Skip to content

Commit

Permalink
Merge pull request #97 from leon-mbs/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
leon-mbs authored Jul 12, 2020
2 parents 2f2eb84 + 53ab089 commit 5d25196
Show file tree
Hide file tree
Showing 64 changed files with 34,258 additions and 346 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
CHANGELOG
=========

### v4.4.3 (2020-07-12)
* Документ Перемещение ТМЦ между складами.
* Возможность сканирования штрих кода камерой телефона.

Для обновления версии выполнить update442to443.sql, обновить папки assets, app, templates, templates_ua,
vendor (или выполнить composer update), файл init.php


### v4.4.2 (2020-06-31)
* Отдельное задание прав на изменение статуса документа.
* Справочник Оборудование расширен до Основные фонды для учета ОС и НМА.
Expand Down
1 change: 1 addition & 0 deletions db/initdata.sql
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +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(77, 2, 'Отчет по зарплате', 'SalaryRep', 'Платежи', 0);
INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(78, 2, 'Движение по контрагентам', 'CustActivity', 'Платежи', 0);
INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(81, 4, 'Договора', 'ContractList', '', 0);
INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(82, 1, 'Перемещение ТМЦ', 'MoveItem', 'Склад', 0);

3 changes: 2 additions & 1 deletion db/initdata_ua.sql
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +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( 4, 'Контракти', 'ContractList', '', 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( 1, 'Перемiщення ТМЦ', 'MoveItem', 'Склад', 0);
3 changes: 3 additions & 0 deletions db/update442to443.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@


INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 1, 'Ïåðåìåùåíèå ÒÌÖ', 'MoveItem', 'Ñêëàä', 0);
89 changes: 89 additions & 0 deletions www/app/entity/doc/moveitem.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
<?php

namespace App\Entity\Doc;

use App\Entity\Entry;
use App\Entity\Stock;
use App\Helper as H;

/**
* Класс-сущность документ перемещение товаров
*
*/
class MoveItem extends Document
{

public function Execute() {


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

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

//списываем со склада

$listst = Stock::pickup($this->headerdata['store'], $item);
if (count($listst) == 0) {
\App\System::setErrorMsg( H::l('noenaughtovar', $item->itemname));

return false;
}
foreach ($listst as $st) {
$sc = new Entry($this->document_id, 0 - $st->quantity * $st->partion, 0 - $st->quantity);
$sc->setStock($st->stock_id);
$sc->save();

$sti = Stock::getStock($this->headerdata['tostore'],$st->item_id,$st->partion,$st->snumber,$st->sdate,true) ;
$sc = new Entry($this->document_id, $st->quantity * $sti->partion, $st->quantity);
$sc->setStock($sti->stock_id);
$sc->save();


}





}

return true;
}

public function generateReport() {

$i = 1;
$detail = array();
foreach ($this->unpackDetails('detaildata') as $item) {
$name = $item->itemname;


$detail[] = array("no" => $i++,
"item_name" => $name,
"snumber" => $item->snumber,
"msr" => $item->msr,
"quantity" => H::fqty($item->quantity));
}

$header = array(
"_detail" => $detail,
'date' => H::fd($this->document_date),
"from" => $this->headerdata["storename"],
"to" => $this->headerdata["tostorename"],
"notes" => $this->notes,
"document_number" => $this->document_number
);
$report = new \App\Report('doc/moveitem.tpl');

$html = $report->generate($header);

return $html;
}

protected function getNumberTemplate() {
return 'MТ-000000';
}



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

$listst = Stock::pickup($this->headerdata['store'], $item);
if (count($listst) == 0) {
\App\System::setErrorMsg('Недостаточно товара ' . $item->itemname);
\App\System::setErrorMsg( H::l('noenaughtovar', $item->itemname));
return false;
}
foreach ($listst as $st) {
Expand Down
6 changes: 3 additions & 3 deletions www/app/entity/equipment.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ protected function beforeSave() {
$this->detail .= "<code>{$this->code}</code>";
$this->detail .= "<balance>{$this->balance}</balance>";
$this->detail .= "<eq>{$this->eq}</eq>";
$this->detail .= "<enterdate>{$this->enterdate}</enterdate>";



Expand All @@ -41,10 +42,9 @@ protected function afterLoad() {
$this->serial = (string)($xml->serial[0]);
$this->code = (string)($xml->code[0]);
$this->balance = (string)($xml->balance[0]);
$this->enterdate = (int)($xml->enterdate[0]);
$this->eq = (int)($xml->eq[0]);




parent::afterLoad();
}

Expand Down
3 changes: 2 additions & 1 deletion www/app/entity/user.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ protected function afterLoad() {
$this->defmf = (int)$options['defmf'];
$this->pagesize = (int)$options['pagesize'];

$this->popupmessage = (int)$options['popupmessage'];

$this->hidesidebar = (int)$options['hidesidebar'];

parent::afterLoad();
Expand All @@ -105,6 +105,7 @@ protected function beforeSave() {

$options['defmf'] = $this->defmf;
$options['pagesize'] = $this->pagesize;
$options['hidesidebar'] = $this->hidesidebar;

$this->options = serialize($options);

Expand Down
2 changes: 2 additions & 0 deletions www/app/helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,8 @@ public static function l($label, $p1 = "", $p2 = "") {
global $_config;

$label = trim($label);
if(strlen($label)==0) return '';

$labels = System::getCache('labels');
if ($labels == null) {
$lang = $_config['common']['lang'];
Expand Down
2 changes: 1 addition & 1 deletion www/app/modules/issue/pages/stat.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function __construct() {

$allow = (strpos($user->modules, 'issue') !== false || $user->rolename == 'admins');
if (!$allow) {
$this->setError(H::l('noaccesstopage'));
$this->setError('noaccesstopage');
App::RedirectHome();
return;
}
Expand Down
14 changes: 7 additions & 7 deletions www/app/modules/note/pages/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -279,26 +279,26 @@ public function OnNodeTitle($form) {
public function ReloadTree() {

$this->tree->removeNodes();
$user_id = System::getUser()->user_id;


$itemlist = Node::find("ispublic = 1 or user_id={$user_id} ", "pid,mpath,title");
$user = System::getUser() ;
$w = "ispublic = 1 or user_id={$user_id->user_id} ";
if($user->rolename=='admins') $w='';
$itemlist = Node::find($w, "pid,mpath,title");
if (count($itemlist) == 0) { //добавляем корень
$root = new Node();
$root->title = "//";
$root->user_id = 0;
$root->ispublic = 1;
$root->save();

$itemlist = Node::find("ispublic = 1 or user_id={$user_id} ", "pid,mpath,title");
$itemlist = Node::find($w, "pid,mpath,title");
}
$first = null;
$nodelist = array();
foreach ($itemlist as $item) {
$node = new \ZCL\BT\TreeNode($item->title, $item->node_id);
// $node->tags = $item->tcnt; //количество топиков в ветке
// $node->tags = '<span class="badge badge-info badge-pill">6</span>'; //количество топиков в ветке
$parentnode = @$nodelist[$item->pid];

$node->icon='fa fa-trash fa-xs';
$this->tree->addNode($node, $parentnode);

$nodelist[$item->node_id] = $node;
Expand Down
8 changes: 4 additions & 4 deletions www/app/modules/ocstore/items.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public function exportOnSubmit($sender) {


if ($data['error'] != "") {
$this->setError($data['error']);
$this->setErrorTop($data['error']);
return;
}
$this->setSuccess('exported_items', count($elist));
Expand Down Expand Up @@ -186,7 +186,7 @@ public function onUpdateQty($sender) {
$data = json_decode($json, true);

if ($data['error'] != "") {
$this->setError($data['error']);
$this->setErrorTop($data['error']);
return;
}
$this->setSuccess('refreshed');
Expand Down Expand Up @@ -218,7 +218,7 @@ public function onUpdatePrice($sender) {
$data = json_decode($json, true);

if ($data['error'] != "") {
$this->setError($data['error']);
$this->setErrorTop($data['error']);
return;
}
$this->setSuccess('refreshed');
Expand All @@ -239,7 +239,7 @@ public function onGetItems($sender) {
$data = json_decode($json, true);

if ($data['error'] != "") {
$this->setError($data['error']);
$this->setErrorTop($data['error']);
return;
}
// $this->setInfo($json);
Expand Down
10 changes: 5 additions & 5 deletions www/app/modules/ocstore/options.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function checkOnClick($sender) {

$data = json_decode($json, true);
if ($data == null) {
$this->setError($json);
$this->setErrorTop($json);
return;
}
if (is_array($data) && count($data) == 0) {
Expand All @@ -70,10 +70,10 @@ public function checkOnClick($sender) {
}

if (is_array($data['error'])) {
$this->setError(implode(' ', $data['error']));
$this->setErrorTop(implode(' ', $data['error']));
} else {
if (strlen($data['error']) > 0) {
$this->setError($data['error']);
$this->setErrorTop($data['error']);
}
}

Expand All @@ -95,7 +95,7 @@ public function checkOnClick($sender) {
$data = json_decode($json, true);

if ($data['error'] != "") {
$this->setError($data['error']);
$this->setErrorTop($data['error']);
} else {

System::getSession()->statuses = $data['statuses'];
Expand All @@ -106,7 +106,7 @@ public function checkOnClick($sender) {
$data = json_decode($json, true);

if ($data['error'] != "") {
$this->setError($data['error']);
$this->setErrorTop($data['error']);
} else {

System::getSession()->cats = $data['cats'];
Expand Down
14 changes: 7 additions & 7 deletions www/app/modules/ocstore/orders.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function filterOnSubmit($sender) {
foreach ($ocorder['_products_'] as $product) {
$code = trim($product['sku']);
if ($code == "") {
$this->setWarn("noarticle_inorder", $product['name'], $ocorder['order_id']);
$this->setWarnTop("noarticle_inorder", $product['name'], $ocorder['order_id']);

}
}
Expand All @@ -103,7 +103,7 @@ public function filterOnSubmit($sender) {

$this->neworderslist->Reload();
} else {
$this->setError($data['error']);
$this->setErrorTop($data['error']);
}
}

Expand Down Expand Up @@ -144,7 +144,7 @@ public function onImport($sender) {
$tovar = Item::getFirst('item_code=' . $code);
if ($tovar == null) {

$this->setWarn("nofoundarticle_inorder", $product['name'], $shoporder->order_id);
$this->setWarnTop("nofoundarticle_inorder", $product['name'], $shoporder->order_id);
continue;
}
$tovar->quantity = $product['quantity'];
Expand Down Expand Up @@ -225,14 +225,14 @@ public function onOutcome($sender) {
$tovar = Item::getFirst('item_code=' . $code);
if ($tovar == null) {

$this->setWarn("nofoundarticle_inorder", $product['name'], $shoporder['order_id']);
$this->setWarnTop("nofoundarticle_inorder", $product['name'], $shoporder['order_id']);
continue;
}
$tovar->quantity = $product['quantity'];

$qty = $tovar->getQuantity($store);
if ($qty < $tovar->quantity) {
$this->setError("nominus", \App\Helper::fqty($qty), $tovar->item_name);
$this->setErrorTop("nominus", \App\Helper::fqty($qty), $tovar->item_name);
return;
}

Expand Down Expand Up @@ -264,7 +264,7 @@ public function onOutcome($sender) {
$tovar = Item::getFirst('item_code=' . $code);
if ($tovar == null) {

$this->setWarn("nofoundarticle_inorder", $product['name'], $shoporder['order_id']);
$this->setWarnTop("nofoundarticle_inorder", $product['name'], $shoporder['order_id']);
continue;
}
$tovar->quantity = $product['quantity'];
Expand Down Expand Up @@ -365,7 +365,7 @@ public function exportOnSubmit($sender) {
$data = json_decode($json, true);

if ($data['error'] != "") {
$this->setError($data['error']);
$this->setErrorTop($data['error']);
return;
}

Expand Down
Loading

0 comments on commit 5d25196

Please sign in to comment.