Compare commits
10
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
df43aeb1e5 | ||
|
|
de4b25bbd7 | ||
|
|
5f088e3411 | ||
|
|
e4c490b323 | ||
|
|
86970cd507 | ||
|
|
2de67bebf9 | ||
|
|
e8b5ae43ad | ||
|
|
0052cd42d2 | ||
|
|
7e6e462e12 | ||
|
|
7a3ac43224 |
@@ -21788,5 +21788,753 @@
|
||||
"rollback_executed": false
|
||||
},
|
||||
"activation": "OnejointGit fast-forward/webhook/installer;zero migrations/imports"
|
||||
},
|
||||
"iva_l1_property_transfers_P087_P127_homologation_20261025": {
|
||||
"status": "installed_delta_verified_partial_L1",
|
||||
"candidate": "d84883b801123664770ab6c69d7e7ddec148e352",
|
||||
"base_installed": "ce9d649fbf631b584cb521ce120c98a4cb459c13",
|
||||
"coverage_complete_branches": {
|
||||
"AUD-SIM-L1-P087": [
|
||||
"binding_lease"
|
||||
],
|
||||
"AUD-SIM-L1-P127": [
|
||||
"business_onerous",
|
||||
"business_free"
|
||||
]
|
||||
},
|
||||
"branch_count_complete": 2,
|
||||
"treatment_count": 3,
|
||||
"QA_example_count": 3,
|
||||
"runtime_delta": [
|
||||
{
|
||||
"path": "resources/js/lib/iva-property-transfers.ts",
|
||||
"sha256_LF": "0d92edaf29b37cbe58f4d60ad3c61756f4cfdf71b8165e47438e9e3d7c59041e"
|
||||
},
|
||||
{
|
||||
"path": "resources/js/components/simulation-property-transfers.tsx",
|
||||
"sha256_LF": "ca2e125cf814ea3f797db9befbccbe6df3d1e9d91118b10af0cd2302e0e307e8"
|
||||
},
|
||||
{
|
||||
"path": "resources/js/components/simulation-monthly-iva.tsx",
|
||||
"sha256_LF": "2b5a10dfd5a180d008403e5fe27333553d95c373c43c3ff629b4a1b4ff44bdfe"
|
||||
},
|
||||
{
|
||||
"path": "resources/js/lib/project-dossier.ts",
|
||||
"sha256_LF": "d59ab0d244d342d3c4167766529499c3cd0cb866e6680c7e4db0508b9c9e62cb"
|
||||
}
|
||||
],
|
||||
"counts_before": {
|
||||
"delivered": 116,
|
||||
"QA": 2,
|
||||
"functional_pending": 14,
|
||||
"documentary": 1,
|
||||
"total": 133
|
||||
},
|
||||
"counts_current": {
|
||||
"delivered": 118,
|
||||
"QA": 0,
|
||||
"functional_pending": 14,
|
||||
"documentary": 1,
|
||||
"total": 133
|
||||
},
|
||||
"counts_after_delivery": {
|
||||
"delivered": 118,
|
||||
"QA": 0,
|
||||
"functional_pending": 14,
|
||||
"documentary": 1,
|
||||
"total": 133
|
||||
},
|
||||
"QA_proofs_reused": [
|
||||
"iva-l1-property-transfers-qa-20261025.json"
|
||||
],
|
||||
"authorization": "Tempo explicitly requests one joint delivery ofd84883b8,P087/P127,preserving concurrent changes and installeddelta only",
|
||||
"scope": "2026;P087baseMZN exacta,classificação pode manter-se com base indeterminada.P127classificação própria de não exigibilidade,sem preencher base/IVA comzero.Sem exigibilidade fiscal calculada,nova dedução,campo11,regularização ou totaisModeloA.P125categoria/elegibilidademargem eP123consignação mantidos separados.",
|
||||
"source": "CIVA Lei13/2016:3(3)a PDF6/p1426(264);3(5) PDF7/p1426(265);15(1) PDF13/p1426(271),páginas visualmente conferidas.Lei22/2022PDF3 mantém15(1);Lei10/2025PDF12 mantém3(3)a/3(5),não altera15.Rectificação2017 sem alteração destas disposições.Acervo seisPDF inventariado/hashes conferidos.",
|
||||
"meaning": {
|
||||
"P087": "Entrega material de bens em execução de contrato de locação com cláusula vinculante para ambas as partes de transferência da propriedade3(3)a. Classificação separada da base15(1):contraprestação obtida/a obter,sem próprioIVA,com composição/âmbito identificados. Não usar15(2)a da consignação,nem transformar mera opção de compra em cláusula vinculante.",
|
||||
"P127": "Cessão onerosa ou gratuita de estabelecimento,totalidade ou parte de património susceptível de constituir ramo independente3(5). Adquirente é ou passa pela aquisição a sujeito passivo2(1)a e pratica operações com direito à dedução. Imposto não devido nem exigível no âmbito demonstrado;não isenção genérica,nem base/taxa zero ou nova dedução. Não impor condição autónoma de continuidade além dos factos da fonte."
|
||||
},
|
||||
"classification_and_scope": "P087 bindinglease3(3)a,base15(1),notconsignment15(2)a;P127onerous/freebusiness3(5),autonomousscope/acquirer2(1)a/deductionactivities;nozero/genericexemption/newdeduction.",
|
||||
"preservation": "116priorclosures andpartialP084/P085 preserved;acceptedperbranchQA reused;one integration/backup/realisolatedrestore/check forwhole set",
|
||||
"partial_P084_P085": "Preparation/conditional simulation only;benefits pending;no closure",
|
||||
"limits": "L1aberto;P00105/06;P121digital/P084/P085pendentes;bebidasL2/L3;Estatísticas/IAadiadas",
|
||||
"containment": "l1-property-transfers-readonly-rollback-20261025.patch,checked only,not applied;blocks newP087/P127calculations,preserves readers/history/otherbranches",
|
||||
"authenticated_preflight": {
|
||||
"installed": {
|
||||
"status": "installed",
|
||||
"commit": "ce9d649fbf631b584cb521ce120c98a4cb459c13",
|
||||
"release": "/var/www/investmoz-homologacao/releases/ce9d649fbf631b584cb521ce120c98a4cb459c13-f7d31a27",
|
||||
"previous_release": "/var/www/investmoz-homologacao/releases/019bcbad6c5a2371e4ca55f7b687447316606fb1-8865b05d",
|
||||
"database_migrations": 0,
|
||||
"content_imports": 0
|
||||
},
|
||||
"current_link": "/var/www/investmoz-homologacao/releases/ce9d649fbf631b584cb521ce120c98a4cb459c13-f7d31a27",
|
||||
"release_revision": {
|
||||
"commit": "ce9d649fbf631b584cb521ce120c98a4cb459c13",
|
||||
"branch": "main",
|
||||
"built_at": "2026-10-24T22:42:39.117961+00:00",
|
||||
"manifest_sha256": "eeab5319e220e8017f0f06e4b4ba2572ccadb5be465cde82d696ac0e64f5ae0c"
|
||||
},
|
||||
"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-property-transfers-delivery-20261025/backup",
|
||||
"target": {
|
||||
"database": "teste_investidor",
|
||||
"port": 5432
|
||||
},
|
||||
"tables": 174,
|
||||
"files_verified": 369,
|
||||
"dump_sha256": "30ce2f710bb55e4222d598277fa92ecce8fc6064e49bca63dff2da128e233c2f",
|
||||
"files_sha256": "13cd195e51574749c71ffff895d20b5d38044e0c38582af8e51e01fca4765540",
|
||||
"restore_verified": false
|
||||
},
|
||||
"restore": {
|
||||
"restore_verified": true,
|
||||
"tables_verified": 174,
|
||||
"container_network": "none",
|
||||
"database": "l1_property_transfers_restore_20261024",
|
||||
"port": 55441,
|
||||
"source_dump_sha256": "30ce2f710bb55e4222d598277fa92ecce8fc6064e49bca63dff2da128e233c2f",
|
||||
"active_database_writes": 0
|
||||
}
|
||||
},
|
||||
"next_dependency_groups_authorized": {
|
||||
"transversal_first": [
|
||||
"P104",
|
||||
"P131",
|
||||
"P132"
|
||||
],
|
||||
"transversal_then": [
|
||||
"P002"
|
||||
],
|
||||
"digital": [
|
||||
"P121",
|
||||
"P130"
|
||||
],
|
||||
"travel_and_events": [
|
||||
"P129",
|
||||
"P133"
|
||||
],
|
||||
"imports_and_benefits": [
|
||||
"P046",
|
||||
"P047",
|
||||
"P058",
|
||||
"P059"
|
||||
],
|
||||
"specific_documentary_nonblocking": [
|
||||
"P084",
|
||||
"P085",
|
||||
"P001"
|
||||
]
|
||||
},
|
||||
"delivery_local_date": "2026-10-25",
|
||||
"delivery_timezone": "Africa/Johannesburg",
|
||||
"served_commit": "92eaa93570b96561a0d2ab60787b7af8171c9529",
|
||||
"installation": {
|
||||
"protected": {
|
||||
"installed": {
|
||||
"status": "installed",
|
||||
"commit": "92eaa93570b96561a0d2ab60787b7af8171c9529",
|
||||
"release": "/var/www/investmoz-homologacao/releases/92eaa93570b96561a0d2ab60787b7af8171c9529-d4d7a2a2",
|
||||
"previous_release": "/var/www/investmoz-homologacao/releases/ce9d649fbf631b584cb521ce120c98a4cb459c13-f7d31a27",
|
||||
"database_migrations": 0,
|
||||
"content_imports": 0
|
||||
},
|
||||
"runtime_files_verified": 4,
|
||||
"persistent_files_and_env_verified": 369,
|
||||
"tables_compared": 174,
|
||||
"changed_tables": {
|
||||
"cache": {
|
||||
"before": {
|
||||
"rows": 106,
|
||||
"checksum": "f2f9da0d12aea236c33cdccfe3bbb124"
|
||||
},
|
||||
"after": {
|
||||
"rows": 106,
|
||||
"checksum": "966c487af6b59f1224527d7c6cfa474d"
|
||||
}
|
||||
},
|
||||
"sessions": {
|
||||
"before": {
|
||||
"rows": 105,
|
||||
"checksum": "486e34e2b2dab1f59fcc403f4b2741d8"
|
||||
},
|
||||
"after": {
|
||||
"rows": 106,
|
||||
"checksum": "e975b8b2e1359ec0273b5ebe826e395d"
|
||||
}
|
||||
}
|
||||
},
|
||||
"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": "92eaa93570b96561a0d2ab60787b7af8171c9529",
|
||||
"branch": "main",
|
||||
"built_at": "2026-10-24T22:52:27.789891+00:00",
|
||||
"manifest_sha256": "52e638801184578d481f490734a4b98f8f557625e81fd942348a2067bfc0f58b"
|
||||
},
|
||||
"manifest_hash_matches": true,
|
||||
"compiled_delta_markers": {
|
||||
"property-transfers/1": [
|
||||
"assets/project-dossier-DUE7gpGm.js"
|
||||
],
|
||||
"binding_lease": [
|
||||
"assets/project-dossier-DUE7gpGm.js",
|
||||
"assets/services-B1VsA-Tn.js"
|
||||
],
|
||||
"business_onerous": [
|
||||
"assets/project-dossier-DUE7gpGm.js"
|
||||
],
|
||||
"business_free": [
|
||||
"assets/project-dossier-DUE7gpGm.js"
|
||||
],
|
||||
"propertyTransfers": [
|
||||
"assets/project-dossier-DUE7gpGm.js"
|
||||
],
|
||||
"materialDelivery": [
|
||||
"assets/project-dossier-DUE7gpGm.js"
|
||||
],
|
||||
"bindingProperty": [
|
||||
"assets/project-dossier-DUE7gpGm.js"
|
||||
],
|
||||
"autonomousBusiness": [
|
||||
"assets/project-dossier-DUE7gpGm.js"
|
||||
],
|
||||
"acquirer2a": [
|
||||
"assets/project-dossier-DUE7gpGm.js"
|
||||
],
|
||||
"deductionActivities": [
|
||||
"assets/project-dossier-DUE7gpGm.js"
|
||||
],
|
||||
"contractRef": [
|
||||
"assets/project-dossier-DUE7gpGm.js",
|
||||
"assets/services-B1VsA-Tn.js"
|
||||
],
|
||||
"propertyClauseRef": [
|
||||
"assets/project-dossier-DUE7gpGm.js",
|
||||
"assets/services-B1VsA-Tn.js"
|
||||
],
|
||||
"acquirerRef": [
|
||||
"assets/project-dossier-DUE7gpGm.js",
|
||||
"assets/services-B1VsA-Tn.js"
|
||||
],
|
||||
"autonomousRef": [
|
||||
"assets/project-dossier-DUE7gpGm.js",
|
||||
"assets/services-B1VsA-Tn.js"
|
||||
],
|
||||
"activitiesRef": [
|
||||
"assets/project-dossier-DUE7gpGm.js",
|
||||
"assets/services-B1VsA-Tn.js"
|
||||
],
|
||||
"considerationRef": [
|
||||
"assets/project-dossier-DUE7gpGm.js",
|
||||
"assets/services-B1VsA-Tn.js"
|
||||
],
|
||||
"compositionConfirmed": [
|
||||
"assets/project-dossier-DUE7gpGm.js",
|
||||
"assets/services-B1VsA-Tn.js"
|
||||
],
|
||||
"goods_transmission": [
|
||||
"assets/project-dossier-DUE7gpGm.js"
|
||||
],
|
||||
"tax_not_exigible_3_5": [
|
||||
"assets/project-dossier-DUE7gpGm.js"
|
||||
],
|
||||
"consideration": [
|
||||
"assets/project-dossier-DUE7gpGm.js",
|
||||
"assets/services-B1VsA-Tn.js"
|
||||
]
|
||||
},
|
||||
"assets": [
|
||||
{
|
||||
"file": "assets/project-dossier-document-Cq8oizup.js",
|
||||
"status": 200,
|
||||
"sha256": "27777ad09c9517041644bb2b7bfcd7f7058e4f6b0c1eec22722f3250aac3c7c9"
|
||||
},
|
||||
{
|
||||
"file": "assets/project-dossier-DUE7gpGm.js",
|
||||
"status": 200,
|
||||
"sha256": "2fc2015b97935391a9db425d0a3431dcc9f1792d82053b97ffcefa31e2acabb3"
|
||||
},
|
||||
{
|
||||
"file": "assets/simulation-form-CPZAFZU3.js",
|
||||
"status": 200,
|
||||
"sha256": "c6bcf64e60a5eeac0cafe3dc055dc5544162f21942ee08b34d51bc6d52947567"
|
||||
},
|
||||
{
|
||||
"file": "assets/services-B1VsA-Tn.js",
|
||||
"status": 200,
|
||||
"sha256": "592b0a0dcb6b7338a9109238c89ce63630546fb92d7be213c49d28752574120e"
|
||||
}
|
||||
],
|
||||
"simulator_status": 200,
|
||||
"simulator_entry": "assets/app-Nmu2R55A.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": "92eaa93570b96561a0d2ab60787b7af8171c9529",
|
||||
"release": "/var/www/investmoz-homologacao/releases/92eaa93570b96561a0d2ab60787b7af8171c9529-d4d7a2a2",
|
||||
"previous_release": "/var/www/investmoz-homologacao/releases/ce9d649fbf631b584cb521ce120c98a4cb459c13-f7d31a27",
|
||||
"database_migrations": 0,
|
||||
"content_imports": 0
|
||||
},
|
||||
"latest_report": {
|
||||
"status": "installed",
|
||||
"commit": "92eaa93570b96561a0d2ab60787b7af8171c9529",
|
||||
"release": "/var/www/investmoz-homologacao/releases/92eaa93570b96561a0d2ab60787b7af8171c9529-d4d7a2a2",
|
||||
"previous_release": "/var/www/investmoz-homologacao/releases/ce9d649fbf631b584cb521ce120c98a4cb459c13-f7d31a27",
|
||||
"database_migrations": 0,
|
||||
"content_imports": 0,
|
||||
"requested_commits": [
|
||||
"92eaa93570b96561a0d2ab60787b7af8171c9529"
|
||||
],
|
||||
"finished_at": "2026-10-24T22:52:30.469110+00:00"
|
||||
},
|
||||
"log_file": "1792882239391904096.log",
|
||||
"summaries": [
|
||||
"OK (1 test, 3106 assertions)",
|
||||
"built in 27.57s",
|
||||
"OK (59 tests, 317 assertions)",
|
||||
"# tests 444",
|
||||
"# pass 444",
|
||||
"# fail 0"
|
||||
],
|
||||
"log_bytes": 153295
|
||||
},
|
||||
"rollback_executed": false
|
||||
},
|
||||
"activation": "OnejointGit fast-forward/webhook/installer;zero migrations/imports"
|
||||
},
|
||||
"iva_l1_currency_events_P131_P132_partial_P104_homologation_20261025": {
|
||||
"status": "installed_P131_P132_partial_P104_delta_verified_L1_open",
|
||||
"candidate": "0052cd42d2755753b7e54257db05df8fbd9f08bc",
|
||||
"base_installed": "92eaa93570b96561a0d2ab60787b7af8171c9529",
|
||||
"coverage_complete_branches": {
|
||||
"AUD-SIM-L1-P131": [
|
||||
"goods_available",
|
||||
"goods_transport",
|
||||
"goods_installation",
|
||||
"service_completed",
|
||||
"service_early_charge",
|
||||
"import_clearance",
|
||||
"import_auction",
|
||||
"continuous_period",
|
||||
"contract_effects"
|
||||
],
|
||||
"AUD-SIM-L1-P132": [
|
||||
"own_goods",
|
||||
"own_services",
|
||||
"commission_delivery",
|
||||
"consignment_deadline",
|
||||
"advance_payment"
|
||||
]
|
||||
},
|
||||
"coverage_partial": {
|
||||
"AUD-SIM-L1-P104": "Preparação e simulação cambial condicionada,gravação/recuperação/histórico/relatório;moeda original,taxa,direcção,data,fonte e pressuposto explícitos. Não fechaP104 e não confirma base fiscal. Falta obter/cotejar disposição de conversão da Lei2/2006 referida em15(8),seu momento/regra e correspondência em2026."
|
||||
},
|
||||
"branch_count_complete": 2,
|
||||
"event_treatment_count": 14,
|
||||
"conditional_scenario_count": 1,
|
||||
"runtime_delta": [
|
||||
{
|
||||
"path": "resources/js/lib/iva-currency-events.ts",
|
||||
"sha256_LF": "7133d1df2cf4171495bd145f5b8350938f0a3b4230af824c223d2b03cf0d9bb1"
|
||||
},
|
||||
{
|
||||
"path": "resources/js/components/simulation-currency-events.tsx",
|
||||
"sha256_LF": "d103234361d57d0461d19a0f1fb9cbc5a714dbd566000478fad9aced585f32fa"
|
||||
},
|
||||
{
|
||||
"path": "resources/js/components/simulation-monthly-iva.tsx",
|
||||
"sha256_LF": "44901ef5fc9def8ebd6c251d4af65f36a1cb330f5ed7d44db4a52d98753f18ff"
|
||||
},
|
||||
{
|
||||
"path": "resources/js/lib/project-dossier.ts",
|
||||
"sha256_LF": "1712be726c868d182a2ddf405331dcc1f55bf0c3ce72ad32ab758c15afef2f4a"
|
||||
},
|
||||
{
|
||||
"path": "resources/js/lib/business-financial-plan.ts",
|
||||
"sha256_LF": "c20274722d1ffcd0360f041a6cacb5d868fe0621cb27a1aca6e06826612c3ebb"
|
||||
}
|
||||
],
|
||||
"counts_before": {
|
||||
"delivered": 118,
|
||||
"QA": 2,
|
||||
"functional_pending": 12,
|
||||
"documentary": 1,
|
||||
"total": 133
|
||||
},
|
||||
"counts_current": {
|
||||
"delivered": 120,
|
||||
"QA": 0,
|
||||
"functional_pending": 12,
|
||||
"documentary": 1,
|
||||
"total": 133
|
||||
},
|
||||
"counts_after_delivery": {
|
||||
"delivered": 120,
|
||||
"QA": 0,
|
||||
"functional_pending": 12,
|
||||
"documentary": 1,
|
||||
"total": 133
|
||||
},
|
||||
"QA_proofs_reused": [
|
||||
"iva-l1-currency-events-qa-20261025.json"
|
||||
],
|
||||
"authorization": "Tempo explicitly requests one joint delivery0052cd42/P131/P132;P104 may accompany only as conditionalconversion,notfiscalclosure;concurrentchanges preserved,installeddeltaonly",
|
||||
"scope": "2026contexto;facto gerador7 e exigibilidade8 por data/âmbito;uma parcela de recebimento e restante por linha,ou parcelas de âmbitos distintos,sem agregação de totais entre linhas. Prazo de emissão é parâmetro legal identificado,não calendário presumido;importação segue7c. P104parcial não aplica câmbio fiscal.Sem nova base/IVA,taxa,dedução,campo11,regularização ou totaisModeloA;P133regimes suspensivos/viagens mantém âmbito separado.",
|
||||
"source": "CIVA Lei13/2016:7(1)–(7),PDF8/p1426(266);8,PDF9/p1426(267);15(8),PDF14/p1426(272),páginas visualmente conferidas.Lei22/2022 eLei10/2025 não alteram7/8;15(8)mantido.RIVADecreto7/2008,21,PDF4:regra histórica5dias úteis e excepções;prazo actual não automatizado,exige disposição/calendário/âmbito identificados.",
|
||||
"meaning": {
|
||||
"P131": "Eventos7(1)a/b/c,7(2),7(3),7(7):disponibilização,início transporte,instalação/montagem concluída,serviço realizado/cobrado ou debitado antecipadamente pelo montante respectivo,desembaraço/arrematação/venda na importação,termo do período sucessivo,efeitos translativos com excepções3(3)a/b. Facto gerador separado de exigibilidade8;factura comercial não desloca evento aduaneiro.",
|
||||
"P132": "Eventos7(4)/(5)/(6) e8c:afectações/transmissões assimiladas3(3)e/f,serviços4(2),disponibilização pelo comissário,termo180dias de mercadorias à consignação3(3)d e pagamentos anteriores à factura. Corrigida remissão a consignação,não embalagensP102.8a/b/c separam parcela recebida e restante,sem dupla contagem."
|
||||
},
|
||||
"P104_partial_condition": "Conversão condicionada,sem base fiscal confirmada.Preserva moeda,taxa,direcção,data,fonte e regra/pressuposto.Exemplar/disposição cambialLei2/2006 deve ser cotejado antes de fecharP104.P104continua nos12pendentes.",
|
||||
"documentary_research_delimited": {
|
||||
"P104": {
|
||||
"finding": "Remissão15(8) para Lei2/2006 identificada;artigo de conversão e parâmetros ainda não cotejados em exemplar íntegro.",
|
||||
"attempts": [
|
||||
"Acervo local seisPDF semLei2/2006",
|
||||
"Pesquisa Lei2/2006/CIP identificaBR12-I22/03/2006",
|
||||
"PDF primário platformchinaplp devolveu404;DLA recusou/timeout;archiveBR2006 devolveu403"
|
||||
],
|
||||
"next_action": "Obter exemplar íntegroLei2/2006 e identificar disposição de conversão/momento/regra;reutilizar rascunhos,sem validação jurídica genérica."
|
||||
},
|
||||
"RIVA21": {
|
||||
"primary_notice": "https://portaldogoverno.gov.mz/governo-introduz-alteracoes-nos-regulamentos-fiscais-para-reforcar-eficiencia-tributaria/",
|
||||
"finding": "Anúncio governamental inclui alteração21;anúncio não substitui texto normativo/publicação. Prazo não presumido5dias úteis por defeito;campo exige termo/disposição/calendário aplicáveis.",
|
||||
"next_action": "Localizar texto publicado da alteração21 para eventual automatização do prazo;motor8já opera com parâmetro concreto identificado."
|
||||
}
|
||||
},
|
||||
"preservation": "118priorclosures andpartialP084/P085 preserved;one integration/backup/realisolatedrestore/check;QAproofsreused",
|
||||
"partial_P084_P085": "Preparation/conditional simulation only;benefits pending;no closure",
|
||||
"limits": "L1aberto;P00105/06;bebidasL2/L3;Estatísticas/IAadiadas",
|
||||
"containment": "l1-currency-events-readonly-rollback-20261025.patch,checked only,not applied;blocks newP131/P132/conditionalP104calculations,preserves readers/history/otherbranches",
|
||||
"authenticated_preflight": {
|
||||
"installed": {
|
||||
"status": "installed",
|
||||
"commit": "92eaa93570b96561a0d2ab60787b7af8171c9529",
|
||||
"release": "/var/www/investmoz-homologacao/releases/92eaa93570b96561a0d2ab60787b7af8171c9529-d4d7a2a2",
|
||||
"previous_release": "/var/www/investmoz-homologacao/releases/ce9d649fbf631b584cb521ce120c98a4cb459c13-f7d31a27",
|
||||
"database_migrations": 0,
|
||||
"content_imports": 0
|
||||
},
|
||||
"current_link": "/var/www/investmoz-homologacao/releases/92eaa93570b96561a0d2ab60787b7af8171c9529-d4d7a2a2",
|
||||
"release_revision": {
|
||||
"commit": "92eaa93570b96561a0d2ab60787b7af8171c9529",
|
||||
"branch": "main",
|
||||
"built_at": "2026-10-24T22:52:27.789891+00:00",
|
||||
"manifest_sha256": "52e638801184578d481f490734a4b98f8f557625e81fd942348a2067bfc0f58b"
|
||||
},
|
||||
"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-currency-events-delivery-20261025/backup",
|
||||
"target": {
|
||||
"database": "teste_investidor",
|
||||
"port": 5432
|
||||
},
|
||||
"tables": 174,
|
||||
"files_verified": 369,
|
||||
"dump_sha256": "3bf9ce6052b554884fc9073ef094df83e4061a4acf9698aa4b86746372a933b3",
|
||||
"files_sha256": "bfdc60b76ce1da29199eeb9f21503350c94da165ba2458fcb26f57c96bde995b",
|
||||
"restore_verified": false
|
||||
},
|
||||
"restore": {
|
||||
"restore_verified": true,
|
||||
"tables_verified": 174,
|
||||
"container_network": "none",
|
||||
"database": "l1_currency_events_restore_20261024",
|
||||
"port": 55441,
|
||||
"source_dump_sha256": "3bf9ce6052b554884fc9073ef094df83e4061a4acf9698aa4b86746372a933b3",
|
||||
"active_database_writes": 0
|
||||
}
|
||||
},
|
||||
"delivery_local_date": "2026-10-25",
|
||||
"delivery_timezone": "Africa/Johannesburg",
|
||||
"served_commit": "e8b5ae43add95be3a7fd437e4488befce76c0a97",
|
||||
"installation": {
|
||||
"protected": {
|
||||
"installed": {
|
||||
"status": "installed",
|
||||
"commit": "e8b5ae43add95be3a7fd437e4488befce76c0a97",
|
||||
"release": "/var/www/investmoz-homologacao/releases/e8b5ae43add95be3a7fd437e4488befce76c0a97-7ad802df",
|
||||
"previous_release": "/var/www/investmoz-homologacao/releases/92eaa93570b96561a0d2ab60787b7af8171c9529-d4d7a2a2",
|
||||
"database_migrations": 0,
|
||||
"content_imports": 0
|
||||
},
|
||||
"runtime_files_verified": 5,
|
||||
"persistent_files_and_env_verified": 369,
|
||||
"tables_compared": 174,
|
||||
"changed_tables": {
|
||||
"cache": {
|
||||
"before": {
|
||||
"rows": 106,
|
||||
"checksum": "9ffc4c728b779ae65422ece807e747ce"
|
||||
},
|
||||
"after": {
|
||||
"rows": 106,
|
||||
"checksum": "eb794d5a5c04b738022d307f04aa5885"
|
||||
}
|
||||
},
|
||||
"sessions": {
|
||||
"before": {
|
||||
"rows": 108,
|
||||
"checksum": "6acbafdd2b5cb8f5388e4c45e1c1ec95"
|
||||
},
|
||||
"after": {
|
||||
"rows": 109,
|
||||
"checksum": "591338e88d2ef2a58a2c1954e7302167"
|
||||
}
|
||||
}
|
||||
},
|
||||
"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": "e8b5ae43add95be3a7fd437e4488befce76c0a97",
|
||||
"branch": "main",
|
||||
"built_at": "2026-10-24T23:06:53.694897+00:00",
|
||||
"manifest_sha256": "8679ad3c79f08e7a9505fcff3d72821c924048cb8188c80bb0ad1332adedf248"
|
||||
},
|
||||
"manifest_hash_matches": true,
|
||||
"compiled_delta_markers": {
|
||||
"currency-events/1": [
|
||||
"assets/project-dossier-BNIZIALo.js"
|
||||
],
|
||||
"foreign_scenario": [
|
||||
"assets/project-dossier-BNIZIALo.js",
|
||||
"assets/services-D8qtC6wy.js"
|
||||
],
|
||||
"goods_available": [
|
||||
"assets/project-dossier-BNIZIALo.js"
|
||||
],
|
||||
"goods_transport": [
|
||||
"assets/project-dossier-BNIZIALo.js"
|
||||
],
|
||||
"goods_installation": [
|
||||
"assets/project-dossier-BNIZIALo.js"
|
||||
],
|
||||
"service_completed": [
|
||||
"assets/project-dossier-BNIZIALo.js"
|
||||
],
|
||||
"service_early_charge": [
|
||||
"assets/project-dossier-BNIZIALo.js",
|
||||
"assets/services-D8qtC6wy.js"
|
||||
],
|
||||
"import_clearance": [
|
||||
"assets/project-dossier-BNIZIALo.js",
|
||||
"assets/services-D8qtC6wy.js"
|
||||
],
|
||||
"import_auction": [
|
||||
"assets/project-dossier-BNIZIALo.js",
|
||||
"assets/services-D8qtC6wy.js"
|
||||
],
|
||||
"continuous_period": [
|
||||
"assets/project-dossier-BNIZIALo.js",
|
||||
"assets/services-D8qtC6wy.js"
|
||||
],
|
||||
"contract_effects": [
|
||||
"assets/project-dossier-BNIZIALo.js",
|
||||
"assets/services-D8qtC6wy.js"
|
||||
],
|
||||
"own_goods": [
|
||||
"assets/project-dossier-BNIZIALo.js"
|
||||
],
|
||||
"own_services": [
|
||||
"assets/project-dossier-BNIZIALo.js"
|
||||
],
|
||||
"commission_delivery": [
|
||||
"assets/project-dossier-BNIZIALo.js"
|
||||
],
|
||||
"consignment_deadline": [
|
||||
"assets/project-dossier-BNIZIALo.js",
|
||||
"assets/services-D8qtC6wy.js"
|
||||
],
|
||||
"advance_payment": [
|
||||
"assets/project-dossier-BNIZIALo.js",
|
||||
"assets/services-D8qtC6wy.js"
|
||||
],
|
||||
"currencyEvents": [
|
||||
"assets/project-dossier-BNIZIALo.js"
|
||||
],
|
||||
"dueEvents": [
|
||||
"assets/project-dossier-BNIZIALo.js"
|
||||
],
|
||||
"scenarioAmount": [
|
||||
"assets/project-dossier-BNIZIALo.js"
|
||||
],
|
||||
"mzn_per_unit": [
|
||||
"assets/project-dossier-BNIZIALo.js",
|
||||
"assets/services-D8qtC6wy.js"
|
||||
],
|
||||
"units_per_mzn": [
|
||||
"assets/project-dossier-BNIZIALo.js",
|
||||
"assets/services-D8qtC6wy.js"
|
||||
],
|
||||
"fxRuleRef": [
|
||||
"assets/project-dossier-BNIZIALo.js",
|
||||
"assets/services-D8qtC6wy.js"
|
||||
],
|
||||
"conversão apenas cenário condicionado": [
|
||||
"assets/project-dossier-BNIZIALo.js"
|
||||
],
|
||||
"sem base fiscal confirmada": [
|
||||
"assets/project-dossier-BNIZIALo.js"
|
||||
]
|
||||
},
|
||||
"assets": [
|
||||
{
|
||||
"file": "assets/simulation-form-BqVD91Ek.js",
|
||||
"status": 200,
|
||||
"sha256": "85cbd533c5bc92af5a448db71da006d4346d2d0adb09dde825db0aa19ad5048c"
|
||||
},
|
||||
{
|
||||
"file": "assets/project-dossier-BNIZIALo.js",
|
||||
"status": 200,
|
||||
"sha256": "4f735b3ce4315b6fc87afb9f8e30774e9dc664073fa775da9cec640eaa6f0fde"
|
||||
},
|
||||
{
|
||||
"file": "assets/services-D8qtC6wy.js",
|
||||
"status": 200,
|
||||
"sha256": "240800ef9ba1c338ac6ceb6f6dbbffce11ce02f8bb52ce385c901632f1d6b681"
|
||||
},
|
||||
{
|
||||
"file": "assets/project-dossier-document-CM7oUIMz.js",
|
||||
"status": 200,
|
||||
"sha256": "2a62e4f6e2d7b8058feb67cef817e2d677150e149a3ffe56d6c38120f810634d"
|
||||
}
|
||||
],
|
||||
"simulator_status": 200,
|
||||
"simulator_entry": "assets/app-DwkwtDdx.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": "e8b5ae43add95be3a7fd437e4488befce76c0a97",
|
||||
"release": "/var/www/investmoz-homologacao/releases/e8b5ae43add95be3a7fd437e4488befce76c0a97-7ad802df",
|
||||
"previous_release": "/var/www/investmoz-homologacao/releases/92eaa93570b96561a0d2ab60787b7af8171c9529-d4d7a2a2",
|
||||
"database_migrations": 0,
|
||||
"content_imports": 0
|
||||
},
|
||||
"latest_report": {
|
||||
"status": "installed",
|
||||
"commit": "e8b5ae43add95be3a7fd437e4488befce76c0a97",
|
||||
"release": "/var/www/investmoz-homologacao/releases/e8b5ae43add95be3a7fd437e4488befce76c0a97-7ad802df",
|
||||
"previous_release": "/var/www/investmoz-homologacao/releases/92eaa93570b96561a0d2ab60787b7af8171c9529-d4d7a2a2",
|
||||
"database_migrations": 0,
|
||||
"content_imports": 0,
|
||||
"requested_commits": [
|
||||
"e8b5ae43add95be3a7fd437e4488befce76c0a97"
|
||||
],
|
||||
"finished_at": "2026-10-24T23:06:56.387937+00:00"
|
||||
},
|
||||
"log_file": "1792883102945866022.log",
|
||||
"summaries": [
|
||||
"OK (1 test, 3106 assertions)",
|
||||
"built in 27.52s",
|
||||
"OK (59 tests, 317 assertions)",
|
||||
"# tests 463",
|
||||
"# pass 463",
|
||||
"# fail 0"
|
||||
],
|
||||
"log_bytes": 156709
|
||||
},
|
||||
"rollback_executed": false
|
||||
},
|
||||
"activation": "OnejointGit fast-forward/webhook/installer;zero migrations/imports",
|
||||
"P104_closure": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,232 @@
|
||||
{
|
||||
"implementation_commit": "7e6e462e12a50aab6ba0043740ffeecb414cbedf",
|
||||
"status": "delivered_P131_P132_partial_P104_QA_proofs_preserved",
|
||||
"coverage": {
|
||||
"AUD-SIM-L1-P131": [
|
||||
"goods_available",
|
||||
"goods_transport",
|
||||
"goods_installation",
|
||||
"service_completed",
|
||||
"service_early_charge",
|
||||
"import_clearance",
|
||||
"import_auction",
|
||||
"continuous_period",
|
||||
"contract_effects"
|
||||
],
|
||||
"AUD-SIM-L1-P132": [
|
||||
"own_goods",
|
||||
"own_services",
|
||||
"commission_delivery",
|
||||
"consignment_deadline",
|
||||
"advance_payment"
|
||||
]
|
||||
},
|
||||
"coverage_partial": {
|
||||
"AUD-SIM-L1-P104": "Preparação e simulação cambial condicionada,gravação/recuperação/histórico/relatório;moeda original,taxa,direcção,data,fonte e pressuposto explícitos. Não fechaP104 e não confirma base fiscal. Falta obter/cotejar disposição de conversão da Lei2/2006 referida em15(8),seu momento/regra e correspondência em2026."
|
||||
},
|
||||
"branch_count_complete": 2,
|
||||
"event_treatment_count": 14,
|
||||
"conditional_scenario_count": 1,
|
||||
"source": "CIVA Lei13/2016:7(1)–(7),PDF8/p1426(266);8,PDF9/p1426(267);15(8),PDF14/p1426(272),páginas visualmente conferidas.Lei22/2022 eLei10/2025 não alteram7/8;15(8)mantido.RIVADecreto7/2008,21,PDF4:regra histórica5dias úteis e excepções;prazo actual não automatizado,exige disposição/calendário/âmbito identificados.",
|
||||
"meaning": {
|
||||
"P131": "Eventos7(1)a/b/c,7(2),7(3),7(7):disponibilização,início transporte,instalação/montagem concluída,serviço realizado/cobrado ou debitado antecipadamente pelo montante respectivo,desembaraço/arrematação/venda na importação,termo do período sucessivo,efeitos translativos com excepções3(3)a/b. Facto gerador separado de exigibilidade8;factura comercial não desloca evento aduaneiro.",
|
||||
"P132": "Eventos7(4)/(5)/(6) e8c:afectações/transmissões assimiladas3(3)e/f,serviços4(2),disponibilização pelo comissário,termo180dias de mercadorias à consignação3(3)d e pagamentos anteriores à factura. Corrigida remissão a consignação,não embalagensP102.8a/b/c separam parcela recebida e restante,sem dupla contagem."
|
||||
},
|
||||
"scope": "2026contexto;facto gerador7 e exigibilidade8 por data/âmbito;uma parcela de recebimento e restante por linha,ou parcelas de âmbitos distintos,sem agregação de totais entre linhas. Prazo de emissão é parâmetro legal identificado,não calendário presumido;importação segue7c. P104parcial não aplica câmbio fiscal.Sem nova base/IVA,taxa,dedução,campo11,regularização ou totaisModeloA;P133regimes suspensivos/viagens mantém âmbito separado.",
|
||||
"documentary_research_delimited": {
|
||||
"P104": {
|
||||
"finding": "Remissão15(8) para Lei2/2006 identificada;artigo de conversão e parâmetros ainda não cotejados em exemplar íntegro.",
|
||||
"attempts": [
|
||||
"Acervo local seisPDF semLei2/2006",
|
||||
"Pesquisa Lei2/2006/CIP identificaBR12-I22/03/2006",
|
||||
"PDF primário platformchinaplp devolveu404;DLA recusou/timeout;archiveBR2006 devolveu403"
|
||||
],
|
||||
"next_action": "Obter exemplar íntegroLei2/2006 e identificar disposição de conversão/momento/regra;reutilizar rascunhos,sem validação jurídica genérica."
|
||||
},
|
||||
"RIVA21": {
|
||||
"primary_notice": "https://portaldogoverno.gov.mz/governo-introduz-alteracoes-nos-regulamentos-fiscais-para-reforcar-eficiencia-tributaria/",
|
||||
"finding": "Anúncio governamental inclui alteração21;anúncio não substitui texto normativo/publicação. Prazo não presumido5dias úteis por defeito;campo exige termo/disposição/calendário aplicáveis.",
|
||||
"next_action": "Localizar texto publicado da alteração21 para eventual automatização do prazo;motor8já opera com parâmetro concreto identificado."
|
||||
}
|
||||
},
|
||||
"technical_choices": "currencyEvents poroportunidade nosnapshot/API/dossier existentes. Exporta/reutiliza convertCents já existente,no mesmo algoritmo,sem alteração dos cálculos financeiros anteriores;BigInt6casas/taxa8casas,arredondamento de cenário à6. DatasUTC/histórico existentes;nenhum relógioactual/taxacorrente ou feriado por defeito. Alterações de percurso conservam campos ocultos e exigem rever confirmações.",
|
||||
"verification": {
|
||||
"frontend": {
|
||||
"tests": 19,
|
||||
"passed": 19,
|
||||
"failed": 0,
|
||||
"coverage": "15percursos/exemplos:14eventos+1câmbiocondicionado;factura pontual/tardia/ausente,pagamento parcial/integral,termo prazo,restantependente,eventofuturo/pagamento anterior,importação7c,consignação180dias,moedainversa/arredondamento/parametros;persistência/histórico/relatório/preservação"
|
||||
},
|
||||
"privateAPI": {
|
||||
"tests": 1,
|
||||
"assertions": 65,
|
||||
"target": "simulator_fiscal_delta_20261021_test:55441",
|
||||
"transaction_rollback": true,
|
||||
"xml": "C:\\laragon\\www\\portal-investidor\\outputs\\iva-l1-currency-events-20261025\\phpunit.xml"
|
||||
},
|
||||
"types": "passed",
|
||||
"build": "passed;existingplugin timingwarnings",
|
||||
"UI": "Edge/CUA:referência prazo vazia conserva facto gerador e deixa exigibilidade indeterminada;restauro egravação/recuperação/relatório.Fixturefinal regenerada após separarimportação7c;15linhas/1versãoanterior,P104conditional64500MZN/P132pagamento200+restante800,importação2026-12-10.Dadossintéticos,nãoaceitaçãomanualTempo.",
|
||||
"UI_screenshot": "C:\\laragon\\www\\portal-investidor\\outputs\\iva-l1-currency-events-20261025\\qa-recovered-report.png"
|
||||
},
|
||||
"preservation": {
|
||||
"base": "7a3ac43224843f0f39900645bc901475275b18be",
|
||||
"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-P087",
|
||||
"AUD-SIM-L1-P088",
|
||||
"AUD-SIM-L1-P089",
|
||||
"AUD-SIM-L1-P090",
|
||||
"AUD-SIM-L1-P091",
|
||||
"AUD-SIM-L1-P092",
|
||||
"AUD-SIM-L1-P093",
|
||||
"AUD-SIM-L1-P094",
|
||||
"AUD-SIM-L1-P095",
|
||||
"AUD-SIM-L1-P096",
|
||||
"AUD-SIM-L1-P097",
|
||||
"AUD-SIM-L1-P098",
|
||||
"AUD-SIM-L1-P099",
|
||||
"AUD-SIM-L1-P100",
|
||||
"AUD-SIM-L1-P101",
|
||||
"AUD-SIM-L1-P102",
|
||||
"AUD-SIM-L1-P103",
|
||||
"AUD-SIM-L1-P105",
|
||||
"AUD-SIM-L1-P106",
|
||||
"AUD-SIM-L1-P107",
|
||||
"AUD-SIM-L1-P108",
|
||||
"AUD-SIM-L1-P109",
|
||||
"AUD-SIM-L1-P110",
|
||||
"AUD-SIM-L1-P111",
|
||||
"AUD-SIM-L1-P112",
|
||||
"AUD-SIM-L1-P113",
|
||||
"AUD-SIM-L1-P114",
|
||||
"AUD-SIM-L1-P115",
|
||||
"AUD-SIM-L1-P116",
|
||||
"AUD-SIM-L1-P117",
|
||||
"AUD-SIM-L1-P118",
|
||||
"AUD-SIM-L1-P119",
|
||||
"AUD-SIM-L1-P120",
|
||||
"AUD-SIM-L1-P122",
|
||||
"AUD-SIM-L1-P123",
|
||||
"AUD-SIM-L1-P124",
|
||||
"AUD-SIM-L1-P125",
|
||||
"AUD-SIM-L1-P126",
|
||||
"AUD-SIM-L1-P127",
|
||||
"AUD-SIM-L1-P128"
|
||||
],
|
||||
"confirmed_losses": [],
|
||||
"accepted_delivery": "92eaa935/7a3ac432;174tables/369files;29published/28relations/408geometries;code/schema/data/config/permissions compared",
|
||||
"frozen": "tests\\frontend\\fixtures\\iva-currency-events-preserved.json",
|
||||
"sha256": "79972e699d32cea2be74f36c244825e47c63d20e6d1d3c14052ba564c4a63c93",
|
||||
"scope": "P104partial/P131/P132QA;allpriorbooks/history immutable;noactivewrites"
|
||||
},
|
||||
"runtime_delta": {
|
||||
"resources/js/lib/iva-currency-events.ts": "7133d1df2cf4171495bd145f5b8350938f0a3b4230af824c223d2b03cf0d9bb1",
|
||||
"resources/js/components/simulation-currency-events.tsx": "d103234361d57d0461d19a0f1fb9cbc5a714dbd566000478fad9aced585f32fa",
|
||||
"resources/js/components/simulation-monthly-iva.tsx": "44901ef5fc9def8ebd6c251d4af65f36a1cb330f5ed7d44db4a52d98753f18ff",
|
||||
"resources/js/lib/project-dossier.ts": "1712be726c868d182a2ddf405331dcc1f55bf0c3ce72ad32ab758c15afef2f4a",
|
||||
"resources/js/lib/business-financial-plan.ts": "c20274722d1ffcd0360f041a6cacb5d868fe0621cb27a1aca6e06826612c3ebb"
|
||||
},
|
||||
"counts_current": {
|
||||
"delivered": 118,
|
||||
"QA": 2,
|
||||
"functional_pending": 12,
|
||||
"P001": 1,
|
||||
"total": 133
|
||||
},
|
||||
"homologation_unchanged": "92eaa935",
|
||||
"remaining": "Entrega conjuntaP131/P132;P104incluídoapenascomopreparação/simulaçãocondicionada,seconstarnomanifesto,nãofecho. RestamP002/P046/P047/P058/P059/P084/P085/P104/P121/P129/P130/P133comimpedimentosnamesmamatriz.",
|
||||
"limits": "L1aberto;P00105/06;bebidasL2/L3;Estatísticas/IAadiadas",
|
||||
"sources_inventory": "C:\\laragon\\www\\portal-investidor\\outputs\\iva-l1-currency-events-20261025\\source-archive-inventory.json",
|
||||
"qa_status_preserved": "QA_complete_P131_P132_partial_P104_not_delivered",
|
||||
"delivery_followup": {
|
||||
"served_commit": "e8b5ae43add95be3a7fd437e4488befce76c0a97",
|
||||
"receipt": "l1-currency-events-delivery-20261025.json",
|
||||
"record": "iva_l1_currency_events_P131_P132_partial_P104_homologation_20261025",
|
||||
"counts": {
|
||||
"delivered": 120,
|
||||
"QA": 0,
|
||||
"functional_pending": 12,
|
||||
"documentary": 1,
|
||||
"total": 133
|
||||
},
|
||||
"P104_closure": false
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
{
|
||||
"implementation_commit": "5f088e341125124077bc420a0b1c8ef0e8c28173",
|
||||
"status": "QA_complete_P121_P130_not_delivered",
|
||||
"coverage": {
|
||||
"AUD-SIM-L1-P121": [
|
||||
"web",
|
||||
"software_service",
|
||||
"information",
|
||||
"media",
|
||||
"teaching",
|
||||
"analogous"
|
||||
],
|
||||
"AUD-SIM-L1-P130": [
|
||||
"software_asset",
|
||||
"content_asset",
|
||||
"data_asset",
|
||||
"crypto_asset",
|
||||
"ebook_asset",
|
||||
"profile_asset",
|
||||
"access_asset",
|
||||
"other_asset"
|
||||
]
|
||||
},
|
||||
"branch_count_complete": 2,
|
||||
"treatment_count": 14,
|
||||
"standard_examples": 42,
|
||||
"additional_examples": 4,
|
||||
"source": "Lei10/2025, localPDF12–14/p2180(12–14),3(2)/(7),6(7)k/(8)/(9),23(2),25(7),26(4),32(1)c,33(2); Lei13/2016 localPDF8/p1426(266),6(7)k i–v, ePDF17/p1426(275),26(1–3). Páginas visualmente conferidas. Inventário de sete exemplares com hash preservado.",
|
||||
"source_link": "https://miramar.co.mz/wp-content/uploads/2026/01/Tax_Update_Key_Amendments_to_Mozambican_Tax_Legislation_1767376440.pdf",
|
||||
"scope": "Natureza digital, localização e responsável; gravação, recuperação, histórico e relatório. Não calcula taxa/base/IVA/dedução/campo11 ou totais; não envia declaração nem inicia pagamento. Software/acesso/licenciamento não decidem natureza apenas pelo título.",
|
||||
"rules": {
|
||||
"inbound": "Fornecedor estrangeiro e adquirente nacional: localização6(7)k.26(4) atribui obrigações ao adquirente sujeito passivo nacional identificado; qualidade desconhecida não apaga localização.25(7) declaração mensal/mapa;32(1)c referência até dia10 do mês seguinte.",
|
||||
"outbound": "Adquirente estabelecido/domiciliado no estrangeiro:6(8), sem isenção ou IVAzero presumidos.",
|
||||
"domestic": "Serviços6(3); bens3(2)/(7) equiparados a corpóreos,6(1) exige local na colocação à disposição demonstrado, sem inferência por servidor/IP/domicílio.",
|
||||
"other_nonresident": "26(1)/(2): representante residente/poderes/comunicação anterior;26(3): falta de representante e actividade comercial/industrial/profissional comprovadas. Não atribui retenção automaticamente a consumidor.33(2)26(1–3) separado de26(4)."
|
||||
},
|
||||
"documentary_limits": {
|
||||
"procedure": "Modelos/formalidades de25(7)/26(4) não cotejados neste incremento. A pesquisa oficial delimitada encontrou anúncio governamental de30/09/2026, não o texto normativo de execução. Isto não declara inexistência de regulamentação nem bloqueia classificação e preparação. Nenhum modelo, taxa de retenção, aprovador ou formulário inventado.",
|
||||
"official_notice": "https://portaldogoverno.gov.mz/governo-introduz-alteracoes-nos-regulamentos-fiscais-para-reforcar-eficiencia-tributaria/",
|
||||
"next_action": "Cotejar texto publicado e modelos aplicáveis antes de automatizar formalidades/submissão; manter preparação, localização e atribuição legal demonstrada.",
|
||||
"P104": "Mantém pendência de escolha da taxa/data; conversão condicionada preservada, sem dependência efectiva destes percursos.",
|
||||
"P084_P085": "Preparação/simulação condicionada preservadas; benefícios não encerrados."
|
||||
},
|
||||
"verification": {
|
||||
"frontend": {
|
||||
"tests": 57,
|
||||
"passed": 57,
|
||||
"failed": 0,
|
||||
"digital_tests": 49,
|
||||
"P002_adapter_compatibility_tests": 8
|
||||
},
|
||||
"privateAPI": {
|
||||
"tests": 1,
|
||||
"assertions": 209,
|
||||
"database": "simulator_fiscal_delta_20261021_test:55441",
|
||||
"transaction": "rollback",
|
||||
"examples": 46
|
||||
},
|
||||
"types": "passed",
|
||||
"build": "passed",
|
||||
"browser": "Edge: qualidade do adquirente Sim→Por esclarecer mantém localização Moçambique e responsável indeterminado; reposta, classificada, gravada, recuperada e relatório aberto. Resultado versão4, três versões históricas.",
|
||||
"screenshot": "C:\\laragon\\www\\portal-investidor\\outputs\\iva-l1-digital-20261025\\qa-recovered-report.png",
|
||||
"preservation": "Comparação integral dos livros e históricos congelados:120entregues e P002QA preservados; sem perdas confirmadas ou escrita activa."
|
||||
},
|
||||
"integration_preparation": {
|
||||
"branches": [
|
||||
"P002",
|
||||
"P121",
|
||||
"P130"
|
||||
],
|
||||
"accepted_P002_candidate": "e4c490b3",
|
||||
"ancestor_confirmed": true,
|
||||
"local_main": "7ccf62adec52e574fdcc75ea2e3852833e3dba10",
|
||||
"local_main_ancestor": true,
|
||||
"merge_tree": "76a7356e225e3e9a857f3aa744f151a3a692c8f4",
|
||||
"conflicts": false,
|
||||
"strategy": "Uma entrega compatível pelo processo Git existente; reutilizar provas por ramo. Revalidar main/destino fresco e conferir somente delta instalado na entrega autorizada. Nenhuma integração no activo ou push neste incremento.",
|
||||
"homologation_baseline": "e8b5ae43",
|
||||
"runtime_delta_from_baseline": [
|
||||
{
|
||||
"file": "resources/js/lib/iva-digital.ts",
|
||||
"sha256_lf": "623165a4e36e161776fea115ee7f8b9b61b4e5766831daa404badf8397eae271"
|
||||
},
|
||||
{
|
||||
"file": "resources/js/components/simulation-digital.tsx",
|
||||
"sha256_lf": "7c6cc9a4a79e385f7554ac43a0dd6310c8b890b162fd3a224378c55127b3844c"
|
||||
},
|
||||
{
|
||||
"file": "resources/js/lib/iva-foreign-operations.ts",
|
||||
"sha256_lf": "b2735b9071aac41f9ddf0ae0c81d3943c870adccfa315ec01432388fec4a7de8"
|
||||
},
|
||||
{
|
||||
"file": "resources/js/components/simulation-foreign-operations.tsx",
|
||||
"sha256_lf": "5276d81afd97cd40df63973fcfdca27d80903464af078f67deb3e45c7bb90948"
|
||||
},
|
||||
{
|
||||
"file": "resources/js/components/simulation-monthly-iva.tsx",
|
||||
"sha256_lf": "19269934dc83f2cb3c36b1677f0bcdf066dc0ffd2af889730bd92acb54532587"
|
||||
},
|
||||
{
|
||||
"file": "resources/js/lib/project-dossier.ts",
|
||||
"sha256_lf": "f0428b411146e030bbf952428faffab6ac26178d09aa3a6437daa9363bc75a46"
|
||||
},
|
||||
{
|
||||
"file": "resources/js/lib/iva-currency-events.ts",
|
||||
"sha256_lf": "fa99e217e96bc6601ebfe0ac48a8ad3395ce85d57218c23888e6eece5a7405fa"
|
||||
}
|
||||
]
|
||||
},
|
||||
"balance": {
|
||||
"delivered": 120,
|
||||
"QA": 3,
|
||||
"functional_pending": 9,
|
||||
"P001": 1,
|
||||
"total": 133
|
||||
},
|
||||
"pending_by_dependency": {
|
||||
"documentary_specific": [
|
||||
"P104",
|
||||
"P084",
|
||||
"P085",
|
||||
"P001"
|
||||
],
|
||||
"travel_events": [
|
||||
"P129",
|
||||
"P133"
|
||||
],
|
||||
"imports_benefits": [
|
||||
"P046",
|
||||
"P047",
|
||||
"P058",
|
||||
"P059"
|
||||
]
|
||||
},
|
||||
"homologation": "e8b5ae43",
|
||||
"preservation_before_tests": "C:\\laragon\\www\\portal-investidor\\outputs\\iva-l1-digital-20261025\\preservation-before-tests.json",
|
||||
"source_inventory": "C:\\laragon\\www\\portal-investidor\\outputs\\iva-l1-digital-20261025\\source-archive-inventory.json"
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
{
|
||||
"implementation_commit": "86970cd507795acb8ff7d942923d84e54e2d3331",
|
||||
"status": "QA_complete_P002_P104_pending_cotejo_documented_not_delivered",
|
||||
"coverage": {
|
||||
"AUD-SIM-L1-P002": [
|
||||
"goods",
|
||||
"services",
|
||||
"listed_services",
|
||||
"foreign_transport_portion"
|
||||
]
|
||||
},
|
||||
"branch_count_complete": 1,
|
||||
"examples": 7,
|
||||
"meaning": "Localização estrangeira reutilizada; enquadramento potencial CIVA19(1)bii. Não concede nem calcula dedução/campo11, IVA, base ou totais. Hipótese interna e exclusões19(2) explícitas; localização nacional não equivale a isenção. Digital mantém âmbito próprio pendente.",
|
||||
"coverage_partial": {
|
||||
"AUD-SIM-L1-P104": "Exemplar integral Lei 2/2006 obtido: BR 12-I de 22/03/2006. Artigo 106(5), PDF18/página impressa66, conferido visualmente: facturação em moeda nacional. Não identifiquei no exemplar a regra de escolha da taxa/data cambial. P104 continua conversão condicionada, sem confirmação de base fiscal."
|
||||
},
|
||||
"documentary_research": {
|
||||
"P104": {
|
||||
"finding": "Exemplar integral Lei 2/2006 obtido: BR 12-I de 22/03/2006. Artigo 106(5), PDF18/página impressa66, conferido visualmente: facturação em moeda nacional. Não identifiquei no exemplar a regra de escolha da taxa/data cambial. P104 continua conversão condicionada, sem confirmação de base fiscal.",
|
||||
"next_action": "Localizar a disposição aplicável que concretiza a remissão do CIVA 15(8), especificando taxa e momento de conversão; conservar moeda, taxa, direcção, data e fonte. Sem taxa corrente por defeito nem nova validação genérica.",
|
||||
"source": {
|
||||
"file": "C:\\laragon\\www\\portal-investidor\\outputs\\iva-l1-foreign-operations-20261025\\Lei-2-2006-BR-12-I.pdf",
|
||||
"sha256": "efe00dbb9d9712d719f11d38a55be028c4d82315960ddfcc7786fdf9bdf133cb",
|
||||
"pages": 36,
|
||||
"origin": "https://www.dlapiperafrica.com/export/sites/africa/mozambique/insights/legislation-series/tax/downloads/Lei-n_2.2006.pdf_2063068952.pdf",
|
||||
"official_identity": "BR12-I22/03/2006;Lei2/2006",
|
||||
"publication": "Localresearchonly;notautomaticallypublishedorusedasFXrule"
|
||||
}
|
||||
}
|
||||
},
|
||||
"verification": {
|
||||
"frontend": {
|
||||
"tests": 8,
|
||||
"passed": 8,
|
||||
"failed": 0
|
||||
},
|
||||
"privateAPI": {
|
||||
"tests": 1,
|
||||
"assertions": 47,
|
||||
"database": "simulator_fiscal_delta_20261021_test:55441",
|
||||
"transaction": "rollback"
|
||||
},
|
||||
"types": "passed",
|
||||
"build": "passed",
|
||||
"browser": "Edge: alteração para hipótese interna desconhecida conserva território e produz indeterminação; reposição, gravação, recuperação e relatório; 7 linhas, versão4, 3 versões históricas",
|
||||
"preservation": "120 fechos inventariados antes dos testes. Comparação integral dos livros anteriores congelados, excluindo apenas novos contextos sintéticos e novo livro P002. Nenhuma perda confirmada.",
|
||||
"screenshot": "C:\\laragon\\www\\portal-investidor\\outputs\\iva-l1-foreign-operations-20261025\\qa-recovered-report.png"
|
||||
},
|
||||
"runtime_delta": [
|
||||
{
|
||||
"file": "resources/js/lib/iva-foreign-operations.ts",
|
||||
"sha256_lf": "33ac9467a0c667d80cb5f66bad43ec567cd96207702579d57a9cbb15cc30d5f8"
|
||||
},
|
||||
{
|
||||
"file": "resources/js/components/simulation-foreign-operations.tsx",
|
||||
"sha256_lf": "5e7eddbd4bd7c9388fc55956baee90c74f673fef6f0d4555cf6f5331e98f8d62"
|
||||
},
|
||||
{
|
||||
"file": "resources/js/components/simulation-monthly-iva.tsx",
|
||||
"sha256_lf": "3072660e5f91668fc69761ddeead00ac9f5e3e752c72537c637cf07993b3ffd3"
|
||||
},
|
||||
{
|
||||
"file": "resources/js/lib/project-dossier.ts",
|
||||
"sha256_lf": "3edb5682d7c8ca6e61e504eab67ca169f18ddcb07050c62fb58f57d3206b9829"
|
||||
},
|
||||
{
|
||||
"file": "resources/js/lib/iva-currency-events.ts",
|
||||
"sha256_lf": "fa99e217e96bc6601ebfe0ac48a8ad3395ce85d57218c23888e6eece5a7405fa"
|
||||
}
|
||||
],
|
||||
"scope": "QA isolada; sem escrita no activo, publicação de documentos, migração ou instalação. iva-currency-events.ts altera apenas explicação documental de P104.",
|
||||
"balance": {
|
||||
"delivered": 120,
|
||||
"QA": 1,
|
||||
"functional_pending": 11,
|
||||
"P001": 1,
|
||||
"total": 133
|
||||
},
|
||||
"homologation": "e8b5ae43",
|
||||
"pending": [
|
||||
"P104",
|
||||
"P121",
|
||||
"P130",
|
||||
"P129",
|
||||
"P133",
|
||||
"P046",
|
||||
"P047",
|
||||
"P058",
|
||||
"P059",
|
||||
"P084",
|
||||
"P085"
|
||||
],
|
||||
"preservation_receipt": "C:\\laragon\\www\\portal-investidor\\outputs\\iva-l1-foreign-operations-20261025\\preservation-before-tests.json"
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"implementation_commit": "5999e35fcbc19605d6037c33018ae0eb3d17854a",
|
||||
"status": "QA_complete_not_delivered",
|
||||
"status": "delivered_with_QA_proofs_preserved",
|
||||
"coverage": {
|
||||
"AUD-SIM-L1-P087": [
|
||||
"binding_lease"
|
||||
@@ -262,5 +262,18 @@
|
||||
"homologation_unchanged": "ce9d649f",
|
||||
"remaining": "Uma entrega conjuntaP087/P127;14outrosIDs mantidos comimpedimento/próximaacção namesmamatriz/manual,nãonovobacklog.",
|
||||
"limits": "L1aberto;P00105/06;P121digital/P084/P085pendentes;bebidasL2/L3;Estatísticas/IAadiadas",
|
||||
"sources_inventory": "C:\\laragon\\www\\portal-investidor\\outputs\\iva-l1-property-transfers-20261025\\source-archive-inventory.json"
|
||||
"sources_inventory": "C:\\laragon\\www\\portal-investidor\\outputs\\iva-l1-property-transfers-20261025\\source-archive-inventory.json",
|
||||
"qa_status_preserved": "QA_complete_not_delivered",
|
||||
"delivery_followup": {
|
||||
"served_commit": "92eaa93570b96561a0d2ab60787b7af8171c9529",
|
||||
"receipt": "l1-property-transfers-delivery-20261025.json",
|
||||
"record": "iva_l1_property_transfers_P087_P127_homologation_20261025",
|
||||
"counts": {
|
||||
"delivered": 118,
|
||||
"QA": 0,
|
||||
"functional_pending": 14,
|
||||
"documentary": 1,
|
||||
"total": 133
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,384 @@
|
||||
{
|
||||
"status": "installed_P131_P132_partial_P104_delta_verified_L1_open",
|
||||
"candidate": "0052cd42d2755753b7e54257db05df8fbd9f08bc",
|
||||
"base_installed": "92eaa93570b96561a0d2ab60787b7af8171c9529",
|
||||
"coverage_complete_branches": {
|
||||
"AUD-SIM-L1-P131": [
|
||||
"goods_available",
|
||||
"goods_transport",
|
||||
"goods_installation",
|
||||
"service_completed",
|
||||
"service_early_charge",
|
||||
"import_clearance",
|
||||
"import_auction",
|
||||
"continuous_period",
|
||||
"contract_effects"
|
||||
],
|
||||
"AUD-SIM-L1-P132": [
|
||||
"own_goods",
|
||||
"own_services",
|
||||
"commission_delivery",
|
||||
"consignment_deadline",
|
||||
"advance_payment"
|
||||
]
|
||||
},
|
||||
"coverage_partial": {
|
||||
"AUD-SIM-L1-P104": "Preparação e simulação cambial condicionada,gravação/recuperação/histórico/relatório;moeda original,taxa,direcção,data,fonte e pressuposto explícitos. Não fechaP104 e não confirma base fiscal. Falta obter/cotejar disposição de conversão da Lei2/2006 referida em15(8),seu momento/regra e correspondência em2026."
|
||||
},
|
||||
"branch_count_complete": 2,
|
||||
"event_treatment_count": 14,
|
||||
"conditional_scenario_count": 1,
|
||||
"runtime_delta": [
|
||||
{
|
||||
"path": "resources/js/lib/iva-currency-events.ts",
|
||||
"sha256_LF": "7133d1df2cf4171495bd145f5b8350938f0a3b4230af824c223d2b03cf0d9bb1"
|
||||
},
|
||||
{
|
||||
"path": "resources/js/components/simulation-currency-events.tsx",
|
||||
"sha256_LF": "d103234361d57d0461d19a0f1fb9cbc5a714dbd566000478fad9aced585f32fa"
|
||||
},
|
||||
{
|
||||
"path": "resources/js/components/simulation-monthly-iva.tsx",
|
||||
"sha256_LF": "44901ef5fc9def8ebd6c251d4af65f36a1cb330f5ed7d44db4a52d98753f18ff"
|
||||
},
|
||||
{
|
||||
"path": "resources/js/lib/project-dossier.ts",
|
||||
"sha256_LF": "1712be726c868d182a2ddf405331dcc1f55bf0c3ce72ad32ab758c15afef2f4a"
|
||||
},
|
||||
{
|
||||
"path": "resources/js/lib/business-financial-plan.ts",
|
||||
"sha256_LF": "c20274722d1ffcd0360f041a6cacb5d868fe0621cb27a1aca6e06826612c3ebb"
|
||||
}
|
||||
],
|
||||
"counts_before": {
|
||||
"delivered": 118,
|
||||
"QA": 2,
|
||||
"functional_pending": 12,
|
||||
"documentary": 1,
|
||||
"total": 133
|
||||
},
|
||||
"counts_current": {
|
||||
"delivered": 120,
|
||||
"QA": 0,
|
||||
"functional_pending": 12,
|
||||
"documentary": 1,
|
||||
"total": 133
|
||||
},
|
||||
"counts_after_delivery": {
|
||||
"delivered": 120,
|
||||
"QA": 0,
|
||||
"functional_pending": 12,
|
||||
"documentary": 1,
|
||||
"total": 133
|
||||
},
|
||||
"QA_proofs_reused": [
|
||||
"iva-l1-currency-events-qa-20261025.json"
|
||||
],
|
||||
"authorization": "Tempo explicitly requests one joint delivery0052cd42/P131/P132;P104 may accompany only as conditionalconversion,notfiscalclosure;concurrentchanges preserved,installeddeltaonly",
|
||||
"scope": "2026contexto;facto gerador7 e exigibilidade8 por data/âmbito;uma parcela de recebimento e restante por linha,ou parcelas de âmbitos distintos,sem agregação de totais entre linhas. Prazo de emissão é parâmetro legal identificado,não calendário presumido;importação segue7c. P104parcial não aplica câmbio fiscal.Sem nova base/IVA,taxa,dedução,campo11,regularização ou totaisModeloA;P133regimes suspensivos/viagens mantém âmbito separado.",
|
||||
"source": "CIVA Lei13/2016:7(1)–(7),PDF8/p1426(266);8,PDF9/p1426(267);15(8),PDF14/p1426(272),páginas visualmente conferidas.Lei22/2022 eLei10/2025 não alteram7/8;15(8)mantido.RIVADecreto7/2008,21,PDF4:regra histórica5dias úteis e excepções;prazo actual não automatizado,exige disposição/calendário/âmbito identificados.",
|
||||
"meaning": {
|
||||
"P131": "Eventos7(1)a/b/c,7(2),7(3),7(7):disponibilização,início transporte,instalação/montagem concluída,serviço realizado/cobrado ou debitado antecipadamente pelo montante respectivo,desembaraço/arrematação/venda na importação,termo do período sucessivo,efeitos translativos com excepções3(3)a/b. Facto gerador separado de exigibilidade8;factura comercial não desloca evento aduaneiro.",
|
||||
"P132": "Eventos7(4)/(5)/(6) e8c:afectações/transmissões assimiladas3(3)e/f,serviços4(2),disponibilização pelo comissário,termo180dias de mercadorias à consignação3(3)d e pagamentos anteriores à factura. Corrigida remissão a consignação,não embalagensP102.8a/b/c separam parcela recebida e restante,sem dupla contagem."
|
||||
},
|
||||
"P104_partial_condition": "Conversão condicionada,sem base fiscal confirmada.Preserva moeda,taxa,direcção,data,fonte e regra/pressuposto.Exemplar/disposição cambialLei2/2006 deve ser cotejado antes de fecharP104.P104continua nos12pendentes.",
|
||||
"documentary_research_delimited": {
|
||||
"P104": {
|
||||
"finding": "Remissão15(8) para Lei2/2006 identificada;artigo de conversão e parâmetros ainda não cotejados em exemplar íntegro.",
|
||||
"attempts": [
|
||||
"Acervo local seisPDF semLei2/2006",
|
||||
"Pesquisa Lei2/2006/CIP identificaBR12-I22/03/2006",
|
||||
"PDF primário platformchinaplp devolveu404;DLA recusou/timeout;archiveBR2006 devolveu403"
|
||||
],
|
||||
"next_action": "Obter exemplar íntegroLei2/2006 e identificar disposição de conversão/momento/regra;reutilizar rascunhos,sem validação jurídica genérica."
|
||||
},
|
||||
"RIVA21": {
|
||||
"primary_notice": "https://portaldogoverno.gov.mz/governo-introduz-alteracoes-nos-regulamentos-fiscais-para-reforcar-eficiencia-tributaria/",
|
||||
"finding": "Anúncio governamental inclui alteração21;anúncio não substitui texto normativo/publicação. Prazo não presumido5dias úteis por defeito;campo exige termo/disposição/calendário aplicáveis.",
|
||||
"next_action": "Localizar texto publicado da alteração21 para eventual automatização do prazo;motor8já opera com parâmetro concreto identificado."
|
||||
}
|
||||
},
|
||||
"preservation": "118priorclosures andpartialP084/P085 preserved;one integration/backup/realisolatedrestore/check;QAproofsreused",
|
||||
"partial_P084_P085": "Preparation/conditional simulation only;benefits pending;no closure",
|
||||
"limits": "L1aberto;P00105/06;bebidasL2/L3;Estatísticas/IAadiadas",
|
||||
"containment": "l1-currency-events-readonly-rollback-20261025.patch,checked only,not applied;blocks newP131/P132/conditionalP104calculations,preserves readers/history/otherbranches",
|
||||
"authenticated_preflight": {
|
||||
"installed": {
|
||||
"status": "installed",
|
||||
"commit": "92eaa93570b96561a0d2ab60787b7af8171c9529",
|
||||
"release": "/var/www/investmoz-homologacao/releases/92eaa93570b96561a0d2ab60787b7af8171c9529-d4d7a2a2",
|
||||
"previous_release": "/var/www/investmoz-homologacao/releases/ce9d649fbf631b584cb521ce120c98a4cb459c13-f7d31a27",
|
||||
"database_migrations": 0,
|
||||
"content_imports": 0
|
||||
},
|
||||
"current_link": "/var/www/investmoz-homologacao/releases/92eaa93570b96561a0d2ab60787b7af8171c9529-d4d7a2a2",
|
||||
"release_revision": {
|
||||
"commit": "92eaa93570b96561a0d2ab60787b7af8171c9529",
|
||||
"branch": "main",
|
||||
"built_at": "2026-10-24T22:52:27.789891+00:00",
|
||||
"manifest_sha256": "52e638801184578d481f490734a4b98f8f557625e81fd942348a2067bfc0f58b"
|
||||
},
|
||||
"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-currency-events-delivery-20261025/backup",
|
||||
"target": {
|
||||
"database": "teste_investidor",
|
||||
"port": 5432
|
||||
},
|
||||
"tables": 174,
|
||||
"files_verified": 369,
|
||||
"dump_sha256": "3bf9ce6052b554884fc9073ef094df83e4061a4acf9698aa4b86746372a933b3",
|
||||
"files_sha256": "bfdc60b76ce1da29199eeb9f21503350c94da165ba2458fcb26f57c96bde995b",
|
||||
"restore_verified": false
|
||||
},
|
||||
"restore": {
|
||||
"restore_verified": true,
|
||||
"tables_verified": 174,
|
||||
"container_network": "none",
|
||||
"database": "l1_currency_events_restore_20261024",
|
||||
"port": 55441,
|
||||
"source_dump_sha256": "3bf9ce6052b554884fc9073ef094df83e4061a4acf9698aa4b86746372a933b3",
|
||||
"active_database_writes": 0
|
||||
}
|
||||
},
|
||||
"delivery_local_date": "2026-10-25",
|
||||
"delivery_timezone": "Africa/Johannesburg",
|
||||
"served_commit": "e8b5ae43add95be3a7fd437e4488befce76c0a97",
|
||||
"installation": {
|
||||
"protected": {
|
||||
"installed": {
|
||||
"status": "installed",
|
||||
"commit": "e8b5ae43add95be3a7fd437e4488befce76c0a97",
|
||||
"release": "/var/www/investmoz-homologacao/releases/e8b5ae43add95be3a7fd437e4488befce76c0a97-7ad802df",
|
||||
"previous_release": "/var/www/investmoz-homologacao/releases/92eaa93570b96561a0d2ab60787b7af8171c9529-d4d7a2a2",
|
||||
"database_migrations": 0,
|
||||
"content_imports": 0
|
||||
},
|
||||
"runtime_files_verified": 5,
|
||||
"persistent_files_and_env_verified": 369,
|
||||
"tables_compared": 174,
|
||||
"changed_tables": {
|
||||
"cache": {
|
||||
"before": {
|
||||
"rows": 106,
|
||||
"checksum": "9ffc4c728b779ae65422ece807e747ce"
|
||||
},
|
||||
"after": {
|
||||
"rows": 106,
|
||||
"checksum": "eb794d5a5c04b738022d307f04aa5885"
|
||||
}
|
||||
},
|
||||
"sessions": {
|
||||
"before": {
|
||||
"rows": 108,
|
||||
"checksum": "6acbafdd2b5cb8f5388e4c45e1c1ec95"
|
||||
},
|
||||
"after": {
|
||||
"rows": 109,
|
||||
"checksum": "591338e88d2ef2a58a2c1954e7302167"
|
||||
}
|
||||
}
|
||||
},
|
||||
"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": "e8b5ae43add95be3a7fd437e4488befce76c0a97",
|
||||
"branch": "main",
|
||||
"built_at": "2026-10-24T23:06:53.694897+00:00",
|
||||
"manifest_sha256": "8679ad3c79f08e7a9505fcff3d72821c924048cb8188c80bb0ad1332adedf248"
|
||||
},
|
||||
"manifest_hash_matches": true,
|
||||
"compiled_delta_markers": {
|
||||
"currency-events/1": [
|
||||
"assets/project-dossier-BNIZIALo.js"
|
||||
],
|
||||
"foreign_scenario": [
|
||||
"assets/project-dossier-BNIZIALo.js",
|
||||
"assets/services-D8qtC6wy.js"
|
||||
],
|
||||
"goods_available": [
|
||||
"assets/project-dossier-BNIZIALo.js"
|
||||
],
|
||||
"goods_transport": [
|
||||
"assets/project-dossier-BNIZIALo.js"
|
||||
],
|
||||
"goods_installation": [
|
||||
"assets/project-dossier-BNIZIALo.js"
|
||||
],
|
||||
"service_completed": [
|
||||
"assets/project-dossier-BNIZIALo.js"
|
||||
],
|
||||
"service_early_charge": [
|
||||
"assets/project-dossier-BNIZIALo.js",
|
||||
"assets/services-D8qtC6wy.js"
|
||||
],
|
||||
"import_clearance": [
|
||||
"assets/project-dossier-BNIZIALo.js",
|
||||
"assets/services-D8qtC6wy.js"
|
||||
],
|
||||
"import_auction": [
|
||||
"assets/project-dossier-BNIZIALo.js",
|
||||
"assets/services-D8qtC6wy.js"
|
||||
],
|
||||
"continuous_period": [
|
||||
"assets/project-dossier-BNIZIALo.js",
|
||||
"assets/services-D8qtC6wy.js"
|
||||
],
|
||||
"contract_effects": [
|
||||
"assets/project-dossier-BNIZIALo.js",
|
||||
"assets/services-D8qtC6wy.js"
|
||||
],
|
||||
"own_goods": [
|
||||
"assets/project-dossier-BNIZIALo.js"
|
||||
],
|
||||
"own_services": [
|
||||
"assets/project-dossier-BNIZIALo.js"
|
||||
],
|
||||
"commission_delivery": [
|
||||
"assets/project-dossier-BNIZIALo.js"
|
||||
],
|
||||
"consignment_deadline": [
|
||||
"assets/project-dossier-BNIZIALo.js",
|
||||
"assets/services-D8qtC6wy.js"
|
||||
],
|
||||
"advance_payment": [
|
||||
"assets/project-dossier-BNIZIALo.js",
|
||||
"assets/services-D8qtC6wy.js"
|
||||
],
|
||||
"currencyEvents": [
|
||||
"assets/project-dossier-BNIZIALo.js"
|
||||
],
|
||||
"dueEvents": [
|
||||
"assets/project-dossier-BNIZIALo.js"
|
||||
],
|
||||
"scenarioAmount": [
|
||||
"assets/project-dossier-BNIZIALo.js"
|
||||
],
|
||||
"mzn_per_unit": [
|
||||
"assets/project-dossier-BNIZIALo.js",
|
||||
"assets/services-D8qtC6wy.js"
|
||||
],
|
||||
"units_per_mzn": [
|
||||
"assets/project-dossier-BNIZIALo.js",
|
||||
"assets/services-D8qtC6wy.js"
|
||||
],
|
||||
"fxRuleRef": [
|
||||
"assets/project-dossier-BNIZIALo.js",
|
||||
"assets/services-D8qtC6wy.js"
|
||||
],
|
||||
"conversão apenas cenário condicionado": [
|
||||
"assets/project-dossier-BNIZIALo.js"
|
||||
],
|
||||
"sem base fiscal confirmada": [
|
||||
"assets/project-dossier-BNIZIALo.js"
|
||||
]
|
||||
},
|
||||
"assets": [
|
||||
{
|
||||
"file": "assets/simulation-form-BqVD91Ek.js",
|
||||
"status": 200,
|
||||
"sha256": "85cbd533c5bc92af5a448db71da006d4346d2d0adb09dde825db0aa19ad5048c"
|
||||
},
|
||||
{
|
||||
"file": "assets/project-dossier-BNIZIALo.js",
|
||||
"status": 200,
|
||||
"sha256": "4f735b3ce4315b6fc87afb9f8e30774e9dc664073fa775da9cec640eaa6f0fde"
|
||||
},
|
||||
{
|
||||
"file": "assets/services-D8qtC6wy.js",
|
||||
"status": 200,
|
||||
"sha256": "240800ef9ba1c338ac6ceb6f6dbbffce11ce02f8bb52ce385c901632f1d6b681"
|
||||
},
|
||||
{
|
||||
"file": "assets/project-dossier-document-CM7oUIMz.js",
|
||||
"status": 200,
|
||||
"sha256": "2a62e4f6e2d7b8058feb67cef817e2d677150e149a3ffe56d6c38120f810634d"
|
||||
}
|
||||
],
|
||||
"simulator_status": 200,
|
||||
"simulator_entry": "assets/app-DwkwtDdx.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": "e8b5ae43add95be3a7fd437e4488befce76c0a97",
|
||||
"release": "/var/www/investmoz-homologacao/releases/e8b5ae43add95be3a7fd437e4488befce76c0a97-7ad802df",
|
||||
"previous_release": "/var/www/investmoz-homologacao/releases/92eaa93570b96561a0d2ab60787b7af8171c9529-d4d7a2a2",
|
||||
"database_migrations": 0,
|
||||
"content_imports": 0
|
||||
},
|
||||
"latest_report": {
|
||||
"status": "installed",
|
||||
"commit": "e8b5ae43add95be3a7fd437e4488befce76c0a97",
|
||||
"release": "/var/www/investmoz-homologacao/releases/e8b5ae43add95be3a7fd437e4488befce76c0a97-7ad802df",
|
||||
"previous_release": "/var/www/investmoz-homologacao/releases/92eaa93570b96561a0d2ab60787b7af8171c9529-d4d7a2a2",
|
||||
"database_migrations": 0,
|
||||
"content_imports": 0,
|
||||
"requested_commits": [
|
||||
"e8b5ae43add95be3a7fd437e4488befce76c0a97"
|
||||
],
|
||||
"finished_at": "2026-10-24T23:06:56.387937+00:00"
|
||||
},
|
||||
"log_file": "1792883102945866022.log",
|
||||
"summaries": [
|
||||
"OK (1 test, 3106 assertions)",
|
||||
"built in 27.52s",
|
||||
"OK (59 tests, 317 assertions)",
|
||||
"# tests 463",
|
||||
"# pass 463",
|
||||
"# fail 0"
|
||||
],
|
||||
"log_bytes": 156709
|
||||
},
|
||||
"rollback_executed": false
|
||||
},
|
||||
"activation": "OnejointGit fast-forward/webhook/installer;zero migrations/imports",
|
||||
"P104_closure": false
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
--- a/resources/js/lib/iva-currency-events.ts
|
||||
+++ b/resources/js/lib/iva-currency-events.ts
|
||||
@@ -90,5 +90,5 @@
|
||||
}
|
||||
function key(draft:Record<string,unknown>,book:CurrencyEventBook):string{return JSON.stringify({version:currencyEventVersion,scope:acquisitionScope(draft),location:draft.selection_labels??{},rows:book.rows});}
|
||||
export function currencyEventCurrent(draft:Record<string,unknown>,book:CurrencyEventBook):boolean{return!!book.result&&book.result.sourceKey===key(draft,book);}
|
||||
-export function recordCurrencyEvents(draft:Record<string,unknown>,book:CurrencyEventBook):CurrencyEventBook{if(!book.rows.length||new Set(book.rows.map(r=>r.id)).size!==book.rows.length)throw new Error('Indique operações com identidades distintas;originais conservados.');const result:CurrencyEventCalculation={version:currencyEventVersion,revision:(book.result?.revision??0)+1,calculatedAt:new Date().toISOString(),opportunity:acquisitionScope(draft),location:JSON.stringify(draft.selection_labels??{}),sourceKey:key(draft,book),source:currencyEventSource,inputs:structuredClone(book.rows),rows:book.rows.map(evaluateCurrencyEvent)};const next={...book,result,history:[...(book.history??[]),...(book.result?[book.result]:[])]};saveCurrencyEventBook(draft,next);return next;}
|
||||
+export function recordCurrencyEvents(draft:Record<string,unknown>,book:CurrencyEventBook):CurrencyEventBook{throw new Error('Novas versões P131/P132 e cenários condicionados P104 temporariamente suspensos;dados,histórico e relatórios preservados.');if(!book.rows.length||new Set(book.rows.map(r=>r.id)).size!==book.rows.length)throw new Error('Indique operações com identidades distintas;originais conservados.');const result:CurrencyEventCalculation={version:currencyEventVersion,revision:(book.result?.revision??0)+1,calculatedAt:new Date().toISOString(),opportunity:acquisitionScope(draft),location:JSON.stringify(draft.selection_labels??{}),sourceKey:key(draft,book),source:currencyEventSource,inputs:structuredClone(book.rows),rows:book.rows.map(evaluateCurrencyEvent)};const next={...book,result,history:[...(book.history??[]),...(book.result?[book.result]:[])]};saveCurrencyEventBook(draft,next);return next;}
|
||||
export function currencyEventReportRows(draft:Record<string,unknown>):Array<[string,string,string,string]>{try{const book=currencyEventBook(draft),r=book.result;if(!r)return[];return r.inputs.map((row,i)=>['IVA mensal',`${currencyEventTreatments.find(t=>t.id===row.treatment)?.branch??'Evento'} — ${row.period} — ${row.id}`,`${row.description};${r.rows[i].reason};facto gerador:${r.rows[i].eventDate??'Indeterminado/não apurado'};parcelas:${r.rows[i].dueEvents.map(p=>p.date+': '+(p.amount??'Montante indeterminado')+' '+row.currency+' ('+p.reason+')').join('; ')||'Nenhuma apurada'};restante pendente:${r.rows[i].status==='indeterminate'?'Indeterminado':r.rows[i].remainingPending?'Sim':'Não'};cenário condicionado:${r.rows[i].scenarioAmount??'Indeterminado'};base/IVA:Indeterminados`,`${r.opportunity};${r.location};${currencyEventCurrent(draft,book)?'Resultado actual':'Entradas alteradas;resultado histórico conservado'};versão${r.revision};${r.calculatedAt};${r.source};${row.origin};documento ${row.documentRef},${row.documentDate};ambito ${row.scope};${row.treatment==='foreign_scenario'?`origem ${row.amount} ${row.sourceCurrency};taxa ${row.fxRate},${row.fxDirection},${row.fxDate};fonte ${row.fxSource};pressuposto ${row.fxRuleRef}`:`evento ${row.eventDate},${row.eventRef};outra data ${row.otherDate};conferencia ${row.reviewDate};factura ${row.invoiceRequired},${row.invoiceState},${row.invoiceDate},${row.invoiceRef};prazo ${row.legalDeadline},${row.deadlineRef};recebimento ${row.paymentState},${row.paymentDate},${row.paymentAmount},${row.paymentRef};total do ambito ${row.amount} ${row.currency}`};fundamento ${row.evidence};sem nova dedução/campo11/IVA ou activação cambial nos livros anteriores.`]);}catch{return[['IVA mensal','Moeda/eventos','Dados não recuperáveis','Originais preservados;sem substituição porzero.']];}}
|
||||
@@ -0,0 +1,180 @@
|
||||
{
|
||||
"status": "ready_after_fresh_authenticated_preflight_and_verified_backup_restore",
|
||||
"candidate": "de4b25bbd73f8c0d34549e455ade5639d37cd801",
|
||||
"accepted_candidates": [
|
||||
"e4c490b3",
|
||||
"de4b25bb"
|
||||
],
|
||||
"base_installed": "e8b5ae43add95be3a7fd437e4488befce76c0a97",
|
||||
"coverage_complete_branches": {
|
||||
"AUD-SIM-L1-P002": [
|
||||
"goods",
|
||||
"services",
|
||||
"listed_services",
|
||||
"foreign_transport_portion"
|
||||
],
|
||||
"AUD-SIM-L1-P121": [
|
||||
"web",
|
||||
"software_service",
|
||||
"information",
|
||||
"media",
|
||||
"teaching",
|
||||
"analogous"
|
||||
],
|
||||
"AUD-SIM-L1-P130": [
|
||||
"software_asset",
|
||||
"content_asset",
|
||||
"data_asset",
|
||||
"crypto_asset",
|
||||
"ebook_asset",
|
||||
"profile_asset",
|
||||
"access_asset",
|
||||
"other_asset"
|
||||
]
|
||||
},
|
||||
"coverage_label": "Três ramos no âmbito demonstrado: P002 enquadramento potencial; P121/P130 natureza/localização/responsável, rascunho/histórico/relatório. Não representa cobertura digital integral.",
|
||||
"digital_coverage_integral": false,
|
||||
"digital_formalities_not_automated": [
|
||||
"Modelos da declaração mensal e do mapa de retenções25(7)",
|
||||
"Formalidades/procedimentos de entrega e pagamento26(4) ainda não cotejados",
|
||||
"Submissão, pagamento ou cálculo de imposto/dedução não executados neste incremento"
|
||||
],
|
||||
"digital_documentary_limits": {
|
||||
"procedure": "Modelos/formalidades de25(7)/26(4) não cotejados neste incremento. A pesquisa oficial delimitada encontrou anúncio governamental de30/09/2026, não o texto normativo de execução. Isto não declara inexistência de regulamentação nem bloqueia classificação e preparação. Nenhum modelo, taxa de retenção, aprovador ou formulário inventado.",
|
||||
"official_notice": "https://portaldogoverno.gov.mz/governo-introduz-alteracoes-nos-regulamentos-fiscais-para-reforcar-eficiencia-tributaria/",
|
||||
"next_action": "Cotejar texto publicado e modelos aplicáveis antes de automatizar formalidades/submissão; manter preparação, localização e atribuição legal demonstrada.",
|
||||
"P104": "Mantém pendência de escolha da taxa/data; conversão condicionada preservada, sem dependência efectiva destes percursos.",
|
||||
"P084_P085": "Preparação/simulação condicionada preservadas; benefícios não encerrados."
|
||||
},
|
||||
"UI_delta_from_QA": "Texto explícito de cobertura limitada e formalidades não automatizadas, pedido pela Tempo; nenhuma alteração de regra ou cálculo.",
|
||||
"branch_count_complete": 3,
|
||||
"digital_treatment_count": 14,
|
||||
"digital_examples": 46,
|
||||
"P002_examples": 7,
|
||||
"runtime_delta": [
|
||||
{
|
||||
"path": "resources/js/lib/iva-digital.ts",
|
||||
"sha256_LF": "623165a4e36e161776fea115ee7f8b9b61b4e5766831daa404badf8397eae271"
|
||||
},
|
||||
{
|
||||
"path": "resources/js/components/simulation-digital.tsx",
|
||||
"sha256_LF": "5bf44510481d1739e0a81f0326c14c8e2f477ac9a7e02b694c3b3173a92dcd78"
|
||||
},
|
||||
{
|
||||
"path": "resources/js/lib/iva-foreign-operations.ts",
|
||||
"sha256_LF": "b2735b9071aac41f9ddf0ae0c81d3943c870adccfa315ec01432388fec4a7de8"
|
||||
},
|
||||
{
|
||||
"path": "resources/js/components/simulation-foreign-operations.tsx",
|
||||
"sha256_LF": "5276d81afd97cd40df63973fcfdca27d80903464af078f67deb3e45c7bb90948"
|
||||
},
|
||||
{
|
||||
"path": "resources/js/components/simulation-monthly-iva.tsx",
|
||||
"sha256_LF": "19269934dc83f2cb3c36b1677f0bcdf066dc0ffd2af889730bd92acb54532587"
|
||||
},
|
||||
{
|
||||
"path": "resources/js/lib/project-dossier.ts",
|
||||
"sha256_LF": "f0428b411146e030bbf952428faffab6ac26178d09aa3a6437daa9363bc75a46"
|
||||
},
|
||||
{
|
||||
"path": "resources/js/lib/iva-currency-events.ts",
|
||||
"sha256_LF": "fa99e217e96bc6601ebfe0ac48a8ad3395ce85d57218c23888e6eece5a7405fa"
|
||||
}
|
||||
],
|
||||
"counts_before": {
|
||||
"delivered": 120,
|
||||
"QA": 3,
|
||||
"functional_pending": 9,
|
||||
"documentary": 1,
|
||||
"total": 133
|
||||
},
|
||||
"counts_current": {
|
||||
"delivered": 120,
|
||||
"QA": 3,
|
||||
"functional_pending": 9,
|
||||
"documentary": 1,
|
||||
"total": 133
|
||||
},
|
||||
"counts_after_delivery": {
|
||||
"delivered": 123,
|
||||
"QA": 0,
|
||||
"functional_pending": 9,
|
||||
"documentary": 1,
|
||||
"total": 133
|
||||
},
|
||||
"QA_proofs_reused": [
|
||||
"iva-l1-foreign-operations-qa-20261025.json",
|
||||
"iva-l1-digital-qa-20261025.json"
|
||||
],
|
||||
"authorization": "Tempo solicita uma única disponibilização P002/P121/P130 no âmbito demonstrado, com alterações concorrentes preservadas e somente delta instalado conferido.",
|
||||
"preservation": "120 fechos, P104 condicionado, P084/P085 parciais, dados, históricos, permissões e acessos preservados. P104 não encerrado.",
|
||||
"scope": "Natureza digital, localização e responsável; gravação, recuperação, histórico e relatório. Não calcula taxa/base/IVA/dedução/campo11 ou totais; não envia declaração nem inicia pagamento. Software/acesso/licenciamento não decidem natureza apenas pelo título.",
|
||||
"P104_closure": false,
|
||||
"limits": "L1 aberto; P001 apenas05/06; P084/P085 benefícios pendentes; bebidas L2/L3; Estatísticas/IA adiadas.",
|
||||
"containment": "l1-foreign-digital-readonly-rollback-20261025.patch; conferir sem aplicar: suspende apenas novas versões P002/digital, preservando leitores/histórico/outros ramos.",
|
||||
"authenticated_preflight": {
|
||||
"installed": {
|
||||
"status": "installed",
|
||||
"commit": "e8b5ae43add95be3a7fd437e4488befce76c0a97",
|
||||
"release": "/var/www/investmoz-homologacao/releases/e8b5ae43add95be3a7fd437e4488befce76c0a97-7ad802df",
|
||||
"previous_release": "/var/www/investmoz-homologacao/releases/92eaa93570b96561a0d2ab60787b7af8171c9529-d4d7a2a2",
|
||||
"database_migrations": 0,
|
||||
"content_imports": 0
|
||||
},
|
||||
"current_link": "/var/www/investmoz-homologacao/releases/e8b5ae43add95be3a7fd437e4488befce76c0a97-7ad802df",
|
||||
"release_revision": {
|
||||
"commit": "e8b5ae43add95be3a7fd437e4488befce76c0a97",
|
||||
"branch": "main",
|
||||
"built_at": "2026-10-24T23:06:53.694897+00:00",
|
||||
"manifest_sha256": "8679ad3c79f08e7a9505fcff3d72821c924048cb8188c80bb0ad1332adedf248"
|
||||
},
|
||||
"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-foreign-digital-delivery-20261025/backup",
|
||||
"target": {
|
||||
"database": "teste_investidor",
|
||||
"port": 5432
|
||||
},
|
||||
"tables": 174,
|
||||
"files_verified": 369,
|
||||
"dump_sha256": "4325b559ab0e7e4a2904a4dc2235b79260a04095e401a3d0231b46e64afb16a9",
|
||||
"files_sha256": "d69622a7179b7bfdfc4599714a9093f47f28c6fcc96b38d1856cfbd38775ef4b",
|
||||
"restore_verified": false
|
||||
},
|
||||
"restore": {
|
||||
"restore_verified": true,
|
||||
"tables_verified": 174,
|
||||
"container_network": "none",
|
||||
"database": "l1_foreign_digital_restore_20261024",
|
||||
"port": 55441,
|
||||
"source_dump_sha256": "4325b559ab0e7e4a2904a4dc2235b79260a04095e401a3d0231b46e64afb16a9",
|
||||
"active_database_writes": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
--- a/resources/js/lib/iva-digital.ts
|
||||
+++ b/resources/js/lib/iva-digital.ts
|
||||
@@ -76,7 +76,7 @@
|
||||
}
|
||||
function key(draft:Record<string,unknown>,book:DigitalBook):string{return JSON.stringify({version:digitalVersion,scope:acquisitionScope(draft),location:draft.selection_labels??{},rows:book.rows});}
|
||||
export function digitalCurrent(draft:Record<string,unknown>,book:DigitalBook):boolean{return!!book.result&&book.result.sourceKey===key(draft,book);}
|
||||
-export function recordDigital(draft:Record<string,unknown>,book:DigitalBook):DigitalBook{
|
||||
+export function recordDigital(draft:Record<string,unknown>,book:DigitalBook):DigitalBook{throw new Error('Novas versões P121/P130 temporariamente suspensas; dados, histórico e relatórios conservados.');
|
||||
if(!book.rows.length||new Set(book.rows.map(r=>r.id)).size!==book.rows.length)throw new Error('Identifique operações distintas; originais conservados.');
|
||||
const result:DigitalCalculation={version:digitalVersion,revision:(book.result?.revision??0)+1,calculatedAt:new Date().toISOString(),opportunity:acquisitionScope(draft),sourceKey:key(draft,book),source:digitalSource,inputs:structuredClone(book.rows),rows:book.rows.map(evaluateDigital)};
|
||||
const next={...book,result,history:[...(book.history??[]),...(book.result?[book.result]:[])]};saveDigitalBook(draft,next);return next;
|
||||
--- a/resources/js/lib/iva-foreign-operations.ts
|
||||
+++ b/resources/js/lib/iva-foreign-operations.ts
|
||||
@@ -46,5 +46,5 @@
|
||||
}
|
||||
function key(draft:Record<string,unknown>,book:ForeignOperationBook):string{return JSON.stringify({version:foreignOperationVersion,scope:acquisitionScope(draft),location:draft.selection_labels??{},rows:book.rows,dependencies:book.rows.map(row=>({source:foreignSources(draft,row.sourceKind).find(s=>s.id===row.sourceRowId),event:row.eventRowId?foreignEvents(draft).find(e=>e.id===row.eventRowId):null}))});}
|
||||
export function foreignOperationCurrent(draft:Record<string,unknown>,book:ForeignOperationBook):boolean{try{return!!book.result&&book.result.sourceKey===key(draft,book);}catch{return false;}}
|
||||
-export function recordForeignOperations(draft:Record<string,unknown>,book:ForeignOperationBook):ForeignOperationBook{if(!book.rows.length||new Set(book.rows.map(r=>r.id)).size!==book.rows.length)throw new Error('Indique identidades distintas;originais conservados.');const result:ForeignOperationCalculation={version:foreignOperationVersion,revision:(book.result?.revision??0)+1,calculatedAt:new Date().toISOString(),opportunity:acquisitionScope(draft),sourceKey:key(draft,book),source:foreignOperationSource,inputs:structuredClone(book.rows),rows:book.rows.map(r=>evaluateForeignOperation(draft,r))};const next={...book,result,history:[...(book.history??[]),...(book.result?[book.result]:[])]};saveForeignOperationBook(draft,next);return next;}
|
||||
+export function recordForeignOperations(draft:Record<string,unknown>,book:ForeignOperationBook):ForeignOperationBook{throw new Error('Novas versões P002 temporariamente suspensas; dados, histórico e relatórios conservados.');if(!book.rows.length||new Set(book.rows.map(r=>r.id)).size!==book.rows.length)throw new Error('Indique identidades distintas;originais conservados.');const result:ForeignOperationCalculation={version:foreignOperationVersion,revision:(book.result?.revision??0)+1,calculatedAt:new Date().toISOString(),opportunity:acquisitionScope(draft),sourceKey:key(draft,book),source:foreignOperationSource,inputs:structuredClone(book.rows),rows:book.rows.map(r=>evaluateForeignOperation(draft,r))};const next={...book,result,history:[...(book.history??[]),...(book.result?[book.result]:[])]};saveForeignOperationBook(draft,next);return next;}
|
||||
export function foreignOperationReportRows(draft:Record<string,unknown>):Array<[string,string,string,string]>{try{const b=foreignOperationBook(draft),r=b.result;if(!r)return[];return r.inputs.map((row,i)=>{const line=r.rows[i];return['IVA mensal',`P002 — ${line.source?.period??'Período indeterminado'} — ${row.id}`,`${line.source?.description??'Origem por escolher'};${line.reason};dedução/IVA:Indeterminados`,`${r.opportunity};${foreignOperationCurrent(draft,b)?'Resultado actual':'Origens/entradas alteradas;resultado histórico conservado'};versão${r.revision};${r.calculatedAt};${r.source};localização${row.sourceKind}/${row.sourceRowId},versão${line.source?.revision??'indeterminada'};${line.source?.reason??''};operação${line.source?.operationRef??''};âmbito origem${line.source?.scope??''};parcela${row.territorialPart};evento${row.eventRowId||'Sem associação necessária'},${line.event?JSON.stringify(line.event):'Não apurado por esta análise'};hipótese interna${row.hypotheticalTaxable},fundamento${row.hypotheticalRef};exclusão19(2)${row.excluded19_2};âmbito${row.scope};factos${row.evidence};sem base/IVA/dedução/campo11/totaisModeloA.`];});}catch{return[['IVA mensal','P002','Dados não recuperáveis','Originais preservados;sem classificação por defeito.']];}}
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"status": "ready_after_fresh_authenticated_preflight_and_verified_backup_restore",
|
||||
"status": "installed_delta_verified_partial_L1",
|
||||
"candidate": "d84883b801123664770ab6c69d7e7ddec148e352",
|
||||
"base_installed": "ce9d649fbf631b584cb521ce120c98a4cb459c13",
|
||||
"coverage_complete_branches": {
|
||||
@@ -40,8 +40,8 @@
|
||||
"total": 133
|
||||
},
|
||||
"counts_current": {
|
||||
"delivered": 116,
|
||||
"QA": 2,
|
||||
"delivered": 118,
|
||||
"QA": 0,
|
||||
"functional_pending": 14,
|
||||
"documentary": 1,
|
||||
"total": 133
|
||||
@@ -63,7 +63,7 @@
|
||||
"P087": "Entrega material de bens em execução de contrato de locação com cláusula vinculante para ambas as partes de transferência da propriedade3(3)a. Classificação separada da base15(1):contraprestação obtida/a obter,sem próprioIVA,com composição/âmbito identificados. Não usar15(2)a da consignação,nem transformar mera opção de compra em cláusula vinculante.",
|
||||
"P127": "Cessão onerosa ou gratuita de estabelecimento,totalidade ou parte de património susceptível de constituir ramo independente3(5). Adquirente é ou passa pela aquisição a sujeito passivo2(1)a e pratica operações com direito à dedução. Imposto não devido nem exigível no âmbito demonstrado;não isenção genérica,nem base/taxa zero ou nova dedução. Não impor condição autónoma de continuidade além dos factos da fonte."
|
||||
},
|
||||
"classification_and_scope": "P087 binding lease materialdelivery3(3)a,base15(1),notconsignment15(2)a.P1273(5) businessscope/acquirer2(1)a/deductionactivities explicit;no genericexemption/zerobase/newdeduction.",
|
||||
"classification_and_scope": "P087 bindinglease3(3)a,base15(1),notconsignment15(2)a;P127onerous/freebusiness3(5),autonomousscope/acquirer2(1)a/deductionactivities;nozero/genericexemption/newdeduction.",
|
||||
"preservation": "116priorclosures andpartialP084/P085 preserved;acceptedperbranchQA reused;one integration/backup/realisolatedrestore/check forwhole set",
|
||||
"partial_P084_P085": "Preparation/conditional simulation only;benefits pending;no closure",
|
||||
"limits": "L1aberto;P00105/06;P121digital/P084/P085pendentes;bebidasL2/L3;Estatísticas/IAadiadas",
|
||||
@@ -161,5 +161,204 @@
|
||||
"P085",
|
||||
"P001"
|
||||
]
|
||||
}
|
||||
},
|
||||
"delivery_local_date": "2026-10-25",
|
||||
"delivery_timezone": "Africa/Johannesburg",
|
||||
"served_commit": "92eaa93570b96561a0d2ab60787b7af8171c9529",
|
||||
"installation": {
|
||||
"protected": {
|
||||
"installed": {
|
||||
"status": "installed",
|
||||
"commit": "92eaa93570b96561a0d2ab60787b7af8171c9529",
|
||||
"release": "/var/www/investmoz-homologacao/releases/92eaa93570b96561a0d2ab60787b7af8171c9529-d4d7a2a2",
|
||||
"previous_release": "/var/www/investmoz-homologacao/releases/ce9d649fbf631b584cb521ce120c98a4cb459c13-f7d31a27",
|
||||
"database_migrations": 0,
|
||||
"content_imports": 0
|
||||
},
|
||||
"runtime_files_verified": 4,
|
||||
"persistent_files_and_env_verified": 369,
|
||||
"tables_compared": 174,
|
||||
"changed_tables": {
|
||||
"cache": {
|
||||
"before": {
|
||||
"rows": 106,
|
||||
"checksum": "f2f9da0d12aea236c33cdccfe3bbb124"
|
||||
},
|
||||
"after": {
|
||||
"rows": 106,
|
||||
"checksum": "966c487af6b59f1224527d7c6cfa474d"
|
||||
}
|
||||
},
|
||||
"sessions": {
|
||||
"before": {
|
||||
"rows": 105,
|
||||
"checksum": "486e34e2b2dab1f59fcc403f4b2741d8"
|
||||
},
|
||||
"after": {
|
||||
"rows": 106,
|
||||
"checksum": "e975b8b2e1359ec0273b5ebe826e395d"
|
||||
}
|
||||
}
|
||||
},
|
||||
"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": "92eaa93570b96561a0d2ab60787b7af8171c9529",
|
||||
"branch": "main",
|
||||
"built_at": "2026-10-24T22:52:27.789891+00:00",
|
||||
"manifest_sha256": "52e638801184578d481f490734a4b98f8f557625e81fd942348a2067bfc0f58b"
|
||||
},
|
||||
"manifest_hash_matches": true,
|
||||
"compiled_delta_markers": {
|
||||
"property-transfers/1": [
|
||||
"assets/project-dossier-DUE7gpGm.js"
|
||||
],
|
||||
"binding_lease": [
|
||||
"assets/project-dossier-DUE7gpGm.js",
|
||||
"assets/services-B1VsA-Tn.js"
|
||||
],
|
||||
"business_onerous": [
|
||||
"assets/project-dossier-DUE7gpGm.js"
|
||||
],
|
||||
"business_free": [
|
||||
"assets/project-dossier-DUE7gpGm.js"
|
||||
],
|
||||
"propertyTransfers": [
|
||||
"assets/project-dossier-DUE7gpGm.js"
|
||||
],
|
||||
"materialDelivery": [
|
||||
"assets/project-dossier-DUE7gpGm.js"
|
||||
],
|
||||
"bindingProperty": [
|
||||
"assets/project-dossier-DUE7gpGm.js"
|
||||
],
|
||||
"autonomousBusiness": [
|
||||
"assets/project-dossier-DUE7gpGm.js"
|
||||
],
|
||||
"acquirer2a": [
|
||||
"assets/project-dossier-DUE7gpGm.js"
|
||||
],
|
||||
"deductionActivities": [
|
||||
"assets/project-dossier-DUE7gpGm.js"
|
||||
],
|
||||
"contractRef": [
|
||||
"assets/project-dossier-DUE7gpGm.js",
|
||||
"assets/services-B1VsA-Tn.js"
|
||||
],
|
||||
"propertyClauseRef": [
|
||||
"assets/project-dossier-DUE7gpGm.js",
|
||||
"assets/services-B1VsA-Tn.js"
|
||||
],
|
||||
"acquirerRef": [
|
||||
"assets/project-dossier-DUE7gpGm.js",
|
||||
"assets/services-B1VsA-Tn.js"
|
||||
],
|
||||
"autonomousRef": [
|
||||
"assets/project-dossier-DUE7gpGm.js",
|
||||
"assets/services-B1VsA-Tn.js"
|
||||
],
|
||||
"activitiesRef": [
|
||||
"assets/project-dossier-DUE7gpGm.js",
|
||||
"assets/services-B1VsA-Tn.js"
|
||||
],
|
||||
"considerationRef": [
|
||||
"assets/project-dossier-DUE7gpGm.js",
|
||||
"assets/services-B1VsA-Tn.js"
|
||||
],
|
||||
"compositionConfirmed": [
|
||||
"assets/project-dossier-DUE7gpGm.js",
|
||||
"assets/services-B1VsA-Tn.js"
|
||||
],
|
||||
"goods_transmission": [
|
||||
"assets/project-dossier-DUE7gpGm.js"
|
||||
],
|
||||
"tax_not_exigible_3_5": [
|
||||
"assets/project-dossier-DUE7gpGm.js"
|
||||
],
|
||||
"consideration": [
|
||||
"assets/project-dossier-DUE7gpGm.js",
|
||||
"assets/services-B1VsA-Tn.js"
|
||||
]
|
||||
},
|
||||
"assets": [
|
||||
{
|
||||
"file": "assets/project-dossier-document-Cq8oizup.js",
|
||||
"status": 200,
|
||||
"sha256": "27777ad09c9517041644bb2b7bfcd7f7058e4f6b0c1eec22722f3250aac3c7c9"
|
||||
},
|
||||
{
|
||||
"file": "assets/project-dossier-DUE7gpGm.js",
|
||||
"status": 200,
|
||||
"sha256": "2fc2015b97935391a9db425d0a3431dcc9f1792d82053b97ffcefa31e2acabb3"
|
||||
},
|
||||
{
|
||||
"file": "assets/simulation-form-CPZAFZU3.js",
|
||||
"status": 200,
|
||||
"sha256": "c6bcf64e60a5eeac0cafe3dc055dc5544162f21942ee08b34d51bc6d52947567"
|
||||
},
|
||||
{
|
||||
"file": "assets/services-B1VsA-Tn.js",
|
||||
"status": 200,
|
||||
"sha256": "592b0a0dcb6b7338a9109238c89ce63630546fb92d7be213c49d28752574120e"
|
||||
}
|
||||
],
|
||||
"simulator_status": 200,
|
||||
"simulator_entry": "assets/app-Nmu2R55A.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": "92eaa93570b96561a0d2ab60787b7af8171c9529",
|
||||
"release": "/var/www/investmoz-homologacao/releases/92eaa93570b96561a0d2ab60787b7af8171c9529-d4d7a2a2",
|
||||
"previous_release": "/var/www/investmoz-homologacao/releases/ce9d649fbf631b584cb521ce120c98a4cb459c13-f7d31a27",
|
||||
"database_migrations": 0,
|
||||
"content_imports": 0
|
||||
},
|
||||
"latest_report": {
|
||||
"status": "installed",
|
||||
"commit": "92eaa93570b96561a0d2ab60787b7af8171c9529",
|
||||
"release": "/var/www/investmoz-homologacao/releases/92eaa93570b96561a0d2ab60787b7af8171c9529-d4d7a2a2",
|
||||
"previous_release": "/var/www/investmoz-homologacao/releases/ce9d649fbf631b584cb521ce120c98a4cb459c13-f7d31a27",
|
||||
"database_migrations": 0,
|
||||
"content_imports": 0,
|
||||
"requested_commits": [
|
||||
"92eaa93570b96561a0d2ab60787b7af8171c9529"
|
||||
],
|
||||
"finished_at": "2026-10-24T22:52:30.469110+00:00"
|
||||
},
|
||||
"log_file": "1792882239391904096.log",
|
||||
"summaries": [
|
||||
"OK (1 test, 3106 assertions)",
|
||||
"built in 27.57s",
|
||||
"OK (59 tests, 317 assertions)",
|
||||
"# tests 444",
|
||||
"# pass 444",
|
||||
"# fail 0"
|
||||
],
|
||||
"log_bytes": 153295
|
||||
},
|
||||
"rollback_executed": false
|
||||
},
|
||||
"activation": "OnejointGit fast-forward/webhook/installer;zero migrations/imports"
|
||||
}
|
||||
|
||||
@@ -1,5 +1,97 @@
|
||||
# Rastreabilidade, utilização e formação
|
||||
|
||||
## 25/10/2026 — P121/P130 concluídos em QA; conjunto compatível P002/digital preparado
|
||||
|
||||
**120 entregues + 3 em QA (P002/P121/P130) + 9 funcionais pendentes + P001 = 133**. Homologação e8b5ae43 inalterada; L1 aberto. Os120 fechos e P002QA foram inventariados antes dos testes e preservados; provas aceites reutilizadas. Sem push, instalação, migração ou escrita no activo.
|
||||
|
||||
No simulador, abrir «Bens e serviços digitais — natureza, localização e obrigações». Escolher transmissão de activo (P130) ou prestação de serviço (P121), tratamento, operação/período, direitos/funcionalidade e fundamento da natureza. Software/acesso/licenciamento não decide a natureza só pelo nome. Campos sem aplicação ficam ocultos e conservados; trocar natureza/tratamento exige rever confirmações. Referências de documentos ou pressupostos existentes são reutilizáveis, sem certificado/aprovador adicional.
|
||||
|
||||
São seis tratamentos de serviços e oito famílias de activos, com42 exemplos de entrada, saída e operação doméstica e quatro exemplos adicionais de qualidade fiscal/representação. Adquirente no estrangeiro segue6(8); entrada digital por fornecedor estrangeiro segue6(7)k. Qualidade fiscal do adquirente por esclarecer não apaga localização nacional:26(4) exige sujeito passivo nacional identificado.26(1–3) tem condições próprias de representação, comunicação e actividade; consumidor não recebe retenção automática. Serviço doméstico usa6(3); bem digital equiparado a corpóreo usa6(1) apenas com local na colocação à disposição fundamentado, sem inferência por servidor/IP. Sem facto demonstrado, localização fica indeterminada.
|
||||
|
||||
26(4),25(7) e32(1)c identificam responsável, declaração mensal/mapa e referência legal do dia10 do mês seguinte, sem ajuste de calendário presumido.33(2) refere26(1–3), não substitui o percurso26(4). Formalidades/modelos não foram cotejados neste incremento: a pesquisa oficial encontrou o anúncio governamental de30/09/2026, que não substitui publicação normativa. Não se declara inexistência da regulamentação. A preparação prossegue; automatizar formalidades exige cotejar o texto/modelos correspondentes. Não há taxa, base, IVA, dedução/campo11, submissão, pagamento ou totais automáticos neste incremento.
|
||||
|
||||
P002 passa a poder associar o resultado digital da mesma oportunidade; alterar origem/revisão invalida a análise actual e conserva histórico. A candidata aceita e4c490b3 está contida por ancestralidade nesta preparação. O ensaio Git com main local (7ccf62adec52e574fdcc75ea2e3852833e3dba10) não apresenta conflitos e produz a mesma árvore da implementação. Na entrega será necessário conferir main/destino frescos, backup/restauro e somente o delta instalado, pelo processo existente. Uma entrega conjunta dos três ramos, sem repetir as provas individuais.
|
||||
|
||||
Passaram57 testes frontend (49 digitais e8 de compatibilidade P002), API privada1teste/209asserções com rollback na base isolada55441, tipos e build. Edge confirmou alteração fiscal sem perda de localização, reposição, gravação, recuperação e relatório (versão4, três versões anteriores). Recibo: `docs/investmoz/simulations/iva-l1-digital-qa-20261025.json`; implementação `5f088e34`.
|
||||
|
||||
Fontes: [BR—Lei10/2025](https://miramar.co.mz/wp-content/uploads/2026/01/Tax_Update_Key_Amendments_to_Mozambican_Tax_Legislation_1767376440.pdf), exemplar localPDF12–14; CIVA2016PDF8 e17. [Anúncio governamental](https://portaldogoverno.gov.mz/governo-introduz-alteracoes-nos-regulamentos-fiscais-para-reforcar-eficiencia-tributaria/) delimitado às formalidades ainda por cotejar. Sete exemplares inventariados por hash; nenhuma publicação automática.
|
||||
|
||||
Pendências: P104, disposição que define taxa/data cambial; P084/P085, correspondência regulamentar mantendo rascunhos e simulação condicionada; P001, instruções dos campos05/06; P129/P133, desenvolvimento/cotejo dos percursos de viagens e eventos; P046/P047/P058/P059, desenvolvimento/cotejo das importações e benefícios específicos. As pendências documentais não bloqueiam grupos independentes. Dedução mantém âmbito próprio; Estatísticas/IA adiadas.
|
||||
|
||||
## 25/10/2026 — preparação QA P121/P130 e entrega compatível com P002
|
||||
|
||||
120 fechos e P002 QA inventariados antes dos testes, sem perdas confirmadas. Reutilizar provas e processo Git existentes; sem instalação individual de P002. Lei10/2025, artigos3/6/23/25/26/32/33, e CIVA2016,6(7)k i–v, cotejados; distinguir bens de serviços e localização de obrigações. Sem dependência cambial efectiva de P104. Novas formalidades remetidas para regulamentação não serão inventadas.
|
||||
|
||||
## 25/10/2026 — P002 concluído em QA; P104 com cotejo documental delimitado
|
||||
|
||||
Saldo: **120 entregues + 1 em QA + 11 funcionais pendentes + P001 = 133**. Homologação e8b5ae43 inalterada; L1 aberto. Os 120 fechos e respectivos livros/históricos foram preservados. P002 aguarda entrega agrupada compatível.
|
||||
|
||||
P002 reutiliza a localização já apurada de bens, serviços, serviços enumerados e parcela exterior de transporte, sem repetir os campos de origem. Pode associar um evento da mesma operação/período. Regista hipótese de tributabilidade interna, fundamento, exclusões do artigo19(2), âmbito e elementos disponíveis. O resultado do artigo19(1)bii é enquadramento potencial, sem concessão ou cálculo de dedução/campo11. Alterar a origem exige rever confirmações; versões anteriores conservam os factos e referências. A falta de fundamento deixa a análise indeterminada sem apagar a localização estrangeira.
|
||||
|
||||
Oito testes frontend e API privada (1 teste/47 asserções) passaram, com base QA isolada e rollback. Tipos, build e conferência Edge de gravação, recuperação, histórico e relatório passaram. Sete exemplos: quatro enquadramentos potenciais, uma operação nacional não aplicável, uma hipótese interna não tributável e uma exclusão19(2). Provas anteriores reutilizadas; sem escrita no activo.
|
||||
|
||||
P104: Exemplar integral Lei 2/2006 obtido: BR 12-I de 22/03/2006. Artigo 106(5), PDF18/página impressa66, conferido visualmente: facturação em moeda nacional. Não identifiquei no exemplar a regra de escolha da taxa/data cambial. P104 continua conversão condicionada, sem confirmação de base fiscal. Localizar a disposição aplicável que concretiza a remissão do CIVA 15(8), especificando taxa e momento de conversão; conservar moeda, taxa, direcção, data e fonte. Sem taxa corrente por defeito nem nova validação genérica.
|
||||
|
||||
Fonte obtida apenas para consulta local: [BR — Lei2/2006](https://www.dlapiperafrica.com/export/sites/africa/mozambique/insights/legislation-series/tax/downloads/Lei-n_2.2006.pdf_2063068952.pdf). SHA256: `efe00dbb9d9712d719f11d38a55be028c4d82315960ddfcc7786fdf9bdf133cb`. Não foi publicada automaticamente nem activada como regra cambial.
|
||||
|
||||
Pendências por próxima acção: P104, identificar taxa/momento na disposição aplicável; P121/P130, percursos digitais; P129/P133, viagens e eventos associados; P046/P047/P058/P059, importações e benefícios; P084/P085, correspondência regulamentar específica mantendo preparação e simulação condicionada; P001, instrução documental dos campos05/06. Nenhuma destas dependências encerra ou bloqueia os ramos independentes. Estatísticas e IA continuam adiadas.
|
||||
|
||||
Recibo QA: `docs/investmoz/simulations/iva-l1-foreign-operations-qa-20261025.json`; implementação `86970cd5`.
|
||||
|
||||
## 25/10/2026 — preparação P002 e cotejo cambialP104
|
||||
|
||||
120fechos inventariados antes dos testes,sem perdas confirmadas;provase8b5ae43/2de67beb reutilizadas.Todososlivros/resultados/históricos congelados.Sem escrita noactivo.P002reutiliza localização bens/serviços/enumerados e eventos já entregues;19(1)biiéenquadramentopotencial,nãoconcessãodededução.P104exemplarLei2/2006obtido;106(5)visualconferido,emissãoemmoedanacionalnãodemonstraregra taxa/data.Cotejoseparaexemplarresolvidodeparâmetrocambialaindapendente,sem bloqueioindependenteP002.
|
||||
|
||||
## 25/10/2026 — P131/P132 entregues conjuntamente,P104 apenas conversão condicionada
|
||||
|
||||
Homologação **`e8b5ae43`**,sobre`92eaa935`;candidata`0052cd42` aceite pela Tempo. Dois ramos encerrados/14percursos,maisumcenáriocambialparcialquenãofechaP104.Umaintegração/backup/restauro/instalação/conferência,provasQA reutilizadas.
|
||||
|
||||
- **P131**: Eventos7(1)a/b/c,7(2),7(3),7(7):disponibilização,início transporte,instalação/montagem concluída,serviço realizado/cobrado ou debitado antecipadamente pelo montante respectivo,desembaraço/arrematação/venda na importação,termo do período sucessivo,efeitos translativos com excepções3(3)a/b. Facto gerador separado de exigibilidade8;factura comercial não desloca evento aduaneiro.
|
||||
- **P132**: Eventos7(4)/(5)/(6) e8c:afectações/transmissões assimiladas3(3)e/f,serviços4(2),disponibilização pelo comissário,termo180dias de mercadorias à consignação3(3)d e pagamentos anteriores à factura. Corrigida remissão a consignação,não embalagensP102.8a/b/c separam parcela recebida e restante,sem dupla contagem.
|
||||
|
||||
CIVA Lei13/2016:7(1)–(7),PDF8/p1426(266);8,PDF9/p1426(267);15(8),PDF14/p1426(272),páginas visualmente conferidas.Lei22/2022 eLei10/2025 não alteram7/8;15(8)mantido.RIVADecreto7/2008,21,PDF4:regra histórica5dias úteis e excepções;prazo actual não automatizado,exige disposição/calendário/âmbito identificados. 2026contexto;facto gerador7 e exigibilidade8 por data/âmbito;uma parcela de recebimento e restante por linha,ou parcelas de âmbitos distintos,sem agregação de totais entre linhas. Prazo de emissão é parâmetro legal identificado,não calendário presumido;importação segue7c. P104parcial não aplica câmbio fiscal.Sem nova base/IVA,taxa,dedução,campo11,regularização ou totaisModeloA;P133regimes suspensivos/viagens mantém âmbito separado. P104incluídosócomopreparação/conversãocondicionada,explicitadonomanifesto/interface/relatório;moedaoriginal,taxa,direcção,data,fonte eregra/pressuposto preservados.Basefiscalnull,semIVA/deduçãoactivados.RegrafiscalLei2/2006aindapendente;concluirocotejodadisposição/momento/regraantesdefecharP104,nãonovavalidaçãojurídicagenérica.
|
||||
|
||||
Main/destino conferidos,fast-forwardnormal,118fechosanteriorespreservados.Backupnovo/restaurorealisoladosemrede174tabelas/369ficheiros.Deltainstalado:revisão,manifesto/hash,24marcadorescompiladosincluindolimiteP104,5hashesfuncionais,simuladorHTTP200.PostgreSQLpela mesmaidentidadeantes/depois,29fichaspublicadas/28relações/408geometriasconservadas,diferençasapenascache/sessões.Zero migrações/importações/permissõesalteradas ouensaiossintéticosnoactivo.Contençãoconferida,nãoaplicada;leitores/histórico/outrosramos/backup/releaseanteriorespreservados.
|
||||
|
||||
[Manifesto/recibo](../simulations/l1-currency-events-delivery-20261025.json),registo`iva_l1_currency_events_P131_P132_partial_P104_homologation_20261025`. **120entregues +12funcionaispendentes +P001=133**,semcandidatasQApor disponibilizar.P104continuanos12,P001separado05/06.L1aberto;P084/P085parciais;bebidasL2/L3;Estatísticas/IAadiadas.Prosseguirgruposindependentessegundo dependênciasjáregistadas,QAporramo/entregasagrupadas.
|
||||
|
||||
|
||||
## 25/10/2026 — P131/P132 QAconcluído,P104parcial
|
||||
|
||||
Implementação`7e6e462e`. DoisramosQA/14eventos,maisumcenáriocambialparcialquenãofechaP104. CIVA Lei13/2016:7(1)–(7),PDF8/p1426(266);8,PDF9/p1426(267);15(8),PDF14/p1426(272),páginas visualmente conferidas.Lei22/2022 eLei10/2025 não alteram7/8;15(8)mantido.RIVADecreto7/2008,21,PDF4:regra histórica5dias úteis e excepções;prazo actual não automatizado,exige disposição/calendário/âmbito identificados.
|
||||
|
||||
- **P131**: Eventos7(1)a/b/c,7(2),7(3),7(7):disponibilização,início transporte,instalação/montagem concluída,serviço realizado/cobrado ou debitado antecipadamente pelo montante respectivo,desembaraço/arrematação/venda na importação,termo do período sucessivo,efeitos translativos com excepções3(3)a/b. Facto gerador separado de exigibilidade8;factura comercial não desloca evento aduaneiro.
|
||||
- **P132**: Eventos7(4)/(5)/(6) e8c:afectações/transmissões assimiladas3(3)e/f,serviços4(2),disponibilização pelo comissário,termo180dias de mercadorias à consignação3(3)d e pagamentos anteriores à factura. Corrigida remissão a consignação,não embalagensP102.8a/b/c separam parcela recebida e restante,sem dupla contagem.
|
||||
|
||||
P132designaçãocorrigida:7(6)refereconsignação3(3)d,nãoembalagensP102;históricopreservado.P123conferênciadenãodevoluçãoépreservada,separadadotermodeexigibilidade7(6). 2026contexto;facto gerador7 e exigibilidade8 por data/âmbito;uma parcela de recebimento e restante por linha,ou parcelas de âmbitos distintos,sem agregação de totais entre linhas. Prazo de emissão é parâmetro legal identificado,não calendário presumido;importação segue7c. P104parcial não aplica câmbio fiscal.Sem nova base/IVA,taxa,dedução,campo11,regularização ou totaisModeloA;P133regimes suspensivos/viagens mantém âmbito separado.
|
||||
|
||||
P104:preparaçãodamoedaoriginal/montante/taxa/direcção/data/fonte/pressuposto;conversãomatemáticareutilizaconvertCentsfinanceirosemalteraralgoritmo.Basefiscalmantémnull. Faltaobter/cotejardisposiçãodeconversãoLei2/2006remetidapor15(8),momento/regraem2026. Acervolocal6PDFinventariado,nãoincluiLei2/2006;pesquisalocalizouBR12-I22/03/2006masexemplaríntegronãoobtido(404/403/recusa).Próximaacçãodelimitadaobteressetrecho,nãonovavalidaçãojurídicagenérica.
|
||||
|
||||
[AnúnciooficialdoGoverno](https://portaldogoverno.gov.mz/governo-introduz-alteracoes-nos-regulamentos-fiscais-para-reforcar-eficiencia-tributaria/)incluialteração21RIVA;anúncionãosubstituitextonormativo.Nãoautomatizadoprazo5diasúteis2008;motor8usatermolegal/disposição/calendário/âmbitoconcretos.Pesquisadotextopublicadoparaeventualautomatizaçãopermanece delimitada,sem bloqueareventos7independentes.
|
||||
|
||||
19testesfrontend;APIprivada1teste/65asserçõescomrollbackemQAisolada55441;tipos/buildaprovados.Edge/CUA:faltareferênciaprazoconservafactogeradoreexigibilidadeindeterminada;restauro,gravação/recuperação/relatório15exemplos,1versãoanterior;importaçãopeloeventoaduaneiro2026-12-10,facturacomercialnãoodesloca;adiantamento200+restante800;P104condicionado64500MZN,semIVA/base.Todososlivrosanteriorescomparadoscomcongelamento;118fechospreservados,semperdasconfirmadas;provas92eaa935/7a3ac432reutilizadas.Relatório`docs\investmoz\simulations\iva-l1-currency-events-qa-20261025.json`;evidência`C:\laragon\www\portal-investidor\outputs\iva-l1-currency-events-20261025/verification.json`,imagem`qa-recovered-report.png`.Semescritanoactivo.
|
||||
|
||||
**118entregues +2QA +12funcionaispendentes +P001=133**;homologação`92eaa935`.P104incluídonos12,nãofechado.CandidataparaentregaconjuntaP131/P132,P104apenasparcialexplicitadonomanifesto.L1aberto;P00105/06;bebidasL2/L3;Estatísticas/IAadiadas.Pendentes:P002/P046/P047/P058/P059/P084/P085/P104/P121/P129/P130/P133,impedimentos/próximasacçõesmantidosnamesmamatriz.
|
||||
|
||||
|
||||
## 25/10/2026 — preparação P104/P131/P132
|
||||
|
||||
118fechos inventariados antes dos testes,sem perdas confirmadas;provas92eaa935/7a3ac432 reutilizadas,todososlivros/resultados/históricos congelados.Sem escrita noactivo.P131/P132:facto gerador7 separado de exigibilidade8 e parcelas de pagamento.P132remissão7(6) refere consignação3(3)d,não embalagensP102.P104remissão15(8) paraLei2/2006 ainda por corresponder;preparar conversão condicionada,não base fiscal confirmada.Prazo emissão dependente disposição/calendário concretos,não aplicar cinco dias úteis2008 por defeito após anúncio de alteração21RIVA.
|
||||
|
||||
## 25/10/2026 — P087/P127 entregues conjuntamente
|
||||
|
||||
Homologação **`92eaa935`**,sobre`ce9d649f`;candidata`d84883b8` expressamente aceite pela Tempo. Dois ramos,tres tratamentos e tres exemplos QA;uma integração/backup/restauro/instalação/conferência,provas QA reutilizadas.
|
||||
|
||||
- **P087**: Entrega material de bens em execução de contrato de locação com cláusula vinculante para ambas as partes de transferência da propriedade3(3)a. Classificação separada da base15(1):contraprestação obtida/a obter,sem próprioIVA,com composição/âmbito identificados. Não usar15(2)a da consignação,nem transformar mera opção de compra em cláusula vinculante.
|
||||
- **P127**: Cessão onerosa ou gratuita de estabelecimento,totalidade ou parte de património susceptível de constituir ramo independente3(5). Adquirente é ou passa pela aquisição a sujeito passivo2(1)a e pratica operações com direito à dedução. Imposto não devido nem exigível no âmbito demonstrado;não isenção genérica,nem base/taxa zero ou nova dedução. Não impor condição autónoma de continuidade além dos factos da fonte.
|
||||
|
||||
CIVA Lei13/2016:3(3)a PDF6/p1426(264);3(5) PDF7/p1426(265);15(1) PDF13/p1426(271),páginas visualmente conferidas.Lei22/2022PDF3 mantém15(1);Lei10/2025PDF12 mantém3(3)a/3(5),não altera15.Rectificação2017 sem alteração destas disposições.Acervo seisPDF inventariado/hashes conferidos. 2026;P087baseMZN exacta,classificação pode manter-se com base indeterminada.P127classificação própria de não exigibilidade,sem preencher base/IVA comzero.Sem exigibilidade fiscal calculada,nova dedução,campo11,regularização ou totaisModeloA.P125categoria/elegibilidademargem eP123consignação mantidos separados. P087:entrega material e clausula vinculante para ambas as partes,base15(1) identificada sem dupla soma/subtraccao.P127:cessao onerosa/gratuita,conjunto autonomo,adquirente2(1)a eoperacoes comdireito adeducao;nao exigibilidade3(5) nao e isencao generica,basezero ou nova deducao. Entradas,resultados,histórico e relatório preservados.
|
||||
|
||||
Main/destino conferidos,fast-forward normal;116fechos anteriores preservados. Backup novo e restauro real isolado sem rede:174tabelas/369ficheiros/configuração. Delta instalado:revisão,manifesto/hash,20marcadores compilados,quatro hashes funcionais e simuladorHTTP200. PostgreSQL pela mesma identidade antes/depois:29fichas publicadas/28relações/408geometrias preservadas,diferenças apenas cache/sessões. Zero migrações/importações/permissões alteradas ou ensaios sintéticos no activo. Contenção conferida,não aplicada;leitores/histórico/outrosramos preservados. Release/backup anteriores conservados.
|
||||
|
||||
[Manifesto/recibo](../simulations/l1-property-transfers-delivery-20261025.json),registo`iva_l1_property_transfers_P087_P127_homologation_20261025`. **118entregues +14funcionaispendentes +P001=133**,sem candidatasQApor disponibilizar. P121digital/P084/P085 eL1abertos;P084/P085 apenas preparação/simulação condicionada,incluídos nos14;P00105/06;bebidasL2/L3;Estatísticas/IAadiadas. Manter QAporramo eentregas conjuntas compativeis. Sequencia aceite:transversaisP104/P131/P132,depoisP002;digitalP121/P130;viagensP129/P133;importacoesP046/P047/P058/P059;documentaisP084/P085/P001 sem bloquear grupos independentes.
|
||||
|
||||
|
||||
## 25/10/2026 — P087/P127 concluídos emQA e situação dos16IDs não entregues
|
||||
|
||||
Implementação`5999e35f`. Doisramos,trêstratamentos:locaçãovinculativa,cessãoonerosa ecessãogratuita. CIVA Lei13/2016:3(3)a PDF6/p1426(264);3(5) PDF7/p1426(265);15(1) PDF13/p1426(271),páginas visualmente conferidas.Lei22/2022PDF3 mantém15(1);Lei10/2025PDF12 mantém3(3)a/3(5),não altera15.Rectificação2017 sem alteração destas disposições.Acervo seisPDF inventariado/hashes conferidos.
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,39 @@
|
||||
import {useState} from 'react';
|
||||
import {currencyEventBook,currencyEventCurrent,currencyEventReportRows,currencyEventSource,currencyEventTreatments,newCurrencyEvent,recordCurrencyEvents,saveCurrencyEventBook,switchCurrencyEvent,type CurrencyEventBook,type CurrencyEventRow} from '@/lib/iva-currency-events';
|
||||
export function SimulationCurrencyEvents({draft,onChange}:{draft:Record<string,unknown>;onChange:(field:string,value:string)=>void}){
|
||||
const[error,setError]=useState('');let book:CurrencyEventBook;try{book=currencyEventBook(draft);}catch(e){return<p role="alert">{String(e)}</p>;}
|
||||
const save=(next:CurrencyEventBook)=>{try{onChange('modelo_a_snapshot',saveCurrencyEventBook(draft,next));setError('');}catch(e){setError(String(e));}};
|
||||
const change=(id:string,patch:Partial<CurrencyEventRow>)=>save({...book,rows:book.rows.map(r=>r.id===id?{...r,...patch}:r)});
|
||||
return <details className="rounded border p-3"><summary>Moeda e datas do facto gerador/exigibilidade</summary><p>Facto gerador e exigibilidade são estados separados. Identifique a operação já preparada,sem repetir os seus cálculos. Conversão P104 é apenas cenário condicionado,enquanto a regra fiscal permanece por corresponder.</p><p>{currencyEventSource}</p>{error&&<p role="alert">{error}</p>}
|
||||
<button type="button" onClick={()=>save({...book,rows:[...book.rows,newCurrencyEvent(crypto.randomUUID(),String(draft.currency??''))]})}>Acrescentar moeda/evento</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>
|
||||
<label>Percurso de moeda/evento<select value={row.treatment} onChange={e=>change(row.id,switchCurrencyEvent(row,e.target.value))}><option value="">Por indicar</option>{currencyEventTreatments.map(t=><option key={t.id} value={t.id}>{t.label}</option>)}</select></label>
|
||||
<label>Natureza dos dados<select value={row.origin} onChange={e=>change(row.id,{origin:e.target.value as CurrencyEventRow['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 existente'],['period','Mês do contexto'],['documentRef','Documento / referência da previsão'],['documentDate','Data do documento'],['scope','Âmbito e parcelas abrangidas'],['evidence','Factos ou pressupostos expressos'],['amount','Montante total do âmbito identificado'],['currency','Moeda do montante / destino da conversão']] as const).map(([field,label])=><label className="block" key={field}>{label}<input value={row[field]} type={field==='period'?'month':field==='documentDate'?'date':'text'} onChange={e=>change(row.id,{[field]:e.target.value})}/></label>)}
|
||||
<label>Factos próprios correspondem ao percurso,operação e âmbito<select value={row.factsConfirmed} onChange={e=>change(row.id,{factsConfirmed:e.target.value as CurrencyEventRow['factsConfirmed']})}><option value="">Por esclarecer</option><option value="yes">Sim</option><option value="no">Não</option></select></label>
|
||||
{row.treatment==='foreign_scenario'?<>
|
||||
{([['sourceCurrency','Moeda original'],['fxRate','Taxa de conversão indicada'],['fxDate','Data efectiva da taxa'],['fxSource','Fonte e exemplar da taxa'],['fxRuleRef','Regra/pressuposto da escolha da taxa e data']] as const).map(([field,label])=><label className="block" key={field}>{label}<input value={row[field]} type={field==='fxDate'?'date':'text'} onChange={e=>change(row.id,{[field]:e.target.value})}/></label>)}
|
||||
<label>Direcção da taxa<select value={row.fxDirection} onChange={e=>change(row.id,{fxDirection:e.target.value as CurrencyEventRow['fxDirection']})}><option value="">Por indicar</option><option value="mzn_per_unit">MZN por unidade da moeda original</option><option value="units_per_mzn">Unidades da moeda original por MZN</option></select></label><p>O valor convertido é uma simulação condicionada. Não substitui a base fiscal,nem altera os valores/moedas dos livros anteriores.</p>
|
||||
</>:row.treatment&&<>
|
||||
{([['eventDate','Data própria do evento escolhido'],['eventRef','Referência e factos do evento7/8'],['reviewDate','Data até à qual os eventos foram conferidos']] as const).filter(([field])=>field!=='eventDate'||!['advance_payment','consignment_deadline'].includes(row.treatment)).map(([field,label])=><label className="block" key={field}>{label}<input value={row[field]} type={field==='eventRef'?'text':'date'} onChange={e=>change(row.id,{[field]:e.target.value})}/></label>)}
|
||||
{['consignment_deadline','service_early_charge','contract_effects'].includes(row.treatment)&&<label>{row.treatment==='consignment_deadline'?'Entrega ao destinatário da consignação':row.treatment==='service_early_charge'?'Data de realização do serviço posterior à cobrança/débito':'Disponibilização anterior aos efeitos translativos'}<input type="date" value={row.otherDate} onChange={e=>change(row.id,{otherDate:e.target.value})}/></label>}
|
||||
{row.treatment==='contract_effects'&&<p>Este percurso7(7) exclui locação vinculativa e venda com reserva3(3)a/b. Confirme essa distinção nos factos.</p>}
|
||||
{row.treatment==='continuous_period'&&<p>Use o termo do período a que respeita cada pagamento sucessivo,não a data arbitrária de emissão.</p>}
|
||||
{row.treatment==='consignment_deadline'&&<p>7(6) fixa exigibilidade no termo180dias da consignação. P123 conserva a conferência da não devolução;embalagensP102 são distintas.</p>}
|
||||
{!['import_clearance','import_auction'].includes(row.treatment)&&<>
|
||||
<label>Operação sujeita à obrigação de emitir factura25<select value={row.invoiceRequired} onChange={e=>change(row.id,{invoiceRequired:e.target.value as CurrencyEventRow['invoiceRequired']})}><option value="">Por esclarecer</option><option value="yes">Sim</option><option value="no">Não</option></select></label>
|
||||
{row.invoiceRequired==='yes'&&<>
|
||||
{([['legalDeadline','Termo legal do prazo de emissão aplicável'],['deadlineRef','Disposição,calendário e âmbito que fundamentam esse prazo']] as const).map(([field,label])=><label className="block" key={field}>{label}<input value={row[field]} type={field==='legalDeadline'?'date':'text'} onChange={e=>change(row.id,{[field]:e.target.value})}/></label>)}
|
||||
<label>Facturação até à conferência<select value={row.invoiceState} onChange={e=>change(row.id,{invoiceState:e.target.value as CurrencyEventRow['invoiceState']})}><option value="">Por esclarecer</option><option value="issued">Factura emitida</option><option value="not_issued">Factura não emitida</option></select></label>
|
||||
{row.invoiceState==='issued'&&<>{([['invoiceDate','Data de emissão da factura'],['invoiceRef','Referência da factura']] as const).map(([field,label])=><label key={field}>{label}<input value={row[field]} type={field==='invoiceDate'?'date':'text'} onChange={e=>change(row.id,{[field]:e.target.value})}/></label>)}</>}
|
||||
<label>Recebimentos neste âmbito<select value={row.paymentState} onChange={e=>change(row.id,{paymentState:e.target.value as CurrencyEventRow['paymentState']})}><option value="">Por esclarecer</option><option value="none">Sem recebimento</option><option value="received">Recebimento identificado</option></select></label>
|
||||
{row.paymentState==='received'&&<>{([['paymentDate','Data de recebimento'],['paymentAmount','Montante recebido'],['paymentRef','Referência e âmbito do recebimento']] as const).map(([field,label])=><label className="block" key={field}>{label}<input value={row[field]} type={field==='paymentDate'?'date':'text'} onChange={e=>change(row.id,{[field]:e.target.value})}/></label>)}</>}
|
||||
<p>O recebimento anterior é separado do restante,sem dupla contagem. Para parcelas com factos distintos,use âmbitos distintos e conserve as referências.</p>
|
||||
</>}
|
||||
</>}
|
||||
</>}
|
||||
<p>Trocar percurso conserva dados ocultos e referências;reveja as confirmações aplicáveis.</p></details>)}
|
||||
{!!book.rows.length&&<button type="button" onClick={()=>{try{save(recordCurrencyEvents(draft,book));}catch(e){setError(String(e));}}}>Conferir moeda/eventos e guardar versão</button>}
|
||||
{book.result&&<><p role="status">{currencyEventCurrent(draft,book)?'Resultados correspondentes às entradas guardadas.':'Entradas alteradas;histórico conservado.'} {book.history?.length??0} versões anteriores.P104condicionado,semIVA/base/dedução activados.</p><dl>{currencyEventReportRows(draft).map(([,label,value,origin],i)=><div key={i}><dt>{label}</dt><dd>{value}<small className="block">{origin}</small></dd></div>)}</dl></>}
|
||||
</details>;
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
import {useState} from 'react';
|
||||
import {digitalBook,digitalConditions,digitalCurrent,digitalReportRows,digitalSource,digitalTreatments,newDigitalRow,recordDigital,saveDigitalBook,switchDigitalKind,switchDigitalTreatment,type DigitalBook,type DigitalRow} from '@/lib/iva-digital';
|
||||
|
||||
export function SimulationDigital({draft,onChange}:{draft:Record<string,unknown>;onChange:(field:string,value:string)=>void}){
|
||||
const[error,setError]=useState('');let book:DigitalBook;
|
||||
try{book=digitalBook(draft);}catch(e){return<p role="alert">{String(e)}</p>;}
|
||||
const save=(next:DigitalBook)=>{try{onChange('modelo_a_snapshot',saveDigitalBook(draft,next));setError('');}catch(e){setError(String(e));}};
|
||||
const change=(id:string,patch:Partial<DigitalRow>)=>save({...book,rows:book.rows.map(r=>r.id===id?{...r,...patch}:r)});
|
||||
return<details className="space-y-3 rounded border p-3"><summary>Bens e serviços digitais — natureza, localização e obrigações</summary>
|
||||
<p>Distinga o activo transmitido da funcionalidade prestada. O nome comercial, a moeda, a nacionalidade ou um servidor não determinam sozinhos o tratamento. Reutilize as referências da operação e os documentos disponíveis.</p>
|
||||
<p>Localização não concede isenção nem calcula IVA ou dedução. A identificação do responsável não apresenta uma declaração nem inicia pagamento. As formalidades remetidas para regulamentação ficam assinaladas.</p>
|
||||
<p><strong>Cobertura digital deste incremento:</strong> identificação da natureza, localização, responsável, rascunho, histórico e relatório. As formalidades regulamentares ainda não cotejadas — modelos da declaração e do mapa de retenções, procedimentos de entrega e pagamento — não estão automatizadas. Não representa cobertura digital integral nem calcula imposto ou dedução.</p>
|
||||
<p>{digitalSource}</p>{error&&<p role="alert">{error}</p>}
|
||||
<button type="button" className="underline" onClick={()=>save({...book,rows:[...book.rows,newDigitalRow(crypto.randomUUID())]})}>Acrescentar operação digital</button>
|
||||
{book.rows.map(row=><details key={row.id} className="rounded border p-3"><summary>{row.description||'Operação digital por identificar'} — {row.period||'mês por indicar'}</summary><div className="grid gap-3 md:grid-cols-2">
|
||||
<label>Natureza da operação digital<select value={row.kind} onChange={e=>change(row.id,switchDigitalKind(row,e.target.value))}><option value="">Por esclarecer</option><option value="goods">P130 — Transmissão de bem digital</option><option value="service">P121 — Prestação de serviço digital</option></select></label>
|
||||
{row.kind&&<label>Tratamento digital<select value={row.treatment} onChange={e=>change(row.id,switchDigitalTreatment(row,e.target.value))}><option value="">Por indicar</option>{digitalTreatments.filter(t=>t.kind===row.kind).map(t=><option key={t.id} value={t.id}>{t.label}</option>)}</select></label>}
|
||||
<label>Natureza dos dados<select value={row.origin} onChange={e=>change(row.id,{origin:e.target.value as DigitalRow['origin']})}><option value="projected">Projectados / pressupostos</option><option value="effective">Efectivos declarados</option></select></label>
|
||||
{([['description','Operação digital identificada'],['operationRef','Referência da operação / pressuposto'],['operationDate','Data da operação / prevista'],['period','Mês da operação'],['subjectRef','Objecto, direitos transmitidos ou funcionalidade prestada'],['natureRef','Fundamento da distinção bem/serviço e natureza digital'],['useRef','Destinatário e utilização / pressuposto'],['documentRef','Documento existente / referência da previsão'],['documentDate','Data do documento / prevista'],['scope','Âmbito: operação, bens/serviços, período e condições'],['evidence','Factos disponíveis / pressupostos expressos'],['buyerPlace','Estabelecimento ou domicílio do adquirente'],['buyerRef','Referência do estabelecimento ou domicílio adquirente']] as const).map(([field,label])=><label key={field}>{label}<input type={['operationDate','documentDate'].includes(field)?'date':field==='period'?'month':'text'} value={row[field]} onChange={e=>change(row.id,{[field]:e.target.value})}/></label>)}
|
||||
<label>País do estabelecimento ou domicílio adquirente<select value={row.buyerCountry} onChange={e=>change(row.id,{buyerCountry:e.target.value})}><option value="">Por esclarecer</option><option value="MZ">Moçambique</option><option value="foreign">Estrangeiro</option></select></label>
|
||||
{row.buyerCountry!=='foreign'&&<>
|
||||
<label>Sede, EP ou domicílio a partir do qual o fornecedor opera<input value={row.providerPlace} onChange={e=>change(row.id,{providerPlace:e.target.value})}/></label><label>Referência desse estabelecimento fornecedor<input value={row.providerRef} onChange={e=>change(row.id,{providerRef:e.target.value})}/></label>
|
||||
<label>País do estabelecimento fornecedor<select value={row.providerCountry} onChange={e=>change(row.id,{providerCountry:e.target.value})}><option value="">Por esclarecer</option><option value="MZ">Moçambique</option><option value="foreign">Estrangeiro</option></select></label>
|
||||
</>}
|
||||
{row.buyerCountry==='MZ'&&row.providerCountry==='foreign'&&<>
|
||||
<label>Adquirente sujeito passivo nacional —26(4)<select value={row.buyerTaxable} onChange={e=>change(row.id,{buyerTaxable:e.target.value})}><option value="">Por esclarecer</option><option value="yes">Sim</option><option value="no">Não</option></select></label>
|
||||
<label>Fundamento da qualidade fiscal do adquirente<input value={row.buyerTaxRef} onChange={e=>change(row.id,{buyerTaxRef:e.target.value})}/></label><p>A qualidade fiscal serve para identificar o responsável; a sua falta não transforma a localização nacional em operação estrangeira.</p>
|
||||
{row.buyerTaxable==='no'&&<>
|
||||
<label>Fornecedor não residente sujeito passivo<select value={row.providerTaxable} onChange={e=>change(row.id,{providerTaxable:e.target.value})}><option value="">Por esclarecer</option><option value="yes">Sim</option><option value="no">Não</option></select></label><label>Fundamento da qualidade fiscal do fornecedor não residente<input value={row.providerTaxRef} onChange={e=>change(row.id,{providerTaxRef:e.target.value})}/></label>
|
||||
<label>Representante residente nomeado —26(1)<select value={row.representative} onChange={e=>change(row.id,{representative:e.target.value})}><option value="">Por esclarecer</option><option value="yes">Sim</option><option value="no">Não</option></select></label>
|
||||
{row.representative==='yes'&&<><label>Representante e referência da procuração/poderes<input value={row.representativeRef} onChange={e=>change(row.id,{representativeRef:e.target.value})}/></label><label>Nomeação comunicada à contraparte antes da operação —26(2)<select value={row.communicationPrior} onChange={e=>change(row.id,{communicationPrior:e.target.value})}><option value="">Por esclarecer</option><option value="yes">Sim</option><option value="no">Não</option></select></label><label>Referência da comunicação<input value={row.communicationRef} onChange={e=>change(row.id,{communicationRef:e.target.value})}/></label></>}
|
||||
{row.representative==='no'&&<><label>Aquisição no exercício de actividade comercial, industrial ou profissional —26(3)<select value={row.businessUse} onChange={e=>change(row.id,{businessUse:e.target.value})}><option value="">Por esclarecer</option><option value="yes">Sim</option><option value="no">Não</option></select></label><label>Referência dessa actividade e aquisição<input value={row.businessRef} onChange={e=>change(row.id,{businessRef:e.target.value})}/></label></>}
|
||||
</>}
|
||||
</>}
|
||||
{row.buyerCountry==='MZ'&&row.providerCountry==='MZ'&&<>
|
||||
<label>Fornecedor sujeito passivo nacional<select value={row.providerTaxable} onChange={e=>change(row.id,{providerTaxable:e.target.value})}><option value="">Por esclarecer</option><option value="yes">Sim</option><option value="no">Não</option></select></label><label>Fundamento da qualidade fiscal do fornecedor<input value={row.providerTaxRef} onChange={e=>change(row.id,{providerTaxRef:e.target.value})}/></label>
|
||||
{row.kind==='goods'&&<><label>Local do bem na colocação à disposição —6(1)<select value={row.goodsPlace} onChange={e=>change(row.id,{goodsPlace:e.target.value})}><option value="">Por demonstrar</option><option value="MZ">Moçambique, segundo fundamento identificado</option><option value="foreign">Estrangeiro, segundo fundamento identificado</option></select></label><label>Fundamento do local do bem digital — sem inferência pelo servidor<input value={row.goodsPlaceRef} onChange={e=>change(row.id,{goodsPlaceRef:e.target.value})}/></label></>}
|
||||
</>}
|
||||
</div><fieldset><legend>Factos próprios da natureza escolhida</legend>{digitalConditions(row.kind).map(([key,label])=><label className="block" key={key}>{label}<select value={row.conditions[key]??''} onChange={e=>change(row.id,{conditions:{...row.conditions,[key]:e.target.value as ''|'yes'|'no'}})}><option value="">Por esclarecer</option><option value="yes">Sim</option><option value="no">Não</option></select></label>)}</fieldset>
|
||||
<p>Mudar natureza ou tratamento conserva referências e campos ocultos; reveja as confirmações próprias. Os dados não são copiados de outra oportunidade.</p></details>)}
|
||||
{!!book.rows.length&&<button type="button" onClick={()=>{try{save(recordDigital(draft,book));}catch(e){setError(String(e));}}}>Classificar operações digitais e guardar versão</button>}
|
||||
{book.result&&<><p role="status">{digitalCurrent(draft,book)?'Resultados correspondem às entradas guardadas.':'Entradas alteradas; resultados históricos conservados. Reveja o delta afectado.'} {book.history?.length??0} versões anteriores. Sem cálculo de IVA ou dedução.</p><dl>{digitalReportRows(draft).map(([,label,value,origin],i)=><div key={i}><dt>{label}</dt><dd>{value}<small className="block">{origin}</small></dd></div>)}</dl></>}
|
||||
</details>;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
import {useState} from 'react';
|
||||
import {foreignOperationBook,foreignOperationCurrent,foreignOperationReportRows,foreignOperationSource,foreignSources,foreignEvents,newForeignOperation,recordForeignOperations,saveForeignOperationBook,switchForeignSource,type ForeignOperationBook,type ForeignOperationRow} from '@/lib/iva-foreign-operations';
|
||||
export function SimulationForeignOperations({draft,onChange}:{draft:Record<string,unknown>;onChange:(field:string,value:string)=>void}){
|
||||
const[error,setError]=useState('');let book:ForeignOperationBook;try{book=foreignOperationBook(draft);}catch(e){return<p role="alert">{String(e)}</p>;}
|
||||
const save=(next:ForeignOperationBook)=>{try{onChange('modelo_a_snapshot',saveForeignOperationBook(draft,next));setError('');}catch(e){setError(String(e));}};
|
||||
const change=(id:string,patch:Partial<ForeignOperationRow>)=>save({...book,rows:book.rows.map(r=>r.id===id?{...r,...patch}:r)});
|
||||
return<details className="rounded border p-3"><summary>Operações no estrangeiro — localização e enquadramento</summary><p>Reutilize uma localização já guardada nesta oportunidade. Fora do território não significa isenção,IVA zero ou dedução concedida. Não é necessário repetir os factos/documentos da localização.</p><p>{foreignOperationSource}</p>{error&&<p role="alert">{error}</p>}
|
||||
<button type="button" onClick={()=>save({...book,rows:[...book.rows,newForeignOperation(crypto.randomUUID())]})}>Acrescentar análise de operação no estrangeiro</button>
|
||||
{book.rows.map(row=>{let sources:ReturnType<typeof foreignSources>=[],events:ReturnType<typeof foreignEvents>=[];try{sources=foreignSources(draft,row.sourceKind);events=foreignEvents(draft);}catch{/* Existing readers retain corrupt originals. */}const source=sources.find(s=>s.id===row.sourceRowId);return<details key={row.id}><summary>{source?.description||'Operação por associar'} — {source?.period||'período da origem'}</summary>
|
||||
<label>Origem da localização<select value={row.sourceKind} onChange={e=>change(row.id,switchForeignSource(row,e.target.value as ForeignOperationRow['sourceKind']))}><option value="">Por indicar</option><option value="goods">Bens corpóreos</option><option value="services">Serviços e transporte</option><option value="listed">Serviços enumerados não digitais</option><option value="digital">Bens e serviços digitais</option></select></label>
|
||||
<label>Resultado de localização existente<select value={row.sourceRowId} onChange={e=>change(row.id,switchForeignSource(row,row.sourceKind,e.target.value))}><option value="">Escolher operação</option>{sources.map(s=><option key={s.id} value={s.id}>{s.description} — {s.period} — {s.territory??'Indeterminado'}{s.current?'':' — histórico'}</option>)}</select></label>
|
||||
{row.sourceKind&&!sources.length&&<p>Prepare a localização nas secções de bens/serviços existentes desta oportunidade. Nenhuma localização é presumida ou copiada de outro projecto.</p>}
|
||||
{source&&<p>Operação: {source.operationRef}. Âmbito: {source.scope}. {source.reason}</p>}
|
||||
{source?.territory==='partial'&&<label>Parcela deste trajecto analisada<select value={row.territorialPart} onChange={e=>change(row.id,{territorialPart:e.target.value as ForeignOperationRow['territorialPart']})}><option value="">Delimitar parcela</option><option value="outside">Parcela fora do território nacional</option><option value="national">Parcela nacional</option></select></label>}
|
||||
{source&&source.territory!=='national'&&<>
|
||||
<label>Evento já guardado da mesma operação,quando aplicável<select value={row.eventRowId} onChange={e=>change(row.id,{eventRowId:e.target.value})}><option value="">Sem associação necessária nesta análise territorial</option>{events.filter(e=>e.operationRef===source.operationRef&&e.period===source.period).map(e=><option key={e.id} value={e.id}>{e.description} — {e.period}{e.current?'':' — histórico'}</option>)}</select></label>
|
||||
<label>Seria tributável se efectuada no território nacional?<select value={row.hypotheticalTaxable} onChange={e=>change(row.id,{hypotheticalTaxable:e.target.value as ForeignOperationRow['hypotheticalTaxable']})}><option value="">Por esclarecer</option><option value="yes">Sim,segundo o fundamento identificado</option><option value="no">Não,segundo o fundamento identificado</option></select></label>
|
||||
<label>Fundamento da hipótese interna e exclusões aplicáveis<input value={row.hypotheticalRef} onChange={e=>change(row.id,{hypotheticalRef:e.target.value})}/></label>
|
||||
{row.hypotheticalTaxable==='yes'&&<label>Existe exclusão19(2) aplicável:17-A ou pagamentos15(6)c?<select value={row.excluded19_2} onChange={e=>change(row.id,{excluded19_2:e.target.value as ForeignOperationRow['excluded19_2']})}><option value="">Por esclarecer</option><option value="yes">Sim</option><option value="no">Não</option></select></label>}
|
||||
</>}
|
||||
<label>Âmbito da análise,conjunto/parcela e período<input value={row.scope} onChange={e=>change(row.id,{scope:e.target.value})}/></label><label>Factos ou pressupostos expressos<input value={row.evidence} onChange={e=>change(row.id,{evidence:e.target.value})}/></label><p>Trocar origem conserva fundamentos ocultos;reveja as confirmações. Nenhuma dedução é lançada por esta análise.</p>
|
||||
</details>;})}
|
||||
{!!book.rows.length&&<button type="button" onClick={()=>{try{save(recordForeignOperations(draft,book));}catch(e){setError(String(e));}}}>Analisar operação estrangeira e guardar versão</button>}
|
||||
{book.result&&<><p role="status">{foreignOperationCurrent(draft,book)?'Análise corresponde às entradas e origens guardadas.':'Entradas ou origens alteradas;resultado histórico conservado. Reveja apenas o delta afectado.'} {book.history?.length??0} versões anteriores.Sem dedução/IVA calculados.</p><dl>{foreignOperationReportRows(draft).map(([,label,value,origin],i)=><div key={i}><dt>{label}</dt><dd>{value}<small className="block">{origin}</small></dd></div>)}</dl></>}
|
||||
</details>;
|
||||
}
|
||||
@@ -1,3 +1,6 @@
|
||||
import { SimulationDigital } from './simulation-digital';
|
||||
import { SimulationForeignOperations } from './simulation-foreign-operations';
|
||||
import { SimulationCurrencyEvents } from './simulation-currency-events';
|
||||
import { SimulationPropertyTransfers } from './simulation-property-transfers';
|
||||
import { SimulationGoodsPresumptions } from './simulation-goods-presumptions';
|
||||
import { InvestmentContextAssessment } from './investment-context-assessment';
|
||||
@@ -123,6 +126,9 @@ export function SimulationMonthlyIva({draft, busy, onCalculate, onChange}: {
|
||||
<SimulationReducedBases draft={draft} onChange={onChange} />
|
||||
<SimulationOwnName draft={draft} onChange={onChange} />
|
||||
<SimulationGoodsAllocation draft={draft} onChange={onChange} />
|
||||
<SimulationForeignOperations draft={draft} onChange={onChange} />
|
||||
<SimulationDigital draft={draft} onChange={onChange} />
|
||||
<SimulationCurrencyEvents draft={draft} onChange={onChange} />
|
||||
<SimulationPropertyTransfers draft={draft} onChange={onChange} />
|
||||
<SimulationGoodsPresumptions draft={draft} onChange={onChange} />
|
||||
<SimulationSecondhand draft={draft} onChange={onChange} />
|
||||
|
||||
@@ -824,7 +824,7 @@ function scaledDecimal(value: string, scale: number, label: string): bigint {
|
||||
);
|
||||
}
|
||||
|
||||
function convertCents(
|
||||
export function convertCents(
|
||||
value: bigint,
|
||||
rateScaled: bigint,
|
||||
rateScale: bigint,
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
import {acquisitionScope,readAcquisitionStore} from './iva-acquisitions.ts';
|
||||
import {convertCents as convertScaledAmount} from './business-financial-plan.ts';
|
||||
export const currencyEventVersion='currency-events/1';
|
||||
export const currencyEventSource='CIVA Lei13/2016,7(1)–(7),PDF8/p1426(266);8,PDF9/p1426(267);15(8),PDF14/p1426(272).Lei22/2022 eLei10/2025 não alteram7/8,15(8)mantido.RIVA21/2008PDF4:regra histórica5dias úteis,não prazo automático vigente;usar prazo e disposição aplicáveis identificados. P104:Lei2/2006 obtida,106(5)conferido;regra taxa/data ainda por demonstrar;conversão apenas cenário condicionado,sem base fiscal confirmada.';
|
||||
export const currencyEventTreatments=[
|
||||
{id:'foreign_scenario',branch:'P104',label:'Moeda estrangeira — cenário condicionado'},
|
||||
{id:'goods_available',branch:'P131',label:'Bens postos à disposição7(1)a'},
|
||||
{id:'goods_transport',branch:'P131',label:'Início do transporte7(2)'},
|
||||
{id:'goods_installation',branch:'P131',label:'Instalação/montagem concluída7(2)'},
|
||||
{id:'service_completed',branch:'P131',label:'Serviço realizado7(1)b'},
|
||||
{id:'service_early_charge',branch:'P131',label:'Serviço cobrado/debitado antes da realização7(1)b'},
|
||||
{id:'import_clearance',branch:'P131',label:'Desembaraço aduaneiro7(1)c'},
|
||||
{id:'import_auction',branch:'P131',label:'Arrematação/venda na importação7(1)c'},
|
||||
{id:'continuous_period',branch:'P131',label:'Termo do período de pagamento sucessivo7(3)'},
|
||||
{id:'contract_effects',branch:'P131',label:'Efeitos translativos posteriores7(7)'},
|
||||
{id:'own_goods',branch:'P132',label:'Afectação/transmissão assimilada3(3)e/f e7(4)'},
|
||||
{id:'own_services',branch:'P132',label:'Serviço assimilado4(2) e7(4)'},
|
||||
{id:'commission_delivery',branch:'P132',label:'Comissário põe bens à disposição7(5)'},
|
||||
{id:'consignment_deadline',branch:'P132',label:'Termo de180dias da consignação7(6)'},
|
||||
{id:'advance_payment',branch:'P132',label:'Pagamento anterior à factura8c'},
|
||||
] as const;
|
||||
type Choice=''|'yes'|'no';
|
||||
export type CurrencyEventRow={id:string;treatment:string;description:string;period:string;origin:'projected'|'effective';operationRef:string;documentRef:string;documentDate:string;scope:string;evidence:string;eventDate:string;eventRef:string;otherDate:string;reviewDate:string;factsConfirmed:Choice;invoiceRequired:Choice;invoiceState:''|'issued'|'not_issued';invoiceDate:string;invoiceRef:string;legalDeadline:string;deadlineRef:string;paymentState:''|'none'|'received';paymentDate:string;paymentRef:string;amount:string;paymentAmount:string;currency:string;sourceCurrency:string;fxRate:string;fxDate:string;fxSource:string;fxRuleRef:string;fxDirection:''|'mzn_per_unit'|'units_per_mzn';};
|
||||
type DueEvent={date:string;amount:string|null;reason:string};
|
||||
type LineResult={id:string;status:'determined'|'not_applicable'|'indeterminate'|'conditional';eventDate:string|null;dueEvents:DueEvent[];remainingPending:boolean;scenarioAmount:string|null;baseAmount:null;vat:null;rate:null;reason:string};
|
||||
export type CurrencyEventCalculation={version:string;revision:number;calculatedAt:string;opportunity:string;location:string;sourceKey:string;source:string;inputs:CurrencyEventRow[];rows:LineResult[]};
|
||||
export type CurrencyEventBook={rows:CurrencyEventRow[];result?:CurrencyEventCalculation;history?:CurrencyEventCalculation[]};
|
||||
type Store=ReturnType<typeof readAcquisitionStore>&{currencyEvents?:Record<string,CurrencyEventBook>};
|
||||
export function newCurrencyEvent(id:string,currency:string):CurrencyEventRow{return{id,treatment:'',description:'',period:'',origin:'projected',operationRef:'',documentRef:'',documentDate:'',scope:'',evidence:'',eventDate:'',eventRef:'',otherDate:'',reviewDate:'',factsConfirmed:'',invoiceRequired:'',invoiceState:'',invoiceDate:'',invoiceRef:'',legalDeadline:'',deadlineRef:'',paymentState:'',paymentDate:'',paymentRef:'',amount:'',paymentAmount:'',currency,sourceCurrency:'',fxRate:'',fxDate:'',fxSource:'',fxRuleRef:'',fxDirection:''};}
|
||||
export function switchCurrencyEvent(row:CurrencyEventRow,treatment:string):CurrencyEventRow{return{...row,treatment,factsConfirmed:'',invoiceRequired:''};}
|
||||
function readStore(draft:Record<string,unknown>):Store{const store=readAcquisitionStore(draft.modelo_a_snapshot) as Store;
|
||||
if(store.currencyEvents!==undefined&&(!store.currencyEvents||typeof store.currencyEvents!=='object'||Array.isArray(store.currencyEvents)))throw new Error('Moeda/eventos não recuperáveis;originais preservados.');
|
||||
const fields=Object.keys(newCurrencyEvent('',''));
|
||||
for(const b of Object.values(store.currencyEvents??{}))if(!b||!Array.isArray(b.rows)||(b.history!==undefined&&!Array.isArray(b.history))||b.rows.some(r=>!r||fields.some(k=>typeof r[k as keyof CurrencyEventRow]!=='string')))throw new Error('Linhas de moeda/eventos não recuperáveis;sem lista vazia por defeito.');return store;}
|
||||
export function currencyEventBook(draft:Record<string,unknown>):CurrencyEventBook{return readStore(draft).currencyEvents?.[acquisitionScope(draft)]??{rows:[]};}
|
||||
export function saveCurrencyEventBook(draft:Record<string,unknown>,book:CurrencyEventBook):string{const store=readStore(draft),encoded=JSON.stringify({...store,currencyEvents:{...store.currencyEvents,[acquisitionScope(draft)]:book}});readStore({...draft,modelo_a_snapshot:encoded});return encoded;}
|
||||
function date(s:string):number|null{const n=Date.parse(s+'T00:00:00Z');return /^\d{4}-\d{2}-\d{2}$/.test(s)&&Number.isFinite(n)&&new Date(n).toISOString().slice(0,10)===s?n:null;}
|
||||
function decimal(s:string,places=6):bigint|null{if(!new RegExp('^\\d{1,15}(\\.\\d{1,'+places+'})?$').test(s.trim()))return null;const[w,f='']=s.trim().split('.');return BigInt(w)*10n**BigInt(places)+BigInt(f.padEnd(places,'0'));}
|
||||
function money(n:bigint):string{return`${n/1000000n}.${(n%1000000n).toString().padStart(6,'0').replace(/0+$/,'').padEnd(2,'0')}`;}
|
||||
export function evaluateCurrencyEvent(row:CurrencyEventRow):LineResult{
|
||||
const result:LineResult={id:row.id,status:'indeterminate',eventDate:null,dueEvents:[],remainingPending:false,scenarioAmount:null,baseAmount:null,vat:null,rate:null,reason:''};const stop=(reason:string,status:LineResult['status']='indeterminate')=>({...result,status,reason});
|
||||
if(!currencyEventTreatments.some(t=>t.id===row.treatment))return stop('Identifique percurso de moeda/evento.');
|
||||
if(!/^2026-(0[1-9]|1[0-2])$/.test(row.period)||!['projected','effective'].includes(row.origin)||date(row.documentDate)===null||![row.description,row.operationRef,row.documentRef,row.scope,row.evidence].every(v=>!!v.trim()))return stop('Identifique mês de contexto2026,operação,documento/data,âmbito e factos ou pressupostos expressos.');
|
||||
if(row.factsConfirmed==='no')return stop('Os factos declarados afastam este percurso;sem isenção ou IVA zero por defeito.','not_applicable');
|
||||
if(row.factsConfirmed!=='yes')return stop('Factos do percurso por esclarecer;não usar datas ou câmbio por defeito.');
|
||||
if(row.treatment==='foreign_scenario'){
|
||||
const amount=decimal(row.amount),fx=decimal(row.fxRate,8);
|
||||
if(row.currency!=='MZN'||!['USD','EUR','ZAR','GBP','CNY','BRL','JPY','CHF','AUD','CAD'].includes(row.sourceCurrency)||amount===null||fx===null||fx===0n||date(row.fxDate)===null||![row.fxSource,row.fxRuleRef].every(v=>!!v.trim())||!['mzn_per_unit','units_per_mzn'].includes(row.fxDirection))return stop('Indique moeda original,valor,taxa positiva,direcção,data,fonte e regra/pressuposto expresso.Sem substituir moeda original porMZN ou reutilizar taxa de apresentação como regra fiscal.');
|
||||
result.scenarioAmount=money(row.fxDirection==='mzn_per_unit'?convertScaledAmount(amount,fx,100000000n):(amount*100000000n+fx/2n)/fx);
|
||||
return stop(`P104:cenário condicionado=${result.scenarioAmount}MZN,origem${row.sourceCurrency},taxa${row.fxRate},${row.fxDirection},data${row.fxDate}. CotejoLei2/2006 concluido:106(5)nao define taxa/data;regra complementar15(8) ainda por demonstrar;referência indicada é pressuposto,não validação da taxa legal.Base fiscal permanece indeterminada.Sem IVA ou activação nos livros anteriores.`,`conditional`);
|
||||
}
|
||||
const review=date(row.reviewDate),event=date(row.eventDate);if(review===null||!row.eventRef.trim())return stop('Identifique data de conferência e documento/âmbito do evento específico.');
|
||||
if(row.treatment==='consignment_deadline'){
|
||||
const delivery=date(row.otherDate);if(delivery===null)return stop('Identifique entrega das mercadorias à consignação3(3)d;7(6) exige termo180dias,não embalagensP102.');
|
||||
result.eventDate=new Date(delivery+180*86400000).toISOString().slice(0,10);
|
||||
}else if(row.treatment==='advance_payment'){
|
||||
if(date(row.paymentDate)===null)return stop('Identifique recebimento anterior à factura para8c.');result.eventDate=null;
|
||||
}else{
|
||||
if(event===null)return stop('Identifique a data própria do evento7,sem inferir da emissão do documento.');result.eventDate=row.eventDate;
|
||||
if(row.treatment==='service_early_charge'&&(date(row.otherDate)===null||event>=date(row.otherDate)!))return stop('Indique realização do serviço posterior à cobrança/débito;aplique o evento apenas ao montante respectivo.');
|
||||
if(row.treatment==='contract_effects'&&(date(row.otherDate)===null||event<date(row.otherDate)!))return stop('Indique disponibilização anterior ou simultânea aos efeitos translativos;este7(7) exclui3(3)a/b,que têm percursos próprios.');
|
||||
}
|
||||
if(['import_clearance','import_auction'].includes(row.treatment)){
|
||||
if(date(result.eventDate!)!>review)return stop('Evento aduaneiro futuro na conferência;sem exigibilidade declarada.');
|
||||
result.dueEvents=[{date:result.eventDate!,amount:decimal(row.amount)===null?null:money(decimal(row.amount)!),reason:'7(1)c:desembaraço/arrematação/venda na importação;factura comercial não desloca o evento aduaneiro'}];return stop('Importação7(1)c:facto gerador/exigibilidade pelo evento aduaneiro identificado;sem aplicar8 por factura comercial,nem calcular base/IVA.','determined');
|
||||
}
|
||||
if(row.invoiceRequired==='')return stop('Identifique se esta operação dá lugar à obrigação de factura25;7 e8 são estados separados.');
|
||||
if(row.invoiceRequired==='no'){
|
||||
if(result.eventDate&&date(result.eventDate)!>review)return stop('Evento futuro na conferencia;sem exigibilidade declarada.');
|
||||
if(row.treatment==='advance_payment')return stop('Percurso8c exige operação com obrigação de factura;conferir enquadramento.','not_applicable');
|
||||
result.dueEvents=[{date:result.eventDate!,amount:decimal(row.amount)===null?null:money(decimal(row.amount)!),reason:'Exigibilidade segundo evento7,sem obrigação de factura declarada'}];return stop('Facto gerador e exigibilidade7 identificados no âmbito declarado;sem calcular IVA,base ou dedução.','determined');
|
||||
}
|
||||
const deadline=date(row.legalDeadline);if(deadline===null||!row.deadlineRef.trim()||(result.eventDate&&deadline<date(result.eventDate)!))return stop('Facto gerador identificado;indique prazo legal de emissão e disposição/calendário aplicáveis.Sem presumir automaticamente cinco dias úteis2008 ou feriados.');
|
||||
if(!['issued','not_issued'].includes(row.invoiceState)||!['none','received'].includes(row.paymentState))return stop('Identifique emissão e recebimentos;desconhecido não é ausência de pagamento.');
|
||||
const invoice=row.invoiceState==='issued'?date(row.invoiceDate):null;
|
||||
if(row.invoiceState==='issued'&&(invoice===null||invoice>review||!row.invoiceRef.trim()))return stop('Identifique factura efectivamente emitida/data/referência até à conferência.');
|
||||
const normalDate=invoice!==null&&invoice<=deadline?row.invoiceDate:row.legalDeadline;const total=decimal(row.amount);
|
||||
let paid=0n;
|
||||
if(row.paymentState==='received'){
|
||||
const payment=date(row.paymentDate),amount=decimal(row.paymentAmount);
|
||||
if(payment===null||payment>review||amount===null||total===null||amount>total||!row.paymentRef.trim())return stop('Identifique recebimento,parcela e total do âmbito na mesma moeda;pagamento não pode exceder o total.Sem duplicar parcelas nem substituir montante desconhecido porzero.');
|
||||
if((invoice===null||payment<invoice)&&payment<date(normalDate)!){paid=amount;result.dueEvents.push({date:row.paymentDate,amount:money(amount),reason:'8c:montante recebido antes da factura,sem prejuízo do termo do prazo8b'});}
|
||||
else if(row.treatment==='advance_payment')return stop('Pagamento não é anterior à factura/termo aplicável;não antecipar por8c.','not_applicable');
|
||||
}
|
||||
if(row.treatment==='advance_payment'&&row.paymentState!=='received')return stop('Identifique o recebimento anterior à factura.');
|
||||
const remainder=total===null?null:total-paid;
|
||||
if(date(normalDate)!<=review){if(remainder===null||remainder>0n)result.dueEvents.push({date:normalDate,amount:remainder===null?null:money(remainder),reason:invoice!==null&&invoice<=deadline?'8a:factura emitida dentro do prazo':'8b:termo do prazo de emissão'});}
|
||||
else result.remainingPending=remainder===null||remainder>0n;
|
||||
return stop('Exigibilidade separada em parcelas8a/b/c,sem dupla contagem do recebimento e restante. Facto gerador7 conservado;prazo legal parametrizado com referência aplicável.Sem IVA,base fiscal,nova dedução ou totaisModeloA.','determined');
|
||||
}
|
||||
function key(draft:Record<string,unknown>,book:CurrencyEventBook):string{return JSON.stringify({version:currencyEventVersion,scope:acquisitionScope(draft),location:draft.selection_labels??{},rows:book.rows});}
|
||||
export function currencyEventCurrent(draft:Record<string,unknown>,book:CurrencyEventBook):boolean{return!!book.result&&book.result.sourceKey===key(draft,book);}
|
||||
export function recordCurrencyEvents(draft:Record<string,unknown>,book:CurrencyEventBook):CurrencyEventBook{if(!book.rows.length||new Set(book.rows.map(r=>r.id)).size!==book.rows.length)throw new Error('Indique operações com identidades distintas;originais conservados.');const result:CurrencyEventCalculation={version:currencyEventVersion,revision:(book.result?.revision??0)+1,calculatedAt:new Date().toISOString(),opportunity:acquisitionScope(draft),location:JSON.stringify(draft.selection_labels??{}),sourceKey:key(draft,book),source:currencyEventSource,inputs:structuredClone(book.rows),rows:book.rows.map(evaluateCurrencyEvent)};const next={...book,result,history:[...(book.history??[]),...(book.result?[book.result]:[])]};saveCurrencyEventBook(draft,next);return next;}
|
||||
export function currencyEventReportRows(draft:Record<string,unknown>):Array<[string,string,string,string]>{try{const book=currencyEventBook(draft),r=book.result;if(!r)return[];return r.inputs.map((row,i)=>['IVA mensal',`${currencyEventTreatments.find(t=>t.id===row.treatment)?.branch??'Evento'} — ${row.period} — ${row.id}`,`${row.description};${r.rows[i].reason};facto gerador:${r.rows[i].eventDate??'Indeterminado/não apurado'};parcelas:${r.rows[i].dueEvents.map(p=>p.date+': '+(p.amount??'Montante indeterminado')+' '+row.currency+' ('+p.reason+')').join('; ')||'Nenhuma apurada'};restante pendente:${r.rows[i].status==='indeterminate'?'Indeterminado':r.rows[i].remainingPending?'Sim':'Não'};cenário condicionado:${r.rows[i].scenarioAmount??'Indeterminado'};base/IVA:Indeterminados`,`${r.opportunity};${r.location};${currencyEventCurrent(draft,book)?'Resultado actual':'Entradas alteradas;resultado histórico conservado'};versão${r.revision};${r.calculatedAt};${r.source};${row.origin};documento ${row.documentRef},${row.documentDate};ambito ${row.scope};${row.treatment==='foreign_scenario'?`origem ${row.amount} ${row.sourceCurrency};taxa ${row.fxRate},${row.fxDirection},${row.fxDate};fonte ${row.fxSource};pressuposto ${row.fxRuleRef}`:`evento ${row.eventDate},${row.eventRef};outra data ${row.otherDate};conferencia ${row.reviewDate};factura ${row.invoiceRequired},${row.invoiceState},${row.invoiceDate},${row.invoiceRef};prazo ${row.legalDeadline},${row.deadlineRef};recebimento ${row.paymentState},${row.paymentDate},${row.paymentAmount},${row.paymentRef};total do ambito ${row.amount} ${row.currency}`};fundamento ${row.evidence};sem nova dedução/campo11/IVA ou activação cambial nos livros anteriores.`]);}catch{return[['IVA mensal','Moeda/eventos','Dados não recuperáveis','Originais preservados;sem substituição porzero.']];}}
|
||||
@@ -0,0 +1,84 @@
|
||||
import {acquisitionScope,readAcquisitionStore} from './iva-acquisitions.ts';
|
||||
|
||||
export const digitalVersion='digital-operations/1';
|
||||
export const digitalSource='CIVA: Lei10/2025, PDF12/p2180(12), artigos3(2)/(7),6(7)k/(8)/(9); enumeração6(7)k i–v mantida de Lei13/2016 PDF8/p1426(266). Obrigações26(1–3),2016PDF17/p1426(275), e23(2),25(7),26(4),32(1)c e33(2),2025PDF13–14. Recorte2026. Natureza, localização e responsável separados de isenção, taxa, base, IVA e dedução. Modelos/formalidades remetidos para regulamentação não são presumidos.';
|
||||
export const digitalTreatments=[
|
||||
{id:'web',kind:'service',branch:'P121',clause:'6(7)k i',label:'Sítios, alojamento, manutenção remota e acesso a plataformas/cloud'},
|
||||
{id:'software_service',kind:'service',branch:'P121',clause:'6(7)k ii/6(9)',label:'Programa/actualização como serviço, incluindo SaaS'},
|
||||
{id:'information',kind:'service',branch:'P121',clause:'6(7)k iii',label:'Imagens, textos, informação e acesso a bases de dados'},
|
||||
{id:'media',kind:'service',branch:'P121',clause:'6(7)k iv/6(9)',label:'Música, filmes, jogos, emissões e streaming'},
|
||||
{id:'teaching',kind:'service',branch:'P121',clause:'6(7)k v',label:'Ensino à distância por meios electrónicos'},
|
||||
{id:'analogous',kind:'service',branch:'P121',clause:'6(7)k vi/6(9)',label:'Outro serviço digital análogo, financeiro ou de intermediação digital'},
|
||||
{id:'software_asset',kind:'goods',branch:'P130',clause:'3(2)/(7)',label:'Software como activo digital'},
|
||||
{id:'content_asset',kind:'goods',branch:'P130',clause:'3(2)/(7)',label:'Conteúdo digital como activo'},
|
||||
{id:'data_asset',kind:'goods',branch:'P130',clause:'3(2)/(7)',label:'Dados digitais com finalidade económica'},
|
||||
{id:'crypto_asset',kind:'goods',branch:'P130',clause:'3(2)/(7)',label:'Criptomoeda como activo digital'},
|
||||
{id:'ebook_asset',kind:'goods',branch:'P130',clause:'3(2)/(7)',label:'E-book como activo digital'},
|
||||
{id:'profile_asset',kind:'goods',branch:'P130',clause:'3(2)/(7)',label:'Perfil em rede social como activo'},
|
||||
{id:'access_asset',kind:'goods',branch:'P130',clause:'3(2)/(7)',label:'Conta, acesso ou identificador digital equiparável'},
|
||||
{id:'other_asset',kind:'goods',branch:'P130',clause:'3(2)/(7)',label:'Outro activo virtual equiparável, com natureza fundamentada'},
|
||||
] as const;
|
||||
type Choice=''|'yes'|'no';
|
||||
export type DigitalRow={id:string;kind:string;treatment:string;description:string;period:string;origin:'projected'|'effective';operationDate:string;operationRef:string;documentRef:string;documentDate:string;subjectRef:string;useRef:string;natureRef:string;scope:string;evidence:string;providerPlace:string;providerCountry:string;providerRef:string;buyerPlace:string;buyerCountry:string;buyerRef:string;buyerTaxable:string;buyerTaxRef:string;providerTaxable:string;providerTaxRef:string;representative:string;representativeRef:string;communicationPrior:string;communicationRef:string;businessUse:string;businessRef:string;goodsPlace:string;goodsPlaceRef:string;conditions:Partial<Record<string,Choice>>};
|
||||
type LineResult={id:string;status:'determined'|'not_applicable'|'indeterminate';kind:string;territory:'national'|'outside'|null;responsible:'acquirer'|'provider'|'representative'|'outside'|'indeterminate';obligationReason:string;declarationReferenceDate:string|null;procedure:'regulation_pending'|'general'|'outside'|'indeterminate';baseAmount:null;vat:null;rate:null;deduction:null;reason:string};
|
||||
export type DigitalCalculation={version:string;revision:number;calculatedAt:string;opportunity:string;sourceKey:string;source:string;inputs:DigitalRow[];rows:LineResult[]};
|
||||
export type DigitalBook={rows:DigitalRow[];result?:DigitalCalculation;history?:DigitalCalculation[]};
|
||||
type Store=ReturnType<typeof readAcquisitionStore>&{digitalOperations?:Record<string,DigitalBook>};
|
||||
export function newDigitalRow(id:string):DigitalRow{return{id,kind:'',treatment:'',description:'',period:'',origin:'projected',operationDate:'',operationRef:'',documentRef:'',documentDate:'',subjectRef:'',useRef:'',natureRef:'',scope:'',evidence:'',providerPlace:'',providerCountry:'',providerRef:'',buyerPlace:'',buyerCountry:'',buyerRef:'',buyerTaxable:'',buyerTaxRef:'',providerTaxable:'',providerTaxRef:'',representative:'',representativeRef:'',communicationPrior:'',communicationRef:'',businessUse:'',businessRef:'',goodsPlace:'',goodsPlaceRef:'',conditions:{}};}
|
||||
export function digitalConditions(kind:string):Array<readonly[string,string]>{return kind==='goods'?[
|
||||
['digitalAsset','Activo intangível em formato electrónico, com valor económico e susceptível de apropriação, titularidade, controlo, transferência ou licenciamento —3(7)'],
|
||||
['assetTransfer','Esta operação transmite o bem digital identificado; a qualificação como activo distingue-se da prestação de um serviço'],
|
||||
]:kind==='service'?[
|
||||
['digitalService','Prestação intangível por meios electrónicos/software/plataforma/rede, nos termos de6(9); não exige ausência total de intervenção humana'],
|
||||
['serviceSupply','A operação identificada é prestação de serviço, distinguida da transmissão de um activo digital'],
|
||||
]:[];}
|
||||
export function switchDigitalKind(row:DigitalRow,kind:string):DigitalRow{return{...row,kind,treatment:'',conditions:{}};}
|
||||
export function switchDigitalTreatment(row:DigitalRow,treatment:string):DigitalRow{return{...row,treatment,conditions:{}};}
|
||||
function readStore(draft:Record<string,unknown>):Store{
|
||||
const s=readAcquisitionStore(draft.modelo_a_snapshot) as Store;
|
||||
if(s.digitalOperations!==undefined&&(!s.digitalOperations||typeof s.digitalOperations!=='object'||Array.isArray(s.digitalOperations)))throw new Error('Operações digitais não recuperáveis; originais conservados.');
|
||||
const fields=Object.keys(newDigitalRow('')).filter(k=>k!=='conditions');
|
||||
for(const b of Object.values(s.digitalOperations??{}))if(!b||!Array.isArray(b.rows)||(b.history!==undefined&&!Array.isArray(b.history))||b.rows.some(r=>!r||fields.some(k=>typeof r[k as keyof DigitalRow]!=='string')||!r.conditions||typeof r.conditions!=='object'||Array.isArray(r.conditions)))throw new Error('Linhas digitais não recuperáveis; sem lista vazia por defeito.');
|
||||
return s;
|
||||
}
|
||||
export function digitalBook(draft:Record<string,unknown>):DigitalBook{return readStore(draft).digitalOperations?.[acquisitionScope(draft)]??{rows:[]};}
|
||||
export function saveDigitalBook(draft:Record<string,unknown>,book:DigitalBook):string{const s=readStore(draft),encoded=JSON.stringify({...s,digitalOperations:{...s.digitalOperations,[acquisitionScope(draft)]:book}});readStore({...draft,modelo_a_snapshot:encoded});return encoded;}
|
||||
function date(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;}
|
||||
function declarationDate(period:string):string{const[y,m]=period.split('-').map(Number);return new Date(Date.UTC(y,m,10)).toISOString().slice(0,10);}
|
||||
export function evaluateDigital(row:DigitalRow):LineResult{
|
||||
const result:LineResult={id:row.id,status:'indeterminate',kind:row.kind,territory:null,responsible:'indeterminate',obligationReason:'Responsável por esclarecer; nenhuma obrigação ou quantia presumida.',declarationReferenceDate:null,procedure:'indeterminate',baseAmount:null,vat:null,rate:null,deduction:null,reason:''};
|
||||
const stop=(reason:string,status:LineResult['status']='indeterminate')=>({...result,status,reason});
|
||||
const rule=digitalTreatments.find(t=>t.id===row.treatment&&t.kind===row.kind);
|
||||
if(!rule)return stop('Distinga transmissão de bem digital de prestação de serviço e identifique o tratamento. Software, licenciamento ou acesso não decidem essa distinção apenas pelo nome.');
|
||||
if(!/^2026-(0[1-9]|1[0-2])$/.test(row.period)||!['projected','effective'].includes(row.origin)||!date(row.operationDate)||row.operationDate.slice(0,7)!==row.period)return stop('Identifique mês2026 e data correspondente, efectivos ou pressupostos expressos.');
|
||||
const conditions=digitalConditions(row.kind);
|
||||
if(conditions.some(([k])=>row.conditions[k]==='no'))return stop('A natureza não corresponde a este percurso digital; conservar dados e utilizar o tratamento aplicável. Não significa isenção ou IVA zero.','not_applicable');
|
||||
if(conditions.some(([k])=>row.conditions[k]!=='yes'))return stop('Natureza digital ou distinção bem/serviço por esclarecer; categoria comercial não substitui os factos da operação.');
|
||||
if(!row.description.trim()||!row.operationRef.trim()||!row.documentRef.trim()||!date(row.documentDate)||!row.subjectRef.trim()||!row.useRef.trim()||!row.natureRef.trim()||!row.scope.trim()||!row.evidence.trim())return stop('Identifique objecto, direitos/funcionalidade, destinatário/utilização, fundamento da natureza, operação, documento ou pressuposto, âmbito e período. Reutilize referências existentes; sem certificado ou aprovador adicional.');
|
||||
if(!['MZ','foreign'].includes(row.buyerCountry)||!row.buyerPlace.trim()||!row.buyerRef.trim())return stop('Identifique estabelecimento ou domicílio do adquirente e referência; nacionalidade, moeda, IP ou servidor isolado não substituem esse facto.');
|
||||
if(row.buyerCountry==='foreign')return{...result,status:'determined',territory:'outside',responsible:'outside',procedure:'outside',obligationReason:'6(8): fora do âmbito territorial nacional desta operação; não determina imposto estrangeiro.',reason:`${rule.branch},${rule.clause}: adquirente estabelecido/domiciliado no estrangeiro,6(8), ainda que transmitente/prestador nacional. Não é benefício fiscal, isenção ou IVA zero.`};
|
||||
if(!['MZ','foreign'].includes(row.providerCountry)||!row.providerPlace.trim()||!row.providerRef.trim())return stop('Identifique sede/estabelecimento/domicílio a partir do qual o transmitente/prestador fornece, com país e referência.');
|
||||
if(row.providerCountry==='foreign'){
|
||||
result.territory='national';result.status='determined';result.reason=`${rule.branch},${rule.clause}: transmitente/prestador sem sede/EP/domicílio nacional a partir do qual fornece e adquirente nacional;6(7)k na redacção2025. A qualidade fiscal do adquirente não é presumida e distingue-se da localização.`;
|
||||
if(row.buyerTaxable==='yes'&&row.buyerTaxRef.trim())return{...result,responsible:'acquirer',procedure:'regulation_pending',declarationReferenceDate:declarationDate(row.period),obligationReason:'26(4): obrigações a cargo do adquirente sujeito passivo nacional;25(7): declaração mensal e mapa de retenções em modelos apropriados, nos termos a regulamentar.32(1)c: referência legal até dia10 do mês seguinte. Sem ajuste de calendário/prorrogação presumidos, sem submissão ou pagamento.23(2)exclui6(7)k;33(2)refere26(1–3), não substituir este percurso digital por operações isoladas.'};
|
||||
if(row.buyerTaxable==='no'&&row.buyerTaxRef.trim()&&row.providerTaxable==='yes'&&row.providerTaxRef.trim()){
|
||||
if(row.representative==='yes'&&row.representativeRef.trim()&&row.communicationPrior==='yes'&&row.communicationRef.trim())return{...result,responsible:'representative',procedure:'general',obligationReason:'26(1)/(2): representante residente identificado, com procuração/poderes e comunicação à contraparte antes da operação; responsabilidade solidária com o representado.33(2) remete26(1–3) para declaração de operações isoladas. Não aplicar automaticamente prazo digital32(1)c ou atribuir retenção a consumidor.'};
|
||||
if(row.representative==='no'&&row.businessUse==='yes'&&row.businessRef.trim())return{...result,responsible:'acquirer',procedure:'general',obligationReason:'26(3): falta de representante e aquisição no exercício de actividade comercial, industrial ou profissional expressamente identificadas; obrigações pelo adquirente.33(2) e23(2) quanto26(3), sem substituir pelo percurso26(4) de sujeito passivo nacional ou presumir montante/prazo.'};
|
||||
}
|
||||
return{...result,obligationReason:row.buyerTaxable==='no'?'26(4) não atribui por este fundamento as obrigações ao adquirente não sujeito passivo. Conferir26(1–3): qualidade do fornecedor não residente, representante com poderes/comunicação ou aquisição no exercício de actividade. Localização nacional mantida; nenhuma retenção automaticamente imputada ao consumidor.':'Qualidade fiscal do adquirente ou referência por esclarecer; localização nacional mantida. Não atribuir automaticamente26(4) nem obrigação de retenção a consumidor.'};
|
||||
}
|
||||
if(row.kind==='goods'){
|
||||
if(!['MZ','foreign'].includes(row.goodsPlace)||!row.goodsPlaceRef.trim())return stop('Bem digital equiparado a corpóreo3(2)/(7): para o percurso doméstico6(1), identificar onde se encontra na colocação à disposição, com fundamento próprio. Não inferir do servidor, nacionalidade ou domicílio do adquirente.');
|
||||
result.territory=row.goodsPlace==='MZ'?'national':'outside';
|
||||
if(result.territory==='outside')return{...result,status:'determined',responsible:'outside',procedure:'outside',obligationReason:'6(1): localização exterior expressamente fundamentada; sem imposto estrangeiro presumido.',reason:`P130,3(2)/(7) e6(1): local do bem na colocação à disposição identificado fora do território; classificação não concede isenção.`};
|
||||
}else result.territory='national';
|
||||
return{...result,status:'determined',responsible:row.providerTaxable==='yes'&&!!row.providerTaxRef.trim()?'provider':'indeterminate',procedure:row.providerTaxable==='yes'&&!!row.providerTaxRef.trim()?'general':'indeterminate',obligationReason:row.providerTaxable==='yes'&&!!row.providerTaxRef.trim()?'Transmitente/prestador sujeito passivo nacional: obrigações gerais identificadas23(1)/25.26(4) e prazo digital32(1)c não se aplicam por este fundamento. Sem cálculo, submissão ou pagamento.':'Qualidade fiscal do transmitente/prestador ou fundamento por esclarecer; não atribuir obrigação automaticamente.',reason:`${rule.branch},${rule.clause}: operação doméstica;${row.kind==='service'?'localização6(3), estabelecimento nacional a partir do qual o serviço é prestado':'localização6(1), bem na colocação à disposição em Moçambique segundo referência expressa'}. Não confirma isenção, taxa, base, IVA ou dedução.`};
|
||||
}
|
||||
function key(draft:Record<string,unknown>,book:DigitalBook):string{return JSON.stringify({version:digitalVersion,scope:acquisitionScope(draft),location:draft.selection_labels??{},rows:book.rows});}
|
||||
export function digitalCurrent(draft:Record<string,unknown>,book:DigitalBook):boolean{return!!book.result&&book.result.sourceKey===key(draft,book);}
|
||||
export function recordDigital(draft:Record<string,unknown>,book:DigitalBook):DigitalBook{
|
||||
if(!book.rows.length||new Set(book.rows.map(r=>r.id)).size!==book.rows.length)throw new Error('Identifique operações distintas; originais conservados.');
|
||||
const result:DigitalCalculation={version:digitalVersion,revision:(book.result?.revision??0)+1,calculatedAt:new Date().toISOString(),opportunity:acquisitionScope(draft),sourceKey:key(draft,book),source:digitalSource,inputs:structuredClone(book.rows),rows:book.rows.map(evaluateDigital)};
|
||||
const next={...book,result,history:[...(book.history??[]),...(book.result?[book.result]:[])]};saveDigitalBook(draft,next);return next;
|
||||
}
|
||||
export function digitalReportRows(draft:Record<string,unknown>):Array<[string,string,string,string]>{try{const b=digitalBook(draft),r=b.result;if(!r)return[];return r.inputs.map((row,i)=>{const line=r.rows[i],rule=digitalTreatments.find(t=>t.id===row.treatment);return['IVA mensal',`${rule?.branch??'Digital'} — ${row.period} — ${row.id}`,`${row.description};natureza:${row.kind==='goods'?'Bem digital':'Serviço digital'};localização:${line.territory==='national'?'Moçambique':line.territory==='outside'?'Fora do território':'Indeterminada'};${line.reason};responsável:${line.responsible};${line.obligationReason};${line.declarationReferenceDate?'Data de referência32(1)c:'+line.declarationReferenceDate+';':''}base/IVA/dedução:Indeterminados`,`${r.opportunity};${digitalCurrent(draft,b)?'Resultado actual':'Entradas alteradas;resultado histórico conservado'};versão${r.revision};${r.calculatedAt};${r.source};${row.origin==='projected'?'Pressupostos projectados':'Dados efectivos declarados'};${rule?.label??''};operação${row.operationRef},${row.operationDate};objecto${row.subjectRef};natureza${row.natureRef};utilização${row.useRef};fornecedor${row.providerPlace},${row.providerCountry},${row.providerRef};adquirente${row.buyerPlace},${row.buyerCountry},${row.buyerRef};${row.buyerCountry==='MZ'&&row.providerCountry==='foreign'?'qualidade fiscal adquirente'+row.buyerTaxable+','+row.buyerTaxRef+';':''}${row.buyerCountry==='MZ'&&row.providerCountry==='MZ'?'qualidade fiscal fornecedor'+row.providerTaxable+','+row.providerTaxRef+';':''}${row.kind==='goods'&&row.buyerCountry==='MZ'&&row.providerCountry==='MZ'?'local do bem6(1)'+row.goodsPlace+','+row.goodsPlaceRef+';':''}${row.buyerCountry==='MZ'&&row.providerCountry==='foreign'&&row.buyerTaxable==='no'?'fornecedor não residente sujeito passivo'+row.providerTaxable+','+row.providerTaxRef+';representante'+row.representative+','+row.representativeRef+';comunicação anterior'+row.communicationPrior+','+row.communicationRef+';actividade comercial/industrial/profissional'+row.businessUse+','+row.businessRef+';':''}âmbito${row.scope};documento/pressuposto${row.documentRef},${row.documentDate};factos${row.evidence};${digitalConditions(row.kind).map(([k,label])=>label+':'+(row.conditions[k]??'Por esclarecer')).join(';')};sem lançamento fiscal, dedução/campo11, regularização ou totaisModeloA.`];});}catch{return[['IVA mensal','Digital','Dados não recuperáveis','Originais conservados; nenhuma classificação por defeito.']];}}
|
||||
@@ -0,0 +1,50 @@
|
||||
import {acquisitionScope,readAcquisitionStore} from './iva-acquisitions.ts';
|
||||
import {goodsLocationBook,goodsLocationCurrent} from './iva-goods-location.ts';
|
||||
import {serviceLocationBook,serviceLocationCurrent} from './iva-service-location.ts';
|
||||
import {listedServiceBook,listedServiceCurrent} from './iva-listed-services.ts';
|
||||
import {currencyEventBook,currencyEventCurrent} from './iva-currency-events.ts';
|
||||
import {digitalBook,digitalCurrent} from './iva-digital.ts';
|
||||
export const foreignOperationVersion='foreign-operations/1';
|
||||
export const foreignOperationSource='CIVA6,Lei13/2016PDF7–8 e redacção2025:reutilizar localização já apurada.19(1)bii,2016PDF15/p1426(273),mantidoLei10/2025PDF13:operações no estrangeiro que seriam tributáveis se efectuadas no território nacional;19(2)alterado2025 mantém exclusões próprias. Enquadramento potencial,não dedução concedida/campo11.Não confundir fora do território com isenção/IVAzero,moeda estrangeira,cliente estrangeiro ou caixa06.';
|
||||
type Choice=''|'yes'|'no';
|
||||
export type ForeignOperationRow={id:string;sourceKind:''|'goods'|'services'|'listed'|'digital';sourceRowId:string;territorialPart:''|'outside'|'national';eventRowId:string;hypotheticalTaxable:Choice;hypotheticalRef:string;excluded19_2:Choice;scope:string;evidence:string;};
|
||||
type Source={id:string;description:string;period:string;operationRef:string;scope:string;status:string;territory:string|null;current:boolean;revision:number;source:string;reason:string;};
|
||||
type LineResult={id:string;status:'determined'|'not_applicable'|'indeterminate';territory:string|null;relation19:'potential'|'not_demonstrated'|'excluded_19_2'|'indeterminate';source:Source|null;event:Record<string,unknown>|null;deduction:null;baseAmount:null;vat:null;rate:null;reason:string};
|
||||
export type ForeignOperationCalculation={version:string;revision:number;calculatedAt:string;opportunity:string;sourceKey:string;source:string;inputs:ForeignOperationRow[];rows:LineResult[]};
|
||||
export type ForeignOperationBook={rows:ForeignOperationRow[];result?:ForeignOperationCalculation;history?:ForeignOperationCalculation[]};
|
||||
type Store=ReturnType<typeof readAcquisitionStore>&{foreignOperations?:Record<string,ForeignOperationBook>};
|
||||
export function newForeignOperation(id:string):ForeignOperationRow{return{id,sourceKind:'',sourceRowId:'',territorialPart:'',eventRowId:'',hypotheticalTaxable:'',hypotheticalRef:'',excluded19_2:'',scope:'',evidence:''};}
|
||||
export function switchForeignSource(row:ForeignOperationRow,sourceKind:ForeignOperationRow['sourceKind'],sourceRowId=''):ForeignOperationRow{return{...row,sourceKind,sourceRowId,territorialPart:'',eventRowId:'',hypotheticalTaxable:'',excluded19_2:''};}
|
||||
export function foreignSources(draft:Record<string,unknown>,kind:ForeignOperationRow['sourceKind']):Source[]{
|
||||
if(kind==='digital'){const b=digitalBook(draft),r=b.result;return r?r.inputs.map((input,i)=>({id:input.id,description:input.description,period:input.period,operationRef:input.operationRef,scope:input.scope,status:r.rows[i].status,territory:r.rows[i].territory,current:digitalCurrent(draft,b),revision:r.revision,source:r.source,reason:r.rows[i].reason})):[];}
|
||||
if(kind==='goods'){const b=goodsLocationBook(draft),r=b.result;return r?r.inputs.map((input,i)=>({id:input.id,description:input.description,period:input.period,operationRef:input.operationRef,scope:input.scope,status:r.rows[i].status,territory:r.rows[i].territory,current:goodsLocationCurrent(draft,b),revision:r.revision,source:r.source,reason:r.rows[i].reason})):[];}
|
||||
if(kind==='services'){const b=serviceLocationBook(draft),r=b.result;return r?r.inputs.map((input,i)=>({id:input.id,description:input.description,period:input.period,operationRef:input.operationRef,scope:input.scope,status:r.rows[i].status,territory:r.rows[i].territory,current:serviceLocationCurrent(draft,b),revision:r.revision,source:r.source,reason:r.rows[i].reason})):[];}
|
||||
if(kind==='listed'){const b=listedServiceBook(draft),r=b.result;return r?r.inputs.map((input,i)=>({id:input.id,description:input.description,period:input.period,operationRef:input.operationRef,scope:input.scope,status:r.rows[i].status,territory:r.rows[i].territory,current:listedServiceCurrent(draft,b),revision:r.revision,source:r.source,reason:r.rows[i].reason})):[];}
|
||||
return[];
|
||||
}
|
||||
export function foreignEvents(draft:Record<string,unknown>):Array<{id:string;description:string;operationRef:string;period:string;current:boolean;revision:number;status:string;eventDate:string|null;dueEvents:unknown[];remainingPending:boolean}>{const b=currencyEventBook(draft),r=b.result;return r?r.inputs.filter(x=>x.treatment!=='foreign_scenario').map(input=>{const line=r.rows[r.inputs.findIndex(x=>x.id===input.id)];return{id:input.id,description:input.description,operationRef:input.operationRef,period:input.period,current:currencyEventCurrent(draft,b),revision:r.revision,status:line.status,eventDate:line.eventDate,dueEvents:line.dueEvents,remainingPending:line.remainingPending};}):[];}
|
||||
function readStore(draft:Record<string,unknown>):Store{const s=readAcquisitionStore(draft.modelo_a_snapshot) as Store;if(s.foreignOperations!==undefined&&(!s.foreignOperations||typeof s.foreignOperations!=='object'||Array.isArray(s.foreignOperations)))throw new Error('Operações no estrangeiro não recuperáveis;originais conservados.');const fields=Object.keys(newForeignOperation(''));for(const b of Object.values(s.foreignOperations??{}))if(!b||!Array.isArray(b.rows)||(b.history!==undefined&&!Array.isArray(b.history))||b.rows.some(r=>!r||fields.some(k=>typeof r[k as keyof ForeignOperationRow]!=='string')))throw new Error('Linhas de operações no estrangeiro não recuperáveis;sem lista vazia por defeito.');return s;}
|
||||
export function foreignOperationBook(draft:Record<string,unknown>):ForeignOperationBook{return readStore(draft).foreignOperations?.[acquisitionScope(draft)]??{rows:[]};}
|
||||
export function saveForeignOperationBook(draft:Record<string,unknown>,book:ForeignOperationBook):string{const s=readStore(draft),encoded=JSON.stringify({...s,foreignOperations:{...s.foreignOperations,[acquisitionScope(draft)]:book}});readStore({...draft,modelo_a_snapshot:encoded});return encoded;}
|
||||
export function evaluateForeignOperation(draft:Record<string,unknown>,row:ForeignOperationRow):LineResult{
|
||||
const result:LineResult={id:row.id,status:'indeterminate',territory:null,relation19:'indeterminate',source:null,event:null,deduction:null,baseAmount:null,vat:null,rate:null,reason:''};const stop=(reason:string,status:LineResult['status']='indeterminate')=>({...result,status,reason});
|
||||
try{const source=foreignSources(draft,row.sourceKind).find(s=>s.id===row.sourceRowId);if(!source)return stop('Escolha uma classificação de localização já guardada nesta oportunidade. Prepare-a nas secções existentes;sem nova classificação por endereço,nacionalidade ou moeda.');result.source=source;
|
||||
if(!source.current||source.status!=='determined'||!source.territory)return stop('Localização alterada ou indeterminada;resultado anterior conservado,sem o tratar como classificação actual.');result.territory=source.territory;
|
||||
if(!/^2026-(0[1-9]|1[0-2])$/.test(source.period)||!row.scope.trim()||!row.evidence.trim())return stop('Identifique âmbito da análise e factos/pressupostos;reutilize operação/período/documentos da localização.');
|
||||
if(source.territory==='national')return stop('Localização reutilizada aponta para Moçambique;P002operação no estrangeiro não se aplica neste âmbito.Não equivale a isenção nem decide tributação interna.','not_applicable');
|
||||
if(source.territory==='partial'){
|
||||
if(!['outside','national'].includes(row.territorialPart))return stop('Transporte tem parcela nacional e exterior;delimite a parcela desta análise,sem transformar todo o trajecto em estrangeiro.');
|
||||
if(row.territorialPart==='national'){result.territory='national';return stop('Análise limitada à parcela nacional do trajecto;P002estrangeiro não se aplica a essa parcela.','not_applicable');}result.territory='outside_portion';
|
||||
}
|
||||
if(row.eventRowId){const event=foreignEvents(draft).find(e=>e.id===row.eventRowId);if(!event||!event.current||event.status!=='determined'||event.operationRef!==source.operationRef||event.period!==source.period)return stop('Evento escolhido não está actual ou não corresponde à mesma operação/período;conserve localização e corrija apenas a associação.Não inferir evento pela data do documento.');result.event=event;}
|
||||
if(!row.hypotheticalRef.trim()||!['yes','no'].includes(row.hypotheticalTaxable))return stop('Operação/parcela estrangeira identificada;fundamente se seria tributável caso efectuada em Moçambique19(1)bii.Não presumir esse facto pela localização ou pela taxa estrangeira.');
|
||||
if(row.hypotheticalTaxable==='no'){result.relation19='not_demonstrated';return stop('Operação no estrangeiro identificada;pressuposto de tributabilidade interna19(1)bii não demonstrado pelos factos declarados.Isto não decide outros enquadramentos de dedução.','determined');}
|
||||
if(!['yes','no'].includes(row.excluded19_2))return stop('Tributabilidade interna hipotética indicada;conferir exclusões19(2),incluindo17-A e pagamentos15(6)c.Sem presumir dedução.');
|
||||
if(row.excluded19_2==='yes'){result.relation19='excluded_19_2';return stop('Operação no estrangeiro identificada;exclusão19(2) declarada e fundamentada afasta este enquadramento potencial.Não calcula ou regulariza dedução.','determined');}
|
||||
result.relation19='potential';return stop('Operação/parcela no estrangeiro reutilizada da localização;seria tributável em Moçambique segundo fundamento declarado,sem exclusão19(2) indicada.Enquadramento potencial19(1)bii,dependente das demais condições18/20 e âmbito dos bens/serviços utilizados.Não é concessão/cálculo de dedução,campo11,isenção ou IVA zero.','determined');
|
||||
}catch{return stop('Localização/eventos de origem não recuperáveis;originais preservados,sem inferir classificação ou valores.');}
|
||||
}
|
||||
function key(draft:Record<string,unknown>,book:ForeignOperationBook):string{return JSON.stringify({version:foreignOperationVersion,scope:acquisitionScope(draft),location:draft.selection_labels??{},rows:book.rows,dependencies:book.rows.map(row=>({source:foreignSources(draft,row.sourceKind).find(s=>s.id===row.sourceRowId),event:row.eventRowId?foreignEvents(draft).find(e=>e.id===row.eventRowId):null}))});}
|
||||
export function foreignOperationCurrent(draft:Record<string,unknown>,book:ForeignOperationBook):boolean{try{return!!book.result&&book.result.sourceKey===key(draft,book);}catch{return false;}}
|
||||
export function recordForeignOperations(draft:Record<string,unknown>,book:ForeignOperationBook):ForeignOperationBook{if(!book.rows.length||new Set(book.rows.map(r=>r.id)).size!==book.rows.length)throw new Error('Indique identidades distintas;originais conservados.');const result:ForeignOperationCalculation={version:foreignOperationVersion,revision:(book.result?.revision??0)+1,calculatedAt:new Date().toISOString(),opportunity:acquisitionScope(draft),sourceKey:key(draft,book),source:foreignOperationSource,inputs:structuredClone(book.rows),rows:book.rows.map(r=>evaluateForeignOperation(draft,r))};const next={...book,result,history:[...(book.history??[]),...(book.result?[book.result]:[])]};saveForeignOperationBook(draft,next);return next;}
|
||||
export function foreignOperationReportRows(draft:Record<string,unknown>):Array<[string,string,string,string]>{try{const b=foreignOperationBook(draft),r=b.result;if(!r)return[];return r.inputs.map((row,i)=>{const line=r.rows[i];return['IVA mensal',`P002 — ${line.source?.period??'Período indeterminado'} — ${row.id}`,`${line.source?.description??'Origem por escolher'};${line.reason};dedução/IVA:Indeterminados`,`${r.opportunity};${foreignOperationCurrent(draft,b)?'Resultado actual':'Origens/entradas alteradas;resultado histórico conservado'};versão${r.revision};${r.calculatedAt};${r.source};localização${row.sourceKind}/${row.sourceRowId},versão${line.source?.revision??'indeterminada'};${line.source?.reason??''};operação${line.source?.operationRef??''};âmbito origem${line.source?.scope??''};parcela${row.territorialPart};evento${row.eventRowId||'Sem associação necessária'},${line.event?JSON.stringify(line.event):'Não apurado por esta análise'};hipótese interna${row.hypotheticalTaxable},fundamento${row.hypotheticalRef};exclusão19(2)${row.excluded19_2};âmbito${row.scope};factos${row.evidence};sem base/IVA/dedução/campo11/totaisModeloA.`];});}catch{return[['IVA mensal','P002','Dados não recuperáveis','Originais preservados;sem classificação por defeito.']];}}
|
||||
@@ -1,3 +1,6 @@
|
||||
import { digitalReportRows } from './iva-digital.ts';
|
||||
import { foreignOperationReportRows } from './iva-foreign-operations.ts';
|
||||
import { currencyEventReportRows } from './iva-currency-events.ts';
|
||||
import { propertyTransferReportRows } from './iva-property-transfers.ts';
|
||||
import { goodsPresumptionReportRows } from './iva-goods-presumptions.ts';
|
||||
import { displayValue } from './display-value.ts';
|
||||
@@ -656,6 +659,9 @@ export function buildProjectDossierRows(
|
||||
rows.push(...secondhandReportRows(draft));
|
||||
rows.push(...goodsPresumptionReportRows(draft));
|
||||
rows.push(...propertyTransferReportRows(draft));
|
||||
rows.push(...currencyEventReportRows(draft));
|
||||
rows.push(...foreignOperationReportRows(draft));
|
||||
rows.push(...digitalReportRows(draft));
|
||||
rows.push(...offerPreparationReportRows(draft));
|
||||
const operationRows = salesReportRows(draft);
|
||||
rows.push(...operationRows);
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
<?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 IvaCurrencyEventDraftTest extends TestCase
|
||||
{
|
||||
use DatabaseTransactions;
|
||||
|
||||
public function test_currencyevents_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-currency-events.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:357', $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['currencyEvents']['opportunity:357'];
|
||||
$this->assertCount(15, $book['rows']);
|
||||
$this->assertSame('conditional',$book['result']['rows'][0]['status']);
|
||||
$this->assertSame('64500.00',$book['result']['rows'][0]['scenarioAmount']);
|
||||
$this->assertSame('2026-12-10',$book['result']['rows'][13]['eventDate']);
|
||||
$this->assertSame(['200.00','800.00'],array_column($book['result']['rows'][14]['dueEvents'],'amount'));
|
||||
foreach ($book['result']['rows'] as $row) {
|
||||
$this->assertNull($row['baseAmount']);$this->assertNull($row['vat']);$this->assertNull($row['rate']);
|
||||
}
|
||||
$this->assertSame($book['rows'], $book['result']['inputs']);
|
||||
$this->assertCount(1, $book['history']);
|
||||
$this->assertSame('64500.00',$book['history'][0]['rows'][0]['scenarioAmount']);
|
||||
$frozen = json_decode(file_get_contents(base_path('tests/frontend/fixtures/iva-currency-events-preserved.json')), true, flags: JSON_THROW_ON_ERROR);
|
||||
$prior = json_decode($frozen['modelo_a_snapshot'], true, flags: JSON_THROW_ON_ERROR);
|
||||
$this->assertSame($prior, array_diff_key($store, ['currencyEvents' => 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-currency-events-20261025/recovered.json'), json_encode($recovered, JSON_THROW_ON_ERROR | JSON_UNESCAPED_UNICODE));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
<?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 IvaDigitalDraftTest extends TestCase
|
||||
{
|
||||
use DatabaseTransactions;
|
||||
|
||||
public function test_digital_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-digital.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:359', $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['digitalOperations']['opportunity:359'];
|
||||
$this->assertCount(46, $book['rows']);
|
||||
$this->assertSame('national',$book['result']['rows'][0]['territory']);
|
||||
$this->assertSame('acquirer',$book['result']['rows'][0]['responsible']);
|
||||
$this->assertSame('2027-01-10',$book['result']['rows'][0]['declarationReferenceDate']);
|
||||
$this->assertSame('outside',$book['result']['rows'][1]['territory']);
|
||||
$this->assertSame('provider',$book['result']['rows'][2]['responsible']);
|
||||
$this->assertSame('national',$book['result']['rows'][42]['territory']);
|
||||
$this->assertSame('indeterminate',$book['result']['rows'][42]['responsible']);
|
||||
$this->assertSame('representative',$book['result']['rows'][44]['responsible']);
|
||||
$this->assertSame('acquirer',$book['result']['rows'][45]['responsible']);
|
||||
foreach ($book['result']['rows'] as $row) {
|
||||
$this->assertNull($row['deduction']);$this->assertNull($row['baseAmount']);$this->assertNull($row['vat']);$this->assertNull($row['rate']);
|
||||
}
|
||||
$this->assertSame($book['rows'], $book['result']['inputs']);
|
||||
$this->assertCount(1, $book['history']);
|
||||
$this->assertSame('national',$book['history'][0]['rows'][0]['territory']);
|
||||
$frozen = json_decode(file_get_contents(base_path('tests/frontend/fixtures/iva-digital-preserved.json')), true, flags: JSON_THROW_ON_ERROR);
|
||||
$prior = json_decode($frozen['modelo_a_snapshot'], true, flags: JSON_THROW_ON_ERROR);
|
||||
$preserved = array_diff_key($store, ['digitalOperations' => true]);
|
||||
$this->assertSame($prior, $preserved);
|
||||
$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-digital-20261025/recovered.json'), json_encode($recovered, JSON_THROW_ON_ERROR | JSON_UNESCAPED_UNICODE));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
<?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 IvaForeignOperationDraftTest extends TestCase
|
||||
{
|
||||
use DatabaseTransactions;
|
||||
|
||||
public function test_foreignoperations_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-foreign-operations.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:358', $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['foreignOperations']['opportunity:358'];
|
||||
$this->assertCount(7, $book['rows']);
|
||||
$this->assertSame(['potential','potential','potential','potential','indeterminate','not_demonstrated','excluded_19_2'],array_column($book['result']['rows'],'relation19'));
|
||||
$this->assertSame('outside_portion',$book['result']['rows'][3]['territory']);
|
||||
$this->assertSame('2026-12-10',$book['result']['rows'][0]['event']['eventDate']);
|
||||
foreach ($book['result']['rows'] as $row) {
|
||||
$this->assertNull($row['deduction']);$this->assertNull($row['baseAmount']);$this->assertNull($row['vat']);$this->assertNull($row['rate']);
|
||||
}
|
||||
$this->assertSame($book['rows'], $book['result']['inputs']);
|
||||
$this->assertCount(1, $book['history']);
|
||||
$this->assertSame('potential',$book['history'][0]['rows'][0]['relation19']);
|
||||
$frozen = json_decode(file_get_contents(base_path('tests/frontend/fixtures/iva-foreign-operations-preserved.json')), true, flags: JSON_THROW_ON_ERROR);
|
||||
$prior = json_decode($frozen['modelo_a_snapshot'], true, flags: JSON_THROW_ON_ERROR);
|
||||
$preserved = array_diff_key($store, ['foreignOperations' => true]);
|
||||
foreach (['goodsLocations','serviceLocations','listedServices','currencyEvents'] as $map) unset($preserved[$map]['opportunity:358']);
|
||||
$this->assertSame($prior, $preserved);
|
||||
$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-foreign-operations-20261025/recovered.json'), json_encode($recovered, JSON_THROW_ON_ERROR | JSON_UNESCAPED_UNICODE));
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,40 @@
|
||||
import test from 'node:test';import assert from 'node:assert/strict';import fs from 'node:fs';
|
||||
import {newCurrencyEvent,currencyEventTreatments,evaluateCurrencyEvent,recordCurrencyEvents,saveCurrencyEventBook,currencyEventBook,currencyEventCurrent,currencyEventReportRows,switchCurrencyEvent} from '../../resources/js/lib/iva-currency-events.ts';
|
||||
const frozen=JSON.parse(fs.readFileSync('tests/frontend/fixtures/iva-currency-events-preserved.json','utf8'));
|
||||
const draft={...frozen,currency:'MZN',context_opportunity:'opportunity:357',project_title:'SYNTHETIC QA — Moeda e eventos / Manica'};
|
||||
function row(t){return{...newCurrencyEvent(t,'MZN'),treatment:t,description:'SYNTHETIC QA '+t,period:'2026-12',origin:'projected',operationRef:'SYNTHETIC QA operação existente',documentRef:'SYNTHETIC QA documento/pressuposto',documentDate:'2026-12-12',scope:'SYNTHETIC QA conjunto/parte/operação/período',evidence:'SYNTHETIC QA pressupostos expressos',eventDate:'2026-12-10',eventRef:'SYNTHETIC QA evento específico/artigo7,excepções próprias conferidas',otherDate:t==='consignment_deadline'?'2026-06-13':t==='contract_effects'?'2026-12-01':'2026-12-12',reviewDate:'2026-12-31',factsConfirmed:'yes',invoiceRequired:'yes',invoiceState:'issued',invoiceDate:'2026-12-12',invoiceRef:'SYNTHETIC QA factura',legalDeadline:'2026-12-17',deadlineRef:'SYNTHETIC QA prazo/disposição/calendário identificados,não regra vigente presumida',paymentState:t==='advance_payment'?'received':'none',paymentDate:'2026-12-09',paymentRef:'SYNTHETIC QA recebimento identificado',amount:'1000.00',paymentAmount:'200.00',sourceCurrency:'USD',fxRate:'64.5',fxDate:'2026-12-10',fxSource:'SYNTHETIC QA taxa/exemplar',fxRuleRef:'SYNTHETIC QA pressuposto da taxa/data,não base fiscal',fxDirection:'mzn_per_unit'};}
|
||||
for(const rule of currencyEventTreatments)test(rule.branch+' '+rule.id+' own event and noVAT/base',()=>{
|
||||
const r=row(rule.id),v=evaluateCurrencyEvent(r);assert.equal(v.status,rule.branch==='P104'?'conditional':'determined');assert.equal(v.baseAmount,null);assert.equal(v.vat,null);assert.equal(v.rate,null);
|
||||
if(rule.branch==='P104')assert.equal(v.scenarioAmount,'64500.00');else{assert.equal(v.dueEvents.at(-1).date,['import_clearance','import_auction'].includes(rule.id)?'2026-12-10':'2026-12-12');assert.equal(v.eventDate,rule.id==='advance_payment'?null:rule.id==='consignment_deadline'?'2026-12-10':'2026-12-10');}
|
||||
for(const f of ['operationRef','documentRef','scope','evidence'])assert.equal(evaluateCurrencyEvent({...r,[f]:''}).status,'indeterminate');assert.equal(evaluateCurrencyEvent({...r,factsConfirmed:''}).status,'indeterminate');assert.equal(evaluateCurrencyEvent({...r,factsConfirmed:'no'}).status,'not_applicable');
|
||||
});
|
||||
test('P131/P132 invoice intime/late/absent,partial payment and no duplicate remainder',()=>{
|
||||
const r=row('goods_available');let v=evaluateCurrencyEvent({...r,paymentState:'received'});assert.deepEqual(v.dueEvents.map(x=>[x.date,x.amount]),[['2026-12-09','200.00'],['2026-12-12','800.00']]);
|
||||
v=evaluateCurrencyEvent({...r,invoiceDate:'2026-12-20'});assert.equal(v.dueEvents[0].date,'2026-12-17');
|
||||
v=evaluateCurrencyEvent({...r,invoiceState:'not_issued'});assert.equal(v.dueEvents[0].date,'2026-12-17');
|
||||
v=evaluateCurrencyEvent({...r,invoiceState:'not_issued',reviewDate:'2026-12-11',paymentState:'received'});assert.equal(v.dueEvents.length,1);assert.equal(v.remainingPending,true);
|
||||
v=evaluateCurrencyEvent({...r,paymentState:'received',paymentDate:'2026-12-19',invoiceDate:'2026-12-20'});assert.deepEqual(v.dueEvents.map(x=>[x.date,x.amount]),[['2026-12-17','1000.00']]);
|
||||
v=evaluateCurrencyEvent({...r,paymentState:'received',paymentAmount:'1000'});assert.equal(v.dueEvents.length,1);assert.equal(v.dueEvents[0].amount,'1000.00');
|
||||
for(const patch of [{paymentState:''},{legalDeadline:''},{deadlineRef:''},{invoiceState:''},{paymentState:'received',paymentAmount:'1001'},{paymentState:'received',amount:''}])assert.equal(evaluateCurrencyEvent({...r,...patch}).status,'indeterminate');
|
||||
assert.equal(evaluateCurrencyEvent({...r,invoiceRequired:'no',amount:''}).dueEvents[0].amount,null);
|
||||
assert.equal(evaluateCurrencyEvent({...r,eventDate:'2026-12-20',reviewDate:'2026-12-11',invoiceState:'not_issued',legalDeadline:'2026-12-28',paymentState:'received'}).dueEvents[0].date,'2026-12-09');
|
||||
});
|
||||
test('own events,consignmentterm,servicecharge,contractexceptions and dates',()=>{
|
||||
assert.equal(evaluateCurrencyEvent({...row('consignment_deadline'),otherDate:''}).status,'indeterminate');
|
||||
assert.equal(evaluateCurrencyEvent({...row('consignment_deadline'),invoiceRequired:'no'}).dueEvents[0].date,'2026-12-10');
|
||||
assert.equal(evaluateCurrencyEvent({...row('service_early_charge'),otherDate:'2026-12-09'}).status,'indeterminate');
|
||||
assert.equal(evaluateCurrencyEvent({...row('contract_effects'),otherDate:'2026-12-11'}).status,'indeterminate');
|
||||
for(const field of ['reviewDate','eventDate','documentDate'])assert.equal(evaluateCurrencyEvent({...row('goods_available'),[field]:'2026-02-30'}).status,'indeterminate');
|
||||
const r=row('own_goods'),sw=switchCurrencyEvent(r,'foreign_scenario');assert.equal(sw.eventDate,r.eventDate);assert.equal(sw.fxSource,r.fxSource);assert.equal(sw.factsConfirmed,'');
|
||||
});
|
||||
test('P104 conditionalconversion direction/exactrounding/missingparams never fiscalbase',()=>{
|
||||
const r=row('foreign_scenario');assert.equal(evaluateCurrencyEvent({...r,fxDirection:'units_per_mzn',fxRate:'2',amount:'100'}).scenarioAmount,'50.00');
|
||||
assert.equal(evaluateCurrencyEvent({...r,amount:'0.000001',fxRate:'1.5'}).scenarioAmount,'0.000002');
|
||||
for(const patch of [{fxRate:'0'},{fxRate:'-1'},{fxSource:''},{fxDate:''},{fxRuleRef:''},{fxDirection:''},{sourceCurrency:'MZN'}])assert.equal(evaluateCurrencyEvent({...r,...patch}).status,'indeterminate');assert.equal(evaluateCurrencyEvent(r).baseAmount,null);
|
||||
});
|
||||
test('snapshot/history/report preserve every delivered book and contextual scope',()=>{
|
||||
const rows=currencyEventTreatments.map(t=>row(t.id)),a=recordCurrencyEvents(draft,{rows}),next={...draft,modelo_a_snapshot:saveCurrencyEventBook(draft,a)},b=recordCurrencyEvents(next,a);next.modelo_a_snapshot=saveCurrencyEventBook(next,b);
|
||||
assert.equal(b.history.length,1);assert.equal(currencyEventCurrent(next,b),true);assert.equal(currencyEventCurrent(next,{...b,rows:rows.slice(1)}),false);assert.equal(currencyEventReportRows(next).length,15);assert.deepEqual(currencyEventBook({...next,context_opportunity:'opportunity:358'}),{rows:[]});
|
||||
const store=JSON.parse(next.modelo_a_snapshot);delete store.currencyEvents;assert.deepEqual(store,JSON.parse(frozen.modelo_a_snapshot));assert.throws(()=>recordCurrencyEvents(next,{rows:[rows[0],rows[0]]}));assert.throws(()=>currencyEventBook({...next,modelo_a_snapshot:JSON.stringify({...store,currencyEvents:[]})}));
|
||||
if(process.env.IVA_CURRENCY_EVENTS_FIXTURE)fs.writeFileSync(process.env.IVA_CURRENCY_EVENTS_FIXTURE,JSON.stringify(next,null,2)+'\n');
|
||||
});
|
||||
@@ -0,0 +1,44 @@
|
||||
import test from 'node:test';import assert from 'node:assert/strict';import fs from 'node:fs';
|
||||
import {digitalTreatments,digitalConditions,newDigitalRow,evaluateDigital,recordDigital,saveDigitalBook,digitalBook,digitalCurrent,digitalReportRows,switchDigitalKind,switchDigitalTreatment} from '../../resources/js/lib/iva-digital.ts';
|
||||
import {newForeignOperation,recordForeignOperations,saveForeignOperationBook,foreignOperationCurrent,foreignSources} from '../../resources/js/lib/iva-foreign-operations.ts';
|
||||
const frozen=JSON.parse(fs.readFileSync('tests/frontend/fixtures/iva-digital-preserved.json','utf8')),prior=JSON.parse(frozen.modelo_a_snapshot);
|
||||
const draft={...frozen,context_opportunity:'opportunity:359',project_title:'SYNTHETIC QA — Digital / Manica'};
|
||||
function row(rule,direction='inbound'){return{...newDigitalRow(rule.id+'-'+direction),kind:rule.kind,treatment:rule.id,description:'SYNTHETIC QA '+rule.label,period:'2026-12',origin:'projected',operationDate:'2026-12-10',operationRef:'SYNTHETIC QA op '+rule.id+'-'+direction,documentRef:'SYNTHETIC QA contrato/previsão',documentDate:'2026-12-01',subjectRef:'SYNTHETIC QA objecto/direitos/funcionalidade delimitados',useRef:'SYNTHETIC QA destinatário e utilização',natureRef:'SYNTHETIC QA natureza contratual '+rule.kind,scope:'SYNTHETIC QA operação/dezembro2026/âmbito identificado',evidence:'SYNTHETIC QA factos ou pressupostos expressos',providerPlace:'SYNTHETIC QA estabelecimento fornecedor',providerCountry:direction==='inbound'?'foreign':'MZ',providerRef:'SYNTHETIC QA contrato/estabelecimento fornecedor',buyerPlace:'SYNTHETIC QA domicílio adquirente',buyerCountry:direction==='outbound'?'foreign':'MZ',buyerRef:'SYNTHETIC QA contrato/domicílio adquirente',buyerTaxable:'yes',buyerTaxRef:'SYNTHETIC QA sujeito passivo nacional, incluindo isento sem dedução',providerTaxable:'yes',providerTaxRef:'SYNTHETIC QA sujeito passivo fornecedor',goodsPlace:'MZ',goodsPlaceRef:'SYNTHETIC QA factos local6(1),não inferido de IP/servidor',conditions:Object.fromEntries(digitalConditions(rule.kind).map(([k])=>[k,'yes']))};}
|
||||
const cases=digitalTreatments.flatMap(rule=>['inbound','outbound','domestic'].map(direction=>row(rule,direction)));
|
||||
for(const r of cases)test(`${r.kind==='goods'?'P130':'P121'} ${r.id} classification and responsibility`,()=>{
|
||||
const v=evaluateDigital(r);assert.equal(v.status,'determined');assert.equal(v.territory,r.buyerCountry==='foreign'?'outside':'national');assert.equal(v.responsible,r.buyerCountry==='foreign'?'outside':r.providerCountry==='foreign'?'acquirer':'provider');
|
||||
assert.equal(v.declarationReferenceDate,r.providerCountry==='foreign'&&r.buyerCountry==='MZ'?'2027-01-10':null);assert.equal(v.procedure,r.buyerCountry==='foreign'?'outside':r.providerCountry==='foreign'?'regulation_pending':'general');for(const k of ['vat','baseAmount','rate','deduction'])assert.equal(v[k],null);
|
||||
});
|
||||
test('Unknown facts do not become national, exempt or zero; no name-only kind inference',()=>{
|
||||
const r=cases[0];for(const patch of [{kind:''},{kind:'goods'},{period:'2025-12'},{operationDate:'2026-02-30'},{operationDate:'2026-11-10'},{origin:'unknown'},{documentDate:'2026-02-30'},{subjectRef:''},{useRef:''},{natureRef:''},{scope:''},{evidence:''},{buyerCountry:''},{buyerRef:''},{providerRef:''}])assert.equal(evaluateDigital({...r,...patch}).status,'indeterminate');
|
||||
for(const[k]of digitalConditions(r.kind)){assert.equal(evaluateDigital({...r,conditions:{...r.conditions,[k]:''}}).status,'indeterminate');assert.equal(evaluateDigital({...r,conditions:{...r.conditions,[k]:'no'}}).status,'not_applicable');}
|
||||
const outbound={...cases[1],providerCountry:'',providerRef:'',providerPlace:'',buyerTaxable:'',buyerTaxRef:''};assert.equal(evaluateDigital(outbound).territory,'outside');
|
||||
});
|
||||
test('26(4) quality/reference independent of national territory; consumer never automatic withholding',()=>{
|
||||
for(const r of [cases[0],cases.find(r=>r.kind==='goods')])for(const patch of [{buyerTaxable:''},{buyerTaxRef:''},{buyerTaxable:'no'}]){const v=evaluateDigital({...r,...patch});assert.equal(v.territory,'national');assert.equal(v.status,'determined');assert.equal(v.responsible,'indeterminate');assert.equal(v.declarationReferenceDate,null);}
|
||||
const r={...cases[0],buyerTaxable:'no',buyerTaxRef:'SYNTHETIC QA consumidor',representative:'yes',representativeRef:'SYNTHETIC QA residente/procuração/poderes',communicationPrior:'yes',communicationRef:'SYNTHETIC QA comunicação anterior'};
|
||||
assert.equal(evaluateDigital(r).responsible,'representative');assert.equal(evaluateDigital(r).declarationReferenceDate,null);
|
||||
for(const patch of [{providerTaxRef:''},{representativeRef:''},{communicationPrior:'no'},{communicationRef:''}])assert.equal(evaluateDigital({...r,...patch}).responsible,'indeterminate');
|
||||
const business={...r,representative:'no',businessUse:'yes',businessRef:'SYNTHETIC QA actividade/aquisição profissional'};assert.equal(evaluateDigital(business).responsible,'acquirer');assert.equal(evaluateDigital({...business,businessUse:'no'}).responsible,'indeterminate');assert.equal(evaluateDigital({...business,businessRef:''}).responsible,'indeterminate');
|
||||
});
|
||||
test('Domestic digital goods need demonstrated6(1) location, not consumer address/server; domestic services6(3)',()=>{
|
||||
const r=cases.find(r=>r.kind==='goods'&&r.id.endsWith('domestic'));assert.equal(evaluateDigital({...r,goodsPlace:''}).territory,null);assert.equal(evaluateDigital({...r,goodsPlaceRef:''}).status,'indeterminate');assert.equal(evaluateDigital({...r,goodsPlace:'foreign'}).territory,'outside');
|
||||
assert.equal(evaluateDigital({...cases[2],goodsPlace:'',goodsPlaceRef:''}).territory,'national');assert.equal(evaluateDigital({...r,providerTaxable:''}).responsible,'indeterminate');
|
||||
});
|
||||
test('Switching nature/treatment preserves deliberate references and hidden facts, rechecks specific conditions',()=>{
|
||||
const r=cases[0],sw=switchDigitalKind(r,'goods');assert.equal(sw.treatment,'');assert.deepEqual(sw.conditions,{});for(const k of ['natureRef','buyerTaxRef','goodsPlaceRef','scope','evidence'])assert.equal(sw[k],r[k]);assert.deepEqual(switchDigitalTreatment(r,'teaching').conditions,{});
|
||||
});
|
||||
test('Opportunity isolation, stable history and malformed-store guard; all prior books including P002 immutable',()=>{
|
||||
const a=recordDigital(draft,{rows:cases}),d={...draft,modelo_a_snapshot:saveDigitalBook(draft,a)},b=recordDigital(d,a);d.modelo_a_snapshot=saveDigitalBook(d,b);assert.equal(digitalCurrent(d,b),true);assert.equal(b.history.length,1);assert.equal(digitalReportRows(d).length,42);assert.deepEqual(digitalBook({...d,context_opportunity:'opportunity:358'}),{rows:[]});
|
||||
const changed={...b,rows:b.rows.map((r,i)=>i===0?{...r,buyerCountry:'foreign'}:r)};assert.equal(digitalCurrent(d,changed),false);assert.equal(b.history[0].inputs[0].buyerCountry,'MZ');assert.equal(b.history[0].rows[0].territory,'national');
|
||||
const store=JSON.parse(d.modelo_a_snapshot);delete store.digitalOperations;assert.deepEqual(store,prior);assert.throws(()=>recordDigital(d,{rows:[cases[0],cases[0]]}));assert.throws(()=>digitalBook({...d,modelo_a_snapshot:JSON.stringify({...store,digitalOperations:[]})}));assert.throws(()=>digitalBook({...d,modelo_a_snapshot:JSON.stringify({...store,digitalOperations:{x:{rows:[{id:'incomplete'}]}}})}));
|
||||
});
|
||||
test('P002 reuses new digital location in same opportunity, guards stale source and keeps accepted P002 snapshots',()=>{
|
||||
const a=recordDigital(draft,{rows:cases}),d={...draft,modelo_a_snapshot:saveDigitalBook(draft,a)},r={...newForeignOperation('digital-outside'),sourceKind:'digital',sourceRowId:cases[1].id,hypotheticalTaxable:'yes',hypotheticalRef:'SYNTHETIC QA hipótese interna',excluded19_2:'no',scope:'SYNTHETIC QA operação digital exterior',evidence:'SYNTHETIC QA pressupostos'};
|
||||
assert.equal(foreignSources(d,'digital').length,42);const b=recordForeignOperations(d,{rows:[r]});assert.equal(b.result.rows[0].relation19,'potential');assert.equal(b.result.rows[0].deduction,null);d.modelo_a_snapshot=saveForeignOperationBook(d,b);assert.equal(foreignOperationCurrent(d,b),true);
|
||||
const next={...d,modelo_a_snapshot:saveDigitalBook(d,recordDigital(d,a))};assert.equal(foreignOperationCurrent(next,b),false);assert.equal(b.result.rows[0].source.revision,1);assert.deepEqual(JSON.parse(d.modelo_a_snapshot).foreignOperations['opportunity:358'],prior.foreignOperations['opportunity:358']);
|
||||
});
|
||||
test('Fixture for private API includes42 examples and unresolved/representative/business cases',()=>{
|
||||
const inbound=cases[0],extra=[{...inbound,id:'consumer',buyerTaxable:'no',buyerTaxRef:'SYNTHETIC QA consumidor'},{...inbound,id:'unknown_quality',buyerTaxable:'',buyerTaxRef:''},{...inbound,id:'representative',buyerTaxable:'no',buyerTaxRef:'SYNTHETIC QA não sujeito passivo',representative:'yes',representativeRef:'SYNTHETIC QA representante/procuração',communicationPrior:'yes',communicationRef:'SYNTHETIC QA comunicação anterior'},{...inbound,id:'business_26_3',buyerTaxable:'no',buyerTaxRef:'SYNTHETIC QA não sujeito passivo',representative:'no',businessUse:'yes',businessRef:'SYNTHETIC QA actividade profissional'}],a=recordDigital(draft,{rows:[...cases,...extra]}),d={...draft,modelo_a_snapshot:saveDigitalBook(draft,a)},b=recordDigital(d,a);d.modelo_a_snapshot=saveDigitalBook(d,b);
|
||||
assert.equal(b.rows.length,46);assert.equal(b.history.length,1);if(process.env.IVA_DIGITAL_FIXTURE)fs.writeFileSync(process.env.IVA_DIGITAL_FIXTURE,JSON.stringify(d,null,2)+'\n');
|
||||
});
|
||||
@@ -0,0 +1,32 @@
|
||||
import test from 'node:test';import assert from 'node:assert/strict';import fs from 'node:fs';
|
||||
import {newForeignOperation,evaluateForeignOperation,foreignSources,foreignEvents,recordForeignOperations,saveForeignOperationBook,foreignOperationBook,foreignOperationCurrent,foreignOperationReportRows,switchForeignSource} from '../../resources/js/lib/iva-foreign-operations.ts';
|
||||
import {recordGoodsLocations,saveGoodsLocationBook,goodsLocationBook} from '../../resources/js/lib/iva-goods-location.ts';
|
||||
import {recordServiceLocations,saveServiceLocationBook} from '../../resources/js/lib/iva-service-location.ts';
|
||||
import {recordListedServices,saveListedServiceBook} from '../../resources/js/lib/iva-listed-services.ts';
|
||||
import {recordCurrencyEvents,saveCurrencyEventBook} from '../../resources/js/lib/iva-currency-events.ts';
|
||||
const frozen=JSON.parse(fs.readFileSync('tests/frontend/fixtures/iva-foreign-operations-preserved.json','utf8')),original=JSON.parse(frozen.modelo_a_snapshot);
|
||||
function seed(){const d={...frozen,context_opportunity:'opportunity:358',project_title:'SYNTHETIC QA — Operações no estrangeiro / Manica'};
|
||||
for(const[map,record,save]of [['goodsLocations',recordGoodsLocations,saveGoodsLocationBook],['serviceLocations',recordServiceLocations,saveServiceLocationBook],['listedServices',recordListedServices,saveListedServiceBook]]){const rows=structuredClone(Object.values(original[map])[0].rows).map(r=>({...r,operationRef:'SYNTHETIC QA op '+r.id}));if(map==='serviceLocations'){const r=structuredClone(rows.find(x=>x.id==='transport_service-MZ'));rows.push({...r,id:'transport_partial',operationRef:'SYNTHETIC QA op transport_partial',departure:'MZ',arrival:'foreign',nationalDistance:'20',totalDistance:'100'});}d.modelo_a_snapshot=save(d,record(d,{rows}));}
|
||||
const event=structuredClone(original.currencyEvents['opportunity:357'].rows.find(r=>r.treatment==='goods_available'));event.operationRef='SYNTHETIC QA op g8a-goods_without_transport';d.modelo_a_snapshot=saveCurrencyEventBook(d,recordCurrencyEvents(d,{rows:[event]}));return d;}
|
||||
const draft=seed();
|
||||
function row(id,kind,source){return{...newForeignOperation(id),sourceKind:kind,sourceRowId:source,territorialPart:'outside',hypotheticalTaxable:'yes',hypotheticalRef:'SYNTHETIC QA hipótese interna/natureza tributável e19(2),fundamento identificado',excluded19_2:'no',scope:'SYNTHETIC QA conjunto/parcela exterior/período identificado',evidence:'SYNTHETIC QA factos/pressupostos expressos'};}
|
||||
const cases=[row('foreign_goods','goods','g8a-goods_without_transport'),row('foreign_services','services','general_service-foreign'),row('foreign_listed','listed','rights_service-outbound'),row('foreign_transport_part','services','transport_partial')];cases[0].eventRowId='goods_available';
|
||||
for(const r of cases)test('P002 '+r.id+' reuses delivered territoriality and potential19only',()=>{const v=evaluateForeignOperation(draft,r);assert.equal(v.status,'determined');assert.equal(v.relation19,'potential');assert.equal(v.territory,r.id==='foreign_transport_part'?'outside_portion':'outside');assert.equal(v.deduction,null);assert.equal(v.vat,null);assert.equal(v.baseAmount,null);assert.equal(v.source.id,r.sourceRowId);assert.equal(v.source.current,true);if(r.eventRowId)assert.equal(v.event.eventDate,'2026-12-10');});
|
||||
test('P002 unknown/national/partial do not imply foreign or exemption',()=>{
|
||||
assert.equal(evaluateForeignOperation(draft,{...cases[0],sourceRowId:''}).status,'indeterminate');assert.equal(evaluateForeignOperation(draft,{...cases[0],sourceRowId:'g8a-goods_with_transport'}).status,'not_applicable');assert.equal(evaluateForeignOperation(draft,{...cases[3],territorialPart:''}).status,'indeterminate');assert.equal(evaluateForeignOperation(draft,{...cases[3],territorialPart:'national'}).status,'not_applicable');
|
||||
for(const patch of [{scope:''},{evidence:''},{hypotheticalRef:''},{hypotheticalTaxable:''},{excluded19_2:''}])assert.equal(evaluateForeignOperation(draft,{...cases[0],...patch}).status,'indeterminate');
|
||||
const no=evaluateForeignOperation(draft,{...cases[0],hypotheticalTaxable:'no'});assert.equal(no.relation19,'not_demonstrated');assert.equal(no.deduction,null);const excluded=evaluateForeignOperation(draft,{...cases[0],excluded19_2:'yes'});assert.equal(excluded.relation19,'excluded_19_2');assert.equal(excluded.deduction,null);
|
||||
});
|
||||
test('P002 stale source and event scope mismatch never overwrite prior acceptance',()=>{
|
||||
const b=goodsLocationBook(draft),changed={...draft,modelo_a_snapshot:saveGoodsLocationBook(draft,{...b,rows:b.rows.map(r=>r.id===cases[0].sourceRowId?{...r,placeCountry:'MZ'}:r)})};assert.equal(evaluateForeignOperation(changed,cases[0]).status,'indeterminate');
|
||||
assert.equal(evaluateForeignOperation({...draft,context_opportunity:'opportunity:359'},cases[0]).status,'indeterminate');assert.equal(evaluateForeignOperation(draft,{...cases[1],eventRowId:'goods_available'}).status,'indeterminate');
|
||||
const sw=switchForeignSource(cases[0],'services','general_service-foreign');assert.equal(sw.hypotheticalRef,cases[0].hypotheticalRef);assert.equal(sw.hypotheticalTaxable,'');assert.equal(sw.eventRowId,'');assert.equal(foreignEvents(draft).length,1);assert.equal(foreignSources(draft,'goods').length,3);
|
||||
});
|
||||
test('P002 dependency changes invalidate new analysis while snapshot/history stay immutable',()=>{
|
||||
const a=recordForeignOperations(draft,{rows:cases}),d={...draft,modelo_a_snapshot:saveForeignOperationBook(draft,a)};assert.equal(foreignOperationCurrent(d,a),true);const b=goodsLocationBook(d),changed={...d,modelo_a_snapshot:saveGoodsLocationBook(d,recordGoodsLocations(d,b))};assert.equal(foreignOperationCurrent(changed,a),false);assert.deepEqual(a.result.inputs,cases);assert.equal(foreignOperationReportRows(d).length,4);
|
||||
});
|
||||
test('P002 private save/recovery/report preserve 120delivered books and P104currency facts',()=>{
|
||||
const rows=[...cases,row('national','goods','g8a-goods_with_transport'),{...cases[1],id:'hypothesis_not_taxable',hypotheticalTaxable:'no'},{...cases[2],id:'exclusion19_2',excluded19_2:'yes'}],a=recordForeignOperations(draft,{rows}),d={...draft,modelo_a_snapshot:saveForeignOperationBook(draft,a)},b=recordForeignOperations(d,a);d.modelo_a_snapshot=saveForeignOperationBook(d,b);assert.equal(b.history.length,1);assert.equal(foreignOperationReportRows(d).length,7);
|
||||
const store=JSON.parse(d.modelo_a_snapshot);delete store.foreignOperations;for(const name of ['goodsLocations','serviceLocations','listedServices','currencyEvents'])delete store[name]['opportunity:358'];assert.deepEqual(store,original);assert.deepEqual(foreignOperationBook({...d,context_opportunity:'opportunity:359'}),{rows:[]});assert.throws(()=>recordForeignOperations(d,{rows:[rows[0],rows[0]]}));assert.throws(()=>foreignOperationBook({...d,modelo_a_snapshot:JSON.stringify({...store,foreignOperations:[]})}));
|
||||
if(process.env.IVA_FOREIGN_OPERATIONS_FIXTURE)fs.writeFileSync(process.env.IVA_FOREIGN_OPERATIONS_FIXTURE,JSON.stringify(d,null,2)+'\n');
|
||||
});
|
||||
Reference in New Issue
Block a user