mirror of
https://github.com/Karaka-Management/oms-Accounting.git
synced 2026-01-10 21:08:41 +00:00
update
This commit is contained in:
parent
1563d9de04
commit
655d816bf8
22
Admin/Hooks/Web/Api.php
Normal file
22
Admin/Hooks/Web/Api.php
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Accounting
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
return [
|
||||
'POST:Module:ClientManagement-client-create' => [
|
||||
'callback' => ['\Modules\Accounting\Controller\ApiController:hookPersonalAccountCreate'],
|
||||
],
|
||||
'POST:Module:SupplierManagement-supplier-create' => [
|
||||
'callback' => ['\Modules\Accounting\Controller\ApiController:hookPersonalAccountCreate'],
|
||||
],
|
||||
];
|
||||
43
Admin/Install/ClientManagement.php
Normal file
43
Admin/Install/ClientManagement.php
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Accounting\Admin\Install
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\Accounting\Admin\Install;
|
||||
|
||||
use phpOMS\Application\ApplicationAbstract;
|
||||
|
||||
/**
|
||||
* ClientManagement class.
|
||||
*
|
||||
* @package Modules\Accounting\Admin\Install
|
||||
* @license OMS License 2.0
|
||||
* @link https://jingga.app
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class ClientManagement
|
||||
{
|
||||
/**
|
||||
* Install navigation providing
|
||||
*
|
||||
* @param ApplicationAbstract $app Application
|
||||
* @param string $path Module path
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public static function install(ApplicationAbstract $app, string $path) : void
|
||||
{
|
||||
\Modules\Accounting\Admin\Installer::importPersonalAccounts($app, 'client');
|
||||
}
|
||||
}
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
{
|
||||
"name": "1",
|
||||
"l11n": {
|
||||
"en": "Turnorver",
|
||||
"en": "Turnover",
|
||||
"de": "Umsatzerlöse"
|
||||
},
|
||||
"account": [2750,2751,2752,2753,2754,2764],
|
||||
|
|
|
|||
|
|
@ -241,7 +241,38 @@
|
|||
"permission": { "permission": 2, "category": null, "element": null },
|
||||
"parent": 1002601001,
|
||||
"children": [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 1002607001,
|
||||
"pid": "/",
|
||||
"type": 2,
|
||||
"subtype": 1,
|
||||
"name": "Suppliers",
|
||||
"uri": "{/base}/accounting/supplier/list",
|
||||
"target": "self",
|
||||
"icon": null,
|
||||
"order": 1,
|
||||
"from": "Accounting",
|
||||
"permission": { "permission": 2, "category": null, "element": null },
|
||||
"parent": 1002601001,
|
||||
"children": [
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 1002608001,
|
||||
"pid": "/",
|
||||
"type": 2,
|
||||
"subtype": 1,
|
||||
"name": "Clients",
|
||||
"uri": "{/base}/accounting/client/list",
|
||||
"target": "self",
|
||||
"icon": null,
|
||||
"order": 1,
|
||||
"from": "Accounting",
|
||||
"permission": { "permission": 2, "category": null, "element": null },
|
||||
"parent": 1002601001,
|
||||
"children": [
|
||||
]
|
||||
}
|
||||
]
|
||||
|
|
|
|||
43
Admin/Install/SupplierManagement.php
Normal file
43
Admin/Install/SupplierManagement.php
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Accounting\Admin\Install
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\Accounting\Admin\Install;
|
||||
|
||||
use phpOMS\Application\ApplicationAbstract;
|
||||
|
||||
/**
|
||||
* SupplierManagement class.
|
||||
*
|
||||
* @package Modules\Accounting\Admin\Install
|
||||
* @license OMS License 2.0
|
||||
* @link https://jingga.app
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class SupplierManagement
|
||||
{
|
||||
/**
|
||||
* Install navigation providing
|
||||
*
|
||||
* @param ApplicationAbstract $app Application
|
||||
* @param string $path Module path
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public static function install(ApplicationAbstract $app, string $path) : void
|
||||
{
|
||||
\Modules\Accounting\Admin\Installer::importPersonalAccounts($app, 'supplier');
|
||||
}
|
||||
}
|
||||
|
|
@ -78,6 +78,13 @@
|
|||
"type": "INT",
|
||||
"default": null,
|
||||
"null": true
|
||||
},
|
||||
"accounting_costcenter_unit": {
|
||||
"name": "accounting_costcenter_unit",
|
||||
"type": "INT",
|
||||
"null": false,
|
||||
"foreignTable": "unit",
|
||||
"foreignKey": "unit_id"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
@ -138,6 +145,13 @@
|
|||
"type": "INT",
|
||||
"default": null,
|
||||
"null": true
|
||||
},
|
||||
"accounting_costobject_unit": {
|
||||
"name": "accounting_costobject_unit",
|
||||
"type": "INT",
|
||||
"null": false,
|
||||
"foreignTable": "unit",
|
||||
"foreignKey": "unit_id"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ namespace Modules\Accounting\Admin;
|
|||
|
||||
use phpOMS\Application\ApplicationAbstract;
|
||||
use phpOMS\Config\SettingsInterface;
|
||||
use phpOMS\Localization\ISO639x1Enum;
|
||||
use phpOMS\Message\Http\HttpRequest;
|
||||
use phpOMS\Message\Http\HttpResponse;
|
||||
use phpOMS\Module\InstallerAbstract;
|
||||
|
|
@ -99,7 +100,11 @@ final class Installer extends InstallerAbstract
|
|||
continue;
|
||||
}
|
||||
|
||||
$accountId = $responseData['response']->id;
|
||||
$account = \is_array($responseData['response'])
|
||||
? $responseData['response']
|
||||
: $responseData['response']->toArray();
|
||||
|
||||
$accountId = $account['id'];
|
||||
|
||||
for ($i = 1; $i < $languages; ++$i) {
|
||||
$response = new HttpResponse();
|
||||
|
|
@ -115,4 +120,38 @@ final class Installer extends InstallerAbstract
|
|||
|
||||
\fclose($fp);
|
||||
}
|
||||
|
||||
/**
|
||||
* Import accounts
|
||||
*
|
||||
* @param ApplicationAbstract $app Application
|
||||
* @param string $type Personal account type
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public static function importPersonalAccounts(ApplicationAbstract $app, string $type) : void
|
||||
{
|
||||
/** @var \Modules\Accounting\Controller\ApiController $module */
|
||||
$module = $app->moduleManager->getModuleInstance('Accounting', 'Api');
|
||||
|
||||
$mapper = $type === 'client'
|
||||
? \Modules\ClientManagement\Models\ClientMapper::class
|
||||
: \Modules\SupplierManagement\Models\SupplierMapper::class;
|
||||
|
||||
foreach ($mapper::yield() as $person) {
|
||||
$response = new HttpResponse();
|
||||
$request = new HttpRequest(new HttpUri(''));
|
||||
|
||||
// @todo define default account number format for clients, if number -> consider number as starting value
|
||||
// @todo define default account number format for suppliers, if number -> consider number as starting value
|
||||
|
||||
$request->header->account = 1;
|
||||
$request->setData('account', $person->number);
|
||||
$request->setData('content', \rtrim($person->account->name1 . ' ' . $person->account->name2));
|
||||
$request->setData('language', ISO639x1Enum::_EN);
|
||||
$module->apiAccountCreate($request, $response);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -117,6 +117,17 @@ return [
|
|||
],
|
||||
],
|
||||
],
|
||||
'^.*/accounting/coa/profile.*$' => [
|
||||
[
|
||||
'dest' => '\Modules\Accounting\Controller\BackendController:viewAccountProfile',
|
||||
'verb' => RouteVerb::GET,
|
||||
'permission' => [
|
||||
'module' => BackendController::NAME,
|
||||
'type' => PermissionType::READ,
|
||||
'state' => PermissionCategory::ACCOUNT,
|
||||
],
|
||||
],
|
||||
],
|
||||
'^.*/accounting/coa/list.*$' => [
|
||||
[
|
||||
'dest' => '\Modules\Accounting\Controller\BackendController:viewCOAList',
|
||||
|
|
@ -217,4 +228,93 @@ return [
|
|||
],
|
||||
],
|
||||
],
|
||||
'^.*/accounting/costcenter/profile.*$' => [
|
||||
[
|
||||
'dest' => '\Modules\Accounting\Controller\BackendController:viewCostCenterProfile',
|
||||
'verb' => RouteVerb::GET,
|
||||
'permission' => [
|
||||
'module' => BackendController::NAME,
|
||||
'type' => PermissionType::READ,
|
||||
'state' => PermissionCategory::COST_CENTER,
|
||||
],
|
||||
],
|
||||
],
|
||||
'^.*/accounting/costobject/profile.*$' => [
|
||||
[
|
||||
'dest' => '\Modules\Accounting\Controller\BackendController:viewCostObjectProfile',
|
||||
'verb' => RouteVerb::GET,
|
||||
'permission' => [
|
||||
'module' => BackendController::NAME,
|
||||
'type' => PermissionType::READ,
|
||||
'state' => PermissionCategory::COST_OBJECT,
|
||||
],
|
||||
],
|
||||
],
|
||||
|
||||
'^.*/accounting/supplier/list.*$' => [
|
||||
[
|
||||
'dest' => '\Modules\Accounting\Controller\BackendController:viewSupplierList',
|
||||
'verb' => RouteVerb::GET,
|
||||
'permission' => [
|
||||
'module' => BackendController::NAME,
|
||||
'type' => PermissionType::READ,
|
||||
'state' => PermissionCategory::SUPPLIER,
|
||||
],
|
||||
],
|
||||
],
|
||||
'^.*/accounting/client/list.*$' => [
|
||||
[
|
||||
'dest' => '\Modules\Accounting\Controller\BackendController:viewClientList',
|
||||
'verb' => RouteVerb::GET,
|
||||
'permission' => [
|
||||
'module' => BackendController::NAME,
|
||||
'type' => PermissionType::READ,
|
||||
'state' => PermissionCategory::CLIENT,
|
||||
],
|
||||
],
|
||||
],
|
||||
'^.*/accounting/supplier/profile.*$' => [
|
||||
[
|
||||
'dest' => '\Modules\Accounting\Controller\BackendController:viewSupplierProfile',
|
||||
'verb' => RouteVerb::GET,
|
||||
'permission' => [
|
||||
'module' => BackendController::NAME,
|
||||
'type' => PermissionType::READ,
|
||||
'state' => PermissionCategory::SUPPLIER,
|
||||
],
|
||||
],
|
||||
],
|
||||
'^.*/accounting/client/profile.*$' => [
|
||||
[
|
||||
'dest' => '\Modules\Accounting\Controller\BackendController:viewClientProfile',
|
||||
'verb' => RouteVerb::GET,
|
||||
'permission' => [
|
||||
'module' => BackendController::NAME,
|
||||
'type' => PermissionType::READ,
|
||||
'state' => PermissionCategory::CLIENT,
|
||||
],
|
||||
],
|
||||
],
|
||||
'^.*/accounting/supplier/entries.*$' => [
|
||||
[
|
||||
'dest' => '\Modules\Accounting\Controller\BackendController:viewSupplierProfile',
|
||||
'verb' => RouteVerb::GET,
|
||||
'permission' => [
|
||||
'module' => BackendController::NAME,
|
||||
'type' => PermissionType::READ,
|
||||
'state' => PermissionCategory::SUPPLIER,
|
||||
],
|
||||
],
|
||||
],
|
||||
'^.*/accounting/client/entries.*$' => [
|
||||
[
|
||||
'dest' => '\Modules\Accounting\Controller\BackendController:viewClientProfile',
|
||||
'verb' => RouteVerb::GET,
|
||||
'permission' => [
|
||||
'module' => BackendController::NAME,
|
||||
'type' => PermissionType::READ,
|
||||
'state' => PermissionCategory::CLIENT,
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
|
|
|
|||
|
|
@ -17,6 +17,10 @@ namespace Modules\Accounting\Controller;
|
|||
use Modules\Accounting\Models\AccountAbstract;
|
||||
use Modules\Accounting\Models\AccountAbstractMapper;
|
||||
use Modules\Accounting\Models\AccountL11nMapper;
|
||||
use Modules\Accounting\Models\CostCenter;
|
||||
use Modules\Accounting\Models\CostCenterMapper;
|
||||
use Modules\Accounting\Models\CostObject;
|
||||
use Modules\Accounting\Models\CostObjectMapper;
|
||||
use phpOMS\Localization\BaseStringL11n;
|
||||
use phpOMS\Localization\ISO639x1Enum;
|
||||
use phpOMS\Message\Http\RequestStatusCode;
|
||||
|
|
@ -36,6 +40,11 @@ use phpOMS\Model\Message\FormValidation;
|
|||
*/
|
||||
final class ApiController extends Controller
|
||||
{
|
||||
public function hookPersonalAccountCreate(...$data)
|
||||
{
|
||||
\var_dump($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Api method to create an account
|
||||
*
|
||||
|
|
@ -124,9 +133,9 @@ final class ApiController extends Controller
|
|||
return;
|
||||
}
|
||||
|
||||
$contractTypeL11n = $this->createAccountL11nFromRequest($request);
|
||||
$this->createModel($request->header->account, $contractTypeL11n, AccountL11nMapper::class, 'contract_type_l11n', $request->getOrigin());
|
||||
$this->createStandardCreateResponse($request, $response, $contractTypeL11n);
|
||||
$accountL11n = $this->createAccountL11nFromRequest($request);
|
||||
$this->createModel($request->header->account, $accountL11n, AccountL11nMapper::class, 'account_l11n', $request->getOrigin());
|
||||
$this->createStandardCreateResponse($request, $response, $accountL11n);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -140,14 +149,14 @@ final class ApiController extends Controller
|
|||
*/
|
||||
private function createAccountL11nFromRequest(RequestAbstract $request) : BaseStringL11n
|
||||
{
|
||||
$contractTypeL11n = new BaseStringL11n();
|
||||
$contractTypeL11n->ref = $request->getDataInt('ref') ?? 0;
|
||||
$contractTypeL11n->setLanguage(
|
||||
$accountL11n = new BaseStringL11n();
|
||||
$accountL11n->ref = $request->getDataInt('ref') ?? 0;
|
||||
$accountL11n->setLanguage(
|
||||
$request->getDataString('language') ?? $request->header->l11n->language
|
||||
);
|
||||
$contractTypeL11n->content = $request->getDataString('content') ?? '';
|
||||
$accountL11n->content = $request->getDataString('content') ?? '';
|
||||
|
||||
return $contractTypeL11n;
|
||||
return $accountL11n;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -235,6 +244,10 @@ final class ApiController extends Controller
|
|||
|
||||
return;
|
||||
}
|
||||
|
||||
$costcenter = $this->createCostCenterFromRequest($request);
|
||||
$this->createModel($request->header->account, $costcenter, CostCenterMapper::class, 'costcenter', $request->getOrigin());
|
||||
$this->createStandardCreateResponse($request, $response, $costcenter);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -249,7 +262,7 @@ final class ApiController extends Controller
|
|||
private function validateCostCenterCreate(RequestAbstract $request) : array
|
||||
{
|
||||
$val = [];
|
||||
if (($val['name'] = !$request->hasData('name'))
|
||||
if (($val['code'] = !$request->hasData('code'))
|
||||
) {
|
||||
return $val;
|
||||
}
|
||||
|
|
@ -257,6 +270,25 @@ final class ApiController extends Controller
|
|||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to create costcenter from request.
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
*
|
||||
* @return CostCenter
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private function createCostCenterFromRequest(RequestAbstract $request) : CostCenter
|
||||
{
|
||||
$costcenter = new CostCenter();
|
||||
$costcenter->code = $request->getDataString('code') ?? '';
|
||||
$costcenter->setL11n($request->getDataString('content') ?? '', $request->getDataString('language') ?? ISO639x1Enum::_EN);
|
||||
$costcenter->unit = $request->getDataInt('unit') ?? 1;
|
||||
|
||||
return $costcenter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Api method to update an cost center
|
||||
*
|
||||
|
|
@ -321,6 +353,29 @@ final class ApiController extends Controller
|
|||
|
||||
return;
|
||||
}
|
||||
|
||||
$costobject = $this->createCostObjectFromRequest($request);
|
||||
$this->createModel($request->header->account, $costobject, CostObjectMapper::class, 'costobject', $request->getOrigin());
|
||||
$this->createStandardCreateResponse($request, $response, $costobject);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to create costobject from request.
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
*
|
||||
* @return CostObject
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private function createCostObjectFromRequest(RequestAbstract $request) : CostObject
|
||||
{
|
||||
$costobject = new CostObject();
|
||||
$costobject->code = $request->getDataString('code') ?? '';
|
||||
$costobject->setL11n($request->getDataString('content') ?? '', $request->getDataString('language') ?? ISO639x1Enum::_EN);
|
||||
$costobject->unit = $request->getDataInt('unit') ?? 1;
|
||||
|
||||
return $costobject;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -335,7 +390,7 @@ final class ApiController extends Controller
|
|||
private function validateCostObjectCreate(RequestAbstract $request) : array
|
||||
{
|
||||
$val = [];
|
||||
if (($val['name'] = !$request->hasData('name'))
|
||||
if (($val['code'] = !$request->hasData('code'))
|
||||
) {
|
||||
return $val;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,8 @@ namespace Modules\Accounting\Controller;
|
|||
use Modules\Accounting\Models\AccountAbstractMapper;
|
||||
use Modules\Accounting\Models\CostCenterMapper;
|
||||
use Modules\Accounting\Models\CostObjectMapper;
|
||||
use Modules\ClientManagement\Models\ClientMapper;
|
||||
use Modules\SupplierManagement\Models\SupplierMapper;
|
||||
use phpOMS\Contract\RenderableInterface;
|
||||
use phpOMS\Message\RequestAbstract;
|
||||
use phpOMS\Message\ResponseAbstract;
|
||||
|
|
@ -34,7 +36,7 @@ use phpOMS\Views\View;
|
|||
final class BackendController extends Controller
|
||||
{
|
||||
/**
|
||||
* Routing end-point for application behaviour.
|
||||
* Routing end-point for application behavior.
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
|
|
@ -55,7 +57,7 @@ final class BackendController extends Controller
|
|||
}
|
||||
|
||||
/**
|
||||
* Routing end-point for application behaviour.
|
||||
* Routing end-point for application behavior.
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
|
|
@ -76,7 +78,7 @@ final class BackendController extends Controller
|
|||
}
|
||||
|
||||
/**
|
||||
* Routing end-point for application behaviour.
|
||||
* Routing end-point for application behavior.
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
|
|
@ -97,7 +99,7 @@ final class BackendController extends Controller
|
|||
}
|
||||
|
||||
/**
|
||||
* Routing end-point for application behaviour.
|
||||
* Routing end-point for application behavior.
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
|
|
@ -118,7 +120,7 @@ final class BackendController extends Controller
|
|||
}
|
||||
|
||||
/**
|
||||
* Routing end-point for application behaviour.
|
||||
* Routing end-point for application behavior.
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
|
|
@ -139,7 +141,7 @@ final class BackendController extends Controller
|
|||
}
|
||||
|
||||
/**
|
||||
* Routing end-point for application behaviour.
|
||||
* Routing end-point for application behavior.
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
|
|
@ -160,7 +162,7 @@ final class BackendController extends Controller
|
|||
}
|
||||
|
||||
/**
|
||||
* Routing end-point for application behaviour.
|
||||
* Routing end-point for application behavior.
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
|
|
@ -181,7 +183,7 @@ final class BackendController extends Controller
|
|||
}
|
||||
|
||||
/**
|
||||
* Routing end-point for application behaviour.
|
||||
* Routing end-point for application behavior.
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
|
|
@ -207,7 +209,7 @@ final class BackendController extends Controller
|
|||
}
|
||||
|
||||
/**
|
||||
* Routing end-point for application behaviour.
|
||||
* Routing end-point for application behavior.
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
|
|
@ -228,7 +230,7 @@ final class BackendController extends Controller
|
|||
}
|
||||
|
||||
/**
|
||||
* Routing end-point for application behaviour.
|
||||
* Routing end-point for application behavior.
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
|
|
@ -249,7 +251,7 @@ final class BackendController extends Controller
|
|||
}
|
||||
|
||||
/**
|
||||
* Routing end-point for application behaviour.
|
||||
* Routing end-point for application behavior.
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
|
|
@ -270,7 +272,7 @@ final class BackendController extends Controller
|
|||
}
|
||||
|
||||
/**
|
||||
* Routing end-point for application behaviour.
|
||||
* Routing end-point for application behavior.
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
|
|
@ -291,7 +293,7 @@ final class BackendController extends Controller
|
|||
}
|
||||
|
||||
/**
|
||||
* Routing end-point for application behaviour.
|
||||
* Routing end-point for application behavior.
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
|
|
@ -312,7 +314,7 @@ final class BackendController extends Controller
|
|||
}
|
||||
|
||||
/**
|
||||
* Routing end-point for application behaviour.
|
||||
* Routing end-point for application behavior.
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
|
|
@ -329,19 +331,27 @@ final class BackendController extends Controller
|
|||
$view->setTemplate('/Modules/Accounting/Theme/Backend/costcenter-list');
|
||||
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1002602001, $request, $response);
|
||||
|
||||
$mapper = CostCenterMapper::getAll()
|
||||
->with('l11n')
|
||||
->where('l11n/language', $response->header->l11n->language)
|
||||
->limit(25);
|
||||
|
||||
if ($request->getData('ptype') === 'p') {
|
||||
$view->data['costcenter'] = CostCenterMapper::getAll()->where('id', $request->getDataInt('id') ?? 0, '<')->limit(25)->execute();
|
||||
$view->data['costcenter'] = $mapper->where('id', $request->getDataInt('id') ?? 0, '<')
|
||||
->execute();
|
||||
} elseif ($request->getData('ptype') === 'n') {
|
||||
$view->data['costcenter'] = CostCenterMapper::getAll()->where('id', $request->getDataInt('id') ?? 0, '>')->limit(25)->execute();
|
||||
$view->data['costcenter'] = $mapper->where('id', $request->getDataInt('id') ?? 0, '>')
|
||||
->execute();
|
||||
} else {
|
||||
$view->data['costcenter'] = CostCenterMapper::getAll()->where('id', 0, '>')->limit(25)->execute();
|
||||
$view->data['costcenter'] = $mapper->where('id', 0, '>')
|
||||
->execute();
|
||||
}
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
/**
|
||||
* Routing end-point for application behaviour.
|
||||
* Routing end-point for application behavior.
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
|
|
@ -358,14 +368,74 @@ final class BackendController extends Controller
|
|||
$view->setTemplate('/Modules/Accounting/Theme/Backend/costobject-list');
|
||||
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1002603001, $request, $response);
|
||||
|
||||
$mapper = CostObjectMapper::getAll()
|
||||
->with('l11n')
|
||||
->where('l11n/language', $response->header->l11n->language)
|
||||
->limit(25);
|
||||
|
||||
if ($request->getData('ptype') === 'p') {
|
||||
$view->data['costobject'] = CostObjectMapper::getAll()->where('id', $request->getDataInt('id') ?? 0, '<')->limit(25)->execute();
|
||||
$view->data['costobject'] = $mapper->where('id', $request->getDataInt('id') ?? 0, '<')
|
||||
->execute();
|
||||
} elseif ($request->getData('ptype') === 'n') {
|
||||
$view->data['costobject'] = CostObjectMapper::getAll()->where('id', $request->getDataInt('id') ?? 0, '>')->limit(25)->execute();
|
||||
$view->data['costobject'] = $mapper->where('id', $request->getDataInt('id') ?? 0, '>')
|
||||
->execute();
|
||||
} else {
|
||||
$view->data['costobject'] = CostObjectMapper::getAll()->where('id', 0, '>')->limit(25)->execute();
|
||||
$view->data['costobject'] = $mapper->where('id', 0, '>')
|
||||
->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 viewSupplierList(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
|
||||
{
|
||||
$view = new View($this->app->l11nManager, $request, $response);
|
||||
$view->setTemplate('/Modules/Accounting/Theme/Backend/personal-list');
|
||||
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1002604001, $request, $response);
|
||||
|
||||
$accounts = SupplierMapper::getAll()
|
||||
->execute();
|
||||
|
||||
$view->data['accounts'] = $accounts;
|
||||
|
||||
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 viewClientList(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
|
||||
{
|
||||
$view = new View($this->app->l11nManager, $request, $response);
|
||||
$view->setTemplate('/Modules/Accounting/Theme/Backend/personal-list');
|
||||
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1002604001, $request, $response);
|
||||
|
||||
$accounts = ClientMapper::getAll()
|
||||
->execute();
|
||||
|
||||
$view->data['accounts'] = $accounts;
|
||||
|
||||
return $view;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
BIN
Docs/Dev/img/er.png
Normal file
BIN
Docs/Dev/img/er.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 23 KiB |
|
|
@ -150,4 +150,22 @@ class AccountAbstract
|
|||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function toArray() : array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function jsonSerialize() : mixed
|
||||
{
|
||||
return $this->toArray();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,90 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Accounting\Models
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\Accounting\Models;
|
||||
|
||||
/**
|
||||
* Balance class.
|
||||
*
|
||||
* @package Modules\Accounting\Models
|
||||
* @license OMS License 2.0
|
||||
* @link https://jingga.app
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Balance
|
||||
{
|
||||
/**
|
||||
* ID.
|
||||
*
|
||||
* @var int
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public int $id = 0;
|
||||
|
||||
/**
|
||||
* Balance data.
|
||||
*
|
||||
* @var array
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public array $balance = [];
|
||||
|
||||
/**
|
||||
* Localization.
|
||||
*
|
||||
* @var BalanceL11n
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public BalanceL11n $l11n;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->l11n = new BalanceL11n();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get balance id
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getId() : int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function toArray() : array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function jsonSerialize() : mixed
|
||||
{
|
||||
return $this->toArray();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,116 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Accounting\Models
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\Accounting\Models;
|
||||
|
||||
use phpOMS\Localization\ISO639x1Enum;
|
||||
|
||||
/**
|
||||
* Balance class.
|
||||
*
|
||||
* @package Modules\Accounting\Models
|
||||
* @license OMS License 2.0
|
||||
* @link https://jingga.app
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class BalanceL11n implements \JsonSerializable
|
||||
{
|
||||
/**
|
||||
* Article ID.
|
||||
*
|
||||
* @var int
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public int $id = 0;
|
||||
|
||||
/**
|
||||
* Balance ID.
|
||||
*
|
||||
* @var int
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public int $balance = 0;
|
||||
|
||||
/**
|
||||
* Language.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public string $language = ISO639x1Enum::_EN;
|
||||
|
||||
/**
|
||||
* Name.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public string $name = '';
|
||||
|
||||
/**
|
||||
* Description.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public string $description = '';
|
||||
|
||||
/**
|
||||
* Get language
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getLanguage() : string
|
||||
{
|
||||
return $this->language;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set language
|
||||
*
|
||||
* @param string $language Language
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setLanguage(string $language) : void
|
||||
{
|
||||
$this->language = $language;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function toArray() : array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'name' => $this->name,
|
||||
'description' => $this->description,
|
||||
'balance' => $this->balance,
|
||||
'language' => $this->language,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function jsonSerialize() : mixed
|
||||
{
|
||||
return $this->toArray();
|
||||
}
|
||||
}
|
||||
|
|
@ -14,6 +14,9 @@ declare(strict_types=1);
|
|||
|
||||
namespace Modules\Accounting\Models;
|
||||
|
||||
use phpOMS\Localization\BaseStringL11n;
|
||||
use phpOMS\Localization\ISO639x1Enum;
|
||||
|
||||
/**
|
||||
* Cost center class.
|
||||
*
|
||||
|
|
@ -40,13 +43,13 @@ class CostCenter
|
|||
*/
|
||||
public string $code = '';
|
||||
|
||||
/**
|
||||
* Localization.
|
||||
/*
|
||||
* String l11n
|
||||
*
|
||||
* @var CostCenterL11n
|
||||
* @var string | BaseStringL11n
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public CostCenterL11n $l11n;
|
||||
public string | BaseStringL11n $l11n = '';
|
||||
|
||||
/**
|
||||
* Parent.
|
||||
|
|
@ -56,15 +59,7 @@ class CostCenter
|
|||
*/
|
||||
public $parent = null;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->l11n = new CostCenterL11n();
|
||||
}
|
||||
public int $unit = 0;
|
||||
|
||||
/**
|
||||
* Get balance id
|
||||
|
|
@ -78,6 +73,44 @@ class CostCenter
|
|||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set l11n
|
||||
*
|
||||
* @param string|BaseStringL11n $l11n Tag article l11n
|
||||
* @param string $lang Language
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setL11n(string | BaseStringL11n $l11n, string $lang = ISO639x1Enum::_EN) : void
|
||||
{
|
||||
if ($l11n instanceof BaseStringL11n) {
|
||||
$this->l11n = $l11n;
|
||||
} elseif (isset($this->l11n) && $this->l11n instanceof BaseStringL11n) {
|
||||
$this->l11n->content = $l11n;
|
||||
$this->l11n->setLanguage($lang);
|
||||
} else {
|
||||
$this->l11n = new BaseStringL11n();
|
||||
$this->l11n->content = $l11n;
|
||||
$this->l11n->setLanguage($lang);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getL11n() : string
|
||||
{
|
||||
if (!isset($this->l11n)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return $this->l11n instanceof BaseStringL11n ? $this->l11n->content : $this->l11n;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,116 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Accounting\Models
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\Accounting\Models;
|
||||
|
||||
use phpOMS\Localization\ISO639x1Enum;
|
||||
|
||||
/**
|
||||
* CostCenter class.
|
||||
*
|
||||
* @package Modules\Accounting\Models
|
||||
* @license OMS License 2.0
|
||||
* @link https://jingga.app
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class CostCenterL11n implements \JsonSerializable
|
||||
{
|
||||
/**
|
||||
* Article ID.
|
||||
*
|
||||
* @var int
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public int $id = 0;
|
||||
|
||||
/**
|
||||
* CostCenter ID.
|
||||
*
|
||||
* @var int
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public int $costcenter = 0;
|
||||
|
||||
/**
|
||||
* Language.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public string $language = ISO639x1Enum::_EN;
|
||||
|
||||
/**
|
||||
* Name.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public string $name = '';
|
||||
|
||||
/**
|
||||
* Description.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public string $description = '';
|
||||
|
||||
/**
|
||||
* Get language
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getLanguage() : string
|
||||
{
|
||||
return $this->language;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set language
|
||||
*
|
||||
* @param string $language Language
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setLanguage(string $language) : void
|
||||
{
|
||||
$this->language = $language;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function toArray() : array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'name' => $this->name,
|
||||
'description' => $this->description,
|
||||
'costcenter' => $this->costcenter,
|
||||
'language' => $this->language,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function jsonSerialize() : mixed
|
||||
{
|
||||
return $this->toArray();
|
||||
}
|
||||
}
|
||||
|
|
@ -38,9 +38,8 @@ final class CostCenterL11nMapper extends DataMapperFactory
|
|||
*/
|
||||
public const COLUMNS = [
|
||||
'accounting_costcenter_l11n_id' => ['name' => 'accounting_costcenter_l11n_id', 'type' => 'int', 'internal' => 'id'],
|
||||
'accounting_costcenter_l11n_name' => ['name' => 'accounting_costcenter_l11n_name', 'type' => 'string', 'internal' => 'name', 'autocomplete' => true],
|
||||
'accounting_costcenter_l11n_description' => ['name' => 'accounting_costcenter_l11n_description', 'type' => 'string', 'internal' => 'description', 'autocomplete' => true],
|
||||
'accounting_costcenter_l11n_costcenter' => ['name' => 'accounting_costcenter_l11n_costcenter', 'type' => 'int', 'internal' => 'costcenter'],
|
||||
'accounting_costcenter_l11n_name' => ['name' => 'accounting_costcenter_l11n_name', 'type' => 'string', 'internal' => 'content', 'autocomplete' => true],
|
||||
'accounting_costcenter_l11n_costcenter' => ['name' => 'accounting_costcenter_l11n_costcenter', 'type' => 'int', 'internal' => 'ref'],
|
||||
'accounting_costcenter_l11n_language' => ['name' => 'accounting_costcenter_l11n_language', 'type' => 'string', 'internal' => 'language'],
|
||||
];
|
||||
|
||||
|
|
@ -59,4 +58,12 @@ final class CostCenterL11nMapper extends DataMapperFactory
|
|||
* @since 1.0.0
|
||||
*/
|
||||
public const PRIMARYFIELD = 'accounting_costcenter_l11n_id';
|
||||
|
||||
/**
|
||||
* Model to use by the mapper.
|
||||
*
|
||||
* @var class-string<T>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const MODEL = BaseStringL11n::class;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ final class CostCenterMapper extends DataMapperFactory
|
|||
public const COLUMNS = [
|
||||
'accounting_costcenter_id' => ['name' => 'accounting_costcenter_id', 'type' => 'int', 'internal' => 'id'],
|
||||
'accounting_costcenter_code' => ['name' => 'accounting_costcenter_code', 'type' => 'string', 'internal' => 'code'],
|
||||
'accounting_costcenter_unit' => ['name' => 'accounting_costcenter_unit', 'type' => 'int', 'internal' => 'unit'],
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
@ -51,7 +52,7 @@ final class CostCenterMapper extends DataMapperFactory
|
|||
'mapper' => CostCenterL11nMapper::class,
|
||||
'table' => 'accounting_costcenter_l11n',
|
||||
'self' => 'accounting_costcenter_l11n_costcenter',
|
||||
'conditional' => true,
|
||||
'column' => 'content',
|
||||
'external' => null,
|
||||
],
|
||||
];
|
||||
|
|
|
|||
|
|
@ -14,6 +14,9 @@ declare(strict_types=1);
|
|||
|
||||
namespace Modules\Accounting\Models;
|
||||
|
||||
use phpOMS\Localization\BaseStringL11n;
|
||||
use phpOMS\Localization\ISO639x1Enum;
|
||||
|
||||
/**
|
||||
* Cost object class.
|
||||
*
|
||||
|
|
@ -40,13 +43,13 @@ class CostObject
|
|||
*/
|
||||
public string $code = '';
|
||||
|
||||
/**
|
||||
* Localization.
|
||||
/*
|
||||
* String l11n
|
||||
*
|
||||
* @var CostObjectL11n
|
||||
* @var string | BaseStringL11n
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public CostObjectL11n $l11n;
|
||||
public string | BaseStringL11n $l11n = '';
|
||||
|
||||
/**
|
||||
* Parent.
|
||||
|
|
@ -56,15 +59,7 @@ class CostObject
|
|||
*/
|
||||
public $parent = null;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->l11n = new CostObjectL11n();
|
||||
}
|
||||
public int $unit = 0;
|
||||
|
||||
/**
|
||||
* Get balance id
|
||||
|
|
@ -78,6 +73,44 @@ class CostObject
|
|||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set l11n
|
||||
*
|
||||
* @param string|BaseStringL11n $l11n Tag article l11n
|
||||
* @param string $lang Language
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setL11n(string | BaseStringL11n $l11n, string $lang = ISO639x1Enum::_EN) : void
|
||||
{
|
||||
if ($l11n instanceof BaseStringL11n) {
|
||||
$this->l11n = $l11n;
|
||||
} elseif (isset($this->l11n) && $this->l11n instanceof BaseStringL11n) {
|
||||
$this->l11n->content = $l11n;
|
||||
$this->l11n->setLanguage($lang);
|
||||
} else {
|
||||
$this->l11n = new BaseStringL11n();
|
||||
$this->l11n->content = $l11n;
|
||||
$this->l11n->setLanguage($lang);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getL11n() : string
|
||||
{
|
||||
if (!isset($this->l11n)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return $this->l11n instanceof BaseStringL11n ? $this->l11n->content : $this->l11n;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,116 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Accounting\Models
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\Accounting\Models;
|
||||
|
||||
use phpOMS\Localization\ISO639x1Enum;
|
||||
|
||||
/**
|
||||
* CostObject class.
|
||||
*
|
||||
* @package Modules\Accounting\Models
|
||||
* @license OMS License 2.0
|
||||
* @link https://jingga.app
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class CostObjectL11n implements \JsonSerializable
|
||||
{
|
||||
/**
|
||||
* Article ID.
|
||||
*
|
||||
* @var int
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public int $id = 0;
|
||||
|
||||
/**
|
||||
* CostObject ID.
|
||||
*
|
||||
* @var int
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public int $costobject = 0;
|
||||
|
||||
/**
|
||||
* Language.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public string $language = ISO639x1Enum::_EN;
|
||||
|
||||
/**
|
||||
* Name.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public string $name = '';
|
||||
|
||||
/**
|
||||
* Description.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public string $description = '';
|
||||
|
||||
/**
|
||||
* Get language
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getLanguage() : string
|
||||
{
|
||||
return $this->language;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set language
|
||||
*
|
||||
* @param string $language Language
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setLanguage(string $language) : void
|
||||
{
|
||||
$this->language = $language;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function toArray() : array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'name' => $this->name,
|
||||
'description' => $this->description,
|
||||
'costobject' => $this->costobject,
|
||||
'language' => $this->language,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function jsonSerialize() : mixed
|
||||
{
|
||||
return $this->toArray();
|
||||
}
|
||||
}
|
||||
|
|
@ -38,9 +38,8 @@ final class CostObjectL11nMapper extends DataMapperFactory
|
|||
*/
|
||||
public const COLUMNS = [
|
||||
'accounting_costobject_l11n_id' => ['name' => 'accounting_costobject_l11n_id', 'type' => 'int', 'internal' => 'id'],
|
||||
'accounting_costobject_l11n_name' => ['name' => 'accounting_costobject_l11n_name', 'type' => 'string', 'internal' => 'name', 'autocomplete' => true],
|
||||
'accounting_costobject_l11n_description' => ['name' => 'accounting_costobject_l11n_description', 'type' => 'string', 'internal' => 'description', 'autocomplete' => true],
|
||||
'accounting_costobject_l11n_costobject' => ['name' => 'accounting_costobject_l11n_costobject', 'type' => 'int', 'internal' => 'costobject'],
|
||||
'accounting_costobject_l11n_name' => ['name' => 'accounting_costobject_l11n_name', 'type' => 'string', 'internal' => 'content', 'autocomplete' => true],
|
||||
'accounting_costobject_l11n_costobject' => ['name' => 'accounting_costobject_l11n_costobject', 'type' => 'int', 'internal' => 'ref'],
|
||||
'accounting_costobject_l11n_language' => ['name' => 'accounting_costobject_l11n_language', 'type' => 'string', 'internal' => 'language'],
|
||||
];
|
||||
|
||||
|
|
@ -59,4 +58,12 @@ final class CostObjectL11nMapper extends DataMapperFactory
|
|||
* @since 1.0.0
|
||||
*/
|
||||
public const PRIMARYFIELD = 'accounting_costobject_l11n_id';
|
||||
|
||||
/**
|
||||
* Model to use by the mapper.
|
||||
*
|
||||
* @var class-string<T>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const MODEL = BaseStringL11n::class;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ final class CostObjectMapper extends DataMapperFactory
|
|||
public const COLUMNS = [
|
||||
'accounting_costobject_id' => ['name' => 'accounting_costobject_id', 'type' => 'int', 'internal' => 'id'],
|
||||
'accounting_costobject_code' => ['name' => 'accounting_costobject_code', 'type' => 'string', 'internal' => 'code'],
|
||||
'accounting_costobject_unit' => ['name' => 'accounting_costobject_unit', 'type' => 'int', 'internal' => 'unit'],
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
@ -51,7 +52,7 @@ final class CostObjectMapper extends DataMapperFactory
|
|||
'mapper' => CostObjectL11nMapper::class,
|
||||
'table' => 'accounting_costobject_l11n',
|
||||
'self' => 'accounting_costobject_l11n_costobject',
|
||||
'conditional' => true,
|
||||
'column' => 'content',
|
||||
'external' => null,
|
||||
],
|
||||
];
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ namespace Modules\Accounting\Models;
|
|||
use phpOMS\Stdlib\Base\Enum;
|
||||
|
||||
/**
|
||||
* Permision state enum.
|
||||
* Permission category enum.
|
||||
*
|
||||
* @package Modules\Accounting\Models
|
||||
* @license OMS License 2.0
|
||||
|
|
@ -43,4 +43,8 @@ abstract class PermissionCategory extends Enum
|
|||
public const ACCOUNT = 8;
|
||||
|
||||
public const ENTRY = 9;
|
||||
|
||||
public const SUPPLIER = 10;
|
||||
|
||||
public const CLIENT = 11;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ return ['Accounting' => [
|
|||
'Accounts' => 'Konten',
|
||||
'BatchPostings' => 'Chargenbuchungen',
|
||||
'Charts' => 'Charts',
|
||||
'COA' => 'Chart of Accounts (COA)',
|
||||
'Code' => 'Code',
|
||||
'ContraAccount' => 'Gegenkonto',
|
||||
'CostCenter' => 'Kostenstelle',
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ return ['Accounting' => [
|
|||
'Accounts' => 'Accounts',
|
||||
'BatchPostings' => 'Batch Postings',
|
||||
'Charts' => 'Charts',
|
||||
'COA' => 'Chart of Accounts (COA)',
|
||||
'Code' => 'Code',
|
||||
'ContraAccount' => 'Contra Account',
|
||||
'CostCenter' => 'Cost Center',
|
||||
|
|
|
|||
|
|
@ -12,6 +12,8 @@
|
|||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
use phpOMS\Uri\UriFactory;
|
||||
|
||||
/**
|
||||
* @var \phpOMS\Views\View $this
|
||||
*/
|
||||
|
|
@ -22,7 +24,7 @@ echo $this->data['nav']->render(); ?>
|
|||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="portlet">
|
||||
<div class="portlet-head"><?= $this->getHtml('Chart of Accounts (COA)'); ?><i class="g-icon download btn end-xs">download</i></div>
|
||||
<div class="portlet-head"><?= $this->getHtml('COA'); ?><i class="g-icon download btn end-xs">download</i></div>
|
||||
<div class="slider">
|
||||
<table class="default sticky">
|
||||
<thead>
|
||||
|
|
@ -32,8 +34,8 @@ echo $this->data['nav']->render(); ?>
|
|||
<tbody>
|
||||
<?php $c = 0;
|
||||
foreach ($accounts as $key => $value) : ++$c;
|
||||
$url = \phpOMS\Uri\UriFactory::build('{/base}/admin/group/settings?{?}&id=' . $value->id); ?>
|
||||
<tr>
|
||||
$url = UriFactory::build('{/base}/accounting/coa/profile?{?}&id=' . $value->id); ?>
|
||||
<tr data-href="<?= $url; ?>">
|
||||
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->account); ?></a>
|
||||
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->getL11n()); ?></a>
|
||||
<?php endforeach; ?>
|
||||
|
|
|
|||
|
|
@ -37,8 +37,10 @@ echo $this->data['nav']->render(); ?>
|
|||
<?php $count = 0; foreach ($costcenter as $key => $value) : ++$count;
|
||||
$url = UriFactory::build('{/base}/tag/single?{?}&id=' . $value->id); ?>
|
||||
<tr tabindex="0" data-href="<?= $url; ?>">
|
||||
<td data-label="<?= $this->getHtml('Code'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->code); ?></a>
|
||||
<td data-label="<?= $this->getHtml('Name'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->l11n->name); ?></a>
|
||||
<td data-label="<?= $this->getHtml('Code'); ?>"><a href="<?= $url; ?>">
|
||||
<?= $this->printHtml($value->code); ?></a>
|
||||
<td data-label="<?= $this->getHtml('Name'); ?>"><a href="<?= $url; ?>">
|
||||
<?= $this->printHtml($value->getL11n()); ?></a>
|
||||
<?php endforeach; ?>
|
||||
<?php if ($count === 0) : ?>
|
||||
<tr><td colspan="3" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
|
||||
|
|
|
|||
|
|
@ -37,8 +37,10 @@ echo $this->data['nav']->render(); ?>
|
|||
<?php $count = 0; foreach ($costobject as $key => $value) : ++$count;
|
||||
$url = UriFactory::build('{/base}/tag/single?{?}&id=' . $value->id); ?>
|
||||
<tr tabindex="0" data-href="<?= $url; ?>">
|
||||
<td data-label="<?= $this->getHtml('Code'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->code); ?></a>
|
||||
<td data-label="<?= $this->getHtml('Name'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->l11n->name); ?></a>
|
||||
<td data-label="<?= $this->getHtml('Code'); ?>"><a href="<?= $url; ?>">
|
||||
<?= $this->printHtml($value->code); ?></a>
|
||||
<td data-label="<?= $this->getHtml('Name'); ?>"><a href="<?= $url; ?>">
|
||||
<?= $this->printHtml($value->getL11n()); ?></a>
|
||||
<?php endforeach; ?>
|
||||
<?php if ($count === 0) : ?>
|
||||
<tr><td colspan="3" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
|
||||
|
|
|
|||
|
|
@ -24,41 +24,56 @@ $footerView->setResults(1);
|
|||
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<section class="box wf-100">
|
||||
<div class="inner">
|
||||
<section class="portlet">
|
||||
<div class="portlet-body">
|
||||
<form>
|
||||
<table class="layout wf-100">
|
||||
<tr>
|
||||
<td><label for="iAccountStart"><?= $this->getHtml('Account'); ?></label>
|
||||
<td><label for="iAccountStart"><?= $this->getHtml('CostCenter'); ?>
|
||||
<td><label for="iAccountStart"><?= $this->getHtml('CostObject'); ?>
|
||||
<td><label for="iAccountStart"><?= $this->getHtml('EntryDate'); ?>
|
||||
<td><label for="iAccount"><?= $this->getHtml('Account'); ?></label>
|
||||
<td><label for="iContra"><?= $this->getHtml('Account'); ?></label>
|
||||
<td><label for="iCostCenter"><?= $this->getHtml('CostCenter'); ?>
|
||||
<td><label for="iCostObject"><?= $this->getHtml('CostObject'); ?>
|
||||
<td><label for="iDate"><?= $this->getHtml('Date'); ?>
|
||||
<tr>
|
||||
<td><span class="input"><button type="button" id="account-start" formaction="" data-action='[{"type": "popup", "tpl": "entry-list-tpl", "aniIn": "fadeIn", "aniOut": "fadeOut", "stay": 1000}]'><i class="g-icon">book</i>
|
||||
</button><input type="number" id="iId" min="1" name="id" required></span>
|
||||
</button><input type="text" id="iAccount" min="1" name="id" required></span>
|
||||
<td><span class="input"><button type="button" id="contra-start" formaction="" data-action='[{"type": "popup", "tpl": "entry-list-tpl", "aniIn": "fadeIn", "aniOut": "fadeOut", "stay": 1000}]'><i class="g-icon">book</i>
|
||||
</button><input type="text" id="iContra" min="1" name="id" required></span>
|
||||
<td><span class="input"><button type="button" formaction=""><i class="g-icon">book</i>
|
||||
</button><input type="number" id="iId" min="1" name="id" required></span>
|
||||
</button><input type="text" id="iCostCenter" min="1" name="id" required></span>
|
||||
<td><span class="input"><button type="button" formaction=""><i class="g-icon">book</i>
|
||||
</button><input type="number" id="iId" min="1" name="id" required></span>
|
||||
<td><input type="datetime-local" id="iId" min="1" name="id" required>
|
||||
</button><input type="text" id="iCostObject" min="1" name="id" required></span>
|
||||
<td><input type="datetime-local" id="iDate" min="1" name="id" required>
|
||||
<tr>
|
||||
<td><label for="iAccountStart"><?= $this->getHtml('To'); ?></label>
|
||||
<td><label for="iAccountStart"><?= $this->getHtml('To'); ?>
|
||||
<td><label for="iAccountStart"><?= $this->getHtml('To'); ?>
|
||||
<td><label for="iAccountStart"><?= $this->getHtml('To'); ?>
|
||||
<td><label for="iAccountType"><?= $this->getHtml('Type'); ?></label>
|
||||
<td><label for="iContraType"><?= $this->getHtml('Type'); ?></label>
|
||||
<td>
|
||||
<td>
|
||||
<td><label for="iDateType"><?= $this->getHtml('Type'); ?></label>
|
||||
<tr>
|
||||
<td><span class="input"><button type="button" formaction=""><i class="g-icon">book</i>
|
||||
</button><input type="number" id="iId" min="1" name="id" required></span>
|
||||
<td><span class="input"><button type="button" formaction=""><i class="g-icon">book</i>
|
||||
</button><input type="number" id="iId" min="1" name="id" required></span>
|
||||
<td><span class="input"><button type="button" formaction=""><i class="g-icon">book</i>
|
||||
</button><input type="number" id="iId" min="1" name="id" required></span>
|
||||
<td><input type="datetime-local" id="iId" min="1" name="id" required>
|
||||
<tr>
|
||||
<td colspan="4"><input type="submit" value="<?= $this->getHtml('Search'); ?>" name="search">
|
||||
<td><select id="iAccountType" name="">
|
||||
<option selected>Debit/Credit
|
||||
<option>Debit
|
||||
<option>Credit
|
||||
</select>
|
||||
<td><select id="iContraType" name="">
|
||||
<option selected>Debit/Credit
|
||||
<option>Debit
|
||||
<option>Credit
|
||||
</select>
|
||||
<td>
|
||||
<td>
|
||||
<td><select id="iAccountType" name="">
|
||||
<option selected>Performance date
|
||||
<option>Invoice date
|
||||
<option>Posting date
|
||||
</select>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
<div class="portlet-foot">
|
||||
<input type="submit" value="<?= $this->getHtml('Search'); ?>" name="search">
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -66,18 +81,19 @@ $footerView->setResults(1);
|
|||
<div class="box w-100">
|
||||
<div class="tabview tab-2">
|
||||
<ul class="tab-links">
|
||||
<li><label for="c-tab2-1"><?= $this->getHtml('List'); ?></label></li>
|
||||
<li><label for="c-tab2-2"><?= $this->getHtml('Evaluation'); ?></label></li>
|
||||
<li><label for="c-tab2-3"><?= $this->getHtml('Charts'); ?></label></li>
|
||||
<li><label for="c-tab2-1"><?= $this->getHtml('List'); ?></label>
|
||||
<li><label for="c-tab2-2"><?= $this->getHtml('Evaluation'); ?></label>
|
||||
<li><label for="c-tab2-3"><?= $this->getHtml('Charts'); ?></label>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<input type="radio" id="c-tab2-1" name="tabular-2" checked>
|
||||
<div class="tab">
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<section class="wf-100">
|
||||
<table class="default">
|
||||
<caption><?= $this->getHtml('Entries'); ?><i class="g-icon end-xs download btn">download</i></caption>
|
||||
<div class="portlet">
|
||||
<div class="portlet-head"><?= $this->getHtml('Entries'); ?><i class="g-icon download btn end-xs">download</i></div>
|
||||
<div class="slider">
|
||||
<table class="default sticky">
|
||||
<thead>
|
||||
<tr>
|
||||
<td><?= $this->getHtml('EntryDate'); ?>
|
||||
|
|
@ -102,17 +118,19 @@ $footerView->setResults(1);
|
|||
<td colspan="13" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
|
||||
<?php endif; ?>
|
||||
</table>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<input type="radio" id="c-tab2-2" name="tabular-2">
|
||||
<div class="tab">
|
||||
<div class="row">
|
||||
<div class="row">
|
||||
<div class="col-xs-4">
|
||||
<section class="wf-100">
|
||||
<table class="default">
|
||||
<caption><?= $this->getHtml('Accounts'); ?><i class="g-icon end-xs download btn">download</i></caption>
|
||||
<div class="portlet">
|
||||
<div class="portlet-head"><?= $this->getHtml('Accounts'); ?><i class="g-icon download btn end-xs">download</i></div>
|
||||
<div class="slider">
|
||||
<table class="default sticky">
|
||||
<thead>
|
||||
<tr>
|
||||
<td><?= $this->getHtml('Account'); ?>
|
||||
|
|
@ -127,12 +145,14 @@ $footerView->setResults(1);
|
|||
<td colspan="13" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
|
||||
<?php endif; ?>
|
||||
</table>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-4">
|
||||
<section class="wf-100">
|
||||
<table class="table green">
|
||||
<caption><?= $this->getHtml('CostCenter'); ?><i class="g-icon end-xs download btn">download</i></caption>
|
||||
<div class="portlet">
|
||||
<div class="portlet-head"><?= $this->getHtml('CostCenter'); ?><i class="g-icon download btn end-xs">download</i></div>
|
||||
<div class="slider">
|
||||
<table class="default sticky">
|
||||
<thead>
|
||||
<tr>
|
||||
<td><?= $this->getHtml('CostCenter'); ?>
|
||||
|
|
@ -147,15 +167,17 @@ $footerView->setResults(1);
|
|||
<td colspan="13" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
|
||||
<?php endif; ?>
|
||||
</table>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-4">
|
||||
<section class="wf-100">
|
||||
<table class="table blue">
|
||||
<caption><?= $this->getHtml('CostObject'); ?><i class="g-icon end-xs download btn">download</i></caption>
|
||||
<div class="portlet">
|
||||
<div class="portlet-head"><?= $this->getHtml('CostObject'); ?><i class="g-icon download btn end-xs">download</i></div>
|
||||
<div class="slider">
|
||||
<table class="default sticky">
|
||||
<thead>
|
||||
<tr>
|
||||
<td><?= $this->getHtml('Account'); ?>
|
||||
<td><?= $this->getHtml('CostObject'); ?>
|
||||
<td class="wf-100"><?= $this->getHtml('Name'); ?>
|
||||
<td><?= $this->getHtml('Total'); ?>
|
||||
<tbody>
|
||||
|
|
@ -167,7 +189,8 @@ $footerView->setResults(1);
|
|||
<td colspan="13" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
|
||||
<?php endif; ?>
|
||||
</table>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -14,13 +14,14 @@
|
|||
"name": "Jingga",
|
||||
"website": "jingga.app"
|
||||
},
|
||||
"description": "Accounting module.",
|
||||
"directory": "Accounting",
|
||||
"dependencies": {
|
||||
"Admin": "1.0.0"
|
||||
},
|
||||
"providing": {
|
||||
"Navigation": "*"
|
||||
"Navigation": "*",
|
||||
"ClientManagement": "*",
|
||||
"SupplierManagement": "*"
|
||||
},
|
||||
"load": [
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user