Topic: Sales Order Inquiry -- Wrong Figure

When we check the Delivery Against Sales Order Inquiry View, it shows the Order Total Value for the Value of the order that is still not delivered. But there is still an anomaly there.

In the attached image you can find that there was big order and all delivered except for one item.

That items total value in the order is 108,000.

Undelivered is 5 out of 6.

The inquiry page shall show the amount 90,000 but it is showing 108,000.

If this is a bug then need a fix. Or if I am mis interpreting it then please let me know.

Post's attachments

sales order.png 137 kb, file has never been downloaded. 

You don't have the permssions to download the attachments of this post.

Re: Sales Order Inquiry -- Wrong Figure

There we are showing the order total. Not the total of outstanding. If required. You can add one more column and show the difference in separate like outstanding. Or yet to deliver.  Hope that's the way to solve it

Re: Sales Order Inquiry -- Wrong Figure

No, If we go through Menu Sales Order Inquiry then it shows Order Total.

But if we go through Menu Delivery Against Sales Order then it is supposed to show the Total of Outstanding.

In the above case I mentioned Delivery Against Sales Order is not showing the Total of Outstanding correctly.

The Order was big and all items are fully delivered except for one that I highlighted.

The system shall show the Total Outstanding as 90,000 (5 * 18000)  but it is showing 108,000 (6 * 18,000).


Re: Sales Order Inquiry -- Wrong Figure

Ok  that's fine. I got your point now. It's simple dude. You can do this easily by taking the items difference with quantity and qty_sent from sales order.

Re: Sales Order Inquiry -- Wrong Figure

@joe: need this fix?

Re: Sales Order Inquiry -- Wrong Figure

Fix is here.

Change the lines of the function get_sql_for_sales_order_view() as follows

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 AS OrderValue,';
        $order_value = 'Sum(line.unit_price*line.quantity*(1-line.discount_percent))+freight_cost AS OrderValue,';

    $sql = "SELECT
                || $filter=='DeliveryTemplates' ?
             "sorder.comments, " : "sorder.customer_ref, ")
            Sum(line.qty_sent) AS TotDelivered,
            Sum(line.quantity) AS TotQuantity,
            Sum(line.invoiced) AS TotInvoiced,

Re: Sales Order Inquiry -- Wrong Figure

I will have a look at this.


Re: Sales Order Inquiry -- Wrong Figure

This has now been fixed. Committed to Stable repo 2.4.8.

The fixed file can be downloaded here. Please replace.

Thanks for reporting this.