支持耳钉货盘克重与对数同步库存及历史盘点基准
This commit is contained in:
1 parent
ba15795f0a
commit
b6a0213a0c
28 files changed
+906
-161
No files matched your search
@@ -70,6 +70,7 @@ function orderChangeLineValue(line,kind){
|
||||
if(kind==='quantity')return line.unit==='g'?grams(line.quantity)+'g':String(line.quantity)+'件';
|
||||
if(kind==='sale')return money(line.sale);
|
||||
if(kind==='pricing')return line.goldPrice!=null?`销售金价 ${money(line.goldPrice)}/克\n${line.laborMode==='gram'?'销售克工费':'销售件工费'} ${money(line.laborRate)}${line.laborMode==='gram'?'/克':'/件'}\n件数 ${line.pieces??'未填写'}`:`手填基础金额 ${money(line.baseSale??line.sale)}`;
|
||||
if(kind==='stockCount')return Number.isSafeInteger(line.stockCount)||pocketCountsEnabled(line.pocket)?stockCountText(line.stockCount):'不记录对数';
|
||||
if(kind==='pocket')return pocketLabel(line.pocket)||'外配/不扣黄金';
|
||||
if(kind==='charges')return line.charges?.length?line.charges.map(item=>`${item.name}:${money(item.amount)}`).join('\n'):'无附加收费';
|
||||
if(kind==='cost')return money(line.cost);
|
||||
@@ -99,14 +100,15 @@ function orderChangeActionSummaryHTML(request){
|
||||
if(input.payer)facts.push(['实际付款人',orderChangePayer(input.payer)]);
|
||||
if(input.note)facts.push(['费用项目/说明',input.note]);
|
||||
if(input.reference)facts.push(['退款凭据备注',input.reference]);
|
||||
if(Array.isArray(input.returnCounts))facts.push(['实际退回数量(对)',input.returnCounts.map((count,index)=>'商品 '+(index+1)+':'+stockCountText(count==null?null:Number(count))).join('\n')]);
|
||||
if(Array.isArray(input.returnPockets))facts.push(['退货实物去向',input.returnPockets.map((pocket,index)=>`${request.before.lines[index]?.name||'商品 '+(index+1)}:${pocketLabel(pocket)||'退供应商/不留黄金货盘'}`).join('\n')]);
|
||||
if(Array.isArray(input.fee_items))facts.push(['本次旧费用',input.fee_items.map(item=>`${item.note||'费用'}:${orderChangeInputMoney(item.amount)} · ${orderChangePayer(item.payer)}支付`).join('\n')]);
|
||||
return `<section class="order-change-action-summary"><h3>本次申请动作</h3><dl class="order-change-action-facts">${facts.map(([title,value])=>`<div><dt>${e(title)}</dt><dd>${orderChangeCell(value)}</dd></div>`).join('')}</dl><p class="small muted">下方对照为服务器试算;批准后才登记这笔变更,不会由系统发起真实收款、退款或转账。</p></section>`;
|
||||
}
|
||||
function orderChangeInventoryHTML(inventory){
|
||||
if(!inventory)return '';
|
||||
const table=(title,rows,changes=false)=>`<h3>${title}</h3>${rows.length?`<div class="table-wrap"><table class="order-change-inventory"><thead><tr><th>日期</th><th>货盘</th>${changes?'':'<th>库存业务</th>'}<th class="number">${changes?'本次增减':'已记克重'}</th></tr></thead><tbody>${rows.map(row=>`<tr><td>${e(row.date)}</td><td>${e(pocketLabel(row.pocket))}</td>${changes?'':`<td>${e(row.kind||'未提供')}</td>`}<td class="number">${row.mg>0?'+':''}${grams(row.mg)}g</td></tr>`).join('')}</tbody></table></div>`:`<p class="small muted">${changes?'本次没有黄金货盘净变动。':'没有本单库存流水。'}</p>`}`;
|
||||
return `<section class="order-change-inventory-summary"><h3>库存原值与批准后变化</h3><p class="small muted">以下为本单各日期、货盘的库存流水;正数为增加,负数为减少。按件商品或退回供应商不计黄金货盘。</p>${table('原库存记录',inventory.before)}${table('同意后的库存记录',inventory.after)}${table('本次库存净变化',inventory.changes,true)}</section>`;
|
||||
const table=(title,rows,changes=false)=>`<h3>${title}</h3>${rows.length?`<div class="table-wrap"><table class="order-change-inventory"><thead><tr><th>日期</th><th>货盘</th>${changes?'':'<th>库存业务</th>'}<th class="number">${changes?'本次增减':'已记克重'}</th></tr></thead><tbody>${rows.map(row=>`<tr><td>${e(row.date)}</td><td>${e(pocketLabel(row.pocket))}</td>${changes?'':`<td>${e(row.kind||'未提供')}</td>`}<td class="number">${row.mg>0?'+':''}${grams(row.mg)}g${inventoryCountHTML(row,{signed:true})}</td></tr>`).join('')}</tbody></table></div>`:`<p class="small muted">${changes?'本次没有黄金货盘净变动。':'没有本单库存流水。'}</p>`}`;
|
||||
return `<section class="order-change-inventory-summary"><h3>库存原值与批准后变化</h3><p class="small muted">以下为本单各日期、货盘的库存流水;正数为增加,负数为减少。按件商品或退回供应商不计黄金货盘。</p>${inventory.legacyCountNotice?'<p class="note">'+e(inventory.legacyCountNotice)+'</p>':''}${table('原库存记录',inventory.before)}${table('同意后的库存记录',inventory.after)}${table('本次库存净变化',inventory.changes,true)}</section>`;
|
||||
}
|
||||
function orderChangePriceLockCostsHTML(before,after){
|
||||
if(!before.priceLockCosts&&!after.priceLockCosts)return '';
|
||||
@@ -123,7 +125,7 @@ function orderChangeComparisonHTML(raw){
|
||||
orderChangePair('成交取整方式',before.rounding_mode==='yuan'?'四舍五入到整数元':'保留到分',after.rounding_mode==='yuan'?'四舍五入到整数元':'保留到分')+
|
||||
orderChangePair('新增费用默认支付日期',before.fees_date||before.date,after.fees_date||after.date)+orderChangePair('交付日期',before.delivered_date,after.delivered_date);
|
||||
const summary=[['成交金额','total'],['收款净额','netReceived'],['货品成本','goodsCost'],['实际费用合计','directCost'],['利润','profit'],['双方待结净额','settlementDue']].map(([title,key])=>orderChangePair(title,orderChangeMoney(request.summary.before[key]),orderChangeMoney(request.summary.after[key]))).join('');
|
||||
const lines=Array.from({length:Math.max(before.lines.length,after.lines.length)},(_,index)=>`<tr class="change-section-row"><th colspan="3" scope="colgroup">商品 ${index+1}</th></tr>${[['商品与销售计价说明','name'],['商品编号','code'],['克重/数量','quantity'],['销售金价、工费与件数','pricing'],['成交金额(含附加收费)','sale'],['客户附加收费','charges'],['货盘','pocket'],['货品成本合计','cost'],['进货料价与料费','material'],['进货工费','labor'],['其他货品成本','extra'],['成本付款人','payers']].map(([title,key])=>orderChangePair(title,orderChangeLineValue(before.lines[index],key),orderChangeLineValue(after.lines[index],key))).join('')}`).join('');
|
||||
const lines=Array.from({length:Math.max(before.lines.length,after.lines.length)},(_,index)=>`<tr class="change-section-row"><th colspan="3" scope="colgroup">商品 ${index+1}</th></tr>${[['商品与销售计价说明','name'],['商品编号','code'],['克重/数量','quantity'],['销售金价、工费与件数','pricing'],['成交金额(含附加收费)','sale'],['客户附加收费','charges'],['货盘','pocket'],['出库数量(对)','stockCount'],['货品成本合计','cost'],['进货料价与料费','material'],['进货工费','labor'],['其他货品成本','extra'],['成本付款人','payers']].map(([title,key])=>orderChangePair(title,orderChangeLineValue(before.lines[index],key),orderChangeLineValue(after.lines[index],key))).join('')}`).join('');
|
||||
const related=(request.relatedOrders||[]).map(item=>`<section class="order-change-related"><h3>同时受影响的关联订单:${e(item.number||item.id)}</h3><p class="small muted">本次修改会重新分配同批购料的成本及付款人。以下关联订单的利润与待结金额也会随批准一起更新。</p>${orderChangeComparisonHTML({...request,order_id:item.id,before:item.before,after:item.after,summary:item.summary,relatedOrders:[],relatedPriceLocks:[]})}</section>`).join('');
|
||||
return `<div class="order-change-comparison"><p class="small muted">原值为申请时快照,申请值由服务器按本次变更试算。批准前请核对客户实付、商品、成本、费用及付款人。</p><div class="table-wrap"><table class="order-change-table" aria-label="变更申请原值与申请值对照"><thead><tr><th>核对项目</th><th>原值(申请时)</th><th>申请值(同意后)</th></tr></thead><tbody>${basic}${orderChangePriceLockCostsHTML(before,after)}${orderChangePair('订单状态',label[before.status]||before.status,label[after.status]||after.status)}${orderChangePair('退货日期',before.returned_date,after.returned_date)}${orderChangePair('整单优惠',orderChangeMoney(before.discount),orderChangeMoney(after.discount))}${summary}${lines}<tr class="change-section-row"><th colspan="3" scope="colgroup">逐笔收退款与实际费用</th></tr>${orderChangePair('有效客户收退款/账户',orderChangePaymentsValue(before),orderChangePaymentsValue(after))}${orderChangePair('已记实际费用/日期/付款人',orderChangeExpensesValue(before),orderChangeExpensesValue(after))}</tbody></table></div>${orderChangeInventoryHTML(request.summary.inventory)}${related}${relatedPriceLocksHTML(request.relatedPriceLocks)}<p class="small muted">双方已发生的实际交款保留;试算不会发起真实收款、退款或转账。批准时仍会校验订单和关联资料版本。</p></div>`;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user