Compare commits
12
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
63cc336787 | ||
|
|
af7d250320 | ||
|
|
2b592ded66 | ||
|
|
5837f34a2c | ||
|
|
2fdca86367 | ||
|
|
833b4e5cef | ||
|
|
67a96085c8 | ||
|
|
b0e01ef737 | ||
|
|
2a7254406d | ||
|
|
4601bf64a0 | ||
|
|
6cffa1188f | ||
|
|
4853bc7284 |
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,178 @@
|
||||
{
|
||||
"implementation_commit": "2b592ded669f400e2322c183947a045bb3790c73",
|
||||
"status": "QA_complete_not_delivered",
|
||||
"coverage": {
|
||||
"AUD-SIM-L1-P122": [
|
||||
"goods_sale_commission",
|
||||
"goods_purchase_commission"
|
||||
],
|
||||
"AUD-SIM-L1-P128": [
|
||||
"service_sale_mandate",
|
||||
"service_purchase_mandate"
|
||||
]
|
||||
},
|
||||
"branch_count": 2,
|
||||
"treatment_count": 4,
|
||||
"source": "CIVA3(3)c,Lei13/2016PDF6/p1426(264);4(3),PDF7/p1426(265). Lei22/2022não altera3/4;Lei10/2025PDF12mantém3(3)c e não altera4. Base15(2)e/P091já entregue permanece independente;sem nova aplicação da base neste incremento.",
|
||||
"meaning": {
|
||||
"P122": "Transferências de bens em execução de contrato de comissão,incluindo consignação;na venda comissário considerado comprador,na compra comitente considerado comprador. Venda:comitente→comissário→terceiro;compra:terceiro→comissário→comitente. Contraprestações e referências das duas relações separadas.",
|
||||
"P128": "Serviço efectuado por intervenção de mandatário emnome próprio:mandatário considerado adquirente eprestador sucessivamente4(3). Venda/prestação:mandante→mandatário→terceiro;compra/aquisição:terceiro→mandatário→mandante. Não é mera intermediação emnome de outrem ou base15(2)e de bens."
|
||||
},
|
||||
"formula": "Classifytwo successive relations bykind/direction;keep eachoriginalconsideration separate;no monetaryaggregation or taxcalculation.",
|
||||
"scope": "2026,circuitos emnome próprio,partes/contratos/objectos econtraprestações originais das duas relações. Sem soma/compensação automática,base tributável nova,localização,isenção,taxa,IVA,dedução/campo11 ou totaisModeloA. Sem conversão cambial;moeda original identificada e coerente com contexto. P091preservado,sem repetir aceitação/cálculo.",
|
||||
"technical_choices": "NewownNames opportunity-scoped book in existingmodelo_a snapshot/API/dossier,no schema/permissions. Switchretainsallhiddenrefs/values andclearsownconfirmations,keepscommon. Originaldecimalstrings up to15integer/6fractiondigits retained;no rounding/conversion. References or explicitassumptions reused,no certificates/approvers invented. OptionalexistingBaseRef notprerequisite;doesnotmodifyP091.",
|
||||
"verification": {
|
||||
"frontend": {
|
||||
"tests": 6,
|
||||
"passed": 6,
|
||||
"failed": 0,
|
||||
"by_treatment": "Four circuits:ownconditions unknown/no,direction/parties,separate originals,dates/refs/currency,zero vsunknown",
|
||||
"additional": "Switchretainsvalues/refs andclearsownconfirmations;nonmonetarytaxfields remainnull;allpriorbooks includingP091 unchanged,history/report/currentkey/corruptwriteguards"
|
||||
},
|
||||
"privateAPI": {
|
||||
"tests": 1,
|
||||
"assertions": 37,
|
||||
"target": "simulator_fiscal_delta_20261021_test:55441",
|
||||
"transaction_rollback": true,
|
||||
"xml": "C:\\laragon\\www\\portal-investidor\\outputs\\iva-l1-g10-own-name-20261025\\api-tests.xml"
|
||||
},
|
||||
"types": "passed",
|
||||
"build": "passed,existing plugin timing warnings",
|
||||
"UI": "Edge/CUArealcomponent:ownNameunknown makescircuitindeterminate;restoredconfirmation andsave/recover/report4circuitswith2relations each and1000.25/1100.75MZN keptseparate,no totals,newbase/VAT/ratenull,3previousversions. SyntheticQA,notmanualTempoacceptance.",
|
||||
"UI_screenshot": "C:\\laragon\\www\\portal-investidor\\outputs\\iva-l1-g10-own-name-20261025\\qa-recovered-report.png"
|
||||
},
|
||||
"preservation": {
|
||||
"base": "5837f34a2cc64a94f91f038ffcb0c62f5fb5ba6a",
|
||||
"delivered_ids": [
|
||||
"AUD-SIM-L1-P003",
|
||||
"AUD-SIM-L1-P004",
|
||||
"AUD-SIM-L1-P005",
|
||||
"AUD-SIM-L1-P006",
|
||||
"AUD-SIM-L1-P007",
|
||||
"AUD-SIM-L1-P008",
|
||||
"AUD-SIM-L1-P009",
|
||||
"AUD-SIM-L1-P010",
|
||||
"AUD-SIM-L1-P011",
|
||||
"AUD-SIM-L1-P012",
|
||||
"AUD-SIM-L1-P013",
|
||||
"AUD-SIM-L1-P014",
|
||||
"AUD-SIM-L1-P015",
|
||||
"AUD-SIM-L1-P016",
|
||||
"AUD-SIM-L1-P017",
|
||||
"AUD-SIM-L1-P018",
|
||||
"AUD-SIM-L1-P019",
|
||||
"AUD-SIM-L1-P020",
|
||||
"AUD-SIM-L1-P021",
|
||||
"AUD-SIM-L1-P022",
|
||||
"AUD-SIM-L1-P023",
|
||||
"AUD-SIM-L1-P024",
|
||||
"AUD-SIM-L1-P025",
|
||||
"AUD-SIM-L1-P026",
|
||||
"AUD-SIM-L1-P027",
|
||||
"AUD-SIM-L1-P028",
|
||||
"AUD-SIM-L1-P029",
|
||||
"AUD-SIM-L1-P030",
|
||||
"AUD-SIM-L1-P031",
|
||||
"AUD-SIM-L1-P032",
|
||||
"AUD-SIM-L1-P033",
|
||||
"AUD-SIM-L1-P034",
|
||||
"AUD-SIM-L1-P035",
|
||||
"AUD-SIM-L1-P036",
|
||||
"AUD-SIM-L1-P037",
|
||||
"AUD-SIM-L1-P038",
|
||||
"AUD-SIM-L1-P039",
|
||||
"AUD-SIM-L1-P040",
|
||||
"AUD-SIM-L1-P041",
|
||||
"AUD-SIM-L1-P042",
|
||||
"AUD-SIM-L1-P043",
|
||||
"AUD-SIM-L1-P044",
|
||||
"AUD-SIM-L1-P045",
|
||||
"AUD-SIM-L1-P048",
|
||||
"AUD-SIM-L1-P049",
|
||||
"AUD-SIM-L1-P050",
|
||||
"AUD-SIM-L1-P051",
|
||||
"AUD-SIM-L1-P052",
|
||||
"AUD-SIM-L1-P053",
|
||||
"AUD-SIM-L1-P054",
|
||||
"AUD-SIM-L1-P055",
|
||||
"AUD-SIM-L1-P056",
|
||||
"AUD-SIM-L1-P057",
|
||||
"AUD-SIM-L1-P060",
|
||||
"AUD-SIM-L1-P061",
|
||||
"AUD-SIM-L1-P062",
|
||||
"AUD-SIM-L1-P063",
|
||||
"AUD-SIM-L1-P064",
|
||||
"AUD-SIM-L1-P065",
|
||||
"AUD-SIM-L1-P066",
|
||||
"AUD-SIM-L1-P067",
|
||||
"AUD-SIM-L1-P068",
|
||||
"AUD-SIM-L1-P069",
|
||||
"AUD-SIM-L1-P070",
|
||||
"AUD-SIM-L1-P071",
|
||||
"AUD-SIM-L1-P072",
|
||||
"AUD-SIM-L1-P073",
|
||||
"AUD-SIM-L1-P074",
|
||||
"AUD-SIM-L1-P075",
|
||||
"AUD-SIM-L1-P076",
|
||||
"AUD-SIM-L1-P077",
|
||||
"AUD-SIM-L1-P078",
|
||||
"AUD-SIM-L1-P079",
|
||||
"AUD-SIM-L1-P080",
|
||||
"AUD-SIM-L1-P081",
|
||||
"AUD-SIM-L1-P082",
|
||||
"AUD-SIM-L1-P083",
|
||||
"AUD-SIM-L1-P086",
|
||||
"AUD-SIM-L1-P089",
|
||||
"AUD-SIM-L1-P090",
|
||||
"AUD-SIM-L1-P091",
|
||||
"AUD-SIM-L1-P094",
|
||||
"AUD-SIM-L1-P095",
|
||||
"AUD-SIM-L1-P096",
|
||||
"AUD-SIM-L1-P097",
|
||||
"AUD-SIM-L1-P098",
|
||||
"AUD-SIM-L1-P099",
|
||||
"AUD-SIM-L1-P100",
|
||||
"AUD-SIM-L1-P101",
|
||||
"AUD-SIM-L1-P102",
|
||||
"AUD-SIM-L1-P103",
|
||||
"AUD-SIM-L1-P105",
|
||||
"AUD-SIM-L1-P106",
|
||||
"AUD-SIM-L1-P107",
|
||||
"AUD-SIM-L1-P108",
|
||||
"AUD-SIM-L1-P109",
|
||||
"AUD-SIM-L1-P110",
|
||||
"AUD-SIM-L1-P111",
|
||||
"AUD-SIM-L1-P112",
|
||||
"AUD-SIM-L1-P113",
|
||||
"AUD-SIM-L1-P114",
|
||||
"AUD-SIM-L1-P115",
|
||||
"AUD-SIM-L1-P116",
|
||||
"AUD-SIM-L1-P117",
|
||||
"AUD-SIM-L1-P118",
|
||||
"AUD-SIM-L1-P119",
|
||||
"AUD-SIM-L1-P120"
|
||||
],
|
||||
"confirmed_losses": [],
|
||||
"accepted_delivery": "2fdca863/5837f34a;174tables/369files;29published/28relations/408geometries;code/schema/data/config/permissions compared",
|
||||
"frozen": "tests\\frontend\\fixtures\\iva-g10-own-name-preserved.json",
|
||||
"sha256": "03defa4a680af33e1bcd05770d619343704d448d295142263b21c40e516b2a5d",
|
||||
"scope": "P122/P128QA;all priorbooks/history includingP105–110 andpartialP084/P085 immutable;no activewrites"
|
||||
},
|
||||
"runtime_delta": {
|
||||
"resources/js/lib/iva-own-name.ts": "c36509de24d31d747d91630a31ce7d72baa749e9928b718a944556348fc54f85",
|
||||
"resources/js/components/simulation-own-name.tsx": "6e142242aa29ae07e36b4d8d0be7d78f770d701e0a92e1a6e9832fcb794c17cf",
|
||||
"resources/js/components/simulation-monthly-iva.tsx": "9718dc440aa98497011775d8bd03049d7857fa3badf27f4467d6d434f642defd",
|
||||
"resources/js/lib/project-dossier.ts": "099dc307a86c763a9509516f6d59cc5c454b1f81189cc04b919d8d6045baf9dc"
|
||||
},
|
||||
"counts_current": {
|
||||
"delivered": 107,
|
||||
"QA": 2,
|
||||
"functional_pending": 23,
|
||||
"P001": 1,
|
||||
"total": 133
|
||||
},
|
||||
"homologation_unchanged": "2fdca863",
|
||||
"remaining": "OnejointGit delivery forP122/P128,freshbackup/realisolatedrestore,acceptedQA reused,installeddeltaonly. No individualbranch deployment.",
|
||||
"limits": "L1open;deductionoutsideincrement;P00105/06;P121digital/P084/P085pending;beveragesL2/L3;Statistics/AIdeferred",
|
||||
"sources_inventory": "C:\\laragon\\www\\portal-investidor\\outputs\\iva-l1-g10-own-name-20261025\\source-archive-inventory.json"
|
||||
}
|
||||
@@ -0,0 +1,214 @@
|
||||
{
|
||||
"implementation_commit": "67a96085c8828231bb7e44ca26a4acb7b915ecee",
|
||||
"status": "delivered_with_QA_proofs_preserved",
|
||||
"coverage": {
|
||||
"AUD-SIM-L1-P096": [
|
||||
"regulated_energy"
|
||||
],
|
||||
"AUD-SIM-L1-P097": [
|
||||
"aeronautical_fees"
|
||||
],
|
||||
"AUD-SIM-L1-P098": [
|
||||
"public_works"
|
||||
],
|
||||
"AUD-SIM-L1-P099": [
|
||||
"public_water"
|
||||
]
|
||||
},
|
||||
"branch_count": 4,
|
||||
"treatment_count": 4,
|
||||
"source": "CIVA15(2)j/k/l/m,15(1)/(5)/(6)/(9),Lei13/2016PDF13–14/p1426(271–272);Lei22/2022PDF3mantém15(2)j–m;Lei10/2025não altera15,adita18(6),PDF13:dedução do imposto suportado relativo a essas operações na mesma proporção da base reduzida.",
|
||||
"meaning": {
|
||||
"P096": {
|
||||
"treatment": "regulated_energy",
|
||||
"formula": "contraprestação total antes redução,sempróprioIVA ×62%",
|
||||
"conditions": "Transmissão de energia com preço fixado porAutoridadePública,referência/âmbito/intervalo aplicáveis."
|
||||
},
|
||||
"P097": {
|
||||
"treatment": "aeronautical_fees",
|
||||
"formula": "contraprestação total antes redução,sempróprioIVA ×85%",
|
||||
"conditions": "Preço doserviço fixado através de taxas aeronáuticas. Não aplicar a comunicações/saneamento/telecomunicações genericamente pelo título histórico da matriz;é necessário demonstrar o preço fixado através de taxa aeronáutica15(2)k."
|
||||
},
|
||||
"P098": {
|
||||
"treatment": "public_works",
|
||||
"formula": "contraprestação total antes redução,sempróprioIVA ×40%(redução60%,não base60%)",
|
||||
"conditions": "Construção/reabilitação de obras públicas abrangidas15(2)l/15(9),projecto/contrato/categoria/âmbito identificados;estradas,pontes,infraestrutura água/saneamento,electrificação rural emprojectos públicos e hidráulicaagrícola noâmbito definido. Não exigir preço regulado a esta alínea."
|
||||
},
|
||||
"P099": {
|
||||
"treatment": "public_water",
|
||||
"formula": "contraprestação total antes redução,sempróprioIVA ×75%",
|
||||
"conditions": "Água potável através derede pública,preço fixado porAutoridadePública comreferência/âmbito/intervalo aplicáveis."
|
||||
}
|
||||
},
|
||||
"formula": "Base=fullconsideration before reduction excludingownVAT ×branchpercentage once;exactdecimal retained,no fiscalrounding assumed.",
|
||||
"scope": "2026/MZN,base apenas. Percentagens62/85/40/75 são de base,não taxasIVA. Proporção18(6)registada sem calcular/conceder dedução/campo11;dedução permanece nas condições/lotes próprios. Sem taxaIVA,IVA,isenção ou totaisModeloA. Não dividir bruto comIVA sem composição esclarecida,nem reduzir montante já reduzido.",
|
||||
"technical_choices": "NewregulatedReducedBases opportunity-scoped book in existingmodelo_a snapshot/API/dossier,no schema/permissions. Switchretainshiddenprice/projectrefs andclearsownconditions;sharedconditions retained. Inputs15integer/6fractiondigits,BigInt×percentage,outputupto8fractiondigits. Existingrefs or explicitassumptions,no certificates/approvers invented.",
|
||||
"verification": {
|
||||
"frontend": {
|
||||
"tests": 6,
|
||||
"passed": 6,
|
||||
"failed": 0,
|
||||
"by_branch": {
|
||||
"AUD-SIM-L1-P096": "Ownconditions unknown/no,source/scope/date/currency,exactpercentage/base,zero vsunknown passed",
|
||||
"AUD-SIM-L1-P097": "Ownconditions unknown/no,source/scope/date/currency,exactpercentage/base,zero vsunknown passed",
|
||||
"AUD-SIM-L1-P098": "Ownconditions unknown/no,source/scope/date/currency,exactpercentage/base,zero vsunknown passed",
|
||||
"AUD-SIM-L1-P099": "Ownconditions unknown/no,source/scope/date/currency,exactpercentage/base,zero vsunknown passed"
|
||||
},
|
||||
"additional": "Eightfractiondigit exactresults from6fractioninput,no float/fiscalrounding;works40not60,pricefields irrelevanttoworks,project/categories guard,switchhiddenretention,allpreviousbooks/history/report/corruptwriteguards"
|
||||
},
|
||||
"privateAPI": {
|
||||
"tests": 1,
|
||||
"assertions": 27,
|
||||
"target": "simulator_fiscal_delta_20261021_test:55441",
|
||||
"transaction_rollback": true,
|
||||
"xml": "C:\\laragon\\www\\portal-investidor\\outputs\\iva-l1-g7-reduced-bases-20261024\\api-tests.xml"
|
||||
},
|
||||
"types": "passed",
|
||||
"build": "passed,existing plugin timing warnings",
|
||||
"UI": "Edge/CUArealcomponent:unknown full-before-reduction composition makesenergybaseindeterminate;unknown workscategory makesworksbaseindeterminate;restore confirms620.155/850.2125/400.10/750.1875MZN,proportion62/85/40/75%,VAT/ratenull. Save/recover/report4rows+3previousversions. SyntheticQA,notmanualTempoacceptance.",
|
||||
"UI_screenshot": "C:\\laragon\\www\\portal-investidor\\outputs\\iva-l1-g7-reduced-bases-20261024\\qa-recovered-report.png"
|
||||
},
|
||||
"preservation": {
|
||||
"base": "b0e01ef737d26a991474e7fcc5d77cd330f20815",
|
||||
"delivered_ids": [
|
||||
"AUD-SIM-L1-P003",
|
||||
"AUD-SIM-L1-P004",
|
||||
"AUD-SIM-L1-P005",
|
||||
"AUD-SIM-L1-P006",
|
||||
"AUD-SIM-L1-P007",
|
||||
"AUD-SIM-L1-P008",
|
||||
"AUD-SIM-L1-P009",
|
||||
"AUD-SIM-L1-P010",
|
||||
"AUD-SIM-L1-P011",
|
||||
"AUD-SIM-L1-P012",
|
||||
"AUD-SIM-L1-P013",
|
||||
"AUD-SIM-L1-P014",
|
||||
"AUD-SIM-L1-P015",
|
||||
"AUD-SIM-L1-P016",
|
||||
"AUD-SIM-L1-P017",
|
||||
"AUD-SIM-L1-P018",
|
||||
"AUD-SIM-L1-P019",
|
||||
"AUD-SIM-L1-P020",
|
||||
"AUD-SIM-L1-P021",
|
||||
"AUD-SIM-L1-P022",
|
||||
"AUD-SIM-L1-P023",
|
||||
"AUD-SIM-L1-P024",
|
||||
"AUD-SIM-L1-P025",
|
||||
"AUD-SIM-L1-P026",
|
||||
"AUD-SIM-L1-P027",
|
||||
"AUD-SIM-L1-P028",
|
||||
"AUD-SIM-L1-P029",
|
||||
"AUD-SIM-L1-P030",
|
||||
"AUD-SIM-L1-P031",
|
||||
"AUD-SIM-L1-P032",
|
||||
"AUD-SIM-L1-P033",
|
||||
"AUD-SIM-L1-P034",
|
||||
"AUD-SIM-L1-P035",
|
||||
"AUD-SIM-L1-P036",
|
||||
"AUD-SIM-L1-P037",
|
||||
"AUD-SIM-L1-P038",
|
||||
"AUD-SIM-L1-P039",
|
||||
"AUD-SIM-L1-P040",
|
||||
"AUD-SIM-L1-P041",
|
||||
"AUD-SIM-L1-P042",
|
||||
"AUD-SIM-L1-P043",
|
||||
"AUD-SIM-L1-P044",
|
||||
"AUD-SIM-L1-P045",
|
||||
"AUD-SIM-L1-P048",
|
||||
"AUD-SIM-L1-P049",
|
||||
"AUD-SIM-L1-P050",
|
||||
"AUD-SIM-L1-P051",
|
||||
"AUD-SIM-L1-P052",
|
||||
"AUD-SIM-L1-P053",
|
||||
"AUD-SIM-L1-P054",
|
||||
"AUD-SIM-L1-P055",
|
||||
"AUD-SIM-L1-P056",
|
||||
"AUD-SIM-L1-P057",
|
||||
"AUD-SIM-L1-P060",
|
||||
"AUD-SIM-L1-P061",
|
||||
"AUD-SIM-L1-P062",
|
||||
"AUD-SIM-L1-P063",
|
||||
"AUD-SIM-L1-P064",
|
||||
"AUD-SIM-L1-P065",
|
||||
"AUD-SIM-L1-P066",
|
||||
"AUD-SIM-L1-P067",
|
||||
"AUD-SIM-L1-P068",
|
||||
"AUD-SIM-L1-P069",
|
||||
"AUD-SIM-L1-P070",
|
||||
"AUD-SIM-L1-P071",
|
||||
"AUD-SIM-L1-P072",
|
||||
"AUD-SIM-L1-P073",
|
||||
"AUD-SIM-L1-P074",
|
||||
"AUD-SIM-L1-P075",
|
||||
"AUD-SIM-L1-P076",
|
||||
"AUD-SIM-L1-P077",
|
||||
"AUD-SIM-L1-P078",
|
||||
"AUD-SIM-L1-P079",
|
||||
"AUD-SIM-L1-P080",
|
||||
"AUD-SIM-L1-P081",
|
||||
"AUD-SIM-L1-P082",
|
||||
"AUD-SIM-L1-P083",
|
||||
"AUD-SIM-L1-P086",
|
||||
"AUD-SIM-L1-P089",
|
||||
"AUD-SIM-L1-P090",
|
||||
"AUD-SIM-L1-P091",
|
||||
"AUD-SIM-L1-P094",
|
||||
"AUD-SIM-L1-P095",
|
||||
"AUD-SIM-L1-P100",
|
||||
"AUD-SIM-L1-P101",
|
||||
"AUD-SIM-L1-P102",
|
||||
"AUD-SIM-L1-P103",
|
||||
"AUD-SIM-L1-P105",
|
||||
"AUD-SIM-L1-P106",
|
||||
"AUD-SIM-L1-P107",
|
||||
"AUD-SIM-L1-P108",
|
||||
"AUD-SIM-L1-P109",
|
||||
"AUD-SIM-L1-P110",
|
||||
"AUD-SIM-L1-P111",
|
||||
"AUD-SIM-L1-P112",
|
||||
"AUD-SIM-L1-P113",
|
||||
"AUD-SIM-L1-P114",
|
||||
"AUD-SIM-L1-P115",
|
||||
"AUD-SIM-L1-P116",
|
||||
"AUD-SIM-L1-P117",
|
||||
"AUD-SIM-L1-P118",
|
||||
"AUD-SIM-L1-P119",
|
||||
"AUD-SIM-L1-P120"
|
||||
],
|
||||
"confirmed_losses": [],
|
||||
"accepted_delivery": "2a725440/b0e01ef7;174tables/369files;29published/28relations/408geometries;code/schema/data/config/permissions compared",
|
||||
"frozen": "tests\\frontend\\fixtures\\iva-g7-reduced-preserved.json",
|
||||
"sha256": "0f106010eb54921462d64f42bf44ac551ef2ab614f6fe0eb063908d858529b01",
|
||||
"scope": "P096–P099QA;all priorbooks/history includingP111–P120 andpartialP084/P085 immutable;no activewrites"
|
||||
},
|
||||
"runtime_delta": {
|
||||
"resources/js/lib/iva-reduced-bases.ts": "4fc79388066a4d012b9af279ef53212ee963ae43d858307155e9ae8a140b5285",
|
||||
"resources/js/components/simulation-reduced-bases.tsx": "00f1e0f1490240f578401c3a6e10b6812ee5b7978bbf7d7e5c9c1a81124bc6d1",
|
||||
"resources/js/components/simulation-monthly-iva.tsx": "6032b9605703e7e29d5fb45cc158e8da57b9af4980d312f3326ddf18ee1e8814",
|
||||
"resources/js/lib/project-dossier.ts": "ab044a0952cc4753925768f5ba7fd422637cfb9d826c1e8c26d21d7616b6dacf"
|
||||
},
|
||||
"counts_current": {
|
||||
"delivered": 103,
|
||||
"QA": 4,
|
||||
"functional_pending": 25,
|
||||
"P001": 1,
|
||||
"total": 133
|
||||
},
|
||||
"homologation_unchanged": "2a725440",
|
||||
"remaining": "OnejointGit delivery forfourcompatiblebranches,onebackup/realisolatedrestore,perbranchQAproofsreused,installeddeltaonly. No individualbranch deployment.",
|
||||
"limits": "P121digital/P084/P085pending;L1open;P00105/06;beveragesL2/L3;Statistics/AIdeferred",
|
||||
"sources_inventory": "C:\\laragon\\www\\portal-investidor\\outputs\\iva-l1-g7-reduced-bases-20261024\\source-archive-inventory.json",
|
||||
"qa_status_preserved": "QA_complete_not_delivered",
|
||||
"delivery_followup": {
|
||||
"served_commit": "2fdca86367d8bad524113b4cf6c49a0110130be9",
|
||||
"receipt": "l1-g7-reduced-delivery-20261024.json",
|
||||
"record": "iva_l1_g7_reduced_P096_P099_homologation_20261024",
|
||||
"counts": {
|
||||
"delivered": 107,
|
||||
"QA": 0,
|
||||
"functional_pending": 25,
|
||||
"documentary": 1,
|
||||
"total": 133
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"implementation_commit": "ec33fb5be2934f34d06349b84bf8e5316f90960e",
|
||||
"status": "QA_complete_not_delivered",
|
||||
"status": "delivered_with_QA_proofs_preserved",
|
||||
"coverage": {
|
||||
"AUD-SIM-L1-P106": [
|
||||
"general_service"
|
||||
@@ -172,5 +172,18 @@
|
||||
"homologation_unchanged": "8f14f5dd",
|
||||
"remaining": "One jointGit integration/delivery forfivecompatiblebranches,one backup/realrestore,individualQAproofsreused,installeddelta only. No individualbranch deployment.",
|
||||
"limits": "P084/P085partial,pending;L1open;P00105/06;beveragesL2/L3;Statistics/AIdeferred",
|
||||
"sources_inventory": "C:\\laragon\\www\\portal-investidor\\outputs\\iva-l1-g8-services-20261024\\source-archive-inventory.json"
|
||||
"sources_inventory": "C:\\laragon\\www\\portal-investidor\\outputs\\iva-l1-g8-services-20261024\\source-archive-inventory.json",
|
||||
"qa_status_preserved": "QA_complete_not_delivered",
|
||||
"delivery_followup": {
|
||||
"served_commit": "03c26d66139f36573cf58362a5076b4d5f98eca2",
|
||||
"receipt": "l1-g8-services-delivery-20261024.json",
|
||||
"record": "iva_l1_g8_services_P106_P110_homologation_20261024",
|
||||
"counts": {
|
||||
"delivered": 93,
|
||||
"QA": 0,
|
||||
"functional_pending": 39,
|
||||
"documentary": 1,
|
||||
"total": 133
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,264 @@
|
||||
{
|
||||
"implementation_commit": "6cffa1188f8f0f43d8d161cf97b7a08a885055f6",
|
||||
"status": "delivered_with_QA_proofs_preserved",
|
||||
"coverage": {
|
||||
"AUD-SIM-L1-P111": [
|
||||
"rights_service"
|
||||
],
|
||||
"AUD-SIM-L1-P112": [
|
||||
"advertising_service"
|
||||
],
|
||||
"AUD-SIM-L1-P113": [
|
||||
"telecom_service"
|
||||
],
|
||||
"AUD-SIM-L1-P114": [
|
||||
"consulting_service"
|
||||
],
|
||||
"AUD-SIM-L1-P115": [
|
||||
"data_service"
|
||||
],
|
||||
"AUD-SIM-L1-P116": [
|
||||
"finance_service"
|
||||
],
|
||||
"AUD-SIM-L1-P117": [
|
||||
"staff_service"
|
||||
],
|
||||
"AUD-SIM-L1-P118": [
|
||||
"intermediation_service"
|
||||
],
|
||||
"AUD-SIM-L1-P119": [
|
||||
"abstention_service"
|
||||
],
|
||||
"AUD-SIM-L1-P120": [
|
||||
"movable_lease_service"
|
||||
]
|
||||
},
|
||||
"branch_count": 10,
|
||||
"treatment_count": 10,
|
||||
"QA_example_count": 30,
|
||||
"source": "CIVA2(1)a/b,2(2),6(3),6(7)a–j e6(8),Lei13/2016PDF6–8/p1426(264–266);23(1)/(2),25(4),26(1–3),PDF16–17. Lei22/2022não altera estes artigos. Lei10/2025PDF12mantém alíneasa–j ealtera6(7–9);PDF13art23(2)excluik e remete declaração33(2);PDF14mantém26(1–3),adita26(4)digital ealtera33(2).",
|
||||
"meaning": {
|
||||
"P111": {
|
||||
"clause": "6(7)a",
|
||||
"treatment": "rights_service",
|
||||
"nature": "Cessão/autorização de direitos de autor,licenças,marcas e análogos"
|
||||
},
|
||||
"P112": {
|
||||
"clause": "6(7)b",
|
||||
"treatment": "advertising_service",
|
||||
"nature": "Publicidade"
|
||||
},
|
||||
"P113": {
|
||||
"clause": "6(7)c",
|
||||
"treatment": "telecom_service",
|
||||
"nature": "Telecomunicações"
|
||||
},
|
||||
"P114": {
|
||||
"clause": "6(7)d",
|
||||
"treatment": "consulting_service",
|
||||
"nature": "Consultores,engenheiros,advogados,economistas,contabilistas/gabinetes de estudos,organização,investigação/desenvolvimento e similares"
|
||||
},
|
||||
"P115": {
|
||||
"clause": "6(7)e",
|
||||
"treatment": "data_service",
|
||||
"nature": "Tratamento de dados/fornecimento de informações"
|
||||
},
|
||||
"P116": {
|
||||
"clause": "6(7)f",
|
||||
"treatment": "finance_service",
|
||||
"nature": "Operações bancárias,financeiras,seguro/resseguro;eventual isenção independente"
|
||||
},
|
||||
"P117": {
|
||||
"clause": "6(7)g",
|
||||
"treatment": "staff_service",
|
||||
"nature": "Colocação de pessoal"
|
||||
},
|
||||
"P118": {
|
||||
"clause": "6(7)h",
|
||||
"treatment": "intermediation_service",
|
||||
"nature": "Intermediação em nome epor conta de outrem no fornecimento de serviço enumerado,subjacente identificado"
|
||||
},
|
||||
"P119": {
|
||||
"clause": "6(7)i",
|
||||
"treatment": "abstention_service",
|
||||
"nature": "Obrigação de não exercer,mesmo parcialmente,actividade/direito enumerado,subjacente identificado"
|
||||
},
|
||||
"P120": {
|
||||
"clause": "6(7)j",
|
||||
"treatment": "movable_lease_service",
|
||||
"nature": "Locação de bens móveis corpóreos,incluindo financeira,bens/contrato identificados"
|
||||
}
|
||||
},
|
||||
"routes": {
|
||||
"inbound": "Prestador semsede/EP/domicílio nacional a partir do qual presta;adquirente2(1)a/b comEP/domicílio nacional,incluindo exclusivamente isentos semdedução:territórionacional6(7),responsáveladquirente2(2)/23(2),declaração33(2)nos termosa regulamentar;sem pressupor montante/imposto devido.",
|
||||
"outbound": "Adquirente estabelecido/domiciliado noestrangeiro:6(8)forado âmbitonacional,ainda que prestadortenha sede/EP/domicílio nacional;não isenção/IVAzero nem imposto estrangeiro presumido. Qualidadea/b oculta/conservada,não imposta aestepercurso.",
|
||||
"domestic": "Prestador nacional apartirdo qualpresta eadquirentenacional,sem regraspróprias:6(3);qualidade prestadorSP/regimegeral ereferência permite identificarprestador23(1),casocontrário responsávelindeterminado sem apagarclassificaçãoterritorial."
|
||||
},
|
||||
"formula": "Territorial classification and responsible party only,no monetarycalculation. No righttodeduction prerequisite for6(7);nondigital23(2)excludedigital26(4)/32(1)c routing.",
|
||||
"scope": "2026,serviços enumerados não digitais;localização e identificação do responsável pelas obrigações. Sem isenção confirmada,base,taxa,IVA,montante a pagar,dedução/campo11 ou totaisModeloA. P121/P130digitais eP002transversal não fechados;outros6(4)/(5)encaminhados para percursos próprios. Não automatiza declaração,pagamento,retenção ou prazo digital32(1)c.",
|
||||
"technical_choices": "NewlistedServices opportunity-scoped book in existingmodelo_a snapshot/API/dossier;no schema/permissions. Switchpreserveshiddenparty/quality/targetrefs andclearsownconditions,keepscommon. References or explicitprojectedassumptions reused,no certificates/approvers invented. Requiredfactualrefs explainruleapplication,not provenance revalidation.",
|
||||
"verification": {
|
||||
"frontend": {
|
||||
"tests": 12,
|
||||
"passed": 12,
|
||||
"failed": 0,
|
||||
"by_branch": {
|
||||
"AUD-SIM-L1-P111": "Ownnature,unknown/no,three routes,quality a/b/other,exemptwithoutdeduction allowed,dates/references and separate responsible passed",
|
||||
"AUD-SIM-L1-P112": "Ownnature,unknown/no,three routes,quality a/b/other,exemptwithoutdeduction allowed,dates/references and separate responsible passed",
|
||||
"AUD-SIM-L1-P113": "Ownnature,unknown/no,three routes,quality a/b/other,exemptwithoutdeduction allowed,dates/references and separate responsible passed",
|
||||
"AUD-SIM-L1-P114": "Ownnature,unknown/no,three routes,quality a/b/other,exemptwithoutdeduction allowed,dates/references and separate responsible passed",
|
||||
"AUD-SIM-L1-P115": "Ownnature,unknown/no,three routes,quality a/b/other,exemptwithoutdeduction allowed,dates/references and separate responsible passed",
|
||||
"AUD-SIM-L1-P116": "Ownnature,unknown/no,three routes,quality a/b/other,exemptwithoutdeduction allowed,dates/references and separate responsible passed",
|
||||
"AUD-SIM-L1-P117": "Ownnature,unknown/no,three routes,quality a/b/other,exemptwithoutdeduction allowed,dates/references and separate responsible passed",
|
||||
"AUD-SIM-L1-P118": "Ownnature,unknown/no,three routes,quality a/b/other,exemptwithoutdeduction allowed,dates/references and separate responsible passed",
|
||||
"AUD-SIM-L1-P119": "Ownnature,unknown/no,three routes,quality a/b/other,exemptwithoutdeduction allowed,dates/references and separate responsible passed",
|
||||
"AUD-SIM-L1-P120": "Ownnature,unknown/no,three routes,quality a/b/other,exemptwithoutdeduction allowed,dates/references and separate responsible passed"
|
||||
},
|
||||
"additional": "P118/P119 underlyingclauses/refs,selfreference/digitaltarget guard;switchretains hiddenrefs andclearsownconditions;alloldbooks immutable,currentkeys/history/report/corruptwrites."
|
||||
},
|
||||
"privateAPI": {
|
||||
"tests": 1,
|
||||
"assertions": 109,
|
||||
"target": "simulator_fiscal_delta_20261021_test:55441",
|
||||
"transaction_rollback": true,
|
||||
"xml": "C:\\laragon\\www\\portal-investidor\\outputs\\iva-l1-g9-nondigital-20261024\\api-tests.xml"
|
||||
},
|
||||
"types": "passed",
|
||||
"build": "passed,existing plugin timing warnings",
|
||||
"UI": "Realcomponent Edge/CUA:recipientqualityunknown andP118underlyingclauseunknown make resultsindeterminate;switch buyerforeign applies6(8)andhidesquality,returnMZ restoresunknown qualityandoriginalref;restorea/subjclause then save/recover/report30rows+4previousversions. VAT/base/ratealwaysnull,responsible acquirer/outside/provider. SyntheticQA,notmanualTempoacceptance.",
|
||||
"UI_screenshot": "C:\\laragon\\www\\portal-investidor\\outputs\\iva-l1-g9-nondigital-20261024\\qa-recovered-report.png"
|
||||
},
|
||||
"preservation": {
|
||||
"base": "4853bc7284d3ed3b1fbafa403fd8406705ac3165",
|
||||
"delivered_ids": [
|
||||
"AUD-SIM-L1-P003",
|
||||
"AUD-SIM-L1-P004",
|
||||
"AUD-SIM-L1-P005",
|
||||
"AUD-SIM-L1-P006",
|
||||
"AUD-SIM-L1-P007",
|
||||
"AUD-SIM-L1-P008",
|
||||
"AUD-SIM-L1-P009",
|
||||
"AUD-SIM-L1-P010",
|
||||
"AUD-SIM-L1-P011",
|
||||
"AUD-SIM-L1-P012",
|
||||
"AUD-SIM-L1-P013",
|
||||
"AUD-SIM-L1-P014",
|
||||
"AUD-SIM-L1-P015",
|
||||
"AUD-SIM-L1-P016",
|
||||
"AUD-SIM-L1-P017",
|
||||
"AUD-SIM-L1-P018",
|
||||
"AUD-SIM-L1-P019",
|
||||
"AUD-SIM-L1-P020",
|
||||
"AUD-SIM-L1-P021",
|
||||
"AUD-SIM-L1-P022",
|
||||
"AUD-SIM-L1-P023",
|
||||
"AUD-SIM-L1-P024",
|
||||
"AUD-SIM-L1-P025",
|
||||
"AUD-SIM-L1-P026",
|
||||
"AUD-SIM-L1-P027",
|
||||
"AUD-SIM-L1-P028",
|
||||
"AUD-SIM-L1-P029",
|
||||
"AUD-SIM-L1-P030",
|
||||
"AUD-SIM-L1-P031",
|
||||
"AUD-SIM-L1-P032",
|
||||
"AUD-SIM-L1-P033",
|
||||
"AUD-SIM-L1-P034",
|
||||
"AUD-SIM-L1-P035",
|
||||
"AUD-SIM-L1-P036",
|
||||
"AUD-SIM-L1-P037",
|
||||
"AUD-SIM-L1-P038",
|
||||
"AUD-SIM-L1-P039",
|
||||
"AUD-SIM-L1-P040",
|
||||
"AUD-SIM-L1-P041",
|
||||
"AUD-SIM-L1-P042",
|
||||
"AUD-SIM-L1-P043",
|
||||
"AUD-SIM-L1-P044",
|
||||
"AUD-SIM-L1-P045",
|
||||
"AUD-SIM-L1-P048",
|
||||
"AUD-SIM-L1-P049",
|
||||
"AUD-SIM-L1-P050",
|
||||
"AUD-SIM-L1-P051",
|
||||
"AUD-SIM-L1-P052",
|
||||
"AUD-SIM-L1-P053",
|
||||
"AUD-SIM-L1-P054",
|
||||
"AUD-SIM-L1-P055",
|
||||
"AUD-SIM-L1-P056",
|
||||
"AUD-SIM-L1-P057",
|
||||
"AUD-SIM-L1-P060",
|
||||
"AUD-SIM-L1-P061",
|
||||
"AUD-SIM-L1-P062",
|
||||
"AUD-SIM-L1-P063",
|
||||
"AUD-SIM-L1-P064",
|
||||
"AUD-SIM-L1-P065",
|
||||
"AUD-SIM-L1-P066",
|
||||
"AUD-SIM-L1-P067",
|
||||
"AUD-SIM-L1-P068",
|
||||
"AUD-SIM-L1-P069",
|
||||
"AUD-SIM-L1-P070",
|
||||
"AUD-SIM-L1-P071",
|
||||
"AUD-SIM-L1-P072",
|
||||
"AUD-SIM-L1-P073",
|
||||
"AUD-SIM-L1-P074",
|
||||
"AUD-SIM-L1-P075",
|
||||
"AUD-SIM-L1-P076",
|
||||
"AUD-SIM-L1-P077",
|
||||
"AUD-SIM-L1-P078",
|
||||
"AUD-SIM-L1-P079",
|
||||
"AUD-SIM-L1-P080",
|
||||
"AUD-SIM-L1-P081",
|
||||
"AUD-SIM-L1-P082",
|
||||
"AUD-SIM-L1-P083",
|
||||
"AUD-SIM-L1-P086",
|
||||
"AUD-SIM-L1-P089",
|
||||
"AUD-SIM-L1-P090",
|
||||
"AUD-SIM-L1-P091",
|
||||
"AUD-SIM-L1-P094",
|
||||
"AUD-SIM-L1-P095",
|
||||
"AUD-SIM-L1-P100",
|
||||
"AUD-SIM-L1-P101",
|
||||
"AUD-SIM-L1-P102",
|
||||
"AUD-SIM-L1-P103",
|
||||
"AUD-SIM-L1-P105",
|
||||
"AUD-SIM-L1-P106",
|
||||
"AUD-SIM-L1-P107",
|
||||
"AUD-SIM-L1-P108",
|
||||
"AUD-SIM-L1-P109",
|
||||
"AUD-SIM-L1-P110"
|
||||
],
|
||||
"confirmed_losses": [],
|
||||
"accepted_delivery": "03c26d66/4853bc72;174tables/369files;29published/28relations/408geometries;code/schema/data/config/permissions compared",
|
||||
"frozen": "tests\\frontend\\fixtures\\iva-g9-nondigital-preserved.json",
|
||||
"sha256": "3132adfbbbcde4b2d8c7c7c657dfb38f743d7994650b78bab4931c443eaab628",
|
||||
"scope": "P111–P120QA;all priorbooks/history includingP105–110 andpartialP084/P085 immutable;no activewrites"
|
||||
},
|
||||
"runtime_delta": {
|
||||
"resources/js/lib/iva-listed-services.ts": "fdc05407576a6c68f8158bc797331380c09e84282609a06ae2a7aa2966c54db6",
|
||||
"resources/js/components/simulation-listed-services.tsx": "77badfa54c3bb6e25fe5153bb852cebc48262b64b4aabc9348a2b1838094917a",
|
||||
"resources/js/components/simulation-monthly-iva.tsx": "43446ed6a23b0e101d72ea50f73cdbae0242ace92af12d836a0955cc85800d82",
|
||||
"resources/js/lib/project-dossier.ts": "fea39f530bf7786778dbdadbb6b08678f2a4071bcccc264e3d026155477517c8"
|
||||
},
|
||||
"counts_current": {
|
||||
"delivered": 93,
|
||||
"QA": 10,
|
||||
"functional_pending": 29,
|
||||
"P001": 1,
|
||||
"total": 133
|
||||
},
|
||||
"homologation_unchanged": "03c26d66",
|
||||
"remaining": "OnejointGit integration/delivery for tencompatiblebranches,onebackup/realisolatedrestore,individualQAproofsreused,installeddeltaonly. No individualbranch deployment.",
|
||||
"limits": "P084/P085partial,pending;L1open;P00105/06;beveragesL2/L3;Statistics/AIdeferred",
|
||||
"sources_inventory": "C:\\laragon\\www\\portal-investidor\\outputs\\iva-l1-g9-nondigital-20261024\\source-archive-inventory.json",
|
||||
"qa_status_preserved": "QA_complete_not_delivered",
|
||||
"delivery_followup": {
|
||||
"served_commit": "2a7254406db3aa6e8c71bfbaf56bbcda1f139d19",
|
||||
"receipt": "l1-g9-nondigital-delivery-20261024.json",
|
||||
"record": "iva_l1_g9_nondigital_P111_P120_homologation_20261024",
|
||||
"counts": {
|
||||
"delivered": 103,
|
||||
"QA": 0,
|
||||
"functional_pending": 29,
|
||||
"documentary": 1,
|
||||
"total": 133
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
{
|
||||
"status": "ready_after_fresh_authenticated_preflight_and_verified_backup_restore",
|
||||
"candidate": "af7d2503207c8744cdbb6d96b8cca89fa367384e",
|
||||
"base_installed": "2fdca86367d8bad524113b4cf6c49a0110130be9",
|
||||
"coverage_complete_branches": {
|
||||
"AUD-SIM-L1-P122": [
|
||||
"goods_sale_commission",
|
||||
"goods_purchase_commission"
|
||||
],
|
||||
"AUD-SIM-L1-P128": [
|
||||
"service_sale_mandate",
|
||||
"service_purchase_mandate"
|
||||
]
|
||||
},
|
||||
"branch_count_complete": 2,
|
||||
"treatment_count": 4,
|
||||
"runtime_delta": [
|
||||
{
|
||||
"path": "resources/js/lib/iva-own-name.ts",
|
||||
"sha256_LF": "c36509de24d31d747d91630a31ce7d72baa749e9928b718a944556348fc54f85"
|
||||
},
|
||||
{
|
||||
"path": "resources/js/components/simulation-own-name.tsx",
|
||||
"sha256_LF": "6e142242aa29ae07e36b4d8d0be7d78f770d701e0a92e1a6e9832fcb794c17cf"
|
||||
},
|
||||
{
|
||||
"path": "resources/js/components/simulation-monthly-iva.tsx",
|
||||
"sha256_LF": "9718dc440aa98497011775d8bd03049d7857fa3badf27f4467d6d434f642defd"
|
||||
},
|
||||
{
|
||||
"path": "resources/js/lib/project-dossier.ts",
|
||||
"sha256_LF": "099dc307a86c763a9509516f6d59cc5c454b1f81189cc04b919d8d6045baf9dc"
|
||||
}
|
||||
],
|
||||
"counts_before": {
|
||||
"delivered": 107,
|
||||
"QA": 2,
|
||||
"functional_pending": 23,
|
||||
"documentary": 1,
|
||||
"total": 133
|
||||
},
|
||||
"counts_current": {
|
||||
"delivered": 107,
|
||||
"QA": 2,
|
||||
"functional_pending": 23,
|
||||
"documentary": 1,
|
||||
"total": 133
|
||||
},
|
||||
"counts_after_delivery": {
|
||||
"delivered": 109,
|
||||
"QA": 0,
|
||||
"functional_pending": 23,
|
||||
"documentary": 1,
|
||||
"total": 133
|
||||
},
|
||||
"QA_proofs_reused": [
|
||||
"iva-l1-g10-own-name-qa-20261025.json"
|
||||
],
|
||||
"authorization": "Tempo explicitly requests one joint delivery ofaf7d2503,P122/P128,main compatibility/concurrent changes preserved,installeddelta only",
|
||||
"scope": "2026,circuitos emnome próprio,partes/contratos/objectos econtraprestações originais das duas relações. Sem soma/compensação automática,base tributável nova,localização,isenção,taxa,IVA,dedução/campo11 ou totaisModeloA. Sem conversão cambial;moeda original identificada e coerente com contexto. P091preservado,sem repetir aceitação/cálculo.",
|
||||
"source": "CIVA3(3)c,Lei13/2016PDF6/p1426(264);4(3),PDF7/p1426(265). Lei22/2022não altera3/4;Lei10/2025PDF12mantém3(3)c e não altera4. Base15(2)e/P091já entregue permanece independente;sem nova aplicação da base neste incremento.",
|
||||
"meaning": {
|
||||
"P122": "Transferências de bens em execução de contrato de comissão,incluindo consignação;na venda comissário considerado comprador,na compra comitente considerado comprador. Venda:comitente→comissário→terceiro;compra:terceiro→comissário→comitente. Contraprestações e referências das duas relações separadas.",
|
||||
"P128": "Serviço efectuado por intervenção de mandatário emnome próprio:mandatário considerado adquirente eprestador sucessivamente4(3). Venda/prestação:mandante→mandatário→terceiro;compra/aquisição:terceiro→mandatário→mandante. Não é mera intermediação emnome de outrem ou base15(2)e de bens."
|
||||
},
|
||||
"formula": "Classifytwo successive relations bykind/direction;keep eachoriginalconsideration separate;no monetaryaggregation or taxcalculation.",
|
||||
"preservation": "107prior closures and partialP084/P085 preserved;accepted perbranchQA reused;one integration/backup/real isolatedrestore/check for whole set",
|
||||
"partial_P084_P085": "Preparation/conditional simulation only,benefits pending;no closure",
|
||||
"limits": "L1open;deductionoutsideincrement;P00105/06;P121digital/P084/P085pending;beveragesL2/L3;Statistics/AIdeferred",
|
||||
"containment": "l1-g10-own-name-readonly-rollback-20261025.patch,checked only,not applied;blocks newP096–099classifications,preserves readers/history/otherbranches",
|
||||
"authenticated_preflight": {
|
||||
"installed": {
|
||||
"status": "installed",
|
||||
"commit": "2fdca86367d8bad524113b4cf6c49a0110130be9",
|
||||
"release": "/var/www/investmoz-homologacao/releases/2fdca86367d8bad524113b4cf6c49a0110130be9-c65ebbad",
|
||||
"previous_release": "/var/www/investmoz-homologacao/releases/2a7254406db3aa6e8c71bfbaf56bbcda1f139d19-ae306e0a",
|
||||
"database_migrations": 0,
|
||||
"content_imports": 0
|
||||
},
|
||||
"current_link": "/var/www/investmoz-homologacao/releases/2fdca86367d8bad524113b4cf6c49a0110130be9-c65ebbad",
|
||||
"release_revision": {
|
||||
"commit": "2fdca86367d8bad524113b4cf6c49a0110130be9",
|
||||
"branch": "main",
|
||||
"built_at": "2026-10-24T22:01:48.219730+00:00",
|
||||
"manifest_sha256": "d45edd81644fa6b659aece95804fd9c5e8e99c599ef82bf078ee2ba39e700f12"
|
||||
},
|
||||
"service": "ExecMainStatus=0\nActiveState=inactive\nSubState=dead\n",
|
||||
"configuration_keys": [
|
||||
"repository",
|
||||
"branch",
|
||||
"target_url",
|
||||
"legacy_root",
|
||||
"state_root",
|
||||
"release_root",
|
||||
"current_link",
|
||||
"shared_assets",
|
||||
"php",
|
||||
"schema_contract",
|
||||
"ci_environment",
|
||||
"postgis_image",
|
||||
"test_database",
|
||||
"qa_port",
|
||||
"retention",
|
||||
"webhook_secret_file"
|
||||
],
|
||||
"safe_paths": {
|
||||
"repository": "nala/Investidor-V2",
|
||||
"release_root": "/var/www/investmoz-homologacao/releases",
|
||||
"postgis_image": "postgis/postgis@sha256:01a6a70e41e6c4467c8f55f6063555ed72db2d6662cd0d571040d42eadaeb6f6"
|
||||
},
|
||||
"pipeline_sha256": "adec1c17654f3a8658b83b134f1e75f95391b235738552721906c3236e388604"
|
||||
},
|
||||
"backup_restore": {
|
||||
"backup": {
|
||||
"stage": "/var/backups/investmoz-l1-g10-own-name-delivery-20261025/backup",
|
||||
"target": {
|
||||
"database": "teste_investidor",
|
||||
"port": 5432
|
||||
},
|
||||
"tables": 174,
|
||||
"files_verified": 369,
|
||||
"dump_sha256": "85e90033b54a7eb7fed1bf0de466b984f5c03cc3b4938b5d8db20b7bf0abf954",
|
||||
"files_sha256": "291e2c871d94c3b642252f8daa8a9d7557278f13028e68df78b5f6edec5b1234",
|
||||
"restore_verified": false
|
||||
},
|
||||
"restore": {
|
||||
"restore_verified": true,
|
||||
"tables_verified": 174,
|
||||
"container_network": "none",
|
||||
"database": "l1_g10_own_name_restore_20261024",
|
||||
"port": 55441,
|
||||
"source_dump_sha256": "85e90033b54a7eb7fed1bf0de466b984f5c03cc3b4938b5d8db20b7bf0abf954",
|
||||
"active_database_writes": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
--- a/resources/js/lib/iva-own-name.ts
|
||||
+++ b/resources/js/lib/iva-own-name.ts
|
||||
@@ -45,6 +45,7 @@
|
||||
function key(draft:Record<string,unknown>,book:OwnNameBook):string{return JSON.stringify({version:ownNameVersion,scope:acquisitionScope(draft),location:draft.selection_labels??{},currency:draft.currency,rows:book.rows});}
|
||||
export function ownNameCurrent(draft:Record<string,unknown>,book:OwnNameBook):boolean{return!!book.result&&book.result.sourceKey===key(draft,book);}
|
||||
export function recordOwnNames(draft:Record<string,unknown>,book:OwnNameBook):OwnNameBook{
|
||||
+ throw new Error('Novas classificações P122/P128 temporariamente suspensas; dados, histórico, relatórios e restantes ramos preservados.');
|
||||
if(!book.rows.length||new Set(book.rows.map(row=>row.id)).size!==book.rows.length)throw new Error('Indique operações com identificadores distintos;originais conservados.');
|
||||
const result:OwnNameCalculation={version:ownNameVersion,revision:(book.result?.revision??0)+1,calculatedAt:new Date().toISOString(),opportunity:acquisitionScope(draft),location:JSON.stringify(draft.selection_labels??{}),sourceKey:key(draft,book),source:ownNameSource,inputs:structuredClone(book.rows),rows:book.rows.map(row=>evaluateOwnName(row,draft.currency))};
|
||||
const next={...book,result,history:[...(book.history??[]),...(book.result?[book.result]:[])]};saveOwnNameBook(draft,next);return next;
|
||||
@@ -0,0 +1,343 @@
|
||||
{
|
||||
"status": "installed_delta_verified_partial_L1",
|
||||
"candidate": "833b4e5cef4334220fd3f27843d520113e9ba0cd",
|
||||
"base_installed": "2a7254406db3aa6e8c71bfbaf56bbcda1f139d19",
|
||||
"coverage_complete_branches": {
|
||||
"AUD-SIM-L1-P096": [
|
||||
"regulated_energy"
|
||||
],
|
||||
"AUD-SIM-L1-P097": [
|
||||
"aeronautical_fees"
|
||||
],
|
||||
"AUD-SIM-L1-P098": [
|
||||
"public_works"
|
||||
],
|
||||
"AUD-SIM-L1-P099": [
|
||||
"public_water"
|
||||
]
|
||||
},
|
||||
"branch_count_complete": 4,
|
||||
"treatment_count": 4,
|
||||
"runtime_delta": [
|
||||
{
|
||||
"path": "resources/js/lib/iva-reduced-bases.ts",
|
||||
"sha256_LF": "4fc79388066a4d012b9af279ef53212ee963ae43d858307155e9ae8a140b5285"
|
||||
},
|
||||
{
|
||||
"path": "resources/js/components/simulation-reduced-bases.tsx",
|
||||
"sha256_LF": "00f1e0f1490240f578401c3a6e10b6812ee5b7978bbf7d7e5c9c1a81124bc6d1"
|
||||
},
|
||||
{
|
||||
"path": "resources/js/components/simulation-monthly-iva.tsx",
|
||||
"sha256_LF": "6032b9605703e7e29d5fb45cc158e8da57b9af4980d312f3326ddf18ee1e8814"
|
||||
},
|
||||
{
|
||||
"path": "resources/js/lib/project-dossier.ts",
|
||||
"sha256_LF": "ab044a0952cc4753925768f5ba7fd422637cfb9d826c1e8c26d21d7616b6dacf"
|
||||
}
|
||||
],
|
||||
"counts_before": {
|
||||
"delivered": 103,
|
||||
"QA": 4,
|
||||
"functional_pending": 25,
|
||||
"documentary": 1,
|
||||
"total": 133
|
||||
},
|
||||
"counts_current": {
|
||||
"delivered": 107,
|
||||
"QA": 0,
|
||||
"functional_pending": 25,
|
||||
"documentary": 1,
|
||||
"total": 133
|
||||
},
|
||||
"counts_after_delivery": {
|
||||
"delivered": 107,
|
||||
"QA": 0,
|
||||
"functional_pending": 25,
|
||||
"documentary": 1,
|
||||
"total": 133
|
||||
},
|
||||
"QA_proofs_reused": [
|
||||
"iva-l1-g7-reduced-bases-qa-20261024.json"
|
||||
],
|
||||
"authorization": "Tempo explicitly requests one joint delivery of833b4e5c,P096–P099,main compatibility/concurrent changes preserved,installeddelta only",
|
||||
"scope": "2026/MZN,base apenas. Percentagens62/85/40/75 são de base,não taxasIVA. Proporção18(6)registada sem calcular/conceder dedução/campo11;dedução permanece nas condições/lotes próprios. Sem taxaIVA,IVA,isenção ou totaisModeloA. Não dividir bruto comIVA sem composição esclarecida,nem reduzir montante já reduzido.",
|
||||
"source": "CIVA15(2)j/k/l/m,15(1)/(5)/(6)/(9),Lei13/2016PDF13–14/p1426(271–272);Lei22/2022PDF3mantém15(2)j–m;Lei10/2025não altera15,adita18(6),PDF13:dedução do imposto suportado relativo a essas operações na mesma proporção da base reduzida.",
|
||||
"meaning": {
|
||||
"P096": {
|
||||
"treatment": "regulated_energy",
|
||||
"formula": "contraprestação total antes redução,sempróprioIVA ×62%",
|
||||
"conditions": "Transmissão de energia com preço fixado porAutoridadePública,referência/âmbito/intervalo aplicáveis."
|
||||
},
|
||||
"P097": {
|
||||
"treatment": "aeronautical_fees",
|
||||
"formula": "contraprestação total antes redução,sempróprioIVA ×85%",
|
||||
"conditions": "Preço doserviço fixado através de taxas aeronáuticas. Não aplicar a comunicações/saneamento/telecomunicações genericamente pelo título histórico da matriz;é necessário demonstrar o preço fixado através de taxa aeronáutica15(2)k."
|
||||
},
|
||||
"P098": {
|
||||
"treatment": "public_works",
|
||||
"formula": "contraprestação total antes redução,sempróprioIVA ×40%(redução60%,não base60%)",
|
||||
"conditions": "Construção/reabilitação de obras públicas abrangidas15(2)l/15(9),projecto/contrato/categoria/âmbito identificados;estradas,pontes,infraestrutura água/saneamento,electrificação rural emprojectos públicos e hidráulicaagrícola noâmbito definido. Não exigir preço regulado a esta alínea."
|
||||
},
|
||||
"P099": {
|
||||
"treatment": "public_water",
|
||||
"formula": "contraprestação total antes redução,sempróprioIVA ×75%",
|
||||
"conditions": "Água potável através derede pública,preço fixado porAutoridadePública comreferência/âmbito/intervalo aplicáveis."
|
||||
}
|
||||
},
|
||||
"formula": "Base=fullconsideration before reduction excludingownVAT ×branchpercentage once;exactdecimal retained,no fiscalrounding assumed.",
|
||||
"preservation": "103prior closures and partialP084/P085 preserved;accepted perbranchQA reused;one integration/backup/real isolatedrestore/check for whole set",
|
||||
"partial_P084_P085": "Preparation/conditional simulation only,benefits pending;no closure",
|
||||
"limits": "P121digital/P084/P085pending;L1open;P00105/06;beveragesL2/L3;Statistics/AIdeferred",
|
||||
"containment": "l1-g7-reduced-readonly-rollback-20261024.patch,checked only,not applied;blocks newP096–099classifications,preserves readers/history/otherbranches",
|
||||
"authenticated_preflight": {
|
||||
"installed": {
|
||||
"status": "installed",
|
||||
"commit": "2a7254406db3aa6e8c71bfbaf56bbcda1f139d19",
|
||||
"release": "/var/www/investmoz-homologacao/releases/2a7254406db3aa6e8c71bfbaf56bbcda1f139d19-ae306e0a",
|
||||
"previous_release": "/var/www/investmoz-homologacao/releases/03c26d66139f36573cf58362a5076b4d5f98eca2-ac76aca8",
|
||||
"database_migrations": 0,
|
||||
"content_imports": 0
|
||||
},
|
||||
"current_link": "/var/www/investmoz-homologacao/releases/2a7254406db3aa6e8c71bfbaf56bbcda1f139d19-ae306e0a",
|
||||
"release_revision": {
|
||||
"commit": "2a7254406db3aa6e8c71bfbaf56bbcda1f139d19",
|
||||
"branch": "main",
|
||||
"built_at": "2026-10-24T21:51:55.419637+00:00",
|
||||
"manifest_sha256": "a04bb2c3e527c027aa263827b37e1566b67b372c479904112cfef79de9bcf2fb"
|
||||
},
|
||||
"service": "ExecMainStatus=0\nActiveState=inactive\nSubState=dead\n",
|
||||
"configuration_keys": [
|
||||
"repository",
|
||||
"branch",
|
||||
"target_url",
|
||||
"legacy_root",
|
||||
"state_root",
|
||||
"release_root",
|
||||
"current_link",
|
||||
"shared_assets",
|
||||
"php",
|
||||
"schema_contract",
|
||||
"ci_environment",
|
||||
"postgis_image",
|
||||
"test_database",
|
||||
"qa_port",
|
||||
"retention",
|
||||
"webhook_secret_file"
|
||||
],
|
||||
"safe_paths": {
|
||||
"repository": "nala/Investidor-V2",
|
||||
"release_root": "/var/www/investmoz-homologacao/releases",
|
||||
"postgis_image": "postgis/postgis@sha256:01a6a70e41e6c4467c8f55f6063555ed72db2d6662cd0d571040d42eadaeb6f6"
|
||||
},
|
||||
"pipeline_sha256": "adec1c17654f3a8658b83b134f1e75f95391b235738552721906c3236e388604"
|
||||
},
|
||||
"backup_restore": {
|
||||
"backup": {
|
||||
"stage": "/var/backups/investmoz-l1-g7-reduced-delivery-20261024/backup",
|
||||
"target": {
|
||||
"database": "teste_investidor",
|
||||
"port": 5432
|
||||
},
|
||||
"tables": 174,
|
||||
"files_verified": 369,
|
||||
"dump_sha256": "844803edd3a18d94ebd1cc75f942cce73b113111c92342ff32acf178b27f210d",
|
||||
"files_sha256": "0b8a20760cdb89e2d7ac03e4b00881a882946370b9d7fa5a428355111e5ace4c",
|
||||
"restore_verified": false
|
||||
},
|
||||
"restore": {
|
||||
"restore_verified": true,
|
||||
"tables_verified": 174,
|
||||
"container_network": "none",
|
||||
"database": "l1_g7_reduced_restore_20261024",
|
||||
"port": 55441,
|
||||
"source_dump_sha256": "844803edd3a18d94ebd1cc75f942cce73b113111c92342ff32acf178b27f210d",
|
||||
"active_database_writes": 0
|
||||
}
|
||||
},
|
||||
"delivery_local_date": "2026-10-25",
|
||||
"delivery_timezone": "Africa/Johannesburg",
|
||||
"batch_identifier_date_preserved": "20261024",
|
||||
"served_commit": "2fdca86367d8bad524113b4cf6c49a0110130be9",
|
||||
"installation": {
|
||||
"protected": {
|
||||
"installed": {
|
||||
"status": "installed",
|
||||
"commit": "2fdca86367d8bad524113b4cf6c49a0110130be9",
|
||||
"release": "/var/www/investmoz-homologacao/releases/2fdca86367d8bad524113b4cf6c49a0110130be9-c65ebbad",
|
||||
"previous_release": "/var/www/investmoz-homologacao/releases/2a7254406db3aa6e8c71bfbaf56bbcda1f139d19-ae306e0a",
|
||||
"database_migrations": 0,
|
||||
"content_imports": 0
|
||||
},
|
||||
"runtime_files_verified": 4,
|
||||
"persistent_files_and_env_verified": 369,
|
||||
"tables_compared": 174,
|
||||
"changed_tables": {
|
||||
"cache": {
|
||||
"before": {
|
||||
"rows": 106,
|
||||
"checksum": "fc22bd1093218afa1777652f5fffb28c"
|
||||
},
|
||||
"after": {
|
||||
"rows": 106,
|
||||
"checksum": "60c94ff2cef9ca39b64d2c8035070dff"
|
||||
}
|
||||
},
|
||||
"sessions": {
|
||||
"before": {
|
||||
"rows": 90,
|
||||
"checksum": "242150536cdc201c41ae0e40414c384d"
|
||||
},
|
||||
"after": {
|
||||
"rows": 91,
|
||||
"checksum": "8c3ccd96b9dc1fa7897ce7976df83f6b"
|
||||
}
|
||||
}
|
||||
},
|
||||
"preserved_counts": {
|
||||
"published_fiches": 29,
|
||||
"relations": 28,
|
||||
"geometries": 408
|
||||
},
|
||||
"migration_count": 0,
|
||||
"content_imports": 0,
|
||||
"comparison_role": "postgres_before_and_after;sameexportedsnapshotbaseline;noapplicationRLSvisibilityinference",
|
||||
"writes_by_verification": 0
|
||||
},
|
||||
"public": {
|
||||
"status": "installed_delta_verified",
|
||||
"served_revision": {
|
||||
"commit": "2fdca86367d8bad524113b4cf6c49a0110130be9",
|
||||
"branch": "main",
|
||||
"built_at": "2026-10-24T22:01:48.219730+00:00",
|
||||
"manifest_sha256": "d45edd81644fa6b659aece95804fd9c5e8e99c599ef82bf078ee2ba39e700f12"
|
||||
},
|
||||
"manifest_hash_matches": true,
|
||||
"compiled_delta_markers": {
|
||||
"proportional-bases/1": [
|
||||
"assets/project-dossier-DNLCPaVL.js"
|
||||
],
|
||||
"regulated_energy": [
|
||||
"assets/project-dossier-DNLCPaVL.js"
|
||||
],
|
||||
"aeronautical_fees": [
|
||||
"assets/project-dossier-DNLCPaVL.js"
|
||||
],
|
||||
"public_works": [
|
||||
"assets/services-C-RxFM34.js",
|
||||
"assets/project-dossier-DNLCPaVL.js"
|
||||
],
|
||||
"public_water": [
|
||||
"assets/project-dossier-DNLCPaVL.js"
|
||||
],
|
||||
"regulatedReducedBases": [
|
||||
"assets/project-dossier-DNLCPaVL.js"
|
||||
],
|
||||
"fullNetInvoice": [
|
||||
"assets/project-dossier-DNLCPaVL.js"
|
||||
],
|
||||
"scopeMatches": [
|
||||
"assets/project-dossier-DNLCPaVL.js"
|
||||
],
|
||||
"publicFixedPrice": [
|
||||
"assets/project-dossier-DNLCPaVL.js"
|
||||
],
|
||||
"workCategoryMatches": [
|
||||
"assets/project-dossier-DNLCPaVL.js"
|
||||
],
|
||||
"deductionProportion": [
|
||||
"assets/project-dossier-DNLCPaVL.js"
|
||||
],
|
||||
"consideration": [
|
||||
"assets/services-C-RxFM34.js",
|
||||
"assets/project-dossier-DNLCPaVL.js"
|
||||
],
|
||||
"compositionRef": [
|
||||
"assets/services-C-RxFM34.js",
|
||||
"assets/project-dossier-DNLCPaVL.js"
|
||||
],
|
||||
"projectRef": [
|
||||
"assets/services-C-RxFM34.js",
|
||||
"assets/project-dossier-DNLCPaVL.js"
|
||||
],
|
||||
"workCategory": [
|
||||
"assets/services-C-RxFM34.js",
|
||||
"assets/project-dossier-DNLCPaVL.js"
|
||||
],
|
||||
"IVA: Indeterminado": [
|
||||
"assets/project-dossier-DNLCPaVL.js"
|
||||
]
|
||||
},
|
||||
"assets": [
|
||||
{
|
||||
"file": "assets/services-C-RxFM34.js",
|
||||
"status": 200,
|
||||
"sha256": "10b075f5e0e73b50ca8c50bc3b78b6a985064b04db20964880e02eb1d4b54463"
|
||||
},
|
||||
{
|
||||
"file": "assets/simulation-form-CPZAFZU3.js",
|
||||
"status": 200,
|
||||
"sha256": "c6bcf64e60a5eeac0cafe3dc055dc5544162f21942ee08b34d51bc6d52947567"
|
||||
},
|
||||
{
|
||||
"file": "assets/project-dossier-DNLCPaVL.js",
|
||||
"status": 200,
|
||||
"sha256": "e92f51bbe03990bb075096fd4036f903c47a13b55be7d41ae33462ae392e553a"
|
||||
},
|
||||
{
|
||||
"file": "assets/project-dossier-document-CMVlVhKB.js",
|
||||
"status": 200,
|
||||
"sha256": "d707cab4744f123b860cd9b6da836d88f1ac83eba2cdc6c96fa5c6d4eccd7131"
|
||||
}
|
||||
],
|
||||
"simulator_status": 200,
|
||||
"simulator_entry": "assets/app-D3qtybUs.js",
|
||||
"existing_fiscal_availability": {
|
||||
"data": {
|
||||
"enabled": true,
|
||||
"coverage_start": "2026-01-01",
|
||||
"coverage_end": "2026-12-31",
|
||||
"message": "IVA geral sobre base líquida disponível; enquadramento declarado."
|
||||
}
|
||||
},
|
||||
"synthetic_private_writes": 0,
|
||||
"method": "Read-only installedrevision/manifest/newcompiledcatalogueandreaders/simulatorentry;acceptedQAproofsreused"
|
||||
},
|
||||
"installer": {
|
||||
"service": "ExecMainStatus=0\nActiveState=inactive\nSubState=dead\n",
|
||||
"installed": {
|
||||
"status": "installed",
|
||||
"commit": "2fdca86367d8bad524113b4cf6c49a0110130be9",
|
||||
"release": "/var/www/investmoz-homologacao/releases/2fdca86367d8bad524113b4cf6c49a0110130be9-c65ebbad",
|
||||
"previous_release": "/var/www/investmoz-homologacao/releases/2a7254406db3aa6e8c71bfbaf56bbcda1f139d19-ae306e0a",
|
||||
"database_migrations": 0,
|
||||
"content_imports": 0
|
||||
},
|
||||
"latest_report": {
|
||||
"status": "installed",
|
||||
"commit": "2fdca86367d8bad524113b4cf6c49a0110130be9",
|
||||
"release": "/var/www/investmoz-homologacao/releases/2fdca86367d8bad524113b4cf6c49a0110130be9-c65ebbad",
|
||||
"previous_release": "/var/www/investmoz-homologacao/releases/2a7254406db3aa6e8c71bfbaf56bbcda1f139d19-ae306e0a",
|
||||
"database_migrations": 0,
|
||||
"content_imports": 0,
|
||||
"requested_commits": [
|
||||
"2fdca86367d8bad524113b4cf6c49a0110130be9"
|
||||
],
|
||||
"finished_at": "2026-10-24T22:01:51.055662+00:00"
|
||||
},
|
||||
"log_file": "1792879201936459656.log",
|
||||
"summaries": [
|
||||
"OK (1 test, 3106 assertions)",
|
||||
"built in 28.30s",
|
||||
"OK (59 tests, 317 assertions)",
|
||||
"# tests 407",
|
||||
"# pass 407",
|
||||
"# fail 0"
|
||||
],
|
||||
"log_bytes": 145227
|
||||
},
|
||||
"rollback_executed": false
|
||||
},
|
||||
"base_VAT_separation": "Accepted perbranchQA reused:P096energy62%,P097aeronautical85%,P098publicworks40%(reduction60%),P099publicwater75%. These percentages apply to taxableBASE,not VATrates. Exactdecimal base applied once to fullconsideration before reduction excludingownVAT. Art18(6)deductionproportion notedonly;deduction/field11 outsideincrement,no VAT/deductioncalculated. Four installedruntimehashes/16compiledmarkers,103priorclosures preserved,no syntheticactivewrites.",
|
||||
"activation": "OnejointGit fast-forward/webhook/installer;zero migrations/imports"
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
--- a/resources/js/lib/iva-reduced-bases.ts
|
||||
+++ b/resources/js/lib/iva-reduced-bases.ts
|
||||
@@ -53,6 +53,7 @@
|
||||
function key(draft:Record<string,unknown>,book:ReducedBaseBook):string{return JSON.stringify({version:reducedBaseVersion,scope:acquisitionScope(draft),location:draft.selection_labels??{},currency:draft.currency,rows:book.rows});}
|
||||
export function reducedBaseCurrent(draft:Record<string,unknown>,book:ReducedBaseBook):boolean{return!!book.result&&book.result.sourceKey===key(draft,book);}
|
||||
export function recordReducedBases(draft:Record<string,unknown>,book:ReducedBaseBook):ReducedBaseBook{
|
||||
+ throw new Error('Novas classificações P096–P099 temporariamente suspensas; dados, histórico, relatórios e restantes ramos preservados.');
|
||||
if(!book.rows.length||new Set(book.rows.map(row=>row.id)).size!==book.rows.length)throw new Error('Indique operações com identificadores distintos;originais conservados.');
|
||||
const result:ReducedBaseCalculation={version:reducedBaseVersion,revision:(book.result?.revision??0)+1,calculatedAt:new Date().toISOString(),opportunity:acquisitionScope(draft),location:JSON.stringify(draft.selection_labels??{}),sourceKey:key(draft,book),source:reducedBaseSource,inputs:structuredClone(book.rows),rows:book.rows.map(row=>evaluateReducedBase(row,draft.currency))};
|
||||
const next={...book,result,history:[...(book.history??[]),...(book.result?[book.result]:[])]};saveReducedBaseBook(draft,next);return next;
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"status": "ready_after_fresh_authenticated_preflight_and_verified_backup_restore",
|
||||
"status": "installed_delta_verified_partial_L1",
|
||||
"candidate": "3f4e71c3f360505dcb53c12376d14ee91643f3cd",
|
||||
"base_installed": "8f14f5dde24819fce062dc316ed21dfbe033ebf8",
|
||||
"coverage_complete_branches": {
|
||||
@@ -47,8 +47,8 @@
|
||||
"total": 133
|
||||
},
|
||||
"counts_current": {
|
||||
"delivered": 88,
|
||||
"QA": 5,
|
||||
"delivered": 93,
|
||||
"QA": 0,
|
||||
"functional_pending": 39,
|
||||
"documentary": 1,
|
||||
"total": 133
|
||||
@@ -142,5 +142,197 @@
|
||||
"source_dump_sha256": "1188dd6c559ba60472c26a9332765b5157bd2b25ba66655b0311d5584c18b919",
|
||||
"active_database_writes": 0
|
||||
}
|
||||
}
|
||||
},
|
||||
"served_commit": "03c26d66139f36573cf58362a5076b4d5f98eca2",
|
||||
"installation": {
|
||||
"protected": {
|
||||
"installed": {
|
||||
"status": "installed",
|
||||
"commit": "03c26d66139f36573cf58362a5076b4d5f98eca2",
|
||||
"release": "/var/www/investmoz-homologacao/releases/03c26d66139f36573cf58362a5076b4d5f98eca2-ac76aca8",
|
||||
"previous_release": "/var/www/investmoz-homologacao/releases/8f14f5dde24819fce062dc316ed21dfbe033ebf8-6abb42c2",
|
||||
"database_migrations": 0,
|
||||
"content_imports": 0
|
||||
},
|
||||
"runtime_files_verified": 4,
|
||||
"persistent_files_and_env_verified": 369,
|
||||
"tables_compared": 174,
|
||||
"changed_tables": {
|
||||
"cache": {
|
||||
"before": {
|
||||
"rows": 106,
|
||||
"checksum": "555fd286e63d7efbd8080a4539536e17"
|
||||
},
|
||||
"after": {
|
||||
"rows": 106,
|
||||
"checksum": "1549defd5f3415c655fef9d5c1eacec9"
|
||||
}
|
||||
},
|
||||
"sessions": {
|
||||
"before": {
|
||||
"rows": 84,
|
||||
"checksum": "4a8cb0e5713004dc915ae58634691888"
|
||||
},
|
||||
"after": {
|
||||
"rows": 85,
|
||||
"checksum": "2dc4aeb9fab2ea3553e91d84f14e9b98"
|
||||
}
|
||||
}
|
||||
},
|
||||
"preserved_counts": {
|
||||
"published_fiches": 29,
|
||||
"relations": 28,
|
||||
"geometries": 408
|
||||
},
|
||||
"migration_count": 0,
|
||||
"content_imports": 0,
|
||||
"comparison_role": "postgres_before_and_after;sameexportedsnapshotbaseline;noapplicationRLSvisibilityinference",
|
||||
"writes_by_verification": 0
|
||||
},
|
||||
"public": {
|
||||
"status": "installed_delta_verified",
|
||||
"served_revision": {
|
||||
"commit": "03c26d66139f36573cf58362a5076b4d5f98eca2",
|
||||
"branch": "main",
|
||||
"built_at": "2026-10-24T21:42:26.795541+00:00",
|
||||
"manifest_sha256": "7deb424f38c7361d0a8df4d0be22464ab066a01e5aa38ece15fa62115c15f8c4"
|
||||
},
|
||||
"manifest_hash_matches": true,
|
||||
"compiled_delta_markers": {
|
||||
"service-territoriality/1": [
|
||||
"assets/project-dossier-CyMPKo3h.js"
|
||||
],
|
||||
"general_service": [
|
||||
"assets/project-dossier-CyMPKo3h.js",
|
||||
"assets/services-CZ5pQbhW.js"
|
||||
],
|
||||
"immovable_service": [
|
||||
"assets/project-dossier-CyMPKo3h.js",
|
||||
"assets/services-CZ5pQbhW.js"
|
||||
],
|
||||
"movable_work": [
|
||||
"assets/project-dossier-CyMPKo3h.js",
|
||||
"assets/services-CZ5pQbhW.js"
|
||||
],
|
||||
"activity_service": [
|
||||
"assets/project-dossier-CyMPKo3h.js"
|
||||
],
|
||||
"transport_service": [
|
||||
"assets/project-dossier-CyMPKo3h.js",
|
||||
"assets/services-CZ5pQbhW.js"
|
||||
],
|
||||
"serviceLocations": [
|
||||
"assets/project-dossier-CyMPKo3h.js"
|
||||
],
|
||||
"providerEstablishment": [
|
||||
"assets/project-dossier-CyMPKo3h.js"
|
||||
],
|
||||
"propertyRelation": [
|
||||
"assets/project-dossier-CyMPKo3h.js"
|
||||
],
|
||||
"totalEssential": [
|
||||
"assets/project-dossier-CyMPKo3h.js"
|
||||
],
|
||||
"materialActivity": [
|
||||
"assets/project-dossier-CyMPKo3h.js"
|
||||
],
|
||||
"routeCorresponds": [
|
||||
"assets/project-dossier-CyMPKo3h.js"
|
||||
],
|
||||
"totalDistance": [
|
||||
"assets/project-dossier-CyMPKo3h.js",
|
||||
"assets/services-CZ5pQbhW.js"
|
||||
],
|
||||
"nationalDistance": [
|
||||
"assets/project-dossier-CyMPKo3h.js",
|
||||
"assets/services-CZ5pQbhW.js"
|
||||
],
|
||||
"providerCountry": [
|
||||
"assets/project-dossier-CyMPKo3h.js",
|
||||
"assets/services-CZ5pQbhW.js"
|
||||
],
|
||||
"subjectRef": [
|
||||
"assets/project-dossier-CyMPKo3h.js",
|
||||
"assets/services-CZ5pQbhW.js"
|
||||
],
|
||||
"IVA: Indeterminado": [
|
||||
"assets/project-dossier-CyMPKo3h.js"
|
||||
],
|
||||
"08/06/2017": [
|
||||
"assets/project-dossier-CyMPKo3h.js",
|
||||
"assets/services-CZ5pQbhW.js"
|
||||
]
|
||||
},
|
||||
"assets": [
|
||||
{
|
||||
"file": "assets/project-dossier-CyMPKo3h.js",
|
||||
"status": 200,
|
||||
"sha256": "2b4728486975e76e77f8f343dcd6c4f82d32385f9b70af212e204b4bb500bb69"
|
||||
},
|
||||
{
|
||||
"file": "assets/simulation-form-CPZAFZU3.js",
|
||||
"status": 200,
|
||||
"sha256": "c6bcf64e60a5eeac0cafe3dc055dc5544162f21942ee08b34d51bc6d52947567"
|
||||
},
|
||||
{
|
||||
"file": "assets/project-dossier-document-ESDgCIR1.js",
|
||||
"status": 200,
|
||||
"sha256": "731071c47247f46f2f693f51dbad7e2ad7fd3f122c873b7525c844788ccedb2c"
|
||||
},
|
||||
{
|
||||
"file": "assets/services-CZ5pQbhW.js",
|
||||
"status": 200,
|
||||
"sha256": "23ee3e239b2b0b3aa977486aee55212babc601b7599e42943d3298d6f4affe43"
|
||||
}
|
||||
],
|
||||
"simulator_status": 200,
|
||||
"simulator_entry": "assets/app-D23Ij5K_.js",
|
||||
"existing_fiscal_availability": {
|
||||
"data": {
|
||||
"enabled": true,
|
||||
"coverage_start": "2026-01-01",
|
||||
"coverage_end": "2026-12-31",
|
||||
"message": "IVA geral sobre base líquida disponível; enquadramento declarado."
|
||||
}
|
||||
},
|
||||
"synthetic_private_writes": 0,
|
||||
"method": "Read-only installedrevision/manifest/newcompiledcatalogueandreaders/simulatorentry;acceptedQAproofsreused"
|
||||
},
|
||||
"installer": {
|
||||
"service": "ExecMainStatus=0\nActiveState=inactive\nSubState=dead\n",
|
||||
"installed": {
|
||||
"status": "installed",
|
||||
"commit": "03c26d66139f36573cf58362a5076b4d5f98eca2",
|
||||
"release": "/var/www/investmoz-homologacao/releases/03c26d66139f36573cf58362a5076b4d5f98eca2-ac76aca8",
|
||||
"previous_release": "/var/www/investmoz-homologacao/releases/8f14f5dde24819fce062dc316ed21dfbe033ebf8-6abb42c2",
|
||||
"database_migrations": 0,
|
||||
"content_imports": 0
|
||||
},
|
||||
"latest_report": {
|
||||
"status": "installed",
|
||||
"commit": "03c26d66139f36573cf58362a5076b4d5f98eca2",
|
||||
"release": "/var/www/investmoz-homologacao/releases/03c26d66139f36573cf58362a5076b4d5f98eca2-ac76aca8",
|
||||
"previous_release": "/var/www/investmoz-homologacao/releases/8f14f5dde24819fce062dc316ed21dfbe033ebf8-6abb42c2",
|
||||
"database_migrations": 0,
|
||||
"content_imports": 0,
|
||||
"requested_commits": [
|
||||
"03c26d66139f36573cf58362a5076b4d5f98eca2"
|
||||
],
|
||||
"finished_at": "2026-10-24T21:42:30.119032+00:00"
|
||||
},
|
||||
"log_file": "1792878042157298229.log",
|
||||
"summaries": [
|
||||
"OK (1 test, 3106 assertions)",
|
||||
"built in 27.76s",
|
||||
"OK (59 tests, 317 assertions)",
|
||||
"# tests 389",
|
||||
"# pass 389",
|
||||
"# fail 0"
|
||||
],
|
||||
"log_bytes": 141421
|
||||
},
|
||||
"rollback_executed": false
|
||||
},
|
||||
"base_VAT_separation": "Accepted perbranchQA reused:P106general providerestablishment,P107propertylocation,P108total/essential movablework,P109materialactivities,P110national/deemednational/mixedroute. AvisoBR89-I08/06/2017PDF1rectification6(5)c/d maintained. Territorial classification independentof exemption/base/rate/VAT/deductionfield11. Four installedruntime hashes/18compiledmarkers;88previousclosures preserved;no syntheticactivewrite.",
|
||||
"activation": "OnejointGit fast-forward/webhook/installer;zero migrations/imports"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,402 @@
|
||||
{
|
||||
"status": "installed_delta_verified_partial_L1",
|
||||
"candidate": "4601bf64a03a02254cbf2e247374996cb36b6a49",
|
||||
"base_installed": "03c26d66139f36573cf58362a5076b4d5f98eca2",
|
||||
"coverage_complete_branches": {
|
||||
"AUD-SIM-L1-P111": [
|
||||
"rights_service"
|
||||
],
|
||||
"AUD-SIM-L1-P112": [
|
||||
"advertising_service"
|
||||
],
|
||||
"AUD-SIM-L1-P113": [
|
||||
"telecom_service"
|
||||
],
|
||||
"AUD-SIM-L1-P114": [
|
||||
"consulting_service"
|
||||
],
|
||||
"AUD-SIM-L1-P115": [
|
||||
"data_service"
|
||||
],
|
||||
"AUD-SIM-L1-P116": [
|
||||
"finance_service"
|
||||
],
|
||||
"AUD-SIM-L1-P117": [
|
||||
"staff_service"
|
||||
],
|
||||
"AUD-SIM-L1-P118": [
|
||||
"intermediation_service"
|
||||
],
|
||||
"AUD-SIM-L1-P119": [
|
||||
"abstention_service"
|
||||
],
|
||||
"AUD-SIM-L1-P120": [
|
||||
"movable_lease_service"
|
||||
]
|
||||
},
|
||||
"branch_count_complete": 10,
|
||||
"treatment_count": 10,
|
||||
"runtime_delta": [
|
||||
{
|
||||
"path": "resources/js/lib/iva-listed-services.ts",
|
||||
"sha256_LF": "fdc05407576a6c68f8158bc797331380c09e84282609a06ae2a7aa2966c54db6"
|
||||
},
|
||||
{
|
||||
"path": "resources/js/components/simulation-listed-services.tsx",
|
||||
"sha256_LF": "77badfa54c3bb6e25fe5153bb852cebc48262b64b4aabc9348a2b1838094917a"
|
||||
},
|
||||
{
|
||||
"path": "resources/js/components/simulation-monthly-iva.tsx",
|
||||
"sha256_LF": "43446ed6a23b0e101d72ea50f73cdbae0242ace92af12d836a0955cc85800d82"
|
||||
},
|
||||
{
|
||||
"path": "resources/js/lib/project-dossier.ts",
|
||||
"sha256_LF": "fea39f530bf7786778dbdadbb6b08678f2a4071bcccc264e3d026155477517c8"
|
||||
}
|
||||
],
|
||||
"counts_before": {
|
||||
"delivered": 93,
|
||||
"QA": 10,
|
||||
"functional_pending": 29,
|
||||
"documentary": 1,
|
||||
"total": 133
|
||||
},
|
||||
"counts_current": {
|
||||
"delivered": 103,
|
||||
"QA": 0,
|
||||
"functional_pending": 29,
|
||||
"documentary": 1,
|
||||
"total": 133
|
||||
},
|
||||
"counts_after_delivery": {
|
||||
"delivered": 103,
|
||||
"QA": 0,
|
||||
"functional_pending": 29,
|
||||
"documentary": 1,
|
||||
"total": 133
|
||||
},
|
||||
"QA_proofs_reused": [
|
||||
"iva-l1-g9-nondigital-qa-20261024.json"
|
||||
],
|
||||
"authorization": "Tempo explicitly requests one joint delivery of4601bf64,P111–P120,main compatibility/concurrent changes preserved,installeddelta only",
|
||||
"scope": "2026,serviços enumerados não digitais;localização e identificação do responsável pelas obrigações. Sem isenção confirmada,base,taxa,IVA,montante a pagar,dedução/campo11 ou totaisModeloA. P121/P130digitais eP002transversal não fechados;outros6(4)/(5)encaminhados para percursos próprios. Não automatiza declaração,pagamento,retenção ou prazo digital32(1)c.",
|
||||
"source": "CIVA2(1)a/b,2(2),6(3),6(7)a–j e6(8),Lei13/2016PDF6–8/p1426(264–266);23(1)/(2),25(4),26(1–3),PDF16–17. Lei22/2022não altera estes artigos. Lei10/2025PDF12mantém alíneasa–j ealtera6(7–9);PDF13art23(2)excluik e remete declaração33(2);PDF14mantém26(1–3),adita26(4)digital ealtera33(2).",
|
||||
"meaning": {
|
||||
"P111": {
|
||||
"clause": "6(7)a",
|
||||
"treatment": "rights_service",
|
||||
"nature": "Cessão/autorização de direitos de autor,licenças,marcas e análogos"
|
||||
},
|
||||
"P112": {
|
||||
"clause": "6(7)b",
|
||||
"treatment": "advertising_service",
|
||||
"nature": "Publicidade"
|
||||
},
|
||||
"P113": {
|
||||
"clause": "6(7)c",
|
||||
"treatment": "telecom_service",
|
||||
"nature": "Telecomunicações"
|
||||
},
|
||||
"P114": {
|
||||
"clause": "6(7)d",
|
||||
"treatment": "consulting_service",
|
||||
"nature": "Consultores,engenheiros,advogados,economistas,contabilistas/gabinetes de estudos,organização,investigação/desenvolvimento e similares"
|
||||
},
|
||||
"P115": {
|
||||
"clause": "6(7)e",
|
||||
"treatment": "data_service",
|
||||
"nature": "Tratamento de dados/fornecimento de informações"
|
||||
},
|
||||
"P116": {
|
||||
"clause": "6(7)f",
|
||||
"treatment": "finance_service",
|
||||
"nature": "Operações bancárias,financeiras,seguro/resseguro;eventual isenção independente"
|
||||
},
|
||||
"P117": {
|
||||
"clause": "6(7)g",
|
||||
"treatment": "staff_service",
|
||||
"nature": "Colocação de pessoal"
|
||||
},
|
||||
"P118": {
|
||||
"clause": "6(7)h",
|
||||
"treatment": "intermediation_service",
|
||||
"nature": "Intermediação em nome epor conta de outrem no fornecimento de serviço enumerado,subjacente identificado"
|
||||
},
|
||||
"P119": {
|
||||
"clause": "6(7)i",
|
||||
"treatment": "abstention_service",
|
||||
"nature": "Obrigação de não exercer,mesmo parcialmente,actividade/direito enumerado,subjacente identificado"
|
||||
},
|
||||
"P120": {
|
||||
"clause": "6(7)j",
|
||||
"treatment": "movable_lease_service",
|
||||
"nature": "Locação de bens móveis corpóreos,incluindo financeira,bens/contrato identificados"
|
||||
}
|
||||
},
|
||||
"formula": "Territorial classification and responsible party only,no monetarycalculation. No righttodeduction prerequisite for6(7);nondigital23(2)excludedigital26(4)/32(1)c routing.",
|
||||
"preservation": "93prior closures and partialP084/P085 preserved;accepted perbranchQA reused;one integration/backup/real isolatedrestore/check for whole set",
|
||||
"partial_P084_P085": "Preparation/conditional simulation only,benefits pending;no closure",
|
||||
"limits": "P084/P085partial,pending;L1open;P00105/06;beveragesL2/L3;Statistics/AIdeferred",
|
||||
"containment": "l1-g9-nondigital-readonly-rollback-20261024.patch,checked only,not applied;blocks newP111–120classifications,preserves readers/history/otherbranches",
|
||||
"authenticated_preflight": {
|
||||
"installed": {
|
||||
"status": "installed",
|
||||
"commit": "03c26d66139f36573cf58362a5076b4d5f98eca2",
|
||||
"release": "/var/www/investmoz-homologacao/releases/03c26d66139f36573cf58362a5076b4d5f98eca2-ac76aca8",
|
||||
"previous_release": "/var/www/investmoz-homologacao/releases/8f14f5dde24819fce062dc316ed21dfbe033ebf8-6abb42c2",
|
||||
"database_migrations": 0,
|
||||
"content_imports": 0
|
||||
},
|
||||
"current_link": "/var/www/investmoz-homologacao/releases/03c26d66139f36573cf58362a5076b4d5f98eca2-ac76aca8",
|
||||
"release_revision": {
|
||||
"commit": "03c26d66139f36573cf58362a5076b4d5f98eca2",
|
||||
"branch": "main",
|
||||
"built_at": "2026-10-24T21:42:26.795541+00:00",
|
||||
"manifest_sha256": "7deb424f38c7361d0a8df4d0be22464ab066a01e5aa38ece15fa62115c15f8c4"
|
||||
},
|
||||
"service": "ExecMainStatus=0\nActiveState=inactive\nSubState=dead\n",
|
||||
"configuration_keys": [
|
||||
"repository",
|
||||
"branch",
|
||||
"target_url",
|
||||
"legacy_root",
|
||||
"state_root",
|
||||
"release_root",
|
||||
"current_link",
|
||||
"shared_assets",
|
||||
"php",
|
||||
"schema_contract",
|
||||
"ci_environment",
|
||||
"postgis_image",
|
||||
"test_database",
|
||||
"qa_port",
|
||||
"retention",
|
||||
"webhook_secret_file"
|
||||
],
|
||||
"safe_paths": {
|
||||
"repository": "nala/Investidor-V2",
|
||||
"release_root": "/var/www/investmoz-homologacao/releases",
|
||||
"postgis_image": "postgis/postgis@sha256:01a6a70e41e6c4467c8f55f6063555ed72db2d6662cd0d571040d42eadaeb6f6"
|
||||
},
|
||||
"pipeline_sha256": "adec1c17654f3a8658b83b134f1e75f95391b235738552721906c3236e388604"
|
||||
},
|
||||
"backup_restore": {
|
||||
"backup": {
|
||||
"stage": "/var/backups/investmoz-l1-g9-nondigital-delivery-20261024/backup",
|
||||
"target": {
|
||||
"database": "teste_investidor",
|
||||
"port": 5432
|
||||
},
|
||||
"tables": 174,
|
||||
"files_verified": 369,
|
||||
"dump_sha256": "8d783acaa134d37d4d5d7da2842f3a4a2ca159cab444b10b127fc1baf7113ac2",
|
||||
"files_sha256": "195de1b12e33ce73510143f009a10cae42f622093e6049d36389e2849e3a117b",
|
||||
"restore_verified": false
|
||||
},
|
||||
"restore": {
|
||||
"restore_verified": true,
|
||||
"tables_verified": 174,
|
||||
"container_network": "none",
|
||||
"database": "l1_g9_nondigital_restore_20261024",
|
||||
"port": 55441,
|
||||
"source_dump_sha256": "8d783acaa134d37d4d5d7da2842f3a4a2ca159cab444b10b127fc1baf7113ac2",
|
||||
"active_database_writes": 0
|
||||
}
|
||||
},
|
||||
"served_commit": "2a7254406db3aa6e8c71bfbaf56bbcda1f139d19",
|
||||
"installation": {
|
||||
"protected": {
|
||||
"installed": {
|
||||
"status": "installed",
|
||||
"commit": "2a7254406db3aa6e8c71bfbaf56bbcda1f139d19",
|
||||
"release": "/var/www/investmoz-homologacao/releases/2a7254406db3aa6e8c71bfbaf56bbcda1f139d19-ae306e0a",
|
||||
"previous_release": "/var/www/investmoz-homologacao/releases/03c26d66139f36573cf58362a5076b4d5f98eca2-ac76aca8",
|
||||
"database_migrations": 0,
|
||||
"content_imports": 0
|
||||
},
|
||||
"runtime_files_verified": 4,
|
||||
"persistent_files_and_env_verified": 369,
|
||||
"tables_compared": 174,
|
||||
"changed_tables": {
|
||||
"cache": {
|
||||
"before": {
|
||||
"rows": 106,
|
||||
"checksum": "38b2f9e034cc821c5c1b47b85fcf4cf2"
|
||||
},
|
||||
"after": {
|
||||
"rows": 106,
|
||||
"checksum": "fc22bd1093218afa1777652f5fffb28c"
|
||||
}
|
||||
},
|
||||
"sessions": {
|
||||
"before": {
|
||||
"rows": 87,
|
||||
"checksum": "104d8807ca3446d84e590d48138eb3bc"
|
||||
},
|
||||
"after": {
|
||||
"rows": 90,
|
||||
"checksum": "242150536cdc201c41ae0e40414c384d"
|
||||
}
|
||||
}
|
||||
},
|
||||
"preserved_counts": {
|
||||
"published_fiches": 29,
|
||||
"relations": 28,
|
||||
"geometries": 408
|
||||
},
|
||||
"migration_count": 0,
|
||||
"content_imports": 0,
|
||||
"comparison_role": "postgres_before_and_after;sameexportedsnapshotbaseline;noapplicationRLSvisibilityinference",
|
||||
"writes_by_verification": 0
|
||||
},
|
||||
"public": {
|
||||
"status": "installed_delta_verified",
|
||||
"served_revision": {
|
||||
"commit": "2a7254406db3aa6e8c71bfbaf56bbcda1f139d19",
|
||||
"branch": "main",
|
||||
"built_at": "2026-10-24T21:51:55.419637+00:00",
|
||||
"manifest_sha256": "a04bb2c3e527c027aa263827b37e1566b67b372c479904112cfef79de9bcf2fb"
|
||||
},
|
||||
"manifest_hash_matches": true,
|
||||
"compiled_delta_markers": {
|
||||
"listed-nondigital-services/1": [
|
||||
"assets/project-dossier-DBVXbPWM.js"
|
||||
],
|
||||
"rights_service": [
|
||||
"assets/project-dossier-DBVXbPWM.js"
|
||||
],
|
||||
"advertising_service": [
|
||||
"assets/project-dossier-DBVXbPWM.js"
|
||||
],
|
||||
"telecom_service": [
|
||||
"assets/project-dossier-DBVXbPWM.js"
|
||||
],
|
||||
"consulting_service": [
|
||||
"assets/project-dossier-DBVXbPWM.js"
|
||||
],
|
||||
"data_service": [
|
||||
"assets/project-dossier-DBVXbPWM.js"
|
||||
],
|
||||
"finance_service": [
|
||||
"assets/project-dossier-DBVXbPWM.js"
|
||||
],
|
||||
"staff_service": [
|
||||
"assets/project-dossier-DBVXbPWM.js"
|
||||
],
|
||||
"intermediation_service": [
|
||||
"assets/services-D1gOx3Gd.js",
|
||||
"assets/project-dossier-DBVXbPWM.js"
|
||||
],
|
||||
"abstention_service": [
|
||||
"assets/services-D1gOx3Gd.js",
|
||||
"assets/project-dossier-DBVXbPWM.js"
|
||||
],
|
||||
"movable_lease_service": [
|
||||
"assets/project-dossier-DBVXbPWM.js"
|
||||
],
|
||||
"listedServices": [
|
||||
"assets/project-dossier-DBVXbPWM.js"
|
||||
],
|
||||
"recipientType": [
|
||||
"assets/services-D1gOx3Gd.js",
|
||||
"assets/project-dossier-DBVXbPWM.js"
|
||||
],
|
||||
"recipientRef": [
|
||||
"assets/services-D1gOx3Gd.js",
|
||||
"assets/project-dossier-DBVXbPWM.js"
|
||||
],
|
||||
"targetClause": [
|
||||
"assets/services-D1gOx3Gd.js",
|
||||
"assets/project-dossier-DBVXbPWM.js"
|
||||
],
|
||||
"targetRef": [
|
||||
"assets/services-D1gOx3Gd.js",
|
||||
"assets/project-dossier-DBVXbPWM.js"
|
||||
],
|
||||
"providerTaxable": [
|
||||
"assets/services-D1gOx3Gd.js",
|
||||
"assets/project-dossier-DBVXbPWM.js"
|
||||
],
|
||||
"responsible": [
|
||||
"assets/project-dossier-DBVXbPWM.js"
|
||||
],
|
||||
"obligationReason": [
|
||||
"assets/project-dossier-DBVXbPWM.js"
|
||||
],
|
||||
"IVA: Indeterminado": [
|
||||
"assets/project-dossier-DBVXbPWM.js"
|
||||
]
|
||||
},
|
||||
"assets": [
|
||||
{
|
||||
"file": "assets/services-D1gOx3Gd.js",
|
||||
"status": 200,
|
||||
"sha256": "76f46314d8d000351ccb43a22737352bd8455e6db4db3954dab0949fdc9f7176"
|
||||
},
|
||||
{
|
||||
"file": "assets/simulation-form-CPZAFZU3.js",
|
||||
"status": 200,
|
||||
"sha256": "c6bcf64e60a5eeac0cafe3dc055dc5544162f21942ee08b34d51bc6d52947567"
|
||||
},
|
||||
{
|
||||
"file": "assets/project-dossier-DBVXbPWM.js",
|
||||
"status": 200,
|
||||
"sha256": "64051d89dabde0c3c23f22396a2d13a3b10413ca1bae4d9f80c65fff2d56ace6"
|
||||
},
|
||||
{
|
||||
"file": "assets/project-dossier-document-CafLZ1EI.js",
|
||||
"status": 200,
|
||||
"sha256": "93c06e2dd413c6309f1d4af50c300924764589afe7ee57ff06e4b960043c2a5b"
|
||||
}
|
||||
],
|
||||
"simulator_status": 200,
|
||||
"simulator_entry": "assets/app-qriXxj5i.js",
|
||||
"existing_fiscal_availability": {
|
||||
"data": {
|
||||
"enabled": true,
|
||||
"coverage_start": "2026-01-01",
|
||||
"coverage_end": "2026-12-31",
|
||||
"message": "IVA geral sobre base líquida disponível; enquadramento declarado."
|
||||
}
|
||||
},
|
||||
"synthetic_private_writes": 0,
|
||||
"method": "Read-only installedrevision/manifest/newcompiledcatalogueandreaders/simulatorentry;acceptedQAproofsreused"
|
||||
},
|
||||
"installer": {
|
||||
"service": "ExecMainStatus=0\nActiveState=inactive\nSubState=dead\n",
|
||||
"installed": {
|
||||
"status": "installed",
|
||||
"commit": "2a7254406db3aa6e8c71bfbaf56bbcda1f139d19",
|
||||
"release": "/var/www/investmoz-homologacao/releases/2a7254406db3aa6e8c71bfbaf56bbcda1f139d19-ae306e0a",
|
||||
"previous_release": "/var/www/investmoz-homologacao/releases/03c26d66139f36573cf58362a5076b4d5f98eca2-ac76aca8",
|
||||
"database_migrations": 0,
|
||||
"content_imports": 0
|
||||
},
|
||||
"latest_report": {
|
||||
"status": "installed",
|
||||
"commit": "2a7254406db3aa6e8c71bfbaf56bbcda1f139d19",
|
||||
"release": "/var/www/investmoz-homologacao/releases/2a7254406db3aa6e8c71bfbaf56bbcda1f139d19-ae306e0a",
|
||||
"previous_release": "/var/www/investmoz-homologacao/releases/03c26d66139f36573cf58362a5076b4d5f98eca2-ac76aca8",
|
||||
"database_migrations": 0,
|
||||
"content_imports": 0,
|
||||
"requested_commits": [
|
||||
"2a7254406db3aa6e8c71bfbaf56bbcda1f139d19"
|
||||
],
|
||||
"finished_at": "2026-10-24T21:51:58.085449+00:00"
|
||||
},
|
||||
"log_file": "1792878609052376699.log",
|
||||
"summaries": [
|
||||
"OK (1 test, 3106 assertions)",
|
||||
"built in 28.19s",
|
||||
"OK (59 tests, 317 assertions)",
|
||||
"# tests 401",
|
||||
"# pass 401",
|
||||
"# fail 0"
|
||||
],
|
||||
"log_bytes": 143948
|
||||
},
|
||||
"rollback_executed": false
|
||||
},
|
||||
"base_VAT_separation": "AcceptedQA reused for10branches/30examples:nondigital6(7)a–j inbound,6(8)outbound and6(3)domestic;acquirerquality2(1)a/b including exclusivelyexemptwithoutdeduction;responsible2(2)/23(2)/33(2)separatefromterritory/exemption/base/rate/VAT/deductionfield11. No digital26(4)/32(1)c automaticroute. Inputs/history/report and93priorclosures preserved;4installedruntimehashes/20compiledmarkers;no syntheticactivewrites.",
|
||||
"activation": "OnejointGit fast-forward/webhook/installer;zero migrations/imports"
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
--- a/resources/js/lib/iva-listed-services.ts
|
||||
+++ b/resources/js/lib/iva-listed-services.ts
|
||||
@@ -71,6 +71,7 @@
|
||||
function key(draft:Record<string,unknown>,book:ListedServiceBook):string{return JSON.stringify({version:listedServiceVersion,scope:acquisitionScope(draft),location:draft.selection_labels??{},rows:book.rows});}
|
||||
export function listedServiceCurrent(draft:Record<string,unknown>,book:ListedServiceBook):boolean{return!!book.result&&book.result.sourceKey===key(draft,book);}
|
||||
export function recordListedServices(draft:Record<string,unknown>,book:ListedServiceBook):ListedServiceBook{
|
||||
+ throw new Error('Novas classificações P111–P120 temporariamente suspensas; dados, histórico, relatórios e restantes ramos preservados.');
|
||||
if(!book.rows.length||new Set(book.rows.map(row=>row.id)).size!==book.rows.length)throw new Error('Indique operações com identificadores distintos;originais conservados.');
|
||||
const result:ListedServiceCalculation={version:listedServiceVersion,revision:(book.result?.revision??0)+1,calculatedAt:new Date().toISOString(),opportunity:acquisitionScope(draft),location:JSON.stringify(draft.selection_labels??{}),sourceKey:key(draft,book),source:listedServiceSource,inputs:structuredClone(book.rows),rows:book.rows.map(row=>evaluateListedService(row))};
|
||||
const next={...book,result,history:[...(book.history??[]),...(book.result?[book.result]:[])]};saveListedServiceBook(draft,next);return next;
|
||||
@@ -1,5 +1,126 @@
|
||||
# Rastreabilidade, utilização e formação
|
||||
|
||||
## 25/10/2026 — G10A–G10B/P122/P128 concluídos emQA,circuitos emnome próprio
|
||||
|
||||
Implementação`2b592ded`. Dois ramos,quatro tratamentos comtestes próprios,uma candidata conjunta. CIVA3(3)c,Lei13/2016PDF6/p1426(264);4(3),PDF7/p1426(265). Lei22/2022não altera3/4;Lei10/2025PDF12mantém3(3)c e não altera4. Base15(2)e/P091já entregue permanece independente;sem nova aplicação da base neste incremento.
|
||||
|
||||
- **P122**: Transferências de bens em execução de contrato de comissão,incluindo consignação;na venda comissário considerado comprador,na compra comitente considerado comprador. Venda:comitente→comissário→terceiro;compra:terceiro→comissário→comitente. Contraprestações e referências das duas relações separadas.
|
||||
- **P128**: Serviço efectuado por intervenção de mandatário emnome próprio:mandatário considerado adquirente eprestador sucessivamente4(3). Venda/prestação:mandante→mandatário→terceiro;compra/aquisição:terceiro→mandatário→mandante. Não é mera intermediação emnome de outrem ou base15(2)e de bens.
|
||||
|
||||
2026,circuitos emnome próprio,partes/contratos/objectos econtraprestações originais das duas relações. Sem soma/compensação automática,base tributável nova,localização,isenção,taxa,IVA,dedução/campo11 ou totaisModeloA. Sem conversão cambial;moeda original identificada e coerente com contexto. P091preservado,sem repetir aceitação/cálculo. Reutilizar referências/partes/contratos/documentos oupressupostos expressos,sem certificado/aprovador novo. ownNames poroportunidade nosnapshot/API/dossier existentes;troca conserva dados ocultos e limpa confirmações próprias,escolha técnica de integridade. ReferênciaP091opcional,reutilizável,sem obrigar a repetir prova ou cálculo aceite.
|
||||
|
||||
Seis testes funcionais:quatro circuitos+troca de sentido/natureza+preservação/gravação/histórico/relatório.APIprivada1teste/37asserções comrollback emQAisolada55441;tipos/build aprovados;Edge/CUAactuação emnome próprio desconhecida,restauro da confirmação,gravação/recuperação/relatório4circuitos,2relações porcada,1000.25/1100.75MZNseparados e3versõesanteriores. Base/IVA/taxanull;sem soma das relações. Comparados todos oslivros anteriores comcongelamento,incluindoP091/P096–P099/P111–P120 eP084/P085parciais;107fechos preservados,provas anteriores reutilizadas. Relatório`docs\investmoz\simulations\iva-l1-g10-own-name-qa-20261025.json`;evidência`C:\laragon\www\portal-investidor\outputs\iva-l1-g10-own-name-20261025/verification.json` eimagem`qa-recovered-report.png`. Sem escrita noactivo.
|
||||
|
||||
**107entregues +2QA +23funcionaispendentes +P001=133**. Homologação`2fdca863`;entrega conjunta pendente. L1aberto,dedução fora deste incremento;P121digital/P084/P085pendentes;P00105/06;bebidasL2/L3;Estatísticas/IAadiadas. Uma integração/backup/restauro/conferência paraoconjunto,reutilizando provas porramo.
|
||||
|
||||
|
||||
## 25/10/2026 — preparação conjunta G10A–G10B/P122/P128
|
||||
|
||||
Inventariados107fechos antes dos testes,sem perdas confirmadas;provas2fdca863/5837f34a reutilizadas. Congelados livros/resultados/históricos incluindoP091/P096–P099/P111–P120 eP084/P085parciais. QAporramo eentrega conjunta futura;sem alterações noactivo. CIVA3(3)c,4(3),2016PDF6–7/p1426(264–265);2025mantém3(3)c e nãoaltera4. Comissões de bens:comissário comprador na venda,comitente comprador na compra;mandatário de serviços emnome próprio é adquirente eprestador sucessivamente. Duas relações econtraprestações separadas,não dupla soma ou comissão autónoma presumida. BaseP091já entregue preservada,sem recalcular;dedução/campo11 fora.
|
||||
|
||||
## 25/10/2026 — G7J–G7M/P096–P099 entregues numa operação conjunta
|
||||
|
||||
Homologação **`2fdca863`**,sobre`2a725440`;candidata`833b4e5c` expressamente aceite pela Tempo. Quatro ramos,uma integração/backup/restauro/instalação/conferência,provas individuaisQA reutilizadas.
|
||||
|
||||
- **P096**: contraprestação total antes redução,sempróprioIVA ×62%. Transmissão de energia com preço fixado porAutoridadePública,referência/âmbito/intervalo aplicáveis.
|
||||
- **P097**: contraprestação total antes redução,sempróprioIVA ×85%. Preço doserviço fixado através de taxas aeronáuticas. Não aplicar a comunicações/saneamento/telecomunicações genericamente pelo título histórico da matriz;é necessário demonstrar o preço fixado através de taxa aeronáutica15(2)k.
|
||||
- **P098**: contraprestação total antes redução,sempróprioIVA ×40%(redução60%,não base60%). Construção/reabilitação de obras públicas abrangidas15(2)l/15(9),projecto/contrato/categoria/âmbito identificados;estradas,pontes,infraestrutura água/saneamento,electrificação rural emprojectos públicos e hidráulicaagrícola noâmbito definido. Não exigir preço regulado a esta alínea.
|
||||
- **P099**: contraprestação total antes redução,sempróprioIVA ×75%. Água potável através derede pública,preço fixado porAutoridadePública comreferência/âmbito/intervalo aplicáveis.
|
||||
|
||||
CIVA15(2)j/k/l/m,15(1)/(5)/(6)/(9),Lei13/2016PDF13–14/p1426(271–272);Lei22/2022PDF3mantém15(2)j–m;Lei10/2025não altera15,adita18(6),PDF13:dedução do imposto suportado relativo a essas operações na mesma proporção da base reduzida. 2026/MZN,base apenas. Percentagens62/85/40/75 são de base,não taxasIVA. Proporção18(6)registada sem calcular/conceder dedução/campo11;dedução permanece nas condições/lotes próprios. Sem taxaIVA,IVA,isenção ou totaisModeloA. Não dividir bruto comIVA sem composição esclarecida,nem reduzir montante já reduzido. As percentagens62/85/40/75 incidem sobre a base tributável,não são taxasIVA. Dedução fora deste incremento;18(6)apenas indica a proporção aplicável,sem cálculo ou preenchimento do campo11. Factos/referências/datas/âmbito,entradas imutáveis/histórico/relatório preservados. Desconhecido não é zero;fora do território não é isenção/IVAzero;sem certificados/aprovadores novos.
|
||||
|
||||
Compatibilidade com main e destino conferida,sem avanço concorrente encontrado;fast-forward normal,sem sobrescrever alterações. SessãoSSH existente autenticada reutilizada,sem guardar credenciais. Backup novo e restauro real isolado sem rede:174tabelas/369ficheiros/configuração. Conferido apenas delta instalado:revisão servida,manifesto/hash,16marcadores compilados,quatro hashes funcionais e simuladorHTTP200. PostgreSQL pela mesma identidade antes/depois:174tabelas/369ficheiros e29fichas publicadas/28relações/408geometrias preservados;diferenças apenascache/sessões. Zero migrações/importações/alterações de permissões ou ensaios sintéticos no activo. Contenção de novas classificações conferida,não aplicada;leitores/histórico/outrosramos preservados. Release/backup anteriores conservados.
|
||||
|
||||
[Manifesto/recibo](../simulations/l1-g7-reduced-delivery-20261024.json),registo`iva_l1_g7_reduced_P096_P099_homologation_20261024`. **107entregues +25funcionaispendentes +P001=133**,sem candidatasQApor disponibilizar. Os103fechos anteriores preservados. P084/P085 continuam incluídos nos25,apenas preparação/simulação condicionada;P002transversal eL1abertos;P00105/06;bebidasL2/L3;Estatísticas/IAadiadas. ManterQAporramo eentregasconjuntas compatíveis.
|
||||
|
||||
|
||||
## 24/10/2026 — G7J–G7M/P096–P099 concluídos emQA,conjunto de bases reduzidas
|
||||
|
||||
Implementação`67a96085`. Quatro ramos comtestes/rastreabilidade próprios,uma candidata conjunta. CIVA15(2)j/k/l/m,15(1)/(5)/(6)/(9),Lei13/2016PDF13–14/p1426(271–272);Lei22/2022PDF3mantém15(2)j–m;Lei10/2025não altera15,adita18(6),PDF13:dedução do imposto suportado relativo a essas operações na mesma proporção da base reduzida.
|
||||
|
||||
- **P096**: contraprestação total antes redução,sempróprioIVA ×62%. Transmissão de energia com preço fixado porAutoridadePública,referência/âmbito/intervalo aplicáveis.
|
||||
- **P097**: contraprestação total antes redução,sempróprioIVA ×85%. Preço doserviço fixado através de taxas aeronáuticas. Não aplicar a comunicações/saneamento/telecomunicações genericamente pelo título histórico da matriz;é necessário demonstrar o preço fixado através de taxa aeronáutica15(2)k.
|
||||
- **P098**: contraprestação total antes redução,sempróprioIVA ×40%(redução60%,não base60%). Construção/reabilitação de obras públicas abrangidas15(2)l/15(9),projecto/contrato/categoria/âmbito identificados;estradas,pontes,infraestrutura água/saneamento,electrificação rural emprojectos públicos e hidráulicaagrícola noâmbito definido. Não exigir preço regulado a esta alínea.
|
||||
- **P099**: contraprestação total antes redução,sempróprioIVA ×75%. Água potável através derede pública,preço fixado porAutoridadePública comreferência/âmbito/intervalo aplicáveis.
|
||||
|
||||
2026/MZN,base apenas. Percentagens62/85/40/75 são de base,não taxasIVA. Proporção18(6)registada sem calcular/conceder dedução/campo11;dedução permanece nas condições/lotes próprios. Sem taxaIVA,IVA,isenção ou totaisModeloA. Não dividir bruto comIVA sem composição esclarecida,nem reduzir montante já reduzido. Composição e referências existentes reutilizáveis oupressupostos expressos,sem certificados/aprovadores novos. Obraspúblicas usam projecto/categoria/âmbito,sem impor condição de preço regulado deoutras alíneas. A descrição históricaP097na matriz não estende15(2)k aqualquer telecomunicação/saneamento;conferido o alcance do texto,sem percentagem presumida por título. Novo livroregulatedReducedBases poroportunidade nosnapshot/API/dossier existentes;troca conserva campos ocultos e limpa condições próprias,escolha técnica de integridade. Decimal exacto até8casasde resultado,sem arredondamento fiscal presumido.
|
||||
|
||||
Seis testes funcionais:um porramo+precisão/obras40%não60/sem dupla redução+preservação/gravação/histórico/relatório.APIprivada1teste/27asserções comrollback emQAisolada55441;tipos/build aprovados;Edge/CUAcomposição/categoria desconhecidas,restauro deentradas,gravação/recuperação/relatório4linhas+3versõesanteriores. Bases620.155/850.2125/400.10/750.1875MZN para1000.25MZNantesredução. Proporções18(6)62/85/40/75%,sem dedução calculada;IVA/taxanull. Comparados todos oslivros anteriores comcongelamento,incluindoP111–P120 eP084/P085parciais;103fechos preservados,provas anteriores reutilizadas. Relatório`docs\investmoz\simulations\iva-l1-g7-reduced-bases-qa-20261024.json`;evidência`C:\laragon\www\portal-investidor\outputs\iva-l1-g7-reduced-bases-20261024/verification.json` eimagem`qa-recovered-report.png`. Sem escrita noactivo.
|
||||
|
||||
**103entregues +4QA +25funcionaispendentes +P001=133**. Homologação`2a725440`;entrega conjunta pendente. P121digital/P084/P085 eL1abertos;P00105/06;bebidasL2/L3;Estatísticas/IAadiadas. Uma integração/backup/restauro/conferência paraoconjunto,reutilizando provas porramo.
|
||||
|
||||
|
||||
## 24/10/2026 — preparação conjunta G7J–G7M/P096–P099
|
||||
|
||||
Inventariados103fechos antes dos testes,sem perdas confirmadas;provas2a725440/b0e01ef7 reutilizadas. Congelados livros/resultados/históricos incluindoP111–P120 eP084/P085parciais. QAporramo eentrega conjunta futura;sem alterações noactivo. CIVA15(2)j–m,15(1)/(5)/(6)/(9),2016PDF13–14;Lei22/2022PDF3mantém15(2)j–m;Lei10/2025PDF13adita18(6):dedução proporcional,sem activar campo11. Base62%energia,85%aeronáutica,40%obras(redução60%),75%água. Não aplicar redução duasvezes ou a todos osserviços de telecomunicações por descrição.
|
||||
|
||||
## 24/10/2026 — G9A–G9J/P111–P120 entregues numa operação conjunta
|
||||
|
||||
Homologação **`2a725440`**,sobre`03c26d66`;candidata`4601bf64` expressamente aceite pela Tempo. Dez ramos,uma integração/backup/restauro/instalação/conferência,provas individuaisQA reutilizadas.
|
||||
|
||||
- **P111 — 6(7)a**: Cessão/autorização de direitos de autor,licenças,marcas e análogos
|
||||
- **P112 — 6(7)b**: Publicidade
|
||||
- **P113 — 6(7)c**: Telecomunicações
|
||||
- **P114 — 6(7)d**: Consultores,engenheiros,advogados,economistas,contabilistas/gabinetes de estudos,organização,investigação/desenvolvimento e similares
|
||||
- **P115 — 6(7)e**: Tratamento de dados/fornecimento de informações
|
||||
- **P116 — 6(7)f**: Operações bancárias,financeiras,seguro/resseguro;eventual isenção independente
|
||||
- **P117 — 6(7)g**: Colocação de pessoal
|
||||
- **P118 — 6(7)h**: Intermediação em nome epor conta de outrem no fornecimento de serviço enumerado,subjacente identificado
|
||||
- **P119 — 6(7)i**: Obrigação de não exercer,mesmo parcialmente,actividade/direito enumerado,subjacente identificado
|
||||
- **P120 — 6(7)j**: Locação de bens móveis corpóreos,incluindo financeira,bens/contrato identificados
|
||||
|
||||
CIVA2(1)a/b,2(2),6(3),6(7)a–j e6(8),Lei13/2016PDF6–8/p1426(264–266);23(1)/(2),25(4),26(1–3),PDF16–17. Lei22/2022não altera estes artigos. Lei10/2025PDF12mantém alíneasa–j ealtera6(7–9);PDF13art23(2)excluik e remete declaração33(2);PDF14mantém26(1–3),adita26(4)digital ealtera33(2). 2026,serviços enumerados não digitais;localização e identificação do responsável pelas obrigações. Sem isenção confirmada,base,taxa,IVA,montante a pagar,dedução/campo11 ou totaisModeloA. P121/P130digitais eP002transversal não fechados;outros6(4)/(5)encaminhados para percursos próprios. Não automatiza declaração,pagamento,retenção ou prazo digital32(1)c. Factos/referências/datas/âmbito,entradas imutáveis/histórico/relatório preservados. Desconhecido não é zero;fora do território não é isenção/IVAzero;sem certificados/aprovadores novos.
|
||||
|
||||
Compatibilidade com main e destino conferida,sem avanço concorrente encontrado;fast-forward normal,sem sobrescrever alterações. SessãoSSH autenticada inicial reutilizada no backup/restauro;expirou durante a instalação e foi restabelecida pelo responsável para leituras finais,sem guardar credenciais. A revisão pública foi conferida antes dessa retoma;nenhuma instalação repetida. Backup novo e restauro real isolado sem rede:174tabelas/369ficheiros/configuração. Conferido apenas delta instalado:revisão servida,manifesto/hash,20marcadores compilados,quatro hashes funcionais e simuladorHTTP200. PostgreSQL pela mesma identidade antes/depois:174tabelas/369ficheiros e29fichas publicadas/28relações/408geometrias preservados;diferenças apenascache/sessões. Zero migrações/importações/alterações de permissões ou ensaios sintéticos no activo. Contenção de novas classificações conferida,não aplicada;leitores/histórico/outrosramos preservados. Release/backup anteriores conservados.
|
||||
|
||||
[Manifesto/recibo](../simulations/l1-g9-nondigital-delivery-20261024.json),registo`iva_l1_g9_nondigital_P111_P120_homologation_20261024`. **103entregues +29funcionaispendentes +P001=133**,sem candidatasQApor disponibilizar. Os93fechos anteriores preservados. P084/P085 continuam incluídos nos29,apenas preparação/simulação condicionada;P121digital/P130digital/P002transversal eL1abertos;P00105/06;bebidasL2/L3;Estatísticas/IAadiadas. ManterQAporramo eentregasconjuntas compatíveis.
|
||||
|
||||
|
||||
## 24/10/2026 — G9A–G9J/P111–P120 concluídos emQA,conjunto compatível não digital
|
||||
|
||||
Implementação`6cffa118`. Dez ramos com rastreabilidade/testes próprios,uma candidata conjunta. CIVA2(1)a/b,2(2),6(3),6(7)a–j e6(8),Lei13/2016PDF6–8/p1426(264–266);23(1)/(2),25(4),26(1–3),PDF16–17. Lei22/2022não altera estes artigos. Lei10/2025PDF12mantém alíneasa–j ealtera6(7–9);PDF13art23(2)excluik e remete declaração33(2);PDF14mantém26(1–3),adita26(4)digital ealtera33(2).
|
||||
|
||||
- **P111 — 6(7)a**: Cessão/autorização de direitos de autor,licenças,marcas e análogos.
|
||||
- **P112 — 6(7)b**: Publicidade.
|
||||
- **P113 — 6(7)c**: Telecomunicações.
|
||||
- **P114 — 6(7)d**: Consultores,engenheiros,advogados,economistas,contabilistas/gabinetes de estudos,organização,investigação/desenvolvimento e similares.
|
||||
- **P115 — 6(7)e**: Tratamento de dados/fornecimento de informações.
|
||||
- **P116 — 6(7)f**: Operações bancárias,financeiras,seguro/resseguro;eventual isenção independente.
|
||||
- **P117 — 6(7)g**: Colocação de pessoal.
|
||||
- **P118 — 6(7)h**: Intermediação em nome epor conta de outrem no fornecimento de serviço enumerado,subjacente identificado.
|
||||
- **P119 — 6(7)i**: Obrigação de não exercer,mesmo parcialmente,actividade/direito enumerado,subjacente identificado.
|
||||
- **P120 — 6(7)j**: Locação de bens móveis corpóreos,incluindo financeira,bens/contrato identificados.
|
||||
|
||||
Prestador estrangeiro semsede/EP/domicílio nacional apartirdoqualpresta+adquirente2(1)a/b comEP/domicílio nacional:6(7),incluindo quem pratique exclusivamente operações isentas sem direitoàdedução;responsáveladquirente2(2)/23(2),declaração33(2)nos termosa regulamentar. Não exigir dedução para localizar. Adquirente estabelecido/domiciliado estrangeiro:6(8),ainda queprestador nacional,sem imposto estrangeiro presumido. Percurso doméstico6(3),sem regras especiais:qualidade prestadorSP/regimegeral+referência identifica prestador23(1);se desconhecida,conservarlocalização e responsávelindeterminado. P118/P119exigem subjacente identificado,sem auto-referência ou enquadramento digital presumido. 2026,serviços enumerados não digitais;localização e identificação do responsável pelas obrigações. Sem isenção confirmada,base,taxa,IVA,montante a pagar,dedução/campo11 ou totaisModeloA. P121/P130digitais eP002transversal não fechados;outros6(4)/(5)encaminhados para percursos próprios. Não automatiza declaração,pagamento,retenção ou prazo digital32(1)c.
|
||||
|
||||
Localização/isenção/dedução/obrigação/montante independentes. Referências e pressupostos expressos reutilizáveis,sem certificado/aprovador novo;troca conserva dados ocultos e limpa condições próprias,escolhatécnicadeintegridade. listedServices poroportunidade nosnapshot/API/dossier existentes,sem schema/permissões.
|
||||
|
||||
Doze testes funcionais:um porramo comtrêspercursos+subjacentes/troca+persistência/histórico/preservação.APIprivada1teste/109asserções comrollback emQAisolada55441;tipos/build aprovados;Edge/CUAqualidade/subjacente desconhecidos,adquirente estrangeiro/retorno conserva referências,gravação/recuperação/relatório30exemplos+4versõesanteriores. Comparação de todos oslivros anteriores,incluindoP105–110/P084/P085parciais,comcongelamento;93fechos preservados,provas anteriores reutilizadas. Relatório`docs\investmoz\simulations\iva-l1-g9-nondigital-qa-20261024.json`;evidência`C:\laragon\www\portal-investidor\outputs\iva-l1-g9-nondigital-20261024/verification.json` eimagem`qa-recovered-report.png`. Sem escrita noactivo.
|
||||
|
||||
**93entregues +10QA +29funcionaispendentes +P001=133**. Homologação`03c26d66`;entrega conjunta pendente. P121/P130digitais/P002transversal/P084/P085 eL1abertos;P00105/06;bebidasL2/L3;Estatísticas/IAadiadas. Uma integração/backup/restauro/conferência paraesteconjunto,reutilizando provas porramo.
|
||||
|
||||
|
||||
## 24/10/2026 — preparação conjunta G9A–G9J/P111–P120
|
||||
|
||||
Inventariados93fechos antes dos testes,sem perdas confirmadas;provas03c26d66/4853bc72 reutilizadas. Congelados livros/resultados/históricos incluindoP105–110 eP084/P085parciais. QAporramo eentrega conjunta futura;sem alterações no activo. CIVA6(7)a–j/6(8),2(1)a/b e2(2),2016PDF6/8;Lei10/2025PDF12–14 para6(7–9),23(2),26/33. P121digital é percurso próprio,não classificar pelo recorte não digital. Localização,isenção e dedução independentes;qualidade SP do adquirente inclui quem realiza operações isentas sem direito à dedução.
|
||||
|
||||
## 24/10/2026 — G8B–G8F/P106–P110 entregues numa operação conjunta
|
||||
|
||||
Homologação **`03c26d66`**,sobre`8f14f5dd`;candidata`3f4e71c3` expressamente aceite pela Tempo. Cinco ramos,uma integração/backup/restauro/instalação/conferência,provas individuaisQA reutilizadas.
|
||||
|
||||
- **P106**: Sede/EP/domicílio do prestador a partir do qual o serviço é prestado,sem regras especiais aplicáveis. Não usar endereço/nacionalidade do cliente.
|
||||
- **P107**: Local do imóvel e relação do serviço,incluindo preparação/coordenação de trabalhos imobiliários,peritos/agentes. Independente da sede do prestador.
|
||||
- **P108**: Execução total ou essencial dos trabalhos/peritagens em bens móveis corpóreos. Independente da sede do prestador.
|
||||
- **P109**: Local material de actividades artísticas,científicas,desportivas,recreativas,ensino/similares,organizadores e serviços acessórios;6(5)c rectificado2017.
|
||||
- **P110**: Distância nacional6(5)d rectificada2017;partida/chegada nacionais incluem percurso fora do país6(6);ida/volta são dois trajectos. Identificar distância total/nacional na mesma unidade,sem apuramento monetário.
|
||||
|
||||
CIVA6(3),6(4)/(5)a–d,6(6),Lei13/2016 PDF7–8/p1426(265–266);Aviso BR89-I,de08/06/2017,PDF1,rectifica expressamente6(5)c/d:actividades nacionais e transporte pela distância nacional;Lei10/2025 PDF12mantém6(3–6),altera7–9digitais. Recorte2026,classificação territorial de serviços por factos próprios;sem base,taxa,IVA,isenção,dedução/campo11 ou totaisModeloA. Digital/outros6(7)/(8)exigem percursos próprios,não classificados automaticamente. P002transversal não encerrado. Factos/referências/datas/âmbito,entradas imutáveis/histórico/relatório preservados. Desconhecido não é zero;fora do território não é isenção/IVAzero;sem certificados/aprovadores novos.
|
||||
|
||||
Compatibilidade com main e destino conferida,sem avanço concorrente encontrado;fast-forward normal,sem sobrescrever alterações. SessãoSSH existente autenticada reutilizada,sem guardar credenciais. Backup novo e restauro real isolado sem rede:174tabelas/369ficheiros/configuração. Conferido apenas delta instalado:revisão servida,manifesto/hash,18marcadores compilados,quatro hashes funcionais e simuladorHTTP200. PostgreSQL pela mesma identidade antes/depois:174tabelas/369ficheiros e29fichas publicadas/28relações/408geometrias preservados;diferenças apenascache/sessões. Zero migrações/importações/alterações de permissões ou ensaios sintéticos no activo. Contenção de novas classificações conferida,não aplicada;leitores/histórico/outrosramos preservados. Release/backup anteriores conservados.
|
||||
|
||||
[Manifesto/recibo](../simulations/l1-g8-services-delivery-20261024.json),registo`iva_l1_g8_services_P106_P110_homologation_20261024`. **93entregues +39funcionaispendentes +P001=133**,sem candidatasQApor disponibilizar. Os88fechos anteriores preservados. P084/P085 continuam incluídos nos39,apenas preparação/simulação condicionada;P002transversal eL1abertos;P00105/06;bebidasL2/L3;Estatísticas/IAadiadas. ManterQAporramo eentregasconjuntas compatíveis.
|
||||
|
||||
|
||||
## 24/10/2026 — G8B–G8F/P106–P110 concluídos emQA,conjunto compatível
|
||||
|
||||
Implementação`ec33fb5b`. Cinco ramos com rastreabilidade/testes próprios,uma candidata conjunta,não cinco entregas. CIVA6(3),6(4)/(5)a–d,6(6),Lei13/2016 PDF7–8/p1426(265–266);Aviso BR89-I,de08/06/2017,PDF1,rectifica expressamente6(5)c/d:actividades nacionais e transporte pela distância nacional;Lei10/2025 PDF12mantém6(3–6),altera7–9digitais.
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,41 @@
|
||||
import {useState} from 'react';
|
||||
import {newListedService,switchListedTreatment,listedServiceBook,listedServiceConditions,ownListedConditions,listedServiceCurrent,listedServiceReportRows,listedServiceSource,listedServiceTreatments,recordListedServices,saveListedServiceBook,type ListedServiceBook,type ListedServiceRow} from '@/lib/iva-listed-services';
|
||||
|
||||
export function SimulationListedServices({draft,onChange}:{draft:Record<string,unknown>;onChange:(field:string,value:string)=>void}){
|
||||
const[error,setError]=useState('');let book:ListedServiceBook;
|
||||
try{book=listedServiceBook(draft);}catch(cause){return<p role="alert">{String(cause)}</p>;}
|
||||
const save=(next:ListedServiceBook)=>{try{onChange('modelo_a_snapshot',saveListedServiceBook(draft,next));setError('');}catch(cause){setError(String(cause));}};
|
||||
const change=(id:string,patch:Partial<ListedServiceRow>)=>save({...book,rows:book.rows.map(row=>row.id===id?{...row,...patch}:row)});
|
||||
return<details className="space-y-3 rounded border p-3">
|
||||
<summary>Serviços enumerados — localização e responsável pelas obrigações</summary>
|
||||
<p>Oportunidade: {String(draft.context_opportunity||'entrada geral')}. Identifique a natureza do serviço,o estabelecimento a partir do qual o prestador o fornece e o estabelecimento estável ou domicílio do adquirente. Nacionalidade não substitui estes factos.</p>
|
||||
<p>Adquirente no estrangeiro:conferir6(8). Prestador estrangeiro e adquirente nacional:6(7)inclui sujeitos passivos2(1)a/b que realizem exclusivamente operações isentas sem direito à dedução. Não exigir direito à dedução como condição de localização. Digital,imóveis e outras regras próprias têm os seus percursos.</p>
|
||||
<p>A classificação não concede isenção nem calcula IVA. A identificação do responsável explica a regra aplicável;não apresenta declaração nem inicia pagamento.</p>
|
||||
<p>{listedServiceSource}</p>{error&&<p role="alert">{error}</p>}
|
||||
<button type="button" className="underline" onClick={()=>save({...book,rows:[...book.rows,newListedService(crypto.randomUUID())]})}>Acrescentar serviço enumerado</button>
|
||||
{book.rows.map(row=><details key={row.id} className="rounded border p-3"><summary>{row.description||'Serviço por identificar'} — {row.period||'mês por indicar'}</summary>
|
||||
<div className="grid gap-3 md:grid-cols-2">
|
||||
<label>Tratamento do serviço<select className="block rounded border p-2" value={row.treatment} onChange={e=>change(row.id,switchListedTreatment(row,e.target.value))}><option value="">Por indicar</option>{listedServiceTreatments.map(t=><option key={t.id} value={t.id}>{t.label}</option>)}</select></label>
|
||||
<label>Natureza dos dados<select className="block rounded border p-2" value={row.origin} onChange={e=>change(row.id,{origin:e.target.value as ListedServiceRow['origin']})}><option value="projected">Projectados / pressupostos</option><option value="effective">Efectivos declarados</option></select></label>
|
||||
{([['description','Serviço identificado'],['operationRef','Referência da operação / pressuposto'],['operationDate','Data do serviço / prevista'],['period','Mês do serviço'],['documentRef','Documento da operação / referência da previsão'],['documentDate','Data do documento / prevista'],['subjectRef','Objecto:direito,campanha,serviço,pessoal,bens ou contrato'],['useRef','Destinatário e utilização / pressuposto'],['scope','Âmbito:serviço,operação,período e condições'],['evidence','Fundamento factual / pressupostos'],['providerPlace','Sede,EP ou domicílio a partir do qual o prestador fornece'],['providerRef','Referência do estabelecimento prestador'],['buyerPlace','Estabelecimento estável ou domicílio do adquirente'],['buyerRef','Referência do estabelecimento ou domicílio adquirente']] as const).map(([field,label])=><label key={field}>{label}<input className="block rounded border p-2" type={['operationDate','documentDate'].includes(field)?'date':field==='period'?'month':'text'} value={row[field]} onChange={e=>change(row.id,{[field]:e.target.value})}/></label>)}
|
||||
{([['providerCountry','País do estabelecimento prestador'],['buyerCountry','País do estabelecimento ou domicílio adquirente']] as const).map(([field,label])=><label key={field}>{label}<select className="block rounded border p-2" value={row[field]} onChange={e=>change(row.id,{[field]:e.target.value})}><option value="">Por indicar</option><option value="MZ">Moçambique</option><option value="foreign">Estrangeiro</option></select></label>)}
|
||||
{row.providerCountry==='foreign'&&row.buyerCountry==='MZ'&&<>
|
||||
<label>Qualidade do adquirente2(1)<select className="block rounded border p-2" value={row.recipientType} onChange={e=>change(row.id,{recipientType:e.target.value})}><option value="">Por esclarecer</option><option value="a">Alínea a — actividade independente habitual,incluindo operações isentas sem dedução</option><option value="b">Alínea b — operação independente nos pressupostos legais</option><option value="other">Não corresponde às alíneas a/b</option></select></label>
|
||||
<label>Referência da qualidade fiscal do adquirente<input className="block rounded border p-2" value={row.recipientRef} onChange={e=>change(row.id,{recipientRef:e.target.value})}/></label>
|
||||
</>}
|
||||
{row.providerCountry==='MZ'&&row.buyerCountry==='MZ'&&<>
|
||||
<label>Prestador sujeito passivo no regime geral<select className="block rounded border p-2" value={row.providerTaxable} onChange={e=>change(row.id,{providerTaxable:e.target.value})}><option value="">Por esclarecer</option><option value="yes">Sim</option><option value="no">Não</option></select></label>
|
||||
<label>Referência da qualidade fiscal do prestador<input className="block rounded border p-2" value={row.providerTaxRef} onChange={e=>change(row.id,{providerTaxRef:e.target.value})}/></label>
|
||||
</>}
|
||||
{['intermediation_service','abstention_service'].includes(row.treatment)&&<>
|
||||
<label>Alínea6(7)do serviço,direito ou actividade subjacente<select className="block rounded border p-2" value={row.targetClause} onChange={e=>change(row.id,{targetClause:e.target.value})}><option value="">Por indicar</option>{listedServiceTreatments.filter(t=>t.id!==row.treatment).map(t=><option key={t.id} value={t.clause}>{t.clause} — {t.label}</option>)}</select></label>
|
||||
<label>Referência do subjacente e relação da intermediação/obrigação<input className="block rounded border p-2" value={row.targetRef} onChange={e=>change(row.id,{targetRef:e.target.value})}/></label>
|
||||
</>}
|
||||
</div>
|
||||
<p>Mudar tratamento conserva dados e referências ocultos,mas exige rever os factos próprios. Campos sem aplicação ficam ocultos e conservados.</p>
|
||||
<fieldset><legend>Factos próprios deste tratamento</legend>{[...listedServiceConditions,...ownListedConditions(row.treatment)].map(([key,label])=><label className="block" key={key}>{label}<select className="block rounded border p-2" value={row.conditions[key]??''} onChange={e=>change(row.id,{conditions:{...row.conditions,[key]:e.target.value as ''|'yes'|'no'}})}><option value="">Por indicar</option><option value="yes">Sim</option><option value="no">Não</option></select></label>)}</fieldset>
|
||||
</details>)}
|
||||
{!!book.rows.length&&<button type="button" className="rounded bg-emerald-800 p-2 text-white" onClick={()=>{try{save(recordListedServices(draft,book));}catch(cause){setError(String(cause));}}}>Classificar serviços e guardar versão</button>}
|
||||
{book.result&&<><p role="status">{listedServiceCurrent(draft,book)?'Resultados correspondentes às entradas guardadas.':'Entradas alteradas;resultados históricos conservados. Reveja e classifique novamente.'} {book.history?.length??0} versões anteriores. Localização e responsável não determinam isenção,IVA ou dedução/campo11.</p><dl>{listedServiceReportRows(draft).map(([,label,value,origin],index)=><div key={index}><dt className="font-semibold">{label}</dt><dd>{value}<small className="block">{origin}</small></dd></div>)}</dl></>}
|
||||
</details>;
|
||||
}
|
||||
@@ -17,6 +17,9 @@ import { SimulationValueReview } from './simulation-value-review';
|
||||
import { SimulationServiceNormal } from './simulation-service-normal';
|
||||
import { SimulationGoodsLocation } from './simulation-goods-location';
|
||||
import { SimulationServiceLocation } from './simulation-service-location';
|
||||
import { SimulationListedServices } from './simulation-listed-services';
|
||||
import { SimulationReducedBases } from './simulation-reduced-bases';
|
||||
import { SimulationOwnName } from './simulation-own-name';
|
||||
import { SimulationOfferPreparations } from './simulation-offer-preparations';
|
||||
import { SimulationOperations } from './simulation-operations';
|
||||
|
||||
@@ -112,6 +115,9 @@ export function SimulationMonthlyIva({draft, busy, onCalculate, onChange}: {
|
||||
<SimulationServiceNormal draft={draft} onChange={onChange} />
|
||||
<SimulationGoodsLocation draft={draft} onChange={onChange} />
|
||||
<SimulationServiceLocation draft={draft} onChange={onChange} />
|
||||
<SimulationListedServices draft={draft} onChange={onChange} />
|
||||
<SimulationReducedBases draft={draft} onChange={onChange} />
|
||||
<SimulationOwnName draft={draft} onChange={onChange} />
|
||||
<SimulationOfferPreparations draft={draft} onChange={onChange} />
|
||||
<SimulationModeloA draft={draft} />
|
||||
</section>;
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
import {useState} from 'react';
|
||||
import {newOwnName,switchOwnNameTreatment,ownNameBook,ownNameConditions,ownNameSpecificConditions,ownNameCurrent,ownNameReportRows,ownNameSource,ownNameTreatments,recordOwnNames,saveOwnNameBook,type OwnNameBook,type OwnNameRow} from '@/lib/iva-own-name';
|
||||
|
||||
export function SimulationOwnName({draft,onChange}:{draft:Record<string,unknown>;onChange:(field:string,value:string)=>void}){
|
||||
const[error,setError]=useState('');let book:OwnNameBook;
|
||||
try{book=ownNameBook(draft);}catch(cause){return<p role="alert">{String(cause)}</p>;}
|
||||
const save=(next:OwnNameBook)=>{try{onChange('modelo_a_snapshot',saveOwnNameBook(draft,next));setError('');}catch(cause){setError(String(cause));}};
|
||||
const change=(id:string,patch:Partial<OwnNameRow>)=>save({...book,rows:book.rows.map(row=>row.id===id?{...row,...patch}:row)});
|
||||
return<details className="space-y-3 rounded border p-3">
|
||||
<summary>Comissão e mandato — circuitos emnome próprio</summary>
|
||||
<p>Oportunidade: {String(draft.context_opportunity||'entrada geral')}. Venda/prestação:mandante ou comitente → agente → terceiro. Aquisição:terceiro → agente → mandante ou comitente. Nos serviços,o mandatário emnome próprio é adquirente eprestador sucessivamente;nos bens,os papéis dependem da comissão de compra ou venda.</p>
|
||||
<p>Conserve as contraprestações originais das duas relações separadas. Este percurso não as soma,não calcula imposto nem dedução e não cria uma comissão autónoma. A base de comissões de bensP091já entregue mantém o seu cálculo e histórico próprios.</p>
|
||||
<p>{ownNameSource}</p>{error&&<p role="alert">{error}</p>}
|
||||
<button type="button" className="underline" onClick={()=>save({...book,rows:[...book.rows,newOwnName(crypto.randomUUID(),String(draft.currency??''))]})}>Acrescentar circuito emnome próprio</button>
|
||||
{book.rows.map(row=><details key={row.id} className="rounded border p-3"><summary>{row.description||'Circuito por identificar'} — {row.period||'mês por indicar'}</summary>
|
||||
<div className="grid gap-3 md:grid-cols-2">
|
||||
<label>Natureza e sentido do circuito<select className="block rounded border p-2" value={row.treatment} onChange={e=>change(row.id,switchOwnNameTreatment(row,e.target.value))}><option value="">Por indicar</option>{ownNameTreatments.map(t=><option key={t.id} value={t.id}>{t.label}</option>)}</select></label>
|
||||
<label>Natureza dos dados<select className="block rounded border p-2" value={row.origin} onChange={e=>change(row.id,{origin:e.target.value as OwnNameRow['origin']})}><option value="projected">Projectados / pressupostos</option><option value="effective">Efectivos declarados</option></select></label>
|
||||
{([['description','Circuito identificado'],['operationRef','Referência da operação / pressuposto'],['operationDate','Data da operação / prevista'],['period','Mês da operação'],['documentRef','Documento / referência da previsão'],['documentDate','Data do documento / prevista'],['principalRef','Mandante ou comitente e referência'],['agentRef','Comissário ou mandatário e referência'],['thirdPartyRef','Terceiro e referência'],['contractRef','Contrato de comissão ou mandato'],['subjectRef','Bens ou serviço e âmbito do objecto'],['currency','Moeda original das contraprestações'],['firstAmount','Contraprestação original da relação1'],['firstLegRef','Referência da relação1'],['secondAmount','Contraprestação original da relação2'],['secondLegRef','Referência da relação2'],['scope','Âmbito:partes,objecto,operação eperíodo'],['evidence','Fundamento factual / pressupostos']] as const).map(([field,label])=><label key={field}>{label}<input className="block rounded border p-2" type={['operationDate','documentDate'].includes(field)?'date':field==='period'?'month':'text'} value={row[field]} onChange={e=>change(row.id,{[field]:e.target.value})}/></label>)}
|
||||
{ownNameTreatments.find(t=>t.id===row.treatment)?.kind==='goods'&&<label>Referência de baseP091já existente,se aplicável<input className="block rounded border p-2" value={row.existingBaseRef} onChange={e=>change(row.id,{existingBaseRef:e.target.value})}/></label>}
|
||||
</div>
|
||||
<p>As relações seguem a ordem indicada no sentido escolhido;contraprestação desconhecida não é zero. A referênciaP091é reutilizável e não constitui nova exigência para identificar o circuito. Mudar sentido/natureza conserva partes,contrato,valores e referências,mas exige rever os factos próprios.</p>
|
||||
<fieldset><legend>Factos próprios do circuito</legend>{[...ownNameConditions,...ownNameSpecificConditions(row.treatment)].map(([key,label])=><label className="block" key={key}>{label}<select className="block rounded border p-2" value={row.conditions[key]??''} onChange={e=>change(row.id,{conditions:{...row.conditions,[key]:e.target.value as ''|'yes'|'no'}})}><option value="">Por indicar</option><option value="yes">Sim</option><option value="no">Não</option></select></label>)}</fieldset>
|
||||
</details>)}
|
||||
{!!book.rows.length&&<button type="button" className="rounded bg-emerald-800 p-2 text-white" onClick={()=>{try{save(recordOwnNames(draft,book));}catch(cause){setError(String(cause));}}}>Identificar circuitos e guardar versão</button>}
|
||||
{book.result&&<><p role="status">{ownNameCurrent(draft,book)?'Circuitos correspondentes às entradas guardadas.':'Entradas alteradas;circuitos históricos conservados. Reveja e identifique novamente.'} {book.history?.length??0} versões anteriores. Duas relações separadas,sem soma de bases,IVA ou dedução/campo11.</p><dl>{ownNameReportRows(draft).map(([,label,value,origin],index)=><div key={index}><dt className="font-semibold">{label}</dt><dd>{value}<small className="block">{origin}</small></dd></div>)}</dl></>}
|
||||
</details>;
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
import {useState} from 'react';
|
||||
import {newReducedBase,switchReducedTreatment,reducedBaseBook,reducedBaseConditions,ownReducedConditions,reducedBaseCurrent,reducedBaseReportRows,reducedBaseSource,reducedBaseTreatments,publicWorkCategories,recordReducedBases,saveReducedBaseBook,type ReducedBaseBook,type ReducedBaseRow} from '@/lib/iva-reduced-bases';
|
||||
|
||||
export function SimulationReducedBases({draft,onChange}:{draft:Record<string,unknown>;onChange:(field:string,value:string)=>void}){
|
||||
const[error,setError]=useState('');let book:ReducedBaseBook;
|
||||
try{book=reducedBaseBook(draft);}catch(cause){return<p role="alert">{String(cause)}</p>;}
|
||||
const save=(next:ReducedBaseBook)=>{try{onChange('modelo_a_snapshot',saveReducedBaseBook(draft,next));setError('');}catch(cause){setError(String(cause));}};
|
||||
const change=(id:string,patch:Partial<ReducedBaseRow>)=>save({...book,rows:book.rows.map(row=>row.id===id?{...row,...patch}:row)});
|
||||
return<details className="space-y-3 rounded border p-3">
|
||||
<summary>Bases reduzidas — energia,taxas aeronáuticas,obras públicas eágua</summary>
|
||||
<p>Oportunidade: {String(draft.context_opportunity||'entrada geral')}. Indique a contraprestação total antes da redução,sem o próprioIVA ecom a composição conferida. Se o montante já está reduzido,reutilize o valor original antes de calcular;se só existe total comIVA,esclareça a composição antes de usar este campo.</p>
|
||||
<p>Energia62%,taxas aeronáuticas85%,obras públicas40%(redução60%)eágua75%. Percentagem da base não é taxaIVA. A dedução relativa a estas operações fica sujeita à mesma proporção18(6),mas este percurso não calcula nem concede dedução ou preenche campo11.</p>
|
||||
<p>{reducedBaseSource}</p>{error&&<p role="alert">{error}</p>}
|
||||
<button type="button" className="underline" onClick={()=>save({...book,rows:[...book.rows,newReducedBase(crypto.randomUUID(),String(draft.currency??''))]})}>Acrescentar base reduzida</button>
|
||||
{book.rows.map(row=><details key={row.id} className="rounded border p-3"><summary>{row.description||'Operação por identificar'} — {row.period||'mês por indicar'}</summary>
|
||||
<div className="grid gap-3 md:grid-cols-2">
|
||||
<label>Tratamento da base reduzida<select className="block rounded border p-2" value={row.treatment} onChange={e=>change(row.id,switchReducedTreatment(row,e.target.value))}><option value="">Por indicar</option>{reducedBaseTreatments.map(t=><option key={t.id} value={t.id}>{t.label}</option>)}</select></label>
|
||||
<label>Natureza dos dados<select className="block rounded border p-2" value={row.origin} onChange={e=>change(row.id,{origin:e.target.value as ReducedBaseRow['origin']})}><option value="projected">Projectados / pressupostos</option><option value="effective">Efectivos declarados</option></select></label>
|
||||
{([['description','Operação identificada'],['currency','Moeda do montante'],['operationDate','Data da operação / prevista'],['period','Mês da operação'],['documentRef','Documento / referência da previsão'],['documentDate','Data do documento / prevista'],['priceScope','Âmbito:objecto,operação,local eperíodo'],['consideration','Contraprestação total antes da redução,sem próprioIVA'],['compositionRef','Referência da composição15(1)/(5)/(6)'],['evidence','Fundamento factual / pressupostos']] as const).map(([field,label])=><label key={field}>{label}<input className="block rounded border p-2" type={['operationDate','documentDate'].includes(field)?'date':field==='period'?'month':'text'} value={row[field]} onChange={e=>change(row.id,{[field]:e.target.value})}/></label>)}
|
||||
{row.treatment==='public_works'?<>
|
||||
<label>Projecto ou contrato de obra pública<input className="block rounded border p-2" value={row.projectRef} onChange={e=>change(row.id,{projectRef:e.target.value})}/></label>
|
||||
<label>Categoria da obra<select className="block rounded border p-2" value={row.workCategory} onChange={e=>change(row.id,{workCategory:e.target.value})}><option value="">Por indicar</option>{publicWorkCategories.map(c=><option key={c.id} value={c.id}>{c.label}</option>)}</select></label>
|
||||
</>:row.treatment&&<>
|
||||
<label>Referência do preço fixado ou taxa aeronáutica<input className="block rounded border p-2" value={row.priceRef} onChange={e=>change(row.id,{priceRef:e.target.value})}/></label>
|
||||
<label>Preço/taxa aplicável desde<input type="date" className="block rounded border p-2" value={row.priceFrom} onChange={e=>change(row.id,{priceFrom:e.target.value})}/></label>
|
||||
<label>Preço/taxa aplicável até,se houver termo<input type="date" className="block rounded border p-2" value={row.priceTo} onChange={e=>change(row.id,{priceTo:e.target.value})}/></label>
|
||||
</>}
|
||||
</div>
|
||||
<p>Mudar tratamento conserva dados e referências ocultos,mas exige rever os factos próprios. Não se exige referência de preço fixado para obras públicas;estas dependem do projecto/categoria/âmbito aplicáveis.</p>
|
||||
<fieldset><legend>Condições deste tratamento</legend>{[...reducedBaseConditions,...ownReducedConditions(row.treatment)].map(([key,label])=><label className="block" key={key}>{label}<select className="block rounded border p-2" value={row.conditions[key]??''} onChange={e=>change(row.id,{conditions:{...row.conditions,[key]:e.target.value as ''|'yes'|'no'}})}><option value="">Por indicar</option><option value="yes">Sim</option><option value="no">Não</option></select></label>)}</fieldset>
|
||||
</details>)}
|
||||
{!!book.rows.length&&<button type="button" className="rounded bg-emerald-800 p-2 text-white" onClick={()=>{try{save(recordReducedBases(draft,book));}catch(cause){setError(String(cause));}}}>Calcular bases reduzidas e guardar versão</button>}
|
||||
{book.result&&<><p role="status">{reducedBaseCurrent(draft,book)?'Bases correspondentes às entradas guardadas.':'Entradas alteradas;bases históricas conservadas. Reveja e calcule novamente.'} {book.history?.length??0} versões anteriores. Base eproporção18(6)não são imposto ou dedução concedida.</p><dl>{reducedBaseReportRows(draft).map(([,label,value,origin],index)=><div key={index}><dt className="font-semibold">{label}</dt><dd>{value}<small className="block">{origin}</small></dd></div>)}</dl></>}
|
||||
</details>;
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
import {acquisitionScope,readAcquisitionStore} from './iva-acquisitions.ts';
|
||||
|
||||
export const listedServiceVersion='listed-nondigital-services/1';
|
||||
export const listedServiceSource='CIVA2(1)a/b,2(2),6(3),6(7)a–j e6(8),Lei13/2016PDF6–8/p1426(264–266);obrigações23(1)/(2),25(4),26(1–3),2016PDF16–17;Lei10/2025PDF12mantém alíneasa–j ealtera6(7)/(8)/(9),PDF13art23(2)excluik,PDF14mantém26(1–3),adita26(4)digital ealtera33(2). Recorte2026,não digital. Regime digital/P121 eoutros6(4)/(5)seguem percurso próprio. Localização/obrigações não confirmam isenção,taxa,IVA,dedução/campo11 ou montante a pagar.';
|
||||
export const listedServiceTreatments=[
|
||||
{id:'rights_service',branch:'P111',clause:'a',label:'P111 — Direitos de autor,patentes,licenças e marcas'},
|
||||
{id:'advertising_service',branch:'P112',clause:'b',label:'P112 — Publicidade'},
|
||||
{id:'telecom_service',branch:'P113',clause:'c',label:'P113 — Telecomunicações'},
|
||||
{id:'consulting_service',branch:'P114',clause:'d',label:'P114 — Consultoria,engenharia,advocacia,economia e contabilidade'},
|
||||
{id:'data_service',branch:'P115',clause:'e',label:'P115 — Tratamento de dados e informações'},
|
||||
{id:'finance_service',branch:'P116',clause:'f',label:'P116 — Banca,finanças,seguro e resseguro'},
|
||||
{id:'staff_service',branch:'P117',clause:'g',label:'P117 — Colocação de pessoal'},
|
||||
{id:'intermediation_service',branch:'P118',clause:'h',label:'P118 — Intermediação em nome e por conta de outrem'},
|
||||
{id:'abstention_service',branch:'P119',clause:'i',label:'P119 — Obrigação de não exercer actividade ou direito'},
|
||||
{id:'movable_lease_service',branch:'P120',clause:'j',label:'P120 — Locação de bens móveis corpóreos e financeira'},
|
||||
] as const;
|
||||
export const listedServiceConditions=[['serviceSupply','Está identificada uma prestação de serviços desta operação e período'],['nonDigital','A natureza foi conferida:este caso não é bem/serviço digital abrangido por6(7)k/6(9)/26(4)'],['placeRulesExcluded','Foram conferidas as regras de imóveis,trabalhos em móveis,actividades e transporte6(4)/(5):não exigem outro percurso neste caso']] as const;
|
||||
export const listedOwnConditions={
|
||||
rights_service:[['rightsNature','Cessão ou autorização para utilizar direitos de autor,licenças,marcas de fábrica/comércio ou outros direitos análogos identificados']],
|
||||
advertising_service:[['advertisingNature','Serviço de publicidade identificado']],
|
||||
telecom_service:[['telecomNature','Serviço de telecomunicações identificado']],
|
||||
consulting_service:[['consultingNature','Consultores,engenheiros,advogados,economistas,contabilistas ou gabinetes de estudo,organização,investigação e desenvolvimento ou domínio similar identificado']],
|
||||
data_service:[['dataNature','Tratamento de dados ou fornecimento de informações identificado']],
|
||||
finance_service:[['financeNature','Operação bancária,financeira,de seguro ou resseguro identificada;localização não determina a eventual isenção']],
|
||||
staff_service:[['staffNature','Colocação de pessoal identificada']],
|
||||
intermediation_service:[['intermediaryNature','Intermediário intervém em nome e por conta de outrem no fornecimento de serviço enumerado neste número']],
|
||||
abstention_service:[['abstentionNature','Obrigação de não exercer,mesmo parcialmente,actividade profissional ou direito mencionado nas alíneas deste número']],
|
||||
movable_lease_service:[['leaseNature','Locação de bens móveis corpóreos,incluindo locação financeira,com bens e contrato identificados']],
|
||||
} as const;
|
||||
export function ownListedConditions(treatment:string):ReadonlyArray<readonly[string,string]>{return listedOwnConditions[treatment as keyof typeof listedOwnConditions]??[];}
|
||||
type Choice=''|'yes'|'no';type Condition=typeof listedServiceConditions[number][0];
|
||||
export type ListedServiceRow={id:string;treatment:string;description:string;period:string;origin:'projected'|'effective';operationDate:string;operationRef:string;documentRef:string;documentDate:string;providerPlace:string;providerCountry:string;providerRef:string;buyerPlace:string;buyerCountry:string;buyerRef:string;recipientType:string;recipientRef:string;providerTaxable:string;providerTaxRef:string;useRef:string;subjectRef:string;targetClause:string;targetRef:string;scope:string;evidence:string;conditions:Partial<Record<string,Choice>>};
|
||||
type LineResult={id:string;status:'determined'|'not_applicable'|'indeterminate';territory:'national'|'outside'|null;responsible:'acquirer'|'provider'|'outside'|'indeterminate';obligationReason:string;baseAmount:null;vat:null;rate:null;reason:string};
|
||||
export type ListedServiceCalculation={version:string;revision:number;calculatedAt:string;opportunity:string;location:string;sourceKey:string;source:string;inputs:ListedServiceRow[];rows:LineResult[]};
|
||||
export type ListedServiceBook={rows:ListedServiceRow[];result?:ListedServiceCalculation;history?:ListedServiceCalculation[]};
|
||||
type Store=ReturnType<typeof readAcquisitionStore>&{listedServices?:Record<string,ListedServiceBook>};
|
||||
export function newListedService(id:string):ListedServiceRow{return{id,treatment:'',description:'',period:'',origin:'projected',operationDate:'',operationRef:'',documentRef:'',documentDate:'',providerPlace:'',providerCountry:'',providerRef:'',buyerPlace:'',buyerCountry:'',buyerRef:'',recipientType:'',recipientRef:'',providerTaxable:'',providerTaxRef:'',useRef:'',subjectRef:'',targetClause:'',targetRef:'',scope:'',evidence:'',conditions:{}};}
|
||||
export function switchListedTreatment(row:ListedServiceRow,treatment:string):ListedServiceRow{return{...row,treatment,conditions:Object.fromEntries(listedServiceConditions.map(([key])=>[key,row.conditions[key]??'']))};}
|
||||
|
||||
function readStore(draft:Record<string,unknown>):Store{
|
||||
const store=readAcquisitionStore(draft.modelo_a_snapshot) as Store;
|
||||
if(store.listedServices!==undefined&&(!store.listedServices||typeof store.listedServices!=='object'||Array.isArray(store.listedServices)))throw new Error('Serviços enumerados não recuperáveis;originais preservados.');
|
||||
const fields=Object.keys(newListedService('')).filter(key=>key!=='conditions');
|
||||
for(const book of Object.values(store.listedServices??{}))if(!book||!Array.isArray(book.rows)||(book.history!==undefined&&!Array.isArray(book.history))||book.rows.some(row=>!row||fields.some(key=>typeof row[key as keyof ListedServiceRow]!=='string')||!row.conditions||typeof row.conditions!=='object'||Array.isArray(row.conditions)))throw new Error('Linhas de serviços enumerados não recuperáveis;originais preservados,sem substituição por lista vazia.');
|
||||
return store;
|
||||
}
|
||||
export function listedServiceBook(draft:Record<string,unknown>):ListedServiceBook{return readStore(draft).listedServices?.[acquisitionScope(draft)]??{rows:[]};}
|
||||
export function saveListedServiceBook(draft:Record<string,unknown>,book:ListedServiceBook):string{const current=readStore(draft),encoded=JSON.stringify({...current,listedServices:{...current.listedServices,[acquisitionScope(draft)]:book}});readStore({...draft,modelo_a_snapshot:encoded});return encoded;}
|
||||
function validDate(value:string):boolean{const d=new Date(value+'T00:00:00Z');return /^\d{4}-\d{2}-\d{2}$/.test(value)&&Number.isFinite(d.getTime())&&d.toISOString().slice(0,10)===value;}
|
||||
export function evaluateListedService(row:ListedServiceRow):LineResult{
|
||||
const result:LineResult={id:row.id,status:'indeterminate',territory:null,responsible:'indeterminate',obligationReason:'Responsável indeterminado;sem obrigação ou montante presumido.',baseAmount:null,vat:null,rate:null,reason:''};const stop=(reason:string,status:LineResult['status']='indeterminate')=>({...result,status,reason});
|
||||
const rule=listedServiceTreatments.find(t=>t.id===row.treatment);if(!rule)return stop('Identifique o serviço enumerado,não digital,e a natureza efectiva da operação.');
|
||||
if(!/^2026-(0[1-9]|1[0-2])$/.test(row.period)||!['projected','effective'].includes(row.origin)||!validDate(row.operationDate)||row.operationDate.slice(0,7)!==row.period)return stop('Identifique mês2026,data correspondente e dados efectivos ou pressupostos expressos.');
|
||||
const required=[...listedServiceConditions,...ownListedConditions(row.treatment)];
|
||||
if(required.some(([key])=>row.conditions[key]==='no'))return stop('Este percurso não se aplica:conferir natureza digital,regra territorial própria ou tratamento indicado;nenhum IVAzero/isenção presumido.','not_applicable');
|
||||
if(required.some(([key])=>row.conditions[key]!=='yes'))return stop('Natureza ou regra própria por esclarecer;desconhecido não é fora do território,isenção ou IVAzero.');
|
||||
if(!row.description.trim()||!row.operationRef.trim()||!row.documentRef.trim()||!validDate(row.documentDate)||!row.scope.trim()||!row.evidence.trim()||!row.useRef.trim()||!row.subjectRef.trim())return stop('Identifique serviço,objecto,destinatário/utilização,operação,documento/data,âmbito e factos ou pressupostos expressos;reutilize referências,sem certificado/aprovador novo.');
|
||||
if(['intermediation_service','abstention_service'].includes(row.treatment)&&(!'abcdefghij'.includes(row.targetClause)||row.targetClause.length!==1||row.targetClause===rule.clause||!row.targetRef.trim()))return stop('Identifique o serviço/direito/actividade subjacente e a sua alínea de6(7),com referência;digitalk exige percurso próprio,não presumir pelo título.');
|
||||
if(!['MZ','foreign'].includes(row.buyerCountry)||!row.buyerPlace.trim()||!row.buyerRef.trim())return stop('Identifique o estabelecimento estável ou domicílio do adquirente,país e referência correspondentes,não apenas nacionalidade.');
|
||||
if(row.buyerCountry==='foreign')return{...result,status:'determined',territory:'outside',responsible:'outside',obligationReason:'Artigo6(8):fora do âmbito territorial de Moçambique;sem obrigação nacional calculada por este percurso ou imposto estrangeiro presumido.',reason:`${rule.branch}:6(8),Lei10/2025PDF12,adquirente estabelecido ou domiciliado no estrangeiro;serviço6(7)${rule.clause} não tributável neste âmbito,ainda que prestador tenha sede/EP/domicílio nacional. Não é concessão de isenção nem IVAzero;sem dedução/campo11 ou imposto estrangeiro presumido.`};
|
||||
if(!['MZ','foreign'].includes(row.providerCountry)||!row.providerPlace.trim()||!row.providerRef.trim())return stop('Identifique sede/EP/domicílio do prestador a partir do qual o serviço é prestado,país e referência.');
|
||||
if(row.providerCountry==='foreign'){
|
||||
if(row.recipientType==='other')return stop('Adquirente não corresponde a2(1)a/b:6(7)não demonstrado por este percurso;conferir outra regra aplicável,sem classificar automaticamente fora do território.','not_applicable');
|
||||
if(!['a','b'].includes(row.recipientType)||!row.recipientRef.trim())return stop('Identifique qualidade do adquirente2(1)a/b e referência;inclui quem pratica exclusivamente operações isentas sem direito à dedução,não exigir direito à dedução.');
|
||||
return{...result,status:'determined',territory:'national',responsible:'acquirer',obligationReason:'Adquirente sujeito passivo2(2)/6(7)/23(2),redacção2025:entrega declaração33(2)eimposto exigível,nos termos a regulamentar. Não se aplica26(4)digital,nem prazo32(1)c digital a este caso. Eventual isenção/taxa/montante eprocedimento de pagamento não são apurados aqui.',reason:`${rule.branch}:6(7)${rule.clause},prestador estrangeiro sem sede/EP/domicílio nacional a partir do qual presta;adquirente2(1)${row.recipientType} comEP/domicílio nacional,mesmo que pratique exclusivamente operações isentas sem dedução. Localização nacional não confirma isenção,IVA ou dedução/campo11.`};
|
||||
}
|
||||
const liable=row.providerTaxable==='yes'&&!!row.providerTaxRef.trim();
|
||||
return{...result,status:'determined',territory:'national',responsible:liable?'provider':'indeterminate',obligationReason:liable?'Prestador sujeito passivo no regime geral:23(1),sem activação automática de cobrança;eventual isenção,taxa,IVA eapuramento independentes.':'Localização6(3)determinada;qualidade fiscal do prestador ou referência por esclarecer,sem atribuir obrigação automaticamente.',reason:`${rule.branch}:6(3),prestador comsede/EP/domicílio nacional a partir do qual presta eadquirente nacional,sem regras6(4)/(5)ou digitais aplicáveis. Qualidade do adquirente2(1)a/b não é pré-condição deste percurso doméstico. Localização não concede isenção nem calculaIVA/dedução.`};
|
||||
}
|
||||
|
||||
function key(draft:Record<string,unknown>,book:ListedServiceBook):string{return JSON.stringify({version:listedServiceVersion,scope:acquisitionScope(draft),location:draft.selection_labels??{},rows:book.rows});}
|
||||
export function listedServiceCurrent(draft:Record<string,unknown>,book:ListedServiceBook):boolean{return!!book.result&&book.result.sourceKey===key(draft,book);}
|
||||
export function recordListedServices(draft:Record<string,unknown>,book:ListedServiceBook):ListedServiceBook{
|
||||
if(!book.rows.length||new Set(book.rows.map(row=>row.id)).size!==book.rows.length)throw new Error('Indique operações com identificadores distintos;originais conservados.');
|
||||
const result:ListedServiceCalculation={version:listedServiceVersion,revision:(book.result?.revision??0)+1,calculatedAt:new Date().toISOString(),opportunity:acquisitionScope(draft),location:JSON.stringify(draft.selection_labels??{}),sourceKey:key(draft,book),source:listedServiceSource,inputs:structuredClone(book.rows),rows:book.rows.map(row=>evaluateListedService(row))};
|
||||
const next={...book,result,history:[...(book.history??[]),...(book.result?[book.result]:[])]};saveListedServiceBook(draft,next);return next;
|
||||
}
|
||||
export function listedServiceReportRows(draft:Record<string,unknown>):Array<[string,string,string,string]>{
|
||||
try{const book=listedServiceBook(draft),result=book.result;if(!result)return[];return result.inputs.map((row,index)=>{const line=result.rows[index];return['IVA mensal',`Serviço ${listedServiceTreatments.find(t=>t.id===row.treatment)?.branch??'enumerado'} — ${row.period} — ${row.id}`,`${row.description};classificação territorial: ${line.territory==='national'?'Moçambique':line.territory==='outside'?'Fora do território nacional':'Indeterminada'};IVA: Indeterminado;${line.reason};responsável: ${line.responsible==='acquirer'?'Adquirente':line.responsible==='provider'?'Prestador':line.responsible==='outside'?'Fora deste âmbito':'Indeterminado'};${line.obligationReason}`,`${result.opportunity};${result.location};${listedServiceCurrent(draft,book)?'Resultado actual':'Entradas alteradas;resultado histórico conservado'};versão${result.revision};${result.calculatedAt};${result.source};${row.origin==='projected'?'Projecção':'Dados efectivos declarados'};${listedServiceTreatments.find(t=>t.id===row.treatment)?.label??'Percurso por indicar'};operação ${row.operationRef},${row.operationDate};prestador ${row.providerPlace},${row.providerCountry},${row.providerRef};adquirente ${row.buyerPlace},${row.buyerCountry},${row.buyerRef};${row.buyerCountry==='MZ'&&row.providerCountry==='foreign'?`qualidade adquirente2(1)${row.recipientType},${row.recipientRef};`:''}${row.buyerCountry==='MZ'&&row.providerCountry==='MZ'?`qualidade prestador ${row.providerTaxable},${row.providerTaxRef};`:''}objecto ${row.subjectRef};destinatário/utilização ${row.useRef};${['intermediation_service','abstention_service'].includes(row.treatment)?`subjacente6(7)${row.targetClause},${row.targetRef};`:''}âmbito ${row.scope};documento ${row.documentRef},${row.documentDate};condições ${[...listedServiceConditions,...ownListedConditions(row.treatment)].map(([key,label])=>label+': '+(row.conditions[key]==='yes'?'Sim':row.conditions[key]==='no'?'Não':'Por indicar')).join('; ')};fundamento ${row.evidence};sem isenção/IVA/campo11/totaisModeloA.`];});}
|
||||
catch{return[['IVA mensal','Serviços enumerados','Dados não recuperáveis','Originais preservados;sem classificação por defeito.']];}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
import {acquisitionScope,readAcquisitionStore} from './iva-acquisitions.ts';
|
||||
|
||||
export const ownNameVersion='own-name-chains/1';
|
||||
export const ownNameSource='CIVA3(3)c,Lei13/2016PDF6/p1426(264):transferências em execução de contrato de comissão,incluindo consignação;comissário considerado comprador na comissão de venda,comitente na de compra. Art4(3),PDF7/p1426(265):mandatário emnome próprio é adquirente eprestador do serviço sucessivamente. Lei10/2025PDF12mantém3(3)c e não altera4. Base de bens15(2)e/P091já entregue,não recalculada ou somada neste percurso. Recorte2026:circuito/contraprestações originais separados,sem localização,isenção,taxa,IVA,dedução/campo11 ou totaisModeloA presumidos.';
|
||||
export const ownNameTreatments=[{id:'goods_sale_commission',branch:'P122',label:'P122 — Comissão de venda de bens',kind:'goods',direction:'sale'},{id:'goods_purchase_commission',branch:'P122',label:'P122 — Comissão de compra de bens',kind:'goods',direction:'purchase'},{id:'service_sale_mandate',branch:'P128',label:'P128 — Mandato de venda/prestação de serviços',kind:'services',direction:'sale'},{id:'service_purchase_mandate',branch:'P128',label:'P128 — Mandato de aquisição de serviços',kind:'services',direction:'purchase'}] as const;
|
||||
export const ownNameConditions=[['ownName','O comissário/mandatário actua emnome próprio,não apenas emnome do mandante'],['forAnother','Actua por conta de outrem identificado ecom relação documentada ou pressuposto expresso'],['factsCorrespond','Objecto,partes,referências eperíodo correspondem à operação identificada']] as const;
|
||||
const goodsConditions=[['goodsNature','São transferências de bens,não serviço autónomo de intermediação'],['commissionContract','As transferências executam contrato de comissão identificado,conforme3(3)c,incluindo consignação quando aplicável'],['directionConfirmed','Papéis e duas relações correspondem ao sentido de venda ou compra escolhido']] as const;
|
||||
const serviceConditions=[['serviceNature','Está identificada uma prestação de serviços,não transferência de bens'],['mandateContract','A prestação é efectuada por intervenção de mandatário emnome próprio,com mandato identificado4(3)'],['successiveService','Mandatário é adquirente eprestador do serviço sucessivamente;referências distinguem as duas prestações'],['directionConfirmed','Papéis e duas relações correspondem ao sentido de venda/prestação ou aquisição escolhido']] as const;
|
||||
export function ownNameSpecificConditions(treatment:string):ReadonlyArray<readonly[string,string]>{const rule=ownNameTreatments.find(t=>t.id===treatment);return rule?.kind==='goods'?goodsConditions:rule?.kind==='services'?serviceConditions:[];}
|
||||
type Choice=''|'yes'|'no';type Condition=typeof ownNameConditions[number][0];
|
||||
export type OwnNameRow={id:string;treatment:string;description:string;period:string;origin:'projected'|'effective';operationDate:string;operationRef:string;documentRef:string;documentDate:string;principalRef:string;agentRef:string;thirdPartyRef:string;contractRef:string;subjectRef:string;currency:string;firstAmount:string;secondAmount:string;firstLegRef:string;secondLegRef:string;existingBaseRef:string;scope:string;evidence:string;conditions:Partial<Record<string,Choice>>};
|
||||
type Leg={supplier:string;acquirer:string;consideration:string;currency:string;reference:string};
|
||||
type LineResult={id:string;status:'determined'|'not_applicable'|'indeterminate';legs:Leg[];baseAmount:null;vat:null;rate:null;reason:string};
|
||||
export type OwnNameCalculation={version:string;revision:number;calculatedAt:string;opportunity:string;location:string;sourceKey:string;source:string;inputs:OwnNameRow[];rows:LineResult[]};
|
||||
export type OwnNameBook={rows:OwnNameRow[];result?:OwnNameCalculation;history?:OwnNameCalculation[]};
|
||||
type Store=ReturnType<typeof readAcquisitionStore>&{ownNames?:Record<string,OwnNameBook>};
|
||||
export function newOwnName(id:string,currency=''):OwnNameRow{return{id,treatment:'',description:'',period:'',origin:'projected',operationDate:'',operationRef:'',documentRef:'',documentDate:'',principalRef:'',agentRef:'',thirdPartyRef:'',contractRef:'',subjectRef:'',currency,firstAmount:'',secondAmount:'',firstLegRef:'',secondLegRef:'',existingBaseRef:'',scope:'',evidence:'',conditions:{}};}
|
||||
export function switchOwnNameTreatment(row:OwnNameRow,treatment:string):OwnNameRow{return{...row,treatment,conditions:Object.fromEntries(ownNameConditions.map(([key])=>[key,row.conditions[key]??'']))};}
|
||||
|
||||
function readStore(draft:Record<string,unknown>):Store{
|
||||
const store=readAcquisitionStore(draft.modelo_a_snapshot) as Store;
|
||||
if(store.ownNames!==undefined&&(!store.ownNames||typeof store.ownNames!=='object'||Array.isArray(store.ownNames)))throw new Error('Circuitos emnome próprio não recuperáveis;originais preservados.');
|
||||
const fields=Object.keys(newOwnName('')).filter(key=>key!=='conditions');
|
||||
for(const book of Object.values(store.ownNames??{}))if(!book||!Array.isArray(book.rows)||(book.history!==undefined&&!Array.isArray(book.history))||book.rows.some(row=>!row||fields.some(key=>typeof row[key as keyof OwnNameRow]!=='string')||!row.conditions||typeof row.conditions!=='object'||Array.isArray(row.conditions)))throw new Error('Linhas de circuitos emnome próprio não recuperáveis;originais preservados,sem substituição por lista vazia.');
|
||||
return store;
|
||||
}
|
||||
export function ownNameBook(draft:Record<string,unknown>):OwnNameBook{return readStore(draft).ownNames?.[acquisitionScope(draft)]??{rows:[]};}
|
||||
export function saveOwnNameBook(draft:Record<string,unknown>,book:OwnNameBook):string{const current=readStore(draft),encoded=JSON.stringify({...current,ownNames:{...current.ownNames,[acquisitionScope(draft)]:book}});readStore({...draft,modelo_a_snapshot:encoded});return encoded;}
|
||||
function validDate(value:string):boolean{const d=new Date(value+'T00:00:00Z');return /^\d{4}-\d{2}-\d{2}$/.test(value)&&Number.isFinite(d.getTime())&&d.toISOString().slice(0,10)===value;}
|
||||
export function evaluateOwnName(row:OwnNameRow,currency:unknown):LineResult{
|
||||
const result:LineResult={id:row.id,status:'indeterminate',legs:[],baseAmount:null,vat:null,rate:null,reason:''};const stop=(reason:string,status:LineResult['status']='indeterminate')=>({...result,status,reason});
|
||||
const rule=ownNameTreatments.find(t=>t.id===row.treatment);if(!rule)return stop('Identifique bens/serviços e o sentido da comissão/mandato;sem inferir pelo pagamento de uma comissão.');
|
||||
if(!/^2026-(0[1-9]|1[0-2])$/.test(row.period)||!['projected','effective'].includes(row.origin)||!validDate(row.operationDate)||row.operationDate.slice(0,7)!==row.period)return stop('Identifique mês2026,data correspondente e dados efectivos ou pressupostos expressos.');
|
||||
const required=[...ownNameConditions,...ownNameSpecificConditions(row.treatment)];if(required.some(([key])=>row.conditions[key]==='no'))return stop('Este circuito emnome próprio não se aplica aos factos declarados;rever mandato/comissão/natureza/papéis,sem classificar mera intermediação como duas operações ou presumir isenção/IVAzero.','not_applicable');
|
||||
if(required.some(([key])=>row.conditions[key]!=='yes'))return stop('Natureza,actuação emnome próprio ou papéis por esclarecer;desconhecido não é não aplicável ou zero.');
|
||||
if(!row.description.trim()||!row.operationRef.trim()||!row.documentRef.trim()||!validDate(row.documentDate)||!row.scope.trim()||!row.evidence.trim()||!row.subjectRef.trim()||!row.contractRef.trim()||![row.principalRef,row.agentRef,row.thirdPartyRef,row.firstLegRef,row.secondLegRef].every(v=>!!v.trim()))return stop('Identifique objecto,mandante/comitente,comissário/mandatário,terceiro,contrato,duas relações,operação/documento/data eâmbito;reutilize referências ou pressupostos expressos,sem certificado/aprovador novo.');
|
||||
if(typeof currency!=='string'||!/^[A-Z]{3}$/.test(currency)||row.currency!==currency)return stop('Identifique moeda original coerente com o contexto;sem converter ou reinterpretarUSDcomoMZN.');
|
||||
const amount=(v:string):string|null=>/^\d{1,15}(\.\d{1,6})?$/.test(v.trim())?v.trim():null;const first=amount(row.firstAmount),second=amount(row.secondAmount);
|
||||
if(first===null||second===null)return stop('Identifique separadamente as contraprestações originais das duas relações;desconhecido não é zero. Não inferir uma delas da comissão ou somá-las como uma única base.');
|
||||
const before=rule.direction==='sale'?row.principalRef:row.thirdPartyRef,after=rule.direction==='sale'?row.thirdPartyRef:row.principalRef;
|
||||
const legs=[{supplier:before,acquirer:row.agentRef,consideration:first,currency:row.currency,reference:row.firstLegRef},{supplier:row.agentRef,acquirer:after,consideration:second,currency:row.currency,reference:row.secondLegRef}];
|
||||
return{...result,status:'determined',legs,reason:`${rule.branch}:${rule.kind==='goods'?`art3(3)c,comissão de${rule.direction==='sale'?'venda:comissário considerado comprador':'compra:comitente considerado comprador'}`:'art4(3),mandatário emnome próprio considerado adquirente eprestador do serviço sucessivamente'}. ${row.origin==='projected'?'Circuito sob pressupostos expressos.':'Circuito segundo dados efectivos declarados.'} Duas relações com objecto/partes/contraprestações originais separadas,sem soma ou compensação automática. ${rule.kind==='goods'?'BaseP091/15(2)e já entregue permanece separada e não é recalculada.':'Não transformar este circuito emcomissão autónoma ou aplicar15(2)e de bens aos serviços.'} Sem determinar localização,isenção,base,taxa,IVA,dedução/campo11 ou totaisModeloA.`};
|
||||
}
|
||||
|
||||
function key(draft:Record<string,unknown>,book:OwnNameBook):string{return JSON.stringify({version:ownNameVersion,scope:acquisitionScope(draft),location:draft.selection_labels??{},currency:draft.currency,rows:book.rows});}
|
||||
export function ownNameCurrent(draft:Record<string,unknown>,book:OwnNameBook):boolean{return!!book.result&&book.result.sourceKey===key(draft,book);}
|
||||
export function recordOwnNames(draft:Record<string,unknown>,book:OwnNameBook):OwnNameBook{
|
||||
if(!book.rows.length||new Set(book.rows.map(row=>row.id)).size!==book.rows.length)throw new Error('Indique operações com identificadores distintos;originais conservados.');
|
||||
const result:OwnNameCalculation={version:ownNameVersion,revision:(book.result?.revision??0)+1,calculatedAt:new Date().toISOString(),opportunity:acquisitionScope(draft),location:JSON.stringify(draft.selection_labels??{}),sourceKey:key(draft,book),source:ownNameSource,inputs:structuredClone(book.rows),rows:book.rows.map(row=>evaluateOwnName(row,draft.currency))};
|
||||
const next={...book,result,history:[...(book.history??[]),...(book.result?[book.result]:[])]};saveOwnNameBook(draft,next);return next;
|
||||
}
|
||||
export function ownNameReportRows(draft:Record<string,unknown>):Array<[string,string,string,string]>{
|
||||
try{const book=ownNameBook(draft),result=book.result;if(!result)return[];return result.inputs.map((row,index)=>{const line=result.rows[index],rule=ownNameTreatments.find(t=>t.id===row.treatment);return['IVA mensal',`Circuito ${rule?.branch??'emnome próprio'} — ${row.period} — ${row.id}`,`${row.description};${line.status==='determined'?'Circuito identificado':line.status==='not_applicable'?'Circuito não aplicável':'Circuito indeterminado'};IVA: Indeterminado;${line.reason};${line.legs.map((leg,i)=>`Relação${i+1}:${leg.supplier} → ${leg.acquirer},contraprestação original ${leg.consideration} ${leg.currency},referência ${leg.reference}`).join('; ')};sem soma das duas relações`,`${result.opportunity};${result.location};${ownNameCurrent(draft,book)?'Resultado actual':'Entradas alteradas;resultado histórico conservado'};versão${result.revision};${result.calculatedAt};${result.source};${row.origin==='projected'?'Projecção':'Dados efectivos declarados'};${rule?.label??'Percurso por indicar'};operação ${row.operationRef},${row.operationDate};objecto ${row.subjectRef};contrato ${row.contractRef};mandante/comitente ${row.principalRef};agente ${row.agentRef};terceiro ${row.thirdPartyRef};relações ${row.firstLegRef}/${row.secondLegRef};${rule?.kind==='goods'?`referênciaP091existente ${row.existingBaseRef||'não indicada;sem nova base calculada'};`:''}âmbito ${row.scope};documento ${row.documentRef},${row.documentDate};condições ${[...ownNameConditions,...ownNameSpecificConditions(row.treatment)].map(([key,label])=>label+': '+(row.conditions[key]==='yes'?'Sim':row.conditions[key]==='no'?'Não':'Por indicar')).join('; ')};fundamento ${row.evidence};sem IVA/dedução/campo11/totaisModeloA.`];});}
|
||||
catch{return[['IVA mensal','Circuito emnome próprio','Dados não recuperáveis','Originais preservados;sem circuito ou valor por defeito.']];}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
import {acquisitionScope,readAcquisitionStore} from './iva-acquisitions.ts';
|
||||
|
||||
export const reducedBaseVersion='proportional-bases/1';
|
||||
export const reducedBaseSource='CIVA15(2)j/k/l/m,15(1)/(5)/(6)/(9),Lei13/2016PDF13–14/p1426(271–272);Lei22/2022PDF3mantém15(2)j–m;Lei10/2025não altera15 eadita18(6),PDF13:dedução do imposto suportado relativo a estas operações na mesma proporção da base reduzida. Recorte2026/MZN;base apenas,sem taxaIVA/IVA/dedução/campo11 ou totaisModeloA. Energia62%,taxas aeronáuticas85%,obras redução60%(base40%),água75%. Percentagem de base não é taxaIVA.';
|
||||
export const reducedBaseTreatments=[{id:'regulated_energy',branch:'P096',clause:'j',label:'P096 — Energia com preço fixado por Autoridade Pública',percent:62},{id:'aeronautical_fees',branch:'P097',clause:'k',label:'P097 — Serviços com preço fixado por taxas aeronáuticas',percent:85},{id:'public_works',branch:'P098',clause:'l',label:'P098 — Obras públicas abrangidas',percent:40},{id:'public_water',branch:'P099',clause:'m',label:'P099 — Água potável por rede pública e preço fixado',percent:75}] as const;
|
||||
export const reducedBaseConditions=[['taxableOperation','Está identificada a operação sujeita a IVA e a correspondência com este tratamento'],['fullNetInvoice','O montante é a contraprestação total da operação/factura antes desta redução,sem o próprioIVA ecom composição15(1)/(5)/(6)conferida'],['scopeMatches','Documentos/referências ou pressupostos expressos correspondem ao objecto,local,operação eperíodo']] as const;
|
||||
export const reducedOwnConditions={
|
||||
regulated_energy:[['energySupply','Transmissão de energia identificada'],['publicFixedPrice','Preço fixado pela Autoridade Pública identificada na referência aplicável']],
|
||||
aeronautical_fees:[['aeronauticalPrice','Preço do serviço fixado através de taxas aeronáuticas;uma descrição de comunicações,saneamento ou telecomunicações não basta']],
|
||||
public_works:[['publicWorks','Construção ou reabilitação de obras públicas abrangidas15(2)l/15(9)'],['workCategoryMatches','A categoria eâmbito da obra correspondem ao projecto público identificado']],
|
||||
public_water:[['potableWater','Fornecimento de água potável'],['publicNetwork','Fornecimento através de rede pública'],['publicFixedPrice','Preço fixado pela Autoridade Pública identificada na referência aplicável']],
|
||||
} as const;
|
||||
export const publicWorkCategories=[{id:'roads',label:'Estradas'},{id:'bridges',label:'Pontes'},{id:'water_infrastructure',label:'Infra-estruturas de abastecimento de água/saneamento15(9)a'},{id:'rural_electricity',label:'Electrificação rural em projectos públicos15(9)b'},{id:'agricultural_hydraulics',label:'Hidráulica agrícola no âmbito definido15(9)c'}] as const;
|
||||
export function ownReducedConditions(treatment:string):ReadonlyArray<readonly[string,string]>{return reducedOwnConditions[treatment as keyof typeof reducedOwnConditions]??[];}
|
||||
type Choice=''|'yes'|'no';type Condition=typeof reducedBaseConditions[number][0];
|
||||
export type ReducedBaseRow={id:string;treatment:string;description:string;period:string;origin:'projected'|'effective';currency:string;operationDate:string;priceRef:string;priceScope:string;priceFrom:string;priceTo:string;documentRef:string;documentDate:string;consideration:string;projectRef:string;workCategory:string;compositionRef:string;evidence:string;conditions:Partial<Record<string,Choice>>};
|
||||
type LineResult={id:string;status:'determined'|'not_applicable'|'indeterminate';baseAmount:string|null;deductionProportion:string|null;vat:null;rate:null;reason:string};
|
||||
export type ReducedBaseCalculation={version:string;revision:number;calculatedAt:string;opportunity:string;location:string;sourceKey:string;source:string;inputs:ReducedBaseRow[];rows:LineResult[]};
|
||||
export type ReducedBaseBook={rows:ReducedBaseRow[];result?:ReducedBaseCalculation;history?:ReducedBaseCalculation[]};
|
||||
type Store=ReturnType<typeof readAcquisitionStore>&{regulatedReducedBases?:Record<string,ReducedBaseBook>};
|
||||
export function newReducedBase(id:string,currency:string):ReducedBaseRow{return{id,treatment:'',description:'',period:'',origin:'projected',currency,operationDate:'',priceRef:'',priceScope:'',priceFrom:'',priceTo:'',documentRef:'',documentDate:'',consideration:'',projectRef:'',workCategory:'',compositionRef:'',evidence:'',conditions:{}};}
|
||||
export function switchReducedTreatment(row:ReducedBaseRow,treatment:string):ReducedBaseRow{return{...row,treatment,conditions:Object.fromEntries(reducedBaseConditions.map(([key])=>[key,row.conditions[key]??'']))};}
|
||||
|
||||
function readStore(draft:Record<string,unknown>):Store{
|
||||
const store=readAcquisitionStore(draft.modelo_a_snapshot) as Store;
|
||||
if(store.regulatedReducedBases!==undefined&&(!store.regulatedReducedBases||typeof store.regulatedReducedBases!=='object'||Array.isArray(store.regulatedReducedBases)))throw new Error('Bases reduzidas não recuperáveis;originais preservados.');
|
||||
const fields=Object.keys(newReducedBase('','')).filter(key=>key!=='conditions');
|
||||
for(const book of Object.values(store.regulatedReducedBases??{}))if(!book||!Array.isArray(book.rows)||(book.history!==undefined&&!Array.isArray(book.history))||book.rows.some(row=>!row||fields.some(key=>typeof row[key as keyof ReducedBaseRow]!=='string')||!row.conditions||typeof row.conditions!=='object'||Array.isArray(row.conditions)))throw new Error('Linhas de bases reduzidas não recuperáveis;originais preservados,sem substituição por lista vazia.');
|
||||
return store;
|
||||
}
|
||||
export function reducedBaseBook(draft:Record<string,unknown>):ReducedBaseBook{return readStore(draft).regulatedReducedBases?.[acquisitionScope(draft)]??{rows:[]};}
|
||||
export function saveReducedBaseBook(draft:Record<string,unknown>,book:ReducedBaseBook):string{const current=readStore(draft),encoded=JSON.stringify({...current,regulatedReducedBases:{...current.regulatedReducedBases,[acquisitionScope(draft)]:book}});readStore({...draft,modelo_a_snapshot:encoded});return encoded;}
|
||||
function decimal(raw:unknown):bigint|null{if(typeof raw!=='string'||!/^\d{1,15}(\.\d{1,6})?$/.test(raw.trim()))return null;const[whole,fraction='']=raw.trim().split('.');return BigInt(whole)*1000000n+BigInt(fraction.padEnd(6,'0'));}
|
||||
function money(n:bigint):string{return`${n/100000000n}.${(n%100000000n).toString().padStart(8,'0').replace(/0+$/,'').padEnd(2,'0')}`;}
|
||||
|
||||
function validDate(value:string):boolean{const d=new Date(value+'T00:00:00Z');return /^\d{4}-\d{2}-\d{2}$/.test(value)&&Number.isFinite(d.getTime())&&d.toISOString().slice(0,10)===value;}
|
||||
export function evaluateReducedBase(row:ReducedBaseRow,currency:unknown):LineResult{
|
||||
const result:LineResult={id:row.id,status:'indeterminate',baseAmount:null,deductionProportion:null,vat:null,rate:null,reason:''};const stop=(reason:string,status:LineResult['status']='indeterminate')=>({...result,status,reason});
|
||||
const rule=reducedBaseTreatments.find(t=>t.id===row.treatment);if(!rule)return stop('Identifique energia,taxas aeronáuticas,obras públicas ou água;sem percentagem por defeito.');
|
||||
if(currency!=='MZN'||row.currency!==currency)return stop('Moeda fora do âmbitoMZN ou divergente do projecto;sem conversão silenciosa.');
|
||||
if(!/^2026-(0[1-9]|1[0-2])$/.test(row.period)||!['projected','effective'].includes(row.origin))return stop('Indique mês2026 e dados efectivos ou pressupostos expressos de projecção.');
|
||||
const conditions=[...reducedBaseConditions,...ownReducedConditions(row.treatment)];if(conditions.some(([key])=>row.conditions[key]==='no'))return stop('Este tratamento de base reduzida não se aplica aos factos declarados;rever natureza/composição/âmbito,sem isenção ou IVAzero presumido.','not_applicable');
|
||||
if(conditions.some(([key])=>row.conditions[key]!=='yes'))return stop('Condições por esclarecer;desconhecido não é não aplicável ou zero. Confirme o montante total antes da redução,sem próprioIVA.');
|
||||
if(!row.description.trim()||!row.documentRef.trim()||!row.compositionRef.trim()||!row.evidence.trim()||!row.priceScope.trim()||!validDate(row.documentDate)||!validDate(row.operationDate)||row.operationDate.slice(0,7)!==row.period)return stop('Identifique operação,data/mês,documento/data,âmbito e composição ou pressupostos expressos;reutilize referências sem certificado/aprovador novo.');
|
||||
if(row.treatment==='public_works'){
|
||||
if(!row.projectRef.trim()||!publicWorkCategories.some(c=>c.id===row.workCategory))return stop('Identifique projecto/contrato público,categoria eâmbito da obra15(2)l/15(9);não aplicar a qualquer obra privada.');
|
||||
}else if(!row.priceRef.trim()||!validDate(row.priceFrom)||row.operationDate<row.priceFrom||(row.priceTo!==''&&(!validDate(row.priceTo)||row.priceFrom>row.priceTo||row.operationDate>row.priceTo)))return stop('Identifique referência aplicável do preço/taxa e intervalo que abrange a operação;fim pode ficar vazio sem termo fixado,com correspondência temporal confirmada. Sem preço actual presumido para outro período.');
|
||||
const amount=decimal(row.consideration);if(amount===null)return stop('Indique contraprestação total antes da redução,sem próprioIVA;desconhecido/inválido não é zero. Se só existe total comIVA,separe a composição no percurso aplicável antes de usar este campo.');
|
||||
const base=money(amount*BigInt(rule.percent));
|
||||
return{...result,status:'determined',baseAmount:base,deductionProportion:String(rule.percent)+'%',reason:`${rule.branch}:15(2)${rule.clause},base=${row.consideration}×${rule.percent}%=${base}MZN,${row.origin==='projected'?'sob pressupostos expressos':'nos dados efectivos declarados'}. ${row.treatment==='public_works'?'Redução de60% significa base40%,não base60%.':'Percentagem aplicada uma única vez ao montante total antes da redução,sem próprioIVA.'} Art18(6),Lei10/2025:dedução relativa a estas operações na mesma proporção(${rule.percent}%),sujeita às condições próprias;isto não calcula nem concede dedução/campo11. Base não é imposto;sem taxaIVA,IVA ou totaisModeloA. Decimal exacto,sem arredondamento fiscal presumido.`};
|
||||
}
|
||||
|
||||
function key(draft:Record<string,unknown>,book:ReducedBaseBook):string{return JSON.stringify({version:reducedBaseVersion,scope:acquisitionScope(draft),location:draft.selection_labels??{},currency:draft.currency,rows:book.rows});}
|
||||
export function reducedBaseCurrent(draft:Record<string,unknown>,book:ReducedBaseBook):boolean{return!!book.result&&book.result.sourceKey===key(draft,book);}
|
||||
export function recordReducedBases(draft:Record<string,unknown>,book:ReducedBaseBook):ReducedBaseBook{
|
||||
if(!book.rows.length||new Set(book.rows.map(row=>row.id)).size!==book.rows.length)throw new Error('Indique operações com identificadores distintos;originais conservados.');
|
||||
const result:ReducedBaseCalculation={version:reducedBaseVersion,revision:(book.result?.revision??0)+1,calculatedAt:new Date().toISOString(),opportunity:acquisitionScope(draft),location:JSON.stringify(draft.selection_labels??{}),sourceKey:key(draft,book),source:reducedBaseSource,inputs:structuredClone(book.rows),rows:book.rows.map(row=>evaluateReducedBase(row,draft.currency))};
|
||||
const next={...book,result,history:[...(book.history??[]),...(book.result?[book.result]:[])]};saveReducedBaseBook(draft,next);return next;
|
||||
}
|
||||
export function reducedBaseReportRows(draft:Record<string,unknown>):Array<[string,string,string,string]>{
|
||||
try{const book=reducedBaseBook(draft),result=book.result;if(!result)return[];return result.inputs.map((row,index)=>['IVA mensal',`Base ${reducedBaseTreatments.find(t=>t.id===row.treatment)?.branch??'reduzida'} — ${row.period} — ${row.id}`,`${row.description};base tributável: ${result.rows[index].baseAmount??'Indeterminada'} ${row.currency};IVA: Indeterminado;proporção18(6):${result.rows[index].deductionProportion??'Indeterminada'}(sem dedução calculada);${result.rows[index].reason}`,`${result.opportunity};${result.location};${reducedBaseCurrent(draft,book)?'Resultado actual':'Entradas alteradas;resultado histórico conservado'};versão${result.revision};${result.calculatedAt};${result.source};${row.origin==='projected'?'Projecção':'Dados efectivos declarados'};operação ${row.operationDate};âmbito ${row.priceScope};${row.treatment==='public_works'?`projecto/contrato ${row.projectRef};categoria ${row.workCategory}`:`preço/taxa ${row.priceRef};intervalo ${row.priceFrom} a ${row.priceTo||'sem termo fixado,correspondência confirmada'}`};contraprestação total antes redução ${row.consideration} ${row.currency};composição ${row.compositionRef};documento ${row.documentRef},${row.documentDate};condições ${[...reducedBaseConditions,...ownReducedConditions(row.treatment)].map(([key,label])=>label+': '+(row.conditions[key]==='yes'?'Sim':row.conditions[key]==='no'?'Não':'Por indicar')).join('; ')};fundamento ${row.evidence};sem dedução/campo11/totaisModeloA.`]);}
|
||||
catch{return[['IVA mensal','Bases reduzidas','Dados não recuperáveis','Originais preservados;sem substituir por zero.']];}
|
||||
}
|
||||
@@ -16,6 +16,9 @@ import { valueReviewReportRows } from './iva-value-review.ts';
|
||||
import { serviceNormalReportRows } from './iva-service-normal.ts';
|
||||
import { goodsLocationReportRows } from './iva-goods-location.ts';
|
||||
import { serviceLocationReportRows } from './iva-service-location.ts';
|
||||
import { listedServiceReportRows } from './iva-listed-services.ts';
|
||||
import { reducedBaseReportRows } from './iva-reduced-bases.ts';
|
||||
import { ownNameReportRows } from './iva-own-name.ts';
|
||||
import { offerPreparationReportRows } from './iva-offer-preparations.ts';
|
||||
import { salesReportRows } from './iva-operations.ts';
|
||||
import { fiscalQaRows } from './fiscal-qa-preview.ts';
|
||||
@@ -642,6 +645,9 @@ export function buildProjectDossierRows(
|
||||
rows.push(...serviceNormalReportRows(draft));
|
||||
rows.push(...goodsLocationReportRows(draft));
|
||||
rows.push(...serviceLocationReportRows(draft));
|
||||
rows.push(...listedServiceReportRows(draft));
|
||||
rows.push(...reducedBaseReportRows(draft));
|
||||
rows.push(...ownNameReportRows(draft));
|
||||
rows.push(...offerPreparationReportRows(draft));
|
||||
const operationRows = salesReportRows(draft);
|
||||
rows.push(...operationRows);
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Str;
|
||||
use Tests\TestCase;
|
||||
|
||||
final class IvaListedServicesDraftTest extends TestCase
|
||||
{
|
||||
use DatabaseTransactions;
|
||||
|
||||
public function test_listed_services_recover_privately_preserving_all_delivered_books(): void
|
||||
{
|
||||
$target = DB::selectOne('select current_database() as name,inet_server_port() as port');
|
||||
$this->assertSame('simulator_fiscal_delta_20261021_test', $target->name);
|
||||
$this->assertSame(55441, (int) $target->port);
|
||||
config(['investor-path.enabled' => true, 'suitecrm.enabled' => false]);
|
||||
$this->actingAs(User::factory()->create(['email_verified_at' => now()]));
|
||||
$draft = json_decode(file_get_contents(base_path('tests/frontend/fixtures/iva-g9-nondigital.json')), true, flags: JSON_THROW_ON_ERROR);
|
||||
$id = $this->postJson('/api/v1/simulation-drafts', ['personal_snapshot' => [], 'economic_snapshot' => $draft], ['Idempotency-Key' => (string) Str::uuid()])->assertCreated()->json('data.id');
|
||||
$recovered = $this->getJson('/api/v1/simulation-drafts/'.$id)->assertOk()->json('data.economic_snapshot');
|
||||
$this->assertSame($draft['modelo_a_snapshot'], $recovered['modelo_a_snapshot']);
|
||||
$this->assertSame('opportunity:350', $recovered['context_opportunity']);
|
||||
$this->assertSame('Manica', $recovered['selection_labels']['province_id']);
|
||||
$store = json_decode($recovered['modelo_a_snapshot'], true, flags: JSON_THROW_ON_ERROR);
|
||||
$book = $store['listedServices']['opportunity:350'];
|
||||
$this->assertCount(30, $book['rows']);
|
||||
$this->assertCount(10,array_unique(array_column($book['rows'],'treatment')));
|
||||
$this->assertSame(array_merge(...array_fill(0,10,['national','outside','national'])),array_column($book['result']['rows'],'territory'));
|
||||
$this->assertSame(array_merge(...array_fill(0,10,['acquirer','outside','provider'])),array_column($book['result']['rows'],'responsible'));
|
||||
foreach ($book['result']['rows'] as $row) {
|
||||
$this->assertNull($row['baseAmount']);$this->assertNull($row['vat']);$this->assertNull($row['rate']);
|
||||
}
|
||||
$this->assertSame($book['rows'], $book['result']['inputs']);
|
||||
$this->assertCount(1, $book['history']);
|
||||
$this->assertNull($book['history'][0]['rows'][0]['baseAmount']);
|
||||
$frozen = json_decode(file_get_contents(base_path('tests/frontend/fixtures/iva-g9-nondigital-preserved.json')), true, flags: JSON_THROW_ON_ERROR);
|
||||
$prior = json_decode($frozen['modelo_a_snapshot'], true, flags: JSON_THROW_ON_ERROR);
|
||||
$this->assertSame($prior, array_diff_key($store, ['listedServices' => true]));
|
||||
$this->assertSame('1250.30', $store['publicAuthorityBases']['opportunity:339']['result']['rows'][1]['baseAmount']);
|
||||
$this->assertNull($store['publicAuthorityBases']['opportunity:339']['result']['rows'][1]['vat']);
|
||||
$this->assertSame('400.00', $store['importExemptions']['opportunity:338']['result']['rows'][1]['importVat']);
|
||||
$this->assertNull($store['books']['opportunity:329']['result']['periods'][0]['fields']['11']);
|
||||
file_put_contents(base_path('outputs/iva-l1-g9-nondigital-20261024/recovered.json'), json_encode($recovered, JSON_THROW_ON_ERROR | JSON_UNESCAPED_UNICODE));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Str;
|
||||
use Tests\TestCase;
|
||||
|
||||
final class IvaOwnNameDraftTest extends TestCase
|
||||
{
|
||||
use DatabaseTransactions;
|
||||
|
||||
public function test_own_name_circuits_recover_privately_preserving_all_delivered_books(): void
|
||||
{
|
||||
$target = DB::selectOne('select current_database() as name,inet_server_port() as port');
|
||||
$this->assertSame('simulator_fiscal_delta_20261021_test', $target->name);
|
||||
$this->assertSame(55441, (int) $target->port);
|
||||
config(['investor-path.enabled' => true, 'suitecrm.enabled' => false]);
|
||||
$this->actingAs(User::factory()->create(['email_verified_at' => now()]));
|
||||
$draft = json_decode(file_get_contents(base_path('tests/frontend/fixtures/iva-g10-own-name.json')), true, flags: JSON_THROW_ON_ERROR);
|
||||
$id = $this->postJson('/api/v1/simulation-drafts', ['personal_snapshot' => [], 'economic_snapshot' => $draft], ['Idempotency-Key' => (string) Str::uuid()])->assertCreated()->json('data.id');
|
||||
$recovered = $this->getJson('/api/v1/simulation-drafts/'.$id)->assertOk()->json('data.economic_snapshot');
|
||||
$this->assertSame($draft['modelo_a_snapshot'], $recovered['modelo_a_snapshot']);
|
||||
$this->assertSame('opportunity:352', $recovered['context_opportunity']);
|
||||
$this->assertSame('Manica', $recovered['selection_labels']['province_id']);
|
||||
$store = json_decode($recovered['modelo_a_snapshot'], true, flags: JSON_THROW_ON_ERROR);
|
||||
$book = $store['ownNames']['opportunity:352'];
|
||||
$this->assertCount(4, $book['rows']);
|
||||
$this->assertSame(['goods_sale_commission','goods_purchase_commission','service_sale_mandate','service_purchase_mandate'],array_column($book['rows'],'treatment'));
|
||||
foreach ($book['result']['rows'] as $row) {
|
||||
$this->assertCount(2,$row['legs']);
|
||||
$this->assertSame(['1000.25','1100.75'],array_column($row['legs'],'consideration'));
|
||||
$this->assertNull($row['baseAmount']);$this->assertNull($row['vat']);$this->assertNull($row['rate']);
|
||||
}
|
||||
$this->assertSame($book['rows'], $book['result']['inputs']);
|
||||
$this->assertCount(1, $book['history']);
|
||||
$this->assertSame('1000.25',$book['history'][0]['rows'][0]['legs'][0]['consideration']);
|
||||
$frozen = json_decode(file_get_contents(base_path('tests/frontend/fixtures/iva-g10-own-name-preserved.json')), true, flags: JSON_THROW_ON_ERROR);
|
||||
$prior = json_decode($frozen['modelo_a_snapshot'], true, flags: JSON_THROW_ON_ERROR);
|
||||
$this->assertSame($prior, array_diff_key($store, ['ownNames' => true]));
|
||||
$this->assertSame('1250.30', $store['publicAuthorityBases']['opportunity:339']['result']['rows'][1]['baseAmount']);
|
||||
$this->assertNull($store['publicAuthorityBases']['opportunity:339']['result']['rows'][1]['vat']);
|
||||
$this->assertSame('400.00', $store['importExemptions']['opportunity:338']['result']['rows'][1]['importVat']);
|
||||
$this->assertNull($store['books']['opportunity:329']['result']['periods'][0]['fields']['11']);
|
||||
file_put_contents(base_path('outputs/iva-l1-g10-own-name-20261025/recovered.json'), json_encode($recovered, JSON_THROW_ON_ERROR | JSON_UNESCAPED_UNICODE));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Str;
|
||||
use Tests\TestCase;
|
||||
|
||||
final class IvaReducedBasesDraftTest extends TestCase
|
||||
{
|
||||
use DatabaseTransactions;
|
||||
|
||||
public function test_reduced_bases_recover_privately_preserving_all_delivered_books(): void
|
||||
{
|
||||
$target = DB::selectOne('select current_database() as name,inet_server_port() as port');
|
||||
$this->assertSame('simulator_fiscal_delta_20261021_test', $target->name);
|
||||
$this->assertSame(55441, (int) $target->port);
|
||||
config(['investor-path.enabled' => true, 'suitecrm.enabled' => false]);
|
||||
$this->actingAs(User::factory()->create(['email_verified_at' => now()]));
|
||||
$draft = json_decode(file_get_contents(base_path('tests/frontend/fixtures/iva-g7-reduced.json')), true, flags: JSON_THROW_ON_ERROR);
|
||||
$id = $this->postJson('/api/v1/simulation-drafts', ['personal_snapshot' => [], 'economic_snapshot' => $draft], ['Idempotency-Key' => (string) Str::uuid()])->assertCreated()->json('data.id');
|
||||
$recovered = $this->getJson('/api/v1/simulation-drafts/'.$id)->assertOk()->json('data.economic_snapshot');
|
||||
$this->assertSame($draft['modelo_a_snapshot'], $recovered['modelo_a_snapshot']);
|
||||
$this->assertSame('opportunity:351', $recovered['context_opportunity']);
|
||||
$this->assertSame('Manica', $recovered['selection_labels']['province_id']);
|
||||
$store = json_decode($recovered['modelo_a_snapshot'], true, flags: JSON_THROW_ON_ERROR);
|
||||
$book = $store['regulatedReducedBases']['opportunity:351'];
|
||||
$this->assertCount(4, $book['rows']);
|
||||
$this->assertSame(['regulated_energy','aeronautical_fees','public_works','public_water'],array_column($book['rows'],'treatment'));
|
||||
$this->assertSame(['620.155','850.2125','400.10','750.1875'],array_column($book['result']['rows'],'baseAmount'));
|
||||
$this->assertSame(['62%','85%','40%','75%'],array_column($book['result']['rows'],'deductionProportion'));
|
||||
foreach ($book['result']['rows'] as $row) {
|
||||
$this->assertNull($row['vat']);$this->assertNull($row['rate']);
|
||||
}
|
||||
$this->assertSame($book['rows'], $book['result']['inputs']);
|
||||
$this->assertCount(1, $book['history']);
|
||||
$this->assertSame('620.155',$book['history'][0]['rows'][0]['baseAmount']);
|
||||
$frozen = json_decode(file_get_contents(base_path('tests/frontend/fixtures/iva-g7-reduced-preserved.json')), true, flags: JSON_THROW_ON_ERROR);
|
||||
$prior = json_decode($frozen['modelo_a_snapshot'], true, flags: JSON_THROW_ON_ERROR);
|
||||
$this->assertSame($prior, array_diff_key($store, ['regulatedReducedBases' => true]));
|
||||
$this->assertSame('1250.30', $store['publicAuthorityBases']['opportunity:339']['result']['rows'][1]['baseAmount']);
|
||||
$this->assertNull($store['publicAuthorityBases']['opportunity:339']['result']['rows'][1]['vat']);
|
||||
$this->assertSame('400.00', $store['importExemptions']['opportunity:338']['result']['rows'][1]['importVat']);
|
||||
$this->assertNull($store['books']['opportunity:329']['result']['periods'][0]['fields']['11']);
|
||||
file_put_contents(base_path('outputs/iva-l1-g7-reduced-bases-20261024/recovered.json'), json_encode($recovered, JSON_THROW_ON_ERROR | JSON_UNESCAPED_UNICODE));
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,33 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import fs from 'node:fs';
|
||||
import {newListedService,switchListedTreatment,listedServiceConditions,ownListedConditions,listedServiceTreatments,evaluateListedService,recordListedServices,saveListedServiceBook,listedServiceBook,listedServiceCurrent,listedServiceReportRows} from '../../resources/js/lib/iva-listed-services.ts';
|
||||
const frozen=JSON.parse(fs.readFileSync('tests/frontend/fixtures/iva-g9-nondigital-preserved.json','utf8'));
|
||||
const draft={...frozen,context_opportunity:'opportunity:350',project_title:'SYNTHETIC QA — G9 não digital / Manica'};
|
||||
function row(t,route='inbound') {const rule=listedServiceTreatments.find(x=>x.id===t);return {...newListedService(t+'-'+route),treatment:t,description:'SYNTHETIC QA '+rule.branch+' '+route,period:'2026-12',origin:'projected',operationDate:'2026-12-12',operationRef:'SYNTHETIC QA operação',documentRef:'SYNTHETIC QA documento/pressuposto',documentDate:'2026-12-12',scope:'SYNTHETIC QA operação/serviço/dezembro2026',evidence:'SYNTHETIC QA pressupostos expressos',providerPlace:'SYNTHETIC QA estabelecimento prestador',providerCountry:route==='inbound'?'foreign':'MZ',providerRef:'SYNTHETIC QA referência estabelecimento prestador',buyerPlace:'SYNTHETIC QA adquirente EP/domicílio',buyerCountry:route==='outbound'?'foreign':'MZ',buyerRef:'SYNTHETIC QA referência adquirente',recipientType:'a',recipientRef:'SYNTHETIC QA SP2(1)a,inclui actividade exclusivamente isenta sem dedução',providerTaxable:'yes',providerTaxRef:'SYNTHETIC QA SPprestador',subjectRef:'SYNTHETIC QA objecto próprio '+rule.branch,useRef:'SYNTHETIC QA destinatário/utilização e âmbito',targetClause:'a',targetRef:'SYNTHETIC QA relação comdireito6(7)a',conditions:Object.fromEntries([...listedServiceConditions,...ownListedConditions(t)].map(([key])=>[key,'yes']))};}
|
||||
for(const rule of listedServiceTreatments)test(rule.branch+' ownnature,three routes,quality and no deduction prerequisite',()=>{
|
||||
for(const route of ['inbound','outbound','domestic']){
|
||||
const r=row(rule.id,route),result=evaluateListedService(r);assert.equal(result.status,'determined');assert.equal(result.territory,route==='outbound'?'outside':'national');assert.equal(result.responsible,route==='outbound'?'outside':route==='inbound'?'acquirer':'provider');assert.deepEqual(['baseAmount','vat','rate'].map(k=>result[k]),[null,null,null]);
|
||||
for(const [key] of [...listedServiceConditions,...ownListedConditions(rule.id)]){const missing=structuredClone(r);delete missing.conditions[key];assert.equal(evaluateListedService(missing).status,'indeterminate');missing.conditions[key]='no';assert.equal(evaluateListedService(missing).status,'not_applicable');assert.equal(evaluateListedService(missing).territory,null);}
|
||||
for(const field of ['operationRef','documentRef','scope','evidence','subjectRef','useRef','buyerRef','buyerPlace','buyerCountry'])assert.equal(evaluateListedService({...r,[field]:''}).status,'indeterminate',field);
|
||||
assert.equal(evaluateListedService({...r,operationDate:'2026-11-12'}).status,'indeterminate');assert.equal(evaluateListedService({...r,documentDate:'2026-02-30'}).status,'indeterminate');assert.equal(evaluateListedService({...r,period:'2025-12'}).status,'indeterminate');
|
||||
}
|
||||
const r=row(rule.id);for(const field of ['providerCountry','providerPlace','providerRef','recipientType','recipientRef'])assert.equal(evaluateListedService({...r,[field]:''}).status,'indeterminate',field);
|
||||
assert.equal(evaluateListedService({...r,recipientType:'b'}).responsible,'acquirer');assert.equal(evaluateListedService({...r,recipientType:'other'}).status,'not_applicable');
|
||||
assert.equal(evaluateListedService({...r,deductionRight:'no',exemptOnly:'yes'}).territory,'national');assert.match(evaluateListedService(r).obligationReason,/23\(2\)/);assert.match(evaluateListedService(r).obligationReason,/Não se aplica26\(4\)/);
|
||||
const domestic=row(rule.id,'domestic');assert.equal(evaluateListedService({...domestic,recipientType:'',recipientRef:''}).responsible,'provider');assert.equal(evaluateListedService({...domestic,providerTaxable:''}).territory,'national');assert.equal(evaluateListedService({...domestic,providerTaxable:''}).responsible,'indeterminate');
|
||||
const outbound=row(rule.id,'outbound');assert.equal(evaluateListedService({...outbound,providerCountry:'',providerPlace:'',providerRef:'',recipientType:''}).territory,'outside');assert.match(evaluateListedService(outbound).reason,/6\(8\)/);
|
||||
});
|
||||
test('P118/P119 require identified underlying service/right and preserve hidden references',()=>{
|
||||
for(const t of ['intermediation_service','abstention_service']){const r=row(t);for(const targetClause of ['',t==='intermediation_service'?'h':'i','k','aa'])assert.equal(evaluateListedService({...r,targetClause}).status,'indeterminate');assert.equal(evaluateListedService({...r,targetRef:''}).status,'indeterminate');}
|
||||
const r=row('intermediation_service');const next=switchListedTreatment(r,'advertising_service');assert.equal(next.targetRef,r.targetRef);assert.equal(next.recipientRef,r.recipientRef);assert.equal(next.conditions.advertisingNature,undefined);next.conditions.advertisingNature='yes';assert.equal(evaluateListedService({...next,targetClause:'',targetRef:''}).status,'determined');
|
||||
});
|
||||
test('Ten branches persist together with previous books,immutable history and report',()=>{
|
||||
const rows=listedServiceTreatments.flatMap(t=>['inbound','outbound','domestic'].map(route=>row(t.id,route)));
|
||||
let book=recordListedServices(draft,{rows});book=recordListedServices(draft,book);assert.equal(book.history.length,1);assert.notEqual(book.result.inputs,book.rows);
|
||||
const next={...draft,modelo_a_snapshot:saveListedServiceBook(draft,book)};assert.deepEqual(listedServiceBook(next),book);assert.ok(listedServiceCurrent(next,book));assert.equal(listedServiceCurrent({...next,context_opportunity:'other'},book),false);assert.equal(listedServiceCurrent({...next,currency:'USD',customer_nationality:'foreign'},book),true);
|
||||
assert.equal(listedServiceReportRows(next).length,30);for(const t of listedServiceTreatments)assert.ok(listedServiceReportRows(next).some(r=>r[1].includes(t.branch)));assert.ok(listedServiceReportRows(next).some(r=>r[2].includes('responsável: Adquirente')));
|
||||
const store=JSON.parse(next.modelo_a_snapshot);delete store.listedServices;assert.deepEqual(store,JSON.parse(frozen.modelo_a_snapshot));
|
||||
assert.throws(()=>recordListedServices(next,{rows:[rows[0],rows[0]]}));assert.throws(()=>listedServiceBook({...next,modelo_a_snapshot:JSON.stringify({...JSON.parse(next.modelo_a_snapshot),listedServices:[]})}));
|
||||
if(process.env.IVA_G9_FIXTURE)fs.writeFileSync(process.env.IVA_G9_FIXTURE,JSON.stringify(next,null,2)+'\n');
|
||||
});
|
||||
@@ -0,0 +1,24 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import fs from 'node:fs';
|
||||
import {newOwnName,switchOwnNameTreatment,ownNameConditions,ownNameSpecificConditions,ownNameTreatments,evaluateOwnName,recordOwnNames,saveOwnNameBook,ownNameBook,ownNameCurrent,ownNameReportRows} from '../../resources/js/lib/iva-own-name.ts';
|
||||
const frozen=JSON.parse(fs.readFileSync('tests/frontend/fixtures/iva-g10-own-name-preserved.json','utf8'));const draft={...frozen,currency:'MZN',context_opportunity:'opportunity:352',project_title:'SYNTHETIC QA — G10 nome próprio / Manica'};
|
||||
function row(t){return{...newOwnName(t,'MZN'),treatment:t,description:'SYNTHETIC QA '+t,period:'2026-12',origin:'projected',operationDate:'2026-12-12',operationRef:'SYNTHETIC QA operação',documentRef:'SYNTHETIC QA documento/pressuposto',documentDate:'2026-12-12',principalRef:'SYNTHETIC QA comitente/mandante A',agentRef:'SYNTHETIC QA agente B',thirdPartyRef:'SYNTHETIC QA terceiro C',contractRef:'SYNTHETIC QA contrato/mandato',subjectRef:'SYNTHETIC QA objecto da operação',firstAmount:'1000.25',secondAmount:'1100.75',firstLegRef:'SYNTHETIC QA relação1',secondLegRef:'SYNTHETIC QA relação2',existingBaseRef:'SYNTHETIC QA referênciaP091preservada',scope:'SYNTHETIC QA partes/objecto/operação/período',evidence:'SYNTHETIC QA pressupostos expressos',conditions:Object.fromEntries([...ownNameConditions,...ownNameSpecificConditions(t)].map(([key])=>[key,'yes']))};}
|
||||
for(const rule of ownNameTreatments)test(rule.branch+'/'+rule.id+' direction,own facts and original separate amounts',()=>{
|
||||
const r=row(rule.id),result=evaluateOwnName(r,'MZN');assert.equal(result.status,'determined');assert.equal(result.legs.length,2);assert.deepEqual(result.legs.map(l=>[l.supplier,l.acquirer]),rule.direction==='sale'?[[r.principalRef,r.agentRef],[r.agentRef,r.thirdPartyRef]]:[[r.thirdPartyRef,r.agentRef],[r.agentRef,r.principalRef]]);assert.deepEqual(result.legs.map(l=>l.consideration),['1000.25','1100.75']);assert.deepEqual(['baseAmount','vat','rate'].map(k=>result[k]),[null,null,null]);
|
||||
for(const [key] of [...ownNameConditions,...ownNameSpecificConditions(rule.id)]){const missing=structuredClone(r);delete missing.conditions[key];assert.equal(evaluateOwnName(missing,'MZN').status,'indeterminate');missing.conditions[key]='no';assert.equal(evaluateOwnName(missing,'MZN').status,'not_applicable');assert.equal(evaluateOwnName(missing,'MZN').legs.length,0);}
|
||||
for(const field of ['description','operationRef','documentRef','contractRef','subjectRef','principalRef','agentRef','thirdPartyRef','firstLegRef','secondLegRef','firstAmount','secondAmount','scope','evidence'])assert.equal(evaluateOwnName({...r,[field]:''},'MZN').status,'indeterminate',field);
|
||||
for(const patch of [{operationDate:'2026-11-12'},{documentDate:'2026-02-30'},{period:'2025-12'},{currency:'USD'},{firstAmount:'1e3'},{secondAmount:'-1'}])assert.equal(evaluateOwnName({...r,...patch},'MZN').status,'indeterminate');
|
||||
assert.equal(evaluateOwnName({...r,currency:'USD'},'USD').legs[0].currency,'USD');assert.equal(evaluateOwnName({...r,firstAmount:'0'},'MZN').legs[0].consideration,'0');assert.equal(evaluateOwnName({...r,existingBaseRef:''},'MZN').status,'determined');
|
||||
assert.match(result.reason,rule.kind==='goods'?/comissário considerado comprador|comitente considerado comprador/:/adquirente eprestador/);
|
||||
});
|
||||
test('Changing direction/kind keeps references and values but requires own confirmations',()=>{
|
||||
const original=row('goods_sale_commission');const changed=switchOwnNameTreatment(original,'service_purchase_mandate');assert.equal(changed.firstAmount,original.firstAmount);assert.equal(changed.secondAmount,original.secondAmount);assert.equal(changed.existingBaseRef,original.existingBaseRef);assert.equal(changed.principalRef,original.principalRef);assert.equal(changed.conditions.directionConfirmed,undefined);assert.equal(evaluateOwnName(changed,'MZN').status,'indeterminate');
|
||||
changed.conditions={...changed.conditions,...Object.fromEntries(ownNameSpecificConditions(changed.treatment).map(([k])=>[k,'yes']))};const result=evaluateOwnName(changed,'MZN');assert.equal(result.status,'determined');assert.equal(result.legs[0].supplier,original.thirdPartyRef);assert.match(result.reason,/Não transformar/);
|
||||
});
|
||||
test('Four circuits save/recover/history/report;P091 and all prior books unchanged',()=>{
|
||||
const rows=ownNameTreatments.map(t=>row(t.id));let book=recordOwnNames(draft,{rows});book=recordOwnNames(draft,book);assert.equal(book.history.length,1);assert.notEqual(book.result.inputs,book.rows);
|
||||
const next={...draft,modelo_a_snapshot:saveOwnNameBook(draft,book)};assert.deepEqual(ownNameBook(next),book);assert.ok(ownNameCurrent(next,book));assert.equal(ownNameCurrent({...next,currency:'USD'},book),false);assert.equal(ownNameCurrent({...next,context_opportunity:'other'},book),false);assert.equal(ownNameReportRows(next).length,4);assert.ok(ownNameReportRows(next).every(r=>r[2].includes('sem soma das duas relações')));
|
||||
const store=JSON.parse(next.modelo_a_snapshot);delete store.ownNames;assert.deepEqual(store,JSON.parse(frozen.modelo_a_snapshot));assert.throws(()=>recordOwnNames(next,{rows:[rows[0],rows[0]]}));assert.throws(()=>ownNameBook({...next,modelo_a_snapshot:JSON.stringify({...JSON.parse(next.modelo_a_snapshot),ownNames:[]})}));
|
||||
if(process.env.IVA_OWN_NAME_FIXTURE)fs.writeFileSync(process.env.IVA_OWN_NAME_FIXTURE,JSON.stringify(next,null,2)+'\n');
|
||||
});
|
||||
@@ -0,0 +1,28 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import fs from 'node:fs';
|
||||
import {newReducedBase,switchReducedTreatment,reducedBaseConditions,ownReducedConditions,reducedBaseTreatments,publicWorkCategories,evaluateReducedBase,recordReducedBases,saveReducedBaseBook,reducedBaseBook,reducedBaseCurrent,reducedBaseReportRows} from '../../resources/js/lib/iva-reduced-bases.ts';
|
||||
const frozen=JSON.parse(fs.readFileSync('tests/frontend/fixtures/iva-g7-reduced-preserved.json','utf8'));const draft={...frozen,currency:'MZN',context_opportunity:'opportunity:351',project_title:'SYNTHETIC QA — G7 bases reduzidas / Manica'};
|
||||
function row(t){const rule=reducedBaseTreatments.find(x=>x.id===t);return{...newReducedBase(t,'MZN'),treatment:t,description:'SYNTHETIC QA '+rule.branch,period:'2026-12',origin:'projected',operationDate:'2026-12-12',documentRef:'SYNTHETIC QA documento/pressuposto',documentDate:'2026-12-12',priceScope:'SYNTHETIC QA objecto/operação/local/período',priceRef:'SYNTHETIC QA preço/taxa aplicável',priceFrom:'2026-01-01',priceTo:'2026-12-31',consideration:'1000.25',compositionRef:'SYNTHETIC QA total antes redução,semIVA,15(1)/(5)/(6)',evidence:'SYNTHETIC QA pressupostos expressos',projectRef:'SYNTHETIC QA projecto público/contrato',workCategory:'roads',conditions:Object.fromEntries([...reducedBaseConditions,...ownReducedConditions(t)].map(([key])=>[key,'yes']))};}
|
||||
const expected=['620.155','850.2125','400.10','750.1875'];
|
||||
for(const [i,rule] of reducedBaseTreatments.entries())test(rule.branch+' ownconditions,exact base and separate deduction proportion',()=>{
|
||||
const r=row(rule.id),result=evaluateReducedBase(r,'MZN');assert.equal(result.status,'determined');assert.equal(result.baseAmount,expected[i]);assert.equal(result.deductionProportion,rule.percent+'%');assert.equal(result.vat,null);assert.equal(result.rate,null);
|
||||
for(const [key] of [...reducedBaseConditions,...ownReducedConditions(rule.id)]){const missing=structuredClone(r);delete missing.conditions[key];assert.equal(evaluateReducedBase(missing,'MZN').status,'indeterminate');missing.conditions[key]='no';assert.equal(evaluateReducedBase(missing,'MZN').status,'not_applicable');assert.equal(evaluateReducedBase(missing,'MZN').baseAmount,null);assert.equal(evaluateReducedBase(missing,'MZN').deductionProportion,null);}
|
||||
for(const field of ['description','documentRef','priceScope','compositionRef','evidence','consideration'])assert.equal(evaluateReducedBase({...r,[field]:''},'MZN').status,'indeterminate',field);
|
||||
for(const patch of [{operationDate:'2026-11-12'},{documentDate:'2026-02-30'},{period:'2025-12'},{currency:'USD'},{consideration:'1,5'},{consideration:'-1'},{consideration:'1e3'}])assert.equal(evaluateReducedBase({...r,...patch},'MZN').status,'indeterminate');assert.equal(evaluateReducedBase(r,'USD').status,'indeterminate');
|
||||
assert.equal(evaluateReducedBase({...r,consideration:'0'},'MZN').baseAmount,'0.00');
|
||||
if(rule.id==='public_works'){assert.equal(evaluateReducedBase({...r,priceRef:'',priceFrom:'',priceTo:''},'MZN').baseAmount,expected[i]);for(const c of publicWorkCategories)assert.equal(evaluateReducedBase({...r,workCategory:c.id},'MZN').status,'determined');assert.equal(evaluateReducedBase({...r,workCategory:'private_work'},'MZN').status,'indeterminate');assert.equal(evaluateReducedBase({...r,projectRef:''},'MZN').status,'indeterminate');assert.match(result.reason,/base40%/);}
|
||||
else{for(const patch of [{priceRef:''},{priceFrom:''},{priceFrom:'2027-01-01'},{priceTo:'2026-11-30'},{priceTo:'2025-12-31'}])assert.equal(evaluateReducedBase({...r,...patch},'MZN').status,'indeterminate');assert.equal(evaluateReducedBase({...r,priceTo:''},'MZN').status,'determined');}
|
||||
});
|
||||
test('Exactfraction retained,no 60percent works base,no duplicate reduction and no automatic deduction',()=>{
|
||||
assert.equal(evaluateReducedBase({...row('regulated_energy'),consideration:'0.000001'},'MZN').baseAmount,'0.00000062');assert.equal(evaluateReducedBase({...row('public_works'),consideration:'0.000001'},'MZN').baseAmount,'0.0000004');
|
||||
assert.equal(evaluateReducedBase({...row('public_water'),consideration:'999999999999999.999999'},'MZN').baseAmount,'749999999999999.99999925');
|
||||
const reduced=row('public_works');reduced.conditions.fullNetInvoice='no';assert.equal(evaluateReducedBase(reduced,'MZN').baseAmount,null);
|
||||
const changed=switchReducedTreatment(row('regulated_energy'),'public_works');assert.equal(changed.priceRef,row('regulated_energy').priceRef);assert.equal(changed.projectRef,row('regulated_energy').projectRef);assert.equal(changed.conditions.publicWorks,undefined);assert.equal(evaluateReducedBase(changed,'MZN').status,'indeterminate');
|
||||
});
|
||||
test('Four branches save/recover/history/report and all previous books are preserved',()=>{
|
||||
const rows=reducedBaseTreatments.map(t=>row(t.id));let book=recordReducedBases(draft,{rows});book=recordReducedBases(draft,book);assert.equal(book.history.length,1);assert.notEqual(book.result.inputs,book.rows);
|
||||
const next={...draft,modelo_a_snapshot:saveReducedBaseBook(draft,book)};assert.deepEqual(reducedBaseBook(next),book);assert.ok(reducedBaseCurrent(next,book));assert.equal(reducedBaseCurrent({...next,currency:'USD'},book),false);assert.equal(reducedBaseCurrent({...next,context_opportunity:'other'},book),false);assert.equal(reducedBaseReportRows(next).length,4);for(const t of reducedBaseTreatments)assert.ok(reducedBaseReportRows(next).some(r=>r[1].includes(t.branch)));
|
||||
const store=JSON.parse(next.modelo_a_snapshot);delete store.regulatedReducedBases;assert.deepEqual(store,JSON.parse(frozen.modelo_a_snapshot));assert.throws(()=>recordReducedBases(next,{rows:[rows[0],rows[0]]}));assert.throws(()=>reducedBaseBook({...next,modelo_a_snapshot:JSON.stringify({...JSON.parse(next.modelo_a_snapshot),regulatedReducedBases:[]})}));
|
||||
if(process.env.IVA_REDUCED_FIXTURE)fs.writeFileSync(process.env.IVA_REDUCED_FIXTURE,JSON.stringify(next,null,2)+'\n');
|
||||
});
|
||||
Reference in New Issue
Block a user