This commit is contained in:
Dennis Eichhorn 2024-04-07 17:31:42 +00:00
parent f27b00d6b1
commit c958be1f1c
9 changed files with 131 additions and 10 deletions

View File

@ -80,9 +80,9 @@ final class Installer extends InstallerAbstract
$request->setData('abbr', $data['abbr'] ?? '');
$request->setData('percentage_invoice', $data['percentage_invoice'] ?? 0);
$request->setData('percentage_sales_tax', $data['percentage_sales_tax'] ?? 0);
$request->setData('percentage_input_tax', $data['percentage_input_tax'] ?? 0);
$request->setData('tax1', $data['tax1_account'] ?? null);
$request->setData('tax2', $data['tax2_account'] ?? null);
$request->setData('percentage_input_tax', $data['percentage_input_tax'] ?? 0);
$request->setData('title', \reset($data['l11n'])['title'] ?? '');
$request->setData('short', \reset($data['l11n'])['short'] ?? '');
$request->setData('long', \reset($data['l11n'])['long'] ?? '');

View File

@ -22,9 +22,10 @@ return [
[
'dest' => '\Modules\Finance\Controller\BackendController:viewDashboard',
'verb' => RouteVerb::GET,
'active' => true,
'permission' => [
'module' => BackendController::NAME,
'type' => PermissionType::CREATE,
'type' => PermissionType::READ,
'state' => PermissionCategory::ANALYSIS,
],
],
@ -33,9 +34,22 @@ return [
[
'dest' => '\Modules\Finance\Controller\BackendController:viewTaxList',
'verb' => RouteVerb::GET,
'active' => true,
'permission' => [
'module' => BackendController::NAME,
'type' => PermissionType::CREATE,
'type' => PermissionType::READ,
'state' => PermissionCategory::TAX,
],
],
],
'^/finance/tax/code/view(\?.*$|$)' => [
[
'dest' => '\Modules\Finance\Controller\BackendController:viewTaxCode',
'verb' => RouteVerb::GET,
'active' => true,
'permission' => [
'module' => BackendController::NAME,
'type' => PermissionType::READ,
'state' => PermissionCategory::TAX,
],
],
@ -44,6 +58,7 @@ return [
[
'dest' => '\Modules\Finance\Controller\BackendController:viewTaxCreate',
'verb' => RouteVerb::GET,
'active' => true,
'permission' => [
'module' => BackendController::NAME,
'type' => PermissionType::CREATE,

View File

@ -132,7 +132,7 @@ final class ApiController extends Controller
}
/**
* Api method to create tag localization
* Api method to create tax code localization
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
@ -159,7 +159,7 @@ final class ApiController extends Controller
}
/**
* Method to create tag localization from request.
* Method to create tax code localization from request.
*
* @param RequestAbstract $request Request
*

View File

@ -45,7 +45,7 @@ final class BackendController extends Controller
public function viewTaxList(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
{
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/Finance/Theme/Backend/finance-taxcode-list');
$view->setTemplate('/Modules/Finance/Theme/Backend/taxcode-list');
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1008102001, $request, $response);
$view->data['taxcode'] = TaxCodeMapper::getAll()
@ -68,7 +68,7 @@ final class BackendController extends Controller
public function viewTaxView(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
{
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/Finance/Theme/Backend/finance-taxcode-view');
$view->setTemplate('/Modules/Finance/Theme/Backend/taxcode-view');
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1008102001, $request, $response);
$view->data['taxcode'] = TaxCodeMapper::getAll()
@ -76,4 +76,24 @@ final class BackendController extends Controller
return $view;
}
/**
* Method which shows the sales dashboard
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param array $data Generic data
*
* @return RenderableInterface Response can be rendered
*
* @since 1.0.0
*/
public function viewTaxCreate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
{
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/Finance/Theme/Backend/taxcode-view');
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1008102001, $request, $response);
return $view;
}
}

View File

@ -45,6 +45,8 @@ class TaxCode implements \JsonSerializable
// 1. Account (gross postings are automatically split)
// 2. Tax code
// 3. Tax combination
// @todo create comment which is the sales an which is the input tax account
public ?string $taxAccount1 = null;
public ?string $taxAccount2 = null;

View File

@ -22,7 +22,6 @@ return ['Finance' => [
'Analysis' => 'Analyse',
'Analyze' => 'Analyse',
'Area' => 'Bereich',
'Article' => 'Artikel',
'Articles' => 'Artikel',
'Available' => 'Erhältlich',
'Calculate' => 'Berechnung',
@ -106,6 +105,9 @@ return ['Finance' => [
'TaxCodes' => 'Steuerkz.',
'TaxCode' => 'Steuerkz.',
'Purchase' => 'Einkauf',
'InvoicePercentage' => 'Rechnungsprozentsatz',
'OutputPercentage' => 'Umsatzsteuerprozentsatz',
'InputPercentage' => 'Vorsteuerprozentsatz',
'Tax1Account' => 'Steuerkonto 1',
'Tax2Account' => 'Steyerkonto 2',
]];

View File

@ -22,8 +22,6 @@ return ['Finance' => [
'Analysis' => 'Analysis',
'Analyze' => 'Analyze',
'Area' => 'Area',
'Article' => 'Article',
'Articles' => 'Articles',
'Available' => 'Available',
'Calculate' => 'Calculate',
'City' => 'City',
@ -106,6 +104,9 @@ return ['Finance' => [
'TaxCodes' => 'Tax Codes',
'TaxCode' => 'Tax Code',
'Purchase' => 'Purchase',
'InvoicePercentage' => 'Invoice Percentage',
'OutputPercentage' => 'Sales Percentage',
'InputPercentage' => 'Input Percentage',
'Tax1Account' => 'Tax Account 1',
'Tax2Account' => 'Tax Account 2',
]];

View File

@ -0,0 +1,81 @@
<?php
/**
* Jingga
*
* PHP Version 8.2
*
* @package Modules\Accounting
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
use Modules\Finance\Models\NullTaxCode;
use phpOMS\Stdlib\Base\FloatInt;
use phpOMS\Uri\UriFactory;
$taxcode = $this->data['taxcode'] ?? new NullTaxCode();
$isNew = $taxcode->id === 0;
/** @var \phpOMS\Views\View $this */
echo $this->data['nav']->render(); ?>
<div class="row">
<div class="col-xs-12 col-md-6">
<section class="portlet">
<form method="<?= $isNew ? 'PUT' : 'POST'; ?>" action="<?= UriFactory::build('{/api}finance/tax/code?csrf={$CSRF}'); ?>">
<div class="portlet-head"><?= $this->getHtml('TaxCode'); ?></div>
<div class="portlet-body">
<div class="form-group">
<label for="iId"><?= $this->getHtml('ID', '0', '0'); ?></label>
<input type="text" name="id" id="iId" value="<?= $taxcode->id; ?>" disabled>
</div>
<div class="form-group">
<label for="iTaxCode"><?= $this->getHtml('TaxCode'); ?></label>
<input type="text" name="abbr" id="iTaxCode" value="<?= $this->printHtml($taxcode->abbr); ?>">
</div>
<div class="form-group">
<label for="iInvoice"><?= $this->getHtml('InvoicePercentage'); ?></label>
<input type="number" step="any" name="percentage_invoice" id="iInvoice" value="<?= \number_format($taxcode->percentageInvoice / FloatInt::DIVISOR, 2); ?>">
</div>
<div class="form-group">
<label for="iOutput"><?= $this->getHtml('OutputPercentage'); ?></label>
<input type="number" step="any" name="percentage_sales_tax" id="iOutput" value="<?= \number_format($taxcode->percentageOutput / FloatInt::DIVISOR, 2); ?>">
</div>
<div class="form-group">
<label for="iInput"><?= $this->getHtml('InputPercentage'); ?></label>
<input type="number" step="any" name="percentage_input_tax" id="iInput" value="<?= \number_format($taxcode->percentageInput / FloatInt::DIVISOR, 2); ?>">
</div>
<div class="form-group">
<label for="iTax1Account"><?= $this->getHtml('Tax1Account'); ?></label>
<input type="text" name="tax1" id="iTax1Account" value="<?= $this->printHtml($taxcode->taxAccount1); ?>">
</div>
<div class="form-group">
<label for="iTax2Account"><?= $this->getHtml('Tax2Account'); ?></label>
<input type="text" name="tax2" id="iTax2Account" value="<?= $this->printHtml($taxcode->taxAccount2); ?>">
</div>
</div>
<div class="portlet-foot">
<?php if ($isNew) : ?>
<input id="iCreateSubmit" type="Submit" value="<?= $this->getHtml('Create', '0', '0'); ?>">
<?php else : ?>
<input id="iSaveSubmit" type="Submit" value="<?= $this->getHtml('Save', '0', '0'); ?>">
<?php endif; ?>
</div>
</form>
</section>
</div>
</div>
<?php if (!$isNew) : ?>
<!-- @todo implement localization form + table.
We cannot use the standard l11n form because here we have multiple l11n elements grouped together
-->
<?php endif; ?>