Skip to content

Commit

Permalink
Merge pull request #79 from leon-mbs/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
leon-mbs authored May 6, 2020
2 parents a86209f + 439d8c2 commit 8a65aa8
Show file tree
Hide file tree
Showing 79 changed files with 723 additions and 171 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
CHANGELOG
=========
### v4.1.2 (2020-04-28)
* Добавлено поле Бренд для товара
* Исправоения и улучшения


### v4.1.1 (2020-04-15)
* исправления и улучшения

Expand Down
22 changes: 22 additions & 0 deletions db/update412.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

ALTER TABLE `items` ADD `manufacturer` VARCHAR(255) NULL ;


ALTER VIEW `items_view` AS
select
`items`.`item_id` AS `item_id`,
`items`.`itemname` AS `itemname`,
`items`.`description` AS `description`,
`items`.`detail` AS `detail`,
`items`.`item_code` AS `item_code`,
`items`.`bar_code` AS `bar_code`,
`items`.`cat_id` AS `cat_id`,
`items`.`msr` AS `msr`,
`items`.`disabled` AS `disabled`,
`items`.`minqty` AS `minqty`,
`items`.`manufacturer` AS `manufacturer`,
`item_cat`.`cat_name` AS `cat_name`
from
(`items` left join `item_cat` on((`items`.`cat_id` = `item_cat`.`cat_id`)));


2 changes: 1 addition & 1 deletion www/app/acl.php
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ public static function getEmpBranchConstraint() {
}

/**
* Возвращает список документы для подстьановки в запрос по текущим филиалам
* Возвращает список документы для подстановки в запрос по текущим филиалам
*
*/
public static function getDocBranchConstraint() {
Expand Down
31 changes: 16 additions & 15 deletions www/app/entity/doc/document.php
Original file line number Diff line number Diff line change
Expand Up @@ -356,12 +356,12 @@ public function updateStatus($state) {
//если нет права выполнять
if ($state >= self::STATE_EXECUTED && \App\Acl::checkExeDoc($this, false, false) == false) {

$this->headerdata['_state_before_approve_'] = $state;
if ($state == self::STATE_WA) {
$this->headerdata['_state_before_approve_'] = $state; //целевой статус
if ($state == self::STATE_WA) { //если на утверждение то ждем утверждения
$this->headerdata['_state_before_approve_'] = self::STATE_APPROVED;
}

$state = self::STATE_WA;
$state = self::STATE_WA; //переводим на ожидание утверждения
}

if ($state == self::STATE_CANCELED) {
Expand All @@ -370,7 +370,7 @@ public function updateStatus($state) {
if ($state == self::STATE_EXECUTED) {
if (false === $this->Execute()) {
$this->Cancel();
return;
return false;
}
}
$this->state = $state;
Expand Down Expand Up @@ -433,26 +433,27 @@ public static function getStateName($state) {
*
* @return mixed
*/
public function nextNumber() {
public function nextNumber($branch_id=0) {


$class = explode("\\", get_called_class());
$metaname = $class[count($class) - 1];
$doc = Document::getFirst("meta_name='" . $metaname . "'", "document_id desc");
if ($doc == null) {
$conn = \ZDB\DB::getConnect();
$branch="";
if($branch_id>0) $branch=" and branch_id=".$branch_id;

$sql = "select document_number from documents_view where meta_name='{$metaname}' {$branch} order by document_id desc limit 0,1";
$prevnumber = $conn->GetOne($sql);
if (strlen($lastnumber) == 0) {
$prevnumber = $this->getNumberTemplate();
} else {
$prevnumber = $doc->document_number;
}


if (strlen($prevnumber) == 0) {
}

if (strlen($prevnumber) == 0)
return '';
}
$number = preg_replace('/[^0-9]/', '', $prevnumber);
if (strlen($number) == 0) {
if (strlen($number) == 0)
$number = 0;
}

$letter = preg_replace('/[0-9]/', '', $prevnumber);

Expand Down
2 changes: 1 addition & 1 deletion www/app/entity/doc/task.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function generateReport() {

$header = array('date' => date('d.m.Y', $this->document_date),
"pareaname" => strlen($this->headerdata["pareaname"]) > 0 ? $this->headerdata["pareaname"] : false,
"startdate" => date('d.m.Y', $this->headerdata["start_date"]),
"document_date" => date('d.m.Y', $this->document_date),
"document_number" => $this->document_number,
"notes" => $this->notes,
"baseddoc" => strlen($this->headerdata["parent_number"]) > 0 ? $this->headerdata["parent_number"] : false,
Expand Down
15 changes: 15 additions & 0 deletions www/app/entity/item.php
Original file line number Diff line number Diff line change
Expand Up @@ -355,4 +355,19 @@ public static function getNextArticle() {
return "ID" . sprintf("%04d", ++$id);
}


public static function getManufacturers() {

$conn = \ZDB\DB::getConnect();

$sql = " select distinct manufacturer from items order by manufacturer";
$res = $conn->Execute($sql);
$list = array();
foreach($res as $v) {
if(strlen($v['manufacturer'])>0) $list[]= $v['manufacturer'];
}
return $list;

}

}
2 changes: 2 additions & 0 deletions www/app/modules/issue/entity/issue.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ protected function init() {

$this->createdon = time();
$this->lastupdate = time();
$this->notes = '' ;

}

/**
Expand Down
1 change: 1 addition & 0 deletions www/app/modules/ocstore/helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public static function do_curl_request($url, $params = array()) {
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_COOKIEJAR, _ROOT . 'upload/apicookie.txt');
curl_setopt($ch, CURLOPT_COOKIEFILE, _ROOT . 'upload/apicookie.txt');
// curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

$params_string = '';
if (is_array($params) && count($params)) {
Expand Down
1 change: 1 addition & 0 deletions www/app/modules/ocstore/items.php
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ public function onGetItems($sender) {
$item->item_code = $product['sku'];
$item->itemname = $product['name'];
$item->description = $product['description'];
$item->manufacturer = $product['manufacturer'];
$w = $product['weight'];
$w = str_replace(',', '.', $w);
if ($product['weight_class_id'] == 2) {
Expand Down
4 changes: 3 additions & 1 deletion www/app/pages/base.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ public function __construct($params = null) {
$this->_tvars["smart"] = Helper::generateSmartMenu();



$this->_tvars["shopmenu"] = $_config['modules']['shop'] == 1;
$this->_tvars["shop"] = $_config['modules']['shop'] == 1;
$this->_tvars["ocstore"] = $_config['modules']['ocstore'] == 1;
$this->_tvars["woocomerce"] = $_config['modules']['woocomerce'] == 1;
Expand All @@ -87,7 +89,7 @@ public function __construct($params = null) {
if (strpos(System::getUser()->modules, 'woocomerce') === false && System::getUser()->userlogin != 'admin') {
$this->_tvars["woocomerce"] = false;
}

//скрыть боковое меню
$this->_tvars["hidesidebar"] = $user->hidesidebar == 1 ? 'hold-transition sidebar-collapse' : 'hold-transition sidebar-mini sidebar-collapse';
//для скрытия блока разметки в шаблоне страниц
Expand Down
16 changes: 12 additions & 4 deletions www/app/pages/doc/goodsreceipt.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ public function __construct($docid = 0, $basedocid = 0) {
$this->editnewitem->add(new TextInput('editnewitembarcode'));
$this->editnewitem->add(new TextInput('editnewitemsnumber'));
$this->editnewitem->add(new TextInput('editnewitemsdate'));
$this->editnewitem->add(new TextInput('editnewmanufacturer'));
$this->editnewitem->add(new DropDownChoice('editnewcat', \App\Entity\Category::findArray("cat_name", "", "cat_name"), 0));
$this->editnewitem->add(new Button('cancelnewitem'))->onClick($this, 'cancelnewitemOnClick');
$this->editnewitem->add(new SubmitButton('savenewitem'))->onClick($this, 'savenewitemOnClick');
Expand Down Expand Up @@ -583,10 +584,10 @@ private function CalcPay() {
$total = $total * $rate;
}

$this->docform->editpayamount->setText(round($total));
$this->docform->payamount->setText(round($total));
$this->docform->editpayed->setText(round($total));
$this->docform->payed->setText(round($total));
$this->docform->editpayamount->setText(H::fa($total));
$this->docform->payamount->setText(H::fa($total));
$this->docform->editpayed->setText(H::fa($total));
$this->docform->payed->setText(H::fa($total));
}

/**
Expand Down Expand Up @@ -642,6 +643,12 @@ public function addnewitemOnClick($sender) {
if (System::getOption("common", "autoarticle") == 1) {
$this->editnewitem->editnewitemcode->setText(Item::getNextArticle());
}
$this->_tvars['manlist'] = array();

foreach(Item::getManufacturers() as $man){
$this->_tvars['manlist'][] = array('mitem'=>$man) ;
}

}

public function savenewitemOnClick($sender) {
Expand All @@ -664,6 +671,7 @@ public function savenewitemOnClick($sender) {
}


$item->manufacturer = $this->editnewitem->editnewmanufacturer->getText();
$item->bar_code = $this->editnewitem->editnewitembarcode->getText();
$item->snumber = $this->editnewitem->editnewitemsnumber->getText();
if (strlen($item->snumber) > 0) {
Expand Down
2 changes: 1 addition & 1 deletion www/app/pages/doc/incomeitem.php
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ private function calcTotal() {
$item->amount = $item->price * $item->quantity;
$total = $total + $item->amount;
}
$this->docform->total->setText(round($total));
$this->docform->total->setText(H::fa($total));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion www/app/pages/doc/invoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ public function OnChangeItem($sender) {


$this->editdetail->qtystock->setText(H::fqty($item->getQuantity($this->docform->store->getValue())));
$this->editdetail->editprice->setText(round($price));
$this->editdetail->editprice->setText(H::fa($price));

$this->updateAjax(array('qtystock', 'editprice'));
}
Expand Down
2 changes: 1 addition & 1 deletion www/app/pages/doc/order.php
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ private function calcTotal() {

$total = $total + $item->amount;
}
$this->docform->total->setText(round($total));
$this->docform->total->setText(H::fa($total));
}

/**
Expand Down
6 changes: 1 addition & 5 deletions www/app/pages/doc/task.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ public function __construct($docid = 0, $basedocid = 0, $date = null) {

$this->add(new Form('docform'));
$this->docform->add(new TextInput('document_number'));
$this->docform->add(new \ZCL\BT\DatePicker('start_date'))->setDate(time());
$this->docform->add(new \ZCL\BT\DatePicker('document_date'))->setDate(time());

$this->docform->add(new TextArea('notes'));
Expand Down Expand Up @@ -81,9 +80,7 @@ public function __construct($docid = 0, $basedocid = 0, $date = null) {
$this->docform->notes->setText($this->_doc->notes);
$this->docform->taskhours->setText($this->_doc->headerdata['taskhours']);

$this->docform->start_date->setDate($this->_doc->headerdata['start_date']);



$this->docform->document_date->setDate($this->_doc->document_date);
$this->docform->parea->setValue($this->_doc->headerdata['parea']);

Expand Down Expand Up @@ -284,7 +281,6 @@ public function savedocOnClick($sender) {
$this->_doc->headerdata['parea'] = $this->docform->parea->getValue();
$this->_doc->headerdata['pareaname'] = $this->docform->parea->getValueName();
$this->_doc->headerdata['taskhours'] = $this->docform->taskhours->getText();
$this->_doc->headerdata['start_date'] = $this->docform->start_date->getDate();
$this->_doc->document_date = $this->docform->document_date->getDate();


Expand Down
5 changes: 4 additions & 1 deletion www/app/pages/reference/customerlist.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public function addOnClick($sender) {
$this->customerdetail->clean();
$this->_customer = new Customer();

$this->contentview->setVisible(false);
$this->contentview->setVisible(false);
}

public function saveOnClick($sender) {
Expand Down Expand Up @@ -394,4 +394,7 @@ public function deleteEventOnClick($sender) {
$this->customertable->customerlist->Reload(false);
}




}
23 changes: 22 additions & 1 deletion www/app/pages/reference/itemlist.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ public function itemlistOnRow($row) {
$row->add(new Label('code', $item->item_code));
$row->add(new Label('msr', $item->msr));
$row->add(new Label('cat_name', $item->cat_name));
$row->add(new Label('manufacturer', $item->manufacturer));
$plist = array();
if ($item->price1 > 0) {
$plist[] = H::fa($item->price1);
Expand All @@ -148,8 +149,14 @@ public function itemlistOnRow($row) {
$plist[] = H::fa($item->price5);
}
$row->add(new Label('price', implode(', ', $plist)));
$row->add(new Label('desc', htmlspecialchars_decode($item->description), true));
$row->add(new Label('hasnotes'))->setVisible(strlen($item->description) > 0) ;
$row->hasnotes->setAttribute('title', htmlspecialchars_decode($item->description));
$row->setAttribute('style', $item->disabled == 1 ? 'color: #aaa' : null);


$row->add(new Label('cell', $item->cell));
$row->add(new Label('inprice' ))->setVisible($item->pricelist);
$row->add(new Label('inseria' ))->setVisible($item->useserial);

$row->add(new ClickLink('edit'))->onClick($this, 'editOnClick');
$row->add(new ClickLink('delete'))->onClick($this, 'deleteOnClick');
Expand Down Expand Up @@ -217,6 +224,8 @@ public function editOnClick($sender) {
$this->itemdetail->editdelimage->setVisible(false);
$this->itemdetail->editimage->setVisible(false);
}

$this->updateman() ;
}

public function addOnClick($sender) {
Expand All @@ -233,6 +242,7 @@ public function addOnClick($sender) {
if (System::getOption("common", "autoarticle") == 1) {
$this->itemdetail->editcode->setText(Item::getNextArticle());
}
$this->updateman() ;
}

public function cancelOnClick($sender) {
Expand Down Expand Up @@ -457,6 +467,15 @@ public function printOnClick($sender) {
$this->updateAjax(array(), " $('#tag').html('{$html}') ; $('#pform').modal()");
}

public function updateman(){
$this->_tvars['manlist'] = array();

foreach(Item::getManufacturers() as $man){
$this->_tvars['manlist'][] = array('mitem'=>$man) ;
}

}

}

class ItemDataSource implements \Zippy\Interfaces\DataSource
Expand Down Expand Up @@ -513,4 +532,6 @@ public function getItem($id) {
return Item::load($id);
}



}
2 changes: 1 addition & 1 deletion www/app/pages/register/doclist.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public function doclistOnRow($row) {

$row->add(new Label('hasnotes'))->setVisible(strlen($doc->notes) > 0 && $doc->notes == strip_tags($doc->notes));
$row->hasnotes->setAttribute('title', $doc->notes);

$row->add(new ClickLink('parentdoc', $this, 'basedOnClick'))->setVisible($doc->parent_id > 0);
$row->parentdoc->setValue($doc->headerdata['parent_number']);

Expand Down
Loading

0 comments on commit 8a65aa8

Please sign in to comment.