my $netamount = 100;
my $amount = $::form->round_amount($netamount * 1.19,2);
my $invoice = SL::DB::PurchaseInvoice->new(
- invoice => 0,
- invnumber => $params{invnumber} || 'test_ap_transaction',
- amount => $amount,
- netamount => $netamount,
- transdate => $transdate1,
- taxincluded => 0,
- vendor_id => $vendor->id,
- taxzone_id => $vendor->taxzone_id,
- currency_id => $currency_id,
- transactions => [],
- notes => 'test_ap_transaction',
+ invoice => 0,
+ invnumber => $params{invnumber} || 'test_ap_transaction',
+ amount => $amount,
+ netamount => $netamount,
+ transdate => $transdate1,
+ taxincluded => 0,
+ vendor_id => $vendor->id,
+ taxzone_id => $vendor->taxzone_id,
+ currency_id => $currency_id,
+ transactions => [],
+ notes => 'test_ap_transaction',
);
$invoice->add_ap_amount_row(
amount => $invoice->netamount,
my $bt = SL::Dev::Payment::create_bank_transaction(record => $ar_transaction) or die "Couldn't create bank_transaction";
$::form->{invoice_ids} = {
- $bt->id => [ $ar_transaction->id ]
- };
+ $bt->id => [ $ar_transaction->id ]
+ };
save_btcontroller_to_string();
) or die "Couldn't create bank_transaction";
$::form->{invoice_ids} = {
- $bt->id => [ $ar_transaction->id ]
- };
+ $bt->id => [ $ar_transaction->id ]
+ };
$::form->{invoice_skontos} = {
- $bt->id => [ 'with_skonto_pt' ]
- };
+ $bt->id => [ 'with_skonto_pt' ]
+ };
save_btcontroller_to_string();
is($agreement, 16, "points for ar_transaction_1 in test_two_invoices ok");
$::form->{invoice_ids} = {
- $bt->id => [ $ar_transaction_1->id, $ar_transaction_2->id ]
- };
+ $bt->id => [ $ar_transaction_1->id, $ar_transaction_2->id ]
+ };
save_btcontroller_to_string();
) or die "Couldn't create bank_transaction";
$::form->{invoice_ids} = {
- $bt->id => [ $ar_transaction->id ]
- };
+ $bt->id => [ $ar_transaction->id ]
+ };
save_btcontroller_to_string();
) or die "Couldn't create bank_transaction";
$::form->{invoice_ids} = {
- $bt_1->id => [ $ar_transaction->id ]
- };
+ $bt_1->id => [ $ar_transaction->id ]
+ };
save_btcontroller_to_string();
$::form->{invoice_ids} = {
- $bt_2->id => [ $ar_transaction->id ]
- };
+ $bt_2->id => [ $ar_transaction->id ]
+ };
save_btcontroller_to_string();
$ar_transaction->load;
) or die "Couldn't create bank_transaction";
$::form->{invoice_ids} = {
- $bt->id => [ $ar_transaction->id ]
- };
+ $bt->id => [ $ar_transaction->id ]
+ };
save_btcontroller_to_string();
is($rule_matches, 'remote_account_number(3) exact_amount(4) wrong_sign(-1) depositor_matches(2) remote_name(2) payment_within_30_days(1) datebonus14(2) ', "rules_matches for credit note ok");
$::form->{invoice_ids} = {
- $bt->id => [ $credit_note->id ]
+ $bt->id => [ $credit_note->id ]
};
save_btcontroller_to_string();
}
sub test_neg_ap_transaction {
- my (%params) = @_;
my $testname = 'test_neg_ap_transaction';
my $netamount = -20;
my $amount = $::form->round_amount($netamount * 1.19,2);
my $invoice = SL::DB::PurchaseInvoice->new(
- invoice => 0,
- invnumber => $params{invnumber} || 'test_neg_ap_transaction',
- amount => $amount,
- netamount => $netamount,
- transdate => $transdate1,
- taxincluded => 0,
- vendor_id => $vendor->id,
- taxzone_id => $vendor->taxzone_id,
- currency_id => $currency_id,
- transactions => [],
- notes => 'test_neg_ap_transaction',
+ invoice => 0,
+ invnumber => $params{invnumber} || 'test_neg_ap_transaction',
+ amount => $amount,
+ netamount => $netamount,
+ transdate => $transdate1,
+ taxincluded => 0,
+ vendor_id => $vendor->id,
+ taxzone_id => $vendor->taxzone_id,
+ currency_id => $currency_id,
+ transactions => [],
+ notes => 'test_neg_ap_transaction',
);
$invoice->add_ap_amount_row(
amount => $invoice->netamount,
$invoice->create_ap_row(chart => $ap_chart);
$invoice->save;
- is($invoice->netamount , -20 , "$testname: netamount ok");
- is($invoice->amount , -23.8 , "$testname: amount ok");
+ is($invoice->netamount, -20 , "$testname: netamount ok");
+ is($invoice->amount , -23.8, "$testname: amount ok");
my $bt = SL::Dev::Payment::create_bank_transaction(record => $invoice,
amount => $invoice->amount,
is($agreement, 15, "points for negative ap transaction ok");
$::form->{invoice_ids} = {
- $bt->id => [ $invoice->id ]
+ $bt->id => [ $invoice->id ]
};
save_btcontroller_to_string();
return $invoice;
};
-
1;