diff --git a/db/update/temp.sql b/db/update/temp.sql index 1e52f9333..055aef457 100644 --- a/db/update/temp.sql +++ b/db/update/temp.sql @@ -8,8 +8,9 @@ ALTER TABLE promocodes ADD dateto DATE DEFAULT NULL ; ALTER TABLE note_topics ADD ispublic tinyint(1) DEFAULT 0; ALTER TABLE note_topicnode ADD islink tinyint(1) DEFAULT 0; //ALTER TABLE note_nodes ADD detail text DEFAULT NULL,; -ALTER TABLE documents DROP INDEX `unuqnumber`; + delete from options where optname='version' ; insert into options (optname,optvalue) values('version','6.12.0'); +ALTER TABLE documents DROP INDEX `unuqnumber`; \ No newline at end of file diff --git a/www/app/entity/crontask.php b/www/app/entity/crontask.php index fb65203d0..6fce222d1 100644 --- a/www/app/entity/crontask.php +++ b/www/app/entity/crontask.php @@ -102,7 +102,7 @@ public static function do(): void { \App\Helper::setKeyVal('lastcronm', time()) ; //очищаем статистику - $dt = $conn->DBDate(strtotime('-1 month', time())) ; + $dt = $conn->DBDate(strtotime('-12 month', time())) ; $conn->Execute("delete from stats where category in (1,2,3,5,6) and dt < ". $dt) ; $conn->Execute(" OPTIMIZE TABLE stats " ) ; diff --git a/www/app/entity/item.php b/www/app/entity/item.php index 79441f7fa..a75ca2687 100644 --- a/www/app/entity/item.php +++ b/www/app/entity/item.php @@ -73,6 +73,7 @@ protected function afterLoad() { $this->country = (string)$xml->country[0]; $this->notes = (string)$xml->notes[0]; $reclist = (string)$xml->reclist[0]; + $this->cflist = (string)$xml->cflist[0]; if(strlen($reclist) >0) { $this->reclist = @unserialize(@base64_decode($reclist)) ; @@ -172,6 +173,7 @@ protected function beforeSave() { $this->detail .= "{$this->url}"; $this->detail .= "{$this->foodstate}"; $this->detail .= "{$this->state}"; + $this->detail .= "{$this->cflist}"; //упаковываем цены по филиалам $brprice = serialize($this->brprice); @@ -868,26 +870,11 @@ public function getID() { * @param mixed $item_id */ public static function packStBC($price,$qty,$item_id) { - $common = \App\System::getOptions("common"); - - if($common['amdigits'] == 1) { - $price= $price *100 ; - } + + $price=doubleval(\App\Helper::fa($price)); + $qty=doubleval(\App\Helper::fqty($qty)); - if($common['qtydigits'] ==1) { - $qty= $qty *10; - } - if($common['qtydigits'] ==2) { - $qty= $qty *100; - } - if($common['qtydigits'] ==3) { - $qty= $qty *1000 ; - } - //убираем нули - $price= intval($price) ; - $qty= intval($qty) ; - - $barcode = strlen($price) . $price .strlen($qty) . $qty . $item_id; + $barcode = "".$price.'-'.$qty. '-' . $item_id; return $barcode; } @@ -898,20 +885,62 @@ public static function packStBC($price,$qty,$item_id) { * @param mixed $barcode */ public static function unpackStBC($barcode) { - $common = \App\System::getOptions("common"); - $lprice= substr($barcode,0,1); - $price= substr($barcode,1,$lprice); - $lqty= substr($barcode,$lprice+1,1); - $qty= substr($barcode,$lprice+2,$lqty); - $id= substr($barcode,$lprice+2+$lqty); + - $item= Item::load(trim($id)); + $s=explode('-',$barcode) ; + + $item= Item::load(trim($s[2])); if($item != null) { - $item->price = \App\Helper::fa($price); - $item->quantity =\App\Helper::fqty($qty); + $item->price = \App\Helper::fa($s[0]); + $item->quantity =\App\Helper::fqty($s[1]); } return $item; } + + /** + * сохранить значения кастомных полей + * + * @param mixed $cf код=>значение + */ + public function savecf($cf){ + if(!is_array($cf)) { + $cf=[]; + } + $this->cflist = serialize($cf); + } + /** + * вернуть значения кастомных полей + * + */ + public function getcf(){ + $cfv = [] ; + if(strlen($this->cflist)>0) { + $cfv=unserialize($this->cflist) ; + } + $options = \App\System::getOptions('common'); + $cflist = $options['cflist']; + $i=1; + $ret=[]; + foreach($cflist as $cf=>$f) { + + $it = new \App\DataItem() ; + $it->id= $i++; + $it->code= $f->code; + $it->name= $f->name; + $it->val=''; + foreach($cfv as $cv=>$v) { + if($f->code==$cv) { + $it->val= $v; + } + } + $ret[]=$it; + + + } + + return $ret; + } + } diff --git a/www/app/entity/subscribe.php b/www/app/entity/subscribe.php index 1b96343ca..66324bae2 100644 --- a/www/app/entity/subscribe.php +++ b/www/app/entity/subscribe.php @@ -31,6 +31,7 @@ class Subscribe extends \ZCL\DB\Entity public const RSV_WH = 4; public const RSV_SYSTEM = 5; public const RSV_DOCRESP = 6; + public const RSV_TG = 7; protected function init() { $this->sub_id = 0; @@ -47,6 +48,7 @@ protected function afterLoad() { $this->doctypename = (string)($xml->doctypename[0]); $this->msgsubject = (string)($xml->msgsubject[0]); $this->url = (string)($xml->url[0]); + $this->chat_id = (string)($xml->chat_id[0]); $this->username = (string)($xml->username[0]); $this->user_id = (int)($xml->user_id[0]); $this->state = (int)($xml->state[0]); @@ -75,6 +77,7 @@ protected function beforeSave() { $this->detail .= "{$this->username}"; $this->detail .= "{$this->msgsubject}"; $this->detail .= "{$this->url}"; + $this->detail .= "{$this->chat_id}"; $this->detail .= ""; @@ -108,8 +111,9 @@ public static function getMsgTypeList($rt=0) { } if(strlen(\App\System::getOption("common", 'tbtoken'))>0) { - $list[self::MSG_BOT] = "Телеграм бот"; + $list[self::MSG_BOT] = "Телеграм"; } + if($rt==self::RSV_CUSTOMER) { unset($list[self::MSG_NOTIFY]) ; @@ -121,6 +125,15 @@ public static function getMsgTypeList($rt=0) { unset($list[self::MSG_BOT]) ; unset($list[self::MSG_SMS]) ; } + + if($rt==self::RSV_TG ) { + unset($list[self::MSG_EMAIL]) ; + unset($list[self::MSG_VIBER]) ; + + unset($list[self::MSG_SMS]) ; + unset($list[self::MSG_NOTIFY]) ; + } + return $list; @@ -139,6 +152,7 @@ public static function getRecieverList($et=0) { $list[self::RSV_SYSTEM] = "Системний лог"; $list[self::RSV_USER] = "Користувач системи"; $list[self::RSV_WH] = "Web Hook"; + $list[self::RSV_TG] = "Телеграм"; return $list; } @@ -183,9 +197,7 @@ public static function onDocumentState($doc_id, $state) { } } - if($c==null && $u== null){ - continue; - } + if ($c != null ) { $options['phone'] = $c->phone; @@ -201,6 +213,9 @@ public static function onDocumentState($doc_id, $state) { $options['chat_id'] = $u->chat_id; $options['notifyuser'] = $u->user_id; } + if ($sub->reciever_type == self::RSV_TG) { + $options['chat_id'] = $sub->chat_id;; + } $options['doc'] = $doc; @@ -250,7 +265,10 @@ public static function onNewCustomer($customer_id) { $options['chat_id'] = $u->chat_id; $options['notifyuser'] = $u->user_id; } -// $options['c'] = $c; +// + if ($sub->reciever_type == self::RSV_TG) { + $options['chat_id'] = $sub->chat_id;; + } $text = $sub->getTextCust($c); @@ -303,6 +321,7 @@ private function sendmsg($text, $options=[]){ if(strlen($options['chat_id'])>0 && $this->msg_type == self::MSG_BOT) { $ret = self::sendBot($options['chat_id'], $text, $this->attach==1 ? $options['doc'] : null,$this->html==1) ; } + if($this->reciever_type == self::RSV_WH) { $ret = self::sendHook($this->url, $text) ; } @@ -376,7 +395,7 @@ private function getTextDoc($doc) { $header['payed'] = ''; $header['credit'] = ''; $header['payurl'] = ''; - $header['botname'] = $common['tbname'] ??''; + // $header['botname'] = $common['tbname'] ??''; $header['device'] = $doc->headerdata['device'] ??''; $header['ttnnp'] = $doc->headerdata['ship_number'] ??''; if (strlen($doc->headerdata['device']) > 0 && strlen($doc->headerdata['devsn']) > 0) { diff --git a/www/app/helper.php b/www/app/helper.php index b2288ca3c..8313d3cc8 100644 --- a/www/app/helper.php +++ b/www/app/helper.php @@ -1033,9 +1033,11 @@ public static function insertstat(int $cat, int $key, int $data) { /** - * Печать этикеток на системном принтере + * Печать этикеток * - * @param array $items + * @param array $items ТМЦ + * @param array $pqty явное указание количества копий + * @param array $tags дополнительные поля */ public static function printItems(array $items, $pqty = 0, array $tags = []) { $user = \App\System::getUser(); @@ -1111,7 +1113,7 @@ public static function printItems(array $items, $pqty = 0, array $tags = []) { $dataUri = $result->getDataUri(); $header['qrcodeattr'] = "src=\"{$dataUri}\" "; - } + } $header['qrcode'] = $item->url; $header['isqrcode'] = true; @@ -1178,6 +1180,14 @@ public static function printItems(array $items, $pqty = 0, array $tags = []) { $qty = 1; //весовой товар } + + //кастомные поля + foreach($item->getcf() as $cf){ + $v= str_replace("\"", "`", $v); + $v= str_replace("'", "`", $v); + $header['cf_'.$cf->code] = $cf->val; + } + if($user->prtypelabel == 2) { $header['name'] = str_replace("\"", "`", $header['name']); $header['description'] = str_replace("\"", "`", $header['description']); @@ -1224,148 +1234,7 @@ public static function printItems(array $items, $pqty = 0, array $tags = []) { } - /* - public static function printItemsEP(array $items, $pqty = 0, array $tags = []) { - $user = \App\System::getUser(); - - - $printer = \App\System::getOptions('printer'); - - $htmls = ""; - $rows = []; - - $report = new \App\Report('item_tag_ps.tpl'); - if($user->prtypelabel == 2) { - $report = new \App\Report('item_tag_ts.tpl'); - } - - foreach($items as $item) { - $header = []; - if(strlen($item->shortname) > 0) { - $header['name'] = $item->shortname; - } else { - $header['name'] = $item->itemname; - } - $header['name'] = str_replace("'", "`", $header['name']); - $header['description'] = str_replace("'", "`", $item->description); - - $header['docnumber'] = $tags['docnumber'] ?? ""; - - $header['isprice'] = $printer['pprice'] == 1; - $header['isarticle'] = $printer['pcode'] == 1; - $header['isbarcode'] = false; - $header['isqrcode'] = false; - $header['isweight'] = $item->isweight ==1; - - - $header['article'] = $item->item_code; - $header['garterm'] = $item->warranty; - $header['country'] = $item->country; - $header['brand'] = $item->manufacturer; - $header['notes'] = $item->notes; - $header['quantity'] = $item->quantity; - - - $header['price'] = self::fa($item->getPrice($printer['pricetype'])); - if(intval($item->price) > 0) { - $header['price'] = self::fa($item->price); //по документу - } - - - if(strlen($item->url) > 0 && $printer['pqrcode'] == 1) { - $header['qrcode'] = $item->url; - $header['isqrcode'] = true; - - } - if($printer['pbarcode'] == 1) { - - $barcode = $item->bar_code; - if(strlen($barcode) == 0) { - $barcode = $item->item_code; - } - if(strlen($barcode) > 0) { - $header['barcode'] = $barcode; - $header['isbarcode'] = true; - } - } - - $qty = intval($item->getQuantity()); - - $printqty = intval($item->printqty); - if($printqty == 0) { - $printqty = 1; - } - - if($printqty == 1) { - $qty = 1; - } - if($printqty == 2) { - $qty = 2; - } - if($printqty == 3) ; - if($printqty == 4) { - if($qty > 10) { - $qty = 10; - } - } - if(intval($item->quantity) > 0) { - $qty = intval($item->quantity); //по документу - } - if($pqty > 0) { - $qty = $pqty; - } - if($item->isweight ==1) { - $qty = 1; //весовой товар - } - - - if($user->prtypelabel == 2) { - $header['name'] = str_replace("\"", "`", $header['name']); - $header['description'] = str_replace("\"", "`", $header['description']); - $header['qrcode'] = str_replace("\"", "`", $header['qrcode']); - $header['brand'] = str_replace("\"", "`", $header['brand']); - - if($user->pwsymlabel > 0) { - $header['name'] = mb_substr($header['name'], 0, $user->pwsymlabel); - } - - - $text = $report->generate($header, false); - - $r = explode("\n", $text); - - for($i = 0; $i < intval($qty); $i++) { - - foreach($r as $row) { - $row = str_replace("\n", "", $row); - $row = str_replace("\r", "", $row); - $row = trim($row); - if($row != "") { - $rows[] = $row; - } - - } - } - - } else { - for($i = 0; $i < intval($qty); $i++) { - $htmls = $htmls . $report->generate($header); - } - - } - - - } - if($user->prtypelabel == 2) { - return $rows; - } else { - return $htmls; - } - - - } - */ - + //"соль" для шифрования public static function getSalt() { $salt = self::getKeyVal('salt'); diff --git a/www/app/pages/admin.php b/www/app/pages/admin.php index fc2103ff8..215f5035c 100644 --- a/www/app/pages/admin.php +++ b/www/app/pages/admin.php @@ -52,7 +52,7 @@ public function sendEmail($sender) { try{ H::sendLetter($email,"test body","test email") ; } catch(\Exception $e) { - + H::logerror($e->getMessage()) ; $this->setError($e->getMessage()) ; } @@ -63,7 +63,7 @@ public function sendSms($sender) { try{ \App\Entity\Subscribe::sendSMS($phone,"test sms"); } catch(\Exception $e) { - + H::logerror($e->getMessage()) ; $this->setError($e->getMessage()) ; } @@ -74,7 +74,7 @@ public function sendBot($sender) { try{ \App\Entity\Subscribe::sendBot($chat_id,"test bot"); } catch(\Exception $e) { - + H::logerror($e->getMessage()) ; $this->setError($e->getMessage()) ; } diff --git a/www/app/pages/doc/calcsalary.php b/www/app/pages/doc/calcsalary.php index 99f35c1ff..983cfb5f0 100644 --- a/www/app/pages/doc/calcsalary.php +++ b/www/app/pages/doc/calcsalary.php @@ -8,6 +8,7 @@ use App\Entity\MoneyFund; use App\Entity\SalType; use App\Entity\EmpAcc; +use App\Entity\TimeItem; use App\Helper as H; use App\System; @@ -70,6 +71,14 @@ public function __construct($docid = 0) { $calcvar .= "var salaryh = fa(emp.salaryh) \n" ; $calcvar .= "var hours = fa(emp.hours) \n" ; $calcvar .= "var days = fa(emp.days) \n" ; + $calcvar .= "var hours_week = fa(emp.hours_week) \n" ; + $calcvar .= "var hours_over = fa(emp.hours_over) \n" ; + $calcvar .= "var days_week = fa(emp.days_week) \n" ; + $calcvar .= "var days_vac = fa(emp.days_vac) \n" ; + $calcvar .= "var days_sick = fa(emp.days_sick) \n" ; + $calcvar .= "var days_bt = fa(emp.days_bt) \n" ; + + // из строки сотрудника в переменные foreach($this->_stlist as $st) { @@ -296,12 +305,45 @@ public function loaddata($args, $post) { $e['sellvalue'] = doubleval($emp->sellvalue) ; } - $sql="select sum(tm) as tm, count(distinct dd) as dd from (select date(t_start) as dd, (UNIX_TIMESTAMP(t_end)-UNIX_TIMESTAMP(t_start) - t_break*60) as tm from timesheet where t_type=1 and emp_id = {$emp->employee_id} and date(t_start)>=date({$from}) and date( t_start)<= date( {$to} ) ) t "; + + $e['hours'] =0; + $e['hours_week'] =0; + $e['hours_over'] =0; + $e['days'] =0; + $e['days_week'] =0; + $e['days_vac'] =0; + $e['days_sick'] =0; + $e['days_bt'] =0; + + $sql="select sum(tm) as tm, count(distinct dd) as dd,t_type from (select date(t_start) as dd, (UNIX_TIMESTAMP(t_end)-UNIX_TIMESTAMP(t_start) - t_break*60) as tm,t_type from timesheet where emp_id = {$emp->employee_id} and date(t_start)>=date({$from}) and date( t_start)<= date( {$to} ) ) t group by t_type "; - $t = $conn->GetRow($sql); - $e['hours'] = intval($t['tm']/3600); - $e['days'] = doubleval($t['dd']); + $rs = $conn->Execute($sql); + foreach($rs as $row) { + if($row['t_type']==TimeItem::TIME_WORK ) { + $e['hours'] += intval($row['tm']/3600); + $e['days'] += doubleval($row['dd']); + } + if($row['t_type']==TimeItem::TINE_WN ) { + $e['hours_week'] += intval($row['tm']/3600); + $e['days_week'] += doubleval($row['dd']); + } + if($row['t_type']==TimeItem::TINE_OVER ) { + $e['hours_over'] += intval($row['tm']/3600); + + } + if($row['t_type']==TimeItem::TINE_HL ) { + $e['days_vac'] += doubleval($row['dd']); + } + if($row['t_type']==TimeItem::TINE_ILL ) { + $e['days_sick'] += doubleval($row['dd']); + } + if($row['t_type']==TimeItem::TINE_BT ) { + $e['days_bt'] += doubleval($row['dd']); + } + } + + $e['invalid'] = $emp->invalid == 1 ; $e['salarytype'] = $emp->ztype ; diff --git a/www/app/pages/doc/goodsissue.php b/www/app/pages/doc/goodsissue.php index 632a24635..c6a99a239 100644 --- a/www/app/pages/doc/goodsissue.php +++ b/www/app/pages/doc/goodsissue.php @@ -443,18 +443,29 @@ public function addcodeOnClick($sender) { $st = array_pop($st) ; $item = Item::load($st->item_id); - } - if ($item == null) { - $this->setWarn("Товар з кодом `{$code}` не знайдено"); - return; - } else { + } + if ($item != null) { $item->snumber = $code; - - } } - - + // проверка на стикер + if ($item == null) { + + $item = Item::unpackStBC($barcode); + $item->pureprice = $item->getPurePrice(); + $this->_itemlist[ ] = $item; + $this->_rownumber = 1; + + $this->docform->detail->Reload(); + $this->calcTotal(); + $this->calcPay(); + return; + } + if ($item == null) { + $this->setWarn("Товар з кодом `{$code}` не знайдено"); + return; + } + $qty = $item->getQuantity($store_id); if ($qty <= 0) { diff --git a/www/app/pages/jobs.php b/www/app/pages/jobs.php index 0cd46c452..21dfb1ea5 100644 --- a/www/app/pages/jobs.php +++ b/www/app/pages/jobs.php @@ -109,6 +109,7 @@ public function OnRow($row) { $row->stwait->setVisible(false); $row->sttoday->setVisible(false); $row->stpast->setVisible(false); + $row->done->setVisible(false); } diff --git a/www/app/pages/reference/itemlist.php b/www/app/pages/reference/itemlist.php index 93ec0d95c..774690bdf 100644 --- a/www/app/pages/reference/itemlist.php +++ b/www/app/pages/reference/itemlist.php @@ -21,6 +21,7 @@ use Zippy\Html\Link\ClickLink; use Zippy\Html\Panel; use Zippy\Html\Link\SubmitLink; +use Zippy\Binding\PropertyBinding as Bind; class ItemList extends \App\Pages\Base { @@ -30,13 +31,22 @@ class ItemList extends \App\Pages\Base public $_itemset = array(); public $_serviceset = array(); public $_tag = '' ; - + public $_cflist = array(); + public $_cflistv = array(); + public function __construct($add = false) { parent::__construct(); if (false == \App\ACL::checkShowRef('ItemList')) { return; } + $options = System::getOptions('common'); + $this->_cflist = $options['cflist']; + if (is_array($this->_cflist) == false) { + $this->_cflist = []; + } + + $this->add(new Form('filter'))->onSubmit($this, 'OnFilter'); $this->filter->add(new TextInput('searchbrand')); @@ -55,6 +65,7 @@ public function __construct($add = false) { $this->add(new Panel('itemtable'))->setVisible(true); $this->itemtable->add(new ClickLink('addnew'))->onClick($this, 'addOnClick'); + $this->itemtable->add(new ClickLink('customlist'))->onClick($this, 'cfOnClick'); $this->itemtable->add(new Form('listform')); @@ -72,6 +83,7 @@ public function __construct($add = false) { $this->itemtable->add(new \Zippy\Html\Link\LinkList("taglist"))->onClick($this, 'OnTagList'); + $this->add(new Form('itemdetail'))->setVisible(false); $this->itemdetail->add(new TextInput('editname')); $this->itemdetail->add(new TextInput('editshortname')); @@ -173,6 +185,19 @@ public function __construct($add = false) { $this->setpanel->add(new Label('stotal')); $this->setpanel->add(new ClickLink('backtolist', $this, "onback")); + + $this->add(new Form('customform'))->setVisible(false); + $this->customform->add(new SubmitButton('savec'))->onClick($this, 'savec'); + $this->customform->add(new Button('cancelc'))->onClick($this, 'cancelOnClick'); + $this->customform->add(new DataView('cflist', new ArrayDataSource(new Bind($this, '_cflist')), $this, 'cfOnRow')); + $this->customform->add(new SubmitLink('addnewcf'))->onClick($this, 'OnAddCF'); + + $this->add(new Form('customformv'))->setVisible(false); + $this->customformv->add(new SubmitButton('savecv'))->onClick($this, 'savecv'); + $this->customformv->add(new Button('cancelcv'))->onClick($this, 'cancelOnClick'); + $this->customformv->add(new TextInput('cflistvitem')) ; + $this->customformv->add(new DataView('cflistv', new ArrayDataSource(new Bind($this, '_cflistv')), $this, 'cfvOnRow')); + $this->_tvars['hp1'] = strlen($common['price1']) > 0 ? $common['price1'] : false; $this->_tvars['hp2'] = strlen($common['price2']) > 0 ? $common['price2'] : false; $this->_tvars['hp3'] = strlen($common['price3']) > 0 ? $common['price3'] : false; @@ -229,6 +254,7 @@ public function itemlistOnRow(\Zippy\Html\DataList\DataRow $row) { $row->shownotes->setVisible(strlen($item->description ?? '') > 0); + $row->add(new ClickLink('cfedit',$this, 'cfeditOnClick'))->setVisible(count($this->_cflist)>0); $row->add(new ClickLink('copy'))->onClick($this, 'copyOnClick'); $row->add(new ClickLink('edit'))->onClick($this, 'editOnClick'); @@ -365,6 +391,8 @@ public function addOnClick($sender) { public function cancelOnClick($sender) { $this->itemtable->setVisible(true); $this->itemdetail->setVisible(false); + $this->customform->setVisible(false); + $this->customformv->setVisible(false); } public function OnFilter($sender) { @@ -1106,6 +1134,8 @@ public function printStOnClick($sender) { } + + public function getSticker($args, $post) { $printer = \App\System::getOptions('printer') ; $user = \App\System::getUser() ; @@ -1199,7 +1229,82 @@ public function getSticker($args, $post) { } } + + public function cfOnClick($sender) { + $this->customform->cflist->Reload(); + $this->itemtable->setVisible(false); + $this->customform->setVisible(true); + } + + public function OnAddCF($sender) { + $ls = new \App\DataItem(); + $ls->code = ''; + $ls->name = ''; + $ls->id = time(); + $this->_cflist[$ls->id] = $ls; + $this->customform->cflist->Reload(); + } + + public function cfOnRow($row) { + $item = $row->getDataItem(); + $row->add(new TextInput('cfcode', new Bind($item, 'code'))); + $row->add(new TextInput('cfname', new Bind($item, 'name'))); + $row->add(new ClickLink('delcf', $this, 'onDelCF')); + + } + public function onDelCF($sender) { + $item = $sender->getOwner()->getDataItem(); + + $this->_cflist = array_diff_key($this->_cflist, array($item->id => $this->_cflist[$item->id])); + + $this->customform->cflist->Reload(); + + + } + + public function savec($sender) { + $options = System::getOptions('common'); + $options['cflist'] = $this->_cflist; + System::setOptions('common', $options); + + $this->itemtable->setVisible(true); + $this->customform->setVisible(false); + $this->Reload(false); + + } + public function cfeditOnClick($sender) { + $item = $sender->getOwner()->getDataItem(); + $this->customformv->cflistvitem->setText($item->item_id); + $this->_cflistv = $item->getcf(); + + $this->customformv->cflistv->Reload(); + $this->itemtable->setVisible(false); + $this->customformv->setVisible(true); + } + public function savecv($sender) { + $v=[]; + foreach($this->_cflistv as $r) { + if(strlen($r->val)>0) { + $v[$r->code]=$r->val; + } + } + $item = Item::load( $this->customformv->cflistvitem->getText()); + $item->savecf($v); + $item->save(); + $this->Reload(false); + + $this->itemtable->setVisible(true); + $this->customformv->setVisible(false); + + } + public function cfvOnRow($row) { + $item = $row->getDataItem(); + $row->add(new Label('cfd', $item->name)); + $row->add(new TextInput('cfval', new Bind($item, 'val'))); + + } + } class ItemDataSource implements \Zippy\Interfaces\DataSource diff --git a/www/app/pages/register/doclist.php b/www/app/pages/register/doclist.php index 10de092ca..984f250d0 100644 --- a/www/app/pages/register/doclist.php +++ b/www/app/pages/register/doclist.php @@ -720,7 +720,7 @@ public function oncsv($sender) { public function printlabels($sender) { $buf=[]; - $one = $this->statusform->print1->isChecked(); + $one = $this->statusform->print1->isChecked() ? 1:0; $items=[]; foreach($this->_doc->unpackDetails('detaildata') as $it) { if($this->_doc->meta_name=='GoodsReceipt') { @@ -731,7 +731,7 @@ public function printlabels($sender) { } $user = \App\System::getUser() ; - $ret = H::printItems($items); + $ret = H::printItems($items,$one); if(intval($user->prtypelabel) == 0) { diff --git a/www/app/pages/register/gilist.php b/www/app/pages/register/gilist.php index d3ec9950a..5a600d6e2 100644 --- a/www/app/pages/register/gilist.php +++ b/www/app/pages/register/gilist.php @@ -173,6 +173,10 @@ public function doclistOnRow(\Zippy\Html\DataList\DataRow $row) { $row->ispay->setVisible(false); } } + if($doc->state==9) { + $row->ispay->setVisible(false); + } + } $row->add(new ClickLink('show'))->onClick($this, 'showOnClick'); $row->add(new ClickLink('edit'))->onClick($this, 'editOnClick'); diff --git a/www/app/pages/register/grlist.php b/www/app/pages/register/grlist.php index 6120a50f7..870a531a1 100644 --- a/www/app/pages/register/grlist.php +++ b/www/app/pages/register/grlist.php @@ -96,6 +96,14 @@ public function doclistOnRow(\Zippy\Html\DataList\DataRow $row) { $row->istruck->setVisible(count($n)==0); } + if($doc->meta_name=='GoodsReceipt') { + if($doc->payamount == $doc->headerdata['prepaid']) { + $row->ispay->setVisible(false); + } + } + if($doc->state==9) { + $row->ispay->setVisible(false); + } } diff --git a/www/app/pages/register/itemlist.php b/www/app/pages/register/itemlist.php index 44181d70d..a3548ff0e 100644 --- a/www/app/pages/register/itemlist.php +++ b/www/app/pages/register/itemlist.php @@ -103,6 +103,7 @@ public function itemlistOnRow( $row) { $row->add(new Label('code', $item->item_code)); $row->add(new Label('brand', $item->manufacturer)); $row->add(new Label('msr', $item->msr)); + $row->add(new Label('cell', $item->cell)); $qty = $item->getQuantity($store); $row->add(new Label('iqty', H::fqty($qty))); diff --git a/www/app/pages/register/salarylist.php b/www/app/pages/register/salarylist.php index 4df50fcd3..ace5ee067 100644 --- a/www/app/pages/register/salarylist.php +++ b/www/app/pages/register/salarylist.php @@ -7,7 +7,7 @@ use App\Helper as H; use App\System; use Zippy\Html\DataList\DataView; -use Zippy\Html\DataList\Paginator; +use Zippy\Html\DataList\Pager; use Zippy\Html\Form\Date; use Zippy\Html\Form\DropDownChoice; use Zippy\Html\Form\Form; @@ -41,7 +41,7 @@ public function __construct() { $doclist = $this->add(new DataView('doclist', new SalListDataSource($this), $this, 'doclistOnRow')); - $this->add(new Paginator('pag', $doclist)); + $this->add(new Pager('pag', $doclist)); $doclist->setPageSize(H::getPG()); $this->add(new Panel("statuspan"))->setVisible(false); diff --git a/www/app/pages/subscribes.php b/www/app/pages/subscribes.php index 7d3aae996..fa6b1b6d8 100644 --- a/www/app/pages/subscribes.php +++ b/www/app/pages/subscribes.php @@ -43,6 +43,7 @@ public function __construct() { $this->editform->add(new TextArea('editmsgtext')); $this->editform->add(new TextInput('editmsgsubject')); $this->editform->add(new TextInput('editurl')); + $this->editform->add(new TextInput('editchatid')); $this->editform->add(new DropDownChoice('editeventtype', Subscribe::getEventList(), Subscribe::EVENT_DOCSTATE))->onChange($this, 'update'); $this->editform->add(new DropDownChoice('editdoctype', H::getDocTypes(), 0)); @@ -97,6 +98,7 @@ public function update($sender) { $this->editform->edituser->setVisible($rt==Subscribe::RSV_USER); $this->editform->editurl->setVisible($rt == Subscribe::RSV_WH); + $this->editform->editchatid->setVisible($rt == Subscribe::RSV_TG); return; @@ -174,6 +176,7 @@ public function OnEdit($sender) { $this->editform->editmsgtext->setText($this->_sub->msgtext); $this->editform->editmsgsubject->setText($this->_sub->msgsubject); $this->editform->editurl->setText($this->_sub->url); + $this->editform->editchatid->setText($this->_sub->chat_id); $this->editform->editdisabled->setCheCked($this->_sub->disabled); $this->editform->editattach->setCheCked($this->_sub->attach); $this->editform->edithtml->setCheCked($this->_sub->html); @@ -204,6 +207,7 @@ public function OnSave($sender) { $this->_sub->msgtext = trim($this->editform->editmsgtext->getText()); $this->_sub->msgsubject = trim($this->editform->editmsgsubject->getText()); $this->_sub->url = trim($this->editform->editurl->getText()); + $this->_sub->chat_id = trim($this->editform->editchatid->getText()); $this->_sub->disabled = $this->editform->editdisabled->isCheCked() ? 1 : 0; $this->_sub->html = $this->editform->edithtml->isCheCked() ? 1 : 0; diff --git a/www/app/pages/update.php b/www/app/pages/update.php index 66e10fab8..85cd0bb2e 100644 --- a/www/app/pages/update.php +++ b/www/app/pages/update.php @@ -61,15 +61,10 @@ public function __construct() { $phpv = phpversion() ; $phpv = substr(str_replace('.','',$phpv),0,2) ; - - $r= mysqli_connect($_config['db']['host'], $_config['db']['user'], $_config['db']['pass'], $_config['db']['name']) ; - - $myv = mysqli_get_server_info($r) ; - $myv = substr(str_replace('.','',$myv),0,2) ; $conn = \ZDB\DB::getConnect(); - $nocache= "?t=" . time()."&s=". H::getSalt() .'&phpv='. System::CURR_VERSION .'_'.$phpv .'_'.$myv ; + $nocache= "?t=" . time()."&s=". H::getSalt() .'&phpv='. System::CURR_VERSION .'_'.$phpv ; $v = @file_get_contents("https://zippy.com.ua/checkver.php".$nocache); $data = @json_decode($v, true); diff --git a/www/config/config.php b/www/config/config.php index 8a85987d3..0c376bd15 100644 --- a/www/config/config.php +++ b/www/config/config.php @@ -6,14 +6,13 @@ $_config['common']['timezone'] = 'Europe/Kiev' ; $_config['common']['loglevel'] = 100 ;//DEBUG = 100,INFO = 200,WARNING = 300,ERROR = 400; +//соединение с сервером БД $_config['db']['host'] = 'localhost:3306' ; $_config['db']['name'] = 'zstore' ; $_config['db']['user'] = 'root' ; $_config['db']['pass'] = 'root' ; - - - +//параметры почтового сервера $_config['smtp']['usesmtp'] = false ; //якщо false використовується sendmail. Заповнюється лише поле user, ящиком з котрого надсилає sendmail $_config['smtp']['host'] = 'smtp.google.com' ; $_config['smtp']['port'] = 587 ; diff --git a/www/templates/404.html b/www/templates/404.html index f5668f805..c9ffa7db9 100644 --- a/www/templates/404.html +++ b/www/templates/404.html @@ -7,8 +7,7 @@ - - + diff --git a/www/templates/pages/options.html b/www/templates/pages/options.html index 2c5cb5413..d6087efae 100644 --- a/www/templates/pages/options.html +++ b/www/templates/pages/options.html @@ -498,6 +498,7 @@

Параметри для етикеток і цінників

brandБренд notesПримітка weightВага (для вагового ТМЦ) + cf_<код поля>Значення кастомних полiв Управляючi теги ispriceДрукувати цiну diff --git a/www/templates/pages/reference/customerlist.html b/www/templates/pages/reference/customerlist.html index 3106d7467..abf83d9e8 100644 --- a/www/templates/pages/reference/customerlist.html +++ b/www/templates/pages/reference/customerlist.html @@ -478,6 +478,7 @@
Редагування джерел лідів
+ Скасувати @@ -497,6 +498,7 @@
Редагуванняя станів лідів
+ Скасувати diff --git a/www/templates/pages/reference/eqlist.html b/www/templates/pages/reference/eqlist.html index 4f0cbbe26..796ad0943 100644 --- a/www/templates/pages/reference/eqlist.html +++ b/www/templates/pages/reference/eqlist.html @@ -97,7 +97,8 @@

- +
+

Редагування

@@ -191,7 +192,7 @@

Редагування

- + diff --git a/www/templates/pages/reference/salarytypelist.html b/www/templates/pages/reference/salarytypelist.html index 300f81169..ec96c5738 100644 --- a/www/templates/pages/reference/salarytypelist.html +++ b/www/templates/pages/reference/salarytypelist.html @@ -111,8 +111,14 @@
Коди контексту
salarym - оклад
salaryh - погодинна сума
sellvalue - виручка по продажних документах співробітника
- hours - години з облiку часу
- days - днi з облiку часу
+ hours - робочi години з облiку часу
+ days - робочi днi з облiку часу
+ hours_over - переробка
+ hours_week - години в вихiднi
+ days_week - днi в вихiднi
+ days_vac - днi вiдпустки
+ days_sick - лiкарнянi днi
+ days_bt - днi в вiдрядженнi
diff --git a/www/templates/pages/register/itemlist.html b/www/templates/pages/register/itemlist.html index 8456b8e6d..f4f0dcef8 100644 --- a/www/templates/pages/register/itemlist.html +++ b/www/templates/pages/register/itemlist.html @@ -108,7 +108,7 @@

Товари на складі

Категорія Бренд Од. - + Кіл. {{^noshowpartion}} @@ -143,7 +143,7 @@

Товари на складі

- + diff --git a/www/templates/pages/register/salarylist.html b/www/templates/pages/register/salarylist.html index cbd213a48..d89d44677 100644 --- a/www/templates/pages/register/salarylist.html +++ b/www/templates/pages/register/salarylist.html @@ -13,13 +13,8 @@

Журнал зарплат

+
+ + + + +
+ +