Below query can be used to get the commission amount for the given period for a salesperson.
select sum(CCL.commission_amount) from cn_commission_headers_all CHR,
cn_commission_lines_all CCL
where CHR.commission_header_id = CCL.commission_header_id and
CCL.credited_salesrep_id = &Salesperson_Id and
CCL.processed_period_id = &Period_Id and
CHR.status like 'ROLL' and
CCL.status like 'CALC'
Below query can be used to get the total transaction amount for the given period for a salesperson.
select sum(CHR.transaction_amount) from cn_commission_headers_all CHR,
cn_commission_lines_all CCL
where CHR.commission_header_id = CCL.commission_header_id and
CCL.credited_salesrep_id = &Salesperson_Id and
CCL.processed_period_id = &Period_Id and
CHR.status like 'ROLL' and
CCL.status like 'CALC'
&Salesperson_Id - Can be taken from JTF_RS_SALESREPS table
&Period_Id - e.g., 2010001 for Jan 2010, 2009012 for Dec 2009
Tuesday, November 23, 2010
Subscribe to:
Comments (Atom)