From 09f0ace38339bfb2094b842d1217eeda0d5c77cb Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Fri, 20 Nov 2015 13:59:08 -0500 Subject: [PATCH] RT86770 PO print lineitem counts & order date Signed-off-by: Bill Erickson --- .../schema/deploy/po-print-li-count-and-date.sql | 214 +++++++++++++++++++++ .../schema/revert/po-print-li-count-and-date.sql | 210 ++++++++++++++++++++ KCLS/sql/schema/sqitch.plan | 1 + .../schema/verify/po-print-li-count-and-date.sql | 7 + 4 files changed, 432 insertions(+) create mode 100644 KCLS/sql/schema/deploy/po-print-li-count-and-date.sql create mode 100644 KCLS/sql/schema/revert/po-print-li-count-and-date.sql create mode 100644 KCLS/sql/schema/verify/po-print-li-count-and-date.sql diff --git a/KCLS/sql/schema/deploy/po-print-li-count-and-date.sql b/KCLS/sql/schema/deploy/po-print-li-count-and-date.sql new file mode 100644 index 0000000000..b7384bc23b --- /dev/null +++ b/KCLS/sql/schema/deploy/po-print-li-count-and-date.sql @@ -0,0 +1,214 @@ +-- Deploy kcls-evergreen:po-print-li-count-and-date to pg +-- requires: blanket-po-print-template + +BEGIN; + +UPDATE action_trigger.event_definition SET template = +$TMPL$ +[% USE date %] +[% USE String %] +[% USE money=format('%.2f') -%] +[%- + # find a lineitem attribute by name and optional type + BLOCK get_li_attr; + FOR attr IN li.attributes; + IF attr.attr_name == attr_name; + IF !attr_type OR attr_type == attr.attr_type; + attr.attr_value; + LAST; + END; + END; + END; + END +-%] +kcls_brandmark +

Purchase Order [% target.id %]

+
+
+[% newstring = target.order_date | truncate(10,'')%] +[% newstring2 = "$newstring 00:00:00" %] +date [% date.format(newstring2, '%m/%d/%Y') %] +
+ + + + + + + + + +
Vendor +
[% target.provider.name %]
+
[% target.provider.addresses.0.street1 %]
+
[% target.provider.addresses.0.street2 %]
+
[% target.provider.addresses.0.city %] [% target.provider.addresses.0.state %] [% target.provider.addresses.0.post_code %]
+ +
[% target.provider.addresses.0.country %]
+ +
Ship to / Bill to +
KING COUNTY LIBRARY SYSTEM
+
ATTN: ORDER DEPT
+
960 NEWPORT WAY NW
+
ISSAQUAH WA 98027
+ +
+ +

+
+ Notes to the Vendor +
    + [% FOR note IN target.notes %] + [% IF note.vendor_public == 't' %] +
  • [% note.value %]
  • + [% END %] + [% END %] +
+
+

+ + + + + + + + + + + + + + + + + + + [% subtotal = 0 %] + [% FOR li IN target.lineitems %] + + + [% count = li.lineitem_details.size %] + [% price = li.estimated_unit_price %] + [% litotal = (price * count) %] + [% subtotal = subtotal + litotal %] + [% isbn = PROCESS get_li_attr attr_name = 'isbn' %] + [% ident = PROCESS get_li_attr attr_name = 'identifier' %] + [% upc = PROCESS get_li_attr attr_name = 'bupc' %] + [% author = PROCESS get_li_attr attr_name = 'author' %] + [% publisher = PROCESS get_li_attr attr_name = 'publisher' %] + [% pubdate = PROCESS get_li_attr attr_name = 'pubdate' %] + [% edition = PROCESS get_li_attr attr_name = 'edition' %] + [% vendnum = PROCESS get_li_attr attr_name = 'vendor_num' %] +[%- + idval = ''; + idqual = 'EN'; # default ISBN/UPC/EAN-13 + ident_attr = helpers.get_li_order_ident(li.attributes); + IF ident_attr; + idname = ident_attr.attr_name; + idval = ident_attr.attr_value; + IF idname == 'isbn' AND idval.length != 13; + idqual = 'IB'; + ELSIF idname == 'issn'; + idqual = 'IS'; + END; + + ELSE; + idqual = 'IN'; + idval = ''; + END -%] + +[%- IF vendnum != ''; + idval = PROCESS get_li_attr attr_name = 'vendor_num'; + END; +-%] + + + + + + + + + + + + [% END %] + [% total_count = target.lineitems.size %] + [% FOR charge IN target.po_items %] + [% subtotal = subtotal + charge.estimated_cost; + # a blanket charge is considered a single purchase. + IF charge.inv_item_type.blanket == 't'; + total_count = total_count + 1; + END; + %] + + + + + + + + + + + [%# po_item.note has no concept of vendor-public, + so avoid displaying it by default %] + + + [% END %] + + + + + + + + +
PO#LineISBN / Item # / Charge TypeTitleAuthorPub InfoQuantityUnit PriceLine TotalNotes
[% target.id %][% li.id %][% idval %][% PROCESS get_li_attr attr_name = 'title' %] [% author %][% publisher %] , [% pubdate %]
Edition: [% edition %]
[% count %][% price %][% money(litotal) %] +
    + [% FOR note IN li.lineitem_notes %] + [% IF note.vendor_public == 't' %] +
  • [% note.value %]
  • + [% END %] + [% END %] +
+
[% target.id %][% charge.id %][% charge.inv_item_type.name %][% charge.title %][% charge.author %][% money(charge.estimated_cost) %][% money(charge.estimated_cost) %]
Sub Total[% money(subtotal) %]
+ +
+ +Total Line Item Count:[% total_count %]

+ +

+_____________________________
+Authorized By     +        +        +        +    Date +

+ +

+SHIPPING AND BILLING INSTRUCTIONS
+Use our complete Ship To/Bill To address as given above.
+Report before sending if part of a numbered series, unless series is noted on this order.
+Do not send if price is substantially above our estimate. Please call for confirmation. 425-369-3368
+Send invoice in duplicate to address given above.
+Cite our line item and order number with each item on invoices and/or correspondence.
+Shipments must be insured or sent at agent's risk.
+No COD shipments.
+Questions, call (425) 369-3368
+

+$TMPL$ WHERE id = 4; + + +COMMIT; diff --git a/KCLS/sql/schema/revert/po-print-li-count-and-date.sql b/KCLS/sql/schema/revert/po-print-li-count-and-date.sql new file mode 100644 index 0000000000..659c4fbf03 --- /dev/null +++ b/KCLS/sql/schema/revert/po-print-li-count-and-date.sql @@ -0,0 +1,210 @@ +-- Revert kcls-evergreen:po-print-li-count-and-date from pg + +BEGIN; + +UPDATE action_trigger.event_definition SET template = +$TMPL$ +[% USE String %] +[% USE money=format('%.2f') -%] +[%- + # find a lineitem attribute by name and optional type + BLOCK get_li_attr; + FOR attr IN li.attributes; + IF attr.attr_name == attr_name; + IF !attr_type OR attr_type == attr.attr_type; + attr.attr_value; + LAST; + END; + END; + END; + END +-%] +kcls_brandmark +

Purchase Order [% target.id %]

+
+
+[% newstring = target.order_date | truncate(10,'')%] +[% newstring2 = "$newstring 00:00:00" %] +date [% date.format(newstring2, '%m/%d/%Y') %] +
+ + + + + + + + + +
Vendor +
[% target.provider.name %]
+
[% target.provider.addresses.0.street1 %]
+
[% target.provider.addresses.0.street2 %]
+
[% target.provider.addresses.0.city %] [% target.provider.addresses.0.state %] [% target.provider.addresses.0.post_code %]
+ +
[% target.provider.addresses.0.country %]
+ +
Ship to / Bill to +
KING COUNTY LIBRARY SYSTEM
+
ATTN: ORDER DEPT
+
960 NEWPORT WAY NW
+
ISSAQUAH WA 98027
+ +
+ +

+
+ Notes to the Vendor +
    + [% FOR note IN target.notes %] + [% IF note.vendor_public == 't' %] +
  • [% note.value %]
  • + [% END %] + [% END %] +
+
+

+ + + + + + + + + + + + + + + + + + + [% subtotal = 0 %] + [% FOR li IN target.lineitems %] + + + [% count = li.lineitem_details.size %] + [% price = li.estimated_unit_price %] + [% litotal = (price * count) %] + [% subtotal = subtotal + litotal %] + [% isbn = PROCESS get_li_attr attr_name = 'isbn' %] + [% ident = PROCESS get_li_attr attr_name = 'identifier' %] + [% upc = PROCESS get_li_attr attr_name = 'bupc' %] + [% author = PROCESS get_li_attr attr_name = 'author' %] + [% publisher = PROCESS get_li_attr attr_name = 'publisher' %] + [% pubdate = PROCESS get_li_attr attr_name = 'pubdate' %] + [% edition = PROCESS get_li_attr attr_name = 'edition' %] + [% vendnum = PROCESS get_li_attr attr_name = 'vendor_num' %] +[%- + idval = ''; + idqual = 'EN'; # default ISBN/UPC/EAN-13 + ident_attr = helpers.get_li_order_ident(li.attributes); + IF ident_attr; + idname = ident_attr.attr_name; + idval = ident_attr.attr_value; + IF idname == 'isbn' AND idval.length != 13; + idqual = 'IB'; + ELSIF idname == 'issn'; + idqual = 'IS'; + END; + + ELSE; + idqual = 'IN'; + idval = ''; + END -%] + +[%- IF vendnum != ''; + idval = PROCESS get_li_attr attr_name = 'vendor_num'; + END; +-%] + + + + + + + + + + + + [% END %] + [% FOR charge IN target.po_items %] + [% subtotal = subtotal + charge.estimated_cost; + # a blanket charge is considered a single purchase. + IF charge.inv_item_type.blanket == 't'; + total_count = total + 1; + END; + %] + + + + + + + + + + + [%# po_item.note has no concept of vendor-public, + so avoid displaying it by default %] + + + [% END %] + + + + + + + + +
PO#LineISBN / Item # / Charge TypeTitleAuthorPub InfoQuantityUnit PriceLine TotalNotes
[% target.id %][% li.id %][% idval %][% PROCESS get_li_attr attr_name = 'title' %] [% author %][% publisher %] , [% pubdate %]
Edition: [% edition %]
[% count %][% price %][% money(litotal) %] +
    + [% FOR note IN li.lineitem_notes %] + [% IF note.vendor_public == 't' %] +
  • [% note.value %]
  • + [% END %] + [% END %] +
+
[% target.id %][% charge.id %][% charge.inv_item_type.name %][% charge.title %][% charge.author %][% money(charge.estimated_cost) %][% money(charge.estimated_cost) %]
Sub Total[% money(subtotal) %]
+ +
+ +Total Line Item Count:[% total_count %]

+ +

+_____________________________
+Authorized By     +        +        +        +    Date +

+ +

+SHIPPING AND BILLING INSTRUCTIONS
+Use our complete Ship To/Bill To address as given above.
+Report before sending if part of a numbered series, unless series is noted on this order.
+Do not send if price is substantially above our estimate. Please call for confirmation. 425-369-3368
+Send invoice in duplicate to address given above.
+Cite our line item and order number with each item on invoices and/or correspondence.
+Shipments must be insured or sent at agent's risk.
+No COD shipments.
+Questions, call (425) 369-3368
+

+$TMPL$ WHERE id = 4; + +COMMIT; diff --git a/KCLS/sql/schema/sqitch.plan b/KCLS/sql/schema/sqitch.plan index 0ed9546624..254a844b52 100644 --- a/KCLS/sql/schema/sqitch.plan +++ b/KCLS/sql/schema/sqitch.plan @@ -14,3 +14,4 @@ blanket-po [copy-stat-checkout-ok] 2015-08-14T21:03:02Z Bill Erickson # CollectionHQ floating CASE/WHEN fix student-groups [blanket-po] 2015-09-16T14:36:00Z Bill Erickson # New groups for student cards blanket-po-print-template [student-groups] 2015-10-12T15:38:31Z Bill Erickson # Blanket PO print template +po-print-li-count-and-date [blanket-po-print-template] 2015-11-20T18:56:33Z Bill Erickson # Minor PO print template repairs diff --git a/KCLS/sql/schema/verify/po-print-li-count-and-date.sql b/KCLS/sql/schema/verify/po-print-li-count-and-date.sql new file mode 100644 index 0000000000..616f02c574 --- /dev/null +++ b/KCLS/sql/schema/verify/po-print-li-count-and-date.sql @@ -0,0 +1,7 @@ +-- Verify kcls-evergreen:po-print-li-count-and-date on pg + +BEGIN; + +-- XXX Add verifications here. + +ROLLBACK; -- 2.11.0