]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/sql/Pg/upgrade/0457.data.acqinv.print.sql
LP#1759238: stamping upgrade script
[Evergreen.git] / Open-ILS / src / sql / Pg / upgrade / 0457.data.acqinv.print.sql
1 BEGIN;
2
3 INSERT INTO config.upgrade_log VALUES ('0457');
4
5 UPDATE action_trigger.event_definition SET template = $$[% FILTER collapse %]
6 [%- SET invoice = target -%]
7 <!-- This lacks general refinement -->
8 <div class="acq-invoice-voucher">
9     <h1>Invoice</h1>
10     <div>
11         <strong>No.</strong> [% invoice.inv_ident %]
12         [% IF invoice.inv_type %]
13             / <strong>Type:</strong>[% invoice.inv_type %]
14         [% END %]
15     </div>
16     <div>
17         <dl>
18             [% BLOCK ent_with_address %]
19             <dt>[% ent_label %]: [% ent.name %] ([% ent.code %])</dt>
20             <dd>
21                 [% IF ent.addresses.0 %]
22                     [% SET addr = ent.addresses.0 %]
23                     [% addr.street1 %]<br />
24                     [% IF addr.street2 %][% addr.street2 %]<br />[% END %]
25                     [% addr.city %],
26                     [% IF addr.county %] [% addr.county %], [% END %]
27                     [% IF addr.state %] [% addr.state %] [% END %]
28                     [% IF addr.post_code %][% addr.post_code %][% END %]<br />
29                     [% IF addr.country %] [% addr.country %] [% END %]
30                 [% END %]
31                 <p>
32                     [% IF ent.phone %] Phone: [% ent.phone %]<br />[% END %]
33                     [% IF ent.fax_phone %] Fax: [% ent.fax_phone %]<br />[% END %]
34                     [% IF ent.url %] URL: [% ent.url %]<br />[% END %]
35                     [% IF ent.email %] E-mail: [% ent.email %] [% END %]
36                 </p>
37             </dd>
38             [% END %]
39             [% INCLUDE ent_with_address
40                 ent = invoice.provider
41                 ent_label = "Provider" %]
42             [% INCLUDE ent_with_address
43                 ent = invoice.shipper
44                 ent_label = "Shipper" %]
45             <dt>Receiver</dt>
46             <dd>
47                 [% invoice.receiver.name %] ([% invoice.receiver.shortname %])
48             </dd>
49             <dt>Received</dt>
50             <dd>
51                 [% helpers.format_date(invoice.recv_date) %] by
52                 [% invoice.recv_method %]
53             </dd>
54             [% IF invoice.note %]
55                 <dt>Note</dt>
56                 <dd>
57                     [% invoice.note %]
58                 </dd>
59             [% END %]
60         </dl>
61     </div>
62     <ul>
63         [% FOR entry IN invoice.entries %]
64             <li>
65                 [% IF entry.lineitem %]
66                     Title: [% helpers.get_li_attr(
67                         "title", "", entry.lineitem.attributes
68                     ) %]<br />
69                     Author: [% helpers.get_li_attr(
70                         "author", "", entry.lineitem.attributes
71                     ) %]
72                 [% END %]
73                 [% IF entry.purchase_order %]
74                     (PO: [% entry.purchase_order.name %])
75                 [% END %]<br />
76                 Invoice item count: [% entry.inv_item_count %]
77                 [% IF entry.phys_item_count %]
78                     / Physical item count: [% entry.phys_item_count %]
79                 [% END %]
80                 <br />
81                 [% IF entry.cost_billed %]
82                     Cost billed: [% entry.cost_billed %]
83                     [% IF entry.billed_per_item %](per item)[% END %]
84                     <br />
85                 [% END %]
86                 [% IF entry.actual_cost %]
87                     Actual cost: [% entry.actual_cost %]<br />
88                 [% END %]
89                 [% IF entry.amount_paid %]
90                     Amount paid: [% entry.amount_paid %]<br />
91                 [% END %]
92                 [% IF entry.note %]Note: [% entry.note %][% END %]
93             </li>
94         [% END %]
95         [% FOR item IN invoice.items %]
96             <li>
97                 [% IF item.inv_item_type %]
98                     Item Type: [% item.inv_item_type %]<br />
99                 [% END %]
100                 [% IF item.title %]Title/Description:
101                     [% item.title %]<br />
102                 [% END %]
103                 [% IF item.author %]Author: [% item.author %]<br />[% END %]
104                 [% IF item.purchase_order %]PO: [% item.purchase_order %]<br />[% END %]
105                 [% IF item.note %]Note: [% item.note %]<br />[% END %]
106                 [% IF item.cost_billed %]
107                     Cost billed: [% item.cost_billed %]<br />
108                 [% END %]
109                 [% IF item.actual_cost %]
110                     Actual cost: [% item.actual_cost %]<br />
111                 [% END %]
112                 [% IF item.amount_paid %]
113                     Amount paid: [% item.amount_paid %]<br />
114                 [% END %]
115             </li>
116         [% END %]
117     </ul>
118     <div>
119         Amounts spent per fund:
120         <table>
121         [% FOR blob IN user_data %]
122             <tr>
123                 <th style="text-align: left;">[% blob.fund.code %] ([% blob.fund.year %]):</th>
124                 <td>$[% blob.total %]</td>
125             </tr>
126         [% END %]
127         </table>
128     </div>
129 </div>
130 [% END %]$$ WHERE id = 22;
131
132 COMMIT;