|
@@ -17,12 +17,12 @@
|
|
</select>
|
|
</select>
|
|
|
|
|
|
<update id="deleteTempTable101">
|
|
<update id="deleteTempTable101">
|
|
- DROP TABLE ##fenpeiTable;
|
|
|
|
|
|
+ DROP TABLE ${table};
|
|
</update>
|
|
</update>
|
|
|
|
|
|
<insert id="createTempTable101">
|
|
<insert id="createTempTable101">
|
|
|
|
|
|
- CREATE TABLE ##fenpeiTable (
|
|
|
|
|
|
+ CREATE TABLE ${table}(
|
|
ccode varchar(50),
|
|
ccode varchar(50),
|
|
cInvCode varchar(50),
|
|
cInvCode varchar(50),
|
|
goodsName varchar(200),
|
|
goodsName varchar(200),
|
|
@@ -38,7 +38,7 @@
|
|
|
|
|
|
<insert id="insertDataIntoTempTable101_101">
|
|
<insert id="insertDataIntoTempTable101_101">
|
|
|
|
|
|
- insert into ##fenpeiTable select t3.ccode as ccode,t3.cInvCode,t3.goodsName,max(t3.dosage) as dosage,sum(t3.usageQuantity) as usageQuantity,max(t3.cVenAbbName) as supper,sum(t3.rmbAmount) as rmbAmount,sum(t3.usdAmount) as usdAmount,sum(t3.priceExcludingtax) as priceExcludingtax,sum(t3.iCost) as cost from (
|
|
|
|
|
|
+ insert into ${table} select t3.ccode as ccode,t3.cInvCode,t3.goodsName,max(t3.dosage) as dosage,sum(t3.usageQuantity) as usageQuantity,max(t3.cVenAbbName) as supper,sum(t3.rmbAmount) as rmbAmount,sum(t3.usdAmount) as usdAmount,sum(t3.priceExcludingtax) as priceExcludingtax,sum(t3.iCost) as cost from (
|
|
|
|
|
|
select t1.ccode as ccode,t1.cInvCode,t1.goodsName,t1.dosage,t1.usageQuantity,t2.cVenAbbName,t2.rmbAmount,t2.usdAmount,t2.priceExcludingtax,t2.iCost from (select ot.cInvCode,od.isosid,om.ccode,oti.cInvName as goodsName,sum(ot.iUnitQuantity) as dosage,sum(ot.iSendQTY) as usageQuantity
|
|
select t1.ccode as ccode,t1.cInvCode,t1.goodsName,t1.dosage,t1.usageQuantity,t2.cVenAbbName,t2.rmbAmount,t2.usdAmount,t2.priceExcludingtax,t2.iCost from (select ot.cInvCode,od.isosid,om.ccode,oti.cInvName as goodsName,sum(ot.iUnitQuantity) as dosage,sum(ot.iSendQTY) as usageQuantity
|
|
|
|
|
|
@@ -71,7 +71,7 @@ join UFDATA_103_2021.dbo.cost_allocation_accessories_view vif on om.ccode = vif.
|
|
</insert>
|
|
</insert>
|
|
|
|
|
|
<insert id="insertDataIntoTempTable101_102">
|
|
<insert id="insertDataIntoTempTable101_102">
|
|
-insert into ##fenpeiTable select t3.ccode,t3.cInvCode,t3.goodsName,max(t3.dosage) as dosage,sum(t3.usageQuantity) as usageQuantity,max(t3.cVenAbbName) as supper,sum(t3.rmbAmount) as rmbAmount,sum(t3.usdAmount) as usdAmount,sum(t3.priceExcludingtax) as priceExcludingtax,sum(t3.iCost) as cost from (
|
|
|
|
|
|
+insert into ${table} select t3.ccode,t3.cInvCode,t3.goodsName,max(t3.dosage) as dosage,sum(t3.usageQuantity) as usageQuantity,max(t3.cVenAbbName) as supper,sum(t3.rmbAmount) as rmbAmount,sum(t3.usdAmount) as usdAmount,sum(t3.priceExcludingtax) as priceExcludingtax,sum(t3.iCost) as cost from (
|
|
|
|
|
|
select t1.ccode,t1.cInvCode,t1.goodsName,t1.dosage,t1.usageQuantity,t2.cVenAbbName,t2.rmbAmount,t2.usdAmount,t2.priceExcludingtax,t2.iCost from (select ot.cInvCode,od.isosid,om.ccode,oti.cInvName as goodsName,sum(ot.iUnitQuantity) as dosage,sum(ot.iSendQTY) as usageQuantity
|
|
select t1.ccode,t1.cInvCode,t1.goodsName,t1.dosage,t1.usageQuantity,t2.cVenAbbName,t2.rmbAmount,t2.usdAmount,t2.priceExcludingtax,t2.iCost from (select ot.cInvCode,od.isosid,om.ccode,oti.cInvName as goodsName,sum(ot.iUnitQuantity) as dosage,sum(ot.iSendQTY) as usageQuantity
|
|
|
|
|
|
@@ -107,7 +107,7 @@ join UFDATA_103_2021.dbo.cost_allocation_accessories_view vif on om.ccode = vif.
|
|
</insert>
|
|
</insert>
|
|
|
|
|
|
<insert id="insertDataIntoTempTable101_103">
|
|
<insert id="insertDataIntoTempTable101_103">
|
|
-insert into ##fenpeiTable select t3.ccode,t3.cInvCode,t3.goodsName,max(t3.dosage) as dosage,sum(t3.usageQuantity) as usageQuantity,max(t3.cVenAbbName) as supper,sum(t3.rmbAmount) as rmbAmount,sum(t3.usdAmount) as usdAmount,sum(t3.priceExcludingtax) as priceExcludingtax,sum(t3.iCost) as cost from (
|
|
|
|
|
|
+insert into ${table} select t3.ccode,t3.cInvCode,t3.goodsName,max(t3.dosage) as dosage,sum(t3.usageQuantity) as usageQuantity,max(t3.cVenAbbName) as supper,sum(t3.rmbAmount) as rmbAmount,sum(t3.usdAmount) as usdAmount,sum(t3.priceExcludingtax) as priceExcludingtax,sum(t3.iCost) as cost from (
|
|
|
|
|
|
select t1.ccode,t1.cInvCode,t1.goodsName,t1.dosage,t1.usageQuantity,t2.cVenAbbName,t2.rmbAmount,t2.usdAmount,t2.priceExcludingtax,t2.iCost from (select ot.cInvCode,od.isosid,om.ccode,oti.cInvName as goodsName,sum(ot.iUnitQuantity) as dosage,sum(ot.iSendQTY) as usageQuantity
|
|
select t1.ccode,t1.cInvCode,t1.goodsName,t1.dosage,t1.usageQuantity,t2.cVenAbbName,t2.rmbAmount,t2.usdAmount,t2.priceExcludingtax,t2.iCost from (select ot.cInvCode,od.isosid,om.ccode,oti.cInvName as goodsName,sum(ot.iUnitQuantity) as dosage,sum(ot.iSendQTY) as usageQuantity
|
|
|
|
|
|
@@ -314,7 +314,7 @@ and (om.cCloser is null or ( (od.iReceivedQTY is not null or od.iReceivedQTY !=
|
|
(
|
|
(
|
|
|
|
|
|
select t4.cInvCode,max(t4.goodsName) as goodsName,max(t4.dosage) as dosage,max(t4.usageQuantity) as usageQuantity,STRING_AGG(t4.supper,',') as supper,sum(t4.rmbAmount) as rmbAmount,sum(t4.usdAmount) as usdAmount,sum(t4.priceExcludingtax) as priceExcludingtax,sum(t4.cost) as cost from
|
|
select t4.cInvCode,max(t4.goodsName) as goodsName,max(t4.dosage) as dosage,max(t4.usageQuantity) as usageQuantity,STRING_AGG(t4.supper,',') as supper,sum(t4.rmbAmount) as rmbAmount,sum(t4.usdAmount) as usdAmount,sum(t4.priceExcludingtax) as priceExcludingtax,sum(t4.cost) as cost from
|
|
- ##fenpeiTable t4
|
|
|
|
|
|
+ ${table} t4
|
|
|
|
|
|
where t4.cInvCode not in(
|
|
where t4.cInvCode not in(
|
|
select cInvCode from UFDATA_103_2021.dbo.cost_allocation_fabric_view vif
|
|
select cInvCode from UFDATA_103_2021.dbo.cost_allocation_fabric_view vif
|