Warning: include(../connect.php) [function.include]: failed to open stream: No such file or directory in E:\www\_kpi\ps\nouse\ps_ac_commission_baht_01122018.php on line 13
Warning: include() [function.include]: Failed opening '../connect.php' for inclusion (include_path='.;C:\php5\pear') in E:\www\_kpi\ps\nouse\ps_ac_commission_baht_01122018.php on line 13
Warning: include(../function.php) [function.include]: failed to open stream: No such file or directory in E:\www\_kpi\ps\nouse\ps_ac_commission_baht_01122018.php on line 14
Warning: include() [function.include]: Failed opening '../function.php' for inclusion (include_path='.;C:\php5\pear') in E:\www\_kpi\ps\nouse\ps_ac_commission_baht_01122018.php on line 14
SELECT UCSMCD+''+E.JUTX40 as SALEMAN,
CASE WHEN SUBSTRING(UCORTP,1,1)='9' THEN (SUM(UCSAAM)+
ABS(Sum(case when UCITNO like 'DIS%' then UCSAAM+UCDIA5 else 0 end)+
Sum(case when UCITNO like 'PRO%' then UCSAAM+UCDIA5 else 0 end)+
Sum(case when UCITNO IN('VARY','DC01') then UCSAAM+UCDIA5 else 0 end)))
ELSE (SUM(UCSAAM)+ABS(Sum(case when UCITNO like 'DIS%' then UCSAAM+UCDIA5 else 0 end)+
Sum(case when UCITNO IN('VARY','DC01') then UCSAAM+UCDIA5 else 0 end)+
Sum(case when UCITNO like 'PRO%' then UCSAAM+UCDIA5 else 0 end)))*1.07
END AS AMOUNT,
SUM(UCDIA1+UCDIA2+UCDIA3+UCDIA4) as DISCOUNT_LINE,
SUM(UCDIA5) as DISCOUNT_HEAD,
CASE WHEN SUBSTRING(UCORTP,1,1)='9' THEN (SUM(UCSAAM)+
ABS(Sum(case when UCITNO like 'DIS%' then UCSAAM+UCDIA5 else 0 end)+
Sum(case when UCITNO IN('VARY','DC01') then UCSAAM+UCDIA5 else 0 end)+
Sum(case when UCITNO like 'PRO%' then UCSAAM+UCDIA5 else 0 end)))/1.07
ELSE (SUM(UCSAAM)+ABS(Sum(case when UCITNO like 'DIS%' then UCSAAM+UCDIA5 else 0 end)+
Sum(case when UCITNO IN('VARY','DC01') then UCSAAM+UCDIA5 else 0 end)+
Sum(case when UCITNO like 'PRO%' then UCSAAM+UCDIA5 else 0 end)))
END AS NET_AMOUNT
FROM MVXJDTA.OSBSTD A
LEFT JOIN MVXJDTA.OCUSMA D ON A.UCCUNO = D.OKCUNO
LEFT JOIN MVXJDTA.CMNUSR E ON A.UCSMCD = E.JUUSID
WHERE UCIVDT like '%'
AND A.UCCUNO <> '73110139'
AND A.UCORTP IN
GROUP BY UCORTP,UCSMCD,E.JUTX40
ORDER BY UCSMCD
Warning: odbc_exec(): supplied argument is not a valid ODBC-Link resource in E:\www\_kpi\ps\nouse\ps_ac_commission_baht_01122018.php on line 178
Report Commission by Amount (Exclude VAT)SaleMan | Discount | NetAmount |
Warning: odbc_fetch_row(): supplied argument is not a valid ODBC result resource in E:\www\_kpi\ps\nouse\ps_ac_commission_baht_01122018.php on line 190
---|
TOTAL | 0.00 | 0.00 |