diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e1e05f8..278096d 100755 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -13,10 +13,15 @@ on: - cron: '0 0 1,15 * *' jobs: - general_module_workflow: + general_module_workflow_php: uses: Karaka-Management/Karaka/.github/workflows/php_template.yml@develop secrets: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} GH_PAT: ${{ secrets.GH_PAT }} CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - + general_module_workflow_js: + uses: Karaka-Management/Karaka/.github/workflows/js_template.yml@develop + secrets: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_PAT: ${{ secrets.GH_PAT }} + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} \ No newline at end of file diff --git a/Admin/Install/Admin.install.php b/Admin/Install/Admin.install.php index 0fd52fb..9f802bd 100644 --- a/Admin/Install/Admin.install.php +++ b/Admin/Install/Admin.install.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules\Billing\Admin * @copyright Dennis Eichhorn @@ -23,4 +23,18 @@ return [ 'pattern' => '', 'module' => ApiController::NAME, ], + [ + 'type' => 'setting', + 'name' => SettingsEnum::BILLING_DOCUMENT_SPACER_COLOR, + 'content' => '15613766', + 'pattern' => '\d', + 'module' => ApiController::NAME, + ], + [ + 'type' => 'setting', + 'name' => SettingsEnum::BILLING_DOCUMENT_SPACER_TOLERANCE, + 'content' => '175', + 'pattern' => '\d', + 'module' => ApiController::NAME, + ], ]; diff --git a/Admin/Install/Admin.php b/Admin/Install/Admin.php index a21cb13..8e824c4 100755 --- a/Admin/Install/Admin.php +++ b/Admin/Install/Admin.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules\Billing\Admin\Install * @copyright Dennis Eichhorn diff --git a/Admin/Install/Media.php b/Admin/Install/Media.php index 3dae6c2..2b24a4b 100755 --- a/Admin/Install/Media.php +++ b/Admin/Install/Media.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules\Billing\Admin\Install * @copyright Dennis Eichhorn diff --git a/Admin/Install/Media/bill.pdf.php b/Admin/Install/Media/bill.pdf.php index cb92fd3..1210ee9 100755 --- a/Admin/Install/Media/bill.pdf.php +++ b/Admin/Install/Media/bill.pdf.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules\Media * @copyright Dennis Eichhorn diff --git a/Admin/Install/Media/lang.php b/Admin/Install/Media/lang.php index 7c11b32..052825a 100755 --- a/Admin/Install/Media/lang.php +++ b/Admin/Install/Media/lang.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * Bill localization. * diff --git a/Admin/Install/Messages.php b/Admin/Install/Messages.php index 670cff7..65290cf 100755 --- a/Admin/Install/Messages.php +++ b/Admin/Install/Messages.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules\Billing\Admin\Install * @copyright Dennis Eichhorn diff --git a/Admin/Install/Navigation.install.json b/Admin/Install/Navigation.install.json index 61df907..fd4a60e 100755 --- a/Admin/Install/Navigation.install.json +++ b/Admin/Install/Navigation.install.json @@ -5,7 +5,7 @@ "type": 2, "subtype": 1, "name": "Billing", - "uri": "{/base}/sales/bill/list?{?}", + "uri": "{/base}/sales/bill/list", "target": "self", "icon": null, "order": 10, @@ -19,7 +19,7 @@ "type": 3, "subtype": 1, "name": "Open", - "uri": "{/base}/sales/bill/list?{?}", + "uri": "{/base}/sales/bill/list", "target": "self", "icon": null, "order": 1, @@ -34,7 +34,7 @@ "type": 3, "subtype": 1, "name": "Archive", - "uri": "{/base}/sales/bill/archive?{?}", + "uri": "{/base}/sales/bill/archive", "target": "self", "icon": null, "order": 5, @@ -49,7 +49,7 @@ "type": 3, "subtype": 1, "name": "Create", - "uri": "{/base}/sales/bill/create?{?}", + "uri": "{/base}/sales/bill/create", "target": "self", "icon": null, "order": 10, @@ -60,11 +60,11 @@ }, { "id": 1005104401, - "pid": "/sales/bill", + "pid": "/bill/payment", "type": 3, "subtype": 1, "name": "PaymentTerms", - "uri": "{/base}/bill/payment/list?{?}", + "uri": "{/base}/bill/payment/list", "target": "self", "icon": null, "order": 15, @@ -75,11 +75,11 @@ }, { "id": 1005104501, - "pid": "/sales/bill", + "pid": "/bill/shipping", "type": 3, "subtype": 1, "name": "ShippingTerms", - "uri": "{/base}/bill/shipping/list?{?}", + "uri": "{/base}/bill/shipping/list", "target": "self", "icon": null, "order": 20, @@ -96,7 +96,7 @@ "type": 2, "subtype": 1, "name": "Billing", - "uri": "{/base}/purchase/bill/list?{?}", + "uri": "{/base}/purchase/bill/list", "target": "self", "icon": null, "order": 10, @@ -110,7 +110,7 @@ "type": 3, "subtype": 1, "name": "Open", - "uri": "{/base}/purchase/bill/list?{?}", + "uri": "{/base}/purchase/bill/list", "target": "self", "icon": null, "order": 1, @@ -125,7 +125,7 @@ "type": 3, "subtype": 1, "name": "Archive", - "uri": "{/base}/purchase/bill/archive?{?}", + "uri": "{/base}/purchase/bill/archive", "target": "self", "icon": null, "order": 5, @@ -140,7 +140,7 @@ "type": 3, "subtype": 1, "name": "Create", - "uri": "{/base}/purchase/bill/create?{?}", + "uri": "{/base}/purchase/bill/create", "target": "self", "icon": null, "order": 10, @@ -155,7 +155,7 @@ "type": 3, "subtype": 1, "name": "Upload", - "uri": "{/base}/purchase/bill/upload?{?}", + "uri": "{/base}/purchase/bill/upload", "target": "self", "icon": null, "order": 15, @@ -172,7 +172,7 @@ "type": 2, "subtype": 1, "name": "Billing", - "uri": "{/base}/warehouse/bill/list?{?}", + "uri": "{/base}/warehouse/bill/list", "target": "self", "icon": null, "order": 5, @@ -186,7 +186,7 @@ "type": 3, "subtype": 1, "name": "List", - "uri": "{/base}/warehouse/bill/list?{?}", + "uri": "{/base}/warehouse/bill/list", "target": "self", "icon": null, "order": 1, @@ -201,7 +201,7 @@ "type": 3, "subtype": 1, "name": "Archive", - "uri": "{/base}/warehouse/bill/archive?{?}", + "uri": "{/base}/warehouse/bill/archive", "target": "self", "icon": null, "order": 1, @@ -216,7 +216,7 @@ "type": 3, "subtype": 1, "name": "Create", - "uri": "{/base}/warehouse/bill/create?{?}", + "uri": "{/base}/warehouse/bill/create", "target": "self", "icon": null, "order": 5, @@ -233,7 +233,7 @@ "type": 3, "subtype": 1, "name": "Bill", - "uri": "{/base}/purchase/analysis/bill?{?}", + "uri": "{/base}/purchase/analysis/bill", "target": "self", "icon": null, "order": 15, @@ -248,7 +248,7 @@ "type": 2, "subtype": 1, "name": "InvoiceRecognition", - "uri": "{/base}/private/purchase/recognition/dashboard?{?}", + "uri": "{/base}/private/purchase/recognition/dashboard", "target": "self", "icon": null, "order": 5, @@ -258,11 +258,11 @@ "children": [ { "id": 1005109101, - "pid": "/", + "pid": "/private/purchase/recognition", "type": 3, "subtype": 1, "name": "List", - "uri": "{/base}/private/purchase/recognition/dashboard?{?}", + "uri": "{/base}/private/purchase/recognition/dashboard", "target": "self", "icon": null, "order": 1, @@ -274,11 +274,11 @@ }, { "id": 1005109201, - "pid": "/", + "pid": "/private/purchase/recognition", "type": 3, "subtype": 1, "name": "Upload", - "uri": "{/base}/private/purchase/recognition/upload?{?}", + "uri": "{/base}/private/purchase/recognition/upload", "target": "self", "icon": null, "order": 5, @@ -296,7 +296,7 @@ "type": 2, "subtype": 1, "name": "InvoiceRecognition", - "uri": "{/base}/purchase/recognition/dashboard?{?}", + "uri": "{/base}/purchase/recognition/dashboard", "target": "self", "icon": null, "order": 5, @@ -306,11 +306,11 @@ "children": [ { "id": 1005110101, - "pid": "/", + "pid": "/purchase/recognition", "type": 3, "subtype": 1, "name": "List", - "uri": "{/base}/purchase/recognition/dashboard?{?}", + "uri": "{/base}/purchase/recognition/dashboard", "target": "self", "icon": null, "order": 1, @@ -322,11 +322,11 @@ }, { "id": 1005110201, - "pid": "/", + "pid": "/purchase/recognition", "type": 3, "subtype": 1, "name": "Upload", - "uri": "{/base}/purchase/recognition/upload?{?}", + "uri": "{/base}/purchase/recognition/upload", "target": "self", "icon": null, "order": 5, @@ -337,5 +337,51 @@ ] } ] + }, + { + "id": 1005103001, + "pid": "/", + "type": 2, + "subtype": 1, + "name": "TaxCombinations", + "uri": "{/base}/finance/tax/combination/list", + "target": "self", + "icon": null, + "order": 2, + "from": "Billing", + "permission": { "permission": 2, "category": null, "element": null }, + "parent": 1008101001, + "children": [ + { + "id": 1005103002, + "pid": "/finance/tax/combination", + "type": 3, + "subtype": 1, + "name": "List", + "uri": "{/base}/finance/tax/combination/list", + "target": "self", + "icon": null, + "order": 1, + "from": "Billing", + "permission": { "permission": 2, "category": null, "element": null }, + "parent": 1005103001, + "children": [] + }, + { + "id": 1005103003, + "pid": "/finance/tax/combination", + "type": 3, + "subtype": 1, + "name": "Create", + "uri": "{/base}/finance/tax/combination/create", + "target": "self", + "icon": null, + "order": 5, + "from": "Billing", + "permission": { "permission": 2, "category": null, "element": null }, + "parent": 1005103001, + "children": [] + } + ] } ] diff --git a/Admin/Install/Navigation.php b/Admin/Install/Navigation.php index 1ea6271..53726b5 100755 --- a/Admin/Install/Navigation.php +++ b/Admin/Install/Navigation.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules\Billing\Admin\Install * @copyright Dennis Eichhorn diff --git a/Admin/Install/Taxes/taxes.json b/Admin/Install/Taxes/taxes.json index 68e2d49..340a123 100644 --- a/Admin/Install/Taxes/taxes.json +++ b/Admin/Install/Taxes/taxes.json @@ -1,4 +1,11 @@ [ + { + "type": 1, + "item_code": "GENERAL", + "account_code": "EU_S", + "tax_code": "EU_S0", + "account": "8400" + }, { "type": 1, "item_code": "GENERAL", @@ -83,14 +90,14 @@ { "type": 1, "item_code": "GENERAL", - "account_code": "DE_0", + "account_code": "DE_S", "tax_code": "SBIZ_0", "account": "8195" }, { "type": 2, "item_code": "GENERAL", - "account_code": "DE_0", + "account_code": "DE_S", "tax_code": "SBIZ_0", "account": "3349" }, @@ -202,6 +209,12 @@ "account_code": "INT", "tax_code": "S0" }, + { + "type": 1, + "item_code": "SOFTWARE", + "account_code": "EU_S", + "tax_code": "EU_S0" + }, { "type": 1, "item_code": "SOFTWARE", @@ -285,14 +298,14 @@ { "type": 1, "item_code": "SOFTWARE", - "account_code": "DE_0", + "account_code": "DE_S", "tax_code": "SBIZ_0", "account": "8195" }, { "type": 2, "item_code": "SOFTWARE", - "account_code": "DE_0", + "account_code": "DE_S", "tax_code": "SBIZ_0", "account": "3349" }, @@ -404,6 +417,12 @@ "account_code": "INT", "tax_code": "S0" }, + { + "type": 1, + "item_code": "SERVICE", + "account_code": "EU_S", + "tax_code": "EU_S0" + }, { "type": 1, "item_code": "SERVICE", @@ -487,14 +506,14 @@ { "type": 1, "item_code": "SERVICE", - "account_code": "DE_0", + "account_code": "DE_S", "tax_code": "SBIZ_0", "account": "8195" }, { "type": 2, "item_code": "SERVICE", - "account_code": "DE_0", + "account_code": "DE_S", "tax_code": "SBIZ_0", "account": "3349" }, diff --git a/Admin/Install/WarehouseManagement.php b/Admin/Install/WarehouseManagement.php index a2ddcb1..5481bca 100755 --- a/Admin/Install/WarehouseManagement.php +++ b/Admin/Install/WarehouseManagement.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules\Billing\Admin\Install * @copyright Dennis Eichhorn diff --git a/Admin/Install/Workflow.php b/Admin/Install/Workflow.php index 90b087e..af99cf5 100755 --- a/Admin/Install/Workflow.php +++ b/Admin/Install/Workflow.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules\Billing\Admin\Install * @copyright Dennis Eichhorn diff --git a/Admin/Install/paymentterms.json b/Admin/Install/paymentterms.json index 394d4ef..02e9ec6 100644 --- a/Admin/Install/paymentterms.json +++ b/Admin/Install/paymentterms.json @@ -41,6 +41,27 @@ "de" : "Zahlung fällig 90 Tage nach Rechnungsdatum" } }, + { + "name": "Net 120", + "l11n": { + "en" : "Payment is due 120 days after the invoice date", + "de" : "Zahlung fällig 120 Tage nach Rechnungsdatum" + } + }, + { + "name": "Net 150", + "l11n": { + "en" : "Payment is due 150 days after the invoice date", + "de" : "Zahlung fällig 150 Tage nach Rechnungsdatum" + } + }, + { + "name": "Net 180", + "l11n": { + "en" : "Payment is due 180 days after the invoice date", + "de" : "Zahlung fällig 180 Tage nach Rechnungsdatum" + } + }, { "name": "COD", "l11n": { @@ -104,6 +125,34 @@ "de" : "3% Skonto innerhalb von 15 Tagen nach Rechnungsdatum, andernfalls fällig zum vollen Betrag nach 30 Tagen nach Rechnungsdatum" } }, + { + "name": "2/10 Net 60", + "l11n": { + "en" : "2% discount for payment within 10 days after invoice date; otherwise, the full amount is due in 60 days after invoice date", + "de" : "2% Skonto innerhalb von 10 Tagen nach Rechnungsdatum, andernfalls fällig zum vollen Betrag nach 60 Tagen nach Rechnungsdatum" + } + }, + { + "name": "3/10 Net 60", + "l11n": { + "en" : "3% discount for payment within 10 days after invoice date; otherwise, the full amount is due in 60 days after invoice date", + "de" : "3% Skonto innerhalb von 10 Tagen nach Rechnungsdatum, andernfalls fällig zum vollen Betrag nach 60 Tagen nach Rechnungsdatum" + } + }, + { + "name": "2/15 Net 60", + "l11n": { + "en" : "2% discount for payment within 15 days after invoice date; otherwise, the full amount is due in 60 days after invoice date", + "de" : "2% Skonto innerhalb von 15 Tagen nach Rechnungsdatum, andernfalls fällig zum vollen Betrag nach 60 Tagen nach Rechnungsdatum" + } + }, + { + "name": "3/15 Net 60", + "l11n": { + "en" : "3% discount for payment within 15 days after invoice date; otherwise, the full amount is due in 60 days after invoice date", + "de" : "3% Skonto innerhalb von 15 Tagen nach Rechnungsdatum, andernfalls fällig zum vollen Betrag nach 60 Tagen nach Rechnungsdatum" + } + }, { "name": "Escrow", "l11n": { diff --git a/Admin/Installer.php b/Admin/Installer.php index e5afc82..4cd261e 100755 --- a/Admin/Installer.php +++ b/Admin/Installer.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules\Billing\Admin * @copyright Dennis Eichhorn @@ -285,6 +285,12 @@ final class Installer extends InstallerAbstract ->where('name', 'sales_tax_code') ->execute(); + /** @var \Modules\Attribute\Models\AttributeType $itemAttributePurchase */ + $itemAttributePurchase = ItemAttributeTypeMapper::get() + ->with('defaults') + ->where('name', 'purchase_tax_code') + ->execute(); + /** @var \Modules\Attribute\Models\AttributeType $clientAttributeSales */ $clientAttributeSales = ClientAttributeTypeMapper::get() ->with('defaults') @@ -298,7 +304,10 @@ final class Installer extends InstallerAbstract ->execute(); foreach ($taxes as $tax) { - $itemValue = $itemAttributeSales->getDefaultByValue($tax['item_code']); + $itemValue = $tax['type'] === 1 + ? $itemAttributeSales->getDefaultByValue($tax['item_code']) + : $itemAttributePurchase->getDefaultByValue($tax['item_code']); + $accountValue = $tax['type'] === 1 ? $clientAttributeSales->getDefaultByValue($tax['account_code']) : $supplierAttributeSales->getDefaultByValue($tax['account_code']); diff --git a/Admin/Routes/Web/Api.php b/Admin/Routes/Web/Api.php index 44996e2..02b502f 100755 --- a/Admin/Routes/Web/Api.php +++ b/Admin/Routes/Web/Api.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules * @copyright Dennis Eichhorn @@ -22,6 +22,8 @@ return [ [ 'dest' => '\Modules\Billing\Controller\ApiBillController:apiMediaRender', 'verb' => RouteVerb::GET, + 'csrf' => true, + 'active' => true, 'permission' => [ 'module' => BackendController::NAME, 'type' => PermissionType::CREATE, @@ -33,6 +35,8 @@ return [ [ 'dest' => '\Modules\Billing\Controller\ApiBillController:apiPreviewRender', 'verb' => RouteVerb::GET, + 'csrf' => true, + 'active' => true, 'permission' => [ 'module' => BackendController::NAME, 'type' => PermissionType::CREATE, @@ -44,6 +48,8 @@ return [ [ 'dest' => '\Modules\Billing\Controller\ApiPriceController:apiPriceCreate', 'verb' => RouteVerb::GET, + 'csrf' => true, + 'active' => true, 'permission' => [ 'module' => BackendController::NAME, 'type' => PermissionType::CREATE, @@ -55,6 +61,8 @@ return [ [ 'dest' => '\Modules\Billing\Controller\ApiPurchaseController:apiInvoiceParse', 'verb' => RouteVerb::SET, + 'csrf' => true, + 'active' => true, 'permission' => [ 'module' => BackendController::NAME, 'type' => PermissionType::MODIFY, @@ -62,4 +70,17 @@ return [ ], ], ], + '^.*/purchase/recognition/upload(\?.*$|$)' => [ + [ + 'dest' => '\Modules\Billing\Controller\ApiPurchaseController:apiPurchaseBillUpload', + 'verb' => RouteVerb::SET, + 'csrf' => true, + 'active' => true, + 'permission' => [ + 'module' => BackendController::NAME, + 'type' => PermissionType::CREATE, + 'state' => PermissionCategory::PURCHASE_INVOICE, + ], + ], + ], ]; diff --git a/Admin/Routes/Web/Backend.php b/Admin/Routes/Web/Backend.php index 127427f..e383429 100755 --- a/Admin/Routes/Web/Backend.php +++ b/Admin/Routes/Web/Backend.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules * @copyright Dennis Eichhorn @@ -18,10 +18,11 @@ use phpOMS\Account\PermissionType; use phpOMS\Router\RouteVerb; return [ - '^.*/sales/bill/create(\?.*$|$)' => [ + '^/sales/bill/create(\?.*$|$)' => [ [ 'dest' => '\Modules\Billing\Controller\BackendController:viewBillingSalesInvoiceCreate', 'verb' => RouteVerb::GET, + 'active' => true, 'permission' => [ 'module' => BackendController::NAME, 'type' => PermissionType::CREATE, @@ -29,10 +30,11 @@ return [ ], ], ], - '^.*/sales/bill/list(\?.*$|$)' => [ + '^/sales/bill/list(\?.*$|$)' => [ [ 'dest' => '\Modules\Billing\Controller\BackendController:viewBillingSalesList', 'verb' => RouteVerb::GET, + 'active' => true, 'permission' => [ 'module' => BackendController::NAME, 'type' => PermissionType::READ, @@ -40,10 +42,11 @@ return [ ], ], ], - '^.*/sales/bill/archive(\?.*$|$)' => [ + '^/sales/bill/archive(\?.*$|$)' => [ [ 'dest' => '\Modules\Billing\Controller\BackendController:viewBillingSalesArchive', 'verb' => RouteVerb::GET, + 'active' => true, 'permission' => [ 'module' => BackendController::NAME, 'type' => PermissionType::READ, @@ -51,10 +54,11 @@ return [ ], ], ], - '^.*/sales/bill(\?.*$|$)' => [ + '^/sales/bill/view(\?.*$|$)' => [ [ 'dest' => '\Modules\Billing\Controller\BackendController:viewBillingSalesInvoice', 'verb' => RouteVerb::GET, + 'active' => true, 'permission' => [ 'module' => BackendController::NAME, 'type' => PermissionType::READ, @@ -63,10 +67,11 @@ return [ ], ], - '^.*/purchase/bill/create(\?.*$|$)' => [ + '^/purchase/bill/create(\?.*$|$)' => [ [ 'dest' => '\Modules\Billing\Controller\BackendController:viewBillingPurchaseInvoiceCreate', 'verb' => RouteVerb::GET, + 'active' => true, 'permission' => [ 'module' => BackendController::NAME, 'type' => PermissionType::CREATE, @@ -74,10 +79,11 @@ return [ ], ], ], - '^.*/purchase/bill/list(\?.*$|$)' => [ + '^/purchase/bill/list(\?.*$|$)' => [ [ 'dest' => '\Modules\Billing\Controller\BackendController:viewBillingPurchaseList', 'verb' => RouteVerb::GET, + 'active' => true, 'permission' => [ 'module' => BackendController::NAME, 'type' => PermissionType::READ, @@ -85,10 +91,11 @@ return [ ], ], ], - '^.*/purchase/bill/archive(\?.*$|$)' => [ + '^/purchase/bill/archive(\?.*$|$)' => [ [ 'dest' => '\Modules\Billing\Controller\BackendController:viewBillingPurchaseArchive', 'verb' => RouteVerb::GET, + 'active' => true, 'permission' => [ 'module' => BackendController::NAME, 'type' => PermissionType::READ, @@ -96,10 +103,11 @@ return [ ], ], ], - '^.*/purchase/bill(\?.*$|$)' => [ + '^/purchase/bill/view(\?.*$|$)' => [ [ 'dest' => '\Modules\Billing\Controller\BackendController:viewBillingPurchaseInvoice', 'verb' => RouteVerb::GET, + 'active' => true, 'permission' => [ 'module' => BackendController::NAME, 'type' => PermissionType::READ, @@ -107,22 +115,24 @@ return [ ], ], ], - '^.*/purchase/bill/upload(\?.*$|$)' => [ + '^/purchase/bill/upload(\?.*$|$)' => [ [ 'dest' => '\Modules\Billing\Controller\BackendController:viewBillingPurchaseInvoiceUpload', 'verb' => RouteVerb::GET, + 'active' => true, 'permission' => [ 'module' => BackendController::NAME, - 'type' => PermissionType::READ, + 'type' => PermissionType::CREATE, 'state' => PermissionCategory::SALES_INVOICE, ], ], ], - '^.*/warehouse/bill/create(\?.*$|$)' => [ + '^/warehouse/bill/create(\?.*$|$)' => [ [ 'dest' => '\Modules\Billing\Controller\BackendController:viewBillingStockInvoiceCreate', 'verb' => RouteVerb::GET, + 'active' => true, 'permission' => [ 'module' => BackendController::NAME, 'type' => PermissionType::CREATE, @@ -130,10 +140,11 @@ return [ ], ], ], - '^.*/warehouse/bill/list(\?.*$|$)' => [ + '^/warehouse/bill/list(\?.*$|$)' => [ [ 'dest' => '\Modules\Billing\Controller\BackendController:viewBillingStockList', 'verb' => RouteVerb::GET, + 'active' => true, 'permission' => [ 'module' => BackendController::NAME, 'type' => PermissionType::READ, @@ -141,10 +152,11 @@ return [ ], ], ], - '^.*/warehouse/bill/archive(\?.*$|$)' => [ + '^/warehouse/bill/archive(\?.*$|$)' => [ [ 'dest' => '\Modules\Billing\Controller\BackendController:viewBillingStockArchive', 'verb' => RouteVerb::GET, + 'active' => true, 'permission' => [ 'module' => BackendController::NAME, 'type' => PermissionType::READ, @@ -152,10 +164,11 @@ return [ ], ], ], - '^.*/warehouse/bill(\?.*$|$)' => [ + '^/warehouse/bill/view(\?.*$|$)' => [ [ 'dest' => '\Modules\Billing\Controller\BackendController:viewBillingStockInvoice', 'verb' => RouteVerb::GET, + 'active' => true, 'permission' => [ 'module' => BackendController::NAME, 'type' => PermissionType::READ, @@ -164,10 +177,11 @@ return [ ], ], - '^.*/private/purchase/recognition/dashboard(\?.*$|$)' => [ + '^/private/purchase/recognition/dashboard(\?.*$|$)' => [ [ 'dest' => '\Modules\Billing\Controller\BackendController:viewPrivatePurchaseBillDashboard', 'verb' => RouteVerb::GET, + 'active' => true, 'permission' => [ 'module' => BackendController::NAME, 'type' => PermissionType::READ, @@ -175,10 +189,47 @@ return [ ], ], ], - '^.*/private/purchase/recognition/upload(\?.*$|$)' => [ + '^/private/purchase/recognition/upload(\?.*$|$)' => [ [ 'dest' => '\Modules\Billing\Controller\BackendController:viewPrivatePurchaseBillUpload', 'verb' => RouteVerb::GET, + 'active' => true, + 'permission' => [ + 'module' => BackendController::NAME, + 'type' => PermissionType::CREATE, + 'state' => PermissionCategory::PRIVATE_BILL_UPLOAD, + ], + ], + ], + '^/private/purchase/recognition/bill(\?.*$|$)' => [ + [ + 'dest' => '\Modules\Billing\Controller\BackendController:viewPrivateBillingPurchaseInvoice', + 'verb' => RouteVerb::GET, + 'active' => true, + 'permission' => [ + 'module' => BackendController::NAME, + 'type' => PermissionType::READ, + 'state' => PermissionCategory::PRIVATE_DASHBOARD, + ], + ], + ], + '^/purchase/recognition/dashboard(\?.*$|$)' => [ + [ + 'dest' => '\Modules\Billing\Controller\BackendController:viewPrivatePurchaseBillDashboard', + 'verb' => RouteVerb::GET, + 'active' => true, + 'permission' => [ + 'module' => BackendController::NAME, + 'type' => PermissionType::READ, + 'state' => PermissionCategory::PRIVATE_DASHBOARD, + ], + ], + ], + '^/purchase/recognition/upload(\?.*$|$)' => [ + [ + 'dest' => '\Modules\Billing\Controller\BackendController:viewPrivatePurchaseBillUpload', + 'verb' => RouteVerb::GET, + 'active' => true, 'permission' => [ 'module' => BackendController::NAME, 'type' => PermissionType::READ, @@ -186,43 +237,11 @@ return [ ], ], ], - '^.*/private/purchase/recognition/bill(\?.*$|$)' => [ - [ - 'dest' => '\Modules\Billing\Controller\BackendController:viewPrivateBillingPurchaseInvoice', - 'verb' => RouteVerb::GET, - 'permission' => [ - 'module' => BackendController::NAME, - 'type' => PermissionType::READ, - 'state' => PermissionCategory::PRIVATE_DASHBOARD, - ], - ], - ], - '^.*/purchase/recognition/dashboard(\?.*$|$)' => [ - [ - 'dest' => '\Modules\Billing\Controller\BackendController:viewPrivatePurchaseBillDashboard', - 'verb' => RouteVerb::GET, - 'permission' => [ - 'module' => BackendController::NAME, - 'type' => PermissionType::READ, - 'state' => PermissionCategory::PRIVATE_DASHBOARD, - ], - ], - ], - '^.*/purchase/recognition/upload(\?.*$|$)' => [ - [ - 'dest' => '\Modules\Billing\Controller\BackendController:viewPrivatePurchaseBillUpload', - 'verb' => RouteVerb::GET, - 'permission' => [ - 'module' => BackendController::NAME, - 'type' => PermissionType::READ, - 'state' => PermissionCategory::PRIVATE_BILL_UPLOAD, - ], - ], - ], - '^.*/purchase/recognition/bill(\?.*$|$)' => [ + '^/purchase/recognition/bill(\?.*$|$)' => [ [ 'dest' => '\Modules\Billing\Controller\BackendController:viewPrivateBillingPurchaseInvoice', 'verb' => RouteVerb::GET, + 'active' => true, 'permission' => [ 'module' => BackendController::NAME, 'type' => PermissionType::READ, @@ -231,10 +250,11 @@ return [ ], ], - '^.*/bill/payment/list(\?.*$|$)' => [ + '^/bill/payment/list(\?.*$|$)' => [ [ 'dest' => '\Modules\Billing\Controller\BackendController:viewPaymentList', 'verb' => RouteVerb::GET, + 'active' => true, 'permission' => [ 'module' => BackendController::NAME, 'type' => PermissionType::READ, @@ -242,10 +262,11 @@ return [ ], ], ], - '^.*/bill/payment/view(\?.*$|$)' => [ + '^/bill/payment/view(\?.*$|$)' => [ [ 'dest' => '\Modules\Billing\Controller\BackendController:viewPaymentView', 'verb' => RouteVerb::GET, + 'active' => true, 'permission' => [ 'module' => BackendController::NAME, 'type' => PermissionType::READ, @@ -253,10 +274,11 @@ return [ ], ], ], - '^.*/bill/shipping/list(\?.*$|$)' => [ + '^/bill/shipping/list(\?.*$|$)' => [ [ 'dest' => '\Modules\Billing\Controller\BackendController:viewShippingList', 'verb' => RouteVerb::GET, + 'active' => true, 'permission' => [ 'module' => BackendController::NAME, 'type' => PermissionType::READ, @@ -264,10 +286,11 @@ return [ ], ], ], - '^.*/bill/shipping/view(\?.*$|$)' => [ + '^/bill/shipping/view(\?.*$|$)' => [ [ 'dest' => '\Modules\Billing\Controller\BackendController:viewShippingView', 'verb' => RouteVerb::GET, + 'active' => true, 'permission' => [ 'module' => BackendController::NAME, 'type' => PermissionType::READ, @@ -275,4 +298,41 @@ return [ ], ], ], + + '^/finance/tax/combination/list(\?.*$|$)' => [ + [ + 'dest' => '\Modules\Billing\Controller\BackendController:viewTaxCombinationList', + 'verb' => RouteVerb::GET, + 'active' => true, + 'permission' => [ + 'module' => BackendController::NAME, + 'type' => PermissionType::CREATE, + 'state' => PermissionCategory::TAX, + ], + ], + ], + '^/finance/tax/combination/view(\?.*$|$)' => [ + [ + 'dest' => '\Modules\Billing\Controller\BackendController:viewTaxCombinationView', + 'verb' => RouteVerb::GET, + 'active' => true, + 'permission' => [ + 'module' => BackendController::NAME, + 'type' => PermissionType::READ, + 'state' => PermissionCategory::TAX, + ], + ], + ], + '^/finance/tax/combination/create(\?.*$|$)' => [ + [ + 'dest' => '\Modules\Billing\Controller\BackendController:viewTaxCombinationCreate', + 'verb' => RouteVerb::GET, + 'active' => true, + 'permission' => [ + 'module' => BackendController::NAME, + 'type' => PermissionType::CREATE, + 'state' => PermissionCategory::TAX, + ], + ], + ], ]; diff --git a/Admin/Status.php b/Admin/Status.php index 56dbd72..dd2c072 100755 --- a/Admin/Status.php +++ b/Admin/Status.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules\Billing\Admin * @copyright Dennis Eichhorn diff --git a/Admin/Uninstaller.php b/Admin/Uninstaller.php index 01b6cab..4c4a813 100755 --- a/Admin/Uninstaller.php +++ b/Admin/Uninstaller.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules\Billing\Admin * @copyright Dennis Eichhorn diff --git a/Admin/Updater.php b/Admin/Updater.php index 401a3a1..aac801a 100755 --- a/Admin/Updater.php +++ b/Admin/Updater.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules\Billing\Admin * @copyright Dennis Eichhorn diff --git a/Controller/ApiAttributeController.php b/Controller/ApiAttributeController.php index 0fe467c..8e36469 100755 --- a/Controller/ApiAttributeController.php +++ b/Controller/ApiAttributeController.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules\Billing * @copyright Dennis Eichhorn @@ -40,7 +40,7 @@ final class ApiAttributeController extends Controller use \Modules\Attribute\Controller\ApiAttributeTraitController; /** - * Api method to create item attribute + * Api method to create Attribute * * @param RequestAbstract $request Request * @param ResponseAbstract $response Response @@ -217,7 +217,7 @@ final class ApiAttributeController extends Controller } /** - * Api method to update BillAttribute + * Api method to update bill Attribute * * @param RequestAbstract $request Request * @param ResponseAbstract $response Response @@ -268,7 +268,7 @@ final class ApiAttributeController extends Controller } /** - * Api method to delete BillAttribute + * Api method to delete bill Attribute * * @param RequestAbstract $request Request * @param ResponseAbstract $response Response @@ -305,7 +305,7 @@ final class ApiAttributeController extends Controller } /** - * Api method to update BillAttributeTypeL11n + * Api method to update bill AttributeTypeL11n * * @param RequestAbstract $request Request * @param ResponseAbstract $response Response @@ -363,7 +363,7 @@ final class ApiAttributeController extends Controller } /** - * Api method to update BillAttributeType + * Api method to update bill AttributeType * * @param RequestAbstract $request Request * @param ResponseAbstract $response Response @@ -393,7 +393,7 @@ final class ApiAttributeController extends Controller } /** - * Api method to delete BillAttributeType + * Api method to delete bill AttributeType * * @param RequestAbstract $request Request * @param ResponseAbstract $response Response @@ -423,7 +423,7 @@ final class ApiAttributeController extends Controller } /** - * Api method to update BillAttributeValue + * Api method to update bill AttributeValue * * @param RequestAbstract $request Request * @param ResponseAbstract $response Response @@ -460,7 +460,7 @@ final class ApiAttributeController extends Controller } /** - * Api method to delete BillAttributeValue + * Api method to delete bill AttributeValue * * @param RequestAbstract $request Request * @param ResponseAbstract $response Response @@ -491,7 +491,7 @@ final class ApiAttributeController extends Controller } /** - * Api method to update BillAttributeValueL11n + * Api method to update bill AttributeValueL11n * * @param RequestAbstract $request Request * @param ResponseAbstract $response Response @@ -521,7 +521,7 @@ final class ApiAttributeController extends Controller } /** - * Api method to delete BillAttributeValueL11n + * Api method to delete bill AttributeValueL11n * * @param RequestAbstract $request Request * @param ResponseAbstract $response Response diff --git a/Controller/ApiBillController.php b/Controller/ApiBillController.php index 2b84a91..dddecda 100755 --- a/Controller/ApiBillController.php +++ b/Controller/ApiBillController.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules\Billing * @copyright Dennis Eichhorn @@ -101,6 +101,8 @@ final class ApiBillController extends Controller * * @return void * + * @api + * * @since 1.0.0 */ public function apiBillEmail(RequestAbstract $request, array $data = []) : void @@ -440,7 +442,7 @@ final class ApiBillController extends Controller // @todo use bill and shipping address instead of main address if available // https://github.com/Karaka-Management/oms-Billing/issues/45 - $bill->billTo = $request->getDataString('billto') ?? $account->account->name1; + $bill->billTo = $request->getDataString('billto') ?? $account->account->name1 . ' ' . $account->account->name2; $bill->billAddress = $request->getDataString('billaddress') ?? $account->mainAddress->address; $bill->billCity = $request->getDataString('billtocity') ?? $account->mainAddress->city; $bill->billZip = $request->getDataString('billtopostal') ?? $account->mainAddress->postal; @@ -481,7 +483,7 @@ final class ApiBillController extends Controller $settings = $this->app->appSettings->get(null, SettingsEnum::VALID_BILL_LANGUAGES, unit: $this->app->unitId, - module: 'Admin' + module: self::NAME ); if (empty($settings)) { @@ -489,7 +491,7 @@ final class ApiBillController extends Controller $settings = $this->app->appSettings->get(null, SettingsEnum::VALID_BILL_LANGUAGES, unit: null, - module: 'Admin' + module: self::NAME ); } @@ -732,88 +734,40 @@ final class ApiBillController extends Controller $bill = BillMapper::get()->where('id', (int) $request->getData('bill'))->execute(); $path = $this->createBillDir($bill); - $uploaded = []; - if (!empty($uploadedFiles = $request->files)) { + $uploaded = new NullCollection(); + if (!empty($request->files)) { $uploaded = $this->app->moduleManager->get('Media', 'Api')->uploadFiles( names: [], fileNames: [], - files: $uploadedFiles, + files: $request->files, account: $request->header->account, basePath: __DIR__ . '/../../../Modules/Media/Files' . $path, virtualPath: $path, pathSettings: PathSettings::FILE_PATH, hasAccountRelation: false, - readContent: $request->getDataBool('parse_content') ?? false + readContent: $request->getDataBool('parse_content') ?? false, + type: $request->getDataInt('type'), + rel: $bill->id, + mapper: BillMapper::class, + field: 'files' ); - - $collection = null; - foreach ($uploaded as $media) { - $this->createModelRelation( - $request->header->account, - $bill->id, - $media->id, - BillMapper::class, - 'files', - '', - $request->getOrigin() - ); - - if ($request->hasData('type')) { - $this->createModelRelation( - $request->header->account, - $media->id, - $request->getDataInt('type'), - MediaMapper::class, - 'types', - '', - $request->getOrigin() - ); - } - - if ($collection === null) { - /** @var \Modules\Media\Models\Collection $collection */ - $collection = MediaMapper::getParentCollection($path) - ->limit(1) - ->execute(); - - if ($collection->id === 0) { - $collection = $this->app->moduleManager->get('Media')->createRecursiveMediaCollection( - $path, - $request->header->account, - __DIR__ . '/../../../Modules/Media/Files' . $path, - ); - } - } - - $this->createModelRelation( - $request->header->account, - $collection->id, - $media->id, - CollectionMapper::class, - 'sources', - '', - $request->getOrigin() - ); - } } - $mediaFiles = $request->getDataJson('media'); - foreach ($mediaFiles as $media) { - $this->createModelRelation( + if (!empty($media = $request->getDataJson('media'))) { + $this->app->moduleManager->get('Media', 'Api')->addMediaToCollectionAndModel( $request->header->account, + $media, $bill->id, - (int) $media, BillMapper::class, 'files', - '', - $request->getOrigin() + $path ); } // @todo media should be an array of NullMedia elements - $this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Media', 'Media added to bill.', [ - 'upload' => $uploaded, - 'media' => $mediaFiles, + $this->fillJsonResponse($request, $response, NotificationLevel::OK, '', $this->app->l11nManager->getText($response->header->l11n->language, '0', '0', 'SuccessfulAdd'), [ + 'upload' => $uploaded->sources, + 'media' => $media, ]); } @@ -939,7 +893,7 @@ final class ApiBillController extends Controller } /** - * Method to validate bill creation from request + * Method to validate add Media to bill request * * @param RequestAbstract $request Request * @@ -1539,7 +1493,7 @@ final class ApiBillController extends Controller } /** - * Api method to create bill files + * Api method to create Note * * @param RequestAbstract $request Request * @param ResponseAbstract $response Response diff --git a/Controller/ApiBillTypeController.php b/Controller/ApiBillTypeController.php index c754c62..b5fc81d 100755 --- a/Controller/ApiBillTypeController.php +++ b/Controller/ApiBillTypeController.php @@ -3,7 +3,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules\Billing * @copyright Dennis Eichhorn @@ -64,7 +64,7 @@ final class ApiBillTypeController extends Controller } /** - * Method to create item attribute from request. + * Method to create BillType from request. * * @param RequestAbstract $request Request * @@ -98,7 +98,7 @@ final class ApiBillTypeController extends Controller } /** - * Validate item attribute create request + * Validate BillType create request * * @param RequestAbstract $request Request * @@ -119,7 +119,7 @@ final class ApiBillTypeController extends Controller } /** - * Api method to create item attribute l11n + * Api method to create BillType l11n * * @param RequestAbstract $request Request * @param ResponseAbstract $response Response @@ -146,7 +146,7 @@ final class ApiBillTypeController extends Controller } /** - * Method to create item attribute l11n from request. + * Method to create BillType l11n from request. * * @param RequestAbstract $request Request * @@ -165,7 +165,7 @@ final class ApiBillTypeController extends Controller } /** - * Validate item attribute l11n create request + * Validate BillType l11n create request * * @param RequestAbstract $request Request * diff --git a/Controller/ApiController.php b/Controller/ApiController.php index 6a6ebe7..fd007a5 100755 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -3,7 +3,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules\Billing * @copyright Dennis Eichhorn diff --git a/Controller/ApiPriceController.php b/Controller/ApiPriceController.php index eb42653..02199d9 100755 --- a/Controller/ApiPriceController.php +++ b/Controller/ApiPriceController.php @@ -3,7 +3,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules\Billing * @copyright Dennis Eichhorn @@ -228,7 +228,7 @@ final class ApiPriceController extends Controller */ /** @var \Modules\Billing\Models\Price\Price[] $prices */ - $prices = $queryMapper->execute(); + $prices = $queryMapper->executeGetArray(); // Find base price $basePrice = null; @@ -247,7 +247,7 @@ final class ApiPriceController extends Controller && $price->clientsection->id === 0 && $price->clienttype->id === 0 && $price->promocode === '' - && $price->priceNew->value < ($basePrice?->priceNew->value ?? \PHP_INT_MAX) + && $price->priceNew->value < ($basePrice?->priceNew?->value ?? \PHP_INT_MAX) ) { $basePrice = $price; } @@ -362,7 +362,7 @@ final class ApiPriceController extends Controller } /** - * Method to create item attribute from request. + * Method to create Price from request. * * @param RequestAbstract $request Request * @@ -407,14 +407,14 @@ final class ApiPriceController extends Controller } /** - * Validate item attribute create request + * Validate Price create request * * @param RequestAbstract $request Request * * @return array * * @todo consider to prevent name 'default'? - * Might not be possible because it is used internally as well (see apiItemCreate in ItemManagement) + * Might not be possible because it is used internally as well (see apiItemCreate in ItemManagement) * * @since 1.0.0 */ @@ -506,8 +506,8 @@ final class ApiPriceController extends Controller $new->clientsection = $request->hasData('clientsection') ? new NullAttributeValue((int) $request->getData('clientsection')) : $new->clientsection; $new->clienttype = $request->hasData('clienttype') ? new NullAttributeValue((int) $request->getData('clienttype')) : $new->clienttype; - $new->supplier = $request->hasData('supplier') ? new NullSupplier((int) $request->getData('supplier')) : $new->supplier; - $new->unit = $request->getDataInt('unit') ?? $new->unit; + $new->supplier = $request->hasData('supplier') ? new NullSupplier((int) $request->getData('supplier')) : $new->supplier; + $new->unit = $request->getDataInt('unit') ?? $new->unit; $new->quantity = new FloatInt($request->getDataString('quantity') ?? $new->quantity->value); $new->price = new FloatInt($request->getDataString('price') ?? $new->price->value); @@ -516,10 +516,10 @@ final class ApiPriceController extends Controller $new->discountPercentage = new FloatInt($request->getDataString('discountPercentage') ?? $new->discountPercentage->value); $new->bonus = new FloatInt($request->getDataString('bonus') ?? $new->bonus->value); - $new->multiply = $request->getDataBool('multiply') ?? $new->multiply; - $new->currency = ISO4217CharEnum::tryFromValue($request->getDataString('currency')) ?? $new->currency; - $new->start = $request->getDataDateTime('start') ?? $new->start; - $new->end = $request->getDataDateTime('end') ?? $new->end; + $new->multiply = $request->getDataBool('multiply') ?? $new->multiply; + $new->currency = ISO4217CharEnum::tryFromValue($request->getDataString('currency')) ?? $new->currency; + $new->start = $request->getDataDateTime('start') ?? $new->start; + $new->end = $request->getDataDateTime('end') ?? $new->end; return $new; } diff --git a/Controller/ApiPurchaseController.php b/Controller/ApiPurchaseController.php index 0bd3b86..1343b43 100755 --- a/Controller/ApiPurchaseController.php +++ b/Controller/ApiPurchaseController.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules\Billing * @copyright Dennis Eichhorn @@ -82,7 +82,7 @@ final class ApiPurchaseController extends Controller } /** - * Method to create item attribute from request. + * Method to upload supplier Bill from request. * * @param RequestAbstract $request Request * @param ResponseAbstract $response Response @@ -111,7 +111,39 @@ final class ApiPurchaseController extends Controller $bills = []; $files = \array_merge($request->files, $request->getDataJson('media')); + + /** @var \Model\Setting[] $settings */ + $settings = $this->app->appSettings->get(null, + [SettingsEnum::BILLING_DOCUMENT_SPACER_COLOR, SettingsEnum::BILLING_DOCUMENT_SPACER_TOLERANCE], + unit: $this->app->unitId, + module: self::NAME + ); + + if (empty($settings)) { + /** @var \Model\Setting[] $settings */ + $settings = $this->app->appSettings->get(null, + [SettingsEnum::BILLING_DOCUMENT_SPACER_COLOR, SettingsEnum::BILLING_DOCUMENT_SPACER_TOLERANCE], + unit: null, + module: self::NAME + ); + } + foreach ($files as $file) { + // 1. convert to image pdftoppm + // 2. search for color pages by using averageColorRandom (tolerance < 175 = color match) + // 3. split pdf document if necessary + // sudo apt-get --yes install pdftk + // pdftk foo-bar.pdf cat 1-12 output foo.pdf + // pdftk foo-bar.pdf cat 13-end output bar.pdf + // alternatively, pdfseparate -f 1 -l 5 input.pdf output-page%d.pdf + // alternatively, pdfjam -o + // alternatively, pdfly cat in.pdf 2:4 -o out.pdf + // 4. add to documents array + } + + $documents = $files; + + foreach ($documents as $file) { // Create default bill $billRequest = new HttpRequest(); $billRequest->header->account = $request->header->account; @@ -171,7 +203,7 @@ final class ApiPurchaseController extends Controller } /** - * Validate item attribute create request + * Validate supplier Bill upload request * * @param RequestAbstract $request Request * @@ -252,7 +284,7 @@ final class ApiPurchaseController extends Controller } /** - * Validate item attribute create request + * Validate Bill parse request * * @param RequestAbstract $request Request * diff --git a/Controller/ApiTaxController.php b/Controller/ApiTaxController.php index cb22186..7a34976 100755 --- a/Controller/ApiTaxController.php +++ b/Controller/ApiTaxController.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules\Billing * @copyright Dennis Eichhorn @@ -126,6 +126,8 @@ final class ApiTaxController extends Controller * * @return void * + * @api + * * @since 1.0.0 */ public function apiTaxCombinationCreate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void @@ -143,7 +145,7 @@ final class ApiTaxController extends Controller } /** - * Method to create item attribute from request. + * Method to create TaxCombination from request. * * @param RequestAbstract $request Request * @@ -169,7 +171,7 @@ final class ApiTaxController extends Controller } /** - * Validate item attribute create request + * Validate TaxCombination create request * * @param RequestAbstract $request Request * @@ -358,7 +360,7 @@ final class ApiTaxController extends Controller ->with('itemCode') ->where('clientCode/valueStr', $combination['account_code'] ?? '') ->where('itemCode/valueStr', $combination['item_code'] ?? '') - ->execute(); + ->executeGetArray(); if (\count($old) !== 1) { continue; diff --git a/Controller/BackendController.php b/Controller/BackendController.php index 2d53acc..131a3d3 100755 --- a/Controller/BackendController.php +++ b/Controller/BackendController.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules\Billing * @copyright Dennis Eichhorn @@ -23,12 +23,14 @@ use Modules\Billing\Models\BillTypeMapper; use Modules\Billing\Models\PaymentTermL11nMapper; use Modules\Billing\Models\PaymentTermMapper; use Modules\Billing\Models\PermissionCategory; -use Modules\Billing\Models\PurchaseBillMapper; -use Modules\Billing\Models\SalesBillMapper; use Modules\Billing\Models\SettingsEnum; use Modules\Billing\Models\ShippingTermL11nMapper; use Modules\Billing\Models\ShippingTermMapper; -use Modules\Billing\Models\StockBillMapper; +use Modules\Billing\Models\Tax\TaxCombinationMapper; +use Modules\ClientManagement\Models\Attribute\ClientAttributeTypeMapper; +use Modules\Finance\Models\TaxCodeMapper; +use Modules\ItemManagement\Models\Attribute\ItemAttributeTypeMapper; +use Modules\SupplierManagement\Models\Attribute\SupplierAttributeTypeMapper; use phpOMS\Account\PermissionType; use phpOMS\Contract\RenderableInterface; use phpOMS\DataStorage\Database\Query\OrderType; @@ -66,7 +68,7 @@ final class BackendController extends Controller $view->setTemplate('/Modules/Billing/Theme/Backend/sales-bill-list'); $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1005104001, $request, $response); - $mapperQuery = SalesBillMapper::getAll() + $view->data['bills'] = BillMapper::getAll() ->with('type') ->with('type/l11n') ->with('client') @@ -75,22 +77,14 @@ final class BackendController extends Controller ->where('type/l11n/language', $response->header->l11n->language) ->sort('id', OrderType::DESC) ->where('unit', $this->app->unitId) - ->limit(25); - - if ($request->getData('ptype') === 'p') { - $view->data['bills'] = $mapperQuery - ->where('id', $request->getDataInt('id') ?? 0, '<') - ->where('client', null, '!=') - ->execute(); - } elseif ($request->getData('ptype') === 'n') { - $view->data['bills'] = $mapperQuery->where('id', $request->getDataInt('id') ?? 0, '>') - ->where('client', null, '!=') - ->execute(); - } else { - $view->data['bills'] = $mapperQuery->where('id', 0, '>') - ->where('client', null, '!=') - ->execute(); - } + ->where('client', null, '!=') + ->limit(25) + ->paginate( + 'id', + $request->getData('ptype'), + $request->getDataInt('offset') + ) + ->execute(); return $view; } @@ -113,7 +107,7 @@ final class BackendController extends Controller $view->setTemplate('/Modules/Billing/Theme/Backend/sales-bill-list'); $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1005104001, $request, $response); - $mapperQuery = SalesBillMapper::getAll() + $view->data['bills'] = BillMapper::getAll() ->with('type') ->with('type/l11n') ->with('client') @@ -122,22 +116,88 @@ final class BackendController extends Controller ->where('type/l11n/language', $response->header->l11n->language) ->sort('id', OrderType::DESC) ->where('unit', $this->app->unitId) - ->limit(25); + ->where('client', null, '!=') + ->limit(25) + ->paginate( + 'id', + $request->getDataString('ptype') ?? '', + $request->getDataInt('offset') + )->executeGetArray(); - if ($request->getData('ptype') === 'p') { - $view->data['bills'] = $mapperQuery - ->where('id', $request->getDataInt('id') ?? 0, '<') - ->where('client', null, '!=') - ->execute(); - } elseif ($request->getData('ptype') === 'n') { - $view->data['bills'] = $mapperQuery->where('id', $request->getDataInt('id') ?? 0, '>') - ->where('client', null, '!=') - ->execute(); - } else { - $view->data['bills'] = $mapperQuery->where('id', 0, '>') - ->where('client', null, '!=') - ->execute(); - } + return $view; + } + + /** + * Routing end-point for application behavior. + * + * @param RequestAbstract $request Request + * @param ResponseAbstract $response Response + * @param array $data Generic data + * + * @return RenderableInterface + * + * @since 1.0.0 + * @codeCoverageIgnore + */ + public function viewBillingStockArchive(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface + { + $view = new View($this->app->l11nManager, $request, $response); + $view->setTemplate('/Modules/Billing/Theme/Backend/sales-bill-list'); + $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1005106001, $request, $response); + + $view->data['bills'] = BillMapper::getAll() + ->with('type') + ->with('type/l11n') + ->with('client') + ->where('status', BillStatus::DRAFT, '!=') + ->where('type/transferType', BillTransferType::STOCK) + ->where('type/l11n/language', $response->header->l11n->language) + ->sort('id', OrderType::DESC) + ->where('unit', $this->app->unitId) + ->limit(25) + ->paginate( + 'id', + $request->getDataString('ptype') ?? '', + $request->getDataInt('offset') + )->executeGetArray(); + + return $view; + } + + /** + * Routing end-point for application behavior. + * + * @param RequestAbstract $request Request + * @param ResponseAbstract $response Response + * @param array $data Generic data + * + * @return RenderableInterface + * + * @since 1.0.0 + * @codeCoverageIgnore + */ + public function viewBillingPurchaseArchive(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface + { + $view = new View($this->app->l11nManager, $request, $response); + $view->setTemplate('/Modules/Billing/Theme/Backend/purchase-bill-list'); + $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1005105001, $request, $response); + + $view->data['bills'] = BillMapper::getAll() + ->with('type') + ->with('type/l11n') + ->with('supplier') + ->where('status', BillStatus::DRAFT, '!=') + ->where('type/transferType', BillTransferType::PURCHASE) + ->where('type/l11n/language', $response->header->l11n->language) + ->sort('id', OrderType::DESC) + ->where('unit', $this->app->unitId) + ->where('supplier', null, '!=') + ->limit(25) + ->paginate( + 'id', + $request->getDataString('ptype') ?? '', + $request->getDataInt('offset') + )->executeGetArray(); return $view; } @@ -161,7 +221,7 @@ final class BackendController extends Controller $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1005104001, $request, $response); /** @var \Modules\Billing\Models\Bill $bill */ - $bill = SalesBillMapper::get() + $bill = BillMapper::get() ->with('client') ->with('elements') ->with('elements/container') @@ -178,7 +238,7 @@ final class BackendController extends Controller ->where('isTemplate', false) ->where('transferType', BillTransferType::SALES) ->where('l11n/language', $request->header->l11n->language) - ->execute(); + ->executeGetArray(); $view->data['billtypes'] = $billTypes; @@ -197,7 +257,7 @@ final class BackendController extends Controller ->where('module', 'Billing') ->where('type', StringUtils::intHash(BillMapper::class)) ->where('ref', $bill->id) - ->execute(); + ->executeGetArray(); if (!empty($bill->elements)) { /** @var \Modules\Auditor\Models\Audit[] $logsElements */ @@ -206,7 +266,7 @@ final class BackendController extends Controller ->where('module', 'Billing') ->where('type', StringUtils::intHash(BillElementMapper::class)) ->where('ref', \array_keys($bill->elements), 'IN') - ->execute(); + ->executeGetArray(); $logs = \array_merge($logs, $logsElements); } @@ -241,7 +301,7 @@ final class BackendController extends Controller ->where('isTemplate', false) ->where('transferType', BillTransferType::SALES) ->where('l11n/language', $request->header->l11n->language) - ->execute(); + ->executeGetArray(); $view->data['billtypes'] = $billTypes; @@ -266,7 +326,9 @@ final class BackendController extends Controller { $view = new View($this->app->l11nManager, $request, $response); $view->setTemplate('/Modules/Billing/Theme/Backend/bill-create'); - $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1005104001, $request, $response); + $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1005105001, $request, $response); + + $view->data['media-upload'] = new \Modules\Media\Theme\Backend\Components\Upload\BaseView($this->app->l11nManager, $request, $response); return $view; } @@ -287,7 +349,9 @@ final class BackendController extends Controller { $view = new View($this->app->l11nManager, $request, $response); $view->setTemplate('/Modules/Billing/Theme/Backend/bill-create'); - $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1005104001, $request, $response); + $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1005106001, $request, $response); + + $view->data['media-upload'] = new \Modules\Media\Theme\Backend\Components\Upload\BaseView($this->app->l11nManager, $request, $response); return $view; } @@ -310,32 +374,21 @@ final class BackendController extends Controller $view->setTemplate('/Modules/Billing/Theme/Backend/purchase-bill-list'); $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1005105001, $request, $response); - $mapperQuery = PurchaseBillMapper::getAll() + $view->data['bills'] = BillMapper::getAll() ->with('type') ->with('type/l11n') ->with('supplier') ->where('type/transferType', BillTransferType::PURCHASE) ->sort('id', OrderType::DESC) ->where('unit', $this->app->unitId) - ->limit(25); - - if ($request->getData('ptype') === 'p') { - $view->data['bills'] = $mapperQuery - ->where('id', $request->getDataInt('id') ?? 0, '<') - ->where('supplier', null, '!=') - ->where('type/l11n/language', $response->header->l11n->language) - ->execute(); - } elseif ($request->getData('ptype') === 'n') { - $view->data['bills'] = $mapperQuery->where('id', $request->getDataInt('id') ?? 0, '>') - ->where('supplier', null, '!=') - ->where('type/l11n/language', $response->header->l11n->language) - ->execute(); - } else { - $view->data['bills'] = $mapperQuery->where('id', 0, '>') - ->where('supplier', null, '!=') - ->where('type/l11n/language', $response->header->l11n->language) - ->execute(); - } + ->where('supplier', null, '!=') + ->where('type/l11n/language', $response->header->l11n->language) + ->limit(25) + ->paginate( + 'id', + $request->getDataString('ptype') ?? '', + $request->getDataInt('offset') + )->executeGetArray(); return $view; } @@ -358,7 +411,7 @@ final class BackendController extends Controller $view->setTemplate('/Modules/Billing/Theme/Backend/purchase-bill'); $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1005105001, $request, $response); - $view->data['bill'] = PurchaseBillMapper::get() + $view->data['bill'] = BillMapper::get() ->with('supplier') ->with('elements') ->with('elements/container') @@ -373,7 +426,7 @@ final class BackendController extends Controller ->where('isTemplate', false) ->where('transferType', BillTransferType::PURCHASE) ->where('l11n/language', $request->header->l11n->language) - ->execute(); + ->executeGetArray(); $logs = []; if ($this->app->accountManager->get($request->header->account)->hasPermission( @@ -390,7 +443,7 @@ final class BackendController extends Controller ->where('module', 'Billing') ->where('type', StringUtils::intHash(BillMapper::class)) ->where('ref', $view->data['bill']->id) - ->execute(); + ->executeGetArray(); if (!empty($view->data['bill']->elements)) { /** @var \Modules\Auditor\Models\Audit[] $logsElements */ @@ -399,7 +452,7 @@ final class BackendController extends Controller ->where('module', 'Billing') ->where('type', StringUtils::intHash(BillElementMapper::class)) ->where('ref', \array_keys($view->data['bill']->elements), 'IN') - ->execute(); + ->executeGetArray(); $logs = \array_merge($logs, $logsElements); } @@ -427,15 +480,17 @@ final class BackendController extends Controller { $view = new View($this->app->l11nManager, $request, $response); $view->setTemplate('/Modules/Billing/Theme/Backend/purchase-bill-list'); - $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1005106001, $request, $response); + $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1005105001, $request, $response); - if ($request->getData('ptype') === 'p') { - $view->data['bills'] = StockBillMapper::getAll()->where('id', $request->getDataInt('id') ?? 0, '<')->where('unit', $this->app->unitId)->limit(25)->execute(); - } elseif ($request->getData('ptype') === 'n') { - $view->data['bills'] = StockBillMapper::getAll()->where('id', $request->getDataInt('id') ?? 0, '>')->where('unit', $this->app->unitId)->limit(25)->execute(); - } else { - $view->data['bills'] = StockBillMapper::getAll()->where('id', 0, '>')->where('unit', $this->app->unitId)->limit(25)->execute(); - } + $view->data['bills'] = BillMapper::getAll() + ->where('unit', $this->app->unitId) + ->limit(25) + ->paginate( + 'id', + $request->getData('ptype'), + $request->getDataInt('offset') + ) + ->executeGetArray(); return $view; } @@ -458,7 +513,7 @@ final class BackendController extends Controller $view->setTemplate('/Modules/Billing/Theme/Backend/purchase-bill'); $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1005106001, $request, $response); - $bill = StockBillMapper::get()->where('id', (int) $request->getData('id'))->execute(); + $bill = BillMapper::get()->where('id', (int) $request->getData('id'))->execute(); $view->data['bill'] = $bill; $view->data['media-upload'] = new \Modules\Media\Theme\Backend\Components\Upload\BaseView($this->app->l11nManager, $request, $response); @@ -482,7 +537,7 @@ final class BackendController extends Controller { $view = new View($this->app->l11nManager, $request, $response); $view->setTemplate('/Modules/Billing/Theme/Backend/purchase-bill-upload'); - $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1002901101, $request, $response); + $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1005105001, $request, $response); return $view; } @@ -502,7 +557,7 @@ final class BackendController extends Controller public function viewPrivatePurchaseBillUpload(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface { $view = new View($this->app->l11nManager, $request, $response); - $view->setTemplate('/Modules/Billing/Theme/Backend/user-purchase-bill-upload'); + $view->setTemplate('/Modules/Billing/Theme/Backend/purchase-bill-upload'); $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1005109001, $request, $response); return $view; @@ -526,7 +581,7 @@ final class BackendController extends Controller $view->setTemplate('/Modules/Billing/Theme/Backend/purchase-bill-list'); $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1005109001, $request, $response); - $mapperQuery = PurchaseBillMapper::getAll() + $view->data['bills'] = BillMapper::getAll() ->with('type') ->with('type/l11n') ->with('supplier') @@ -534,22 +589,13 @@ final class BackendController extends Controller ->where('status', BillStatus::UNPARSED) ->sort('id', OrderType::DESC) ->where('unit', $this->app->unitId) - ->limit(25); - - if ($request->getData('ptype') === 'p') { - $view->data['bills'] = $mapperQuery - ->where('id', $request->getDataInt('id') ?? 0, '<') - ->where('type/l11n/language', $response->header->l11n->language) - ->execute(); - } elseif ($request->getData('ptype') === 'n') { - $view->data['bills'] = $mapperQuery->where('id', $request->getDataInt('id') ?? 0, '>') - ->where('type/l11n/language', $response->header->l11n->language) - ->execute(); - } else { - $view->data['bills'] = $mapperQuery->where('id', 0, '>') - ->where('type/l11n/language', $response->header->l11n->language) - ->execute(); - } + ->where('type/l11n/language', $response->header->l11n->language) + ->limit(25) + ->paginate( + 'id', + $request->getDataString('ptype') ?? '', + $request->getDataInt('offset') + )->executeGetArray(); return $view; } @@ -572,7 +618,7 @@ final class BackendController extends Controller $view->setTemplate('/Modules/Billing/Theme/Backend/purchase-bill'); $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1005109001, $request, $response); - $bill = PurchaseBillMapper::get() + $bill = BillMapper::get() ->with('elements') ->with('files') ->with('files/types') @@ -618,12 +664,12 @@ final class BackendController extends Controller { $view = new View($this->app->l11nManager, $request, $response); $view->setTemplate('/Modules/Billing/Theme/Backend/payment-type-list'); - $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1002901101, $request, $response); + $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1005104001, $request, $response); $view->data['types'] = PaymentTermMapper::getAll() ->with('l11n') ->where('l11n/language', $response->header->l11n->language) - ->execute(); + ->executeGetArray(); return $view; } @@ -644,7 +690,7 @@ final class BackendController extends Controller { $view = new View($this->app->l11nManager, $request, $response); $view->setTemplate('/Modules/Billing/Theme/Backend/payment-view'); - $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1002901101, $request, $response); + $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1005104001, $request, $response); $view->data['type'] = PaymentTermMapper::get() ->with('l11n') @@ -657,7 +703,7 @@ final class BackendController extends Controller /** @var \phpOMS\Localization\BaseStringL11n[] $l11nValues */ $l11nValues = PaymentTermL11nMapper::getAll() ->where('ref', $view->data['type']->id) - ->execute(); + ->executeGetArray(); $view->data['l11nValues'] = $l11nValues; @@ -680,12 +726,12 @@ final class BackendController extends Controller { $view = new View($this->app->l11nManager, $request, $response); $view->setTemplate('/Modules/Billing/Theme/Backend/shipping-type-list'); - $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1002901101, $request, $response); + $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1005104001, $request, $response); $view->data['types'] = ShippingTermMapper::getAll() ->with('l11n') ->where('l11n/language', $response->header->l11n->language) - ->execute(); + ->executeGetArray(); return $view; } @@ -706,7 +752,7 @@ final class BackendController extends Controller { $view = new View($this->app->l11nManager, $request, $response); $view->setTemplate('/Modules/Billing/Theme/Backend/shipping-view'); - $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1002901101, $request, $response); + $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1005104001, $request, $response); $view->data['type'] = ShippingTermMapper::get() ->with('l11n') @@ -719,10 +765,139 @@ final class BackendController extends Controller /** @var \phpOMS\Localization\BaseStringL11n[] $l11nValues */ $l11nValues = ShippingTermL11nMapper::getAll() ->where('ref', $view->data['type']->id) - ->execute(); + ->executeGetArray(); $view->data['l11nValues'] = $l11nValues; return $view; } + + /** + * Method which shows the sales dashboard + * + * @param RequestAbstract $request Request + * @param ResponseAbstract $response Response + * @param array $data Generic data + * + * @return RenderableInterface Response can be rendered + * + * @since 1.0.0 + */ + public function viewTaxCombinationList(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface + { + $view = new View($this->app->l11nManager, $request, $response); + $view->setTemplate('/Modules/Billing/Theme/Backend/finance-taxcombination-list'); + $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1005103001, $request, $response); + + $view->data['taxcombination'] = TaxCombinationMapper::getAll() + ->with('clientCode') + ->with('supplierCode') + ->with('itemCode') + ->with('taxCode') + ->executeGetArray(); + + return $view; + } + + /** + * Method which shows the sales dashboard + * + * @param RequestAbstract $request Request + * @param ResponseAbstract $response Response + * @param array $data Generic data + * + * @return RenderableInterface Response can be rendered + * + * @since 1.0.0 + */ + public function viewTaxCombinationCreate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface + { + $view = new View($this->app->l11nManager, $request, $response); + $view->setTemplate('/Modules/Billing/Theme/Backend/finance-taxcombination-view'); + $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1005103001, $request, $response); + + $view->data['client_codes'] = ClientAttributeTypeMapper::get() + ->with('defaults') + ->where('name', 'sales_tax_code') + ->limit(1) + ->execute(); + + $view->data['supplier_codes'] = SupplierAttributeTypeMapper::get() + ->with('defaults') + ->where('name', 'purchase_tax_code') + ->limit(1) + ->execute(); + + $view->data['item_codes_sales'] = ItemAttributeTypeMapper::get() + ->with('defaults') + ->where('name', 'sales_tax_code') + ->limit(1) + ->execute(); + + $view->data['item_codes_purchase'] = ItemAttributeTypeMapper::get() + ->with('defaults') + ->where('name', 'purchase_tax_code') + ->limit(1) + ->execute(); + + $view->data['tax_codes'] = TaxCodeMapper::getAll() + ->executeGetArray(); + + return $view; + } + + /** + * Method which shows the sales dashboard + * + * @param RequestAbstract $request Request + * @param ResponseAbstract $response Response + * @param array $data Generic data + * + * @return RenderableInterface Response can be rendered + * + * @since 1.0.0 + */ + public function viewTaxCombinationView(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface + { + $view = new View($this->app->l11nManager, $request, $response); + $view->setTemplate('/Modules/Billing/Theme/Backend/finance-taxcombination-view'); + $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1005103001, $request, $response); + + $view->data['taxcombination'] = TaxCombinationMapper::get() + ->with('clientCode') + ->with('supplierCode') + ->with('itemCode') + ->with('taxCode') + ->where('id', (int) $request->getData('id')) + ->execute(); + + $view->data['client_codes'] = ClientAttributeTypeMapper::get() + ->with('defaults') + ->where('name', 'sales_tax_code') + ->limit(1) + ->execute(); + + $view->data['supplier_codes'] = SupplierAttributeTypeMapper::get() + ->with('defaults') + ->where('name', 'purchase_tax_code') + ->limit(1) + ->execute(); + + $view->data['item_codes_sales'] = ItemAttributeTypeMapper::get() + ->with('defaults') + ->where('name', 'sales_tax_code') + ->limit(1) + ->execute(); + + $view->data['item_codes_purchase'] = ItemAttributeTypeMapper::get() + ->with('defaults') + ->where('name', 'purchase_tax_code') + ->limit(1) + ->execute(); + + $view->data['tax_codes'] = TaxCodeMapper::getAll() + ->executeGetArray(); + + return $view; + } } diff --git a/Controller/CliController.php b/Controller/CliController.php index 0271494..2c8b743 100755 --- a/Controller/CliController.php +++ b/Controller/CliController.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules\Billing * @copyright Dennis Eichhorn @@ -122,7 +122,7 @@ final class CliController extends Controller ->with('mainAddress') ->with('attributes/type') ->where('attributes/type/name', ['bill_match_pattern', 'bill_date_format'], 'IN') - ->execute(); + ->executeGetArray(); $supplierId = $this->matchSupplier($content, $suppliers); $bill->supplier = new NullSupplier($supplierId); diff --git a/Controller/Controller.php b/Controller/Controller.php index facef88..a55c965 100755 --- a/Controller/Controller.php +++ b/Controller/Controller.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules\Billing * @copyright Dennis Eichhorn diff --git a/ICAL.txt b/ICLA.txt old mode 100755 new mode 100644 similarity index 100% rename from ICAL.txt rename to ICLA.txt diff --git a/Models/Attribute/BillAttributeMapper.php b/Models/Attribute/BillAttributeMapper.php index b9fb7bd..71cabaa 100755 --- a/Models/Attribute/BillAttributeMapper.php +++ b/Models/Attribute/BillAttributeMapper.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules\Billing\Models\Attribute * @copyright Dennis Eichhorn diff --git a/Models/Attribute/BillAttributeTypeL11nMapper.php b/Models/Attribute/BillAttributeTypeL11nMapper.php index 1ac4e8a..65aacd0 100755 --- a/Models/Attribute/BillAttributeTypeL11nMapper.php +++ b/Models/Attribute/BillAttributeTypeL11nMapper.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules\Billing\Models\Attribute * @copyright Dennis Eichhorn diff --git a/Models/Attribute/BillAttributeTypeMapper.php b/Models/Attribute/BillAttributeTypeMapper.php index 3429716..17b6e7b 100755 --- a/Models/Attribute/BillAttributeTypeMapper.php +++ b/Models/Attribute/BillAttributeTypeMapper.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules\Billing\Models\Attribute * @copyright Dennis Eichhorn diff --git a/Models/Attribute/BillAttributeValueL11nMapper.php b/Models/Attribute/BillAttributeValueL11nMapper.php index 939cd7e..f1604be 100755 --- a/Models/Attribute/BillAttributeValueL11nMapper.php +++ b/Models/Attribute/BillAttributeValueL11nMapper.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules\Billing\Models\Attribute * @copyright Dennis Eichhorn diff --git a/Models/Attribute/BillAttributeValueMapper.php b/Models/Attribute/BillAttributeValueMapper.php index 2e54b8b..c698c3e 100755 --- a/Models/Attribute/BillAttributeValueMapper.php +++ b/Models/Attribute/BillAttributeValueMapper.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules\Billing\Models\Attribute * @copyright Dennis Eichhorn diff --git a/Models/Bill.php b/Models/Bill.php index 2a6784a..a5acf20 100755 --- a/Models/Bill.php +++ b/Models/Bill.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules\Billing\Models * @copyright Dennis Eichhorn diff --git a/Models/BillElement.php b/Models/BillElement.php index 024c17a..8938dab 100755 --- a/Models/BillElement.php +++ b/Models/BillElement.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules\Billing\Models * @copyright Dennis Eichhorn @@ -15,7 +15,6 @@ declare(strict_types=1); namespace Modules\Billing\Models; use Modules\Billing\Models\Tax\TaxCombination; -use Modules\Finance\Models\TaxCode; use Modules\ItemManagement\Models\Container; use Modules\ItemManagement\Models\Item; use Modules\ItemManagement\Models\NullItem; diff --git a/Models/BillElementMapper.php b/Models/BillElementMapper.php index d8771e3..1eb5200 100755 --- a/Models/BillElementMapper.php +++ b/Models/BillElementMapper.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules\Billing\Models * @copyright Dennis Eichhorn @@ -20,7 +20,7 @@ use Modules\ItemManagement\Models\ItemMapper; use phpOMS\DataStorage\Database\Mapper\DataMapperFactory; /** - * Mapper class. + * Billelement mapper class. * * @package Modules\Billing\Models * @license OMS License 2.0 diff --git a/Models/BillMapper.php b/Models/BillMapper.php index ee72a5b..d12bfd9 100755 --- a/Models/BillMapper.php +++ b/Models/BillMapper.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules\Billing\Models * @copyright Dennis Eichhorn @@ -18,13 +18,12 @@ use Modules\Admin\Models\AccountMapper; use Modules\Billing\Models\Attribute\BillAttributeMapper; use Modules\ClientManagement\Models\ClientMapper; use Modules\Editor\Models\EditorDocMapper; -use Modules\Media\Models\CollectionMapper; use Modules\Media\Models\MediaMapper; use Modules\SupplierManagement\Models\SupplierMapper; use phpOMS\DataStorage\Database\Mapper\DataMapperFactory; /** - * Mapper class. + * Bill mapper class. * * WARNING: This mapper may use a trigger to update the sequence number on insert. * @@ -142,7 +141,7 @@ class BillMapper extends DataMapperFactory 'referral' => [ 'mapper' => AccountMapper::class, 'external' => 'billing_bill_referral', - ] + ], ]; /** diff --git a/Models/BillPaymentStatus.php b/Models/BillPaymentStatus.php index 900022c..ad777fa 100755 --- a/Models/BillPaymentStatus.php +++ b/Models/BillPaymentStatus.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules\Billing\Models * @copyright Dennis Eichhorn diff --git a/Models/BillStatus.php b/Models/BillStatus.php index 292aead..01e15ba 100755 --- a/Models/BillStatus.php +++ b/Models/BillStatus.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules\Billing\Models * @copyright Dennis Eichhorn diff --git a/Models/BillTransferType.php b/Models/BillTransferType.php index 9b7bd59..c48aa53 100755 --- a/Models/BillTransferType.php +++ b/Models/BillTransferType.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules\Billing\Models * @copyright Dennis Eichhorn diff --git a/Models/BillType.php b/Models/BillType.php index 8bfab10..bdfe2aa 100755 --- a/Models/BillType.php +++ b/Models/BillType.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules\Billing\Models * @copyright Dennis Eichhorn diff --git a/Models/BillTypeL11nMapper.php b/Models/BillTypeL11nMapper.php index be5b1d6..d6abb8c 100755 --- a/Models/BillTypeL11nMapper.php +++ b/Models/BillTypeL11nMapper.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules\Billing\Models * @copyright Dennis Eichhorn diff --git a/Models/BillTypeMapper.php b/Models/BillTypeMapper.php index d3cccfe..aa58cd4 100755 --- a/Models/BillTypeMapper.php +++ b/Models/BillTypeMapper.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules\Billing\Models * @copyright Dennis Eichhorn diff --git a/Models/InvoiceRecognition.php b/Models/InvoiceRecognition.php index 74c11be..4b09c1f 100644 --- a/Models/InvoiceRecognition.php +++ b/Models/InvoiceRecognition.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules\Billing\Models * @copyright Dennis Eichhorn diff --git a/Models/NullBill.php b/Models/NullBill.php index c4da9a3..f917b91 100755 --- a/Models/NullBill.php +++ b/Models/NullBill.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules\Billing\Models * @copyright Dennis Eichhorn diff --git a/Models/NullBillElement.php b/Models/NullBillElement.php index 8953f5b..916e768 100755 --- a/Models/NullBillElement.php +++ b/Models/NullBillElement.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules\Billing\Models * @copyright Dennis Eichhorn diff --git a/Models/NullBillType.php b/Models/NullBillType.php index 818e8bc..4ee3e0f 100755 --- a/Models/NullBillType.php +++ b/Models/NullBillType.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules\Billing\Models * @copyright Dennis Eichhorn diff --git a/Models/NullSubscription.php b/Models/NullSubscription.php index 1a953f1..29c54c5 100755 --- a/Models/NullSubscription.php +++ b/Models/NullSubscription.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules\Billing\Models * @copyright Dennis Eichhorn diff --git a/Models/PaymentTermL11nMapper.php b/Models/PaymentTermL11nMapper.php index 3510b12..d0072f8 100644 --- a/Models/PaymentTermL11nMapper.php +++ b/Models/PaymentTermL11nMapper.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules\Billing\Models * @copyright Dennis Eichhorn @@ -18,7 +18,7 @@ use phpOMS\DataStorage\Database\Mapper\DataMapperFactory; use phpOMS\Localization\BaseStringL11n; /** - * Item mapper class. + * PaymentTermL11n mapper class. * * @package Modules\Billing\Models * @license OMS License 2.0 diff --git a/Models/PaymentTermMapper.php b/Models/PaymentTermMapper.php index a8fcce5..baf5b4c 100644 --- a/Models/PaymentTermMapper.php +++ b/Models/PaymentTermMapper.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules\Billing\Models * @copyright Dennis Eichhorn @@ -18,7 +18,7 @@ use phpOMS\DataStorage\Database\Mapper\DataMapperFactory; use phpOMS\Localization\BaseStringL11nType; /** - * Item mapper class. + * PaymentTerm mapper class. * * @package Modules\Billing\Models * @license OMS License 2.0 diff --git a/Models/PermissionCategory.php b/Models/PermissionCategory.php index 3e1458c..e0c41b1 100755 --- a/Models/PermissionCategory.php +++ b/Models/PermissionCategory.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules\Billing\Models * @copyright Dennis Eichhorn @@ -45,4 +45,6 @@ abstract class PermissionCategory extends Enum public const SHIPPING_TERM = 10; public const BILL_LOG = 101; + + public const TAX = 201; } diff --git a/Models/Price/NullPrice.php b/Models/Price/NullPrice.php index e636173..c0ff963 100755 --- a/Models/Price/NullPrice.php +++ b/Models/Price/NullPrice.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules\Billing\Models\Price * @copyright Dennis Eichhorn diff --git a/Models/Price/Price.php b/Models/Price/Price.php index 023a524..6079d04 100755 --- a/Models/Price/Price.php +++ b/Models/Price/Price.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules\Billing\Models\Price * @copyright Dennis Eichhorn diff --git a/Models/Price/PriceMapper.php b/Models/Price/PriceMapper.php index 6d15044..6567819 100755 --- a/Models/Price/PriceMapper.php +++ b/Models/Price/PriceMapper.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules\Billing\Models\Price * @copyright Dennis Eichhorn diff --git a/Models/Price/PriceStatus.php b/Models/Price/PriceStatus.php index 74e3a21..ad42907 100644 --- a/Models/Price/PriceStatus.php +++ b/Models/Price/PriceStatus.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules\Billing\Models\Price * @copyright Dennis Eichhorn diff --git a/Models/Price/PriceType.php b/Models/Price/PriceType.php index f8fb8ad..1f165f8 100755 --- a/Models/Price/PriceType.php +++ b/Models/Price/PriceType.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules\Billing\Models\Price * @copyright Dennis Eichhorn diff --git a/Models/PurchaseBillMapper.php b/Models/PurchaseBillMapper.php index b6bf6a8..5796e09 100755 --- a/Models/PurchaseBillMapper.php +++ b/Models/PurchaseBillMapper.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules\Billing\Models * @copyright Dennis Eichhorn @@ -20,7 +20,7 @@ use phpOMS\Localization\Defaults\CountryMapper; use phpOMS\Stdlib\Base\FloatInt; /** - * Mapper class. + * PurchaseBill mapper class. * * @package Modules\Billing\Models * @license OMS License 2.0 @@ -53,7 +53,7 @@ final class PurchaseBillMapper extends BillMapper ->where('id', $pivot, '<') ->where('transferType', BillTransferType::PURCHASE) ->limit($limit) - ->execute(); + ->executeGetArray(); } /** @@ -72,7 +72,7 @@ final class PurchaseBillMapper extends BillMapper ->where('id', $pivot, '>') ->where('transferType', BillTransferType::PURCHASE) ->limit($limit) - ->execute(); + ->executeGetArray(); } /** @@ -253,7 +253,7 @@ final class PurchaseBillMapper extends BillMapper ->groupBy(SupplierMapper::TABLE . '_d1.suppliermgmt_supplier_id'); $suppliers = SupplierMapper::getAll()->execute($query); - $data = SupplierMapper::getRaw()->execute(); + $data = SupplierMapper::getRaw()->executeGetArray(); return [$suppliers, $data]; } @@ -326,4 +326,161 @@ final class PurchaseBillMapper extends BillMapper return $result ?? []; } + + /** + * Placeholder + * @todo Implement + */ + public static function getSupplierNetSales(int $supplier, \DateTime $start, \DateTime $end) : FloatInt + { + $sql = <<= '{$start->format('Y-m-d H:i:s')}' + AND billing_bill_performance_date <= '{$end->format('Y-m-d H:i:s')}'; + SQL; + + $query = new Builder(self::$db); + $result = $query->raw($sql)->execute()?->fetchAll(\PDO::FETCH_ASSOC) ?? []; + + return new FloatInt(-((int) ($result[0]['net_sales'] ?? 0))); + } + + /** + * Placeholder + * @todo Implement + */ + public static function getSupplierLastOrder(int $supplier) : ?\DateTime + { + $sql = <<raw($sql)->execute()?->fetchAll(\PDO::FETCH_ASSOC) ?? []; + + return isset($result[0]['billing_bill_created_at']) + ? new \DateTime(($result[0]['billing_bill_created_at'])) + : null; + } + + /** + * Placeholder + * @todo Implement + */ + public static function getSLVHistoric(int $supplier) : FloatInt + { + $sql = <<raw($sql)->execute()?->fetchAll(\PDO::FETCH_ASSOC) ?? []; + + return new FloatInt(-((int) ($result[0]['net_sales'] ?? 0))); + } + + /** + * Placeholder + * @todo Implement + */ + public static function getSupplierMonthlySalesCosts(int $supplier, \DateTime $start, \DateTime $end) : array + { + $sql = <<= '{$start->format('Y-m-d H:i:s')}' + AND billing_bill_performance_date <= '{$end->format('Y-m-d H:i:s')}' + GROUP BY year, month + ORDER BY year ASC, month ASC; + SQL; + + $query = new Builder(self::$db); + $result = $query->raw($sql)->execute()?->fetchAll(\PDO::FETCH_ASSOC) ?? []; + + return $result ?? []; + } + + /** + * Placeholder + * @todo Implement + */ + public static function getSupplierAttributeNetSales( + int $supplier, + string $attribute, + string $language, + \DateTime $start, + \DateTime $end + ) : array + { + $sql = <<= '{$start->format('Y-m-d H:i:s')}' + AND billing_bill_performance_date <= '{$end->format('Y-m-d H:i:s')}' + AND itemmgmt_attr_type_name = '{$attribute}' + GROUP BY + itemmgmt_attr_value_l11n_title; + SQL; + + $query = new Builder(self::$db); + $result = $query->raw($sql)->execute()?->fetchAll(\PDO::FETCH_ASSOC) ?? []; + + return $result; + } + + /** + * Placeholder + * @todo Implement + */ + public static function getSupplierItem(int $supplier, \DateTime $start, \DateTime $end) : array + { + return BillElementMapper::getAll() + ->with('bill') + ->with('bill/type') + ->where('bill/supplier', $supplier) + ->where('bill/type/transferStock', true) + ->executeGetArray(); + } } diff --git a/Models/SalesBillMapper.php b/Models/SalesBillMapper.php index 60b1360..79cc38c 100755 --- a/Models/SalesBillMapper.php +++ b/Models/SalesBillMapper.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules\Billing\Models * @copyright Dennis Eichhorn @@ -16,11 +16,11 @@ namespace Modules\Billing\Models; use Modules\ClientManagement\Models\ClientMapper; use phpOMS\DataStorage\Database\Query\Builder; -use phpOMS\Localization\Defaults\CountryMapper; +use phpOMS\DataStorage\Database\Query\OrderType; use phpOMS\Stdlib\Base\FloatInt; /** - * Mapper class. + * SalesBill mapper class. * * @package Modules\Billing\Models * @license OMS License 2.0 @@ -54,7 +54,7 @@ final class SalesBillMapper extends BillMapper ->where('id', $pivot, '<') ->where('type/transferType', BillTransferType::SALES) ->limit($limit) - ->execute(); + ->executeGetArray(); } /** @@ -74,7 +74,7 @@ final class SalesBillMapper extends BillMapper ->where('id', $pivot, '>') ->where('type/transferType', BillTransferType::SALES) ->limit($limit) - ->execute(); + ->executeGetArray(); } /** @@ -257,13 +257,16 @@ final class SalesBillMapper extends BillMapper { $query = new Builder(self::$db); $query->selectAs(ClientMapper::TABLE . '.clientmgmt_client_id', 'client') - ->selectAs('SUM(' . BillElementMapper::TABLE . '.billing_bill_element_total_netsalesprice)', 'net_sales') + ->selectAs('SUM(' . BillElementMapper::TABLE . '.billing_bill_element_total_netsalesprice * billing_type_transfer_sign)', 'net_sales') ->from(ClientMapper::TABLE) ->leftJoin(self::TABLE) ->on(ClientMapper::TABLE . '.clientmgmt_client_id', '=', self::TABLE . '.billing_bill_client') ->leftJoin(BillElementMapper::TABLE) ->on(self::TABLE . '.billing_bill_id', '=', BillElementMapper::TABLE . '.billing_bill_element_bill') + ->leftJoin(BillTypeMapper::TABLE) + ->on(self::TABLE . '.billing_bill_type', '=', BillTypeMapper::TABLE . '.billing_type_id') ->where(BillElementMapper::TABLE . '.billing_bill_element_item', '=', $id) + ->andWhere(BillTypeMapper::TABLE . '.billing_type_accounting', '=', true) ->andWhere(self::TABLE . '.billing_bill_performance_date', '>=', $start) ->andWhere(self::TABLE . '.billing_bill_performance_date', '<=', $end) ->orderBy('net_sales', 'DESC') @@ -284,7 +287,7 @@ final class SalesBillMapper extends BillMapper ->with('account') ->with('mainAddress') ->where('id', $clientIds, 'IN') - ->execute(); + ->executeGetArray(); } return [$clients, $data]; @@ -294,28 +297,27 @@ final class SalesBillMapper extends BillMapper * Placeholder * @todo Implement */ - public static function getItemBills(int $id, \DateTime $start, \DateTime $end) : array + public static function getItemBills(int $id, \DateTime $start, \DateTime $end, int $limit = 10000) : array { $query = self::reader() ->with('type') ->with('type/l11n') ->where('type/l11n/language', 'en') + ->where('createdAt', $start, '>=') + ->where('createdAt', $end, '<=') + ->sort('id', OrderType::DESC) + ->limit($limit) ->getQuery(); $query->leftJoin(BillElementMapper::TABLE, BillElementMapper::TABLE . '_d1') ->on(self::TABLE . '_d1.billing_bill_id', '=', BillElementMapper::TABLE . '_d1.billing_bill_element_bill') ->where(BillElementMapper::TABLE . '_d1.billing_bill_element_item', '=', $id); - /** @phpstan-ignore-next-line */ - if (!empty(self::CREATED_AT)) { - $query->orderBy(self::TABLE . '_d1.' . self::COLUMNS[self::CREATED_AT]['name'], 'DESC'); - } else { - $query->orderBy(self::TABLE . '_d1.' . self::COLUMNS[self::PRIMARYFIELD]['name'], 'DESC'); - } - return self::getAll() ->with('type') ->with('type/l11n') + ->sort('id', OrderType::DESC) + ->limit($limit) ->execute($query); } @@ -332,7 +334,7 @@ final class SalesBillMapper extends BillMapper ->where('type/l11n/language', $language) ->where('billDate', $start, '>=') ->where('billDate', $end, '<=') - ->execute(); + ->executeGetArray(); } /** @@ -346,33 +348,50 @@ final class SalesBillMapper extends BillMapper ->with('bill/type') ->where('bill/client', $client) ->where('bill/type/transferStock', true) - ->execute(); + ->executeGetArray(); } /** * Placeholder * @todo Implement */ - public static function getItemCountrySales(int $id, \DateTime $start, \DateTime $end, int $limit = 10) : array + public static function getItemCountrySales(int $item, \DateTime $start, \DateTime $end, int $limit = 10) : array { - $query = new Builder(self::$db); - $result = $query->select(CountryMapper::TABLE . '.country_code2') - ->selectAs('SUM(billing_bill_element_total_netsalesprice)', 'net_sales') - ->from(self::TABLE) - ->leftJoin(BillElementMapper::TABLE) - ->on(self::TABLE . '.billing_bill_id', '=', BillElementMapper::TABLE . '.billing_bill_element_bill') - ->leftJoin(CountryMapper::TABLE) - ->on(self::TABLE . '.billing_bill_billCountry', '=', CountryMapper::TABLE . '.country_code2') - ->where(BillElementMapper::TABLE . '.billing_bill_element_item', '=', $id) - ->andWhere(self::TABLE . '.billing_bill_performance_date', '>=', $start) - ->andWhere(self::TABLE . '.billing_bill_performance_date', '<=', $end) - ->groupBy(CountryMapper::TABLE . '.country_code2') - ->orderBy('net_sales', 'DESC') - ->limit($limit) - ->execute() - ?->fetchAll(\PDO::FETCH_KEY_PAIR); + $sql = <<= '{$start->format('Y-m-d H:i:s')}' + AND billing_bill_performance_date <= '{$end->format('Y-m-d H:i:s')}' + GROUP BY + billing_bill_billCountry + LIMIT {$limit}; + SQL; - return $result ?? []; + $query = new Builder(self::$db); + $results = $query->raw($sql)->execute()?->fetchAll(\PDO::FETCH_ASSOC) ?? []; + + if ($results === false) { + return []; + } + + $hasData = false; + foreach ($results as $result) { + if ($result !== "0" || $result > 0) { + $hasData = true; + break; + } + } + + return $hasData ? $results : []; } /** @@ -390,24 +409,40 @@ final class SalesBillMapper extends BillMapper $sql = <<= '{$start->format('Y-m-d H:i:s')}' AND billing_bill_performance_date <= '{$end->format('Y-m-d H:i:s')}' GROUP BY billing_bill_element_item, year, month ORDER BY billing_bill_element_item, year ASC, month ASC; SQL; - $query = new Builder(self::$db); - $result = $query->raw($sql)->execute()?->fetchAll(\PDO::FETCH_ASSOC) ?? []; + $query = new Builder(self::$db); + $results = $query->raw($sql)->execute()?->fetchAll(\PDO::FETCH_ASSOC) ?? []; - return $result ?? []; + if ($results === false) { + return []; + } + + $hasData = false; + foreach ($results as $result) { + if ($result['net_sales'] !== "0" || $result['net_sales'] > 0 + || $result['net_costs'] !== "0" || $result['net_costs'] > 0 + ) { + $hasData = true; + break; + } + } + + return $hasData ? $results : []; } /** @@ -452,13 +487,15 @@ final class SalesBillMapper extends BillMapper { $sql = <<= '{$start->format('Y-m-d H:i:s')}' AND billing_bill_performance_date <= '{$end->format('Y-m-d H:i:s')}' GROUP BY year, month @@ -493,6 +530,55 @@ final class SalesBillMapper extends BillMapper return new FloatInt((int) ($result[0]['net_sales'] ?? 0)); } + /** + * Placeholder + * @todo Implement + */ + public static function getClientAttributeNetSales( + int $client, + string $attribute, + string $language, + \DateTime $start, + \DateTime $end + ) : array + { + $sql = <<= '{$start->format('Y-m-d H:i:s')}' + AND billing_bill_performance_date <= '{$end->format('Y-m-d H:i:s')}' + AND itemmgmt_attr_type_name = '{$attribute}' + GROUP BY + itemmgmt_attr_value_l11n_title; + SQL; + + $query = new Builder(self::$db); + $result = $query->raw($sql)->execute()?->fetchAll(\PDO::FETCH_ASSOC) ?? []; + + return $result; + } + /** * Placeholder * @todo Implement @@ -551,8 +637,10 @@ final class SalesBillMapper extends BillMapper public static function getClientNetSales(int $client, \DateTime $start, \DateTime $end) : FloatInt { $sql = <<= '{$start->format('Y-m-d H:i:s')}' @@ -572,8 +660,10 @@ final class SalesBillMapper extends BillMapper public static function getCLVHistoric(int $client) : FloatInt { $sql = <<where('id', $pivot, '<') ->where('transferType', BillTransferType::SALES) ->limit($limit) - ->execute(); + ->executeGetArray(); } /** @@ -69,6 +69,6 @@ final class StockBillMapper extends BillMapper ->where('id', $pivot, '>') ->where('transferType', BillTransferType::SALES) ->limit($limit) - ->execute(); + ->executeGetArray(); } } diff --git a/Models/Subscription.php b/Models/Subscription.php index feccea0..0a151eb 100755 --- a/Models/Subscription.php +++ b/Models/Subscription.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules\Billing\Models * @copyright Dennis Eichhorn diff --git a/Models/SubscriptionMapper.php b/Models/SubscriptionMapper.php index 7f2a098..61befbe 100755 --- a/Models/SubscriptionMapper.php +++ b/Models/SubscriptionMapper.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules\Billing\Models * @copyright Dennis Eichhorn @@ -17,7 +17,7 @@ namespace Modules\Billing\Models; use phpOMS\DataStorage\Database\Mapper\DataMapperFactory; /** - * Mapper class. + * Subscription mapper class. * * @package Modules\Billing\Models * @license OMS License 2.0 diff --git a/Models/Tax/BillTaxType.php b/Models/Tax/BillTaxType.php index 951c23e..7bc2fb8 100755 --- a/Models/Tax/BillTaxType.php +++ b/Models/Tax/BillTaxType.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules\Billing\Models\Tax * @copyright Dennis Eichhorn diff --git a/Models/Tax/NullTaxCombination.php b/Models/Tax/NullTaxCombination.php index 13a142b..41bb20a 100755 --- a/Models/Tax/NullTaxCombination.php +++ b/Models/Tax/NullTaxCombination.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules\Billing\Models\Tax * @copyright Dennis Eichhorn diff --git a/Models/Tax/TaxCombination.php b/Models/Tax/TaxCombination.php index 56bd8cf..4e8ca72 100755 --- a/Models/Tax/TaxCombination.php +++ b/Models/Tax/TaxCombination.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules\Billing\Models\Tax * @copyright Dennis Eichhorn diff --git a/Models/Tax/TaxCombinationMapper.php b/Models/Tax/TaxCombinationMapper.php index b4ad10f..9e5b43a 100755 --- a/Models/Tax/TaxCombinationMapper.php +++ b/Models/Tax/TaxCombinationMapper.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules\Billing\Models\Tax * @copyright Dennis Eichhorn diff --git a/Theme/Backend/Lang/Navigation.de.lang.php b/Theme/Backend/Lang/Navigation.de.lang.php index 2adfaa3..3130d50 100755 --- a/Theme/Backend/Lang/Navigation.de.lang.php +++ b/Theme/Backend/Lang/Navigation.de.lang.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules\Localization * @copyright Dennis Eichhorn diff --git a/Theme/Backend/Lang/Navigation.en.lang.php b/Theme/Backend/Lang/Navigation.en.lang.php index 0d87942..863c619 100755 --- a/Theme/Backend/Lang/Navigation.en.lang.php +++ b/Theme/Backend/Lang/Navigation.en.lang.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules\Localization * @copyright Dennis Eichhorn diff --git a/Theme/Backend/Lang/de.lang.php b/Theme/Backend/Lang/de.lang.php index d1b05de..92340ea 100755 --- a/Theme/Backend/Lang/de.lang.php +++ b/Theme/Backend/Lang/de.lang.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules\Localization * @copyright Dennis Eichhorn @@ -13,81 +13,92 @@ declare(strict_types=1); return ['Billing' => [ - 'Address' => 'Adresse', - 'Addresses' => 'Adressen', - 'AlreadyPaid' => 'Bereits bezahlt', - 'Amount' => 'Betrag', - 'Archive' => 'Archiev', - 'Internal' => 'Intern', - 'Error' => 'Fehler', - 'Billing' => 'Rechnungsstellung', - 'External' => 'Extern', - 'Bills' => 'Rechnungen', - 'Bonus' => 'Bonus', - 'Cashback' => 'Kennzeichnen', - 'City' => 'Stadt', - 'Client' => 'Kunde', - 'ClientID' => 'Kunden ID', - 'Confirmation' => 'Bestätigung', - 'Country' => 'Land', - 'Created' => 'Erstellt', - 'CreditCard' => 'Kreditkarte', - 'CreditNote' => 'Rechnungskorrektur', - 'Currency' => 'Währung', - 'Date' => 'Datum', - 'Delivery' => 'Lieferung', - 'DeliveryNote' => 'Lieferschein', - 'DirectDebit' => 'Direktüberweisung.', - 'Discount' => 'Rabatt', - 'DiscountP' => 'Rabatt %', - 'Due' => 'Fällig', - 'Email' => 'Email', - 'Freightage' => 'Fracht', - 'Gross' => 'Brutto', - 'Invoice' => 'Rechnung', - 'Item' => 'Artikel', - 'Items' => 'Produkte', - 'Language' => 'Sprache', - 'Log' => 'Protokoll', - 'Logs' => 'Protokolle', - 'Media' => 'Medien', - 'MoneyTransfer' => 'Überweisung', - 'Name' => 'Name', - 'Net' => 'Netz', - 'Parse' => 'Rechnungserkennung', - 'Offer' => 'Angebot', - 'Original' => 'Original', - 'Payment' => 'Zahlung', - 'PaymentPlan' => 'Zahlungsplan', - 'Postal' => 'Post', - 'Prepaid' => 'Vorausbezahlt', - 'Preview' => 'Vorschau', - 'Price' => 'Preis', - 'Profit' => 'Gewinn', - 'Quantity' => 'Menge', - 'Recipient' => 'Empfänger', - 'Select' => 'Wählen', - 'Shipment' => 'Sendung', - 'Source' => 'Quelle', - 'Supplier' => 'Anbieter', - 'SupplierID' => 'Lieferanten ID', - 'Tax' => 'Steuer', - 'TaxP' => 'Steuer %', - 'Margin' => 'Marge', - 'TermsOfDelivery' => 'Lieferbedingungen', - 'Total' => 'Gesamt', - 'Type' => 'Typ', - 'Types' => 'Typen', - 'Upload' => 'Hochladen', - 'Zip' => 'Zip', - 'Files' => 'Files', - 'PaymentTerms' => 'Zahlungsbedingungen', - 'ShippingTerms' => 'Lieferbedingungen', - 'PaymentTerm' => 'Zahlungsbedingung', - 'ShippingTerm' => 'Lieferbedingung', - 'E_bill_items' => 'Es gibt ein Problem mit Ihren Artikeln.', - 'E_bill_taxes' => 'Der Gesamtsteuerbetrag stimmt nicht mit dem Steuerbetrag der Elemente überein. Möglicherweise gibt es ein Problem mit den Steuersätzen oder zusätzlichen Posten.', - 'E_bill_net' => 'Der Gesamtnettobetrag stimmt nicht mit dem Nettobetrag der Elemente überein. Mögliches Problem mit Steuersätzen oder zusätzlichen Positionen.', - 'E_bill_gross' => 'Der Gesamtbruttobetrag stimmt nicht mit dem Bruttobetrag der Elemente überein. Mögliches Problem mit Steuersätzen oder zusätzlichen Positionen.', - 'E_bill_unit' => 'Stückpreis stimmt nicht mit Gesamtpreis überein. Mögliche Probleme mit Preis, Menge oder Rabatten.', + 'Address' => 'Adresse', + 'Addresses' => 'Adressen', + 'AlreadyPaid' => 'Bereits bezahlt', + 'Amount' => 'Betrag', + 'Archive' => 'Archiev', + 'Internal' => 'Intern', + 'Error' => 'Fehler', + 'Billing' => 'Rechnungsstellung', + 'External' => 'Extern', + 'Bills' => 'Rechnungen', + 'Bonus' => 'Bonus', + 'Cashback' => 'Kennzeichnen', + 'City' => 'Stadt', + 'Client' => 'Kunde', + 'ClientID' => 'Kunden ID', + 'Confirmation' => 'Bestätigung', + 'Country' => 'Land', + 'Created' => 'Erstellt', + 'CreditCard' => 'Kreditkarte', + 'CreditNote' => 'Rechnungskorrektur', + 'Currency' => 'Währung', + 'Date' => 'Datum', + 'Delivery' => 'Lieferung', + 'DeliveryNote' => 'Lieferschein', + 'DirectDebit' => 'Direktüberweisung.', + 'Discount' => 'Rabatt', + 'DiscountP' => 'Rabatt %', + 'Due' => 'Fällig', + 'Email' => 'Email', + 'Freightage' => 'Fracht', + 'Gross' => 'Brutto', + 'Invoice' => 'Rechnung', + 'Item' => 'Artikel', + 'Items' => 'Produkte', + 'Language' => 'Sprache', + 'Log' => 'Protokoll', + 'Logs' => 'Protokolle', + 'Media' => 'Medien', + 'MoneyTransfer' => 'Überweisung', + 'Name' => 'Name', + 'Net' => 'Netz', + 'Parse' => 'Rechnungserkennung', + 'Offer' => 'Angebot', + 'Original' => 'Original', + 'Payment' => 'Zahlung', + 'PaymentPlan' => 'Zahlungsplan', + 'Postal' => 'Post', + 'Prepaid' => 'Vorausbezahlt', + 'Preview' => 'Vorschau', + 'Price' => 'Preis', + 'Profit' => 'Gewinn', + 'Quantity' => 'Menge', + 'Recipient' => 'Empfänger', + 'Select' => 'Wählen', + 'Shipment' => 'Sendung', + 'Source' => 'Quelle', + 'Supplier' => 'Anbieter', + 'SupplierID' => 'Lieferanten ID', + 'Tax' => 'Steuer', + 'TaxP' => 'Steuer %', + 'Margin' => 'Marge', + 'TermsOfDelivery' => 'Lieferbedingungen', + 'Total' => 'Gesamt', + 'Type' => 'Typ', + 'Types' => 'Typen', + 'Upload' => 'Hochladen', + 'Zip' => 'Zip', + 'Files' => 'Files', + 'TaxCode' => 'Steuerkz.', + 'PL' => 'GuV', + ':combinationtype-1' => 'Verkauf', + ':combinationtype-2' => 'Einkauf', + 'PLAccount' => 'GuV-Konto', + 'Tax1Account' => 'Steuerkonto 1', + 'Tax2Account' => 'Steuerkonto 2', + 'TaxCombinations' => 'Steuerkomb.', + 'PaymentTerms' => 'Zahlungsbedingungen', + 'ShippingTerms' => 'Lieferbedingungen', + 'PaymentTerm' => 'Zahlungsbedingung', + 'ShippingTerm' => 'Lieferbedingung', + 'RecognitionUpload1' => 'Einzelne Rechnung', + 'RecognitionUpload2' => 'Mehrere Rechnungen in getrennten Dateien', + 'RecognitionUpload3' => 'Mehrere Rechnungen in einer Datei ABER getrennt mit einer farbigen Zwischenseite', + 'E_bill_items' => 'Es gibt ein Problem mit Ihren Artikeln.', + 'E_bill_taxes' => 'Der Gesamtsteuerbetrag stimmt nicht mit dem Steuerbetrag der Elemente überein. Möglicherweise gibt es ein Problem mit den Steuersätzen oder zusätzlichen Posten.', + 'E_bill_net' => 'Der Gesamtnettobetrag stimmt nicht mit dem Nettobetrag der Elemente überein. Mögliches Problem mit Steuersätzen oder zusätzlichen Positionen.', + 'E_bill_gross' => 'Der Gesamtbruttobetrag stimmt nicht mit dem Bruttobetrag der Elemente überein. Mögliches Problem mit Steuersätzen oder zusätzlichen Positionen.', + 'E_bill_unit' => 'Stückpreis stimmt nicht mit Gesamtpreis überein. Mögliche Probleme mit Preis, Menge oder Rabatten.', ]]; diff --git a/Theme/Backend/Lang/en.lang.php b/Theme/Backend/Lang/en.lang.php index a7bbb44..7d10a7d 100755 --- a/Theme/Backend/Lang/en.lang.php +++ b/Theme/Backend/Lang/en.lang.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules\Localization * @copyright Dennis Eichhorn @@ -13,81 +13,92 @@ declare(strict_types=1); return ['Billing' => [ - 'Address' => 'Address', - 'Addresses' => 'Addresses', - 'AlreadyPaid' => 'Already Paid', - 'Amount' => 'Amount', - 'Archive' => 'Archive', - 'Internal' => 'Internal', - 'Error' => 'Error', - 'Billing' => 'Billing', - 'External' => 'External', - 'Bills' => 'Bills', - 'Bonus' => 'Bonus', - 'Cashback' => 'Cash Back', - 'City' => 'City', - 'Client' => 'Client', - 'ClientID' => 'Client ID', - 'Confirmation' => 'Confirmation', - 'Country' => 'Country', - 'Created' => 'Created', - 'CreditCard' => 'CreditCard', - 'CreditNote' => 'Credit Note', - 'Currency' => 'Currency', - 'Date' => 'Date', - 'Delivery' => 'Delivery', - 'DeliveryNote' => 'Delivery Note', - 'DirectDebit' => 'DirectDebit', - 'Discount' => 'Discount', - 'DiscountP' => 'Discount %', - 'Due' => 'Due', - 'Email' => 'Email', - 'Freightage' => 'Freightage', - 'Gross' => 'Gross', - 'Invoice' => 'Invoice', - 'Item' => 'Item', - 'Items' => 'Items', - 'Language' => 'Language', - 'Log' => 'Log', - 'Logs' => 'Logs', - 'Media' => 'Media', - 'MoneyTransfer' => 'Money Transfer', - 'Name' => 'Name', - 'Net' => 'Net', - 'Parse' => 'Invoice recognition', - 'Offer' => 'Offer', - 'Original' => 'Original', - 'Payment' => 'Payment', - 'PaymentPlan' => 'Payment Plan', - 'Postal' => 'Postal', - 'Prepaid' => 'Prepaid', - 'Preview' => 'Preview', - 'Price' => 'Price', - 'Profit' => 'Profit', - 'Quantity' => 'Quantity', - 'Recipient' => 'Recipient', - 'Select' => 'Select', - 'Shipment' => 'Shipment', - 'Source' => 'Source', - 'Supplier' => 'Supplier', - 'SupplierID' => 'Supplier ID', - 'Tax' => 'Tax', - 'TaxP' => 'Tax %', - 'Margin' => 'Margin', - 'TermsOfDelivery' => 'Terms Of Delivery', - 'Total' => 'Total', - 'Type' => 'Type', - 'Types' => 'Types', - 'Upload' => 'Upload', - 'Zip' => 'Zip', - 'Files' => 'Files', - 'PaymentTerms' => 'Payment Terms', - 'ShippingTerms' => 'Shipping Terms', - 'PaymentTerm' => 'Payment Term', - 'ShippingTerm' => 'Shipping Term', - 'E_bill_items' => 'There is an issue with your bill items.', - 'E_bill_taxes' => 'The total tax amount doesn\'t match the tax amount of the elements. Potential issue with tax rates or additional items.', - 'E_bill_net' => 'The total net amount doesn\'t match the net amount of the elements. Potential issue with tax rates or additional items.', - 'E_bill_gross' => 'The total gross amount doesn\'t match the gross amount of the elements. Potential issue with tax rates or additional items.', - 'E_bill_unit' => 'Unit price doesn\'t match total price. Potential issues with price, quantity or discounts.', + 'Address' => 'Address', + 'Addresses' => 'Addresses', + 'AlreadyPaid' => 'Already Paid', + 'Amount' => 'Amount', + 'Archive' => 'Archive', + 'Internal' => 'Internal', + 'Error' => 'Error', + 'Billing' => 'Billing', + 'External' => 'External', + 'Bills' => 'Bills', + 'Bonus' => 'Bonus', + 'Cashback' => 'Cash Back', + 'City' => 'City', + 'Client' => 'Client', + 'ClientID' => 'Client ID', + 'Confirmation' => 'Confirmation', + 'Country' => 'Country', + 'Created' => 'Created', + 'CreditCard' => 'CreditCard', + 'CreditNote' => 'Credit Note', + 'Currency' => 'Currency', + 'Date' => 'Date', + 'Delivery' => 'Delivery', + 'DeliveryNote' => 'Delivery Note', + 'DirectDebit' => 'DirectDebit', + 'Discount' => 'Discount', + 'DiscountP' => 'Discount %', + 'Due' => 'Due', + 'Email' => 'Email', + 'Freightage' => 'Freightage', + 'Gross' => 'Gross', + 'Invoice' => 'Invoice', + 'Item' => 'Item', + 'Items' => 'Items', + 'Language' => 'Language', + 'Log' => 'Log', + 'Logs' => 'Logs', + 'Media' => 'Media', + 'MoneyTransfer' => 'Money Transfer', + 'Name' => 'Name', + 'Net' => 'Net', + 'Parse' => 'Invoice recognition', + 'Offer' => 'Offer', + 'Original' => 'Original', + 'Payment' => 'Payment', + 'PaymentPlan' => 'Payment Plan', + 'Postal' => 'Postal', + 'Prepaid' => 'Prepaid', + 'Preview' => 'Preview', + 'Price' => 'Price', + 'Profit' => 'Profit', + 'Quantity' => 'Quantity', + 'Recipient' => 'Recipient', + 'Select' => 'Select', + 'Shipment' => 'Shipment', + 'Source' => 'Source', + 'Supplier' => 'Supplier', + 'SupplierID' => 'Supplier ID', + 'Tax' => 'Tax', + 'TaxP' => 'Tax %', + 'Margin' => 'Margin', + 'TermsOfDelivery' => 'Terms Of Delivery', + 'Total' => 'Total', + 'Type' => 'Type', + 'Types' => 'Types', + 'Upload' => 'Upload', + 'Zip' => 'Zip', + 'Files' => 'Files', + 'TaxCode' => 'Tax Code', + 'PL' => 'PL', + ':combinationtype-1' => 'Sales', + ':combinationtype-2' => 'Purchase', + 'PLAccount' => 'PL Account', + 'Tax1Account' => 'Tax Account 1', + 'Tax2Account' => 'Tax Account 2', + 'TaxCombinations' => 'Tax Combinations', + 'PaymentTerms' => 'Payment Terms', + 'ShippingTerms' => 'Shipping Terms', + 'PaymentTerm' => 'Payment Term', + 'ShippingTerm' => 'Shipping Term', + 'RecognitionUpload1' => 'Individual file upload', + 'RecognitionUpload2' => 'Multiple invoices in separate files', + 'RecognitionUpload3' => 'Multiple invoices in one file BUT separated with a colored spacer paper', + 'E_bill_items' => 'There is an issue with your bill items.', + 'E_bill_taxes' => 'The total tax amount doesn\'t match the tax amount of the elements. Potential issue with tax rates or additional items.', + 'E_bill_net' => 'The total net amount doesn\'t match the net amount of the elements. Potential issue with tax rates or additional items.', + 'E_bill_gross' => 'The total gross amount doesn\'t match the gross amount of the elements. Potential issue with tax rates or additional items.', + 'E_bill_unit' => 'Unit price doesn\'t match total price. Potential issues with price, quantity or discounts.', ]]; diff --git a/Theme/Backend/bill-create.tpl.php b/Theme/Backend/bill-create.tpl.php index b1c7d66..3c5e46e 100755 --- a/Theme/Backend/bill-create.tpl.php +++ b/Theme/Backend/bill-create.tpl.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules\Billing * @copyright Dennis Eichhorn @@ -354,7 +354,7 @@ echo $this->data['nav']->render(); ?> > - + > > > @@ -422,7 +422,7 @@ echo $this->data['nav']->render(); ?>
- +
@@ -436,7 +436,7 @@ echo $this->data['nav']->render(); ?>
- +
@@ -555,7 +555,7 @@ echo $this->data['nav']->render(); ?>
-
+
getHtml('Logs'); ?>download
@@ -585,7 +585,7 @@ echo $this->data['nav']->render(); ?>
createdAt->format('Y-m-d H:i'); ?>
-
+
diff --git a/Theme/Backend/finance-taxcombination-list.tpl.php b/Theme/Backend/finance-taxcombination-list.tpl.php new file mode 100644 index 0000000..2144e8c --- /dev/null +++ b/Theme/Backend/finance-taxcombination-list.tpl.php @@ -0,0 +1,73 @@ +data['taxcombination']; + +$previous = empty($taxcombination) ? '{/base}/finance/tax/combination/list' : '{/base}/finance/tax/combination/list?{?}&offset=' . \reset($taxcombination)->id . '&ptype=p'; +$next = empty($taxcombination) ? '{/base}/finance/tax/combination/list' : '{/base}/finance/tax/combination/list?{?}&offset=' . \end($taxcombination)->id . '&ptype=n'; + +echo $this->data['nav']->render(); ?> +
+
+
+
getHtml('TaxCombinations'); ?>download
+ + + + + $value) : ++$count; + $url = UriFactory::build('{/base}/finance/tax/combination/view?{?}&id=' . $value->id); ?> + +
getHtml('ID', '0', '0'); ?> + getHtml('Client'); ?> + getHtml('Supplier'); ?> + getHtml('Item'); ?> + getHtml('TaxCode'); ?> + getHtml('Tax'); ?> + getHtml('PL'); ?> +
+ id; ?> + + printHtml($value->clientCode->getValue()); ?> + + printHtml($value->supplierCode->getValue()); ?> + + printHtml($value->itemCode->getValue()); ?> + + printHtml($value->taxCode->abbr); ?> + + taxCode->percentageInvoice / 10000; ?> % + + printHtml($value->account); ?> + + +
getHtml('Empty', '0', '0'); ?> + +
+ +
+
+
diff --git a/Theme/Backend/finance-taxcombination-view.tpl.php b/Theme/Backend/finance-taxcombination-view.tpl.php new file mode 100644 index 0000000..7e52e5d --- /dev/null +++ b/Theme/Backend/finance-taxcombination-view.tpl.php @@ -0,0 +1,146 @@ +data['taxcombination'] ?? new NullTaxCombination(); +$isNew = $taxcombination->id === 0; + +$combinationType = BillTaxType::getConstants(); + +/** @var \phpOMS\Views\View $this */ +echo $this->data['nav']->render(); ?> +
+
+
+
+
getHtml('TaxCode'); ?>
+
+
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+
+
+ + + + + +
+
+
+
+
diff --git a/Theme/Backend/payment-type-list.tpl.php b/Theme/Backend/payment-type-list.tpl.php index d36f6d8..21d8cec 100644 --- a/Theme/Backend/payment-type-list.tpl.php +++ b/Theme/Backend/payment-type-list.tpl.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules\ItemManagement * @copyright Dennis Eichhorn diff --git a/Theme/Backend/payment-view.tpl.php b/Theme/Backend/payment-view.tpl.php index 40f1511..5fb9110 100644 --- a/Theme/Backend/payment-view.tpl.php +++ b/Theme/Backend/payment-view.tpl.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules\Billing * @copyright Dennis Eichhorn @@ -21,8 +21,8 @@ $type = $this->data['type']; echo $this->data['nav']->render(); ?>
-
-
+ @@ -30,7 +30,7 @@ echo $this->data['nav']->render(); ?>
- +
@@ -39,7 +39,7 @@ echo $this->data['nav']->render(); ?>
-
+
@@ -47,7 +47,7 @@ echo $this->data['nav']->render(); ?> data['l11nView']->render( $this->data['l11nValues'], [], - '{/api}bill/payment/l11n' + '{/api}bill/payment/l11n?csrf={$CSRF}' ); ?> \ No newline at end of file diff --git a/Theme/Backend/purchase-bill-list.tpl.php b/Theme/Backend/purchase-bill-list.tpl.php index ad3f775..6393246 100755 --- a/Theme/Backend/purchase-bill-list.tpl.php +++ b/Theme/Backend/purchase-bill-list.tpl.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules\Billing * @copyright Dennis Eichhorn @@ -20,7 +20,7 @@ echo $this->data['nav']->render(); ?>
-
+
getHtml('Bills'); ?>download
@@ -166,7 +166,7 @@ echo $this->data['nav']->render(); ?> $value) : ++$count; - $url = UriFactory::build('{/base}/purchase/bill?{?}&id=' . $value->id); + $url = UriFactory::build('{/base}/purchase/bill/view?{?}&id=' . $value->id); ?>
-
+
diff --git a/Theme/Backend/purchase-bill-upload.tpl.php b/Theme/Backend/purchase-bill-upload.tpl.php new file mode 100644 index 0000000..f442ac8 --- /dev/null +++ b/Theme/Backend/purchase-bill-upload.tpl.php @@ -0,0 +1,44 @@ +data['nav']->render(); ?> + +
+
+
+
+
getHtml('Upload'); ?>
+
+
+
    +
  • getHtml('RecognitionUpload1'); ?> +
  • getHtml('RecognitionUpload2'); ?> +
  • getHtml('RecognitionUpload3'); ?> +
+
+ +
+ + +
+
+
+ +
+
+
+
+
\ No newline at end of file diff --git a/Theme/Backend/purchase-bill.tpl.php b/Theme/Backend/purchase-bill.tpl.php index eae5982..fa086fe 100755 --- a/Theme/Backend/purchase-bill.tpl.php +++ b/Theme/Backend/purchase-bill.tpl.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules\Billing * @copyright Dennis Eichhorn @@ -352,7 +352,7 @@ echo $this->data['nav']->render(); ?> > - + > > > @@ -421,7 +421,7 @@ echo $this->data['nav']->render(); ?>
- +
@@ -438,7 +438,7 @@ echo $this->data['nav']->render(); ?>
@@ -453,7 +453,7 @@ echo $this->data['nav']->render(); ?>
@@ -573,7 +573,7 @@ echo $this->data['nav']->render(); ?>
-
+
getHtml('Logs'); ?>download
@@ -603,7 +603,7 @@ echo $this->data['nav']->render(); ?>
createdAt->format('Y-m-d H:i'); ?>
-
+
diff --git a/Theme/Backend/sales-bill-list.tpl.php b/Theme/Backend/sales-bill-list.tpl.php index 61c72da..67ff78e 100755 --- a/Theme/Backend/sales-bill-list.tpl.php +++ b/Theme/Backend/sales-bill-list.tpl.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules\Billing * @copyright Dennis Eichhorn @@ -20,7 +20,7 @@ echo $this->data['nav']->render(); ?>
-
+
getHtml('Bills'); ?>download
@@ -165,7 +165,7 @@ echo $this->data['nav']->render(); ?> $value) : ++$count; - $url = UriFactory::build('{/base}/sales/bill?{?}&id=' . $value->id); + $url = UriFactory::build('{/base}/sales/bill/view?{?}&id=' . $value->id); ?>
-
+
diff --git a/Theme/Backend/shipping-type-list.tpl.php b/Theme/Backend/shipping-type-list.tpl.php index 7db9527..54d3239 100644 --- a/Theme/Backend/shipping-type-list.tpl.php +++ b/Theme/Backend/shipping-type-list.tpl.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules\ItemManagement * @copyright Dennis Eichhorn diff --git a/Theme/Backend/shipping-view.tpl.php b/Theme/Backend/shipping-view.tpl.php index 545385f..480e744 100644 --- a/Theme/Backend/shipping-view.tpl.php +++ b/Theme/Backend/shipping-view.tpl.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules\Billing * @copyright Dennis Eichhorn @@ -21,8 +21,8 @@ $type = $this->data['type']; echo $this->data['nav']->render(); ?>
-
- + @@ -30,7 +30,7 @@ echo $this->data['nav']->render(); ?>
- +
@@ -39,7 +39,7 @@ echo $this->data['nav']->render(); ?>
-
+
@@ -47,7 +47,7 @@ echo $this->data['nav']->render(); ?> data['l11nView']->render( $this->data['l11nValues'], [], - '{/api}bill/shipping/l11n' + '{/api}bill/shipping/l11n?csrf={$CSRF}' ); ?>
\ No newline at end of file diff --git a/Theme/Backend/user-purchase-bill-dashboard.tpl.php b/Theme/Backend/user-purchase-bill-dashboard.tpl.php deleted file mode 100755 index 176c8b3..0000000 --- a/Theme/Backend/user-purchase-bill-dashboard.tpl.php +++ /dev/null @@ -1,202 +0,0 @@ -data['bills'] ?? []; - -echo $this->data['nav']->render(); ?> - -
-
-
-
getHtml('Bills'); ?>download
-
- - - - - $value) : - ++$count; - $url = UriFactory::build('{/base}/private/purchase/bill?{?}&id=' . $value->id); - ?> - -
- getHtml('ID', '0', '0'); ?> - - - - getHtml('External'); ?> - - - - getHtml('Type'); ?> - - - - getHtml('SupplierID'); ?> - - - - getHtml('Supplier'); ?> - - - - getHtml('Address'); ?> - - - - getHtml('Postal'); ?> - - - - getHtml('City'); ?> - - - - getHtml('Country'); ?> - - - - getHtml('Gross'); ?> - - - - getHtml('Date'); ?> - - - -
- getNumber(); ?> - external; ?> - type->getL11n(); ?> - supplier->number; ?> - printHtml($value->billTo); ?> - billAddress; ?> - billZip; ?> - billCity; ?> - billCountry) - ? '' - : ISO3166NameEnum::getByName( - ISO3166TwoEnum::getName($value->billCountry) - ); ?> - grossSales->getAmount(); ?> - billDate?->format('Y-m-d'); ?> - - -
getHtml('Empty', '0', '0'); ?> - -
-
-
-
-
diff --git a/Theme/Cli/Lang/de.lang.php b/Theme/Cli/Lang/de.lang.php index 776cf84..1949f83 100644 --- a/Theme/Cli/Lang/de.lang.php +++ b/Theme/Cli/Lang/de.lang.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules\Localization * @copyright Dennis Eichhorn diff --git a/Theme/Cli/Lang/en.lang.php b/Theme/Cli/Lang/en.lang.php index 776cf84..1949f83 100755 --- a/Theme/Cli/Lang/en.lang.php +++ b/Theme/Cli/Lang/en.lang.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules\Localization * @copyright Dennis Eichhorn diff --git a/tests/Admin/AdminTest.php b/tests/Admin/AdminTest.php index cc5faeb..f559565 100755 --- a/tests/Admin/AdminTest.php +++ b/tests/Admin/AdminTest.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package tests * @copyright Dennis Eichhorn diff --git a/tests/Autoloader.php b/tests/Autoloader.php index 28b8056..525390b 100755 --- a/tests/Autoloader.php +++ b/tests/Autoloader.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules/tests * @copyright Dennis Eichhorn diff --git a/tests/Bootstrap.php b/tests/Bootstrap.php index 4bf4f19..165c4ac 100755 --- a/tests/Bootstrap.php +++ b/tests/Bootstrap.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package Modules\Billing\tests * @copyright Dennis Eichhorn diff --git a/tests/Controller/Api/ApiBillControllerTrait.php b/tests/Controller/Api/ApiBillControllerTrait.php index 1670cbf..ca159b8 100644 --- a/tests/Controller/Api/ApiBillControllerTrait.php +++ b/tests/Controller/Api/ApiBillControllerTrait.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package tests * @copyright Dennis Eichhorn diff --git a/tests/Controller/Api/ApiPurchaseControllerTrait.php b/tests/Controller/Api/ApiPurchaseControllerTrait.php index f1aef72..7038509 100644 --- a/tests/Controller/Api/ApiPurchaseControllerTrait.php +++ b/tests/Controller/Api/ApiPurchaseControllerTrait.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package tests * @copyright Dennis Eichhorn diff --git a/tests/Controller/ApiControllerTest.php b/tests/Controller/ApiControllerTest.php index cb71db9..7170d45 100755 --- a/tests/Controller/ApiControllerTest.php +++ b/tests/Controller/ApiControllerTest.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package tests * @copyright Dennis Eichhorn diff --git a/tests/Models/BillElementTest.php b/tests/Models/BillElementTest.php index 063025f..53d7a1d 100755 --- a/tests/Models/BillElementTest.php +++ b/tests/Models/BillElementTest.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package tests * @copyright Dennis Eichhorn diff --git a/tests/Models/BillTest.php b/tests/Models/BillTest.php index 504ec9e..aad26fe 100755 --- a/tests/Models/BillTest.php +++ b/tests/Models/BillTest.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package tests * @copyright Dennis Eichhorn @@ -116,7 +116,7 @@ final class BillTest extends \PHPUnit\Framework\TestCase 'billCity' => 'City', 'billZip' => 'Zip', 'billCountry' => 'Country', - 'external' => '', + 'external' => '', ], $this->bill->jsonSerialize() ); diff --git a/tests/Models/BillTypeTest.php b/tests/Models/BillTypeTest.php index 708904a..6b54725 100755 --- a/tests/Models/BillTypeTest.php +++ b/tests/Models/BillTypeTest.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package tests * @copyright Dennis Eichhorn diff --git a/tests/Models/InvoiceRecognitionTest.php b/tests/Models/InvoiceRecognitionTest.php index 1bc79f6..a2c67c3 100644 --- a/tests/Models/InvoiceRecognitionTest.php +++ b/tests/Models/InvoiceRecognitionTest.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package tests * @copyright Dennis Eichhorn diff --git a/tests/Models/NullBillElementTest.php b/tests/Models/NullBillElementTest.php index e75ec1b..881b47f 100755 --- a/tests/Models/NullBillElementTest.php +++ b/tests/Models/NullBillElementTest.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package tests * @copyright Dennis Eichhorn diff --git a/tests/Models/NullBillTest.php b/tests/Models/NullBillTest.php index 668e6e1..7eecab9 100755 --- a/tests/Models/NullBillTest.php +++ b/tests/Models/NullBillTest.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package tests * @copyright Dennis Eichhorn diff --git a/tests/Models/NullBillTypeTest.php b/tests/Models/NullBillTypeTest.php index 5c3b9f4..a451822 100755 --- a/tests/Models/NullBillTypeTest.php +++ b/tests/Models/NullBillTypeTest.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package tests * @copyright Dennis Eichhorn diff --git a/tests/Models/NullSubscriptionTest.php b/tests/Models/NullSubscriptionTest.php index 27efe39..3fd5dcd 100644 --- a/tests/Models/NullSubscriptionTest.php +++ b/tests/Models/NullSubscriptionTest.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package tests * @copyright Dennis Eichhorn diff --git a/tests/Models/Price/NullPriceTest.php b/tests/Models/Price/NullPriceTest.php index b39e0d7..8368a48 100644 --- a/tests/Models/Price/NullPriceTest.php +++ b/tests/Models/Price/NullPriceTest.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package tests * @copyright Dennis Eichhorn diff --git a/tests/Models/PurchaseBillMapperTest.php b/tests/Models/PurchaseBillMapperTest.php index abf52fe..bf52365 100755 --- a/tests/Models/PurchaseBillMapperTest.php +++ b/tests/Models/PurchaseBillMapperTest.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package tests * @copyright Dennis Eichhorn diff --git a/tests/Models/SalesBillMapperTest.php b/tests/Models/SalesBillMapperTest.php index 0929f9e..3d6aac0 100755 --- a/tests/Models/SalesBillMapperTest.php +++ b/tests/Models/SalesBillMapperTest.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package tests * @copyright Dennis Eichhorn diff --git a/tests/Models/StockBillMapperTest.php b/tests/Models/StockBillMapperTest.php index f23c4e4..7a32459 100755 --- a/tests/Models/StockBillMapperTest.php +++ b/tests/Models/StockBillMapperTest.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package tests * @copyright Dennis Eichhorn diff --git a/tests/Models/Tax/NullTaxCombinationTest.php b/tests/Models/Tax/NullTaxCombinationTest.php index 62e331d..c035f17 100644 --- a/tests/Models/Tax/NullTaxCombinationTest.php +++ b/tests/Models/Tax/NullTaxCombinationTest.php @@ -2,7 +2,7 @@ /** * Jingga * - * PHP Version 8.1 + * PHP Version 8.2 * * @package tests * @copyright Dennis Eichhorn