From 15de9f612d1445de41f8a600e297ce95e40b0c82 Mon Sep 17 00:00:00 2001 From: CRM8000 Date: Fri, 22 Nov 2024 09:57:24 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=B0=E8=B4=A6=E5=87=AD=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SLN0002/DAO/VoucherDAO.class.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/web/Application/SLN0002/DAO/VoucherDAO.class.php b/web/Application/SLN0002/DAO/VoucherDAO.class.php index 62e0198c..5aa4e917 100644 --- a/web/Application/SLN0002/DAO/VoucherDAO.class.php +++ b/web/Application/SLN0002/DAO/VoucherDAO.class.php @@ -233,6 +233,24 @@ class VoucherDAO extends PSIBaseExDAO $billNumber = 0; } + $ignoreBalance = intval($bill["ignoreBalance"]) == 1; + if (!$ignoreBalance) { + // 检查分录金额合计是否相等 + $items = $bill["items"]; + $dbSum = 0; + $crSum = 0; + foreach ($items as $v) { + $debit = floatval($v["debit"]); + $credit = floatval($v["credit"]); + + $dbSum += $debit; + $crSum += $credit; + } + if ($dbSum != $crSum) { + return $this->bad("分录金额合计不平,无法保存凭证"); + } + } + // 检查orgId $sql = "select name from t_org