\Warehouse
Basic warehouse accounting implementation
Synopsis
class Warehouse
{
- // constants
- const URL_ME = '?module=warehouse';
- const URL_CATEGORIES = 'categories=true';
- const URL_ITEMTYPES = 'itemtypes=true';
- const URL_STORAGES = 'storages=true';
- const URL_CONTRACTORS = 'contractors=true';
- const URL_IN = 'in=true';
- const URL_OUT = 'out=true';
- const URL_OUTAJREMAINS = 'ajaxremains=true';
- const URL_AJITSELECTOR = 'ajits=';
- const URL_AJODSELECTOR = 'ajods=';
- const URL_INAJLIST = 'ajaxinlist=true';
- const URL_REAJTREM = 'ajaxtremains=true';
- const URL_OUTAJLIST = 'ajaxoutlist=true';
- const URL_VIEWERS = 'viewers=true';
- const URL_REPORTS = 'reports=true';
- const URL_RESERVE = 'reserve=true';
- const ROUTE_DELOUT = 'outcomedelete';
- const ROUTE_DELIN = 'incomedelete';
- const PROUTE_MASSRESERVEOUT = 'massoutreserves';
- const PROUTE_MASSAGREEOUT = 'massoutagreement';
- const PROUTE_DOMASSRESOUT = 'runmassoutreserve';
- const PROUTE_RETURNOUTID = 'newreturnoutcomeid';
- const PROUTE_RETURNSTORAGE = 'newreturnstorageid';
- const PROUTE_RETURNPRICE = 'newreturnprice';
- const PROUTE_RETURNNOTE = 'newreturnnote';
- const PROUTE_EMPREPLACE = 'massoutemployeereplace';
- const PHOTOSTORAGE_SCOPE = 'WAREHOUSEITEMTYPE';
- const LOG_PATH = 'exports/whdebug.log';
- const CACHE_TIMEOUT = 2592000;
- // members
- protected array $allEmployee = ;
- protected array $activeEmployee = ;
- protected array $allEmployeeTelegram = ;
- protected array $allEmployeeLogins = ;
- protected array $altCfg = ;
- protected array $allCategories = ;
- protected array $allItemTypes = ;
- protected array $allItemTypeNames = ;
- protected array $allStorages = ;
- protected array $allContractors = ;
- protected array $allIncoming = ;
- protected array $allOutcoming = ;
- protected array $allReserve = ;
- protected array $allReserveHistory = ;
- protected array $allReserveCreationDates = ;
- protected array $unitTypes = ;
- protected array $outDests = ;
- protected array $taskOutsCache = ;
- protected $messages = '';
- protected $telegram = '';
- protected $returnsDb = '';
- protected array $allReturns = ;
- protected bool $telegramNotify = false;
- protected $cache = '';
- protected string $sup = '';
- protected bool $recPriceFlag = false;
- // methods
- public void __construct()
- protected void loadAltCfg()
- protected void setOptions()
- protected void loadMessages()
- protected void initTelegram()
- protected void initReturns()
- protected void loadReturns()
- protected void initCache()
- protected void loadTaskOutsCache()
- protected void loadAllEmployeeData()
- protected void setUnitTypes()
- protected void setOutDests()
- protected void setSup()
- protected void loadCategories()
- protected void loadItemTypes()
- protected void loadStorages()
- protected void loadContractors()
- protected void loadInOperations()
- protected void loadOutOperations()
- protected void loadReserve()
- protected void loadReserveHistory()
- protected float reserveGet()
- protected array reserveGetData()
- protected void reservePushLog()
- protected void sendTelegram()
- protected void reserveCreationNotify()
- public void telegramReserveDailyNotify()
- public void/string reserveCreate()
- public string reserveMassCreate()
- protected string reserveRenderTodayReserved()
- public string reserveMassForm()
- public string reserveCreateForm()
- public void reserveDelete()
- public string reserveEditForm()
- protected void reserveDrain()
- public void reserveSave()
- protected string reserveGetCreationDate()
- public string reserveRenderList()
- public void reserveListAjaxReply()
- public string getEmployeeName()
- public string renderMassOutEmployyeReplaceForm()
- public string renderMassOutForm()
- public void/string runMassReserveOutcome()
- public void reportEmployeeInventrory()
- public void reserveHistoryAjaxReply()
- protected array getAdminNames()
- public string reserveHistoryFilterForm()
- public void reserveHistoryPrintFiltered()
- public string reserveRenderHistory()
- public string categoriesCreateForm()
- protected string categoriesEditForm()
- public string categoriesRenderList()
- public void categoriesCreate()
- protected bool categoryProtected()
- public bool categoriesDelete()
- public void categoriesSave()
- public void backControl()
- public string renderPanel()
- public string itemtypesCreateForm()
- public string itemtypesEditForm()
- public void itemtypesSave()
- public void itemtypesCreate()
- public string itemtypesRenderList()
- protected bool itemtypeProtected()
- public bool itemtypesDelete()
- public string itemtypeGetName()
- public string itemtypeGetUnit()
- public string itemtypeGetCategory()
- public string storagesCreateForm()
- public void storagesCreate()
- protected bool storageProtected()
- public string storageGetName()
- public bool storagesDelete()
- protected string storagesEditForm()
- public void storagesSave()
- public string storagesRenderList()
- public string contractorsCreateForm()
- public void contractorCreate()
- protected bool contractorProtected()
- public bool contractorsDelete()
- protected string contractorsEditForm()
- public void contractorsSave()
- public string contractorsRenderList()
- protected array itemtypesFilterCategory()
- public string itemtypesCategorySelector()
- public string incomingCreateForm()
- public void incomingCreate()
- public string incomingOperationsList()
- public string incomingListAjaxReply()
- protected string qrControl()
- public string incomingView()
- protected string incomingEditForm()
- public void/string incomingSaveChanges()
- public void/string incomingDelete()
- public bool isIncomeEditable()
- public string outcomingStoragesList()
- protected array remainsOnStorage()
- public array remainsAll()
- public string outcomingRemainsAjaxReply()
- public string outcomingItemsList()
- public string outcomingOperationsList()
- protected string outDestControl()
- public string outcomingListAjaxReply()
- public string outcomindAjaxDestSelector()
- public string outcomingCreateForm()
- public string outcomingView()
- public void outcomingDelete()
- protected string renderReturnForm()
- protected void createReturnOperation()
- public string outcomingCreate()
- public string reportAllStoragesRemains()
- public string reportAllStoragesRemainsAjaxReply()
- public array remainsAllWithReserves()
- public string reportAllStoragesRemainsView()
- protected string reserveAlert()
- protected string reserveShoppingAlert()
- public void summaryReport()
- public void qrCodeDraw()
- public string reportCalendarOps()
- public string taskMaterialsReport()
- public string userSpentMaterialsReport()
- public array taskMaterialsSpentPrice()
- public void reportPrintable()
- public void reportStorageRemainsPrintable()
- protected string reportDateRemainsHeader()
- protected string reportDateRemainsAddRow()
- public float getIncomeMiddlePrice()
- protected array getAllSignupTasks()
- public string reportStoragesRemains()
- public string reportDateRemains()
- public void renderItemHistory()
- public string renderItemtypeOutcomesHistory()
- public string renderPurchasesReport()
- public string renderContractorIncomesReport()
- public string renderReturnsReport()
- public void ajReturnsList()
- public array getAllItemTypes()
- public array getAllItemCategories()
- public array getAllIncomes()
- public array getAllOutcomes()
Constants
Name | Value |
---|---|
URL_ME | '?module=warehouse' |
URL_CATEGORIES | 'categories=true' |
URL_ITEMTYPES | 'itemtypes=true' |
URL_STORAGES | 'storages=true' |
URL_CONTRACTORS | 'contractors=true' |
URL_IN | 'in=true' |
URL_OUT | 'out=true' |
URL_OUTAJREMAINS | 'ajaxremains=true' |
URL_AJITSELECTOR | 'ajits=' |
URL_AJODSELECTOR | 'ajods=' |
URL_INAJLIST | 'ajaxinlist=true' |
URL_REAJTREM | 'ajaxtremains=true' |
URL_OUTAJLIST | 'ajaxoutlist=true' |
URL_VIEWERS | 'viewers=true' |
URL_REPORTS | 'reports=true' |
URL_RESERVE | 'reserve=true' |
ROUTE_DELOUT | 'outcomedelete' |
ROUTE_DELIN | 'incomedelete' |
PROUTE_MASSRESERVEOUT | 'massoutreserves' |
PROUTE_MASSAGREEOUT | 'massoutagreement' |
PROUTE_DOMASSRESOUT | 'runmassoutreserve' |
PROUTE_RETURNOUTID | 'newreturnoutcomeid' |
PROUTE_RETURNSTORAGE | 'newreturnstorageid' |
PROUTE_RETURNPRICE | 'newreturnprice' |
PROUTE_RETURNNOTE | 'newreturnnote' |
PROUTE_EMPREPLACE | 'massoutemployeereplace' |
PHOTOSTORAGE_SCOPE | 'WAREHOUSEITEMTYPE' |
LOG_PATH | 'exports/whdebug.log' |
CACHE_TIMEOUT | 2592000 |
Members
protected
- $activeEmployee
—
array
Contains all active employee as employeeid=>name - $allCategories
—
array
List of all available items categories as id=>category name - $allContractors
—
array
All of available warehouse contractors as id=>name - $allEmployee
—
array
Contains all available employee as employeeid=>name - $allEmployeeLogins
—
array
Contains all available employee realnames as login=>name - $allEmployeeTelegram
—
array
Contains available employee telegram chatid data as id=>chatid - $allIncoming
—
array
All available incoming operations - $allItemTypeNames
—
array
Contains all item type names as id=>name - $allItemTypes
—
array
List of all available item types as id=>data - $allOutcoming
—
array
All available outcoming operations as id=>outcomeData - $allReserve
—
array
Preloaded reserve entries as id=>reserve data - $allReserveCreationDates
—
array
Contains reserve creation dates as reserveId=>date string array - $allReserveHistory
—
array
Contains previous reservation history - $allReturns
—
array
Contains all returns operation as outcomeid=>returnData - $allStorages
—
array
All of available warehouse storages as id=>name - $altCfg
—
array
System alter.ini config stored as array key=>value - $cache
—
System caching object placeholder - $messages
—
System messages helper object placeholder - $outDests
—
array
Available outcoming destinations as destination=>localized name - $recPriceFlag
—
bool
Recommended price flag - $returnsDb
—
Returns database abstraction layer placeholder - $sup
—
string
Default asterisk required fields notifier - $taskOutsCache
—
array
Contains previously detected tasks outcomings mappings - $telegram
—
System telegram object placeholder - $telegramNotify
—
bool
Telegram force notification flag - $unitTypes
—
array
Available unit types as unittype=>localized name
Methods
protected
- categoriesEditForm() — Returns cetegory edit form
- categoryProtected() — Check is category used by some items?
- contractorProtected() — Check is contractor used by some incoming operations?
- contractorsEditForm() — Returns contractors edit form
- createReturnOperation() — Creates new outcome return operation
- getAdminNames() — Returns array of available administrators as login=>name
- getAllSignupTasks() — Returns list of all signup typed tasks as id=>id
- incomingEditForm() — Renders incoming operation editing form
- initCache() — Inits system cache for further usage
- initReturns() — Inits returns database abstraction layer
- initTelegram() — Inits telegram object as protected instance for further usage
- itemtypeProtected() — Checks is itemtype protected by some existing operations?
- itemtypesFilterCategory() — Performs itemtypes per category filtering. Returns array id=>name
- loadAllEmployeeData() — Loads all existing employees from database
- loadAltCfg() — Loads system alter config
- loadCategories() — Loads existing warehouse categories from DB
- loadContractors() — Loads existing warehouse contractors from DB
- loadInOperations() — Loads existing incoming operations from database
- loadItemTypes() — Loads all existing warehouse item types
- loadMessages() — Creates system message helper object instance
- loadOutOperations() — Loads existing outcoming operations from database
- loadReserve() — Loads available reserved items from database
- loadReserveHistory() — Loads reserve history logs from database
- loadReturns() — Loads all existing return operations from database into protected prop
- loadStorages() — Loads existing warehouse storages from DB
- loadTaskOutsCache() — Loads tasks=>outcomings cache
- outDestControl() — Returns outcoming operation destination link
- qrControl() — Returns default contol for QR code view interface
- remainsOnStorage() — Returns array of items remains on some storage
- renderReturnForm() — Renders return operation form
- reportDateRemainsAddRow() — Returns valid formatted table row form date remains report
- reportDateRemainsHeader() — Returns date remains report header
- reserveAlert() — Returns low reserve alert
- reserveCreationNotify() — Sends some notificaton about reserve creation to employee
- reserveDrain() — Drain items from some reserve. If items count less than zero - deletes reserve.
- reserveGet() — Returns count of itemtypes reserved on storage if available
- reserveGetCreationDate() — Returns reserve creation date extracted from log if exists
- reserveGetData() — Returns existing reserve data
- reservePushLog() — Stores reservation history log record into database
- reserveRenderTodayReserved() — Renders current dayly items reserved for some employee
- reserveShoppingAlert() — Returns low reserve alert
- sendTelegram() — Stores Telegram message for some employee
- setOptions() — Sets some config based options
- setOutDests() — Sets default unit types
- setSup() — Sets default required fields notification
- setUnitTypes() — Sets default unit types
- storageProtected() — Check is storage used by some incoming operations?
- storagesEditForm() — Returns storages edit form
public
- __construct() — Creates new warehouse instance
- ajReturnsList() — Renders returned operations list
- backControl() — Renders default back control
- categoriesCreate() — Creates new category in database
- categoriesCreateForm() — Returns cetegory creation form
- categoriesDelete() — Deletes existging category from database
- categoriesRenderList() — Renders list of available categories with some controls
- categoriesSave() — Saves category changes in database by data recieved from form
- contractorCreate() — Creates new contractor in database
- contractorsCreateForm() — Returns contractor creation form
- contractorsDelete() — Deletes existing contractor from database
- contractorsRenderList() — Renders list of available contractors with some controls
- contractorsSave() — Saves contractor changes in database by data recieved from form
- getAllIncomes() — Returns all available income operations
- getAllItemCategories() — Returns array of all existing item type categories
- getAllItemTypes() — Returns array of all existing item types
- getAllOutcomes() — Returns all available outcome operations
- getEmployeeName() — Returns employee name by its ID
- getIncomeMiddlePrice() — Returns middle price for some itemtype based of all incoming operations
- incomingCreate() — Creates new incoming operation in database
- incomingCreateForm() — Returns incoming operation creation form
- incomingDelete() — Deletes existing incoming operation
- incomingListAjaxReply() — Returns JQuery datatables reply for incoming operations list
- incomingOperationsList() — Returns income operations list available at storages
- incomingSaveChanges() — Catches and performs incoming operation editing request
- incomingView() — Renders incoming operation view interface
- isIncomeEditable() — Checks is incoming operation existing and editable?
- itemtypeGetCategory() — Returns item type count unit
- itemtypeGetName() — Returns itemtype name by its ID
- itemtypeGetUnit() — Returns item type count unit
- itemtypesCategorySelector() — Returns itemtype selector filtered by category
- itemtypesCreate() — Creates new items type
- itemtypesCreateForm() — Returns item types creation form
- itemtypesDelete() — Deletes items type by its ID
- itemtypesEditForm() — Returns item types editing form
- itemtypesRenderList() — Renders of available warehouse item types
- itemtypesSave() — Saves item type changes in database by data recieved from form
- outcomindAjaxDestSelector() — Returns ajax selector reply for outcoming operation creation form
- outcomingCreate() — Creates new outcoming operation record in database
- outcomingCreateForm() — Returns outcoming operation creation form
- outcomingDelete() — Deletes existing outcoming operation
- outcomingItemsList() — Returns items list available at storage for further outcoming operation
- outcomingListAjaxReply() — Returns JQuery datatables reply for incoming operations list
- outcomingOperationsList() — Returns outcoming operations list
- outcomingRemainsAjaxReply() — Returns JQuery datatables reply for storage remains itemtypes
- outcomingStoragesList() — Returns outcoming operation creation form
- outcomingView() — Renders outcoming operation view interface
- qrCodeDraw() — Renders QR code label of some type
- remainsAll() — Returns array of all itemtypes available on all storages
- remainsAllWithReserves() — Returns array of all itemtypes available on all storages with their reserved counts
- renderContractorIncomesReport() — Renders incomes by contractor report
- renderItemHistory() — Renders itemtype history with income, outcome and reservation operations
- renderItemtypeOutcomesHistory() — Renders some itemtype outomes history for some finance accounting purposes. Yep. I dont know what for.
- renderMassOutEmployyeReplaceForm() — Renders mass out employee replacement form and performs some redirects if required.
- renderMassOutForm() — Renders mass outcome form for some employeeId reserved items
- renderPanel() — Renders control panel for whole module
- renderPurchasesReport() — Renders per year purchases report
- renderReturnsReport() — Renders returns list container
- reportAllStoragesRemains() — Returns income operations list available at storages
- reportAllStoragesRemainsAjaxReply() — Returns JQuery datatables reply for total remains report
- reportAllStoragesRemainsView() — Renders itemtype storage availability view
- reportCalendarOps() — Renders available operations in calendar widget
- reportDateRemains() — Renders date remains report
- reportEmployeeInventrory() — Renders printable per-employee reserves summary.
- reportPrintable() — shows printable report content
- reportStorageRemainsPrintable() — Renders storage remains printable report
- reportStoragesRemains() — Renders report with list of controls to view some storages remains
- reserveCreate() — Creates new reserve record in database
- reserveCreateForm() — Returns itemtype reservation interface
- reserveDelete() — Deletes existing reservation record from database
- reserveEditForm() — Returns reserve record editing form
- reserveHistoryAjaxReply() — Renders json list of available reservation history log entries
- reserveHistoryFilterForm() — Renders reserve history print filtering form
- reserveHistoryPrintFiltered() — Renders printable report of reserve operations history
- reserveListAjaxReply() — Renders JSON of available reserves list
- reserveMassCreate() — Creates mass reservation if required and returns its results as formatted notifications
- reserveMassForm() — Renders mass reservation form
- reserveRenderHistory() — Renders reservation history log
- reserveRenderList() — Renders list of available reserved items sorted by Employee with some controls
- reserveSave() — Saves reserve changes into database
- runMassReserveOutcome() — Runs batch outcome operations creation based on reserve
- storageGetName() — Returns storage name by its ID
- storagesCreate() — Creates new storage in database
- storagesCreateForm() — Returns storage creation form
- storagesDelete() — Deletes existing storage from database
- storagesRenderList() — Renders list of available storages with some controls
- storagesSave() — Saves storage changes in database by data recieved from form
- summaryReport() — Shows warehouse summary report
- taskMaterialsReport() — Returns additionally spent materials list for some task
- taskMaterialsSpentPrice() — Returns additionally spent materials price for some task
- telegramReserveDailyNotify() — Sends reserve remains daily notifications to employees
- userSpentMaterialsReport() — Renders materials list spent on some tasks from array