Code cleanup.
[fa-stable.git] / sales / customer_delivery.php
index 8365cc819a4e1bc0f2cb77fc6af1e61d59247d9e..3c275dbbf9aeeab2ce0148491699d1633209fea0 100644 (file)
@@ -36,7 +36,6 @@ page($_SESSION['page_title'], false, false, "", $js);
 
 if (isset($_GET['AddedID'])) {
        $dispatch_no = $_GET['AddedID'];
-       print_hidden_script(13);
 
        display_notification(_("Dispatch processed:") . ' '.$_GET['AddedID'], true);
 
@@ -55,7 +54,6 @@ if (isset($_GET['AddedID'])) {
 } elseif (isset($_GET['UpdatedID'])) {
 
        $delivery_no = $_GET['UpdatedID'];
-       print_hidden_script(13);
 
        display_notification_centered(sprintf(_('Delivery Note # %d has been updated.'),$delivery_no));
 
@@ -88,6 +86,7 @@ if (isset($_GET['OrderNumber']) && $_GET['OrderNumber'] > 0) {
        $ord->order_no = key($ord->trans_no);
        $ord->trans_no = 0;
        $ord->reference = references::get_next(13);
+       $ord->document_date = Today();
        $_SESSION['Items'] = $ord;
        copy_from_cart();
 
@@ -367,13 +366,13 @@ $th = array(_("Item Code"), _("Item Description"), _("Ordered"), _("Units"), _("
 table_header($th);
 $k = 0;
 $has_marked = false;
-$show_qoh = true;
 
 foreach ($_SESSION['Items']->line_items as $line=>$ln_itm) {
        if ($ln_itm->quantity==$ln_itm->qty_done) {
                continue; //this line is fully delivered
        }
        // if it's a non-stock item (eg. service) don't show qoh
+       $show_qoh = true;
        if (sys_prefs::allow_negative_stock() || !has_stock_holding($ln_itm->mb_flag) ||
                $ln_itm->qty_dispatched == 0) {
                $show_qoh = false;
@@ -412,11 +411,8 @@ foreach ($_SESSION['Items']->line_items as $line=>$ln_itm) {
        end_row();
 }
 
-$_POST['ChargeFreightCost'] = price_format($_SESSION['Items']->freight_cost);
-
-if (!check_num('ChargeFreightCost')) {
-               $_POST['ChargeFreightCost'] = price_format(0);
-}
+$_POST['ChargeFreightCost'] =  get_post('ChargeFreightCost', 
+       price_format($_SESSION['Items']->freight_cost));
 
 start_row();