Skip to content

Commit

Permalink
Merge pull request #342 from leon-mbs/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
leon-mbs authored Jul 29, 2022
2 parents fd140dd + ed1443f commit 3ba508f
Show file tree
Hide file tree
Showing 40 changed files with 2,495 additions and 899 deletions.
93 changes: 46 additions & 47 deletions mysqldb/db.sql

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion mysqldb/initdata.sql
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,4 @@ INSERT INTO `options` (`optname`, `optvalue`) VALUES('printer', 'a:15:{s:7:\"phe
INSERT INTO `options` (`optname`, `optvalue`) VALUES('salary', 'a:4:{s:13:\"codebaseincom\";s:3:\"105\";s:10:\"coderesult\";s:3:\"900\";s:4:\"calc\";s:219:\"v200 = v105\r\n//податки\r\nv220 = v200 * 0.18\r\nv300 = v200 * 0.22\r\n//всього утримано\r\nv600 =v200 - v220- v300\r\n//на руки\r\nv900 =v200 - v600-v850\r\n\r\n\r\n//приклад\r\nif(invalid){\r\n \r\n} \";s:11:\"codeadvance\";s:3:\"850\";}');
INSERT INTO `options` (`optname`, `optvalue`) VALUES('shop', 'a:19:{s:7:\"defcust\";s:1:\"1\";s:11:\"defcustname\";s:29:\"Леонид Мартынюк\";s:9:\"defbranch\";N;s:9:\"ordertype\";s:1:\"2\";s:12:\"defpricetype\";s:6:\"price1\";s:5:\"email\";s:15:\"[email protected]\";s:8:\"shopname\";s:18:\"Наш магаз7\";s:12:\"currencyname\";s:6:\"грн\";s:8:\"uselogin\";i:0;s:9:\"usefilter\";i:0;s:13:\"createnewcust\";i:0;s:11:\"usefeedback\";i:0;s:11:\"usemainpage\";i:0;s:7:\"aboutus\";s:16:\"PHA+PGJyPjwvcD4=\";s:7:\"contact\";s:0:\"\";s:8:\"delivery\";s:0:\"\";s:4:\"news\";s:0:\"\";s:5:\"pages\";a:2:{s:4:\"news\";O:12:\"App\\DataItem\":2:{s:2:\"id\";N;s:9:\"\0*\0fields\";a:4:{s:4:\"link\";s:4:\"news\";s:5:\"title\";s:11:\"kkkrrrrrrrr\";s:5:\"order\";s:1:\"2\";s:4:\"text\";s:24:\"PHA+ZWVlZWVlZWVlPC9wPg==\";}}s:8:\"about_us\";O:12:\"App\\DataItem\":2:{s:2:\"id\";N;s:9:\"\0*\0fields\";a:4:{s:4:\"link\";s:8:\"about_us\";s:5:\"title\";s:9:\"О нас\";s:5:\"order\";s:1:\"3\";s:4:\"text\";s:32:\"PHA+PGI+0J4g0L3QsNGBPC9iPjwvcD4=\";}}}s:5:\"phone\";s:0:\"\";}');
INSERT INTO `options` (`optname`, `optvalue`) VALUES('val', 'a:2:{s:7:\"vallist\";a:2:{i:1642675955;O:12:\"App\\DataItem\":2:{s:2:\"id\";i:1642675955;s:9:\"\0*\0fields\";a:3:{s:4:\"code\";s:3:\"USD\";s:4:\"name\";s:10:\"Долар\";s:4:\"rate\";s:2:\"28\";}}i:1642676126;O:12:\"App\\DataItem\":2:{s:2:\"id\";i:1642676126;s:9:\"\0*\0fields\";a:3:{s:4:\"code\";s:4:\"EURO\";s:4:\"name\";s:8:\"Євро\";s:4:\"rate\";s:2:\"33\";}}}s:8:\"valprice\";i:0;}');
INSERT INTO options (optname,optvalue) values('version','6.3.0');
INSERT INTO options (optname,optvalue) values('version','6.3.3');
2 changes: 0 additions & 2 deletions mysqldb/update/archive/temp.sql
Original file line number Diff line number Diff line change
@@ -1,2 +0,0 @@
update metadata set menugroup ='Продажі' where meta_name='ItemOrder'

25 changes: 25 additions & 0 deletions mysqldb/update/update630to633.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
update metadata set menugroup ='Ïðîäàæ³' where meta_name='ItemOrder';

DROP VIEW cust_acc_view ;

CREATE VIEW cust_acc_view
AS
SELECT
COALESCE(SUM((CASE WHEN (d.meta_name IN ('InvoiceCust', 'GoodsReceipt', 'IncomeService', 'OutcomeMoney')) THEN d.payed WHEN ((d.meta_name = 'OutcomeMoney') AND
(d.content LIKE '%<detail>2</detail>%')) THEN d.payed WHEN (d.meta_name = 'RetCustIssue') THEN d.payamount ELSE 0 END)), 0) AS s_passive,
COALESCE(SUM((CASE WHEN (d.meta_name IN ('IncomeService', 'GoodsReceipt')) THEN d.payamount WHEN ((d.meta_name = 'IncomeMoney') AND
(d.content LIKE '%<detail>2</detail>%')) THEN d.payed WHEN (d.meta_name = 'RetCustIssue') THEN d.payed ELSE 0 END)), 0) AS s_active,
COALESCE(SUM((CASE WHEN (d.meta_name IN ('GoodsIssue', 'TTN', 'PosCheck', 'OrderFood', 'ServiceAct')) THEN d.payamount WHEN ((d.meta_name = 'OutcomeMoney') AND
(d.content LIKE '%<detail>1</detail>%')) THEN d.payed WHEN (d.meta_name = 'ReturnIssue') THEN d.payed ELSE 0 END)), 0) AS b_passive,
COALESCE(SUM((CASE WHEN (d.meta_name IN ('GoodsIssue', 'Order', 'PosCheck', 'OrderFood', 'Invoice', 'ServiceAct')) THEN d.payed WHEN ((d.meta_name = 'IncomeMoney') AND
(d.content LIKE '%<detail>1</detail>%')) THEN d.payed WHEN (d.meta_name = 'ReturnIssue') THEN d.payamount ELSE 0 END)), 0) AS b_active,
d.customer_id AS customer_id
FROM documents_view d
WHERE ((d.state NOT IN (0, 1, 2, 3, 15, 8, 17))
AND (d.customer_id > 0))
GROUP BY d.customer_id;


delete from options where optname='version' ;
insert into options (optname,optvalue) values('version','6.3.3');

8 changes: 4 additions & 4 deletions pgsqldb/db.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1523,16 +1523,16 @@ AS
SELECT
COALESCE(SUM((CASE WHEN (d.meta_name IN ('InvoiceCust', 'GoodsReceipt', 'IncomeService', 'OutcomeMoney')) THEN d.payed WHEN ((d.meta_name = 'OutcomeMoney') AND
(d.content LIKE '%<detail>2</detail>%')) THEN d.payed WHEN (d.meta_name = 'RetCustIssue') THEN d.payamount ELSE 0 END)), 0) AS s_passive,
COALESCE(SUM((CASE WHEN (d.meta_name IN ('GoodsReceipt') ) THEN d.payamount WHEN ((d.meta_name = 'IncomeMoney') AND
COALESCE(SUM((CASE WHEN (d.meta_name IN ('IncomeService', 'GoodsReceipt')) THEN d.payamount WHEN ((d.meta_name = 'IncomeMoney') AND
(d.content LIKE '%<detail>2</detail>%')) THEN d.payed WHEN (d.meta_name = 'RetCustIssue') THEN d.payed ELSE 0 END)), 0) AS s_active,
COALESCE(SUM((CASE WHEN (d.meta_name IN ('GoodsIssue', 'TTN', 'PosCheck', 'OrderFood')) THEN d.payamount WHEN ((d.meta_name = 'OutcomeMoney') AND
COALESCE(SUM((CASE WHEN (d.meta_name IN ('GoodsIssue', 'TTN', 'PosCheck', 'OrderFood', 'ServiceAct')) THEN d.payamount WHEN ((d.meta_name = 'OutcomeMoney') AND
(d.content LIKE '%<detail>1</detail>%')) THEN d.payed WHEN (d.meta_name = 'ReturnIssue') THEN d.payed ELSE 0 END)), 0) AS b_passive,
COALESCE(SUM((CASE WHEN (d.meta_name IN ('GoodsIssue', 'Order', 'PosCheck', 'OrderFood', 'Invoice', 'ServiceAct')) THEN d.payed WHEN ((d.meta_name = 'IncomeMoney') AND
(d.content LIKE '%<detail>1</detail>%')) THEN d.payed WHEN (d.meta_name = 'ReturnIssue') THEN d.payamount ELSE 0 END)), 0) AS b_active,
d.customer_id AS customer_id
FROM documents_view d
WHERE ((d.state NOT IN (0, 1, 2, 3, 15, 8))
WHERE ((d.state NOT IN (0, 1, 2, 3, 15, 8, 17))
AND (d.customer_id > 0))
GROUP BY d.customer_id;
GROUP BY d.customer_id;


3 changes: 2 additions & 1 deletion pgsqldb/initdata.sql
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ INSERT INTO "options" ("optname", "optvalue") VALUES('printer', 'a:15:{s:7:\"phe
INSERT INTO "options" ("optname", "optvalue") VALUES('salary', 'a:4:{s:13:\"codebaseincom\";s:3:\"105\";s:10:\"coderesult\";s:3:\"900\";s:4:\"calc\";s:219:\"v200 = v105\r\n//податки\r\nv220 = v200 * 0.18\r\nv300 = v200 * 0.22\r\n//всього утримано\r\nv600 =v200 - v220- v300\r\n//на руки\r\nv900 =v200 - v600-v850\r\n\r\n\r\n//приклад\r\nif(invalid){\r\n \r\n} \";s:11:\"codeadvance\";s:3:\"850\";}');
INSERT INTO "options" ("optname", "optvalue") VALUES('shop', 'a:19:{s:7:\"defcust\";s:1:\"1\";s:11:\"defcustname\";s:29:\"Леонид Мартынюк\";s:9:\"defbranch\";N;s:9:\"ordertype\";s:1:\"2\";s:12:\"defpricetype\";s:6:\"price1\";s:5:\"email\";s:15:\"[email protected]\";s:8:\"shopname\";s:18:\"Наш магаз7\";s:12:\"currencyname\";s:6:\"грн\";s:8:\"uselogin\";i:0;s:9:\"usefilter\";i:0;s:13:\"createnewcust\";i:0;s:11:\"usefeedback\";i:0;s:11:\"usemainpage\";i:0;s:7:\"aboutus\";s:16:\"PHA+PGJyPjwvcD4=\";s:7:\"contact\";s:0:\"\";s:8:\"delivery\";s:0:\"\";s:4:\"news\";s:0:\"\";s:5:\"pages\";a:2:{s:4:\"news\";O:12:\"App\\DataItem\":2:{s:2:\"id\";N;s:9:\"\0*\0fields\";a:4:{s:4:\"link\";s:4:\"news\";s:5:\"title\";s:11:\"kkkrrrrrrrr\";s:5:\"order\";s:1:\"2\";s:4:\"text\";s:24:\"PHA+ZWVlZWVlZWVlPC9wPg==\";}}s:8:\"about_us\";O:12:\"App\\DataItem\":2:{s:2:\"id\";N;s:9:\"\0*\0fields\";a:4:{s:4:\"link\";s:8:\"about_us\";s:5:\"title\";s:9:\"О нас\";s:5:\"order\";s:1:\"3\";s:4:\"text\";s:32:\"PHA+PGI+0J4g0L3QsNGBPC9iPjwvcD4=\";}}}s:5:\"phone\";s:0:\"\";}');
INSERT INTO "options" ("optname", "optvalue") VALUES('val', 'a:2:{s:7:\"vallist\";a:2:{i:1642675955;O:12:\"App\\DataItem\":2:{s:2:\"id\";i:1642675955;s:9:\"\0*\0fields\";a:3:{s:4:\"code\";s:3:\"USD\";s:4:\"name\";s:10:\"Долар\";s:4:\"rate\";s:2:\"28\";}}i:1642676126;O:12:\"App\\DataItem\":2:{s:2:\"id\";i:1642676126;s:9:\"\0*\0fields\";a:3:{s:4:\"code\";s:4:\"EURO\";s:4:\"name\";s:8:\"Євро\";s:4:\"rate\";s:2:\"33\";}}}s:8:\"valprice\";i:0;}');

INSERT INTO "options" ("optname", "optvalue") VALUES('version', '6.3.3');



INSERT INTO "metadata" ( "meta_type", "description", "meta_name", "menugroup", "disabled") VALUES( 4, 'Склади', 'StoreList', 'Товари', 0);
Expand Down
25 changes: 25 additions & 0 deletions pgsqldb/update/update630to633.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
update metadata set menugroup ='Ïðîäàæ³' where meta_name='ItemOrder';

DROP VIEW cust_acc_view ;

CREATE VIEW cust_acc_view
AS
SELECT
COALESCE(SUM((CASE WHEN (d.meta_name IN ('InvoiceCust', 'GoodsReceipt', 'IncomeService', 'OutcomeMoney')) THEN d.payed WHEN ((d.meta_name = 'OutcomeMoney') AND
(d.content LIKE '%<detail>2</detail>%')) THEN d.payed WHEN (d.meta_name = 'RetCustIssue') THEN d.payamount ELSE 0 END)), 0) AS s_passive,
COALESCE(SUM((CASE WHEN (d.meta_name IN ('IncomeService', 'GoodsReceipt')) THEN d.payamount WHEN ((d.meta_name = 'IncomeMoney') AND
(d.content LIKE '%<detail>2</detail>%')) THEN d.payed WHEN (d.meta_name = 'RetCustIssue') THEN d.payed ELSE 0 END)), 0) AS s_active,
COALESCE(SUM((CASE WHEN (d.meta_name IN ('GoodsIssue', 'TTN', 'PosCheck', 'OrderFood', 'ServiceAct')) THEN d.payamount WHEN ((d.meta_name = 'OutcomeMoney') AND
(d.content LIKE '%<detail>1</detail>%')) THEN d.payed WHEN (d.meta_name = 'ReturnIssue') THEN d.payed ELSE 0 END)), 0) AS b_passive,
COALESCE(SUM((CASE WHEN (d.meta_name IN ('GoodsIssue', 'Order', 'PosCheck', 'OrderFood', 'Invoice', 'ServiceAct')) THEN d.payed WHEN ((d.meta_name = 'IncomeMoney') AND
(d.content LIKE '%<detail>1</detail>%')) THEN d.payed WHEN (d.meta_name = 'ReturnIssue') THEN d.payamount ELSE 0 END)), 0) AS b_active,
d.customer_id AS customer_id
FROM documents_view d
WHERE ((d.state NOT IN (0, 1, 2, 3, 15, 8, 17))
AND (d.customer_id > 0))
GROUP BY d.customer_id;


delete from options where optname='version' ;
insert into options (optname,optvalue) values('version','6.3.3');

113 changes: 0 additions & 113 deletions www/app/api/base/restful.php

This file was deleted.

2 changes: 1 addition & 1 deletion www/app/api/common.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace App\API;

class common extends \App\API\Base\JsonRPC
class common extends JsonRPC
{


Expand Down
2 changes: 1 addition & 1 deletion www/app/api/customers.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use \App\Entity\Customer;
use \App\Helper as H;

class customers extends \App\API\Base\JsonRPC
class customers extends JsonRPC
{

//список контрагентов
Expand Down
2 changes: 1 addition & 1 deletion www/app/api/docs.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use \App\Entity\Item;
use \App\Helper as H;

class docs extends \App\API\Base\JsonRPC
class docs extends JsonRPC
{

//список статусов
Expand Down
2 changes: 1 addition & 1 deletion www/app/api/items.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use \App\Entity\Item;
use \App\Helper as H;

class items extends \App\API\Base\JsonRPC
class items extends JsonRPC
{

// список категорий ТМЦ
Expand Down
2 changes: 1 addition & 1 deletion www/app/api/base/jsonrpc.php → www/app/api/jsonrpc.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace App\API\Base;
namespace App\API;

/**
* Base class for Json RPC
Expand Down
20 changes: 0 additions & 20 deletions www/app/api/testclass.php

This file was deleted.

2 changes: 1 addition & 1 deletion www/app/api/testjsonrpc.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Пример для использования Json RPC
* пример вызова /api/TestJsonRPC
*/
class TestJsonRPC extends \App\API\Base\JsonRPC
class TestJsonRPC extends JsonRPC
{

//{"jsonrpc": "2.0", "method": "Hello", "params": {"p1": "12345",$p3:"2"}, "id": 1}
Expand Down
17 changes: 0 additions & 17 deletions www/app/api/testrest.php

This file was deleted.

59 changes: 9 additions & 50 deletions www/app/application.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,22 +58,7 @@ public function Route($uri) {

$class = $api[1];

if ($class == 'echo') { //для теста /api/echo/параметр
echo $api[2];
die;
}

/*
if ($_SERVER["REQUEST_METHOD"] == "OPTIONS") {
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Credentials: true');
header("Access-Control-Allow-Methods: GET, POST, OPTIONS");
header('Access-Control-Allow-Headers: Content-Type, Authorization, X-Requested-With');
http_response_code(200);
die;
}
*/



try {
Expand All @@ -86,46 +71,20 @@ public function Route($uri) {
require_once($file);

$class = "\\App\\API\\" . $class;
$method = $api[2];
// $method = $api[2];

$page = new $class;

// RESTFul
if ($page instanceof \App\API\Base\RestFul) {
$_params = array_slice($api, 3);
$i=0;
if( is_array($_params) ) {
foreach($_params as $v) {
$params[$i++]=$v;
}
}
if( is_array($_REQUEST) ) {
foreach($_REQUEST as $k=>$v) {
$params[$k]=$v;
}
}

if ($_SERVER["REQUEST_METHOD"] == "POST") {
$post = file_get_contents('php://input');
$page->{$method}($params,$post);
die;
};

$page->{$method}($params);
die;
}
// JSON-RPC
if ($page instanceof \App\API\Base\JsonRPC) {


if ($page instanceof \App\API\JsonRPC) {
$page->Execute();
die;
}

//для произвольной страницы
$params = array_slice($api, 3);
if (strlen($api[2]) > 0) {
call_user_func_array(array($page, $api[2]), $params);

} else {
$this->headers(403);
}
die;

} catch(\Throwable $e) {
global $logger;
$logger->error($e->getMessage());
Expand Down
2 changes: 1 addition & 1 deletion www/app/pages/register/paybaylist.php
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ public function updateDetDocs() {

$this->_blist = array();

$list = \App\Entity\Doc\Document::find(" {$br} customer_id= {$this->_cust->customer_id} and state NOT IN (0, 1, 2, 3, 15, 8) " , " document_id asc",-1,-1,"*, COALESCE( ((CASE WHEN (meta_name IN ('GoodsIssue', 'TTN', 'PosCheck', 'OrderFood')) THEN payamount WHEN ((meta_name = 'OutcomeMoney') AND (content LIKE '%<detail>1</detail>%')) THEN payed WHEN (meta_name = 'ReturnIssue') THEN payed ELSE 0 END)), 0) AS b_passive, COALESCE( ((CASE WHEN (meta_name IN ('GoodsIssue', 'Order', 'PosCheck', 'OrderFood', 'Invoice', 'ServiceAct')) THEN payed WHEN ((meta_name = 'IncomeMoney') AND (content LIKE '%<detail>1</detail>%')) THEN payed WHEN (meta_name = 'ReturnIssue') THEN payamount ELSE 0 END)), 0) AS b_active");
$list = \App\Entity\Doc\Document::find(" {$br} customer_id= {$this->_cust->customer_id} and state NOT IN (0, 1, 2, 3, 15, 8, 17) " , " document_id asc",-1,-1,"*, COALESCE( ((CASE WHEN (meta_name IN ('GoodsIssue', 'TTN', 'PosCheck', 'OrderFood', 'ServiceAct')) THEN payamount WHEN ((meta_name = 'OutcomeMoney') AND (content LIKE '%<detail>1</detail>%')) THEN payed WHEN (meta_name = 'ReturnIssue') THEN payed ELSE 0 END)), 0) AS b_passive, COALESCE( ((CASE WHEN (meta_name IN ('GoodsIssue', 'Order', 'PosCheck', 'OrderFood', 'Invoice', 'ServiceAct')) THEN payed WHEN ((meta_name = 'IncomeMoney') AND (content LIKE '%<detail>1</detail>%')) THEN payed WHEN (meta_name = 'ReturnIssue') THEN payamount ELSE 0 END)), 0) AS b_active");

$bal=0;

Expand Down
Loading

0 comments on commit 3ba508f

Please sign in to comment.