Minor change in class.graphic.inc
[fa-stable.git] / sales / customer_invoice.php
index fbffe054897a1675e3d7fff3e3f11adbacf6db0c..560ea687c582334bba89c7bde5a0acb015346d4c 100644 (file)
@@ -159,14 +159,12 @@ if (isset($_POST['Update'])) {
        $Ajax->activate('Items');
 }
 if (isset($_POST['_InvoiceDate_changed'])) {
-       $_POST['due_date'] = get_invoice_duedate($_SESSION['Items']->payment, 
-               $_POST['InvoiceDate']);
+       $_POST['due_date'] = get_invoice_duedate($_SESSION['Items']->payment, $_POST['InvoiceDate']);
        $Ajax->activate('due_date');
 }
 if (list_updated('payment')) {
        $_SESSION['Items']->payment = get_post('payment');
-       $_POST['due_date'] = get_invoice_duedate($_SESSION['Items']->payment, 
-               $_POST['InvoiceDate']);
+       $_POST['due_date'] = get_invoice_duedate($_SESSION['Items']->payment, $_POST['InvoiceDate']);
        $Ajax->activate('due_date');
 }
 
@@ -228,7 +226,7 @@ function copy_to_cart()
        $cart->freight_cost = input_num('ChargeFreightCost');
        $cart->document_date =  $_POST['InvoiceDate'];
        $cart->due_date =  $_POST['due_date'];
-       if ($cart->pos != -1) {
+       if ($cart->pos['cash_sale'] || $cart->pos['credit_sale']) {
                $cart->payment = $_POST['payment'];
                $cart->payment_terms = get_payment_terms($_POST['payment']);
        }
@@ -362,9 +360,21 @@ hidden('cart_id');
 start_table(TABLESTYLE2, "width=80%", 5);
 
 start_row();
+$colspan = 1;
+$dim = get_company_pref('use_dimension');
+if ($dim > 0) 
+       $colspan = 3;
 label_cells(_("Customer"), $_SESSION['Items']->customer_name, "class='tableheader2'");
 label_cells(_("Branch"), get_branch_name($_SESSION['Items']->Branch), "class='tableheader2'");
-label_cells(_("Currency"), $_SESSION['Items']->customer_currency, "class='tableheader2'");
+if ($_SESSION['Items']->pos['credit_sale'] || $_SESSION['Items']->pos['cash_sale']) {
+ // editable payment type
+       $paymcat = !$_SESSION['Items']->pos['cash_sale'] ? PM_CREDIT :
+               (!$_SESSION['Items']->pos['credit_sale'] ? PM_CASH : PM_ANY);
+       label_cells(_("Payment terms:"), sale_payment_list('payment', $paymcat),
+               "class='tableheader2'", "colspan=$colspan");
+} else
+       label_cells(_('Payment:'), $_SESSION['Items']->payment_terms['terms'], "class='tableheader2'", "colspan=$colspan");
+
 end_row();
 start_row();
 
@@ -379,10 +389,10 @@ if ($_SESSION['Items']->trans_no == 0) {
 
 label_cells(_("Sales Type"), $_SESSION['Items']->sales_type_name, "class='tableheader2'");
 
-if ($_SESSION['Items']->pos != -1) // editable payment type
-       label_cells(_("Payment terms:"), sale_payment_list('payment'), "class='tableheader2'");
-else
-       label_cells(_('Payment:'), $_SESSION['Items']->payment_terms['terms'], "class='tableheader2'");
+label_cells(_("Currency"), $_SESSION['Items']->customer_currency, "class='tableheader2'");
+// 2010-09-03 Joe Hunt
+if ($dim > 0) 
+       label_cells(_("Dimension"), get_dimension_string($_SESSION['Items']->dimension_id), "class='tableheader2'");
 
 end_row();
 start_row();
@@ -408,6 +418,10 @@ if (!isset($_POST['due_date']) || !is_date($_POST['due_date'])) {
 }
 
 date_cells(_("Due Date"), 'due_date', '', null, 0, 0, 0, "class='tableheader2'");
+if ($dim > 1) 
+       label_cells(_("Dimension"). " 2", get_dimension_string($_SESSION['Items']->dimension2_id), "class='tableheader2'");
+else if ($dim > 0)
+       label_cell(" ", "colspan=2");
 
 end_row();
 end_table();