wwt-certificate-tool 1.2.54 → 1.2.56

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/app.html CHANGED
@@ -3,7 +3,7 @@
3
3
  <head>
4
4
  <meta charset="UTF-8">
5
5
  <meta name="viewport" content="width=device-width,initial-scale=1">
6
- <title>WWT 金蝶凭证工具 · 纯前端版 P1.2.54</title>
6
+ <title>WWT 金蝶凭证工具 · 纯前端版 P1.2.56</title>
7
7
  <style>*{box-sizing:border-box;margin:0;padding:0}
8
8
  body{font-family:"Microsoft YaHei","PingFang SC",-apple-system,Segoe UI,sans-serif;font-size:13px;color:#1f2328;background:#f4f6f9;line-height:1.6}
9
9
  h1{font-size:17px;font-weight:600}
@@ -320,7 +320,7 @@ input[data-f="field"][list^="dlGe_"]::placeholder{color:#a8861f;font-style:itali
320
320
  <div class="brand">
321
321
  <span class="logo">WWT</span>
322
322
  <div>
323
- <h1>金蝶凭证工具 <span class="ver">P1.2.54</span></h1>
323
+ <h1>金蝶凭证工具 <span class="ver">P1.2.56</span></h1>
324
324
  <div class="sub">纯前端离线版 · 双击即用 · 数据只存在本机,不上传任何服务器</div>
325
325
  </div>
326
326
  </div>
@@ -332,6 +332,7 @@ input[data-f="field"][list^="dlGe_"]::placeholder{color:#a8861f;font-style:itali
332
332
  <button class="btn ghost" onclick="UI.exportCfg()">📤 导出配置</button>
333
333
  <button class="btn ghost" onclick="UI.importCfg()">📥 导入配置</button>
334
334
  <button class="btn danger ghost" onclick="UI.clearAll()">⚠ 清空全部</button>
335
+ <button class="btn ghost" onclick="UI.clearBiz()" title="只清空本月业务数据表,保留基础数据、规则、映射和配置">🧹 清空业务数据</button>
335
336
  <button class="btn ghost" onclick="UI.checkUpdate()">🔄 检查更新</button>
336
337
  <button class="btn ghost" onclick="UI.setUpdateUrl()">⚙ 更新设置</button>
337
338
  </div>
@@ -1022,6 +1023,24 @@ window.WWT_ENGINE = (function () {
1022
1023
  function round2(x) { return Math.round((num(x) + Number.EPSILON) * 100) / 100; }
1023
1024
  // 繁简归一 + 去空白:业务表是繁体「帐」,规则里可能写简体「账」
1024
1025
  function normPay(s) { return clean(s).replace(/账/g, "帐").replace(/\s+/g, ""); }
1026
+ // 【P1.2.56】合计/小计/总计 行识别:Excel 底部常带一行「合计」,其标识列(单位名称等)会写"合计",
1027
+ // 若参与凭证生成会把这些汇总金额再累加一遍(如 人进价 145万 → 290万)。生成/审核时整行跳过。
1028
+ const TOTAL_KEYWORDS = ["合计", "小计", "总计", "total", "sum"];
1029
+ const TOTAL_LABEL_FIELDS = ["单位名称", "供应商名称", "客户名称", "往来单位", "往来单位名称", "工单号", "出库单号",
1030
+ "入库单号", "合同号", "单号", "名称", "项目", "厂牌", "部门", "存货名称", "物料名称", "商品名称",
1031
+ "收费类型", "单类", "出库单类", "单据类型", "结算方式"];
1032
+ function isTotalRow(row) {
1033
+ if (!row || typeof row !== "object") return false;
1034
+ for (const f of TOTAL_LABEL_FIELDS) {
1035
+ const v = clean(row[f]);
1036
+ if (!v) continue;
1037
+ const lv = v.toLowerCase();
1038
+ for (const kw of TOTAL_KEYWORDS) {
1039
+ if (lv.indexOf(kw.toLowerCase()) >= 0) return true;
1040
+ }
1041
+ }
1042
+ return false;
1043
+ }
1025
1044
  function ciGetObj(t, key) {
1026
1045
  if (!key || !t) return null;
1027
1046
  if (t[key]) return t[key];
@@ -1701,7 +1720,7 @@ window.WWT_ENGINE = (function () {
1701
1720
  const missing = [];
1702
1721
  const usedRows = {}; // src -> Set(index)
1703
1722
  const globalExcludedUsed = {}; // 【P1.2.35】src -> Set(index),全局排除行不进任何规则 rowsIn
1704
- const stats = { rules: 0, rows: 0, vouchers: 0, entries: 0, skipped: [] };
1723
+ const stats = { rules: 0, rows: 0, vouchers: 0, entries: 0, skipped: [], totalRows: 0 };
1705
1724
 
1706
1725
  for (const rule of (opts.rules || [])) {
1707
1726
  if (rule.enabled === false) continue;
@@ -1717,6 +1736,8 @@ window.WWT_ENGINE = (function () {
1717
1736
  for (let i = 0; i < rowsAll.length; i++) {
1718
1737
  if (usedRows[curSrc].has(i)) continue;
1719
1738
  const row = rowsAll[i];
1739
+ // 【P1.2.56】合计/小计/总计 行整行跳过,不进任何规则(避免汇总金额被重复累加)
1740
+ if (isTotalRow(row)) { stats.totalRows++; continue; }
1720
1741
  // 【P1.2.35】全局排除(按业务源分组的总开关):命中行不进任何针对该业务源的规则
1721
1742
  if (isExcludedByGlobals(row, curSrc, idx, globalExcludes)) {
1722
1743
  globalExcludedUsed[curSrc].add(i);
@@ -2082,7 +2103,7 @@ window.WWT_ENGINE = (function () {
2082
2103
  };
2083
2104
  const out = [];
2084
2105
  const missing = [];
2085
- const stats = { rules: 0, rows: 0, vouchers: 0, entries: 0, skipped: [] };
2106
+ const stats = { rules: 0, rows: 0, vouchers: 0, entries: 0, skipped: [], totalRows: 0 };
2086
2107
  if (rowsAll.length) {
2087
2108
  // 直接复用 generate 走一遍,但只跑这一条 rule;为不污染 vstart,每次都重算起始号
2088
2109
  // 这里简单实现:复制 generate 主循环的核心分桶逻辑,但只跑一条 rule
@@ -2091,6 +2112,8 @@ window.WWT_ENGINE = (function () {
2091
2112
  for (let i = 0; i < rowsAll.length; i++) {
2092
2113
  if (usedRows.has(i)) continue;
2093
2114
  const row = rowsAll[i];
2115
+ // 【P1.2.56】合计/小计/总计 行整行跳过,不进 audit 统计(避免汇总金额被重复累加)
2116
+ if (isTotalRow(row)) { stats.totalRows++; continue; }
2094
2117
  // 【P1.2.35】全局排除(按业务源分组的总开关):命中行不进任何 audit 统计
2095
2118
  if (isExcludedByGlobals(row, curSrc, idx, globalExcludes)) continue;
2096
2119
  // 【P1.2.34】规则级排除:跳过 excludeWhen 命中的行
@@ -2540,7 +2563,7 @@ const S = window.__STATE__ = {
2540
2563
  };
2541
2564
 
2542
2565
  /* ---------------- 版本 & 框架自动更新(只更新程序本身,本地数据/规则不动) ---------------- */
2543
- const WWT_VER=(function(){const raw='P1.2.54';return raw.indexOf('__WVER__')>=0?'P1.2.10':raw;})();
2566
+ const WWT_VER=(function(){const raw='P1.2.56';return raw.indexOf('__WVER__')>=0?'P1.2.10':raw;})();
2544
2567
  const UPD_URL_KEY='wwt_fe_updurl';
2545
2568
  // 默认更新源:Gitee 上本项目的 version.json(API 接口,浏览器可直接跨域读)
2546
2569
  const DEFAULT_UPD_URL='https://gitee.com/api/v5/repos/wwtmrhu/certificate-generation/contents/dist/version.json';
@@ -6124,7 +6147,7 @@ window.UI={
6124
6147
  restoreUpgradeBackup:restoreUpgradeBackup, dismissUpgradeBackup:dismissUpgradeBackup,
6125
6148
  showUpgradeHelp:showUpgradeHelp, checkPendingUpgradeBackup:checkPendingUpgradeBackup,
6126
6149
  renderPersistHint:renderPersistHint,
6127
- clearAll:clearAll, switchTab:switchTab,
6150
+ clearAll:clearAll, clearBiz:clearBiz, switchTab:switchTab,
6128
6151
  };
6129
6152
 
6130
6153
  if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',init);
package/dist/version.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
- "ver": "P1.2.54",
3
- "npm": "1.2.54",
4
- "url": "https://cdn.jsdelivr.net/npm/wwt-certificate-tool@1.2.54/dist/app.html",
5
- "url_unpkg": "https://unpkg.com/wwt-certificate-tool@1.2.54/dist/app.html",
6
- "url_gh": "https://api.github.com/repos/huweipei745839/certificate-generation/contents/dist/WWT%E5%87%AD%E8%AF%81%E5%B7%A5%E5%85%B7_P1.2.54.html",
7
- "note": "① 内置默认基础表/规则/映射:新安装或分享打开即自带当前这套标准配置。② 生成凭证后实际生成了凭证的规则自动变绿并显示「已生成」徽章,状态持久化。③ 新增「清空已生成」按钮。④ 凭证起始号放到「④ 生成凭证」页生成栏。⑤ 对碰检测跳过未结算单据,缺失清单增加「单号」与「付款方式/结算方式」列。⑥ 凭证审核表「核算维度」列移到「科目名称」后。⑦ 【P1.2.54】分录级拆分字段:每条分录可单独设置拆分字段,实现一张凭证内借方按单号拆、贷方汇总等混合拆分。"
2
+ "ver": "P1.2.56",
3
+ "npm": "1.2.56",
4
+ "url": "https://cdn.jsdelivr.net/npm/wwt-certificate-tool@1.2.56/dist/app.html",
5
+ "url_unpkg": "https://unpkg.com/wwt-certificate-tool@1.2.56/dist/app.html",
6
+ "url_gh": "https://api.github.com/repos/huweipei745839/certificate-generation/contents/dist/WWT%E5%87%AD%E8%AF%81%E5%B7%A5%E5%85%B7_P1.2.56.html",
7
+ "note": "① 内置默认基础表/规则/映射:新安装或分享打开即自带当前这套标准配置。② 生成凭证后实际生成了凭证的规则自动变绿并显示「已生成」徽章,状态持久化。③ 新增「清空已生成」按钮。④ 凭证起始号放到「④ 生成凭证」页生成栏。⑤ 对碰检测跳过未结算单据,缺失清单增加「单号」与「付款方式/结算方式」列。⑥ 凭证审核表「核算维度」列移到「科目名称」后。⑦ 分录级拆分字段:每条分录可单独设置拆分字段,实现一张凭证内借方按单号拆、贷方汇总等混合拆分。⑧ 【P1.2.55】顶部工具栏增加「清空业务数据」按钮,只清本月业务数据表,保留基础数据、规则、映射和配置。⑨ 【P1.2.56】生成/审核自动跳过 Excel 底部的「合计/小计/总计」行,避免汇总金额被重复累加(如 人进价 145万 → 280万 的翻倍问题);合计行在编辑器内仍可见、只是不参与凭证生成。"
8
8
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wwt-certificate-tool",
3
- "version": "1.2.54",
3
+ "version": "1.2.56",
4
4
  "description": "WWT 金蝶凭证工具 · 纯前端版(离线单文件 HTML,双击即用)",
5
5
  "keywords": [
6
6
  "WWT",