Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cd530b248b | ||
|
|
2087134143 | ||
|
|
67b8b58149 | ||
|
|
adb849d4fc |
@@ -18097,5 +18097,318 @@
|
||||
},
|
||||
"base_VAT_separation": "Accepted QA reused:initial netamount plus onlynotalreadyincluded tax/accessorycomponents;onebase peroperation,no doublecounting or ownVAT. Nestedcomponentnature/amount/inclusion/references,immutableinputs/history/report retained;specialbases and exclusions respected. 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_g7g_P102_homologation_20261024": {
|
||||
"status": "installed_delta_verified_partial_L1",
|
||||
"candidate": "9c2b2c6560062fcc261b27731cf9726276510d47",
|
||||
"base_installed": "7e5710ebbd235f9478f149f8470a238c9e66ea9e",
|
||||
"coverage_complete_branches": {
|
||||
"AUD-SIM-L1-P102": [
|
||||
"judicial_indemnity",
|
||||
"granted_discount",
|
||||
"third_party_payment",
|
||||
"returnable_packaging"
|
||||
]
|
||||
},
|
||||
"branch_count_complete": 1,
|
||||
"treatment_count": 4,
|
||||
"runtime_delta": [
|
||||
{
|
||||
"path": "resources/js/lib/iva-exclusion-base.ts",
|
||||
"sha256_LF": "2d4d2f607eb4e24e617a5640b239d14ab4958e364cc6f3cda36a407b8b1d782f"
|
||||
},
|
||||
{
|
||||
"path": "resources/js/components/simulation-exclusion-base.tsx",
|
||||
"sha256_LF": "4c69345d9e49c96756727cbf909bf1d5949fa9db14c346157413dd1885258520"
|
||||
},
|
||||
{
|
||||
"path": "resources/js/components/simulation-monthly-iva.tsx",
|
||||
"sha256_LF": "81be9e69aeab5d544a2fb8aadcf487bb6f04ae0ab06861759709912afe9c82bf"
|
||||
},
|
||||
{
|
||||
"path": "resources/js/lib/project-dossier.ts",
|
||||
"sha256_LF": "af10643db841e08f14a9ef534ccf7367fe5b05e20c58b770e3a4cf51aa0192e8"
|
||||
}
|
||||
],
|
||||
"counts_before": {
|
||||
"delivered": 84,
|
||||
"QA": 1,
|
||||
"functional_pending": 47,
|
||||
"documentary": 1,
|
||||
"total": 133
|
||||
},
|
||||
"counts_current": {
|
||||
"delivered": 85,
|
||||
"QA": 0,
|
||||
"functional_pending": 47,
|
||||
"documentary": 1,
|
||||
"total": 133
|
||||
},
|
||||
"counts_after_delivery": {
|
||||
"delivered": 85,
|
||||
"QA": 0,
|
||||
"functional_pending": 47,
|
||||
"documentary": 1,
|
||||
"total": 133
|
||||
},
|
||||
"QA_proofs_reused": [
|
||||
"iva-l1-g7g-qa-20261024.json"
|
||||
],
|
||||
"authorization": "Tempo explicitly deploy9c2b2c65 through existingGit,preserve concurrentchanges and check installeddelta only;four treatments sameP102branch,ownconditions and no double subtraction",
|
||||
"scope": "2026/MZN,P102baseonly;no IVA/incidence/rate/deduction/field11/regularisations/ModeloAtotals. No automaticlegaldecision orpriorperiodposting. Packagingrequiresagreedreturnmention,notactualreturn. Unknownconditions/amount/inclusion indeterminate;failedcondition yields notapplicable,notzero;exclusionsexceedinginitialamount notnegative/flooredzero.",
|
||||
"meaning": "Four exclusions:judicial indemnity for total/partial contractbreach;granteddiscount/abatement/bonus;payment inname/onaccount of purchaser/recipient recorded inappropriate thirdpartyaccounts;packaging notactuallytransacted withseparateinvoiceindication/express agreedreturnmention.",
|
||||
"formula": "initialamount netofownVAT with15(5)inclusions minus only exclusions stillincluded;alreadyexcluded retained without secondsubtraction",
|
||||
"preservation": "84priorclosures 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-g7g-readonly-rollback-20261024.patch,checked only,not applied;blocks newP102calculations only,preserves readers/history/otherbranches",
|
||||
"authenticated_preflight": {
|
||||
"installed": {
|
||||
"status": "installed",
|
||||
"commit": "7e5710ebbd235f9478f149f8470a238c9e66ea9e",
|
||||
"release": "/var/www/investmoz-homologacao/releases/7e5710ebbd235f9478f149f8470a238c9e66ea9e-8bf3c724",
|
||||
"previous_release": "/var/www/investmoz-homologacao/releases/70b4a640ee5f790f8e6a089d157456ff437e336d-c95636fc",
|
||||
"database_migrations": 0,
|
||||
"content_imports": 0
|
||||
},
|
||||
"current_link": "/var/www/investmoz-homologacao/releases/7e5710ebbd235f9478f149f8470a238c9e66ea9e-8bf3c724",
|
||||
"release_revision": {
|
||||
"commit": "7e5710ebbd235f9478f149f8470a238c9e66ea9e",
|
||||
"branch": "main",
|
||||
"built_at": "2026-10-24T20:54:47.716763+00:00",
|
||||
"manifest_sha256": "bb782ee252ff461e8c53287876736b77f7851f7a5f23c7f12ff84aa8a23dd611"
|
||||
},
|
||||
"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-g7g-delivery-20261024/backup",
|
||||
"target": {
|
||||
"database": "teste_investidor",
|
||||
"port": 5432
|
||||
},
|
||||
"tables": 174,
|
||||
"files_verified": 369,
|
||||
"dump_sha256": "4eafcef8350b4a486b4306b675bc71ed89961f43ab56aa49a9751982d7a8d9b5",
|
||||
"files_sha256": "abc18ef93cfbd7b266b08cb8c7fcc5f048eae33c74e5bce0fa19c3e9ba25469e",
|
||||
"restore_verified": false
|
||||
},
|
||||
"restore": {
|
||||
"restore_verified": true,
|
||||
"tables_verified": 174,
|
||||
"container_network": "none",
|
||||
"database": "l1_g7g_restore_20261024",
|
||||
"port": 55441,
|
||||
"source_dump_sha256": "4eafcef8350b4a486b4306b675bc71ed89961f43ab56aa49a9751982d7a8d9b5",
|
||||
"active_database_writes": 0
|
||||
}
|
||||
},
|
||||
"served_commit": "5d5f3b414866969e4b2d38376402b8f264c6d19c",
|
||||
"installation": {
|
||||
"protected": {
|
||||
"installed": {
|
||||
"status": "installed",
|
||||
"commit": "5d5f3b414866969e4b2d38376402b8f264c6d19c",
|
||||
"release": "/var/www/investmoz-homologacao/releases/5d5f3b414866969e4b2d38376402b8f264c6d19c-7453aad9",
|
||||
"previous_release": "/var/www/investmoz-homologacao/releases/7e5710ebbd235f9478f149f8470a238c9e66ea9e-8bf3c724",
|
||||
"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": "1d5e3ec2a5dba626144c3527b18e0e65"
|
||||
},
|
||||
"after": {
|
||||
"rows": 106,
|
||||
"checksum": "3b79bad8f86095c2b11c82425ce8a63c"
|
||||
}
|
||||
},
|
||||
"sessions": {
|
||||
"before": {
|
||||
"rows": 71,
|
||||
"checksum": "3738e4ce15d39c7ac152c3045dc1c11f"
|
||||
},
|
||||
"after": {
|
||||
"rows": 73,
|
||||
"checksum": "901a2e2d485d58ea01f02b2e1887cf0e"
|
||||
}
|
||||
}
|
||||
},
|
||||
"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": "5d5f3b414866969e4b2d38376402b8f264c6d19c",
|
||||
"branch": "main",
|
||||
"built_at": "2026-10-24T21:06:06.620815+00:00",
|
||||
"manifest_sha256": "640a7390e644ff6efdf891439786a7b1783553d805cf71ccb6e6d488ed7196e8"
|
||||
},
|
||||
"manifest_hash_matches": true,
|
||||
"compiled_delta_markers": {
|
||||
"consideration-exclusions-base/1": [
|
||||
"assets/project-dossier-N7veALmJ.js"
|
||||
],
|
||||
"judicial_indemnity": [
|
||||
"assets/project-dossier-N7veALmJ.js"
|
||||
],
|
||||
"granted_discount": [
|
||||
"assets/project-dossier-N7veALmJ.js"
|
||||
],
|
||||
"third_party_payment": [
|
||||
"assets/services-Bum8CrDQ.js",
|
||||
"assets/project-dossier-N7veALmJ.js"
|
||||
],
|
||||
"returnable_packaging": [
|
||||
"assets/services-Bum8CrDQ.js",
|
||||
"assets/project-dossier-N7veALmJ.js"
|
||||
],
|
||||
"considerationExclusions": [
|
||||
"assets/project-dossier-N7veALmJ.js"
|
||||
],
|
||||
"judicialDeclaration": [
|
||||
"assets/project-dossier-N7veALmJ.js"
|
||||
],
|
||||
"contractBreach": [
|
||||
"assets/project-dossier-N7veALmJ.js"
|
||||
],
|
||||
"thirdPartyAccounts": [
|
||||
"assets/project-dossier-N7veALmJ.js"
|
||||
],
|
||||
"returnMention": [
|
||||
"assets/project-dossier-N7veALmJ.js"
|
||||
],
|
||||
"separateIndication": [
|
||||
"assets/project-dossier-N7veALmJ.js"
|
||||
],
|
||||
"accountRef": [
|
||||
"assets/services-Bum8CrDQ.js",
|
||||
"assets/project-dossier-N7veALmJ.js"
|
||||
],
|
||||
"beneficiaryRef": [
|
||||
"assets/services-Bum8CrDQ.js",
|
||||
"assets/project-dossier-N7veALmJ.js"
|
||||
],
|
||||
"documentExcerpt": [
|
||||
"assets/services-Bum8CrDQ.js",
|
||||
"assets/project-dossier-N7veALmJ.js"
|
||||
],
|
||||
"included": [
|
||||
"assets/services-Bum8CrDQ.js",
|
||||
"assets/project-dossier-N7veALmJ.js"
|
||||
],
|
||||
"IVA: Indeterminado": [
|
||||
"assets/project-dossier-N7veALmJ.js"
|
||||
]
|
||||
},
|
||||
"assets": [
|
||||
{
|
||||
"file": "assets/services-Bum8CrDQ.js",
|
||||
"status": 200,
|
||||
"sha256": "2333ebe00e8e446bc3721eb76a5b7a34c80bc3e64789bbaf0e488f16f13adb1e"
|
||||
},
|
||||
{
|
||||
"file": "assets/simulation-form-CPZAFZU3.js",
|
||||
"status": 200,
|
||||
"sha256": "c6bcf64e60a5eeac0cafe3dc055dc5544162f21942ee08b34d51bc6d52947567"
|
||||
},
|
||||
{
|
||||
"file": "assets/project-dossier-document-CJyannat.js",
|
||||
"status": 200,
|
||||
"sha256": "cece8886f730ac17191b912bc840bde193d0ea377a056c5adb5476a16a66c88e"
|
||||
},
|
||||
{
|
||||
"file": "assets/project-dossier-N7veALmJ.js",
|
||||
"status": 200,
|
||||
"sha256": "77a3cd4693091ea6979bf10129036e592f7e26eaf9edc573081f9f3e6240c4c5"
|
||||
}
|
||||
],
|
||||
"simulator_status": 200,
|
||||
"simulator_entry": "assets/app-DjGpWTrb.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": "5d5f3b414866969e4b2d38376402b8f264c6d19c",
|
||||
"release": "/var/www/investmoz-homologacao/releases/5d5f3b414866969e4b2d38376402b8f264c6d19c-7453aad9",
|
||||
"previous_release": "/var/www/investmoz-homologacao/releases/7e5710ebbd235f9478f149f8470a238c9e66ea9e-8bf3c724",
|
||||
"database_migrations": 0,
|
||||
"content_imports": 0
|
||||
},
|
||||
"latest_report": {
|
||||
"status": "installed",
|
||||
"commit": "5d5f3b414866969e4b2d38376402b8f264c6d19c",
|
||||
"release": "/var/www/investmoz-homologacao/releases/5d5f3b414866969e4b2d38376402b8f264c6d19c-7453aad9",
|
||||
"previous_release": "/var/www/investmoz-homologacao/releases/7e5710ebbd235f9478f149f8470a238c9e66ea9e-8bf3c724",
|
||||
"database_migrations": 0,
|
||||
"content_imports": 0,
|
||||
"requested_commits": [
|
||||
"5d5f3b414866969e4b2d38376402b8f264c6d19c"
|
||||
],
|
||||
"finished_at": "2026-10-24T21:06:09.473849+00:00"
|
||||
},
|
||||
"log_file": "1792875866291395065.log",
|
||||
"summaries": [
|
||||
"OK (1 test, 3106 assertions)",
|
||||
"built in 26.50s",
|
||||
"OK (59 tests, 317 assertions)",
|
||||
"# tests 370",
|
||||
"# pass 370",
|
||||
"# fail 0"
|
||||
],
|
||||
"log_bytes": 136776
|
||||
},
|
||||
"rollback_executed": false
|
||||
},
|
||||
"base_VAT_separation": "Accepted QA reused:four exclusiontreatments withownconditions;initialnetamount minus onlystillincluded exclusions,alreadyexcluded notsubtractedagain. Judicial/contract/grant/accounts/recipient/packaginginvoice references/scope andimmutableinputs/history/report retained. Base independent of VAT/rate(alwaysnull),no deduction/regularisation inferred. 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": "acc633bf088c66042a8442d356076bdbb508ac53",
|
||||
"status": "QA_complete_not_delivered",
|
||||
"status": "delivered_with_QA_proofs_preserved",
|
||||
"coverage": {
|
||||
"AUD-SIM-L1-P102": [
|
||||
"judicial_indemnity",
|
||||
@@ -152,5 +152,18 @@
|
||||
"homologation_unchanged": "7e5710eb",
|
||||
"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-g7g-exclusions-20261024\\source-archive-inventory.json"
|
||||
"sources_inventory": "C:\\laragon\\www\\portal-investidor\\outputs\\iva-l1-g7g-exclusions-20261024\\source-archive-inventory.json",
|
||||
"qa_status_preserved": "QA_complete_not_delivered",
|
||||
"delivery_followup": {
|
||||
"served_commit": "5d5f3b414866969e4b2d38376402b8f264c6d19c",
|
||||
"receipt": "l1-g7g-delivery-20261024.json",
|
||||
"record": "iva_l1_g7g_P102_homologation_20261024",
|
||||
"counts": {
|
||||
"delivered": 85,
|
||||
"QA": 0,
|
||||
"functional_pending": 47,
|
||||
"documentary": 1,
|
||||
"total": 133
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,158 @@
|
||||
{
|
||||
"implementation_commit": "67b8b5814955ebce761b2123969958c9f2c8bf0f",
|
||||
"status": "QA_complete_not_delivered",
|
||||
"coverage": {
|
||||
"AUD-SIM-L1-P103": [
|
||||
"price_comparison",
|
||||
"referenced_correction"
|
||||
]
|
||||
},
|
||||
"branch_count": 1,
|
||||
"treatment_count": 2,
|
||||
"source": "CIVA15(7),2016PDF14/p1426(272),15(1)/(5)/(6);2022PDF3maintains15(7);2025doesnotamend15;2017rectificationdoesnotamend15(7).",
|
||||
"meaning": "AT may correct consideration below current/normal factorygate/wholesale/retail/serviceprice,considering natureoftransmission. Comparison doesnot exerciseATpower or automaticallysubstitute referenceprice. Recordedcorrection in effective declareddata or expresslyconditional projectedscenario retains ownamount/ref/date/scope.",
|
||||
"formula": {
|
||||
"price_comparison": "compare exactdeclared/reference values;retain declaredbase withoutautomaticcorrection",
|
||||
"referenced_correction": "if15(7)belowtrigger andscopeconfirmed,use explicitlyreferenced correctedamount;no max/defaultreference"
|
||||
},
|
||||
"technical_choices": "New valueReviews opportunity-scoped book in existingmodelo_a_snapshot/API/dossier;exactdecimal up to6fractiondigits,no assumedrounding. Context/percourse/origin changes preserve values/references butclear affected confirmation;projected→effective cannotreuse assumedcorrectionconfirmation. No newcertificates/appraisers/approvers. Currentkeys/history/immutableinputs/report retained.",
|
||||
"scope": "2026/MZN,P103baseonly;no automaticvaluation/legalcorrection,incidence/rate/VAT/deduction/field11/regularisation/ModeloAtotals oractiveauthorityaction. Referencecontext/scope and equivalentcomposition required. Unknowncorrectionamount notdefaultreference;no inventedfloor/maximum. Projectedcorrection clearlyconditional,notATdecision. Notbelowdoesnotdemonstrate15(7)trigger.",
|
||||
"verification": {
|
||||
"frontend": {
|
||||
"tests": 4,
|
||||
"passed": 4,
|
||||
"failed": 0,
|
||||
"scope": "Allfourpricecontexts;ownconditions/references;below/equal/above;no automaticreference substitution;correctionamount/ref/date/scope/application;projected/effective distinction;exactdecimal/zero;context/percourse/originswitch retention/clearedconfirmation;oldbooks/currentkeys/history/report;corruptwriteguard"
|
||||
},
|
||||
"privateAPI": {
|
||||
"tests": 1,
|
||||
"assertions": 33,
|
||||
"target": "simulator_fiscal_delta_20261021_test:55441",
|
||||
"transaction_rollback": true,
|
||||
"xml": "C:\\laragon\\www\\portal-investidor\\outputs\\iva-l1-g7h-value-review-20261024\\api-tests.xml"
|
||||
},
|
||||
"types": "passed",
|
||||
"build": "passed,existing plugin timing warnings",
|
||||
"UI": "Realcomponent Edge/CUA:pricereference/missingcorrectedamount indeterminate;comparisonbelow retains1000.25 against1500.50;projected→effective clearsapplicationconfirmation;outofscope no preventsapplication;returnprojected/confirmed producesconditional1400.75,not1500.50. Save/recover/report2rows+5priorversions,VATnull. SyntheticQA,notmanualTempoacceptance.",
|
||||
"UI_screenshot": "C:\\laragon\\www\\portal-investidor\\outputs\\iva-l1-g7h-value-review-20261024\\qa-recovered-report.png"
|
||||
},
|
||||
"preservation": {
|
||||
"base": "adb849d4fc6d840eec1123e8fc90c4c34a008da4",
|
||||
"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",
|
||||
"AUD-SIM-L1-P101",
|
||||
"AUD-SIM-L1-P102"
|
||||
],
|
||||
"confirmed_losses": [],
|
||||
"accepted_delivery": "5d5f3b41/adb849d4;174tables/369files;29published/28relations/408geometries;code/schema/data/config/permissions compared at delivery",
|
||||
"frozen": "tests\\frontend\\fixtures\\iva-g7h-preserved-inputs.json",
|
||||
"sha256": "d2e25976ee432238fa90791db01c124f24c0cfb805e213af73d4c7dab4f25f31",
|
||||
"counts_before": {
|
||||
"delivered": 85,
|
||||
"QA": 0,
|
||||
"functional_pending": 47,
|
||||
"P001": 1,
|
||||
"total": 133
|
||||
},
|
||||
"scope": "P103only;allpreviousbooks immutable including P102/P101/P100/P095/P060/P050/partialP084P085;no active query/write"
|
||||
},
|
||||
"runtime_delta": {
|
||||
"resources/js/lib/iva-value-review.ts": "411aa0506868afd112bac0e27571db1978b21bd8375051dc36abbe55dfad7876",
|
||||
"resources/js/components/simulation-value-review.tsx": "ff3fc2ad0e0082a931341ae51b63d6abe2bfee00b90e5891fc4dce742e84a017",
|
||||
"resources/js/components/simulation-monthly-iva.tsx": "c7f6a45a8533f6ce4128c912511b7712011fc365b99dfbe675d6cb2b455dfca1",
|
||||
"resources/js/lib/project-dossier.ts": "89ee4a4abfa36c4d159edd71c936d718e2a6e99c9c8a83be669451fb309c5d2c"
|
||||
},
|
||||
"counts_current": {
|
||||
"delivered": 85,
|
||||
"QA": 1,
|
||||
"functional_pending": 46,
|
||||
"P001": 1,
|
||||
"total": 133
|
||||
},
|
||||
"homologation_unchanged": "5d5f3b41",
|
||||
"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-g7h-value-review-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": "9c2b2c6560062fcc261b27731cf9726276510d47",
|
||||
"base_installed": "7e5710ebbd235f9478f149f8470a238c9e66ea9e",
|
||||
"coverage_complete_branches": {
|
||||
@@ -38,8 +38,8 @@
|
||||
"total": 133
|
||||
},
|
||||
"counts_current": {
|
||||
"delivered": 84,
|
||||
"QA": 1,
|
||||
"delivered": 85,
|
||||
"QA": 0,
|
||||
"functional_pending": 47,
|
||||
"documentary": 1,
|
||||
"total": 133
|
||||
@@ -126,5 +126,188 @@
|
||||
"source_dump_sha256": "4eafcef8350b4a486b4306b675bc71ed89961f43ab56aa49a9751982d7a8d9b5",
|
||||
"active_database_writes": 0
|
||||
}
|
||||
}
|
||||
},
|
||||
"served_commit": "5d5f3b414866969e4b2d38376402b8f264c6d19c",
|
||||
"installation": {
|
||||
"protected": {
|
||||
"installed": {
|
||||
"status": "installed",
|
||||
"commit": "5d5f3b414866969e4b2d38376402b8f264c6d19c",
|
||||
"release": "/var/www/investmoz-homologacao/releases/5d5f3b414866969e4b2d38376402b8f264c6d19c-7453aad9",
|
||||
"previous_release": "/var/www/investmoz-homologacao/releases/7e5710ebbd235f9478f149f8470a238c9e66ea9e-8bf3c724",
|
||||
"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": "1d5e3ec2a5dba626144c3527b18e0e65"
|
||||
},
|
||||
"after": {
|
||||
"rows": 106,
|
||||
"checksum": "3b79bad8f86095c2b11c82425ce8a63c"
|
||||
}
|
||||
},
|
||||
"sessions": {
|
||||
"before": {
|
||||
"rows": 71,
|
||||
"checksum": "3738e4ce15d39c7ac152c3045dc1c11f"
|
||||
},
|
||||
"after": {
|
||||
"rows": 73,
|
||||
"checksum": "901a2e2d485d58ea01f02b2e1887cf0e"
|
||||
}
|
||||
}
|
||||
},
|
||||
"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": "5d5f3b414866969e4b2d38376402b8f264c6d19c",
|
||||
"branch": "main",
|
||||
"built_at": "2026-10-24T21:06:06.620815+00:00",
|
||||
"manifest_sha256": "640a7390e644ff6efdf891439786a7b1783553d805cf71ccb6e6d488ed7196e8"
|
||||
},
|
||||
"manifest_hash_matches": true,
|
||||
"compiled_delta_markers": {
|
||||
"consideration-exclusions-base/1": [
|
||||
"assets/project-dossier-N7veALmJ.js"
|
||||
],
|
||||
"judicial_indemnity": [
|
||||
"assets/project-dossier-N7veALmJ.js"
|
||||
],
|
||||
"granted_discount": [
|
||||
"assets/project-dossier-N7veALmJ.js"
|
||||
],
|
||||
"third_party_payment": [
|
||||
"assets/services-Bum8CrDQ.js",
|
||||
"assets/project-dossier-N7veALmJ.js"
|
||||
],
|
||||
"returnable_packaging": [
|
||||
"assets/services-Bum8CrDQ.js",
|
||||
"assets/project-dossier-N7veALmJ.js"
|
||||
],
|
||||
"considerationExclusions": [
|
||||
"assets/project-dossier-N7veALmJ.js"
|
||||
],
|
||||
"judicialDeclaration": [
|
||||
"assets/project-dossier-N7veALmJ.js"
|
||||
],
|
||||
"contractBreach": [
|
||||
"assets/project-dossier-N7veALmJ.js"
|
||||
],
|
||||
"thirdPartyAccounts": [
|
||||
"assets/project-dossier-N7veALmJ.js"
|
||||
],
|
||||
"returnMention": [
|
||||
"assets/project-dossier-N7veALmJ.js"
|
||||
],
|
||||
"separateIndication": [
|
||||
"assets/project-dossier-N7veALmJ.js"
|
||||
],
|
||||
"accountRef": [
|
||||
"assets/services-Bum8CrDQ.js",
|
||||
"assets/project-dossier-N7veALmJ.js"
|
||||
],
|
||||
"beneficiaryRef": [
|
||||
"assets/services-Bum8CrDQ.js",
|
||||
"assets/project-dossier-N7veALmJ.js"
|
||||
],
|
||||
"documentExcerpt": [
|
||||
"assets/services-Bum8CrDQ.js",
|
||||
"assets/project-dossier-N7veALmJ.js"
|
||||
],
|
||||
"included": [
|
||||
"assets/services-Bum8CrDQ.js",
|
||||
"assets/project-dossier-N7veALmJ.js"
|
||||
],
|
||||
"IVA: Indeterminado": [
|
||||
"assets/project-dossier-N7veALmJ.js"
|
||||
]
|
||||
},
|
||||
"assets": [
|
||||
{
|
||||
"file": "assets/services-Bum8CrDQ.js",
|
||||
"status": 200,
|
||||
"sha256": "2333ebe00e8e446bc3721eb76a5b7a34c80bc3e64789bbaf0e488f16f13adb1e"
|
||||
},
|
||||
{
|
||||
"file": "assets/simulation-form-CPZAFZU3.js",
|
||||
"status": 200,
|
||||
"sha256": "c6bcf64e60a5eeac0cafe3dc055dc5544162f21942ee08b34d51bc6d52947567"
|
||||
},
|
||||
{
|
||||
"file": "assets/project-dossier-document-CJyannat.js",
|
||||
"status": 200,
|
||||
"sha256": "cece8886f730ac17191b912bc840bde193d0ea377a056c5adb5476a16a66c88e"
|
||||
},
|
||||
{
|
||||
"file": "assets/project-dossier-N7veALmJ.js",
|
||||
"status": 200,
|
||||
"sha256": "77a3cd4693091ea6979bf10129036e592f7e26eaf9edc573081f9f3e6240c4c5"
|
||||
}
|
||||
],
|
||||
"simulator_status": 200,
|
||||
"simulator_entry": "assets/app-DjGpWTrb.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": "5d5f3b414866969e4b2d38376402b8f264c6d19c",
|
||||
"release": "/var/www/investmoz-homologacao/releases/5d5f3b414866969e4b2d38376402b8f264c6d19c-7453aad9",
|
||||
"previous_release": "/var/www/investmoz-homologacao/releases/7e5710ebbd235f9478f149f8470a238c9e66ea9e-8bf3c724",
|
||||
"database_migrations": 0,
|
||||
"content_imports": 0
|
||||
},
|
||||
"latest_report": {
|
||||
"status": "installed",
|
||||
"commit": "5d5f3b414866969e4b2d38376402b8f264c6d19c",
|
||||
"release": "/var/www/investmoz-homologacao/releases/5d5f3b414866969e4b2d38376402b8f264c6d19c-7453aad9",
|
||||
"previous_release": "/var/www/investmoz-homologacao/releases/7e5710ebbd235f9478f149f8470a238c9e66ea9e-8bf3c724",
|
||||
"database_migrations": 0,
|
||||
"content_imports": 0,
|
||||
"requested_commits": [
|
||||
"5d5f3b414866969e4b2d38376402b8f264c6d19c"
|
||||
],
|
||||
"finished_at": "2026-10-24T21:06:09.473849+00:00"
|
||||
},
|
||||
"log_file": "1792875866291395065.log",
|
||||
"summaries": [
|
||||
"OK (1 test, 3106 assertions)",
|
||||
"built in 26.50s",
|
||||
"OK (59 tests, 317 assertions)",
|
||||
"# tests 370",
|
||||
"# pass 370",
|
||||
"# fail 0"
|
||||
],
|
||||
"log_bytes": 136776
|
||||
},
|
||||
"rollback_executed": false
|
||||
},
|
||||
"base_VAT_separation": "Accepted QA reused:four exclusiontreatments withownconditions;initialnetamount minus onlystillincluded exclusions,alreadyexcluded notsubtractedagain. Judicial/contract/grant/accounts/recipient/packaginginvoice references/scope andimmutableinputs/history/report retained. Base independent of VAT/rate(alwaysnull),no deduction/regularisation inferred. Four installed runtime hashes and16compiled markers verified;no synthetic activewrite.",
|
||||
"activation": "Normal Git fast-forward/webhook/installer;zero migrations/imports"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,131 @@
|
||||
{
|
||||
"status": "ready_after_fresh_authenticated_preflight_and_verified_backup_restore",
|
||||
"candidate": "20871341438c024fa22a82419144734cb95cffbd",
|
||||
"base_installed": "5d5f3b414866969e4b2d38376402b8f264c6d19c",
|
||||
"coverage_complete_branches": {
|
||||
"AUD-SIM-L1-P103": [
|
||||
"price_comparison",
|
||||
"referenced_correction"
|
||||
]
|
||||
},
|
||||
"branch_count_complete": 1,
|
||||
"treatment_count": 2,
|
||||
"runtime_delta": [
|
||||
{
|
||||
"path": "resources/js/lib/iva-value-review.ts",
|
||||
"sha256_LF": "411aa0506868afd112bac0e27571db1978b21bd8375051dc36abbe55dfad7876"
|
||||
},
|
||||
{
|
||||
"path": "resources/js/components/simulation-value-review.tsx",
|
||||
"sha256_LF": "ff3fc2ad0e0082a931341ae51b63d6abe2bfee00b90e5891fc4dce742e84a017"
|
||||
},
|
||||
{
|
||||
"path": "resources/js/components/simulation-monthly-iva.tsx",
|
||||
"sha256_LF": "c7f6a45a8533f6ce4128c912511b7712011fc365b99dfbe675d6cb2b455dfca1"
|
||||
},
|
||||
{
|
||||
"path": "resources/js/lib/project-dossier.ts",
|
||||
"sha256_LF": "89ee4a4abfa36c4d159edd71c936d718e2a6e99c9c8a83be669451fb309c5d2c"
|
||||
}
|
||||
],
|
||||
"counts_before": {
|
||||
"delivered": 85,
|
||||
"QA": 1,
|
||||
"functional_pending": 46,
|
||||
"documentary": 1,
|
||||
"total": 133
|
||||
},
|
||||
"counts_current": {
|
||||
"delivered": 85,
|
||||
"QA": 1,
|
||||
"functional_pending": 46,
|
||||
"documentary": 1,
|
||||
"total": 133
|
||||
},
|
||||
"counts_after_delivery": {
|
||||
"delivered": 86,
|
||||
"QA": 0,
|
||||
"functional_pending": 46,
|
||||
"documentary": 1,
|
||||
"total": 133
|
||||
},
|
||||
"QA_proofs_reused": [
|
||||
"iva-l1-g7h-qa-20261024.json"
|
||||
],
|
||||
"authorization": "Tempo explicitly deploy20871341 through existingGit,preserve concurrentchanges and check installeddelta only;P103comparison distinct fromreferencedcorrection andconditionalscenario",
|
||||
"scope": "2026/MZN,P103baseonly;no automaticvaluation/legalcorrection,incidence/rate/VAT/deduction/field11/regularisation/ModeloAtotals oractiveauthorityaction. Referencecontext/scope and equivalentcomposition required. Unknowncorrectionamount notdefaultreference;no inventedfloor/maximum. Projectedcorrection clearlyconditional,notATdecision. Notbelowdoesnotdemonstrate15(7)trigger.",
|
||||
"meaning": "AT may correct consideration below current/normal factorygate/wholesale/retail/serviceprice,considering natureoftransmission. Comparison doesnot exerciseATpower or automaticallysubstitute referenceprice. Recordedcorrection in effective declareddata or expresslyconditional projectedscenario retains ownamount/ref/date/scope.",
|
||||
"formula": {
|
||||
"price_comparison": "compare exactdeclared/reference values;retain declaredbase withoutautomaticcorrection",
|
||||
"referenced_correction": "if15(7)belowtrigger andscopeconfirmed,use explicitlyreferenced correctedamount;no max/defaultreference"
|
||||
},
|
||||
"preservation": "85priorclosures 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-g7h-readonly-rollback-20261024.patch,checked only,not applied;blocks newP103calculations only,preserves readers/history/otherbranches",
|
||||
"authenticated_preflight": {
|
||||
"installed": {
|
||||
"status": "installed",
|
||||
"commit": "5d5f3b414866969e4b2d38376402b8f264c6d19c",
|
||||
"release": "/var/www/investmoz-homologacao/releases/5d5f3b414866969e4b2d38376402b8f264c6d19c-7453aad9",
|
||||
"previous_release": "/var/www/investmoz-homologacao/releases/7e5710ebbd235f9478f149f8470a238c9e66ea9e-8bf3c724",
|
||||
"database_migrations": 0,
|
||||
"content_imports": 0
|
||||
},
|
||||
"current_link": "/var/www/investmoz-homologacao/releases/5d5f3b414866969e4b2d38376402b8f264c6d19c-7453aad9",
|
||||
"release_revision": {
|
||||
"commit": "5d5f3b414866969e4b2d38376402b8f264c6d19c",
|
||||
"branch": "main",
|
||||
"built_at": "2026-10-24T21:06:06.620815+00:00",
|
||||
"manifest_sha256": "640a7390e644ff6efdf891439786a7b1783553d805cf71ccb6e6d488ed7196e8"
|
||||
},
|
||||
"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-g7h-delivery-20261024/backup",
|
||||
"target": {
|
||||
"database": "teste_investidor",
|
||||
"port": 5432
|
||||
},
|
||||
"tables": 174,
|
||||
"files_verified": 369,
|
||||
"dump_sha256": "a61c5e65e681b5d58b514ae910d6a039a6313f9db78f0bfa440248a5d6d04162",
|
||||
"files_sha256": "18957aa6e1635d99848d4d57248cf6213f0076a2d5c9852d2f1c695b3417c813",
|
||||
"restore_verified": false
|
||||
},
|
||||
"restore": {
|
||||
"restore_verified": true,
|
||||
"tables_verified": 174,
|
||||
"container_network": "none",
|
||||
"database": "l1_g7h_restore_20261024",
|
||||
"port": 55441,
|
||||
"source_dump_sha256": "a61c5e65e681b5d58b514ae910d6a039a6313f9db78f0bfa440248a5d6d04162",
|
||||
"active_database_writes": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
--- a/resources/js/lib/iva-value-review.ts
|
||||
+++ b/resources/js/lib/iva-value-review.ts
|
||||
@@ -54,6 +54,7 @@
|
||||
function key(draft:Record<string,unknown>,book:ValueReviewBook):string{return JSON.stringify({version:valueReviewVersion,scope:acquisitionScope(draft),location:draft.selection_labels??{},currency:draft.currency,rows:book.rows});}
|
||||
export function valueReviewCurrent(draft:Record<string,unknown>,book:ValueReviewBook):boolean{return!!book.result&&book.result.sourceKey===key(draft,book);}
|
||||
export function recordValueReviews(draft:Record<string,unknown>,book:ValueReviewBook):ValueReviewBook{
|
||||
+ throw new Error('Novas bases P103 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:ValueReviewCalculation={version:valueReviewVersion,revision:(book.result?.revision??0)+1,calculatedAt:new Date().toISOString(),opportunity:acquisitionScope(draft),location:JSON.stringify(draft.selection_labels??{}),sourceKey:key(draft,book),source:valueReviewSource,inputs:structuredClone(book.rows),rows:book.rows.map(row=>evaluateValueReview(row,draft.currency))};
|
||||
const next={...book,result,history:[...(book.history??[]),...(book.result?[book.result]:[])]};saveValueReviewBook(draft,next);return next;
|
||||
@@ -1,6 +1,36 @@
|
||||
# Rastreabilidade, utilização e formação
|
||||
|
||||
|
||||
## 24/10/2026 — G7H/P103 concluído emQA:comparação e correcção referenciada
|
||||
|
||||
Implementação`67b8b581`. **Um ramo,dois tratamentos**:`price_comparison` e`referenced_correction`. FonteCIVA15(7),Lei13/2016PDF14/p1426(272),15(1)/(5)/(6);2022PDF3mantém7;2025não altera15. Contraprestação inferior à resultante de preços correntes/normais à porta fábrica,grosso,retalho ou do serviço,considerando natureza das transmissões:AT pode corrigir,não automatismo. Comparação conserva contraprestação declarada;registo de correcção usa montante/referência/data/âmbito próprios,não máximo/referência substitutos. Contexto do preço,referência/âmbito,operação e composição equivalente sem próprioIVA identificados. Na projecção,correcção é cenário condicionado expressamente assumido,não decisão AT concedida;dados efectivos declarados exigem confirmação da correspondência da correcção referenciada. Não se demonstra pressuposto15(7)quando contraprestação não inferior.
|
||||
|
||||
Desconhecido não é zero/correcção presumida. Decimal exacto até6casas,sem arredondamento fiscal presumido. Mudança de contexto/percurso/origem conserva montantes/documentos e limpa confirmações afectadas;projectado→efectivo não reutiliza confirmação do pressuposto. Escolha técnica de integridade,não novo aprovador/certificado/regra organizacional. LivrovalueReviews por oportunidade,snapshot/API/dossier existentes,sem schema/permissões novos. Sem avaliação automática,IVA/incidência/taxa/dedução/campo11/regularizações/totaisModeloA ou execução de acto AT.
|
||||
|
||||
Provas do delta:**4testes frontend**,**APIprivada1teste/33asserções**,guarda`simulator_fiscal_delta_20261021_test:55441` e rollback;tipos/build passaram. Interface real Edge/CUA:referência de preço/montante corrigido desconhecidos→indeterminado;comparação inferior1000.25vs1500.50 mantém1000.25;origem efectivo limpa confirmação;correcção fora âmbito não aplicada;regresso à projecção confirma cenário condicionado1400.75,sem substituir por1500.50. Gravação recuperada/relatório:2linhas/5versões anteriores,IVAindeterminado. Dados sintéticos,não aceitação manual atribuída à Tempo.85fechos/livros/resultados/históricos intactos,incluindoP102/P101/P100/P095/P094/P091/P060/P050 eP084/P085parciais;provas anteriores reutilizadas. [RegistoQA](../simulations/iva-l1-g7h-qa-20261024.json).
|
||||
|
||||
**85entregues +1emQA(P103) +46funcionaispendentes +P001 =133**. Homologação permanece`5d5f3b41`;falta integração/entrega pelo processoGit,manifesto/backup/restauro e delta instalado. P084/P085 continuam nos46,apenas preparação/simulação condicionada,sem benefícios confirmados. L1aberto;P00105/06;bebidasL2/L3;Estatísticas/IAadiadas.
|
||||
|
||||
|
||||
|
||||
## 24/10/2026 — preparação G7H/P103,inventário antes de testes
|
||||
|
||||
G7G/P102 aceite5d5f3b41/adb849d4;**85entregues+47funcionaispendentes+P001=133**. Inventariados85fechos,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,incluindoP102/P101/P100/P095/P094/P091/P060/P050/P084/P085parciais. Sem repetir aceitação anterior ou ensaiar no activo.
|
||||
|
||||
G7H/P103 executaCIVA15(7),2016PDF14/p1426(272):para efeitos15(1),contraprestação inferior à resultante de preços correntes/normais de venda à porta fábrica,por grosso ou retalho,ou do serviço,tendo em conta a natureza das transmissões,AT pode proceder à correcção.2022PDF3mantém7;2025não altera15;2017não rectifica15(7). Fontes/exemplares/inventário aceites,cotejo visual com skillPDF. Dois tratamentos num ramo:comparar sem correcção automática;registar correcção AT referenciada nos dados efectivos ou cenário condicionado expressamente assumido na projecção. Referência/âmbito/contexto do preço e composição equivalente identificados;valor inferior não autoriza o portal a corrigir automaticamente,nem usar máximo/referência como substituto de montante de correcção. Conservar documentos/valores ao mudar percurso/contexto,limpando confirmações afectadas por integridade. Sem novos certificados/aprovadores,IVA/dedução/campo11/regularizações/totaisModeloA. L1aberto;P00105/06;bebidasL2/L3;P084/P085parciais;Estatísticas/IAadiadas.
|
||||
|
||||
|
||||
|
||||
## 24/10/2026 — G7G/P102 entregue:quatro exclusões da contraprestação
|
||||
|
||||
Homologação **`5d5f3b41`**,pelo processoGit existente,sobre`7e5710eb`;candidata`9c2b2c65` expressamente aceite pela Tempo. **P102:um ramo,quatro tratamentos**:`judicial_indemnity`,`granted_discount`,`third_party_payment`,`returnable_packaging`,na mesma base por operação. Indemnização recebida declarada judicialmente por incumprimento total/parcial de contrato;descontos/abatimentos/bónus concedidos;quantias pagas em nome e por conta do adquirente/destinatário,registadas em adequadas contas de terceiros;embalagens não efectivamente transaccionadas com indicação separada e menção expressa da devolução acordada27(5)(b). Não exigir devolução já realizada. Montante inicial sem próprioIVA e com inclusões15(5)consideradas−exclusões ainda incluídas;parcelas já excluídas conservadas sem segunda subtracção. Condições,referências e âmbitos próprios conservados nas entradas imutáveis,versões/histórico/relatório. Desconhecido não é zero/exclusão presumida. Sem certificados/aprovadores novos. Base separada de incidência/taxa/IVA(IVA/taxa permanecemnull),dedução/campo11/regularizações/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,quatro exclusões/condições próprias/âmbito/referências,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çãoP102 conferida,não aplicada,leitores/históricos e restantes ramos preservados.
|
||||
|
||||
[Manifesto/recibo](../simulations/l1-g7g-delivery-20261024.json),registo`iva_l1_g7g_P102_homologation_20261024`. **85entregues +47funcionaispendentes +P001 =133;sem candidatasQA por disponibilizar.** Os84fechos anteriores permanecem encerrados. P084/P085 continuam nos47,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 — G7G/P102 concluído emQA:quatro exclusões da contraprestação
|
||||
|
||||
Implementação`acc633bf`. **Um ramo,quatro tratamentos**:`judicial_indemnity`,`granted_discount`,`third_party_payment`,`returnable_packaging`,na mesma base por operação. FonteCIVA15(6)(a–d),Lei13/2016PDF14/p1426(272);27(5)(b),PDF17/p1426(275);2022PDF3mantém15(6);2025PDF14mantém27(5)(b),altera27(10),não15. Indemnização recebida declarada judicialmente por incumprimento total/parcial de contrato;descontos/abatimentos/bónus concedidos;quantias pagas em nome e por conta do adquirente/destinatário,registadas em adequadas contas de terceiros;embalagens não efectivamente transaccionadas com indicação separada e menção expressa da devolução acordada na factura/documento equivalente. Não exigir devolução já realizada.
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -13,6 +13,7 @@ import { SimulationFuelBase } from './simulation-fuel-base';
|
||||
import { SimulationNoncashBase } from './simulation-noncash-base';
|
||||
import { SimulationCompositionBase } from './simulation-composition-base';
|
||||
import { SimulationExclusionBase } from './simulation-exclusion-base';
|
||||
import { SimulationValueReview } from './simulation-value-review';
|
||||
import { SimulationOfferPreparations } from './simulation-offer-preparations';
|
||||
import { SimulationOperations } from './simulation-operations';
|
||||
|
||||
@@ -104,6 +105,7 @@ export function SimulationMonthlyIva({draft, busy, onCalculate, onChange}: {
|
||||
<SimulationNoncashBase draft={draft} onChange={onChange} />
|
||||
<SimulationCompositionBase draft={draft} onChange={onChange} />
|
||||
<SimulationExclusionBase draft={draft} onChange={onChange} />
|
||||
<SimulationValueReview draft={draft} onChange={onChange} />
|
||||
<SimulationOfferPreparations draft={draft} onChange={onChange} />
|
||||
<SimulationModeloA draft={draft} />
|
||||
</section>;
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
import {useState} from 'react';
|
||||
import {newValueReview,switchValueReview,switchPriceContext,switchValueOrigin,valueReviewBook,valueReviewConditions,valueReviewCurrent,valueReviewReportRows,valueReviewSource,valueReviewTreatments,priceContexts,recordValueReviews,saveValueReviewBook,type ValueReviewBook,type ValueReviewRow} from '@/lib/iva-value-review';
|
||||
|
||||
export function SimulationValueReview({draft,onChange}:{draft:Record<string,unknown>;onChange:(field:string,value:string)=>void}){
|
||||
const[error,setError]=useState('');let book:ValueReviewBook;
|
||||
try{book=valueReviewBook(draft);}catch(cause){return<p role="alert">{String(cause)}</p>;}
|
||||
const save=(next:ValueReviewBook)=>{try{onChange('modelo_a_snapshot',saveValueReviewBook(draft,next));setError('');}catch(cause){setError(String(cause));}};
|
||||
const change=(id:string,patch:Partial<ValueReviewRow>)=>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 — comparação de preços e correcção referenciada</summary>
|
||||
<p>Oportunidade: {String(draft.context_opportunity||'entrada geral')}. Compare a contraprestação com o preço corrente ou normal correspondente à natureza da operação. Um preço inferior permite à AT proceder à correcção;esta comparação não exerce esse poder nem substitui automaticamente a contraprestação.</p>
|
||||
<p>Para registar uma correcção,identifique o montante,referência,data e âmbito aplicáveis à operação e período. Na projecção,um cenário condicionado permanece identificado como pressuposto,não decisão AT concedida. Base e IVA são resultados distintos.</p>
|
||||
<p>{valueReviewSource}</p>{error&&<p role="alert">{error}</p>}
|
||||
<button type="button" className="underline" onClick={()=>save({...book,rows:[...book.rows,newValueReview(crypto.randomUUID(),String(draft.currency??''))]})}>Acrescentar comparação de contraprestação</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>Percurso da comparação<select className="block rounded border p-2" value={row.treatment} onChange={e=>change(row.id,switchValueReview(row,e.target.value))}><option value="">Por indicar</option>{valueReviewTreatments.map(t=><option key={t.id} value={t.id}>{t.label}</option>)}</select></label>
|
||||
<label>Contexto do preço de referência<select className="block rounded border p-2" value={row.priceContext} onChange={e=>change(row.id,switchPriceContext(row,e.target.value))}><option value="">Por indicar</option>{priceContexts.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,switchValueOrigin(row,e.target.value as ValueReviewRow['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'],['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'],['declaredAmount','Contraprestação declarada sem IVA (moeda indicada)'],['referenceAmount','Preço corrente ou normal comparável sem IVA (moeda indicada)'],['referenceRef','Referência do preço corrente ou normal / pressuposto'],['referenceScope','Âmbito do preço: bens/serviços, estádio, período, local e condições'],['compositionRef','Referência da composição equivalente sem próprio IVA'],['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>)}
|
||||
{row.treatment==='referenced_correction'&&<>
|
||||
{([['correctedAmount','Montante da base corrigida / pressuposto condicionado'],['correctionRef','Referência da correcção AT / pressuposto condicionado'],['correctionScope','Âmbito da correcção: bens/serviços, operação, período e condições'],['correctionDate','Data da correcção / prevista']] as const).map(([field,label])=><label key={field}>{label}<input className="block rounded border p-2" type={field==='correctionDate'?'date':'text'} value={row[field]} onChange={e=>change(row.id,{[field]:e.target.value})}/></label>)}
|
||||
<label>{row.origin==='projected'?'O cenário condicionado assume expressamente esta correcção e âmbito,sem afirmar decisão AT concedida?':'A correcção AT referenciada aplica-se a estes bens/serviços,operação,período e condições?'}<select className="block rounded border p-2" value={row.correctionApplies} onChange={e=>change(row.id,{correctionApplies:e.target.value as ValueReviewRow['correctionApplies']})}><option value="">Por indicar</option><option value="yes">Sim</option><option value="no">Não</option></select></label>
|
||||
</>}
|
||||
</div>
|
||||
<p>Mudar percurso/contexto conserva montantes e documentos,mas exige rever as correspondências afectadas. Campos sem aplicação ficam ocultos e conservados;uma comparação não concede nem determina uma correcção.</p>
|
||||
<fieldset><legend>Condições próprias da comparação</legend>{valueReviewConditions.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>
|
||||
</details>)}
|
||||
{!!book.rows.length&&<button type="button" className="rounded bg-emerald-800 p-2 text-white" onClick={()=>{try{save(recordValueReviews(draft,book));}catch(cause){setError(String(cause));}}}>Comparar e guardar versão</button>}
|
||||
{book.result&&<><p role="status">{valueReviewCurrent(draft,book)?'Comparações correspondentes às entradas guardadas.':'Entradas alteradas;comparaçõ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>{valueReviewReportRows(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,64 @@
|
||||
import {acquisitionScope,readAcquisitionStore} from './iva-acquisitions.ts';
|
||||
|
||||
export const valueReviewVersion='value-review-base/1';
|
||||
export const valueReviewSource='CIVA republicado Lei13/2016,15(7),PDF14/p1426(272):para efeitos15(1),quando a contraprestação é inferior à resultante dos preços correntes ou normais de venda à porta da fábrica,por grosso ou a retalho,ou aos preços correntes/normais do serviço,tendo em conta a natureza das transmissões,a Administração Tributária pode proceder à correcção. Lei22/2022PDF3mantém15(7);Lei10/2025não altera15. Recorte2026/MZN;comparação não exerce o poder da AT,nem substitui automaticamente a contraprestação pelo valor de referência. Sem incidência,taxa,IVA,dedução/campo11,regularizações ou totaisModeloA.';
|
||||
export const valueReviewTreatments=[{id:'price_comparison',label:'Comparar sem correcção automática'},{id:'referenced_correction',label:'Registar correcção referenciada / cenário condicionado'}] as const;
|
||||
export const priceContexts=[{id:'factory',label:'Venda à porta da fábrica'},{id:'wholesale',label:'Venda por grosso'},{id:'retail',label:'Venda a retalho'},{id:'service',label:'Preço corrente ou normal do serviço'}] as const;
|
||||
export const valueReviewConditions=[
|
||||
['taxableOperation','A operação e a contraprestação para efeitos15(1)estão identificadas'],
|
||||
['referenceCorresponds','O preço corrente ou normal e o contexto escolhido correspondem à natureza desta transmissão ou serviço,no período e âmbito identificados'],
|
||||
['netComposition','Os montantes comparados têm composição equivalente,sem próprioIVA,com inclusões/exclusões aplicáveis15(5)/(6)consideradas'],
|
||||
] as const;
|
||||
type Choice=''|'yes'|'no';type Condition=typeof valueReviewConditions[number][0];
|
||||
export type ValueReviewRow={id:string;treatment:string;priceContext:string;description:string;period:string;origin:'projected'|'effective';currency:string;operationRef:string;documentRef:string;documentDate:string;declaredAmount:string;referenceAmount:string;referenceRef:string;referenceScope:string;compositionRef:string;evidence:string;correctedAmount:string;correctionRef:string;correctionScope:string;correctionDate:string;correctionApplies:Choice;conditions:Partial<Record<Condition,Choice>>};
|
||||
type LineResult={id:string;status:'determined'|'not_applicable'|'indeterminate';baseAmount:string|null;vat:null;rate:null;comparison:'below'|'not_below'|null;reason:string};
|
||||
export type ValueReviewCalculation={version:string;revision:number;calculatedAt:string;opportunity:string;location:string;sourceKey:string;source:string;inputs:ValueReviewRow[];rows:LineResult[]};
|
||||
export type ValueReviewBook={rows:ValueReviewRow[];result?:ValueReviewCalculation;history?:ValueReviewCalculation[]};
|
||||
type Store=ReturnType<typeof readAcquisitionStore>&{valueReviews?:Record<string,ValueReviewBook>};
|
||||
export function newValueReview(id:string,currency:string):ValueReviewRow{return{id,treatment:'',priceContext:'',description:'',period:'',origin:'projected',currency,operationRef:'',documentRef:'',documentDate:'',declaredAmount:'',referenceAmount:'',referenceRef:'',referenceScope:'',compositionRef:'',evidence:'',correctedAmount:'',correctionRef:'',correctionScope:'',correctionDate:'',correctionApplies:'',conditions:{}};}
|
||||
export function switchValueReview(row:ValueReviewRow,treatment:string):ValueReviewRow{return{...row,treatment,correctionApplies:''};}
|
||||
export function switchPriceContext(row:ValueReviewRow,priceContext:string):ValueReviewRow{return{...row,priceContext,conditions:{...row.conditions,referenceCorresponds:''},correctionApplies:''};}
|
||||
export function switchValueOrigin(row:ValueReviewRow,origin:ValueReviewRow['origin']):ValueReviewRow{return{...row,origin,correctionApplies:''};}
|
||||
|
||||
function readStore(draft:Record<string,unknown>):Store{
|
||||
const store=readAcquisitionStore(draft.modelo_a_snapshot) as Store;
|
||||
if(store.valueReviews!==undefined&&(!store.valueReviews||typeof store.valueReviews!=='object'||Array.isArray(store.valueReviews)))throw new Error('Bases de contraprestação não recuperáveis;originais preservados.');
|
||||
const fields=Object.keys(newValueReview('','')).filter(key=>key!=='conditions');
|
||||
for(const book of Object.values(store.valueReviews??{}))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 ValueReviewRow]!=='string')||!row.conditions||typeof row.conditions!=='object'||Array.isArray(row.conditions)))throw new Error('Linhas de contraprestação não recuperáveis;originais preservados,sem substituição por lista vazia.');
|
||||
return store;
|
||||
}
|
||||
export function valueReviewBook(draft:Record<string,unknown>):ValueReviewBook{return readStore(draft).valueReviews?.[acquisitionScope(draft)]??{rows:[]};}
|
||||
export function saveValueReviewBook(draft:Record<string,unknown>,book:ValueReviewBook):string{const current=readStore(draft),encoded=JSON.stringify({...current,valueReviews:{...current.valueReviews,[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 evaluateValueReview(row:ValueReviewRow,currency:unknown):LineResult{
|
||||
const result:LineResult={id:row.id,status:'indeterminate',baseAmount:null,vat:null,rate:null,comparison:null,reason:''};const stop=(reason:string,status:LineResult['status']='indeterminate')=>({...result,status,reason});
|
||||
if(!valueReviewTreatments.some(item=>item.id===row.treatment)||!priceContexts.some(item=>item.id===row.priceContext))return stop('Identifique o percurso e o contexto do preço de referência;desconhecido não permite presumir correcção.');
|
||||
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 expressos de projecção.');
|
||||
const failed=valueReviewConditions.filter(([key])=>row.conditions[key]==='no');if(failed.length)return stop('Não se aplica esta comparação: '+failed.map(([,label])=>label).join('; ')+'. Não é isenção nem IVA zero.','not_applicable');
|
||||
if(valueReviewConditions.some(([key])=>row.conditions[key]!=='yes'))return stop('Confirme as condições próprias da comparação;desconhecido não é zero,não aplicável ou correcção.');
|
||||
if(!row.description.trim()||!row.operationRef.trim()||!row.documentRef.trim()||!validDate(row.documentDate)||!row.referenceRef.trim()||!row.referenceScope.trim()||!row.compositionRef.trim()||!row.evidence.trim())return stop('Identifique operação,documento/data,preço corrente/normal,referência/âmbito e composição,ou pressupostos expressos;sem avaliação automática/certificado/aprovador novo.');
|
||||
const declared=decimal(row.declaredAmount),reference=decimal(row.referenceAmount);if(declared===null||reference===null)return stop('Indique contraprestação e preço de referência comparáveis;valor desconhecido ou inválido não é zero.');
|
||||
result.comparison=declared<reference?'below':'not_below';
|
||||
const comparison=declared<reference?`Contraprestação ${money(declared)} inferior à referência ${money(reference)} por ${money(reference-declared)}MZN;AT pode proceder à correcção,sem automatismo.`:`Contraprestação ${money(declared)} não inferior à referência ${money(reference)}MZN;não se demonstra este pressuposto15(7).`;
|
||||
if(row.treatment==='price_comparison')return{...result,status:'determined',baseAmount:money(declared),reason:comparison+' Contraprestação declarada conservada como base neste recorte,sem correcção pelo portal;IVA/taxa,dedução/campo11,regularizações e totaisModeloA não determinados.'};
|
||||
if(declared>=reference)return stop(comparison+' A correcção deste percurso15(7)não é aplicada. Registo e referências conservados.','not_applicable');
|
||||
if(row.correctionApplies==='no')return stop(comparison+' A correcção referenciada não abrange esta operação/período/condições;sem aplicação automática.','not_applicable');
|
||||
if(row.correctionApplies!=='yes'||!row.correctionRef.trim()||!row.correctionScope.trim()||!validDate(row.correctionDate))return stop(comparison+' Identifique referência,data e âmbito da correcção AT aplicável ou pressuposto expresso do cenário condicionado;comparar não substitui uma correcção.');
|
||||
const corrected=decimal(row.correctedAmount);if(corrected===null)return stop(comparison+' Indique o montante da correcção referenciada ou pressuposto condicionado;sem usar automaticamente o maior valor ou a referência.');
|
||||
return{...result,status:'determined',baseAmount:money(corrected),reason:comparison+` ${row.origin==='projected'?'Cenário condicionado à correcção expressamente assumida,não decisão AT concedida':'Correcção AT nos dados efectivos declarados,com referência/data/âmbito identificados'}:base ${money(corrected)}MZN. Montante da referência não substituído automaticamente. Sem IVA/taxa,dedução/campo11,regularizações ou totaisModeloA.`};
|
||||
}
|
||||
|
||||
function key(draft:Record<string,unknown>,book:ValueReviewBook):string{return JSON.stringify({version:valueReviewVersion,scope:acquisitionScope(draft),location:draft.selection_labels??{},currency:draft.currency,rows:book.rows});}
|
||||
export function valueReviewCurrent(draft:Record<string,unknown>,book:ValueReviewBook):boolean{return!!book.result&&book.result.sourceKey===key(draft,book);}
|
||||
export function recordValueReviews(draft:Record<string,unknown>,book:ValueReviewBook):ValueReviewBook{
|
||||
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:ValueReviewCalculation={version:valueReviewVersion,revision:(book.result?.revision??0)+1,calculatedAt:new Date().toISOString(),opportunity:acquisitionScope(draft),location:JSON.stringify(draft.selection_labels??{}),sourceKey:key(draft,book),source:valueReviewSource,inputs:structuredClone(book.rows),rows:book.rows.map(row=>evaluateValueReview(row,draft.currency))};
|
||||
const next={...book,result,history:[...(book.history??[]),...(book.result?[book.result]:[])]};saveValueReviewBook(draft,next);return next;
|
||||
}
|
||||
export function valueReviewReportRows(draft:Record<string,unknown>):Array<[string,string,string,string]>{
|
||||
try{const book=valueReviewBook(draft),result=book.result;if(!result)return[];return result.inputs.map((row,index)=>['IVA mensal',`Base P103 — ${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};${valueReviewCurrent(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'};${valueReviewTreatments.find(t=>t.id===row.treatment)?.label??'Percurso por indicar'};contexto ${priceContexts.find(t=>t.id===row.priceContext)?.label??'Por indicar'};operação ${row.operationRef};contraprestação ${row.declaredAmount};preço referência ${row.referenceAmount},${row.referenceRef};âmbito ${row.referenceScope};${row.treatment==='referenced_correction'?`correcção ${row.correctedAmount},referência ${row.correctionRef},data ${row.correctionDate},âmbito ${row.correctionScope},aplica:${row.correctionApplies==='yes'?'Sim':row.correctionApplies==='no'?'Não':'Por indicar'}`:'Sem correcção automática'};composição ${row.compositionRef};documento ${row.documentRef},${row.documentDate};condições ${valueReviewConditions.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','Comparação/correcção da contraprestação','Dados não recuperáveis','Originais preservados;sem substituir por zero.']];}
|
||||
}
|
||||
@@ -12,6 +12,7 @@ import { fuelBaseReportRows } from './iva-fuel-base.ts';
|
||||
import { noncashBaseReportRows } from './iva-noncash-base.ts';
|
||||
import { compositionReportRows } from './iva-composition-base.ts';
|
||||
import { exclusionReportRows } from './iva-exclusion-base.ts';
|
||||
import { valueReviewReportRows } from './iva-value-review.ts';
|
||||
import { offerPreparationReportRows } from './iva-offer-preparations.ts';
|
||||
import { salesReportRows } from './iva-operations.ts';
|
||||
import { fiscalQaRows } from './fiscal-qa-preview.ts';
|
||||
@@ -634,6 +635,7 @@ export function buildProjectDossierRows(
|
||||
rows.push(...noncashBaseReportRows(draft));
|
||||
rows.push(...compositionReportRows(draft));
|
||||
rows.push(...exclusionReportRows(draft));
|
||||
rows.push(...valueReviewReportRows(draft));
|
||||
rows.push(...offerPreparationReportRows(draft));
|
||||
const operationRows = salesReportRows(draft);
|
||||
rows.push(...operationRows);
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
<?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 IvaValueReviewDraftTest extends TestCase
|
||||
{
|
||||
use DatabaseTransactions;
|
||||
|
||||
public function test_value_reviews_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-g7h-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:346', $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['valueReviews']['opportunity:346'];
|
||||
$this->assertCount(2, $book['rows']);
|
||||
$this->assertSame(['price_comparison','referenced_correction'], array_column($book['rows'], 'treatment'));
|
||||
$this->assertSame(['1000.25','1400.75'], array_column($book['result']['rows'], 'baseAmount'));
|
||||
$this->assertSame(['determined','determined'], array_column($book['result']['rows'], 'status'));
|
||||
$this->assertSame([null,null], array_column($book['result']['rows'], 'vat'));
|
||||
$this->assertSame([null,null], array_column($book['result']['rows'], 'rate'));
|
||||
$this->assertSame(['below','below'], array_column($book['result']['rows'], 'comparison'));
|
||||
$this->assertSame('1000.25', $book['rows'][0]['declaredAmount']);
|
||||
$this->assertSame('1500.50', $book['rows'][0]['referenceAmount']);
|
||||
$this->assertSame('1400.75', $book['rows'][1]['correctedAmount']);
|
||||
$this->assertSame('projected', $book['rows'][1]['origin']);
|
||||
$this->assertSame('yes', $book['rows'][1]['correctionApplies']);
|
||||
$this->assertSame('retail', $book['rows'][1]['priceContext']);
|
||||
$this->assertSame('2026-12-20', $book['rows'][1]['correctionDate']);
|
||||
$this->assertStringContainsString('condicionado correcção A', $book['rows'][1]['correctionRef']);
|
||||
$this->assertStringContainsString('dezembro2026', $book['rows'][1]['correctionScope']);
|
||||
$this->assertStringContainsString('Cenário condicionado', $book['result']['rows'][1]['reason']);
|
||||
$this->assertStringContainsString('15(7)', $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-g7h-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, ['valueReviews' => 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-g7h-value-review-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,43 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import fs from 'node:fs';
|
||||
import {newValueReview,switchValueReview,switchPriceContext,switchValueOrigin,valueReviewTreatments,priceContexts,valueReviewConditions,evaluateValueReview,recordValueReviews,saveValueReviewBook,valueReviewBook,valueReviewCurrent,valueReviewReportRows} from '../../resources/js/lib/iva-value-review.ts';
|
||||
import {exclusionCurrent} from '../../resources/js/lib/iva-exclusion-base.ts';
|
||||
import {compositionCurrent} from '../../resources/js/lib/iva-composition-base.ts';
|
||||
import {createProjectDossierReport} from '../../resources/js/lib/project-dossier-report.ts';
|
||||
const frozen=JSON.parse(fs.readFileSync(new URL('./fixtures/iva-g7h-preserved-inputs.json',import.meta.url),'utf8'));
|
||||
const row=(treatment='price_comparison')=>({...newValueReview('g7h-'+treatment,'MZN'),treatment,priceContext:'retail',description:'SYNTHETIC QA operação A',period:'2026-12',operationRef:'SYNTHETIC QA operação A',documentRef:'SYNTHETIC QA G7H '+treatment,documentDate:'2026-12-12',declaredAmount:'1000.25',referenceAmount:'1500.50',referenceRef:'SYNTHETIC QA preço corrente A',referenceScope:'SYNTHETIC QA bens A,retalho,dezembro2026,Manica e condições comparáveis',compositionRef:'SYNTHETIC QA composição equivalente15(5)/(6),sem próprioIVA',evidence:'SYNTHETIC QA pressupostos expressos,não documento real',correctedAmount:'1400.75',correctionRef:'SYNTHETIC QA pressuposto condicionado correcção A',correctionScope:'SYNTHETIC QA bens A/operação A/dezembro2026/condições A',correctionDate:'2026-12-20',correctionApplies:'yes',conditions:Object.fromEntries(valueReviewConditions.map(([key])=>[key,'yes']))});
|
||||
const draft=()=>({...structuredClone(frozen),context_opportunity:'opportunity:346',project_title:'SYNTHETIC QA — G7H / Comparação e correcção'});
|
||||
|
||||
test('P103 contexts and ownconditions/references;below comparison never replaces declaredbase automatically',()=>{
|
||||
for(const context of priceContexts){const input={...row(),priceContext:context.id};assert.equal(evaluateValueReview(input,'MZN').baseAmount,'1000.25');assert.equal(evaluateValueReview(input,'MZN').comparison,'below');
|
||||
for(const[key]of valueReviewConditions)for(const value of ['','unknown','no']){const r=evaluateValueReview({...input,conditions:{...input.conditions,[key]:value}},'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:''},{documentRef:''},{documentDate:'2026-02-30'},{referenceRef:''},{referenceScope:''},{compositionRef:''},{evidence:''},{period:'2025-12'},{currency:'USD'},{priceContext:'unknown'},{treatment:''},{declaredAmount:''},{referenceAmount:''}])assert.equal(evaluateValueReview({...input,...patch},'MZN').baseAmount,null);
|
||||
}
|
||||
for(const referenceAmount of ['1000.25','500.00']){const r=evaluateValueReview({...row(),referenceAmount},'MZN');assert.equal(r.comparison,'not_below');assert.equal(r.baseAmount,'1000.25');}
|
||||
});
|
||||
|
||||
test('correction amount/reference/scope required;scenario distinct fromeffective;no maximum/default reference;exactdecimal and switches',()=>{
|
||||
const input=row('referenced_correction'),ok=evaluateValueReview(input,'MZN');assert.equal(ok.baseAmount,'1400.75');assert.equal(ok.comparison,'below');assert.match(ok.reason,/Cenário condicionado/);assert.equal(ok.vat,null);assert.equal(ok.rate,null);assert.match(evaluateValueReview({...input,origin:'effective'},'MZN').reason,/dados efectivos declarados/);
|
||||
for(const patch of [{correctedAmount:''},{correctionRef:''},{correctionScope:''},{correctionDate:'2026-02-30'},{correctionApplies:''}]){const r=evaluateValueReview({...input,...patch},'MZN');assert.equal(r.baseAmount,null);assert.equal(r.comparison,'below');}
|
||||
assert.equal(evaluateValueReview({...input,correctionApplies:'no'},'MZN').status,'not_applicable');assert.equal(evaluateValueReview({...input,referenceAmount:'500'},'MZN').status,'not_applicable');
|
||||
for(const correctedAmount of ['0','900.15','999999999999999.999999'])assert.equal(evaluateValueReview({...input,correctedAmount},'MZN').baseAmount,correctedAmount==='0'?'0.00':correctedAmount);
|
||||
for(const correctedAmount of ['-1','NaN','0.0000001'])assert.equal(evaluateValueReview({...input,correctedAmount},'MZN').baseAmount,null);
|
||||
assert.equal(evaluateValueReview({...row(),declaredAmount:'0',referenceAmount:'0'},'MZN').baseAmount,'0.00');assert.equal(evaluateValueReview({...row(),declaredAmount:'1.000001',referenceAmount:'1.000002'},'MZN').comparison,'below');
|
||||
for(const changed of [switchValueReview(input,'price_comparison'),switchPriceContext(input,'wholesale'),switchValueOrigin(input,'effective')]){assert.equal(changed.correctionApplies,'');for(const field of ['declaredAmount','referenceAmount','correctedAmount','correctionRef','correctionScope'])assert.equal(changed[field],input[field]);}
|
||||
assert.equal(evaluateValueReview(switchValueOrigin(input,'effective'),'MZN').baseAmount,null);assert.equal(evaluateValueReview(switchPriceContext(input,'wholesale'),'MZN').baseAmount,null);
|
||||
});
|
||||
|
||||
test('save/recovery/history/report preserve all85 delivered books/currentkeys including P102/P101/P095',()=>{
|
||||
const d=draft(),prior=JSON.parse(d.modelo_a_snapshot);assert.deepEqual(valueReviewBook(d),{rows:[]});assert.deepEqual(valueReviewReportRows(d),[]);
|
||||
let book=recordValueReviews(d,{rows:valueReviewTreatments.map(t=>({...row(t.id),conditions:{}}))});book=recordValueReviews(d,{...book,rows:valueReviewTreatments.map(t=>({...row(t.id),conditions:{...row(t.id).conditions,referenceCorresponds:'no'}}))});book=recordValueReviews(d,{...book,rows:valueReviewTreatments.map(t=>row(t.id))});assert.equal(book.history.length,2);assert.ok(book.history.every(h=>h.rows.every(r=>r.baseAmount===null&&r.vat===null)));assert.ok(valueReviewCurrent(d,book));
|
||||
for(const field of ['priceContext','declaredAmount','referenceAmount','referenceScope','correctedAmount','correctionRef','correctionScope','correctionApplies','origin'])assert.ok(!valueReviewCurrent(d,{...book,rows:book.rows.map(r=>({...r,[field]:'changed'}))}));for(const patch of [{context_opportunity:'opportunity:347'},{currency:'USD'},{selection_labels:{province_id:'Maputo'}}])assert.ok(!valueReviewCurrent({...d,...patch},book));
|
||||
d.modelo_a_snapshot=saveValueReviewBook(d,book);assert.deepEqual(valueReviewBook(JSON.parse(JSON.stringify(d))),book);const next=JSON.parse(d.modelo_a_snapshot);const{valueReviews,...untouched}=next;assert.deepEqual(untouched,prior);for(const[scope,previous]of Object.entries(prior.considerationExclusions))assert.ok(exclusionCurrent({...d,context_opportunity:scope},previous));for(const[scope,previous]of Object.entries(prior.considerationCompositions))assert.ok(compositionCurrent({...d,context_opportunity:scope},previous));
|
||||
assert.equal(next.considerationExclusions['opportunity:345'].result.rows[0].baseAmount,'799.70');assert.equal(next.considerationCompositions['opportunity:344'].result.rows[0].baseAmount,'1150.60');assert.equal(next.regulatedFuelBases['opportunity:342'].result.rows[0].baseAmount,'1400.15');assert.equal(next.books['opportunity:329'].result.periods[0].fields['11'],null);
|
||||
const report=JSON.stringify(createProjectDossierReport(d,{selectedSections:new Set(['finance']),version:'QA G7H'}));for(const token of ['Base P103','1000.25','1400.75','1500.50','IVA: Indeterminado','opportunity:346','Manica','2026-12','15(7)','condicionado','correcção A','campo11'])assert.ok(report.includes(token),token);assert.deepEqual(valueReviewReportRows({...d,context_opportunity:'opportunity:347'}),[]);
|
||||
if(process.env.IVA_G7H_CALCULATED)fs.writeFileSync(process.env.IVA_G7H_CALCULATED,JSON.stringify(d));
|
||||
});
|
||||
|
||||
test('corrupt review rows/store cannot overwrite originals;duplicateoperationids cannotbe recorded',()=>{
|
||||
const d=draft(),original=d.modelo_a_snapshot;for(const patch of [{declaredAmount:4},{conditions:[]},{correctionScope:null}])assert.throws(()=>saveValueReviewBook(d,{rows:[{...row(),...patch}]}),/originais preservados/);assert.equal(d.modelo_a_snapshot,original);assert.throws(()=>recordValueReviews(d,{rows:[row(),row()]}),/distintos/);assert.throws(()=>recordValueReviews(d,{rows:[]}),/distintos/);assert.throws(()=>valueReviewBook({...d,modelo_a_snapshot:JSON.stringify({...JSON.parse(original),valueReviews:[]})}),/originais preservados/);
|
||||
});
|
||||
Reference in New Issue
Block a user