push @{ $self->problems }, $self->save_single_bank_transaction(
bank_transaction_id => $bank_transaction_id,
invoice_ids => $invoice_ids,
+ sources => ($::form->{sources} // {})->{$_},
+ memos => ($::form->{memos} // {})->{$_},
);
$count += scalar( @{$invoice_ids} );
}
sub action_save_proposals {
my ($self) = @_;
+
if ( $::form->{proposal_ids} ) {
my $propcount = scalar(@{ $::form->{proposal_ids} });
if ( $propcount > 0 ) {
my $n_invoices = 0;
foreach my $invoice (@{ $data{invoices} }) {
+ my $source = ($data{sources} // [])->[$n_invoices];
+ my $memo = ($data{memos} // [])->[$n_invoices];
$n_invoices++ ;
trans_id => $invoice->id,
amount => $open_amount,
payment_type => $payment_type,
+ source => $source,
+ memo => $memo,
transdate => $bank_transaction->transdate->to_kivitendo);
} elsif ( $invoice->is_sales && $invoice->type eq 'credit_note' ) {
# no check for overpayment/multiple payments
trans_id => $invoice->id,
amount => $invoice->open_amount,
payment_type => $payment_type,
+ source => $source,
+ memo => $memo,
transdate => $bank_transaction->transdate->to_kivitendo);
} else { # use the whole amount of the bank transaction for the invoice, overpay the invoice if necessary
my $overpaid_amount = $amount_of_transaction - $invoice->open_amount;
trans_id => $invoice->id,
amount => $amount_of_transaction,
payment_type => $payment_type,
+ source => $source,
+ memo => $memo,
transdate => $bank_transaction->transdate->to_kivitendo);
$bank_transaction->invoice_amount($bank_transaction->amount);
$amount_of_transaction = 0;
my $reference_account = $self->reference_account;
croak "can't find reference account (link = AR/AP) for invoice" unless ref $reference_account;
- my $memo = $params{'memo'} || '';
- my $source = $params{'source'} || '';
+ my $memo = $params{memo} // '';
+ my $source = $params{source} // '';
my $rounded_params_amount = _round( $params{amount} ); # / $exchangerate);
my $fx_gain_loss_amount = 0; # for fx_gain and fx_loss
$.cookie('jquery_ui_tab_bt_tabs', ui_tab);
};
+
+ ns.show_set_all_sources_memos_dialog = function(sources_selector, memos_selector) {
+ var dlg_id = 'set_all_sources_memos_dialog';
+ var $dlg = $('#' + dlg_id);
+
+ $dlg.data('sources-selector', sources_selector);
+ $dlg.data('memos-selector', memos_selector);
+
+ $('#set_all_sources').val('');
+ $('#set_all_memos').val('');
+
+ kivi.popup_dialog({
+ id: dlg_id,
+ dialog: {
+ title: kivi.t8('Set all source and memo fields')
+ }
+ });
+ };
+
+ ns.set_all_sources_memos = function(sources_selector, memos_selector) {
+ var $dlg = $('#set_all_sources_memos_dialog');
+
+ ['sources', 'memos'].forEach(function(type) {
+ var value = $('#set_all_' + type).val();
+ if (value !== '')
+ $($dlg.data(type + '-selector')).each(function(idx, input) {
+ $(input).val(value);
+ });
+ });
+
+ $dlg.dialog('close');
+ };
});
"Save and keep open":"Speichern und geöffnet lassen",
"Section/Function block actions":"Abschnitts-/Funktionsblockaktionen",
"Select template to paste":"Einzufügende Vorlage auswählen",
+"Set all source and memo fields":"Alle Beleg-/Memo-Felder setzen",
"Show all details":"Alle Details anzeigen",
"Show details":"Details anzeigen",
"Subject":"Betreff",
'Service, assembly or part' => 'Dienstleistung, Erzeugnis oder Ware',
'Services' => 'Dienstleistungen',
'Set (set to)' => 'Setze',
+ 'Set all source and memo fields' => 'Alle Beleg-/Memo-Felder setzen',
'Set count for one or more of the items to select them' => 'Zum Selektieren bitte Menge für einen oder mehrere Artikel setzen',
'Set eMail text' => 'E-Mail Text eingeben',
+ 'Set fields' => 'Felder setzen',
'Set lastcost' => 'EK-Preis übernehmen',
'Set sellprice' => 'VK-Preis übernehmen',
'Set to paid missing' => 'Fehlbetrag setzen',
<div id="automatic">[% PROCESS "bank_transactions/tabs/automatic.html" %]</div>
</div>
+<div id="set_all_sources_memos_dialog" class="hidden">
+ <table>
+ <tr>
+ <th>[% LxERP.t8("Source") %]:</th>
+ <td>[% L.input_tag("set_all_sources", "") %]</td>
+ </tr>
+
+ <tr>
+ <th>[% LxERP.t8("Memo") %]:</th>
+ <td>[% L.input_tag("set_all_memos", "") %]</td>
+ </tr>
+ </table>
+
+ <p>
+ [% L.button_tag("kivi.BankTransaction.set_all_sources_memos()", LxERP.t8("Set fields")) %]
+ <a href="#" onclick="$('#set_all_sources_memos_dialog').dialog('close');">[%- LxERP.t8("Cancel") %]</a>
+ </p>
+</div>
<script type="text/javascript">
<!--
[%- USE HTML -%][%- USE LxERP -%][%- USE L -%][%- USE T8 -%]
[% SET debug=1 %]
-<form method="post" id="list_form">
+<form method="post" id="list_all_form">
[% L.hidden_tag('filter.bank_account', FORM.filter.bank_account) %]
[% L.hidden_tag('filter.fromdate', FORM.filter.fromdate) %]
[% L.hidden_tag('filter.todate', FORM.filter.todate) %]
[%- USE HTML -%][%- USE LxERP -%][%- USE L -%][%- USE T8 -%]
-<form method="post" id="list_form">
+<form method="post" id="list_automatic_form">
[% L.hidden_tag('filter.bank_account', FORM.filter.bank_account) %]
[% L.hidden_tag('filter.fromdate', FORM.filter.fromdate) %]
[% L.hidden_tag('filter.todate', FORM.filter.todate) %]
<th>[% 'Skonto' | $T8 %]</th>
<th>[% 'Purpose/Reference' | $T8 %]</th>
<th>[% 'Customer/Vendor/Remote name' | $T8 %]</th>
+ <th>[% LxERP.t8("Source") %]</th>
+ <th>[% LxERP.t8("Memo") %]</th>
</tr>
</thead>
[% IF !PROPOSALS.size %]
END %]
</td>
<td>[% HTML.escape(proposal.remote_name) %]</td>
+ <td></td>
+ <td></td>
</tr>
[% FOREACH proposed_invoice = proposal.proposals %]
[% L.hidden_tag("invoice_skontos." _ proposal.id _ "[]", proposed_invoice.skonto_type) %]</td>
<td[% IF proposed_invoice.invnumber == invnumber_found %] class="invoice_number_highlight"[% END %]>[% proposed_invoice.link %]</td>
<td>[% HTML.escape(proposed_invoice.customer.name) %][% HTML.escape(proposed_invoice.vendor.name) %]</td>
+ <td>[% L.input_tag("sources." _ proposal.id _ "[]", "", size=20) %]</td>
+ <td>[% L.input_tag("memos." _ proposal.id _ "[]", "", size=20) %]</td>
</tr>
[% END %]
- <tr><td style="height:10px" colspan="8"></td></tr>
+ <tr><td style="height:10px" colspan="10"></td></tr>
</tbody>
[% END %]
[% END %]
</table>
-[% L.submit_tag('action_save_proposals', LxERP.t8('Save proposals')) %]
+
+<p>
+ [% L.submit_tag('action_save_proposals', LxERP.t8('Save proposals')) %]
+ [% L.button_tag('kivi.BankTransaction.show_set_all_sources_memos_dialog("#list_automatic_form [name^=\\"sources.\\"]", "#list_automatic_form [name^=\\"memos.\\"]")', LxERP.t8('Set all source and memo fields')) %]
+</p>
</form>