Przeglądaj źródła

汽运报表计算

zxz 2 lat temu
rodzic
commit
67d47b9ad7

+ 32 - 7
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/TranSettlementReportServiceImpl.java

@@ -30,6 +30,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
 
+import java.text.DecimalFormat;
 import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.stream.Collectors;
@@ -249,6 +250,18 @@ public class TranSettlementReportServiceImpl extends ServiceImpl<TranSettlementR
                 tranSettlementReport1.setManualFlag("1");
                 //应付=单价x结算重量-扣款
                 tranSettlementReport1.setAmountIngPayable(tranSettlementReport1.getTransportPrice() * tranSettlementReport.getSettlementWeight() - Float.valueOf(tranSettlementReport1.getDeductionAmount() != null ? tranSettlementReport1.getDeductionAmount() : "0"));
+                //实付金额
+                tranSettlementReport1.setAmountActuallyPaid(Double.valueOf(tranSettlementReport1.getTransportPrice()) * tranSettlementReport1.getSettlementWeight()
+                        - Double.valueOf(tranSettlementReport1.getDeductionAmount() != null ? tranSettlementReport1.getDeductionAmount() : "0") - tranSettlementReport1.getServiceCharge());
+                //税点
+                tranSettlementReport1.setTaxPoint(tranSettlementReport1.getAmountActuallyPaid()/0.946*0.054);
+                //合计应付
+                tranSettlementReport1.setTotalPayable(tranSettlementReport1.getAmountActuallyPaid()+tranSettlementReport1.getTaxPoint());
+                //未付金额
+                Float f = 0.0f;
+                f = tranSettlementReport1.getTotalPayable().floatValue() - tranSettlementReport1.getAmountEdPayable();
+                DecimalFormat df1 = new DecimalFormat("#.00");
+                tranSettlementReport1.setAmountNotPayable(Float.parseFloat(df1.format(f)));
                 //更改汽运结算信息
                 this.updateById(tranSettlementReport1);
                 return "OK";
@@ -258,6 +271,18 @@ public class TranSettlementReportServiceImpl extends ServiceImpl<TranSettlementR
                 tranSettlementReport1.setDeductionAmount(tranSettlementReport.getDeductionAmount());
                 tranSettlementReport1.setAmountIngPayable(tranSettlementReport1.getSettlementWeight()*tranSettlementReport1.getTransportPrice()-Float.valueOf(tranSettlementReport1.getDeductionAmount()));
                 tranSettlementReport1.setAmountNotPayable(tranSettlementReport1.getAmountIngPayable()-tranSettlementReport1.getAmountEdPayable());
+                //实付金额
+                tranSettlementReport1.setAmountActuallyPaid(Double.valueOf(tranSettlementReport1.getTransportPrice()) * tranSettlementReport1.getSettlementWeight()
+                        - Double.valueOf(tranSettlementReport1.getDeductionAmount() != null ? tranSettlementReport1.getDeductionAmount() : "0") - tranSettlementReport1.getServiceCharge());
+                //税点
+                tranSettlementReport1.setTaxPoint(tranSettlementReport1.getAmountActuallyPaid()/0.946*0.054);
+                //合计应付
+                tranSettlementReport1.setTotalPayable(tranSettlementReport1.getAmountActuallyPaid()+tranSettlementReport1.getTaxPoint());
+                //未付金额
+                Float f = 0.0f;
+                f = tranSettlementReport1.getTotalPayable().floatValue() - tranSettlementReport1.getAmountEdPayable();
+                DecimalFormat df1 = new DecimalFormat("#.00");
+                tranSettlementReport1.setAmountNotPayable(Float.parseFloat(df1.format(f)));
                 //更改汽运结算信息
                 this.updateById(tranSettlementReport1);
                 return "OK";
@@ -280,17 +305,17 @@ public class TranSettlementReportServiceImpl extends ServiceImpl<TranSettlementR
             else{
                 tranSettlementReport1.setServiceCharge(tranSettlementReport.getServiceCharge());
                 //实付金额
-                if(tranSettlementReport1.getDeductionAmount() != null){
-                    tranSettlementReport1.setAmountActuallyPaid(Double.valueOf(tranSettlementReport1.getTransportPrice()) * tranSettlementReport1.getSettlementWeight()
-                            - Double.valueOf(tranSettlementReport.getDeductionAmount()) - tranSettlementReport1.getServiceCharge());
-                }else{
-                    tranSettlementReport1.setAmountActuallyPaid(Double.valueOf(tranSettlementReport1.getTransportPrice()) * tranSettlementReport1.getSettlementWeight()
-                            - tranSettlementReport1.getServiceCharge());
-                }
+                tranSettlementReport1.setAmountActuallyPaid(Double.valueOf(tranSettlementReport1.getTransportPrice()) * tranSettlementReport1.getSettlementWeight()
+                        - Double.valueOf(tranSettlementReport1.getDeductionAmount() != null ? tranSettlementReport1.getDeductionAmount() : "0") - tranSettlementReport1.getServiceCharge());
                 //税点
                 tranSettlementReport1.setTaxPoint(tranSettlementReport1.getAmountActuallyPaid()/0.946*0.054);
                 //合计应付
                 tranSettlementReport1.setTotalPayable(tranSettlementReport1.getAmountActuallyPaid()+tranSettlementReport1.getTaxPoint());
+                //未付金额
+                Float f = 0.0f;
+                f = tranSettlementReport1.getTotalPayable().floatValue() - tranSettlementReport1.getAmountEdPayable();
+                DecimalFormat df1 = new DecimalFormat("#.00");
+                tranSettlementReport1.setAmountNotPayable(Float.parseFloat(df1.format(f)));
                 //更改汽运结算信息
                 this.updateById(tranSettlementReport1);
                 return "OK";