|
@@ -114,7 +114,7 @@
|
|
|
select a.cCode,a.cBusType,b.cInvCode,isnull(b.cFree1,'') as cColor,isnull(b.cBatch,'') as cBatch,b.iQuantity,e.cInvName,
|
|
|
isnull(b.iSumBillQuantity,0) as iQuantityInvoice,
|
|
|
isnull(isnull((select sum(case when y.cexch_name='美元' then convert(decimal(18,4),isnull(x.cdefine27,'0'))*x.iPBVQuantity else x.iSum end)/sum(x.iPBVQuantity ) from PurBillVouchs x inner join purbillvouch y on x.PBVID =y.PBVID where x.RdsId =b.autoid),b.iSum/b.iQuantity),0) as iPrice,
|
|
|
- isnull(isnull((select sum(case when y.cexch_name='美元' then convert(decimal(18,4),isnull(x.cdefine27,'0'))*x.iPBVQuantity else x.iSum end) from PurBillVouchs x inner join purbillvouch y on x.PBVID =y.PBVID where x.RdsId =b.autoid),b.iSum ),0) as iPurchuseMoney,
|
|
|
+ isnull((select sum(case when y.cexch_name='美元' then convert(decimal(18,4),isnull(x.cdefine27,'0'))+x.iOriSum*y.cExchRate else x.iOriSum end) from PurBillVouchs x inner join purbillvouch y on x.PBVID =y.PBVID where x.RdsId =b.autoid),0) as iPurchuseMoney,
|
|
|
isnull((select sum(x.iMoney)/sum(x.iPBVQuantity ) from PurBillVouchs x inner join purbillvouch y on x.PBVID =y.PBVID where x.RdsId =b.autoid),0) as iNoTaxPrice,
|
|
|
isnull(b.iSQuantity,0) as iQuantitySettle,
|
|
|
g.cVCName,f.cVenName ,f.cVenAbbName,isnull(d.cPOID,'') as cPlanCode,e.cInvCCode,
|
|
@@ -154,7 +154,8 @@
|
|
|
|
|
|
select cPBVCode,cVenName,cVenAbbName,cShipTime,isnull(sum(iSum),0) as iSum,
|
|
|
isnull(sum(iOriSum),0) as iOriSum,isnull(sum(iQuantity),0) as iQuantity,
|
|
|
- isnull(sum(iPBVQuantity),0) as iPBVQuantity,isnull(sum(iSQuantity),0) as iSQuantity
|
|
|
+ isnull(sum(iPBVQuantity),0) as iPBVQuantity,isnull(sum(iSQuantity),0) as iSQuantity,
|
|
|
+ isnull(sum(iSumBillQuantity ),0) as iSumBillQuantity
|
|
|
from VIEW_FabricLoss_Cost_Clothes where trim(cCode) like CONCAT(#{code},'%') and cCode not like '%样%'
|
|
|
group by
|
|
|
cPBVCode,cVenName,cVenAbbName,cShipTime
|