Preserve verified 275 MZN and incomplete 175 MZN demonstrations. Keep 090000 and four real cost grants unapplied; real costing and fiscal blocks remain intact.
11 lines
2.2 KiB
PHP
11 lines
2.2 KiB
PHP
<?php
|
|
require __DIR__.'/../vendor/autoload.php';$app=require __DIR__.'/../bootstrap/app.php';$app->make(\Illuminate\Contracts\Console\Kernel::class)->bootstrap();
|
|
\App\Modules\Workshop\DirectCosts::guard();$f=json_decode(file_get_contents('C:/laragon/data/sgf-tempo/secrets/browser-fixture.json'),true,32,JSON_THROW_ON_ERROR);$fx=$f['direct_costs'];$db=\Illuminate\Support\Facades\DB::class;
|
|
$rows=$db::table('dc_calculations')->where('order_id',$fx['order'])->orderBy('id')->get();if($rows->count()<2)throw new RuntimeException('Two browser calculations required.');
|
|
$full=json_decode($rows[0]->snapshot,true);$partial=json_decode($rows[1]->snapshot,true);
|
|
if($full['known_subtotal_exact']!=='275'||$full['incomplete']||$partial['known_subtotal_exact']!=='175'||!$partial['incomplete']||$partial['selected_direct_total_exact']!==null||count($partial['pending'])!==1)throw new RuntimeException('Browser arithmetic/completeness differs.');
|
|
foreach([$rows[0],$rows[1]] as $c){$decision=$db::table('dc_decisions')->where(['calculation_id'=>$c->id,'decision'=>'approved'])->first();if(!$decision||$decision->actor_id===$c->actor_id)throw new RuntimeException('Distinct approval required.');}
|
|
if($db::table('wo_entries')->where('order_id',$fx['order'])->count()!==7)throw new RuntimeException('Technical events duplicated.');
|
|
$proof=['policy'=>\App\Modules\Workshop\DirectCosts::POLICY,'database'=>'sgf_tempo_test','synthetic_only'=>true,'real_browser_login'=>true,'csrf_enabled'=>true,'distinct_cost_roles'=>true,'original_workshop_entries'=>7,'technical_events_not_duplicated'=>true,'entry_versions'=>[['id'=>$fx['time'],'version'=>1],['id'=>$fx['material'],'version'=>1]],'full_selected_direct'=>['material'=>'100','labour'=>'175','known_subtotal'=>'275','complete_cost_claimed'=>false],'missing_material_rate'=>['known_subtotal'=>'175','selected_total'=>null,'incomplete'=>true,'pending'=>true],'both_exact_versions_approved'=>true,'real_grants_applied'=>false,'development_migration_applied'=>false];
|
|
file_put_contents(base_path('docs/proofs/direct-cost-browser-results.json'),json_encode($proof,JSON_PRETTY_PRINT|JSON_THROW_ON_ERROR));echo "Browser results verified: 275 known, 175 incomplete, distinct approval, seven original technical entries unchanged in number.\n";
|