}
sub number_of_payments {
- my $transactions = shift;
+ my $invoice = shift;
my $number_of_payments;
my $paid_amount;
- foreach my $transaction ( @$transactions ) {
+ foreach my $transaction ( @{ $invoice->transactions } ) {
if ( $transaction->chart_link =~ /(AR_paid|AP_paid)/ ) {
$paid_amount += $transaction->amount ;
$number_of_payments++;
};
sub total_amount {
- my $transactions = shift;
+ my $invoice = shift;
- my $total = sum map { $_->amount } @$transactions;
+ my $total = sum map { $_->amount } @{ $invoice->transactions };
return $::form->round_amount($total, 5);
$invoice->pay_invoice( %params );
- my ($number_of_payments, $paid_amount) = number_of_payments($invoice->transactions);
- my $total = total_amount($invoice->transactions);
+ my ($number_of_payments, $paid_amount) = number_of_payments($invoice);
+ my $total = total_amount($invoice);
my $title = 'default invoice, one item, 19% tax, without_skonto';
$params{amount} = '-10.00';
$invoice->pay_invoice( %params );
- my ($number_of_payments, $paid_amount) = number_of_payments($invoice->transactions);
- my $total = total_amount($invoice->transactions);
+ my ($number_of_payments, $paid_amount) = number_of_payments($invoice);
+ my $total = total_amount($invoice);
my $title = 'default invoice, one item, 19% tax, without_skonto';
$invoice->pay_invoice( %params );
- my ($number_of_payments, $paid_amount) = number_of_payments($invoice->transactions);
- my $total = total_amount($invoice->transactions);
+ my ($number_of_payments, $paid_amount) = number_of_payments($invoice);
+ my $total = total_amount($invoice);
my $title = 'default invoice, two items, 19/7% tax with_skonto_pt';
$invoice->pay_invoice( %params );
- my ($number_of_payments, $paid_amount) = number_of_payments($invoice->transactions);
- my $total = total_amount($invoice->transactions);
+ my ($number_of_payments, $paid_amount) = number_of_payments($invoice);
+ my $total = total_amount($invoice);
my $title = 'default invoice, two items, 19/7% tax with_skonto_pt';
$invoice->pay_invoice( %params );
- my ($number_of_payments, $paid_amount) = number_of_payments($invoice->transactions);
- my $total = total_amount($invoice->transactions);
+ my ($number_of_payments, $paid_amount) = number_of_payments($invoice);
+ my $total = total_amount($invoice);
my $title = 'default invoice, two items, 19/7% tax without skonto';
transdate => DateTime->today_local->to_kivitendo,
);
- my ($number_of_payments, $paid_amount) = number_of_payments($invoice->transactions);
- my $total = total_amount($invoice->transactions);
+ my ($number_of_payments, $paid_amount) = number_of_payments($invoice);
+ my $total = total_amount($invoice);
my $title = 'default invoice, two items, 19/7% tax without skonto incomplete payment';
transdate => DateTime->today_local->to_kivitendo
);
- my ($number_of_payments, $paid_amount) = number_of_payments($invoice->transactions);
- my $total = total_amount($invoice->transactions);
+ my ($number_of_payments, $paid_amount) = number_of_payments($invoice);
+ my $total = total_amount($invoice);
my $title = 'default invoice, two items, 19/7% tax not included';
transdate => DateTime->today_local->to_kivitendo
);
- my ($number_of_payments, $paid_amount) = number_of_payments($invoice->transactions);
- my $total = total_amount($invoice->transactions);
+ my ($number_of_payments, $paid_amount) = number_of_payments($invoice);
+ my $total = total_amount($invoice);
my $title = 'default invoice, two items, 19/7% tax not included';
transdate => DateTime->today_local->to_kivitendo
);
- my ($number_of_payments, $paid_amount) = number_of_payments($invoice->transactions);
- my $total = total_amount($invoice->transactions);
+ my ($number_of_payments, $paid_amount) = number_of_payments($invoice);
+ my $total = total_amount($invoice);
my $title = 'default invoice, two items, 19/7% tax not included';
transdate => DateTime->today_local->to_kivitendo
);
- my ($number_of_payments, $paid_amount) = number_of_payments($invoice->transactions);
- my $total = total_amount($invoice->transactions);
+ my ($number_of_payments, $paid_amount) = number_of_payments($invoice);
+ my $total = total_amount($invoice);
my $title = 'default invoice, two items, 19/7% tax not included';
$params{payment_type} = 'difference_as_skonto';
$invoice->pay_invoice( %params );
- my ($number_of_payments, $paid_amount) = number_of_payments($invoice->transactions);
- my $total = total_amount($invoice->transactions);
+ my ($number_of_payments, $paid_amount) = number_of_payments($invoice);
+ my $total = total_amount($invoice);
my $title = 'default invoice, one item, 19% tax, without_skonto';
$params{payment_type} = 'difference_as_skonto';
$invoice->pay_invoice( %params );
- my ($number_of_payments, $paid_amount) = number_of_payments($invoice->transactions);
- my $total = total_amount($invoice->transactions);
+ my ($number_of_payments, $paid_amount) = number_of_payments($invoice);
+ my $total = total_amount($invoice);
my $title = 'default invoice, one item, 19% tax, without_skonto';
$purchase_invoice->pay_invoice( %params );
- my ($number_of_payments, $paid_amount) = number_of_payments($purchase_invoice->transactions);
- my $total = total_amount($purchase_invoice->transactions);
+ my ($number_of_payments, $paid_amount) = number_of_payments($purchase_invoice);
+ my $total = total_amount($purchase_invoice);
my $title = 'default invoice, two items, 19/7% tax without skonto';
$purchase_invoice->pay_invoice( %params );
- my ($number_of_payments, $paid_amount) = number_of_payments($purchase_invoice->transactions);
- my $total = total_amount($purchase_invoice->transactions);
+ my ($number_of_payments, $paid_amount) = number_of_payments($purchase_invoice);
+ my $total = total_amount($purchase_invoice);
my $title = 'default invoice, two items, 19/7% tax without skonto';
chart_id => $bank_account->chart_id,
transdate => DateTime->today_local->to_kivitendo
);
- my ($number_of_payments, $paid_amount) = number_of_payments($purchase_invoice->transactions);
- my $total = total_amount($purchase_invoice->transactions);
+ my ($number_of_payments, $paid_amount) = number_of_payments($purchase_invoice);
+ my $total = total_amount($purchase_invoice);
my $title = 'default purchase_invoice, two charts, 19/7% tax multiple payments with final difference as skonto';
transdate => DateTime->today_local->to_kivitendo
);
- my ($number_of_payments, $paid_amount) = number_of_payments($purchase_invoice->transactions);
- my $total = total_amount($purchase_invoice->transactions);
+ my ($number_of_payments, $paid_amount) = number_of_payments($purchase_invoice);
+ my $total = total_amount($purchase_invoice);
my $title = 'default purchase_invoice, two charts, 19/7% tax multiple payments with final difference as skonto';
$invoice->pay_invoice( %params );
- my ($number_of_payments, $paid_amount) = number_of_payments($invoice->transactions);
- my $total = total_amount($invoice->transactions);
+ my ($number_of_payments, $paid_amount) = number_of_payments($invoice);
+ my $total = total_amount($invoice);
my $title = 'default invoice, two items, 19/7% tax with_skonto_pt 50/50';
$invoice->pay_invoice( %params );
- my ($number_of_payments, $paid_amount) = number_of_payments($invoice->transactions);
- my $total = total_amount($invoice->transactions);
+ my ($number_of_payments, $paid_amount) = number_of_payments($invoice);
+ my $total = total_amount($invoice);
my $title = 'default invoice, four items, 19/7% tax with_skonto_pt 4x25';
$invoice->pay_invoice( %params );
- my ($number_of_payments, $paid_amount) = number_of_payments($invoice->transactions);
- my $total = total_amount($invoice->transactions);
+ my ($number_of_payments, $paid_amount) = number_of_payments($invoice);
+ my $total = total_amount($invoice);
my $title = 'default invoice, four items, 19/7% tax with_skonto_pt 4x25';
transdate => DateTime->today_local->to_kivitendo
);
- my ($number_of_payments, $paid_amount) = number_of_payments($invoice->transactions);
- my $total = total_amount($invoice->transactions);
+ my ($number_of_payments, $paid_amount) = number_of_payments($invoice);
+ my $total = total_amount($invoice);
my $title = 'default invoice, four items, 19/7% tax with_skonto_pt 4x25';