Revision 38b14007
Von Jan Büren vor mehr als 2 Jahren hinzugefügt
SL/SEPA.pm | ||
---|---|---|
|
||
${arap}.amount - ${arap}.paid - COALESCE(open_transfers.amount, 0) AS open_amount,
|
||
COALESCE(open_transfers.amount, 0) AS transfer_amount,
|
||
pt.description as pt_description
|
||
|
||
pt.description as pt_description,
|
||
(current_date < (${arap}.transdate + pt.terms_skonto)) as within_skonto_period
|
||
FROM ${arap}
|
||
LEFT JOIN ${vc} vc ON (${arap}.${vc}_id = vc.id)
|
||
LEFT JOIN (SELECT sei.${arap}_id, SUM(sei.amount) + SUM(COALESCE(sei.skonto_amount,0)) AS amount
|
||
... | ... | |
# add some more data to $results:
|
||
# create drop-down data for payment types and suggest amount to be paid according
|
||
# to open amount or skonto
|
||
# One minor fault: amount_less_skonto does not subtract the not yet booked sepa transfer amounts
|
||
|
||
foreach my $result ( @$results ) {
|
||
my $invoice = $vc eq 'customer' ? SL::DB::Manager::Invoice->find_by( id => $result->{id} )
|
||
: SL::DB::Manager::PurchaseInvoice->find_by( id => $result->{id} );
|
||
|
||
$invoice->get_payment_suggestions(sepa => 1); # consider amounts of open entries in sepa_export_items
|
||
$result->{skonto_amount} = $invoice->skonto_amount;
|
||
$result->{within_skonto_period} = $invoice->within_skonto_period;
|
||
$result->{invoice_amount_suggestion} = $invoice->{invoice_amount_suggestion};
|
||
$result->{payment_select_options} = $invoice->{payment_select_options};
|
||
};
|
||
my @options;
|
||
push @options, { payment_type => 'without_skonto', display => t8('without skonto') };
|
||
push @options, { payment_type => 'with_skonto_pt', display => t8('with skonto acc. to pt'), selected => 1 } if $result->{within_skonto_period};
|
||
$result->{payment_select_options} = \@options;
|
||
}
|
||
|
||
$main::lxdebug->leave_sub();
|
||
|
locale/de/all | ||
---|---|---|
'SAVED FOR DUNNING' => 'Gespeichert zum Mahnen',
|
||
'SCREENED' => 'Angezeigt',
|
||
'SEPA' => 'SEPA',
|
||
'SEPA Transfer Amount' => 'Betrag in offenen SEPA Exporten',
|
||
'SEPA XML download' => 'SEPA-XML-Download',
|
||
'SEPA creditor ID' => 'SEPA-Kreditoren-Identifikation',
|
||
'SEPA exports' => 'SEPA-Exporte',
|
templates/webpages/sepa/bank_transfer_add.html | ||
---|---|---|
<th class="listheading">[% IF is_vendor %][% 'Vendor' | $T8 %][%- ELSE %][%- LxERP.t8('Customer') %][%- END %]</th>
|
||
<th class="listheading">[% 'Invoice' | $T8 %]</th>
|
||
<th class="listheading" align="right">[% 'Amount' | $T8 %]</th>
|
||
<th class="listheading" align="right">[% 'SEPA Transfer Amount' | $T8 %]</th>
|
||
<th class="listheading" align="right">[% 'Open amount' | $T8 %]</th>
|
||
<th class="listheading" align="right">[% 'Invoice Date' | $T8 %]</th>
|
||
<th class="listheading" align="right">[% 'Due Date' | $T8 %]</th>
|
||
... | ... | |
[%- FOREACH invoice = INVOICES %]
|
||
<input type="hidden" name="bank_transfers[+].[% arap %]_id" value="[% HTML.escape(invoice.id) %]">
|
||
<input type="hidden" id="amount_less_skonto_[% loop.count %]" name="amount_less_skonto_[% loop.count %]" value="[% LxERP.format_amount(invoice.amount_less_skonto, 2) %]">
|
||
<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) %]">
|
||
<input type="hidden" id="invoice_open_amount_[% loop.count %]" name="invoice_open_amount_[% loop.count %]" value="[% LxERP.format_amount(invoice.open_amount - invoice.transfer_amount, 2) %]">
|
||
<input type="hidden" id="skonto_amount_[% loop.count %]" name="skonto_amount_[% loop.count %]" value="[% LxERP.format_amount(invoice.skonto_amount, 2) %]">
|
||
|
||
|
||
... | ... | |
</a>
|
||
</td>
|
||
|
||
<td align="right">[% LxERP.format_amount(invoice.invoice_amount-invoice.open_sepa_transfer_amount, 2) %]</td>
|
||
<td align="right">[% LxERP.format_amount(invoice.open_amount-invoice.open_sepa_transfer_amount, 2) %]</td>
|
||
<td align="right">[% LxERP.format_amount(invoice.invoice_amount, 2) %]</td>
|
||
<td align="right">[% LxERP.format_amount(invoice.transfer_amount * -1, 2) %]</td>
|
||
<td align="right">[% IF invoice.within_skonto_period %] [% LxERP.format_amount(invoice.amount_less_skonto, 2) %] [% ELSE %] [% LxERP.format_amount(invoice.open_amount - invoice.transfer_amount, 2) %][% END %] </td>
|
||
<td align="right">[% invoice.transdate %]</td>
|
||
<td align="right">[% invoice.duedate %]</td>
|
||
<td>
|
||
... | ... | |
<input name="bank_transfers[].reference" value="[% HTML.escape(reference.substr(0, 140)) %]" maxlength="140" size="30">
|
||
</td>
|
||
<td align="right">
|
||
<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">
|
||
<input id=[% loop.count %] name="bank_transfers[].amount" id="amount_[% loop.count %]" value="[% IF invoice.within_skonto_period %] [% LxERP.format_amount(invoice.amount_less_skonto, 2) %] [% ELSE %] [% LxERP.format_amount(invoice.open_amount - invoice.transfer_amount, 2) %][% END %]" style="text-align: right" size="12">
|
||
</td>
|
||
<td>
|
||
[% 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' ) %]
|
||
... | ... | |
// alert("found id " + id);
|
||
if ( $(this).val() == "without_skonto" ) {
|
||
$('#' + id).val( $('#invoice_open_amount_' + id).val() );
|
||
} else if ( $(this).val() == "difference_as_skonto" ) {
|
||
$('#' + id).val( $('#invoice_open_amount_' + id).val() );
|
||
} else if ( $(this).val() == "with_skonto_pt" ) {
|
||
$('#' + id).val( $('#amount_less_skonto_' + id).val() );
|
||
}
|
Auch abrufbar als: Unified diff
SEPA: within_skonto_period direkt aus SQL Abfrage und keine Helper-Funktionen
- transfer_amount aus sql ist identisch mit open_sepa_transfer_amount
- SEPA Transfer Amount in Template auch als Wert angeben