3 INSERT INTO config.upgrade_log (version) VALUES ('0240'); -- senator
5 INSERT INTO action_trigger.hook (key, core_type, description, passive)
9 'Formats invoices into a voucher',
13 INSERT INTO action_trigger.event_definition (
14 id, active, owner, name, hook,
15 validator, reactor, granularity, template
27 [%- SET invoice = target -%]
28 <!-- This lacks totals, info about funds (for invoice entries,
29 funds are per-LID!), and general refinement -->
30 <div class="acq-invoice-voucher">
33 <strong>No.</strong> [% invoice.inv_ident %]
34 [% IF invoice.inv_type %]
35 / <strong>Type:</strong>[% invoice.inv_type %]
40 [% BLOCK ent_with_address %]
41 <dt>[% ent_label %]: [% ent.name %] ([% ent.code %])</dt>
43 [% IF ent.addresses.0 %]
44 [% SET addr = ent.addresses.0 %]
45 [% addr.street1 %]<br />
46 [% IF addr.street2 %][% addr.street2 %]<br />[% END %]
48 [% IF addr.county %] [% addr.county %], [% END %]
49 [% IF addr.state %] [% addr.state %] [% END %]
50 [% IF addr.post_code %][% addr.post_code %][% END %]<br />
51 [% IF addr.country %] [% addr.country %] [% END %]
54 [% IF ent.phone %] Phone: [% ent.phone %]<br />[% END %]
55 [% IF ent.fax_phone %] Fax: [% ent.fax_phone %]<br />[% END %]
56 [% IF ent.url %] URL: [% ent.url %]<br />[% END %]
57 [% IF ent.email %] E-mail: [% ent.email %] [% END %]
61 [% INCLUDE ent_with_address
62 ent = invoice.provider
63 ent_label = "Provider" %]
64 [% INCLUDE ent_with_address
66 ent_label = "Shipper" %]
69 [% invoice.receiver.name %] ([% invoice.receiver.shortname %])
73 [% helpers.format_date(invoice.recv_date) %] by
74 [% invoice.recv_method %]
85 [% FOR entry IN invoice.entries %]
87 [% IF entry.lineitem %]
88 Title: [% helpers.get_li_attr(
89 "title", "", entry.lineitem.attributes
91 Author: [% helpers.get_li_attr(
92 "author", "", entry.lineitem.attributes
95 [% IF entry.purchase_order %]
96 (PO: [% entry.purchase_order.name %])
98 Invoice item count: [% entry.inv_item_count %]
99 [% IF entry.phys_item_count %]
100 / Physical item count: [% entry.phys_item_count %]
103 [% IF entry.cost_billed %]
104 Cost billed: [% entry.cost_billed %]
105 [% IF entry.billed_per_item %](per item)[% END %]
108 [% IF entry.actual_cost %]
109 Actual cost: [% entry.actual_cost %]<br />
111 [% IF entry.amount_paid %]
112 Amount paid: [% entry.amount_paid %]<br />
114 [% IF entry.note %]Note: [% entry.note %][% END %]
117 [% FOR item IN invoice.items %]
119 [% IF item.inv_item_type %]
120 Item Type: [% item.inv_item_type %]<br />
122 [% IF item.title %]Title/Description:
123 [% item.title %]<br />
125 [% IF item.author %]Author: [% item.author %]<br />[% END %]
126 [% IF item.purchase_order %]PO: [% item.purchase_order %]<br />[% END %]
127 [% IF item.note %]Note: [% item.note %]<br />[% END %]
128 [% IF item.cost_billed %]
129 Cost billed: [% item.cost_billed %]<br />
131 [% IF item.actual_cost %]
132 Actual cost: [% item.actual_cost %]<br />
134 [% IF item.amount_paid %]
135 Amount paid: [% item.amount_paid %]<br />
146 INSERT INTO action_trigger.environment (event_def, path) VALUES
148 (22, 'provider.addresses'),
150 (22, 'shipper.addresses'),
153 (22, 'entries.purchase_order'),
154 (22, 'entries.lineitem'),
155 (22, 'entries.lineitem.attributes'),