[open-ils-commits] r15793 - in trunk/Open-ILS/src/sql/Pg: . upgrade (erickson)

svn at svn.open-ils.org svn at svn.open-ils.org
Thu Mar 11 10:32:26 EST 2010


Author: erickson
Date: 2010-03-11 10:32:24 -0500 (Thu, 11 Mar 2010)
New Revision: 15793

Added:
   trunk/Open-ILS/src/sql/Pg/upgrade/0189.data.po_print_template.sql
Modified:
   trunk/Open-ILS/src/sql/Pg/002.schema.config.sql
   trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql
Log:
update PO printout to include vendor-public PO and LI notes

Modified: trunk/Open-ILS/src/sql/Pg/002.schema.config.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/002.schema.config.sql	2010-03-11 15:00:22 UTC (rev 15792)
+++ trunk/Open-ILS/src/sql/Pg/002.schema.config.sql	2010-03-11 15:32:24 UTC (rev 15793)
@@ -51,7 +51,7 @@
     install_date    TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
 );
 
-INSERT INTO config.upgrade_log (version) VALUES ('0188'); -- miker
+INSERT INTO config.upgrade_log (version) VALUES ('0189'); -- berick
 
 CREATE TABLE config.bib_source (
 	id		SERIAL	PRIMARY KEY,

Modified: trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql	2010-03-11 15:00:22 UTC (rev 15792)
+++ trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql	2010-03-11 15:32:24 UTC (rev 15793)
@@ -3008,6 +3008,7 @@
 <style>
     table td { padding:5px; border:1px solid #aaa;}
     table { width:95%; border-collapse:collapse; }
+    #vendor-notes { padding:5px; border:1px solid #aaa; }
 </style>
 <table id='vendor-table'>
   <tr>
@@ -3034,7 +3035,18 @@
   </tr>
 </table>
 
-<br/><br/><br/>
+<br/><br/>
+<fieldset id='vendor-notes'>
+    <legend>Notes to the Vendor</legend>
+    <ul>
+    [% FOR note IN target.notes %]
+        [% IF note.vendor_public == 't' %]
+            <li>[% note.value %]</li>
+        [% END %]
+    [% END %]
+    </ul>
+</fieldset>
+<br/><br/>
 
 <table>
   <thead>
@@ -3045,6 +3057,7 @@
       <th>Quantity</th>
       <th>Unit Price</th>
       <th>Line Total</th>
+      <th>Notes</th>
     </tr>
   </thead>
   <tbody>
@@ -3054,7 +3067,7 @@
 
   <tr>
     [% count = li.lineitem_details.size %]
-    [% price = PROCESS get_li_attr attr_name = 'estimated_price' %]
+    [% price = li.estimated_unit_price %]
     [% litotal = (price * count) %]
     [% subtotal = subtotal + litotal %]
     [% isbn = PROCESS get_li_attr attr_name = 'isbn' %]
@@ -3066,6 +3079,15 @@
     <td>[% count %]</td>
     <td>[% price %]</td>
     <td>[% litotal %]</td>
+    <td>
+        <ul>
+        [% FOR note IN li.lineitem_notes %]
+            [% IF note.vendor_public == 't' %]
+                <li>[% note.value %]</li>
+            [% END %]
+        [% END %]
+        </ul>
+    </td>
   </tr>
   [% END %]
   <tr>
@@ -3088,7 +3110,9 @@
     (4, 'ordering_agency.mailing_address'),
     (4, 'ordering_agency.billing_address'),
     (4, 'provider.addresses'),
-    (4, 'lineitems.attributes');
+    (4, 'lineitems.attributes'),
+    (4, 'lineitems.lineitem_notes'),
+    (4, 'notes');
 
 
 INSERT INTO action_trigger.event_definition (id, active, owner, name, hook, validator, reactor, delay, delay_field, group_field, template)

Added: trunk/Open-ILS/src/sql/Pg/upgrade/0189.data.po_print_template.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/upgrade/0189.data.po_print_template.sql	                        (rev 0)
+++ trunk/Open-ILS/src/sql/Pg/upgrade/0189.data.po_print_template.sql	2010-03-11 15:32:24 UTC (rev 15793)
@@ -0,0 +1,131 @@
+
+BEGIN;
+
+INSERT INTO config.upgrade_log (version) VALUES ('0189'); 
+
+UPDATE action_trigger.event_definition SET template = 
+$$
+[%- USE date -%]
+[%-
+    # 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
+-%]
+
+<h2>Purchase Order [% target.id %]</h2>
+<br/>
+date <b>[% date.format(date.now, '%Y%m%d') %]</b>
+<br/>
+
+<style>
+    table td { padding:5px; border:1px solid #aaa;}
+    table { width:95%; border-collapse:collapse; }
+    #vendor-notes { padding:5px; border:1px solid #aaa; }
+</style>
+<table id='vendor-table'>
+  <tr>
+    <td valign='top'>Vendor</td>
+    <td>
+      <div>[% target.provider.name %]</div>
+      <div>[% target.provider.addresses.0.street1 %]</div>
+      <div>[% target.provider.addresses.0.street2 %]</div>
+      <div>[% target.provider.addresses.0.city %]</div>
+      <div>[% target.provider.addresses.0.state %]</div>
+      <div>[% target.provider.addresses.0.country %]</div>
+      <div>[% target.provider.addresses.0.post_code %]</div>
+    </td>
+    <td valign='top'>Ship to / Bill to</td>
+    <td>
+      <div>[% target.ordering_agency.name %]</div>
+      <div>[% target.ordering_agency.billing_address.street1 %]</div>
+      <div>[% target.ordering_agency.billing_address.street2 %]</div>
+      <div>[% target.ordering_agency.billing_address.city %]</div>
+      <div>[% target.ordering_agency.billing_address.state %]</div>
+      <div>[% target.ordering_agency.billing_address.country %]</div>
+      <div>[% target.ordering_agency.billing_address.post_code %]</div>
+    </td>
+  </tr>
+</table>
+
+<br/><br/>
+<fieldset id='vendor-notes'>
+    <legend>Notes to the Vendor</legend>
+    <ul>
+    [% FOR note IN target.notes %]
+        [% IF note.vendor_public == 't' %]
+            <li>[% note.value %]</li>
+        [% END %]
+    [% END %]
+    </ul>
+</fieldset>
+<br/><br/>
+
+<table>
+  <thead>
+    <tr>
+      <th>PO#</th>
+      <th>ISBN or Item #</th>
+      <th>Title</th>
+      <th>Quantity</th>
+      <th>Unit Price</th>
+      <th>Line Total</th>
+      <th>Notes</th>
+    </tr>
+  </thead>
+  <tbody>
+
+  [% subtotal = 0 %]
+  [% FOR li IN target.lineitems %]
+
+  <tr>
+    [% 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' %]
+
+    <td>[% target.id %]</td>
+    <td>[% isbn || ident %]</td>
+    <td>[% PROCESS get_li_attr attr_name = 'title' %]</td>
+    <td>[% count %]</td>
+    <td>[% price %]</td>
+    <td>[% litotal %]</td>
+    <td>
+        <ul>
+        [% FOR note IN li.lineitem_notes %]
+            [% IF note.vendor_public == 't' %]
+                <li>[% note.value %]</li>
+            [% END %]
+        [% END %]
+        </ul>
+    </td>
+  </tr>
+  [% END %]
+  <tr>
+    <td/><td/><td/><td/>
+    <td>Sub Total</td>
+    <td>[% subtotal %]</td>
+  </tr>
+  </tbody>
+</table>
+
+<br/>
+
+Total Line Item Count: [% target.lineitems.size %]
+$$
+WHERE id = 4;
+
+INSERT INTO action_trigger.environment (event_def, path) VALUES 
+    (4, 'lineitems.lineitem_notes'),
+    (4, 'notes');
+
+COMMIT;



More information about the open-ils-commits mailing list