Преглед изворни кода

费用支出按占比计算金额

zengtx пре 1 година
родитељ
комит
4ca11206b7

+ 3 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/cost/entity/SyCostAllocation.java

@@ -250,4 +250,7 @@ public class SyCostAllocation implements Serializable {
     //公司承担金额人民币
     private java.math.BigDecimal pkorgAmountrmb;
 
+    //销售订单总数量
+    private BigDecimal salerIquantity;
+
 }

+ 4 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/cost/mapper/SyCostAllocationMapper.java

@@ -26,4 +26,8 @@ public interface SyCostAllocationMapper extends BaseMapper<SyCostAllocation> {
     //查询改计划号的所有采购发票
     @DS("multi-three")
     List<SyCostAllocation> queryPurBillVouchByFabric(@Param("code") String code);
+
+    //查询销售订单总数量
+    @DS("multi-three")
+    SyCostAllocation querySalerIauantity(@Param("csocode") String csocode);
 }

+ 12 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/cost/mapper/xml/SyCostAllocationMapper.xml

@@ -208,4 +208,16 @@ select omi.cInvName as cInvName,sum(pbs.iOriSum) as iOriSum,sum(round(pbs.iOriSu
 
 
 	</select>
+
+    <select id="querySalerIauantity" resultType="org.jeecg.modules.cost.entity.SyCostAllocation">
+
+select t.salerIquantity from (
+select sum(iquantity) as salerIquantity from UFDATA_101_2021.dbo.SO_SODetails where csocode = #{csocode}
+union all
+select sum(iquantity) as salerIquantity from UFDATA_102_2021.dbo.SO_SODetails where csocode = #{csocode}
+union all
+select sum(iquantity) as salerIquantity from UFDATA_103_2021.dbo.SO_SODetails where csocode = #{csocode}
+) as t where t.salerIquantity is not null
+
+    </select>
 </mapper>

+ 19 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/cost/service/impl/SyCostAllocationServiceImpl.java

@@ -492,8 +492,27 @@ public class SyCostAllocationServiceImpl extends ServiceImpl<SyCostAllocationMap
 
         //费用支出
         List<SyCostAllocationCostpay> syCostAllocationCostpays = syCostAllocationCostpayMapper.queryByCostPay(plannum);
+        //查询销售订单总数量(用来计算占比),有一个销售订单关联多个委外订单的情况,使用占比算金额
+        SyCostAllocation entity = syCostAllocationMapper.querySalerIauantity(syCostAllocation.getGarmentContractno());
+        //计算占比
+        BigDecimal zhanBi = syCostAllocation.getPlanQuantity().divide(entity.getSalerIquantity(),2);
+
         for (int i=0;i<syCostAllocationCostpays.size();i++) {
+
             SyCostAllocationCostpay syCostAllocationCostpay = syCostAllocationCostpays.get(i);
+            //人民币税额算占比
+            if(oConvertUtils.isNotEmpty(syCostAllocationCostpay.getShuiemoney())){
+                syCostAllocationCostpay.setShuiemoney(syCostAllocationCostpay.getShuiemoney().multiply(zhanBi));
+            }
+            //人民币(不含税)算占比
+            if(oConvertUtils.isNotEmpty(syCostAllocationCostpay.getDisbursedLocalmoney())){
+                syCostAllocationCostpay.setDisbursedLocalmoney(syCostAllocationCostpay.getDisbursedLocalmoney().multiply(zhanBi));
+            }
+            //美元算占比
+            if(oConvertUtils.isNotEmpty(syCostAllocationCostpay.getDisbursedOriginalmoney())){
+                syCostAllocationCostpay.setDisbursedOriginalmoney(syCostAllocationCostpay.getDisbursedOriginalmoney().multiply(zhanBi));
+            }
+
             //费用支出单原币本币汇总 并 赋值给表头(运杂费)
             if(syCostAllocation.getUsdExpense()==null){
                 syCostAllocation.setUsdExpense(syCostAllocationCostpay.getDisbursedOriginalmoney());