ソースを参照

金额税额改为校验总金额

yaoyu 1 年間 前
コミット
a2d845c6a1

+ 18 - 13
arap/arap/src/public/nc/bs/arap/actions/BillUpdateBatchBSAction.java

@@ -168,22 +168,24 @@ public abstract class BillUpdateBatchBSAction extends UpdateBatchBSAction {
 		ArapBusiLogUtils.insertSmartBusiLogs(ArapConstant.ARAP_ACTION_EDIT, (BaseAggVO) bills[0], (BaseAggVO) orginBills[0], ArapConstant.SYS_NAME);
 		String top_billid = (String) bills[0].getChildrenVO()[0].getAttributeValue("top_billid");
 		if(top_billid != null) {
-			//String pk_tradetypeid = (String) bills[0].getParentVO().getAttributeValue("pk_tradetypeid");
-			//String sql = "select pk_billtypecode from bd_billtype where pk_billtypeid = '"+pk_tradetypeid+"'";
-			//String type = (String) iuap.executeQuery(sql, new ColumnProcessor());
 			//2023/10/11 YY 校验应付单金额与采购发票是否一致
 			String pk_billtype = (String) bills[0].getParentVO().getAttributeValue("pk_billtype");
 			//if("F1-Cxx-02".equals(type) || "D1".equals(type) || "F1-Cxx-04".equals(type) || "F1-Cxx-05".equals(type)) {
 			if("F1".equals(pk_billtype)) {
 				PayableBillItemVO[] payableBillItemVO = (PayableBillItemVO[]) bills[0].getChildrenVO();
+				//应付总金额
+				UFDouble local_notax_cr = new UFDouble(0.00);
+				//应付总税额
+				UFDouble local_tax_cr = new UFDouble(0.00);
+				//采购发票总金额
+				UFDouble znmny = new UFDouble(0.00);
+				//采购发票总税额
+				UFDouble zntax = new UFDouble(0.00);
 				for (int j = 0; j < payableBillItemVO.length; j++) {
 					String def12 = payableBillItemVO[j].getDef12();
 					//没有发票号的行不进行金额校验
 					if(def12 != null) {
-						//金额
-						UFDouble local_notax_cr = new UFDouble(0.00);
-						//税额
-						UFDouble local_tax_cr = new UFDouble(0.00);
+						
 						//价税合计
 						UFDouble local_money_cr = new UFDouble(0.00);
 						for (int x = 0; x < payableBillItemVO.length; x++) {							
@@ -203,14 +205,10 @@ public abstract class BillUpdateBatchBSAction extends UpdateBatchBSAction {
 						UFDouble nmny = new UFDouble(map.get("nmny").toString());
 						//税额
 						UFDouble ntax = new UFDouble(map.get("ntax").toString());
+						znmny = znmny.add(nmny);
+						zntax = zntax.add(ntax);
 						//价税合计
 						UFDouble ntotalorigmny = new UFDouble(map.get("norigtaxmny").toString());
-						if(local_notax_cr.compareTo(new UFDouble(nmny)) != 0) {
-						throw new BusinessException("发票号:"+def12+"与采购发票金额不一致!");
-						}
-						if(local_tax_cr.compareTo(new UFDouble(ntax)) != 0) {
-						throw new BusinessException("发票号:"+def12+"与采购发票税额不一致!");
-						}
 						if(local_money_cr.compareTo(new UFDouble(ntotalorigmny)) != 0) {
 						throw new BusinessException("发票号:"+def12+"与采购发票价税合计不一致!");
 						}
@@ -230,6 +228,13 @@ public abstract class BillUpdateBatchBSAction extends UpdateBatchBSAction {
 						}
 					}
 				}
+				//金额税额只比较总额
+				if(local_notax_cr.compareTo(new UFDouble(znmny)) != 0) {
+					throw new BusinessException("与采购发票金额不一致!");
+				}
+				if(local_tax_cr.compareTo(new UFDouble(zntax)) != 0) {
+					throw new BusinessException("与采购发票税额不一致!");
+				}
 			}
 		}
 	}