fix php version, lang files, basic tpl and sales impl.

This commit is contained in:
Dennis Eichhorn 2021-03-05 21:01:37 +01:00
parent 532f5e810c
commit 345f68f14f
32 changed files with 835 additions and 1032 deletions

25
Admin/Hooks/Web/Api.php Normal file
View File

@ -0,0 +1,25 @@
<?php
/**
* Orange Management
*
* PHP Version 8.0
*
* @package Modules\WarehouseManagement
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
return [
'POST:Module:ClientManagement-client-create' => [
'callback' => ['\Modules\WarehouseManagement\Controller\ApiController:eventStockCreateInternal'],
],
'POST:Module:SupplierManagement-supplier-create' => [
'callback' => ['\Modules\WarehouseManagement\Controller\ApiController:eventStockCreateInternal'],
],
'/POST:Module:Billing\-bill(_element)*\-(create|delete|update)/' => [
'callback' => ['\Modules\WarehouseManagement\Controller\ApiController:eventBillUpdateInternal'],
],
];

View File

@ -9,10 +9,56 @@
"target": "self",
"icon": "fa fa-cube",
"order": 40,
"from": "Warehousing",
"from": "WarehouseManagement",
"permission": { "permission": 2, "type": null, "element": null },
"parent": 0,
"children": [
{
"id": 1001302001,
"pid": "/",
"type": 2,
"subtype": 1,
"name": "Stock",
"uri": "{/prefix}warehouse/stock/list",
"target": "self",
"icon": null,
"order": 1,
"from": "WarehouseManagement",
"permission": { "permission": 2, "type": null, "element": null },
"parent": 1001301001,
"children": [
{
"id": 1001303001,
"pid": "/warehouse/stock",
"type": 3,
"subtype": 1,
"name": "Stocks",
"uri": "{/prefix}warehouse/stock/list",
"target": "self",
"icon": null,
"order": 1,
"from": "WarehouseManagement",
"permission": { "permission": 2, "type": null, "element": null },
"parent": 1001302001,
"children": []
},
{
"id": 1001303002,
"pid": "/warehouse/stock",
"type": 3,
"subtype": 1,
"name": "Locations",
"uri": "{/prefix}warehouse/stock/location/list",
"target": "self",
"icon": null,
"order": 1,
"from": "WarehouseManagement",
"permission": { "permission": 2, "type": null, "element": null },
"parent": 1001302001,
"children": []
}
]
}
]
}
]

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.4
* PHP Version 8.0
*
* @package Modules\WarehouseManagement\Admin\Install
* @copyright Dennis Eichhorn

View File

@ -267,7 +267,8 @@
"warehousemgmt_movement_lot": {
"name": "warehousemgmt_movement_lot",
"type": "INT",
"null": false,
"null": true,
"default": null,
"foreignTable": "warehousemgmt_lot",
"foreignKey": "warehousemgmt_lot_id"
},
@ -293,6 +294,7 @@
"null": false
},
"warehousemgmt_movement_subtype": {
"description": "Destroy, return, sale, purchase, ...",
"name": "warehousemgmt_movement_subtype",
"type": "INT",
"null": false,

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.4
* PHP Version 8.0
*
* @package Modules\WarehouseManagement\Admin
* @copyright Dennis Eichhorn
@ -14,7 +14,15 @@ declare(strict_types=1);
namespace Modules\WarehouseManagement\Admin;
use phpOMS\Config\SettingsInterface;
use phpOMS\DataStorage\Database\DatabasePool;
use phpOMS\Localization\ISO639x1Enum;
use phpOMS\Module\InstallerAbstract;
use phpOMS\Module\ModuleInfo;
use Modules\WarehouseManagement\Models\Stock;
use Modules\WarehouseManagement\Models\StockMapper;
use Modules\WarehouseManagement\Models\StockLocation;
use Modules\WarehouseManagement\Models\StockLocationMapper;
/**
* Installer class.
@ -26,4 +34,24 @@ use phpOMS\Module\InstallerAbstract;
*/
final class Installer extends InstallerAbstract
{
/**
* {@inheritdoc}
*/
public static function install(DatabasePool $dbPool, ModuleInfo $info, SettingsInterface $cfgHandler) : void
{
parent::install($dbPool, $info, $cfgHandler);
self::createStock();
}
private static function createStock() : void
{
$stock = new Stock('Default');
$stock->type = 0;
StockMapper::create($stock);
$stockLocation = new StockLocation((string) ($stock->getId() . '-1'));
$stockLocation->stock = $stock;
StockLocationMapper::create($stockLocation);
}
}

View File

@ -1,3 +1,65 @@
<?php declare(strict_types=1);
<?php
/**
* Orange Management
*
* PHP Version 8.0
*
* @package Modules\WarehouseManagement
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
return [];
use Modules\WarehouseManagement\Controller\BackendController;
use Modules\WarehouseManagement\Models\PermissionState;
use phpOMS\Account\PermissionType;
use phpOMS\Router\RouteVerb;
return [
'^.*/warehouse/stock/list.*$' => [
[
'dest' => '\Modules\WarehouseManagement\Controller\BackendController:viewStockList',
'verb' => RouteVerb::GET,
'permission' => [
'module' => BackendController::MODULE_NAME,
'type' => PermissionType::READ,
'state' => PermissionState::STOCK,
],
],
],
'^.*/warehouse/stock(\?.*)?$' => [
[
'dest' => '\Modules\WarehouseManagement\Controller\BackendController:viewStock',
'verb' => RouteVerb::GET,
'permission' => [
'module' => BackendController::MODULE_NAME,
'type' => PermissionType::READ,
'state' => PermissionState::STOCK,
],
],
],
'^.*/warehouse/stock/location/list.*$' => [
[
'dest' => '\Modules\WarehouseManagement\Controller\BackendController:viewStockLocationList',
'verb' => RouteVerb::GET,
'permission' => [
'module' => BackendController::MODULE_NAME,
'type' => PermissionType::READ,
'state' => PermissionState::STOCK_LOCATION,
],
],
],
'^.*/warehouse/stock/location(\?.*)?$' => [
[
'dest' => '\Modules\WarehouseManagement\Controller\BackendController:viewStockLocation',
'verb' => RouteVerb::GET,
'permission' => [
'module' => BackendController::MODULE_NAME,
'type' => PermissionType::READ,
'state' => PermissionState::STOCK_LOCATION,
],
],
],
];

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.4
* PHP Version 8.0
*
* @package Modules\WarehouseManagement\Admin
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.4
* PHP Version 8.0
*
* @package Modules\WarehouseManagement\Admin
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.4
* PHP Version 8.0
*
* @package Modules\WarehouseManagement\Admin
* @copyright Dennis Eichhorn

View File

@ -0,0 +1,84 @@
<?php
/**
* Orange Management
*
* PHP Version 8.0
*
* @package Modules\WarehouseManagement
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
namespace Modules\WarehouseManagement\Controller;
use Modules\Admin\Models\NullAccount;
use Modules\WarehouseManagement\Models\Stock;
use Modules\WarehouseManagement\Models\StockMapper;
use Modules\WarehouseManagement\Models\StockLocation;
use Modules\WarehouseManagement\Models\StockLocationMapper;
/**
* WarehouseManagement api controller class.
*
* @package Modules\WarehouseManagement
* @license OMS License 1.0
* @link https://orange-management.org
* @since 1.0.0
*/
final class ApiController extends Controller
{
public function eventStockCreateInternal(
int $account,
mixed $old,
mixed $new,
int $type = 0,
string $trigger = '',
string $module = null,
string $ref = null,
string $content = null,
string $ip = null
) : void
{
$stock = new Stock($new->number);
$stock->type = 1;
StockMapper::create($stock);
$stockLocation = new StockLocation($new->number . '-1');
$stockLocation->stock = $stock->getId();
StockLocationMapper::create($stockLocation);
}
public function eventBillUpdateInternal(
int $account,
mixed $old,
mixed $new,
int $type = 0,
string $trigger = '',
string $module = null,
string $ref = null,
string $content = null,
string $ip = null
) : void
{
if ($trigger === 'POST:Module:Billing-bill_element-create') {
// @todo: if is bill element create, create stock movement
} elseif ($trigger === 'POST:Module:Billing-bill_element-update') {
// quantity change
// lot changes
// stock changes
// all other changes ignore!
// check availability again, if not available abort bill
} elseif ($trigger === 'POST:Module:Billing-bill_element-delete') {
// @todo: delete stock movement
} elseif ($trigger === 'POST:Module:Billing-bill-delete') {
// @todo: delete stock movements
} elseif ($trigger === 'POST:Module:Billing-bill-update') {
// is receiver update -> change all movements
// is status update -> change all movements (delete = delete)
}
}
}

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.4
* PHP Version 8.0
*
* @package Modules\WarehouseManagement
* @copyright Dennis Eichhorn
@ -14,6 +14,13 @@ declare(strict_types=1);
namespace Modules\WarehouseManagement\Controller;
use Modules\WarehouseManagement\Models\StockMapper;
use Modules\WarehouseManagement\Models\StockLocationMapper;
use phpOMS\Contract\RenderableInterface;
use phpOMS\Message\RequestAbstract;
use phpOMS\Message\ResponseAbstract;
use phpOMS\Views\View;
/**
* WarehouseManagement class.
*
@ -24,4 +31,131 @@ namespace Modules\WarehouseManagement\Controller;
*/
final class BackendController extends Controller
{
/**
* Routing end-point for application behaviour.
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param mixed $data Generic data
*
* @return RenderableInterface Returns a renderable object
*
* @since 1.0.0
* @codeCoverageIgnore
*/
public function viewStockList(RequestAbstract $request, ResponseAbstract $response, $data = null) : RenderableInterface
{
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/WarehouseManagement/Theme/Backend/stock-list');
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1001302001, $request, $response));
if ($request->getData('ptype') === 'p') {
$view->setData('stocks',
StockMapper::withConditional('language', $response->getLanguage())
::getBeforePivot((int) ($request->getData('id') ?? 0), limit: 25)
);
} elseif ($request->getData('ptype') === 'n') {
$view->setData('stocks',
StockMapper::withConditional('language', $response->getLanguage())
::getAfterPivot((int) ($request->getData('id') ?? 0), limit: 25)
);
} else {
$view->setData('stocks',
StockMapper::withConditional('language', $response->getLanguage())
::getAfterPivot(0, limit: 25)
);
}
return $view;
}
/**
* Routing end-point for application behaviour.
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param mixed $data Generic data
*
* @return RenderableInterface Returns a renderable object
*
* @since 1.0.0
* @codeCoverageIgnore
*/
public function viewStock(RequestAbstract $request, ResponseAbstract $response, $data = null) : RenderableInterface
{
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/WarehouseManagement/Theme/Backend/stock');
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1001302001, $request, $response));
$view->setData('stock', StockMapper::get((int) $request->getData('id')));
return $view;
}
/**
* Routing end-point for application behaviour.
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param mixed $data Generic data
*
* @return RenderableInterface Returns a renderable object
*
* @since 1.0.0
* @codeCoverageIgnore
*/
public function viewStockLocationList(RequestAbstract $request, ResponseAbstract $response, $data = null) : RenderableInterface
{
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/WarehouseManagement/Theme/Backend/stock-location-list');
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1001302001, $request, $response));
if ($request->getData('ptype') === 'p') {
$view->setData('locations',
StockLocationMapper::withConditional('language', $response->getLanguage())
::getBeforePivot((int) ($request->getData('id') ?? 0), limit: 25)
);
} elseif ($request->getData('ptype') === 'n') {
$view->setData('locations',
StockLocationMapper::withConditional('language', $response->getLanguage())
::getAfterPivot((int) ($request->getData('id') ?? 0), limit: 25)
);
} else {
$view->setData('locations',
StockLocationMapper::withConditional('language', $response->getLanguage())
::getAfterPivot(0, limit: 25)
);
}
return $view;
}
/**
* Routing end-point for application behaviour.
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param mixed $data Generic data
*
* @return RenderableInterface Returns a renderable object
*
* @since 1.0.0
* @codeCoverageIgnore
*/
public function viewStockLocation(RequestAbstract $request, ResponseAbstract $response, $data = null) : RenderableInterface
{
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/WarehouseManagement/Theme/Backend/stock-location');
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1001302001, $request, $response));
$view->setData('location', StockLocationMapper::get((int) $request->getData('id')));
return $view;
}
}

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.4
* PHP Version 8.0
*
* @package Modules\WarehouseManagement
* @copyright Dennis Eichhorn

View File

@ -1,250 +0,0 @@
<?php
/**
* Orange Management
*
* PHP Version 7.4
*
* @package Modules\Warehousing\Models
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
namespace Modules\WarehouseManagement\Models;
/**
* Warehouse class.
*
* @package Modules\Warehousing\Models
* @license OMS License 1.0
* @link https://orange-management.org
* @since 1.0.0
*/
class Arrival
{
/**
* ID.
*
* @var int
* @since 1.0.0
*/
private int $id = 0;
/**
* Order.
*
* @var string
* @since 1.0.0
*/
private string $order = '';
/**
* From.
*
* @var \phpOMS\Stdlib\Base\Address
* @since 1.0.0
*/
private $from = null;
/**
* Warehouse.
*
* @var Warehouse
* @since 1.0.0
*/
private $warehouse = null;
/**
* Date of arrival.
*
* @var null|\DateTime
* @since 1.0.0
*/
private ?\DateTime $date = null;
/**
* Person who accepted the delivery.
*
* @var int
* @since 1.0.0
*/
private ?int $acceptor = null;
/**
* Warehouse.
*
* @var int
* @since 1.0.0
*/
private int $status = 0;
private bool $goodPackaging = false;
/**
* Constructor.
*
* @param int $id Arrival ID
*
* @since 1.0.0
*/
private function __construct($id)
{
$this->id = $id;
}
/**
* Get ID.
*
* @return int
*
* @since 1.0.0
*/
public function getId()
{
return $this->id;
}
/**
* Get date of when the consignment arrived.
*
* @return \DateTime Date of arrival
*
* @since 1.0.0
*/
public function getDate()
{
return $this->date;
}
/**
* Set date of when the consignment arrived.
*
* @param \DateTime $date Date of arrival
*
* @return void
*
* @since 1.0.0
*/
public function setDate($date) : void
{
$this->date = $date;
}
/**
* Get order.
*
* @return string
*
* @since 1.0.0
*/
public function getOrder() : string
{
return $this->order;
}
/**
* Set order.
*
* @param string $order Order Id
*
* @return void
*
* @since 1.0.0
*/
public function setOrder(string $order) : void
{
$this->order = $order;
}
/**
* Get From.
*
* @return \phpOMS\Stdlib\Base\Address
*
* @since 1.0.0
*/
public function getFrom()
{
return $this->from;
}
/**
* Set From.
*
* @param \phpOMS\Stdlib\Base\Address $from Consignor
*
* @return void
*
* @since 1.0.0
*/
public function setFrom($from) : void
{
$this->from = $from;
}
/**
* Get status.
*
* @return int
*
* @since 1.0.0
*/
public function getStatus() : int
{
return $this->status;
}
/**
* Set status.
*
* @param int $status Status
*
* @return void
*
* @since 1.0.0
*/
public function setStatus(int $status) : void
{
$this->status = $status;
}
/**
* Get warehouse.
*
* @return Warehouse
*
* @since 1.0.0
*/
public function getWarehouse()
{
return $this->warehouse;
}
/**
* Get acceptor.
*
* @return int
*
* @since 1.0.0
*/
public function getAcceptor()
{
return $this->acceptor;
}
/**
* Set acceptor.
*
* @param int $acceptor Person who accepted the consignment
*
* @return void
*
* @since 1.0.0
*/
public function setAcceptor($acceptor) : void
{
$this->acceptor = $acceptor;
}
}

View File

@ -1,333 +0,0 @@
<?php
/**
* Orange Management
*
* PHP Version 7.4
*
* @package Modules\Warehousing\Models
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
namespace Modules\WarehouseManagement\Models;
/**
* Article class.
*
* @package Modules\Warehousing\Models
* @license OMS License 1.0
* @link https://orange-management.org
* @since 1.0.0
*/
class Article
{
/**
* Article ID.
*
* @var int
* @since 1.0.0
*/
private int $id = 0;
/**
* Name.
*
* @var string
* @since 1.0.0
*/
private string $name = '';
/**
* Description.
*
* @var string
* @since 1.0.0
*/
private string $description = '';
/**
* Matchcode.
*
* @var string
* @since 1.0.0
*/
private string $matchcode = '';
/**
* Sector.
*
* @var null|string
* @since 1.0.0
*/
private ?string $sector = null;
/**
* Group.
*
* @var null|string
* @since 1.0.0
*/
private ?string $group = null;
/**
* Suppliers.
*
* supplier price leadtime
*
* @var null|string
* @since 1.0.0
*/
private ?string $suppliers = null;
/**
* Localization strings.
*
* [en] Name - Description
*
* @var array
* @since 1.0.0
*/
private array $invoice_i18n = [];
/**
* Prizes.
*
* [id] name country state prize discount% discountA bonus-in-kind groupA groupB amount event
*
* @var array
* @since 1.0.0
*/
private array $prizes = [];
/**
* Active supplier.
*
* @var null|string
* @since 1.0.0
*/
private ?string $pprice = null;
/**
* Created.
*
* @var null|\DateTime
* @since 1.0.0
*/
private ?\DateTime $created = null;
/**
* Creator.
*
* @var null|\phpOMS\Models\User
* @since 1.0.0
*/
private $creator = null;
/**
* Constructor.
*
* @param int $id Article ID
*
* @since 1.0.0
*/
public function __construct($id)
{
$this->id = $id;
}
/**
* Get ID.
*
* @return int
*
* @since 1.0.0
*/
public function getId()
{
return $this->id;
}
/**
* Get name.
*
* @return string
*
* @since 1.0.0
*/
public function getName()
{
return $this->name;
}
/**
* Set name.
*
* @param string $name Name of the article
*
* @return void
*
* @since 1.0.0
*/
public function setName($name) : void
{
$this->name = $name;
}
/**
* Get matchcode.
*
* @return string
*
* @since 1.0.0
*/
public function getMatchcode()
{
return $this->matchcode;
}
/**
* Set matchcode.
*
* @param string $matchcode Matchcode of the article
*
* @return void
*
* @since 1.0.0
*/
public function setMatchcode($matchcode) : void
{
$this->matchcode = $matchcode;
}
/**
* Get description.
*
* @return string
*
* @since 1.0.0
*/
public function getDescription()
{
return $this->description;
}
/**
* Set description.
*
* @param string $desc Description of the article
*
* @return void
*
* @since 1.0.0
*/
public function setDescription($desc) : void
{
$this->description = $desc;
}
/**
* Get created.
*
* @return \DateTime
*
* @since 1.0.0
*/
public function getCreated()
{
return $this->created;
}
/**
* Set created.
*
* @param \DateTime $created Date of when the article got created
*
* @return void
*
* @since 1.0.0
*/
public function setCreated($created) : void
{
$this->created = $created;
}
/**
* Get creator.
*
* @return \phpOMS\Models\User
*
* @since 1.0.0
*/
public function getCreator()
{
return $this->creator;
}
/**
* Set creator.
*
* @param \phpOMS\Models\User $creator Creator ID
*
* @return void
*
* @since 1.0.0
*/
public function setCreator($creator) : void
{
$this->creator = $creator;
}
/**
* Add price to pricelist.
*
* @param array $price Price
* @param bool $db Update DB and cache?
*
* @return void
*
* @since 1.0.0
*/
public function addPrice($price, $db = true) : void
{
$id = 0; /* insert and get id */
$this->prices[$id] = $price;
}
/**
* Remove price from pricelist.
*
* @param int $id Price ID
* @param bool $db Update DB and cache?
*
* @return void
*
* @since 1.0.0
*/
public function removePrice($id, $db = true) : void
{
if (isset($this->prices[$id])) {
unset($this->prices[$id]);
}
}
/**
* Add price to pricelist.
*
* @param int $id Price ID
* @param array $price Price
* @param bool $db Update DB and cache?
*
* @return void
*
* @since 1.0.0
*/
public function editPrice($id, $price, $db = true) : void
{
if (isset($this->prices[$id])) {
$this->prices[$id] = $price;
}
}
}

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.4
* PHP Version 8.0
*
* @package Modules\Warehousing\Models
* @copyright Dennis Eichhorn

View File

@ -2,9 +2,9 @@
/**
* Orange Management
*
* PHP Version 7.4
* PHP Version 8.0
*
* @package Modules\Warehousing\Models
* @package Modules\WarehouseManagement\Models
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
@ -17,22 +17,15 @@ namespace Modules\WarehouseManagement\Models;
use phpOMS\Stdlib\Base\Enum;
/**
* Packaging status enum.
* Permision state enum.
*
* @package Modules\Warehousing\Models
* @package Modules\WarehouseManagement\Models
* @license OMS License 1.0
* @link https://orange-management.org
* @since 1.0.0
*/
abstract class PackagingStatus extends Enum
abstract class PermissionState extends Enum
{
public const PENDING = 0;
public const PACKING = 1;
public const PACKED = 2;
public const SUSPENDED = 3;
public const CANCELED = 4;
public const STOCK = 1;
public const STOCK_LOCATION = 2;
}

View File

@ -1,248 +0,0 @@
<?php
/**
* Orange Management
*
* PHP Version 7.4
*
* @package Modules\Warehousing\Models
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
namespace Modules\WarehouseManagement\Models;
/**
* Warehouse class.
*
* @package Modules\Warehousing\Models
* @license OMS License 1.0
* @link https://orange-management.org
* @since 1.0.0
*/
class Shipping
{
/**
* ID.
*
* @var int
* @since 1.0.0
*/
private int $id = 0;
/**
* Order.
*
* @var int
* @since 1.0.0
*/
private $order = 0;
/**
* From.
*
* @var \phpOMS\Stdlib\Base\Address
* @since 1.0.0
*/
private $to = null;
/**
* Warehouse.
*
* @var string
* @since 1.0.0
*/
private string $warehouse = '';
/**
* Date of arrival.
*
* @var null|\DateTime
* @since 1.0.0
*/
private ?\DateTime $delivered = null;
/**
* Person who sent the delivery.
*
* @var int
* @since 1.0.0
*/
private ?int $sender = null;
/**
* Warehouse.
*
* @var int
* @since 1.0.0
*/
private int $status = 0;
/**
* Constructor.
*
* @param int $id Article ID
*
* @since 1.0.0
*/
public function __construct(int $id)
{
$this->id = $id;
}
/**
* Get ID.
*
* @return int
*
* @since 1.0.0
*/
public function getId()
{
return $this->id;
}
/**
* Get order.
*
* @return int
*
* @since 1.0.0
*/
public function getOrder() : int
{
return $this->order;
}
/**
* Set order.
*
* @param int $order Order ID
*
* @return void
*
* @since 1.0.0
*/
public function setOrder(int $order) : void
{
$this->order = $order;
}
/**
* Get delivered.
*
* @return \DateTime
*
* @since 1.0.0
*/
public function getDelivered()
{
return $this->delivered;
}
/**
* Set delivered.
*
* @param \DateTime $delivered Date of delivery
*
* @return void
*
* @since 1.0.0
*/
public function setDelivered($delivered) : void
{
$this->delivered = $delivered;
}
/**
* Get To.
*
* @return \phpOMS\Stdlib\Base\Address
*
* @since 1.0.0
*/
public function getTo()
{
return $this->to;
}
/**
* Set To.
*
* @param \phpOMS\Stdlib\Base\Address $to Receiver
*
* @return void
*
* @since 1.0.0
*/
public function setTo($to) : void
{
$this->to = $to;
}
/**
* Get status.
*
* @return int
*
* @since 1.0.0
*/
public function getStatus() : int
{
return $this->status;
}
/**
* Set status.
*
* @param int $status Status
*
* @return void
*
* @since 1.0.0
*/
public function setStatus(int $status) : void
{
$this->status = $status;
}
/**
* Get warehouse.
*
* @return mixed
*
* @since 1.0.0
*/
public function getWarehouse()
{
return $this->warehouse;
}
/**
* Get acceptor.
*
* @return int
*
* @since 1.0.0
*/
public function getSender()
{
return $this->sender;
}
/**
* Set sender.
*
* @param int $sender Person who accepted the consignment
*
* @return void
*
* @since 1.0.0
*/
public function setSender($sender) : void
{
$this->sender = $sender;
}
}

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.4
* PHP Version 8.0
*
* @package Modules\Warehousing\Models
* @copyright Dennis Eichhorn
@ -14,25 +14,35 @@ declare(strict_types=1);
namespace Modules\WarehouseManagement\Models;
use phpOMS\Stdlib\Base\Enum;
/**
* Arrival status enum.
* Warehouse class.
*
* @package Modules\Warehousing\Models
* @license OMS License 1.0
* @link https://orange-management.org
* @since 1.0.0
*/
abstract class ArrivalStatus extends Enum
class Stock
{
public const NONE = 0;
/**
* ID.
*
* @var int
* @since 1.0.0
*/
private int $id = 0;
public const PENDING = 1;
public string $name = '';
public const CHECKING = 2;
public int $type = 0;
public const SORTING = 3;
public function __construct(string $name = '')
{
$this->name = $name;
}
public const FINISHED = 4;
public function getId() : int
{
return $this->id;
}
}

54
Models/StockLocation.php Normal file
View File

@ -0,0 +1,54 @@
<?php
/**
* Orange Management
*
* PHP Version 8.0
*
* @package Modules\Warehousing\Models
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
namespace Modules\WarehouseManagement\Models;
/**
* Warehouse class.
*
* @package Modules\Warehousing\Models
* @license OMS License 1.0
* @link https://orange-management.org
* @since 1.0.0
*/
class StockLocation
{
/**
* ID.
*
* @var int
* @since 1.0.0
*/
private int $id = 0;
public string $name = '';
public $stock = 0;
public int $x = 0;
public int $y = 0;
public int $z = 0;
public function __construct(string $name = '')
{
$this->name = $name;
}
public function getId() : int
{
return $this->id;
}
}

View File

@ -0,0 +1,72 @@
<?php
/**
* Orange Management
*
* PHP Version 8.0
*
* @package Modules\WarehouseManagement\Models
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
namespace Modules\WarehouseManagement\Models;
use phpOMS\DataStorage\Database\DataMapperAbstract;
/**
* WarehouseManagement mapper class.
*
* @package Modules\WarehouseManagement\Models
* @license OMS License 1.0
* @link https://orange-management.org
* @since 1.0.0
*/
final class StockLocationMapper extends DataMapperAbstract
{
/**
* Columns.
*
* @var array<string, array{name:string, type:string, internal:string, autocomplete?:bool, readonly?:bool, writeonly?:bool, annotations?:array}>
* @since 1.0.0
*/
protected static array $columns = [
'warehousemgmt_stocklocation_id' => ['name' => 'warehousemgmt_stocklocation_id', 'type' => 'int', 'internal' => 'id'],
'warehousemgmt_stocklocation_name' => ['name' => 'warehousemgmt_stocklocation_name', 'type' => 'string', 'internal' => 'name'],
'warehousemgmt_stocklocation_stock' => ['name' => 'warehousemgmt_stocklocation_stock', 'type' => 'int', 'internal' => 'stock'],
'warehousemgmt_stocklocation_x' => ['name' => 'warehousemgmt_stocklocation_x', 'type' => 'int', 'internal' => 'x'],
'warehousemgmt_stocklocation_y' => ['name' => 'warehousemgmt_stocklocation_y', 'type' => 'int', 'internal' => 'y'],
'warehousemgmt_stocklocation_z' => ['name' => 'warehousemgmt_stocklocation_z', 'type' => 'int', 'internal' => 'z'],
];
/**
* Belongs to.
*
* @var array<string, array{mapper:string, external:string}>
* @since 1.0.0
*/
protected static array $belongsTo = [
'stock' => [
'mapper' => StockMapper::class,
'external' => 'warehousemgmt_stocklocation_stock',
],
];
/**
* Primary table.
*
* @var string
* @since 1.0.0
*/
protected static string $table = 'warehousemgmt_stocklocation';
/**
* Primary field name.
*
* @var string
* @since 1.0.0
*/
protected static string $primaryField = 'warehousemgmt_stocklocation_id';
}

56
Models/StockMapper.php Normal file
View File

@ -0,0 +1,56 @@
<?php
/**
* Orange Management
*
* PHP Version 8.0
*
* @package Modules\WarehouseManagement\Models
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
namespace Modules\WarehouseManagement\Models;
use phpOMS\DataStorage\Database\DataMapperAbstract;
/**
* WarehouseManagement mapper class.
*
* @package Modules\WarehouseManagement\Models
* @license OMS License 1.0
* @link https://orange-management.org
* @since 1.0.0
*/
final class StockMapper extends DataMapperAbstract
{
/**
* Columns.
*
* @var array<string, array{name:string, type:string, internal:string, autocomplete?:bool, readonly?:bool, writeonly?:bool, annotations?:array}>
* @since 1.0.0
*/
protected static array $columns = [
'warehousemgmt_stock_id' => ['name' => 'warehousemgmt_stock_id', 'type' => 'int', 'internal' => 'id'],
'warehousemgmt_stock_name' => ['name' => 'warehousemgmt_stock_name', 'type' => 'string', 'internal' => 'name'],
'warehousemgmt_stock_type' => ['name' => 'warehousemgmt_stock_type', 'type' => 'int', 'internal' => 'type'],
];
/**
* Primary table.
*
* @var string
* @since 1.0.0
*/
protected static string $table = 'warehousemgmt_stock';
/**
* Primary field name.
*
* @var string
* @since 1.0.0
*/
protected static string $primaryField = 'warehousemgmt_stock_id';
}

78
Models/StockMovement.php Normal file
View File

@ -0,0 +1,78 @@
<?php
/**
* Orange Management
*
* PHP Version 8.0
*
* @package Modules\Warehousing\Models
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
namespace Modules\WarehouseManagement\Models;
/**
* Warehouse class.
*
* @package Modules\Warehousing\Models
* @license OMS License 1.0
* @link https://orange-management.org
* @since 1.0.0
*/
class StockMovement
{
/**
* ID.
*
* @var int
* @since 1.0.0
*/
protected int $id = 0;
public int $quantity = 0;
public ?string $lot = null;
public int $from = 0;
public int $to = 0;
public int $type = StockMovementType::TRANSFER;
public int $subtype = 0;
public string $reference = '';
public int $billElement = 0;
/**
* Creator.
*
* @var Account
* @since 1.0.0
*/
protected Account $createdBy;
/**
* Created.
*
* @var \DateTimeImmutable
* @since 1.0.0
*/
public \DateTimeImmutable $createdAt;
/**
* Get ID.
*
* @return int
*
* @since 1.0.0
*/
public function getId()
{
return $this->id;
}
}

View File

View File

@ -1,160 +0,0 @@
<?php
/**
* Orange Management
*
* PHP Version 7.4
*
* @package Modules\Warehousing\Models
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
namespace Modules\WarehouseManagement\Models;
/**
* Warehouse class.
*
* @package Modules\Warehousing\Models
* @license OMS License 1.0
* @link https://orange-management.org
* @since 1.0.0
*/
class Warehouse
{
/**
* ID.
*
* @var int
* @since 1.0.0
*/
protected int $id = 0;
/**
* Name.
*
* @var string
* @since 1.0.0
*/
private string $name = '';
/**
* Description.
*
* @var string
* @since 1.0.0
*/
private string $description = '';
/**
* Location of the warehouse.
*
* @var \phpOMS\Stdlib\Base\Location
* @since 1.0.0
*/
private $location = null;
/**
* Constructor.
*
* @param int $id Warehouse ID
*
* @since 1.0.0
*/
public function __construct($id)
{
$this->id = $id;
}
/**
* Get ID.
*
* @return int
*
* @since 1.0.0
*/
public function getId()
{
return $this->id;
}
/**
* Get name.
*
* @return string
*
* @since 1.0.0
*/
public function getName()
{
return $this->name;
}
/**
* Set name.
*
* @param string $name Name of the article
*
* @return void
*
* @since 1.0.0
*/
public function setName($name) : void
{
$this->name = $name;
}
/**
* Get name.
*
* @return string
*
* @since 1.0.0
*/
public function getDescription()
{
return $this->description;
}
/**
* Set name.
*
* @param string $description Description of the warehouse
*
* @return void
*
* @since 1.0.0
*/
public function setDescription($description) : void
{
$this->description = $description;
}
/**
* Get location.
*
* @return \phpOMS\Stdlib\Base\Location
*
* @since 1.0.0
*/
public function getLocation()
{
return $this->location;
}
/**
* Set location.
*
* @param \phpOMS\Stdlib\Base\Location $location Location of the warehouse
*
* @return void
*
* @since 1.0.0
*/
public function setLocation($location) : void
{
$this->location = $location;
}
}

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.4
* PHP Version 8.0
*
* @package Modules\WarehouseManagement
* @copyright Dennis Eichhorn
@ -15,7 +15,9 @@ declare(strict_types=1);
return ['Navigation' => [
'Arrival' => 'Arrival',
'Articles' => 'Articles',
'Locations' => 'Locations',
'Shipping' => 'Shipping',
'Stock' => 'Stock',
'Stocks' => 'Stocks',
'Warehousing' => 'Warehousing',
]];

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.4
* PHP Version 8.0
*
* @package Modules\WarehouseManagement
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Orange Management
*
* PHP Version 7.4
* PHP Version 8.0
*
* @package Modules\WarehouseManagement
* @copyright Dennis Eichhorn

View File

@ -0,0 +1,47 @@
<?php
/**
* Orange Management
*
* PHP Version 8.0
*
* @package Modules\WarehouseManagement
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
use phpOMS\Uri\UriFactory;
$stocks = $this->getData('stocks') ?? [];
echo $this->getData('nav')->render(); ?>
<div class="row">
<div class="col-xs-12">
<div class="portlet">
<div class="portlet-head"><?= $this->getHtml('Stocks'); ?><i class="fa fa-download floatRight download btn"></i></div>
<table id="stockList" class="default">
<thead>
<tr>
<td><?= $this->getHtml('ID', '0', '0'); ?>
<td><?= $this->getHtml('Type'); ?>
<td class="wf-100"><?= $this->getHtml('Name'); ?>
<tbody>
<?php $count = 0; foreach ($stocks as $key => $value) :
++$count;
$url = UriFactory::build('{/prefix}warehouse/stock?{?}&id=' . $value->getId());
?>
<tr data-href="<?= $url; ?>">
<td><a href="<?= $url; ?>"><?= $value->getId(); ?></a>
<td><a href="<?= $url; ?>"><?= $value->type; ?></a>
<td><a href="<?= $url; ?>"><?= $value->name; ?></a>
<?php endforeach; ?>
<?php if ($count === 0) : ?>
<tr><td colspan="3" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
<?php endif; ?>
</table>
</div>
</div>
</div>

View File

@ -0,0 +1,47 @@
<?php
/**
* Orange Management
*
* PHP Version 8.0
*
* @package Modules\WarehouseManagement
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
use phpOMS\Uri\UriFactory;
$locations = $this->getData('locations') ?? [];
echo $this->getData('nav')->render(); ?>
<div class="row">
<div class="col-xs-12">
<div class="portlet">
<div class="portlet-head"><?= $this->getHtml('Locations'); ?><i class="fa fa-download floatRight download btn"></i></div>
<table id="stockList" class="default">
<thead>
<tr>
<td><?= $this->getHtml('ID', '0', '0'); ?>
<td><?= $this->getHtml('Stock'); ?>
<td class="wf-100"><?= $this->getHtml('Name'); ?>
<tbody>
<?php $count = 0; foreach ($locations as $key => $value) :
++$count;
$url = UriFactory::build('{/prefix}warehouse/stock/location?{?}&id=' . $value->getId());
?>
<tr data-href="<?= $url; ?>">
<td><a href="<?= $url; ?>"><?= $value->getId(); ?></a>
<td><a href="<?= $url; ?>"><?= $value->stock->name; ?></a>
<td><a href="<?= $url; ?>"><?= $value->name; ?></a>
<?php endforeach; ?>
<?php if ($count === 0) : ?>
<tr><td colspan="3" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
<?php endif; ?>
</table>
</div>
</div>
</div>

View File

@ -0,0 +1,26 @@
<?php
/**
* Orange Management
*
* PHP Version 8.0
*
* @package Modules\Profile
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
$location = $this->getData('location');
echo $this->getData('nav')->render();
?>
<div class="row">
<div class="col-xs-12">
<section class="portlet">
<div class="portlet-head"><?= $this->printHtml($location->name); ?></div>
<div class="portlet-body">
</section>
</div>
</div>

View File

@ -0,0 +1,26 @@
<?php
/**
* Orange Management
*
* PHP Version 8.0
*
* @package Modules\Profile
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
$stock = $this->getData('stock');
echo $this->getData('nav')->render();
?>
<div class="row">
<div class="col-xs-12">
<section class="portlet">
<div class="portlet-head"><?= $this->printHtml($stock->name); ?></div>
<div class="portlet-body">
</section>
</div>
</div>

View File

@ -17,7 +17,9 @@
"description": "Warehousing module.",
"directory": "WarehouseManagement",
"dependencies": {
"Admin": "1.0.0"
"Admin": "1.0.0",
"ItemManagement": "1.0.0",
"Billing": "1.0.0"
},
"providing": {
"Navigation": "*"
@ -28,7 +30,7 @@
"/warehouse"
],
"type": 4,
"for": 0,
"for": "WarehouseManagement",
"from": "WarehouseManagement",
"file": "WarehouseManagement"
},