make id public, organigram impl. media password/encryption, settings bug fix, Money->FloatInt change, ...

This commit is contained in:
Dennis Eichhorn 2023-05-06 11:42:05 +00:00
parent 2eacbaadc0
commit 88ee85212f
33 changed files with 232 additions and 213 deletions

View File

@ -14,6 +14,7 @@ declare(strict_types=1);
use Modules\Billing\Models\NullBill; use Modules\Billing\Models\NullBill;
use phpOMS\Localization\ISO3166NameEnum; use phpOMS\Localization\ISO3166NameEnum;
use phpOMS\Localization\Money;
/** @var \phpOMS\Views\View $this */ /** @var \phpOMS\Views\View $this */
require_once $this->getData('defaultTemplates') require_once $this->getData('defaultTemplates')
@ -202,9 +203,12 @@ foreach($lines as $line) {
$pdf->writeHTMLCell($w[0], 10, null, null, $line->itemNumber . ' ' . $line->itemName, 0, 2, $fill); $pdf->writeHTMLCell($w[0], 10, null, null, $line->itemNumber . ' ' . $line->itemName, 0, 2, $fill);
$height = $pdf->getY() - $tempY; $height = $pdf->getY() - $tempY;
$singleSalesPriceNet = Money::fromFloatInt($line->singleSalesPriceNet);
$totalSalesPriceNet = Money::fromFloatInt($line->totalSalesPriceNet);
$pdf->MultiCell($w[1], $height, $line->getQuantity(), 0, 'L', $fill, 0, 15 + $w[0], $tempY, true, 0, false, true, 0, 'M', true); $pdf->MultiCell($w[1], $height, $line->getQuantity(), 0, 'L', $fill, 0, 15 + $w[0], $tempY, true, 0, false, true, 0, 'M', true);
$pdf->MultiCell($w[2], $height, $line->singleSalesPriceNet->getCurrency(2, symbol: ''), 0, 'L', $fill, 0, 15 + $w[0] + $w[1], $tempY, true, 0, false, true, 0, 'M', true); $pdf->MultiCell($w[2], $height, $singleSalesPriceNet->getCurrency(2, symbol: ''), 0, 'L', $fill, 0, 15 + $w[0] + $w[1], $tempY, true, 0, false, true, 0, 'M', true);
$pdf->MultiCell($w[3], $height, $line->totalSalesPriceNet->getCurrency(2, symbol: ''), 0, 'L', $fill, 1, 15 + $w[0] + $w[1] + $w[2], $tempY, true, 0, false, true, 0, 'M', true); $pdf->MultiCell($w[3], $height, $totalSalesPriceNet->getCurrency(2, symbol: ''), 0, 'L', $fill, 1, 15 + $w[0] + $w[1] + $w[2], $tempY, true, 0, false, true, 0, 'M', true);
$fill = !$fill; $fill = !$fill;
@ -230,12 +234,16 @@ $pdf->setFont('helvetica', 'B', 8);
$tempY = $pdf->getY(); $tempY = $pdf->getY();
$netSales = Money::fromFloatInt($bill->netSales);
$pdf->setX($w[0] + $w[1] + 15); $pdf->setX($w[0] + $w[1] + 15);
$pdf->Cell($w[2], 7, $lang[$pdf->language]['Subtotal'], 0, 0, 'L', false); $pdf->Cell($w[2], 7, $lang[$pdf->language]['Subtotal'], 0, 0, 'L', false);
$pdf->Cell($w[3], 7, $bill->netSales->getCurrency(2, symbol: ''), 0, 0, 'L', false); $pdf->Cell($w[3], 7, $netSales->getCurrency(2, symbol: ''), 0, 0, 'L', false);
$pdf->Ln(); $pdf->Ln();
foreach ($taxes as $rate => $tax) { foreach ($taxes as $rate => $tax) {
$tax = Money::fromFloatInt($tax);
$pdf->setX($w[0] + $w[1] + 15); $pdf->setX($w[0] + $w[1] + 15);
$pdf->Cell($w[2], 7, $lang[$pdf->language]['Taxes'] . ' (' . $rate . '%)', 0, 0, 'L', false); $pdf->Cell($w[2], 7, $lang[$pdf->language]['Taxes'] . ' (' . $rate . '%)', 0, 0, 'L', false);
$pdf->Cell($w[3], 7, $tax->getCurrency(2, symbol: ''), 0, 0, 'L', false); $pdf->Cell($w[3], 7, $tax->getCurrency(2, symbol: ''), 0, 0, 'L', false);
@ -249,9 +257,11 @@ $pdf->setTextColor(255);
$pdf->setDrawColor(255, 162, 7); $pdf->setDrawColor(255, 162, 7);
$pdf->setFont('helvetica', 'B', 8); $pdf->setFont('helvetica', 'B', 8);
$grossSales = Money::fromFloatInt($bill->grossSales);
$pdf->setX($w[0] + $w[1] + 15); $pdf->setX($w[0] + $w[1] + 15);
$pdf->Cell($w[2], 7, \strtoupper($lang[$pdf->language]['Total']), 1, 0, 'L', true); $pdf->Cell($w[2], 7, \strtoupper($lang[$pdf->language]['Total']), 1, 0, 'L', true);
$pdf->Cell($w[3], 7, $bill->grossSales->getCurrency(2, symbol: ''), 1, 0, 'L', true); $pdf->Cell($w[3], 7, $grossSales->getCurrency(2, symbol: ''), 1, 0, 'L', true);
$pdf->Ln(); $pdf->Ln();
$tempY2 = $pdf->getY(); $tempY2 = $pdf->getY();

View File

@ -312,6 +312,11 @@
"type": "TINYINT(1)", "type": "TINYINT(1)",
"null": false "null": false
}, },
"billing_type_account_format": {
"name": "billing_type_account_format",
"type": "VARCHAR(255)",
"null": false
},
"billing_type_is_template": { "billing_type_is_template": {
"description": "What kind of bill is it?", "description": "What kind of bill is it?",
"name": "billing_type_is_template", "name": "billing_type_is_template",

View File

@ -130,7 +130,7 @@ final class Installer extends InstallerAbstract
$request->setData('title', \reset($attribute['l11n'])); $request->setData('title', \reset($attribute['l11n']));
$request->setData('language', \array_keys($attribute['l11n'])[0] ?? 'en'); $request->setData('language', \array_keys($attribute['l11n'])[0] ?? 'en');
$request->setData('is_required', $attribute['is_required'] ?? false); $request->setData('is_required', $attribute['is_required'] ?? false);
$request->setData('is_custom_allowed', $attribute['is_custom_allowed'] ?? false); $request->setData('custom', $attribute['is_custom_allowed'] ?? false);
$request->setData('validation_pattern', $attribute['validation_pattern'] ?? ''); $request->setData('validation_pattern', $attribute['validation_pattern'] ?? '');
$request->setData('datatype', (int) $attribute['value_type']); $request->setData('datatype', (int) $attribute['value_type']);
@ -289,8 +289,8 @@ final class Installer extends InstallerAbstract
$request->header->account = 1; $request->header->account = 1;
$request->setData('tax_type', $tax['type']); $request->setData('tax_type', $tax['type']);
$request->setData('tax_code', $tax['tax_code']); $request->setData('tax_code', $tax['tax_code']);
$request->setData('item_code', $itemValue->getId()); $request->setData('item_code', $itemValue->id);
$request->setData('account_code', $accountValue->getId()); $request->setData('account_code', $accountValue->id);
$module->apiTaxCombinationCreate($request, $response); $module->apiTaxCombinationCreate($request, $response);

View File

@ -290,7 +290,7 @@ final class ApiAttributeController extends Controller
$this->createModelRelation( $this->createModelRelation(
$request->header->account, $request->header->account,
(int) $request->getData('type'), (int) $request->getData('type'),
$attrValue->getId(), $attrValue->id,
BillAttributeTypeMapper::class, 'defaults', '', $request->getOrigin() BillAttributeTypeMapper::class, 'defaults', '', $request->getOrigin()
); );
} }

View File

@ -172,7 +172,7 @@ final class ApiBillController extends Controller
// @todo: consider to remove the trigger and select the latest bill here and add + 1 to the new sequence since we have to tdo an update anyways // @todo: consider to remove the trigger and select the latest bill here and add + 1 to the new sequence since we have to tdo an update anyways
/** @var Bill $bill */ /** @var Bill $bill */
$tmp = BillMapper::get() $tmp = BillMapper::get()
->where('id', $bill->getId()) ->where('id', $bill->id)
->execute(); ->execute();
$bill->sequence = $tmp->sequence; $bill->sequence = $tmp->sequence;
@ -256,7 +256,7 @@ final class ApiBillController extends Controller
$billLanguage = $validLanguages[0] ?? ISO639x1Enum::_EN; $billLanguage = $validLanguages[0] ?? ISO639x1Enum::_EN;
$clientBillLanguage = $client->getAttribute('bill_language')?->value->valueStr; $clientBillLanguage = $client->getAttribute('bill_language')->value->valueStr;
if (!empty($clientBillLanguage) && \in_array($clientBillLanguage, $validLanguages)) { if (!empty($clientBillLanguage) && \in_array($clientBillLanguage, $validLanguages)) {
$billLanguage = $clientBillLanguage; $billLanguage = $clientBillLanguage;
} else { } else {
@ -293,7 +293,7 @@ final class ApiBillController extends Controller
$item, $item,
$taxCode, $taxCode,
$request->getDataInt('quantity') ?? 1, $request->getDataInt('quantity') ?? 1,
$bill->getId() $bill->id
); );
return $element; return $element;
@ -430,8 +430,8 @@ final class ApiBillController extends Controller
foreach ($uploaded as $media) { foreach ($uploaded as $media) {
$this->createModelRelation( $this->createModelRelation(
$request->header->account, $request->header->account,
$bill->getId(), $bill->id,
$media->getId(), $media->id,
BillMapper::class, BillMapper::class,
'media', 'media',
'', '',
@ -441,7 +441,7 @@ final class ApiBillController extends Controller
if ($request->hasData('type')) { if ($request->hasData('type')) {
$this->createModelRelation( $this->createModelRelation(
$request->header->account, $request->header->account,
$media->getId(), $media->id,
$request->getDataInt('type'), $request->getDataInt('type'),
MediaMapper::class, MediaMapper::class,
'types', 'types',
@ -453,7 +453,7 @@ final class ApiBillController extends Controller
if ($collection === null) { if ($collection === null) {
$collection = MediaMapper::getParentCollection($path)->limit(1)->execute(); $collection = MediaMapper::getParentCollection($path)->limit(1)->execute();
if ($collection instanceof NullCollection) { if ($collection->id === 0) {
$collection = $this->app->moduleManager->get('Media')->createRecursiveMediaCollection( $collection = $this->app->moduleManager->get('Media')->createRecursiveMediaCollection(
$path, $path,
$request->header->account, $request->header->account,
@ -464,8 +464,8 @@ final class ApiBillController extends Controller
$this->createModelRelation( $this->createModelRelation(
$request->header->account, $request->header->account,
$collection->getId(), $collection->id,
$media->getId(), $media->id,
CollectionMapper::class, CollectionMapper::class,
'sources', 'sources',
'', '',
@ -478,7 +478,7 @@ final class ApiBillController extends Controller
foreach ($mediaFiles as $media) { foreach ($mediaFiles as $media) {
$this->createModelRelation( $this->createModelRelation(
$request->header->account, $request->header->account,
$bill->getId(), $bill->id,
(int) $media, (int) $media,
BillMapper::class, BillMapper::class,
'media', 'media',
@ -510,7 +510,7 @@ final class ApiBillController extends Controller
. $bill->createdAt->format('Y') . '/' . $bill->createdAt->format('Y') . '/'
. $bill->createdAt->format('m') . '/' . $bill->createdAt->format('m') . '/'
. $bill->createdAt->format('d') . '/' . $bill->createdAt->format('d') . '/'
. $bill->getId(); . $bill->id;
} }
/** /**
@ -602,7 +602,7 @@ final class ApiBillController extends Controller
->execute(); ->execute();
$element = $this->createBaseBillElement($bill->client, $item, $bill, $request); $element = $this->createBaseBillElement($bill->client, $item, $bill, $request);
$element->bill = $bill->getId(); $element->bill = $bill->id;
// discounts // discounts
if ($request->getData('discount_percentage') !== null) { if ($request->getData('discount_percentage') !== null) {
@ -661,7 +661,7 @@ final class ApiBillController extends Controller
$billTypeId = $request->getData('bill_type', 'int'); $billTypeId = $request->getData('bill_type', 'int');
if (empty($billTypeId)) { if (empty($billTypeId)) {
$billTypeId = $bill->type->getId(); $billTypeId = $bill->type->id;
} }
if (empty($billTypeId)) { if (empty($billTypeId)) {
@ -674,7 +674,7 @@ final class ApiBillController extends Controller
->where('id', $billTypeId) ->where('id', $billTypeId)
->execute(); ->execute();
$templateId = $billType->defaultTemplate?->getId(); $templateId = $billType->defaultTemplate?->id;
} }
/** @var \Modules\Media\Models\Collection $template */ /** @var \Modules\Media\Models\Collection $template */
@ -799,14 +799,14 @@ final class ApiBillController extends Controller
$templateId = $request->getDataInt('bill_template'); $templateId = $request->getDataInt('bill_template');
if ($templateId === null) { if ($templateId === null) {
$billTypeId = $bill->type->getId(); $billTypeId = $bill->type->id;
/** @var \Modules\Billing\Models\BillType $billType */ /** @var \Modules\Billing\Models\BillType $billType */
$billType = BillTypeMapper::get() $billType = BillTypeMapper::get()
->where('id', $billTypeId) ->where('id', $billTypeId)
->execute(); ->execute();
$templateId = $billType->defaultTemplate?->getId(); $templateId = $billType->defaultTemplate?->id;
} }
/** @var \Modules\Media\Models\Collection $template */ /** @var \Modules\Media\Models\Collection $template */
@ -903,8 +903,8 @@ final class ApiBillController extends Controller
$this->createModelRelation( $this->createModelRelation(
$request->header->account, $request->header->account,
$bill->getId(), $bill->id,
$media->getId(), $media->id,
BillMapper::class, BillMapper::class,
'media', 'media',
'', '',
@ -954,7 +954,7 @@ final class ApiBillController extends Controller
} }
$model = $response->get($request->uri->__toString())['response']; $model = $response->get($request->uri->__toString())['response'];
$this->createModelRelation($request->header->account, $request->getDataInt('id'), $model->getId(), BillMapper::class, 'bill_note', '', $request->getOrigin()); $this->createModelRelation($request->header->account, $request->getDataInt('id'), $model->id, BillMapper::class, 'bill_note', '', $request->getOrigin());
} }
/** /**

View File

@ -33,6 +33,7 @@ use phpOMS\Message\NotificationLevel;
use phpOMS\Message\RequestAbstract; use phpOMS\Message\RequestAbstract;
use phpOMS\Message\ResponseAbstract; use phpOMS\Message\ResponseAbstract;
use phpOMS\Model\Message\FormValidation; use phpOMS\Model\Message\FormValidation;
use phpOMS\Stdlib\Base\FloatInt;
use phpOMS\System\MimeType; use phpOMS\System\MimeType;
/** /**
@ -118,16 +119,16 @@ final class ApiPriceController extends Controller
$queryMapper->where('promocode', \array_unique([$request->getData('price_promocode'), null]), 'IN'); $queryMapper->where('promocode', \array_unique([$request->getData('price_promocode'), null]), 'IN');
$queryMapper->where('item', \array_unique([$request->getData('price_item', 'int'), null]), 'IN'); $queryMapper->where('item', \array_unique([$request->getData('price_item', 'int'), null]), 'IN');
$queryMapper->where('itemgroup', \array_unique([$request->getData('price_itemgroup', 'int'), $item?->getAttribute('itemgroup')?->getId(), null]), 'IN'); $queryMapper->where('itemgroup', \array_unique([$request->getData('price_itemgroup', 'int'), $item?->getAttribute('itemgroup')->id, null]), 'IN');
$queryMapper->where('itemsegment', \array_unique([$request->getData('price_itemsegment', 'int'), $item?->getAttribute('itemsegment')?->getId(), null]), 'IN'); $queryMapper->where('itemsegment', \array_unique([$request->getData('price_itemsegment', 'int'), $item?->getAttribute('itemsegment')->id, null]), 'IN');
$queryMapper->where('itemsection', \array_unique([$request->getData('price_itemsection', 'int'), $item?->getAttribute('itemsection')?->getId(), null]), 'IN'); $queryMapper->where('itemsection', \array_unique([$request->getData('price_itemsection', 'int'), $item?->getAttribute('itemsection')->id, null]), 'IN');
$queryMapper->where('itemtype', \array_unique([$request->getData('price_itemtype', 'int'), $item?->getAttribute('itemtype')?->getId(), null]), 'IN'); $queryMapper->where('itemtype', \array_unique([$request->getData('price_itemtype', 'int'), $item?->getAttribute('itemtype')->id, null]), 'IN');
$queryMapper->where('client', \array_unique([$request->getData('price_client', 'int'), null]), 'IN'); $queryMapper->where('client', \array_unique([$request->getData('price_client', 'int'), null]), 'IN');
$queryMapper->where('clientgroup', \array_unique([$request->getData('price_clientgroup', 'int'), $client?->getAttribute('clientgroup')?->getId(), null]), 'IN'); $queryMapper->where('clientgroup', \array_unique([$request->getData('price_clientgroup', 'int'), $client?->getAttribute('clientgroup')->id, null]), 'IN');
$queryMapper->where('clientsegment', \array_unique([$request->getData('price_clientsegment', 'int'), $client?->getAttribute('clientsegment')?->getId(), null]), 'IN'); $queryMapper->where('clientsegment', \array_unique([$request->getData('price_clientsegment', 'int'), $client?->getAttribute('clientsegment')->id, null]), 'IN');
$queryMapper->where('clientsection', \array_unique([$request->getData('price_clientsection', 'int'), $client?->getAttribute('clientsection')?->getId(), null]), 'IN'); $queryMapper->where('clientsection', \array_unique([$request->getData('price_clientsection', 'int'), $client?->getAttribute('clientsection')->id, null]), 'IN');
$queryMapper->where('clienttype', \array_unique([$request->getData('price_clienttype', 'int'), $client?->getAttribute('clienttype')?->getId(), null]), 'IN'); $queryMapper->where('clienttype', \array_unique([$request->getData('price_clienttype', 'int'), $client?->getAttribute('clienttype')->id, null]), 'IN');
$queryMapper->where('clientcountry', \array_unique([$request->getData('price_clientcountry'), $client?->mainAddress->getCountry(), null]), 'IN'); $queryMapper->where('clientcountry', \array_unique([$request->getData('price_clientcountry'), $client?->mainAddress->getCountry(), null]), 'IN');
$queryMapper->where('supplier', \array_unique([$request->getData('price_supplier', 'int'), null]), 'IN'); $queryMapper->where('supplier', \array_unique([$request->getData('price_supplier', 'int'), null]), 'IN');
@ -155,16 +156,16 @@ final class ApiPriceController extends Controller
$bestBasePrice = null; $bestBasePrice = null;
foreach ($prices as $price) { foreach ($prices as $price) {
if ($price->price !== 0 && $price->priceNew === 0 if ($price->price !== 0 && $price->priceNew === 0
&& $price->item->getId() !== 0 && $price->item->id !== 0
&& $price->itemgroup->getId() === 0 && $price->itemgroup->id === 0
&& $price->itemsegment->getId() === 0 && $price->itemsegment->id === 0
&& $price->itemsection->getId() === 0 && $price->itemsection->id === 0
&& $price->itemtype->getId() === 0 && $price->itemtype->id === 0
&& $price->client->getId() === 0 && $price->client->id === 0
&& $price->clientgroup->getId() === 0 && $price->clientgroup->id === 0
&& $price->clientsegment->getId() === 0 && $price->clientsegment->id === 0
&& $price->clientsection->getId() === 0 && $price->clientsection->id === 0
&& $price->clienttype->getId() === 0 && $price->clienttype->id === 0
&& $price->promocode === '' && $price->promocode === ''
) { ) {
if ($price->price < ($bestBasePrice?->price ?? \PHP_INT_MAX)) { if ($price->price < ($bestBasePrice?->price ?? \PHP_INT_MAX)) {
@ -208,11 +209,11 @@ final class ApiPriceController extends Controller
$tax = ($request->getDataInt('price_type') ?? PriceType::SALES) === PriceType::SALES $tax = ($request->getDataInt('price_type') ?? PriceType::SALES) === PriceType::SALES
? TaxCombinationMapper::get() ? TaxCombinationMapper::get()
->where('itemCode', $request->getDataInt('price_item')) ->where('itemCode', $request->getDataInt('price_item'))
->where('clientCode', $account->getAttribute('client_code')?->value->getId()) ->where('clientCode', $account->getAttribute('client_code')->value->id)
->execute() ->execute()
: TaxCombinationMapper::get() : TaxCombinationMapper::get()
->where('itemCode', $request->getDataInt('price_item')) ->where('itemCode', $request->getDataInt('price_item'))
->where('supplierCode', $account->getAttribute('supplier_code')?->value->getId()) ->where('supplierCode', $account->getAttribute('supplier_code')->value->id)
->execute(); ->execute();
$response->header->set('Content-Type', MimeType::M_JSON, true); $response->header->set('Content-Type', MimeType::M_JSON, true);
@ -281,8 +282,8 @@ final class ApiPriceController extends Controller
$price->unit = (int) $request->getData('unit'); $price->unit = (int) $request->getData('unit');
$price->type = $request->getDataInt('type') ?? PriceType::SALES; $price->type = $request->getDataInt('type') ?? PriceType::SALES;
$price->quantity = (int) $request->getData('quantity'); $price->quantity = (int) $request->getData('quantity');
$price->price = (int) $request->getData('price'); $price->price = new FloatInt((int) $request->getData('price'));
$price->priceNew = (int) $request->getData('price_name'); $price->priceNew = (int) $request->getData('price_new');
$price->discount = (int) $request->getData('discount'); $price->discount = (int) $request->getData('discount');
$price->discountPercentage = (int) $request->getData('discountPercentage'); $price->discountPercentage = (int) $request->getData('discountPercentage');
$price->bonus = (int) $request->getData('bonus'); $price->bonus = (int) $request->getData('bonus');

View File

@ -73,14 +73,14 @@ final class ApiPurchaseController extends Controller
$billRequest->header->l11n = $request->header->l11n; $billRequest->header->l11n = $request->header->l11n;
$billRequest->setData('supplier', 0); $billRequest->setData('supplier', 0);
$billRequest->setData('status', BillStatus::UNPARSED); $billRequest->setData('status', BillStatus::UNPARSED);
$billRequest->setData('type', $purchaseTransferType->getId()); $billRequest->setData('type', $purchaseTransferType->id);
$billResponse = new HttpResponse(); $billResponse = new HttpResponse();
$billResponse->header->l11n = $response->header->l11n; $billResponse->header->l11n = $response->header->l11n;
$this->app->moduleManager->get('Billing', 'Api')->apiBillCreate($billRequest, $billResponse, $data); $this->app->moduleManager->get('Billing', 'Api')->apiBillCreate($billRequest, $billResponse, $data);
$billId = $billResponse->get('')['response']->getId(); $billId = $billResponse->get('')['response']->id;
// Upload and assign document to bill // Upload and assign document to bill
$mediaRequest = new HttpRequest(); $mediaRequest = new HttpRequest();

View File

@ -62,8 +62,8 @@ final class ApiTaxController extends Controller
// @todo: consider to actually use a ownsOne reference instead of only a string, this way the next line with the TaxCodeMapper can be removed // @todo: consider to actually use a ownsOne reference instead of only a string, this way the next line with the TaxCodeMapper can be removed
/** @var \Modules\Billing\Models\Tax\TaxCombination $taxCombination */ /** @var \Modules\Billing\Models\Tax\TaxCombination $taxCombination */
$taxCombination = TaxCombinationMapper::get() $taxCombination = TaxCombinationMapper::get()
->where('itemCode', $item->getAttribute('sales_tax_code')?->value->getId()) ->where('itemCode', $item->getAttribute('sales_tax_code')->value->id)
->where('clientCode', $client->getAttribute('sales_tax_code')?->value->getId()) ->where('clientCode', $client->getAttribute('sales_tax_code')->value->id)
->execute(); ->execute();
/** @var \Modules\Finance\Models\TaxCode $taxCode */ /** @var \Modules\Finance\Models\TaxCode $taxCode */
@ -72,7 +72,7 @@ final class ApiTaxController extends Controller
->execute(); ->execute();
// If now tax code could be found, the local tax code should be used. // If now tax code could be found, the local tax code should be used.
if ($taxCode instanceof NullTaxCode) { if ($taxCode->id === 0) {
/** @var \Modules\Organization\Models\Unit $unit */ /** @var \Modules\Organization\Models\Unit $unit */
$unit = UnitMapper::get() $unit = UnitMapper::get()
->with('mainAddress') ->with('mainAddress')
@ -91,8 +91,8 @@ final class ApiTaxController extends Controller
/** @var \Modules\Billing\Models\Tax\TaxCombination $taxCombination */ /** @var \Modules\Billing\Models\Tax\TaxCombination $taxCombination */
$taxCombination = TaxCombinationMapper::get() $taxCombination = TaxCombinationMapper::get()
->where('itemCode', $item->getAttribute('sales_tax_code')?->value->getId()) ->where('itemCode', $item->getAttribute('sales_tax_code')->value->id)
->where('clientCode', $taxCodeAttribute->getId()) ->where('clientCode', $taxCodeAttribute->id)
->execute(); ->execute();
/** @var \Modules\Finance\Models\TaxCode $taxCode */ /** @var \Modules\Finance\Models\TaxCode $taxCode */
@ -203,7 +203,7 @@ final class ApiTaxController extends Controller
} elseif (\in_array($taxOfficeAddress->getCountry(), ISO3166CharEnum::getRegion('eu')) } elseif (\in_array($taxOfficeAddress->getCountry(), ISO3166CharEnum::getRegion('eu'))
&& \in_array($client->mainAddress->getCountry(), ISO3166CharEnum::getRegion('eu')) && \in_array($client->mainAddress->getCountry(), ISO3166CharEnum::getRegion('eu'))
) { ) {
if (!empty($client->getAttribute('vat_id')?->value->getValue())) { if (!empty($client->getAttribute('vat_id')->value->getValue())) {
// Is EU company // Is EU company
$taxCode = $codes->getDefaultByValue('EU'); $taxCode = $codes->getDefaultByValue('EU');
} else { } else {

View File

@ -131,7 +131,7 @@ final class BackendController extends Controller
->with('createdBy') ->with('createdBy')
->where('module', 'Billing') ->where('module', 'Billing')
->where('type', StringUtils::intHash(BillMapper::class)) ->where('type', StringUtils::intHash(BillMapper::class))
->where('ref', $bill->getId()) ->where('ref', $bill->id)
->execute(); ->execute();
/** @var \Modules\Auditor\Models\Auditor[] $logsElements */ /** @var \Modules\Auditor\Models\Auditor[] $logsElements */

View File

@ -111,7 +111,7 @@ final class CliController extends Controller
->where('name', $type) ->where('name', $type)
->execute(); ->execute();
$bill->type = new NullBillType($billType->getId()); $bill->type = new NullBillType($billType->id);
/* Number */ /* Number */
$billNumber = $this->findBillNumber($lines, $identifiers['bill_no'][$language]); $billNumber = $this->findBillNumber($lines, $identifiers['bill_no'][$language]);
@ -125,7 +125,7 @@ final class CliController extends Controller
/* Total Gross */ /* Total Gross */
$totalGross = $this->findBillGross($lines, $identifiers['total_gross'][$language]); $totalGross = $this->findBillGross($lines, $identifiers['total_gross'][$language]);
$bill->grossCosts = new Money($totalGross); $bill->grossCosts = new FloatInt($totalGross);
$this->updateModel($request->header->account, $old, $bill, BillMapper::class, 'bill_parsing', $request->getOrigin()); $this->updateModel($request->header->account, $old, $bill, BillMapper::class, 'bill_parsing', $request->getOrigin());
@ -354,7 +354,7 @@ final class CliController extends Controller
if ((!empty($supplier->getAttribute('bill_match_pattern')->value->valueStr) if ((!empty($supplier->getAttribute('bill_match_pattern')->value->valueStr)
&& \stripos($content, $supplier->getAttribute('bill_match_pattern')->value->valueStr) !== false) && \stripos($content, $supplier->getAttribute('bill_match_pattern')->value->valueStr) !== false)
) { ) {
return $supplier->getId(); return $supplier->id;
} }
} }
@ -364,7 +364,7 @@ final class CliController extends Controller
$ibans = $supplier->getPaymentsByType(PaymentType::SWIFT); $ibans = $supplier->getPaymentsByType(PaymentType::SWIFT);
foreach ($ibans as $iban) { foreach ($ibans as $iban) {
if (\stripos($content, $iban->content2) !== false) { if (\stripos($content, $iban->content2) !== false) {
return $supplier->getId(); return $supplier->id;
} }
} }
} }
@ -378,7 +378,7 @@ final class CliController extends Controller
|| (!empty( $supplier->mainAddress->address) || (!empty( $supplier->mainAddress->address)
&& \stripos($content, $supplier->mainAddress->address) !== false) && \stripos($content, $supplier->mainAddress->address) !== false)
) { ) {
return $supplier->getId(); return $supplier->id;
} }
} }
} }
@ -386,7 +386,7 @@ final class CliController extends Controller
// name1 // name1
foreach ($suppliers as $supplier) { foreach ($suppliers as $supplier) {
if (\stripos($content, $supplier->account->name1) !== false) { if (\stripos($content, $supplier->account->name1) !== false) {
return $supplier->getId(); return $supplier->id;
} }
} }
@ -408,7 +408,7 @@ final class CliController extends Controller
{ {
if ((!empty($supplier->getAttribute('bill_date_format')->value->valueStr))) { if ((!empty($supplier->getAttribute('bill_date_format')->value->valueStr))) {
return \DateTime::createFromFormat( return \DateTime::createFromFormat(
$supplier->getAttribute('bill_date_format')?->value->valueStr ?? '', $supplier->getAttribute('bill_date_format')->value->valueStr ?? '',
$date $date
); );
} }

View File

@ -24,7 +24,7 @@ use Modules\Media\Models\NullMedia;
use Modules\SupplierManagement\Models\Supplier; use Modules\SupplierManagement\Models\Supplier;
use phpOMS\Localization\ISO4217CharEnum; use phpOMS\Localization\ISO4217CharEnum;
use phpOMS\Localization\ISO639x1Enum; use phpOMS\Localization\ISO639x1Enum;
use phpOMS\Localization\Money; use phpOMS\Stdlib\Base\FloatInt;
/** /**
* Bill class. * Bill class.
@ -42,7 +42,7 @@ class Bill implements \JsonSerializable
* @var int * @var int
* @since 1.0.0 * @since 1.0.0
*/ */
protected int $id = 0; public int $id = 0;
/** /**
* Sequence. * Sequence.
@ -85,7 +85,7 @@ class Bill implements \JsonSerializable
* @var int * @var int
* @since 1.0.0 * @since 1.0.0
*/ */
private int $status = BillStatus::DRAFT; public int $status = BillStatus::DRAFT;
private int $paymentStatus = BillPaymentStatus::UNPAID; private int $paymentStatus = BillPaymentStatus::UNPAID;
@ -256,82 +256,82 @@ class Bill implements \JsonSerializable
/** /**
* Net amount. * Net amount.
* *
* @var Money * @var FloatInt
* @since 1.0.0 * @since 1.0.0
*/ */
public Money $netProfit; public FloatInt $netProfit;
/** /**
* Gross amount. * Gross amount.
* *
* @var Money * @var FloatInt
* @since 1.0.0 * @since 1.0.0
*/ */
public Money $grossProfit; public FloatInt $grossProfit;
/** /**
* Costs in net. * Costs in net.
* *
* @var Money * @var FloatInt
* @since 1.0.0 * @since 1.0.0
*/ */
public Money $netCosts; public FloatInt $netCosts;
/** /**
* Profit in net. * Profit in net.
* *
* @var Money * @var FloatInt
* @since 1.0.0 * @since 1.0.0
*/ */
public Money $grossCosts; public FloatInt $grossCosts;
/** /**
* Costs in net. * Costs in net.
* *
* @var Money * @var FloatInt
* @since 1.0.0 * @since 1.0.0
*/ */
public Money $netSales; public FloatInt $netSales;
/** /**
* Profit in net. * Profit in net.
* *
* @var Money * @var FloatInt
* @since 1.0.0 * @since 1.0.0
*/ */
public Money $grossSales; public FloatInt $grossSales;
/** /**
* Costs in net. * Costs in net.
* *
* @var Money * @var FloatInt
* @since 1.0.0 * @since 1.0.0
*/ */
public Money $netDiscount; public FloatInt $netDiscount;
/** /**
* Profit in net. * Profit in net.
* *
* @var Money * @var FloatInt
* @since 1.0.0 * @since 1.0.0
*/ */
public Money $grossDiscount; public FloatInt $grossDiscount;
/** /**
* Insurance fees in net. * Insurance fees in net.
* *
* @var Money * @var FloatInt
* @since 1.0.0 * @since 1.0.0
*/ */
public Money $insurance; public FloatInt $insurance;
/** /**
* Freight in net. * Freight in net.
* *
* @var Money * @var FloatInt
* @since 1.0.0 * @since 1.0.0
*/ */
public Money $freight; public FloatInt $freight;
/** /**
* Currency. * Currency.
@ -468,14 +468,14 @@ class Bill implements \JsonSerializable
*/ */
public function __construct() public function __construct()
{ {
$this->netProfit = new Money(0); $this->netProfit = new FloatInt(0);
$this->grossProfit = new Money(0); $this->grossProfit = new FloatInt(0);
$this->netCosts = new Money(0); $this->netCosts = new FloatInt(0);
$this->grossCosts = new Money(0); $this->grossCosts = new FloatInt(0);
$this->netSales = new Money(0); $this->netSales = new FloatInt(0);
$this->grossSales = new Money(0); $this->grossSales = new FloatInt(0);
$this->netDiscount = new Money(0); $this->netDiscount = new FloatInt(0);
$this->grossDiscount = new Money(0); $this->grossDiscount = new FloatInt(0);
$this->billDate = new \DateTime('now'); $this->billDate = new \DateTime('now');
$this->createdAt = new \DateTimeImmutable(); $this->createdAt = new \DateTimeImmutable();
@ -520,7 +520,7 @@ class Bill implements \JsonSerializable
$this->createdAt->format('d'), $this->createdAt->format('d'),
$this->id, $this->id,
$this->sequence, $this->sequence,
$this->type->getId(), $this->type->id,
], ],
$this->type->numberFormat $this->type->numberFormat
); );
@ -804,7 +804,7 @@ class Bill implements \JsonSerializable
$files = []; $files = [];
foreach ($this->media as $file) { foreach ($this->media as $file) {
if ($file->type !== null && $file->type->getId() === $type) { if ($file->type !== null && $file->type->id === $type) {
$files[] = $file; $files[] = $file;
} }
} }

View File

@ -16,7 +16,6 @@ namespace Modules\Billing\Models;
use Modules\Finance\Models\TaxCode; use Modules\Finance\Models\TaxCode;
use Modules\ItemManagement\Models\Item; use Modules\ItemManagement\Models\Item;
use phpOMS\Localization\Money;
use phpOMS\Stdlib\Base\FloatInt; use phpOMS\Stdlib\Base\FloatInt;
/** /**
@ -35,7 +34,7 @@ class BillElement implements \JsonSerializable
* @var int * @var int
* @since 1.0.0 * @since 1.0.0
*/ */
protected int $id = 0; public int $id = 0;
public int $order = 0; public int $order = 0;
@ -52,53 +51,53 @@ class BillElement implements \JsonSerializable
public ?Subscription $subscription = null; public ?Subscription $subscription = null;
public Money $singleSalesPriceNet; public FloatInt $singleSalesPriceNet;
public Money $singleSalesPriceGross; public FloatInt $singleSalesPriceGross;
public Money $totalSalesPriceNet; public FloatInt $totalSalesPriceNet;
public Money $totalSalesPriceGross; public FloatInt $totalSalesPriceGross;
public Money $singleDiscountP; public FloatInt $singleDiscountP;
public Money $totalDiscountP; public FloatInt $totalDiscountP;
public ?FloatInt $singleDiscountR = null; public ?FloatInt $singleDiscountR = null;
public ?FloatInt $discountQ = null; public ?FloatInt $discountQ = null;
public Money $singleListPriceNet; public FloatInt $singleListPriceNet;
public Money $singleListPriceGross; public FloatInt $singleListPriceGross;
public Money $totalListPriceNet; public FloatInt $totalListPriceNet;
public Money $totalListPriceGross; public FloatInt $totalListPriceGross;
public Money $singlePurchasePriceNet; public FloatInt $singlePurchasePriceNet;
public Money $singlePurchasePriceGross; public FloatInt $singlePurchasePriceGross;
public Money $totalPurchasePriceNet; public FloatInt $totalPurchasePriceNet;
public Money $totalPurchasePriceGross; public FloatInt $totalPurchasePriceGross;
public Money $singleProfitNet; public FloatInt $singleProfitNet;
public Money $singleProfitGross; public FloatInt $singleProfitGross;
public Money $totalProfitNet; public FloatInt $totalProfitNet;
public Money $totalProfitGross; public FloatInt $totalProfitGross;
/** /**
* Tax amount * Tax amount
* *
* @var Money * @var FloatInt
* @since 1.0.0 * @since 1.0.0
*/ */
public Money $taxP; public FloatInt $taxP;
/** /**
* Tax percentage * Tax percentage
@ -135,34 +134,34 @@ class BillElement implements \JsonSerializable
*/ */
public function __construct() public function __construct()
{ {
$this->singleListPriceNet = new Money(); $this->singleListPriceNet = new FloatInt();
$this->singleListPriceGross = new Money(); $this->singleListPriceGross = new FloatInt();
$this->totalListPriceNet = new Money(); $this->totalListPriceNet = new FloatInt();
$this->totalListPriceGross = new Money(); $this->totalListPriceGross = new FloatInt();
$this->singleSalesPriceNet = new Money(); $this->singleSalesPriceNet = new FloatInt();
$this->singleSalesPriceGross = new Money(); $this->singleSalesPriceGross = new FloatInt();
$this->totalSalesPriceNet = new Money(); $this->totalSalesPriceNet = new FloatInt();
$this->totalSalesPriceGross = new Money(); $this->totalSalesPriceGross = new FloatInt();
$this->singlePurchasePriceNet = new Money(); $this->singlePurchasePriceNet = new FloatInt();
$this->singlePurchasePriceGross = new Money(); $this->singlePurchasePriceGross = new FloatInt();
$this->totalPurchasePriceNet = new Money(); $this->totalPurchasePriceNet = new FloatInt();
$this->totalPurchasePriceGross = new Money(); $this->totalPurchasePriceGross = new FloatInt();
$this->singleProfitNet = new Money(); $this->singleProfitNet = new FloatInt();
$this->singleProfitGross = new Money(); $this->singleProfitGross = new FloatInt();
$this->totalProfitNet = new Money(); $this->totalProfitNet = new FloatInt();
$this->totalProfitGross = new Money(); $this->totalProfitGross = new FloatInt();
$this->singleDiscountP = new Money(); $this->singleDiscountP = new FloatInt();
$this->totalDiscountP = new Money(); $this->totalDiscountP = new FloatInt();
$this->taxP = new Money(); $this->taxP = new FloatInt();
$this->taxR = new FloatInt(); $this->taxR = new FloatInt();
} }
@ -239,7 +238,7 @@ class BillElement implements \JsonSerializable
{ {
$element = new self(); $element = new self();
$element->bill = $bill; $element->bill = $bill;
$element->item = empty($item->getId()) ? null : $item->getId(); $element->item = empty($item->id) ? null : $item->id;
$element->itemNumber = $item->number; $element->itemNumber = $item->number;
$element->itemName = $item->getL11n('name1')->description; $element->itemName = $item->getL11n('name1')->description;
$element->itemDescription = $item->getL11n('description_short')->description; $element->itemDescription = $item->getL11n('description_short')->description;
@ -257,7 +256,7 @@ class BillElement implements \JsonSerializable
$element->singleProfitNet->setInt($element->singleSalesPriceNet->getInt() - $element->singlePurchasePriceNet->getInt()); $element->singleProfitNet->setInt($element->singleSalesPriceNet->getInt() - $element->singlePurchasePriceNet->getInt());
$element->totalProfitNet->setInt($element->quantity * ($element->totalSalesPriceNet->getInt() - $element->totalPurchasePriceNet->getInt())); $element->totalProfitNet->setInt($element->quantity * ($element->totalSalesPriceNet->getInt() - $element->totalPurchasePriceNet->getInt()));
$element->taxP = new Money((int) (($code->percentageInvoice * $element->totalSalesPriceNet->getInt()) / 10000)); $element->taxP = new FloatInt((int) (($code->percentageInvoice * $element->totalSalesPriceNet->getInt()) / 10000));
$element->taxR = new FloatInt($code->percentageInvoice); $element->taxR = new FloatInt($code->percentageInvoice);
$element->taxCode = $code->abbr; $element->taxCode = $code->abbr;
@ -272,7 +271,7 @@ class BillElement implements \JsonSerializable
$element->totalProfitGross->setInt($element->quantity * ($element->totalSalesPriceGross->getInt() - $element->totalPurchasePriceGross->getInt())); $element->totalProfitGross->setInt($element->quantity * ($element->totalSalesPriceGross->getInt() - $element->totalPurchasePriceGross->getInt()));
if (!empty($element->bill) if (!empty($element->bill)
&& $item->getAttribute('subscription')?->value->getValue() === 1 && $item->getAttribute('subscription')->value->getValue() === 1
) { ) {
$element->subscription = new Subscription(); $element->subscription = new Subscription();
$element->subscription->bill = $element->bill; $element->subscription->bill = $element->bill;

View File

@ -34,7 +34,7 @@ class BillType implements \JsonSerializable
* @var int * @var int
* @since 1.0.0 * @since 1.0.0
*/ */
protected int $id = 0; public int $id = 0;
public string $name = ''; public string $name = '';
@ -44,6 +44,8 @@ class BillType implements \JsonSerializable
public string $numberFormat = ''; public string $numberFormat = '';
public string $accountFormat = '';
public int $transferType = BillTransferType::SALES; public int $transferType = BillTransferType::SALES;
public bool $transferStock = true; public bool $transferStock = true;

View File

@ -40,6 +40,7 @@ final class BillTypeMapper extends DataMapperFactory
'billing_type_id' => ['name' => 'billing_type_id', 'type' => 'int', 'internal' => 'id'], 'billing_type_id' => ['name' => 'billing_type_id', 'type' => 'int', 'internal' => 'id'],
'billing_type_name' => ['name' => 'billing_type_name', 'type' => 'string', 'internal' => 'name'], 'billing_type_name' => ['name' => 'billing_type_name', 'type' => 'string', 'internal' => 'name'],
'billing_type_number_format' => ['name' => 'billing_type_number_format', 'type' => 'string', 'internal' => 'numberFormat'], 'billing_type_number_format' => ['name' => 'billing_type_number_format', 'type' => 'string', 'internal' => 'numberFormat'],
'billing_type_account_format' => ['name' => 'billing_type_account_format', 'type' => 'string', 'internal' => 'accountFormat'],
'billing_type_transfer_type' => ['name' => 'billing_type_transfer_type', 'type' => 'int', 'internal' => 'transferType'], 'billing_type_transfer_type' => ['name' => 'billing_type_transfer_type', 'type' => 'int', 'internal' => 'transferType'],
'billing_type_default_template' => ['name' => 'billing_type_default_template', 'type' => 'int', 'internal' => 'defaultTemplate'], 'billing_type_default_template' => ['name' => 'billing_type_default_template', 'type' => 'int', 'internal' => 'defaultTemplate'],
'billing_type_transfer_stock' => ['name' => 'billing_type_transfer_stock', 'type' => 'bool', 'internal' => 'transferStock'], 'billing_type_transfer_stock' => ['name' => 'billing_type_transfer_stock', 'type' => 'bool', 'internal' => 'transferStock'],

View File

@ -23,6 +23,7 @@ use Modules\ItemManagement\Models\NullItem;
use Modules\SupplierManagement\Models\NullSupplier; use Modules\SupplierManagement\Models\NullSupplier;
use Modules\SupplierManagement\Models\Supplier; use Modules\SupplierManagement\Models\Supplier;
use phpOMS\Localization\ISO4217CharEnum; use phpOMS\Localization\ISO4217CharEnum;
use phpOMS\Stdlib\Base\FloatInt;
/** /**
* Bill class. * Bill class.
@ -40,7 +41,7 @@ class Price implements \JsonSerializable
* @var int * @var int
* @since 1.0.0 * @since 1.0.0
*/ */
protected int $id = 0; public int $id = 0;
public string $name = ''; public string $name = '';
@ -76,7 +77,7 @@ class Price implements \JsonSerializable
public int $quantity = 0; public int $quantity = 0;
public int $price = 0; public FloatInt $price;
public int $priceNew = 0; public int $priceNew = 0;
@ -109,6 +110,8 @@ class Price implements \JsonSerializable
$this->clienttype = new NullAttributeValue(); $this->clienttype = new NullAttributeValue();
$this->supplier = new NullSupplier(); $this->supplier = new NullSupplier();
$this->price = new FloatInt();
} }
/** /**

View File

@ -60,7 +60,7 @@ final class PriceMapper extends DataMapperFactory
'billing_price_unit' => ['name' => 'billing_price_unit', 'type' => 'int', 'internal' => 'unit'], 'billing_price_unit' => ['name' => 'billing_price_unit', 'type' => 'int', 'internal' => 'unit'],
'billing_price_type' => ['name' => 'billing_price_type', 'type' => 'int', 'internal' => 'type'], 'billing_price_type' => ['name' => 'billing_price_type', 'type' => 'int', 'internal' => 'type'],
'billing_price_quantity' => ['name' => 'billing_price_quantity', 'type' => 'int', 'internal' => 'quantity'], 'billing_price_quantity' => ['name' => 'billing_price_quantity', 'type' => 'int', 'internal' => 'quantity'],
'billing_price_price' => ['name' => 'billing_price_price', 'type' => 'int', 'internal' => 'price'], 'billing_price_price' => ['name' => 'billing_price_price', 'type' => 'Serializable', 'internal' => 'price'],
'billing_price_price_new' => ['name' => 'billing_price_price_new', 'type' => 'int', 'internal' => 'priceNew'], 'billing_price_price_new' => ['name' => 'billing_price_price_new', 'type' => 'int', 'internal' => 'priceNew'],
'billing_price_discount' => ['name' => 'billing_price_discount', 'type' => 'int', 'internal' => 'discount'], 'billing_price_discount' => ['name' => 'billing_price_discount', 'type' => 'int', 'internal' => 'discount'],
'billing_price_discountp' => ['name' => 'billing_price_discountp', 'type' => 'int', 'internal' => 'discountPercentage'], 'billing_price_discountp' => ['name' => 'billing_price_discountp', 'type' => 'int', 'internal' => 'discountPercentage'],

View File

@ -17,7 +17,7 @@ namespace Modules\Billing\Models;
use Modules\SupplierManagement\Models\SupplierMapper; use Modules\SupplierManagement\Models\SupplierMapper;
use phpOMS\DataStorage\Database\Query\Builder; use phpOMS\DataStorage\Database\Query\Builder;
use phpOMS\Localization\Defaults\CountryMapper; use phpOMS\Localization\Defaults\CountryMapper;
use phpOMS\Localization\Money; use phpOMS\Stdlib\Base\FloatInt;
/** /**
* Mapper class. * Mapper class.
@ -78,7 +78,7 @@ final class PurchaseBillMapper extends BillMapper
/** /**
* Placeholder * Placeholder
*/ */
public static function getPurchaseByItemId(int $id, \DateTime $start, \DateTime $end) : Money public static function getPurchaseByItemId(int $id, \DateTime $start, \DateTime $end) : FloatInt
{ {
$query = new Builder(self::$db); $query = new Builder(self::$db);
$result = $query->select('SUM(billing_bill_element_total_netpurchaseprice)') $result = $query->select('SUM(billing_bill_element_total_netpurchaseprice)')
@ -91,13 +91,13 @@ final class PurchaseBillMapper extends BillMapper
->execute() ->execute()
?->fetch(); ?->fetch();
return new Money((int) $result[0]); return new FloatInt((int) $result[0]);
} }
/** /**
* Placeholder * Placeholder
*/ */
public static function getPurchaseBySupplierId(int $id, \DateTime $start, \DateTime $end) : Money public static function getPurchaseBySupplierId(int $id, \DateTime $start, \DateTime $end) : FloatInt
{ {
$query = new Builder(self::$db); $query = new Builder(self::$db);
$result = $query->select('SUM(billing_bill_netcosts)') $result = $query->select('SUM(billing_bill_netcosts)')
@ -108,13 +108,13 @@ final class PurchaseBillMapper extends BillMapper
->execute() ->execute()
?->fetch(); ?->fetch();
return new Money((int) $result[0]); return new FloatInt((int) $result[0]);
} }
/** /**
* Placeholder * Placeholder
*/ */
public static function getAvgPurchasePriceByItemId(int $id, \DateTime $start, \DateTime $end) : Money public static function getAvgPurchasePriceByItemId(int $id, \DateTime $start, \DateTime $end) : FloatInt
{ {
$query = new Builder(self::$db); $query = new Builder(self::$db);
$result = $query->select('SUM(billing_bill_element_single_netpurchaseprice)', 'COUNT(billing_bill_element_total_netpurchaseprice)') $result = $query->select('SUM(billing_bill_element_single_netpurchaseprice)', 'COUNT(billing_bill_element_total_netpurchaseprice)')
@ -127,7 +127,7 @@ final class PurchaseBillMapper extends BillMapper
->execute() ->execute()
?->fetch(); ?->fetch();
return new Money($result === false || $result[1] == 0 ? 0 : (int) (((int) $result[0]) / ((int) $result[1]))); return new FloatInt($result === false || $result[1] == 0 ? 0 : (int) (((int) $result[0]) / ((int) $result[1])));
} }
/** /**
@ -179,9 +179,9 @@ final class PurchaseBillMapper extends BillMapper
/** /**
* Placeholder * Placeholder
*/ */
public static function getItemLivetimeValue(int $id, \DateTime $start, \DateTime $end) : Money public static function getItemLivetimeValue(int $id, \DateTime $start, \DateTime $end) : FloatInt
{ {
return new Money(); return new FloatInt();
} }
/** /**

View File

@ -17,7 +17,7 @@ namespace Modules\Billing\Models;
use Modules\ClientManagement\Models\ClientMapper; use Modules\ClientManagement\Models\ClientMapper;
use phpOMS\DataStorage\Database\Query\Builder; use phpOMS\DataStorage\Database\Query\Builder;
use phpOMS\Localization\Defaults\CountryMapper; use phpOMS\Localization\Defaults\CountryMapper;
use phpOMS\Localization\Money; use phpOMS\Stdlib\Base\FloatInt;
/** /**
* Mapper class. * Mapper class.
@ -78,7 +78,7 @@ final class SalesBillMapper extends BillMapper
/** /**
* Placeholder * Placeholder
*/ */
public static function getSalesByItemId(int $id, \DateTime $start, \DateTime $end) : Money public static function getSalesByItemId(int $id, \DateTime $start, \DateTime $end) : FloatInt
{ {
$query = new Builder(self::$db); $query = new Builder(self::$db);
$result = $query->select('SUM(billing_bill_element_total_netsalesprice)') $result = $query->select('SUM(billing_bill_element_total_netsalesprice)')
@ -91,13 +91,13 @@ final class SalesBillMapper extends BillMapper
->execute() ->execute()
?->fetch(); ?->fetch();
return new Money((int) $result[0] ?? 0); return new FloatInt((int) $result[0] ?? 0);
} }
/** /**
* Placeholder * Placeholder
*/ */
public static function getSalesByClientId(int $id, \DateTime $start, \DateTime $end) : Money public static function getSalesByClientId(int $id, \DateTime $start, \DateTime $end) : FloatInt
{ {
$query = new Builder(self::$db); $query = new Builder(self::$db);
$result = $query->select('SUM(billing_bill_netsales)') $result = $query->select('SUM(billing_bill_netsales)')
@ -108,13 +108,13 @@ final class SalesBillMapper extends BillMapper
->execute() ->execute()
?->fetch(); ?->fetch();
return new Money((int) $result[0] ?? 0); return new FloatInt((int) $result[0] ?? 0);
} }
/** /**
* Placeholder * Placeholder
*/ */
public static function getAvgSalesPriceByItemId(int $id, \DateTime $start, \DateTime $end) : Money public static function getAvgSalesPriceByItemId(int $id, \DateTime $start, \DateTime $end) : FloatInt
{ {
$query = new Builder(self::$db); $query = new Builder(self::$db);
$result = $query->select('SUM(billing_bill_element_single_netsalesprice)', 'COUNT(billing_bill_element_total_netsalesprice)') $result = $query->select('SUM(billing_bill_element_single_netsalesprice)', 'COUNT(billing_bill_element_total_netsalesprice)')
@ -127,7 +127,7 @@ final class SalesBillMapper extends BillMapper
->execute() ->execute()
?->fetch(); ?->fetch();
return new Money($result === false || ((int) ($result[1] ?? 0)) === 0 ? 0 : (int) (((int) $result[0] ?? 0) / ((int) $result[1]))); return new FloatInt($result === false || ((int) ($result[1] ?? 0)) === 0 ? 0 : (int) (((int) $result[0] ?? 0) / ((int) $result[1])));
} }
/** /**
@ -179,9 +179,9 @@ final class SalesBillMapper extends BillMapper
/** /**
* Placeholder * Placeholder
*/ */
public static function getItemLivetimeValue(int $id, \DateTime $start, \DateTime $end) : Money public static function getItemLivetimeValue(int $id, \DateTime $start, \DateTime $end) : FloatInt
{ {
return new Money(); return new FloatInt();
} }
/** /**

View File

@ -32,7 +32,7 @@ class Subscription implements \JsonSerializable
* @var int * @var int
* @since 1.0.0 * @since 1.0.0
*/ */
protected int $id = 0; public int $id = 0;
public int $status = 0; public int $status = 0;

View File

@ -33,7 +33,7 @@ class TaxCombination implements \JsonSerializable
* @var int * @var int
* @since 1.0.0 * @since 1.0.0
*/ */
protected int $id = 0; public int $id = 0;
public ?AttributeValue $clientCode = null; public ?AttributeValue $clientCode = null;

View File

@ -39,7 +39,7 @@ $billTypes = $this->getData('billtypes') ?? [];
/** @var \Modules\Auditor\Models\Audit */ /** @var \Modules\Auditor\Models\Audit */
$logs = $this->getData('logs') ?? []; $logs = $this->getData('logs') ?? [];
$editable = $bill instanceof NullBill || \in_array($bill->getStatus(), [BillStatus::DRAFT, BillStatus::UNPARSED]); $editable = $bill->id === 0 || \in_array($bill->getStatus(), [BillStatus::DRAFT, BillStatus::UNPARSED]);
$disabled = !$editable ? ' disabled' : ''; $disabled = !$editable ? ' disabled' : '';
echo $this->getData('nav')->render(); ?> echo $this->getData('nav')->render(); ?>
@ -96,7 +96,7 @@ echo $this->getData('nav')->render(); ?>
<label for="iBillType"><?= $this->getHtml('Type'); ?></label> <label for="iBillType"><?= $this->getHtml('Type'); ?></label>
<select id="iBillType" name="bill_type"<?= $disabled; ?>> <select id="iBillType" name="bill_type"<?= $disabled; ?>>
<?php foreach ($billTypes as $type) : ?> <?php foreach ($billTypes as $type) : ?>
<option value="<?= $type->getId(); ?>"><?= $this->printHtml($type->getL11n()); ?> <option value="<?= $type->id; ?>"><?= $this->printHtml($type->getL11n()); ?>
<?php endforeach; ?> <?php endforeach; ?>
</select> </select>
</div> </div>
@ -306,12 +306,12 @@ echo $this->getData('nav')->render(); ?>
<td><span class="input"><button type="button" formaction=""><i class="fa fa-book"></i></button><input name="" type="text" value="<?= $element->itemNumber; ?>" required<?= $disabled; ?>></span> <td><span class="input"><button type="button" formaction=""><i class="fa fa-book"></i></button><input name="" type="text" value="<?= $element->itemNumber; ?>" required<?= $disabled; ?>></span>
<td><textarea required<?= $disabled; ?>><?= $element->itemName; ?></textarea> <td><textarea required<?= $disabled; ?>><?= $element->itemName; ?></textarea>
<td><input name="" type="number" min="0" value="<?= $element->getQuantity(); ?>" required<?= $disabled; ?>> <td><input name="" type="number" min="0" value="<?= $element->getQuantity(); ?>" required<?= $disabled; ?>>
<td><input name="" type="text" value="<?= $element->singleSalesPriceNet->getCurrency(symbol: ''); ?>"<?= $disabled; ?>> <td><input name="" type="text" value="<?= $this->getCurrency($element->singleSalesPriceNet, symbol: ''); ?>"<?= $disabled; ?>>
<td><input name="" type="number" min="0"<?= $disabled; ?>> <td><input name="" type="number" min="0"<?= $disabled; ?>>
<td><input name="" type="number" min="0" max="100" step="any"<?= $disabled; ?>> <td><input name="" type="number" min="0" max="100" step="any"<?= $disabled; ?>>
<td><input name="" type="number" min="0" step="any"<?= $disabled; ?>> <td><input name="" type="number" min="0" step="any"<?= $disabled; ?>>
<td><input name="" type="number" min="0" step="any"<?= $disabled; ?>> <td><input name="" type="number" min="0" step="any"<?= $disabled; ?>>
<td><?= $element->totalSalesPriceNet->getCurrency(); ?> <td><?= $this->getCurrency($element->totalSalesPriceNet); ?>
<?php endforeach; ?> <?php endforeach; ?>
<?php if ($editable) : ?> <?php if ($editable) : ?>
<tr data-id="0"> <tr data-id="0">
@ -345,7 +345,7 @@ echo $this->getData('nav')->render(); ?>
<div class="col-xs-12 col-sm-3 box"> <div class="col-xs-12 col-sm-3 box">
<select id="iBillPreviewType" name="bill_preview_type">> <select id="iBillPreviewType" name="bill_preview_type">>
<?php foreach ($billTypes as $type) : ?> <?php foreach ($billTypes as $type) : ?>
<option value="<?= $type->getId(); ?>"><?= $this->printHtml($type->getL11n()); ?> <option value="<?= $type->id; ?>"><?= $this->printHtml($type->getL11n()); ?>
<?php endforeach; ?> <?php endforeach; ?>
</select> </select>
</div> </div>
@ -512,10 +512,10 @@ echo $this->getData('nav')->render(); ?>
<tbody> <tbody>
<?php <?php
foreach ($logs as $audit) : foreach ($logs as $audit) :
$url = UriFactory::build('{/base}/admin/audit/single?id=' . $audit->getId()); $url = UriFactory::build('{/base}/admin/audit/single?id=' . $audit->id);
?> ?>
<tr data-href="<?= $url; ?>"> <tr data-href="<?= $url; ?>">
<td><a href="<?= $url; ?>"><?= $audit->getId(); ?></a> <td><a href="<?= $url; ?>"><?= $audit->id; ?></a>
<td><a href="<?= $url; ?>"><?= $audit->trigger; ?></a> <td><a href="<?= $url; ?>"><?= $audit->trigger; ?></a>
<td><?php if ($audit->old === null) : echo $this->getHtml('CREATE', 'Auditor', 'Backend'); ?> <td><?php if ($audit->old === null) : echo $this->getHtml('CREATE', 'Auditor', 'Backend'); ?>
<?php elseif ($audit->old !== null && $audit->new !== null) : echo $this->getHtml('UPDATE', 'Auditor', 'Backend'); ?> <?php elseif ($audit->old !== null && $audit->new !== null) : echo $this->getHtml('UPDATE', 'Auditor', 'Backend'); ?>
@ -523,7 +523,7 @@ echo $this->getData('nav')->render(); ?>
<?php else : echo $this->getHtml('UNKNOWN', 'Auditor', 'Backend'); ?> <?php else : echo $this->getHtml('UNKNOWN', 'Auditor', 'Backend'); ?>
<?php endif; ?> <?php endif; ?>
<td><a class="content" <td><a class="content"
href="<?= UriFactory::build('{/base}/admin/account/settings?id=' . $audit->createdBy->getId()); ?>"><?= $this->printHtml( href="<?= UriFactory::build('{/base}/admin/account/settings?id=' . $audit->createdBy->id); ?>"><?= $this->printHtml(
$this->renderUserName('%3$s %2$s %1$s', [$audit->createdBy->name1, $audit->createdBy->name2, $audit->createdBy->name3, $audit->createdBy->login]) $this->renderUserName('%3$s %2$s %1$s', [$audit->createdBy->name1, $audit->createdBy->name2, $audit->createdBy->name3, $audit->createdBy->login])
); ?></a> ); ?></a>
<td><a href="<?= $url; ?>"><?= $audit->createdAt->format('Y-m-d'); ?></a> <td><a href="<?= $url; ?>"><?= $audit->createdAt->format('Y-m-d'); ?></a>

View File

@ -154,7 +154,7 @@ echo $this->getData('nav')->render(); ?>
<?php $count = 0; <?php $count = 0;
foreach ($bills as $key => $value) : foreach ($bills as $key => $value) :
++$count; ++$count;
$url = UriFactory::build('{/base}/purchase/bill?{?}&id=' . $value->getId()); $url = UriFactory::build('{/base}/purchase/bill?{?}&id=' . $value->id);
?> ?>
<tr data-href="<?= $url; ?>"> <tr data-href="<?= $url; ?>">
<td><label class="checkbox" for="iBillSelect-<?= $key; ?>"> <td><label class="checkbox" for="iBillSelect-<?= $key; ?>">
@ -163,7 +163,7 @@ echo $this->getData('nav')->render(); ?>
</label> </label>
<td><a href="<?= $url; ?>"><?= $value->getNumber(); ?></a> <td><a href="<?= $url; ?>"><?= $value->getNumber(); ?></a>
<td><a href="<?= $url; ?>"><?= $value->type->getL11n(); ?></a> <td><a href="<?= $url; ?>"><?= $value->type->getL11n(); ?></a>
<td><a class="content" href="<?= $supplier = UriFactory::build('purchase/supplier/profile?{?}&id=' . $value->supplier->getId()); ?>"><?= $value->supplier->number; ?></a> <td><a class="content" href="<?= $supplier = UriFactory::build('purchase/supplier/profile?{?}&id=' . $value->supplier->id); ?>"><?= $value->supplier->number; ?></a>
<td><a class="content" href="<?= $supplier; ?>"><?= $this->printHtml($value->billTo); ?></a> <td><a class="content" href="<?= $supplier; ?>"><?= $this->printHtml($value->billTo); ?></a>
<td><a href="<?= $url; <td><a href="<?= $url;
?>"><?= $value->billAddress; ?></a> ?>"><?= $value->billAddress; ?></a>

View File

@ -169,12 +169,12 @@ echo $this->getData('nav')->render(); ?>
<td><span class="input"><button type="button" formaction=""><i class="fa fa-book"></i></button><input name="" type="text" value="<?= $element->itemNumber; ?>" required></span> <td><span class="input"><button type="button" formaction=""><i class="fa fa-book"></i></button><input name="" type="text" value="<?= $element->itemNumber; ?>" required></span>
<td><textarea required><?= $element->itemName; ?></textarea> <td><textarea required><?= $element->itemName; ?></textarea>
<td><input name="" type="number" min="0" value="<?= $element->quantity; ?>" required> <td><input name="" type="number" min="0" value="<?= $element->quantity; ?>" required>
<td><input name="" type="text" value="<?= $element->singleSalesPriceNet->getCurrency(); ?>"> <td><input name="" type="text" value="<?= $this->getCurrency($element->singleSalesPriceNet); ?>">
<td><input name="" type="number" min="0"> <td><input name="" type="number" min="0">
<td><input name="" type="number" min="0" max="100" step="any"> <td><input name="" type="number" min="0" max="100" step="any">
<td><input name="" type="number" min="0" step="any"> <td><input name="" type="number" min="0" step="any">
<td><input name="" type="number" min="0" step="any"> <td><input name="" type="number" min="0" step="any">
<td><?= $element->totalSalesPriceNet->getCurrency(); ?> <td><?= $this->getCurrency($element->totalSalesPriceNet); ?>
<?php endforeach; ?> <?php endforeach; ?>
<tr> <tr>
<td><i class="fa fa-plus"></i> <i class="fa fa-chevron-up order-up"></i> <i class="fa fa-chevron-down order-down"></i> <td><i class="fa fa-plus"></i> <i class="fa fa-chevron-up order-up"></i> <i class="fa fa-chevron-down order-down"></i>
@ -191,9 +191,9 @@ echo $this->getData('nav')->render(); ?>
</div> </div>
<div class="portlet-foot"> <div class="portlet-foot">
<?= $this->getHtml('Freightage'); ?>: 0.00 - <?= $this->getHtml('Freightage'); ?>: 0.00 -
<?= $this->getHtml('Net'); ?>: <?= $bill->netSales->getCurrency(); ?> - <?= $this->getHtml('Net'); ?>: <?= $this->getCurrency($bill->netSales); ?> -
<?= $this->getHtml('Tax'); ?>: 0.00 - <?= $this->getHtml('Tax'); ?>: 0.00 -
<?= $this->getHtml('Total'); ?>: <?= $bill->grossSales->getCurrency(); ?> <?= $this->getHtml('Total'); ?>: <?= $this->getCurrency($bill->grossSales); ?>
</div> </div>
</div> </div>
</div> </div>
@ -205,7 +205,7 @@ echo $this->getData('nav')->render(); ?>
<div class="col-xs-12"> <div class="col-xs-12">
<section id="mediaFile" class="portlet"> <section id="mediaFile" class="portlet">
<div class="portlet-body"> <div class="portlet-body">
<?php if (!($billPdf instanceof NullMedia)) : ?> <?php if ($billPdf->id > 0) : ?>
<iframe style="min-height: 600px;" data-form="iUiSettings" data-name="iframeHelper" id="iHelperFrame" src="<?= UriFactory::build('{/backend}Resources/mozilla/Pdf/web/viewer.html{?}&file=' . \urlencode(($billPdf->isAbsolute ? '' : '/../../../../') . $billPdf->getPath())); ?>" allowfullscreen></iframe> <iframe style="min-height: 600px;" data-form="iUiSettings" data-name="iframeHelper" id="iHelperFrame" src="<?= UriFactory::build('{/backend}Resources/mozilla/Pdf/web/viewer.html{?}&file=' . \urlencode(($billPdf->isAbsolute ? '' : '/../../../../') . $billPdf->getPath())); ?>" allowfullscreen></iframe>
<?php endif; ?> <?php endif; ?>
</div> </div>
@ -219,7 +219,7 @@ echo $this->getData('nav')->render(); ?>
<div class="col-xs-12"> <div class="col-xs-12">
<section id="mediaFile" class="portlet"> <section id="mediaFile" class="portlet">
<div class="portlet-body"> <div class="portlet-body">
<?php if (!($original instanceof NullMedia)) : ?> <?php if ($original->id > 0) : ?>
<iframe style="min-height: 600px;" data-form="iUiSettings" data-name="iframeHelper" id="iHelperFrame" src="<?= UriFactory::build('{/backend}Resources/mozilla/Pdf/web/viewer.html{?}&file=' . \urlencode(($original->isAbsolute ? '' : '/../../../../') . $original->getPath())); ?>" allowfullscreen></iframe> <iframe style="min-height: 600px;" data-form="iUiSettings" data-name="iframeHelper" id="iHelperFrame" src="<?= UriFactory::build('{/backend}Resources/mozilla/Pdf/web/viewer.html{?}&file=' . \urlencode(($original->isAbsolute ? '' : '/../../../../') . $original->getPath())); ?>" allowfullscreen></iframe>
<?php endif; ?> <?php endif; ?>
</div> </div>
@ -301,9 +301,9 @@ echo $this->getData('nav')->render(); ?>
<?php foreach ($media as $file) : <?php foreach ($media as $file) :
$url = $file->extension === 'collection' $url = $file->extension === 'collection'
? UriFactory::build('{/base}/media/list?path=' . \rtrim($file->getVirtualPath(), '/') . '/' . $file->name) ? UriFactory::build('{/base}/media/list?path=' . \rtrim($file->getVirtualPath(), '/') . '/' . $file->name)
: UriFactory::build('{/base}/media/single?id=' . $file->getId() : UriFactory::build('{/base}/media/single?id=' . $file->id
. '&path={?path}' . ( . '&path={?path}' . (
$file->getId() === 0 $file->id === 0
? '/' . $file->name ? '/' . $file->name
: '' : ''
) )

View File

@ -165,7 +165,7 @@ echo $this->getData('nav')->render(); ?>
<tbody> <tbody>
<?php $count = 0; foreach ($bills as $key => $value) : <?php $count = 0; foreach ($bills as $key => $value) :
++$count; ++$count;
$url = UriFactory::build('{/base}/sales/bill?{?}&id=' . $value->getId()); $url = UriFactory::build('{/base}/sales/bill?{?}&id=' . $value->id);
?> ?>
<tr data-href="<?= $url; ?>"> <tr data-href="<?= $url; ?>">
<td><label class="checkbox" for="iBillSelect-<?= $key; ?>"> <td><label class="checkbox" for="iBillSelect-<?= $key; ?>">
@ -174,15 +174,15 @@ echo $this->getData('nav')->render(); ?>
</label> </label>
<td><a href="<?= $url; ?>"><?= $value->getNumber(); ?></a> <td><a href="<?= $url; ?>"><?= $value->getNumber(); ?></a>
<td><a href="<?= $url; ?>"><?= $value->type->getL11n(); ?></a> <td><a href="<?= $url; ?>"><?= $value->type->getL11n(); ?></a>
<td><a class="content" href="<?= $client = UriFactory::build('sales/client/profile?{?}&id=' . $value->client->getId()); ?>"><?= $value->client->number; ?></a> <td><a class="content" href="<?= $client = UriFactory::build('sales/client/profile?{?}&id=' . $value->client->id); ?>"><?= $value->client->number; ?></a>
<td><a class="content" href="<?= $client; ?>"><?= $this->printHtml($value->billTo); ?></a> <td><a class="content" href="<?= $client; ?>"><?= $this->printHtml($value->billTo); ?></a>
<td><a href="<?= $url; <td><a href="<?= $url;
?>"><?= $value->billAddress; ?></a> ?>"><?= $value->billAddress; ?></a>
<td><a href="<?= $url; ?>"><?= $value->billZip; ?></a> <td><a href="<?= $url; ?>"><?= $value->billZip; ?></a>
<td><a href="<?= $url; ?>"><?= $value->billCity; ?></a> <td><a href="<?= $url; ?>"><?= $value->billCity; ?></a>
<td><a href="<?= $url; ?>"><?= $value->billCountry; ?></a> <td><a href="<?= $url; ?>"><?= $value->billCountry; ?></a>
<td><a href="<?= $url; ?>"><?= $value->netSales->getCurrency(); ?></a> <td><a href="<?= $url; ?>"><?= $this->getCurrency($value->netSales); ?></a>
<td><a href="<?= $url; ?>"><?= $value->netProfit->getCurrency(); ?></a> <td><a href="<?= $url; ?>"><?= $this->getCurrency($value->netProfit); ?></a>
<td><a href="<?= $url; ?>"><?= $value->createdAt->format('Y-m-d'); ?></a> <td><a href="<?= $url; ?>"><?= $value->createdAt->format('Y-m-d'); ?></a>
<?php endforeach; ?> <?php endforeach; ?>
<?php if ($count === 0) : ?> <?php if ($count === 0) : ?>

View File

@ -156,7 +156,7 @@ echo $this->getData('nav')->render(); ?>
<?php $count = 0; <?php $count = 0;
foreach ($bills as $key => $value) : foreach ($bills as $key => $value) :
++$count; ++$count;
$url = UriFactory::build('{/base}/private/purchase/bill?{?}&id=' . $value->getId()); $url = UriFactory::build('{/base}/private/purchase/bill?{?}&id=' . $value->id);
?> ?>
<tr data-href="<?= $url; ?>"> <tr data-href="<?= $url; ?>">
<td><label class="checkbox" for="iBillSelect-<?= $key; ?>"> <td><label class="checkbox" for="iBillSelect-<?= $key; ?>">
@ -165,7 +165,7 @@ echo $this->getData('nav')->render(); ?>
</label> </label>
<td><a href="<?= $url; ?>"><?= $value->getNumber(); ?></a> <td><a href="<?= $url; ?>"><?= $value->getNumber(); ?></a>
<td><a href="<?= $url; ?>"><?= $value->type->getL11n(); ?></a> <td><a href="<?= $url; ?>"><?= $value->type->getL11n(); ?></a>
<td><a class="content" href="<?= $supplier = UriFactory::build('purchase/supplier/profile?{?}&id=' . $value->supplier->getId()); ?>"><?= $value->supplier->number; ?></a> <td><a class="content" href="<?= $supplier = UriFactory::build('purchase/supplier/profile?{?}&id=' . $value->supplier->id); ?>"><?= $value->supplier->number; ?></a>
<td><a class="content" href="<?= $supplier; ?>"><?= $this->printHtml($value->billTo); ?></a> <td><a class="content" href="<?= $supplier; ?>"><?= $this->printHtml($value->billTo); ?></a>
<td><a href="<?= $url; <td><a href="<?= $url;
?>"><?= $value->billAddress; ?></a> ?>"><?= $value->billAddress; ?></a>

View File

@ -168,12 +168,12 @@ echo $this->getData('nav')->render(); ?>
<td><span class="input"><button type="button" formaction=""><i class="fa fa-book"></i></button><input name="" type="text" value="<?= $element->itemNumber; ?>" required></span> <td><span class="input"><button type="button" formaction=""><i class="fa fa-book"></i></button><input name="" type="text" value="<?= $element->itemNumber; ?>" required></span>
<td><textarea required><?= $element->itemName; ?></textarea> <td><textarea required><?= $element->itemName; ?></textarea>
<td><input name="" type="number" min="0" value="<?= $element->quantity; ?>" required> <td><input name="" type="number" min="0" value="<?= $element->quantity; ?>" required>
<td><input name="" type="text" value="<?= $element->singleSalesPriceNet->getCurrency(); ?>"> <td><input name="" type="text" value="<?= $this->getCurrency($element->singleSalesPriceNet); ?>">
<td><input name="" type="number" min="0"> <td><input name="" type="number" min="0">
<td><input name="" type="number" min="0" max="100" step="any"> <td><input name="" type="number" min="0" max="100" step="any">
<td><input name="" type="number" min="0" step="any"> <td><input name="" type="number" min="0" step="any">
<td><input name="" type="number" min="0" step="any"> <td><input name="" type="number" min="0" step="any">
<td><?= $element->totalSalesPriceNet->getCurrency(); ?> <td><?= $this->getCurrency($element->totalSalesPriceNet); ?>
<?php endforeach; ?> <?php endforeach; ?>
<tr> <tr>
<td><i class="fa fa-plus"></i> <i class="fa fa-chevron-up order-up"></i> <i class="fa fa-chevron-down order-down"></i> <td><i class="fa fa-plus"></i> <i class="fa fa-chevron-up order-up"></i> <i class="fa fa-chevron-down order-down"></i>
@ -189,9 +189,9 @@ echo $this->getData('nav')->render(); ?>
</table> </table>
<div class="portlet-foot"> <div class="portlet-foot">
<?= $this->getHtml('Freightage'); ?>: 0.00 - <?= $this->getHtml('Freightage'); ?>: 0.00 -
<?= $this->getHtml('Net'); ?>: <?= $bill->netSales->getCurrency(); ?> - <?= $this->getHtml('Net'); ?>: <?= $this->getCurrency($bill->netSales); ?> -
<?= $this->getHtml('Tax'); ?>: 0.00 - <?= $this->getHtml('Tax'); ?>: 0.00 -
<?= $this->getHtml('Total'); ?>: <?= $bill->grossSales->getCurrency(); ?> <?= $this->getHtml('Total'); ?>: <?= $this->getCurrency($bill->grossSales); ?>
</div> </div>
</div> </div>
</div> </div>
@ -203,7 +203,7 @@ echo $this->getData('nav')->render(); ?>
<div class="col-xs-12"> <div class="col-xs-12">
<section id="mediaFile" class="portlet"> <section id="mediaFile" class="portlet">
<div class="portlet-body"> <div class="portlet-body">
<?php if (!($billPdf instanceof NullMedia)) : ?> <?php if ($billPdf->id > 0) : ?>
<iframe style="min-height: 600px;" data-form="iUiSettings" data-name="iframeHelper" id="iHelperFrame" src="<?= UriFactory::build('{/backend}Resources/mozilla/Pdf/web/viewer.html{?}&file=' . \urlencode(($billPdf->isAbsolute ? '' : '/../../../../') . $billPdf->getPath())); ?>" allowfullscreen></iframe> <iframe style="min-height: 600px;" data-form="iUiSettings" data-name="iframeHelper" id="iHelperFrame" src="<?= UriFactory::build('{/backend}Resources/mozilla/Pdf/web/viewer.html{?}&file=' . \urlencode(($billPdf->isAbsolute ? '' : '/../../../../') . $billPdf->getPath())); ?>" allowfullscreen></iframe>
<?php endif; ?> <?php endif; ?>
</div> </div>
@ -217,7 +217,7 @@ echo $this->getData('nav')->render(); ?>
<div class="col-xs-12"> <div class="col-xs-12">
<section id="mediaFile" class="portlet"> <section id="mediaFile" class="portlet">
<div class="portlet-body"> <div class="portlet-body">
<?php if (!($original instanceof NullMedia)) : ?> <?php if ($original->id > 0) : ?>
<iframe style="min-height: 600px;" data-form="iUiSettings" data-name="iframeHelper" id="iHelperFrame" src="<?= UriFactory::build('{/backend}Resources/mozilla/Pdf/web/viewer.html{?}&file=' . \urlencode(($original->isAbsolute ? '' : '/../../../../') . $original->getPath())); ?>" allowfullscreen></iframe> <iframe style="min-height: 600px;" data-form="iUiSettings" data-name="iframeHelper" id="iHelperFrame" src="<?= UriFactory::build('{/backend}Resources/mozilla/Pdf/web/viewer.html{?}&file=' . \urlencode(($original->isAbsolute ? '' : '/../../../../') . $original->getPath())); ?>" allowfullscreen></iframe>
<?php endif; ?> <?php endif; ?>
</div> </div>
@ -299,9 +299,9 @@ echo $this->getData('nav')->render(); ?>
<?php foreach ($media as $file) : <?php foreach ($media as $file) :
$url = $file->extension === 'collection' $url = $file->extension === 'collection'
? UriFactory::build('{/base}/media/list?path=' . \rtrim($file->getVirtualPath(), '/') . '/' . $file->name) ? UriFactory::build('{/base}/media/list?path=' . \rtrim($file->getVirtualPath(), '/') . '/' . $file->name)
: UriFactory::build('{/base}/media/single?id=' . $file->getId() : UriFactory::build('{/base}/media/single?id=' . $file->id
. '&path={?path}' . ( . '&path={?path}' . (
$file->getId() === 0 $file->id === 0
? '/' . $file->name ? '/' . $file->name
: '' : ''
) )

View File

@ -123,7 +123,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
$this->module->apiBillCreate($request, $response); $this->module->apiBillCreate($request, $response);
$bId = $response->get('')['response']->getId(); $bId = $response->get('')['response']->id;
self::assertGreaterThan(0, $bId); self::assertGreaterThan(0, $bId);
for ($k = 0; $k < 10; ++$k) { for ($k = 0; $k < 10; ++$k) {
@ -151,7 +151,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
} }
$this->module->apiBillElementCreate($request, $response); $this->module->apiBillElementCreate($request, $response);
self::assertGreaterThan(0, $response->get('')['response']->getId()); self::assertGreaterThan(0, $response->get('')['response']->id);
} }
$response = new HttpResponse(); $response = new HttpResponse();
@ -163,7 +163,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
$this->module->apiBillPdfArchiveCreate($request, $response); $this->module->apiBillPdfArchiveCreate($request, $response);
$result = $response->get(''); $result = $response->get('');
self::assertGreaterThan(0, $result === null ? -1 : $result['response']?->getId()); self::assertGreaterThan(0, $result === null ? -1 : $result['response']?->id);
} }
*/ */
@ -199,7 +199,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
$this->module->apiBillCreate($request, $response); $this->module->apiBillCreate($request, $response);
$bId = $response->get('')['response']->getId(); $bId = $response->get('')['response']->id;
self::assertGreaterThan(0, $bId); self::assertGreaterThan(0, $bId);
for ($k = 0; $k < 10; ++$k) { for ($k = 0; $k < 10; ++$k) {
@ -227,7 +227,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
} }
$this->module->apiBillElementCreate($request, $response); $this->module->apiBillElementCreate($request, $response);
self::assertGreaterThan(0, $response->get('')['response']->getId()); self::assertGreaterThan(0, $response->get('')['response']->id);
} }
$response = new HttpResponse(); $response = new HttpResponse();
@ -239,7 +239,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
$this->module->apiBillPdfArchiveCreate($request, $response); $this->module->apiBillPdfArchiveCreate($request, $response);
$result = $response->get(''); $result = $response->get('');
self::assertGreaterThan(0, $result === null ? -1 : $result['response']?->getId()); self::assertGreaterThan(0, $result === null ? -1 : $result['response']?->id);
} }
*/ */

View File

@ -37,7 +37,7 @@ final class BillElementTest extends \PHPUnit\Framework\TestCase
*/ */
public function testDefault() : void public function testDefault() : void
{ {
self::assertEquals(0, $this->element->getId()); self::assertEquals(0, $this->element->id);
self::assertInstanceOf('\phpOMS\Localization\Money', $this->element->singleSalesPriceNet); self::assertInstanceOf('\phpOMS\Localization\Money', $this->element->singleSalesPriceNet);
self::assertInstanceOf('\phpOMS\Localization\Money', $this->element->totalSalesPriceNet); self::assertInstanceOf('\phpOMS\Localization\Money', $this->element->totalSalesPriceNet);
self::assertInstanceOf('\phpOMS\Localization\Money', $this->element->singlePurchasePriceNet); self::assertInstanceOf('\phpOMS\Localization\Money', $this->element->singlePurchasePriceNet);

View File

@ -42,7 +42,7 @@ final class BillTest extends \PHPUnit\Framework\TestCase
*/ */
public function testDefault() : void public function testDefault() : void
{ {
self::assertEquals(0, $this->bill->getId()); self::assertEquals(0, $this->bill->id);
self::assertEquals('', $this->bill->number); self::assertEquals('', $this->bill->number);
self::assertEquals('', $this->bill->referralName); self::assertEquals('', $this->bill->referralName);
self::assertEquals('', $this->bill->info); self::assertEquals('', $this->bill->info);
@ -93,7 +93,7 @@ final class BillTest extends \PHPUnit\Framework\TestCase
*/ */
public function testNumberRendering() : void public function testNumberRendering() : void
{ {
$this->bill->numberFormat = '{y}{m}{d}-{id}'; $this->bill->type->numberFormat = '{y}{m}{d}-{id}';
self::assertEquals(\date('Y') . \date('m') . \date('d') . '-0', $this->bill->getNumber()); self::assertEquals(\date('Y') . \date('m') . \date('d') . '-0', $this->bill->getNumber());
} }
@ -165,7 +165,6 @@ final class BillTest extends \PHPUnit\Framework\TestCase
public function testSerialize() : void public function testSerialize() : void
{ {
$this->bill->number = '123456'; $this->bill->number = '123456';
$this->bill->numberFormat = '{y}';
$this->bill->type = new NullBillType(2); $this->bill->type = new NullBillType(2);
$this->bill->shipTo = 'To'; $this->bill->shipTo = 'To';
$this->bill->shipFAO = 'FAO'; $this->bill->shipFAO = 'FAO';
@ -184,7 +183,6 @@ final class BillTest extends \PHPUnit\Framework\TestCase
[ [
'id' => 0, 'id' => 0,
'number' => '123456', 'number' => '123456',
'numberFormat' => '{y}',
'type' => $this->bill->type, 'type' => $this->bill->type,
'shipTo' => 'To', 'shipTo' => 'To',
'shipFAO' => 'FAO', 'shipFAO' => 'FAO',

View File

@ -38,7 +38,7 @@ final class BillTypeTest extends \PHPUnit\Framework\TestCase
*/ */
public function testDefault() : void public function testDefault() : void
{ {
self::assertEquals(0, $this->type->getId()); self::assertEquals(0, $this->type->id);
self::assertTrue($this->type->transferStock); self::assertTrue($this->type->transferStock);
} }

View File

@ -37,6 +37,6 @@ final class NullBillElementTest extends \PHPUnit\Framework\TestCase
public function testId() : void public function testId() : void
{ {
$null = new NullBillElement(2); $null = new NullBillElement(2);
self::assertEquals(2, $null->getId()); self::assertEquals(2, $null->id);
} }
} }

View File

@ -37,6 +37,6 @@ final class NullBillTest extends \PHPUnit\Framework\TestCase
public function testId() : void public function testId() : void
{ {
$null = new NullBill(2); $null = new NullBill(2);
self::assertEquals(2, $null->getId()); self::assertEquals(2, $null->id);
} }
} }

View File

@ -37,6 +37,6 @@ final class NullBillTypeTest extends \PHPUnit\Framework\TestCase
public function testId() : void public function testId() : void
{ {
$null = new NullBillType(2); $null = new NullBillType(2);
self::assertEquals(2, $null->getId()); self::assertEquals(2, $null->id);
} }
} }