Topic: Salesman Listing Report 106 - Fix

Salesman Listing Report 106

while fetching salesman listing report current sql query is conflicting with order_no displaying mismatch data. I have fix this adding AND sorder.trans_type = 30 to correct this issue.

    $sql = "SELECT DISTINCT trans.*,
            ov_amount+ov_discount AS InvoiceTotal,
            cust.name AS DebtorName,
            cust.curr_code,
            branch.br_name,
            sorder.customer_ref,
            salesman.*
        FROM ".TB_PREF."debtor_trans trans,
             ".TB_PREF."debtors_master cust,
             ".TB_PREF."sales_orders sorder,
             ".TB_PREF."cust_branch branch,
            ".TB_PREF."salesman salesman
        WHERE sorder.order_no=trans.order_
            AND trans.branch_code=branch.branch_code
            AND sorder.trans_type = 30
            AND branch.salesman=salesman.salesman_code
            AND trans.debtor_no=cust.debtor_no
            AND (trans.type=".ST_SALESINVOICE." OR trans.type=".ST_CUSTCREDIT.")
            AND trans.tran_date>='$fromdate'
            AND trans.tran_date<='$todate'
        ORDER BY salesman.salesman_code, trans.tran_date";

Mohsin Mujawar
Impulse Solutions

Re: Salesman Listing Report 106 - Fix

Thanks, will have a look at this.

Joe

Re: Salesman Listing Report 106 - Fix

@joe committed it.