Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #135

Merged
merged 11 commits into from
Mar 4, 2021
Merged

Dev #135

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ CHANGELOG

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

### v4.8.4 (2021-03-01)
* Интеграция с Новой Почтой (Украина)
* Настройка подписки на события и уведомлений
* Интеграция с сервисами рассылок смс.

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


### v4.8.2 (2021-01-10)
* Исправление ошибок
Expand Down
11 changes: 7 additions & 4 deletions db/initdata.sql
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `men
INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(47, 3, 'Журнал платежей', 'PayList', 'Касса и платежи', 0);
INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(48, 2, 'Движение по денежным счетам', 'PayActivity', 'Платежи', 0);
INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(64, 1, 'Списание ТМЦ', 'OutcomeItem', 'Склад', 0);
INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(50, 1, 'Приходный ордер', 'IncomeMoney', 'Платежи', 0);
INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(51, 1, 'Расходный ордер', 'OutcomeMoney', 'Платежи', 0);
INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(50, 1, 'Приходный ордер', 'IncomeMoney', 'Касса и платежи', 0);
INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(51, 1, 'Расходный ордер', 'OutcomeMoney', 'Касса и платежи', 0);
INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(53, 2, 'Финансовые результаты', 'PayBalance', '', 0);
INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(57, 1, 'Инвентаризация', 'Inventory', 'Склад', 0);
INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(58, 1, 'Счет входящий', 'InvoiceCust', 'Закупки', 0);
Expand All @@ -72,14 +72,17 @@ INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `men
INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(75, 5, 'Экспорт', 'Export', '', 0);
INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(67, 5, 'АРМ кассира', 'ARMPos', '', 0);
INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(71, 3, 'Товары на складе', 'ItemList', 'Склад', 0);
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(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_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(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);
INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(83, 2, 'Рабочее время', 'Timestat', 'Зарплата', 0);
INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(84, 1, 'Товарно-транспортная накладная', 'TTN', 'Продажи', 0);
INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(85, 2, 'Неликвидные товары', 'NoLiq', 'Склад', 0);
INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(86, 3, 'Расчеты с поставщиками', 'PaySelList', 'Касса и платежи', 0);
INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(87, 3, 'Расчеты с покупателями', 'PayBayList', 'Касса и платежи', 0);
INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(88, 1, 'Перемещение денег', 'MoveMoney', 'Касса и платежи', 0);



15 changes: 8 additions & 7 deletions db/initdata_ua.sql
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `men
INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(44, 1, 'Перекомплектація ТМЦ', 'TransItem', 'Склад', 0);
INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(46, 4, 'Каси, рахунки', 'MFList', '', 0);
INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(47, 3, 'Журнал платежів', 'PayList', 'Каса та платежі', 0);
INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(48, 2, 'Рух по грошовим рахунках', 'PayActivity', 'Платежі', 0);
INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(50, 1, 'Прибутковий ордер', 'IncomeMoney', 'Платежі', 0);
INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(51, 1, 'Видатковий ордер', 'OutcomeMoney', 'Платежі', 0);
INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(53, 2, 'Платіжний баланс', 'PayBalance', 'Платежі', 0);
INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(48, 2, 'Рух по грошовим рахунках', 'PayActivity', 'Каса та платежі', 0);
INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(50, 1, 'Прибутковий ордер', 'IncomeMoney', 'Каса та платежі', 0);
INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(51, 1, 'Видатковий ордер', 'OutcomeMoney', 'Каса та платежі', 0);
INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(53, 2, 'Платіжний баланс', 'PayBalance', 'Каса та платежі', 0);
INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(57, 1, 'Інвентаризація', 'Inventory', 'Склад', 0);
INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(58, 1, 'Рахунок, вхідний', 'InvoiceCust', 'Закупки', 0);
INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(59, 1, 'Рахунок-фактура', 'Invoice', 'Продажі', 0);
Expand All @@ -72,13 +72,14 @@ INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `men
INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(69, 3, 'Роботи, послуги', 'SerList', '', 0);
INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(71, 3, 'Товари на складі', 'ItemList', 'Склад', 0);
INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(75, 5, 'Експорт', 'Export', '', 0);
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_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(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_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(79, 4, 'Контракти', 'ContractList', '', 0);
INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(80, 1, 'Перемiщення ТМЦ', 'MoveItem', 'Склад', 0);
INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(81, 2, 'Робочий час', 'Timestat', '', 0);
INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(84, 1, 'Товарно-транспортна накладна', 'TTN', 'Продажі', 0);
INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(85, 2, 'Нелiквiднi товари', 'NoLiq', 'Склад', 0);
INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(86, 3, 'Розрахунки с поставщиками', 'PaySelList', 'Каса та платежі', 0);
INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(87, 3, 'Розрахунки с покупателями', 'PayBayList', 'Каса та платежі', 0);
INSERT INTO `metadata` (`meta_id`, `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES(88, 1, 'Перемiщення грошей', 'MoveMoney', 'Каса та платежі', 0);
30 changes: 30 additions & 0 deletions db/temp.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*


CREATE TABLE `empacc` (
`ea_id` int(11) NOT NULL AUTO_INCREMENT,
`emp_id` int(11) NOT NULL,
`document_id` int(11) DEFAULT NULL,
`optype` int(11) DEFAULT NULL,
//`createdon` date NOT NULL,
`notes` varchar(255) DEFAULT NULL,
`amount` decimal(10,2) NOT NULL,

PRIMARY KEY (`ea_id`),
KEY `emp_id` (`emp_id`)
) engine=InnoDB DEFAULT CHARSET=utf8;



CREATE TABLE `prodproc` (
`pp_id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) DEFAULT NULL,
`detail` LONGTEXT DEFAULT NULL,
PRIMARY KEY (`pp_id`)

) engine=InnoDB DEFAULT CHARSET=utf8;




*/
35 changes: 4 additions & 31 deletions db/update483to484.sql
Original file line number Diff line number Diff line change
@@ -1,43 +1,16 @@

CREATE TABLE `subscribes` (
`sub_id` int(11) NOT NULL AUTO_INCREMENT,
`sub_type` int(11) DEFAULT NULL,

`reciever_type` int(11) DEFAULT NULL,

`msg_type` int(11) DEFAULT NULL,
`detail` LONGTEXT DEFAULT NULL,
`detail` TEXT DEFAULT NULL,
`msgtext` TEXT DEFAULT NULL,
`disabled` int(1) DEFAULT 0,
PRIMARY KEY (`sub_id`)

) engine=InnoDB DEFAULT CHARSET=utf8;

/*

CREATE TABLE `empacc` (
`ea_id` int(11) NOT NULL AUTO_INCREMENT,
`emp_id` int(11) NOT NULL,
`document_id` int(11) DEFAULT NULL,
`optype` int(11) DEFAULT NULL,
//`createdon` date NOT NULL,
`notes` varchar(255) DEFAULT NULL,
`amount` decimal(10,2) NOT NULL,

PRIMARY KEY (`ea_id`),
KEY `emp_id` (`emp_id`)
) engine=InnoDB DEFAULT CHARSET=utf8;



CREATE TABLE `prodproc` (
`pp_id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) DEFAULT NULL,
`detail` LONGTEXT DEFAULT NULL,
PRIMARY KEY (`pp_id`)

) engine=InnoDB DEFAULT CHARSET=utf8;




*/
INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 1, 'Перемещение денег', 'MoveMoney', 'Платежи', 0);

9 changes: 8 additions & 1 deletion www/app/calendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,14 @@ class Calendar extends \Zippy\Html\HtmlComponent implements \Zippy\Interfaces\Re

private $event = null;
private $data = array();
private $view = 'month';

public function __construct($id,$view='month') {
parent::__construct($id);
$this->view = $view;
}


public final function RenderImpl() {
global $_config;
$id = $this->getAttribute('id');
Expand Down Expand Up @@ -36,7 +43,7 @@ public final function RenderImpl() {
center: 'title',
right: ' prev,next'
},
defaultView: 'month',
defaultView: '{$this->view}',
eventTextColor:'white',
minTime: '08:00:00',
maxTime: '20:00:00',
Expand Down
3 changes: 2 additions & 1 deletion www/app/entity/contract.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,14 @@ public function getDolg() {


$where = " customer_id={$this->customer_id} and content like '%<contract_id>{$this->contract_id}</contract_id>%' ";

if($this->ctype==1){
$_docs = " and ( meta_name in('GoodsIssue','Invoice','RetCustIssue','PosCheck','ServiceAct','Order') or (meta_name='IncomeMoney' and content like '%<detail>1</detail>%' ) or (meta_name='OutcomeMoney' and content like '%<detail>2</detail>%' )) ";

$sql .= "
select sum((case when meta_name='OutcomeMoney' then (payed - payamount ) else (payamount - payed) end) ) as sam
from `documents_view`
where {$where} and (payamount >0 or payed >0) {$_docs} and state not in (1,2,3,17,8) and payamount <> payed
where {$where} 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 ))

";
} else
Expand Down
8 changes: 7 additions & 1 deletion www/app/entity/customer.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Customer extends \ZCL\DB\Entity

const STATUS_ACTUAL = 0; //актуальный
const STATUS_DISABLED = 1; //не используется
const STATUS_WAIT = 2; //потенциальный
// const STATUS_WAIT = 2; //потенциальный


const TYPE_BAYER = 1; //покупатель
Expand All @@ -37,6 +37,9 @@ protected function beforeSave() {
$this->detail .= "<shopcust_id>{$this->shopcust_id}</shopcust_id>";
$this->detail .= "<isholding>{$this->isholding}</isholding>";
$this->detail .= "<holding>{$this->holding}</holding>";
$this->detail .= "<viber>{$this->viber}</viber>";
$this->detail .= "<created>{$this->created}</created>";
$this->detail .= "<user_id>{$this->user_id}</user_id>";

$this->detail .= "<holding_name><![CDATA[{$this->holding_name}]]></holding_name>";
$this->detail .= "<address><![CDATA[{$this->address}]]></address>";
Expand All @@ -56,10 +59,13 @@ protected function afterLoad() {
$this->jurid = (int)($xml->jurid[0]);
$this->shopcust_id = (int)($xml->shopcust_id[0]);
$this->isholding = (int)($xml->isholding[0]);
$this->user_id = (int)($xml->user_id[0]);
$this->created = (int)($xml->created[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]);
$this->viber = (string)($xml->viber[0]);

parent::afterLoad();
}
Expand Down
16 changes: 11 additions & 5 deletions www/app/entity/doc/document.php
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ protected function Cancel() {
$conn->Execute("delete from entrylist where document_id =" . $this->document_id);

//удаляем освободившиеся стоки
$conn->Execute("delete from store_stock where stock_id not in (select coalesce(stock_id,0) from entrylist) ");
$conn->Execute("delete from store_stock where stock_id not in (select stock_id from entrylist) ");

//отменяем оплаты
$conn->Execute("delete from paylist where document_id = " . $this->document_id);
Expand Down Expand Up @@ -361,15 +361,21 @@ public function updateStatus($state) {

if ($oldstate != $state) {
$doc = $this->cast();
$doc->onState($oldstate, $state);
\App\Entity\Subscribe::onDocumentState($doc->meta_name,$state) ;
$doc->onState( $state);
\App\Entity\Subscribe::onDocumentState($doc->document_id,$state) ;
}

return true;
}

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

/**
* обработчик изменения статусов
* переопределяется в дочерних документах
*
* @param mixed $state новый статус
*/
protected function onState( $state) {


}
Expand Down
46 changes: 46 additions & 0 deletions www/app/entity/doc/movemoney.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php

namespace App\Entity\Doc;

use App\Entity\Pay;
use App\Helper as H;

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

public function Execute() {

Pay::addPayment($this->document_id, $this->document_date, 0 - $this->amount, $this->headerdata['paymentfrom'], 0, $this->notes);
Pay::addPayment($this->document_id, $this->document_date, $this->amount, $this->headerdata['paymentto'], 0, $this->notes);


return true;
}

public function generateReport() {


$header = array(
'amount' => H::fa($this->amount),
'date' => H::fd($this->document_date),
"notes" => $this->notes,
"from" => $this->headerdata["paymentfromname"],
"to" => $this->headerdata["paymenttoname"],
"document_number" => $this->document_number
);
$report = new \App\Report('doc/movemoney.tpl');

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

return $html;
}

protected function getNumberTemplate() {
return 'ПМ-000000';
}

}
Loading