|
- SELECT T3.FNAME AS 客户,T3.FBILLNO AS 订单编码,T2.FNAME AS 产品名称,T1.FTAXPRICE AS 单价,FPRICEBASEQTY AS 数量,FAMOUNT AS 金额,T4.FCOSTAMOUNT AS 成本,T1.FAMOUNT -T4.FCOSTAMOUNT AS 毛利
- FROM T_SAL_ORDERENTRY_F T1
- INNER JOIN
- (SELECT FNAME,FID FROM T_SAL_ORDERENTRY A1
- LEFT JOIN T_BD_MATERIAL_L A2
- ON A1.FMATERIALID=A2.FMATERIALID) T2
- ON T1.FID=T2.FID
- INNER JOIN(SELECT FNAME,FID,FBILLNO FROM T_SAL_ORDER A1
- LEFT JOIN
- T_BD_CUSTOMER_L A2
- ON A1.FCUSTID=A2.FCUSTID) T3
- ON T1.FID=T3.FID
- LEFT JOIN
- (SELECT FCOSTAMOUNT, FSBILLID FROM T_SAL_OUTSTOCKENTRY_LK A1
- INNER JOIN T_SAL_OUTSTOCKENTRY_F A2
- ON A1.FENTRYID=A2.FENTRYID
- WHERE FSTABLENAME = 'T_SAL_ORDERENTRY')T4
- ON T4.FSBILLID=T1.FID
复制代码
|
|