Merge branch 'master' of vc.linet-services.de:public/lx-office-erp
[kivitendo-erp.git] / templates / webpages / is / form_header.html
index c84e5d4..34b340c 100644 (file)
@@ -1,6 +1,7 @@
 [%- USE T8 %]
 [%- USE HTML %]
 [%- USE LxERP %]
+[%- USE L %]
 [%- SET follow_up_trans_info = invnumber _ ' (' _ customer_name _ ')' %]
 <body>
 <script type="text/javascript" src="js/common.js"></script>
 <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="lizenzen" value="[% lizenzen %]">
-
 <p><div class="listtop" width="100%">[% title %]</div></p>
 
 <p>[% saved_message %]</p>
 
-[%- INCLUDE 'common/flash.html' %]
+[%- PROCESS 'common/flash.html' %]
 
 <table width="100%">
   <tr>
         <tr>
           <th align="right">[% 'Contact Person' | $T8 %]</th>
           <td>
-            [%- INCLUDE 'generic/multibox.html'
-                 name       = 'cp_id',
-                 style      = 'width: 250px',
-                 DATA       = ALL_CONTACTS,
-                 id_key     = 'cp_id',
-                 label_sub  = 'contact_labels',
-                 show_empty = 1 -%]
+            [% L.select_tag('cp_id', L.options_for_select(ALL_CONTACTS, default=cp_id, value='cp_id', title_sub=\contact_labels, with_empty=1), style='width: 250px') %]
           </td>
         </tr>
 [%- END %]
         <tr>
           <th align="right">[% 'Shipping Address' | $T8 %]</th>
           <td>
-            [%- INCLUDE 'generic/multibox.html'
-                 name       = 'shipto_id',
-                 style      = 'width: 250px',
-                 DATA       = ALL_SHIPTO,
-                 id_key     = 'shipto_id',
-                 label_sub  = 'shipto_labels',
-                 show_empty = 1,
-                 onChange   = "document.getElementById('update_button').click();" -%]
+            [% L.select_tag('shipto_id', L.options_for_select(ALL_SHIPTO, default=shipto_id, value='shipto_id', title_sub=\shipto_labels, with_empty=1), style='width: 250px', onChange="document.getElementById('update_button').click();") %]
           </td>
         </tr>
 [%- END %]
         <tr>
           <th align="right">[% 'Steuersatz' | $T8 %]</th>
           <td>
-            [%- INCLUDE 'generic/multibox.html'
-                 name       = 'taxzone_id'
-                 stype      = '250px'
-                 DATA       = ALL_TAXZONES
-                 id_key     = 'id'
-                 readonly   = (id ? 1 : 0)
-                 label_key  = 'description' -%]
+            [% L.select_tag('taxzone_id', L.options_for_select(ALL_TAXZONES, default=taxzone_id, title='description'), readonly=(id ? 1 : 0), style='width: 250px', onchange="document.getElementById('update_button').click();") %]
           </td>
   [%- IF id %]
           <input type='hidden' name='taxzone_id' value='[% taxzone_id %]'>
         <tr>
           <th align="right" nowrap>[% 'Department' | $T8 %]</th>
           <td colspan="3">
-            [%- INCLUDE 'generic/multibox.html'
-                 name       = 'department_id',
-                 style      = 'width: 250px',
-                 DATA       = all_departments,
-                 id_key     = 'id',
-                 label_sub  = 'department_labels',
-                 show_empty = 1 -%]
+            [% L.select_tag('department_id', L.options_for_select(all_departments, default=department_id, title_sub=\department_labels, with_empty=1), style='width:250px') %]
           </td>
         </tr>
 [%- END %]
         <tr>
           <th align="right">[% 'Employee' | $T8 %]</th>
           <td>
-            [%- INCLUDE 'generic/multibox.html'
-                 name       = 'employee_id',
-                 DATA       = ALL_EMPLOYEES,
-                 id_key     = 'id',
-                 label_sub  = 'sales_employee_labels' -%]
+            [% L.select_tag('employee_id', L.options_for_select(ALL_EMPLOYEES, default=employee_id, title_sub=\sales_employee_labels)) %]
           </td>
         </tr>
 [%- IF ALL_SALESMEN.size %]
         <tr>
           <th align="right">[% 'Salesman' | $T8 %]</th>
           <td>
-            [%- INCLUDE 'generic/multibox.html'
-                 name       = 'salesman_id',
-                 default    = salesman_id ? salesman_id : employee_id,
-                 DATA       = ALL_SALESMEN,
-                 id_key     = 'id',
-                 label_sub  = 'sales_employee_labels' -%]
+            [% L.select_tag('salesman_id', L.options_for_select(ALL_SALESMEN, default=(salesman_id ? salesman_id : employee_id), title_sub=\sales_employee_labels)) %]
           </td>
         </tr>
 [%- END %]
         </tr>
         <tr>
           <th align="right">[% 'Credit Note Date' | $T8 %]</th>
-          <td nowrap>
-            <input name="invdate" id="invdate" size="11" title="[% dateformat %]" value="[% invdate %]" onBlur="check_right_date_format(this)">
-            <input type="button" name="invdate_button" id="trigger1" value="[% 'button' | $T8 %]">
-          </td>
+          <td>[% L.date_tag('invdate', invdate, onBlur='check_right_date_format(this)', cal_align='BL', onChange='set_duedate()') %]</td>
         </tr>
 [%- ELSE %]
         <tr>
         </tr>
         <tr>
           <th align="right">[% 'Invoice Date' | $T8 %]</th>
-          <td nowrap>
-            <input name="invdate" id="invdate" size="11" title="[% dateformat %]" value="[% invdate %]" onBlur="check_right_date_format(this)">
-            <input type="button" name="invdate_button" id="trigger1" value="[% 'button' | $T8 %]">
-          </td>
+          <td>[% L.date_tag('invdate', invdate, onBlur='check_right_date_format(this)', cal_align='BL', onChange='set_duedate()') %]</td>
         </tr>
         <tr>
           <th align="right">[% 'Due Date' | $T8 %]</th>
-          <td width="13">
-            <input name="duedate" id="duedate" size="11" title="[% dateformat %]" value="[% duedate %]" onBlur="check_right_date_format(this)">
-            <input type="button" name="duedate_button" id="trigger2" value="[% 'button' | $T8 %]">
-          </td>
+          <td>[% L.date_tag('duedate', duedate, onBlur='check_right_date_format(this)', cal_align='BL') %]</td>
         </tr>
         <tr>
         <th align="right" nowrap>[% 'Delivery Order Number' | $T8 %]</th>
         </tr>
         <tr>
           <th align="right">[% 'Delivery Date' | $T8 %]</th>
-            <td width="13">
-              <input name="deliverydate" id="deliverydate" size="11" title="[% dateformat %]" value="[% deliverydate %]" onBlur="check_right_date_format(this)">
-              <input type="button" name="deliverydate_button" id="trigger3" value="[% 'button' | $T8 %]">
-            </td>
+          <td>[% L.date_tag('deliverydate', deliverydate, onBlur='check_right_date_format(this)', cal_align='BL') %]</td>
         </tr>
 [%- END %]
 
         </tr>
         <tr>
           <th align="right" nowrap>[% 'Order Date' | $T8 %]</th>
-          <td><input name="orddate" id="orddate" size="11" title="[% dateformat %]" value="[% orddate %]" onBlur="check_right_date_format(this)">
-          <input type="button" name="b_orddate" id="trigger_orddate" value="?"></td>
+          <td>[% L.date_tag('orddate', orddate, onBlur='check_right_date_format(this)', cal_align='BL') %]</td>
         </tr>
         <tr>
           <th align="right" nowrap>[% 'Quotation Number' | $T8 %]</th>
         </tr>
         <tr>
           <th align="right" nowrap>[% 'Quotation Date' | $T8 %]</th>
-          <td><input name="quodate" id="quodate" size="11" title="[% dateformat %]" value="[% quodate %]" onBlur="check_right_date_format(this)">
-           <input type="button" name="b_quodate" id="trigger_quodate" value="?"></td>
+          <td>[% L.date_tag('quodate', quodate, onBlur='check_right_date_format(this)', cal_align='BL') %]</td>
         </tr>
         <tr>
           <th align="right" nowrap>[% 'Customer Order Number' | $T8 %]</th>
         <tr>
           <th align="right" nowrap>[% 'Project Number' | $T8 %]</th>
           <td>
-            [%- INCLUDE 'generic/multibox.html'
-                 name       = 'globalproject_id',
-                 DATA       = ALL_PROJECTS,
-                 id_key     = 'id',
-                 label_key  = 'projectnumber',
-                 show_empty = 1,
-                 onChange   = "document.getElementById('update_button').click();" -%]
+            [%- L.select_tag('globalproject_id', L.options_for_select(ALL_PROJECTS, title='projectnumber', default=globalproject_id, with_empty='1'), onChange="document.getElementById('update_button').click();") %]
           </td>
         </tr>
       </table>
   <script type="text/javascript" src="js/show_history.js"></script>
   <script type="text/javascript">
    <!--
-     Calendar.setup({ inputField : "invdate",      ifFormat :"[% myconfig_jsc_dateformat %]", align : "BL", button : "trigger1" });
-[% IF !is_type_credit_note %]
-     Calendar.setup({ inputField : "duedate",      ifFormat :"[% myconfig_jsc_dateformat %]", align : "BL", button : "trigger2" });
-     Calendar.setup({ inputField : "deliverydate", ifFormat :"[% myconfig_jsc_dateformat %]", align : "BL", button : "trigger3" });
-[% END %]
-     Calendar.setup({ inputField : "orddate", ifFormat :"[% myconfig_jsc_dateformat %]", align : "BL", button : "trigger_orddate" });
-     Calendar.setup({ inputField : "quodate", ifFormat :"[% myconfig_jsc_dateformat %]", align : "BL", button : "trigger_quodate" });
      $('document').ready(function(){
 [% IF resubmit && is_format_html %]
        window.open('about:blank','Beleg');
        setupDateFormat('[% dateformat %]', '[% 'Falsches Datumsformat!' | $T8 %]');
        setupPoints('[% numberformat %]', '[% 'wrongformat' | $T8 %]');
      });
+     function set_duedate() {
+       $.ajax({
+         url: 'is.pl?action=set_duedate',
+         data: {
+           invdate: $('#invdate').val(),
+           payment_id: $('#payment_id').val(),
+         },
+         dataType: 'text',
+         success: function (data) { $('#duedate').val(data); }
+       })
+     }
    //-->
   </script>