6 <script type="text/javascript">
 
   8   function setTaxkey(accno, row) {
 
   9     var taxkey = accno.options[accno.selectedIndex].value;
 
  10     var reg = /--([0-9]*)/;
 
  11     var found = reg.exec(taxkey);
 
  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;
 
  26 <script type="text/javascript" src="js/show_history.js"></script>
 
  28 <form method="post" action="[% script | html %]">
 
  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 %]">
 
  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 %]">
 
  38 <input type="hidden" name="creditlimit" value="[% creditlimit | html %]">
 
  39 <input type="hidden" name="creditremaining" value="[% creditremaining | html %]">
 
  41 <input type="hidden" name="forex" value="[% forex | html %]">
 
  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 %]">
 
  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">
 
  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 %]">
 
  58 <input type="hidden" name="oldinvtotal" value="[% oldinvtotal | html %]">
 
  59 <input type="hidden" name="oldtotalpaid" value="[% oldtotalpaid | html %]">
 
  61 <input type="hidden" name="taxaccounts" value="[% taxaccounts | html %]">
 
  63 <input type="hidden" name="rowcount" value="[% rowcount | html %]">
 
  65 <input type="hidden" name="paidaccounts" value="[% paidaccounts | html %]">
 
  67 [% FOREACH i IN [1..paidaccounts] %]
 
  68   [% temp = "acc_trans_id_"_ i %]
 
  69   <input type="hidden" name="[% temp %]" value="[% $temp | html %]">
 
  71   [% temp = "gldate_"_ i %]
 
  72   <input type="hidden" name="[% temp %]" value="[% $temp | html %]">
 
  75 <h1>[% title | html %]</h1>
 
  77 [% IF ( saved_message ) %]
 
  78   <p>[% saved_message | html %]</p>
 
  81 <div class="tabwidget">
 
  83   <li><a href="#ui-tabs-basic-data">[% 'Basic Data' | $T8 %]</a></li>
 
  85   <li><a href="controller.pl?action=RecordLinks/ajax_list&object_model=PurchaseInvoice&object_id=[% HTML.url(id) %]">[% 'Linked Records' | $T8 %]</a></li>
 
  89 <div id="ui-tabs-basic-data">
 
  98                 <th align="right" nowrap>[% 'Vendor' | $T8 %]</th>
 
 100                   [% IF ( selectvendor ) %]
 
 101                     <select name="vendor" onchange="document.getElementById('update_button').click();">[% selectvendor %]</select>
 
 103                     <input name=vendor value="[% vendor | html %]" size="35">
 
 105                   <input type="button" value="D" onclick="show_vc_details('vendor')">
 
 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>
 
 124                 <th align="right" nowrap>[% 'Currency' | $T8 %]</th>
 
 125                 <td><select name="currency">[% selectcurrency %]</select></td>
 
 127                 [% IF ( defaultcurrency && (currency != defaultcurrency) ) %]
 
 128                   <th align=right>[% 'Exchangerate' | $T8 %]</th>
 
 130                     <td><input type="hidden" name="exchangerate" value="[% exchangerate | html %]">[% exchangerate | html %]</td>
 
 132                     <td><input type="text" name="exchangerate" size="10" value="[% exchangerate | html %]"></td>
 
 138               [% IF ( selectdepartment ) %]
 
 140                   <th align="right" nowrap>[% 'Department' | $T8 %]</th>
 
 142                     <select name="department">[% selectdepartment %]</select>
 
 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>
 
 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>
 
 161                 <th align="right" nowrap>[% 'Invoice Number' | $T8 %]</th>
 
 162                 <td><input name="invnumber" size="11" value="[% invnumber | html %]" [% readonly %]></td>
 
 165                 <th align="right" nowrap>[% 'Order Number' | $T8 %]</th>
 
 166                 <td><input name="ordnumber" size="11" value="[% ordnumber | html %]" [% readonly %]></td>
 
 169                 <th align="right" nowrap>[% 'Invoice Date' | $T8 %]</th>
 
 170                 <td>[% L.date_tag('transdate', transdate) %]</td>
 
 173                 <th align="right" nowrap>[% 'Due Date' | $T8 %]</th>
 
 174                 <td>[% L.date_tag('duedate', duedate) %]</td>
 
 177                 <th align="right" nowrap>[% 'Project Number' | $T8 %]</th>
 
 179                   [% L.select_tag('globalproject_id', ALL_PROJECTS, with_empty = 1, default = globalproject_id, value_key = 'id', title_key = 'projectnumber') %]
 
 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>
 
 200         [% FOREACH i IN [1..rowcount] %]
 
 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) %]
 
 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 %]">
 
 210               <input name="amount_[% i %]" size="10" value="[% temp = "amount_"_ i %][% $temp | html %]">
 
 213               [% temp = "tax_"_ i %][% $temp | html %]
 
 216               [% temp = 'selected_taxchart_'_ i %]
 
 217               [% L.select_tag('taxchart_'_ i, ALL_TAXCHARTS, value_title_sub = \taxchart_value_title_sub, default = $temp) %]
 
 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') %]
 
 233             [% L.select_tag('APselected', ALL_CHARTS_AP, value_title_sub = \APselected_value_title_sub, default = APselected) %]
 
 235           <th align="left">[% invtotal | html %]</th>
 
 236           <td colspan="4"></td>
 
 245           <th align="left" width="1%">[% 'Notes' | $T8 %]</th>
 
 247             <textarea name="notes" rows="[% textarea_rows %]" cols="50" wrap="soft" [% readonly %]>[% notes | html %]</textarea>
 
 250           <th align="left" width=1%>[% 'Notes for vendor' | $T8 %]</th>
 
 252             <textarea name="intnotes" rows="[% textarea_rows %]" cols="50" wrap="soft" readonly>[% intnotes | html %]</textarea>
 
 261         <tr class="listheading">
 
 262           <th class="listheading" colspan="7">[% 'Payments' | $T8 %]</th>
 
 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>
 
 273           <th>[% 'Account' | $T8 %]</th>
 
 274           <th>[% 'Project Number' | $T8 %]</th>
 
 277         [% FOREACH i IN [1..paidaccounts] %]
 
 278           [% temp = "paidaccount_changeable_"_ i %]
 
 279           [% changeable = $temp %]
 
 282             [% temp = "datepaid_"_ i %]
 
 284               [% IF( changeable ) %]
 
 285                 [% L.date_tag(temp, $temp) %]
 
 288                 <input type="hidden" name="[% temp %]" value="[% $temp | html %]">
 
 292             [% temp = "source_"_ i %]
 
 294               [% IF( changeable ) %]
 
 295                 <input name="[% temp %]" size="11" value="[% $temp | html %]">
 
 298                 <input type="hidden" name="[% temp %]" value="[% $temp | html %]">
 
 302             [% temp = "memo_"_ i %]
 
 304               [% IF( changeable ) %]
 
 305                 <input name="[% temp %]" size="11" value="[% $temp | html %]">
 
 308                 <input type="hidden" name="[% temp %]" value="[% $temp | html %]">
 
 312             [% temp = "paid_"_ i %]
 
 314               [% IF( changeable ) %]
 
 315                 <input name="[% temp %]" size="11" value="[% $temp | html %]" onBlur="check_right_number_format(this);">
 
 318                 <input type="hidden" name="[% temp %]" value="[% $temp | html %]">
 
 322             [% IF ( !defaultcurrency || (currency != defaultcurrency) ) %]
 
 324                 [% temp = "exchangerate_"_ i %]
 
 325                 [% temp_forex = "forex_"_ i %]
 
 327                 [% IF( $temp_forex || !changeable ) %]
 
 329                   <input type="hidden" name="[% temp %]" value="[% $temp | html %]">
 
 331                   <input name="[% temp %]" size="11" value="[% $temp | html %]">
 
 334                 <input type=hidden name="[% temp_forex %]" value="[% $temp_forex | html %]">
 
 338             [% temp = "AP_paid_"_ i %]
 
 340               [% IF( changeable ) %]
 
 341                 [% L.select_tag(temp, ALL_CHARTS_AP_paid, value_title_sub = \AP_paid_value_title_sub, default = ($temp || accno_arap))  %]
 
 344                 <input type="hidden" name="[% temp %]" value="[% $temp | html %]">
 
 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') %]
 
 353                 <input type="hidden" name="[% temp %]" value="[% $temp | html %]">
 
 354                 [% temp = "label"_ temp %]
 
 364           <td align="center">[% 'Total' | $T8 %]</td>
 
 365           <td align="center">[% LxERP.format_amount(totalpaid, 2) | html %]</td>
 
 370           <td align="center">[% 'Missing amount' | $T8 %]</td>
 
 371           <td align="center">[% LxERP.format_amount(paid_missing, 2) | html %]</td>