汇总每日料池用量并精简老板专属月度利润分成表
This commit is contained in:
1 parent
dec01a3dca
commit
39f80fbab7
16 files changed
+276
-32
No files matched your search
@@ -217,6 +217,25 @@ test('料池用料在所属订单卡直接可见,保留原分币金额、麦
|
||||
assert.match(text,/麦麦垫付合计:料池料费 ¥1,033\.33 + 其他成本 ¥36\.00 = ¥1,069\.33/);
|
||||
});
|
||||
|
||||
function sourcePoolBusinessReport(){
|
||||
const response=poolBusinessReport(),day=response.ownershipBusiness.assistant.poolMaterial.days[0];
|
||||
day.averageRate=null;day.sources=[{kind:'personal_recovery',member:'assistant',priceLocked:false,mg:1000,averageRate:90000,amount:90000,knownAmount:90000,missingCount:0},{kind:'public',member:null,priceLocked:false,mg:1000,averageRate:103333,amount:103333,knownAmount:103333,missingCount:0}];
|
||||
return response;
|
||||
}
|
||||
test('个人与公共用料各一行公式,同日汇总克重及原分币料费明显,文本包含组合公式',async()=>{
|
||||
const h=businessHarness(sourcePoolBusinessReport());await h.run('renderReport()');const html=memberCard(h.content.innerHTML,'assistant');
|
||||
assert.match(html,/已用料合计<\/span><strong>2\.000g/);assert.match(html,/料池已用料费<\/span><strong>¥1,933\.33/);assert.match(html,/已用 2\.000g · 料费 ¥1,933\.33/);
|
||||
assert.match(html,/<p><span>娜娜个人回收料<\/span><strong>1\.000g × ¥900\.00\/g = ¥900\.00<\/strong><\/p>/);assert.match(html,/<p><span>公共料<\/span><strong>1\.000g × ¥1,033\.33\/g = ¥1,033\.33<\/strong><\/p>/);assert.doesNotMatch(html,/2\.000g ×/);
|
||||
const text=h.run('reportOwnershipReceiptsText(currentReport).join(String.fromCharCode(10))');assert.match(text,/已用料合计:2\.000g/);assert.match(text,/娜娜个人回收料 1\.000g × ¥900\.00\/g + 公共料 1\.000g × ¥1,033\.33\/g = ¥1,933\.33/);
|
||||
});
|
||||
test('同日不同锁价原均价分别显示,不合成新料价;来源不全或克重金额不平不能保存',async()=>{
|
||||
const response=sourcePoolBusinessReport(),day=response.ownershipBusiness.assistant.poolMaterial.days[0];day.sources[0]={...day.sources[0],kind:'public',member:null,priceLocked:true};
|
||||
const h=businessHarness(response);await h.run('renderReport()');const html=memberCard(h.content.innerHTML,'assistant');assert.match(html,/公共料(含锁价原料)<\/span><strong>1\.000g × ¥900\.00\/g = ¥900\.00/);assert.match(html,/公共料<\/span><strong>1\.000g × ¥1,033\.33\/g = ¥1,033\.33/);assert.doesNotMatch(html,/966\.67/);
|
||||
for(const change of [d=>d.sources[0].mg++,d=>d.sources[0].amount++,d=>d.sources[0].knownAmount++,d=>delete d.sources[0].priceLocked,d=>d.sources[0].member='outside',d=>d.sources=[]]){
|
||||
const broken=sourcePoolBusinessReport();change(broken.ownershipBusiness.assistant.poolMaterial.days[0]);const invalid=businessHarness(broken);await invalid.run('renderReport()');assert.equal(invalid.run('currentReport'),null);assert.match(invalid.content.innerHTML,/所属订单成本、利润或待转资料未完整返回/);
|
||||
}
|
||||
});
|
||||
|
||||
test('多日料池各列原均价与耗用额,跨日锁价说明不把交付料费当作本日新往来',async()=>{
|
||||
const response=poolBusinessReport(),pool=response.ownershipBusiness.assistant.poolMaterial,prior='2026-10-21';
|
||||
pool.hasPriceLocks=true;pool.days=[{...pool.days[0],poolId:prior,date:prior,mg:1000,averageRate:90000,amount:90000,knownAmount:90000,byPayer:{owner:{amount:0,knownAmount:0},assistant:{amount:90000,knownAmount:90000},assistant2:{amount:0,knownAmount:0}}},{...pool.days[0],mg:1000,averageRate:103333,amount:103333,knownAmount:103333,byPayer:{owner:{amount:103333,knownAmount:103333},assistant:{amount:0,knownAmount:0},assistant2:{amount:0,knownAmount:0}}}];
|
||||
@@ -232,6 +251,14 @@ test('待补料费与未知FIFO付款人显示已知额和待补,其他已核
|
||||
assert.match(html,/麦麦垫付合计:料池料费 待补(已知 ¥0\.00) + 其他成本 ¥36\.00 = 待补(已知 ¥36\.00)/);
|
||||
});
|
||||
|
||||
test('个人来源已知而公共待补仍保留整单待补,已知料费和其他成本不提前改账',async()=>{
|
||||
const response=sourcePoolBusinessReport(),pool=response.ownershipBusiness.assistant.poolMaterial;
|
||||
pool.amount=null;pool.knownAmount=0;pool.missingCount=1;pool.byPayer=Object.fromEntries(['owner','assistant','assistant2'].map(key=>[key,{amount:null,knownAmount:0}]));
|
||||
pool.days[0]={...pool.days[0],amount:null,knownAmount:0,missingCount:1,byPayer:pool.byPayer};pool.days[0].sources[1]={...pool.days[0].sources[1],averageRate:null,amount:null,knownAmount:0,missingCount:1};
|
||||
response.ownershipBusiness.assistant=businessPerson(response.ownershipReceipts.assistant,D,D,{costByPayer:{owner:{totalCost:null,knownTotalCost:3600,missingCount:1},assistant:{totalCost:300,knownTotalCost:300}},poolMaterial:pool,settlement:settlement([],D,D,{partial:true,pendingCount:1})});
|
||||
const h=businessHarness(response);await h.run('renderReport()');const html=memberCard(h.content.innerHTML,'assistant');assert.match(html,/娜娜个人回收料<\/span><strong>1\.000g × ¥900\.00\/g = ¥900\.00/);assert.match(html,/公共料<\/span><strong>1\.000g × 待补料价 = 料费待补(已知 ¥0\.00)/);assert.match(html,/料池已用料费<\/span><strong>已知 ¥0\.00/);assert.match(html,/其他成本 <b>¥39\.00/);assert.match(html,/料费待补的订单尚未计入已知料费/);assert.ok(h.run('currentReport'));
|
||||
});
|
||||
|
||||
test('料费分项、克重、付款归属和其他成本必须守恒,缺失投影不会把料费隐藏成0',async()=>{
|
||||
const changes=[r=>delete r.ownershipBusiness.assistant.poolMaterial,r=>r.ownershipBusiness.assistant.poolMaterial.mg++,r=>r.ownershipBusiness.assistant.poolMaterial.days[0].amount++,r=>r.ownershipBusiness.assistant.poolMaterial.byPayer.owner.knownAmount++,r=>r.ownershipBusiness.assistant.poolMaterial.otherCosts.knownAmount++];
|
||||
for(const change of changes){const response=poolBusinessReport();change(response);const h=businessHarness(response);await h.run('renderReport()');assert.equal(h.run('currentReport'),null);assert.match(h.content.innerHTML,/所属订单成本、利润或待转资料未完整返回/);assert.doesNotMatch(h.content.innerHTML,/料池已用料费<\/span>/);}
|
||||
|
||||
Reference in new issue
Block a user