$line->discount_percent)";
db_query($sql, "order Details Cannot be Added");
+ // Now mark quotation line as processed
+ if ($order->trans_type == ST_SALESORDER && $line->src_id)
+ update_parent_line(ST_SALESORDER, $line->src_id, $line->qty_dispatched); // clear all the quote despite all or the part was ordered
} /* inserted line items into sales order details */
-
add_audit_trail($order->trans_type, $order_no, $order->document_date);
$Refs->save($order->trans_type, $order_no, $order->reference);
." AND sorder.ord_date <= '$date_before'";
}
if ($trans_type == ST_SALESQUOTE && !check_value('show_all'))
- $sql .= " AND sorder.delivery_date >= '".date2sql(Today())."'";
+ $sql .= " AND sorder.delivery_date >= '".date2sql(Today())."' AND line.qty_sent=0"; // show only outstanding, not realized quotes
+
if ($selected_customer != -1)
$sql .= " AND sorder.debtor_no=".db_escape($selected_customer);
if ($_POST['order_view_mode']=='OutstandingOnly')
$sql .= " AND line.qty_sent < line.quantity";
+
elseif ($_POST['order_view_mode']=='InvoiceTemplates' || $_POST['order_view_mode']=='DeliveryTemplates')
$sql .= " AND sorder.type=1";
$qty_dispatched = (float)$qty_dispatched;
// echo "update line: $line_id, $doc_type, $qty_dispatched";
- if ($doc_type==0)
+ if ($doc_type == 0)
return false;
else {
- if ($doc_type==ST_SALESORDER)
+ if ($doc_type==ST_SALESORDER || $doc_type==ST_SALESQUOTE)
{
$sql = "UPDATE ".TB_PREF."sales_order_details
SET qty_sent = qty_sent + $qty_dispatched";
if ($auto)
$sql .= ", quantity = quantity + $qty_dispatched";
$sql .= " WHERE id=".db_escape($line_id);
- }
+ }
else
$sql = "UPDATE ".TB_PREF."debtor_trans_details
SET qty_done = qty_done + $qty_dispatched