code fixes

This commit is contained in:
Dennis Eichhorn 2024-03-15 20:24:39 +00:00
parent 77b345864f
commit a87884f3a9
32 changed files with 340 additions and 312 deletions

View File

@ -57,5 +57,5 @@ return [
'state' => PermissionCategory::ORDER,
],
],
]
],
];

View File

@ -61,8 +61,8 @@ final class ApiController extends Controller
return;
}
$supplier = $request->getDataString('supplier');
$productGroup = $request->getDataInt('product_group');
$supplier = $request->getDataString('supplier');
$productGroup = $request->getDataInt('product_group');
$showIrrelevant = !($request->getDataBool('hide_irrelevant') ?? true);
try {
@ -84,6 +84,17 @@ final class ApiController extends Controller
$this->createStandardBackgroundResponse($request, $response, []);
}
/**
* Returns data from an order suggestion element.
*
* This also re-calculates a lot of values because some depend on the current stock amounts, prices etc.
*
* @param OrderSuggestionElement[] $elements Elements of our order
*
* @return array<int, array{singlePrice:FloatInt, totalPrice:FloatInt, stock:FloatInt, reserved:FloatInt, ordered:FloatInt, minquantity:FloatInt, minstock:FloatInt, quantitystep:FloatInt, avgsales:FloatInt, range_stock:float, range_reserved:float, range_ordered:float}>
*
* @since 1.0.0
*/
public function getOrderSuggestionElementData(array $elements) : array
{
if (empty($elements)) {
@ -102,16 +113,16 @@ final class ApiController extends Controller
$end = SmartDateTime::endOfMonth();
$end->smartModify(0, -1);
$salesHistory = SalesBillMapper::getItemMonthlySalesQuantity($itemIds, $start, $end);
$salesHistory = SalesBillMapper::getItemMonthlySalesQuantity($itemIds, $start, $end);
$distributions = \Modules\WarehouseManagement\Models\StockMapper::getStockDistribution($itemIds);
$historyStart = (int) $start->format('m');
$historyEnd = (int) $end->format('m');
$historyEnd = (int) $end->format('m');
// @todo A lot of the code below is mirrored in the CliController for ALL items.
// Pull out some of the code so we only need to maintain one version
foreach ($elements as $element) {
$maxHistoryDuration = $element->item->getAttribute('order_suggestion_history_duration')->value->getValue() ?? 12;
$maxHistoryDuration = $element->item->getAttribute('order_suggestion_history_duration')->value->valueInt ?? 12;
$salesForecast = [];
@ -161,7 +172,7 @@ final class ApiController extends Controller
// Calculate current range using historic sales + other current stats
$totalHistoricSales = \array_sum($salesForecast);
$avgMonthlySales = (int) \round($totalHistoricSales / $actualHistoricDuration);
$avgMonthlySales = (int) \round($totalHistoricSales / $actualHistoricDuration);
$totalStockQuantity = 0;
foreach ($distributions['dists'][$element->item->id] ?? [] as $dist) {
@ -169,7 +180,7 @@ final class ApiController extends Controller
}
$totalReservedQuantity = $distributions['reserved'][$element->item->id] ?? 0;
$totalOrderedQuantity = $distributions['ordered'][$element->item->id] ?? 0;
$totalOrderedQuantity = $distributions['ordered'][$element->item->id] ?? 0;
$currentRangeStock = $avgMonthlySales == 0 ? \PHP_INT_MAX : ($totalStockQuantity + $totalOrderedQuantity) / $avgMonthlySales;
$currentRangeReserved = $avgMonthlySales == 0 ? \PHP_INT_MAX : ($totalStockQuantity + $totalOrderedQuantity - $totalReservedQuantity) / $avgMonthlySales;
@ -179,19 +190,19 @@ final class ApiController extends Controller
// -> see SD HTS (depending on other shipments -> not delivered even if available)
// -> maybe it's possible to consider the expected delivery time?
$minimumStockQuantity = $element->item->getAttribute('minimum_stock_quantity')->value->getValue() ?? 0;
$minimumStockQuantity = (int) \round($minimumStockQuantity * 1000);
$minimumStockRange = $avgMonthlySales === 0 ? 0 : $minimumStockQuantity / $avgMonthlySales;
$minimumStockQuantity = $element->item->getAttribute('minimum_stock_quantity')->value->valueInt ?? 0;
$minimumStockQuantity = (int) \round($minimumStockQuantity * FloatInt::DIVISOR); // @bug why? shouldn't the value already be 10,000?
$minimumStockRange = $avgMonthlySales === 0 ? 0 : $minimumStockQuantity / $avgMonthlySales;
$minimumStockQuantity = (int) \round($minimumStockRange * $avgMonthlySales);
$minimumOrderQuantity = $element->item->getAttribute('minimum_order_quantity')->value->getValue() ?? 0;
$minimumOrderQuantity = $element->item->getAttribute('minimum_order_quantity')->value->valueInt ?? 0;
$minimumOrderQuantity = (int) \round($minimumOrderQuantity * FloatInt::DIVISOR);
$orderQuantityStep = $element->item->getAttribute('order_quantity_steps')->value->getValue() ?? 1;
$orderQuantityStep = $element->item->getAttribute('order_quantity_steps')->value->valueInt ?? 1;
$orderQuantityStep = (int) \round($orderQuantityStep * FloatInt::DIVISOR);
$orderQuantity = $element->quantity->value;
$orderRange = $avgMonthlySales === 0 ? \PHP_INT_MAX : $element->quantity->value / $avgMonthlySales;
$orderRange = $avgMonthlySales === 0 ? \PHP_INT_MAX : $element->quantity->value / $avgMonthlySales;
$internalRequest = new HttpRequest();
$internalRequest->setData('price_quantity', $orderQuantity);
@ -201,18 +212,18 @@ final class ApiController extends Controller
// @question Consider to add gross price
$data[$element->item->id] = [
'singlePrice' => $price['bestActualPrice'],
'totalPrice' => new FloatInt((int) ($price['bestActualPrice']->value * $orderQuantity / FloatInt::DIVISOR)),
'stock' => new FloatInt($totalStockQuantity),
'reserved' => new FloatInt($totalReservedQuantity),
'ordered' => new FloatInt($totalOrderedQuantity),
'minquantity' => new FloatInt($minimumOrderQuantity),
'minstock' => new FloatInt($minimumStockQuantity),
'quantitystep' => new FloatInt($orderQuantityStep),
'avgsales' => new FloatInt($avgMonthlySales),
'range_stock' => $currentRangeStock, // range only considering stock + ordered
'singlePrice' => $price['bestActualPrice'],
'totalPrice' => new FloatInt((int) ($price['bestActualPrice']->value * $orderQuantity / FloatInt::DIVISOR)),
'stock' => new FloatInt($totalStockQuantity),
'reserved' => new FloatInt($totalReservedQuantity),
'ordered' => new FloatInt($totalOrderedQuantity),
'minquantity' => new FloatInt($minimumOrderQuantity),
'minstock' => new FloatInt($minimumStockQuantity),
'quantitystep' => new FloatInt($orderQuantityStep),
'avgsales' => new FloatInt($avgMonthlySales),
'range_stock' => $currentRangeStock, // range only considering stock + ordered
'range_reserved' => $currentRangeReserved, // range considering stock - reserved + ordered
'range_ordered' => $orderRange, // range ADDED with suggested new order quantity
'range_ordered' => $orderRange, // range ADDED with suggested new order quantity
];
}
@ -274,7 +285,7 @@ final class ApiController extends Controller
return;
}
$elements = $request->getDataJson('element');
$elements = $request->getDataJson('element');
$quantities = $request->getDataJson('quantity');
// Missmatch -> data corrupted
@ -286,7 +297,7 @@ final class ApiController extends Controller
}
foreach ($elements as $idx => $e) {
$e = (int) $e;
$e = (int) $e;
$temp = new FloatInt($quantities[$idx]);
foreach ($old->elements as $element) {
@ -306,7 +317,7 @@ final class ApiController extends Controller
$internalRequest->setData('price_quantity', $new->quantity->value);
$internalRequest->setData('price_type', PriceType::PURCHASE);
$price = $this->app->moduleManager->get('Billing', 'ApiPrice')->findBestPrice($internalRequest, $element->item);
$price = $this->app->moduleManager->get('Billing', 'ApiPrice')->findBestPrice($internalRequest, $element->item);
$new->costs = new FloatInt((int) ($price['bestActualPrice']->value * $new->quantity->value / FloatInt::DIVISOR));
$this->updateModel($request->header->account, $element, $new, OrderSuggestionElementMapper::class, 'order_suggestion_element', $request->getOrigin());

View File

@ -84,12 +84,21 @@ final class CliController extends Controller
return $view;
}
/**
* Create a suggestion
*
* @param RequestAbstract $request Request
*
* @return OrderSuggestion
*
* @since 1.0.0
*/
public function createSuggestionFromRequest(RequestAbstract $request) : OrderSuggestion
{
$showIrrelevant = $request->getDataBool('-irrelevant') ?? false;
$now = new \DateTime('now');
$now = new \DateTime('now');
$suggestion = new OrderSuggestion();
$suggestion = new OrderSuggestion();
$suggestion->createdBy = new NullAccount($request->getDataInt('-user') ?? 1);
// @todo define order details per item+stock
@ -99,6 +108,7 @@ final class CliController extends Controller
// @question Consider to save suggestion as model in db
// This would allow users to work on it for a longer time
// It would also allow for an easier approval process
/** @var \Modules\ItemManagement\Models\Item[] $items */
$items = ItemMapper::getAll()
->with('container')
->with('l11n')
@ -140,7 +150,7 @@ final class CliController extends Controller
$end = SmartDateTime::endOfMonth();
$end->smartModify(0, -1);
$salesHistory = SalesBillMapper::getItemMonthlySalesQuantity($itemIds, $start, $end);
$salesHistory = SalesBillMapper::getItemMonthlySalesQuantity($itemIds, $start, $end);
$distributions = \Modules\WarehouseManagement\Models\StockMapper::getStockDistribution($itemIds);
$unitAttribute = UnitAttributeMapper::get()
@ -150,13 +160,13 @@ final class CliController extends Controller
->where('type/name', 'business_year_start')
->execute();
$businessStart = $unitAttribute->id === 0 ? 1 : $unitAttribute->value->getValue();
$businessStart = $unitAttribute->id === 0 ? 1 : $unitAttribute->value->valueInt;
$historyStart = (int) $start->format('m');
$historyEnd = (int) $end->format('m');
$historyEnd = (int) $end->format('m');
foreach ($items as $item) {
$maxHistoryDuration = $item->getAttribute('order_suggestion_history_duration')->value->getValue() ?? 12;
$maxHistoryDuration = $item->getAttribute('order_suggestion_history_duration')->value->valueInt ?? 12;
$salesForecast = [];
@ -206,7 +216,7 @@ final class CliController extends Controller
// Calculate current range using historic sales + other current stats
$totalHistoricSales = \array_sum($salesForecast);
$avgMonthlySales = (int) \round($totalHistoricSales / $actualHistoricDuration);
$avgMonthlySales = (int) \round($totalHistoricSales / $actualHistoricDuration);
$totalStockQuantity = 0;
foreach ($distributions['dists'][$item->id] ?? [] as $dist) {
@ -214,7 +224,7 @@ final class CliController extends Controller
}
$totalReservedQuantity = $distributions['reserved'][$item->id] ?? 0;
$totalOrderedQuantity = $distributions['ordered'][$item->id] ?? 0;
$totalOrderedQuantity = $distributions['ordered'][$item->id] ?? 0;
$currentRangeStock = $avgMonthlySales == 0 ? \PHP_INT_MAX : ($totalStockQuantity + $totalOrderedQuantity) / $avgMonthlySales;
$currentRangeReserved = $avgMonthlySales == 0 ? \PHP_INT_MAX : ($totalStockQuantity + $totalOrderedQuantity - $totalReservedQuantity) / $avgMonthlySales;
@ -225,30 +235,30 @@ final class CliController extends Controller
// -> maybe it's possible to consider the expected delivery time?
// Get minimum range we want
$wantedStockRange = $item->getAttribute('minimum_stock_range')->value->getValue() ?? 1;
$wantedStockRange = $item->getAttribute('minimum_stock_range')->value->valueInt ?? 1;
$minimumStockQuantity = $item->getAttribute('minimum_stock_quantity')->value->getValue() ?? 0;
$minimumStockQuantity = $item->getAttribute('minimum_stock_quantity')->value->valueInt ?? 0;
$minimumStockQuantity = (int) \round($minimumStockQuantity * FloatInt::DIVISOR);
$minimumStockRange = $avgMonthlySales === 0 ? 0 : $minimumStockQuantity / $avgMonthlySales;
$minimumStockRange = $avgMonthlySales === 0 ? 0 : $minimumStockQuantity / $avgMonthlySales;
$minimumStockQuantity = (int) \round($minimumStockRange * $avgMonthlySales);
$minimumOrderQuantity = $item->getAttribute('minimum_order_quantity')->value->getValue() ?? 0;
$minimumOrderQuantity = $item->getAttribute('minimum_order_quantity')->value->valueInt ?? 0;
$minimumOrderQuantity = (int) \round($minimumOrderQuantity * FloatInt::DIVISOR);
$orderQuantityStep = $item->getAttribute('order_quantity_steps')->value->getValue() ?? 1;
$orderQuantityStep = $item->getAttribute('order_quantity_steps')->value->valueInt ?? 1;
$orderQuantityStep = (int) \round($orderQuantityStep * FloatInt::DIVISOR);
$leadTime = $item->getAttribute('lead_time')->value->getValue() ?? 3; // in days
$leadTime = $item->getAttribute('lead_time')->value->valueInt ?? 3; // in days
// @todo Business hours don't have to be 8 hours
// we assume 10 seconds per item if nothing is defined for (invoice handling, stock handling)
$adminTime = ($item->getAttribute('admin_time')->value->getValue() ?? 10) / (8 * 60 * 60); // from seconds -> days
$adminTime = ($item->getAttribute('admin_time')->value->valueInt ?? 10) / (8 * 60 * 60); // from seconds -> days
// Overhead time in days by estimating at least 1 week worth of order quantity
$estimatedOverheadTime = $leadTime + $adminTime * \max($minimumOrderQuantity, $avgMonthlySales / 4) / FloatInt::DIVISOR;
$orderQuantity = 0;
$orderRange = 0;
$orderRange = 0;
if ($minimumStockRange - ($currentRangeReserved - $estimatedOverheadTime / 30) > 0) {
// Iteratively approaching overhead time
@ -296,13 +306,13 @@ final class CliController extends Controller
->where('id', (int) $price['supplier'])
->execute();
$element = new OrderSuggestionElement();
$element->status = OrderSuggestionElementStatus::CALCULATED;
$element->modifiedBy = $suggestion->createdBy;
$element = new OrderSuggestionElement();
$element->status = OrderSuggestionElementStatus::CALCULATED;
$element->modifiedBy = $suggestion->createdBy;
$element->quantity->value = $orderQuantity;
$element->item = $item;
$element->supplier = $supplier;
$element->costs = new FloatInt((int) ($price['bestActualPrice']->value * $orderQuantity / FloatInt::DIVISOR));
$element->item = $item;
$element->supplier = $supplier;
$element->costs = new FloatInt((int) ($price['bestActualPrice']->value * $orderQuantity / FloatInt::DIVISOR));
$suggestion->elements[] = $element;
}

View File

@ -36,14 +36,30 @@ class OrderSuggestion
public \DateTimeImmutable $createdAt;
/**
* Order elements
*
* @var OrderSuggestionElement[]
* @since 1.0.0
*/
public array $elements = [];
/**
* Constructor.
*/
public function __construct()
{
$this->createdBy = new NullAccount();
$this->createdAt = new \DateTimeImmutable('now');
}
/**
* Calculate total costs of order
*
* @return FloatInt
*
* @since 1.0.0
*/
public function getTotalCosts() : FloatInt
{
$total = new FloatInt();

View File

@ -53,13 +53,18 @@ class OrderSuggestionElement
public FloatInt $costs;
/**
* Constructor.
*
* @since 1.0.0
*/
public function __construct()
{
$this->modifiedBy = new NullAccount();
$this->modifiedAt = new \DateTimeImmutable('now');
$this->item = new NullItem();
$this->supplier = new NullSupplier();
$this->quantity = new FloatInt();
$this->costs = new FloatInt();
$this->item = new NullItem();
$this->supplier = new NullSupplier();
$this->quantity = new FloatInt();
$this->costs = new FloatInt();
}
}

View File

@ -21,14 +21,14 @@ use Modules\SupplierManagement\Models\SupplierMapper;
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
/**
* Client mapper class.
* OrderSuggestionElement mapper class.
*
* @package Modules\Purchase\Models\OrderSuggestion
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*
* @template T of Client
* @template T of OrderSuggestionElement
* @extends DataMapperFactory<T>
*/
final class OrderSuggestionElementMapper extends DataMapperFactory
@ -41,15 +41,15 @@ final class OrderSuggestionElementMapper extends DataMapperFactory
*/
public const COLUMNS = [
'purchase_order_suggestion_element_id' => ['name' => 'purchase_order_suggestion_element_id', 'type' => 'int', 'internal' => 'id'],
'purchase_order_suggestion_element_status' => ['name' => 'purchase_order_suggestion_element_status', 'type' => 'int', 'internal' => 'status'],
'purchase_order_suggestion_element_status' => ['name' => 'purchase_order_suggestion_element_status', 'type' => 'int', 'internal' => 'status'],
'purchase_order_suggestion_element_updated_by' => ['name' => 'purchase_order_suggestion_element_updated_by', 'type' => 'int', 'internal' => 'modifiedBy'],
'purchase_order_suggestion_element_updated_at' => ['name' => 'purchase_order_suggestion_element_updated_at', 'type' => 'DateTimeImmutable', 'internal' => 'modifiedAt'],
'purchase_order_suggestion_element_suggestion' => ['name' => 'purchase_order_suggestion_element_suggestion', 'type' => 'int', 'internal' => 'suggestion'],
'purchase_order_suggestion_element_updated_at' => ['name' => 'purchase_order_suggestion_element_updated_at', 'type' => 'DateTimeImmutable', 'internal' => 'modifiedAt'],
'purchase_order_suggestion_element_suggestion' => ['name' => 'purchase_order_suggestion_element_suggestion', 'type' => 'int', 'internal' => 'suggestion'],
'purchase_order_suggestion_element_item' => ['name' => 'purchase_order_suggestion_element_item', 'type' => 'int', 'internal' => 'item'],
'purchase_order_suggestion_element_bill' => ['name' => 'purchase_order_suggestion_element_bill', 'type' => 'int', 'internal' => 'bill'],
'purchase_order_suggestion_element_supplier' => ['name' => 'purchase_order_suggestion_element_supplier', 'type' => 'int', 'internal' => 'supplier'],
'purchase_order_suggestion_element_quantity' => ['name' => 'purchase_order_suggestion_element_quantity', 'type' => 'Serializable', 'internal' => 'quantity'],
'purchase_order_suggestion_element_costs' => ['name' => 'purchase_order_suggestion_element_costs', 'type' => 'Serializable', 'internal' => 'costs'],
'purchase_order_suggestion_element_supplier' => ['name' => 'purchase_order_suggestion_element_supplier', 'type' => 'int', 'internal' => 'supplier'],
'purchase_order_suggestion_element_quantity' => ['name' => 'purchase_order_suggestion_element_quantity', 'type' => 'Serializable', 'internal' => 'quantity'],
'purchase_order_suggestion_element_costs' => ['name' => 'purchase_order_suggestion_element_costs', 'type' => 'Serializable', 'internal' => 'costs'],
];
/**

View File

@ -18,14 +18,14 @@ use Modules\Admin\Models\AccountMapper;
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
/**
* Client mapper class.
* OrderSuggestion mapper class.
*
* @package Modules\Purchase\Models\OrderSuggestion
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*
* @template T of Client
* @template T of OrderSuggestion
* @extends DataMapperFactory<T>
*/
final class OrderSuggestionMapper extends DataMapperFactory
@ -38,9 +38,9 @@ final class OrderSuggestionMapper extends DataMapperFactory
*/
public const COLUMNS = [
'purchase_order_suggestion_id' => ['name' => 'purchase_order_suggestion_id', 'type' => 'int', 'internal' => 'id'],
'purchase_order_suggestion_status' => ['name' => 'purchase_order_suggestion_status', 'type' => 'int', 'internal' => 'status'],
'purchase_order_suggestion_status' => ['name' => 'purchase_order_suggestion_status', 'type' => 'int', 'internal' => 'status'],
'purchase_order_suggestion_created_by' => ['name' => 'purchase_order_suggestion_created_by', 'type' => 'int', 'internal' => 'createdBy'],
'purchase_order_suggestion_created_at' => ['name' => 'purchase_order_suggestion_created_at', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt'],
'purchase_order_suggestion_created_at' => ['name' => 'purchase_order_suggestion_created_at', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt'],
];
/**

View File

@ -33,5 +33,4 @@ abstract class OrderSuggestionOptimizationType extends Enum
public const COST = 2; // Suggestion focuses on creating better prices if volume discounts exist.
public const JUST_IN_TIME = 3; // Suggestion focuses on calculating minimum stock quantities.
}

View File

@ -15,17 +15,15 @@ declare(strict_types=1);
return ['Navigation' => [
'Analysis' => 'Analysis',
'Articles' => 'Articles',
'Create' => 'Create',
'Invoice' => 'Invoice',
'Invoices' => 'Invoices',
'List' => 'List',
'OrderSuggestions' => 'Order Suggestions',
'PendingOrders' => 'Pending Orders',
'Profile' => 'Profile',
'Purchase' => 'Purchase',
'Suppliers' => 'Suppliers',
'TaxCodes' => 'Tax Codes',
'TaxCombinations' => 'Tax Combinations',
'List' => 'List',
'Create' => 'Create',
'TaxCodes' => 'Tax Codes',
'TaxCombinations' => 'Tax Combinations',
'List' => 'List',
'Create' => 'Create',
]];

View File

@ -13,12 +13,12 @@
declare(strict_types=1);
return ['Purchase' => [
'Created' => 'خلقت',
'Creator' => 'المنشئ',
'Order' => 'طلب',
'Ordered' => 'أمر',
'Price' => 'السعر',
'Status' => 'حالة',
'Stock' => 'المخزون',
'Supplier' => 'المورد',
'Created' => 'خلقت',
'Creator' => 'المنشئ',
'Order' => 'طلب',
'Ordered' => 'أمر',
'Price' => 'السعر',
'Status' => 'حالة',
'Stock' => 'المخزون',
'Supplier' => 'المورد',
]];

View File

@ -13,12 +13,12 @@
declare(strict_types=1);
return ['Purchase' => [
'Created' => 'Vytvořený',
'Creator' => 'Tvůrce',
'Order' => 'Objednat',
'Ordered' => 'Objednaný',
'Price' => 'Cena',
'Status' => 'Postavení',
'Stock' => 'Skladem',
'Supplier' => 'Dodavatel',
'Created' => 'Vytvořený',
'Creator' => 'Tvůrce',
'Order' => 'Objednat',
'Ordered' => 'Objednaný',
'Price' => 'Cena',
'Status' => 'Postavení',
'Stock' => 'Skladem',
'Supplier' => 'Dodavatel',
]];

View File

@ -13,12 +13,12 @@
declare(strict_types=1);
return ['Purchase' => [
'Created' => 'Oprettet',
'Creator' => 'Skaber.',
'Order' => 'Bestille',
'Ordered' => 'Bestilt.',
'Price' => 'Pris',
'Status' => 'Status.',
'Stock' => 'Lager',
'Supplier' => 'Leverandør',
'Created' => 'Oprettet',
'Creator' => 'Skaber.',
'Order' => 'Bestille',
'Ordered' => 'Bestilt.',
'Price' => 'Pris',
'Status' => 'Status.',
'Stock' => 'Lager',
'Supplier' => 'Leverandør',
]];

View File

@ -13,48 +13,43 @@
declare(strict_types=1);
return ['Purchase' => [
'Created' => 'Erstellt',
'Creator' => 'Ersteller',
'Order' => 'Befehl',
'Ordered' => 'Bestellt',
'Price' => 'Preis',
'Status' => 'Status',
'Stock' => 'Aktie',
'Order' => 'Bestellen',
'Item' => 'Artikel',
'Created' => 'Erstellt',
'Creator' => 'Ersteller',
'Order' => 'Befehl',
'Price' => 'Preis',
'Status' => 'Status',
'Item' => 'Artikel',
'Supplier' => 'Lieferant',
'Stock' => 'Lager',
'Stock' => 'Lager',
'Reserved' => 'Reserviert',
'Ordered' => 'Bestellt',
'AvgConsumption' => 'Ø Verbrauch',
'Range1' => 'Reichw. 1',
'Range2' => 'Reichw. 2',
'Ordered' => 'Bestellt',
'AvgConsumption' => 'Ø Verbrauch',
'Range1' => 'Reichw. 1',
'Range2' => 'Reichw. 2',
'MinStock' => 'Min. Lager',
'MinOrder' => 'Min. Bestellmenge',
'MinRange' => 'Min. Reichw.',
'Steps' => 'Schritte',
'Steps' => 'Schritte',
'Ordering' => 'Bestellen',
'NewRange' => 'Neue Reichw.',
'Price' => 'Preis',
'Total' => 'Gesamt',
'Costs' => 'Kosten',
':SuggestionStatus-1' => 'Entwurf',
':SuggestionStatus-2' => 'Gelöscht',
':SuggestionStatus-3' => 'Bestellt',
':OptimizationAlgorithm-0' => 'Artikel specifisch',
':OptimizationAlgorithm-1' => 'Verfügbarkeit',
':OptimizationAlgorithm-2' => 'Kosten',
':OptimizationAlgorithm-3' => 'Just in time',
'Elements' => 'Elemente',
'Algorithm' => 'Algorithmus',
'Analyze' => 'Analysiere',
'Segment' => 'Segment',
'HideIrrelevant' => 'Nur relevante',
'Section' => 'Sparte',
'SalesGroup' => 'Umsatzgruppe',
'ProductGroup' => 'Produktgruppe',
'MinRange' => 'Min.-Reichweite',
'OrderSuggestions' => 'Bestellvorschläge',
'OrderSuggestion' => 'Bestellvorschlag',
'Total' => 'Gesamt',
'Costs' => 'Kosten',
':SuggestionStatus-1' => 'Entwurf',
':SuggestionStatus-2' => 'Gelöscht',
':SuggestionStatus-3' => 'Bestellt',
':OptimizationAlgorithm-0' => 'Artikel specifisch',
':OptimizationAlgorithm-1' => 'Verfügbarkeit',
':OptimizationAlgorithm-2' => 'Kosten',
':OptimizationAlgorithm-3' => 'Just in time',
'Elements' => 'Elemente',
'Algorithm' => 'Algorithmus',
'Analyze' => 'Analysiere',
'Segment' => 'Segment',
'HideIrrelevant' => 'Nur relevante',
'Section' => 'Sparte',
'SalesGroup' => 'Umsatzgruppe',
'ProductGroup' => 'Produktgruppe',
'OrderSuggestions' => 'Bestellvorschläge',
'OrderSuggestion' => 'Bestellvorschlag',
'Suggestions' => 'Vorschläge',
]];

View File

@ -13,12 +13,12 @@
declare(strict_types=1);
return ['Purchase' => [
'Created' => 'Δημιουργήθηκε',
'Creator' => 'Δημιουργός',
'Order' => 'Σειρά',
'Ordered' => 'Διέταξε',
'Price' => 'Τιμή',
'Status' => 'Κατάσταση',
'Stock' => 'Στοκ',
'Supplier' => 'Προμηθευτής',
'Created' => 'Δημιουργήθηκε',
'Creator' => 'Δημιουργός',
'Order' => 'Σειρά',
'Ordered' => 'Διέταξε',
'Price' => 'Τιμή',
'Status' => 'Κατάσταση',
'Stock' => 'Στοκ',
'Supplier' => 'Προμηθευτής',
]];

View File

@ -13,48 +13,42 @@
declare(strict_types=1);
return ['Purchase' => [
'Created' => 'Created',
'Creator' => 'Creator',
'Order' => 'Order',
'Ordered' => 'Ordered',
'Price' => 'Price',
'Status' => 'Status',
'Stock' => 'Stock',
'Supplier' => 'Supplier',
'Order' => 'Order',
'Item' => 'Item',
'Created' => 'Created',
'Creator' => 'Creator',
'Status' => 'Status',
'Order' => 'Order',
'Item' => 'Item',
'Supplier' => 'Supplier',
'Stock' => 'Stock',
'Stock' => 'Stock',
'Reserved' => 'Reserved',
'Ordered' => 'Ordered',
'AvgConsumption' => 'Ø Cons.',
'Range1' => 'Range 1',
'Range2' => 'Range 2',
'Ordered' => 'Ordered',
'AvgConsumption' => 'Ø Cons.',
'Range1' => 'Range 1',
'Range2' => 'Range 2',
'MinStock' => 'Min. Stock',
'MinOrder' => 'Min. Order',
'MinRange' => 'Min. Range',
'Steps' => 'Steps',
'Steps' => 'Steps',
'Ordering' => 'Ordering',
'NewRange' => 'New Range',
'Price' => 'Price',
'Total' => 'Total',
'Costs' => 'Costs',
':SuggestionStatus-1' => 'Draft',
':SuggestionStatus-2' => 'DELETED',
':SuggestionStatus-3' => 'ORDERED',
':OptimizationAlgorithm-0' => 'Item specific',
':OptimizationAlgorithm-1' => 'Availability optimization',
':OptimizationAlgorithm-2' => 'Cost optimization',
':OptimizationAlgorithm-3' => 'Just in time',
'Elements' => 'Elements',
'Algorithm' => 'Algorithm',
'Analyze' => 'Analyze',
'Segment' => 'Segment',
'HideIrrelevant' => 'Hide irrelevant',
'Section' => 'Section',
'SalesGroup' => 'Sales Group',
'ProductGroup' => 'Product Group',
'MinRange' => 'Min. Range',
'OrderSuggestions' => 'Order Suggestions',
'Price' => 'Price',
'Total' => 'Total',
'Costs' => 'Costs',
':SuggestionStatus-1' => 'Draft',
':SuggestionStatus-2' => 'DELETED',
':SuggestionStatus-3' => 'ORDERED',
':OptimizationAlgorithm-0' => 'Item specific',
':OptimizationAlgorithm-1' => 'Availability optimization',
':OptimizationAlgorithm-2' => 'Cost optimization',
':OptimizationAlgorithm-3' => 'Just in time',
'Elements' => 'Elements',
'Algorithm' => 'Algorithm',
'Analyze' => 'Analyze',
'Segment' => 'Segment',
'HideIrrelevant' => 'Hide irrelevant',
'Section' => 'Section',
'SalesGroup' => 'Sales Group',
'ProductGroup' => 'Product Group',
'MinRange' => 'Min. Range',
'OrderSuggestions' => 'Order Suggestions',
'Suggestions' => 'Suggestions',
]];

View File

@ -13,12 +13,12 @@
declare(strict_types=1);
return ['Purchase' => [
'Created' => 'Creado',
'Creator' => 'Creador',
'Order' => 'Pedido',
'Ordered' => 'Ordenado',
'Price' => 'Precio',
'Status' => 'Estado',
'Stock' => 'Valores',
'Supplier' => 'Proveedor',
'Created' => 'Creado',
'Creator' => 'Creador',
'Order' => 'Pedido',
'Ordered' => 'Ordenado',
'Price' => 'Precio',
'Status' => 'Estado',
'Stock' => 'Valores',
'Supplier' => 'Proveedor',
]];

View File

@ -13,12 +13,12 @@
declare(strict_types=1);
return ['Purchase' => [
'Created' => 'Luotu',
'Creator' => 'Luoja',
'Order' => 'Tilaus',
'Ordered' => 'Tilattu',
'Price' => 'Hinta',
'Status' => 'Tila',
'Stock' => 'Varasto',
'Supplier' => 'Toimittaja',
'Created' => 'Luotu',
'Creator' => 'Luoja',
'Order' => 'Tilaus',
'Ordered' => 'Tilattu',
'Price' => 'Hinta',
'Status' => 'Tila',
'Stock' => 'Varasto',
'Supplier' => 'Toimittaja',
]];

View File

@ -13,12 +13,12 @@
declare(strict_types=1);
return ['Purchase' => [
'Created' => 'Établi',
'Creator' => 'Créateur',
'Order' => 'Commander',
'Ordered' => 'Commandé',
'Price' => 'Prix',
'Status' => 'Statut',
'Stock' => 'Stocker',
'Supplier' => 'Fournisseur',
'Created' => 'Établi',
'Creator' => 'Créateur',
'Order' => 'Commander',
'Ordered' => 'Commandé',
'Price' => 'Prix',
'Status' => 'Statut',
'Stock' => 'Stocker',
'Supplier' => 'Fournisseur',
]];

View File

@ -13,12 +13,12 @@
declare(strict_types=1);
return ['Purchase' => [
'Created' => 'Létrehozott',
'Creator' => 'Teremtő',
'Order' => 'Rendelés',
'Ordered' => 'Elrendelt',
'Price' => 'Ár',
'Status' => 'Állapot',
'Stock' => 'Készlet',
'Supplier' => 'Támogató',
'Created' => 'Létrehozott',
'Creator' => 'Teremtő',
'Order' => 'Rendelés',
'Ordered' => 'Elrendelt',
'Price' => 'Ár',
'Status' => 'Állapot',
'Stock' => 'Készlet',
'Supplier' => 'Támogató',
]];

View File

@ -13,12 +13,12 @@
declare(strict_types=1);
return ['Purchase' => [
'Created' => 'Creato',
'Creator' => 'Creatore',
'Order' => 'Ordine',
'Ordered' => 'Ordinato',
'Price' => 'Prezzo',
'Status' => 'Stato',
'Stock' => 'Azione',
'Supplier' => 'Fornitore',
'Created' => 'Creato',
'Creator' => 'Creatore',
'Order' => 'Ordine',
'Ordered' => 'Ordinato',
'Price' => 'Prezzo',
'Status' => 'Stato',
'Stock' => 'Azione',
'Supplier' => 'Fornitore',
]];

View File

@ -13,12 +13,12 @@
declare(strict_types=1);
return ['Purchase' => [
'Created' => '作成した',
'Creator' => 'クリエーター',
'Order' => '注文',
'Ordered' => '順序付けられました',
'Price' => '価格',
'Status' => '状態',
'Stock' => 'ストック',
'Supplier' => 'サプライヤー',
'Created' => '作成した',
'Creator' => 'クリエーター',
'Order' => '注文',
'Ordered' => '順序付けられました',
'Price' => '価格',
'Status' => '状態',
'Stock' => 'ストック',
'Supplier' => 'サプライヤー',
]];

View File

@ -13,12 +13,12 @@
declare(strict_types=1);
return ['Purchase' => [
'Created' => '만들어진',
'Creator' => '창조자',
'Order' => '주문하다',
'Ordered' => '주문했다',
'Price' => '가격',
'Status' => '상태',
'Stock' => '재고',
'Supplier' => '공급자',
'Created' => '만들어진',
'Creator' => '창조자',
'Order' => '주문하다',
'Ordered' => '주문했다',
'Price' => '가격',
'Status' => '상태',
'Stock' => '재고',
'Supplier' => '공급자',
]];

View File

@ -13,12 +13,12 @@
declare(strict_types=1);
return ['Purchase' => [
'Created' => 'Opprettet',
'Creator' => 'Skaperen.',
'Order' => 'Rekkefølge',
'Ordered' => 'Bestilt',
'Price' => 'Pris',
'Status' => 'Status',
'Stock' => 'Lager',
'Supplier' => 'Leverandør',
'Created' => 'Opprettet',
'Creator' => 'Skaperen.',
'Order' => 'Rekkefølge',
'Ordered' => 'Bestilt',
'Price' => 'Pris',
'Status' => 'Status',
'Stock' => 'Lager',
'Supplier' => 'Leverandør',
]];

View File

@ -13,12 +13,12 @@
declare(strict_types=1);
return ['Purchase' => [
'Created' => 'Utworzony',
'Creator' => 'Twórca',
'Order' => 'Zamówienie',
'Ordered' => 'Uporządkowany',
'Price' => 'Cena £',
'Status' => 'Status',
'Stock' => 'Magazyn',
'Supplier' => 'Dostawca',
'Created' => 'Utworzony',
'Creator' => 'Twórca',
'Order' => 'Zamówienie',
'Ordered' => 'Uporządkowany',
'Price' => 'Cena £',
'Status' => 'Status',
'Stock' => 'Magazyn',
'Supplier' => 'Dostawca',
]];

View File

@ -13,12 +13,12 @@
declare(strict_types=1);
return ['Purchase' => [
'Created' => 'Criado',
'Creator' => 'O Criador',
'Order' => 'Pedido',
'Ordered' => 'Encomendado',
'Price' => 'Preço',
'Status' => 'Status',
'Stock' => 'Estoque',
'Supplier' => 'Fornecedor',
'Created' => 'Criado',
'Creator' => 'O Criador',
'Order' => 'Pedido',
'Ordered' => 'Encomendado',
'Price' => 'Preço',
'Status' => 'Status',
'Stock' => 'Estoque',
'Supplier' => 'Fornecedor',
]];

View File

@ -13,12 +13,12 @@
declare(strict_types=1);
return ['Purchase' => [
'Created' => 'Созданный',
'Creator' => 'Создатель',
'Order' => 'Заказ',
'Ordered' => 'Заказал',
'Price' => 'Цена',
'Status' => 'Статус',
'Stock' => 'Склад',
'Supplier' => 'Поставщик',
'Created' => 'Созданный',
'Creator' => 'Создатель',
'Order' => 'Заказ',
'Ordered' => 'Заказал',
'Price' => 'Цена',
'Status' => 'Статус',
'Stock' => 'Склад',
'Supplier' => 'Поставщик',
]];

View File

@ -13,12 +13,12 @@
declare(strict_types=1);
return ['Purchase' => [
'Created' => 'Skapad',
'Creator' => 'Skapare',
'Order' => 'Beställa',
'Ordered' => 'Beställde',
'Price' => 'Pris',
'Status' => 'Status',
'Stock' => 'Stock',
'Supplier' => 'Leverantör',
'Created' => 'Skapad',
'Creator' => 'Skapare',
'Order' => 'Beställa',
'Ordered' => 'Beställde',
'Price' => 'Pris',
'Status' => 'Status',
'Stock' => 'Stock',
'Supplier' => 'Leverantör',
]];

View File

@ -13,12 +13,12 @@
declare(strict_types=1);
return ['Purchase' => [
'Created' => 'สร้าง',
'Creator' => 'ผู้สร้าง',
'Order' => 'คำสั่ง',
'Ordered' => 'ที่ได้รับคำสั่ง',
'Price' => 'ราคา',
'Status' => 'สถานะ',
'Stock' => 'คลังสินค้า',
'Supplier' => 'ผู้ผลิต',
'Created' => 'สร้าง',
'Creator' => 'ผู้สร้าง',
'Order' => 'คำสั่ง',
'Ordered' => 'ที่ได้รับคำสั่ง',
'Price' => 'ราคา',
'Status' => 'สถานะ',
'Stock' => 'คลังสินค้า',
'Supplier' => 'ผู้ผลิต',
]];

View File

@ -13,12 +13,12 @@
declare(strict_types=1);
return ['Purchase' => [
'Created' => 'Yaratılmış',
'Creator' => 'Yaratıcı',
'Order' => 'Emir',
'Ordered' => 'Emir',
'Price' => 'Fiyat',
'Status' => 'Durum',
'Stock' => 'Stoklamak',
'Supplier' => 'Tedarikçi',
'Created' => 'Yaratılmış',
'Creator' => 'Yaratıcı',
'Order' => 'Emir',
'Ordered' => 'Emir',
'Price' => 'Fiyat',
'Status' => 'Durum',
'Stock' => 'Stoklamak',
'Supplier' => 'Tedarikçi',
]];

View File

@ -13,12 +13,12 @@
declare(strict_types=1);
return ['Purchase' => [
'Created' => 'Створений',
'Creator' => 'Творець',
'Order' => 'Порядок',
'Ordered' => 'Упорядкований',
'Price' => 'Ціна',
'Status' => 'Статус',
'Stock' => 'Запас',
'Supplier' => 'Постачальник',
'Created' => 'Створений',
'Creator' => 'Творець',
'Order' => 'Порядок',
'Ordered' => 'Упорядкований',
'Price' => 'Ціна',
'Status' => 'Статус',
'Stock' => 'Запас',
'Supplier' => 'Постачальник',
]];

View File

@ -13,12 +13,12 @@
declare(strict_types=1);
return ['Purchase' => [
'Created' => '创造了',
'Creator' => '创造者',
'Order' => '命令',
'Ordered' => '订购',
'Price' => '价格',
'Status' => '地位',
'Stock' => '库存',
'Supplier' => '供应商',
'Created' => '创造了',
'Creator' => '创造者',
'Order' => '命令',
'Ordered' => '订购',
'Price' => '价格',
'Status' => '地位',
'Stock' => '库存',
'Supplier' => '供应商',
]];

View File

@ -65,12 +65,12 @@ echo $this->data['nav']->render();
<td><?= $this->getHtml('Costs'); ?>
<tbody>
<?php
$now = new SmartDateTime('now');
$total = new FloatInt();
$subtotal = new FloatInt();
$now = new SmartDateTime('now');
$total = new FloatInt();
$subtotal = new FloatInt();
$lastSupplier = 0;
$supplier = $this->request->getDataString('supplier');
$supplier = $this->request->getDataString('supplier');
$hasSupplierSwitch = false;
$isFirst = true;
@ -89,7 +89,7 @@ echo $this->data['nav']->render();
<?php
if (empty($supplier) && $lastSupplier !== $element->supplier->id && !$isFirst) :
$hasSupplierSwitch = true;
$lastSupplier = $element->supplier->id;
$lastSupplier = $element->supplier->id;
?>
<tr class="hl-7">
<td colspan="15"><?= $this->printHtml($element->supplier->account->name1); ?> <?= $this->printHtml($element->supplier->account->name2); ?>
@ -125,7 +125,7 @@ echo $this->data['nav']->render();
(int) ($months = ($this->data['suggestion_data'][$element->item->id]['range_ordered']
+ $this->data['suggestion_data'][$element->item->id]['range_reserved'])),
(int) (($months - ((int) $months)) * 30))
->format('Y-m-d')
->format('Y-m-d');
?>
<td><?= $this->data['suggestion_data'][$element->item->id]['singlePrice']->getAmount(); ?>
<td><?= $element->costs->getAmount(); ?>