Added POS and cash sale support.
[fa-stable.git] / sales / includes / db / sales_order_db.inc
index 0e51a907dcb748a7375737625400aecd2a8b09b0..25e39abf579fb66c7da65065ffd856a96d810421 100644 (file)
@@ -60,7 +60,7 @@ function add_sales_order(&$order)
                        db_escape($order->Comments) .",'" . 
                        date2sql($order->document_date) . "', " .
                        db_escape($order->sales_type) . ", " .
-                       $_POST['ship_via'] ."," . 
+                       db_escape($order->ship_via)."," . 
                        db_escape($order->deliver_to) . "," .
                        db_escape($order->delivery_address) . ", " .
                        db_escape($order->phone) . ", " . 
@@ -362,7 +362,8 @@ function read_sales_order($order_no, &$order)
        $order->set_branch($myrow["branch_code"], $myrow["tax_group_id"],
          $myrow["tax_group_name"], $myrow["contact_phone"], $myrow["contact_email"]);
 
-       $order->set_sales_type($myrow["sales_type_id"], $myrow["sales_type"], $myrow["tax_included"]);
+       $order->set_sales_type($myrow["sales_type_id"], $myrow["sales_type"], 
+           $myrow["tax_included"], 0); // no default price calculations on edit
 
        $order->set_location($myrow["from_stk_loc"], $myrow["location_name"]);
 
@@ -451,8 +452,10 @@ function get_customer_to_order($customer_id) {
                  .TB_PREF."debtors_master.sales_type AS salestype, "
                  .TB_PREF."sales_types.sales_type, "
                  .TB_PREF."sales_types.tax_included, "
+                 .TB_PREF."sales_types.factor, "
                  .TB_PREF."debtors_master.curr_code, "
-                 .TB_PREF."debtors_master.discount
+                 .TB_PREF."debtors_master.discount,"
+                 .TB_PREF."debtors_master.pymt_discount
                FROM ".TB_PREF."debtors_master, "
                  .TB_PREF."credit_status, "
                  .TB_PREF."sales_types