Bug 13321: Rename variables
This patch renames the variable according to the new DB column names * gste => tax_excluded * gsti => tax_included * gstrate => tax_rate * gstvalue => tax_value This patch also modify the ModReceiveOrder subroutine: * Edit vendor note on receiving is not possible, so the code should not permit that. * Update ModReceiveOrder to pass a hashref And that's all! git grep on gste, gsti, gstrate and gstvalue should not return any code that can be executed. Signed-off-by: Laurence Rault <laurence.rault@biblibre.com> Signed-off-by: Francois Charbonnier <francois.charbonnier@inlibro.com> Signed-off-by: Sonia Bouis <sonia.bouis@univ-lyon3.fr> Signed-off-by: Sonia Bouis <koha@univ-lyon3.fr> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
parent
9a77e0600e
commit
20d9ed618f
|
|
@ -1334,58 +1334,42 @@ sub ModItemOrder {
|
|||
|
||||
=head3 ModReceiveOrder
|
||||
|
||||
&ModReceiveOrder({
|
||||
biblionumber => $biblionumber,
|
||||
ordernumber => $ordernumber,
|
||||
quantityreceived => $quantityreceived,
|
||||
user => $user,
|
||||
cost => $cost,
|
||||
ecost => $ecost,
|
||||
invoiceid => $invoiceid,
|
||||
rrp => $rrp,
|
||||
budget_id => $budget_id,
|
||||
datereceived => $datereceived,
|
||||
received_itemnumbers => \@received_itemnumbers,
|
||||
order_internalnote => $order_internalnote,
|
||||
order_vendornote => $order_vendornote,
|
||||
});
|
||||
my ( $date_received, $new_ordernumber ) = ModReceiveOrder(
|
||||
{
|
||||
biblionumber => $biblionumber,
|
||||
order => $order,
|
||||
quantityreceived => $quantityreceived,
|
||||
user => $user,
|
||||
invoice => $invoice,
|
||||
budget_id => $budget_id,
|
||||
received_itemnumbers => \@received_itemnumbers,
|
||||
order_internalnote => $order_internalnote,
|
||||
}
|
||||
);
|
||||
|
||||
Updates an order, to reflect the fact that it was received, at least
|
||||
in part. All arguments not mentioned below update the fields with the
|
||||
same name in the aqorders table of the Koha database.
|
||||
in part.
|
||||
|
||||
If a partial order is received, splits the order into two.
|
||||
|
||||
Updates the order with bibilionumber C<$biblionumber> and ordernumber
|
||||
C<$ordernumber>.
|
||||
Updates the order with biblionumber C<$biblionumber> and ordernumber
|
||||
C<$order->{ordernumber}>.
|
||||
|
||||
=cut
|
||||
|
||||
|
||||
sub ModReceiveOrder {
|
||||
my ( $params ) = @_;
|
||||
my $biblionumber = $params->{biblionumber};
|
||||
my $ordernumber = $params->{ordernumber};
|
||||
my $quantrec = $params->{quantityreceived};
|
||||
my $user = $params->{user};
|
||||
my $cost = $params->{cost};
|
||||
my $ecost = $params->{ecost};
|
||||
my $invoiceid = $params->{invoiceid};
|
||||
my $rrp = $params->{rrp};
|
||||
my $budget_id = $params->{budget_id};
|
||||
my $datereceived = $params->{datereceived};
|
||||
my ($params) = @_;
|
||||
my $biblionumber = $params->{biblionumber};
|
||||
my $order = { %{ $params->{order} } }; # Copy the order, we don't want to modify it
|
||||
my $invoice = $params->{invoice};
|
||||
my $quantrec = $params->{quantityreceived};
|
||||
my $user = $params->{user};
|
||||
my $budget_id = $params->{budget_id};
|
||||
my $received_items = $params->{received_items};
|
||||
my $order_internalnote = $params->{order_internalnote};
|
||||
my $order_vendornote = $params->{order_vendornote};
|
||||
|
||||
my $dbh = C4::Context->dbh;
|
||||
$datereceived = output_pref(
|
||||
{
|
||||
dt => ( $datereceived ? dt_from_string( $datereceived ) : dt_from_string ),
|
||||
dateformat => 'iso',
|
||||
dateonly => 1,
|
||||
}
|
||||
);
|
||||
my $datereceived = ( $invoice and $invoice->{datereceived} ) ? $invoice->{datereceived} : dt_from_string;
|
||||
my $suggestionid = GetSuggestionFromBiblionumber( $biblionumber );
|
||||
if ($suggestionid) {
|
||||
ModSuggestion( {suggestionid=>$suggestionid,
|
||||
|
|
@ -1394,16 +1378,8 @@ sub ModReceiveOrder {
|
|||
);
|
||||
}
|
||||
|
||||
my $result_set = $dbh->selectall_arrayref(
|
||||
q{SELECT *, aqbasket.is_standing FROM aqorders LEFT JOIN aqbasket USING (basketno) WHERE biblionumber=? AND aqorders.ordernumber=?},
|
||||
{ Slice => {} }, $biblionumber, $ordernumber
|
||||
);
|
||||
|
||||
# we assume we have a unique order
|
||||
my $order = $result_set->[0];
|
||||
|
||||
my $new_ordernumber = $ordernumber;
|
||||
if ( $order->{is_standing} || $order->{quantity} > $quantrec ) {
|
||||
my $new_ordernumber = $order->{ordernumber};
|
||||
if ( $order->{quantity} > $quantrec ) {
|
||||
# Split order line in two parts: the first is the original order line
|
||||
# without received items (the quantity is decreased),
|
||||
# the second part is a new order line with quantity=quantityrec
|
||||
|
|
@ -1412,28 +1388,23 @@ q{SELECT *, aqbasket.is_standing FROM aqorders LEFT JOIN aqbasket USING (basketn
|
|||
UPDATE aqorders
|
||||
SET quantity = ?,
|
||||
orderstatus = 'partial'|;
|
||||
$query .= q|, order_internalnote = ?| if defined $order_internalnote;
|
||||
$query .= q|, order_vendornote = ?| if defined $order_vendornote;
|
||||
$query .= q|, order_internalnote = ?| if defined $order->{order_internalnote};
|
||||
$query .= q| WHERE ordernumber = ?|;
|
||||
my $sth = $dbh->prepare($query);
|
||||
|
||||
$sth->execute(
|
||||
( $order->{is_standing} ? 1 : ( $order->{quantity} - $quantrec ) ),
|
||||
( defined $order_internalnote ? $order_internalnote : () ),
|
||||
( defined $order_vendornote ? $order_vendornote : () ),
|
||||
$ordernumber
|
||||
$order->{quantity} - $quantrec,
|
||||
( defined $order->{order_internalnote} ? $order->{order_internalnote} : () ),
|
||||
$order->{ordernumber}
|
||||
);
|
||||
|
||||
delete $order->{'ordernumber'};
|
||||
$order->{'budget_id'} = ( $budget_id || $order->{'budget_id'} );
|
||||
$order->{'quantity'} = $quantrec;
|
||||
$order->{'quantityreceived'} = $quantrec;
|
||||
$order->{'datereceived'} = $datereceived;
|
||||
$order->{'invoiceid'} = $invoiceid;
|
||||
$order->{'unitprice'} = $cost;
|
||||
$order->{'rrp'} = $rrp;
|
||||
$order->{ecost} = $ecost;
|
||||
$order->{'orderstatus'} = 'complete';
|
||||
delete $order->{ordernumber};
|
||||
$order->{budget_id} = ( $budget_id || $order->{budget_id} );
|
||||
$order->{quantity} = $quantrec;
|
||||
$order->{quantityreceived} = $quantrec;
|
||||
$order->{datereceived} = $datereceived;
|
||||
$order->{invoiceid} = $invoice->{invoiceid};
|
||||
$order->{orderstatus} = 'complete';
|
||||
$new_ordernumber = Koha::Acquisition::Order->new($order)->insert->{ordernumber};
|
||||
|
||||
if ($received_items) {
|
||||
|
|
@ -1443,29 +1414,54 @@ q{SELECT *, aqbasket.is_standing FROM aqorders LEFT JOIN aqbasket USING (basketn
|
|||
}
|
||||
} else {
|
||||
my $query = q|
|
||||
update aqorders
|
||||
set quantityreceived=?,datereceived=?,invoiceid=?,
|
||||
unitprice=?,rrp=?,ecost=?,budget_id=?,orderstatus='complete'|;
|
||||
$query .= q|, order_internalnote = ?| if defined $order_internalnote;
|
||||
$query .= q|, order_vendornote = ?| if defined $order_vendornote;
|
||||
UPDATE aqorders
|
||||
SET quantityreceived = ?,
|
||||
datereceived = ?,
|
||||
invoiceid = ?,
|
||||
budget_id = ?,
|
||||
orderstatus = 'complete'
|
||||
|;
|
||||
|
||||
$query .= q|
|
||||
, unitprice = ?, unitprice_tax_included = ?, unitprice_tax_excluded = ?
|
||||
| if defined $order->{unitprice};
|
||||
|
||||
$query .= q|
|
||||
, rrp = ?, rrp_tax_included = ?, rrp_tax_excluded = ?
|
||||
| if defined $order->{rrp};
|
||||
|
||||
$query .= q|
|
||||
, ecost = ?, ecost_tax_included = ?, ecost_tax_excluded = ?
|
||||
| if defined $order->{ecost};
|
||||
|
||||
$query .= q|
|
||||
, order_internalnote = ?
|
||||
| if defined $order->{order_internalnote};
|
||||
|
||||
$query .= q| where biblionumber=? and ordernumber=?|;
|
||||
|
||||
my $sth = $dbh->prepare( $query );
|
||||
$sth->execute(
|
||||
$quantrec,
|
||||
$datereceived,
|
||||
$invoiceid,
|
||||
$cost,
|
||||
$rrp,
|
||||
$ecost,
|
||||
( $budget_id ? $budget_id : $order->{budget_id} ),
|
||||
( defined $order_internalnote ? $order_internalnote : () ),
|
||||
( defined $order_vendornote ? $order_vendornote : () ),
|
||||
$biblionumber,
|
||||
$ordernumber
|
||||
);
|
||||
my @params = ( $quantrec, $datereceived, $invoice->{invoiceid}, $budget_id );
|
||||
|
||||
if ( defined $order->{unitprice} ) {
|
||||
push @params, $order->{unitprice}, $order->{unitprice_tax_included}, $order->{unitprice_tax_excluded};
|
||||
}
|
||||
if ( defined $order->{rrp} ) {
|
||||
push @params, $order->{rrp}, $order->{rrp_tax_included}, $order->{rrp_tax_excluded};
|
||||
}
|
||||
if ( defined $order->{ecost} ) {
|
||||
push @params, $order->{ecost}, $order->{ecost_tax_included}, $order->{ecost_tax_excluded};
|
||||
}
|
||||
if ( defined $order->{order_internalnote} ) {
|
||||
push @params, $order->{order_internalnote};
|
||||
}
|
||||
|
||||
push @params, ( $biblionumber, $order->{ordernumber} );
|
||||
|
||||
$sth->execute( @params );
|
||||
|
||||
# All items have been received, sent a notification to users
|
||||
NotifyOrderUsers( $ordernumber );
|
||||
NotifyOrderUsers( $order->{ordernumber} );
|
||||
|
||||
}
|
||||
return ($datereceived, $new_ordernumber);
|
||||
|
|
@ -2850,50 +2846,44 @@ sub populate_order_with_prices {
|
|||
$order->{ecost} = Koha::Number::Price->new( $order->{ecost} )->round;
|
||||
if ($ordering) {
|
||||
if ( $bookseller->{listincgst} ) {
|
||||
$order->{rrpgsti} = $order->{rrp};
|
||||
$order->{rrpgste} = Koha::Number::Price->new(
|
||||
$order->{rrpgsti} / ( 1 + $order->{gstrate} ) )->round;
|
||||
$order->{ecostgsti} = $order->{ecost};
|
||||
$order->{ecostgste} = Koha::Number::Price->new(
|
||||
$order->{ecost} / ( 1 + $order->{gstrate} ) )->round;
|
||||
$order->{gstvalue} = Koha::Number::Price->new(
|
||||
( $order->{ecostgsti} - $order->{ecostgste} ) *
|
||||
$order->{rrp_tax_included} = $order->{rrp};
|
||||
$order->{rrp_tax_excluded} = Koha::Number::Price->new(
|
||||
$order->{rrp_tax_included} / ( 1 + $order->{tax_rate} ) )->round;
|
||||
$order->{ecost_tax_included} = $order->{ecost};
|
||||
$order->{ecost_tax_excluded} = Koha::Number::Price->new(
|
||||
$order->{ecost} / ( 1 + $order->{tax_rate} ) )->round;
|
||||
$order->{tax_value} = Koha::Number::Price->new(
|
||||
( $order->{ecost_tax_included} - $order->{ecost_tax_excluded} ) *
|
||||
$order->{quantity} )->round;
|
||||
$order->{totalgste} = $order->{ecostgste} * $order->{quantity};
|
||||
$order->{totalgsti} = $order->{ecostgsti} * $order->{quantity};
|
||||
}
|
||||
else {
|
||||
$order->{rrpgste} = $order->{rrp};
|
||||
$order->{rrpgsti} = Koha::Number::Price->new(
|
||||
$order->{rrp} * ( 1 + $order->{gstrate} ) )->round;
|
||||
$order->{ecostgste} = $order->{ecost};
|
||||
$order->{ecostgsti} = Koha::Number::Price->new(
|
||||
$order->{ecost} * ( 1 + $order->{gstrate} ) )->round;
|
||||
$order->{gstvalue} = Koha::Number::Price->new(
|
||||
( $order->{ecostgsti} - $order->{ecostgste} ) *
|
||||
$order->{rrp_tax_excluded} = $order->{rrp};
|
||||
$order->{rrp_tax_included} = Koha::Number::Price->new(
|
||||
$order->{rrp} * ( 1 + $order->{tax_rate} ) )->round;
|
||||
$order->{ecost_tax_excluded} = $order->{ecost};
|
||||
$order->{ecost_tax_included} = Koha::Number::Price->new(
|
||||
$order->{ecost} * ( 1 + $order->{tax_rate} ) )->round;
|
||||
$order->{tax_value} = Koha::Number::Price->new(
|
||||
( $order->{ecost_tax_included} - $order->{ecost_tax_excluded} ) *
|
||||
$order->{quantity} )->round;
|
||||
$order->{totalgste} = $order->{ecostgste} * $order->{quantity};
|
||||
$order->{totalgsti} = $order->{ecostgsti} * $order->{quantity};
|
||||
}
|
||||
}
|
||||
|
||||
if ($receiving) {
|
||||
if ( $bookseller->{listincgst} ) {
|
||||
$order->{unitpricegsti} = Koha::Number::Price->new( $order->{unitprice} )->round;
|
||||
$order->{unitpricegste} = Koha::Number::Price->new(
|
||||
$order->{unitpricegsti} / ( 1 + $order->{gstrate} ) )->round;
|
||||
$order->{unitprice_tax_included} = Koha::Number::Price->new( $order->{unitprice} )->round;
|
||||
$order->{unitprice_tax_excluded} = Koha::Number::Price->new(
|
||||
$order->{unitprice_tax_included} / ( 1 + $order->{tax_rate} ) )->round;
|
||||
}
|
||||
else {
|
||||
$order->{unitpricegste} = Koha::Number::Price->new( $order->{unitprice} )->round;
|
||||
$order->{unitpricegsti} = Koha::Number::Price->new(
|
||||
$order->{unitpricegste} * ( 1 + $order->{gstrate} ) )->round;
|
||||
$order->{unitprice_tax_excluded} = Koha::Number::Price->new( $order->{unitprice} )->round;
|
||||
$order->{unitprice_tax_included} = Koha::Number::Price->new(
|
||||
$order->{unitprice_tax_excluded} * ( 1 + $order->{tax_rate} ) )->round;
|
||||
}
|
||||
$order->{gstvalue} = Koha::Number::Price->new(
|
||||
( $order->{unitpricegsti} - $order->{unitpricegste} )
|
||||
$order->{tax_value} = Koha::Number::Price->new(
|
||||
( $order->{unitprice_tax_included} - $order->{unitprice_tax_excluded} )
|
||||
* $order->{quantityreceived} )->round;
|
||||
|
||||
$order->{totalgste} = $order->{unitpricegste} * $order->{quantity};
|
||||
$order->{totalgsti} = $order->{unitpricegsti} * $order->{quantity};
|
||||
}
|
||||
|
||||
return $order;
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ sub AddBookseller {
|
|||
name, address1, address2, address3, address4,
|
||||
postal, phone, accountnumber,fax, url,
|
||||
active, listprice, invoiceprice, gstreg,
|
||||
listincgst,invoiceincgst, gstrate, discount, notes,
|
||||
listincgst,invoiceincgst, tax_rate, discount, notes,
|
||||
deliverytime
|
||||
)
|
||||
VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) |
|
||||
|
|
@ -151,7 +151,7 @@ sub AddBookseller {
|
|||
$data->{'active'}, $data->{'listprice'},
|
||||
$data->{'invoiceprice'}, $data->{'gstreg'},
|
||||
$data->{'listincgst'}, $data->{'invoiceincgst'},
|
||||
$data->{'gstrate'}, $data->{'discount'},
|
||||
$data->{'tax_rate'}, $data->{'discount'},
|
||||
$data->{notes}, $data->{deliverytime},
|
||||
);
|
||||
|
||||
|
|
@ -194,7 +194,7 @@ sub ModBookseller {
|
|||
postal=?,phone=?,accountnumber=?,fax=?,url=?,
|
||||
active=?,listprice=?, invoiceprice=?,
|
||||
gstreg=?,listincgst=?,invoiceincgst=?,
|
||||
discount=?,notes=?,gstrate=?,deliverytime=?
|
||||
discount=?,notes=?,tax_rate=?,deliverytime=?
|
||||
WHERE id=?';
|
||||
my $sth = $dbh->prepare($query);
|
||||
my $cnt = $sth->execute(
|
||||
|
|
@ -207,7 +207,7 @@ sub ModBookseller {
|
|||
$data->{'invoiceprice'}, $data->{'gstreg'},
|
||||
$data->{'listincgst'}, $data->{'invoiceincgst'},
|
||||
$data->{'discount'}, $data->{'notes'},
|
||||
$data->{'gstrate'}, $data->{deliverytime},
|
||||
$data->{'tax_rate'}, $data->{deliverytime},
|
||||
$data->{'id'}
|
||||
);
|
||||
$contacts ||= $data->{'contacts'};
|
||||
|
|
|
|||
|
|
@ -205,7 +205,7 @@ if ($op eq ""){
|
|||
# in this case, the price will be x100 when unformatted ! Replace the . by a , to get a proper price calculation
|
||||
$price =~ s/\./,/ if C4::Context->preference("CurrencyFormat") eq "FR";
|
||||
$price = Koha::Number::Price->new($price)->unformat;
|
||||
$orderinfo{gstrate} = $bookseller->{gstrate};
|
||||
$orderinfo{tax_rate} = $bookseller->{tax_rate};
|
||||
my $c = $c_discount ? $c_discount : $bookseller->{discount} / 100;
|
||||
if ( $bookseller->{listincgst} ) {
|
||||
if ( $c_discount ) {
|
||||
|
|
@ -217,10 +217,10 @@ if ($op eq ""){
|
|||
}
|
||||
} else {
|
||||
if ( $c_discount ) {
|
||||
$orderinfo{ecost} = $price / ( 1 + $orderinfo{gstrate} );
|
||||
$orderinfo{ecost} = $price / ( 1 + $orderinfo{tax_rate} );
|
||||
$orderinfo{rrp} = $orderinfo{ecost} / ( 1 - $c );
|
||||
} else {
|
||||
$orderinfo{rrp} = $price / ( 1 + $orderinfo{gstrate} );
|
||||
$orderinfo{rrp} = $price / ( 1 + $orderinfo{tax_rate} );
|
||||
$orderinfo{ecost} = $orderinfo{rrp} * ( 1 - $c );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -320,27 +320,29 @@ if ( $op eq 'list' ) {
|
|||
my @book_foot_loop;
|
||||
my %foot;
|
||||
my $total_quantity = 0;
|
||||
my $total_gste = 0;
|
||||
my $total_gsti = 0;
|
||||
my $total_gstvalue = 0;
|
||||
my $total_tax_excluded = 0;
|
||||
my $total_tax_included = 0;
|
||||
my $total_tax_value = 0;
|
||||
for my $order (@orders) {
|
||||
$order = C4::Acquisition::populate_order_with_prices({ order => $order, booksellerid => $booksellerid, ordering => 1 });
|
||||
my $line = get_order_infos( $order, $bookseller);
|
||||
if ( $line->{uncertainprice} ) {
|
||||
$template->param( uncertainprices => 1 );
|
||||
}
|
||||
|
||||
$line->{total_tax_excluded} = Koha::Number::Price->new( $line->{ecost_tax_excluded} * $line->{quantity} )->format;
|
||||
$line->{total_tax_included} = Koha::Number::Price->new( $line->{ecost_tax_included} * $line->{quantity} )->format;
|
||||
|
||||
push @books_loop, $line;
|
||||
|
||||
$foot{$$line{gstrate}}{gstrate} = $$line{gstrate};
|
||||
$foot{$$line{gstrate}}{gstvalue} += $$line{gstvalue};
|
||||
$total_gstvalue += $$line{gstvalue};
|
||||
$foot{$$line{gstrate}}{quantity} += $$line{quantity};
|
||||
$foot{$$line{tax_rate}}{tax_rate} = $$line{tax_rate};
|
||||
$foot{$$line{tax_rate}}{tax_value} += $$line{tax_value};
|
||||
$total_tax_value += $$line{tax_value};
|
||||
$foot{$$line{tax_rate}}{quantity} += $$line{quantity};
|
||||
$total_quantity += $$line{quantity};
|
||||
$foot{$$line{gstrate}}{totalgste} += $$line{totalgste};
|
||||
$total_gste += $$line{totalgste};
|
||||
$foot{$$line{gstrate}}{totalgsti} += $$line{totalgsti};
|
||||
$total_gsti += $$line{totalgsti};
|
||||
$foot{$$line{tax_rate}}{total_tax_excluded} += $$line{total_tax_excluded};
|
||||
$total_tax_excluded += $$line{total_tax_excluded};
|
||||
$foot{$$line{tax_rate}}{total_tax_included} += $$line{total_tax_included};
|
||||
$total_tax_included += $$line{total_tax_included};
|
||||
}
|
||||
|
||||
push @book_foot_loop, map {$_} values %foot;
|
||||
|
|
@ -349,7 +351,6 @@ if ( $op eq 'list' ) {
|
|||
my @cancelledorders = GetOrders($basketno, { cancelled => 1 });
|
||||
my @cancelledorders_loop;
|
||||
for my $order (@cancelledorders) {
|
||||
$order = C4::Acquisition::populate_order_with_prices({ order => $order, booksellerid => $booksellerid, ordering => 1 });
|
||||
my $line = get_order_infos( $order, $bookseller);
|
||||
push @cancelledorders_loop, $line;
|
||||
}
|
||||
|
|
@ -401,9 +402,9 @@ if ( $op eq 'list' ) {
|
|||
book_foot_loop => \@book_foot_loop,
|
||||
cancelledorders_loop => \@cancelledorders_loop,
|
||||
total_quantity => $total_quantity,
|
||||
total_gste => sprintf( "%.2f", $total_gste ),
|
||||
total_gsti => sprintf( "%.2f", $total_gsti ),
|
||||
total_gstvalue => sprintf( "%.2f", $total_gstvalue ),
|
||||
total_tax_excluded => $total_tax_excluded,
|
||||
total_tax_included => $total_tax_included,
|
||||
total_tax_value => $total_tax_value,
|
||||
currency => $active_currency->currency,
|
||||
listincgst => $bookseller->{listincgst},
|
||||
basketgroups => $basketgroups,
|
||||
|
|
@ -440,7 +441,7 @@ sub get_order_infos {
|
|||
$line{budget_name} = $budget->{budget_name};
|
||||
|
||||
if ( $line{uncertainprice} ) {
|
||||
$line{rrpgste} .= ' (Uncertain)';
|
||||
$line{rrp_tax_excluded} .= ' (Uncertain)';
|
||||
}
|
||||
if ( $line{'title'} ) {
|
||||
my $volume = $order->{'volume'};
|
||||
|
|
|
|||
|
|
@ -74,9 +74,14 @@ sub BasketTotal {
|
|||
my $total = 0;
|
||||
my @orders = GetOrders($basketno);
|
||||
for my $order (@orders){
|
||||
$total = $total + ( $order->{ecost} * $order->{quantity} );
|
||||
if ($bookseller->{invoiceincgst} && ! $bookseller->{listincgst} && ( $bookseller->{gstrate} // C4::Context->preference("gist") )) {
|
||||
my $gst = $bookseller->{gstrate} // C4::Context->preference("gist");
|
||||
# FIXME The following is wrong
|
||||
if ( $bookseller->{listincgst} ) {
|
||||
$total = $total + ( $order->{ecost_tax_included} * $order->{quantity} );
|
||||
} else {
|
||||
$total = $total + ( $order->{ecost_tax_excluded} * $order->{quantity} );
|
||||
}
|
||||
if ($bookseller->{invoiceincgst} && ! $bookseller->{listincgst} && ( $bookseller->{tax_rate} // C4::Context->preference("gist") )) {
|
||||
my $gst = $bookseller->{tax_rate} // C4::Context->preference("gist");
|
||||
$total = $total * ( $gst / 100 +1);
|
||||
}
|
||||
}
|
||||
|
|
@ -167,13 +172,15 @@ sub printbasketgrouppdf{
|
|||
croak $@;
|
||||
}
|
||||
|
||||
$ord = C4::Acquisition::populate_order_with_prices({ order => $ord, booksellerid => $bookseller->{id}, ordering => 1 });
|
||||
$ord->{total_tax_included} = $ord->{ecost_tax_included} * $ord->{quantity};
|
||||
$ord->{total_tax_excluded} = $ord->{ecost_tax_excluded} * $ord->{quantity};
|
||||
|
||||
my $bib = GetBiblioData($ord->{biblionumber});
|
||||
my $itemtypes = GetItemTypes();
|
||||
|
||||
#FIXME DELETE ME
|
||||
# 0 1 2 3 4 5 6 7 8 9
|
||||
#isbn, itemtype, author, title, publishercode, quantity, listprice ecost discount gstrate
|
||||
#isbn, itemtype, author, title, publishercode, quantity, listprice ecost discount tax_rate
|
||||
|
||||
# Editor Number
|
||||
my $en;
|
||||
|
|
@ -201,7 +208,7 @@ sub printbasketgrouppdf{
|
|||
-type => 'application/pdf',
|
||||
-attachment => ( $basketgroup->{name} || $basketgroupid ) . '.pdf'
|
||||
);
|
||||
my $pdf = printpdf($basketgroup, $bookseller, $baskets, \%orders, $bookseller->{gstrate} // C4::Context->preference("gist")) || die "pdf generation failed";
|
||||
my $pdf = printpdf($basketgroup, $bookseller, $baskets, \%orders, $bookseller->{tax_rate} // C4::Context->preference("gist")) || die "pdf generation failed";
|
||||
print $pdf;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,7 +56,6 @@ my $booksellerid = $input->param('booksellerid');
|
|||
my $cnt = 0;
|
||||
my $ecost = $input->param('ecost');
|
||||
my $rrp = $input->param('rrp');
|
||||
my $order_internalnote = $input->param("order_internalnote");
|
||||
my $bookfund = $input->param("bookfund");
|
||||
my $order = GetOrder($ordernumber);
|
||||
my $new_ordernumber = $ordernumber;
|
||||
|
|
@ -83,40 +82,40 @@ if ($quantityrec > $origquantityrec ) {
|
|||
}
|
||||
}
|
||||
|
||||
$order->{order_internalnote} = $input->param("order_internalnote");
|
||||
$order->{rrp} = $rrp;
|
||||
$order->{ecost} = $ecost;
|
||||
$order->{unitprice} = $unitprice;
|
||||
|
||||
# FIXME is it still useful?
|
||||
my $bookseller = Koha::Acquisition::Bookseller->fetch({ id => $booksellerid });
|
||||
if ( $bookseller->{listincgst} ) {
|
||||
if ( not $bookseller->{invoiceincgst} ) {
|
||||
$order->{rrp} = $order->{rrp} * ( 1 + $order->{gstrate} );
|
||||
$order->{ecost} = $order->{ecost} * ( 1 + $order->{gstrate} );
|
||||
$order->{unitprice} = $order->{unitprice} * ( 1 + $order->{gstrate} );
|
||||
$order->{rrp} = $order->{rrp} * ( 1 + $order->{tax_rate} );
|
||||
$order->{ecost} = $order->{ecost} * ( 1 + $order->{tax_rate} );
|
||||
$order->{unitprice} = $order->{unitprice} * ( 1 + $order->{tax_rate} );
|
||||
}
|
||||
} else {
|
||||
if ( $bookseller->{invoiceincgst} ) {
|
||||
$order->{rrp} = $order->{rrp} / ( 1 + $order->{gstrate} );
|
||||
$order->{ecost} = $order->{ecost} / ( 1 + $order->{gstrate} );
|
||||
$order->{unitprice} = $order->{unitprice} / ( 1 + $order->{gstrate} );
|
||||
$order->{rrp} = $order->{rrp} / ( 1 + $order->{tax_rate} );
|
||||
$order->{ecost} = $order->{ecost} / ( 1 + $order->{tax_rate} );
|
||||
$order->{unitprice} = $order->{unitprice} / ( 1 + $order->{tax_rate} );
|
||||
}
|
||||
}
|
||||
|
||||
# save the quantity received.
|
||||
if ( $quantityrec > 0 ) {
|
||||
($datereceived, $new_ordernumber) = ModReceiveOrder({
|
||||
biblionumber => $biblionumber,
|
||||
ordernumber => $ordernumber,
|
||||
quantityreceived => $quantityrec,
|
||||
user => $user,
|
||||
cost => $order->{unitprice},
|
||||
ecost => $order->{ecost},
|
||||
invoiceid => $invoiceid,
|
||||
rrp => $order->{rrp},
|
||||
budget_id => $bookfund,
|
||||
datereceived => $datereceived,
|
||||
received_items => \@received_items,
|
||||
order_internalnote => $order_internalnote,
|
||||
} );
|
||||
( $datereceived, $new_ordernumber ) = ModReceiveOrder(
|
||||
{
|
||||
biblionumber => $biblionumber,
|
||||
order => $order,
|
||||
quantityreceived => $quantityrec,
|
||||
user => $user,
|
||||
invoice => $invoice,
|
||||
budget_id => $bookfund,
|
||||
received_items => \@received_items,
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
# now, add items if applicable
|
||||
|
|
|
|||
|
|
@ -118,28 +118,24 @@ my $orders = $details->{'orders'};
|
|||
my @foot_loop;
|
||||
my %foot;
|
||||
my $total_quantity = 0;
|
||||
my $total_gste = 0;
|
||||
my $total_gsti = 0;
|
||||
my $total_gstvalue = 0;
|
||||
my $total_tax_excluded = 0;
|
||||
my $total_tax_included = 0;
|
||||
my $total_tax_value = 0;
|
||||
foreach my $order (@$orders) {
|
||||
$order = C4::Acquisition::populate_order_with_prices(
|
||||
{
|
||||
order => $order,
|
||||
booksellerid => $bookseller->{id},
|
||||
receiving => 1,
|
||||
}
|
||||
);
|
||||
my $line = get_infos( $order, $bookseller);
|
||||
|
||||
$foot{$$line{gstrate}}{gstrate} = $$line{gstrate};
|
||||
$foot{$$line{gstrate}}{gstvalue} += $$line{gstvalue};
|
||||
$total_gstvalue += $$line{gstvalue};
|
||||
$foot{$$line{gstrate}}{quantity} += $$line{quantity};
|
||||
$line->{total_tax_excluded} = Koha::Number::Price->new( $line->{unitprice_tax_excluded} * $line->{quantity} )->format;
|
||||
$line->{total_tax_included} = Koha::Number::Price->new( $line->{unitprice_tax_included} * $line->{quantity} )->format;
|
||||
|
||||
$foot{$$line{tax_rate}}{tax_rate} = $$line{tax_rate};
|
||||
$foot{$$line{tax_rate}}{tax_value} += $$line{tax_value};
|
||||
$total_tax_value += $$line{tax_value};
|
||||
$foot{$$line{tax_rate}}{quantity} += $$line{quantity};
|
||||
$total_quantity += $$line{quantity};
|
||||
$foot{$$line{gstrate}}{totalgste} += $$line{totalgste};
|
||||
$total_gste += $$line{totalgste};
|
||||
$foot{$$line{gstrate}}{totalgsti} += $$line{totalgsti};
|
||||
$total_gsti += $$line{totalgsti};
|
||||
$foot{$$line{tax_rate}}{total_tax_excluded} += $$line{total_tax_excluded};
|
||||
$total_tax_excluded += $$line{total_tax_excluded};
|
||||
$foot{$$line{tax_rate}}{total_tax_included} += $$line{total_tax_included};
|
||||
$total_tax_included += $$line{total_tax_included};
|
||||
|
||||
$line->{orderline} = $line->{parent_ordernumber};
|
||||
push @orders_loop, $line;
|
||||
|
|
@ -174,11 +170,11 @@ $template->param(
|
|||
orders_loop => \@orders_loop,
|
||||
foot_loop => \@foot_loop,
|
||||
total_quantity => $total_quantity,
|
||||
total_gste => sprintf( $format, $total_gste ),
|
||||
total_gsti => sprintf( $format, $total_gsti ),
|
||||
total_gstvalue => sprintf( $format, $total_gstvalue ),
|
||||
total_gste_shipment => sprintf( $format, $total_gste + $details->{shipmentcost}),
|
||||
total_gsti_shipment => sprintf( $format, $total_gsti + $details->{shipmentcost}),
|
||||
total_tax_excluded => sprintf( $format, $total_tax_excluded ),
|
||||
total_tax_included => sprintf( $format, $total_tax_included ),
|
||||
total_tax_value => sprintf( $format, $total_tax_value ),
|
||||
total_tax_excluded_shipment => sprintf( $format, $total_tax_excluded + $details->{shipmentcost}),
|
||||
total_tax_included_shipment => sprintf( $format, $total_tax_included + $details->{shipmentcost}),
|
||||
invoiceincgst => $bookseller->{invoiceincgst},
|
||||
currency => Koha::Acquisition::Currencies->get_active,
|
||||
budgets_loop => \@budgets_loop,
|
||||
|
|
|
|||
|
|
@ -265,7 +265,7 @@ if ( defined $subscriptionid ) {
|
|||
$budget_id = $lastOrderReceived->{budgetid};
|
||||
$data->{listprice} = $lastOrderReceived->{listprice};
|
||||
$data->{uncertainprice} = $lastOrderReceived->{uncertainprice};
|
||||
$data->{gstrate} = $lastOrderReceived->{gstrate};
|
||||
$data->{tax_rate} = $lastOrderReceived->{tax_rate};
|
||||
$data->{discount} = $lastOrderReceived->{discount};
|
||||
$data->{rrp} = $lastOrderReceived->{rrp};
|
||||
$data->{ecost} = $lastOrderReceived->{ecost};
|
||||
|
|
@ -350,7 +350,7 @@ $template->param(
|
|||
quantityrec => $quantity,
|
||||
rrp => $data->{'rrp'},
|
||||
gst_values => \@gst_values,
|
||||
gstrate => $data->{gstrate} ? $data->{gstrate}+0.0 : $bookseller->{gstrate} ? $bookseller->{gstrate}+0.0 : 0,
|
||||
tax_rate => $data->{tax_rate} ? $data->{tax_rate}+0.0 : $bookseller->{tax_rate} ? $bookseller->{tax_rate}+0.0 : 0,
|
||||
listprice => sprintf( "%.2f", $data->{listprice} || $data->{price} || $listprice),
|
||||
total => sprintf( "%.2f", ($data->{ecost} || 0) * ($data->{'quantity'} || 0) ),
|
||||
ecost => sprintf( "%.2f", $data->{ecost} || 0),
|
||||
|
|
|
|||
|
|
@ -163,15 +163,15 @@ if ( $bookseller->{listincgst} ) {
|
|||
$ecost = $order->{ecost};
|
||||
$unitprice = $order->{unitprice};
|
||||
} else {
|
||||
$rrp = $order->{rrp} / ( 1 + $order->{gstrate} );
|
||||
$ecost = $order->{ecost} / ( 1 + $order->{gstrate} );
|
||||
$unitprice = $order->{unitprice} / ( 1 + $order->{gstrate} );
|
||||
$rrp = $order->{rrp} / ( 1 + $order->{tax_rate} );
|
||||
$ecost = $order->{ecost} / ( 1 + $order->{tax_rate} );
|
||||
$unitprice = $order->{unitprice} / ( 1 + $order->{tax_rate} );
|
||||
}
|
||||
} else {
|
||||
if ( $bookseller->{invoiceincgst} ) {
|
||||
$rrp = $order->{rrp} * ( 1 + $order->{gstrate} );
|
||||
$ecost = $order->{ecost} * ( 1 + $order->{gstrate} );
|
||||
$unitprice = $order->{unitprice} * ( 1 + $order->{gstrate} );
|
||||
$rrp = $order->{rrp} * ( 1 + $order->{tax_rate} );
|
||||
$ecost = $order->{ecost} * ( 1 + $order->{tax_rate} );
|
||||
$unitprice = $order->{unitprice} * ( 1 + $order->{tax_rate} );
|
||||
} else {
|
||||
$rrp = $order->{rrp};
|
||||
$ecost = $order->{ecost};
|
||||
|
|
|
|||
|
|
@ -111,28 +111,30 @@ unless( $invoiceid and $invoice->{invoiceid} ) {
|
|||
|
||||
my $booksellerid = $invoice->{booksellerid};
|
||||
my $bookseller = Koha::Acquisition::Bookseller->fetch({ id => $booksellerid });
|
||||
my $gst = $bookseller->{gstrate} // C4::Context->preference("gist") // 0;
|
||||
my $gst = $bookseller->{tax_rate} // C4::Context->preference("gist") // 0;
|
||||
|
||||
my @orders = @{ $invoice->{orders} };
|
||||
my $countlines = scalar @orders;
|
||||
my @loop_received = ();
|
||||
my @book_foot_loop;
|
||||
my %foot;
|
||||
my $total_gste = 0;
|
||||
my $total_gsti = 0;
|
||||
my $total_tax_excluded = 0;
|
||||
my $total_tax_included = 0;
|
||||
|
||||
my $subtotal_for_funds;
|
||||
for my $order ( @orders ) {
|
||||
$order = C4::Acquisition::populate_order_with_prices({ order => $order, booksellerid => $bookseller->{id}, receiving => 1, ordering => 1 });
|
||||
$order->{'unitprice'} += 0;
|
||||
|
||||
if ( $bookseller->{listincgst} and not $bookseller->{invoiceincgst} ) {
|
||||
$order->{ecost} = $order->{ecostgste};
|
||||
$order->{unitprice} = $order->{unitpricegste};
|
||||
$order->{ecost} = $order->{ecost_tax_excluded};
|
||||
$order->{unitprice} = $order->{unitprice_tax_excluded};
|
||||
}
|
||||
elsif ( not $bookseller->{listinct} and $bookseller->{invoiceincgst} ) {
|
||||
$order->{ecost} = $order->{ecostgsti};
|
||||
$order->{unitprice} = $order->{unitpricegsti};
|
||||
$order->{ecost} = $order->{ecost_tax_included};
|
||||
$order->{unitprice} = $order->{unitprice_tax_included};
|
||||
} else {
|
||||
$order->{ecost} = $order->{ecost_tax_excluded};
|
||||
$order->{unitprice} = $order->{unitprice_tax_excluded};
|
||||
}
|
||||
$order->{total} = $order->{unitprice} * $order->{quantity};
|
||||
|
||||
|
|
@ -145,10 +147,10 @@ for my $order ( @orders ) {
|
|||
$line{holds} += scalar( @$holds );
|
||||
}
|
||||
$line{budget} = GetBudgetByOrderNumber( $line{ordernumber} );
|
||||
$foot{$line{gstrate}}{gstrate} = $line{gstrate};
|
||||
$foot{$line{gstrate}}{gstvalue} += $line{gstvalue};
|
||||
$total_gste += $line{totalgste};
|
||||
$total_gsti += $line{totalgsti};
|
||||
$foot{$line{tax_rate}}{tax_rate} = $line{tax_rate};
|
||||
$foot{$line{tax_rate}}{tax_value} += $line{tax_value};
|
||||
$total_tax_excluded += Koha::Number::Price->new( $line{ecost_tax_excluded} * $line{quantity} )->format;
|
||||
$total_tax_included += Koha::Number::Price->new( $line{ecost_tax_included} * $line{quantity} )->format;
|
||||
|
||||
my $suggestion = GetSuggestionInfoFromBiblionumber($line{biblionumber});
|
||||
$line{suggestionid} = $suggestion->{suggestionid};
|
||||
|
|
@ -219,12 +221,13 @@ unless( defined $invoice->{closedate} ) {
|
|||
|
||||
for (my $i = 0 ; $i < $countpendings ; $i++) {
|
||||
my $order = $pendingorders->[$i];
|
||||
$order = C4::Acquisition::populate_order_with_prices({ order => $order, booksellerid => $bookseller->{id}, receiving => 1, ordering => 1 });
|
||||
|
||||
if ( $bookseller->{listincgst} and not $bookseller->{invoiceincgst} ) {
|
||||
$order->{ecost} = $order->{ecostgste};
|
||||
$order->{ecost} = $order->{ecost_tax_excluded};
|
||||
} elsif ( not $bookseller->{listinct} and $bookseller->{invoiceincgst} ) {
|
||||
$order->{ecost} = $order->{ecostgsti};
|
||||
$order->{ecost} = $order->{ecost_tax_included};
|
||||
} else {
|
||||
$order->{ecost} = $order->{ecost_tax_excluded};
|
||||
}
|
||||
$order->{total} = $order->{ecost} * $order->{quantity};
|
||||
|
||||
|
|
@ -288,8 +291,8 @@ $template->param(
|
|||
loop_orders => \@loop_orders,
|
||||
book_foot_loop => \@book_foot_loop,
|
||||
(uc(C4::Context->preference("marcflavour"))) => 1,
|
||||
total_gste => $total_gste,
|
||||
total_gsti => $total_gsti,
|
||||
total_tax_excluded => $total_tax_excluded,
|
||||
total_tax_included => $total_tax_included,
|
||||
subtotal_for_funds => $subtotal_for_funds,
|
||||
sticky_filters => $sticky_filters,
|
||||
);
|
||||
|
|
|
|||
|
|
@ -96,11 +96,11 @@ sub printorders {
|
|||
$basket->{basketno},
|
||||
$titleinfo. ($line->{order_vendornote} ? "\n----------------\nNote for vendor : " . $line->{order_vendornote} : '' ),
|
||||
$line->{quantity},
|
||||
Koha::Number::Price->new( $line->{rrpgsti} )->format,
|
||||
Koha::Number::Price->new( $line->{rrp_tax_included} )->format,
|
||||
Koha::Number::Price->new( $line->{discount} )->format . '%',
|
||||
Koha::Number::Price->new( $line->{gstrate} * 100 )->format . '%',
|
||||
Koha::Number::Price->new( $line->{totalgste} )->format,
|
||||
Koha::Number::Price->new( $line->{totalgsti} )->format,
|
||||
Koha::Number::Price->new( $line->{tax_rate} * 100 )->format . '%',
|
||||
Koha::Number::Price->new( $line->{total_tax_excluded} )->format,
|
||||
Koha::Number::Price->new( $line->{total_tax_included} )->format,
|
||||
);
|
||||
push(@$abaskets, $arrbasket);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -96,11 +96,11 @@ sub printorders {
|
|||
$basket->{basketno},
|
||||
$titleinfo. ($line->{order_vendornote} ? "\n----------------\nLieferantennotiz : ". $line->{order_vendornote} : '' ), $line->{quantity},
|
||||
$line->{quantity},
|
||||
Koha::Number::Price->new( $line->{rrpgsti} )->format,
|
||||
Koha::Number::Price->new( $line->{rrp_tax_included} )->format,
|
||||
Koha::Number::Price->new( $line->{discount} )->format . '%',
|
||||
Koha::Number::Price->new( $line->{gstrate} * 100 )->format . '%',
|
||||
Koha::Number::Price->new( $line->{totalgste} )->format,
|
||||
Koha::Number::Price->new( $line->{totalgsti} )->format,
|
||||
Koha::Number::Price->new( $line->{tax_rate} * 100 )->format . '%',
|
||||
Koha::Number::Price->new( $line->{total_tax_excluded} )->format,
|
||||
Koha::Number::Price->new( $line->{total_tax_included} )->format,
|
||||
);
|
||||
push(@$abaskets, $arrbasket);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -117,13 +117,13 @@ sub printorders {
|
|||
push( @$arrbasket,
|
||||
$titleinfo. ($line->{order_vendornote} ? "\n----------------\nNote for vendor : " . $line->{order_vendornote} : '' ),
|
||||
$line->{quantity},
|
||||
Koha::Number::Price->new( $line->{rrpgste} )->format,
|
||||
Koha::Number::Price->new( $line->{rrpgsti} )->format,
|
||||
Koha::Number::Price->new( $line->{rrp_tax_excluded} )->format,
|
||||
Koha::Number::Price->new( $line->{rrp_tax_included} )->format,
|
||||
Koha::Number::Price->new( $line->{discount} )->format . '%',
|
||||
Koha::Number::Price->new( $line->{rrpgste} - $line->{ecostgste})->format,
|
||||
Koha::Number::Price->new( $line->{gstrate} * 100 )->format . '%',
|
||||
Koha::Number::Price->new( $line->{totalgste} )->format,
|
||||
Koha::Number::Price->new( $line->{totalgsti} )->format,
|
||||
Koha::Number::Price->new( $line->{rrp_tax_excluded} - $line->{ecost_tax_excluded})->format,
|
||||
Koha::Number::Price->new( $line->{tax_rate} * 100 )->format . '%',
|
||||
Koha::Number::Price->new( $line->{total_tax_excluded} )->format,
|
||||
Koha::Number::Price->new( $line->{total_tax_included} )->format,
|
||||
);
|
||||
push(@$abaskets, $arrbasket);
|
||||
}
|
||||
|
|
@ -209,43 +209,43 @@ sub printbaskets {
|
|||
for my $bkey (@keys) {
|
||||
push(@$arrbasket, $bkey);
|
||||
}
|
||||
my ($grandtotalrrpgsti, $grandtotalrrpgste, $grandtotalgsti, $grandtotalgste, $grandtotalgstvalue, $grandtotaldiscount);
|
||||
my ($grandtotal_rrp_tax_included, $grandtotal_rrp_tax_excluded, $grandtotal_tax_included, $grandtotal_tax_excluded, $grandtotaltax_value, $grandtotaldiscount);
|
||||
# calculate each basket total
|
||||
push(@$abaskets, $arrbasket);
|
||||
for my $basket (@$hbaskets) {
|
||||
my @gst;
|
||||
$arrbasket = undef;
|
||||
my ($totalrrpgste, $totalrrpgsti, $totalgste, $totalgsti, $totalgstvalue, $totaldiscount);
|
||||
my ($total_rrp_tax_excluded, $total_rrp_tax_included, $total_tax_excluded, $total_tax_included, $totaltax_value, $totaldiscount);
|
||||
my $ords = $orders->{$basket->{basketno}};
|
||||
my $ordlength = @$ords;
|
||||
foreach my $ord (@$ords) {
|
||||
$totalgste += $ord->{totalgste};
|
||||
$totalgsti += $ord->{totalgsti};
|
||||
$totalgstvalue += $ord->{gstvalue};
|
||||
$totaldiscount += ($ord->{rrpgste} - $ord->{ecostgste} ) * $ord->{quantity};
|
||||
$totalrrpgste += $ord->{rrpgste} * $ord->{quantity};
|
||||
$totalrrpgsti += $ord->{rrpgsti} * $ord->{quantity};
|
||||
push @gst, $ord->{gstrate};
|
||||
$total_tax_excluded += $ord->{total_tax_excluded};
|
||||
$total_tax_included += $ord->{total_tax_included};
|
||||
$totaltax_value += $ord->{tax_value};
|
||||
$totaldiscount += ($ord->{rrp_tax_excluded} - $ord->{ecost_tax_excluded} ) * $ord->{quantity};
|
||||
$total_rrp_tax_excluded += $ord->{rrp_tax_excluded} * $ord->{quantity};
|
||||
$total_rrp_tax_included += $ord->{rrp_tax_included} * $ord->{quantity};
|
||||
push @gst, $ord->{tax_rate};
|
||||
}
|
||||
@gst = uniq map { $_ * 100 } @gst;
|
||||
$grandtotalrrpgste += $totalrrpgste;
|
||||
$grandtotalrrpgsti += $totalrrpgsti;
|
||||
$grandtotalgsti += $totalgsti;
|
||||
$grandtotalgste += $totalgste;
|
||||
$grandtotalgstvalue += $totalgstvalue;
|
||||
$grandtotal_rrp_tax_excluded += $total_rrp_tax_excluded;
|
||||
$grandtotal_rrp_tax_included += $total_rrp_tax_included;
|
||||
$grandtotal_tax_included += $total_tax_included;
|
||||
$grandtotal_tax_excluded += $total_tax_excluded;
|
||||
$grandtotaltax_value += $totaltax_value;
|
||||
$grandtotaldiscount += $totaldiscount;
|
||||
my @gst_string =
|
||||
map { Koha::Number::Price->new($_)->format . '%' } @gst;
|
||||
push(@$arrbasket,
|
||||
$basket->{contractname},
|
||||
$basket->{basketname} . ' (No. ' . $basket->{basketno} . ')',
|
||||
Koha::Number::Price->new( $totalrrpgste )->format,
|
||||
Koha::Number::Price->new( $totalrrpgsti )->format,
|
||||
Koha::Number::Price->new( $total_rrp_tax_excluded )->format,
|
||||
Koha::Number::Price->new( $total_rrp_tax_included )->format,
|
||||
"@gst_string",
|
||||
Koha::Number::Price->new( $totalgstvalue )->format,
|
||||
Koha::Number::Price->new( $totaltax_value )->format,
|
||||
Koha::Number::Price->new( $totaldiscount )->format,
|
||||
Koha::Number::Price->new( $totalgste )->format,
|
||||
Koha::Number::Price->new( $totalgsti )->format,
|
||||
Koha::Number::Price->new( $total_tax_excluded )->format,
|
||||
Koha::Number::Price->new( $total_tax_included )->format,
|
||||
);
|
||||
push(@$abaskets, $arrbasket);
|
||||
}
|
||||
|
|
@ -254,13 +254,13 @@ sub printbaskets {
|
|||
push @$arrbasket,
|
||||
'',
|
||||
'Total',
|
||||
Koha::Number::Price->new( $grandtotalrrpgste )->format,
|
||||
Koha::Number::Price->new( $grandtotalrrpgsti )->format,
|
||||
Koha::Number::Price->new( $grandtotal_rrp_tax_excluded )->format,
|
||||
Koha::Number::Price->new( $grandtotal_rrp_tax_included )->format,
|
||||
'',
|
||||
Koha::Number::Price->new( $grandtotalgstvalue )->format,
|
||||
Koha::Number::Price->new( $grandtotaltax_value )->format,
|
||||
Koha::Number::Price->new( $grandtotaldiscount )->format,
|
||||
Koha::Number::Price->new( $grandtotalgste )->format,
|
||||
Koha::Number::Price->new( $grandtotalgsti )->format;
|
||||
Koha::Number::Price->new( $grandtotal_tax_excluded )->format,
|
||||
Koha::Number::Price->new( $grandtotal_tax_included )->format;
|
||||
push @$abaskets,$arrbasket;
|
||||
# height is width and width is height in this function, as the pdf is in landscape mode for the Tables.
|
||||
|
||||
|
|
|
|||
|
|
@ -117,13 +117,13 @@ sub printorders {
|
|||
push( @$arrbasket,
|
||||
$titleinfo. ($line->{order_vendornote} ? "\n----------------\nNote pour le fournisseur : ". $line->{order_vendornote} : '' ),
|
||||
$line->{quantity},
|
||||
Koha::Number::Price->new( $line->{rrpgste})->format,
|
||||
Koha::Number::Price->new( $line->{rrpgsti})->format,
|
||||
Koha::Number::Price->new( $line->{rrp_tax_excluded})->format,
|
||||
Koha::Number::Price->new( $line->{rrp_tax_included})->format,
|
||||
Koha::Number::Price->new( $line->{discount})->format.'%',
|
||||
Koha::Number::Price->new( $line->{rrpgste} - $line->{ecostgste})->format,
|
||||
Koha::Number::Price->new( $line->{gstrate} * 100)->format.'%',
|
||||
Koha::Number::Price->new( $line->{totalgste})->format,
|
||||
Koha::Number::Price->new( $line->{totalgsti})->format,
|
||||
Koha::Number::Price->new( $line->{rrp_tax_excluded} - $line->{ecost_tax_excluded})->format,
|
||||
Koha::Number::Price->new( $line->{tax_rate} * 100)->format.'%',
|
||||
Koha::Number::Price->new( $line->{total_tax_excluded})->format,
|
||||
Koha::Number::Price->new( $line->{total_tax_included})->format,
|
||||
);
|
||||
push(@$abaskets, $arrbasket);
|
||||
}
|
||||
|
|
@ -209,43 +209,43 @@ sub printbaskets {
|
|||
for my $bkey (@keys) {
|
||||
push(@$arrbasket, $bkey);
|
||||
}
|
||||
my ($grandtotalrrpgsti, $grandtotalrrpgste, $grandtotalgsti, $grandtotalgste, $grandtotalgstvalue, $grandtotaldiscount);
|
||||
my ($grandtotal_rrp_tax_included, $grandtotal_rrp_tax_excluded, $grandtotal_tax_included, $grandtotal_tax_excluded, $grandtotaltax_value, $grandtotaldiscount);
|
||||
# calculate each basket total
|
||||
push(@$abaskets, $arrbasket);
|
||||
for my $basket (@$hbaskets) {
|
||||
my @gst;
|
||||
$arrbasket = undef;
|
||||
my ($totalrrpgste, $totalrrpgsti, $totalgste, $totalgsti, $totalgstvalue, $totaldiscount);
|
||||
my ($total_rrp_tax_excluded, $total_rrp_tax_included, $total_tax_excluded, $total_tax_included, $totaltax_value, $totaldiscount);
|
||||
my $ords = $orders->{$basket->{basketno}};
|
||||
my $ordlength = @$ords;
|
||||
foreach my $ord (@$ords) {
|
||||
$totalgste += $ord->{totalgste};
|
||||
$totalgsti += $ord->{totalgsti};
|
||||
$totalgstvalue += $ord->{gstvalue};
|
||||
$totaldiscount += ($ord->{rrpgste} - $ord->{ecostgste} ) * $ord->{quantity};
|
||||
$totalrrpgste += $ord->{rrpgste} * $ord->{quantity};
|
||||
$totalrrpgsti += $ord->{rrpgsti} * $ord->{quantity};
|
||||
push @gst, $ord->{gstrate};
|
||||
$total_tax_excluded += $ord->{total_tax_excluded};
|
||||
$total_tax_included += $ord->{total_tax_included};
|
||||
$totaltax_value += $ord->{tax_value};
|
||||
$totaldiscount += ($ord->{rrp_tax_excluded} - $ord->{ecost_tax_excluded} ) * $ord->{quantity};
|
||||
$total_rrp_tax_excluded += $ord->{rrp_tax_excluded} * $ord->{quantity};
|
||||
$total_rrp_tax_included += $ord->{rrp_tax_included} * $ord->{quantity};
|
||||
push @gst, $ord->{tax_rate};
|
||||
}
|
||||
@gst = uniq map { $_ * 100 } @gst;
|
||||
$grandtotalrrpgste += $totalrrpgste;
|
||||
$grandtotalrrpgsti += $totalrrpgsti;
|
||||
$grandtotalgsti += $totalgsti;
|
||||
$grandtotalgste += $totalgste;
|
||||
$grandtotalgstvalue += $totalgstvalue;
|
||||
$grandtotal_rrp_tax_excluded += $total_rrp_tax_excluded;
|
||||
$grandtotal_rrp_tax_included += $total_rrp_tax_included;
|
||||
$grandtotal_tax_included += $total_tax_included;
|
||||
$grandtotal_tax_excluded += $total_tax_excluded;
|
||||
$grandtotaltax_value += $totaltax_value;
|
||||
$grandtotaldiscount += $totaldiscount;
|
||||
my @gst_string =
|
||||
map { Koha::Number::Price->new($_)->format . '%' } @gst;
|
||||
push(@$arrbasket,
|
||||
$basket->{contractname},
|
||||
$basket->{basketname} . ' (No. ' . $basket->{basketno} . ')',
|
||||
Koha::Number::Price->new( $totalrrpgste )->format,
|
||||
Koha::Number::Price->new( $totalrrpgsti )->format,
|
||||
Koha::Number::Price->new( $total_rrp_tax_excluded )->format,
|
||||
Koha::Number::Price->new( $total_rrp_tax_included )->format,
|
||||
"@gst_string",
|
||||
Koha::Number::Price->new( $totalgstvalue )->format,
|
||||
Koha::Number::Price->new( $totaltax_value )->format,
|
||||
Koha::Number::Price->new( $totaldiscount )->format,
|
||||
Koha::Number::Price->new( $totalgste )->format,
|
||||
Koha::Number::Price->new( $totalgsti )->format,
|
||||
Koha::Number::Price->new( $total_tax_excluded )->format,
|
||||
Koha::Number::Price->new( $total_tax_included )->format,
|
||||
);
|
||||
push(@$abaskets, $arrbasket);
|
||||
}
|
||||
|
|
@ -254,13 +254,13 @@ sub printbaskets {
|
|||
push @$arrbasket,
|
||||
'',
|
||||
'Total',
|
||||
Koha::Number::Price->new( $grandtotalrrpgste )->format,
|
||||
Koha::Number::Price->new( $grandtotalrrpgsti )->format,
|
||||
Koha::Number::Price->new( $grandtotal_rrp_tax_excluded )->format,
|
||||
Koha::Number::Price->new( $grandtotal_rrp_tax_included )->format,
|
||||
'',
|
||||
Koha::Number::Price->new( $grandtotalgstvalue )->format,
|
||||
Koha::Number::Price->new( $grandtotaltax_value )->format,
|
||||
Koha::Number::Price->new( $grandtotaldiscount )->format,
|
||||
Koha::Number::Price->new( $grandtotalgste )->format,
|
||||
Koha::Number::Price->new( $grandtotalgsti )->format;
|
||||
Koha::Number::Price->new( $grandtotal_tax_excluded )->format,
|
||||
Koha::Number::Price->new( $grandtotal_tax_included )->format;
|
||||
push @$abaskets,$arrbasket;
|
||||
# height is width and width is height in this function, as the pdf is in landscape mode for the Tables.
|
||||
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ if ( $op eq 'display' ) {
|
|||
|
||||
$template->param(
|
||||
active => $supplier->{'active'},
|
||||
gstrate => $supplier->{'gstrate'} + 0.0,
|
||||
tax_rate => $supplier->{'tax_rate'} + 0.0,
|
||||
invoiceprice => $supplier->{'invoiceprice'},
|
||||
listprice => $supplier->{'listprice'},
|
||||
basketcount => $supplier->{'basketcount'},
|
||||
|
|
@ -108,7 +108,7 @@ if ( $op eq 'display' ) {
|
|||
$template->param(
|
||||
# set active ON by default for supplier add (id empty for add)
|
||||
active => $booksellerid ? $supplier->{'active'} : 1,
|
||||
gstrate => $supplier->{gstrate} ? $supplier->{'gstrate'}+0.0 : 0,
|
||||
tax_rate => $supplier->{tax_rate} ? $supplier->{'tax_rate'}+0.0 : 0,
|
||||
gst_values => \@gst_values,
|
||||
currencies => \@currencies,
|
||||
enter => 1,
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ Here is the list :
|
|||
supplier, id, company, company_postal, physical, company_phone,
|
||||
physical, company_phone, company_fax, website, company_email, notes,
|
||||
status, publishers_imprints, list_currency, gst, list_gst, invoice_gst,
|
||||
discount, gstrate, contact_name, contact_position, contact_phone,
|
||||
discount, tax_rate, contact_name, contact_position, contact_phone,
|
||||
contact_altphone, contact_fax, contact_email, contact_notes,
|
||||
contact_claimacquisition, contact_claimissues, contact_acqprimary,
|
||||
contact_serialsprimary.
|
||||
|
|
@ -90,7 +90,7 @@ $data{'gstreg'}=$input->param('gst');
|
|||
$data{'listincgst'}=$input->param('list_gst');
|
||||
$data{'invoiceincgst'}=$input->param('invoice_gst');
|
||||
#have to transform this into fraction so it's easier to use
|
||||
$data{'gstrate'} = $input->param('gstrate');
|
||||
$data{'tax_rate'} = $input->param('tax_rate');
|
||||
$data{'discount'} = $input->param('discount');
|
||||
$data{deliverytime} = $input->param('deliverytime');
|
||||
$data{'active'}=$input->param('status');
|
||||
|
|
|
|||
|
|
@ -13,12 +13,12 @@
|
|||
//<![CDATA[
|
||||
function updateColumnsVisibility(visible) {
|
||||
if ( visible ) {
|
||||
$("table .gste, .gsti").show();
|
||||
$("table .tax_excluded, .tax_included").show();
|
||||
} else {
|
||||
[% IF ( listincgst ) %]
|
||||
$("table .gste").hide();
|
||||
$("table .tax_excluded").hide();
|
||||
[% ELSE %]
|
||||
$("table .gsti").hide();
|
||||
$("table .tax_included").hide();
|
||||
[% END %]
|
||||
}
|
||||
}
|
||||
|
|
@ -458,13 +458,13 @@
|
|||
<tr>
|
||||
<th>No.</th>
|
||||
<th class="anti-the">Order</th>
|
||||
<th class="gste">RRP tax exc.</th>
|
||||
<th class="gste">Ecost tax exc.</th>
|
||||
<th class="gsti">RRP tax inc.</th>
|
||||
<th class="gsti">ecost tax inc.</th>
|
||||
<th class="tax_excluded">RRP tax exc.</th>
|
||||
<th class="tax_excluded">ecost tax exc.</th>
|
||||
<th class="tax_included">RRP tax inc.</th>
|
||||
<th class="tax_included">ecost tax inc.</th>
|
||||
<th>Qty.</th>
|
||||
<th class="gste">Total tax exc. ([% currency %])</th>
|
||||
<th class="gsti">Total tax inc. ([% currency %])</th>
|
||||
<th class="tax_excluded">Total tax exc. ([% currency %])</th>
|
||||
<th class="tax_included">Total tax inc. ([% currency %])</th>
|
||||
<th>GST %</th>
|
||||
<th>GST</th>
|
||||
<th>Fund</th>
|
||||
|
|
@ -481,16 +481,16 @@
|
|||
[% FOREACH foot_loo IN book_foot_loop %]
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>Total (GST [% foot_loo.gstrate * 100 | $Price %])</th>
|
||||
<th class="gste"> </th>
|
||||
<th class="gste"> </th>
|
||||
<th class="gsti"> </th>
|
||||
<th class="gsti"> </th>
|
||||
<th>Total (GST [% foot_loo.tax_rate * 100 | $Price %])</th>
|
||||
<th class="tax_excluded"> </th>
|
||||
<th class="tax_excluded"> </th>
|
||||
<th class="tax_included"> </th>
|
||||
<th class="tax_included"> </th>
|
||||
<th>[% foot_loo.quantity %]</th>
|
||||
<th class="gste">[% foot_loo.totalgste | $Price%]</th>
|
||||
<th class="gsti">[% foot_loo.totalgsti | $Price %]</th>
|
||||
<th class="tax_excluded">[% foot_loo.total_tax_excluded | $Price%]</th>
|
||||
<th class="tax_included">[% foot_loo.total_tax_included | $Price %]</th>
|
||||
<th> </th>
|
||||
<th>[% foot_loo.gstvalue | $Price %]</th>
|
||||
<th>[% foot_loo.tax_value | $Price %]</th>
|
||||
<th> </th>
|
||||
<th> </th>
|
||||
[% IF ( active ) %]
|
||||
|
|
@ -504,15 +504,15 @@
|
|||
<tr>
|
||||
<th></th>
|
||||
<th>Total ([% currency %])</th>
|
||||
<th class="gste"> </th>
|
||||
<th class="gste"> </th>
|
||||
<th class="gsti"> </th>
|
||||
<th class="gsti"> </th>
|
||||
<th class="tax_excluded"> </th>
|
||||
<th class="tax_excluded"> </th>
|
||||
<th class="tax_included"> </th>
|
||||
<th class="tax_included"> </th>
|
||||
<th>[% total_quantity %]</th>
|
||||
<th class="gste">[% total_gste | $Price %]</th>
|
||||
<th class="gsti">[% total_gsti | $Price %]</th>
|
||||
<th class="tax_excluded">[% total_tax_excluded | $Price %]</th>
|
||||
<th class="tax_included">[% total_tax_included | $Price %]</th>
|
||||
<th> </th>
|
||||
<th>[% total_gstvalue | $Price %]</th>
|
||||
<th>[% total_tax_value | $Price %]</th>
|
||||
<th> </th>
|
||||
<th> </th>
|
||||
[% IF ( active ) %]
|
||||
|
|
@ -578,15 +578,15 @@
|
|||
</td>
|
||||
[% SET zero_regex = "^0{1,}\.?0{1,}[^1-9]" %] [%# 0 or 0.0 or 0.00 or 00 or 00.0 or 00.00 or 0.000 ... %]
|
||||
[%# FIXME: use of a regexp is not ideal; bugs 9410 and 10929 suggest better way of handling this %]
|
||||
<td class="number gste [% IF books_loo.rrpgste.search(zero_regex) %]error[% END %]">[% books_loo.rrpgste | $Price %]</td>
|
||||
<td class="number gste [% IF books_loo.ecostgste.search(zero_regex) %]error[% END %]">[% books_loo.ecostgste | $Price%]</td>
|
||||
<td class="number gsti [% IF books_loo.rrpgsti.search(zero_regex) %]error[% END %]">[% books_loo.rrpgsti | $Price %]</td>
|
||||
<td class="number gsti [% IF books_loo.ecostgsti.search(zero_regex) %]error[% END %]">[% books_loo.ecostgsti | $Price %]</td>
|
||||
<td class="number tax_excluded [% IF books_loo.rrp_tax_excluded.search(zero_regex) %]error[% END %]">[% books_loo.rrp_tax_excluded | $Price %]</td>
|
||||
<td class="number tax_excluded [% IF books_loo.ecost_tax_excluded.search(zero_regex) %]error[% END %]">[% books_loo.ecost_tax_excluded | $Price%]</td>
|
||||
<td class="number tax_included [% IF books_loo.rrp_tax_included.search(zero_regex) %]error[% END %]">[% books_loo.rrp_tax_included | $Price %]</td>
|
||||
<td class="number tax_included [% IF books_loo.ecost_tax_included.search(zero_regex) %]error[% END %]">[% books_loo.ecost_tax_included | $Price %]</td>
|
||||
<td class="number [% IF books_loo.quantity.search(zero_regex) %]error[% END %]">[% books_loo.quantity %]</td>
|
||||
<td class="number gste [% IF books_loo.totalgste.search(zero_regex) %]error[% END %]">[% books_loo.totalgste | $Price %]</td>
|
||||
<td class="number gsti [% IF books_loo.totalgsti.search(zero_regex) %]error[% END %]">[% books_loo.totalgsti | $Price %]</td>
|
||||
<td class="number">[% books_loo.gstrate * 100 | $Price %]</td>
|
||||
<td class="number [% IF books_loo.gstvalue.search(zero_regex) %]error[% END %]">[% books_loo.gstvalue | $Price %]</td>
|
||||
<td class="number tax_excluded [% IF books_loo.total_tax_excluded.search(zero_regex) %]error[% END %]">[% books_loo.total_tax_excluded | $Price %]</td>
|
||||
<td class="number tax_included [% IF books_loo.total_tax_included.search(zero_regex) %]error[% END %]">[% books_loo.total_tax_included | $Price %]</td>
|
||||
<td class="number">[% books_loo.tax_rate * 100 | $Price %]</td>
|
||||
<td class="number [% IF books_loo.tax_value.search(zero_regex) %]error[% END %]">[% books_loo.tax_value | $Price %]</td>
|
||||
<td>[% books_loo.budget_name %]</td>
|
||||
<td>[% books_loo.suppliers_report %]</td>
|
||||
[% IF ( active ) %]
|
||||
|
|
@ -640,13 +640,13 @@
|
|||
<tr>
|
||||
<th>No.</th>
|
||||
<th>Order</th>
|
||||
<th class="gste">RRP tax exc.</th>
|
||||
<th class="gste">ecost tax exc.</th>
|
||||
<th class="gsti">RRP tax inc.</th>
|
||||
<th class="gsti">ecost tax inc.</th>
|
||||
<th class="tax_excluded">RRP tax exc.</th>
|
||||
<th class="tax_excluded">ecost tax exc.</th>
|
||||
<th class="tax_included">RRP tax inc.</th>
|
||||
<th class="tax_included">ecost tax inc.</th>
|
||||
<th>Qty.</th>
|
||||
<th class="gste">Total tax exc. ([% currency %])</th>
|
||||
<th class="gsti">Total tax inc. ([% currency %])</th>
|
||||
<th class="tax_excluded">Total tax exc. ([% currency %])</th>
|
||||
<th class="tax_included">Total tax inc. ([% currency %])</th>
|
||||
<th>GST %</th>
|
||||
<th>GST</th>
|
||||
<th>Fund</th>
|
||||
|
|
@ -691,15 +691,15 @@
|
|||
</p>
|
||||
[% END %]
|
||||
</td>
|
||||
<td class="number gste">[% order.rrpgste | $Price %]</td>
|
||||
<td class="number gste">[% order.ecostgste | $Price %]</td>
|
||||
<td class="number gsti">[% order.rrpgsti | $Price %]</td>
|
||||
<td class="number gsti">[% order.ecostgsti | $Price %]</td>
|
||||
<td class="number tax_excluded">[% order.rrp_tax_excluded | $Price %]</td>
|
||||
<td class="number tax_excluded">[% order.ecost_tax_excluded | $Price %]</td>
|
||||
<td class="number tax_included">[% order.rrp_tax_included | $Price %]</td>
|
||||
<td class="number tax_included">[% order.ecost_tax_included | $Price %]</td>
|
||||
<td class="number">[% order.quantity %]</td>
|
||||
<td class="number gste">[% order.totalgste | $Price %]</td>
|
||||
<td class="number gsti">[% order.totalgsti | $Price %]</td>
|
||||
<td class="number">[% order.gstrate * 100 | $Price %]</td>
|
||||
<td class="number">[% order.gstvalue | $Price %]</td>
|
||||
<td class="number tax_excluded">[% order.total_tax_excluded | $Price %]</td>
|
||||
<td class="number tax_included">[% order.total_tax_included | $Price %]</td>
|
||||
<td class="number">[% order.tax_rate * 100 | $Price %]</td>
|
||||
<td class="number">[% order.tax_value | $Price %]</td>
|
||||
<td>[% order.budget_name %]
|
||||
</tr>
|
||||
[% END %]
|
||||
|
|
|
|||
|
|
@ -12,12 +12,12 @@
|
|||
//<![CDATA[
|
||||
function updateColumnsVisibility(visible) {
|
||||
if ( visible ) {
|
||||
$("table .gste, .gsti").show();
|
||||
$("table .tax_excluded, .tax_included").show();
|
||||
} else {
|
||||
[% IF ( invoiceincgst ) %]
|
||||
$("table .gste").hide();
|
||||
$("table .tax_excluded").hide();
|
||||
[% ELSE %]
|
||||
$("table .gsti").hide();
|
||||
$("table .tax_included").hide();
|
||||
[% END %]
|
||||
}
|
||||
}
|
||||
|
|
@ -142,11 +142,11 @@
|
|||
<tr>
|
||||
<th class="anti-the">Summary</th>
|
||||
<th>Library</th>
|
||||
<th class="gste">Actual cost tax exc.</th>
|
||||
<th class="gsti">Actual cost tax inc.</th>
|
||||
<th class="tax_excluded">Actual cost tax exc.</th>
|
||||
<th class="tax_included">Actual cost tax inc.</th>
|
||||
<th>Qty.</th>
|
||||
<th class="gste">Total tax exc. ([% currency.symbol %])</th>
|
||||
<th class="gsti">Total tax inc. ([% currency.symbol %])</th>
|
||||
<th class="tax_excluded">Total tax exc. ([% currency.symbol %])</th>
|
||||
<th class="tax_included">Total tax inc. ([% currency.symbol %])</th>
|
||||
<th>GST %</th>
|
||||
<th>GST</th>
|
||||
<th>Fund</th>
|
||||
|
|
@ -174,13 +174,13 @@
|
|||
[% END %]
|
||||
</td>
|
||||
<td><p>[% order.branchcode %]</p></td>
|
||||
<td class="number gste">[% order.unitpricegste | $Price %]</td>
|
||||
<td class="number gsti">[% order.unitpricegsti | $Price %]</td>
|
||||
<td class="number tax_excluded">[% order.unitprice_tax_excluded | $Price %]</td>
|
||||
<td class="number tax_included">[% order.unitprice_tax_included | $Price %]</td>
|
||||
<td class="number">[% order.quantity %]</td>
|
||||
<td class="number gste">[% order.totalgste | $Price %]</td>
|
||||
<td class="number gsti">[% order.totalgsti | $Price %]</td>
|
||||
<td class="number">[% order.gstrate * 100 | $Price %]</td>
|
||||
<td class="number">[% order.gstvalue | $Price %]</td>
|
||||
<td class="number tax_excluded">[% order.total_tax_excluded | $Price %]</td>
|
||||
<td class="number tax_included">[% order.total_tax_included | $Price %]</td>
|
||||
<td class="number">[% order.tax_rate * 100 | $Price %]</td>
|
||||
<td class="number">[% order.tax_value | $Price %]</td>
|
||||
<td>[% order.budget_name %]</td>
|
||||
</tr>
|
||||
[% END %]
|
||||
|
|
@ -188,35 +188,35 @@
|
|||
<tfoot>
|
||||
[% FOR tf IN foot_loop %]
|
||||
<tr>
|
||||
<th colspan='2'>Total (GST [% tf.gstrate * 100 | $Price %] %)</th>
|
||||
<th class="gste"/><th class="gsti"/>
|
||||
<th colspan='3'>Total (GST [% tf.tax_rate * 100 | $Price %] %)</th>
|
||||
<th class="tax_excluded"/><th class="tax_included"/>
|
||||
<th>[% tf.quantity %]</th>
|
||||
<th class="gste">[% tf.totalgste | $Price %]</th>
|
||||
<th class="gsti">[% tf.totalgsti | $Price %]</th>
|
||||
<th class="tax_excluded">[% tf.total_tax_excluded | $Price %]</th>
|
||||
<th class="tax_included">[% tf.total_tax_included | $Price %]</th>
|
||||
<th> </th>
|
||||
<th>[% tf.gstvalue | $Price %]</th>
|
||||
<th>[% tf.tax_value | $Price %]</th>
|
||||
<th> </th>
|
||||
</tr>
|
||||
[% END %]
|
||||
<tr>
|
||||
<th colspan='2'>Total ([% currency.symbol %])</th>
|
||||
<th class="gste"/><th class="gsti"/>
|
||||
<th class="tax_excluded"/><th class="tax_included"/>
|
||||
<th>[% total_quantity %]</th>
|
||||
<th class="gste">[% total_gste | $Price %]</th>
|
||||
<th class="gsti">[% total_gsti | $Price %]</th>
|
||||
<th class="tax_excluded">[% total_tax_excluded | $Price %]</th>
|
||||
<th class="tax_included">[% total_tax_included | $Price %]</th>
|
||||
<th> </th>
|
||||
<th>[% total_gstvalue | $Price %]</th>
|
||||
<th>[% total_tax_value | $Price %]</th>
|
||||
<th> </th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="2">Total + Shipment cost ([% currency.symbol %])</th>
|
||||
<th class="gste"></th>
|
||||
<th class="gsti"></th>
|
||||
<th class="tax_excluded"></th>
|
||||
<th class="tax_included"></th>
|
||||
<th>[% total_quantity %]</th>
|
||||
<th class="gste">[% total_gste_shipment | $Price %]</th>
|
||||
<th class="gsti">[% total_gsti_shipment | $Price %]</th>
|
||||
<th class="tax_excluded">[% total_tax_excluded_shipment | $Price %]</th>
|
||||
<th class="tax_included">[% total_tax_included_shipment | $Price %]</th>
|
||||
<th> </th>
|
||||
<th>[% total_gstvalue | $Price %]</th>
|
||||
<th>[% total_tax_value | $Price %]</th>
|
||||
<th> </th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
|
|
|
|||
|
|
@ -561,12 +561,12 @@ $(document).ready(function()
|
|||
<li>
|
||||
[% IF ( close ) %]
|
||||
<span class="label">Tax rate: </span>
|
||||
<input type="hidden" name="gstrate" id="gstrate" value="[% gstrate %]" />[% gstrate %]%
|
||||
<input type="hidden" name="tax_rate" id="tax_rate" value="[% tax_rate %]" />[% tax_rate %]%
|
||||
[% ELSE %]
|
||||
<label for="gstrate">Tax rate: </label>
|
||||
<select name="gstrate" id="gstrate" onchange="updateCosts();">
|
||||
<label for="tax_rate">Tax rate: </label>
|
||||
<select name="tax_rate" id="tax_rate" onchange="updateCosts();">
|
||||
[% FOREACH gst IN gst_values %]
|
||||
[% IF ( gst.option == gstrate ) %]
|
||||
[% IF ( gst.option == tax_rate ) %]
|
||||
<option value="[% gst.option %]" selected="selected">[% gst.option * 100 | format("%.1f") %]%</option>
|
||||
[% ELSE %]
|
||||
<option value="[% gst.option %]">[% gst.option * 100 | format("%.1f") %]%</option>
|
||||
|
|
@ -575,7 +575,7 @@ $(document).ready(function()
|
|||
</select>
|
||||
[% END %]
|
||||
[% ELSE %]
|
||||
<input type="hidden" name="gstrate" value="0" />
|
||||
<input type="hidden" name="tax_rate" value="0" />
|
||||
</li>
|
||||
[% END %]
|
||||
<li>
|
||||
|
|
|
|||
|
|
@ -262,7 +262,7 @@
|
|||
<input type="hidden" name="invoiceid" value="[% invoiceid %]" />
|
||||
<input type="hidden" name="ordernumber" value="[% ordernumber %]" />
|
||||
<input type="hidden" name="booksellerid" value="[% booksellerid %]" />
|
||||
<input type="hidden" name="gstrate" value="[% gstrate %]" />
|
||||
<input type="hidden" name="tax_rate" value="[% tax_rate %]" />
|
||||
</div>
|
||||
<div class="yui-u">
|
||||
<fieldset class="rows">
|
||||
|
|
|
|||
|
|
@ -374,19 +374,19 @@
|
|||
[% END %]
|
||||
<tr>
|
||||
<th colspan="10" class="total">Total tax exc.</th>
|
||||
<th>[% total_gste | $Price %]</th>
|
||||
<th>[% total_tax_excluded | $Price %]</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
[% FOREACH book_foot IN book_foot_loop %]
|
||||
<tr>
|
||||
<th colspan="10">Total (GST [% book_foot.gstrate * 100 | $Price %]%)</th>
|
||||
<th>[% book_foot.gstvalue | $Price %]</th>
|
||||
<th colspan="10">Total (GST [% book_foot.tax_rate * 100 | $Price %]%)</th>
|
||||
<th>[% book_foot.tax_value | $Price %]</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
[% END %]
|
||||
<tr>
|
||||
<th colspan="10" class="total">Total tax inc.</th>
|
||||
<th>[% total_gsti | $Price %]</th>
|
||||
<th>[% total_tax_included | $Price %]</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
|
|
|
|||
|
|
@ -287,10 +287,10 @@ function delete_contact(ev) {
|
|||
[% IF gst_values %]
|
||||
<ol>
|
||||
<li>
|
||||
<label for="gstrate">Tax rate: </label>
|
||||
<select name="gstrate" id="gstrate">
|
||||
<label for="tax_rate">Tax rate: </label>
|
||||
<select name="tax_rate" id="tax_rate">
|
||||
[% FOREACH gst IN gst_values %]
|
||||
[% IF ( gstrate == gst.option ) %]
|
||||
[% IF ( tax_rate == gst.option ) %]
|
||||
<option value="[% gst.option %]" selected="selected">[% gst.option * 100 | format ("%.1f") %] %</option>
|
||||
[% ELSE %]
|
||||
<option value="[% gst.option %]">[% gst.option * 100 | format ("%.1f") %] %</option>
|
||||
|
|
@ -300,7 +300,7 @@ function delete_contact(ev) {
|
|||
</li>
|
||||
</ol>
|
||||
[% ELSE %]
|
||||
<input type="hidden" name="gstrate" value="0" />
|
||||
<input type="hidden" name="tax_rate" value="0" />
|
||||
[% END %]
|
||||
<ol>
|
||||
<li><label for="discount">Discount: </label>
|
||||
|
|
@ -344,7 +344,7 @@ function delete_contact(ev) {
|
|||
[% END %]</p>
|
||||
<p><strong>List prices are: </strong>[% listprice %]</p>
|
||||
<p><strong>Invoice prices are: </strong>[% invoiceprice %]</p>
|
||||
[% IF ( gstrate ) %]<p><strong>Tax number registered: </strong>
|
||||
[% IF ( tax_rate ) %]<p><strong>Tax number registered: </strong>
|
||||
[% IF ( gstreg ) %]Yes[% ELSE %]No[% END %]</p>
|
||||
<p><strong>List item price includes tax: </strong>
|
||||
[% IF ( listincgst ) %]Yes[% ELSE %]No[% END %]</p>
|
||||
|
|
@ -353,7 +353,7 @@ function delete_contact(ev) {
|
|||
<p><strong>Discount: </strong>
|
||||
[% discount | format("%.1f") %] %</p>
|
||||
<p><strong>Tax rate: </strong>
|
||||
[% 0 + gstrate * 100 | format("%.1f") %] %</p>
|
||||
[% 0 + tax_rate * 100 | format("%.1f") %] %</p>
|
||||
[% IF deliverytime.defined %]
|
||||
<p><strong>Delivery time: </strong>
|
||||
[% deliverytime %] days</p>
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@
|
|||
<li>A basket with at least one uncertain price can't be closed.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>If you are charged sales tax, choose that from the gstrate field</li>
|
||||
<li>If you are charged sales tax, choose that from the tax_rate field</li>
|
||||
<li>Enter the percentage discount you're receiving on this order, once you enter this, hit tab and Koha will populate the rest of the cost fields below.</li>
|
||||
<li>If you added Planning Values when creating the Fund, those values will appear in the two Planning Value fields.</li>
|
||||
</ul>
|
||||
|
|
|
|||
|
|
@ -359,8 +359,8 @@ $(document).ready(function() {
|
|||
<tbody>
|
||||
<tr>
|
||||
<td>Ordered amount</td>
|
||||
<td>[% valuegste_ordered %]</td>
|
||||
<td>[% valuegsti_ordered %]</td>
|
||||
<td>[% value_tax_excluded_ordered %]</td>
|
||||
<td>[% value_tax_included_ordered %]</td>
|
||||
<td>[% budget_name_ordered %]</td>
|
||||
<td>
|
||||
[% IF ( ordered_exists ) %]
|
||||
|
|
@ -370,8 +370,8 @@ $(document).ready(function() {
|
|||
</tr>
|
||||
<tr>
|
||||
<td>Spent amount</td>
|
||||
<td>[% valuegste_spent %]</td>
|
||||
<td>[% valuegsti_spent %]</td>
|
||||
<td>[% value_tax_excluded_spent %]</td>
|
||||
<td>[% value_tax_included_spent %]</td>
|
||||
<td>[% budget_name_spent %]</td>
|
||||
<td>
|
||||
[% IF ( spent_exists ) %]
|
||||
|
|
|
|||
|
|
@ -123,9 +123,9 @@ if ( defined $subscriptionid ) {
|
|||
if ( defined $lastOrderNotReceived ) {
|
||||
my $basket = GetBasket $lastOrderNotReceived->{basketno};
|
||||
my $bookseller = Koha::Acquisition::Bookseller->fetch({ id => $basket->{booksellerid} });
|
||||
( $tmpl_infos->{valuegsti_ordered}, $tmpl_infos->{valuegste_ordered} ) = get_value_with_gst_params ( $lastOrderNotReceived->{ecost}, $lastOrderNotReceived->{gstrate}, $bookseller );
|
||||
$tmpl_infos->{valuegsti_ordered} = sprintf( "%.2f", $tmpl_infos->{valuegsti_ordered} );
|
||||
$tmpl_infos->{valuegste_ordered} = sprintf( "%.2f", $tmpl_infos->{valuegste_ordered} );
|
||||
( $tmpl_infos->{value_tax_included_ordered}, $tmpl_infos->{value_tax_excluded_ordered} ) = get_value_with_gst_params ( $lastOrderNotReceived->{ecost}, $lastOrderNotReceived->{tax_rate}, $bookseller );
|
||||
$tmpl_infos->{value_tax_included_ordered} = sprintf( "%.2f", $tmpl_infos->{value_tax_included_ordered} );
|
||||
$tmpl_infos->{value_tax_excluded_ordered} = sprintf( "%.2f", $tmpl_infos->{value_tax_excluded_ordered} );
|
||||
$tmpl_infos->{budget_name_ordered} = GetBudgetName $lastOrderNotReceived->{budget_id};
|
||||
$tmpl_infos->{basketno} = $lastOrderNotReceived->{basketno};
|
||||
$tmpl_infos->{ordered_exists} = 1;
|
||||
|
|
@ -133,9 +133,9 @@ if ( defined $subscriptionid ) {
|
|||
if ( defined $lastOrderReceived ) {
|
||||
my $basket = GetBasket $lastOrderReceived->{basketno};
|
||||
my $bookseller = Koha::Acquisition::Bookseller->fetch({ id => $basket->{booksellerid} });
|
||||
( $tmpl_infos->{valuegsti_spent}, $tmpl_infos->{valuegste_spent} ) = get_value_with_gst_params ( $lastOrderReceived->{unitprice}, $lastOrderReceived->{gstrate}, $bookseller );
|
||||
$tmpl_infos->{valuegsti_spent} = sprintf( "%.2f", $tmpl_infos->{valuegsti_spent} );
|
||||
$tmpl_infos->{valuegste_spent} = sprintf( "%.2f", $tmpl_infos->{valuegste_spent} );
|
||||
( $tmpl_infos->{value_tax_included_spent}, $tmpl_infos->{value_tax_excluded_spent} ) = get_value_with_gst_params ( $lastOrderReceived->{unitprice}, $lastOrderReceived->{tax_rate}, $bookseller );
|
||||
$tmpl_infos->{value_tax_included_spent} = sprintf( "%.2f", $tmpl_infos->{value_tax_included_spent} );
|
||||
$tmpl_infos->{value_tax_excluded_spent} = sprintf( "%.2f", $tmpl_infos->{value_tax_excluded_spent} );
|
||||
$tmpl_infos->{budget_name_spent} = GetBudgetName $lastOrderReceived->{budget_id};
|
||||
$tmpl_infos->{invoiceid} = $lastOrderReceived->{invoiceid};
|
||||
$tmpl_infos->{spent_exists} = 1;
|
||||
|
|
@ -191,21 +191,21 @@ sub get_default_view {
|
|||
|
||||
sub get_value_with_gst_params {
|
||||
my $value = shift;
|
||||
my $gstrate = shift;
|
||||
my $tax_rate = shift;
|
||||
my $bookseller = shift;
|
||||
if ( $bookseller->{listincgst} ) {
|
||||
return ( $value, $value / ( 1 + $gstrate ) );
|
||||
return ( $value, $value / ( 1 + $tax_rate ) );
|
||||
} else {
|
||||
return ( $value * ( 1 + $gstrate ), $value );
|
||||
return ( $value * ( 1 + $tax_rate ), $value );
|
||||
}
|
||||
}
|
||||
|
||||
sub get_gste {
|
||||
sub get_tax_excluded {
|
||||
my $value = shift;
|
||||
my $gstrate = shift;
|
||||
my $tax_rate = shift;
|
||||
my $bookseller = shift;
|
||||
if ( $bookseller->{invoiceincgst} ) {
|
||||
return $value / ( 1 + $gstrate );
|
||||
return $value / ( 1 + $tax_rate );
|
||||
} else {
|
||||
return $value;
|
||||
}
|
||||
|
|
@ -213,11 +213,11 @@ sub get_gste {
|
|||
|
||||
sub get_gst {
|
||||
my $value = shift;
|
||||
my $gstrate = shift;
|
||||
my $tax_rate = shift;
|
||||
my $bookseller = shift;
|
||||
if ( $bookseller->{invoiceincgst} ) {
|
||||
return $value / ( 1 + $gstrate ) * $gstrate;
|
||||
return $value / ( 1 + $tax_rate ) * $tax_rate;
|
||||
} else {
|
||||
return $value * ( 1 + $gstrate ) - $value;
|
||||
return $value * ( 1 + $tax_rate ) - $value;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
209
t/Prices.t
209
t/Prices.t
|
|
@ -67,7 +67,7 @@ for my $currency_format ( qw( US FR ) ) {
|
|||
invoiceid => $invoiceid_0_0,
|
||||
rrp => 82.00,
|
||||
ecost => 73.80,
|
||||
gstrate => 0.0500,
|
||||
tax_rate => 0.0500,
|
||||
discount => 10.0000,
|
||||
datereceived => $today
|
||||
};
|
||||
|
|
@ -82,58 +82,58 @@ for my $currency_format ( qw( US FR ) ) {
|
|||
# Note that this configuration is correct \o/
|
||||
compare(
|
||||
{
|
||||
got => $order_0_0->{rrpgsti},
|
||||
got => $order_0_0->{rrp_tax_included},
|
||||
expected => 86.10,
|
||||
conf => '0 0',
|
||||
field => 'rrpgsti'
|
||||
field => 'rrp_tax_included'
|
||||
}
|
||||
);
|
||||
compare(
|
||||
{
|
||||
got => $order_0_0->{rrpgste},
|
||||
got => $order_0_0->{rrp_tax_excluded},
|
||||
expected => 82.00,
|
||||
conf => '0 0',
|
||||
field => 'rrpgste'
|
||||
field => 'rrp_tax_excluded'
|
||||
}
|
||||
);
|
||||
compare(
|
||||
{
|
||||
got => $order_0_0->{ecostgsti},
|
||||
got => $order_0_0->{ecost_tax_included},
|
||||
expected => 77.49,
|
||||
conf => '0 0',
|
||||
field => 'ecostgsti'
|
||||
field => 'ecost_tax_included'
|
||||
}
|
||||
);
|
||||
compare(
|
||||
{
|
||||
got => $order_0_0->{ecostgste},
|
||||
got => $order_0_0->{ecost_tax_excluded},
|
||||
expected => 73.80,
|
||||
conf => '0 0',
|
||||
field => 'ecostgste'
|
||||
field => 'ecost_tax_excluded'
|
||||
}
|
||||
);
|
||||
compare(
|
||||
{
|
||||
got => $order_0_0->{gstvalue},
|
||||
got => $order_0_0->{tax_value},
|
||||
expected => 7.38,
|
||||
conf => '0 0',
|
||||
field => 'gstvalue'
|
||||
field => 'tax_value'
|
||||
}
|
||||
);
|
||||
compare(
|
||||
{
|
||||
got => $order_0_0->{totalgsti},
|
||||
got => $order_0_0->{total_tax_included},
|
||||
expected => 154.98,
|
||||
conf => '0 0',
|
||||
field => 'totalgsti'
|
||||
field => 'total_tax_included'
|
||||
}
|
||||
);
|
||||
compare(
|
||||
{
|
||||
got => $order_0_0->{totalgste},
|
||||
got => $order_0_0->{total_tax_excluded},
|
||||
expected => 147.60,
|
||||
conf => '0 0',
|
||||
field => 'totalgste'
|
||||
field => 'total_tax_excluded'
|
||||
}
|
||||
);
|
||||
|
||||
|
|
@ -148,42 +148,42 @@ for my $currency_format ( qw( US FR ) ) {
|
|||
# Note that this configuration is correct \o/
|
||||
compare(
|
||||
{
|
||||
got => $order_0_0->{unitpricegsti},
|
||||
got => $order_0_0->{unitprice_tax_included},
|
||||
expected => 77.49,
|
||||
conf => '0 0',
|
||||
field => 'unitpricegsti'
|
||||
field => 'unitprice_tax_included'
|
||||
}
|
||||
);
|
||||
compare(
|
||||
{
|
||||
got => $order_0_0->{unitpricegste},
|
||||
got => $order_0_0->{unitprice_tax_excluded},
|
||||
expected => 73.80,
|
||||
conf => '0 0',
|
||||
field => 'unitpricegste'
|
||||
field => 'unitprice_tax_excluded'
|
||||
}
|
||||
);
|
||||
compare(
|
||||
{
|
||||
got => $order_0_0->{gstvalue},
|
||||
got => $order_0_0->{tax_value},
|
||||
expected => 7.38,
|
||||
conf => '0 0',
|
||||
field => 'gstvalue'
|
||||
field => 'tax_value'
|
||||
}
|
||||
);
|
||||
compare(
|
||||
{
|
||||
got => $order_0_0->{totalgsti},
|
||||
got => $order_0_0->{total_tax_included},
|
||||
expected => 154.98,
|
||||
conf => '0 0',
|
||||
field => 'totalgsti'
|
||||
field => 'total_tax_included'
|
||||
}
|
||||
);
|
||||
compare(
|
||||
{
|
||||
got => $order_0_0->{totalgste},
|
||||
got => $order_0_0->{total_tax_excluded},
|
||||
expected => 147.60,
|
||||
conf => '0 0',
|
||||
field => 'totalgste'
|
||||
field => 'total_tax_excluded'
|
||||
}
|
||||
);
|
||||
};
|
||||
|
|
@ -208,7 +208,7 @@ for my $currency_format ( qw( US FR ) ) {
|
|||
invoiceid => $invoiceid_1_1,
|
||||
rrp => 82.00,
|
||||
ecost => 73.80,
|
||||
gstrate => 0.0500,
|
||||
tax_rate => 0.0500,
|
||||
discount => 10.0000,
|
||||
datereceived => $today
|
||||
};
|
||||
|
|
@ -222,61 +222,61 @@ for my $currency_format ( qw( US FR ) ) {
|
|||
);
|
||||
|
||||
# Note that this configuration is *not* correct
|
||||
# gstvalue should be 7.03 instead of 7.02
|
||||
# tax_value should be 7.03 instead of 7.02
|
||||
compare(
|
||||
{
|
||||
got => $order_1_1->{rrpgsti},
|
||||
got => $order_1_1->{rrp_tax_included},
|
||||
expected => 82.00,
|
||||
conf => '1 1',
|
||||
field => 'rrpgsti'
|
||||
field => 'rrp_tax_included'
|
||||
}
|
||||
);
|
||||
compare(
|
||||
{
|
||||
got => $order_1_1->{rrpgste},
|
||||
got => $order_1_1->{rrp_tax_excluded},
|
||||
expected => 78.10,
|
||||
conf => '1 1',
|
||||
field => 'rrpgste'
|
||||
field => 'rrp_tax_excluded'
|
||||
}
|
||||
);
|
||||
compare(
|
||||
{
|
||||
got => $order_1_1->{ecostgsti},
|
||||
got => $order_1_1->{ecost_tax_included},
|
||||
expected => 73.80,
|
||||
conf => '1 1',
|
||||
field => 'ecostgsti'
|
||||
field => 'ecost_tax_included'
|
||||
}
|
||||
);
|
||||
compare(
|
||||
{
|
||||
got => $order_1_1->{ecostgste},
|
||||
got => $order_1_1->{ecost_tax_excluded},
|
||||
expected => 70.29,
|
||||
conf => '1 1',
|
||||
field => 'ecostgste'
|
||||
field => 'ecost_tax_excluded'
|
||||
}
|
||||
);
|
||||
compare(
|
||||
{
|
||||
got => $order_1_1->{gstvalue},
|
||||
got => $order_1_1->{tax_value},
|
||||
expected => 7.02,
|
||||
conf => '1 1',
|
||||
field => 'gstvalue'
|
||||
field => 'tax_value'
|
||||
}
|
||||
);
|
||||
compare(
|
||||
{
|
||||
got => $order_1_1->{totalgsti},
|
||||
got => $order_1_1->{total_tax_included},
|
||||
expected => 147.60,
|
||||
conf => '1 1',
|
||||
field => 'totalgsti'
|
||||
field => 'total_tax_included'
|
||||
}
|
||||
);
|
||||
compare(
|
||||
{
|
||||
got => $order_1_1->{totalgste},
|
||||
got => $order_1_1->{total_tax_excluded},
|
||||
expected => 140.58,
|
||||
conf => '1 1',
|
||||
field => 'totalgste'
|
||||
field => 'total_tax_excluded'
|
||||
}
|
||||
);
|
||||
|
||||
|
|
@ -288,45 +288,45 @@ for my $currency_format ( qw( US FR ) ) {
|
|||
}
|
||||
);
|
||||
# Note that this configuration is *not* correct!
|
||||
# gstvalue should be 7.03
|
||||
# tax_value should be 7.03
|
||||
compare(
|
||||
{
|
||||
got => $order_1_1->{unitpricegsti},
|
||||
got => $order_1_1->{unitprice_tax_included},
|
||||
expected => 73.80,
|
||||
conf => '1 1',
|
||||
field => 'unitpricegsti'
|
||||
field => 'unitprice_tax_included'
|
||||
}
|
||||
);
|
||||
compare(
|
||||
{
|
||||
got => $order_1_1->{unitpricegste},
|
||||
got => $order_1_1->{unitprice_tax_excluded},
|
||||
expected => 70.29,
|
||||
conf => '1 1',
|
||||
field => 'unitpricegste'
|
||||
field => 'unitprice_tax_excluded'
|
||||
}
|
||||
);
|
||||
compare(
|
||||
{
|
||||
got => $order_1_1->{gstvalue},
|
||||
got => $order_1_1->{tax_value},
|
||||
expected => 7.02,
|
||||
conf => '1 1',
|
||||
field => 'gstvalue'
|
||||
field => 'tax_value'
|
||||
}
|
||||
);
|
||||
compare(
|
||||
{
|
||||
got => $order_1_1->{totalgsti},
|
||||
got => $order_1_1->{total_tax_included},
|
||||
expected => 147.60,
|
||||
conf => '1 1',
|
||||
field => 'totalgsti'
|
||||
field => 'total_tax_included'
|
||||
}
|
||||
);
|
||||
compare(
|
||||
{
|
||||
got => $order_1_1->{totalgste},
|
||||
got => $order_1_1->{total_tax_excluded},
|
||||
expected => 140.58,
|
||||
conf => '1 1',
|
||||
field => 'totalgste'
|
||||
field => 'total_tax_excluded'
|
||||
}
|
||||
);
|
||||
};
|
||||
|
|
@ -351,7 +351,7 @@ for my $currency_format ( qw( US FR ) ) {
|
|||
invoiceid => $invoiceid_1_1,
|
||||
rrp => 82.01,
|
||||
ecost => 73.80,
|
||||
gstrate => 0.0500,
|
||||
tax_rate => 0.0500,
|
||||
discount => 10.0000,
|
||||
datereceived => $today
|
||||
};
|
||||
|
|
@ -365,64 +365,63 @@ for my $currency_format ( qw( US FR ) ) {
|
|||
);
|
||||
|
||||
# Note that this configuration is *not* correct!
|
||||
# rrp gsti should be 82 (what we inserted!)
|
||||
# => Actually we need to fix the inserted value (here we have 82.01 in DB)
|
||||
# gstvalue should be 7.03 instead of 7.02
|
||||
# rrp_tax_included should be 82 (what we inserted!)
|
||||
# tax_value should be 7.03 instead of 7.02
|
||||
|
||||
compare(
|
||||
{
|
||||
got => $order_1_0->{rrpgsti},
|
||||
got => $order_1_0->{rrp_tax_included},
|
||||
expected => 82.01,
|
||||
conf => '1 0',
|
||||
field => 'rrpgsti'
|
||||
field => 'rrp_tax_included'
|
||||
}
|
||||
);
|
||||
compare(
|
||||
{
|
||||
got => $order_1_0->{rrpgste},
|
||||
got => $order_1_0->{rrp_tax_excluded},
|
||||
expected => 78.10,
|
||||
conf => '1 0',
|
||||
field => 'rrpgste'
|
||||
field => 'rrp_tax_excluded'
|
||||
}
|
||||
);
|
||||
compare(
|
||||
{
|
||||
got => $order_1_0->{ecostgsti},
|
||||
got => $order_1_0->{ecost_tax_included},
|
||||
expected => 73.80,
|
||||
conf => '1 0',
|
||||
field => 'ecostgsti'
|
||||
field => 'ecost_tax_included'
|
||||
}
|
||||
);
|
||||
compare(
|
||||
{
|
||||
got => $order_1_0->{ecostgste},
|
||||
got => $order_1_0->{ecost_tax_excluded},
|
||||
expected => 70.29,
|
||||
conf => '1 0',
|
||||
field => 'ecostgste'
|
||||
field => 'ecost_tax_excluded'
|
||||
}
|
||||
);
|
||||
compare(
|
||||
{
|
||||
got => $order_1_0->{gstvalue},
|
||||
got => $order_1_0->{tax_value},
|
||||
expected => 7.02,
|
||||
conf => '1 0',
|
||||
field => 'gstvalue'
|
||||
field => 'tax_value'
|
||||
}
|
||||
);
|
||||
compare(
|
||||
{
|
||||
got => $order_1_0->{totalgsti},
|
||||
got => $order_1_0->{total_tax_included},
|
||||
expected => 147.60,
|
||||
conf => '1 0',
|
||||
field => 'totalgsti'
|
||||
field => 'total_tax_included'
|
||||
}
|
||||
);
|
||||
compare(
|
||||
{
|
||||
got => $order_1_0->{totalgste},
|
||||
got => $order_1_0->{total_tax_excluded},
|
||||
expected => 140.58,
|
||||
conf => '1 0',
|
||||
field => 'totalgste'
|
||||
field => 'total_tax_excluded'
|
||||
}
|
||||
);
|
||||
|
||||
|
|
@ -437,42 +436,42 @@ for my $currency_format ( qw( US FR ) ) {
|
|||
# gstvalue should be 7.03
|
||||
compare(
|
||||
{
|
||||
got => $order_1_0->{unitpricegsti},
|
||||
got => $order_1_0->{unitprice_tax_included},
|
||||
expected => 73.80,
|
||||
conf => '1 0',
|
||||
field => 'unitpricegsti'
|
||||
field => 'unitprice_tax_included'
|
||||
}
|
||||
);
|
||||
compare(
|
||||
{
|
||||
got => $order_1_0->{unitpricegste},
|
||||
got => $order_1_0->{unitprice_tax_excluded},
|
||||
expected => 70.29,
|
||||
conf => '1 0',
|
||||
field => 'unitpricegste'
|
||||
field => 'unitprice_tax_excluded'
|
||||
}
|
||||
);
|
||||
compare(
|
||||
{
|
||||
got => $order_1_0->{gstvalue},
|
||||
got => $order_1_0->{tax_value},
|
||||
expected => 7.02,
|
||||
conf => '1 0',
|
||||
field => 'gstvalue'
|
||||
field => 'tax_value'
|
||||
}
|
||||
);
|
||||
compare(
|
||||
{
|
||||
got => $order_1_0->{totalgsti},
|
||||
got => $order_1_0->{total_tax_included},
|
||||
expected => 147.60,
|
||||
conf => '1 0',
|
||||
field => 'totalgsti'
|
||||
field => 'total_tax_included'
|
||||
}
|
||||
);
|
||||
compare(
|
||||
{
|
||||
got => $order_1_0->{totalgste},
|
||||
got => $order_1_0->{total_tax_excluded},
|
||||
expected => 140.58,
|
||||
conf => '1 0',
|
||||
field => 'totalgste'
|
||||
field => 'total_tax_excluded'
|
||||
}
|
||||
);
|
||||
};
|
||||
|
|
@ -497,7 +496,7 @@ for my $currency_format ( qw( US FR ) ) {
|
|||
invoiceid => $invoiceid_1_1,
|
||||
rrp => 82.00,
|
||||
ecost => 73.80,
|
||||
gstrate => 0.0500,
|
||||
tax_rate => 0.0500,
|
||||
discount => 10.0000,
|
||||
datereceived => $today
|
||||
};
|
||||
|
|
@ -513,58 +512,58 @@ for my $currency_format ( qw( US FR ) ) {
|
|||
# Note that this configuration is correct \o/
|
||||
compare(
|
||||
{
|
||||
got => $order_0_1->{rrpgsti},
|
||||
got => $order_0_1->{rrp_tax_included},
|
||||
expected => 86.10,
|
||||
conf => '1 0',
|
||||
field => 'rrpgsti'
|
||||
field => 'rrp_tax_included'
|
||||
}
|
||||
);
|
||||
compare(
|
||||
{
|
||||
got => $order_0_1->{rrpgste},
|
||||
got => $order_0_1->{rrp_tax_excluded},
|
||||
expected => 82.00,
|
||||
conf => '1 0',
|
||||
field => 'rrpgste'
|
||||
field => 'rrp_tax_excluded'
|
||||
}
|
||||
);
|
||||
compare(
|
||||
{
|
||||
got => $order_0_1->{ecostgsti},
|
||||
got => $order_0_1->{ecost_tax_included},
|
||||
expected => 77.49,
|
||||
conf => '1 0',
|
||||
field => 'ecostgsti'
|
||||
field => 'ecost_tax_included'
|
||||
}
|
||||
);
|
||||
compare(
|
||||
{
|
||||
got => $order_0_1->{ecostgste},
|
||||
got => $order_0_1->{ecost_tax_excluded},
|
||||
expected => 73.80,
|
||||
conf => '1 0',
|
||||
field => 'ecostgste'
|
||||
field => 'ecost_tax_excluded'
|
||||
}
|
||||
);
|
||||
compare(
|
||||
{
|
||||
got => $order_0_1->{gstvalue},
|
||||
got => $order_0_1->{tax_value},
|
||||
expected => 7.38,
|
||||
conf => '1 0',
|
||||
field => 'gstvalue'
|
||||
field => 'tax_value'
|
||||
}
|
||||
);
|
||||
compare(
|
||||
{
|
||||
got => $order_0_1->{totalgsti},
|
||||
got => $order_0_1->{total_tax_included},
|
||||
expected => 154.98,
|
||||
conf => '1 0',
|
||||
field => 'totalgsti'
|
||||
field => 'total_tax_included'
|
||||
}
|
||||
);
|
||||
compare(
|
||||
{
|
||||
got => $order_0_1->{totalgste},
|
||||
got => $order_0_1->{total_tax_excluded},
|
||||
expected => 147.60,
|
||||
conf => '1 0',
|
||||
field => 'totalgste'
|
||||
field => 'total_tax_excluded'
|
||||
}
|
||||
);
|
||||
|
||||
|
|
@ -578,42 +577,42 @@ for my $currency_format ( qw( US FR ) ) {
|
|||
# Note that this configuration is correct
|
||||
compare(
|
||||
{
|
||||
got => $order_0_1->{unitpricegsti},
|
||||
got => $order_0_1->{unitprice_tax_included},
|
||||
expected => 77.49,
|
||||
conf => '0 1',
|
||||
field => 'unitpricegsti'
|
||||
field => 'unitprice_tax_included'
|
||||
}
|
||||
);
|
||||
compare(
|
||||
{
|
||||
got => $order_0_1->{unitpricegste},
|
||||
got => $order_0_1->{unitprice_tax_excluded},
|
||||
expected => 73.80,
|
||||
conf => '0 1',
|
||||
field => 'unitpricegste'
|
||||
field => 'unitprice_tax_excluded'
|
||||
}
|
||||
);
|
||||
compare(
|
||||
{
|
||||
got => $order_0_1->{gstvalue},
|
||||
got => $order_0_1->{tax_value},
|
||||
expected => 7.38,
|
||||
conf => '0 1',
|
||||
field => 'gstvalue'
|
||||
field => 'tax_value'
|
||||
}
|
||||
);
|
||||
compare(
|
||||
{
|
||||
got => $order_0_1->{totalgsti},
|
||||
got => $order_0_1->{total_tax_included},
|
||||
expected => 154.98,
|
||||
conf => '0 1',
|
||||
field => 'totalgsti'
|
||||
field => 'total_tax_included'
|
||||
}
|
||||
);
|
||||
compare(
|
||||
{
|
||||
got => $order_0_1->{totalgste},
|
||||
got => $order_0_1->{total_tax_excluded},
|
||||
expected => 147.60,
|
||||
conf => '0 1',
|
||||
field => 'totalgste'
|
||||
field => 'total_tax_excluded'
|
||||
}
|
||||
);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -189,7 +189,7 @@ my @order_content = (
|
|||
ecost => 38.15,
|
||||
rrp => 40.15,
|
||||
discount => 5.1111,
|
||||
gstrate => 0.0515
|
||||
tax_rate => 0.0515
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
@ -217,7 +217,7 @@ my @order_content = (
|
|||
ecost => 38.1,
|
||||
rrp => 11.0,
|
||||
discount => 5.1,
|
||||
gstrate => 0.1
|
||||
tax_rate => 0.1
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
@ -237,7 +237,7 @@ my @order_content = (
|
|||
rrp => 11.00,
|
||||
discount => 0,
|
||||
uncertainprice => 0,
|
||||
gstrate => 0
|
||||
tax_rate => 0
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
@ -257,7 +257,7 @@ my @order_content = (
|
|||
rrp => 10,
|
||||
discount => 0,
|
||||
uncertainprice => 0,
|
||||
gstrate => 0
|
||||
tax_rate => 0
|
||||
}
|
||||
}
|
||||
);
|
||||
|
|
@ -347,16 +347,23 @@ my @expectedfields = qw(
|
|||
invoiceid
|
||||
freight
|
||||
unitprice
|
||||
unitprice_tax_included
|
||||
unitprice_tax_excluded
|
||||
quantityreceived
|
||||
datecancellationprinted
|
||||
purchaseordernumber
|
||||
basketno
|
||||
timestamp
|
||||
rrp
|
||||
rrp_tax_included
|
||||
rrp_tax_excluded
|
||||
ecost
|
||||
ecost_tax_included
|
||||
ecost_tax_excluded
|
||||
unitpricesupplier
|
||||
unitpricelib
|
||||
gstrate
|
||||
tax_rate
|
||||
tax_value
|
||||
discount
|
||||
budget_id
|
||||
budgetdate
|
||||
|
|
@ -424,6 +431,8 @@ my @base_expectedfields = qw(
|
|||
notes
|
||||
ordernumber
|
||||
ecost
|
||||
ecost_tax_included
|
||||
ecost_tax_excluded
|
||||
uncertainprice
|
||||
url
|
||||
isbn
|
||||
|
|
@ -453,6 +462,8 @@ my @base_expectedfields = qw(
|
|||
budget_parent_id
|
||||
publishercode
|
||||
unitprice
|
||||
unitprice_tax_included
|
||||
unitprice_tax_excluded
|
||||
collectionvolume
|
||||
budget_amount
|
||||
budget_owner_id
|
||||
|
|
@ -474,7 +485,8 @@ my @base_expectedfields = qw(
|
|||
suppliers_report
|
||||
agerestriction
|
||||
budget_branchcode
|
||||
gstrate
|
||||
tax_rate
|
||||
tax_value
|
||||
listprice
|
||||
budget_code
|
||||
budgetdate
|
||||
|
|
@ -497,6 +509,8 @@ my @base_expectedfields = qw(
|
|||
sort2_authcat
|
||||
budget_expend
|
||||
rrp
|
||||
rrp_tax_included
|
||||
rrp_tax_excluded
|
||||
cn_sort
|
||||
lccn
|
||||
sort1
|
||||
|
|
@ -584,6 +598,8 @@ ok(
|
|||
firstname
|
||||
biblioitemnumber
|
||||
ecost
|
||||
ecost_tax_included
|
||||
ecost_tax_excluded
|
||||
uncertainprice
|
||||
creationdate
|
||||
datereceived
|
||||
|
|
@ -594,7 +610,8 @@ ok(
|
|||
suppliers_report
|
||||
isbn
|
||||
copyrightdate
|
||||
gstrate
|
||||
tax_rate
|
||||
tax_value
|
||||
serial
|
||||
listprice
|
||||
budgetdate
|
||||
|
|
@ -620,7 +637,11 @@ ok(
|
|||
unititle
|
||||
sort2_authcat
|
||||
rrp
|
||||
rrp_tax_included
|
||||
rrp_tax_excluded
|
||||
unitprice
|
||||
unitprice_tax_included
|
||||
unitprice_tax_excluded
|
||||
sort1
|
||||
ordernumber
|
||||
datecreated
|
||||
|
|
@ -646,15 +667,14 @@ my $invoiceid = AddInvoice(
|
|||
unknown => "unknown"
|
||||
);
|
||||
|
||||
my $invoice = GetInvoice( $invoiceid );
|
||||
|
||||
my ($datereceived, $new_ordernumber) = ModReceiveOrder(
|
||||
{
|
||||
biblionumber => $biblionumber4,
|
||||
ordernumber => $ordernumbers[4],
|
||||
order => GetOrder( $ordernumbers[4] ),
|
||||
quantityreceived => 1,
|
||||
cost => 10,
|
||||
ecost => 10,
|
||||
invoiceid => $invoiceid,
|
||||
rrp => 10,
|
||||
invoice => $invoice,
|
||||
budget_id => $order_content[4]->{str}->{budget_id},
|
||||
}
|
||||
);
|
||||
|
|
@ -812,20 +832,18 @@ is(
|
|||
"AddClaim : Check claimed_date"
|
||||
);
|
||||
|
||||
my $order2 = GetOrder( $ordernumbers[1] );
|
||||
$order2->{order_internalnote} = "my notes";
|
||||
( $datereceived, $new_ordernumber ) = ModReceiveOrder(
|
||||
{
|
||||
biblionumber => $biblionumber2,
|
||||
ordernumber => $ordernumbers[1],
|
||||
order => $order2,
|
||||
quantityreceived => 2,
|
||||
cost => 12,
|
||||
ecost => 12,
|
||||
invoiceid => $invoiceid,
|
||||
rrp => 42,
|
||||
order_internalnote => "my notes",
|
||||
order_vendornote => "my vendor notes",
|
||||
invoice => $invoice,
|
||||
}
|
||||
);
|
||||
my $order2 = GetOrder( $ordernumbers[1] );
|
||||
)
|
||||
;
|
||||
$order2 = GetOrder( $ordernumbers[1] );
|
||||
is( $order2->{'quantityreceived'},
|
||||
0, 'Splitting up order did not receive any on original order' );
|
||||
is( $order2->{'quantity'}, 40, '40 items on original order' );
|
||||
|
|
@ -833,8 +851,6 @@ is( $order2->{'budget_id'}, $budgetid,
|
|||
'Budget on original order is unchanged' );
|
||||
is( $order2->{order_internalnote}, "my notes",
|
||||
'ModReceiveOrder and GetOrder deal with internal notes' );
|
||||
is( $order2->{order_vendornote}, "my vendor notes",
|
||||
'ModReceiveOrder and GetOrder deal with vendor notes' );
|
||||
|
||||
$neworder = GetOrder($new_ordernumber);
|
||||
is( $neworder->{'quantity'}, 2, '2 items on new order' );
|
||||
|
|
@ -857,21 +873,19 @@ my $budgetid2 = C4::Budgets::AddBudget(
|
|||
}
|
||||
);
|
||||
|
||||
my $order3 = GetOrder( $ordernumbers[2] );
|
||||
$order3->{order_internalnote} = "my other notes";
|
||||
( $datereceived, $new_ordernumber ) = ModReceiveOrder(
|
||||
{
|
||||
biblionumber => $biblionumber2,
|
||||
ordernumber => $ordernumbers[2],
|
||||
order => $order3,
|
||||
quantityreceived => 2,
|
||||
cost => 12,
|
||||
ecost => 12,
|
||||
invoiceid => $invoiceid,
|
||||
rrp => 42,
|
||||
invoice => $invoice,
|
||||
budget_id => $budgetid2,
|
||||
order_internalnote => "my other notes",
|
||||
}
|
||||
);
|
||||
|
||||
my $order3 = GetOrder( $ordernumbers[2] );
|
||||
$order3 = GetOrder( $ordernumbers[2] );
|
||||
is( $order3->{'quantityreceived'},
|
||||
0, 'Splitting up order did not receive any on original order' );
|
||||
is( $order3->{'quantity'}, 2, '2 items on original order' );
|
||||
|
|
@ -886,17 +900,15 @@ is( $neworder->{'quantityreceived'},
|
|||
2, 'Splitting up order received items on new order' );
|
||||
is( $neworder->{'budget_id'}, $budgetid2, 'Budget on new order is changed' );
|
||||
|
||||
$order3 = GetOrder( $ordernumbers[2] );
|
||||
$order3->{order_internalnote} = "my third notes";
|
||||
( $datereceived, $new_ordernumber ) = ModReceiveOrder(
|
||||
{
|
||||
biblionumber => $biblionumber2,
|
||||
ordernumber => $ordernumbers[2],
|
||||
order => $order3,
|
||||
quantityreceived => 2,
|
||||
cost => 12,
|
||||
ecost => 12,
|
||||
invoiceid => $invoiceid,
|
||||
rrp => 42,
|
||||
invoice => $invoice,
|
||||
budget_id => $budgetid2,
|
||||
order_internalnote => "my third notes",
|
||||
}
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -60,9 +60,8 @@ my $ordernumber = $order->{ordernumber};
|
|||
ModReceiveOrder(
|
||||
{
|
||||
biblionumber => $biblionumber,
|
||||
ordernumber => $ordernumber,
|
||||
order => $order,
|
||||
quantityreceived => 2,
|
||||
datereceived => dt_from_string
|
||||
}
|
||||
);
|
||||
|
||||
|
|
@ -70,8 +69,7 @@ $order->add_item( $itemnumber );
|
|||
|
||||
CancelReceipt($ordernumber);
|
||||
|
||||
$order = GetOrder( $ordernumber );
|
||||
is(scalar GetItemnumbersFromOrder($order->{ordernumber}), 0, "Create items on receiving: 0 item exist after cancelling a receipt");
|
||||
is(scalar GetItemnumbersFromOrder($ordernumber), 0, "Create items on receiving: 0 item exist after cancelling a receipt");
|
||||
|
||||
my $itemnumber1 = AddItem({}, $biblionumber);
|
||||
my $itemnumber2 = AddItem({}, $biblionumber);
|
||||
|
|
@ -103,9 +101,8 @@ is(
|
|||
my ( undef, $new_ordernumber ) = ModReceiveOrder(
|
||||
{
|
||||
biblionumber => $biblionumber,
|
||||
ordernumber => $ordernumber,
|
||||
order => $order,
|
||||
quantityreceived => 1,
|
||||
datereceived => dt_from_string,
|
||||
received_items => [ $itemnumber1 ],
|
||||
}
|
||||
);
|
||||
|
|
|
|||
|
|
@ -91,26 +91,24 @@ my $invoiceid2 = AddInvoice(invoicenumber => 'invoice2', booksellerid => $bookse
|
|||
shipmentdate => '2012-12-24',
|
||||
);
|
||||
|
||||
my $invoice1 = GetInvoice( $invoiceid1 );
|
||||
my $invoice2 = GetInvoice( $invoiceid2 );
|
||||
|
||||
my ( $datereceived, $new_ordernumber ) = ModReceiveOrder(
|
||||
{
|
||||
biblionumber => $biblionumber1,
|
||||
ordernumber => $ordernumber1,
|
||||
order => $order1,
|
||||
quantityreceived => 2,
|
||||
cost => 12,
|
||||
ecost => 12,
|
||||
invoiceid => $invoiceid1,
|
||||
rrp => 42
|
||||
invoice => $invoice1,
|
||||
}
|
||||
);
|
||||
|
||||
( $datereceived, $new_ordernumber ) = ModReceiveOrder(
|
||||
{
|
||||
biblionumber => $biblionumber2,
|
||||
ordernumber => $ordernumber2,
|
||||
order => $order2,
|
||||
quantityreceived => 1,
|
||||
cost => 5,
|
||||
ecost => 5,
|
||||
invoiceid => $invoiceid2,
|
||||
invoice => $invoice2,
|
||||
rrp => 42
|
||||
}
|
||||
);
|
||||
|
|
@ -118,17 +116,14 @@ my ( $datereceived, $new_ordernumber ) = ModReceiveOrder(
|
|||
( $datereceived, $new_ordernumber ) = ModReceiveOrder(
|
||||
{
|
||||
biblionumber => $biblionumber3,
|
||||
ordernumber => $ordernumber3,
|
||||
order => $order3,
|
||||
quantityreceived => 1,
|
||||
cost => 12,
|
||||
ecost => 12,
|
||||
invoiceid => $invoiceid2,
|
||||
rrp => 42
|
||||
invoice => $invoice2,
|
||||
}
|
||||
);
|
||||
|
||||
my $invoice1 = GetInvoiceDetails($invoiceid1);
|
||||
my $invoice2 = GetInvoiceDetails($invoiceid2);
|
||||
$invoice1 = GetInvoiceDetails($invoiceid1);
|
||||
$invoice2 = GetInvoiceDetails($invoiceid2);
|
||||
|
||||
is(scalar @{$invoice1->{'orders'}}, 1, 'Invoice1 has only one order');
|
||||
is(scalar @{$invoice2->{'orders'}}, 2, 'Invoice2 has only two orders');
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ my $order = Koha::Acquisition::Order->new({
|
|||
basketno => $basketno,
|
||||
rrp => $cost,
|
||||
ecost => $cost,
|
||||
gstrate => 0.0500,
|
||||
tax_rate => 0.0500,
|
||||
orderstatus => 'new',
|
||||
subscriptionid => $subscription->{subscriptionid},
|
||||
budget_id => $budget_id,
|
||||
|
|
@ -85,16 +85,16 @@ ok( $order->{ecost} == $cost, "test cost for the last order not received");
|
|||
$dbh->do(q{DELETE FROM aqinvoices});
|
||||
my $invoiceid = AddInvoice(invoicenumber => 'invoice1', booksellerid => $booksellerid, unknown => "unknown");
|
||||
|
||||
my $invoice = GetInvoice( $invoiceid );
|
||||
$invoice->{datereceived} = '02-01-2013';
|
||||
|
||||
my ( $datereceived, $new_ordernumber ) = ModReceiveOrder(
|
||||
{
|
||||
biblionumber => $biblionumber,
|
||||
ordernumber => $ordernumber,
|
||||
order => $order,
|
||||
quantityreceived => 1,
|
||||
cost => $cost,
|
||||
ecost => $cost,
|
||||
rrp => $cost,
|
||||
budget_id => $budget_id,
|
||||
invoiceid => $invoiceid,
|
||||
invoice => $invoice,
|
||||
}
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -95,11 +95,12 @@ $orders = SearchOrders({ ordernumber => $ordernumber });
|
|||
is ( scalar( @$orders ), 1, 'SearchOrders returns 1 order with [old]ordernumber' );
|
||||
is ( $orders->[0]->{ordernumber}, $newordernumber, 'SearchOrders returns newordernumber if [old]ordernumber is given' );
|
||||
|
||||
my $neworder = GetOrder( $newordernumber );
|
||||
|
||||
ModReceiveOrder({
|
||||
biblionumber => $biblionumber,
|
||||
ordernumber => $newordernumber,
|
||||
order => $neworder,
|
||||
quantityreceived => 2,
|
||||
datereceived => dt_from_string(),
|
||||
});
|
||||
CancelReceipt( $newordernumber );
|
||||
$order = GetOrder( $newordernumber );
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ my $sample_supplier1 = {
|
|||
gstreg => 1,
|
||||
listincgst => 1,
|
||||
invoiceincgst => 1,
|
||||
gstrate => '1.0000',
|
||||
tax_rate => '1.0000',
|
||||
discount => '1.0000',
|
||||
notes => 'notes1',
|
||||
deliverytime => undef
|
||||
|
|
@ -83,7 +83,7 @@ my $sample_supplier2 = {
|
|||
gstreg => 1,
|
||||
listincgst => 1,
|
||||
invoiceincgst => 1,
|
||||
gstrate => '2.0000',
|
||||
tax_rate => '2.0000',
|
||||
discount => '2.0000',
|
||||
notes => 'notes2',
|
||||
deliverytime => 2
|
||||
|
|
@ -224,7 +224,7 @@ $sample_supplier2 = {
|
|||
gstreg => 1,
|
||||
listincgst => 1,
|
||||
invoiceincgst => 1,
|
||||
gstrate => '2.0000 ',
|
||||
tax_rate => '2.0000 ',
|
||||
discount => '2.0000',
|
||||
notes => 'notes2 modified',
|
||||
deliverytime => 2,
|
||||
|
|
@ -264,7 +264,7 @@ my $sample_supplier3 = {
|
|||
gstreg => 1,
|
||||
listincgst => 1,
|
||||
invoiceincgst => 1,
|
||||
gstrate => '3.0000',
|
||||
tax_rate => '3.0000',
|
||||
discount => '3.0000',
|
||||
notes => 'notes3',
|
||||
deliverytime => 3
|
||||
|
|
@ -284,7 +284,7 @@ my $sample_supplier4 = {
|
|||
gstreg => 1,
|
||||
listincgst => 1,
|
||||
invoiceincgst => 1,
|
||||
gstrate => '3.0000',
|
||||
tax_rate => '3.0000',
|
||||
discount => '3.0000',
|
||||
notes => 'notes3',
|
||||
};
|
||||
|
|
@ -361,7 +361,7 @@ my $order1 = Koha::Acquisition::Order->new(
|
|||
entrydate => '01-01-2013',
|
||||
currency => 'EUR',
|
||||
notes => "This is a note1",
|
||||
gstrate => 0.0500,
|
||||
tax_rate => 0.0500,
|
||||
orderstatus => 1,
|
||||
subscriptionid => $id_subscription1,
|
||||
quantityreceived => 2,
|
||||
|
|
@ -381,7 +381,7 @@ my $order2 = Koha::Acquisition::Order->new(
|
|||
entrydate => '01-01-2013',
|
||||
currency => 'EUR',
|
||||
notes => "This is a note2",
|
||||
gstrate => 0.0500,
|
||||
tax_rate => 0.0500,
|
||||
orderstatus => 1,
|
||||
subscriptionid => $id_subscription2,
|
||||
rrp => 10,
|
||||
|
|
@ -399,7 +399,7 @@ my $order3 = Koha::Acquisition::Order->new(
|
|||
entrydate => '02-02-2013',
|
||||
currency => 'EUR',
|
||||
notes => "This is a note3",
|
||||
gstrate => 0.0500,
|
||||
tax_rate => 0.0500,
|
||||
orderstatus => 2,
|
||||
subscriptionid => $id_subscription3,
|
||||
rrp => 11,
|
||||
|
|
@ -417,7 +417,7 @@ my $order4 = Koha::Acquisition::Order->new(
|
|||
entrydate => '02-02-2013',
|
||||
currency => 'EUR',
|
||||
notes => "This is a note3",
|
||||
gstrate => 0.0500,
|
||||
tax_rate => 0.0500,
|
||||
orderstatus => 2,
|
||||
subscriptionid => $id_subscription3,
|
||||
rrp => 11,
|
||||
|
|
|
|||
|
|
@ -317,6 +317,7 @@ my @order_infos = (
|
|||
|
||||
my %budgets;
|
||||
my $invoiceid = AddInvoice(invoicenumber => 'invoice_test_clone', booksellerid => $booksellerid, unknown => "unknown");
|
||||
my $invoice = GetInvoice( $invoiceid );
|
||||
my $item_price = 10;
|
||||
my $item_quantity = 2;
|
||||
my $number_of_orders_to_move = 0;
|
||||
|
|
@ -337,7 +338,7 @@ for my $infos (@order_infos) {
|
|||
rrp => $item_price,
|
||||
discount => 0,
|
||||
uncertainprice => 0,
|
||||
gstrate => 0,
|
||||
tax_rate => 0,
|
||||
}
|
||||
)->insert;
|
||||
my $ordernumber = $order->{ordernumber};
|
||||
|
|
@ -360,19 +361,16 @@ for my $infos (@order_infos) {
|
|||
rrp => $item_price,
|
||||
discount => 0,
|
||||
uncertainprice => 0,
|
||||
gstrate => 0,
|
||||
tax_rate => 0,
|
||||
}
|
||||
)->insert;
|
||||
my $ordernumber = $order->{ordernumber};
|
||||
ModReceiveOrder({
|
||||
biblionumber => $biblionumber,
|
||||
ordernumber => $ordernumber,
|
||||
order => $order,
|
||||
budget_id => $infos->{budget_id},
|
||||
quantityreceived => $item_quantity,
|
||||
cost => $item_price,
|
||||
ecost => $item_price,
|
||||
invoiceid => $invoiceid,
|
||||
rrp => $item_price,
|
||||
invoice => $invoice,
|
||||
received_items => [],
|
||||
} );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ my $sample_supplier1 = {
|
|||
gstreg => 1,
|
||||
listincgst => 1,
|
||||
invoiceincgst => 1,
|
||||
gstrate => '1.0000',
|
||||
tax_rate => '1.0000',
|
||||
discount => '1.0000',
|
||||
notes => 'notes1',
|
||||
deliverytime => undef
|
||||
|
|
@ -68,7 +68,7 @@ my $sample_supplier2 = {
|
|||
gstreg => 1,
|
||||
listincgst => 1,
|
||||
invoiceincgst => 1,
|
||||
gstrate => '2.0000',
|
||||
tax_rate => '2.0000',
|
||||
discount => '2.0000',
|
||||
notes => 'notes2',
|
||||
deliverytime => 2
|
||||
|
|
|
|||
Loading…
Reference in New Issue