my $pendingorders = GetPendingOrders($supplierid);
my $countpendings = scalar @$pendingorders;
+# pending orders totals
+my ($totalPunitprice,$totalPquantity,$totalPecost);
+
my @loop_orders = ();
for (my $i=0;$i<$countpendings;$i++){
my %line;
$toggle=0;
}
%line = %{$pendingorders->[$i]};
+ $totalPunitprice += $line{unitprice};
+ $totalPquantity +=$line{quantity};
+ $totalPecost += $line{ecost};
$line{ecost} = sprintf("%.2f",$line{ecost});
$line{unitprice} = sprintf("%.2f",$line{unitprice});
$line{invoice} = $invoice;
$tototal=$tototal+$freight;
$template->param(invoice => $invoice,
- datereceived => $datereceived,
- formatteddatereceived => format_date($datereceived),
- name => $booksellers[0]->{'name'},
- supplierid => $supplierid,
- gst => $gst,
- freight => $freight,
- invoice => $invoice,
- countreceived => $countlines,
- loop_received => \@loop_received,
- countpending => $countpendings,
- loop_orders => \@loop_orders,
- totalprice => $totalprice,
- totalfreight => $totalfreight,
- totalquantity => $totalquantity,
- tototal => $tototal,
- gst => $gst,
- grandtot => $tototal+$gst,
- intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
- intranetstylesheet => C4::Context->preference("intranetstylesheet"),
- IntranetNav => C4::Context->preference("IntranetNav"),
- );
+ datereceived => $datereceived,
+ formatteddatereceived => format_date($datereceived),
+ name => $booksellers[0]->{'name'},
+ supplierid => $supplierid,
+ gst => $gst,
+ freight => $freight,
+ invoice => $invoice,
+ countreceived => $countlines,
+ loop_received => \@loop_received,
+ countpending => $countpendings,
+ loop_orders => \@loop_orders,
+ totalprice => $totalprice,
+ totalfreight => $totalfreight,
+ totalquantity => $totalquantity,
+ tototal => $tototal,
+ gst => $gst,
+ grandtot => $tototal+$gst,
+ totalPunitprice => sprintf("%.2f",$totalPunitprice),
+ totalPquantity => $totalPquantity,
+ totalPecost => sprintf("%.2f",$totalPecost),
+ );
output_html_with_http_headers $input, $cookie, $template->output;
<tr>
<th>BASKET</th>
<th>Summary</th>
- <th>Est. Cost</th>
- <th>P&P</th>
- <th>QTY Ordered</th>
- <th>QTY</th>
- <th>TOTAL</th>
+ <th>Order qty</th>
+ <th>Order cost</th>
+ <th>Recieved qty</th>
+ <th>Recieved cost</th>
</tr>
<!-- TMPL_LOOP NAME="loop_orders" -->
<tr>
<!-- TMPL_IF NAME="author" --><br />author :<!-- TMPL_VAR NAME="author" --><!--/TMPL_IF-->
<!-- TMPL_IF NAME="publishercode" --><br />Publisher :<!-- TMPL_VAR NAME="publishercode" --><!--/TMPL_IF-->
</td>
- <td><!-- TMPL_VAR NAME="unitprice" --></td>
- <td></td>
<td><!-- TMPL_VAR NAME="quantity" --></td>
- <td><!-- TMPL_VAR NAME="quantityreceived" --></td>
<td><!-- TMPL_VAR NAME="ecost" --></td>
+ <td><!-- TMPL_VAR NAME="quantityreceived" --></td>
+ <td><!-- TMPL_IF EXPR="unitprice ne '0.00'" --><!-- TMPL_VAR NAME="unitprice" --><!-- /TMPL_IF --></td>
</tr>
<!-- /TMPL_LOOP -->
+ <tr>
+ <th colspan="2">TOTAL</th>
+ <th><!-- TMPL_VAR NAME="totalPquantity" --></th>
+ <th><!-- TMPL_VAR NAME="totalPecost" --></th>
+ <th><!-- TMPL_VAR NAME="quantityreceived" --></th>
+ <th><!-- TMPL_VAR NAME="totalPunitprice" --></th>
+ </tr>
</table>
</div>
</div>