mirror of
https://github.com/Karaka-Management/oms-ItemManagement.git
synced 2026-01-11 11:48:41 +00:00
update
This commit is contained in:
parent
10752eee16
commit
609071e480
|
|
@ -91,10 +91,10 @@
|
|||
"values": []
|
||||
},
|
||||
{
|
||||
"name": "maximum_order_interval",
|
||||
"name": "minimum_order_quantity",
|
||||
"l11n": {
|
||||
"en": "Maximum order interval",
|
||||
"de": "Maximale Bestellhäufigkeit"
|
||||
"en": "MOQ",
|
||||
"de": "Mindestbestellmenge"
|
||||
},
|
||||
"value_type": 1,
|
||||
"is_custom_allowed": true,
|
||||
|
|
@ -104,10 +104,23 @@
|
|||
"values": []
|
||||
},
|
||||
{
|
||||
"name": "minimum_order_quantity",
|
||||
"name": "order_quantity_steps",
|
||||
"l11n": {
|
||||
"en": "MOQ",
|
||||
"de": "Mindestbestellmenge"
|
||||
"en": "Order quantity steps",
|
||||
"de": "Bestellschritte"
|
||||
},
|
||||
"value_type": 1,
|
||||
"is_custom_allowed": true,
|
||||
"validation_pattern": "",
|
||||
"is_required": false,
|
||||
"default_value": "",
|
||||
"values": []
|
||||
},
|
||||
{
|
||||
"name": "minimum_stock_range",
|
||||
"l11n": {
|
||||
"en": "Minimum stock range",
|
||||
"de": "Mindestreichweite"
|
||||
},
|
||||
"value_type": 1,
|
||||
"is_custom_allowed": true,
|
||||
|
|
|
|||
|
|
@ -43,6 +43,11 @@
|
|||
"type": "TINYINT(1)",
|
||||
"null": false
|
||||
},
|
||||
"itemmgmt_item_createdat": {
|
||||
"name": "itemmgmt_item_createdat",
|
||||
"type": "DATETIME",
|
||||
"null": false
|
||||
},
|
||||
"itemmgmt_item_parent": {
|
||||
"name": "itemmgmt_item_parent",
|
||||
"type": "INT(11)",
|
||||
|
|
|
|||
|
|
@ -214,7 +214,7 @@ final class ApiController extends Controller
|
|||
$uploadedFiles = $request->files['item_profile_image'] ?? [];
|
||||
if (!empty($uploadedFiles)) {
|
||||
// upload image
|
||||
$uploaded = $this->app->moduleManager->get('Media')->uploadFiles(
|
||||
$uploaded = $this->app->moduleManager->get('Media', 'Api')->uploadFiles(
|
||||
names: [],
|
||||
fileNames: [],
|
||||
files: $uploadedFiles,
|
||||
|
|
@ -676,7 +676,7 @@ final class ApiController extends Controller
|
|||
|
||||
$path = $this->createItemDir($item);
|
||||
|
||||
$uploaded = $this->app->moduleManager->get('Media')->uploadFiles(
|
||||
$uploaded = $this->app->moduleManager->get('Media', 'Api')->uploadFiles(
|
||||
names: $request->getDataList('names'),
|
||||
fileNames: $request->getDataList('filenames'),
|
||||
files: $uploadedFiles,
|
||||
|
|
|
|||
|
|
@ -216,62 +216,15 @@ final class BackendController extends Controller
|
|||
$reserved = [];
|
||||
$ordered = [];
|
||||
if ($this->app->moduleManager->isActive('WarehouseManagement')) {
|
||||
$itemIds = \array_map(function (Item $item) { return $item->id;
|
||||
$itemIds = \array_map(function (Item $item) {
|
||||
return $item->id;
|
||||
}, $items);
|
||||
$itemIdsString = \implode(',', $itemIds);
|
||||
|
||||
// @todo only select sales stock. Therefore we need a place to define the sales stock(s)
|
||||
$temp = \Modules\WarehouseManagement\Models\StockDistributionMapper::getAll()
|
||||
->where('item', $itemIds, 'IN')
|
||||
->execute();
|
||||
$distributions = \Modules\WarehouseManagement\Models\StockMapper::getStockDistribution($itemIds);
|
||||
|
||||
foreach ($temp as $t) {
|
||||
if (!isset($dists[$t->item])) {
|
||||
$dists[$t->item] = [];
|
||||
}
|
||||
|
||||
// @todo These numbers might need adjustments for delivery notes/invoices depending on
|
||||
// how we implement them in the warehouse management (maybe flag them in the transaction protocol as reserved?)
|
||||
// also remember the SD issue where delivery notes can be technically still in stock -> stock value still belongs to company
|
||||
// solution: "just" do a soft adjust of the available numbers?! but don't change the actual stock in the db
|
||||
// the SD solution where actually delivered delivery notes can be adjusted after "archiving" will not be allowed
|
||||
// to allow them to see what happened with such a delivery note maybe we can implement a view shows how many of the items are
|
||||
// actually still outstanding. This shouldn't be anything special since we need importing of delivery notes anyways and marking
|
||||
// old delivery note elements in a way to show which line items or even sub-line items got invoiced/returned etc.
|
||||
$dists[$t->item][] = $t;
|
||||
}
|
||||
|
||||
$stockIdentifier = StockIdentifierType::NONE;
|
||||
|
||||
$sql = <<<SQL
|
||||
SELECT billing_bill_element.billing_bill_element_item,
|
||||
billing_type.billing_type_name,
|
||||
SUM(billing_bill_element.billing_bill_element_quantity) AS quantity
|
||||
FROM billing_bill_element
|
||||
LEFT JOIN itemmgmt_item ON billing_bill_element.billing_bill_element_item = itemmgmt_item.itemmgmt_item_id
|
||||
LEFT JOIN billing_bill ON billing_bill_element.billing_bill_element_bill = billing_bill.billing_bill_id
|
||||
LEFT JOIN billing_type ON billing_bill.billing_bill_type = billing_type.billing_type_id
|
||||
WHERE billing_bill_element.billing_bill_element_item IN ({$itemIdsString})
|
||||
AND itemmgmt_item.itemmgmt_item_stockidentifier != {$stockIdentifier}
|
||||
AND billing_type.billing_type_name IN ('sales_order_confirmation', 'purchase_order')
|
||||
GROUP BY billing_bill_element.billing_bill_element_item, billing_type.billing_type_name;
|
||||
SQL;
|
||||
|
||||
$query = new Builder($this->app->dbPool->get());
|
||||
$results = $query->raw($sql)->execute()->fetchAll(\PDO::FETCH_ASSOC);
|
||||
|
||||
foreach ($results as $result) {
|
||||
if (!isset($reserved[(int) $result['billing_bill_element_item']])) {
|
||||
$reserved[(int) $result['billing_bill_element_item']] = 0;
|
||||
$ordered[(int) $result['billing_bill_element_item']] = 0;
|
||||
}
|
||||
|
||||
if ($result['billing_type_name'] === 'sales_order_confirmation') {
|
||||
$reserved[(int) $result['billing_bill_element_item']] += (int) $result['quantity'];
|
||||
} else {
|
||||
$ordered[(int) $result['billing_bill_element_item']] += (int) $result['quantity'];
|
||||
}
|
||||
}
|
||||
$dists = $distributions['dists'];
|
||||
$reserved = $distributions['reserved'];
|
||||
$ordered = $distributions['ordered'];
|
||||
}
|
||||
|
||||
$view->data['dists'] = $dists;
|
||||
|
|
@ -457,10 +410,8 @@ final class BackendController extends Controller
|
|||
->execute();
|
||||
|
||||
// Get item profile image
|
||||
// It might not be part of the 5 newest item files from above
|
||||
// @todo It would be nice to have something like this as a default method in the model e.g.
|
||||
// ItemManagement::getRelations()->with('types')->where(...);
|
||||
// This should return the relations and NOT the model itself
|
||||
// @feature Create a new read mapper function that returns relation models instead of its own model
|
||||
// https://github.com/Karaka-Management/phpOMS/issues/320
|
||||
$query = new Builder($this->app->dbPool->get());
|
||||
$results = $query->selectAs(ItemMapper::HAS_MANY['files']['external'], 'file')
|
||||
->from(ItemMapper::TABLE)
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@ final class ItemMapper extends DataMapperFactory
|
|||
'itemmgmt_item_purchaseprice' => ['name' => 'itemmgmt_item_purchaseprice', 'type' => 'Serializable', 'internal' => 'purchasePrice'],
|
||||
'itemmgmt_item_parent' => ['name' => 'itemmgmt_item_parent', 'type' => 'int', 'internal' => 'parent'],
|
||||
'itemmgmt_item_unit' => ['name' => 'itemmgmt_item_unit', 'type' => 'int', 'internal' => 'unit'],
|
||||
'itemmgmt_item_createdat' => ['name' => 'itemmgmt_item_createdat', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt'],
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -616,10 +616,7 @@ echo $this->data['nav']->render(); ?>
|
|||
</div>
|
||||
|
||||
<!--
|
||||
@todo
|
||||
maybe put a master variations selection at the beginning so that you need to change it for other variations...
|
||||
this way you will however not be able to see all at once only one at a time
|
||||
make container in packaging department that can be used by packaging for sales and purchase
|
||||
@todo make container in packaging department that can be used by packaging for sales and purchase
|
||||
Shelf life (stock???)
|
||||
Packaging dimension+weight+units for different types (pallet, case etc.)
|
||||
Language for all variations based on variables: e.g. ${size} T-shirt in ${color}
|
||||
|
|
|
|||
|
|
@ -323,7 +323,7 @@ echo $this->data['nav']->render();
|
|||
<?php endif; ?>
|
||||
|
||||
<?php
|
||||
$monthlySalesCosts = SalesBillMapper::getItemMonthlySalesCosts($item->id, (new SmartDateTime('now'))->createModify(-1), new SmartDateTime('now'));
|
||||
$monthlySalesCosts = SalesBillMapper::getItemMonthlySalesCosts([$item->id], (new SmartDateTime('now'))->createModify(-1), new SmartDateTime('now'));
|
||||
if (!empty($monthlySalesCosts)) : ?>
|
||||
<div class="col-xs-12 col-lg-6">
|
||||
<section class="portlet">
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user