- concat(trans.$ref, IF(type=".ST_BANKPAYMENT.", ' $BP ', IF(type=".ST_SUPPAYMENT.", ' $SP ', ' $CN ')), supplier.supp_name) as IName
- FROM ".TB_PREF."suppliers supplier, "
- .TB_PREF."supp_trans trans
- WHERE type IN(".ST_BANKPAYMENT.",".ST_SUPPAYMENT.",".ST_SUPPCREDIT.")
- AND supplier.supplier_id=trans.supplier_id
- ORDER BY trans.trans_no DESC";
+ concat(trans.$ref, IF(trans.type=".ST_BANKPAYMENT.", ' $BP ', IF(trans.type=".ST_SUPPAYMENT.", ' $SP ',
+ ' $CN ')),
+ supplier.supp_name) as IName
+ FROM ".TB_PREF."suppliers supplier, "
+ .TB_PREF."supp_trans trans LEFT JOIN ".TB_PREF."voided AS vd ON trans.type=vd.type AND trans.trans_no=vd.id
+ WHERE trans.type IN(".ST_BANKPAYMENT.",".ST_SUPPAYMENT.",".ST_SUPPCREDIT.") AND
+ supplier.supplier_id=trans.supplier_id AND ISNULL(vd.id)
+ ORDER BY trans.trans_no DESC";