mirror of
https://github.com/Karaka-Management/oms-Accounting.git
synced 2026-01-10 21:08:41 +00:00
template fixes + bug fixes + style fixes
This commit is contained in:
parent
7501418738
commit
83efadb3a3
|
|
@ -18,7 +18,7 @@ use phpOMS\Account\PermissionType;
|
|||
use phpOMS\Router\RouteVerb;
|
||||
|
||||
return [
|
||||
'^/accounting/entries(\?.*$|$)' => [
|
||||
'^/accounting/entries/dashboard(\?.*$|$)' => [
|
||||
[
|
||||
'dest' => '\Modules\Accounting\Controller\BackendController:viewEntries',
|
||||
'verb' => RouteVerb::GET,
|
||||
|
|
|
|||
|
|
@ -349,7 +349,7 @@ final class ApiController extends Controller
|
|||
// https://github.com/Karaka-Management/oms-Accounting/issues/8
|
||||
|
||||
$request->header->account = $account;
|
||||
$request->setData('code', $new->number);
|
||||
$request->setData('code', $new->number . '-1');
|
||||
$request->setData('content', \rtrim($new->account->name1 . ' ' . $new->account->name2));
|
||||
$request->setData('language', ISO639x1Enum::_EN);
|
||||
$request->setData('type', $accountType);
|
||||
|
|
|
|||
|
|
@ -218,7 +218,8 @@ final class BackendController extends Controller
|
|||
$view->data['accounts'] = AccountAbstractMapper::getAll()
|
||||
->with('l11n')
|
||||
->where('l11n/language', $response->header->l11n->language)
|
||||
->execute();
|
||||
->where('account', null)
|
||||
->executeGetArray();
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
|
@ -253,7 +254,7 @@ final class BackendController extends Controller
|
|||
/** @var \phpOMS\Localization\BaseStringL11n[] $l11nValues */
|
||||
$l11nValues = AccountL11nMapper::getAll()
|
||||
->where('ref', $view->data['account']->id)
|
||||
->execute();
|
||||
->executeGetArray();
|
||||
|
||||
$view->data['l11nValues'] = $l11nValues;
|
||||
|
||||
|
|
@ -359,7 +360,7 @@ final class BackendController extends Controller
|
|||
/** @var \phpOMS\Localization\BaseStringL11n[] $l11nValues */
|
||||
$l11nValues = CostCenterL11nMapper::getAll()
|
||||
->where('ref', $view->data['costcenter']->id)
|
||||
->execute();
|
||||
->executeGetArray();
|
||||
|
||||
$view->data['l11nValues'] = $l11nValues;
|
||||
|
||||
|
|
@ -396,7 +397,7 @@ final class BackendController extends Controller
|
|||
/** @var \phpOMS\Localization\BaseStringL11n[] $l11nValues */
|
||||
$l11nValues = CostObjectL11nMapper::getAll()
|
||||
->where('ref', $view->data['costobject']->id)
|
||||
->execute();
|
||||
->executeGetArray();
|
||||
|
||||
$view->data['l11nValues'] = $l11nValues;
|
||||
|
||||
|
|
@ -427,10 +428,10 @@ final class BackendController extends Controller
|
|||
->limit(25);
|
||||
|
||||
if ($request->getData('ptype') === 'p') {
|
||||
$view->data['costcenter'] = $mapper->where('id', $request->getDataInt('id') ?? 0, '<')
|
||||
$view->data['costcenter'] = $mapper->where('id', $request->getDataInt('offset') ?? 0, '<')
|
||||
->execute();
|
||||
} elseif ($request->getData('ptype') === 'n') {
|
||||
$view->data['costcenter'] = $mapper->where('id', $request->getDataInt('id') ?? 0, '>')
|
||||
$view->data['costcenter'] = $mapper->where('id', $request->getDataInt('offset') ?? 0, '>')
|
||||
->execute();
|
||||
} else {
|
||||
$view->data['costcenter'] = $mapper->where('id', 0, '>')
|
||||
|
|
@ -464,10 +465,10 @@ final class BackendController extends Controller
|
|||
->limit(25);
|
||||
|
||||
if ($request->getData('ptype') === 'p') {
|
||||
$view->data['costobject'] = $mapper->where('id', $request->getDataInt('id') ?? 0, '<')
|
||||
$view->data['costobject'] = $mapper->where('id', $request->getDataInt('offset') ?? 0, '<')
|
||||
->execute();
|
||||
} elseif ($request->getData('ptype') === 'n') {
|
||||
$view->data['costobject'] = $mapper->where('id', $request->getDataInt('id') ?? 0, '>')
|
||||
$view->data['costobject'] = $mapper->where('id', $request->getDataInt('offset') ?? 0, '>')
|
||||
->execute();
|
||||
} else {
|
||||
$view->data['costobject'] = $mapper->where('id', 0, '>')
|
||||
|
|
@ -499,7 +500,7 @@ final class BackendController extends Controller
|
|||
->with('account')
|
||||
->with('mainAddress')
|
||||
->limit(25)
|
||||
->execute();
|
||||
->executeGetArray();
|
||||
|
||||
$view->data['accounts'] = $accounts;
|
||||
|
||||
|
|
@ -528,7 +529,7 @@ final class BackendController extends Controller
|
|||
->with('account')
|
||||
->with('mainAddress')
|
||||
->limit(25)
|
||||
->execute();
|
||||
->executeGetArray();
|
||||
|
||||
$view->data['accounts'] = $accounts;
|
||||
|
||||
|
|
@ -561,13 +562,54 @@ final class BackendController extends Controller
|
|||
$view->setTemplate('/Modules/Accounting/Theme/Backend/personal-view');
|
||||
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1002604001, $request, $response);
|
||||
|
||||
$account = SupplierMapper::get()
|
||||
$view->data['account'] = SupplierMapper::get()
|
||||
->with('account')
|
||||
->with('account/addresses')
|
||||
->with('account/contacts')
|
||||
->with('mainAddress')
|
||||
->with('files')->limit(5, 'files')->sort('files/id', OrderType::DESC)
|
||||
->with('notes')->limit(5, 'notes')->sort('notes/id', OrderType::DESC)
|
||||
->with('attributes')
|
||||
->with('attributes/type')
|
||||
->with('attributes/type/l11n')
|
||||
->with('attributes/value')
|
||||
->where('id', (int) $request->getData('id'))
|
||||
->execute();
|
||||
|
||||
$view->data['account'] = $account;
|
||||
$view->data['fiAccounts'] = AccountAbstractMapper::getAll()
|
||||
->where('account', $view->data['account']->account->id)
|
||||
->executeGetArray();
|
||||
|
||||
$view->data['attributeView'] = new \Modules\Attribute\Theme\Backend\Components\AttributeView($this->app->l11nManager, $request, $response);
|
||||
$view->data['attributeView']->data['default_localization'] = $this->app->l11nServer;
|
||||
|
||||
$view->data['attributeTypes'] = ClientAttributeTypeMapper::getAll()
|
||||
->with('l11n')
|
||||
->where('l11n/language', $response->header->l11n->language)
|
||||
->executeGetArray();
|
||||
|
||||
// Get item profile image
|
||||
// @feature Create a new read mapper function that returns relation models instead of its own model
|
||||
// https://github.com/Karaka-Management/phpOMS/issues/320
|
||||
$query = new Builder($this->app->dbPool->get());
|
||||
$results = $query->selectAs(SupplierMapper::HAS_MANY['files']['external'], 'file')
|
||||
->from(SupplierMapper::TABLE)
|
||||
->leftJoin(SupplierMapper::HAS_MANY['files']['table'])
|
||||
->on(SupplierMapper::HAS_MANY['files']['table'] . '.' . SupplierMapper::HAS_MANY['files']['self'], '=', SupplierMapper::TABLE . '.' . SupplierMapper::PRIMARYFIELD)
|
||||
->leftJoin(MediaMapper::TABLE)
|
||||
->on(SupplierMapper::HAS_MANY['files']['table'] . '.' . SupplierMapper::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(SupplierMapper::HAS_MANY['files']['self'], '=', $view->data['account']->id)
|
||||
->where(MediaTypeMapper::TABLE . '.' . MediaTypeMapper::getColumnByMember('name'), '=', 'supplier_profile_image');
|
||||
|
||||
$view->data['accountImage'] = MediaMapper::get()
|
||||
->with('types')
|
||||
->where('id', $results)
|
||||
->limit(1)
|
||||
->execute();
|
||||
|
||||
$businessStart = UnitAttributeMapper::get()
|
||||
->with('type')
|
||||
|
|
@ -578,25 +620,25 @@ final class BackendController extends Controller
|
|||
|
||||
$view->data['business_start'] = $businessStart->id === 0 ? 1 : $businessStart->value->getValue();
|
||||
|
||||
$view->data['hasBilling'] = $this->app->moduleManager->isActive('Billing');
|
||||
$view->data['audits'] = AuditMapper::getAll()
|
||||
->where('type', StringUtils::intHash(ClientMapper::class))
|
||||
->where('module', 'ClientManagement')
|
||||
->where('ref', (string) $view->data['account']->id)
|
||||
->executeGetArray();
|
||||
|
||||
$view->data['attributeView'] = new \Modules\Attribute\Theme\Backend\Components\AttributeView($this->app->l11nManager, $request, $response);
|
||||
$view->data['attributeView']->data['default_localization'] = $this->app->l11nServer;
|
||||
|
||||
/** @var \Modules\Media\Models\Media[] $files */
|
||||
$files = MediaMapper::getAll()
|
||||
$view->data['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;
|
||||
->on('id', $view->data['account']->id, relation: 'files') // id = item id
|
||||
->executeGetArray();
|
||||
|
||||
$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['address-component'] = new \Modules\Admin\Theme\Backend\Components\AddressEditor\AddressView($this->app->l11nManager, $request, $response);
|
||||
$view->data['contact-component'] = new \Modules\Admin\Theme\Backend\Components\ContactEditor\ContactView($this->app->l11nManager, $request, $response);
|
||||
|
||||
$view->data['hasBilling'] = $this->app->moduleManager->isActive('Billing');
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
|
|
@ -626,28 +668,31 @@ final class BackendController extends Controller
|
|||
$view->setTemplate('/Modules/Accounting/Theme/Backend/personal-view');
|
||||
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1002604001, $request, $response);
|
||||
|
||||
$account = ClientMapper::get()
|
||||
$view->data['account'] = ClientMapper::get()
|
||||
->with('account')
|
||||
->with('account/addresses')
|
||||
->with('account/contacts')
|
||||
->with('mainAddress')
|
||||
->with('files')->limit(5, 'files')->sort('files/id', OrderType::DESC)
|
||||
->with('notes')->limit(5, 'notes')->sort('notes/id', OrderType::DESC)
|
||||
->with('attributes')
|
||||
->with('attributes/type')
|
||||
->with('attributes/type/l11n')
|
||||
->with('attributes/value')
|
||||
->where('id', (int) $request->getData('id'))
|
||||
->execute();
|
||||
|
||||
$view->data['account'] = $account;
|
||||
$view->data['fiAccounts'] = AccountAbstractMapper::getAll()
|
||||
->where('account', $view->data['account']->account->id)
|
||||
->executeGetArray();
|
||||
|
||||
$view->data['attributeView'] = new \Modules\Attribute\Theme\Backend\Components\AttributeView($this->app->l11nManager, $request, $response);
|
||||
$view->data['attributeView']->data['default_localization'] = $this->app->l11nServer;
|
||||
|
||||
/** @var \Modules\Attribute\Models\AttributeType[] $attributeTypes */
|
||||
$attributeTypes = ClientAttributeTypeMapper::getAll()
|
||||
$view->data['attributeTypes'] = ClientAttributeTypeMapper::getAll()
|
||||
->with('l11n')
|
||||
->where('l11n/language', $response->header->l11n->language)
|
||||
->execute();
|
||||
|
||||
$view->data['attributeTypes'] = $attributeTypes;
|
||||
->executeGetArray();
|
||||
|
||||
// Get item profile image
|
||||
// @feature Create a new read mapper function that returns relation models instead of its own model
|
||||
|
|
@ -663,17 +708,15 @@ final class BackendController extends Controller
|
|||
->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(ClientMapper::HAS_MANY['files']['self'], '=', $view->data['account']->id)
|
||||
->where(MediaTypeMapper::TABLE . '.' . MediaTypeMapper::getColumnByMember('name'), '=', 'client_profile_image');
|
||||
|
||||
$accountImage = MediaMapper::get()
|
||||
$view->data['accountImage'] = MediaMapper::get()
|
||||
->with('types')
|
||||
->where('id', $results)
|
||||
->limit(1)
|
||||
->execute();
|
||||
|
||||
$view->data['accountImage'] = $accountImage;
|
||||
|
||||
$businessStart = UnitAttributeMapper::get()
|
||||
->with('type')
|
||||
->with('value')
|
||||
|
|
@ -683,23 +726,17 @@ final class BackendController extends Controller
|
|||
|
||||
$view->data['business_start'] = $businessStart->id === 0 ? 1 : $businessStart->value->getValue();
|
||||
|
||||
/** @var \Modules\Auditor\Models\Audit[] $audits */
|
||||
$audits = AuditMapper::getAll()
|
||||
$view->data['audits'] = AuditMapper::getAll()
|
||||
->where('type', StringUtils::intHash(ClientMapper::class))
|
||||
->where('module', 'ClientManagement')
|
||||
->where('ref', (string) $account->id)
|
||||
->execute();
|
||||
->where('ref', (string) $view->data['account']->id)
|
||||
->executeGetArray();
|
||||
|
||||
$view->data['audits'] = $audits;
|
||||
|
||||
/** @var \Modules\Media\Models\Media[] $files */
|
||||
$files = MediaMapper::getAll()
|
||||
$view->data['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;
|
||||
->on('id', $view->data['account']->id, relation: 'files') // id = item id
|
||||
->executeGetArray();
|
||||
|
||||
$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);
|
||||
|
|
|
|||
|
|
@ -84,4 +84,10 @@ return ['Accounting' => [
|
|||
'Title' => 'Titel',
|
||||
'Net' => 'Netto',
|
||||
'BalanceSheet' => 'Balance Sheet',
|
||||
'QuickAction' => 'Aktion',
|
||||
'Status' => 'Status',
|
||||
'Wire' => 'Überweisung',
|
||||
'Creditcard' => 'Kreditkarte',
|
||||
':status-1' => 'Aktiv',
|
||||
':status-2' => 'Inaktiv',
|
||||
]];
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ return ['Accounting' => [
|
|||
'Creator' => 'Creator',
|
||||
'Credit' => 'Credit',
|
||||
'Debit' => 'Debit',
|
||||
'Description' => '',
|
||||
'Description' => 'Description',
|
||||
'Due' => 'Due',
|
||||
'Entries' => 'Entries',
|
||||
'EntryDate' => 'Entry Date',
|
||||
|
|
@ -84,4 +84,10 @@ return ['Accounting' => [
|
|||
'Title' => 'Title',
|
||||
'Net' => 'Net',
|
||||
'BalanceSheet' => 'Balance Sheet',
|
||||
'QuickAction' => 'Quick Action',
|
||||
'Status' => 'Status',
|
||||
'Wire' => 'Wire',
|
||||
'Creditcard' => 'Creditcard',
|
||||
':status-1' => 'Active',
|
||||
':status-2' => 'Inactive',
|
||||
]];
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@ use phpOMS\Uri\UriFactory;
|
|||
*/
|
||||
$costcenter = $this->data['costcenter'];
|
||||
|
||||
$previous = empty($costcenter) ? '{/base}/accounting/costcenter/list' : '{/base}/accounting/costcenter/list?{?}&id=' . \reset($costcenter)->id . '&ptype=p';
|
||||
$next = empty($costcenter) ? '{/base}/accounting/costcenter/list' : '{/base}/accounting/costcenter/list?{?}&id=' . \end($costcenter)->id . '&ptype=n';
|
||||
$previous = empty($costcenter) ? '{/base}/accounting/costcenter/list' : '{/base}/accounting/costcenter/list?{?}&offset=' . \reset($costcenter)->id . '&ptype=p';
|
||||
$next = empty($costcenter) ? '{/base}/accounting/costcenter/list' : '{/base}/accounting/costcenter/list?{?}&offset=' . \end($costcenter)->id . '&ptype=n';
|
||||
|
||||
echo $this->data['nav']->render(); ?>
|
||||
<div class="row">
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@ use phpOMS\Uri\UriFactory;
|
|||
*/
|
||||
$costobject = $this->data['costobject'];
|
||||
|
||||
$previous = empty($costobject) ? '{/base}/accounting/costobject/list' : '{/base}/accounting/costobject/list?{?}&id=' . \reset($costobject)->id . '&ptype=p';
|
||||
$next = empty($costobject) ? '{/base}/accounting/costobject/list' : '{/base}/accounting/costobject/list?{?}&id=' . \end($costobject)->id . '&ptype=n';
|
||||
$previous = empty($costobject) ? '{/base}/accounting/costobject/list' : '{/base}/accounting/costobject/list?{?}&offset=' . \reset($costobject)->id . '&ptype=p';
|
||||
$next = empty($costobject) ? '{/base}/accounting/costobject/list' : '{/base}/accounting/costobject/list?{?}&offset=' . \end($costobject)->id . '&ptype=n';
|
||||
|
||||
echo $this->data['nav']->render(); ?>
|
||||
<div class="row">
|
||||
|
|
|
|||
|
|
@ -35,9 +35,9 @@ $footerView->setResults(1);
|
|||
<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>
|
||||
<td><span class="input"><button type="button" id="account-start" formaction=""><i class="g-icon">book</i>
|
||||
</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>
|
||||
<td><span class="input"><button type="button" id="contra-start" formaction=""><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="text" id="iCostCenter" min="1" name="id" required></span>
|
||||
|
|
@ -220,5 +220,3 @@ $footerView->setResults(1);
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php include __DIR__ . '/account-list.tpl.php'; ?>
|
||||
|
|
@ -1,479 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package Modules\HumanResourceTimeRecording
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
use Modules\Admin\Models\ContactType;
|
||||
use Modules\Billing\Models\SalesBillMapper;
|
||||
use Modules\Media\Models\NullMedia;
|
||||
use phpOMS\DataStorage\Database\Query\OrderType;
|
||||
use phpOMS\Localization\ISO639Enum;
|
||||
use phpOMS\Stdlib\Base\SmartDateTime;
|
||||
use phpOMS\Uri\UriFactory;
|
||||
|
||||
/** @var \phpOMS\Views\View $this */
|
||||
$account = $this->data['account'] ?? null;
|
||||
|
||||
$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(); ?>
|
||||
<div class="tabview tab-2">
|
||||
<div class="box">
|
||||
<ul class="tab-links">
|
||||
<li><label for="c-tab-1"><?= $this->getHtml('Account'); ?></label>
|
||||
<li><label for="c-tab-2"><?= $this->getHtml('Finance'); ?></label>
|
||||
<li><label for="c-tab-7"><?= $this->getHtml('Payment'); ?></label>
|
||||
<li><label for="c-tab-3"><?= $this->getHtml('Entries'); ?></label>
|
||||
<li><label for="c-tab-4"><?= $this->getHtml('Address'); ?></label>
|
||||
<li><label for="c-tab-5"><?= $this->getHtml('Files'); ?></label>
|
||||
<li><label for="c-tab-6"><?= $this->getHtml('Notes'); ?></label>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="tab-content">
|
||||
<input type="radio" id="c-tab-1" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-1' ? ' checked' : ''; ?>>
|
||||
<div class="tab">
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-lg-3 last-lg">
|
||||
<div class="box">
|
||||
<?php if(true) : ?>
|
||||
<a class="button" href="<?= UriFactory::build('{/base}/sales/bill/create?account=' . $account->id); ?>"><?= $this->getHtml('CreateBill', 'Billing'); ?></a>
|
||||
<?php endif; ?>
|
||||
<?php if (false) : ?>
|
||||
<a class="button"><?= $this->getHtml('ViewAccount', 'Accounting'); ?></a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<section class="portlet">
|
||||
<form>
|
||||
<div class="portlet-body">
|
||||
<div class="form-group">
|
||||
<label for="iId"><?= $this->getHtml('ID', '0', '0'); ?></label>
|
||||
<span class="input"><button type="button" formaction=""><i class="g-icon">book</i></button><input type="number" id="iId" min="1" name="id" value="<?= $this->printHtml($account->number); ?>" disabled></span>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iName1"><?= $this->getHtml('Name1'); ?></label>
|
||||
<input type="text" id="iName1" name="name1" value="<?= $this->printHtml($account->account->name1); ?>" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iName2"><?= $this->getHtml('Name2'); ?></label>
|
||||
<input type="text" id="iName2" name="name2" value="<?= $this->printHtml($account->account->name2); ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iName3"><?= $this->getHtml('Name3'); ?></label>
|
||||
<input type="text" id="iName3" name="name3" value="<?= $this->printHtml($account->account->name3); ?>">
|
||||
</div>
|
||||
</div>
|
||||
<div class="portlet-foot">
|
||||
<input type="submit" value="<?= $this->getHtml('Save', '0', '0'); ?>" name="save-account-profile"> <input type="submit" value="<?= $this->getHtml('Delete', '0', '0'); ?>" name="delete-account-profile">
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
|
||||
<section class="portlet">
|
||||
<div class="portlet-head">
|
||||
<?= $this->getHtml('Contact'); ?>
|
||||
<a class="end-xs" href=""><i class="g-icon btn">mail</i></a>
|
||||
</div>
|
||||
<div class="portlet-body">
|
||||
<div class="form-group">
|
||||
<label for="iPhone"><?= $this->getHtml('Phone'); ?></label>
|
||||
<input type="text" id="iPhone" name="name1" value="<?= $this->printHtml($account->account->getContactByType(ContactType::PHONE)->content); ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iEmail"><?= $this->getHtml('Email'); ?></label>
|
||||
<input type="text" id="iEmail" name="name1" value="<?= $this->printHtml($account->account->getContactByType(ContactType::EMAIL)->content); ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iWebsite"><?= $this->getHtml('Website'); ?></label>
|
||||
<input type="text" id="iWebsite" name="name1" value="<?= $this->printHtml($account->account->getContactByType(ContactType::WEBSITE)->content); ?>">
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="portlet map-small">
|
||||
<div class="portlet-head">
|
||||
<?= $this->getHtml('Address'); ?>
|
||||
<span class="clickPopup end-xs">
|
||||
<label for="addressDropdown"><i class="g-icon btn">print</i></label>
|
||||
<input id="addressDropdown" name="addressDropdown" type="checkbox">
|
||||
<div class="popup">
|
||||
<ul>
|
||||
<li>
|
||||
<input id="id1" type="checkbox">
|
||||
<ul>
|
||||
<li>
|
||||
<label for="id1">
|
||||
<a href="" class="button">Word</a>
|
||||
<span></span>
|
||||
<i class="g-icon expand">chevron_right</i>
|
||||
</label>
|
||||
<li>Letter
|
||||
</ul>
|
||||
<li><label class="button cancel" for="addressDropdown">Cancel</label>
|
||||
</ul>
|
||||
</div>
|
||||
</span>
|
||||
</div>
|
||||
<div class="portlet-body">
|
||||
<?php if (!empty($account->mainAddress->fao)) : ?>
|
||||
<div class="form-group">
|
||||
<label for="iFAO"><?= $this->getHtml('FAO'); ?></label>
|
||||
<input type="text" id="iFAO" name="fao" value="<?= $this->printHtml($account->mainAddress->fao); ?>">
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iAddress"><?= $this->getHtml('Address'); ?></label>
|
||||
<input type="text" id="iAddress" name="address" value="<?= $this->printHtml($account->mainAddress->address); ?>" required>
|
||||
</div>
|
||||
|
||||
<?php if (!empty($account->mainAddress->addressAddition)) : ?>
|
||||
<div class="form-group">
|
||||
<label for="iAddition"><?= $this->getHtml('Addition'); ?></label>
|
||||
<input type="text" id="iAddition" name="addition" value="<?= $this->printHtml($account->mainAddress->addressAddition); ?>">
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iPostal"><?= $this->getHtml('Postal'); ?></label>
|
||||
<input type="text" id="iPostal" name="postal" value="<?= $this->printHtml($account->mainAddress->postal); ?>" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iCity"><?= $this->getHtml('City'); ?></label>
|
||||
<input type="text" id="iCity" name="city" value="<?= $this->printHtml($account->mainAddress->city); ?>" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iCountry"><?= $this->getHtml('Country'); ?></label>
|
||||
<select id="iCountry" name="country">
|
||||
<?php foreach ($countryCodes as $code3 => $code2) : ?>
|
||||
<option value="<?= $this->printHtml($code2); ?>"<?= $this->printHtml($code2 === $account->mainAddress->country ? ' selected' : ''); ?>><?= $this->printHtml($countries[$code3]); ?>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iClientMap"><?= $this->getHtml('Map'); ?></label>
|
||||
<div id="iClientMap" class="map" data-lat="<?= $account->mainAddress->lat; ?>" data-lon="<?= $account->mainAddress->lon; ?>"></div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="portlet">
|
||||
<div class="portlet-body">
|
||||
<img alt="<?= $this->printHtml($accountImage->name); ?>" width="100%" loading="lazy" class="item-image"
|
||||
src="<?= $accountImage->id === 0
|
||||
? 'Web/Backend/img/logo_grey.png'
|
||||
: UriFactory::build($accountImage->getPath()); ?>">
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="portlet hl-4">
|
||||
<div class="portlet-body">
|
||||
<textarea class="undecorated"><?= $this->printHtml($account->info); ?></textarea>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
<div class="col-xs-12 col-lg-9 plain-grid">
|
||||
<?php if (!empty($account->notes) && ($warning = $account->getEditorDocByTypeName('account_backend_warning'))->id !== 0) : ?>
|
||||
<!-- If note warning exists -->
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<section class="portlet hl-1">
|
||||
<div class="portlet-body"><?= $this->printHtml($warning->plain); ?></div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($this->data['hasBilling']) : ?>
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-lg-4">
|
||||
<section class="portlet hl-7">
|
||||
<div class="portlet-body">
|
||||
<table class="wf-100">
|
||||
<tr><td><?= $this->getHtml('YTDSales'); ?>:
|
||||
<td><?= $this->getCurrency(SalesBillMapper::getClientNetSales($account->id, SmartDateTime::startOfYear($this->data['business_start']), new \DateTime('now')), format: 'medium'); ?>
|
||||
<tr><td><?= $this->getHtml('MTDSales'); ?>:
|
||||
<td><?= $this->getCurrency(SalesBillMapper::getClientNetSales($account->id, SmartDateTime::startOfMonth(), new \DateTime('now')), format: 'medium'); ?>
|
||||
<tr><td><?= $this->getHtml('CLV'); ?>:
|
||||
<td><?= $this->getCurrency(SalesBillMapper::getCLVHistoric($account->id), format: 'medium'); ?>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<div class="col-xs-12 col-lg-4">
|
||||
<section class="portlet hl-2">
|
||||
<div class="portlet-body">
|
||||
<table class="wf-100">
|
||||
<tr><td><?= $this->getHtml('LastContact'); ?>:
|
||||
<td><?= SalesBillMapper::getClientLastOrder($account->id)?->format('Y-m-d'); ?>
|
||||
<tr><td><?= $this->getHtml('LastOrder'); ?>:
|
||||
<td><?= SalesBillMapper::getClientLastOrder($account->id)?->format('Y-m-d'); ?>
|
||||
<tr><td><?= $this->getHtml('Created'); ?>:
|
||||
<td><?= $account->createdAt->format('Y-m-d H:i'); ?>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<div class="col-xs-12 col-lg-4">
|
||||
<section class="portlet hl-3">
|
||||
<div class="portlet-body">
|
||||
<table class="wf-100">
|
||||
<tr><td><?= $this->getHtml('DSO'); ?>:
|
||||
<td>TBD
|
||||
<tr><td><?= $this->getHtml('Due'); ?>:
|
||||
<td>TBD
|
||||
<tr><td><?= $this->getHtml('Balance'); ?>:
|
||||
<td>TBD
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-md-6">
|
||||
<section class="portlet">
|
||||
<div class="portlet-head"><?= $this->getHtml('Notes'); ?></div>
|
||||
<div class="slider">
|
||||
<table id="iNotesItemList" class="default sticky">
|
||||
<thead>
|
||||
<tr>
|
||||
<td class="wf-100"><?= $this->getHtml('Title'); ?>
|
||||
<td><?= $this->getHtml('CreatedAt'); ?>
|
||||
<tbody>
|
||||
<?php foreach ($account->notes as $note) :
|
||||
$url = UriFactory::build('{/base}/editor/view?{?}&id=' . $note->id);
|
||||
?>
|
||||
<tr data-href="<?= $url; ?>">
|
||||
<td><a href="<?= $url; ?>"><?= $note->title; ?></a>
|
||||
<td><a href="<?= $url; ?>"><?= $note->createdAt->format('Y-m-d'); ?></a>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<div class="col-xs-12 col-md-6">
|
||||
<section class="portlet">
|
||||
<div class="portlet-head"><?= $this->getHtml('Documents'); ?></div>
|
||||
<div class="slider">
|
||||
<table id="iFilesClientList" class="default sticky">
|
||||
<thead>
|
||||
<tr>
|
||||
<td class="wf-100"><?= $this->getHtml('Title'); ?>
|
||||
<td>
|
||||
<td><?= $this->getHtml('CreatedAt'); ?>
|
||||
<tbody>
|
||||
<?php foreach ($account->files as $file) :
|
||||
$url = UriFactory::build('{/base}/media/view?{?}&id=' . $file->id);
|
||||
?>
|
||||
<tr data-href="<?= $url; ?>">
|
||||
<td><a href="<?= $url; ?>"><?= $file->name; ?></a>
|
||||
<td><a href="<?= $url; ?>"><?= $file->extension; ?></a>
|
||||
<td><a href="<?= $url; ?>"><?= $file->createdAt->format('Y-m-d'); ?></a>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if ($this->data['hasBilling']) : ?>
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<section class="portlet">
|
||||
<div class="portlet-head"><?= $this->getHtml('RecentInvoices'); ?></div>
|
||||
<table id="iSalesItemList" class="default sticky">
|
||||
<thead>
|
||||
<tr>
|
||||
<td><?= $this->getHtml('Number'); ?>
|
||||
<td><?= $this->getHtml('Type'); ?>
|
||||
<td class="wf-100"><?= $this->getHtml('Name'); ?>
|
||||
<td><?= $this->getHtml('Net'); ?>
|
||||
<td><?= $this->getHtml('Date'); ?>
|
||||
<tbody>
|
||||
<?php
|
||||
$newestInvoices = SalesBillMapper::getAll()
|
||||
->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);
|
||||
?>
|
||||
<tr data-href="<?= $url; ?>">
|
||||
<td><a href="<?= $url; ?>"><?= $invoice->getNumber(); ?></a>
|
||||
<td><a href="<?= $url; ?>"><?= $invoice->type->getL11n(); ?></a>
|
||||
<td><a href="<?= $url; ?>"><?= $invoice->billTo; ?></a>
|
||||
<td><a href="<?= $url; ?>"><?= $this->getCurrency($invoice->netSales); ?></a>
|
||||
<td><a href="<?= $url; ?>"><?= $invoice->createdAt->format('Y-m-d'); ?></a>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input type="radio" id="c-tab-2" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-2' ? ' checked' : ''; ?>>
|
||||
<div class="tab">
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-sm-6">
|
||||
<section class="portlet">
|
||||
<div class="portlet-head"><?= $this->getHtml('Account'); ?></div>
|
||||
<div class="portlet-body">
|
||||
<div class="form-group">
|
||||
<label for="iBalanceSheet"><?= $this->getHtml('BalanceSheet'); ?></label>
|
||||
<input id="iBalanceSheet" type="text">
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<div class="col-xs-12 col-sm-6">
|
||||
<section class="portlet">
|
||||
<div class="portlet-head"><?= $this->getHtml('Accounts'); ?></div>
|
||||
<div class="slider">
|
||||
<table class="default sticky">
|
||||
<thead>
|
||||
<tr>
|
||||
<td>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input type="radio" id="c-tab-7" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-7' ? ' checked' : ''; ?>>
|
||||
<div class="tab">
|
||||
<div class="row">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input type="radio" id="c-tab-3" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-3' ? ' checked' : ''; ?>>
|
||||
<div class="tab">
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-lg-3 last-lg">
|
||||
<section class="portlet">
|
||||
<div class="portlet-head"><?= $this->getHtml('QuickAction'); ?></div>
|
||||
<div class="portlet-body">
|
||||
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<div class="col-xs-12 col-lg-9 plain-grid">
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<section class="portlet col-simple" style="height: 350px;">
|
||||
<div class="portlet-head top-xs"><?= $this->getHtml('Open'); ?></div>
|
||||
<table id="iSalesItemList" class="default sticky">
|
||||
<thead>
|
||||
<tr>
|
||||
<td>
|
||||
<td><?= $this->getHtml('Info'); ?>
|
||||
<td><?= $this->getHtml('Date'); ?>
|
||||
<td><?= $this->getHtml('Credit'); ?>
|
||||
<td><?= $this->getHtml('Debit'); ?>
|
||||
<td><?= $this->getHtml('Number'); ?>
|
||||
<td class="wf-100"><?= $this->getHtml('Text'); ?>
|
||||
<td><?= $this->getHtml('Due'); ?>
|
||||
<td><?= $this->getHtml('Payment'); ?>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td colspan="9" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
|
||||
</table>
|
||||
<div class="portlet-body col-xs"></div>
|
||||
<div class="portlet-foot bottom-xs">
|
||||
<?= $this->getHtml('Total'); ?>: 0.00
|
||||
<?= $this->getHtml('Due'); ?>: 0.00
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<section class="portlet col-simple" style="height: 350px;">
|
||||
<div class="portlet-head top-xs"><?= $this->getHtml('Total'); ?></div>
|
||||
<table id="iSalesItemList" class="default sticky">
|
||||
<thead>
|
||||
<tr>
|
||||
<td><?= $this->getHtml('Info'); ?>
|
||||
<td><?= $this->getHtml('Date'); ?>
|
||||
<td><?= $this->getHtml('Credit'); ?>
|
||||
<td><?= $this->getHtml('Debit'); ?>
|
||||
<td><?= $this->getHtml('Number'); ?>
|
||||
<td class="wf-100"><?= $this->getHtml('Text'); ?>
|
||||
<td><?= $this->getHtml('Due'); ?>
|
||||
<td><?= $this->getHtml('Payment'); ?>
|
||||
<td><?= $this->getHtml('Balanced'); ?>
|
||||
<td><?= $this->getHtml('Balance'); ?>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td colspan="10" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
|
||||
</table>
|
||||
<div class="portlet-body col-xs"></div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input type="radio" id="c-tab-4" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-4' ? ' checked' : ''; ?>>
|
||||
<div class="tab">
|
||||
<?= $this->data['contact-component']->render('account-contact', 'contacts', $account->account->contacts); ?>
|
||||
<?= $this->data['address-component']->render('account-address', 'addresses', $account->account->addresses); ?>
|
||||
</div>
|
||||
|
||||
<input type="radio" id="c-tab-5" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-5' ? ' checked' : ''; ?>>
|
||||
<div class="tab col-simple">
|
||||
<?= $this->data['media-upload']->render('account-file', 'files', '', $account->files); ?>
|
||||
</div>
|
||||
|
||||
<input type="radio" id="c-tab-6" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-6' ? ' checked' : ''; ?>>
|
||||
<div class="tab col-simple">
|
||||
<?= $this->data['note']->render('account-note', 'notes', $account->notes); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -12,8 +12,12 @@
|
|||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
use Modules\Accounting\Models\AccountStatus;
|
||||
use Modules\Admin\Models\ContactType;
|
||||
use Modules\Billing\Models\BillMapper;
|
||||
use Modules\Billing\Models\PurchaseBillMapper;
|
||||
use Modules\Billing\Models\SalesBillMapper;
|
||||
use Modules\ClientManagement\Models\Client;
|
||||
use Modules\Media\Models\NullMedia;
|
||||
use phpOMS\DataStorage\Database\Query\OrderType;
|
||||
use phpOMS\Localization\ISO639Enum;
|
||||
|
|
@ -22,6 +26,9 @@ use phpOMS\Uri\UriFactory;
|
|||
|
||||
/** @var \phpOMS\Views\View $this */
|
||||
$account = $this->data['account'] ?? null;
|
||||
$isNew = ($account?->id ?? 0) === 0;
|
||||
|
||||
$isClient = $account instanceof Client;
|
||||
|
||||
$accountImage = $this->getData('accountImage') ?? new NullMedia();
|
||||
|
||||
|
|
@ -31,8 +38,11 @@ $countryCodes = \phpOMS\Localization\ISO3166TwoEnum::getConstants();
|
|||
$countries = \phpOMS\Localization\ISO3166NameEnum::getConstants();
|
||||
$languages = ISO639Enum::getConstants();
|
||||
|
||||
$accountStatus = AccountStatus::getConstants();
|
||||
|
||||
echo $this->data['nav']->render(); ?>
|
||||
<div class="tabview tab-2">
|
||||
<?php if (!$isNew) : ?>
|
||||
<div class="box">
|
||||
<ul class="tab-links">
|
||||
<li><label for="c-tab-1"><?= $this->getHtml('Account'); ?></label>
|
||||
|
|
@ -44,26 +54,27 @@ echo $this->data['nav']->render(); ?>
|
|||
<li><label for="c-tab-6"><?= $this->getHtml('Notes'); ?></label>
|
||||
</ul>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="tab-content">
|
||||
<input type="radio" id="c-tab-1" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-1' ? ' checked' : ''; ?>>
|
||||
<input type="radio" id="c-tab-1" name="tabular-2"<?= $isNew || $this->request->uri->fragment === 'c-tab-1' ? ' checked' : ''; ?>>
|
||||
<div class="tab">
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-lg-3 last-lg">
|
||||
<div class="box">
|
||||
<?php if(true) : ?>
|
||||
<a class="button" href="<?= UriFactory::build('{/base}/sales/bill/create?account=' . $account->id); ?>"><?= $this->getHtml('CreateBill', 'Billing'); ?></a>
|
||||
<?php endif; ?>
|
||||
<?php if (false) : ?>
|
||||
<a class="button"><?= $this->getHtml('ViewAccount', 'Accounting'); ?></a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<section class="portlet">
|
||||
<form>
|
||||
<form id="accountForm" method="<?= $isNew ? 'PUT' : 'POST'; ?>" action="<?= UriFactory::build('{/api}accounting/profile?csrf={$CSRF}'); ?>">
|
||||
<div class="portlet-body">
|
||||
<div class="form-group">
|
||||
<div class="form-group">
|
||||
<label for="iId"><?= $this->getHtml('ID', '0', '0'); ?></label>
|
||||
<span class="input"><button type="button" formaction=""><i class="g-icon">book</i></button><input type="number" id="iId" min="1" name="id" value="<?= $this->printHtml($account->number); ?>" disabled></span>
|
||||
<span class="input"><button type="button" formaction=""><i class="g-icon">book</i></button><input type="text" id="iId" min="1" name="id" value="<?= $this->printHtml($account->number); ?>"<?= $isNew ? ' required' : ' disabled'; ?>></span>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iStatus"><?= $this->getHtml('Status'); ?></label>
|
||||
<select id="iStatus" name="status">
|
||||
<?php foreach ($accountStatus as $status) : ?>
|
||||
<option value="<?= $status; ?>"<?= $account->status === $status ? ' selected': ''; ?>><?= $this->getHtml(':status-' . $status); ?>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
|
|
@ -82,7 +93,12 @@ echo $this->data['nav']->render(); ?>
|
|||
</div>
|
||||
</div>
|
||||
<div class="portlet-foot">
|
||||
<input type="submit" value="<?= $this->getHtml('Save', '0', '0'); ?>" name="save-account-profile"> <input type="submit" value="<?= $this->getHtml('Delete', '0', '0'); ?>" name="delete-account-profile">
|
||||
<?php if ($isNew) : ?>
|
||||
<input type="submit" value="<?= $this->getHtml('Create', '0', '0'); ?>" name="create-account">
|
||||
<?php else : ?>
|
||||
<input type="submit" value="<?= $this->getHtml('Save', '0', '0'); ?>" name="save-account-profile">
|
||||
<input class="cancel end-xs" type="submit" value="<?= $this->getHtml('Delete', '0', '0'); ?>" name="delete-account-profile">
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
|
|
@ -95,17 +111,17 @@ echo $this->data['nav']->render(); ?>
|
|||
<div class="portlet-body">
|
||||
<div class="form-group">
|
||||
<label for="iPhone"><?= $this->getHtml('Phone'); ?></label>
|
||||
<input type="text" id="iPhone" name="name1" value="<?= $this->printHtml($account->account->getContactByType(ContactType::PHONE)->content); ?>">
|
||||
<input type="text" id="iPhone" form="accountForm" name="phone" value="<?= $this->printHtml($account->account->getContactByType(ContactType::PHONE)->content); ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iEmail"><?= $this->getHtml('Email'); ?></label>
|
||||
<input type="text" id="iEmail" name="name1" value="<?= $this->printHtml($account->account->getContactByType(ContactType::EMAIL)->content); ?>">
|
||||
<input type="text" id="iEmail" form="accountForm" name="email" value="<?= $this->printHtml($account->account->getContactByType(ContactType::EMAIL)->content); ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iWebsite"><?= $this->getHtml('Website'); ?></label>
|
||||
<input type="text" id="iWebsite" name="name1" value="<?= $this->printHtml($account->account->getContactByType(ContactType::WEBSITE)->content); ?>">
|
||||
<input type="text" id="iWebsite" form="accountForm" name="website" value="<?= $this->printHtml($account->account->getContactByType(ContactType::WEBSITE)->content); ?>">
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
|
@ -138,48 +154,51 @@ echo $this->data['nav']->render(); ?>
|
|||
<?php if (!empty($account->mainAddress->fao)) : ?>
|
||||
<div class="form-group">
|
||||
<label for="iFAO"><?= $this->getHtml('FAO'); ?></label>
|
||||
<input type="text" id="iFAO" name="fao" value="<?= $this->printHtml($account->mainAddress->fao); ?>">
|
||||
<input type="text" id="iFAO" form="accountForm" name="fao" value="<?= $this->printHtml($account->mainAddress->fao); ?>">
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iAddress"><?= $this->getHtml('Address'); ?></label>
|
||||
<input type="text" id="iAddress" name="address" value="<?= $this->printHtml($account->mainAddress->address); ?>" required>
|
||||
<input type="text" id="iAddress" form="accountForm" name="address" value="<?= $this->printHtml($account->mainAddress->address); ?>" required>
|
||||
</div>
|
||||
|
||||
<?php if (!empty($account->mainAddress->addressAddition)) : ?>
|
||||
<div class="form-group">
|
||||
<label for="iAddition"><?= $this->getHtml('Addition'); ?></label>
|
||||
<input type="text" id="iAddition" name="addition" value="<?= $this->printHtml($account->mainAddress->addressAddition); ?>">
|
||||
<input type="text" id="iAddition" form="accountForm" name="addition" value="<?= $this->printHtml($account->mainAddress->addressAddition); ?>">
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iPostal"><?= $this->getHtml('Postal'); ?></label>
|
||||
<input type="text" id="iPostal" name="postal" value="<?= $this->printHtml($account->mainAddress->postal); ?>" required>
|
||||
<input type="text" id="iPostal" form="accountForm" name="postal" value="<?= $this->printHtml($account->mainAddress->postal); ?>" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iCity"><?= $this->getHtml('City'); ?></label>
|
||||
<input type="text" id="iCity" name="city" value="<?= $this->printHtml($account->mainAddress->city); ?>" required>
|
||||
<input type="text" id="iCity" form="accountForm" name="city" value="<?= $this->printHtml($account->mainAddress->city); ?>" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iCountry"><?= $this->getHtml('Country'); ?></label>
|
||||
<select id="iCountry" name="country">
|
||||
<select id="iCountry" form="accountForm" name="country">
|
||||
<?php foreach ($countryCodes as $code3 => $code2) : ?>
|
||||
<option value="<?= $this->printHtml($code2); ?>"<?= $this->printHtml($code2 === $account->mainAddress->country ? ' selected' : ''); ?>><?= $this->printHtml($countries[$code3]); ?>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<?php if (!$isNew) : ?>
|
||||
<div class="form-group">
|
||||
<label for="iClientMap"><?= $this->getHtml('Map'); ?></label>
|
||||
<div id="iClientMap" class="map" data-lat="<?= $account->mainAddress->lat; ?>" data-lon="<?= $account->mainAddress->lon; ?>"></div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<?php if (!$isNew) : ?>
|
||||
<section class="portlet">
|
||||
<div class="portlet-body">
|
||||
<img alt="<?= $this->printHtml($accountImage->name); ?>" width="100%" loading="lazy" class="item-image"
|
||||
|
|
@ -194,7 +213,10 @@ echo $this->data['nav']->render(); ?>
|
|||
<textarea class="undecorated"><?= $this->printHtml($account->info); ?></textarea>
|
||||
</div>
|
||||
</section>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<?php if (!$isNew) : ?>
|
||||
<div class="col-xs-12 col-lg-9 plain-grid">
|
||||
<?php if (!empty($account->notes) && ($warning = $account->getEditorDocByTypeName('account_backend_warning'))->id !== 0) : ?>
|
||||
<!-- If note warning exists -->
|
||||
|
|
@ -214,11 +236,20 @@ echo $this->data['nav']->render(); ?>
|
|||
<div class="portlet-body">
|
||||
<table class="wf-100">
|
||||
<tr><td><?= $this->getHtml('YTDSales'); ?>:
|
||||
<td><?= $this->getCurrency(SalesBillMapper::getClientNetSales($account->id, SmartDateTime::startOfYear($this->data['business_start']), new \DateTime('now')), format: 'medium'); ?>
|
||||
<td><?= $isClient
|
||||
? SalesBillMapper::getClientNetSales($account->id, SmartDateTime::startOfYear($this->data['business_start']), new \DateTime('now'))->getAmount()
|
||||
: PurchaseBillMapper::getSupplierNetSales($account->id, SmartDateTime::startOfYear($this->data['business_start']), new \DateTime('now'))->getAmount();
|
||||
?>
|
||||
<tr><td><?= $this->getHtml('MTDSales'); ?>:
|
||||
<td><?= $this->getCurrency(SalesBillMapper::getClientNetSales($account->id, SmartDateTime::startOfMonth(), new \DateTime('now')), format: 'medium'); ?>
|
||||
<td><?= $isClient
|
||||
? SalesBillMapper::getClientNetSales($account->id, SmartDateTime::startOfMonth(), new \DateTime('now'))->getAmount()
|
||||
: PurchaseBillMapper::getSupplierNetSales($account->id, SmartDateTime::startOfMonth(), new \DateTime('now'))->getAmount();
|
||||
?>
|
||||
<tr><td><?= $this->getHtml('CLV'); ?>:
|
||||
<td><?= $this->getCurrency(SalesBillMapper::getCLVHistoric($account->id), format: 'medium'); ?>
|
||||
<td><?= $isClient
|
||||
? SalesBillMapper::getCLVHistoric($account->id)->getAmount()
|
||||
: PurchaseBillMapper::getSLVHistoric($account->id)->getAmount();
|
||||
?>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
|
|
@ -229,9 +260,15 @@ echo $this->data['nav']->render(); ?>
|
|||
<div class="portlet-body">
|
||||
<table class="wf-100">
|
||||
<tr><td><?= $this->getHtml('LastContact'); ?>:
|
||||
<td><?= SalesBillMapper::getClientLastOrder($account->id)?->format('Y-m-d'); ?>
|
||||
<td><?= $isClient
|
||||
? SalesBillMapper::getClientLastOrder($account->id)?->format('Y-m-d')
|
||||
: PurchaseBillMapper::getSupplierLastOrder($account->id)?->format('Y-m-d');
|
||||
?>
|
||||
<tr><td><?= $this->getHtml('LastOrder'); ?>:
|
||||
<td><?= SalesBillMapper::getClientLastOrder($account->id)?->format('Y-m-d'); ?>
|
||||
<td><?= $isClient
|
||||
? SalesBillMapper::getClientLastOrder($account->id)?->format('Y-m-d')
|
||||
: PurchaseBillMapper::getSupplierLastOrder($account->id)?->format('Y-m-d');
|
||||
?>
|
||||
<tr><td><?= $this->getHtml('Created'); ?>:
|
||||
<td><?= $account->createdAt->format('Y-m-d H:i'); ?>
|
||||
</table>
|
||||
|
|
@ -267,13 +304,19 @@ echo $this->data['nav']->render(); ?>
|
|||
<td class="wf-100"><?= $this->getHtml('Title'); ?>
|
||||
<td><?= $this->getHtml('CreatedAt'); ?>
|
||||
<tbody>
|
||||
<?php foreach ($account->notes as $note) :
|
||||
<?php
|
||||
$count = 0;
|
||||
foreach ($account->notes as $note) :
|
||||
++$count;
|
||||
$url = UriFactory::build('{/base}/editor/view?{?}&id=' . $note->id);
|
||||
?>
|
||||
?>
|
||||
<tr data-href="<?= $url; ?>">
|
||||
<td><a href="<?= $url; ?>"><?= $note->title; ?></a>
|
||||
<td><a href="<?= $url; ?>"><?= $note->createdAt->format('Y-m-d'); ?></a>
|
||||
<?php endforeach; ?>
|
||||
<?php if ($count === 0) : ?>
|
||||
<tr><td colspan="3" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
|
||||
<?php endif; ?>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
|
|
@ -290,14 +333,20 @@ echo $this->data['nav']->render(); ?>
|
|||
<td>
|
||||
<td><?= $this->getHtml('CreatedAt'); ?>
|
||||
<tbody>
|
||||
<?php foreach ($account->files as $file) :
|
||||
<?php
|
||||
$count = 0;
|
||||
foreach ($account->files as $file) :
|
||||
++$count;
|
||||
$url = UriFactory::build('{/base}/media/view?{?}&id=' . $file->id);
|
||||
?>
|
||||
?>
|
||||
<tr data-href="<?= $url; ?>">
|
||||
<td><a href="<?= $url; ?>"><?= $file->name; ?></a>
|
||||
<td><a href="<?= $url; ?>"><?= $file->extension; ?></a>
|
||||
<td><a href="<?= $url; ?>"><?= $file->createdAt->format('Y-m-d'); ?></a>
|
||||
<?php endforeach; ?>
|
||||
<?php if ($count === 0) : ?>
|
||||
<tr><td colspan="3" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
|
||||
<?php endif; ?>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
|
|
@ -319,7 +368,7 @@ echo $this->data['nav']->render(); ?>
|
|||
<td><?= $this->getHtml('Date'); ?>
|
||||
<tbody>
|
||||
<?php
|
||||
$newestInvoices = SalesBillMapper::getAll()
|
||||
$newestInvoices = BillMapper::getAll()
|
||||
->with('type')
|
||||
->with('type/l11n')
|
||||
->with('account')
|
||||
|
|
@ -327,11 +376,11 @@ echo $this->data['nav']->render(); ?>
|
|||
->where('type/l11n/language', $this->response->header->l11n->language)
|
||||
->sort('id', OrderType::DESC)
|
||||
->limit(5)
|
||||
->execute();
|
||||
->executeGetArray();
|
||||
|
||||
/** @var \Modules\Billing\Models\Bill $invoice */
|
||||
foreach ($newestInvoices as $invoice) :
|
||||
$url = UriFactory::build('{/base}/sales/bill?{?}&id=' . $invoice->id);
|
||||
$url = UriFactory::build('{/base}/sales/bill/view?{?}&id=' . $invoice->id);
|
||||
?>
|
||||
<tr data-href="<?= $url; ?>">
|
||||
<td><a href="<?= $url; ?>"><?= $invoice->getNumber(); ?></a>
|
||||
|
|
@ -346,9 +395,11 @@ echo $this->data['nav']->render(); ?>
|
|||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if (!$isNew) : ?>
|
||||
<input type="radio" id="c-tab-2" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-2' ? ' checked' : ''; ?>>
|
||||
<div class="tab">
|
||||
<div class="row">
|
||||
|
|
@ -373,8 +424,18 @@ echo $this->data['nav']->render(); ?>
|
|||
<tr>
|
||||
<td>
|
||||
<tbody>
|
||||
<?php
|
||||
$c = 0;
|
||||
foreach ($this->data['fiAccounts'] as $fiAccount) :
|
||||
++$c;
|
||||
?>
|
||||
<tr>
|
||||
<td>
|
||||
<td><?= $this->printHtml($fiAccount->code); ?>
|
||||
<?php endforeach; ?>
|
||||
<?php if ($c === 0) : ?>
|
||||
<tr>
|
||||
<td colspan="1" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
|
||||
<?php endif; ?>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
|
|
@ -384,8 +445,24 @@ echo $this->data['nav']->render(); ?>
|
|||
|
||||
<input type="radio" id="c-tab-7" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-7' ? ' checked' : ''; ?>>
|
||||
<div class="tab">
|
||||
<div class="row">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-md-6 col-lg-4">
|
||||
<section class="portlet">
|
||||
<div class="portlet-head"><?= $this->getHtml('Payment'); ?></div>
|
||||
<div class="portlet-body">
|
||||
<form>
|
||||
<table class="layout wf-100">
|
||||
<tr><td><label for="iACType"><?= $this->getHtml('Type'); ?></label>
|
||||
<tr><td><select id="iACType" name="actype">
|
||||
<option><?= $this->getHtml('Wire'); ?>
|
||||
<option><?= $this->getHtml('Creditcard'); ?>
|
||||
</select>
|
||||
<tr><td colspan="2"><input type="submit" value="<?= $this->getHtml('Add', '0', '0'); ?>">
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -396,7 +473,7 @@ echo $this->data['nav']->render(); ?>
|
|||
<section class="portlet">
|
||||
<div class="portlet-head"><?= $this->getHtml('QuickAction'); ?></div>
|
||||
<div class="portlet-body">
|
||||
|
||||
TBD
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
|
@ -475,5 +552,6 @@ echo $this->data['nav']->render(); ?>
|
|||
<div class="tab col-simple">
|
||||
<?= $this->data['note']->render('account-note', 'notes', $account->notes); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -28,10 +28,10 @@ final class CostCenterMapperTest extends \PHPUnit\Framework\TestCase
|
|||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
public function testCR() : void
|
||||
{
|
||||
$costcenter = new CostCenter();
|
||||
$costcenter->code = '123';
|
||||
$costcenter->l11n = new BaseStringL11n();
|
||||
$costcenter->l11n->name = 'Test CostCenter';
|
||||
$costcenter = new CostCenter();
|
||||
$costcenter->code = '123';
|
||||
$costcenter->l11n = new BaseStringL11n();
|
||||
$costcenter->l11n->name = 'Test CostCenter';
|
||||
$costcenter->l11n->content = 'Test description';
|
||||
|
||||
$id = CostCenterMapper::create()->execute($costcenter);
|
||||
|
|
|
|||
|
|
@ -28,10 +28,10 @@ final class CostObjectMapperTest extends \PHPUnit\Framework\TestCase
|
|||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
public function testCR() : void
|
||||
{
|
||||
$costobject = new CostObject();
|
||||
$costobject->code = '123';
|
||||
$costobject->l11n = new BaseStringL11n();
|
||||
$costobject->l11n->name = 'Test CostObject';
|
||||
$costobject = new CostObject();
|
||||
$costobject->code = '123';
|
||||
$costobject->l11n = new BaseStringL11n();
|
||||
$costobject->l11n->name = 'Test CostObject';
|
||||
$costobject->l11n->content = 'Test description';
|
||||
|
||||
$id = CostObjectMapper::create()->execute($costobject);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user