Merge branch 'b-3.6.1' of ../kivitendo-erp_20220811
[kivitendo-erp.git] / templates / webpages / is / form_header.html
index 2ccdf5f..c870191 100644 (file)
@@ -1,31 +1,30 @@
 [%- USE T8 %]
 [%- USE HTML %]
 [%- USE LxERP %]
-[%- USE L %]
-[%- SET follow_up_trans_info = invnumber _ ' (' _ customer_name _ ')' %]
+[%- USE L %][%- USE P -%]
+[%- SET follow_up_trans_info = invnumber _ ' (' _ customer_obj.name _ ')' %]
 <script type="text/javascript" src="js/common.js"></script>
 <script type="text/javascript" src="js/delivery_customer_selection.js"></script>
-<script type="text/javascript" src="js/vendor_selection.js"></script>
 <script type="text/javascript" src="js/calculate_qty.js"></script>
 <script type="text/javascript" src="js/follow_up.js"></script>
-<script type="text/javascript" src="js/customer_or_vendor_selection.js"></script>
 
-<form method="post" name="invoice" action="[% script %]">
+<form method="post" id='form' name="invoice" action="[% script %]">
 
 [%- FOREACH key = HIDDENS %]
-<input type="hidden" name="[% HTML.escape(key) %]" value="[% HTML.escape($key)  %]">
+<input type="hidden" name="[% HTML.escape(key) %]" id="[% HTML.escape(key) %]" value="[% HTML.escape($key)  %]">
 [%- END %]
-<input type="hidden" name="follow_up_trans_id_1" value="[% id %]">
-<input type="hidden" name="follow_up_trans_type_1" value="sales_invoice">
-<input type="hidden" name="follow_up_trans_info_1" value="[% HTML.escape(follow_up_trans_info) %]">
-<input type="hidden" name="follow_up_rowcount" value="1">
-<input type="hidden" name="lastmtime" value="[% HTML.escape(lastmtime) %]">
+<input type="hidden" name="follow_up_trans_id_1" id="follow_up_trans_id_1" value="[% id %]">
+<input type="hidden" name="follow_up_trans_type_1" id="follow_up_trans_type_1" value="sales_invoice">
+<input type="hidden" name="follow_up_trans_info_1" id="follow_up_trans_info_1" value="[% HTML.escape(follow_up_trans_info) %]">
+<input type="hidden" name="follow_up_rowcount" id="follow_up_rowcount" value="1">
+<input type="hidden" name="lastmtime" id="lastmtime" value="[% HTML.escape(lastmtime) %]">
+<input type="hidden" name="already_printed_flag" id="already_printed_flag" value="0">
 
 <h1>[% title %]</h1>
 
 <p>[% saved_message %]</p>
 
-[%- PROCESS 'common/flash.html' %]
+[%- INCLUDE 'common/flash.html' %]
 [%- INCLUDE 'generic/set_longdescription.html' %]
 
 <div id="is_tabs" class="tabwidget">
   <li><a href="#ui-tabs-webdav">[% 'WebDAV' | $T8 %]</a></li>
 [%- END %]
 [%- IF id %]
+  [%- IF INSTANCE_CONF.get_doc_storage %]
+  <li><a href="controller.pl?action=File/list&file_type=document&object_type=[% type %]&object_id=[% HTML.url(id) %]">[% 'Documents' | $T8 %]</a></li>
+  <li><a href="controller.pl?action=File/list&file_type=attachment&object_type=[% type %]&object_id=[% HTML.url(id) %]">[% 'Attachments' | $T8 %]</a></li>
+  [%- END %]
+  [%- IF AUTH.assert('record_links', 1) %]
   <li><a href="controller.pl?action=RecordLinks/ajax_list&object_model=Invoice&object_id=[% HTML.url(id) %]">[% 'Linked Records' | $T8 %]</a></li>
+  [%- END %]
+  [%- IF AUTH.assert('invoice_edit', 1) %]
   <li><a href="[% 'controller.pl?action=AccTrans/list_transactions&trans_id=' _ HTML.url(id) | html %]">[% LxERP.t8('Transactions') %]</a></li>
+  [%- END %]
 [%- END %]
  </ul>
 
         <tr>
           <th align="right">[% 'Customer' | $T8 %]</th>
           <td>
-            [%- INCLUDE 'generic/multibox.html'
-                 id            = 'customer',
-                 name          = 'customer',
-                 style         = 'width: 250px',
-                 class         = 'initial_focus',
-                 DATA          = ALL_CUSTOMERS,
-                 id_sub        = 'vc_keys',
-                 label_key     = 'name',
-                 select        = vc_select,
-                 limit         = vclimit,
-                 allow_textbox = 1,
-                 onChange      = "document.getElementById('update_button').click();" -%]
-            <input type="button" value="[% 'Details (one letter abbreviation)' | $T8 %]" onclick="show_vc_details('[% HTML.escape(vc) %]')">
-          <input type="hidden" name="customer_klass" value="[% HTML.escape(customer_klass) %]">
-          <input type="hidden" name="customer_id" value="[% HTML.escape(customer_id) %]">
-          <input type="hidden" name="oldcustomer" value="[% HTML.escape(oldcustomer) %]">
-          <input type="hidden" name="selectcustomer" value="[% HTML.escape(selectcustomer) %]">
+           [% P.customer_vendor.picker("customer_id", customer_id, type="customer", style="width: 250px", class="initial_focus", onchange="\$('#update_button').click()") %]
+           [% L.button_tag("show_vc_details('customer')", LxERP.t8('Details (one letter abbreviation)')) %]
+           [% 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')) %]
+           [% L.hidden_tag("previous_customer_id", customer_id) %]
+           [% L.hidden_tag("customer_pricegroup_id", customer_pricegroup_id) %]
           </td>
         </tr>
 [%- IF ALL_CONTACTS.size %]
           </td>
         </tr>
 [%- END %]
-[%- IF ALL_SHIPTO.size %]
         <tr>
           <th align="right">[% 'Shipping Address' | $T8 %]</th>
           <td>
+           [%- IF ALL_SHIPTO.size %]
             [% shiptos = [ [ "", LxERP.t8("No/individual shipping address") ] ] ;
                L.select_tag('shipto_id', shiptos.import(ALL_SHIPTO), default=shipto_id, value_key='shipto_id', title_key='displayable_id', style='width: 250px') %]
+           [%- END %]
+           [% L.button_tag("kivi.SalesPurchase.edit_custom_shipto()", LxERP.t8("Custom shipto")) %]
+          </td>
+        </tr>
+
+[%- IF customer_obj.additional_billing_addresses.as_list.size %]
+        <tr>
+          <th align="right">[% 'Custom Billing Address' | $T8 %]</th>
+          <td>
+            [% L.select_tag('billing_address_id', customer_obj.additional_billing_addresses,
+                            with_empty=1, default=billing_address_id, value_key='id', title_key='displayable_id', style='width: 250px') %]
           </td>
         </tr>
 [%- END %]
+
         <tr>
           <td align="right">[% 'Credit Limit' | $T8 %]</td>
           <td>
   [%- END %]
           </td>
         </tr>
-[%- IF all_departments %]
+[%- IF ALL_LANGUAGES %]
+        <tr>
+          <th align="right" nowrap>[% 'Language' | $T8 %]</th>
+          <td colspan="3">
+            [% L.select_tag('language_id', ALL_LANGUAGES, default = language_id, title_key = 'description', with_empty = 1, style = 'width:250px') %]
+          </td>
+        </tr>
+[%- END %]
+[%- IF ALL_DEPARTMENTS %]
         <tr>
           <th align="right" nowrap>[% 'Department' | $T8 %]</th>
           <td colspan="3">
-            [% L.select_tag('department_id', all_departments, default = department_id, title_sub = \department_labels, with_empty = 1, style = 'width:250px') %]
+            [% L.select_tag('department_id', ALL_DEPARTMENTS, default = department_id, title_key = 'description', with_empty = 1, style = 'width:250px') %]
           </td>
         </tr>
 [%- END %]
           <td>
             <input type="hidden" name="fxgain_accno" value="[% fxgain_accno %]">
             <input type="hidden" name="fxloss_accno" value="[% fxloss_accno %]">
+            <input type="hidden" name="rndgain_accno" value="[% rndgain_accno %]">
+            <input type="hidden" name="rndloss_accno" value="[% rndloss_accno %]">
           </td>
         </tr>
 [%- IF show_exchangerate %]
           <th align="right">[% 'Exchangerate' | $T8 %]</th>
           <td>
            [%- IF forex %]
-            [% LxERP.format_amount(exchangerate, 2) %]
+            [% LxERP.format_amount(exchangerate, 5) %]
            [%- ELSE %]
             <input name="exchangerate" size="10" value="[% HTML.escape(LxERP.format_amount(exchangerate)) %]">
            [%- END %]
         </tr>
         <tr>
           <th align="right">[% 'Transaction description' | $T8 %]</th>
-          <td colspan="3"><input size='35' name="transaction_description" id="transaction_description" value="[% HTML.escape(transaction_description) %]"></td>
+          <td colspan="3">[% L.input_tag("transaction_description", transaction_description, size=35, "data-validate"=INSTANCE_CONF.get_require_transaction_description_ps ? 'required' : '') %]</td>
         </tr>
       </table>
     </td>
 [%- IF is_type_credit_note %]
         <tr>
           <th align="right" nowrap>[% 'Credit Note Number' | $T8 %]</th>
-          <td colspan="3"><input size='11' name="invnumber" value="[% HTML.escape(invnumber) %]"></td>
+          <td colspan="3">
+[%- IF INSTANCE_CONF.get_sales_purchase_record_numbers_changeable %]
+            [% L.input_tag("invnumber", invnumber, size="11") %]
+[%- ELSIF id %]
+            [% L.hidden_tag("invnumber", invnumber) %]
+            [% HTML.escape(invnumber) %]
+[%- ELSE %]
+            [% LxERP.t8("will be set upon posting") %]
+[%- END %]
+          </td>
         </tr>
         <tr>
           <th align="right" nowrap>[% 'Invoice Number' | $T8 %]</th>
-          <td colspan="3"><input size='11' name="invnumber_for_credit_note" value="[% HTML.escape(invnumber_for_credit_note) %]"></td>
+          <td colspan="3"><input size='11' name="invnumber_for_credit_note" id="invnumber_for_credit_note" value="[% HTML.escape(invnumber_for_credit_note) %]"></td>
         </tr>
         <tr>
           <th align="right">[% 'Credit Note Date' | $T8 %]</th>
 [%- ELSE %]
         <tr>
           <th align="right" nowrap>[% 'Invoice Number' | $T8 %]</th>
-          <td colspan="3"><input size='11' name="invnumber" value="[% HTML.escape(invnumber) %]"></td>
+          <td colspan="3">
+[%- IF INSTANCE_CONF.get_sales_purchase_record_numbers_changeable %]
+          [% L.input_tag("invnumber", invnumber, size="11") %]
+[%- ELSIF id %]
+            [% L.hidden_tag("invnumber", invnumber) %]
+            [% HTML.escape(invnumber) %]
+[%- ELSE %]
+            [% LxERP.t8("will be set upon posting") %]
+[%- END %]
+          </td>
         </tr>
         <tr>
           <th align="right">[% 'Invoice Date' | $T8 %]</th>
            <span id="duedate_fixed"[% IF !payment_terms_obj.auto_calculation %] style="display:none"[% END %]>[% HTML.escape(duedate) %]</span>
           </td>
         </tr>
+[%- END %]
         <tr>
-        <th align="right" nowrap>[% 'Delivery Order Number' | $T8 %]</th>
-          <td colspan="3"><input size='11' name="donumber" value="[% HTML.escape(donumber) %]"></td>
+          <th align="right" nowrap>[% LxERP.t8('Tax point') %]</th>
+          <td nowrap>[% L.date_tag('tax_point', tax_point, id='tax_point') %]</td>
+        </tr>
+[%- IF !is_type_credit_note %]
+        <tr>
+          <th align="right" nowrap>[% 'Delivery Order Number' | $T8 %]</th>
+          <td colspan="3"><input size='11' name="donumber" id="donumber" value="[% HTML.escape(donumber) %]"></td>
         </tr>
 [%- END %]
         <tr>
         </tr>
         <tr>
           <th align="right" nowrap>[% 'Order Number' | $T8 %]</th>
-          <td colspan="3"><input size='11' name="ordnumber" value="[% HTML.escape(ordnumber) %]"></td>
+          <td colspan="3"><input size='11' name="ordnumber" id="ordnumber" value="[% HTML.escape(ordnumber) %]"></td>
         </tr>
         <tr>
           <th align="right" nowrap>[% 'Order Date' | $T8 %]</th>
         </tr>
         <tr>
           <th align="right" nowrap>[% 'Quotation Number' | $T8 %]</th>
-          <td colspan="3"><input size='11' name="quonumber" value="[% HTML.escape(quonumber) %]"></td>
+          <td colspan="3"><input size='11' name="quonumber" id="quonumber" value="[% HTML.escape(quonumber) %]"></td>
         </tr>
         <tr>
           <th align="right" nowrap>[% 'Quotation Date' | $T8 %]</th>
         </tr>
         <tr>
           <th align="right" nowrap>[% 'Customer Order Number' | $T8 %]</th>
-          <td colspan="3"><input size='11' name="cusordnumber" value="[% HTML.escape(cusordnumber) %]"></td>
+          <td colspan="3"><input size='11' name="cusordnumber" id="cusordnumber" value="[% HTML.escape(cusordnumber) %]"></td>
         </tr>
         <tr>
           <th align="right" nowrap>[% 'Project Number' | $T8 %]</th>
   <script type="text/javascript">
    <!--
      $('document').ready(function(){
+[% IF INSTANCE_CONF.get_invoice_prevent_browser_back %]
+       function disableBack() { window.history.forward() };
+       window.onload = disableBack();
+       window.onpageshow = function(evt) { if (evt.persisted) disableBack() };
+[% END %]
+
 [% IF resubmit && is_format_html %]
        window.open('about:blank','Beleg');
        document.invoice.target = 'Beleg';
-       document.invoice.submit();
+       kivi.SalesPurchase.show_print_dialog();
+       kivi.SalesPurchase.print_record();
 [% ELSIF resubmit %]
-       document.invoice.submit();
+       if ($('#already_printed_flag').val() === "0") {
+         kivi.SalesPurchase.show_print_dialog();
+         kivi.SalesPurchase.print_record();
+         $('#already_printed_flag').val("1");
+       }
 [% ELSIF creditwarning != '' %]
        alert('[% 'Credit Limit exceeded!!!' | $T8 %]');
 [% ELSE %]