wwt-certificate-tool 1.2.69 → 1.2.71

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.69</title>
6
+ <title>WWT 金蝶凭证工具 · 纯前端版 P1.2.71</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}
@@ -328,7 +328,7 @@ input[data-f="field"][list^="dlGe_"]::placeholder{color:#a8861f;font-style:itali
328
328
  <div class="brand">
329
329
  <span class="logo">WWT</span>
330
330
  <div>
331
- <h1>金蝶凭证工具 <span class="ver">P1.2.69</span></h1>
331
+ <h1>金蝶凭证工具 <span class="ver">P1.2.71</span></h1>
332
332
  <div class="sub">纯前端离线版 · 双击即用 · 数据只存在本机,不上传任何服务器</div>
333
333
  </div>
334
334
  </div>
@@ -1083,10 +1083,11 @@ window.WWT_ENGINE = (function () {
1083
1083
  if (!row || typeof row !== "object") return false;
1084
1084
  const fields = TOTAL_LABEL_FIELDS.concat(Object.keys(row).filter(k => TOTAL_LABEL_FIELDS.indexOf(k) < 0));
1085
1085
  // 法一:任意字段含 合计/小计/总计/total/sum(含写在摘要/备注/类型等非标识列的情况)
1086
+ // 某些 Excel 合计格会把「合计」写成「 合 计」之类带空格,先去掉全部空白再匹配。
1086
1087
  for (const f of fields) {
1087
1088
  const v = clean(row[f]);
1088
1089
  if (!v) continue;
1089
- const lv = v.toLowerCase();
1090
+ const lv = v.replace(/\s+/g, '').toLowerCase();
1090
1091
  for (const kw of TOTAL_KEYWORDS) {
1091
1092
  if (lv.indexOf(kw.toLowerCase()) >= 0) return true;
1092
1093
  }
@@ -2709,7 +2710,7 @@ const S = window.__STATE__ = {
2709
2710
  };
2710
2711
 
2711
2712
  /* ---------------- 版本 & 框架自动更新(只更新程序本身,本地数据/规则不动) ---------------- */
2712
- const WWT_VER=(function(){const raw='P1.2.69';return raw.indexOf('__WVER__')>=0?'P1.2.10':raw;})();
2713
+ const WWT_VER=(function(){const raw='P1.2.71';return raw.indexOf('__WVER__')>=0?'P1.2.10':raw;})();
2713
2714
  const UPD_URL_KEY='wwt_fe_updurl';
2714
2715
  // 默认更新源:Gitee 上本项目的 version.json(API 接口,浏览器可直接跨域读)
2715
2716
  const DEFAULT_UPD_URL='https://gitee.com/api/v5/repos/wwtmrhu/certificate-generation/contents/dist/version.json';
@@ -4790,26 +4791,62 @@ function previewRule(ruleId){
4790
4791
  h+='<div style="color:#8b949e;padding:8px">本规则没生成任何凭证('+esc(r0.candidate_in_source?'无候选行':'源表是空的')+')。</div>';
4791
4792
  }else{
4792
4793
  // 【P1.2.48】凭证预览表格改为金蝶式「核算维度」单列
4794
+ // 【P1.2.70】增加「借/贷合计数」:多证时每证小计 + 整表合计 + 借贷平衡检验
4793
4795
  let previewMissingDims=[];
4796
+ // 【P1.2.70】新增借/贷合计数(见下方整表合计 tfoot + 信息行)
4797
+ const _r2=x=>Math.round(x*100)/100;
4798
+ let totDeb=0, totCre=0, prevVno=null, subDeb=0, subCre=0;
4799
+ const showSub=(pvStats.vouchers||0)>1;
4800
+ const tbodyRows=[];
4801
+ for(let i=0;i<pvRows.length;i++){
4802
+ const e=pvRows[i];
4803
+ const dim=formatDimensions(e);
4804
+ if(dim.missingDims.length) previewMissingDims=previewMissingDims.concat(dim.missingDims);
4805
+ const hasMissing=e['_缺失编码'] || dim.missingDims.length>0;
4806
+ const d=E.num(e['借方金额']), c=E.num(e['贷方金额']);
4807
+ totDeb+=d; totCre+=c;
4808
+ if(showSub && prevVno!==null && e['凭证号']!==prevVno){
4809
+ const sd=subDeb, sc=subCre, sv=prevVno, sdiff=_r2(sd-sc);
4810
+ tbodyRows.push('<tr style="background:#f5f7fa;font-weight:600">'+
4811
+ '<td colspan="5" style="color:#57606a">└ 凭证 '+esc(sv)+' 小计</td>'+
4812
+ '<td class="num">'+fmt(sd)+'</td><td class="num">'+fmt(sc)+'</td>'+
4813
+ '<td'+(Math.abs(sdiff)<0.005?'':' style="color:#a40e26;font-weight:700"')+'>'+
4814
+ (Math.abs(sdiff)<0.005?'✅ 平衡':'⚠ 差额 '+fmt(sdiff))+'</td></tr>');
4815
+ subDeb=0; subCre=0;
4816
+ }
4817
+ prevVno=e['凭证号']; subDeb+=d; subCre+=c;
4818
+ tbodyRows.push('<tr'+(hasMissing?' class="bad"':'')+'>'+
4819
+ '<td><b>'+esc(e['凭证号'])+'</b></td><td>'+esc(e['分录序号'])+'</td>'+
4820
+ '<td>'+esc(e['业务日期']||'')+'</td><td>'+esc((e['摘要']||'').slice(0,40))+'</td>'+
4821
+ '<td><b>'+esc(e['科目编码'])+'</b> '+esc(e['科目名称']||'')+'</td>'+
4822
+ '<td class="num">'+(e['借方金额']?fmt(e['借方金额']):'')+'</td>'+
4823
+ '<td class="num">'+(e['贷方金额']?fmt(e['贷方金额']):'')+'</td>'+
4824
+ '<td>'+dim.html+'</td></tr>');
4825
+ }
4826
+ if(showSub && prevVno!==null){
4827
+ const sdiff=_r2(subDeb-subCre);
4828
+ tbodyRows.push('<tr style="background:#f5f7fa;font-weight:600">'+
4829
+ '<td colspan="5" style="color:#57606a">└ 凭证 '+esc(prevVno)+' 小计</td>'+
4830
+ '<td class="num">'+fmt(subDeb)+'</td><td class="num">'+fmt(subCre)+'</td>'+
4831
+ '<td'+(Math.abs(sdiff)<0.005?'':' style="color:#a40e26;font-weight:700"')+'>'+
4832
+ (Math.abs(sdiff)<0.005?'✅ 平衡':'⚠ 差额 '+fmt(sdiff))+'</td></tr>');
4833
+ }
4834
+ const gDiff=_r2(totDeb-totCre);
4794
4835
  h+='<div class="tablewrap" style="max-height:340px"><table><thead><tr>'+
4795
4836
  '<th>凭证号</th><th>分录序号</th><th>业务日期</th><th>摘要</th><th>科目</th><th>借方</th><th>贷方</th>'+
4796
- '<th>核算维度</th></tr></thead><tbody>'+
4797
- pvRows.map(e=>{
4798
- const dim=formatDimensions(e);
4799
- if(dim.missingDims.length) previewMissingDims=previewMissingDims.concat(dim.missingDims);
4800
- const hasMissing=e['_缺失编码'] || dim.missingDims.length>0;
4801
- return '<tr'+(hasMissing?' class="bad"':'')+'>'+
4802
- '<td><b>'+esc(e['凭证号'])+'</b></td><td>'+esc(e['分录序号'])+'</td>'+
4803
- '<td>'+esc(e['业务日期']||'')+'</td><td>'+esc((e['摘要']||'').slice(0,40))+'</td>'+
4804
- '<td><b>'+esc(e['科目编码'])+'</b> '+esc(e['科目名称']||'')+'</td>'+
4805
- '<td class="num">'+(e['借方金额']?fmt(e['借方金额']):'')+'</td>'+
4806
- '<td class="num">'+(e['贷方金额']?fmt(e['贷方金额']):'')+'</td>'+
4807
- '<td>'+dim.html+'</td></tr>';
4808
- }).join('')+
4809
- '</tbody></table></div>';
4837
+ '<th>核算维度</th></tr></thead><tbody>'+tbodyRows.join('')+'</tbody>'+
4838
+ '<tfoot><tr style="background:#eef2f7;font-weight:700;border-top:2px solid #c9d2dc">'+
4839
+ '<td colspan="5">整表合计('+pvRows.length+' 条分录 / '+pvStats.vouchers+' 张凭证)</td>'+
4840
+ '<td class="num">'+fmt(totDeb)+'</td><td class="num">'+fmt(totCre)+'</td>'+
4841
+ '<td'+(Math.abs(gDiff)<0.005?' style="color:#0a7d28"':' style="color:#a40e26"')+'>'+
4842
+ (Math.abs(gDiff)<0.005?'✅ 借贷平衡':'⚠ 差额 '+fmt(gDiff))+'</td></tr></tfoot>'+
4843
+ '</table></div>';
4810
4844
  const previewMissingSet=previewMissingDims.filter((v,i,a)=>a.indexOf(v)===i);
4811
4845
  h+='<div style="margin-top:5px;color:#57606a;font-size:12px">共 <b>'+pvStats.vouchers+'</b> 张凭证,<b>'+
4812
4846
  pvStats.entries+'</b> 条分录'+
4847
+ ' · <b>借方合计 <span style="color:#0a7d28">'+fmt(totDeb)+'</span></b>'+
4848
+ ' · <b>贷方合计 <span style="color:#0a7d28">'+fmt(totCre)+'</span></b>'+
4849
+ (Math.abs(gDiff)<0.005?' · <span style="color:#0a7d28">✅ 借贷平衡</span>':' · <b style="color:#a40e26">⚠ 差额 '+fmt(gDiff)+'</b>')+
4813
4850
  (previewMissingSet.length?' · <b style="color:#a40e26">'+previewMissingSet.length+' 个维度缺编码('+
4814
4851
  previewMissingSet.join('、')+')</b>':' · 无编码缺失')+
4815
4852
  ')。预览不修改任何数据,关闭即丢。</div>';
package/dist/version.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
- "ver": "P1.2.69",
3
- "npm": "1.2.69",
4
- "url": "https://cdn.jsdelivr.net/npm/wwt-certificate-tool@1.2.69/dist/app.html",
5
- "url_unpkg": "https://unpkg.com/wwt-certificate-tool@1.2.69/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.69.html",
7
- "note": "㉒ 【P1.2.69】修复规则命中顶层条件但分支未覆盖(且无默认分录行)的行被静默吞掉:这些行不再计入「已命中/已覆盖」,也不占用 usedRows;auditRule 新增 branch_missed 统计,规则预览弹窗显式提示「命中条件但无分支/分录匹配 X 行」及金额,避免用户误以为「应处理子集全部命中」。"
2
+ "ver": "P1.2.71",
3
+ "npm": "1.2.71",
4
+ "url": "https://cdn.jsdelivr.net/npm/wwt-certificate-tool@1.2.71/dist/app.html",
5
+ "url_unpkg": "https://unpkg.com/wwt-certificate-tool@1.2.71/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.71.html",
7
+ "note": "㉔ 【P1.2.71】修复合计行识别:单元格内「合」「计」或「小」「计」之间有空格(如 Excel 底部「 合 计 」「 小 计 」)时也能正确识别并跳过,避免汇总金额被重复累加。"
8
8
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wwt-certificate-tool",
3
- "version": "1.2.69",
3
+ "version": "1.2.71",
4
4
  "description": "WWT 金蝶凭证工具 · 纯前端版(离线单文件 HTML,双击即用)",
5
5
  "keywords": [
6
6
  "WWT",