Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7e5710ebbd | ||
|
|
6f90fcb9d4 | ||
|
|
e3caf55361 | ||
|
|
0bef805ede |
@@ -17472,5 +17472,321 @@
|
||||
},
|
||||
"base_VAT_separation": "Accepted QA reused:TC included is subtracted once;alreadyexcluded unchanged. Price reference/scope/period and immutable inputs/history/report retained;no presumed price/TC or double subtraction. Base independent of VAT/rate(alwaysnull). Four installed runtime hashes and15compiled markers verified;no synthetic activewrite.",
|
||||
"activation": "Normal Git fast-forward/webhook/installer;zero migrations/imports"
|
||||
},
|
||||
"iva_l1_g7e_P100_homologation_20261024": {
|
||||
"status": "installed_delta_verified_partial_L1",
|
||||
"candidate": "0460c85330557b8074c14c04c74cd890e6cab97a",
|
||||
"base_installed": "92a7418cb6b080916a4d02d3c1db4be94d3d96f1",
|
||||
"coverage_complete_branches": {
|
||||
"AUD-SIM-L1-P100": [
|
||||
"noncash_only",
|
||||
"cash_and_noncash"
|
||||
]
|
||||
},
|
||||
"branch_count_complete": 1,
|
||||
"treatment_count": 2,
|
||||
"runtime_delta": [
|
||||
{
|
||||
"path": "resources/js/lib/iva-noncash-base.ts",
|
||||
"sha256_LF": "d07cbefec4d54cffe41626093832972b31b8eacf0021a146655c79b189f25434"
|
||||
},
|
||||
{
|
||||
"path": "resources/js/components/simulation-noncash-base.tsx",
|
||||
"sha256_LF": "e8d5dd905d9c6b75ed7589e4ecf7b708bb288ba59285d409f444e799f9f09c35"
|
||||
},
|
||||
{
|
||||
"path": "resources/js/components/simulation-monthly-iva.tsx",
|
||||
"sha256_LF": "bc1005d31306c859dfa325f8d63e8bac98073b38f6d65ab22f736537629d4752"
|
||||
},
|
||||
{
|
||||
"path": "resources/js/lib/project-dossier.ts",
|
||||
"sha256_LF": "84d3c968dfa0a644f1767c09dd266fbe32b086117da0416564681e4a51e8d7f6"
|
||||
}
|
||||
],
|
||||
"counts_before": {
|
||||
"delivered": 82,
|
||||
"QA": 1,
|
||||
"functional_pending": 49,
|
||||
"documentary": 1,
|
||||
"total": 133
|
||||
},
|
||||
"counts_current": {
|
||||
"delivered": 83,
|
||||
"QA": 0,
|
||||
"functional_pending": 49,
|
||||
"documentary": 1,
|
||||
"total": 133
|
||||
},
|
||||
"counts_after_delivery": {
|
||||
"delivered": 83,
|
||||
"QA": 0,
|
||||
"functional_pending": 49,
|
||||
"documentary": 1,
|
||||
"total": 133
|
||||
},
|
||||
"QA_proofs_reused": [
|
||||
"iva-l1-g7e-qa-20261024.json"
|
||||
],
|
||||
"authorization": "Tempo explicitly deploy0460c853 through existingGit,preserve concurrentchanges and check installeddelta only;two treatments sameP100branch",
|
||||
"scope": "2026/MZN,baseonly;no currencyconversion,automatic normalvaluation,incidence/rate/VAT/deduction/field11/ModeloAtotals. Unknown monetary share not inferredzero;explicitzero differentiated. Otherbranches and prior normalvalue contexts unchanged.",
|
||||
"meaning": "Consideration not wholly or partly defined in money:money received/receivable plus normalvalue of goods/services given in exchange as consideration for identified operation. Entirely noncash only with express composition confirmation,not inferred from emptycash field.",
|
||||
"formula": {
|
||||
"noncash_only": "normalvalue,absence of monetary consideration explicitly confirmed",
|
||||
"cash_and_noncash": "cashamount received/receivable + normalvalue of goods/services given in exchange"
|
||||
},
|
||||
"preservation": "82priorclosures and partialP084/P085 preserved;acceptedQA reused;freshbackup/realisolatedrestore beforeinstallation;installeddelta only",
|
||||
"partial_P084_P085": "Preparation/conditional simulation only,benefits pending;no closure",
|
||||
"limits": "P084/P085partial,pending;P00105/06;L1open;beveragesL2/L3;Statistics/AIdeferred",
|
||||
"containment": "l1-g7e-readonly-rollback-20261024.patch,checked only,not applied;blocks newP100calculations only,preserves readers/history/otherbranches",
|
||||
"authenticated_preflight": {
|
||||
"installed": {
|
||||
"status": "installed",
|
||||
"commit": "92a7418cb6b080916a4d02d3c1db4be94d3d96f1",
|
||||
"release": "/var/www/investmoz-homologacao/releases/92a7418cb6b080916a4d02d3c1db4be94d3d96f1-ebe3dcb6",
|
||||
"previous_release": "/var/www/investmoz-homologacao/releases/df7cb7fa47f50ae23f52c1bdf7e48e38489cffef-be472ead",
|
||||
"database_migrations": 0,
|
||||
"content_imports": 0
|
||||
},
|
||||
"current_link": "/var/www/investmoz-homologacao/releases/92a7418cb6b080916a4d02d3c1db4be94d3d96f1-ebe3dcb6",
|
||||
"release_revision": {
|
||||
"commit": "92a7418cb6b080916a4d02d3c1db4be94d3d96f1",
|
||||
"branch": "main",
|
||||
"built_at": "2026-10-24T20:37:45.995677+00:00",
|
||||
"manifest_sha256": "bac69b18e37c76367dbcdd4caee54122f088dfafdc344ebd8a7e31f66617cfc8"
|
||||
},
|
||||
"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-g7e-delivery-20261024/backup",
|
||||
"target": {
|
||||
"database": "teste_investidor",
|
||||
"port": 5432
|
||||
},
|
||||
"tables": 174,
|
||||
"files_verified": 369,
|
||||
"dump_sha256": "dcc4d9b15c0a62b065742f976dc4478c560674f40e6fd7c2017492dee433a27e",
|
||||
"files_sha256": "59804ad31f7c6a6055aed0020b7b8d30f23e0ad8b43e75d6280fba977d0e4a4e",
|
||||
"restore_verified": false
|
||||
},
|
||||
"restore": {
|
||||
"restore_verified": true,
|
||||
"tables_verified": 174,
|
||||
"container_network": "none",
|
||||
"database": "l1_g7e_restore_20261024",
|
||||
"port": 55441,
|
||||
"source_dump_sha256": "dcc4d9b15c0a62b065742f976dc4478c560674f40e6fd7c2017492dee433a27e",
|
||||
"active_database_writes": 0
|
||||
}
|
||||
},
|
||||
"served_commit": "70b4a640ee5f790f8e6a089d157456ff437e336d",
|
||||
"installation": {
|
||||
"protected": {
|
||||
"installed": {
|
||||
"status": "installed",
|
||||
"commit": "70b4a640ee5f790f8e6a089d157456ff437e336d",
|
||||
"release": "/var/www/investmoz-homologacao/releases/70b4a640ee5f790f8e6a089d157456ff437e336d-c95636fc",
|
||||
"previous_release": "/var/www/investmoz-homologacao/releases/92a7418cb6b080916a4d02d3c1db4be94d3d96f1-ebe3dcb6",
|
||||
"database_migrations": 0,
|
||||
"content_imports": 0
|
||||
},
|
||||
"runtime_files_verified": 4,
|
||||
"persistent_files_and_env_verified": 369,
|
||||
"tables_compared": 174,
|
||||
"changed_tables": {
|
||||
"cache": {
|
||||
"before": {
|
||||
"rows": 105,
|
||||
"checksum": "ed216cb11fffaa2b61c114570c78a17b"
|
||||
},
|
||||
"after": {
|
||||
"rows": 105,
|
||||
"checksum": "ff9165ae0fd40844ce207770858bf0d1"
|
||||
}
|
||||
},
|
||||
"sessions": {
|
||||
"before": {
|
||||
"rows": 65,
|
||||
"checksum": "8aee0965c2b1e3d8f0a01c8d0d7d5ec1"
|
||||
},
|
||||
"after": {
|
||||
"rows": 66,
|
||||
"checksum": "13e05ea1a9dc6cd7c07205bfe491b4c7"
|
||||
}
|
||||
}
|
||||
},
|
||||
"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": "70b4a640ee5f790f8e6a089d157456ff437e336d",
|
||||
"branch": "main",
|
||||
"built_at": "2026-10-24T20:45:12.326319+00:00",
|
||||
"manifest_sha256": "c141928a91011ced381e72b1e616469bb9fe061a2a9e9d7b43dcf8ec37ccd068"
|
||||
},
|
||||
"manifest_hash_matches": true,
|
||||
"compiled_delta_markers": {
|
||||
"noncash-consideration-base/1": [
|
||||
"assets/project-dossier-BG2KqrE6.js"
|
||||
],
|
||||
"noncash_only": [
|
||||
"assets/project-dossier-BG2KqrE6.js"
|
||||
],
|
||||
"cash_and_noncash": [
|
||||
"assets/project-dossier-BG2KqrE6.js",
|
||||
"assets/services-B-L_nC4P.js"
|
||||
],
|
||||
"noncashBases": [
|
||||
"assets/project-dossier-BG2KqrE6.js"
|
||||
],
|
||||
"taxableOperation": [
|
||||
"assets/project-dossier-BG2KqrE6.js"
|
||||
],
|
||||
"exchangeIdentified": [
|
||||
"assets/project-dossier-BG2KqrE6.js"
|
||||
],
|
||||
"cashComposition": [
|
||||
"assets/project-dossier-BG2KqrE6.js"
|
||||
],
|
||||
"normalValueBasis": [
|
||||
"assets/project-dossier-BG2KqrE6.js"
|
||||
],
|
||||
"cashAmount": [
|
||||
"assets/project-dossier-BG2KqrE6.js",
|
||||
"assets/services-B-L_nC4P.js"
|
||||
],
|
||||
"cashRef": [
|
||||
"assets/project-dossier-BG2KqrE6.js",
|
||||
"assets/services-B-L_nC4P.js"
|
||||
],
|
||||
"normalValue": [
|
||||
"assets/project-dossier-BG2KqrE6.js",
|
||||
"assets/services-B-L_nC4P.js"
|
||||
],
|
||||
"exchangeDescription": [
|
||||
"assets/project-dossier-BG2KqrE6.js",
|
||||
"assets/services-B-L_nC4P.js"
|
||||
],
|
||||
"agreementRef": [
|
||||
"assets/project-dossier-BG2KqrE6.js",
|
||||
"assets/services-B-L_nC4P.js"
|
||||
],
|
||||
"valuationRef": [
|
||||
"assets/project-dossier-BG2KqrE6.js",
|
||||
"assets/services-B-L_nC4P.js"
|
||||
],
|
||||
"valuationScope": [
|
||||
"assets/project-dossier-BG2KqrE6.js",
|
||||
"assets/services-B-L_nC4P.js"
|
||||
],
|
||||
"IVA: Indeterminado": [
|
||||
"assets/project-dossier-BG2KqrE6.js"
|
||||
]
|
||||
},
|
||||
"assets": [
|
||||
{
|
||||
"file": "assets/project-dossier-BG2KqrE6.js",
|
||||
"status": 200,
|
||||
"sha256": "372b30385b0d0ead940a585e0eb90517e0b03bf8e04eff78aa368d52ba882a81"
|
||||
},
|
||||
{
|
||||
"file": "assets/simulation-form-CPZAFZU3.js",
|
||||
"status": 200,
|
||||
"sha256": "c6bcf64e60a5eeac0cafe3dc055dc5544162f21942ee08b34d51bc6d52947567"
|
||||
},
|
||||
{
|
||||
"file": "assets/services-B-L_nC4P.js",
|
||||
"status": 200,
|
||||
"sha256": "4272f5a7705350dbb2e46dc328a73447e814f9280614077a9c902c32e4f32063"
|
||||
},
|
||||
{
|
||||
"file": "assets/project-dossier-document-CbKgC_ZS.js",
|
||||
"status": 200,
|
||||
"sha256": "68a73417854b38b1cb93434f10762323ad3dfed97b9bddbce0e3f2ca0f5af7d2"
|
||||
}
|
||||
],
|
||||
"simulator_status": 200,
|
||||
"simulator_entry": "assets/app-BKEVCVJE.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": "70b4a640ee5f790f8e6a089d157456ff437e336d",
|
||||
"release": "/var/www/investmoz-homologacao/releases/70b4a640ee5f790f8e6a089d157456ff437e336d-c95636fc",
|
||||
"previous_release": "/var/www/investmoz-homologacao/releases/92a7418cb6b080916a4d02d3c1db4be94d3d96f1-ebe3dcb6",
|
||||
"database_migrations": 0,
|
||||
"content_imports": 0
|
||||
},
|
||||
"latest_report": {
|
||||
"status": "installed",
|
||||
"commit": "70b4a640ee5f790f8e6a089d157456ff437e336d",
|
||||
"release": "/var/www/investmoz-homologacao/releases/70b4a640ee5f790f8e6a089d157456ff437e336d-c95636fc",
|
||||
"previous_release": "/var/www/investmoz-homologacao/releases/92a7418cb6b080916a4d02d3c1db4be94d3d96f1-ebe3dcb6",
|
||||
"database_migrations": 0,
|
||||
"content_imports": 0,
|
||||
"requested_commits": [
|
||||
"70b4a640ee5f790f8e6a089d157456ff437e336d"
|
||||
],
|
||||
"finished_at": "2026-10-24T20:45:15.438182+00:00"
|
||||
},
|
||||
"log_file": "1792874615285322105.log",
|
||||
"summaries": [
|
||||
"OK (1 test, 3106 assertions)",
|
||||
"built in 25.36s",
|
||||
"OK (59 tests, 317 assertions)",
|
||||
"# tests 362",
|
||||
"# pass 362",
|
||||
"# fail 0"
|
||||
],
|
||||
"log_bytes": 134422
|
||||
},
|
||||
"rollback_executed": false
|
||||
},
|
||||
"base_VAT_separation": "Accepted QA reused:normalvalue of goods/services given in exchange plus monetary share if present;absence expressly confirmed,hidden monetary inputs preserved but not summed in noncash_only. Normalvalue basis/scope and immutable inputs/history/report retained. Base independent of VAT/rate(alwaysnull). Four installed runtime hashes and16compiled markers verified;no synthetic activewrite.",
|
||||
"activation": "Normal Git fast-forward/webhook/installer;zero migrations/imports"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"implementation_commit": "9f053ac9d3f332c432420fd5b5d31cdfb7936071",
|
||||
"status": "QA_complete_not_delivered",
|
||||
"status": "delivered_with_QA_proofs_preserved",
|
||||
"coverage": {
|
||||
"AUD-SIM-L1-P100": [
|
||||
"noncash_only",
|
||||
@@ -151,5 +151,18 @@
|
||||
"homologation_unchanged": "92a7418c",
|
||||
"remaining": "Integrate/deliver through existingGit withmanifest,freshbackup/real isolatedrestore and installeddelta;no push in QA task",
|
||||
"limits": "P084/P085partial,pending;P00105/06;L1open;beveragesL2/L3;Statistics/AIdeferred",
|
||||
"sources_inventory": "C:\\laragon\\www\\portal-investidor\\outputs\\iva-l1-g7e-noncash-base-20261024\\source-archive-inventory.json"
|
||||
"sources_inventory": "C:\\laragon\\www\\portal-investidor\\outputs\\iva-l1-g7e-noncash-base-20261024\\source-archive-inventory.json",
|
||||
"qa_status_preserved": "QA_complete_not_delivered",
|
||||
"delivery_followup": {
|
||||
"served_commit": "70b4a640ee5f790f8e6a089d157456ff437e336d",
|
||||
"receipt": "l1-g7e-delivery-20261024.json",
|
||||
"record": "iva_l1_g7e_P100_homologation_20261024",
|
||||
"counts": {
|
||||
"delivered": 83,
|
||||
"QA": 0,
|
||||
"functional_pending": 49,
|
||||
"documentary": 1,
|
||||
"total": 133
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,153 @@
|
||||
{
|
||||
"implementation_commit": "e3caf553616da59222dbc2bd2327dfae602ad3db",
|
||||
"status": "QA_complete_not_delivered",
|
||||
"coverage": {
|
||||
"AUD-SIM-L1-P101": [
|
||||
"tax_component",
|
||||
"accessory_component"
|
||||
]
|
||||
},
|
||||
"branch_count": 1,
|
||||
"treatment_count": 2,
|
||||
"source": "CIVA15(5)(a)/(b),Lei13/2016PDF14/p1426(272);15(1)/(2)/(6);Lei22/2022PDF3maintains15(5)byremissão;Lei10/2025doesnotamend15;2017rectificationdoesnotamend15(5).",
|
||||
"meaning": "Include taxes,duties,fees/otherimpositions excludingownVAT;accessory expenses charged forcommissions,packaging,transport/insurance onclientaccount. Both component treatments form one base peroperation,not parallelbases.",
|
||||
"formula": "initial amount netofownVAT/applicableexclusions + sum of applicable components notalreadyincluded;alreadyincluded components retained without secondsum",
|
||||
"technical_choices": "New considerationCompositions opportunity-scoped book in existingmodelo_a_snapshot/API/dossier;operations with nested components,ids and immutableinput/history/report. No schema/permissionschange. Exactdecimal up to6fractiondigits,no assumed fiscalrounding. Componenttreatmentchange preservesamount/reference/inclusion but clearsnatureconfirmation as integritychoice. Idduplicates/malformednestedwrite guarded. References reuse documents/projectionassumptions,no newcertificates/approvers.",
|
||||
"scope": "2026/MZN,P101compositiononly;no incidence/taxrates/IVA/deduction/field11/ModeloAtotals. Initialamount explicitlynetofownIVA and applicable15(6)exclusions;specialbases15(2)respected includingP095TCexclusion. DetailedP102exclusions notclosed by thisrecorte. Unknowncomponentamount/inclusion notassumedzero or missing;ownIVA not added ascomponent.",
|
||||
"verification": {
|
||||
"frontend": {
|
||||
"tests": 4,
|
||||
"passed": 4,
|
||||
"failed": 0,
|
||||
"scope": "Ownoperationandcomponentconditions unknown/no;tax/accessory separately andtogether;ownIVA;references;addmissingonly/alreadyincluded unchanged;exactdecimal/zero;switchretention;duplicateparts/malformednestedwrite;oldbooks/currentkeys/history/report"
|
||||
},
|
||||
"privateAPI": {
|
||||
"tests": 1,
|
||||
"assertions": 31,
|
||||
"target": "simulator_fiscal_delta_20261021_test:55441",
|
||||
"transaction_rollback": true,
|
||||
"xml": "C:\\laragon\\www\\portal-investidor\\outputs\\iva-l1-g7f-composition-20261024\\api-tests.xml"
|
||||
},
|
||||
"types": "passed",
|
||||
"build": "passed,existing plugin timing warnings",
|
||||
"UI": "Realcomponent Edge/CUA:unknown inclusion indeterminate;tax100.10alreadyincluded plusaccessory50.25 produces1050.50 from1000.25;ownIVAcondition no yields notapplicable/noIVAzero;finalbothnotincluded1150.60,VATnull;save/recover/report1operation/2components/6priorversions. SyntheticQA,not manualTempoacceptance.",
|
||||
"UI_screenshot": "C:\\laragon\\www\\portal-investidor\\outputs\\iva-l1-g7f-composition-20261024\\qa-recovered-report.png"
|
||||
},
|
||||
"preservation": {
|
||||
"base": "0bef805ede26c9878f5e040aafbd65186ddb56f2",
|
||||
"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-P090",
|
||||
"AUD-SIM-L1-P091",
|
||||
"AUD-SIM-L1-P094",
|
||||
"AUD-SIM-L1-P095",
|
||||
"AUD-SIM-L1-P100"
|
||||
],
|
||||
"confirmed_losses": [],
|
||||
"accepted_delivery": "70b4a640/0bef805e;174tables/369files;29published/28relations/408geometries;code/schema/data/config/permissions compared at delivery",
|
||||
"frozen": "tests\\frontend\\fixtures\\iva-g7f-preserved-inputs.json",
|
||||
"sha256": "6f22015f78ed08c36234b5a19ad574fbc2662d6854c1f85112e1c2bd635ec325",
|
||||
"counts_before": {
|
||||
"delivered": 83,
|
||||
"QA": 0,
|
||||
"functional_pending": 49,
|
||||
"P001": 1,
|
||||
"total": 133
|
||||
},
|
||||
"scope": "P101 only;allpreviousbooks immutable including P100normalvalue/P095TC/P094/P091/P060/P050/partialP084P085;no active query/write"
|
||||
},
|
||||
"runtime_delta": {
|
||||
"resources/js/lib/iva-composition-base.ts": "557d6b4b5ed2c534b69e5edf43c9e4014cdfb7362bf164829cd16e4deeabbf73",
|
||||
"resources/js/components/simulation-composition-base.tsx": "3507c14f15e40bf018089520a46b7e22002ddbd9bffa64d179f085b0d933ae0e",
|
||||
"resources/js/components/simulation-monthly-iva.tsx": "82694be2d0a5ac097b64d68dceeda1df239bb2bf2bce193e8112d3dadad79a95",
|
||||
"resources/js/lib/project-dossier.ts": "c640883680629049ea851a63e28e967a70297257a55e5d885df8e32f4b81e871"
|
||||
},
|
||||
"counts_current": {
|
||||
"delivered": 83,
|
||||
"QA": 1,
|
||||
"functional_pending": 48,
|
||||
"P001": 1,
|
||||
"total": 133
|
||||
},
|
||||
"homologation_unchanged": "70b4a640",
|
||||
"remaining": "Integrate/deliver through existingGit withmanifest,freshbackup/real isolatedrestore and installeddelta;no push in QA task",
|
||||
"limits": "P084/P085partial,pending;P00105/06;L1open;beveragesL2/L3;Statistics/AIdeferred",
|
||||
"sources_inventory": "C:\\laragon\\www\\portal-investidor\\outputs\\iva-l1-g7f-composition-20261024\\source-archive-inventory.json"
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"status": "ready_after_fresh_authenticated_preflight_and_verified_backup_restore",
|
||||
"status": "installed_delta_verified_partial_L1",
|
||||
"candidate": "0460c85330557b8074c14c04c74cd890e6cab97a",
|
||||
"base_installed": "92a7418cb6b080916a4d02d3c1db4be94d3d96f1",
|
||||
"coverage_complete_branches": {
|
||||
@@ -36,8 +36,8 @@
|
||||
"total": 133
|
||||
},
|
||||
"counts_current": {
|
||||
"delivered": 82,
|
||||
"QA": 1,
|
||||
"delivered": 83,
|
||||
"QA": 0,
|
||||
"functional_pending": 49,
|
||||
"documentary": 1,
|
||||
"total": 133
|
||||
@@ -127,5 +127,190 @@
|
||||
"source_dump_sha256": "dcc4d9b15c0a62b065742f976dc4478c560674f40e6fd7c2017492dee433a27e",
|
||||
"active_database_writes": 0
|
||||
}
|
||||
}
|
||||
},
|
||||
"served_commit": "70b4a640ee5f790f8e6a089d157456ff437e336d",
|
||||
"installation": {
|
||||
"protected": {
|
||||
"installed": {
|
||||
"status": "installed",
|
||||
"commit": "70b4a640ee5f790f8e6a089d157456ff437e336d",
|
||||
"release": "/var/www/investmoz-homologacao/releases/70b4a640ee5f790f8e6a089d157456ff437e336d-c95636fc",
|
||||
"previous_release": "/var/www/investmoz-homologacao/releases/92a7418cb6b080916a4d02d3c1db4be94d3d96f1-ebe3dcb6",
|
||||
"database_migrations": 0,
|
||||
"content_imports": 0
|
||||
},
|
||||
"runtime_files_verified": 4,
|
||||
"persistent_files_and_env_verified": 369,
|
||||
"tables_compared": 174,
|
||||
"changed_tables": {
|
||||
"cache": {
|
||||
"before": {
|
||||
"rows": 105,
|
||||
"checksum": "ed216cb11fffaa2b61c114570c78a17b"
|
||||
},
|
||||
"after": {
|
||||
"rows": 105,
|
||||
"checksum": "ff9165ae0fd40844ce207770858bf0d1"
|
||||
}
|
||||
},
|
||||
"sessions": {
|
||||
"before": {
|
||||
"rows": 65,
|
||||
"checksum": "8aee0965c2b1e3d8f0a01c8d0d7d5ec1"
|
||||
},
|
||||
"after": {
|
||||
"rows": 66,
|
||||
"checksum": "13e05ea1a9dc6cd7c07205bfe491b4c7"
|
||||
}
|
||||
}
|
||||
},
|
||||
"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": "70b4a640ee5f790f8e6a089d157456ff437e336d",
|
||||
"branch": "main",
|
||||
"built_at": "2026-10-24T20:45:12.326319+00:00",
|
||||
"manifest_sha256": "c141928a91011ced381e72b1e616469bb9fe061a2a9e9d7b43dcf8ec37ccd068"
|
||||
},
|
||||
"manifest_hash_matches": true,
|
||||
"compiled_delta_markers": {
|
||||
"noncash-consideration-base/1": [
|
||||
"assets/project-dossier-BG2KqrE6.js"
|
||||
],
|
||||
"noncash_only": [
|
||||
"assets/project-dossier-BG2KqrE6.js"
|
||||
],
|
||||
"cash_and_noncash": [
|
||||
"assets/project-dossier-BG2KqrE6.js",
|
||||
"assets/services-B-L_nC4P.js"
|
||||
],
|
||||
"noncashBases": [
|
||||
"assets/project-dossier-BG2KqrE6.js"
|
||||
],
|
||||
"taxableOperation": [
|
||||
"assets/project-dossier-BG2KqrE6.js"
|
||||
],
|
||||
"exchangeIdentified": [
|
||||
"assets/project-dossier-BG2KqrE6.js"
|
||||
],
|
||||
"cashComposition": [
|
||||
"assets/project-dossier-BG2KqrE6.js"
|
||||
],
|
||||
"normalValueBasis": [
|
||||
"assets/project-dossier-BG2KqrE6.js"
|
||||
],
|
||||
"cashAmount": [
|
||||
"assets/project-dossier-BG2KqrE6.js",
|
||||
"assets/services-B-L_nC4P.js"
|
||||
],
|
||||
"cashRef": [
|
||||
"assets/project-dossier-BG2KqrE6.js",
|
||||
"assets/services-B-L_nC4P.js"
|
||||
],
|
||||
"normalValue": [
|
||||
"assets/project-dossier-BG2KqrE6.js",
|
||||
"assets/services-B-L_nC4P.js"
|
||||
],
|
||||
"exchangeDescription": [
|
||||
"assets/project-dossier-BG2KqrE6.js",
|
||||
"assets/services-B-L_nC4P.js"
|
||||
],
|
||||
"agreementRef": [
|
||||
"assets/project-dossier-BG2KqrE6.js",
|
||||
"assets/services-B-L_nC4P.js"
|
||||
],
|
||||
"valuationRef": [
|
||||
"assets/project-dossier-BG2KqrE6.js",
|
||||
"assets/services-B-L_nC4P.js"
|
||||
],
|
||||
"valuationScope": [
|
||||
"assets/project-dossier-BG2KqrE6.js",
|
||||
"assets/services-B-L_nC4P.js"
|
||||
],
|
||||
"IVA: Indeterminado": [
|
||||
"assets/project-dossier-BG2KqrE6.js"
|
||||
]
|
||||
},
|
||||
"assets": [
|
||||
{
|
||||
"file": "assets/project-dossier-BG2KqrE6.js",
|
||||
"status": 200,
|
||||
"sha256": "372b30385b0d0ead940a585e0eb90517e0b03bf8e04eff78aa368d52ba882a81"
|
||||
},
|
||||
{
|
||||
"file": "assets/simulation-form-CPZAFZU3.js",
|
||||
"status": 200,
|
||||
"sha256": "c6bcf64e60a5eeac0cafe3dc055dc5544162f21942ee08b34d51bc6d52947567"
|
||||
},
|
||||
{
|
||||
"file": "assets/services-B-L_nC4P.js",
|
||||
"status": 200,
|
||||
"sha256": "4272f5a7705350dbb2e46dc328a73447e814f9280614077a9c902c32e4f32063"
|
||||
},
|
||||
{
|
||||
"file": "assets/project-dossier-document-CbKgC_ZS.js",
|
||||
"status": 200,
|
||||
"sha256": "68a73417854b38b1cb93434f10762323ad3dfed97b9bddbce0e3f2ca0f5af7d2"
|
||||
}
|
||||
],
|
||||
"simulator_status": 200,
|
||||
"simulator_entry": "assets/app-BKEVCVJE.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": "70b4a640ee5f790f8e6a089d157456ff437e336d",
|
||||
"release": "/var/www/investmoz-homologacao/releases/70b4a640ee5f790f8e6a089d157456ff437e336d-c95636fc",
|
||||
"previous_release": "/var/www/investmoz-homologacao/releases/92a7418cb6b080916a4d02d3c1db4be94d3d96f1-ebe3dcb6",
|
||||
"database_migrations": 0,
|
||||
"content_imports": 0
|
||||
},
|
||||
"latest_report": {
|
||||
"status": "installed",
|
||||
"commit": "70b4a640ee5f790f8e6a089d157456ff437e336d",
|
||||
"release": "/var/www/investmoz-homologacao/releases/70b4a640ee5f790f8e6a089d157456ff437e336d-c95636fc",
|
||||
"previous_release": "/var/www/investmoz-homologacao/releases/92a7418cb6b080916a4d02d3c1db4be94d3d96f1-ebe3dcb6",
|
||||
"database_migrations": 0,
|
||||
"content_imports": 0,
|
||||
"requested_commits": [
|
||||
"70b4a640ee5f790f8e6a089d157456ff437e336d"
|
||||
],
|
||||
"finished_at": "2026-10-24T20:45:15.438182+00:00"
|
||||
},
|
||||
"log_file": "1792874615285322105.log",
|
||||
"summaries": [
|
||||
"OK (1 test, 3106 assertions)",
|
||||
"built in 25.36s",
|
||||
"OK (59 tests, 317 assertions)",
|
||||
"# tests 362",
|
||||
"# pass 362",
|
||||
"# fail 0"
|
||||
],
|
||||
"log_bytes": 134422
|
||||
},
|
||||
"rollback_executed": false
|
||||
},
|
||||
"base_VAT_separation": "Accepted QA reused:normalvalue of goods/services given in exchange plus monetary share if present;absence expressly confirmed,hidden monetary inputs preserved but not summed in noncash_only. Normalvalue basis/scope and immutable inputs/history/report retained. Base independent of VAT/rate(alwaysnull). Four installed runtime hashes and16compiled markers verified;no synthetic activewrite.",
|
||||
"activation": "Normal Git fast-forward/webhook/installer;zero migrations/imports"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,128 @@
|
||||
{
|
||||
"status": "ready_after_fresh_authenticated_preflight_and_verified_backup_restore",
|
||||
"candidate": "6f90fcb9d4ea6e93b13291e65fa6cb7406ca98c9",
|
||||
"base_installed": "70b4a640ee5f790f8e6a089d157456ff437e336d",
|
||||
"coverage_complete_branches": {
|
||||
"AUD-SIM-L1-P101": [
|
||||
"tax_component",
|
||||
"accessory_component"
|
||||
]
|
||||
},
|
||||
"branch_count_complete": 1,
|
||||
"treatment_count": 2,
|
||||
"runtime_delta": [
|
||||
{
|
||||
"path": "resources/js/lib/iva-composition-base.ts",
|
||||
"sha256_LF": "557d6b4b5ed2c534b69e5edf43c9e4014cdfb7362bf164829cd16e4deeabbf73"
|
||||
},
|
||||
{
|
||||
"path": "resources/js/components/simulation-composition-base.tsx",
|
||||
"sha256_LF": "3507c14f15e40bf018089520a46b7e22002ddbd9bffa64d179f085b0d933ae0e"
|
||||
},
|
||||
{
|
||||
"path": "resources/js/components/simulation-monthly-iva.tsx",
|
||||
"sha256_LF": "82694be2d0a5ac097b64d68dceeda1df239bb2bf2bce193e8112d3dadad79a95"
|
||||
},
|
||||
{
|
||||
"path": "resources/js/lib/project-dossier.ts",
|
||||
"sha256_LF": "c640883680629049ea851a63e28e967a70297257a55e5d885df8e32f4b81e871"
|
||||
}
|
||||
],
|
||||
"counts_before": {
|
||||
"delivered": 83,
|
||||
"QA": 1,
|
||||
"functional_pending": 48,
|
||||
"documentary": 1,
|
||||
"total": 133
|
||||
},
|
||||
"counts_current": {
|
||||
"delivered": 83,
|
||||
"QA": 1,
|
||||
"functional_pending": 48,
|
||||
"documentary": 1,
|
||||
"total": 133
|
||||
},
|
||||
"counts_after_delivery": {
|
||||
"delivered": 84,
|
||||
"QA": 0,
|
||||
"functional_pending": 48,
|
||||
"documentary": 1,
|
||||
"total": 133
|
||||
},
|
||||
"QA_proofs_reused": [
|
||||
"iva-l1-g7f-qa-20261024.json"
|
||||
],
|
||||
"authorization": "Tempo explicitly deploy6f90fcb9 through existingGit,preserve concurrentchanges and check installeddelta only;onebase peroperation,withoutdoublecounting or ownVAT;two componenttreatments sameP101branch",
|
||||
"scope": "2026/MZN,P101compositiononly;no incidence/taxrates/IVA/deduction/field11/ModeloAtotals. Initialamount explicitlynetofownIVA and applicable15(6)exclusions;specialbases15(2)respected includingP095TCexclusion. DetailedP102exclusions notclosed by thisrecorte. Unknowncomponentamount/inclusion notassumedzero or missing;ownIVA not added ascomponent.",
|
||||
"meaning": "Include taxes,duties,fees/otherimpositions excludingownVAT;accessory expenses charged forcommissions,packaging,transport/insurance onclientaccount. Both component treatments form one base peroperation,not parallelbases.",
|
||||
"formula": "initial amount netofownVAT/applicableexclusions + sum of applicable components notalreadyincluded;alreadyincluded components retained without secondsum",
|
||||
"preservation": "83priorclosures and partialP084/P085 preserved;acceptedQA reused;freshbackup/realisolatedrestore beforeinstallation;installeddelta only",
|
||||
"partial_P084_P085": "Preparation/conditional simulation only,benefits pending;no closure",
|
||||
"limits": "P084/P085partial,pending;P00105/06;L1open;beveragesL2/L3;Statistics/AIdeferred",
|
||||
"containment": "l1-g7f-readonly-rollback-20261024.patch,checked only,not applied;blocks newP101calculations only,preserves readers/history/otherbranches",
|
||||
"authenticated_preflight": {
|
||||
"installed": {
|
||||
"status": "installed",
|
||||
"commit": "70b4a640ee5f790f8e6a089d157456ff437e336d",
|
||||
"release": "/var/www/investmoz-homologacao/releases/70b4a640ee5f790f8e6a089d157456ff437e336d-c95636fc",
|
||||
"previous_release": "/var/www/investmoz-homologacao/releases/92a7418cb6b080916a4d02d3c1db4be94d3d96f1-ebe3dcb6",
|
||||
"database_migrations": 0,
|
||||
"content_imports": 0
|
||||
},
|
||||
"current_link": "/var/www/investmoz-homologacao/releases/70b4a640ee5f790f8e6a089d157456ff437e336d-c95636fc",
|
||||
"release_revision": {
|
||||
"commit": "70b4a640ee5f790f8e6a089d157456ff437e336d",
|
||||
"branch": "main",
|
||||
"built_at": "2026-10-24T20:45:12.326319+00:00",
|
||||
"manifest_sha256": "c141928a91011ced381e72b1e616469bb9fe061a2a9e9d7b43dcf8ec37ccd068"
|
||||
},
|
||||
"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-g7f-delivery-20261024/backup",
|
||||
"target": {
|
||||
"database": "teste_investidor",
|
||||
"port": 5432
|
||||
},
|
||||
"tables": 174,
|
||||
"files_verified": 369,
|
||||
"dump_sha256": "18729e57928183ae4a59eb2e34566a1e87ec4a1fa9e8d3a97177ab9623ae272a",
|
||||
"files_sha256": "13142a0558b2a84ae6fd142789fe313f09ef3a0f3b201c6421a274e4105f7f23",
|
||||
"restore_verified": false
|
||||
},
|
||||
"restore": {
|
||||
"restore_verified": true,
|
||||
"tables_verified": 174,
|
||||
"container_network": "none",
|
||||
"database": "l1_g7f_restore_20261024",
|
||||
"port": 55441,
|
||||
"source_dump_sha256": "18729e57928183ae4a59eb2e34566a1e87ec4a1fa9e8d3a97177ab9623ae272a",
|
||||
"active_database_writes": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
--- a/resources/js/lib/iva-composition-base.ts
|
||||
+++ b/resources/js/lib/iva-composition-base.ts
|
||||
@@ -55,6 +55,7 @@
|
||||
function key(draft:Record<string,unknown>,book:CompositionBook):string{return JSON.stringify({version:compositionBaseVersion,scope:acquisitionScope(draft),location:draft.selection_labels??{},currency:draft.currency,rows:book.rows});}
|
||||
export function compositionCurrent(draft:Record<string,unknown>,book:CompositionBook):boolean{return!!book.result&&book.result.sourceKey===key(draft,book);}
|
||||
export function recordCompositions(draft:Record<string,unknown>,book:CompositionBook):CompositionBook{
|
||||
+ throw new Error('Novas bases P101 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:CompositionCalculation={version:compositionBaseVersion,revision:(book.result?.revision??0)+1,calculatedAt:new Date().toISOString(),opportunity:acquisitionScope(draft),location:JSON.stringify(draft.selection_labels??{}),sourceKey:key(draft,book),source:compositionBaseSource,inputs:structuredClone(book.rows),rows:book.rows.map(row=>evaluateComposition(row,draft.currency))};
|
||||
const next={...book,result,history:[...(book.history??[]),...(book.result?[book.result]:[])]};saveCompositionBook(draft,next);return next;
|
||||
@@ -1,6 +1,36 @@
|
||||
# Rastreabilidade, utilização e formação
|
||||
|
||||
|
||||
## 24/10/2026 — G7F/P101 concluído emQA:composição da contraprestação sem dupla contagem
|
||||
|
||||
Implementação`e3caf553`. **Um ramo,dois tratamentos de parcela**:`tax_component` e`accessory_component`,na mesma composição por operação. FonteCIVA15(5)(a)/(b),Lei13/2016PDF14/p1426(272),15(1)/(2)/(6);Lei22/2022PDF3mantém5 por remissão;Lei10/2025não altera15. Impostos/direitos/taxas/outras imposições excepto próprioIVA;despesas acessórias debitadas relativas a comissões,embalagem,transporte e seguros por conta do cliente. Uma base por operação,não bases concorrentes por parcela.
|
||||
|
||||
Fórmula:montante inicial sem próprioIVA e com exclusões aplicáveis consideradas+parcelas aplicáveis ainda não incluídas. Parcelas já incluídas conservadas sem segunda soma;desconhecido não é zero nem soma/ausência presumida. Montante inicial/parcelas/composição referenciados,com documentos reutilizados ou pressupostos expressos. Respeitar regras especiais15(2),incluindo exclusãoTC deP095;P102(exclusões detalhadas)não é fechado nesta entrega. Sem taxas,IVA,dedução/campo11/totaisModeloA. Decimal exacto até6casas,sem arredondamento fiscal presumido. LivroconsiderationCompositions por oportunidade com operações/parcelas aninhadas,snapshot/API/dossier existentes,sem schema/permissões novos. Mudar natureza da parcela preserva montante/referência/inclusão e limpa confirmação de natureza;escolha técnica de integridade,não regra organizacional. Sem certificados/aprovadores/revalidação genérica de fontes oficiais.
|
||||
|
||||
Provas do delta:**4testes frontend**,**APIprivada1teste/31asserções**,guarda`simulator_fiscal_delta_20261021_test:55441` e rollback;tipos/build passaram. Interface real Edge/CUA:inclusão desconhecida→indeterminado;imposição100.10já incluída e transporte50.25não incluído dão1000.25+50.25=1050.50;parcela com próprioIVA→não aplicação desta composição,não isenção/IVAzero. Gravação recuperada/relatório:1000.25+100.10+50.25=1150.60,IVAindeterminado,1operação/2parcelas/6versões anteriores. Dados sintéticos,não aceitação manual atribuída à Tempo.83fechos/livros/resultados/históricos intactos,incluindoP100/P095/P094/P091/P090,P060/P056/P050 eP084/P085parciais;provas anteriores reutilizadas. [RegistoQA](../simulations/iva-l1-g7f-qa-20261024.json).
|
||||
|
||||
**83entregues +1emQA(P101) +48funcionaispendentes +P001 =133**. Homologação permanece`70b4a640`;falta integração/entrega pelo processoGit,manifesto/backup/restauro e delta instalado. P084/P085 continuam nos48,apenas preparação/simulação condicionada,sem benefícios confirmados. L1aberto;P00105/06;bebidasL2/L3;Estatísticas/IAadiadas.
|
||||
|
||||
|
||||
|
||||
## 24/10/2026 — preparação G7F/P101,inventário antes de testes
|
||||
|
||||
G7E/P100 aceite70b4a640/0bef805e;**83entregues+49funcionaispendentes+P001=133**. Inventariados83fechos,sem perdas confirmadas;provas instaladas código/schema/dados/configuração/permissões174tabelas/369ficheiros/29fichas/28relações/408geometrias reutilizadas. Congelados todos os livros/resultados/históricos,incluindoP100(valor normal),P095(TCuma vez),P094(âmbito),P091/P090(baseIVA),P060/P056,P050(IVAserviço),P084/P085parciais. Sem repetir aceitação anterior ou ensaiar no activo.
|
||||
|
||||
G7F/P101 executa CIVA15(5)(a)/(b),2016PDF14/p1426(272):impostos/direitos/taxas/outras imposições excepto próprioIVA;despesas acessórias debitadas relativas a comissões,embalagem,transporte e seguros por conta do cliente.2022PDF3mantém5 por remissão;2025não altera15,2017não rectifica15(5). Fontes/exemplares/inventário aceites,cotejo visual com skillPDF. Um ramo,dois tratamentos de parcela na composição da mesma operação:não criar bases concorrentes por parcela. Montante inicial explicitamente líquido de próprioIVA e exclusões aplicáveis15(6);parcelas já incluídas mantidas sem segunda soma,parcelas não incluídas somadas uma vez. Desconhecido não é zero;respeitar regras especiais15(2),incluindoTC emP095,sem as substituir por inclusão genérica. Regra detalhada das exclusõesP102 não é fechada nesta entrega. Novo livro incremental no snapshot/API/relatório existentes,sem schema/permissões ou cálculoIVA/campo11/totaisModeloA. L1aberto;P00105/06;bebidasL2/L3;P084/P085parciais;Estatísticas/IAadiadas.
|
||||
|
||||
|
||||
|
||||
## 24/10/2026 — G7E/P100 entregue:contraprestação não monetária total ou parcial
|
||||
|
||||
Homologação **`70b4a640`**,pelo processoGit existente,sobre`92a7418c`;candidata`0460c853` expressamente aceite pela Tempo. **P100:um ramo,dois tratamentos**,`noncash_only` e`cash_and_noncash`. Base=valor normal dos bens/serviços dados em troca como contraprestação+montante monetário recebido/a receber quando exista. Ausência de dinheiro expressamente confirmada,não inferida de campo vazio;montante oculto preservado mas não somado quando inteiramente não monetária. Operação,contraprestação,acordo,fundamento/âmbito do valor normal15(4),composição15(5)/(6)sem próprioIVA e documentos/pressupostos conservados nas entradas imutáveis,versões/histórico/relatório. Sem avaliação automática,certificado/avaliador/aprovador novo,conversão cambial ou zero presumido. Base separada de incidência/taxa/IVA(IVA/taxa permanecemnull),dedução/campo11/totaisModeloA. Livros anteriores não alterados nem base somada como imposto.
|
||||
|
||||
Destino e main conferidos novamente;sem avanço concorrente encontrado. SessãoSSH autenticada existente reutilizada,sem guardar credenciais. Backup novo e restauro real isolado sem rede:**174tabelas e369ficheiros/configuração**. ProvasQA aceites reutilizadas;conferido apenas delta instalado:revisão servida,manifesto/hash,16marcadores compilados do livro/componente/relatório,dinheiro/valor normal econtraprestação/fundamento/âmbito,quatro ficheiros funcionais e simuladorHTTP200. Comparação PostgreSQL pela mesma identidade antes/depois:174tabelas/369ficheiros,29fichas publicadas/28relações/408geometrias preservados;diferenças apenas cache/sessões. Zero migrações/importações/alterações de permissões e zero ensaios sintéticos no activo. Release/backup anteriores preservados;contençãoP100 conferida,não aplicada,leitores/históricos e restantes ramos preservados.
|
||||
|
||||
[Manifesto/recibo](../simulations/l1-g7e-delivery-20261024.json),registo`iva_l1_g7e_P100_homologation_20261024`. **83entregues +49funcionaispendentes +P001 =133;sem candidatasQA por disponibilizar.** Os82fechos anteriores permanecem encerrados. P084/P085 continuam nos49,apenas preparação/simulação condicionada,sem benefícios confirmados;rascunhos,decisões,âmbitos e históricos preservados. L1aberto;P001 só05/06;bebidasL2/L3;Estatísticas/IAadiadas. FecharL1 não exige concluirL2/L3 nem todos os impostos.
|
||||
|
||||
|
||||
|
||||
## 24/10/2026 — G7E/P100 concluído emQA:contraprestação não monetária total ou parcial
|
||||
|
||||
Implementação`9f053ac9`. **Um ramo,dois tratamentos**:`noncash_only`(valor normal,sem parte monetária expressamente confirmada) e`cash_and_noncash`(montante monetário recebido/a receber+valor normal dos bens/serviços dados em troca como contraprestação). FonteCIVA15(3)/(4),Lei13/2016PDF14/p1426(272),composição15(5)/(6);Lei22/2022PDF3mantém3–6 por remissão;Lei10/2025não altera15. Referenciar operação,contraprestação em bens/serviços,acordo,fundamento e âmbito do valor normal15(4):concorrência normal,fornecedor independente,mesmo estádio de comercialização,tempo/lugar da operação ou mais próximos e elementos15(5)na medida não incluídos. Documentos existentes/pressupostos expressos,sem avaliação automática,certificado,avaliador ou aprovador novo.
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,34 @@
|
||||
import {useState} from 'react';
|
||||
import {newCompositionBase,newCompositionPart,switchCompositionPart,compositionBook,compositionConditions,compositionCurrent,compositionReportRows,compositionBaseSource,compositionTreatments,recordCompositions,saveCompositionBook,type CompositionBook,type CompositionRow,type CompositionPart} from '@/lib/iva-composition-base';
|
||||
|
||||
export function SimulationCompositionBase({draft,onChange}:{draft:Record<string,unknown>;onChange:(field:string,value:string)=>void}){
|
||||
const[error,setError]=useState('');let book:CompositionBook;
|
||||
try{book=compositionBook(draft);}catch(cause){return<p role="alert">{String(cause)}</p>;}
|
||||
const save=(next:CompositionBook)=>{try{onChange('modelo_a_snapshot',saveCompositionBook(draft,next));setError('');}catch(cause){setError(String(cause));}};
|
||||
const change=(id:string,patch:Partial<CompositionRow>)=>save({...book,rows:book.rows.map(row=>row.id===id?{...row,...patch}:row)});
|
||||
return<details className="space-y-3 rounded border p-3">
|
||||
<summary>Base tributável — impostos e despesas acessórias da contraprestação</summary>
|
||||
<p>Oportunidade: {String(draft.context_opportunity||'entrada geral')}. Prepare uma composição por operação. Parta do montante sem próprio IVA e com as exclusões aplicáveis já consideradas. Identifique as parcelas e se já estão incluídas;acrescente apenas as que ainda não constam do montante inicial.</p>
|
||||
<p>Impostos,direitos,taxas e outras imposições excluem o próprio IVA. Nas despesas acessórias,confirme que são debitadas por conta do cliente e relativas a comissões,embalagem,transporte ou seguros. Respeite as regras especiais da operação,incluindo a exclusão da TC nos combustíveis. Base e IVA são resultados distintos.</p>
|
||||
<p>{compositionBaseSource}</p>{error&&<p role="alert">{error}</p>}
|
||||
<button type="button" className="underline" onClick={()=>save({...book,rows:[...book.rows,newCompositionBase(crypto.randomUUID(),String(draft.currency??''))]})}>Acrescentar composição de operação</button>
|
||||
{book.rows.map(row=>{const partChange=(id:string,patch:Partial<CompositionPart>)=>change(row.id,{parts:row.parts.map(p=>p.id===id?{...p,...patch}:p)});return<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>Natureza dos dados<select className="block rounded border p-2" value={row.origin} onChange={e=>change(row.id,{origin:e.target.value as CompositionRow['origin']})}><option value="projected">Projectados / pressupostos</option><option value="effective">Efectivos declarados</option></select></label>
|
||||
{([['description','Operação identificada'],['operationRef','Referência da operação / pressuposto'],['initialAmount','Montante inicial sem próprio IVA (moeda indicada)'],['initialRef','Referência do montante inicial e da sua composição'],['documentRef','Documento da operação / referência da previsão'],['documentDate','Data do documento / prevista'],['period','Mês da operação'],['currency','Moeda de origem'],['compositionRef','Referência da composição e exclusões aplicáveis'],['evidence','Fundamento factual / pressupostos']] as const).map(([field,label])=><label key={field}>{label}<input className="block rounded border p-2" type={field==='documentDate'?'date':field==='period'?'month':'text'} value={row[field]} onChange={e=>change(row.id,{[field]:e.target.value})}/></label>)}
|
||||
</div>
|
||||
<fieldset><legend>Condições da composição</legend>{compositionConditions.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}})}><option value="">Por indicar</option><option value="yes">Sim</option><option value="no">Não</option></select></label>)}</fieldset>
|
||||
<button type="button" className="underline" onClick={()=>change(row.id,{parts:[...row.parts,newCompositionPart(crypto.randomUUID())]})}>Acrescentar parcela desta operação</button>
|
||||
{row.parts.map(part=><fieldset key={part.id} className="rounded border p-3"><legend>{part.description||'Parcela por identificar'}</legend>
|
||||
<label>Natureza da parcela<select className="block rounded border p-2" value={part.treatment} onChange={e=>partChange(part.id,switchCompositionPart(part,e.target.value))}><option value="">Por indicar</option>{compositionTreatments.map(t=><option key={t.id} value={t.id}>{t.label}</option>)}</select></label>
|
||||
{([['description','Descrição da parcela'],['amount','Montante da parcela sem próprio IVA (moeda indicada)'],['reference','Referência da parcela / pressuposto']] as const).map(([field,label])=><label className="block" key={field}>{label}<input className="block rounded border p-2" value={part[field]} onChange={e=>partChange(part.id,{[field]:e.target.value})}/></label>)}
|
||||
<label>Esta parcela já está incluída no montante inicial?<select className="block rounded border p-2" value={part.included} onChange={e=>partChange(part.id,{included:e.target.value as CompositionPart['included']})}><option value="">Por indicar</option><option value="yes">Sim — conservar sem somar novamente</option><option value="no">Não — acrescentar uma vez</option></select></label>
|
||||
{part.treatment&&<label>{part.treatment==='tax_component'?'É imposto,direito,taxa ou outra imposição que integra esta contraprestação nos termos15(5)(a)?':'É despesa acessória debitada por conta do cliente,relativa a comissões,embalagem,transporte ou seguros nos termos15(5)(b)?'}<select className="block rounded border p-2" value={part.natureConfirmed} onChange={e=>partChange(part.id,{natureConfirmed:e.target.value as CompositionPart['natureConfirmed']})}><option value="">Por indicar</option><option value="yes">Sim</option><option value="no">Não</option></select></label>}
|
||||
<label>A parcela exclui o próprio IVA?<select className="block rounded border p-2" value={part.ownVatExcluded} onChange={e=>partChange(part.id,{ownVatExcluded:e.target.value as CompositionPart['ownVatExcluded']})}><option value="">Por indicar</option><option value="yes">Sim</option><option value="no">Não</option></select></label>
|
||||
<p>Mudar a natureza conserva os montantes e referências,mas exige rever a correspondência da parcela. Cada parcela será considerada uma única vez nesta operação.</p>
|
||||
</fieldset>)}
|
||||
</details>;})}
|
||||
{!!book.rows.length&&<button type="button" className="rounded bg-emerald-800 p-2 text-white" onClick={()=>{try{save(recordCompositions(draft,book));}catch(cause){setError(String(cause));}}}>Compor bases e guardar versão</button>}
|
||||
{book.result&&<><p role="status">{compositionCurrent(draft,book)?'Composições correspondentes às entradas guardadas.':'Entradas alteradas;composições históricas conservadas. Reveja e determine novamente.'} {book.history?.length??0} versões anteriores. IVA e campo11 não são preenchidos por estas bases.</p><dl>{compositionReportRows(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>;
|
||||
}
|
||||
@@ -11,6 +11,7 @@ import { SimulationCommissionBase } from './simulation-commission-base';
|
||||
import { SimulationActSaleBase } from './simulation-act-sale-base';
|
||||
import { SimulationFuelBase } from './simulation-fuel-base';
|
||||
import { SimulationNoncashBase } from './simulation-noncash-base';
|
||||
import { SimulationCompositionBase } from './simulation-composition-base';
|
||||
import { SimulationOfferPreparations } from './simulation-offer-preparations';
|
||||
import { SimulationOperations } from './simulation-operations';
|
||||
|
||||
@@ -100,6 +101,7 @@ export function SimulationMonthlyIva({draft, busy, onCalculate, onChange}: {
|
||||
<SimulationActSaleBase draft={draft} onChange={onChange} />
|
||||
<SimulationFuelBase draft={draft} onChange={onChange} />
|
||||
<SimulationNoncashBase draft={draft} onChange={onChange} />
|
||||
<SimulationCompositionBase draft={draft} onChange={onChange} />
|
||||
<SimulationOfferPreparations draft={draft} onChange={onChange} />
|
||||
<SimulationModeloA draft={draft} />
|
||||
</section>;
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
import {acquisitionScope,readAcquisitionStore} from './iva-acquisitions.ts';
|
||||
|
||||
export const compositionBaseVersion='consideration-composition-base/1';
|
||||
export const compositionBaseSource='CIVA republicado Lei13/2016,15(5)(a)/(b),PDF14/p1426(272):o valor tributável inclui impostos,direitos,taxas e outras imposições,excepto o próprioIVA;e despesas acessórias debitadas relativas a comissões,embalagem,transporte e seguros por conta do cliente. Respeitar regras especiais15(2) e exclusões15(6);não substitui a exclusãoTC emP095. Lei22/2022PDF3mantém15(5)por remissão;Lei10/2025não altera15. Recorte2026/MZN,composição da base apenas,sem incidência,taxas,IVA,dedução/campo11 ou totaisModeloA.';
|
||||
export const compositionTreatments=[{id:'tax_component',label:'Impostos,direitos,taxas ou outras imposições,excepto próprio IVA'},{id:'accessory_component',label:'Despesas acessórias debitadas por conta do cliente'}] as const;
|
||||
export const compositionConditions=[
|
||||
['taxableOperation','A operação sujeita a IVA e a contraprestação correspondente estão identificadas'],
|
||||
['initialNet','O montante inicial está identificado,sem próprio IVA e com as exclusões aplicáveis15(6)já consideradas; a referência explica a composição'],
|
||||
['completeComposition','As parcelas aplicáveis15(5)estão reconciliadas com o montante inicial,sem omissões ou dupla contagem'],
|
||||
['specialRules','Esta composição respeita a regra aplicável da operação,sem substituir bases especiais15(2),exclusões15(6)ou a exclusão da TC de combustíveis'],
|
||||
] as const;
|
||||
type Choice=''|'yes'|'no';type Condition=typeof compositionConditions[number][0];
|
||||
export type CompositionPart={id:string;treatment:string;description:string;amount:string;included:Choice;reference:string;natureConfirmed:Choice;ownVatExcluded:Choice};
|
||||
export type CompositionRow={id:string;description:string;period:string;origin:'projected'|'effective';currency:string;initialAmount:string;initialRef:string;operationRef:string;documentRef:string;documentDate:string;compositionRef:string;evidence:string;conditions:Partial<Record<Condition,Choice>>;parts:CompositionPart[]};
|
||||
type LineResult={id:string;status:'determined'|'not_applicable'|'indeterminate';baseAmount:string|null;vat:null;rate:null;reason:string};
|
||||
export type CompositionCalculation={version:string;revision:number;calculatedAt:string;opportunity:string;location:string;sourceKey:string;source:string;inputs:CompositionRow[];rows:LineResult[]};
|
||||
export type CompositionBook={rows:CompositionRow[];result?:CompositionCalculation;history?:CompositionCalculation[]};
|
||||
type Store=ReturnType<typeof readAcquisitionStore>&{considerationCompositions?:Record<string,CompositionBook>};
|
||||
export function newCompositionPart(id:string):CompositionPart{return{id,treatment:'',description:'',amount:'',included:'',reference:'',natureConfirmed:'',ownVatExcluded:''};}
|
||||
export function newCompositionBase(id:string,currency:string):CompositionRow{return{id,description:'',period:'',origin:'projected',currency,initialAmount:'',initialRef:'',operationRef:'',documentRef:'',documentDate:'',compositionRef:'',evidence:'',conditions:{},parts:[]};}
|
||||
export function switchCompositionPart(part:CompositionPart,treatment:string):CompositionPart{return{...part,treatment,natureConfirmed:''};}
|
||||
function readStore(draft:Record<string,unknown>):Store{
|
||||
const store=readAcquisitionStore(draft.modelo_a_snapshot) as Store;
|
||||
if(store.considerationCompositions!==undefined&&(!store.considerationCompositions||typeof store.considerationCompositions!=='object'||Array.isArray(store.considerationCompositions)))throw new Error('Composições não recuperáveis;originais preservados.');
|
||||
const fields=Object.keys(newCompositionBase('','')).filter(key=>!['conditions','parts'].includes(key));const partFields=Object.keys(newCompositionPart(''));
|
||||
for(const book of Object.values(store.considerationCompositions??{}))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 CompositionRow]!=='string')||!row.conditions||typeof row.conditions!=='object'||Array.isArray(row.conditions)||!Array.isArray(row.parts)||row.parts.some(part=>!part||partFields.some(key=>typeof part[key as keyof CompositionPart]!=='string'))))throw new Error('Linhas de composição não recuperáveis;originais preservados,sem substituição por lista vazia.');
|
||||
return store;
|
||||
}
|
||||
export function compositionBook(draft:Record<string,unknown>):CompositionBook{return readStore(draft).considerationCompositions?.[acquisitionScope(draft)]??{rows:[]};}
|
||||
export function saveCompositionBook(draft:Record<string,unknown>,book:CompositionBook):string{const current=readStore(draft),encoded=JSON.stringify({...current,considerationCompositions:{...current.considerationCompositions,[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/1000000n}.${(n%1000000n).toString().padStart(6,'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 evaluateComposition(row:CompositionRow,currency:unknown):LineResult{
|
||||
const result:LineResult={id:row.id,status:'indeterminate',baseAmount:null,vat:null,rate:null,reason:''};const stop=(reason:string,status:LineResult['status']='indeterminate')=>({...result,status,reason});
|
||||
if(currency!=='MZN'||row.currency!==currency)return stop('Moeda fora do âmbito MZN 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ês em2026 e dados efectivos declarados ou pressupostos de projecção.');
|
||||
const failed=compositionConditions.filter(([key])=>row.conditions[key]==='no');if(failed.length)return stop('Não se aplica esta composição: '+failed.map(([,label])=>label).join('; ')+'. Não é isenção nem IVA zero.','not_applicable');
|
||||
const missing=compositionConditions.filter(([key])=>row.conditions[key]!=='yes');if(missing.length)return stop('Condições por indicar: '+missing.map(([,label])=>label).join('; ')+'. Desconhecido não é zero.');
|
||||
if(!row.description.trim()||!row.initialRef.trim()||!row.operationRef.trim()||!row.documentRef.trim()||!row.compositionRef.trim()||!row.evidence.trim()||!validDate(row.documentDate))return stop('Identifique operação,montante inicial,documento/data,composição e fundamento ou pressupostos expressos;reutilize referências existentes,sem certificado/aprovador novo.');
|
||||
const initial=decimal(row.initialAmount);if(initial===null)return stop('Indique o montante inicial sem próprio IVA e com exclusões aplicáveis consideradas;desconhecido não é zero.');
|
||||
if(!row.parts.length||new Set(row.parts.map(p=>p.id)).size!==row.parts.length||row.parts.some(p=>!p.id.trim()))return stop('Identifique as parcelas desta operação com identificadores distintos;sem soma de linhas vazias ou duplicadas.');
|
||||
let additions=0n;const formulas:string[]=[];
|
||||
for(const part of row.parts){
|
||||
const rule=compositionTreatments.find(t=>t.id===part.treatment);if(!rule)return stop('Identifique a natureza de cada parcela:imposição excepto próprioIVA ou despesa acessória debitada por conta do cliente.');
|
||||
if(part.natureConfirmed==='no'||part.ownVatExcluded==='no')return stop('A parcela '+part.id+' não corresponde ao tratamento ou inclui próprioIVA;reveja a composição,não se transforma em exclusão/isenção automática.','not_applicable');
|
||||
if(part.natureConfirmed!=='yes'||part.ownVatExcluded!=='yes'||!['yes','no'].includes(part.included))return stop('Confirme a natureza,exclusão do próprioIVA e se a parcela '+part.id+' já está no montante inicial;desconhecido não permite presumir soma ou ausência.');
|
||||
if(!part.description.trim()||!part.reference.trim())return stop('Identifique descrição e referência da parcela '+part.id+',ou pressuposto expresso;sem novo documento obrigatório.');
|
||||
const amount=decimal(part.amount);if(amount===null)return stop('Indique o montante exacto da parcela '+part.id+';desconhecido não é zero.');
|
||||
if(part.included==='no')additions+=amount;
|
||||
formulas.push(`${part.id}:${rule.label},${money(amount)}MZN,${part.included==='yes'?'já incluída,sem segunda soma':'acrescida uma vez'}`);
|
||||
}
|
||||
const base=initial+additions;return{...result,status:'determined',baseAmount:money(base),reason:`Base15(5):montante inicial ${money(initial)} + parcelas ainda não incluídas ${money(additions)} = ${money(base)}MZN;${formulas.join('; ')},${row.origin==='projected'?'nas condições expressamente assumidas na projecção':'nos dados efectivos declarados'}. Base única por operação,não uma base por parcela. Base não é imposto;IVA/taxa,dedução/campo11 e totaisModeloA não são determinados por esta composição.`};
|
||||
}
|
||||
function key(draft:Record<string,unknown>,book:CompositionBook):string{return JSON.stringify({version:compositionBaseVersion,scope:acquisitionScope(draft),location:draft.selection_labels??{},currency:draft.currency,rows:book.rows});}
|
||||
export function compositionCurrent(draft:Record<string,unknown>,book:CompositionBook):boolean{return!!book.result&&book.result.sourceKey===key(draft,book);}
|
||||
export function recordCompositions(draft:Record<string,unknown>,book:CompositionBook):CompositionBook{
|
||||
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:CompositionCalculation={version:compositionBaseVersion,revision:(book.result?.revision??0)+1,calculatedAt:new Date().toISOString(),opportunity:acquisitionScope(draft),location:JSON.stringify(draft.selection_labels??{}),sourceKey:key(draft,book),source:compositionBaseSource,inputs:structuredClone(book.rows),rows:book.rows.map(row=>evaluateComposition(row,draft.currency))};
|
||||
const next={...book,result,history:[...(book.history??[]),...(book.result?[book.result]:[])]};saveCompositionBook(draft,next);return next;
|
||||
}
|
||||
export function compositionReportRows(draft:Record<string,unknown>):Array<[string,string,string,string]>{
|
||||
try{const book=compositionBook(draft),result=book.result;if(!result)return[];return result.inputs.map((row,index)=>['IVA mensal',`Base P101 — ${row.period} — ${row.id}`,`${row.description};base tributável: ${result.rows[index].baseAmount??'Indeterminada'} ${row.currency};IVA: Indeterminado;${result.rows[index].reason}`,`${result.opportunity};${result.location};${compositionCurrent(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.operationRef};montante inicial ${row.initialAmount} ${row.currency},referência ${row.initialRef};parcelas ${row.parts.map(p=>`${p.id}/${p.treatment},${p.description},${p.amount} ${row.currency},já incluída:${p.included==='yes'?'Sim':p.included==='no'?'Não':'Por indicar'},natureza:${p.natureConfirmed},sem próprioIVA:${p.ownVatExcluded},referência ${p.reference}`).join('; ')};composição ${row.compositionRef};documento ${row.documentRef},${row.documentDate};condições ${compositionConditions.map(([key,label])=>label+': '+(row.conditions[key]==='yes'?'Sim':row.conditions[key]==='no'?'Não':'Por indicar')).join('; ')};fundamento ${row.evidence};não preenche totaisModeloA ou campo11.`]);}
|
||||
catch{return[['IVA mensal','Composição da contraprestação','Dados não recuperáveis','Originais preservados;sem substituir por zero.']];}
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import { commissionBaseReportRows } from './iva-commission-base.ts';
|
||||
import { actSaleReportRows } from './iva-act-sale-base.ts';
|
||||
import { fuelBaseReportRows } from './iva-fuel-base.ts';
|
||||
import { noncashBaseReportRows } from './iva-noncash-base.ts';
|
||||
import { compositionReportRows } from './iva-composition-base.ts';
|
||||
import { offerPreparationReportRows } from './iva-offer-preparations.ts';
|
||||
import { salesReportRows } from './iva-operations.ts';
|
||||
import { fiscalQaRows } from './fiscal-qa-preview.ts';
|
||||
@@ -630,6 +631,7 @@ export function buildProjectDossierRows(
|
||||
rows.push(...actSaleReportRows(draft));
|
||||
rows.push(...fuelBaseReportRows(draft));
|
||||
rows.push(...noncashBaseReportRows(draft));
|
||||
rows.push(...compositionReportRows(draft));
|
||||
rows.push(...offerPreparationReportRows(draft));
|
||||
const operationRows = salesReportRows(draft);
|
||||
rows.push(...operationRows);
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
<?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 IvaCompositionBaseDraftTest extends TestCase
|
||||
{
|
||||
use DatabaseTransactions;
|
||||
|
||||
public function test_composition_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-g7f-bases.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:344', $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['considerationCompositions']['opportunity:344'];
|
||||
$this->assertCount(1, $book['rows']);
|
||||
$this->assertCount(2, $book['rows'][0]['parts']);
|
||||
$this->assertSame(['tax_component','accessory_component'], array_column($book['rows'][0]['parts'], 'treatment'));
|
||||
$this->assertSame(['1150.60'], array_column($book['result']['rows'], 'baseAmount'));
|
||||
$this->assertSame(['determined'], array_column($book['result']['rows'], 'status'));
|
||||
$this->assertSame([null], array_column($book['result']['rows'], 'vat'));
|
||||
$this->assertSame([null], array_column($book['result']['rows'], 'rate'));
|
||||
$this->assertSame('1000.25', $book['rows'][0]['initialAmount']);
|
||||
$this->assertSame(['100.10','50.25'], array_column($book['rows'][0]['parts'], 'amount'));
|
||||
$this->assertSame(['no','no'], array_column($book['rows'][0]['parts'], 'included'));
|
||||
$this->assertSame(['yes','yes'], array_column($book['rows'][0]['parts'], 'ownVatExcluded'));
|
||||
$this->assertStringContainsString('operação A', $book['rows'][0]['operationRef']);
|
||||
$this->assertStringContainsString('próprioIVA', $book['rows'][0]['initialRef']);
|
||||
$this->assertStringContainsString('referência tax_component', $book['rows'][0]['parts'][0]['reference']);
|
||||
$this->assertStringContainsString('cliente', $book['rows'][0]['parts'][1]['description']);
|
||||
$this->assertStringContainsString('15(5)', $book['result']['source']);
|
||||
$this->assertSame($book['rows'], $book['result']['inputs']);
|
||||
$this->assertCount(2, $book['history']);
|
||||
$this->assertNull($book['history'][0]['rows'][0]['baseAmount']);
|
||||
$frozen = json_decode(file_get_contents(base_path('tests/frontend/fixtures/iva-g7f-preserved-inputs.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, ['considerationCompositions' => 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-g7f-composition-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
@@ -0,0 +1,41 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import fs from 'node:fs';
|
||||
import {newCompositionBase,newCompositionPart,switchCompositionPart,compositionTreatments,compositionConditions,evaluateComposition,recordCompositions,saveCompositionBook,compositionBook,compositionCurrent,compositionReportRows} from '../../resources/js/lib/iva-composition-base.ts';
|
||||
import {noncashBaseCurrent} from '../../resources/js/lib/iva-noncash-base.ts';
|
||||
import {fuelBaseCurrent} from '../../resources/js/lib/iva-fuel-base.ts';
|
||||
import {createProjectDossierReport} from '../../resources/js/lib/project-dossier-report.ts';
|
||||
const frozen=JSON.parse(fs.readFileSync(new URL('./fixtures/iva-g7f-preserved-inputs.json',import.meta.url),'utf8'));
|
||||
const part=(treatment='tax_component',id=treatment)=>({...newCompositionPart(id),treatment,description:'SYNTHETIC QA '+(treatment==='tax_component'?'imposição A':'transporte por conta do cliente'),amount:treatment==='tax_component'?'100.10':'50.25',included:'no',reference:'SYNTHETIC QA referência '+id,natureConfirmed:'yes',ownVatExcluded:'yes'});
|
||||
const row=()=>({...newCompositionBase('g7f-operation-A','MZN'),description:'SYNTHETIC QA composição operação A',period:'2026-12',operationRef:'SYNTHETIC QA operação A',initialAmount:'1000.25',initialRef:'SYNTHETIC QA preço sem próprioIVA/exclusões15(6)consideradas',documentRef:'SYNTHETIC QA G7F documento A',documentDate:'2026-12-12',compositionRef:'SYNTHETIC QA parcelas A,B e montante inicial reconciliados,sem duplicação',evidence:'SYNTHETIC QA pressupostos expressos,não documento real',conditions:Object.fromEntries(compositionConditions.map(([key])=>[key,'yes'])),parts:compositionTreatments.map(t=>part(t.id))});
|
||||
const draft=()=>({...structuredClone(frozen),context_opportunity:'opportunity:344',project_title:'SYNTHETIC QA — G7F / Composição da contraprestação'});
|
||||
|
||||
test('P101 operation and each tax/accessory condition required;ownIVA or wrong nature not silently included',()=>{
|
||||
const input=row(),ok=evaluateComposition(input,'MZN');assert.equal(ok.baseAmount,'1150.60');assert.equal(ok.vat,null);assert.equal(ok.rate,null);
|
||||
for(const[key]of compositionConditions)for(const value of ['','unknown','no']){const r=evaluateComposition({...input,conditions:{...input.conditions,[key]:value}},'MZN');assert.equal(r.status,value==='no'?'not_applicable':'indeterminate');assert.equal(r.baseAmount,null);}
|
||||
for(const t of compositionTreatments)for(const key of ['natureConfirmed','ownVatExcluded'])for(const value of ['','unknown','no']){const p={...part(t.id),[key]:value},r=evaluateComposition({...input,parts:[p]},'MZN');assert.equal(r.status,value==='no'?'not_applicable':'indeterminate');assert.equal(r.baseAmount,null);assert.equal(r.vat,null);}
|
||||
for(const patch of [{description:''},{operationRef:''},{initialRef:''},{documentRef:''},{documentDate:'2026-02-30'},{compositionRef:''},{evidence:''},{period:'2025-12'},{currency:'USD'}])assert.equal(evaluateComposition({...input,...patch},'MZN').baseAmount,null);
|
||||
for(const patch of [{treatment:''},{description:''},{reference:''},{included:''},{included:'unknown'},{amount:''}])assert.equal(evaluateComposition({...input,parts:[{...part(),...patch}]},'MZN').baseAmount,null);
|
||||
});
|
||||
|
||||
test('single operation base adds missing components only;alreadyincluded does not doublecount;exactdecimal and preserved edits',()=>{
|
||||
const input=row();for(const[parts,expected]of [[[part('tax_component')],'1100.35'],[[part('accessory_component')],'1050.50'],[[{...part(),included:'yes'},part('accessory_component')],'1050.50'],[input.parts.map(p=>({...p,included:'yes'})),'1000.25']])assert.equal(evaluateComposition({...input,parts},'MZN').baseAmount,expected);
|
||||
assert.equal(evaluateComposition({...input,initialAmount:'0',parts:[{...part(),amount:'0'}]},'MZN').baseAmount,'0.00');assert.equal(evaluateComposition({...input,initialAmount:'1.000002',parts:[{...part(),amount:'0.000001'}]},'MZN').baseAmount,'1.000003');assert.equal(evaluateComposition({...input,initialAmount:'999999999999999.999999',parts:[{...part(),amount:'999999999999999.999999'}]},'MZN').baseAmount,'1999999999999999.999998');
|
||||
for(const amount of ['-1','NaN','0.0000001',''])assert.equal(evaluateComposition({...input,parts:[{...part(),amount}]},'MZN').baseAmount,null);assert.equal(evaluateComposition({...input,initialAmount:''},'MZN').baseAmount,null);
|
||||
const switched=switchCompositionPart(part(),'accessory_component');assert.equal(switched.natureConfirmed,'');assert.equal(switched.amount,'100.10');assert.equal(switched.reference,part().reference);assert.equal(evaluateComposition({...input,parts:[switched]},'MZN').baseAmount,null);
|
||||
assert.equal(evaluateComposition({...input,parts:[]},'MZN').baseAmount,null);assert.equal(evaluateComposition({...input,parts:[part(),part()]},'MZN').baseAmount,null);
|
||||
});
|
||||
|
||||
test('save/recovery/history/report keep one base peroperation and all83 previous books/currentkeys unchanged',()=>{
|
||||
const d=draft(),prior=JSON.parse(d.modelo_a_snapshot);assert.deepEqual(compositionBook(d),{rows:[]});assert.deepEqual(compositionReportRows(d),[]);
|
||||
let book=recordCompositions(d,{rows:[{...row(),conditions:{}}]});book=recordCompositions(d,{...book,rows:[{...row(),parts:[{...part(),ownVatExcluded:'no'}]}]});book=recordCompositions(d,{...book,rows:[row()]});assert.equal(book.history.length,2);assert.ok(book.history.every(h=>h.rows.every(r=>r.baseAmount===null&&r.vat===null)));assert.ok(compositionCurrent(d,book));assert.equal(book.result.rows.length,1);assert.equal(book.result.inputs[0].parts.length,2);
|
||||
for(const field of ['amount','included','reference','treatment'])assert.ok(!compositionCurrent(d,{...book,rows:book.rows.map(r=>({...r,parts:r.parts.map(p=>({...p,[field]:'changed'}))}))}));for(const patch of [{context_opportunity:'opportunity:345'},{currency:'USD'},{selection_labels:{province_id:'Maputo'}}])assert.ok(!compositionCurrent({...d,...patch},book));
|
||||
d.modelo_a_snapshot=saveCompositionBook(d,book);assert.deepEqual(compositionBook(JSON.parse(JSON.stringify(d))),book);const next=JSON.parse(d.modelo_a_snapshot);const{considerationCompositions,...untouched}=next;assert.deepEqual(untouched,prior);for(const[scope,previous]of Object.entries(prior.noncashBases))assert.ok(noncashBaseCurrent({...d,context_opportunity:scope},previous));for(const[scope,previous]of Object.entries(prior.regulatedFuelBases))assert.ok(fuelBaseCurrent({...d,context_opportunity:scope},previous));
|
||||
assert.equal(next.noncashBases['opportunity:343'].result.rows[1].baseAmount,'2700.75');assert.equal(next.regulatedFuelBases['opportunity:342'].result.rows[0].baseAmount,'1400.15');assert.equal(next.regulatedFuelBases['opportunity:342'].result.rows[1].baseAmount,'1500.25');assert.equal(next.importExemptions['opportunity:338'].result.rows[1].importVat,'400.00');assert.equal(next.books['opportunity:329'].result.periods[0].fields['11'],null);
|
||||
const report=JSON.stringify(createProjectDossierReport(d,{selectedSections:new Set(['finance']),version:'QA G7F'}));for(const token of ['Base P101','1150.60','IVA: Indeterminado','opportunity:344','Manica','2026-12','operação A','15(5)','100.10','50.25','accessory_component','campo11'])assert.ok(report.includes(token),token);assert.equal(compositionReportRows(d).length,1);assert.deepEqual(compositionReportRows({...d,context_opportunity:'opportunity:345'}),[]);
|
||||
if(process.env.IVA_G7F_CALCULATED)fs.writeFileSync(process.env.IVA_G7F_CALCULATED,JSON.stringify(d));
|
||||
});
|
||||
|
||||
test('corrupt nested components/store cannot overwrite originals;duplicate operation ids cannot be recorded',()=>{
|
||||
const d=draft(),original=d.modelo_a_snapshot;for(const patch of [{initialAmount:4},{conditions:[]},{parts:{}},{parts:[{...part(),amount:4}]},{parts:[null]}])assert.throws(()=>saveCompositionBook(d,{rows:[{...row(),...patch}]}),/originais preservados/);assert.equal(d.modelo_a_snapshot,original);assert.throws(()=>recordCompositions(d,{rows:[row(),row()]}),/distintos/);assert.throws(()=>recordCompositions(d,{rows:[]}),/distintos/);assert.throws(()=>compositionBook({...d,modelo_a_snapshot:JSON.stringify({...JSON.parse(original),considerationCompositions:[]})}),/originais preservados/);
|
||||
});
|
||||
Reference in New Issue
Block a user