From 6a5590eadac1e19122267db5b0ebc63b5df6c1a3 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Fri, 15 Jan 2021 10:33:55 -0500 Subject: [PATCH] LP1929741 Angular Selection List / Po Seed Data PO and lineitem worksheet print templates. Workstation preferences for grids and lineitem list page size. Signed-off-by: Bill Erickson Signed-off-by: Galen Charlton Signed-off-by: Jane Sandberg --- .../Pg/upgrade/XXXX.data.picklist-po-angular.sql | 162 +++++++++++++++++++++ 1 file changed, 162 insertions(+) create mode 100644 Open-ILS/src/sql/Pg/upgrade/XXXX.data.picklist-po-angular.sql diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.picklist-po-angular.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.picklist-po-angular.sql new file mode 100644 index 0000000000..674d1a3ecc --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.picklist-po-angular.sql @@ -0,0 +1,162 @@ +BEGIN; + +--SELECT evergreen.upgrade_deps_block_check('TODO', :eg_version); + +INSERT INTO config.workstation_setting_type (name, grp, datatype, label) +VALUES ( + 'eg.grid.acq.lineitem.history', 'gui', 'object', + oils_i18n_gettext( + 'eg.grid.acq.lineitem.history', + 'Grid Config: Acq Lineitem History', + 'cwst', 'label' + ) +), ( + 'eg.grid.acq.po.history', 'gui', 'object', + oils_i18n_gettext( + 'eg.grid.acq.po.history', + 'Grid Config: Acq PO History', + 'cwst', 'label' + ) +), ( + 'eg.grid.acq.po.edi_messages', 'gui', 'object', + oils_i18n_gettext( + 'eg.grid.acq.po.edi_messages', + 'Grid Config: Acq PO EDI Messages', + 'cwst', 'label' + ) +), ( + 'acq.lineitem.page_size', 'gui', 'integer', + oils_i18n_gettext( + 'acq.lineitem.page_size', + 'ACQ Lineitem List Page Size', + 'cwst', 'label' + ) +); + +INSERT INTO config.print_template + (id, name, label, owner, active, locale, template) +VALUES ( + 4, 'lineitem_worksheet', 'Lineitem Worksheet', 1, TRUE, 'en-US', +$TEMPLATE$ +[%- + USE money=format('%.2f'); + SET li = template_data.lineitem; + SET title = ''; + SET author = ''; + FOREACH attr IN li.attributes; + IF attr.attr_type == 'lineitem_marc_attr_definition'; + IF attr.attr_name == 'title'; + title = attr.attr_value; + ELSIF attr.attr_name == 'author'; + author = attr.attr_value; + END; + END; + END; +-%] + +
Title: [% title.substr(0, 80) %][% IF title.length > 80 %]...[% END %]
+
Author: [% author %]
+
Item Count: [% li.lineitem_details.size %]
+
Lineitem ID: [% li.id %]
+
PO # : [% li.purchase_order%]
+
Est. Price: [% money(li.estimated_unit_price) %]
+ +$TEMPLATE$ +); + +INSERT INTO config.print_template + (id, name, label, owner, active, locale, template) +VALUES (5, 'purchase_order', 'Purchase Order', 1, TRUE, 'en-US', +$TEMPLATE$ + +[%- + USE date; + USE String; + USE money=format('%.2f'); + SET po = template_data.po; + + # 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; + + BLOCK get_li_order_attr_value; + FOR attr IN li.attributes; + IF attr.order_ident == 't'; + attr.attr_value; + LAST; + END; + END; + END; +-%] + + + + + + + + + + + + + + + + +[% + SET subtotal = 0; + FOR li IN po.lineitems; + + SET idval = ''; + IF vendnum != ''; + idval = PROCESS get_li_attr attr_name = 'vendor_num'; + END; + IF !idval; + idval = PROCESS get_li_order_attr_value; + END; +-%] + + + + + + + + [%- + SET count = li.lineitem_details.size; + SET price = li.estimated_unit_price; + SET itotal = (price * count); + %] + + + + + [% END %] + + +
PO#Line#ISBN / Item # / Charge TypeTitleAuthorPub InfoQuantityUnit PriceLine Total
[% po.id %][% li.id %][% idval %][% PROCESS get_li_attr attr_name = 'title' %][% PROCESS get_li_attr attr_name = 'author' %] +
+ [% PROCESS get_li_attr attr_name = 'publisher' %], + [% PROCESS get_li_attr attr_name = 'pubdate' %] +
+
Edition: [% PROCESS get_li_attr attr_name = 'edition' %]
+
[% count %][% money(price) %][% money(litotal) %]
+ + + +$TEMPLATE$ +); + + +COMMIT; + + -- 2.11.0