Compare commits
8
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
019bcbad6c | ||
|
|
0ebb20c86a | ||
|
|
b0818c0163 | ||
|
|
ec786f4ae2 | ||
|
|
6c12aabb3a | ||
|
|
cd259623ae | ||
|
|
9b95e5e7a8 | ||
|
|
1b67fa85ff |
@@ -20437,5 +20437,674 @@
|
||||
},
|
||||
"base_VAT_separation": "Accepted perbranchQA reused:P096energy62%,P097aeronautical85%,P098publicworks40%(reduction60%),P099publicwater75%. These percentages apply to taxableBASE,not VATrates. Exactdecimal base applied once to fullconsideration before reduction excludingownVAT. Art18(6)deductionproportion notedonly;deduction/field11 outsideincrement,no VAT/deductioncalculated. Four installedruntimehashes/16compiledmarkers,103priorclosures preserved,no syntheticactivewrites.",
|
||||
"activation": "OnejointGit fast-forward/webhook/installer;zero migrations/imports"
|
||||
},
|
||||
"iva_l1_g10_own_name_P122_P128_homologation_20261025": {
|
||||
"status": "installed_delta_verified_partial_L1",
|
||||
"candidate": "af7d2503207c8744cdbb6d96b8cca89fa367384e",
|
||||
"base_installed": "2fdca86367d8bad524113b4cf6c49a0110130be9",
|
||||
"coverage_complete_branches": {
|
||||
"AUD-SIM-L1-P122": [
|
||||
"goods_sale_commission",
|
||||
"goods_purchase_commission"
|
||||
],
|
||||
"AUD-SIM-L1-P128": [
|
||||
"service_sale_mandate",
|
||||
"service_purchase_mandate"
|
||||
]
|
||||
},
|
||||
"branch_count_complete": 2,
|
||||
"treatment_count": 4,
|
||||
"runtime_delta": [
|
||||
{
|
||||
"path": "resources/js/lib/iva-own-name.ts",
|
||||
"sha256_LF": "c36509de24d31d747d91630a31ce7d72baa749e9928b718a944556348fc54f85"
|
||||
},
|
||||
{
|
||||
"path": "resources/js/components/simulation-own-name.tsx",
|
||||
"sha256_LF": "6e142242aa29ae07e36b4d8d0be7d78f770d701e0a92e1a6e9832fcb794c17cf"
|
||||
},
|
||||
{
|
||||
"path": "resources/js/components/simulation-monthly-iva.tsx",
|
||||
"sha256_LF": "9718dc440aa98497011775d8bd03049d7857fa3badf27f4467d6d434f642defd"
|
||||
},
|
||||
{
|
||||
"path": "resources/js/lib/project-dossier.ts",
|
||||
"sha256_LF": "099dc307a86c763a9509516f6d59cc5c454b1f81189cc04b919d8d6045baf9dc"
|
||||
}
|
||||
],
|
||||
"counts_before": {
|
||||
"delivered": 107,
|
||||
"QA": 2,
|
||||
"functional_pending": 23,
|
||||
"documentary": 1,
|
||||
"total": 133
|
||||
},
|
||||
"counts_current": {
|
||||
"delivered": 109,
|
||||
"QA": 0,
|
||||
"functional_pending": 23,
|
||||
"documentary": 1,
|
||||
"total": 133
|
||||
},
|
||||
"counts_after_delivery": {
|
||||
"delivered": 109,
|
||||
"QA": 0,
|
||||
"functional_pending": 23,
|
||||
"documentary": 1,
|
||||
"total": 133
|
||||
},
|
||||
"QA_proofs_reused": [
|
||||
"iva-l1-g10-own-name-qa-20261025.json"
|
||||
],
|
||||
"authorization": "Tempo explicitly requests one joint delivery ofaf7d2503,P122/P128,main compatibility/concurrent changes preserved,installeddelta only",
|
||||
"scope": "2026,circuitos emnome próprio,partes/contratos/objectos econtraprestações originais das duas relações. Sem soma/compensação automática,base tributável nova,localização,isenção,taxa,IVA,dedução/campo11 ou totaisModeloA. Sem conversão cambial;moeda original identificada e coerente com contexto. P091preservado,sem repetir aceitação/cálculo.",
|
||||
"source": "CIVA3(3)c,Lei13/2016PDF6/p1426(264);4(3),PDF7/p1426(265). Lei22/2022não altera3/4;Lei10/2025PDF12mantém3(3)c e não altera4. Base15(2)e/P091já entregue permanece independente;sem nova aplicação da base neste incremento.",
|
||||
"meaning": {
|
||||
"P122": "Transferências de bens em execução de contrato de comissão,incluindo consignação;na venda comissário considerado comprador,na compra comitente considerado comprador. Venda:comitente→comissário→terceiro;compra:terceiro→comissário→comitente. Contraprestações e referências das duas relações separadas.",
|
||||
"P128": "Serviço efectuado por intervenção de mandatário emnome próprio:mandatário considerado adquirente eprestador sucessivamente4(3). Venda/prestação:mandante→mandatário→terceiro;compra/aquisição:terceiro→mandatário→mandante. Não é mera intermediação emnome de outrem ou base15(2)e de bens."
|
||||
},
|
||||
"formula": "Classifytwo successive relations bykind/direction;keep eachoriginalconsideration separate;no monetaryaggregation or taxcalculation.",
|
||||
"preservation": "107prior closures and partialP084/P085 preserved;accepted perbranchQA reused;one integration/backup/real isolatedrestore/check for whole set",
|
||||
"partial_P084_P085": "Preparation/conditional simulation only,benefits pending;no closure",
|
||||
"limits": "L1open;deductionoutsideincrement;P00105/06;P121digital/P084/P085pending;beveragesL2/L3;Statistics/AIdeferred",
|
||||
"containment": "l1-g10-own-name-readonly-rollback-20261025.patch,checked only,not applied;blocks newP096–099classifications,preserves readers/history/otherbranches",
|
||||
"authenticated_preflight": {
|
||||
"installed": {
|
||||
"status": "installed",
|
||||
"commit": "2fdca86367d8bad524113b4cf6c49a0110130be9",
|
||||
"release": "/var/www/investmoz-homologacao/releases/2fdca86367d8bad524113b4cf6c49a0110130be9-c65ebbad",
|
||||
"previous_release": "/var/www/investmoz-homologacao/releases/2a7254406db3aa6e8c71bfbaf56bbcda1f139d19-ae306e0a",
|
||||
"database_migrations": 0,
|
||||
"content_imports": 0
|
||||
},
|
||||
"current_link": "/var/www/investmoz-homologacao/releases/2fdca86367d8bad524113b4cf6c49a0110130be9-c65ebbad",
|
||||
"release_revision": {
|
||||
"commit": "2fdca86367d8bad524113b4cf6c49a0110130be9",
|
||||
"branch": "main",
|
||||
"built_at": "2026-10-24T22:01:48.219730+00:00",
|
||||
"manifest_sha256": "d45edd81644fa6b659aece95804fd9c5e8e99c599ef82bf078ee2ba39e700f12"
|
||||
},
|
||||
"service": "ExecMainStatus=0\nActiveState=inactive\nSubState=dead\n",
|
||||
"configuration_keys": [
|
||||
"repository",
|
||||
"branch",
|
||||
"target_url",
|
||||
"legacy_root",
|
||||
"state_root",
|
||||
"release_root",
|
||||
"current_link",
|
||||
"shared_assets",
|
||||
"php",
|
||||
"schema_contract",
|
||||
"ci_environment",
|
||||
"postgis_image",
|
||||
"test_database",
|
||||
"qa_port",
|
||||
"retention",
|
||||
"webhook_secret_file"
|
||||
],
|
||||
"safe_paths": {
|
||||
"repository": "nala/Investidor-V2",
|
||||
"release_root": "/var/www/investmoz-homologacao/releases",
|
||||
"postgis_image": "postgis/postgis@sha256:01a6a70e41e6c4467c8f55f6063555ed72db2d6662cd0d571040d42eadaeb6f6"
|
||||
},
|
||||
"pipeline_sha256": "adec1c17654f3a8658b83b134f1e75f95391b235738552721906c3236e388604"
|
||||
},
|
||||
"backup_restore": {
|
||||
"backup": {
|
||||
"stage": "/var/backups/investmoz-l1-g10-own-name-delivery-20261025/backup",
|
||||
"target": {
|
||||
"database": "teste_investidor",
|
||||
"port": 5432
|
||||
},
|
||||
"tables": 174,
|
||||
"files_verified": 369,
|
||||
"dump_sha256": "85e90033b54a7eb7fed1bf0de466b984f5c03cc3b4938b5d8db20b7bf0abf954",
|
||||
"files_sha256": "291e2c871d94c3b642252f8daa8a9d7557278f13028e68df78b5f6edec5b1234",
|
||||
"restore_verified": false
|
||||
},
|
||||
"restore": {
|
||||
"restore_verified": true,
|
||||
"tables_verified": 174,
|
||||
"container_network": "none",
|
||||
"database": "l1_g10_own_name_restore_20261024",
|
||||
"port": 55441,
|
||||
"source_dump_sha256": "85e90033b54a7eb7fed1bf0de466b984f5c03cc3b4938b5d8db20b7bf0abf954",
|
||||
"active_database_writes": 0
|
||||
}
|
||||
},
|
||||
"delivery_local_date": "2026-10-25",
|
||||
"delivery_timezone": "Africa/Johannesburg",
|
||||
"served_commit": "63cc336787cade92fb7ee5b2b2d407308a0cf66b",
|
||||
"installation": {
|
||||
"protected": {
|
||||
"installed": {
|
||||
"status": "installed",
|
||||
"commit": "63cc336787cade92fb7ee5b2b2d407308a0cf66b",
|
||||
"release": "/var/www/investmoz-homologacao/releases/63cc336787cade92fb7ee5b2b2d407308a0cf66b-a32af166",
|
||||
"previous_release": "/var/www/investmoz-homologacao/releases/2fdca86367d8bad524113b4cf6c49a0110130be9-c65ebbad",
|
||||
"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": "0533965406197091e01442f39b006a04"
|
||||
},
|
||||
"after": {
|
||||
"rows": 106,
|
||||
"checksum": "690fff122d6fc745c2e2ab9bd28732aa"
|
||||
}
|
||||
},
|
||||
"sessions": {
|
||||
"before": {
|
||||
"rows": 93,
|
||||
"checksum": "d97f35b74199225940dea7078a712474"
|
||||
},
|
||||
"after": {
|
||||
"rows": 94,
|
||||
"checksum": "def210abad7e8e9b838f9490594fb787"
|
||||
}
|
||||
}
|
||||
},
|
||||
"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": "63cc336787cade92fb7ee5b2b2d407308a0cf66b",
|
||||
"branch": "main",
|
||||
"built_at": "2026-10-24T22:09:58.694541+00:00",
|
||||
"manifest_sha256": "40f4377487ec290e47d1bee92146172fa4e2a316fa4a072dcc82300fea3cc6c1"
|
||||
},
|
||||
"manifest_hash_matches": true,
|
||||
"compiled_delta_markers": {
|
||||
"own-name-chains/1": [
|
||||
"assets/project-dossier-Ct_yYLqe.js"
|
||||
],
|
||||
"goods_sale_commission": [
|
||||
"assets/project-dossier-Ct_yYLqe.js"
|
||||
],
|
||||
"goods_purchase_commission": [
|
||||
"assets/project-dossier-Ct_yYLqe.js"
|
||||
],
|
||||
"service_sale_mandate": [
|
||||
"assets/project-dossier-Ct_yYLqe.js"
|
||||
],
|
||||
"service_purchase_mandate": [
|
||||
"assets/project-dossier-Ct_yYLqe.js"
|
||||
],
|
||||
"ownNames": [
|
||||
"assets/project-dossier-Ct_yYLqe.js"
|
||||
],
|
||||
"ownName": [
|
||||
"assets/project-dossier-Ct_yYLqe.js"
|
||||
],
|
||||
"forAnother": [
|
||||
"assets/project-dossier-Ct_yYLqe.js"
|
||||
],
|
||||
"commissionContract": [
|
||||
"assets/project-dossier-Ct_yYLqe.js"
|
||||
],
|
||||
"successiveService": [
|
||||
"assets/project-dossier-Ct_yYLqe.js"
|
||||
],
|
||||
"directionConfirmed": [
|
||||
"assets/project-dossier-Ct_yYLqe.js"
|
||||
],
|
||||
"firstAmount": [
|
||||
"assets/services-BoK-jPgg.js",
|
||||
"assets/project-dossier-Ct_yYLqe.js"
|
||||
],
|
||||
"secondAmount": [
|
||||
"assets/services-BoK-jPgg.js",
|
||||
"assets/project-dossier-Ct_yYLqe.js"
|
||||
],
|
||||
"firstLegRef": [
|
||||
"assets/services-BoK-jPgg.js",
|
||||
"assets/project-dossier-Ct_yYLqe.js"
|
||||
],
|
||||
"secondLegRef": [
|
||||
"assets/services-BoK-jPgg.js",
|
||||
"assets/project-dossier-Ct_yYLqe.js"
|
||||
],
|
||||
"existingBaseRef": [
|
||||
"assets/services-BoK-jPgg.js",
|
||||
"assets/project-dossier-Ct_yYLqe.js"
|
||||
],
|
||||
"IVA: Indeterminado": [
|
||||
"assets/project-dossier-Ct_yYLqe.js"
|
||||
]
|
||||
},
|
||||
"assets": [
|
||||
{
|
||||
"file": "assets/simulation-form-CPZAFZU3.js",
|
||||
"status": 200,
|
||||
"sha256": "c6bcf64e60a5eeac0cafe3dc055dc5544162f21942ee08b34d51bc6d52947567"
|
||||
},
|
||||
{
|
||||
"file": "assets/services-BoK-jPgg.js",
|
||||
"status": 200,
|
||||
"sha256": "df86ebec3aad6060cc563343ddc3010d330fcd8b89e21db9861c042dbadb3317"
|
||||
},
|
||||
{
|
||||
"file": "assets/project-dossier-document-DTNvmcJB.js",
|
||||
"status": 200,
|
||||
"sha256": "e961e77528e9c18681f133dd6e332202f48783bb0f9373117aac8aa83a0653b3"
|
||||
},
|
||||
{
|
||||
"file": "assets/project-dossier-Ct_yYLqe.js",
|
||||
"status": 200,
|
||||
"sha256": "db9b14435dccf65e83555e2517b939e0bc05a31782996abffe6d7b29b901ea47"
|
||||
}
|
||||
],
|
||||
"simulator_status": 200,
|
||||
"simulator_entry": "assets/app-dGCxtIbq.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": "63cc336787cade92fb7ee5b2b2d407308a0cf66b",
|
||||
"release": "/var/www/investmoz-homologacao/releases/63cc336787cade92fb7ee5b2b2d407308a0cf66b-a32af166",
|
||||
"previous_release": "/var/www/investmoz-homologacao/releases/2fdca86367d8bad524113b4cf6c49a0110130be9-c65ebbad",
|
||||
"database_migrations": 0,
|
||||
"content_imports": 0
|
||||
},
|
||||
"latest_report": {
|
||||
"status": "installed",
|
||||
"commit": "63cc336787cade92fb7ee5b2b2d407308a0cf66b",
|
||||
"release": "/var/www/investmoz-homologacao/releases/63cc336787cade92fb7ee5b2b2d407308a0cf66b-a32af166",
|
||||
"previous_release": "/var/www/investmoz-homologacao/releases/2fdca86367d8bad524113b4cf6c49a0110130be9-c65ebbad",
|
||||
"database_migrations": 0,
|
||||
"content_imports": 0,
|
||||
"requested_commits": [
|
||||
"63cc336787cade92fb7ee5b2b2d407308a0cf66b"
|
||||
],
|
||||
"finished_at": "2026-10-24T22:10:01.647328+00:00"
|
||||
},
|
||||
"log_file": "1792879692780810651.log",
|
||||
"summaries": [
|
||||
"OK (1 test, 3106 assertions)",
|
||||
"built in 27.93s",
|
||||
"OK (59 tests, 317 assertions)",
|
||||
"# tests 413",
|
||||
"# pass 413",
|
||||
"# fail 0"
|
||||
],
|
||||
"log_bytes": 146997
|
||||
},
|
||||
"rollback_executed": false
|
||||
},
|
||||
"base_VAT_separation": "AcceptedQA reused:P122goods sale/purchasecommission3(3)c andP128services sale/purchasemandate4(3). Agent ownname andforanother,parties/contract/object/period/two relations explicit. Originalconsiderations separated,never summed/netted/converted or usedasautomaticbase. P091anditsbooks/history preserved,not recalculated. No territoriality/exemption/base/rate/VAT/deductionfield11 or ModeloAtotals activated. Four installedruntimehashes/17compiledmarkers;107previousclosures preserved;no syntheticactivewrites.",
|
||||
"activation": "OnejointGit fast-forward/webhook/installer;zero migrations/imports"
|
||||
},
|
||||
"iva_l1_goods_allocation_P088_P124_homologation_20261025": {
|
||||
"status": "installed_delta_verified_partial_L1",
|
||||
"candidate": "cd259623aed6e8831091866de02d5e5db4ef1818",
|
||||
"base_installed": "63cc336787cade92fb7ee5b2b2d407308a0cf66b",
|
||||
"coverage_complete_branches": {
|
||||
"AUD-SIM-L1-P088": [
|
||||
"permanent_private_goods",
|
||||
"free_goods_transfer",
|
||||
"exempt_sector_goods",
|
||||
"fixed_asset_20a"
|
||||
],
|
||||
"AUD-SIM-L1-P124": [
|
||||
"permanent_private_goods",
|
||||
"free_goods_transfer",
|
||||
"exempt_sector_goods",
|
||||
"fixed_asset_20a"
|
||||
]
|
||||
},
|
||||
"branch_count_complete": 2,
|
||||
"treatment_count": 4,
|
||||
"runtime_delta": [
|
||||
{
|
||||
"path": "resources/js/lib/iva-goods-allocation.ts",
|
||||
"sha256_LF": "6646a2054ebd4e6731b60719d36ce922ed50f2e062e0f980190eb20ce8c23d20"
|
||||
},
|
||||
{
|
||||
"path": "resources/js/components/simulation-goods-allocation.tsx",
|
||||
"sha256_LF": "08c84f4b9af21e46cd9d5af6f6bee9e12c14b111438f1649a694a27f36d14180"
|
||||
},
|
||||
{
|
||||
"path": "resources/js/components/simulation-monthly-iva.tsx",
|
||||
"sha256_LF": "1b27e8d3a6c79c6f8769bf5158ed8be45718f655b13cdf23b517bdb44c5a6951"
|
||||
},
|
||||
{
|
||||
"path": "resources/js/lib/project-dossier.ts",
|
||||
"sha256_LF": "c5de565ff7ded1fcf4d1f3a025694d3e2af4ff75e55266463758e8c1c5fcc314"
|
||||
}
|
||||
],
|
||||
"counts_before": {
|
||||
"delivered": 109,
|
||||
"QA": 2,
|
||||
"functional_pending": 21,
|
||||
"documentary": 1,
|
||||
"total": 133
|
||||
},
|
||||
"counts_current": {
|
||||
"delivered": 111,
|
||||
"QA": 0,
|
||||
"functional_pending": 21,
|
||||
"documentary": 1,
|
||||
"total": 133
|
||||
},
|
||||
"counts_after_delivery": {
|
||||
"delivered": 111,
|
||||
"QA": 0,
|
||||
"functional_pending": 21,
|
||||
"documentary": 1,
|
||||
"total": 133
|
||||
},
|
||||
"QA_proofs_reused": [
|
||||
"iva-l1-goods-allocation-qa-20261025.json"
|
||||
],
|
||||
"authorization": "Tempo explicitly requests one joint delivery ofcd259623,P088/P124,main compatibility/concurrent changes preserved,installeddelta only",
|
||||
"scope": "2026/MZN,quatro tratamentos partilhados entre dois requisitos sobre a mesma operação,registada uma vez. Distinto de uso temporário de bens como serviçoP089. Sem nova dedução/campo11,regularização,taxaIVA,IVA ou totaisModeloA;dedução anterior apenas facto histórico. Excepçãoamostras/ofertas fica fora deste percurso quando aplicável;desconhecido permanece indeterminado.",
|
||||
"source": "CIVA3(3)e/f,Lei13/2016PDF6–7/p1426(264–265);15(2)b,PDF13/p1426(271);20(1)a,PDF15/p1426(273). Lei22/2022PDF3mantém15(2)b e20(1)a;Lei10/2025PDF12mantém3(3)e/f e não altera15/20.",
|
||||
"meaning": {
|
||||
"P124": "Classificação da afectação permanente de bens a uso próprio/particular/alheio,transmissão gratuita,afectação a sector isento ou aoactivo imobilizado de bens20(1)a. Exige dedução anterior total/parcial nos bens/elementos;em3e conferir excepção de amostras/ofertas depequeno valor,sem limiar inventado. Facto histórico de dedução,não nova dedução.",
|
||||
"P088": "Base15(2)b:preço aquisição ou,na sua falta demonstrada,preço custo,reportados ao momento da operação. ClassificaçãoP124 pode estar identificada ebaseP088 indeterminada;sem custo por defeito para preço aquisição desconhecido."
|
||||
},
|
||||
"formula": "15(2)b:current acquisitionprice;only if absent,currentcost.No automaticvaluation/update/depreciation/deduction.",
|
||||
"preservation": "109prior closures and partialP084/P085 preserved;accepted perbranchQA reused;one integration/backup/real isolatedrestore/check for whole set",
|
||||
"partial_P084_P085": "Preparation/conditional simulation only,benefits pending;no closure",
|
||||
"limits": "L1open;newdeduction/regularisationoutsideincrement;P00105/06;P121digital/P084/P085pending;beveragesL2/L3;Statistics/AIdeferred",
|
||||
"containment": "l1-goods-allocation-readonly-rollback-20261025.patch,checked only,not applied;blocks newP096–099classifications,preserves readers/history/otherbranches",
|
||||
"authenticated_preflight": {
|
||||
"installed": {
|
||||
"status": "installed",
|
||||
"commit": "63cc336787cade92fb7ee5b2b2d407308a0cf66b",
|
||||
"release": "/var/www/investmoz-homologacao/releases/63cc336787cade92fb7ee5b2b2d407308a0cf66b-a32af166",
|
||||
"previous_release": "/var/www/investmoz-homologacao/releases/2fdca86367d8bad524113b4cf6c49a0110130be9-c65ebbad",
|
||||
"database_migrations": 0,
|
||||
"content_imports": 0
|
||||
},
|
||||
"current_link": "/var/www/investmoz-homologacao/releases/63cc336787cade92fb7ee5b2b2d407308a0cf66b-a32af166",
|
||||
"release_revision": {
|
||||
"commit": "63cc336787cade92fb7ee5b2b2d407308a0cf66b",
|
||||
"branch": "main",
|
||||
"built_at": "2026-10-24T22:09:58.694541+00:00",
|
||||
"manifest_sha256": "40f4377487ec290e47d1bee92146172fa4e2a316fa4a072dcc82300fea3cc6c1"
|
||||
},
|
||||
"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-goods-allocation-delivery-20261025/backup",
|
||||
"target": {
|
||||
"database": "teste_investidor",
|
||||
"port": 5432
|
||||
},
|
||||
"tables": 174,
|
||||
"files_verified": 369,
|
||||
"dump_sha256": "a78973a94e05f58ab4cea4bebedca4603d7f68aa4a0d8a46b889d27751514e64",
|
||||
"files_sha256": "9302d0e283a5ea2619de1fbe5853d4c2e563d455d7aafb7e88203eafc6ef85e1",
|
||||
"restore_verified": false
|
||||
},
|
||||
"restore": {
|
||||
"restore_verified": true,
|
||||
"tables_verified": 174,
|
||||
"container_network": "none",
|
||||
"database": "l1_goods_allocation_restore_20261024",
|
||||
"port": 55441,
|
||||
"source_dump_sha256": "a78973a94e05f58ab4cea4bebedca4603d7f68aa4a0d8a46b889d27751514e64",
|
||||
"active_database_writes": 0
|
||||
}
|
||||
},
|
||||
"delivery_local_date": "2026-10-25",
|
||||
"delivery_timezone": "Africa/Johannesburg",
|
||||
"served_commit": "6c12aabb3ac7f8296025a2af0408390bfe292bdb",
|
||||
"installation": {
|
||||
"protected": {
|
||||
"installed": {
|
||||
"status": "installed",
|
||||
"commit": "6c12aabb3ac7f8296025a2af0408390bfe292bdb",
|
||||
"release": "/var/www/investmoz-homologacao/releases/6c12aabb3ac7f8296025a2af0408390bfe292bdb-4c33615a",
|
||||
"previous_release": "/var/www/investmoz-homologacao/releases/63cc336787cade92fb7ee5b2b2d407308a0cf66b-a32af166",
|
||||
"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": "09d3d422c9a8be947a5b477dbee30bb4"
|
||||
},
|
||||
"after": {
|
||||
"rows": 106,
|
||||
"checksum": "898f63b7cbe166244f5a4ea6d0803cb2"
|
||||
}
|
||||
},
|
||||
"sessions": {
|
||||
"before": {
|
||||
"rows": 96,
|
||||
"checksum": "375984b4326c2b632b66fba47946b8c8"
|
||||
},
|
||||
"after": {
|
||||
"rows": 97,
|
||||
"checksum": "acfde110c5f28d239ee13f14da01e6b7"
|
||||
}
|
||||
}
|
||||
},
|
||||
"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": "6c12aabb3ac7f8296025a2af0408390bfe292bdb",
|
||||
"branch": "main",
|
||||
"built_at": "2026-10-24T22:19:07.102372+00:00",
|
||||
"manifest_sha256": "91a95647c3666b2dc9a322fbf7534e055c616872c791920d2cc004234c1b0d25"
|
||||
},
|
||||
"manifest_hash_matches": true,
|
||||
"compiled_delta_markers": {
|
||||
"goods-allocation-base/1": [
|
||||
"assets/project-dossier-Dnh3xPdC.js"
|
||||
],
|
||||
"permanent_private_goods": [
|
||||
"assets/services-B0mFnttq.js",
|
||||
"assets/project-dossier-Dnh3xPdC.js"
|
||||
],
|
||||
"free_goods_transfer": [
|
||||
"assets/services-B0mFnttq.js",
|
||||
"assets/project-dossier-Dnh3xPdC.js"
|
||||
],
|
||||
"exempt_sector_goods": [
|
||||
"assets/project-dossier-Dnh3xPdC.js"
|
||||
],
|
||||
"fixed_asset_20a": [
|
||||
"assets/services-B0mFnttq.js",
|
||||
"assets/project-dossier-Dnh3xPdC.js"
|
||||
],
|
||||
"regulatedGoodsAllocations": [
|
||||
"assets/project-dossier-Dnh3xPdC.js"
|
||||
],
|
||||
"priorDeduction": [
|
||||
"assets/project-dossier-Dnh3xPdC.js"
|
||||
],
|
||||
"deductionRef": [
|
||||
"assets/services-B0mFnttq.js",
|
||||
"assets/project-dossier-Dnh3xPdC.js"
|
||||
],
|
||||
"acquisitionPrice": [
|
||||
"assets/services-B0mFnttq.js",
|
||||
"assets/project-dossier-Dnh3xPdC.js"
|
||||
],
|
||||
"acquisitionRef": [
|
||||
"assets/services-B0mFnttq.js",
|
||||
"assets/project-dossier-Dnh3xPdC.js"
|
||||
],
|
||||
"currentCost": [
|
||||
"assets/services-B0mFnttq.js",
|
||||
"assets/project-dossier-Dnh3xPdC.js"
|
||||
],
|
||||
"costRef": [
|
||||
"assets/services-B0mFnttq.js",
|
||||
"assets/project-dossier-Dnh3xPdC.js"
|
||||
],
|
||||
"valuationMode": [
|
||||
"assets/services-B0mFnttq.js",
|
||||
"assets/project-dossier-Dnh3xPdC.js"
|
||||
],
|
||||
"valuationConfirmed": [
|
||||
"assets/services-B0mFnttq.js",
|
||||
"assets/project-dossier-Dnh3xPdC.js"
|
||||
],
|
||||
"acquisitionUnavailable": [
|
||||
"assets/services-B0mFnttq.js",
|
||||
"assets/project-dossier-Dnh3xPdC.js"
|
||||
],
|
||||
"valuationScope": [
|
||||
"assets/services-B0mFnttq.js",
|
||||
"assets/project-dossier-Dnh3xPdC.js"
|
||||
],
|
||||
"valuationDate": [
|
||||
"assets/services-B0mFnttq.js",
|
||||
"assets/project-dossier-Dnh3xPdC.js"
|
||||
],
|
||||
"asset20aRef": [
|
||||
"assets/services-B0mFnttq.js",
|
||||
"assets/project-dossier-Dnh3xPdC.js"
|
||||
],
|
||||
"exceptionRef": [
|
||||
"assets/services-B0mFnttq.js",
|
||||
"assets/project-dossier-Dnh3xPdC.js"
|
||||
],
|
||||
"IVA: Indeterminado": [
|
||||
"assets/project-dossier-Dnh3xPdC.js"
|
||||
]
|
||||
},
|
||||
"assets": [
|
||||
{
|
||||
"file": "assets/services-B0mFnttq.js",
|
||||
"status": 200,
|
||||
"sha256": "8e586f10c4efa6ad9805ed75ba0c21f68b1550d9a697959b5f51c966b40ace45"
|
||||
},
|
||||
{
|
||||
"file": "assets/project-dossier-Dnh3xPdC.js",
|
||||
"status": 200,
|
||||
"sha256": "a02b40fbbafa16651af80f74b6d0486b8fb086b404151bcf1a25690252138d40"
|
||||
},
|
||||
{
|
||||
"file": "assets/simulation-form-CPZAFZU3.js",
|
||||
"status": 200,
|
||||
"sha256": "c6bcf64e60a5eeac0cafe3dc055dc5544162f21942ee08b34d51bc6d52947567"
|
||||
},
|
||||
{
|
||||
"file": "assets/project-dossier-document-Cb9azkcP.js",
|
||||
"status": 200,
|
||||
"sha256": "08aa7a6c7f2b78ddfdd69b51c355f186b6811171bd702275bf76fe3369aa87d9"
|
||||
}
|
||||
],
|
||||
"simulator_status": 200,
|
||||
"simulator_entry": "assets/app-Cy6kCwzN.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": "6c12aabb3ac7f8296025a2af0408390bfe292bdb",
|
||||
"release": "/var/www/investmoz-homologacao/releases/6c12aabb3ac7f8296025a2af0408390bfe292bdb-4c33615a",
|
||||
"previous_release": "/var/www/investmoz-homologacao/releases/63cc336787cade92fb7ee5b2b2d407308a0cf66b-a32af166",
|
||||
"database_migrations": 0,
|
||||
"content_imports": 0
|
||||
},
|
||||
"latest_report": {
|
||||
"status": "installed",
|
||||
"commit": "6c12aabb3ac7f8296025a2af0408390bfe292bdb",
|
||||
"release": "/var/www/investmoz-homologacao/releases/6c12aabb3ac7f8296025a2af0408390bfe292bdb-4c33615a",
|
||||
"previous_release": "/var/www/investmoz-homologacao/releases/63cc336787cade92fb7ee5b2b2d407308a0cf66b-a32af166",
|
||||
"database_migrations": 0,
|
||||
"content_imports": 0,
|
||||
"requested_commits": [
|
||||
"6c12aabb3ac7f8296025a2af0408390bfe292bdb"
|
||||
],
|
||||
"finished_at": "2026-10-24T22:19:10.041371+00:00"
|
||||
},
|
||||
"log_file": "1792880241239958545.log",
|
||||
"summaries": [
|
||||
"OK (1 test, 3106 assertions)",
|
||||
"built in 26.70s",
|
||||
"OK (59 tests, 317 assertions)",
|
||||
"# tests 420",
|
||||
"# pass 420",
|
||||
"# fail 0"
|
||||
],
|
||||
"log_bytes": 148552
|
||||
},
|
||||
"rollback_executed": false
|
||||
},
|
||||
"base_VAT_separation": "AcceptedQA reused:P124assimilatedgoods classification3(3)e/f andP088base15(2)b,four sharedtreatments,one operationidentity. Prior total/partialdeduction is historicalfact ongoods/elements,not newdeduction/field11 orregularisation. Base=currentacquisitionprice;currentcostonlyin demonstratedabsence ofacquisitionprice. Unknownfallback retainsclassification withindeterminatebase;unknownhistoricaldeduction leavesclassificationindeterminate. No tax/IVA/regularisationcalculated. Fourinstalledruntimehashes/20compiledmarkers;109priorclosures preserved;no syntheticactivewrites.",
|
||||
"activation": "OnejointGit fast-forward/webhook/installer;zero migrations/imports"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"implementation_commit": "2b592ded669f400e2322c183947a045bb3790c73",
|
||||
"status": "QA_complete_not_delivered",
|
||||
"status": "delivered_with_QA_proofs_preserved",
|
||||
"coverage": {
|
||||
"AUD-SIM-L1-P122": [
|
||||
"goods_sale_commission",
|
||||
@@ -174,5 +174,18 @@
|
||||
"homologation_unchanged": "2fdca863",
|
||||
"remaining": "OnejointGit delivery forP122/P128,freshbackup/realisolatedrestore,acceptedQA reused,installeddeltaonly. No individualbranch deployment.",
|
||||
"limits": "L1open;deductionoutsideincrement;P00105/06;P121digital/P084/P085pending;beveragesL2/L3;Statistics/AIdeferred",
|
||||
"sources_inventory": "C:\\laragon\\www\\portal-investidor\\outputs\\iva-l1-g10-own-name-20261025\\source-archive-inventory.json"
|
||||
"sources_inventory": "C:\\laragon\\www\\portal-investidor\\outputs\\iva-l1-g10-own-name-20261025\\source-archive-inventory.json",
|
||||
"qa_status_preserved": "QA_complete_not_delivered",
|
||||
"delivery_followup": {
|
||||
"served_commit": "63cc336787cade92fb7ee5b2b2d407308a0cf66b",
|
||||
"receipt": "l1-g10-own-name-delivery-20261025.json",
|
||||
"record": "iva_l1_g10_own_name_P122_P128_homologation_20261025",
|
||||
"counts": {
|
||||
"delivered": 109,
|
||||
"QA": 0,
|
||||
"functional_pending": 23,
|
||||
"documentary": 1,
|
||||
"total": 133
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,198 @@
|
||||
{
|
||||
"implementation_commit": "9b95e5e7a8d129d6256f8df1b62423b8a94c4477",
|
||||
"status": "delivered_with_QA_proofs_preserved",
|
||||
"coverage": {
|
||||
"AUD-SIM-L1-P088": [
|
||||
"permanent_private_goods",
|
||||
"free_goods_transfer",
|
||||
"exempt_sector_goods",
|
||||
"fixed_asset_20a"
|
||||
],
|
||||
"AUD-SIM-L1-P124": [
|
||||
"permanent_private_goods",
|
||||
"free_goods_transfer",
|
||||
"exempt_sector_goods",
|
||||
"fixed_asset_20a"
|
||||
]
|
||||
},
|
||||
"branch_count": 2,
|
||||
"treatment_count": 4,
|
||||
"shared_operations_not_double_counted": true,
|
||||
"source": "CIVA3(3)e/f,Lei13/2016PDF6–7/p1426(264–265);15(2)b,PDF13/p1426(271);20(1)a,PDF15/p1426(273). Lei22/2022PDF3mantém15(2)b e20(1)a;Lei10/2025PDF12mantém3(3)e/f e não altera15/20.",
|
||||
"meaning": {
|
||||
"P124": "Classificação da afectação permanente de bens a uso próprio/particular/alheio,transmissão gratuita,afectação a sector isento ou aoactivo imobilizado de bens20(1)a. Exige dedução anterior total/parcial nos bens/elementos;em3e conferir excepção de amostras/ofertas depequeno valor,sem limiar inventado. Facto histórico de dedução,não nova dedução.",
|
||||
"P088": "Base15(2)b:preço aquisição ou,na sua falta demonstrada,preço custo,reportados ao momento da operação. ClassificaçãoP124 pode estar identificada ebaseP088 indeterminada;sem custo por defeito para preço aquisição desconhecido."
|
||||
},
|
||||
"formula": "15(2)b:current acquisitionprice;only if absent,currentcost.No automaticvaluation/update/depreciation/deduction.",
|
||||
"scope": "2026/MZN,quatro tratamentos partilhados entre dois requisitos sobre a mesma operação,registada uma vez. Distinto de uso temporário de bens como serviçoP089. Sem nova dedução/campo11,regularização,taxaIVA,IVA ou totaisModeloA;dedução anterior apenas facto histórico. Excepçãoamostras/ofertas fica fora deste percurso quando aplicável;desconhecido permanece indeterminado.",
|
||||
"technical_choices": "NewregulatedGoodsAllocations opportunity-scoped book in existingmodelo_a snapshot/API/dossier;oneoperation jointlycoversP124facts/P088base,no duplicatedentry/aggregation. Switchretains hiddenprices/refs andrequiresreviewownfacts/valuation. Money15integer/6fractiondigits,BigInt,no float/rounding. Existingrefs or explicitassumptions,no certificates/approvers/newthresholds. valuationDate meansmomenttowhichpriceisreported,not compulsorynewdocumentissue date.",
|
||||
"verification": {
|
||||
"frontend": {
|
||||
"tests": 7,
|
||||
"passed": 7,
|
||||
"failed": 0,
|
||||
"by_treatment": "Four ownfact paths,priorDeduction unknown/no,scope/refs/date,exactcurrent acquisition/cost and no VAT",
|
||||
"additional": "P124classification separatedfromP088missingbase;costfallback requires explicitabsence ofacquisitionprice,currentmoment,date/scope;switchretains hiddenprices/refs andclearsconfirmations;zero vsunknown;allpreviousbooks/history/report/corruptwriteguards"
|
||||
},
|
||||
"privateAPI": {
|
||||
"tests": 1,
|
||||
"assertions": 27,
|
||||
"target": "simulator_fiscal_delta_20261021_test:55441",
|
||||
"transaction_rollback": true,
|
||||
"xml": "C:\\laragon\\www\\portal-investidor\\outputs\\iva-l1-goods-allocation-20261025\\api-tests.xml"
|
||||
},
|
||||
"types": "passed",
|
||||
"build": "passed,existing plugin timing warnings",
|
||||
"UI": "Edge/CUArealcomponent:acquisitionabsenceunknown retainsassimilatedclassification butcostbaseindeterminate;priorDeductionunknown makesclassificationindeterminate;restorefacts,saved/recovered/report4operations1000.25/800.15/1000.25/800.15MZN and4previousversions,VAT/ratenull. SyntheticQA,notmanualTempoacceptance.",
|
||||
"UI_screenshot": "C:\\laragon\\www\\portal-investidor\\outputs\\iva-l1-goods-allocation-20261025\\qa-recovered-report.png"
|
||||
},
|
||||
"preservation": {
|
||||
"base": "1b67fa85ff91174a45c171a6cf6af821727acca5",
|
||||
"delivered_ids": [
|
||||
"AUD-SIM-L1-P003",
|
||||
"AUD-SIM-L1-P004",
|
||||
"AUD-SIM-L1-P005",
|
||||
"AUD-SIM-L1-P006",
|
||||
"AUD-SIM-L1-P007",
|
||||
"AUD-SIM-L1-P008",
|
||||
"AUD-SIM-L1-P009",
|
||||
"AUD-SIM-L1-P010",
|
||||
"AUD-SIM-L1-P011",
|
||||
"AUD-SIM-L1-P012",
|
||||
"AUD-SIM-L1-P013",
|
||||
"AUD-SIM-L1-P014",
|
||||
"AUD-SIM-L1-P015",
|
||||
"AUD-SIM-L1-P016",
|
||||
"AUD-SIM-L1-P017",
|
||||
"AUD-SIM-L1-P018",
|
||||
"AUD-SIM-L1-P019",
|
||||
"AUD-SIM-L1-P020",
|
||||
"AUD-SIM-L1-P021",
|
||||
"AUD-SIM-L1-P022",
|
||||
"AUD-SIM-L1-P023",
|
||||
"AUD-SIM-L1-P024",
|
||||
"AUD-SIM-L1-P025",
|
||||
"AUD-SIM-L1-P026",
|
||||
"AUD-SIM-L1-P027",
|
||||
"AUD-SIM-L1-P028",
|
||||
"AUD-SIM-L1-P029",
|
||||
"AUD-SIM-L1-P030",
|
||||
"AUD-SIM-L1-P031",
|
||||
"AUD-SIM-L1-P032",
|
||||
"AUD-SIM-L1-P033",
|
||||
"AUD-SIM-L1-P034",
|
||||
"AUD-SIM-L1-P035",
|
||||
"AUD-SIM-L1-P036",
|
||||
"AUD-SIM-L1-P037",
|
||||
"AUD-SIM-L1-P038",
|
||||
"AUD-SIM-L1-P039",
|
||||
"AUD-SIM-L1-P040",
|
||||
"AUD-SIM-L1-P041",
|
||||
"AUD-SIM-L1-P042",
|
||||
"AUD-SIM-L1-P043",
|
||||
"AUD-SIM-L1-P044",
|
||||
"AUD-SIM-L1-P045",
|
||||
"AUD-SIM-L1-P048",
|
||||
"AUD-SIM-L1-P049",
|
||||
"AUD-SIM-L1-P050",
|
||||
"AUD-SIM-L1-P051",
|
||||
"AUD-SIM-L1-P052",
|
||||
"AUD-SIM-L1-P053",
|
||||
"AUD-SIM-L1-P054",
|
||||
"AUD-SIM-L1-P055",
|
||||
"AUD-SIM-L1-P056",
|
||||
"AUD-SIM-L1-P057",
|
||||
"AUD-SIM-L1-P060",
|
||||
"AUD-SIM-L1-P061",
|
||||
"AUD-SIM-L1-P062",
|
||||
"AUD-SIM-L1-P063",
|
||||
"AUD-SIM-L1-P064",
|
||||
"AUD-SIM-L1-P065",
|
||||
"AUD-SIM-L1-P066",
|
||||
"AUD-SIM-L1-P067",
|
||||
"AUD-SIM-L1-P068",
|
||||
"AUD-SIM-L1-P069",
|
||||
"AUD-SIM-L1-P070",
|
||||
"AUD-SIM-L1-P071",
|
||||
"AUD-SIM-L1-P072",
|
||||
"AUD-SIM-L1-P073",
|
||||
"AUD-SIM-L1-P074",
|
||||
"AUD-SIM-L1-P075",
|
||||
"AUD-SIM-L1-P076",
|
||||
"AUD-SIM-L1-P077",
|
||||
"AUD-SIM-L1-P078",
|
||||
"AUD-SIM-L1-P079",
|
||||
"AUD-SIM-L1-P080",
|
||||
"AUD-SIM-L1-P081",
|
||||
"AUD-SIM-L1-P082",
|
||||
"AUD-SIM-L1-P083",
|
||||
"AUD-SIM-L1-P086",
|
||||
"AUD-SIM-L1-P089",
|
||||
"AUD-SIM-L1-P090",
|
||||
"AUD-SIM-L1-P091",
|
||||
"AUD-SIM-L1-P094",
|
||||
"AUD-SIM-L1-P095",
|
||||
"AUD-SIM-L1-P096",
|
||||
"AUD-SIM-L1-P097",
|
||||
"AUD-SIM-L1-P098",
|
||||
"AUD-SIM-L1-P099",
|
||||
"AUD-SIM-L1-P100",
|
||||
"AUD-SIM-L1-P101",
|
||||
"AUD-SIM-L1-P102",
|
||||
"AUD-SIM-L1-P103",
|
||||
"AUD-SIM-L1-P105",
|
||||
"AUD-SIM-L1-P106",
|
||||
"AUD-SIM-L1-P107",
|
||||
"AUD-SIM-L1-P108",
|
||||
"AUD-SIM-L1-P109",
|
||||
"AUD-SIM-L1-P110",
|
||||
"AUD-SIM-L1-P111",
|
||||
"AUD-SIM-L1-P112",
|
||||
"AUD-SIM-L1-P113",
|
||||
"AUD-SIM-L1-P114",
|
||||
"AUD-SIM-L1-P115",
|
||||
"AUD-SIM-L1-P116",
|
||||
"AUD-SIM-L1-P117",
|
||||
"AUD-SIM-L1-P118",
|
||||
"AUD-SIM-L1-P119",
|
||||
"AUD-SIM-L1-P120",
|
||||
"AUD-SIM-L1-P122",
|
||||
"AUD-SIM-L1-P128"
|
||||
],
|
||||
"confirmed_losses": [],
|
||||
"accepted_delivery": "63cc3367/1b67fa85;174tables/369files;29published/28relations/408geometries;code/schema/data/config/permissions compared",
|
||||
"frozen": "tests\\frontend\\fixtures\\iva-goods-allocation-preserved.json",
|
||||
"sha256": "724929bfda23475531c373f2bf5a88951c192e7ecb930e1d38249d6e2cbefd14",
|
||||
"scope": "P088/P124QA;all priorbooks/history includingP105–110 andpartialP084/P085 immutable;no activewrites"
|
||||
},
|
||||
"runtime_delta": {
|
||||
"resources/js/lib/iva-goods-allocation.ts": "6646a2054ebd4e6731b60719d36ce922ed50f2e062e0f980190eb20ce8c23d20",
|
||||
"resources/js/components/simulation-goods-allocation.tsx": "08c84f4b9af21e46cd9d5af6f6bee9e12c14b111438f1649a694a27f36d14180",
|
||||
"resources/js/components/simulation-monthly-iva.tsx": "1b27e8d3a6c79c6f8769bf5158ed8be45718f655b13cdf23b517bdb44c5a6951",
|
||||
"resources/js/lib/project-dossier.ts": "c5de565ff7ded1fcf4d1f3a025694d3e2af4ff75e55266463758e8c1c5fcc314"
|
||||
},
|
||||
"counts_current": {
|
||||
"delivered": 109,
|
||||
"QA": 2,
|
||||
"functional_pending": 21,
|
||||
"P001": 1,
|
||||
"total": 133
|
||||
},
|
||||
"homologation_unchanged": "63cc3367",
|
||||
"remaining": "OnejointGit delivery forP088/P124,freshbackup/realisolatedrestore,acceptedQA reused,installeddeltaonly. No individualbranch deployment.",
|
||||
"limits": "L1open;newdeduction/regularisationoutsideincrement;P00105/06;P121digital/P084/P085pending;beveragesL2/L3;Statistics/AIdeferred",
|
||||
"sources_inventory": "C:\\laragon\\www\\portal-investidor\\outputs\\iva-l1-goods-allocation-20261025\\source-archive-inventory.json",
|
||||
"qa_status_preserved": "QA_complete_not_delivered",
|
||||
"delivery_followup": {
|
||||
"served_commit": "6c12aabb3ac7f8296025a2af0408390bfe292bdb",
|
||||
"receipt": "l1-goods-allocation-delivery-20261025.json",
|
||||
"record": "iva_l1_goods_allocation_P088_P124_homologation_20261025",
|
||||
"counts": {
|
||||
"delivered": 111,
|
||||
"QA": 0,
|
||||
"functional_pending": 21,
|
||||
"documentary": 1,
|
||||
"total": 133
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,188 @@
|
||||
{
|
||||
"implementation_commit": "b0818c01633ed7eab7240fcec5fa4a0a87c15104",
|
||||
"status": "QA_complete_not_delivered",
|
||||
"coverage": {
|
||||
"AUD-SIM-L1-P092": [
|
||||
"reseller_margin"
|
||||
],
|
||||
"AUD-SIM-L1-P093": [
|
||||
"auction_margin"
|
||||
],
|
||||
"AUD-SIM-L1-P125": [
|
||||
"used_goods",
|
||||
"art",
|
||||
"collection",
|
||||
"antique"
|
||||
]
|
||||
},
|
||||
"branch_count": 3,
|
||||
"treatment_count": 2,
|
||||
"category_count": 4,
|
||||
"QA_example_count": 8,
|
||||
"shared_operations_not_double_counted": true,
|
||||
"source": "CIVA Lei13/2016:3(3)g/3(6),PDF7,p1426(265);15(2)f/g,PDF13,p1426(271). RIVA Decreto7/2008,BR16-I de16/04/2008,arts47–49,PDF8–9,p106–107. Lei22/2022 PDF3 mantém15f/g e fixa17(1)16%. Lei10/2025 não altera15/17 e revoga regimes35/42;referência antiga não os reactiva. Rectificação2017 sem alteração destas disposições.",
|
||||
"meaning": {
|
||||
"P092": "Revendedor: margem individual positiva da contraprestação total com IVA menos preço de compra justificado; dividir por 1.16 e arredondar a base à unidade. Perda conservada no bem, sem compensação entre transmissões. Opção pelo regime normal fica separada.",
|
||||
"P093": "Organizador em nome próprio por conta do comitente, contrato de comissão e venda em leilão: base = facturado ao comprador menos líquido do comitente menos IVA próprio identificado. Líquido = adjudicação menos comissão. IVA desconhecido não é zero.",
|
||||
"P125": "Classificação própria: bem usado reutilizável, arte, colecção ou antiguidade superior a 100 anos; critérios de 3(6) conservados. Categoria identificada não activa automaticamente a margem. Tiragem limitada a 200 exemplares e cerâmica única executada/assinada pelo artista nos percursos respectivos."
|
||||
},
|
||||
"scope": "2026/MZN,transmissões internas tributáveis e aquisição nacional com qualidade do fornecedor/comitente demonstrada. Duas fórmulas, quatro categorias, oito exemplos e três ramos; uma operação individual, sem dupla contagem. Apenas classificação/base:sem IVA calculado,nova dedução,campo11,regularização ou totaisModeloA. IVA identificado no leilão é componente referenciada. Exportação isenta e opção normal separadas; origens legadas35/42 permanecem indeterminadas.",
|
||||
"technical_choices": "regulatedSecondhands por oportunidade no snapshot/API/dossier existentes;BigInt com6casas,sem float;arredondamento à unidade mais próxima,empate para cima como escolha técnica explícita;troca conserva campos/referências e exige rever confirmações.Nenhum certificado/aprovador inventado. Prazo49(6)/(7) de5dias úteis identificado,sem calendário de feriados presumido.",
|
||||
"verification": {
|
||||
"frontend": {
|
||||
"tests": 11,
|
||||
"passed": 11,
|
||||
"failed": 0,
|
||||
"coverage": "8 combinações regime/categoria;ausência de factos/referências;opção normal;origem nacional/elegibilidade;limites de tiragem/idade;perdas/arredondamento;trocadecategoria;persistência,histórico,relatório e preservação integral"
|
||||
},
|
||||
"privateAPI": {
|
||||
"tests": 1,
|
||||
"assertions": 35,
|
||||
"target": "simulator_fiscal_delta_20261021_test:55441",
|
||||
"transaction_rollback": true,
|
||||
"xml": "C:\\laragon\\www\\portal-investidor\\outputs\\iva-l1-secondhand-20261025\\phpunit.xml"
|
||||
},
|
||||
"types": "passed",
|
||||
"build": "passed;existing plugin timing warnings",
|
||||
"UI": "Edge/CUA,componente real:preço compra vazio mantém classificação mas base indeterminada;venda900/compra1000 conserva perda100 ebase0semcompensaroutrosbens;restauro1160/1000base138;gravação/recuperação/relatório8operações,4versõesanteriores,bases138.00x4/344.83x4,IVA/taxanull. Dados sintéticos,não aceitação manual da Tempo.",
|
||||
"UI_screenshot": "C:\\laragon\\www\\portal-investidor\\outputs\\iva-l1-secondhand-20261025\\qa-recovered-report.png"
|
||||
},
|
||||
"preservation": {
|
||||
"base": "ec786f4ae2eb25d9a21cdc46dc883efcf8fb8c02",
|
||||
"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-P088",
|
||||
"AUD-SIM-L1-P089",
|
||||
"AUD-SIM-L1-P090",
|
||||
"AUD-SIM-L1-P091",
|
||||
"AUD-SIM-L1-P094",
|
||||
"AUD-SIM-L1-P095",
|
||||
"AUD-SIM-L1-P096",
|
||||
"AUD-SIM-L1-P097",
|
||||
"AUD-SIM-L1-P098",
|
||||
"AUD-SIM-L1-P099",
|
||||
"AUD-SIM-L1-P100",
|
||||
"AUD-SIM-L1-P101",
|
||||
"AUD-SIM-L1-P102",
|
||||
"AUD-SIM-L1-P103",
|
||||
"AUD-SIM-L1-P105",
|
||||
"AUD-SIM-L1-P106",
|
||||
"AUD-SIM-L1-P107",
|
||||
"AUD-SIM-L1-P108",
|
||||
"AUD-SIM-L1-P109",
|
||||
"AUD-SIM-L1-P110",
|
||||
"AUD-SIM-L1-P111",
|
||||
"AUD-SIM-L1-P112",
|
||||
"AUD-SIM-L1-P113",
|
||||
"AUD-SIM-L1-P114",
|
||||
"AUD-SIM-L1-P115",
|
||||
"AUD-SIM-L1-P116",
|
||||
"AUD-SIM-L1-P117",
|
||||
"AUD-SIM-L1-P118",
|
||||
"AUD-SIM-L1-P119",
|
||||
"AUD-SIM-L1-P120",
|
||||
"AUD-SIM-L1-P122",
|
||||
"AUD-SIM-L1-P124",
|
||||
"AUD-SIM-L1-P128"
|
||||
],
|
||||
"confirmed_losses": [],
|
||||
"accepted_delivery": "6c12aabb/ec786f4a;174tables/369files;29published/28relations/408geometries;code/schema/data/config/permissions compared",
|
||||
"frozen": "tests\\frontend\\fixtures\\iva-secondhand-preserved.json",
|
||||
"sha256": "f3616dc0b3a333128d08679e0e0949fa3cc425290db8e46bd4f563198f7f8e07",
|
||||
"scope": "P092/P093/P125QA;all priorbooks/history includingP105–110 andpartialP084/P085 immutable;no activewrites"
|
||||
},
|
||||
"runtime_delta": {
|
||||
"resources/js/lib/iva-secondhand.ts": "de9cab0f8685c0be1072ce0b8b5ae98865383fa52f4487ecb62514ddb28d6fdc",
|
||||
"resources/js/components/simulation-secondhand.tsx": "7a715a05635137d3b7b8a1eb3d554646c4553430904613235199fc6a254cec20",
|
||||
"resources/js/components/simulation-monthly-iva.tsx": "338d5c4b9b60b2be6b3f059c543c92127222f621424854cba9a19651d86d2967",
|
||||
"resources/js/lib/project-dossier.ts": "fe0b12b2acc5d1a59c862abf6c96e2e09c51193fc2e090e475dc0ec8673e23c9"
|
||||
},
|
||||
"counts_current": {
|
||||
"delivered": 111,
|
||||
"QA": 3,
|
||||
"functional_pending": 18,
|
||||
"P001": 1,
|
||||
"total": 133
|
||||
},
|
||||
"homologation_unchanged": "6c12aabb",
|
||||
"remaining": "Uma entrega conjunta P092/P093/P125 pelo processoGit;backup/restauro isolado fresco e conferência apenas do delta instalado,reutilizando estas provas.",
|
||||
"limits": "L1aberto;P00105/06;P121digital/P084/P085pendentes;bebidasL2/L3;Estatísticas/IAadiadas",
|
||||
"sources_inventory": "C:\\laragon\\www\\portal-investidor\\outputs\\iva-l1-secondhand-20261025\\source-archive-inventory.json"
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"status": "ready_after_fresh_authenticated_preflight_and_verified_backup_restore",
|
||||
"status": "installed_delta_verified_partial_L1",
|
||||
"candidate": "af7d2503207c8744cdbb6d96b8cca89fa367384e",
|
||||
"base_installed": "2fdca86367d8bad524113b4cf6c49a0110130be9",
|
||||
"coverage_complete_branches": {
|
||||
@@ -40,8 +40,8 @@
|
||||
"total": 133
|
||||
},
|
||||
"counts_current": {
|
||||
"delivered": 107,
|
||||
"QA": 2,
|
||||
"delivered": 109,
|
||||
"QA": 0,
|
||||
"functional_pending": 23,
|
||||
"documentary": 1,
|
||||
"total": 133
|
||||
@@ -132,5 +132,192 @@
|
||||
"source_dump_sha256": "85e90033b54a7eb7fed1bf0de466b984f5c03cc3b4938b5d8db20b7bf0abf954",
|
||||
"active_database_writes": 0
|
||||
}
|
||||
}
|
||||
},
|
||||
"delivery_local_date": "2026-10-25",
|
||||
"delivery_timezone": "Africa/Johannesburg",
|
||||
"served_commit": "63cc336787cade92fb7ee5b2b2d407308a0cf66b",
|
||||
"installation": {
|
||||
"protected": {
|
||||
"installed": {
|
||||
"status": "installed",
|
||||
"commit": "63cc336787cade92fb7ee5b2b2d407308a0cf66b",
|
||||
"release": "/var/www/investmoz-homologacao/releases/63cc336787cade92fb7ee5b2b2d407308a0cf66b-a32af166",
|
||||
"previous_release": "/var/www/investmoz-homologacao/releases/2fdca86367d8bad524113b4cf6c49a0110130be9-c65ebbad",
|
||||
"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": "0533965406197091e01442f39b006a04"
|
||||
},
|
||||
"after": {
|
||||
"rows": 106,
|
||||
"checksum": "690fff122d6fc745c2e2ab9bd28732aa"
|
||||
}
|
||||
},
|
||||
"sessions": {
|
||||
"before": {
|
||||
"rows": 93,
|
||||
"checksum": "d97f35b74199225940dea7078a712474"
|
||||
},
|
||||
"after": {
|
||||
"rows": 94,
|
||||
"checksum": "def210abad7e8e9b838f9490594fb787"
|
||||
}
|
||||
}
|
||||
},
|
||||
"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": "63cc336787cade92fb7ee5b2b2d407308a0cf66b",
|
||||
"branch": "main",
|
||||
"built_at": "2026-10-24T22:09:58.694541+00:00",
|
||||
"manifest_sha256": "40f4377487ec290e47d1bee92146172fa4e2a316fa4a072dcc82300fea3cc6c1"
|
||||
},
|
||||
"manifest_hash_matches": true,
|
||||
"compiled_delta_markers": {
|
||||
"own-name-chains/1": [
|
||||
"assets/project-dossier-Ct_yYLqe.js"
|
||||
],
|
||||
"goods_sale_commission": [
|
||||
"assets/project-dossier-Ct_yYLqe.js"
|
||||
],
|
||||
"goods_purchase_commission": [
|
||||
"assets/project-dossier-Ct_yYLqe.js"
|
||||
],
|
||||
"service_sale_mandate": [
|
||||
"assets/project-dossier-Ct_yYLqe.js"
|
||||
],
|
||||
"service_purchase_mandate": [
|
||||
"assets/project-dossier-Ct_yYLqe.js"
|
||||
],
|
||||
"ownNames": [
|
||||
"assets/project-dossier-Ct_yYLqe.js"
|
||||
],
|
||||
"ownName": [
|
||||
"assets/project-dossier-Ct_yYLqe.js"
|
||||
],
|
||||
"forAnother": [
|
||||
"assets/project-dossier-Ct_yYLqe.js"
|
||||
],
|
||||
"commissionContract": [
|
||||
"assets/project-dossier-Ct_yYLqe.js"
|
||||
],
|
||||
"successiveService": [
|
||||
"assets/project-dossier-Ct_yYLqe.js"
|
||||
],
|
||||
"directionConfirmed": [
|
||||
"assets/project-dossier-Ct_yYLqe.js"
|
||||
],
|
||||
"firstAmount": [
|
||||
"assets/services-BoK-jPgg.js",
|
||||
"assets/project-dossier-Ct_yYLqe.js"
|
||||
],
|
||||
"secondAmount": [
|
||||
"assets/services-BoK-jPgg.js",
|
||||
"assets/project-dossier-Ct_yYLqe.js"
|
||||
],
|
||||
"firstLegRef": [
|
||||
"assets/services-BoK-jPgg.js",
|
||||
"assets/project-dossier-Ct_yYLqe.js"
|
||||
],
|
||||
"secondLegRef": [
|
||||
"assets/services-BoK-jPgg.js",
|
||||
"assets/project-dossier-Ct_yYLqe.js"
|
||||
],
|
||||
"existingBaseRef": [
|
||||
"assets/services-BoK-jPgg.js",
|
||||
"assets/project-dossier-Ct_yYLqe.js"
|
||||
],
|
||||
"IVA: Indeterminado": [
|
||||
"assets/project-dossier-Ct_yYLqe.js"
|
||||
]
|
||||
},
|
||||
"assets": [
|
||||
{
|
||||
"file": "assets/simulation-form-CPZAFZU3.js",
|
||||
"status": 200,
|
||||
"sha256": "c6bcf64e60a5eeac0cafe3dc055dc5544162f21942ee08b34d51bc6d52947567"
|
||||
},
|
||||
{
|
||||
"file": "assets/services-BoK-jPgg.js",
|
||||
"status": 200,
|
||||
"sha256": "df86ebec3aad6060cc563343ddc3010d330fcd8b89e21db9861c042dbadb3317"
|
||||
},
|
||||
{
|
||||
"file": "assets/project-dossier-document-DTNvmcJB.js",
|
||||
"status": 200,
|
||||
"sha256": "e961e77528e9c18681f133dd6e332202f48783bb0f9373117aac8aa83a0653b3"
|
||||
},
|
||||
{
|
||||
"file": "assets/project-dossier-Ct_yYLqe.js",
|
||||
"status": 200,
|
||||
"sha256": "db9b14435dccf65e83555e2517b939e0bc05a31782996abffe6d7b29b901ea47"
|
||||
}
|
||||
],
|
||||
"simulator_status": 200,
|
||||
"simulator_entry": "assets/app-dGCxtIbq.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": "63cc336787cade92fb7ee5b2b2d407308a0cf66b",
|
||||
"release": "/var/www/investmoz-homologacao/releases/63cc336787cade92fb7ee5b2b2d407308a0cf66b-a32af166",
|
||||
"previous_release": "/var/www/investmoz-homologacao/releases/2fdca86367d8bad524113b4cf6c49a0110130be9-c65ebbad",
|
||||
"database_migrations": 0,
|
||||
"content_imports": 0
|
||||
},
|
||||
"latest_report": {
|
||||
"status": "installed",
|
||||
"commit": "63cc336787cade92fb7ee5b2b2d407308a0cf66b",
|
||||
"release": "/var/www/investmoz-homologacao/releases/63cc336787cade92fb7ee5b2b2d407308a0cf66b-a32af166",
|
||||
"previous_release": "/var/www/investmoz-homologacao/releases/2fdca86367d8bad524113b4cf6c49a0110130be9-c65ebbad",
|
||||
"database_migrations": 0,
|
||||
"content_imports": 0,
|
||||
"requested_commits": [
|
||||
"63cc336787cade92fb7ee5b2b2d407308a0cf66b"
|
||||
],
|
||||
"finished_at": "2026-10-24T22:10:01.647328+00:00"
|
||||
},
|
||||
"log_file": "1792879692780810651.log",
|
||||
"summaries": [
|
||||
"OK (1 test, 3106 assertions)",
|
||||
"built in 27.93s",
|
||||
"OK (59 tests, 317 assertions)",
|
||||
"# tests 413",
|
||||
"# pass 413",
|
||||
"# fail 0"
|
||||
],
|
||||
"log_bytes": 146997
|
||||
},
|
||||
"rollback_executed": false
|
||||
},
|
||||
"base_VAT_separation": "AcceptedQA reused:P122goods sale/purchasecommission3(3)c andP128services sale/purchasemandate4(3). Agent ownname andforanother,parties/contract/object/period/two relations explicit. Originalconsiderations separated,never summed/netted/converted or usedasautomaticbase. P091anditsbooks/history preserved,not recalculated. No territoriality/exemption/base/rate/VAT/deductionfield11 or ModeloAtotals activated. Four installedruntimehashes/17compiledmarkers;107previousclosures preserved;no syntheticactivewrites.",
|
||||
"activation": "OnejointGit fast-forward/webhook/installer;zero migrations/imports"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,346 @@
|
||||
{
|
||||
"status": "installed_delta_verified_partial_L1",
|
||||
"candidate": "cd259623aed6e8831091866de02d5e5db4ef1818",
|
||||
"base_installed": "63cc336787cade92fb7ee5b2b2d407308a0cf66b",
|
||||
"coverage_complete_branches": {
|
||||
"AUD-SIM-L1-P088": [
|
||||
"permanent_private_goods",
|
||||
"free_goods_transfer",
|
||||
"exempt_sector_goods",
|
||||
"fixed_asset_20a"
|
||||
],
|
||||
"AUD-SIM-L1-P124": [
|
||||
"permanent_private_goods",
|
||||
"free_goods_transfer",
|
||||
"exempt_sector_goods",
|
||||
"fixed_asset_20a"
|
||||
]
|
||||
},
|
||||
"branch_count_complete": 2,
|
||||
"treatment_count": 4,
|
||||
"runtime_delta": [
|
||||
{
|
||||
"path": "resources/js/lib/iva-goods-allocation.ts",
|
||||
"sha256_LF": "6646a2054ebd4e6731b60719d36ce922ed50f2e062e0f980190eb20ce8c23d20"
|
||||
},
|
||||
{
|
||||
"path": "resources/js/components/simulation-goods-allocation.tsx",
|
||||
"sha256_LF": "08c84f4b9af21e46cd9d5af6f6bee9e12c14b111438f1649a694a27f36d14180"
|
||||
},
|
||||
{
|
||||
"path": "resources/js/components/simulation-monthly-iva.tsx",
|
||||
"sha256_LF": "1b27e8d3a6c79c6f8769bf5158ed8be45718f655b13cdf23b517bdb44c5a6951"
|
||||
},
|
||||
{
|
||||
"path": "resources/js/lib/project-dossier.ts",
|
||||
"sha256_LF": "c5de565ff7ded1fcf4d1f3a025694d3e2af4ff75e55266463758e8c1c5fcc314"
|
||||
}
|
||||
],
|
||||
"counts_before": {
|
||||
"delivered": 109,
|
||||
"QA": 2,
|
||||
"functional_pending": 21,
|
||||
"documentary": 1,
|
||||
"total": 133
|
||||
},
|
||||
"counts_current": {
|
||||
"delivered": 111,
|
||||
"QA": 0,
|
||||
"functional_pending": 21,
|
||||
"documentary": 1,
|
||||
"total": 133
|
||||
},
|
||||
"counts_after_delivery": {
|
||||
"delivered": 111,
|
||||
"QA": 0,
|
||||
"functional_pending": 21,
|
||||
"documentary": 1,
|
||||
"total": 133
|
||||
},
|
||||
"QA_proofs_reused": [
|
||||
"iva-l1-goods-allocation-qa-20261025.json"
|
||||
],
|
||||
"authorization": "Tempo explicitly requests one joint delivery ofcd259623,P088/P124,main compatibility/concurrent changes preserved,installeddelta only",
|
||||
"scope": "2026/MZN,quatro tratamentos partilhados entre dois requisitos sobre a mesma operação,registada uma vez. Distinto de uso temporário de bens como serviçoP089. Sem nova dedução/campo11,regularização,taxaIVA,IVA ou totaisModeloA;dedução anterior apenas facto histórico. Excepçãoamostras/ofertas fica fora deste percurso quando aplicável;desconhecido permanece indeterminado.",
|
||||
"source": "CIVA3(3)e/f,Lei13/2016PDF6–7/p1426(264–265);15(2)b,PDF13/p1426(271);20(1)a,PDF15/p1426(273). Lei22/2022PDF3mantém15(2)b e20(1)a;Lei10/2025PDF12mantém3(3)e/f e não altera15/20.",
|
||||
"meaning": {
|
||||
"P124": "Classificação da afectação permanente de bens a uso próprio/particular/alheio,transmissão gratuita,afectação a sector isento ou aoactivo imobilizado de bens20(1)a. Exige dedução anterior total/parcial nos bens/elementos;em3e conferir excepção de amostras/ofertas depequeno valor,sem limiar inventado. Facto histórico de dedução,não nova dedução.",
|
||||
"P088": "Base15(2)b:preço aquisição ou,na sua falta demonstrada,preço custo,reportados ao momento da operação. ClassificaçãoP124 pode estar identificada ebaseP088 indeterminada;sem custo por defeito para preço aquisição desconhecido."
|
||||
},
|
||||
"formula": "15(2)b:current acquisitionprice;only if absent,currentcost.No automaticvaluation/update/depreciation/deduction.",
|
||||
"preservation": "109prior closures and partialP084/P085 preserved;accepted perbranchQA reused;one integration/backup/real isolatedrestore/check for whole set",
|
||||
"partial_P084_P085": "Preparation/conditional simulation only,benefits pending;no closure",
|
||||
"limits": "L1open;newdeduction/regularisationoutsideincrement;P00105/06;P121digital/P084/P085pending;beveragesL2/L3;Statistics/AIdeferred",
|
||||
"containment": "l1-goods-allocation-readonly-rollback-20261025.patch,checked only,not applied;blocks newP096–099classifications,preserves readers/history/otherbranches",
|
||||
"authenticated_preflight": {
|
||||
"installed": {
|
||||
"status": "installed",
|
||||
"commit": "63cc336787cade92fb7ee5b2b2d407308a0cf66b",
|
||||
"release": "/var/www/investmoz-homologacao/releases/63cc336787cade92fb7ee5b2b2d407308a0cf66b-a32af166",
|
||||
"previous_release": "/var/www/investmoz-homologacao/releases/2fdca86367d8bad524113b4cf6c49a0110130be9-c65ebbad",
|
||||
"database_migrations": 0,
|
||||
"content_imports": 0
|
||||
},
|
||||
"current_link": "/var/www/investmoz-homologacao/releases/63cc336787cade92fb7ee5b2b2d407308a0cf66b-a32af166",
|
||||
"release_revision": {
|
||||
"commit": "63cc336787cade92fb7ee5b2b2d407308a0cf66b",
|
||||
"branch": "main",
|
||||
"built_at": "2026-10-24T22:09:58.694541+00:00",
|
||||
"manifest_sha256": "40f4377487ec290e47d1bee92146172fa4e2a316fa4a072dcc82300fea3cc6c1"
|
||||
},
|
||||
"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-goods-allocation-delivery-20261025/backup",
|
||||
"target": {
|
||||
"database": "teste_investidor",
|
||||
"port": 5432
|
||||
},
|
||||
"tables": 174,
|
||||
"files_verified": 369,
|
||||
"dump_sha256": "a78973a94e05f58ab4cea4bebedca4603d7f68aa4a0d8a46b889d27751514e64",
|
||||
"files_sha256": "9302d0e283a5ea2619de1fbe5853d4c2e563d455d7aafb7e88203eafc6ef85e1",
|
||||
"restore_verified": false
|
||||
},
|
||||
"restore": {
|
||||
"restore_verified": true,
|
||||
"tables_verified": 174,
|
||||
"container_network": "none",
|
||||
"database": "l1_goods_allocation_restore_20261024",
|
||||
"port": 55441,
|
||||
"source_dump_sha256": "a78973a94e05f58ab4cea4bebedca4603d7f68aa4a0d8a46b889d27751514e64",
|
||||
"active_database_writes": 0
|
||||
}
|
||||
},
|
||||
"delivery_local_date": "2026-10-25",
|
||||
"delivery_timezone": "Africa/Johannesburg",
|
||||
"served_commit": "6c12aabb3ac7f8296025a2af0408390bfe292bdb",
|
||||
"installation": {
|
||||
"protected": {
|
||||
"installed": {
|
||||
"status": "installed",
|
||||
"commit": "6c12aabb3ac7f8296025a2af0408390bfe292bdb",
|
||||
"release": "/var/www/investmoz-homologacao/releases/6c12aabb3ac7f8296025a2af0408390bfe292bdb-4c33615a",
|
||||
"previous_release": "/var/www/investmoz-homologacao/releases/63cc336787cade92fb7ee5b2b2d407308a0cf66b-a32af166",
|
||||
"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": "09d3d422c9a8be947a5b477dbee30bb4"
|
||||
},
|
||||
"after": {
|
||||
"rows": 106,
|
||||
"checksum": "898f63b7cbe166244f5a4ea6d0803cb2"
|
||||
}
|
||||
},
|
||||
"sessions": {
|
||||
"before": {
|
||||
"rows": 96,
|
||||
"checksum": "375984b4326c2b632b66fba47946b8c8"
|
||||
},
|
||||
"after": {
|
||||
"rows": 97,
|
||||
"checksum": "acfde110c5f28d239ee13f14da01e6b7"
|
||||
}
|
||||
}
|
||||
},
|
||||
"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": "6c12aabb3ac7f8296025a2af0408390bfe292bdb",
|
||||
"branch": "main",
|
||||
"built_at": "2026-10-24T22:19:07.102372+00:00",
|
||||
"manifest_sha256": "91a95647c3666b2dc9a322fbf7534e055c616872c791920d2cc004234c1b0d25"
|
||||
},
|
||||
"manifest_hash_matches": true,
|
||||
"compiled_delta_markers": {
|
||||
"goods-allocation-base/1": [
|
||||
"assets/project-dossier-Dnh3xPdC.js"
|
||||
],
|
||||
"permanent_private_goods": [
|
||||
"assets/services-B0mFnttq.js",
|
||||
"assets/project-dossier-Dnh3xPdC.js"
|
||||
],
|
||||
"free_goods_transfer": [
|
||||
"assets/services-B0mFnttq.js",
|
||||
"assets/project-dossier-Dnh3xPdC.js"
|
||||
],
|
||||
"exempt_sector_goods": [
|
||||
"assets/project-dossier-Dnh3xPdC.js"
|
||||
],
|
||||
"fixed_asset_20a": [
|
||||
"assets/services-B0mFnttq.js",
|
||||
"assets/project-dossier-Dnh3xPdC.js"
|
||||
],
|
||||
"regulatedGoodsAllocations": [
|
||||
"assets/project-dossier-Dnh3xPdC.js"
|
||||
],
|
||||
"priorDeduction": [
|
||||
"assets/project-dossier-Dnh3xPdC.js"
|
||||
],
|
||||
"deductionRef": [
|
||||
"assets/services-B0mFnttq.js",
|
||||
"assets/project-dossier-Dnh3xPdC.js"
|
||||
],
|
||||
"acquisitionPrice": [
|
||||
"assets/services-B0mFnttq.js",
|
||||
"assets/project-dossier-Dnh3xPdC.js"
|
||||
],
|
||||
"acquisitionRef": [
|
||||
"assets/services-B0mFnttq.js",
|
||||
"assets/project-dossier-Dnh3xPdC.js"
|
||||
],
|
||||
"currentCost": [
|
||||
"assets/services-B0mFnttq.js",
|
||||
"assets/project-dossier-Dnh3xPdC.js"
|
||||
],
|
||||
"costRef": [
|
||||
"assets/services-B0mFnttq.js",
|
||||
"assets/project-dossier-Dnh3xPdC.js"
|
||||
],
|
||||
"valuationMode": [
|
||||
"assets/services-B0mFnttq.js",
|
||||
"assets/project-dossier-Dnh3xPdC.js"
|
||||
],
|
||||
"valuationConfirmed": [
|
||||
"assets/services-B0mFnttq.js",
|
||||
"assets/project-dossier-Dnh3xPdC.js"
|
||||
],
|
||||
"acquisitionUnavailable": [
|
||||
"assets/services-B0mFnttq.js",
|
||||
"assets/project-dossier-Dnh3xPdC.js"
|
||||
],
|
||||
"valuationScope": [
|
||||
"assets/services-B0mFnttq.js",
|
||||
"assets/project-dossier-Dnh3xPdC.js"
|
||||
],
|
||||
"valuationDate": [
|
||||
"assets/services-B0mFnttq.js",
|
||||
"assets/project-dossier-Dnh3xPdC.js"
|
||||
],
|
||||
"asset20aRef": [
|
||||
"assets/services-B0mFnttq.js",
|
||||
"assets/project-dossier-Dnh3xPdC.js"
|
||||
],
|
||||
"exceptionRef": [
|
||||
"assets/services-B0mFnttq.js",
|
||||
"assets/project-dossier-Dnh3xPdC.js"
|
||||
],
|
||||
"IVA: Indeterminado": [
|
||||
"assets/project-dossier-Dnh3xPdC.js"
|
||||
]
|
||||
},
|
||||
"assets": [
|
||||
{
|
||||
"file": "assets/services-B0mFnttq.js",
|
||||
"status": 200,
|
||||
"sha256": "8e586f10c4efa6ad9805ed75ba0c21f68b1550d9a697959b5f51c966b40ace45"
|
||||
},
|
||||
{
|
||||
"file": "assets/project-dossier-Dnh3xPdC.js",
|
||||
"status": 200,
|
||||
"sha256": "a02b40fbbafa16651af80f74b6d0486b8fb086b404151bcf1a25690252138d40"
|
||||
},
|
||||
{
|
||||
"file": "assets/simulation-form-CPZAFZU3.js",
|
||||
"status": 200,
|
||||
"sha256": "c6bcf64e60a5eeac0cafe3dc055dc5544162f21942ee08b34d51bc6d52947567"
|
||||
},
|
||||
{
|
||||
"file": "assets/project-dossier-document-Cb9azkcP.js",
|
||||
"status": 200,
|
||||
"sha256": "08aa7a6c7f2b78ddfdd69b51c355f186b6811171bd702275bf76fe3369aa87d9"
|
||||
}
|
||||
],
|
||||
"simulator_status": 200,
|
||||
"simulator_entry": "assets/app-Cy6kCwzN.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": "6c12aabb3ac7f8296025a2af0408390bfe292bdb",
|
||||
"release": "/var/www/investmoz-homologacao/releases/6c12aabb3ac7f8296025a2af0408390bfe292bdb-4c33615a",
|
||||
"previous_release": "/var/www/investmoz-homologacao/releases/63cc336787cade92fb7ee5b2b2d407308a0cf66b-a32af166",
|
||||
"database_migrations": 0,
|
||||
"content_imports": 0
|
||||
},
|
||||
"latest_report": {
|
||||
"status": "installed",
|
||||
"commit": "6c12aabb3ac7f8296025a2af0408390bfe292bdb",
|
||||
"release": "/var/www/investmoz-homologacao/releases/6c12aabb3ac7f8296025a2af0408390bfe292bdb-4c33615a",
|
||||
"previous_release": "/var/www/investmoz-homologacao/releases/63cc336787cade92fb7ee5b2b2d407308a0cf66b-a32af166",
|
||||
"database_migrations": 0,
|
||||
"content_imports": 0,
|
||||
"requested_commits": [
|
||||
"6c12aabb3ac7f8296025a2af0408390bfe292bdb"
|
||||
],
|
||||
"finished_at": "2026-10-24T22:19:10.041371+00:00"
|
||||
},
|
||||
"log_file": "1792880241239958545.log",
|
||||
"summaries": [
|
||||
"OK (1 test, 3106 assertions)",
|
||||
"built in 26.70s",
|
||||
"OK (59 tests, 317 assertions)",
|
||||
"# tests 420",
|
||||
"# pass 420",
|
||||
"# fail 0"
|
||||
],
|
||||
"log_bytes": 148552
|
||||
},
|
||||
"rollback_executed": false
|
||||
},
|
||||
"base_VAT_separation": "AcceptedQA reused:P124assimilatedgoods classification3(3)e/f andP088base15(2)b,four sharedtreatments,one operationidentity. Prior total/partialdeduction is historicalfact ongoods/elements,not newdeduction/field11 orregularisation. Base=currentacquisitionprice;currentcostonlyin demonstratedabsence ofacquisitionprice. Unknownfallback retainsclassification withindeterminatebase;unknownhistoricaldeduction leavesclassificationindeterminate. No tax/IVA/regularisationcalculated. Fourinstalledruntimehashes/20compiledmarkers;109priorclosures preserved;no syntheticactivewrites.",
|
||||
"activation": "OnejointGit fast-forward/webhook/installer;zero migrations/imports"
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
--- a/resources/js/lib/iva-goods-allocation.ts
|
||||
+++ b/resources/js/lib/iva-goods-allocation.ts
|
||||
@@ -55,6 +55,7 @@
|
||||
function key(draft:Record<string,unknown>,book:GoodsAllocationBook):string{return JSON.stringify({version:goodsAllocationVersion,scope:acquisitionScope(draft),location:draft.selection_labels??{},currency:draft.currency,rows:book.rows});}
|
||||
export function goodsAllocationCurrent(draft:Record<string,unknown>,book:GoodsAllocationBook):boolean{return!!book.result&&book.result.sourceKey===key(draft,book);}
|
||||
export function recordGoodsAllocations(draft:Record<string,unknown>,book:GoodsAllocationBook):GoodsAllocationBook{
|
||||
+ throw new Error('Novas classificações P088/P124 temporariamente suspensas; dados, histórico, relatórios e restantes ramos preservados.');
|
||||
if(!book.rows.length||new Set(book.rows.map(row=>row.id)).size!==book.rows.length)throw new Error('Indique operações com identificadores distintos;originais conservados.');
|
||||
const result:GoodsAllocationCalculation={version:goodsAllocationVersion,revision:(book.result?.revision??0)+1,calculatedAt:new Date().toISOString(),opportunity:acquisitionScope(draft),location:JSON.stringify(draft.selection_labels??{}),sourceKey:key(draft,book),source:goodsAllocationSource,inputs:structuredClone(book.rows),rows:book.rows.map(row=>evaluateGoodsAllocation(row,draft.currency))};
|
||||
const next={...book,result,history:[...(book.history??[]),...(book.result?[book.result]:[])]};saveGoodsAllocationBook(draft,next);return next;
|
||||
@@ -0,0 +1,143 @@
|
||||
{
|
||||
"status": "ready_after_fresh_authenticated_preflight_and_verified_backup_restore",
|
||||
"candidate": "0ebb20c86a8cfcee9fae56c38f6bfdc6b2ab80ab",
|
||||
"base_installed": "6c12aabb3ac7f8296025a2af0408390bfe292bdb",
|
||||
"coverage_complete_branches": {
|
||||
"AUD-SIM-L1-P092": [
|
||||
"reseller_margin"
|
||||
],
|
||||
"AUD-SIM-L1-P093": [
|
||||
"auction_margin"
|
||||
],
|
||||
"AUD-SIM-L1-P125": [
|
||||
"used_goods",
|
||||
"art",
|
||||
"collection",
|
||||
"antique"
|
||||
]
|
||||
},
|
||||
"branch_count_complete": 3,
|
||||
"treatment_count": 2,
|
||||
"category_count": 4,
|
||||
"QA_example_count": 8,
|
||||
"runtime_delta": [
|
||||
{
|
||||
"path": "resources/js/lib/iva-secondhand.ts",
|
||||
"sha256_LF": "de9cab0f8685c0be1072ce0b8b5ae98865383fa52f4487ecb62514ddb28d6fdc"
|
||||
},
|
||||
{
|
||||
"path": "resources/js/components/simulation-secondhand.tsx",
|
||||
"sha256_LF": "7a715a05635137d3b7b8a1eb3d554646c4553430904613235199fc6a254cec20"
|
||||
},
|
||||
{
|
||||
"path": "resources/js/components/simulation-monthly-iva.tsx",
|
||||
"sha256_LF": "338d5c4b9b60b2be6b3f059c543c92127222f621424854cba9a19651d86d2967"
|
||||
},
|
||||
{
|
||||
"path": "resources/js/lib/project-dossier.ts",
|
||||
"sha256_LF": "fe0b12b2acc5d1a59c862abf6c96e2e09c51193fc2e090e475dc0ec8673e23c9"
|
||||
}
|
||||
],
|
||||
"counts_before": {
|
||||
"delivered": 111,
|
||||
"QA": 3,
|
||||
"functional_pending": 18,
|
||||
"documentary": 1,
|
||||
"total": 133
|
||||
},
|
||||
"counts_current": {
|
||||
"delivered": 111,
|
||||
"QA": 3,
|
||||
"functional_pending": 18,
|
||||
"documentary": 1,
|
||||
"total": 133
|
||||
},
|
||||
"counts_after_delivery": {
|
||||
"delivered": 114,
|
||||
"QA": 0,
|
||||
"functional_pending": 18,
|
||||
"documentary": 1,
|
||||
"total": 133
|
||||
},
|
||||
"QA_proofs_reused": [
|
||||
"iva-l1-secondhand-qa-20261025.json"
|
||||
],
|
||||
"authorization": "Tempo explicitly requests one joint delivery of0ebb20c8,P092/P093/P125,preserving concurrent changes and installeddelta only",
|
||||
"scope": "2026/MZN,transmissões internas tributáveis e aquisição nacional com qualidade do fornecedor/comitente demonstrada. Duas fórmulas, quatro categorias, oito exemplos e três ramos; uma operação individual, sem dupla contagem. Apenas classificação/base:sem IVA calculado,nova dedução,campo11,regularização ou totaisModeloA. IVA identificado no leilão é componente referenciada. Exportação isenta e opção normal separadas; origens legadas35/42 permanecem indeterminadas.",
|
||||
"source": "CIVA Lei13/2016:3(3)g/3(6),PDF7,p1426(265);15(2)f/g,PDF13,p1426(271). RIVA Decreto7/2008,BR16-I de16/04/2008,arts47–49,PDF8–9,p106–107. Lei22/2022 PDF3 mantém15f/g e fixa17(1)16%. Lei10/2025 não altera15/17 e revoga regimes35/42;referência antiga não os reactiva. Rectificação2017 sem alteração destas disposições.",
|
||||
"meaning": {
|
||||
"P092": "Revendedor: margem individual positiva da contraprestação total com IVA menos preço de compra justificado; dividir por 1.16 e arredondar a base à unidade. Perda conservada no bem, sem compensação entre transmissões. Opção pelo regime normal fica separada.",
|
||||
"P093": "Organizador em nome próprio por conta do comitente, contrato de comissão e venda em leilão: base = facturado ao comprador menos líquido do comitente menos IVA próprio identificado. Líquido = adjudicação menos comissão. IVA desconhecido não é zero.",
|
||||
"P125": "Classificação própria: bem usado reutilizável, arte, colecção ou antiguidade superior a 100 anos; critérios de 3(6) conservados. Categoria identificada não activa automaticamente a margem. Tiragem limitada a 200 exemplares e cerâmica única executada/assinada pelo artista nos percursos respectivos."
|
||||
},
|
||||
"classification_margin_separation": "P125 classifies goods;P092/P093 independently require eligible supplier/principal,territorial and regimeconditions;no automaticmargineligibility",
|
||||
"preservation": "111priorclosures 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-secondhand-readonly-rollback-20261025.patch,checked only,not applied;blocks newP092/P093/P125calculations,preserves readers/history/otherbranches",
|
||||
"authenticated_preflight": {
|
||||
"installed": {
|
||||
"status": "installed",
|
||||
"commit": "6c12aabb3ac7f8296025a2af0408390bfe292bdb",
|
||||
"release": "/var/www/investmoz-homologacao/releases/6c12aabb3ac7f8296025a2af0408390bfe292bdb-4c33615a",
|
||||
"previous_release": "/var/www/investmoz-homologacao/releases/63cc336787cade92fb7ee5b2b2d407308a0cf66b-a32af166",
|
||||
"database_migrations": 0,
|
||||
"content_imports": 0
|
||||
},
|
||||
"current_link": "/var/www/investmoz-homologacao/releases/6c12aabb3ac7f8296025a2af0408390bfe292bdb-4c33615a",
|
||||
"release_revision": {
|
||||
"commit": "6c12aabb3ac7f8296025a2af0408390bfe292bdb",
|
||||
"branch": "main",
|
||||
"built_at": "2026-10-24T22:19:07.102372+00:00",
|
||||
"manifest_sha256": "91a95647c3666b2dc9a322fbf7534e055c616872c791920d2cc004234c1b0d25"
|
||||
},
|
||||
"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-secondhand-delivery-20261025/backup",
|
||||
"target": {
|
||||
"database": "teste_investidor",
|
||||
"port": 5432
|
||||
},
|
||||
"tables": 174,
|
||||
"files_verified": 369,
|
||||
"dump_sha256": "d7c0767888ce08fcb078020cefe7a83634849939c6d436911475d6779a640c01",
|
||||
"files_sha256": "e3b297c870dd26676004c495c1893cebf68be0ccbc013b2c073b93f63a4643e6",
|
||||
"restore_verified": false
|
||||
},
|
||||
"restore": {
|
||||
"restore_verified": true,
|
||||
"tables_verified": 174,
|
||||
"container_network": "none",
|
||||
"database": "l1_secondhand_restore_20261024",
|
||||
"port": 55441,
|
||||
"source_dump_sha256": "d7c0767888ce08fcb078020cefe7a83634849939c6d436911475d6779a640c01",
|
||||
"active_database_writes": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
--- a/resources/js/lib/iva-secondhand.ts
|
||||
+++ b/resources/js/lib/iva-secondhand.ts
|
||||
@@ -74,6 +74,7 @@
|
||||
function key(draft:Record<string,unknown>,book:SecondhandBook):string{return JSON.stringify({version:secondhandVersion,scope:acquisitionScope(draft),location:draft.selection_labels??{},currency:draft.currency,rows:book.rows});}
|
||||
export function secondhandCurrent(draft:Record<string,unknown>,book:SecondhandBook):boolean{return!!book.result&&book.result.sourceKey===key(draft,book);}
|
||||
export function recordSecondhands(draft:Record<string,unknown>,book:SecondhandBook):SecondhandBook{
|
||||
+ throw new Error('Novos cálculos P092/P093/P125 temporariamente suspensos;dados,histórico,relatórios e restantes ramos preservados.');
|
||||
if(!book.rows.length||new Set(book.rows.map(row=>row.id)).size!==book.rows.length)throw new Error('Indique operações com identificadores distintos;originais conservados.');
|
||||
const result:SecondhandCalculation={version:secondhandVersion,revision:(book.result?.revision??0)+1,calculatedAt:new Date().toISOString(),opportunity:acquisitionScope(draft),location:JSON.stringify(draft.selection_labels??{}),sourceKey:key(draft,book),source:secondhandSource,inputs:structuredClone(book.rows),rows:book.rows.map(row=>evaluateSecondhand(row,draft.currency))};
|
||||
const next={...book,result,history:[...(book.history??[]),...(book.result?[book.result]:[])]};saveSecondhandBook(draft,next);return next;
|
||||
@@ -1,5 +1,72 @@
|
||||
# Rastreabilidade, utilização e formação
|
||||
|
||||
## 25/10/2026 — P092/P093/P125 concluídos em QA: segunda mão e leilões
|
||||
|
||||
Implementação `b0818c01`. Três ramos, duas fórmulas de base e quatro categorias, conferidos em oito exemplos. A classificação P125 partilha a mesma operação com P092 ou P093; não soma uma segunda base. CIVA Lei13/2016:3(3)g/3(6),PDF7,p1426(265);15(2)f/g,PDF13,p1426(271). RIVA Decreto7/2008,BR16-I de16/04/2008,arts47–49,PDF8–9,p106–107. Lei22/2022 PDF3 mantém15f/g e fixa17(1)16%. Lei10/2025 não altera15/17 e revoga regimes35/42;referência antiga não os reactiva. Rectificação2017 sem alteração destas disposições.
|
||||
|
||||
- **P092**: Revendedor: margem individual positiva da contraprestação total com IVA menos preço de compra justificado; dividir por 1.16 e arredondar a base à unidade. Perda conservada no bem, sem compensação entre transmissões. Opção pelo regime normal fica separada.
|
||||
- **P093**: Organizador em nome próprio por conta do comitente, contrato de comissão e venda em leilão: base = facturado ao comprador menos líquido do comitente menos IVA próprio identificado. Líquido = adjudicação menos comissão. IVA desconhecido não é zero.
|
||||
- **P125**: Classificação própria: bem usado reutilizável, arte, colecção ou antiguidade superior a 100 anos; critérios de 3(6) conservados. Categoria identificada não activa automaticamente a margem. Tiragem limitada a 200 exemplares e cerâmica única executada/assinada pelo artista nos percursos respectivos.
|
||||
|
||||
2026/MZN,transmissões internas tributáveis e aquisição nacional com qualidade do fornecedor/comitente demonstrada. Duas fórmulas, quatro categorias, oito exemplos e três ramos; uma operação individual, sem dupla contagem. Apenas classificação/base:sem IVA calculado,nova dedução,campo11,regularização ou totaisModeloA. IVA identificado no leilão é componente referenciada. Exportação isenta e opção normal separadas; origens legadas35/42 permanecem indeterminadas.
|
||||
|
||||
Reutilizar dados/documentos e registar referências ou pressupostos expressos. O livro regulatedSecondhands conserva entradas/resultados/histórico por oportunidade, integra a gravação/recuperação privada e o relatório existente. Trocar percurso/categoria conserva campos ocultos e obriga a rever apenas as confirmações afectadas. Arredondamento da base de revenda à unidade mais próxima por48(6)b;empate para cima é escolha técnica explícita. Montantes com seis casas e BigInt. Prazo do relatório ao comitente de cinco dias úteis identificado, sem inventar calendário. Não emitir factura fiscal nem relatório legal ao comitente por esta simulação.
|
||||
|
||||
Verificação:11testesfrontend,APIprivada1teste/35asserções comrollback emQAisolada55441,tipos ebuild aprovados. Edge/CUA:compra desconhecida deixa base indeterminada;perda individual mantémbasezero sem compensar outros bens;restauro dos valores,gravação,recuperação e relatório oito operações,bases138.00x4/344.83x4MZN,quatro versões anteriores,IVA/taxanull. Todos os livros anteriores comparados com congelamento;111fechos preservados,sem perdas confirmadas,provas6c12aabb/ec786f4a reutilizadas. Relatório `docs\investmoz\simulations\iva-l1-secondhand-qa-20261025.json`,prova `C:\laragon\www\portal-investidor\outputs\iva-l1-secondhand-20261025/verification.json`,imagem `qa-recovered-report.png`. Sem escrita no activo.
|
||||
|
||||
**111entregues +3QA +18funcionaispendentes +P001=133**. Homologação `6c12aabb`;entrega conjunta pendente,sem entrega individual por ramo. L1aberto;P00105/06;P121digital/P084/P085pendentes;bebidasL2/L3;Estatísticas/IAadiadas.
|
||||
|
||||
|
||||
## 25/10/2026 — preparação conjunta P092/P093/P125
|
||||
|
||||
Inventariados111fechos antes dos testes,sem perdas confirmadas;provas6c12aabb/ec786f4a reutilizadas.Congelados livros/resultados/históricos incluindoP088/P124/P091/P122/P128 eP084/P085parciais.QAporramo eentrega conjunta futura,sem alterações noactivo.CIVA3(3)g/3(6),15(2)f/g,2016PDF7/13;RIVADecreto7/2008arts47–49,acervoBR16-I16/04/2008PDF8–9;2022mantém15f/g;2025revoga regimes35/42,não os reactivar por referência antiga.Regularização/dedução fora.Revenda:margem individual sem compensação entrebens;base de margem positiva comdivisor1.16 e arredondamento à unidade47/48.Leilão:facturado−líquidocomitente−IVApróprio identificado,sem IVAzero presumido.
|
||||
|
||||
## 25/10/2026 — G7N/G10C/P088/P124 entregues numa operação conjunta
|
||||
|
||||
Homologação **`6c12aabb`**,sobre`63cc3367`;candidata`cd259623` expressamente aceite pela Tempo. Dois ramos,quatro tratamentos,uma integração/backup/restauro/instalação/conferência,provas individuaisQA reutilizadas.
|
||||
|
||||
- **P124**: Classificação da afectação permanente de bens a uso próprio/particular/alheio,transmissão gratuita,afectação a sector isento ou aoactivo imobilizado de bens20(1)a. Exige dedução anterior total/parcial nos bens/elementos;em3e conferir excepção de amostras/ofertas depequeno valor,sem limiar inventado. Facto histórico de dedução,não nova dedução.
|
||||
- **P088**: Base15(2)b:preço aquisição ou,na sua falta demonstrada,preço custo,reportados ao momento da operação. ClassificaçãoP124 pode estar identificada ebaseP088 indeterminada;sem custo por defeito para preço aquisição desconhecido.
|
||||
|
||||
CIVA3(3)e/f,Lei13/2016PDF6–7/p1426(264–265);15(2)b,PDF13/p1426(271);20(1)a,PDF15/p1426(273). Lei22/2022PDF3mantém15(2)b e20(1)a;Lei10/2025PDF12mantém3(3)e/f e não altera15/20. 2026/MZN,quatro tratamentos partilhados entre dois requisitos sobre a mesma operação,registada uma vez. Distinto de uso temporário de bens como serviçoP089. Sem nova dedução/campo11,regularização,taxaIVA,IVA ou totaisModeloA;dedução anterior apenas facto histórico. Excepçãoamostras/ofertas fica fora deste percurso quando aplicável;desconhecido permanece indeterminado. Uma operação partilhada entreP124classificação eP088base,sem dupla entrada/soma. Dedução anterior apenas facto histórico exigido pela fonte,não nova dedução ou regularização. Base pelo preço aquisição ou,na sua falta demonstrada,custo reportado ao momento da operação. Sem preenchimento do campo11.Factos/referências/datas/âmbito,entradas imutáveis/histórico/relatório preservados. Desconhecido não é zero;fora do território não é isenção/IVAzero;sem certificados/aprovadores novos.
|
||||
|
||||
Compatibilidade com main e destino conferida,sem avanço concorrente encontrado;fast-forward normal,sem sobrescrever alterações. SessãoSSH existente autenticada reutilizada,sem guardar credenciais. Backup novo e restauro real isolado sem rede:174tabelas/369ficheiros/configuração. Conferido apenas delta instalado:revisão servida,manifesto/hash,20marcadores compilados,quatro hashes funcionais e simuladorHTTP200. PostgreSQL pela mesma identidade antes/depois:174tabelas/369ficheiros e29fichas publicadas/28relações/408geometrias preservados;diferenças apenascache/sessões. Zero migrações/importações/alterações de permissões ou ensaios sintéticos no activo. Contenção de novas classificações conferida,não aplicada;leitores/histórico/outrosramos preservados. Release/backup anteriores conservados.
|
||||
|
||||
[Manifesto/recibo](../simulations/l1-goods-allocation-delivery-20261025.json),registo`iva_l1_goods_allocation_P088_P124_homologation_20261025`. **111entregues +21funcionaispendentes +P001=133**,sem candidatasQApor disponibilizar. Os109fechos anteriores preservados. P084/P085 continuam incluídos nos21,apenas preparação/simulação condicionada;P002transversal eL1abertos;P00105/06;bebidasL2/L3;Estatísticas/IAadiadas. ManterQAporramo eentregasconjuntas compatíveis.
|
||||
|
||||
|
||||
## 25/10/2026 — P088/P124 concluídos emQA,classificação de afectações ebase aquisição/custo
|
||||
|
||||
Implementação`9b95e5e7`. Dois ramos,quatro tratamentos partilhados:afectação permanente privada,transmissão gratuita,sector isento,activo imobilizado20(1)a.Uma operação registada uma vez,coberturaP124/P088 distinta,não oito tratamentos nem dupla base. CIVA3(3)e/f,Lei13/2016PDF6–7/p1426(264–265);15(2)b,PDF13/p1426(271);20(1)a,PDF15/p1426(273). Lei22/2022PDF3mantém15(2)b e20(1)a;Lei10/2025PDF12mantém3(3)e/f e não altera15/20.
|
||||
|
||||
- **P124**: Classificação da afectação permanente de bens a uso próprio/particular/alheio,transmissão gratuita,afectação a sector isento ou aoactivo imobilizado de bens20(1)a. Exige dedução anterior total/parcial nos bens/elementos;em3e conferir excepção de amostras/ofertas depequeno valor,sem limiar inventado. Facto histórico de dedução,não nova dedução.
|
||||
- **P088**: Base15(2)b:preço aquisição ou,na sua falta demonstrada,preço custo,reportados ao momento da operação. ClassificaçãoP124 pode estar identificada ebaseP088 indeterminada;sem custo por defeito para preço aquisição desconhecido.
|
||||
|
||||
2026/MZN,quatro tratamentos partilhados entre dois requisitos sobre a mesma operação,registada uma vez. Distinto de uso temporário de bens como serviçoP089. Sem nova dedução/campo11,regularização,taxaIVA,IVA ou totaisModeloA;dedução anterior apenas facto histórico. Excepçãoamostras/ofertas fica fora deste percurso quando aplicável;desconhecido permanece indeterminado. Preço/custo reportado ao momento da operação,comdata/âmbito;esse campo temporal não impõe novo documento emitido na mesma data.Reutilizar referências epressupostos expressos,sem certificado/aprovador/limiar inventado.Custo não é alternativa automática para aquisição desconhecida.Sem actualização automática de custos/depreciações.regulatedGoodsAllocations poroportunidade nosnapshot/API/dossier existentes;troca conserva valores ocultos e exige rever factos/avaliação,escolha técnica de integridade.
|
||||
|
||||
Sete testes funcionais:quatro tratamentos+P124factos/P088base separados+subsidiariedade custo/precisão/troca+preservação/persistência/histórico/relatório.APIprivada1teste/27asserções comrollback emQAisolada55441;tipos/build aprovados.Edge/CUA:falta aquisição por esclarecer conserva classificação masbase indeterminada;dedução histórica desconhecida torna classificação indeterminada;restaurados factos egravação/recuperação/relatório4operações1000.25/800.15/1000.25/800.15MZN,4versõesanteriores,IVA/taxanull.Comparados todos oslivros anteriores comcongelamento,incluindoP091/P089/P122/P128/P096–P099/P111–P120 eP084/P085parciais;109fechos preservados,provas anteriores reutilizadas.Relatório`docs\investmoz\simulations\iva-l1-goods-allocation-qa-20261025.json`;evidência`C:\laragon\www\portal-investidor\outputs\iva-l1-goods-allocation-20261025/verification.json` eimagem`qa-recovered-report.png`.Sem escrita noactivo.
|
||||
|
||||
**109entregues +2QA +21funcionaispendentes +P001=133**.Homologação`63cc3367`;entrega conjunta pendente.L1aberto;nova dedução/regularização fora;P121digital/P084/P085pendentes;P00105/06;bebidasL2/L3;Estatísticas/IAadiadas.Uma integração/backup/restauro/conferência paraoconjunto,reutilizando provas porramo.
|
||||
|
||||
|
||||
## 25/10/2026 — preparação conjunta G7N/G10C,P088/P124
|
||||
|
||||
Inventariados109fechos antes dos testes,sem perdas confirmadas;provas63cc3367/1b67fa85 reutilizadas. Congelados livros/resultados/históricos incluindoP091/P122/P128 eP084/P085parciais. QAporramo eentrega conjunta futura;sem alterações noactivo. CIVA3(3)e/f,2016PDF6–7;15(2)b,PDF13:preço aquisição ou,nasua falta,preço custo,reportados aomomento daoperação. Dedução anterior total/parcial é facto histórico de3e/f,não nova dedução/campo11. Não confundir uso temporário de serviçosP089 comafectação/transmissão permanente de bens.
|
||||
|
||||
## 25/10/2026 — G10A–G10B/P122/P128 entregues numa operação conjunta
|
||||
|
||||
Homologação **`63cc3367`**,sobre`2fdca863`;candidata`af7d2503` expressamente aceite pela Tempo. Dois ramos,quatro tratamentos,uma integração/backup/restauro/instalação/conferência,provas individuaisQA reutilizadas.
|
||||
|
||||
- **P122**: Transferências de bens em execução de contrato de comissão,incluindo consignação;na venda comissário considerado comprador,na compra comitente considerado comprador. Venda:comitente→comissário→terceiro;compra:terceiro→comissário→comitente. Contraprestações e referências das duas relações separadas.
|
||||
- **P128**: Serviço efectuado por intervenção de mandatário emnome próprio:mandatário considerado adquirente eprestador sucessivamente4(3). Venda/prestação:mandante→mandatário→terceiro;compra/aquisição:terceiro→mandatário→mandante. Não é mera intermediação emnome de outrem ou base15(2)e de bens.
|
||||
|
||||
CIVA3(3)c,Lei13/2016PDF6/p1426(264);4(3),PDF7/p1426(265). Lei22/2022não altera3/4;Lei10/2025PDF12mantém3(3)c e não altera4. Base15(2)e/P091já entregue permanece independente;sem nova aplicação da base neste incremento. 2026,circuitos emnome próprio,partes/contratos/objectos econtraprestações originais das duas relações. Sem soma/compensação automática,base tributável nova,localização,isenção,taxa,IVA,dedução/campo11 ou totaisModeloA. Sem conversão cambial;moeda original identificada e coerente com contexto. P091preservado,sem repetir aceitação/cálculo. Contraprestações das duas relações mantidas separadas,sem dupla soma.P091 e seus cálculos/históricos preservados,sem recalcular.Dedução fora deste incremento.Factos/referências/datas/âmbito,entradas imutáveis/histórico/relatório preservados. Desconhecido não é zero;fora do território não é isenção/IVAzero;sem certificados/aprovadores novos.
|
||||
|
||||
Compatibilidade com main e destino conferida,sem avanço concorrente encontrado;fast-forward normal,sem sobrescrever alterações. SessãoSSH existente autenticada reutilizada,sem guardar credenciais. Backup novo e restauro real isolado sem rede:174tabelas/369ficheiros/configuração. Conferido apenas delta instalado:revisão servida,manifesto/hash,17marcadores compilados,quatro hashes funcionais e simuladorHTTP200. PostgreSQL pela mesma identidade antes/depois:174tabelas/369ficheiros e29fichas publicadas/28relações/408geometrias preservados;diferenças apenascache/sessões. Zero migrações/importações/alterações de permissões ou ensaios sintéticos no activo. Contenção de novas classificações conferida,não aplicada;leitores/histórico/outrosramos preservados. Release/backup anteriores conservados.
|
||||
|
||||
[Manifesto/recibo](../simulations/l1-g10-own-name-delivery-20261025.json),registo`iva_l1_g10_own_name_P122_P128_homologation_20261025`. **109entregues +23funcionaispendentes +P001=133**,sem candidatasQApor disponibilizar. Os107fechos anteriores preservados. P084/P085 continuam incluídos nos23,apenas preparação/simulação condicionada;P002transversal eL1abertos;P00105/06;bebidasL2/L3;Estatísticas/IAadiadas. ManterQAporramo eentregasconjuntas compatíveis.
|
||||
|
||||
|
||||
## 25/10/2026 — G10A–G10B/P122/P128 concluídos emQA,circuitos emnome próprio
|
||||
|
||||
Implementação`2b592ded`. Dois ramos,quatro tratamentos comtestes próprios,uma candidata conjunta. CIVA3(3)c,Lei13/2016PDF6/p1426(264);4(3),PDF7/p1426(265). Lei22/2022não altera3/4;Lei10/2025PDF12mantém3(3)c e não altera4. Base15(2)e/P091já entregue permanece independente;sem nova aplicação da base neste incremento.
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,35 @@
|
||||
import {useState} from 'react';
|
||||
import {newGoodsAllocation,switchAllocationTreatment,switchAllocationValuation,goodsAllocationBook,goodsAllocationConditions,allocationSpecificConditions,goodsAllocationCurrent,goodsAllocationReportRows,goodsAllocationSource,goodsAllocationTreatments,recordGoodsAllocations,saveGoodsAllocationBook,type GoodsAllocationBook,type GoodsAllocationRow} from '@/lib/iva-goods-allocation';
|
||||
|
||||
export function SimulationGoodsAllocation({draft,onChange}:{draft:Record<string,unknown>;onChange:(field:string,value:string)=>void}){
|
||||
const[error,setError]=useState('');let book:GoodsAllocationBook;
|
||||
try{book=goodsAllocationBook(draft);}catch(cause){return<p role="alert">{String(cause)}</p>;}
|
||||
const save=(next:GoodsAllocationBook)=>{try{onChange('modelo_a_snapshot',saveGoodsAllocationBook(draft,next));setError('');}catch(cause){setError(String(cause));}};
|
||||
const change=(id:string,patch:Partial<GoodsAllocationRow>)=>save({...book,rows:book.rows.map(row=>row.id===id?{...row,...patch}:row)});
|
||||
return<details className="space-y-3 rounded border p-3">
|
||||
<summary>Afectação de bens — classificação ebase de aquisição/custo</summary>
|
||||
<p>Oportunidade: {String(draft.context_opportunity||'entrada geral')}. P124identifica a transmissão assimilada;P088determina a base. Uma operação conserva a sua identidade nos dois requisitos,não se soma duas vezes. Uso temporário de bens como serviçoP089segue o seu percurso.</p>
|
||||
<p>A dedução anterior total/parcial é um facto histórico dos bens ou elementos;não é calculada nem concedida aqui. A base usa preço de aquisição reportado ao momento da operação ou,na sua falta demonstrada,preço de custo.Não substituir um preço desconhecido por zero ou por custo automaticamente.</p>
|
||||
<p>{goodsAllocationSource}</p>{error&&<p role="alert">{error}</p>}
|
||||
<button type="button" className="underline" onClick={()=>save({...book,rows:[...book.rows,newGoodsAllocation(crypto.randomUUID(),String(draft.currency??''))]})}>Acrescentar afectação ou transmissão gratuita</button>
|
||||
{book.rows.map(row=><details key={row.id} className="rounded border p-3"><summary>{row.description||'Operação por identificar'} — {row.period||'mês por indicar'}</summary>
|
||||
<div className="grid gap-3 md:grid-cols-2">
|
||||
<label>Percurso de afectação dos bens<select className="block rounded border p-2" value={row.treatment} onChange={e=>change(row.id,switchAllocationTreatment(row,e.target.value))}><option value="">Por indicar</option>{goodsAllocationTreatments.map(t=><option key={t.id} value={t.id}>{t.label}</option>)}</select></label>
|
||||
<label>Natureza dos dados<select className="block rounded border p-2" value={row.origin} onChange={e=>change(row.id,{origin:e.target.value as GoodsAllocationRow['origin']})}><option value="projected">Projectados / pressupostos</option><option value="effective">Efectivos declarados</option></select></label>
|
||||
{([['description','Operação identificada'],['operationRef','Referência da operação / pressuposto'],['currency','Moeda da base'],['operationDate','Data da operação / prevista'],['period','Mês da operação'],['documentRef','Documento / referência da previsão'],['documentDate','Data do documento / prevista'],['goodsRef','Bens/elementos e identificação do conjunto afectado'],['deductionRef','Referência da dedução anterior total ou parcial'],['destinationRef','Destino,finalidade ou sector eâmbito'],['evidence','Fundamento factual / pressupostos']] as const).map(([field,label])=><label key={field}>{label}<input className="block rounded border p-2" type={['operationDate','documentDate'].includes(field)?'date':field==='period'?'month':'text'} value={row[field]} onChange={e=>change(row.id,{[field]:e.target.value})}/></label>)}
|
||||
{['permanent_private_goods','free_goods_transfer'].includes(row.treatment)&&<label>Factos/referência sobre excepção de amostras/ofertas de pequeno valor<input className="block rounded border p-2" value={row.exceptionRef} onChange={e=>change(row.id,{exceptionRef:e.target.value})}/></label>}
|
||||
{row.treatment==='fixed_asset_20a'&&<label>Enquadramento dos bens20(1)a eafectação ao activo imobilizado<input className="block rounded border p-2" value={row.asset20aRef} onChange={e=>change(row.id,{asset20aRef:e.target.value})}/></label>}
|
||||
<label>Modo de determinação da base15(2)b<select className="block rounded border p-2" value={row.valuationMode} onChange={e=>change(row.id,switchAllocationValuation(row,e.target.value))}><option value="">Por esclarecer</option><option value="acquisition">Preço de aquisição reportado ao momento da operação</option><option value="cost">Preço de custo,na falta demonstrada de preço de aquisição</option></select></label>
|
||||
{row.valuationMode==='acquisition'&&<><label>Preço de aquisição para o conjunto identificado,sem próprioIVA<input className="block rounded border p-2" value={row.acquisitionPrice} onChange={e=>change(row.id,{acquisitionPrice:e.target.value})}/></label><label>Referência do preço de aquisição reportado ao momento<input className="block rounded border p-2" value={row.acquisitionRef} onChange={e=>change(row.id,{acquisitionRef:e.target.value})}/></label></>}
|
||||
{row.valuationMode==='cost'&&<><label>Preço de custo para o conjunto identificado,sem próprioIVA<input className="block rounded border p-2" value={row.currentCost} onChange={e=>change(row.id,{currentCost:e.target.value})}/></label><label>Referência do custo reportado ao momento<input className="block rounded border p-2" value={row.costRef} onChange={e=>change(row.id,{costRef:e.target.value})}/></label><label>Falta de preço de aquisição demonstrada para esta operação<select className="block rounded border p-2" value={row.conditions.acquisitionUnavailable??''} onChange={e=>change(row.id,{conditions:{...row.conditions,acquisitionUnavailable:e.target.value as ''|'yes'|'no'}})}><option value="">Por esclarecer</option><option value="yes">Sim</option><option value="no">Não</option></select></label></>}
|
||||
<label>Momento a que o preço de aquisição/custo é reportado<input type="date" className="block rounded border p-2" value={row.valuationDate} onChange={e=>change(row.id,{valuationDate:e.target.value})}/></label>
|
||||
<label>Âmbito ecomposição da base,bens/elementos abrangidos<input className="block rounded border p-2" value={row.valuationScope} onChange={e=>change(row.id,{valuationScope:e.target.value})}/></label>
|
||||
<label>Base reportada ao momento desta operação,sem próprioIVA ecom âmbito correspondente<select className="block rounded border p-2" value={row.conditions.valuationConfirmed??''} onChange={e=>change(row.id,{conditions:{...row.conditions,valuationConfirmed:e.target.value as ''|'yes'|'no'}})}><option value="">Por esclarecer</option><option value="yes">Sim</option><option value="no">Não</option></select></label>
|
||||
</div>
|
||||
<p>Mudar percurso/modo conserva referências e valores ocultos,mas exige rever confirmações próprias. Não se presume limiar de oferta,custo histórico actualizado ou nova dedução.</p>
|
||||
<fieldset><legend>Factos próprios da operação</legend>{[...goodsAllocationConditions,...allocationSpecificConditions(row.treatment)].map(([key,label])=><label className="block" key={key}>{label}<select className="block rounded border p-2" value={row.conditions[key]??''} onChange={e=>change(row.id,{conditions:{...row.conditions,[key]:e.target.value as ''|'yes'|'no'}})}><option value="">Por indicar</option><option value="yes">Sim</option><option value="no">Não</option></select></label>)}</fieldset>
|
||||
</details>)}
|
||||
{!!book.rows.length&&<button type="button" className="rounded bg-emerald-800 p-2 text-white" onClick={()=>{try{save(recordGoodsAllocations(draft,book));}catch(cause){setError(String(cause));}}}>Classificar afectações,determinar base eguardar versão</button>}
|
||||
{book.result&&<><p role="status">{goodsAllocationCurrent(draft,book)?'Classificações/bases correspondentes às entradas guardadas.':'Entradas alteradas;resultados históricos conservados. Reveja e determine novamente.'} {book.history?.length??0} versões anteriores. Dedução histórica não é nova dedução/campo11;sem IVA ou regularização calculados.</p><dl>{goodsAllocationReportRows(draft).map(([,label,value,origin],index)=><div key={index}><dt className="font-semibold">{label}</dt><dd>{value}<small className="block">{origin}</small></dd></div>)}</dl></>}
|
||||
</details>;
|
||||
}
|
||||
@@ -20,6 +20,8 @@ import { SimulationServiceLocation } from './simulation-service-location';
|
||||
import { SimulationListedServices } from './simulation-listed-services';
|
||||
import { SimulationReducedBases } from './simulation-reduced-bases';
|
||||
import { SimulationOwnName } from './simulation-own-name';
|
||||
import { SimulationGoodsAllocation } from './simulation-goods-allocation';
|
||||
import { SimulationSecondhand } from './simulation-secondhand';
|
||||
import { SimulationOfferPreparations } from './simulation-offer-preparations';
|
||||
import { SimulationOperations } from './simulation-operations';
|
||||
|
||||
@@ -118,6 +120,8 @@ export function SimulationMonthlyIva({draft, busy, onCalculate, onChange}: {
|
||||
<SimulationListedServices draft={draft} onChange={onChange} />
|
||||
<SimulationReducedBases draft={draft} onChange={onChange} />
|
||||
<SimulationOwnName draft={draft} onChange={onChange} />
|
||||
<SimulationGoodsAllocation draft={draft} onChange={onChange} />
|
||||
<SimulationSecondhand draft={draft} onChange={onChange} />
|
||||
<SimulationOfferPreparations draft={draft} onChange={onChange} />
|
||||
<SimulationModeloA draft={draft} />
|
||||
</section>;
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
import {useState} from 'react';
|
||||
import {newSecondhand,switchSecondhandTreatment,switchSecondhandCategory,secondhandBook,secondhandConditions,secondhandCategoryConditions,secondhandCurrent,secondhandReportRows,secondhandSource,secondhandTreatments,secondhandCategories,recordSecondhands,saveSecondhandBook,type SecondhandBook,type SecondhandRow} from '@/lib/iva-secondhand';
|
||||
|
||||
export function SimulationSecondhand({draft,onChange}:{draft:Record<string,unknown>;onChange:(field:string,value:string)=>void}){
|
||||
const[error,setError]=useState('');let book:SecondhandBook;
|
||||
try{book=secondhandBook(draft);}catch(cause){return<p role="alert">{String(cause)}</p>;}
|
||||
const save=(next:SecondhandBook)=>{try{onChange('modelo_a_snapshot',saveSecondhandBook(draft,next));setError('');}catch(cause){setError(String(cause));}};
|
||||
const change=(id:string,patch:Partial<SecondhandRow>)=>save({...book,rows:book.rows.map(row=>row.id===id?{...row,...patch}:row)});
|
||||
return<details className="space-y-3 rounded border p-3">
|
||||
<summary>Bens emsegunda mão — revenda pela margem eleilão</summary>
|
||||
<p>Oportunidade: {String(draft.context_opportunity||'entrada geral')}. Uma linha porbem.P125identifica categoria/estatuto;P092ouP093determina a base aplicável.Sem compensação de perdas entrebens,nova dedução ou IVAcalculado.</p>
|
||||
<p>Revendedor:contraprestação total comIVA−preço compra,parcela positiva÷1.16 ebase arredondada à unidade48(6)b.16%é parâmetro do divisor,não IVAcalculado neste percurso.Leilão:facturado−líquidocomitente−IVApróprio identificado;líquido=adjudicação−comissão.Não substituir IVA desconhecido porzero.</p>
|
||||
<p>{secondhandSource}</p>{error&&<p role="alert">{error}</p>}
|
||||
<button type="button" className="underline" onClick={()=>save({...book,rows:[...book.rows,newSecondhand(crypto.randomUUID(),String(draft.currency??''))]})}>Acrescentar bem individual</button>
|
||||
{book.rows.map(row=><details key={row.id} className="rounded border p-3"><summary>{row.description||'Bem por identificar'} — {row.period||'mês por indicar'}</summary>
|
||||
<div className="grid gap-3 md:grid-cols-2">
|
||||
<label>Percurso da margem<select className="block rounded border p-2" value={row.treatment} onChange={e=>change(row.id,switchSecondhandTreatment(row,e.target.value))}><option value="">Por indicar</option>{secondhandTreatments.map(t=><option key={t.id} value={t.id}>{t.label}</option>)}</select></label>
|
||||
<label>Categoria do bem<select className="block rounded border p-2" value={row.category} onChange={e=>change(row.id,switchSecondhandCategory(row,e.target.value))}><option value="">Por indicar</option>{secondhandCategories.map(c=><option key={c.id} value={c.id}>{c.label}</option>)}</select></label>
|
||||
<label>Natureza dos dados<select className="block rounded border p-2" value={row.origin} onChange={e=>change(row.id,{origin:e.target.value as SecondhandRow['origin']})}><option value="projected">Projectados / pressupostos</option><option value="effective">Efectivos declarados</option></select></label>
|
||||
{([['description','Bem/operação identificados'],['operationRef','Referência da operação'],['operationDate','Data da operação / prevista'],['period','Mês da operação'],['currency','Moeda dos montantes'],['documentRef','Documento / referência da previsão'],['documentDate','Data do documento / prevista'],['goodsRef','Identidade do bem individual'],['operatorRef','Operador e estatuto revendedor/organizador'],['categoryRef','Características e referência da classificação'],['sourceRef','Fornecedor/comitente,origem e referência'],['scope','Âmbito:bem,partes,operação eperíodo'],['evidence','Fundamento factual / pressupostos']] as const).map(([field,label])=><label key={field}>{label}<input className="block rounded border p-2" type={['operationDate','documentDate'].includes(field)?'date':field==='period'?'month':'text'} value={row[field]} onChange={e=>change(row.id,{[field]:e.target.value})}/></label>)}
|
||||
<label>Qualidade do fornecedor/comitente<select className="block rounded border p-2" value={row.sourceType} onChange={e=>change(row.id,{sourceType:e.target.value})}><option value="">Por esclarecer</option><option value="private">Particular</option><option value="margin_reseller">Revendedor sujeito à margem</option><option value="exempt_9_12_e">Transmissão no âmbito9(12)e</option><option value="legacy_35_42">Referência histórica a35/42 — conferir situação2026</option><option value="other">Outro enquadramento por esclarecer</option></select></label>
|
||||
{([['domesticPurchase','Aquisição dos bens no território nacional'],['domesticTaxable','Transmissão interna tributável,não exportação isenta13']] as const).map(([field,label])=><label key={field}>{label}<select className="block rounded border p-2" value={row[field]} onChange={e=>change(row.id,{[field]:e.target.value})}><option value="">Por esclarecer</option><option value="yes">Sim</option><option value="no">Não</option></select></label>)}
|
||||
{row.category==='art'&&<><label>Tipo de objecto de arte<select className="block rounded border p-2" value={row.artSubtype} onChange={e=>change(row.id,{artSubtype:e.target.value})}><option value="">Por indicar</option><option value="original">Quadro,pintura ou desenho original</option><option value="print">Gravura,estampa ou litografia</option><option value="sculpture">Escultura ou estatuária</option><option value="ceramic">Cerâmica</option></select></label>{row.artSubtype==='print'&&<label>Tiragem total<input className="block rounded border p-2" value={row.editionCount} onChange={e=>change(row.id,{editionCount:e.target.value})}/></label>}{row.artSubtype==='ceramic'&&<label>Cerâmica única,executada eassinada pelo artista<select className="block rounded border p-2" value={row.ceramicUniqueSigned} onChange={e=>change(row.id,{ceramicUniqueSigned:e.target.value})}><option value="">Por esclarecer</option><option value="yes">Sim</option><option value="no">Não</option></select></label>}</>}
|
||||
{row.category==='collection'&&<><label>Tipo de colecção<select className="block rounded border p-2" value={row.collectionSubtype} onChange={e=>change(row.id,{collectionSubtype:e.target.value})}><option value="">Por indicar</option><option value="postal">Postal/filatélica</option><option value="scientific">Colecções/espécimes científicos3(6)c</option><option value="historical">Interesse histórico,arqueológico,paleontológico,etnográfico ou numismático</option></select></label>{row.collectionSubtype==='postal'&&<label>Fora decirculação esem destino aser posto emcirculação<select className="block rounded border p-2" value={row.postalNotCirculating} onChange={e=>change(row.id,{postalNotCirculating:e.target.value})}><option value="">Por esclarecer</option><option value="yes">Sim</option><option value="no">Não</option></select></label>}</>}
|
||||
{row.category==='antique'&&<label>Idade emanos<input className="block rounded border p-2" value={row.ageYears} onChange={e=>change(row.id,{ageYears:e.target.value})}/></label>}
|
||||
{row.treatment==='reseller_margin'&&<><label>Opção do revendedor<select className="block rounded border p-2" value={row.regimeChoice} onChange={e=>change(row.id,{regimeChoice:e.target.value})}><option value="">Por esclarecer</option><option value="margin">Regime da margem</option><option value="general">Regime geral — outra fórmula</option></select></label>{([['grossSale','Contraprestação total devida pelocliente,comIVA incluído'],['purchasePrice','Preço compra do mesmo bem'],['purchaseRef','Justificação/referência do preço compra']] as const).map(([field,label])=><label key={field}>{label}<input className="block rounded border p-2" value={row[field]} onChange={e=>change(row.id,{[field]:e.target.value})}/></label>)}</>}
|
||||
{row.treatment==='auction_margin'&&([['grossInvoice','Montante facturado ao comprador49(4)'],['hammerPrice','Preço de adjudicação'],['principalCommission','Comissão obtida/aobter do comitente'],['auctionRef','Contrato de comissão de venda emnome próprio eleilão'],['principalRef','Comitente e referência do líquido'],['ownVat','IVApróprio relativo àtransmissão,identificado'],['ownVatRef','Referência/composição do IVApróprio identificado']] as const).map(([field,label])=><label key={field}>{label}<input className="block rounded border p-2" value={row[field]} onChange={e=>change(row.id,{[field]:e.target.value})}/></label>)}
|
||||
</div>
|
||||
<p>Os montantes ocultos de outro percurso são conservados esó entram na fórmula escolhida.Situação antiga35/42não activa margem automaticamente em2026;sem novo certificado/aprovador.</p>
|
||||
<fieldset><legend>Condições da classificação eregime</legend>{[...secondhandConditions,...secondhandCategoryConditions(row.category),['regimeConfirmed','Condições47/48(1)ou49(1),papéis/contrato equadro temporal conferidos'],['compositionConfirmed','Composição monetária corresponde ao percurso:revenda comIVA no total,ou leilão comfacturado,líquidocomitente eIVApróprio separados,sem dupla subtracção']] .map(([key,label])=><label className="block" key={key}>{label}<select className="block rounded border p-2" value={row.conditions[key]??''} onChange={e=>change(row.id,{conditions:{...row.conditions,[key]:e.target.value as ''|'yes'|'no'}})}><option value="">Por indicar</option><option value="yes">Sim</option><option value="no">Não</option></select></label>)}</fieldset>
|
||||
</details>)}
|
||||
{!!book.rows.length&&<button type="button" className="rounded bg-emerald-800 p-2 text-white" onClick={()=>{try{save(recordSecondhands(draft,book));}catch(cause){setError(String(cause));}}}>Classificar bens,calcular bases eguardar versão</button>}
|
||||
{book.result&&<><p role="status">{secondhandCurrent(draft,book)?'Classificações/bases correspondentes às entradas guardadas.':'Entradas alteradas;resultados históricos conservados.'} {book.history?.length??0} versões anteriores.Sem compensar margens entrebens,calcular IVA ou dedução/campo11.</p><dl>{secondhandReportRows(draft).map(([,label,value,origin],index)=><div key={index}><dt className="font-semibold">{label}</dt><dd>{value}<small className="block">{origin}</small></dd></div>)}</dl></>}
|
||||
</details>;
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
import {acquisitionScope,readAcquisitionStore} from './iva-acquisitions.ts';
|
||||
|
||||
export const goodsAllocationVersion='goods-allocation-base/1';
|
||||
export const goodsAllocationSource='CIVA3(3)e/f,Lei13/2016PDF6–7/p1426(264–265):afectação permanente de bens a uso próprio/particular/alheio,transmissão gratuita,afectação a sector isento ou ao activo imobilizado de bens20(1)a,com dedução total/parcial anterior nos bens/elementos;excepção de amostras/ofertas de pequeno valor na alíneae. Art15(2)b,PDF13/p1426(271):preço de aquisição ou,na sua falta,preço de custo,reportados ao momento da operação. Art20(1)a,PDF15/p1426(273). Lei22/2022PDF3mantém15(2)b e20(1)a;Lei10/2025mantém3(3)e/f e não altera15/20. Recorte2026/MZN,sem nova dedução/campo11,regularização,taxa,IVA ou totaisModeloA. Uso temporário de bens como serviçoP089 é distinto.';
|
||||
export const goodsAllocationTreatments=[{id:'permanent_private_goods',label:'Afectação permanente a uso próprio,particular ou fins alheios',clause:'e'},{id:'free_goods_transfer',label:'Transmissão gratuita de bens',clause:'e'},{id:'exempt_sector_goods',label:'Afectação de bens a sector de actividade isento',clause:'f'},{id:'fixed_asset_20a',label:'Afectação ao activo imobilizado de bens20(1)a',clause:'f'}] as const;
|
||||
export const goodsAllocationConditions=[['businessGoods','São bens da empresa identificados,não uma prestação de serviços ou venda onerosa normal'],['priorDeduction','Houve dedução total ou parcial anterior nos bens ou elementos que os constituem,com referência histórica'],['factsCorrespond','Objecto,destino,operação,data eâmbito correspondem ao percurso identificado']] as const;
|
||||
export const allocationOwnConditions={
|
||||
permanent_private_goods:[['permanentAllocation','A afectação dos bens é permanente,não mero uso temporário'],['privatePurpose','Uso próprio do titular,pessoal ou fins alheios à empresa identificado'],['notSmallGift','Não se trata de amostra ou oferta de pequeno valor abrangida pela excepção3(3)e']],
|
||||
free_goods_transfer:[['gratuitousTransfer','Está identificada uma transmissão gratuita dos bens'],['notSmallGift','Não se trata de amostra ou oferta de pequeno valor abrangida pela excepção3(3)e']],
|
||||
exempt_sector_goods:[['exemptSector','Os bens são afectados ao sector de actividade isento identificado']],
|
||||
fixed_asset_20a:[['fixedAsset','Está identificada a afectação ao activo imobilizado'],['goods20a','Os bens correspondem aos referidos em20(1)a,com âmbito e referência identificados']],
|
||||
} as const;
|
||||
export function allocationSpecificConditions(treatment:string):ReadonlyArray<readonly[string,string]>{return allocationOwnConditions[treatment as keyof typeof allocationOwnConditions]??[];}
|
||||
type Choice=''|'yes'|'no';type Condition=typeof goodsAllocationConditions[number][0];
|
||||
export type GoodsAllocationRow={id:string;treatment:string;description:string;period:string;origin:'projected'|'effective';currency:string;operationDate:string;operationRef:string;documentRef:string;documentDate:string;goodsRef:string;deductionRef:string;destinationRef:string;exceptionRef:string;asset20aRef:string;valuationMode:string;acquisitionPrice:string;acquisitionRef:string;currentCost:string;costRef:string;valuationDate:string;valuationScope:string;evidence:string;conditions:Partial<Record<string,Choice>>};
|
||||
type LineResult={id:string;status:'determined'|'not_applicable'|'indeterminate';classification:'assimilated_goods'|'not_applicable'|'indeterminate';baseAmount:string|null;vat:null;rate:null;reason:string};
|
||||
export type GoodsAllocationCalculation={version:string;revision:number;calculatedAt:string;opportunity:string;location:string;sourceKey:string;source:string;inputs:GoodsAllocationRow[];rows:LineResult[]};
|
||||
export type GoodsAllocationBook={rows:GoodsAllocationRow[];result?:GoodsAllocationCalculation;history?:GoodsAllocationCalculation[]};
|
||||
type Store=ReturnType<typeof readAcquisitionStore>&{regulatedGoodsAllocations?:Record<string,GoodsAllocationBook>};
|
||||
export function newGoodsAllocation(id:string,currency:string):GoodsAllocationRow{return{id,treatment:'',description:'',period:'',origin:'projected',currency,operationDate:'',operationRef:'',documentRef:'',documentDate:'',goodsRef:'',deductionRef:'',destinationRef:'',exceptionRef:'',asset20aRef:'',valuationMode:'',acquisitionPrice:'',acquisitionRef:'',currentCost:'',costRef:'',valuationDate:'',valuationScope:'',evidence:'',conditions:{}};}
|
||||
export function switchAllocationTreatment(row:GoodsAllocationRow,treatment:string):GoodsAllocationRow{return{...row,treatment,conditions:Object.fromEntries(goodsAllocationConditions.map(([key])=>[key,row.conditions[key]??'']))};}
|
||||
export function switchAllocationValuation(row:GoodsAllocationRow,valuationMode:string):GoodsAllocationRow{return{...row,valuationMode,conditions:{...row.conditions,valuationConfirmed:'',acquisitionUnavailable:''}};}
|
||||
|
||||
function readStore(draft:Record<string,unknown>):Store{
|
||||
const store=readAcquisitionStore(draft.modelo_a_snapshot) as Store;
|
||||
if(store.regulatedGoodsAllocations!==undefined&&(!store.regulatedGoodsAllocations||typeof store.regulatedGoodsAllocations!=='object'||Array.isArray(store.regulatedGoodsAllocations)))throw new Error('Afectações de bens não recuperáveis;originais preservados.');
|
||||
const fields=Object.keys(newGoodsAllocation('','')).filter(key=>key!=='conditions');
|
||||
for(const book of Object.values(store.regulatedGoodsAllocations??{}))if(!book||!Array.isArray(book.rows)||(book.history!==undefined&&!Array.isArray(book.history))||book.rows.some(row=>!row||fields.some(key=>typeof row[key as keyof GoodsAllocationRow]!=='string')||!row.conditions||typeof row.conditions!=='object'||Array.isArray(row.conditions)))throw new Error('Linhas de afectações de bens não recuperáveis;originais preservados,sem substituição por lista vazia.');
|
||||
return store;
|
||||
}
|
||||
export function goodsAllocationBook(draft:Record<string,unknown>):GoodsAllocationBook{return readStore(draft).regulatedGoodsAllocations?.[acquisitionScope(draft)]??{rows:[]};}
|
||||
export function saveGoodsAllocationBook(draft:Record<string,unknown>,book:GoodsAllocationBook):string{const current=readStore(draft),encoded=JSON.stringify({...current,regulatedGoodsAllocations:{...current.regulatedGoodsAllocations,[acquisitionScope(draft)]:book}});readStore({...draft,modelo_a_snapshot:encoded});return encoded;}
|
||||
function decimal(raw:unknown):bigint|null{if(typeof raw!=='string'||!/^\d{1,15}(\.\d{1,6})?$/.test(raw.trim()))return null;const[whole,fraction='']=raw.trim().split('.');return BigInt(whole)*1000000n+BigInt(fraction.padEnd(6,'0'));}
|
||||
function money(n:bigint):string{return`${n/1000000n}.${(n%1000000n).toString().padStart(6,'0').replace(/0+$/,'').padEnd(2,'0')}`;}
|
||||
function validDate(value:string):boolean{const d=new Date(value+'T00:00:00Z');return /^\d{4}-\d{2}-\d{2}$/.test(value)&&Number.isFinite(d.getTime())&&d.toISOString().slice(0,10)===value;}
|
||||
export function evaluateGoodsAllocation(row:GoodsAllocationRow,currency:unknown):LineResult{
|
||||
const result:LineResult={id:row.id,status:'indeterminate',classification:'indeterminate',baseAmount:null,vat:null,rate:null,reason:''};const stop=(reason:string,status:LineResult['status']='indeterminate')=>({...result,status,classification:status==='not_applicable'?'not_applicable' as const:result.classification,reason});
|
||||
const rule=goodsAllocationTreatments.find(t=>t.id===row.treatment);if(!rule)return stop('Identifique afectação permanente,transmissão gratuita,sector isento ou activo imobilizado20(1)a.');
|
||||
if(!/^2026-(0[1-9]|1[0-2])$/.test(row.period)||!['projected','effective'].includes(row.origin)||!validDate(row.operationDate)||row.operationDate.slice(0,7)!==row.period)return stop('Identifique mês2026,data correspondente e dados efectivos ou pressupostos expressos.');
|
||||
const conditions=[...goodsAllocationConditions,...allocationSpecificConditions(row.treatment)];if(conditions.some(([key])=>row.conditions[key]==='no'))return stop('Este percurso de transmissão assimilada não se aplica aos factos declarados;conferir natureza,dedução histórica ou excepção,não presumir isenção/IVAzero.','not_applicable');
|
||||
if(conditions.some(([key])=>row.conditions[key]!=='yes'))return stop('Factos próprios ou dedução anterior por esclarecer;desconhecido não é não aplicável ou zero. Dedução histórica não é nova dedução concedida.');
|
||||
if(!row.description.trim()||!row.operationRef.trim()||!row.documentRef.trim()||!validDate(row.documentDate)||!row.goodsRef.trim()||!row.deductionRef.trim()||!row.destinationRef.trim()||!row.evidence.trim())return stop('Identifique bens,operação,documento/data,dedução histórica,destino eâmbito factual ou pressupostos expressos;reutilize referências,sem certificado/aprovador novo.');
|
||||
if(rule.clause==='e'&&!row.exceptionRef.trim())return stop('Identifique os factos/referência que distinguem a operação da excepção de amostras/ofertas de pequeno valor,ou pressuposto expresso;sem limiar inventado.');
|
||||
if(row.treatment==='fixed_asset_20a'&&!row.asset20aRef.trim())return stop('Identifique enquadramento dos bens20(1)a eafectação ao activo imobilizado,com referência/âmbito.');
|
||||
result.classification='assimilated_goods';
|
||||
if(currency!=='MZN'||row.currency!==currency)return stop('Operação3(3)'+rule.clause+' identificada;moeda fora do recorteMZN ou divergente,base indeterminada,sem conversão silenciosa.');
|
||||
if(!['acquisition','cost'].includes(row.valuationMode))return stop('Operação3(3)'+rule.clause+' identificada;base15(2)b por esclarecer:preço aquisição ou,na sua falta demonstrada,preço custo,reportados ao momento da operação.');
|
||||
if(row.conditions.valuationConfirmed!=='yes'||!validDate(row.valuationDate)||row.valuationDate!==row.operationDate||!row.valuationScope.trim())return stop('Operação assimilada identificada;base por esclarecer. Confirme preço de aquisição/custo reportado ao momento desta operação,data/âmbito ecomposição sem próprioIVA;não usar custo histórico automaticamente.');
|
||||
if(row.valuationMode==='cost'&&row.conditions.acquisitionUnavailable!=='yes')return stop('Operação assimilada identificada;não substituir aquisição desconhecida por custo. O custo15(2)b só é usado na falta demonstrada de preço aquisição;conferir esse facto.');
|
||||
const raw=row.valuationMode==='acquisition'?row.acquisitionPrice:row.currentCost,ref=row.valuationMode==='acquisition'?row.acquisitionRef:row.costRef;const amount=decimal(raw);
|
||||
if(amount===null||!ref.trim())return stop('Operação assimilada identificada;indique o preço e referência correspondentes ao modo escolhido,reportados ao momento da operação;desconhecido não é zero.');
|
||||
return{...result,status:'determined',baseAmount:money(amount),reason:`P124:transmissão assimilada3(3)${rule.clause};P088:base15(2)b=${money(amount)}MZN,${row.valuationMode==='acquisition'?'preço aquisição':'preço custo,na falta demonstrada de preço aquisição'},reportado a${row.operationDate},${row.origin==='projected'?'sob pressupostos expressos':'segundo dados efectivos declarados'}. Dedução anterior total/parcial é facto histórico dos bens/elementos,não nova dedução/campo11. Não confundir afectação/transmissão de bens comserviço por uso temporárioP089. Sem calcular IVA,taxa,regularização ou totaisModeloA.`};
|
||||
}
|
||||
|
||||
function key(draft:Record<string,unknown>,book:GoodsAllocationBook):string{return JSON.stringify({version:goodsAllocationVersion,scope:acquisitionScope(draft),location:draft.selection_labels??{},currency:draft.currency,rows:book.rows});}
|
||||
export function goodsAllocationCurrent(draft:Record<string,unknown>,book:GoodsAllocationBook):boolean{return!!book.result&&book.result.sourceKey===key(draft,book);}
|
||||
export function recordGoodsAllocations(draft:Record<string,unknown>,book:GoodsAllocationBook):GoodsAllocationBook{
|
||||
if(!book.rows.length||new Set(book.rows.map(row=>row.id)).size!==book.rows.length)throw new Error('Indique operações com identificadores distintos;originais conservados.');
|
||||
const result:GoodsAllocationCalculation={version:goodsAllocationVersion,revision:(book.result?.revision??0)+1,calculatedAt:new Date().toISOString(),opportunity:acquisitionScope(draft),location:JSON.stringify(draft.selection_labels??{}),sourceKey:key(draft,book),source:goodsAllocationSource,inputs:structuredClone(book.rows),rows:book.rows.map(row=>evaluateGoodsAllocation(row,draft.currency))};
|
||||
const next={...book,result,history:[...(book.history??[]),...(book.result?[book.result]:[])]};saveGoodsAllocationBook(draft,next);return next;
|
||||
}
|
||||
export function goodsAllocationReportRows(draft:Record<string,unknown>):Array<[string,string,string,string]>{
|
||||
try{const book=goodsAllocationBook(draft),result=book.result;if(!result)return[];return result.inputs.map((row,index)=>{const line=result.rows[index],rule=goodsAllocationTreatments.find(t=>t.id===row.treatment);return['IVA mensal',`Afectação P124/baseP088 — ${row.period} — ${row.id}`,`${row.description};classificação:${line.classification==='assimilated_goods'?'Transmissão assimilada de bens':line.classification==='not_applicable'?'Percurso não aplicável':'Indeterminada'};base:${line.baseAmount??'Indeterminada'} ${row.currency};IVA: Indeterminado;${line.reason}`,`${result.opportunity};${result.location};${goodsAllocationCurrent(draft,book)?'Resultado actual':'Entradas alteradas;resultado histórico conservado'};versão${result.revision};${result.calculatedAt};${result.source};${row.origin==='projected'?'Projecção':'Dados efectivos declarados'};${rule?.label??'Percurso por indicar'};operação ${row.operationRef},${row.operationDate};bens ${row.goodsRef};dedução histórica ${row.deductionRef};destino ${row.destinationRef};${rule?.clause==='e'?`excepção amostras/ofertas ${row.exceptionRef};`:''}${row.treatment==='fixed_asset_20a'?`enquadramento20(1)a ${row.asset20aRef};`:''}base ${row.valuationMode};${row.valuationMode==='cost'?`custo ${row.currentCost},${row.costRef};falta aquisição ${row.conditions.acquisitionUnavailable??'por indicar'}`:`aquisição ${row.acquisitionPrice},${row.acquisitionRef}`};data/âmbito base ${row.valuationDate},${row.valuationScope};documento ${row.documentRef},${row.documentDate};condições ${[...goodsAllocationConditions,...allocationSpecificConditions(row.treatment)].map(([key,label])=>label+': '+(row.conditions[key]==='yes'?'Sim':row.conditions[key]==='no'?'Não':'Por indicar')).join('; ')};fundamento ${row.evidence};sem nova dedução/campo11/IVA/regularização/totaisModeloA.`];});}
|
||||
catch{return[['IVA mensal','Afectação de bens','Dados não recuperáveis','Originais preservados;sem base ou classificação por defeito.']];}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
import {acquisitionScope,readAcquisitionStore} from './iva-acquisitions.ts';
|
||||
|
||||
export const secondhandVersion='secondhand-individual-margin/1';
|
||||
export const secondhandSource='CIVA3(3)g/3(6),15(2)f/g,Lei13/2016PDF7/13;Lei22/2022PDF3mantém15f/g efixa17(1)16%;Lei10/2025não altera15/17,revoga regimes35/42. RIVADecreto7/2008arts47–49,BR16-I16/04/2008PDF8–9/p106–107:revenda porbem,margem positiva dividida por1.16 ebase arredondada à unidade;sem compensar perdas entrebens. Leilão:facturado−líquidocomitente−IVApróprio identificado,líquido=adjudicação−comissão. ClassificaçãoP125 separada da baseP092/P093. Sem nova dedução/campo11,isenção automática,IVA calculado ou totaisModeloA.';
|
||||
export const secondhandTreatments=[{id:'reseller_margin',branch:'P092',label:'Revendedor — margem individual'},{id:'auction_margin',branch:'P093',label:'Organizador emnome próprio — venda em leilão'}] as const;
|
||||
export const secondhandCategories=[{id:'used_goods',label:'Bem móvel usado3(6)a'},{id:'art',label:'Objecto de arte3(6)b'},{id:'collection',label:'Objecto de colecção3(6)c'},{id:'antique',label:'Antiguidade3(6)d'}] as const;
|
||||
export const secondhandConditions=[['goodsIdentity','Bem individual identificado,com aquisição,transmissão e referências correspondentes'],['operatorRole','Sujeito passivo revendedor ou organizador de leilão identificado,no exercício da actividade epercurso escolhido']] as const;
|
||||
export const categoryConditions={
|
||||
used_goods:[['reusableUsed','Bem móvel usado susceptível de reutilização no estado ou após reparação'],['notRenewedTransformed','Não é renovado nem transformado:renovado se materiais de reparação excedem aquisição+mão-de-obra;transformado se reparação modifica características essenciais'],['notPreciousExcluded','Não são pedras/metais preciosos excluídos3(6)a;moedas/artefactos desses materiais não são excluídos só por esse motivo']],
|
||||
art:[['artistOriginal','Obra da autoria do artista,no âmbito3(6)b;sem desenho industrial,ourivesaria ou joalharia']],
|
||||
collection:[['collectionNature','Objecto de colecção no âmbito3(6)c,com natureza e características identificadas']],
|
||||
antique:[['notArtCollection','Não é objecto de arte ou de colecção já classificado nessas categorias']],
|
||||
} as const;
|
||||
export function secondhandCategoryConditions(category:string):ReadonlyArray<readonly[string,string]>{return categoryConditions[category as keyof typeof categoryConditions]??[];}
|
||||
type Choice=''|'yes'|'no';type Condition=typeof secondhandConditions[number][0];
|
||||
export type SecondhandRow={id:string;treatment:string;category:string;description:string;period:string;origin:'projected'|'effective';currency:string;operationDate:string;operationRef:string;documentRef:string;documentDate:string;goodsRef:string;operatorRef:string;categoryRef:string;artSubtype:string;editionCount:string;ceramicUniqueSigned:string;collectionSubtype:string;postalNotCirculating:string;ageYears:string;sourceType:string;sourceRef:string;domesticPurchase:string;regimeChoice:string;domesticTaxable:string;grossSale:string;purchasePrice:string;purchaseRef:string;grossInvoice:string;hammerPrice:string;principalCommission:string;auctionRef:string;principalRef:string;ownVat:string;ownVatRef:string;scope:string;evidence:string;conditions:Partial<Record<string,Choice>>};
|
||||
type LineResult={id:string;status:'determined'|'not_applicable'|'indeterminate';classification:'qualified_goods'|'not_applicable'|'indeterminate';baseAmount:string|null;grossMargin:string|null;principalNet:string|null;baseDivisorRate:string|null;vat:null;rate:null;reason:string};
|
||||
export type SecondhandCalculation={version:string;revision:number;calculatedAt:string;opportunity:string;location:string;sourceKey:string;source:string;inputs:SecondhandRow[];rows:LineResult[]};
|
||||
export type SecondhandBook={rows:SecondhandRow[];result?:SecondhandCalculation;history?:SecondhandCalculation[]};
|
||||
type Store=ReturnType<typeof readAcquisitionStore>&{regulatedSecondhands?:Record<string,SecondhandBook>};
|
||||
export function newSecondhand(id:string,currency:string):SecondhandRow{return{id,treatment:'',category:'',description:'',period:'',origin:'projected',currency,operationDate:'',operationRef:'',documentRef:'',documentDate:'',goodsRef:'',operatorRef:'',categoryRef:'',artSubtype:'',editionCount:'',ceramicUniqueSigned:'',collectionSubtype:'',postalNotCirculating:'',ageYears:'',sourceType:'',sourceRef:'',domesticPurchase:'',regimeChoice:'',domesticTaxable:'',grossSale:'',purchasePrice:'',purchaseRef:'',grossInvoice:'',hammerPrice:'',principalCommission:'',auctionRef:'',principalRef:'',ownVat:'',ownVatRef:'',scope:'',evidence:'',conditions:{}};}
|
||||
export function switchSecondhandTreatment(row:SecondhandRow,treatment:string):SecondhandRow{return{...row,treatment,conditions:{...row.conditions,regimeConfirmed:'',compositionConfirmed:''}};}
|
||||
export function switchSecondhandCategory(row:SecondhandRow,category:string):SecondhandRow{return{...row,category,conditions:Object.fromEntries(secondhandConditions.map(([key])=>[key,row.conditions[key]??'']))};}
|
||||
|
||||
function readStore(draft:Record<string,unknown>):Store{
|
||||
const store=readAcquisitionStore(draft.modelo_a_snapshot) as Store;
|
||||
if(store.regulatedSecondhands!==undefined&&(!store.regulatedSecondhands||typeof store.regulatedSecondhands!=='object'||Array.isArray(store.regulatedSecondhands)))throw new Error('Afectações de bens não recuperáveis;originais preservados.');
|
||||
const fields=Object.keys(newSecondhand('','')).filter(key=>key!=='conditions');
|
||||
for(const book of Object.values(store.regulatedSecondhands??{}))if(!book||!Array.isArray(book.rows)||(book.history!==undefined&&!Array.isArray(book.history))||book.rows.some(row=>!row||fields.some(key=>typeof row[key as keyof SecondhandRow]!=='string')||!row.conditions||typeof row.conditions!=='object'||Array.isArray(row.conditions)))throw new Error('Linhas de afectações de bens não recuperáveis;originais preservados,sem substituição por lista vazia.');
|
||||
return store;
|
||||
}
|
||||
export function secondhandBook(draft:Record<string,unknown>):SecondhandBook{return readStore(draft).regulatedSecondhands?.[acquisitionScope(draft)]??{rows:[]};}
|
||||
export function saveSecondhandBook(draft:Record<string,unknown>,book:SecondhandBook):string{const current=readStore(draft),encoded=JSON.stringify({...current,regulatedSecondhands:{...current.regulatedSecondhands,[acquisitionScope(draft)]:book}});readStore({...draft,modelo_a_snapshot:encoded});return encoded;}
|
||||
function decimal(raw:unknown):bigint|null{if(typeof raw!=='string'||!/^\d{1,15}(\.\d{1,6})?$/.test(raw.trim()))return null;const[whole,fraction='']=raw.trim().split('.');return BigInt(whole)*1000000n+BigInt(fraction.padEnd(6,'0'));}
|
||||
function money(n:bigint):string{return`${n/1000000n}.${(n%1000000n).toString().padStart(6,'0').replace(/0+$/,'').padEnd(2,'0')}`;}
|
||||
function validDate(value:string):boolean{const d=new Date(value+'T00:00:00Z');return /^\d{4}-\d{2}-\d{2}$/.test(value)&&Number.isFinite(d.getTime())&&d.toISOString().slice(0,10)===value;}
|
||||
export function evaluateSecondhand(row:SecondhandRow,currency:unknown):LineResult{
|
||||
const result:LineResult={id:row.id,status:'indeterminate',classification:'indeterminate',baseAmount:null,grossMargin:null,principalNet:null,baseDivisorRate:null,vat:null,rate:null,reason:''};const stop=(reason:string,status:LineResult['status']='indeterminate')=>({...result,status,reason});
|
||||
if(!secondhandTreatments.some(t=>t.id===row.treatment)||!secondhandCategories.some(c=>c.id===row.category))return stop('Identifique revendedor/leilão e categoria do bem;sem regime ou base por defeito.');
|
||||
if(!/^2026-(0[1-9]|1[0-2])$/.test(row.period)||!['projected','effective'].includes(row.origin)||!validDate(row.operationDate)||row.operationDate.slice(0,7)!==row.period)return stop('Identifique mês2026,data correspondente e natureza efectiva/projectada dos dados.');
|
||||
const required=[...secondhandConditions,...secondhandCategoryConditions(row.category)];if(required.some(([k])=>row.conditions[k]==='no'))return{...stop('Definição/estatuto deste percurso não correspondem aos factos;rever classificação3(6),sem basezero ou isenção presumida.','not_applicable'),classification:'not_applicable'};
|
||||
if(required.some(([k])=>row.conditions[k]!=='yes'))return stop('Natureza do bem ou estatuto do operador por esclarecer;desconhecido não é zero.');
|
||||
if(![row.description,row.operationRef,row.documentRef,row.goodsRef,row.operatorRef,row.categoryRef,row.scope,row.evidence].every(v=>!!v.trim())||!validDate(row.documentDate))return stop('Identifique bem individual,operador,categoria,operação,documento/data,âmbito e factos ou pressupostos expressos;sem certificado/aprovador novo.');
|
||||
if(row.category==='art'){
|
||||
if(!['original','print','sculpture','ceramic'].includes(row.artSubtype))return stop('Identifique pintura/desenho original,gravura/estampa/litografia,escultura/estatuária ou cerâmica.');
|
||||
if(row.artSubtype==='print'&&(!/^\d+$/.test(row.editionCount)||BigInt(row.editionCount)<1n))return stop('Identifique tiragem da gravura/estampa/litografia.');
|
||||
if(row.artSubtype==='print'&&BigInt(row.editionCount)>200n)return{...stop('Tiragem superior a200 não corresponde a esta definição de arte3(6)b.','not_applicable'),classification:'not_applicable'};
|
||||
if(row.artSubtype==='ceramic'&&row.ceramicUniqueSigned!=='yes')return stop('Esclareça se a cerâmica é exemplar único executado eassinado pelo artista3(6)b.');
|
||||
}
|
||||
if(row.category==='collection'&&(!['postal','scientific','historical'].includes(row.collectionSubtype)||(row.collectionSubtype==='postal'&&row.postalNotCirculating!=='yes')))return stop('Identifique colecção postal não emcirculação/nem destinada acircular,colecções/espécimes científicos ou interesse histórico/arqueológico/paleontológico/etnográfico/numismático3(6)c.');
|
||||
if(row.category==='antique'){
|
||||
const age=decimal(row.ageYears);if(age===null)return stop('Identifique idade emanos do bem.');if(age<=100000000n)return{...stop('A definição de antiguidade3(6)d exige mais de100anos.','not_applicable'),classification:'not_applicable'};
|
||||
}
|
||||
result.classification='qualified_goods';
|
||||
if(row.domesticPurchase!=='yes'||!row.sourceRef.trim())return stop('P125identificado;P092/P093 por esclarecer:origem nacional equalidade do fornecedor/comitente comreferência48(1)/49(1).');
|
||||
if(row.sourceType==='legacy_35_42')return stop('P125identificado;referência histórica aos regimes35/42 não activa margem em2026:Lei10/2025revogou essas subsecções. Conferir situação aplicável sem reactivar regime revogado.');
|
||||
if(!['private','margin_reseller','exempt_9_12_e'].includes(row.sourceType))return stop('P125identificado;origem elegível particular,revendedor na margem ou transmissão9(12)e não demonstrada. Outro regime permanece por esclarecer.');
|
||||
if(row.treatment==='reseller_margin'&&row.regimeChoice==='general')return stop('P125identificado;opção pelo regime geral47(1)não aplica esta fórmula de margem.','not_applicable');
|
||||
if(row.treatment==='reseller_margin'&&row.regimeChoice!=='margin')return stop('P125identificado;esclareça opção margem/regime geral do revendedor47(1).');
|
||||
if(row.domesticTaxable!=='yes'||row.conditions.regimeConfirmed!=='yes'||row.conditions.compositionConfirmed!=='yes')return stop('P125identificado;base por esclarecer:transmissão interna tributável,natureza/regime elegível ecomposição confirmados;exportação13/48(7)tem percurso próprio.');
|
||||
if(currency!=='MZN'||row.currency!==currency)return stop('P125identificado;base fora do recorteMZN ou moeda divergente,sem conversão silenciosa.');
|
||||
if(row.treatment==='reseller_margin'){
|
||||
const sale=decimal(row.grossSale),purchase=decimal(row.purchasePrice);if(sale===null||purchase===null||!row.purchaseRef.trim())return stop('Identifique contraprestação total devida pelocliente comIVA incluído epreço compra justificado do mesmo bem;desconhecido não é zero.');
|
||||
const diff=sale-purchase,positive=diff>0n?diff:0n,denominator=116000000n;const whole=(positive*100n+denominator/2n)/denominator;
|
||||
return{...result,status:'determined',baseAmount:money(whole*1000000n),grossMargin:diff<0n?'-'+money(-diff):money(diff),baseDivisorRate:'16%',reason:`P092:48(2)/(3)/(6),margem individual=${money(sale)}−${money(purchase)}=${diff<0n?'-'+money(-diff):money(diff)}MZN;parcela positiva÷1.16,base arredondada à unidade=${money(whole*1000000n)}MZN. ${diff<0n?'Excesso do preço compra registado neste bem,sem compensar outras transmissões;sem margem positiva tributável.':''} Taxa16% utilizada só no divisor da base17(1)/48(6)b;não há IVA ou dedução calculados. Factura com menção IVA-Bens emSegundaMão,sem discriminarIVA48(8)/(9);registos separados48(10)/(11).`};
|
||||
}
|
||||
const invoice=decimal(row.grossInvoice),hammer=decimal(row.hammerPrice),commission=decimal(row.principalCommission),tax=decimal(row.ownVat);
|
||||
if(invoice===null||hammer===null||commission===null||tax===null||![row.auctionRef,row.principalRef,row.ownVatRef].every(v=>!!v.trim()))return stop('Identifique montante facturado,adjudicação,comissão do comitente eIVApróprio relativo à transmissão,comreferências;IVA desconhecido não é zero.');
|
||||
if(commission>hammer)return stop('Comissão excede adjudicação;conferir componentes antes de determinar líquido comitente49(3).');
|
||||
const net=hammer-commission;if(invoice<net+tax)return stop('Facturado inferior ao líquido comitente+IVAindicado;conferir composição,sem base negativa ou zero substituto.');
|
||||
return{...result,status:'determined',baseAmount:money(invoice-net-tax),principalNet:money(net),reason:`P093:15(2)g/49(2)/(3),líquido comitente=${money(hammer)}−${money(commission)}=${money(net)}MZN;base=${money(invoice)}facturado−${money(net)}líquido−${money(tax)}IVApróprio identificado=${money(invoice-net-tax)}MZN. IVAindicado é componente referenciada,não calculada aqui. Factura IVA-Regime específico devendas emleilão,sem discriminarIVA49(5);relatório ao comitente em5dias úteis49(6)/(7),sem calendário de feriados presumido;contas deterceiros49(8). Sem nova dedução/campo11 ou totaisModeloA.`};
|
||||
}
|
||||
|
||||
function key(draft:Record<string,unknown>,book:SecondhandBook):string{return JSON.stringify({version:secondhandVersion,scope:acquisitionScope(draft),location:draft.selection_labels??{},currency:draft.currency,rows:book.rows});}
|
||||
export function secondhandCurrent(draft:Record<string,unknown>,book:SecondhandBook):boolean{return!!book.result&&book.result.sourceKey===key(draft,book);}
|
||||
export function recordSecondhands(draft:Record<string,unknown>,book:SecondhandBook):SecondhandBook{
|
||||
if(!book.rows.length||new Set(book.rows.map(row=>row.id)).size!==book.rows.length)throw new Error('Indique operações com identificadores distintos;originais conservados.');
|
||||
const result:SecondhandCalculation={version:secondhandVersion,revision:(book.result?.revision??0)+1,calculatedAt:new Date().toISOString(),opportunity:acquisitionScope(draft),location:JSON.stringify(draft.selection_labels??{}),sourceKey:key(draft,book),source:secondhandSource,inputs:structuredClone(book.rows),rows:book.rows.map(row=>evaluateSecondhand(row,draft.currency))};
|
||||
const next={...book,result,history:[...(book.history??[]),...(book.result?[book.result]:[])]};saveSecondhandBook(draft,next);return next;
|
||||
}
|
||||
export function secondhandReportRows(draft:Record<string,unknown>):Array<[string,string,string,string]>{
|
||||
try{const book=secondhandBook(draft),result=book.result;if(!result)return[];return result.inputs.map((row,i)=>{const line=result.rows[i],rule=secondhandTreatments.find(t=>t.id===row.treatment);return['IVA mensal',`Bem P125/base${rule?.branch??'margem'} — ${row.period} — ${row.id}`,`${row.description};P125:${line.classification==='qualified_goods'?'Categoria/estatuto identificados':line.classification==='not_applicable'?'Percurso não aplicável':'Indeterminado'};base:${line.baseAmount??'Indeterminada'} ${row.currency};IVA: Indeterminado;${line.reason}`,`${result.opportunity};${result.location};${secondhandCurrent(draft,book)?'Resultado actual':'Entradas alteradas;resultado histórico conservado'};versão${result.revision};${result.calculatedAt};${result.source};${row.origin==='projected'?'Projecção':'Dados efectivos declarados'};${rule?.label};categoria ${row.category},${row.categoryRef};critérios ${row.category==='art'?`${row.artSubtype},tiragem ${row.editionCount},cerâmica única/assinada ${row.ceramicUniqueSigned}`:row.category==='collection'?`${row.collectionSubtype},postal fora de circulação ${row.postalNotCirculating}`:row.category==='antique'?`idade ${row.ageYears} anos`:JSON.stringify(row.conditions)};bem ${row.goodsRef};operador ${row.operatorRef};origem ${row.sourceType},${row.sourceRef};operação ${row.operationRef},${row.operationDate};documento ${row.documentRef},${row.documentDate};${row.treatment==='reseller_margin'?`venda comIVA ${row.grossSale};compra ${row.purchasePrice},${row.purchaseRef};margem ${line.grossMargin??'indeterminada'};divisor ${line.baseDivisorRate??'indeterminado'}`:`facturado ${row.grossInvoice};adjudicação ${row.hammerPrice};comissão comitente ${row.principalCommission};líquido ${line.principalNet??'indeterminado'},${row.principalRef};IVAcomponente ${row.ownVat},${row.ownVatRef};leilão ${row.auctionRef}`};âmbito ${row.scope};fundamento ${row.evidence};sem nova dedução/campo11/totaisModeloA.`];});}
|
||||
catch{return[['IVA mensal','Bens usados/margem','Dados não recuperáveis','Originais preservados;sem base por defeito.']];}
|
||||
}
|
||||
@@ -19,6 +19,8 @@ import { serviceLocationReportRows } from './iva-service-location.ts';
|
||||
import { listedServiceReportRows } from './iva-listed-services.ts';
|
||||
import { reducedBaseReportRows } from './iva-reduced-bases.ts';
|
||||
import { ownNameReportRows } from './iva-own-name.ts';
|
||||
import { goodsAllocationReportRows } from './iva-goods-allocation.ts';
|
||||
import { secondhandReportRows } from './iva-secondhand.ts';
|
||||
import { offerPreparationReportRows } from './iva-offer-preparations.ts';
|
||||
import { salesReportRows } from './iva-operations.ts';
|
||||
import { fiscalQaRows } from './fiscal-qa-preview.ts';
|
||||
@@ -648,6 +650,8 @@ export function buildProjectDossierRows(
|
||||
rows.push(...listedServiceReportRows(draft));
|
||||
rows.push(...reducedBaseReportRows(draft));
|
||||
rows.push(...ownNameReportRows(draft));
|
||||
rows.push(...goodsAllocationReportRows(draft));
|
||||
rows.push(...secondhandReportRows(draft));
|
||||
rows.push(...offerPreparationReportRows(draft));
|
||||
const operationRows = salesReportRows(draft);
|
||||
rows.push(...operationRows);
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Str;
|
||||
use Tests\TestCase;
|
||||
|
||||
final class IvaGoodsAllocationDraftTest extends TestCase
|
||||
{
|
||||
use DatabaseTransactions;
|
||||
|
||||
public function test_goods_allocation_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-goods-allocation.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:353', $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['regulatedGoodsAllocations']['opportunity:353'];
|
||||
$this->assertCount(4, $book['rows']);
|
||||
$this->assertSame(['permanent_private_goods','free_goods_transfer','exempt_sector_goods','fixed_asset_20a'],array_column($book['rows'],'treatment'));
|
||||
$this->assertSame(['1000.25','800.15','1000.25','800.15'],array_column($book['result']['rows'],'baseAmount'));
|
||||
$this->assertSame(array_fill(0,4,'assimilated_goods'),array_column($book['result']['rows'],'classification'));
|
||||
foreach ($book['result']['rows'] as $row) {
|
||||
$this->assertNull($row['vat']);$this->assertNull($row['rate']);
|
||||
}
|
||||
$this->assertSame($book['rows'], $book['result']['inputs']);
|
||||
$this->assertCount(1, $book['history']);
|
||||
$this->assertSame('1000.25',$book['history'][0]['rows'][0]['baseAmount']);
|
||||
$frozen = json_decode(file_get_contents(base_path('tests/frontend/fixtures/iva-goods-allocation-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, ['regulatedGoodsAllocations' => 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-goods-allocation-20261025/recovered.json'), json_encode($recovered, JSON_THROW_ON_ERROR | JSON_UNESCAPED_UNICODE));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Str;
|
||||
use Tests\TestCase;
|
||||
|
||||
final class IvaSecondhandDraftTest extends TestCase
|
||||
{
|
||||
use DatabaseTransactions;
|
||||
|
||||
public function test_secondhand_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-secondhand.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:354', $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['regulatedSecondhands']['opportunity:354'];
|
||||
$this->assertCount(8, $book['rows']);
|
||||
$this->assertSame(array_merge(array_fill(0,4,'reseller_margin'),array_fill(0,4,'auction_margin')),array_column($book['rows'],'treatment'));
|
||||
$this->assertSame(array_merge(array_fill(0,4,'138.00'),array_fill(0,4,'344.83')),array_column($book['result']['rows'],'baseAmount'));
|
||||
$this->assertSame(array_fill(0,8,'qualified_goods'),array_column($book['result']['rows'],'classification'));
|
||||
foreach ($book['result']['rows'] as $row) {
|
||||
$this->assertNull($row['vat']);$this->assertNull($row['rate']);
|
||||
}
|
||||
$this->assertSame($book['rows'], $book['result']['inputs']);
|
||||
$this->assertCount(1, $book['history']);
|
||||
$this->assertSame('138.00',$book['history'][0]['rows'][0]['baseAmount']);
|
||||
$frozen = json_decode(file_get_contents(base_path('tests/frontend/fixtures/iva-secondhand-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, ['regulatedSecondhands' => 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-secondhand-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
@@ -0,0 +1,29 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import fs from 'node:fs';
|
||||
import {newGoodsAllocation,switchAllocationTreatment,switchAllocationValuation,goodsAllocationConditions,allocationSpecificConditions,goodsAllocationTreatments,evaluateGoodsAllocation,recordGoodsAllocations,saveGoodsAllocationBook,goodsAllocationBook,goodsAllocationCurrent,goodsAllocationReportRows} from '../../resources/js/lib/iva-goods-allocation.ts';
|
||||
const frozen=JSON.parse(fs.readFileSync('tests/frontend/fixtures/iva-goods-allocation-preserved.json','utf8'));const draft={...frozen,currency:'MZN',context_opportunity:'opportunity:353',project_title:'SYNTHETIC QA — Afectação de bens / Manica'};
|
||||
function row(t){const cost=['free_goods_transfer','fixed_asset_20a'].includes(t);return{...newGoodsAllocation(t,'MZN'),treatment:t,description:'SYNTHETIC QA '+t,period:'2026-12',origin:'projected',operationDate:'2026-12-12',operationRef:'SYNTHETIC QA operação',documentRef:'SYNTHETIC QA documento/pressuposto',documentDate:'2026-12-12',goodsRef:'SYNTHETIC QA conjunto de bens/elementos',deductionRef:'SYNTHETIC QA dedução histórica parcial,bens/elementos identificados',destinationRef:'SYNTHETIC QA destino/finalidade/sector/activo eâmbito',exceptionRef:'SYNTHETIC QA factos fora da excepção de amostras/ofertas,não limiar inventado',asset20aRef:'SYNTHETIC QA bens20(1)a/activoimobilizado',valuationMode:cost?'cost':'acquisition',acquisitionPrice:'1000.25',acquisitionRef:'SYNTHETIC QA preço aquisição reportado ao momento',currentCost:'800.15',costRef:'SYNTHETIC QA custo reportado ao momento',valuationDate:'2026-12-12',valuationScope:'SYNTHETIC QA conjunto identificado/preço ao momento,semIVA',evidence:'SYNTHETIC QA pressupostos expressos',conditions:{...Object.fromEntries([...goodsAllocationConditions,...allocationSpecificConditions(t)].map(([key])=>[key,'yes'])),valuationConfirmed:'yes',acquisitionUnavailable:'yes'}};}
|
||||
for(const rule of goodsAllocationTreatments)test('P124/P088 '+rule.id+' ownfacts,historicaldeduction and base',()=>{
|
||||
const r=row(rule.id),result=evaluateGoodsAllocation(r,'MZN');assert.equal(result.status,'determined');assert.equal(result.classification,'assimilated_goods');assert.equal(result.baseAmount,r.valuationMode==='cost'?'800.15':'1000.25');assert.equal(result.vat,null);assert.equal(result.rate,null);
|
||||
for(const [key] of [...goodsAllocationConditions,...allocationSpecificConditions(rule.id)]){const missing=structuredClone(r);delete missing.conditions[key];assert.equal(evaluateGoodsAllocation(missing,'MZN').classification,'indeterminate');missing.conditions[key]='no';assert.equal(evaluateGoodsAllocation(missing,'MZN').status,'not_applicable');assert.equal(evaluateGoodsAllocation(missing,'MZN').baseAmount,null);}
|
||||
for(const field of ['description','operationRef','documentRef','goodsRef','deductionRef','destinationRef','evidence',...(rule.clause==='e'?['exceptionRef']:[]),...(rule.id==='fixed_asset_20a'?['asset20aRef']:[])])assert.equal(evaluateGoodsAllocation({...r,[field]:''},'MZN').classification,'indeterminate',field);
|
||||
for(const patch of [{operationDate:'2026-11-12'},{documentDate:'2026-02-30'},{period:'2025-12'}])assert.equal(evaluateGoodsAllocation({...r,...patch},'MZN').status,'indeterminate');
|
||||
});
|
||||
test('P124classification independentof missingP088base;no newdeduction and no temporaryservice substitution',()=>{
|
||||
const r=row('permanent_private_goods');for(const patch of [{valuationMode:''},{acquisitionPrice:''},{valuationDate:'2026-12-11'},{valuationScope:''},{currency:'USD'},{acquisitionRef:''}]){const result=evaluateGoodsAllocation({...r,...patch},'MZN');assert.equal(result.status,'indeterminate');assert.equal(result.classification,'assimilated_goods');assert.equal(result.baseAmount,null);}
|
||||
assert.match(evaluateGoodsAllocation(r,'MZN').reason,/não nova dedução/);assert.match(evaluateGoodsAllocation(r,'MZN').reason,/P089/);
|
||||
const noPrior=structuredClone(r);noPrior.conditions.priorDeduction='no';assert.equal(evaluateGoodsAllocation(noPrior,'MZN').classification,'not_applicable');assert.equal(evaluateGoodsAllocation(noPrior,'MZN').baseAmount,null);
|
||||
});
|
||||
test('P088costfallback explicit,currentmoment,hidden retention and exact amounts',()=>{
|
||||
const r=row('free_goods_transfer');for(const flag of ['','no']){const result=evaluateGoodsAllocation({...r,conditions:{...r.conditions,acquisitionUnavailable:flag}},'MZN');assert.equal(result.classification,'assimilated_goods');assert.equal(result.baseAmount,null);}
|
||||
assert.equal(evaluateGoodsAllocation({...r,acquisitionPrice:'999999'},'MZN').baseAmount,'800.15');assert.equal(evaluateGoodsAllocation({...r,currentCost:'0'},'MZN').baseAmount,'0.00');assert.equal(evaluateGoodsAllocation({...r,currentCost:'0.000001'},'MZN').baseAmount,'0.000001');for(const v of ['','-1','1e3','1,5'])assert.equal(evaluateGoodsAllocation({...r,currentCost:v},'MZN').baseAmount,null);
|
||||
const acquisition=switchAllocationValuation(r,'acquisition');assert.equal(acquisition.currentCost,r.currentCost);assert.equal(acquisition.acquisitionPrice,r.acquisitionPrice);assert.equal(acquisition.conditions.valuationConfirmed,'');assert.equal(evaluateGoodsAllocation(acquisition,'MZN').baseAmount,null);acquisition.conditions.valuationConfirmed='yes';assert.equal(evaluateGoodsAllocation(acquisition,'MZN').baseAmount,'1000.25');
|
||||
const changed=switchAllocationTreatment(r,'fixed_asset_20a');assert.equal(changed.exceptionRef,r.exceptionRef);assert.equal(changed.asset20aRef,r.asset20aRef);assert.equal(changed.conditions.fixedAsset,undefined);assert.equal(evaluateGoodsAllocation(changed,'MZN').classification,'indeterminate');
|
||||
});
|
||||
test('Sharedoperation under2requirements persists once;all previous books/history/report preserved',()=>{
|
||||
const rows=goodsAllocationTreatments.map(t=>row(t.id));let book=recordGoodsAllocations(draft,{rows});book=recordGoodsAllocations(draft,book);assert.equal(book.history.length,1);assert.notEqual(book.result.inputs,book.rows);
|
||||
const next={...draft,modelo_a_snapshot:saveGoodsAllocationBook(draft,book)};assert.deepEqual(goodsAllocationBook(next),book);assert.ok(goodsAllocationCurrent(next,book));assert.equal(goodsAllocationCurrent({...next,currency:'USD'},book),false);assert.equal(goodsAllocationCurrent({...next,context_opportunity:'other'},book),false);assert.equal(goodsAllocationReportRows(next).length,4);assert.ok(goodsAllocationReportRows(next).every(r=>r[1].includes('P124/baseP088')));
|
||||
const store=JSON.parse(next.modelo_a_snapshot);delete store.regulatedGoodsAllocations;assert.deepEqual(store,JSON.parse(frozen.modelo_a_snapshot));assert.throws(()=>recordGoodsAllocations(next,{rows:[rows[0],rows[0]]}));assert.throws(()=>goodsAllocationBook({...next,modelo_a_snapshot:JSON.stringify({...JSON.parse(next.modelo_a_snapshot),regulatedGoodsAllocations:[]})}));
|
||||
if(process.env.IVA_ALLOCATION_FIXTURE)fs.writeFileSync(process.env.IVA_ALLOCATION_FIXTURE,JSON.stringify(next,null,2)+'\n');
|
||||
});
|
||||
@@ -0,0 +1,27 @@
|
||||
import test from 'node:test';import assert from 'node:assert/strict';import fs from 'node:fs';
|
||||
import {newSecondhand,switchSecondhandTreatment,switchSecondhandCategory,secondhandConditions,secondhandCategoryConditions,secondhandTreatments,secondhandCategories,evaluateSecondhand,recordSecondhands,saveSecondhandBook,secondhandBook,secondhandCurrent,secondhandReportRows} from '../../resources/js/lib/iva-secondhand.ts';
|
||||
const frozen=JSON.parse(fs.readFileSync('tests/frontend/fixtures/iva-secondhand-preserved.json','utf8'));const draft={...frozen,currency:'MZN',context_opportunity:'opportunity:354',project_title:'SYNTHETIC QA — Segunda mão / Manica'};
|
||||
function row(t,c){return{...newSecondhand(t+'-'+c,'MZN'),treatment:t,category:c,description:'SYNTHETIC QA '+t+'/'+c,period:'2026-12',origin:'projected',operationDate:'2026-12-12',operationRef:'SYNTHETIC QA operação',documentRef:'SYNTHETIC QA documento/pressuposto',documentDate:'2026-12-12',goodsRef:'SYNTHETIC QA bem individual '+t+c,operatorRef:'SYNTHETIC QA estatuto operador',categoryRef:'SYNTHETIC QA características/definição3(6)',artSubtype:'print',editionCount:'200',ceramicUniqueSigned:'yes',collectionSubtype:'postal',postalNotCirculating:'yes',ageYears:'101',sourceType:'private',sourceRef:'SYNTHETIC QA origem particular nacional',domesticPurchase:'yes',regimeChoice:'margin',domesticTaxable:'yes',grossSale:'1160',purchasePrice:'1000',purchaseRef:'SYNTHETIC QA preço compra justificado',grossInvoice:'1300',hammerPrice:'1000',principalCommission:'100',auctionRef:'SYNTHETIC QA organizador emnome próprio/contrato comissão/leilão',principalRef:'SYNTHETIC QA comitente/líquido',ownVat:'55.17',ownVatRef:'SYNTHETIC QA IVApróprio transmissão identificado',scope:'SYNTHETIC QA bem/partes/operação/período',evidence:'SYNTHETIC QA pressupostos expressos',conditions:{...Object.fromEntries([...secondhandConditions,...secondhandCategoryConditions(c)].map(([k])=>[k,'yes'])),regimeConfirmed:'yes',compositionConfirmed:'yes'}};}
|
||||
for(const t of secondhandTreatments)for(const c of secondhandCategories)test(t.branch+'/P125 '+c.id+' ownfacts,eligibleorigin and specificformula',()=>{
|
||||
const r=row(t.id,c.id),result=evaluateSecondhand(r,'MZN');assert.equal(result.status,'determined');assert.equal(result.classification,'qualified_goods');assert.equal(result.baseAmount,t.id==='reseller_margin'?'138.00':'344.83');assert.equal(result.vat,null);assert.equal(result.rate,null);
|
||||
for(const [k] of [...secondhandConditions,...secondhandCategoryConditions(c.id)]){const missing=structuredClone(r);delete missing.conditions[k];assert.equal(evaluateSecondhand(missing,'MZN').classification,'indeterminate');missing.conditions[k]='no';assert.equal(evaluateSecondhand(missing,'MZN').classification,'not_applicable');assert.equal(evaluateSecondhand(missing,'MZN').baseAmount,null);}
|
||||
for(const field of ['description','operationRef','documentRef','goodsRef','operatorRef','categoryRef','scope','evidence'])assert.equal(evaluateSecondhand({...r,[field]:''},'MZN').classification,'indeterminate',field);
|
||||
for(const patch of [{period:'2025-12'},{operationDate:'2026-11-12'},{documentDate:'2026-02-30'},{currency:'USD'},{sourceType:'legacy_35_42'},{sourceType:'other'},{sourceRef:''},{domesticPurchase:''},{domesticTaxable:''}])assert.equal(evaluateSecondhand({...r,...patch},'MZN').baseAmount,null);
|
||||
assert.equal(evaluateSecondhand({...r,sourceType:'margin_reseller'},'MZN').status,'determined');assert.equal(evaluateSecondhand({...r,sourceType:'exempt_9_12_e'},'MZN').status,'determined');
|
||||
if(t.id==='reseller_margin'){assert.equal(evaluateSecondhand({...r,regimeChoice:'general'},'MZN').baseAmount,null);for(const field of ['grossSale','purchasePrice','purchaseRef'])assert.equal(evaluateSecondhand({...r,[field]:''},'MZN').baseAmount,null);}
|
||||
else{for(const field of ['grossInvoice','hammerPrice','principalCommission','ownVat','ownVatRef','auctionRef','principalRef'])assert.equal(evaluateSecondhand({...r,[field]:''},'MZN').baseAmount,null);assert.equal(evaluateSecondhand({...r,principalCommission:'1001'},'MZN').baseAmount,null);assert.equal(evaluateSecondhand({...r,ownVat:'401'},'MZN').baseAmount,null);}
|
||||
});
|
||||
test('P092 rounding towholeunit,zero vsunknown and negative individualmargin no compensation',()=>{
|
||||
const r=row('reseller_margin','used_goods');assert.equal(evaluateSecondhand({...r,grossSale:'1000.58'},'MZN').baseAmount,'1.00');assert.equal(evaluateSecondhand({...r,grossSale:'1000.579999'},'MZN').baseAmount,'0.00');assert.equal(evaluateSecondhand({...r,grossSale:'1000'},'MZN').baseAmount,'0.00');
|
||||
const loss=evaluateSecondhand({...r,grossSale:'900'},'MZN');assert.equal(loss.grossMargin,'-100.00');assert.equal(loss.baseAmount,'0.00');assert.match(loss.reason,/sem compensar/);assert.equal(evaluateSecondhand({...r,purchasePrice:''},'MZN').baseAmount,null);
|
||||
const positive=evaluateSecondhand(r,'MZN');assert.equal(positive.baseAmount,'138.00');assert.equal(positive.baseDivisorRate,'16%');assert.equal(positive.vat,null);
|
||||
});
|
||||
test('P125 boundaries and both switches preserve hidden values withoutautomaticregime',()=>{
|
||||
const art=row('reseller_margin','art');assert.equal(evaluateSecondhand({...art,editionCount:'201'},'MZN').classification,'not_applicable');assert.equal(evaluateSecondhand({...art,editionCount:''},'MZN').classification,'indeterminate');assert.equal(evaluateSecondhand({...art,artSubtype:'ceramic',ceramicUniqueSigned:''},'MZN').baseAmount,null);
|
||||
const antique=row('reseller_margin','antique');assert.equal(evaluateSecondhand({...antique,ageYears:'100'},'MZN').classification,'not_applicable');assert.equal(evaluateSecondhand({...antique,ageYears:'100.1'},'MZN').classification,'qualified_goods');
|
||||
const changed=switchSecondhandTreatment(art,'auction_margin');assert.equal(changed.grossSale,art.grossSale);assert.equal(changed.ownVat,art.ownVat);assert.equal(changed.conditions.compositionConfirmed,'');assert.equal(evaluateSecondhand(changed,'MZN').baseAmount,null);const cat=switchSecondhandCategory(art,'collection');assert.equal(cat.editionCount,'200');assert.equal(cat.conditions.collectionNature,undefined);
|
||||
});
|
||||
test('All8individualgoods persistwithhistory/report;all priorbooks preserved,noaggregateoffset',()=>{
|
||||
const rows=secondhandTreatments.flatMap(t=>secondhandCategories.map(c=>row(t.id,c.id)));let book=recordSecondhands(draft,{rows});book=recordSecondhands(draft,book);assert.equal(book.history.length,1);const next={...draft,modelo_a_snapshot:saveSecondhandBook(draft,book)};assert.deepEqual(secondhandBook(next),book);assert.ok(secondhandCurrent(next,book));assert.equal(secondhandCurrent({...next,currency:'USD'},book),false);assert.equal(secondhandReportRows(next).length,8);
|
||||
const store=JSON.parse(next.modelo_a_snapshot);delete store.regulatedSecondhands;assert.deepEqual(store,JSON.parse(frozen.modelo_a_snapshot));assert.throws(()=>recordSecondhands(next,{rows:[rows[0],rows[0]]}));assert.throws(()=>secondhandBook({...next,modelo_a_snapshot:JSON.stringify({...JSON.parse(next.modelo_a_snapshot),regulatedSecondhands:[]})}));if(process.env.IVA_SECONDHAND_FIXTURE)fs.writeFileSync(process.env.IVA_SECONDHAND_FIXTURE,JSON.stringify(next,null,2)+'\n');
|
||||
});
|
||||
Reference in New Issue
Block a user