-
-$totalfreight=$freight;
-$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"),
- );
+$freight = $totalfreight unless $freight;
+
+#$totalfreight=$freight;
+$tototal = $tototal + $freight;
+
+$template->param(
+ invoice => $invoice,
+ datereceived => $datereceived->output('iso'),
+ invoicedatereceived => $datereceived->output('iso'),
+ formatteddatereceived => $datereceived->output(),
+ name => $bookseller->{'name'},
+ supplierid => $supplierid,
+ gst => $gst,
+ freight => $freight,
+ invoice => $invoice,
+ countreceived => $countlines,
+ loop_received => \@loop_received,
+ countpending => $countpendings,
+ loop_orders => \@loop_orders,
+ totalprice => sprintf($cfstr, $totalprice),
+ totalfreight => $totalfreight,
+ totalquantity => $totalquantity,
+ tototal => sprintf($cfstr, $tototal),
+ ordergrandtotal => sprintf($cfstr, $ordergrandtotal),
+ gst => $gst,
+ grandtot => sprintf($cfstr, $tototal + $gst),
+ totalPunitprice => sprintf("%.2f", $totalPunitprice),
+ totalPquantity => $totalPquantity,
+ totalPqtyrcvd => $totalPqtyrcvd,
+ totalPecost => sprintf("%.2f", $totalPecost),
+);