|
|
@@ -721,11 +721,10 @@
|
|
|
</update>
|
|
|
|
|
|
<update id="updatePurchaseYqty" parameterType="java.lang.Integer">
|
|
|
-
|
|
|
-update prodiodetail a
|
|
|
-set a.pd_yqty =ifnull((select b.pd_outqty from (select pd_ioid,sum(pd_outqty) pd_outqty from prodiodetail left join prodinout on pd_piid = pi_id where pd_piclass='采购验退单'
|
|
|
-and pi_puid=#{id,jdbcType=INTEGER} GROUP BY pd_ioid) b where ifnull(b.pd_ioid ,0)= a.pd_id ),0)
|
|
|
-where a.pd_piid = (select pi_id from prodinout where pi_puid=#{id,jdbcType=INTEGER} and pi_class='采购验收单')
|
|
|
+ update prodiodetail a
|
|
|
+ set a.pd_yqty =ifnull((select b.pd_outqty from (select pd_ioid,sum(pd_outqty) pd_outqty from prodiodetail left join prodinout on pd_piid = pi_id where pd_piclass='采购验退单'
|
|
|
+ and pi_puid=#{id,jdbcType=INTEGER} GROUP BY pd_ioid) b where ifnull(b.pd_ioid ,0)= a.pd_id ),0)
|
|
|
+ where a.pd_piid = (select pi_id from prodinout where pi_puid=#{id,jdbcType=INTEGER} and pi_class='采购验收单')
|
|
|
</update>
|
|
|
|
|
|
|
|
|
@@ -740,15 +739,15 @@ where a.pd_piid = (select pi_id from prodinout where pi_puid=#{id,jdbcType=INTEG
|
|
|
</delete>
|
|
|
|
|
|
<update id="calcProdIn">
|
|
|
- update prodiodetail set pd_netprice = pd_orderprice/(1+pd_taxrate/100) where pd_piid = #{pi_id,jdbcType=INTEGER};
|
|
|
- update prodiodetail set pd_total = pd_orderprice*pd_inqty,pd_nettotal = pd_netprice*pd_inqty where pd_piid = #{pi_id,jdbcType=INTEGER};
|
|
|
+ update prodiodetail set pd_netprice = ifnull(pd_orderprice,0)/(1+ifnull(pd_taxrate,0)/100) where pd_piid = #{pi_id,jdbcType=INTEGER};
|
|
|
+ update prodiodetail set pd_total = ifnull(pd_orderprice,0)*ifnull(pd_inqty,0),pd_nettotal = pd_netprice*ifnull(pd_inqty,0) where pd_piid = #{pi_id,jdbcType=INTEGER};
|
|
|
update prodinout set pi_total = (select sum(pd_total) from prodiodetail where pd_piid = #{pi_id,jdbcType=INTEGER} ) where pi_id = #{pi_id,jdbcType=INTEGER};
|
|
|
update prodinout set pi_nettotal = (select sum(pd_nettotal) from prodiodetail where pd_piid = #{pi_id,jdbcType=INTEGER} ) where pi_id = #{pi_id,jdbcType=INTEGER};
|
|
|
</update>
|
|
|
|
|
|
<update id="calcProdOut">
|
|
|
- update prodiodetail set pd_netprice = pd_orderprice/(1+pd_taxrate/100) where pd_piid = #{pi_id,jdbcType=INTEGER};
|
|
|
- update prodiodetail set pd_total = pd_orderprice*pd_outqty,pd_nettotal = pd_netprice*pd_outqty where pd_piid = #{pi_id,jdbcType=INTEGER};
|
|
|
+ update prodiodetail set pd_netprice = ifnull(pd_orderprice,0)/(1+ifnull(pd_taxrate,0)/100) where pd_piid = #{pi_id,jdbcType=INTEGER};
|
|
|
+ update prodiodetail set pd_total = ifnull(pd_orderprice,0)*ifnull(pd_outqty,0),pd_nettotal = pd_netprice*ifnull(pd_outqty,0) where pd_piid = #{pi_id,jdbcType=INTEGER};
|
|
|
update prodinout set pi_total = (select sum(pd_total) from prodiodetail where pd_piid = #{pi_id,jdbcType=INTEGER} ) where pi_id = #{pi_id,jdbcType=INTEGER};
|
|
|
update prodinout set pi_nettotal = (select sum(pd_nettotal) from prodiodetail where pd_piid = #{pi_id,jdbcType=INTEGER} ) where pi_id = #{pi_id,jdbcType=INTEGER};
|
|
|
</update>
|