.TB_PREF."tax_groups.id AS tax_group_id ";
}
- $sql .= " FROM ".TB_PREF."debtor_trans trans, ".TB_PREF."debtors_master cust";
+ $sql .= " FROM ".TB_PREF."debtor_trans trans LEFT JOIN ".TB_PREF."comments com ON trans.type=com.type AND trans.trans_no=com.id
+ LEFT JOIN ".TB_PREF."shippers ON ".TB_PREF."shippers.shipper_id=trans.ship_via,
+ ".TB_PREF."debtors_master cust";
if ($trans_type == ST_CUSTPAYMENT) {
// it's a payment so also get the bank account
if ($trans_type == ST_SALESINVOICE || $trans_type == ST_CUSTCREDIT || $trans_type == ST_CUSTDELIVERY) {
// it's an invoice so also get the shipper, salestypes
- $sql .= ", ".TB_PREF."shippers, "
- .TB_PREF."sales_types, "
+ $sql .= ", ".TB_PREF."sales_types, "
.TB_PREF."cust_branch branch, "
.TB_PREF."tax_groups ";
}
}
if ($trans_type == ST_SALESINVOICE || $trans_type == ST_CUSTCREDIT || $trans_type == ST_CUSTDELIVERY) {
// it's an invoice so also get the shipper
- $sql .= " AND ".TB_PREF."shippers.shipper_id=trans.ship_via
- AND ".TB_PREF."sales_types.id = trans.tpe
+ $sql .= " AND ".TB_PREF."sales_types.id = trans.tpe
AND branch.branch_code = trans.branch_code
AND branch.tax_group_id = ".TB_PREF."tax_groups.id ";
}
."tax_group.name AS tax_group_name , "
."tax_group.id AS tax_group_id, "
."cust.tax_id "
- ."FROM ".TB_PREF."sales_orders sorder, "
+ ."FROM ".TB_PREF."sales_orders sorder LEFT JOIN ".TB_PREF."shippers ship ON ship.shipper_id = sorder.ship_via,"
.TB_PREF."debtors_master cust,"
.TB_PREF."sales_types stype, "
.TB_PREF."tax_groups tax_group, "
.TB_PREF."cust_branch branch,"
- .TB_PREF."locations loc, "
- .TB_PREF."shippers ship
+ .TB_PREF."locations loc
WHERE sorder.order_type=stype.id
AND branch.branch_code = sorder.branch_code
AND branch.tax_group_id = tax_group.id
AND sorder.debtor_no = cust.debtor_no
AND loc.loc_code = sorder.from_stk_loc
- AND ship.shipper_id = sorder.ship_via
AND sorder.trans_type = " . db_escape($trans_type) ."
AND sorder.order_no = " . db_escape($order_no );
$cart->document_date = $_POST['OrderDate'];
$newpayment = false;
+
if (isset($_POST['payment']) && ($cart->payment != $_POST['payment'])) {
$cart->payment = $_POST['payment'];
$cart->payment_terms = get_payment_terms($_POST['payment']);
if ($newpayment) {
$cart->due_date = $cart->document_date;
$cart->phone = $cart->cust_ref = $cart->delivery_address = '';
- $cart->ship_via = 1;
+ $cart->ship_via = 0;
$cart->deliver_to = '';
}
} else {
} else {
display_error($customer_error);
}
+
end_form();
end_page();
?>
\ No newline at end of file