Topic: Print Sales Orders

it seems there is a bug when trying to Generate "Print Sales Orders" ID 109.
if you select to print just 1 sale order.. like the last sales order it works.. but if you select a range of sales order "multiple sales order"  like 2 or more than one sale order then you get a white pdf.

i could produce this on the demo FA website.

Re: Print Sales Orders

You know that the records are presented in falling order. Last first in both combo boxes. Are you sure that you got the sequence right?


3 (edited by Alaa 01/13/2018 12:41:27 pm)

Re: Print Sales Orders

in my old FA installation 2.4 beta i used to select the latest (newest) invoice in the "from" drop down and the 1st issued invoice (oldest) in the "to" .. it used to work..

now when i try it in 2.4.3 i get white pdf.. but if i do it the other way by selecting the oldest invoice in the "From" and the newest in the "to" .. the report is generated successfully, but i get the following errors
You have missing or invalid sales document in database (type:30, number:28).
You have missing or invalid sales document in database (type:30, number:29).
You have missing or invalid sales document in database (type:30, number:38).
You have missing or invalid sales document in database (type:30, number:71).
You have missing or invalid sales document in database (type:30, number:82).
You have missing or invalid sales document in database (type:30, number:462).

Post's attachments

PrtSO_MissingSalesDoc.png 54.8 kb, file has never been downloaded. 

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

Re: Print Sales Orders

I have no problems selecting and printing sales orders.

In the first combobox select the lowest ref number you want.
In the second combobox select the highest ref you want.

There might be some problems selecting the auto references created from direct deliveries and direct invoices, however these might not be very interesting.

In the Sales Order Inquiry you can easily print the auto referenced.


Re: Print Sales Orders

There is a problem with the new pattern for references if it straddles fiscal years. See here.

Re: Print Sales Orders

Follow @joe's instructions by choosing the smaller number in "From" and larger Number in "To".

If the problem still occurs in your installation, then troubleshoot as below.

The function get_sales_order_header() in sales/includes/db/ is where this error emanates.
It is possible that the database may be missing some records.
Try this set of SQLs (with your table prefixes - set as 1_ here in 9 places) for each of the error pairs of type and order number in phpMyAdmin or any MySQL client:

SET @typ = 30;
SET @ono = 28; -- test with 29, 38, 71, 82 and 462 where the error occurs as well

SELECT sorder.*,,
      stype.sales_type, AS sales_type_id,
       ship.shipper_name, AS tax_group_name, AS tax_group_id,
      IFNULL(allocs.ord_allocs, 0)+IFNULL(inv.inv_allocs ,0) AS sum_paid,
      sorder.prep_amount>0 AS prepaid
    FROM 1_sales_orders sorder
            LEFT JOIN (SELECT trans_no_to, SUM(amt) ord_allocs FROM 1_cust_allocations
                WHERE trans_type_to=30 AND trans_no_to=@ono GROUP BY trans_no_to)
                 allocs ON sorder.trans_type=30 AND allocs.trans_no_to=sorder.order_no
            LEFT JOIN (SELECT order_, SUM(alloc) inv_allocs FROM 1_debtor_trans 
                WHERE TYPE=10 AND order_=@ono  GROUP BY order_)
                 inv ON sorder.trans_type=30 AND inv.order_=sorder.order_no
            LEFT JOIN 1_shippers ship ON  ship.shipper_id = sorder.ship_via,
      1_debtors_master cust,
      1_sales_types stype, 
      1_tax_groups tax_group, 
      1_cust_branch branch,
      1_locations loc
        AND branch.branch_code = sorder.branch_code
        AND branch.tax_group_id =
        AND sorder.debtor_no = cust.debtor_no
        AND loc.loc_code = sorder.from_stk_loc
        AND sorder.trans_type = @typ
        AND sorder.order_no = @ono;