feat(est): print progress and adjustment costs
This commit is contained in:
@@ -44,6 +44,45 @@ def test_progress_and_escalation_print_use_selected_calculations():
|
||||
assert result["empty"]["errors"]
|
||||
|
||||
|
||||
def test_progress_cost_print_preserves_selected_round_costs():
|
||||
result = run(
|
||||
"math",
|
||||
"""(()=>{
|
||||
const p=EstNative.empty();p.options.SourceRefresh=false;
|
||||
p.tables.EstMainDat=[{PkID:1,Code:'R',GN:10,GU:100},{LinkIndex:54}];
|
||||
p.tables.Wonga=[{Gubun:'D',Name:'direct',BaseField:'GC'},{Gubun:'T',Name:'total',LinkIndex:55,VSusic:'D'}];
|
||||
p.progress=[{id:'one',inputs:{'1':{Gum:2,Sa:1}},approved:true}];
|
||||
const q=EstProgress.lock(EstNative.calculate(p),'one');
|
||||
q.tables.EstMainDat[0].GU=200;q.progress.push({id:'two',inputs:{'1':{Gum:3}}});
|
||||
return {one:EstForms.data('progress-costs',q,{roundId:'one'}),two:EstForms.data('progress-costs',q,{roundId:'two'})};
|
||||
})()""",
|
||||
)
|
||||
assert result["one"]["rows"][-1]["ContractCost"] == 1000
|
||||
assert result["one"]["rows"][-1]["GumCost"] == 200
|
||||
assert result["one"]["rows"][-1]["SaCost"] == 100
|
||||
assert result["two"]["rows"][-1]["JunCost"] == 100
|
||||
assert result["two"]["rows"][-1]["GumCost"] == 600
|
||||
assert result["two"]["rows"][-1]["TotalCost"] == 700
|
||||
|
||||
|
||||
def test_escalation_cost_print_uses_computed_cost_breakdowns():
|
||||
result = run(
|
||||
"math",
|
||||
"""(()=>{
|
||||
const p=EstNative.empty();p.options.SourceRefresh=false;p.options.EscDesignTotal=1000;
|
||||
p.tables.EstMainDat=[{PkID:1,Code:'R',GN:10,GU:80},{LinkIndex:54}];
|
||||
p.tables.Wonga=[{Gubun:'D',Name:'direct',BaseField:'GC'},{Gubun:'T',Name:'total',LinkIndex:55,VSusic:'D'}];
|
||||
const q=EstBusiness.baseline(EstNative.calculate(p));
|
||||
Object.assign(q.tables.EstMainDat[0],{AGU:100,GU:120,EscActual:3});
|
||||
return EstForms.data('escalation-costs',q);
|
||||
})()""",
|
||||
)
|
||||
assert result["errors"] == []
|
||||
assert result["rows"][-1]["ContractCost"] == 800
|
||||
assert result["rows"][-1]["adjustedCost"] == 960
|
||||
assert result["rows"][-1]["excludedCost"] == 240
|
||||
|
||||
|
||||
def test_resource_report_separates_each_work_item_without_changing_aggregate():
|
||||
result = run(
|
||||
"math",
|
||||
|
||||
Reference in New Issue
Block a user