|
|
@@ -483,6 +483,15 @@ public class SyCostAllocationServiceImpl extends ServiceImpl<SyCostAllocationMap
|
|
|
// if (syLossReport1 == null){
|
|
|
//根据计划号查找该计划号下所有采购发票含税金额和不含税金额(不含税金额 = 含税金额/1.13)
|
|
|
List<SyCostAllocation> fabriccostIncludestax = syCostAllocationMapper.queryPurBillVouchByFabric(plannum);
|
|
|
+ List<SyCostAllocation> fabriccostIncludestax1=new ArrayList<>();//103
|
|
|
+ List<SyCostAllocation> fabriccostIncludestax2=new ArrayList<>();//101/102
|
|
|
+ fabriccostIncludestax.forEach(f->{
|
|
|
+ if (f.getAccount().equals("103")){
|
|
|
+ fabriccostIncludestax1.add(f);
|
|
|
+ }else{
|
|
|
+ fabriccostIncludestax2.add(f);
|
|
|
+ }
|
|
|
+ });
|
|
|
//合计面料含税成本人名币
|
|
|
BigDecimal usageQuantityTotal = BigDecimal.ZERO;
|
|
|
//合计面料不含税成本人名币
|
|
|
@@ -509,51 +518,52 @@ public class SyCostAllocationServiceImpl extends ServiceImpl<SyCostAllocationMap
|
|
|
if((syCostAllocation.getFabriccostIncludestaxUsd()==null|| syCostAllocation.getFabriccostIncludestaxUsd().compareTo(new BigDecimal("0"))==0 ||orderType.equals("国外加工单"))
|
|
|
&& /*syCostAllocation.getFabriccostIncludestaxUsd()==null*/ fabriccostIncludestax!=null){
|
|
|
if(fabriccostIncludestax.size()!=0){
|
|
|
- for(SyCostAllocation str : fabriccostIncludestax){
|
|
|
- if (str.getExchangeRate().compareTo(str.getExchangeRate2())!=0){
|
|
|
- signNumUS="us";
|
|
|
- }
|
|
|
- System.out.println("美元\t"+signNumUS);
|
|
|
- for(SyCostAllocationFabric li:list3){
|
|
|
- String goodsName=li.getGoodsName();
|
|
|
- if (goodsName.indexOf("--")!=-1){
|
|
|
- goodsName=goodsName.substring(0,goodsName.indexOf("--"));
|
|
|
+ if (syCostAllocation.getFabriccostIncludestaxUsd()==null){
|
|
|
+ for(SyCostAllocation str : fabriccostIncludestax){
|
|
|
+ if (str.getExchangeRate().compareTo(str.getExchangeRate2())!=0){
|
|
|
+ signNumUS="us";
|
|
|
}
|
|
|
- if(str.getCInvName().equals(goodsName)){
|
|
|
- BigDecimal quantity=li.getUsageQuantity();
|
|
|
- if (li.getFabrictransferQuantity()!=null){
|
|
|
- quantity=li.getUsageQuantity().subtract(li.getFabrictransferQuantity());
|
|
|
+ System.out.println("美元\t"+signNumUS);
|
|
|
+ for(SyCostAllocationFabric li:list3){
|
|
|
+ String goodsName=li.getGoodsName();
|
|
|
+ if (goodsName.indexOf("--")!=-1){
|
|
|
+ goodsName=goodsName.substring(0,goodsName.indexOf("--"));
|
|
|
}
|
|
|
- //-- fabriccostincludestax=面料含税成本 fabriccostNotincludestax=面料不含税成本
|
|
|
+ if(str.getCInvName().equals(goodsName)){
|
|
|
+ BigDecimal quantity=li.getUsageQuantity();
|
|
|
+ if (li.getFabrictransferQuantity()!=null){
|
|
|
+ quantity=li.getUsageQuantity().subtract(li.getFabrictransferQuantity());
|
|
|
+ }
|
|
|
+ //-- fabriccostincludestax=面料含税成本 fabriccostNotincludestax=面料不含税成本
|
|
|
// System.out.println("getFabriccostIncludestax "+str.getFabriccostIncludestax()+" getFabriccostNotincludestax "+str.getFabriccostNotincludestax()
|
|
|
// +"getFabriccostIncludestaxUsd"+str.getFabriccostIncludestaxUsd()+" getInvoiceQuantity "+str.getInvoiceQuantity()+" quantity "+quantity);
|
|
|
- if (str.getInvoiceQuantity().compareTo(quantity)!=0){
|
|
|
- exchangeRate=str.getExchangeRate();//汇率
|
|
|
- BigDecimal money = str.getFabriccostIncludestax().divide(str.getInvoiceQuantity(),2,BigDecimal.ROUND_HALF_UP);
|
|
|
- BigDecimal num = money.multiply(str.getInvoiceQuantity());
|
|
|
- usageQuantityTotal = usageQuantityTotal.add(num);
|
|
|
- System.out.println("str\t"+str);
|
|
|
- System.out.println("str.getFabriccostIncludestax()\t"+str.getFabriccostIncludestax());
|
|
|
- System.out.println("str.getFabriccostNotincludestax()\t"+str.getFabriccostNotincludestax());
|
|
|
- System.out.println("money\t"+money);
|
|
|
- System.out.println("getInvoiceQuantity\t"+str.getInvoiceQuantity());
|
|
|
- System.out.println("quantity\t"+quantity);
|
|
|
- System.out.println("num\t"+num);
|
|
|
- BigDecimal money1 = str.getFabriccostNotincludestax().divide(str.getInvoiceQuantity(),2,BigDecimal.ROUND_HALF_UP);
|
|
|
- BigDecimal num1 = money1.multiply(quantity);
|
|
|
- notincludestaxTotal = notincludestaxTotal.add(num1);
|
|
|
+ if (str.getInvoiceQuantity().compareTo(quantity)!=0){
|
|
|
+ exchangeRate=str.getExchangeRate();//汇率
|
|
|
+ BigDecimal money = str.getFabriccostIncludestax().divide(str.getInvoiceQuantity(),2,BigDecimal.ROUND_HALF_UP);
|
|
|
+ BigDecimal num = money.multiply(str.getInvoiceQuantity());
|
|
|
+ usageQuantityTotal = usageQuantityTotal.add(num);
|
|
|
+ System.out.println("str\t"+str);
|
|
|
+ System.out.println("str.getFabriccostIncludestax()\t"+str.getFabriccostIncludestax());
|
|
|
+ System.out.println("str.getFabriccostNotincludestax()\t"+str.getFabriccostNotincludestax());
|
|
|
+ System.out.println("money\t"+money);
|
|
|
+ System.out.println("getInvoiceQuantity\t"+str.getInvoiceQuantity());
|
|
|
+ System.out.println("quantity\t"+quantity);
|
|
|
+ System.out.println("num\t"+num);
|
|
|
+ BigDecimal money1 = str.getFabriccostNotincludestax().divide(str.getInvoiceQuantity(),2,BigDecimal.ROUND_HALF_UP);
|
|
|
+ BigDecimal num1 = money1.multiply(quantity);
|
|
|
+ notincludestaxTotal = notincludestaxTotal.add(num1);
|
|
|
// notincludestaxTotal = notincludestaxTotal.add(str.getFabriccostIncludestax());
|
|
|
- System.out.println("notincludestaxTotal1\t"+notincludestaxTotal);
|
|
|
- BigDecimal money2 = str.getFabriccostIncludestaxUsd().divide(str.getInvoiceQuantity(),2,BigDecimal.ROUND_HALF_UP);
|
|
|
- BigDecimal num2 = money2.multiply(quantity);
|
|
|
- includestaxTotal = includestaxTotal.add(num2);
|
|
|
- }else{
|
|
|
- usageQuantityTotal = usageQuantityTotal.add(str.getFabriccostIncludestax());
|
|
|
- notincludestaxTotal = notincludestaxTotal.add(str.getFabriccostNotincludestax());
|
|
|
- System.out.println("notincludestaxTotal2\t"+notincludestaxTotal);
|
|
|
- includestaxTotal = includestaxTotal.add(str.getFabriccostIncludestaxUsd());
|
|
|
- }
|
|
|
- System.out.println(" getInvoiceQuantity "+str.getInvoiceQuantity()+" quantity "+quantity);
|
|
|
+ System.out.println("notincludestaxTotal1\t"+notincludestaxTotal);
|
|
|
+ BigDecimal money2 = str.getFabriccostIncludestaxUsd().divide(str.getInvoiceQuantity(),2,BigDecimal.ROUND_HALF_UP);
|
|
|
+ BigDecimal num2 = money2.multiply(quantity);
|
|
|
+ includestaxTotal = includestaxTotal.add(num2);
|
|
|
+ }else{
|
|
|
+ usageQuantityTotal = usageQuantityTotal.add(str.getFabriccostIncludestax());
|
|
|
+ notincludestaxTotal = notincludestaxTotal.add(str.getFabriccostNotincludestax());
|
|
|
+ System.out.println("notincludestaxTotal2\t"+notincludestaxTotal);
|
|
|
+ includestaxTotal = includestaxTotal.add(str.getFabriccostIncludestaxUsd());
|
|
|
+ }
|
|
|
+ System.out.println(" getInvoiceQuantity "+str.getInvoiceQuantity()+" quantity "+quantity);
|
|
|
// BigDecimal money = str.getFabriccostIncludestax().divide(str.getInvoiceQuantity(),2,BigDecimal.ROUND_HALF_UP);
|
|
|
// BigDecimal num = money.multiply(li.getUsageQuantity());
|
|
|
// usageQuantityTotal = usageQuantityTotal.add(num);
|
|
|
@@ -564,31 +574,111 @@ public class SyCostAllocationServiceImpl extends ServiceImpl<SyCostAllocationMap
|
|
|
// BigDecimal money2 = str.getFabriccostIncludestaxUsd().divide(str.getInvoiceQuantity(),2,BigDecimal.ROUND_HALF_UP);
|
|
|
// BigDecimal num2 = money2.multiply(li.getUsageQuantity());
|
|
|
// includestaxTotal = includestaxTotal.add(num2);
|
|
|
- //(发票金额/发票数量)*使用数量
|
|
|
+ //(发票金额/发票数量)*使用数量
|
|
|
// System.out.println("面料含税成本\t"+usageQuantityTotal+"\t面料不含税成本\t"+notincludestaxTotal+"\t发票数量\t"+str.getInvoiceQuantity()+"\t使用数量\t"+li.getUsageQuantity());
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
// System.out.println("面料含税人民币2\t"+usageQuantityTotal.setScale(2,BigDecimal.ROUND_HALF_UP));
|
|
|
// System.out.println("实际总金额2\t"+usageQuantityTotal);
|
|
|
- System.out.println("人民币面料成本notincludestaxTotal\t"+notincludestaxTotal);
|
|
|
- if (syCostAllocation.getFabriccostIncludestax()!=null){
|
|
|
- syCostAllocation.setFabriccostIncludestax(syCostAllocation.getFabriccostIncludestax().add(usageQuantityTotal.setScale(2,BigDecimal.ROUND_HALF_UP)));
|
|
|
- }else{
|
|
|
- syCostAllocation.setFabriccostIncludestax(usageQuantityTotal.setScale(2,BigDecimal.ROUND_HALF_UP));
|
|
|
- }
|
|
|
- System.out.println("人民币面料成本1\t"+syCostAllocation.getFabriccostNotincludestax());
|
|
|
- if (syCostAllocation.getFabriccostNotincludestax()!=null){
|
|
|
- syCostAllocation.setFabriccostNotincludestax(syCostAllocation.getFabriccostNotincludestax().add(notincludestaxTotal));
|
|
|
- }else{
|
|
|
- syCostAllocation.setFabriccostNotincludestax(notincludestaxTotal);
|
|
|
- }
|
|
|
- System.out.println("人民币面料成本2\t"+syCostAllocation.getFabriccostNotincludestax());
|
|
|
- System.out.println("includestaxTotal\t"+includestaxTotal+" getFabriccostIncludestaxUsd "+syCostAllocation.getFabriccostIncludestaxUsd());
|
|
|
- if (syCostAllocation.getFabriccostIncludestaxUsd()!=null){
|
|
|
- syCostAllocation.setFabriccostIncludestaxUsd(syCostAllocation.getFabriccostIncludestaxUsd().add(includestaxTotal));
|
|
|
+ System.out.println("人民币面料成本notincludestaxTotal\t"+notincludestaxTotal);
|
|
|
+ if (syCostAllocation.getFabriccostIncludestax()!=null){
|
|
|
+ syCostAllocation.setFabriccostIncludestax(syCostAllocation.getFabriccostIncludestax().add(usageQuantityTotal.setScale(2,BigDecimal.ROUND_HALF_UP)));
|
|
|
+ }else{
|
|
|
+ syCostAllocation.setFabriccostIncludestax(usageQuantityTotal.setScale(2,BigDecimal.ROUND_HALF_UP));
|
|
|
+ }
|
|
|
+ System.out.println("人民币面料成本1\t"+syCostAllocation.getFabriccostNotincludestax());
|
|
|
+ if (syCostAllocation.getFabriccostNotincludestax()!=null){
|
|
|
+ syCostAllocation.setFabriccostNotincludestax(syCostAllocation.getFabriccostNotincludestax().add(notincludestaxTotal));
|
|
|
+ }else{
|
|
|
+ syCostAllocation.setFabriccostNotincludestax(notincludestaxTotal);
|
|
|
+ }
|
|
|
+ System.out.println("人民币面料成本2\t"+syCostAllocation.getFabriccostNotincludestax());
|
|
|
+ System.out.println("includestaxTotal\t"+includestaxTotal+" getFabriccostIncludestaxUsd "+syCostAllocation.getFabriccostIncludestaxUsd());
|
|
|
+ if (syCostAllocation.getFabriccostIncludestaxUsd()!=null){
|
|
|
+ syCostAllocation.setFabriccostIncludestaxUsd(syCostAllocation.getFabriccostIncludestaxUsd().add(includestaxTotal));
|
|
|
+ }else{
|
|
|
+ syCostAllocation.setFabriccostIncludestaxUsd(includestaxTotal);
|
|
|
+ }
|
|
|
}else{
|
|
|
- syCostAllocation.setFabriccostIncludestaxUsd(includestaxTotal);
|
|
|
+ for(SyCostAllocation str : fabriccostIncludestax2){
|
|
|
+ if (str.getExchangeRate().compareTo(str.getExchangeRate2())!=0){
|
|
|
+ signNumUS="us";
|
|
|
+ }
|
|
|
+ System.out.println("美元\t"+signNumUS);
|
|
|
+ for(SyCostAllocationFabric li:list3){
|
|
|
+ String goodsName=li.getGoodsName();
|
|
|
+ if (goodsName.indexOf("--")!=-1){
|
|
|
+ goodsName=goodsName.substring(0,goodsName.indexOf("--"));
|
|
|
+ }
|
|
|
+ if(str.getCInvName().equals(goodsName)){
|
|
|
+ BigDecimal quantity=li.getUsageQuantity();
|
|
|
+ if (li.getFabrictransferQuantity()!=null){
|
|
|
+ quantity=li.getUsageQuantity().subtract(li.getFabrictransferQuantity());
|
|
|
+ }
|
|
|
+ if (str.getInvoiceQuantity().compareTo(quantity)!=0){
|
|
|
+ exchangeRate=str.getExchangeRate();//汇率
|
|
|
+ BigDecimal money = str.getFabriccostIncludestax().divide(str.getInvoiceQuantity(),2,BigDecimal.ROUND_HALF_UP);
|
|
|
+ BigDecimal num = money.multiply(str.getInvoiceQuantity());
|
|
|
+ usageQuantityTotal = usageQuantityTotal.add(num);
|
|
|
+ System.out.println("str\t"+str);
|
|
|
+ System.out.println("str.getFabriccostIncludestax()\t"+str.getFabriccostIncludestax());
|
|
|
+ System.out.println("str.getFabriccostNotincludestax()\t"+str.getFabriccostNotincludestax());
|
|
|
+ System.out.println("money\t"+money);
|
|
|
+ System.out.println("getInvoiceQuantity\t"+str.getInvoiceQuantity());
|
|
|
+ System.out.println("quantity\t"+quantity);
|
|
|
+ System.out.println("num\t"+num);
|
|
|
+ BigDecimal money1 = str.getFabriccostNotincludestax().divide(str.getInvoiceQuantity(),2,BigDecimal.ROUND_HALF_UP);
|
|
|
+ BigDecimal num1 = money1.multiply(quantity);
|
|
|
+ notincludestaxTotal = notincludestaxTotal.add(num1);
|
|
|
+// notincludestaxTotal = notincludestaxTotal.add(str.getFabriccostIncludestax());
|
|
|
+ System.out.println("notincludestaxTotal1\t"+notincludestaxTotal);
|
|
|
+ BigDecimal money2 = str.getFabriccostIncludestaxUsd().divide(str.getInvoiceQuantity(),2,BigDecimal.ROUND_HALF_UP);
|
|
|
+ BigDecimal num2 = money2.multiply(quantity);
|
|
|
+ includestaxTotal = includestaxTotal.add(num2);
|
|
|
+ }else{
|
|
|
+ usageQuantityTotal = usageQuantityTotal.add(str.getFabriccostIncludestax());
|
|
|
+ notincludestaxTotal = notincludestaxTotal.add(str.getFabriccostNotincludestax());
|
|
|
+ System.out.println("notincludestaxTotal2\t"+notincludestaxTotal);
|
|
|
+ includestaxTotal = includestaxTotal.add(str.getFabriccostIncludestaxUsd());
|
|
|
+ }
|
|
|
+ System.out.println(" getInvoiceQuantity "+str.getInvoiceQuantity()+" quantity "+quantity);
|
|
|
+// BigDecimal money = str.getFabriccostIncludestax().divide(str.getInvoiceQuantity(),2,BigDecimal.ROUND_HALF_UP);
|
|
|
+// BigDecimal num = money.multiply(li.getUsageQuantity());
|
|
|
+// usageQuantityTotal = usageQuantityTotal.add(num);
|
|
|
+//
|
|
|
+// BigDecimal money1 = str.getFabriccostNotincludestax().divide(str.getInvoiceQuantity(),2,BigDecimal.ROUND_HALF_UP);
|
|
|
+// BigDecimal num1 = money1.multiply(li.getUsageQuantity());
|
|
|
+// notincludestaxTotal = notincludestaxTotal.add(num1);
|
|
|
+// BigDecimal money2 = str.getFabriccostIncludestaxUsd().divide(str.getInvoiceQuantity(),2,BigDecimal.ROUND_HALF_UP);
|
|
|
+// BigDecimal num2 = money2.multiply(li.getUsageQuantity());
|
|
|
+// includestaxTotal = includestaxTotal.add(num2);
|
|
|
+ //(发票金额/发票数量)*使用数量
|
|
|
+// System.out.println("面料含税成本\t"+usageQuantityTotal+"\t面料不含税成本\t"+notincludestaxTotal+"\t发票数量\t"+str.getInvoiceQuantity()+"\t使用数量\t"+li.getUsageQuantity());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+// System.out.println("面料含税人民币2\t"+usageQuantityTotal.setScale(2,BigDecimal.ROUND_HALF_UP));
|
|
|
+// System.out.println("实际总金额2\t"+usageQuantityTotal);
|
|
|
+ System.out.println("人民币面料成本notincludestaxTotal\t"+notincludestaxTotal);
|
|
|
+ if (syCostAllocation.getFabriccostIncludestax()!=null){
|
|
|
+ syCostAllocation.setFabriccostIncludestax(syCostAllocation.getFabriccostIncludestax().add(usageQuantityTotal.setScale(2,BigDecimal.ROUND_HALF_UP)));
|
|
|
+ }else{
|
|
|
+ syCostAllocation.setFabriccostIncludestax(usageQuantityTotal.setScale(2,BigDecimal.ROUND_HALF_UP));
|
|
|
+ }
|
|
|
+ System.out.println("人民币面料成本1\t"+syCostAllocation.getFabriccostNotincludestax());
|
|
|
+ if (syCostAllocation.getFabriccostNotincludestax()!=null){
|
|
|
+ syCostAllocation.setFabriccostNotincludestax(syCostAllocation.getFabriccostNotincludestax().add(notincludestaxTotal));
|
|
|
+ }else{
|
|
|
+ syCostAllocation.setFabriccostNotincludestax(notincludestaxTotal);
|
|
|
+ }
|
|
|
+ System.out.println("人民币面料成本2\t"+syCostAllocation.getFabriccostNotincludestax());
|
|
|
+ System.out.println("includestaxTotal\t"+includestaxTotal+" getFabriccostIncludestaxUsd "+syCostAllocation.getFabriccostIncludestaxUsd());
|
|
|
+ if (syCostAllocation.getFabriccostIncludestaxUsd()!=null){
|
|
|
+ syCostAllocation.setFabriccostIncludestaxUsd(syCostAllocation.getFabriccostIncludestaxUsd().add(includestaxTotal));
|
|
|
+ }else{
|
|
|
+ syCostAllocation.setFabriccostIncludestaxUsd(includestaxTotal);
|
|
|
+ }
|
|
|
}
|
|
|
}else{
|
|
|
if (syCostAllocation.getFabriccostIncludestax()==null){
|