Merge branch 'test' of ../kivitendo-erp_20220811
[kivitendo-erp.git] / templates / webpages / is / _payments.html
index 1c39b20..8072df3 100644 (file)
@@ -1,4 +1,6 @@
-[%- USE LxERP %][% USE T8 %]
+[%- USE LxERP %]
+[%- USE T8 %]
+[%- USE L %]
   <tr>
    <td>
     <table width="100%">
@@ -16,6 +18,7 @@
       <th>[%- 'Source' | $T8 %]</th>
       <th>[%- 'Memo' | $T8 %]</th>
       <th>[%- 'Amount' | $T8 %]</th>
+      <th></th>
 [% IF show_exchangerate %]
       <th>[%- 'Exch' | $T8 %]</th>
 [% END %]
 
 
 [% FOREACH i = paid_indices %]
+  [% SET changeable    = 'changeable_'    _ i %]
+  [% SET acc_trans_id  = 'acc_trans_id_'  _ i %]
+  [% SET p_gldate      = 'gldate_'        _ i %]
   [% SET datepaid      = 'datepaid_'      _ i %]
   [% SET source        = 'source_'        _ i %]
   [% SET memo          = 'memo_'          _ i %]
   [% SET paid          = 'paid_'          _ i %]
+  [% SET AR_paid       = 'AR_paid_'       _ i %]
   [% SET selectAR_paid_ref = 'selectAR_paid_' _ i %]
+     <tr style='display:none'>
+       <td>
+         <input type=hidden name="acc_trans_id_[% i %]" value="[% $acc_trans_id %]">
+         <input type=hidden name="gldate_[% i %]" value="[% $p_gldate %]">
+       </td>
+     </tr>
 
      <tr>
+     <td align="center">
+     [% IF $changeable %]
+       [% IF $datepaid %]
+         [% L.date_tag('datepaid_'_ i, $datepaid) %]
+       [% ELSE %]
+         [% L.date_tag('datepaid_'_ i, today) %]
+       [% END %]
+     [% ELSE %]
+       <input type="hidden" name="datepaid_[% i %]" value="[% $datepaid %]"> [% $datepaid %]
+     [% END %]
+     </td>
 
-    <td align="center">
-      <input id="datepaid_[% i %]" name="datepaid_[% i %]" size="11" title="[% dateformat %]" value="[% $datepaid %]">
-      <input type="button" name="datepaid_[% i %]" id="trigger_datepaid_[% i %]" value="?">
+     <td align=center>
+     [% IF $changeable %]
+       <input name="source_[% i %]" size="11" value="[% $source %]">
+     [% ELSE %]
+       <input type="hidden" name="source_[% i %]" value="[% $source %]">[% $source %]
+     [% END %]
+     </td>
+     <td align="center">
+     [% IF $changeable %]
+       <input name="memo_[% i %]" size="11" value="[% $memo %]">
+     [% ELSE %]
+       <input type="hidden" name="memo_[% i %]" value="[% $memo %]">[% $memo %]
+     [% END %]
      </td>
-     <td align=center><input name="source_[% i %]" size="11" value="[% $source %]"></td>
-     <td align="center"><input name="memo_[% i %]" size="11" value="[% $memo %]"></td>
-     <td align="center"><input name="paid_[% i %]" size="11" value="[% LxERP.format_amount($paid, 2, 1) %]"></td>
+     <td align="center">
+     [% IF $changeable %]
+       <input name="paid_[% i %]" size="11" data-validate="number" class="numeric" value="[% LxERP.format_amount($paid, 2, 1) %]">
+     [% ELSE %]
+       <input type="hidden" name="paid_[% i %]" value="[% LxERP.format_amount($paid, 2, 1) %]">
+       [% LxERP.format_amount($paid, 2, 1) %]
+     [% END %]
+     </td>
+     <td>
+       [% IF $changeable && loop.last && paid_missing > 0 %]
+         <input type='button' id='is_set_to_paid_missing' value='[% 'Set to paid missing' | $T8 %]'>
+       [% END %]
+     </td>
+
 [% IF show_exchangerate %]
      <td align="center">
   [% SET forex        = 'forex_'        _ i %]
   [% SET exchangerate = 'exchangerate_' _ i %]
-  [% IF forex %]
-        <input type="hidden" name="exchangerate_[% i %]" value="[% LxERP.format_amount($exchangerate, 2) %]">
-        [% LxERP.format_amount(exchangerate, 2) %]
+  [% IF $forex %]
+        <input type="hidden" name="exchangerate_[% i %]" value="[% LxERP.format_amount($exchangerate, 5) %]">
+        [% LxERP.format_amount($forex, 5) %]
   [% ELSE %]
-        <input name="exchangerate_[% i %]" size="10" value="[% LxERP.format_amount($exchangerate, 2, 1) %]">
+     [% IF $changeable %]
+        <input name="exchangerate_[% i %]" size="10" value="[% LxERP.format_amount($exchangerate, 5, 1) %]">
+     [% ELSE %]
+        <input type="hidden" name="exchangerate_[% i %]" value="[% LxERP.format_amount($exchangerate, 5, 1) %]">
+        [% LxERP.format_amount($exchangerate, 5, 1) %]
+     [% END %]
   [% END %]
-        <input type="hidden" name="forex_[% i %]" value="[% $forex %]">;
+        <input type="hidden" name="forex_[% i %]" value="[% $forex %]">
      </td>
 [% END %]
-     <td align="center"><select name="AR_paid_[% i %]">[% $selectAR_paid_ref %]</select></td>
 
-    </tr>
-    <script type='text/javascript'>
-     Calendar.setup({ inputField : "datepaid_[% i %]", ifFormat :"[% myconfig_jsc_dateformat %]", align : "TR", button : "trigger_datepaid_[% i %]" });
-     $('input[name="paid_[% i %]"]').blur(function(){ check_right_number_format(this) });
-     $('#datepaid_[% i %]').blur(function(){ check_right_date_format(this) });
-    </script>
+     <td align="center">
+     [% IF $changeable %]
+       <select name="AR_paid_[% i %]">[% $selectAR_paid_ref %]</select>
+     [% ELSE %]
+       <input type="hidden" name="AR_paid_[% i %]" value="[% $AR_paid %]">[% $AR_paid %]
+     [% END %]
+     </td>
 
+    </tr>
 [% END # foreach %]
 
     <tr>
       <td></td>
       <td></td>
       <td align="center">[%- 'Total' | $T8 %]</td>
-      <td align="center">[% LxERP.foramt_amount(totalpaid, 2) | html %]</td>
+      <td align="center">[% LxERP.format_amount(totalpaid, 2) | html %]</td>
     </tr>
     <tr>
       <td></td>
       <td align="center">[%- 'Missing amount' | $T8 %]</td>
       <td align="center">[% LxERP.format_amount(paid_missing, 2) | html %]</td>
     </tr>
-
+    <tr style='display:none'>
+     <td>
      <input type="hidden" name="paidaccounts" value="[% paidaccounts %]">
      <input type="hidden" name="selectAR_paid" value="[% selectAR_paid %]">
      <input type="hidden" name="oldinvtotal" value="[% oldinvtotal %]">
 
      <input type="hidden" name="oldtotalpaid" value="[% totalpaid %]">
+    </td>
+   </tr>
     </table>
 
     </td>
   </tr>
+    <script type='text/javascript'>
+     $('#is_set_to_paid_missing').click(function(){ $('input[name^="paid_"]:last').val("[% LxERP.format_amount(paid_missing, 2) %]") });
+    </script>