|
Lines 78-138
my $invoice=$input->param('invoice') || '';
Link Here
|
| 78 |
my $freight=$input->param('freight'); |
78 |
my $freight=$input->param('freight'); |
| 79 |
my $input_gst = ($input->param('gst') eq '' ? undef : $input->param('gst')); |
79 |
my $input_gst = ($input->param('gst') eq '' ? undef : $input->param('gst')); |
| 80 |
my $gst= $input_gst // $bookseller->{gstrate} // C4::Context->preference("gist") // 0; |
80 |
my $gst= $input_gst // $bookseller->{gstrate} // C4::Context->preference("gist") // 0; |
| 81 |
my $datereceived = ($input->param('op') eq 'new') ? C4::Dates->new($input->param('datereceived')) |
81 |
my $datereceived = ($input->param('op') eq ('new' or "search")) ? C4::Dates->new($input->param('datereceived')) |
| 82 |
: C4::Dates->new($input->param('datereceived'), 'iso') ; |
82 |
: C4::Dates->new($input->param('datereceived'), 'iso'); |
| 83 |
$datereceived = C4::Dates->new() unless $datereceived; |
83 |
$datereceived = C4::Dates->new() unless $datereceived; |
| 84 |
my $code = $input->param('code'); |
84 |
my $code = $input->param('code'); |
| 85 |
my @rcv_err = $input->param('error'); |
85 |
my @rcv_err = $input->param('error'); |
| 86 |
my @rcv_err_barcode = $input->param('error_bc'); |
86 |
my @rcv_err_barcode = $input->param('error_bc'); |
| 87 |
|
|
|
| 88 |
my $startfrom=$input->param('startfrom'); |
87 |
my $startfrom=$input->param('startfrom'); |
| 89 |
my $resultsperpage = $input->param('resultsperpage'); |
88 |
my $resultsperpage = $input->param('resultsperpage'); |
| 90 |
$resultsperpage = 20 unless ($resultsperpage); |
89 |
$resultsperpage = 20 unless ($resultsperpage); |
| 91 |
$startfrom=0 unless ($startfrom); |
90 |
$startfrom=0 unless ($startfrom); |
| 92 |
|
91 |
|
| 93 |
if($input->param('format') eq "json"){ |
|
|
| 94 |
my ($template, $loggedinuser, $cookie) |
| 95 |
= get_template_and_user({template_name => "acqui/ajax.tmpl", |
| 96 |
query => $input, |
| 97 |
type => "intranet", |
| 98 |
authnotrequired => 0, |
| 99 |
flagsrequired => {acquisition => 'order_receive'}, |
| 100 |
debug => 1, |
| 101 |
}); |
| 102 |
|
| 103 |
my @datas; |
| 104 |
my $search = $input->param('search') || ''; |
| 105 |
my $ean = $input->param('ean') || ''; |
| 106 |
my $supplier = $input->param('booksellerid') || ''; |
| 107 |
my $basketno = $input->param('basketno') || ''; |
| 108 |
my $orderno = $input->param('orderno') || ''; |
| 109 |
|
| 110 |
my $orders = SearchOrder($orderno, $search, $ean, $supplier, $basketno); |
| 111 |
foreach my $order (@$orders) { |
| 112 |
if ( $order->{quantityreceived} < $order->{quantity} ) { |
| 113 |
my $data = {}; |
| 114 |
|
| 115 |
$data->{basketno} = $order->{basketno}; |
| 116 |
$data->{ordernumber} = $order->{ordernumber}; |
| 117 |
$data->{title} = $order->{title}; |
| 118 |
$data->{author} = $order->{author}; |
| 119 |
$data->{isbn} = $order->{isbn}; |
| 120 |
$data->{booksellerid} = $order->{booksellerid}; |
| 121 |
$data->{biblionumber} = $order->{biblionumber}; |
| 122 |
$data->{freight} = $order->{freight}; |
| 123 |
$data->{quantity} = $order->{quantity}; |
| 124 |
$data->{ecost} = $order->{ecost}; |
| 125 |
$data->{ordertotal} = sprintf("%.2f",$order->{ecost}*$order->{quantity}); |
| 126 |
push @datas, $data; |
| 127 |
} |
| 128 |
} |
| 129 |
|
| 130 |
my $json_text = to_json(\@datas); |
| 131 |
$template->param(return => $json_text); |
| 132 |
output_html_with_http_headers $input, $cookie, $template->output; |
| 133 |
exit; |
| 134 |
} |
| 135 |
|
| 136 |
my ($template, $loggedinuser, $cookie) |
92 |
my ($template, $loggedinuser, $cookie) |
| 137 |
= get_template_and_user({template_name => "acqui/parcel.tmpl", |
93 |
= get_template_and_user({template_name => "acqui/parcel.tmpl", |
| 138 |
query => $input, |
94 |
query => $input, |
|
Lines 196-202
for (my $i = 0 ; $i < $countlines ; $i++) {
Link Here
|
| 196 |
$tototal += $total; |
152 |
$tototal += $total; |
| 197 |
} |
153 |
} |
| 198 |
|
154 |
|
| 199 |
my $pendingorders = GetPendingOrders($booksellerid); |
155 |
# We get the pending orders either all or filtered |
|
|
156 |
my $pendingorders; |
| 157 |
if($input->param('op') eq "search"){ |
| 158 |
my $search = $input->param('summaryfilter') || ''; |
| 159 |
my $ean = $input->param('eanfilter') || ''; |
| 160 |
my $basketno = $input->param('basketfilter') || ''; |
| 161 |
my $orderno = $input->param('orderfilter') || ''; |
| 162 |
$pendingorders = GetPendingOrders($booksellerid,$orderno,$search,$ean,$basketno); |
| 163 |
}else{ |
| 164 |
$pendingorders = GetPendingOrders($booksellerid); |
| 165 |
} |
| 200 |
my $countpendings = scalar @$pendingorders; |
166 |
my $countpendings = scalar @$pendingorders; |
| 201 |
|
167 |
|
| 202 |
# pending orders totals |
168 |
# pending orders totals |
|
Lines 252-258
for (my $i = 0 ; $i < $countpendings ; $i++) {
Link Here
|
| 252 |
$line{left_subscription} = 1 if scalar @subscriptions >= 1; |
218 |
$line{left_subscription} = 1 if scalar @subscriptions >= 1; |
| 253 |
$line{subscriptions} = scalar @subscriptions; |
219 |
$line{subscriptions} = scalar @subscriptions; |
| 254 |
$line{left_holds} = 1 if $holds >= 1; |
220 |
$line{left_holds} = 1 if $holds >= 1; |
| 255 |
$line{left_holds_on_order} = 1 if $line{left_holds}==1 && ($line{items} == 0 || $itemholds ); |
221 |
$line{left_holds_on_order} = 1 if $line{left_holds} == 1 && ($line{items} == 0 || $itemholds ); |
| 256 |
$line{holds} = $holds; |
222 |
$line{holds} = $holds; |
| 257 |
$line{holds_on_order} = $itemholds?$itemholds:$holds if $line{left_holds_on_order}; |
223 |
$line{holds_on_order} = $itemholds?$itemholds:$holds if $line{left_holds_on_order}; |
| 258 |
|
224 |
|
|
Lines 260-266
for (my $i = 0 ; $i < $countpendings ; $i++) {
Link Here
|
| 260 |
push @loop_orders, \%line if ($i >= $startfrom and $i < $startfrom + $resultsperpage); |
226 |
push @loop_orders, \%line if ($i >= $startfrom and $i < $startfrom + $resultsperpage); |
| 261 |
} |
227 |
} |
| 262 |
$freight = $totalfreight unless $freight; |
228 |
$freight = $totalfreight unless $freight; |
| 263 |
|
|
|
| 264 |
my $count = $countpendings; |
229 |
my $count = $countpendings; |
| 265 |
|
230 |
|
| 266 |
if ($count>$resultsperpage){ |
231 |
if ($count>$resultsperpage){ |