function get_sql_for_sales_orders_view($trans_type, $trans_no, $filter,
$stock_item='', $from='', $to='', $ref='', $location=ALL_TEXT, $customer_id=ALL_TEXT)
{
+ if ($filter=='OutstandingOnly')
+ $order_value = 'Sum(line.unit_price*(line.quantity-line.qty_sent)*(1-line.discount_percent))+freight_cost';
+ else
+ $order_value = 'Sum(line.unit_price*line.quantity*(1-line.discount_percent))+freight_cost';
$sql = "SELECT
sorder.order_no,
."sorder.ord_date,
sorder.delivery_date,
sorder.deliver_to,
- Sum(line.unit_price*line.quantity*(1-line.discount_percent))+freight_cost AS OrderValue,
+ $order_value AS OrderValue,
sorder.type,
debtor.curr_code,
Sum(line.qty_sent) AS TotDelivered,