Files
SGF/scripts/sgf-analysis-sources-readonly.php
T
2026-11-11 09:00:17 +02:00

3 lines
788 B
PHP

<?php
$book=$argv[1]??'8085';require __DIR__.'/sgf-single-bootstrap.php';$rows=$native->table('gl_accounts as a')->leftJoin('gl_lines as l','l.account_id','=','a.id')->where(['a.tenant_id'=>1,'a.company_id'=>2,'a.unit_id'=>2])->whereIn('a.code',['QA-CAIXA','QA-OBRIGACAO','QA-FORNECEDOR','QA-OBRIGACOES','QA-PASSIVO'])->groupBy('a.id','a.code')->select(['a.id','a.code'])->selectRaw('coalesce(sum(l.debit_minor-l.credit_minor),0)::text net_debit_minor')->orderBy('a.id')->get();file_put_contents($work.'/analysis-sources-readonly.json',json_encode(['passed'=>true,'candidate_sources'=>$rows,'criteria_assigned'=>false,'new_rights'=>0,'business_commands'=>0],JSON_PRETTY_PRINT));echo json_encode(['passed'=>true,'sources'=>$rows,'proof'=>$work.'/analysis-sources-readonly.json']).PHP_EOL;