Skip to content

Commit

Permalink
Merge pull request #210 from leon-mbs/dev
Browse files Browse the repository at this point in the history
5.5.1
  • Loading branch information
leon-mbs authored Oct 30, 2021
2 parents df8c589 + 49d991d commit ef4eba5
Show file tree
Hide file tree
Showing 55 changed files with 46,355 additions and 12,555 deletions.
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ Zippy Store
####
Основная функциональность

* управление складами, складская логистика
* управление складами
* закупка
* продажа
* учет курса валют при закупке и продаже
* учет платежей и взаиморасчеты с котрагентами
* партионный учет и учет по сериям производителя
* управление пользователями и доступом, личный кабинет пользователя
* работа с лидами и друние элементы элементы CRM
* работа с лидами и другие элементы CRM
* отчеты по продажам, закупкам, движению товара
* услуги, задачи, календарь выполнения работ
* учет оборудования
Expand All @@ -39,8 +39,7 @@ Zippy Store
--------------------

Создать БД (кодировка utf8_general_ci), выполнить SQL скрипты (папка DB) сначала структуру db.sql потом данные инициализации initdata.sql.
Файлы update*.sql для новой БД выполнять не нужно.


Скопировать содержимое папки www в корневой каталог сайта.
Выполнить composer.json для скачивания сторонних библиотек .

Expand Down
22 changes: 22 additions & 0 deletions www/app/entity/customer.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,4 +209,26 @@ public function getBonus() {
return $conn->GetOne($sql);

}

public function getDolg() {
$br = "";
$c = \App\ACL::getBranchConstraint();
if (strlen($c) > 0) {
$br = " {$c} and ";
}
$docs = " and ( meta_name in('GoodsIssue','Invoice' ,'PosCheck','ServiceAct','Order','ReturnIssue') or (meta_name='IncomeMoney' and content like '%<detail>1</detail>%' ) or (meta_name='OutcomeMoney' and content like '%<detail>2</detail>%' )) ";

$conn = \ZDB\DB::getConnect();
$sql = "select coalesce(sum(sam),0) as sam from (
select (case when ( meta_name='OutcomeMoney' or meta_name='ReturnIssue' ) then (payed - payamount ) else (payamount - payed) end) as sam
from `documents_view`
where {$br} customer_id={$this->customer_id} and (payamount >0 or payed >0) {$docs} and state not in (1,2,3,17,8) and ( (meta_name <>'POSCheck' and payamount <> payed) or(meta_name = 'POSCheck' and payamount > payed ))
) t ";


return $conn->GetOne($sql);

}


}
1 change: 1 addition & 0 deletions www/app/entity/doc/goodsreceipt.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ public function getRelationBased() {

$list['RetCustIssue'] = self::getDesc('RetCustIssue');
$list['GoodsReceipt'] = self::getDesc('GoodsReceipt');
$list['ProdIssue'] = self::getDesc('ProdIssue');

return $list;
}
Expand Down
2 changes: 1 addition & 1 deletion www/app/entity/pay.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public static function addPayment($document_id, $paydate, $amount, $mf_id, $type
$payb->user_id = \App\System::getUser()->user_id;
$payb->save();

\App\Entity\IOState::addIOState($document_id, $payb->amount, \App\Entity\IOState::TYPE_BANK);
\App\Entity\IOState::addIOState($document_id, 0-$payb->amount, \App\Entity\IOState::TYPE_BANK);


}
Expand Down
2 changes: 1 addition & 1 deletion www/app/entity/stock.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public static function getStock($store_id, $item_id, $price, $snumber = "", $sda
$stock->snumber = $snumber;
$stock->sdate = $sdate;

\App\Helper::log(serialize($stock));

$stock->save();
}
if ($partiontype == '1' && $price > 0) { //учет по последней цене
Expand Down
13 changes: 13 additions & 0 deletions www/app/entity/subscribe.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ public function getText($doc) {
$header['mf'] = '';
$header['pos'] = '';
$header['source'] = '';
$header['payed'] = '';
$header['credit'] = '';
$header['device'] = $doc->headerdata['device'];
if (strlen($doc->headerdata['device']) > 0 && strlen($doc->headerdata['devsn']) > 0) {
$header['device'] .= " (" . $doc->headerdata['devsn'] . ")";
Expand Down Expand Up @@ -209,6 +211,9 @@ public function getText($doc) {
if ($doc->headerdata['payed'] == 0 && $doc->payamount == 0) {
$header['mf'] = \App\Helper::l("prepaid");
}
if ($doc->headerdata['payed'] > 0) {
$header['payed'] = \App\Helper::fa($doc->headerdata['payed']);
}

if ($doc->headerdata['pos']) {
$pos = \App\Entity\Pos::load($doc->headerdata['pos']);
Expand All @@ -218,6 +223,14 @@ public function getText($doc) {
$sl = H::getSaleSources();
$header['source'] = $sl[$doc->headerdata['salesource']];
}
if ($doc->customer_id > 0) {
$cust = \App\Entity\Customer::load($doc->customer_id) ;
$dolg = $cust->getDolg();
if($dolg >0) {
$header['credit'] = \App\Helper::fa($dolg);
}

}

$table = array();
foreach ($doc->unpackDetails('detaildata') as $item) {
Expand Down
3 changes: 3 additions & 0 deletions www/app/modules/shop/comparelist.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ public function hasProsuct($item_id) {
public function isEmpty() {
return count($this->list) == 0;
}
public function getItemCount() {
return count($this->list) ;
}

// реализация DataSource
/*
Expand Down
15 changes: 11 additions & 4 deletions www/app/modules/shop/pages/base.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ public function __construct($params = null) {

// $this->_tvars["islogined"] = $user->user_id > 0;
$this->_tvars["currencyname"] = $shop["currencyname"];
$this->_tvars["notcnt"] = false;
$this->_tvars["basketcnt"] = false;
$this->_tvars["comparecnt"] = false;
$this->_tvars["phone"] = strlen($shop["phone"]) > 0 ? $shop["phone"] : false;

$this->add(new \Zippy\Html\Form\Form('searchform'));
Expand Down Expand Up @@ -63,7 +64,9 @@ public function __construct($params = null) {
if(!is_array($shop["pages"])) $shop["pages"] = array();
$this->_tvars['pages'] =array();
foreach($shop["pages"] as $p) {
$this->_tvars['pages'][]=array('link'=> $p->link ,'title'=>$p->title);
$link = _BASEURL .trim($p->link,"/");

$this->_tvars['pages'][]=array('link'=> $link ,'title'=>$p->title);
}


Expand Down Expand Up @@ -115,10 +118,14 @@ final protected function isError() {

protected function beforeRender() {
$basket = \App\Modules\Shop\Basket::getBasket();
$comp = \App\Modules\Shop\CompareList::getCompareList();

$this->shopcart->setVisible($basket->isEmpty() == false);
$this->showcompare->setVisible(\App\Modules\Shop\CompareList::getCompareList()->isEmpty() == false);
$this->showcompare->setVisible($comp->isEmpty() == false);

$this->_tvars["notcnt"] = $basket->getItemCount();
$this->_tvars["basketcnt"] = $basket->getItemCount();

$this->_tvars["comparecnt"] = $comp->getItemCount();
}

protected function afterRender() {
Expand Down
12 changes: 10 additions & 2 deletions www/app/modules/shop/pages/order.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function OnDelivery($sender) {

public function OnUpdate($sender) {


$this->listform->pitem->Reload();
$this->sum = 0;

$rows = $this->listform->pitem->getDataRows();
Expand All @@ -77,8 +77,9 @@ public function OnUpdate($sender) {

$this->sum = $this->sum + $product->getPriceFinal() * $product->quantity;
}

Basket::getBasket()->list = $this->basketlist;
$this->listform->pitem->Reload();

}

public function OnDelete($sender) {
Expand Down Expand Up @@ -230,6 +231,12 @@ public function OnSave($sender) {
$order->amount = $amount;
$order->payamount = $amount;
$order->branch_id = $op["defbranch"];

if($order->user_id==0) {
$user = \App\Entity\user::getByLogin('admin') ;
$order->user_id = $user->user_id;
}

$order->save();
$order->updateStatus(Document::STATE_NEW);
if ($shop['ordertype'] == 1) { //Кассовый чек
Expand All @@ -255,6 +262,7 @@ public function OnSave($sender) {
}
} catch(\Exception $ee) {
$this->setError($ee->getMessage());
return;
}


Expand Down
4 changes: 2 additions & 2 deletions www/app/modules/wc/helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ public static function getClient() {
$modules = \App\System::getOptions("modules");

$site = $modules['wcsite'];
$keyc = $modules['wckeyc'];
$keys = $modules['wckeys'];
$keyc = $modules['wckeyc']; //ck_a36c9d5d8ef70a34001b6a44bc245a7665ca77e7
$keys = $modules['wckeys']; //cs_12b03012d9db469b45b1fc82e329a3bc995f3e36
$api = $modules['wcapi'];
// $ssl = $modules['wcssl'];

Expand Down
Loading

0 comments on commit ef4eba5

Please sign in to comment.