Merged changes from main trunk 2.2.1-2.2.2
[fa-stable.git] / sales / customer_delivery.php
index 26bd6eeccde8dd9dcc4790094ddf4556824c55c8..cd7299a8d18d96c807129f913ce453edc8161f82 100644 (file)
@@ -35,10 +35,10 @@ if ($use_date_picker) {
 
 if (isset($_GET['ModifyDelivery'])) {
        $_SESSION['page_title'] = sprintf(_("Modifying Delivery Note # %d."), $_GET['ModifyDelivery']);
-       $help_page_title = _("Modifying Delivery Note");
+       $help_context = "Modifying Delivery Note";
        processing_start();
 } elseif (isset($_GET['OrderNumber'])) {
-       $_SESSION['page_title'] = _("Deliver Items for a Sales Order");
+       $_SESSION['page_title'] = _($help_context = "Deliver Items for a Sales Order");
        processing_start();
 }
 
@@ -136,9 +136,10 @@ if (isset($_GET['OrderNumber']) && $_GET['OrderNumber'] > 0) {
        if (!check_quantities()) {
                display_error(_("Selected quantity cannot be less than quantity invoiced nor more than quantity not dispatched on sales order."));
 
-       } elseif(!check_num('ChargeFreightCost', 0))
+       } elseif(!check_num('ChargeFreightCost', 0)) {
                display_error(_("Freight cost cannot be less than zero"));
                set_focus('ChargeFreightCost');
+       }
 }
 
 //-----------------------------------------------------------------------------
@@ -194,8 +195,6 @@ function check_data()
        }
 
        if (!check_quantities()) {
-               display_error(_("Selected quantity cannot be less than quantity invoiced nor more than quantity
-               not dispatched on sales order."));
                return false;
        }
 
@@ -212,7 +211,7 @@ function copy_to_cart()
        $cart->Location = $_POST['Location'];
        $cart->Comments = $_POST['Comments'];
        if ($cart->trans_no == 0)
-               $dn->ref = $_POST['ref'];
+               $cart->reference = $_POST['ref'];
 
 }
 //------------------------------------------------------------------------------
@@ -395,8 +394,12 @@ if ($row['dissallow_invoices'] == 1)
 display_heading(_("Delivery Items"));
 div_start('Items');
 start_table("$table_style width=80%");
-$th = array(_("Item Code"), _("Item Description"), _("Ordered"), _("Units"), _("Delivered"),
+
+$new = $_SESSION['Items']->trans_no==0;
+$th = array(_("Item Code"), _("Item Description"), 
+       $new ? _("Ordered") : _("Max. delivery"), _("Units"), $new ? _("Delivered") : _("Invoiced"),
        _("This Delivery"), _("Price"), _("Tax Type"), _("Discount"), _("Total"));
+
 table_header($th);
 $k = 0;
 $has_marked = false;
@@ -448,22 +451,25 @@ foreach ($_SESSION['Items']->line_items as $line=>$ln_itm) {
 $_POST['ChargeFreightCost'] =  get_post('ChargeFreightCost', 
        price_format($_SESSION['Items']->freight_cost));
 
-start_row();
+$colspan = 9;
 
-small_amount_cells(_("Shipping Cost"), 'ChargeFreightCost', $_SESSION['Items']->freight_cost, "colspan=9 align=right");
+start_row();
+label_cell(_("Shipping Cost"), "colspan=$colspan align=right");
+small_amount_cells(null, 'ChargeFreightCost', $_SESSION['Items']->freight_cost);
+end_row();
 
 $inv_items_total = $_SESSION['Items']->get_items_total_dispatch();
 
 $display_sub_total = price_format($inv_items_total + input_num('ChargeFreightCost'));
 
-label_row(_("Sub-total"), $display_sub_total, "colspan=9 align=right","align=right");
+label_row(_("Sub-total"), $display_sub_total, "colspan=$colspan align=right","align=right");
 
 $taxes = $_SESSION['Items']->get_taxes(input_num('ChargeFreightCost'));
-$tax_total = display_edit_tax_items($taxes, 9, $_SESSION['Items']->tax_included);
+$tax_total = display_edit_tax_items($taxes, $colspan, $_SESSION['Items']->tax_included);
 
 $display_total = price_format(($inv_items_total + input_num('ChargeFreightCost') + $tax_total));
 
-label_row(_("Amount Total"), $display_total, "colspan=9 align=right","align=right");
+label_row(_("Amount Total"), $display_total, "colspan=$colspan align=right","align=right");
 
 end_table(1);