Skip to content

Commit

Permalink
Merge pull request #115 from leon-mbs/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
leon-mbs authored Dec 5, 2020
2 parents 9583504 + 40b8810 commit 5c105bc
Show file tree
Hide file tree
Showing 81 changed files with 1,265 additions and 483 deletions.
18 changes: 15 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
CHANGELOG
=========



### v4.7.0 (2020-12-19)
* Добавлена иерархия контрагентов для консолидированой отчетности на уровне холдингов
* Добавлены типы номенклатуры. Комплектация теперь только для готовой продукции и полуфабрикатов.
* Номер банковского счета для счета фактуры перенесен в настройки денежных счетов
* Добавлен банковский процент для списания оплат операций по безналу

Для обновления версии обновить папки app, templates, templates_ua, выполнить update462to470.sql .


### v4.6.2 (2020-11-19)
* Улучшение быстродействия
* Усовершенствованиие додкумента Инвентаризация
* Усовершенствованиие документа Инвентаризация
* Исправление ошибок

Для обновления версии обновить папки app, templates, templates_ua
Обновить папку vendor (или выполнить composer)
Для обновления версии обновить папки app, templates, templates_ua, assets.
Обновить папку vendor (или выполнить composer, предварительно обновив composer.json)




Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Zippy Store
Домашняя страница: [http://zippy.com.ua/zstore](https://zippy.com.ua/zstore)

####
Основной функционал
Основная функционалльность

* управление складами, складская логистика
* закупка
Expand Down
147 changes: 101 additions & 46 deletions db/db.sql

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion db/initdata.sql
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ INSERT INTO `metadata` VALUES(19, 1, 'Наряд', 'Task', 'Производст
INSERT INTO `metadata` VALUES(20, 2, 'Отчет по нарядам', 'EmpTask', 'Производство', 0);
INSERT INTO `metadata` VALUES(21, 2, 'Закупки', 'Income', 'Закупки', 0);
INSERT INTO `metadata` VALUES(22, 2, 'Продажи', 'Outcome', 'Продажи', 0);
INSERT INTO `metadata` VALUES(46, 4, 'Кассы', 'MFList', '', 0);
INSERT INTO `metadata` VALUES(46, 4, 'Кассы, счета', 'MFList', '', 0);
INSERT INTO `metadata` VALUES(27, 3, 'Заказы клиентов', 'OrderList', 'Продажи', 0);
INSERT INTO `metadata` VALUES(28, 1, 'Заказ', 'Order', 'Продажи', 0);
INSERT INTO `metadata` VALUES(30, 1, 'Оприходование с производства', 'ProdReceipt', 'Производство', 0);
Expand Down
136 changes: 67 additions & 69 deletions db/initdata_ua.sql

Large diffs are not rendered by default.

64 changes: 64 additions & 0 deletions db/update462to470.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
ALTER TABLE `mfund` ADD `detail` LONGTEXT NULL ;

ALTER TABLE `paylist` ADD `detail` LONGTEXT NULL ;

ALTER VIEW `paylist_view` AS
select
`pl`.`pl_id` AS `pl_id`,
`pl`.`document_id` AS `document_id`,
`pl`.`amount` AS `amount`,
`pl`.`mf_id` AS `mf_id`,
`pl`.`notes` AS `notes`,
`pl`.`user_id` AS `user_id`,
`pl`.`paydate` AS `paydate`,
`pl`.`paytype` AS `paytype`,
`pl`.`detail` AS `detail`,
`d`.`document_number` AS `document_number`,
`u`.`username` AS `username`,
`m`.`mf_name` AS `mf_name`,
`d`.`customer_id` AS `customer_id`,
`d`.`customer_name` AS `customer_name`
from
(((`paylist` `pl` join `documents_view` `d` on((`pl`.`document_id` = `d`.`document_id`))) join `users_view` `u` on((`pl`.`user_id` = `u`.`user_id`))) join `mfund` `m` on((`pl`.`mf_id` = `m`.`mf_id`)));


ALTER TABLE `items` ADD `item_type` INT 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.item_type AS item_type,
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)));

ALTER VIEW store_stock_view AS
select
st.stock_id AS stock_id,
st.item_id AS item_id,
st.partion AS partion,
st.store_id AS store_id,
i.itemname AS itemname,
i.item_code AS item_code,
i.cat_id AS cat_id,
i.msr AS msr,
i.item_type AS item_type,
i.bar_code AS bar_code,
i.cat_name AS cat_name,
i.disabled AS itemdisabled,
stores.storename AS storename,
st.qty AS qty,
st.snumber AS snumber,
st.sdate AS sdate
from
((store_stock st join items_view i on(((i.item_id = st.item_id) and (i.disabled <> 1)))) join stores on((stores.store_id = st.store_id)));
4 changes: 2 additions & 2 deletions www/app/acl.php
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ public static function getStoreBranchConstraint() {
}

/**
* Возвращает список касс для подстьановки в запрос по текущим филиалам
* Возвращает список касс для подстановки в запрос по текущим филиалам
*
*/
public static function getMFBranchConstraint() {
Expand Down Expand Up @@ -545,7 +545,7 @@ public static function getBranchIDsConstraint() {
}

if (strlen($user->aclbranch) == 0) {
return " (0)";
return "0";
} //нет доступа ни к одному филиалу
return "{$user->aclbranch}";
}
Expand Down
49 changes: 42 additions & 7 deletions www/app/entity/customer.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ protected function beforeSave() {
$this->detail .= "<type>{$this->type}</type>";
$this->detail .= "<jurid>{$this->jurid}</jurid>";
$this->detail .= "<shopcust_id>{$this->shopcust_id}</shopcust_id>";
$this->detail .= "<isholding>{$this->isholding}</isholding>";
$this->detail .= "<holding>{$this->holding}</holding>";

$this->detail .= "<holding_name><![CDATA[{$this->holding_name}]]></holding_name>";
$this->detail .= "<address><![CDATA[{$this->address}]]></address>";
$this->detail .= "<comment><![CDATA[{$this->comment}]]></comment>";
$this->detail .= "</detail>";
Expand All @@ -51,6 +55,9 @@ protected function afterLoad() {
$this->type = (int)($xml->type[0]);
$this->jurid = (int)($xml->jurid[0]);
$this->shopcust_id = (int)($xml->shopcust_id[0]);
$this->isholding = (int)($xml->isholding[0]);
$this->holding = (int)($xml->holding[0]);
$this->holding_name = (string)($xml->holding_name[0]);
$this->address = (string)($xml->address[0]);
$this->comment = (string)($xml->comment[0]);

Expand All @@ -69,13 +76,7 @@ public function beforeDelete() {
return "";
}

/**
* список для комбо
*
*/
public static function getList() {
return Customer::findArray("customer_name", "status=" . Customer::STATUS_ACTUAL);
}


protected function afterDelete() {

Expand Down Expand Up @@ -103,5 +104,39 @@ public static function getByEmail($email) {
$conn = \ZDB\DB::getConnect();
return Customer::getFirst(' email = ' . $conn->qstr($email));
}

/**
* список контрагентов кроме холдингов
*
* @param mixed $search
* @param mixed $type
*/
public static function getList($search='',$type=0) {

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

$where = "status=0 and detail not like '%<isholding>1</isholding>%' ";
if(strlen($search)>0) {
$search = $conn->qstr('%' . $search . '%');
$where .= " and (customer_name like {$search} or phone like {$search} ) ";
}
if($type>0) {
$where .= " and (detail like '%<type>{$type}</type>%' or detail like '%<type>0</type>%' ) ";
}

return Customer::findArray("customer_name",$where,"customer_name");
}

public static function getHoldList($type=0) {

$conn = \ZDB\DB::getConnect();
$where = "status=0 and detail like '%<isholding>1</isholding>%' ";
if($type>0) {
$where .= " and (detail like '%<type>{$type}</type>%' or detail like '%<type>0</type>%' ) ";
}

return Customer::findArray("customer_name",$where,"customer_name");
}


}
12 changes: 11 additions & 1 deletion www/app/entity/doc/document.php
Original file line number Diff line number Diff line change
Expand Up @@ -354,15 +354,25 @@ public function updateStatus($state) {
return false;
}
}
$oldstate = $this->state;
$this->state = $state;
$this->insertLog($state);

$this->save();


if($oldstate!=$state){
$this->onState($oldstate,$state);
}

return true;
}

//обработяик изменения статусов
protected function onState($oldstate,$state){


}

/**
* Возвращает название статуса документа
*
Expand Down
7 changes: 4 additions & 3 deletions www/app/entity/doc/invoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class Invoice extends \App\Entity\Doc\Document
public function generateReport() {

$firm = H::getFirmData($this->headerdata["firm_id"], $this->branch_id);
$mf = \App\Entity\MoneyFund::load($this->headerdata["payment"]);


$i = 1;
Expand Down Expand Up @@ -51,9 +52,9 @@ public function generateReport() {
"iscontract" => $this->headerdata["contract_id"] > 0,
"phone" => $this->headerdata["phone"],
"customer_print" => $this->headerdata["customer_print"],
"bank" => $firm["bank"],
"bankacc" => $firm["bankacc"],
"isbank" => (strlen($firm["bankacc"]) > 0 && strlen($firm["bank"]) > 0),
"bank" => @$mf->bank,
"bankacc" => @$mf->bankacc,
"isbank" => (strlen($mf->bankacc) > 0 && strlen($mf->bank) > 0),
"email" => $this->headerdata["email"],
"notes" => $this->notes,
"document_number" => $this->document_number,
Expand Down
2 changes: 1 addition & 1 deletion www/app/entity/doc/retcustissue.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function Execute() {

}
if ($this->headerdata['payment'] > 0 && $this->payed > 0) {
\App\Entity\Pay::addPayment($this->document_id, $this->document_date, $this->payed, $this->headerdata['payment'], \App\Entity\Pay::PAY_CANCEL_CUST);
\App\Entity\Pay::addPayment($this->document_id, $this->document_date, $this->payed, $this->headerdata['payment'], \App\Entity\Pay::PAY_BASE_OUTCOME);
$this->payamount = $this->amount;
}

Expand Down
2 changes: 1 addition & 1 deletion www/app/entity/doc/returnissue.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function Execute() {
$sc->save();
}
if ($this->headerdata['payment'] > 0 && $this->payed > 0) {
\App\Entity\Pay::addPayment($this->document_id, $this->document_date, 0 - $this->payed, $this->headerdata['payment'], \App\Entity\Pay::PAY_CANCEL);
\App\Entity\Pay::addPayment($this->document_id, $this->document_date, 0 - $this->payed, $this->headerdata['payment'], \App\Entity\Pay::PAY_BASE_INCOME);
$this->payamount = $this->amount;
}

Expand Down
5 changes: 3 additions & 2 deletions www/app/entity/doc/task.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ public function generateReport() {
$detail = array();

foreach ($this->unpackDetails('detaildata') as $ser) {

if($ser->cost=="") $ser->cost=0;
if($ser->hours=="") $ser->hours=0;
$detail[] = array("no" => $i++,
"service_name" => $ser->service_name,
"cost" => H::fa($ser->cost * $ser->qty),
Expand Down Expand Up @@ -86,7 +87,7 @@ public function getRelationBased() {
$list = array();
$list['ProdIssue'] = self::getDesc('ProdIssue');
$list['ProdReceipt'] = self::getDesc('ProdReceipt');
$list['ServiceAct'] = self::getDesc('ServiceAct');
// $list['ServiceAct'] = self::getDesc('ServiceAct');

return $list;
}
Expand Down
4 changes: 0 additions & 4 deletions www/app/entity/firm.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ protected function afterLoad() {
$this->inn = (string)($xml->inn[0]);
$this->phone = (string)($xml->phone[0]);

$this->bank = (string)($xml->bank[0]);
$this->bankacc = (string)($xml->bankacc[0]);
$this->logo = (string)($xml->logo[0]);
$this->stamp = (string)($xml->stamp[0]);
$this->sign = (string)($xml->sign[0]);
Expand All @@ -39,8 +37,6 @@ protected function beforeSave() {

$this->details = "<details>";
$this->details .= "<address><![CDATA[{$this->address}]]></address>";
$this->details .= "<bank><![CDATA[{$this->bank}]]></bank>";
$this->details .= "<bankacc><![CDATA[{$this->bankacc}]]></bankacc>";
$this->details .= "<logo><![CDATA[{$this->logo}]]></logo>";
$this->details .= "<stamp><![CDATA[{$this->stamp}]]></stamp>";
$this->details .= "<sign><![CDATA[{$this->sign}]]></sign>";
Expand Down
25 changes: 23 additions & 2 deletions www/app/entity/item.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@
*/
class Item extends \ZCL\DB\Entity
{

const TYPE_TOVAR = 1; //товар
const TYPE_MAT = 2; //материалы и комплектующие
const TYPE_MBP = 3; //малоценка
const TYPE_PROD = 4; //готовая продукция
const TYPE_HALFPROD = 5; //полуфабрикаты


private $brprice = array(); //цены по филиалам

protected function init() {
Expand Down Expand Up @@ -40,6 +46,7 @@ protected function afterLoad() {
$this->pricelist = (int)$xml->pricelist[0];
$this->useserial = (int)$xml->useserial[0];
$this->image_id = (int)$xml->image_id[0];

$this->weight = (string)$xml->weight[0];
$this->manufacturer = (string)$xml->manufacturer[0];
$this->shortname = (string)$xml->shortname[0];
Expand Down Expand Up @@ -101,7 +108,7 @@ protected function beforeSave() {

$this->detail .= "<image_id>{$this->image_id}</image_id>";
$this->detail .= "<weight>{$this->weight}</weight>";


//упаковываем цены по филиалам
$brprice = serialize($this->brprice);
Expand Down Expand Up @@ -414,4 +421,18 @@ public static function getManufacturers() {

}


public static function getTypes(){
$list = array();

$list[Item::TYPE_TOVAR] = \App\Helper::l('it_tovar');
$list[Item::TYPE_MAT] = \App\Helper::l('it_mat');
$list[Item::TYPE_MBP] = \App\Helper::l('it_mbp');
$list[Item::TYPE_PROD] = \App\Helper::l('it_prod');
$list[Item::TYPE_HALFPROD] = \App\Helper::l('it_hprod');


return $list;
}

}
29 changes: 29 additions & 0 deletions www/app/entity/moneyfund.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,35 @@ protected function init() {
$this->branch_id = 0;
}

protected function beforeSave() {
parent::beforeSave();
//упаковываем данные в detail
$this->detail = "<detail>";
$this->detail .= "<beznal>{$this->beznal}</beznal>";
$this->detail .= "<btran>{$this->btran}</btran>";
$this->detail .= "<bank><![CDATA[{$this->bank}]]></bank>";
$this->detail .= "<bankacc><![CDATA[{$this->bankacc}]]></bankacc>";

$this->detail .= "</detail>";

return true;
}

protected function afterLoad() {
//распаковываем данные из detail
if(strlen($this->detail)==0) return;

$xml = simplexml_load_string($this->detail);
$this->beznal = intval($xml->beznal[0]);
$this->btran = floatval($xml->btran[0]);
$this->bank = (string)($xml->bank[0]);
$this->bankacc = (string)($xml->bankacc[0]);

parent::afterLoad();
}



protected function beforeDelete() {

$conn = \ZDB\DB::getConnect();
Expand Down
Loading

0 comments on commit 5c105bc

Please sign in to comment.