593a022ea439ca690d15e6cc6776b58c5d6c213c
[kivitendo-erp.git] / templates / webpages / sepa / bank_transfer_add.html
1 [%- USE T8 %]
2 [%- USE L %]
3 [% USE HTML %][% USE LxERP %]
4 [% IF vc == 'vendor' %]
5  [% SET is_vendor = 1 %]
6  [% SET arap = 'ap' %]
7  [% SET iris = 'ir' %]
8 [% ELSE %]
9  [% SET is_vendor = 0 %]
10  [% SET arap = 'ar' %]
11  [% SET iris = 'is' %]
12 [%- END %]
13
14  <p><div class="listtop">[% title %]</div></p>
15
16  <form action="sepa.pl" method="post">
17   <p>
18    [%- IF is_vendor %]
19     [% 'Please select the source bank account for the transfers:' | $T8 %]
20    [%- ELSE %]
21     [% 'Please select the destination bank account for the collections:' | $T8 %]
22    [%- END %]
23    <br>
24    [% L.select_tag('bank_account',
25        BANK_ACCOUNTS,
26        title_key='displayable_name',
27        with_empty=0,
28        style='width:450px',
29    ) %]
30   </p>
31
32   <p>
33    <table border="0">
34     <tr>
35      <th class="listheading" align="center"><input type="checkbox" id="select_all"></th>
36      <th class="listheading">[% IF is_vendor %][% 'Vendor' | $T8 %][%- ELSE %][%- LxERP.t8('Customer') %][%- END %]</th>
37      <th class="listheading">[% 'Invoice' | $T8 %]</th>
38      <th class="listheading" align="right">[% 'Amount' | $T8 %]</th>
39      <th class="listheading" align="right">[% 'Open amount' | $T8 %]</th>
40      <th class="listheading" align="right">[% 'Invoice Date' | $T8 %]</th>
41      <th class="listheading" align="right">[% 'Due Date' | $T8 %]</th>
42      <th class="listheading">[% 'Purpose' | $T8 %]</th>
43      <th class="listheading" align="right">[% 'Bank transfer amount' | $T8 %]</th>
44      <th class="listheading" align="right">[% 'Payment type' | $T8 %]</th>
45      <th class="listheading" align="right">[% 'Skonto information' | $T8 %]</th>
46     </tr>
47
48     [%- FOREACH invoice = INVOICES %]
49      <input type="hidden" name="bank_transfers[+].[% arap %]_id" value="[% HTML.escape(invoice.id) %]">
50      <input type="hidden" id="amount_less_skonto_[% loop.count %]" name="amount_less_skonto_[% loop.count %]" value="[% LxERP.format_amount(invoice.amount_less_skonto, 2) %]">
51      <input type="hidden" id="invoice_open_amount_[% loop.count %]" name="invoice_open_amount_[% loop.count %]" value="[% LxERP.format_amount(invoice.open_amount - invoice.open_sepa_transfer_amount, 2) %]">
52      <input type="hidden" id="skonto_amount_[% loop.count %]" name="skonto_amount_[% loop.count %]" value="[% LxERP.format_amount(invoice.skonto_amount, 2) %]">
53
54
55      <tr class="listrow[% loop.count % 2 %]">
56       <td align="center">
57        [%- IF invoice.vc_bank_info_ok %]
58         <input type="checkbox" name="bank_transfers[].selected" value="1"[% IF invoice.checked %] checked[% END %]>
59        [%- END %]
60       </td>
61       <td>
62        [%- IF loop.first || (previous_vcname != invoice.vcname) %]
63         <a href="controller.pl?action=CustomerVendor/edit&db=[% vc %]&id=[% HTML.url(invoice.vc_id) %]&callback=[% HTML.url('sepa.pl?action=bank_transfer_add&vc=' _ vc) %]">
64          [%- GET HTML.escape(invoice.vcname);
65              SET previous_vcname = invoice.vcname;
66              IF !invoice.vc_bank_info_ok;
67                GET ' <sup>(1)</sup>';
68                SET show_vc_bank_info_footnote = '1';
69              END; -%]
70         </a>
71        [%- END -%]
72       </td>
73
74       <td>
75        <a href="[% IF invoice.invoice %][% iris %][% ELSE %][% arap %][% END %].pl?action=edit&id=[% HTML.escape(invoice.id) %]">
76         [% HTML.escape(invoice.invnumber) %]
77        </a>
78       </td>
79
80       <td align="right">[% LxERP.format_amount(invoice.invoice_amount-invoice.open_sepa_transfer_amount, 2) %]</td>
81       <td align="right">[% LxERP.format_amount(invoice.open_amount-invoice.open_sepa_transfer_amount, 2) %]</td>
82       <td align="right">[% invoice.transdate %]</td>
83       <td align="right">[% invoice.duedate %]</td>
84       <td>
85        [%- SET reference = invoice.reference_prefix _ invoice.invnumber %]
86        <input name="bank_transfers[].reference" value="[% HTML.escape(reference.substr(0, 140)) %]" maxlength="140" size="20">
87       </td>
88       <td align="right">
89        <input id=[% loop.count %] name="bank_transfers[].amount" id="amount_[% loop.count %]" value="[% LxERP.format_amount(invoice.invoice_amount_suggestion, 2) %]" style="text-align: right" size="12">
90       </td>
91       <td>
92       [% L.select_tag('bank_transfers[].payment_type', invoice.payment_select_options, value_key => 'payment_type', title_key => 'display', id => 'payment_type_' _ loop.count, class => 'type_target' ) %]
93       </td>
94       <td align="left" [%- IF invoice.within_skonto_period %]style="background-color: LightGreen"[%- END %]>[%- IF invoice.skonto_amount %] [% LxERP.format_amount(invoice.percent_skonto, 2) %] % = [% LxERP.format_amount(invoice.skonto_amount, 2) %] € bis [% invoice.skonto_date %] [%- END %]</td>
95      </tr>
96     [%- END %]
97    </table>
98   </p>
99
100   [%- IF show_vc_bank_info_footnote %]
101    <p>
102     <sup>(1)</sup>
103     [%- IF is_vendor %]
104      [%- 'No bank information has been entered in this vendor\'s master data entry. You cannot create bank transfers unless you enter bank information.' | $T8 %]
105      [% "The required information consists of the IBAN and the BIC." | $T8 %]
106     [%- ELSE %]
107      [%- 'No bank information has been entered in this customer\'s master data entry. You cannot create bank collections unless you enter bank information.' | $T8 %]
108      [% "The required information consists of the IBAN, the BIC, the mandator ID and the mandate's date of signature." | $T8 %]
109     [%- END %]
110    </p>
111   [%- END %]
112
113   <p>
114    <input type="submit" class="submit" name="action_bank_transfer_create" value="[% 'Step 2' | $T8 %]">
115   </p>
116
117   <input type="hidden" name="action" value="dispatcher">
118   <input type="hidden" name="vc" value="[%- HTML.escape(vc) %]">
119  </form>
120
121  <script type="text/javascript">
122   <!--
123     $(function() {
124       $("#select_all").checkall('INPUT[name="bank_transfers[].selected"]');
125     });
126     -->
127
128 $( ".type_target" ).change(function() {
129   type_id = $(this).attr('id');
130   var id = type_id.match(/\d*$/);
131   // alert("found id " + id);
132   if ( $(this).val() == "without_skonto" ) {
133       $('#' + id).val( $('#invoice_open_amount_' + id).val() );
134   } else if ( $(this).val() == "difference_as_skonto" ) {
135       $('#' + id).val( $('#invoice_open_amount_' + id).val() );
136   } else if ( $(this).val() == "with_skonto_pt" ) {
137             $('#' + id).val( $('#amount_less_skonto_' + id).val() );
138   }
139 });
140
141  </script>