Bug 23376: Clean up order receipt page code
This patchset switches from using DB lookups to using an order object for most things on orderreceive.pl It simplifies the script and makes minimal changes to the template To test: 1 - Place some orders and receive them 2 - Have orders with or without subscriptions attached 3 - Try with different AcqCreateItems settings 4 - Apply patch 5 - No behaviour should change 6 - Read code to ensure things make sense Signed-off-by: Agustin Moyano <agustinmoyano@theke.io> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
parent
d7c58c10f1
commit
5d4740dfb0
2 changed files with 86 additions and 114 deletions
|
@ -89,30 +89,26 @@ my $freight = $invoice->{shipmentcost};
|
||||||
my $ordernumber = $input->param('ordernumber');
|
my $ordernumber = $input->param('ordernumber');
|
||||||
|
|
||||||
my $bookseller = Koha::Acquisition::Booksellers->find( $booksellerid );
|
my $bookseller = Koha::Acquisition::Booksellers->find( $booksellerid );
|
||||||
my $results;
|
my $order = Koha::Acquisition::Orders->find( $ordernumber );
|
||||||
$results = SearchOrders({
|
|
||||||
ordernumber => $ordernumber
|
|
||||||
}) if $ordernumber;
|
|
||||||
|
|
||||||
my ( $template, $loggedinuser, $cookie, $userflags ) = get_template_and_user(
|
my ( $template, $loggedinuser, $cookie, $userflags ) = get_template_and_user(
|
||||||
{
|
{
|
||||||
template_name => "acqui/orderreceive.tt",
|
template_name => "acqui/orderreceive.tt",
|
||||||
query => $input,
|
query => $input,
|
||||||
type => "intranet",
|
type => "intranet",
|
||||||
|
authnotrequired => 0,
|
||||||
flagsrequired => {acquisition => 'order_receive'},
|
flagsrequired => {acquisition => 'order_receive'},
|
||||||
debug => 1,
|
debug => 1,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
unless ( $results and @$results) {
|
unless ( $order ) {
|
||||||
output_html_with_http_headers $input, $cookie, $template->output;
|
output_html_with_http_headers $input, $cookie, $template->output;
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
# prepare the form for receiving
|
# prepare the form for receiving
|
||||||
my $order = $results->[0];
|
my $basket = $order->basket;
|
||||||
my $order_object = Koha::Acquisition::Orders->find( $ordernumber );
|
|
||||||
my $basket = $order_object->basket;
|
|
||||||
my $currencies = Koha::Acquisition::Currencies->search;
|
my $currencies = Koha::Acquisition::Currencies->search;
|
||||||
my $active_currency = $currencies->get_active;
|
my $active_currency = $currencies->get_active;
|
||||||
|
|
||||||
|
@ -130,87 +126,61 @@ if ($AcqCreateItem eq 'receiving') {
|
||||||
);
|
);
|
||||||
} elsif ($AcqCreateItem eq 'ordering') {
|
} elsif ($AcqCreateItem eq 'ordering') {
|
||||||
my $fw = ($acq_fw) ? 'ACQ' : '';
|
my $fw = ($acq_fw) ? 'ACQ' : '';
|
||||||
my $items = $order_object->items;
|
my $items = $order->items;
|
||||||
my @items;
|
$template->param(items => $items);
|
||||||
while ( my $i = $items->next ) {
|
|
||||||
my $item = $i->unblessed;
|
|
||||||
my $descriptions;
|
|
||||||
$descriptions = Koha::AuthorisedValues->get_description_by_koha_field({frameworkcode => $fw, kohafield => 'items.notforloan', authorised_value => $item->{notforloan} });
|
|
||||||
$item->{notforloan} = $descriptions->{lib} // '';
|
|
||||||
|
|
||||||
$descriptions = Koha::AuthorisedValues->get_description_by_koha_field({frameworkcode => $fw, kohafield => 'items.restricted', authorised_value => $item->{restricted} });
|
|
||||||
$item->{restricted} = $descriptions->{lib} // '';
|
|
||||||
|
|
||||||
$descriptions = Koha::AuthorisedValues->get_description_by_koha_field({frameworkcode => $fw, kohafield => 'items.location', authorised_value => $item->{location} });
|
|
||||||
$item->{location} = $descriptions->{lib} // '';
|
|
||||||
|
|
||||||
$descriptions = Koha::AuthorisedValues->get_description_by_koha_field({frameworkcode => $fw, kohafield => 'items.ccode', authorised_value => $item->{ccode} });
|
|
||||||
$item->{collection} = $descriptions->{lib} // '';
|
|
||||||
|
|
||||||
$descriptions = Koha::AuthorisedValues->get_description_by_koha_field({frameworkcode => $fw, kohafield => 'items.materials', authorised_value => $item->{materials} });
|
|
||||||
$item->{materials} = $descriptions->{lib} // '';
|
|
||||||
|
|
||||||
my $itemtype = Koha::ItemTypes->find($i->effective_itemtype);
|
|
||||||
if (defined $itemtype) {
|
|
||||||
# We should not do that here, but call ->itemtype->description when needed instead
|
|
||||||
$item->{itemtype} = $itemtype->description; # FIXME Should not it be translated_description?
|
|
||||||
}
|
|
||||||
push @items, $item;
|
|
||||||
}
|
|
||||||
$template->param(items => \@items);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$order->{quantityreceived} = '' if $order->{quantityreceived} == 0;
|
$order->quantityreceived = '' if $order->quantityreceived == 0;
|
||||||
|
|
||||||
my $unitprice = $order->{unitprice};
|
my $unitprice = $order->unitprice;
|
||||||
my ( $rrp, $ecost );
|
my ( $rrp, $ecost );
|
||||||
if ( $bookseller->invoiceincgst ) {
|
if ( $bookseller->invoiceincgst ) {
|
||||||
$rrp = $order->{rrp_tax_included};
|
$rrp = $order->rrp_tax_included;
|
||||||
$ecost = $order->{ecost_tax_included};
|
$ecost = $order->ecost_tax_included;
|
||||||
unless ( $unitprice != 0 and defined $unitprice) {
|
unless ( $unitprice != 0 and defined $unitprice) {
|
||||||
$unitprice = $order->{ecost_tax_included};
|
$unitprice = $order->ecost_tax_included;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$rrp = $order->{rrp_tax_excluded};
|
$rrp = $order->rrp_tax_excluded;
|
||||||
$ecost = $order->{ecost_tax_excluded};
|
$ecost = $order->ecost_tax_excluded;
|
||||||
unless ( $unitprice != 0 and defined $unitprice) {
|
unless ( $unitprice != 0 and defined $unitprice) {
|
||||||
$unitprice = $order->{ecost_tax_excluded};
|
$unitprice = $order->ecost_tax_excluded;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
my $tax_rate;
|
my $tax_rate;
|
||||||
if( defined $order->{tax_rate_on_receiving} ) {
|
if( defined $order->tax_rate_on_receiving ) {
|
||||||
$tax_rate = $order->{tax_rate_on_receiving} + 0.0;
|
$tax_rate = $order->tax_rate_on_receiving + 0.0;
|
||||||
} else {
|
} else {
|
||||||
$tax_rate = $order->{tax_rate_on_ordering} + 0.0;
|
$tax_rate = $order->tax_rate_on_ordering + 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
my $creator = Koha::Patrons->find( $order->{created_by} );
|
my $creator = Koha::Patrons->find( $order->created_by );
|
||||||
|
|
||||||
my $budget = GetBudget( $order->{budget_id} );
|
my $budget = GetBudget( $order->budget_id );
|
||||||
|
|
||||||
my $datereceived = $order->{datereceived} ? dt_from_string( $order->{datereceived} ) : dt_from_string;
|
my $datereceived = $order->datereceived ? dt_from_string( $order->datereceived ) : dt_from_string;
|
||||||
|
|
||||||
# get option values for gist syspref
|
# get option values for gist syspref
|
||||||
my @gst_values = map {
|
my @gst_values = map {
|
||||||
option => $_ + 0.0
|
option => $_ + 0.0
|
||||||
}, split( '\|', C4::Context->preference("gist") );
|
}, split( '\|', C4::Context->preference("gist") );
|
||||||
|
|
||||||
my $order_internalnote = $order->{order_internalnote};
|
my $order_internalnote = $order->order_internalnote;
|
||||||
my $order_vendornote = $order->{order_vendornote};
|
my $order_vendornote = $order->order_vendornote;
|
||||||
if ( $order->{subscriptionid} ) {
|
if ( $order->subscriptionid ) {
|
||||||
# Order from a subscription, we will display an history of what has been received
|
# Order from a subscription, we will display an history of what has been received
|
||||||
my $orders = Koha::Acquisition::Orders->search(
|
my $orders = Koha::Acquisition::Orders->search(
|
||||||
{
|
{
|
||||||
subscriptionid => $order->{subscriptionid},
|
subscriptionid => $order->subscriptionid,
|
||||||
parent_ordernumber => $order->{ordernumber},
|
parent_ordernumber => $order->ordernumber,
|
||||||
ordernumber => { '!=' => $order->{ordernumber} }
|
ordernumber => { '!=' => $order->ordernumber }
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
if ( $order->{parent_ordernumber} != $order->{ordernumber} ) {
|
if ( $order->parent_ordernumber != $order->ordernumber ) {
|
||||||
my $parent_order = Koha::Acquisition::Orders->find($order->{parent_ordernumber});
|
my $parent_order = Koha::Acquisition::Orders->find($order->parent_ordernumber);
|
||||||
$order_internalnote = $parent_order->{order_internalnote};
|
$order_internalnote = $parent_order->order_internalnote;
|
||||||
$order_vendornote = $parent_order->{order_vendornote};
|
$order_vendornote = $parent_order->order_vendornote;
|
||||||
}
|
}
|
||||||
$template->param(
|
$template->param(
|
||||||
orders => $orders,
|
orders => $orders,
|
||||||
|
@ -220,29 +190,15 @@ if ( $order->{subscriptionid} ) {
|
||||||
$template->param(
|
$template->param(
|
||||||
AcqCreateItem => $AcqCreateItem,
|
AcqCreateItem => $AcqCreateItem,
|
||||||
count => 1,
|
count => 1,
|
||||||
biblionumber => $order->{'biblionumber'},
|
order => $order,
|
||||||
ordernumber => $order->{'ordernumber'},
|
|
||||||
subscriptionid => $order->{subscriptionid},
|
|
||||||
booksellerid => $order->{'booksellerid'},
|
|
||||||
freight => $freight,
|
freight => $freight,
|
||||||
name => $bookseller->name,
|
name => $bookseller->name,
|
||||||
active_currency => $active_currency,
|
active_currency => $active_currency,
|
||||||
currencies => scalar $currencies->search({ rate => { '!=' => 1 } }),
|
currencies => scalar $currencies->search({ rate => { '!=' => 1 } }),
|
||||||
invoiceincgst => $bookseller->invoiceincgst,
|
invoiceincgst => $bookseller->invoiceincgst,
|
||||||
title => $order->{'title'},
|
|
||||||
author => $order->{'author'},
|
|
||||||
copyrightdate => $order->{'copyrightdate'},
|
|
||||||
isbn => $order->{'isbn'},
|
|
||||||
seriestitle => $order->{'seriestitle'},
|
|
||||||
bookfund => $budget->{budget_name},
|
bookfund => $budget->{budget_name},
|
||||||
quantity => $order->{'quantity'},
|
|
||||||
quantityreceivedplus1 => $order->{'quantityreceived'} + 1,
|
|
||||||
quantityreceived => $order->{'quantityreceived'},
|
|
||||||
rrp => $rrp,
|
rrp => $rrp,
|
||||||
replacementprice => $order->{'replacementprice'},
|
|
||||||
ecost => $ecost,
|
ecost => $ecost,
|
||||||
unitprice => $unitprice,
|
|
||||||
tax_rate => $tax_rate,
|
|
||||||
creator => $creator,
|
creator => $creator,
|
||||||
invoiceid => $invoice->{invoiceid},
|
invoiceid => $invoice->{invoiceid},
|
||||||
invoice => $invoice->{invoicenumber},
|
invoice => $invoice->{invoicenumber},
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
[% USE KohaDates %]
|
[% USE KohaDates %]
|
||||||
[% USE Branches %]
|
[% USE Branches %]
|
||||||
[% USE AuthorisedValues %]
|
[% USE AuthorisedValues %]
|
||||||
|
[% USE ItemTypes %]
|
||||||
[% USE Price %]
|
[% USE Price %]
|
||||||
[% SET footerjs = 1 %]
|
[% SET footerjs = 1 %]
|
||||||
[% INCLUDE 'doc-head-open.inc' %]
|
[% INCLUDE 'doc-head-open.inc' %]
|
||||||
|
@ -14,14 +15,14 @@
|
||||||
[% INCLUDE 'header.inc' %]
|
[% INCLUDE 'header.inc' %]
|
||||||
[% INCLUDE 'acquisitions-search.inc' %]
|
[% INCLUDE 'acquisitions-search.inc' %]
|
||||||
|
|
||||||
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> › <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid | html %]">[% name | html %]</a> › Receive items from : [% name | html %] [% IF ( invoice ) %][[% invoice | html %]][% END %] (order #[% ordernumber | html %])</div>
|
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> › <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% order.basket.booksellerid | html %]">[% name | html %]</a> › Receive items from : [% name | html %] [% IF ( invoice ) %][[% invoice | html %]][% END %] (order #[% order.ordernumber | html %])</div>
|
||||||
|
|
||||||
<div class="main container-fluid">
|
<div class="main container-fluid">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-10 col-sm-push-2">
|
<div class="col-sm-10 col-sm-push-2">
|
||||||
<main>
|
<main>
|
||||||
|
|
||||||
<h1>Receive items from : [% name | html %] [% IF ( invoice ) %][[% invoice | html %]] [% END %] (order #[% ordernumber | html %])</h1>
|
<h1>Receive items from : [% name | html %] [% IF ( invoice ) %][[% invoice | html %]] [% END %] (order #[% order.ordernumber | html %])</h1>
|
||||||
|
|
||||||
[% IF ( count ) %]
|
[% IF ( count ) %]
|
||||||
<form action="/cgi-bin/koha/acqui/finishreceive.pl" class="noEnterSubmit" method="post" onsubmit="return Check(this);">
|
<form action="/cgi-bin/koha/acqui/finishreceive.pl" class="noEnterSubmit" method="post" onsubmit="return Check(this);">
|
||||||
|
@ -31,15 +32,15 @@
|
||||||
|
|
||||||
<fieldset class="rows">
|
<fieldset class="rows">
|
||||||
<legend>Catalog details</legend>
|
<legend>Catalog details</legend>
|
||||||
<ol><li><span class="label">Title: </span><span class="title">[% title | html %]</span></li>
|
<ol><li><span class="label">Title: </span><span class="title">[% order.biblio.title | html %]</span></li>
|
||||||
<li> <span class="label">Author: </span>
|
<li> <span class="label">Author: </span>
|
||||||
[% author | html %]</li>
|
[% order.biblio.author | html %]</li>
|
||||||
<li><span class="label">Copyright: </span>
|
<li><span class="label">Copyright: </span>
|
||||||
[% copyrightdate | html %]</li>
|
[% order.biblio.copyrightdate | html %]</li>
|
||||||
<li> <span class="label">ISBN: </span>
|
<li> <span class="label">ISBN: </span>
|
||||||
[% isbn | html %]</li>
|
[% order.biblio.biblioitem.isbn | html %]</li>
|
||||||
<li> <span class="label">Series: </span>
|
<li> <span class="label">Series: </span>
|
||||||
[% seriestitle | html %]</li>
|
[% order.biblio.seriestitle | html %]</li>
|
||||||
</ol>
|
</ol>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
|
@ -85,7 +86,7 @@
|
||||||
</fieldset>
|
</fieldset>
|
||||||
[% END %]
|
[% END %]
|
||||||
|
|
||||||
[% IF subscriptionid and orders.count %]
|
[% IF order.subscriptionid and orders.count %]
|
||||||
<fieldset class="rows">
|
<fieldset class="rows">
|
||||||
<legend>Receipt history for this subscription</legend>
|
<legend>Receipt history for this subscription</legend>
|
||||||
<table id="orders">
|
<table id="orders">
|
||||||
|
@ -169,7 +170,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
[% UNLESS subscriptionid %]
|
[% UNLESS order.subscriptionid %]
|
||||||
<fieldset class="rows" id="itemfieldset">
|
<fieldset class="rows" id="itemfieldset">
|
||||||
<legend>Item</legend>
|
<legend>Item</legend>
|
||||||
[% IF ( NoACQframework ) %]
|
[% IF ( NoACQframework ) %]
|
||||||
|
@ -183,7 +184,7 @@
|
||||||
</fieldset>
|
</fieldset>
|
||||||
[% END %]
|
[% END %]
|
||||||
[% ELSIF (AcqCreateItem == 'ordering') %]
|
[% ELSIF (AcqCreateItem == 'ordering') %]
|
||||||
[% IF (items.size) %]
|
[% IF (items.count) %]
|
||||||
<h5>Items</h5>
|
<h5>Items</h5>
|
||||||
<div style="width:100%;overflow:auto">
|
<div style="width:100%;overflow:auto">
|
||||||
<table>
|
<table>
|
||||||
|
@ -214,15 +215,15 @@
|
||||||
<td>[% item.barcode | html %]</td>
|
<td>[% item.barcode | html %]</td>
|
||||||
<td>[% Branches.GetName( item.homebranch ) | html %]</td>
|
<td>[% Branches.GetName( item.homebranch ) | html %]</td>
|
||||||
<td>[% Branches.GetName( item.holdingbranch ) | html %]</td>
|
<td>[% Branches.GetName( item.holdingbranch ) | html %]</td>
|
||||||
<td>[% item.notforloan | html %]</td>
|
<td>[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.notforloan', authorised_value => item.notforloan ) | html %]</td>
|
||||||
<td>[% item.restricted | html %]</td>
|
<td>[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.restricted', authorised_value => item.restricted ) | html %]</td>
|
||||||
<td><span class="shelvingloc">[% item.location | html %]</span></td>
|
<td><span class="shelvingloc">[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => item.location ) | html %]</span></td>
|
||||||
<td>[% item.itemcallnumber | html %]</td>
|
<td>[% item.itemcallnumber | html %]</td>
|
||||||
<td>[% item.copynumber | html %]</td>
|
<td>[% item.copynumber | html %]</td>
|
||||||
<td>[% item.stocknumber | html %]</td>
|
<td>[% item.stocknumber | html %]</td>
|
||||||
<td>[% item.collection | html %]</td>
|
<td>[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode', authorised_value => item.ccode ) | html %]</td>
|
||||||
<td>[% item.itemtype | html %]</td>
|
<td>[% ItemTypes.GetDescription( item.itype ) | html %]</td>
|
||||||
<td>[% item.materials | html %]</td>
|
<td>[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.materials', authorised_value => item.materials ) | html %]</td>
|
||||||
<td>[% item.itemnotes | html %]</td>
|
<td>[% item.itemnotes | html %]</td>
|
||||||
</tr>
|
</tr>
|
||||||
[% END %]
|
[% END %]
|
||||||
|
@ -231,10 +232,10 @@
|
||||||
</div>
|
</div>
|
||||||
[% END %]
|
[% END %]
|
||||||
[% END %]
|
[% END %]
|
||||||
<input type="hidden" name="biblionumber" value="[% biblionumber | html %]" />
|
<input type="hidden" name="biblionumber" value="[% order.biblionumber | html %]" />
|
||||||
<input type="hidden" name="invoiceid" value="[% invoiceid | html %]" />
|
<input type="hidden" name="invoiceid" value="[% invoiceid | html %]" />
|
||||||
<input type="hidden" name="ordernumber" value="[% ordernumber | html %]" />
|
<input type="hidden" name="ordernumber" value="[% order.ordernumber | html %]" />
|
||||||
<input type="hidden" name="booksellerid" value="[% booksellerid | html %]" />
|
<input type="hidden" name="booksellerid" value="[% order.basket.booksellerid | html %]" />
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
<fieldset class="rows">
|
<fieldset class="rows">
|
||||||
|
@ -245,7 +246,7 @@
|
||||||
<input type="text" size="10" id="datereceived" name="datereceived" value="[% datereceived | $KohaDates %]" class="datepicker" />
|
<input type="text" size="10" id="datereceived" name="datereceived" value="[% datereceived | $KohaDates %]" class="datepicker" />
|
||||||
</li>
|
</li>
|
||||||
<li><label for="bookfund">Fund: </label><select id="bookfund" name="bookfund">
|
<li><label for="bookfund">Fund: </label><select id="bookfund" name="bookfund">
|
||||||
<option value="">Keep current ([% budget_period_description | html %] - [% bookfund | html %])</option>
|
<option value="">Keep current ([% budget_period_description | html %] - [% order.fund.budget_name | html %])</option>
|
||||||
[% FOREACH period IN budget_loop %]
|
[% FOREACH period IN budget_loop %]
|
||||||
<optgroup label="[% period.description | html %]">
|
<optgroup label="[% period.description | html %]">
|
||||||
[% FOREACH fund IN period.funds %]
|
[% FOREACH fund IN period.funds %]
|
||||||
|
@ -266,30 +267,30 @@
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
<li><label for="quantity_to_receive">Quantity ordered: </label><span class="label">
|
<li><label for="quantity_to_receive">Quantity ordered: </label><span class="label">
|
||||||
[% IF edit or subscriptionid %]
|
[% IF edit or order.subscriptionid %]
|
||||||
<input type="text" id="quantity_to_receive" name="quantity" value="[% quantity | html %]" />
|
<input type="text" id="quantity_to_receive" name="quantity" value="[% order.quantity | html %]" />
|
||||||
[% ELSE%]
|
[% ELSE%]
|
||||||
<input type="text" readonly="readonly" id="quantity_to_receive" name="quantity" value="[% quantity | html %]" />
|
<input type="text" readonly="readonly" id="quantity_to_receive" name="quantity" value="[% order.quantity | html %]" />
|
||||||
[% END %]
|
[% END %]
|
||||||
</span></li>
|
</span></li>
|
||||||
<li><label for="quantity">Quantity received: </label>
|
<li><label for="quantity">Quantity received: </label>
|
||||||
[% IF subscriptionid %]
|
[% IF order.subscriptionid %]
|
||||||
<input type="text" size="20" name="quantityrec" id="quantity" value="[% quantity | html %]" />
|
<input type="text" size="20" name="quantityrec" id="quantity" value="[% order.quantity | html %]" />
|
||||||
<input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="[% quantityreceived | html %]" />
|
<input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="[% order.quantityreceived | html %]" />
|
||||||
[% ELSIF AcqCreateItemReceiving %]
|
[% ELSIF AcqCreateItemReceiving %]
|
||||||
<input readonly="readonly" type="text" size="20" name="quantityrec" id="quantity" value="0" />
|
<input readonly="readonly" type="text" size="20" name="quantityrec" id="quantity" value="0" />
|
||||||
[% ELSE %]
|
[% ELSE %]
|
||||||
[% IF ( quantityreceived ) %]
|
[% IF ( order.quantityreceived ) %]
|
||||||
[% IF ( edit ) %]
|
[% IF ( edit ) %]
|
||||||
<input type="text" size="20" name="quantityrec" id="quantity" value="[% quantityreceived | html %]" />
|
<input type="text" size="20" name="quantityrec" id="quantity" value="[% order.quantityreceived | html %]" />
|
||||||
<input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="[% quantityreceived | html %]" />
|
<input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="[% order.quantityreceived | html %]" />
|
||||||
[% ELSE %]
|
[% ELSE %]
|
||||||
[% IF ( items ) %]
|
[% IF ( items ) %]
|
||||||
<input readonly="readonly" type="text" size="20" name="quantityrec" id="quantity" value="[% quantityreceivedplus1 | html %]" />
|
<input readonly="readonly" type="text" size="20" name="quantityrec" id="quantity" value="[% order.quantityreceived + 1 | html %]" />
|
||||||
[% ELSE %]
|
[% ELSE %]
|
||||||
<input type="text" size="20" name="quantityrec" id="quantity" value="[% quantityreceivedplus1 | html %]" />
|
<input type="text" size="20" name="quantityrec" id="quantity" value="[% quantityreceived + 1 | html %]" />
|
||||||
[% END %]
|
[% END %]
|
||||||
<input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="[% quantityreceived | html %]" />
|
<input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="[% order.quantityreceived | html %]" />
|
||||||
[% END %]
|
[% END %]
|
||||||
[% ELSE %]
|
[% ELSE %]
|
||||||
<input type="text" id="quantity" size="20" name="quantityrec" value="1" />
|
<input type="text" id="quantity" size="20" name="quantityrec" value="1" />
|
||||||
|
@ -299,13 +300,14 @@
|
||||||
<p class="error">Warning, you have entered more items than expected.
|
<p class="error">Warning, you have entered more items than expected.
|
||||||
Items will not be created.</p>
|
Items will not be created.</p>
|
||||||
</div>
|
</div>
|
||||||
[% END %][%# IF (subscriptionid) ELSIF (AcqCreateItemReceiving) %]
|
[% END %][%# IF (order.subscriptionid) ELSIF (AcqCreateItemReceiving) %]
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
[% IF ( gst_values ) %]
|
[% IF ( gst_values ) %]
|
||||||
<li>
|
<li>
|
||||||
<label for="tax_rate">Tax rate: </label>
|
<label for="tax_rate">Tax rate: </label>
|
||||||
<select name="tax_rate" id="tax_rate">
|
<select name="tax_rate" id="tax_rate">
|
||||||
|
[% tax_rate = order.tax_rate_on_receiving || order.tax_rate_on_ordering %]
|
||||||
[% FOREACH gst IN gst_values %]
|
[% FOREACH gst IN gst_values %]
|
||||||
[% IF gst.option == tax_rate %]
|
[% IF gst.option == tax_rate %]
|
||||||
<option value="[% gst.option | html %]" selected="selected">[% gst.option * 100 | html %]%</option>
|
<option value="[% gst.option | html %]" selected="selected">[% gst.option * 100 | html %]%</option>
|
||||||
|
@ -319,16 +321,30 @@
|
||||||
<input type="hidden" name="tax_rate" value="0" />
|
<input type="hidden" name="tax_rate" value="0" />
|
||||||
[% END %]
|
[% END %]
|
||||||
|
|
||||||
<li><label for="rrp">Retail price: </label>[% rrp | $Price %] <span class="hint">(adjusted for [% active_currency.currency | html %], [% IF (invoiceincgst == 1) %]tax inclusive[% ELSE %]tax exclusive[% END %])</span></li>
|
<li><label for="rrp">Retail price: </label>
|
||||||
|
[% IF (invoiceincgst == 1) %]
|
||||||
|
[% order.rrp_tax_included | $Price %]<span class="hint">(adjusted for [% active_currency.currency | html %],tax inclusive)</span></li>
|
||||||
|
[% ELSE %]
|
||||||
|
[% order.rrp_tax_excluded | $Price %]<span class="hint">(adjusted for [% active_currency.currency | html %],tax exclusive)</span></li>
|
||||||
|
[% END %]
|
||||||
<li>
|
<li>
|
||||||
<label for="replacementprice">Replacement price:</label>
|
<label for="replacementprice">Replacement price:</label>
|
||||||
<input type="text" size="20" name="replacementprice" id="replacementprice" value="[% replacementprice | $Price on_editing => 1 %]" />
|
<input type="text" size="20" name="replacementprice" id="replacementprice" value="[% order.replacementprice | $Price on_editing => 1 %]" />
|
||||||
</li>
|
</li>
|
||||||
<li><label for="ecost">Budgeted cost: </label>[% ecost | $Price %] <span class="hint">[% IF (invoiceincgst == 1) %](tax inclusive)[% ELSE %](tax exclusive)[% END %]</span></li>
|
<li>
|
||||||
|
[% IF (invoiceincgst) %]
|
||||||
|
<label for="ecost">Budgeted cost: </label>[% order.ecost_tax_included | $Price %] <span class="hint">(tax inclusive)</span>
|
||||||
|
[% ELSE %]
|
||||||
|
<label for="ecost">Budgeted cost: </label>[% order.ecost_tax_excluded | $Price %] <span class="hint">(tax exclusive)</span>
|
||||||
|
[% END %]
|
||||||
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<label for="unitprice">Actual cost:</label>
|
<label for="unitprice">Actual cost:</label>
|
||||||
<input type="text" size="20" name="unitprice" id="unitprice" value="[% unitprice | $Price on_editing => 1 %]" />
|
[% IF (invoiceincgst) %]
|
||||||
<span class="hint">[% IF (invoiceincgst == 1) %](tax inclusive)[% ELSE %](tax exclusive)[% END %]</span>
|
<input type="text" size="20" name="unitprice" id="unitprice" value="[% order.unitprice_tax_included | $Price on_editing => 1 %]" /> <span class="hint">(tax inclusive)</span>
|
||||||
|
[% ELSE %]
|
||||||
|
<input type="text" size="20" name="unitprice" id="unitprice" value="[% order.unitprice_tax_excluded | $Price on_editing => 1 %]" /> <span class="hint">(tax exclusive)</span>
|
||||||
|
[% END %]
|
||||||
<label style="font-weight: inherit; float:none;"><input type="checkbox" name="change_currency">Change currency</label>
|
<label style="font-weight: inherit; float:none;"><input type="checkbox" name="change_currency">Change currency</label>
|
||||||
</li>
|
</li>
|
||||||
<li id="select_currency">
|
<li id="select_currency">
|
||||||
|
@ -464,7 +480,7 @@
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
[% IF (AcqCreateItemReceiving) %]
|
[% IF (AcqCreateItemReceiving) %]
|
||||||
cloneItemBlock(0, '[% UniqueItemFields | html %]');
|
cloneItemBlock(0, '[% UniqueItemFields | html %]');
|
||||||
[% ELSIF (AcqCreateItem == 'ordering') && not subscriptionid %]
|
[% ELSIF (AcqCreateItem == 'ordering') && not order.subscriptionid %]
|
||||||
$("input[name='items_to_receive']").change(function() {
|
$("input[name='items_to_receive']").change(function() {
|
||||||
CalcQtyToReceive();
|
CalcQtyToReceive();
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue