diff --git a/.gitignore b/.gitignore
index b4cf62469..4f19830e9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,3 +6,4 @@ www/cron.cmd
www/.idea/
+www/logs/
diff --git a/CHANGELOG.md b/CHANGELOG.md
index cff5e36c0..576709ca0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,12 +1,16 @@
CHANGELOG
=========
-### v4.8.1 (2021-01-10)
+### v4.8.2 (2021-01-10)
* Исправление ошибок
* Печать накладной на узком принтере
-
-
-Для обновления версии обновить папки app, templates, templates_ua
+* Внешнее API в модуле автозапчастей
+* Добавлен документ Товарно-транспортная накладная. Доставка теперь будет через него а не Расходную накладную.
+* Оприходование на склад расширено до возможностей Авансового отчета .
+* Оплаты непосредственно в заказе.
+
+Для обновления версии обновить папки app, templates, templates_ua, выполнить update480to482.sql
+
### v4.8.0 (2020-12-19)
* Добавлен модуль програмного РРО для отправки чеков в налоговую (Украина). Описание модуля
diff --git a/db/initdata.sql b/db/initdata.sql
index d0866cf65..bb06b35a5 100644
--- a/db/initdata.sql
+++ b/db/initdata.sql
@@ -20,62 +20,63 @@ INSERT INTO `options` (`optname`, `optvalue`) VALUES('shop', 'N;');
INSERT INTO `options` (`optname`, `optvalue`) VALUES('modules', 'a:21:{s:6:"ocsite";s:24:"https://yerbalife.com.ua";s:9:"ocapiname";s:5:"zippy";s:5:"ockey";s:256:"xgquZq2BXB5QRMGq3mPR3zTMXI3Jl2oaUOQmmyrbaVjeZMhnpgwomxEn2D8dZFOLMcscA7WbRWXiCKg0navzgmJpinIgmYTCK0de5ZLZ3oOGp6eAKpzt3nadwYVvCl1ByjNPdpGbSMMBkUEhuJSzmliC0mE5oY1mLpDUEhVp45T8ELh3JReFuRNidV5ojVW2OhYqx3Q8RukKE4LzWjNvkivplLo3lrNBeZx5Mi2CZegOxrNbI1sz3bcojzvJ8aW0";s:13:"occustomer_id";s:1:"8";s:11:"ocpricetype";s:6:"price1";s:6:"wcsite";s:15:"http://local.wp";s:6:"wckeyc";s:43:"ck_a36c9d5d8ef70a34001b6a44bc245a7665ca77e7";s:6:"wckeys";s:43:"cs_12b03012d9db469b45b1fc82e329a3bc995f3e36";s:5:"wcapi";s:2:"v3";s:13:"wccustomer_id";s:1:"8";s:11:"wcpricetype";s:6:"price1";s:9:"ocoutcome";i:0;s:12:"ocinsertcust";i:0;s:12:"td_pricetype";s:1:"0";s:8:"td_store";s:1:"0";s:8:"td_ipath";s:0:"";s:11:"td_seconddb";i:1;s:9:"td_dbhost";s:9:"localhost";s:9:"td_dbname";s:6:"tecdoc";s:9:"td_dbuser";s:4:"root";s:9:"td_dbpass";s:4:"root";}');
-INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 4, 'Склады', 'StoreList', 'ТМЦ', 0);
-INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 4, 'Номенклатура', 'ItemList', 'ТМЦ', 0);
-INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 4, 'Сотрудники', 'EmployeeList', '', 0);
-INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 4, 'Категории ', 'CategoryList', 'ТМЦ', 0);
-INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 4, 'Контрагенты', 'CustomerList', '', 0);
-INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 1, 'Приходная накладная', 'GoodsReceipt', 'Закупки', 0);
-INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 1, 'Расходная накладная', 'GoodsIssue', 'Продажи', 0);
-INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 3, 'Общий журнал', 'DocList', '', 0);
-INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 1, 'Гарантийный талон', 'Warranty', 'Продажи', 0);
-INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 2, 'Движение по складу', 'ItemActivity', 'Склад', 0);
-INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 2, 'ABC анализ', 'ABC', '', 0);
-INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 4, 'Услуги, работы', 'ServiceList', '', 0);
-INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 1, 'Заказ (услуги)', 'ServiceAct', 'Услуги', 0);
-INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 1, 'Возврат от покупателя', 'ReturnIssue', 'Продажи', 0);
-INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 3, 'Наряды', 'TaskList', '', 0);
-INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 1, 'Наряд', 'Task', 'Производство', 0);
-INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 2, 'Отчет по нарядам', 'EmpTask', 'Производство', 0);
-INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 2, 'Закупки', 'Income', 'Закупки', 0);
-INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 2, 'Продажи', 'Outcome', 'Продажи', 0);
-INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 4, 'Кассы', 'MFList', '', 0);
-INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 3, 'Заказы клиентов', 'OrderList', 'Продажи', 0);
-INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 1, 'Заказ', 'Order', 'Продажи', 0);
-INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 1, 'Оприходование с производства', 'ProdReceipt', 'Производство', 0);
-INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 1, 'Списание на производство', 'ProdIssue', 'Производство', 0);
-INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 2, 'Отчет по производству', 'Prod', 'Производство', 0);
-INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 4, 'Производственные участки', 'ProdAreaList', '', 0);
-INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 1, 'Заявка поставщику', 'OrderCust', 'Закупки', 0);
-INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 3, 'Продажи', 'GIList', 'Продажи', 0);
-INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 4, 'Основные фонды', 'EqList', '', 0);
-INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 3, 'Закупки', 'GRList', 'Закупки', 0);
-INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 3, 'Заявки поставщикам', 'OrderCustList', 'Закупки', 0);
-INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 2, 'Прайс', 'Price', 'Склад', 0);
-INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 1, 'Возврат поставщику', 'RetCustIssue', 'Закупки', 0);
-INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 3, 'Работы, услуги', 'SerList', '', 0);
-INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 1, 'Перекомплектация ТМЦ', 'TransItem', 'Склад', 0);
-INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 3, 'Журнал платежей', 'PayList', 'Касса и платежи', 0);
-INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 2, 'Движение по денежным счетам', 'PayActivity', 'Платежи', 0);
-INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 1, 'Списание ТМЦ', 'OutcomeItem', 'Склад', 0);
-INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 1, 'Приходный ордер', 'IncomeMoney', 'Платежи', 0);
-INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 1, 'Расходный ордер', 'OutcomeMoney', 'Платежи', 0);
-INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 2, 'Финансовые результаты', 'PayBalance', '', 0);
-INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 1, 'Инвентаризация', 'Inventory', 'Склад', 0);
-INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 1, 'Счет входящий', 'InvoiceCust', 'Закупки', 0);
-INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 1, 'Счет-фактура', 'Invoice', 'Продажи', 0);
-INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 5, 'Импорт', 'Import', '', 0);
-INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 3, 'Движение ТМЦ', 'StockList', 'Склад', 0);
-INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 1, 'Кассовый чек', 'POSCheck', 'Продажи', 1);
-INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 2, 'Товары в пути', 'CustOrder', 'Закупки', 0);
-INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 1, 'Оприходование ТМЦ', 'IncomeItem', 'Склад', 0);
-INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 5, 'Экспорт', 'Export', '', 0);
-INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 5, 'АРМ кассира', 'ARMPos', '', 0);
-INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 3, 'Расчеты с контрагентами', 'PayCustList', 'Касса и платежи', 0);
-INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 3, 'Товары на складе', 'ItemList', 'Склад', 0);
-INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 1, 'Выплата зарплаты', 'OutSalary', 'Платежи', 0);
-INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 2, 'Отчет по зарплате', 'SalaryRep', 'Зарплата', 0);
-INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 2, 'Движение по контрагентам', 'CustActivity', 'Платежи', 0);
-INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 4, 'Договора', 'ContractList', '', 0);
-INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 1, 'Перемещение товара', 'MoveItem', 'Склад', 0);
-INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 2, 'Рабочее время', 'Timestat', 'Зарплата', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(1, 4, 'Склады', 'StoreList', 'ТМЦ', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(2, 4, 'Номенклатура', 'ItemList', 'ТМЦ', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(3, 4, 'Сотрудники', 'EmployeeList', '', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(4, 4, 'Категории ', 'CategoryList', 'ТМЦ', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(5, 4, 'Контрагенты', 'CustomerList', '', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(6, 1, 'Приходная накладная', 'GoodsReceipt', 'Закупки', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(7, 1, 'Расходная накладная', 'GoodsIssue', 'Продажи', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(8, 3, 'Общий журнал', 'DocList', '', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(10, 1, 'Гарантийный талон', 'Warranty', 'Продажи', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(12, 2, 'Движение по складу', 'ItemActivity', 'Склад', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(13, 2, 'ABC анализ', 'ABC', '', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(14, 4, 'Услуги, работы', 'ServiceList', '', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(15, 1, 'Заказ (услуги)', 'ServiceAct', 'Услуги', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(16, 1, 'Возврат от покупателя', 'ReturnIssue', 'Продажи', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(18, 3, 'Наряды', 'TaskList', '', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(19, 1, 'Наряд', 'Task', 'Производство', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(20, 2, 'Отчет по нарядам', 'EmpTask', 'Производство', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(21, 2, 'Закупки', 'Income', 'Закупки', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(22, 2, 'Продажи', 'Outcome', 'Продажи', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(46, 4, 'Кассы', 'MFList', '', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(27, 3, 'Заказы клиентов', 'OrderList', 'Продажи', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(28, 1, 'Заказ', 'Order', 'Продажи', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(30, 1, 'Оприходование с производства', 'ProdReceipt', 'Производство', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(31, 1, 'Списание на производство', 'ProdIssue', 'Производство', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(32, 2, 'Отчет по производству', 'Prod', 'Производство', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(33, 4, 'Производственные участки', 'ProdAreaList', '', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(38, 1, 'Заявка поставщику', 'OrderCust', 'Закупки', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(35, 3, 'Продажи', 'GIList', 'Продажи', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(36, 4, 'Основные фонды', 'EqList', '', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(37, 3, 'Закупки', 'GRList', 'Закупки', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(39, 3, 'Заявки поставщикам', 'OrderCustList', 'Закупки', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(40, 2, 'Прайс', 'Price', 'Склад', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(41, 1, 'Возврат поставщику', 'RetCustIssue', 'Закупки', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(69, 3, 'Работы, услуги', 'SerList', '', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(44, 1, 'Перекомплектация ТМЦ', 'TransItem', 'Склад', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(47, 3, 'Журнал платежей', 'PayList', 'Касса и платежи', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(48, 2, 'Движение по денежным счетам', 'PayActivity', 'Платежи', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(64, 1, 'Списание ТМЦ', 'OutcomeItem', 'Склад', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(50, 1, 'Приходный ордер', 'IncomeMoney', 'Платежи', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(51, 1, 'Расходный ордер', 'OutcomeMoney', 'Платежи', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(53, 2, 'Финансовые результаты', 'PayBalance', '', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(57, 1, 'Инвентаризация', 'Inventory', 'Склад', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(58, 1, 'Счет входящий', 'InvoiceCust', 'Закупки', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(59, 1, 'Счет-фактура', 'Invoice', 'Продажи', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(60, 5, 'Импорт', 'Import', '', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(61, 3, 'Движение ТМЦ', 'StockList', 'Склад', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(62, 1, 'Кассовый чек', 'POSCheck', 'Продажи', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(63, 2, 'Товары в пути', 'CustOrder', 'Закупки', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(65, 1, 'Оприходование ТМЦ', 'IncomeItem', 'Склад', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(75, 5, 'Экспорт', 'Export', '', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(67, 5, 'АРМ кассира', 'ARMPos', '', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(70, 3, 'Расчеты с контрагентами', 'PayCustList', 'Касса и платежи', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(71, 3, 'Товары на складе', 'ItemList', 'Склад', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(76, 1, 'Выплата зарплаты', 'OutSalary', 'Платежи', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(77, 2, 'Отчет по зарплате', 'SalaryRep', 'Зарплата', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(78, 2, 'Движение по контрагентам', 'CustActivity', 'Платежи', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(81, 4, 'Договора', 'ContractList', '', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(82, 1, 'Перемещение товара', 'MoveItem', 'Склад', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(83, 2, 'Рабочее время', 'Timestat', 'Зарплата', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(84, 1, 'Товарно-транспортная накладная', 'TTN', 'Продажи', 0);
diff --git a/db/initdata_ua.sql b/db/initdata_ua.sql
index 41196a294..5ff78ebc8 100644
--- a/db/initdata_ua.sql
+++ b/db/initdata_ua.sql
@@ -8,9 +8,9 @@ INSERT INTO `roles` (`role_id`, `rolename`, `acl`) VALUES(1, 'admins', 'a:9:{s:7
UPDATE users set role_id=(select role_id from roles where rolename='admins' limit 0,1 ) where userlogin='admin' ;
-INSERT INTO `stores` ( `storename`, `description`) VALUES( 'Основний склад', '');
-INSERT INTO `mfund` (`mf_id`, `mf_name`, `description`) VALUES(2, 'Каса', 'Основна каса');
-INSERT INTO `firms` ( `firm_name`, `details`, `disabled`) VALUES( 'Наша фiрма', '', 0);
+INSERT INTO `stores` ( `storename`, `description`) VALUES( 'Основний склад', '');
+INSERT INTO `mfund` (`mf_id`, `mf_name`, `description`) VALUES(2, 'Каса', 'Основна каса');
+INSERT INTO `firms` ( `firm_name`, `details`, `disabled`) VALUES( 'Наша фiрма', '', 0);
INSERT INTO `options` (`optname`, `optvalue`) VALUES('common', 'a:24:{s:9:"qtydigits";s:1:"0";s:8:"amdigits";s:1:"0";s:10:"dateformat";s:5:"d.m.Y";s:11:"partiontype";s:1:"1";s:4:"curr";s:2:"ru";s:6:"phonel";s:2:"10";s:6:"price1";s:17:"Роздрiбна";s:6:"price2";s:12:"Оптова";s:6:"price3";s:0:"";s:6:"price4";s:0:"";s:6:"price5";s:0:"";s:8:"defprice";s:0:"";s:8:"shopname";s:18:"Наша фiрма";s:8:"ts_break";s:2:"60";s:8:"ts_start";s:5:"09:00";s:6:"ts_end";s:5:"18:00";s:11:"autoarticle";i:1;s:10:"usesnumber";i:0;s:10:"usescanner";i:0;s:9:"useimages";i:0;s:9:"usebranch";i:0;s:10:"allowminus";i:1;s:6:"useval";i:0;s:6:"capcha";i:0;}');
@@ -20,63 +20,63 @@ INSERT INTO `options` (`optname`, `optvalue`) VALUES('modules', 'a:11:{s:6:"ocsi
-INSERT INTO `metadata` VALUES(1, 4, 'Склади', 'StoreList', 'Товари', 0);
-INSERT INTO `metadata` VALUES(2, 4, 'Номенклатура', 'ItemList', 'Товари', 0);
-INSERT INTO `metadata` VALUES(3, 4, 'Співробітники', 'EmployeeList', '', 0);
-INSERT INTO `metadata` VALUES(4, 4, 'Категорії товарів', 'CategoryList', 'Товари', 0);
-INSERT INTO `metadata` VALUES(5, 4, 'Контрагенти', 'CustomerList', '', 0);
-INSERT INTO `metadata` VALUES(6, 1, 'Прибуткова накладна', 'GoodsReceipt', 'Закупки', 0);
-INSERT INTO `metadata` VALUES(7, 1, 'Видаткова накладна', 'GoodsIssue', 'Продажі', 0);
-INSERT INTO `metadata` VALUES(8, 3, 'Загальний журнал', 'DocList', '', 0);
-INSERT INTO `metadata` VALUES(10, 1, 'Гарантійний талон', 'Warranty', 'Продажі', 0);
-INSERT INTO `metadata` VALUES(12, 2, 'Рух по складу', 'ItemActivity', 'Склад', 0);
-INSERT INTO `metadata` VALUES(13, 2, 'ABC аналіз', 'ABC', '', 0);
-INSERT INTO `metadata` VALUES(14, 4, 'Послуги, роботи', 'ServiceList', '', 0);
-INSERT INTO `metadata` VALUES(15, 1, 'Акт виконаних робіт', 'ServiceAct', 'Послуги', 0);
-INSERT INTO `metadata` VALUES(16, 1, 'Повернення від покупця', 'ReturnIssue', 'Продажі', 0);
-INSERT INTO `metadata` VALUES(18, 3, 'Наряди', 'TaskList', '', 0);
-INSERT INTO `metadata` VALUES(19, 1, 'Наряд', 'Task', 'Виробництво', 0);
-INSERT INTO `metadata` VALUES(20, 2, 'Оплата за нарядами', 'EmpTask', 'Виробництво', 0);
-INSERT INTO `metadata` VALUES(21, 2, 'Закупівлі', 'Income', 'Закупки', 0);
-INSERT INTO `metadata` VALUES(22, 2, 'Продажі', 'Outcome', 'Продажі', 0);
-INSERT INTO `metadata` VALUES(27, 3, 'Замовлення клієнтів', 'OrderList', 'Продажі', 0);
-INSERT INTO `metadata` VALUES(28, 1, 'Замовлення', 'Order', 'Продажі', 0);
-INSERT INTO `metadata` VALUES(30, 1, 'Оприбуткування з виробництва', 'ProdReceipt', 'Виробництво', 0);
-INSERT INTO `metadata` VALUES(31, 1, 'Списання на виробництво', 'ProdIssue', 'Виробництво', 0);
-INSERT INTO `metadata` VALUES(32, 2, 'Звіт по виробництву', 'Prod', 'Виробництво', 0);
-INSERT INTO `metadata` VALUES(33, 4, 'Виробничі дільниці', 'ProdAreaList', '', 0);
-INSERT INTO `metadata` VALUES(35, 3, 'Продажі', 'GIList', 'Продажі', 0);
-INSERT INTO `metadata` VALUES(36, 4, 'Основні фонди', 'EqList', '', 0);
-INSERT INTO `metadata` VALUES(37, 3, 'Закупівлі', 'GRList', 'Закупки', 0);
-INSERT INTO `metadata` VALUES(38, 1, 'Заявка постачальнику', 'OrderCust', 'Закупки', 0);
-INSERT INTO `metadata` VALUES(39, 3, 'Заявки постачальникам', 'OrderCustList', 'Закупки', 0);
-INSERT INTO `metadata` VALUES(40, 2, 'Прайс', 'Price', 'Склад', 0);
-INSERT INTO `metadata` VALUES(41, 1, 'Повернення постачальнику', 'RetCustIssue', 'Закупки', 0);
-INSERT INTO `metadata` VALUES(44, 1, 'Перекомплектація ТМЦ', 'TransItem', 'Склад', 0);
-INSERT INTO `metadata` VALUES(46, 4, 'Каси, рахунки', 'MFList', '', 0);
-INSERT INTO `metadata` VALUES(47, 3, 'Журнал платежів', 'PayList', 'Каса та платежі', 0);
-INSERT INTO `metadata` VALUES(48, 2, 'Рух по грошовим рахунках', 'PayActivity', 'Платежі', 0);
-INSERT INTO `metadata` VALUES(50, 1, 'Прибутковий ордер', 'IncomeMoney', 'Платежі', 0);
-INSERT INTO `metadata` VALUES(51, 1, 'Видатковий ордер', 'OutcomeMoney', 'Платежі', 0);
-INSERT INTO `metadata` VALUES(53, 2, 'Платіжний баланс', 'PayBalance', 'Платежі', 0);
-INSERT INTO `metadata` VALUES(57, 1, 'Інвентаризація', 'Inventory', 'Склад', 0);
-INSERT INTO `metadata` VALUES(58, 1, 'Рахунок, вхідний', 'InvoiceCust', 'Закупки', 0);
-INSERT INTO `metadata` VALUES(59, 1, 'Рахунок-фактура', 'Invoice', 'Продажі', 0);
-INSERT INTO `metadata` VALUES(60, 5, 'Імпорт', 'Import', '', 0);
-INSERT INTO `metadata` VALUES(61, 3, 'Рух ТМЦ', 'StockList', 'Склад', 0);
-INSERT INTO `metadata` VALUES(62, 1, 'Касовий чек', 'POSCheck', 'Продажі', 1);
-INSERT INTO `metadata` VALUES(63, 2, 'Товари в дорозі', 'CustOrder', 'Закупки', 0);
-INSERT INTO `metadata` VALUES(64, 1, 'Списання ТМЦ', 'OutcomeItem', 'Склад', 0);
-INSERT INTO `metadata` VALUES(65, 1, 'Оприбуткування ТМЦ', 'IncomeItem', 'Склад', 0);
-INSERT INTO `metadata` VALUES(67, 5, 'АРМ касира', 'ARMPos', '', 0);
-INSERT INTO `metadata` VALUES(69, 3, 'Роботи, послуги', 'SerList', '', 0);
-INSERT INTO `metadata` VALUES(70, 3, 'Розрахунки з контрагентами', 'PayCustList', 'Каса та платежі', 0);
-INSERT INTO `metadata` VALUES(71, 3, 'Товари на складі', 'ItemList', 'Склад', 0);
-INSERT INTO `metadata` VALUES(75, 5, 'Експорт', 'Export', '', 0);
-INSERT INTO `metadata` VALUES(76, 1, 'Виплата зарплати', 'OutSalary', 'Платежі', 0);
-INSERT INTO `metadata` VALUES(77, 2, 'Звіт по зарплаті', 'SalaryRep', 'Платежі', 0);
-INSERT INTO `metadata` VALUES(78, 2, 'Рух по контрагентах', 'CustActivity', 'Платежі', 0);
-INSERT INTO `metadata` VALUES(79, 4, 'Контракти', 'ContractList', '', 0);
-INSERT INTO `metadata` VALUES(80, 1, 'Перемiщення ТМЦ', 'MoveItem', 'Склад', 0);
-INSERT INTO `metadata` VALUES(81, 2, 'Робочий час', 'Timestat', '', 0);
-
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(1, 4, 'Склади', 'StoreList', 'Товари', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(2, 4, 'Номенклатура', 'ItemList', 'Товари', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(3, 4, 'Співробітники', 'EmployeeList', '', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(4, 4, 'Категорії товарів', 'CategoryList', 'Товари', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(5, 4, 'Контрагенти', 'CustomerList', '', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(6, 1, 'Прибуткова накладна', 'GoodsReceipt', 'Закупки', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(7, 1, 'Видаткова накладна', 'GoodsIssue', 'Продажі', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(8, 3, 'Загальний журнал', 'DocList', '', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(10, 1, 'Гарантійний талон', 'Warranty', 'Продажі', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(12, 2, 'Рух по складу', 'ItemActivity', 'Склад', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(13, 2, 'ABC аналіз', 'ABC', '', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(14, 4, 'Послуги, роботи', 'ServiceList', '', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(15, 1, 'Акт виконаних робіт', 'ServiceAct', 'Послуги', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(16, 1, 'Повернення від покупця', 'ReturnIssue', 'Продажі', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(18, 3, 'Наряди', 'TaskList', '', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(19, 1, 'Наряд', 'Task', 'Виробництво', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(20, 2, 'Оплата за нарядами', 'EmpTask', 'Виробництво', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(21, 2, 'Закупівлі', 'Income', 'Закупки', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(22, 2, 'Продажі', 'Outcome', 'Продажі', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(27, 3, 'Замовлення клієнтів', 'OrderList', 'Продажі', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(28, 1, 'Замовлення', 'Order', 'Продажі', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(30, 1, 'Оприбуткування з виробництва', 'ProdReceipt', 'Виробництво', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(31, 1, 'Списання на виробництво', 'ProdIssue', 'Виробництво', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(32, 2, 'Звіт по виробництву', 'Prod', 'Виробництво', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(33, 4, 'Виробничі дільниці', 'ProdAreaList', '', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(35, 3, 'Продажі', 'GIList', 'Продажі', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(36, 4, 'Основні фонди', 'EqList', '', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(37, 3, 'Закупівлі', 'GRList', 'Закупки', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(38, 1, 'Заявка постачальнику', 'OrderCust', 'Закупки', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(39, 3, 'Заявки постачальникам', 'OrderCustList', 'Закупки', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(40, 2, 'Прайс', 'Price', 'Склад', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(41, 1, 'Повернення постачальнику', 'RetCustIssue', 'Закупки', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(44, 1, 'Перекомплектація ТМЦ', 'TransItem', 'Склад', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(46, 4, 'Каси, рахунки', 'MFList', '', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(47, 3, 'Журнал платежів', 'PayList', 'Каса та платежі', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(48, 2, 'Рух по грошовим рахунках', 'PayActivity', 'Платежі', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(50, 1, 'Прибутковий ордер', 'IncomeMoney', 'Платежі', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(51, 1, 'Видатковий ордер', 'OutcomeMoney', 'Платежі', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(53, 2, 'Платіжний баланс', 'PayBalance', 'Платежі', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(57, 1, 'Інвентаризація', 'Inventory', 'Склад', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(58, 1, 'Рахунок, вхідний', 'InvoiceCust', 'Закупки', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(59, 1, 'Рахунок-фактура', 'Invoice', 'Продажі', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(60, 5, 'Імпорт', 'Import', '', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(61, 3, 'Рух ТМЦ', 'StockList', 'Склад', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(62, 1, 'Касовий чек', 'POSCheck', 'Продажі', 1);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(63, 2, 'Товари в дорозі', 'CustOrder', 'Закупки', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(64, 1, 'Списання ТМЦ', 'OutcomeItem', 'Склад', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(65, 1, 'Оприбуткування ТМЦ', 'IncomeItem', 'Склад', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(67, 5, 'АРМ касира', 'ARMPos', '', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(69, 3, 'Роботи, послуги', 'SerList', '', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(70, 3, 'Розрахунки з контрагентами', 'PayCustList', 'Каса та платежі', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(71, 3, 'Товари на складі', 'ItemList', 'Склад', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(75, 5, 'Експорт', 'Export', '', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(76, 1, 'Виплата зарплати', 'OutSalary', 'Платежі', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(77, 2, 'Звіт по зарплаті', 'SalaryRep', 'Платежі', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(78, 2, 'Рух по контрагентах', 'CustActivity', 'Платежі', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(79, 4, 'Контракти', 'ContractList', '', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(80, 1, 'Перемiщення ТМЦ', 'MoveItem', 'Склад', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(81, 2, 'Робочий час', 'Timestat', '', 0);
+INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(84, 1, 'Товарно-транспортна накладна', 'TTN', 'Продажі', 0);
diff --git a/db/update480to482.sql b/db/update480to482.sql
new file mode 100644
index 000000000..5eb9dd501
--- /dev/null
+++ b/db/update480to482.sql
@@ -0,0 +1,13 @@
+
+INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 1, '�������-������������ ���������', 'TTN', '�������', 0);
+
+CREATE TABLE `shop_images` (
+ `image_id` int(11) NOT NULL AUTO_INCREMENT,
+ `content` longblob NOT NULL,
+ `mime` varchar(16) DEFAULT NULL,
+ `thumb` longblob,
+ PRIMARY KEY (`image_id`)
+) DEFAULT CHARSET=utf8;
+
+
+
diff --git a/db/update480to490.sql b/db/update482to483.sql
similarity index 93%
rename from db/update480to490.sql
rename to db/update482to483.sql
index d42430ef7..ea82d6ebb 100644
--- a/db/update480to490.sql
+++ b/db/update482to483.sql
@@ -1,8 +1,10 @@
+
/*
CREATE TABLE `empacc` (
`ea_id` int(11) NOT NULL AUTO_INCREMENT,
`emp_id` int(11) NOT NULL,
`document_id` int(11) DEFAULT NULL,
+ `acctype` int(11) DEFAULT NULL,
`createdon` date NOT NULL,
`notes` varchar(255) DEFAULT NULL,
`income` decimal(10,2) NOT NULL,
@@ -11,6 +13,8 @@ CREATE TABLE `empacc` (
KEY `emp_id` (`emp_id`)
) DEFAULT CHARSET=utf8;
+
+
CREATE TABLE `prodproc` (
`pp_id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) DEFAULT NULL,
diff --git a/www/app/api/common.php b/www/app/api/common.php
new file mode 100644
index 000000000..a43a052c6
--- /dev/null
+++ b/www/app/api/common.php
@@ -0,0 +1,37 @@
+ 0 ? $api['key'] : "defkey";
+ $exp = strlen($api['exp']) > 0 ? $api['exp'] : 60;
+
+ $token = array(
+ "user_id" => $user->user_id,
+ "iat" => time(),
+ "exp" => time() + $exp * 60
+ );
+
+ $jwt = \Firebase\JWT\JWT::encode($token, $key);
+
+
+ } else {
+ throw new \Exception('Неверный логин', 1000);
+ }
+
+ return $jwt;
+
+ }
+
+
+}
\ No newline at end of file
diff --git a/www/app/api/help.php b/www/app/api/help.php
new file mode 100644
index 000000000..507a7ad5a
--- /dev/null
+++ b/www/app/api/help.php
@@ -0,0 +1,35 @@
+ 0) {
+ $lang = $_GET['lang'];
+ }
+
+ $templatepath = 'templates/';
+
+ if (strlen($lang) > 0 && $lang != 'ru') {
+ $templatepath = 'templates_' . $lang . '/';
+ }
+ $path = _ROOT . strtolower($templatepath) . "apihelp.html";
+
+
+ $template = @file_get_contents($path);
+ echo $template;
+ die;
+ }
+}
diff --git a/www/app/api/items.php b/www/app/api/items.php
new file mode 100644
index 000000000..35061efa9
--- /dev/null
+++ b/www/app/api/items.php
@@ -0,0 +1,38 @@
+ $cat->cat_id, 'name' => $cat->cat_name);
+
+ }
+ return $list;
+ }
+
+ public function itemlist($args) {
+
+ $list = array();
+ $w = '';
+
+ if ($args['cat'] > 0) {
+ $w = "cat_id=" . $args['cat'];
+ }
+ \App\Helper::log($w);
+ foreach (\App\Entity\Item::find($w, 'itemname') as $item) {
+ $list[] = array('code' => $item->item_code, 'name' => $item->itemame);
+
+ }
+ return $list;
+ }
+
+}
\ No newline at end of file
diff --git a/www/app/jsonrpc.php b/www/app/api/jsonrpc.php
similarity index 81%
rename from www/app/jsonrpc.php
rename to www/app/api/jsonrpc.php
index 051ea9f31..457173b24 100644
--- a/www/app/jsonrpc.php
+++ b/www/app/api/jsonrpc.php
@@ -1,6 +1,6 @@
$value) {
+ if ($header == "Authorization") {
+ $jwt = str_replace("Bearer ", "", $value);
+ $jwt = trim($jwt);
+ break;
+ }
+ }
+
+ $key = strlen($api['key']) > 0 ? $api['key'] : "defkey";
+
+
+ $decoded = \Firebase\JWT\JWT::decode($jwt, $key, array('HS256'));
+
+ $user = \App\Entity\User::load($decoded->user_id);
}
+ //Basic
+ if ($api['atype'] == 2) {
+ $user = \App\Helper::login($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']);
+
+ }
+ //без авторризации
+ if ($api['atype'] == 3) {
+ $user = \App\Entity\User::getByLogin('admin');
+ }
+ if ($user == null) {
+ throw new \Exception('Пользователь не найден', 1001);
+ }
+ \App\System::setUser($user);
+
+
+ return true;
+
}
+
/**
* Processes the user input, and prepares a response (if necessary).
*
@@ -160,11 +207,17 @@ private function processRequest($request) {
*/
private function processQuery($id, $method, $arguments) {
+
if (method_exists($this, $method) == false) {
return self::error($id, -32601, "Method '{$method}' not found");
}
- $result = @call_user_func_array(array($this, $method), $arguments);
+ try {
+
+ $result = @call_user_func_array(array($this, $method), array('args' => $arguments));
+ } catch(\Exception $e) {
+ return self::error($id, $e->getCode(), $e->getMessage());
+ }
if ($result != false) {
return self::response($id, $result);
@@ -232,7 +285,7 @@ private static function requestError($id = null) {
* @return array
* Returns an error object.
*/
- private static function error($id, $code, $message, $data = null) {
+ protected static function error($id, $code, $message, $data = null) {
$error = array(
'code' => $code,
'message' => $message
@@ -270,4 +323,5 @@ private static function response($id, $result) {
);
}
+
}
diff --git a/www/app/api/orders.php b/www/app/api/orders.php
deleted file mode 100644
index 9dd5078de..000000000
--- a/www/app/api/orders.php
+++ /dev/null
@@ -1,17 +0,0 @@
-OKAnswer();
- }
-
- public function get($params) {
-
- $xml = "";
- /*
- $conn = \ZDB\DB::getConnect();
- $groups = array();
-
- $rs = $conn->Execute('select distinct * from erp_item_group where group_id in (select group_id from erp_item where price > 0) order by group_name');
- foreach ($rs as $row) {
- $groups[$row['group_id']] = $row['group_name'];
- }
-
-
-
- foreach ($groups as $id => $name) {
- $xml .= "";
- $xml .= "";
- $rs = $conn->Execute("select * from erp_item_view where group_id ={$id} order by itemname");
- foreach ($rs as $row) {
- $price = number_format($row['price'] / 100, 2, '.', "");
- $xml .= "- ";
- $xml .= "";
- $xml .= "{$price}";
- $xml .= "{$row['measure_name']}";
- $xml .= "";
- $xml .= "
";
- }
-
- $xml .= "";
- }
- */
- $this->XMLAnswer($xml . "");
- }
-
-}
diff --git a/www/app/restful.php b/www/app/api/restful.php
similarity index 98%
rename from www/app/restful.php
rename to www/app/api/restful.php
index a2cb541a4..9425cb00a 100644
--- a/www/app/restful.php
+++ b/www/app/api/restful.php
@@ -1,6 +1,6 @@
'Hi');
+ }
+
+}
diff --git a/www/app/api/testrest.php b/www/app/api/testrest.php
new file mode 100644
index 000000000..e42e6bfc5
--- /dev/null
+++ b/www/app/api/testrest.php
@@ -0,0 +1,17 @@
+TextAnswer("Hi");
+ }
+
+}
diff --git a/www/app/application.php b/www/app/application.php
index 526671d8a..742c5964b 100644
--- a/www/app/application.php
+++ b/www/app/application.php
@@ -80,20 +80,22 @@ public function Route($uri) {
$page = new $class;
// RESTFul
- if ($page instanceof \App\RestFul) {
+ if ($page instanceof \App\API\JsonRPCRestFul) {
$params = array_slice($api, 2);
$page->Execute($params);
die;
}
// JSON-RPC
- if ($page instanceof \App\JsonRPC) {
+ if ($page instanceof \App\API\JsonRPC) {
$page->Execute();
die;
}
//для произвольной страницы
$params = array_slice($api, 3);
- call_user_func_array(array($page, $api[2]), $params);
+ if (strlen($api[2]) > 0) {
+ call_user_func_array(array($page, $api[2]), $params);
+ }
die;
} catch(\Throwable $e) {
global $logger;
diff --git a/www/app/entity/doc/document.php b/www/app/entity/doc/document.php
index a9297c1a0..dd5eac0f4 100644
--- a/www/app/entity/doc/document.php
+++ b/www/app/entity/doc/document.php
@@ -13,22 +13,22 @@ class Document extends \ZCL\DB\Entity
{
// состояния документа
- const STATE_NEW = 1; //Новый
- const STATE_EDITED = 2; //Отредактирован
- const STATE_CANCELED = 3; //Отменен
- const STATE_EXECUTED = 5; // Проведен
- const STATE_DELETED = 6; // Удален
- const STATE_INPROCESS = 7; // в работе
- const STATE_WA = 8; // ждет подтверждения
- const STATE_CLOSED = 9; // Закрыт , доставлен, выполнен
- const STATE_INSHIPMENT = 11; // Отгружен
- const STATE_DELIVERED = 14; // доставлен
- const STATE_REFUSED = 15; // отклонен
- const STATE_SHIFTED = 16; // отложен
- const STATE_FAIL = 17; // Аннулирован
- const STATE_FINISHED = 18; // Закончен
- const STATE_APPROVED = 19; // Готов к выполнению
- // const STATE_READYTOEXE = 20; // готов к выполнению
+ const STATE_NEW = 1; //Новый
+ const STATE_EDITED = 2; //Отредактирован
+ const STATE_CANCELED = 3; //Отменен
+ const STATE_EXECUTED = 5; // Проведен
+ const STATE_DELETED = 6; // Удален
+ const STATE_INPROCESS = 7; // в работе
+ const STATE_WA = 8; // ждет подтверждения
+ const STATE_CLOSED = 9; // Закрыт , доставлен, выполнен
+ const STATE_INSHIPMENT = 11; // Отгружен
+ const STATE_DELIVERED = 14; // доставлен
+ const STATE_REFUSED = 15; // отклонен
+ const STATE_SHIFTED = 16; // отложен
+ const STATE_FAIL = 17; // Аннулирован
+ const STATE_FINISHED = 18; // Закончен
+ const STATE_APPROVED = 19; // Готов к выполнению
+ const STATE_READYTOSHIP = 20; // готов к отправке
// типы экспорта
const EX_WORD = 1; // Word
const EX_EXCEL = 2; // Excel
@@ -38,6 +38,12 @@ class Document extends \ZCL\DB\Entity
// const EX_XML_GNAU = 4;
+ //доставка
+ const DEL_SELF = 1; // самовывоз
+ const DEL_BOY = 2; // курьер
+ const DEL_SERVICE = 3; // служба доставки
+
+
/**
* Ассоциативный массив с атрибутами заголовка документа
*
@@ -115,17 +121,6 @@ protected function beforeSave() {
$this->packData();
}
- public function checkUniqueNumber() {
- $this->document_number = trim($this->document_number);
-
- $doc = Document::getFirst(" document_number = '{$this->document_number}' ");
- if ($doc instanceof Document) {
- if ($this->document_id != $doc->document_id) {
- return false;
- }
- }
- return true;
- }
/**
* Упаковка данных в XML
@@ -413,12 +408,28 @@ public static function getStateName($state) {
return Helper::l('st_fail');
case Document::STATE_INPROCESS:
return Helper::l('st_inprocess');
+ case Document::STATE_READYTOSHIP:
+ return Helper::l('st_rdshipment');
default:
return Helper::l('st_unknow');
}
}
+
+ public function checkUniqueNumber() {
+ $this->document_number = trim($this->document_number);
+ $class = explode("\\", get_called_class());
+ $metaname = $class[count($class) - 1];
+ $doc = Document::getFirst("meta_name='" . $metaname . "' and document_number = '{$this->document_number}' ");
+ if ($doc instanceof Document) {
+ if ($this->document_id != $doc->document_id) {
+ return false;
+ }
+ }
+ return true;
+ }
+
/**
* Возвращает следующий номер при автонумерации
*
@@ -451,8 +462,8 @@ public function nextNumber($branch_id = 0) {
}
$letter = preg_replace('/[0-9]/', '', $prevnumber);
-
- return $letter . sprintf("%05d", ++$number);
+ $next = $letter . sprintf("%05d", ++$number);
+ return $next;
}
/**
@@ -691,6 +702,18 @@ public static function getDesc($meta_name) {
return self::$_metalist[$meta_name];
}
+ /**
+ * Список типов доставки
+ */
+ public static function getDeliveryTypes() {
+ $list = array();
+ $list[self::DEL_SELF] = Helper::l('delself');
+ $list[self::DEL_BOY] = Helper::l('delboy');
+ $list[self::DEL_SERVICE] = Helper::l('delservice');
+
+ return $list;
+ }
+
/**
* Отправка документа по почте
diff --git a/www/app/entity/doc/goodsissue.php b/www/app/entity/doc/goodsissue.php
index c1d22f0ea..f1702655b 100644
--- a/www/app/entity/doc/goodsissue.php
+++ b/www/app/entity/doc/goodsissue.php
@@ -58,12 +58,7 @@ public function generateReport() {
"isfirm" => strlen($firm["firm_name"]) > 0,
"iscontract" => $this->headerdata["contract_id"] > 0,
"store_name" => $this->headerdata["store_name"],
- "weight" => $weight > 0 ? H::l("allweight", $weight) : '',
- "ship_address" => $this->headerdata["ship_address"],
- "ship_number" => $this->headerdata["ship_number"],
- "delivery_cost" => H::fa($this->headerdata["delivery_cost"]),
"order" => strlen($this->headerdata["order"]) > 0 ? $this->headerdata["order"] : false,
- "emp_name" => $this->headerdata["emp_name"],
"document_number" => $this->document_number,
"totalstr" => $totalstr,
@@ -82,14 +77,6 @@ public function generateReport() {
}
- if ($this->headerdata["sent_date"] > 0) {
- $header['sent_date'] = H::fd($this->headerdata["sent_date"]);
- }
- if ($this->headerdata["delivery_date"] > 0) {
- $header['delivery_date'] = H::fd($this->headerdata["delivery_date"]);
- }
- $header["isdelivery"] = $this->headerdata["delivery"] > 1;
-
$report = new \App\Report('doc/goodsissue.tpl');
$html = $report->generate($header);
@@ -136,6 +123,7 @@ public function getRelationBased() {
$list['Warranty'] = self::getDesc('Warranty');
$list['ReturnIssue'] = self::getDesc('ReturnIssue');
$list['GoodsIssue'] = self::getDesc('GoodsIssue');
+ $list['TTN'] = self::getDesc('TTN');
return $list;
}
@@ -144,8 +132,8 @@ protected function getNumberTemplate() {
return 'РН-000000';
}
-
- public function generatePosReport() {
+
+ public function generatePosReport() {
$detail = array();
@@ -179,10 +167,10 @@ public function generatePosReport() {
return $html;
}
-
-
- public function supportedExport() {
- return array(self::EX_EXCEL, self::EX_POS, self::EX_PDF);
+
+
+ public function supportedExport() {
+ return array(self::EX_EXCEL, self::EX_POS, self::EX_PDF);
}
-
+
}
diff --git a/www/app/entity/doc/incomeitem.php b/www/app/entity/doc/incomeitem.php
index 64445abc0..b895a8713 100644
--- a/www/app/entity/doc/incomeitem.php
+++ b/www/app/entity/doc/incomeitem.php
@@ -26,6 +26,10 @@ public function Execute() {
$sc->save();
}
+ if ($this->headerdata['emp'] > 0 && $this->headerdata['exmf'] > 0 && $this->headerdata['examount'] > 0) {
+ \App\Entity\Pay::addPayment($this->document_id, $this->document_date, $this->headerdata['examount'], $this->headerdata['exmf'], \App\Entity\Pay::PAY_BASE_INCOME, $this->notes);
+
+ }
return true;
}
@@ -54,9 +58,16 @@ public function generateReport() {
'date' => H::fd($this->document_date),
"total" => H::fa($this->amount),
"to" => $this->headerdata["storename"],
+ "emp" => false,
"notes" => $this->notes,
"document_number" => $this->document_number
);
+ if ($this->headerdata["emp"] > 0 && $this->headerdata['examount']) {
+ $header['emp'] = $this->headerdata["empname"];
+ $header['examount'] = H::fa($this->headerdata["examount"]);
+
+ }
+
$report = new \App\Report('doc/incomeitem.tpl');
$html = $report->generate($header);
diff --git a/www/app/entity/doc/incomemoney.php b/www/app/entity/doc/incomemoney.php
index 94603128c..ea65db2e3 100644
--- a/www/app/entity/doc/incomemoney.php
+++ b/www/app/entity/doc/incomemoney.php
@@ -29,6 +29,8 @@ public function generateReport() {
'amount' => H::fa($this->amount),
'date' => H::fd($this->document_date),
"notes" => $this->notes,
+ "customer" => $this->customer_id > 0 ? $this->customer_name : false,
+ "emp" => strlen($this->headerdata["emp_name"]) > 0 ? $this->headerdata["emp_name"] : false,
"type" => $pt[$this->headerdata["type"]],
"to" => $this->headerdata["paymentname"],
"document_number" => $this->document_number
diff --git a/www/app/entity/doc/invoice.php b/www/app/entity/doc/invoice.php
index 94019f481..9fe83c930 100644
--- a/www/app/entity/doc/invoice.php
+++ b/www/app/entity/doc/invoice.php
@@ -108,6 +108,7 @@ public function getRelationBased() {
$list = array();
$list['GoodsIssue'] = self::getDesc('GoodsIssue');
$list['Invoice'] = self::getDesc('Invoice');
+ $list['TTN'] = self::getDesc('TTN');
return $list;
}
diff --git a/www/app/entity/doc/order.php b/www/app/entity/doc/order.php
index 2d3eaf406..4e8f6b004 100644
--- a/www/app/entity/doc/order.php
+++ b/www/app/entity/doc/order.php
@@ -50,19 +50,16 @@ public function generateReport() {
"phone" => $this->headerdata["phone"],
"email" => $this->headerdata["email"],
"delivery" => $this->headerdata["delivery_name"],
+ "ship_address" => strlen($this->headerdata["ship_address"]) > 0 ? $this->headerdata["ship_address"] : false,
"notes" => $this->notes,
"document_number" => $this->document_number,
- "total" => H::fa($this->amount)
+ "total" => H::fa($this->amount),
+ "payed" => H::fa($this->payed),
+ "paydisc" => H::fa($this->headerdata["paydisc"]),
+ "isdisc" => $this->headerdata["paydisc"] > 0,
+ //"prepaid" => $this->headerdata['payment'] == \App\Entity\MoneyFund::PREPAID,
+ "payamount" => H::fa($this->payamount)
);
- if ($this->headerdata["delivery"] == 2 || $this->headerdata["delivery"] == 3) {
- $header['delivery'] = $header['delivery'] . '. по адресу: ' . $this->headerdata["address"];
- }
-
- $list = $this->getChildren('GoodsIssue');
- foreach ($list as $d) {
-
- $header['ttn'] = $d->document_number;
- }
$report = new \App\Report('doc/order.tpl');
@@ -84,6 +81,7 @@ public function getRelationBased() {
$list['Invoice'] = self::getDesc('Invoice');
$list['POSCheck'] = self::getDesc('POSCheck');
$list['Task'] = self::getDesc('Task');
+ $list['TTN'] = self::getDesc('TTN');
return $list;
@@ -129,4 +127,28 @@ public function generatePosReport() {
return $html;
}
+
+ public function Execute() {
+ //$conn = \ZDB\DB::getConnect();
+
+
+ //списываем бонусы
+ if ($this->headerdata['paydisc'] > 0 && $this->customer_id > 0) {
+ $customer = \App\Entity\Customer::load($this->customer_id);
+ if ($customer->discount > 0) {
+ return; //процент
+ } else {
+ $customer->bonus = $customer->bonus - ($this->headerdata['paydisc'] > 0 ? $this->headerdata['paydisc'] : 0);
+ $customer->save();
+ }
+ }
+
+
+ if ($this->headerdata['payment'] > 0 && $this->payed > 0) {
+ \App\Entity\Pay::addPayment($this->document_id, $this->document_date, $this->payed, $this->headerdata['payment'], \App\Entity\Pay::PAY_BASE_INCOME);
+ }
+
+ return true;
+ }
+
}
diff --git a/www/app/entity/doc/outcomemoney.php b/www/app/entity/doc/outcomemoney.php
index 72bc0297a..298b64448 100644
--- a/www/app/entity/doc/outcomemoney.php
+++ b/www/app/entity/doc/outcomemoney.php
@@ -29,6 +29,8 @@ public function generateReport() {
'amount' => H::fa($this->amount),
'date' => H::fd($this->document_date),
"notes" => $this->notes,
+ "customer" => $this->customer_id > 0 ? $this->customer_name : false,
+ "emp" => strlen($this->headerdata["emp_name"]) > 0 ? $this->headerdata["emp_name"] : false,
"from" => $this->headerdata["paymentname"],
"type" => $pt[$this->headerdata["type"]],
"document_number" => $this->document_number
diff --git a/www/app/entity/doc/poscheck.php b/www/app/entity/doc/poscheck.php
index b32db36dd..07f9521a1 100644
--- a/www/app/entity/doc/poscheck.php
+++ b/www/app/entity/doc/poscheck.php
@@ -49,7 +49,7 @@ public function generateReport() {
$common = \App\System::getOptions('common');
- $firm = H::getFirmData($this->firm_id );
+ $firm = H::getFirmData($this->firm_id);
$header = array('date' => H::fd($this->document_date),
"_detail" => $detail,
diff --git a/www/app/entity/doc/task.php b/www/app/entity/doc/task.php
index 4e5aa48b7..806d83d21 100644
--- a/www/app/entity/doc/task.php
+++ b/www/app/entity/doc/task.php
@@ -36,7 +36,7 @@ public function generateReport() {
"quantity" => H::fqty($ser->quantity),
"cost" => H::fa($ser->cost * $ser->quantity),
- "hours" => $ser->hours * $ser->qty
+ "hours" => $ser->hours * $ser->qty
);
}
diff --git a/www/app/entity/doc/ttn.php b/www/app/entity/doc/ttn.php
new file mode 100644
index 000000000..d1b96c5a1
--- /dev/null
+++ b/www/app/entity/doc/ttn.php
@@ -0,0 +1,123 @@
+unpackDetails('detaildata') as $item) {
+
+
+ $name = $item->itemname;
+ if (strlen($item->snumber) > 0) {
+ $s = ' (' . $item->snumber . ' )';
+ if (strlen($item->sdate) > 0) {
+ $s = ' (' . $item->snumber . ',' . H::fd($item->sdate) . ')';
+ }
+ $name .= $s;
+
+ }
+ if ($item->weight > 0) {
+ $weight += $item->weight;
+ }
+
+ $detail[] = array("no" => $i++,
+ "tovar_name" => $name,
+ "tovar_code" => $item->item_code,
+ "quantity" => H::fqty($item->quantity),
+ "msr" => $item->msr,
+
+ "price" => H::fa($item->price),
+ "amount" => H::fa($item->quantity * $item->price)
+ );
+
+ }
+
+
+ $firm = H::getFirmData($this->firm_id, $this->branch_id);
+
+ $header = array('date' => H::fd($this->document_date),
+ "_detail" => $detail,
+ "firm_name" => $firm['firm_name'],
+ "customer_name" => $this->customer_id ? $this->customer_name : $this->headerdata["customer_name"],
+ "isfirm" => strlen($firm["firm_name"]) > 0,
+ "store_name" => $this->headerdata["store_name"],
+ "weight" => $weight > 0 ? H::l("allweight", $weight) : '',
+ "ship_address" => strlen($this->headerdata["ship_address"]) > 0 ? $this->headerdata["ship_address"] : false,
+ "ship_number" => strlen($this->headerdata["ship_number"]) > 0 ? $this->headerdata["ship_number"] : false,
+ "delivery_name" => $this->headerdata["delivery_name"],
+ "order" => strlen($this->headerdata["order"]) > 0 ? $this->headerdata["order"] : false,
+ "emp_name" => $this->headerdata["emp_name"],
+ "document_number" => $this->document_number,
+
+
+ "total" => H::fa($this->amount),
+ );
+
+
+ if ($this->headerdata["sent_date"] > 0) {
+ $header['sent_date'] = H::fd($this->headerdata["sent_date"]);
+ }
+ if ($this->headerdata["delivery_date"] > 0) {
+ $header['delivery_date'] = H::fd($this->headerdata["delivery_date"]);
+ }
+
+ $report = new \App\Report('doc/ttn.tpl');
+
+ $html = $report->generate($header);
+
+ return $html;
+ }
+
+ public function Execute() {
+ //$conn = \ZDB\DB::getConnect();
+
+
+ foreach ($this->unpackDetails('detaildata') as $item) {
+ $listst = \App\Entity\Stock::pickup($this->headerdata['store'], $item);
+
+ foreach ($listst as $st) {
+ $sc = new Entry($this->document_id, 0 - $st->quantity * $item->price, 0 - $st->quantity);
+ $sc->setStock($st->stock_id);
+ $sc->setExtCode($item->price - $st->partion); //Для АВС
+ $sc->save();
+ }
+ }
+
+
+ return true;
+ }
+
+ public function getRelationBased() {
+ $list = array();
+ $list['Warranty'] = self::getDesc('Warranty');
+ $list['ReturnIssue'] = self::getDesc('ReturnIssue');
+ $list['GoodsIssue'] = self::getDesc('GoodsIssue');
+
+ return $list;
+ }
+
+ protected function getNumberTemplate() {
+ return 'ТТН-000000';
+ }
+
+
+ public function supportedExport() {
+ return array(self::EX_EXCEL, self::EX_PDF);
+ }
+
+}
diff --git a/www/app/entity/pay.php b/www/app/entity/pay.php
index df9a395ec..009b56e62 100644
--- a/www/app/entity/pay.php
+++ b/www/app/entity/pay.php
@@ -104,7 +104,7 @@ public static function addPayment($document_id, $paydate, $amount, $mf_id, $type
$pay = new \App\Entity\Pay();
$pay->mf_id = $mf_id;
$pay->document_id = $document_id;
- $pay->amount = 0-($amount * $mf->btran / 100);
+ $pay->amount = 0 - ($amount * $mf->btran / 100);
$pay->paytype = Pay::PAY_BASE_OUTCOME;
$pay->paydate = $paydate;
$pay->notes = \App\Helper::l('bankproc');
diff --git a/www/app/helper.php b/www/app/helper.php
index 8f8b6ba9b..a25a0f68d 100644
--- a/www/app/helper.php
+++ b/www/app/helper.php
@@ -671,72 +671,69 @@ public static function getValList() {
return $list;
}
-
- public static function exportExcel($data,$header,$filename){
+
+ public static function exportExcel($data, $header, $filename) {
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
-
+
$sheet = $spreadsheet->getActiveSheet();
-
-
-
- foreach($header as $k=>$v) {
-
- $sheet->setCellValue($k, $v);
- $sheet->getStyle($k)->applyFromArray([
+
+
+ foreach ($header as $k => $v) {
+
+ $sheet->setCellValue($k, $v);
+ $sheet->getStyle($k)->applyFromArray([
'font' => [
-
- 'bold' => true
-
- ]
- ]);
-
- }
-
- foreach($data as $k=>$v) {
-
-
- $sheet->setCellValue($k, $v);
-
-
- }
-
-
-
- /*
- $sheet->getStyle('A1')->applyFromArray([
- 'font' => [
- 'name' => 'Arial',
- 'bold' => true,
- 'italic' => false,
- 'underline' => Font::UNDERLINE_DOUBLE,
- 'strikethrough' => false,
- 'color' => [
- 'rgb' => '808080'
+
+ 'bold' => true
+
]
- ],
- 'borders' => [
- 'allBorders' => [
- 'borderStyle' => Border::BORDER_THIN,
- 'color' => [
- 'rgb' => '808080'
- ]
- ],
- ],
- 'alignment' => [
- 'horizontal' => Alignment::HORIZONTAL_CENTER,
- 'vertical' => Alignment::VERTICAL_CENTER,
- 'wrapText' => true,
- ]
- ]);
-
- */
+ ]);
+
+ }
+
+ foreach ($data as $k => $v) {
+
+
+ $sheet->setCellValue($k, $v);
+
+
+ }
+
+
+ /*
+ $sheet->getStyle('A1')->applyFromArray([
+ 'font' => [
+ 'name' => 'Arial',
+ 'bold' => true,
+ 'italic' => false,
+ 'underline' => Font::UNDERLINE_DOUBLE,
+ 'strikethrough' => false,
+ 'color' => [
+ 'rgb' => '808080'
+ ]
+ ],
+ 'borders' => [
+ 'allBorders' => [
+ 'borderStyle' => Border::BORDER_THIN,
+ 'color' => [
+ 'rgb' => '808080'
+ ]
+ ],
+ ],
+ 'alignment' => [
+ 'horizontal' => Alignment::HORIZONTAL_CENTER,
+ 'vertical' => Alignment::VERTICAL_CENTER,
+ 'wrapText' => true,
+ ]
+ ]);
+
+ */
$writer = new \PhpOffice\PhpSpreadsheet\Writer\Xlsx($spreadsheet);
-
-
-
+
+
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
- header('Content-Disposition: attachment; filename="'.$filename.'"');
- $writer->save('php://output');
+ header('Content-Disposition: attachment; filename="' . $filename . '"');
+ $writer->save('php://output');
die;
}
diff --git a/www/app/modules/ppo/ppohelper.php b/www/app/modules/ppo/ppohelper.php
index 8ec262667..797bcdfd2 100644
--- a/www/app/modules/ppo/ppohelper.php
+++ b/www/app/modules/ppo/ppohelper.php
@@ -110,7 +110,7 @@ public static function send($data, $type, $server, $port, $encrypted) {
if ($signed['success'] == true) {
- file_put_contents("d:/leon/denwer72/home/local.gost/www/signedask",$signed['data']) ;
+ file_put_contents("d:/leon/denwer72/home/local.gost/www/signedask", $signed['data']);
$request = curl_init();
curl_setopt_array($request, [
@@ -269,7 +269,7 @@ public static function zform($posid, $stat, $rstat) {
//реализация
$n = 1;
-
+
if ($stat['amount0'] > 0) {
$header['pays'][] = array(
'formname' => H::l('ppo_nal'),
@@ -315,7 +315,7 @@ public static function zform($posid, $stat, $rstat) {
//возврат
$n = 1;
-
+
if ($rstat['amount0'] > 0) {
$header['paysr'][] = array(
'formname' => H::l('ppo_nal'),
@@ -336,8 +336,8 @@ public static function zform($posid, $stat, $rstat) {
$amountr = $amountr + $rstat['amount1'];
$n++;
}
-
-
+
+
$header['amount'] = number_format($amount, 2, '.', '');
$header['amountr'] = number_format($amountr, 2, '.', '');
$header['cnt'] = $cnt;
@@ -348,7 +348,7 @@ public static function zform($posid, $stat, $rstat) {
$report = new \App\Report('zform.xml');
$xml = $report->generate($header);
-
+
$xml = mb_convert_encoding($xml, "windows-1251", "utf-8");
return self::send($xml, 'doc', $firm['pposerver'], $firm['pposerverport'], true);
@@ -526,7 +526,7 @@ public static function check($doc) {
*
* @param mixed $doc
*/
- public static function checkpay($doc,$pos_id,$payed,$payment) {
+ public static function checkpay($doc, $pos_id, $payed, $payment) {
$pos = \App\Entity\Pos::load($pos_id);
@@ -601,7 +601,7 @@ public static function checkback($doc) {
$pos = \App\Entity\Pos::load($doc->headerdata['pos']);
$firm = \App\Helper::getFirmData($pos->firm_id);
- $mf = \App\Entity\MoneyFund::load($doc->headerdata['payment']);
+ $mf = \App\Entity\MoneyFund::load($doc->headerdata['payment']);
$header = array();
@@ -643,7 +643,7 @@ public static function checkback($doc) {
$n = 1;
$header['amount'] = 0;
- foreach ($doc->unpackDetails('detaildata') as $item) {
+ foreach ($doc->unpackDetails('detaildata') as $item) {
$header['details'][] = array(
'num' => "ROWNUM=\"{$n}\"",
'name' => $item->itemname,
diff --git a/www/app/modules/ppo/ppolist.php b/www/app/modules/ppo/ppolist.php
index 9c7c6c6f0..8f619c6ae 100644
--- a/www/app/modules/ppo/ppolist.php
+++ b/www/app/modules/ppo/ppolist.php
@@ -106,7 +106,7 @@ public function ppoOnRow($row) {
$row->add(new Label('fn', $item->tr->NumFiscal));
$row->add(new Label('ln', $item->tr->NumLocal));
$row->add(new Label('rn', $item->tr->Name));
-
+
$row->add(new ClickLink('objdet', $this, 'onObj'));
}
@@ -123,7 +123,7 @@ public function onObj($sender) {
public function updateShifts() {
$this->_shlist = array();
- $from = \Carbon\Carbon::now()->addMonth(-1)->startOfMonth()->format('c');
+ $from = \Carbon\Carbon::now()->addMonths(-1)->startOfMonth()->format('c');
$to = \Carbon\Carbon::now()->format('c');
$cid = $this->opan->filter->searchcomp->getValue();
$firm = Firm::load($cid);
diff --git a/www/app/modules/shop/entity/image.php b/www/app/modules/shop/entity/image.php
new file mode 100644
index 000000000..9dbc2b1ce
--- /dev/null
+++ b/www/app/modules/shop/entity/image.php
@@ -0,0 +1,17 @@
+group_id);
$this->sfilter->add(new TextInput('pricefrom'))->setText(floor($pr["minp"]));
- $this->sfilter->add(new TextInput('priceto'))->setText(ceil($pr["maxp"]));;
+ $this->sfilter->add(new TextInput('priceto'))->setText(ceil($pr["maxp"]));
$this->sfilter->add(new TextInput('searchkey'));
@@ -125,7 +125,7 @@ public function onSClear($sender) {
$this->sfilter->clean();
$pr = Helper::getPriceRange($this->group_id);
$this->sfilter->pricefrom->setText(floor($pr["minp"] / 100));
- $this->sfilter->priceto->setText(ceil($pr["maxp"] / 100));;
+ $this->sfilter->priceto->setText(ceil($pr["maxp"] / 100));
$this->catlist->Reload();
}
diff --git a/www/app/modules/shop/pages/productlist.php b/www/app/modules/shop/pages/productlist.php
index 019077f83..2308f546d 100644
--- a/www/app/modules/shop/pages/productlist.php
+++ b/www/app/modules/shop/pages/productlist.php
@@ -355,8 +355,8 @@ public function onImageSubmit($sender) {
}
$r = ((double)$imagedata[0]) / $imagedata[1];
if ($r > 1.1 || $r < 0.9) {
- $this->setError('squareimage');
- return;
+ $this->setError('squareimage');
+ return;
}
$image = new \App\Entity\Image();
diff --git a/www/app/modules/tecdoc/apihelper.php b/www/app/modules/tecdoc/apihelper.php
index 9e308bb74..60d77ce25 100644
--- a/www/app/modules/tecdoc/apihelper.php
+++ b/www/app/modules/tecdoc/apihelper.php
@@ -6,19 +6,17 @@ class APIHelper
{
private $type;
private $api;
-
+
public function __construct($type = 'passenger') {
$this->type = $type;
$modules = \App\System::getOptions("modules");
-
-
+
$this->token = $modules['td_code'];
$this->email = $modules['td_email'];
-
- $this->api = $modules['td_host'];
-
- $this->api =rtrim($this->api,'/') . '/';
+
+
+ $this->api = rtrim($modules['td_host'], '/') . '/api';
}
@@ -31,14 +29,14 @@ private function fetch($plist) {
$ask = trim($ask, '&');
$url = $this->api . "?" . $ask;
- try{
+ try {
$ret = \Fetch\fetch($this->api . "?" . $ask, [
'headers' => [
'Accept' => 'application/json',
],
])->json(true);
- } catch(\Exception $e) {
- return array('success' => false, 'error' => $e->getMessage());
+ } catch(\Exception $e) {
+ return array('success' => false, 'error' => $e->getMessage());
}
if (is_array($ret)) {
@@ -84,14 +82,14 @@ public function getTree($modif_id) {
}
public function searchByCategory($id, $modif_id) {
- return $this->fetch(array('cmd' => 'searchByCategory', 'type' => $this->type, 'modif_id' => $modif_id, 'nodeid' => $id));
+ return $this->fetch(array('cmd' => 'searchByCategory', 'type' => $this->type, 'modif_id' => $modif_id, 'node_id' => $id));
}
public function searchByBrandAndCode($code, $brand) {
- return $this->fetch(array('cmd' => 'searchByBrandAndCode', 'code' => $code, 'brand' => $brand));
+ return $this->fetch(array('cmd' => 'searchByBrandAndCode', 'partnumber' => $code, 'brand' => $brand));
}
diff --git a/www/app/modules/tecdoc/options.php b/www/app/modules/tecdoc/options.php
index 4191213a1..35a7ec350 100644
--- a/www/app/modules/tecdoc/options.php
+++ b/www/app/modules/tecdoc/options.php
@@ -26,29 +26,29 @@ public function __construct() {
$modules = System::getOptions("modules");
$form = $this->add(new Form("cform"));
-
+
$form->add(new TextInput('host', $modules['td_host']));
$form->add(new TextInput('code', $modules['td_code']));
-
+
$form->add(new DropDownChoice('defpricetype', \App\Entity\Item::getPriceTypeList(), $modules['td_pricetype']));
$form->add(new DropDownChoice('defstore', \App\Entity\Store::getList(), $modules['td_store']));
$form->add(new SubmitButton('save'))->onClick($this, 'saveOnClick');
-
+
}
-
+
public function saveOnClick($sender) {
$modules = System::getOptions("modules");
$modules['td_pricetype'] = $this->cform->defpricetype->getValue();
$modules['td_store'] = $this->cform->defstore->getValue();
-
+
$modules['td_host'] = $this->cform->host->getText();
$modules['td_code'] = $this->cform->code->getText();
-
+
System::setOptions("modules", $modules);
$this->setSuccess('saved');
}
diff --git a/www/app/modules/tecdoc/search.php b/www/app/modules/tecdoc/search.php
index a42b920ec..72082274e 100644
--- a/www/app/modules/tecdoc/search.php
+++ b/www/app/modules/tecdoc/search.php
@@ -21,8 +21,9 @@
class Search extends \App\Pages\Base
{
- public $_ds = array();
+ public $_ds = array();
public $_card = array();
+
public function __construct() {
parent::__construct();
@@ -46,7 +47,7 @@ public function __construct() {
$tablist->add(new Form('search1form'));
- $tablist->search1form->add(new DropDownChoice('stype', array('passenger' => 'Авто', 'commercial' => 'Грузовик', 'motorbike' => 'Мотоцикл' ), 'passenger'))->onChange($this, 'onType');
+ $tablist->search1form->add(new DropDownChoice('stype', array('passenger' => 'Авто', 'commercial' => 'Грузовик', 'motorbike' => 'Мотоцикл'), 'passenger'))->onChange($this, 'onType');
$tablist->search1form->add(new DropDownChoice('sbrand', array(), 0))->onChange($this, 'onBrand');
$tablist->search1form->add(new DropDownChoice('smodel', array(), 0))->onChange($this, 'onModel');
$tablist->search1form->add(new DropDownChoice('smodif', array(), 0))->onChange($this, 'onModif');
@@ -73,18 +74,17 @@ public function __construct() {
$this->add(new Panel('tview'))->setVisible(false);
-
+
//Корзина
- $this->_card = \App\Session::getSession()->cardlist ;
- if(!is_array($this->_card))$this->_card=array();
- $this->add(new Panel('cartpan'))->setVisible(count($this->_card)>0);
- $this->cartpan->add(new DataView('cardlist', new ArrayDataSource(new Bind($this, "_card")), $this, 'cardOnRow'));
- $this->cartpan->cardlist->Reload();
- $this->cartpan->add(new ClickLink('copycart',$this,'OnCopy'));
-
-
-
-
+ $this->_card = \App\Session::getSession()->clipboard;
+ if (!is_array($this->_card)) {
+ $this->_card = array();
+ }
+ $this->tlist->add(new Panel('cartpan'))->setVisible(count($this->_card) > 0);
+ $this->tlist->cartpan->add(new DataView('cardlist', new ArrayDataSource(new Bind($this, "_card")), $this, 'cardOnRow'));
+ $this->tlist->cartpan->cardlist->Reload();
+ $this->tlist->cartpan->add(new ClickLink('copycart', $this, 'OnCopy'));
+
$this->onTab($this->tpanel->tabl);
$this->onType($tablist->search1form->stype);
@@ -420,7 +420,7 @@ public function listOnRow($row) {
}
$row->add(new ClickLink('show'))->onClick($this, 'showOnClick');
$row->add(new ClickLink('cart', $this, "OnCart"));//->setVisible($item->quantity>0);
-
+
}
public function showOnClick($sender) {
@@ -461,7 +461,7 @@ public function showOnClick($sender) {
if (strlen($ret['data']) > 0) {
$this->_tvars['isimage'] = true;
- $this->_tvars['imagepath'] = str_replace('.BMP', '.jpg', $ret['data']);
+ $this->_tvars['imagepath'] = "/proxy.php?im=" . $ret['data'];
}
@@ -582,7 +582,7 @@ public function showOnClick($sender) {
}
-
+
public function cardOnRow($row) {
$item = $row->getDataItem();
$row->add(new Label('carditem', $item->itemname));
@@ -591,13 +591,13 @@ public function cardOnRow($row) {
$row->add(new ClickLink('delcard', $this, "OnDelCart"));
}
-
+
public function OnCart($sender) {
$item = $sender->getOwner()->getDataItem();
- $item->itemname = $item->product_name ;
- $item->manufacturer = $item->brand ;
- $item->item_code = $item->part_number;
-
+ $item->itemname = $item->product_name;
+ $item->manufacturer = $item->brand;
+ $item->item_code = $item->part_number;
+
if ($item->item_id > 0) {
$item->item_code = $item->product_name;
@@ -606,40 +606,40 @@ public function OnCart($sender) {
$_item = Item::getFirst("item_code=" . Item::qstr($item->part_number) . " and manufacturer=" . Item::qstr($item->brand));
if ($_item instanceof Item) {
$item->item_id = $_item->item_id;
-
-
+
+
} else {
$_item = new Item();
$_item->itemname = $item->product_name;
-
+
$_item->item_code = $item->part_number;
$_item->manufacturer = $item->brand;
-
+
$_item->save();
$item->item_id = $_item->item_id;
$item->quantity = 1;
$this->_card[$item->item_id] = $item;
}
}
-
- $this->_card[$item->item_id] = $item ;
- $this->cartpan->cardlist->Reload();
- $this->cartpan->setVisible(count($this->_card) > 0);
-
+
+ $this->_card[$item->item_id] = $item;
+ $this->tlist->cartpan->cardlist->Reload();
+ $this->tlist->cartpan->setVisible(count($this->_card) > 0);
+
}
public function OnDelCart($sender) {
$item = $sender->getOwner()->getDataItem();
$this->_card = array_diff_key($this->_card, array($item->item_id => $this->_card[$item->item_id]));
- $this->cartpan->cardlist->Reload();
- $this->cartpan->setVisible(count($this->_card) > 0);
-
+ $this->tlist->cartpan->cardlist->Reload();
+ $this->tlist->cartpan->setVisible(count($this->_card) > 0);
+
}
-
+
public function OnCopy($sender) {
-
- \App\Session::getSession()->clipboard=$this->_card;
- $this->setInfo('Скопировано');
+
+ \App\Session::getSession()->clipboard = $this->_card;
+ $this->setInfo('Скопировано');
}
-
+
}
\ No newline at end of file
diff --git a/www/app/pages/doc/goodsissue.php b/www/app/pages/doc/goodsissue.php
index 7470575c2..a2fa7087b 100644
--- a/www/app/pages/doc/goodsissue.php
+++ b/www/app/pages/doc/goodsissue.php
@@ -48,8 +48,6 @@ public function __construct($docid = 0, $basedocid = 0) {
$this->docform->add(new TextInput('document_number'));
$this->docform->add(new Date('document_date'))->setDate(time());
- $this->docform->add(new Date('sent_date'));
- $this->docform->add(new Date('delivery_date'));
$this->docform->add(new DropDownChoice('payment', MoneyFund::getList(true, true), H::getDefMF()))->onChange($this, 'OnPayment');
@@ -63,11 +61,9 @@ public function __construct($docid = 0, $basedocid = 0) {
$this->docform->add(new SubmitButton('bpayamount'))->onClick($this, 'onPayAmount');
$this->docform->add(new TextInput('editpayed', "0"));
$this->docform->add(new SubmitButton('bpayed'))->onClick($this, 'onPayed');
- $this->docform->add(new TextInput('editdelivery_cost', "0"));
- $this->docform->add(new SubmitButton('bdelivery_cost'))->onClick($this, 'onDelivery_cost');
$this->docform->add(new Label('payed', 0));
$this->docform->add(new Label('payamount', 0));
- $this->docform->add(new Label('delivery_cost', 0));
+
$this->docform->add(new TextInput('barcode'));
$this->docform->add(new SubmitLink('addcode'))->onClick($this, 'addcodeOnClick');
@@ -85,31 +81,25 @@ public function __construct($docid = 0, $basedocid = 0) {
$this->docform->add(new DropDownChoice('pricetype', Item::getPriceTypeList(), H::getDefPriceType()));
- $this->docform->add(new DropDownChoice('emp', \App\Entity\Employee::findArray('emp_name', '', 'emp_name')));
- $this->docform->add(new DropDownChoice('delivery', array(1 => H::l('delself'), 2 => H::l('delboy'), 3 => H::l('delmail')), 1))->onChange($this, 'OnDelivery');
$this->docform->add(new TextInput('order'));
$this->docform->add(new TextInput('notes'));
- $this->docform->add(new TextInput('ship_number'));
- $this->docform->add(new TextInput('ship_address'));
- $cp = \App\Session::getSession()->clipboard ;
- $this->docform->add(new ClickLink('paste',$this,'onPaste'))->setVisible(is_array($cp) && count($cp)>0);
-
+ $cp = \App\Session::getSession()->clipboard;
+ $this->docform->add(new ClickLink('paste', $this, 'onPaste'))->setVisible(is_array($cp) && count($cp) > 0);
+
$this->docform->add(new SubmitLink('addrow'))->onClick($this, 'addrowOnClick');
$this->docform->add(new SubmitButton('savedoc'))->onClick($this, 'savedocOnClick');
$this->docform->add(new SubmitButton('execdoc'))->onClick($this, 'savedocOnClick');
- $this->docform->add(new SubmitButton('senddoc'))->onClick($this, 'savedocOnClick');
+
$this->docform->add(new Button('backtolist'))->onClick($this, 'backtolistOnClick');
$this->docform->add(new Label('total'));
- $this->docform->add(new Label('weight'))->setVisible(false);
-
-
+
$this->add(new Form('editdetail'))->setVisible(false);
$this->editdetail->add(new TextInput('editquantity'))->setText("1");
$this->editdetail->add(new TextInput('editprice'));
@@ -143,16 +133,8 @@ public function __construct($docid = 0, $basedocid = 0) {
$this->docform->total->setText($this->_doc->amount);
$this->docform->document_date->setDate($this->_doc->document_date);
- $this->docform->sent_date->setDate($this->_doc->headerdata['sent_date']);
- $this->docform->delivery_date->setDate($this->_doc->headerdata['delivery_date']);
- $this->docform->ship_number->setText($this->_doc->headerdata['ship_number']);
- $this->docform->ship_address->setText($this->_doc->headerdata['ship_address']);
- $this->docform->emp->setValue($this->_doc->headerdata['emp_id']);
- $this->docform->delivery->setValue($this->_doc->headerdata['delivery']);
$this->docform->payment->setValue($this->_doc->headerdata['payment']);
- $this->docform->delivery_cost->setText($this->_doc->headerdata['delivery_cost']);
- $this->docform->editdelivery_cost->setText($this->_doc->headerdata['delivery_cost']);
$this->docform->payamount->setText($this->_doc->payamount);
$this->docform->editpayamount->setText($this->_doc->payamount);
$this->docform->paydisc->setText($this->_doc->headerdata['paydisc']);
@@ -203,11 +185,7 @@ public function __construct($docid = 0, $basedocid = 0) {
$this->docform->store->setValue($basedoc->headerdata['store']);
$this->_orderid = $basedocid;
$this->docform->order->setText($basedoc->document_number);
- $this->docform->ship_address->setText($basedoc->headerdata['address']);
- $this->docform->delivery->setValue($basedoc->headerdata['delivery']);
- $this->docform->sent_date->setDate($basedoc->headerdata['sent_date']);
- $this->docform->delivery_date->setDate($basedoc->headerdata['delivery']);
$notfound = array();
$order = $basedoc->cast();
@@ -237,12 +215,6 @@ public function __construct($docid = 0, $basedocid = 0) {
$this->docform->pricetype->setValue($basedoc->headerdata['pricetype']);
$this->docform->store->setValue($basedoc->headerdata['store']);
- // $this->_orderid = $basedocid;
- // $this->docform->order->setText($basedoc->document_number);
- $this->docform->ship_address->setText($basedoc->headerdata['address']);
- $this->docform->delivery->setValue($basedoc->headerdata['delivery']);
- $this->docform->sent_date->setDate($basedoc->headerdata['sent_date']);
- $this->docform->delivery_date->setDate($basedoc->headerdata['delivery']);
$notfound = array();
$invoice = $basedoc->cast();
@@ -280,9 +252,6 @@ public function __construct($docid = 0, $basedocid = 0) {
$this->docform->store->setValue($basedoc->headerdata['store']);
- $this->docform->ship_address->setText($basedoc->headerdata['address']);
- $this->docform->delivery->setValue($basedoc->headerdata['delivery']);
-
$this->docform->firm->setValue($basedoc->firm_id);
$this->OnChangeCustomer($this->docform->customer);
@@ -318,7 +287,7 @@ public function __construct($docid = 0, $basedocid = 0) {
$this->_tvars['manlist'][] = array('mitem' => $man);
}
- $this->OnDelivery($this->docform->delivery);
+
}
public function detailOnRow($row) {
@@ -499,7 +468,7 @@ public function savedocOnClick($sender) {
$this->_doc->payed = $this->docform->payed->getText();
$this->_doc->headerdata['paydisc'] = $this->docform->paydisc->getText();
- $this->_doc->headerdata['delivery_cost'] = $this->docform->delivery_cost->getText();
+
$this->_doc->headerdata['payment'] = $this->docform->payment->getValue();
if ($this->_doc->headerdata['payment'] == \App\Entity\MoneyFund::PREPAID) {
@@ -518,17 +487,11 @@ public function savedocOnClick($sender) {
$this->_doc->headerdata['order_id'] = $this->_orderid;
$this->_doc->headerdata['order'] = $this->docform->order->getText();
- $this->_doc->headerdata['ship_address'] = $this->docform->ship_address->getText();
- $this->_doc->headerdata['ship_number'] = $this->docform->ship_number->getText();
- $this->_doc->headerdata['delivery'] = $this->docform->delivery->getValue();
+
$this->_doc->headerdata['store'] = $this->docform->store->getValue();
$this->_doc->headerdata['store_name'] = $this->docform->store->getValueName();
- $this->_doc->headerdata['emp_id'] = $this->docform->emp->getValue();
- $this->_doc->headerdata['emp_name'] = $this->docform->emp->getValueName();
$this->_doc->headerdata['pricetype'] = $this->docform->pricetype->getValue();
$this->_doc->headerdata['pricetypename'] = $this->docform->pricetype->getValueName();
- $this->_doc->headerdata['delivery_date'] = $this->docform->delivery_date->getDate();
- $this->_doc->headerdata['sent_date'] = $this->docform->sent_date->getDate();
$this->_doc->headerdata['order_id'] = $this->_orderid;
$this->_doc->packDetails('detaildata', $this->_itemlist);
@@ -554,6 +517,7 @@ public function savedocOnClick($sender) {
// проверка на минус в количестве
+
$allowminus = System::getOption("common", "allowminus");
if ($allowminus != 1) {
@@ -569,29 +533,11 @@ public function savedocOnClick($sender) {
$this->_doc->updateStatus(Document::STATE_EXECUTED);
- if ($this->_doc->parent_id > 0) { //закрываем заказ
- if ($this->_doc->payamount > 0 && $this->_doc->payamount > $this->_doc->payed) {
- } else {
- $order = Document::load($this->_doc->parent_id);
- if ($order->state == Document::STATE_INPROCESS) {
- $order->updateStatus(Document::STATE_CLOSED);
- }
- }
- }
} else {
- if ($sender->id == 'senddoc') {
- if (!$isEdited) {
- $this->_doc->updateStatus(Document::STATE_NEW);
- }
- $this->_doc->updateStatus(Document::STATE_EXECUTED);
- $this->_doc->updateStatus(Document::STATE_INSHIPMENT);
- // $this->_doc->headerdata['sent_date'] = time();
- $this->_doc->save();
- } else {
- $this->_doc->updateStatus($isEdited ? Document::STATE_EDITED : Document::STATE_NEW);
- }
+ $this->_doc->updateStatus($isEdited ? Document::STATE_EDITED : Document::STATE_NEW);
+
}
@@ -616,11 +562,6 @@ public function onPayAmount($sender) {
$this->goAnkor("tankor");
}
- public function onDelivery_cost($sender) {
- $this->docform->delivery_cost->setText($this->docform->editdelivery_cost->getText());
- $this->goAnkor("tankor");
- $this->calcPay();
- }
public function onPayed($sender) {
$this->docform->payed->setText(H::fa($this->docform->editpayed->getText()));
@@ -647,20 +588,15 @@ public function onPayDisc() {
private function calcTotal() {
$total = 0;
- $weight = 0;
+
foreach ($this->_itemlist as $item) {
$item->amount = $item->price * $item->quantity;
$total = $total + $item->amount;
- if ($item->weight > 0) {
- $weight = $weight + $item->weight;
- }
+
}
$this->docform->total->setText(H::fa($total));
- $this->docform->weight->setText(H::l("allweight", $weight));
- $this->docform->weight->setVisible($weight > 0);
-
$disc = 0;
@@ -689,13 +625,11 @@ private function calcTotal() {
private function calcPay() {
$total = $this->docform->total->getText();
$disc = $this->docform->paydisc->getText();
- $delivery_cost = $this->docform->delivery_cost->getText();
+
if ($disc > 0) {
$total -= $disc;
}
- if ($delivery_cost > 0) {
- $total += $delivery_cost;
- }
+
$this->docform->editpayamount->setText(H::fa($total));
$this->docform->payamount->setText(H::fa($total));
$this->docform->editpayed->setText(H::fa($total));
@@ -822,6 +756,13 @@ private function checkForm() {
$this->setError("noselstore");
}
$c = $this->docform->customer->getKey();
+
+ $noallowfiz = System::getOption("common", "noallowfiz");
+ if ($noallowfiz == 1 && $c == 0) {
+ $this->setError("noselcust");
+ }
+
+
$p = $this->docform->payment->getValue();
if ($p == 0) {
$this->setError("noselpaytype");
@@ -898,9 +839,6 @@ public function OnChangeCustomer($sender) {
$this->docform->discount->setVisible(true);
}
}
- if ($this->docform->ship_address->getText() == '') {
- $this->docform->ship_address->setText($customer->address);
- }
}
if ($this->_prevcust != $customer_id) {//сменился контрагент
@@ -931,7 +869,6 @@ public function savecustOnClick($sender) {
$cust = new Customer();
$cust->customer_name = $custname;
$cust->address = $this->editcust->editaddress->getText();
- $this->docform->ship_address->setText($cust->address);
$cust->phone = $this->editcust->editphone->getText();
if (strlen($cust->phone) > 0 && strlen($cust->phone) != H::PhoneL()) {
@@ -956,7 +893,7 @@ public function savecustOnClick($sender) {
$this->editcust->setVisible(false);
$this->docform->setVisible(true);
$this->docform->discount->setVisible(false);
- $this->_discount = 0;
+
}
public function cancelcustOnClick($sender) {
@@ -964,31 +901,6 @@ public function cancelcustOnClick($sender) {
$this->docform->setVisible(true);
}
- public function OnDelivery($sender) {
-
- if ($sender->getValue() == 2 || $sender->getValue() == 3) {
- $this->docform->senddoc->setVisible(true);
- $this->docform->execdoc->setVisible(false);
- $this->docform->ship_address->setVisible(true);
- $this->docform->ship_number->setVisible(true);
- $this->docform->sent_date->setVisible(true);
- $this->docform->sent_date->setVisible(true);
- $this->docform->delivery_date->setVisible(true);
- $this->docform->emp->setVisible(true);
- $this->docform->delivery_cost->setVisible(true);
- } else {
- $this->docform->senddoc->setVisible(false);
- $this->docform->execdoc->setVisible(true);
- $this->docform->ship_address->setVisible(false);
- $this->docform->ship_number->setVisible(false);
- $this->docform->sent_date->setVisible(false);
- $this->docform->sent_date->setVisible(false);
- $this->docform->delivery_date->setVisible(false);
- $this->docform->emp->setVisible(false);
- $this->docform->delivery_cost->setVisible(false);
- }
- $this->calcPay();
- }
public function onOpenItemSel($sender) {
$this->wselitem->setVisible(true);
@@ -1019,28 +931,29 @@ public function OnCustomerFirm($sender) {
}
-
- public function onPaste($sender) {
+ public function onPaste($sender) {
$store_id = $this->docform->store->getValue();
- $cp = \App\Session::getSession()->clipboard ;
-
- foreach($cp as $it) {
- $item = Item::load($it->item_id);
- if($item==null) continue;
- $item->quantity =1;
- $item->price =$item->getPrice($this->docform->pricetype->getValue(), $store_id);
-
- $this->_itemlist[$item->item_id] = $item;
+ $cp = \App\Session::getSession()->clipboard;
+
+ foreach ($cp as $it) {
+ $item = Item::load($it->item_id);
+ if ($item == null) {
+ continue;
+ }
+ $item->quantity = 1;
+ $item->price = $item->getPrice($this->docform->pricetype->getValue(), $store_id);
+
+ $this->_itemlist[$item->item_id] = $item;
}
-
+
$this->docform->detail->Reload();
-
+
$this->calcTotal();
$this->calcPay();
}
-
+
}
diff --git a/www/app/pages/doc/incomeitem.php b/www/app/pages/doc/incomeitem.php
index cf56a1879..ecc8347a3 100644
--- a/www/app/pages/doc/incomeitem.php
+++ b/www/app/pages/doc/incomeitem.php
@@ -48,6 +48,9 @@ public function __construct($docid = 0, $basedocid = 0) {
$this->docform->add(new SubmitButton('savedoc'))->onClick($this, 'savedocOnClick');
$this->docform->add(new SubmitButton('execdoc'))->onClick($this, 'savedocOnClick');
$this->docform->add(new Button('backtolist'))->onClick($this, 'backtolistOnClick');
+ $this->docform->add(new DropDownChoice('emp', \App\Entity\Employee::findArray("emp_name", "disabled<>1", "emp_name")))->onChange($this, 'OnEmp');
+ $this->docform->add(new DropDownChoice('exmf', \App\Entity\MoneyFund::getList(), H::getDefMF()));
+ $this->docform->add(new TextInput('examount'));
$this->add(new Form('editdetail'))->setVisible(false);
@@ -69,6 +72,9 @@ public function __construct($docid = 0, $basedocid = 0) {
$this->docform->document_date->setDate($this->_doc->document_date);
$this->docform->store->setValue($this->_doc->headerdata['store']);
+ $this->docform->emp->setValue($this->_doc->headerdata['emp']);
+ $this->docform->exmf->setValue($this->_doc->headerdata['exmf']);
+ $this->docform->examount->setText($this->_doc->headerdata['examount']);
$this->docform->notes->setText($this->_doc->notes);
$this->_itemlist = $this->_doc->unpackDetails('detaildata');
@@ -92,8 +98,6 @@ public function __construct($docid = 0, $basedocid = 0) {
$this->_itemlist[] = $it;
}
-
-
}
}
}
@@ -106,6 +110,7 @@ public function __construct($docid = 0, $basedocid = 0) {
$this->docform->detail->Reload();
$this->calcTotal();
+ $this->OnEmp($this->docform->emp);
}
public function detailOnRow($row) {
@@ -242,9 +247,7 @@ public function savedocOnClick($sender) {
if (false == \App\ACL::checkEditDoc($this->_doc)) {
return;
}
- if ($this->checkForm() == false) {
- return;
- }
+
$this->_doc->notes = $this->docform->notes->getText();
$file = $this->docform->scan->getFile();
if ($file['size'] > 10000000) {
@@ -252,10 +255,12 @@ public function savedocOnClick($sender) {
return;
}
-
$this->_doc->headerdata['store'] = $this->docform->store->getValue();
$this->_doc->headerdata['storename'] = $this->docform->store->getValueName();
-
+ $this->_doc->headerdata['emp'] = $this->docform->emp->getValue();
+ $this->_doc->headerdata['empname'] = $this->docform->emp->getValueName();
+ $this->_doc->headerdata['exmf'] = $this->docform->exmf->getValue();
+ $this->_doc->headerdata['examount'] = $this->docform->examount->getText();
$this->_doc->packDetails('detaildata', $this->_itemlist);
@@ -263,6 +268,9 @@ public function savedocOnClick($sender) {
$this->_doc->document_number = $this->docform->document_number->getText();
$this->_doc->document_date = strtotime($this->docform->document_date->getText());
$this->_doc->amount = $this->docform->total->getText();
+ if ($this->checkForm() == false) {
+ return;
+ }
$isEdited = $this->_doc->document_id > 0;
@@ -328,7 +336,8 @@ private function checkForm() {
$this->setError("enterdocnumber");
}
if (false == $this->_doc->checkUniqueNumber()) {
- $this->docform->document_number->setText($this->_doc->nextNumber());
+ $next = $this->_doc->nextNumber();
+ $this->docform->document_number->setText($next);
$this->setError('nouniquedocnumber_created');
return false;
}
@@ -388,4 +397,14 @@ public function addcodeOnClick($sender) {
$this->docform->detail->Reload();
}
+ public function OnEmp($sender) {
+ if ($sender->getValue() > 0) {
+ $this->docform->examount->setVisible(true);
+ $this->docform->exmf->setVisible(true);
+ } else {
+ $this->docform->examount->setVisible(false);
+ $this->docform->exmf->setVisible(false);
+ }
+ }
+
}
diff --git a/www/app/pages/doc/incomemoney.php b/www/app/pages/doc/incomemoney.php
index a8b60b46e..5f084e29c 100644
--- a/www/app/pages/doc/incomemoney.php
+++ b/www/app/pages/doc/incomemoney.php
@@ -13,6 +13,10 @@
use Zippy\Html\Form\Form;
use Zippy\Html\Form\SubmitButton;
use Zippy\Html\Form\TextInput;
+use Zippy\Html\Form\AutocompleteTextInput;
+use App\Entity\Customer;
+use App\Entity\Employee;
+
/**
* Страница приходный ордер
@@ -30,21 +34,26 @@ public function __construct($docid = 0) {
$this->docform->add(new Date('document_date', time()));
$this->docform->add(new DropDownChoice('mtype', Pay::getPayTypeList(1), Pay::PAY_BASE_INCOME));
+ $this->docform->add(new DropDownChoice('emp', Employee::findArray("emp_name", "disabled<>1", "emp_name")));
$this->docform->add(new DropDownChoice('payment', MoneyFund::getList(), H::getDefMF()));
$this->docform->add(new TextInput('notes'));
$this->docform->add(new TextInput('amount'));
+ $this->docform->add(new AutocompleteTextInput('customer'))->onText($this, 'OnAutoCustomer');
$this->docform->add(new SubmitButton('savedoc'))->onClick($this, 'savedocOnClick');
$this->docform->add(new SubmitButton('execdoc'))->onClick($this, 'savedocOnClick');
$this->docform->add(new Button('backtolist'))->onClick($this, 'backtolistOnClick');
- if ($docid > 0) { //загружаем содержимок документа на страницу
+ if ($docid > 0) { //загружаем содержимое документа на страницу
$this->_doc = Document::load($docid)->cast();
$this->docform->document_number->setText($this->_doc->document_number);
$this->docform->document_date->setDate($this->_doc->document_date);
$this->docform->mtype->setValue($this->_doc->headerdata['type']);
+ $this->docform->emp->setValue($this->_doc->headerdata['emp']);
+ $this->docform->customer->setKey($this->_doc->customer_id);
+ $this->docform->customer->setText($this->_doc->customer_name);
$this->docform->payment->setValue($this->_doc->headerdata['payment']);
@@ -70,10 +79,13 @@ public function savedocOnClick($sender) {
$this->_doc->headerdata['payment'] = $this->docform->payment->getValue();
$this->_doc->headerdata['paymentname'] = $this->docform->payment->getValueName();
$this->_doc->headerdata['type'] = $this->docform->mtype->getValue();
+ $this->_doc->headerdata['emp'] = $this->docform->emp->getValue();
+ $this->_doc->headerdata['emp_name'] = $this->docform->emp->getValueName();
$this->_doc->amount = H::fa($this->docform->amount->getText());
$this->_doc->document_number = trim($this->docform->document_number->getText());
$this->_doc->document_date = strtotime($this->docform->document_date->getText());
+ $this->_doc->customer_id = $this->docform->customer->getKey();
if ($this->checkForm() == false) {
return;
@@ -137,4 +149,7 @@ public function backtolistOnClick($sender) {
App::RedirectBack();
}
+ public function OnAutoCustomer($sender) {
+ return Customer::getList($sender->getText(), 2);
+ }
}
diff --git a/www/app/pages/doc/order.php b/www/app/pages/doc/order.php
index b786c5f28..11774e342 100644
--- a/www/app/pages/doc/order.php
+++ b/www/app/pages/doc/order.php
@@ -4,6 +4,7 @@
use App\Application as App;
use App\Entity\Customer;
+use App\Entity\MoneyFund;
use App\Entity\Doc\Document;
use App\Entity\Item;
use App\Entity\Store;
@@ -31,7 +32,7 @@ class Order extends \App\Pages\Base
private $_doc;
private $_basedocid = 0;
private $_rowid = 0;
- private $_discount;
+
public function __construct($docid = 0, $basedocid = 0) {
parent::__construct();
@@ -47,15 +48,29 @@ public function __construct($docid = 0, $basedocid = 0) {
$this->docform->customer->onChange($this, 'OnChangeCustomer');
$this->docform->add(new TextArea('notes'));
+ $this->docform->add(new DropDownChoice('payment', MoneyFund::getList(false, false), H::getDefMF()));
+
+
+ $this->docform->add(new TextInput('editpaydisc'));
+ $this->docform->add(new SubmitButton('bpaydisc'))->onClick($this, 'onPayDisc');
+ $this->docform->add(new Label('paydisc', 0));
+
+
+ $this->docform->add(new TextInput('editpayamount'));
+ $this->docform->add(new SubmitButton('bpayamount'))->onClick($this, 'onPayAmount');
+ $this->docform->add(new TextInput('editpayed', "0"));
+ $this->docform->add(new SubmitButton('bpayed'))->onClick($this, 'onPayed');
+ $this->docform->add(new Label('payed', 0));
+ $this->docform->add(new Label('payamount', 0));
$this->docform->add(new Label('discount'))->setVisible(false);
$this->docform->add(new DropDownChoice('pricetype', Item::getPriceTypeList()))->onChange($this, 'OnChangePriceType');
- $this->docform->add(new DropDownChoice('delivery', array(1 => H::l('delself'), 2 => H::l('delboy'), 3 => H::l('delmail'))))->onChange($this, 'OnDelivery');
+ $this->docform->add(new DropDownChoice('delivery', Document::getDeliveryTypes()))->onChange($this, 'OnDelivery');
$this->docform->add(new TextInput('email'));
$this->docform->add(new TextInput('phone'));
- $this->docform->add(new TextInput('address'))->setVisible(false);
+ $this->docform->add(new TextArea('address'))->setVisible(false);
$this->docform->add(new SubmitLink('addcust'))->onClick($this, 'addcustOnClick');
@@ -98,11 +113,20 @@ public function __construct($docid = 0, $basedocid = 0) {
$this->docform->delivery->setValue($this->_doc->headerdata['delivery']);
$this->OnDelivery($this->docform->delivery);
$this->docform->store->setValue($this->_doc->headerdata['store']);
+ $this->docform->payment->setValue($this->_doc->headerdata['payment']);
+
+ $this->docform->payamount->setText($this->_doc->payamount);
+ $this->docform->editpayamount->setText($this->_doc->payamount);
+ $this->docform->paydisc->setText($this->_doc->headerdata['paydisc']);
+ $this->docform->editpaydisc->setText($this->_doc->headerdata['paydisc']);
+ $this->docform->payed->setText($this->_doc->payed);
+ $this->docform->editpayed->setText($this->_doc->payed);
+
$this->docform->notes->setText($this->_doc->notes);
$this->docform->email->setText($this->_doc->headerdata['email']);
$this->docform->phone->setText($this->_doc->headerdata['phone']);
- $this->docform->address->setText($this->_doc->headerdata['address']);
+ $this->docform->address->setText($this->_doc->headerdata['ship_address']);
$this->docform->customer->setKey($this->_doc->customer_id);
$this->docform->customer->setText($this->_doc->customer_name);
@@ -110,7 +134,7 @@ public function __construct($docid = 0, $basedocid = 0) {
} else {
$this->_doc = Document::create('Order');
$this->docform->document_number->setText($this->_doc->nextNumber());
-
+ $this->_doc->headerdata['paydisc'] = 0;
if ($basedocid > 0) { //создание на основании
$basedoc = Document::load($basedocid);
if ($basedoc instanceof Document) {
@@ -119,6 +143,7 @@ public function __construct($docid = 0, $basedocid = 0) {
}
}
$this->calcTotal();
+ $this->calcPay();
$this->docform->add(new DataView('detail', new \Zippy\Html\DataList\ArrayDataSource(new \Zippy\Binding\PropertyBinding($this, '_tovarlist')), $this, 'detailOnRow'))->Reload();
if (false == \App\ACL::checkShowDoc($this->_doc)) {
return;
@@ -151,6 +176,7 @@ public function deleteOnClick($sender) {
$this->_tovarlist = array_diff_key($this->_tovarlist, array($tovar->item_id => $this->_tovarlist[$tovar->item_id]));
$this->docform->detail->Reload();
$this->calcTotal();
+ $this->calcPay();
}
public function addrowOnClick($sender) {
@@ -199,6 +225,7 @@ public function saverowOnClick($sender) {
$this->docform->setVisible(true);
$this->docform->detail->Reload();
$this->calcTotal();
+ $this->calcPay();
//очищаем форму
$this->editdetail->edittovar->setKey(0);
$this->editdetail->edittovar->setText('');
@@ -241,7 +268,7 @@ public function savedocOnClick($sender) {
$this->_doc->headerdata['delivery'] = $this->docform->delivery->getValue();
$this->_doc->headerdata['delivery_name'] = $this->docform->delivery->getValueName();
- $this->_doc->headerdata['address'] = $this->docform->address->getText();
+ $this->_doc->headerdata['ship_address'] = $this->docform->address->getText();
$this->_doc->headerdata['phone'] = $this->docform->phone->getText();
$this->_doc->headerdata['email'] = $this->docform->email->getText();
$this->_doc->headerdata['pricetype'] = $this->docform->pricetype->getValue();
@@ -250,8 +277,24 @@ public function savedocOnClick($sender) {
$this->_doc->packDetails('detaildata', $this->_tovarlist);
$this->_doc->amount = $this->docform->total->getText();
- $this->_doc->payed = 0;
- $this->_doc->payamount = 0;
+
+ $this->_doc->payamount = $this->docform->payamount->getText();
+
+ $this->_doc->payed = $this->docform->payed->getText();
+ $this->_doc->headerdata['paydisc'] = $this->docform->paydisc->getText();
+
+ $this->_doc->headerdata['payment'] = $this->docform->payment->getValue();
+
+ if ($this->_doc->headerdata['payment'] == \App\Entity\MoneyFund::PREPAID) {
+ $this->_doc->headerdata['paydisc'] = 0;
+ $this->_doc->payed = 0;
+ $this->_doc->payamount = 0;
+ }
+ if ($this->_doc->headerdata['payment'] == \App\Entity\MoneyFund::CREDIT) {
+ $this->_doc->payed = 0;
+ }
+
+
$isEdited = $this->_doc->document_id > 0;
$conn = \ZDB\DB::getConnect();
@@ -276,15 +319,11 @@ public function savedocOnClick($sender) {
$conn->CommitTrans();
if ($sender->id == 'execdoc') {
- App::Redirect("\\App\\Pages\\Doc\\GoodsIssue", 0, $this->_doc->document_id);
- return;
- }
+ // App::Redirect("\\App\\Pages\\Doc\\TTN", 0, $this->_doc->document_id);
- if ($isEdited) {
- App::RedirectBack();
- } else {
- App::Redirect("\\App\\Pages\\Register\\OrderList");
}
+ App::Redirect("\\App\\Pages\\Register\\OrderList");
+
} catch(\Exception $ee) {
global $logger;
$conn->RollbackTrans();
@@ -309,6 +348,28 @@ private function calcTotal() {
$total = $total + $item->amount;
}
$this->docform->total->setText(H::fa($total));
+
+
+ $customer_id = $this->docform->customer->getKey();
+ if ($customer_id > 0) {
+ $customer = Customer::load($customer_id);
+
+ if ($customer->discount > 0) {
+ $disc = round($total * ($customer->discount / 100));
+ } else {
+ if ($customer->bonus > 0) {
+ if ($total >= $customer->bonus) {
+ $disc = $customer->bonus;
+ } else {
+ $disc = $total;
+ }
+ }
+ }
+ }
+
+
+ $this->docform->paydisc->setText($disc);
+ $this->docform->editpaydisc->setText($disc);
}
/**
@@ -326,10 +387,11 @@ private function checkForm() {
if (count($this->_tovarlist) == 0) {
$this->setError("noenteritem");
}
- if (($this->docform->store->getValue() > 0) == false) {
- $this->setError("noselstore");
- }
+ $c = $this->docform->customer->getKey();
+ if ($c == 0) {
+ $this->setError("noselcust");
+ }
return !$this->isError();
}
@@ -341,7 +403,6 @@ public function OnChangeItem($sender) {
$id = $sender->getKey();
$item = Item::load($id);
$price = $item->getPrice($this->docform->pricetype->getValue());
- $price = round($price - $price / 100 * $this->_discount);
$this->editdetail->qtystock->setText(H::fqty($item->getQuantity($this->docform->store->getValue())));
@@ -355,22 +416,31 @@ public function OnAutoCustomer($sender) {
}
public function OnChangeCustomer($sender) {
- $this->_discount = 0;
+
$customer_id = $this->docform->customer->getKey();
if ($customer_id > 0) {
$customer = Customer::load($customer_id);
- $this->_discount = $customer->discount;
+
$this->docform->phone->setText($customer->phone);
$this->docform->email->setText($customer->email);
$this->docform->address->setText($customer->address);
+
+
+ if ($customer->discount > 0) {
+ $this->docform->discount->setText("Постоянная скидка " . $customer->discount . '%');
+ $this->docform->discount->setVisible(true);
+ } else {
+ if ($customer->bonus > 0) {
+ $this->docform->discount->setText("Бонусы " . $customer->bonus);
+ $this->docform->discount->setVisible(true);
+ }
+ }
}
+
+
$this->calcTotal();
- if ($this->_discount > 0) {
- $this->docform->discount->setVisible(true);
- $this->docform->discount->setText('Скидка ' . $this->_discount . '%');
- } else {
- $this->docform->discount->setVisible(false);
- }
+
+ $this->calcPay();
}
public function OnAutoItem($sender) {
@@ -418,7 +488,7 @@ public function savecustOnClick($sender) {
$this->editcust->setVisible(false);
$this->docform->setVisible(true);
$this->docform->discount->setVisible(false);
- $this->_discount = 0;
+
$this->docform->phone->setText($cust->phone);
}
@@ -429,7 +499,7 @@ public function cancelcustOnClick($sender) {
public function OnDelivery($sender) {
- if ($sender->getValue() == 2 || $sender->getValue() == 3) {
+ if ($sender->getValue() == Document::DEL_BOY || $sender->getValue() == Document::DEL_SERVICE) {
$this->docform->address->setVisible(true);
} else {
$this->docform->address->setVisible(false);
@@ -440,11 +510,52 @@ public function OnChangePriceType($sender) {
foreach ($this->_tovarlist as $item) {
//$item = Item::load($item->item_id);
$price = $item->getPrice($this->docform->pricetype->getValue());
- $item->price = $price - $price / 100 * $this->_discount;
+ $item->price = $price;
}
$this->calcTotal();
$this->docform->detail->Reload();
$this->calcTotal();
}
+
+ public function onPayAmount($sender) {
+ $this->docform->payamount->setText($this->docform->editpayamount->getText());
+ $this->goAnkor("tankor");
+ }
+
+
+ public function onPayed($sender) {
+ $this->docform->payed->setText(H::fa($this->docform->editpayed->getText()));
+ $payed = $this->docform->payed->getText();
+ $payamount = $this->docform->payamount->getText();
+ if ($payed > $payamount) {
+
+ $this->setWarn('inserted_extrasum');
+ } else {
+ $this->goAnkor("tankor");
+ }
+ $this->calcPay();
+ }
+
+ public function onPayDisc() {
+ $this->docform->paydisc->setText($this->docform->editpaydisc->getText());
+ $this->calcPay();
+ $this->goAnkor("tankor");
+ }
+
+ private function calcPay() {
+ $total = $this->docform->total->getText();
+ $disc = $this->docform->paydisc->getText();
+
+ if ($disc > 0) {
+ $total -= $disc;
+ }
+
+ $this->docform->editpayamount->setText(H::fa($total));
+ $this->docform->payamount->setText(H::fa($total));
+ // $this->docform->editpayed->setText(H::fa($total));
+ // $this->docform->payed->setText(H::fa($total));
+ }
+
+
}
diff --git a/www/app/pages/doc/ordercust.php b/www/app/pages/doc/ordercust.php
index ed9fee9ef..3aa9eefb0 100644
--- a/www/app/pages/doc/ordercust.php
+++ b/www/app/pages/doc/ordercust.php
@@ -43,9 +43,9 @@ public function __construct($docid = 0, $basedocid = 0) {
$this->docform->add(new Date('document_date'))->setDate(time());
$this->docform->add(new AutocompleteTextInput('customer'))->onText($this, 'OnAutoCustomer');
$this->docform->add(new TextInput('notes'));
- $cp = \App\Session::getSession()->clipboard ;
- $this->docform->add(new ClickLink('paste',$this,'onPaste'))->setVisible(is_array($cp) && count($cp)>0);
-
+ $cp = \App\Session::getSession()->clipboard;
+ $this->docform->add(new ClickLink('paste', $this, 'onPaste'))->setVisible(is_array($cp) && count($cp) > 0);
+
$this->docform->add(new SubmitLink('addrow'))->onClick($this, 'addrowOnClick');
$this->docform->add(new Button('backtolist'))->onClick($this, 'backtolistOnClick');
$this->docform->add(new SubmitButton('savedoc'))->onClick($this, 'savedocOnClick');
@@ -379,25 +379,27 @@ public function cancelnewitemOnClick($sender) {
$this->editdetail->setVisible(true);
}
-
- public function onPaste($sender) {
-
- $cp = \App\Session::getSession()->clipboard ;
-
- foreach($cp as $it) {
- $item = Item::load($it->item_id);
- if($item==null) continue;
- $item->quantity =1;
- $item->price = 0;
-
- $this->_itemlist[$item->item_id] = $item;
+
+ public function onPaste($sender) {
+
+ $cp = \App\Session::getSession()->clipboard;
+
+ foreach ($cp as $it) {
+ $item = Item::load($it->item_id);
+ if ($item == null) {
+ continue;
+ }
+ $item->quantity = 1;
+ $item->price = 0;
+
+ $this->_itemlist[$item->item_id] = $item;
}
-
+
$this->docform->detail->Reload();
-
+
$this->calcTotal();
-
+
}
-
+
}
diff --git a/www/app/pages/doc/outcomemoney.php b/www/app/pages/doc/outcomemoney.php
index 26d50ab7e..6ace63089 100644
--- a/www/app/pages/doc/outcomemoney.php
+++ b/www/app/pages/doc/outcomemoney.php
@@ -13,6 +13,9 @@
use Zippy\Html\Form\Form;
use Zippy\Html\Form\SubmitButton;
use Zippy\Html\Form\TextInput;
+use Zippy\Html\Form\AutocompleteTextInput;
+use App\Entity\Customer;
+use App\Entity\Employee;
/**
* Страница расходный ордер
@@ -33,17 +36,22 @@ public function __construct($docid = 0) {
$this->docform->add(new DropDownChoice('mtype', Pay::getPayTypeList(2), 0));
$this->docform->add(new TextInput('notes'));
$this->docform->add(new TextInput('amount'));
+ $this->docform->add(new AutocompleteTextInput('customer'))->onText($this, 'OnAutoCustomer');
+ $this->docform->add(new DropDownChoice('emp', Employee::findArray("emp_name", "disabled<>1", "emp_name")));
$this->docform->add(new SubmitButton('savedoc'))->onClick($this, 'savedocOnClick');
$this->docform->add(new SubmitButton('execdoc'))->onClick($this, 'savedocOnClick');
$this->docform->add(new Button('backtolist'))->onClick($this, 'backtolistOnClick');
- if ($docid > 0) { //загружаем содержимок документа на страницу
+ if ($docid > 0) { //загружаем содержимое документа на страницу
$this->_doc = Document::load($docid)->cast();
$this->docform->document_number->setText($this->_doc->document_number);
$this->docform->document_date->setDate($this->_doc->document_date);
+ $this->docform->customer->setKey($this->_doc->customer_id);
+ $this->docform->customer->setText($this->_doc->customer_name);
+ $this->docform->emp->setValue($this->_doc->headerdata['emp']);
$this->docform->payment->setValue($this->_doc->headerdata['payment']);
$this->docform->mtype->setValue($this->_doc->headerdata['type']);
$this->docform->notes->setText($this->_doc->notes);
@@ -68,10 +76,13 @@ public function savedocOnClick($sender) {
$this->_doc->headerdata['payment'] = $this->docform->payment->getValue();
$this->_doc->headerdata['paymentname'] = $this->docform->payment->getValueName();
$this->_doc->headerdata['type'] = $this->docform->mtype->getValue();
+ $this->_doc->headerdata['emp'] = $this->docform->emp->getValue();
+ $this->_doc->headerdata['emp_name'] = $this->docform->emp->getValueName();
$this->_doc->amount = H::fa($this->docform->amount->getText());
$this->_doc->document_number = trim($this->docform->document_number->getText());
$this->_doc->document_date = strtotime($this->docform->document_date->getText());
+ $this->_doc->customer_id = $this->docform->customer->getKey();
if ($this->checkForm() == false) {
return;
@@ -133,4 +144,7 @@ public function backtolistOnClick($sender) {
App::RedirectBack();
}
+ public function OnAutoCustomer($sender) {
+ return Customer::getList($sender->getText(), 2);
+ }
}
diff --git a/www/app/pages/doc/poscheck.php b/www/app/pages/doc/poscheck.php
index fbceab9e4..7f71738b1 100644
--- a/www/app/pages/doc/poscheck.php
+++ b/www/app/pages/doc/poscheck.php
@@ -450,7 +450,7 @@ public function savedocOnClick($sender) {
}
$this->_doc->payamount = $this->docform->payamount->getText();
- $this->_doc->headerdata['time'] = time();
+
$this->_doc->payed = $this->docform->payed->getText();
$this->_doc->headerdata['exchange'] = $this->docform->exchange->getText();
$this->_doc->headerdata['paydisc'] = $this->docform->paydisc->getText();
@@ -480,42 +480,44 @@ public function savedocOnClick($sender) {
$this->_doc->packDetails('services', $this->_serlist);
$this->_doc->amount = $this->docform->total->getText();
$this->_doc->headerdata['pos'] = $this->docform->pos->getValue();
-
+
$pos = \App\Entity\Pos::load($this->_doc->headerdata['pos']);
-
- if ($pos->usefisc == 1 && $sender->id == 'execdoc') {
+
+ if ($pos->usefisc == 1 && $sender->id == 'execdoc') {
+ $ret = \App\Modules\PPO\PPOHelper::check($this->_doc);
+ if ($ret['success'] == false && $ret['docnumber'] > 0) {
+ //повторяем для нового номера
+ $pos->fiscdocnumber = $ret['docnumber'];
+ $pos->save();
$ret = \App\Modules\PPO\PPOHelper::check($this->_doc);
- if ($ret['success'] == false && $ret['docnumber'] > 0) {
- //повторяем для нового номера
- $pos->fiscdocnumber = $ret['docnumber'];
- $pos->save();
- $ret = \App\Modules\PPO\PPOHelper::check($this->_doc);
- }
- if ($ret['success'] == false) {
- $this->setError($ret['data']);
- return;
+ }
+ if ($ret['success'] == false) {
+ $this->setError($ret['data']);
+ return;
+ } else {
+ // $this->setSuccess("Выполнено") ;
+ if ($ret['docnumber'] > 0) {
+ $pos->fiscdocnumber = $ret['doclocnumber'] + 1;
+ $pos->save();
+ $this->_doc->headerdata["fiscalnumber"] = $ret['docnumber'];
} else {
- // $this->setSuccess("Выполнено") ;
- if ($ret['docnumber'] > 0) {
- $pos->fiscdocnumber = $ret['doclocnumber'] + 1;
- $pos->save();
- $this->_doc->headerdata["fiscalnumber"] = $ret['docnumber'];
- } else {
- $this->setError("ppo_noretnumber");
- return;
-
- }
+ $this->setError("ppo_noretnumber");
+ return;
}
}
-
-
-
+
+ }
+
+
$isEdited = $this->_doc->document_id > 0;
+ if ($isEdited == false) {
+ $this->_doc->headerdata['time'] = time();
+ }
$conn = \ZDB\DB::getConnect();
$conn->BeginTrans();
diff --git a/www/app/pages/doc/returnissue.php b/www/app/pages/doc/returnissue.php
index 1e1df3ac0..53b48ceaf 100644
--- a/www/app/pages/doc/returnissue.php
+++ b/www/app/pages/doc/returnissue.php
@@ -110,7 +110,7 @@ public function __construct($docid = 0, $basedocid = 0) {
$this->_tovarlist = $basedoc->unpackDetails('detaildata');
}
- if ($basedoc->meta_name == 'POSCheck') {
+ if ($basedoc->meta_name == 'POSCheck') {
$this->docform->store->setValue($basedoc->headerdata['store']);
$this->docform->customer->setKey($basedoc->customer_id);
$this->docform->customer->setText($basedoc->customer_name);
@@ -258,51 +258,50 @@ public function savedocOnClick($sender) {
$pos_id = $this->docform->pos->getValue();
-
- if($pos_id>0 && $sender->id == 'execdoc') {
+
+ if ($pos_id > 0 && $sender->id == 'execdoc') {
$pos = \App\Entity\Pos::load($pos_id);
if ($this->_basedocid > 0) {
- $basedoc = Document::load($this->_basedocid);
- $this->_doc->headerdata["docnumberback"] = $basedoc->headerdata["fiscalnumber"];
-
- }
-
- if(strlen($this->_doc->headerdata["docnumberback"])==0) {
+ $basedoc = Document::load($this->_basedocid);
+ $this->_doc->headerdata["docnumberback"] = $basedoc->headerdata["fiscalnumber"];
+
+ }
+
+ if (strlen($this->_doc->headerdata["docnumberback"]) == 0) {
$this->setError("ppo_returndoc");
return;
}
- $this->_doc->headerdata["pos"] =$pos->pos_id;
-
- $ret = \App\Modules\PPO\PPOHelper::checkback($this->_doc );
- if($ret['success'] == false && $ret['docnumber']>0) {
+ $this->_doc->headerdata["pos"] = $pos->pos_id;
+
+ $ret = \App\Modules\PPO\PPOHelper::checkback($this->_doc);
+ if ($ret['success'] == false && $ret['docnumber'] > 0) {
//повторяем для нового номера
$pos->fiscdocnumber = $ret['docnumber'];
- $pos->save();
- $ret = \App\Modules\PPO\PPOHelper::checkback($this->_doc );
-
+ $pos->save();
+ $ret = \App\Modules\PPO\PPOHelper::checkback($this->_doc);
+
}
- if($ret['success'] == false ) {
+ if ($ret['success'] == false) {
$this->setError($ret['data']);
return;
} else {
-
- if($ret['docnumber'] >0) {
- $pos->fiscdocnumber = $ret['doclocnumber']+1;
- $pos->save();
- $this->_doc->headerdata["fiscalnumber"] = $ret['docnumber'] ;
- } else {
+
+ if ($ret['docnumber'] > 0) {
+ $pos->fiscdocnumber = $ret['doclocnumber'] + 1;
+ $pos->save();
+ $this->_doc->headerdata["fiscalnumber"] = $ret['docnumber'];
+ } else {
$this->setError("ppo_noretnumber");
- return;
-
- }
-
- }
-
-
- }
-
+ return;
+
+ }
+
+ }
+
+
+ }
$conn = \ZDB\DB::getConnect();
@@ -322,8 +321,7 @@ public function savedocOnClick($sender) {
} else {
$this->_doc->updateStatus($isEdited ? Document::STATE_EDITED : Document::STATE_NEW);
}
-
-
+
$conn->CommitTrans();
App::RedirectBack();
diff --git a/www/app/pages/doc/ttn.php b/www/app/pages/doc/ttn.php
new file mode 100644
index 000000000..3e24b5814
--- /dev/null
+++ b/www/app/pages/doc/ttn.php
@@ -0,0 +1,838 @@
+_tvars["colspan"] = $common['usesnumber'] == 1 ? 8 : 6;
+
+
+ $this->add(new Form('docform'));
+ $this->docform->add(new TextInput('document_number'));
+
+ $this->docform->add(new Date('document_date'))->setDate(time());
+ $this->docform->add(new Date('sent_date'));
+ $this->docform->add(new Date('delivery_date'));
+
+
+ $this->docform->add(new TextInput('barcode'));
+ $this->docform->add(new SubmitLink('addcode'))->onClick($this, 'addcodeOnClick');
+
+
+ $this->docform->add(new DropDownChoice('store', Store::getList(), H::getDefStore()))->onChange($this, 'OnChangeStore');
+
+ $this->docform->add(new SubmitLink('addcust'))->onClick($this, 'addcustOnClick');
+
+ $this->docform->add(new AutocompleteTextInput('customer'))->onText($this, 'OnAutoCustomer');
+ $this->docform->customer->onChange($this, 'OnChangeCustomer');
+
+ $this->docform->add(new DropDownChoice('firm', \App\Entity\Firm::getList(), H::getDefFirm()));
+
+
+ $this->docform->add(new DropDownChoice('pricetype', Item::getPriceTypeList(), H::getDefPriceType()));
+ $this->docform->add(new DropDownChoice('emp', \App\Entity\Employee::findArray('emp_name', '', 'emp_name')));
+
+ $this->docform->add(new DropDownChoice('delivery', Document::getDeliveryTypes(), Document::DEL_SELF))->onChange($this, 'OnDelivery');
+
+ $this->docform->add(new TextInput('order'));
+
+ $this->docform->add(new TextInput('notes'));
+ $this->docform->add(new TextInput('ship_number'));
+ $this->docform->add(new TextArea('ship_address'));
+
+ $this->docform->add(new Label('notesfromorder'));
+
+
+ $this->docform->add(new SubmitLink('addrow'))->onClick($this, 'addrowOnClick');
+ $this->docform->add(new SubmitButton('savedoc'))->onClick($this, 'savedocOnClick');
+ $this->docform->add(new SubmitButton('execdoc'))->onClick($this, 'savedocOnClick');
+ $this->docform->add(new SubmitButton('senddoc'))->onClick($this, 'savedocOnClick');
+
+ $this->docform->add(new Button('backtolist'))->onClick($this, 'backtolistOnClick');
+
+ $this->docform->add(new Label('total'));
+ $this->docform->add(new Label('weight'))->setVisible(false);
+
+
+ $this->add(new Form('editdetail'))->setVisible(false);
+ $this->editdetail->add(new TextInput('editquantity'))->setText("1");
+ $this->editdetail->add(new TextInput('editprice'));
+ $this->editdetail->add(new TextInput('editserial'));
+
+ $this->editdetail->add(new AutocompleteTextInput('edittovar'))->onText($this, 'OnAutoItem');
+ $this->editdetail->edittovar->onChange($this, 'OnChangeItem', true);
+
+
+ $this->editdetail->add(new ClickLink('openitemsel', $this, 'onOpenItemSel'));
+ $this->editdetail->add(new Label('qtystock'));
+
+ $this->editdetail->add(new Button('cancelrow'))->onClick($this, 'cancelrowOnClick');
+ $this->editdetail->add(new SubmitButton('submitrow'))->onClick($this, 'saverowOnClick');
+
+ $this->add(new \App\Widgets\ItemSel('wselitem', $this, 'onSelectItem'))->setVisible(false);
+
+ //добавление нового контрагента
+ $this->add(new Form('editcust'))->setVisible(false);
+ $this->editcust->add(new TextInput('editcustname'));
+ $this->editcust->add(new TextInput('editphone'));
+ $this->editcust->add(new TextInput('editaddress'));
+ $this->editcust->add(new Button('cancelcust'))->onClick($this, 'cancelcustOnClick');
+ $this->editcust->add(new SubmitButton('savecust'))->onClick($this, 'savecustOnClick');
+
+ if ($docid > 0) { //загружаем содержимое документа настраницу
+ $this->_doc = Document::load($docid)->cast();
+ $this->docform->document_number->setText($this->_doc->document_number);
+
+ $this->docform->pricetype->setValue($this->_doc->headerdata['pricetype']);
+ $this->docform->total->setText($this->_doc->amount);
+
+ $this->docform->document_date->setDate($this->_doc->document_date);
+ $this->docform->sent_date->setDate($this->_doc->headerdata['sent_date']);
+ $this->docform->delivery_date->setDate($this->_doc->headerdata['delivery_date']);
+ $this->docform->ship_number->setText($this->_doc->headerdata['ship_number']);
+ $this->docform->ship_address->setText($this->_doc->headerdata['ship_address']);
+ $this->docform->emp->setValue($this->_doc->headerdata['emp_id']);
+ $this->docform->delivery->setValue($this->_doc->headerdata['delivery']);
+
+
+ $this->docform->store->setValue($this->_doc->headerdata['store']);
+ $this->docform->customer->setKey($this->_doc->customer_id);
+
+ if ($this->_doc->customer_id) {
+ $this->docform->customer->setText($this->_doc->customer_name);
+ } else {
+ $this->docform->customer->setText($this->_doc->headerdata['customer_name']);
+ }
+
+ $this->docform->notes->setText($this->_doc->notes);
+ $this->docform->order->setText($this->_doc->headerdata['order']);
+ $this->_orderid = $this->_doc->headerdata['order_id'];
+
+
+ $this->docform->firm->setValue($this->_doc->firm_id);
+ $this->OnChangeCustomer($this->docform->customer);
+
+
+ $this->_itemlist = $this->_doc->unpackDetails('detaildata');
+
+
+ } else {
+ $this->_doc = Document::create('TTN');
+ $this->docform->document_number->setText($this->_doc->nextNumber());
+
+ if ($basedocid > 0) { //создание на основании
+ $basedoc = Document::load($basedocid);
+ if ($basedoc instanceof Document) {
+ $this->_basedocid = $basedocid;
+ if ($basedoc->meta_name == 'Order') {
+
+ $this->docform->customer->setKey($basedoc->customer_id);
+ $this->docform->customer->setText($basedoc->customer_name);
+
+ $this->docform->delivery->setValue($basedoc->headerdata['delivery']);
+ $this->docform->pricetype->setValue($basedoc->headerdata['pricetype']);
+ $this->docform->store->setValue($basedoc->headerdata['store']);
+ $this->_orderid = $basedocid;
+ $this->docform->order->setText($basedoc->document_number);
+ $this->docform->notesfromorder->setText($basedoc->notes);
+ $this->docform->ship_address->setText($basedoc->headerdata['address']);
+ $this->docform->delivery->setValue($basedoc->headerdata['delivery']);
+
+
+ $notfound = array();
+ $order = $basedoc->cast();
+
+
+ //проверяем что уже есть отправка
+ $list = $order->getChildren('TTN');
+
+ if (count($list) > 0) {
+
+ $this->setWarn('order_has_sent');
+ }
+ $this->docform->total->setText($order->amount);
+
+ $this->OnChangeCustomer($this->docform->customer);
+
+
+ $this->_itemlist = $basedoc->unpackDetails('detaildata');
+ $this->calcTotal();
+
+
+ }
+ if ($basedoc->meta_name == 'Invoice') {
+
+ $this->docform->customer->setKey($basedoc->customer_id);
+ $this->docform->customer->setText($basedoc->customer_name);
+
+ $this->docform->pricetype->setValue($basedoc->headerdata['pricetype']);
+ $this->docform->store->setValue($basedoc->headerdata['store']);
+
+ $notfound = array();
+ $invoice = $basedoc->cast();
+
+ $this->docform->total->setText($invoice->amount);
+ $this->docform->firm->setValue($basedoc->firm_id);
+
+ $this->OnChangeCustomer($this->docform->customer);
+
+
+ $this->_itemlist = $basedoc->unpackDetails('detaildata');
+ $this->calcTotal();
+
+
+ }
+
+
+ if ($basedoc->meta_name == 'GoodsIssue') {
+
+ $this->docform->customer->setKey($basedoc->customer_id);
+ if ($basedoc->customer_id > 0) {
+ $this->docform->customer->setText($basedoc->customer_name);
+ } else {
+ $this->docform->customer->setText($basedoc->headerdata['customer_name']);
+ }
+
+
+ $this->docform->pricetype->setValue($basedoc->headerdata['pricetype']);
+ $this->docform->store->setValue($basedoc->headerdata['store']);
+
+
+ $this->docform->firm->setValue($basedoc->firm_id);
+
+ $this->OnChangeCustomer($this->docform->customer);
+
+
+ foreach ($basedoc->unpackDetails('detaildata') as $item) {
+ $item->price = $item->getPrice($basedoc->headerdata['pricetype']);
+ $this->_itemlist[$item->item_id] = $item;
+ }
+ $this->calcTotal();
+
+ }
+
+
+ }
+ }
+ }
+
+ $this->docform->add(new DataView('detail', new \Zippy\Html\DataList\ArrayDataSource(new \Zippy\Binding\PropertyBinding($this, '_itemlist')), $this, 'detailOnRow'))->Reload();
+ if (false == \App\ACL::checkShowDoc($this->_doc)) {
+ return;
+ }
+
+ $this->_tvars['manlist'] = array();
+
+ foreach (Item::getManufacturers() as $man) {
+ $this->_tvars['manlist'][] = array('mitem' => $man);
+ }
+
+ $this->OnDelivery($this->docform->delivery);
+ }
+
+ public function detailOnRow($row) {
+ $item = $row->getDataItem();
+
+ $row->add(new Label('num', $row->getAllNumber()));
+ $row->add(new Label('tovar', $item->itemname));
+
+ $row->add(new Label('code', $item->item_code));
+ $row->add(new Label('msr', $item->msr));
+ $row->add(new Label('snumber', $item->snumber));
+ $row->add(new Label('sdate', $item->sdate > 0 ? date('Y-m-d', $item->sdate) : ''));
+
+ $row->add(new Label('quantity', H::fqty($item->quantity)));
+ $row->add(new Label('price', H::fa($item->price)));
+
+ $row->add(new Label('amount', H::fa($item->quantity * $item->price)));
+ $row->add(new ClickLink('delete'))->onClick($this, 'deleteOnClick');
+ $row->add(new ClickLink('edit'))->onClick($this, 'editOnClick');
+ }
+
+ public function deleteOnClick($sender) {
+ if (false == \App\ACL::checkEditDoc($this->_doc)) {
+ return;
+ }
+
+ $tovar = $sender->owner->getDataItem();
+ // unset($this->_itemlist[$tovar->tovar_id]);
+
+ $this->_itemlist = array_diff_key($this->_itemlist, array($tovar->item_id => $this->_itemlist[$tovar->item_id]));
+ $this->docform->detail->Reload();
+ $this->calcTotal();
+
+ }
+
+ public function addrowOnClick($sender) {
+ $this->editdetail->setVisible(true);
+ $this->editdetail->editquantity->setText("1");
+ $this->editdetail->editprice->setText("0");
+ $this->editdetail->qtystock->setText("");
+ $this->docform->setVisible(false);
+ $this->_rowid = 0;
+ }
+
+ public function editOnClick($sender) {
+ $item = $sender->getOwner()->getDataItem();
+ $this->editdetail->setVisible(true);
+ $this->docform->setVisible(false);
+
+
+ $this->editdetail->edittovar->setKey($item->item_id);
+ $this->editdetail->edittovar->setText($item->itemname);
+
+ $this->OnChangeItem($this->editdetail->edittovar);
+
+ $this->editdetail->editprice->setText($item->price);
+ $this->editdetail->editquantity->setText($item->quantity);
+ $this->editdetail->editserial->setText($item->serial);
+
+ $this->_rowid = $item->item_id;
+ }
+
+ public function saverowOnClick($sender) {
+
+ $id = $this->editdetail->edittovar->getKey();
+ if ($id == 0) {
+ $this->setError("noselitem");
+ return;
+ }
+ $item = Item::load($id);
+ $store_id = $this->docform->store->getValue();
+
+ $item->quantity = $this->editdetail->editquantity->getText();
+ $item->snumber = $this->editdetail->editserial->getText();
+ $qstock = $this->editdetail->qtystock->getText();
+
+ $item->price = $this->editdetail->editprice->getText();
+
+ if ($item->quantity > $qstock) {
+
+ $this->setWarn('inserted_extra_count');
+ }
+
+ if (strlen($item->snumber) == 0 && $item->useserial == 1 && $this->_tvars["usesnumber"] == true) {
+
+ $this->setError("needs_serial");
+ return;
+ }
+
+ if ($this->_tvars["usesnumber"] == true && $item->useserial == 1) {
+ $slist = $item->getSerials($store_id);
+
+ if (in_array($item->snumber, $slist) == false) {
+
+ $this->setWarn('invalid_serialno');
+ } else {
+ $st = Stock::getFirst("store_id={$store_id} and item_id={$item->item_id} and snumber=" . Stock::qstr($item->snumber));
+ if ($st instanceof Stock) {
+ $item->sdate = $st->sdate;
+ }
+
+ }
+
+
+ }
+
+ $tarr = array();
+
+ foreach ($this->_itemlist as $k => $value) {
+
+ if ($this->_rowid > 0 && $this->_rowid == $k) {
+ $tarr[$item->item_id] = $item; // заменяем
+ } else {
+ $tarr[$k] = $value; // старый
+ }
+
+ }
+
+ if ($this->_rowid == 0) { // в конец
+ $tarr[$item->item_id] = $item;
+ }
+ $this->_itemlist = $tarr;
+ $this->_rowid = 0;
+
+ $this->editdetail->setVisible(false);
+ $this->wselitem->setVisible(false);
+ $this->docform->setVisible(true);
+ $this->docform->detail->Reload();
+
+ //очищаем форму
+ $this->editdetail->edittovar->setKey(0);
+ $this->editdetail->edittovar->setText('');
+
+ $this->editdetail->editquantity->setText("1");
+
+ $this->editdetail->editprice->setText("");
+ $this->editdetail->editserial->setText("");
+ $this->calcTotal();
+
+ }
+
+ public function cancelrowOnClick($sender) {
+ $this->wselitem->setVisible(false);
+ $this->editdetail->setVisible(false);
+ $this->docform->setVisible(true);
+ //очищаем форму
+ $this->editdetail->edittovar->setKey(0);
+ $this->editdetail->edittovar->setText('');
+
+ $this->editdetail->editquantity->setText("1");
+
+ $this->editdetail->editprice->setText("");
+ }
+
+ public function savedocOnClick($sender) {
+ if (false == \App\ACL::checkEditDoc($this->_doc)) {
+ return;
+ }
+
+
+ $this->_doc->document_number = $this->docform->document_number->getText();
+ $this->_doc->document_date = $this->docform->document_date->getDate();
+ $this->_doc->notes = $this->docform->notes->getText();
+ // $this->_doc->order = $this->docform->order->getText();
+ $this->_doc->headerdata['customer_name'] = $this->docform->customer->getText();
+ $this->_doc->customer_id = $this->docform->customer->getKey();
+ if ($this->_doc->customer_id > 0) {
+ $customer = Customer::load($this->_doc->customer_id);
+ $this->_doc->headerdata['customer_name'] = $this->docform->customer->getText() . ' ' . $customer->phone;
+ }
+
+ $this->_doc->firm_id = $this->docform->firm->getValue();
+ if ($this->_doc->firm_id > 0) {
+ $this->_doc->headerdata['firm_name'] = $this->docform->firm->getValueName();
+ }
+
+ $this->_doc->headerdata['order_id'] = $this->_orderid;
+ $this->_doc->headerdata['order'] = $this->docform->order->getText();
+ $this->_doc->headerdata['ship_address'] = $this->docform->ship_address->getText();
+ $this->_doc->headerdata['ship_number'] = $this->docform->ship_number->getText();
+ $this->_doc->headerdata['delivery'] = $this->docform->delivery->getValue();
+ $this->_doc->headerdata['delivery_name'] = $this->docform->delivery->getValueName();
+ $this->_doc->headerdata['store'] = $this->docform->store->getValue();
+ $this->_doc->headerdata['store_name'] = $this->docform->store->getValueName();
+ $this->_doc->headerdata['emp_id'] = $this->docform->emp->getValue();
+ $this->_doc->headerdata['emp_name'] = $this->docform->emp->getValueName();
+ $this->_doc->headerdata['pricetype'] = $this->docform->pricetype->getValue();
+ $this->_doc->headerdata['pricetypename'] = $this->docform->pricetype->getValueName();
+ $this->_doc->headerdata['delivery_date'] = $this->docform->delivery_date->getDate();
+ $this->_doc->headerdata['sent_date'] = $this->docform->sent_date->getDate();
+ $this->_doc->headerdata['order_id'] = $this->_orderid;
+
+ if ($this->checkForm() == false) {
+ return;
+ }
+
+ $this->_doc->packDetails('detaildata', $this->_itemlist);
+
+ $this->_doc->amount = $this->docform->total->getText();
+
+ $isEdited = $this->_doc->document_id > 0;
+
+ if ($sender->id == 'senddoc' && $this->_doc->headerdata['delivery'] > 2 && strlen($this->_doc->headerdata['delivery']) == 0) {
+ $this->setError('nottnnumber');
+ return;
+ }
+
+ $conn = \ZDB\DB::getConnect();
+ $conn->BeginTrans();
+ try {
+ if ($this->_basedocid > 0) {
+ $this->_doc->parent_id = $this->_basedocid;
+ $this->_basedocid = 0;
+ }
+ $this->_doc->save();
+ if ($sender->id == 'execdoc') {
+ if (!$isEdited) {
+ $this->_doc->updateStatus(Document::STATE_NEW);
+ }
+
+ /*
+ // проверка на минус в количестве
+ $allowminus = System::getOption("common", "allowminus");
+ if ($allowminus != 1) {
+
+ foreach ($this->_itemlist as $item) {
+ $qty = $item->getQuantity($this->_doc->headerdata['store']);
+ if ($qty < $item->quantity) {
+ $this->setError("nominus", H::fqty($qty), $item->item_name);
+ return;
+ }
+ }
+ }
+ */
+
+ $this->_doc->updateStatus(Document::STATE_EXECUTED);
+ $this->_doc->updateStatus(Document::STATE_READYTOSHIP);
+
+ /* if ($this->_doc->parent_id > 0) { //закрываем заказ
+ if ($this->_doc->payamount > 0 && $this->_doc->payamount > $this->_doc->payed) {
+
+ } else {
+ $order = Document::load($this->_doc->parent_id);
+ if ($order->state == Document::STATE_INPROCESS) {
+ $order->updateStatus(Document::STATE_CLOSED);
+ }
+ }
+ } */
+ } else {
+ if ($sender->id == 'senddoc') {
+
+
+ if (!$isEdited) {
+ $this->_doc->updateStatus(Document::STATE_NEW);
+ }
+
+ $this->_doc->updateStatus(Document::STATE_EXECUTED);
+ $this->_doc->updateStatus(Document::STATE_INSHIPMENT);
+ // $this->_doc->headerdata['sent_date'] = time();
+ $this->_doc->save();
+ } else {
+ $this->_doc->updateStatus($isEdited ? Document::STATE_EDITED : Document::STATE_NEW);
+ }
+ }
+
+
+ $conn->CommitTrans();
+
+ App::Redirect("\\App\\Pages\\Register\\GIList");
+
+ } catch(\Exception $ee) {
+ global $logger;
+ $conn->RollbackTrans();
+ $this->setError($ee->getMessage());
+
+ $logger->error($ee->getMessage() . " Документ " . $this->_doc->meta_desc);
+ return;
+ }
+ }
+
+
+ /**
+ * Расчет итого
+ *
+ */
+ private function calcTotal() {
+
+ $total = 0;
+ $weight = 0;
+
+ foreach ($this->_itemlist as $item) {
+ $item->amount = $item->price * $item->quantity;
+
+ $total = $total + $item->amount;
+ if ($item->weight > 0) {
+ $weight = $weight + $item->weight;
+ }
+ }
+ $this->docform->total->setText(H::fa($total));
+ $this->docform->weight->setText(H::l("allweight", $weight));
+ $this->docform->weight->setVisible($weight > 0);
+
+
+ }
+
+ public function addcodeOnClick($sender) {
+ $code = trim($this->docform->barcode->getText());
+ $this->docform->barcode->setText('');
+ if ($code == '') {
+ return;
+ }
+ $store_id = $this->docform->store->getValue();
+ if ($store_id == 0) {
+ $this->setError('noselstore');
+ return;
+ }
+
+ $code_ = Item::qstr($code);
+ $item = Item::getFirst(" item_id in(select item_id from store_stock where store_id={$store_id}) and (item_code = {$code_} or bar_code = {$code_})");
+
+
+ if ($item == null) {
+
+ $this->setWarn("noitemcode", $code);
+ return;
+ }
+
+
+ $store_id = $this->docform->store->getValue();
+
+ $qty = $item->getQuantity($store_id);
+ if ($qty <= 0) {
+
+ $this->setWarn("noitemonstore", $item->itemname);
+ }
+
+
+ if ($this->_itemlist[$item->item_id] instanceof Item) {
+ $this->_itemlist[$item->item_id]->quantity += 1;
+ } else {
+
+
+ $price = $item->getPrice($this->docform->pricetype->getValue(), $store_id);
+ $item->price = $price;
+ $item->quantity = 1;
+
+ if ($this->_tvars["usesnumber"] == true && $item->useserial == 1) {
+
+ $serial = '';
+ $slist = $item->getSerials($store_id);
+ if (count($slist) == 1) {
+ $serial = array_pop($slist);
+ }
+
+
+ if (strlen($serial) == 0) {
+ $this->setWarn('needs_serial');
+ $this->editdetail->setVisible(true);
+ $this->docform->setVisible(false);
+
+
+ $this->editdetail->edittovar->setKey($item->item_id);
+ $this->editdetail->edittovar->setText($item->itemname);
+ $this->editdetail->editserial->setText('');
+ $this->editdetail->editquantity->setText('1');
+ $this->editdetail->editprice->setText($item->price);
+
+
+ return;
+ } else {
+ $item->snumber = $serial;
+ }
+ }
+ $this->_itemlist[$item->item_id] = $item;
+ }
+ $this->docform->detail->Reload();
+ $this->calcTotal();
+
+
+ $this->_rowid = 0;
+ }
+
+ /**
+ * Валидация формы
+ *
+ */
+ private function checkForm() {
+ if (strlen($this->_doc->document_number) == 0) {
+
+ $this->setError('enterdocnumber');
+ }
+
+ if (false == $this->_doc->checkUniqueNumber()) {
+ $this->docform->document_number->setText($this->_doc->nextNumber());
+ $this->setError('nouniquedocnumber_created');
+ }
+
+ if (count($this->_itemlist) == 0) {
+ $this->setError("noenteritem");
+ }
+
+ if (($this->docform->store->getValue() > 0) == false) {
+ $this->setError("noselstore");
+ }
+ $c = $this->docform->customer->getKey();
+
+
+ if ($c == 0) {
+ $this->setError("noselcust");
+ }
+
+
+ return !$this->isError();
+ }
+
+ public function backtolistOnClick($sender) {
+ App::RedirectBack();
+ }
+
+ public function OnChangeStore($sender) {
+ //очистка списка товаров
+ $this->_itemlist = array();
+ $this->docform->detail->Reload();
+ }
+
+ public function OnChangeItem($sender) {
+ $id = $sender->getKey();
+ $item = Item::load($id);
+ $store_id = $this->docform->store->getValue();
+
+ $price = $item->getPrice($this->docform->pricetype->getValue(), $store_id);
+ $qty = $item->getQuantity($store_id);
+
+ $this->editdetail->qtystock->setText(H::fqty($qty));
+ $this->editdetail->editprice->setText($price);
+ if ($this->_tvars["usesnumber"] == true && $item->useserial == 1) {
+
+ $serial = '';
+ $slist = $item->getSerials($store_id);
+ if (count($slist) == 1) {
+ $serial = array_pop($slist);
+ }
+ $this->editdetail->editserial->setText($serial);
+ }
+
+
+ $this->updateAjax(array('qtystock', 'editprice', 'editserial'));
+ }
+
+ public function OnAutoItem($sender) {
+ $store_id = $this->docform->store->getValue();
+ $text = trim($sender->getText());
+ return Item::findArrayAC($text);
+ }
+
+ public function OnAutoCustomer($sender) {
+ return Customer::getList($sender->getText(), 1);
+ }
+
+ public function OnChangeCustomer($sender) {
+
+
+ $customer_id = $this->docform->customer->getKey();
+ if ($customer_id > 0) {
+ $customer = Customer::load($customer_id);
+
+ if ($this->docform->ship_address->getText() == '') {
+ $this->docform->ship_address->setText($customer->address);
+ }
+
+ }
+
+
+ }
+
+ //добавление нового контрагента
+ public function addcustOnClick($sender) {
+ $this->editcust->setVisible(true);
+ $this->docform->setVisible(false);
+
+ $this->editcust->editcustname->setText('');
+ $this->editcust->editaddress->setText('');
+ $this->editcust->editphone->setText('');
+ }
+
+ public function savecustOnClick($sender) {
+ $custname = trim($this->editcust->editcustname->getText());
+ if (strlen($custname) == 0) {
+ $this->setError("entername");
+ return;
+ }
+ $cust = new Customer();
+ $cust->customer_name = $custname;
+ $cust->address = $this->editcust->editaddress->getText();
+ $this->docform->ship_address->setText($cust->address);
+ $cust->phone = $this->editcust->editphone->getText();
+
+ if (strlen($cust->phone) > 0 && strlen($cust->phone) != H::PhoneL()) {
+ $this->setError("");
+ $this->setError("tel10", H::PhoneL());
+ return;
+ }
+
+ $c = Customer::getByPhone($cust->phone);
+ if ($c != null) {
+ if ($c->customer_id != $cust->customer_id) {
+
+ $this->setError("existcustphone");
+ return;
+ }
+ }
+ $cust->type = Customer::TYPE_BAYER;
+ $cust->save();
+ $this->docform->customer->setText($cust->customer_name);
+ $this->docform->customer->setKey($cust->customer_id);
+
+ $this->editcust->setVisible(false);
+ $this->docform->setVisible(true);
+
+
+ }
+
+ public function cancelcustOnClick($sender) {
+ $this->editcust->setVisible(false);
+ $this->docform->setVisible(true);
+ }
+
+ public function OnDelivery($sender) {
+
+ if ($sender->getValue() == Document::DEL_BOY || $sender->getValue() == Document::DEL_SERVICE) {
+ $this->docform->senddoc->setVisible(true);
+
+ $this->docform->ship_address->setVisible(true);
+ $this->docform->ship_number->setVisible($sender->getValue() == 3);
+ $this->docform->sent_date->setVisible(true);
+ $this->docform->delivery_date->setVisible(true);
+ $this->docform->emp->setVisible(true);
+
+ } else {
+ $this->docform->senddoc->setVisible(false);
+
+ $this->docform->ship_address->setVisible(false);
+ $this->docform->ship_number->setVisible(false);
+ $this->docform->sent_date->setVisible(false);
+ $this->docform->delivery_date->setVisible(false);
+ $this->docform->emp->setVisible(false);
+
+ }
+
+ }
+
+ public function onOpenItemSel($sender) {
+ $this->wselitem->setVisible(true);
+ $this->wselitem->setPriceType($this->docform->pricetype->getValue());
+ $this->wselitem->Reload();
+ }
+
+ public function onSelectItem($item_id, $itemname) {
+ $this->editdetail->edittovar->setKey($item_id);
+ $this->editdetail->edittovar->setText($itemname);
+ $this->OnChangeItem($this->editdetail->edittovar);
+ }
+
+
+}
+
+
+
+
+
diff --git a/www/app/pages/options.php b/www/app/pages/options.php
index 631344ae2..ca7a8976b 100644
--- a/www/app/pages/options.php
+++ b/www/app/pages/options.php
@@ -51,6 +51,7 @@ public function __construct() {
$this->common->add(new CheckBox('usescanner'));
$this->common->add(new CheckBox('usebranch'));
$this->common->add(new CheckBox('allowminus'));
+ $this->common->add(new CheckBox('noallowfiz'));
$this->common->add(new CheckBox('capcha'));
$this->common->add(new TextInput('price1'));
$this->common->add(new TextInput('price2'));
@@ -92,6 +93,7 @@ public function __construct() {
$this->common->usescanner->setChecked($common['usescanner']);
$this->common->useimages->setChecked($common['useimages']);
$this->common->usebranch->setChecked($common['usebranch']);
+ $this->common->noallowfiz->setChecked($common['noallowfiz']);
$this->common->allowminus->setChecked($common['allowminus']);
$this->common->capcha->setChecked($common['capcha']);
$this->common->useval->setChecked($common['useval']);
@@ -141,6 +143,21 @@ public function __construct() {
$this->printer->pbarcode->setChecked($printer['pbarcode']);
$this->printer->pprice->setChecked($printer['pprice']);
+ $this->add(new Form('api'))->onSubmit($this, 'saveApiOnClick');
+
+ $this->api->add(new TextInput('akey'));
+ $this->api->add(new TextInput('aexp'));
+ $this->api->add(new DropDownChoice('atype', array('1' => H::l('apijwt'), '2' => H::l('apibasic'), '3' => H::l('apinologin')), 1))->onChange($this, 'onApiType');
+ $api = System::getOptions("api");
+ if (!is_array($api)) {
+ $api = array('exp' => 60, 'key' => 'qwerty', 'atype' => 1);
+ }
+ $this->api->akey->setText($api['key']);
+ $this->api->aexp->setValue($api['exp']);
+ $this->api->atype->setValue($api['atype']);
+
+ $this->onApiType($this->api->atype);
+
$this->metadatads = new \ZCL\DB\EntityDataSource("\\App\\Entity\\MetaData", "", "description");
$this->add(new Panel('listpan'));
@@ -165,6 +182,8 @@ public function __construct() {
$this->editpan->editform->add(new DropDownChoice('edit_meta_type', \App\Entity\MetaData::getNames()));
$this->editpan->add(new ClickLink('mcancel'))->onClick($this, 'mcancelOnClick');
+
+ $this->_tvars['tab2'] = false;
}
@@ -197,6 +216,7 @@ public function saveCommonOnClick($sender) {
$common['useimages'] = $this->common->useimages->isChecked() ? 1 : 0;
$common['usebranch'] = $this->common->usebranch->isChecked() ? 1 : 0;
+ $common['noallowfiz'] = $this->common->noallowfiz->isChecked() ? 1 : 0;
$common['allowminus'] = $this->common->allowminus->isChecked() ? 1 : 0;
$common['useval'] = $this->common->useval->isChecked() ? 1 : 0;
$common['capcha'] = $this->common->capcha->isChecked() ? 1 : 0;
@@ -208,6 +228,8 @@ public function saveCommonOnClick($sender) {
$this->setSuccess('saved');
System::setCache('labels', null);
+
+ $this->_tvars['tab2'] = false;
}
@@ -221,6 +243,8 @@ public function saveValOnClick($sender) {
System::setOptions("val", $val);
$this->setSuccess('saved');
+
+ $this->_tvars['tab2'] = false;
}
public function savePrinterOnClick($sender) {
@@ -236,6 +260,33 @@ public function savePrinterOnClick($sender) {
System::setOptions("printer", $printer);
$this->setSuccess('saved');
+
+ $this->_tvars['tab2'] = false;
+
+ }
+
+ public function onApiType($sender) {
+ $type = $this->api->atype->getValue();
+ $this->api->aexp->setVisible($type == 1);
+ $this->api->akey->setVisible($type == 1);
+
+ $this->goAnkor('api');
+
+ $this->_tvars['tab2'] = false;
+
+ }
+
+ public function saveApiOnClick($sender) {
+ $api = array();
+ $printer['exp'] = $this->api->aexp->getText();
+ $printer['key'] = $this->api->akey->getText();
+ $printer['atype'] = $this->api->atype->getValue();
+
+ System::setOptions("api", $api);
+ $this->setSuccess('saved');
+
+ $this->_tvars['tab2'] = false;
+
}
public function filterOnSubmit($sender) {
@@ -261,6 +312,9 @@ public function filterOnSubmit($sender) {
$this->metadatads->setWhere($where);
$this->listpan->metarow->Reload();
+
+ $this->_tvars['tab2'] = true;
+
}
public function addnewOnClick($sender) {
@@ -272,11 +326,15 @@ public function addnewOnClick($sender) {
$this->editpan->editform->edit_menugroup->setText('');
$this->editpan->editform->edit_disabled->setChecked(0);
+ $this->_tvars['tab2'] = true;
+
}
public function mcancelOnClick($sender) {
$this->listpan->setVisible(true);
$this->editpan->setVisible(false);
+ $this->_tvars['tab2'] = true;
+
}
public function metarowOnRow($row) {
@@ -323,6 +381,8 @@ public function roweditOnClick($sender) {
$this->listpan->setVisible(false);
$this->editpan->setVisible(true);
+
+ $this->_tvars['tab2'] = true;
}
public function rowdeleteOnClick($sender) {
@@ -330,6 +390,7 @@ public function rowdeleteOnClick($sender) {
\App\Entity\MetaData::delete($item->meta_id);
$this->listpan->metarow->Reload();
+ $this->_tvars['tab2'] = true;
}
public function editformOnSubmit($sender) {
@@ -358,6 +419,15 @@ public function editformOnSubmit($sender) {
$this->editpan->editform->edit_description->setText('');
$this->editpan->editform->edit_meta_name->setText('');
$this->editpan->editform->edit_menugroup->setText('');
+
+ $this->_tvars['tab2'] = true;
}
+
+ public function afterRender() {
+ // $this->_tvars['tab2'] = false;
+
+ }
+
+
}
diff --git a/www/app/pages/reference/itemlist.php b/www/app/pages/reference/itemlist.php
index eead59c5e..95a5b854a 100644
--- a/www/app/pages/reference/itemlist.php
+++ b/www/app/pages/reference/itemlist.php
@@ -205,7 +205,9 @@ public function deleteOnClick($sender) {
}
public function editOnClick($sender) {
- $this->_item = $sender->owner->getDataItem();
+ $item = $sender->owner->getDataItem();
+ $this->_item = Item::load($item->item_id);
+
$this->itemtable->setVisible(false);
$this->itemdetail->setVisible(true);
@@ -400,6 +402,8 @@ public function onback($sender) {
public function setOnClick($sender) {
$item = $sender->owner->getDataItem();
+ $item = Item::load($item->item_id);
+
$this->_pitem_id = $item->item_id;
$this->_itemset = ItemSet::find("pitem_id=" . $item->item_id, "itemname");
$this->setpanel->setVisible(true);
@@ -407,7 +411,7 @@ public function setOnClick($sender) {
$this->setpanel->stitle->setText($item->itemname);
- $this->_itemset = ItemSet::find("pitem_id=" . $this->_pitem_id, "itemname");
+
$this->setpanel->setlist->Reload();
}
diff --git a/www/app/pages/register/doclist.php b/www/app/pages/register/doclist.php
index 5e1eabbfa..1f3517690 100644
--- a/www/app/pages/register/doclist.php
+++ b/www/app/pages/register/doclist.php
@@ -320,7 +320,7 @@ public function cancelOnClick($sender) {
// return;
$user = System::getUser();
- if (\App\ACL::checkExeDoc($doc, true, false) == false) {
+ if (\App\ACL::checkCancelDoc($doc, true, false) == false) {
if ($doc->state == Document::STATE_WA && $doc->user_id == $user->user_id) {
//свой может отменить
} else {
@@ -343,6 +343,10 @@ public function cancelOnClick($sender) {
}
$doc->updateStatus(Document::STATE_CANCELED);
+ $doc->payed = 0; //отменяем оплату
+ $doc->save();
+
+
$this->doclist->setSelectedRow($sender->getOwner());
$this->doclist->Reload(false);
$this->resetURL();
@@ -395,26 +399,25 @@ public function statusOnSubmit($sender) {
public function oncsv($sender) {
$list = $this->doclist->getDataSource()->getItems(-1, -1, 'document_id');
-
+
$header = array();
$data = array();
-
- $i=0;
+
+ $i = 0;
foreach ($list as $d) {
- $i++;
- $data['A'.$i] = H::fd($d->document_date) ;
- $data['B'.$i] = $d->document_number ;
- $data['C'.$i] = $d->meta_desc ;
- $data['D'.$i] = $d->customer_name ;
- $data['E'.$i] = $d->amount ;
- $data['F'.$i] = $d->notes ;
-
+ $i++;
+ $data['A' . $i] = H::fd($d->document_date);
+ $data['B' . $i] = $d->document_number;
+ $data['C' . $i] = $d->meta_desc;
+ $data['D' . $i] = $d->customer_name;
+ $data['E' . $i] = $d->amount;
+ $data['F' . $i] = $d->notes;
+
}
-
- H::exportExcel($data,$header,'doclist.xlsx') ;
-
-
-
+
+ H::exportExcel($data, $header, 'doclist.xlsx');
+
+
}
}
diff --git a/www/app/pages/register/gilist.php b/www/app/pages/register/gilist.php
index 8ca4b5811..bdb8227cc 100644
--- a/www/app/pages/register/gilist.php
+++ b/www/app/pages/register/gilist.php
@@ -12,6 +12,7 @@
use Zippy\Html\Form\Date;
use Zippy\Html\Form\DropDownChoice;
use Zippy\Html\Form\Form;
+use Zippy\Html\Form\CheckBox;
use Zippy\Html\Form\SubmitButton;
use Zippy\Html\Form\TextInput;
use Zippy\Html\Label;
@@ -38,22 +39,18 @@ public function __construct() {
}
$this->add(new Form('filter'))->onSubmit($this, 'filterOnSubmit');
- $this->filter->add(new Date('from', time() - (7 * 24 * 3600)));
- $this->filter->add(new Date('to', time() + (1 * 24 * 3600)));
$this->filter->add(new TextInput('searchnumber'));
$this->filter->add(new TextInput('searchtext'));
- $this->filter->add(new DropDownChoice('status', array(0 => H::l('Открытые'), 1 => H::l('newed'), 2 => H::l('sended'), 4 => H::l('notpayed'), 3 => H::l('all')), 0));
+ $this->filter->add(new DropDownChoice('status', array(0 => H::l('opened'), 1 => H::l('newed'), 2 => H::l('sended'), 4 => H::l('notpayed'), 3 => H::l('all')), 0));
$this->filter->add(new DropDownChoice('searchcomp', Firm::findArray('firm_name', 'disabled<>1', 'firm_name'), 0));
-
$doclist = $this->add(new DataView('doclist', new GoodsIssueDataSource($this), $this, 'doclistOnRow'));
$doclist->setSelectedClass('table-success');
$this->add(new Paginator('pag', $doclist));
$doclist->setPageSize(H::getPG());
-
$this->add(new Panel("statuspan"))->setVisible(false);
$this->statuspan->add(new Form('statusform'));
@@ -64,7 +61,7 @@ public function __construct() {
$this->statuspan->statusform->add(new SubmitButton('bgar'))->onClick($this, 'statusOnSubmit');
$this->statuspan->statusform->add(new SubmitButton('bret'))->onClick($this, 'statusOnSubmit');
$this->statuspan->statusform->add(new TextInput('ship_number'));
-
+ $this->statuspan->statusform->add(new CheckBox('closeorder'));
$this->statuspan->add(new \App\Widgets\DocView('docview'));
@@ -74,7 +71,6 @@ public function __construct() {
public function filterOnSubmit($sender) {
-
$this->statuspan->setVisible(false);
$this->doclist->Reload(false);
@@ -93,6 +89,7 @@ public function doclistOnRow($row) {
$row->add(new Label('state', Document::getStateName($doc->state)));
$row->add(new Label('firm', $doc->firm_name));
+ $row->add(new Label('waitpay'))->setVisible($doc->payamount > 0 && $doc->payamount > $doc->payed);
$row->add(new ClickLink('show'))->onClick($this, 'showOnClick');
$row->add(new ClickLink('edit'))->onClick($this, 'editOnClick');
@@ -119,15 +116,14 @@ public function statusOnSubmit($sender) {
$this->_doc->headerdata['document_date'] = time();
$this->_doc->save();
- $this->_doc->updateStatus(Document::STATE_EXECUTED);
- $this->_doc->updateStatus(Document::STATE_INSHIPMENT);
+ if ($this->_doc->state < 4) {
+ $this->_doc->updateStatus(Document::STATE_EXECUTED);
+ }
+ $this->_doc->updateStatus(Document::STATE_INSHIPMENT);
$this->_doc->save();
- // if ($order instanceof Document) {
- // $order = $order->cast();
- // $order->updateStatus(Document::STATE_INSHIPMENT);
- // }
+
$this->statuspan->statusform->ship_number->setText('');
$this->setSuccess('sent');
}
@@ -135,31 +131,35 @@ public function statusOnSubmit($sender) {
if ($sender->id == "bdevivered") {
$this->_doc->updateStatus(Document::STATE_DELIVERED);
- if ($this->_doc->parent_id > 0) { //закрываем заказ
- if ($this->_doc->payamount > 0 && $this->_doc->payamount > $this->_doc->payed) {
- } else {
- $order = Document::load($this->_doc->parent_id);
- if ($order->state == Document::STATE_INPROCESS) {
- $order->updateStatus(Document::STATE_CLOSED);
- $this->setSuccess("order_closed ", $order->document_number);
+ if ($this->statuspan->statusform->closeorder->isChecked()) { //закрываем заказ
+ $order = Document::load($this->_doc->parent_id);
+ if ($order instanceof \App\Entity\Doc\Document) {
+ $order = $order->cast();
+ if ($order->payamount > 0 && $order->payamount > $order->payed) {
+
+ } else { //оплачен
+ if ($order->state == Document::STATE_INPROCESS) {
+ $order->updateStatus(Document::STATE_CLOSED);
+ $this->setSuccess("order_closed ", $order->document_number);
+ }
}
}
}
-
- $this->_doc->updateStatus(Document::STATE_CLOSED);
+ // $this->_doc->updateStatus(Document::STATE_CLOSED);
}
if ($sender->id == "bttn") {
- $d = $this->_doc->getChildren('GoodsReceipt');
+ $d = $this->_doc->getChildren('TTN');
if (count($d) > 0) {
- $this->setWarn('goodsreceipt_exists');
+ $this->setWarn('ttn_exists');
}
- App::Redirect("\\App\\Pages\\Doc\\GoodsReceipt", 0, $this->_doc->document_id);
+ App::Redirect("\\App\\Pages\\Doc\\TTN", 0, $this->_doc->document_id);
}
+
if ($sender->id == "bgar") {
App::Redirect("\\App\\Pages\\Doc\\Warranty", 0, $this->_doc->document_id);
}
@@ -167,7 +167,6 @@ public function statusOnSubmit($sender) {
App::Redirect("\\App\\Pages\\Doc\\ReturnIssue", 0, $this->_doc->document_id);
}
-
$this->doclist->Reload(false);
$this->statuspan->setVisible(false);
@@ -178,7 +177,6 @@ public function statusOnSubmit($sender) {
public function updateStatusButtons() {
-
$this->statuspan->statusform->bdevivered->setVisible(true);
$this->statuspan->statusform->bttn->setVisible(true);
$this->statuspan->statusform->bret->setVisible(true);
@@ -186,13 +184,28 @@ public function updateStatusButtons() {
$this->statuspan->statusform->bgar->setVisible(true);
$this->statuspan->statusform->ship_number->setVisible(true);
- $state = $this->_doc->state;
+
+ $this->statuspan->statusform->closeorder->setVisible(false);
+ if ($this->_doc->headerdata['order_id'] > 0) {
+ $order = Document::load($this->_doc->headerdata['order_id']);
+ if ($order->payamount == $order->payed) {
+ $this->statuspan->statusform->closeorder->setVisible(true);
+ }
+ }
- //отправлен
- if ($state == Document::STATE_INSHIPMENT) {
+ $this->statuspan->statusform->closeorder->setChecked(false);
+ $state = $this->_doc->state;
+ //готов к отправке
+ if ($state == Document::STATE_READYTOSHIP) {
+ $this->statuspan->statusform->bdevivered->setVisible(false);
+ $this->statuspan->statusform->bret->setVisible(false);
+ $this->statuspan->statusform->closeorder->setVisible(false);
+ }
+ //отправлен
+ if ($state == Document::STATE_INSHIPMENT) {
$this->statuspan->statusform->bsend->setVisible(false);
$this->statuspan->statusform->ship_number->setVisible(false);
}
@@ -205,15 +218,21 @@ public function updateStatusButtons() {
}
//прячем лишнее
- if ($this->_doc->meta_name == 'GoodsIssue') {
+ if ($this->_doc->meta_name == 'TTN') {
+ $this->statuspan->statusform->ship_number->setVisible($this->_doc->headerdata['delivery'] > 2);
$this->statuspan->statusform->bttn->setVisible(false);
}
- if ($this->_doc->meta_name == 'POSCheck') {
+ if ($this->_doc->meta_name == 'GoodsIssue') {
+
+ $this->statuspan->statusform->bdevivered->setVisible(false);
+ $this->statuspan->statusform->ship_number->setVisible(false);
$this->statuspan->statusform->bsend->setVisible(false);
+ }
+ if ($this->_doc->meta_name == 'POSCheck') {
$this->statuspan->statusform->bdevivered->setVisible(false);
- $this->statuspan->statusform->bttn->setVisible(false);
$this->statuspan->statusform->ship_number->setVisible(false);
+ $this->statuspan->statusform->bsend->setVisible(false);
}
if ($this->_doc->meta_name == 'Invoice') {
@@ -225,7 +244,6 @@ public function updateStatusButtons() {
}
if ($this->_doc->meta_name == 'ReturnIssue') {
-
$this->statuspan->statusform->bsend->setVisible(false);
$this->statuspan->statusform->bdevivered->setVisible(false);
$this->statuspan->statusform->bttn->setVisible(false);
@@ -266,22 +284,21 @@ public function oncsv($sender) {
$list = $this->doclist->getDataSource()->getItems(-1, -1, 'document_id');
$header = array();
$data = array();
-
- $i=0;
+
+ $i = 0;
foreach ($list as $d) {
- $i++;
- $data['A'.$i] = H::fd($d->document_date) ;
- $data['B'.$i] = $d->document_number ;
- $data['C'.$i] = $d->headerdata['order'] ;
- $data['D'.$i] = $d->customer_name ;
- $data['E'.$i] = $d->amount ;
- $data['F'.$i] = $d->notes ;
-
+ $i++;
+ $data['A' . $i] = H::fd($d->document_date);
+ $data['B' . $i] = $d->document_number;
+ $data['C' . $i] = $d->headerdata['order'];
+ $data['D' . $i] = $d->customer_name;
+ $data['E' . $i] = $d->amount;
+ $data['F' . $i] = $d->notes;
+
}
-
- H::exportExcel($data,$header,'selllist.xlsx') ;
-
-
+
+ H::exportExcel($data, $header, 'selllist.xlsx');
+
}
}
@@ -303,13 +320,11 @@ private function getWhere() {
$conn = \ZDB\DB::getConnect();
- $where = " date(document_date) >= " . $conn->DBDate($this->page->filter->from->getDate()) . " and date(document_date) <= " . $conn->DBDate($this->page->filter->to->getDate());
-
- $where .= " and meta_name in('GoodsIssue', 'Invoice','POSCheck','ReturnIssue' ,'Warranty' ) ";
+ $where = " meta_name in('GoodsIssue', 'Invoice','POSCheck','ReturnIssue' ,'Warranty','TTN' ) ";
$status = $this->page->filter->status->getValue();
if ($status == 0) {
- $where .= " and state <> " . Document::STATE_CLOSED;
+ $where .= " and ( (payamount >0 and payamount > payed and state >3 ) or( ( meta_name= 'TTN' and state <> 9) or (meta_name <> 'TTN' and state <>5) ) ) ";
}
if ($status == 1) {
$where .= " and state = " . Document::STATE_NEW;
@@ -318,7 +333,7 @@ private function getWhere() {
$where .= " and state = " . Document::STATE_INSHIPMENT;
}
if ($status == 4) {
- $where .= " and amount > payamount";
+ $where .= " and payamount >0 and payamount > payed and state >3 ";
}
$comp = $this->page->filter->searchcomp->getValue();
if ($comp > 0) {
diff --git a/www/app/pages/register/grlist.php b/www/app/pages/register/grlist.php
index cead45b35..8b4198e5d 100644
--- a/www/app/pages/register/grlist.php
+++ b/www/app/pages/register/grlist.php
@@ -38,12 +38,10 @@ public function __construct() {
}
$this->add(new Form('filter'))->onSubmit($this, 'filterOnSubmit');
- $this->filter->add(new Date('from', time() - (7 * 24 * 3600)));
- $this->filter->add(new Date('to', time() + (1 * 24 * 3600)));
$this->filter->add(new TextInput('searchnumber'));
$this->filter->add(new TextInput('searchtext'));
- $this->filter->add(new DropDownChoice('status', array(0 => H::l('all'), 1 => H::l('notexecuted'), 2 => H::l('notpayed')), 0));
+ $this->filter->add(new DropDownChoice('status', array(0 => H::l('opened'), 1 => H::l('notexecuted'), 2 => H::l('notpayed'), 3 => H::l('all')), 0));
$this->filter->add(new DropDownChoice('searchcomp', Firm::findArray('firm_name', 'disabled<>1', 'firm_name'), 0));
@@ -176,25 +174,25 @@ public function editOnClick($sender) {
public function oncsv($sender) {
$list = $this->doclist->getDataSource()->getItems(-1, -1, 'document_id');
-
-
+
+
$header = array();
$data = array();
-
- $i=0;
+
+ $i = 0;
foreach ($list as $d) {
- $i++;
- $data['A'.$i] = H::fd($d->document_date) ;
- $data['B'.$i] = $d->document_number ;
- $data['C'.$i] = $d->customer_name ;
- $data['D'.$i] = $d->amount ;
- $data['E'.$i] = $d->notes ;
-
+ $i++;
+ $data['A' . $i] = H::fd($d->document_date);
+ $data['B' . $i] = $d->document_number;
+ $data['C' . $i] = $d->customer_name;
+ $data['D' . $i] = $d->amount;
+ $data['E' . $i] = $d->notes;
+
}
-
- H::exportExcel($data,$header,'baylist.xlsx') ;
-
-
+
+ H::exportExcel($data, $header, 'baylist.xlsx');
+
+
}
}
@@ -216,18 +214,23 @@ private function getWhere() {
$conn = \ZDB\DB::getConnect();
- $where = " date(document_date) >= " . $conn->DBDate($this->page->filter->from->getDate()) . " and date(document_date) <= " . $conn->DBDate($this->page->filter->to->getDate());
-
- $where .= " and meta_name in('GoodsReceipt','InvoiceCust', 'RetCustIssue' ) ";
+ $where = " meta_name in('GoodsReceipt','InvoiceCust', 'RetCustIssue' ) ";
$status = $this->page->filter->status->getValue();
+ if ($status == 0) {
+ $where .= " and ( (payamount > 0 and payamount > payed) or (state <>" . Document::STATE_EXECUTED . ")) ";
+ }
+
if ($status == 1) {
$where .= " and state <>" . Document::STATE_EXECUTED;
}
if ($status == 2) {
$where .= " and (payamount > 0 and payamount > payed)";
}
+ if ($status == 3) {
+
+ }
$comp = $this->page->filter->searchcomp->getValue();
if ($comp > 0) {
diff --git a/www/app/pages/register/itemlist.php b/www/app/pages/register/itemlist.php
index 6e0d7e501..1e87cac28 100644
--- a/www/app/pages/register/itemlist.php
+++ b/www/app/pages/register/itemlist.php
@@ -50,11 +50,6 @@ public function __construct() {
$this->detailpanel->add(new DataView('stocklist', new DetailDataSource($this), $this, 'detailistOnRow'));
- $this->detailpanel->add(new Form('moveform'))->onSubmit($this, 'OnMove');
- $this->detailpanel->moveform->add(new DropDownChoice('frompart'));
- $this->detailpanel->moveform->add(new DropDownChoice('topart'));
- $this->detailpanel->moveform->add(new TextInput('mqty', '0'));
-
$this->OnFilter(null);
}
@@ -155,7 +150,9 @@ public function detailistOnRow($row) {
}
$row->add(new Label('partion', H::fa($stock->partion)));
- if(\App\System::getUser()->rolename!='admins') $row->partion->setText('');;
+ if (\App\System::getUser()->rolename != 'admins') {
+ $row->partion->setText('');
+ };
$row->add(new Label('qty', H::fqty($stock->qty)));
$row->add(new Label('amount', H::fa($stock->qty * $stock->partion)));
@@ -210,94 +207,39 @@ public function showOnClick($sender) {
$name = $name . ', ' . H::fa($stock->partion);
$st[$stock->stock_id] = $name;
}
- $this->detailpanel->moveform->frompart->setOptionList($st);
- $this->detailpanel->moveform->topart->setOptionList($st);
- $this->detailpanel->moveform->setVisible(count($st) > 1);
- }
-
- public function OnMove($sender) {
- $st1 = $sender->frompart->getValue();
- $st2 = $sender->topart->getValue();
- $qty = $sender->mqty->getText();
- if ($st1 == 0 || $st2 == 0) {
- $this->setError('noselpartion');
-
- return;
- }
- if ($st1 == $st2) {
- $this->setError('thesamepartion');
+ }
- return;
- }
- if (($qty > 0) == false) {
- $this->setError('invalidquantity');
- return;
- }
- $st1 = Stock::load($st1);
- $st2 = Stock::load($st2);
- if ($qty > $st1->qty) {
- $this->setError('overqty');
+ public function oncsv($sender) {
+ $store = $this->filter->searchstore->getValue();
+ $list = $this->itempanel->itemlist->getDataSource()->getItems(-1, -1, 'itemname');
- return;
- }
- $doc = \App\Entity\Doc\Document::create('TransItem');
- $doc->document_number = $doc->nextNumber();
- if (strlen($doc->document_number) == 0) {
- $doc->document_number = "ПК-000001";
- }
- $doc->document_date = time();
+ $header = array();
+ $data = array();
- $doc->headerdata['fromitem'] = $st1->stock_id;
- $doc->headerdata['tostock'] = $st2->stock_id;
+ $header['A1'] = "Наименование";
+ $header['B1'] = "Артикул";
+ $header['C1'] = "Штрих-код";
+ $header['D1'] = "Ед.";
+ $header['E1'] = "Категория";
+ $header['F1'] = "Кол.";
+ $header['G1'] = "Цена";
- $store = Store::load($st1->store_id);
- $doc->headerdata['store'] = $store->store_id;
- $doc->headerdata['storename'] = $store->storename;
- $doc->headerdata['fromquantity'] = $qty;
- $doc->headerdata['toquantity'] = $qty;
- $doc->notes = H::l('partmove');
- $doc->save();
- $doc->updateStatus(\App\Entity\Doc\Document::STATE_NEW);
- $doc->updateStatus(\App\Entity\Doc\Document::STATE_EXECUTED);
- $this->setInfo('partion_moved', $doc->document_number);
+ $i = 1;
+ foreach ($list as $item) {
+ $i++;
+ $data['A' . $i] = $item->itemname;
+ $data['B' . $i] = $item->item_code;
+ $data['C' . $i] = $item->bar_code;
+ $data['D' . $i] = $item->msr;
+ $data['E' . $i] = $item->cat_name;
+ $qty = $item->getQuantity($store);
+ $data['F' . $i] = H::fqty($qty);
- $sender->clean();
- $this->detailpanel->stocklist->Reload();
- }
- public function oncsv($sender) {
- $store = $this->filter->searchstore->getValue();
- $list = $this->itempanel->itemlist->getDataSource()->getItems(-1, -1, 'itemname');
-
-
- $header = array();
- $data = array();
-
- $header['A1'] = "Наименование";
- $header['B1'] = "Артикул";
- $header['C1'] = "Штрих-код";
- $header['D1'] = "Ед.";
- $header['E1'] = "Категория";
- $header['F1'] = "Кол.";
- $header['G1'] = "Цена";
-
-
- $i=1;
- foreach ($list as $item) {
- $i++;
- $data['A'.$i] = $item->itemname;
- $data['B'.$i] = $item->item_code ;
- $data['C'.$i] = $item->bar_code ;
- $data['D'.$i] = $item->msr ;
- $data['E'.$i] = $item->cat_name ;
- $qty = $item->getQuantity($store);
- $data['F'.$i] = H::fqty($qty) ;
-
-
$plist = array();
if ($item->price1 > 0) {
$plist[] = $item->getPrice('price1', $store);
@@ -313,14 +255,14 @@ public function oncsv($sender) {
}
if ($item->price5 > 0) {
$plist[] = $item->getPrice('price5', $store);
- }
- $data['G'.$i] = implode(' ', $plist) ;
-
-
+ }
+ $data['G' . $i] = implode(' ', $plist);
+
+
}
-
- H::exportExcel($data,$header,'stocklist.xlsx') ;
-
+
+ H::exportExcel($data, $header, 'stocklist.xlsx');
+
}
}
diff --git a/www/app/pages/register/ordercustlist.php b/www/app/pages/register/ordercustlist.php
index 96d6bcff7..f482fab5f 100644
--- a/www/app/pages/register/ordercustlist.php
+++ b/www/app/pages/register/ordercustlist.php
@@ -37,8 +37,6 @@ public function __construct() {
}
$this->add(new Form('filter'))->onSubmit($this, 'filterOnSubmit');
- $this->filter->add(new Date('from', time() - (7 * 24 * 3600)));
- $this->filter->add(new Date('to', time() + (1 * 24 * 3600)));
$this->filter->add(new TextInput('searchnumber'));
$this->filter->add(new TextInput('searchtext'));
@@ -108,7 +106,7 @@ public function statusOnSubmit($sender) {
}
$state = $this->_doc->state;
- // $payed = $this->_doc->payamount >= $this->_doc->amount; //оплачен
+ // $payed = $this->_doc->payamount >= $this->_doc->amount; //оплачен
//проверяем что есть ТТН
$d = $this->_doc->getChildren('GoodsReceipt');
$ttn = count($d) > 0;
@@ -144,7 +142,7 @@ public function statusOnSubmit($sender) {
}
if ($sender->id == "bclose") {
- // $this->_doc->payamount = $this->_doc->amount;
+ // $this->_doc->payamount = $this->_doc->amount;
$this->_doc->save();
$this->_doc->updateStatus(Document::STATE_CLOSED);
@@ -161,7 +159,7 @@ public function updateStatusButtons() {
$state = $this->_doc->state;
- // $payed = $this->_doc->payamount >= $this->_doc->amount; //оплачен
+ // $payed = $this->_doc->payamount >= $this->_doc->amount; //оплачен
//доставлен
$sent = $this->_doc->checkStates(array(Document::STATE_DELIVERED));
@@ -223,7 +221,7 @@ public function updateStatusButtons() {
$this->statuspan->statusform->setVisible(false);
}
-
+
}
//просмотр
@@ -233,7 +231,7 @@ public function showOnClick($sender) {
if (false == \App\ACL::checkShowDoc($this->_doc, true)) {
return;
}
-
+
$this->statuspan->setVisible(true);
$this->statuspan->statusform->setVisible(true);
$this->statuspan->docview->setDoc($this->_doc);
@@ -242,7 +240,7 @@ public function showOnClick($sender) {
$this->updateStatusButtons();
$this->goAnkor('dankor');
$this->_tvars['askclose'] = false;
-
+
}
public function editOnClick($sender) {
@@ -257,25 +255,25 @@ public function editOnClick($sender) {
public function oncsv($sender) {
$list = $this->doclist->getDataSource()->getItems(-1, -1, 'document_id');
-
-
+
+
$header = array();
$data = array();
-
- $i=0;
+
+ $i = 0;
foreach ($list as $d) {
- $i++;
- $data['A'.$i] = H::fd($d->document_date) ;
- $data['B'.$i] = $d->document_number ;
- $data['C'.$i] = $d->customer_name ;
- $data['D'.$i] = $d->amount ;
- $data['E'.$i] = Document::getStateName($d->state) ;
- $data['F'.$i] = $d->notes ;
-
+ $i++;
+ $data['A' . $i] = H::fd($d->document_date);
+ $data['B' . $i] = $d->document_number;
+ $data['C' . $i] = $d->customer_name;
+ $data['D' . $i] = $d->amount;
+ $data['E' . $i] = Document::getStateName($d->state);
+ $data['F' . $i] = $d->notes;
+
}
-
- H::exportExcel($data,$header,'ordercustlist.xlsx') ;
-
+
+ H::exportExcel($data, $header, 'ordercustlist.xlsx');
+
}
}
@@ -297,9 +295,8 @@ private function getWhere() {
$conn = \ZDB\DB::getConnect();
- $where = " date(document_date) >= " . $conn->DBDate($this->page->filter->from->getDate()) . " and date(document_date) <= " . $conn->DBDate($this->page->filter->to->getDate());
- $where .= " and meta_name = 'OrderCust' ";
+ $where = " meta_name = 'OrderCust' ";
$status = $this->page->filter->status->getValue();
if ($status == 0) {
diff --git a/www/app/pages/register/orderlist.php b/www/app/pages/register/orderlist.php
index 8d5f1a6bf..03397e3f8 100644
--- a/www/app/pages/register/orderlist.php
+++ b/www/app/pages/register/orderlist.php
@@ -13,9 +13,11 @@
use Zippy\Html\Form\Form;
use Zippy\Html\Form\SubmitButton;
use Zippy\Html\Form\TextInput;
+use Zippy\Html\Form\CheckBox;
use Zippy\Html\Label;
use Zippy\Html\Link\ClickLink;
use Zippy\Html\Panel;
+use App\Entity\Pay;
/**
* журнал заказов
@@ -37,8 +39,6 @@ public function __construct() {
}
$this->add(new Form('filter'))->onSubmit($this, 'filterOnSubmit');
- $this->filter->add(new Date('from', time() - (7 * 24 * 3600)));
- $this->filter->add(new Date('to', time() + (1 * 24 * 3600)));
$this->filter->add(new TextInput('searchnumber'));
$this->filter->add(new TextInput('searchtext'));
@@ -65,11 +65,23 @@ public function __construct() {
$this->doclist->Reload();
$this->add(new ClickLink('csv', $this, 'oncsv'));
+
+ $this->add(new Form('payform'))->onSubmit($this, 'payOnSubmit');
+ $this->payform->add(new DropDownChoice('payment', \App\Entity\MoneyFund::getList(), H::getDefMF()));
+ $this->payform->add(new DropDownChoice('pos', \App\Entity\Pos::findArray('pos_name', "details like '%1%' "), 0));
+ $this->payform->add(new TextInput('pamount'));
+ $this->payform->add(new TextInput('pcomment'));
+ $this->payform->add(new CheckBox('closeorder'));
+ $this->payform->add(new Date('pdate', time()));
+ $this->payform->setVisible(false);
+
+
}
public function filterOnSubmit($sender) {
$this->statuspan->setVisible(false);
+ $this->payform->setVisible(false);
$this->doclist->Reload();
}
@@ -88,6 +100,7 @@ public function doclistOnRow($row) {
$row->add(new ClickLink('show'))->onClick($this, 'showOnClick');
$row->add(new ClickLink('edit'))->onClick($this, 'editOnClick');
+ $row->add(new ClickLink('pay', $this, 'payOnClick'))->setVisible($doc->payamount > 0 && $doc->payamount > $doc->payed);
if ($doc->state < Document::STATE_EXECUTED) {
$row->edit->setVisible(true);
@@ -132,7 +145,7 @@ public function statusOnSubmit($sender) {
if ($ttn) {
$this->setWarn('order_has_sent');
}
- App::Redirect("\\App\\Pages\\Doc\\GoodsIssue", 0, $this->_doc->document_id);
+ App::Redirect("\\App\\Pages\\Doc\\TTN", 0, $this->_doc->document_id);
return;
}
if ($sender->id == "binv") {
@@ -146,8 +159,8 @@ public function statusOnSubmit($sender) {
if ($sender->id == "bclose") {
- // $this->_doc->payamount = $this->_doc->amount;
- $this->_doc->save();
+ // $this->_doc->payamount = $this->_doc->amount;
+ // $this->_doc->save();
$this->_doc->updateStatus(Document::STATE_CLOSED);
$this->statuspan->setVisible(false);
@@ -172,7 +185,7 @@ public function updateStatusButtons() {
//проверяем что есть ТТН
- $list = $this->_doc->getChildren('GoodsIssue');
+ $list = $this->_doc->getChildren('TTN');
$ttn = count($list) > 0;
$list = $this->_doc->getChildren('Invoice');
$invoice = count($list) > 0;
@@ -186,6 +199,8 @@ public function updateStatusButtons() {
$this->statuspan->statusform->bclose->setVisible(false);
$this->statuspan->statusform->bref->setVisible(false);
+ $this->statuspan->statusform->bttn->setVisible(false);
+ $this->statuspan->statusform->binv->setVisible(false);
$this->statuspan->statusform->binp->setVisible(true);
} else {
@@ -220,6 +235,11 @@ public function updateStatusButtons() {
$this->statuspan->statusform->setVisible(false);
}
+ if ($this->_doc->payamount > 0 && $this->_doc->payamount > $this->_doc->payed) {
+ $this->statuspan->statusform->bclose->setVisible(false);
+ }
+
+
$this->_tvars['askclose'] = false;
if ($inproc == false || $sent == false) {
$this->_tvars['askclose'] = true;
@@ -228,6 +248,7 @@ public function updateStatusButtons() {
//просмотр
public function showOnClick($sender) {
+ $this->payform->setVisible(false);
$this->_doc = $sender->owner->getDataItem();
if (false == \App\ACL::checkShowDoc($this->_doc, true)) {
@@ -235,7 +256,7 @@ public function showOnClick($sender) {
}
$this->statuspan->setVisible(true);
- $this->statuspan->statusform->setVisible(true);
+ $this->statuspan->statusform->setVisible(true);
$this->statuspan->statusform->setVisible(true);
$this->statuspan->docview->setDoc($this->_doc);
$this->doclist->setSelectedRow($sender->getOwner());
@@ -256,25 +277,123 @@ public function editOnClick($sender) {
public function oncsv($sender) {
$list = $this->doclist->getDataSource()->getItems(-1, -1, 'document_id');
-
+
$header = array();
$data = array();
-
- $i=0;
+
+ $i = 0;
foreach ($list as $d) {
- $i++;
- $data['A'.$i] = H::fd($d->document_date) ;
- $data['B'.$i] = $d->document_number ;
- $data['C'.$i] = $d->customer_name ;
- $data['D'.$i] = $d->amount ;
- $data['E'.$i] = Document::getStateName($d->state) ;
- $data['F'.$i] = $d->notes ;
-
+ $i++;
+ $data['A' . $i] = H::fd($d->document_date);
+ $data['B' . $i] = $d->document_number;
+ $data['C' . $i] = $d->customer_name;
+ $data['D' . $i] = $d->amount;
+ $data['E' . $i] = Document::getStateName($d->state);
+ $data['F' . $i] = $d->notes;
+
+ }
+
+ H::exportExcel($data, $header, 'orderlist.xlsx');
+
+
+ }
+
+ public function payOnClick($sender) {
+ $this->statuspan->setVisible(false);
+ $this->payform->setVisible(true);
+ $this->doclist->setSelectedRow($sender->getOwner());
+ $this->doclist->Reload(true);
+
+ $this->_doc = $sender->owner->getDataItem();
+
+
+ $this->goAnkor('dankor');
+
+ $this->payform->pamount->setText($this->_doc->payamount - $this->_doc->payed);;
+ $this->payform->pcomment->setText("");;
+
+ $this->payform->pos->setVisible(false);//пока без фискализации
+
+ $this->payform->closeorder->setVisible(false);
+
+ $delivered = 0;
+ $list = $this->_doc->getChildren('TTN');
+ foreach ($list as $ttn) {
+ if ($ttn->state == Document::STATE_DELIVERED) {
+ $delivered++;
+ }
+ }
+ if ($delivered > 0 && $delivered == count($list)) {
+ $this->payform->closeorder->setVisible(true);
+
+ }
+
+ $this->payform->closeorder->setChecked(false);
+ }
+
+ public function payOnSubmit($sender) {
+ $form = $this->payform;
+ $pos_id = $form->pos->getValue();
+ $amount = $form->pamount->getText();
+ $pdate = $form->pdate->getDate();
+ if ($amount == 0) {
+ return;
+ }
+
+
+ if ($amount > $this->_doc->payamount - $this->_doc->payed) {
+
+ $this->setWarn('sumoverpay');
+
+ }
+
+
+ if ($pos_id > 0) {
+ $pos = \App\Entity\Pos::load($pos_id);
+
+ $ret = \App\Modules\PPO\PPOHelper::checkpay($this->_doc, $pos_id, $amount, $form->payment->getValue());
+ if ($ret['success'] == false && $ret['docnumber'] > 0) {
+ //повторяем для нового номера
+ $pos->fiscdocnumber = $ret['docnumber'];
+ $pos->save();
+ $ret = \App\Modules\PPO\PPOHelper::check($this->_doc);
+
+ }
+ if ($ret['success'] == false) {
+ $this->setError($ret['data']);
+ return;
+ } else {
+
+ if ($ret['docnumber'] > 0) {
+ $pos->fiscdocnumber = $ret['doclocnumber'] + 1;
+ $pos->save();
+ $this->_doc->headerdata["fiscalnumber"] = $ret['docnumber'];
+ } else {
+ $this->setError("ppo_noretnumber");
+ return;
+
+ }
+
+ }
+
}
-
- H::exportExcel($data,$header,'orderlist.xlsx') ;
-
-
+
+ Pay::addPayment($this->_doc->document_id, $pdate, $amount, $form->payment->getValue(), Pay::PAY_BASE_INCOME, $form->pcomment->getText());
+
+
+ $this->setSuccess('payment_added');
+
+
+ if ($this->payform->closeorder->isChecked() == true) {
+ $doc = Document::load($this->_doc->document_id); //загружаем тобы обновить оплату
+ $doc->updateStatus(Document::STATE_CLOSED);
+ }
+
+
+ $this->doclist->Reload(false);
+ $this->payform->setVisible(false);
+
+
}
}
@@ -296,9 +415,8 @@ private function getWhere() {
$conn = \ZDB\DB::getConnect();
- $where = " date(document_date) >= " . $conn->DBDate($this->page->filter->from->getDate()) . " and date(document_date) <= " . $conn->DBDate($this->page->filter->to->getDate());
- $where .= " and meta_name = 'Order' ";
+ $where = " meta_name = 'Order' ";
$status = $this->page->filter->status->getValue();
if ($status == 0) {
@@ -307,7 +425,7 @@ private function getWhere() {
if ($status == 1) {
$where .= " and state =1 ";
}
-
+
$st = trim($this->page->filter->searchtext->getText());
if (strlen($st) > 2) {
diff --git a/www/app/pages/register/paycustlist.php b/www/app/pages/register/paycustlist.php
index 52ddd1a90..e3fe50fc5 100644
--- a/www/app/pages/register/paycustlist.php
+++ b/www/app/pages/register/paycustlist.php
@@ -28,9 +28,9 @@ class PayCustList extends \App\Pages\Base
public $_pays = array();
public $_totdebet = 0;
public $_totcredit = 0;
- private $_docsin = "'GoodsReceipt','InvoiceCust','ReturnIssue' ";
- private $_docsout = "'GoodsIssue','Invoice','RetCustIssue','PosCheck','ServiceAct' ";
- private $_state = "1,2,3,17,8";
+ private $_docsin = "'GoodsReceipt','InvoiceCust','ReturnIssue' ";
+ private $_docsout = "'GoodsIssue','Invoice','RetCustIssue','PosCheck','ServiceAct','Order' ";
+ private $_state = "1,2,3,17,8";
/**
*
@@ -111,7 +111,7 @@ public function updateCust() {
group by c.customer_name,c.phone, c.customer_id, fl
having fl <> 0
order by c.customer_name ";
-
+
$this->_custlist = \App\DataItem::query($sql);
$this->_totcredit = 0;
$this->_totdebet = 0;
@@ -254,54 +254,49 @@ public function payOnSubmit($sender) {
if ($amount > $this->_doc->payamount - $this->_doc->payed) {
- $this->setError('sumoverpay');
- return;
+ $this->setWarn('sumoverpay');
+
}
- $type = Pay::PAY_BASE_INCOME ;
-
-
- if ( in_array($this->_doc->meta_name,array('GoodsReceipt','InvoiceCust','ReturnIssue') ) ){
+ $type = Pay::PAY_BASE_INCOME;
+
+
+ if (in_array($this->_doc->meta_name, array('GoodsReceipt', 'InvoiceCust', 'ReturnIssue'))) {
$amount = 0 - $amount;
$type = Pay::PAY_BASE_OUTCOME;
}
-
-
- if($pos_id>0) {
+
+
+ if ($pos_id > 0) {
$pos = \App\Entity\Pos::load($pos_id);
-
- $ret = \App\Modules\PPO\PPOHelper::checkpay($this->_doc,$pos_id,$amount, $form->payment->getValue());
+
+ $ret = \App\Modules\PPO\PPOHelper::checkpay($this->_doc, $pos_id, $amount, $form->payment->getValue());
if ($ret['success'] == false && $ret['docnumber'] > 0) {
- //повторяем для нового номера
- $pos->fiscdocnumber = $ret['docnumber'];
+ //повторяем для нового номера
+ $pos->fiscdocnumber = $ret['docnumber'];
+ $pos->save();
+ $ret = \App\Modules\PPO\PPOHelper::check($this->_doc);
+
+ }
+ if ($ret['success'] == false) {
+ $this->setError($ret['data']);
+ return;
+ } else {
+
+ if ($ret['docnumber'] > 0) {
+ $pos->fiscdocnumber = $ret['doclocnumber'] + 1;
$pos->save();
- $ret = \App\Modules\PPO\PPOHelper::check($this->_doc);
+ $this->_doc->headerdata["fiscalnumber"] = $ret['docnumber'];
+ } else {
+ $this->setError("ppo_noretnumber");
+ return;
}
- if ($ret['success'] == false) {
- $this->setError($ret['data']);
- return;
- } else {
-
- if ($ret['docnumber'] > 0) {
- $pos->fiscdocnumber = $ret['doclocnumber'] + 1;
- $pos->save();
- $this->_doc->headerdata["fiscalnumber"] = $ret['docnumber'];
- } else {
- $this->setError("ppo_noretnumber");
- return;
- }
+ }
- }
-
}
-
-
-
-
-
Pay::addPayment($this->_doc->document_id, $pdate, $amount, $form->payment->getValue(), $type, $form->pcomment->getText());
@@ -314,46 +309,44 @@ public function payOnSubmit($sender) {
public function oncsv($sender) {
$csv = "";
-
+
$header = array();
$data = array();
-
- $i=0;
-
+
+ $i = 0;
+
if ($sender->id == 'csv') {
$list = $this->clist->custlist->getDataSource()->getItems(-1, -1, 'customer_name');
- foreach ($list as $c) {
- $i++;
- $data['A'.$i] = $c->customer_name ;
- $data['B'.$i] = $c->phone ;
- $data['C'.$i] = H::fa($c->fl == -1 ? $c->sam : "") ;
- $data['D'.$i] = H::fa($c->fl == 1 ? $c->sam : "") ;
-
-
- }
-
-
-
-
+ foreach ($list as $c) {
+ $i++;
+ $data['A' . $i] = $c->customer_name;
+ $data['B' . $i] = $c->phone;
+ $data['C' . $i] = H::fa($c->fl == -1 ? $c->sam : "");
+ $data['D' . $i] = H::fa($c->fl == 1 ? $c->sam : "");
+
+
+ }
+
+
}
if ($sender->id == 'csv2') {
$list = $this->plist->doclist->getDataSource()->getItems(-1, -1, 'document_id');
foreach ($list as $d) {
- $i++;
- $data['A'.$i] = H::fd($d->document_date) ;
- $data['B'.$i] = $d->document_number;
- $data['C'.$i] = H::fa($d->amount);
- $data['D'.$i] = $d->notes ;
-
-
+ $i++;
+ $data['A' . $i] = H::fd($d->document_date);
+ $data['B' . $i] = $d->document_number;
+ $data['C' . $i] = H::fa($d->amount);
+ $data['D' . $i] = $d->notes;
+
+
}
-
+
}
-
- H::exportExcel($data,$header,'baylist.xlsx') ;
-
+
+ H::exportExcel($data, $header, 'baylist.xlsx');
+
}
}
diff --git a/www/app/pages/register/paylist.php b/www/app/pages/register/paylist.php
index c52485c91..106ee8d0f 100644
--- a/www/app/pages/register/paylist.php
+++ b/www/app/pages/register/paylist.php
@@ -40,8 +40,6 @@ public function __construct() {
$this->add(new Form('filter'))->onSubmit($this, 'filterOnSubmit');
- $this->filter->add(new Date('from', time() - (7 * 24 * 3600)));
- $this->filter->add(new Date('to', time() + (1 * 24 * 3600)));
$this->filter->add(new DropDownChoice('fmfund', \App\Entity\MoneyFund::getList(), 0));
$this->filter->add(new DropDownChoice('fuser', \App\Entity\User::findArray('username', '', 'username'), 0));
$this->filter->add(new DropDownChoice('ftype', $this->_ptlist, 0));
@@ -136,36 +134,36 @@ public function delOnClick($sender) {
public function oncsv($sender) {
$list = $this->doclist->getDataSource()->getItems(-1, -1);
-
+
$header = array();
$data = array();
-
- $header['A1'] = "Дата";
- $header['B1'] = "Счет";
- $header['C1'] = "Приход";
- $header['D1'] = "Расход";
- $header['E1'] = "Документ";
- $header['F1'] = "Создал";
- $header['G1'] = "Контрагент";
- $header['H1'] = "Примечание";
-
- $i=1;
+
+ $header['A1'] = "Дата";
+ $header['B1'] = "Счет";
+ $header['C1'] = "Приход";
+ $header['D1'] = "Расход";
+ $header['E1'] = "Документ";
+ $header['F1'] = "Создал";
+ $header['G1'] = "Контрагент";
+ $header['H1'] = "Примечание";
+
+ $i = 1;
foreach ($list as $doc) {
- $i++;
- $data['A'.$i] = H::fd(strtotime($doc->paydate));
- $data['B'.$i] = $doc->mf_name ;
- $data['C'.$i] = ($doc->amount > 0 ? H::fa($doc->amount) : "") ;
- $data['D'.$i] = ($doc->amount < 0 ? H::fa(0 - $doc->amount) : "") ;
- $data['E'.$i] = $doc->document_number ;
- $data['F'.$i] = $doc->username ;
- $data['G'.$i] = $doc->customer_name ;
- $data['H'.$i] = $doc->notes ;
-
+ $i++;
+ $data['A' . $i] = H::fd(strtotime($doc->paydate));
+ $data['B' . $i] = $doc->mf_name;
+ $data['C' . $i] = ($doc->amount > 0 ? H::fa($doc->amount) : "");
+ $data['D' . $i] = ($doc->amount < 0 ? H::fa(0 - $doc->amount) : "");
+ $data['E' . $i] = $doc->document_number;
+ $data['F' . $i] = $doc->username;
+ $data['G' . $i] = $doc->customer_name;
+ $data['H' . $i] = $doc->notes;
+
}
-
- H::exportExcel($data,$header,'paylist.xlsx') ;
+
+ H::exportExcel($data, $header, 'paylist.xlsx');
}
-
+
}
@@ -186,7 +184,7 @@ private function getWhere() {
$conn = \ZDB\DB::getConnect();
- $where = " date(paydate) >= " . $conn->DBDate($this->page->filter->from->getDate()) . " and date(paydate) <= " . $conn->DBDate($this->page->filter->to->getDate());
+ $where = " 1=1 ";
$author = $this->page->filter->fuser->getValue();
$type = $this->page->filter->ftype->getValue();
diff --git a/www/app/pages/register/serlist.php b/www/app/pages/register/serlist.php
index ae8f04acb..17a10c206 100644
--- a/www/app/pages/register/serlist.php
+++ b/www/app/pages/register/serlist.php
@@ -37,8 +37,6 @@ public function __construct() {
}
$this->add(new Form('filter'))->onSubmit($this, 'filterOnSubmit');
- $this->filter->add(new Date('from', time() - (7 * 24 * 3600)));
- $this->filter->add(new Date('to', time() + (1 * 24 * 3600)));
$this->filter->add(new TextInput('searchnumber'));
$this->filter->add(new TextInput('searchtext'));
@@ -209,30 +207,28 @@ public function editOnClick($sender) {
App::Redirect("\\App\\Pages\\Doc\\GoodsIssue", $doc->document_id);
}
-
public function oncsv($sender) {
$list = $this->doclist->getDataSource()->getItems(-1, -1, 'document_id');
-
-
+
+
$header = array();
$data = array();
-
- $i=0;
+
+ $i = 0;
foreach ($list as $d) {
- $i++;
- $data['A'.$i] = H::fd($d->document_date) ;
- $data['B'.$i] = $d->document_number ;
- $data['C'.$i] = $d->customer_name ;
- $data['D'.$i] = $d->amount ;
- $data['E'.$i] = $d->notes ;
-
+ $i++;
+ $data['A' . $i] = H::fd($d->document_date);
+ $data['B' . $i] = $d->document_number;
+ $data['C' . $i] = $d->customer_name;
+ $data['D' . $i] = $d->amount;
+ $data['E' . $i] = $d->notes;
+
}
-
- H::exportExcel($data,$header,'serlist.xlsx') ;
-
-
-
+
+ H::exportExcel($data, $header, 'serlist.xlsx');
+
+
}
}
@@ -254,9 +250,8 @@ private function getWhere() {
$conn = \ZDB\DB::getConnect();
- $where = " date(document_date) >= " . $conn->DBDate($this->page->filter->from->getDate()) . " and date(document_date) <= " . $conn->DBDate($this->page->filter->to->getDate());
- $where .= " and meta_name in( 'ServiceAct' ) ";
+ $where = " meta_name in( 'ServiceAct' ) ";
$status = $this->page->filter->status->getValue();
if ($status == 0) {
diff --git a/www/app/pages/register/tasklist.php b/www/app/pages/register/tasklist.php
index 30cd0980f..e142b45c0 100644
--- a/www/app/pages/register/tasklist.php
+++ b/www/app/pages/register/tasklist.php
@@ -356,26 +356,26 @@ public function OnFilter($sender) {
public function oncsv($sender) {
$list = $this->tasktab->tasklist->getDataSource()->getItems(-1, -1, 'document_id');
-
-
+
+
$header = array();
$data = array();
-
- $i=0;
+
+ $i = 0;
foreach ($list as $task) {
- $i++;
- $data['A'.$i] = $task->document_number ;
- $data['B'.$i] = $task->notes ;
- $data['C'.$i] = H::fdt($task->document_date) ;
- $data['D'.$i] = $task->headerdata['taskhours'] ;
- $data['E'.$i] = Document::getStateName($task->state) ;
- $data['F'.$i] = $task->notes ;
-
+ $i++;
+ $data['A' . $i] = $task->document_number;
+ $data['B' . $i] = $task->notes;
+ $data['C' . $i] = H::fdt($task->document_date);
+ $data['D' . $i] = $task->headerdata['taskhours'];
+ $data['E' . $i] = Document::getStateName($task->state);
+ $data['F' . $i] = $task->notes;
+
}
-
- H::exportExcel($data,$header,'taskslist.xlsx') ;
-
-
+
+ H::exportExcel($data, $header, 'taskslist.xlsx');
+
+
}
}
diff --git a/www/app/pages/report/outcome.php b/www/app/pages/report/outcome.php
index f6ad77cec..47a7051a6 100644
--- a/www/app/pages/report/outcome.php
+++ b/www/app/pages/report/outcome.php
@@ -22,11 +22,16 @@ public function __construct() {
if (false == \App\ACL::checkShowReport('Outcome')) {
return;
}
+ $br = "";
+ $brids = \App\ACL::getBranchIDsConstraint();
+ if (strlen($brids) > 0) {
+ $br = " and branch_id in ({$brids}) ";
+ }
$this->add(new Form('filter'))->onSubmit($this, 'OnSubmit');
$this->filter->add(new Date('from', time() - (7 * 24 * 3600)));
$this->filter->add(new Date('to', time()));
- $this->filter->add(new DropDownChoice('emp', \App\Entity\User::findArray('username', "user_id in (select user_id from documents_view where meta_name in('GoodsIssue','ServiceAct','Task','Order','POSCheck'))", 'username'), 0));
+ $this->filter->add(new DropDownChoice('emp', \App\Entity\User::findArray('username', "user_id in (select user_id from documents_view where meta_name in('GoodsIssue','ServiceAct','Task','Order','POSCheck','TTN') {$br} )", 'username'), 0));
$this->filter->add(new DropDownChoice('cat', \App\Entity\Category::findArray('cat_name', "", 'cat_name'), 0))->setVisible(false);
$hlist = \App\Entity\Customer::getHoldList();
// $this->filter->add(new DropDownChoice('holding', $hlist, 0))->setVisible(false);
@@ -108,7 +113,7 @@ public function OnAutoCustomer($sender) {
private function generateReport() {
-
+ $conn = \ZDB\DB::getConnect();
$type = $this->filter->type->getValue();
$user = $this->filter->emp->getValue();
$cat_id = $this->filter->cat->getValue();
@@ -130,8 +135,29 @@ private function generateReport() {
$br = " and d.branch_id in ({$brids}) ";
}
+ // скидка
+
+
+ $sql = "document_id in( select d.document_id from `entrylist_view` e
+ join `documents_view` d on d.`document_id` = e.`document_id`
+ where e.`item_id` >0 and e.`quantity` <> 0
+ and d.`meta_name` in ('GoodsIssue','ServiceAct','Task','Order','POSCheck')
+ {$br} {$u} and d.payamount >0 and d.payamount < d.amount
+ AND DATE(e.document_date) >= " . $conn->DBDate($from) . "
+ AND DATE(e.document_date) <= " . $conn->DBDate($to) . ")";
+
+ $res = \App\Entity\Doc\Document::find($sql);
+ $disc = 0;
+ foreach ($res as $d) {
+ if ($d->headerdata['paydisc'] > 0) {
+
+ $disc += $d->headerdata['paydisc'];
+ }
+ }
+
+
$detail = array();
- $conn = \ZDB\DB::getConnect();
+
$cat = "";
if ($type == 5 && $cat_id > 0) {
$cat = " and cat_id=" . $cat_id;
@@ -161,9 +187,9 @@ private function generateReport() {
join `items_view` i on e.`item_id` = i.`item_id`
join `documents_view` d on d.`document_id` = e.`document_id`
- where e.`item_id` >0 {$u} and e.`quantity` <> 0 {$cat} {$cust}
- and d.`meta_name` in ('GoodsIssue','ServiceAct' ,'POSCheck','ReturnIssue')
- {$br}
+ where e.`item_id` >0 and e.`quantity` <> 0 {$cat} {$cust}
+ and d.`meta_name` in ('GoodsIssue','ServiceAct' ,'POSCheck','ReturnIssue','TTN')
+ {$br} {$u}
AND DATE(e.document_date) >= " . $conn->DBDate($from) . "
AND DATE(e.document_date) <= " . $conn->DBDate($to) . "
group by i.`itemname`,i.`item_code`
@@ -178,9 +204,9 @@ private function generateReport() {
left join `customers` c on c.`customer_id` = e.`customer_id`
join `documents_view` d on d.`document_id` = e.`document_id`
- where e.`quantity` <>0 {$u}
- and d.`meta_name` in ('GoodsIssue','ServiceAct', 'POSCheck','ReturnIssue') AND DATE(e.document_date) >= " . $conn->DBDate($from) . "
- {$br} AND DATE(e.document_date) <= " . $conn->DBDate($to) . "
+ where e.`quantity` <>0
+ and d.`meta_name` in ('GoodsIssue','ServiceAct', 'POSCheck','ReturnIssue','TTN') AND DATE(e.document_date) >= " . $conn->DBDate($from) . "
+ {$br} {$u} AND DATE(e.document_date) <= " . $conn->DBDate($to) . "
AND c.detail not like '%1%'
group by c.`customer_name`,c.`customer_id`
order by c.`customer_name`
@@ -188,14 +214,14 @@ private function generateReport() {
}
if ($type == 3) { //по датам
$sql = "
- select e.`document_date` as dt , sum(0-e.`amount`) as summa
+ select e.`document_date` as dt , sum(0-e.`amount`) as summa ,0 as navar
from `entrylist_view` e
join `items` i on e.`item_id` = i.`item_id`
join `documents_view` d on d.`document_id` = e.`document_id`
- where e.`item_id` >0 {$u} and e.`quantity` <>0
- and d.`meta_name` in ('GoodsIssue','ServiceAct' ,'POSCheck','ReturnIssue')
- {$br} AND DATE(e.document_date) >= " . $conn->DBDate($from) . "
+ where e.`item_id` >0 and e.`quantity` <>0
+ and d.`meta_name` in ('GoodsIssue','ServiceAct' ,'POSCheck','ReturnIssue','TTN')
+ {$br} {$u} AND DATE(e.document_date) >= " . $conn->DBDate($from) . "
AND DATE(e.document_date) <= " . $conn->DBDate($to) . "
group by e.`document_date`
order by e.`document_date`
@@ -204,14 +230,14 @@ private function generateReport() {
if ($type == 4 || $type == 7) { //по сервисам
$sql = "
- select s.`service_name` as itemname, sum(0-e.`quantity`) as qty, sum(0-e.`amount`) as summa
+ select s.`service_name` as itemname, sum(0-e.`quantity`) as qty, sum(0-e.`amount`) as summa ,0 as navar
from `entrylist_view` e
join `services` s on e.`service_id` = s.`service_id`
join `documents_view` d on d.`document_id` = e.`document_id`
- where e.`service_id` >0 {$u} and e.`quantity` <>0 {$cust}
+ where e.`service_id` >0 and e.`quantity` <>0 {$cust}
and d.`meta_name` in ( 'ServiceAct' ,'POSCheck' )
- {$br} AND DATE(e.document_date) >= " . $conn->DBDate($from) . "
+ {$br} {$u} AND DATE(e.document_date) >= " . $conn->DBDate($from) . "
AND DATE(e.document_date) <= " . $conn->DBDate($to) . "
group by s.`service_name`
order by s.`service_name` ";
@@ -224,9 +250,9 @@ private function generateReport() {
join `items_view` i on e.`item_id` = i.`item_id`
join `documents_view` d on d.`document_id` = e.`document_id`
- where e.`item_id` >0 {$u} and e.`quantity` <>0
- and d.`meta_name` in ('GoodsIssue', 'POSCheck','ReturnIssue')
- {$br}
+ where e.`item_id` >0 and e.`quantity` <>0
+ and d.`meta_name` in ('GoodsIssue', 'POSCheck','ReturnIssue','TTN')
+ {$br} {$u}
AND DATE(e.document_date) >= " . $conn->DBDate($from) . "
AND DATE(e.document_date) <= " . $conn->DBDate($to) . "
group by i.`cat_name`
@@ -255,9 +281,9 @@ private function generateReport() {
join `documents_view` d on d.`document_id` = e.`document_id`
- where e.`quantity` <>0 {$u}
- and d.`meta_name` in ('GoodsIssue', 'ServiceAct' , 'POSCheck','ReturnIssue')
- {$br} AND DATE(e.document_date) >= " . $conn->DBDate($from) . "
+ where e.`quantity` <>0
+ and d.`meta_name` in ('GoodsIssue', 'ServiceAct' , 'POSCheck','ReturnIssue','TTN')
+ {$br} {$u} AND DATE(e.document_date) >= " . $conn->DBDate($from) . "
AND DATE(e.document_date) <= " . $conn->DBDate($to) . "
and d.customer_id in({$custlist})
";
@@ -281,7 +307,15 @@ private function generateReport() {
$rs = $conn->Execute($sql);
}
+
foreach ($rs as $row) {
+
+ $summa = $row['summa'];
+ if ($row['navar'] != 0) {
+ $row['summa'] += $row['navar'];
+ }
+
+
$detail[] = array(
"code" => $row['item_code'],
"name" => $row['itemname'],
@@ -303,6 +337,9 @@ private function generateReport() {
$header['totsumma'] = H::fa($totsum);
$header['totnavar'] = H::fa($totnavar);
+ $header['disc'] = H::fa($disc);
+ $header['isdisc'] = $disc > 0;
+ $header['totall'] = H::fa($totsum - $disc);
if ($type == 1 || $type == 6 || strlen($cat) > 0) {
diff --git a/www/app/pages/service/armpos.php b/www/app/pages/service/armpos.php
index 0a0c2217f..f1a56f337 100644
--- a/www/app/pages/service/armpos.php
+++ b/www/app/pages/service/armpos.php
@@ -257,6 +257,7 @@ public function serOnRow($row) {
public function addcodeOnClick($sender) {
$code = trim($this->form2->barcode->getText());
+ $store = $this->form1->store->getValue();
$this->form2->barcode->setText('');
if ($code == '') {
return;
@@ -264,7 +265,7 @@ public function addcodeOnClick($sender) {
$code_ = Item::qstr($code);
- $item = Item::getFirst(" item_id in(select item_id from store_stock where store_id={$this->pos->store}) and (item_code = {$code_} or bar_code = {$code_})");
+ $item = Item::getFirst(" item_id in(select item_id from store_stock where store_id={$store}) and (item_code = {$code_} or bar_code = {$code_})");
if ($item == null) {
@@ -272,7 +273,7 @@ public function addcodeOnClick($sender) {
return;
}
- $qty = $item->getQuantity($this->pos->store);
+ $qty = $item->getQuantity($store);
if ($qty <= 0) {
$this->setError("noitemonstore", $item->itemname);
}
@@ -283,14 +284,14 @@ public function addcodeOnClick($sender) {
} else {
- $price = $item->getPrice($this->pos->pricetype, $this->pos->store);
+ $price = $item->getPrice($this->pos->pricetype, $store);
$item->price = $price;
$item->quantity = 1;
if ($this->_tvars["usesnumber"] == true && $item->useserial == 1) {
$serial = '';
- $slist = $item->getSerials($this->pos->store);
+ $slist = $item->getSerials($store);
if (count($slist) == 1) {
$serial = array_pop($slist);
}
@@ -359,6 +360,7 @@ public function addserOnClick($sender) {
}
public function saverowOnClick($sender) {
+ $store = $this->form1->store->getValue();
$id = $this->editdetail->edittovar->getKey();
if ($id == 0) {
@@ -383,7 +385,7 @@ public function saverowOnClick($sender) {
}
if ($this->_tvars["usesnumber"] == true && $item->useserial == 1) {
- $slist = $item->getSerials($this->pos->store);
+ $slist = $item->getSerials($store);
if (in_array($item->snumber, $slist) == false) {
$this->setWarn('invalid_serialno');
@@ -467,17 +469,18 @@ private function calcTotal() {
public function OnChangeItem($sender) {
$id = $sender->getKey();
$item = Item::load($id);
+ $store = $this->form1->store->getValue();
- $price = $item->getPrice($this->pos->pricetype, $this->pos->store);
- $qty = $item->getQuantity($this->pos->store);
+ $price = $item->getPrice($this->pos->pricetype, $store);
+ $qty = $item->getQuantity($store);
$this->editdetail->qtystock->setText(H::fqty($qty));
$this->editdetail->editprice->setText($price);
if ($this->_tvars["usesnumber"] == true && $item->useserial == 1) {
$serial = '';
- $slist = $item->getSerials($this->pos->store);
+ $slist = $item->getSerials($store);
if (count($slist) == 1) {
$serial = array_pop($slist);
}
@@ -715,9 +718,9 @@ public function savedocOnClick($sender) {
$logger->error($ee->getMessage() . " Документ " . $this->_doc->meta_desc);
return;
}
- $this->form3->customer->setKey(0);
- $this->form3->customer->setText('');
- $this->form3->payment->setValue(H::getDefMF());
+ $this->form3->customer->setKey(0);
+ $this->form3->customer->setText('');
+ $this->form3->payment->setValue(H::getDefMF());
$this->form3->setVisible(false);
$this->form4->setVisible(true);
@@ -731,20 +734,20 @@ public function OnPayment($sender) {
$this->form3->payed->setVisible(true);
$this->form3->payamount->setVisible(true);
$this->form3->paydisc->setVisible(true);
- $this->form3->exchange->setVisible(true);
-
+ $this->form3->exchange->setVisible(true);
+
if ($b == \App\Entity\MoneyFund::PREPAID) {
$this->form3->payed->setVisible(false);
$this->form3->payamount->setVisible(false);
$this->form3->paydisc->setVisible(false);
$this->form3->exchange->setVisible(false);
- }
+ }
if ($b == \App\Entity\MoneyFund::CREDIT) {
$this->form3->payed->setVisible(false);
//$this->form3->payamount->setVisible(false);
$this->form3->paydisc->setVisible(false);
$this->form3->exchange->setVisible(false);
- }
+ }
}
@@ -787,7 +790,7 @@ public function OnCloseShift($sender) {
$ret = $this->zform();
if ($ret == true) {
$this->closeshift();
- };
+ }
}
diff --git a/www/app/pages/service/export.php b/www/app/pages/service/export.php
index 7fece7839..3b66c9beb 100644
--- a/www/app/pages/service/export.php
+++ b/www/app/pages/service/export.php
@@ -16,8 +16,8 @@
use Zippy\Html\DataList\DataView;
use Zippy\Html\Form\CheckBox;
use Zippy\Html\Label;
-
-
+
+
class Export extends \App\Pages\Base
{
public $_docs = array();
@@ -27,9 +27,8 @@ public function __construct() {
if (false == \App\ACL::checkShowSer('Export')) {
return;
}
-
-
-
+
+
$form = $this->add(new Form("iform"));
$form->add(new DropDownChoice("itype", array(), 0))->onChange($this, "onType");
@@ -43,14 +42,14 @@ public function __construct() {
$form = $this->add(new Form("cform"));
$form->add(new DropDownChoice("ctype", array(), 0));
-
+
$form->onSubmit($this, "onCExport");
$form = $this->add(new Form("dform"));
$form->add(new DropDownChoice("dtype", array('GoodsReceipt' => Document::getDesc('GoodsReceipt'), 'GoodsIssue' => Document::getDesc('GoodsIssue')), 'GoodsReceipt'));
-
+
$form->add(new Date('dfrom', time() - (7 * 24 * 3600)));
$form->add(new Date('dto', time() + (1 * 24 * 3600)));
@@ -70,8 +69,7 @@ public function onType($sender) {
public function onCExport($sender) {
$t = $this->cform->ctype->getValue();
-
-
+
$sql = " status=" . Customer::STATUS_ACTUAL;
if ($t > 0) {
@@ -79,90 +77,81 @@ public function onCExport($sender) {
$sql .= " and detail like '%{$t}%' ";
}
$list = Customer::find($sql, "customer_name asc");
-
- $header = array();
+
+ $header = array();
$data = array();
-
- $header['A1'] = "Наименование";
- $header['B1'] = "Телефон";
- $header['C1'] = "Email";
- $header['D1'] = "Город";
- $header['E1'] = "Адрес";
-
-
-
- $i=1;
+
+ $header['A1'] = "Наименование";
+ $header['B1'] = "Телефон";
+ $header['C1'] = "Email";
+ $header['D1'] = "Город";
+ $header['E1'] = "Адрес";
+
+
+ $i = 1;
foreach ($list as $item) {
- $i++;
- $data['A'.$i] = $item->customer_name;
- $data['B'.$i] = $item->phone ;
- $data['C'.$i] = $item->email ;
- $data['D'.$i] = $item->city ;
- $data['E'.$i] = $item->address ;
-
-
-
+ $i++;
+ $data['A' . $i] = $item->customer_name;
+ $data['B' . $i] = $item->phone;
+ $data['C' . $i] = $item->email;
+ $data['D' . $i] = $item->city;
+ $data['E' . $i] = $item->address;
+
+
}
-
- H::exportExcel($data,$header,'customers_' . date('Y_m_d', time()) .'.xlsx') ;
-
-
+
+ H::exportExcel($data, $header, 'customers_' . date('Y_m_d', time()) . '.xlsx');
+
+
}
public function onExport($sender) {
$t = $this->iform->itype->getValue();
$store = $this->iform->store->getValue();
$pt = $this->iform->price->getValue();
-
+
$sql = "disabled <> 1 ";
$list = Item::find($sql, "itemname asc");
-
-
+
+
$header = array();
$data = array();
-
- $header['A1'] = "Наименование";
- $header['B1'] = "Ед.";
- $header['C1'] = "Группа";
- $header['D1'] = "Бренд";
- $header['E1'] = "Артикул";
- $header['F1'] = "Штрих код";
- $header['G1'] = "Цена";
- if ($t == 1) $header['H1'] = "Кол.";
-
-
-
- $i=1;
+
+ $header['A1'] = "Наименование";
+ $header['B1'] = "Ед.";
+ $header['C1'] = "Группа";
+ $header['D1'] = "Бренд";
+ $header['E1'] = "Артикул";
+ $header['F1'] = "Штрих код";
+ $header['G1'] = "Цена";
+ if ($t == 1) {
+ $header['H1'] = "Кол.";
+ }
+
+
+ $i = 1;
foreach ($list as $item) {
- $i++;
- $data['A'.$i] = $item->itemname;
- $data['B'.$i] = $item->msr ;
- $data['C'.$i] = $item->cat_name ;
- $data['D'.$i] = $item->manufacturer ;
- $data['E'.$i] = $item->item_code ;
- $data['F'.$i] = $item->bar_code ;
- $price = H::fa($item->getPrice($pt));
- $data['G'.$i] = H::fa($price) ;
-
+ $i++;
+ $data['A' . $i] = $item->itemname;
+ $data['B' . $i] = $item->msr;
+ $data['C' . $i] = $item->cat_name;
+ $data['D' . $i] = $item->manufacturer;
+ $data['E' . $i] = $item->item_code;
+ $data['F' . $i] = $item->bar_code;
+ $price = H::fa($item->getPrice($pt));
+ $data['G' . $i] = H::fa($price);
+
if ($t == 1) {
$qty = H::fqty($item->getQuantity($store));
- $data['H'.$i] = H::fqty($qty) ;
+ $data['H' . $i] = H::fqty($qty);
}
-
-
-
+
+
}
-
- H::exportExcel($data,$header,'items_' . date('Y_m_d', time()) .'.xlsx') ;
-
-
-
-
+ H::exportExcel($data, $header, 'items_' . date('Y_m_d', time()) . '.xlsx');
-
-
}
@@ -189,38 +178,37 @@ public function expDRow($row) {
}
public function onDExport($sender) {
-
- $header = array();
+
+ $header = array();
$data = array();
-
-
-
- $i=0;
+
+
+ $i = 0;
foreach ($this->_docs as $doc) {
- $i++;
- $data['A'.$i] = $doc->document_number;
- $data['B'.$i] = H::fd($doc->document_date) ;
- $data['C'.$i] = $doc->customer_name ;
- $n=1;
- foreach ($doc->unpackDetails('detaildata') as $item) {
- $i++;
- $data['B'.$i] = $n++ ;
- $data['C'.$i] = $item->itemname;
- $data['D'.$i] = $item->item_code ;
- $data['E'.$i] = H::fqty($item->quantity) ;
- $data['F'.$i] = H::fa($item->price) ;
-
- }
-
- $i++;
- $data['A'.$i] = H::l("total").": ";
- $data['B'.$i] = H::fa($doc->amount);
- $i++;
+ $i++;
+ $data['A' . $i] = $doc->document_number;
+ $data['B' . $i] = H::fd($doc->document_date);
+ $data['C' . $i] = $doc->customer_name;
+ $n = 1;
+ foreach ($doc->unpackDetails('detaildata') as $item) {
+ $i++;
+ $data['B' . $i] = $n++;
+ $data['C' . $i] = $item->itemname;
+ $data['D' . $i] = $item->item_code;
+ $data['E' . $i] = H::fqty($item->quantity);
+ $data['F' . $i] = H::fa($item->price);
+
+ }
+
+ $i++;
+ $data['A' . $i] = H::l("total") . ": ";
+ $data['B' . $i] = H::fa($doc->amount);
+ $i++;
}
-
- H::exportExcel($data,$header,'exportdoc_' . date('Y_m_d', time()) .'.xlsx') ;
-
-
+
+ H::exportExcel($data, $header, 'exportdoc_' . date('Y_m_d', time()) . '.xlsx');
+
+
}
diff --git a/www/app/pages/service/import.php b/www/app/pages/service/import.php
index 147dbec7d..5dd9ab79d 100644
--- a/www/app/pages/service/import.php
+++ b/www/app/pages/service/import.php
@@ -27,10 +27,10 @@ public function __construct() {
$form = $this->add(new Form("iform"));
$form->add(new DropDownChoice("itype", array(), 0))->onChange($this, "onType");
-
+
$form->add(new DropDownChoice("price", Item::getPriceTypeList()));
$form->add(new DropDownChoice("store", Store::getList(), H::getDefStore()));
-
+
$form->add(new \Zippy\Html\Form\File("filename"));
$cols = array(0 => '-', 'A' => 'A', 'B' => 'B', 'C' => 'C', 'D' => 'D', 'E' => 'E', 'F' => 'F', 'G' => 'G', 'H' => 'H', 'I' => 'I', 'J' => 'J');
$form->add(new DropDownChoice("colname", $cols));
@@ -56,12 +56,11 @@ public function __construct() {
$form = $this->add(new Form("nform"));
-
$form->add(new DropDownChoice("nstore", Store::getList(), H::getDefStore()));
-
+
$form->add(new AutocompleteTextInput("ncust"))->onText($this, 'OnAutoCustomer');
$form->add(new \Zippy\Html\Form\File("nfilename"));
-
+
$form->add(new DropDownChoice("ncolname", $cols));
$form->add(new DropDownChoice("ncolcode", $cols));
$form->add(new DropDownChoice("ncolqty", $cols));
@@ -76,8 +75,8 @@ public function __construct() {
$form = $this->add(new Form("cform"));
$form->add(new DropDownChoice("ctype", array(), 0));
-
-
+
+
$form->add(new CheckBox("cpreview"));
$form->add(new CheckBox("cpassfirst"));
$form->add(new DropDownChoice("colcname", $cols));
@@ -112,7 +111,7 @@ public function onImport($sender) {
$t = $this->iform->itype->getValue();
$store = $this->iform->store->getValue();
$pt = $this->iform->price->getValue();
-
+
$preview = $this->iform->preview->isChecked();
$preview = $this->iform->preview->isChecked();
$checkname = $this->iform->checkname->isChecked();
@@ -144,30 +143,27 @@ public function onImport($sender) {
}
$data = array();
- $oSpreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($file['tmp_name']); // Вариант и для xls и xlsX
-
-
- $oCells = $oSpreadsheet->getActiveSheet()->getCellCollection();
-
- for ($iRow = ($passfirst ? 2:1); $iRow <= $oCells->getHighestRow(); $iRow++)
- {
-
- $row = array();
- for ($iCol = 'A'; $iCol <= $oCells->getHighestColumn(); $iCol++)
- {
- $oCell = $oCells->get($iCol.$iRow);
- if($oCell)
- {
- $row[$iCol] = $oCell->getValue();
- }
-
- }
- $data[$iRow] = $row;
-
-
- }
-
- unset($oSpreadsheet);
+ $oSpreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($file['tmp_name']); // Вариант и для xls и xlsX
+
+
+ $oCells = $oSpreadsheet->getActiveSheet()->getCellCollection();
+
+ for ($iRow = ($passfirst ? 2 : 1); $iRow <= $oCells->getHighestRow(); $iRow++) {
+
+ $row = array();
+ for ($iCol = 'A'; $iCol <= $oCells->getHighestColumn(); $iCol++) {
+ $oCell = $oCells->get($iCol . $iRow);
+ if ($oCell) {
+ $row[$iCol] = $oCell->getValue();
+ }
+
+ }
+ $data[$iRow] = $row;
+
+
+ }
+
+ unset($oSpreadsheet);
if ($preview) {
@@ -176,16 +172,16 @@ public function onImport($sender) {
foreach ($data as $row) {
$this->_tvars['list'][] = array(
- 'colname' => $row[$colname ],
- 'colcode' => $row[$colcode ],
- 'colbarcode' => $row[$colbarcode ],
- 'colgr' => $row[$colgr ],
- 'colqty' => $row[$colqty ],
- 'colmsr' => $row[$colmsr ],
- 'colinprice' => $row[$colinprice ],
- 'colprice' => $row[$colprice ],
- 'colbrand' => $row[$colbrand ] ,
- 'coldesc' => $row[$coldesc ]
+ 'colname' => $row[$colname],
+ 'colcode' => $row[$colcode],
+ 'colbarcode' => $row[$colbarcode],
+ 'colgr' => $row[$colgr],
+ 'colqty' => $row[$colqty],
+ 'colmsr' => $row[$colmsr],
+ 'colinprice' => $row[$colinprice],
+ 'colprice' => $row[$colprice],
+ 'colbrand' => $row[$colbrand],
+ 'coldesc' => $row[$coldesc]
);
}
return;
@@ -195,7 +191,7 @@ public function onImport($sender) {
$newitems = array();
foreach ($data as $row) {
- $catname = $row[$colgr ];
+ $catname = $row[$colgr];
if (strlen($catname) > 0) {
$cat = Category::getFirst('cat_name=' . Category::qstr($catname));
if ($cat == null) {
@@ -205,42 +201,43 @@ public function onImport($sender) {
}
}
$item = null;
- $itemname = trim($row[$colname ]);
- $itemcode = trim($row[$colcode ]);
- $itembarcode = trim($row[$colbarcode ]);
+ $itemname = trim($row[$colname]);
+ $itemcode = trim($row[$colcode]);
+ $itembarcode = trim($row[$colbarcode]);
if (strlen($itemname) > 0) {
if (strlen($itembarcode) > 0) {
$item = Item::getFirst('bar_code=' . Item::qstr($itembarcode));
- } else
- if (strlen($itemcode) > 0) {
- $item = Item::getFirst('item_code=' . Item::qstr($itemcode));
+ } else {
+ if (strlen($itemcode) > 0) {
+ $item = Item::getFirst('item_code=' . Item::qstr($itemcode));
+ }
}
- if ($item == null && $checkname==true) {
+ if ($item == null && $checkname == true) {
$item = Item::getFirst('itemname=' . Item::qstr($itemname));
}
if ($item == null) {
- $price = str_replace(',', '.', trim($row[$colprice ]));
- $inprice = str_replace(',', '.', trim($row[$colinprice ]));
- $qty = str_replace(',', '.', trim($row[$colqty ]));
+ $price = str_replace(',', '.', trim($row[$colprice]));
+ $inprice = str_replace(',', '.', trim($row[$colinprice]));
+ $qty = str_replace(',', '.', trim($row[$colqty]));
$item = new Item();
$item->itemname = $itemname;
- if (strlen($row[$colcode ]) > 0) {
- $item->item_code = trim($row[$colcode ]);
+ if (strlen($row[$colcode]) > 0) {
+ $item->item_code = trim($row[$colcode]);
}
- if (strlen($row[$colbarcode ]) > 0) {
- $item->bar_code = trim($row[$colbarcode ]);
+ if (strlen($row[$colbarcode]) > 0) {
+ $item->bar_code = trim($row[$colbarcode]);
}
- if (strlen($row[$colmsr ]) > 0) {
- $item->msr = trim($row[$colmsr ]);
+ if (strlen($row[$colmsr]) > 0) {
+ $item->msr = trim($row[$colmsr]);
}
- if (strlen($row[$colbrand ]) > 0) {
- $item->manufacturer = trim($row[$colbrand ]);
+ if (strlen($row[$colbrand]) > 0) {
+ $item->manufacturer = trim($row[$colbrand]);
}
- if (strlen(trim($row[$coldesc ])) > 0) {
- $item->description = trim($row[$coldesc ]);
+ if (strlen(trim($row[$coldesc])) > 0) {
+ $item->description = trim($row[$coldesc]);
}
if ($price > 0) {
$item->{$pt} = $price;
@@ -299,7 +296,7 @@ public function onImport($sender) {
public function onCImport($sender) {
$t = $this->cform->ctype->getValue();
-
+
$preview = $this->cform->cpreview->isChecked();
$passfirst = $this->cform->cpassfirst->isChecked();
$this->_tvars['preview2'] = false;
@@ -309,7 +306,7 @@ public function onCImport($sender) {
$colemail = $this->cform->colemail->getValue();
$colcity = $this->cform->colcity->getValue();
$coladdress = $this->cform->coladdress->getValue();
-
+
if ($colcname === '0') {
$this->setError('noselcolname');
@@ -321,38 +318,33 @@ public function onCImport($sender) {
$this->setError('noselfile');
return;
}
-
-
- $data = array();
-
- $oSpreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($file['tmp_name']); // Вариант и для xls и xlsX
-
-
- $oCells = $oSpreadsheet->getActiveSheet()->getCellCollection();
-
- for ($iRow = ($passfirst ? 2:1); $iRow <= $oCells->getHighestRow(); $iRow++)
- {
-
- $row = array();
- for ($iCol = 'A'; $iCol <= $oCells->getHighestColumn(); $iCol++)
- {
- $oCell = $oCells->get($iCol.$iRow);
- if($oCell)
- {
- $row[$iCol] = $oCell->getValue();
- }
-
- }
- $data[$iRow] = $row;
-
-
- }
-
- unset($oSpreadsheet);
-
-
-
-
+
+
+ $data = array();
+
+ $oSpreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($file['tmp_name']); // Вариант и для xls и xlsX
+
+
+ $oCells = $oSpreadsheet->getActiveSheet()->getCellCollection();
+
+ for ($iRow = ($passfirst ? 2 : 1); $iRow <= $oCells->getHighestRow(); $iRow++) {
+
+ $row = array();
+ for ($iCol = 'A'; $iCol <= $oCells->getHighestColumn(); $iCol++) {
+ $oCell = $oCells->get($iCol . $iRow);
+ if ($oCell) {
+ $row[$iCol] = $oCell->getValue();
+ }
+
+ }
+ $data[$iRow] = $row;
+
+
+ }
+
+ unset($oSpreadsheet);
+
+
if ($preview) {
$this->_tvars['preview2'] = true;
@@ -360,11 +352,11 @@ public function onCImport($sender) {
foreach ($data as $row) {
$this->_tvars['list2'][] = array(
- 'colname' => $row[$colcname ],
- 'colphone' => $row[$colphone ],
- 'colemail' => $row[$colemail ],
- 'colcity' => $row[$colcity ],
- 'coladdress' => $row[$coladdress ]
+ 'colname' => $row[$colcname],
+ 'colphone' => $row[$colphone],
+ 'colemail' => $row[$colemail],
+ 'colcity' => $row[$colcity],
+ 'coladdress' => $row[$coladdress]
);
}
return;
@@ -375,8 +367,8 @@ public function onCImport($sender) {
foreach ($data as $row) {
$c = null;
- $name = $row[$colcname ];
- $phone = $row[$colphone ];
+ $name = $row[$colcname];
+ $phone = $row[$colphone];
if (strlen(trim($name)) == 0) {
continue;
@@ -392,17 +384,17 @@ public function onCImport($sender) {
$c->type = $t;
$c->customer_name = $name;
- if (strlen($row[$colphone ]) > 0) {
- $c->phone = $row[$colphone ];
+ if (strlen($row[$colphone]) > 0) {
+ $c->phone = $row[$colphone];
}
- if (strlen($row[$colemail ]) > 0) {
- $c->email = $row[$colemail ];
+ if (strlen($row[$colemail]) > 0) {
+ $c->email = $row[$colemail];
}
- if (strlen($row[$colcity ]) > 0) {
- $c->city = $row[$colcity ];
+ if (strlen($row[$colcity]) > 0) {
+ $c->city = $row[$colcity];
}
- if (strlen($row[$coladdress ]) > 0) {
- $c->address = $row[$coladdress ];
+ if (strlen($row[$coladdress]) > 0) {
+ $c->address = $row[$coladdress];
}
@@ -422,7 +414,7 @@ public function onCImport($sender) {
public function onNImport($sender) {
$store = $this->nform->nstore->getValue();
$c = $this->nform->ncust->getKey();
-
+
$preview = $this->nform->npreview->isChecked();
$passfirst = $this->nform->npassfirst->isChecked();
$this->_tvars['preview3'] = false;
@@ -433,7 +425,7 @@ public function onNImport($sender) {
$colqty = $this->nform->ncolqty->getValue();
$colprice = $this->nform->ncolprice->getValue();
$colmsr = $this->nform->ncolmsr->getValue();
-
+
if ($colname === '0') {
$this->setError('noselcolname');
@@ -457,30 +449,27 @@ public function onNImport($sender) {
}
$data = array();
- $oSpreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($file['tmp_name']); // Вариант и для xls и xlsX
-
-
- $oCells = $oSpreadsheet->getActiveSheet()->getCellCollection();
-
- for ($iRow = ($passfirst ? 2:1); $iRow <= $oCells->getHighestRow(); $iRow++)
- {
-
- $row = array();
- for ($iCol = 'A'; $iCol <= $oCells->getHighestColumn(); $iCol++)
- {
- $oCell = $oCells->get($iCol.$iRow);
- if($oCell)
- {
- $row[$iCol] = $oCell->getValue();
- }
-
- }
- $data[$iRow] = $row;
-
-
- }
-
- unset($oSpreadsheet);
+ $oSpreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($file['tmp_name']); // Вариант и для xls и xlsX
+
+
+ $oCells = $oSpreadsheet->getActiveSheet()->getCellCollection();
+
+ for ($iRow = ($passfirst ? 2 : 1); $iRow <= $oCells->getHighestRow(); $iRow++) {
+
+ $row = array();
+ for ($iCol = 'A'; $iCol <= $oCells->getHighestColumn(); $iCol++) {
+ $oCell = $oCells->get($iCol . $iRow);
+ if ($oCell) {
+ $row[$iCol] = $oCell->getValue();
+ }
+
+ }
+ $data[$iRow] = $row;
+
+
+ }
+
+ unset($oSpreadsheet);
if ($preview) {
@@ -489,11 +478,11 @@ public function onNImport($sender) {
foreach ($data as $row) {
$this->_tvars['list'][] = array(
- 'colname' => $row[$colname ],
- 'colcode' => $row[$colcode ],
- 'colqty' => $row[$colqty ],
- 'colmsr' => $row[$colmsr ],
- 'colprice' => $row[$colprice ]
+ 'colname' => $row[$colname],
+ 'colcode' => $row[$colcode],
+ 'colqty' => $row[$colqty],
+ 'colmsr' => $row[$colmsr],
+ 'colprice' => $row[$colprice]
);
}
return;
@@ -505,8 +494,8 @@ public function onNImport($sender) {
$item = null;
- $itemname = trim($row[$colname ]);
- $itemcode = trim($row[$colcode ]);
+ $itemname = trim($row[$colname]);
+ $itemcode = trim($row[$colcode]);
if (strlen($itemname) > 0) {
if (strlen($itemcode) > 0) {
@@ -516,17 +505,17 @@ public function onNImport($sender) {
$item = Item::getFirst('itemname=' . Item::qstr($itemname));
}
- $price = str_replace(',', '.', trim($row[$colprice ]));
- $qty = str_replace(',', '.', trim($row[$colqty ]));
+ $price = str_replace(',', '.', trim($row[$colprice]));
+ $qty = str_replace(',', '.', trim($row[$colqty]));
if ($item == null) {
$item = new Item();
$item->itemname = $itemname;
- if (strlen($row[$colcode ]) > 0) {
- $item->item_code = trim($row[$colcode ]);
+ if (strlen($row[$colcode]) > 0) {
+ $item->item_code = trim($row[$colcode]);
}
if (strlen($row[$colmsr - 1]) > 0) {
- $item->msr = trim($row[$colmsr ]);
+ $item->msr = trim($row[$colmsr]);
}
diff --git a/www/app/pages/userlogin.php b/www/app/pages/userlogin.php
index 8c54cd754..0d3dcaef2 100644
--- a/www/app/pages/userlogin.php
+++ b/www/app/pages/userlogin.php
@@ -17,7 +17,7 @@ public function __construct() {
global $_config;
$common = System::getOptions('common');
-
+ \App\Session::getSession()->clipboard = null;
$form = new \Zippy\Html\Form\Form('loginform');
$form->add(new TextInput('userlogin'));
@@ -31,7 +31,7 @@ public function __construct() {
$this->setError('');
- $curver = 'v4.8.1';
+ $curver = 'v4.8.2';
$this->_tvars['curversion'] = $curver;
//проверка новой версии
diff --git a/www/app/util.php b/www/app/util.php
index 0f7e82ddf..2bab0dbaf 100644
--- a/www/app/util.php
+++ b/www/app/util.php
@@ -4,6 +4,8 @@
use App\Helper as H;
use Symfony\Polyfill\Mbstring\Mbstring;
+use Symfony\Polyfill\Uuid\Uuid;
+
/**
* Класс со вспомагательными функциями
@@ -16,14 +18,10 @@ class Util
*/
public static function guid() {
- if (function_exists('com_create_guid') === true) {
- return trim(com_create_guid(), '{}');
- }
+ $uuid = Uuid::uuid_create(Uuid::UUID_TYPE_RANDOM);
+
+ return $uuid;
- $data = openssl_random_pseudo_bytes(16);
- $data[6] = chr(ord($data[6]) & 0x0f | 0x40); // set version to 0100
- $data[8] = chr(ord($data[8]) & 0x3f | 0x80); // set bits 6-7 to 10
- return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4));
}
diff --git a/www/app/widgets/docview.php b/www/app/widgets/docview.php
index 29eafa206..97bfe57ac 100644
--- a/www/app/widgets/docview.php
+++ b/www/app/widgets/docview.php
@@ -96,7 +96,7 @@ public function setDoc(\App\Entity\Doc\Document $doc) {
$html = $doc->generateReport();
$this->preview->setText($html, true);
$htmlpos = $doc->generatePosReport();
-
+
$this->previewpos->setText($htmlpos, true);
@@ -179,7 +179,7 @@ public function payListOnRow($row) {
//вывод строки проводок
public function itemListOnRow($row) {
$entry = $row->getDataItem();
- $stock = \App\Entity\Stock::load($entry->stock_id);;
+ $stock = \App\Entity\Stock::load($entry->stock_id);
$row->add(new Label('itname', $stock->itemname));
$row->add(new Label('itcode', $stock->item_code));
$row->add(new Label('itqty', H::fqty($entry->quantity)));
@@ -395,11 +395,11 @@ public function onTab($sender) {
$page->_tvars['isscan'] = $this->_doc->headerdata['scan'] > 0;
$page->_tvars['doctabpbadge'] = $sender->id == 'doctabp' ? "badge badge-dark badge-pill " : "badge badge-light badge-pill ";
- $page->_tvars['doctabcbadge'] = $sender->id == 'doctabc' ? "badge badge-dark badge-pill " : "badge badge-light badge-pill ";;
- $page->_tvars['doctabfbadge'] = $sender->id == 'doctabf' ? "badge badge-dark badge-pill " : "badge badge-light badge-pill ";;
- $page->_tvars['doctabdbadge'] = $sender->id == 'doctabd' ? "badge badge-dark badge-pill " : "badge badge-light badge-pill ";;
- $page->_tvars['doctabhbadge'] = $sender->id == 'doctabh' ? "badge badge-dark badge-pill " : "badge badge-light badge-pill ";;
- $page->_tvars['doctabsbadge'] = $sender->id == 'doctabs' ? "badge badge-dark badge-pill " : "badge badge-light badge-pill ";;
+ $page->_tvars['doctabcbadge'] = $sender->id == 'doctabc' ? "badge badge-dark badge-pill " : "badge badge-light badge-pill ";
+ $page->_tvars['doctabfbadge'] = $sender->id == 'doctabf' ? "badge badge-dark badge-pill " : "badge badge-light badge-pill ";
+ $page->_tvars['doctabdbadge'] = $sender->id == 'doctabd' ? "badge badge-dark badge-pill " : "badge badge-light badge-pill ";
+ $page->_tvars['doctabhbadge'] = $sender->id == 'doctabh' ? "badge badge-dark badge-pill " : "badge badge-light badge-pill ";
+ $page->_tvars['doctabsbadge'] = $sender->id == 'doctabs' ? "badge badge-dark badge-pill " : "badge badge-light badge-pill ";
$page->goDocView();
diff --git a/www/app/widgets/wdebitors.php b/www/app/widgets/wdebitors.php
index 7f8c01630..137a3780c 100644
--- a/www/app/widgets/wdebitors.php
+++ b/www/app/widgets/wdebitors.php
@@ -45,7 +45,7 @@ public function __construct($id) {
$list = $this->add(new DataView('ddoclist', new ArrayDataSource($data), $this, 'OnRow'));
$list->Reload();
- $list->setPageSize(10);
+ $list->setPageSize(Helper::getPG());
$this->add(new \Zippy\Html\DataList\Paginator("wdpag", $list));
$list->Reload();
if (count($data) == 0 || $visible == false) {
diff --git a/www/app/widgets/wminqty.php b/www/app/widgets/wminqty.php
index cc7daf26e..0bac84ccb 100644
--- a/www/app/widgets/wminqty.php
+++ b/www/app/widgets/wminqty.php
@@ -47,7 +47,7 @@ public function __construct($id) {
}
$mqlist = $this->add(new DataView('mqlist', new ArrayDataSource($this->data), $this, 'mqlistOnRow'));
- $mqlist->setPageSize(10);
+ $mqlist->setPageSize(Helper::getPG());
$this->add(new \Zippy\Html\DataList\Paginator("mqpag", $mqlist));
$mqlist->Reload();
diff --git a/www/app/widgets/wnoliq.php b/www/app/widgets/wnoliq.php
index 86fb55541..6bc27e3dc 100644
--- a/www/app/widgets/wnoliq.php
+++ b/www/app/widgets/wnoliq.php
@@ -30,10 +30,14 @@ public function __construct($id) {
$this->data = array();
- $sql = "select coalesce(sum(st.qty),0) as qty, st.itemname,st.item_code,st.storename from store_stock_view st where st.itemdisabled <> 1
+ $sql = "select coalesce(sum(st.qty),0) as qty, st.itemname,st.item_code,st.storename from store_stock_view st where st.itemdisabled <> 1 and st.qty >0
{$cstr} and st.stock_id not in(select stock_id
from entrylist_view
- where document_date >" . $conn->DBDate(strtotime('- 30 day')) . " and quantity < 0 )
+ where document_date >" . $conn->DBDate(strtotime('- 30 day')) . " and quantity < 0 )
+ and st.stock_id in(select stock_id
+ from entrylist_view
+ where document_date <" . $conn->DBDate(strtotime('- 30 day')) . " and quantity > 0 )
+
group by st.itemname,st.item_code,st.storename
";
@@ -46,7 +50,7 @@ public function __construct($id) {
}
$noliqlist = $this->add(new DataView('noliqlist', new ArrayDataSource($this->data), $this, 'noliqlistOnRow'));
- $noliqlist->setPageSize(10);
+ $noliqlist->setPageSize(Helper::getPG());
$this->add(new \Zippy\Html\DataList\Paginator("noliqpag", $noliqlist));
$noliqlist->Reload();
diff --git a/www/app/widgets/wopendocs.php b/www/app/widgets/wopendocs.php
index cc1699466..c541d5d77 100644
--- a/www/app/widgets/wopendocs.php
+++ b/www/app/widgets/wopendocs.php
@@ -31,7 +31,7 @@ public function __construct($id) {
}
$doclist = $this->add(new DataView('odoclist', new ArrayDataSource($data), $this, 'doclistOnRow'));
- $doclist->setPageSize(10);
+ $doclist->setPageSize(Helper::getPG());
$this->add(new \Zippy\Html\DataList\Paginator("odpag", $doclist));
$doclist->Reload();
diff --git a/www/app/widgets/wplanneddocs.php b/www/app/widgets/wplanneddocs.php
index d9c7ee085..542ed400f 100644
--- a/www/app/widgets/wplanneddocs.php
+++ b/www/app/widgets/wplanneddocs.php
@@ -4,6 +4,7 @@
use App\Entity\Doc\Document;
use App\System;
+use App\Helper;
use Zippy\Html\DataList\ArrayDataSource;
use Zippy\Html\DataList\DataView;
use Zippy\Html\Label;
@@ -33,7 +34,7 @@ public function __construct($id) {
}
$doclist = $this->add(new DataView('pdoclist', new ArrayDataSource($data), $this, 'doclistOnRow'));
- $doclist->setPageSize(10);
+ $doclist->setPageSize(Helper::getPG());
$this->add(new \Zippy\Html\DataList\Paginator("plpag", $doclist));
$doclist->Reload();
diff --git a/www/app/widgets/wrdoc.php b/www/app/widgets/wrdoc.php
index 5a649ead1..8e046a833 100644
--- a/www/app/widgets/wrdoc.php
+++ b/www/app/widgets/wrdoc.php
@@ -41,6 +41,8 @@ public function __construct($id) {
}
$doclist = $this->add(new DataView('rdoclist', new ArrayDataSource($data), $this, 'doclistOnRow'));
+ $doclist->setPageSize(Helper::getPG());
+ $this->add(new \Zippy\Html\DataList\Paginator("wrpag", $doclist));
$doclist->Reload();
diff --git a/www/app/widgets/wreserved.php b/www/app/widgets/wreserved.php
index f5a3e05c8..352044c32 100644
--- a/www/app/widgets/wreserved.php
+++ b/www/app/widgets/wreserved.php
@@ -44,7 +44,7 @@ public function __construct($id) {
}
$reslist = $this->add(new DataView('reslist', new ArrayDataSource($data), $this, 'reslistOnRow'));
- $reslist->setPageSize(10);
+ $reslist->setPageSize(Helper::getPG());
$this->add(new \Zippy\Html\DataList\Paginator("respag", $reslist));
$reslist->Reload();
diff --git a/www/app/widgets/wsdate.php b/www/app/widgets/wsdate.php
index 1a39aaf71..cd837a5ef 100644
--- a/www/app/widgets/wsdate.php
+++ b/www/app/widgets/wsdate.php
@@ -41,7 +41,7 @@ public function __construct($id) {
}
$sdlist = $this->add(new DataView('sdlist', new ArrayDataSource($data), $this, 'sdlistOnRow'));
- $sdlist->setPageSize(10);
+ $sdlist->setPageSize(Helper::getPG());
$this->add(new \Zippy\Html\DataList\Paginator("sdpag", $sdlist));
$sdlist->Reload();
diff --git a/www/app/widgets/wwaited.php b/www/app/widgets/wwaited.php
index bf4503fed..6dfb5ad9f 100644
--- a/www/app/widgets/wwaited.php
+++ b/www/app/widgets/wwaited.php
@@ -45,7 +45,7 @@ public function __construct($id) {
}
$waitlist = $this->add(new DataView('waitlist', new ArrayDataSource($data), $this, 'waitlistOnRow'));
- $waitlist->setPageSize(10);
+ $waitlist->setPageSize(Helper::getPG());
$this->add(new \Zippy\Html\DataList\Paginator("waitpag", $waitlist));
$waitlist->Reload();
diff --git a/www/assets/css/app.css b/www/assets/css/app.css
index e777efa14..ce153fd61 100644
--- a/www/assets/css/app.css
+++ b/www/assets/css/app.css
@@ -1,5 +1,5 @@
body {
- font-family: "Arial", "Helvetica Neue";
+ font-family: "Roboto", "Helvetica Neue";
background-color: #FaFaFa;
}
@@ -108,4 +108,7 @@ body {
.text-smaller{
font-size:smaller ;
}
+table {
+ font-family: "Arial"
+}
\ No newline at end of file
diff --git a/www/assets/js/adminlte.js b/www/assets/js/adminlte.js
index 72a615aae..5b7dcb2a3 100644
--- a/www/assets/js/adminlte.js
+++ b/www/assets/js/adminlte.js
@@ -1,1891 +1,2728 @@
/*!
- * AdminLTE v3.0.6-pre (https://adminlte.io)
- * Copyright 2014-2020 Colorlib
+ * AdminLTE v3.1.0-rc (https://adminlte.io)
+ * Copyright 2014-2020 Colorlib
* Licensed under MIT (https://github.com/ColorlibHQ/AdminLTE/blob/master/LICENSE)
*/
(function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
- typeof define === 'function' && define.amd ? define(['exports'], factory) :
- (global = global || self, factory(global.adminlte = {}));
-}(this, (function (exports) { 'use strict';
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('jquery')) :
+ typeof define === 'function' && define.amd ? define(['exports', 'jquery'], factory) :
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.adminlte = {}, global.jQuery));
+}(this, (function (exports, $) { 'use strict';
+
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
+
+ var $__default = /*#__PURE__*/_interopDefaultLegacy($);
/**
* --------------------------------------------
- * AdminLTE ControlSidebar.js
+ * AdminLTE CardRefresh.js
+ * License MIT
+ * --------------------------------------------
+ */
+ /**
+ * Constants
+ * ====================================================
+ */
+
+ var NAME = 'CardRefresh';
+ var DATA_KEY = 'lte.cardrefresh';
+ var EVENT_KEY = "." + DATA_KEY;
+ var JQUERY_NO_CONFLICT = $__default['default'].fn[NAME];
+ var EVENT_LOADED = "loaded" + EVENT_KEY;
+ var EVENT_OVERLAY_ADDED = "overlay.added" + EVENT_KEY;
+ var EVENT_OVERLAY_REMOVED = "overlay.removed" + EVENT_KEY;
+ var CLASS_NAME_CARD = 'card';
+ var SELECTOR_CARD = "." + CLASS_NAME_CARD;
+ var SELECTOR_DATA_REFRESH = '[data-card-widget="card-refresh"]';
+ var Default = {
+ source: '',
+ sourceSelector: '',
+ params: {},
+ trigger: SELECTOR_DATA_REFRESH,
+ content: '.card-body',
+ loadInContent: true,
+ loadOnInit: true,
+ responseType: '',
+ overlayTemplate: '
',
+ onLoadStart: function onLoadStart() {},
+ onLoadDone: function onLoadDone(response) {
+ return response;
+ }
+ };
+
+ var CardRefresh = /*#__PURE__*/function () {
+ function CardRefresh(element, settings) {
+ this._element = element;
+ this._parent = element.parents(SELECTOR_CARD).first();
+ this._settings = $__default['default'].extend({}, Default, settings);
+ this._overlay = $__default['default'](this._settings.overlayTemplate);
+
+ if (element.hasClass(CLASS_NAME_CARD)) {
+ this._parent = element;
+ }
+
+ if (this._settings.source === '') {
+ throw new Error('Source url was not defined. Please specify a url in your CardRefresh source option.');
+ }
+ }
+
+ var _proto = CardRefresh.prototype;
+
+ _proto.load = function load() {
+ var _this = this;
+
+ this._addOverlay();
+
+ this._settings.onLoadStart.call($__default['default'](this));
+
+ $__default['default'].get(this._settings.source, this._settings.params, function (response) {
+ if (_this._settings.loadInContent) {
+ if (_this._settings.sourceSelector !== '') {
+ response = $__default['default'](response).find(_this._settings.sourceSelector).html();
+ }
+
+ _this._parent.find(_this._settings.content).html(response);
+ }
+
+ _this._settings.onLoadDone.call($__default['default'](_this), response);
+
+ _this._removeOverlay();
+ }, this._settings.responseType !== '' && this._settings.responseType);
+ $__default['default'](this._element).trigger($__default['default'].Event(EVENT_LOADED));
+ };
+
+ _proto._addOverlay = function _addOverlay() {
+ this._parent.append(this._overlay);
+
+ $__default['default'](this._element).trigger($__default['default'].Event(EVENT_OVERLAY_ADDED));
+ };
+
+ _proto._removeOverlay = function _removeOverlay() {
+ this._parent.find(this._overlay).remove();
+
+ $__default['default'](this._element).trigger($__default['default'].Event(EVENT_OVERLAY_REMOVED));
+ } // Private
+ ;
+
+ _proto._init = function _init() {
+ var _this2 = this;
+
+ $__default['default'](this).find(this._settings.trigger).on('click', function () {
+ _this2.load();
+ });
+
+ if (this._settings.loadOnInit) {
+ this.load();
+ }
+ } // Static
+ ;
+
+ CardRefresh._jQueryInterface = function _jQueryInterface(config) {
+ var data = $__default['default'](this).data(DATA_KEY);
+
+ var _options = $__default['default'].extend({}, Default, $__default['default'](this).data());
+
+ if (!data) {
+ data = new CardRefresh($__default['default'](this), _options);
+ $__default['default'](this).data(DATA_KEY, typeof config === 'string' ? data : config);
+ }
+
+ if (typeof config === 'string' && config.match(/load/)) {
+ data[config]();
+ } else {
+ data._init($__default['default'](this));
+ }
+ };
+
+ return CardRefresh;
+ }();
+ /**
+ * Data API
+ * ====================================================
+ */
+
+
+ $__default['default'](document).on('click', SELECTOR_DATA_REFRESH, function (event) {
+ if (event) {
+ event.preventDefault();
+ }
+
+ CardRefresh._jQueryInterface.call($__default['default'](this), 'load');
+ });
+ $__default['default'](function () {
+ $__default['default'](SELECTOR_DATA_REFRESH).each(function () {
+ CardRefresh._jQueryInterface.call($__default['default'](this));
+ });
+ });
+ /**
+ * jQuery API
+ * ====================================================
+ */
+
+ $__default['default'].fn[NAME] = CardRefresh._jQueryInterface;
+ $__default['default'].fn[NAME].Constructor = CardRefresh;
+
+ $__default['default'].fn[NAME].noConflict = function () {
+ $__default['default'].fn[NAME] = JQUERY_NO_CONFLICT;
+ return CardRefresh._jQueryInterface;
+ };
+
+ /**
+ * --------------------------------------------
+ * AdminLTE CardWidget.js
* License MIT
* --------------------------------------------
*/
- var ControlSidebar = function ($) {
- /**
- * Constants
- * ====================================================
- */
- var NAME = 'ControlSidebar';
- var DATA_KEY = 'lte.controlsidebar';
- var EVENT_KEY = "." + DATA_KEY;
- var JQUERY_NO_CONFLICT = $.fn[NAME];
- var Event = {
- COLLAPSED: "collapsed" + EVENT_KEY,
- EXPANDED: "expanded" + EVENT_KEY
+ /**
+ * Constants
+ * ====================================================
+ */
+
+ var NAME$1 = 'CardWidget';
+ var DATA_KEY$1 = 'lte.cardwidget';
+ var EVENT_KEY$1 = "." + DATA_KEY$1;
+ var JQUERY_NO_CONFLICT$1 = $__default['default'].fn[NAME$1];
+ var EVENT_EXPANDED = "expanded" + EVENT_KEY$1;
+ var EVENT_COLLAPSED = "collapsed" + EVENT_KEY$1;
+ var EVENT_MAXIMIZED = "maximized" + EVENT_KEY$1;
+ var EVENT_MINIMIZED = "minimized" + EVENT_KEY$1;
+ var EVENT_REMOVED = "removed" + EVENT_KEY$1;
+ var CLASS_NAME_CARD$1 = 'card';
+ var CLASS_NAME_COLLAPSED = 'collapsed-card';
+ var CLASS_NAME_COLLAPSING = 'collapsing-card';
+ var CLASS_NAME_EXPANDING = 'expanding-card';
+ var CLASS_NAME_WAS_COLLAPSED = 'was-collapsed';
+ var CLASS_NAME_MAXIMIZED = 'maximized-card';
+ var SELECTOR_DATA_REMOVE = '[data-card-widget="remove"]';
+ var SELECTOR_DATA_COLLAPSE = '[data-card-widget="collapse"]';
+ var SELECTOR_DATA_MAXIMIZE = '[data-card-widget="maximize"]';
+ var SELECTOR_CARD$1 = "." + CLASS_NAME_CARD$1;
+ var SELECTOR_CARD_HEADER = '.card-header';
+ var SELECTOR_CARD_BODY = '.card-body';
+ var SELECTOR_CARD_FOOTER = '.card-footer';
+ var Default$1 = {
+ animationSpeed: 'normal',
+ collapseTrigger: SELECTOR_DATA_COLLAPSE,
+ removeTrigger: SELECTOR_DATA_REMOVE,
+ maximizeTrigger: SELECTOR_DATA_MAXIMIZE,
+ collapseIcon: 'fa-minus',
+ expandIcon: 'fa-plus',
+ maximizeIcon: 'fa-expand',
+ minimizeIcon: 'fa-compress'
+ };
+
+ var CardWidget = /*#__PURE__*/function () {
+ function CardWidget(element, settings) {
+ this._element = element;
+ this._parent = element.parents(SELECTOR_CARD$1).first();
+
+ if (element.hasClass(CLASS_NAME_CARD$1)) {
+ this._parent = element;
+ }
+
+ this._settings = $__default['default'].extend({}, Default$1, settings);
+ }
+
+ var _proto = CardWidget.prototype;
+
+ _proto.collapse = function collapse() {
+ var _this = this;
+
+ this._parent.addClass(CLASS_NAME_COLLAPSING).children(SELECTOR_CARD_BODY + ", " + SELECTOR_CARD_FOOTER).slideUp(this._settings.animationSpeed, function () {
+ _this._parent.addClass(CLASS_NAME_COLLAPSED).removeClass(CLASS_NAME_COLLAPSING);
+ });
+
+ this._parent.find("> " + SELECTOR_CARD_HEADER + " " + this._settings.collapseTrigger + " ." + this._settings.collapseIcon).addClass(this._settings.expandIcon).removeClass(this._settings.collapseIcon);
+
+ this._element.trigger($__default['default'].Event(EVENT_COLLAPSED), this._parent);
};
- var Selector = {
- CONTROL_SIDEBAR: '.control-sidebar',
- CONTROL_SIDEBAR_CONTENT: '.control-sidebar-content',
- DATA_TOGGLE: '[data-widget="control-sidebar"]',
- CONTENT: '.content-wrapper',
- HEADER: '.main-header',
- FOOTER: '.main-footer'
+
+ _proto.expand = function expand() {
+ var _this2 = this;
+
+ this._parent.addClass(CLASS_NAME_EXPANDING).children(SELECTOR_CARD_BODY + ", " + SELECTOR_CARD_FOOTER).slideDown(this._settings.animationSpeed, function () {
+ _this2._parent.removeClass(CLASS_NAME_COLLAPSED).removeClass(CLASS_NAME_EXPANDING);
+ });
+
+ this._parent.find("> " + SELECTOR_CARD_HEADER + " " + this._settings.collapseTrigger + " ." + this._settings.expandIcon).addClass(this._settings.collapseIcon).removeClass(this._settings.expandIcon);
+
+ this._element.trigger($__default['default'].Event(EVENT_EXPANDED), this._parent);
};
- var ClassName = {
- CONTROL_SIDEBAR_ANIMATE: 'control-sidebar-animate',
- CONTROL_SIDEBAR_OPEN: 'control-sidebar-open',
- CONTROL_SIDEBAR_SLIDE: 'control-sidebar-slide-open',
- LAYOUT_FIXED: 'layout-fixed',
- NAVBAR_FIXED: 'layout-navbar-fixed',
- NAVBAR_SM_FIXED: 'layout-sm-navbar-fixed',
- NAVBAR_MD_FIXED: 'layout-md-navbar-fixed',
- NAVBAR_LG_FIXED: 'layout-lg-navbar-fixed',
- NAVBAR_XL_FIXED: 'layout-xl-navbar-fixed',
- FOOTER_FIXED: 'layout-footer-fixed',
- FOOTER_SM_FIXED: 'layout-sm-footer-fixed',
- FOOTER_MD_FIXED: 'layout-md-footer-fixed',
- FOOTER_LG_FIXED: 'layout-lg-footer-fixed',
- FOOTER_XL_FIXED: 'layout-xl-footer-fixed'
+
+ _proto.remove = function remove() {
+ this._parent.slideUp();
+
+ this._element.trigger($__default['default'].Event(EVENT_REMOVED), this._parent);
};
- var Default = {
- controlsidebarSlide: true,
- scrollbarTheme: 'os-theme-light',
- scrollbarAutoHide: 'l'
+
+ _proto.toggle = function toggle() {
+ if (this._parent.hasClass(CLASS_NAME_COLLAPSED)) {
+ this.expand();
+ return;
+ }
+
+ this.collapse();
};
- /**
- * Class Definition
- * ====================================================
- */
-
- var ControlSidebar = /*#__PURE__*/function () {
- function ControlSidebar(element, config) {
- this._element = element;
- this._config = config;
-
- this._init();
- } // Public
-
-
- var _proto = ControlSidebar.prototype;
-
- _proto.collapse = function collapse() {
- // Show the control sidebar
- if (this._config.controlsidebarSlide) {
- $('html').addClass(ClassName.CONTROL_SIDEBAR_ANIMATE);
- $('body').removeClass(ClassName.CONTROL_SIDEBAR_SLIDE).delay(300).queue(function () {
- $(Selector.CONTROL_SIDEBAR).hide();
- $('html').removeClass(ClassName.CONTROL_SIDEBAR_ANIMATE);
- $(this).dequeue();
- });
- } else {
- $('body').removeClass(ClassName.CONTROL_SIDEBAR_OPEN);
+
+ _proto.maximize = function maximize() {
+ this._parent.find(this._settings.maximizeTrigger + " ." + this._settings.maximizeIcon).addClass(this._settings.minimizeIcon).removeClass(this._settings.maximizeIcon);
+
+ this._parent.css({
+ height: this._parent.height(),
+ width: this._parent.width(),
+ transition: 'all .15s'
+ }).delay(150).queue(function () {
+ var $element = $__default['default'](this);
+ $element.addClass(CLASS_NAME_MAXIMIZED);
+ $__default['default']('html').addClass(CLASS_NAME_MAXIMIZED);
+
+ if ($element.hasClass(CLASS_NAME_COLLAPSED)) {
+ $element.addClass(CLASS_NAME_WAS_COLLAPSED);
}
- var collapsedEvent = $.Event(Event.COLLAPSED);
- $(this._element).trigger(collapsedEvent);
- };
+ $element.dequeue();
+ });
+
+ this._element.trigger($__default['default'].Event(EVENT_MAXIMIZED), this._parent);
+ };
+
+ _proto.minimize = function minimize() {
+ this._parent.find(this._settings.maximizeTrigger + " ." + this._settings.minimizeIcon).addClass(this._settings.maximizeIcon).removeClass(this._settings.minimizeIcon);
- _proto.show = function show() {
- // Collapse the control sidebar
- if (this._config.controlsidebarSlide) {
- $('html').addClass(ClassName.CONTROL_SIDEBAR_ANIMATE);
- $(Selector.CONTROL_SIDEBAR).show().delay(10).queue(function () {
- $('body').addClass(ClassName.CONTROL_SIDEBAR_SLIDE).delay(300).queue(function () {
- $('html').removeClass(ClassName.CONTROL_SIDEBAR_ANIMATE);
- $(this).dequeue();
- });
- $(this).dequeue();
+ this._parent.css('cssText', "height: " + this._parent[0].style.height + " !important; width: " + this._parent[0].style.width + " !important; transition: all .15s;").delay(10).queue(function () {
+ var $element = $__default['default'](this);
+ $element.removeClass(CLASS_NAME_MAXIMIZED);
+ $__default['default']('html').removeClass(CLASS_NAME_MAXIMIZED);
+ $element.css({
+ height: 'inherit',
+ width: 'inherit'
+ });
+
+ if ($element.hasClass(CLASS_NAME_WAS_COLLAPSED)) {
+ $element.removeClass(CLASS_NAME_WAS_COLLAPSED);
+ }
+
+ $element.dequeue();
+ });
+
+ this._element.trigger($__default['default'].Event(EVENT_MINIMIZED), this._parent);
+ };
+
+ _proto.toggleMaximize = function toggleMaximize() {
+ if (this._parent.hasClass(CLASS_NAME_MAXIMIZED)) {
+ this.minimize();
+ return;
+ }
+
+ this.maximize();
+ } // Private
+ ;
+
+ _proto._init = function _init(card) {
+ var _this3 = this;
+
+ this._parent = card;
+ $__default['default'](this).find(this._settings.collapseTrigger).click(function () {
+ _this3.toggle();
+ });
+ $__default['default'](this).find(this._settings.maximizeTrigger).click(function () {
+ _this3.toggleMaximize();
+ });
+ $__default['default'](this).find(this._settings.removeTrigger).click(function () {
+ _this3.remove();
+ });
+ } // Static
+ ;
+
+ CardWidget._jQueryInterface = function _jQueryInterface(config) {
+ var data = $__default['default'](this).data(DATA_KEY$1);
+
+ var _options = $__default['default'].extend({}, Default$1, $__default['default'](this).data());
+
+ if (!data) {
+ data = new CardWidget($__default['default'](this), _options);
+ $__default['default'](this).data(DATA_KEY$1, typeof config === 'string' ? data : config);
+ }
+
+ if (typeof config === 'string' && config.match(/collapse|expand|remove|toggle|maximize|minimize|toggleMaximize/)) {
+ data[config]();
+ } else if (typeof config === 'object') {
+ data._init($__default['default'](this));
+ }
+ };
+
+ return CardWidget;
+ }();
+ /**
+ * Data API
+ * ====================================================
+ */
+
+
+ $__default['default'](document).on('click', SELECTOR_DATA_COLLAPSE, function (event) {
+ if (event) {
+ event.preventDefault();
+ }
+
+ CardWidget._jQueryInterface.call($__default['default'](this), 'toggle');
+ });
+ $__default['default'](document).on('click', SELECTOR_DATA_REMOVE, function (event) {
+ if (event) {
+ event.preventDefault();
+ }
+
+ CardWidget._jQueryInterface.call($__default['default'](this), 'remove');
+ });
+ $__default['default'](document).on('click', SELECTOR_DATA_MAXIMIZE, function (event) {
+ if (event) {
+ event.preventDefault();
+ }
+
+ CardWidget._jQueryInterface.call($__default['default'](this), 'toggleMaximize');
+ });
+ /**
+ * jQuery API
+ * ====================================================
+ */
+
+ $__default['default'].fn[NAME$1] = CardWidget._jQueryInterface;
+ $__default['default'].fn[NAME$1].Constructor = CardWidget;
+
+ $__default['default'].fn[NAME$1].noConflict = function () {
+ $__default['default'].fn[NAME$1] = JQUERY_NO_CONFLICT$1;
+ return CardWidget._jQueryInterface;
+ };
+
+ /**
+ * --------------------------------------------
+ * AdminLTE ControlSidebar.js
+ * License MIT
+ * --------------------------------------------
+ */
+ /**
+ * Constants
+ * ====================================================
+ */
+
+ var NAME$2 = 'ControlSidebar';
+ var DATA_KEY$2 = 'lte.controlsidebar';
+ var EVENT_KEY$2 = "." + DATA_KEY$2;
+ var JQUERY_NO_CONFLICT$2 = $__default['default'].fn[NAME$2];
+ var EVENT_COLLAPSED$1 = "collapsed" + EVENT_KEY$2;
+ var EVENT_EXPANDED$1 = "expanded" + EVENT_KEY$2;
+ var SELECTOR_CONTROL_SIDEBAR = '.control-sidebar';
+ var SELECTOR_CONTROL_SIDEBAR_CONTENT = '.control-sidebar-content';
+ var SELECTOR_DATA_TOGGLE = '[data-widget="control-sidebar"]';
+ var SELECTOR_HEADER = '.main-header';
+ var SELECTOR_FOOTER = '.main-footer';
+ var CLASS_NAME_CONTROL_SIDEBAR_ANIMATE = 'control-sidebar-animate';
+ var CLASS_NAME_CONTROL_SIDEBAR_OPEN = 'control-sidebar-open';
+ var CLASS_NAME_CONTROL_SIDEBAR_SLIDE = 'control-sidebar-slide-open';
+ var CLASS_NAME_LAYOUT_FIXED = 'layout-fixed';
+ var CLASS_NAME_NAVBAR_FIXED = 'layout-navbar-fixed';
+ var CLASS_NAME_NAVBAR_SM_FIXED = 'layout-sm-navbar-fixed';
+ var CLASS_NAME_NAVBAR_MD_FIXED = 'layout-md-navbar-fixed';
+ var CLASS_NAME_NAVBAR_LG_FIXED = 'layout-lg-navbar-fixed';
+ var CLASS_NAME_NAVBAR_XL_FIXED = 'layout-xl-navbar-fixed';
+ var CLASS_NAME_FOOTER_FIXED = 'layout-footer-fixed';
+ var CLASS_NAME_FOOTER_SM_FIXED = 'layout-sm-footer-fixed';
+ var CLASS_NAME_FOOTER_MD_FIXED = 'layout-md-footer-fixed';
+ var CLASS_NAME_FOOTER_LG_FIXED = 'layout-lg-footer-fixed';
+ var CLASS_NAME_FOOTER_XL_FIXED = 'layout-xl-footer-fixed';
+ var Default$2 = {
+ controlsidebarSlide: true,
+ scrollbarTheme: 'os-theme-light',
+ scrollbarAutoHide: 'l'
+ };
+ /**
+ * Class Definition
+ * ====================================================
+ */
+
+ var ControlSidebar = /*#__PURE__*/function () {
+ function ControlSidebar(element, config) {
+ this._element = element;
+ this._config = config;
+
+ this._init();
+ } // Public
+
+
+ var _proto = ControlSidebar.prototype;
+
+ _proto.collapse = function collapse() {
+ var $body = $__default['default']('body');
+ var $html = $__default['default']('html'); // Show the control sidebar
+
+ if (this._config.controlsidebarSlide) {
+ $html.addClass(CLASS_NAME_CONTROL_SIDEBAR_ANIMATE);
+ $body.removeClass(CLASS_NAME_CONTROL_SIDEBAR_SLIDE).delay(300).queue(function () {
+ $__default['default'](SELECTOR_CONTROL_SIDEBAR).hide();
+ $html.removeClass(CLASS_NAME_CONTROL_SIDEBAR_ANIMATE);
+ $__default['default'](this).dequeue();
+ });
+ } else {
+ $body.removeClass(CLASS_NAME_CONTROL_SIDEBAR_OPEN);
+ }
+
+ $__default['default'](this._element).trigger($__default['default'].Event(EVENT_COLLAPSED$1));
+ };
+
+ _proto.show = function show() {
+ var $body = $__default['default']('body');
+ var $html = $__default['default']('html'); // Collapse the control sidebar
+
+ if (this._config.controlsidebarSlide) {
+ $html.addClass(CLASS_NAME_CONTROL_SIDEBAR_ANIMATE);
+ $__default['default'](SELECTOR_CONTROL_SIDEBAR).show().delay(10).queue(function () {
+ $body.addClass(CLASS_NAME_CONTROL_SIDEBAR_SLIDE).delay(300).queue(function () {
+ $html.removeClass(CLASS_NAME_CONTROL_SIDEBAR_ANIMATE);
+ $__default['default'](this).dequeue();
});
- } else {
- $('body').addClass(ClassName.CONTROL_SIDEBAR_OPEN);
+ $__default['default'](this).dequeue();
+ });
+ } else {
+ $body.addClass(CLASS_NAME_CONTROL_SIDEBAR_OPEN);
+ }
+
+ this._fixHeight();
+
+ this._fixScrollHeight();
+
+ $__default['default'](this._element).trigger($__default['default'].Event(EVENT_EXPANDED$1));
+ };
+
+ _proto.toggle = function toggle() {
+ var $body = $__default['default']('body');
+ var shouldClose = $body.hasClass(CLASS_NAME_CONTROL_SIDEBAR_OPEN) || $body.hasClass(CLASS_NAME_CONTROL_SIDEBAR_SLIDE);
+
+ if (shouldClose) {
+ // Close the control sidebar
+ this.collapse();
+ } else {
+ // Open the control sidebar
+ this.show();
+ }
+ } // Private
+ ;
+
+ _proto._init = function _init() {
+ var _this = this;
+
+ this._fixHeight();
+
+ this._fixScrollHeight();
+
+ $__default['default'](window).resize(function () {
+ _this._fixHeight();
+
+ _this._fixScrollHeight();
+ });
+ $__default['default'](window).scroll(function () {
+ var $body = $__default['default']('body');
+ var shouldFixHeight = $body.hasClass(CLASS_NAME_CONTROL_SIDEBAR_OPEN) || $body.hasClass(CLASS_NAME_CONTROL_SIDEBAR_SLIDE);
+
+ if (shouldFixHeight) {
+ _this._fixScrollHeight();
}
+ });
+ };
- var expandedEvent = $.Event(Event.EXPANDED);
- $(this._element).trigger(expandedEvent);
- };
+ _proto._fixScrollHeight = function _fixScrollHeight() {
+ var $body = $__default['default']('body');
- _proto.toggle = function toggle() {
- var shouldClose = $('body').hasClass(ClassName.CONTROL_SIDEBAR_OPEN) || $('body').hasClass(ClassName.CONTROL_SIDEBAR_SLIDE);
+ if (!$body.hasClass(CLASS_NAME_LAYOUT_FIXED)) {
+ return;
+ }
- if (shouldClose) {
- // Close the control sidebar
- this.collapse();
+ var heights = {
+ scroll: $__default['default'](document).height(),
+ window: $__default['default'](window).height(),
+ header: $__default['default'](SELECTOR_HEADER).outerHeight(),
+ footer: $__default['default'](SELECTOR_FOOTER).outerHeight()
+ };
+ var positions = {
+ bottom: Math.abs(heights.window + $__default['default'](window).scrollTop() - heights.scroll),
+ top: $__default['default'](window).scrollTop()
+ };
+ var navbarFixed = ($body.hasClass(CLASS_NAME_NAVBAR_FIXED) || $body.hasClass(CLASS_NAME_NAVBAR_SM_FIXED) || $body.hasClass(CLASS_NAME_NAVBAR_MD_FIXED) || $body.hasClass(CLASS_NAME_NAVBAR_LG_FIXED) || $body.hasClass(CLASS_NAME_NAVBAR_XL_FIXED)) && $__default['default'](SELECTOR_HEADER).css('position') === 'fixed';
+ var footerFixed = ($body.hasClass(CLASS_NAME_FOOTER_FIXED) || $body.hasClass(CLASS_NAME_FOOTER_SM_FIXED) || $body.hasClass(CLASS_NAME_FOOTER_MD_FIXED) || $body.hasClass(CLASS_NAME_FOOTER_LG_FIXED) || $body.hasClass(CLASS_NAME_FOOTER_XL_FIXED)) && $__default['default'](SELECTOR_FOOTER).css('position') === 'fixed';
+ var $controlSidebar = $__default['default'](SELECTOR_CONTROL_SIDEBAR);
+ var $controlsidebarContent = $__default['default'](SELECTOR_CONTROL_SIDEBAR + ", " + SELECTOR_CONTROL_SIDEBAR + " " + SELECTOR_CONTROL_SIDEBAR_CONTENT);
+
+ if (positions.top === 0 && positions.bottom === 0) {
+ $controlSidebar.css({
+ bottom: heights.footer,
+ top: heights.header
+ });
+ $controlsidebarContent.css('height', heights.window - (heights.header + heights.footer));
+ } else if (positions.bottom <= heights.footer) {
+ if (footerFixed === false) {
+ var top = heights.header - positions.top;
+ $controlSidebar.css('bottom', heights.footer - positions.bottom).css('top', top >= 0 ? top : 0);
+ $controlsidebarContent.css('height', heights.window - (heights.footer - positions.bottom));
+ } else {
+ $controlSidebar.css('bottom', heights.footer);
+ }
+ } else if (positions.top <= heights.header) {
+ if (navbarFixed === false) {
+ $controlSidebar.css('top', heights.header - positions.top);
+ $controlsidebarContent.css('height', heights.window - (heights.header - positions.top));
} else {
- // Open the control sidebar
- this.show();
+ $controlSidebar.css('top', heights.header);
}
- } // Private
- ;
+ } else if (navbarFixed === false) {
+ $controlSidebar.css('top', 0);
+ $controlsidebarContent.css('height', heights.window);
+ } else {
+ $controlSidebar.css('top', heights.header);
+ }
+ };
- _proto._init = function _init() {
- var _this = this;
+ _proto._fixHeight = function _fixHeight() {
+ var $body = $__default['default']('body');
- this._fixHeight();
+ if (!$body.hasClass(CLASS_NAME_LAYOUT_FIXED)) {
+ return;
+ }
- this._fixScrollHeight();
+ var heights = {
+ window: $__default['default'](window).height(),
+ header: $__default['default'](SELECTOR_HEADER).outerHeight(),
+ footer: $__default['default'](SELECTOR_FOOTER).outerHeight()
+ };
+ var sidebarHeight = heights.window - heights.header;
- $(window).resize(function () {
- _this._fixHeight();
+ if ($body.hasClass(CLASS_NAME_FOOTER_FIXED) || $body.hasClass(CLASS_NAME_FOOTER_SM_FIXED) || $body.hasClass(CLASS_NAME_FOOTER_MD_FIXED) || $body.hasClass(CLASS_NAME_FOOTER_LG_FIXED) || $body.hasClass(CLASS_NAME_FOOTER_XL_FIXED)) {
+ if ($__default['default'](SELECTOR_FOOTER).css('position') === 'fixed') {
+ sidebarHeight = heights.window - heights.header - heights.footer;
+ }
+ }
- _this._fixScrollHeight();
- });
- $(window).scroll(function () {
- if ($('body').hasClass(ClassName.CONTROL_SIDEBAR_OPEN) || $('body').hasClass(ClassName.CONTROL_SIDEBAR_SLIDE)) {
- _this._fixScrollHeight();
+ var $controlSidebar = $__default['default'](SELECTOR_CONTROL_SIDEBAR + " " + SELECTOR_CONTROL_SIDEBAR_CONTENT);
+ $controlSidebar.css('height', sidebarHeight);
+
+ if (typeof $__default['default'].fn.overlayScrollbars !== 'undefined') {
+ $controlSidebar.overlayScrollbars({
+ className: this._config.scrollbarTheme,
+ sizeAutoCapable: true,
+ scrollbars: {
+ autoHide: this._config.scrollbarAutoHide,
+ clickScrolling: true
}
});
- };
+ }
+ } // Static
+ ;
- _proto._fixScrollHeight = function _fixScrollHeight() {
- var heights = {
- scroll: $(document).height(),
- window: $(window).height(),
- header: $(Selector.HEADER).outerHeight(),
- footer: $(Selector.FOOTER).outerHeight()
- };
- var positions = {
- bottom: Math.abs(heights.window + $(window).scrollTop() - heights.scroll),
- top: $(window).scrollTop()
- };
- var navbarFixed = false;
- var footerFixed = false;
-
- if ($('body').hasClass(ClassName.LAYOUT_FIXED)) {
- if ($('body').hasClass(ClassName.NAVBAR_FIXED) || $('body').hasClass(ClassName.NAVBAR_SM_FIXED) || $('body').hasClass(ClassName.NAVBAR_MD_FIXED) || $('body').hasClass(ClassName.NAVBAR_LG_FIXED) || $('body').hasClass(ClassName.NAVBAR_XL_FIXED)) {
- if ($(Selector.HEADER).css("position") === "fixed") {
- navbarFixed = true;
- }
- }
+ ControlSidebar._jQueryInterface = function _jQueryInterface(operation) {
+ return this.each(function () {
+ var data = $__default['default'](this).data(DATA_KEY$2);
- if ($('body').hasClass(ClassName.FOOTER_FIXED) || $('body').hasClass(ClassName.FOOTER_SM_FIXED) || $('body').hasClass(ClassName.FOOTER_MD_FIXED) || $('body').hasClass(ClassName.FOOTER_LG_FIXED) || $('body').hasClass(ClassName.FOOTER_XL_FIXED)) {
- if ($(Selector.FOOTER).css("position") === "fixed") {
- footerFixed = true;
- }
- }
+ var _options = $__default['default'].extend({}, Default$2, $__default['default'](this).data());
- if (positions.top === 0 && positions.bottom === 0) {
- $(Selector.CONTROL_SIDEBAR).css('bottom', heights.footer);
- $(Selector.CONTROL_SIDEBAR).css('top', heights.header);
- $(Selector.CONTROL_SIDEBAR + ', ' + Selector.CONTROL_SIDEBAR + ' ' + Selector.CONTROL_SIDEBAR_CONTENT).css('height', heights.window - (heights.header + heights.footer));
- } else if (positions.bottom <= heights.footer) {
- if (footerFixed === false) {
- $(Selector.CONTROL_SIDEBAR).css('bottom', heights.footer - positions.bottom);
- $(Selector.CONTROL_SIDEBAR + ', ' + Selector.CONTROL_SIDEBAR + ' ' + Selector.CONTROL_SIDEBAR_CONTENT).css('height', heights.window - (heights.footer - positions.bottom));
- } else {
- $(Selector.CONTROL_SIDEBAR).css('bottom', heights.footer);
- }
- } else if (positions.top <= heights.header) {
- if (navbarFixed === false) {
- $(Selector.CONTROL_SIDEBAR).css('top', heights.header - positions.top);
- $(Selector.CONTROL_SIDEBAR + ', ' + Selector.CONTROL_SIDEBAR + ' ' + Selector.CONTROL_SIDEBAR_CONTENT).css('height', heights.window - (heights.header - positions.top));
- } else {
- $(Selector.CONTROL_SIDEBAR).css('top', heights.header);
- }
- } else {
- if (navbarFixed === false) {
- $(Selector.CONTROL_SIDEBAR).css('top', 0);
- $(Selector.CONTROL_SIDEBAR + ', ' + Selector.CONTROL_SIDEBAR + ' ' + Selector.CONTROL_SIDEBAR_CONTENT).css('height', heights.window);
- } else {
- $(Selector.CONTROL_SIDEBAR).css('top', heights.header);
- }
- }
+ if (!data) {
+ data = new ControlSidebar(this, _options);
+ $__default['default'](this).data(DATA_KEY$2, data);
}
- };
- _proto._fixHeight = function _fixHeight() {
- var heights = {
- window: $(window).height(),
- header: $(Selector.HEADER).outerHeight(),
- footer: $(Selector.FOOTER).outerHeight()
- };
+ if (data[operation] === 'undefined') {
+ throw new Error(operation + " is not a function");
+ }
- if ($('body').hasClass(ClassName.LAYOUT_FIXED)) {
- var sidebarHeight = heights.window - heights.header;
+ data[operation]();
+ });
+ };
- if ($('body').hasClass(ClassName.FOOTER_FIXED) || $('body').hasClass(ClassName.FOOTER_SM_FIXED) || $('body').hasClass(ClassName.FOOTER_MD_FIXED) || $('body').hasClass(ClassName.FOOTER_LG_FIXED) || $('body').hasClass(ClassName.FOOTER_XL_FIXED)) {
- if ($(Selector.FOOTER).css("position") === "fixed") {
- sidebarHeight = heights.window - heights.header - heights.footer;
- }
- }
+ return ControlSidebar;
+ }();
+ /**
+ *
+ * Data Api implementation
+ * ====================================================
+ */
- $(Selector.CONTROL_SIDEBAR + ' ' + Selector.CONTROL_SIDEBAR_CONTENT).css('height', sidebarHeight);
-
- if (typeof $.fn.overlayScrollbars !== 'undefined') {
- $(Selector.CONTROL_SIDEBAR + ' ' + Selector.CONTROL_SIDEBAR_CONTENT).overlayScrollbars({
- className: this._config.scrollbarTheme,
- sizeAutoCapable: true,
- scrollbars: {
- autoHide: this._config.scrollbarAutoHide,
- clickScrolling: true
- }
- });
- }
+
+ $__default['default'](document).on('click', SELECTOR_DATA_TOGGLE, function (event) {
+ event.preventDefault();
+
+ ControlSidebar._jQueryInterface.call($__default['default'](this), 'toggle');
+ });
+ /**
+ * jQuery API
+ * ====================================================
+ */
+
+ $__default['default'].fn[NAME$2] = ControlSidebar._jQueryInterface;
+ $__default['default'].fn[NAME$2].Constructor = ControlSidebar;
+
+ $__default['default'].fn[NAME$2].noConflict = function () {
+ $__default['default'].fn[NAME$2] = JQUERY_NO_CONFLICT$2;
+ return ControlSidebar._jQueryInterface;
+ };
+
+ /**
+ * --------------------------------------------
+ * AdminLTE DirectChat.js
+ * License MIT
+ * --------------------------------------------
+ */
+ /**
+ * Constants
+ * ====================================================
+ */
+
+ var NAME$3 = 'DirectChat';
+ var DATA_KEY$3 = 'lte.directchat';
+ var EVENT_KEY$3 = "." + DATA_KEY$3;
+ var JQUERY_NO_CONFLICT$3 = $__default['default'].fn[NAME$3];
+ var EVENT_TOGGLED = "toggled" + EVENT_KEY$3;
+ var SELECTOR_DATA_TOGGLE$1 = '[data-widget="chat-pane-toggle"]';
+ var SELECTOR_DIRECT_CHAT = '.direct-chat';
+ var CLASS_NAME_DIRECT_CHAT_OPEN = 'direct-chat-contacts-open';
+ /**
+ * Class Definition
+ * ====================================================
+ */
+
+ var DirectChat = /*#__PURE__*/function () {
+ function DirectChat(element) {
+ this._element = element;
+ }
+
+ var _proto = DirectChat.prototype;
+
+ _proto.toggle = function toggle() {
+ $__default['default'](this._element).parents(SELECTOR_DIRECT_CHAT).first().toggleClass(CLASS_NAME_DIRECT_CHAT_OPEN);
+ $__default['default'](this._element).trigger($__default['default'].Event(EVENT_TOGGLED));
+ } // Static
+ ;
+
+ DirectChat._jQueryInterface = function _jQueryInterface(config) {
+ return this.each(function () {
+ var data = $__default['default'](this).data(DATA_KEY$3);
+
+ if (!data) {
+ data = new DirectChat($__default['default'](this));
+ $__default['default'](this).data(DATA_KEY$3, data);
}
- } // Static
- ;
- ControlSidebar._jQueryInterface = function _jQueryInterface(operation) {
- return this.each(function () {
- var data = $(this).data(DATA_KEY);
+ data[config]();
+ });
+ };
- var _options = $.extend({}, Default, $(this).data());
+ return DirectChat;
+ }();
+ /**
+ *
+ * Data Api implementation
+ * ====================================================
+ */
- if (!data) {
- data = new ControlSidebar(this, _options);
- $(this).data(DATA_KEY, data);
- }
- if (data[operation] === 'undefined') {
- throw new Error(operation + " is not a function");
- }
+ $__default['default'](document).on('click', SELECTOR_DATA_TOGGLE$1, function (event) {
+ if (event) {
+ event.preventDefault();
+ }
- data[operation]();
+ DirectChat._jQueryInterface.call($__default['default'](this), 'toggle');
+ });
+ /**
+ * jQuery API
+ * ====================================================
+ */
+
+ $__default['default'].fn[NAME$3] = DirectChat._jQueryInterface;
+ $__default['default'].fn[NAME$3].Constructor = DirectChat;
+
+ $__default['default'].fn[NAME$3].noConflict = function () {
+ $__default['default'].fn[NAME$3] = JQUERY_NO_CONFLICT$3;
+ return DirectChat._jQueryInterface;
+ };
+
+ /**
+ * --------------------------------------------
+ * AdminLTE Dropdown.js
+ * License MIT
+ * --------------------------------------------
+ */
+ /**
+ * Constants
+ * ====================================================
+ */
+
+ var NAME$4 = 'Dropdown';
+ var DATA_KEY$4 = 'lte.dropdown';
+ var JQUERY_NO_CONFLICT$4 = $__default['default'].fn[NAME$4];
+ var SELECTOR_NAVBAR = '.navbar';
+ var SELECTOR_DROPDOWN_MENU = '.dropdown-menu';
+ var SELECTOR_DROPDOWN_MENU_ACTIVE = '.dropdown-menu.show';
+ var SELECTOR_DROPDOWN_TOGGLE = '[data-toggle="dropdown"]';
+ var CLASS_NAME_DROPDOWN_RIGHT = 'dropdown-menu-right';
+ var CLASS_NAME_DROPDOWN_SUBMENU = 'dropdown-submenu'; // TODO: this is unused; should be removed along with the extend?
+
+ var Default$3 = {};
+ /**
+ * Class Definition
+ * ====================================================
+ */
+
+ var Dropdown = /*#__PURE__*/function () {
+ function Dropdown(element, config) {
+ this._config = config;
+ this._element = element;
+ } // Public
+
+
+ var _proto = Dropdown.prototype;
+
+ _proto.toggleSubmenu = function toggleSubmenu() {
+ this._element.siblings().show().toggleClass('show');
+
+ if (!this._element.next().hasClass('show')) {
+ this._element.parents(SELECTOR_DROPDOWN_MENU).first().find('.show').removeClass('show').hide();
+ }
+
+ this._element.parents('li.nav-item.dropdown.show').on('hidden.bs.dropdown', function () {
+ $__default['default']('.dropdown-submenu .show').removeClass('show').hide();
+ });
+ };
+
+ _proto.fixPosition = function fixPosition() {
+ var $element = $__default['default'](SELECTOR_DROPDOWN_MENU_ACTIVE);
+
+ if ($element.length === 0) {
+ return;
+ }
+
+ if ($element.hasClass(CLASS_NAME_DROPDOWN_RIGHT)) {
+ $element.css({
+ left: 'inherit',
+ right: 0
});
- };
+ } else {
+ $element.css({
+ left: 0,
+ right: 'inherit'
+ });
+ }
- return ControlSidebar;
- }();
- /**
- *
- * Data Api implementation
- * ====================================================
- */
+ var offset = $element.offset();
+ var width = $element.width();
+ var visiblePart = $__default['default'](window).width() - offset.left;
+ if (offset.left < 0) {
+ $element.css({
+ left: 'inherit',
+ right: offset.left - 5
+ });
+ } else if (visiblePart < width) {
+ $element.css({
+ left: 'inherit',
+ right: 0
+ });
+ }
+ } // Static
+ ;
- $(document).on('click', Selector.DATA_TOGGLE, function (event) {
- event.preventDefault();
+ Dropdown._jQueryInterface = function _jQueryInterface(config) {
+ return this.each(function () {
+ var data = $__default['default'](this).data(DATA_KEY$4);
- ControlSidebar._jQueryInterface.call($(this), 'toggle');
- });
- /**
- * jQuery API
- * ====================================================
- */
+ var _config = $__default['default'].extend({}, Default$3, $__default['default'](this).data());
- $.fn[NAME] = ControlSidebar._jQueryInterface;
- $.fn[NAME].Constructor = ControlSidebar;
+ if (!data) {
+ data = new Dropdown($__default['default'](this), _config);
+ $__default['default'](this).data(DATA_KEY$4, data);
+ }
- $.fn[NAME].noConflict = function () {
- $.fn[NAME] = JQUERY_NO_CONFLICT;
- return ControlSidebar._jQueryInterface;
+ if (config === 'toggleSubmenu' || config === 'fixPosition') {
+ data[config]();
+ }
+ });
};
- return ControlSidebar;
- }(jQuery);
+ return Dropdown;
+ }();
+ /**
+ * Data API
+ * ====================================================
+ */
+
+
+ $__default['default'](SELECTOR_DROPDOWN_MENU + " " + SELECTOR_DROPDOWN_TOGGLE).on('click', function (event) {
+ event.preventDefault();
+ event.stopPropagation();
+
+ Dropdown._jQueryInterface.call($__default['default'](this), 'toggleSubmenu');
+ });
+ $__default['default'](SELECTOR_NAVBAR + " " + SELECTOR_DROPDOWN_TOGGLE).on('click', function (event) {
+ event.preventDefault();
+
+ if ($__default['default'](event.target).parent().hasClass(CLASS_NAME_DROPDOWN_SUBMENU)) {
+ return;
+ }
+
+ setTimeout(function () {
+ Dropdown._jQueryInterface.call($__default['default'](this), 'fixPosition');
+ }, 1);
+ });
+ /**
+ * jQuery API
+ * ====================================================
+ */
+
+ $__default['default'].fn[NAME$4] = Dropdown._jQueryInterface;
+ $__default['default'].fn[NAME$4].Constructor = Dropdown;
+
+ $__default['default'].fn[NAME$4].noConflict = function () {
+ $__default['default'].fn[NAME$4] = JQUERY_NO_CONFLICT$4;
+ return Dropdown._jQueryInterface;
+ };
/**
* --------------------------------------------
- * AdminLTE Layout.js
+ * AdminLTE ExpandableTable.js
* License MIT
* --------------------------------------------
*/
- var Layout = function ($) {
- /**
- * Constants
- * ====================================================
- */
- var NAME = 'Layout';
- var DATA_KEY = 'lte.layout';
- var JQUERY_NO_CONFLICT = $.fn[NAME];
- var Selector = {
- HEADER: '.main-header',
- MAIN_SIDEBAR: '.main-sidebar',
- SIDEBAR: '.main-sidebar .sidebar',
- CONTENT: '.content-wrapper',
- BRAND: '.brand-link',
- CONTENT_HEADER: '.content-header',
- WRAPPER: '.wrapper',
- CONTROL_SIDEBAR: '.control-sidebar',
- CONTROL_SIDEBAR_CONTENT: '.control-sidebar-content',
- CONTROL_SIDEBAR_BTN: '[data-widget="control-sidebar"]',
- LAYOUT_FIXED: '.layout-fixed',
- FOOTER: '.main-footer',
- PUSHMENU_BTN: '[data-widget="pushmenu"]',
- LOGIN_BOX: '.login-box',
- REGISTER_BOX: '.register-box'
+ /**
+ * Constants
+ * ====================================================
+ */
+
+ var NAME$5 = 'ExpandableTable';
+ var DATA_KEY$5 = 'lte.expandableTable';
+ var EVENT_KEY$4 = "." + DATA_KEY$5;
+ var JQUERY_NO_CONFLICT$5 = $__default['default'].fn[NAME$5];
+ var EVENT_EXPANDED$2 = "expanded" + EVENT_KEY$4;
+ var EVENT_COLLAPSED$2 = "collapsed" + EVENT_KEY$4;
+ var SELECTOR_TABLE = '.expandable-table';
+ var SELECTOR_DATA_TOGGLE$2 = '[data-widget="expandable-table"]';
+ var SELECTOR_ARIA_ATTR = 'aria-expanded';
+ /**
+ * Class Definition
+ * ====================================================
+ */
+
+ var ExpandableTable = /*#__PURE__*/function () {
+ function ExpandableTable(element, options) {
+ this._options = options;
+ this._element = element;
+ } // Public
+
+
+ var _proto = ExpandableTable.prototype;
+
+ _proto.init = function init() {
+ $__default['default'](SELECTOR_DATA_TOGGLE$2).each(function (_, $header) {
+ var $type = $__default['default']($header).attr(SELECTOR_ARIA_ATTR);
+ var $body = $__default['default']($header).next().children().first().children();
+
+ if ($type === 'true') {
+ $body.show();
+ } else if ($type === 'false') {
+ $body.hide();
+ $body.parent().parent().addClass('d-none');
+ }
+ });
};
- var ClassName = {
- HOLD: 'hold-transition',
- SIDEBAR: 'main-sidebar',
- CONTENT_FIXED: 'content-fixed',
- SIDEBAR_FOCUSED: 'sidebar-focused',
- LAYOUT_FIXED: 'layout-fixed',
- NAVBAR_FIXED: 'layout-navbar-fixed',
- FOOTER_FIXED: 'layout-footer-fixed',
- LOGIN_PAGE: 'login-page',
- REGISTER_PAGE: 'register-page',
- CONTROL_SIDEBAR_SLIDE_OPEN: 'control-sidebar-slide-open',
- CONTROL_SIDEBAR_OPEN: 'control-sidebar-open'
+
+ _proto.toggleRow = function toggleRow() {
+ var $element = this._element;
+ var time = 500;
+ var $type = $element.attr(SELECTOR_ARIA_ATTR);
+ var $body = $element.next().children().first().children();
+ $body.stop();
+
+ if ($type === 'true') {
+ $body.slideUp(time, function () {
+ $element.next().addClass('d-none');
+ });
+ $element.attr(SELECTOR_ARIA_ATTR, 'false');
+ $element.trigger($__default['default'].Event(EVENT_COLLAPSED$2));
+ } else if ($type === 'false') {
+ $element.next().removeClass('d-none');
+ $body.slideDown(time);
+ $element.attr(SELECTOR_ARIA_ATTR, 'true');
+ $element.trigger($__default['default'].Event(EVENT_EXPANDED$2));
+ }
+ } // Static
+ ;
+
+ ExpandableTable._jQueryInterface = function _jQueryInterface(operation) {
+ return this.each(function () {
+ var data = $__default['default'](this).data(DATA_KEY$5);
+
+ if (!data) {
+ data = new ExpandableTable($__default['default'](this));
+ $__default['default'](this).data(DATA_KEY$5, data);
+ }
+
+ if (typeof operation === 'string' && operation.match(/init|toggleRow/)) {
+ data[operation]();
+ }
+ });
};
- var Default = {
- scrollbarTheme: 'os-theme-light',
- scrollbarAutoHide: 'l',
- panelAutoHeight: true,
- loginRegisterAutoHeight: true
+
+ return ExpandableTable;
+ }();
+ /**
+ * Data API
+ * ====================================================
+ */
+
+
+ $__default['default'](SELECTOR_TABLE).ready(function () {
+ ExpandableTable._jQueryInterface.call($__default['default'](this), 'init');
+ });
+ $__default['default'](document).on('click', SELECTOR_DATA_TOGGLE$2, function () {
+ ExpandableTable._jQueryInterface.call($__default['default'](this), 'toggleRow');
+ });
+ /**
+ * jQuery API
+ * ====================================================
+ */
+
+ $__default['default'].fn[NAME$5] = ExpandableTable._jQueryInterface;
+ $__default['default'].fn[NAME$5].Constructor = ExpandableTable;
+
+ $__default['default'].fn[NAME$5].noConflict = function () {
+ $__default['default'].fn[NAME$5] = JQUERY_NO_CONFLICT$5;
+ return ExpandableTable._jQueryInterface;
+ };
+
+ /**
+ * --------------------------------------------
+ * AdminLTE Fullscreen.js
+ * License MIT
+ * --------------------------------------------
+ */
+ /**
+ * Constants
+ * ====================================================
+ */
+
+ var NAME$6 = 'Fullscreen';
+ var DATA_KEY$6 = 'lte.fullscreen';
+ var JQUERY_NO_CONFLICT$6 = $__default['default'].fn[NAME$6];
+ var SELECTOR_DATA_WIDGET = '[data-widget="fullscreen"]';
+ var SELECTOR_ICON = SELECTOR_DATA_WIDGET + " i";
+ var Default$4 = {
+ minimizeIcon: 'fa-compress-arrows-alt',
+ maximizeIcon: 'fa-expand-arrows-alt'
+ };
+ /**
+ * Class Definition
+ * ====================================================
+ */
+
+ var Fullscreen = /*#__PURE__*/function () {
+ function Fullscreen(_element, _options) {
+ this.element = _element;
+ this.options = $__default['default'].extend({}, Default$4, _options);
+ } // Public
+
+
+ var _proto = Fullscreen.prototype;
+
+ _proto.toggle = function toggle() {
+ if (document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement || document.msFullscreenElement) {
+ this.windowed();
+ } else {
+ this.fullscreen();
+ }
};
- /**
- * Class Definition
- * ====================================================
- */
- var Layout = /*#__PURE__*/function () {
- function Layout(element, config) {
- this._config = config;
- this._element = element;
+ _proto.fullscreen = function fullscreen() {
+ if (document.documentElement.requestFullscreen) {
+ document.documentElement.requestFullscreen();
+ } else if (document.documentElement.webkitRequestFullscreen) {
+ document.documentElement.webkitRequestFullscreen();
+ } else if (document.documentElement.msRequestFullscreen) {
+ document.documentElement.msRequestFullscreen();
+ }
- this._init();
- } // Public
+ $__default['default'](SELECTOR_ICON).removeClass(this.options.maximizeIcon).addClass(this.options.minimizeIcon);
+ };
+ _proto.windowed = function windowed() {
+ if (document.exitFullscreen) {
+ document.exitFullscreen();
+ } else if (document.webkitExitFullscreen) {
+ document.webkitExitFullscreen();
+ } else if (document.msExitFullscreen) {
+ document.msExitFullscreen();
+ }
- var _proto = Layout.prototype;
+ $__default['default'](SELECTOR_ICON).removeClass(this.options.minimizeIcon).addClass(this.options.maximizeIcon);
+ } // Static
+ ;
- _proto.fixLayoutHeight = function fixLayoutHeight(extra) {
- if (extra === void 0) {
- extra = null;
- }
+ Fullscreen._jQueryInterface = function _jQueryInterface(config) {
+ var data = $__default['default'](this).data(DATA_KEY$6);
+
+ if (!data) {
+ data = $__default['default'](this).data();
+ }
- var control_sidebar = 0;
+ var _options = $__default['default'].extend({}, Default$4, typeof config === 'object' ? config : data);
- if ($('body').hasClass(ClassName.CONTROL_SIDEBAR_SLIDE_OPEN) || $('body').hasClass(ClassName.CONTROL_SIDEBAR_OPEN) || extra == 'control_sidebar') {
- control_sidebar = $(Selector.CONTROL_SIDEBAR_CONTENT).height();
- }
+ var plugin = new Fullscreen($__default['default'](this), _options);
+ $__default['default'](this).data(DATA_KEY$6, typeof config === 'object' ? config : data);
- var heights = {
- window: $(window).height(),
- header: $(Selector.HEADER).length !== 0 ? $(Selector.HEADER).outerHeight() : 0,
- footer: $(Selector.FOOTER).length !== 0 ? $(Selector.FOOTER).outerHeight() : 0,
- sidebar: $(Selector.SIDEBAR).length !== 0 ? $(Selector.SIDEBAR).height() : 0,
- control_sidebar: control_sidebar
- };
+ if (typeof config === 'string' && config.match(/toggle|fullscreen|windowed/)) {
+ plugin[config]();
+ } else {
+ plugin.init();
+ }
+ };
- var max = this._max(heights);
+ return Fullscreen;
+ }();
+ /**
+ * Data API
+ * ====================================================
+ */
- var offset = this._config.panelAutoHeight;
- if (offset === true) {
- offset = 0;
- }
+ $__default['default'](document).on('click', SELECTOR_DATA_WIDGET, function () {
+ Fullscreen._jQueryInterface.call($__default['default'](this), 'toggle');
+ });
+ /**
+ * jQuery API
+ * ====================================================
+ */
- if (offset !== false) {
- if (max == heights.control_sidebar) {
- $(Selector.CONTENT).css('min-height', max + offset);
- } else if (max == heights.window) {
- $(Selector.CONTENT).css('min-height', max + offset - heights.header - heights.footer);
- } else {
- $(Selector.CONTENT).css('min-height', max + offset - heights.header);
- }
+ $__default['default'].fn[NAME$6] = Fullscreen._jQueryInterface;
+ $__default['default'].fn[NAME$6].Constructor = Fullscreen;
- if (this._isFooterFixed()) {
- $(Selector.CONTENT).css('min-height', parseFloat($(Selector.CONTENT).css('min-height')) + heights.footer);
- }
- }
+ $__default['default'].fn[NAME$6].noConflict = function () {
+ $__default['default'].fn[NAME$6] = JQUERY_NO_CONFLICT$6;
+ return Fullscreen._jQueryInterface;
+ };
- if ($('body').hasClass(ClassName.LAYOUT_FIXED)) {
- if (offset !== false) {
- $(Selector.CONTENT).css('min-height', max + offset - heights.header - heights.footer);
- }
+ /**
+ * --------------------------------------------
+ * AdminLTE IFrame.js
+ * License MIT
+ * --------------------------------------------
+ */
+ /**
+ * Constants
+ * ====================================================
+ */
- if (typeof $.fn.overlayScrollbars !== 'undefined') {
- $(Selector.SIDEBAR).overlayScrollbars({
- className: this._config.scrollbarTheme,
- sizeAutoCapable: true,
- scrollbars: {
- autoHide: this._config.scrollbarAutoHide,
- clickScrolling: true
- }
- });
- }
- }
- };
+ var NAME$7 = 'IFrame';
+ var DATA_KEY$7 = 'lte.iframe';
+ var JQUERY_NO_CONFLICT$7 = $__default['default'].fn[NAME$7];
+ var SELECTOR_DATA_TOGGLE$3 = '[data-widget="iframe"]';
+ var SELECTOR_DATA_TOGGLE_CLOSE = '[data-widget="iframe-close"]';
+ var SELECTOR_DATA_TOGGLE_SCROLL_LEFT = '[data-widget="iframe-scrollleft"]';
+ var SELECTOR_DATA_TOGGLE_SCROLL_RIGHT = '[data-widget="iframe-scrollright"]';
+ var SELECTOR_DATA_TOGGLE_FULLSCREEN = '[data-widget="iframe-fullscreen"]';
+ var SELECTOR_CONTENT_WRAPPER = '.content-wrapper';
+ var SELECTOR_CONTENT_IFRAME = SELECTOR_CONTENT_WRAPPER + " iframe";
+ var SELECTOR_TAB_NAV = SELECTOR_DATA_TOGGLE$3 + ".iframe-mode .nav";
+ var SELECTOR_TAB_NAVBAR_NAV = SELECTOR_DATA_TOGGLE$3 + ".iframe-mode .navbar-nav";
+ var SELECTOR_TAB_NAVBAR_NAV_ITEM = SELECTOR_TAB_NAVBAR_NAV + " .nav-item";
+ var SELECTOR_TAB_CONTENT = SELECTOR_DATA_TOGGLE$3 + ".iframe-mode .tab-content";
+ var SELECTOR_TAB_EMPTY = SELECTOR_TAB_CONTENT + " .tab-empty";
+ var SELECTOR_TAB_LOADING = SELECTOR_TAB_CONTENT + " .tab-loading";
+ var SELECTOR_SIDEBAR_MENU_ITEM = '.main-sidebar .nav-item > a.nav-link';
+ var SELECTOR_HEADER_MENU_ITEM = '.main-header .nav-item a.nav-link';
+ var SELECTOR_HEADER_DROPDOWN_ITEM = '.main-header a.dropdown-item';
+ var CLASS_NAME_IFRAME_MODE = 'iframe-mode';
+ var CLASS_NAME_FULLSCREEN_MODE = 'iframe-mode-fullscreen';
+ var Default$5 = {
+ onTabClick: function onTabClick(item) {
+ return item;
+ },
+ onTabChanged: function onTabChanged(item) {
+ return item;
+ },
+ onTabCreated: function onTabCreated(item) {
+ return item;
+ },
+ autoIframeMode: true,
+ autoItemActive: true,
+ autoShowNewTab: true,
+ loadingScreen: true,
+ useNavbarItems: true,
+ scrollOffset: 40,
+ scrollBehaviorSwap: false,
+ iconMaximize: 'fa-expand',
+ iconMinimize: 'fa-compress'
+ };
+ /**
+ * Class Definition
+ * ====================================================
+ */
- _proto.fixLoginRegisterHeight = function fixLoginRegisterHeight() {
- if ($(Selector.LOGIN_BOX + ', ' + Selector.REGISTER_BOX).length === 0) {
- $('body, html').css('height', 'auto');
- } else if ($(Selector.LOGIN_BOX + ', ' + Selector.REGISTER_BOX).length !== 0) {
- var box_height = $(Selector.LOGIN_BOX + ', ' + Selector.REGISTER_BOX).height();
+ var IFrame = /*#__PURE__*/function () {
+ function IFrame(element, config) {
+ this._config = config;
+ this._element = element;
- if ($('body').css('min-height') !== box_height) {
- $('body').css('min-height', box_height);
- }
- }
- } // Private
- ;
+ this._init();
+ } // Public
- _proto._init = function _init() {
- var _this = this;
- // Activate layout height watcher
- this.fixLayoutHeight();
+ var _proto = IFrame.prototype;
- if (this._config.loginRegisterAutoHeight === true) {
- this.fixLoginRegisterHeight();
- } else if (Number.isInteger(this._config.loginRegisterAutoHeight)) {
- setInterval(this.fixLoginRegisterHeight, this._config.loginRegisterAutoHeight);
- }
+ _proto.onTabClick = function onTabClick(item) {
+ this._config.onTabClick(item);
+ };
- $(Selector.SIDEBAR).on('collapsed.lte.treeview expanded.lte.treeview', function () {
- _this.fixLayoutHeight();
- });
- $(Selector.PUSHMENU_BTN).on('collapsed.lte.pushmenu shown.lte.pushmenu', function () {
- _this.fixLayoutHeight();
- });
- $(Selector.CONTROL_SIDEBAR_BTN).on('collapsed.lte.controlsidebar', function () {
- _this.fixLayoutHeight();
- }).on('expanded.lte.controlsidebar', function () {
- _this.fixLayoutHeight('control_sidebar');
- });
- $(window).resize(function () {
- _this.fixLayoutHeight();
- });
- setTimeout(function () {
- $('body.hold-transition').removeClass('hold-transition');
- }, 50);
- };
+ _proto.onTabChanged = function onTabChanged(item) {
+ this._config.onTabChanged(item);
+ };
- _proto._max = function _max(numbers) {
- // Calculate the maximum number in a list
- var max = 0;
- Object.keys(numbers).forEach(function (key) {
- if (numbers[key] > max) {
- max = numbers[key];
- }
- });
- return max;
- };
+ _proto.onTabCreated = function onTabCreated(item) {
+ this._config.onTabCreated(item);
+ };
- _proto._isFooterFixed = function _isFooterFixed() {
- return $('.main-footer').css('position') === 'fixed';
- } // Static
- ;
+ _proto.createTab = function createTab(title, link, uniqueName, autoOpen) {
+ var _this = this;
+
+ var tabId = "panel-" + uniqueName + "-" + Math.floor(Math.random() * 1000);
+ var navId = "tab-" + uniqueName + "-" + Math.floor(Math.random() * 1000);
+ var newNavItem = "" + title + "";
+ $__default['default'](SELECTOR_TAB_NAVBAR_NAV).append(newNavItem);
+ var newTabItem = "";
+ $__default['default'](SELECTOR_TAB_CONTENT).append(newTabItem);
+
+ if (autoOpen) {
+ if (this._config.loadingScreen) {
+ var $loadingScreen = $__default['default'](SELECTOR_TAB_LOADING);
+ $loadingScreen.fadeIn();
+ $__default['default'](tabId + " iframe").ready(function () {
+ if (typeof _this._config.loadingScreen === 'number') {
+ _this.switchTab("#" + navId, _this._config.loadingScreen);
+
+ setTimeout(function () {
+ $loadingScreen.fadeOut();
+ }, _this._config.loadingScreen);
+ } else {
+ _this.switchTab("#" + navId, _this._config.loadingScreen);
- Layout._jQueryInterface = function _jQueryInterface(config) {
- if (config === void 0) {
- config = '';
+ $loadingScreen.fadeOut();
+ }
+ });
+ } else {
+ this.switchTab("#" + navId);
}
+ }
- return this.each(function () {
- var data = $(this).data(DATA_KEY);
+ this.onTabCreated($__default['default']("#" + navId));
+ };
- var _options = $.extend({}, Default, $(this).data());
+ _proto.openTabSidebar = function openTabSidebar(item, autoOpen) {
+ if (autoOpen === void 0) {
+ autoOpen = this._config.autoShowNewTab;
+ }
- if (!data) {
- data = new Layout($(this), _options);
- $(this).data(DATA_KEY, data);
- }
+ var $item = $__default['default'](item).clone();
- if (config === 'init' || config === '') {
- data['_init']();
- } else if (config === 'fixLayoutHeight' || config === 'fixLoginRegisterHeight') {
- data[config]();
- }
- });
- };
+ if ($item.attr('href') === undefined) {
+ $item = $__default['default'](item).parent('a').clone();
+ }
- return Layout;
- }();
- /**
- * Data API
- * ====================================================
- */
+ $item.find('.right').remove();
+ var title = $item.find('p').text();
+ if (title === '') {
+ title = $item.text();
+ }
- $(window).on('load', function () {
- Layout._jQueryInterface.call($('body'));
- });
- $(Selector.SIDEBAR + ' a').on('focusin', function () {
- $(Selector.MAIN_SIDEBAR).addClass(ClassName.SIDEBAR_FOCUSED);
- });
- $(Selector.SIDEBAR + ' a').on('focusout', function () {
- $(Selector.MAIN_SIDEBAR).removeClass(ClassName.SIDEBAR_FOCUSED);
- });
- /**
- * jQuery API
- * ====================================================
- */
+ var link = $item.attr('href');
- $.fn[NAME] = Layout._jQueryInterface;
- $.fn[NAME].Constructor = Layout;
+ if (link === '#' || link === '' || link === undefined) {
+ return;
+ }
- $.fn[NAME].noConflict = function () {
- $.fn[NAME] = JQUERY_NO_CONFLICT;
- return Layout._jQueryInterface;
+ this.createTab(title, link, link.replace('.html', '').replace('./', '').replaceAll('/', '-'), autoOpen);
};
- return Layout;
- }(jQuery);
+ _proto.switchTab = function switchTab(item) {
+ var $item = $__default['default'](item);
+ var tabId = $item.attr('href');
+ $__default['default'](SELECTOR_TAB_EMPTY).hide();
+ $__default['default'](SELECTOR_TAB_NAVBAR_NAV + " .active").tab('dispose').removeClass('active');
- /**
- * --------------------------------------------
- * AdminLTE PushMenu.js
- * License MIT
- * --------------------------------------------
- */
- var PushMenu = function ($) {
- /**
- * Constants
- * ====================================================
- */
- var NAME = 'PushMenu';
- var DATA_KEY = 'lte.pushmenu';
- var EVENT_KEY = "." + DATA_KEY;
- var JQUERY_NO_CONFLICT = $.fn[NAME];
- var Event = {
- COLLAPSED: "collapsed" + EVENT_KEY,
- SHOWN: "shown" + EVENT_KEY
- };
- var Default = {
- autoCollapseSize: 992,
- enableRemember: false,
- noTransitionAfterReload: true
- };
- var Selector = {
- TOGGLE_BUTTON: '[data-widget="pushmenu"]',
- SIDEBAR_MINI: '.sidebar-mini',
- SIDEBAR_COLLAPSED: '.sidebar-collapse',
- BODY: 'body',
- OVERLAY: '#sidebar-overlay',
- WRAPPER: '.wrapper'
+ this._fixHeight();
+
+ $item.tab('show');
+ $item.parents('li').addClass('active');
+ this.onTabChanged($item);
+
+ if (this._config.autoItemActive) {
+ this._setItemActive($__default['default'](tabId + " iframe").attr('src'));
+ }
};
- var ClassName = {
- COLLAPSED: 'sidebar-collapse',
- OPEN: 'sidebar-open',
- CLOSED: 'sidebar-closed'
+
+ _proto.removeActiveTab = function removeActiveTab() {
+ var $navItem = $__default['default'](SELECTOR_TAB_NAVBAR_NAV_ITEM + ".active");
+ var $navItemParent = $navItem.parent();
+ var navItemIndex = $navItem.index();
+ $navItem.remove();
+ $__default['default']('.tab-pane.active').remove();
+
+ if ($__default['default'](SELECTOR_TAB_CONTENT).children().length == $__default['default'](SELECTOR_TAB_EMPTY + ", " + SELECTOR_TAB_LOADING).length) {
+ $__default['default'](SELECTOR_TAB_EMPTY).show();
+ } else {
+ var prevNavItemIndex = navItemIndex - 1;
+ this.switchTab($navItemParent.children().eq(prevNavItemIndex).find('a'));
+ }
};
- /**
- * Class Definition
- * ====================================================
- */
-
- var PushMenu = /*#__PURE__*/function () {
- function PushMenu(element, options) {
- this._element = element;
- this._options = $.extend({}, Default, options);
-
- if (!$(Selector.OVERLAY).length) {
- this._addOverlay();
- }
- this._init();
- } // Public
+ _proto.toggleFullscreen = function toggleFullscreen() {
+ if ($__default['default']('body').hasClass(CLASS_NAME_FULLSCREEN_MODE)) {
+ $__default['default'](SELECTOR_DATA_TOGGLE_FULLSCREEN + " i").removeClass(this._config.iconMinimize).addClass(this._config.iconMaximize);
+ $__default['default']('body').removeClass(CLASS_NAME_FULLSCREEN_MODE);
+ $__default['default'](SELECTOR_TAB_EMPTY + ", " + SELECTOR_TAB_LOADING).height('auto');
+ $__default['default'](SELECTOR_CONTENT_WRAPPER).height('auto');
+ $__default['default'](SELECTOR_CONTENT_IFRAME).height('auto');
+ } else {
+ $__default['default'](SELECTOR_DATA_TOGGLE_FULLSCREEN + " i").removeClass(this._config.iconMaximize).addClass(this._config.iconMinimize);
+ $__default['default']('body').addClass(CLASS_NAME_FULLSCREEN_MODE);
+ }
+ $__default['default'](window).trigger('resize');
- var _proto = PushMenu.prototype;
+ this._fixHeight(true);
+ } // Private
+ ;
- _proto.expand = function expand() {
- if (this._options.autoCollapseSize) {
- if ($(window).width() <= this._options.autoCollapseSize) {
- $(Selector.BODY).addClass(ClassName.OPEN);
- }
- }
+ _proto._init = function _init() {
+ if (window.frameElement && this._config.autoIframeMode) {
+ $__default['default']('body').addClass(CLASS_NAME_IFRAME_MODE);
+ } else if ($__default['default'](SELECTOR_CONTENT_WRAPPER).hasClass(CLASS_NAME_IFRAME_MODE)) {
+ this._setupListeners();
- $(Selector.BODY).removeClass(ClassName.COLLAPSED).removeClass(ClassName.CLOSED);
+ this._fixHeight(true);
+ }
+ };
- if (this._options.enableRemember) {
- localStorage.setItem("remember" + EVENT_KEY, ClassName.OPEN);
- }
+ _proto._navScroll = function _navScroll(offset) {
+ var leftPos = $__default['default'](SELECTOR_TAB_NAVBAR_NAV).scrollLeft();
+ $__default['default'](SELECTOR_TAB_NAVBAR_NAV).animate({
+ scrollLeft: leftPos + offset
+ }, 250, 'linear');
+ };
- var shownEvent = $.Event(Event.SHOWN);
- $(this._element).trigger(shownEvent);
- };
+ _proto._setupListeners = function _setupListeners() {
+ var _this2 = this;
- _proto.collapse = function collapse() {
- if (this._options.autoCollapseSize) {
- if ($(window).width() <= this._options.autoCollapseSize) {
- $(Selector.BODY).removeClass(ClassName.OPEN).addClass(ClassName.CLOSED);
- }
- }
+ $__default['default'](window).on('resize', function () {
+ setTimeout(function () {
+ _this2._fixHeight();
+ }, 1);
+ });
+ $__default['default'](document).on('click', SELECTOR_SIDEBAR_MENU_ITEM, function (e) {
+ e.preventDefault();
- $(Selector.BODY).addClass(ClassName.COLLAPSED);
+ _this2.openTabSidebar(e.target);
+ });
- if (this._options.enableRemember) {
- localStorage.setItem("remember" + EVENT_KEY, ClassName.COLLAPSED);
- }
+ if (this._config.useNavbarItems) {
+ $__default['default'](document).on('click', SELECTOR_HEADER_MENU_ITEM + ", " + SELECTOR_HEADER_DROPDOWN_ITEM, function (e) {
+ e.preventDefault();
- var collapsedEvent = $.Event(Event.COLLAPSED);
- $(this._element).trigger(collapsedEvent);
- };
+ _this2.openTabSidebar(e.target);
+ });
+ }
- _proto.toggle = function toggle() {
- if (!$(Selector.BODY).hasClass(ClassName.COLLAPSED)) {
- this.collapse();
- } else {
- this.expand();
- }
- };
+ $__default['default'](document).on('click', SELECTOR_TAB_NAVBAR_NAV_ITEM, function (e) {
+ e.preventDefault();
- _proto.autoCollapse = function autoCollapse(resize) {
- if (resize === void 0) {
- resize = false;
- }
+ _this2.onTabClick(e.target);
- if (this._options.autoCollapseSize) {
- if ($(window).width() <= this._options.autoCollapseSize) {
- if (!$(Selector.BODY).hasClass(ClassName.OPEN)) {
- this.collapse();
- }
- } else if (resize == true) {
- if ($(Selector.BODY).hasClass(ClassName.OPEN)) {
- $(Selector.BODY).removeClass(ClassName.OPEN);
- } else if ($(Selector.BODY).hasClass(ClassName.CLOSED)) {
- this.expand();
- }
- }
- }
- };
+ _this2.switchTab(e.target);
+ });
+ $__default['default'](document).on('click', SELECTOR_DATA_TOGGLE_CLOSE, function (e) {
+ e.preventDefault();
- _proto.remember = function remember() {
- if (this._options.enableRemember) {
- var toggleState = localStorage.getItem("remember" + EVENT_KEY);
+ _this2.removeActiveTab();
+ });
+ $__default['default'](document).on('click', SELECTOR_DATA_TOGGLE_FULLSCREEN, function (e) {
+ e.preventDefault();
- if (toggleState == ClassName.COLLAPSED) {
- if (this._options.noTransitionAfterReload) {
- $("body").addClass('hold-transition').addClass(ClassName.COLLAPSED).delay(50).queue(function () {
- $(this).removeClass('hold-transition');
- $(this).dequeue();
- });
- } else {
- $("body").addClass(ClassName.COLLAPSED);
- }
- } else {
- if (this._options.noTransitionAfterReload) {
- $("body").addClass('hold-transition').removeClass(ClassName.COLLAPSED).delay(50).queue(function () {
- $(this).removeClass('hold-transition');
- $(this).dequeue();
- });
- } else {
- $("body").removeClass(ClassName.COLLAPSED);
- }
- }
+ _this2.toggleFullscreen();
+ });
+ var mousedown = false;
+ var mousedownInterval = null;
+ $__default['default'](document).on('mousedown', SELECTOR_DATA_TOGGLE_SCROLL_LEFT, function (e) {
+ e.preventDefault();
+ clearInterval(mousedownInterval);
+ var scrollOffset = _this2._config.scrollOffset;
+
+ if (!_this2._config.scrollBehaviorSwap) {
+ scrollOffset = -scrollOffset;
}
- } // Private
- ;
- _proto._init = function _init() {
- var _this = this;
+ mousedown = true;
- this.remember();
- this.autoCollapse();
- $(window).resize(function () {
- _this.autoCollapse(true);
- });
- };
+ _this2._navScroll(scrollOffset);
- _proto._addOverlay = function _addOverlay() {
- var _this2 = this;
+ mousedownInterval = setInterval(function () {
+ _this2._navScroll(scrollOffset);
+ }, 250);
+ });
+ $__default['default'](document).on('mousedown', SELECTOR_DATA_TOGGLE_SCROLL_RIGHT, function (e) {
+ e.preventDefault();
+ clearInterval(mousedownInterval);
+ var scrollOffset = _this2._config.scrollOffset;
- var overlay = $('', {
- id: 'sidebar-overlay'
- });
- overlay.on('click', function () {
- _this2.collapse();
- });
- $(Selector.WRAPPER).append(overlay);
- } // Static
- ;
+ if (_this2._config.scrollBehaviorSwap) {
+ scrollOffset = -scrollOffset;
+ }
- PushMenu._jQueryInterface = function _jQueryInterface(operation) {
- return this.each(function () {
- var data = $(this).data(DATA_KEY);
+ mousedown = true;
- var _options = $.extend({}, Default, $(this).data());
+ _this2._navScroll(scrollOffset);
- if (!data) {
- data = new PushMenu(this, _options);
- $(this).data(DATA_KEY, data);
- }
+ mousedownInterval = setInterval(function () {
+ _this2._navScroll(scrollOffset);
+ }, 250);
+ });
+ $__default['default'](document).on('mouseup', function () {
+ if (mousedown) {
+ mousedown = false;
+ clearInterval(mousedownInterval);
+ mousedownInterval = null;
+ }
+ });
+ };
- if (typeof operation === 'string' && operation.match(/collapse|expand|toggle/)) {
- data[operation]();
- }
- });
- };
+ _proto._setItemActive = function _setItemActive(href) {
+ $__default['default'](SELECTOR_SIDEBAR_MENU_ITEM + ", " + SELECTOR_HEADER_DROPDOWN_ITEM).removeClass('active');
+ $__default['default'](SELECTOR_HEADER_MENU_ITEM).parent().removeClass('active');
+ var $headerMenuItem = $__default['default'](SELECTOR_HEADER_MENU_ITEM + "[href$=\"" + href + "\"]");
+ var $headerDropdownItem = $__default['default'](SELECTOR_HEADER_DROPDOWN_ITEM + "[href$=\"" + href + "\"]");
+ var $sidebarMenuItem = $__default['default'](SELECTOR_SIDEBAR_MENU_ITEM + "[href$=\"" + href + "\"]");
+ $headerMenuItem.each(function (i, e) {
+ $__default['default'](e).parent().addClass('active');
+ });
+ $headerDropdownItem.each(function (i, e) {
+ $__default['default'](e).addClass('active');
+ });
+ $sidebarMenuItem.each(function (i, e) {
+ $__default['default'](e).addClass('active');
+ $__default['default'](e).parents('.nav-treeview').prevAll('.nav-link').addClass('active');
+ });
+ };
+
+ _proto._fixHeight = function _fixHeight(tabEmpty) {
+ if (tabEmpty === void 0) {
+ tabEmpty = false;
+ }
- return PushMenu;
- }();
- /**
- * Data API
- * ====================================================
- */
+ if ($__default['default']('body').hasClass(CLASS_NAME_FULLSCREEN_MODE)) {
+ var windowHeight = $__default['default'](window).height();
+ $__default['default'](SELECTOR_TAB_EMPTY + ", " + SELECTOR_TAB_LOADING).height(windowHeight);
+ $__default['default'](SELECTOR_CONTENT_WRAPPER).height(windowHeight);
+ $__default['default'](SELECTOR_CONTENT_IFRAME).height(windowHeight);
+ } else {
+ var contentWrapperHeight = parseFloat($__default['default'](SELECTOR_CONTENT_WRAPPER).css('min-height'));
+ var navbarHeight = $__default['default'](SELECTOR_TAB_NAV).outerHeight();
+
+ if (tabEmpty == true) {
+ setTimeout(function () {
+ $__default['default'](SELECTOR_TAB_EMPTY + ", " + SELECTOR_TAB_LOADING).height(contentWrapperHeight - navbarHeight);
+ }, 50);
+ } else {
+ $__default['default'](SELECTOR_CONTENT_IFRAME).height(contentWrapperHeight - navbarHeight);
+ }
+ }
+ } // Static
+ ;
+ IFrame._jQueryInterface = function _jQueryInterface(operation) {
+ var data = $__default['default'](this).data(DATA_KEY$7);
- $(document).on('click', Selector.TOGGLE_BUTTON, function (event) {
- event.preventDefault();
- var button = event.currentTarget;
+ var _options = $__default['default'].extend({}, Default$5, $__default['default'](this).data());
- if ($(button).data('widget') !== 'pushmenu') {
- button = $(button).closest(Selector.TOGGLE_BUTTON);
+ if (!data) {
+ data = new IFrame(this, _options);
+ $__default['default'](this).data(DATA_KEY$7, data);
}
- PushMenu._jQueryInterface.call($(button), 'toggle');
- });
- $(window).on('load', function () {
- PushMenu._jQueryInterface.call($(Selector.TOGGLE_BUTTON));
- });
- /**
- * jQuery API
- * ====================================================
- */
+ if (typeof operation === 'string' && operation.match(/createTab|openTabSidebar|switchTab|removeActiveTab/)) {
+ var _data;
- $.fn[NAME] = PushMenu._jQueryInterface;
- $.fn[NAME].Constructor = PushMenu;
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
+ args[_key - 1] = arguments[_key];
+ }
- $.fn[NAME].noConflict = function () {
- $.fn[NAME] = JQUERY_NO_CONFLICT;
- return PushMenu._jQueryInterface;
+ (_data = data)[operation].apply(_data, args);
+ }
};
- return PushMenu;
- }(jQuery);
+ return IFrame;
+ }();
+ /**
+ * Data API
+ * ====================================================
+ */
+
+
+ $__default['default'](window).on('load', function () {
+ IFrame._jQueryInterface.call($__default['default'](SELECTOR_DATA_TOGGLE$3));
+ });
+ /**
+ * jQuery API
+ * ====================================================
+ */
+
+ $__default['default'].fn[NAME$7] = IFrame._jQueryInterface;
+ $__default['default'].fn[NAME$7].Constructor = IFrame;
+
+ $__default['default'].fn[NAME$7].noConflict = function () {
+ $__default['default'].fn[NAME$7] = JQUERY_NO_CONFLICT$7;
+ return IFrame._jQueryInterface;
+ };
/**
* --------------------------------------------
- * AdminLTE Treeview.js
+ * AdminLTE Layout.js
* License MIT
* --------------------------------------------
*/
- var Treeview = function ($) {
- /**
- * Constants
- * ====================================================
- */
- var NAME = 'Treeview';
- var DATA_KEY = 'lte.treeview';
- var EVENT_KEY = "." + DATA_KEY;
- var JQUERY_NO_CONFLICT = $.fn[NAME];
- var Event = {
- SELECTED: "selected" + EVENT_KEY,
- EXPANDED: "expanded" + EVENT_KEY,
- COLLAPSED: "collapsed" + EVENT_KEY,
- LOAD_DATA_API: "load" + EVENT_KEY
- };
- var Selector = {
- LI: '.nav-item',
- LINK: '.nav-link',
- TREEVIEW_MENU: '.nav-treeview',
- OPEN: '.menu-open',
- DATA_WIDGET: '[data-widget="treeview"]'
- };
- var ClassName = {
- LI: 'nav-item',
- LINK: 'nav-link',
- TREEVIEW_MENU: 'nav-treeview',
- OPEN: 'menu-open',
- SIDEBAR_COLLAPSED: 'sidebar-collapse'
- };
- var Default = {
- trigger: Selector.DATA_WIDGET + " " + Selector.LINK,
- animationSpeed: 300,
- accordion: true,
- expandSidebar: false,
- sidebarButtonSelector: '[data-widget="pushmenu"]'
- };
- /**
- * Class Definition
- * ====================================================
- */
+ /**
+ * Constants
+ * ====================================================
+ */
- var Treeview = /*#__PURE__*/function () {
- function Treeview(element, config) {
- this._config = config;
- this._element = element;
- } // Public
+ var NAME$8 = 'Layout';
+ var DATA_KEY$8 = 'lte.layout';
+ var JQUERY_NO_CONFLICT$8 = $__default['default'].fn[NAME$8];
+ var SELECTOR_HEADER$1 = '.main-header';
+ var SELECTOR_MAIN_SIDEBAR = '.main-sidebar';
+ var SELECTOR_SIDEBAR = '.main-sidebar .sidebar';
+ var SELECTOR_CONTENT = '.content-wrapper';
+ var SELECTOR_CONTROL_SIDEBAR_CONTENT$1 = '.control-sidebar-content';
+ var SELECTOR_CONTROL_SIDEBAR_BTN = '[data-widget="control-sidebar"]';
+ var SELECTOR_FOOTER$1 = '.main-footer';
+ var SELECTOR_PUSHMENU_BTN = '[data-widget="pushmenu"]';
+ var SELECTOR_LOGIN_BOX = '.login-box';
+ var SELECTOR_REGISTER_BOX = '.register-box';
+ var CLASS_NAME_SIDEBAR_FOCUSED = 'sidebar-focused';
+ var CLASS_NAME_LAYOUT_FIXED$1 = 'layout-fixed';
+ var CLASS_NAME_CONTROL_SIDEBAR_SLIDE_OPEN = 'control-sidebar-slide-open';
+ var CLASS_NAME_CONTROL_SIDEBAR_OPEN$1 = 'control-sidebar-open';
+ var Default$6 = {
+ scrollbarTheme: 'os-theme-light',
+ scrollbarAutoHide: 'l',
+ panelAutoHeight: true,
+ panelAutoHeightMode: 'min-height',
+ loginRegisterAutoHeight: true
+ };
+ /**
+ * Class Definition
+ * ====================================================
+ */
+ var Layout = /*#__PURE__*/function () {
+ function Layout(element, config) {
+ this._config = config;
+ this._element = element;
- var _proto = Treeview.prototype;
+ this._init();
+ } // Public
- _proto.init = function init() {
- this._setupListeners();
- };
- _proto.expand = function expand(treeviewMenu, parentLi) {
- var _this = this;
+ var _proto = Layout.prototype;
- var expandedEvent = $.Event(Event.EXPANDED);
+ _proto.fixLayoutHeight = function fixLayoutHeight(extra) {
+ if (extra === void 0) {
+ extra = null;
+ }
- if (this._config.accordion) {
- var openMenuLi = parentLi.siblings(Selector.OPEN).first();
- var openTreeview = openMenuLi.find(Selector.TREEVIEW_MENU).first();
- this.collapse(openTreeview, openMenuLi);
- }
+ var $body = $__default['default']('body');
+ var controlSidebar = 0;
- treeviewMenu.stop().slideDown(this._config.animationSpeed, function () {
- parentLi.addClass(ClassName.OPEN);
- $(_this._element).trigger(expandedEvent);
- });
+ if ($body.hasClass(CLASS_NAME_CONTROL_SIDEBAR_SLIDE_OPEN) || $body.hasClass(CLASS_NAME_CONTROL_SIDEBAR_OPEN$1) || extra === 'control_sidebar') {
+ controlSidebar = $__default['default'](SELECTOR_CONTROL_SIDEBAR_CONTENT$1).height();
+ }
- if (this._config.expandSidebar) {
- this._expandSidebar();
- }
+ var heights = {
+ window: $__default['default'](window).height(),
+ header: $__default['default'](SELECTOR_HEADER$1).length !== 0 ? $__default['default'](SELECTOR_HEADER$1).outerHeight() : 0,
+ footer: $__default['default'](SELECTOR_FOOTER$1).length !== 0 ? $__default['default'](SELECTOR_FOOTER$1).outerHeight() : 0,
+ sidebar: $__default['default'](SELECTOR_SIDEBAR).length !== 0 ? $__default['default'](SELECTOR_SIDEBAR).height() : 0,
+ controlSidebar: controlSidebar
};
- _proto.collapse = function collapse(treeviewMenu, parentLi) {
- var _this2 = this;
+ var max = this._max(heights);
- var collapsedEvent = $.Event(Event.COLLAPSED);
- treeviewMenu.stop().slideUp(this._config.animationSpeed, function () {
- parentLi.removeClass(ClassName.OPEN);
- $(_this2._element).trigger(collapsedEvent);
- treeviewMenu.find(Selector.OPEN + " > " + Selector.TREEVIEW_MENU).slideUp();
- treeviewMenu.find(Selector.OPEN).removeClass(ClassName.OPEN);
- });
- };
+ var offset = this._config.panelAutoHeight;
- _proto.toggle = function toggle(event) {
- var $relativeTarget = $(event.currentTarget);
- var $parent = $relativeTarget.parent();
- var treeviewMenu = $parent.find('> ' + Selector.TREEVIEW_MENU);
+ if (offset === true) {
+ offset = 0;
+ }
- if (!treeviewMenu.is(Selector.TREEVIEW_MENU)) {
- if (!$parent.is(Selector.LI)) {
- treeviewMenu = $parent.parent().find('> ' + Selector.TREEVIEW_MENU);
- }
+ var $contentSelector = $__default['default'](SELECTOR_CONTENT);
- if (!treeviewMenu.is(Selector.TREEVIEW_MENU)) {
- return;
- }
+ if (offset !== false) {
+ if (max === heights.controlSidebar) {
+ $contentSelector.css(this._config.panelAutoHeightMode, max + offset);
+ } else if (max === heights.window) {
+ $contentSelector.css(this._config.panelAutoHeightMode, max + offset - heights.header - heights.footer);
+ } else {
+ $contentSelector.css(this._config.panelAutoHeightMode, max + offset - heights.header);
}
- event.preventDefault();
- var parentLi = $relativeTarget.parents(Selector.LI).first();
- var isOpen = parentLi.hasClass(ClassName.OPEN);
-
- if (isOpen) {
- this.collapse($(treeviewMenu), parentLi);
- } else {
- this.expand($(treeviewMenu), parentLi);
+ if (this._isFooterFixed()) {
+ $contentSelector.css(this._config.panelAutoHeightMode, parseFloat($contentSelector.css(this._config.panelAutoHeightMode)) + heights.footer);
}
- } // Private
- ;
+ }
- _proto._setupListeners = function _setupListeners() {
- var _this3 = this;
+ if (!$body.hasClass(CLASS_NAME_LAYOUT_FIXED$1)) {
+ return;
+ }
+
+ if (offset !== false) {
+ $contentSelector.css(this._config.panelAutoHeightMode, max + offset - heights.header - heights.footer);
+ }
- $(document).on('click', this._config.trigger, function (event) {
- _this3.toggle(event);
+ if (typeof $__default['default'].fn.overlayScrollbars !== 'undefined') {
+ $__default['default'](SELECTOR_SIDEBAR).overlayScrollbars({
+ className: this._config.scrollbarTheme,
+ sizeAutoCapable: true,
+ scrollbars: {
+ autoHide: this._config.scrollbarAutoHide,
+ clickScrolling: true
+ }
});
- };
+ }
+ };
- _proto._expandSidebar = function _expandSidebar() {
- if ($('body').hasClass(ClassName.SIDEBAR_COLLAPSED)) {
- $(this._config.sidebarButtonSelector).PushMenu('expand');
- }
- } // Static
- ;
+ _proto.fixLoginRegisterHeight = function fixLoginRegisterHeight() {
+ var $body = $__default['default']('body');
+ var $selector = $__default['default'](SELECTOR_LOGIN_BOX + ", " + SELECTOR_REGISTER_BOX);
- Treeview._jQueryInterface = function _jQueryInterface(config) {
- return this.each(function () {
- var data = $(this).data(DATA_KEY);
+ if ($selector.length === 0) {
+ $body.css('height', 'auto');
+ $__default['default']('html').css('height', 'auto');
+ } else {
+ var boxHeight = $selector.height();
- var _options = $.extend({}, Default, $(this).data());
+ if ($body.css(this._config.panelAutoHeightMode) !== boxHeight) {
+ $body.css(this._config.panelAutoHeightMode, boxHeight);
+ }
+ }
+ } // Private
+ ;
- if (!data) {
- data = new Treeview($(this), _options);
- $(this).data(DATA_KEY, data);
- }
+ _proto._init = function _init() {
+ var _this = this;
- if (config === 'init') {
- data[config]();
- }
- });
- };
+ // Activate layout height watcher
+ this.fixLayoutHeight();
- return Treeview;
- }();
- /**
- * Data API
- * ====================================================
- */
+ if (this._config.loginRegisterAutoHeight === true) {
+ this.fixLoginRegisterHeight();
+ } else if (this._config.loginRegisterAutoHeight === parseInt(this._config.loginRegisterAutoHeight, 10)) {
+ setInterval(this.fixLoginRegisterHeight, this._config.loginRegisterAutoHeight);
+ }
+ $__default['default'](SELECTOR_SIDEBAR).on('collapsed.lte.treeview expanded.lte.treeview', function () {
+ _this.fixLayoutHeight();
+ });
+ $__default['default'](SELECTOR_PUSHMENU_BTN).on('collapsed.lte.pushmenu shown.lte.pushmenu', function () {
+ _this.fixLayoutHeight();
+ });
+ $__default['default'](SELECTOR_CONTROL_SIDEBAR_BTN).on('collapsed.lte.controlsidebar', function () {
+ _this.fixLayoutHeight();
+ }).on('expanded.lte.controlsidebar', function () {
+ _this.fixLayoutHeight('control_sidebar');
+ });
+ $__default['default'](window).resize(function () {
+ _this.fixLayoutHeight();
+ });
+ setTimeout(function () {
+ $__default['default']('body.hold-transition').removeClass('hold-transition');
+ }, 50);
+ };
- $(window).on(Event.LOAD_DATA_API, function () {
- $(Selector.DATA_WIDGET).each(function () {
- Treeview._jQueryInterface.call($(this), 'init');
+ _proto._max = function _max(numbers) {
+ // Calculate the maximum number in a list
+ var max = 0;
+ Object.keys(numbers).forEach(function (key) {
+ if (numbers[key] > max) {
+ max = numbers[key];
+ }
});
- });
- /**
- * jQuery API
- * ====================================================
- */
+ return max;
+ };
+
+ _proto._isFooterFixed = function _isFooterFixed() {
+ return $__default['default'](SELECTOR_FOOTER$1).css('position') === 'fixed';
+ } // Static
+ ;
+
+ Layout._jQueryInterface = function _jQueryInterface(config) {
+ if (config === void 0) {
+ config = '';
+ }
+
+ return this.each(function () {
+ var data = $__default['default'](this).data(DATA_KEY$8);
- $.fn[NAME] = Treeview._jQueryInterface;
- $.fn[NAME].Constructor = Treeview;
+ var _options = $__default['default'].extend({}, Default$6, $__default['default'](this).data());
- $.fn[NAME].noConflict = function () {
- $.fn[NAME] = JQUERY_NO_CONFLICT;
- return Treeview._jQueryInterface;
+ if (!data) {
+ data = new Layout($__default['default'](this), _options);
+ $__default['default'](this).data(DATA_KEY$8, data);
+ }
+
+ if (config === 'init' || config === '') {
+ data._init();
+ } else if (config === 'fixLayoutHeight' || config === 'fixLoginRegisterHeight') {
+ data[config]();
+ }
+ });
};
- return Treeview;
- }(jQuery);
+ return Layout;
+ }();
+ /**
+ * Data API
+ * ====================================================
+ */
+
+
+ $__default['default'](window).on('load', function () {
+ Layout._jQueryInterface.call($__default['default']('body'));
+ });
+ $__default['default'](SELECTOR_SIDEBAR + " a").on('focusin', function () {
+ $__default['default'](SELECTOR_MAIN_SIDEBAR).addClass(CLASS_NAME_SIDEBAR_FOCUSED);
+ });
+ $__default['default'](SELECTOR_SIDEBAR + " a").on('focusout', function () {
+ $__default['default'](SELECTOR_MAIN_SIDEBAR).removeClass(CLASS_NAME_SIDEBAR_FOCUSED);
+ });
+ /**
+ * jQuery API
+ * ====================================================
+ */
+
+ $__default['default'].fn[NAME$8] = Layout._jQueryInterface;
+ $__default['default'].fn[NAME$8].Constructor = Layout;
+
+ $__default['default'].fn[NAME$8].noConflict = function () {
+ $__default['default'].fn[NAME$8] = JQUERY_NO_CONFLICT$8;
+ return Layout._jQueryInterface;
+ };
/**
* --------------------------------------------
- * AdminLTE DirectChat.js
+ * AdminLTE PushMenu.js
* License MIT
* --------------------------------------------
*/
- var DirectChat = function ($) {
- /**
- * Constants
- * ====================================================
- */
- var NAME = 'DirectChat';
- var DATA_KEY = 'lte.directchat';
- var JQUERY_NO_CONFLICT = $.fn[NAME];
- var Event = {
- TOGGLED: "toggled{EVENT_KEY}"
- };
- var Selector = {
- DATA_TOGGLE: '[data-widget="chat-pane-toggle"]',
- DIRECT_CHAT: '.direct-chat'
- };
- var ClassName = {
- DIRECT_CHAT_OPEN: 'direct-chat-contacts-open'
- };
- /**
- * Class Definition
- * ====================================================
- */
+ /**
+ * Constants
+ * ====================================================
+ */
+
+ var NAME$9 = 'PushMenu';
+ var DATA_KEY$9 = 'lte.pushmenu';
+ var EVENT_KEY$5 = "." + DATA_KEY$9;
+ var JQUERY_NO_CONFLICT$9 = $__default['default'].fn[NAME$9];
+ var EVENT_COLLAPSED$3 = "collapsed" + EVENT_KEY$5;
+ var EVENT_SHOWN = "shown" + EVENT_KEY$5;
+ var SELECTOR_TOGGLE_BUTTON = '[data-widget="pushmenu"]';
+ var SELECTOR_BODY = 'body';
+ var SELECTOR_OVERLAY = '#sidebar-overlay';
+ var SELECTOR_WRAPPER = '.wrapper';
+ var CLASS_NAME_COLLAPSED$1 = 'sidebar-collapse';
+ var CLASS_NAME_OPEN = 'sidebar-open';
+ var CLASS_NAME_IS_OPENING = 'sidebar-is-opening';
+ var CLASS_NAME_CLOSED = 'sidebar-closed';
+ var Default$7 = {
+ autoCollapseSize: 992,
+ enableRemember: false,
+ noTransitionAfterReload: true
+ };
+ /**
+ * Class Definition
+ * ====================================================
+ */
- var DirectChat = /*#__PURE__*/function () {
- function DirectChat(element, config) {
- this._element = element;
+ var PushMenu = /*#__PURE__*/function () {
+ function PushMenu(element, options) {
+ this._element = element;
+ this._options = $__default['default'].extend({}, Default$7, options);
+
+ if ($__default['default'](SELECTOR_OVERLAY).length === 0) {
+ this._addOverlay();
}
- var _proto = DirectChat.prototype;
+ this._init();
+ } // Public
- _proto.toggle = function toggle() {
- $(this._element).parents(Selector.DIRECT_CHAT).first().toggleClass(ClassName.DIRECT_CHAT_OPEN);
- var toggledEvent = $.Event(Event.TOGGLED);
- $(this._element).trigger(toggledEvent);
- } // Static
- ;
- DirectChat._jQueryInterface = function _jQueryInterface(config) {
- return this.each(function () {
- var data = $(this).data(DATA_KEY);
+ var _proto = PushMenu.prototype;
- if (!data) {
- data = new DirectChat($(this));
- $(this).data(DATA_KEY, data);
- }
+ _proto.expand = function expand() {
+ var $bodySelector = $__default['default'](SELECTOR_BODY);
- data[config]();
- });
- };
+ if (this._options.autoCollapseSize) {
+ if ($__default['default'](window).width() <= this._options.autoCollapseSize) {
+ $bodySelector.addClass(CLASS_NAME_OPEN);
+ }
+ }
- return DirectChat;
- }();
- /**
- *
- * Data Api implementation
- * ====================================================
- */
+ $bodySelector.addClass(CLASS_NAME_IS_OPENING).removeClass(CLASS_NAME_COLLAPSED$1 + " " + CLASS_NAME_CLOSED).delay(50).queue(function () {
+ $bodySelector.removeClass(CLASS_NAME_IS_OPENING);
+ $__default['default'](this).dequeue();
+ });
+ if (this._options.enableRemember) {
+ localStorage.setItem("remember" + EVENT_KEY$5, CLASS_NAME_OPEN);
+ }
- $(document).on('click', Selector.DATA_TOGGLE, function (event) {
- if (event) event.preventDefault();
+ $__default['default'](this._element).trigger($__default['default'].Event(EVENT_SHOWN));
+ };
- DirectChat._jQueryInterface.call($(this), 'toggle');
- });
- /**
- * jQuery API
- * ====================================================
- */
+ _proto.collapse = function collapse() {
+ var $bodySelector = $__default['default'](SELECTOR_BODY);
- $.fn[NAME] = DirectChat._jQueryInterface;
- $.fn[NAME].Constructor = DirectChat;
+ if (this._options.autoCollapseSize) {
+ if ($__default['default'](window).width() <= this._options.autoCollapseSize) {
+ $bodySelector.removeClass(CLASS_NAME_OPEN).addClass(CLASS_NAME_CLOSED);
+ }
+ }
- $.fn[NAME].noConflict = function () {
- $.fn[NAME] = JQUERY_NO_CONFLICT;
- return DirectChat._jQueryInterface;
- };
+ $bodySelector.addClass(CLASS_NAME_COLLAPSED$1);
- return DirectChat;
- }(jQuery);
+ if (this._options.enableRemember) {
+ localStorage.setItem("remember" + EVENT_KEY$5, CLASS_NAME_COLLAPSED$1);
+ }
- /**
- * --------------------------------------------
- * AdminLTE TodoList.js
- * License MIT
- * --------------------------------------------
- */
- var TodoList = function ($) {
- /**
- * Constants
- * ====================================================
- */
- var NAME = 'TodoList';
- var DATA_KEY = 'lte.todolist';
- var JQUERY_NO_CONFLICT = $.fn[NAME];
- var Selector = {
- DATA_TOGGLE: '[data-widget="todo-list"]'
- };
- var ClassName = {
- TODO_LIST_DONE: 'done'
+ $__default['default'](this._element).trigger($__default['default'].Event(EVENT_COLLAPSED$3));
};
- var Default = {
- onCheck: function onCheck(item) {
- return item;
- },
- onUnCheck: function onUnCheck(item) {
- return item;
+
+ _proto.toggle = function toggle() {
+ if ($__default['default'](SELECTOR_BODY).hasClass(CLASS_NAME_COLLAPSED$1)) {
+ this.expand();
+ } else {
+ this.collapse();
}
};
- /**
- * Class Definition
- * ====================================================
- */
- var TodoList = /*#__PURE__*/function () {
- function TodoList(element, config) {
- this._config = config;
- this._element = element;
+ _proto.autoCollapse = function autoCollapse(resize) {
+ if (resize === void 0) {
+ resize = false;
+ }
+
+ if (!this._options.autoCollapseSize) {
+ return;
+ }
- this._init();
- } // Public
+ var $bodySelector = $__default['default'](SELECTOR_BODY);
+ if ($__default['default'](window).width() <= this._options.autoCollapseSize) {
+ if (!$bodySelector.hasClass(CLASS_NAME_OPEN)) {
+ this.collapse();
+ }
+ } else if (resize === true) {
+ if ($bodySelector.hasClass(CLASS_NAME_OPEN)) {
+ $bodySelector.removeClass(CLASS_NAME_OPEN);
+ } else if ($bodySelector.hasClass(CLASS_NAME_CLOSED)) {
+ this.expand();
+ }
+ }
+ };
- var _proto = TodoList.prototype;
+ _proto.remember = function remember() {
+ if (!this._options.enableRemember) {
+ return;
+ }
- _proto.toggle = function toggle(item) {
- item.parents('li').toggleClass(ClassName.TODO_LIST_DONE);
+ var $body = $__default['default']('body');
+ var toggleState = localStorage.getItem("remember" + EVENT_KEY$5);
- if (!$(item).prop('checked')) {
- this.unCheck($(item));
- return;
+ if (toggleState === CLASS_NAME_COLLAPSED$1) {
+ if (this._options.noTransitionAfterReload) {
+ $body.addClass('hold-transition').addClass(CLASS_NAME_COLLAPSED$1).delay(50).queue(function () {
+ $__default['default'](this).removeClass('hold-transition');
+ $__default['default'](this).dequeue();
+ });
+ } else {
+ $body.addClass(CLASS_NAME_COLLAPSED$1);
}
+ } else if (this._options.noTransitionAfterReload) {
+ $body.addClass('hold-transition').removeClass(CLASS_NAME_COLLAPSED$1).delay(50).queue(function () {
+ $__default['default'](this).removeClass('hold-transition');
+ $__default['default'](this).dequeue();
+ });
+ } else {
+ $body.removeClass(CLASS_NAME_COLLAPSED$1);
+ }
+ } // Private
+ ;
- this.check(item);
- };
+ _proto._init = function _init() {
+ var _this = this;
- _proto.check = function check(item) {
- this._config.onCheck.call(item);
- };
+ this.remember();
+ this.autoCollapse();
+ $__default['default'](window).resize(function () {
+ _this.autoCollapse(true);
+ });
+ };
- _proto.unCheck = function unCheck(item) {
- this._config.onUnCheck.call(item);
- } // Private
- ;
+ _proto._addOverlay = function _addOverlay() {
+ var _this2 = this;
- _proto._init = function _init() {
- var that = this;
- $(Selector.DATA_TOGGLE).find('input:checkbox:checked').parents('li').toggleClass(ClassName.TODO_LIST_DONE);
- $(Selector.DATA_TOGGLE).on('change', 'input:checkbox', function (event) {
- that.toggle($(event.target));
- });
- } // Static
- ;
+ var overlay = $__default['default']('', {
+ id: 'sidebar-overlay'
+ });
+ overlay.on('click', function () {
+ _this2.collapse();
+ });
+ $__default['default'](SELECTOR_WRAPPER).append(overlay);
+ } // Static
+ ;
- TodoList._jQueryInterface = function _jQueryInterface(config) {
- return this.each(function () {
- var data = $(this).data(DATA_KEY);
+ PushMenu._jQueryInterface = function _jQueryInterface(operation) {
+ return this.each(function () {
+ var data = $__default['default'](this).data(DATA_KEY$9);
- var _options = $.extend({}, Default, $(this).data());
+ var _options = $__default['default'].extend({}, Default$7, $__default['default'](this).data());
- if (!data) {
- data = new TodoList($(this), _options);
- $(this).data(DATA_KEY, data);
- }
+ if (!data) {
+ data = new PushMenu(this, _options);
+ $__default['default'](this).data(DATA_KEY$9, data);
+ }
+
+ if (typeof operation === 'string' && operation.match(/collapse|expand|toggle/)) {
+ data[operation]();
+ }
+ });
+ };
- if (config === 'init') {
- data[config]();
- }
- });
- };
+ return PushMenu;
+ }();
+ /**
+ * Data API
+ * ====================================================
+ */
- return TodoList;
- }();
- /**
- * Data API
- * ====================================================
- */
+ $__default['default'](document).on('click', SELECTOR_TOGGLE_BUTTON, function (event) {
+ event.preventDefault();
+ var button = event.currentTarget;
- $(window).on('load', function () {
- TodoList._jQueryInterface.call($(Selector.DATA_TOGGLE));
- });
- /**
- * jQuery API
- * ====================================================
- */
+ if ($__default['default'](button).data('widget') !== 'pushmenu') {
+ button = $__default['default'](button).closest(SELECTOR_TOGGLE_BUTTON);
+ }
- $.fn[NAME] = TodoList._jQueryInterface;
- $.fn[NAME].Constructor = TodoList;
+ PushMenu._jQueryInterface.call($__default['default'](button), 'toggle');
+ });
+ $__default['default'](window).on('load', function () {
+ PushMenu._jQueryInterface.call($__default['default'](SELECTOR_TOGGLE_BUTTON));
+ });
+ /**
+ * jQuery API
+ * ====================================================
+ */
- $.fn[NAME].noConflict = function () {
- $.fn[NAME] = JQUERY_NO_CONFLICT;
- return TodoList._jQueryInterface;
- };
+ $__default['default'].fn[NAME$9] = PushMenu._jQueryInterface;
+ $__default['default'].fn[NAME$9].Constructor = PushMenu;
- return TodoList;
- }(jQuery);
+ $__default['default'].fn[NAME$9].noConflict = function () {
+ $__default['default'].fn[NAME$9] = JQUERY_NO_CONFLICT$9;
+ return PushMenu._jQueryInterface;
+ };
/**
* --------------------------------------------
- * AdminLTE CardWidget.js
+ * AdminLTE SidebarSearch.js
* License MIT
* --------------------------------------------
*/
- var CardWidget = function ($) {
- /**
- * Constants
- * ====================================================
- */
- var NAME = 'CardWidget';
- var DATA_KEY = 'lte.cardwidget';
- var EVENT_KEY = "." + DATA_KEY;
- var JQUERY_NO_CONFLICT = $.fn[NAME];
- var Event = {
- EXPANDED: "expanded" + EVENT_KEY,
- COLLAPSED: "collapsed" + EVENT_KEY,
- MAXIMIZED: "maximized" + EVENT_KEY,
- MINIMIZED: "minimized" + EVENT_KEY,
- REMOVED: "removed" + EVENT_KEY
- };
- var ClassName = {
- CARD: 'card',
- COLLAPSED: 'collapsed-card',
- COLLAPSING: 'collapsing-card',
- EXPANDING: 'expanding-card',
- WAS_COLLAPSED: 'was-collapsed',
- MAXIMIZED: 'maximized-card'
- };
- var Selector = {
- DATA_REMOVE: '[data-card-widget="remove"]',
- DATA_COLLAPSE: '[data-card-widget="collapse"]',
- DATA_MAXIMIZE: '[data-card-widget="maximize"]',
- CARD: "." + ClassName.CARD,
- CARD_HEADER: '.card-header',
- CARD_BODY: '.card-body',
- CARD_FOOTER: '.card-footer',
- COLLAPSED: "." + ClassName.COLLAPSED
- };
- var Default = {
- animationSpeed: 'normal',
- collapseTrigger: Selector.DATA_COLLAPSE,
- removeTrigger: Selector.DATA_REMOVE,
- maximizeTrigger: Selector.DATA_MAXIMIZE,
- collapseIcon: 'fa-minus',
- expandIcon: 'fa-plus',
- maximizeIcon: 'fa-expand',
- minimizeIcon: 'fa-compress'
- };
+ /**
+ * Constants
+ * ====================================================
+ */
- var CardWidget = /*#__PURE__*/function () {
- function CardWidget(element, settings) {
- this._element = element;
- this._parent = element.parents(Selector.CARD).first();
+ var NAME$a = 'SidebarSearch';
+ var DATA_KEY$a = 'lte.sidebar-search';
+ var JQUERY_NO_CONFLICT$a = $__default['default'].fn[NAME$a];
+ var CLASS_NAME_OPEN$1 = 'sidebar-search-open';
+ var CLASS_NAME_ICON_SEARCH = 'fa-search';
+ var CLASS_NAME_ICON_CLOSE = 'fa-times';
+ var CLASS_NAME_HEADER = 'nav-header';
+ var CLASS_NAME_SEARCH_RESULTS = 'sidebar-search-results';
+ var CLASS_NAME_LIST_GROUP = 'list-group';
+ var SELECTOR_DATA_WIDGET$1 = '[data-widget="sidebar-search"]';
+ var SELECTOR_SIDEBAR$1 = '.main-sidebar .nav-sidebar';
+ var SELECTOR_NAV_LINK = '.nav-link';
+ var SELECTOR_NAV_TREEVIEW = '.nav-treeview';
+ var SELECTOR_SEARCH_INPUT = SELECTOR_DATA_WIDGET$1 + " .form-control";
+ var SELECTOR_SEARCH_BUTTON = SELECTOR_DATA_WIDGET$1 + " .btn";
+ var SELECTOR_SEARCH_ICON = SELECTOR_SEARCH_BUTTON + " i";
+ var SELECTOR_SEARCH_LIST_GROUP = "." + CLASS_NAME_LIST_GROUP;
+ var SELECTOR_SEARCH_RESULTS = "." + CLASS_NAME_SEARCH_RESULTS;
+ var SELECTOR_SEARCH_RESULTS_GROUP = SELECTOR_SEARCH_RESULTS + " ." + CLASS_NAME_LIST_GROUP;
+ var Default$8 = {
+ arrowSign: '->',
+ minLength: 3,
+ maxResults: 7,
+ highlightName: true,
+ highlightPath: false,
+ highlightClass: 'text-light',
+ notFoundText: 'No element found!'
+ };
+ var SearchItems = [];
+ /**
+ * Class Definition
+ * ====================================================
+ */
- if (element.hasClass(ClassName.CARD)) {
- this._parent = element;
- }
+ var SidebarSearch = /*#__PURE__*/function () {
+ function SidebarSearch(_element, _options) {
+ this.element = _element;
+ this.options = $__default['default'].extend({}, Default$8, _options);
+ this.items = [];
+ } // Public
- this._settings = $.extend({}, Default, settings);
- }
- var _proto = CardWidget.prototype;
+ var _proto = SidebarSearch.prototype;
- _proto.collapse = function collapse() {
- var _this = this;
+ _proto.init = function init() {
+ var _this = this;
- this._parent.addClass(ClassName.COLLAPSING).children(Selector.CARD_BODY + ", " + Selector.CARD_FOOTER).slideUp(this._settings.animationSpeed, function () {
- _this._parent.addClass(ClassName.COLLAPSED).removeClass(ClassName.COLLAPSING);
- });
+ if ($__default['default'](SELECTOR_DATA_WIDGET$1).length == 0) {
+ return;
+ }
- this._parent.find('> ' + Selector.CARD_HEADER + ' ' + this._settings.collapseTrigger + ' .' + this._settings.collapseIcon).addClass(this._settings.expandIcon).removeClass(this._settings.collapseIcon);
+ if ($__default['default'](SELECTOR_DATA_WIDGET$1).next(SELECTOR_SEARCH_RESULTS).length == 0) {
+ $__default['default'](SELECTOR_DATA_WIDGET$1).after($__default['default']('', {
+ class: CLASS_NAME_SEARCH_RESULTS
+ }));
+ }
- var collapsed = $.Event(Event.COLLAPSED);
+ if ($__default['default'](SELECTOR_SEARCH_RESULTS).children(SELECTOR_SEARCH_LIST_GROUP).length == 0) {
+ $__default['default'](SELECTOR_SEARCH_RESULTS).append($__default['default']('', {
+ class: CLASS_NAME_LIST_GROUP
+ }));
+ }
- this._element.trigger(collapsed, this._parent);
- };
+ this._addNotFound();
- _proto.expand = function expand() {
- var _this2 = this;
+ $__default['default'](SELECTOR_SIDEBAR$1).children().each(function (i, child) {
+ _this._parseItem(child);
+ });
+ };
- this._parent.addClass(ClassName.EXPANDING).children(Selector.CARD_BODY + ", " + Selector.CARD_FOOTER).slideDown(this._settings.animationSpeed, function () {
- _this2._parent.removeClass(ClassName.COLLAPSED).removeClass(ClassName.EXPANDING);
- });
+ _proto.search = function search() {
+ var _this2 = this;
- this._parent.find('> ' + Selector.CARD_HEADER + ' ' + this._settings.collapseTrigger + ' .' + this._settings.expandIcon).addClass(this._settings.collapseIcon).removeClass(this._settings.expandIcon);
+ var searchValue = $__default['default'](SELECTOR_SEARCH_INPUT).val().toLowerCase();
- var expanded = $.Event(Event.EXPANDED);
+ if (searchValue.length < this.options.minLength) {
+ $__default['default'](SELECTOR_SEARCH_RESULTS_GROUP).empty();
- this._element.trigger(expanded, this._parent);
- };
+ this._addNotFound();
- _proto.remove = function remove() {
- this._parent.slideUp();
+ this.close();
+ return;
+ }
- var removed = $.Event(Event.REMOVED);
+ var searchResults = SearchItems.filter(function (item) {
+ return item.name.toLowerCase().includes(searchValue);
+ });
+ var endResults = $__default['default'](searchResults.slice(0, this.options.maxResults));
+ $__default['default'](SELECTOR_SEARCH_RESULTS_GROUP).empty();
+
+ if (endResults.length === 0) {
+ this._addNotFound();
+ } else {
+ endResults.each(function (i, result) {
+ $__default['default'](SELECTOR_SEARCH_RESULTS_GROUP).append(_this2._renderItem(result.name, result.link, result.path));
+ });
+ }
- this._element.trigger(removed, this._parent);
- };
+ this.open();
+ };
- _proto.toggle = function toggle() {
- if (this._parent.hasClass(ClassName.COLLAPSED)) {
- this.expand();
- return;
- }
+ _proto.open = function open() {
+ $__default['default'](SELECTOR_DATA_WIDGET$1).parent().addClass(CLASS_NAME_OPEN$1);
+ $__default['default'](SELECTOR_SEARCH_ICON).removeClass(CLASS_NAME_ICON_SEARCH).addClass(CLASS_NAME_ICON_CLOSE);
+ };
- this.collapse();
- };
+ _proto.close = function close() {
+ $__default['default'](SELECTOR_DATA_WIDGET$1).parent().removeClass(CLASS_NAME_OPEN$1);
+ $__default['default'](SELECTOR_SEARCH_ICON).removeClass(CLASS_NAME_ICON_CLOSE).addClass(CLASS_NAME_ICON_SEARCH);
+ };
- _proto.maximize = function maximize() {
- this._parent.find(this._settings.maximizeTrigger + ' .' + this._settings.maximizeIcon).addClass(this._settings.minimizeIcon).removeClass(this._settings.maximizeIcon);
+ _proto.toggle = function toggle() {
+ if ($__default['default'](SELECTOR_DATA_WIDGET$1).parent().hasClass(CLASS_NAME_OPEN$1)) {
+ this.close();
+ } else {
+ this.open();
+ }
+ } // Private
+ ;
- this._parent.css({
- 'height': this._parent.height(),
- 'width': this._parent.width(),
- 'transition': 'all .15s'
- }).delay(150).queue(function () {
- $(this).addClass(ClassName.MAXIMIZED);
- $('html').addClass(ClassName.MAXIMIZED);
+ _proto._parseItem = function _parseItem(item, path) {
+ var _this3 = this;
- if ($(this).hasClass(ClassName.COLLAPSED)) {
- $(this).addClass(ClassName.WAS_COLLAPSED);
- }
+ if (path === void 0) {
+ path = [];
+ }
+
+ if ($__default['default'](item).hasClass(CLASS_NAME_HEADER)) {
+ return;
+ }
- $(this).dequeue();
+ var itemObject = {};
+ var navLink = $__default['default'](item).clone().find("> " + SELECTOR_NAV_LINK);
+ var navTreeview = $__default['default'](item).clone().find("> " + SELECTOR_NAV_TREEVIEW);
+ var link = navLink.attr('href');
+ var name = navLink.find('p').children().remove().end().text();
+ itemObject.name = this._trimText(name);
+ itemObject.link = link;
+ itemObject.path = path;
+
+ if (navTreeview.length === 0) {
+ SearchItems.push(itemObject);
+ } else {
+ var newPath = itemObject.path.concat([itemObject.name]);
+ navTreeview.children().each(function (i, child) {
+ _this3._parseItem(child, newPath);
});
+ }
+ };
- var maximized = $.Event(Event.MAXIMIZED);
+ _proto._trimText = function _trimText(text) {
+ return $.trim(text.replace(/(\r\n|\n|\r)/gm, ' '));
+ };
- this._element.trigger(maximized, this._parent);
- };
+ _proto._renderItem = function _renderItem(name, link, path) {
+ var _this4 = this;
- _proto.minimize = function minimize() {
- this._parent.find(this._settings.maximizeTrigger + ' .' + this._settings.minimizeIcon).addClass(this._settings.maximizeIcon).removeClass(this._settings.minimizeIcon);
+ path = path.join(" " + this.options.arrowSign + " ");
- this._parent.css('cssText', 'height:' + this._parent[0].style.height + ' !important;' + 'width:' + this._parent[0].style.width + ' !important; transition: all .15s;').delay(10).queue(function () {
- $(this).removeClass(ClassName.MAXIMIZED);
- $('html').removeClass(ClassName.MAXIMIZED);
- $(this).css({
- 'height': 'inherit',
- 'width': 'inherit'
- });
+ if (this.options.highlightName || this.options.highlightPath) {
+ var searchValue = $__default['default'](SELECTOR_SEARCH_INPUT).val().toLowerCase();
+ var regExp = new RegExp(searchValue, 'gi');
- if ($(this).hasClass(ClassName.WAS_COLLAPSED)) {
- $(this).removeClass(ClassName.WAS_COLLAPSED);
- }
+ if (this.options.highlightName) {
+ name = name.replace(regExp, function (str) {
+ return "" + str + "";
+ });
+ }
- $(this).dequeue();
- });
+ if (this.options.highlightPath) {
+ path = path.replace(regExp, function (str) {
+ return "" + str + "";
+ });
+ }
+ }
- var MINIMIZED = $.Event(Event.MINIMIZED);
+ return "\n \n " + name + "\n
\n \n " + path + "\n
\n ";
+ };
- this._element.trigger(MINIMIZED, this._parent);
- };
+ _proto._addNotFound = function _addNotFound() {
+ $__default['default'](SELECTOR_SEARCH_RESULTS_GROUP).append(this._renderItem(this.options.notFoundText, '#', []));
+ } // Static
+ ;
- _proto.toggleMaximize = function toggleMaximize() {
- if (this._parent.hasClass(ClassName.MAXIMIZED)) {
- this.minimize();
- return;
- }
+ SidebarSearch._jQueryInterface = function _jQueryInterface(config) {
+ var data = $__default['default'](this).data(DATA_KEY$a);
- this.maximize();
- } // Private
- ;
+ if (!data) {
+ data = $__default['default'](this).data();
+ }
- _proto._init = function _init(card) {
- var _this3 = this;
+ var _options = $__default['default'].extend({}, Default$8, typeof config === 'object' ? config : data);
- this._parent = card;
- $(this).find(this._settings.collapseTrigger).click(function () {
- _this3.toggle();
- });
- $(this).find(this._settings.maximizeTrigger).click(function () {
- _this3.toggleMaximize();
- });
- $(this).find(this._settings.removeTrigger).click(function () {
- _this3.remove();
- });
- } // Static
- ;
+ var plugin = new SidebarSearch($__default['default'](this), _options);
+ $__default['default'](this).data(DATA_KEY$a, typeof config === 'object' ? config : data);
- CardWidget._jQueryInterface = function _jQueryInterface(config) {
- var data = $(this).data(DATA_KEY);
+ if (typeof config === 'string' && config.match(/init|toggle|close|open|search/)) {
+ plugin[config]();
+ } else {
+ plugin.init();
+ }
+ };
- var _options = $.extend({}, Default, $(this).data());
+ return SidebarSearch;
+ }();
+ /**
+ * Data API
+ * ====================================================
+ */
- if (!data) {
- data = new CardWidget($(this), _options);
- $(this).data(DATA_KEY, typeof config === 'string' ? data : config);
- }
- if (typeof config === 'string' && config.match(/collapse|expand|remove|toggle|maximize|minimize|toggleMaximize/)) {
- data[config]();
- } else if (typeof config === 'object') {
- data._init($(this));
- }
- };
+ $__default['default'](document).on('click', SELECTOR_SEARCH_BUTTON, function (event) {
+ event.preventDefault();
- return CardWidget;
- }();
- /**
- * Data API
- * ====================================================
- */
+ SidebarSearch._jQueryInterface.call($__default['default'](SELECTOR_DATA_WIDGET$1), 'toggle');
+ });
+ $__default['default'](document).on('keyup', SELECTOR_SEARCH_INPUT, function (event) {
+ if (event.keyCode == 38) {
+ event.preventDefault();
+ $__default['default'](SELECTOR_SEARCH_RESULTS_GROUP).children().last().focus();
+ return;
+ }
+ if (event.keyCode == 40) {
+ event.preventDefault();
+ $__default['default'](SELECTOR_SEARCH_RESULTS_GROUP).children().first().focus();
+ return;
+ }
+
+ var timer = 0;
+ clearTimeout(timer);
+ timer = setTimeout(function () {
+ SidebarSearch._jQueryInterface.call($__default['default'](SELECTOR_DATA_WIDGET$1), 'search');
+ }, 100);
+ });
+ $__default['default'](document).on('keydown', SELECTOR_SEARCH_RESULTS_GROUP, function (event) {
+ var $focused = $__default['default'](':focus');
+
+ if (event.keyCode == 38) {
+ event.preventDefault();
- $(document).on('click', Selector.DATA_COLLAPSE, function (event) {
- if (event) {
- event.preventDefault();
+ if ($focused.is(':first-child')) {
+ $focused.siblings().last().focus();
+ } else {
+ $focused.prev().focus();
}
+ }
- CardWidget._jQueryInterface.call($(this), 'toggle');
- });
- $(document).on('click', Selector.DATA_REMOVE, function (event) {
- if (event) {
- event.preventDefault();
- }
+ if (event.keyCode == 40) {
+ event.preventDefault();
- CardWidget._jQueryInterface.call($(this), 'remove');
- });
- $(document).on('click', Selector.DATA_MAXIMIZE, function (event) {
- if (event) {
- event.preventDefault();
+ if ($focused.is(':last-child')) {
+ $focused.siblings().first().focus();
+ } else {
+ $focused.next().focus();
}
+ }
+ });
+ $__default['default'](window).on('load', function () {
+ SidebarSearch._jQueryInterface.call($__default['default'](SELECTOR_DATA_WIDGET$1), 'init');
+ });
+ /**
+ * jQuery API
+ * ====================================================
+ */
- CardWidget._jQueryInterface.call($(this), 'toggleMaximize');
- });
- /**
- * jQuery API
- * ====================================================
- */
-
- $.fn[NAME] = CardWidget._jQueryInterface;
- $.fn[NAME].Constructor = CardWidget;
-
- $.fn[NAME].noConflict = function () {
- $.fn[NAME] = JQUERY_NO_CONFLICT;
- return CardWidget._jQueryInterface;
- };
+ $__default['default'].fn[NAME$a] = SidebarSearch._jQueryInterface;
+ $__default['default'].fn[NAME$a].Constructor = SidebarSearch;
- return CardWidget;
- }(jQuery);
+ $__default['default'].fn[NAME$a].noConflict = function () {
+ $__default['default'].fn[NAME$a] = JQUERY_NO_CONFLICT$a;
+ return SidebarSearch._jQueryInterface;
+ };
/**
* --------------------------------------------
- * AdminLTE CardRefresh.js
+ * AdminLTE Toasts.js
* License MIT
* --------------------------------------------
*/
- var CardRefresh = function ($) {
- /**
- * Constants
- * ====================================================
- */
- var NAME = 'CardRefresh';
- var DATA_KEY = 'lte.cardrefresh';
- var EVENT_KEY = "." + DATA_KEY;
- var JQUERY_NO_CONFLICT = $.fn[NAME];
- var Event = {
- LOADED: "loaded" + EVENT_KEY,
- OVERLAY_ADDED: "overlay.added" + EVENT_KEY,
- OVERLAY_REMOVED: "overlay.removed" + EVENT_KEY
- };
- var ClassName = {
- CARD: 'card'
- };
- var Selector = {
- CARD: "." + ClassName.CARD,
- DATA_REFRESH: '[data-card-widget="card-refresh"]'
- };
- var Default = {
- source: '',
- sourceSelector: '',
- params: {},
- trigger: Selector.DATA_REFRESH,
- content: '.card-body',
- loadInContent: true,
- loadOnInit: true,
- responseType: '',
- overlayTemplate: '
',
- onLoadStart: function onLoadStart() {},
- onLoadDone: function onLoadDone(response) {
- return response;
- }
- };
+ /**
+ * Constants
+ * ====================================================
+ */
+
+ var NAME$b = 'Toasts';
+ var DATA_KEY$b = 'lte.toasts';
+ var EVENT_KEY$6 = "." + DATA_KEY$b;
+ var JQUERY_NO_CONFLICT$b = $__default['default'].fn[NAME$b];
+ var EVENT_INIT = "init" + EVENT_KEY$6;
+ var EVENT_CREATED = "created" + EVENT_KEY$6;
+ var EVENT_REMOVED$1 = "removed" + EVENT_KEY$6;
+ var SELECTOR_CONTAINER_TOP_RIGHT = '#toastsContainerTopRight';
+ var SELECTOR_CONTAINER_TOP_LEFT = '#toastsContainerTopLeft';
+ var SELECTOR_CONTAINER_BOTTOM_RIGHT = '#toastsContainerBottomRight';
+ var SELECTOR_CONTAINER_BOTTOM_LEFT = '#toastsContainerBottomLeft';
+ var CLASS_NAME_TOP_RIGHT = 'toasts-top-right';
+ var CLASS_NAME_TOP_LEFT = 'toasts-top-left';
+ var CLASS_NAME_BOTTOM_RIGHT = 'toasts-bottom-right';
+ var CLASS_NAME_BOTTOM_LEFT = 'toasts-bottom-left';
+ var POSITION_TOP_RIGHT = 'topRight';
+ var POSITION_TOP_LEFT = 'topLeft';
+ var POSITION_BOTTOM_RIGHT = 'bottomRight';
+ var POSITION_BOTTOM_LEFT = 'bottomLeft';
+ var Default$9 = {
+ position: POSITION_TOP_RIGHT,
+ fixed: true,
+ autohide: false,
+ autoremove: true,
+ delay: 1000,
+ fade: true,
+ icon: null,
+ image: null,
+ imageAlt: null,
+ imageHeight: '25px',
+ title: null,
+ subtitle: null,
+ close: true,
+ body: null,
+ class: null
+ };
+ /**
+ * Class Definition
+ * ====================================================
+ */
- var CardRefresh = /*#__PURE__*/function () {
- function CardRefresh(element, settings) {
- this._element = element;
- this._parent = element.parents(Selector.CARD).first();
- this._settings = $.extend({}, Default, settings);
- this._overlay = $(this._settings.overlayTemplate);
+ var Toasts = /*#__PURE__*/function () {
+ function Toasts(element, config) {
+ this._config = config;
- if (element.hasClass(ClassName.CARD)) {
- this._parent = element;
- }
+ this._prepareContainer();
- if (this._settings.source === '') {
- throw new Error('Source url was not defined. Please specify a url in your CardRefresh source option.');
- }
+ $__default['default']('body').trigger($__default['default'].Event(EVENT_INIT));
+ } // Public
+
+
+ var _proto = Toasts.prototype;
+
+ _proto.create = function create() {
+ var toast = $__default['default']('');
+ toast.data('autohide', this._config.autohide);
+ toast.data('animation', this._config.fade);
+
+ if (this._config.class) {
+ toast.addClass(this._config.class);
}
- var _proto = CardRefresh.prototype;
+ if (this._config.delay && this._config.delay != 500) {
+ toast.data('delay', this._config.delay);
+ }
- _proto.load = function load() {
- this._addOverlay();
+ var toastHeader = $__default['default']('