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/sales_order_db.inc 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.*,
cust.name,
cust.curr_code,
cust.address,
loc.location_name,
cust.discount,
stype.sales_type,
stype.id AS sales_type_id,
stype.tax_included,
stype.factor,
ship.shipper_name,
tax_group.name AS tax_group_name,
tax_group.id AS tax_group_id,
cust.tax_id,
sorder.alloc,
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
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 sorder.trans_type = @typ
AND sorder.order_no = @ono;