From db0580990002665d3e25469d7f356a048b8fce55 Mon Sep 17 00:00:00 2001 From: Leon Date: Wed, 27 May 2020 10:14:49 +0300 Subject: [PATCH 1/8] fix --- www/app/modules/issue/pages/issuelist.php | 9 +++++++-- www/templates/modules/issue/pages/issuelist.html | 3 ++- www/templates_ua/modules/issue/pages/issuelist.html | 3 ++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/www/app/modules/issue/pages/issuelist.php b/www/app/modules/issue/pages/issuelist.php index fa219b7d3..0b5aa07cc 100644 --- a/www/app/modules/issue/pages/issuelist.php +++ b/www/app/modules/issue/pages/issuelist.php @@ -161,7 +161,8 @@ public function onFilter($sender) { public function listOnRow($row) { $issue = $row->getDataItem(); - $row->add(new Label('issue_number', '#' . $issue->issue_id)); + $row->add(new RedirectLink('issue_number', "\\App\\Modules\\Issue\\Pages\\IssueList", array($issue->issue_id) ))->setValue('#' . $issue->issue_id); + $row->issue_number->setAttribute('class', 'badge badge-success'); if ($issue->priority == Issue::PRIORITY_HIGH) { $row->issue_number->setAttribute('class', 'badge badge-danger'); @@ -170,7 +171,8 @@ public function listOnRow($row) { $row->issue_number->setAttribute('class', 'badge badge-warning'); } - $row->add(new BookmarkableLink('title', '/issue/' . $issue->issue_id))->setValue($issue->issue_name); + $row->add(new ClickLink('title', $this , 'OnIssue' ))->setValue($issue->issue_name); + $row->add(new Label('emp', \App\Util::getLabelName($issue->username))); $row->emp->setAttribute('title', $issue->username); if ($this->_issue->issue_id == $issue) { @@ -237,6 +239,9 @@ public function onSaveIssue($sender) { $this->listpan->list->Reload(); $this->openIssue($this->_issue); } + public function OnIssue($sender) { + $this->openIssue($sender->getOwner()->getDataItem()); + } public function openIssue($issue) { $this->_issue = $issue; diff --git a/www/templates/modules/issue/pages/issuelist.html b/www/templates/modules/issue/pages/issuelist.html index 2c13494da..52da6c8ac 100644 --- a/www/templates/modules/issue/pages/issuelist.html +++ b/www/templates/modules/issue/pages/issuelist.html @@ -46,7 +46,8 @@

Список задач

- + + diff --git a/www/templates_ua/modules/issue/pages/issuelist.html b/www/templates_ua/modules/issue/pages/issuelist.html index 74f5c7148..51b0b131b 100644 --- a/www/templates_ua/modules/issue/pages/issuelist.html +++ b/www/templates_ua/modules/issue/pages/issuelist.html @@ -46,7 +46,8 @@

Список завдань

- + + From 7e812c4d0e0d25153ecb3112856a0c00ef157dca Mon Sep 17 00:00:00 2001 From: Leon Date: Wed, 27 May 2020 13:39:01 +0300 Subject: [PATCH 2/8] =?UTF-8?q?=D0=B2=D0=BE=D0=B7=D0=BC=D0=BE=D0=B6=D0=BD?= =?UTF-8?q?=D0=BE=D1=81=D1=82=D1=8C=20=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D1=8F=D1=82=D1=8C=20=D0=B2=20=20=D0=BF=D1=80=D0=B8=D1=85?= =?UTF-8?q?=D0=BE=D0=B4=20=D0=B8=D0=B4=D0=B8=D0=BD=D0=B0=D0=BA=D0=BE=D0=B2?= =?UTF-8?q?=D1=8B=D0=B5=20=20=D1=82=D0=BE=D0=B2=D0=B0=D1=80=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- www/app/pages/doc/goodsreceipt.php | 33 +++++++++---------- www/templates/pages/reference/itemlist.html | 2 ++ .../pages/reference/itemlist.html | 3 ++ 3 files changed, 21 insertions(+), 17 deletions(-) diff --git a/www/app/pages/doc/goodsreceipt.php b/www/app/pages/doc/goodsreceipt.php index bfc54ce65..716b1d382 100644 --- a/www/app/pages/doc/goodsreceipt.php +++ b/www/app/pages/doc/goodsreceipt.php @@ -32,6 +32,7 @@ class GoodsReceipt extends \App\Pages\Base private $_doc; private $_basedocid = 0; private $_rowid = 0; + public function __construct($docid = 0, $basedocid = 0) { parent::__construct(); @@ -259,7 +260,7 @@ public function editOnClick($sender) { $this->editdetail->edititem->setText($item->itemname); - $this->_rowid = $item->item_id; + $this->_rowid = $item->rowid; } public function deleteOnClick($sender) { @@ -267,9 +268,11 @@ public function deleteOnClick($sender) { return; } $item = $sender->owner->getDataItem(); - // unset($this->_itemlist[$item->item_id]); - $this->_itemlist = array_diff_key($this->_itemlist, array($item->item_id => $this->_itemlist[$item->item_id])); + + $this->_itemlist = array_diff_key($this->_itemlist, array($item->rowid => $this->_itemlist[$item->rowid])); + + $this->calcTotal(); $this->calcPay(); @@ -350,23 +353,16 @@ public function saverowOnClick($sender) { if ($item->sdate == false) { $item->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) { + $item->rowid = $this->_rowid; + }else { + $next = count($this->_itemlist) >0? max(array_keys($this->_itemlist)) : 0; + $item->rowid=$next+1 ; } + $this->_itemlist[$item->rowid] = $item; - if ($this->_rowid == 0) { // в конец - $tarr[$item->item_id] = $item; - } - $this->_itemlist = $tarr; $this->_rowid = 0; @@ -791,4 +787,7 @@ public function onSelectItem($item_id, $itemname) { $this->editdetail->edititem->setText($itemname); } + + + } diff --git a/www/templates/pages/reference/itemlist.html b/www/templates/pages/reference/itemlist.html index 7432a65ea..8882d061b 100644 --- a/www/templates/pages/reference/itemlist.html +++ b/www/templates/pages/reference/itemlist.html @@ -133,6 +133,8 @@

Редактирование товара

+ Код товара должен быть уникальным. + Если используется код производителя, следует добавить бренд к коду например k123_имябренда
diff --git a/www/templates_ua/pages/reference/itemlist.html b/www/templates_ua/pages/reference/itemlist.html index bd42051b0..03e1a1326 100644 --- a/www/templates_ua/pages/reference/itemlist.html +++ b/www/templates_ua/pages/reference/itemlist.html @@ -132,6 +132,9 @@

Редагування товару

+ Код товару мае бути унiкальним. + Якщо використовуется код виробника, слiд додати бренд до коду наприклад k123_имябренда +
From da0977e75180d061f14611786e45c4bcb3f1fdec Mon Sep 17 00:00:00 2001 From: Leon Date: Thu, 28 May 2020 22:44:40 +0300 Subject: [PATCH 3/8] =?UTF-8?q?=D0=BA=D0=BE=D0=BC=D0=BF=D0=B0=D0=BD=D0=B8?= =?UTF-8?q?=D0=B8=20=D0=BA=D0=BE=D0=BD=D1=82=D1=80=D0=B0=D0=BA=D1=82=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 8 +- db/db.sql | 28 +++-- db/initdata.sql | 3 + db/initdata_ua.sql | 2 + db/update430to431.sql | 41 +++++++ www/app/entity/doc/document.php | 12 +- www/app/entity/doc/invoice.php | 2 +- www/app/entity/message.php | 4 +- www/app/helper.php | 6 +- www/app/modules/issue/pages/issuelist.php | 4 +- www/app/modules/issue/pages/projectlist.php | 4 +- www/app/pages/base.php | 5 + www/app/pages/doc/goodsreceipt.php | 10 +- www/app/pages/doc/invoicecust.php | 28 +++++ www/app/pages/options.php | 5 +- www/app/pages/reference/customerlist.php | 4 +- www/app/widgets/docview.php | 2 +- www/composer.json | 4 +- www/composer.lock | 117 ++++++++++---------- www/templates/pages/base.html | 69 +++++++++--- www/templates/pages/branchlist.html | 2 +- www/templates/pages/doc/invoicecust.html | 10 ++ www/templates/pages/options.html | 10 +- www/templates/pages/userlogin.html | 2 +- www/templates_ua/pages/base.html | 44 +++++--- www/templates_ua/pages/doc/invoicecust.html | 10 ++ www/templates_ua/pages/options.html | 11 ++ www/templates_ua/pages/userlogin.html | 2 +- 28 files changed, 320 insertions(+), 129 deletions(-) create mode 100644 db/update430to431.sql diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a53971f5..e81acee15 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ CHANGELOG ========= +### v4.3.1 (2020-05-31) +* Добавлена возможность работать в разрезе нескольких компаний. +* Добавлен документ Договор и журнал договоров. +Для обновления выполнить update430to431.sql обновить папки app, templates, templates_ua. Обновить библиотеки согласно composer.json + ### v4.3.0 (2020-05-25) * добавлены роли пользователей. Теперь разделение доступа и оперативное меню настраивается на уровне роли. Для обновления выполнить update421to430.sql обновить папки app, templates, templates_ua @@ -56,8 +61,7 @@ CHANGELOG * Добавлена возможность работы с филиалами (например торговыми точками). Доступ к данным системы определеяется разрешенными пользователю филиалами. * Печать квитанций и этикеток на узкий принтер. -* Мастер миграции - переноса данных при переходе на новую версию. - + Новая версия требует PHP7.2 ### v3.1.3 (2019-12-06) diff --git a/db/db.sql b/db/db.sql index fe28c8e23..106e7f245 100644 --- a/db/db.sql +++ b/db/db.sql @@ -62,7 +62,7 @@ CREATE TABLE `docstatelog` ( `hostname` varchar(64) NOT NULL, PRIMARY KEY (`log_id`), KEY `document_id` (`document_id`) -) AUTO_INCREMENT=998 DEFAULT CHARSET=utf8; +) AUTO_INCREMENT=1002 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `docstatelog_view`; /*!50001 DROP VIEW IF EXISTS `docstatelog_view`*/; @@ -98,12 +98,14 @@ CREATE TABLE `documents` ( `payed` decimal(11,2) DEFAULT '0.00', `branch_id` int(11) DEFAULT '0', `parent_id` bigint(20) DEFAULT '0', + `firm_id` int(11) DEFAULT '0', PRIMARY KEY (`document_id`), KEY `document_date` (`document_date`), KEY `customer_id` (`customer_id`), KEY `user_id` (`user_id`), - KEY `branch_id` (`branch_id`) -) AUTO_INCREMENT=262 DEFAULT CHARSET=utf8; + KEY `branch_id` (`branch_id`), + KEY `firm_id` (`firm_id`) +) AUTO_INCREMENT=263 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `documents_view`; /*!50001 DROP VIEW IF EXISTS `documents_view`*/; @@ -127,6 +129,7 @@ SET character_set_client = utf8; 1 AS `parent_id`, 1 AS `branch_id`, 1 AS `branch_name`, + 1 AS `firm_name`, 1 AS `meta_name`, 1 AS `meta_desc`*/; SET character_set_client = @saved_cs_client; @@ -157,7 +160,7 @@ CREATE TABLE `entrylist` ( PRIMARY KEY (`entry_id`), KEY `document_id` (`document_id`), KEY `stock_id` (`stock_id`) -) AUTO_INCREMENT=740 DEFAULT CHARSET=utf8; +) AUTO_INCREMENT=742 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -289,6 +292,17 @@ CREATE TABLE `filesdata` ( UNIQUE KEY `file_id` (`file_id`) ) DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `firms`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `firms` ( + `firm_id` int(11) NOT NULL AUTO_INCREMENT, + `firm_name` varchar(255) NOT NULL, + `details` longtext NOT NULL, + `disabled` tinyint(1) NOT NULL DEFAULT '0', + PRIMARY KEY (`firm_id`) +) DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `images`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; @@ -655,7 +669,7 @@ CREATE TABLE `paylist` ( `paytype` tinyint(4) NOT NULL DEFAULT '0', PRIMARY KEY (`pl_id`), KEY `document_id` (`document_id`) -) AUTO_INCREMENT=249 DEFAULT CHARSET=utf8; +) AUTO_INCREMENT=250 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `paylist_view`; /*!50001 DROP VIEW IF EXISTS `paylist_view`*/; @@ -924,7 +938,7 @@ CREATE TABLE `users` ( `role_id` int(11) DEFAULT NULL, PRIMARY KEY (`user_id`), UNIQUE KEY `userlogin` (`userlogin`) -) AUTO_INCREMENT=8 DEFAULT CHARSET=utf8; +) AUTO_INCREMENT=9 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `users_view`; /*!50001 DROP VIEW IF EXISTS `users_view`*/; @@ -980,7 +994,7 @@ SET character_set_client = @saved_cs_client; /*!50001 SET collation_connection = latin1_swedish_ci */; /*!50001 CREATE */ /*!50013 */ -/*!50001 VIEW `documents_view` AS select `d`.`document_id` AS `document_id`,`d`.`document_number` AS `document_number`,`d`.`document_date` AS `document_date`,`d`.`user_id` AS `user_id`,`d`.`content` AS `content`,`d`.`amount` AS `amount`,`d`.`meta_id` AS `meta_id`,`u`.`username` AS `username`,`c`.`customer_id` AS `customer_id`,`c`.`customer_name` AS `customer_name`,`d`.`state` AS `state`,`d`.`notes` AS `notes`,`d`.`payamount` AS `payamount`,`d`.`payed` AS `payed`,`d`.`parent_id` AS `parent_id`,`d`.`branch_id` AS `branch_id`,`b`.`branch_name` AS `branch_name`,`metadata`.`meta_name` AS `meta_name`,`metadata`.`description` AS `meta_desc` from ((((`documents` `d` left join `users_view` `u` on((`d`.`user_id` = `u`.`user_id`))) left join `customers` `c` on((`d`.`customer_id` = `c`.`customer_id`))) join `metadata` on((`metadata`.`meta_id` = `d`.`meta_id`))) left join `branches` `b` on((`d`.`branch_id` = `b`.`branch_id`))) */; +/*!50001 VIEW `documents_view` AS select `d`.`document_id` AS `document_id`,`d`.`document_number` AS `document_number`,`d`.`document_date` AS `document_date`,`d`.`user_id` AS `user_id`,`d`.`content` AS `content`,`d`.`amount` AS `amount`,`d`.`meta_id` AS `meta_id`,`u`.`username` AS `username`,`c`.`customer_id` AS `customer_id`,`c`.`customer_name` AS `customer_name`,`d`.`state` AS `state`,`d`.`notes` AS `notes`,`d`.`payamount` AS `payamount`,`d`.`payed` AS `payed`,`d`.`parent_id` AS `parent_id`,`d`.`branch_id` AS `branch_id`,`b`.`branch_name` AS `branch_name`,`f`.`firm_name` AS `firm_name`,`metadata`.`meta_name` AS `meta_name`,`metadata`.`description` AS `meta_desc` from (((((`documents` `d` left join `users_view` `u` on((`d`.`user_id` = `u`.`user_id`))) left join `customers` `c` on((`d`.`customer_id` = `c`.`customer_id`))) join `metadata` on((`metadata`.`meta_id` = `d`.`meta_id`))) left join `branches` `b` on((`d`.`branch_id` = `b`.`branch_id`))) left join `firms` `f` on((`d`.`firm_id` = `f`.`firm_id`))) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; diff --git a/db/initdata.sql b/db/initdata.sql index 4e2d9b65e..f8ee22ace 100644 --- a/db/initdata.sql +++ b/db/initdata.sql @@ -73,4 +73,7 @@ INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `men 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_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 2, 'Движение по контрагентам', 'CustActivity', 'Платежи', 0); +INSERT INTO `metadata` (`meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 1, 'Договор', 'Contract', '', 0); +INSERT INTO `metadata` (`meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 4, 'Договора', 'ContractList', '', 0); + diff --git a/db/initdata_ua.sql b/db/initdata_ua.sql index 377e03add..030e729ca 100644 --- a/db/initdata_ua.sql +++ b/db/initdata_ua.sql @@ -74,3 +74,5 @@ INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `men 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_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 2, 'Рух по контрагентах', 'CustActivity', 'Платежі', 0); +INSERT INTO `metadata` (`meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 1, 'Контракт', 'Contract', '', 0); +INSERT INTO `metadata` (`meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 4, 'Контракти', 'ContractList', '', 0); diff --git a/db/update430to431.sql b/db/update430to431.sql new file mode 100644 index 000000000..36a63eb51 --- /dev/null +++ b/db/update430to431.sql @@ -0,0 +1,41 @@ +CREATE TABLE `firms` ( + `firm_id` int(11) NOT NULL AUTO_INCREMENT, + `firm_name` varchar(255) NOT NULL, + `details` longtext NOT NULL, + `disabled` tinyint(1) NOT NULL DEFAULT '0', + PRIMARY KEY (`firm_id`) +) ENGINE=MyISAM CHARSET=utf8; + + +ALTER TABLE `documents` ADD `firm_id` INT NULL DEFAULT '0' , ADD INDEX (`firm_id`); + +ALTER VIEW `documents_view` AS + select + `d`.`document_id` AS `document_id`, + `d`.`document_number` AS `document_number`, + `d`.`document_date` AS `document_date`, + `d`.`user_id` AS `user_id`, + `d`.`content` AS `content`, + `d`.`amount` AS `amount`, + `d`.`meta_id` AS `meta_id`, + `u`.`username` AS `username`, + `c`.`customer_id` AS `customer_id`, + `c`.`customer_name` AS `customer_name`, + `d`.`state` AS `state`, + `d`.`notes` AS `notes`, + `d`.`payamount` AS `payamount`, + `d`.`payed` AS `payed`, + `d`.`parent_id` AS `parent_id`, + `d`.`branch_id` AS `branch_id`, + `b`.`branch_name` AS `branch_name`, + `f`.`firm_name` AS `firm_name`, + `metadata`.`meta_name` AS `meta_name`, + `metadata`.`description` AS `meta_desc` + from + (((((`documents` `d` left join `users_view` `u` on((`d`.`user_id` = `u`.`user_id`))) left join `customers` `c` on((`d`.`customer_id` = `c`.`customer_id`))) join `metadata` on((`metadata`.`meta_id` = `d`.`meta_id`))) left join `branches` `b` on((`d`.`branch_id` = `b`.`branch_id`))) left join `firms` `f` on((`d`.`firm_id` = `f`.`firm_id`))); + + +INSERT INTO `metadata` (`meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 1, '�������', 'Contract', '', 0); +INSERT INTO `metadata` (`meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 4, '��������', 'ContractList', '', 0); + + \ No newline at end of file diff --git a/www/app/entity/doc/document.php b/www/app/entity/doc/document.php index 7fee55fa2..2ab4a88ba 100644 --- a/www/app/entity/doc/document.php +++ b/www/app/entity/doc/document.php @@ -321,11 +321,15 @@ public static function create($classname, $branch_id = 0) { $doc = new $fullclassname(); $doc->meta_id = $meta['meta_id']; - $doc->branch_id = $branch_id; - if ($branch_id == 0) { - $doc->branch_id = \App\Acl::checkCurrentBranch(); + if($classname=='Contract') { + $doc->branch_id = 0; + } + else { + $doc->branch_id = $branch_id; + if ($branch_id == 0 ) { + $doc->branch_id = \App\Acl::checkCurrentBranch(); + } } - return $doc; } diff --git a/www/app/entity/doc/invoice.php b/www/app/entity/doc/invoice.php index a118e4fd1..9d7cab268 100644 --- a/www/app/entity/doc/invoice.php +++ b/www/app/entity/doc/invoice.php @@ -43,7 +43,7 @@ public function generateReport() { "notes" => $this->notes, "document_number" => $this->document_number, "totalstr" => $totalstr, - "total" => $this->amount, + "total" => H::fa($this->amount), "payamount" => H::fa($this->payamount), "payed" => H::fa($this->payed), "paydisc" => H::fa($this->headerdata["paydisc"]) diff --git a/www/app/entity/message.php b/www/app/entity/message.php index 3cc5a919a..1f8544eb0 100644 --- a/www/app/entity/message.php +++ b/www/app/entity/message.php @@ -30,8 +30,8 @@ protected function afterLoad() { * @param mixed $item_d * @param mixed $sort */ - public static function getMessages($type, $item_id, $sort = 'asc') { - return \App\Entity\Message::find("item_type ={$type} and item_id={$item_id}", "created " . $sort); + public static function getMessages($type, $item_id ) { + return \App\Entity\Message::find("item_type ={$type} and item_id={$item_id}", "message_id " ); } /** diff --git a/www/app/helper.php b/www/app/helper.php index 017a15bf4..cd91f4b68 100644 --- a/www/app/helper.php +++ b/www/app/helper.php @@ -451,11 +451,11 @@ public static function fdt($date ) { /** * возвращает данные фирмы. Учитывает филиал если задан */ - public static function getFirmData($id = 0) { + public static function getFirmData($branch_id = 0) { $data = \App\System::getOptions("firm"); - if ($id > 0) { - $branch = \App\Entity\Branch::load($id); + if ($branch_id > 0) { + $branch = \App\Entity\Branch::load($branch_id); if (strlen($branch->shopname) > 0) { $data['shopname'] = $branch->shop_name; } diff --git a/www/app/modules/issue/pages/issuelist.php b/www/app/modules/issue/pages/issuelist.php index 0b5aa07cc..aec8c22ad 100644 --- a/www/app/modules/issue/pages/issuelist.php +++ b/www/app/modules/issue/pages/issuelist.php @@ -340,7 +340,7 @@ public function onAddMsg($sender) { //список комментариев private function updateMessages() { - $this->_msglist = \App\Entity\Message::find('item_type = ' . \App\Entity\Message::TYPE_ISSUE . ' and item_id=' . $this->_issue->issue_id); + $this->_msglist = \App\Entity\Message::find('item_type = ' . \App\Entity\Message::TYPE_ISSUE . ' and item_id=' . $this->_issue->issue_id,'message_id'); $this->listpan->msgpan->msglist->Reload(); $this->_fileslist = \App\Helper::getFileList($this->_issue->issue_id, \App\Entity\Message::TYPE_ISSUE); $this->listpan->msgpan->filelist->Reload(); @@ -350,7 +350,7 @@ public function msgListOnRow($row) { $item = $row->getDataItem(); $row->add(new Label('msgdate', \App\Helper::fdt( $item->created))); $row->add(new Label('msguser', $item->username)); - $row->add(new Label('msgdata', $item->message)); + $row->add(new Label('msgdata', nl2br($item->message))); $row->add(new ClickLink('delmsg'))->onClick($this, 'deleteMmsOnClick'); if ($this->_user->rolename == 'admins' || $this->_user->user_id == $item->user_id) { $row->delmsg->setVisible(true); diff --git a/www/app/modules/issue/pages/projectlist.php b/www/app/modules/issue/pages/projectlist.php index d5a4c8a72..60f52a1e9 100644 --- a/www/app/modules/issue/pages/projectlist.php +++ b/www/app/modules/issue/pages/projectlist.php @@ -216,7 +216,7 @@ public function onAddMsg($sender) { } private function updateMessages() { - $this->_msglist = \App\Entity\Message::find('item_type =6 and item_id=' . $this->_project->project_id); + $this->_msglist = \App\Entity\Message::find('item_type =6 and item_id=' . $this->_project->project_id,'message_id'); $this->showpan->msglist->Reload(); $this->_fileslist = \App\Helper::getFileList($this->_project->project_id, 6); $this->showpan->filelist->Reload(); @@ -226,7 +226,7 @@ public function msgListOnRow($row) { $item = $row->getDataItem(); $row->add(new Label('msgdate', \App\Helper::fdt( $item->created))); $row->add(new Label('msguser', $item->username)); - $row->add(new Label('msgdata', $item->message)); + $row->add(new Label('msgdata', nl2br($item->message))); $row->add(new ClickLink('delmsg'))->onClick($this, 'deleteMmsOnClick'); if ($this->_user->rolename == 'admins' || $this->_user->user_id == $item->user_id) { $row->delmsg->setVisible(true); diff --git a/www/app/pages/base.php b/www/app/pages/base.php index 3b2139453..e924344dc 100644 --- a/www/app/pages/base.php +++ b/www/app/pages/base.php @@ -59,6 +59,7 @@ public function __construct($params = null) { $this->_tvars["useimages"] = $options['useimages'] == 1; $this->_tvars["usebranch"] = $options['usebranch'] == 1; $this->_tvars["useval"] = $options['useval'] == 1; + $this->_tvars["usefirms"] = $options['usefirms'] == 1; if ($this->_tvars["usebranch"] == false) { $this->branch_id = 0; @@ -199,6 +200,10 @@ protected final function resetURL() { \App\Application::$app->setReloadPage(); } + public function tm($p,$post) { + return "Привет" ; + } + /** * Вставляет JavaScript в конец выходного потока diff --git a/www/app/pages/doc/goodsreceipt.php b/www/app/pages/doc/goodsreceipt.php index 716b1d382..888f06d46 100644 --- a/www/app/pages/doc/goodsreceipt.php +++ b/www/app/pages/doc/goodsreceipt.php @@ -259,6 +259,8 @@ public function editOnClick($sender) { $this->editdetail->edititem->setKey($item->item_id); $this->editdetail->edititem->setText($item->itemname); + if($item->rowid>0) ; //для совместимости + else $item->rowid = $item->item_id ; $this->_rowid = $item->rowid; } @@ -269,7 +271,9 @@ public function deleteOnClick($sender) { } $item = $sender->owner->getDataItem(); - + if($item->rowid>0) ; //для совместимости + else $item->rowid = $item->item_id ; + $this->_itemlist = array_diff_key($this->_itemlist, array($item->rowid => $this->_itemlist[$item->rowid])); @@ -286,9 +290,9 @@ public function addcodeOnClick($sender) { return; } - foreach ($this->_itemlist as $_item) { + foreach ($this->_itemlist as $ri=>$_item ) { if ($_item->bar_code == $code) { - $this->_itemlist[$_item->item_id]->quantity += 1; + $this->_itemlist[$ri]->quantity += 1; $this->docform->detail->Reload(); $this->calcTotal(); $this->CalcPay(); diff --git a/www/app/pages/doc/invoicecust.php b/www/app/pages/doc/invoicecust.php index 42cdc59eb..87b0c10d9 100644 --- a/www/app/pages/doc/invoicecust.php +++ b/www/app/pages/doc/invoicecust.php @@ -41,7 +41,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')); + $this->docform->add(new DropDownChoice('val',H::getValList() , '0'))->onChange($this, 'OnVal'); + $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'); @@ -311,6 +313,19 @@ public function savedocOnClick($sender) { } $this->_doc->updateStatus(Document::STATE_EXECUTED); + + + //обновляем курс + if(strlen($this->_doc->headerdata['val'])>1) { + $optval = \App\System::getOptions("val" ); + if(strlen($optval[$this->_doc->headerdata['val']])>0){ + $optval[$this->_doc->headerdata['val']] = $this->_doc->headerdata['rate'] ; + \App\System::setOptions("val", $optval); + } + + } + + } else { $this->_doc->updateStatus($isEdited ? Document::STATE_EDITED : Document::STATE_NEW); } @@ -401,6 +416,19 @@ public function onRate($sender) { $this->goAnkor("tankor"); } + public function OnVal($sender) { + $val = $sender->getValue(); + if(strlen($val)>1){ + $optval = \App\System::getOptions("val" ); + $rate = $optval[$val]; + } else { + $rate =1; + } + $this->docform->rate->setText($rate); + $this->docform->editrate->setText($rate); + $this->CalcPay(); + } + /** * Валидация формы diff --git a/www/app/pages/options.php b/www/app/pages/options.php index f4a8a3c2c..372b0790e 100644 --- a/www/app/pages/options.php +++ b/www/app/pages/options.php @@ -46,8 +46,9 @@ public function __construct() { $this->common->add(new CheckBox('useset')); $this->common->add(new CheckBox('useval')); - $this->common->add(new CheckBox('usescanner')); + $this->common->add(new CheckBox('usefirms')); $this->common->add(new CheckBox('useimages')); + $this->common->add(new CheckBox('usescanner')); $this->common->add(new CheckBox('usebranch')); $this->common->add(new CheckBox('allowminus')); $this->common->add(new TextInput('price1')); @@ -83,6 +84,7 @@ public function __construct() { $this->common->usesnumber->setChecked($common['usesnumber']); + $this->common->usefirms->setChecked($common['usefirms']); $this->common->usescanner->setChecked($common['usescanner']); $this->common->useimages->setChecked($common['useimages']); $this->common->usebranch->setChecked($common['usebranch']); @@ -201,6 +203,7 @@ public function saveCommonOnClick($sender) { $common['usesnumber'] = $this->common->usesnumber->isChecked() ? 1 : 0; $common['usescanner'] = $this->common->usescanner->isChecked() ? 1 : 0; $common['useimages'] = $this->common->useimages->isChecked() ? 1 : 0; + $common['usefirms'] = $this->common->usefirms->isChecked() ? 1 : 0; $common['usebranch'] = $this->common->usebranch->isChecked() ? 1 : 0; $common['allowminus'] = $this->common->allowminus->isChecked() ? 1 : 0; $common['useval'] = $this->common->useval->isChecked() ? 1 : 0; diff --git a/www/app/pages/reference/customerlist.php b/www/app/pages/reference/customerlist.php index 5e588a9c5..9745be291 100644 --- a/www/app/pages/reference/customerlist.php +++ b/www/app/pages/reference/customerlist.php @@ -314,7 +314,7 @@ public function OnMsgSubmit($sender) { //список комментариев private function updateMessages() { - $this->_msglist = \App\Entity\Message::find('item_type = 2 and item_id=' . $this->_customer->customer_id); + $this->_msglist = \App\Entity\Message::find('item_type = 2 and item_id=' . $this->_customer->customer_id,'message_id'); $this->contentview->dw_msglist->Reload(); } @@ -322,7 +322,7 @@ private function updateMessages() { public function msgListOnRow($row) { $item = $row->getDataItem(); - $row->add(new Label("msgdata", $item->message)); + $row->add(new Label("msgdata",nl2br($item->message))); $row->add(new Label("msgdate", \App\Helper::fdt( $item->created))); $row->add(new Label("msguser", $item->username)); diff --git a/www/app/widgets/docview.php b/www/app/widgets/docview.php index eba00a6c0..a06ff2b4c 100644 --- a/www/app/widgets/docview.php +++ b/www/app/widgets/docview.php @@ -263,7 +263,7 @@ public function OnMsgSubmit($sender) { //список комментариев private function updateMessages() { - $this->_msglist = \App\Entity\Message::getMessages(1, $this->_doc->document_id); + $this->_msglist = \App\Entity\Message::getMessages(1, $this->_doc->document_id ); $this->dw_msglist->Reload(); $this->hmessages->setText(count($this->_msglist)); $this->hmessages->setVisible(count($this->_msglist) > 0); diff --git a/www/composer.json b/www/composer.json index c95851682..133c5c1ef 100644 --- a/www/composer.json +++ b/www/composer.json @@ -1,7 +1,7 @@ { "require": { "php": ">=7.2", - "phpmailer/phpmailer": "~5.2", + "phpmailer/phpmailer": "~6.1", "monolog/monolog": "1.25.3", "nesbot/carbon": "2.32.2", "timetoogo/pinq": "3.4.1", @@ -13,6 +13,6 @@ "endroid/qr-code": "3.7.5", "automattic/woocommerce": "3.0.0", "symfony/polyfill-mbstring": "^1.10", - "leon-mbs/zippy": "v2.1.21" + "leon-mbs/zippy": "v2.2.0" } } \ No newline at end of file diff --git a/www/composer.lock b/www/composer.lock index b9f6c2b2e..e8e119f85 100644 --- a/www/composer.lock +++ b/www/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "7c818f3ff94f4dd231d119b76d084e78", + "content-hash": "7f159aa15b4937f740cb840621aaa6a9", "packages": [ { "name": "adodb/adodb-php", @@ -733,16 +733,16 @@ }, { "name": "leon-mbs/zippy", - "version": "v2.1.21", + "version": "v2.2.0", "source": { "type": "git", "url": "https://github.com/leon-mbs/zippy.git", - "reference": "4618618b104473d412f8e7d46d140a3b2542807f" + "reference": "0e70b9138b18aefe9a91d54abf600727136fc0b3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/leon-mbs/zippy/zipball/4618618b104473d412f8e7d46d140a3b2542807f", - "reference": "4618618b104473d412f8e7d46d140a3b2542807f", + "url": "https://api.github.com/repos/leon-mbs/zippy/zipball/0e70b9138b18aefe9a91d54abf600727136fc0b3", + "reference": "0e70b9138b18aefe9a91d54abf600727136fc0b3", "shasum": "" }, "require": { @@ -773,7 +773,7 @@ "framework", "php" ], - "time": "2020-05-17T10:11:00+00:00" + "time": "2020-05-28T15:03:42+00:00" }, { "name": "monolog/monolog", @@ -1146,60 +1146,45 @@ }, { "name": "phpmailer/phpmailer", - "version": "v5.2.28", + "version": "v6.1.6", "source": { "type": "git", "url": "https://github.com/PHPMailer/PHPMailer.git", - "reference": "acba50393dd03da69a50226c139722af8b153b11" + "reference": "c2796cb1cb99d7717290b48c4e6f32cb6c60b7b3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/acba50393dd03da69a50226c139722af8b153b11", - "reference": "acba50393dd03da69a50226c139722af8b153b11", + "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/c2796cb1cb99d7717290b48c4e6f32cb6c60b7b3", + "reference": "c2796cb1cb99d7717290b48c4e6f32cb6c60b7b3", "shasum": "" }, "require": { "ext-ctype": "*", - "php": ">=5.0.0" + "ext-filter": "*", + "php": ">=5.5.0" }, "require-dev": { - "doctrine/annotations": "1.2.*", - "jms/serializer": "0.16.*", - "phpdocumentor/phpdocumentor": "2.*", - "phpunit/phpunit": "4.8.*", - "symfony/debug": "2.8.*", - "symfony/filesystem": "2.8.*", - "symfony/translation": "2.8.*", - "symfony/yaml": "2.8.*", - "zendframework/zend-cache": "2.5.1", - "zendframework/zend-config": "2.5.1", - "zendframework/zend-eventmanager": "2.5.1", - "zendframework/zend-filter": "2.5.1", - "zendframework/zend-i18n": "2.5.1", - "zendframework/zend-json": "2.5.1", - "zendframework/zend-math": "2.5.1", - "zendframework/zend-serializer": "2.5.*", - "zendframework/zend-servicemanager": "2.5.*", - "zendframework/zend-stdlib": "2.5.1" + "doctrine/annotations": "^1.2", + "friendsofphp/php-cs-fixer": "^2.2", + "phpunit/phpunit": "^4.8 || ^5.7" }, "suggest": { - "league/oauth2-google": "Needed for Google XOAUTH2 authentication" + "ext-mbstring": "Needed to send email in multibyte encoding charset", + "hayageek/oauth2-yahoo": "Needed for Yahoo XOAUTH2 authentication", + "league/oauth2-google": "Needed for Google XOAUTH2 authentication", + "psr/log": "For optional PSR-3 debug logging", + "stevenmaguire/oauth2-microsoft": "Needed for Microsoft XOAUTH2 authentication", + "symfony/polyfill-mbstring": "To support UTF-8 if the Mbstring PHP extension is not enabled (^1.2)" }, "type": "library", "autoload": { - "classmap": [ - "class.phpmailer.php", - "class.phpmaileroauth.php", - "class.phpmaileroauthgoogle.php", - "class.smtp.php", - "class.pop3.php", - "extras/EasyPeasyICS.php", - "extras/ntlm_sasl_client.php" - ] + "psr-4": { + "PHPMailer\\PHPMailer\\": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "LGPL-2.1" + "LGPL-2.1-only" ], "authors": [ { @@ -1219,7 +1204,13 @@ } ], "description": "PHPMailer is a full-featured email creation and transfer class for PHP", - "time": "2020-03-19T14:29:37+00:00" + "funding": [ + { + "url": "https://github.com/synchro", + "type": "github" + } + ], + "time": "2020-05-27T12:24:03+00:00" }, { "name": "picqer/php-barcode-generator", @@ -1343,12 +1334,12 @@ "source": { "type": "git", "url": "https://github.com/Roave/SecurityAdvisories.git", - "reference": "885e8b1e0bc2096989fd20938342e407e8045186" + "reference": "55922f51129488c246a776ff944463605d447da0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/885e8b1e0bc2096989fd20938342e407e8045186", - "reference": "885e8b1e0bc2096989fd20938342e407e8045186", + "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/55922f51129488c246a776ff944463605d447da0", + "reference": "55922f51129488c246a776ff944463605d447da0", "shasum": "" }, "conflict": { @@ -1389,10 +1380,10 @@ "doctrine/mongodb-odm": ">=1,<1.0.2", "doctrine/mongodb-odm-bundle": ">=2,<3.0.1", "doctrine/orm": ">=2,<2.4.8|>=2.5,<2.5.1", - "dolibarr/dolibarr": "<=10.0.6", + "dolibarr/dolibarr": "<11.0.4", "dompdf/dompdf": ">=0.6,<0.6.2", - "drupal/core": ">=7,<7.69|>=8,<8.7.12|>=8.8,<8.8.4", - "drupal/drupal": ">=7,<7.69|>=8,<8.7.12|>=8.8,<8.8.4", + "drupal/core": ">=7,<7.70|>=8,<8.7.14|>=8.8,<8.8.6", + "drupal/drupal": ">=7,<7.70|>=8,<8.7.14|>=8.8,<8.8.6", "endroid/qr-code-bundle": "<3.4.2", "enshrined/svg-sanitize": "<0.13.1", "erusev/parsedown": "<1.7.2", @@ -1452,7 +1443,7 @@ "paypal/merchant-sdk-php": "<3.12", "pear/archive_tar": "<1.4.4", "phpfastcache/phpfastcache": ">=5,<5.0.13", - "phpmailer/phpmailer": ">=5,<5.2.27|>=6,<6.0.6", + "phpmailer/phpmailer": "<6.1.6", "phpmyadmin/phpmyadmin": "<4.9.2", "phpoffice/phpexcel": "<1.8.2", "phpoffice/phpspreadsheet": "<1.8", @@ -1615,7 +1606,7 @@ "type": "tidelift" } ], - "time": "2020-05-16T00:00:31+00:00" + "time": "2020-05-28T00:01:39+00:00" }, { "name": "sabberworm/php-css-parser", @@ -2411,20 +2402,20 @@ }, { "name": "symfony/translation-contracts", - "version": "v2.0.1", + "version": "v2.1.2", "source": { "type": "git", "url": "https://github.com/symfony/translation-contracts.git", - "reference": "8cc682ac458d75557203b2f2f14b0b92e1c744ed" + "reference": "e5ca07c8f817f865f618aa072c2fe8e0e637340e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/8cc682ac458d75557203b2f2f14b0b92e1c744ed", - "reference": "8cc682ac458d75557203b2f2f14b0b92e1c744ed", + "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/e5ca07c8f817f865f618aa072c2fe8e0e637340e", + "reference": "e5ca07c8f817f865f618aa072c2fe8e0e637340e", "shasum": "" }, "require": { - "php": "^7.2.5" + "php": ">=7.2.5" }, "suggest": { "symfony/translation-implementation": "" @@ -2432,7 +2423,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-master": "2.1-dev" } }, "autoload": { @@ -2464,7 +2455,21 @@ "interoperability", "standards" ], - "time": "2019-11-18T17:27:11+00:00" + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-05-20T17:43:50+00:00" }, { "name": "timetoogo/pinq", diff --git a/www/templates/pages/base.html b/www/templates/pages/base.html index 2d8987aa3..e29520dcf 100644 --- a/www/templates/pages/base.html +++ b/www/templates/pages/base.html @@ -540,16 +540,31 @@
_______________

  Пользователи

- {{#isadmin}} - - + + + {{#isadmin}} + + - {{/isadmin}} - + + {{#usefirms}} + + {{/usefirms}} + {{#usebranch}} {{/usebranch}} - - {{#isadmin}} + {{/isadmin}} + + {{/isadmin}} @@ -634,7 +644,7 @@
_______________
- + diff --git a/www/templates/pages/branchlist.html b/www/templates/pages/branchlist.html index ee24e42c9..2165d91ac 100644 --- a/www/templates/pages/branchlist.html +++ b/www/templates/pages/branchlist.html @@ -30,7 +30,7 @@

Список филиалов

- + Если задано используется вместо настроек
diff --git a/www/templates/pages/doc/invoicecust.html b/www/templates/pages/doc/invoicecust.html index 1038b44b3..4e65b70c7 100644 --- a/www/templates/pages/doc/invoicecust.html +++ b/www/templates/pages/doc/invoicecust.html @@ -32,6 +32,16 @@

Счет входящий

+ {{#useval}} + +
+ + + +
+ {{/useval}}
+ + +
@@ -161,7 +167,7 @@

Курсы валют

{{/useval}} - + {{^usefirms}}

Данные о компании

@@ -194,7 +200,7 @@

Данные о компании

- + {{/usefirms}}

Настройка принтера

diff --git a/www/templates/pages/userlogin.html b/www/templates/pages/userlogin.html index c044df33e..f8cedce33 100644 --- a/www/templates/pages/userlogin.html +++ b/www/templates/pages/userlogin.html @@ -92,7 +92,7 @@
- v4.3.0 © zippy.com.ua + v4.3.1 © zippy.com.ua
diff --git a/www/templates_ua/pages/base.html b/www/templates_ua/pages/base.html index 95622617c..8672eda37 100644 --- a/www/templates_ua/pages/base.html +++ b/www/templates_ua/pages/base.html @@ -539,15 +539,29 @@
_______________

  Користувачі

- {{#isadmin}} - - - - {{/isadmin}} + + + {{#isadmin}} + + + {{#usefirms}} + + {{/usefirms}} + {{#usebranch}} {{/usebranch}} - - - {{#isadmin}} + {{/isadmin}} + + {{/isadmin}} diff --git a/www/templates_ua/pages/doc/invoicecust.html b/www/templates_ua/pages/doc/invoicecust.html index feefd3ae2..f3d6d86f7 100644 --- a/www/templates_ua/pages/doc/invoicecust.html +++ b/www/templates_ua/pages/doc/invoicecust.html @@ -32,6 +32,16 @@

Рахунок вхідний

+ {{#useval}} + +
+ + + +
+ {{/useval}}
+ + +
+
@@ -163,6 +170,8 @@

Курси валют

{{/useval}} + + {{^usefirms}}

Дані про компанію

@@ -195,6 +204,8 @@

Дані про компанію

+ {{/usefirms}} +

Налаштування принтера

Налаштування вузького принтера для друку чеків і етикеток
diff --git a/www/templates_ua/pages/userlogin.html b/www/templates_ua/pages/userlogin.html index 4e5fcf87b..6b73e40df 100644 --- a/www/templates_ua/pages/userlogin.html +++ b/www/templates_ua/pages/userlogin.html @@ -92,7 +92,7 @@
- v4.3.0 © zippy.com.ua + v4.3.1 © zippy.com.ua
From a10c2496a2c051c39615ca1837f0f324776ef2bf Mon Sep 17 00:00:00 2001 From: Leon Date: Sat, 30 May 2020 23:21:11 +0300 Subject: [PATCH 4/8] =?UTF-8?q?=D1=81=D0=BF=D1=80=D0=B0=D0=B0=D0=B2=D0=BE?= =?UTF-8?q?=D1=87=D0=BD=D0=B8=D0=BA=20=20=D0=B4=D0=BE=D0=B3=D0=BE=D0=B2?= =?UTF-8?q?=D0=BE=D1=80=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/initdata.sql | 3 +- db/initdata_ua.sql | 3 +- db/update430to431.sql | 33 ++- www/app/acl.php | 20 +- www/app/entity/contract.php | 55 +++++ www/app/entity/doc/document.php | 13 +- www/app/entity/employee.php | 7 +- www/app/entity/firm.php | 50 +++++ www/app/entity/metadata.php | 8 +- www/app/entity/service.php | 2 +- www/app/pages/firmlist.php | 164 ++++++++++++++ www/app/pages/options.php | 8 +- www/app/pages/reference/contractlist.php | 201 ++++++++++++++++++ www/templates/pages/firmlist.html | 82 +++++++ .../pages/reference/contractlist.html | 103 +++++++++ .../pages/reference/servicelist.html | 2 +- 16 files changed, 709 insertions(+), 45 deletions(-) create mode 100644 www/app/entity/contract.php create mode 100644 www/app/entity/firm.php create mode 100644 www/app/pages/firmlist.php create mode 100644 www/app/pages/reference/contractlist.php create mode 100644 www/templates/pages/firmlist.html create mode 100644 www/templates/pages/reference/contractlist.html diff --git a/db/initdata.sql b/db/initdata.sql index f8ee22ace..9bb107ec5 100644 --- a/db/initdata.sql +++ b/db/initdata.sql @@ -73,7 +73,6 @@ INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `men 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_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 2, 'Движение по контрагентам', 'CustActivity', 'Платежи', 0); -INSERT INTO `metadata` (`meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 1, 'Договор', 'Contract', '', 0); INSERT INTO `metadata` (`meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 4, 'Договора', 'ContractList', '', 0); - + diff --git a/db/initdata_ua.sql b/db/initdata_ua.sql index 030e729ca..523cc574f 100644 --- a/db/initdata_ua.sql +++ b/db/initdata_ua.sql @@ -74,5 +74,4 @@ INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `men 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_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 2, 'Рух по контрагентах', 'CustActivity', 'Платежі', 0); -INSERT INTO `metadata` (`meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 1, 'Контракт', 'Contract', '', 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( 4, 'Контракти', 'ContractList', '', 0); \ No newline at end of file diff --git a/db/update430to431.sql b/db/update430to431.sql index 36a63eb51..cdb24bcb3 100644 --- a/db/update430to431.sql +++ b/db/update430to431.sql @@ -1,7 +1,7 @@ CREATE TABLE `firms` ( `firm_id` int(11) NOT NULL AUTO_INCREMENT, `firm_name` varchar(255) NOT NULL, - `details` longtext NOT NULL, + `details` longtext , `disabled` tinyint(1) NOT NULL DEFAULT '0', PRIMARY KEY (`firm_id`) ) ENGINE=MyISAM CHARSET=utf8; @@ -34,8 +34,29 @@ ALTER VIEW `documents_view` AS from (((((`documents` `d` left join `users_view` `u` on((`d`.`user_id` = `u`.`user_id`))) left join `customers` `c` on((`d`.`customer_id` = `c`.`customer_id`))) join `metadata` on((`metadata`.`meta_id` = `d`.`meta_id`))) left join `branches` `b` on((`d`.`branch_id` = `b`.`branch_id`))) left join `firms` `f` on((`d`.`firm_id` = `f`.`firm_id`))); - -INSERT INTO `metadata` (`meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 1, '�������', 'Contract', '', 0); -INSERT INTO `metadata` (`meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 4, '��������', 'ContractList', '', 0); - - \ No newline at end of file +CREATE TABLE `contracts` ( + `contract_id` int(11) NOT NULL AUTO_INCREMENT, + `customer_id` int(11) DEFAULT '0', + `firm_id` int(11) DEFAULT '0', + `createdon` date NOT NULL, + `contract_number` varchar(64) NOT NULL, + `disabled` tinyint(1) DEFAULT '0', + `details` longtext NOT NULL, + PRIMARY KEY (`contract_id`) +) DEFAULT CHARSET=utf8; + + +CREATE VIEW `contracts_view` AS + select + `co`.`contract_id` AS `contract_id`, + `co`.`customer_id` AS `customer_id`, + `co`.`firm_id` AS `firm_id`, + `co`.`createdon` AS `createdon`, + `co`.`contract_number` AS `contract_number`, + `co`.`disabled` AS `disabled`, + `co`.`details` AS `details`, + `cu`.`customer_name` AS `customer_name`, + `f`.`firm_name` AS `firm_name` + from + ((`contracts` `co` join `customers` `cu` on((`co`.`customer_id` = `cu`.`customer_id`))) left join `firms` `f` on((`co`.`firm_id` = `f`.`firm_id`))); + \ No newline at end of file diff --git a/www/app/acl.php b/www/app/acl.php index f34e8f879..873caabc2 100644 --- a/www/app/acl.php +++ b/www/app/acl.php @@ -273,7 +273,7 @@ public static function checkShowSer($ser, $showerror = true) { * возвращает ограничение для ресурсов по филиалам * @param mixed $nul включая те у которых филиал не задан */ - public static function getBranchConstraint($nul = false) { + public static function getBranchConstraint( ) { $options = \App\System::getOptions('common'); if ($options['usebranch'] != 1) { return ''; @@ -281,11 +281,9 @@ public static function getBranchConstraint($nul = false) { $id = \App\System::getBranch(); //если выбран конкретный if ($id > 0) { - if ($nul == true) { - return "branch_id in (0,{$id})"; - } else { - return "branch_id in ({$id})"; - } + + return "branch_id in (0,{$id})"; + } @@ -295,14 +293,12 @@ public static function getBranchConstraint($nul = false) { } if (strlen($user->aclbranch) == 0) { - return '1=2'; + return "branch_id in (0 )"; } //нет доступа ни к одному филиалу - if ($nul == true) { - return "branch_id in (0,{$user->aclbranch})"; - } else { - return "branch_id in ({$user->aclbranch})"; - } + + return "branch_id in (0,{$user->aclbranch})"; + } diff --git a/www/app/entity/contract.php b/www/app/entity/contract.php new file mode 100644 index 000000000..a1e284649 --- /dev/null +++ b/www/app/entity/contract.php @@ -0,0 +1,55 @@ +contract_id = 0; + $this->createdon = time(); + } + + protected function afterLoad() { + + $this->createdon = strtotime($this->createdon); + + $xml = @simplexml_load_string($this->details); + + $this->shortdesc = (string)($xml->shortdesc[0]); + $this->payname = (string)($xml->payname[0]); + $this->pay = (int)($xml->pay[0]); + + parent::afterLoad(); + } + + protected function beforeSave() { + parent::beforeSave(); + $this->details = "
"; + //упаковываем данные + $this->details .= "shortdesc}]]>"; + $this->details .= "payname}]]>"; + $this->details .= "{$this->pay}"; + + $this->details .= "
"; + + return true; + } + + public static function PayList(){ + return array( + 1=>'Нал', + 2=>'Безнал', + 3=>'Кредит', + 4=>'Под реализацию' + ); + } + +} diff --git a/www/app/entity/doc/document.php b/www/app/entity/doc/document.php index 2ab4a88ba..579f62827 100644 --- a/www/app/entity/doc/document.php +++ b/www/app/entity/doc/document.php @@ -321,15 +321,12 @@ public static function create($classname, $branch_id = 0) { $doc = new $fullclassname(); $doc->meta_id = $meta['meta_id']; - if($classname=='Contract') { - $doc->branch_id = 0; - } - else { - $doc->branch_id = $branch_id; - if ($branch_id == 0 ) { - $doc->branch_id = \App\Acl::checkCurrentBranch(); - } + + $doc->branch_id = $branch_id; + if ($branch_id == 0 ) { + $doc->branch_id = \App\Acl::checkCurrentBranch(); } + return $doc; } diff --git a/www/app/entity/employee.php b/www/app/entity/employee.php index e5c7e8b50..b41087273 100644 --- a/www/app/entity/employee.php +++ b/www/app/entity/employee.php @@ -28,11 +28,8 @@ protected function beforeSave() { $this->detail .= "{$this->balance}"; $this->detail .= "{$this->email}"; $this->detail .= "{$this->phone}"; - $this->detail .= "{$this->comment}"; - // $this->detail .= "{$this->ztype}"; - // $this->detail .= "{$this->zhour}"; - // $this->detail .= "{$this->zmon}"; - // $this->detail .= "{$this->advance}"; + $this->detail .= "comment}]]>"; + $this->detail .= ""; return true; diff --git a/www/app/entity/firm.php b/www/app/entity/firm.php new file mode 100644 index 000000000..007e4d6cc --- /dev/null +++ b/www/app/entity/firm.php @@ -0,0 +1,50 @@ +firm_id = 0; + } + + protected function afterLoad() { + + + $xml = @simplexml_load_string($this->detail); + + $this->hours = (string)($xml->hours[0]); + $this->price = (string)($xml->price[0]); + + + parent::afterLoad(); + } + + protected function beforeSave() { + parent::beforeSave(); + $this->detail = ""; + //упаковываем данные в detail + $this->detail .= "{$this->price}"; + $this->detail .= "{$this->hours}"; + + $this->detail .= ""; + + return true; + } + + protected function beforeDelete() { + + $conn = \ZDB\DB::getConnect(); + $sql = " select count(*) from entrylist where service_id = {$this->service_id}"; + $cnt = $conn->GetOne($sql); + return ($cnt > 0) ? \App\Helper::l('nodelservice') : ""; + } + +} diff --git a/www/app/entity/metadata.php b/www/app/entity/metadata.php index 60e5f3ebb..c7d51e7b9 100644 --- a/www/app/entity/metadata.php +++ b/www/app/entity/metadata.php @@ -13,16 +13,16 @@ class MetaData extends \ZCL\DB\Entity const METATYPE_DOC = 1; const METATYPE_REP = 2; - const METATYPE_REF = 3; - const METATYPE_REG = 4; + const METATYPE_REG = 3; + const METATYPE_REF = 4; const METATYPE_SER = 5; public static function getNames() { $list = array(); $list[1] = \App\Helper::l("md_doc"); $list[2] = \App\Helper::l("md_rep"); - $list[3] = \App\Helper::l("md_ref"); - $list[4] = \App\Helper::l("md_reg"); + $list[3] = \App\Helper::l("md_reg"); + $list[4] = \App\Helper::l("md_ref"); $list[5] = \App\Helper::l("md_ser"); diff --git a/www/app/entity/service.php b/www/app/entity/service.php index 056425c30..a9d1c9bbf 100644 --- a/www/app/entity/service.php +++ b/www/app/entity/service.php @@ -3,7 +3,7 @@ namespace App\Entity; /** - * Клас-сущность категория товара + * Клас-сущность работа, услуга * * @table=services * @keyfield=service_id diff --git a/www/app/pages/firmlist.php b/www/app/pages/firmlist.php new file mode 100644 index 000000000..435a416ad --- /dev/null +++ b/www/app/pages/firmlist.php @@ -0,0 +1,164 @@ +add(new Form('filter'))->onSubmit($this, 'OnFilter'); + $this->filter->add(new CheckBox('showdis')); + $this->filter->add(new TextInput('searchkey')); + + $this->add(new Panel('servicetable'))->setVisible(true); + $this->servicetable->add(new DataView('servicelist', new ServiceDataSource($this), $this, 'servicelistOnRow'))->Reload(); + $this->servicetable->add(new ClickLink('addnew'))->onClick($this, 'addOnClick'); + $this->servicetable->servicelist->setPageSize(H::getPG()); + $this->servicetable->add(new \Zippy\Html\DataList\Paginator('pag', $this->servicetable->servicelist)); + + $this->add(new Form('servicedetail'))->setVisible(false); + $this->servicedetail->add(new TextInput('editservice_name')); + $this->servicedetail->add(new TextInput('editprice')); + $this->servicedetail->add(new TextInput('edithours')); + $this->servicedetail->add(new CheckBox('editdisabled')); + + $this->servicedetail->add(new SubmitButton('save'))->onClick($this, 'saveOnClick'); + $this->servicedetail->add(new Button('cancel'))->onClick($this, 'cancelOnClick'); + } + + public function servicelistOnRow($row) { + $item = $row->getDataItem(); + + $row->add(new Label('service_name', $item->service_name)); + $row->add(new Label('price', $item->price)); + $row->add(new Label('hours', $item->hours)); + $row->add(new ClickLink('edit'))->onClick($this, 'editOnClick'); + $row->add(new ClickLink('delete'))->onClick($this, 'deleteOnClick'); + } + + public function deleteOnClick($sender) { + if (false == \App\ACL::checkEditRef('ServiceList')) { + return; + } + + $service_id = $sender->owner->getDataItem()->service_id; + + $del = Service::delete($service_id); + if (strlen($del) > 0) { + $this->setError($del); + return; + } + $this->servicetable->servicelist->Reload(); + } + + public function editOnClick($sender) { + $this->_service = $sender->owner->getDataItem(); + $this->servicetable->setVisible(false); + $this->servicedetail->setVisible(true); + $this->servicedetail->editservice_name->setText($this->_service->service_name); + $this->servicedetail->editprice->setText($this->_service->price); + $this->servicedetail->edithours->setText($this->_service->hours); + $this->servicedetail->editdisabled->setChecked($this->_service->disabled); + } + + public function addOnClick($sender) { + $this->servicetable->setVisible(false); + $this->servicedetail->setVisible(true); + // Очищаем форму + $this->servicedetail->clean(); + + $this->_service = new Service(); + } + + public function saveOnClick($sender) { + if (false == \App\ACL::checkEditRef('ServiceList')) { + return; + } + + $this->_service->service_name = $this->servicedetail->editservice_name->getText(); + $this->_service->price = $this->servicedetail->editprice->getText(); + $this->_service->hours = $this->servicedetail->edithours->getText(); + if ($this->_service->service_name == '') { + $this->setError("entername"); + return; + } + $this->_service->disabled = $this->servicedetail->editdisabled->isChecked() ? 1 : 0; + + $this->_service->Save(); + $this->servicedetail->setVisible(false); + $this->servicetable->setVisible(true); + $this->servicetable->servicelist->Reload(); + } + + public function cancelOnClick($sender) { + $this->servicetable->setVisible(true); + $this->servicedetail->setVisible(false); + } + + public function OnFilter($sender) { + $this->servicetable->servicelist->Reload(); + } + +} + +class ServiceDataSource implements \Zippy\Interfaces\DataSource +{ + + private $page; + + public function __construct($page) { + $this->page = $page; + } + + private function getWhere() { + + $form = $this->page->filter; + $where = "1=1"; + $text = trim($form->searchkey->getText()); + $showdis = $form->showdis->isChecked(); + + + if ($showdis > 0) { + + } else { + $where = $where . " and disabled <> 1"; + } + if (strlen($text) > 0) { + $text = Service::qstr('%' . $text . '%'); + $where = $where . " and service_name like {$text} "; + } + return $where; + } + + public function getItemCount() { + return Service::findCnt($this->getWhere()); + } + + public function getItems($start, $count, $sortfield = null, $asc = null) { + return Service::find($this->getWhere(), "service_name asc", $count, $start); + } + + public function getItem($id) { + return Service::load($id); + } + +} diff --git a/www/app/pages/options.php b/www/app/pages/options.php index 372b0790e..ebf919c3d 100644 --- a/www/app/pages/options.php +++ b/www/app/pages/options.php @@ -265,10 +265,10 @@ public function filterOnSubmit($sender) { if ($this->listpan->filter->frep->isChecked()) { $where .= " or meta_type = 2"; } - if ($this->listpan->filter->fref->isChecked()) { + if ($this->listpan->filter->freg->isChecked()) { $where .= " or meta_type = 3"; } - if ($this->listpan->filter->freg->isChecked()) { + if ($this->listpan->filter->fref->isChecked()) { $where .= " or meta_type = 4"; } if ($this->listpan->filter->fser->isChecked()) { @@ -308,10 +308,10 @@ public function metarowOnRow($row) { $title = H::l('md_rep'); break; case 3: - $title = H::l('md_ref'); + $title = H::l('md_reg'); break; case 4: - $title = H::l('md_reg'); + $title = H::l('md_ref'); break; case 5: $title = H::l('md_ser'); diff --git a/www/app/pages/reference/contractlist.php b/www/app/pages/reference/contractlist.php new file mode 100644 index 000000000..4e91d45ef --- /dev/null +++ b/www/app/pages/reference/contractlist.php @@ -0,0 +1,201 @@ +add(new Form('filter'))->onSubmit($this, 'OnFilter'); + $this->filter->add(new CheckBox('showdis')); + $this->filter->add(new TextInput('searchkey')); + $this->filter->add(new AutocompleteTextInput('searchcust'))->onText($this, 'OnAutoCustomer'); + $this->filter->add(new DropDownChoice('searchcomp',Firm::findArray('firm_name','disabled<>1','firm_name'),0)); + + $this->add(new Panel('contracttable'))->setVisible(true); + $this->contracttable->add(new DataView('contractlist', new ContractDataSource($this), $this, 'contractlistOnRow'))->Reload(); + $this->contracttable->add(new ClickLink('addnew'))->onClick($this, 'addOnClick'); + $this->contracttable->contractlist->setPageSize(H::getPG()); + $this->contracttable->add(new \Zippy\Html\DataList\Paginator('pag', $this->contracttable->contractlist)); + + $this->add(new Form('contractdetail'))->setVisible(false); + $this->contractdetail->add(new TextInput('editcontract_number')); + $this->contractdetail->add(new TextInput('editshortdesc')); + $this->contractdetail->add(new AutocompleteTextInput('editcust'))->onText($this, 'OnAutoCustomer'); + $this->contractdetail->add(new DropDownChoice('editcomp',Firm::findArray('firm_name','disabled<>1','firm_name'),0)); + $this->contractdetail->add(new DropDownChoice('editpay',Contract::PayList() ,0)); + + $this->contractdetail->add(new CheckBox('editdisabled')); + + $this->contractdetail->add(new SubmitButton('save'))->onClick($this, 'saveOnClick'); + $this->contractdetail->add(new Button('cancel'))->onClick($this, 'cancelOnClick'); + } + + public function contractlistOnRow($row) { + $item = $row->getDataItem(); + + $row->add(new Label('contract_number', $item->contract_number)); + $row->add(new Label('shortdesc', $item->shortdesc)); + $row->add(new Label('createdon', H::fd($item->createdon))); + $row->add(new Label('customer', $item->customer_name)); + $row->add(new Label('firm', $item->firm_name)); + $row->add(new Label('payname', $item->payname)); + $row->add(new ClickLink('edit'))->onClick($this, 'editOnClick'); + $row->add(new ClickLink('delete'))->onClick($this, 'deleteOnClick'); + } + + public function deleteOnClick($sender) { + if (false == \App\ACL::checkEditRef('ContractList')) { + return; + } + + $contract_id = $sender->owner->getDataItem()->contract_id; + + $del = Contract::delete($contract_id); + if (strlen($del) > 0) { + $this->setError($del); + return; + } + $this->contracttable->contractlist->Reload(); + } + + public function editOnClick($sender) { + $this->_contract = $sender->owner->getDataItem(); + $this->contracttable->setVisible(false); + $this->contractdetail->setVisible(true); + $this->contractdetail->editcontract_number->setText($this->_contract->contract_number); + $this->contractdetail->editshortdesc->setText($this->_contract->shortdesc); + $this->contractdetail->editdisabled->setChecked($this->_contract->disabled); + $this->contractdetail->editcust->setKey($this->_contract->customer_id); + $this->contractdetail->editcust->setText($this->_contract->customer_name); + $this->contractdetail->editcomp->setValue($this->_contract->firm_id); + $this->contractdetail->editpay->setValue($this->_contract->pay); + } + + public function addOnClick($sender) { + $this->contracttable->setVisible(false); + $this->contractdetail->setVisible(true); + // Очищаем форму + $this->contractdetail->clean(); + + $this->_contract = new Contract(); + } + + public function saveOnClick($sender) { + if (false == \App\ACL::checkEditRef('ContractList')) { + return; + } + + $this->_contract->contract_number = $this->contractdetail->editcontract_number->getText(); + if ($this->_contract->contract_number == '') { + $this->setError("entername"); + return; + } + $this->_contract->customer_id = $this->contractdetail->editcust->getKey(); + if ($this->_contract->customer_id == 0) { + $this->setError("noselcust"); + return; + } + + $this->_contract->shortdesc = $this->contractdetail->editshortdesc->getText(); + $this->_contract->firm_id = $this->contractdetail->editcomp->getValue(); + $this->_contract->pay = $this->contractdetail->editpay->getValue(); + $this->_contract->payname = $this->contractdetail->editpay->getValueName(); + $this->_contract->disabled = $this->contractdetail->editdisabled->isChecked() ? 1 : 0; + + $this->_contract->save(); + $this->contractdetail->setVisible(false); + $this->contracttable->setVisible(true); + $this->contracttable->contractlist->Reload(false); + } + + public function cancelOnClick($sender) { + $this->contracttable->setVisible(true); + $this->contractdetail->setVisible(false); + } + + public function OnFilter($sender) { + $this->contracttable->contractlist->Reload(); + } + + public function OnAutoCustomer($sender) { + $text = Customer::qstr('%' . $sender->getText() . '%'); + return Customer::findArray("customer_name", "status=0 and (customer_name like {$text} or phone like {$text} )"); + } + +} + +class ContractDataSource implements \Zippy\Interfaces\DataSource +{ + + private $page; + + public function __construct($page) { + $this->page = $page; + } + + private function getWhere() { + + $form = $this->page->filter; + $where = "1=1"; + $text = trim($form->searchkey->getText()); + $showdis = $form->showdis->isChecked(); + $cust = $form->searchcust->getKey(); + $comp = $form->searchcomp->getValue(); + + + if ($cust > 0) { + $where = $where . " and customer_id = ". $cust; + } + if ($comp > 0) { + $where = $where . " and firm_id = ". $comp; + } + + if ($showdis > 0) { + + } else { + $where = $where . " and disabled <> 1"; + } + if (strlen($text) > 0) { + $text = Contract::qstr('%' . $text . '%'); + $where = $where . " and contract_number like {$text} "; + } + return $where; + } + + public function getItemCount() { + return Contract::findCnt($this->getWhere()); + } + + public function getItems($start, $count, $sortfield = null, $asc = null) { + return Contract::find($this->getWhere(), "createdon desc", $count, $start); + } + + public function getItem($id) { + return Contract::load($id); + } + +} diff --git a/www/templates/pages/firmlist.html b/www/templates/pages/firmlist.html new file mode 100644 index 000000000..0ac255805 --- /dev/null +++ b/www/templates/pages/firmlist.html @@ -0,0 +1,82 @@ + + + + + +
+
+
+

Список компаний

+ + Добавить +
+ + + + + + + + + + + + + + + +
НазваниеСтоимостьНормо-часы
+
+ + + + + + +
+
+
+ + +
+
+ +
+ +
+
+
+ +
+ +
+
+
+ + +
+    + + +
+
+ + + \ No newline at end of file diff --git a/www/templates/pages/reference/contractlist.html b/www/templates/pages/reference/contractlist.html new file mode 100644 index 000000000..723ef8b02 --- /dev/null +++ b/www/templates/pages/reference/contractlist.html @@ -0,0 +1,103 @@ + + + + + +
+
+
+

Договора

+ + Добавить + + + + + + + + + + + + + + + + + + + + + + + +
НомерДатаКонтрагентКомпанияОплата
+
+ +
+ + +
+
+
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+ +
+ + +
+    + + +
+
+ + + \ No newline at end of file diff --git a/www/templates/pages/reference/servicelist.html b/www/templates/pages/reference/servicelist.html index 7ef92ba44..0c15a6d58 100644 --- a/www/templates/pages/reference/servicelist.html +++ b/www/templates/pages/reference/servicelist.html @@ -39,7 +39,7 @@

Услуги, работы

- From 9a3e004c6934e2d1e756608e1c37c1f75371490f Mon Sep 17 00:00:00 2001 From: Leon Date: Sun, 31 May 2020 18:08:07 +0300 Subject: [PATCH 5/8] =?UTF-8?q?=D0=B4=D0=BE=D0=B3=D0=BE=D0=B2=D0=BE=D1=80?= =?UTF-8?q?=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- www/app/entity/contract.php | 10 +- www/app/pages/reference/contractlist.php | 2 +- www/templates/lang.json | 13 ++- www/templates_ua/lang.json | 5 + .../pages/reference/contractlist.html | 101 ++++++++++++++++++ 5 files changed, 120 insertions(+), 11 deletions(-) create mode 100644 www/templates_ua/pages/reference/contractlist.html diff --git a/www/app/entity/contract.php b/www/app/entity/contract.php index a1e284649..8ede85c52 100644 --- a/www/app/entity/contract.php +++ b/www/app/entity/contract.php @@ -37,7 +37,6 @@ protected function beforeSave() { $this->details .= "shortdesc}]]>"; $this->details .= "payname}]]>"; $this->details .= "{$this->pay}"; - $this->details .= ""; return true; @@ -45,11 +44,10 @@ protected function beforeSave() { public static function PayList(){ return array( - 1=>'Нал', - 2=>'Безнал', - 3=>'Кредит', - 4=>'Под реализацию' + 1=>\App\Helper::l('cnal'), + 2=>\App\Helper::l('cbeznal'), + 3=>\App\Helper::l('ckredit'), + 4=>\App\Helper::l('creal') ); } - } diff --git a/www/app/pages/reference/contractlist.php b/www/app/pages/reference/contractlist.php index 4e91d45ef..4246a2349 100644 --- a/www/app/pages/reference/contractlist.php +++ b/www/app/pages/reference/contractlist.php @@ -111,7 +111,7 @@ public function saveOnClick($sender) { $this->_contract->contract_number = $this->contractdetail->editcontract_number->getText(); if ($this->_contract->contract_number == '') { - $this->setError("entername"); + $this->setError("notnumber"); return; } $this->_contract->customer_id = $this->contractdetail->editcust->getKey(); diff --git a/www/templates/lang.json b/www/templates/lang.json index 6742b6052..ea8aabecd 100644 --- a/www/templates/lang.json +++ b/www/templates/lang.json @@ -208,11 +208,16 @@ "name": "Наименование", "code": "Код", "brand": "Бренд", - "onlyadminaccess": "К странице имеет доступ только пользователь admin", - "onlyadminsaccess": "К странице имеют доступ только пользователи с ролью admins ", - "onlyadminsuser": "Пользователями может управлять только пользователи с ролью admins ", + "onlyadminaccess": "К странице имеет доступ только пользователь admin", + "onlyadminsaccess": "К странице имеют доступ только пользователи с ролью admins ", + "onlyadminsuser": "Пользователями может управлять только пользователи с ролью admins ", + "notnumber": "Не введен номер", + "cnal" : "Нал", + "cbeznal": "Безнал", + "ckredit": "В кредит", + "creal" : "Под реализацию", "refreshed": "Обновлено", - "sent": "Отправлено", + "sent" : "Отправлено", "saved": "Сохранено" } \ No newline at end of file diff --git a/www/templates_ua/lang.json b/www/templates_ua/lang.json index 58eb49a88..83ed129de 100644 --- a/www/templates_ua/lang.json +++ b/www/templates_ua/lang.json @@ -208,6 +208,11 @@ "onlyadminaccess": "До сторiнки має доступ тiльки користувач admin", "onlyadminsaccess": "До сторiнки мають доступ тiльки користувачi з admins ", "onlyadminsuser": "Користувачами може керувати тiльки користувач з admins ", + "notnumber": "Не введено номер", + "cnal" : "Готiвка", + "cbeznal": "Безготiвка", + "ckredit": "В кредит", + "creal" : "Пiд реалiзацiю", "refreshed": "Оновлено", "sent": "Відправлено", diff --git a/www/templates_ua/pages/reference/contractlist.html b/www/templates_ua/pages/reference/contractlist.html new file mode 100644 index 000000000..cb1ad4700 --- /dev/null +++ b/www/templates_ua/pages/reference/contractlist.html @@ -0,0 +1,101 @@ + + + + + +
+
+
+

Контракти

+ + Добавити + + + + + + + + + + + + + + + + + + + + + +
НомерДатаКонтрагентКомпанiяОплата
+
+ +
+ + +
+
+
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+ +
+ + +
+    + + +
+
+ + + \ No newline at end of file From bbb76ae533be402174aa4f07e9df794518648604 Mon Sep 17 00:00:00 2001 From: Leon Date: Sun, 31 May 2020 18:08:50 +0300 Subject: [PATCH 6/8] =?UTF-8?q?=D0=B8=D0=BC=D0=BF=D0=BE=D1=80=D1=82=20=20?= =?UTF-8?q?=D0=BA=D0=BB=D0=B8=D0=B5=D0=BD=D1=82=D0=BE=D0=B2=20=D1=81=20=20?= =?UTF-8?q?=D0=BE=D0=BF=D0=B5=D0=BD=D0=BA=D0=B0=D1=80=D1=82=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- www/app/entity/customer.php | 2 ++ www/app/modules/ocstore/orders.php | 30 ++++++++++++++++++++++++++---- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/www/app/entity/customer.php b/www/app/entity/customer.php index 8fa83baa3..309760476 100644 --- a/www/app/entity/customer.php +++ b/www/app/entity/customer.php @@ -34,6 +34,7 @@ protected function beforeSave() { $this->detail .= "{$this->bonus}"; $this->detail .= "{$this->type}"; $this->detail .= "{$this->jurid}"; + $this->detail .= "{$this->shopcust_id}"; $this->detail .= "
address}]]>
"; $this->detail .= "comment}]]>"; $this->detail .= ""; @@ -49,6 +50,7 @@ protected function afterLoad() { $this->bonus = (int)($xml->bonus[0]); $this->type = (int)($xml->type[0]); $this->jurid = (int)($xml->jurid[0]); + $this->shopcust_id = (int)($xml->shopcust_id[0]); $this->address = (string)($xml->address[0]); $this->comment = (string)($xml->comment[0]); diff --git a/www/app/modules/ocstore/orders.php b/www/app/modules/ocstore/orders.php index 44702bb1b..81f5f28a1 100644 --- a/www/app/modules/ocstore/orders.php +++ b/www/app/modules/ocstore/orders.php @@ -4,6 +4,7 @@ use App\Entity\Doc\Document; use App\Entity\Item; +use App\Entity\Customer; use App\System; use Zippy\Binding\PropertyBinding as Prop; use Zippy\Html\DataList\ArrayDataSource; @@ -145,7 +146,7 @@ public function onImport($sender) { $tovar = Item::getFirst('item_code=' . $code); if ($tovar == null) { - $this->setWarn("nofoundarticle_inorder", $product['name'], $shoporder['order_id']); + $this->setWarn("nofoundarticle_inorder", $product['name'], $shoporder->order_id); continue; } $tovar->quantity = $product['quantity']; @@ -155,13 +156,34 @@ public function onImport($sender) { $tlist[] = $tovar; } $neworder->packDetails('detaildata', $tlist); - + $neworder->amount = round($shoporder->total); $neworder->headerdata['ocorder'] = $shoporder->order_id; $neworder->headerdata['ocorderback'] = 0; - $neworder->headerdata['occlient'] = $shoporder->firstname . ' ' . $shoporder->lastname; - $neworder->amount = round($shoporder->total); + $neworder->notes = "OC номер:{$shoporder->order_id};"; + + + $neworder->headerdata['occlient'] = $shoporder->firstname . ' ' . $shoporder->lastname; $neworder->notes .= " Клиент:" . $shoporder->firstname . ' ' . $shoporder->lastname . ";"; + + if($shoporder->customer_id>0){ + $cust = Customer::getFirst("detail like '%{$shoporder->customer_id}%'") ; + if($cust == null) { + $cust = new Customer(); + $cust->shopcust_id = $shoporder->customer_id; + $cust->customer_name = $shoporder->firstname . ' ' . $shoporder->lastname; + $cust->address = $shoporder->shipping_city . ' ' . $shoporder->shipping_address_1 ; + $cust->type = Customer::TYPE_BAYER ; + $cust->phone = $shoporder->telephone ; + $cust->email = $shoporder->email ; + $cust->comment = "Клиент ИМ" ; + $cust->save(); + + } + $neworder->customer_id = $cust->customer_id; + } + + if (strlen($shoporder->email) > 0) { $neworder->notes .= " Email:" . $shoporder->email . ";"; } From 677a67bbdbea731a2aecf4c6a60b046e2f7cf6fd Mon Sep 17 00:00:00 2001 From: Leon Date: Tue, 2 Jun 2020 11:38:12 +0300 Subject: [PATCH 7/8] =?UTF-8?q?=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=B8=D1=87?= =?UTF-8?q?=D0=BD=D0=B8=D0=BA=20=D1=84=D0=B8=D1=80=D0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 11 +- db/{update430to431.sql => update430to440.sql} | 1 + www/app/entity/contract.php | 2 + www/app/entity/firm.php | 14 +- www/app/entity/message.php | 1 + www/app/helper.php | 1 + www/app/modules/ocstore/options.php | 5 +- www/app/modules/ocstore/orders.php | 6 +- www/app/pages/firmlist.php | 138 ++++++------------ www/app/pages/reference/contractlist.php | 29 +++- www/app/pages/register/gilist.php | 7 + www/app/pages/register/grlist.php | 6 + www/app/pages/userlogin.php | 27 +++- www/templates/modules/ocstore/options.html | 5 + www/templates/pages/firmlist.html | 53 ++----- www/templates/pages/options.html | 4 +- .../pages/reference/contractlist.html | 25 +++- www/templates/pages/register/gilist.html | 10 ++ www/templates/pages/register/grlist.html | 14 +- www/templates/pages/userlogin.html | 2 +- www/templates_ua/modules/ocstore/options.html | 9 +- www/templates_ua/pages/options.html | 2 +- .../pages/reference/contractlist.html | 23 ++- www/templates_ua/pages/register/gilist.html | 10 +- www/templates_ua/pages/register/grlist.html | 10 +- www/templates_ua/pages/userlogin.html | 5 +- 26 files changed, 242 insertions(+), 178 deletions(-) rename db/{update430to431.sql => update430to440.sql} (98%) diff --git a/CHANGELOG.md b/CHANGELOG.md index e81acee15..6c9cc858a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,13 @@ CHANGELOG ========= -### v4.3.1 (2020-05-31) -* Добавлена возможность работать в разрезе нескольких компаний. -* Добавлен документ Договор и журнал договоров. -Для обновления выполнить update430to431.sql обновить папки app, templates, templates_ua. Обновить библиотеки согласно composer.json +### v4.4.0 (2020-06-03) +* Добавлена возможность работать в разрезе нескольких компаний. +* Справочник договоров. +* Импорт клиентов с опенкарта в справочник контрагентов. +* Уведомление о выходе новой версии на странице логина. + +Для обновления выполнить update430to440.sql обновить папки app, templates, templates_ua. Обновить библиотеки согласно composer.json ### v4.3.0 (2020-05-25) * добавлены роли пользователей. Теперь разделение доступа и оперативное меню настраивается на уровне роли. diff --git a/db/update430to431.sql b/db/update430to440.sql similarity index 98% rename from db/update430to431.sql rename to db/update430to440.sql index cdb24bcb3..bf5658a88 100644 --- a/db/update430to431.sql +++ b/db/update430to440.sql @@ -28,6 +28,7 @@ ALTER VIEW `documents_view` AS `d`.`parent_id` AS `parent_id`, `d`.`branch_id` AS `branch_id`, `b`.`branch_name` AS `branch_name`, + `f`.`firm_id` AS `firm_id`, `f`.`firm_name` AS `firm_name`, `metadata`.`meta_name` AS `meta_name`, `metadata`.`description` AS `meta_desc` diff --git a/www/app/entity/contract.php b/www/app/entity/contract.php index 8ede85c52..7c02c8c7b 100644 --- a/www/app/entity/contract.php +++ b/www/app/entity/contract.php @@ -26,6 +26,7 @@ protected function afterLoad() { $this->shortdesc = (string)($xml->shortdesc[0]); $this->payname = (string)($xml->payname[0]); $this->pay = (int)($xml->pay[0]); + $this->file_id = (int)($xml->file_id[0]); parent::afterLoad(); } @@ -37,6 +38,7 @@ protected function beforeSave() { $this->details .= "shortdesc}]]>"; $this->details .= "payname}]]>"; $this->details .= "{$this->pay}"; + $this->details .= "{$this->file_id}"; $this->details .= ""; return true; diff --git a/www/app/entity/firm.php b/www/app/entity/firm.php index 007e4d6cc..025294e0f 100644 --- a/www/app/entity/firm.php +++ b/www/app/entity/firm.php @@ -18,23 +18,21 @@ protected function init() { protected function afterLoad() { - $xml = @simplexml_load_string($this->detail); + $xml = @simplexml_load_string($this->details); $this->hours = (string)($xml->hours[0]); - $this->price = (string)($xml->price[0]); - + parent::afterLoad(); } protected function beforeSave() { parent::beforeSave(); - $this->detail = ""; - //упаковываем данные в detail - $this->detail .= "{$this->price}"; - $this->detail .= "{$this->hours}"; + $this->details = "
"; + + - $this->detail .= ""; + $this->details .= "
"; return true; } diff --git a/www/app/entity/message.php b/www/app/entity/message.php index 1f8544eb0..c88f90615 100644 --- a/www/app/entity/message.php +++ b/www/app/entity/message.php @@ -18,6 +18,7 @@ class Message extends \ZCL\DB\Entity const TYPE_NOTE = 4; const TYPE_ISSUE = 5; const TYPE_PROJECT = 6; + const TYPE_CONTRACT = 7; protected function afterLoad() { $this->created = strtotime($this->created); diff --git a/www/app/helper.php b/www/app/helper.php index cd91f4b68..1599a80ee 100644 --- a/www/app/helper.php +++ b/www/app/helper.php @@ -240,6 +240,7 @@ public static function addFile($file, $itemid, $comment, $itemtype = 0) { $data = $conn->qstr($data); $sql = "insert into filesdata (file_id,filedata) values ({$id},{$data}) "; $conn->Execute($sql); + return $id; } /** diff --git a/www/app/modules/ocstore/options.php b/www/app/modules/ocstore/options.php index 3a357d11a..5f140b360 100644 --- a/www/app/modules/ocstore/options.php +++ b/www/app/modules/ocstore/options.php @@ -30,6 +30,7 @@ public function __construct() { $form->add(new TextInput('site', $modules['ocsite'])); $form->add(new TextInput('apiname', $modules['ocapiname'])); $form->add(new CheckBox('outcome', $modules['ocoutcome'])); + $form->add(new CheckBox('insertcust', $modules['ocinsertcust'])); $form->add(new TextArea('key', $modules['ockey'])); $form->add(new DropDownChoice('defcust', \App\Entity\Customer::getList(), $modules['occustomer_id'] > 0 ? $modules['occustomer_id'] : 0)); $form->add(new DropDownChoice('defpricetype', \App\Entity\Item::getPriceTypeList(), $modules['ocpricetype'])); @@ -119,7 +120,8 @@ public function saveOnClick($sender) { $key = $this->cform->key->getText(); $customer_id = $this->cform->defcust->getValue(); $pricetype = $this->cform->defpricetype->getValue(); - $outcome = $this->cform->outcome->isChecked(); + $outcome = $this->cform->outcome->isChecked() ?1:0; + $insertcust = $this->cform->insertcust->isChecked()?1:0; if ($customer_id == 0) { $this->setError('noselcust'); @@ -141,6 +143,7 @@ public function saveOnClick($sender) { $modules['occustomer_id'] = $customer_id; $modules['ocpricetype'] = $pricetype; $modules['ocoutcome'] = $outcome; + $modules['ocinsertcust'] = $insertcust; System::setOptions("modules", $modules); $this->setSuccess('saved'); diff --git a/www/app/modules/ocstore/orders.php b/www/app/modules/ocstore/orders.php index 81f5f28a1..49f81f6b1 100644 --- a/www/app/modules/ocstore/orders.php +++ b/www/app/modules/ocstore/orders.php @@ -26,7 +26,7 @@ public function __construct() { parent::__construct(); if (strpos(System::getUser()->modules, 'ocstore') === false && System::getUser()->rolename != 'admins') { - System::setErrorMsg(H::l('noaccesstopage')); + System::setErrorMsg(\App\Helper::l('noaccesstopage')); App::RedirectHome(); return; @@ -166,7 +166,7 @@ public function onImport($sender) { $neworder->headerdata['occlient'] = $shoporder->firstname . ' ' . $shoporder->lastname; $neworder->notes .= " Клиент:" . $shoporder->firstname . ' ' . $shoporder->lastname . ";"; - if($shoporder->customer_id>0){ + if($shoporder->customer_id>0 && $modules['ocinsertcust'] == 1){ $cust = Customer::getFirst("detail like '%{$shoporder->customer_id}%'") ; if($cust == null) { $cust = new Customer(); @@ -180,7 +180,7 @@ public function onImport($sender) { $cust->save(); } - $neworder->customer_id = $cust->customer_id; + $neworder->customer_id = $cust->customer_id; } diff --git a/www/app/pages/firmlist.php b/www/app/pages/firmlist.php index 435a416ad..763eee3db 100644 --- a/www/app/pages/firmlist.php +++ b/www/app/pages/firmlist.php @@ -2,9 +2,10 @@ namespace App\Pages; -use App\Entity\Service; +use App\Entity\Firm; use App\Helper as H; use Zippy\Html\DataList\DataView; + use Zippy\Html\Form\Button; use Zippy\Html\Form\CheckBox; use Zippy\Html\Form\Form; @@ -17,148 +18,93 @@ class FirmList extends \App\Pages\Base { - private $_service; + private $_firm; public function __construct() { parent::__construct(); - if (false == \App\ACL::checkShowRef('ServiceList')) { + if (false == \App\ACL::checkShowRef('FirmList')) { return; } - $this->add(new Form('filter'))->onSubmit($this, 'OnFilter'); - $this->filter->add(new CheckBox('showdis')); - $this->filter->add(new TextInput('searchkey')); + + $this->add(new Panel('firmtable'))->setVisible(true); + $this->firmtable->add(new DataView('firmlist', new \ZCL\DB\EntityDataSource('\App\Entity\Firm', '', 'disabled,firm_name'), $this, 'firmlistOnRow'))->Reload(); + $this->firmtable->add(new ClickLink('addnew'))->onClick($this, 'addOnClick'); - $this->add(new Panel('servicetable'))->setVisible(true); - $this->servicetable->add(new DataView('servicelist', new ServiceDataSource($this), $this, 'servicelistOnRow'))->Reload(); - $this->servicetable->add(new ClickLink('addnew'))->onClick($this, 'addOnClick'); - $this->servicetable->servicelist->setPageSize(H::getPG()); - $this->servicetable->add(new \Zippy\Html\DataList\Paginator('pag', $this->servicetable->servicelist)); + $this->add(new Form('firmdetail'))->setVisible(false); + $this->firmdetail->add(new TextInput('editfirm_name')); + $this->firmdetail->add(new CheckBox('editdisabled')); - $this->add(new Form('servicedetail'))->setVisible(false); - $this->servicedetail->add(new TextInput('editservice_name')); - $this->servicedetail->add(new TextInput('editprice')); - $this->servicedetail->add(new TextInput('edithours')); - $this->servicedetail->add(new CheckBox('editdisabled')); - - $this->servicedetail->add(new SubmitButton('save'))->onClick($this, 'saveOnClick'); - $this->servicedetail->add(new Button('cancel'))->onClick($this, 'cancelOnClick'); + $this->firmdetail->add(new SubmitButton('save'))->onClick($this, 'saveOnClick'); + $this->firmdetail->add(new Button('cancel'))->onClick($this, 'cancelOnClick'); } - public function servicelistOnRow($row) { + public function firmlistOnRow($row) { $item = $row->getDataItem(); - $row->add(new Label('service_name', $item->service_name)); - $row->add(new Label('price', $item->price)); - $row->add(new Label('hours', $item->hours)); + $row->add(new Label('firm_name', $item->firm_name)); + $row->add(new ClickLink('edit'))->onClick($this, 'editOnClick'); $row->add(new ClickLink('delete'))->onClick($this, 'deleteOnClick'); } public function deleteOnClick($sender) { - if (false == \App\ACL::checkEditRef('ServiceList')) { + if (false == \App\ACL::checkEditRef('FirmList')) { return; } - $service_id = $sender->owner->getDataItem()->service_id; + $firm_id = $sender->owner->getDataItem()->firm_id; - $del = Service::delete($service_id); + $del = Firm::delete($firm_id); if (strlen($del) > 0) { $this->setError($del); return; } - $this->servicetable->servicelist->Reload(); + $this->firmtable->firmlist->Reload(); } public function editOnClick($sender) { - $this->_service = $sender->owner->getDataItem(); - $this->servicetable->setVisible(false); - $this->servicedetail->setVisible(true); - $this->servicedetail->editservice_name->setText($this->_service->service_name); - $this->servicedetail->editprice->setText($this->_service->price); - $this->servicedetail->edithours->setText($this->_service->hours); - $this->servicedetail->editdisabled->setChecked($this->_service->disabled); + $this->_firm = $sender->owner->getDataItem(); + $this->firmtable->setVisible(false); + $this->firmdetail->setVisible(true); + $this->firmdetail->editfirm_name->setText($this->_firm->firm_name); + $this->firmdetail->editdisabled->setChecked($this->_firm->disabled); } public function addOnClick($sender) { - $this->servicetable->setVisible(false); - $this->servicedetail->setVisible(true); + $this->firmtable->setVisible(false); + $this->firmdetail->setVisible(true); // Очищаем форму - $this->servicedetail->clean(); + $this->firmdetail->clean(); - $this->_service = new Service(); + $this->_firm = new Firm(); } public function saveOnClick($sender) { - if (false == \App\ACL::checkEditRef('ServiceList')) { + if (false == \App\ACL::checkEditRef('FirmList')) { return; } - $this->_service->service_name = $this->servicedetail->editservice_name->getText(); - $this->_service->price = $this->servicedetail->editprice->getText(); - $this->_service->hours = $this->servicedetail->edithours->getText(); - if ($this->_service->service_name == '') { + $this->_firm->firm_name = $this->firmdetail->editfirm_name->getText(); + + if ($this->_firm->firm_name == '') { $this->setError("entername"); return; } - $this->_service->disabled = $this->servicedetail->editdisabled->isChecked() ? 1 : 0; + $this->_firm->disabled = $this->firmdetail->editdisabled->isChecked() ? 1 : 0; - $this->_service->Save(); - $this->servicedetail->setVisible(false); - $this->servicetable->setVisible(true); - $this->servicetable->servicelist->Reload(); + $this->_firm->Save(); + $this->firmdetail->setVisible(false); + $this->firmtable->setVisible(true); + $this->firmtable->firmlist->Reload(); } public function cancelOnClick($sender) { - $this->servicetable->setVisible(true); - $this->servicedetail->setVisible(false); - } - - public function OnFilter($sender) { - $this->servicetable->servicelist->Reload(); + $this->firmtable->setVisible(true); + $this->firmdetail->setVisible(false); } + } -class ServiceDataSource implements \Zippy\Interfaces\DataSource -{ - - private $page; - - public function __construct($page) { - $this->page = $page; - } - - private function getWhere() { - - $form = $this->page->filter; - $where = "1=1"; - $text = trim($form->searchkey->getText()); - $showdis = $form->showdis->isChecked(); - - - if ($showdis > 0) { - - } else { - $where = $where . " and disabled <> 1"; - } - if (strlen($text) > 0) { - $text = Service::qstr('%' . $text . '%'); - $where = $where . " and service_name like {$text} "; - } - return $where; - } - - public function getItemCount() { - return Service::findCnt($this->getWhere()); - } - - public function getItems($start, $count, $sortfield = null, $asc = null) { - return Service::find($this->getWhere(), "service_name asc", $count, $start); - } - - public function getItem($id) { - return Service::load($id); - } - -} + diff --git a/www/app/pages/reference/contractlist.php b/www/app/pages/reference/contractlist.php index 4246a2349..db2c0a7b0 100644 --- a/www/app/pages/reference/contractlist.php +++ b/www/app/pages/reference/contractlist.php @@ -13,6 +13,7 @@ use Zippy\Html\Form\SubmitButton; use Zippy\Html\Form\AutocompleteTextInput; use Zippy\Html\Form\TextInput; +use Zippy\Html\Form\Date; use Zippy\Html\Form\DropDownChoice; use Zippy\Html\Label; use Zippy\Html\Link\ClickLink; @@ -42,12 +43,14 @@ public function __construct() { $this->contracttable->add(new \Zippy\Html\DataList\Paginator('pag', $this->contracttable->contractlist)); $this->add(new Form('contractdetail'))->setVisible(false); - $this->contractdetail->add(new TextInput('editcontract_number')); + $this->contractdetail->add(new Date('editcreatedon')); $this->contractdetail->add(new TextInput('editshortdesc')); + $this->contractdetail->add(new TextInput('editcontract_number')); $this->contractdetail->add(new AutocompleteTextInput('editcust'))->onText($this, 'OnAutoCustomer'); $this->contractdetail->add(new DropDownChoice('editcomp',Firm::findArray('firm_name','disabled<>1','firm_name'),0)); $this->contractdetail->add(new DropDownChoice('editpay',Contract::PayList() ,0)); - + $this->contractdetail->add(new \Zippy\Html\Form\File('scan')); + $this->contractdetail->add(new CheckBox('editdisabled')); $this->contractdetail->add(new SubmitButton('save'))->onClick($this, 'saveOnClick'); @@ -63,6 +66,14 @@ public function contractlistOnRow($row) { $row->add(new Label('customer', $item->customer_name)); $row->add(new Label('firm', $item->firm_name)); $row->add(new Label('payname', $item->payname)); + + $row->add(new \Zippy\Html\Link\BookmarkableLink('scanlink'))->setVisible(false); + if($item->file_id>0) { + $row->scanlink->setVisible(true); + $row->scanlink->setLink(_BASEURL . 'loadfile.php?id=' . $item->file_id); + + } + $row->add(new ClickLink('edit'))->onClick($this, 'editOnClick'); $row->add(new ClickLink('delete'))->onClick($this, 'deleteOnClick'); } @@ -86,6 +97,7 @@ public function editOnClick($sender) { $this->_contract = $sender->owner->getDataItem(); $this->contracttable->setVisible(false); $this->contractdetail->setVisible(true); + $this->contractdetail->editcreatedon->setDate($this->_contract->createdon); $this->contractdetail->editcontract_number->setText($this->_contract->contract_number); $this->contractdetail->editshortdesc->setText($this->_contract->shortdesc); $this->contractdetail->editdisabled->setChecked($this->_contract->disabled); @@ -93,6 +105,7 @@ public function editOnClick($sender) { $this->contractdetail->editcust->setText($this->_contract->customer_name); $this->contractdetail->editcomp->setValue($this->_contract->firm_id); $this->contractdetail->editpay->setValue($this->_contract->pay); + } public function addOnClick($sender) { @@ -120,6 +133,7 @@ public function saveOnClick($sender) { return; } + $this->_contract->createdon = $this->contractdetail->editcreatedon->getDate(); $this->_contract->shortdesc = $this->contractdetail->editshortdesc->getText(); $this->_contract->firm_id = $this->contractdetail->editcomp->getValue(); $this->_contract->pay = $this->contractdetail->editpay->getValue(); @@ -127,6 +141,14 @@ public function saveOnClick($sender) { $this->_contract->disabled = $this->contractdetail->editdisabled->isChecked() ? 1 : 0; $this->_contract->save(); + + $file = $this->contractdetail->scan->getFile(); + if ($file['size'] > 0) { + $this->_contract->file_id = H::addFile($file, $this->_contract->contract_id, 'Скан ', \App\Entity\Message::TYPE_CONTRACT); + $this->_contract->save(); + } + + $this->contractdetail->setVisible(false); $this->contracttable->setVisible(true); $this->contracttable->contractlist->Reload(false); @@ -164,12 +186,13 @@ private function getWhere() { $text = trim($form->searchkey->getText()); $showdis = $form->showdis->isChecked(); $cust = $form->searchcust->getKey(); - $comp = $form->searchcomp->getValue(); if ($cust > 0) { $where = $where . " and customer_id = ". $cust; } + + $comp = $form->searchcomp->getValue(); if ($comp > 0) { $where = $where . " and firm_id = ". $comp; } diff --git a/www/app/pages/register/gilist.php b/www/app/pages/register/gilist.php index b9e2d7bd4..ef94eef2e 100644 --- a/www/app/pages/register/gilist.php +++ b/www/app/pages/register/gilist.php @@ -5,6 +5,7 @@ use App\Application as App; use App\Entity\Doc\Document; use App\Helper as H; +use App\Entity\Firm; use App\System; use Zippy\Html\DataList\DataView; use Zippy\Html\DataList\Paginator; @@ -43,6 +44,7 @@ public function __construct() { $this->filter->add(new TextInput('searchnumber')); $this->filter->add(new TextInput('searchtext')); $this->filter->add(new DropDownChoice('status', array(0 => 'Открытые', 1 => 'Новые', 2 => 'Отправленые', 4 => 'Неоплаченные', 3 => 'Все'), 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')); @@ -90,6 +92,7 @@ public function doclistOnRow($row) { $row->add(new Label('customer', $doc->customer_name)); $row->add(new Label('state', Document::getStateName($doc->state))); + $row->add(new Label('firm', $item->firm_name)); $row->add(new ClickLink('show'))->onClick($this, 'showOnClick'); $row->add(new ClickLink('edit'))->onClick($this, 'editOnClick'); @@ -320,6 +323,10 @@ private function getWhere() { if ($status == 4) { $where .= " and amount > payamount"; } + $comp = $this->page->filter->searchcomp->getValue(); + if ($comp > 0) { + $where = $where . " and firm_id = ". $comp; + } $st = trim($this->page->filter->searchtext->getText()); diff --git a/www/app/pages/register/grlist.php b/www/app/pages/register/grlist.php index 31e2db9b1..98f73a1ce 100644 --- a/www/app/pages/register/grlist.php +++ b/www/app/pages/register/grlist.php @@ -5,6 +5,7 @@ use App\Application as App; use App\Entity\Doc\Document; use App\Helper as H; +use App\Entity\Firm; use App\System; use Zippy\Html\DataList\DataView; use Zippy\Html\DataList\Paginator; @@ -43,6 +44,7 @@ public function __construct() { $this->filter->add(new TextInput('searchnumber')); $this->filter->add(new TextInput('searchtext')); $this->filter->add(new DropDownChoice('status', array(0 => 'Все', 1 => 'Не проведенные', 2 => 'Неоплаченые'), 0)); + $this->filter->add(new DropDownChoice('searchcomp',Firm::findArray('firm_name','disabled<>1','firm_name'),0)); $doclist = $this->add(new DataView('doclist', new GoodsReceiptDataSource($this), $this, 'doclistOnRow')); @@ -228,6 +230,10 @@ private function getWhere() { $where .= " and (payamount > 0 and payamount > payed)"; } + $comp = $this->page->filter->searchcomp->getValue(); + if ($comp > 0) { + $where = $where . " and firm_id = ". $comp; + } $st = trim($this->page->filter->searchtext->getText()); if (strlen($st) > 2) { diff --git a/www/app/pages/userlogin.php b/www/app/pages/userlogin.php index cc92f0629..4f99972f0 100644 --- a/www/app/pages/userlogin.php +++ b/www/app/pages/userlogin.php @@ -13,7 +13,8 @@ class UserLogin extends \Zippy\Html\WebPage public function __construct() { parent::__construct(); - + global $_config; + $form = new \Zippy\Html\Form\Form('loginform'); $form->add(new TextInput('userlogin')); $form->add(new TextInput('userpassword')); @@ -22,6 +23,30 @@ public function __construct() { $this->add($form); $this->setError(''); + + + $curver = 'v4.4.0'; + $this->_tvars['curversion'] = $curver ; + + //проверка новой версии + $this->_tvars['isnewversion'] = false; + + $v = @file_get_contents("https://zippy.com.ua/version.json"); + $v = @json_decode($v,true) ; + if(strlen( $v['version'])>0){ + $c = (int) str_replace(".","",str_replace("v","",$curver )) ; + $n = (int)str_replace(".","",str_replace("v","",$v['version'] )) ; + if($n>$c) { + $this->_tvars['isnewversion'] = true; + $url = "https://zippy.com.ua/zstore#"; + $lang = $_config['common']['lang']; + if ($lang == 'ua') { + $url = "https://zippy.com.ua/ua/zstore#"; + } + $url = $url . $v['ankor']; + } + $this->_tvars['newversion'] = "{$v['version']}"; + } } public function onsubmit($sender) { diff --git a/www/templates/modules/ocstore/options.html b/www/templates/modules/ocstore/options.html index 7770a1759..400e84e2b 100644 --- a/www/templates/modules/ocstore/options.html +++ b/www/templates/modules/ocstore/options.html @@ -44,6 +44,11 @@

Настройки соединения

Вместо заказа формировать и автоматически проводить расходную накладную. Используется если заказы обрабатываются на стороне ИМ.
+
+ + + Импортировать зарегистрированых клиентов из ИМ в справочник контрагентов. +
diff --git a/www/templates/pages/firmlist.html b/www/templates/pages/firmlist.html index 0ac255805..4b5ad2f1a 100644 --- a/www/templates/pages/firmlist.html +++ b/www/templates/pages/firmlist.html @@ -5,45 +5,25 @@
-
+

Список компаний

- + Добавить - - - + - - - - - + + +
НазваниеСтоимостьНормо-часы
-
+
@@ -51,23 +31,12 @@

Список компаний

-
+
- - -
-
- -
- -
-
-
- -
- -
+ +
+
diff --git a/www/templates/pages/options.html b/www/templates/pages/options.html index c6d283873..74a68d114 100644 --- a/www/templates/pages/options.html +++ b/www/templates/pages/options.html @@ -65,9 +65,9 @@

Настройки системы

Используется если не задана цена в товаре или в категории товара
- + - Используется для сумм прописью в печатных формах + Используется для сумм прописью в печатных формах.
diff --git a/www/templates/pages/reference/contractlist.html b/www/templates/pages/reference/contractlist.html index 723ef8b02..6a85e323d 100644 --- a/www/templates/pages/reference/contractlist.html +++ b/www/templates/pages/reference/contractlist.html @@ -15,10 +15,13 @@

Договора

+ {{#usefirms}} + + {{/usefirms}}
@@ -35,9 +38,10 @@

Договора

Номер Дата Контрагент - Компания + {{#usefirms}} Компания {{/usefirms}} Оплата + @@ -45,8 +49,9 @@

Договора

- + {{#usefirms}} {{/usefirms}} + @@ -63,8 +68,12 @@

Договора

- +
+ + +
+
@@ -76,19 +85,27 @@

Договора

+ {{#usefirms}}
+ {{/usefirms}}
- +
+ + + + + +
diff --git a/www/templates/pages/register/gilist.html b/www/templates/pages/register/gilist.html index 668a42bdc..a2deac61e 100644 --- a/www/templates/pages/register/gilist.html +++ b/www/templates/pages/register/gilist.html @@ -23,6 +23,13 @@

Журнал продаж

+ {{#usefirms}} + + + + {{/usefirms}} @@ -42,6 +49,8 @@

Журнал продаж

Дата Заказ Клиент + {{#usefirms}} Компания {{/usefirms}} + Сумма Статус @@ -58,6 +67,7 @@

Журнал продаж

+ {{#usefirms}} {{/usefirms}} diff --git a/www/templates/pages/register/grlist.html b/www/templates/pages/register/grlist.html index 3bc92292e..a3271c1fc 100644 --- a/www/templates/pages/register/grlist.html +++ b/www/templates/pages/register/grlist.html @@ -23,6 +23,13 @@

Журнал закупок

+ {{#usefirms}} + + + + {{/usefirms}} @@ -41,10 +48,12 @@

Журнал закупок

Дата Поставщик + {{#usefirms}} Компания {{/usefirms}} + Сумма Статус - + Примечание @@ -56,7 +65,8 @@

Журнал закупок

- + {{#usefirms}} {{/usefirms}} + diff --git a/www/templates/pages/userlogin.html b/www/templates/pages/userlogin.html index f8cedce33..723dc18c2 100644 --- a/www/templates/pages/userlogin.html +++ b/www/templates/pages/userlogin.html @@ -92,7 +92,7 @@
- v4.3.1 © zippy.com.ua + {{curversion}} {{#isnewversion}} {{{newversion}}} {{/isnewversion}} © zippy.com.ua
diff --git a/www/templates_ua/modules/ocstore/options.html b/www/templates_ua/modules/ocstore/options.html index d68b45ba9..201fb9161 100644 --- a/www/templates_ua/modules/ocstore/options.html +++ b/www/templates_ua/modules/ocstore/options.html @@ -43,9 +43,14 @@

Налаштування підключення

Замість замовлення створювати і автоматично проводити видаткову накладну. - Використовуеться якщо замовлення обробляются на стороні IМ. + Використовуеться якщо замовлення обробляються на стороні IМ.
- +
+ + + Iмпортувати клiентiв з IМ в довiдник контрагентiв. +
+
diff --git a/www/templates_ua/pages/options.html b/www/templates_ua/pages/options.html index 874036c60..26b13cb5d 100644 --- a/www/templates_ua/pages/options.html +++ b/www/templates_ua/pages/options.html @@ -67,7 +67,7 @@

Налаштування системи

Використовується якщо не задана ціна в товарі або в категорії товару
- + Для сум прописом в друкованих формах
diff --git a/www/templates_ua/pages/reference/contractlist.html b/www/templates_ua/pages/reference/contractlist.html index cb1ad4700..c298b6072 100644 --- a/www/templates_ua/pages/reference/contractlist.html +++ b/www/templates_ua/pages/reference/contractlist.html @@ -15,10 +15,12 @@

Контракти

+ {{#usefirms}} + {{/usefirms}}
@@ -35,9 +37,10 @@

Контракти

Номер Дата Контрагент - Компанiя + {{#usefirms}} Компанiя {{/usefirms}} Оплата + @@ -45,9 +48,10 @@

Контракти

- + {{#usefirms}} {{/usefirms}} - + + @@ -63,6 +67,10 @@

Контракти

+ + +
+
@@ -74,18 +82,27 @@

Контракти

+ {{#usefirms}}
+ {{/usefirms}}
+
+ + + + + +
diff --git a/www/templates_ua/pages/register/gilist.html b/www/templates_ua/pages/register/gilist.html index a0b8e0272..56cab7520 100644 --- a/www/templates_ua/pages/register/gilist.html +++ b/www/templates_ua/pages/register/gilist.html @@ -23,6 +23,12 @@

Журнал продажів

+ {{#usefirms}} + + + {{/usefirms}} @@ -42,7 +48,8 @@

Журнал продажів

Дата Замовлення Клієнт - Сума + {{#usefirms}} Компанiя {{/usefirms}} + Сума Статус @@ -58,6 +65,7 @@

Журнал продажів

+ {{#usefirms}} {{/usefirms}} diff --git a/www/templates_ua/pages/register/grlist.html b/www/templates_ua/pages/register/grlist.html index 8735047ed..f13c9b220 100644 --- a/www/templates_ua/pages/register/grlist.html +++ b/www/templates_ua/pages/register/grlist.html @@ -23,6 +23,12 @@

Журнал закупівель

+ {{#usefirms}} + + + {{/usefirms}} @@ -41,7 +47,8 @@

Журнал закупівель

Дата Постачальник - Сума + {{#usefirms}} Компанiя {{/usefirms}} + Сума Статус @@ -56,6 +63,7 @@

Журнал закупівель

+ {{#usefirms}} {{/usefirms}} diff --git a/www/templates_ua/pages/userlogin.html b/www/templates_ua/pages/userlogin.html index 6b73e40df..34d4ef8c9 100644 --- a/www/templates_ua/pages/userlogin.html +++ b/www/templates_ua/pages/userlogin.html @@ -83,8 +83,7 @@
- - +
@@ -92,7 +91,7 @@
- v4.3.1 © zippy.com.ua + {{curversion}} {{#isnewversion}} {{{newversion}}} {{/isnewversion}} © zippy.com.ua
From 212a1ec2f3dcd50709bac3d3223756a121dd274f Mon Sep 17 00:00:00 2001 From: Leon Date: Tue, 9 Jun 2020 00:46:12 +0300 Subject: [PATCH 8/8] v4.4.0 --- CHANGELOG.md | 3 +- db/db.sql | 65 +++++++++++++++---- db/initdata.sql | 4 +- db/update430to440.sql | 30 +-------- www/app/entity/contract.php | 16 +++++ www/app/entity/doc/goodsissue.php | 13 +++- www/app/entity/doc/goodsreceipt.php | 14 +++- www/app/entity/doc/invoice.php | 10 +++ www/app/entity/doc/invoicecust.php | 11 +++- www/app/entity/doc/poscheck.php | 4 +- www/app/entity/doc/retcustissue.php | 2 +- www/app/entity/doc/returnissue.php | 2 +- www/app/entity/doc/serviceact.php | 17 ++++- www/app/entity/doc/warranty.php | 2 +- www/app/entity/firm.php | 27 +++++--- www/app/helper.php | 38 ++++++----- www/app/modules/issue/pages/stat.php | 2 +- www/app/modules/shop/pages/productview.php | 2 +- www/app/pages/doc/goodsissue.php | 43 +++++++++++- www/app/pages/doc/goodsreceipt.php | 39 ++++++++++- www/app/pages/doc/invoice.php | 27 ++++++++ www/app/pages/doc/invoicecust.php | 31 +++++++++ www/app/pages/doc/retcustissue.php | 2 +- www/app/pages/doc/returnissue.php | 2 +- www/app/pages/doc/serviceact.php | 32 ++++++++- www/app/pages/doc/warranty.php | 2 +- www/app/pages/firmlist.php | 14 +++- www/app/pages/options.php | 7 +- www/app/pages/reference/contractlist.php | 3 +- www/app/pages/reference/employeelist.php | 5 +- www/app/pages/service/armpos.php | 2 +- www/app/pages/userlogin.php | 60 ++++++++++++++--- www/app/pages/userprofile.php | 2 +- www/templates/lang.json | 5 ++ www/templates/pages/branchlist.html | 6 +- www/templates/pages/doc/goodsissue.html | 19 +++++- www/templates/pages/doc/goodsreceipt.html | 16 +++++ www/templates/pages/doc/invoice.html | 30 +++++++-- www/templates/pages/doc/invoicecust.html | 17 ++++- www/templates/pages/doc/serviceact.html | 18 +++++ www/templates/pages/firmlist.html | 22 +++++-- www/templates/pages/options.html | 7 +- .../pages/reference/contractlist.html | 2 +- www/templates/pages/userlogin.html | 28 ++++++-- www/templates/printforms/doc/goodsissue.tpl | 19 ++++++ www/templates/printforms/doc/goodsreceipt.tpl | 18 +++++ www/templates/printforms/doc/invoice.tpl | 17 +++++ www/templates/printforms/doc/invoicecust.tpl | 17 +++++ www/templates/printforms/doc/serviceact.tpl | 16 +++++ www/templates_ua/lang.json | 8 ++- www/templates_ua/pages/doc/goodsissue.html | 17 ++++- www/templates_ua/pages/doc/goodsreceipt.html | 16 +++++ www/templates_ua/pages/doc/invoice.html | 31 +++++++-- www/templates_ua/pages/doc/invoicecust.html | 15 +++++ www/templates_ua/pages/doc/serviceact.html | 18 +++++ www/templates_ua/pages/firmlist.html | 63 ++++++++++++++++++ www/templates_ua/pages/options.html | 6 ++ .../pages/reference/contractlist.html | 2 +- www/templates_ua/pages/userlogin.html | 12 +++- .../printforms/doc/goodsissue.tpl | 20 ++++++ .../printforms/doc/goodsreceipt.tpl | 22 ++++++- www/templates_ua/printforms/doc/invoice.tpl | 17 +++++ .../printforms/doc/invoicecust.tpl | 19 ++++++ .../printforms/doc/serviceact.tpl | 16 +++++ 64 files changed, 921 insertions(+), 151 deletions(-) create mode 100644 www/templates_ua/pages/firmlist.html diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c9cc858a..c3eb7b47e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,8 @@ CHANGELOG * Добавлена возможность работать в разрезе нескольких компаний. * Справочник договоров. * Импорт клиентов с опенкарта в справочник контрагентов. -* Уведомление о выходе новой версии на странице логина. +* Уведомление о выходе новой версии на странице логина. +* Добавлена капча на форму логина. Для обновления выполнить update430to440.sql обновить папки app, templates, templates_ua. Обновить библиотеки согласно composer.json diff --git a/db/db.sql b/db/db.sql index 106e7f245..9330f7910 100644 --- a/db/db.sql +++ b/db/db.sql @@ -20,6 +20,35 @@ CREATE TABLE `branches` ( PRIMARY KEY (`branch_id`) ) AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `contracts`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `contracts` ( + `contract_id` int(11) NOT NULL AUTO_INCREMENT, + `customer_id` int(11) DEFAULT '0', + `firm_id` int(11) DEFAULT '0', + `createdon` date NOT NULL, + `contract_number` varchar(64) NOT NULL, + `disabled` tinyint(1) DEFAULT '0', + `details` longtext NOT NULL, + PRIMARY KEY (`contract_id`) +) AUTO_INCREMENT=6 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `contracts_view`; +/*!50001 DROP VIEW IF EXISTS `contracts_view`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `contracts_view` AS SELECT + 1 AS `contract_id`, + 1 AS `customer_id`, + 1 AS `firm_id`, + 1 AS `createdon`, + 1 AS `contract_number`, + 1 AS `disabled`, + 1 AS `details`, + 1 AS `customer_name`, + 1 AS `firm_name`*/; +SET character_set_client = @saved_cs_client; DROP TABLE IF EXISTS `customers`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; @@ -32,7 +61,7 @@ CREATE TABLE `customers` ( `status` smallint(4) NOT NULL DEFAULT '0', `city` varchar(255) DEFAULT NULL, PRIMARY KEY (`customer_id`) -) AUTO_INCREMENT=16 DEFAULT CHARSET=utf8; +) AUTO_INCREMENT=17 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `customers_view`; /*!50001 DROP VIEW IF EXISTS `customers_view`*/; @@ -62,7 +91,7 @@ CREATE TABLE `docstatelog` ( `hostname` varchar(64) NOT NULL, PRIMARY KEY (`log_id`), KEY `document_id` (`document_id`) -) AUTO_INCREMENT=1002 DEFAULT CHARSET=utf8; +) AUTO_INCREMENT=1022 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `docstatelog_view`; /*!50001 DROP VIEW IF EXISTS `docstatelog_view`*/; @@ -98,14 +127,12 @@ CREATE TABLE `documents` ( `payed` decimal(11,2) DEFAULT '0.00', `branch_id` int(11) DEFAULT '0', `parent_id` bigint(20) DEFAULT '0', - `firm_id` int(11) DEFAULT '0', PRIMARY KEY (`document_id`), KEY `document_date` (`document_date`), KEY `customer_id` (`customer_id`), KEY `user_id` (`user_id`), - KEY `branch_id` (`branch_id`), - KEY `firm_id` (`firm_id`) -) AUTO_INCREMENT=263 DEFAULT CHARSET=utf8; + KEY `branch_id` (`branch_id`) +) AUTO_INCREMENT=272 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `documents_view`; /*!50001 DROP VIEW IF EXISTS `documents_view`*/; @@ -129,7 +156,6 @@ SET character_set_client = utf8; 1 AS `parent_id`, 1 AS `branch_id`, 1 AS `branch_name`, - 1 AS `firm_name`, 1 AS `meta_name`, 1 AS `meta_desc`*/; SET character_set_client = @saved_cs_client; @@ -281,7 +307,7 @@ CREATE TABLE `files` ( `mime` varchar(16) DEFAULT NULL, PRIMARY KEY (`file_id`), KEY `item_id` (`item_id`) -) AUTO_INCREMENT=26 DEFAULT CHARSET=utf8; +) AUTO_INCREMENT=27 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `filesdata`; /*!40101 SET @saved_cs_client = @@character_set_client */; @@ -301,7 +327,7 @@ CREATE TABLE `firms` ( `details` longtext NOT NULL, `disabled` tinyint(1) NOT NULL DEFAULT '0', PRIMARY KEY (`firm_id`) -) DEFAULT CHARSET=utf8; +) AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `images`; /*!40101 SET @saved_cs_client = @@character_set_client */; @@ -527,7 +553,7 @@ CREATE TABLE `metadata` ( `menugroup` varchar(255) DEFAULT NULL, `disabled` tinyint(4) NOT NULL, PRIMARY KEY (`meta_id`) -) AUTO_INCREMENT=79 DEFAULT CHARSET=utf8; +) AUTO_INCREMENT=82 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `mfund`; /*!40101 SET @saved_cs_client = @@character_set_client */; @@ -635,7 +661,7 @@ CREATE TABLE `notifies` ( `sender_name` varchar(255) DEFAULT NULL, PRIMARY KEY (`notify_id`), KEY `user_id` (`user_id`) -) AUTO_INCREMENT=64 DEFAULT CHARSET=utf8; +) AUTO_INCREMENT=69 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `options`; /*!40101 SET @saved_cs_client = @@character_set_client */; @@ -669,7 +695,7 @@ CREATE TABLE `paylist` ( `paytype` tinyint(4) NOT NULL DEFAULT '0', PRIMARY KEY (`pl_id`), KEY `document_id` (`document_id`) -) AUTO_INCREMENT=250 DEFAULT CHARSET=utf8; +) AUTO_INCREMENT=251 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `paylist_view`; /*!50001 DROP VIEW IF EXISTS `paylist_view`*/; @@ -959,6 +985,19 @@ SET character_set_client = utf8; 1 AS `employee_id`, 1 AS `username`*/; SET character_set_client = @saved_cs_client; +/*!50001 DROP VIEW IF EXISTS `contracts_view`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = latin1 */; +/*!50001 SET character_set_results = latin1 */; +/*!50001 SET collation_connection = latin1_swedish_ci */; +/*!50001 CREATE */ +/*!50013 */ +/*!50001 VIEW `contracts_view` AS select `co`.`contract_id` AS `contract_id`,`co`.`customer_id` AS `customer_id`,`co`.`firm_id` AS `firm_id`,`co`.`createdon` AS `createdon`,`co`.`contract_number` AS `contract_number`,`co`.`disabled` AS `disabled`,`co`.`details` AS `details`,`cu`.`customer_name` AS `customer_name`,`f`.`firm_name` AS `firm_name` from ((`contracts` `co` join `customers` `cu` on((`co`.`customer_id` = `cu`.`customer_id`))) left join `firms` `f` on((`co`.`firm_id` = `f`.`firm_id`))) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; /*!50001 DROP VIEW IF EXISTS `customers_view`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -994,7 +1033,7 @@ SET character_set_client = @saved_cs_client; /*!50001 SET collation_connection = latin1_swedish_ci */; /*!50001 CREATE */ /*!50013 */ -/*!50001 VIEW `documents_view` AS select `d`.`document_id` AS `document_id`,`d`.`document_number` AS `document_number`,`d`.`document_date` AS `document_date`,`d`.`user_id` AS `user_id`,`d`.`content` AS `content`,`d`.`amount` AS `amount`,`d`.`meta_id` AS `meta_id`,`u`.`username` AS `username`,`c`.`customer_id` AS `customer_id`,`c`.`customer_name` AS `customer_name`,`d`.`state` AS `state`,`d`.`notes` AS `notes`,`d`.`payamount` AS `payamount`,`d`.`payed` AS `payed`,`d`.`parent_id` AS `parent_id`,`d`.`branch_id` AS `branch_id`,`b`.`branch_name` AS `branch_name`,`f`.`firm_name` AS `firm_name`,`metadata`.`meta_name` AS `meta_name`,`metadata`.`description` AS `meta_desc` from (((((`documents` `d` left join `users_view` `u` on((`d`.`user_id` = `u`.`user_id`))) left join `customers` `c` on((`d`.`customer_id` = `c`.`customer_id`))) join `metadata` on((`metadata`.`meta_id` = `d`.`meta_id`))) left join `branches` `b` on((`d`.`branch_id` = `b`.`branch_id`))) left join `firms` `f` on((`d`.`firm_id` = `f`.`firm_id`))) */; +/*!50001 VIEW `documents_view` AS select `d`.`document_id` AS `document_id`,`d`.`document_number` AS `document_number`,`d`.`document_date` AS `document_date`,`d`.`user_id` AS `user_id`,`d`.`content` AS `content`,`d`.`amount` AS `amount`,`d`.`meta_id` AS `meta_id`,`u`.`username` AS `username`,`c`.`customer_id` AS `customer_id`,`c`.`customer_name` AS `customer_name`,`d`.`state` AS `state`,`d`.`notes` AS `notes`,`d`.`payamount` AS `payamount`,`d`.`payed` AS `payed`,`d`.`parent_id` AS `parent_id`,`d`.`branch_id` AS `branch_id`,`b`.`branch_name` AS `branch_name`,`metadata`.`meta_name` AS `meta_name`,`metadata`.`description` AS `meta_desc` from ((((`documents` `d` left join `users_view` `u` on((`d`.`user_id` = `u`.`user_id`))) left join `customers` `c` on((`d`.`customer_id` = `c`.`customer_id`))) join `metadata` on((`metadata`.`meta_id` = `d`.`meta_id`))) left join `branches` `b` on((`d`.`branch_id` = `b`.`branch_id`))) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; diff --git a/db/initdata.sql b/db/initdata.sql index 9bb107ec5..8788c5b76 100644 --- a/db/initdata.sql +++ b/db/initdata.sql @@ -3,7 +3,7 @@ SET NAMES 'utf8'; INSERT INTO `users` ( `userlogin`, `userpass`, `createdon`, `email`, `acl`, `disabled`, `options`) VALUES( 'admin', '$2y$10$GsjC.thVpQAPMQMO6b4Ma.olbIFr2KMGFz12l5/wnmxI1PEqRDQf.', '2017-01-01', 'admin@admin.admin', 'a:8:{s:7:"acltype";i:0;s:6:"onlymy";i:0;s:7:"aclview";N;s:7:"acledit";N;s:6:"aclexe";N;s:9:"aclbranch";N;s:7:"widgets";N;s:7:"modules";N;}', 0, 'a:4:{s:9:"smartmenu";s:3:"7,8";s:8:"defstore";s:2:"19";s:5:"defmf";s:1:"2";s:8:"pagesize";s:2:"15";}'); -INSERT INTO `roles` ( `rolename`, `acl`) VALUES ( 'admins', NULL); +INSERT INTO `roles` ( `rolename`, `acl`) VALUES( 'admins', 'a:7:{s:7:"aclview";N;s:7:"acledit";N;s:6:"aclexe";N;s:9:"aclcancel";N;s:7:"widgets";N;s:7:"modules";N;s:9:"smartmenu";s:1:"8";}'); UPDATE users set role_id=(select role_id from roles where rolename='admins' limit 0,1 ) where userlogin='admin' ; @@ -12,7 +12,7 @@ INSERT INTO `mfund` (`mf_id`, `mf_name`, `description`) VALUES(2, 'Касса', INSERT INTO `options` (`optname`, `optvalue`) VALUES('common', 'a:16:{s:9:"qtydigits";s:1:"0";s:8:"amdigits";s:1:"0";s:11:"partiontype";s:1:"1";s:4:"lang";s:2:"ru";s:6:"price1";s:18:"Розничная";s:6:"price2";s:14:"Оптовая";s:6:"price3";s:0:"";s:6:"price4";s:0:"";s:6:"price5";s:0:"";s:8:"defprice";s:2:"10";s:11:"autoarticle";i:1;s:6:"useset";i:0;s:10:"usesnumber";i:0;s:10:"usescanner";i:0;s:9:"useimages";i:0;s:9:"usebranch";i:0;}'); INSERT INTO `options` (`optname`, `optvalue`) VALUES('shop', 'N;'); -INSERT INTO `options` (`optname`, `optvalue`) VALUES('firm', 'a:5:{s:8:"firmname";s:20:"Наша фирма";s:8:"shopname";s:14:"Магазин";s:5:"phone";s:0:"";s:7:"address";s:0:"";s:3:"inn";s:0:"";}'); +INSERT INTO `options` (`optname`, `optvalue`) VALUES('firm', 'a:5:{s:9:"firm_name";s:20:"Наша фирма";s:8:"shopname";s:14:"Магазин";s:5:"phone";s:0:"";s:7:"address";s:0:"";s:3:"inn";s:0:"";}'); INSERT INTO `options` (`optname`, `optvalue`) VALUES('printer', 'a:7:{s:6:"pwidth";s:0:"";s:9:"pricetype";s:6:"price1";s:11:"barcodetype";s:5:"EAN13";s:5:"pname";i:1;s:5:"pcode";i:0;s:8:"pbarcode";i:1;s:6:"pprice";i:0;}'); INSERT INTO `options` (`optname`, `optvalue`) VALUES('modules', 'a:11:{s:6:"ocsite";s:20:"http://local.ostore3";s:9:"ocapiname";s:5:"admin";s:5:"ockey";s:256:"Bf81dB8fY2waVxlhych4fFprGfxF2tULlSlHiwEXZqf45E6HDBoA6XjocGcziRsfCQsRovzzDAvMBImmrlzXqEJcMByQpkfeLYfZBDoYstDVuA0Qvx86YkeXVwQ6I2v8xEXS2ZL6ioH1l8qinySGZdRrO5mgFCFWKhgKxIfkNOYpvzIZdR2MdqkHKSzHGSfoDVmbts8slGNFqYzvkXQSP0VaHcw0fYmBZLo0HEvLb2EiBZ5A8EcGDZWWtndg2wlY";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";}'); diff --git a/db/update430to440.sql b/db/update430to440.sql index bf5658a88..8cdf19cfd 100644 --- a/db/update430to440.sql +++ b/db/update430to440.sql @@ -7,34 +7,8 @@ CREATE TABLE `firms` ( ) ENGINE=MyISAM CHARSET=utf8; -ALTER TABLE `documents` ADD `firm_id` INT NULL DEFAULT '0' , ADD INDEX (`firm_id`); - -ALTER VIEW `documents_view` AS - select - `d`.`document_id` AS `document_id`, - `d`.`document_number` AS `document_number`, - `d`.`document_date` AS `document_date`, - `d`.`user_id` AS `user_id`, - `d`.`content` AS `content`, - `d`.`amount` AS `amount`, - `d`.`meta_id` AS `meta_id`, - `u`.`username` AS `username`, - `c`.`customer_id` AS `customer_id`, - `c`.`customer_name` AS `customer_name`, - `d`.`state` AS `state`, - `d`.`notes` AS `notes`, - `d`.`payamount` AS `payamount`, - `d`.`payed` AS `payed`, - `d`.`parent_id` AS `parent_id`, - `d`.`branch_id` AS `branch_id`, - `b`.`branch_name` AS `branch_name`, - `f`.`firm_id` AS `firm_id`, - `f`.`firm_name` AS `firm_name`, - `metadata`.`meta_name` AS `meta_name`, - `metadata`.`description` AS `meta_desc` - from - (((((`documents` `d` left join `users_view` `u` on((`d`.`user_id` = `u`.`user_id`))) left join `customers` `c` on((`d`.`customer_id` = `c`.`customer_id`))) join `metadata` on((`metadata`.`meta_id` = `d`.`meta_id`))) left join `branches` `b` on((`d`.`branch_id` = `b`.`branch_id`))) left join `firms` `f` on((`d`.`firm_id` = `f`.`firm_id`))); - + + CREATE TABLE `contracts` ( `contract_id` int(11) NOT NULL AUTO_INCREMENT, `customer_id` int(11) DEFAULT '0', diff --git a/www/app/entity/contract.php b/www/app/entity/contract.php index 7c02c8c7b..062384782 100644 --- a/www/app/entity/contract.php +++ b/www/app/entity/contract.php @@ -51,5 +51,21 @@ public static function PayList(){ 3=>\App\Helper::l('ckredit'), 4=>\App\Helper::l('creal') ); + } + public static function getList($c,$f=0){ + + $ar = array(); + if(strlen($f)==0)$f=0; + if($c>0 ) { + $where="disabled <> 1 and customer_id={$c} and coalesce(firm_id,0) = {$f} " ; + + $res = Contract::find($where,'contract_number'); + foreach($res as $k=>$v) { + $ar[$k] = $v->contract_number .' '. $v->shortdesc ; + } + + } + + return $ar; } } diff --git a/www/app/entity/doc/goodsissue.php b/www/app/entity/doc/goodsissue.php index c9bc58c36..dc54bb741 100644 --- a/www/app/entity/doc/goodsissue.php +++ b/www/app/entity/doc/goodsissue.php @@ -46,11 +46,14 @@ public function generateReport() { $totalstr = H::sumstr($this->amount); + $firm = H::getFirmData($this->branch_id,$this->headerdata["firm_id"]); $header = array('date' => H::fd( $this->document_date), "_detail" => $detail, - "firmname" => $this->headerdata["firmname"], + "firm_name" => $firm['firm_name'], "customer_name" => $this->customer_name, + "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"], @@ -67,6 +70,14 @@ public function generateReport() { "prepaid" => $this->headerdata['payment'] == \App\Entity\MoneyFund::PREPAID, "payamount" => H::fa($this->payamount) ); + + if ($this->headerdata["contract_id"] > 0) { + $contract=\App\Entity\Contract::load($this->headerdata["contract_id"]); + $header['contract'] = $contract->contract_number ; + $header['createdon'] = H::fd($contract->createdon) ; + } + + if ($this->headerdata["sent_date"] > 0) { $header['sent_date'] = H::fd( $this->headerdata["sent_date"]); } diff --git a/www/app/entity/doc/goodsreceipt.php b/www/app/entity/doc/goodsreceipt.php index 05e3f88ff..7b9538acf 100644 --- a/www/app/entity/doc/goodsreceipt.php +++ b/www/app/entity/doc/goodsreceipt.php @@ -14,8 +14,8 @@ class GoodsReceipt extends Document { public function generateReport() { - - + $firm = H::getFirmData($this->branch_id,$this->headerdata["firm_id"]); + $i = 1; $detail = array(); @@ -39,7 +39,10 @@ public function generateReport() { $header = array('date' => H::fd( $this->document_date), "_detail" => $detail, "basedoc" => $this->headerdata["basedoc"], - "isval" => ($this->_doc->headerdata['val'])>1 , + "firm_name" => $firm['firm_name'], + "isfirm" => strlen($firm["firm_name"]) > 0, + "iscontract" => $this->headerdata["contract_id"] > 0, + "isval" => ($this->_doc->headerdata['val'])>1 , "customer_name" => $this->customer_name, "document_number" => $this->document_number, "total" => H::fa($this->amount), @@ -47,6 +50,11 @@ public function generateReport() { "prepaid" => $this->headerdata['payment'] == \App\Entity\MoneyFund::PREPAID, "payamount" => H::fa($this->payamount) ); + if ($this->headerdata["contract_id"] > 0) { + $contract=\App\Entity\Contract::load($this->headerdata["contract_id"]); + $header['contract'] = $contract->contract_number ; + $header['createdon'] = H::fd($contract->createdon) ; + } $header['isdisc'] = $this->headerdata["disc"] > 0; $header['isnds'] = $this->headerdata["nds"] > 0; diff --git a/www/app/entity/doc/invoice.php b/www/app/entity/doc/invoice.php index 9d7cab268..f16809ebe 100644 --- a/www/app/entity/doc/invoice.php +++ b/www/app/entity/doc/invoice.php @@ -13,6 +13,8 @@ class Invoice extends \App\Entity\Doc\Document public function generateReport() { + $firm = H::getFirmData($this->branch_id,$this->headerdata["firm_id"]); + $i = 1; $detail = array(); @@ -38,6 +40,9 @@ public function generateReport() { $header = array('date' => H::fd( $this->document_date), "_detail" => $detail, "customer_name" => $this->customer_name, + "firm_name" => $firm['firm_name'], + "isfirm" => strlen($firm["firm_name"]) > 0, + "iscontract" => $this->headerdata["contract_id"] > 0, "phone" => $this->headerdata["phone"], "email" => $this->headerdata["email"], "notes" => $this->notes, @@ -48,6 +53,11 @@ public function generateReport() { "payed" => H::fa($this->payed), "paydisc" => H::fa($this->headerdata["paydisc"]) ); + if ($this->headerdata["contract_id"] > 0) { + $contract=\App\Entity\Contract::load($this->headerdata["contract_id"]); + $header['contract'] = $contract->contract_number ; + $header['createdon'] = H::fd($contract->createdon) ; + } $report = new \App\Report('doc/invoice.tpl'); diff --git a/www/app/entity/doc/invoicecust.php b/www/app/entity/doc/invoicecust.php index c1ffdcadf..457b3b2f9 100644 --- a/www/app/entity/doc/invoicecust.php +++ b/www/app/entity/doc/invoicecust.php @@ -12,6 +12,7 @@ class InvoiceCust extends Document { public function generateReport() { + $firm = H::getFirmData($this->branch_id,$this->headerdata["firm_id"]); $i = 1; @@ -31,10 +32,18 @@ public function generateReport() { "_detail" => $detail, "customer_name" => $this->customer_name, "document_number" => $this->document_number, - "total" => H::fa($this->amount), + "firm_name" => $firm['firm_name'], + "isfirm" => strlen($firm["firm_name"]) > 0, + "iscontract" => $this->headerdata["contract_id"] > 0, + "total" => H::fa($this->amount), "payed" => H::fa($this->payed), "payamount" => H::fa($this->payamount) ); + if ($this->headerdata["contract_id"] > 0) { + $contract=\App\Entity\Contract::load($this->headerdata["contract_id"]); + $header['contract'] = $contract->contract_number ; + $header['createdon'] = H::fd($contract->createdon) ; + } $header['isdisc'] = $this->headerdata["disc"] > 0; $header['isnds'] = $this->headerdata["nds"] > 0; diff --git a/www/app/entity/doc/poscheck.php b/www/app/entity/doc/poscheck.php index cebf3f41a..4d2a12cb6 100644 --- a/www/app/entity/doc/poscheck.php +++ b/www/app/entity/doc/poscheck.php @@ -52,7 +52,7 @@ public function generateReport() { $header = array('date' => H::fd( $this->document_date), "_detail" => $detail, - "firmname" => $firm["firmname"], + "firm_name" => $firm["firm_name"], "shopname" => $firm["shopname"], "address" => $firm["address"], "phone" => $firm["phone"], @@ -104,7 +104,7 @@ public function generatePosReport() { $header = array('date' => H::fd( $this->document_date), "_detail" => $detail, - "firmname" => $firm["firmname"], + "firm_name" => $firm["firm_name"], "shopname" => strlen($firm["shopname"]) > 0 ? $firm["shopname"] : false, "address" => $firm["address"], "phone" => $firm["phone"], diff --git a/www/app/entity/doc/retcustissue.php b/www/app/entity/doc/retcustissue.php index ed3db77aa..093664a90 100644 --- a/www/app/entity/doc/retcustissue.php +++ b/www/app/entity/doc/retcustissue.php @@ -44,7 +44,7 @@ public function generateReport() { $header = array('date' => H::fd( $this->document_date), "_detail" => $detail, - "firmname" => $this->headerdata["firmname"], + "firm_name" => $this->headerdata["firm_name"], "customer_name" => $this->customer_name, "document_number" => $this->document_number, "total" => H::fa($this->amount), diff --git a/www/app/entity/doc/returnissue.php b/www/app/entity/doc/returnissue.php index edf58e380..af4452451 100644 --- a/www/app/entity/doc/returnissue.php +++ b/www/app/entity/doc/returnissue.php @@ -41,7 +41,7 @@ public function generateReport() { $header = array('date' => H::fd( $this->document_date), "_detail" => $detail, - "firmname" => $this->headerdata["firmname"], + "firm_name" => $this->headerdata["firm_name"], "customer_name" => $this->customer_name, "document_number" => $this->document_number, "total" => H::fa($this->amount), diff --git a/www/app/entity/doc/serviceact.php b/www/app/entity/doc/serviceact.php index 36edc76d5..3492fa12b 100644 --- a/www/app/entity/doc/serviceact.php +++ b/www/app/entity/doc/serviceact.php @@ -14,6 +14,7 @@ class ServiceAct extends Document { public function generateReport() { + $firm = H::getFirmData($this->branch_id,$this->headerdata["firm_id"]); $i = 1; @@ -29,15 +30,25 @@ public function generateReport() { $header = array('date' => H::fd( $this->document_date), "_detail" => $detail, "customer_name" => $this->customer_name, + "firm_name" => $firm['firm_name'], "gar" => $this->headerdata['gar'], "isdevice" => strlen($this->headerdata["device"]) > 0, "device" => $this->headerdata["device"], + "isfirm" => strlen($firm["firm_name"]) > 0, + "iscontract" => $this->headerdata["contract_id"] > 0, "devsn" => $this->headerdata["devsn"], "document_number" => $this->document_number, "payamount" => H::fa($this->payamount), "payed" => H::fa($this->payed), "total" => H::fa($this->amount) ); + if ($this->headerdata["contract_id"] > 0) { + $contract=\App\Entity\Contract::load($this->headerdata["contract_id"]); + $header['contract'] = $contract->contract_number ; + $header['createdon'] = H::fd($contract->createdon) ; + } + + $report = new \App\Report('doc/serviceact.tpl'); $html = $report->generate($header); @@ -75,7 +86,7 @@ protected function getNumberTemplate() { public function generatePosReport() { $printer = \App\System::getOptions('printer'); - $firm = H::getFirmData($this->branch_id); + $firm = H::getFirmData($this->branch_id,$this->headerdata["firm_id"]); $wp = 'style="width:40mm"'; if (strlen($printer['pwidth']) > 0) { $wp = 'style="width:' . $printer['pwidth'] . 'mm"'; @@ -83,7 +94,7 @@ public function generatePosReport() { $header = array('printw' => $wp, 'date' => H::fd( time()), "document_number" => $this->document_number, - "firmname" => $firm['firmname'], + "firm_name" => $firm['firm_name'], "shopname" => strlen($firm['shopname']) > 0 ? $firm['shopname'] : false, "address" => $firm['address'], "phone" => $firm['phone'], @@ -93,7 +104,7 @@ public function generatePosReport() { "total" => H::fa($this->amount) ); if (strlen($this->headerdata['gar']) > 0) { - $header['gar'] = 'Гарантия: ' . $this->headerdata['gar']; + $header['gar'] = H::l('garant'). ': ' . $this->headerdata['gar']; } $detail = array(); $i = 1; diff --git a/www/app/entity/doc/warranty.php b/www/app/entity/doc/warranty.php index 8d047e4cf..2cae0d179 100644 --- a/www/app/entity/doc/warranty.php +++ b/www/app/entity/doc/warranty.php @@ -31,7 +31,7 @@ public function generateReport() { $header = array('date' => H::fd( $this->document_date), "_detail" => $detail, - "firmname" => $this->headerdata["firmname"], + "firm_name" => $this->headerdata["firm_name"], "customer_name" => $this->customer_name, "document_number" => $this->document_number ); diff --git a/www/app/entity/firm.php b/www/app/entity/firm.php index 025294e0f..21042b768 100644 --- a/www/app/entity/firm.php +++ b/www/app/entity/firm.php @@ -17,21 +17,24 @@ protected function init() { protected function afterLoad() { - $xml = @simplexml_load_string($this->details); - $this->hours = (string)($xml->hours[0]); - + $this->address = (string)($xml->address[0]); + $this->inn = (string)($xml->inn[0]); + $this->phone = (string)($xml->phone[0]); + $this->shopname = (string)($xml->shopname[0]); parent::afterLoad(); } protected function beforeSave() { parent::beforeSave(); - $this->details = "
"; - - + $this->details = "
"; + $this->details .= "
address}]]>
"; + $this->details .= "shopname}]]>"; + $this->details .= "{$this->inn}"; + $this->details .= "{$this->phone}"; $this->details .= "
"; return true; @@ -40,9 +43,15 @@ protected function beforeSave() { protected function beforeDelete() { $conn = \ZDB\DB::getConnect(); - $sql = " select count(*) from entrylist where service_id = {$this->service_id}"; - $cnt = $conn->GetOne($sql); - return ($cnt > 0) ? \App\Helper::l('nodelservice') : ""; + $sql = " select count(*) from contracts where firm_id = {$this->firm_id} "; + $cntc = $conn->GetOne($sql); + $sql = " select count(*) from documents where content like '%{$this->firm_id}%' "; + $cntd = $conn->GetOne($sql); + return ($cntc > 0 || $cntd>0 ) ? \App\Helper::l('nodelfirm') : ""; } + public static function getList() { + return Firm::findArray("firm_name", "disabled <> 1", "firm_name"); + } + } diff --git a/www/app/helper.php b/www/app/helper.php index 1599a80ee..bea42eb39 100644 --- a/www/app/helper.php +++ b/www/app/helper.php @@ -175,29 +175,25 @@ public static function loadEmail($template, $keys = array()) { $logger->error($templatepath . " is wrong"); return ""; } - - + $template = @file_get_contents($templatepath); $m = new \Mustache_Engine(); $template = $m->render($template, $keys); - - + return $template; } public static function sendLetter($template, $emailfrom, $emailto, $subject = "") { - - - $mail = new \PHPMailer(); - $mail->setFrom($emailfrom, 'Онлайн каталог'); + + $mail = new \PHPMailer\PHPMailer\PHPMailer(); + $mail->setFrom($emailfrom); $mail->addAddress($emailto); $mail->Subject = $subject; $mail->msgHTML($template); $mail->CharSet = "UTF-8"; $mail->IsHTML(true); - - + $mail->send(); /* @@ -431,13 +427,14 @@ public static function fd($date ) { return ''; } - /** + + /** * форматирование даты и времени * * @param mixed $date * @return mixed */ - public static function fdt($date ) { + public static function fdt($date ) { if ($date > 0) { $dateformat = System::getOption("common",'dateformat'); if(strlen($dateformat)==0) $dateformat = 'd.m.Y'; @@ -448,13 +445,22 @@ public static function fdt($date ) { return ''; } - /** * возвращает данные фирмы. Учитывает филиал если задан */ - public static function getFirmData($branch_id = 0) { - - $data = \App\System::getOptions("firm"); + public static function getFirmData($branch_id = 0,$firm_id=0) { + $usefirms = System::getOption('common','usefirms'); + if($firm_id>0) { + $firm = \App\Entity\Firm::load($firm_id); + $data = $firm->getData(); + } + else { + if($usefirms==true ) return array(); + + $data = \App\System::getOptions("firm"); + } + + if ($branch_id > 0) { $branch = \App\Entity\Branch::load($branch_id); if (strlen($branch->shopname) > 0) { diff --git a/www/app/modules/issue/pages/stat.php b/www/app/modules/issue/pages/stat.php index 47798c391..adfd306ba 100644 --- a/www/app/modules/issue/pages/stat.php +++ b/www/app/modules/issue/pages/stat.php @@ -45,7 +45,7 @@ public function __construct() { $user_id = 0; - if ($user->username != 'admin') { + if ($user->userlogin != 'admin') { $user_id = $user->user_id; $users = User::findArray('username', 'user_id=' . $user_id, 'username'); } diff --git a/www/app/modules/shop/pages/productview.php b/www/app/modules/shop/pages/productview.php index 7839df295..3bf23d28a 100644 --- a/www/app/modules/shop/pages/productview.php +++ b/www/app/modules/shop/pages/productview.php @@ -189,7 +189,7 @@ public function OnAddCommentRow(\Zippy\Html\DataList\DataRow $datarow) { $datarow->add(new Label("comment", $item->comment)); $datarow->add(new Label("created", \App\Helper::fdt( $item->created))); $datarow->add(new TextInput("rate"))->setText($item->rating); - $datarow->add(new ClickLink('deletecomment', $this, 'OnDeleteComment'))->SetVisible(System::getUser()->userlogin == "admin" && $item->moderated != 1); + $datarow->add(new ClickLink('deletecomment', $this, 'OnDeleteComment'))->SetVisible(System::getUser()->userlogin == 'admin' && $item->moderated != 1); } //удалить коментарий diff --git a/www/app/pages/doc/goodsissue.php b/www/app/pages/doc/goodsissue.php index 102c57b45..f24e54478 100644 --- a/www/app/pages/doc/goodsissue.php +++ b/www/app/pages/doc/goodsissue.php @@ -79,6 +79,11 @@ public function __construct($docid = 0, $basedocid = 0) { $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(), 0))->onChange($this,'OnCustomerFirm' ); + $this->docform->add(new DropDownChoice('contract', array(), 0))->setVisible(false); ; + + $this->docform->add(new DropDownChoice('pricetype', Item::getPriceTypeList())); $this->docform->add(new DropDownChoice('emp', \App\Entity\Employee::findArray('emp_name', '', 'emp_name'))); @@ -162,8 +167,11 @@ public function __construct($docid = 0, $basedocid = 0) { $this->_orderid = $this->_doc->headerdata['order_id']; $this->_prevcust = $this->_doc->customer_id; + $this->docform->firm->setValue($this->_doc->headerdata['firm_id']); $this->OnChangeCustomer($this->docform->customer); + $this->docform->contract->setValue($this->_doc->headerdata['contract_id']); + $this->_itemlist = $this->_doc->unpackDetails('detaildata'); @@ -230,8 +238,10 @@ public function __construct($docid = 0, $basedocid = 0) { $invoice = $basedoc->cast(); $this->docform->total->setText($invoice->amount); - + $this->docform->firm->setValue($basedoc->headerdata['firm_id']); + $this->OnChangeCustomer($this->docform->customer); + $this->docform->contract->setValue($basedoc->headerdata['contract_id']); $this->_itemlist = $basedoc->unpackDetails('detaildata'); @@ -258,8 +268,10 @@ public function __construct($docid = 0, $basedocid = 0) { $this->docform->ship_address->setText($basedoc->headerdata['address']); $this->docform->delivery->setValue($basedoc->headerdata['delivery']); - + $this->docform->firm->setValue($basedoc->headerdata['firm_id']); + $this->OnChangeCustomer($this->docform->customer); + $this->docform->contract->setValue($basedoc->headerdata['contract_id']); foreach ($basedoc->unpackDetails('detaildata') as $item) { @@ -456,13 +468,19 @@ public function savedocOnClick($sender) { $this->_doc->notes = $this->docform->notes->getText(); // $this->_doc->order = $this->docform->order->getText(); $firm = H::getFirmData($this->_doc->branch_id); - $this->_doc->headerdata["firmname"] = $firm['firmname']; + $this->_doc->headerdata["firm_name"] = $firm['firm_name']; $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->headerdata['contract_id'] = $this->docform->contract->getValue(); + $this->_doc->headerdata['firm_id'] = $this->docform->firm->getValue(); + if($this->_doc->headerdata['firm_id']>0){ + $this->_doc->headerdata['firm_name'] = $this->docform->firm->getValueName(); + } + $this->_doc->payamount = $this->docform->payamount->getText(); $this->_doc->payed = $this->docform->payed->getText(); @@ -864,6 +882,7 @@ public function OnChangeCustomer($sender) { $this->calcPay(); } + $this->OnCustomerFirm(null); } //добавление нового контрагента @@ -955,6 +974,24 @@ public function onSelectItem($item_id, $itemname) { $this->editdetail->edittovar->setText($itemname); $this->OnChangeItem($this->editdetail->edittovar); } + + public function OnCustomerFirm($sender) { + $c=$this->docform->customer->getKey(); + $f=$this->docform->firm->getValue(); + + $ar = \App\Entity\Contract::getList($c,$f) ; + + $this->docform->contract->setOptionList($ar); + if(count($ar)>0){ + $this->docform->contract->setVisible(true); + } else { + $this->docform->contract->setVisible(false); + $this->docform->contract->setValue(0); + } + + } + + } diff --git a/www/app/pages/doc/goodsreceipt.php b/www/app/pages/doc/goodsreceipt.php index 888f06d46..b21e51b4a 100644 --- a/www/app/pages/doc/goodsreceipt.php +++ b/www/app/pages/doc/goodsreceipt.php @@ -45,6 +45,9 @@ 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 AutocompleteTextInput('customer'))->onText($this, 'OnAutoCustomer'); + $this->docform->customer->onChange($this,'OnCustomerFirm') ; + $this->docform->add(new DropDownChoice('firm', \App\Entity\Firm::getList(), 0))->onChange($this,'OnCustomerFirm' ); + $this->docform->add(new DropDownChoice('contract', array(), 0))->setVisible(false); ; $this->docform->add(new DropDownChoice('store', Store::getList(), H::getDefStore())); $this->docform->add(new TextInput('notes')); @@ -145,6 +148,10 @@ public function __construct($docid = 0, $basedocid = 0) { $this->docform->editpayed->setText($this->_doc->payed); $this->docform->store->setValue($this->_doc->headerdata['store']); $this->docform->payment->setValue($this->_doc->headerdata['payment']); + $this->docform->firm->setValue($this->_doc->headerdata['firm_id']); + $this->OnCustomerFirm($this->docform->customer); + + $this->docform->contract->setValue($this->_doc->headerdata['contract_id']); $this->OnPayment($this->docform->payment); @@ -186,6 +193,11 @@ public function __construct($docid = 0, $basedocid = 0) { $this->docform->editrate->setText($invoice->headerdata['rate']); $this->docform->disc->setText($invoice->headerdata['disc']); $this->docform->editdisc->setText($invoice->headerdata['disc']); + $this->docform->firm->setValue($invoice->headerdata['firm_id']); + $this->OnCustomerFirm($this->docform->customer); + + $this->docform->contract->setValue($invoice->headerdata['contract_id']); + $this->_itemlist = $basedoc->unpackDetails('detaildata'); @@ -200,6 +212,10 @@ public function __construct($docid = 0, $basedocid = 0) { $this->docform->customer->setText($basedoc->customer_name); $basedoc = $basedoc->cast(); + $this->docform->firm->setValue($basedoc->headerdata['firm_id']); + $this->OnCustomerFirm($this->docform->customer); + + $this->docform->contract->setValue($basedoc->headerdata['contract_id']); $this->docform->payment->setValue(\App\Entity\MoneyFund::PREPAID); @@ -402,7 +418,7 @@ public function savedocOnClick($sender) { $this->goAnkor(""); $firm = H::getFirmData($this->_doc->branch_id); - $this->_doc->headerdata["firmname"] = $firm['firmname']; + $this->_doc->headerdata["firm_name"] = $firm['firm_name']; $this->_doc->document_number = $this->docform->document_number->getText(); $this->_doc->document_date = $this->docform->document_date->getDate(); @@ -412,6 +428,12 @@ public function savedocOnClick($sender) { $customer = Customer::load($this->_doc->customer_id); $this->_doc->headerdata['customer_name'] = $this->docform->customer->getText() . ' ' . $customer->phone; } + $this->_doc->headerdata['contract_id'] = $this->docform->contract->getValue(); + $this->_doc->headerdata['firm_id'] = $this->docform->firm->getValue(); + if($this->_doc->headerdata['firm_id']>0){ + $this->_doc->headerdata['firm_name'] = $this->docform->firm->getValueName(); + } + $this->_doc->payamount = $this->docform->payamount->getText(); $this->_doc->headerdata['store'] = $this->docform->store->getValue(); $this->_doc->headerdata['payment'] = $this->docform->payment->getValue(); @@ -792,6 +814,21 @@ public function onSelectItem($item_id, $itemname) { } + public function OnCustomerFirm($sender) { + $c=$this->docform->customer->getKey(); + $f=$this->docform->firm->getValue(); + + $ar = \App\Entity\Contract::getList($c,$f) ; + + $this->docform->contract->setOptionList($ar); + if(count($ar)>0){ + $this->docform->contract->setVisible(true); + } else { + $this->docform->contract->setVisible(false); + $this->docform->contract->setValue(0); + } + + } } diff --git a/www/app/pages/doc/invoice.php b/www/app/pages/doc/invoice.php index c28a1d24a..4d64c7b24 100644 --- a/www/app/pages/doc/invoice.php +++ b/www/app/pages/doc/invoice.php @@ -45,6 +45,8 @@ public function __construct($docid = 0, $basedocid = 0) { $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(), 0))->onChange($this,'OnCustomerFirm' ); + $this->docform->add(new DropDownChoice('contract', array(), 0))->setVisible(false); ; $this->docform->add(new TextArea('notes')); @@ -124,8 +126,11 @@ public function __construct($docid = 0, $basedocid = 0) { $this->_prevcust = $this->_doc->customer_id; $this->_tovarlist = $this->_doc->unpackDetails('detaildata'); + $this->docform->firm->setValue($this->_doc->headerdata['firm_id']); $this->OnChangeCustomer($this->docform->customer); + $this->docform->contract->setValue($this->_doc->headerdata['contract_id']); + } else { $this->_doc = Document::create('Invoice'); $this->docform->document_number->setText($this->_doc->nextNumber()); @@ -307,6 +312,11 @@ public function savedocOnClick($sender) { $this->_doc->headerdata['phone'] = $this->docform->phone->getText(); $this->_doc->headerdata['pricetype'] = $this->docform->pricetype->getValue(); $this->_doc->headerdata['store'] = $this->docform->store->getValue(); + $this->_doc->headerdata['contract_id'] = $this->docform->contract->getValue(); + $this->_doc->headerdata['firm_id'] = $this->docform->firm->getValue(); + if($this->_doc->headerdata['firm_id']>0){ + $this->_doc->headerdata['firm_name'] = $this->docform->firm->getValueName(); + } $this->_doc->packDetails('detaildata', $this->_tovarlist); @@ -509,6 +519,7 @@ public function OnChangeCustomer($sender) { $this->calcTotal(); $this->calcPay(); + $this->OnCustomerFirm(null); } public function OnAutoItem($sender) { @@ -574,4 +585,20 @@ public function OnChangePriceType($sender) { $this->calcTotal(); } + public function OnCustomerFirm($sender) { + $c=$this->docform->customer->getKey(); + $f=$this->docform->firm->getValue(); + + $ar = \App\Entity\Contract::getList($c,$f) ; + + $this->docform->contract->setOptionList($ar); + if(count($ar)>0){ + $this->docform->contract->setVisible(true); + } else { + $this->docform->contract->setVisible(false); + $this->docform->contract->setValue(0); + } + + } + } diff --git a/www/app/pages/doc/invoicecust.php b/www/app/pages/doc/invoicecust.php index 87b0c10d9..109f33346 100644 --- a/www/app/pages/doc/invoicecust.php +++ b/www/app/pages/doc/invoicecust.php @@ -40,6 +40,10 @@ 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 AutocompleteTextInput('customer'))->onText($this, 'OnAutoCustomer'); + $this->docform->customer->onChange($this,'OnCustomerFirm') ; + $this->docform->add(new DropDownChoice('firm', \App\Entity\Firm::getList(), 0))->onChange($this,'OnCustomerFirm' ); + $this->docform->add(new DropDownChoice('contract', array(), 0))->setVisible(false); ; + $this->docform->add(new TextInput('notes')); $this->docform->add(new DropDownChoice('val',H::getValList() , '0'))->onChange($this, 'OnVal'); @@ -110,6 +114,11 @@ public function __construct($docid = 0, $basedocid = 0) { $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->firm->setValue($this->_doc->headerdata['firm_id']); + $this->OnCustomerFirm($this->docform->customer); + + $this->docform->contract->setValue($this->_doc->headerdata['contract_id']); + $this->docform->total->setText($this->_doc->amount); $this->_itemlist = $this->_doc->unpackDetails('detaildata'); @@ -276,6 +285,12 @@ public function savedocOnClick($sender) { $customer = Customer::load($this->_doc->customer_id); $this->_doc->headerdata['customer_name'] = $this->docform->customer->getText() . ' ' . $customer->phone; } + $this->_doc->headerdata['contract_id'] = $this->docform->contract->getValue(); + $this->_doc->headerdata['firm_id'] = $this->docform->firm->getValue(); + if($this->_doc->headerdata['firm_id']>0){ + $this->_doc->headerdata['firm_name'] = $this->docform->firm->getValueName(); + } + $this->_doc->headerdata['payment'] = $this->docform->payment->getValue(); if ($this->checkForm() == false) { @@ -502,4 +517,20 @@ public function cancelnewitemOnClick($sender) { $this->editdetail->setVisible(true); } + public function OnCustomerFirm($sender) { + $c=$this->docform->customer->getKey(); + $f=$this->docform->firm->getValue(); + + $ar = \App\Entity\Contract::getList($c,$f) ; + + $this->docform->contract->setOptionList($ar); + if(count($ar)>0){ + $this->docform->contract->setVisible(true); + } else { + $this->docform->contract->setVisible(false); + $this->docform->contract->setValue(0); + } + + } + } diff --git a/www/app/pages/doc/retcustissue.php b/www/app/pages/doc/retcustissue.php index fee89954d..8768239ff 100644 --- a/www/app/pages/doc/retcustissue.php +++ b/www/app/pages/doc/retcustissue.php @@ -247,7 +247,7 @@ public function savedocOnClick($sender) { // $this->calcTotal(); $firm = H::getFirmData($this->_doc->branch_id); - $this->_doc->headerdata["firmname"] = $firm['firmname']; + $this->_doc->headerdata["firm_name"] = $firm['firm_name']; $this->_doc->headerdata['store'] = $this->docform->store->getValue(); diff --git a/www/app/pages/doc/returnissue.php b/www/app/pages/doc/returnissue.php index 887c5dc13..863422800 100644 --- a/www/app/pages/doc/returnissue.php +++ b/www/app/pages/doc/returnissue.php @@ -234,7 +234,7 @@ public function savedocOnClick($sender) { $firm = H::getFirmData($this->_doc->branch_id); - $this->_doc->headerdata["firmname"] = $firm['firmname']; + $this->_doc->headerdata["firm_name"] = $firm['firm_name']; $this->_doc->headerdata['store'] = $this->docform->store->getValue(); $this->_doc->headerdata['payment'] = $this->docform->payment->getValue(); diff --git a/www/app/pages/doc/serviceact.php b/www/app/pages/doc/serviceact.php index cd70eed92..d5e585307 100644 --- a/www/app/pages/doc/serviceact.php +++ b/www/app/pages/doc/serviceact.php @@ -39,7 +39,11 @@ 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 AutocompleteTextInput('customer'))->onText($this, 'OnAutoCustomer'); + $this->docform->customer->onChange($this,'OnCustomerFirm') ; + $this->docform->add(new DropDownChoice('firm', \App\Entity\Firm::getList(), 0))->onChange($this,'OnCustomerFirm' ); + $this->docform->add(new DropDownChoice('contract', array(), 0))->setVisible(false); ; + $this->docform->add(new TextInput('notes')); $this->docform->add(new TextInput('gar')); $this->docform->add(new TextInput('device')); @@ -111,7 +115,9 @@ public function __construct($docid = 0, $basedocid = 0) { $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->firm->setValue($this->_doc->headerdata['firm_id']); + $this->OnCustomerFirm(null); + $this->docform->contract->setValue($this->_doc->headerdata['contract_id']); $this->_servicelist = $this->_doc->unpackDetails('detaildata'); } else { @@ -222,6 +228,12 @@ public function savedocOnClick($sender) { } $this->_doc->headerdata['device'] = $this->docform->device->getText(); $this->_doc->headerdata['devsn'] = $this->docform->devsn->getText(); + $this->_doc->headerdata['contract_id'] = $this->docform->contract->getValue(); + $this->_doc->headerdata['firm_id'] = $this->docform->firm->getValue(); + if($this->_doc->headerdata['firm_id']>0){ + $this->_doc->headerdata['firm_name'] = $this->docform->firm->getValueName(); + } + $this->calcTotal(); @@ -414,6 +426,22 @@ public function OnChangeServive($sender) { $this->updateAjax(array('editprice')); } + public function OnCustomerFirm($sender) { + $c=$this->docform->customer->getKey(); + $f=$this->docform->firm->getValue(); + + $ar = \App\Entity\Contract::getList($c,$f) ; + + $this->docform->contract->setOptionList($ar); + if(count($ar)>0){ + $this->docform->contract->setVisible(true); + } else { + $this->docform->contract->setVisible(false); + $this->docform->contract->setValue(0); + } + + } + //добавление нового контрагента public function addcustOnClick($sender) { $this->editcust->setVisible(true); @@ -449,7 +477,7 @@ public function savecustOnClick($sender) { $cust->save(); $this->docform->customer->setText($cust->customer_name); $this->docform->customer->setKey($cust->customer_id); - + $this->OnCustomerFirm(null) ; $this->editcust->setVisible(false); $this->docform->setVisible(true); } diff --git a/www/app/pages/doc/warranty.php b/www/app/pages/doc/warranty.php index 2e4227579..a2343a9a0 100644 --- a/www/app/pages/doc/warranty.php +++ b/www/app/pages/doc/warranty.php @@ -196,7 +196,7 @@ public function savedocOnClick($sender) { $this->_doc->headerdata["customer_name"] = $this->docform->customer->getText(); $firm = H::getFirmData($this->_doc->branch_id); - $this->_doc->headerdata["firmname"] = $firm['firmname']; + $this->_doc->headerdata["firm_name"] = $firm['firm_name']; $this->_doc->packDetails('detaildata', $this->_tovarlist); diff --git a/www/app/pages/firmlist.php b/www/app/pages/firmlist.php index 763eee3db..4145fc8dd 100644 --- a/www/app/pages/firmlist.php +++ b/www/app/pages/firmlist.php @@ -25,7 +25,6 @@ public function __construct() { if (false == \App\ACL::checkShowRef('FirmList')) { return; } - $this->add(new Panel('firmtable'))->setVisible(true); $this->firmtable->add(new DataView('firmlist', new \ZCL\DB\EntityDataSource('\App\Entity\Firm', '', 'disabled,firm_name'), $this, 'firmlistOnRow'))->Reload(); @@ -33,6 +32,10 @@ public function __construct() { $this->add(new Form('firmdetail'))->setVisible(false); $this->firmdetail->add(new TextInput('editfirm_name')); + $this->firmdetail->add(new TextInput('editinn')); + $this->firmdetail->add(new TextInput('editaddress')); + $this->firmdetail->add(new TextInput('editphone')); + $this->firmdetail->add(new TextInput('editshopname')); $this->firmdetail->add(new CheckBox('editdisabled')); $this->firmdetail->add(new SubmitButton('save'))->onClick($this, 'saveOnClick'); @@ -68,6 +71,10 @@ public function editOnClick($sender) { $this->firmtable->setVisible(false); $this->firmdetail->setVisible(true); $this->firmdetail->editfirm_name->setText($this->_firm->firm_name); + $this->firmdetail->editinn->setText($this->_firm->inn); + $this->firmdetail->editaddress->setText($this->_firm->address); + $this->firmdetail->editphone->setText($this->_firm->phone); + $this->firmdetail->editshopname->setText($this->_firm->shopname); $this->firmdetail->editdisabled->setChecked($this->_firm->disabled); } @@ -86,11 +93,16 @@ public function saveOnClick($sender) { } $this->_firm->firm_name = $this->firmdetail->editfirm_name->getText(); + $this->_firm->inn = $this->firmdetail->editinn->getText(); + $this->_firm->address = $this->firmdetail->editaddress->getText(); + $this->_firm->phone = $this->firmdetail->editphone->getText(); + $this->_firm->shopname = $this->firmdetail->editshopname->getText(); if ($this->_firm->firm_name == '') { $this->setError("entername"); return; } + $this->_firm->disabled = $this->firmdetail->editdisabled->isChecked() ? 1 : 0; $this->_firm->Save(); diff --git a/www/app/pages/options.php b/www/app/pages/options.php index ebf919c3d..97f1ea7ab 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('capcha')); $this->common->add(new TextInput('price1')); $this->common->add(new TextInput('price2')); $this->common->add(new TextInput('price3')); @@ -89,6 +90,7 @@ public function __construct() { $this->common->useimages->setChecked($common['useimages']); $this->common->usebranch->setChecked($common['usebranch']); $this->common->allowminus->setChecked($common['allowminus']); + $this->common->capcha->setChecked($common['capcha']); $this->common->useval->setChecked($common['useval']); @@ -105,7 +107,7 @@ public function __construct() { $firm = array(); } - $this->firm->firmname->setText($firm['firmname']); + $this->firm->firmname->setText($firm['firm_name']); $this->firm->shopname->setText($firm['shopname']); $this->firm->phone->setText($firm['phone']); $this->firm->address->setText($firm['address']); @@ -207,6 +209,7 @@ public function saveCommonOnClick($sender) { $common['usebranch'] = $this->common->usebranch->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; System::setOptions("common", $common); @@ -219,7 +222,7 @@ public function saveCommonOnClick($sender) { public function saveFirmOnClick($sender) { $firm = array(); - $firm['firmname'] = $this->firm->firmname->getText(); + $firm['firm_name'] = $this->firm->firmname->getText(); $firm['shopname'] = $this->firm->shopname->getText(); $firm['phone'] = $this->firm->phone->getText(); diff --git a/www/app/pages/reference/contractlist.php b/www/app/pages/reference/contractlist.php index db2c0a7b0..afaec84f4 100644 --- a/www/app/pages/reference/contractlist.php +++ b/www/app/pages/reference/contractlist.php @@ -43,7 +43,7 @@ public function __construct() { $this->contracttable->add(new \Zippy\Html\DataList\Paginator('pag', $this->contracttable->contractlist)); $this->add(new Form('contractdetail'))->setVisible(false); - $this->contractdetail->add(new Date('editcreatedon')); + $this->contractdetail->add(new Date('editcreatedon',time())); $this->contractdetail->add(new TextInput('editshortdesc')); $this->contractdetail->add(new TextInput('editcontract_number')); $this->contractdetail->add(new AutocompleteTextInput('editcust'))->onText($this, 'OnAutoCustomer'); @@ -113,6 +113,7 @@ public function addOnClick($sender) { $this->contractdetail->setVisible(true); // Очищаем форму $this->contractdetail->clean(); + $this->contractdetail->editcreatedon->setDate(time()); $this->_contract = new Contract(); } diff --git a/www/app/pages/reference/employeelist.php b/www/app/pages/reference/employeelist.php index 4f5f1523d..c5bd7ceb0 100644 --- a/www/app/pages/reference/employeelist.php +++ b/www/app/pages/reference/employeelist.php @@ -112,10 +112,7 @@ public function saveOnClick($sender) { $login = trim($this->employeedetail->editlogin->getText()); if (strlen($login) > 0) { - if ($login == "admin") { - $this->setError('invalidlogin'); - return; - } + $_emp = Employee::getFirst("login = '{$login}'"); if ($_emp != null && $_emp->employee_id != $this->_employee->employee_id) { $this->setError('assignedlogin', $_emp->emp_name()); diff --git a/www/app/pages/service/armpos.php b/www/app/pages/service/armpos.php index 55f978417..db996376e 100644 --- a/www/app/pages/service/armpos.php +++ b/www/app/pages/service/armpos.php @@ -626,7 +626,7 @@ public function savedocOnClick($sender) { // $pos = \App\Entity\Pos::load($this->_doc->headerdata['pos']); - $this->_doc->headerdata["firmname"] = $firm['firmname']; + $this->_doc->headerdata["firm_name"] = $firm['firm_name']; $this->_doc->headerdata["inn"] = $firm['inn']; $this->_doc->headerdata["address"] = $firm['address']; $this->_doc->headerdata["phone"] = $firm['phone']; diff --git a/www/app/pages/userlogin.php b/www/app/pages/userlogin.php index 4f99972f0..2c3caf653 100644 --- a/www/app/pages/userlogin.php +++ b/www/app/pages/userlogin.php @@ -10,15 +10,21 @@ class UserLogin extends \Zippy\Html\WebPage { - + private $cntlogin=0; + public function __construct() { parent::__construct(); global $_config; + + $common = System::getOptions('common'); + $form = new \Zippy\Html\Form\Form('loginform'); $form->add(new TextInput('userlogin')); $form->add(new TextInput('userpassword')); + $form->add(new TextInput('capchacode')); $form->add(new \Zippy\Html\Form\CheckBox('remember')); + $form->add(new \ZCL\Captcha\Captcha('capcha')); $form->onSubmit($this, 'onsubmit'); $this->add($form); @@ -38,15 +44,12 @@ public function __construct() { $n = (int)str_replace(".","",str_replace("v","",$v['version'] )) ; if($n>$c) { $this->_tvars['isnewversion'] = true; - $url = "https://zippy.com.ua/zstore#"; - $lang = $_config['common']['lang']; - if ($lang == 'ua') { - $url = "https://zippy.com.ua/ua/zstore#"; - } - $url = $url . $v['ankor']; } - $this->_tvars['newversion'] = "{$v['version']}"; + + $this->_tvars['newversion'] = $v['version'] ; } + + $this->_tvars['capcha'] = $common['capcha'] == 1; } public function onsubmit($sender) { @@ -55,6 +58,17 @@ public function onsubmit($sender) { $this->setError(''); $login = $sender->userlogin->getText(); $password = $sender->userpassword->getText(); + $sender->userpassword->setText('') ; + if($this->_tvars['capcha']==true){ + $entercode = $sender->capchacode->getText(); + $capchacode = $sender->capcha->getCode(); + if(strlen($entercode)==0 || $entercode != $capchacode) { + $this->setError("invalidcapcha") ; + $this->counter() ; + + return; + } + } if ($login == '') { $this->setError('enterlogin'); @@ -90,6 +104,8 @@ public function onsubmit($sender) { } else { $this->setError('invalidlogin'); + + $this->counter() ; } } @@ -106,7 +122,7 @@ public function beforeRequest() { public function setError($msg) { - + $msg = Helper::l($msg); $this->_tvars['alerterror'] = $msg; } @@ -114,5 +130,31 @@ protected function afterRender() { // $this->_tvars['alerterror'] = ''; } + + private function counter() { + $this->cntlogin++; + if($this->cntlogin==5){ + $msg = Helper::l("extralogin"); + $msg .= '
'.$this->loginform->userlogin->getText() .', '; + $msg .= $_SERVER['HTTP_HOST'] .' '. $_SERVER['SERVER_ADDR']; + $admin = \App\Entity\User::getByLogin('admin'); + $n = new \App\Entity\Notify(); + $n->user_id = $admin->user_id; + + $n->dateshow = time(); + $n->message = $msg; + + $n->save(); + + $this->setError('invalidloginalert'); + $this->loginform->setVisible(false); + if(strlen($admin->email)>0) { + Helper::sendLetter($msg,$admin->email,$admin->email,"Zippy Store alert") ; + } + + } + + // $this->_tvars['alerterror'] = ''; + } } diff --git a/www/app/pages/userprofile.php b/www/app/pages/userprofile.php index d43b5b780..5eb857b77 100644 --- a/www/app/pages/userprofile.php +++ b/www/app/pages/userprofile.php @@ -102,7 +102,7 @@ public function onsubmitpass($sender) { $this->setSuccess('saved'); } - if ($this->user->username != 'admin') { + if ($this->user->userlogin != 'admin') { $admin = \App\Entity\User::getByLogin('admin'); $n = new \App\Entity\Notify(); $n->user_id = $admin->user_id; diff --git a/www/templates/lang.json b/www/templates/lang.json index ea8aabecd..bc0a72e24 100644 --- a/www/templates/lang.json +++ b/www/templates/lang.json @@ -197,6 +197,7 @@ "nominus": "На складе всего %s товара %s. Списание в минус запрещено.", "selectbranch": "Для создания документов нужно выбрать конкретный филиал.", "nodelservice": "Нельзя удалять используемую услугу", + "nodelfirm": "Нельзя удалять используемую компанию", "partmove": "Перемещение партий", "noaccesstopage": "Нет права доступа к странице", "nodelusedfroup": "Нельзя удалять используемую группу", @@ -216,6 +217,10 @@ "cbeznal": "Безнал", "ckredit": "В кредит", "creal" : "Под реализацию", + "invalidcapcha" : "Неверный код капчи", + "extralogin" : "Много неудачных авторизаций.", + "invalidloginalert" : "Много неудачных авторизаций. Администратору системы отправлено уведомление", + "garant" : "Гарантия", "refreshed": "Обновлено", "sent" : "Отправлено", diff --git a/www/templates/pages/branchlist.html b/www/templates/pages/branchlist.html index 2165d91ac..51d0f73b9 100644 --- a/www/templates/pages/branchlist.html +++ b/www/templates/pages/branchlist.html @@ -32,18 +32,18 @@

Список филиалов

- Если задано используется вместо настроек + Если задано используется вместо настроек компании
- Если задан используется вместо настроек + Если задан используется вместо настроек компании
- Если задан используется вместо настроек + Если задан используется вместо настроек компании
diff --git a/www/templates/pages/doc/goodsissue.html b/www/templates/pages/doc/goodsissue.html index 8c987b39a..a3adc34d0 100644 --- a/www/templates/pages/doc/goodsissue.html +++ b/www/templates/pages/doc/goodsissue.html @@ -31,8 +31,23 @@

Расходная накладная

Добавить нового
- - + {{#usefirms}} +
+ + +
+ {{/usefirms}} +
+ + + + +
+
diff --git a/www/templates/pages/doc/goodsreceipt.html b/www/templates/pages/doc/goodsreceipt.html index a78f28c46..e775647f9 100644 --- a/www/templates/pages/doc/goodsreceipt.html +++ b/www/templates/pages/doc/goodsreceipt.html @@ -24,6 +24,22 @@

Приходная накладная

Добавить нового
+ {{#usefirms}} +
+ + +
+ {{/usefirms}} +
+ + + + +
diff --git a/www/templates/pages/doc/invoice.html b/www/templates/pages/doc/invoice.html index c04bf250a..d184940a8 100644 --- a/www/templates/pages/doc/invoice.html +++ b/www/templates/pages/doc/invoice.html @@ -31,13 +31,23 @@

Счет-фактура

-
- - -
+ {{#usefirms}} +
+ + +
+ {{/usefirms}} +
+ + + + +
+
@@ -56,7 +66,13 @@

Счет-фактура

+
+ + +
diff --git a/www/templates/pages/doc/invoicecust.html b/www/templates/pages/doc/invoicecust.html index 4e65b70c7..c5d0dfc79 100644 --- a/www/templates/pages/doc/invoicecust.html +++ b/www/templates/pages/doc/invoicecust.html @@ -19,7 +19,22 @@

Счет входящий

- + {{#usefirms}} +
+ + +
+ {{/usefirms}} +
+ + + + +
diff --git a/www/templates/pages/doc/serviceact.html b/www/templates/pages/doc/serviceact.html index b2745d34c..2581aa691 100644 --- a/www/templates/pages/doc/serviceact.html +++ b/www/templates/pages/doc/serviceact.html @@ -25,6 +25,24 @@

Акт выполненых работ Добавить нового

+ {{#usefirms}} +
+ + +
+ {{/usefirms}} +
+ + + + +
+ +
diff --git a/www/templates/pages/firmlist.html b/www/templates/pages/firmlist.html index 4b5ad2f1a..1886ee924 100644 --- a/www/templates/pages/firmlist.html +++ b/www/templates/pages/firmlist.html @@ -23,11 +23,7 @@

Список компаний

zippy="delete" title="Удалить"> - -
- -
@@ -36,7 +32,23 @@

Список компаний

- +
+ + + Вводится если название магазина отличается от названия компании +
+
+ + +
+
+ + +
+
+ + +
diff --git a/www/templates/pages/options.html b/www/templates/pages/options.html index 74a68d114..6181e29d8 100644 --- a/www/templates/pages/options.html +++ b/www/templates/pages/options.html @@ -127,6 +127,12 @@

Настройки системы

+
+ + + +
@@ -190,7 +196,6 @@

Данные о компании

-
diff --git a/www/templates/pages/reference/contractlist.html b/www/templates/pages/reference/contractlist.html index 6a85e323d..5ce0ec336 100644 --- a/www/templates/pages/reference/contractlist.html +++ b/www/templates/pages/reference/contractlist.html @@ -79,7 +79,7 @@

Договора

- +
diff --git a/www/templates/pages/userlogin.html b/www/templates/pages/userlogin.html index 723dc18c2..a50c9968f 100644 --- a/www/templates/pages/userlogin.html +++ b/www/templates/pages/userlogin.html @@ -67,6 +67,16 @@
+ {{#capcha}} +
+ +
+ +
+
+ {{/capcha}} +
@@ -76,15 +86,21 @@
- +
- +
- +
- - + {{#isnewversion}} +
+
+ Доступна новая версия {{newversion}} Открыть... + +
+
+ {{/isnewversion}} @@ -92,7 +108,7 @@
- {{curversion}} {{#isnewversion}} {{{newversion}}} {{/isnewversion}} © zippy.com.ua + {{curversion}} © zippy.com.ua
diff --git a/www/templates/printforms/doc/goodsissue.tpl b/www/templates/printforms/doc/goodsissue.tpl index bd7d734c5..84d8b425f 100644 --- a/www/templates/printforms/doc/goodsissue.tpl +++ b/www/templates/printforms/doc/goodsissue.tpl @@ -6,6 +6,25 @@ Покупатель {{customer_name}} + {{#isfirm}} + + + + Продавец + {{firm_name}} + + + {{/isfirm}} + {{#iscontract}} + + + + Договор + {{contract}} от {{createdon}} + + + {{/iscontract}} + Списано с diff --git a/www/templates/printforms/doc/goodsreceipt.tpl b/www/templates/printforms/doc/goodsreceipt.tpl index 27c6f136a..e134600f7 100644 --- a/www/templates/printforms/doc/goodsreceipt.tpl +++ b/www/templates/printforms/doc/goodsreceipt.tpl @@ -6,6 +6,24 @@ Поставщик {{customer_name}} + {{#isfirm}} + + + + Покупатель + {{firm_name}} + + + {{/isfirm}} + {{#iscontract}} + + + + Договор + {{contract}} от {{createdon}} + + + {{/iscontract}} Основание diff --git a/www/templates/printforms/doc/invoice.tpl b/www/templates/printforms/doc/invoice.tpl index 0f58b8c29..23d0ca7aa 100644 --- a/www/templates/printforms/doc/invoice.tpl +++ b/www/templates/printforms/doc/invoice.tpl @@ -16,7 +16,24 @@ Email {{email}} + {{#isfirm}} + + + + Продавец + {{firm_name}} + + {{/isfirm}} + {{#iscontract}} + + + + Договор + {{contract}} от {{createdon}} + + + {{/iscontract}} Счет-фактура № {{document_number}} от {{date}} diff --git a/www/templates/printforms/doc/invoicecust.tpl b/www/templates/printforms/doc/invoicecust.tpl index 7956ae37b..c9e96176a 100644 --- a/www/templates/printforms/doc/invoicecust.tpl +++ b/www/templates/printforms/doc/invoicecust.tpl @@ -6,7 +6,24 @@ Поставщик {{customer_name}} + {{#isfirm}} + + + + Покупатель + {{firm_name}} + + {{/isfirm}} + {{#iscontract}} + + + + Договор + {{contract}} от {{createdon}} + + + {{/iscontract}}
Счет входящий № {{document_number}} от {{date}}

diff --git a/www/templates/printforms/doc/serviceact.tpl b/www/templates/printforms/doc/serviceact.tpl index de23ffcf2..fba5d7381 100644 --- a/www/templates/printforms/doc/serviceact.tpl +++ b/www/templates/printforms/doc/serviceact.tpl @@ -7,6 +7,22 @@ + {{#isfirm}} + + + Исполнитель: {{firm_name}} + + + + {{/isfirm}} + {{#iscontract}} + + + Договор: {{contract}} от {{createdon}} + + + + {{/iscontract}} {{#isdevice}} diff --git a/www/templates_ua/lang.json b/www/templates_ua/lang.json index 83ed129de..ea0517b52 100644 --- a/www/templates_ua/lang.json +++ b/www/templates_ua/lang.json @@ -197,6 +197,7 @@ "nominus": "На складi всього %s товару %s. Списання в мiнус заборонено.", "selectbranch": "Для створення документу потрiбно вибрати конкретну фiлiю.", "nodelservice": "Не можна видаляти використовану послугу", + "nodelfirm": "Не можна видаляти використовану компанiю", "partmove": "Перемiщення партiй", "noaccesstopage": "Нема права доступу до сторiнки", "nodelusedfroup": "Не можна видаляти використовану групу", @@ -208,12 +209,17 @@ "onlyadminaccess": "До сторiнки має доступ тiльки користувач admin", "onlyadminsaccess": "До сторiнки мають доступ тiльки користувачi з admins ", "onlyadminsuser": "Користувачами може керувати тiльки користувач з admins ", - "notnumber": "Не введено номер", + "notnumber": "Не введено номер", "cnal" : "Готiвка", "cbeznal": "Безготiвка", "ckredit": "В кредит", "creal" : "Пiд реалiзацiю", + "invalidcapcha" : "Невiрний код капчi", + "extralogin" : "Багато невдалих авторизацiй.", + "invalidloginalert" : "Багато невдалих авторизацiй. Адмiнiстратору системи вiдiслано попередження", + "garant" : "Гарантiя", + "refreshed": "Оновлено", "sent": "Відправлено", "saved": "Збережено" diff --git a/www/templates_ua/pages/doc/goodsissue.html b/www/templates_ua/pages/doc/goodsissue.html index 719356547..d2e6bf67d 100644 --- a/www/templates_ua/pages/doc/goodsissue.html +++ b/www/templates_ua/pages/doc/goodsissue.html @@ -31,7 +31,22 @@

Видаткова накладна

Додати нового - + {{#usefirms}} +
+ + +
+ {{/usefirms}} +
+ + + + +
diff --git a/www/templates_ua/pages/doc/goodsreceipt.html b/www/templates_ua/pages/doc/goodsreceipt.html index 5aacccfbd..6c5c066a5 100644 --- a/www/templates_ua/pages/doc/goodsreceipt.html +++ b/www/templates_ua/pages/doc/goodsreceipt.html @@ -24,6 +24,22 @@

Прибуткова накладна

Додати нового
+ {{#usefirms}} +
+ + +
+ {{/usefirms}} +
+ + + + +
diff --git a/www/templates_ua/pages/doc/invoice.html b/www/templates_ua/pages/doc/invoice.html index 9cf37e25d..391f27352 100644 --- a/www/templates_ua/pages/doc/invoice.html +++ b/www/templates_ua/pages/doc/invoice.html @@ -31,13 +31,24 @@

Рахунок-фактура

-
- - -
+ {{#usefirms}} +
+ + +
+ {{/usefirms}} +
+ + + + +
+ +
@@ -56,7 +67,13 @@

Рахунок-фактура

+
+ + +
diff --git a/www/templates_ua/pages/doc/invoicecust.html b/www/templates_ua/pages/doc/invoicecust.html index f3d6d86f7..afc698d33 100644 --- a/www/templates_ua/pages/doc/invoicecust.html +++ b/www/templates_ua/pages/doc/invoicecust.html @@ -19,7 +19,22 @@

Рахунок вхідний

+ {{#usefirms}} +
+ + +
+ {{/usefirms}} +
+ + + +
diff --git a/www/templates_ua/pages/doc/serviceact.html b/www/templates_ua/pages/doc/serviceact.html index 4560761ea..f179aad92 100644 --- a/www/templates_ua/pages/doc/serviceact.html +++ b/www/templates_ua/pages/doc/serviceact.html @@ -25,6 +25,24 @@

Акт виконаних робіт Додати нового

+ + {{#usefirms}} +
+ + +
+ {{/usefirms}} +
+ + + + +
+
diff --git a/www/templates_ua/pages/firmlist.html b/www/templates_ua/pages/firmlist.html new file mode 100644 index 000000000..ac97fc30a --- /dev/null +++ b/www/templates_ua/pages/firmlist.html @@ -0,0 +1,63 @@ + + + + + +
+
+
+

Список компанiй

+ + Додати + + + + + + + + + + + + +
Назва
+
+
+
+
+
+
+ + +
+
+ + + Вводиться якщо назва магазину відрізняється від назви компанії +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+    + + +
+
+ + + \ No newline at end of file diff --git a/www/templates_ua/pages/options.html b/www/templates_ua/pages/options.html index 26b13cb5d..47bc02fb1 100644 --- a/www/templates_ua/pages/options.html +++ b/www/templates_ua/pages/options.html @@ -132,6 +132,12 @@

Налаштування системи

+
+ + + +
diff --git a/www/templates_ua/pages/reference/contractlist.html b/www/templates_ua/pages/reference/contractlist.html index c298b6072..b523ca006 100644 --- a/www/templates_ua/pages/reference/contractlist.html +++ b/www/templates_ua/pages/reference/contractlist.html @@ -76,7 +76,7 @@

Контракти

- +
diff --git a/www/templates_ua/pages/userlogin.html b/www/templates_ua/pages/userlogin.html index 34d4ef8c9..864b734b7 100644 --- a/www/templates_ua/pages/userlogin.html +++ b/www/templates_ua/pages/userlogin.html @@ -83,7 +83,15 @@
- + {{#isnewversion}} +
+
+ Доступна нова версiя {{newversion}} Перейти... + +
+
+ {{/isnewversion}} + @@ -91,7 +99,7 @@
- {{curversion}} {{#isnewversion}} {{{newversion}}} {{/isnewversion}} © zippy.com.ua + {{curversion}} © zippy.com.ua
diff --git a/www/templates_ua/printforms/doc/goodsissue.tpl b/www/templates_ua/printforms/doc/goodsissue.tpl index c67ce399a..8e51f3a43 100644 --- a/www/templates_ua/printforms/doc/goodsissue.tpl +++ b/www/templates_ua/printforms/doc/goodsissue.tpl @@ -6,6 +6,26 @@ Покупець {{customer_name}} + {{#isfirm}} + + + + Продавец + {{firm_name}} + + + {{/isfirm}} + {{#iscontract}} + + + + + Угода + {{contract}} вiд {{createdon}} + + + + {{/iscontract}} Зписано з diff --git a/www/templates_ua/printforms/doc/goodsreceipt.tpl b/www/templates_ua/printforms/doc/goodsreceipt.tpl index e20f2a442..0d417e00a 100644 --- a/www/templates_ua/printforms/doc/goodsreceipt.tpl +++ b/www/templates_ua/printforms/doc/goodsreceipt.tpl @@ -6,7 +6,27 @@ Постачальник {{customer_name}} - + {{#isfirm}} + + + + Покупець + {{firm_name}} + + + {{/isfirm}} + {{#iscontract}} + + + + + Угода + {{contract}} вiд {{createdon}} + + + + {{/iscontract}} + Підстава {{basedoc}} diff --git a/www/templates_ua/printforms/doc/invoice.tpl b/www/templates_ua/printforms/doc/invoice.tpl index e367a3714..d82def534 100644 --- a/www/templates_ua/printforms/doc/invoice.tpl +++ b/www/templates_ua/printforms/doc/invoice.tpl @@ -16,7 +16,24 @@ Email {{email}} + {{#isfirm}} + + + + Продавець + {{firm_name}} + + {{/isfirm}} + {{#iscontract}} + + + + Угода + {{contract}} вiд {{createdon}} + + + {{/iscontract}} Рахунок-фактура № {{document_number}} від {{date}} diff --git a/www/templates_ua/printforms/doc/invoicecust.tpl b/www/templates_ua/printforms/doc/invoicecust.tpl index 50d9c5a54..65412f497 100644 --- a/www/templates_ua/printforms/doc/invoicecust.tpl +++ b/www/templates_ua/printforms/doc/invoicecust.tpl @@ -6,7 +6,26 @@ Постачальник {{customer_name}} + {{#isfirm}} + + + + Покупець + {{firm_name}} + + {{/isfirm}} + {{#iscontract}} + + + + + Угода + {{contract}} вiд {{createdon}} + + + + {{/iscontract}}
Рахунок вхідний № {{document_number}} від {{date}}

diff --git a/www/templates_ua/printforms/doc/serviceact.tpl b/www/templates_ua/printforms/doc/serviceact.tpl index 6679693d5..5a9d34fac 100644 --- a/www/templates_ua/printforms/doc/serviceact.tpl +++ b/www/templates_ua/printforms/doc/serviceact.tpl @@ -6,6 +6,22 @@ + {{#isfirm}} + + + Виконавець: {{firm_name}} + + + + {{/isfirm}} + {{#iscontract}} + + + Угода: {{contract}} вiд {{createdon}} + + + + {{/iscontract}} {{#isdevice}}