|
|
@@ -549,49 +549,107 @@
|
|
|
|
|
|
</select>-->
|
|
|
|
|
|
- <select id="queryPurBillVouchByFabric" resultType="org.jeecg.modules.cost.entity.SyCostAllocation">
|
|
|
-
|
|
|
+ <!--<select id="queryPurBillVouchByFabric" resultType="org.jeecg.modules.cost.entity.SyCostAllocation">
|
|
|
+ select t.cInvName,sum(t.iOriSum) as fabriccostIncludestax,sum(t.iNotOriMoney) as fabriccostNotincludestax, sum(t.cExchRate) as fabriccostIncludestaxUsd,sum(t.invoiceQuantity) as invoiceQuantity from (
|
|
|
+ select omi.cInvName as cInvName,sum(pbs.iOriSum) as iOriSum,sum(round(pbs.iOriSum/1.13,4)) as iNotOriMoney,CONVERT(DECIMAL(38,2),sum(pbs.iOriSum)/max(so.iExchRate)) as cExchRate,sum(pbs.iPBVQuantity) as invoiceQuantity
|
|
|
+ from UFDATA_101_2021.dbo.PO_Pomain pm
|
|
|
+ join UFDATA_101_2021.dbo.PO_Podetails pd on pm.POID = pd.POID
|
|
|
+ join UFDATA_101_2021.dbo.PurBillVouchs pbs on pd.ID = pbs.iPOsID
|
|
|
+ join UFDATA_101_2021.dbo.PurBillVouch pb on pb.PBVID = pbs.PBVID
|
|
|
+ join UFDATA_101_2021.dbo.Inventory omi on omi.cInvCode=pbs.cInvCode
|
|
|
+ join UFDATA_101_2021.dbo.SO_SOMain so on pd.csoordercode = so.csocode
|
|
|
+ where pm.cPOID like CONCAT('%',#{code},'%') and (omi.cInvCcode like '03%' or omi.cInvCcode like '04%') and omi.cInvCCode != '0399' and omi.cInvCCode != '0499' and omi.cInvCCode != '0299'
|
|
|
+ and omi.cInvCCode != '07'and omi.cInvCCode != '06'and omi.cInvCCode != '05' and pb.cVenCode not in('T010001','T020001','T030001')
|
|
|
+ group by omi.cInvName
|
|
|
+ UNION ALL
|
|
|
+ select omi.cInvName as cInvName,sum(pbs.iOriSum) as iOriSum,sum(round(pbs.iOriSum/1.13,2)) as iNotOriMoney,CONVERT(DECIMAL(38,2),sum(pbs.iOriSum)/max(so.iExchRate)) as cExchRate,sum(pbs.iPBVQuantity) as invoiceQuantity
|
|
|
+ from UFDATA_102_2021.dbo.PO_Pomain pm
|
|
|
+ join UFDATA_102_2021.dbo.PO_Podetails pd on pm.POID = pd.POID
|
|
|
+ join UFDATA_102_2021.dbo.PurBillVouchs pbs on pd.ID = pbs.iPOsID
|
|
|
+ join UFDATA_102_2021.dbo.PurBillVouch pb on pb.PBVID = pbs.PBVID
|
|
|
+ join UFDATA_102_2021.dbo.Inventory omi on omi.cInvCode=pbs.cInvCode
|
|
|
+ join UFDATA_102_2021.dbo.SO_SOMain so on pd.csoordercode = so.csocode
|
|
|
+ where pm.cPOID like CONCAT('%',#{code},'%') and (omi.cInvCcode like '03%' or omi.cInvCcode like '04%') and omi.cInvCCode != '0399' and omi.cInvCCode != '0499' and omi.cInvCCode != '0299'
|
|
|
+ and omi.cInvCCode != '07'and omi.cInvCCode != '06'and omi.cInvCCode != '05' and pb.cVenCode not in('T010001','T020001')
|
|
|
+ group by omi.cInvName
|
|
|
+ UNION ALL
|
|
|
+ select omi.cInvName as cInvName,sum(pbs.iOriSum) as iOriSum,sum(round(pbs.iOriSum/1.13,4)) as iNotOriMoney,CONVERT(DECIMAL(38,2),sum(pbs.iOriSum)/max(so.iExchRate)) as cExchRate,sum(pbs.iPBVQuantity) as invoiceQuantity
|
|
|
+ from UFDATA_103_2021.dbo.PO_Pomain pm
|
|
|
+ join UFDATA_103_2021.dbo.PO_Podetails pd on pm.POID = pd.POID
|
|
|
+ join UFDATA_103_2021.dbo.PurBillVouchs pbs on pd.ID = pbs.iPOsID
|
|
|
+ join UFDATA_103_2021.dbo.PurBillVouch pb on pb.PBVID = pbs.PBVID
|
|
|
+ join UFDATA_103_2021.dbo.Inventory omi on omi.cInvCode=pbs.cInvCode
|
|
|
+ join UFDATA_103_2021.dbo.SO_SOMain so on pd.csoordercode = so.csocode
|
|
|
+ where pm.cPOID like CONCAT('%',#{code},'%') and (omi.cInvCcode like '03%' or omi.cInvCcode like '04%') and omi.cInvCCode != '0399' and omi.cInvCCode != '0499' and omi.cInvCCode != '0299'
|
|
|
+ and omi.cInvCCode != '07'and omi.cInvCCode != '06'and omi.cInvCCode != '05' and pb.cVenCode not in('T010001','T020001')
|
|
|
+ group by omi.cInvName) t where t.iOriSum is not null group by t.cInvName
|
|
|
+ </select>-->
|
|
|
|
|
|
- select t.cInvName,sum(t.iOriSum) as fabriccostIncludestax,sum(t.iNotOriMoney) as fabriccostNotincludestax, sum(t.cExchRate) as fabriccostIncludestaxUsd,sum(t.invoiceQuantity) as invoiceQuantity from (
|
|
|
- select omi.cInvName as cInvName,sum(pbs.iOriSum) as iOriSum,sum(round(pbs.iOriSum/1.13,4)) as iNotOriMoney,CONVERT(DECIMAL(38,2),sum(pbs.iOriSum)/max(so.iExchRate)) as cExchRate,sum(pbs.iPBVQuantity) as invoiceQuantity
|
|
|
- from UFDATA_101_2021.dbo.PO_Pomain pm
|
|
|
- join UFDATA_101_2021.dbo.PO_Podetails pd on pm.POID = pd.POID
|
|
|
- join UFDATA_101_2021.dbo.PurBillVouchs pbs on pd.ID = pbs.iPOsID
|
|
|
- join UFDATA_101_2021.dbo.PurBillVouch pb on pb.PBVID = pbs.PBVID
|
|
|
- join UFDATA_101_2021.dbo.Inventory omi on omi.cInvCode=pbs.cInvCode
|
|
|
- join UFDATA_101_2021.dbo.SO_SOMain so on pd.csoordercode = so.csocode
|
|
|
- where pm.cPOID like CONCAT('%',#{code},'%') and (omi.cInvCcode like '03%' or omi.cInvCcode like '04%') and omi.cInvCCode != '0399' and omi.cInvCCode != '0499' and omi.cInvCCode != '0299'
|
|
|
- and omi.cInvCCode != '07'and omi.cInvCCode != '06'and omi.cInvCCode != '05' and pb.cVenCode not in('T010001','T020001','T030001')
|
|
|
- group by omi.cInvName
|
|
|
- UNION ALL
|
|
|
-
|
|
|
-select omi.cInvName as cInvName,sum(pbs.iOriSum) as iOriSum,sum(round(pbs.iOriSum/1.13,2)) as iNotOriMoney,CONVERT(DECIMAL(38,2),sum(pbs.iOriSum)/max(so.iExchRate)) as cExchRate,sum(pbs.iPBVQuantity) as invoiceQuantity
|
|
|
- from UFDATA_102_2021.dbo.PO_Pomain pm
|
|
|
- join UFDATA_102_2021.dbo.PO_Podetails pd on pm.POID = pd.POID
|
|
|
- join UFDATA_102_2021.dbo.PurBillVouchs pbs on pd.ID = pbs.iPOsID
|
|
|
- join UFDATA_102_2021.dbo.PurBillVouch pb on pb.PBVID = pbs.PBVID
|
|
|
- join UFDATA_102_2021.dbo.Inventory omi on omi.cInvCode=pbs.cInvCode
|
|
|
- join UFDATA_102_2021.dbo.SO_SOMain so on pd.csoordercode = so.csocode
|
|
|
- where pm.cPOID like CONCAT('%',#{code},'%') and (omi.cInvCcode like '03%' or omi.cInvCcode like '04%') and omi.cInvCCode != '0399' and omi.cInvCCode != '0499' and omi.cInvCCode != '0299'
|
|
|
- and omi.cInvCCode != '07'and omi.cInvCCode != '06'and omi.cInvCCode != '05' and pb.cVenCode not in('T010001','T020001')
|
|
|
-group by omi.cInvName
|
|
|
- UNION ALL
|
|
|
-
|
|
|
-
|
|
|
-select omi.cInvName as cInvName,sum(pbs.iOriSum) as iOriSum,sum(round(pbs.iOriSum/1.13,4)) as iNotOriMoney,CONVERT(DECIMAL(38,2),sum(pbs.iOriSum)/max(so.iExchRate)) as cExchRate,sum(pbs.iPBVQuantity) as invoiceQuantity
|
|
|
- from UFDATA_103_2021.dbo.PO_Pomain pm
|
|
|
- join UFDATA_103_2021.dbo.PO_Podetails pd on pm.POID = pd.POID
|
|
|
- join UFDATA_103_2021.dbo.PurBillVouchs pbs on pd.ID = pbs.iPOsID
|
|
|
- join UFDATA_103_2021.dbo.PurBillVouch pb on pb.PBVID = pbs.PBVID
|
|
|
- join UFDATA_103_2021.dbo.Inventory omi on omi.cInvCode=pbs.cInvCode
|
|
|
- join UFDATA_103_2021.dbo.SO_SOMain so on pd.csoordercode = so.csocode
|
|
|
- where pm.cPOID like CONCAT('%',#{code},'%') and (omi.cInvCcode like '03%' or omi.cInvCcode like '04%') and omi.cInvCCode != '0399' and omi.cInvCCode != '0499' and omi.cInvCCode != '0299'
|
|
|
- and omi.cInvCCode != '07'and omi.cInvCCode != '06'and omi.cInvCCode != '05' and pb.cVenCode not in('T010001','T020001')
|
|
|
- group by omi.cInvName
|
|
|
- ) t where t.iOriSum is not null group by t.cInvName
|
|
|
|
|
|
+ <select id="queryPurBillVouchByFabric" resultType="org.jeecg.modules.cost.entity.SyCostAllocation">
|
|
|
|
|
|
- </select>
|
|
|
+ select t.cInvName,
|
|
|
+ sum(t.iOriSum) as fabriccostIncludestax,sum(t.iNotOriMoney) as fabriccostNotincludestax, sum(t.cExchRate) as fabriccostIncludestaxUsd,sum(t.invoiceQuantity) as invoiceQuantity from (
|
|
|
+ select omi.cInvName as cInvName,
|
|
|
+ /*人民币含税金额取本币含税金额*/
|
|
|
+ SUM(pbs.iSum) as iOriSum,
|
|
|
+ /*人民币不含税金额 美元税率设置为0*/
|
|
|
+ sum(case when pb.cexch_name='美元' then pbs.iSum else round(pbs.iSum/1.13,4) end ) as iNotOriMoney,
|
|
|
+ /*美元金额*/
|
|
|
+ sum(case when pb.cexch_name='美元' then pbs.iOriSum else 0 end)+
|
|
|
+ CONVERT(DECIMAL(38,2),SUM(case when pb.cexch_name!='美元' THEN pbs.iSum ELSE 0 END)/max(so.iExchRate)) as cExchRate,
|
|
|
+
|
|
|
+ sum(pbs.iPBVQuantity) as invoiceQuantity
|
|
|
+ from UFDATA_101_2021.dbo.PO_Pomain pm
|
|
|
+ join UFDATA_101_2021.dbo.PO_Podetails pd on pm.POID = pd.POID
|
|
|
+ join UFDATA_101_2021.dbo.PurBillVouchs pbs on pd.ID = pbs.iPOsID
|
|
|
+ join UFDATA_101_2021.dbo.PurBillVouch pb on pb.PBVID = pbs.PBVID
|
|
|
+ join UFDATA_101_2021.dbo.Inventory omi on omi.cInvCode=pbs.cInvCode
|
|
|
+ join UFDATA_101_2021.dbo.SO_SOMain so on pd.csoordercode = so.csocode
|
|
|
+ where pm.cPOID like CONCAT('%',#{code},'%') and (omi.cInvCcode like '03%' or omi.cInvCcode like '04%') and omi.cInvCCode != '0399' and omi.cInvCCode != '0499' and omi.cInvCCode != '0299'
|
|
|
+ and omi.cInvCCode != '07'and omi.cInvCCode != '06'and omi.cInvCCode != '05' and pb.cVenCode not in('T010001','T020001','T030001')
|
|
|
+ group by omi.cInvName
|
|
|
+ UNION ALL
|
|
|
+
|
|
|
+ select omi.cInvName as cInvName,
|
|
|
+ /*人民币含税金额*/
|
|
|
+ SUM(pbs.iSum) as iOriSum,
|
|
|
+ /*人民币不含税金额 美元税率设置为0*/
|
|
|
+ sum(case when pb.cexch_name='美元' then pbs.iSum else round(pbs.iSum/1.13,4) end ) as iNotOriMoney,
|
|
|
+ /*美元金额*/
|
|
|
+ sum(case when pb.cexch_name='美元' then pbs.iOriSum else 0 end)+
|
|
|
+ CONVERT(DECIMAL(38,2),SUM(case when pb.cexch_name!='美元' THEN pbs.iSum ELSE 0 END)/max(so.iExchRate)) as cExchRate
|
|
|
+ ,sum(pbs.iPBVQuantity) as invoiceQuantity
|
|
|
+ from UFDATA_102_2021.dbo.PO_Pomain pm
|
|
|
+ join UFDATA_102_2021.dbo.PO_Podetails pd on pm.POID = pd.POID
|
|
|
+ join UFDATA_102_2021.dbo.PurBillVouchs pbs on pd.ID = pbs.iPOsID
|
|
|
+ join UFDATA_102_2021.dbo.PurBillVouch pb on pb.PBVID = pbs.PBVID
|
|
|
+ join UFDATA_102_2021.dbo.Inventory omi on omi.cInvCode=pbs.cInvCode
|
|
|
+ join UFDATA_102_2021.dbo.SO_SOMain so on pd.csoordercode = so.csocode
|
|
|
+ where pm.cPOID like CONCAT('%',#{code},'%') and (omi.cInvCcode like '03%' or omi.cInvCcode like '04%') and omi.cInvCCode != '0399' and omi.cInvCCode != '0499' and omi.cInvCCode != '0299'
|
|
|
+ and omi.cInvCCode != '07'and omi.cInvCCode != '06'and omi.cInvCCode != '05' and pb.cVenCode not in('T010001','T020001')
|
|
|
+ group by omi.cInvName
|
|
|
+ UNION ALL
|
|
|
+ select omi.cInvName as cInvName,
|
|
|
+ /*人民币含税金额*/
|
|
|
+ SUM(pbs.iSum) as iOriSum,
|
|
|
+ /*人民币不含税金额 美元税率设置为0*/
|
|
|
+ sum(case when pb.cexch_name='美元' then pbs.iSum else round(pbs.iSum/1.13,4) end ) as iNotOriMoney,
|
|
|
+ /*美元金额*/
|
|
|
+ sum(case when pb.cexch_name='美元' then pbs.iOriSum else 0 end)+
|
|
|
+ CONVERT(DECIMAL(38,2),SUM(case when pb.cexch_name!='美元' THEN pbs.iSum ELSE 0 END)/max(so.iExchRate)) as cExchRate,
|
|
|
+ sum(pbs.iPBVQuantity) as invoiceQuantity
|
|
|
+ from UFDATA_103_2021.dbo.PO_Pomain pm
|
|
|
+ join UFDATA_103_2021.dbo.PO_Podetails pd on pm.POID = pd.POID
|
|
|
+ join UFDATA_103_2021.dbo.PurBillVouchs pbs on pd.ID = pbs.iPOsID
|
|
|
+ join UFDATA_103_2021.dbo.PurBillVouch pb on pb.PBVID = pbs.PBVID
|
|
|
+ join UFDATA_103_2021.dbo.Inventory omi on omi.cInvCode=pbs.cInvCode
|
|
|
+ join UFDATA_103_2021.dbo.SO_SOMain so on pd.csoordercode = so.csocode
|
|
|
+ where pm.cPOID like CONCAT('%',#{code},'%') and (omi.cInvCcode like '03%' or omi.cInvCcode like '04%') and omi.cInvCCode != '0399' and omi.cInvCCode != '0499' and omi.cInvCCode != '0299'
|
|
|
+ and omi.cInvCCode != '07'and omi.cInvCCode != '06'and omi.cInvCCode != '05' and pb.cVenCode not in('T010001','T020001')
|
|
|
+ group by omi.cInvName
|
|
|
+ ) t where t.iOriSum is not null group by t.cInvName
|
|
|
+ </select>
|
|
|
|
|
|
<select id="querySalerIauantity" resultType="org.jeecg.modules.cost.entity.SyCostAllocation">
|
|
|
|