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