wwt-certificate-tool 1.2.52 → 1.2.54
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 +33 -18
- package/dist/version.json +6 -6
- package/package.json +1 -1
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.
|
|
6
|
+
<title>WWT 金蝶凭证工具 · 纯前端版 P1.2.54</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.
|
|
323
|
+
<h1>金蝶凭证工具 <span class="ver">P1.2.54</span></h1>
|
|
324
324
|
<div class="sub">纯前端离线版 · 双击即用 · 数据只存在本机,不上传任何服务器</div>
|
|
325
325
|
</div>
|
|
326
326
|
</div>
|
|
@@ -1611,6 +1611,14 @@ window.WWT_ENGINE = (function () {
|
|
|
1611
1611
|
return raw.split(/[+,,]/).map(s => s.trim()).filter(Boolean);
|
|
1612
1612
|
}
|
|
1613
1613
|
|
|
1614
|
+
// 【P1.2.54】分录级拆分字段:每条分录可单独指定 lineSplitBy;空表示跟随规则级 lineSplitBy
|
|
1615
|
+
function splitFieldsOfLine(line, rule) {
|
|
1616
|
+
const raw = clean(line && line.lineSplitBy);
|
|
1617
|
+
if (raw === "-") return []; // 显式写 "-" 表示本行强制不拆分(覆盖规则级)
|
|
1618
|
+
if (!raw) return splitFieldsOf(rule);
|
|
1619
|
+
return raw.split(/[+,,]/).map(s => s.trim()).filter(Boolean);
|
|
1620
|
+
}
|
|
1621
|
+
|
|
1614
1622
|
/* ---------------- 分支选取 ---------------- */
|
|
1615
1623
|
function resolveEffectiveLines(rule, row, curSrc, idx) {
|
|
1616
1624
|
const branches = rule.branches || [];
|
|
@@ -1767,14 +1775,14 @@ window.WWT_ENGINE = (function () {
|
|
|
1767
1775
|
|
|
1768
1776
|
// Step B:sub_bucket = group_key值 × 分支lines
|
|
1769
1777
|
// 【P1.2.40】全部汇总且按非单位名称字段拆证时,取消子桶按单位名称细分,实现真正的按该字段汇总
|
|
1770
|
-
// 【P1.2.
|
|
1778
|
+
// 【P1.2.54】sub_bucket 不再按拆分字段细分;拆分粒度下沉到每条分录行的 groups 阶段,
|
|
1779
|
+
// 这样同一张凭证内可以「借方按单号拆、贷方汇总」等混合拆分需求。
|
|
1771
1780
|
const groupKeyField = (genMode === "一对一" || splitFs.length > 0) ? null :
|
|
1772
1781
|
(genMode === "全部汇总" && gb && gb !== "单位名称") ? null : "单位名称";
|
|
1773
1782
|
const subMap = new Map();
|
|
1774
1783
|
for (const it of bucket) {
|
|
1775
1784
|
const gv = groupKeyField ? (clean(it.row[groupKeyField]) || "(空)") : "";
|
|
1776
|
-
const
|
|
1777
|
-
const k = JSON.stringify([gv, splitT, linesKey(it._lines)]);
|
|
1785
|
+
const k = JSON.stringify([gv, linesKey(it._lines)]);
|
|
1778
1786
|
if (!subMap.has(k)) subMap.set(k, { gv: gv, lines: it._lines, items: [], acct: {} });
|
|
1779
1787
|
subMap.get(k).items.push(it);
|
|
1780
1788
|
}
|
|
@@ -1803,10 +1811,12 @@ window.WWT_ENGINE = (function () {
|
|
|
1803
1811
|
const line = sub.lines[li];
|
|
1804
1812
|
if (isAutoDiff(line)) continue;
|
|
1805
1813
|
const groups = new Map();
|
|
1814
|
+
// 【P1.2.54】本行拆分字段优先于规则级;空表示跟随规则级(兼容旧规则)
|
|
1815
|
+
const lineSplitFs = splitFieldsOfLine(line, rule);
|
|
1806
1816
|
for (const it of sub.items) {
|
|
1807
1817
|
const dv = calcDimValues(line, it.row, curSrc, idx, sub);
|
|
1808
1818
|
const subj = leafSubject(line.subject, it.row, dv, curSrc, idx);
|
|
1809
|
-
const splitT =
|
|
1819
|
+
const splitT = lineSplitFs.map(f => clean(it.row[f]));
|
|
1810
1820
|
const dimKey = Object.keys(dv).sort().map(d => [d, dv[d].name]);
|
|
1811
1821
|
const gkey = JSON.stringify([subj, dimKey, splitT]);
|
|
1812
1822
|
if (!groups.has(gkey)) {
|
|
@@ -1814,7 +1824,7 @@ window.WWT_ENGINE = (function () {
|
|
|
1814
1824
|
}
|
|
1815
1825
|
const g = groups.get(gkey);
|
|
1816
1826
|
g.sgn += sumAmtExpr(it.row, line.amountField);
|
|
1817
|
-
|
|
1827
|
+
lineSplitFs.forEach((f, fi) => {
|
|
1818
1828
|
const v = splitT[fi];
|
|
1819
1829
|
if (v) { if (!g.vals[f]) g.vals[f] = []; if (g.vals[f].indexOf(v) < 0) g.vals[f].push(v); }
|
|
1820
1830
|
});
|
|
@@ -2157,16 +2167,18 @@ window.WWT_ENGINE = (function () {
|
|
|
2157
2167
|
const line = sub.lines[li];
|
|
2158
2168
|
if (isAutoDiff(line)) continue;
|
|
2159
2169
|
const groups = new Map();
|
|
2170
|
+
// 【P1.2.54】本行拆分字段优先于规则级;空表示跟随规则级(兼容旧规则)
|
|
2171
|
+
const lineSplitFs = splitFieldsOfLine(line, r);
|
|
2160
2172
|
for (const it of sub.items) {
|
|
2161
2173
|
const dv = calcDimValues(line, it.row, curSrc, idx, sub);
|
|
2162
2174
|
const subj = leafSubject(line.subject, it.row, dv, curSrc, idx);
|
|
2163
|
-
const splitT =
|
|
2175
|
+
const splitT = lineSplitFs.map(f => clean(it.row[f]));
|
|
2164
2176
|
const dimKey = Object.keys(dv).sort().map(d => [d, dv[d].name]);
|
|
2165
2177
|
const gkey = JSON.stringify([subj, dimKey, splitT]);
|
|
2166
2178
|
if (!groups.has(gkey)) groups.set(gkey, { subj: subj, dv: dv, sgn: 0, vals: {}, first: it });
|
|
2167
2179
|
const g = groups.get(gkey);
|
|
2168
2180
|
g.sgn += sumAmtExpr(it.row, line.amountField);
|
|
2169
|
-
|
|
2181
|
+
lineSplitFs.forEach((f, fi) => {
|
|
2170
2182
|
const v = splitT[fi];
|
|
2171
2183
|
if (v) { if (!g.vals[f]) g.vals[f] = []; if (g.vals[f].indexOf(v) < 0) g.vals[f].push(v); }
|
|
2172
2184
|
});
|
|
@@ -2469,7 +2481,7 @@ window.WWT_ENGINE = (function () {
|
|
|
2469
2481
|
});
|
|
2470
2482
|
totalRows += checked.length;
|
|
2471
2483
|
|
|
2472
|
-
const push = (dimName, val, kind, hint, billNo) => {
|
|
2484
|
+
const push = (dimName, val, kind, hint, billNo, pay) => {
|
|
2473
2485
|
if (!val) return;
|
|
2474
2486
|
let code = "";
|
|
2475
2487
|
if (kind === "客户" || kind === "供应商") {
|
|
@@ -2479,7 +2491,7 @@ window.WWT_ENGINE = (function () {
|
|
|
2479
2491
|
if (!code) {
|
|
2480
2492
|
missCount++;
|
|
2481
2493
|
byDim[dimName] = (byDim[dimName] || 0) + 1;
|
|
2482
|
-
res.push({ 来源单据: src, 维度: dimName, 名称: val, 单号: billNo || '', 建议: hint });
|
|
2494
|
+
res.push({ 来源单据: src, 维度: dimName, 名称: val, 单号: billNo || '', '付款方式/结算方式': pay || '', 建议: hint });
|
|
2483
2495
|
}
|
|
2484
2496
|
};
|
|
2485
2497
|
|
|
@@ -2489,7 +2501,8 @@ window.WWT_ENGINE = (function () {
|
|
|
2489
2501
|
if (party) {
|
|
2490
2502
|
const dimName = meta.partytype === "供应商" ? "供应商" : "客户";
|
|
2491
2503
|
const billNo = clean(r[meta.no]) || clean(r["原单号"]);
|
|
2492
|
-
|
|
2504
|
+
const pay = clean(r["付款方式"]) || clean(r["支付方式"]) || clean(r["结算方式"]);
|
|
2505
|
+
push(dimName, party, dimName, suggest[dimName], billNo, pay);
|
|
2493
2506
|
}
|
|
2494
2507
|
}
|
|
2495
2508
|
}
|
|
@@ -2527,7 +2540,7 @@ const S = window.__STATE__ = {
|
|
|
2527
2540
|
};
|
|
2528
2541
|
|
|
2529
2542
|
/* ---------------- 版本 & 框架自动更新(只更新程序本身,本地数据/规则不动) ---------------- */
|
|
2530
|
-
const WWT_VER=(function(){const raw='P1.2.
|
|
2543
|
+
const WWT_VER=(function(){const raw='P1.2.54';return raw.indexOf('__WVER__')>=0?'P1.2.10':raw;})();
|
|
2531
2544
|
const UPD_URL_KEY='wwt_fe_updurl';
|
|
2532
2545
|
// 默认更新源:Gitee 上本项目的 version.json(API 接口,浏览器可直接跨域读)
|
|
2533
2546
|
const DEFAULT_UPD_URL='https://gitee.com/api/v5/repos/wwtmrhu/certificate-generation/contents/dist/version.json';
|
|
@@ -4138,6 +4151,7 @@ function lineHTML(bi,li,l){
|
|
|
4138
4151
|
'<div class="row"><select class="w60" data-lf="side">'+sideOpts+'</select>'+
|
|
4139
4152
|
'<span class="w60">科目</span><input class="w140" data-lf="subject" value="'+esc(l.subject||'')+'" placeholder="如 1122 / 6002" list="dlSubjects" title="可下拉选会计科目表里的编码;也可手动输入">'+
|
|
4140
4153
|
'<span class="w60">金额</span><input class="w180" data-lf="amountField" value="'+esc(l.amountField||'')+'" placeholder="实收金额+折扣费 / -折扣费 / 金额*0.13 / 金额/数量" list="dlAmountFields" title="支持四则运算与括号:字段名/数字常量;可下拉选「__AUTO_DIFF__」自动补差额;例:实收金额+折扣费、-折扣费、金额*0.13">'+
|
|
4154
|
+
'<span class="w70" style="margin-left:8px">本行拆分</span><input class="w120" data-lf="lineSplitBy" value="'+esc(l.lineSplitBy||'')+'" placeholder="空=跟随规则" title="空=使用规则级拆分字段;填字段名=本行单独按该字段拆分;填 - = 本行强制不拆分">'+
|
|
4141
4155
|
'<button class="mini del" onclick="UI.delRow(this,\'linerow\')">删除分录</button></div>'+
|
|
4142
4156
|
'<div class="row"><span class="w60">摘要</span><input class="grow" data-lf="summary" value="'+esc(l.summary||'')+'" placeholder="{单位名称}{收入板块}对帐S{原单号}"></div>'+
|
|
4143
4157
|
'<div style="font-size:11.5px;color:#57606a;margin:3px 0">辅助核算维度:</div>'+
|
|
@@ -4194,6 +4208,7 @@ function collectLines(rows){
|
|
|
4194
4208
|
}).filter(a=>a.dim);
|
|
4195
4209
|
return {side:g('side').value,subject:g('subject').value.trim(),
|
|
4196
4210
|
amountField:g('amountField').value.trim(),summary:g('summary').value.trim(),
|
|
4211
|
+
lineSplitBy:g('lineSplitBy')?g('lineSplitBy').value.trim():'',
|
|
4197
4212
|
auxiliaries:auxs};
|
|
4198
4213
|
});
|
|
4199
4214
|
}
|
|
@@ -4581,8 +4596,8 @@ function exportRulePreview(){
|
|
|
4581
4596
|
* ⑤ 凭证审核
|
|
4582
4597
|
* ============================================================ */
|
|
4583
4598
|
// 【P1.2.48】审核表格把客户/供应商/部门/员工/仓库/收入类型/成本类型等合并成「核算维度」单列
|
|
4584
|
-
const AUD_COLS=['凭证号','分录序号','记账日期','业务日期','摘要','科目编码','科目名称','借方金额','贷方金额',
|
|
4585
|
-
'
|
|
4599
|
+
const AUD_COLS=['凭证号','分录序号','记账日期','业务日期','摘要','科目编码','科目名称','核算维度','借方金额','贷方金额',
|
|
4600
|
+
'结算方式名称','来源单据','规则名称'];
|
|
4586
4601
|
const AUD_NUM=['借方金额','贷方金额'];
|
|
4587
4602
|
let audPage=1;
|
|
4588
4603
|
/** S.draft 里"分组来源":cv_upload | 业务源 key(如 销售已确认) */
|
|
@@ -4741,9 +4756,9 @@ function runDetect(){
|
|
|
4741
4756
|
(Object.keys(r.byDim).length?'('+Object.entries(r.byDim).map(x=>esc(x[0])+' '+x[1]).join('、')+')':'');
|
|
4742
4757
|
let h='';
|
|
4743
4758
|
if(r.rows.length){
|
|
4744
|
-
h='<table><thead><tr><th>来源单据</th><th>维度</th><th>业务里的名称</th><th>单号</th><th>建议</th></tr></thead><tbody>'+
|
|
4759
|
+
h='<table><thead><tr><th>来源单据</th><th>维度</th><th>业务里的名称</th><th>单号</th><th>付款方式/结算方式</th><th>建议</th></tr></thead><tbody>'+
|
|
4745
4760
|
r.rows.slice(0,500).map(x=>'<tr><td>'+esc(x.来源单据)+'</td><td>'+esc(x.维度)+'</td><td><b>'+esc(x.名称)+'</b></td>'+
|
|
4746
|
-
'<td>'+esc(x.单号||'-')+'</td><td style="color:#8b949e">'+esc(x.建议)+'</td></tr>').join('')+'</tbody></table>';
|
|
4761
|
+
'<td>'+esc(x.单号||'-')+'</td><td>'+esc(x['付款方式/结算方式']||'-')+'</td><td style="color:#8b949e">'+esc(x.建议)+'</td></tr>').join('')+'</tbody></table>';
|
|
4747
4762
|
$('btnDlMissing').style.display='';
|
|
4748
4763
|
}else h='<div class="notice">✅ 全部对得上,没有缺失。</div>';
|
|
4749
4764
|
$('checkWrap').innerHTML=h;
|
|
@@ -4873,7 +4888,7 @@ function dlMissing(){
|
|
|
4873
4888
|
const aoa=[C.MISSING_HEAD].concat(S.missing.map(m=>C.MISSING_HEAD.map(h=>m[h]||'')));
|
|
4874
4889
|
aoaToXlsx([aoa],['缺失编码清单'],'缺失编码清单.xlsx');
|
|
4875
4890
|
}else{
|
|
4876
|
-
const aoa=[['来源单据','维度','业务里的名称','单号','建议']].concat(S.checkRows.map(x=>[x.来源单据,x.维度,x.名称,x.单号||'',x.建议]));
|
|
4891
|
+
const aoa=[['来源单据','维度','业务里的名称','单号','付款方式/结算方式','建议']].concat(S.checkRows.map(x=>[x.来源单据,x.维度,x.名称,x.单号||'',x['付款方式/结算方式']||'',x.建议]));
|
|
4877
4892
|
aoaToXlsx([aoa],['缺失清单'],'缺失编码清单.xlsx');
|
|
4878
4893
|
}
|
|
4879
4894
|
}
|
package/dist/version.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
-
"ver": "P1.2.
|
|
3
|
-
"npm": "1.2.
|
|
4
|
-
"url": "https://cdn.jsdelivr.net/npm/wwt-certificate-tool@1.2.
|
|
5
|
-
"url_unpkg": "https://unpkg.com/wwt-certificate-tool@1.2.
|
|
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.
|
|
7
|
-
"note": "① 内置默认基础表/规则/映射:新安装或分享打开即自带当前这套标准配置。② 生成凭证后实际生成了凭证的规则自动变绿并显示「已生成」徽章,状态持久化。③ 新增「清空已生成」按钮。④ 凭证起始号放到「④ 生成凭证」页生成栏。⑤ 【P1.2.
|
|
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】分录级拆分字段:每条分录可单独设置拆分字段,实现一张凭证内借方按单号拆、贷方汇总等混合拆分。"
|
|
8
8
|
}
|