5 [%- USE LxERP %][%- USE P -%]
 
   7 <h1>[% title | html %]</h1>
 
   9 [%- INCLUDE 'common/flash.html' %]
 
  11 <form method="post" action="[% script | html %]" id="form">
 
  13 <input type="hidden" name="terms" value="[% terms | html %]">
 
  15 <input type="hidden" name="creditlimit" value="[% creditlimit | html %]">
 
  16 <input type="hidden" name="creditremaining" value="[% creditremaining | html %]">
 
  18 <input type="hidden" name="forex" value="[% forex | html %]">
 
  19 <input type="hidden" name="lastmtime" value="[% HTML.escape(lastmtime) %]">
 
  21 <input id="id" type="hidden" name="id" value="[% id | html %]">
 
  22 <input type="hidden" name="sort" value="[% sort | html %]">
 
  23 <input type="hidden" name="closedto" value="[% closedto | html %]">
 
  24 <input type="hidden" name="locked" value="[% locked | html %]">
 
  25 <input type="hidden" name="title" value="[% title_ | html %]">
 
  27 <input type="hidden" name="follow_up_trans_id_1" value="[% id | html %]">
 
  28 <input type="hidden" name="follow_up_trans_type_1" value="ap_transaction">
 
  29 <input type="hidden" name="follow_up_trans_info_1" value="[% follow_up_trans_info | html %]">
 
  30 <input type="hidden" name="follow_up_rowcount" value="1">
 
  32 <input type="hidden" name="defaultcurrency" value="[% defaultcurrency | html %]">
 
  33 <input type="hidden" name="fxgain_accno" value="[% fxgain_accno | html %]">
 
  34 <input type="hidden" name="fxloss_accno" value="[% fxloss_accno | html %]">
 
  36 <input type="hidden" name="oldinvtotal" value="[% oldinvtotal | html %]">
 
  37 <input type="hidden" name="oldtotalpaid" value="[% oldtotalpaid | html %]">
 
  39 <input type="hidden" name="taxaccounts" value="[% taxaccounts | html %]">
 
  41 <input type="hidden" name="rowcount" value="[% rowcount | html %]">
 
  43 <input type="hidden" name="paidaccounts" value="[% paidaccounts | html %]">
 
  45 [%- P.hidden_tag('convert_from_oe_id', convert_from_oe_id) -%]
 
  47 [% FOREACH i IN [1..paidaccounts] %]
 
  48   [% temp = "acc_trans_id_"_ i %]
 
  49   <input type="hidden" name="[% temp %]" value="[% $temp | html %]">
 
  51   [% temp = "gldate_"_ i %]
 
  52   <input type="hidden" name="[% temp %]" value="[% $temp | html %]">
 
  55 [% IF ( saved_message ) %]
 
  56   <p>[% saved_message | html %]</p>
 
  59 <div id="ap_tabs" class="tabwidget">
 
  61   <li><a href="#ui-tabs-basic-data">[% 'Basic Data' | $T8 %]</a></li>
 
  62 [%- IF INSTANCE_CONF.get_webdav %]
 
  63   <li><a href="#ui-tabs-webdav">[% 'WebDAV' | $T8 %]</a></li>
 
  65 [%- IF id AND INSTANCE_CONF.get_doc_storage %]
 
  66       <li><a href="#ui-tabs-docs">[% 'Documents' | $T8 %]</a></li>
 
  67       <li><a href="controller.pl?action=File/list&file_type=attachment&object_type=purchase_invoice&object_id=[% HTML.url(id) %]">[% 'Attachments' | $T8 %]</a></li>
 
  70   [%- IF AUTH.assert('record_links', 1) %]
 
  71   <li><a href="controller.pl?action=RecordLinks/ajax_list&object_model=PurchaseInvoice&object_id=[% HTML.url(id) %]">[% 'Linked Records' | $T8 %]</a></li>
 
  73   <li><a href="[% 'controller.pl?action=AccTrans/list_transactions&trans_id=' _ HTML.url(id) | html %]">[% LxERP.t8('Transactions') %]</a></li>
 
  77 [%- IF id AND INSTANCE_CONF.get_doc_storage %]
 
  78    <div id="ui-tabs-docs"></div>
 
  81 <div id="ui-tabs-basic-data">
 
  90                 <th align="right" nowrap>[% 'Vendor' | $T8 %]</th>
 
  92                  [% P.customer_vendor.picker("vendor_id", vendor_id, type="vendor", style="width: 300px", onchange="\$('#update_button').click()") %]
 
  93                  [% L.button_tag("show_vc_details('vendor')", LxERP.t8('Details (one letter abbreviation)')) %]
 
  94                  [% L.hidden_tag("previous_vendor_id", vendor_id) %]
 
  99                 <th align="right" valign="top">[% LxERP.t8("Credit Limit") %]</th>
 
 101                  [% creditlimit | html %];
 
 102                  [% LxERP.t8("Remaining") %]
 
 103                  <span class="plus[% creditremaining_plus %]">[% creditremaining | html %]</span>
 
 107 [%- IF invoice_obj.sepa_exports.as_list.size %]
 
 109                 <th align="right">[% LxERP.t8("SEPA exports") %]</th>
 
 111                  [% FOREACH export = invoice_obj.sepa_exports.as_list %]
 
 112                   <a href="sepa.pl?action=bank_transfer_edit&vc=vendor&id=[% HTML.url(export.id) %]">[% HTML.escape(export.id) %]</a>
 
 113                   [% UNLESS loop.last %], [% END %]
 
 120                 <th align="right" nowrap>[% 'Currency' | $T8 %]</th>
 
 121                 <td>[% L.select_tag("currency", currencies, default=currency, value_key="name", title_key="name") %]</td>
 
 123                 [% IF ( defaultcurrency && (currency != defaultcurrency) ) %]
 
 124                   <th align=right>[% 'Exchangerate' | $T8 %]</th>
 
 126                     <td><input type="hidden" name="exchangerate" value="[% exchangerate | html %]">[% exchangerate | html %]</td>
 
 128                     <td><input type="text" name="exchangerate" size="10" value="[% exchangerate | html %]"></td>
 
 134               [% IF ALL_DEPARTMENTS %]
 
 136                   <th align="right" nowrap>[% 'Department' | $T8 %]</th>
 
 137                   <td colspan=3>[% L.select_tag('department_id', ALL_DEPARTMENTS, default = department_id, title_key = 'description', with_empty = 1) %]</td>
 
 142                 <td align="right"><input name="taxincluded" class="checkbox" type="checkbox" value="1" [% IF ( taxincluded ) %]checked[% END %]></td>
 
 143                 <th align=left nowrap>[% 'Tax Included' | $T8 %]</th>
 
 146                 <td align="right"><input name="direct_debit" class="checkbox" type="checkbox" value="1" [% IF direct_debit %]checked[% END %]></td>
 
 147                 <th align="left" nowrap>[% 'direct debit' | $T8 %]</th>
 
 155                 <th align="right" nowrap>[% 'Invoice Number' | $T8 %]</th>
 
 156                 <td>[% L.input_tag("invnumber", invnumber, size="11", readonly=readonly) %]</td>
 
 159                 <th align="right" nowrap>[% 'Order Number' | $T8 %]</th>
 
 160                 <td>[% L.input_tag("ordnumber", ordnumber, size="11", readonly=readonly) %]</td>
 
 163                 <th align="right" nowrap>[% 'Invoice Date' | $T8 %]</th>
 
 164                 <td>[% L.date_tag('transdate', transdate, onchange='kivi.SalesPurchase.set_duedate_on_reference_date_change("transdate")') %]</td>
 
 167                 <th align="right" nowrap>[% 'Due Date' | $T8 %]</th>
 
 168                 <td>[% L.date_tag('duedate', duedate) %]</td>
 
 171                 <th align="right" nowrap>[% LxERP.t8('Tax point') %]</th>
 
 172                 <td>[% L.date_tag('tax_point', tax_point, id='tax_point') %]</td>
 
 175                 <th align=right nowrap>[% 'Delivery Date' | $T8 %]</th>
 
 176                 <td>[% L.date_tag('deliverydate', deliverydate) %]</td>
 
 179                 <th align="right" nowrap>[% 'Project Number' | $T8 %]</th>
 
 181                   [% P.project.picker('globalproject_id', globalproject_id, onchange="document.getElementById('update_button').click();") %]
 
 194         <tr class=listheading>
 
 195           <th class=listheading style="width:15%">[% 'Account' | $T8 %]</th>
 
 196           <th class=listheading style="width:10%">[% 'Amount' | $T8 %]</th>
 
 197           <th class=listheading style="width:10%">[% 'Tax' | $T8 %]</th>
 
 198           <th class=listheading style="width:10%">[% 'Taxkey' | $T8 %]</th>
 
 199           <th class=listheading style="width:10%">[% 'Project' | $T8 %]</th>
 
 202         [% FOREACH i IN [1..rowcount] %]
 
 205               [% SET selected_chart_id = "AP_amount_chart_id_"_ i %]
 
 206               [% P.chart.picker("AP_amount_chart_id_" _ i, $selected_chart_id, style="width: 400px", type="AP_amount", class=(initial_focus == 'row_' _ i ? "initial_focus" : "")) %]
 
 207               [% L.hidden_tag("previous_AP_amount_chart_id_" _ i, $selected_chart_id) %]
 
 208               <input type="hidden" name="tax_[% i %]" value="[% temp = "tax"_ i %][% $temp | html %]">
 
 211               <input name="amount_[% i %]" size="10" value="[% temp = "amount_"_ i %][% $temp | html %]">
 
 214               [% temp = "tax_"_ i %][% $temp | html %]
 
 217               [% temp = 'selected_taxchart_'_ i %]
 
 218               [% taxcharts = 'taxcharts_' _ i %]
 
 219               [% L.select_tag('taxchart_'_ i, $taxcharts, value_title_sub = \taxchart_value_title_sub, default = $temp, style="width: 250px") %]
 
 222               [% temp = "project_id_"_ i %]
 
 223               [% P.project.picker(temp, loop.last ? globalproject_id : $temp) %]
 
 235             [% P.chart.picker('AP_chart_id', AP_chart_id, style="width: 400px", type="AP") %]
 
 237           <th align="left">[% invtotal | html %]</th>
 
 238           <td colspan="4"></td>
 
 247            <th align="left">[% 'Notes' | $T8 %]</th>
 
 248            <th align="left">[% 'Internal Notes' | $T8 %]</th>
 
 249            <th align="left">[% 'Payment Terms' | $T8 %]</th>
 
 253             [% L.textarea_tag("notes", notes, wrap="soft", rows=textarea_rows, cols=50, readonly=readonly) %]
 
 256             [% L.textarea_tag("intnotes", intnotes, wrap="soft", rows=textarea_rows, cols=50, readonly=readonly) %]
 
 259              [% L.select_tag('payment_id', payment_terms, default=payment_id, title_key='description', with_empty=1, style="width: 250px", onchange="kivi.SalesPurchase.set_duedate_on_reference_date_change('transdate')") %]
 
 267       [% UNLESS no_payment_bookings %]
 
 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" data-validate="number" class="numeric" value="[% $temp | html %]" id="[%- 'payment_' _ temp -%]">
 
 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 %]
 
 354             [% readonly = "AP_paid_readonly_desc_"_ i %]
 
 356               [% IF( changeable ) %]
 
 357                 [% L.select_tag(temp, ALL_CHARTS_AP_paid, value_title_sub = \AP_paid_value_title_sub, default = ($temp || accno_arap))  %]
 
 359                 [% $readonly | html %]
 
 360                 <input type="hidden" name="[% temp %]" value="[% $temp | html %]">
 
 365               [% temp = "paid_project_id_"_ i %]
 
 366               [% IF( changeable ) %]
 
 367                 [% P.project.picker(temp, $temp) %]
 
 369                 <input type="hidden" name="[% temp %]" value="[% $temp | html %]">
 
 370                 [% temp = "label"_ temp %]
 
 380           <td align="center">[% 'Total' | $T8 %]</td>
 
 381           <td align="center">[% LxERP.format_amount(totalpaid, 2) | html %]</td>
 
 386           <td align="center">[% 'Missing amount' | $T8 %]</td>
 
 387           <td align="center">[% LxERP.format_amount(paid_missing, 2) | html %]</td>
 
 395 [% PROCESS 'webdav/_list.html' %]
 
 397  [% LxERP.t8('Loading...') %]
 
 401 <hr size="3" noshade>
 
 403 <script type='text/javascript'>
 
 404  $('#ap_set_to_paid_missing').click(function(){ $('input[id^="payment_paid_"]:last').val('[% LxERP.format_amount(paid_missing, 2) %]') });