4 [%- USE L %][%- USE P -%]
 
   5 [%- SET follow_up_trans_info = invnumber _ ' (' _ customer_obj.name _ ')' %]
 
   6 <script type="text/javascript" src="js/common.js"></script>
 
   7 <script type="text/javascript" src="js/delivery_customer_selection.js"></script>
 
   8 <script type="text/javascript" src="js/calculate_qty.js"></script>
 
   9 <script type="text/javascript" src="js/follow_up.js"></script>
 
  11 <form method="post" id='form' name="invoice" action="[% script %]">
 
  13 [%- FOREACH key = HIDDENS %]
 
  14 <input type="hidden" name="[% HTML.escape(key) %]" id="[% HTML.escape(key) %]" value="[% HTML.escape($key)  %]">
 
  16 <input type="hidden" name="follow_up_trans_id_1" id="follow_up_trans_id_1" value="[% id %]">
 
  17 <input type="hidden" name="follow_up_trans_type_1" id="follow_up_trans_type_1" value="sales_invoice">
 
  18 <input type="hidden" name="follow_up_trans_info_1" id="follow_up_trans_info_1" value="[% HTML.escape(follow_up_trans_info) %]">
 
  19 <input type="hidden" name="follow_up_rowcount" id="follow_up_rowcount" value="1">
 
  20 <input type="hidden" name="lastmtime" id="lastmtime" value="[% HTML.escape(lastmtime) %]">
 
  21 <input type="hidden" name="already_printed_flag" id="already_printed_flag" value="0">
 
  25 <p>[% saved_message %]</p>
 
  27 [%- INCLUDE 'common/flash.html' %]
 
  28 [%- INCLUDE 'generic/set_longdescription.html' %]
 
  30 <div id="is_tabs" class="tabwidget">
 
  32   <li><a href="#ui-tabs-basic-data">[% 'Basic Data' | $T8 %]</a></li>
 
  33 [%- IF INSTANCE_CONF.get_webdav %]
 
  34   <li><a href="#ui-tabs-webdav">[% 'WebDAV' | $T8 %]</a></li>
 
  37   [%- IF INSTANCE_CONF.get_doc_storage %]
 
  38   <li><a href="controller.pl?action=File/list&file_type=document&object_type=[% type %]&object_id=[% HTML.url(id) %]">[% 'Documents' | $T8 %]</a></li>
 
  39   <li><a href="controller.pl?action=File/list&file_type=attachment&object_type=[% type %]&object_id=[% HTML.url(id) %]">[% 'Attachments' | $T8 %]</a></li>
 
  41   [%- IF AUTH.assert('record_links', 1) %]
 
  42   <li><a href="controller.pl?action=RecordLinks/ajax_list&object_model=Invoice&object_id=[% HTML.url(id) %]">[% 'Linked Records' | $T8 %]</a></li>
 
  44   [%- IF AUTH.assert('invoice_edit', 1) %]
 
  45   <li><a href="[% 'controller.pl?action=AccTrans/list_transactions&trans_id=' _ HTML.url(id) | html %]">[% LxERP.t8('Transactions') %]</a></li>
 
  50 <div id="ui-tabs-basic-data">
 
  56           <th align="right">[% 'Customer' | $T8 %]</th>
 
  58            [% P.customer_vendor.picker("customer_id", customer_id, type="customer", style="width: 250px", class="initial_focus", onchange="\$('#update_button').click()") %]
 
  59            [% L.button_tag("show_vc_details('customer')", LxERP.t8('Details (one letter abbreviation)')) %]
 
  60            [% P.link_tag('controller.pl?action=CustomerVendor/edit&db=customer&id=' _ customer_id, LxERP.t8('Edit'), target="_blank", title=LxERP.t8('Open in new window')) %]
 
  61            [% L.hidden_tag("previous_customer_id", customer_id) %]
 
  62            [% L.hidden_tag("customer_pricegroup_id", customer_pricegroup_id) %]
 
  65 [%- IF ALL_CONTACTS.size %]
 
  67           <th align="right">[% 'Contact Person' | $T8 %]</th>
 
  69             [% L.select_tag('cp_id', ALL_CONTACTS, default = cp_id, value_key = 'cp_id', title_key = 'full_name_dep', with_empty = 1, style = 'width: 250px') %]
 
  74           <th align="right">[% 'Shipping Address' | $T8 %]</th>
 
  76            [%- IF ALL_SHIPTO.size %]
 
  77             [% shiptos = [ [ "", LxERP.t8("No/individual shipping address") ] ] ;
 
  78                L.select_tag('shipto_id', shiptos.import(ALL_SHIPTO), default=shipto_id, value_key='shipto_id', title_key='displayable_id', style='width: 250px') %]
 
  80            [% L.button_tag("kivi.SalesPurchase.edit_custom_shipto()", LxERP.t8("Custom shipto")) %]
 
  84 [%- IF customer_obj.additional_billing_addresses.as_list.size %]
 
  86           <th align="right">[% 'Custom Billing Address' | $T8 %]</th>
 
  88             [% L.select_tag('billing_address_id', customer_obj.additional_billing_addresses,
 
  89                             with_empty=1, default=billing_address_id, value_key='id', title_key='displayable_id', style='width: 250px') %]
 
  95           <td align="right">[% 'Credit Limit' | $T8 %]</td>
 
  97             [% LxERP.format_amount(creditlimit, 0, '0') %]; [% 'Remaining' | $T8 %]
 
  98             <span class="plus[% IF is_credit_remaining_negativ %]0[% ELSE %]1[% END %]">[% LxERP.format_amount(creditremaining,0 ,'0') %]</span>
 
 101 [%- IF max_dunning_level || dunning_description  %]
 
 103           <th align="right" valign="top">[% LxERP.t8("Dunning status") %]</th>
 
 105            [% IF dunning_description %]
 
 106             <span class="dunned_invoice">[% LxERP.t8("This invoice's dunning level: #1", dunning_description) %]</span>
 
 107             [% IF max_dunning_level %]<br>[% END %]
 
 109            [% IF max_dunning_level %]
 
 110             <span class="customer_dunning_level">
 
 111              [% LxERP.t8("Customer's current maximum dunning level: #1", max_dunning_level) %]
 
 113              [% LxERP.t8("Dunned open amount: #1", LxERP.format_amount(dunning_amount, 2)) %]
 
 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=customer&id=[% HTML.url(export.id) %]">[% HTML.escape(export.id) %]</a>
 
 125             [% UNLESS loop.last %], [% END %]
 
 132           <th align="right">[% 'Customer type' | $T8 %]</th>
 
 133           <td>[% business %]; [% 'Trade Discount' | $T8 %] [% LxERP.format_amount(tradediscount * 100) %] %</td>
 
 137           <th align="right" nowrap>[% 'Record in' | $T8 %]</th>
 
 139             <select name="AR" style="width:250px;">[% selectAR %]</select>
 
 140             <input type="hidden" name="selectAR" value="[% selectAR | html %]">
 
 144           <th align="right">[% 'Steuersatz' | $T8 %]</th>
 
 146             [% L.select_tag('taxzone_id', ( id ? ALL_TAXZONES : ALL_ACTIVE_TAXZONES) , default = taxzone_id, title_key = 'description', disabled = (id ? 1 : 0), style='width: 250px', onchange = "document.getElementById('update_button').click();") %]
 
 148           <input type='hidden' name='taxzone_id' value='[% taxzone_id %]'>
 
 152 [%- IF ALL_LANGUAGES %]
 
 154           <th align="right" nowrap>[% 'Language' | $T8 %]</th>
 
 156             [% L.select_tag('language_id', ALL_LANGUAGES, default = language_id, title_key = 'description', with_empty = 1, style = 'width:250px') %]
 
 160 [%- IF ALL_DEPARTMENTS %]
 
 162           <th align="right" nowrap>[% 'Department' | $T8 %]</th>
 
 164             [% L.select_tag('department_id', ALL_DEPARTMENTS, default = department_id, title_key = 'description', with_empty = 1, style = 'width:250px') %]
 
 170           <th align="right">[% 'Currency' | $T8 %]</th>
 
 171           <td>[% currencies %]</td>
 
 174         <tr style='display:none'>
 
 176             <input type="hidden" name="fxgain_accno" value="[% fxgain_accno %]">
 
 177             <input type="hidden" name="fxloss_accno" value="[% fxloss_accno %]">
 
 178             <input type="hidden" name="rndgain_accno" value="[% rndgain_accno %]">
 
 179             <input type="hidden" name="rndloss_accno" value="[% rndloss_accno %]">
 
 182 [%- IF show_exchangerate %]
 
 184           <th align="right">[% 'Exchangerate' | $T8 %]</th>
 
 187             [% LxERP.format_amount(exchangerate, 5) %]
 
 189             <input name="exchangerate" size="10" value="[% HTML.escape(LxERP.format_amount(exchangerate)) %]">
 
 195           <th align="right" nowrap>[% 'Shipping Point' | $T8 %]</th>
 
 196           <td colspan="3"><input size='35' name="shippingpoint" value="[% HTML.escape(shippingpoint) %]"></td>
 
 199           <th align="right" nowrap>[% 'Ship via' | $T8 %]</th>
 
 200           <td colspan="3"><input size='35' name="shipvia" value="[% HTML.escape(shipvia) %]"></td>
 
 203           <th align="right">[% 'Transaction description' | $T8 %]</th>
 
 204           <td colspan="3">[% L.input_tag("transaction_description", transaction_description, size=35, "data-validate"=INSTANCE_CONF.get_require_transaction_description_ps ? 'required' : '') %]</td>
 
 208     <td align="right" valign="top">
 
 211           <th align="right">[% 'Employee' | $T8 %]</th>
 
 213             [% L.select_tag('employee_id', ALL_EMPLOYEES, default = employee_id, title_key = 'safe_name') %]
 
 216 [%- IF ALL_SALESMEN.size %]
 
 218           <th align="right">[% 'Salesman' | $T8 %]</th>
 
 220             [% L.select_tag('salesman_id', ALL_SALESMEN, default = (salesman_id ? salesman_id : employee_id), title_key = 'safe_name') %]
 
 225 [%- IF is_type_credit_note %]
 
 227           <th align="right" nowrap>[% 'Credit Note Number' | $T8 %]</th>
 
 229 [%- IF INSTANCE_CONF.get_sales_purchase_record_numbers_changeable %]
 
 230             [% L.input_tag("invnumber", invnumber, size="11") %]
 
 232             [% L.hidden_tag("invnumber", invnumber) %]
 
 233             [% HTML.escape(invnumber) %]
 
 235             [% LxERP.t8("will be set upon posting") %]
 
 240           <th align="right" nowrap>[% 'Invoice Number' | $T8 %]</th>
 
 241           <td colspan="3"><input size='11' name="invnumber_for_credit_note" id="invnumber_for_credit_note" value="[% HTML.escape(invnumber_for_credit_note) %]"></td>
 
 244           <th align="right">[% 'Credit Note Date' | $T8 %]</th>
 
 245           <td>[% L.date_tag('invdate', invdate, onchange='kivi.SalesPurchase.set_duedate_on_reference_date_change("invdate")') %]</td>
 
 249           <th align="right" nowrap>[% 'Invoice Number' | $T8 %]</th>
 
 251 [%- IF INSTANCE_CONF.get_sales_purchase_record_numbers_changeable %]
 
 252           [% L.input_tag("invnumber", invnumber, size="11") %]
 
 254             [% L.hidden_tag("invnumber", invnumber) %]
 
 255             [% HTML.escape(invnumber) %]
 
 257             [% LxERP.t8("will be set upon posting") %]
 
 262           <th align="right">[% 'Invoice Date' | $T8 %]</th>
 
 263           <td>[% L.date_tag('invdate', invdate, onchange='kivi.SalesPurchase.set_duedate_on_reference_date_change("invdate")') %]</td>
 
 266           <th align="right">[% 'Due Date' | $T8 %]</th>
 
 268            <span id="duedate_container"[% IF payment_terms_obj.auto_calculation %] style="display:none"[% END %]>[% L.date_tag('duedate', duedate) %]</span>
 
 269            <span id="duedate_fixed"[% IF !payment_terms_obj.auto_calculation %] style="display:none"[% END %]>[% HTML.escape(duedate) %]</span>
 
 274           <th align="right" nowrap>[% LxERP.t8('Tax point') %]</th>
 
 275           <td nowrap>[% L.date_tag('tax_point', tax_point, id='tax_point') %]</td>
 
 277 [%- IF !is_type_credit_note %]
 
 279           <th align="right" nowrap>[% 'Delivery Order Number' | $T8 %]</th>
 
 280           <td colspan="3"><input size='11' name="donumber" id="donumber" value="[% HTML.escape(donumber) %]"></td>
 
 284           <th align="right">[% 'Delivery Date' | $T8 %]</th>
 
 285           <td>[% L.date_tag('deliverydate', deliverydate) %]</td>
 
 288           <th align="right" nowrap>[% 'Order Number' | $T8 %]</th>
 
 289           <td colspan="3"><input size='11' name="ordnumber" id="ordnumber" value="[% HTML.escape(ordnumber) %]"></td>
 
 292           <th align="right" nowrap>[% 'Order Date' | $T8 %]</th>
 
 293           <td>[% L.date_tag('orddate', orddate) %]</td>
 
 296           <th align="right" nowrap>[% 'Quotation Number' | $T8 %]</th>
 
 297           <td colspan="3"><input size='11' name="quonumber" id="quonumber" value="[% HTML.escape(quonumber) %]"></td>
 
 300           <th align="right" nowrap>[% 'Quotation Date' | $T8 %]</th>
 
 301           <td>[% L.date_tag('quodate', quodate) %]</td>
 
 304           <th align="right" nowrap>[% 'Customer Order Number' | $T8 %]</th>
 
 305           <td colspan="3"><input size='11' name="cusordnumber" id="cusordnumber" value="[% HTML.escape(cusordnumber) %]"></td>
 
 308           <th align="right" nowrap>[% 'Project Number' | $T8 %]</th>
 
 310             [%- L.select_tag('globalproject_id', ALL_PROJECTS, title_key = 'projectnumber', default = globalproject_id, with_empty = '1', onChange = "document.getElementById('update_button').click();") %]
 
 316   <tr style='display:none'>
 
 318       <input type="hidden" name="webdav" value="[% webdav %]">
 
 323   <script type="text/javascript" src="js/show_form_details.js"></script>
 
 324   <script type="text/javascript" src="js/show_vc_details.js"></script>
 
 325   <script type="text/javascript" src="js/show_history.js"></script>
 
 326   <script type="text/javascript">
 
 328      $('document').ready(function(){
 
 329 [% IF INSTANCE_CONF.get_invoice_prevent_browser_back %]
 
 330        function disableBack() { window.history.forward() };
 
 331        window.onload = disableBack();
 
 332        window.onpageshow = function(evt) { if (evt.persisted) disableBack() };
 
 335 [% IF resubmit && is_format_html %]
 
 336        window.open('about:blank','Beleg');
 
 337        document.invoice.target = 'Beleg';
 
 338        kivi.SalesPurchase.show_print_dialog();
 
 339        kivi.SalesPurchase.print_record();
 
 341        if ($('#already_printed_flag').val() === "0") {
 
 342          kivi.SalesPurchase.show_print_dialog();
 
 343          kivi.SalesPurchase.print_record();
 
 344          $('#already_printed_flag').val("1");
 
 346 [% ELSIF creditwarning != '' %]
 
 347        alert('[% 'Credit Limit exceeded!!!' | $T8 %]');