diff --git a/Admin/Install/Coa/skr03.csv b/Admin/Install/Coa/SKR03_DE_GAAP.csv similarity index 100% rename from Admin/Install/Coa/skr03.csv rename to Admin/Install/Coa/SKR03_DE_GAAP.csv diff --git a/Admin/Install/Coa/skr03_pl_de_gaap_salescost.json b/Admin/Install/Coa/skr03_pl_de_gaap_salescost.json deleted file mode 100644 index e69de29..0000000 diff --git a/Admin/Install/Coa/skr03_pl_de_gaap_totalcost.json b/Admin/Install/Coa/skr03_pl_de_gaap_totalcost.json deleted file mode 100644 index e76f34f..0000000 --- a/Admin/Install/Coa/skr03_pl_de_gaap_totalcost.json +++ /dev/null @@ -1,370 +0,0 @@ -[ - { - "name": "1", - "l11n": { - "en": "Turnover", - "de": "Umsatzerlöse" - }, - "account": [2750,2751,2752,2753,2754,2764], - "type": "category", - "formula": "", - "style": "category", - "children": [] - }, - { - "name": "2", - "l11n": { - "en": "Increase or reduction of stocks of finished goods and work in progress", - "de": "Erhöhung oder Verminderung des Bestands an fertigen und unfertigen Erzeugnissen" - }, - "account": [], - "type": "category", - "formula": "", - "style": "category", - "children": [] - }, - { - "name": "3", - "l11n": { - "en": "Work performed by the undertaking for its own purposes and carried as an asset", - "de": "Andere aktivierte Eigenleistungen" - }, - "account": [], - "type": "category", - "formula": "", - "style": "category", - "children": [] - }, - { - "name": "4", - "l11n": { - "en": "Other operating earnings", - "de": "Sonstige betriebliche Erträge" - }, - "account": [2315,2316,2317,2318,2500,2501,2504,2508,2510,2520,2590,2594,2660,2661,2666,2700,2705,2707,2709,2710,2711,2712,2713,2714,2715,2716,2720,2723,2725,2726,2727,2728,2729,2730,2731,2732,2735,2736,2737,2740,2741,2742,2743,2744,2746,2747,2749,2760,2762,2790,2745,2746,2747,2749], - "type": "category", - "formula": "", - "style": "category", - "children": [] - }, - { - "name": "5", - "l11n": { - "en": "Expenditures on materials", - "de": "Materialaufwand" - }, - "account": [], - "type": "category", - "formula": "", - "style": "category", - "children": [ - { - "name": "5a", - "l11n": { - "en": "Expenditures for raw materials, auxiliary supplies and consumables and for purchased goods", - "de": "Aufwendungen für Roh-, Hilfs- und Betriebsstoffe und für bezogene Waren" - }, - "account": [3000,3010,3011,3012,3013,3014,3015,3016,3017,3018,3019,3020,3021,3022,3023,3024,3025,3026,3027,3028,3029,3030,3031,3032,3033,3034,3035,3036,3037,3038,3039,3040,3041,3042,3043,3044,3045,3046,3047,3048,3049,3050,3051,3052,3053,3054,3055,3056,3057,3058,3059,3060,3061,3062,3063,3064,3065,3066,3067,3068,3069,3070,3071,3072,3073,3074,3075,3076,3077,3078,3079,3080,3081,3082,3083,3084,3085,3086,3087,3088,3089,3090,3091,3092,3093,3094,3095,3096,3097,3098,3200,3300,3301,3302,3303,3304,3305,3306,3307,3308,3309,3310,3311,3312,3313,3314,3315,3316,3317,3318,3319,3320,3321,3322,3323,3324,3325,3326,3327,3328,3329,3330,3331,3332,3333,3334,3335,3336,3337,3338,3339,3340,3341,3342,3343,3344,3345,3346,3347,3348,3349,3400,3401,3402,3403,3404,3405,3406,3407,3408,3409,3410,3411,3412,3413,3414,3415,3416,3417,3418,3419,3420,3421,3422,3423,3424,3425,3426,3427,3428,3429,3430,3431,3432,3433,3434,3435], - "type": "category", - "formula": "", - "style": "category", - "children": [] - }, - { - "name": "5b", - "l11n": { - "en": "Expenditures for purchased services", - "de": "Aufwendungen für bezogene Leistungen" - }, - "account": [3100,3106,3107,3108,3109,3110,3111,3112,3113,3114,3115,3116,3117,3118,3119,3120,3121,3122,3123,3124,3125,3126,3127,3128,3129,3130,3131,3132,3133,3134,3135,3136,3137,3138,3139,3140,3141,3142,3143,3144,3145,3146,3147,3148,3149,3150,3151,3152,3153,3154,3155,3156,3157,3158,3159,3160,3165,3170,3175,3180,3185], - "type": "category", - "formula": "", - "style": "category", - "children": [] - } - ] - }, - { - "name": "GP", - "l11n": { - "en": "Gross profit", - "de": "Rohertrag" - }, - "account": [], - "type": "formula", - "formula": "1+2+3+4+5", - "style": "subtotal", - "children": [] - }, - { - "name": "GPratio", - "l11n": { - "en": "Gross profit ratio", - "de": "Rohertragsmarge" - }, - "account": [], - "type": "formula", - "formula": "GP/(1+2+3+4)", - "style": "ratio", - "children": [] - }, - { - "name": "6", - "l11n": { - "en": "Staff costs", - "de": "Personalaufwand" - }, - "account": [], - "type": "category", - "formula": "", - "style": "category", - "children": [ - { - "name": "6a", - "l11n": { - "en": "Wages and salaries", - "de": "Löhne und Gehälter" - }, - "account": [], - "type": "category", - "formula": "", - "style": "category", - "children": [] - }, - { - "name": "6b", - "l11n": { - "en": "Social security contributions and expenditures for old-age pension schemes and for support", - "de": "soziale Abgaben und Aufwendungen für Altersversorgung und für Unterstützung" - }, - "account": [], - "type": "category", - "formula": "", - "style": "category", - "children": [ - { - "name": "6bthereof", - "l11n": { - "en": "thereof relating to the old-age pension scheme", - "de": "davon für Altersversorgung" - }, - "account": [], - "type": "category", - "formula": "", - "style": "category", - "children": [] - } - ] - } - ] - }, - { - "name": "7", - "l11n": { - "en": "Amortisations / depreciations", - "de": "Abschreibungen" - }, - "account": [], - "type": "category", - "formula": "", - "style": "category", - "children": [ - { - "name": "7a", - "l11n": { - "en": "Intangible assets forming part of the fixed assets and of tangible fixed assets", - "de": "auf immaterielle Vermögensgegenstände des Anlagevermögens und Sachanlage" - }, - "account": [], - "type": "category", - "formula": "", - "style": "category", - "children": [] - }, - { - "name": "7b", - "l11n": { - "en": "Assets reported as part of the current assets, to the extent that they exceed the depreciations customarily stated for the share capital company", - "de": "auf Vermögensgegenstände des Umlaufvermögens, soweit diese die in der Kapitalgesellschaft üblichen Abschreibungen überschreiten" - }, - "account": [2430,2431,2432,2433,2434,2345,2436,2437,2438,2440,2441], - "type": "category", - "formula": "", - "style": "category", - "children": [] - } - ] - }, - { - "name": "8", - "l11n": { - "en": "Other operating expenses", - "de": "Sonstige betriebliche Aufwendungen" - }, - "account": [2150,2151,2166,2170,2171,2174,2175,2176,2300,2307,2308,2309,2310,2311,2312,2313,2320,2323,2325,2326,2327,2328,2339,2342,2343,2344,2345,2347,2350,2380,2381,2382,2383,2384,2385,2386,2387,2389,2390,2400,2401,2402,2403,2404,2405,2406,2407,2408,2409,2450,2451,2490,2890,2891,2892,2893,2894,2895,2900], - "type": "category", - "formula": "", - "style": "category", - "children": [] - }, - { - "name": "9", - "l11n": { - "en": "Income from participating interests", - "de": "Erträge aus Beteiligungen" - }, - "account": [2480,2491,2492,2493,2494,2495,2496,2497,2498,2499,2600,2603,2613,2614,2615,2616,2618,2619,2792,2794], - "type": "category", - "formula": "", - "style": "category", - "children": [ - { - "name": "9thereof", - "l11n": { - "en": "thereof derived from affiliated undertakings", - "de": "davon aus verbundenen Unternehmen" - }, - "account": [], - "type": "category", - "formula": "", - "style": "category", - "children": [] - } - ] - }, - { - "name": "10", - "l11n": { - "en": "Income from other investments and loans forming part of the financial assets", - "de": "Erträge aus anderen Wertpapieren und Ausleihungen des Finanzanlagevermögens" - }, - "account": [2620,2621,2622,2623,2625,2626,2640,2641,2646,2647,2648,2649], - "type": "category", - "formula": "", - "style": "category", - "children": [ - { - "name": "10thereof", - "l11n": { - "en": "thereof derived from affiliated undertakings", - "de": "davon aus verbundenen Unternehmen" - }, - "account": [], - "type": "category", - "formula": "", - "style": "category", - "children": [] - } - ] - }, - { - "name": "11", - "l11n": { - "en": "Other interest receivable and similar income", - "de": "Sonstige Zinsen und ähnliche Erträge" - }, - "account": [2650,2653,2654,2655,2656,2657,2658,2659,2670,2679,2680,2682,2683,2684,2685,2686,2687,2688,2689], - "type": "category", - "formula": "", - "style": "category", - "children": [ - { - "name": "11thereof", - "l11n": { - "en": "thereof derived from affiliated undertakings", - "de": "davon aus verbundenen Unternehmen" - }, - "account": [], - "type": "category", - "formula": "", - "style": "category", - "children": [] - } - ] - }, - { - "name": "12", - "l11n": { - "en": "Depreciations of financial assets and of investment securities forming part of the current assets", - "de": "Abschreibungen auf Finanzanlagen und auf Wertpapiere des Umlaufvermögens" - }, - "account": [], - "type": "category", - "formula": "", - "style": "category", - "children": [] - }, - { - "name": "13", - "l11n": { - "en": "Interest payable and similar expenses", - "de": "Zinsen und ähnliche Aufwendungen," - }, - "account": [2105,2106,2107,2108,2109,2110,2111,2113,2114,2115,2116,2117,2118,2119,2120,2123,2124,2125,2126,2127,2128,2129,2130,2139,2140,2141,2142,2143,2144,2145,2146,2147,2148,2149], - "type": "category", - "formula": "", - "style": "category", - "children": [ - { - "name": "13thereof", - "l11n": { - "en": "thereof derived from affiliated undertakings", - "de": "davon aus verbundenen Unternehmen" - }, - "account": [], - "type": "category", - "formula": "", - "style": "category", - "children": [] - } - ] - }, - { - "name": "14", - "l11n": { - "en": "Taxes on income and earnings", - "de": "Steuern vom Einkommen und vom Ertrag" - }, - "account": [2200,2203,2204,2208,2209,2210,2213,2216,2218,2219,2250,2255,2260,2265,2281,2283], - "type": "category", - "formula": "", - "style": "category", - "children": [] - }, - { - "name": "15", - "l11n": { - "en": "Profit or loss after taxes", - "de": "Ergebnis nach Steuern" - }, - "account": [], - "type": "formula", - "formula": "1+2+3+4+5+6+7+8+9+10+11+12+13+14", - "style": "subtotal", - "children": [] - }, - { - "name": "16", - "l11n": { - "en": "Other taxes", - "de": "Sonstige Steuern" - }, - "account": [2285,2287,2289,2375], - "type": "category", - "formula": "", - "style": "category", - "children": [] - }, - { - "name": "17", - "l11n": { - "en": "Net income for the year / net loss for the year", - "de": "Jahresüberschuss/Jahresfehlbetrag" - }, - "account": [], - "type": "formula", - "formula": "15+16", - "style": "total", - "children": [] - } -] \ No newline at end of file diff --git a/Admin/Install/Coa/skr03_pl_ifrs_salescost.json b/Admin/Install/Coa/skr03_pl_ifrs_salescost.json deleted file mode 100644 index e69de29..0000000 diff --git a/Admin/Install/Coa/skr03_pl_ifrs_totalcost.json b/Admin/Install/Coa/skr03_pl_ifrs_totalcost.json deleted file mode 100644 index e69de29..0000000 diff --git a/Admin/Install/db.json b/Admin/Install/db.json index f7523fb..9ddb2ff 100755 --- a/Admin/Install/db.json +++ b/Admin/Install/db.json @@ -9,10 +9,11 @@ "primary": true, "autoincrement": true }, - "accounting_account_account": { - "name": "accounting_account_account", + "accounting_account_code": { + "name": "accounting_account_code", "type": "VARCHAR(50)", - "null": false + "null": false, + "unique": true }, "accounting_account_type": { "name": "accounting_account_type", @@ -24,6 +25,14 @@ "type": "INT", "default": null, "null": true + }, + "accounting_account_account": { + "name": "accounting_account_account", + "type": "INT", + "default": null, + "null": true, + "foreignTable": "account", + "foreignKey": "account_id" } } }, diff --git a/Admin/Installer.php b/Admin/Installer.php index fcc6146..be392cc 100755 --- a/Admin/Installer.php +++ b/Admin/Installer.php @@ -14,6 +14,7 @@ declare(strict_types=1); namespace Modules\Accounting\Admin; +use Modules\Accounting\Models\AccountType; use phpOMS\Application\ApplicationAbstract; use phpOMS\Config\SettingsInterface; use phpOMS\Localization\ISO639x1Enum; @@ -65,7 +66,7 @@ final class Installer extends InstallerAbstract /** @var \Modules\Accounting\Controller\ApiController $module */ $module = $app->moduleManager->getModuleInstance('Accounting', 'Api'); - $fp = \fopen(__DIR__ . '/Install/Coa/skr03.csv', 'r'); + $fp = \fopen(__DIR__ . '/Install/Coa/SKR03_DE_GAAP.csv', 'r'); if ($fp === false) { return; } @@ -90,7 +91,7 @@ final class Installer extends InstallerAbstract $request = new HttpRequest(new HttpUri('')); $request->header->account = 1; - $request->setData('account', $line[0]); + $request->setData('code', $line[0]); $request->setData('content', \trim($line[19])); $request->setData('language', $definitions[19]); $module->apiAccountCreate($request, $response); @@ -140,7 +141,11 @@ final class Installer extends InstallerAbstract ? \Modules\ClientManagement\Models\ClientMapper::class : \Modules\SupplierManagement\Models\SupplierMapper::class; - foreach ($mapper::yield() as $person) { + $accountType = $type === 'client' + ? AccountType::DEBITOR + : AccountType::CREDITOR; + + foreach ($mapper::yield()->execute() as $person) { $response = new HttpResponse(); $request = new HttpRequest(new HttpUri('')); @@ -148,9 +153,11 @@ final class Installer extends InstallerAbstract // @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('code', $person->number); $request->setData('content', \rtrim($person->account->name1 . ' ' . $person->account->name2)); - $request->setData('language', ISO639x1Enum::_EN); + $request->setData('language', ISO639x1Enum::_EN); // @todo personal accounts shouldn't have a translation?! + $request->setData('type', $accountType); + $request->setData('account', $person->account->id); $module->apiAccountCreate($request, $response); } } diff --git a/Admin/Routes/Web/Backend.php b/Admin/Routes/Web/Backend.php index c6fbb8a..dbae7ab 100755 --- a/Admin/Routes/Web/Backend.php +++ b/Admin/Routes/Web/Backend.php @@ -18,28 +18,6 @@ use phpOMS\Account\PermissionType; use phpOMS\Router\RouteVerb; return [ - '^.*/accounting/personal/entries.*$' => [ - [ - 'dest' => '\Modules\Accounting\Controller\BackendController:viewPersonalEntries', - 'verb' => RouteVerb::GET, - 'permission' => [ - 'module' => BackendController::NAME, - 'type' => PermissionType::READ, - 'state' => PermissionCategory::PERSONAL, - ], - ], - ], - '^.*/accounting/impersonal/entries.*$' => [ - [ - 'dest' => '\Modules\Accounting\Controller\BackendController:viewImpersonalEntries', - 'verb' => RouteVerb::GET, - 'permission' => [ - 'module' => BackendController::NAME, - 'type' => PermissionType::READ, - 'state' => PermissionCategory::IMPERSONAL, - ], - ], - ], '^.*/accounting/entries.*$' => [ [ 'dest' => '\Modules\Accounting\Controller\BackendController:viewEntries', @@ -51,17 +29,6 @@ return [ ], ], ], - '^.*/accounting/impersonal/journal/list.*$' => [ - [ - 'dest' => '\Modules\Accounting\Controller\BackendController:viewJournalList', - 'verb' => RouteVerb::GET, - 'permission' => [ - 'module' => BackendController::NAME, - 'type' => PermissionType::READ, - 'state' => PermissionCategory::JOURNAL, - ], - ], - ], '^.*/accounting/stack/list.*$' => [ [ 'dest' => '\Modules\Accounting\Controller\BackendController:viewStackList', @@ -150,17 +117,6 @@ return [ ], ], ], - '^.*/accounting/gl/profile.*$' => [ - [ - 'dest' => '\Modules\Accounting\Controller\BackendController:viewGLProfile', - 'verb' => RouteVerb::GET, - 'permission' => [ - 'module' => BackendController::NAME, - 'type' => PermissionType::READ, - 'state' => PermissionCategory::GL, - ], - ], - ], '^.*/accounting/dun/print.*$' => [ [ 'dest' => '\Modules\Accounting\Controller\BackendController:viewCostCenterProfile', diff --git a/Controller.js b/Controller.js new file mode 100644 index 0000000..705e20f --- /dev/null +++ b/Controller.js @@ -0,0 +1,92 @@ +import { jsOMS } from '../../jsOMS/Utils/oLib.js'; +import { Autoloader } from '../../jsOMS/Autoloader.js'; + +Autoloader.defineNamespace('omsApp.Modules'); + +omsApp.Modules.Accounting = class { + /** + * @constructor + * + * @since 1.0.0 + */ + constructor (app) + { + this.app = app; + }; + + bind (id) + { + const charts = typeof id === 'undefined' ? document.getElementsByTagName('canvas') : [document.getElementById(id)]; + let length = charts.length; + + for (let i = 0; i < length; ++i) { + if (charts[i].getAttribute('data-chart') === null + && charts[i].getAttribute('data-chart') !== 'undefined' + ) { + continue; + } + + this.bindChart(charts[i]); + } + + const maps = typeof id === 'undefined' ? document.getElementsByClassName('map') : [document.getElementById(id)]; + length = maps.length; + + for (let i = 0; i < length; ++i) { + this.bindMap(maps[i]); + } + }; + + bindChart (chart) + { + if (typeof chart === 'undefined' || !chart) { + jsOMS.Log.Logger.instance.error('Invalid chart: ' + chart, 'Accounting'); + + return; + } + + const self = this; + const data = JSON.parse(chart.getAttribute('data-chart')); + + const myChart = new Chart(chart.getContext('2d'), data); + + }; + + bindMap (map) + { + if (typeof map === 'undefined' || !map) { + jsOMS.Log.Logger.instance.error('Invalid map: ' + map, 'Accounting'); + + return; + } + + const mapObj = new OpenLayers.Map(map.getAttribute('id'), { + controls: [ + new OpenLayers.Control.Navigation( + { + zoomBoxEnabled: true, + zoomWheelEnabled: false + } + ), + new OpenLayers.Control.Zoom(), + new OpenLayers.Control.Attribution() + ] + }); + + mapObj.addLayer(new OpenLayers.Layer.OSM()); + + const fromProjection = new OpenLayers.Projection("EPSG:4326"); // Transform from WGS 1984 + const toProjection = new OpenLayers.Projection("EPSG:900913"); // to Spherical Mercator Projection + const position = new OpenLayers.LonLat(map.getAttribute('data-lon'), map.getAttribute('data-lat')).transform(fromProjection, toProjection); + const zoom = 12; + + const markers = new OpenLayers.Layer.Markers("Markers"); + mapObj.addLayer(markers); + + markers.addMarker(new OpenLayers.Marker(position)); + + mapObj.setCenter(position, zoom); + }; +}; + +window.omsApp.moduleManager.get('Accounting').bind(); diff --git a/Controller/ApiController.php b/Controller/ApiController.php index f4b1203..6b5163d 100755 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -17,6 +17,7 @@ namespace Modules\Accounting\Controller; use Modules\Accounting\Models\AccountAbstract; use Modules\Accounting\Models\AccountAbstractMapper; use Modules\Accounting\Models\AccountL11nMapper; +use Modules\Accounting\Models\AccountType; use Modules\Accounting\Models\CostCenter; use Modules\Accounting\Models\CostCenterMapper; use Modules\Accounting\Models\CostObject; @@ -84,8 +85,7 @@ final class ApiController extends Controller private function validateAccountCreate(RequestAbstract $request) : array { $val = []; - if (($val['account'] = !$request->hasData('account')) - || ($val['content'] = !$request->hasData('content')) + if (($val['code'] = !$request->hasData('code')) ) { return $val; } @@ -105,8 +105,14 @@ final class ApiController extends Controller private function createAccountFromRequest(RequestAbstract $request) : AccountAbstract { $account = new AccountAbstract(); - $account->account = $request->getDataString('account') ?? ''; - $account->setL11n($request->getDataString('content') ?? '', $request->getDataString('language') ?? ISO639x1Enum::_EN); + $account->code = $request->getDataString('code') ?? ''; + $account->account = $request->getDataInt('account'); + + if ($request->hasData('content')) { + $account->setL11n($request->getDataString('content') ?? '', $request->getDataString('language') ?? ISO639x1Enum::_EN); + } + + $account->type = $request->getDataInt('type') ?? AccountType::IMPERSONAL; return $account; } diff --git a/Controller/BackendController.php b/Controller/BackendController.php index 755a61f..4e4d480 100755 --- a/Controller/BackendController.php +++ b/Controller/BackendController.php @@ -17,11 +17,22 @@ namespace Modules\Accounting\Controller; use Modules\Accounting\Models\AccountAbstractMapper; use Modules\Accounting\Models\CostCenterMapper; use Modules\Accounting\Models\CostObjectMapper; +use Modules\Admin\Models\LocalizationMapper; +use Modules\Admin\Models\SettingsEnum; +use Modules\Auditor\Models\AuditMapper; +use Modules\ClientManagement\Models\Attribute\ClientAttributeTypeMapper; use Modules\ClientManagement\Models\ClientMapper; +use Modules\Media\Models\MediaMapper; +use Modules\Media\Models\MediaTypeMapper; +use Modules\Organization\Models\Attribute\UnitAttributeMapper; use Modules\SupplierManagement\Models\SupplierMapper; +use phpOMS\Asset\AssetType; use phpOMS\Contract\RenderableInterface; +use phpOMS\DataStorage\Database\Query\Builder; +use phpOMS\DataStorage\Database\Query\OrderType; use phpOMS\Message\RequestAbstract; use phpOMS\Message\ResponseAbstract; +use phpOMS\Utils\StringUtils; use phpOMS\Views\View; /** @@ -229,27 +240,6 @@ final class BackendController extends Controller 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 viewGLProfile(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface - { - $view = new View($this->app->l11nManager, $request, $response); - $view->setTemplate('/Modules/Accounting/Theme/Backend/gl-profile'); - $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1002604001, $request, $response); - - return $view; - } - /** * Routing end-point for application behavior. * @@ -265,7 +255,7 @@ final class BackendController extends Controller public function viewCostCenterProfile(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface { $view = new View($this->app->l11nManager, $request, $response); - $view->setTemplate('/Modules/Accounting/Theme/Backend/gl-profile'); + $view->setTemplate('/Modules/Accounting/Theme/Backend/costcenter-profile'); $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1002604001, $request, $response); return $view; @@ -283,31 +273,10 @@ final class BackendController extends Controller * @since 1.0.0 * @codeCoverageIgnore */ - public function viewImpersonalEntries(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface + public function viewCostObjectProfile(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface { $view = new View($this->app->l11nManager, $request, $response); - $view->setTemplate('/Modules/Accounting/Theme/Backend/gl-profile'); - $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1002604001, $request, $response); - - 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 viewPersonalEntries(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface - { - $view = new View($this->app->l11nManager, $request, $response); - $view->setTemplate('/Modules/Accounting/Theme/Backend/gl-profile'); + $view->setTemplate('/Modules/Accounting/Theme/Backend/costobject-profile'); $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1002604001, $request, $response); return $view; @@ -406,6 +375,9 @@ final class BackendController extends Controller $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1002604001, $request, $response); $accounts = SupplierMapper::getAll() + ->with('account') + ->with('mainAddress') + ->limit(25) ->execute(); $view->data['accounts'] = $accounts; @@ -432,10 +404,192 @@ final class BackendController extends Controller $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1002604001, $request, $response); $accounts = ClientMapper::getAll() + ->with('account') + ->with('mainAddress') + ->limit(25) ->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 viewSupplierProfile(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface + { + $head = $response->data['Content']->head; + $nonce = $this->app->appSettings->getOption('script-nonce'); + + $head->addAsset(AssetType::CSS, 'Resources/chartjs/chart.css'); + $head->addAsset(AssetType::JSLATE, 'Resources/chartjs/chart.js', ['nonce' => $nonce]); + $head->addAsset(AssetType::JSLATE, 'Resources/OpenLayers/OpenLayers.js', ['nonce' => $nonce]); + $head->addAsset(AssetType::JSLATE, 'Modules/Accounting/Controller.js', ['nonce' => $nonce, 'type' => 'module']); + + $view = new View($this->app->l11nManager, $request, $response); + $view->setTemplate('/Modules/Accounting/Theme/Backend/personal-profile'); + $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1002604001, $request, $response); + + $account = SupplierMapper::get() + ->with('account') + ->with('mainAddress') + ->where('id', (int) $request->getData('id')) + ->execute(); + + $view->data['account'] = $account; + + $businessStart = UnitAttributeMapper::get() + ->with('type') + ->with('value') + ->where('ref', $this->app->unitId) + ->where('type/name', 'business_year_start') + ->execute(); + + $view->data['business_start'] = $businessStart->id === 0 ? 1 : $businessStart->value->getValue(); + + $view->data['hasBilling'] = $this->app->moduleManager->isActive('Billing'); + + /** @var \Model\Setting $settings */ + $settings = $this->app->appSettings->get(null, SettingsEnum::DEFAULT_LOCALIZATION); + + $view->data['attributeView'] = new \Modules\Attribute\Theme\Backend\Components\AttributeView($this->app->l11nManager, $request, $response); + $view->data['attributeView']->data['default_localization'] = LocalizationMapper::get()->where('id', (int) $settings->id)->execute(); + + /** @var \Modules\Media\Models\Media[] $files */ + $files = MediaMapper::getAll() + ->with('types') + ->join('id', ClientMapper::class, 'files') // id = media id, files = client relations + ->on('id', $account->id, relation: 'files') // id = item id + ->execute(); + + $view->data['files'] = $files; + + $view->data['media-upload'] = new \Modules\Media\Theme\Backend\Components\Upload\BaseView($this->app->l11nManager, $request, $response); + $view->data['note'] = new \Modules\Editor\Theme\Backend\Components\Note\BaseView($this->app->l11nManager, $request, $response); + + 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 viewClientProfile(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface + { + $head = $response->data['Content']->head; + $nonce = $this->app->appSettings->getOption('script-nonce'); + + $head->addAsset(AssetType::CSS, 'Resources/chartjs/chart.css'); + $head->addAsset(AssetType::JSLATE, 'Resources/chartjs/chart.js', ['nonce' => $nonce]); + $head->addAsset(AssetType::JSLATE, 'Resources/OpenLayers/OpenLayers.js', ['nonce' => $nonce]); + $head->addAsset(AssetType::JSLATE, 'Modules/Accounting/Controller.js', ['nonce' => $nonce, 'type' => 'module']); + + $view = new View($this->app->l11nManager, $request, $response); + $view->setTemplate('/Modules/Accounting/Theme/Backend/personal-profile'); + $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1002604001, $request, $response); + + $account = ClientMapper::get() + ->with('account') + ->with('contactElements') + ->with('mainAddress') + ->with('files')->limit(5, 'files')->sort('files/id', OrderType::DESC) + ->with('notes')->limit(5, 'notes')->sort('notes/id', OrderType::DESC) + ->where('id', (int) $request->getData('id')) + ->execute(); + + $view->data['account'] = $account; + + /** @var \Model\Setting $settings */ + $settings = $this->app->appSettings->get(null, SettingsEnum::DEFAULT_LOCALIZATION); + + $view->data['attributeView'] = new \Modules\Attribute\Theme\Backend\Components\AttributeView($this->app->l11nManager, $request, $response); + $view->data['attributeView']->data['default_localization'] = LocalizationMapper::get()->where('id', (int) $settings->id)->execute(); + + /** @var \Modules\Attribute\Models\AttributeType[] $attributeTypes */ + $attributeTypes = ClientAttributeTypeMapper::getAll() + ->with('l11n') + ->where('l11n/language', $response->header->l11n->language) + ->execute(); + + $view->data['attributeTypes'] = $attributeTypes; + + // Get item profile image + // It might not be part of the 5 newest item files from above + // @todo It would be nice to have something like this as a default method in the model e.g. + // ItemManagement::getRelations()->with('types')->where(...); + // This should return the relations and NOT the model itself + $query = new Builder($this->app->dbPool->get()); + $results = $query->selectAs(ClientMapper::HAS_MANY['files']['external'], 'file') + ->from(ClientMapper::TABLE) + ->leftJoin(ClientMapper::HAS_MANY['files']['table']) + ->on(ClientMapper::HAS_MANY['files']['table'] . '.' . ClientMapper::HAS_MANY['files']['self'], '=', ClientMapper::TABLE . '.' . ClientMapper::PRIMARYFIELD) + ->leftJoin(MediaMapper::TABLE) + ->on(ClientMapper::HAS_MANY['files']['table'] . '.' . ClientMapper::HAS_MANY['files']['external'], '=', MediaMapper::TABLE . '.' . MediaMapper::PRIMARYFIELD) + ->leftJoin(MediaMapper::HAS_MANY['types']['table']) + ->on(MediaMapper::TABLE . '.' . MediaMapper::PRIMARYFIELD, '=', MediaMapper::HAS_MANY['types']['table'] . '.' . MediaMapper::HAS_MANY['types']['self']) + ->leftJoin(MediaTypeMapper::TABLE) + ->on(MediaMapper::HAS_MANY['types']['table'] . '.' . MediaMapper::HAS_MANY['types']['external'], '=', MediaTypeMapper::TABLE . '.' . MediaTypeMapper::PRIMARYFIELD) + ->where(ClientMapper::HAS_MANY['files']['self'], '=', $account->id) + ->where(MediaTypeMapper::TABLE . '.' . MediaTypeMapper::getColumnByMember('name'), '=', 'client_profile_image'); + + $accountImage = MediaMapper::get() + ->with('types') + ->where('id', $results) + ->limit(1) + ->execute(); + + $view->data['accountImage'] = $accountImage; + + $businessStart = UnitAttributeMapper::get() + ->with('type') + ->with('value') + ->where('ref', $this->app->unitId) + ->where('type/name', 'business_year_start') + ->execute(); + + $view->data['business_start'] = $businessStart->id === 0 ? 1 : $businessStart->value->getValue(); + + /** @var \Modules\Auditor\Models\Audit[] $audits */ + $audits = AuditMapper::getAll() + ->where('type', StringUtils::intHash(ClientMapper::class)) + ->where('module', 'ClientManagement') + ->where('ref', (string) $account->id) + ->execute(); + + $view->data['audits'] = $audits; + + /** @var \Modules\Media\Models\Media[] $files */ + $files = MediaMapper::getAll() + ->with('types') + ->join('id', ClientMapper::class, 'files') // id = media id, files = client relations + ->on('id', $account->id, relation: 'files') // id = item id + ->execute(); + + $view->data['files'] = $files; + + $view->data['media-upload'] = new \Modules\Media\Theme\Backend\Components\Upload\BaseView($this->app->l11nManager, $request, $response); + $view->data['note'] = new \Modules\Editor\Theme\Backend\Components\Note\BaseView($this->app->l11nManager, $request, $response); + + $view->data['hasBilling'] = $this->app->moduleManager->isActive('Billing'); + + return $view; + } } diff --git a/Models/AccountAbstract.php b/Models/AccountAbstract.php index bd9ee2d..fe72d5e 100755 --- a/Models/AccountAbstract.php +++ b/Models/AccountAbstract.php @@ -35,7 +35,9 @@ class AccountAbstract */ public int $id = 0; - public string $account = ''; + public string $code = ''; + + public ?int $account = null; /* * String l11n diff --git a/Models/AccountAbstractMapper.php b/Models/AccountAbstractMapper.php index 7db0fbd..7924ed4 100644 --- a/Models/AccountAbstractMapper.php +++ b/Models/AccountAbstractMapper.php @@ -37,9 +37,10 @@ class AccountAbstractMapper extends DataMapperFactory */ public const COLUMNS = [ 'accounting_account_id' => ['name' => 'accounting_account_id', 'type' => 'int', 'internal' => 'id'], - 'accounting_account_account' => ['name' => 'accounting_account_account', 'type' => 'string', 'internal' => 'account', 'autocomplete' => true], + 'accounting_account_code' => ['name' => 'accounting_account_code', 'type' => 'string', 'internal' => 'code', 'autocomplete' => true], 'accounting_account_type' => ['name' => 'accounting_account_type', 'type' => 'int', 'internal' => 'type'], 'accounting_account_parent' => ['name' => 'accounting_account_parent', 'type' => 'int', 'internal' => 'parent'], + 'accounting_account_account' => ['name' => 'accounting_account_account', 'type' => 'int', 'internal' => 'account'], ]; /** diff --git a/Theme/Backend/Lang/ar.lang.php b/Theme/Backend/Lang/ar.lang.php index 776159c..9130dd8 100755 --- a/Theme/Backend/Lang/ar.lang.php +++ b/Theme/Backend/Lang/ar.lang.php @@ -46,7 +46,6 @@ return ['Accounting' => [ 'Stack' => 'كومة', 'TAccount' => 'T- حساب', 'Text' => 'نص', - 'To' => 'ل', 'Total' => 'مجموع', 'Type' => 'نوع', ]]; diff --git a/Theme/Backend/Lang/cs.lang.php b/Theme/Backend/Lang/cs.lang.php index 047fc02..fdab817 100755 --- a/Theme/Backend/Lang/cs.lang.php +++ b/Theme/Backend/Lang/cs.lang.php @@ -46,7 +46,6 @@ return ['Accounting' => [ 'Stack' => 'Zásobník', 'TAccount' => 'T-Account.', 'Text' => 'Text', - 'To' => 'Na', 'Total' => 'Celkový', 'Type' => 'Typ', ]]; diff --git a/Theme/Backend/Lang/da.lang.php b/Theme/Backend/Lang/da.lang.php index b89380b..3346331 100755 --- a/Theme/Backend/Lang/da.lang.php +++ b/Theme/Backend/Lang/da.lang.php @@ -46,7 +46,6 @@ return ['Accounting' => [ 'Stack' => 'Stak', 'TAccount' => 'T-konto.', 'Text' => 'Tekst', - 'To' => 'Til', 'Total' => 'i alt', 'Type' => 'Type', ]]; diff --git a/Theme/Backend/Lang/de.lang.php b/Theme/Backend/Lang/de.lang.php index 8ac55c6..db88006 100755 --- a/Theme/Backend/Lang/de.lang.php +++ b/Theme/Backend/Lang/de.lang.php @@ -47,7 +47,41 @@ return ['Accounting' => [ 'Stack' => 'Stapel', 'TAccount' => 'T-Konto', 'Text' => 'Text', - 'To' => 'Zu', 'Total' => 'Gesamt', 'Type' => 'Typ', + 'City' => 'Stadt', + 'Zip' => 'Postleitzahl', + 'Address' => 'Adresse', + 'Country' => 'Land', + 'Info' => 'Info', + 'Date' => 'Datum', + 'Number' => 'Nummer', + 'Payment' => 'Zahlung', + 'Open' => 'Offen', + 'Balanced' => 'Ausgeglichen', + 'Balance' => 'Ausgleich', + 'YTDSales' => 'Ytd Sales', + 'MTDSales' => 'Mtd Sales', + 'CLV' => 'CLV', + 'LastContact' => 'Letzter Kontakt', + 'LastOrder' => 'Letzte Bestellung', + 'DSO' => 'DSO', + 'Name1' => 'Name 1', + 'Name2' => 'Name 2', + 'Name3' => 'Name 3', + 'Contact' => 'Kontakt', + 'Phone' => 'Telefon', + 'Email' => 'Email', + 'Website' => 'Webseite', + 'Postal' => 'Postleitzahl', + 'Map' => 'Karte', + 'RecentInvoices' => 'Neuste Rechnungen', + 'Notes' => 'Notizen', + 'Documents' => 'Dokumente', + 'CreatedAt' => 'Erstellt', + 'Finance' => 'Finanzen', + 'Files' => 'Dateien', + 'Title' => 'Titel', + 'Net' => 'Netto', + 'BalanceSheet' => 'Balance Sheet', ]]; diff --git a/Theme/Backend/Lang/el.lang.php b/Theme/Backend/Lang/el.lang.php index a22c124..36d589a 100755 --- a/Theme/Backend/Lang/el.lang.php +++ b/Theme/Backend/Lang/el.lang.php @@ -46,7 +46,6 @@ return ['Accounting' => [ 'Stack' => 'Σωρός', 'TAccount' => 'T-λογαριασμό', 'Text' => 'Κείμενο', - 'To' => 'Προς το', 'Total' => 'Σύνολο', 'Type' => 'Τύπος', ]]; diff --git a/Theme/Backend/Lang/en.lang.php b/Theme/Backend/Lang/en.lang.php index dcd03f3..bac86e9 100755 --- a/Theme/Backend/Lang/en.lang.php +++ b/Theme/Backend/Lang/en.lang.php @@ -47,7 +47,41 @@ return ['Accounting' => [ 'Stack' => 'Stack', 'TAccount' => 'T-Account', 'Text' => 'Text', - 'To' => 'To', 'Total' => 'Total', 'Type' => 'Type', + 'City' => 'City', + 'Zip' => 'Zip', + 'Address' => 'Address', + 'Country' => 'Country', + 'Info' => 'Info', + 'Date' => 'Date', + 'Number' => 'Number', + 'Payment' => 'Payment', + 'Open' => 'Open', + 'Balanced' => 'Balanced', + 'Balance' => 'Balance', + 'YTDSales' => 'YTD Sales', + 'MTDSales' => 'MTD Sales', + 'CLV' => 'CLV', + 'LastContact' => 'Last Contact', + 'LastOrder' => 'Last Order', + 'DSO' => 'DSO', + 'Name1' => 'Name 1', + 'Name2' => 'Name 2', + 'Name3' => 'Name 3', + 'Contact' => 'Contact', + 'Phone' => 'Phone', + 'Email' => 'Email', + 'Website' => 'Website', + 'Postal' => 'Postal', + 'Map' => 'Map', + 'RecentInvoices' => 'Recent Invoices', + 'Notes' => 'Notes', + 'Documents' => 'Documents', + 'CreatedAt' => 'Created At', + 'Finance' => 'Finance', + 'Files' => 'Files', + 'Title' => 'Title', + 'Net' => 'Net', + 'BalanceSheet' => 'Balance Sheet', ]]; diff --git a/Theme/Backend/Lang/es.lang.php b/Theme/Backend/Lang/es.lang.php index 7302375..240b028 100755 --- a/Theme/Backend/Lang/es.lang.php +++ b/Theme/Backend/Lang/es.lang.php @@ -46,7 +46,6 @@ return ['Accounting' => [ 'Stack' => 'Apilar', 'TAccount' => 'Cuenta t', 'Text' => 'Texto', - 'To' => 'A', 'Total' => 'Total', 'Type' => 'Escribe', ]]; diff --git a/Theme/Backend/Lang/fi.lang.php b/Theme/Backend/Lang/fi.lang.php index 1b3994a..b321800 100755 --- a/Theme/Backend/Lang/fi.lang.php +++ b/Theme/Backend/Lang/fi.lang.php @@ -46,7 +46,6 @@ return ['Accounting' => [ 'Stack' => 'Pino', 'TAccount' => 'T-tili', 'Text' => 'Teksti', - 'To' => 'Jllek', 'Total' => 'Kaikki yhteensä', 'Type' => 'Tyyppi', ]]; diff --git a/Theme/Backend/Lang/fr.lang.php b/Theme/Backend/Lang/fr.lang.php index 7963963..747fbd0 100755 --- a/Theme/Backend/Lang/fr.lang.php +++ b/Theme/Backend/Lang/fr.lang.php @@ -46,7 +46,6 @@ return ['Accounting' => [ 'Stack' => 'Empiler', 'TAccount' => 'Compte T-Compte', 'Text' => 'Texte', - 'To' => 'À', 'Total' => 'Le total', 'Type' => 'Taper', ]]; diff --git a/Theme/Backend/Lang/hu.lang.php b/Theme/Backend/Lang/hu.lang.php index 4077c65..91e0f26 100755 --- a/Theme/Backend/Lang/hu.lang.php +++ b/Theme/Backend/Lang/hu.lang.php @@ -46,7 +46,6 @@ return ['Accounting' => [ 'Stack' => 'Kazal', 'TAccount' => 'T-számla', 'Text' => 'Szöveg', - 'To' => 'Nak nek', 'Total' => 'Teljes', 'Type' => 'típus', ]]; diff --git a/Theme/Backend/Lang/it.lang.php b/Theme/Backend/Lang/it.lang.php index bff527d..6ab9514 100755 --- a/Theme/Backend/Lang/it.lang.php +++ b/Theme/Backend/Lang/it.lang.php @@ -46,7 +46,6 @@ return ['Accounting' => [ 'Stack' => 'Pila', 'TAccount' => 'T-ACCOUNT.', 'Text' => 'Testo', - 'To' => 'a', 'Total' => 'Totale', 'Type' => 'Tipo', ]]; diff --git a/Theme/Backend/Lang/ja.lang.php b/Theme/Backend/Lang/ja.lang.php index ae3e1e4..4b57f05 100755 --- a/Theme/Backend/Lang/ja.lang.php +++ b/Theme/Backend/Lang/ja.lang.php @@ -46,7 +46,6 @@ return ['Accounting' => [ 'Stack' => 'スタック', 'TAccount' => 'T - アカウント', 'Text' => '文章', - 'To' => 'に', 'Total' => '合計', 'Type' => 'タイプ', ]]; diff --git a/Theme/Backend/Lang/ko.lang.php b/Theme/Backend/Lang/ko.lang.php index b9b02b2..8a650f7 100755 --- a/Theme/Backend/Lang/ko.lang.php +++ b/Theme/Backend/Lang/ko.lang.php @@ -46,7 +46,6 @@ return ['Accounting' => [ 'Stack' => '스택', 'TAccount' => 'T-Account.', 'Text' => '텍스트', - 'To' => '에게', 'Total' => '총', 'Type' => '유형', ]]; diff --git a/Theme/Backend/Lang/no.lang.php b/Theme/Backend/Lang/no.lang.php index b2a6ddc..97873b0 100755 --- a/Theme/Backend/Lang/no.lang.php +++ b/Theme/Backend/Lang/no.lang.php @@ -46,7 +46,6 @@ return ['Accounting' => [ 'Stack' => 'Stable', 'TAccount' => 'T-konto', 'Text' => 'Tekst', - 'To' => 'Til', 'Total' => 'Total', 'Type' => 'Type', ]]; diff --git a/Theme/Backend/Lang/pl.lang.php b/Theme/Backend/Lang/pl.lang.php index 1634dfb..55116c7 100755 --- a/Theme/Backend/Lang/pl.lang.php +++ b/Theme/Backend/Lang/pl.lang.php @@ -46,7 +46,6 @@ return ['Accounting' => [ 'Stack' => 'Stos', 'TAccount' => 'Konta T.', 'Text' => 'Tekst', - 'To' => 'Do', 'Total' => 'Całkowity', 'Type' => 'Rodzaj', ]]; diff --git a/Theme/Backend/Lang/pt.lang.php b/Theme/Backend/Lang/pt.lang.php index f3905d1..f68982a 100755 --- a/Theme/Backend/Lang/pt.lang.php +++ b/Theme/Backend/Lang/pt.lang.php @@ -46,7 +46,6 @@ return ['Accounting' => [ 'Stack' => 'Pilha', 'TAccount' => 'Conta t.', 'Text' => 'Texto', - 'To' => 'Para', 'Total' => 'Total', 'Type' => 'Modelo', ]]; diff --git a/Theme/Backend/Lang/ru.lang.php b/Theme/Backend/Lang/ru.lang.php index 49ff536..0fdbbb4 100755 --- a/Theme/Backend/Lang/ru.lang.php +++ b/Theme/Backend/Lang/ru.lang.php @@ -46,7 +46,6 @@ return ['Accounting' => [ 'Stack' => 'Куча', 'TAccount' => 'T-счет', 'Text' => 'Текст', - 'To' => 'К', 'Total' => 'Всего', 'Type' => 'Тип', ]]; diff --git a/Theme/Backend/Lang/sv.lang.php b/Theme/Backend/Lang/sv.lang.php index 32ac776..6c2afcf 100755 --- a/Theme/Backend/Lang/sv.lang.php +++ b/Theme/Backend/Lang/sv.lang.php @@ -46,7 +46,6 @@ return ['Accounting' => [ 'Stack' => 'Stack', 'TAccount' => 'T-konto', 'Text' => 'Text', - 'To' => 'Till', 'Total' => 'Total', 'Type' => 'Typ', ]]; diff --git a/Theme/Backend/Lang/th.lang.php b/Theme/Backend/Lang/th.lang.php index e5d1dc8..820ac85 100755 --- a/Theme/Backend/Lang/th.lang.php +++ b/Theme/Backend/Lang/th.lang.php @@ -46,7 +46,6 @@ return ['Accounting' => [ 'Stack' => 'ซ้อนกัน', 'TAccount' => 'บัญชี T', 'Text' => 'ข้อความ', - 'To' => 'ถึง', 'Total' => 'ทั้งหมด', 'Type' => 'พิมพ์', ]]; diff --git a/Theme/Backend/Lang/tr.lang.php b/Theme/Backend/Lang/tr.lang.php index dc3f140..85bd7da 100755 --- a/Theme/Backend/Lang/tr.lang.php +++ b/Theme/Backend/Lang/tr.lang.php @@ -46,7 +46,6 @@ return ['Accounting' => [ 'Stack' => 'Yığın', 'TAccount' => 'Te hesabı', 'Text' => 'Metin', - 'To' => 'İle', 'Total' => 'Toplam', 'Type' => 'Tip', ]]; diff --git a/Theme/Backend/Lang/uk.lang.php b/Theme/Backend/Lang/uk.lang.php index e3a93a5..7df108d 100755 --- a/Theme/Backend/Lang/uk.lang.php +++ b/Theme/Backend/Lang/uk.lang.php @@ -46,7 +46,6 @@ return ['Accounting' => [ 'Stack' => 'Стек', 'TAccount' => 'Т-обліковий запис', 'Text' => 'Текст', - 'To' => 'До', 'Total' => 'Загальний', 'Type' => 'Тип', ]]; diff --git a/Theme/Backend/Lang/zh.lang.php b/Theme/Backend/Lang/zh.lang.php index f24960a..174959c 100755 --- a/Theme/Backend/Lang/zh.lang.php +++ b/Theme/Backend/Lang/zh.lang.php @@ -46,7 +46,6 @@ return ['Accounting' => [ 'Stack' => '堆', 'TAccount' => 't账户', 'Text' => '文本', - 'To' => '到', 'Total' => '全部的', 'Type' => '类型', ]]; diff --git a/Theme/Backend/account-list.tpl.php b/Theme/Backend/account-list.tpl.php deleted file mode 100755 index f8e8aa1..0000000 --- a/Theme/Backend/account-list.tpl.php +++ /dev/null @@ -1,12 +0,0 @@ - \ No newline at end of file diff --git a/Theme/Backend/coa-list.tpl.php b/Theme/Backend/coa-list.tpl.php index 15d6f38..bb76e71 100644 --- a/Theme/Backend/coa-list.tpl.php +++ b/Theme/Backend/coa-list.tpl.php @@ -36,7 +36,7 @@ echo $this->data['nav']->render(); ?> foreach ($accounts as $key => $value) : ++$c; $url = UriFactory::build('{/base}/accounting/coa/profile?{?}&id=' . $value->id); ?> - printHtml($value->account); ?> + printHtml($value->code); ?> printHtml($value->getL11n()); ?> diff --git a/Theme/Backend/personal-list.tpl.php b/Theme/Backend/personal-list.tpl.php index e69de29..c373c71 100644 --- a/Theme/Backend/personal-list.tpl.php +++ b/Theme/Backend/personal-list.tpl.php @@ -0,0 +1,125 @@ +data['accounts'] ?? []; + +$type = \reset($accounts) instanceof Client ? 'client' : 'supplier'; + +echo $this->data['nav']->render(); ?> +
+
+
+
getHtml('Accounts'); ?>download
+
+ + + + + $value) : ++$count; + $url = UriFactory::build('{/base}/accounting/' . $type . '/profile?{?}&id=' . $value->id); + ?> + +
getHtml('ID', '0', '0'); ?> + + + + getHtml('Name'); ?> + + + + getHtml('City'); ?> + + + + getHtml('Zip'); ?> + + + + getHtml('Address'); ?> + + + + getHtml('Country'); ?> + + + +
printHtml($value->number); ?> + printHtml($value->account->name1); ?> printHtml($value->account->name2); ?> + printHtml($value->mainAddress->city); ?> + printHtml($value->mainAddress->postal); ?> + printHtml($value->mainAddress->address); ?> + printHtml($value->mainAddress->getCountry()); ?> + + +
getHtml('Empty', '0', '0'); ?> + +
+
+
+
+
diff --git a/Theme/Backend/personal-profile.tpl.php b/Theme/Backend/personal-profile.tpl.php new file mode 100644 index 0000000..cc6d862 --- /dev/null +++ b/Theme/Backend/personal-profile.tpl.php @@ -0,0 +1,479 @@ +data['account'] ?? null; +$notes = $account->notes; +$files = $account->files; + +$accountImage = $this->getData('accountImage') ?? new NullMedia(); + +$attributeView = $this->data['attributeView']; + +$countryCodes = \phpOMS\Localization\ISO3166TwoEnum::getConstants(); +$countries = \phpOMS\Localization\ISO3166NameEnum::getConstants(); +$languages = ISO639Enum::getConstants(); + +echo $this->data['nav']->render(); ?> +
+
+ +
+
+ request->uri->fragment === 'c-tab-1' ? ' checked' : ''; ?>> +
+
+
+ + +
+
+
+
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+
+
+ +
+
+
+ +
+
+ getHtml('Contact'); ?> + mail +
+
+
+ + +
+ +
+ + +
+ +
+ + +
+
+
+ +
+
+ getHtml('Address'); ?> + + + + + +
+
+ mainAddress->fao)) : ?> +
+ + +
+ + +
+ + +
+ + mainAddress->addressAddition)) : ?> +
+ + +
+ + +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ +
+
+
+
+ +
+
+ <?= $this->printHtml($accountImage->name); ?> +
+
+ +
+
+ +
+
+
+
+ getEditorDocByTypeName('account_backend_warning'))->id !== 0) : ?> + +
+
+
+
printHtml($warning->plain); ?>
+
+
+
+ + + data['hasBilling']) : ?> +
+
+
+
+ +
getHtml('YTDSales'); ?>: + getCurrency(SalesBillMapper::getClientNetSales($account->id, SmartDateTime::startOfYear($this->data['business_start']), new \DateTime('now')), format: 'medium'); ?> +
getHtml('MTDSales'); ?>: + getCurrency(SalesBillMapper::getClientNetSales($account->id, SmartDateTime::startOfMonth(), new \DateTime('now')), format: 'medium'); ?> +
getHtml('CLV'); ?>: + getCurrency(SalesBillMapper::getCLVHistoric($account->id), format: 'medium'); ?> +
+
+
+
+ +
+
+
+ +
getHtml('LastContact'); ?>: + id)?->format('Y-m-d'); ?> +
getHtml('LastOrder'); ?>: + id)?->format('Y-m-d'); ?> +
getHtml('Created'); ?>: + createdAt->format('Y-m-d H:i'); ?> +
+
+
+
+ +
+
+
+ +
getHtml('DSO'); ?>: + TBD +
getHtml('Due'); ?>: + TBD +
getHtml('Balance'); ?>: + TBD +
+
+
+
+
+ + +
+
+
+
getHtml('Notes'); ?>
+
+ + + + + id); + ?> + +
getHtml('Title'); ?> + getHtml('CreatedAt'); ?> +
title; ?> + createdAt->format('Y-m-d'); ?> + +
+
+
+
+ +
+
+
getHtml('Documents'); ?>
+
+ + + + + id); + ?> + +
getHtml('Title'); ?> + + getHtml('CreatedAt'); ?> +
name; ?> + extension; ?> + createdAt->format('Y-m-d'); ?> + +
+
+
+
+
+ + data['hasBilling']) : ?> +
+
+
+
getHtml('RecentInvoices'); ?>
+ + + + + with('type') + ->with('type/l11n') + ->with('account') + ->where('account', $account->id) + ->where('type/l11n/language', $this->response->header->l11n->language) + ->sort('id', OrderType::DESC) + ->limit(5) + ->execute(); + + /** @var \Modules\Billing\Models\Bill $invoice */ + foreach ($newestInvoices as $invoice) : + $url = UriFactory::build('{/base}/sales/bill?{?}&id=' . $invoice->id); + ?> + +
getHtml('Number'); ?> + getHtml('Type'); ?> + getHtml('Name'); ?> + getHtml('Net'); ?> + getHtml('Date'); ?> +
getNumber(); ?> + type->getL11n(); ?> + billTo; ?> + getCurrency($invoice->netSales); ?> + createdAt->format('Y-m-d'); ?> + +
+
+
+
+ +
+
+
+ + request->uri->fragment === 'c-tab-2' ? ' checked' : ''; ?>> +
+
+
+
+
getHtml('Account'); ?>
+
+
+ + +
+
+
+
+ +
+
+
getHtml('Accounts'); ?>
+
+ + + + + +
+
+
+
+
+
+
+
+ + request->uri->fragment === 'c-tab-7' ? ' checked' : ''; ?>> +
+
+ +
+
+ + request->uri->fragment === 'c-tab-3' ? ' checked' : ''; ?>> +
+
+
+
+
getHtml('QuickAction'); ?>
+
+ +
+
+
+ +
+
+
+
+
getHtml('Open'); ?>
+ + + + + +
+ getHtml('Info'); ?> + getHtml('Date'); ?> + getHtml('Credit'); ?> + getHtml('Debit'); ?> + getHtml('Number'); ?> + getHtml('Text'); ?> + getHtml('Due'); ?> + getHtml('Payment'); ?> +
getHtml('Empty', '0', '0'); ?> +
+
+
+ getHtml('Total'); ?>: 0.00 + getHtml('Due'); ?>: 0.00 +
+
+
+
+ +
+
+
+
getHtml('Total'); ?>
+ + + + + +
getHtml('Info'); ?> + getHtml('Date'); ?> + getHtml('Credit'); ?> + getHtml('Debit'); ?> + getHtml('Number'); ?> + getHtml('Text'); ?> + getHtml('Due'); ?> + getHtml('Payment'); ?> + getHtml('Balanced'); ?> + getHtml('Balance'); ?> +
getHtml('Empty', '0', '0'); ?> +
+
+
+
+
+
+
+
+ + request->uri->fragment === 'c-tab-4' ? ' checked' : ''; ?>> +
+
+ + request->uri->fragment === 'c-tab-5' ? ' checked' : ''; ?>> +
+ data['media-upload']->render('account-file', 'files', '', $account->files); ?> +
+ + request->uri->fragment === 'c-tab-6' ? ' checked' : ''; ?>> +
+ data['note']->render('account-note', 'notes', $account->notes); ?> +
+
+