From 81a7ef60daafa46762f8d1be3fc6111e022e83d7 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Fri, 15 Mar 2024 20:24:38 +0000 Subject: [PATCH] code fixes --- Admin/Install/db.json | 12 ++++++++++++ Admin/Install/taxcodes.json | 10 ++++++++++ Admin/Installer.php | 2 ++ Controller/ApiController.php | 2 ++ Models/TaxCode.php | 4 ++-- Models/TaxCodeMapper.php | 12 +++++++----- 6 files changed, 35 insertions(+), 7 deletions(-) diff --git a/Admin/Install/db.json b/Admin/Install/db.json index fe7cef1..cf99003 100755 --- a/Admin/Install/db.json +++ b/Admin/Install/db.json @@ -29,6 +29,18 @@ "name": "tax_code_input", "type": "INT(11)", "null": false + }, + "tax_code_tax1_account": { + "name": "tax_code_tax1_account", + "type": "VARCHAR(10)", + "null": false, + "default": null + }, + "tax_code_tax2_account": { + "name": "tax_code_tax2_account", + "type": "VARCHAR(10)", + "null": false, + "default": null } } }, diff --git a/Admin/Install/taxcodes.json b/Admin/Install/taxcodes.json index b36e59f..5830e47 100755 --- a/Admin/Install/taxcodes.json +++ b/Admin/Install/taxcodes.json @@ -73,6 +73,8 @@ "percentage_invoice": 70000, "percentage_sales_tax": 70000, "percentage_input_tax": 70000, + "tax1_account": "1571", + "tax2_account": null, "tax_report": { "base": null, "amount": 43 @@ -92,6 +94,8 @@ "percentage_invoice": 190000, "percentage_sales_tax": 190000, "percentage_input_tax": 190000, + "tax1_account": "1576", + "tax2_account": null, "tax_report": { "base": null, "amount": 43 @@ -130,6 +134,8 @@ "percentage_invoice": 70000, "percentage_sales_tax": 70000, "percentage_input_tax": 70000, + "tax1_account": null, + "tax2_account": "1771", "tax_report": { "base": null, "amount": 43 @@ -149,6 +155,8 @@ "percentage_invoice": 190000, "percentage_sales_tax": 190000, "percentage_input_tax": 190000, + "tax1_account": null, + "tax2_account": "1776", "tax_report": { "base": null, "amount": 43 @@ -168,6 +176,8 @@ "percentage_invoice": 0, "percentage_sales_tax": 190000, "percentage_input_tax": 190000, + "tax1_account": "1574", + "tax2_account": "1774", "tax_report": { "base": null, "amount": 43 diff --git a/Admin/Installer.php b/Admin/Installer.php index 9638459..02ad2e4 100755 --- a/Admin/Installer.php +++ b/Admin/Installer.php @@ -80,6 +80,8 @@ final class Installer extends InstallerAbstract $request->setData('abbr', $data['abbr'] ?? ''); $request->setData('percentage_invoice', $data['percentage_invoice'] ?? 0); $request->setData('percentage_sales_tax', $data['percentage_sales_tax'] ?? 0); + $request->setData('tax1', $data['tax1_account'] ?? null); + $request->setData('tax2', $data['tax2_account'] ?? null); $request->setData('percentage_input_tax', $data['percentage_input_tax'] ?? 0); $request->setData('title', \reset($data['l11n'])['title'] ?? ''); $request->setData('short', \reset($data['l11n'])['short'] ?? ''); diff --git a/Controller/ApiController.php b/Controller/ApiController.php index fa8f983..95e02cd 100755 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -97,6 +97,8 @@ final class ApiController extends Controller $code->percentageInvoice = $request->getDataInt('percentage_invoice') ?? 0; $code->percentageSales = $request->getDataInt('percentage_sales_tax') ?? 0; $code->percentageInput = $request->getDataInt('percentage_input_tax') ?? 0; + $code->taxAccount1 = $request->getDataString('tax1'); + $code->taxAccount2 = $request->getDataString('tax2'); if ($request->hasData('title')) { $code->l11n->title = $request->getDataString('title') ?? ''; diff --git a/Models/TaxCode.php b/Models/TaxCode.php index 0bcb769..b81f1e5 100755 --- a/Models/TaxCode.php +++ b/Models/TaxCode.php @@ -44,9 +44,9 @@ class TaxCode implements \JsonSerializable // 1. Account (gross postings are automatically split) // 2. Tax code // 3. Tax combination - public ?int $taxAccount1 = null; + public ?string $taxAccount1 = null; - public ?int $taxAccount2 = null; + public ?string $taxAccount2 = null; /** * Localization. diff --git a/Models/TaxCodeMapper.php b/Models/TaxCodeMapper.php index 03e3f99..73e094b 100755 --- a/Models/TaxCodeMapper.php +++ b/Models/TaxCodeMapper.php @@ -36,11 +36,13 @@ final class TaxCodeMapper extends DataMapperFactory * @since 1.0.0 */ public const COLUMNS = [ - 'tax_code_id' => ['name' => 'tax_code_id', 'type' => 'int', 'internal' => 'id'], - 'tax_code_abbr' => ['name' => 'tax_code_abbr', 'type' => 'string', 'internal' => 'abbr'], - 'tax_code_invoice' => ['name' => 'tax_code_invoice', 'type' => 'int', 'internal' => 'percentageInvoice'], - 'tax_code_sales' => ['name' => 'tax_code_sales', 'type' => 'int', 'internal' => 'percentageSales'], - 'tax_code_input' => ['name' => 'tax_code_input', 'type' => 'int', 'internal' => 'percentageInput'], + 'tax_code_id' => ['name' => 'tax_code_id', 'type' => 'int', 'internal' => 'id'], + 'tax_code_abbr' => ['name' => 'tax_code_abbr', 'type' => 'string', 'internal' => 'abbr'], + 'tax_code_invoice' => ['name' => 'tax_code_invoice', 'type' => 'int', 'internal' => 'percentageInvoice'], + 'tax_code_sales' => ['name' => 'tax_code_sales', 'type' => 'int', 'internal' => 'percentageSales'], + 'tax_code_input' => ['name' => 'tax_code_input', 'type' => 'int', 'internal' => 'percentageInput'], + 'tax_code_tax1_account' => ['name' => 'tax_code_tax1_account', 'type' => 'string', 'internal' => 'taxAccount1'], + 'tax_code_tax2_account' => ['name' => 'tax_code_tax2_account', 'type' => 'string', 'internal' => 'taxAccount2'], ]; /**