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>
 
  86   <li><a href="[% 'controller.pl?action=AccTrans/list_transactions&trans_id=' _ HTML.url(id) | html %]">[% LxERP.t8('Transactions') %]</a></li>
 
  90 <div id="ui-tabs-basic-data">
 
  99                 <th align="right" nowrap>[% 'Vendor' | $T8 %]</th>
 
 101                   [% IF ( selectvendor ) %]
 
 102                     <select name="vendor" onchange="document.getElementById('update_button').click();">[% selectvendor %]</select>
 
 104                     <input name=vendor value="[% vendor | html %]" size="35">
 
 106                   <input type="button" value="D" onclick="show_vc_details('vendor')">
 
 111                 <th align="right" valign="top">[% LxERP.t8("Credit Limit") %]</th>
 
 113                  [% creditlimit | html %];
 
 114                  [% LxERP.t8("Remaining") %]
 
 115                  <span class="plus[% creditremaining_plus %]">[% creditremaining | html %]</span>
 
 119 [%- IF invoice_obj.sepa_exports.as_list.size %]
 
 121                 <th align="right">[% LxERP.t8("SEPA exports") %]</th>
 
 123                  [% FOREACH export = invoice_obj.sepa_exports.as_list %]
 
 124                   <a href="sepa.pl?action=bank_transfer_edit&vc=vendor&id=[% HTML.url(export.id) %]">[% HTML.escape(export.id) %]</a>
 
 125                   [% UNLESS loop.last %], [% END %]
 
 132                 <th align="right" nowrap>[% 'Currency' | $T8 %]</th>
 
 133                 <td><select name="currency">[% selectcurrency %]</select></td>
 
 135                 [% IF ( defaultcurrency && (currency != defaultcurrency) ) %]
 
 136                   <th align=right>[% 'Exchangerate' | $T8 %]</th>
 
 138                     <td><input type="hidden" name="exchangerate" value="[% exchangerate | html %]">[% exchangerate | html %]</td>
 
 140                     <td><input type="text" name="exchangerate" size="10" value="[% exchangerate | html %]"></td>
 
 146               [% IF ( selectdepartment ) %]
 
 148                   <th align="right" nowrap>[% 'Department' | $T8 %]</th>
 
 150                     <select name="department">[% selectdepartment %]</select>
 
 156                 <td align="right"><input name="taxincluded" class="checkbox" type="checkbox" value="1" [% IF ( taxincluded ) %]checked[% END %]></td>
 
 157                 <th align=left nowrap>[% 'Tax Included' | $T8 %]</th>
 
 160                 <td align="right"><input name="direct_debit" class="checkbox" type="checkbox" value="1" [% IF direct_debit %]checked[% END %]></td>
 
 161                 <th align="left" nowrap>[% 'direct debit' | $T8 %]</th>
 
 169                 <th align="right" nowrap>[% 'Invoice Number' | $T8 %]</th>
 
 170                 <td><input name="invnumber" size="11" value="[% invnumber | html %]" [% readonly %]></td>
 
 173                 <th align="right" nowrap>[% 'Order Number' | $T8 %]</th>
 
 174                 <td><input name="ordnumber" size="11" value="[% ordnumber | html %]" [% readonly %]></td>
 
 177                 <th align="right" nowrap>[% 'Invoice Date' | $T8 %]</th>
 
 178                 <td>[% L.date_tag('transdate', transdate) %]</td>
 
 181                 <th align="right" nowrap>[% 'Due Date' | $T8 %]</th>
 
 182                 <td>[% L.date_tag('duedate', duedate) %]</td>
 
 185                 <th align="right" nowrap>[% 'Project Number' | $T8 %]</th>
 
 187                   [% L.select_tag('globalproject_id', ALL_PROJECTS, with_empty = 1, default = globalproject_id, value_key = 'id', title_key = 'projectnumber') %]
 
 200         <tr class=listheading>
 
 201           <th class=listheading style="width:15%">[% 'Account' | $T8 %]</th>
 
 202           <th class=listheading style="width:10%">[% 'Amount' | $T8 %]</th>
 
 203           <th class=listheading style="width:10%">[% 'Tax' | $T8 %]</th>
 
 204           <th class=listheading style="width:10%">[% 'Taxkey' | $T8 %]</th>
 
 205           <th class=listheading style="width:10%">[% 'Project' | $T8 %]</th>
 
 208         [% FOREACH i IN [1..rowcount] %]
 
 211               [% selected_accno_full = "selected_accno_full_"_ i %]
 
 212               [% 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) %]
 
 214               <input type="hidden" name="previous_AP_amount_[% i %]" value="[% $selected_accno_full %]">
 
 215               <input type="hidden" name="tax_[% i %]" value="[% temp = "tax"_ i %][% $temp | html %]">
 
 218               <input name="amount_[% i %]" size="10" value="[% temp = "amount_"_ i %][% $temp | html %]">
 
 221               [% temp = "tax_"_ i %][% $temp | html %]
 
 224               [% temp = 'selected_taxchart_'_ i %]
 
 225               [% L.select_tag('taxchart_'_ i, ALL_TAXCHARTS, value_title_sub = \taxchart_value_title_sub, default = $temp) %]
 
 228               [% temp = "project_id_"_ i %]
 
 229               [% L.select_tag(temp, ALL_PROJECTS, with_empty = 1, default = loop.last ? globalproject_id : $temp, value_key = 'id', title_key = 'projectnumber') %]
 
 241             [% L.select_tag('APselected', ALL_CHARTS_AP, value_title_sub = \APselected_value_title_sub, default = APselected) %]
 
 243           <th align="left">[% invtotal | html %]</th>
 
 244           <td colspan="4"></td>
 
 253           <th align="left" width="1%">[% 'Notes' | $T8 %]</th>
 
 255             <textarea name="notes" rows="[% textarea_rows %]" cols="50" wrap="soft" [% readonly %]>[% notes | html %]</textarea>
 
 258           <th align="left" width=1%>[% 'Notes for vendor' | $T8 %]</th>
 
 260             <textarea name="intnotes" rows="[% textarea_rows %]" cols="50" wrap="soft" readonly>[% intnotes | html %]</textarea>
 
 269         <tr class="listheading">
 
 270           <th class="listheading" colspan="7">[% 'Payments' | $T8 %]</th>
 
 274           <th>[% 'Date' | $T8 %]</th>
 
 275           <th>[% 'Source' | $T8 %]</th>
 
 276           <th>[% 'Memo' | $T8 %]</th>
 
 277           <th>[% 'Amount' | $T8 %]</th>
 
 279           [% IF ( !defaultcurrency || (currency != defaultcurrency) ) %]
 
 280             <th>[% 'Exch' | $T8 %]</th>
 
 282           <th>[% 'Account' | $T8 %]</th>
 
 283           <th>[% 'Project Number' | $T8 %]</th>
 
 286         [% FOREACH i IN [1..paidaccounts] %]
 
 287           [% temp = "paidaccount_changeable_"_ i %]
 
 288           [% changeable = $temp %]
 
 291             [% temp = "datepaid_"_ i %]
 
 293               [% IF( changeable ) %]
 
 294                 [% L.date_tag(temp, $temp ? $temp : today) %]
 
 297                 <input type="hidden" name="[% temp %]" value="[% $temp | html %]">
 
 301             [% temp = "source_"_ i %]
 
 303               [% IF( changeable ) %]
 
 304                 <input name="[% temp %]" size="11" value="[% $temp | html %]">
 
 307                 <input type="hidden" name="[% temp %]" value="[% $temp | html %]">
 
 311             [% temp = "memo_"_ i %]
 
 313               [% IF( changeable ) %]
 
 314                 <input name="[% temp %]" size="11" value="[% $temp | html %]">
 
 317                 <input type="hidden" name="[% temp %]" value="[% $temp | html %]">
 
 321             [% temp = "paid_"_ i %]
 
 323               [% IF( changeable ) %]
 
 324                 <input name="[% temp %]" size="11" value="[% $temp | html %]" onBlur="check_right_number_format(this);">
 
 327                 <input type="hidden" name="[% temp %]" value="[% $temp | html %]">
 
 332               [% IF changeable && loop.last && paid_missing > 0 %]
 
 333                 <input type="button" id="ap_set_to_paid_missing" value="[% "Set to paid missing" | $T8 %]">
 
 337             [% IF ( !defaultcurrency || (currency != defaultcurrency) ) %]
 
 339                 [% temp = "exchangerate_"_ i %]
 
 340                 [% temp_forex = "forex_"_ i %]
 
 342                 [% IF( $temp_forex || !changeable ) %]
 
 344                   <input type="hidden" name="[% temp %]" value="[% $temp | html %]">
 
 346                   <input name="[% temp %]" size="11" value="[% $temp | html %]">
 
 349                 <input type=hidden name="[% temp_forex %]" value="[% $temp_forex | html %]">
 
 353             [% temp = "AP_paid_"_ i %]
 
 355               [% IF( changeable ) %]
 
 356                 [% L.select_tag(temp, ALL_CHARTS_AP_paid, value_title_sub = \AP_paid_value_title_sub, default = ($temp || accno_arap))  %]
 
 359                 <input type="hidden" name="[% temp %]" value="[% $temp | html %]">
 
 364               [% temp = "paid_project_id_"_ i %]
 
 365               [% IF( changeable ) %]
 
 366                 [% L.select_tag(temp, ALL_PROJECTS, with_empty = 1, default = $temp, value_key = 'id', title_key = 'projectnumber') %]
 
 368                 <input type="hidden" name="[% temp %]" value="[% $temp | html %]">
 
 369                 [% temp = "label"_ temp %]
 
 379           <td align="center">[% 'Total' | $T8 %]</td>
 
 380           <td align="center">[% LxERP.format_amount(totalpaid, 2) | html %]</td>
 
 385           <td align="center">[% 'Missing amount' | $T8 %]</td>
 
 386           <td align="center">[% LxERP.format_amount(paid_missing, 2) | html %]</td>
 
 395 <script type='text/javascript'>
 
 396  $('#ap_set_to_paid_missing').click(function(){ $('input[name^="paid_"]:last').val('[% LxERP.format_amount(paid_missing, 2) %]') });