889080b02dda2921bb4ebeb4bde67bceb8cb362d
[kivitendo-erp.git] / templates / webpages / ap / form_header.html
1 [%- USE L %]
2 [%- USE HTML %]
3 [%- USE T8 %]
4 [%- USE LxERP %][%- USE P -%]
5
6 <form method="post" action="[% script | html %]">
7
8 <input type="hidden" name="terms" value="[% terms | html %]">
9
10 <input type="hidden" name="creditlimit" value="[% creditlimit | html %]">
11 <input type="hidden" name="creditremaining" value="[% creditremaining | html %]">
12
13 <input type="hidden" name="forex" value="[% forex | html %]">
14 <input type="hidden" name="lastmtime" value="[% HTML.escape(lastmtime) %]">
15
16 <input type="hidden" name="id" value="[% id | html %]">
17 <input type="hidden" name="sort" value="[% sort | html %]">
18 <input type="hidden" name="closedto" value="[% closedto | html %]">
19 <input type="hidden" name="locked" value="[% locked | html %]">
20 <input type="hidden" name="title" value="[% title_ | html %]">
21
22 <input type="hidden" name="follow_up_trans_id_1" value="[% id | html %]">
23 <input type="hidden" name="follow_up_trans_type_1" value="ap_transaction">
24 <input type="hidden" name="follow_up_trans_info_1" value="[% follow_up_trans_info | html %]">
25 <input type="hidden" name="follow_up_rowcount" value="1">
26
27 <input type="hidden" name="defaultcurrency" value="[% defaultcurrency | html %]">
28 <input type="hidden" name="fxgain_accno" value="[% fxgain_accno | html %]">
29 <input type="hidden" name="fxloss_accno" value="[% fxloss_accno | html %]">
30
31 <input type="hidden" name="oldinvtotal" value="[% oldinvtotal | html %]">
32 <input type="hidden" name="oldtotalpaid" value="[% oldtotalpaid | html %]">
33
34 <input type="hidden" name="taxaccounts" value="[% taxaccounts | html %]">
35
36 <input type="hidden" name="rowcount" value="[% rowcount | html %]">
37
38 <input type="hidden" name="paidaccounts" value="[% paidaccounts | html %]">
39
40 [% FOREACH i IN [1..paidaccounts] %]
41   [% temp = "acc_trans_id_"_ i %]
42   <input type="hidden" name="[% temp %]" value="[% $temp | html %]">
43
44   [% temp = "gldate_"_ i %]
45   <input type="hidden" name="[% temp %]" value="[% $temp | html %]">
46 [% END %]
47
48 <h1>[% title | html %]</h1>
49
50 [% IF ( saved_message ) %]
51   <p>[% saved_message | html %]</p>
52 [% END %]
53
54 <div id="ap_tabs" class="tabwidget">
55  <ul>
56   <li><a href="#ui-tabs-basic-data">[% 'Basic Data' | $T8 %]</a></li>
57 [%- IF INSTANCE_CONF.get_webdav %]
58   <li><a href="#ui-tabs-webdav">[% 'WebDAV' | $T8 %]</a></li>
59 [%- END %]
60 [%- IF id %]
61   [%- IF AUTH.assert('record_links', 1) %]
62   <li><a href="controller.pl?action=RecordLinks/ajax_list&object_model=PurchaseInvoice&object_id=[% HTML.url(id) %]">[% 'Linked Records' | $T8 %]</a></li>
63   [%- END %]
64   <li><a href="[% 'controller.pl?action=AccTrans/list_transactions&trans_id=' _ HTML.url(id) | html %]">[% LxERP.t8('Transactions') %]</a></li>
65 [%- END %]
66  </ul>
67
68 <div id="ui-tabs-basic-data">
69 <table width="100%">
70   <tr valign="top">
71     <td>
72       <table width="100%">
73         <tr valign="top">
74           <td>
75             <table>
76               <tr>
77                 <th align="right" nowrap>[% 'Vendor' | $T8 %]</th>
78                 <td colspan="3">
79                  [% P.customer_vendor_picker("vendor_id", vendor_id, type="vendor", style="width: 300px") %]
80                  [% L.button_tag("show_vc_details('vendor')", LxERP.t8('Details (one letter abbreviation)')) %]
81                  [% L.hidden_tag("previous_vendor_id", vendor_id) %]
82                 </td>
83               </tr>
84
85               <tr>
86                 <th align="right" valign="top">[% LxERP.t8("Credit Limit") %]</th>
87                 <td>
88                  [% creditlimit | html %];
89                  [% LxERP.t8("Remaining") %]
90                  <span class="plus[% creditremaining_plus %]">[% creditremaining | html %]</span>
91                 </td>
92               </tr>
93
94 [%- IF invoice_obj.sepa_exports.as_list.size %]
95               <tr>
96                 <th align="right">[% LxERP.t8("SEPA exports") %]</th>
97                 <td>
98                  [% FOREACH export = invoice_obj.sepa_exports.as_list %]
99                   <a href="sepa.pl?action=bank_transfer_edit&vc=vendor&id=[% HTML.url(export.id) %]">[% HTML.escape(export.id) %]</a>
100                   [% UNLESS loop.last %], [% END %]
101                  [% END %]
102                 </td>
103               </tr>
104 [%- END %]
105
106               <tr>
107                 <th align="right" nowrap>[% 'Currency' | $T8 %]</th>
108                 <td>[% L.select_tag("currency", currencies, default=currency, value_key="name", title_key="name") %]</td>
109
110                 [% IF ( defaultcurrency && (currency != defaultcurrency) ) %]
111                   <th align=right>[% 'Exchangerate' | $T8 %]</th>
112                   [% IF ( forex ) %]
113                     <td><input type="hidden" name="exchangerate" value="[% exchangerate | html %]">[% exchangerate | html %]</td>
114                   [% ELSE %]
115                     <td><input type="text" name="exchangerate" size="10" value="[% exchangerate | html %]"></td>
116                   [% END %]
117                 [% END %]
118
119               </tr>
120
121               [% IF ALL_DEPARTMENTS %]
122                 <tr>
123                   <th align="right" nowrap>[% 'Department' | $T8 %]</th>
124                   <td colspan=3>[% L.select_tag('department_id', ALL_DEPARTMENTS, default = department_id, title_key = 'description', with_empty = 1) %]</td>
125                 </tr>
126               [% END %]
127
128               <tr>
129                 <td align="right"><input name="taxincluded" class="checkbox" type="checkbox" value="1" [% IF ( taxincluded ) %]checked[% END %]></td>
130                 <th align=left nowrap>[% 'Tax Included' | $T8 %]</th>
131               </tr>
132               <tr>
133                 <td align="right"><input name="direct_debit" class="checkbox" type="checkbox" value="1" [% IF direct_debit %]checked[% END %]></td>
134                 <th align="left" nowrap>[% 'direct debit' | $T8 %]</th>
135               </tr>
136             </table>
137           </td>
138
139           <td align="right">
140             <table>
141               <tr>
142                 <th align="right" nowrap>[% 'Invoice Number' | $T8 %]</th>
143                 <td><input name="invnumber" size="11" value="[% invnumber | html %]" [% readonly %]></td>
144               </tr>
145               <tr>
146                 <th align="right" nowrap>[% 'Order Number' | $T8 %]</th>
147                 <td><input name="ordnumber" size="11" value="[% ordnumber | html %]" [% readonly %]></td>
148               </tr>
149               <tr>
150                 <th align="right" nowrap>[% 'Invoice Date' | $T8 %]</th>
151                 <td>[% L.date_tag('transdate', transdate) %]</td>
152               </tr>
153               <tr>
154                 <th align="right" nowrap>[% 'Due Date' | $T8 %]</th>
155                 <td>[% L.date_tag('duedate', duedate) %]</td>
156               </tr>
157               <tr>
158                 <th align="right" nowrap>[% 'Project Number' | $T8 %]</th>
159                 <td>
160                   [% L.select_tag('globalproject_id', ALL_PROJECTS, with_empty = 1, default = globalproject_id, value_key = 'id', title_key = 'projectnumber', onChange = "document.getElementById('update_button').click();") %]
161                 </td>
162               </tr>
163             </table>
164           </td>
165         </tr>
166       </table>
167     </td>
168   </tr>
169
170   <tr>
171     <td>
172       <table width=100%>
173         <tr class=listheading>
174           <th class=listheading style="width:15%">[% 'Account' | $T8 %]</th>
175           <th class=listheading style="width:10%">[% 'Amount' | $T8 %]</th>
176           <th class=listheading style="width:10%">[% 'Tax' | $T8 %]</th>
177           <th class=listheading style="width:10%">[% 'Taxkey' | $T8 %]</th>
178           <th class=listheading style="width:10%">[% 'Project' | $T8 %]</th>
179         </tr>
180
181         [% FOREACH i IN [1..rowcount] %]
182           <tr>
183             <td>
184               [% SET selected_chart_id = "AP_amount_chart_id_"_ i %]
185               [% P.chart_picker("AP_amount_chart_id_" _ i, $selected_chart_id, style="width: 400px", type="AP_amount", class=(initial_focus == 'row_' _ i ? "initial_focus" : "")) %]
186               [% L.hidden_tag("previous_AP_amount_chart_id_" _ i, $selected_chart_id) %]
187               <input type="hidden" name="tax_[% i %]" value="[% temp = "tax"_ i %][% $temp | html %]">
188             </td>
189             <td>
190               <input name="amount_[% i %]" size="10" value="[% temp = "amount_"_ i %][% $temp | html %]">
191             </td>
192             <td>
193               [% temp = "tax_"_ i %][% $temp | html %]
194             </td>
195             <td>
196               [% temp = 'selected_taxchart_'_ i %]
197               [% taxcharts = 'taxcharts_' _ i %]
198               [% L.select_tag('taxchart_'_ i, $taxcharts, value_title_sub = \taxchart_value_title_sub, default = $temp, style="width: 250px") %]
199             </td>
200             <td>
201               [% temp = "project_id_"_ i %]
202               [% L.select_tag(temp, ALL_PROJECTS, with_empty = 1, default = loop.last ? globalproject_id : $temp, value_key = 'id', title_key = 'projectnumber') %]
203             </td>
204           </tr>
205         [% END %]
206
207         <tr>
208           <td colspan="6">
209             <hr noshade>
210           </td>
211         </tr>
212         <tr>
213           <td>
214             [% P.chart_picker('AP_chart_id', AP_chart_id, style="width: 400px", type="AP") %]
215           </td>
216           <th align="left">[% invtotal | html %]</th>
217           <td colspan="4"></td>
218         </tr>
219       </table>
220      </td>
221     </tr>
222     <tr>
223       <td>
224         <table width="100%">
225         <tr>
226           <th align="left" width="1%">[% 'Notes' | $T8 %]</th>
227           <td align="left">
228             <textarea name="notes" rows="[% textarea_rows %]" cols="50" wrap="soft" [% readonly %]>[% notes | html %]</textarea>
229           </td>
230
231           <th align="left" width=1%>[% 'Notes for vendor' | $T8 %]</th>
232           <td align="left">
233             <textarea name="intnotes" rows="[% textarea_rows %]" cols="50" wrap="soft" readonly>[% intnotes | html %]</textarea>
234           </td>
235         </tr>
236       </table>
237     </td>
238   </tr>
239   <tr>
240     <td>
241       <table width="100%">
242         <tr class="listheading">
243           <th class="listheading" colspan="7">[% 'Payments' | $T8 %]</th>
244         </tr>
245
246         <tr>
247           <th>[% 'Date' | $T8 %]</th>
248           <th>[% 'Source' | $T8 %]</th>
249           <th>[% 'Memo' | $T8 %]</th>
250           <th>[% 'Amount' | $T8 %]</th>
251           <th></th>
252           [% IF ( !defaultcurrency || (currency != defaultcurrency) ) %]
253             <th>[% 'Exch' | $T8 %]</th>
254           [% END %]
255           <th>[% 'Account' | $T8 %]</th>
256           <th>[% 'Project Number' | $T8 %]</th>
257         </tr>
258
259         [% FOREACH i IN [1..paidaccounts] %]
260           [% temp = "paidaccount_changeable_"_ i %]
261           [% changeable = $temp %]
262
263           <tr>
264             [% temp = "datepaid_"_ i %]
265             <td align="center">
266               [% IF( changeable ) %]
267                 [% L.date_tag(temp, $temp ? $temp : today) %]
268               [% ELSE %]
269                 [% $temp | html %]
270                 <input type="hidden" name="[% temp %]" value="[% $temp | html %]">
271               [% END %]
272             </td>
273
274             [% temp = "source_"_ i %]
275             <td align="center">
276               [% IF( changeable ) %]
277                 <input name="[% temp %]" size="11" value="[% $temp | html %]">
278               [% ELSE %]
279                 [% $temp | html %]
280                 <input type="hidden" name="[% temp %]" value="[% $temp | html %]">
281               [% END %]
282             </td>
283
284             [% temp = "memo_"_ i %]
285             <td align="center">
286               [% IF( changeable ) %]
287                 <input name="[% temp %]" size="11" value="[% $temp | html %]">
288               [% ELSE %]
289                 [% $temp | html %]
290                 <input type="hidden" name="[% temp %]" value="[% $temp | html %]">
291               [% END %]
292             </td>
293
294             [% temp = "paid_"_ i %]
295             <td align="center">
296               [% IF( changeable ) %]
297                 <input name="[% temp %]" size="11" value="[% $temp | html %]" onBlur="check_right_number_format(this);">
298               [% ELSE %]
299                 [% $temp | html %]
300                 <input type="hidden" name="[% temp %]" value="[% $temp | html %]">
301               [% END %]
302             </td>
303
304             <td>
305               [% IF changeable && loop.last && paid_missing > 0 %]
306                 <input type="button" id="ap_set_to_paid_missing" value="[% "Set to paid missing" | $T8 %]">
307               [% END %]
308             </td>
309
310             [% IF ( !defaultcurrency || (currency != defaultcurrency) ) %]
311               <td align="center">
312                 [% temp = "exchangerate_"_ i %]
313                 [% temp_forex = "forex_"_ i %]
314
315                 [% IF( $temp_forex || !changeable ) %]
316                   [% $temp | html %]
317                   <input type="hidden" name="[% temp %]" value="[% $temp | html %]">
318                 [% ELSE %]
319                   <input name="[% temp %]" size="11" value="[% $temp | html %]">
320                 [% END %]
321
322                 <input type=hidden name="[% temp_forex %]" value="[% $temp_forex | html %]">
323               </td>
324             [% END %]
325
326             [% temp = "AP_paid_"_ i %]
327             <td align="center">
328               [% IF( changeable ) %]
329                 [% L.select_tag(temp, ALL_CHARTS_AP_paid, value_title_sub = \AP_paid_value_title_sub, default = ($temp || accno_arap))  %]
330               [% ELSE %]
331                 [% $temp | html %]
332                 <input type="hidden" name="[% temp %]" value="[% $temp | html %]">
333               [% END %]
334             </td>
335
336             <td align="center">
337               [% temp = "paid_project_id_"_ i %]
338               [% IF( changeable ) %]
339                 [% L.select_tag(temp, ALL_PROJECTS, with_empty = 1, default = $temp, value_key = 'id', title_key = 'projectnumber') %]
340               [% ELSE %]
341                 <input type="hidden" name="[% temp %]" value="[% $temp | html %]">
342                 [% temp = "label"_ temp %]
343                 [% $temp | html %]
344               [% END %]
345             </td>
346           </tr>
347         [% END %]
348
349         <tr>
350           <td></td>
351           <td></td>
352           <td align="center">[% 'Total' | $T8 %]</td>
353           <td align="center">[% LxERP.format_amount(totalpaid, 2) | html %]</td>
354         </tr>
355         <tr>
356           <td></td>
357           <td></td>
358           <td align="center">[% 'Missing amount' | $T8 %]</td>
359           <td align="center">[% LxERP.format_amount(paid_missing, 2) | html %]</td>
360         </tr>
361       </table>
362     </td>
363   </tr>
364 </table>
365 </div>
366 [% PROCESS 'webdav/_list.html' %]
367 <div id="ui-tabs-1">
368  [% LxERP.t8('Loading...') %]
369 </div>
370 </div>
371
372 <hr size="3" noshade>
373
374 <script type='text/javascript'>
375  $('#ap_set_to_paid_missing').click(function(){ $('input[name^="paid_"]:last').val('[% LxERP.format_amount(paid_missing, 2) %]') });
376 </script>