Revision e9775242
Von Moritz Bunkus vor fast 8 Jahren hinzugefügt
SL/Controller/BankTransaction.pm | ||
---|---|---|
337 | 337 |
my @select_options = $invoice->get_payment_select_options_for_bank_transaction($::form->{bt_id}); |
338 | 338 |
|
339 | 339 |
my $html; |
340 |
$html .= SL::Presenter->input_tag('invoice_ids.' . $::form->{bt_id} . '[]', $::form->{prop_id} , type => 'hidden'); |
|
341 |
$html .= SL::Presenter->escape(t8('Invno.') . ': ' . $invoice->invnumber . ' '); |
|
342 |
$html .= SL::Presenter->escape(t8('Open amount') . ': ' . $::form->format_amount(\%::myconfig, $invoice->open_amount, 2) . ' '); |
|
343 |
$html .= SL::Presenter->select_tag('invoice_skontos.' . $::form->{bt_id} . '[]', |
|
344 |
\@select_options, |
|
345 |
value_key => 'payment_type', |
|
346 |
title_key => 'display' ) |
|
347 |
if @select_options; |
|
348 |
$html .= SL::Presenter->html_tag('a', 'x', href => '#', onclick => "kivi.BankTransaction.delete_invoice(" . $::form->{bt_id} . ',' . $::form->{prop_id} . ")"); |
|
349 |
$html = SL::Presenter->html_tag('div', $html, id => $::form->{bt_id} . '.' . $::form->{prop_id}, 'data-invoice-amount' => $invoice->open_amount * 1); |
|
350 |
|
|
351 |
$self->render(\ SL::JSON::to_json( { 'html' => $html } ), { layout => 0, type => 'json', process => 0 }); |
|
340 |
$html = $self->render( |
|
341 |
'bank_transactions/_payment_suggestion', { output => 0 }, |
|
342 |
bt_id => $::form->{bt_id}, |
|
343 |
prop_id => $::form->{prop_id}, |
|
344 |
invoice => $invoice, |
|
345 |
SELECT_OPTIONS => \@select_options, |
|
346 |
); |
|
347 |
|
|
348 |
$self->render(\ SL::JSON::to_json( { 'html' => "$html" } ), { layout => 0, type => 'json', process => 0 }); |
|
352 | 349 |
}; |
353 | 350 |
|
354 | 351 |
sub action_filter_drafts { |
... | ... | |
521 | 518 |
push @{ $self->problems }, $self->save_single_bank_transaction( |
522 | 519 |
bank_transaction_id => $bank_transaction_id, |
523 | 520 |
invoice_ids => $invoice_ids, |
521 |
sources => [ map { $::form->{"sources_${bank_transaction_id}_${_}"} } @{ $invoice_ids } ], |
|
522 |
memos => [ map { $::form->{"memos_${bank_transaction_id}_${_}"} } @{ $invoice_ids } ], |
|
524 | 523 |
); |
525 | 524 |
$count += scalar( @{$invoice_ids} ); |
526 | 525 |
} |
js/kivi.BankTransaction.js | ||
---|---|---|
13 | 13 |
}; |
14 | 14 |
|
15 | 15 |
ns.add_invoices = function(bank_transaction_id, proposal_id) { |
16 |
$('[data-proposal-id=' + proposal_id + ']').hide(); |
|
17 | 16 |
|
18 | 17 |
$.ajax({ |
19 | 18 |
url: 'controller.pl?action=BankTransaction/ajax_payment_suggestion&bt_id=' + bank_transaction_id + '&prop_id=' + proposal_id, |
20 | 19 |
success: function(data) { |
21 |
$('#assigned_invoices_' + bank_transaction_id).append(data.html); |
|
20 |
$('#assigned_invoices_' + bank_transaction_id + "_" + proposal_id).html(data.html); |
|
21 |
$('#sources_' + bank_transaction_id + "_" + proposal_id + ',' + |
|
22 |
'#memos_' + bank_transaction_id + "_" + proposal_id).show(); |
|
23 |
$('[data-proposal-id=' + proposal_id + ']').hide(); |
|
24 |
|
|
22 | 25 |
ns.update_invoice_amount(bank_transaction_id); |
23 | 26 |
} |
24 | 27 |
}); |
25 | 28 |
}; |
26 | 29 |
|
27 | 30 |
ns.delete_invoice = function(bank_transaction_id, proposal_id) { |
28 |
$( "#" + bank_transaction_id + "\\." + proposal_id ).remove(); |
|
31 |
var $inputs = $('#sources_' + bank_transaction_id + "_" + proposal_id + ',' + |
|
32 |
'#memos_' + bank_transaction_id + "_" + proposal_id); |
|
33 |
|
|
29 | 34 |
$('[data-proposal-id=' + proposal_id + ']').show(); |
35 |
$('#assigned_invoices_' + bank_transaction_id + "_" + proposal_id).html(''); |
|
36 |
$('#extra_row_' + bank_transaction_id + '_' + proposal_id).remove(); |
|
37 |
|
|
38 |
$inputs.hide(); |
|
39 |
$inputs.val(''); |
|
40 |
|
|
30 | 41 |
ns.update_invoice_amount(bank_transaction_id); |
31 | 42 |
}; |
32 | 43 |
|
... | ... | |
59 | 70 |
$.ajax({ |
60 | 71 |
url: url, |
61 | 72 |
success: function(new_html) { |
62 |
$('#assigned_invoices_' + bank_transaction_id).append(new_html);
|
|
73 |
$('#bt_rows_' + bank_transaction_id).append(new_html);
|
|
63 | 74 |
$('#assign_invoice_window').dialog('close'); |
64 | 75 |
ns.update_invoice_amount(bank_transaction_id); |
65 | 76 |
} |
templates/webpages/bank_transactions/_payment_suggestion.html | ||
---|---|---|
1 |
[%- USE P -%][%- USE HTML -%][%- USE LxERP -%] |
|
2 |
<span id="[% HTML.escape(bt_id) %].[% HTML.escape(prop_id) %]" data-invoice-amount="[% HTML.escape(invoice.open_amount * 1) %]"> |
|
3 |
[% P.hidden_tag("invoice_ids." _ bt_id _ "[]", prop_id) %] |
|
4 |
[% LxERP.t8("Invno.") %]: [% HTML.escape(invoice.invnumber) %] |
|
5 |
[% LxERP.t8("Open amount") %]: [% LxERP.format_amount(invoice.open_amount, 2) %] |
|
6 |
[% IF SELECT_OPTIONS.size %] |
|
7 |
[% P.select_tag("invoice_skontos." _ bt_id _ "[]", SELECT_OPTIONS, value_key="payment_type", title_key="display") %] |
|
8 |
[% END %] |
|
9 |
[% P.link("#", "x", onclick="kivi.BankTransaction.delete_invoice(" _ bt_id _ "," _ prop_id _ ")") %] |
|
10 |
</span> |
templates/webpages/bank_transactions/invoices.html | ||
---|---|---|
1 |
[% USE L %] |
|
2 |
[% USE T8 %] |
|
3 |
[% USE LxERP %][%- USE HTML -%] |
|
1 |
[%- USE HTML -%][%- USE LxERP -%][%- USE P -%] |
|
2 |
[% SET debug=1 %] |
|
4 | 3 |
[% FOREACH invoice = INVOICES %] |
5 |
<div id="[% bt_id %].[% invoice.id %]" data-invoice-amount="[% HTML.escape(invoice.open_amount * 1) %]"> |
|
6 |
[% L.hidden_tag('invoice_ids.' _ bt_id _'[]', invoice.id) %] |
|
7 |
[% 'Invno.' | $T8 %]: [% invoice.invnumber %] |
|
8 |
[% 'Open amount' | $T8 %]: [% LxERP.format_amount(invoice.open_amount, 2) %] |
|
9 |
<a href=# onclick="kivi.BankTransaction.delete_invoice([% bt_id %], [% invoice.id %])">x</a> |
|
10 |
</div> |
|
4 |
<tr id="extra_row_[% HTML.escape(bt_id) %]_[% HTML.escape(invoice.id) %]"> |
|
5 |
<td></td> |
|
6 |
<td></td> |
|
7 |
<td id="assigned_invoices_[% bt.id %]_[% invoice.id %]"> |
|
8 |
<span id="[% bt_id %].[% invoice.id %]" data-invoice-amount="[% HTML.escape(invoice.open_amount * 1) %]"> |
|
9 |
[% P.hidden_tag("invoice_ids." _ bt_id _"[]", invoice.id) %] |
|
10 |
[% LxERP.t8("Invno.") %]: [% HTML.escape(invoice.invnumber) %] |
|
11 |
[% LxERP.t8("Open amount") %]: [% LxERP.format_amount(invoice.open_amount, 2) %] |
|
12 |
[% P.link("#", "x", onclick="kivi.BankTransaction.delete_invoice(" _ bt_id _ "," _ invoice.id _ ")") %] |
|
13 |
</span> |
|
14 |
</td> |
|
15 |
<td>[% P.input_tag("sources_" _ bt_id _ "_" _ invoice.id, "") %]</td> |
|
16 |
<td>[% P.input_tag("memos_" _ bt_id _ "_" _ invoice.id, "") %]</td> |
|
17 |
[% IF debug %] |
|
18 |
<td></td> |
|
19 |
[% END %] |
|
20 |
<td></td> |
|
21 |
<td></td> |
|
22 |
<td></td> |
|
23 |
<td></td> |
|
24 |
<td></td> |
|
25 |
<td></td> |
|
26 |
<td></td> |
|
27 |
<td></td> |
|
28 |
<td></td> |
|
29 |
<td></td> |
|
30 |
<td></td> |
|
31 |
</tr> |
|
11 | 32 |
[% END %] |
templates/webpages/bank_transactions/tabs/all.html | ||
---|---|---|
1 |
[%- USE HTML -%][%- USE LxERP -%][%- USE L -%][%- USE T8 -%] |
|
1 |
[%- USE HTML -%][%- USE LxERP -%][%- USE L -%][%- USE T8 -%][%- USE P -%] |
|
2 |
|
|
3 |
[% BLOCK proposal_div %] |
|
4 |
<div data-proposal-id="[% prop.id %]"> |
|
5 |
<a href=# onclick="kivi.BankTransaction.add_invoices('[% bt.id %]', '[% prop.id %]');" |
|
6 |
title="<table><tr><th></th><th>[% 'Suggested invoice' | $T8 %][% IF !prop.is_sales %] ([% 'AP' | $T8 %])[% END %]</th><th>[% 'Bank transaction' | $T8 %]</th></tr><tr><th>[% 'Amount' | $T8 %]</th><td>[% prop.realamount %] ([% 'open' | $T8 %]: [% LxERP.format_amount(prop.open_amount, 2) %])</td><td>[% LxERP.format_amount(bt.amount, 2) %]</td></tr>[% IF prop.skonto_date %]<tr><th>[% 'Payment terms' | $T8 %]</th><td>[% LxERP.format_amount(prop.amount_less_skonto, 2) %] [% 'until' | $T8 %] [% HTML.escape(prop.skonto_date.to_kivitendo) %] ([% prop.percent_skonto * 100 %] %)</td><td></td></tr>[% END %]<tr><th>[% 'Customer/Vendor' | $T8 %]</th><td>[% HTML.escape(prop.customer.displayable_name) %][% HTML.escape(prop.vendor.displayable_name) %]</td><td>[% HTML.escape(bt.remote_name) %]</td></tr><tr><th>[% 'Invoice Date' | $T8 %]</th><td>[% HTML.escape(prop.transdate_as_date) %]</td><td>[% HTML.escape(bt.transdate_as_date) %] ([% HTML.escape(bt.transdate.utc_rd_days - prop.transdate.utc_rd_days) %])</td></tr><tr><th>[% 'Invoice Number' | $T8 %]</th><td>[% HTML.escape(prop.invnumber) %]</td><td>[% HTML.escape(bt.purpose) %]</td></tr></table>" |
|
7 |
class="[% IF bt.agreement >= 5 %]green[% ELSIF bt.agreement < 5 and bt.agreement >= 3 %]orange[% ELSE %]red[% END %] tooltipster-html">←[% HTML.escape(prop.invnumber)%]</a> |
|
8 |
</div> |
|
9 |
[% END %] |
|
2 | 10 |
|
3 | 11 |
[% SET debug=1 %] |
4 | 12 |
<form method="post" id="list_all_form"> |
... | ... | |
13 | 21 |
<tr class="listheading"> |
14 | 22 |
<th></th> |
15 | 23 |
<th></th> |
16 |
<th>[% 'Assigned invoices' | $T8 %] [% 'with amount' | $T8 %]</th> |
|
24 |
<th>[% LxERP.t8("Assigned invoices with amount") %]</th> |
|
25 |
<th style="width: 100px">[% LxERP.t8("Source") %]</th> |
|
26 |
<th style="width: 100px">[% LxERP.t8("Memo") %]</th> |
|
17 | 27 |
[% IF debug %] |
18 | 28 |
<th>[% 'Score' | $T8 %]</th> |
19 | 29 |
[% END %] |
... | ... | |
80 | 90 |
</tr> |
81 | 91 |
</thead> |
82 | 92 |
|
83 |
<tbody> |
|
84 |
[%- FOREACH bt = BANK_TRANSACTIONS %] |
|
85 |
<tr class="listrow" id="bt_id_[% bt.id %]"> |
|
86 |
<td><a href=# onclick="kivi.BankTransaction.assign_invoice('[% bt.id %]'); return false;">[% 'Assign invoice' | $T8 %]</a></td> |
|
87 |
<td><a href=# onclick="kivi.BankTransaction.create_invoice('[% bt.id %]'); return false;">[% 'Create invoice' | $T8 %]</a></td> |
|
88 |
<td id="assigned_invoices_[% bt.id %]" nowrap></td> |
|
89 |
[% IF debug %] |
|
90 |
<td class="tooltipster-html" title="[% FOREACH match = bt.rule_matches %] [% match %]<br> [% END %]">[% bt.agreement %]</td> |
|
91 |
[% END %] |
|
92 |
<td> |
|
93 |
[% FOREACH prop = bt.proposals %] |
|
94 |
<div data-proposal-id="[% prop.id %]"> |
|
95 |
<a href=# onclick="kivi.BankTransaction.add_invoices('[% bt.id %]', '[% prop.id %]');" |
|
96 |
title="<table><tr><th></th><th>[% 'Suggested invoice' | $T8 %][% IF !prop.is_sales %] ([% 'AP' | $T8 %])[% END %]</th><th>[% 'Bank transaction' | $T8 %]</th></tr><tr><th>[% 'Amount' | $T8 %]</th><td>[% prop.realamount %] ([% 'open' | $T8 %]: [% LxERP.format_amount(prop.open_amount, 2) %])</td><td>[% LxERP.format_amount(bt.amount, 2) %]</td></tr>[% IF prop.skonto_date %]<tr><th>[% 'Payment terms' | $T8 %]</th><td>[% LxERP.format_amount(prop.amount_less_skonto, 2) %] [% 'until' | $T8 %] [% HTML.escape(prop.skonto_date.to_kivitendo) %] ([% prop.percent_skonto * 100 %] %)</td><td></td></tr>[% END %]<tr><th>[% 'Customer/Vendor' | $T8 %]</th><td>[% HTML.escape(prop.customer.displayable_name) %][% HTML.escape(prop.vendor.displayable_name) %]</td><td>[% HTML.escape(bt.remote_name) %]</td></tr><tr><th>[% 'Invoice Date' | $T8 %]</th><td>[% HTML.escape(prop.transdate_as_date) %]</td><td>[% HTML.escape(bt.transdate_as_date) %] ([% HTML.escape(bt.transdate.utc_rd_days - prop.transdate.utc_rd_days) %])</td></tr><tr><th>[% 'Invoice Number' | $T8 %]</th><td>[% HTML.escape(prop.invnumber) %]</td><td>[% HTML.escape(bt.purpose) %]</td></tr></table>" |
|
97 |
class="[% IF bt.agreement >= 5 %]green[% ELSIF bt.agreement < 5 and bt.agreement >= 3 %]orange[% ELSE %]red[% END %] tooltipster-html">←[% HTML.escape(prop.invnumber)%]</a></div> |
|
98 |
[% END %] |
|
99 |
</td> |
|
100 |
<td align=right>[% bt.transdate_as_date %]</td> |
|
101 |
<td align=right>[% LxERP.format_amount(bt.amount, 2) %]</td> |
|
102 |
<td align=right id="invoice_amount_[% HTML.escape(bt.id) %]" data-invoice-amount="[% HTML.escape(bt.invoice_amount) %]">[% HTML.escape(LxERP.format_amount(bt.invoice_amount, 2)) %]</td> |
|
103 |
<td>[% HTML.escape(bt.remote_name) %]</td> |
|
104 |
<td>[% HTML.escape(bt.purpose) %]</td> |
|
105 |
<td>[% HTML.escape(bt.transaction_text) %]</td> |
|
106 |
<td>[% HTML.escape(bt.remote_account_number) %]</td> |
|
107 |
<td>[% HTML.escape(bt.remote_bank_code) %]</td> |
|
108 |
<td align=right>[% bt.valutadate_as_date %]</td> |
|
109 |
<td align=center>[% HTML.escape(bt.currency.name) %]</td> |
|
110 |
</tr> |
|
111 |
[%- END %] |
|
112 |
</tbody> |
|
93 |
[%- FOREACH bt = BANK_TRANSACTIONS %] |
|
94 |
<tbody class="listrow" id="bt_rows_[% HTML.escape(bt.id) %]"> |
|
95 |
[% FOREACH prop = bt.proposals %] |
|
96 |
[% IF loop.first %] |
|
97 |
<tr id="bt_id_[% bt.id %]"> |
|
98 |
<td><a href=# onclick="kivi.BankTransaction.assign_invoice('[% bt.id %]'); return false;">[% 'Assign invoice' | $T8 %]</a></td> |
|
99 |
<td><a href=# onclick="kivi.BankTransaction.create_invoice('[% bt.id %]'); return false;">[% 'Create invoice' | $T8 %]</a></td> |
|
100 |
<td id="assigned_invoices_[% bt.id %]_[% prop.id %]"></td> |
|
101 |
<td>[% P.input_tag("sources_" _ bt.id _ "_" _ prop.id, "", class="hidden") %]</td> |
|
102 |
<td>[% P.input_tag("memos_" _ bt.id _ "_" _ prop.id, "", class="hidden") %]</td> |
|
103 |
[% IF debug %] |
|
104 |
<td class="tooltipster-html" title="[% FOREACH match = bt.rule_matches %] [% match %]<br> [% END %]">[% bt.agreement %]</td> |
|
105 |
[% END %] |
|
106 |
<td> |
|
107 |
[% PROCESS proposal_div %] |
|
108 |
</td> |
|
109 |
<td align="right">[% bt.transdate_as_date %]</td> |
|
110 |
<td align="right">[% LxERP.format_amount(bt.amount, 2) %]</td> |
|
111 |
<td align="right" id="invoice_amount_[% HTML.escape(bt.id) %]" data-invoice-amount="[% HTML.escape(bt.invoice_amount) %]">[% HTML.escape(LxERP.format_amount(bt.invoice_amount, 2)) %]</td> |
|
112 |
<td>[% HTML.escape(bt.remote_name) %]</td> |
|
113 |
<td>[% HTML.escape(bt.purpose) %]</td> |
|
114 |
<td>[% HTML.escape(bt.transaction_text) %]</td> |
|
115 |
<td>[% HTML.escape(bt.remote_account_number) %]</td> |
|
116 |
<td>[% HTML.escape(bt.remote_bank_code) %]</td> |
|
117 |
<td align="right">[% bt.valutadate_as_date %]</td> |
|
118 |
<td align="center">[% HTML.escape(bt.currency.name) %]</td> |
|
119 |
</tr> |
|
120 |
[% ELSE # loop.first %] |
|
121 |
<tr> |
|
122 |
<td></td> |
|
123 |
<td></td> |
|
124 |
<td id="assigned_invoices_[% bt.id %]_[% prop.id %]"></td> |
|
125 |
<td>[% P.input_tag("sources_" _ bt.id _ "_" _ prop.id, "", class="hidden") %]</td> |
|
126 |
<td>[% P.input_tag("memos_" _ bt.id _ "_" _ prop.id, "", class="hidden") %]</td> |
|
127 |
[% IF debug %] |
|
128 |
<td></td> |
|
129 |
[% END %] |
|
130 |
<td> |
|
131 |
[% PROCESS proposal_div %] |
|
132 |
</td> |
|
133 |
<td></td> |
|
134 |
<td></td> |
|
135 |
<td></td> |
|
136 |
<td></td> |
|
137 |
<td></td> |
|
138 |
<td></td> |
|
139 |
<td></td> |
|
140 |
<td></td> |
|
141 |
<td></td> |
|
142 |
<td></td> |
|
143 |
</tr> |
|
144 |
[% END # loop.first %] |
|
145 |
[% END # FOREACH proposal %] |
|
146 |
</tbody> |
|
147 |
[%- END %] |
|
113 | 148 |
</table> |
114 |
[% L.submit_tag('action_save_invoices', LxERP.t8('Save invoices')) %] |
|
149 |
|
|
150 |
<p> |
|
151 |
[% L.submit_tag('action_save_invoices', LxERP.t8('Save invoices')) %] |
|
152 |
[% L.button_tag('kivi.BankTransaction.show_set_all_sources_memos_dialog("#list_all_form [name^=\\"sources_\\"]:visible", "#list_all_form [name^=\\"memos_\\"]:visible")', LxERP.t8('Set all source and memo fields')) %] |
|
153 |
</p> |
|
115 | 154 |
|
116 | 155 |
</form> |
Auch abrufbar als: Unified diff
Kontoauszug verbuchen: Beleg/Memo bei »Alle Buchungen« angeben können