From ab14c6a35f7c03b580ccaca84f0e04b63ad7cbf8 Mon Sep 17 00:00:00 2001 From: "HOME\\leonm" Date: Fri, 11 Dec 2020 02:09:10 +0200 Subject: [PATCH 01/11] fix --- www/app/pages/register/doclist.php | 3 - www/app/pages/register/gilist.php | 3 - www/app/pages/register/grlist.php | 3 - www/app/pages/register/ordercustlist.php | 3 - www/app/pages/register/orderlist.php | 3 - www/app/pages/report/abc.php | 5 +- www/composer.json | 2 +- www/composer.lock | 181 ++++++----------------- www/config/config.ini | 2 +- 9 files changed, 45 insertions(+), 160 deletions(-) diff --git a/www/app/pages/register/doclist.php b/www/app/pages/register/doclist.php index 4802e0510..e4dbfaed5 100644 --- a/www/app/pages/register/doclist.php +++ b/www/app/pages/register/doclist.php @@ -459,9 +459,6 @@ public function getItemCount() { public function getItems($start, $count, $sortfield = null, $asc = null) { $docs = Document::find($this->getWhere(), $sortfield . " " . $asc, $count, $start); - //$l = Traversable::from($docs); - //$l = $l->where(function ($doc) {return $doc->document_id == 169; }) ; - //$l = $l->select(function ($doc) { return $doc; })->asArray() ; return $docs; } diff --git a/www/app/pages/register/gilist.php b/www/app/pages/register/gilist.php index e9e951c30..211f8517d 100644 --- a/www/app/pages/register/gilist.php +++ b/www/app/pages/register/gilist.php @@ -351,9 +351,6 @@ public function getItemCount() { public function getItems($start, $count, $sortfield = null, $asc = null) { $docs = Document::find($this->getWhere(), "document_date desc,document_id desc", $count, $start); - //$l = Traversable::from($docs); - //$l = $l->where(function ($doc) {return $doc->document_id == 169; }) ; - //$l = $l->select(function ($doc) { return $doc; })->asArray() ; return $docs; } diff --git a/www/app/pages/register/grlist.php b/www/app/pages/register/grlist.php index 7e58c43fe..4e8ee2675 100644 --- a/www/app/pages/register/grlist.php +++ b/www/app/pages/register/grlist.php @@ -257,9 +257,6 @@ public function getItemCount() { public function getItems($start, $count, $sortfield = null, $asc = null) { $docs = Document::find($this->getWhere(), "document_date desc,document_id desc", $count, $start); - //$l = Traversable::from($docs); - //$l = $l->where(function ($doc) {return $doc->document_id == 169; }) ; - //$l = $l->select(function ($doc) { return $doc; })->asArray() ; return $docs; } diff --git a/www/app/pages/register/ordercustlist.php b/www/app/pages/register/ordercustlist.php index c2d0c552d..39295a4d6 100644 --- a/www/app/pages/register/ordercustlist.php +++ b/www/app/pages/register/ordercustlist.php @@ -328,9 +328,6 @@ public function getItemCount() { public function getItems($start, $count, $sortfield = null, $asc = null) { $docs = Document::find($this->getWhere(), "document_date desc,document_id desc", $count, $start); - //$l = Traversable::from($docs); - //$l = $l->where(function ($doc) {return $doc->document_id == 169; }) ; - //$l = $l->select(function ($doc) { return $doc; })->asArray() ; return $docs; } diff --git a/www/app/pages/register/orderlist.php b/www/app/pages/register/orderlist.php index 836815c24..c07437cc5 100644 --- a/www/app/pages/register/orderlist.php +++ b/www/app/pages/register/orderlist.php @@ -321,9 +321,6 @@ public function getItemCount() { public function getItems($start, $count, $sortfield = null, $asc = null) { $docs = Document::find($this->getWhere(), "document_date desc,document_id desc", $count, $start); - //$l = Traversable::from($docs); - //$l = $l->where(function ($doc) {return $doc->document_id == 169; }) ; - //$l = $l->select(function ($doc) { return $doc; })->asArray() ; return $docs; } diff --git a/www/app/pages/report/abc.php b/www/app/pages/report/abc.php index 4b6215d0f..c517ec202 100644 --- a/www/app/pages/report/abc.php +++ b/www/app/pages/report/abc.php @@ -273,10 +273,7 @@ private function find5() { //выполняет расчет АВС private function calc($detail) { - // $detail = \Pinq\Traversable::from($detail) - // ->orderByAscending(function($row){return $row['value'];}) - // ->select(function($row){ return array('name'=>$row['name'],'value'=>$row['value']) ;})->asArray(); - + $sum = 0; $_detail = array(); diff --git a/www/composer.json b/www/composer.json index fe4eb4ddb..f5eea1b41 100644 --- a/www/composer.json +++ b/www/composer.json @@ -5,7 +5,7 @@ "phpmailer/phpmailer": "~6.1", "monolog/monolog": "1.25.4", "nesbot/carbon": "2.32.2", - "timetoogo/pinq": "3.4.1", + "dompdf/dompdf": "v0.8.5", "firebase/php-jwt": "v5.0.0", diff --git a/www/composer.lock b/www/composer.lock index 69efb76a0..ad851d177 100644 --- a/www/composer.lock +++ b/www/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "61c11148616c469cf1d3f238051784b1", + "content-hash": "4ad1f45340e40604cfeb1d1c762d5ec1", "packages": [ { "name": "adodb/adodb-php", @@ -652,61 +652,6 @@ ], "time": "2020-03-31T13:43:19+00:00" }, - { - "name": "nikic/php-parser", - "version": "v3.1.5", - "source": { - "type": "git", - "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "bb87e28e7d7b8d9a7fda231d37457c9210faf6ce" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/bb87e28e7d7b8d9a7fda231d37457c9210faf6ce", - "reference": "bb87e28e7d7b8d9a7fda231d37457c9210faf6ce", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "php": ">=5.5" - }, - "require-dev": { - "phpunit/phpunit": "~4.0|~5.0" - }, - "bin": [ - "bin/php-parse" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "psr-4": { - "PhpParser\\": "lib/PhpParser" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Nikita Popov" - } - ], - "description": "A PHP parser written in PHP", - "keywords": [ - "parser", - "php" - ], - "support": { - "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v3.1.5" - }, - "time": "2018-02-28T20:30:58+00:00" - }, { "name": "phenx/php-font-lib", "version": "0.5.2", @@ -794,16 +739,16 @@ }, { "name": "phpmailer/phpmailer", - "version": "v6.1.8", + "version": "v6.2.0", "source": { "type": "git", "url": "https://github.com/PHPMailer/PHPMailer.git", - "reference": "917ab212fa00dc6eacbb26e8bc387ebe40993bc1" + "reference": "e38888a75c070304ca5514197d4847a59a5c853f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/917ab212fa00dc6eacbb26e8bc387ebe40993bc1", - "reference": "917ab212fa00dc6eacbb26e8bc387ebe40993bc1", + "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/e38888a75c070304ca5514197d4847a59a5c853f", + "reference": "e38888a75c070304ca5514197d4847a59a5c853f", "shasum": "" }, "require": { @@ -813,9 +758,12 @@ "php": ">=5.5.0" }, "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", "doctrine/annotations": "^1.2", - "friendsofphp/php-cs-fixer": "^2.2", - "phpunit/phpunit": "^4.8 || ^5.7" + "phpcompatibility/php-compatibility": "^9.3.5", + "roave/security-advisories": "dev-latest", + "squizlabs/php_codesniffer": "^3.5.6", + "yoast/phpunit-polyfills": "^0.2.0" }, "suggest": { "ext-mbstring": "Needed to send email in multibyte encoding charset", @@ -855,15 +803,15 @@ "description": "PHPMailer is a full-featured email creation and transfer class for PHP", "support": { "issues": "https://github.com/PHPMailer/PHPMailer/issues", - "source": "https://github.com/PHPMailer/PHPMailer/tree/v6.1.8" + "source": "https://github.com/PHPMailer/PHPMailer/tree/v6.2.0" }, "funding": [ { - "url": "https://github.com/synchro", + "url": "https://github.com/Synchro", "type": "github" } ], - "time": "2020-10-09T14:55:58+00:00" + "time": "2020-11-25T15:24:57+00:00" }, { "name": "picqer/php-barcode-generator", @@ -994,12 +942,12 @@ "source": { "type": "git", "url": "https://github.com/Roave/SecurityAdvisories.git", - "reference": "4100ec7deab9f78b3b7685fedc6c9b82c15b5c76" + "reference": "d5961914bf7f90e81af509b81e51450bff419815" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/4100ec7deab9f78b3b7685fedc6c9b82c15b5c76", - "reference": "4100ec7deab9f78b3b7685fedc6c9b82c15b5c76", + "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/d5961914bf7f90e81af509b81e51450bff419815", + "reference": "d5961914bf7f90e81af509b81e51450bff419815", "shasum": "" }, "conflict": { @@ -1029,7 +977,7 @@ "composer/composer": "<=1-alpha.11", "contao-components/mediaelement": ">=2.14.2,<2.21.1", "contao/core": ">=2,<3.5.39", - "contao/core-bundle": "= 4.10.0|>=4,<4.4.52|>=4.5,<4.9.6", + "contao/core-bundle": ">=4,<4.4.52|>=4.5,<4.9.6|= 4.10.0", "contao/listing-bundle": ">=4,<4.4.8", "datadog/dd-trace": ">=0.30,<0.30.2", "david-garcia/phpwhois": "<=4.3.1", @@ -1045,12 +993,13 @@ "doctrine/orm": ">=2,<2.4.8|>=2.5,<2.5.1", "dolibarr/dolibarr": "<11.0.4", "dompdf/dompdf": ">=0.6,<0.6.2", - "drupal/core": ">=7,<7.73|>=8,<8.8.10|>=8.9,<8.9.6|>=9,<9.0.6", - "drupal/drupal": ">=7,<7.73|>=8,<8.8.10|>=8.9,<8.9.6|>=9,<9.0.6", + "drupal/core": ">=7,<7.74|>=8,<8.8.11|>=8.9,<8.9.9|>=9,<9.0.8", + "drupal/drupal": ">=7,<7.74|>=8,<8.8.11|>=8.9,<8.9.9|>=9,<9.0.8", "endroid/qr-code-bundle": "<3.4.2", "enshrined/svg-sanitize": "<0.13.1", "erusev/parsedown": "<1.7.2", "ezsystems/demobundle": ">=5.4,<5.4.6.1", + "ezsystems/ez-support-tools": ">=2.2,<2.2.3", "ezsystems/ezdemo-ls-extension": ">=5.4,<5.4.2.1", "ezsystems/ezfind-ls": ">=5.3,<5.3.6.1|>=5.4,<5.4.11.1|>=2017.12,<2017.12.0.1", "ezsystems/ezplatform": ">=1.7,<1.7.9.1|>=1.13,<1.13.5.1|>=2.5,<2.5.4", @@ -1072,6 +1021,8 @@ "friendsoftypo3/mediace": ">=7.6.2,<7.6.5", "fuel/core": "<1.8.1", "getgrav/grav": "<1.7-beta.8", + "getkirby/cms": ">=3,<3.4.5", + "getkirby/panel": "<2.5.14", "gos/web-socket-bundle": "<1.10.4|>=2,<2.6.1|>=3,<3.3", "gree/jose": "<=2.2", "gregwar/rst": "<1.0.3", @@ -1099,7 +1050,7 @@ "magento/magento1ee": ">=1,<1.14.4.3", "magento/product-community-edition": ">=2,<2.2.10|>=2.3,<2.3.2-p.2", "marcwillmann/turn": "<0.3.3", - "mediawiki/core": ">=1.31,<1.31.9|>=1.32,<1.32.4|>=1.33,<1.33.3|>=1.34,<1.34.3|>=1.34.99,<1.35", + "mediawiki/core": ">=1.27,<1.27.6|>=1.29,<1.29.3|>=1.30,<1.30.2|>=1.31,<1.31.9|>=1.32,<1.32.6|>=1.32.99,<1.33.3|>=1.33.99,<1.34.3|>=1.34.99,<1.35", "mittwald/typo3_forum": "<1.2.1", "monolog/monolog": ">=1.8,<1.12", "namshi/jose": "<2.2", @@ -1107,8 +1058,8 @@ "nette/nette": ">=2,<2.0.19|>=2.1,<2.1.13", "nystudio107/craft-seomatic": "<3.3", "nzo/url-encryptor-bundle": ">=4,<4.3.2|>=5,<5.0.1", - "october/backend": ">=1.0.319,<1.0.467", - "october/cms": ">=1.0.319,<1.0.466", + "october/backend": ">=1.0.319,<1.0.470", + "october/cms": "= 1.0.469|>=1.0.319,<1.0.469", "october/october": ">=1.0.319,<1.0.466", "october/rain": ">=1.0.319,<1.0.468", "onelogin/php-saml": "<2.10.4", @@ -1121,13 +1072,14 @@ "padraic/humbug_get_contents": "<1.1.2", "pagarme/pagarme-php": ">=0,<3", "paragonie/random_compat": "<2", + "passbolt/passbolt_api": "<2.11", "paypal/merchant-sdk-php": "<3.12", - "pear/archive_tar": "<1.4.4", + "pear/archive_tar": "<1.4.11", "personnummer/personnummer": "<3.0.2", "phpfastcache/phpfastcache": ">=5,<5.0.13", "phpmailer/phpmailer": "<6.1.6", "phpmussel/phpmussel": ">=1,<1.6", - "phpmyadmin/phpmyadmin": "<4.9.2", + "phpmyadmin/phpmyadmin": "<4.9.6|>=5,<5.0.3", "phpoffice/phpexcel": "<1.8.2", "phpoffice/phpspreadsheet": "<1.8", "phpunit/phpunit": ">=4.8.19,<4.8.28|>=5.0.10,<5.6.3", @@ -1224,12 +1176,12 @@ "titon/framework": ">=0,<9.9.99", "truckersmp/phpwhois": "<=4.3.1", "twig/twig": "<1.38|>=2,<2.7", - "typo3/cms": ">=6.2,<6.2.30|>=7,<7.6.32|>=8,<8.7.30|>=9,<9.5.20|>=10,<10.4.6", - "typo3/cms-core": ">=8,<8.7.30|>=9,<9.5.20|>=10,<10.4.6", + "typo3/cms": ">=6.2,<6.2.30|>=7,<7.6.32|>=8,<8.7.38|>=9,<9.5.23|>=10,<10.4.10", + "typo3/cms-core": ">=8,<8.7.38|>=9,<9.5.23|>=10,<10.4.10", "typo3/flow": ">=1,<1.0.4|>=1.1,<1.1.1|>=2,<2.0.1|>=2.3,<2.3.16|>=3,<3.0.10|>=3.1,<3.1.7|>=3.2,<3.2.7|>=3.3,<3.3.5", "typo3/neos": ">=1.1,<1.1.3|>=1.2,<1.2.13|>=2,<2.0.4", "typo3/phar-stream-wrapper": ">=1,<2.1.1|>=3,<3.1.1", - "typo3fluid/fluid": ">=2,<2.0.5|>=2.1,<2.1.4|>=2.2,<2.2.1|>=2.3,<2.3.5|>=2.4,<2.4.1|>=2.5,<2.5.5|>=2.6,<2.6.1", + "typo3fluid/fluid": ">=2,<2.0.8|>=2.1,<2.1.7|>=2.2,<2.2.4|>=2.3,<2.3.7|>=2.4,<2.4.4|>=2.5,<2.5.11|>=2.6,<2.6.10", "ua-parser/uap-php": "<3.8", "usmanhalalit/pixie": "<1.0.3|>=2,<2.0.2", "verot/class.upload.php": "<=1.0.3|>=2,<=2.0.4", @@ -1303,7 +1255,7 @@ "type": "tidelift" } ], - "time": "2020-11-18T07:02:14+00:00" + "time": "2020-12-08T15:02:56+00:00" }, { "name": "sabberworm/php-css-parser", @@ -1519,23 +1471,23 @@ }, { "name": "symfony/translation", - "version": "v5.1.8", + "version": "v5.2.0", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "27980838fd261e04379fa91e94e81e662fe5a1b6" + "reference": "52f486a707510884450df461b5a6429dd7a67379" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/27980838fd261e04379fa91e94e81e662fe5a1b6", - "reference": "27980838fd261e04379fa91e94e81e662fe5a1b6", + "url": "https://api.github.com/repos/symfony/translation/zipball/52f486a707510884450df461b5a6429dd7a67379", + "reference": "52f486a707510884450df461b5a6429dd7a67379", "shasum": "" }, "require": { "php": ">=7.2.5", "symfony/polyfill-mbstring": "~1.0", "symfony/polyfill-php80": "^1.15", - "symfony/translation-contracts": "^2" + "symfony/translation-contracts": "^2.3" }, "conflict": { "symfony/config": "<4.4", @@ -1565,6 +1517,9 @@ }, "type": "library", "autoload": { + "files": [ + "Resources/functions.php" + ], "psr-4": { "Symfony\\Component\\Translation\\": "" }, @@ -1589,7 +1544,7 @@ "description": "Symfony Translation Component", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/translation/tree/v5.1.8" + "source": "https://github.com/symfony/translation/tree/v5.2.0" }, "funding": [ { @@ -1605,7 +1560,7 @@ "type": "tidelift" } ], - "time": "2020-10-24T12:01:57+00:00" + "time": "2020-11-28T11:24:18+00:00" }, { "name": "symfony/translation-contracts", @@ -1684,58 +1639,6 @@ } ], "time": "2020-09-28T13:05:58+00:00" - }, - { - "name": "timetoogo/pinq", - "version": "3.4.1", - "source": { - "type": "git", - "url": "https://github.com/TimeToogo/Pinq.git", - "reference": "fa55da968d063c5aca384b5298665348da248c08" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/TimeToogo/Pinq/zipball/fa55da968d063c5aca384b5298665348da248c08", - "reference": "fa55da968d063c5aca384b5298665348da248c08", - "shasum": "" - }, - "require": { - "nikic/php-parser": "~3.1", - "php": ">=5.5.0" - }, - "require-dev": { - "doctrine/cache": "1.5.*", - "phpunit/phpunit": "4.8.*", - "satooshi/php-coveralls": "1.0.*" - }, - "type": "library", - "autoload": { - "psr-4": { - "Pinq\\": "Source/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Elliot Levin", - "email": "elliotlevin@hotmail.com" - } - ], - "description": "PHP Integrated Query - A real LINQ library for PHP", - "homepage": "http://www.github.com/TimeToogo/Pinq", - "keywords": [ - "collection", - "pinq", - "query" - ], - "support": { - "issues": "https://github.com/TimeToogo/Pinq/issues", - "source": "https://github.com/TimeToogo/Pinq/tree/master" - }, - "time": "2017-09-06T06:27:03+00:00" } ], "packages-dev": [], diff --git a/www/config/config.ini b/www/config/config.ini index 155f4a95d..9ef294921 100644 --- a/www/config/config.ini +++ b/www/config/config.ini @@ -26,7 +26,7 @@ tls=true ocstore=0 ; интеграция с опенкарт shop=0 ; встроеный модуль онлайн каталога note=1 ; модуль органайзера(базы знаний) -issue=1 ; модуль Проекты и задачи +issue=0 ; модуль Проекты и задачи woocomerce=0; интеграция с вукомерсе tecdoc=0 ; поиск по базе автозапчастей \ No newline at end of file From 00ab7e8231b2ef7f03bbbef860be86d30f060109 Mon Sep 17 00:00:00 2001 From: "HOME\\leonm" Date: Mon, 14 Dec 2020 01:28:33 +0200 Subject: [PATCH 02/11] next --- CHANGELOG.md | 9 +++++++-- db/update470to480.sql | 13 +++++++++++++ db/update480to490.sql | 22 ++++++++++++++++++++++ www/app/modules/ppo/ppolist.php | 22 ++++++++++++++++------ www/app/pages/userlogin.php | 2 +- www/composer.json | 2 +- www/composer.lock | 28 ++++++++++++++-------------- www/config/config.ini | 1 + 8 files changed, 75 insertions(+), 24 deletions(-) create mode 100644 db/update470to480.sql create mode 100644 db/update480to490.sql diff --git a/CHANGELOG.md b/CHANGELOG.md index e32e370fb..2ee03517b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,14 @@ CHANGELOG ========= +### v4.8.0 (2020-12-19) +* Добавлен модуль програмного РРО для отправки чеков в налоговую (Украина). Опимание модуля +на оф. сайте. + +Для обновления версии обновить папки app, templates, templates_ua, выполнить update470to480.sql . + - -### v4.7.0 (2020-12-19) +### v4.7.0 (2020-12-03) * Добавлена иерархия контрагентов для консолидированой отчетности на уровне холдингов * Добавлены типы номенклатуры. Комплектация теперь только для готовой продукции и полуфабрикатов. * Номер банковского счета для счета фактуры перенесен в настройки денежных счетов diff --git a/db/update470to480.sql b/db/update470to480.sql new file mode 100644 index 000000000..bab807cbd --- /dev/null +++ b/db/update470to480.sql @@ -0,0 +1,13 @@ +CREATE TABLE `ppo_zformstat` ( + `zf_id` int(11) NOT NULL AUTO_INCREMENT, + `pos_id` int(11) NOT NULL, + `checktype` int(11) NOT NULL, + `createdon` datetime NOT NULL, + `document_number` varchar(255) NOT NULL, + `amount0` decimal(10,2) NOT NULL, + `amount1` decimal(10,2) NOT NULL, + `amount2` decimal(10,2) NOT NULL, + `amount3` decimal(10,2) NOT NULL, + PRIMARY KEY (`zf_id`) +) DEFAULT CHARSET=utf8; + diff --git a/db/update480to490.sql b/db/update480to490.sql new file mode 100644 index 000000000..d42430ef7 --- /dev/null +++ b/db/update480to490.sql @@ -0,0 +1,22 @@ +/* +CREATE TABLE `empacc` ( + `ea_id` int(11) NOT NULL AUTO_INCREMENT, + `emp_id` int(11) NOT NULL, + `document_id` int(11) DEFAULT NULL, + `createdon` date NOT NULL, + `notes` varchar(255) DEFAULT NULL, + `income` decimal(10,2) NOT NULL, + `outcome` decimal(10,2) NOT NULL, + PRIMARY KEY (`ea_id`), + KEY `emp_id` (`emp_id`) +) 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`) + +) DEFAULT CHARSET=utf8; + +*/ \ No newline at end of file diff --git a/www/app/modules/ppo/ppolist.php b/www/app/modules/ppo/ppolist.php index 3eebde8b4..48dcf600e 100644 --- a/www/app/modules/ppo/ppolist.php +++ b/www/app/modules/ppo/ppolist.php @@ -49,7 +49,7 @@ public function __construct() { $this->opan->add(new Paginator('pagp', $this->opan->ppolist)); - $this->opan->ppolist->setPageSize(H::getPG()); + $this->opan->ppolist->setPageSize(5000); $this->add(new Panel('shpan'))->setVisible(false); $this->shpan->add(new ClickLink('backo', $this, 'onBacko')); @@ -59,6 +59,7 @@ public function __construct() { $this->docpan->add(new ClickLink('backsh', $this, 'onBacksh')); $this->docpan->add(new Label('docshow'))->setVisible(false);; $this->docpan->add(new DataView('doclist', new ArrayDataSource(new Prop($this, '_doclist')), $this, 'docOnRow')); + $this->docpan->doclist->setSelectedClass('table-success'); } @@ -112,6 +113,14 @@ public function ppoOnRow($row) { public function onObj($sender) { $this->ppo = $sender->getOwner()->getDataItem(); + + $this->updateShifts() ; + + $this->opan->setVisible(false); + $this->shpan->setVisible(true); + } + + public function updateShifts() { $this->_shlist = array(); $from = \Carbon\Carbon::now()->addMonth(-1)->startOfMonth()->format('c'); $to = \Carbon\Carbon::now()->format('c'); @@ -136,11 +145,8 @@ public function onObj($sender) { } $this->shpan->shlist->Reload(); - - $this->opan->setVisible(false); - $this->shpan->setVisible(true); - } - + } + public function onBacko($sender) { $this->opan->setVisible(true); $this->shpan->setVisible(false); @@ -195,6 +201,7 @@ public function onBacksh($sender) { $this->shpan->setVisible(true); $this->docpan->setVisible(false); $this->docpan->docshow->setVisible(false); + $this->updateShifts() ; } @@ -214,6 +221,9 @@ public function docOnRow($row) { public function onDoc($sender) { $doc = $sender->getOwner()->getDataItem(); + $this->docpan->doclist->setSelectedRow($sender->getOwner()); + $this->docpan->doclist->Reload(); + $cid = $this->opan->filter->searchcomp->getValue(); $res = Helper::send(json_encode(array('Command' => $doc->DocClass, 'RegistrarNumFiscal' => $this->ppo->tr->NumFiscal, 'NumFiscal' => $doc->NumFiscal)), 'cmd', $cid, true); diff --git a/www/app/pages/userlogin.php b/www/app/pages/userlogin.php index 7af86f49f..05773820f 100644 --- a/www/app/pages/userlogin.php +++ b/www/app/pages/userlogin.php @@ -31,7 +31,7 @@ public function __construct() { $this->setError(''); - $curver = 'v4.7.0'; + $curver = 'v4.8.0'; $this->_tvars['curversion'] = $curver; //проверка новой версии diff --git a/www/composer.json b/www/composer.json index f5eea1b41..8933b75c7 100644 --- a/www/composer.json +++ b/www/composer.json @@ -17,7 +17,7 @@ "automattic/woocommerce": "3.0.0", "symfony/polyfill-mbstring": "^1.10", - "leon-mbs/zippy": "2.2.3" + "leon-mbs/zippy": "2.2.4" } } diff --git a/www/composer.lock b/www/composer.lock index ad851d177..8172f7df1 100644 --- a/www/composer.lock +++ b/www/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "4ad1f45340e40604cfeb1d1c762d5ec1", + "content-hash": "b169fd20e0bc5c02170932c28e4fa769", "packages": [ { "name": "adodb/adodb-php", @@ -283,16 +283,16 @@ }, { "name": "leon-mbs/zdb", - "version": "1.2.9", + "version": "1.2.10", "source": { "type": "git", "url": "https://github.com/leon-mbs/zdb.git", - "reference": "4c444bb2bf02a06e3cecd429e6bccbdb1312f821" + "reference": "eb86c36aa16ac6a0f9255baeb0f0e2a6954a292f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/leon-mbs/zdb/zipball/4c444bb2bf02a06e3cecd429e6bccbdb1312f821", - "reference": "4c444bb2bf02a06e3cecd429e6bccbdb1312f821", + "url": "https://api.github.com/repos/leon-mbs/zdb/zipball/eb86c36aa16ac6a0f9255baeb0f0e2a6954a292f", + "reference": "eb86c36aa16ac6a0f9255baeb0f0e2a6954a292f", "shasum": "" }, "require": { @@ -323,27 +323,27 @@ ], "support": { "issues": "https://github.com/leon-mbs/zdb/issues", - "source": "https://github.com/leon-mbs/zdb/tree/1.2.9" + "source": "https://github.com/leon-mbs/zdb/tree/1.2.10" }, - "time": "2020-11-13T16:47:37+00:00" + "time": "2020-12-12T20:53:58+00:00" }, { "name": "leon-mbs/zippy", - "version": "2.2.3", + "version": "2.2.4", "source": { "type": "git", "url": "https://github.com/leon-mbs/zippy.git", - "reference": "6269135ac19beb44ffc592e730f31ec0b8ef830f" + "reference": "2fee5b144376bd0f57a17948e67dde9af88aa4f7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/leon-mbs/zippy/zipball/6269135ac19beb44ffc592e730f31ec0b8ef830f", - "reference": "6269135ac19beb44ffc592e730f31ec0b8ef830f", + "url": "https://api.github.com/repos/leon-mbs/zippy/zipball/2fee5b144376bd0f57a17948e67dde9af88aa4f7", + "reference": "2fee5b144376bd0f57a17948e67dde9af88aa4f7", "shasum": "" }, "require": { "leon-mbs/phpquery": ">=1.0.0", - "leon-mbs/zdb": "1.2.9", + "leon-mbs/zdb": "1.2.10", "mustache/mustache": "v2.13.0", "php": ">=7.2.0" }, @@ -371,9 +371,9 @@ ], "support": { "issues": "https://github.com/leon-mbs/zippy/issues", - "source": "https://github.com/leon-mbs/zippy/tree/2.2.3" + "source": "https://github.com/leon-mbs/zippy/tree/2.2.4" }, - "time": "2020-11-13T16:53:55+00:00" + "time": "2020-12-12T20:55:12+00:00" }, { "name": "masterexploder/phpthumb", diff --git a/www/config/config.ini b/www/config/config.ini index 9ef294921..3ce387db5 100644 --- a/www/config/config.ini +++ b/www/config/config.ini @@ -29,4 +29,5 @@ note=1 ; модуль органайзера(базы знаний) issue=0 ; модуль Проекты и задачи woocomerce=0; интеграция с вукомерсе tecdoc=0 ; поиск по базе автозапчастей +ppo=1 ; фискализация \ No newline at end of file From 2c6c074a9738d006e669ac2767d968cf1fc18c10 Mon Sep 17 00:00:00 2001 From: "HOME\\leonm" Date: Tue, 15 Dec 2020 01:23:42 +0200 Subject: [PATCH 03/11] fix --- CHANGELOG.md | 2 +- www/app/entity/doc/order.php | 2 + www/app/entity/doc/prodreceipt.php | 3 +- www/app/entity/doc/serviceact.php | 3 +- www/app/entity/doc/task.php | 1 + www/app/modules/ppo/helper.php | 5 +- www/app/modules/ppo/ppohelper.php | 718 ++++++++++++++++++ www/app/pages/doc/goodsissue.php | 3 +- www/app/pages/doc/prodissue.php | 7 +- www/app/pages/doc/prodreceipt.php | 8 + www/app/pages/doc/task.php | 12 +- www/app/pages/register/orderlist.php | 17 +- www/app/widgets/wdebitors.php | 8 +- www/app/widgets/wminqty.php | 10 +- www/app/widgets/wnoliq.php | 8 +- www/app/widgets/wopendocs.php | 10 +- www/app/widgets/wplanneddocs.php | 6 +- www/app/widgets/wrdoc.php | 11 +- www/app/widgets/wreserved.php | 6 +- www/app/widgets/wsdate.php | 14 +- www/app/widgets/wwaited.php | 6 +- www/templates/lang.json | 1 + www/templates/pages/doc/serviceact.html | 4 +- www/templates/pages/register/orderlist.html | 1 + www/templates/printforms/check.xml | 84 +- www/templates/printforms/checkback.xml | 80 +- www/templates/printforms/checkpay.xml | 84 +- www/templates/printforms/doc/task.tpl | 8 + www/templates/printforms/shift.xml | 2 +- www/templates/printforms/zform.xml | 49 +- www/templates/widgets/wdebitors.html | 8 +- www/templates/widgets/wminqty.html | 10 +- www/templates/widgets/wnoliq.html | 8 +- www/templates/widgets/wopendocs.html | 8 +- www/templates/widgets/wplanneddocs.html | 6 +- www/templates/widgets/wrdoc.html | 8 +- www/templates/widgets/wreserved.html | 6 +- www/templates/widgets/wsdate.html | 10 +- www/templates/widgets/wwaited.html | 6 +- www/templates_ua/lang.json | 1 + www/templates_ua/pages/doc/serviceact.html | 4 +- .../pages/register/orderlist.html | 1 + www/templates_ua/printforms/doc/task.tpl | 8 + www/templates_ua/widgets/wdebitors.html | 8 +- www/templates_ua/widgets/wminqty.html | 10 +- www/templates_ua/widgets/wnoliq.html | 8 +- www/templates_ua/widgets/wopendocs.html | 8 +- www/templates_ua/widgets/wplanneddocs.html | 6 +- www/templates_ua/widgets/wrdoc.html | 8 +- www/templates_ua/widgets/wreserved.html | 6 +- www/templates_ua/widgets/wsdate.html | 10 +- www/templates_ua/widgets/wwaited.html | 6 +- 52 files changed, 1077 insertions(+), 250 deletions(-) create mode 100644 www/app/modules/ppo/ppohelper.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ee03517b..22d579e76 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ CHANGELOG ========= ### v4.8.0 (2020-12-19) -* Добавлен модуль програмного РРО для отправки чеков в налоговую (Украина). Опимание модуля +* Добавлен модуль програмного РРО для отправки чеков в налоговую (Украина). Описание модуля на оф. сайте. Для обновления версии обновить папки app, templates, templates_ua, выполнить update470to480.sql . diff --git a/www/app/entity/doc/order.php b/www/app/entity/doc/order.php index 43ed4fd71..c34af040b 100644 --- a/www/app/entity/doc/order.php +++ b/www/app/entity/doc/order.php @@ -80,8 +80,10 @@ protected function getNumberTemplate() { public function getRelationBased() { $list = array(); $list['GoodsIssue'] = self::getDesc('GoodsIssue'); + $list['ProdReceipt'] = self::getDesc('ProdReceipt'); $list['Invoice'] = self::getDesc('Invoice'); $list['POSCheck'] = self::getDesc('POSCheck'); + $list['Task'] = self::getDesc('Task') ; return $list; diff --git a/www/app/entity/doc/prodreceipt.php b/www/app/entity/doc/prodreceipt.php index 55e2d1beb..9c70d65c9 100644 --- a/www/app/entity/doc/prodreceipt.php +++ b/www/app/entity/doc/prodreceipt.php @@ -80,7 +80,8 @@ protected function getNumberTemplate() { public function getRelationBased() { $list = array(); $list['ProdReceipt'] = self::getDesc('ProdReceipt'); - $list['ProdIssue'] = self::getDesc('ProdIssue'); + $list['ProdIssue'] = self::getDesc('ProdIssue'); //для формирования комплектубщих по готовой продукции + return $list; } diff --git a/www/app/entity/doc/serviceact.php b/www/app/entity/doc/serviceact.php index 0224c9b2e..f5e219261 100644 --- a/www/app/entity/doc/serviceact.php +++ b/www/app/entity/doc/serviceact.php @@ -136,7 +136,8 @@ public function generatePosReport() { public function getRelationBased() { $list = array(); - $list['Task'] = 'Наряд'; + $list['Task'] = self::getDesc('Task') ; + $list['ProdIssue'] = self::getDesc('ProdIssue') ; $list['GoodsIssue'] = self::getDesc('GoodsIssue'); return $list; diff --git a/www/app/entity/doc/task.php b/www/app/entity/doc/task.php index 2236fd106..599c0a292 100644 --- a/www/app/entity/doc/task.php +++ b/www/app/entity/doc/task.php @@ -52,6 +52,7 @@ public function generateReport() { "document_number" => $this->document_number, "notes" => $this->notes, "baseddoc" => strlen($this->headerdata["parent_number"]) > 0 ? $this->headerdata["parent_number"] : false, + "cust" => strlen($this->customer_name) > 0 ? $this->customer_name : false, "_detail" => $detail, "_detail2" => $detail2, "iseq" => count($detail2) > 0, diff --git a/www/app/modules/ppo/helper.php b/www/app/modules/ppo/helper.php index e8d6f809f..9ab7b28bb 100644 --- a/www/app/modules/ppo/helper.php +++ b/www/app/modules/ppo/helper.php @@ -94,6 +94,7 @@ public static function decrypt($data, $cid) { } + public static function send($data, $type, $cid, $encrypted = false) { $signed = Helper::sign($data, $cid); @@ -188,7 +189,7 @@ public static function shift($cid, $posid, $open) { $pos = \App\Entity\Pos::load($posid); $branch_id = \App\Session::getSession()->branch_id; - $firm = \App\Helper::getFirmData($cid, $branch_id); + $firm = \App\Helper::getFirmData($cid ); $branch = \App\Entity\Branch::load($branch_id); $header = array(); @@ -223,7 +224,7 @@ public static function zform($cid, $posid ) { $pos = \App\Entity\Pos::load($posid); $branch_id = \App\Session::getSession()->branch_id; - $firm = \App\Helper::getFirmData($cid, $branch_id); + $firm = \App\Helper::getFirmData($cid ); $branch = \App\Entity\Branch::load($branch_id); $header = array(); diff --git a/www/app/modules/ppo/ppohelper.php b/www/app/modules/ppo/ppohelper.php new file mode 100644 index 000000000..6393a3f34 --- /dev/null +++ b/www/app/modules/ppo/ppohelper.php @@ -0,0 +1,718 @@ + $port, + CURLOPT_URL => "{$server}:{$port}/sign", + CURLOPT_POST => true, + CURLOPT_ENCODING => "", + CURLOPT_MAXREDIRS => 10, + CURLOPT_RETURNTRANSFER => true, + CURLOPT_CONNECTTIMEOUT => 20, + CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, + CURLOPT_POSTFIELDS => $data + ]); + + $ret = curl_exec($request); + if (curl_errno($request) > 0) { + + return array('success'=>false,'data'=>'Curl error: ' . curl_error($request)); + + } + + curl_close($request); + $ret = json_decode($ret,true); + + + return array('success'=>true,'data'=>base64_decode($ret['data'])); + + } + + public static function decrypt($data, $server,$port) { + + + $request = curl_init(); + + curl_setopt_array($request, [ + CURLOPT_PORT => $port, + CURLOPT_URL => "{$server}:{$port}/sign", + CURLOPT_POST => true, + CURLOPT_ENCODING => "", + CURLOPT_MAXREDIRS => 10, + CURLOPT_RETURNTRANSFER => true, + CURLOPT_CONNECTTIMEOUT => 20, + CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, + CURLOPT_POSTFIELDS => base64_encode($data) + ]); + + + + if (curl_errno($request) > 0) { + return array('success'=>false,'data'=>'Curl error: ' . curl_error($request)); + + + } + $ret = (curl_exec($request)); + + curl_close($request); + $data = json_decode($ret,true); + return array('success'=>true,'data'=>base64_decode($data['data'])); + + } + + public static function send($data, $type, $server,$port, $encrypted = false) { + + $signed = self::sign($data, $server,$port); + if ($signed['success'] == true) { + + + $request = curl_init(); + + + + curl_setopt_array($request, [ + CURLOPT_URL => self::DPI_SERVER.$type, + CURLOPT_POST => true, + CURLOPT_HEADER => false, + CURLOPT_HTTPHEADER => array('Content-Type: application/octet-stream', "Content-Length: " . strlen($signed['data'])), + CURLOPT_ENCODING => "", + CURLOPT_RETURNTRANSFER => true, + CURLOPT_CONNECTTIMEOUT => 20, + CURLOPT_VERBOSE => 1, + CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, + CURLOPT_POSTFIELDS => $signed['data'] + ]); + + $return = curl_exec($request); + + if (curl_errno($request) > 0) { + return array('success'=>false,'data'=>'Curl error: ' . curl_error($request)); + } + curl_close($request); + + if (strpos($return, 'Номер документа повинен дорівнювати') > 0) { + $arr = explode(' ',$return); + if($arr[count($arr) - 1] > 0) { + return array('success'=>false, 'docnumber'=>$arr[count($arr) - 1],'data'=>$return); + } + + + } + if (strpos($return, 'помилки') > 0) { + + return array('success'=>false,'data'=>$return); + + } + + //декодируем подписаный ответ + if ($encrypted) { + + $decrypted = self::decrypt($return, $server,$port); + + if ($decrypted['success'] == true ) { + //если вернул xml + if(substr($decrypted['data'] ,0,5)=="ERRORCODE[0]); + $taxnum = (string) ($xml->ORDERTAXNUM[0]); + + if($errorcode=='0' && $taxnum>0) //следующий номер документа + { + return array('success'=>true, 'docnumber'=>$taxnum,'data'=>$return); + + } + return array('success'=>false, 'data'=>$errorcode); + + } + + + + return array('success'=>true,'data'=> $decrypted['data'] ); + } else { + return array('success'=>false,'data'=>$decrypted['data']); + } + + } else { + return array('success'=>true,'data'=>$return); ; + } + + + } else { + return array('success'=>false,'data'=>$signed['data']); + + + } + + + } + + + public static function shift($cid, $posid, $open) { + $pos = \App\Entity\Pos::load($posid); + + $branch_id = \App\Session::getSession()->branch_id; + $firm = \App\Helper::getFirmData($cid ); + $branch = \App\Entity\Branch::load($branch_id); + + $header = array(); + $header['doctype'] = $open == true ? 100 : 101; + $header['firmname'] = $firm['firmname']; + $header['inn'] = $firm['inn']; + $header['edrpou'] = $firm['edrpou']; + $header['address'] = $firm['address']; + $header['branchname'] = strlen($branch->branch_name) > 0 ? $branch->branch_name : $firm['firmname']; + $header['date'] = date('dmY'); + $header['time'] = date('His'); + $header['docnumber'] = $pos->fiscalnumber; + $header['posinner'] = $pos->posinner; + $header['posnumber'] = $pos->fisc; + $header['username'] = \App\System::getUser()->username; + $header['guid'] = self::guid(); + + + $report = new \App\Report('shift.xml'); + + $xml = $report->generate($header); + + + $xml = mb_convert_encoding($xml, "windows-1251", "utf-8"); + + + return self::send($xml, 'doc', $firm['signserver'],$firm['signserverport'], true); + + + } + + public static function zform($cid, $posid ) { + $pos = \App\Entity\Pos::load($posid); + + $branch_id = \App\Session::getSession()->branch_id; + $firm = \App\Helper::getFirmData($cid ); + $branch = \App\Entity\Branch::load($branch_id); + + $stat = self::getStat($posid) ; + + $header = array(); + $header['doctype'] = $open == true ? 100 : 101; + $header['firmname'] = $firm['firmname']; + $header['inn'] = $firm['inn']; + $header['edrpou'] = $firm['edrpou']; + $header['address'] = $firm['address']; + $header['branchname'] = strlen($branch->branch_name) > 0 ? $branch->branch_name : $firm['firmname']; + $header['date'] = date('dmY'); + $header['time'] = date('His'); + $header['docnumber'] = $pos->fiscalnumber; + $header['posinner'] = $pos->posinner; + $header['posnumber'] = $pos->fisc; + $header['username'] = \App\System::getUser()->username; + $header['guid'] = self::guid(); + $header['pays'] = array(); + $header['paysr'] = array(); + $amount=0; + $amountr=0; + $cnt=0; + $cntr=0; + + $stat = self::getStat($pos->pos_id); + //реализация + foreach($stat as $row) { + $n=1; + $cnt = $cnt+ $row['cnt']; + if($row['amount0']>0) { + $header['pays'][] = array( + 'formname'=> self::PAY_NAL, + 'formcode'=> 0, + 'sum'=> number_format($row['amount0'], 2, '.', '') , + 'num'=>"ROWNUM=\"{$n}\"" + ); + $amount = $amount + $row['amount0'] ; + $n++; + } + if($row['amount1']>0) { + $header['pays'][] = array( + 'formname'=> self::PAY_BEZNAL, + 'formcode'=> 1, + 'sum'=> number_format($row['amount1'], 2, '.', '') , + 'num'=>"ROWNUM=\"{$n}\"" + ); + $amount = $amount + $row['amount1'] ; + $n++; + } + if($row['amount2']>0) { + $header['pays'][] = array( + 'formname'=> self::PAY_CREDIT, + 'formcode'=> 2, + 'sum'=> number_format($row['amount2'], 2, '.', '') , + 'num'=>"ROWNUM=\"{$n}\"" + ); + $amount = $amount + $row['amount2'] ; + $n++; + } + if($row['amount3']>0) { + $header['pays'][] = array( + 'formname'=> self::PAY_PREPAID, + 'formcode'=> 3, + 'sum'=> number_format($row['amount3'], 2, '.', '') , + 'num'=>"ROWNUM=\"{$n}\"" + ); + $amount = $amount + $row['amount3'] ; + $n++; + } + } + + $stat = self::getStat($pos->pos_id,true); + //возврат + foreach($stat as $row) { + $n=1; + $cntr = $cntr+ $row['cnt']; + if($row['amount0']>0) { + $header['paysr'][] = array( + 'formname'=> self::PAY_NAL, + 'formcode'=> 0, + 'sum'=> number_format($row['amount0'], 2, '.', '') , + 'num'=>"ROWNUM=\"{$n}\"" + ); + $amountr = $amountr + $row['amount0'] ; + $n++; + } + if($row['amount1']>0) { + $header['paysr'][] = array( + 'formname'=> self::PAY_BEZNAL, + 'formcode'=> 1, + 'sum'=> number_format($row['amount1'], 2, '.', '') , + 'num'=>"ROWNUM=\"{$n}\"" + ); + $amountr = $amountr + $row['amount1'] ; + $n++; + } + + } + /* + $cnt=6; + $header['pays'][] = array( + 'formname'=> 'Готiвка', + 'formcode'=> 0, + 'sum'=> number_format(64, 2, '.', '') , + 'num'=>"ROWNUM=\"1\"" + ); + + $header['pays'][] = array( + 'formname'=> 'Наличная', + 'formcode'=> 1, + 'sum'=> number_format(30.3, 2, '.', '') , + 'num'=>"ROWNUM=\"2\"" + ); + + */ + $header['amount'] = number_format($amount, 2, '.', ''); + $header['amountr'] = number_format($amountr, 2, '.', ''); + $header['cnt'] = $cnt ; + $header['cntr'] = $cntr ; + $header['isreal'] = $cnt>0 ; + $header['isret'] = $cntr>0 ; + + $report = new \App\Report('zform.xml'); + + $xml = $report->generate($header); + + + $xml = mb_convert_encoding($xml , "windows-1251","utf-8" ) ; + + return self::send($xml, 'doc', $firm['signserver'],$firm['signserverport'], true); + + } + + public static function check($cid, $posid ) { + $pos = \App\Entity\Pos::load($posid); + + $branch_id = \App\Session::getSession()->branch_id; + $firm = \App\Helper::getFirmData($cid, $branch_id); + $branch = \App\Entity\Branch::load($branch_id); + + + + $header = array( ); + $header['doctype'] = $doctype ; + $header['docsubtype'] = $docsubtype ; + $header['firmname'] = $firm['firmname'] ; + $header['inn'] = $firm['inn']; + $header['edrpou'] = $firm['edrpou']; + $header['address'] = $firm['address'] ; + $header['branchname'] = $branch->branch_name ; + $header['date'] = date('dmY'); + $header['time'] = date('His'); + $header['docnumber'] = $pos->fiscalnumber; + $header['posinner'] = $pos->posinner; + $header['posnumber'] = $pos->fisc ; + $header['username'] = $doc->username ; + $header['guid'] = self::guid(); + + + $header['disc'] = $doc->headerdata["paydisc"] >0 ? number_format($doc->headerdata["paydisc"], 2, '.', '') : false; + $header['details'] = array(); + $n=1; + $disc=1; + if($doc->headerdata["paydisc"] >0 ) { + $disc = 1 - ($doc->headerdata["paydisc"]/$doc->amount); + + } + $header['amount'] =0; + foreach ($doc->unpackDetails('detaildata') as $item) { + $header['details'][] = array( + 'num'=>"ROWNUM=\"{$n}\"", + 'name'=> $item->itemname , + 'qty'=> number_format($item->quantity , 3, '.', '') , + 'price'=> number_format($item->price*$disc , 2, '.', ''), + 'cost'=> number_format($item->quantity*$item->price*$disc , 2, '.', '') + ) ; + + $header['amount'] = $header['amount']+ $item->quantity*$item->price*$disc; + } + foreach ($doc->unpackDetails('services') as $item) { + $header['details'][] = array( + 'num'=>"ROWNUM=\"{$n}\"", + 'name'=> $item->service_name , + 'qty'=> number_format($item->quantity , 3, '.', '') , + 'price'=> number_format($item->price*$disc , 2, '.', ''), + 'cost'=> number_format($item->quantity*$item->price*$disc , 2, '.', '') + ) ; + $n++; + $header['amount'] = $header['amount']+ $item->quantity*$item->price*$disc; + } + + $mf = \App\Entity\MoneyFund::load($doc->headerdata['payment']); + + $amount0=0; + $amount1=0; + $amount2=0; + $amount3=0; + $header['pays'] = array(); + $n=1; + + if ($doc->headerdata['payment'] == \App\Entity\MoneyFund::PREPAID) { + $pay = array( + 'formname'=> self::PAY_PREPAID, + 'formcode'=> 3, + 'paysum'=> number_format($header['amount'], 2, '.', '') , + 'payed'=> number_format($header['amount'], 2, '.', '') , + 'num'=>"ROWNUM=\"{$n}\"" + ); + + $header['pays'][]=$pay; + $n++; + $amount3 = $pay['paysum']; + } else + if ( $mf !=null && $mf->beznal==1) { + $pay = array( + 'formname'=> self::PAY_BEZNAL, + 'formcode'=> 1, + 'paysum'=> number_format($doc->payamount, 2, '.', '') , + 'payed'=> number_format($doc->payamount, 2, '.', '') , + 'num'=>"ROWNUM=\"{$n}\"" + ); + // в долг + if($doc->payed < $doc->payamount) { + $pay['paysum'] = number_format($doc->payamount, 2, '.', '') ; + $pay['payed'] = number_format($doc->payed, 2, '.', '') ; + + } + $header['pays'][]=$pay; + $n++; + $amount1 = $pay['paysum']; + } else { + + $pay = array( + 'formname'=> self::PAY_NAL, + 'formcode'=> 0, + 'paysum'=> number_format($doc->payamount, 2, '.', '') , + 'payed'=> number_format($doc->payed, 2, '.', '') , + 'rest'=>false, + 'num'=>"ROWNUM=\"{$n}\"" + ); + //сдача + if($doc->headerdata["exchange"] >0 ){ + $pay['rest'] = number_format($doc->headerdata["exchange"], 2, '.', ''); + } + // в долг + if($doc->payed < $doc->payamount) { + $pay['paysum'] = number_format($doc->payed, 2, '.', '') ; + $pay['payed'] = number_format($doc->payed, 2, '.', '') ; + + } + + $header['pays'][]=$pay; + $n++; + $amount0 = $pay['paysum']; + } + // в долг + if($doc->payed < $doc->payamount) { + $pay = array( + 'formname'=>self::PAY_CREDIT, + 'formcode'=> 2, + 'paysum'=> number_format($doc->payamount - $doc->payed, 2, '.', '') , + 'payed'=> number_format($doc->payamount - $doc->payed, 2, '.', '') , + 'rest'=>false, + 'num'=>"ROWNUM=\"{$n}\"" + ); + $header['pays'][]=$pay; + $n++; + + $amount2 = $pay['paysum']; + } + + $header['pay'] = count($header['pays'])>0 ; + $header['disc'] = false; + + $header['amount'] = number_format($header['amount'], 2, '.', ''); + if($doc->headerdata["paydisc"] >0 ) { + // $header['disc'] = number_format($doc->headerdata["paydisc"], 2, '.', '') ; + + } + $report = new \App\Report('check.xml'); + + $xml = $report->generate($header); + + $xml = mb_convert_encoding($xml , "windows-1251","utf-8" ) ; + + $ret = self::send($xml,'doc',$firm['signserver'],$firm['signserverport']); + if($ret['success'] == true){ + + self::insertStat($pos->pos_id,1,$amount0,$amount1,$amount2,$amount3,$doc->document_number); + } + + return $ret; + + + } + + public static function checkpay($cid,$doc ) { + + + $firm = \App\Helper::getFirmData($cid ); + $branch = \App\Entity\Branch::load($doc->branch_id); + //todo терминал что ща открыта смена + $pos = \App\Entity\Pos::load($doc->headerdata['pos']); + + $mf = \App\Entity\MoneyFund::load($doc->headerdata['payment']); + + $header = array( ); + + $header['firmname'] = $firm['firmname'] ; + $header['inn'] = $firm['inn']; + $header['edrpou'] = $firm['edrpou']; + $header['address'] = $firm['address'] ; + $header['branchname'] = $branch->branch_name ; + $header['date'] = date('dmY'); + $header['time'] = date('His'); + $header['docnumber'] = $pos->fiscalnumber; + $header['posinner'] = $pos->posinner; + $header['posnumber'] = $pos->fisc ; + $header['username'] = $doc->username ; + $header['guid'] = self::guid(); + + $amount0=0; + $amount1=0; + $amount2=0; + $amount3=0; + + + + if ($mf !=null && $mf->beznal==1) { + $header['formname'] = self::PAY_BEZNAL; + $header['formcode'] = 1; + $amount1 = number_format($doc->payed, 2, '.', '') ; + } else { + $header['formname'] = self::PAY_NAL; + $header['formcode'] = 0; + $amount0 = number_format($doc->payed, 2, '.', '') ; + } + // $header['amount'] = number_format($doc->amount, 2, '.', ''); + $header['pay'] = $doc->payed > 0; + $header['paysum'] = number_format($doc->payed, 2, '.', '') ; + $header['payed'] = number_format($doc->payed, 2, '.', '') ; + + + $header['parentcheck'] = $doc->document_number ; + $header['amount'] = number_format($doc->payed, 2, '.', '') ; + + $report = new \App\Report('checkpay.xml'); + + $xml = $report->generate($header); + + $xml = mb_convert_encoding($xml , "windows-1251","utf-8" ) ; + + $ret = self::send($xml,'doc',$firm['signserver'],$firm['signserverport']); + if($ret['success'] == true){ + + + + + self::insertStat($pos->pos_id,2,$amount0,$amount1,$amount2,$amount3,$doc->document_number); + } + + return $ret; + + + } + + //возврат + public static function checkback($cid,$doc ) { + + + + $firm = \App\Helper::getFirmData($cid ); + $branch = \App\Entity\Branch::load($doc->branch_id); + //todo терминал что ща открыта смена + $pos = \App\Entity\Pos::load($doc->headerdata['pos']); + $mf = \App\Entity\MoneyFund::load($doc->headerdata['payment']); + + + + $header = array( ); + $header['doctype'] = $doctype ; + $header['docsubtype'] = $docsubtype ; + $header['firmname'] = $firm['firmname'] ; + $header['inn'] = $firm['inn']; + $header['edrpou'] = $firm['edrpou']; + $header['address'] = $firm['address'] ; + $header['branchname'] = $branch->branch_name ; + $header['date'] = date('dmY'); + $header['time'] = date('His'); + $header['docnumber'] = $pos->fiscalnumber ; + $header['docnumberback'] = $doc->headerdata["docnumberback"] ; + $header['posinner'] = $pos->posinner; + $header['posnumber'] = $pos->fisc ; + $header['username'] = $doc->username ; + $header['guid'] = self::guid(); + $amount0=0; + $amount1=0; + $amount2=0; + $amount3=0; + + + + if ($mf !=null && $mf->beznal==1) { + $header['formname'] = self::PAY_BEZNAL; + $header['formcode'] = 1; + $amount1 = number_format($doc->payed, 2, '.', '') ; + } else { + $header['formname'] = self::PAY_NAL; + $header['formcode'] = 0; + $amount0 = number_format($doc->payed, 2, '.', '') ; + } + + $header['paysum'] = number_format($doc->payed, 2, '.', '') ; + $header['payed'] = number_format($doc->payed, 2, '.', '') ; + + $header['details'] = array(); + + $n=1; + $header['amount'] =0; + foreach ($doc->detaildata as $item) { + $header['details'][] = array( + 'num'=>"ROWNUM=\"{$n}\"", + 'name'=> $item['itemname'] , + 'qty'=> number_format($item['quantity'] , 3, '.', '') , + 'price'=> number_format($item['price'] , 2, '.', ''), + 'cost'=> number_format($item['quantity'] * $item['price'] , 2, '.', '') + ) ; + $n++; + $header['amount'] = $header['amount'] + $item['quantity'] * $item['price'] ; + } + + + $header['amount'] = number_format($header['amount'], 2, '.', ''); + + $report = new \App\Report('checkback.xml'); + + $xml = $report->generate($header); + + $xml = mb_convert_encoding($xml , "windows-1251","utf-8" ) ; + + + $ret = self::send($xml,'doc',$firm['signserver'],$firm['signserverport']); + if($ret['success'] == true){ + + + self::insertStat($pos->pos_id,3,$amount0,$amount1,$amount2,$amount3,$doc->document_number); + } + + return $ret; + + } + + + public static function insertStat($pos_id,$checktype,$amount0,$amount1,$amount2,$amount3,$document_number=''){ + $conn = \ZDB\DB::getConnect(); + $amount0 = number_format($amount0, 2, '.', '') ; + $amount1 = number_format($amount1, 2, '.', '') ; + $amount2 = number_format($amount2, 2, '.', '') ; + $amount3 = number_format($amount3, 2, '.', '') ; + $sql = "insert into ppo_zformstat (pos_id,checktype, amount0,amount1,amount2,amount3,document_number,createdon) values ({$pos_id},{$checktype}, {$amount0}, {$amount1},{$amount2},{$amount3},". $conn->qstr($document_number) .",". $conn->DBDate(time()) .")"; + + $conn->Execute($sql) ; + + } + + public static function clearStat($pos_id ){ + $conn = \ZDB\DB::getConnect(); + + $conn->Execute("delete from ppo_zformstat where pos_id=".$pos_id ) ; + + } + + public static function getStat($pos_id,$ret=false ){ + $conn = \ZDB\DB::getConnect(); + + $sql = "select count(*) as cnt, coalesce(sum(amount0),0) as amount0, coalesce(sum(amount1),0) as amount1, coalesce(sum(amount2),0) as amount2, coalesce(sum(amount3),0) as amount3 from ppo_zformstat where pos_id=".$pos_id; + if($ret==true){ + $sql = $sql . " and checktype =3" ; //возврат + } else { + $sql = $sql . " and checktype <>3" ; + } + + + return $conn->Execute($sql) ; + + } + +} + \ No newline at end of file diff --git a/www/app/pages/doc/goodsissue.php b/www/app/pages/doc/goodsissue.php index 49e6abfc3..a6bfc7219 100644 --- a/www/app/pages/doc/goodsissue.php +++ b/www/app/pages/doc/goodsissue.php @@ -293,10 +293,11 @@ public function __construct($docid = 0, $basedocid = 0) { } if ($basedoc->meta_name == 'ServiceAct') { - $this->docform->notes->setText('Комплектующие для ' . $basedoc->document_number); + $this->docform->notes->setText(H::l('basedon') . $basedoc->document_number); $this->docform->customer->setKey($basedoc->customer_id); $this->docform->customer->setText($basedoc->customer_name); } + } } } diff --git a/www/app/pages/doc/prodissue.php b/www/app/pages/doc/prodissue.php index 37cb43848..81b73df8f 100644 --- a/www/app/pages/doc/prodissue.php +++ b/www/app/pages/doc/prodissue.php @@ -89,9 +89,14 @@ public function __construct($docid = 0, $basedocid = 0) { $this->_basedocid = $basedocid; if ($basedoc->meta_name == 'Task') { - $this->docform->notes->setText('Наряд ' . $basedoc->document_number); + $this->docform->notes->setText(H::l('basedon') . $basedoc->document_number); $this->docform->parea->setValue($basedoc->headerdata['parea']); } + if ($basedoc->meta_name == 'ServiceAct') { + + $this->docform->notes->setText(H::l('basedon') . $basedoc->document_number); + + } if ($basedoc->meta_name == 'ProdIssue') { $this->docform->store->setValue($basedoc->headerdata['store']); $this->docform->parea->setValue($basedoc->headerdata['parea']); diff --git a/www/app/pages/doc/prodreceipt.php b/www/app/pages/doc/prodreceipt.php index a3f87d0cd..256ffd8b2 100644 --- a/www/app/pages/doc/prodreceipt.php +++ b/www/app/pages/doc/prodreceipt.php @@ -90,6 +90,14 @@ public function __construct($docid = 0, $basedocid = 0) { } } + if ($basedoc instanceof Document) { + $this->_basedocid = $basedocid; + if ($basedoc->meta_name == 'Order') { + + $this->_itemlist = $basedoc->unpackDetails('detaildata'); + + } + } if ($basedoc->meta_name == 'Task') { $this->docform->notes->setText('Наряд ' . $basedoc->document_number); diff --git a/www/app/pages/doc/task.php b/www/app/pages/doc/task.php index cbd07800a..3b221ee6a 100644 --- a/www/app/pages/doc/task.php +++ b/www/app/pages/doc/task.php @@ -18,6 +18,7 @@ use Zippy\Html\Label; use Zippy\Html\Link\ClickLink; use Zippy\Html\Link\SubmitLink; +use App\Helper as H; /** * Страница ввода наряда на работу @@ -100,10 +101,15 @@ public function __construct($docid = 0, $basedocid = 0, $date = null) { $basedoc = Document::load($basedocid); if ($basedoc instanceof Document) { $this->_basedocid = $basedocid; + $this->_doc->customer_id = $basedoc->customer_id; + if ($basedoc->meta_name == 'ServiceAct') { - - - $this->docform->notes->setText("Заказ " . $basedoc->document_number); + $this->docform->notes->setText(H::l('basedon') . $basedoc->document_number); + $this->_servicelist = $basedoc->unpackDetails('detaildata'); + + } + if ($basedoc->meta_name == 'Order') { + $this->docform->notes->setText(H::l('basedon') . $basedoc->document_number); $this->_servicelist = $basedoc->unpackDetails('detaildata'); } } diff --git a/www/app/pages/register/orderlist.php b/www/app/pages/register/orderlist.php index c07437cc5..54dc59fa6 100644 --- a/www/app/pages/register/orderlist.php +++ b/www/app/pages/register/orderlist.php @@ -59,6 +59,7 @@ public function __construct() { $this->statuspan->statusform->add(new SubmitButton('binv'))->onClick($this, 'statusOnSubmit'); $this->statuspan->statusform->add(new SubmitButton('bref'))->onClick($this, 'statusOnSubmit'); $this->statuspan->statusform->add(new SubmitButton('bttn'))->onClick($this, 'statusOnSubmit'); + $this->statuspan->statusform->add(new SubmitButton('btask'))->onClick($this, 'statusOnSubmit'); $this->statuspan->add(new \App\Widgets\DocView('docview')); @@ -118,7 +119,15 @@ public function statusOnSubmit($sender) { $this->setWarn('order_canceled'); } + if ($sender->id == "btask") { + $task = count($this->_doc->getChildren('Task')) > 0; + + if ($task) { + $this->setWarn('task_exists'); + } + App::Redirect("\\App\\Pages\\Doc\\Task", 0, $this->_doc->document_id); + } if ($sender->id == "bttn") { if ($ttn) { $this->setWarn('order_has_sent'); @@ -173,15 +182,19 @@ public function updateStatusButtons() { //новый if ($state < Document::STATE_EXECUTED) { - + $this->statuspan->statusform->btask->setVisible(false); + $this->statuspan->statusform->bclose->setVisible(false); $this->statuspan->statusform->bref->setVisible(false); $this->statuspan->statusform->binp->setVisible(true); + } else { $this->statuspan->statusform->bclose->setVisible(true); $this->statuspan->statusform->bref->setVisible(true); $this->statuspan->statusform->binp->setVisible(false); + $this->statuspan->statusform->btask->setVisible(true); + } if ($ttn) { @@ -199,7 +212,7 @@ public function updateStatusButtons() { if ($state == Document::STATE_CLOSED) { $this->statuspan->statusform->bclose->setVisible(false); - + $this->statuspan->statusform->btask->setVisible(false); $this->statuspan->statusform->binv->setVisible(false); $this->statuspan->statusform->binp->setVisible(false); $this->statuspan->statusform->bref->setVisible(false); diff --git a/www/app/widgets/wdebitors.php b/www/app/widgets/wdebitors.php index 8dfe00e2a..7f8c01630 100644 --- a/www/app/widgets/wdebitors.php +++ b/www/app/widgets/wdebitors.php @@ -56,10 +56,10 @@ public function __construct($id) { public function OnRow($row) { $item = $row->getDataItem(); - $row->add(new Label('cust', $item->customer_name)); - $row->add(new Label('amount', Helper::fa($item->am))); - $row->add(new Label('type', $item->meta_desc)); - $row->add(new Label('number', $item->document_number)); + $row->add(new Label('wdbt_cust', $item->customer_name)); + $row->add(new Label('wdbt_amount', Helper::fa($item->am))); + $row->add(new Label('wdbt_type', $item->meta_desc)); + $row->add(new Label('wdbt_number', $item->document_number)); } } diff --git a/www/app/widgets/wminqty.php b/www/app/widgets/wminqty.php index 42e007b3b..cc7daf26e 100644 --- a/www/app/widgets/wminqty.php +++ b/www/app/widgets/wminqty.php @@ -60,11 +60,11 @@ public function __construct($id) { public function mqlistOnRow($row) { $item = $row->getDataItem(); - $row->add(new Label('storename', $item->storename)); - $row->add(new Label('itemname', $item->itemname)); - $row->add(new Label('item_code', $item->item_code)); - $row->add(new Label('qty', Helper::fqty($item->qty))); - $row->add(new Label('minqty', Helper::fqty($item->minqty))); + $row->add(new Label('wmq_storename', $item->storename)); + $row->add(new Label('wmq_itemname', $item->itemname)); + $row->add(new Label('wmq_item_code', $item->item_code)); + $row->add(new Label('wmq_qty', Helper::fqty($item->qty))); + $row->add(new Label('wmq_minqty', Helper::fqty($item->minqty))); } public function oncsv($sender) { diff --git a/www/app/widgets/wnoliq.php b/www/app/widgets/wnoliq.php index b781fdb33..86fb55541 100644 --- a/www/app/widgets/wnoliq.php +++ b/www/app/widgets/wnoliq.php @@ -60,10 +60,10 @@ public function noliqlistOnRow($row) { $item = $row->getDataItem(); - $row->add(new Label('storename', $item->storename)); - $row->add(new Label('itemname', $item->itemname)); - $row->add(new Label('item_code', $item->item_code)); - $row->add(new Label('qty', Helper::fqty($item->qty))); + $row->add(new Label('wnl_storename', $item->storename)); + $row->add(new Label('wnl_itemname', $item->itemname)); + $row->add(new Label('wnl_item_code', $item->item_code)); + $row->add(new Label('wnl_qty', Helper::fqty($item->qty))); } public function oncsv($sender) { diff --git a/www/app/widgets/wopendocs.php b/www/app/widgets/wopendocs.php index a212f73f9..cc1699466 100644 --- a/www/app/widgets/wopendocs.php +++ b/www/app/widgets/wopendocs.php @@ -10,7 +10,7 @@ use Zippy\Html\Label; /** - * Виджет для просмотра запланированых документов + * Виджет для просмотра недавно открытых документов */ class WOpenDocs extends \Zippy\Html\PageFragment { @@ -44,11 +44,11 @@ public function doclistOnRow($row) { $item = $row->getDataItem(); $item = $item->cast(); - $row->add(new \Zippy\Html\Link\RedirectLink("number", "\\App\\Pages\\Register\\DocList", $item->document_id))->setValue($item->document_number); + $row->add(new \Zippy\Html\Link\RedirectLink("wod_number", "\\App\\Pages\\Register\\DocList", $item->document_id))->setValue($item->document_number); - $row->add(new Label('date', \App\Helper::fdt($item->document_date))); - $row->add(new Label('type', $item->meta_desc)); - $row->add(new Label('amount', Helper::fa($item->amount))); + $row->add(new Label('wod_date', \App\Helper::fdt($item->document_date))); + $row->add(new Label('wod_type', $item->meta_desc)); + $row->add(new Label('wod_amount', Helper::fa($item->amount))); } } diff --git a/www/app/widgets/wplanneddocs.php b/www/app/widgets/wplanneddocs.php index 8e963de4a..d9c7ee085 100644 --- a/www/app/widgets/wplanneddocs.php +++ b/www/app/widgets/wplanneddocs.php @@ -46,10 +46,10 @@ public function doclistOnRow($row) { $item = $row->getDataItem(); $item = $item->cast(); $dt = \App\Helper::fd($item->document_date); - $row->add(new \Zippy\Html\Link\RedirectLink("number", "\\App\\Pages\\Register\\DocList", $item->document_id))->setValue($item->document_number); + $row->add(new \Zippy\Html\Link\RedirectLink("wpl_number", "\\App\\Pages\\Register\\DocList", $item->document_id))->setValue($item->document_number); - $row->add(new Label('date', $dt)); - $row->add(new Label('type', $item->meta_desc)); + $row->add(new Label('wpl_date', $dt)); + $row->add(new Label('wpl_type', $item->meta_desc)); } } diff --git a/www/app/widgets/wrdoc.php b/www/app/widgets/wrdoc.php index dec8edad1..90c6eb647 100644 --- a/www/app/widgets/wrdoc.php +++ b/www/app/widgets/wrdoc.php @@ -52,12 +52,11 @@ public function __construct($id) { public function doclistOnRow($row) { $item = $row->getDataItem(); - - - $row->add(new Label('date', \App\Helper::fd(strtotime($item->document_date)))); - $row->add(new Label('type', $item->meta_desc)); - $row->add(new Label('amount', Helper::fa($item->amount))); - $row->add(new \Zippy\Html\Link\RedirectLink("number", "\\App\\Pages\\Register\\DocList", $item->document_id))->setValue($item->document_number); + + $row->add(new Label('wrd_date', \App\Helper::fd(strtotime($item->document_date)))); + $row->add(new Label('wrd_type', $item->meta_desc)); + $row->add(new Label('wrd_amount', Helper::fa($item->amount))); + $row->add(new \Zippy\Html\Link\RedirectLink("wrd_number", "\\App\\Pages\\Register\\DocList", $item->document_id))->setValue($item->document_number); } } diff --git a/www/app/widgets/wreserved.php b/www/app/widgets/wreserved.php index 8b5bd5150..f5a3e05c8 100644 --- a/www/app/widgets/wreserved.php +++ b/www/app/widgets/wreserved.php @@ -57,9 +57,9 @@ public function __construct($id) { public function reslistOnRow($row) { $item = $row->getDataItem(); - $row->add(new Label('resitem', $item->storename)); - $row->add(new Label('resstore', $item->itemname)); - $row->add(new Label('resqty', Helper::fqty($item->qty))); + $row->add(new Label('wres_resitem', $item->storename)); + $row->add(new Label('wres_resstore', $item->itemname)); + $row->add(new Label('wres_resqty', Helper::fqty($item->qty))); } } diff --git a/www/app/widgets/wsdate.php b/www/app/widgets/wsdate.php index 7d0ee4fd5..1a39aaf71 100644 --- a/www/app/widgets/wsdate.php +++ b/www/app/widgets/wsdate.php @@ -54,14 +54,14 @@ public function __construct($id) { public function sdlistOnRow($row) { $stock = $row->getDataItem(); - $row->add(new Label('storename', $stock->storename)); - $row->add(new Label('itemname', $stock->itemname)); - $row->add(new Label('snumber', $stock->snumber)); - $row->add(new Label('edate', \App\Helper::fd($stock->sdate))); - $row->add(new Label('qty', Helper::fqty($stock->qty))); - $row->edate->setAttribute('class', 'badge badge-danger'); + $row->add(new Label('wsd_storename', $stock->storename)); + $row->add(new Label('wsd_itemname', $stock->itemname)); + $row->add(new Label('wsd_snumber', $stock->snumber)); + $row->add(new Label('wsd_edate', \App\Helper::fd($stock->sdate))); + $row->add(new Label('wsd_qty', Helper::fqty($stock->qty))); + $row->wsd_edate->setAttribute('class', 'badge badge-danger'); if ($stock->sdate > time()) { - $row->edate->setAttribute('class', 'badge badge-warning'); + $row->wsd_edate->setAttribute('class', 'badge badge-warning'); } } diff --git a/www/app/widgets/wwaited.php b/www/app/widgets/wwaited.php index 6ef1ab08e..bf4503fed 100644 --- a/www/app/widgets/wwaited.php +++ b/www/app/widgets/wwaited.php @@ -58,9 +58,9 @@ public function __construct($id) { public function waitlistOnRow($row) { $item = $row->getDataItem(); - $row->add(new Label('waititem', $item->storename)); - $row->add(new Label('waitstore', $item->itemname)); - $row->add(new Label('waitqty', Helper::fqty($item->qty))); + $row->add(new Label('wwt_waititem', $item->storename)); + $row->add(new Label('wwt_waitstore', $item->itemname)); + $row->add(new Label('wwt_waitqty', Helper::fqty($item->qty))); } } diff --git a/www/templates/lang.json b/www/templates/lang.json index cf710f96c..d2d0b6794 100644 --- a/www/templates/lang.json +++ b/www/templates/lang.json @@ -264,6 +264,7 @@ "noenaughtovar": "Недостаточно товара %s ", "indocalreadyexists": "Уже существует приходный документ ", "thesamestore": "Выбран тот же склад ", + "basedon": "Основание ", "incomebasedon": "Основание %s, склад %s ", "incomebasedonbr": "Основание %s,склад %s,филиал %s ", "createddoc": "Создан документ %s ", diff --git a/www/templates/pages/doc/serviceact.html b/www/templates/pages/doc/serviceact.html index 998276ad4..8f0b9eaed 100644 --- a/www/templates/pages/doc/serviceact.html +++ b/www/templates/pages/doc/serviceact.html @@ -4,10 +4,10 @@
-

Акт выполненых работ +

Заказ (услуги)

diff --git a/www/templates/pages/register/orderlist.html b/www/templates/pages/register/orderlist.html index 7b6ac4315..58d7e24fc 100644 --- a/www/templates/pages/register/orderlist.html +++ b/www/templates/pages/register/orderlist.html @@ -97,6 +97,7 @@

Журнал заказов

+ diff --git a/www/templates/printforms/check.xml b/www/templates/printforms/check.xml index 6a3550473..25966d41e 100644 --- a/www/templates/printforms/check.xml +++ b/www/templates/printforms/check.xml @@ -1,30 +1,30 @@ - + 0 0 - + {{guid}} - + {{edrpou}} {{inn}} - {{firmname}} + {{firmname}} - {{branchname}} + {{branchname}} {{address}} {{date}} {{time}} - - {{docnumber}} - + + {{docnumber}} + {{posinner}} {{posnumber}} @@ -33,47 +33,51 @@ {{username}} 1 - 101234567890123 - - + + {{amount}} - - - - - - {{#pay}} - - - + {{#disc}} + 0 + {{disc}} + {{/disc}} + + + + + {{#pay}} + + {{#pays}} + + {{formcode}} - + {{formname}} - + {{paysum}} - + {{payed}} {{#rest}} {{rest}} {{/rest}} + {{/pays}} + - {{/pay}} - - + {{/pay}} + + - {{#details}} - - - {{name}} - - {{qty}} - {{price}} - - {{cost}} - - {{/details}} - - + {{#details}} + + + {{name}} + + {{qty}} + {{price}} + + {{cost}} + + {{/details}} + + diff --git a/www/templates/printforms/checkback.xml b/www/templates/printforms/checkback.xml index 3753692f7..3090e5d9d 100644 --- a/www/templates/printforms/checkback.xml +++ b/www/templates/printforms/checkback.xml @@ -1,62 +1,76 @@ - + 0 1 - + {{guid}} - + {{edrpou}} - {{inn}} + {{inn}} - {{firmname}} + {{firmname}} - {{branchname}} + {{branchname}} {{address}} {{date}} {{time}} - - {{docnumber}} - + + {{docnumber}} + {{posinner}} {{posnumber}} - {{docnumberback}} + {{docnumberback}} {{username}} 1 - - + + {{amount}} - - - - - + + + + + + + + + - - + {{formcode}} + + {{formname}} + + {{paysum}} + + {{payed}} + + + + + + - {{#details}} - - - {{name}} - - {{qty}} - {{price}} - - {{cost}} - - {{/details}} - - + {{#details}} + + + {{name}} + + {{qty}} + {{price}} + + {{cost}} + + {{/details}} + + diff --git a/www/templates/printforms/checkpay.xml b/www/templates/printforms/checkpay.xml index bead40294..d713efee4 100644 --- a/www/templates/printforms/checkpay.xml +++ b/www/templates/printforms/checkpay.xml @@ -1,30 +1,30 @@ - + - 1 - - + 0 + 0 + {{guid}} - + {{edrpou}} - {{inn}} + {{inn}} - {{firmname}} + {{firmname}} - {{branchname}} + {{branchname}} {{address}} {{date}} {{time}} - - {{docnumber}} - + + {{docnumber}} + {{posinner}} {{posnumber}} @@ -33,43 +33,43 @@ {{username}} 1 - - - + + + {{amount}} - - - - - - {{#pay}} - + + + + + + {{#pay}} + - - {{formcode}} - - {{formname}} - + + {{formcode}} + + {{formname}} + {{paysum}} - - {{payed}} - - + + {{payed}} + + - {{/pay}} - - - - - - ������� �� ���� {{parentcheck}} - + {{/pay}} + + + + + + Доплата по чеку {{parentcheck}} + 1 {{amount}} - + {{amount}} - - - + + + diff --git a/www/templates/printforms/doc/task.tpl b/www/templates/printforms/doc/task.tpl index 1af0245a5..e0f6e5cff 100644 --- a/www/templates/printforms/doc/task.tpl +++ b/www/templates/printforms/doc/task.tpl @@ -21,6 +21,14 @@ {{/baseddoc}} + {{#cust}} + + + Заказчик: {{cust}} + + + + {{/cust}} diff --git a/www/templates/printforms/shift.xml b/www/templates/printforms/shift.xml index 64775a0d4..de83ec5f0 100644 --- a/www/templates/printforms/shift.xml +++ b/www/templates/printforms/shift.xml @@ -21,7 +21,7 @@ {{time}} {{docnumber}} - + {{posinner}} {{posnumber}} diff --git a/www/templates/printforms/zform.xml b/www/templates/printforms/zform.xml index 5fd78b22a..c17348ce8 100644 --- a/www/templates/printforms/zform.xml +++ b/www/templates/printforms/zform.xml @@ -20,23 +20,56 @@ {{time}} {{docnumber}} - - + {{posinner}} + {{posnumber}} - - + {{username}} 1 + {{#isreal}} - 20.00 - 1 + {{amount}} + {{cnt}} + + {{#pays}} + + + {{formcode}} + + {{formname}} + + {{sum}} + + + {{/pays}} + + + {{/isreal}} + + {{#isret}} + + {{amountr}} + {{cntr}} + + {{#paysr}} + + + {{formcode}} + + {{formname}} + + {{sum}} + + + {{/paysr}} + - - + + {{/isret}} diff --git a/www/templates/widgets/wdebitors.html b/www/templates/widgets/wdebitors.html index f2d51525d..d4c26fdee 100644 --- a/www/templates/widgets/wdebitors.html +++ b/www/templates/widgets/wdebitors.html @@ -17,10 +17,10 @@

Документы к оплате Долг - - - - + + + +
diff --git a/www/templates/widgets/wminqty.html b/www/templates/widgets/wminqty.html index 312431b17..6c04bfa77 100644 --- a/www/templates/widgets/wminqty.html +++ b/www/templates/widgets/wminqty.html @@ -18,11 +18,11 @@

Минимальное количество Мин. - - - - - + + + + +
diff --git a/www/templates/widgets/wnoliq.html b/www/templates/widgets/wnoliq.html index 8ef15a3b1..145f2a990 100644 --- a/www/templates/widgets/wnoliq.html +++ b/www/templates/widgets/wnoliq.html @@ -19,10 +19,10 @@

Неликвидные товары - - - - + + + +
diff --git a/www/templates/widgets/wopendocs.html b/www/templates/widgets/wopendocs.html index 565f6cfaf..211eedced 100644 --- a/www/templates/widgets/wopendocs.html +++ b/www/templates/widgets/wopendocs.html @@ -15,10 +15,10 @@

Мои открытые документы Сумма - - - - + + + + diff --git a/www/templates/widgets/wplanneddocs.html b/www/templates/widgets/wplanneddocs.html index 326c383fd..17d8b8c89 100644 --- a/www/templates/widgets/wplanneddocs.html +++ b/www/templates/widgets/wplanneddocs.html @@ -14,9 +14,9 @@

Запланированные документы - - - + + +
diff --git a/www/templates/widgets/wrdoc.html b/www/templates/widgets/wrdoc.html index 11fb350b2..af4d5717f 100644 --- a/www/templates/widgets/wrdoc.html +++ b/www/templates/widgets/wrdoc.html @@ -16,10 +16,10 @@

Мои недавние документы - - - - + + + + diff --git a/www/templates/widgets/wreserved.html b/www/templates/widgets/wreserved.html index 5f10a96cd..ca01025bf 100644 --- a/www/templates/widgets/wreserved.html +++ b/www/templates/widgets/wreserved.html @@ -14,9 +14,9 @@

Зарезервированные товары Кол. - - - + + +
diff --git a/www/templates/widgets/wsdate.html b/www/templates/widgets/wsdate.html index 7580419c7..1f74a8c39 100644 --- a/www/templates/widgets/wsdate.html +++ b/www/templates/widgets/wsdate.html @@ -18,11 +18,11 @@

Просроченные товары

Кол. - - - - - + + + + +
diff --git a/www/templates/widgets/wwaited.html b/www/templates/widgets/wwaited.html index c37152894..0f443164b 100644 --- a/www/templates/widgets/wwaited.html +++ b/www/templates/widgets/wwaited.html @@ -14,9 +14,9 @@

Ожидаемые товары Кол. - - - + + +
diff --git a/www/templates_ua/lang.json b/www/templates_ua/lang.json index 57fdc738e..6e69993f1 100644 --- a/www/templates_ua/lang.json +++ b/www/templates_ua/lang.json @@ -255,6 +255,7 @@ "noenaughtovar": "Недостатньо товару %s ", "indocalreadyexists": "Вже iснує приходний документ ", "thesamestore": "Выбрано той же склад ", + "basedon": "Пiдстава ", "incomebasedon": "Пiдстава %s зi складу %s ", "incomebasedonbr": "Пiдстава %s,склад %s,фiлiя %s ", "createddoc": "Створено документ %s ", diff --git a/www/templates_ua/pages/doc/serviceact.html b/www/templates_ua/pages/doc/serviceact.html index 9b0bcaf77..cd9d3a99e 100644 --- a/www/templates_ua/pages/doc/serviceact.html +++ b/www/templates_ua/pages/doc/serviceact.html @@ -4,10 +4,10 @@ -

Акт виконаних робіт +

Замовлення (послуги)

diff --git a/www/templates_ua/pages/register/orderlist.html b/www/templates_ua/pages/register/orderlist.html index 4ce60062b..44fd50e56 100644 --- a/www/templates_ua/pages/register/orderlist.html +++ b/www/templates_ua/pages/register/orderlist.html @@ -98,6 +98,7 @@

Журнал замовлень

рахунок-фактуру + diff --git a/www/templates_ua/printforms/doc/task.tpl b/www/templates_ua/printforms/doc/task.tpl index 590c6bd0b..b76a9fdc5 100644 --- a/www/templates_ua/printforms/doc/task.tpl +++ b/www/templates_ua/printforms/doc/task.tpl @@ -21,7 +21,15 @@ {{/baseddoc}} + + {{#cust}} + + + Замовник: {{cust}} + + + {{/cust}} diff --git a/www/templates_ua/widgets/wdebitors.html b/www/templates_ua/widgets/wdebitors.html index 289c868ae..b0c5c888e 100644 --- a/www/templates_ua/widgets/wdebitors.html +++ b/www/templates_ua/widgets/wdebitors.html @@ -17,10 +17,10 @@

Документи до оплати Борг - - - - + + + +
diff --git a/www/templates_ua/widgets/wminqty.html b/www/templates_ua/widgets/wminqty.html index 34cfad3a3..9941ea693 100644 --- a/www/templates_ua/widgets/wminqty.html +++ b/www/templates_ua/widgets/wminqty.html @@ -18,11 +18,11 @@

Мінімальна кількістьМін. - - - - - + + + + +
diff --git a/www/templates_ua/widgets/wnoliq.html b/www/templates_ua/widgets/wnoliq.html index 211a352e2..764037a38 100644 --- a/www/templates_ua/widgets/wnoliq.html +++ b/www/templates_ua/widgets/wnoliq.html @@ -19,10 +19,10 @@

Неліквідні товари - - - - + + + +
diff --git a/www/templates_ua/widgets/wopendocs.html b/www/templates_ua/widgets/wopendocs.html index 19de1dc00..666d582d8 100644 --- a/www/templates_ua/widgets/wopendocs.html +++ b/www/templates_ua/widgets/wopendocs.html @@ -15,10 +15,10 @@

Мої відкриті документи Сума - - - - + + + + diff --git a/www/templates_ua/widgets/wplanneddocs.html b/www/templates_ua/widgets/wplanneddocs.html index 29c606a44..c6a0f2fe7 100644 --- a/www/templates_ua/widgets/wplanneddocs.html +++ b/www/templates_ua/widgets/wplanneddocs.html @@ -14,9 +14,9 @@

Заплановані документи Дата - - - + + +
diff --git a/www/templates_ua/widgets/wrdoc.html b/www/templates_ua/widgets/wrdoc.html index 84c6ae1dc..4d8ff418a 100644 --- a/www/templates_ua/widgets/wrdoc.html +++ b/www/templates_ua/widgets/wrdoc.html @@ -16,10 +16,10 @@

Моi недавні документи - - - - + + + + diff --git a/www/templates_ua/widgets/wreserved.html b/www/templates_ua/widgets/wreserved.html index 71c9e9e1c..9bac5b4dc 100644 --- a/www/templates_ua/widgets/wreserved.html +++ b/www/templates_ua/widgets/wreserved.html @@ -14,9 +14,9 @@

Зарезервовані товари Кіл. - - - + + +
diff --git a/www/templates_ua/widgets/wsdate.html b/www/templates_ua/widgets/wsdate.html index b1efec5ca..5e65d669d 100644 --- a/www/templates_ua/widgets/wsdate.html +++ b/www/templates_ua/widgets/wsdate.html @@ -18,11 +18,11 @@

Прострочені товари

Кіл. - - - - - + + + + +
diff --git a/www/templates_ua/widgets/wwaited.html b/www/templates_ua/widgets/wwaited.html index c4ab8a51b..6d81b2277 100644 --- a/www/templates_ua/widgets/wwaited.html +++ b/www/templates_ua/widgets/wwaited.html @@ -14,9 +14,9 @@

Очікувані товари Кіл. - - - + + +
From 689d4975827443abe1c015fb077f9c7252144971 Mon Sep 17 00:00:00 2001 From: "HOME\\leonm" Date: Wed, 16 Dec 2020 22:16:53 +0200 Subject: [PATCH 04/11] fix --- www/app/modules/ppo/helper.php | 4 + www/app/modules/ppo/ppohelper.php | 4 + www/app/modules/ppo/ppolist.php | 1 + www/app/pages/options.php | 1 + www/app/pages/reference/itemlist.php | 10 +- www/composer.json | 1 + www/composer.lock | 601 ++++++++++++++++++++++++++- www/templates/pages/base.html | 2 +- www/templates_ua/pages/base.html | 2 +- 9 files changed, 618 insertions(+), 8 deletions(-) diff --git a/www/app/modules/ppo/helper.php b/www/app/modules/ppo/helper.php index 9ab7b28bb..d3b368ed5 100644 --- a/www/app/modules/ppo/helper.php +++ b/www/app/modules/ppo/helper.php @@ -98,6 +98,10 @@ public static function decrypt($data, $cid) { public static function send($data, $type, $cid, $encrypted = false) { $signed = Helper::sign($data, $cid); + if(strlen($signed['data'])==0){ + return array('success'=>false,'data'=>'Неверный ответ сервера подписи'); + + } if ($signed['success'] == true) { diff --git a/www/app/modules/ppo/ppohelper.php b/www/app/modules/ppo/ppohelper.php index 6393a3f34..0f69b4d76 100644 --- a/www/app/modules/ppo/ppohelper.php +++ b/www/app/modules/ppo/ppohelper.php @@ -98,6 +98,10 @@ public static function decrypt($data, $server,$port) { public static function send($data, $type, $server,$port, $encrypted = false) { $signed = self::sign($data, $server,$port); + if(strlen($signed['data'])==0){ + return array('success'=>false,'data'=>'Неверный ответ сервера подписи'); + + } if ($signed['success'] == true) { diff --git a/www/app/modules/ppo/ppolist.php b/www/app/modules/ppo/ppolist.php index 48dcf600e..e833f4017 100644 --- a/www/app/modules/ppo/ppolist.php +++ b/www/app/modules/ppo/ppolist.php @@ -75,6 +75,7 @@ public function filterOnSubmit($sender) { $this->setError($res['data']); return; } + $res = json_decode($res['data']); if (is_array($res->TaxObjects)) { $this->_ppolist = array(); diff --git a/www/app/pages/options.php b/www/app/pages/options.php index 80250510b..19a7e7a58 100644 --- a/www/app/pages/options.php +++ b/www/app/pages/options.php @@ -183,6 +183,7 @@ public function saveCommonOnClick($sender) { $common['price3'] = $this->common->price3->getText(); $common['price4'] = $this->common->price4->getText(); $common['price5'] = $this->common->price5->getText(); + $common['defprice'] = $this->common->defprice->getText(); $common['shopname'] = $this->common->shopname->getText(); $common['ts_break'] = $this->common->ts_break->getText(); $common['ts_start'] = $this->common->ts_start->getText(); diff --git a/www/app/pages/reference/itemlist.php b/www/app/pages/reference/itemlist.php index e312dc549..c732f3d3b 100644 --- a/www/app/pages/reference/itemlist.php +++ b/www/app/pages/reference/itemlist.php @@ -142,19 +142,19 @@ public function itemlistOnRow($row) { $row->add(new Label('manufacturer', $item->manufacturer)); $plist = array(); if ($item->price1 > 0) { - $plist[] = H::fa($item->price1); + $plist[] = $item->price1 ; } if ($item->price2 > 0) { - $plist[] = H::fa($item->price2); + $plist[] = $item->price2 ; } if ($item->price3 > 0) { - $plist[] = H::fa($item->price3); + $plist[] = $item->price3 ; } if ($item->price4 > 0) { - $plist[] = H::fa($item->price4); + $plist[] = $item->price4 ; } if ($item->price5 > 0) { - $plist[] = H::fa($item->price5); + $plist[] = $item->price5 ; } $row->add(new Label('price', implode(', ', $plist))); $row->add(new Label('hasnotes'))->setVisible(strlen($item->description) > 0); diff --git a/www/composer.json b/www/composer.json index 8933b75c7..0f6df8b53 100644 --- a/www/composer.json +++ b/www/composer.json @@ -13,6 +13,7 @@ "picqer/php-barcode-generator": "v0.3", "masterexploder/phpthumb" :"*", + "lemmon/fetch" :"v0.3.0", "automattic/woocommerce": "3.0.0", diff --git a/www/composer.lock b/www/composer.lock index 8172f7df1..77c5f7b72 100644 --- a/www/composer.lock +++ b/www/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "b169fd20e0bc5c02170932c28e4fa769", + "content-hash": "3892d58badc0f38c63af39182780a7fa", "packages": [ { "name": "adodb/adodb-php", @@ -236,6 +236,261 @@ }, "time": "2017-06-27T22:17:23+00:00" }, + { + "name": "guzzlehttp/guzzle", + "version": "6.5.5", + "source": { + "type": "git", + "url": "https://github.com/guzzle/guzzle.git", + "reference": "9d4290de1cfd701f38099ef7e183b64b4b7b0c5e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/9d4290de1cfd701f38099ef7e183b64b4b7b0c5e", + "reference": "9d4290de1cfd701f38099ef7e183b64b4b7b0c5e", + "shasum": "" + }, + "require": { + "ext-json": "*", + "guzzlehttp/promises": "^1.0", + "guzzlehttp/psr7": "^1.6.1", + "php": ">=5.5", + "symfony/polyfill-intl-idn": "^1.17.0" + }, + "require-dev": { + "ext-curl": "*", + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0", + "psr/log": "^1.1" + }, + "suggest": { + "psr/log": "Required for using the Log middleware" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.5-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Guzzle is a PHP HTTP client library", + "homepage": "http://guzzlephp.org/", + "keywords": [ + "client", + "curl", + "framework", + "http", + "http client", + "rest", + "web service" + ], + "support": { + "issues": "https://github.com/guzzle/guzzle/issues", + "source": "https://github.com/guzzle/guzzle/tree/6.5" + }, + "time": "2020-06-16T21:01:06+00:00" + }, + { + "name": "guzzlehttp/promises", + "version": "1.4.0", + "source": { + "type": "git", + "url": "https://github.com/guzzle/promises.git", + "reference": "60d379c243457e073cff02bc323a2a86cb355631" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/promises/zipball/60d379c243457e073cff02bc323a2a86cb355631", + "reference": "60d379c243457e073cff02bc323a2a86cb355631", + "shasum": "" + }, + "require": { + "php": ">=5.5" + }, + "require-dev": { + "symfony/phpunit-bridge": "^4.4 || ^5.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Promise\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Guzzle promises library", + "keywords": [ + "promise" + ], + "support": { + "issues": "https://github.com/guzzle/promises/issues", + "source": "https://github.com/guzzle/promises/tree/1.4.0" + }, + "time": "2020-09-30T07:37:28+00:00" + }, + { + "name": "guzzlehttp/psr7", + "version": "1.7.0", + "source": { + "type": "git", + "url": "https://github.com/guzzle/psr7.git", + "reference": "53330f47520498c0ae1f61f7e2c90f55690c06a3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/53330f47520498c0ae1f61f7e2c90f55690c06a3", + "reference": "53330f47520498c0ae1f61f7e2c90f55690c06a3", + "shasum": "" + }, + "require": { + "php": ">=5.4.0", + "psr/http-message": "~1.0", + "ralouphie/getallheaders": "^2.0.5 || ^3.0.0" + }, + "provide": { + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "ext-zlib": "*", + "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.8 || ^9.3.10" + }, + "suggest": { + "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.7-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Psr7\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Tobias Schultze", + "homepage": "https://github.com/Tobion" + } + ], + "description": "PSR-7 message implementation that also provides common utility methods", + "keywords": [ + "http", + "message", + "psr-7", + "request", + "response", + "stream", + "uri", + "url" + ], + "support": { + "issues": "https://github.com/guzzle/psr7/issues", + "source": "https://github.com/guzzle/psr7/tree/1.7.0" + }, + "time": "2020-09-30T07:37:11+00:00" + }, + { + "name": "lemmon/fetch", + "version": "v0.3.0", + "source": { + "type": "git", + "url": "https://github.com/lemmon/fetch-php.git", + "reference": "974f812893f2316b6923c6fe2a776ab159a884c6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/lemmon/fetch-php/zipball/974f812893f2316b6923c6fe2a776ab159a884c6", + "reference": "974f812893f2316b6923c6fe2a776ab159a884c6", + "shasum": "" + }, + "require": { + "guzzlehttp/guzzle": "^6.3", + "php": ">=7.0" + }, + "type": "library", + "autoload": { + "files": [ + "src/Fetch/fetch.php", + "src/fetch.php" + ], + "psr-4": { + "Fetch\\": "src/Fetch/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jakub Pelák", + "homepage": "https://github.com/lemmon" + } + ], + "description": "JavaScript's fetch() implementation on top of Guzzle", + "keywords": [ + "client", + "curl", + "framework", + "http", + "http client", + "rest", + "web service" + ], + "support": { + "issues": "https://github.com/lemmon/fetch-php/issues", + "source": "https://github.com/lemmon/fetch-php/tree/master" + }, + "time": "2019-11-22T16:25:43+00:00" + }, { "name": "leon-mbs/phpquery", "version": "1.0.0", @@ -886,6 +1141,59 @@ }, "time": "2019-01-12T09:29:34+00:00" }, + { + "name": "psr/http-message", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message.git", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP messages", + "homepage": "https://github.com/php-fig/http-message", + "keywords": [ + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" + ], + "support": { + "source": "https://github.com/php-fig/http-message/tree/master" + }, + "time": "2016-08-06T14:39:51+00:00" + }, { "name": "psr/log", "version": "1.1.3", @@ -936,6 +1244,50 @@ }, "time": "2020-03-23T09:12:05+00:00" }, + { + "name": "ralouphie/getallheaders", + "version": "3.0.3", + "source": { + "type": "git", + "url": "https://github.com/ralouphie/getallheaders.git", + "reference": "120b605dfeb996808c31b6477290a714d356e822" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822", + "reference": "120b605dfeb996808c31b6477290a714d356e822", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "require-dev": { + "php-coveralls/php-coveralls": "^2.1", + "phpunit/phpunit": "^5 || ^6.5" + }, + "type": "library", + "autoload": { + "files": [ + "src/getallheaders.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ralph Khattar", + "email": "ralph.khattar@gmail.com" + } + ], + "description": "A polyfill for getallheaders.", + "support": { + "issues": "https://github.com/ralouphie/getallheaders/issues", + "source": "https://github.com/ralouphie/getallheaders/tree/develop" + }, + "time": "2019-03-08T08:55:37+00:00" + }, { "name": "roave/security-advisories", "version": "dev-master", @@ -1306,6 +1658,177 @@ }, "time": "2020-06-01T09:10:00+00:00" }, + { + "name": "symfony/polyfill-intl-idn", + "version": "v1.20.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-idn.git", + "reference": "3b75acd829741c768bc8b1f84eb33265e7cc5117" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/3b75acd829741c768bc8b1f84eb33265e7cc5117", + "reference": "3b75acd829741c768bc8b1f84eb33265e7cc5117", + "shasum": "" + }, + "require": { + "php": ">=7.1", + "symfony/polyfill-intl-normalizer": "^1.10", + "symfony/polyfill-php72": "^1.10" + }, + "suggest": { + "ext-intl": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.20-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Intl\\Idn\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Laurent Bassin", + "email": "laurent@bassin.info" + }, + { + "name": "Trevor Rowbotham", + "email": "trevor.rowbotham@pm.me" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "idn", + "intl", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.20.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-10-23T14:02:19+00:00" + }, + { + "name": "symfony/polyfill-intl-normalizer", + "version": "v1.20.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-normalizer.git", + "reference": "727d1096295d807c309fb01a851577302394c897" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/727d1096295d807c309fb01a851577302394c897", + "reference": "727d1096295d807c309fb01a851577302394c897", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "suggest": { + "ext-intl": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.20-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Intl\\Normalizer\\": "" + }, + "files": [ + "bootstrap.php" + ], + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for intl's Normalizer class and related functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "intl", + "normalizer", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.20.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-10-23T14:02:19+00:00" + }, { "name": "symfony/polyfill-mbstring", "version": "v1.20.0", @@ -1386,6 +1909,82 @@ ], "time": "2020-10-23T14:02:19+00:00" }, + { + "name": "symfony/polyfill-php72", + "version": "v1.20.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php72.git", + "reference": "cede45fcdfabdd6043b3592e83678e42ec69e930" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/cede45fcdfabdd6043b3592e83678e42ec69e930", + "reference": "cede45fcdfabdd6043b3592e83678e42ec69e930", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.20-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php72\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php72/tree/v1.20.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-10-23T14:02:19+00:00" + }, { "name": "symfony/polyfill-php80", "version": "v1.20.0", diff --git a/www/templates/pages/base.html b/www/templates/pages/base.html index a11ce0fe3..6a4b2f1e0 100644 --- a/www/templates/pages/base.html +++ b/www/templates/pages/base.html @@ -236,7 +236,7 @@

- Журналы документов + Журналы

diff --git a/www/templates_ua/pages/base.html b/www/templates_ua/pages/base.html index b086d4cd7..ad914d94b 100644 --- a/www/templates_ua/pages/base.html +++ b/www/templates_ua/pages/base.html @@ -237,7 +237,7 @@

- Журнали документів + Журнали

From e0ca1eefac500a7bd9bafe7451075db6f0a8250c Mon Sep 17 00:00:00 2001 From: "HOME\\leonm" Date: Tue, 22 Dec 2020 08:49:25 +0200 Subject: [PATCH 05/11] ppo --- www/app/entity/doc/poscheck.php | 2 + www/app/entity/firm.php | 8 +- www/app/entity/itemset.php | 2 +- www/app/entity/pos.php | 19 +- www/app/modules/ppo/helper.php | 340 ------------------ www/app/modules/ppo/ppohelper.php | 315 ++++++++-------- www/app/modules/ppo/ppolist.php | 20 +- www/app/modules/ppo/zform.php | 9 + www/app/pages/base.php | 3 + www/app/pages/doc/returnissue.php | 2 +- www/app/pages/firmlist.php | 9 +- www/app/pages/poslist.php | 11 +- www/app/pages/service/armpos.php | 200 ++++++++--- www/app/util.php | 17 + www/composer.json | 47 +-- www/composer.lock | 70 +++- www/templates/lang.json | 9 +- www/templates/modules/ppo/ppolist.html | 3 +- www/templates/modules/ppo/zform.html | 28 ++ www/templates/pages/base.html | 6 + www/templates/pages/firmlist.html | 10 +- www/templates/pages/poslist.html | 16 +- www/templates/pages/service/armpos.html | 63 +++- www/templates/printforms/check.xml | 6 +- www/templates/printforms/checkback.xml | 6 +- www/templates/printforms/checkpay.xml | 6 +- .../printforms/doc/poscheck_bill.tpl | 5 + www/templates/printforms/shift.xml | 10 +- www/templates/printforms/zform.xml | 6 +- www/templates_ua/lang.json | 8 +- www/templates_ua/pages/base.html | 6 + www/templates_ua/pages/firmlist.html | 12 +- www/templates_ua/pages/poslist.html | 12 +- www/templates_ua/pages/service/armpos.html | 11 +- www/templates_ua/pages/service/export.html | 120 ++++++- .../printforms/doc/poscheck_bill.tpl | 6 + 36 files changed, 739 insertions(+), 684 deletions(-) delete mode 100644 www/app/modules/ppo/helper.php create mode 100644 www/app/modules/ppo/zform.php create mode 100644 www/templates/modules/ppo/zform.html diff --git a/www/app/entity/doc/poscheck.php b/www/app/entity/doc/poscheck.php index 47e059d3b..0365587e5 100644 --- a/www/app/entity/doc/poscheck.php +++ b/www/app/entity/doc/poscheck.php @@ -112,7 +112,9 @@ public function generatePosReport() { "address" => $firm["address"], "phone" => $firm["phone"], "inn" => $firm["inn"], + "inn" => $firm["inn"], "customer_name" => strlen($this->headerdata["customer_name"]) > 0 ? $this->headerdata["customer_name"] : false, + "fiscalnumber" => strlen($this->headerdata["fiscalnumber"])>0 ? $this->headerdata["fiscalnumber"] : false, "exchange" => $this->headerdata["exchange"], "pos_name" => $this->headerdata["pos_name"], "time" => H::fdt($this->headerdata["time"]), diff --git a/www/app/entity/firm.php b/www/app/entity/firm.php index 46c76bdcb..535a385cc 100644 --- a/www/app/entity/firm.php +++ b/www/app/entity/firm.php @@ -21,12 +21,14 @@ protected function afterLoad() { $this->address = (string)($xml->address[0]); $this->inn = (string)($xml->inn[0]); + $this->phone = (string)($xml->phone[0]); $this->logo = (string)($xml->logo[0]); $this->stamp = (string)($xml->stamp[0]); $this->sign = (string)($xml->sign[0]); - $this->pposerv = (string)($xml->pposerv[0]); + $this->pposerver = (string)($xml->pposerver[0]); + $this->pposerverport = (string)($xml->pposerverport[0]); $this->tin = (string)($xml->edittin[0]); parent::afterLoad(); @@ -41,8 +43,10 @@ protected function beforeSave() { $this->details .= "stamp}]]>"; $this->details .= "sign}]]>"; $this->details .= "{$this->inn}"; + $this->details .= "{$this->phone}"; - $this->details .= "{$this->pposerv}"; + $this->details .= "{$this->pposerver}"; + $this->details .= "{$this->pposerverport}"; $this->details .= "{$this->tin}"; $this->details .= ""; diff --git a/www/app/entity/itemset.php b/www/app/entity/itemset.php index 43e230251..c88f8ca0f 100644 --- a/www/app/entity/itemset.php +++ b/www/app/entity/itemset.php @@ -3,7 +3,7 @@ namespace App\Entity; /** - * Клас-сущность комплект ТМЦ + * Класc-сущность комплект ТМЦ * * @table=item_set * @view=item_set_view diff --git a/www/app/entity/pos.php b/www/app/entity/pos.php index 749a81f93..4e6abf501 100644 --- a/www/app/entity/pos.php +++ b/www/app/entity/pos.php @@ -22,16 +22,17 @@ protected function beforeSave() { $this->details = "
"; $this->details .= "comment}]]>"; + $this->details .= "
address}]]>
"; $this->details .= "{$this->pricetype}"; $this->details .= "{$this->mf}"; $this->details .= "{$this->store}"; - $this->details .= "{$this->fisc}"; + $this->details .= "{$this->fiscalnumber}"; + $this->details .= "{$this->fiscallocnumber}"; $this->details .= "{$this->fiscdocnumber}"; - $this->details .= "{$this->posinner}"; + + $this->details .= "{$this->usefisc}"; - $this->details .= "{$this->openshift}"; - $this->details .= "{$this->closeshift}"; $this->details .= "
"; return true; @@ -45,13 +46,13 @@ protected function afterLoad() { $this->pricetype = (string)($xml->pricetype[0]); $this->store = (int)($xml->store[0]); $this->comment = (string)($xml->comment[0]); + $this->address = (string)($xml->address[0]); + $this->fiscalnumber = (string)($xml->fiscalnumber[0]); + $this->fiscallocnumber = (int)($xml->fiscallocnumber[0]); $this->fiscdocnumber = (int)($xml->fiscdocnumber[0]); - $this->fisc = (string)($xml->fisc[0]); - $this->posinner = (string)($xml->posinner[0]); + $this->usefisc = (int)($xml->usefisc[0]); - $this->openshift = (int)($xml->openshift[0]); - $this->opencloseshiftshift = (int)($xml->closeshift[0]); - + if(strlen($this->fiscdocnumber)==0)$this->fiscdocnumber=1; parent::afterLoad(); } diff --git a/www/app/modules/ppo/helper.php b/www/app/modules/ppo/helper.php deleted file mode 100644 index d3b368ed5..000000000 --- a/www/app/modules/ppo/helper.php +++ /dev/null @@ -1,340 +0,0 @@ -pposerv); - - - $request = curl_init(); - - curl_setopt_array($request, [ - CURLOPT_PORT => $ap[1], - CURLOPT_URL => "{$ap[0]}:{$ap[1]}/sign", - CURLOPT_POST => true, - CURLOPT_ENCODING => "", - CURLOPT_MAXREDIRS => 10, - CURLOPT_RETURNTRANSFER => true, - CURLOPT_CONNECTTIMEOUT => 20, - CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, - CURLOPT_POSTFIELDS => $data - ]); - - $ret = curl_exec($request); - if (curl_errno($request) > 0) { - - return array('success'=>false,'data'=>'Curl error: ' . curl_error($request)); - - } - - curl_close($request); - $ret = json_decode($ret,true); - - - return array('success'=>true,'data'=>base64_decode($ret['data'])); - - } - - public static function decrypt($data, $cid) { - $c = \App\Entity\Firm::load($cid); - - - $ap = explode(':', $c->pposerv); - - - $request = curl_init(); - - curl_setopt_array($request, [ - CURLOPT_PORT => $ap[1], - CURLOPT_URL => "{$ap[0]}:{$ap[1]}/decrypt", - CURLOPT_POST => true, - CURLOPT_ENCODING => "", - CURLOPT_MAXREDIRS => 10, - CURLOPT_RETURNTRANSFER => true, - CURLOPT_CONNECTTIMEOUT => 20, - CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, - CURLOPT_POSTFIELDS => base64_encode($data) - ]); - - - - if (curl_errno($request) > 0) { - return array('success'=>false,'data'=>'Curl error: ' . curl_error($request)); - - - } - $ret = (curl_exec($request)); - - curl_close($request); - $data = json_decode($ret,true); - return array('success'=>true,'data'=>base64_decode($data['data'])); - - } - - - public static function send($data, $type, $cid, $encrypted = false) { - - $signed = Helper::sign($data, $cid); - if(strlen($signed['data'])==0){ - return array('success'=>false,'data'=>'Неверный ответ сервера подписи'); - - } - if ($signed['success'] == true) { - - - $request = curl_init(); - - - - curl_setopt_array($request, [ - CURLOPT_URL => "http://80.91.165.208:8609/fs/{$type}", - CURLOPT_POST => true, - CURLOPT_HEADER => false, - CURLOPT_HTTPHEADER => array('Content-Type: application/octet-stream', "Content-Length: " . strlen($signed['data'])), - CURLOPT_ENCODING => "", - CURLOPT_RETURNTRANSFER => true, - CURLOPT_CONNECTTIMEOUT => 20, - CURLOPT_VERBOSE => 1, - CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, - CURLOPT_POSTFIELDS => $signed['data'] - ]); - - $return = curl_exec($request); - - if (curl_errno($request) > 0) { - return array('success'=>false,'data'=>'Curl error: ' . curl_error($request)); - } - curl_close($request); - - if (strpos($return, 'Номер документа повинен дорівнювати') > 0) { - $arr = explode(' ',$return); - if($arr[count($arr) - 1] > 0) { - return array('success'=>false, 'docnumber'=>$arr[count($arr) - 1],'data'=>$return); - } - - - } - if (strpos($return, 'помилки') > 0) { - - return array('success'=>false,'data'=>$return); - - } - - //декодируем подписаный ответ - if ($encrypted) { - - $decrypted = Helper::decrypt($return, $cid); - - if ($decrypted['success'] == true ) { - //если вернул xml - if(substr($decrypted['data'] ,0,5)=="ERRORCODE[0]); - $taxnum = (string) ($xml->ORDERTAXNUM[0]); - - if($errorcode=='0' && $taxnum>0) //следующий номер документа - { - return array('success'=>true, 'docnumber'=>$taxnum,'data'=>$return); - - } - return array('success'=>false, 'data'=>$errorcode); - - } - - - - return array('success'=>true,'data'=> $decrypted['data'] ); - } else { - return array('success'=>false,'data'=>$decrypted['data']); - } - - } else { - return array('success'=>true,'data'=>$return); ; - } - - - } else { - return array('success'=>false,'data'=>$signed['data']); - - - } - - - } - - - public static function shift($cid, $posid, $open) { - $pos = \App\Entity\Pos::load($posid); - - $branch_id = \App\Session::getSession()->branch_id; - $firm = \App\Helper::getFirmData($cid ); - $branch = \App\Entity\Branch::load($branch_id); - - $header = array(); - $header['doctype'] = $open == true ? 100 : 101; - $header['firmname'] = $firm['firmname']; - $header['inn'] = $firm['inn']; - $header['edrpou'] = $firm['tin']; - $header['address'] = $firm['address']; - $header['branchname'] = strlen($branch->branch_name) > 0 ? $branch->branch_name : $firm['firmname']; - $header['date'] = date('dmY'); - $header['time'] = date('His'); - $header['docnumber'] = $pos->fiscdocnumber; - $header['posinner'] = $pos->posinner; - $header['posnumber'] = $pos->fisc; - $header['username'] = \App\System::getUser()->username; - $header['guid'] = Helper::guid(); - - - $report = new \App\Report('shift.xml'); - - $xml = $report->generate($header); - - - $xml = mb_convert_encoding($xml, "windows-1251", "utf-8"); - - - return Helper::send($xml, 'doc', $cid, true); - - - } - public static function zform($cid, $posid ) { - $pos = \App\Entity\Pos::load($posid); - - $branch_id = \App\Session::getSession()->branch_id; - $firm = \App\Helper::getFirmData($cid ); - $branch = \App\Entity\Branch::load($branch_id); - - $header = array(); - $header['doctype'] = $open == true ? 100 : 101; - $header['firmname'] = $firm['firmname']; - $header['inn'] = $firm['inn']; - $header['edrpou'] = $firm['tin']; - $header['address'] = $firm['address']; - $header['branchname'] = strlen($branch->branch_name) > 0 ? $branch->branch_name : $firm['firmname']; - $header['date'] = date('dmY'); - $header['time'] = date('His'); - $header['docnumber'] = $pos->fiscdocnumber; - $header['posinner'] = $pos->posinner; - $header['posnumber'] = $pos->fisc; - $header['username'] = \App\System::getUser()->username; - $header['guid'] = Helper::guid(); - - - $report = new \App\Report('zform.xml'); - - $xml = $report->generate($header); - - return Helper::send($xml, 'doc', $cid, true); - - } - - public static function check($cid, $posid ) { - $pos = \App\Entity\Pos::load($posid); - - $branch_id = \App\Session::getSession()->branch_id; - $firm = \App\Helper::getFirmData($cid, $branch_id); - $branch = \App\Entity\Branch::load($branch_id); - - $header = array(); - - $header['firmname'] = $firm['firmname']; - $header['inn'] = $firm['inn']; - $header['edrpou'] = $firm['tin']; - $header['address'] = $firm['address']; - $header['branchname'] = strlen($branch->branch_name) > 0 ? $branch->branch_name : $firm['firmname']; - $header['date'] = date('dmY'); - $header['time'] = date('His'); - $header['docnumber'] = $pos->fiscdocnumber; - $header['posinner'] = $pos->posinner; - $header['posnumber'] = $pos->fisc; - $header['username'] = \App\System::getUser()->username; - $header['guid'] = Helper::guid(); - $header['formname'] = 'Готiвка'; - $header['formcode'] = 0; - if ($doc->headerdata['payform'] == 1) { - $header['formname'] = 'Банкiвська картка'; - $header['formcode'] = 1; - } - - $header['pay'] = $doc->payamount > 0; - $header['paysum'] = number_format($doc->payamount, 2, '.', '') ; - $header['payed'] = number_format($doc->payed, 2, '.', '') ; - $header['rest'] = $doc->headerdata["exchange"] >0 ? number_format($doc->headerdata["exchange"], 2, '.', '') : false; - if($doc->payed < $doc->payamount) { - $header['paysum'] = number_format($doc->payed, 2, '.', '') ; - $header['payed'] = number_format($doc->payed, 2, '.', '') ; - $header['rest'] = false; - } - - - $header['disc'] = $doc->headerdata["paydisc"] >0 ? number_format($doc->headerdata["paydisc"], 2, '.', '') : false; - $header['details'] = array(); - $n=1; - $disc=1; - if($doc->headerdata["paydisc"] >0 ) { - $disc = 1 - ($doc->headerdata["paydisc"]/$doc->amount); - - } - $header['amount'] =0; - foreach ($doc->unpackDetails('detaildata') as $item) { - $header['details'][] = array( - 'num'=>"ROWNUM=\"{$n}\"", - 'name'=> $item->itemname , - 'qty'=> number_format($item->quantity , 3, '.', '') , - 'price'=> number_format($item->price*$disc , 2, '.', ''), - 'cost'=> number_format($item->quantity*$item->price*$disc , 2, '.', '') - ) ; - $n++; - $header['amount'] = $header['amount']+ $item->quantity*$item->price*$disc; - } - foreach ($doc->unpackDetails('services') as $item) { - $header['details'][] = array( - 'num'=>"ROWNUM=\"{$n}\"", - 'name'=> $item->service_name , - 'qty'=> number_format($item->quantity , 3, '.', '') , - 'price'=> number_format($item->price*$disc , 2, '.', ''), - 'cost'=> number_format($item->quantity*$item->price*$disc , 2, '.', '') - ) ; - $n++; - $header['amount'] = $header['amount']+ $item->quantity*$item->price*$disc; - } - - - $header['amount'] = number_format($header['amount'], 2, '.', ''); - - $report = new \App\Report('check.xml'); - - $xml = $report->generate($header); - - return Helper::send($xml, 'doc', $cid, true); - - } - -} \ No newline at end of file diff --git a/www/app/modules/ppo/ppohelper.php b/www/app/modules/ppo/ppohelper.php index 0f69b4d76..e626c557f 100644 --- a/www/app/modules/ppo/ppohelper.php +++ b/www/app/modules/ppo/ppohelper.php @@ -2,38 +2,22 @@ namespace App\Modules\PPO; +use \App\Helper as H; /** * Вспомагательный класс */ class PPOHelper { - - const DPI_SERVER="http://80.91.165.208:8609/fs/" ; - const PAY_NAL='Готiвка' ; - const PAY_BEZNAL='Банкiвська картка' ; - const PAY_CREDIT='В кредит' ; - const PAY_PREPAID='Передплата' ; + const DPI ="http://80.91.165.208:8609/fs/"; - public static function guid() { - - if (function_exists('com_create_guid') === true) { - return trim(com_create_guid(), '{}'); - } - - $data = openssl_random_pseudo_bytes(16); - $data[6] = chr(ord($data[6]) & 0x0f | 0x40); // set version to 0100 - $data[8] = chr(ord($data[8]) & 0x3f | 0x80); // set bits 6-7 to 10 - return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4)); - - } public static function sign($data, $server,$port) { + $server = rtrim($server,'/') ; - $request = curl_init(); curl_setopt_array($request, [ @@ -70,7 +54,7 @@ public static function decrypt($data, $server,$port) { curl_setopt_array($request, [ CURLOPT_PORT => $port, - CURLOPT_URL => "{$server}:{$port}/sign", + CURLOPT_URL => "{$server}:{$port}/decrypt", CURLOPT_POST => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, @@ -95,22 +79,20 @@ public static function decrypt($data, $server,$port) { } - public static function send($data, $type, $server,$port, $encrypted = false) { + public static function send($data, $type, $server,$port, $encrypted ) { $signed = self::sign($data, $server,$port); if(strlen($signed['data'])==0){ - return array('success'=>false,'data'=>'Неверный ответ сервера подписи'); - - } + return array('success'=>false,'data'=> 'Неверный ответ сервера подписи'); + } + if ($signed['success'] == true) { $request = curl_init(); - - - + curl_setopt_array($request, [ - CURLOPT_URL => self::DPI_SERVER.$type, + CURLOPT_URL => self::DPI.$type, CURLOPT_POST => true, CURLOPT_HEADER => false, CURLOPT_HTTPHEADER => array('Content-Type: application/octet-stream', "Content-Length: " . strlen($signed['data'])), @@ -157,18 +139,17 @@ public static function send($data, $type, $server,$port, $encrypted = false) { $xml = simplexml_load_string($xml); $errorcode = (string) ($xml->ERRORCODE[0]); $taxnum = (string) ($xml->ORDERTAXNUM[0]); + $taxnumloc = (string) ($xml->ORDERNUM[0]); if($errorcode=='0' && $taxnum>0) //следующий номер документа { - return array('success'=>true, 'docnumber'=>$taxnum,'data'=>$return); + return array('success'=>true, 'docnumber'=>$taxnum,'doclocnumber'=>$taxnumloc,'data'=>$return); } return array('success'=>false, 'data'=>$errorcode); } - - - + return array('success'=>true,'data'=> $decrypted['data'] ); } else { return array('success'=>false,'data'=>$decrypted['data']); @@ -181,73 +162,68 @@ public static function send($data, $type, $server,$port, $encrypted = false) { } else { return array('success'=>false,'data'=>$signed['data']); - - } - - + } - public static function shift($cid, $posid, $open) { + public static function shift($cid, $posid, $open) { + $pos = \App\Entity\Pos::load($posid); - - $branch_id = \App\Session::getSession()->branch_id; - $firm = \App\Helper::getFirmData($cid ); - $branch = \App\Entity\Branch::load($branch_id); - + + $firm = \App\Helper::getFirmData($cid,$pos->branch_id); + $branch = \App\Entity\Branch::load($pos->branch_id); + $header = array(); $header['doctype'] = $open == true ? 100 : 101; - $header['firmname'] = $firm['firmname']; - $header['inn'] = $firm['inn']; - $header['edrpou'] = $firm['edrpou']; - $header['address'] = $firm['address']; - $header['branchname'] = strlen($branch->branch_name) > 0 ? $branch->branch_name : $firm['firmname']; + $header['firmname'] = $firm['firm_name']; + $header['inn'] = strlen($firm['inn'])>0 ? $firm['inn'] : false; + $header['tin'] = $firm['tin']; + $header['address'] = $pos->address; + $header['pointname'] = $pos->pos_name; $header['date'] = date('dmY'); $header['time'] = date('His'); - $header['docnumber'] = $pos->fiscalnumber; - $header['posinner'] = $pos->posinner; - $header['posnumber'] = $pos->fisc; + $header['docnumber'] = $pos->fiscdocnumber; + $header['posinner'] = $pos->fiscallocnumber; + $header['posnumber'] = $pos->fiscalnumber; $header['username'] = \App\System::getUser()->username; - $header['guid'] = self::guid(); + $header['guid'] = \App\Util::guid(); $report = new \App\Report('shift.xml'); $xml = $report->generate($header); - + $xml = mb_convert_encoding($xml, "windows-1251", "utf-8"); - - return self::send($xml, 'doc', $firm['signserver'],$firm['signserverport'], true); + + return self::send($xml, 'doc', $firm['pposerver'],$firm['pposerverport'], true); } - public static function zform($cid, $posid ) { + public static function zform($cid, $posid ) { $pos = \App\Entity\Pos::load($posid); - $branch_id = \App\Session::getSession()->branch_id; - $firm = \App\Helper::getFirmData($cid ); - $branch = \App\Entity\Branch::load($branch_id); + $firm = \App\Helper::getFirmData($cid,$pos->branch_id); + $branch = \App\Entity\Branch::load($pos->branch_id); - $stat = self::getStat($posid) ; - + $header = array(); $header['doctype'] = $open == true ? 100 : 101; - $header['firmname'] = $firm['firmname']; - $header['inn'] = $firm['inn']; - $header['edrpou'] = $firm['edrpou']; - $header['address'] = $firm['address']; - $header['branchname'] = strlen($branch->branch_name) > 0 ? $branch->branch_name : $firm['firmname']; + $header['firmname'] = $firm['firm_name']; + $header['inn'] = strlen($firm['inn'])>0 ? $firm['inn'] : false; + $header['tin'] = $firm['tin']; + $header['address'] = $pos->address; + $header['pointname'] = $pos->pos_name; $header['date'] = date('dmY'); $header['time'] = date('His'); - $header['docnumber'] = $pos->fiscalnumber; - $header['posinner'] = $pos->posinner; - $header['posnumber'] = $pos->fisc; + $header['docnumber'] = $pos->fiscdocnumber; + $header['posinner'] = $pos->fiscallocnumber; + $header['posnumber'] = $pos->fiscalnumber; $header['username'] = \App\System::getUser()->username; - $header['guid'] = self::guid(); + $header['guid'] = \App\Util::guid(); $header['pays'] = array(); $header['paysr'] = array(); $amount=0; @@ -257,82 +233,82 @@ public static function zform($cid, $posid ) { $stat = self::getStat($pos->pos_id); //реализация - foreach($stat as $row) { + $n=1; - $cnt = $cnt+ $row['cnt']; - if($row['amount0']>0) { + $cnt = $cnt+ $stat['cnt']; + if($stat['amount0']>0) { $header['pays'][] = array( - 'formname'=> self::PAY_NAL, + 'formname'=> H::l('ppo_nal'), 'formcode'=> 0, - 'sum'=> number_format($row['amount0'], 2, '.', '') , + 'sum'=> number_format($stat['amount0'], 2, '.', '') , 'num'=>"ROWNUM=\"{$n}\"" ); - $amount = $amount + $row['amount0'] ; + $amount = $amount + $stat['amount0'] ; $n++; } - if($row['amount1']>0) { + if($stat['amount1']>0) { $header['pays'][] = array( - 'formname'=> self::PAY_BEZNAL, + 'formname'=> H::l('ppo_bnal'), 'formcode'=> 1, - 'sum'=> number_format($row['amount1'], 2, '.', '') , + 'sum'=> number_format($stat['amount1'], 2, '.', '') , 'num'=>"ROWNUM=\"{$n}\"" ); - $amount = $amount + $row['amount1'] ; + $amount = $amount + $stat['amount1'] ; $n++; } if($row['amount2']>0) { $header['pays'][] = array( - 'formname'=> self::PAY_CREDIT, + 'formname'=> H::l('ppo_credit'), 'formcode'=> 2, - 'sum'=> number_format($row['amount2'], 2, '.', '') , + 'sum'=> number_format($stat['amount2'], 2, '.', '') , 'num'=>"ROWNUM=\"{$n}\"" ); - $amount = $amount + $row['amount2'] ; + $amount = $amount + $stat['amount2'] ; $n++; } - if($row['amount3']>0) { + if($stat['amount3']>0) { $header['pays'][] = array( - 'formname'=> self::PAY_PREPAID, + 'formname'=> H::l('ppo_prepaid'), 'formcode'=> 3, - 'sum'=> number_format($row['amount3'], 2, '.', '') , + 'sum'=> number_format($stat['amount3'], 2, '.', '') , 'num'=>"ROWNUM=\"{$n}\"" ); - $amount = $amount + $row['amount3'] ; + $amount = $amount + $stat['amount3'] ; $n++; } - } + $stat = self::getStat($pos->pos_id,true); //возврат - foreach($stat as $row) { + $n=1; - $cntr = $cntr+ $row['cnt']; - if($row['amount0']>0) { + $cntr = $cntr+ $stat['cnt']; + if($stat['amount0']>0) { $header['paysr'][] = array( - 'formname'=> self::PAY_NAL, + 'formname'=> H::l('ppo_nal'), 'formcode'=> 0, - 'sum'=> number_format($row['amount0'], 2, '.', '') , + 'sum'=> number_format($stat['amount0'], 2, '.', '') , 'num'=>"ROWNUM=\"{$n}\"" ); - $amountr = $amountr + $row['amount0'] ; + $amountr = $amountr + $stat['amount0'] ; $n++; } - if($row['amount1']>0) { + if($stat['amount1']>0) { $header['paysr'][] = array( - 'formname'=> self::PAY_BEZNAL, + 'formname'=> H::l('ppo_bnal'), 'formcode'=> 1, - 'sum'=> number_format($row['amount1'], 2, '.', '') , + 'sum'=> number_format($stat['amount1'], 2, '.', '') , 'num'=>"ROWNUM=\"{$n}\"" ); - $amountr = $amountr + $row['amount1'] ; + $amountr = $amountr + $stat['amount1'] ; $n++; } - } + /* $cnt=6; $header['pays'][] = array( - 'formname'=> 'Готiвка', + 'formname'=> 'H::l('ppo_nal'), 'formcode'=> 0, 'sum'=> number_format(64, 2, '.', '') , 'num'=>"ROWNUM=\"1\"" @@ -360,34 +336,35 @@ public static function zform($cid, $posid ) { $xml = mb_convert_encoding($xml , "windows-1251","utf-8" ) ; - return self::send($xml, 'doc', $firm['signserver'],$firm['signserverport'], true); + return self::send($xml, 'doc', $firm['pposerver'],$firm['pposerverport'], true); } - public static function check($cid, $posid ) { - $pos = \App\Entity\Pos::load($posid); - - $branch_id = \App\Session::getSession()->branch_id; - $firm = \App\Helper::getFirmData($cid, $branch_id); - $branch = \App\Entity\Branch::load($branch_id); - + public static function check($doc ) { + + + $firm = \App\Helper::getFirmData($doc->firm_id,$doc->branch_id); + $branch = \App\Entity\Branch::load($doc->branch_id); + $pos = \App\Entity\Pos::load($doc->headerdata['pos']); + + $mf = \App\Entity\MoneyFund::load($doc->headerdata['payment']); $header = array( ); $header['doctype'] = $doctype ; $header['docsubtype'] = $docsubtype ; - $header['firmname'] = $firm['firmname'] ; - $header['inn'] = $firm['inn']; - $header['edrpou'] = $firm['edrpou']; - $header['address'] = $firm['address'] ; - $header['branchname'] = $branch->branch_name ; + $header['firmname'] = $firm['firm_name']; + $header['inn'] = strlen($firm['inn'])>0 ? $firm['inn'] : false; + $header['tin'] = $firm['tin']; + $header['address'] = $pos->address; + $header['pointname'] = $pos->pos_name; $header['date'] = date('dmY'); $header['time'] = date('His'); - $header['docnumber'] = $pos->fiscalnumber; - $header['posinner'] = $pos->posinner; - $header['posnumber'] = $pos->fisc ; + $header['docnumber'] = $pos->fiscdocnumber; + $header['posinner'] = $pos->fiscallocnumber; + $header['posnumber'] = $pos->fiscalnumber; $header['username'] = $doc->username ; - $header['guid'] = self::guid(); + $header['guid'] = \App\Util::guid(); $header['disc'] = $doc->headerdata["paydisc"] >0 ? number_format($doc->headerdata["paydisc"], 2, '.', '') : false; @@ -407,7 +384,8 @@ public static function check($cid, $posid ) { 'price'=> number_format($item->price*$disc , 2, '.', ''), 'cost'=> number_format($item->quantity*$item->price*$disc , 2, '.', '') ) ; - + $n++; + $header['amount'] = $header['amount']+ $item->quantity*$item->price*$disc; } foreach ($doc->unpackDetails('services') as $item) { @@ -421,9 +399,6 @@ public static function check($cid, $posid ) { $n++; $header['amount'] = $header['amount']+ $item->quantity*$item->price*$disc; } - - $mf = \App\Entity\MoneyFund::load($doc->headerdata['payment']); - $amount0=0; $amount1=0; $amount2=0; @@ -433,7 +408,7 @@ public static function check($cid, $posid ) { if ($doc->headerdata['payment'] == \App\Entity\MoneyFund::PREPAID) { $pay = array( - 'formname'=> self::PAY_PREPAID, + 'formname'=> H::l('ppo_prepaid'), 'formcode'=> 3, 'paysum'=> number_format($header['amount'], 2, '.', '') , 'payed'=> number_format($header['amount'], 2, '.', '') , @@ -444,9 +419,9 @@ public static function check($cid, $posid ) { $n++; $amount3 = $pay['paysum']; } else - if ( $mf !=null && $mf->beznal==1) { + if ($mf != null && $mf->beznal==1) { $pay = array( - 'formname'=> self::PAY_BEZNAL, + 'formname'=> H::l('ppo_bnal'), 'formcode'=> 1, 'paysum'=> number_format($doc->payamount, 2, '.', '') , 'payed'=> number_format($doc->payamount, 2, '.', '') , @@ -464,7 +439,7 @@ public static function check($cid, $posid ) { } else { $pay = array( - 'formname'=> self::PAY_NAL, + 'formname'=> H::l('ppo_nal'), 'formcode'=> 0, 'paysum'=> number_format($doc->payamount, 2, '.', '') , 'payed'=> number_format($doc->payed, 2, '.', '') , @@ -489,7 +464,7 @@ public static function check($cid, $posid ) { // в долг if($doc->payed < $doc->payamount) { $pay = array( - 'formname'=>self::PAY_CREDIT, + 'formname'=> H::l('ppo_credit'), 'formcode'=> 2, 'paysum'=> number_format($doc->payamount - $doc->payed, 2, '.', '') , 'payed'=> number_format($doc->payamount - $doc->payed, 2, '.', '') , @@ -513,10 +488,10 @@ public static function check($cid, $posid ) { $report = new \App\Report('check.xml'); $xml = $report->generate($header); - - $xml = mb_convert_encoding($xml , "windows-1251","utf-8" ) ; - - $ret = self::send($xml,'doc',$firm['signserver'],$firm['signserverport']); + $xml = mb_convert_encoding($xml , "windows-1251","utf-8" ) ; + file_put_contents("z:/xml.xml",$xml) ; + + $ret = self::send($xml,'doc',$firm['pposerver'],$firm['pposerverport'],true); if($ret['success'] == true){ self::insertStat($pos->pos_id,1,$amount0,$amount1,$amount2,$amount3,$doc->document_number); @@ -527,30 +502,28 @@ public static function check($cid, $posid ) { } - public static function checkpay($cid,$doc ) { + public static function checkpay($doc ) { - $firm = \App\Helper::getFirmData($cid ); + $firm = \App\Helper::getFirmData($doc->firm_id,$doc->branch_id); $branch = \App\Entity\Branch::load($doc->branch_id); - //todo терминал что ща открыта смена $pos = \App\Entity\Pos::load($doc->headerdata['pos']); - $mf = \App\Entity\MoneyFund::load($doc->headerdata['payment']); - + $header = array( ); - $header['firmname'] = $firm['firmname'] ; - $header['inn'] = $firm['inn']; - $header['edrpou'] = $firm['edrpou']; - $header['address'] = $firm['address'] ; - $header['branchname'] = $branch->branch_name ; - $header['date'] = date('dmY'); + $header['firmname'] = $firm['firm_name']; + $header['inn'] = strlen($firm['inn'])>0 ? $firm['inn'] : false; + $header['tin'] = $firm['tin']; + $header['address'] = $pos->address; + $header['pointname'] = $pos->pos_name; + $header['date'] = date('dmY'); $header['time'] = date('His'); - $header['docnumber'] = $pos->fiscalnumber; - $header['posinner'] = $pos->posinner; - $header['posnumber'] = $pos->fisc ; + $header['docnumber'] = $pos->fiscdocnumber; + $header['posinner'] = $pos->fiscallocnumber; + $header['posnumber'] = $pos->fiscalnumber; $header['username'] = $doc->username ; - $header['guid'] = self::guid(); + $header['guid'] = \App\Util::guid(); $amount0=0; $amount1=0; @@ -559,12 +532,12 @@ public static function checkpay($cid,$doc ) { - if ($mf !=null && $mf->beznal==1) { - $header['formname'] = self::PAY_BEZNAL; + if ($doc->headerdata['payment'] == \App\Entity\MoneyFund::BEZNAL) { + $header['formname'] = 'Банкiвська картка'; $header['formcode'] = 1; $amount1 = number_format($doc->payed, 2, '.', '') ; } else { - $header['formname'] = self::PAY_NAL; + $header['formname'] = H::l('ppo_nal'); $header['formcode'] = 0; $amount0 = number_format($doc->payed, 2, '.', '') ; } @@ -583,7 +556,7 @@ public static function checkpay($cid,$doc ) { $xml = mb_convert_encoding($xml , "windows-1251","utf-8" ) ; - $ret = self::send($xml,'doc',$firm['signserver'],$firm['signserverport']); + $ret = self::send($xml,'doc',$firm['pposerver'],$firm['pposerverport'],true); if($ret['success'] == true){ @@ -597,35 +570,33 @@ public static function checkpay($cid,$doc ) { } - //возврат - public static function checkback($cid,$doc ) { + + public static function checkback($doc ) { - $firm = \App\Helper::getFirmData($cid ); + $firm = \App\Helper::getFirmData($doc->firm_id,$doc->branch_id); $branch = \App\Entity\Branch::load($doc->branch_id); - //todo терминал что ща открыта смена $pos = \App\Entity\Pos::load($doc->headerdata['pos']); - $mf = \App\Entity\MoneyFund::load($doc->headerdata['payment']); $header = array( ); $header['doctype'] = $doctype ; $header['docsubtype'] = $docsubtype ; - $header['firmname'] = $firm['firmname'] ; - $header['inn'] = $firm['inn']; - $header['edrpou'] = $firm['edrpou']; - $header['address'] = $firm['address'] ; - $header['branchname'] = $branch->branch_name ; - $header['date'] = date('dmY'); + $header['firmname'] = $firm['firm_name']; + $header['inn'] = strlen($firm['inn'])>0 ? $firm['inn'] : false;; + $header['tin'] = $firm['tin']; + $header['address'] = $pos->address ; + $header['pointname'] = $pos->pos_name; + $header['date'] = date('dmY'); $header['time'] = date('His'); - $header['docnumber'] = $pos->fiscalnumber ; $header['docnumberback'] = $doc->headerdata["docnumberback"] ; - $header['posinner'] = $pos->posinner; - $header['posnumber'] = $pos->fisc ; + $header['docnumber'] = $pos->fiscdocnumber; + $header['posinner'] = $pos->fiscallocnumber; + $header['posnumber'] = $pos->fiscalnumber; $header['username'] = $doc->username ; - $header['guid'] = self::guid(); + $header['guid'] = \App\Util::guid(); $amount0=0; $amount1=0; $amount2=0; @@ -633,12 +604,12 @@ public static function checkback($cid,$doc ) { - if ($mf !=null && $mf->beznal==1) { - $header['formname'] = self::PAY_BEZNAL; + if ($doc->headerdata['payment'] == \App\Entity\MoneyFund::BEZNAL) { + $header['formname'] = 'Банкiвська картка'; $header['formcode'] = 1; $amount1 = number_format($doc->payed, 2, '.', '') ; } else { - $header['formname'] = self::PAY_NAL; + $header['formname'] = H::l('ppo_nal'); $header['formcode'] = 0; $amount0 = number_format($doc->payed, 2, '.', '') ; } @@ -672,7 +643,7 @@ public static function checkback($cid,$doc ) { $xml = mb_convert_encoding($xml , "windows-1251","utf-8" ) ; - $ret = self::send($xml,'doc',$firm['signserver'],$firm['signserverport']); + $ret = self::send($xml,'doc',$firm['pposerver'],$firm['pposerverport'],true); if($ret['success'] == true){ @@ -683,14 +654,14 @@ public static function checkback($cid,$doc ) { } - + //функции работы со статистикой для z-отчета public static function insertStat($pos_id,$checktype,$amount0,$amount1,$amount2,$amount3,$document_number=''){ $conn = \ZDB\DB::getConnect(); $amount0 = number_format($amount0, 2, '.', '') ; $amount1 = number_format($amount1, 2, '.', '') ; $amount2 = number_format($amount2, 2, '.', '') ; $amount3 = number_format($amount3, 2, '.', '') ; - $sql = "insert into ppo_zformstat (pos_id,checktype, amount0,amount1,amount2,amount3,document_number,createdon) values ({$pos_id},{$checktype}, {$amount0}, {$amount1},{$amount2},{$amount3},". $conn->qstr($document_number) .",". $conn->DBDate(time()) .")"; + $sql = "insert into zformstat (pos_id,checktype, amount0,amount1,amount2,amount3,document_number,createdon) values ({$pos_id},{$checktype}, {$amount0}, {$amount1},{$amount2},{$amount3},". $conn->qstr($document_number) .",". $conn->DBDate(time()) .")"; $conn->Execute($sql) ; @@ -699,14 +670,14 @@ public static function insertStat($pos_id,$checktype,$amount0,$amount1,$amount2, public static function clearStat($pos_id ){ $conn = \ZDB\DB::getConnect(); - $conn->Execute("delete from ppo_zformstat where pos_id=".$pos_id ) ; + $conn->Execute("delete from zformstat where pos_id=".$pos_id ) ; } public static function getStat($pos_id,$ret=false ){ $conn = \ZDB\DB::getConnect(); - $sql = "select count(*) as cnt, coalesce(sum(amount0),0) as amount0, coalesce(sum(amount1),0) as amount1, coalesce(sum(amount2),0) as amount2, coalesce(sum(amount3),0) as amount3 from ppo_zformstat where pos_id=".$pos_id; + $sql = "select count(*) as cnt, coalesce(sum(amount0),0) as amount0, coalesce(sum(amount1),0) as amount1, coalesce(sum(amount2),0) as amount2, coalesce(sum(amount3),0) as amount3 from zformstat where pos_id=".$pos_id; if($ret==true){ $sql = $sql . " and checktype =3" ; //возврат } else { @@ -714,7 +685,7 @@ public static function getStat($pos_id,$ret=false ){ } - return $conn->Execute($sql) ; + return $conn->GetRow($sql) ; } diff --git a/www/app/modules/ppo/ppolist.php b/www/app/modules/ppo/ppolist.php index e833f4017..71c48fa53 100644 --- a/www/app/modules/ppo/ppolist.php +++ b/www/app/modules/ppo/ppolist.php @@ -2,9 +2,11 @@ namespace App\Modules\PPO; -use App\Entity\Item; +use App\Entity\Firm; +use App\Entity\Pos; +use App\Entity\Branch; use App\Helper as H; -use App\Modules\PPO\Helper; +use App\Modules\PPO\PPOHelper; use App\DataItem; use App\System; use Zippy\Binding\PropertyBinding as Prop; @@ -49,7 +51,7 @@ public function __construct() { $this->opan->add(new Paginator('pagp', $this->opan->ppolist)); - $this->opan->ppolist->setPageSize(5000); + $this->opan->ppolist->setPageSize(50 ); //H::getPG() $this->add(new Panel('shpan'))->setVisible(false); $this->shpan->add(new ClickLink('backo', $this, 'onBacko')); @@ -70,7 +72,8 @@ public function filterOnSubmit($sender) { if ($cid == 0) { return; } - $res = Helper::send(json_encode(array('Command' => 'Objects')), 'cmd', $cid); + $firm= Firm::load($cid); + $res = PPOHelper::send(json_encode(array('Command' => 'Objects')), 'cmd', $firm->pposerver,$firm->pposerverport,false); if($res['success']==false) { $this->setError($res['data']); return; @@ -126,8 +129,9 @@ public function updateShifts() { $from = \Carbon\Carbon::now()->addMonth(-1)->startOfMonth()->format('c'); $to = \Carbon\Carbon::now()->format('c'); $cid = $this->opan->filter->searchcomp->getValue(); + $firm= Firm::load($cid); - $res = Helper::send(json_encode(array('Command' => 'Shifts', 'NumFiscal' => $this->ppo->tr->NumFiscal, 'From' => $from, 'To' => $to)), 'cmd', $cid); + $res = PPOHelper::send(json_encode(array('Command' => 'Shifts', 'NumFiscal' => $this->ppo->tr->NumFiscal, 'From' => $from, 'To' => $to)), 'cmd', $firm->pposerver,$firm->pposerverport,false); if($res['success']==false) { $this->setError($res['data']); return; @@ -172,8 +176,9 @@ public function onSh($sender) { $sh = $sender->getOwner()->getDataItem(); $this->_doclist = array(); $cid = $this->opan->filter->searchcomp->getValue(); + $firm= Firm::load($cid); - $res = Helper::send(json_encode(array('Command' => 'Documents', 'NumFiscal' => $this->ppo->tr->NumFiscal, 'ShiftId' => $sh->ShiftId)), 'cmd', $cid); + $res = PPOHelper::send(json_encode(array('Command' => 'Documents', 'NumFiscal' => $this->ppo->tr->NumFiscal, 'ShiftId' => $sh->ShiftId)), 'cmd', $firm->pposerver,$firm->pposerverport,false); if($res['success']==false) { $this->setError($res['data']); return; @@ -226,8 +231,9 @@ public function onDoc($sender) { $this->docpan->doclist->Reload(); $cid = $this->opan->filter->searchcomp->getValue(); + $firm= Firm::load($cid); - $res = Helper::send(json_encode(array('Command' => $doc->DocClass, 'RegistrarNumFiscal' => $this->ppo->tr->NumFiscal, 'NumFiscal' => $doc->NumFiscal)), 'cmd', $cid, true); + $res = PPOHelper::send(json_encode(array('Command' => $doc->DocClass, 'RegistrarNumFiscal' => $this->ppo->tr->NumFiscal, 'NumFiscal' => $doc->NumFiscal)), 'cmd', $firm->pposerver,$firm->pposerverport,true); if($res['success']==false) { $this->setError($res['data']); return; diff --git a/www/app/modules/ppo/zform.php b/www/app/modules/ppo/zform.php new file mode 100644 index 000000000..b0b3a42ab --- /dev/null +++ b/www/app/modules/ppo/zform.php @@ -0,0 +1,9 @@ +modules, 'tecdoc') === false && System::getUser()->rolename != 'admins') { $this->_tvars["tecdoc"] = false; } + if (strpos(System::getUser()->modules, 'ppo') === false && System::getUser()->rolename != 'admins') { + $this->_tvars["ppo"] = false; + } //скрыть боковое меню diff --git a/www/app/pages/doc/returnissue.php b/www/app/pages/doc/returnissue.php index e2b48e0fb..9d62d41ea 100644 --- a/www/app/pages/doc/returnissue.php +++ b/www/app/pages/doc/returnissue.php @@ -341,7 +341,7 @@ public function OnChangeStore($sender) { } public function OnAutoCustomer($sender) { - return Customer::getList($sender->getText(), 2); + return Customer::getList($sender->getText(),1); } public function OnAutoItem($sender) { diff --git a/www/app/pages/firmlist.php b/www/app/pages/firmlist.php index 360b83d80..3ba3c39a2 100644 --- a/www/app/pages/firmlist.php +++ b/www/app/pages/firmlist.php @@ -47,6 +47,7 @@ public function __construct() { $this->firmdetail->add(new TextInput('editstamp')); $this->firmdetail->add(new TextInput('editsign')); $this->firmdetail->add(new TextInput('editpposerv')); + $this->firmdetail->add(new TextInput('editpposervport')); $this->firmdetail->add(new SubmitButton('save'))->onClick($this, 'saveOnClick'); $this->firmdetail->add(new Button('cancel'))->onClick($this, 'cancelOnClick'); } @@ -85,7 +86,8 @@ public function editOnClick($sender) { $this->firmdetail->editlogo->setText($this->_firm->logo); $this->firmdetail->editstamp->setText($this->_firm->stamp); $this->firmdetail->editsign->setText($this->_firm->sign); - $this->firmdetail->editpposerv->setText($this->_firm->pposerv); + $this->firmdetail->editpposerv->setText($this->_firm->pposerver); + $this->firmdetail->editpposervport->setText($this->_firm->pposerverport); $this->firmdetail->editdisabled->setChecked($this->_firm->disabled); @@ -108,10 +110,11 @@ public function saveOnClick($sender) { $this->_firm->address = $this->firmdetail->editaddress->getText(); $this->_firm->phone = $this->firmdetail->editphone->getText(); - $this->_firm->logo = $this->firmdetail->editlogo->getText(); + $this->_firm->logo = $this->firmdetail->editlogo->getText(); $this->_firm->stamp = $this->firmdetail->editstamp->getText(); $this->_firm->sign = $this->firmdetail->editsign->getText(); - $this->_firm->pposerv = $this->firmdetail->editpposerv->getText(); + $this->_firm->pposerver = trim($this->firmdetail->editpposerv->getText()); + $this->_firm->pposerverport = trim($this->firmdetail->editpposervport->getText()); if ($this->_firm->firm_name == '') { $this->setError("entername"); diff --git a/www/app/pages/poslist.php b/www/app/pages/poslist.php index a3ccaa1b6..163adb6c0 100644 --- a/www/app/pages/poslist.php +++ b/www/app/pages/poslist.php @@ -46,6 +46,7 @@ public function __construct() { $this->posdetail->add(new TextInput('editposinner')); $this->posdetail->add(new TextInput('editfisc')); $this->posdetail->add(new TextInput('editfiscalnumber')); + $this->posdetail->add(new TextInput('editaddress')); $this->posdetail->add(new TextArea('editcomment')); $this->posdetail->add(new SubmitButton('save'))->onClick($this, 'saveOnClick'); @@ -84,8 +85,9 @@ public function editOnClick($sender) { $this->posdetail->editstore->setValue($this->_pos->store); $this->posdetail->editmf->setValue($this->_pos->mf); $this->posdetail->editpricetype->setValue($this->_pos->pricetype); - $this->posdetail->editposinner->setText($this->_pos->posinner); - $this->posdetail->editfisc->setText($this->_pos->fisc); + $this->posdetail->editaddress->setText($this->_pos->address); + $this->posdetail->editposinner->setText($this->_pos->fiscallocnumber); + $this->posdetail->editfisc->setText($this->_pos->fiscalnumber); $this->posdetail->editfiscalnumber->setText($this->_pos->fiscdocnumber); $this->posdetail->editusefisc->setChecked($this->_pos->usefisc); @@ -117,8 +119,9 @@ public function saveOnClick($sender) { $this->_pos->pricetype = $this->posdetail->editpricetype->getValue(); - $this->_pos->posinner = $this->posdetail->editposinner->getText(); - $this->_pos->fisc = $this->posdetail->editfisc->getText(); + $this->_pos->address = $this->posdetail->editaddress->getText(); + $this->_pos->fiscallocnumber = $this->posdetail->editposinner->getText(); + $this->_pos->fiscalnumber = $this->posdetail->editfisc->getText(); $this->_pos->fiscdocnumber = $this->posdetail->editfiscalnumber->getText(); $this->_pos->usefisc = $this->posdetail->editusefisc->isChecked() ? 1 : 0; diff --git a/www/app/pages/service/armpos.php b/www/app/pages/service/armpos.php index f42a750c4..0df9e7920 100644 --- a/www/app/pages/service/armpos.php +++ b/www/app/pages/service/armpos.php @@ -49,14 +49,13 @@ public function __construct() { } $this->form1->add(new DropDownChoice('pos', $plist, $cc)); $this->form1->add(new DropDownChoice('firm', \App\Entity\Firm::getList(), 0)); - - + $this->form1->add(new SubmitButton('next1'))->onClick($this, 'next1docOnClick'); $this->add(new Form('form2'))->setVisible(false); // ввод товаров - $this->form2->add(new Button('cancel1'))->onClick($this, 'cancel1docOnClick'); + $this->form2->add(new SubmitButton('next2'))->onClick($this, 'next2docOnClick'); $this->form2->add(new TextInput('barcode')); $this->form2->add(new SubmitLink('addcode'))->onClick($this, 'addcodeOnClick'); @@ -67,9 +66,9 @@ public function __construct() { $this->form2->add(new DataView('detail', new \Zippy\Html\DataList\ArrayDataSource(new \Zippy\Binding\PropertyBinding($this, '_itemlist')), $this, 'detailOnRow')); $this->form2->add(new DataView('detailser', new \Zippy\Html\DataList\ArrayDataSource(new \Zippy\Binding\PropertyBinding($this, '_serlist')), $this, 'serOnRow')); - $this->form2->add(new ClickLink('openshift', $this, 'OnShift')); - $this->form2->add(new ClickLink('closeshift', $this, 'OnShift')); - $this->form2->add(new ClickLink('zform', $this, 'OnShift')); + $this->form2->add(new ClickLink('openshift', $this, 'OnOpenShift')); + $this->form2->add(new ClickLink('closeshift', $this, 'OnCloseShift')); + //оплата @@ -132,14 +131,23 @@ public function __construct() { $this->editcust->add(new TextInput('editphone')); $this->editcust->add(new Button('cancelcust'))->onClick($this, 'cancelcustOnClick'); $this->editcust->add(new SubmitButton('savecust'))->onClick($this, 'savecustOnClick'); + + /* + //Закрытие смены + $this->add(new Form('zform'))->setVisible(false); + $this->zform->add(new TextInput('zformqnt')); + $this->zform->add(new TextInput('zformnal')); + $this->zform->add(new TextInput('zformbnal')); + $this->zform->add(new TextInput('zformcredit')); + $this->zform->add(new TextInput('zformprepaid')); + $this->zform->add(new TextInput('zformtotal')); + $this->zform->add(new Button('cancelzform'))->onClick($this, 'cancelzformOnClick'); + $this->zform->add(new SubmitButton('savezform'))->onClick($this, 'savezformOnClick'); + + */ } - public function cancel1docOnClick($sender) { - $this->form1->setVisible(true); - $this->form2->setVisible(false); - $this->form3->setVisible(false); - $this->form4->setVisible(false); - } + public function cancel2docOnClick($sender) { @@ -657,7 +665,38 @@ public function savedocOnClick($sender) { } } - + if($this->pos->usefisc==1) { + + + $ret = \App\Modules\PPO\PPOHelper::check($this->_doc); + if($ret['success'] == false && $ret['docnumber']>0) { + //повторяем для нового номера + $this->pos->fiscdocnumber = $ret['docnumber']; + $this->pos->save(); + $ret = \App\Modules\PPO\PPOHelper::check($this->_doc); + + } + if($ret['success'] == false ) { + $this->setError($ret['data']); + return; + } else { + // $this->setSuccess("Выполнено") ; + if($ret['docnumber'] >0) { + $this->pos->fiscdocnumber = $ret['doclocnumber']+1; + $this->pos->save(); + $this->_doc->headerdata["fiscalnumber"] = $ret['docnumber'] ; + } else { + $this->setError("ppo_noretnumber" ); + return; + + } + + } + + } + + + $this->_doc->save(); $this->_doc->updateStatus(Document::STATE_NEW); @@ -693,59 +732,110 @@ public function OnPayment($sender) { $this->form3->exchange->setVisible(true); } } + + + public function OnOpenShift(){ + $ret = \App\Modules\PPO\PPOHelper::shift($this->form1->firm->getValue(),$this->pos->pos_id,true); + if($ret['success'] == false && $ret['docnumber']>0) { + //повторяем для нового номера + $this->pos->fiscdocnumber = $ret['docnumber']; + $this->pos->save(); + $ret = \App\Modules\PPO\PPOHelper::shift($this->form1->firm->getValue(), $this->pos->pos_id,true); + - public function OnShift($sender) { + } + if($ret['success'] == false ) { + $this->setError($ret['data']); + return false; + } else { + $this->setSuccess("ppo_shiftopened") ; + if($ret['docnumber'] >0) { + $this->pos->fiscdocnumber = $ret['doclocnumber']+1; + $this->pos->save(); + $this->_doc->headerdata["fiscalnumber"] = $ret['docnumber'] ; + + } else { + $this->setError("ppo_noretnumber"); + return; + + } + \App\Modules\PPO\PPOHelper::clearStat($this->pos->pos_id) ; + } + + + $this->pos->save(); + return true; + } - $cid = $this->form1->firm->getValue(); - $posid = $this->form1->pos->getValue(); - $pos = \App\Entity\Pos::load($posid); - - if($sender->id=="openshift") { - $ret = \App\Modules\PPO\Helper::shift($cid,$posid,true); - } - if($sender->id=="closeshift") { - $ret = \App\Modules\PPO\Helper::shift($cid,$posid,false); - } - if($sender->id=="zform") { - $ret = \App\Modules\PPO\Helper::zform($cid,$posid); + public function OnCloseShift($sender){ + $ret = $this->zform(); + if($ret==true)$this->closeshift();; + } + + + public function zform(){ + $ret = \App\Modules\PPO\PPOHelper::zform($this->form1->firm->getValue(), $this->pos->pos_id ); + if(strpos($ret['data'],'ZRepAlreadyRegistered')) { + return true; + } + if($ret['success'] == false && $ret['docnumber']>0) { + //повторяем для нового номера + $this->pos->fiscdocnumber = $ret['docnumber']; + $this->pos->save(); + $ret = \App\Modules\PPO\PPOHelper::zform($this->form1->firm->getValue(), $this->pos->pos_id ); + + + } + if($ret['success'] == false ) { + $this->setError($ret['data']); + return false; + } else { + + if($ret['docnumber'] >0) { + $this->pos->fiscdocnumber = $ret['doclocnumber']+1; + $this->pos->save(); + } else { + $this->setError("ppo_noretnumber"); + return; + } + + } + + + return true; + } + + + public function closeshift(){ + $ret = \App\Modules\PPO\PPOHelper::shift($this->form1->firm->getValue(), $this->pos->pos_id,false ); if($ret['success'] == false && $ret['docnumber']>0) { //повторяем для нового номера - $pos->fiscdocnumber = $ret['docnumber']; - $pos->save(); - - if($sender->id=="openshift") { - $ret = \App\Modules\PPO\Helper::shift($cid,$posid,true); - } - if($sender->id=="closeshift") { - $ret = \App\Modules\PPO\Helper::shift($cid,$posid,false); - } - if($sender->id=="zform") { - $ret = \App\Modules\PPO\Helper::zform($cid,$posid); - } + $this->pos->fiscdocnumber = $ret['docnumber']; + $this->pos->save(); + $ret = \App\Modules\PPO\PPOHelper::shift($this->form1->firm->getValue(), $this->pos->pos_id,false ); + } if($ret['success'] == false ) { $this->setError($ret['data']); - return; + return false; } else { - $this->setSuccess("ppoexecuted") ; - } - + $this->setSuccess("ppo_shiftclosed") ; + if($ret['docnumber'] >0) { + $this->pos->fiscdocnumber = $ret['doclocnumber']+1; + $this->pos->save(); + } else { + $this->setError("ppo_noretnumber"); + return; + + } + \App\Modules\PPO\PPOHelper::clearStat($this->pos->pos_id) ; + } + - //состояние смены - if ($sender->id == "openshift") { - $pos->openshift = time(); - $pos->closeshift = 0; - } - if ($sender->id == "closeshift") { - $pos->closeshift = time(); - } - - $pos->save(); - + return true; } - - + } diff --git a/www/app/util.php b/www/app/util.php index 178c81100..d63d91d63 100644 --- a/www/app/util.php +++ b/www/app/util.php @@ -10,7 +10,24 @@ */ class Util { + /** + * генерация GUID + * + */ + public static function guid() { + + if (function_exists('com_create_guid') === true) { + return trim(com_create_guid(), '{}'); + } + + $data = openssl_random_pseudo_bytes(16); + $data[6] = chr(ord($data[6]) & 0x0f | 0x40); // set version to 0100 + $data[8] = chr(ord($data[8]) & 0x3f | 0x80); // set bits 6-7 to 10 + return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4)); + } + + /** * возвращает первые буквы */ diff --git a/www/composer.json b/www/composer.json index 0f6df8b53..b578d2fff 100644 --- a/www/composer.json +++ b/www/composer.json @@ -1,24 +1,31 @@ { - "require": { - "php": ">=7.2", - - "phpmailer/phpmailer": "~6.1", - "monolog/monolog": "1.25.4", - "nesbot/carbon": "2.32.2", - - - "dompdf/dompdf": "v0.8.5", - "firebase/php-jwt": "v5.0.0", - "roave/security-advisories": "dev-master", - "picqer/php-barcode-generator": "v0.3", - - "masterexploder/phpthumb" :"*", - "lemmon/fetch" :"v0.3.0", - + "description": "Складская система", + "keywords": [ "php", "wms", "erp" ], + "homepage": "https://zippy.com.ua/", + + "license": "MIT" , - "automattic/woocommerce": "3.0.0", - "symfony/polyfill-mbstring": "^1.10", - "leon-mbs/zippy": "2.2.4" + "require": { + "php": ">=7.2", + + "phpmailer/phpmailer": "~6.1", + "monolog/monolog": "1.25.4", + "nesbot/carbon": "2.32.2", + + + "dompdf/dompdf": "v0.8.5", + "firebase/php-jwt": "v5.0.0", + "roave/security-advisories": "dev-master", + "picqer/php-barcode-generator": "v0.3", + + "masterexploder/phpthumb" :"*", + "lemmon/fetch" :"v0.3.0", + "lis-dev/nova-poshta-api-2" :"0.1.6", + + + "automattic/woocommerce": "3.0.0", + "symfony/polyfill-mbstring": "^1.10", + "leon-mbs/zippy": "2.2.4" - } + } } diff --git a/www/composer.lock b/www/composer.lock index 77c5f7b72..e4bb9f82e 100644 --- a/www/composer.lock +++ b/www/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "3892d58badc0f38c63af39182780a7fa", + "content-hash": "1e1239b0590bc5ef05b05d7e4a437270", "packages": [ { "name": "adodb/adodb-php", @@ -630,6 +630,62 @@ }, "time": "2020-12-12T20:55:12+00:00" }, + { + "name": "lis-dev/nova-poshta-api-2", + "version": "0.1.6", + "source": { + "type": "git", + "url": "https://github.com/lis-dev/nova-poshta-api-2.git", + "reference": "0460cf3cf44b1bc078d0ea439ea8c197e718c0bb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/lis-dev/nova-poshta-api-2/zipball/0460cf3cf44b1bc078d0ea439ea8c197e718c0bb", + "reference": "0460cf3cf44b1bc078d0ea439ea8c197e718c0bb", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" + }, + "type": "library", + "autoload": { + "psr-4": { + "LisDev\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Igor Ivashchenko", + "homepage": "https://github.com/lis-dev/nova-poshta-api-2", + "role": "Developer" + }, + { + "name": "Team", + "homepage": "https://github.com/lis-dev/nova-poshta-api-2/graphs/contributors", + "role": "Contributors" + } + ], + "description": "PHP class for API 2.0 ukrainian delivery company \"Nova Poshta\"", + "homepage": "https://github.com/lis-dev/", + "keywords": [ + "delivery", + "delivery service", + "nova poshta", + "nova poshta api" + ], + "support": { + "issues": "https://github.com/lis-dev/nova-poshta-api-2/issues", + "source": "https://github.com/lis-dev/nova-poshta-api-2/tree/0.1.6" + }, + "time": "2020-12-09T13:43:16+00:00" + }, { "name": "masterexploder/phpthumb", "version": "2.1", @@ -2070,16 +2126,16 @@ }, { "name": "symfony/translation", - "version": "v5.2.0", + "version": "v5.2.1", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "52f486a707510884450df461b5a6429dd7a67379" + "reference": "a04209ba0d1391c828e5b2373181dac63c52ee70" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/52f486a707510884450df461b5a6429dd7a67379", - "reference": "52f486a707510884450df461b5a6429dd7a67379", + "url": "https://api.github.com/repos/symfony/translation/zipball/a04209ba0d1391c828e5b2373181dac63c52ee70", + "reference": "a04209ba0d1391c828e5b2373181dac63c52ee70", "shasum": "" }, "require": { @@ -2143,7 +2199,7 @@ "description": "Symfony Translation Component", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/translation/tree/v5.2.0" + "source": "https://github.com/symfony/translation/tree/v5.2.1" }, "funding": [ { @@ -2159,7 +2215,7 @@ "type": "tidelift" } ], - "time": "2020-11-28T11:24:18+00:00" + "time": "2020-12-08T17:03:37+00:00" }, { "name": "symfony/translation-contracts", diff --git a/www/templates/lang.json b/www/templates/lang.json index d2d0b6794..037a7dc7a 100644 --- a/www/templates/lang.json +++ b/www/templates/lang.json @@ -311,8 +311,15 @@ "it_tovar": "Товар", "it_mat": "Материалы и комплектующие", "it_mbp": "МБП (малоценка)", - "it_prod": "Готовая продукция", + "it_prod": "Готовая продукция", "it_hprod": "Полуфабрикаты", + "ppo_noretnumber": "Не возвращен фискальный номер", + "ppo_shiftopened": "Смена открыта", + "ppo_shiftclosed": "Смена закрыта", + "ppo_nal": "Готiвка", + "ppo_bnal": "Банкiвська картка", + "ppo_credit": "В кредит", + "ppo_prepaid": "Передплата", "refreshed": "Обновлено", diff --git a/www/templates/modules/ppo/ppolist.html b/www/templates/modules/ppo/ppolist.html index 9bc7ebe8e..a362a4f68 100644 --- a/www/templates/modules/ppo/ppolist.html +++ b/www/templates/modules/ppo/ppolist.html @@ -1,6 +1,5 @@ - - +
diff --git a/www/templates/modules/ppo/zform.html b/www/templates/modules/ppo/zform.html new file mode 100644 index 000000000..ca9eee57a --- /dev/null +++ b/www/templates/modules/ppo/zform.html @@ -0,0 +1,28 @@ + + + +
+
+ +

Закрытие смены

+ Страница для ручного закрытия смены + +
+ +
+ + + \ No newline at end of file diff --git a/www/templates/pages/base.html b/www/templates/pages/base.html index 6a4b2f1e0..c4b9556bd 100644 --- a/www/templates/pages/base.html +++ b/www/templates/pages/base.html @@ -577,6 +577,12 @@
_______________

  Зарегистрированые РРО

+ diff --git a/www/templates/pages/firmlist.html b/www/templates/pages/firmlist.html index 6eaf47e69..2ad88fe55 100644 --- a/www/templates/pages/firmlist.html +++ b/www/templates/pages/firmlist.html @@ -73,10 +73,12 @@

Список компаний

- Адрес сервера цифровой подписи в формате - : - . - + +
+
+ + +
{{/ppo}} diff --git a/www/templates/pages/poslist.html b/www/templates/pages/poslist.html index 1ea8256c5..8a320519b 100644 --- a/www/templates/pages/poslist.html +++ b/www/templates/pages/poslist.html @@ -11,15 +11,17 @@

Справочник POS терминалов

+ {{#usebranch}} - + {{/usebranch}} - - + {{#usebranch}} + + {{/usebranch}} @@ -37,13 +39,14 @@

Справочник POS терминалов

+ {{#usebranch}}
- + {{/usebranch}}
@@ -63,6 +66,11 @@

Справочник POS терминалов

+
+ + +
+ {{#ppo}}
diff --git a/www/templates/pages/service/armpos.html b/www/templates/pages/service/armpos.html index 92ddf6d8c..bbf616af1 100644 --- a/www/templates/pages/service/armpos.html +++ b/www/templates/pages/service/armpos.html @@ -37,9 +37,9 @@

        АРМ кассира

{{#ppo}} @@ -54,8 +54,8 @@

        АРМ кассира

{{/usescanner}} - -   Добавить товар + + Добавить товар   Добавить услугу    @@ -320,8 +320,6 @@

 Новый контрагент

- -
@@ -329,7 +327,56 @@

 Новый контрагент

- + + \ No newline at end of file diff --git a/www/templates_ua/printforms/doc/poscheck_bill.tpl b/www/templates_ua/printforms/doc/poscheck_bill.tpl index 6fc6e5a62..7a881424a 100644 --- a/www/templates_ua/printforms/doc/poscheck_bill.tpl +++ b/www/templates_ua/printforms/doc/poscheck_bill.tpl @@ -2,6 +2,12 @@
+ {{#fiscalnumber}} + + + + {{/fiscalnumber}} + From 82cdc4ea7133ad2f8c4d6ed99b897274394170e7 Mon Sep 17 00:00:00 2001 From: Leon Date: Tue, 22 Dec 2020 15:45:31 +0200 Subject: [PATCH 06/11] next --- CHANGELOG.md | 5 +++-- www/app/entity/doc/poscheck.php | 2 +- www/templates/printforms/doc/poscheck.tpl | 18 ++++++++++++++++++ www/templates/printforms/doc/poscheck_bill.tpl | 5 +++-- www/templates_ua/printforms/doc/poscheck.tpl | 15 +++++++++++++++ .../printforms/doc/poscheck_bill.tpl | 2 +- 6 files changed, 41 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 22d579e76..56c57e872 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ CHANGELOG на оф. сайте. Для обновления версии обновить папки app, templates, templates_ua, выполнить update470to480.sql . - +Обновить папку vendor (или выполнить composer, предварительно обновив composer.json) ### v4.7.0 (2020-12-03) * Добавлена иерархия контрагентов для консолидированой отчетности на уровне холдингов @@ -14,7 +14,8 @@ CHANGELOG * Номер банковского счета для счета фактуры перенесен в настройки денежных счетов * Добавлен банковский процент для списания оплат операций по безналу -Для обновления версии обновить папки app, templates, templates_ua, выполнить update462to470.sql . +Для обновления версии обновить папки app, templates, templates_ua, выполнить update462to470.sql . + ### v4.6.2 (2020-11-19) diff --git a/www/app/entity/doc/poscheck.php b/www/app/entity/doc/poscheck.php index 0365587e5..c5df5b8a3 100644 --- a/www/app/entity/doc/poscheck.php +++ b/www/app/entity/doc/poscheck.php @@ -57,6 +57,7 @@ public function generateReport() { "shopname" => $common["shopname"], "address" => $firm["address"], "phone" => $firm["phone"], + "inn" => $firm["inn"], "customer_name" => strlen($this->customer_name) > 0 ? $this->customer_name : false, "exchange" => $this->headerdata["exchange"], "pos_name" => $this->headerdata["pos_name"], @@ -112,7 +113,6 @@ public function generatePosReport() { "address" => $firm["address"], "phone" => $firm["phone"], "inn" => $firm["inn"], - "inn" => $firm["inn"], "customer_name" => strlen($this->headerdata["customer_name"]) > 0 ? $this->headerdata["customer_name"] : false, "fiscalnumber" => strlen($this->headerdata["fiscalnumber"])>0 ? $this->headerdata["fiscalnumber"] : false, "exchange" => $this->headerdata["exchange"], diff --git a/www/templates/printforms/doc/poscheck.tpl b/www/templates/printforms/doc/poscheck.tpl index c0b6322b3..3f4681c28 100644 --- a/www/templates/printforms/doc/poscheck.tpl +++ b/www/templates/printforms/doc/poscheck.tpl @@ -6,11 +6,29 @@ Чек № {{document_number}} от {{date}}
+ + + + + + + + + + + + + + + + + + {{#customer_name}} diff --git a/www/templates/printforms/doc/poscheck_bill.tpl b/www/templates/printforms/doc/poscheck_bill.tpl index c8c5c4a66..7b5213fb8 100644 --- a/www/templates/printforms/doc/poscheck_bill.tpl +++ b/www/templates/printforms/doc/poscheck_bill.tpl @@ -6,13 +6,14 @@ - {{/fiscalnumber}} + {{/fiscalnumber}} + - + diff --git a/www/templates_ua/printforms/doc/poscheck.tpl b/www/templates_ua/printforms/doc/poscheck.tpl index 9e05e02d7..8ccc915a3 100644 --- a/www/templates_ua/printforms/doc/poscheck.tpl +++ b/www/templates_ua/printforms/doc/poscheck.tpl @@ -6,6 +6,21 @@ Чек № {{document_number}} від {{date}}
+ + + + + + + + + + + + + + + diff --git a/www/templates_ua/printforms/doc/poscheck_bill.tpl b/www/templates_ua/printforms/doc/poscheck_bill.tpl index 7a881424a..71cfd1f50 100644 --- a/www/templates_ua/printforms/doc/poscheck_bill.tpl +++ b/www/templates_ua/printforms/doc/poscheck_bill.tpl @@ -14,7 +14,7 @@ - + From 2e23adb1d3b585c9d06147abac31a37707f88fb1 Mon Sep 17 00:00:00 2001 From: "HOME\\leonm" Date: Mon, 28 Dec 2020 22:37:10 +0200 Subject: [PATCH 07/11] next --- CHANGELOG.md | 1 + db/db.sql | 181 ++-- db/initdata.sql | 122 +-- db/initdata_ua.sql | 2 +- www/app/application.php | 9 +- www/app/entity/customer.php | 51 +- www/app/entity/doc/document.php | 14 +- www/app/entity/doc/goodsissue.php | 2 +- www/app/entity/doc/goodsreceipt.php | 2 +- www/app/entity/doc/inventory.php | 4 +- www/app/entity/doc/invoice.php | 4 +- www/app/entity/doc/invoicecust.php | 2 +- www/app/entity/doc/order.php | 4 +- www/app/entity/doc/poscheck.php | 7 +- www/app/entity/doc/prodreceipt.php | 2 +- www/app/entity/doc/serviceact.php | 8 +- www/app/entity/doc/task.php | 23 +- www/app/entity/firm.php | 4 +- www/app/entity/item.php | 32 +- www/app/entity/moneyfund.php | 19 +- www/app/entity/pay.php | 67 +- www/app/entity/pos.php | 20 +- www/app/helper.php | 92 +- www/app/modules/ppo/ppohelper.php | 968 +++++++++--------- www/app/modules/ppo/ppolist.php | 59 +- www/app/modules/ppo/zform.php | 145 ++- www/app/modules/shop/pages/grouplist.php | 6 +- www/app/modules/tecdoc/dbhelper.php | 2 +- www/app/modules/tecdoc/options.php | 20 +- www/app/modules/tecdoc/search.php | 2 +- www/app/pages/base.php | 2 +- www/app/pages/branchlist.php | 5 +- www/app/pages/doc/goodsissue.php | 18 +- www/app/pages/doc/goodsreceipt.php | 14 +- www/app/pages/doc/inventory.php | 60 +- www/app/pages/doc/invoice.php | 4 +- www/app/pages/doc/invoicecust.php | 8 +- www/app/pages/doc/ordercust.php | 2 +- www/app/pages/doc/outcomeitem.php | 10 +- www/app/pages/doc/poscheck.php | 8 + www/app/pages/doc/prodissue.php | 4 +- www/app/pages/doc/prodreceipt.php | 15 +- www/app/pages/doc/retcustissue.php | 2 +- www/app/pages/doc/returnissue.php | 66 +- www/app/pages/doc/serviceact.php | 13 +- www/app/pages/doc/task.php | 34 +- www/app/pages/doc/warranty.php | 2 +- www/app/pages/options.php | 6 +- www/app/pages/poslist.php | 35 +- www/app/pages/reference/contractlist.php | 2 +- www/app/pages/reference/customerlist.php | 14 +- www/app/pages/reference/itemlist.php | 50 +- www/app/pages/reference/mflist.php | 20 +- www/app/pages/register/doclist.php | 37 +- www/app/pages/register/gilist.php | 35 +- www/app/pages/register/itemlist.php | 2 +- www/app/pages/register/orderlist.php | 10 +- www/app/pages/register/paycustlist.php | 82 +- www/app/pages/register/paylist.php | 5 +- www/app/pages/report/abc.php | 17 +- www/app/pages/report/income.php | 8 +- www/app/pages/report/outcome.php | 133 ++- www/app/pages/report/paybalance.php | 43 +- www/app/pages/service/armpos.php | 322 +++--- www/app/pages/service/export.php | 75 +- www/app/pages/showreport.php | 4 +- www/app/pages/userlogin.php | 2 +- www/app/thumb.php | 15 +- www/app/util.php | 12 +- www/app/widgets/wrdoc.php | 2 +- www/composer.json | 2 +- www/composer.lock | 576 ++++++++++- www/config/config.ini | 14 +- www/templates/lang.json | 6 +- www/templates/modules/ppo/ppolist.html | 8 +- www/templates/modules/ppo/zform.html | 50 +- www/templates/pages/branchlist.html | 8 +- www/templates/pages/doc/goodsissue.html | 2 +- www/templates/pages/doc/goodsreceipt.html | 2 +- www/templates/pages/doc/returnissue.html | 10 + www/templates/pages/doc/task.html | 7 +- www/templates/pages/poslist.html | 51 +- www/templates/pages/register/doclist.html | 2 +- www/templates/pages/register/gilist.html | 2 +- www/templates/pages/register/grlist.html | 2 +- www/templates/pages/register/itemlist.html | 2 +- .../pages/register/ordercustlist.html | 2 +- www/templates/pages/register/orderlist.html | 2 +- www/templates/pages/register/paycustlist.html | 16 +- www/templates/pages/register/paylist.html | 2 +- www/templates/pages/register/serlist.html | 2 +- www/templates/pages/register/tasklist.html | 2 +- www/templates/pages/service/armpos.html | 17 +- www/templates/printforms/doc/task.tpl | 2 +- www/templates_ua/lang.json | 17 +- www/templates_ua/modules/ppo/ppolist.html | 107 ++ www/templates_ua/modules/ppo/zform.html | 66 ++ www/templates_ua/pages/branchlist.html | 12 +- www/templates_ua/pages/doc/goodsissue.html | 2 +- www/templates_ua/pages/doc/goodsreceipt.html | 2 +- www/templates_ua/pages/doc/returnissue.html | 9 + www/templates_ua/pages/doc/task.html | 7 +- www/templates_ua/pages/poslist.html | 34 +- .../pages/reference/itemlist.html | 2 +- www/templates_ua/pages/register/doclist.html | 2 +- www/templates_ua/pages/register/gilist.html | 2 +- www/templates_ua/pages/register/grlist.html | 2 +- www/templates_ua/pages/register/itemlist.html | 2 +- .../pages/register/ordercustlist.html | 2 +- .../pages/register/orderlist.html | 2 +- .../pages/register/paycustlist.html | 18 +- www/templates_ua/pages/register/paylist.html | 2 +- www/templates_ua/pages/register/serlist.html | 2 +- www/templates_ua/pages/register/tasklist.html | 2 +- www/templates_ua/pages/service/armpos.html | 18 +- www/templates_ua/pages/service/import.html | 2 +- www/templates_ua/printforms/check.xml | 85 ++ www/templates_ua/printforms/checkback.xml | 78 ++ www/templates_ua/printforms/checkpay.xml | 77 ++ www/templates_ua/printforms/doc/task.tpl | 7 +- www/templates_ua/printforms/item_tag.tpl | 10 +- www/templates_ua/printforms/shift.xml | 38 + www/templates_ua/printforms/zform.xml | 77 ++ 123 files changed, 3104 insertions(+), 1443 deletions(-) create mode 100644 www/templates_ua/modules/ppo/ppolist.html create mode 100644 www/templates_ua/modules/ppo/zform.html create mode 100644 www/templates_ua/printforms/check.xml create mode 100644 www/templates_ua/printforms/checkback.xml create mode 100644 www/templates_ua/printforms/checkpay.xml create mode 100644 www/templates_ua/printforms/shift.xml create mode 100644 www/templates_ua/printforms/zform.xml diff --git a/CHANGELOG.md b/CHANGELOG.md index 56c57e872..6c97ac5ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ CHANGELOG ### v4.8.0 (2020-12-19) * Добавлен модуль програмного РРО для отправки чеков в налоговую (Украина). Описание модуля на оф. сайте. +* Экспорт и импорт переделан из csv в полноценный xlsx файл Для обновления версии обновить папки app, templates, templates_ua, выполнить update470to480.sql . Обновить папку vendor (или выполнить composer, предварительно обновив composer.json) diff --git a/db/db.sql b/db/db.sql index 657fd84ef..0b3d5430c 100644 --- a/db/db.sql +++ b/db/db.sql @@ -18,7 +18,7 @@ CREATE TABLE `branches` ( `details` longtext NOT NULL, `disabled` tinyint(1) NOT NULL DEFAULT '0', PRIMARY KEY (`branch_id`) -) AUTO_INCREMENT=3 ; +) AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `contracts`; /*!40101 SET @saved_cs_client = @@character_set_client */; @@ -32,7 +32,7 @@ CREATE TABLE `contracts` ( `disabled` tinyint(1) DEFAULT '0', `details` longtext NOT NULL, PRIMARY KEY (`contract_id`) -) AUTO_INCREMENT=6 ; +) AUTO_INCREMENT=6 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `contracts_view`; /*!50001 DROP VIEW IF EXISTS `contracts_view`*/; @@ -61,7 +61,7 @@ CREATE TABLE `customers` ( `status` smallint(4) NOT NULL DEFAULT '0', `city` varchar(255) DEFAULT NULL, PRIMARY KEY (`customer_id`) -) AUTO_INCREMENT=17 ; +) AUTO_INCREMENT=17 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `customers_view`; /*!50001 DROP VIEW IF EXISTS `customers_view`*/; @@ -91,7 +91,7 @@ CREATE TABLE `docstatelog` ( `hostname` varchar(64) NOT NULL, PRIMARY KEY (`log_id`), KEY `document_id` (`document_id`) -) AUTO_INCREMENT=1128 ; +) AUTO_INCREMENT=1149 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `docstatelog_view`; /*!50001 DROP VIEW IF EXISTS `docstatelog_view`*/; @@ -134,7 +134,7 @@ CREATE TABLE `documents` ( KEY `user_id` (`user_id`), KEY `branch_id` (`branch_id`), KEY `meta_id` (`meta_id`) -) AUTO_INCREMENT=301 ; +) AUTO_INCREMENT=310 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `documents_view`; /*!50001 DROP VIEW IF EXISTS `documents_view`*/; @@ -174,7 +174,7 @@ CREATE TABLE `employees` ( `emp_name` varchar(64) NOT NULL, `branch_id` int(11) DEFAULT '0', PRIMARY KEY (`employee_id`) -) AUTO_INCREMENT=6 ; +) AUTO_INCREMENT=6 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `entrylist`; /*!40101 SET @saved_cs_client = @@character_set_client */; @@ -190,9 +190,9 @@ CREATE TABLE `entrylist` ( PRIMARY KEY (`entry_id`), KEY `document_id` (`document_id`), KEY `stock_id` (`stock_id`) -) AUTO_INCREMENT=799 ; +) AUTO_INCREMENT=802 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; - +ALTER DATABASE `zstore` CHARACTER SET utf8 COLLATE utf8_general_ci ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -202,7 +202,7 @@ CREATE TABLE `entrylist` ( /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 */ /*!50003 TRIGGER `entrylist_after_ins_tr` AFTER INSERT ON `entrylist` +/*!50003 CREATE*/ /*!50017 */ /*!50003 TRIGGER `entrylist_after_ins_tr` AFTER INSERT ON `entrylist` FOR EACH ROW BEGIN @@ -218,7 +218,8 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; - +ALTER DATABASE `zstore` CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci ; +ALTER DATABASE `zstore` CHARACTER SET utf8 COLLATE utf8_general_ci ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -243,7 +244,7 @@ DELIMITER ; /*!50003 SET character_set_client = @saved_cs_client */ ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; - +ALTER DATABASE `zstore` CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci ; DROP TABLE IF EXISTS `entrylist_view`; /*!50001 DROP VIEW IF EXISTS `entrylist_view`*/; SET @saved_cs_client = @@character_set_client; @@ -270,7 +271,7 @@ CREATE TABLE `equipments` ( `disabled` tinyint(1) DEFAULT '0', `description` text, PRIMARY KEY (`eq_id`) -) AUTO_INCREMENT=4 ; +) AUTO_INCREMENT=4 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `eventlist`; /*!40101 SET @saved_cs_client = @@character_set_client */; @@ -286,7 +287,7 @@ CREATE TABLE `eventlist` ( PRIMARY KEY (`event_id`), KEY `user_id` (`user_id`), KEY `customer_id` (`customer_id`) -) AUTO_INCREMENT=5 ; +) AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `eventlist_view`; /*!50001 DROP VIEW IF EXISTS `eventlist_view`*/; @@ -314,7 +315,7 @@ CREATE TABLE `files` ( `mime` varchar(16) DEFAULT NULL, PRIMARY KEY (`file_id`), KEY `item_id` (`item_id`) -) AUTO_INCREMENT=32 ; +) AUTO_INCREMENT=32 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `filesdata`; /*!40101 SET @saved_cs_client = @@character_set_client */; @@ -323,7 +324,7 @@ CREATE TABLE `filesdata` ( `file_id` int(11) DEFAULT NULL, `filedata` longblob, UNIQUE KEY `file_id` (`file_id`) -) ; +) DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `firms`; /*!40101 SET @saved_cs_client = @@character_set_client */; @@ -334,7 +335,7 @@ CREATE TABLE `firms` ( `details` longtext NOT NULL, `disabled` tinyint(1) NOT NULL DEFAULT '0', PRIMARY KEY (`firm_id`) -) AUTO_INCREMENT=3 ; +) AUTO_INCREMENT=4 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `images`; /*!40101 SET @saved_cs_client = @@character_set_client */; @@ -345,7 +346,7 @@ CREATE TABLE `images` ( `mime` varchar(16) DEFAULT NULL, `thumb` longblob, PRIMARY KEY (`image_id`) -) AUTO_INCREMENT=48 ; +) AUTO_INCREMENT=48 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `issue_history`; /*!40101 SET @saved_cs_client = @@character_set_client */; @@ -358,7 +359,7 @@ CREATE TABLE `issue_history` ( `description` varchar(255) NOT NULL, PRIMARY KEY (`hist_id`), KEY `issue_id` (`issue_id`) -) AUTO_INCREMENT=6 ; +) AUTO_INCREMENT=6 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `issue_issuelist`; /*!40101 SET @saved_cs_client = @@character_set_client */; @@ -375,7 +376,7 @@ CREATE TABLE `issue_issuelist` ( PRIMARY KEY (`issue_id`), KEY `project_id` (`project_id`), KEY `user_id` (`user_id`) -) AUTO_INCREMENT=16 ; +) AUTO_INCREMENT=16 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `issue_issuelist_view`; /*!50001 DROP VIEW IF EXISTS `issue_issuelist_view`*/; @@ -401,7 +402,7 @@ CREATE TABLE `issue_projectacc` ( `project_id` int(11) NOT NULL, `user_id` int(11) NOT NULL, PRIMARY KEY (`id`) -) AUTO_INCREMENT=12 ; +) AUTO_INCREMENT=12 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `issue_projectlist`; /*!40101 SET @saved_cs_client = @@character_set_client */; @@ -413,7 +414,7 @@ CREATE TABLE `issue_projectlist` ( `customer_id` int(11) DEFAULT NULL, `status` smallint(6) DEFAULT NULL, PRIMARY KEY (`project_id`) -) AUTO_INCREMENT=11 ; +) AUTO_INCREMENT=11 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `issue_projectlist_view`; /*!50001 DROP VIEW IF EXISTS `issue_projectlist_view`*/; @@ -442,7 +443,7 @@ CREATE TABLE `issue_time` ( `notes` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`), KEY `issue_id` (`issue_id`) -) AUTO_INCREMENT=31 ; +) AUTO_INCREMENT=31 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `issue_time_view`; /*!50001 DROP VIEW IF EXISTS `issue_time_view`*/; @@ -468,7 +469,7 @@ CREATE TABLE `item_cat` ( `cat_name` varchar(255) NOT NULL, `detail` longtext, PRIMARY KEY (`cat_id`) -) AUTO_INCREMENT=6 ; +) AUTO_INCREMENT=6 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `item_set`; /*!40101 SET @saved_cs_client = @@character_set_client */; @@ -479,7 +480,7 @@ CREATE TABLE `item_set` ( `pitem_id` int(11) DEFAULT '0', `qty` decimal(11,3) DEFAULT '0.000', PRIMARY KEY (`set_id`) -) AUTO_INCREMENT=5 ; +) AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `item_set_view`; /*!50001 DROP VIEW IF EXISTS `item_set_view`*/; @@ -513,7 +514,7 @@ CREATE TABLE `items` ( KEY `item_code` (`item_code`), KEY `itemname` (`itemname`), KEY `cat_id` (`cat_id`) -) AUTO_INCREMENT=575 ; +) AUTO_INCREMENT=575 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `items_view`; /*!50001 DROP VIEW IF EXISTS `items_view`*/; @@ -546,7 +547,7 @@ CREATE TABLE `messages` ( `item_type` int(11) DEFAULT NULL, PRIMARY KEY (`message_id`), KEY `item_id` (`item_id`) -) AUTO_INCREMENT=79 ; +) AUTO_INCREMENT=79 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `messages_view`; /*!50001 DROP VIEW IF EXISTS `messages_view`*/; @@ -572,7 +573,7 @@ CREATE TABLE `metadata` ( `menugroup` varchar(255) DEFAULT NULL, `disabled` tinyint(4) NOT NULL, PRIMARY KEY (`meta_id`) -) AUTO_INCREMENT=84 ; +) AUTO_INCREMENT=85 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `mfund`; /*!40101 SET @saved_cs_client = @@character_set_client */; @@ -584,7 +585,7 @@ CREATE TABLE `mfund` ( `branch_id` int(11) DEFAULT '0', `detail` longtext, PRIMARY KEY (`mf_id`) -) AUTO_INCREMENT=6 ; +) AUTO_INCREMENT=6 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `note_fav`; /*!40101 SET @saved_cs_client = @@character_set_client */; @@ -594,7 +595,7 @@ CREATE TABLE `note_fav` ( `topic_id` int(11) NOT NULL, `user_id` int(11) NOT NULL, PRIMARY KEY (`fav_id`) -) AUTO_INCREMENT=8 ; +) AUTO_INCREMENT=8 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `note_nodes`; /*!40101 SET @saved_cs_client = @@character_set_client */; @@ -608,7 +609,7 @@ CREATE TABLE `note_nodes` ( `ispublic` tinyint(1) DEFAULT '0', PRIMARY KEY (`node_id`), KEY `user_id` (`user_id`) -) AUTO_INCREMENT=17 ; +) AUTO_INCREMENT=17 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `note_nodesview`; /*!50001 DROP VIEW IF EXISTS `note_nodesview`*/; @@ -632,7 +633,7 @@ CREATE TABLE `note_tags` ( `tagvalue` varchar(255) NOT NULL, PRIMARY KEY (`tag_id`), KEY `topic_id` (`topic_id`) -) AUTO_INCREMENT=34 ; +) AUTO_INCREMENT=34 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `note_topicnode`; /*!40101 SET @saved_cs_client = @@character_set_client */; @@ -644,7 +645,7 @@ CREATE TABLE `note_topicnode` ( PRIMARY KEY (`tn_id`), KEY `topic_id` (`topic_id`), KEY `node_id` (`node_id`) -) AUTO_INCREMENT=32 ; +) AUTO_INCREMENT=32 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `note_topicnodeview`; /*!50001 DROP VIEW IF EXISTS `note_topicnodeview`*/; @@ -668,7 +669,7 @@ CREATE TABLE `note_topics` ( `acctype` smallint(4) DEFAULT '0', `user_id` int(11) NOT NULL, PRIMARY KEY (`topic_id`) -) AUTO_INCREMENT=28 ; +) AUTO_INCREMENT=28 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `note_topicsview`; /*!50001 DROP VIEW IF EXISTS `note_topicsview`*/; @@ -693,7 +694,7 @@ CREATE TABLE `notifies` ( `sender_name` varchar(255) DEFAULT NULL, PRIMARY KEY (`notify_id`), KEY `user_id` (`user_id`) -) AUTO_INCREMENT=92 ; +) AUTO_INCREMENT=92 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `options`; /*!40101 SET @saved_cs_client = @@character_set_client */; @@ -702,7 +703,7 @@ CREATE TABLE `options` ( `optname` varchar(64) NOT NULL, `optvalue` longtext NOT NULL, UNIQUE KEY `optname` (`optname`) -) ; +) DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `parealist`; /*!40101 SET @saved_cs_client = @@character_set_client */; @@ -711,7 +712,7 @@ CREATE TABLE `parealist` ( `pa_id` int(11) NOT NULL AUTO_INCREMENT, `pa_name` varchar(255) NOT NULL, PRIMARY KEY (`pa_id`) -) AUTO_INCREMENT=2 ; +) AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `paylist`; /*!40101 SET @saved_cs_client = @@character_set_client */; @@ -728,7 +729,7 @@ CREATE TABLE `paylist` ( `detail` longtext, PRIMARY KEY (`pl_id`), KEY `document_id` (`document_id`) -) AUTO_INCREMENT=263 ; +) AUTO_INCREMENT=264 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `paylist_view`; /*!50001 DROP VIEW IF EXISTS `paylist_view`*/; @@ -759,7 +760,23 @@ CREATE TABLE `poslist` ( `details` longtext NOT NULL, `branch_id` int(11) DEFAULT '0', PRIMARY KEY (`pos_id`) -) AUTO_INCREMENT=2 ; +) AUTO_INCREMENT=4 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `ppo_zformstat`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `ppo_zformstat` ( + `zf_id` int(11) NOT NULL AUTO_INCREMENT, + `pos_id` int(11) NOT NULL, + `checktype` int(11) NOT NULL, + `createdon` datetime NOT NULL, + `document_number` varchar(255) NOT NULL, + `amount0` decimal(10,2) NOT NULL, + `amount1` decimal(10,2) NOT NULL, + `amount2` decimal(10,2) NOT NULL, + `amount3` decimal(10,2) NOT NULL, + PRIMARY KEY (`zf_id`) +) DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `roles`; /*!40101 SET @saved_cs_client = @@character_set_client */; @@ -769,7 +786,7 @@ CREATE TABLE `roles` ( `rolename` varchar(255) DEFAULT NULL, `acl` mediumtext, PRIMARY KEY (`role_id`) -) AUTO_INCREMENT=3 ; +) AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `roles_view`; /*!50001 DROP VIEW IF EXISTS `roles_view`*/; @@ -790,7 +807,7 @@ CREATE TABLE `services` ( `detail` text, `disabled` tinyint(1) DEFAULT '0', PRIMARY KEY (`service_id`) -) AUTO_INCREMENT=6 ; +) AUTO_INCREMENT=6 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `shop_attributes`; /*!40101 SET @saved_cs_client = @@character_set_client */; @@ -803,7 +820,7 @@ CREATE TABLE `shop_attributes` ( `valueslist` varchar(255) DEFAULT NULL, `showinlist` tinyint(1) DEFAULT NULL, PRIMARY KEY (`attribute_id`) -) ; +) DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `shop_attributes_order`; /*!40101 SET @saved_cs_client = @@character_set_client */; @@ -814,7 +831,7 @@ CREATE TABLE `shop_attributes_order` ( `pg_id` int(11) NOT NULL, `ordern` int(11) NOT NULL, PRIMARY KEY (`order_id`) -) ; +) DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `shop_attributes_view`; /*!50001 DROP VIEW IF EXISTS `shop_attributes_view`*/; @@ -839,7 +856,7 @@ CREATE TABLE `shop_attributevalues` ( `attributevalue` varchar(255) NOT NULL, PRIMARY KEY (`attributevalue_id`), KEY `attribute_id` (`attribute_id`) -) ; +) DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `shop_manufacturers`; /*!40101 SET @saved_cs_client = @@character_set_client */; @@ -849,7 +866,7 @@ CREATE TABLE `shop_manufacturers` ( `manufacturername` varchar(255) NOT NULL, `url` varchar(255) NOT NULL, PRIMARY KEY (`manufacturer_id`) -) ; +) DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `shop_prod_comments`; /*!40101 SET @saved_cs_client = @@character_set_client */; @@ -864,7 +881,7 @@ CREATE TABLE `shop_prod_comments` ( `moderated` tinyint(1) NOT NULL DEFAULT '0', PRIMARY KEY (`comment_id`), KEY `product_id` (`product_id`) -) AUTO_INCREMENT=4 ; +) AUTO_INCREMENT=4 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `shop_productgroups`; /*!40101 SET @saved_cs_client = @@character_set_client */; @@ -876,7 +893,7 @@ CREATE TABLE `shop_productgroups` ( `mpath` varchar(1024) DEFAULT NULL, `image_id` int(11) NOT NULL DEFAULT '0', PRIMARY KEY (`group_id`) -) AUTO_INCREMENT=10 ; +) AUTO_INCREMENT=10 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `shop_productgroups_view`; /*!50001 DROP VIEW IF EXISTS `shop_productgroups_view`*/; @@ -910,7 +927,7 @@ CREATE TABLE `shop_products` ( `comments` int(11) DEFAULT '0', PRIMARY KEY (`product_id`), KEY `group_id` (`group_id`) -) AUTO_INCREMENT=4 ; +) AUTO_INCREMENT=4 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `shop_products_view`; /*!50001 DROP VIEW IF EXISTS `shop_products_view`*/; @@ -949,7 +966,7 @@ CREATE TABLE `store_stock` ( `sdate` date DEFAULT NULL, PRIMARY KEY (`stock_id`), KEY `item_id` (`item_id`) -) AUTO_INCREMENT=573 ; +) AUTO_INCREMENT=573 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `store_stock_view`; /*!50001 DROP VIEW IF EXISTS `store_stock_view`*/; @@ -982,7 +999,7 @@ CREATE TABLE `stores` ( `description` varchar(255) DEFAULT NULL, `branch_id` int(11) DEFAULT '0', PRIMARY KEY (`store_id`) -) AUTO_INCREMENT=28 ; +) AUTO_INCREMENT=28 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `timesheet`; /*!40101 SET @saved_cs_client = @@character_set_client */; @@ -997,7 +1014,7 @@ CREATE TABLE `timesheet` ( `t_break` smallint(6) DEFAULT '0', PRIMARY KEY (`time_id`), KEY `emp_id` (`emp_id`) -) AUTO_INCREMENT=30 ; +) AUTO_INCREMENT=30 DEFAULT CHARSET=utf8mb4; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `timesheet_view`; /*!50001 DROP VIEW IF EXISTS `timesheet_view`*/; @@ -1030,7 +1047,7 @@ CREATE TABLE `users` ( `role_id` int(11) DEFAULT NULL, PRIMARY KEY (`user_id`), UNIQUE KEY `userlogin` (`userlogin`) -) AUTO_INCREMENT=9 ; +) AUTO_INCREMENT=9 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `users_view`; /*!50001 DROP VIEW IF EXISTS `users_view`*/; @@ -1051,6 +1068,22 @@ SET character_set_client = utf8; 1 AS `employee_id`, 1 AS `username`*/; SET character_set_client = @saved_cs_client; +DROP TABLE IF EXISTS `zformstat`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `zformstat` ( + `zf_id` int(11) NOT NULL AUTO_INCREMENT, + `pos_id` int(11) NOT NULL, + `checktype` int(11) NOT NULL, + `amount0` decimal(10,2) NOT NULL, + `createdon` datetime NOT NULL, + `amount1` decimal(10,2) NOT NULL, + `amount2` decimal(10,2) NOT NULL, + `document_number` varchar(255) NOT NULL, + `amount3` decimal(10,2) NOT NULL, + PRIMARY KEY (`zf_id`) +) AUTO_INCREMENT=25 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; /*!50001 DROP VIEW IF EXISTS `contracts_view`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; @@ -1059,7 +1092,7 @@ SET character_set_client = @saved_cs_client; /*!50001 SET character_set_results = latin1 */; /*!50001 SET collation_connection = latin1_swedish_ci */; /*!50001 CREATE */ -/*!50013 */ +/*!50013 */ /*!50001 VIEW `contracts_view` AS select `co`.`contract_id` AS `contract_id`,`co`.`customer_id` AS `customer_id`,`co`.`firm_id` AS `firm_id`,`co`.`createdon` AS `createdon`,`co`.`contract_number` AS `contract_number`,`co`.`disabled` AS `disabled`,`co`.`details` AS `details`,`cu`.`customer_name` AS `customer_name`,`f`.`firm_name` AS `firm_name` from ((`contracts` `co` join `customers` `cu` on((`co`.`customer_id` = `cu`.`customer_id`))) left join `firms` `f` on((`co`.`firm_id` = `f`.`firm_id`))) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; @@ -1072,7 +1105,7 @@ SET character_set_client = @saved_cs_client; /*!50001 SET character_set_results = latin1 */; /*!50001 SET collation_connection = latin1_swedish_ci */; /*!50001 CREATE */ -/*!50013 */ +/*!50013 */ /*!50001 VIEW `customers_view` AS select `customers`.`customer_id` AS `customer_id`,`customers`.`customer_name` AS `customer_name`,`customers`.`detail` AS `detail`,`customers`.`email` AS `email`,`customers`.`phone` AS `phone`,`customers`.`status` AS `status`,`customers`.`city` AS `city`,(select count(0) from `messages` `m` where ((`m`.`item_id` = `customers`.`customer_id`) and (`m`.`item_type` = 2))) AS `mcnt`,(select count(0) from `files` `f` where ((`f`.`item_id` = `customers`.`customer_id`) and (`f`.`item_type` = 2))) AS `fcnt`,(select count(0) from `eventlist` `e` where ((`e`.`customer_id` = `customers`.`customer_id`) and (`e`.`eventdate` >= now()))) AS `ecnt` from `customers` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; @@ -1085,7 +1118,7 @@ SET character_set_client = @saved_cs_client; /*!50001 SET character_set_results = latin1 */; /*!50001 SET collation_connection = latin1_swedish_ci */; /*!50001 CREATE */ -/*!50013 */ +/*!50013 */ /*!50001 VIEW `docstatelog_view` AS select `dl`.`log_id` AS `log_id`,`dl`.`user_id` AS `user_id`,`dl`.`document_id` AS `document_id`,`dl`.`docstate` AS `docstate`,`dl`.`createdon` AS `createdon`,`dl`.`hostname` AS `hostname`,`u`.`username` AS `username`,`d`.`document_number` AS `document_number`,`d`.`meta_desc` AS `meta_desc`,`d`.`meta_name` AS `meta_name` from ((`docstatelog` `dl` join `users_view` `u` on((`dl`.`user_id` = `u`.`user_id`))) join `documents_view` `d` on((`d`.`document_id` = `dl`.`document_id`))) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; @@ -1098,7 +1131,7 @@ SET character_set_client = @saved_cs_client; /*!50001 SET character_set_results = latin1 */; /*!50001 SET collation_connection = latin1_swedish_ci */; /*!50001 CREATE */ -/*!50013 */ +/*!50013 */ /*!50001 VIEW `documents_view` AS select `d`.`document_id` AS `document_id`,`d`.`document_number` AS `document_number`,`d`.`document_date` AS `document_date`,`d`.`user_id` AS `user_id`,`d`.`content` AS `content`,`d`.`amount` AS `amount`,`d`.`meta_id` AS `meta_id`,`u`.`username` AS `username`,`c`.`customer_id` AS `customer_id`,`c`.`customer_name` AS `customer_name`,`d`.`state` AS `state`,`d`.`notes` AS `notes`,`d`.`payamount` AS `payamount`,`d`.`payed` AS `payed`,`d`.`parent_id` AS `parent_id`,`d`.`branch_id` AS `branch_id`,`b`.`branch_name` AS `branch_name`,`d`.`firm_id` AS `firm_id`,`f`.`firm_name` AS `firm_name`,`metadata`.`meta_name` AS `meta_name`,`metadata`.`description` AS `meta_desc` from (((((`documents` `d` left join `users_view` `u` on((`d`.`user_id` = `u`.`user_id`))) left join `customers` `c` on((`d`.`customer_id` = `c`.`customer_id`))) join `metadata` on((`metadata`.`meta_id` = `d`.`meta_id`))) left join `branches` `b` on((`d`.`branch_id` = `b`.`branch_id`))) left join `firms` `f` on((`d`.`firm_id` = `f`.`firm_id`))) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; @@ -1111,7 +1144,7 @@ SET character_set_client = @saved_cs_client; /*!50001 SET character_set_results = latin1 */; /*!50001 SET collation_connection = latin1_swedish_ci */; /*!50001 CREATE */ -/*!50013 */ +/*!50013 */ /*!50001 VIEW `entrylist_view` AS select `entrylist`.`entry_id` AS `entry_id`,`entrylist`.`document_id` AS `document_id`,`entrylist`.`amount` AS `amount`,`entrylist`.`quantity` AS `quantity`,`documents`.`customer_id` AS `customer_id`,`entrylist`.`extcode` AS `extcode`,`entrylist`.`stock_id` AS `stock_id`,`entrylist`.`service_id` AS `service_id`,`store_stock`.`item_id` AS `item_id`,`documents`.`document_date` AS `document_date` from ((`entrylist` left join `store_stock` on((`entrylist`.`stock_id` = `store_stock`.`stock_id`))) join `documents` on((`entrylist`.`document_id` = `documents`.`document_id`))) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; @@ -1124,7 +1157,7 @@ SET character_set_client = @saved_cs_client; /*!50001 SET character_set_results = latin1 */; /*!50001 SET collation_connection = latin1_swedish_ci */; /*!50001 CREATE */ -/*!50013 */ +/*!50013 */ /*!50001 VIEW `eventlist_view` AS select `e`.`user_id` AS `user_id`,`e`.`eventdate` AS `eventdate`,`e`.`title` AS `title`,`e`.`description` AS `description`,`e`.`notify_id` AS `notify_id`,`e`.`event_id` AS `event_id`,`e`.`customer_id` AS `customer_id`,`c`.`customer_name` AS `customer_name` from (`eventlist` `e` left join `customers` `c` on((`e`.`customer_id` = `c`.`customer_id`))) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; @@ -1137,7 +1170,7 @@ SET character_set_client = @saved_cs_client; /*!50001 SET character_set_results = latin1 */; /*!50001 SET collation_connection = latin1_swedish_ci */; /*!50001 CREATE */ -/*!50013 */ +/*!50013 */ /*!50001 VIEW `issue_issuelist_view` AS select `i`.`issue_id` AS `issue_id`,`i`.`issue_name` AS `issue_name`,`i`.`details` AS `details`,`i`.`status` AS `status`,`i`.`priority` AS `priority`,`i`.`user_id` AS `user_id`,`i`.`lastupdate` AS `lastupdate`,`i`.`project_id` AS `project_id`,`u`.`username` AS `username`,`p`.`project_name` AS `project_name` from ((`issue_issuelist` `i` left join `users_view` `u` on((`i`.`user_id` = `u`.`user_id`))) join `issue_projectlist` `p` on((`i`.`project_id` = `p`.`project_id`))) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; @@ -1150,7 +1183,7 @@ SET character_set_client = @saved_cs_client; /*!50001 SET character_set_results = latin1 */; /*!50001 SET collation_connection = latin1_swedish_ci */; /*!50001 CREATE */ -/*!50013 */ +/*!50013 */ /*!50001 VIEW `issue_projectlist_view` AS select `p`.`project_id` AS `project_id`,`p`.`project_name` AS `project_name`,`p`.`details` AS `details`,`p`.`customer_id` AS `customer_id`,`p`.`status` AS `status`,`c`.`customer_name` AS `customer_name`,(select coalesce(sum((case when (`i`.`status` = 0) then 1 else 0 end)),0) from `issue_issuelist` `i` where (`i`.`project_id` = `p`.`project_id`)) AS `inew`,(select coalesce(sum((case when (`i`.`status` > 1) then 1 else 0 end)),0) from `issue_issuelist` `i` where (`i`.`project_id` = `p`.`project_id`)) AS `iproc`,(select coalesce(sum((case when (`i`.`status` = 1) then 1 else 0 end)),0) from `issue_issuelist` `i` where (`i`.`project_id` = `p`.`project_id`)) AS `iclose` from (`issue_projectlist` `p` left join `customers` `c` on((`p`.`customer_id` = `c`.`customer_id`))) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; @@ -1163,7 +1196,7 @@ SET character_set_client = @saved_cs_client; /*!50001 SET character_set_results = latin1 */; /*!50001 SET collation_connection = latin1_swedish_ci */; /*!50001 CREATE */ -/*!50013 */ +/*!50013 */ /*!50001 VIEW `issue_time_view` AS select `t`.`id` AS `id`,`t`.`issue_id` AS `issue_id`,`t`.`createdon` AS `createdon`,`t`.`user_id` AS `user_id`,`t`.`duration` AS `duration`,`t`.`notes` AS `notes`,`u`.`username` AS `username`,`i`.`issue_name` AS `issue_name`,`i`.`project_id` AS `project_id`,`i`.`project_name` AS `project_name` from ((`issue_time` `t` join `users_view` `u` on((`t`.`user_id` = `u`.`user_id`))) join `issue_issuelist_view` `i` on((`t`.`issue_id` = `i`.`issue_id`))) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; @@ -1176,7 +1209,7 @@ SET character_set_client = @saved_cs_client; /*!50001 SET character_set_results = utf8mb4 */; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE */ -/*!50013 */ +/*!50013 */ /*!50001 VIEW `item_set_view` AS select `item_set`.`set_id` AS `set_id`,`item_set`.`item_id` AS `item_id`,`item_set`.`pitem_id` AS `pitem_id`,`item_set`.`qty` AS `qty`,`items`.`itemname` AS `itemname`,`items`.`item_code` AS `item_code` from (`item_set` join `items` on((`item_set`.`item_id` = `items`.`item_id`))) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; @@ -1189,7 +1222,7 @@ SET character_set_client = @saved_cs_client; /*!50001 SET character_set_results = utf8mb4 */; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE */ -/*!50013 */ +/*!50013 */ /*!50001 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`))) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; @@ -1202,7 +1235,7 @@ SET character_set_client = @saved_cs_client; /*!50001 SET character_set_results = latin1 */; /*!50001 SET collation_connection = latin1_swedish_ci */; /*!50001 CREATE */ -/*!50013 */ +/*!50013 */ /*!50001 VIEW `messages_view` AS select `messages`.`message_id` AS `message_id`,`messages`.`user_id` AS `user_id`,`messages`.`created` AS `created`,`messages`.`message` AS `message`,`messages`.`item_id` AS `item_id`,`messages`.`item_type` AS `item_type`,`users_view`.`username` AS `username` from (`messages` join `users_view` on((`messages`.`user_id` = `users_view`.`user_id`))) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; @@ -1215,7 +1248,7 @@ SET character_set_client = @saved_cs_client; /*!50001 SET character_set_results = latin1 */; /*!50001 SET collation_connection = latin1_swedish_ci */; /*!50001 CREATE */ -/*!50013 */ +/*!50013 */ /*!50001 VIEW `note_nodesview` AS select `note_nodes`.`node_id` AS `node_id`,`note_nodes`.`pid` AS `pid`,`note_nodes`.`title` AS `title`,`note_nodes`.`mpath` AS `mpath`,`note_nodes`.`user_id` AS `user_id`,`note_nodes`.`ispublic` AS `ispublic`,(select count(`note_topicnode`.`topic_id`) AS `Count(topic_id)` from `note_topicnode` where (`note_topicnode`.`node_id` = `note_nodes`.`node_id`)) AS `tcnt` from `note_nodes` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; @@ -1228,7 +1261,7 @@ SET character_set_client = @saved_cs_client; /*!50001 SET character_set_results = latin1 */; /*!50001 SET collation_connection = latin1_swedish_ci */; /*!50001 CREATE */ -/*!50013 */ +/*!50013 */ /*!50001 VIEW `note_topicnodeview` AS select `note_topicnode`.`topic_id` AS `topic_id`,`note_topicnode`.`node_id` AS `node_id`,`note_topicnode`.`tn_id` AS `tn_id`,`note_topics`.`title` AS `title`,`note_nodes`.`user_id` AS `user_id`,`note_topics`.`content` AS `content` from ((`note_topics` join `note_topicnode` on((`note_topics`.`topic_id` = `note_topicnode`.`topic_id`))) join `note_nodes` on((`note_nodes`.`node_id` = `note_topicnode`.`node_id`))) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; @@ -1241,7 +1274,7 @@ SET character_set_client = @saved_cs_client; /*!50001 SET character_set_results = latin1 */; /*!50001 SET collation_connection = latin1_swedish_ci */; /*!50001 CREATE */ -/*!50013 */ +/*!50013 */ /*!50001 VIEW `note_topicsview` AS select `t`.`topic_id` AS `topic_id`,`t`.`title` AS `title`,`t`.`content` AS `content`,`t`.`acctype` AS `acctype`,`t`.`user_id` AS `user_id` from `note_topics` `t` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; @@ -1254,7 +1287,7 @@ SET character_set_client = @saved_cs_client; /*!50001 SET character_set_results = latin1 */; /*!50001 SET collation_connection = latin1_swedish_ci */; /*!50001 CREATE */ -/*!50013 */ +/*!50013 */ /*!50001 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`))) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; @@ -1267,7 +1300,7 @@ SET character_set_client = @saved_cs_client; /*!50001 SET character_set_results = utf8mb4 */; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE */ -/*!50013 */ +/*!50013 */ /*!50001 VIEW `roles_view` AS select `roles`.`role_id` AS `role_id`,`roles`.`rolename` AS `rolename`,`roles`.`acl` AS `acl`,(select coalesce(count(0),0) from `users` where (`users`.`role_id` = `roles`.`role_id`)) AS `cnt` from `roles` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; @@ -1280,7 +1313,7 @@ SET character_set_client = @saved_cs_client; /*!50001 SET character_set_results = latin1 */; /*!50001 SET collation_connection = latin1_swedish_ci */; /*!50001 CREATE */ -/*!50013 */ +/*!50013 */ /*!50001 VIEW `shop_attributes_view` AS select `shop_attributes`.`attribute_id` AS `attribute_id`,`shop_attributes`.`attributename` AS `attributename`,`shop_attributes`.`group_id` AS `group_id`,`shop_attributes`.`attributetype` AS `attributetype`,`shop_attributes`.`valueslist` AS `valueslist`,`shop_attributes`.`showinlist` AS `showinlist`,`shop_attributes_order`.`ordern` AS `ordern` from (`shop_attributes` join `shop_attributes_order` on(((`shop_attributes`.`attribute_id` = `shop_attributes_order`.`attr_id`) and (`shop_attributes`.`group_id` = `shop_attributes_order`.`pg_id`)))) order by `shop_attributes_order`.`ordern` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; @@ -1293,7 +1326,7 @@ SET character_set_client = @saved_cs_client; /*!50001 SET character_set_results = latin1 */; /*!50001 SET collation_connection = latin1_swedish_ci */; /*!50001 CREATE */ -/*!50013 */ +/*!50013 */ /*!50001 VIEW `shop_productgroups_view` AS select `g`.`group_id` AS `group_id`,`g`.`parent_id` AS `parent_id`,`g`.`groupname` AS `groupname`,`g`.`mpath` AS `mpath`,`g`.`image_id` AS `image_id`,(select count(`sg`.`group_id`) AS `cnt` from `shop_productgroups` `sg` where (`g`.`group_id` = `sg`.`parent_id`)) AS `gcnt`,(select count(`p`.`product_id`) AS `cnt` from `shop_products` `p` where (`g`.`group_id` = `p`.`group_id`)) AS `pcnt` from `shop_productgroups` `g` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; @@ -1306,7 +1339,7 @@ SET character_set_client = @saved_cs_client; /*!50001 SET character_set_results = latin1 */; /*!50001 SET collation_connection = latin1_swedish_ci */; /*!50001 CREATE */ -/*!50013 */ +/*!50013 */ /*!50001 VIEW `shop_products_view` AS select `p`.`product_id` AS `product_id`,`p`.`group_id` AS `group_id`,`p`.`productname` AS `productname`,`p`.`manufacturer_id` AS `manufacturer_id`,`p`.`price` AS `price`,`p`.`sold` AS `sold`,`p`.`deleted` AS `deleted`,`p`.`sef` AS `sef`,`p`.`item_id` AS `item_id`,`p`.`created` AS `created`,`p`.`detail` AS `detail`,`p`.`rating` AS `rating`,`i`.`item_code` AS `item_code`,(case when (`p`.`created` > (now() - interval 1 month)) then 1 else 0 end) AS `novelty`,`p`.`comments` AS `comments`,`g`.`groupname` AS `groupname`,`m`.`manufacturername` AS `manufacturername`,0 AS `qty` from (((`shop_products` `p` join `shop_productgroups` `g` on((`p`.`group_id` = `g`.`group_id`))) left join `shop_manufacturers` `m` on((`p`.`manufacturer_id` = `m`.`manufacturer_id`))) join `items` `i` on((`p`.`item_id` = `i`.`item_id`))) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; @@ -1319,7 +1352,7 @@ SET character_set_client = @saved_cs_client; /*!50001 SET character_set_results = utf8mb4 */; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE */ -/*!50013 */ +/*!50013 */ /*!50001 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`))) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; @@ -1332,7 +1365,7 @@ SET character_set_client = @saved_cs_client; /*!50001 SET character_set_results = latin1 */; /*!50001 SET collation_connection = latin1_swedish_ci */; /*!50001 CREATE */ -/*!50013 */ +/*!50013 */ /*!50001 VIEW `timesheet_view` AS select `t`.`time_id` AS `time_id`,`t`.`emp_id` AS `emp_id`,`t`.`description` AS `description`,`t`.`t_start` AS `t_start`,`t`.`t_end` AS `t_end`,`t`.`t_type` AS `t_type`,`t`.`t_break` AS `t_break`,`e`.`emp_name` AS `emp_name`,`e`.`disabled` AS `disabled`,`e`.`branch_id` AS `branch_id` from (`timesheet` `t` join `employees` `e` on((`t`.`emp_id` = `e`.`employee_id`))) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; @@ -1345,7 +1378,7 @@ SET character_set_client = @saved_cs_client; /*!50001 SET character_set_results = utf8mb4 */; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE */ -/*!50013 */ +/*!50013 */ /*!50001 VIEW `users_view` AS select `users`.`user_id` AS `user_id`,`users`.`userlogin` AS `userlogin`,`users`.`userpass` AS `userpass`,`users`.`createdon` AS `createdon`,`users`.`email` AS `email`,`users`.`acl` AS `acl`,`users`.`options` AS `options`,`users`.`disabled` AS `disabled`,`roles`.`rolename` AS `rolename`,`users`.`role_id` AS `role_id`,`roles`.`acl` AS `roleacl`,coalesce(`employees`.`employee_id`,0) AS `employee_id`,(case when isnull(`employees`.`emp_name`) then `users`.`userlogin` else `employees`.`emp_name` end) AS `username` from ((`users` left join `employees` on(((`users`.`userlogin` = `employees`.`login`) and (`employees`.`disabled` <> 1)))) left join `roles` on((`users`.`role_id` = `roles`.`role_id`))) */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; diff --git a/db/initdata.sql b/db/initdata.sql index 9e269203d..d0866cf65 100644 --- a/db/initdata.sql +++ b/db/initdata.sql @@ -14,68 +14,68 @@ INSERT INTO `mfund` (`mf_id`, `mf_name`, `description`) VALUES(2, 'Касса', INSERT INTO `firms` ( `firm_name`, `details`, `disabled`) VALUES( 'Наша фирма', '', 0); -INSERT INTO `options` (`optname`, `optvalue`) VALUES('common', 'a:23:{s:9:"qtydigits";s:1:"0";s:8:"amdigits";s:1:"0";s:10:"dateformat";s:5:"d.m.Y";s:11:"partiontype";s:1:"1";s:4:"curr";s:2:"ru";s:6:"price1";s:18:"Розничная";s:6:"price2";s:14:"Оптовая";s:6:"price3";s:0:"";s:6:"price4";s:0:"";s:6:"price5";s:0:"";s:8:"shopname";s:14:"Магазин";s:8:"ts_break";s:2:"60";s:8:"ts_start";s:5:"09:00";s:6:"ts_end";s:5:"18:00";s:11:"autoarticle";i:1;s:6:"useset";i:0;s:10:"usesnumber";i:0;s:10:"usescanner";i:1;s:9:"useimages";i:0;s:9:"usebranch";i:0;s:10:"allowminus";i:1;s:6:"useval";i:0;s:6:"capcha";i:0;}'); +INSERT INTO `options` (`optname`, `optvalue`) VALUES('common', 'a:24:{s:9:"qtydigits";s:1:"0";s:8:"amdigits";s:1:"0";s:10:"dateformat";s:5:"d.m.Y";s:11:"partiontype";s:1:"1";s:4:"curr";s:2:"ru";s:6:"phonel";s:2:"10";s:6:"price1";s:18:"Розничная";s:6:"price2";s:14:"Оптовая";s:6:"price3";s:0:"";s:6:"price4";s:0:"";s:6:"price5";s:0:"";s:8:"defprice";s:0:"";s:8:"shopname";s:14:"Магазин";s:8:"ts_break";s:2:"60";s:8:"ts_start";s:5:"09:00";s:6:"ts_end";s:5:"18:00";s:11:"autoarticle";i:1;s:10:"usesnumber";i:0;s:10:"usescanner";i:0;s:9:"useimages";i:0;s:9:"usebranch";i:0;s:10:"allowminus";i:1;s:6:"useval";i:0;s:6:"capcha";i:0;}'); INSERT INTO `options` (`optname`, `optvalue`) VALUES('printer', 'a:8:{s:6:"pwidth";s:4:"100%";s:9:"pricetype";s:6:"price1";s:11:"barcodetype";s:5:"EAN13";s:9:"pfontsize";s:2:"16";s:5:"pname";i:1;s:5:"pcode";i:0;s:8:"pbarcode";i:1;s:6:"pprice";i:0;}'); INSERT INTO `options` (`optname`, `optvalue`) VALUES('shop', 'N;'); -INSERT INTO `options` (`optname`, `optvalue`) VALUES('modules', 'a:11:{s:6:"ocsite";s:20:"http://local.ostore3";s:9:"ocapiname";s:5:"admin";s:5:"ockey";s:256:"Bf81dB8fY2waVxlhych4fFprGfxF2tULlSlHiwEXZqf45E6HDBoA6XjocGcziRsfCQsRovzzDAvMBImmrlzXqEJcMByQpkfeLYfZBDoYstDVuA0Qvx86YkeXVwQ6I2v8xEXS2ZL6ioH1l8qinySGZdRrO5mgFCFWKhgKxIfkNOYpvzIZdR2MdqkHKSzHGSfoDVmbts8slGNFqYzvkXQSP0VaHcw0fYmBZLo0HEvLb2EiBZ5A8EcGDZWWtndg2wlY";s:13:"occustomer_id";s:1:"8";s:11:"ocpricetype";s:6:"price1";s:6:"wcsite";s:15:"http://local.wp";s:6:"wckeyc";s:43:"ck_a36c9d5d8ef70a34001b6a44bc245a7665ca77e7";s:6:"wckeys";s:43:"cs_12b03012d9db469b45b1fc82e329a3bc995f3e36";s:5:"wcapi";s:2:"v3";s:13:"wccustomer_id";s:1:"8";s:11:"wcpricetype";s:6:"price1";}'); +INSERT INTO `options` (`optname`, `optvalue`) VALUES('modules', 'a:21:{s:6:"ocsite";s:24:"https://yerbalife.com.ua";s:9:"ocapiname";s:5:"zippy";s:5:"ockey";s:256:"xgquZq2BXB5QRMGq3mPR3zTMXI3Jl2oaUOQmmyrbaVjeZMhnpgwomxEn2D8dZFOLMcscA7WbRWXiCKg0navzgmJpinIgmYTCK0de5ZLZ3oOGp6eAKpzt3nadwYVvCl1ByjNPdpGbSMMBkUEhuJSzmliC0mE5oY1mLpDUEhVp45T8ELh3JReFuRNidV5ojVW2OhYqx3Q8RukKE4LzWjNvkivplLo3lrNBeZx5Mi2CZegOxrNbI1sz3bcojzvJ8aW0";s:13:"occustomer_id";s:1:"8";s:11:"ocpricetype";s:6:"price1";s:6:"wcsite";s:15:"http://local.wp";s:6:"wckeyc";s:43:"ck_a36c9d5d8ef70a34001b6a44bc245a7665ca77e7";s:6:"wckeys";s:43:"cs_12b03012d9db469b45b1fc82e329a3bc995f3e36";s:5:"wcapi";s:2:"v3";s:13:"wccustomer_id";s:1:"8";s:11:"wcpricetype";s:6:"price1";s:9:"ocoutcome";i:0;s:12:"ocinsertcust";i:0;s:12:"td_pricetype";s:1:"0";s:8:"td_store";s:1:"0";s:8:"td_ipath";s:0:"";s:11:"td_seconddb";i:1;s:9:"td_dbhost";s:9:"localhost";s:9:"td_dbname";s:6:"tecdoc";s:9:"td_dbuser";s:4:"root";s:9:"td_dbpass";s:4:"root";}'); -INSERT INTO `metadata` VALUES(1, 4, 'Склады', 'StoreList', 'Товары', 0); -INSERT INTO `metadata` VALUES(2, 4, 'Номенклатура', 'ItemList', 'Товары', 0); -INSERT INTO `metadata` VALUES(3, 4, 'Сотрудники', 'EmployeeList', '', 0); -INSERT INTO `metadata` VALUES(4, 4, 'Категории товаров', 'CategoryList', 'Товары', 0); -INSERT INTO `metadata` VALUES(5, 4, 'Контрагенты', 'CustomerList', '', 0); -INSERT INTO `metadata` VALUES(6, 1, 'Приходная накладная', 'GoodsReceipt', 'Закупки', 0); -INSERT INTO `metadata` VALUES(7, 1, 'Расходная накладная', 'GoodsIssue', 'Продажи', 0); -INSERT INTO `metadata` VALUES(8, 3, 'Общий журнал', 'DocList', '', 0); -INSERT INTO `metadata` VALUES(10, 1, 'Гарантийный талон', 'Warranty', 'Продажи', 0); -INSERT INTO `metadata` VALUES(12, 2, 'Движение по складу', 'ItemActivity', 'Склад', 0); -INSERT INTO `metadata` VALUES(13, 2, 'ABC анализ', 'ABC', '', 0); -INSERT INTO `metadata` VALUES(14, 4, 'Услуги, работы', 'ServiceList', '', 0); -INSERT INTO `metadata` VALUES(15, 1, 'Акт выполненных работ', 'ServiceAct', 'Услуги', 0); -INSERT INTO `metadata` VALUES(16, 1, 'Возврат от покупателя', 'ReturnIssue', 'Продажи', 0); -INSERT INTO `metadata` VALUES(18, 3, 'Наряды', 'TaskList', '', 0); -INSERT INTO `metadata` VALUES(19, 1, 'Наряд', 'Task', 'Производство', 0); -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(27, 3, 'Заказы клиентов', 'OrderList', 'Продажи', 0); -INSERT INTO `metadata` VALUES(28, 1, 'Заказ', 'Order', 'Продажи', 0); -INSERT INTO `metadata` VALUES(30, 1, 'Оприходование с производства', 'ProdReceipt', 'Производство', 0); -INSERT INTO `metadata` VALUES(31, 1, 'Списание на производство', 'ProdIssue', 'Производство', 0); -INSERT INTO `metadata` VALUES(32, 2, 'Отчет по производству', 'Prod', 'Производство', 0); -INSERT INTO `metadata` VALUES(33, 4, 'Производственные участки', 'ProdAreaList', '', 0); -INSERT INTO `metadata` VALUES(38, 1, 'Заявка поставщику', 'OrderCust', 'Закупки', 0); -INSERT INTO `metadata` VALUES(35, 3, 'Продажи', 'GIList', 'Продажи', 0); -INSERT INTO `metadata` VALUES(36, 4, 'Основные фонды', 'EqList', '', 0); -INSERT INTO `metadata` VALUES(37, 3, 'Закупки', 'GRList', 'Закупки', 0); -INSERT INTO `metadata` VALUES(39, 3, 'Заявки поставщикам', 'OrderCustList', 'Закупки', 0); -INSERT INTO `metadata` VALUES(40, 2, 'Прайс', 'Price', 'Склад', 0); -INSERT INTO `metadata` VALUES(41, 1, 'Возврат поставщику', 'RetCustIssue', 'Закупки', 0); -INSERT INTO `metadata` VALUES(69, 3, 'Работы, услуги', 'SerList', '', 0); -INSERT INTO `metadata` VALUES(44, 1, 'Перекомплектация ТМЦ', 'TransItem', 'Склад', 0); -INSERT INTO `metadata` VALUES(47, 3, 'Журнал платежей', 'PayList', 'Касса и платежи', 0); -INSERT INTO `metadata` VALUES(48, 2, 'Движение по денежным счетам', 'PayActivity', 'Платежи', 0); -INSERT INTO `metadata` VALUES(64, 1, 'Списание ТМЦ', 'OutcomeItem', 'Склад', 0); -INSERT INTO `metadata` VALUES(50, 1, 'Приходный ордер', 'IncomeMoney', 'Платежи', 0); -INSERT INTO `metadata` VALUES(51, 1, 'Расходный ордер', 'OutcomeMoney', 'Платежи', 0); -INSERT INTO `metadata` VALUES(53, 2, 'Финансовые результаты', 'PayBalance', '', 0); -INSERT INTO `metadata` VALUES(57, 1, 'Инвентаризация', 'Inventory', 'Склад', 0); -INSERT INTO `metadata` VALUES(58, 1, 'Счет входящий', 'InvoiceCust', 'Закупки', 0); -INSERT INTO `metadata` VALUES(59, 1, 'Счет-фактура', 'Invoice', 'Продажи', 0); -INSERT INTO `metadata` VALUES(60, 5, 'Импорт', 'Import', '', 0); -INSERT INTO `metadata` VALUES(61, 3, 'Движение ТМЦ', 'StockList', 'Склад', 0); -INSERT INTO `metadata` VALUES(62, 1, 'Кассовый чек', 'POSCheck', 'Продажи', 1); -INSERT INTO `metadata` VALUES(63, 2, 'Товары в пути', 'CustOrder', 'Закупки', 0); -INSERT INTO `metadata` VALUES(65, 1, 'Оприходование ТМЦ', 'IncomeItem', 'Склад', 0); -INSERT INTO `metadata` VALUES(75, 5, 'Экспорт', 'Export', '', 0); -INSERT INTO `metadata` VALUES(67, 5, 'АРМ кассира', 'ARMPos', '', 0); -INSERT INTO `metadata` VALUES(70, 3, 'Расчеты с контрагентами', 'PayCustList', 'Касса и платежи', 0); -INSERT INTO `metadata` VALUES(71, 3, 'Товары на складе', 'ItemList', 'Склад', 0); -INSERT INTO `metadata` VALUES(76, 1, 'Выплата зарплаты', 'OutSalary', 'Платежи', 0); -INSERT INTO `metadata` VALUES(77, 2, 'Отчет по зарплате', 'SalaryRep', 'Зарплата', 0); -INSERT INTO `metadata` VALUES(78, 2, 'Движение по контрагентам', 'CustActivity', 'Платежи', 0); -INSERT INTO `metadata` VALUES(81, 4, 'Договора', 'ContractList', '', 0); -INSERT INTO `metadata` VALUES(82, 1, 'Перемещение товара', 'MoveItem', 'Склад', 0); -INSERT INTO `metadata` VALUES(83, 2, 'Рабочее время', 'Timestat', 'Зарплата', 0); +INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 4, 'Склады', 'StoreList', 'ТМЦ', 0); +INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 4, 'Номенклатура', 'ItemList', 'ТМЦ', 0); +INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 4, 'Сотрудники', 'EmployeeList', '', 0); +INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 4, 'Категории ', 'CategoryList', 'ТМЦ', 0); +INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 4, 'Контрагенты', 'CustomerList', '', 0); +INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 1, 'Приходная накладная', 'GoodsReceipt', 'Закупки', 0); +INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 1, 'Расходная накладная', 'GoodsIssue', 'Продажи', 0); +INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 3, 'Общий журнал', 'DocList', '', 0); +INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 1, 'Гарантийный талон', 'Warranty', 'Продажи', 0); +INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 2, 'Движение по складу', 'ItemActivity', 'Склад', 0); +INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 2, 'ABC анализ', 'ABC', '', 0); +INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 4, 'Услуги, работы', 'ServiceList', '', 0); +INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 1, 'Заказ (услуги)', 'ServiceAct', 'Услуги', 0); +INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 1, 'Возврат от покупателя', 'ReturnIssue', 'Продажи', 0); +INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 3, 'Наряды', 'TaskList', '', 0); +INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 1, 'Наряд', 'Task', 'Производство', 0); +INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 2, 'Отчет по нарядам', 'EmpTask', 'Производство', 0); +INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 2, 'Закупки', 'Income', 'Закупки', 0); +INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 2, 'Продажи', 'Outcome', 'Продажи', 0); +INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 4, 'Кассы', 'MFList', '', 0); +INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 3, 'Заказы клиентов', 'OrderList', 'Продажи', 0); +INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 1, 'Заказ', 'Order', 'Продажи', 0); +INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 1, 'Оприходование с производства', 'ProdReceipt', 'Производство', 0); +INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 1, 'Списание на производство', 'ProdIssue', 'Производство', 0); +INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 2, 'Отчет по производству', 'Prod', 'Производство', 0); +INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 4, 'Производственные участки', 'ProdAreaList', '', 0); +INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 1, 'Заявка поставщику', 'OrderCust', 'Закупки', 0); +INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 3, 'Продажи', 'GIList', 'Продажи', 0); +INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 4, 'Основные фонды', 'EqList', '', 0); +INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 3, 'Закупки', 'GRList', 'Закупки', 0); +INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 3, 'Заявки поставщикам', 'OrderCustList', 'Закупки', 0); +INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 2, 'Прайс', 'Price', 'Склад', 0); +INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 1, 'Возврат поставщику', 'RetCustIssue', 'Закупки', 0); +INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 3, 'Работы, услуги', 'SerList', '', 0); +INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 1, 'Перекомплектация ТМЦ', 'TransItem', 'Склад', 0); +INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 3, 'Журнал платежей', 'PayList', 'Касса и платежи', 0); +INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 2, 'Движение по денежным счетам', 'PayActivity', 'Платежи', 0); +INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 1, 'Списание ТМЦ', 'OutcomeItem', 'Склад', 0); +INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 1, 'Приходный ордер', 'IncomeMoney', 'Платежи', 0); +INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 1, 'Расходный ордер', 'OutcomeMoney', 'Платежи', 0); +INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 2, 'Финансовые результаты', 'PayBalance', '', 0); +INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 1, 'Инвентаризация', 'Inventory', 'Склад', 0); +INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 1, 'Счет входящий', 'InvoiceCust', 'Закупки', 0); +INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 1, 'Счет-фактура', 'Invoice', 'Продажи', 0); +INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 5, 'Импорт', 'Import', '', 0); +INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 3, 'Движение ТМЦ', 'StockList', 'Склад', 0); +INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 1, 'Кассовый чек', 'POSCheck', 'Продажи', 1); +INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 2, 'Товары в пути', 'CustOrder', 'Закупки', 0); +INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 1, 'Оприходование ТМЦ', 'IncomeItem', 'Склад', 0); +INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 5, 'Экспорт', 'Export', '', 0); +INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 5, 'АРМ кассира', 'ARMPos', '', 0); +INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 3, 'Расчеты с контрагентами', 'PayCustList', 'Касса и платежи', 0); +INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 3, 'Товары на складе', 'ItemList', 'Склад', 0); +INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 1, 'Выплата зарплаты', 'OutSalary', 'Платежи', 0); +INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 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( 1, 'Перемещение товара', 'MoveItem', 'Склад', 0); +INSERT INTO `metadata` ( `meta_type`, `description`, `meta_name`, `menugroup`, `disabled`) VALUES( 2, 'Рабочее время', 'Timestat', 'Зарплата', 0); diff --git a/db/initdata_ua.sql b/db/initdata_ua.sql index 7262f2162..41196a294 100644 --- a/db/initdata_ua.sql +++ b/db/initdata_ua.sql @@ -13,7 +13,7 @@ INSERT INTO `mfund` (`mf_id`, `mf_name`, `description`) VALUES(2, 'Кас INSERT INTO `firms` ( `firm_name`, `details`, `disabled`) VALUES( 'Наша С„iСЂРјР°', '', 0); -INSERT INTO `options` (`optname`, `optvalue`) VALUES('common', 'a:23:{s:9:"qtydigits";s:1:"0";s:8:"amdigits";s:1:"0";s:10:"dateformat";s:5:"d.m.Y";s:11:"partiontype";s:1:"1";s:4:"curr";s:2:"gr";s:6:"phonel";s:2:"10";s:6:"price1";s:17:"Роздрiбна";s:6:"price2";s:12:"Оптова";s:6:"price3";s:0:"";s:6:"price4";s:0:"";s:6:"price5";s:0:"";s:8:"shopname";s:14:"Магазин";s:8:"ts_break";s:2:"60";s:8:"ts_start";s:5:"09:00";s:6:"ts_end";s:5:"18:00";s:11:"autoarticle";i:1;s:10:"usesnumber";i:0;s:10:"usescanner";i:0;s:9:"useimages";i:0;s:9:"usebranch";i:0;s:10:"allowminus";i:1;s:6:"useval";i:0;s:6:"capcha";i:0;}'); +INSERT INTO `options` (`optname`, `optvalue`) VALUES('common', 'a:24:{s:9:"qtydigits";s:1:"0";s:8:"amdigits";s:1:"0";s:10:"dateformat";s:5:"d.m.Y";s:11:"partiontype";s:1:"1";s:4:"curr";s:2:"ru";s:6:"phonel";s:2:"10";s:6:"price1";s:17:"Роздрiбна";s:6:"price2";s:12:"Оптова";s:6:"price3";s:0:"";s:6:"price4";s:0:"";s:6:"price5";s:0:"";s:8:"defprice";s:0:"";s:8:"shopname";s:18:"Наша фiрма";s:8:"ts_break";s:2:"60";s:8:"ts_start";s:5:"09:00";s:6:"ts_end";s:5:"18:00";s:11:"autoarticle";i:1;s:10:"usesnumber";i:0;s:10:"usescanner";i:0;s:9:"useimages";i:0;s:9:"usebranch";i:0;s:10:"allowminus";i:1;s:6:"useval";i:0;s:6:"capcha";i:0;}'); INSERT INTO `options` (`optname`, `optvalue`) VALUES('printer', 'a:8:{s:6:"pwidth";s:4:"100%";s:9:"pricetype";s:6:"price1";s:11:"barcodetype";s:5:"EAN13";s:9:"pfontsize";s:2:"16";s:5:"pname";i:1;s:5:"pcode";i:0;s:8:"pbarcode";i:1;s:6:"pprice";i:0;}'); INSERT INTO `options` (`optname`, `optvalue`) VALUES('shop', 'N;'); INSERT INTO `options` (`optname`, `optvalue`) VALUES('modules', 'a:11:{s:6:"ocsite";s:20:"http://local.ostore3";s:9:"ocapiname";s:5:"admin";s:5:"ockey";s:256:"Bf81dB8fY2waVxlhych4fFprGfxF2tULlSlHiwEXZqf45E6HDBoA6XjocGcziRsfCQsRovzzDAvMBImmrlzXqEJcMByQpkfeLYfZBDoYstDVuA0Qvx86YkeXVwQ6I2v8xEXS2ZL6ioH1l8qinySGZdRrO5mgFCFWKhgKxIfkNOYpvzIZdR2MdqkHKSzHGSfoDVmbts8slGNFqYzvkXQSP0VaHcw0fYmBZLo0HEvLb2EiBZ5A8EcGDZWWtndg2wlY";s:13:"occustomer_id";s:1:"8";s:11:"ocpricetype";s:6:"price1";s:6:"wcsite";s:15:"http://local.wp";s:6:"wckeyc";s:43:"ck_a36c9d5d8ef70a34001b6a44bc245a7665ca77e7";s:6:"wckeys";s:43:"cs_12b03012d9db469b45b1fc82e329a3bc995f3e36";s:5:"wcapi";s:2:"v3";s:13:"wccustomer_id";s:1:"8";s:11:"wcpricetype";s:6:"price1";}'); diff --git a/www/app/application.php b/www/app/application.php index 8fab1b588..b1f6926d2 100644 --- a/www/app/application.php +++ b/www/app/application.php @@ -19,12 +19,12 @@ public function getTemplate($name) { $path = ''; $name = ltrim($name, '\\'); - $lang = $_config['common']['lang']; + $lang = $_config['common']['lang']; $templatepath = 'templates/'; - - if (strlen($lang) >0 && $lang != 'ru') { - $templatepath = 'templates_'.$lang.'/'; + + if (strlen($lang) > 0 && $lang != 'ru') { + $templatepath = 'templates_' . $lang . '/'; } $className = str_replace("\\", "/", ltrim($name, '\\')); @@ -107,6 +107,7 @@ public function Route($uri) { $pages = array( "store" => "\\App\\Pages\\Main", + "admin" => "\\App\\Pages\\Main", "shop" => "\\App\\Modules\\Shop\\Pages\\Main", "sp" => "\\App\\Modules\\Shop\\Pages\\ProductView", "aboutus" => "\\App\\Modules\\Shop\\Pages\\AboutUs", diff --git a/www/app/entity/customer.php b/www/app/entity/customer.php index 0dd73dee5..906d6f47d 100644 --- a/www/app/entity/customer.php +++ b/www/app/entity/customer.php @@ -37,7 +37,7 @@ protected function beforeSave() { $this->detail .= "{$this->shopcust_id}"; $this->detail .= "{$this->isholding}"; $this->detail .= "{$this->holding}"; - + $this->detail .= "holding_name}]]>"; $this->detail .= "
address}]]>
"; $this->detail .= "comment}]]>"; @@ -76,7 +76,6 @@ public function beforeDelete() { return ""; } - protected function afterDelete() { @@ -104,39 +103,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) { - + + /** + * список контрагентов кроме холдингов + * + * @param mixed $search + * @param mixed $type + */ + public static function getList($search = '', $type = 0) { + $conn = \ZDB\DB::getConnect(); - + $where = "status=0 and detail not like '%1%' "; - if(strlen($search)>0) { - $search = $conn->qstr('%' . $search . '%'); - $where .= " and (customer_name like {$search} or phone like {$search} ) "; + 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}%' or detail like '%0%' ) "; + if ($type > 0) { + $where .= " and (detail like '%{$type}%' or detail like '%0%' ) "; } - - return Customer::findArray("customer_name",$where,"customer_name"); + + return Customer::findArray("customer_name", $where, "customer_name"); } - public static function getHoldList($type=0) { - + public static function getHoldList($type = 0) { + $conn = \ZDB\DB::getConnect(); $where = "status=0 and detail like '%1%' "; - if($type>0) { - $where .= " and (detail like '%{$type}%' or detail like '%0%' ) "; + if ($type > 0) { + $where .= " and (detail like '%{$type}%' or detail like '%0%' ) "; } - - return Customer::findArray("customer_name",$where,"customer_name"); + + return Customer::findArray("customer_name", $where, "customer_name"); } - + } diff --git a/www/app/entity/doc/document.php b/www/app/entity/doc/document.php index d14111d1f..a9297c1a0 100644 --- a/www/app/entity/doc/document.php +++ b/www/app/entity/doc/document.php @@ -359,20 +359,20 @@ public function updateStatus($state) { $this->insertLog($state); $this->save(); - - if($oldstate!=$state){ - $this->onState($oldstate,$state); + + if ($oldstate != $state) { + $this->onState($oldstate, $state); } return true; } //обработяик изменения статусов - protected function onState($oldstate,$state){ - - + protected function onState($oldstate, $state) { + + } - + /** * Возвращает название статуса документа * diff --git a/www/app/entity/doc/goodsissue.php b/www/app/entity/doc/goodsissue.php index dff40ef60..3d9884d51 100644 --- a/www/app/entity/doc/goodsissue.php +++ b/www/app/entity/doc/goodsissue.php @@ -49,7 +49,7 @@ public function generateReport() { $totalstr = H::sumstr($this->amount); - $firm = H::getFirmData($this->headerdata["firm_id"], $this->branch_id); + $firm = H::getFirmData($this->firm_id, $this->branch_id); $header = array('date' => H::fd($this->document_date), "_detail" => $detail, diff --git a/www/app/entity/doc/goodsreceipt.php b/www/app/entity/doc/goodsreceipt.php index 40f54569d..11625ec86 100644 --- a/www/app/entity/doc/goodsreceipt.php +++ b/www/app/entity/doc/goodsreceipt.php @@ -14,7 +14,7 @@ class GoodsReceipt extends Document { public function generateReport() { - $firm = H::getFirmData($this->headerdata["firm_id"], $this->branch_id); + $firm = H::getFirmData($this->firm_id, $this->branch_id); $i = 1; diff --git a/www/app/entity/doc/inventory.php b/www/app/entity/doc/inventory.php index b734b91bd..32d76143c 100644 --- a/www/app/entity/doc/inventory.php +++ b/www/app/entity/doc/inventory.php @@ -23,7 +23,7 @@ public function Execute() { } //оприходуем - if ($item->quantity < $item->qfact && $this->headerdata['autoincome']==1) { + if ($item->quantity < $item->qfact && $this->headerdata['autoincome'] == 1) { $qty = $item->qfact - $item->quantity; $where = "store_id=" . $this->headerdata['store'] . " and item_id=" . $item->item_id; $price = 0; @@ -40,7 +40,7 @@ public function Execute() { } //списываем со склада - if ($item->quantity > $item->qfact && $this->headerdata['autooutcome']==1) { + if ($item->quantity > $item->qfact && $this->headerdata['autooutcome'] == 1) { $item->quantity = $item->quantity - $item->qfact; $listst = Stock::pickup($this->headerdata['store'], $item); foreach ($listst as $st) { diff --git a/www/app/entity/doc/invoice.php b/www/app/entity/doc/invoice.php index 731bd2cd2..ee8f4b42e 100644 --- a/www/app/entity/doc/invoice.php +++ b/www/app/entity/doc/invoice.php @@ -13,7 +13,7 @@ class Invoice extends \App\Entity\Doc\Document public function generateReport() { - $firm = H::getFirmData($this->headerdata["firm_id"], $this->branch_id); + $firm = H::getFirmData($this->firm_id, $this->branch_id); $mf = \App\Entity\MoneyFund::load($this->headerdata["payment"]); @@ -114,7 +114,7 @@ public function getRelationBased() { protected function getEmailBody() { - $firm = H::getFirmData($this->headerdata["firm_id"], $this->branch_id); + $firm = H::getFirmData($this->firm_id, $this->branch_id); $header = array(); diff --git a/www/app/entity/doc/invoicecust.php b/www/app/entity/doc/invoicecust.php index da03677b2..4192d6c26 100644 --- a/www/app/entity/doc/invoicecust.php +++ b/www/app/entity/doc/invoicecust.php @@ -12,7 +12,7 @@ class InvoiceCust extends Document { public function generateReport() { - $firm = H::getFirmData($this->headerdata["firm_id"], $this->branch_id); + $firm = H::getFirmData($this->firm_id, $this->branch_id); $i = 1; diff --git a/www/app/entity/doc/order.php b/www/app/entity/doc/order.php index c34af040b..2d3eaf406 100644 --- a/www/app/entity/doc/order.php +++ b/www/app/entity/doc/order.php @@ -83,7 +83,7 @@ public function getRelationBased() { $list['ProdReceipt'] = self::getDesc('ProdReceipt'); $list['Invoice'] = self::getDesc('Invoice'); $list['POSCheck'] = self::getDesc('POSCheck'); - $list['Task'] = self::getDesc('Task') ; + $list['Task'] = self::getDesc('Task'); return $list; @@ -109,7 +109,7 @@ public function generatePosReport() { ); } - $firm = H::getFirmData($this->headerdata["firm_id"], $this->branch_id); + $firm = H::getFirmData($this->firm_id, $this->branch_id); $header = array('date' => H::fd($this->document_date), "_detail" => $detail, diff --git a/www/app/entity/doc/poscheck.php b/www/app/entity/doc/poscheck.php index c5df5b8a3..b32db36dd 100644 --- a/www/app/entity/doc/poscheck.php +++ b/www/app/entity/doc/poscheck.php @@ -49,7 +49,7 @@ public function generateReport() { $common = \App\System::getOptions('common'); - $firm = H::getFirmData($this->headerdata["firm_id"], $this->branch_id); + $firm = H::getFirmData($this->firm_id ); $header = array('date' => H::fd($this->document_date), "_detail" => $detail, @@ -103,7 +103,7 @@ public function generatePosReport() { } $common = \App\System::getOptions('common'); - $firm = H::getFirmData($this->headerdata["firm_id"], $this->branch_id); + $firm = H::getFirmData($this->firm_id, $this->branch_id); $header = array('date' => H::fd($this->document_date), "_detail" => $detail, @@ -114,7 +114,7 @@ public function generatePosReport() { "phone" => $firm["phone"], "inn" => $firm["inn"], "customer_name" => strlen($this->headerdata["customer_name"]) > 0 ? $this->headerdata["customer_name"] : false, - "fiscalnumber" => strlen($this->headerdata["fiscalnumber"])>0 ? $this->headerdata["fiscalnumber"] : false, + "fiscalnumber" => strlen($this->headerdata["fiscalnumber"]) > 0 ? $this->headerdata["fiscalnumber"] : false, "exchange" => $this->headerdata["exchange"], "pos_name" => $this->headerdata["pos_name"], "time" => H::fdt($this->headerdata["time"]), @@ -192,6 +192,7 @@ public function supportedExport() { public function getRelationBased() { $list = array(); $list['Warranty'] = self::getDesc('Warranty'); + $list['ReturnIssue'] = self::getDesc('ReturnIssue'); return $list; } diff --git a/www/app/entity/doc/prodreceipt.php b/www/app/entity/doc/prodreceipt.php index 9c70d65c9..ad89a9b7b 100644 --- a/www/app/entity/doc/prodreceipt.php +++ b/www/app/entity/doc/prodreceipt.php @@ -81,7 +81,7 @@ public function getRelationBased() { $list = array(); $list['ProdReceipt'] = self::getDesc('ProdReceipt'); $list['ProdIssue'] = self::getDesc('ProdIssue'); //для формирования комплектубщих по готовой продукции - + return $list; } diff --git a/www/app/entity/doc/serviceact.php b/www/app/entity/doc/serviceact.php index f5e219261..c91149f07 100644 --- a/www/app/entity/doc/serviceact.php +++ b/www/app/entity/doc/serviceact.php @@ -14,7 +14,7 @@ class ServiceAct extends Document { public function generateReport() { - $firm = H::getFirmData($this->headerdata["firm_id"], $this->branch_id); + $firm = H::getFirmData($this->firm_id, $this->branch_id); $i = 1; @@ -87,7 +87,7 @@ public function generatePosReport() { $common = \App\System::getOptions('common'); $printer = \App\System::getOptions('printer'); - $firm = H::getFirmData($this->headerdata["firm_id"], $this->branch_id); + $firm = H::getFirmData($this->firm_id, $this->branch_id); $wp = 'style="width:40mm"'; if (strlen($printer['pwidth']) > 0) { @@ -136,8 +136,8 @@ public function generatePosReport() { public function getRelationBased() { $list = array(); - $list['Task'] = self::getDesc('Task') ; - $list['ProdIssue'] = self::getDesc('ProdIssue') ; + $list['Task'] = self::getDesc('Task'); + $list['ProdIssue'] = self::getDesc('ProdIssue'); $list['GoodsIssue'] = self::getDesc('GoodsIssue'); return $list; diff --git a/www/app/entity/doc/task.php b/www/app/entity/doc/task.php index 599c0a292..4e5aa48b7 100644 --- a/www/app/entity/doc/task.php +++ b/www/app/entity/doc/task.php @@ -12,6 +12,11 @@ */ class Task extends Document { + protected function init() { + parent::init(); + $this->tasktype = 0;//0 - услуги,1- производство + + } public function generateReport() { @@ -20,12 +25,17 @@ public function generateReport() { $detail = array(); foreach ($this->unpackDetails('detaildata') as $ser) { - if($ser->cost=="") $ser->cost=0; - if($ser->hours=="") $ser->hours=0; + 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), - "qty" => $ser->qty, + "quantity" => H::fqty($ser->quantity), + "cost" => H::fa($ser->cost * $ser->quantity), + "hours" => $ser->hours * $ser->qty ); } @@ -52,7 +62,7 @@ public function generateReport() { "document_number" => $this->document_number, "notes" => $this->notes, "baseddoc" => strlen($this->headerdata["parent_number"]) > 0 ? $this->headerdata["parent_number"] : false, - "cust" => strlen($this->customer_name) > 0 ? $this->customer_name : false, + "cust" => strlen($this->customer_name) > 0 ? $this->customer_name : false, "_detail" => $detail, "_detail2" => $detail2, "iseq" => count($detail2) > 0, @@ -88,7 +98,8 @@ 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'); + $list['POSCheck'] = self::getDesc('POSCheck'); return $list; } diff --git a/www/app/entity/firm.php b/www/app/entity/firm.php index 535a385cc..1fa439f28 100644 --- a/www/app/entity/firm.php +++ b/www/app/entity/firm.php @@ -21,7 +21,7 @@ protected function afterLoad() { $this->address = (string)($xml->address[0]); $this->inn = (string)($xml->inn[0]); - + $this->phone = (string)($xml->phone[0]); $this->logo = (string)($xml->logo[0]); @@ -43,7 +43,7 @@ protected function beforeSave() { $this->details .= "stamp}]]>"; $this->details .= "sign}]]>"; $this->details .= "{$this->inn}"; - + $this->details .= "{$this->phone}"; $this->details .= "{$this->pposerver}"; $this->details .= "{$this->pposerverport}"; diff --git a/www/app/entity/item.php b/www/app/entity/item.php index 3234d16ff..dfdadbff9 100644 --- a/www/app/entity/item.php +++ b/www/app/entity/item.php @@ -11,13 +11,13 @@ */ class Item extends \ZCL\DB\Entity { - const TYPE_TOVAR = 1; //товар - const TYPE_MAT = 2; //материалы и комплектующие - const TYPE_MBP = 3; //малоценка + const TYPE_TOVAR = 1; //товар + const TYPE_MAT = 2; //материалы и комплектующие + const TYPE_MBP = 3; //малоценка const TYPE_PROD = 4; //готовая продукция - const TYPE_HALFPROD = 5; //полуфабрикаты - - + const TYPE_HALFPROD = 5; //полуфабрикаты + + private $brprice = array(); //цены по филиалам protected function init() { @@ -46,7 +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]; @@ -108,7 +108,7 @@ protected function beforeSave() { $this->detail .= "{$this->image_id}"; $this->detail .= "{$this->weight}"; - + //упаковываем цены по филиалам $brprice = serialize($this->brprice); @@ -128,7 +128,7 @@ public function allowDelete() { //проверка на партии $sql = " select count(*) from store_stock where item_id = {$this->item_id}"; $cnt = $conn->GetOne($sql); - return ($cnt > 0) ? false : true; + return ($cnt > 0) ? false : true; } protected function afterDelete() { @@ -361,7 +361,7 @@ public function getAmount($store_id = 0) { * @return [] * @static */ - public static function findArrayAC($partname, $store = 0,$cat=0) { + public static function findArrayAC($partname, $store = 0, $cat = 0) { $criteria = " disabled <> 1 "; if ($store > 0) { @@ -421,18 +421,18 @@ public static function getManufacturers() { } - - public static function getTypes(){ + + 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; } - + } diff --git a/www/app/entity/moneyfund.php b/www/app/entity/moneyfund.php index 5c1956ee2..a754747bf 100644 --- a/www/app/entity/moneyfund.php +++ b/www/app/entity/moneyfund.php @@ -28,7 +28,7 @@ protected function beforeSave() { $this->detail .= "{$this->btran}"; $this->detail .= "bank}]]>"; $this->detail .= "bankacc}]]>"; - + $this->detail .= ""; return true; @@ -36,19 +36,20 @@ protected function beforeSave() { protected function afterLoad() { //распаковываем данные из detail - if(strlen($this->detail)==0) return; - + 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->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(); diff --git a/www/app/entity/pay.php b/www/app/entity/pay.php index b815c0255..9c37c03ef 100644 --- a/www/app/entity/pay.php +++ b/www/app/entity/pay.php @@ -14,11 +14,11 @@ class Pay extends \ZCL\DB\Entity //типы платежей - затраты и доходы const PAY_BASE_INCOME = 1; //операционные доходы - - const PAY_OTHER_INCOME = 2; //прочие доходы - const PAY_FIN = 3; //доходы от фин. деятельности - - + + const PAY_OTHER_INCOME = 2; //прочие доходы + const PAY_FIN = 3; //доходы от фин. деятельности + + const PAY_BASE_OUTCOME = 50; //операционные расходы const PAY_COMMON_OUTCOME = 51; //общепроизводственные расходы const PAY_ADMIN_OUTCOME = 52; //административные расходы @@ -35,26 +35,29 @@ protected function init() { $this->paydate = time(); } - + protected function beforeSave() { parent::beforeSave(); //упаковываем данные в detail $this->detail = ""; - + $this->detail .= ""; return true; } protected function afterLoad() { - $this->paydate = strtotime($this->paydate); + $this->paydate = strtotime($this->paydate); //распаковываем данные из detail - if(strlen($this->detail)==0) return; - + if (strlen($this->detail) == 0) { + return; + } + $xml = simplexml_load_string($this->detail); - + parent::afterLoad(); - } + } + //возвращает список оплат public static function getPayments($document_id) { $list = Pay::find("document_id=" . $document_id, "pl_id"); @@ -94,23 +97,23 @@ public static function addPayment($document_id, $paydate, $amount, $mf_id, $type $pay->user_id = \App\System::getUser()->user_id; $pay->save(); - $mf = \App\Entity\MoneyFund::load($mf_id); - if($mf instanceof \App\Entity\MoneyFund){ - //банковский процент - if($mf->beznal==1 and $mf->btran>0) { + $mf = \App\Entity\MoneyFund::load($mf_id); + if ($mf instanceof \App\Entity\MoneyFund) { + //банковский процент + if ($mf->beznal == 1 and $mf->btran > 0) { $pay = new \App\Entity\Pay(); $pay->mf_id = $mf_id; $pay->document_id = $document_id; - $pay->amount = ($amount * $mf->btran/100); + $pay->amount = ($amount * $mf->btran / 100); $pay->paytype = Pay::PAY_BASE_OUTCOME; $pay->paydate = $paydate; $pay->notes = \App\Helper::l('bankproc'); $pay->user_id = \App\System::getUser()->user_id; - $pay->save(); - } + $pay->save(); + } } - - + + $conn = \ZDB\DB::getConnect(); $sql = "select coalesce(abs(sum(amount)),0) from paylist where document_id=" . $document_id; @@ -118,26 +121,26 @@ public static function addPayment($document_id, $paydate, $amount, $mf_id, $type $conn->Execute("update documents set payed={$payed} where document_id =" . $document_id); } - public static function cancelPayment($id,$comment){ + public static function cancelPayment($id, $comment) { $pl = Pay::load($id); if ($pl == null) { return; } - + $pay = new \App\Entity\Pay(); $pay->mf_id = $pay->mf; - $pay->document_id = $pay->document_id; - $pay->amount = 0-$pay->amount; - $pay->paytype = $pay->paytype; + + $pay->amount = 0 - $pay->amount; + $pay->paydate = time(); $pay->notes = $comment; $pay->user_id = \App\System::getUser()->user_id; $pay->save(); - + } - - + + /** * список расходов и доходов * @@ -147,10 +150,10 @@ public static function getPayTypeList($type = 0) { $list = array(); if ($type != 2) { $list[PAY::PAY_BASE_INCOME] = \App\Helper::l('pt_inprod'); - + $list[PAY::PAY_OTHER_INCOME] = \App\Helper::l('pt_inother'); $list[PAY::PAY_FIN] = \App\Helper::l('pt_fin'); - + } if ($type != 1) { @@ -163,7 +166,7 @@ public static function getPayTypeList($type = 0) { $list[PAY::PAY_BILL_OUTCOME] = \App\Helper::l('pt_outrent'); $list[PAY::PAY_DIVIDEND_OUTCOME] = \App\Helper::l('pt_outcap'); $list[PAY::PAY_OTHER_OUTCOME] = \App\Helper::l('pt_outother'); - + } return $list; diff --git a/www/app/entity/pos.php b/www/app/entity/pos.php index 4e6abf501..c3338dcf8 100644 --- a/www/app/entity/pos.php +++ b/www/app/entity/pos.php @@ -23,16 +23,15 @@ protected function beforeSave() { $this->details .= "comment}]]>"; $this->details .= "
address}]]>
"; + $this->details .= "pointname}]]>"; - $this->details .= "{$this->pricetype}"; - $this->details .= "{$this->mf}"; - $this->details .= "{$this->store}"; $this->details .= "{$this->fiscalnumber}"; $this->details .= "{$this->fiscallocnumber}"; $this->details .= "{$this->fiscdocnumber}"; - - + + $this->details .= "{$this->usefisc}"; + $this->details .= "{$this->firm_id}"; $this->details .= ""; return true; @@ -42,17 +41,18 @@ protected function afterLoad() { //распаковываем данные из detail $xml = simplexml_load_string($this->details); - $this->mf = (int)($xml->mf[0]); - $this->pricetype = (string)($xml->pricetype[0]); - $this->store = (int)($xml->store[0]); $this->comment = (string)($xml->comment[0]); $this->address = (string)($xml->address[0]); + $this->pointname = (string)($xml->pointname[0]); $this->fiscalnumber = (string)($xml->fiscalnumber[0]); $this->fiscallocnumber = (int)($xml->fiscallocnumber[0]); $this->fiscdocnumber = (int)($xml->fiscdocnumber[0]); - + $this->firm_id = (int)($xml->firm_id[0]); + $this->usefisc = (int)($xml->usefisc[0]); - if(strlen($this->fiscdocnumber)==0)$this->fiscdocnumber=1; + if (strlen($this->fiscdocnumber) == 0) { + $this->fiscdocnumber = 1; + } parent::afterLoad(); } diff --git a/www/app/helper.php b/www/app/helper.php index 73551b2cb..8f8b6ba9b 100644 --- a/www/app/helper.php +++ b/www/app/helper.php @@ -415,6 +415,20 @@ public static function getDefMF() { return 0; } + /** + * Возвращает первый тип цен как по умолчанию + * + */ + public static function getDefPriceType() { + + $pt = \App\Entity\Item::getPriceTypeList(); + if (count($pt) > 0) { + $keys = array_keys($pt); + return $keys[0]; + } + return 0; + } + /** * Форматирование количества * @@ -604,7 +618,7 @@ public static function l($label, $p1 = "", $p2 = "", $p3 = "") { } if (isset($labels[$label])) { $text = $labels[$label]; - $text = sprintf($text, $p1, $p2,$p3); + $text = sprintf($text, $p1, $p2, $p3); return $text; } else { @@ -642,20 +656,88 @@ public static function getValList() { $val = \App\System::getOptions("val"); $list = array(); if ($val['valuan'] > 0 && $val['valuan'] != 1) { - $list['valuan'] = 'Гривна'; + $list['valuan'] = self::l('valuan'); } if ($val['valusd'] > 0 && $val['valusd'] != 1) { - $list['valusd'] = 'Доллар'; + $list['valusd'] = self::l('valusd'); } if ($val['valeuro'] > 0 && $val['valeuro'] != 1) { - $list['valeuro'] = 'Евро'; + $list['valeuro'] = self::l('valeuro'); } if ($val['valrub'] > 0 && $val['valrub'] != 1) { - $list['valrub'] = 'Рубль'; + $list['valrub'] = self::l('valrub'); } return $list; } + + public static function exportExcel($data,$header,$filename){ + $spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet(); + + $sheet = $spreadsheet->getActiveSheet(); + + + + foreach($header as $k=>$v) { + + $sheet->setCellValue($k, $v); + $sheet->getStyle($k)->applyFromArray([ + 'font' => [ + + 'bold' => true + + ] + ]); + + } + + foreach($data as $k=>$v) { + + + $sheet->setCellValue($k, $v); + + + } + + + + /* + $sheet->getStyle('A1')->applyFromArray([ + 'font' => [ + 'name' => 'Arial', + 'bold' => true, + 'italic' => false, + 'underline' => Font::UNDERLINE_DOUBLE, + 'strikethrough' => false, + 'color' => [ + 'rgb' => '808080' + ] + ], + 'borders' => [ + 'allBorders' => [ + 'borderStyle' => Border::BORDER_THIN, + 'color' => [ + 'rgb' => '808080' + ] + ], + ], + 'alignment' => [ + 'horizontal' => Alignment::HORIZONTAL_CENTER, + 'vertical' => Alignment::VERTICAL_CENTER, + 'wrapText' => true, + ] + ]); + + */ + $writer = new \PhpOffice\PhpSpreadsheet\Writer\Xlsx($spreadsheet); + + + + header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); + header('Content-Disposition: attachment; filename="'.$filename.'"'); + $writer->save('php://output'); + die; + } } diff --git a/www/app/modules/ppo/ppohelper.php b/www/app/modules/ppo/ppohelper.php index e626c557f..8b7e01368 100644 --- a/www/app/modules/ppo/ppohelper.php +++ b/www/app/modules/ppo/ppohelper.php @@ -5,18 +5,24 @@ use \App\Helper as H; /** - * Вспомагательный класс + * Вспомагательный класс для фискализации */ class PPOHelper { - const DPI ="http://80.91.165.208:8609/fs/"; - - + const DPI = "http://80.91.165.208:8609/fs/"; + + + /** + * цифровая подпись данных + * + * @param mixed $data + * @param mixed $server сервер подписи + * @param mixed $port порт сервера + */ + public static function sign($data, $server, $port) { + + $server = rtrim($server, '/'); - public static function sign($data, $server,$port) { - - $server = rtrim($server,'/') ; - $request = curl_init(); @@ -35,20 +41,27 @@ public static function sign($data, $server,$port) { $ret = curl_exec($request); if (curl_errno($request) > 0) { - return array('success'=>false,'data'=>'Curl error: ' . curl_error($request)); + return array('success' => false, 'data' => 'Curl error: ' . curl_error($request)); } curl_close($request); - $ret = json_decode($ret,true); + $ret = json_decode($ret, true); + + + return array('success' => true, 'data' => base64_decode($ret['data'])); - - return array('success'=>true,'data'=>base64_decode($ret['data'])); - } - public static function decrypt($data, $server,$port) { - + /** + * проверка подписи и распаковка ответа + * + * @param mixed $data + * @param mixed $server + * @param mixed $port + */ + public static function decrypt($data, $server, $port) { + $request = curl_init(); @@ -61,38 +74,47 @@ public static function decrypt($data, $server,$port) { CURLOPT_RETURNTRANSFER => true, CURLOPT_CONNECTTIMEOUT => 20, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, - CURLOPT_POSTFIELDS => base64_encode($data) + CURLOPT_POSTFIELDS => base64_encode($data) ]); - if (curl_errno($request) > 0) { - return array('success'=>false,'data'=>'Curl error: ' . curl_error($request)); + return array('success' => false, 'data' => 'Curl error: ' . curl_error($request)); } $ret = (curl_exec($request)); - + curl_close($request); - $data = json_decode($ret,true); - return array('success'=>true,'data'=>base64_decode($data['data'])); - + $data = json_decode($ret, true); + return array('success' => true, 'data' => base64_decode($data['data'])); + } - public static function send($data, $type, $server,$port, $encrypted ) { - $signed = self::sign($data, $server,$port); - if(strlen($signed['data'])==0){ - return array('success'=>false,'data'=> 'Неверный ответ сервера подписи'); - } + /** + * Отправка данных в налоговую + * + * @param mixed $data + * @param mixed $type cmd (команда) или doc (документ) + * @param mixed $server сервер налоговой + * @param mixed $port порт сервера + * @param mixed $encrypted ответ требующий распаковки и провкри (как правила в случае отправки документа) + */ + public static function send($data, $type, $server, $port, $encrypted) { + + $signed = self::sign($data, $server, $port); + if (strlen($signed['data']) == 0) { + return array('success' => false, 'data' => 'Неверный ответ сервера подписи'); + } if ($signed['success'] == true) { $request = curl_init(); - + curl_setopt_array($request, [ - CURLOPT_URL => self::DPI.$type, + CURLOPT_URL => self::DPI . $type, CURLOPT_POST => true, CURLOPT_HEADER => false, CURLOPT_HTTPHEADER => array('Content-Type: application/octet-stream', "Content-Length: " . strlen($signed['data'])), @@ -107,80 +129,85 @@ public static function send($data, $type, $server,$port, $encrypted ) { $return = curl_exec($request); if (curl_errno($request) > 0) { - return array('success'=>false,'data'=>'Curl error: ' . curl_error($request)); + return array('success' => false, 'data' => 'Curl error: ' . curl_error($request)); } curl_close($request); - + if (strpos($return, 'Номер документа повинен дорівнювати') > 0) { - $arr = explode(' ',$return); - if($arr[count($arr) - 1] > 0) { - return array('success'=>false, 'docnumber'=>$arr[count($arr) - 1],'data'=>$return); - } - - + $arr = explode(' ', $return); + if ($arr[count($arr) - 1] > 0) { + return array('success' => false, 'docnumber' => $arr[count($arr) - 1], 'data' => $return); + } + + } if (strpos($return, 'помилки') > 0) { - - return array('success'=>false,'data'=>$return); - + + return array('success' => false, 'data' => $return); + } - + //декодируем подписаный ответ if ($encrypted) { - - $decrypted = self::decrypt($return, $server,$port); - - if ($decrypted['success'] == true ) { + + $decrypted = self::decrypt($return, $server, $port); + + if ($decrypted['success'] == true) { //если вернул xml - if(substr($decrypted['data'] ,0,5)=="ERRORCODE[0]); - $taxnum = (string) ($xml->ORDERTAXNUM[0]); - $taxnumloc = (string) ($xml->ORDERNUM[0]); - - if($errorcode=='0' && $taxnum>0) //следующий номер документа - { - return array('success'=>true, 'docnumber'=>$taxnum,'doclocnumber'=>$taxnumloc,'data'=>$return); - - } - return array('success'=>false, 'data'=>$errorcode); - - } - - return array('success'=>true,'data'=> $decrypted['data'] ); + if (substr($decrypted['data'], 0, 5) == "ERRORCODE[0]); + $taxnum = (string)($xml->ORDERTAXNUM[0]); + $taxnumloc = (string)($xml->ORDERNUM[0]); + + if ($errorcode == '0' && $taxnum > 0) //следующий номер документа + { + return array('success' => true, 'docnumber' => $taxnum, 'doclocnumber' => $taxnumloc, 'data' => $return); + + } + return array('success' => false, 'data' => $errorcode); + + } + + return array('success' => true, 'data' => $decrypted['data']); } else { - return array('success'=>false,'data'=>$decrypted['data']); + return array('success' => false, 'data' => $decrypted['data']); } } else { - return array('success'=>true,'data'=>$return); ; + return array('success' => true, 'data' => $return);; } } else { - return array('success'=>false,'data'=>$signed['data']); + return array('success' => false, 'data' => $signed['data']); } - + } + /** + * закрытие и открытие смены + * + * @param mixed $posid pos терминал + * @param mixed $open true- открыть, false - закрыть + */ + public static function shift($posid, $open) { - public static function shift($cid, $posid, $open) { - $pos = \App\Entity\Pos::load($posid); - - $firm = \App\Helper::getFirmData($cid,$pos->branch_id); - $branch = \App\Entity\Branch::load($pos->branch_id); - + + $firm = \App\Helper::getFirmData($pos->firm_id); + + $header = array(); $header['doctype'] = $open == true ? 100 : 101; $header['firmname'] = $firm['firm_name']; - $header['inn'] = strlen($firm['inn'])>0 ? $firm['inn'] : false; + $header['inn'] = strlen($firm['inn']) > 0 ? $firm['inn'] : false; $header['tin'] = $firm['tin']; $header['address'] = $pos->address; - $header['pointname'] = $pos->pos_name; + $header['pointname'] = $pos->pointname; $header['date'] = date('dmY'); $header['time'] = date('His'); $header['docnumber'] = $pos->fiscdocnumber; @@ -189,34 +216,41 @@ public static function shift($cid, $posid, $open) { $header['username'] = \App\System::getUser()->username; $header['guid'] = \App\Util::guid(); - + $report = new \App\Report('shift.xml'); $xml = $report->generate($header); - - + + $xml = mb_convert_encoding($xml, "windows-1251", "utf-8"); - - - return self::send($xml, 'doc', $firm['pposerver'],$firm['pposerverport'], true); + + + return self::send($xml, 'doc', $firm['pposerver'], $firm['pposerverport'], true); } - - public static function zform($cid, $posid ) { + + + /** + * отправка z-отчета + * + * @param mixed $posid pos терминал + * @param mixed $stat данные оплат + * @param mixed $rstat данные оплат по возврату + */ + public static function zform($posid, $stat, $rstat) { $pos = \App\Entity\Pos::load($posid); - $firm = \App\Helper::getFirmData($cid,$pos->branch_id); - $branch = \App\Entity\Branch::load($pos->branch_id); - - + $firm = \App\Helper::getFirmData($pos->firm_id); + + $header = array(); $header['doctype'] = $open == true ? 100 : 101; $header['firmname'] = $firm['firm_name']; - $header['inn'] = strlen($firm['inn'])>0 ? $firm['inn'] : false; + $header['inn'] = strlen($firm['inn']) > 0 ? $firm['inn'] : false; $header['tin'] = $firm['tin']; $header['address'] = $pos->address; - $header['pointname'] = $pos->pos_name; + $header['pointname'] = $pos->pointname; $header['date'] = date('dmY'); $header['time'] = date('His'); $header['docnumber'] = $pos->fiscdocnumber; @@ -224,470 +258,458 @@ public static function zform($cid, $posid ) { $header['posnumber'] = $pos->fiscalnumber; $header['username'] = \App\System::getUser()->username; $header['guid'] = \App\Util::guid(); - $header['pays'] = array(); - $header['paysr'] = array(); - $amount=0; - $amountr=0; - $cnt=0; - $cntr=0; - - $stat = self::getStat($pos->pos_id); + $header['pays'] = array(); + $header['paysr'] = array(); + $amount = 0; + $amountr = 0; + $cnt = $stat['cnt']; + $cntr = $rstat['cnt']; + + //реализация - - $n=1; - $cnt = $cnt+ $stat['cnt']; - if($stat['amount0']>0) { - $header['pays'][] = array( - 'formname'=> H::l('ppo_nal'), - 'formcode'=> 0, - 'sum'=> number_format($stat['amount0'], 2, '.', '') , - 'num'=>"ROWNUM=\"{$n}\"" - ); - $amount = $amount + $stat['amount0'] ; - $n++; - } - if($stat['amount1']>0) { - $header['pays'][] = array( - 'formname'=> H::l('ppo_bnal'), - 'formcode'=> 1, - 'sum'=> number_format($stat['amount1'], 2, '.', '') , - 'num'=>"ROWNUM=\"{$n}\"" - ); - $amount = $amount + $stat['amount1'] ; - $n++; - } - if($row['amount2']>0) { - $header['pays'][] = array( - 'formname'=> H::l('ppo_credit'), - 'formcode'=> 2, - 'sum'=> number_format($stat['amount2'], 2, '.', '') , - 'num'=>"ROWNUM=\"{$n}\"" - ); - $amount = $amount + $stat['amount2'] ; - $n++; - } - if($stat['amount3']>0) { - $header['pays'][] = array( - 'formname'=> H::l('ppo_prepaid'), - 'formcode'=> 3, - 'sum'=> number_format($stat['amount3'], 2, '.', '') , - 'num'=>"ROWNUM=\"{$n}\"" - ); - $amount = $amount + $stat['amount3'] ; - $n++; - } - - - $stat = self::getStat($pos->pos_id,true); + + $n = 1; + + if ($stat['amount0'] > 0) { + $header['pays'][] = array( + 'formname' => H::l('ppo_nal'), + 'formcode' => 0, + 'sum' => number_format($stat['amount0'], 2, '.', ''), + 'num' => "ROWNUM=\"{$n}\"" + ); + $amount = $amount + $stat['amount0']; + $n++; + } + if ($stat['amount1'] > 0) { + $header['pays'][] = array( + 'formname' => H::l('ppo_bnal'), + 'formcode' => 1, + 'sum' => number_format($stat['amount1'], 2, '.', ''), + 'num' => "ROWNUM=\"{$n}\"" + ); + $amount = $amount + $stat['amount1']; + $n++; + } + if ($row['amount2'] > 0) { + $header['pays'][] = array( + 'formname' => H::l('ppo_credit'), + 'formcode' => 2, + 'sum' => number_format($stat['amount2'], 2, '.', ''), + 'num' => "ROWNUM=\"{$n}\"" + ); + $amount = $amount + $stat['amount2']; + $n++; + } + if ($stat['amount3'] > 0) { + $header['pays'][] = array( + 'formname' => H::l('ppo_prepaid'), + 'formcode' => 3, + 'sum' => number_format($stat['amount3'], 2, '.', ''), + 'num' => "ROWNUM=\"{$n}\"" + ); + $amount = $amount + $stat['amount3']; + $n++; + } + + //возврат - - $n=1; - $cntr = $cntr+ $stat['cnt']; - if($stat['amount0']>0) { - $header['paysr'][] = array( - 'formname'=> H::l('ppo_nal'), - 'formcode'=> 0, - 'sum'=> number_format($stat['amount0'], 2, '.', '') , - 'num'=>"ROWNUM=\"{$n}\"" - ); - $amountr = $amountr + $stat['amount0'] ; - $n++; - } - if($stat['amount1']>0) { - $header['paysr'][] = array( - 'formname'=> H::l('ppo_bnal'), - 'formcode'=> 1, - 'sum'=> number_format($stat['amount1'], 2, '.', '') , - 'num'=>"ROWNUM=\"{$n}\"" - ); - $amountr = $amountr + $stat['amount1'] ; - $n++; - } + + $n = 1; + if ($rstat['amount0'] > 0) { + $header['paysr'][] = array( + 'formname' => H::l('ppo_nal'), + 'formcode' => 0, + 'sum' => number_format($rstat['amount0'], 2, '.', ''), + 'num' => "ROWNUM=\"{$n}\"" + ); + $amountr = $amountr + $rstat['amount0']; + $n++; + } + if ($rstat['amount1'] > 0) { + $header['paysr'][] = array( + 'formname' => H::l('ppo_bnal'), + 'formcode' => 1, + 'sum' => number_format($rstat['amount1'], 2, '.', ''), + 'num' => "ROWNUM=\"{$n}\"" + ); + $amountr = $amountr + $rstat['amount1']; + $n++; + } + - /* - $cnt=6; - $header['pays'][] = array( - 'formname'=> 'H::l('ppo_nal'), - 'formcode'=> 0, - 'sum'=> number_format(64, 2, '.', '') , - 'num'=>"ROWNUM=\"1\"" - ); - - $header['pays'][] = array( - 'formname'=> 'Наличная', - 'formcode'=> 1, - 'sum'=> number_format(30.3, 2, '.', '') , - 'num'=>"ROWNUM=\"2\"" - ); - - */ $header['amount'] = number_format($amount, 2, '.', ''); $header['amountr'] = number_format($amountr, 2, '.', ''); - $header['cnt'] = $cnt ; - $header['cntr'] = $cntr ; - $header['isreal'] = $cnt>0 ; - $header['isret'] = $cntr>0 ; - + $header['cnt'] = $cnt; + $header['cntr'] = $cntr; + $header['isreal'] = $cnt > 0; + $header['isret'] = $cntr > 0; + $report = new \App\Report('zform.xml'); $xml = $report->generate($header); - - - $xml = mb_convert_encoding($xml , "windows-1251","utf-8" ) ; + + $xml = mb_convert_encoding($xml, "windows-1251", "utf-8"); - return self::send($xml, 'doc', $firm['pposerver'],$firm['pposerverport'], true); + return self::send($xml, 'doc', $firm['pposerver'], $firm['pposerverport'], true); } - public static function check($doc ) { - - - - $firm = \App\Helper::getFirmData($doc->firm_id,$doc->branch_id); - $branch = \App\Entity\Branch::load($doc->branch_id); + /** + * отправка чека + * + * @param mixed $doc + */ + public static function check($doc) { + + $pos = \App\Entity\Pos::load($doc->headerdata['pos']); - + $firm = \App\Helper::getFirmData($pos->firm_id); + $mf = \App\Entity\MoneyFund::load($doc->headerdata['payment']); - - $header = array( ); - $header['doctype'] = $doctype ; - $header['docsubtype'] = $docsubtype ; + + $header = array(); + $header['doctype'] = $doctype; + $header['docsubtype'] = $docsubtype; $header['firmname'] = $firm['firm_name']; - $header['inn'] = strlen($firm['inn'])>0 ? $firm['inn'] : false; + $header['inn'] = strlen($firm['inn']) > 0 ? $firm['inn'] : false; $header['tin'] = $firm['tin']; $header['address'] = $pos->address; - $header['pointname'] = $pos->pos_name; + $header['pointname'] = $pos->pointname; $header['date'] = date('dmY'); $header['time'] = date('His'); $header['docnumber'] = $pos->fiscdocnumber; $header['posinner'] = $pos->fiscallocnumber; $header['posnumber'] = $pos->fiscalnumber; - $header['username'] = $doc->username ; + $header['username'] = $doc->username; $header['guid'] = \App\Util::guid(); - - - $header['disc'] = $doc->headerdata["paydisc"] >0 ? number_format($doc->headerdata["paydisc"], 2, '.', '') : false; + + + $header['disc'] = $doc->headerdata["paydisc"] > 0 ? number_format($doc->headerdata["paydisc"], 2, '.', '') : false; $header['details'] = array(); - $n=1; - $disc=1; - if($doc->headerdata["paydisc"] >0 ) { - $disc = 1 - ($doc->headerdata["paydisc"]/$doc->amount); - + $n = 1; + $disc = 1; + if ($doc->headerdata["paydisc"] > 0) { + $disc = 1 - ($doc->headerdata["paydisc"] / $doc->amount); + } - $header['amount'] =0; - foreach ($doc->unpackDetails('detaildata') as $item) { + $header['amount'] = 0; + foreach ($doc->unpackDetails('detaildata') as $item) { $header['details'][] = array( - 'num'=>"ROWNUM=\"{$n}\"", - 'name'=> $item->itemname , - 'qty'=> number_format($item->quantity , 3, '.', '') , - 'price'=> number_format($item->price*$disc , 2, '.', ''), - 'cost'=> number_format($item->quantity*$item->price*$disc , 2, '.', '') - ) ; + 'num' => "ROWNUM=\"{$n}\"", + 'name' => $item->itemname, + 'qty' => number_format($item->quantity, 3, '.', ''), + 'price' => number_format($item->price * $disc, 2, '.', ''), + 'cost' => number_format($item->quantity * $item->price * $disc, 2, '.', '') + ); $n++; - $header['amount'] = $header['amount']+ $item->quantity*$item->price*$disc; + $header['amount'] = $header['amount'] + $item->quantity * $item->price * $disc; } - foreach ($doc->unpackDetails('services') as $item) { + foreach ($doc->unpackDetails('services') as $item) { $header['details'][] = array( - 'num'=>"ROWNUM=\"{$n}\"", - 'name'=> $item->service_name , - 'qty'=> number_format($item->quantity , 3, '.', '') , - 'price'=> number_format($item->price*$disc , 2, '.', ''), - 'cost'=> number_format($item->quantity*$item->price*$disc , 2, '.', '') - ) ; + 'num' => "ROWNUM=\"{$n}\"", + 'name' => $item->service_name, + 'qty' => number_format($item->quantity, 3, '.', ''), + 'price' => number_format($item->price * $disc, 2, '.', ''), + 'cost' => number_format($item->quantity * $item->price * $disc, 2, '.', '') + ); $n++; - $header['amount'] = $header['amount']+ $item->quantity*$item->price*$disc; + $header['amount'] = $header['amount'] + $item->quantity * $item->price * $disc; } - $amount0=0; - $amount1=0; - $amount2=0; - $amount3=0; + $amount0 = 0; + $amount1 = 0; + $amount2 = 0; + $amount3 = 0; $header['pays'] = array(); - $n=1; - + $n = 1; + if ($doc->headerdata['payment'] == \App\Entity\MoneyFund::PREPAID) { $pay = array( - 'formname'=> H::l('ppo_prepaid'), - 'formcode'=> 3, - 'paysum'=> number_format($header['amount'], 2, '.', '') , - 'payed'=> number_format($header['amount'], 2, '.', '') , - 'num'=>"ROWNUM=\"{$n}\"" - ); - - $header['pays'][]=$pay; - $n++; - $amount3 = $pay['paysum']; - } else - if ($mf != null && $mf->beznal==1) { - $pay = array( - 'formname'=> H::l('ppo_bnal'), - 'formcode'=> 1, - 'paysum'=> number_format($doc->payamount, 2, '.', '') , - 'payed'=> number_format($doc->payamount, 2, '.', '') , - 'num'=>"ROWNUM=\"{$n}\"" + 'formname' => H::l('ppo_prepaid'), + 'formcode' => 3, + 'paysum' => number_format($header['amount'], 2, '.', ''), + 'payed' => number_format($header['amount'], 2, '.', ''), + 'num' => "ROWNUM=\"{$n}\"" ); - // в долг - if($doc->payed < $doc->payamount) { - $pay['paysum'] = number_format($doc->payamount, 2, '.', '') ; - $pay['payed'] = number_format($doc->payed, 2, '.', '') ; - - } - $header['pays'][]=$pay; + + $header['pays'][] = $pay; $n++; - $amount1 = $pay['paysum']; - } else { - - $pay = array( - 'formname'=> H::l('ppo_nal'), - 'formcode'=> 0, - 'paysum'=> number_format($doc->payamount, 2, '.', '') , - 'payed'=> number_format($doc->payed, 2, '.', '') , - 'rest'=>false, - 'num'=>"ROWNUM=\"{$n}\"" - ); - //сдача - if($doc->headerdata["exchange"] >0 ){ - $pay['rest'] = number_format($doc->headerdata["exchange"], 2, '.', ''); + $amount3 = $pay['paysum']; + } else { + if ($mf != null && $mf->beznal == 1) { + $pay = array( + 'formname' => H::l('ppo_bnal'), + 'formcode' => 1, + 'paysum' => number_format($doc->payamount, 2, '.', ''), + 'payed' => number_format($doc->payamount, 2, '.', ''), + 'num' => "ROWNUM=\"{$n}\"" + ); + // в долг + if ($doc->payed < $doc->payamount) { + $pay['paysum'] = number_format($doc->payamount, 2, '.', ''); + $pay['payed'] = number_format($doc->payed, 2, '.', ''); + + } + $header['pays'][] = $pay; + $n++; + $amount1 = $pay['paysum']; + } else { + + $pay = array( + 'formname' => H::l('ppo_nal'), + 'formcode' => 0, + 'paysum' => number_format($doc->payamount, 2, '.', ''), + 'payed' => number_format($doc->payed, 2, '.', ''), + 'rest' => false, + 'num' => "ROWNUM=\"{$n}\"" + ); + //сдача + if ($doc->headerdata["exchange"] > 0) { + $pay['rest'] = number_format($doc->headerdata["exchange"], 2, '.', ''); + } + // в долг + if ($doc->payed < $doc->payamount) { + $pay['paysum'] = number_format($doc->payed, 2, '.', ''); + $pay['payed'] = number_format($doc->payed, 2, '.', ''); + + } + + $header['pays'][] = $pay; + $n++; + $amount0 = $pay['paysum']; } - // в долг - if($doc->payed < $doc->payamount) { - $pay['paysum'] = number_format($doc->payed, 2, '.', '') ; - $pay['payed'] = number_format($doc->payed, 2, '.', '') ; - - } - - $header['pays'][]=$pay; - $n++; - $amount0 = $pay['paysum']; - } + } // в долг - if($doc->payed < $doc->payamount) { - $pay = array( - 'formname'=> H::l('ppo_credit'), - 'formcode'=> 2, - 'paysum'=> number_format($doc->payamount - $doc->payed, 2, '.', '') , - 'payed'=> number_format($doc->payamount - $doc->payed, 2, '.', '') , - 'rest'=>false, - 'num'=>"ROWNUM=\"{$n}\"" - ); - $header['pays'][]=$pay; + if ($doc->payed < $doc->payamount) { + $pay = array( + 'formname' => H::l('ppo_credit'), + 'formcode' => 2, + 'paysum' => number_format($doc->payamount - $doc->payed, 2, '.', ''), + 'payed' => number_format($doc->payamount - $doc->payed, 2, '.', ''), + 'rest' => false, + 'num' => "ROWNUM=\"{$n}\"" + ); + $header['pays'][] = $pay; $n++; - + $amount2 = $pay['paysum']; - } - - $header['pay'] = count($header['pays'])>0 ; + } + + $header['pay'] = count($header['pays']) > 0; $header['disc'] = false; - - $header['amount'] = number_format($header['amount'], 2, '.', ''); - if($doc->headerdata["paydisc"] >0 ) { - // $header['disc'] = number_format($doc->headerdata["paydisc"], 2, '.', '') ; - - } + + $header['amount'] = number_format($header['amount'], 2, '.', ''); + if ($doc->headerdata["paydisc"] > 0) { + // $header['disc'] = number_format($doc->headerdata["paydisc"], 2, '.', '') ; + + } $report = new \App\Report('check.xml'); - + $xml = $report->generate($header); - $xml = mb_convert_encoding($xml , "windows-1251","utf-8" ) ; - file_put_contents("z:/xml.xml",$xml) ; - - $ret = self::send($xml,'doc',$firm['pposerver'],$firm['pposerverport'],true); - if($ret['success'] == true){ - - self::insertStat($pos->pos_id,1,$amount0,$amount1,$amount2,$amount3,$doc->document_number); + $xml = mb_convert_encoding($xml, "windows-1251", "utf-8"); + file_put_contents("z:/xml.xml", $xml); + + $ret = self::send($xml, 'doc', $firm['pposerver'], $firm['pposerverport'], true); + if ($ret['success'] == true) { + + self::insertStat($pos->pos_id, 1, $amount0, $amount1, $amount2, $amount3, $doc->document_number); } - + return $ret; - - } - - public static function checkpay($doc ) { - - $firm = \App\Helper::getFirmData($doc->firm_id,$doc->branch_id); - $branch = \App\Entity\Branch::load($doc->branch_id); - $pos = \App\Entity\Pos::load($doc->headerdata['pos']); - - - $header = array( ); - + } + + /** + * отправка доплаты + * + * @param mixed $doc + */ + public static function checkpay($doc,$pos_id,$payed,$payment) { + + + $pos = \App\Entity\Pos::load($pos_id); + $firm = \App\Helper::getFirmData($pos->firm_id); + $mf = \App\Entity\MoneyFund::load($payment); + + + $header = array(); + $header['firmname'] = $firm['firm_name']; - $header['inn'] = strlen($firm['inn'])>0 ? $firm['inn'] : false; + $header['inn'] = strlen($firm['inn']) > 0 ? $firm['inn'] : false; $header['tin'] = $firm['tin']; $header['address'] = $pos->address; - $header['pointname'] = $pos->pos_name; - $header['date'] = date('dmY'); + $header['pointname'] = $pos->pointname; + $header['date'] = date('dmY'); $header['time'] = date('His'); $header['docnumber'] = $pos->fiscdocnumber; $header['posinner'] = $pos->fiscallocnumber; $header['posnumber'] = $pos->fiscalnumber; - $header['username'] = $doc->username ; + $header['username'] = \App\System::getUser()->username; $header['guid'] = \App\Util::guid(); - - $amount0=0; - $amount1=0; - $amount2=0; - $amount3=0; - - - - if ($doc->headerdata['payment'] == \App\Entity\MoneyFund::BEZNAL) { - $header['formname'] = 'Банкiвська картка'; + + $amount0 = 0; + $amount1 = 0; + $amount2 = 0; + $amount3 = 0; + + + if ($mf != null && $mf->beznal == 1) { + $header['formname'] = H::l('ppo_bnal'); $header['formcode'] = 1; - $amount1 = number_format($doc->payed, 2, '.', '') ; - } else { - $header['formname'] = H::l('ppo_nal'); - $header['formcode'] = 0; - $amount0 = number_format($doc->payed, 2, '.', '') ; - } - // $header['amount'] = number_format($doc->amount, 2, '.', ''); - $header['pay'] = $doc->payed > 0; - $header['paysum'] = number_format($doc->payed, 2, '.', '') ; - $header['payed'] = number_format($doc->payed, 2, '.', '') ; - - - $header['parentcheck'] = $doc->document_number ; - $header['amount'] = number_format($doc->payed, 2, '.', '') ; + $amount1 = number_format($payed, 2, '.', ''); + } else { + $header['formname'] = H::l('ppo_nal'); + $header['formcode'] = 0; + $amount0 = number_format($payed, 2, '.', ''); + } + // $header['amount'] = number_format($doc->amount, 2, '.', ''); + $header['pay'] = $payed > 0; + $header['paysum'] = number_format($payed, 2, '.', ''); + $header['payed'] = number_format($payed, 2, '.', ''); + + + $header['parentcheck'] = $doc->document_number; + $header['amount'] = number_format($payed, 2, '.', ''); $report = new \App\Report('checkpay.xml'); - + $xml = $report->generate($header); - - $xml = mb_convert_encoding($xml , "windows-1251","utf-8" ) ; - - $ret = self::send($xml,'doc',$firm['pposerver'],$firm['pposerverport'],true); - if($ret['success'] == true){ - - - - self::insertStat($pos->pos_id,2,$amount0,$amount1,$amount2,$amount3,$doc->document_number); + $xml = mb_convert_encoding($xml, "windows-1251", "utf-8"); + + $ret = self::send($xml, 'doc', $firm['pposerver'], $firm['pposerverport'], true); + if ($ret['success'] == true) { + + + self::insertStat($pos->pos_id, 2, $amount0, $amount1, $amount2, $amount3, $doc->document_number); } - + return $ret; - - } - - - public static function checkback($doc ) { - - - - $firm = \App\Helper::getFirmData($doc->firm_id,$doc->branch_id); - $branch = \App\Entity\Branch::load($doc->branch_id); + + } + + /** + * отправка возвратного чека + * + * @param mixed $doc + */ + public static function checkback($doc) { + + $pos = \App\Entity\Pos::load($doc->headerdata['pos']); - - - - $header = array( ); - $header['doctype'] = $doctype ; - $header['docsubtype'] = $docsubtype ; + $firm = \App\Helper::getFirmData($pos->firm_id); + $mf = \App\Entity\MoneyFund::load($doc->headerdata['payment']); + + + $header = array(); + $header['doctype'] = $doctype; + $header['docsubtype'] = $docsubtype; $header['firmname'] = $firm['firm_name']; - $header['inn'] = strlen($firm['inn'])>0 ? $firm['inn'] : false;; - $header['tin'] = $firm['tin']; - $header['address'] = $pos->address ; - $header['pointname'] = $pos->pos_name; - $header['date'] = date('dmY'); + $header['inn'] = strlen($firm['inn']) > 0 ? $firm['inn'] : false;; + $header['tin'] = $firm['tin']; + $header['address'] = $pos->address; + $header['pointname'] = $pos->pointname; + $header['date'] = date('dmY'); $header['time'] = date('His'); - $header['docnumberback'] = $doc->headerdata["docnumberback"] ; + $header['docnumberback'] = $doc->headerdata["docnumberback"]; $header['docnumber'] = $pos->fiscdocnumber; $header['posinner'] = $pos->fiscallocnumber; $header['posnumber'] = $pos->fiscalnumber; - $header['username'] = $doc->username ; + $header['username'] = $doc->username; $header['guid'] = \App\Util::guid(); - $amount0=0; - $amount1=0; - $amount2=0; - $amount3=0; - - - - if ($doc->headerdata['payment'] == \App\Entity\MoneyFund::BEZNAL) { - $header['formname'] = 'Банкiвська картка'; + $amount0 = 0; + $amount1 = 0; + $amount2 = 0; + $amount3 = 0; + + + if ($mf != null && $mf->beznal == 1) { + $header['formname'] = H::l('ppo_bnal'); $header['formcode'] = 1; - $amount1 = number_format($doc->payed, 2, '.', '') ; - } else { - $header['formname'] = H::l('ppo_nal'); - $header['formcode'] = 0; - $amount0 = number_format($doc->payed, 2, '.', '') ; - } - - $header['paysum'] = number_format($doc->payed, 2, '.', '') ; - $header['payed'] = number_format($doc->payed, 2, '.', '') ; - + $amount1 = number_format($doc->payed, 2, '.', ''); + } else { + $header['formname'] = H::l('ppo_nal'); + $header['formcode'] = 0; + $amount0 = number_format($doc->payed, 2, '.', ''); + } + + $header['paysum'] = number_format($doc->payed, 2, '.', ''); + $header['payed'] = number_format($doc->payed, 2, '.', ''); + $header['details'] = array(); - - $n=1; - $header['amount'] =0; - foreach ($doc->detaildata as $item) { + + $n = 1; + $header['amount'] = 0; + foreach ($doc->unpackDetails('detaildata') as $item) { $header['details'][] = array( - 'num'=>"ROWNUM=\"{$n}\"", - 'name'=> $item['itemname'] , - 'qty'=> number_format($item['quantity'] , 3, '.', '') , - 'price'=> number_format($item['price'] , 2, '.', ''), - 'cost'=> number_format($item['quantity'] * $item['price'] , 2, '.', '') - ) ; + 'num' => "ROWNUM=\"{$n}\"", + 'name' => $item->itemname, + 'qty' => number_format($item->quantity, 3, '.', ''), + 'price' => number_format($item->price, 2, '.', ''), + 'cost' => number_format($item->quantity * $item->price, 2, '.', '') + ); $n++; - $header['amount'] = $header['amount'] + $item['quantity'] * $item['price'] ; + $header['amount'] = $header['amount'] + $item->quantity * $item->price; } - - - $header['amount'] = number_format($header['amount'], 2, '.', ''); - + + + $header['amount'] = number_format($header['amount'], 2, '.', ''); + $report = new \App\Report('checkback.xml'); - + $xml = $report->generate($header); - - $xml = mb_convert_encoding($xml , "windows-1251","utf-8" ) ; - - - $ret = self::send($xml,'doc',$firm['pposerver'],$firm['pposerverport'],true); - if($ret['success'] == true){ - - - self::insertStat($pos->pos_id,3,$amount0,$amount1,$amount2,$amount3,$doc->document_number); + + $xml = mb_convert_encoding($xml, "windows-1251", "utf-8"); + + + $ret = self::send($xml, 'doc', $firm['pposerver'], $firm['pposerverport'], true); + if ($ret['success'] == true) { + + + self::insertStat($pos->pos_id, 3, $amount0, $amount1, $amount2, $amount3, $doc->document_number); } - + return $ret; - - } - + + } + //функции работы со статистикой для z-отчета - public static function insertStat($pos_id,$checktype,$amount0,$amount1,$amount2,$amount3,$document_number=''){ - $conn = \ZDB\DB::getConnect(); - $amount0 = number_format($amount0, 2, '.', '') ; - $amount1 = number_format($amount1, 2, '.', '') ; - $amount2 = number_format($amount2, 2, '.', '') ; - $amount3 = number_format($amount3, 2, '.', '') ; - $sql = "insert into zformstat (pos_id,checktype, amount0,amount1,amount2,amount3,document_number,createdon) values ({$pos_id},{$checktype}, {$amount0}, {$amount1},{$amount2},{$amount3},". $conn->qstr($document_number) .",". $conn->DBDate(time()) .")"; - - $conn->Execute($sql) ; - - } - - public static function clearStat($pos_id ){ - $conn = \ZDB\DB::getConnect(); - - $conn->Execute("delete from zformstat where pos_id=".$pos_id ) ; - - } - - public static function getStat($pos_id,$ret=false ){ - $conn = \ZDB\DB::getConnect(); - - $sql = "select count(*) as cnt, coalesce(sum(amount0),0) as amount0, coalesce(sum(amount1),0) as amount1, coalesce(sum(amount2),0) as amount2, coalesce(sum(amount3),0) as amount3 from zformstat where pos_id=".$pos_id; - if($ret==true){ - $sql = $sql . " and checktype =3" ; //возврат - } else { - $sql = $sql . " and checktype <>3" ; - } - - - return $conn->GetRow($sql) ; - - } - + public static function insertStat($pos_id, $checktype, $amount0, $amount1, $amount2, $amount3, $document_number = '') { + $conn = \ZDB\DB::getConnect(); + $amount0 = number_format($amount0, 2, '.', ''); + $amount1 = number_format($amount1, 2, '.', ''); + $amount2 = number_format($amount2, 2, '.', ''); + $amount3 = number_format($amount3, 2, '.', ''); + $sql = "insert into zformstat (pos_id,checktype, amount0,amount1,amount2,amount3,document_number,createdon) values ({$pos_id},{$checktype}, {$amount0}, {$amount1},{$amount2},{$amount3}," . $conn->qstr($document_number) . "," . $conn->DBDate(time()) . ")"; + + $conn->Execute($sql); + + } + + public static function clearStat($pos_id) { + $conn = \ZDB\DB::getConnect(); + + $conn->Execute("delete from zformstat where pos_id=" . $pos_id); + + } + + public static function getStat($pos_id, $ret = false) { + $conn = \ZDB\DB::getConnect(); + + $sql = "select count(*) as cnt, coalesce(sum(amount0),0) as amount0, coalesce(sum(amount1),0) as amount1, coalesce(sum(amount2),0) as amount2, coalesce(sum(amount3),0) as amount3 from zformstat where pos_id=" . $pos_id; + if ($ret == true) { + $sql = $sql . " and checktype =3"; //возврат + } else { + $sql = $sql . " and checktype <>3"; + } + + + return $conn->GetRow($sql); + + } + } \ No newline at end of file diff --git a/www/app/modules/ppo/ppolist.php b/www/app/modules/ppo/ppolist.php index 71c48fa53..9c7c6c6f0 100644 --- a/www/app/modules/ppo/ppolist.php +++ b/www/app/modules/ppo/ppolist.php @@ -40,18 +40,16 @@ public function __construct() { } $modules = System::getOptions("modules"); - $this->add(new Panel('opan')); $this->opan->add(new Form('filter'))->onSubmit($this, 'filterOnSubmit'); $this->opan->filter->add(new DropDownChoice('searchcomp', \App\Entity\Firm::findArray('firm_name', 'disabled<>1', 'firm_name'), 0)); - $this->opan->add(new DataView('ppolist', new ArrayDataSource(new Prop($this, '_ppolist')), $this, 'ppoOnRow')); $this->opan->add(new Paginator('pagp', $this->opan->ppolist)); - $this->opan->ppolist->setPageSize(50 ); //H::getPG() + $this->opan->ppolist->setPageSize(2000); //H::getPG() $this->add(new Panel('shpan'))->setVisible(false); $this->shpan->add(new ClickLink('backo', $this, 'onBacko')); @@ -72,29 +70,26 @@ public function filterOnSubmit($sender) { if ($cid == 0) { return; } - $firm= Firm::load($cid); - $res = PPOHelper::send(json_encode(array('Command' => 'Objects')), 'cmd', $firm->pposerver,$firm->pposerverport,false); - if($res['success']==false) { + $firm = Firm::load($cid); + $res = PPOHelper::send(json_encode(array('Command' => 'Objects')), 'cmd', $firm->pposerver, $firm->pposerverport, false); + if ($res['success'] == false) { $this->setError($res['data']); return; } - + $this->_ppolist = array(); $res = json_decode($res['data']); if (is_array($res->TaxObjects)) { - $this->_ppolist = array(); + foreach ($res->TaxObjects as $item) { foreach ($item->TransactionsRegistrars as $tr) { - $it = new DataItem(array('org' => $item)); + $it = new DataItem(array('org' => $item)); $it->tr = $tr; $this->_ppolist[] = $it; } } - $this->opan->ppolist->Reload(); } - - } public function ppoOnRow($row) { @@ -105,11 +100,13 @@ public function ppoOnRow($row) { $row->add(new Label('name', $item->org->Name)); $row->add(new Label('org', $item->org->OrgName)); + $row->add(new Label('address', $item->org->Address)); $row->add(new Label('tin', $item->org->Tin)); $row->add(new Label('ipn', $item->org->Ipn)); $row->add(new Label('fn', $item->tr->NumFiscal)); $row->add(new Label('ln', $item->tr->NumLocal)); $row->add(new Label('rn', $item->tr->Name)); + $row->add(new ClickLink('objdet', $this, 'onObj')); } @@ -118,7 +115,7 @@ public function ppoOnRow($row) { public function onObj($sender) { $this->ppo = $sender->getOwner()->getDataItem(); - $this->updateShifts() ; + $this->updateShifts(); $this->opan->setVisible(false); $this->shpan->setVisible(true); @@ -129,10 +126,10 @@ public function updateShifts() { $from = \Carbon\Carbon::now()->addMonth(-1)->startOfMonth()->format('c'); $to = \Carbon\Carbon::now()->format('c'); $cid = $this->opan->filter->searchcomp->getValue(); - $firm= Firm::load($cid); + $firm = Firm::load($cid); - $res = PPOHelper::send(json_encode(array('Command' => 'Shifts', 'NumFiscal' => $this->ppo->tr->NumFiscal, 'From' => $from, 'To' => $to)), 'cmd', $firm->pposerver,$firm->pposerverport,false); - if($res['success']==false) { + $res = PPOHelper::send(json_encode(array('Command' => 'Shifts', 'NumFiscal' => $this->ppo->tr->NumFiscal, 'From' => $from, 'To' => $to)), 'cmd', $firm->pposerver, $firm->pposerverport, false); + if ($res['success'] == false) { $this->setError($res['data']); return; } @@ -150,8 +147,8 @@ public function updateShifts() { } $this->shpan->shlist->Reload(); - } - + } + public function onBacko($sender) { $this->opan->setVisible(true); $this->shpan->setVisible(false); @@ -165,8 +162,8 @@ public function shOnRow($row) { $row->add(new Label('openname', $item->openname)); $row->add(new Label('closename', $item->closename)); $row->add(new Label('opened', date('Y-m-d H:i', strtotime($item->opened)))); - $cl = strtotime($item->closed) ; - $row->add(new Label('closed', $cl>0? date('Y-m-d H:i',$cl ):'')); + $cl = strtotime($item->closed); + $row->add(new Label('closed', $cl > 0 ? date('Y-m-d H:i', $cl) : '')); $row->add(new ClickLink('shdet', $this, 'onSh')); } @@ -176,10 +173,10 @@ public function onSh($sender) { $sh = $sender->getOwner()->getDataItem(); $this->_doclist = array(); $cid = $this->opan->filter->searchcomp->getValue(); - $firm= Firm::load($cid); + $firm = Firm::load($cid); - $res = PPOHelper::send(json_encode(array('Command' => 'Documents', 'NumFiscal' => $this->ppo->tr->NumFiscal, 'ShiftId' => $sh->ShiftId)), 'cmd', $firm->pposerver,$firm->pposerverport,false); - if($res['success']==false) { + $res = PPOHelper::send(json_encode(array('Command' => 'Documents', 'NumFiscal' => $this->ppo->tr->NumFiscal, 'ShiftId' => $sh->ShiftId)), 'cmd', $firm->pposerver, $firm->pposerverport, false); + if ($res['success'] == false) { $this->setError($res['data']); return; } @@ -207,8 +204,8 @@ public function onBacksh($sender) { $this->shpan->setVisible(true); $this->docpan->setVisible(false); $this->docpan->docshow->setVisible(false); - $this->updateShifts() ; - + $this->updateShifts(); + } @@ -229,17 +226,17 @@ public function onDoc($sender) { $doc = $sender->getOwner()->getDataItem(); $this->docpan->doclist->setSelectedRow($sender->getOwner()); $this->docpan->doclist->Reload(); - + $cid = $this->opan->filter->searchcomp->getValue(); - $firm= Firm::load($cid); + $firm = Firm::load($cid); - $res = PPOHelper::send(json_encode(array('Command' => $doc->DocClass, 'RegistrarNumFiscal' => $this->ppo->tr->NumFiscal, 'NumFiscal' => $doc->NumFiscal)), 'cmd', $firm->pposerver,$firm->pposerverport,true); - if($res['success']==false) { + $res = PPOHelper::send(json_encode(array('Command' => $doc->DocClass, 'RegistrarNumFiscal' => $this->ppo->tr->NumFiscal, 'NumFiscal' => $doc->NumFiscal)), 'cmd', $firm->pposerver, $firm->pposerverport, true); + if ($res['success'] == false) { $this->setError($res['data']); return; } - - + + // $res = mb_convert_encoding($res , "utf-8" ,"windows-1251" ) ; $this->docpan->docshow->setText($res['data']); $this->docpan->docshow->setVisible(true); diff --git a/www/app/modules/ppo/zform.php b/www/app/modules/ppo/zform.php index b0b3a42ab..f74fb646b 100644 --- a/www/app/modules/ppo/zform.php +++ b/www/app/modules/ppo/zform.php @@ -2,8 +2,151 @@ namespace App\Modules\PPO; +use Zippy\Html\Form\DropDownChoice; +use Zippy\Html\Form\Form; +use Zippy\Html\Form\TextInput; + + class ZForm extends \App\Pages\Base { + private $pos; + + public function __construct() { + parent::__construct(); + + $this->add(new Form('filter'))->onSubmit($this, 'OnRefresh'); + + $this->filter->add(new DropDownChoice('pos', \App\Entity\Pos::findArray('pos_name', ''), 0)); + + $this->add(new Form('stat'))->onSubmit($this, 'OnClose'); + $this->stat->add(new TextInput('nal')); + $this->stat->add(new TextInput('bnal')); + $this->stat->add(new TextInput('credit')); + $this->stat->add(new TextInput('prepaid')); + $this->stat->add(new TextInput('retnal')); + $this->stat->add(new TextInput('retbnal')); + $this->stat->add(new TextInput('cnt')); + $this->stat->add(new TextInput('retcnt')); + $this->stat->setVisible(false); + } + + + public function OnRefresh($sender) { + $pos_id = $this->filter->pos->getValue(); + if ($pos_id == 0) { + return; + } + $this->pos = \App\Entity\Pos::load($pos_id); + + $this->stat->setVisible(true); + + $data = \App\Modules\PPO\PPOHelper::getStat($pos_id, false); + $this->stat->nal->setText($data['amount0']); + $this->stat->bnal->setText($data['amount1']); + $this->stat->credit->setText($data['amount2']); + $this->stat->prepaid->setText($data['amount3']); + $this->stat->cnt->setText($data['cnt']); + + $data = \App\Modules\PPO\PPOHelper::getStat($pos_id, true); + $this->stat->retnal->setText($data['amount0']); + $this->stat->retbnal->setText($data['amount1']); + $this->stat->retcnt->setText($data['cnt']); + + + } + + public function OnClose($sender) { + + + $ret = $this->zform(); + if ($ret == true) { + $this->closeshift(); + }; + + + } + + public function zform() { + + $stat = array(); + $rstat = array(); + + $stat['amount0'] = $this->stat->nal->getText(); + $stat['amount1'] = $this->stat->bnal->getText(); + $stat['amount2'] = $this->stat->credit->getText(); + $stat['amount3'] = $this->stat->prepaid->getText(); + $stat['cnt'] = $this->stat->cnt->getText(); + + $rstat['amount0'] = $this->stat->retnal->getText(); + $rstat['amount1'] = $this->stat->retbnal->getText(); + $rstat['amount2'] = 0; + $rstat['amount3'] = 0; + $rstat['cnt'] = $this->stat->retcnt->getText(); + + $ret = \App\Modules\PPO\PPOHelper::zform($this->pos->pos_id, $stat, $rstat); + if (strpos($ret['data'], 'ZRepAlreadyRegistered')) { + return true; + } + if ($ret['success'] == false && $ret['docnumber'] > 0) { + //повторяем для нового номера + $this->pos->fiscdocnumber = $ret['docnumber']; + $this->pos->save(); + $ret = \App\Modules\PPO\PPOHelper::zform($this->pos->pos_id, $stat, $rstat); + + + } + if ($ret['success'] == false) { + $this->setError($ret['data']); + return false; + } else { + + if ($ret['docnumber'] > 0) { + $this->pos->fiscdocnumber = $ret['doclocnumber'] + 1; + $this->pos->save(); + } else { + $this->setError("ppo_noretnumber"); + return; + + } + + } + + + return true; + } + + + public function closeshift() { + + + $ret = \App\Modules\PPO\PPOHelper::shift($this->pos->pos_id, false); + if ($ret['success'] == false && $ret['docnumber'] > 0) { + //повторяем для нового номера + $pos->fiscdocnumber = $ret['docnumber']; + $pos->save(); + $ret = \App\Modules\PPO\PPOHelper::shift($this->pos->pos_id, false); + + + } + if ($ret['success'] == false) { + $this->setError($ret['data']); + return false; + } else { + $this->setSuccess("ppo_shiftclosed"); + if ($ret['docnumber'] > 0) { + $this->pos->fiscdocnumber = $ret['doclocnumber'] + 1; + $this->pos->save(); + } else { + $this->setError("ppo_noretnumber"); + return; + + } + \App\Modules\PPO\PPOHelper::clearStat($this->pos->pos_id); + } + + + return true; + } + - } \ No newline at end of file diff --git a/www/app/modules/shop/pages/grouplist.php b/www/app/modules/shop/pages/grouplist.php index d6fae9e15..ffa6ea594 100644 --- a/www/app/modules/shop/pages/grouplist.php +++ b/www/app/modules/shop/pages/grouplist.php @@ -201,10 +201,8 @@ public function OnSavePhoto($sender) { $this->setError('squareimage'); return; } - - - - + + $image = new \App\Entity\Image(); $image->content = file_get_contents($filedata['tmp_name']); diff --git a/www/app/modules/tecdoc/dbhelper.php b/www/app/modules/tecdoc/dbhelper.php index c4b5b2a8f..09a653156 100644 --- a/www/app/modules/tecdoc/dbhelper.php +++ b/www/app/modules/tecdoc/dbhelper.php @@ -11,7 +11,7 @@ public function __construct($type = 'passenger') { $this->type = $type; $modules = \App\System::getOptions("modules"); if ($modules['td_seconddb'] == 1) { - + $this->conn = \ADONewConnection("mysqli"); $this->conn->NConnect($modules['td_dbhost'], $modules['td_dbuser'], $modules['td_dbpass'], $modules['td_dbname']); $this->conn->Execute("SET NAMES 'utf8'"); diff --git a/www/app/modules/tecdoc/options.php b/www/app/modules/tecdoc/options.php index 6b00f69a4..ce17ab527 100644 --- a/www/app/modules/tecdoc/options.php +++ b/www/app/modules/tecdoc/options.php @@ -28,29 +28,29 @@ public function __construct() { $form = $this->add(new Form("cform")); $form->add(new TextInput('ipath', $modules['td_ipath'])); - $form->add(new CheckBox('seconddb', $modules['td_seconddb']==1))->onChange($this,'onDB'); + $form->add(new CheckBox('seconddb', $modules['td_seconddb'] == 1))->onChange($this, 'onDB'); $form->add(new TextInput('dbhost', $modules['td_dbhost'])); $form->add(new TextInput('dbname', $modules['td_dbname'])); $form->add(new TextInput('dbuser', $modules['td_dbuser'])); $form->add(new TextInput('dbpass', $modules['td_dbpass'])); - + $form->add(new DropDownChoice('defpricetype', \App\Entity\Item::getPriceTypeList(), $modules['td_pricetype'])); $form->add(new DropDownChoice('defstore', \App\Entity\Store::getList(), $modules['td_store'])); $form->add(new SubmitButton('save'))->onClick($this, 'saveOnClick'); - + $this->onDB($form->seconddb); } public function onDB($sender) { - $b = $sender->isChecked(); - $this->cform->dbhost->setVisible($b); - $this->cform->dbname->setVisible($b); - $this->cform->dbuser->setVisible($b); - $this->cform->dbpass->setVisible($b); + $b = $sender->isChecked(); + $this->cform->dbhost->setVisible($b); + $this->cform->dbname->setVisible($b); + $this->cform->dbuser->setVisible($b); + $this->cform->dbpass->setVisible($b); } - + public function saveOnClick($sender) { $modules = System::getOptions("modules"); @@ -58,7 +58,7 @@ public function saveOnClick($sender) { $modules['td_pricetype'] = $this->cform->defpricetype->getValue(); $modules['td_store'] = $this->cform->defstore->getValue(); $modules['td_ipath'] = $this->cform->ipath->getText(); - + $modules['td_seconddb'] = $this->cform->seconddb->isChecked() ? 1 : 0; $modules['td_dbhost'] = $this->cform->dbhost->getText(); $modules['td_dbname'] = $this->cform->dbname->getText(); diff --git a/www/app/modules/tecdoc/search.php b/www/app/modules/tecdoc/search.php index bd4045961..88f33b7c4 100644 --- a/www/app/modules/tecdoc/search.php +++ b/www/app/modules/tecdoc/search.php @@ -298,7 +298,7 @@ public function onSearch2($sender) { } else { $this->setWarn('Ничего не найдено'); } - $this->add(new Panel('tview'))->setVisible(false); + $this->tview->setVisible(false); } diff --git a/www/app/pages/base.php b/www/app/pages/base.php index 48476086f..1f3af2ce8 100644 --- a/www/app/pages/base.php +++ b/www/app/pages/base.php @@ -54,7 +54,7 @@ public function __construct($params = null) { $options = System::getOptions('common'); - + $this->_tvars["usesnumber"] = $options['usesnumber'] == 1; $this->_tvars["usescanner"] = $options['usescanner'] == 1; $this->_tvars["useimages"] = $options['useimages'] == 1; diff --git a/www/app/pages/branchlist.php b/www/app/pages/branchlist.php index 3ee64ed68..5caf049de 100644 --- a/www/app/pages/branchlist.php +++ b/www/app/pages/branchlist.php @@ -36,7 +36,6 @@ public function __construct() { $this->branchtable->add(new ClickLink('addnew'))->onClick($this, 'addOnClick'); $this->add(new Form('branchdetail'))->setVisible(false); $this->branchdetail->add(new TextInput('editbranchname')); - $this->branchdetail->add(new TextInput('editshopname')); $this->branchdetail->add(new TextInput('editaddress')); $this->branchdetail->add(new TextInput('editphone')); @@ -76,7 +75,7 @@ public function editOnClick($sender) { $this->branchtable->setVisible(false); $this->branchdetail->setVisible(true); $this->branchdetail->editbranchname->setText($this->_branch->branch_name); - $this->branchdetail->editshopname->setText($this->_branch->shop_name); + $this->branchdetail->editphone->setText($this->_branch->phone); $this->branchdetail->editaddress->setText($this->_branch->address); @@ -105,7 +104,7 @@ public function saveOnClick($sender) { $this->_branch->address = $this->branchdetail->editaddress->getText(); $this->_branch->phone = $this->branchdetail->editphone->getText(); - $this->_branch->shop_name = $this->branchdetail->editshopname->getText(); + $this->_branch->comment = $this->branchdetail->editcomment->getText(); $this->_branch->disabled = $this->branchdetail->editdisabled->isChecked() ? 1 : 0; diff --git a/www/app/pages/doc/goodsissue.php b/www/app/pages/doc/goodsissue.php index a6bfc7219..a506e3ee0 100644 --- a/www/app/pages/doc/goodsissue.php +++ b/www/app/pages/doc/goodsissue.php @@ -84,7 +84,7 @@ public function __construct($docid = 0, $basedocid = 0) { $this->docform->add(new DropDownChoice('contract', array(), 0))->setVisible(false);; - $this->docform->add(new DropDownChoice('pricetype', Item::getPriceTypeList())); + $this->docform->add(new DropDownChoice('pricetype', Item::getPriceTypeList(), H::getDefPriceType())); $this->docform->add(new DropDownChoice('emp', \App\Entity\Employee::findArray('emp_name', '', 'emp_name'))); $this->docform->add(new DropDownChoice('delivery', array(1 => H::l('delself'), 2 => H::l('delboy'), 3 => H::l('delmail')), 1))->onChange($this, 'OnDelivery'); @@ -172,7 +172,7 @@ public function __construct($docid = 0, $basedocid = 0) { $this->_orderid = $this->_doc->headerdata['order_id']; $this->_prevcust = $this->_doc->customer_id; - $this->docform->firm->setValue($this->_doc->headerdata['firm_id']); + $this->docform->firm->setValue($this->_doc->firm_id); $this->OnChangeCustomer($this->docform->customer); $this->docform->contract->setValue($this->_doc->headerdata['contract_id']); @@ -243,7 +243,7 @@ public function __construct($docid = 0, $basedocid = 0) { $invoice = $basedoc->cast(); $this->docform->total->setText($invoice->amount); - $this->docform->firm->setValue($basedoc->headerdata['firm_id']); + $this->docform->firm->setValue($basedoc->firm_id); $this->OnChangeCustomer($this->docform->customer); $this->docform->contract->setValue($basedoc->headerdata['contract_id']); @@ -278,7 +278,7 @@ public function __construct($docid = 0, $basedocid = 0) { $this->docform->ship_address->setText($basedoc->headerdata['address']); $this->docform->delivery->setValue($basedoc->headerdata['delivery']); - $this->docform->firm->setValue($basedoc->headerdata['firm_id']); + $this->docform->firm->setValue($basedoc->firm_id); $this->OnChangeCustomer($this->docform->customer); $this->docform->contract->setValue($basedoc->headerdata['contract_id']); @@ -297,7 +297,7 @@ public function __construct($docid = 0, $basedocid = 0) { $this->docform->customer->setKey($basedoc->customer_id); $this->docform->customer->setText($basedoc->customer_name); } - + } } } @@ -485,8 +485,8 @@ public function savedocOnClick($sender) { $this->_doc->headerdata['customer_name'] = $this->docform->customer->getText() . ' ' . $customer->phone; } $this->_doc->headerdata['contract_id'] = $this->docform->contract->getValue(); - $this->_doc->headerdata['firm_id'] = $this->docform->firm->getValue(); - if ($this->_doc->headerdata['firm_id'] > 0) { + $this->_doc->firm_id = $this->docform->firm->getValue(); + if ($this->_doc->firm_id > 0) { $this->_doc->headerdata['firm_name'] = $this->docform->firm->getValueName(); } @@ -803,7 +803,7 @@ private function checkForm() { $this->setError('enterdocnumber'); } - + if (false == $this->_doc->checkUniqueNumber()) { $this->docform->document_number->setText($this->_doc->nextNumber()); $this->setError('nouniquedocnumber_created'); @@ -828,7 +828,7 @@ private function checkForm() { $this->setError("mustsel_cust"); } if ($c == 0) { - // $this->setError("noselcust"); + // $this->setError("noselcust"); } return !$this->isError(); diff --git a/www/app/pages/doc/goodsreceipt.php b/www/app/pages/doc/goodsreceipt.php index 339ef7a27..00786d2dd 100644 --- a/www/app/pages/doc/goodsreceipt.php +++ b/www/app/pages/doc/goodsreceipt.php @@ -148,7 +148,7 @@ public function __construct($docid = 0, $basedocid = 0) { $this->docform->editpayed->setText($this->_doc->payed); $this->docform->store->setValue($this->_doc->headerdata['store']); $this->docform->payment->setValue($this->_doc->headerdata['payment']); - $this->docform->firm->setValue($this->_doc->headerdata['firm_id']); + $this->docform->firm->setValue($this->_doc->firm_id); $this->OnCustomerFirm($this->docform->customer); $this->docform->contract->setValue($this->_doc->headerdata['contract_id']); @@ -193,7 +193,7 @@ public function __construct($docid = 0, $basedocid = 0) { $this->docform->editrate->setText($invoice->headerdata['rate']); $this->docform->disc->setText($invoice->headerdata['disc']); $this->docform->editdisc->setText($invoice->headerdata['disc']); - $this->docform->firm->setValue($invoice->headerdata['firm_id']); + $this->docform->firm->setValue($invoice->firm_id); $this->OnCustomerFirm($this->docform->customer); $this->docform->contract->setValue($invoice->headerdata['contract_id']); @@ -211,7 +211,7 @@ public function __construct($docid = 0, $basedocid = 0) { $this->docform->customer->setText($basedoc->customer_name); $basedoc = $basedoc->cast(); - $this->docform->firm->setValue($basedoc->headerdata['firm_id']); + $this->docform->firm->setValue($basedoc->firm_id); $this->OnCustomerFirm($this->docform->customer); $this->docform->contract->setValue($basedoc->headerdata['contract_id']); @@ -314,7 +314,7 @@ public function addcodeOnClick($sender) { } foreach ($this->_itemlist as $ri => $_item) { - if ($_item->bar_code == $code) { + if ($_item->bar_code == $code || $_item->item_code == $code) { $this->_itemlist[$ri]->quantity += 1; $this->docform->detail->Reload(); $this->calcTotal(); @@ -334,6 +334,8 @@ public function addcodeOnClick($sender) { if ($item == null) { $this->setWarn('item_notfound'); + $this->addnewitemOnClick(null); + } else { $this->editdetail->edititem->setKey($item->item_id); $this->editdetail->edititem->setText($item->itemname); @@ -434,8 +436,8 @@ public function savedocOnClick($sender) { $this->_doc->headerdata['customer_name'] = $this->docform->customer->getText() . ' ' . $customer->phone; } $this->_doc->headerdata['contract_id'] = $this->docform->contract->getValue(); - $this->_doc->headerdata['firm_id'] = $this->docform->firm->getValue(); - if ($this->_doc->headerdata['firm_id'] > 0) { + $this->_doc->firm_id = $this->docform->firm->getValue(); + if ($this->_doc->firm_id > 0) { $this->_doc->headerdata['firm_name'] = $this->docform->firm->getValueName(); } diff --git a/www/app/pages/doc/inventory.php b/www/app/pages/doc/inventory.php index 96a5068a3..8e8c45f26 100644 --- a/www/app/pages/doc/inventory.php +++ b/www/app/pages/doc/inventory.php @@ -198,8 +198,8 @@ public function savedocOnClick($sender) { $this->_doc->notes = $this->docform->notes->getText(); - $this->_doc->headerdata['autoincome'] = $this->docform->autoincome->isChecked() ?1:0; - $this->_doc->headerdata['autooutcome'] = $this->docform->autooutcome->isChecked() ?1:0; + $this->_doc->headerdata['autoincome'] = $this->docform->autoincome->isChecked() ? 1 : 0; + $this->_doc->headerdata['autooutcome'] = $this->docform->autooutcome->isChecked() ? 1 : 0; $this->_doc->headerdata['cat'] = $this->docform->category->getValue(); $this->_doc->headerdata['store'] = $this->docform->store->getValue(); $this->_doc->headerdata['storename'] = $this->docform->store->getValueName(); @@ -275,20 +275,21 @@ public function OnChangeStore($sender) { $this->_itemlist = array(); $this->docform->detail->Reload(); } + public function OnChangeCat($sender) { - $cat_id = $sender->getValue() ; - - if($cat_id>0) { + $cat_id = $sender->getValue(); + + if ($cat_id > 0) { $itemlist = array(); - foreach($this->_itemlist as $item) { - if($item->cat_id==$cat_id) { - $itemlist[$item->item_id]=$item; + foreach ($this->_itemlist as $item) { + if ($item->cat_id == $cat_id) { + $itemlist[$item->item_id] = $item; } } $this->_itemlist = $itemlist; - + $this->docform->detail->Reload(); - + } } @@ -296,26 +297,27 @@ public function OnAutocompleteItem($sender) { $store_id = $this->docform->store->getValue(); $text = trim($sender->getText()); $cat_id = $this->docform->category->getValue(); - - return Item::findArrayAC($text, $store_id,$cat_id); + + return Item::findArrayAC($text, $store_id, $cat_id); } public function loadallOnClick($sender) { - $this->_itemlist = array(); - $store_id = $this->docform->store->getValue(); - $cat_id = $this->docform->category->getValue(); - $w = " disabled<> 1 and item_id in (select item_id from store_stock_view where qty>0 and store_id={$store_id}) "; - if($cat_id>0){ - $w = $w . " and cat_id =". $cat_id ; - } - $items = Item::find($w,'itemname') ; - foreach($items as $item) { - $item->qfact=0; - $item->quantity=0; - $this->_itemlist[$item->item_id]=$item; - } - $this->docform->detail->Reload(); + $this->_itemlist = array(); + $store_id = $this->docform->store->getValue(); + $cat_id = $this->docform->category->getValue(); + $w = " disabled<> 1 and item_id in (select item_id from store_stock_view where qty>0 and store_id={$store_id}) "; + if ($cat_id > 0) { + $w = $w . " and cat_id =" . $cat_id; + } + $items = Item::find($w, 'itemname'); + foreach ($items as $item) { + $item->qfact = 0; + $item->quantity = 0; + $this->_itemlist[$item->item_id] = $item; + } + $this->docform->detail->Reload(); } + public function addcodeOnClick($sender) { $code = trim($this->docform->barcode->getText()); $this->docform->barcode->setText(''); @@ -325,9 +327,9 @@ public function addcodeOnClick($sender) { $code_ = Item::qstr($code); $cat_id = $this->docform->category->getValue(); - $w = "item_code={$code_} or bar_code={$code_}" ; - if($cat_id >0) { - $w = $w . " and cat_id=".$cat_id ; + $w = "item_code={$code_} or bar_code={$code_}"; + if ($cat_id > 0) { + $w = $w . " and cat_id=" . $cat_id; } $item = Item::getFirst($w); if ($item == null) { diff --git a/www/app/pages/doc/invoice.php b/www/app/pages/doc/invoice.php index 0dc6cb806..43f72058f 100644 --- a/www/app/pages/doc/invoice.php +++ b/www/app/pages/doc/invoice.php @@ -128,7 +128,7 @@ public function __construct($docid = 0, $basedocid = 0) { $this->_prevcust = $this->_doc->customer_id; $this->_tovarlist = $this->_doc->unpackDetails('detaildata'); - $this->docform->firm->setValue($this->_doc->headerdata['firm_id']); + $this->docform->firm->setValue($this->_doc->firm_id); $this->OnChangeCustomer($this->docform->customer); $this->docform->contract->setValue($this->_doc->headerdata['contract_id']); @@ -316,7 +316,7 @@ public function savedocOnClick($sender) { $this->_doc->headerdata['pricetype'] = $this->docform->pricetype->getValue(); $this->_doc->headerdata['store'] = $this->docform->store->getValue(); $this->_doc->headerdata['contract_id'] = $this->docform->contract->getValue(); - $this->_doc->headerdata['firm_id'] = $this->docform->firm->getValue(); + $this->_doc->firm_id = $this->docform->firm->getValue(); $this->_doc->packDetails('detaildata', $this->_tovarlist); diff --git a/www/app/pages/doc/invoicecust.php b/www/app/pages/doc/invoicecust.php index 691a44e26..f92596383 100644 --- a/www/app/pages/doc/invoicecust.php +++ b/www/app/pages/doc/invoicecust.php @@ -115,7 +115,7 @@ public function __construct($docid = 0, $basedocid = 0) { $this->docform->document_date->setDate($this->_doc->document_date); $this->docform->customer->setKey($this->_doc->customer_id); $this->docform->customer->setText($this->_doc->customer_name); - $this->docform->firm->setValue($this->_doc->headerdata['firm_id']); + $this->docform->firm->setValue($this->_doc->firm_id); $this->OnCustomerFirm($this->docform->customer); $this->docform->contract->setValue($this->_doc->headerdata['contract_id']); @@ -291,8 +291,8 @@ public function savedocOnClick($sender) { $this->_doc->headerdata['customer_name'] = $this->docform->customer->getText() . ' ' . $customer->phone; } $this->_doc->headerdata['contract_id'] = $this->docform->contract->getValue(); - $this->_doc->headerdata['firm_id'] = $this->docform->firm->getValue(); - if ($this->_doc->headerdata['firm_id'] > 0) { + $this->_doc->firm_id = $this->docform->firm->getValue(); + if ($this->_doc->firm_id > 0) { $this->_doc->headerdata['firm_name'] = $this->docform->firm->getValueName(); } @@ -492,7 +492,7 @@ public function OnAutoItem($sender) { } public function OnAutoCustomer($sender) { - + return Customer::getList($sender->getText(), 2); } diff --git a/www/app/pages/doc/ordercust.php b/www/app/pages/doc/ordercust.php index 243b3566f..38c463228 100644 --- a/www/app/pages/doc/ordercust.php +++ b/www/app/pages/doc/ordercust.php @@ -57,7 +57,7 @@ public function __construct($docid = 0, $basedocid = 0) { $this->editdetail->add(new AutocompleteTextInput('edititem'))->onText($this, 'OnAutoItem'); $this->editdetail->add(new SubmitLink('addnewitem'))->onClick($this, 'addnewitemOnClick'); $this->editdetail->add(new TextInput('editquantity'))->setText("1"); - $this->editdetail->add(new TextInput('editcustcode')) ; + $this->editdetail->add(new TextInput('editcustcode')); $this->editdetail->add(new TextInput('editprice')); $this->editdetail->add(new Button('cancelrow'))->onClick($this, 'cancelrowOnClick'); diff --git a/www/app/pages/doc/outcomeitem.php b/www/app/pages/doc/outcomeitem.php index 866683c23..6c07e07cb 100644 --- a/www/app/pages/doc/outcomeitem.php +++ b/www/app/pages/doc/outcomeitem.php @@ -283,15 +283,15 @@ public function savedocOnClick($sender) { $indoc->branch_id = 0; if ($this->_tvars["usebranch"]) { $st = Store::load($tostore); - + $indoc->branch_id = $st->branch_id; } $indoc->document_number = $indoc->nextNumber($indoc->branch_id); $indoc->user_id = 0; - $indoc->notes = H::l('incomebasedon', $this->_doc->document_number,$this->_doc->headerdata['storename']); - if($this->_doc->branch_id>0){ - $br = \App\Entity\Branch::load($this->_doc->branch_id); - $indoc->notes = H::l('incomebasedonbr', $this->_doc->document_number,$this->_doc->headerdata['storename'],$br->branch_name); + $indoc->notes = H::l('incomebasedon', $this->_doc->document_number, $this->_doc->headerdata['storename']); + if ($this->_doc->branch_id > 0) { + $br = \App\Entity\Branch::load($this->_doc->branch_id); + $indoc->notes = H::l('incomebasedonbr', $this->_doc->document_number, $this->_doc->headerdata['storename'], $br->branch_name); } $items = array(); diff --git a/www/app/pages/doc/poscheck.php b/www/app/pages/doc/poscheck.php index 0b1b979ac..100075b98 100644 --- a/www/app/pages/doc/poscheck.php +++ b/www/app/pages/doc/poscheck.php @@ -223,6 +223,14 @@ public function __construct($docid = 0, $basedocid = 0) { $this->docform->payment->setValie(MoneyFund::PREPAID);// предоплата } } + if ($basedoc->meta_name == 'Task') { + $this->docform->customer->setKey($basedoc->customer_id); + $this->docform->customer->setText($basedoc->customer_name); + + $this->docform->notes->setText('Наряд ' . $basedoc->document_number); + $this->_serlist = $basedoc->unpackDetails('detaildata'); + + } } diff --git a/www/app/pages/doc/prodissue.php b/www/app/pages/doc/prodissue.php index 81b73df8f..7a7d86545 100644 --- a/www/app/pages/doc/prodissue.php +++ b/www/app/pages/doc/prodissue.php @@ -95,8 +95,8 @@ public function __construct($docid = 0, $basedocid = 0) { if ($basedoc->meta_name == 'ServiceAct') { $this->docform->notes->setText(H::l('basedon') . $basedoc->document_number); - - } + + } if ($basedoc->meta_name == 'ProdIssue') { $this->docform->store->setValue($basedoc->headerdata['store']); $this->docform->parea->setValue($basedoc->headerdata['parea']); diff --git a/www/app/pages/doc/prodreceipt.php b/www/app/pages/doc/prodreceipt.php index 256ffd8b2..6c8c5494e 100644 --- a/www/app/pages/doc/prodreceipt.php +++ b/www/app/pages/doc/prodreceipt.php @@ -52,7 +52,7 @@ public function __construct($docid = 0, $basedocid = 0) { $this->docform->add(new Label('total')); $this->add(new Form('editdetail'))->setVisible(false); - $this->editdetail->add(new DropDownChoice('edititem',Item::findArray('itemname','disabled<>1 and item_type in(4,5)','itemname'))) ; + $this->editdetail->add(new DropDownChoice('edititem', Item::findArray('itemname', 'disabled<>1 and item_type in(4,5)', 'itemname'))); $this->editdetail->edititem->onChange($this, 'OnChangeItem', true); $this->editdetail->add(new TextInput('editquantity'))->setText("1"); @@ -93,7 +93,7 @@ public function __construct($docid = 0, $basedocid = 0) { if ($basedoc instanceof Document) { $this->_basedocid = $basedocid; if ($basedoc->meta_name == 'Order') { - + $this->_itemlist = $basedoc->unpackDetails('detaildata'); } @@ -145,7 +145,6 @@ public function editOnClick($sender) { $this->editdetail->edititem->setValue($item->item_id); - $this->_rowid = $item->item_id; @@ -176,12 +175,12 @@ public function saverowOnClick($sender) { $id = $this->editdetail->edititem->getValue(); - - if ($id == 0 ) { + + if ($id == 0) { $this->setError("noselitem"); return; } - + $item = Item::load($id); @@ -227,7 +226,7 @@ public function saverowOnClick($sender) { $this->calcTotal(); //очищаем форму $this->editdetail->edititem->setValue(0); - + $this->editdetail->editquantity->setText("1"); @@ -346,7 +345,7 @@ public function beforeRender() { public function backtolistOnClick($sender) { App::RedirectBack(); } - + public function OnChangeItem($sender) { $id = $sender->getValue(); $item = \App\Entity\Item::load($id); diff --git a/www/app/pages/doc/retcustissue.php b/www/app/pages/doc/retcustissue.php index 5a8526516..584a00c25 100644 --- a/www/app/pages/doc/retcustissue.php +++ b/www/app/pages/doc/retcustissue.php @@ -246,7 +246,7 @@ public function savedocOnClick($sender) { } // $this->calcTotal(); - $firm = H::getFirmData($this->_doc->headerdata["firm_id"], $this->branch_id); + $firm = H::getFirmData($this->_doc->firm_id, $this->branch_id); $this->_doc->headerdata["firm_name"] = $firm['firm_name']; $this->_doc->headerdata['store'] = $this->docform->store->getValue(); diff --git a/www/app/pages/doc/returnissue.php b/www/app/pages/doc/returnissue.php index 9d62d41ea..bf336518d 100644 --- a/www/app/pages/doc/returnissue.php +++ b/www/app/pages/doc/returnissue.php @@ -50,6 +50,7 @@ public function __construct($docid = 0, $basedocid = 0) { $this->docform->add(new TextInput('notes')); $this->docform->add(new DropDownChoice('payment', MoneyFund::getList(), H::getDefMF())); + $this->docform->add(new DropDownChoice('pos', \App\Entity\Pos::findArray('pos_name', "details like '%1%' "), 0)); $this->docform->add(new SubmitLink('addrow'))->onClick($this, 'addrowOnClick'); $this->docform->add(new SubmitButton('savedoc'))->onClick($this, 'savedocOnClick'); @@ -106,6 +107,15 @@ public function __construct($docid = 0, $basedocid = 0) { $this->docform->customer->setText($basedoc->customer_name); + $this->_tovarlist = $basedoc->unpackDetails('detaildata'); + + } + if ($basedoc->meta_name == 'POSCheck') { + $this->docform->store->setValue($basedoc->headerdata['store']); + $this->docform->customer->setKey($basedoc->customer_id); + $this->docform->customer->setText($basedoc->customer_name); + + $this->_tovarlist = $basedoc->unpackDetails('detaildata'); } @@ -233,7 +243,7 @@ public function savedocOnClick($sender) { } - $firm = H::getFirmData($this->_doc->headerdata["firm_id"], $this->branch_id); + $firm = H::getFirmData($this->_doc->firm_id, $this->branch_id); $this->_doc->headerdata["firm_name"] = $firm['firm_name']; $this->_doc->headerdata['store'] = $this->docform->store->getValue(); @@ -246,6 +256,55 @@ public function savedocOnClick($sender) { $this->_doc->payed = $this->docform->payed->getText(); $isEdited = $this->_doc->document_id > 0; + + $pos_id = $this->docform->pos->getValue(); + + if($pos_id>0) { + $pos = \App\Entity\Pos::load($pos_id); + + if ($this->_basedocid > 0) { + $basedoc = Document::load($this->_basedocid); + $this->_doc->headerdata["docnumberback"] = $basedoc->headerdata["fiscalnumber"]; + + } + + if(strlen($this->_doc->headerdata["docnumberback"])==0) { + $this->setError("ppo_returndoc"); + return; + } + + $this->_doc->headerdata["pos"] =$pos->pos_id; + + $ret = \App\Modules\PPO\PPOHelper::checkback($this->_doc ); + if($ret['success'] == false && $ret['docnumber']>0) { + //повторяем для нового номера + $pos->fiscdocnumber = $ret['docnumber']; + $pos->save(); + $ret = \App\Modules\PPO\PPOHelper::checkback($this->_doc ); + + } + if($ret['success'] == false ) { + $this->setError($ret['data']); + return; + } else { + + if($ret['docnumber'] >0) { + $pos->fiscdocnumber = $ret['doclocnumber']+1; + $pos->save(); + $this->_doc->headerdata["fiscalnumber"] = $ret['docnumber'] ; + } else { + $this->setError("ppo_noretnumber"); + return; + + } + + } + + + } + + + $conn = \ZDB\DB::getConnect(); $conn->BeginTrans(); try { @@ -263,7 +322,8 @@ public function savedocOnClick($sender) { } else { $this->_doc->updateStatus($isEdited ? Document::STATE_EDITED : Document::STATE_NEW); } - + + $conn->CommitTrans(); App::RedirectBack(); @@ -341,7 +401,7 @@ public function OnChangeStore($sender) { } public function OnAutoCustomer($sender) { - return Customer::getList($sender->getText(),1); + return Customer::getList($sender->getText(), 1); } public function OnAutoItem($sender) { diff --git a/www/app/pages/doc/serviceact.php b/www/app/pages/doc/serviceact.php index 2ed77af7e..acc4c725c 100644 --- a/www/app/pages/doc/serviceact.php +++ b/www/app/pages/doc/serviceact.php @@ -115,7 +115,7 @@ public function __construct($docid = 0, $basedocid = 0) { $this->docform->document_date->setDate($this->_doc->document_date); $this->docform->customer->setKey($this->_doc->customer_id); $this->docform->customer->setText($this->_doc->customer_name); - $this->docform->firm->setValue($this->_doc->headerdata['firm_id']); + $this->docform->firm->setValue($this->_doc->firm_id); $this->OnCustomerFirm(null); $this->docform->contract->setValue($this->_doc->headerdata['contract_id']); @@ -127,6 +127,8 @@ public function __construct($docid = 0, $basedocid = 0) { $basedoc = Document::load($basedocid); if ($basedoc->meta_name == 'Task') { + $this->docform->customer->setKey($basedoc->customer_id); + $this->docform->customer->setText($basedoc->customer_name); $this->docform->notes->setText('Наряд ' . $basedoc->document_number); $this->_servicelist = $basedoc->unpackDetails('detaildata'); @@ -215,7 +217,6 @@ public function saverowOnClick($sender) { $this->editdetail->editservice->setValue(0); $this->editdetail->editdesc->setText(''); - $this->editdetail->editprice->setText("0"); } @@ -240,12 +241,11 @@ public function savedocOnClick($sender) { $this->_doc->headerdata['device'] = $this->docform->device->getText(); $this->_doc->headerdata['devsn'] = $this->docform->devsn->getText(); $this->_doc->headerdata['contract_id'] = $this->docform->contract->getValue(); - $this->_doc->headerdata['firm_id'] = $this->docform->firm->getValue(); - if ($this->_doc->headerdata['firm_id'] > 0) { + $this->_doc->firm_id = $this->docform->firm->getValue(); + if ($this->_doc->firm_id > 0) { $this->_doc->headerdata['firm_name'] = $this->docform->firm->getValueName(); } - $this->calcTotal(); $this->_doc->headerdata['gar'] = $this->docform->gar->getText(); @@ -266,7 +266,6 @@ public function savedocOnClick($sender) { return; } - $this->_doc->packDetails('detaildata', $this->_servicelist); $isEdited = $this->_doc->document_id > 0; @@ -347,7 +346,6 @@ private function calcTotal() { } } - $this->docform->paydisc->setText($disc); $this->docform->editpaydisc->setText($disc); } @@ -359,7 +357,6 @@ public function OnPayment($sender) { $b = $sender->getValue(); - if ($b == \App\Entity\MoneyFund::PREPAID) { $this->docform->payed->setVisible(false); $this->docform->payamount->setVisible(false); diff --git a/www/app/pages/doc/task.php b/www/app/pages/doc/task.php index 3b221ee6a..b9f5cfa73 100644 --- a/www/app/pages/doc/task.php +++ b/www/app/pages/doc/task.php @@ -15,6 +15,7 @@ use Zippy\Html\Form\SubmitButton; use Zippy\Html\Form\TextArea; use Zippy\Html\Form\TextInput; +use Zippy\Html\Form\AutocompleteTextInput; use Zippy\Html\Label; use Zippy\Html\Link\ClickLink; use Zippy\Html\Link\SubmitLink; @@ -43,6 +44,8 @@ public function __construct($docid = 0, $basedocid = 0, $date = null) { $this->docform->add(new TextArea('notes')); $this->docform->add(new TextInput('taskhours', "0")); + $this->docform->add(new AutocompleteTextInput('customer'))->onText($this, 'OnAutoCustomer'); + $this->docform->add(new DropDownChoice('parea', Prodarea::findArray("pa_name", ""), 0)); $this->docform->add(new SubmitLink('addservice'))->onClick($this, 'addserviceOnClick'); @@ -80,6 +83,8 @@ public function __construct($docid = 0, $basedocid = 0, $date = null) { $this->docform->document_number->setText($this->_doc->document_number); $this->docform->notes->setText($this->_doc->notes); $this->docform->taskhours->setText($this->_doc->headerdata['taskhours']); + $this->docform->customer->setKey($this->_doc->customer_id); + $this->docform->customer->setText($this->_doc->customer_name); $this->docform->document_date->setDate($this->_doc->document_date); @@ -102,11 +107,11 @@ public function __construct($docid = 0, $basedocid = 0, $date = null) { if ($basedoc instanceof Document) { $this->_basedocid = $basedocid; $this->_doc->customer_id = $basedoc->customer_id; - + if ($basedoc->meta_name == 'ServiceAct') { $this->docform->notes->setText(H::l('basedon') . $basedoc->document_number); $this->_servicelist = $basedoc->unpackDetails('detaildata'); - + } if ($basedoc->meta_name == 'Order') { $this->docform->notes->setText(H::l('basedon') . $basedoc->document_number); @@ -141,7 +146,7 @@ public function detailOnRow($row) { $row->add(new Label('service', $service->service_name)); - $row->add(new Label('qty', $service->qty)); + $row->add(new Label('quantity', $service->quantity)); $row->add(new ClickLink('edit'))->onClick($this, 'editOnClick'); @@ -165,7 +170,7 @@ public function editOnClick($sender) { $this->docform->setVisible(false); - $this->editdetail->editqty->setText($service->qty); + $this->editdetail->editqty->setText($service->quantity); $this->editdetail->editservice->setValue($service->service_id); } @@ -189,9 +194,11 @@ public function saverowOnClick($sender) { $service = Service::load($id); - $service->qty = $this->editdetail->editqty->getText(); - - + $service->quantity = $this->editdetail->editqty->getText(); + $service->price = $service->cost; + if (strlen($service->price) == 0) { + $service->price = 0; + } $this->_servicelist[$service->service_id] = $service; $this->editdetail->setVisible(false); $this->docform->setVisible(true); @@ -289,20 +296,22 @@ public function savedocOnClick($sender) { $this->_doc->headerdata['pareaname'] = $this->docform->parea->getValueName(); $this->_doc->headerdata['taskhours'] = $this->docform->taskhours->getText(); $this->_doc->document_date = $this->docform->document_date->getDate(); - + $this->_doc->customer_id = $this->docform->customer->getKey(); + if ($this->_doc->customer_id > 0) { + $customer = \App\Entity\Customer::load($this->_doc->customer_id); + $this->_doc->headerdata['customer_name'] = $this->docform->customer->getText() . ' ' . $customer->phone; + } if ($this->checkForm() == false) { return; } - $this->_doc->packDetails('detaildata', $this->_servicelist); $this->_doc->packDetails('eqlist', $this->_eqlist); $this->_doc->packDetails('emplist', $this->_emplist); $isEdited = $this->_doc->document_id > 0; - $conn = \ZDB\DB::getConnect(); $conn->BeginTrans(); try { @@ -362,15 +371,16 @@ private function checkForm() { $this->setError("noenterpos"); } - return !$this->isError(); - } public function backtolistOnClick($sender) { App::RedirectBack(); } + public function OnAutoCustomer($sender) { + return \App\Entity\Customer::getList($sender->getText(), 1); + } } diff --git a/www/app/pages/doc/warranty.php b/www/app/pages/doc/warranty.php index 730984fdf..bee683d3c 100644 --- a/www/app/pages/doc/warranty.php +++ b/www/app/pages/doc/warranty.php @@ -201,7 +201,7 @@ public function savedocOnClick($sender) { $this->_doc->notes = $this->docform->notes->getText(); $this->_doc->headerdata["customer_name"] = $this->docform->customer->getText(); - $firm = H::getFirmData($this->_doc->headerdata["firm_id"], $this->branch_id); + $firm = H::getFirmData($this->_doc->firm_id, $this->branch_id); $this->_doc->headerdata["firm_name"] = $firm['firm_name']; diff --git a/www/app/pages/options.php b/www/app/pages/options.php index 19a7e7a58..631344ae2 100644 --- a/www/app/pages/options.php +++ b/www/app/pages/options.php @@ -43,7 +43,7 @@ public function __construct() { $this->common->add(new CheckBox('autoarticle')); $this->common->add(new CheckBox('usesnumber')); - + $this->common->add(new CheckBox('useval')); $this->common->add(new TextInput('shopname')); @@ -84,7 +84,7 @@ public function __construct() { $this->common->shopname->setText($common['shopname']); $this->common->autoarticle->setChecked($common['autoarticle']); - + $this->common->usesnumber->setChecked($common['usesnumber']); @@ -190,7 +190,7 @@ public function saveCommonOnClick($sender) { $common['ts_end'] = $this->common->ts_end->getText(); $common['autoarticle'] = $this->common->autoarticle->isChecked() ? 1 : 0; - + $common['usesnumber'] = $this->common->usesnumber->isChecked() ? 1 : 0; $common['usescanner'] = $this->common->usescanner->isChecked() ? 1 : 0; diff --git a/www/app/pages/poslist.php b/www/app/pages/poslist.php index 163adb6c0..5973f2971 100644 --- a/www/app/pages/poslist.php +++ b/www/app/pages/poslist.php @@ -36,17 +36,16 @@ public function __construct() { $this->add(new Form('posdetail'))->setVisible(false); $this->posdetail->add(new DropDownChoice('editbranch', $this->_blist, 0)); + $this->posdetail->add(new DropDownChoice('editcomp', \App\Entity\Firm::getList(), 0)); $this->posdetail->add(new TextInput('editpos_name')); - $this->posdetail->add(new DropDownChoice('editstore', \App\Entity\Store::getList(), H::getDefStore())); - $this->posdetail->add(new DropDownChoice('editmf', \App\Entity\MoneyFund::getList())); - $this->posdetail->add(new DropDownChoice('editpricetype', \App\Entity\Item::getPriceTypeList())); $this->posdetail->add(new CheckBox('editusefisc')); $this->posdetail->add(new TextInput('editposinner')); $this->posdetail->add(new TextInput('editfisc')); $this->posdetail->add(new TextInput('editfiscalnumber')); $this->posdetail->add(new TextInput('editaddress')); + $this->posdetail->add(new TextInput('editpointname')); $this->posdetail->add(new TextArea('editcomment')); $this->posdetail->add(new SubmitButton('save'))->onClick($this, 'saveOnClick'); @@ -82,10 +81,9 @@ public function editOnClick($sender) { $this->posdetail->setVisible(true); $this->posdetail->editpos_name->setText($this->_pos->pos_name); $this->posdetail->editbranch->setValue($this->_pos->branch_id); - $this->posdetail->editstore->setValue($this->_pos->store); - $this->posdetail->editmf->setValue($this->_pos->mf); - $this->posdetail->editpricetype->setValue($this->_pos->pricetype); + $this->posdetail->editcomp->setValue($this->_pos->firm_id); $this->posdetail->editaddress->setText($this->_pos->address); + $this->posdetail->editpointname->setText($this->_pos->pointname); $this->posdetail->editposinner->setText($this->_pos->fiscallocnumber); $this->posdetail->editfisc->setText($this->_pos->fiscalnumber); $this->posdetail->editfiscalnumber->setText($this->_pos->fiscdocnumber); @@ -113,13 +111,11 @@ public function saveOnClick($sender) { $this->_pos->pos_name = $this->posdetail->editpos_name->getText(); $this->_pos->branch_id = $this->posdetail->editbranch->getValue(); + $this->_pos->firm_id = $this->posdetail->editcomp->getValue(); - $this->_pos->store = $this->posdetail->editstore->getValue(); - $this->_pos->mf = $this->posdetail->editmf->getValue(); - - $this->_pos->pricetype = $this->posdetail->editpricetype->getValue(); $this->_pos->address = $this->posdetail->editaddress->getText(); + $this->_pos->pointname = $this->posdetail->editpointname->getText(); $this->_pos->fiscallocnumber = $this->posdetail->editposinner->getText(); $this->_pos->fiscalnumber = $this->posdetail->editfisc->getText(); $this->_pos->fiscdocnumber = $this->posdetail->editfiscalnumber->getText(); @@ -129,27 +125,16 @@ public function saveOnClick($sender) { $this->setError("entername"); return; } - if ($this->_tvars['usebranch'] == true && $this->_pos->branch_id == 0) { - - $this->setError("selbranch"); - return; - } - if ($this->_pos->mf == 0) { - - $this->setError("selmf"); + if ($this->_pos->firm_id == 0) { + $this->setError("noselfirm"); return; } + if ($this->_tvars['usebranch'] == true && $this->_pos->branch_id == 0) { - if ($this->_pos->store == 0) { - - $this->setError("noselstore"); + $this->setError("selbranch"); return; } - if ($this->_pos->pricetype == "0") { - $this->setError("noselpricetype"); - return; - } if ($this->_tvars['usebranch'] == true && $this->_pos->branch_id > 0) { $mf = \App\Entity\MoneyFund::load($this->_pos->mf); diff --git a/www/app/pages/reference/contractlist.php b/www/app/pages/reference/contractlist.php index 266ca9452..20222fbcc 100644 --- a/www/app/pages/reference/contractlist.php +++ b/www/app/pages/reference/contractlist.php @@ -206,7 +206,7 @@ public function OnFilter($sender) { } public function OnAutoCustomer($sender) { - return Customer::getList($sender->getText() ); + return Customer::getList($sender->getText()); } public function showOnClick($sender) { diff --git a/www/app/pages/reference/customerlist.php b/www/app/pages/reference/customerlist.php index 029bf86fe..b43e87415 100644 --- a/www/app/pages/reference/customerlist.php +++ b/www/app/pages/reference/customerlist.php @@ -40,7 +40,7 @@ public function __construct($id = 0) { $this->add(new Form('filter'))->onSubmit($this, 'OnSearch'); $this->filter->add(new TextInput('searchkey')); $this->filter->add(new DropDownChoice('searchtype', array(Customer::TYPE_BAYER => Helper::l("bayers"), Customer::TYPE_SELLER => Helper::l("sellers"), 5 => Helper::l("holdings")), 0)); - $this->filter->add(new DropDownChoice('searchstatus', array(Customer::STATUS_ACTUAL =>Helper::l("isactul") , Customer::STATUS_DISABLED => Helper::l("notused"), Customer::STATUS_WAIT => Helper::l("potential")), Customer::STATUS_ACTUAL)); + $this->filter->add(new DropDownChoice('searchstatus', array(Customer::STATUS_ACTUAL => Helper::l("isactul"), Customer::STATUS_DISABLED => Helper::l("notused"), Customer::STATUS_WAIT => Helper::l("potential")), Customer::STATUS_ACTUAL)); $this->filter->add(new DropDownChoice('searchholding', Customer::getHoldList(), 0)); @@ -122,7 +122,7 @@ public function OnSearch($sender) { if ($type == 5) { $where .= " and detail like '%1%' "; } - if ($holding >0 ) { + if ($holding > 0) { $where .= " and detail like '%{$holding}%' "; } @@ -159,7 +159,7 @@ public function show() { $this->customertable->setVisible(false); $this->customerdetail->setVisible(true); $this->contentview->setVisible(false); - $this->customerdetail->editholding->setOptionList( Customer::getHoldList()); + $this->customerdetail->editholding->setOptionList(Customer::getHoldList()); $this->customerdetail->editcustomername->setText($this->_customer->customer_name); $this->customerdetail->editphone->setText($this->_customer->phone); @@ -226,11 +226,11 @@ public function saveOnClick($sender) { $this->_customer->status = $this->customerdetail->editstatus->getValue(); $this->_customer->isholding = $this->customerdetail->editisholding->isChecked() ? 1 : 0; - if($this->_customer->isholding == 1 && $this->_customer->holding > 0) { - $this->setError('nothold'); - return ; + if ($this->_customer->isholding == 1 && $this->_customer->holding > 0) { + $this->setError('nothold'); + return; } - + $c = Customer::getByEmail($this->_customer->email); if ($c != null) { diff --git a/www/app/pages/reference/itemlist.php b/www/app/pages/reference/itemlist.php index c732f3d3b..eead59c5e 100644 --- a/www/app/pages/reference/itemlist.php +++ b/www/app/pages/reference/itemlist.php @@ -37,10 +37,10 @@ public function __construct($add = false) { $this->add(new Form('filter'))->onSubmit($this, 'OnFilter'); $this->filter->add(new CheckBox('showdis')); $this->filter->add(new TextInput('searchkey')); - $catlist=array(); - $catlist[-1]= H::l("withoutcat") ; - foreach(Category::findArray("cat_name", "", "cat_name") as $k=>$v){ - $catlist[$k]= $v; + $catlist = array(); + $catlist[-1] = H::l("withoutcat"); + foreach (Category::findArray("cat_name", "", "cat_name") as $k => $v) { + $catlist[$k] = $v; } $this->filter->add(new DropDownChoice('searchcat', $catlist, 0)); @@ -108,7 +108,7 @@ public function __construct($add = false) { $this->itemdetail->add(new \Zippy\Html\Image('editimage', '/LoadImage.php?id=0')); $this->itemdetail->add(new \Zippy\Html\Form\File('editaddfile')); $this->itemdetail->add(new CheckBox('editdelimage')); - $this->itemdetail->add(new DropDownChoice('edittype',Item::getTypes())); + $this->itemdetail->add(new DropDownChoice('edittype', Item::getTypes())); $this->itemdetail->add(new SubmitButton('save'))->onClick($this, 'OnSubmit'); $this->itemdetail->add(new Button('cancel'))->onClick($this, 'cancelOnClick'); @@ -134,7 +134,7 @@ public function __construct($add = false) { public function itemlistOnRow($row) { $item = $row->getDataItem(); $row->setAttribute('style', $item->disabled == 1 ? 'color: #aaa' : null); - + $row->add(new Label('itemname', $item->itemname)); $row->add(new Label('code', $item->item_code)); $row->add(new Label('msr', $item->msr)); @@ -142,19 +142,19 @@ public function itemlistOnRow($row) { $row->add(new Label('manufacturer', $item->manufacturer)); $plist = array(); if ($item->price1 > 0) { - $plist[] = $item->price1 ; + $plist[] = $item->price1; } if ($item->price2 > 0) { - $plist[] = $item->price2 ; + $plist[] = $item->price2; } if ($item->price3 > 0) { - $plist[] = $item->price3 ; + $plist[] = $item->price3; } if ($item->price4 > 0) { - $plist[] = $item->price4 ; + $plist[] = $item->price4; } if ($item->price5 > 0) { - $plist[] = $item->price5 ; + $plist[] = $item->price5; } $row->add(new Label('price', implode(', ', $plist))); $row->add(new Label('hasnotes'))->setVisible(strlen($item->description) > 0); @@ -169,7 +169,7 @@ public function itemlistOnRow($row) { $row->add(new ClickLink('edit'))->onClick($this, 'editOnClick'); $row->add(new ClickLink('delete'))->onClick($this, 'deleteOnClick'); $row->add(new ClickLink('set'))->onClick($this, 'setOnClick'); - $row->set->setVisible($item->item_type ==Item::TYPE_PROD || $item->item_type ==Item::TYPE_HALFPROD); + $row->set->setVisible($item->item_type == Item::TYPE_PROD || $item->item_type == Item::TYPE_HALFPROD); $row->add(new ClickLink('print'))->onClick($this, 'printOnClick', true); @@ -189,14 +189,14 @@ public function deleteOnClick($sender) { $item = $sender->owner->getDataItem(); - + if ($item->allowDelete()) { - Item::delete($item->item_id) ; - } else { - $this->setWarn("delitemwarn") ; - $item->disabled=1; - $item->save(); - + Item::delete($item->item_id); + } else { + $this->setWarn("delitemwarn"); + $item->disabled = 1; + $item->save(); + } @@ -281,7 +281,7 @@ public function OnSubmit($sender) { } $this->_item->itemname = $this->itemdetail->editname->getText(); - if(strlen($this->_item->itemname)==0) { + if (strlen($this->_item->itemname) == 0) { $this->setError('entername'); return; } @@ -427,7 +427,7 @@ public function OnAutoSet($sender) { } $in .= ")"; - return Item::findArray('itemname', "coalesce(item_type,0) <> 1 and coalesce(item_type,0) <>3 and item_id not in {$in} and (itemname like {$text} or item_code like {$text}) and disabled <> 1",'itemname'); + return Item::findArray('itemname', "coalesce(item_type,0) <> 1 and coalesce(item_type,0) <>3 and item_id not in {$in} and (itemname like {$text} or item_code like {$text}) and disabled <> 1", 'itemname'); } public function OnAddSet($sender) { @@ -550,10 +550,10 @@ private function getWhere($p = false) { $showdis = $form->showdis->isChecked(); if ($cat != 0) { - if($cat==-1) { - $where = $where . " and cat_id=0"; - } else { - $where = $where . " and cat_id=" . $cat; + if ($cat == -1) { + $where = $where . " and cat_id=0"; + } else { + $where = $where . " and cat_id=" . $cat; } } if ($showdis == true) { diff --git a/www/app/pages/reference/mflist.php b/www/app/pages/reference/mflist.php index ab0bc61e4..b4130cf84 100644 --- a/www/app/pages/reference/mflist.php +++ b/www/app/pages/reference/mflist.php @@ -40,12 +40,12 @@ public function __construct() { $this->mfdetail->add(new TextInput('editmf_name')); $this->mfdetail->add(new DropDownChoice('editbranch', $this->_blist, 0)); - $this->mfdetail->add(new CheckBox('editbeznal'))->onChange($this,'onBeznal'); + $this->mfdetail->add(new CheckBox('editbeznal'))->onChange($this, 'onBeznal'); $this->mfdetail->add(new TextInput('editbtran')); $this->mfdetail->add(new TextArea('editmf_description')); $this->mfdetail->add(new TextInput('editbank')); $this->mfdetail->add(new TextInput('editbankacc')); - + $this->mfdetail->add(new SubmitButton('save'))->onClick($this, 'saveOnClick'); $this->mfdetail->add(new Button('cancel'))->onClick($this, 'cancelOnClick'); } @@ -109,10 +109,10 @@ public function saveOnClick($sender) { } $this->_mf->mf_name = $this->mfdetail->editmf_name->getText(); - if(strlen($this->_mf->mf_name)==0) { + if (strlen($this->_mf->mf_name) == 0) { $this->setError('entername'); return; - } + } $this->_mf->btran = $this->mfdetail->editbtran->getText(); $this->_mf->bank = $this->mfdetail->editbank->getText(); $this->_mf->bankacc = $this->mfdetail->editbankacc->getText(); @@ -122,7 +122,7 @@ public function saveOnClick($sender) { $this->setError("entername"); return; } - $this->_mf->beznal = $this->mfdetail->editbeznal->isChecked()?1:0; + $this->_mf->beznal = $this->mfdetail->editbeznal->isChecked() ? 1 : 0; $this->_mf->branch_id = $this->mfdetail->editbranch->getValue(); // if ($this->_tvars['usebranch'] == true && $this->_mf->branch_id == 0) { // $this->setError('Не выбран филиал'); @@ -139,12 +139,12 @@ public function cancelOnClick($sender) { $this->mftable->setVisible(true); $this->mfdetail->setVisible(false); } - + public function onBeznal($sender) { - $b = $sender->isChecked(); - $this->mfdetail->editbank->setVisible($b); - $this->mfdetail->editbankacc->setVisible($b); - $this->mfdetail->editbtran->setVisible($b); + $b = $sender->isChecked(); + $this->mfdetail->editbank->setVisible($b); + $this->mfdetail->editbankacc->setVisible($b); + $this->mfdetail->editbtran->setVisible($b); } } diff --git a/www/app/pages/register/doclist.php b/www/app/pages/register/doclist.php index e4dbfaed5..5e1eabbfa 100644 --- a/www/app/pages/register/doclist.php +++ b/www/app/pages/register/doclist.php @@ -395,27 +395,26 @@ public function statusOnSubmit($sender) { public function oncsv($sender) { $list = $this->doclist->getDataSource()->getItems(-1, -1, 'document_id'); - $csv = ""; - + + $header = array(); + $data = array(); + + $i=0; foreach ($list as $d) { - $csv .= H::fd($d->document_date) . ';'; - $csv .= $d->document_number . ';'; - $csv .= $d->meta_desc . ';'; - $csv .= $d->customer_name . ';'; - $csv .= $d->amount . ';'; - $csv .= str_replace(';', '', $d->notes) . ';'; - $csv .= "\n"; + $i++; + $data['A'.$i] = H::fd($d->document_date) ; + $data['B'.$i] = $d->document_number ; + $data['C'.$i] = $d->meta_desc ; + $data['D'.$i] = $d->customer_name ; + $data['E'.$i] = $d->amount ; + $data['F'.$i] = $d->notes ; + } - $csv = mb_convert_encoding($csv, "windows-1251", "utf-8"); - - - header("Content-type: text/csv"); - header("Content-Disposition: attachment;Filename=doclist.csv"); - header("Content-Transfer-Encoding: binary"); - - echo $csv; - flush(); - die; + + H::exportExcel($data,$header,'doclist.xlsx') ; + + + } } diff --git a/www/app/pages/register/gilist.php b/www/app/pages/register/gilist.php index 211f8517d..8ca4b5811 100644 --- a/www/app/pages/register/gilist.php +++ b/www/app/pages/register/gilist.php @@ -264,27 +264,24 @@ public function editOnClick($sender) { public function oncsv($sender) { $list = $this->doclist->getDataSource()->getItems(-1, -1, 'document_id'); - $csv = ""; - + $header = array(); + $data = array(); + + $i=0; foreach ($list as $d) { - $csv .= H::fd($d->document_date) . ';'; - $csv .= $d->document_number . ';'; - $csv .= $d->headerdata['order'] . ';'; - $csv .= $d->customer_name . ';'; - $csv .= $d->amount . ';'; - $csv .= str_replace(';', '', $d->notes) . ';'; - $csv .= "\n"; + $i++; + $data['A'.$i] = H::fd($d->document_date) ; + $data['B'.$i] = $d->document_number ; + $data['C'.$i] = $d->headerdata['order'] ; + $data['D'.$i] = $d->customer_name ; + $data['E'.$i] = $d->amount ; + $data['F'.$i] = $d->notes ; + } - $csv = mb_convert_encoding($csv, "windows-1251", "utf-8"); - - - header("Content-type: text/csv"); - header("Content-Disposition: attachment;Filename=selllist.csv"); - header("Content-Transfer-Encoding: binary"); - - echo $csv; - flush(); - die; + + H::exportExcel($data,$header,'selllist.xlsx') ; + + } } diff --git a/www/app/pages/register/itemlist.php b/www/app/pages/register/itemlist.php index bee207272..e3d8bc112 100644 --- a/www/app/pages/register/itemlist.php +++ b/www/app/pages/register/itemlist.php @@ -62,7 +62,7 @@ public function __construct() { public function itemlistOnRow($row) { $item = $row->getDataItem(); $store = $this->filter->searchstore->getValue(); - + $row->add(new Label('itemname', $item->itemname)); $row->add(new Label('code', $item->item_code)); $row->add(new Label('brand', $item->manufacturer)); diff --git a/www/app/pages/register/orderlist.php b/www/app/pages/register/orderlist.php index 54dc59fa6..f7cd80646 100644 --- a/www/app/pages/register/orderlist.php +++ b/www/app/pages/register/orderlist.php @@ -121,7 +121,7 @@ public function statusOnSubmit($sender) { } if ($sender->id == "btask") { $task = count($this->_doc->getChildren('Task')) > 0; - + if ($task) { $this->setWarn('task_exists'); @@ -183,18 +183,18 @@ public function updateStatusButtons() { //новый if ($state < Document::STATE_EXECUTED) { $this->statuspan->statusform->btask->setVisible(false); - + $this->statuspan->statusform->bclose->setVisible(false); $this->statuspan->statusform->bref->setVisible(false); $this->statuspan->statusform->binp->setVisible(true); - + } else { $this->statuspan->statusform->bclose->setVisible(true); $this->statuspan->statusform->bref->setVisible(true); $this->statuspan->statusform->binp->setVisible(false); - $this->statuspan->statusform->btask->setVisible(true); - + $this->statuspan->statusform->btask->setVisible(true); + } if ($ttn) { diff --git a/www/app/pages/register/paycustlist.php b/www/app/pages/register/paycustlist.php index 0e7ffd340..122abdcf9 100644 --- a/www/app/pages/register/paycustlist.php +++ b/www/app/pages/register/paycustlist.php @@ -21,13 +21,13 @@ class PayCustList extends \App\Pages\Base { - private $_doc = null; - private $_cust = null; - public $_custlist = array(); - public $_doclist = array(); - public $_pays = array(); - public $_totdebet = 0; - public $_totcredit = 0; + private $_doc = null; + private $_cust = null; + public $_custlist = array(); + public $_doclist = array(); + public $_pays = array(); + public $_totdebet = 0; + public $_totcredit = 0; /** * @@ -41,7 +41,7 @@ public function __construct() { } $this->add(new Form('filter'))->onSubmit($this, 'filterOnSubmit'); $this->filter->add(new DropDownChoice('holdlist', \App\Entity\Customer::getHoldList(), 0)); - + $this->add(new Panel("clist")); $this->clist->add(new Label("totcredit")); $this->clist->add(new Label("totdebet")); @@ -62,6 +62,7 @@ public function __construct() { $this->paypan->add(new Label("pname")); $this->paypan->add(new Form('payform'))->onSubmit($this, 'payOnSubmit'); $this->paypan->payform->add(new DropDownChoice('payment', \App\Entity\MoneyFund::getList(), H::getDefMF())); + $this->paypan->payform->add(new DropDownChoice('pos', \App\Entity\Pos::findArray('pos_name', "details like '%1%' "), 0)); $this->paypan->payform->add(new TextInput('pamount')); $this->paypan->payform->add(new TextInput('pcomment')); $this->paypan->payform->add(new Date('pdate', time())); @@ -76,26 +77,26 @@ public function __construct() { $this->updateCust(); } - + public function filterOnSubmit($sender) { $this->plist->setVisible(false); - $this->updateCust() ; + $this->updateCust(); } - + public function updateCust() { $br = ""; $c = \App\ACL::getBranchConstraint(); if (strlen($c) > 0) { $br = " {$c} and "; } - $hold=""; + $hold = ""; $holding = $this->filter->holdlist->getValue(); - if($holding>0){ - $hold=" where c.detail like '%{$holding}%'" ; + if ($holding > 0) { + $hold = " where c.detail like '%{$holding}%'"; } - + $sql = "select c.customer_name,c.phone, c.customer_id,sum(sam) as sam, fl from ( select customer_id, coalesce( (payamount - payed),0) as sam, (case when @@ -106,11 +107,11 @@ public function updateCust() { ) t join customers c on t.customer_id = c.customer_id {$hold} group by c.customer_name,c.phone, c.customer_id, fl order by c.customer_name "; $this->_custlist = \App\DataItem::query($sql); - $this->_totcredit =0; + $this->_totcredit = 0; $this->_totdebet = 0; - + $this->clist->custlist->Reload(); - + $this->clist->totdebet->setText(H::fa($this->_totdebet)); $this->clist->totcredit->setText(H::fa($this->_totcredit)); } @@ -123,11 +124,11 @@ public function custlistOnRow($row) { $row->add(new Label('debet', H::fa($cust->fl == 1 ? H::fa($cust->sam) : ""))); $row->add(new ClickLink('showdocs'))->onClick($this, 'showdocsOnClick'); - + $this->_totcredit += ($cust->fl == -1 ? $cust->sam : 0); $this->_totdebet += ($cust->fl == 1 ? $cust->sam : 0); - - + + } //список документов @@ -237,6 +238,7 @@ public function payOnRow($row) { public function payOnSubmit($sender) { $form = $this->paypan->payform; + $pos_id = $form->pos->getValue(); $amount = $form->pamount->getText(); $pdate = $form->pdate->getDate(); if ($amount == 0) { @@ -249,14 +251,50 @@ public function payOnSubmit($sender) { $this->setError('sumoverpay'); return; } - + $type = \App\Entity\Pay::PAY_BASE_INCOME; //закупки и возвраты if ($this->_doc->meta_name == 'GoodsReceipt' || $this->_doc->meta_name == 'InvoiceCust' || $this->_doc->meta_name == 'ReturnIssue') { $amount = 0 - $amount; $type = Pay::PAY_BASE_OUTCOME; } + + if($pos_id>0) { + $pos = \App\Entity\Pos::load($pos_id); + + $ret = \App\Modules\PPO\PPOHelper::checkpay($this->_doc,$pos_id,$amount, $form->payment->getValue()); + if ($ret['success'] == false && $ret['docnumber'] > 0) { + //повторяем для нового номера + $pos->fiscdocnumber = $ret['docnumber']; + $pos->save(); + $ret = \App\Modules\PPO\PPOHelper::check($this->_doc); + + } + if ($ret['success'] == false) { + $this->setError($ret['data']); + return; + } else { + + if ($ret['docnumber'] > 0) { + $pos->fiscdocnumber = $ret['doclocnumber'] + 1; + $pos->save(); + $this->_doc->headerdata["fiscalnumber"] = $ret['docnumber']; + } else { + $this->setError("ppo_noretnumber"); + return; + + } + + } + + } + + + + + + Pay::addPayment($this->_doc->document_id, $pdate, $amount, $form->payment->getValue(), $type, $form->pcomment->getText()); diff --git a/www/app/pages/register/paylist.php b/www/app/pages/register/paylist.php index f0691d860..22c3f552c 100644 --- a/www/app/pages/register/paylist.php +++ b/www/app/pages/register/paylist.php @@ -73,7 +73,7 @@ public function filterOnSubmit($sender) { } public function OnAutoCustomer($sender) { - return Customer::getList($sender->getText()); + return Customer::getList($sender->getText()); } public function doclistOnRow($row) { @@ -117,9 +117,8 @@ public function delOnClick($sender) { $id = $sender->pl_id->getText(); - Pay::cancelPayment($id, $sender->notes->getText()); - + $conn = \ZDB\DB::getConnect(); $sql = "select coalesce(abs(sum(amount)),0) from paylist where document_id=" . $pl->document_id; diff --git a/www/app/pages/report/abc.php b/www/app/pages/report/abc.php index c517ec202..c7f61017a 100644 --- a/www/app/pages/report/abc.php +++ b/www/app/pages/report/abc.php @@ -17,8 +17,8 @@ class ABC extends \App\Pages\Base { private $typelist = array(); - private $br=''; - + private $br = ''; + public function __construct() { parent::__construct(); @@ -49,13 +49,13 @@ public function __construct() { $this->detail->add(new RedirectLink('excel', "abc")); $this->detail->add(new RedirectLink('pdf', "abc")); $this->detail->add(new Label('preview')); - - + + $brids = \App\ACL::getBranchIDsConstraint(); - if(strlen($brids)>0) { - $this->br = " and documents_view.branch_id in ({$brids}) "; + if (strlen($brids) > 0) { + $this->br = " and documents_view.branch_id in ({$brids}) "; } - + } public function OnSubmit($sender) { @@ -156,7 +156,7 @@ private function find1() { )t ORDER BY value DESC"; - + $rs = $conn->Execute($sql); foreach ($rs as $row) { $row['value'] = round($row['value']); @@ -273,7 +273,6 @@ private function find5() { //выполняет расчет АВС private function calc($detail) { - $sum = 0; $_detail = array(); diff --git a/www/app/pages/report/income.php b/www/app/pages/report/income.php index 85f64da59..abf97d37c 100644 --- a/www/app/pages/report/income.php +++ b/www/app/pages/report/income.php @@ -79,11 +79,11 @@ private function generateReport() { $from = $this->filter->from->getDate(); $to = $this->filter->to->getDate(); - - $br=""; + + $br = ""; $brids = \App\ACL::getBranchIDsConstraint(); - if(strlen($brids)>0) { - $br = " and d.branch_id in ({$brids}) "; + if (strlen($brids) > 0) { + $br = " and d.branch_id in ({$brids}) "; } $detail = array(); diff --git a/www/app/pages/report/outcome.php b/www/app/pages/report/outcome.php index 36b4d1d3c..f6ad77cec 100644 --- a/www/app/pages/report/outcome.php +++ b/www/app/pages/report/outcome.php @@ -29,22 +29,22 @@ public function __construct() { $this->filter->add(new DropDownChoice('emp', \App\Entity\User::findArray('username', "user_id in (select user_id from documents_view where meta_name in('GoodsIssue','ServiceAct','Task','Order','POSCheck'))", 'username'), 0)); $this->filter->add(new DropDownChoice('cat', \App\Entity\Category::findArray('cat_name', "", 'cat_name'), 0))->setVisible(false); $hlist = \App\Entity\Customer::getHoldList(); - // $this->filter->add(new DropDownChoice('holding', $hlist, 0))->setVisible(false); - - - $types=array(); - $types[1]= H::l('repbyitems') ; - $types[6]= H::l('repbybyersitem') ; - $types[2]= H::l('repbybyers') ; - $types[3]= H::l('repbydates') ; - $types[4]= H::l('repbyservices') ; - $types[7]= H::l('repbybyersservices') ; - $types[5]= H::l('repbycat') ; - if(count($hlist)>0){ - $types[8]= H::l('repbyhold') ; + // $this->filter->add(new DropDownChoice('holding', $hlist, 0))->setVisible(false); + + + $types = array(); + $types[1] = H::l('repbyitems'); + $types[6] = H::l('repbybyersitem'); + $types[2] = H::l('repbybyers'); + $types[3] = H::l('repbydates'); + $types[4] = H::l('repbyservices'); + $types[7] = H::l('repbybyersservices'); + $types[5] = H::l('repbycat'); + if (count($hlist) > 0) { + $types[8] = H::l('repbyhold'); } - - + + $this->filter->add(new DropDownChoice('type', $types, 1))->onChange($this, "OnType"); $this->filter->add(new \Zippy\Html\Form\AutocompleteTextInput('cust'))->onText($this, 'OnAutoCustomer'); @@ -63,8 +63,8 @@ public function OnType($sender) { $this->filter->cat->setValue(0); $this->filter->cat->setVisible($type == 5); - $this->filter->cust->setVisible($type == 6 || $type==7); - // $this->filter->holding->setVisible($type == 7); + $this->filter->cust->setVisible($type == 6 || $type == 7); + // $this->filter->holding->setVisible($type == 7); } public function OnAutoItem($sender) { @@ -112,7 +112,7 @@ private function generateReport() { $type = $this->filter->type->getValue(); $user = $this->filter->emp->getValue(); $cat_id = $this->filter->cat->getValue(); - // $hold_id = $this->filter->holding->getValue(); + // $hold_id = $this->filter->holding->getValue(); $cust_id = $this->filter->cust->getKey(); $from = $this->filter->from->getDate(); @@ -124,10 +124,10 @@ private function generateReport() { if ($user > 0) { $u = " and d.user_id={$user} "; } - $br=""; + $br = ""; $brids = \App\ACL::getBranchIDsConstraint(); - if(strlen($brids)>0) { - $br = " and d.branch_id in ({$brids}) "; + if (strlen($brids) > 0) { + $br = " and d.branch_id in ({$brids}) "; } $detail = array(); @@ -137,24 +137,23 @@ private function generateReport() { $cat = " and cat_id=" . $cat_id; } $cust = ""; - - - - if (($type == 6 || $type==7 ) && $cust_id > 0) { + + + if (($type == 6 || $type == 7) && $cust_id > 0) { $cust = " and d.customer_id=" . $cust_id; $c = \App\Entity\Customer::load($cust_id); - if($c->isholding==1) { - $list = \App\Entity\Customer::find("detail like '%{$cust_id}%' "); - $ids= array_keys($list) ; - if(count($ids) >0) { - $cust = " and d.customer_id in(". implode(',',$ids) ." )" ; - } - - - } + if ($c->isholding == 1) { + $list = \App\Entity\Customer::find("detail like '%{$cust_id}%' "); + $ids = array_keys($list); + if (count($ids) > 0) { + $cust = " and d.customer_id in(" . implode(',', $ids) . " )"; + } + + + } } - $sql=''; + $sql = ''; if ($type == 1 || $type == 6 || strlen($cat) > 0) { //по товарам $sql = " select i.`itemname`,i.`item_code`,sum(0-e.`quantity`) as qty, sum(0-e.`amount`) as summa, sum(e.extcode*(0-e.`quantity`)) as navar @@ -234,23 +233,22 @@ private function generateReport() { order by i.`cat_name` "; } - - - if ($type == 8) { //по холдингам - $sql=''; + + + if ($type == 8) { //по холдингам + $sql = ''; $rs = array(); - - $hlist = \App\Entity\Customer::getHoldList() ; - foreach($hlist as $id=>$name) { - $custlist='0'; - $list = \App\Entity\Customer::find("detail like '%{$id}%' "); - $ids= array_keys($list) ; - if(count($ids) >0) { - $custlist = implode(',',$ids) ; - } - - - + + $hlist = \App\Entity\Customer::getHoldList(); + foreach ($hlist as $id => $name) { + $custlist = '0'; + $list = \App\Entity\Customer::find("detail like '%{$id}%' "); + $ids = array_keys($list); + if (count($ids) > 0) { + $custlist = implode(',', $ids); + } + + $sqlc = " select coalesce(sum(0-e.`amount`) ,0) as summa, sum(e.extcode*(0-e.`quantity`)) as navar from `entrylist_view` e @@ -263,27 +261,26 @@ private function generateReport() { AND DATE(e.document_date) <= " . $conn->DBDate($to) . " and d.customer_id in({$custlist}) "; - - $row = $conn->GetRow($sqlc); - if($row['summa']<>0) { - $row['itemname'] = $name ; - $rs[]=$row; - } - - - + + $row = $conn->GetRow($sqlc); + if ($row['summa'] <> 0) { + $row['itemname'] = $name; + $rs[] = $row; + } + + } - + } - - + + $totsum = 0; $totnavar = 0; - - if(strlen($sql) > 0) { + + if (strlen($sql) > 0) { $rs = $conn->Execute($sql); } - + foreach ($rs as $row) { $detail[] = array( "code" => $row['item_code'], @@ -315,7 +312,7 @@ private function generateReport() { $header['_type4'] = false; $header['_type5'] = false; } - if ($type == 2 || $type==8) { + if ($type == 2 || $type == 8) { $header['_type1'] = false; $header['_type2'] = true; $header['_type3'] = false; @@ -329,7 +326,7 @@ private function generateReport() { $header['_type4'] = false; $header['_type5'] = false; } - if ($type == 4 || $type == 7) { + if ($type == 4 || $type == 7) { $header['_type1'] = false; $header['_type2'] = false; $header['_type3'] = false; diff --git a/www/app/pages/report/paybalance.php b/www/app/pages/report/paybalance.php index f6ab21e6e..21479d3fb 100644 --- a/www/app/pages/report/paybalance.php +++ b/www/app/pages/report/paybalance.php @@ -78,24 +78,23 @@ private function generateReport() { $detail = array(); $detail2 = array(); - // $cstr = \App\Acl::getMFBranchConstraint(); - // if (strlen($cstr) > 0) { - // $cstr = " mf_id in ({$cstr}) and "; - // } - - - $brpay=""; - $brst=""; + // $cstr = \App\Acl::getMFBranchConstraint(); + // if (strlen($cstr) > 0) { + // $cstr = " mf_id in ({$cstr}) and "; + // } + + + $brpay = ""; + $brst = ""; $brids = \App\ACL::getBranchIDsConstraint(); - if(strlen($brids)>0) { - $brst = " and store_id in( select store_id from stores where branch_id in ({$brids}) ) "; - - $brpay = " and document_id in(select document_id from documents where branch_id in ({$brids}) )"; + if (strlen($brids) > 0) { + $brst = " and store_id in( select store_id from stores where branch_id in ({$brids}) ) "; + + $brpay = " and document_id in(select document_id from documents where branch_id in ({$brids}) )"; } - - - - $pl = Pay::getPayTypeList(); + + + $pl = Pay::getPayTypeList(); $conn = \ZDB\DB::getConnect(); @@ -155,7 +154,7 @@ private function generateReport() { $sql = " SELECT coalesce(sum(abs(amount)),0) as am FROM paylist WHERE - paytype = ".Pay::PAY_BASE_OUTCOME ." {$brpay} + paytype = " . Pay::PAY_BASE_OUTCOME . " {$brpay} AND paydate >= " . $conn->DBDate($from) . " AND paydate <= " . $conn->DBDate($to) . " @@ -163,19 +162,19 @@ private function generateReport() { "; $OPOUT = $conn->GetOne($sql); // переменные расходы - - $sql = " + + $sql = " SELECT coalesce( sum(abs(amount)),0) as am FROM paylist WHERE - paytype = ".Pay::PAY_BASE_INCOME ." {$brpay} + paytype = " . Pay::PAY_BASE_INCOME . " {$brpay} AND paydate >= " . $conn->DBDate($from) . " AND paydate <= " . $conn->DBDate($to) . " "; - $OPIN = $conn->GetOne($sql); // операционный доход - + $OPIN = $conn->GetOne($sql); // операционный доход + $header['tu'] = H::fa($OPIN - $OPOUT); //проход $header['tvc'] = H::fa($OPOUT); //переменные затраты $header['OP'] = H::fa($tout - $OPOUT); //операционные расходы diff --git a/www/app/pages/service/armpos.php b/www/app/pages/service/armpos.php index 0df9e7920..50deb3e06 100644 --- a/www/app/pages/service/armpos.php +++ b/www/app/pages/service/armpos.php @@ -32,6 +32,10 @@ class ARMPos extends \App\Pages\Base private $pos; private $_doc = null; + + private $_pt = 0; + private $_store_id = 0; + public function __construct() { parent::__construct(); @@ -42,20 +46,18 @@ public function __construct() { //обшие настройки $this->add(new Form('form1')); - $plist = \App\Entity\Pos::findArray('pos_name'); - $cc = $_COOKIE['posterminal'] > 0 ? $_COOKIE['posterminal'] : 0; - if (System::getUser()->rolename != 'admins') { - $plist = \App\Entity\Pos::findArray('pos_name', 'pos_id=' . $cc); - } - $this->form1->add(new DropDownChoice('pos', $plist, $cc)); - $this->form1->add(new DropDownChoice('firm', \App\Entity\Firm::getList(), 0)); - + $plist = \App\Entity\Pos::findArray('pos_name', ''); + + $this->form1->add(new DropDownChoice('pos', $plist, 0)); + $this->form1->add(new DropDownChoice('store', \App\Entity\Store::getList(), H::getDefStore())); + $this->form1->add(new DropDownChoice('pricetype', \App\Entity\Item::getPriceTypeList(), H::getDefPriceType())); + $this->form1->add(new SubmitButton('next1'))->onClick($this, 'next1docOnClick'); $this->add(new Form('form2'))->setVisible(false); // ввод товаров - + $this->form2->add(new SubmitButton('next2'))->onClick($this, 'next2docOnClick'); $this->form2->add(new TextInput('barcode')); $this->form2->add(new SubmitLink('addcode'))->onClick($this, 'addcodeOnClick'); @@ -68,12 +70,12 @@ public function __construct() { $this->form2->add(new DataView('detailser', new \Zippy\Html\DataList\ArrayDataSource(new \Zippy\Binding\PropertyBinding($this, '_serlist')), $this, 'serOnRow')); $this->form2->add(new ClickLink('openshift', $this, 'OnOpenShift')); $this->form2->add(new ClickLink('closeshift', $this, 'OnCloseShift')); - //оплата $this->add(new Form('form3'))->setVisible(false); - $this->form3->add(new DropDownChoice('payment'))->onChange($this, 'OnPayment'); + $this->form3->add(new DropDownChoice('payment', \App\Entity\MoneyFund::getList(true, true), H::getDefMF()))->onChange($this, 'OnPayment'); + $this->form3->add(new TextInput('document_number')); $this->form3->add(new Date('document_date'))->setDate(time()); @@ -131,23 +133,22 @@ public function __construct() { $this->editcust->add(new TextInput('editphone')); $this->editcust->add(new Button('cancelcust'))->onClick($this, 'cancelcustOnClick'); $this->editcust->add(new SubmitButton('savecust'))->onClick($this, 'savecustOnClick'); - - /* - //Закрытие смены - $this->add(new Form('zform'))->setVisible(false); - $this->zform->add(new TextInput('zformqnt')); - $this->zform->add(new TextInput('zformnal')); - $this->zform->add(new TextInput('zformbnal')); - $this->zform->add(new TextInput('zformcredit')); - $this->zform->add(new TextInput('zformprepaid')); - $this->zform->add(new TextInput('zformtotal')); - $this->zform->add(new Button('cancelzform'))->onClick($this, 'cancelzformOnClick'); - $this->zform->add(new SubmitButton('savezform'))->onClick($this, 'savezformOnClick'); - - */ - } - - + + /* + //Закрытие смены + $this->add(new Form('zform'))->setVisible(false); + $this->zform->add(new TextInput('zformqnt')); + $this->zform->add(new TextInput('zformnal')); + $this->zform->add(new TextInput('zformbnal')); + $this->zform->add(new TextInput('zformcredit')); + $this->zform->add(new TextInput('zformprepaid')); + $this->zform->add(new TextInput('zformtotal')); + $this->zform->add(new Button('cancelzform'))->onClick($this, 'cancelzformOnClick'); + $this->zform->add(new SubmitButton('savezform'))->onClick($this, 'savezformOnClick'); + + */ + } + public function cancel2docOnClick($sender) { @@ -164,17 +165,23 @@ public function cancel3docOnClick($sender) { public function next1docOnClick($sender) { $this->pos = \App\Entity\Pos::load($this->form1->pos->getValue()); + $this->_store_id = $this->form1->store->getValue(); + $this->_pt = $this->form1->pricetype->getValue(); if ($this->pos == null) { $this->setError("noselterm"); return; } - setcookie("posterminal", $this->pos->pos_id, time() + 60 * 60 * 24 * 30); - $mf = \App\Entity\MoneyFund::Load($this->pos->mf); + if ($this->_store_id == 0) { + $this->setError("noselstore"); + return; + } - $this->form3->payment->setOptionList(array($mf->mf_id => $mf->mf_name, \App\Entity\MoneyFund::PREPAID => 'Была предоплата', \App\Entity\MoneyFund::CREDIT => 'В кредит')); - $this->form3->payment->setValue($mf->mf_id); + if (strlen($this->_pt) == 0) { + $this->setError("noselpricetype"); + return; + } $this->form1->setVisible(false); $this->form2->setVisible(true); @@ -631,13 +638,12 @@ public function savedocOnClick($sender) { $this->_doc->headerdata['pos'] = $this->pos->pos_id; $this->_doc->headerdata['pos_name'] = $this->pos->pos_name; - $this->_doc->headerdata['store'] = $this->pos->store; - $this->_doc->headerdata['pricetype'] = $this->pos->pricetype; - // $this->_doc->headerdata['pricetypename'] = $this->form1->pricetype->getValueName(); + $this->_doc->headerdata['store'] = $this->_store_id; + $this->_doc->headerdata['pricetype'] = $this->_pt; - $this->_doc->headerdata['firm_id'] = $this->form1->firm->getValue(); + $this->_doc->firm_id = $this->pos->firm_id; - $firm = H::getFirmData($this->_doc->headerdata["firm_id"], $this->branch_id); + $firm = H::getFirmData($this->_doc->firm_id); $this->_doc->headerdata["firm_name"] = $firm['firm_name']; $this->_doc->headerdata["inn"] = $firm['inn']; $this->_doc->headerdata["address"] = $firm['address']; @@ -665,38 +671,37 @@ public function savedocOnClick($sender) { } } - if($this->pos->usefisc==1) { - - - $ret = \App\Modules\PPO\PPOHelper::check($this->_doc); - if($ret['success'] == false && $ret['docnumber']>0) { + if ($this->pos->usefisc == 1) { + + + $ret = \App\Modules\PPO\PPOHelper::check($this->_doc); + if ($ret['success'] == false && $ret['docnumber'] > 0) { //повторяем для нового номера $this->pos->fiscdocnumber = $ret['docnumber']; - $this->pos->save(); - $ret = \App\Modules\PPO\PPOHelper::check($this->_doc); - + $this->pos->save(); + $ret = \App\Modules\PPO\PPOHelper::check($this->_doc); + } - if($ret['success'] == false ) { + if ($ret['success'] == false) { $this->setError($ret['data']); return; } else { - // $this->setSuccess("Выполнено") ; - if($ret['docnumber'] >0) { - $this->pos->fiscdocnumber = $ret['doclocnumber']+1; - $this->pos->save(); - $this->_doc->headerdata["fiscalnumber"] = $ret['docnumber'] ; - } else { - $this->setError("ppo_noretnumber" ); - return; - - } - - } - - } - - - + // $this->setSuccess("Выполнено") ; + if ($ret['docnumber'] > 0) { + $this->pos->fiscdocnumber = $ret['doclocnumber'] + 1; + $this->pos->save(); + $this->_doc->headerdata["fiscalnumber"] = $ret['docnumber']; + } else { + $this->setError("ppo_noretnumber"); + return; + + } + + } + + } + + $this->_doc->save(); $this->_doc->updateStatus(Document::STATE_NEW); @@ -732,110 +737,117 @@ public function OnPayment($sender) { $this->form3->exchange->setVisible(true); } } - - - public function OnOpenShift(){ - $ret = \App\Modules\PPO\PPOHelper::shift($this->form1->firm->getValue(),$this->pos->pos_id,true); - if($ret['success'] == false && $ret['docnumber']>0) { - //повторяем для нового номера - $this->pos->fiscdocnumber = $ret['docnumber']; - $this->pos->save(); - $ret = \App\Modules\PPO\PPOHelper::shift($this->form1->firm->getValue(), $this->pos->pos_id,true); - - - } - if($ret['success'] == false ) { - $this->setError($ret['data']); - return false; + + + public function OnOpenShift() { + $ret = \App\Modules\PPO\PPOHelper::shift($this->pos->pos_id, true); + if ($ret['success'] == false && $ret['docnumber'] > 0) { + //повторяем для нового номера + $this->pos->fiscdocnumber = $ret['docnumber']; + $this->pos->save(); + $ret = \App\Modules\PPO\PPOHelper::shift($this->pos->pos_id, true); + + + } + if ($ret['success'] == false) { + $this->setError($ret['data']); + return false; + } else { + $this->setSuccess("ppo_shiftopened"); + if ($ret['docnumber'] > 0) { + $this->pos->fiscdocnumber = $ret['doclocnumber'] + 1; + $this->pos->save(); + $this->_doc->headerdata["fiscalnumber"] = $ret['docnumber']; + } else { - $this->setSuccess("ppo_shiftopened") ; - if($ret['docnumber'] >0) { - $this->pos->fiscdocnumber = $ret['doclocnumber']+1; - $this->pos->save(); - $this->_doc->headerdata["fiscalnumber"] = $ret['docnumber'] ; - - } else { - $this->setError("ppo_noretnumber"); - return; - - } - \App\Modules\PPO\PPOHelper::clearStat($this->pos->pos_id) ; - } - - - $this->pos->save(); - return true; + $this->setError("ppo_noretnumber"); + return; + + } + \App\Modules\PPO\PPOHelper::clearStat($this->pos->pos_id); + + } + + + $this->pos->save(); + return true; } - - public function OnCloseShift($sender){ + + public function OnCloseShift($sender) { $ret = $this->zform(); - if($ret==true)$this->closeshift();; + if ($ret == true) { + $this->closeshift(); + }; } - - - public function zform(){ - $ret = \App\Modules\PPO\PPOHelper::zform($this->form1->firm->getValue(), $this->pos->pos_id ); - if(strpos($ret['data'],'ZRepAlreadyRegistered')) { - return true; + + + public function zform() { + + $stat = \App\Modules\PPO\PPOHelper::getStat($this->pos->pos_id); + $rstat = \App\Modules\PPO\PPOHelper::getStat($this->pos->pos_id, true); + + $ret = \App\Modules\PPO\PPOHelper::zform($this->pos->pos_id, $stat, $rstat); + if (strpos($ret['data'], 'ZRepAlreadyRegistered')) { + return true; } - if($ret['success'] == false && $ret['docnumber']>0) { + if ($ret['success'] == false && $ret['docnumber'] > 0) { //повторяем для нового номера $this->pos->fiscdocnumber = $ret['docnumber']; - $this->pos->save(); - $ret = \App\Modules\PPO\PPOHelper::zform($this->form1->firm->getValue(), $this->pos->pos_id ); - + $this->pos->save(); + $ret = \App\Modules\PPO\PPOHelper::zform($this->pos->pos_id, $stat, $rstat); + - } - if($ret['success'] == false ) { + } + if ($ret['success'] == false) { $this->setError($ret['data']); - return false; + return false; } else { - - if($ret['docnumber'] >0) { - $this->pos->fiscdocnumber = $ret['doclocnumber']+1; - $this->pos->save(); - } else { - $this->setError("ppo_noretnumber"); - return; - + + if ($ret['docnumber'] > 0) { + $this->pos->fiscdocnumber = $ret['doclocnumber'] + 1; + $this->pos->save(); + } else { + $this->setError("ppo_noretnumber"); + return; + } - - } - - - return true; - } - - - public function closeshift(){ - $ret = \App\Modules\PPO\PPOHelper::shift($this->form1->firm->getValue(), $this->pos->pos_id,false ); - if($ret['success'] == false && $ret['docnumber']>0) { - //повторяем для нового номера - $this->pos->fiscdocnumber = $ret['docnumber']; - $this->pos->save(); - $ret = \App\Modules\PPO\PPOHelper::shift($this->form1->firm->getValue(), $this->pos->pos_id,false ); - - - } - if($ret['success'] == false ) { - $this->setError($ret['data']); - return false; + + } + + + return true; + } + + + public function closeshift() { + $ret = \App\Modules\PPO\PPOHelper::shift($this->pos->pos_id, false); + if ($ret['success'] == false && $ret['docnumber'] > 0) { + //повторяем для нового номера + $this->pos->fiscdocnumber = $ret['docnumber']; + $this->pos->save(); + $ret = \App\Modules\PPO\PPOHelper::shift($this->pos->pos_id, false); + + + } + if ($ret['success'] == false) { + $this->setError($ret['data']); + return false; + } else { + $this->setSuccess("ppo_shiftclosed"); + if ($ret['docnumber'] > 0) { + $this->pos->fiscdocnumber = $ret['doclocnumber'] + 1; + $this->pos->save(); } else { - $this->setSuccess("ppo_shiftclosed") ; - if($ret['docnumber'] >0) { - $this->pos->fiscdocnumber = $ret['doclocnumber']+1; - $this->pos->save(); - } else { - $this->setError("ppo_noretnumber"); - return; - - } - \App\Modules\PPO\PPOHelper::clearStat($this->pos->pos_id) ; - } - - - return true; + $this->setError("ppo_noretnumber"); + return; + + } + \App\Modules\PPO\PPOHelper::clearStat($this->pos->pos_id); + } + + + return true; } - + } diff --git a/www/app/pages/service/export.php b/www/app/pages/service/export.php index 4034296f1..d87d7c6a6 100644 --- a/www/app/pages/service/export.php +++ b/www/app/pages/service/export.php @@ -16,7 +16,11 @@ use Zippy\Html\DataList\DataView; use Zippy\Html\Form\CheckBox; use Zippy\Html\Label; - +use PhpOffice\PhpSpreadsheet\IOFactory; +use PhpOffice\PhpSpreadsheet\Writer\Xlsx; +use PhpOffice\PhpSpreadsheet\Spreadsheet; +use PhpOffice\PhpSpreadsheet\Style\{Font, Border, Alignment}; + class Export extends \App\Pages\Base { public $_docs = array(); @@ -26,7 +30,74 @@ public function __construct() { if (false == \App\ACL::checkShowSer('Export')) { return; } - + /* +$spreadsheet = new Spreadsheet(); +//Получаем текущий активный лист +$sheet = $spreadsheet->getActiveSheet(); +// Записываем в ячейку A1 данные +$sheet->setCellValue('A1', 'Тест'); +$sheet->getStyle('A1')->applyFromArray([ + 'font' => [ + 'name' => 'Arial', + 'bold' => true, + 'italic' => false, + 'underline' => Font::UNDERLINE_DOUBLE, + 'strikethrough' => false, + 'color' => [ + 'rgb' => '808080' + ] + ], + 'borders' => [ + 'allBorders' => [ + 'borderStyle' => Border::BORDER_THIN, + 'color' => [ + 'rgb' => '808080' + ] + ], + ], + 'alignment' => [ + 'horizontal' => Alignment::HORIZONTAL_CENTER, + 'vertical' => Alignment::VERTICAL_CENTER, + 'wrapText' => true, + ] +]); +$writer = new Xlsx($spreadsheet); +//Сохраняем файл в текущей папке, в которой выполняется скрипт. +//Чтобы указать другую папку для сохранения. +//Прописываем полный путь до папки и указываем имя файла + + + + + + header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); + header('Content-Disposition: attachment; filename="test.xlsx"'); + $writer->save('php://output'); + + + $sNewFile = 'c:/Users/leonm/Downloads/items_2020_12_28.csv'; + + $oSpreadsheet = IOFactory::load($sNewFile); // Вариант и для xls и xlsX + + + $oCells = $oSpreadsheet->getActiveSheet()->getCellCollection(); + + for ($iRow = 1; $iRow <= $oCells->getHighestRow(); $iRow++) + { + + for ($iCol = 'A'; $iCol <= $oCells->getHighestColumn(); $iCol++) + { + $oCell = $oCells->get($iCol.$iRow); + if($oCell) + { + echo $oCell->getValue() . '
'; + } + } + echo '
'; + } + + */ + $form = $this->add(new Form("iform")); $form->add(new DropDownChoice("itype", array(), 0))->onChange($this, "onType"); diff --git a/www/app/pages/showreport.php b/www/app/pages/showreport.php index 710494dac..b4decd05d 100644 --- a/www/app/pages/showreport.php +++ b/www/app/pages/showreport.php @@ -13,8 +13,8 @@ public function __construct($type, $filename) { if ($user->user_id == 0) { die; } - - $filename = $filename. date('_Y_m_d') ; + + $filename = $filename . date('_Y_m_d'); $html = \App\Session::getSession()->printform; if ($type == "preview") { diff --git a/www/app/pages/userlogin.php b/www/app/pages/userlogin.php index 05773820f..00642807c 100644 --- a/www/app/pages/userlogin.php +++ b/www/app/pages/userlogin.php @@ -18,7 +18,7 @@ public function __construct() { $common = System::getOptions('common'); - + $form = new \Zippy\Html\Form\Form('loginform'); $form->add(new TextInput('userlogin')); $form->add(new TextInput('userpassword')); diff --git a/www/app/thumb.php b/www/app/thumb.php index 36d4f5d58..8e4f9a2b9 100644 --- a/www/app/thumb.php +++ b/www/app/thumb.php @@ -1,15 +1,14 @@ options = array(); parent::__construct($fileName, $options); - } + } } diff --git a/www/app/util.php b/www/app/util.php index d63d91d63..0f7e82ddf 100644 --- a/www/app/util.php +++ b/www/app/util.php @@ -11,9 +11,9 @@ class Util { /** - * генерация GUID - * - */ + * генерация GUID + * + */ public static function guid() { if (function_exists('com_create_guid') === true) { @@ -25,9 +25,9 @@ public static function guid() { $data[8] = chr(ord($data[8]) & 0x3f | 0x80); // set bits 6-7 to 10 return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4)); - } - - + } + + /** * возвращает первые буквы */ diff --git a/www/app/widgets/wrdoc.php b/www/app/widgets/wrdoc.php index 90c6eb647..5a649ead1 100644 --- a/www/app/widgets/wrdoc.php +++ b/www/app/widgets/wrdoc.php @@ -52,7 +52,7 @@ public function __construct($id) { public function doclistOnRow($row) { $item = $row->getDataItem(); - + $row->add(new Label('wrd_date', \App\Helper::fd(strtotime($item->document_date)))); $row->add(new Label('wrd_type', $item->meta_desc)); $row->add(new Label('wrd_amount', Helper::fa($item->amount))); diff --git a/www/composer.json b/www/composer.json index b578d2fff..2c0273366 100644 --- a/www/composer.json +++ b/www/composer.json @@ -21,7 +21,7 @@ "masterexploder/phpthumb" :"*", "lemmon/fetch" :"v0.3.0", "lis-dev/nova-poshta-api-2" :"0.1.6", - + "phpoffice/phpspreadsheet" :"^1.15.0", "automattic/woocommerce": "3.0.0", "symfony/polyfill-mbstring": "^1.10", diff --git a/www/composer.lock b/www/composer.lock index e4bb9f82e..3cdd69768 100644 --- a/www/composer.lock +++ b/www/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "1e1239b0590bc5ef05b05d7e4a437270", + "content-hash": "0ea9d0ee3cec55c929179004aa7028b8", "packages": [ { "name": "adodb/adodb-php", @@ -686,6 +686,250 @@ }, "time": "2020-12-09T13:43:16+00:00" }, + { + "name": "maennchen/zipstream-php", + "version": "2.1.0", + "source": { + "type": "git", + "url": "https://github.com/maennchen/ZipStream-PHP.git", + "reference": "c4c5803cc1f93df3d2448478ef79394a5981cc58" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/maennchen/ZipStream-PHP/zipball/c4c5803cc1f93df3d2448478ef79394a5981cc58", + "reference": "c4c5803cc1f93df3d2448478ef79394a5981cc58", + "shasum": "" + }, + "require": { + "myclabs/php-enum": "^1.5", + "php": ">= 7.1", + "psr/http-message": "^1.0", + "symfony/polyfill-mbstring": "^1.0" + }, + "require-dev": { + "ext-zip": "*", + "guzzlehttp/guzzle": ">= 6.3", + "mikey179/vfsstream": "^1.6", + "phpunit/phpunit": ">= 7.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "ZipStream\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Paul Duncan", + "email": "pabs@pablotron.org" + }, + { + "name": "Jonatan Männchen", + "email": "jonatan@maennchen.ch" + }, + { + "name": "Jesse Donat", + "email": "donatj@gmail.com" + }, + { + "name": "András Kolesár", + "email": "kolesar@kolesar.hu" + } + ], + "description": "ZipStream is a library for dynamically streaming dynamic zip files from PHP without writing to the disk at all on the server.", + "keywords": [ + "stream", + "zip" + ], + "support": { + "issues": "https://github.com/maennchen/ZipStream-PHP/issues", + "source": "https://github.com/maennchen/ZipStream-PHP/tree/master" + }, + "funding": [ + { + "url": "https://opencollective.com/zipstream", + "type": "open_collective" + } + ], + "time": "2020-05-30T13:11:16+00:00" + }, + { + "name": "markbaker/complex", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/MarkBaker/PHPComplex.git", + "reference": "9999f1432fae467bc93c53f357105b4c31bb994c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/MarkBaker/PHPComplex/zipball/9999f1432fae467bc93c53f357105b4c31bb994c", + "reference": "9999f1432fae467bc93c53f357105b4c31bb994c", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", + "phpcompatibility/php-compatibility": "^9.0", + "phpdocumentor/phpdocumentor": "2.*", + "phploc/phploc": "^4.0", + "phpmd/phpmd": "2.*", + "phpunit/phpunit": "^7.0 || ^8.0 || ^9.3", + "sebastian/phpcpd": "^4.0", + "squizlabs/php_codesniffer": "^3.4" + }, + "type": "library", + "autoload": { + "psr-4": { + "Complex\\": "classes/src/" + }, + "files": [ + "classes/src/functions/abs.php", + "classes/src/functions/acos.php", + "classes/src/functions/acosh.php", + "classes/src/functions/acot.php", + "classes/src/functions/acoth.php", + "classes/src/functions/acsc.php", + "classes/src/functions/acsch.php", + "classes/src/functions/argument.php", + "classes/src/functions/asec.php", + "classes/src/functions/asech.php", + "classes/src/functions/asin.php", + "classes/src/functions/asinh.php", + "classes/src/functions/atan.php", + "classes/src/functions/atanh.php", + "classes/src/functions/conjugate.php", + "classes/src/functions/cos.php", + "classes/src/functions/cosh.php", + "classes/src/functions/cot.php", + "classes/src/functions/coth.php", + "classes/src/functions/csc.php", + "classes/src/functions/csch.php", + "classes/src/functions/exp.php", + "classes/src/functions/inverse.php", + "classes/src/functions/ln.php", + "classes/src/functions/log2.php", + "classes/src/functions/log10.php", + "classes/src/functions/negative.php", + "classes/src/functions/pow.php", + "classes/src/functions/rho.php", + "classes/src/functions/sec.php", + "classes/src/functions/sech.php", + "classes/src/functions/sin.php", + "classes/src/functions/sinh.php", + "classes/src/functions/sqrt.php", + "classes/src/functions/tan.php", + "classes/src/functions/tanh.php", + "classes/src/functions/theta.php", + "classes/src/operations/add.php", + "classes/src/operations/subtract.php", + "classes/src/operations/multiply.php", + "classes/src/operations/divideby.php", + "classes/src/operations/divideinto.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mark Baker", + "email": "mark@lange.demon.co.uk" + } + ], + "description": "PHP Class for working with complex numbers", + "homepage": "https://github.com/MarkBaker/PHPComplex", + "keywords": [ + "complex", + "mathematics" + ], + "support": { + "issues": "https://github.com/MarkBaker/PHPComplex/issues", + "source": "https://github.com/MarkBaker/PHPComplex/tree/PHP8" + }, + "time": "2020-08-26T10:42:07+00:00" + }, + { + "name": "markbaker/matrix", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/MarkBaker/PHPMatrix.git", + "reference": "9567d9c4c519fbe40de01dbd1e4469dbbb66f46a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/MarkBaker/PHPMatrix/zipball/9567d9c4c519fbe40de01dbd1e4469dbbb66f46a", + "reference": "9567d9c4c519fbe40de01dbd1e4469dbbb66f46a", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", + "phpcompatibility/php-compatibility": "^9.0", + "phpdocumentor/phpdocumentor": "2.*", + "phploc/phploc": "^4.0", + "phpmd/phpmd": "2.*", + "phpunit/phpunit": "^7.0 || ^8.0 || ^9.3", + "sebastian/phpcpd": "^4.0", + "squizlabs/php_codesniffer": "^3.4" + }, + "type": "library", + "autoload": { + "psr-4": { + "Matrix\\": "classes/src/" + }, + "files": [ + "classes/src/functions/adjoint.php", + "classes/src/functions/antidiagonal.php", + "classes/src/functions/cofactors.php", + "classes/src/functions/determinant.php", + "classes/src/functions/diagonal.php", + "classes/src/functions/identity.php", + "classes/src/functions/inverse.php", + "classes/src/functions/minors.php", + "classes/src/functions/trace.php", + "classes/src/functions/transpose.php", + "classes/src/operations/add.php", + "classes/src/operations/directsum.php", + "classes/src/operations/subtract.php", + "classes/src/operations/multiply.php", + "classes/src/operations/divideby.php", + "classes/src/operations/divideinto.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mark Baker", + "email": "mark@demon-angel.eu" + } + ], + "description": "PHP Class for working with matrices", + "homepage": "https://github.com/MarkBaker/PHPMatrix", + "keywords": [ + "mathematics", + "matrix", + "vector" + ], + "support": { + "issues": "https://github.com/MarkBaker/PHPMatrix/issues", + "source": "https://github.com/MarkBaker/PHPMatrix/tree/PHP8" + }, + "time": "2020-08-28T17:11:00+00:00" + }, { "name": "masterexploder/phpthumb", "version": "2.1", @@ -878,6 +1122,66 @@ }, "time": "2019-11-23T21:40:31+00:00" }, + { + "name": "myclabs/php-enum", + "version": "1.7.7", + "source": { + "type": "git", + "url": "https://github.com/myclabs/php-enum.git", + "reference": "d178027d1e679832db9f38248fcc7200647dc2b7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/myclabs/php-enum/zipball/d178027d1e679832db9f38248fcc7200647dc2b7", + "reference": "d178027d1e679832db9f38248fcc7200647dc2b7", + "shasum": "" + }, + "require": { + "ext-json": "*", + "php": ">=7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7", + "squizlabs/php_codesniffer": "1.*", + "vimeo/psalm": "^3.8" + }, + "type": "library", + "autoload": { + "psr-4": { + "MyCLabs\\Enum\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP Enum contributors", + "homepage": "https://github.com/myclabs/php-enum/graphs/contributors" + } + ], + "description": "PHP Enum implementation", + "homepage": "http://github.com/myclabs/php-enum", + "keywords": [ + "enum" + ], + "support": { + "issues": "https://github.com/myclabs/php-enum/issues", + "source": "https://github.com/myclabs/php-enum/tree/1.7.7" + }, + "funding": [ + { + "url": "https://github.com/mnapoli", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/myclabs/php-enum", + "type": "tidelift" + } + ], + "time": "2020-11-14T18:14:52+00:00" + }, { "name": "nesbot/carbon", "version": "2.32.2", @@ -1124,6 +1428,106 @@ ], "time": "2020-11-25T15:24:57+00:00" }, + { + "name": "phpoffice/phpspreadsheet", + "version": "1.15.0", + "source": { + "type": "git", + "url": "https://github.com/PHPOffice/PhpSpreadsheet.git", + "reference": "a8e8068b31b8119e1daa5b1eb5715a3a8ea8305f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPOffice/PhpSpreadsheet/zipball/a8e8068b31b8119e1daa5b1eb5715a3a8ea8305f", + "reference": "a8e8068b31b8119e1daa5b1eb5715a3a8ea8305f", + "shasum": "" + }, + "require": { + "ext-ctype": "*", + "ext-dom": "*", + "ext-fileinfo": "*", + "ext-gd": "*", + "ext-iconv": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-simplexml": "*", + "ext-xml": "*", + "ext-xmlreader": "*", + "ext-xmlwriter": "*", + "ext-zip": "*", + "ext-zlib": "*", + "maennchen/zipstream-php": "^2.1", + "markbaker/complex": "^1.5|^2.0", + "markbaker/matrix": "^1.2|^2.0", + "php": "^7.2|^8.0", + "psr/http-client": "^1.0", + "psr/http-factory": "^1.0", + "psr/simple-cache": "^1.0" + }, + "require-dev": { + "dompdf/dompdf": "^0.8.5", + "friendsofphp/php-cs-fixer": "^2.16", + "jpgraph/jpgraph": "^4.0", + "mpdf/mpdf": "^8.0", + "phpcompatibility/php-compatibility": "^9.3", + "phpunit/phpunit": "^8.5|^9.3", + "squizlabs/php_codesniffer": "^3.5", + "tecnickcom/tcpdf": "^6.3" + }, + "suggest": { + "dompdf/dompdf": "Option for rendering PDF with PDF Writer (doesn't yet support PHP8)", + "jpgraph/jpgraph": "Option for rendering charts, or including charts with PDF or HTML Writers", + "mpdf/mpdf": "Option for rendering PDF with PDF Writer", + "tecnickcom/tcpdf": "Option for rendering PDF with PDF Writer (doesn't yet support PHP8)" + }, + "type": "library", + "autoload": { + "psr-4": { + "PhpOffice\\PhpSpreadsheet\\": "src/PhpSpreadsheet" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Maarten Balliauw", + "homepage": "https://blog.maartenballiauw.be" + }, + { + "name": "Mark Baker", + "homepage": "https://markbakeruk.net" + }, + { + "name": "Franck Lefevre", + "homepage": "https://rootslabs.net" + }, + { + "name": "Erik Tilt" + }, + { + "name": "Adrien Crivelli" + } + ], + "description": "PHPSpreadsheet - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine", + "homepage": "https://github.com/PHPOffice/PhpSpreadsheet", + "keywords": [ + "OpenXML", + "excel", + "gnumeric", + "ods", + "php", + "spreadsheet", + "xls", + "xlsx" + ], + "support": { + "issues": "https://github.com/PHPOffice/PhpSpreadsheet/issues", + "source": "https://github.com/PHPOffice/PhpSpreadsheet/tree/1.15.0" + }, + "time": "2020-10-11T13:20:59+00:00" + }, { "name": "picqer/php-barcode-generator", "version": "v0.3", @@ -1197,6 +1601,113 @@ }, "time": "2019-01-12T09:29:34+00:00" }, + { + "name": "psr/http-client", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-client.git", + "reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-client/zipball/2dfb5f6c5eff0e91e20e913f8c5452ed95b86621", + "reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621", + "shasum": "" + }, + "require": { + "php": "^7.0 || ^8.0", + "psr/http-message": "^1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Client\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP clients", + "homepage": "https://github.com/php-fig/http-client", + "keywords": [ + "http", + "http-client", + "psr", + "psr-18" + ], + "support": { + "source": "https://github.com/php-fig/http-client/tree/master" + }, + "time": "2020-06-29T06:28:15+00:00" + }, + { + "name": "psr/http-factory", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-factory.git", + "reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-factory/zipball/12ac7fcd07e5b077433f5f2bee95b3a771bf61be", + "reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be", + "shasum": "" + }, + "require": { + "php": ">=7.0.0", + "psr/http-message": "^1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interfaces for PSR-7 HTTP message factories", + "keywords": [ + "factory", + "http", + "message", + "psr", + "psr-17", + "psr-7", + "request", + "response" + ], + "support": { + "source": "https://github.com/php-fig/http-factory/tree/master" + }, + "time": "2019-04-30T12:38:16+00:00" + }, { "name": "psr/http-message", "version": "1.0.1", @@ -1300,6 +1811,57 @@ }, "time": "2020-03-23T09:12:05+00:00" }, + { + "name": "psr/simple-cache", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/simple-cache.git", + "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/simple-cache/zipball/408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", + "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\SimpleCache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interfaces for simple caching", + "keywords": [ + "cache", + "caching", + "psr", + "psr-16", + "simple-cache" + ], + "support": { + "source": "https://github.com/php-fig/simple-cache/tree/master" + }, + "time": "2017-10-23T01:57:42+00:00" + }, { "name": "ralouphie/getallheaders", "version": "3.0.3", @@ -1350,12 +1912,12 @@ "source": { "type": "git", "url": "https://github.com/Roave/SecurityAdvisories.git", - "reference": "d5961914bf7f90e81af509b81e51450bff419815" + "reference": "49da07b20a780d3fca9fe12e1db27975a2910c18" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/d5961914bf7f90e81af509b81e51450bff419815", - "reference": "d5961914bf7f90e81af509b81e51450bff419815", + "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/49da07b20a780d3fca9fe12e1db27975a2910c18", + "reference": "49da07b20a780d3fca9fe12e1db27975a2910c18", "shasum": "" }, "conflict": { @@ -1512,8 +2074,8 @@ "scheb/two-factor-bundle": ">=0,<3.26|>=4,<4.11", "sensiolabs/connect": "<4.2.3", "serluck/phpwhois": "<=4.2.6", - "shopware/core": "<=6.3.2", - "shopware/platform": "<=6.3.2", + "shopware/core": "<=6.3.4", + "shopware/platform": "<=6.3.4", "shopware/shopware": "<5.6.9", "silverstripe/admin": ">=1.0.3,<1.0.4|>=1.1,<1.1.1", "silverstripe/assets": ">=1,<1.4.7|>=1.5,<1.5.2", @@ -1663,7 +2225,7 @@ "type": "tidelift" } ], - "time": "2020-12-08T15:02:56+00:00" + "time": "2020-12-21T18:11:20+00:00" }, { "name": "sabberworm/php-css-parser", diff --git a/www/config/config.ini b/www/config/config.ini index 3ce387db5..99c24f795 100644 --- a/www/config/config.ini +++ b/www/config/config.ini @@ -23,11 +23,11 @@ tls=true [modules] -ocstore=0 ; интеграция с опенкарт -shop=0 ; встроеный модуль онлайн каталога -note=1 ; модуль органайзера(базы знаний) -issue=0 ; модуль Проекты и задачи -woocomerce=0; интеграция с вукомерсе -tecdoc=0 ; поиск по базе автозапчастей -ppo=1 ; фискализация +ocstore=0 ; интеграция с опенкарт +shop=0 ; встроеный модуль онлайн каталога +note=1 ; модуль органайзера(базы знаний) +issue=0 ; модуль Проекты и задачи +woocomerce=0 ; интеграция с вукомерсе +tecdoc=0 ; поиск по базе автозапчастей +ppo=1 ; фискализация \ No newline at end of file diff --git a/www/templates/lang.json b/www/templates/lang.json index 037a7dc7a..feb5745c6 100644 --- a/www/templates/lang.json +++ b/www/templates/lang.json @@ -320,7 +320,11 @@ "ppo_bnal": "Банкiвська картка", "ppo_credit": "В кредит", "ppo_prepaid": "Передплата", - + "ppo_returndoc": "Для фискализации создайте возврат на основе фискализованого чека", + "valuan": "Гривна", + "valusd": "Доллар", + "valeuro": "Евро", + "valrub": "Рубль", "refreshed": "Обновлено", "sent": "Отправлено", diff --git a/www/templates/modules/ppo/ppolist.html b/www/templates/modules/ppo/ppolist.html index a362a4f68..35eff2693 100644 --- a/www/templates/modules/ppo/ppolist.html +++ b/www/templates/modules/ppo/ppolist.html @@ -2,7 +2,7 @@
-
+

Просмотр обьектов

+ + + @@ -38,11 +41,14 @@

Просмотр обьектов

+ + + diff --git a/www/templates/modules/ppo/zform.html b/www/templates/modules/ppo/zform.html index ca9eee57a..444b02283 100644 --- a/www/templates/modules/ppo/zform.html +++ b/www/templates/modules/ppo/zform.html @@ -9,17 +9,55 @@

Закрытие смены

+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+ +
+ + +
+
+ + +
+
+ + +
+ + + + + diff --git a/www/templates/pages/branchlist.html b/www/templates/pages/branchlist.html index 51d0f73b9..d9fd712c3 100644 --- a/www/templates/pages/branchlist.html +++ b/www/templates/pages/branchlist.html @@ -12,7 +12,7 @@

Список филиалов

- + @@ -29,11 +29,7 @@

Список филиалов

-
- - - Если задано используется вместо настроек компании -
+
diff --git a/www/templates/pages/doc/goodsissue.html b/www/templates/pages/doc/goodsissue.html index 0d037341c..e5e596ed7 100644 --- a/www/templates/pages/doc/goodsissue.html +++ b/www/templates/pages/doc/goodsissue.html @@ -108,7 +108,7 @@

Расходная накладная

-
+
{{#usescanner}}
-
+
{{#usescanner}} + {{#ppo}} +
+ + +
+ {{/ppo}} +
diff --git a/www/templates/pages/doc/task.html b/www/templates/pages/doc/task.html index 27cc5af4b..6f35b122c 100644 --- a/www/templates/pages/doc/task.html +++ b/www/templates/pages/doc/task.html @@ -25,6 +25,11 @@

Наряд на выполнение работ

+
+ + +
+
@@ -68,7 +73,7 @@
Работы
- + - + @@ -29,21 +29,17 @@

Список філій

-
- - - Якщо задано використовується замість налаштувань -
+
- Якщо заданий використовується замість налаштувань + Якщо задана використовується замість налаштувань компанii
- Якщо заданий використовується замість налаштувань + Якщо заданий використовується замість налаштувань компанii
diff --git a/www/templates_ua/pages/doc/goodsissue.html b/www/templates_ua/pages/doc/goodsissue.html index 39d3eb487..557f1121c 100644 --- a/www/templates_ua/pages/doc/goodsissue.html +++ b/www/templates_ua/pages/doc/goodsissue.html @@ -107,7 +107,7 @@

Видаткова накладна

-
+
{{#usescanner}}
-
+
{{#usescanner}} + {{#ppo}} +
+ + +
+ {{/ppo}}
diff --git a/www/templates_ua/pages/doc/task.html b/www/templates_ua/pages/doc/task.html index 07c583ea2..5070f9b15 100644 --- a/www/templates_ua/pages/doc/task.html +++ b/www/templates_ua/pages/doc/task.html @@ -25,6 +25,11 @@

Наряд на виконання робіт

+
+ + +
+
@@ -68,7 +73,7 @@
Роботи
- +
НазваниеФилиал
Чек {{document_number}}
Фiск. номер {{fiscalnumber}}
від {{time}}
Продавец{{firm_name}}
ИНН{{inn}}
Телефон{{phone}}
Терминал {{pos_name}}
Фиск. номер {{fiscalnumber}}
от {{time}}
{{firmname}} {{firm_name}}
Продавець{{firm_name}}
IПН{{inn}}
Телефон{{phone}}
Термінал
{{firmname}} {{firm_name}}
Наименование ОрганизацияАдрес ЕДРПОУ ИНН Фиск. № Лок. №Имя
diff --git a/www/templates/pages/poslist.html b/www/templates/pages/poslist.html index 8a320519b..e3c076bcb 100644 --- a/www/templates/pages/poslist.html +++ b/www/templates/pages/poslist.html @@ -39,38 +39,45 @@

Справочник POS терминалов

- {{#usebranch}} + + + +
+ + +
+ {{#usebranch}}
- {{/usebranch}} - -
- - + {{/usebranch}} +
+ + + Если задано используется в чеках и фискализации +
-
- - -
-
- - + +
+ + + Если задано используется в чеках вместо адреса компании +
+ +
- - + + + Если задан используется в чеках вместо настроек компании
- + + {{#ppo}}
diff --git a/www/templates/pages/register/doclist.html b/www/templates/pages/register/doclist.html index a62c13ab8..7d597385c 100644 --- a/www/templates/pages/register/doclist.html +++ b/www/templates/pages/register/doclist.html @@ -39,7 +39,7 @@

Журнал документов

- Скачать CSV + Экспорт в Excel diff --git a/www/templates/pages/register/gilist.html b/www/templates/pages/register/gilist.html index f177c004d..a825c6717 100644 --- a/www/templates/pages/register/gilist.html +++ b/www/templates/pages/register/gilist.html @@ -40,7 +40,7 @@

Журнал продаж

Создать РН  Создать СФ -
Скачать CSV +
Экспорт в Excel
Документ
diff --git a/www/templates/pages/register/grlist.html b/www/templates/pages/register/grlist.html index a055ea34b..fe982b733 100644 --- a/www/templates/pages/register/grlist.html +++ b/www/templates/pages/register/grlist.html @@ -39,7 +39,7 @@

Журнал закупок

Создать -
Скачать CSV +
Экспорт в Excel
diff --git a/www/templates/pages/register/itemlist.html b/www/templates/pages/register/itemlist.html index 61ee84b19..c8d7fb3b1 100644 --- a/www/templates/pages/register/itemlist.html +++ b/www/templates/pages/register/itemlist.html @@ -31,7 +31,7 @@

Товары на складе

- Скачать CSV + Экспорт в Excel
diff --git a/www/templates/pages/register/ordercustlist.html b/www/templates/pages/register/ordercustlist.html index 6272cb15f..84db4fb9e 100644 --- a/www/templates/pages/register/ordercustlist.html +++ b/www/templates/pages/register/ordercustlist.html @@ -33,7 +33,7 @@

Журнал заявок

Создать -
Скачать CSV +
Экспорт в Excel
diff --git a/www/templates/pages/register/orderlist.html b/www/templates/pages/register/orderlist.html index 58d7e24fc..9ec2b2972 100644 --- a/www/templates/pages/register/orderlist.html +++ b/www/templates/pages/register/orderlist.html @@ -37,7 +37,7 @@

Журнал заказов

Новый заказ -
Скачать CSV +
Экспорт в Excel
diff --git a/www/templates/pages/register/paycustlist.html b/www/templates/pages/register/paycustlist.html index 5deb03266..b62cd930a 100644 --- a/www/templates/pages/register/paycustlist.html +++ b/www/templates/pages/register/paycustlist.html @@ -63,7 +63,7 @@

Расчеты с контрагентами

@@ -110,14 +110,20 @@

+ class="form-control mr-2"> - + {{#ppo}} + + + {{/ppo}} - - + + diff --git a/www/templates/pages/register/paylist.html b/www/templates/pages/register/paylist.html index 34df620ed..4907a066a 100644 --- a/www/templates/pages/register/paylist.html +++ b/www/templates/pages/register/paylist.html @@ -43,7 +43,7 @@

Журнал платежей

diff --git a/www/templates/pages/register/serlist.html b/www/templates/pages/register/serlist.html index 593da8eb6..4cf43c5af 100644 --- a/www/templates/pages/register/serlist.html +++ b/www/templates/pages/register/serlist.html @@ -33,7 +33,7 @@

Журнал услуг

Создать новый -
Скачать CSV +
Экспорт в Excel
diff --git a/www/templates/pages/register/tasklist.html b/www/templates/pages/register/tasklist.html index eb899d75b..e17633d02 100644 --- a/www/templates/pages/register/tasklist.html +++ b/www/templates/pages/register/tasklist.html @@ -66,7 +66,7 @@

Журнал нарядов

diff --git a/www/templates/pages/service/armpos.html b/www/templates/pages/service/armpos.html index bbf616af1..b0ad541bf 100644 --- a/www/templates/pages/service/armpos.html +++ b/www/templates/pages/service/armpos.html @@ -16,14 +16,21 @@

        АРМ кассира

+ +
- - + + +
+ +
+ +
- -
diff --git a/www/templates/printforms/doc/task.tpl b/www/templates/printforms/doc/task.tpl index e0f6e5cff..b3c8c8a96 100644 --- a/www/templates/printforms/doc/task.tpl +++ b/www/templates/printforms/doc/task.tpl @@ -49,7 +49,7 @@ - + diff --git a/www/templates_ua/lang.json b/www/templates_ua/lang.json index 1b7230cbf..0e0913e85 100644 --- a/www/templates_ua/lang.json +++ b/www/templates_ua/lang.json @@ -138,7 +138,7 @@ "noselpartion": "Не выбрана партія", "thesamepartion": "Однакові партії", "overqty": "Перевищена кількість", - "sumoverpay": "Сумма білша необхідної", + "sumoverpay": "Сума більша необхідної", "noselterm": "Не выбраний термінал", "noselencode": "Не выбране кодування", "noselcolname": "Не вказаний стовбець з найменуванням", @@ -148,7 +148,7 @@ "nomovedesc": "Не можна перемістити в свого нащадка", "filetobig": "Файл налто великий", "entertext": "Введіть текст", - "noroot": "Не знайдено корньового вузла", + "noroot": "Не знайдено корневого вузла", "invalidresponse": "Невірна відповідь", "nodataresponse": "Нема данних відповіді", "noselcust": "Не заданий контрагент", @@ -197,7 +197,7 @@ "barcode_exists": "Такий штрих-код вже iснує", "allweight": "Загальна вага %s кг", "abc1": "Товари, прибуток", - "abc2": "Постачальники,об`єм поставок", + "abc2": "Постачальники, об`єм поставок", "abc3": "Клiєнти, об`єм продаж", "abc4": "Послуги, виручка", "abc5": "Клiєнти, прибуток", @@ -284,7 +284,7 @@ "iscontractdocs": "Контракт має документи", "modnotemain": "База знань", "modtecdocsearch": "Пошук по TECDOC", - "delitemwarn": "Товар вже використовуеться. Переведений в неактивний", + "delitemwarn": "Товар вже використовується. Переведений в неактивний", "withoutcat": "Без категорiї", "ppoexecuted": "Виконано", "emptycust": "Фiз. особа", @@ -295,7 +295,7 @@ "seller": "Постачальник", "holdings": "Холдинги", "isactul": "Актуальний", - "notused": "Не використовуется", + "notused": "Не використовуєтся", "potential": "Потенцiальний", "bankproc": "Банкiвський процент за транзакцiю", "it_tovar": "Товар", @@ -310,7 +310,12 @@ "ppo_bnal": "Банкiвська картка", "ppo_credit": "В кредит", "ppo_prepaid": "Передплата", - + "ppo_returndoc": "Для фїскалїзацiї створiть повернення на пiдставi фiскалiзованого чеку", + "valuan": "Гривня", + "valusd": "Долар", + "valeuro": "Євро", + "valrub": "Рубль", + "refreshed": "Оновлено", "sent": "Відправлено", "saved": "Збережено" diff --git a/www/templates_ua/modules/ppo/ppolist.html b/www/templates_ua/modules/ppo/ppolist.html new file mode 100644 index 000000000..aaa5e2e73 --- /dev/null +++ b/www/templates_ua/modules/ppo/ppolist.html @@ -0,0 +1,107 @@ + + + +
+
+ +

Перегляд об'ектiв

+ + Зареестрованi РРО +
{{no}} {{service_name}}{{qty}}{{quantity}} {{cost}} {{hours}}
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
НайменуванняОрганiзацiяАдресаЕДРПОУIПНФiск. №Лок. №Iм'я
+
+
+ + +
+

Смены

+ Назад + + + + + + + + + + + + + + + + + +
ВiдкривДатаЗакривДата
+
+
+

Документы

+ Назад + + + + + + + + + + + + + + + + +
Фiск. №Локал. №ДокументТип
+

+
+    
+
+ + + diff --git a/www/templates_ua/modules/ppo/zform.html b/www/templates_ua/modules/ppo/zform.html new file mode 100644 index 000000000..b1955bf79 --- /dev/null +++ b/www/templates_ua/modules/ppo/zform.html @@ -0,0 +1,66 @@ + + + +
+
+ +

Закриття змiни

+ Сторiнка для ручного закриття змiни + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+ +
+ + +
+
+ + +
+
+ + +
+ + + + +
+
+ +
+ + + \ No newline at end of file diff --git a/www/templates_ua/pages/branchlist.html b/www/templates_ua/pages/branchlist.html index d183c6d27..dd1ab75e9 100644 --- a/www/templates_ua/pages/branchlist.html +++ b/www/templates_ua/pages/branchlist.html @@ -12,7 +12,7 @@

Список філій

diff --git a/www/templates_ua/pages/poslist.html b/www/templates_ua/pages/poslist.html index 95bc19375..14db23e5c 100644 --- a/www/templates_ua/pages/poslist.html +++ b/www/templates_ua/pages/poslist.html @@ -37,6 +37,12 @@

Довідник POS терміналів

+
+ + +
{{#usebranch}}
@@ -46,28 +52,18 @@

Довідник POS терміналів

{{/usebranch}} - -
- - -
-
- - -
-
- - +
+ + + Використовуєтся в чеках та фiскалiзацiї +
-
+ + +
+ Якщо задана використовується в чеках замість налаштувань компанii
{{#ppo}} diff --git a/www/templates_ua/pages/reference/itemlist.html b/www/templates_ua/pages/reference/itemlist.html index 95fb5adbf..81c16fa35 100644 --- a/www/templates_ua/pages/reference/itemlist.html +++ b/www/templates_ua/pages/reference/itemlist.html @@ -130,7 +130,7 @@

Редагування товару

- +
diff --git a/www/templates_ua/pages/register/doclist.html b/www/templates_ua/pages/register/doclist.html index aa268b1ef..fb52128ab 100644 --- a/www/templates_ua/pages/register/doclist.html +++ b/www/templates_ua/pages/register/doclist.html @@ -39,7 +39,7 @@

Журнал документів

- Завантажити CSV + Експорт в Excel diff --git a/www/templates_ua/pages/register/gilist.html b/www/templates_ua/pages/register/gilist.html index 55e365930..e1d4bf007 100644 --- a/www/templates_ua/pages/register/gilist.html +++ b/www/templates_ua/pages/register/gilist.html @@ -39,7 +39,7 @@

Журнал продажів

Створити ВН  Створити РФ -
Завантажити CSV +
Експорт в Excel
Документ
diff --git a/www/templates_ua/pages/register/grlist.html b/www/templates_ua/pages/register/grlist.html index cd403f919..ac6c6d8c4 100644 --- a/www/templates_ua/pages/register/grlist.html +++ b/www/templates_ua/pages/register/grlist.html @@ -38,7 +38,7 @@

Журнал закупівель

Створити -
Завантажити CSV +
Експорт в Excel
diff --git a/www/templates_ua/pages/register/itemlist.html b/www/templates_ua/pages/register/itemlist.html index 415cc0582..8897ffff2 100644 --- a/www/templates_ua/pages/register/itemlist.html +++ b/www/templates_ua/pages/register/itemlist.html @@ -31,7 +31,7 @@

Товари на складі

- Завантажити CSV + Експорт в Excel
diff --git a/www/templates_ua/pages/register/ordercustlist.html b/www/templates_ua/pages/register/ordercustlist.html index f48563839..ccceee646 100644 --- a/www/templates_ua/pages/register/ordercustlist.html +++ b/www/templates_ua/pages/register/ordercustlist.html @@ -33,7 +33,7 @@

Журнал заявок

Створити -
Завантажити CSV +
Експорт в Excel
diff --git a/www/templates_ua/pages/register/orderlist.html b/www/templates_ua/pages/register/orderlist.html index 44fd50e56..d16ad5068 100644 --- a/www/templates_ua/pages/register/orderlist.html +++ b/www/templates_ua/pages/register/orderlist.html @@ -37,7 +37,7 @@

Журнал замовлень

Нове замовлення -
Завантажити CSV +
Експорт в Excel
diff --git a/www/templates_ua/pages/register/paycustlist.html b/www/templates_ua/pages/register/paycustlist.html index 0e6168461..b4b747517 100644 --- a/www/templates_ua/pages/register/paycustlist.html +++ b/www/templates_ua/pages/register/paycustlist.html @@ -61,7 +61,7 @@

Розрахунки з контрагентами

@@ -108,12 +108,22 @@

+ class="form-control mr-2"> - - + {{#ppo}} + + + {{/ppo}} + + + + diff --git a/www/templates_ua/pages/register/paylist.html b/www/templates_ua/pages/register/paylist.html index 9c83389fd..196d51fe9 100644 --- a/www/templates_ua/pages/register/paylist.html +++ b/www/templates_ua/pages/register/paylist.html @@ -43,7 +43,7 @@

Журнал платежів

diff --git a/www/templates_ua/pages/register/serlist.html b/www/templates_ua/pages/register/serlist.html index 2e1d6d4bb..d9946574c 100644 --- a/www/templates_ua/pages/register/serlist.html +++ b/www/templates_ua/pages/register/serlist.html @@ -33,7 +33,7 @@

Журнал послугг

Створити новий -
Завантажити CSV +
Експорт в Excel
diff --git a/www/templates_ua/pages/register/tasklist.html b/www/templates_ua/pages/register/tasklist.html index 7f61621ef..5a41639c1 100644 --- a/www/templates_ua/pages/register/tasklist.html +++ b/www/templates_ua/pages/register/tasklist.html @@ -65,7 +65,7 @@

Журнал нарядів

diff --git a/www/templates_ua/pages/service/armpos.html b/www/templates_ua/pages/service/armpos.html index 81b1cfe7a..f416c4df7 100644 --- a/www/templates_ua/pages/service/armpos.html +++ b/www/templates_ua/pages/service/armpos.html @@ -15,17 +15,23 @@

        АРМ касира

- +
- - + + +
+ +
+ +
-
- +
diff --git a/www/templates_ua/pages/service/import.html b/www/templates_ua/pages/service/import.html index de0d240a3..7459b0d8a 100644 --- a/www/templates_ua/pages/service/import.html +++ b/www/templates_ua/pages/service/import.html @@ -131,7 +131,7 @@

Імпорт номенклатури

- + {{#list}} diff --git a/www/templates_ua/printforms/check.xml b/www/templates_ua/printforms/check.xml new file mode 100644 index 000000000..64657adf8 --- /dev/null +++ b/www/templates_ua/printforms/check.xml @@ -0,0 +1,85 @@ + + + + + + 0 + 0 + + + {{guid}} + + {{tin}} + + {{#inn}} + {{inn}} + {{/inn}} + + {{firmname}} + + {{pointname}} + + {{address}} + + {{date}} + + {{time}} + + {{docnumber}} + + + {{posinner}} + {{posnumber}} + + + {{username}} + + 1 + + + + {{amount}} + {{#disc}} + 0 + {{disc}} + {{/disc}} + + + + + {{#pay}} + + {{#pays}} + + + {{formcode}} + + {{formname}} + + {{paysum}} + + {{payed}} + {{#rest}} + {{rest}} + {{/rest}} + + {{/pays}} + + + {{/pay}} + + + + {{#details}} + + + {{name}} + + {{qty}} + {{price}} + + {{cost}} + + {{/details}} + + diff --git a/www/templates_ua/printforms/checkback.xml b/www/templates_ua/printforms/checkback.xml new file mode 100644 index 000000000..3c9068dec --- /dev/null +++ b/www/templates_ua/printforms/checkback.xml @@ -0,0 +1,78 @@ + + + + + + 0 + 1 + + + {{guid}} + + {{tin}} + + {{#inn}} + {{inn}} + {{/inn}} + + {{firmname}} + + {{pointname}} + + {{address}} + + {{date}} + + {{time}} + + {{docnumber}} + + + {{posinner}} + {{posnumber}} + {{docnumberback}} + + {{username}} + + 1 + + + + {{amount}} + + + + + + + + + + + {{formcode}} + + {{formname}} + + {{paysum}} + + {{payed}} + + + + + + + + {{#details}} + + + {{name}} + + {{qty}} + {{price}} + + {{cost}} + + {{/details}} + + diff --git a/www/templates_ua/printforms/checkpay.xml b/www/templates_ua/printforms/checkpay.xml new file mode 100644 index 000000000..2575391ea --- /dev/null +++ b/www/templates_ua/printforms/checkpay.xml @@ -0,0 +1,77 @@ + + + + + + 0 + 0 + + + {{guid}} + + {{tin}} + + {{#inn}} + {{inn}} + {{/inn}} + + {{firmname}} + + {{pointname}} + + {{address}} + + {{date}} + + {{time}} + + {{docnumber}} + + + {{posinner}} + {{posnumber}} + + + {{username}} + + 1 + + + + {{amount}} + + + + + + {{#pay}} + + + + {{formcode}} + + {{formname}} + + {{paysum}} + + {{payed}} + + + + {{/pay}} + + + + + + Доплата по чеку {{parentcheck}} + + 1 + {{amount}} + + {{amount}} + + + + + diff --git a/www/templates_ua/printforms/doc/task.tpl b/www/templates_ua/printforms/doc/task.tpl index b76a9fdc5..6d86a12ab 100644 --- a/www/templates_ua/printforms/doc/task.tpl +++ b/www/templates_ua/printforms/doc/task.tpl @@ -39,7 +39,8 @@ - + + @@ -48,8 +49,8 @@ - - + + diff --git a/www/templates_ua/printforms/item_tag.tpl b/www/templates_ua/printforms/item_tag.tpl index 24e3c23f0..f14455542 100644 --- a/www/templates_ua/printforms/item_tag.tpl +++ b/www/templates_ua/printforms/item_tag.tpl @@ -1,15 +1,15 @@ -
-
Од. Кіл. Обл. цінаОпт. цінаВiдп. ціна
НайменуванняКiлСума Годин
{{no}} {{service_name}}{{quantity}}{{cost}} {{hours}}
- +
+
> + {{#isap}} - + {{/isap}} - + diff --git a/www/templates_ua/printforms/shift.xml b/www/templates_ua/printforms/shift.xml new file mode 100644 index 000000000..342dd3d68 --- /dev/null +++ b/www/templates_ua/printforms/shift.xml @@ -0,0 +1,38 @@ + + + + + {{doctype}} + + {{guid}} + + {{tin}} + + {{#inn}} + {{inn}} + {{/inn}} + + {{firmname}} + + {{pointname}} + + {{address}} + + {{date}} + + {{time}} + + {{docnumber}} + + + {{posinner}} + {{posnumber}} + + + {{username}} + + 1 + + + + diff --git a/www/templates_ua/printforms/zform.xml b/www/templates_ua/printforms/zform.xml new file mode 100644 index 000000000..e113b0a12 --- /dev/null +++ b/www/templates_ua/printforms/zform.xml @@ -0,0 +1,77 @@ + + + + + + {{guid}} + + {{tin}} + + {{#inn}} + {{inn}} + {{/inn}} + + {{firmname}} + + {{pointname}} + + {{address}} + + {{date}} + + {{time}} + + {{docnumber}} + + {{posinner}} + + {{posnumber}} + + {{username}} + + 1 + + + + {{#isreal}} + + {{amount}} + {{cnt}} + + {{#pays}} + + + {{formcode}} + + {{formname}} + + {{sum}} + + + {{/pays}} + + + + {{/isreal}} + + {{#isret}} + + {{amountr}} + {{cntr}} + + {{#paysr}} + + + {{formcode}} + + {{formname}} + + {{sum}} + + + {{/paysr}} + + + + {{/isret}} + From 58cc79881d91f11ea884bb34509b6b9fe01be774 Mon Sep 17 00:00:00 2001 From: "HOME\\leonm" Date: Tue, 29 Dec 2020 09:28:24 +0200 Subject: [PATCH 08/11] fix --- www/app/modules/ppo/ppohelper.php | 2 +- www/app/pages/service/armpos.php | 21 +++++++++++++++------ www/templates/pages/service/armpos.html | 10 +++++----- www/templates_ua/pages/service/armpos.html | 8 ++++---- 4 files changed, 25 insertions(+), 16 deletions(-) diff --git a/www/app/modules/ppo/ppohelper.php b/www/app/modules/ppo/ppohelper.php index 8b7e01368..a8e2d9edd 100644 --- a/www/app/modules/ppo/ppohelper.php +++ b/www/app/modules/ppo/ppohelper.php @@ -290,7 +290,7 @@ public static function zform($posid, $stat, $rstat) { $amount = $amount + $stat['amount1']; $n++; } - if ($row['amount2'] > 0) { + if ($stat['amount2'] > 0) { $header['pays'][] = array( 'formname' => H::l('ppo_credit'), 'formcode' => 2, diff --git a/www/app/pages/service/armpos.php b/www/app/pages/service/armpos.php index 50deb3e06..0a0c2217f 100644 --- a/www/app/pages/service/armpos.php +++ b/www/app/pages/service/armpos.php @@ -715,6 +715,9 @@ public function savedocOnClick($sender) { $logger->error($ee->getMessage() . " Документ " . $this->_doc->meta_desc); return; } + $this->form3->customer->setKey(0); + $this->form3->customer->setText(''); + $this->form3->payment->setValue(H::getDefMF()); $this->form3->setVisible(false); $this->form4->setVisible(true); @@ -725,17 +728,23 @@ public function savedocOnClick($sender) { public function OnPayment($sender) { $b = $sender->getValue(); + $this->form3->payed->setVisible(true); + $this->form3->payamount->setVisible(true); + $this->form3->paydisc->setVisible(true); + $this->form3->exchange->setVisible(true); + if ($b == \App\Entity\MoneyFund::PREPAID) { $this->form3->payed->setVisible(false); $this->form3->payamount->setVisible(false); $this->form3->paydisc->setVisible(false); $this->form3->exchange->setVisible(false); - } else { - $this->form3->payed->setVisible(true); - $this->form3->payamount->setVisible(true); - $this->form3->paydisc->setVisible(true); - $this->form3->exchange->setVisible(true); - } + } + if ($b == \App\Entity\MoneyFund::CREDIT) { + $this->form3->payed->setVisible(false); + //$this->form3->payamount->setVisible(false); + $this->form3->paydisc->setVisible(false); + $this->form3->exchange->setVisible(false); + } } diff --git a/www/templates/pages/service/armpos.html b/www/templates/pages/service/armpos.html index b0ad541bf..5dde66bae 100644 --- a/www/templates/pages/service/armpos.html +++ b/www/templates/pages/service/armpos.html @@ -186,20 +186,20 @@

        АРМ кассира

- +
- +
- +
- +
@@ -262,7 +262,7 @@

Ввод товара

-
diff --git a/www/templates_ua/pages/service/armpos.html b/www/templates_ua/pages/service/armpos.html index f416c4df7..9727b330d 100644 --- a/www/templates_ua/pages/service/armpos.html +++ b/www/templates_ua/pages/service/armpos.html @@ -184,15 +184,15 @@

        АРМ касира

- +
- +
- +
@@ -260,7 +260,7 @@

Введення товару

-
From 7acf0cb77c5e074174c8ad921241f3c93b0fc0eb Mon Sep 17 00:00:00 2001 From: Leon Date: Tue, 29 Dec 2020 14:27:35 +0200 Subject: [PATCH 09/11] =?UTF-8?q?=D0=B8=D0=BC=D0=BF=D0=BE=D1=80=D1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- www/app/pages/register/grlist.php | 35 ++- www/app/pages/register/itemlist.php | 59 +++-- www/app/pages/register/ordercustlist.php | 36 ++- www/app/pages/register/orderlist.php | 35 ++- www/app/pages/register/paycustlist.php | 59 ++--- www/app/pages/register/paylist.php | 50 ++-- www/app/pages/register/serlist.php | 39 ++- www/app/pages/register/tasklist.php | 39 ++- www/app/pages/service/export.php | 288 ++++++++------------- www/app/pages/service/import.php | 281 ++++++++++---------- www/templates/lang.json | 1 + www/templates/pages/service/export.html | 40 +-- www/templates/pages/service/import.html | 49 +--- www/templates_ua/lang.json | 1 + www/templates_ua/pages/service/export.html | 40 +-- www/templates_ua/pages/service/import.html | 50 +--- 16 files changed, 455 insertions(+), 647 deletions(-) diff --git a/www/app/pages/register/grlist.php b/www/app/pages/register/grlist.php index 4e8ee2675..cead45b35 100644 --- a/www/app/pages/register/grlist.php +++ b/www/app/pages/register/grlist.php @@ -176,26 +176,25 @@ public function editOnClick($sender) { public function oncsv($sender) { $list = $this->doclist->getDataSource()->getItems(-1, -1, 'document_id'); - $csv = ""; - + + + $header = array(); + $data = array(); + + $i=0; foreach ($list as $d) { - $csv .= H::fd($d->document_date) . ';'; - $csv .= $d->document_number . ';'; - $csv .= $d->customer_name . ';'; - $csv .= $d->amount . ';'; - $csv .= str_replace(';', '', $d->notes) . ';'; - $csv .= "\n"; + $i++; + $data['A'.$i] = H::fd($d->document_date) ; + $data['B'.$i] = $d->document_number ; + $data['C'.$i] = $d->customer_name ; + $data['D'.$i] = $d->amount ; + $data['E'.$i] = $d->notes ; + } - $csv = mb_convert_encoding($csv, "windows-1251", "utf-8"); - - - header("Content-type: text/csv"); - header("Content-Disposition: attachment;Filename=baylist.csv"); - header("Content-Transfer-Encoding: binary"); - - echo $csv; - flush(); - die; + + H::exportExcel($data,$header,'baylist.xlsx') ; + + } } diff --git a/www/app/pages/register/itemlist.php b/www/app/pages/register/itemlist.php index e3d8bc112..084ab59ea 100644 --- a/www/app/pages/register/itemlist.php +++ b/www/app/pages/register/itemlist.php @@ -270,18 +270,32 @@ public function OnMove($sender) { public function oncsv($sender) { $store = $this->filter->searchstore->getValue(); $list = $this->itempanel->itemlist->getDataSource()->getItems(-1, -1, 'itemname'); - $csv = ""; - + + + $header = array(); + $data = array(); + + $header['A1'] = "Наименование"; + $header['B1'] = "Артикул"; + $header['C1'] = "Штрих-код"; + $header['D1'] = "Ед."; + $header['E1'] = "Категория"; + $header['F1'] = "Кол."; + $header['G1'] = "Цена"; + + + $i=1; foreach ($list as $item) { - - $csv .= $item->itemname . ';'; - $csv .= $item->item_code . ';'; - - $csv .= $item->msr . ';'; - $csv .= $item->cat_name . ';'; - $qty = $item->getQuantity($store); - - $csv .= H::fqty($qty) . ';'; + $i++; + $data['A'.$i] = $item->itemname; + $data['B'.$i] = $item->item_code ; + $data['C'.$i] = $item->bar_code ; + $data['D'.$i] = $item->msr ; + $data['E'.$i] = $item->cat_name ; + $qty = $item->getQuantity($store); + $data['F'.$i] = H::fqty($qty) ; + + $plist = array(); if ($item->price1 > 0) { $plist[] = $item->getPrice('price1', $store); @@ -297,23 +311,14 @@ public function oncsv($sender) { } if ($item->price5 > 0) { $plist[] = $item->getPrice('price5', $store); - } - - - $csv .= implode(' ', $plist) . ';'; - - $csv .= "\n"; + } + $data['G'.$i] = implode(' ', $plist) ; + + } - $csv = mb_convert_encoding($csv, "windows-1251", "utf-8"); - - - header("Content-type: text/csv"); - header("Content-Disposition: attachment;Filename=stockslist.csv"); - header("Content-Transfer-Encoding: binary"); - - echo $csv; - flush(); - die; + + H::exportExcel($data,$header,'stocklist.xlsx') ; + } } diff --git a/www/app/pages/register/ordercustlist.php b/www/app/pages/register/ordercustlist.php index 39295a4d6..2373944bd 100644 --- a/www/app/pages/register/ordercustlist.php +++ b/www/app/pages/register/ordercustlist.php @@ -254,27 +254,25 @@ public function editOnClick($sender) { public function oncsv($sender) { $list = $this->doclist->getDataSource()->getItems(-1, -1, 'document_id'); - $csv = ""; - + + + $header = array(); + $data = array(); + + $i=0; foreach ($list as $d) { - $csv .= H::fd($d->document_date) . ';'; - $csv .= $d->document_number . ';'; - $csv .= $d->customer_name . ';'; - $csv .= $d->amount . ';'; - $csv .= Document::getStateName($d->state) . ';'; - $csv .= str_replace(';', '', $d->notes) . ';'; - $csv .= "\n"; + $i++; + $data['A'.$i] = H::fd($d->document_date) ; + $data['B'.$i] = $d->document_number ; + $data['C'.$i] = $d->customer_name ; + $data['D'.$i] = $d->amount ; + $data['E'.$i] = Document::getStateName($d->state) ; + $data['F'.$i] = $d->notes ; + } - $csv = mb_convert_encoding($csv, "windows-1251", "utf-8"); - - - header("Content-type: text/csv"); - header("Content-Disposition: attachment;Filename=ordercustlist.csv"); - header("Content-Transfer-Encoding: binary"); - - echo $csv; - flush(); - die; + + H::exportExcel($data,$header,'ordercustlist.xlsx') ; + } } diff --git a/www/app/pages/register/orderlist.php b/www/app/pages/register/orderlist.php index f7cd80646..1e068b514 100644 --- a/www/app/pages/register/orderlist.php +++ b/www/app/pages/register/orderlist.php @@ -255,26 +255,25 @@ public function editOnClick($sender) { public function oncsv($sender) { $list = $this->doclist->getDataSource()->getItems(-1, -1, 'document_id'); - $csv = ""; - + + $header = array(); + $data = array(); + + $i=0; foreach ($list as $d) { - $csv .= H::fd($d->document_date) . ';'; - $csv .= $d->document_number . ';'; - $csv .= $d->customer_name . ';'; - $csv .= $d->amount . ';'; - $csv .= Document::getStateName($d->state) . ';'; - $csv .= str_replace(';', '', $d->notes) . ';'; - $csv .= "\n"; + $i++; + $data['A'.$i] = H::fd($d->document_date) ; + $data['B'.$i] = $d->document_number ; + $data['C'.$i] = $d->customer_name ; + $data['D'.$i] = $d->amount ; + $data['E'.$i] = Document::getStateName($d->state) ; + $data['F'.$i] = $d->notes ; + } - $csv = mb_convert_encoding($csv, "windows-1251", "utf-8"); - - header("Content-type: text/csv"); - header("Content-Disposition: attachment;Filename=orderlist.csv"); - header("Content-Transfer-Encoding: binary"); - - echo $csv; - flush(); - die; + + H::exportExcel($data,$header,'orderlist.xlsx') ; + + } } diff --git a/www/app/pages/register/paycustlist.php b/www/app/pages/register/paycustlist.php index 122abdcf9..a35ae66fb 100644 --- a/www/app/pages/register/paycustlist.php +++ b/www/app/pages/register/paycustlist.php @@ -307,45 +307,46 @@ public function payOnSubmit($sender) { public function oncsv($sender) { $csv = ""; + + $header = array(); + $data = array(); + + $i=0; + if ($sender->id == 'csv') { $list = $this->clist->custlist->getDataSource()->getItems(-1, -1, 'customer_name'); - - foreach ($list as $c) { - - $csv .= $c->customer_name . ';'; - $csv .= $c->phone . ';'; - - $csv .= H::fa($c->fl == -1 ? $c->sam : "") . ';'; - $csv .= H::fa($c->fl == 1 ? $c->sam : "") . ';'; - - $csv .= "\n"; - } + foreach ($list as $c) { + $i++; + $data['A'.$i] = $c->customer_name ; + $data['B'.$i] = $c->phone ; + $data['C'.$i] = H::fa($c->fl == -1 ? $c->sam : "") ; + $data['D'.$i] = H::fa($c->fl == 1 ? $c->sam : "") ; + + + } + + + + } if ($sender->id == 'csv2') { $list = $this->plist->doclist->getDataSource()->getItems(-1, -1, 'document_id'); - foreach ($list as $d) { - $csv .= H::fd($d->document_date) . ';'; - $csv .= $d->document_number . ';'; - - $csv .= H::fa($d->amount) . ';'; - $csv .= str_replace(';', '', $d->notes) . ';'; - $csv .= "\n"; + $i++; + $data['A'.$i] = H::fd($d->document_date) ; + $data['B'.$i] = $d->document_number; + $data['C'.$i] = H::fa($d->amount); + $data['D'.$i] = $d->notes ; + + } +M } - - $csv = mb_convert_encoding($csv, "windows-1251", "utf-8"); - - - header("Content-type: text/csv"); - header("Content-Disposition: attachment;Filename=baylist.csv"); - header("Content-Transfer-Encoding: binary"); - - echo $csv; - flush(); - die; + + H::exportExcel($data,$header,'baylist.xlsx') ; + } } diff --git a/www/app/pages/register/paylist.php b/www/app/pages/register/paylist.php index 22c3f552c..c52485c91 100644 --- a/www/app/pages/register/paylist.php +++ b/www/app/pages/register/paylist.php @@ -136,32 +136,36 @@ public function delOnClick($sender) { public function oncsv($sender) { $list = $this->doclist->getDataSource()->getItems(-1, -1); - $csv = "Дата;Счет;Приход;Расход;Документ;Создал;Контрагент;Примечание;"; - $csv .= "\n\n"; - + + $header = array(); + $data = array(); + + $header['A1'] = "Дата"; + $header['B1'] = "Счет"; + $header['C1'] = "Приход"; + $header['D1'] = "Расход"; + $header['E1'] = "Документ"; + $header['F1'] = "Создал"; + $header['G1'] = "Контрагент"; + $header['H1'] = "Примечание"; + + $i=1; foreach ($list as $doc) { - - $csv .= H::fd(strtotime($doc->paydate)) . ';'; - $csv .= $doc->mf_name . ';'; - $csv .= ($doc->amount > 0 ? $doc->amount : "") . ';'; - $csv .= ($doc->amount < 0 ? 0 - $doc->amount : "") . ';'; - $csv .= $doc->document_number . ';'; - $csv .= $doc->username . ';'; - $csv .= $doc->customer_name . ';'; - $csv .= str_replace(';', '', $doc->notes) . ';'; - $csv .= "\n"; + $i++; + $data['A'.$i] = H::fd(strtotime($doc->paydate)); + $data['B'.$i] = $doc->mf_name ; + $data['C'.$i] = ($doc->amount > 0 ? H::fa($doc->amount) : "") ; + $data['D'.$i] = ($doc->amount < 0 ? H::fa(0 - $doc->amount) : "") ; + $data['E'.$i] = $doc->document_number ; + $data['F'.$i] = $doc->username ; + $data['G'.$i] = $doc->customer_name ; + $data['H'.$i] = $doc->notes ; + } - $csv = mb_convert_encoding($csv, "windows-1251", "utf-8"); - - - header("Content-type: text/csv"); - header("Content-Disposition: attachment;Filename=baylist.csv"); - header("Content-Transfer-Encoding: binary"); - - echo $csv; - flush(); - die; + + H::exportExcel($data,$header,'paylist.xlsx') ; } + } diff --git a/www/app/pages/register/serlist.php b/www/app/pages/register/serlist.php index 0bab39eb6..ae8f04acb 100644 --- a/www/app/pages/register/serlist.php +++ b/www/app/pages/register/serlist.php @@ -209,31 +209,30 @@ public function editOnClick($sender) { App::Redirect("\\App\\Pages\\Doc\\GoodsIssue", $doc->document_id); } - //оплаты + public function oncsv($sender) { $list = $this->doclist->getDataSource()->getItems(-1, -1, 'document_id'); - $csv = ""; - + + + $header = array(); + $data = array(); + + $i=0; foreach ($list as $d) { - $csv .= H::fd($d->document_date) . ';'; - $csv .= $d->document_number . ';'; - - $csv .= $d->customer_name . ';'; - $csv .= $d->amount . ';'; - $csv .= str_replace(';', '', $d->notes) . ';'; - $csv .= "\n"; + $i++; + $data['A'.$i] = H::fd($d->document_date) ; + $data['B'.$i] = $d->document_number ; + $data['C'.$i] = $d->customer_name ; + $data['D'.$i] = $d->amount ; + $data['E'.$i] = $d->notes ; + } - $csv = mb_convert_encoding($csv, "windows-1251", "utf-8"); - - - header("Content-type: text/csv"); - header("Content-Disposition: attachment;Filename=selllist.csv"); - header("Content-Transfer-Encoding: binary"); - - echo $csv; - flush(); - die; + + H::exportExcel($data,$header,'serlist.xlsx') ; + + + } } diff --git a/www/app/pages/register/tasklist.php b/www/app/pages/register/tasklist.php index 779789a34..30cd0980f 100644 --- a/www/app/pages/register/tasklist.php +++ b/www/app/pages/register/tasklist.php @@ -356,29 +356,26 @@ public function OnFilter($sender) { public function oncsv($sender) { $list = $this->tasktab->tasklist->getDataSource()->getItems(-1, -1, 'document_id'); - $csv = ""; - + + + $header = array(); + $data = array(); + + $i=0; foreach ($list as $task) { - $csv .= $task->document_number . ','; - - $csv .= str_replace(',', '', $task->notes) . ';'; - $csv .= H::fdt($task->document_date) . ';'; - $csv .= $task->headerdata['taskhours'] . ';'; - $csv .= Document::getStateName($task->state) . ';'; - $csv .= $task->amount . ';'; - - $csv .= "\n"; + $i++; + $data['A'.$i] = $task->document_number ; + $data['B'.$i] = $task->notes ; + $data['C'.$i] = H::fdt($task->document_date) ; + $data['D'.$i] = $task->headerdata['taskhours'] ; + $data['E'.$i] = Document::getStateName($task->state) ; + $data['F'.$i] = $task->notes ; + } - $csv = mb_convert_encoding($csv, "windows-1251", "utf-8"); - - - header("Content-type: text/csv"); - header("Content-Disposition: attachment;Filename=taskslist.csv"); - header("Content-Transfer-Encoding: binary"); - - echo $csv; - flush(); - die; + + H::exportExcel($data,$header,'taskslist.xlsx') ; + + } } diff --git a/www/app/pages/service/export.php b/www/app/pages/service/export.php index d87d7c6a6..7fece7839 100644 --- a/www/app/pages/service/export.php +++ b/www/app/pages/service/export.php @@ -16,10 +16,7 @@ use Zippy\Html\DataList\DataView; use Zippy\Html\Form\CheckBox; use Zippy\Html\Label; -use PhpOffice\PhpSpreadsheet\IOFactory; -use PhpOffice\PhpSpreadsheet\Writer\Xlsx; -use PhpOffice\PhpSpreadsheet\Spreadsheet; -use PhpOffice\PhpSpreadsheet\Style\{Font, Border, Alignment}; + class Export extends \App\Pages\Base { @@ -30,81 +27,14 @@ public function __construct() { if (false == \App\ACL::checkShowSer('Export')) { return; } - /* -$spreadsheet = new Spreadsheet(); -//Получаем текущий активный лист -$sheet = $spreadsheet->getActiveSheet(); -// Записываем в ячейку A1 данные -$sheet->setCellValue('A1', 'Тест'); -$sheet->getStyle('A1')->applyFromArray([ - 'font' => [ - 'name' => 'Arial', - 'bold' => true, - 'italic' => false, - 'underline' => Font::UNDERLINE_DOUBLE, - 'strikethrough' => false, - 'color' => [ - 'rgb' => '808080' - ] - ], - 'borders' => [ - 'allBorders' => [ - 'borderStyle' => Border::BORDER_THIN, - 'color' => [ - 'rgb' => '808080' - ] - ], - ], - 'alignment' => [ - 'horizontal' => Alignment::HORIZONTAL_CENTER, - 'vertical' => Alignment::VERTICAL_CENTER, - 'wrapText' => true, - ] -]); -$writer = new Xlsx($spreadsheet); -//Сохраняем файл в текущей папке, в которой выполняется скрипт. -//Чтобы указать другую папку для сохранения. -//Прописываем полный путь до папки и указываем имя файла - - - - - - header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); - header('Content-Disposition: attachment; filename="test.xlsx"'); - $writer->save('php://output'); - $sNewFile = 'c:/Users/leonm/Downloads/items_2020_12_28.csv'; - - $oSpreadsheet = IOFactory::load($sNewFile); // Вариант и для xls и xlsX - - - $oCells = $oSpreadsheet->getActiveSheet()->getCellCollection(); - - for ($iRow = 1; $iRow <= $oCells->getHighestRow(); $iRow++) - { - - for ($iCol = 'A'; $iCol <= $oCells->getHighestColumn(); $iCol++) - { - $oCell = $oCells->get($iCol.$iRow); - if($oCell) - { - echo $oCell->getValue() . '
'; - } - } - echo '
'; - } - - */ $form = $this->add(new Form("iform")); $form->add(new DropDownChoice("itype", array(), 0))->onChange($this, "onType"); - $form->add(new DropDownChoice("encode", array(1 => 'UTF8', 2 => 'win1251'), 0)); $form->add(new DropDownChoice("price", Item::getPriceTypeList())); $form->add(new DropDownChoice("store", Store::getList(), H::getDefStore())); - $form->add(new TextInput("sep", ';')); $form->onSubmit($this, "onExport"); @@ -113,16 +43,14 @@ public function __construct() { $form = $this->add(new Form("cform")); $form->add(new DropDownChoice("ctype", array(), 0)); - $form->add(new DropDownChoice("cencode", array(1 => 'UTF8', 2 => 'win1251'), 0)); - $form->add(new TextInput("csep", ';')); + $form->onSubmit($this, "onCExport"); $form = $this->add(new Form("dform")); $form->add(new DropDownChoice("dtype", array('GoodsReceipt' => Document::getDesc('GoodsReceipt'), 'GoodsIssue' => Document::getDesc('GoodsIssue')), 'GoodsReceipt')); - $form->add(new DropDownChoice("dencode", array(1 => 'UTF8', 2 => 'win1251'), 0)); - $form->add(new TextInput("dsep", ';')); + $form->add(new Date('dfrom', time() - (7 * 24 * 3600))); $form->add(new Date('dto', time() + (1 * 24 * 3600))); @@ -142,18 +70,8 @@ public function onType($sender) { public function onCExport($sender) { $t = $this->cform->ctype->getValue(); - $encode = $this->cform->cencode->getValue(); - - $sep = $this->cform->csep->getText(); - - if ($encode == 0) { - $this->setError('noselencode'); - return; - } - - $csv = "Наименование{$sep}Телефон{$sep}Email{$sep}Город{$sep}Адрес{$sep}"; - - $csv .= "\n\n"; + + $sql = " status=" . Customer::STATUS_ACTUAL; if ($t > 0) { @@ -161,82 +79,90 @@ public function onCExport($sender) { $sql .= " and detail like '%{$t}%' "; } $list = Customer::find($sql, "customer_name asc"); + + $header = array(); + $data = array(); + + $header['A1'] = "Наименование"; + $header['B1'] = "Телефон"; + $header['C1'] = "Email"; + $header['D1'] = "Город"; + $header['E1'] = "Адрес"; + + + + $i=1; foreach ($list as $item) { - - $csv .= $item->customer_name . $sep; - $csv .= $item->phone . $sep; - $csv .= $item->email . $sep; - $csv .= $item->city . $sep; - $csv .= $item->address . $sep; - - $csv .= "\n"; - } - if ($encode == 2) { - $csv = mb_convert_encoding($csv, "windows-1251", "utf-8"); + $i++; + $data['A'.$i] = $item->customer_name; + $data['B'.$i] = $item->phone ; + $data['C'.$i] = $item->email ; + $data['D'.$i] = $item->city ; + $data['E'.$i] = $item->address ; + + + } - - - header("Content-type: text/csv"); - header("Content-Disposition: attachment;Filename=customers_" . date('Y_m_d', time()) . ".csv"); - header("Content-Transfer-Encoding: binary"); - - echo $csv; - flush(); - die; + + H::exportExcel($data,$header,'customers_' . date('Y_m_d', time()) .'.xlsx') ; + + } public function onExport($sender) { $t = $this->iform->itype->getValue(); $store = $this->iform->store->getValue(); $pt = $this->iform->price->getValue(); - $encode = $this->iform->encode->getValue(); - - $sep = $this->iform->sep->getText(); - - if ($encode == 0) { - $this->setError('noselencode'); - return; - } - - - $csv = "Наименование{$sep}Ед.{$sep}Группа{$sep}Бренд{$sep}Артикул{$sep}Штрих код{$sep}Цена{$sep}"; - if ($t == 1) { - $csv = "Наименование{$sep}Ед.{$sep}Группа{$sep}Бренд{$sep}Артикул{$sep}Штрих код{$sep}Кол{$sep}Цена{$sep}"; - } - $csv .= "\n\n"; - + $sql = "disabled <> 1 "; $list = Item::find($sql, "itemname asc"); - + + + $header = array(); + $data = array(); + + $header['A1'] = "Наименование"; + $header['B1'] = "Ед."; + $header['C1'] = "Группа"; + $header['D1'] = "Бренд"; + $header['E1'] = "Артикул"; + $header['F1'] = "Штрих код"; + $header['G1'] = "Цена"; + if ($t == 1) $header['H1'] = "Кол."; + + + + $i=1; foreach ($list as $item) { - $price = H::fa($item->getPrice($pt)); - - $csv .= $item->itemname . $sep; - $csv .= $item->msr . $sep; - $csv .= $item->cat_name . $sep; - $csv .= $item->manufacturer . $sep; - $csv .= $item->item_code . $sep; - $csv .= $item->bar_code . $sep; + $i++; + $data['A'.$i] = $item->itemname; + $data['B'.$i] = $item->msr ; + $data['C'.$i] = $item->cat_name ; + $data['D'.$i] = $item->manufacturer ; + $data['E'.$i] = $item->item_code ; + $data['F'.$i] = $item->bar_code ; + $price = H::fa($item->getPrice($pt)); + $data['G'.$i] = H::fa($price) ; + if ($t == 1) { $qty = H::fqty($item->getQuantity($store)); - $csv .= $qty . $sep; + $data['H'.$i] = H::fqty($qty) ; } - $csv .= "\n"; - } - if ($encode == 2) { - $csv = mb_convert_encoding($csv, "windows-1251", "utf-8"); + + + } + + H::exportExcel($data,$header,'items_' . date('Y_m_d', time()) .'.xlsx') ; + + + + - header("Content-type: text/csv"); - header("Content-Disposition: attachment;Filename=items_" . date('Y_m_d', time()) . ".csv"); - header("Content-Transfer-Encoding: binary"); - - echo $csv; - flush(); - die; - + + } @@ -263,50 +189,38 @@ public function expDRow($row) { } public function onDExport($sender) { - $encode = $this->dform->dencode->getValue(); - - $sep = $this->dform->dsep->getText(); - - if ($encode == 0) { - $this->setError('noselencode'); - return; - } - $csv = ""; - + + $header = array(); + $data = array(); + + + + $i=0; foreach ($this->_docs as $doc) { - if ($doc->ch == false) { - continue; - } - - $csv .= $doc->document_number . $sep; - $csv .= H::fd($doc->document_date) . $sep; - $csv .= $doc->customer_name . $sep; - $csv .= "\n"; - $n = 1; - - foreach ($doc->unpackDetails('detaildata') as $item) { - $csv .= $sep . $n . $sep; - $csv .= $item->itemname . $sep; - $csv .= $item->item_code . $sep; - $csv .= H::fqty($item->quantity) . $sep; - $csv .= H::fa($item->price) . $sep; - $csv .= "\n"; - } - $csv .= "Итого: " . $sep; - $csv .= H::fa($doc->amount) . $sep . $sep . $sep . $sep . $sep; - $csv .= "\n"; - + $i++; + $data['A'.$i] = $doc->document_number; + $data['B'.$i] = H::fd($doc->document_date) ; + $data['C'.$i] = $doc->customer_name ; + $n=1; + foreach ($doc->unpackDetails('detaildata') as $item) { + $i++; + $data['B'.$i] = $n++ ; + $data['C'.$i] = $item->itemname; + $data['D'.$i] = $item->item_code ; + $data['E'.$i] = H::fqty($item->quantity) ; + $data['F'.$i] = H::fa($item->price) ; + + } + + $i++; + $data['A'.$i] = H::l("total").": "; + $data['B'.$i] = H::fa($doc->amount); + $i++; } - if ($encode == 2) { - $csv = mb_convert_encoding($csv, "windows-1251", "utf-8"); - } - header("Content-type: text/csv"); - header("Content-Disposition: attachment;Filename=exportdoc_" . date('Y_m_d', time()) . ".csv"); - header("Content-Transfer-Encoding: binary"); - - echo $csv; - flush(); - die; + + H::exportExcel($data,$header,'exportdoc_' . date('Y_m_d', time()) .'.xlsx') ; + + } diff --git a/www/app/pages/service/import.php b/www/app/pages/service/import.php index f83a1fa0a..d3a1eae18 100644 --- a/www/app/pages/service/import.php +++ b/www/app/pages/service/import.php @@ -27,12 +27,12 @@ public function __construct() { $form = $this->add(new Form("iform")); $form->add(new DropDownChoice("itype", array(), 0))->onChange($this, "onType"); - $form->add(new DropDownChoice("encode", array(1 => 'UTF8', 2 => 'win1251'), 0)); + $form->add(new DropDownChoice("price", Item::getPriceTypeList())); $form->add(new DropDownChoice("store", Store::getList(), H::getDefStore())); - $form->add(new TextInput("sep", ';')); + $form->add(new \Zippy\Html\Form\File("filename")); - $cols = array(0 => '-', 1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10); + $cols = array(0 => '-', 'A' => 'A', 'B' => 'B', 'C' => 'C', 'D' => 'D', 'E' => 'E', 'F' => 'F', 'G' => 'G', 'H' => 'H', 'I' => 'I', 'J' => 'J'); $form->add(new DropDownChoice("colname", $cols)); $form->add(new DropDownChoice("colcode", $cols)); $form->add(new DropDownChoice("colbarcode", $cols)); @@ -54,12 +54,12 @@ public function __construct() { $form = $this->add(new Form("nform")); - $form->add(new DropDownChoice("nencode", array(1 => 'UTF8', 2 => 'win1251'), 0)); + $form->add(new DropDownChoice("nstore", Store::getList(), H::getDefStore())); - $form->add(new TextInput("nsep", ';')); + $form->add(new AutocompleteTextInput("ncust"))->onText($this, 'OnAutoCustomer'); $form->add(new \Zippy\Html\Form\File("nfilename")); - $cols = array(0 => '-', 1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10); + $form->add(new DropDownChoice("ncolname", $cols)); $form->add(new DropDownChoice("ncolcode", $cols)); $form->add(new DropDownChoice("ncolqty", $cols)); @@ -74,8 +74,8 @@ public function __construct() { $form = $this->add(new Form("cform")); $form->add(new DropDownChoice("ctype", array(), 0)); - $form->add(new DropDownChoice("cencode", array(1 => 'UTF8', 2 => 'win1251'), 0)); - $form->add(new TextInput("csep", ';')); + + $form->add(new CheckBox("cpreview")); $form->add(new CheckBox("cpassfirst")); $form->add(new DropDownChoice("colcname", $cols)); @@ -110,7 +110,7 @@ public function onImport($sender) { $t = $this->iform->itype->getValue(); $store = $this->iform->store->getValue(); $pt = $this->iform->price->getValue(); - $encode = $this->iform->encode->getValue(); + $preview = $this->iform->preview->isChecked(); $passfirst = $this->iform->passfirst->isChecked(); $this->_tvars['preview'] = false; @@ -124,17 +124,11 @@ public function onImport($sender) { $colinprice = $this->iform->colinprice->getValue(); $colmsr = $this->iform->colmsr->getValue(); $colbrand = $this->iform->colbrand->getValue(); - $sep = $this->iform->sep->getText(); - - if ($encode == 0) { - $this->setError('noselencode'); - return; - } - if ($colname == 0) { + if ($colname === '0') { $this->setError('noselcolname'); return; } - if ($t == 1 && $colqty == 0) { + if ($t == 1 && $colqty === '0') { $this->setError('noselcolqty'); return; } @@ -146,20 +140,30 @@ public function onImport($sender) { } $data = array(); - if (($handle = fopen($file['tmp_name'], "r")) !== FALSE) { - - while(($row = fgets($handle)) !== FALSE) { - if ($encode == 2) { - $row = mb_convert_encoding($row, "utf-8", "windows-1251"); - } - if ($passfirst == true) { - $passfirst = false; - continue; - } - $data[] = explode($sep, trim($row)); - } - } - fclose($handle); + $oSpreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($file['tmp_name']); // Вариант и для xls и xlsX + + + $oCells = $oSpreadsheet->getActiveSheet()->getCellCollection(); + + for ($iRow = ($passfirst ? 2:1); $iRow <= $oCells->getHighestRow(); $iRow++) + { + + $row = array(); + for ($iCol = 'A'; $iCol <= $oCells->getHighestColumn(); $iCol++) + { + $oCell = $oCells->get($iCol.$iRow); + if($oCell) + { + $row[$iCol] = $oCell->getValue(); + } + + } + $data[$iRow] = $row; + + + } + + unset($oSpreadsheet); if ($preview) { @@ -168,15 +172,15 @@ public function onImport($sender) { foreach ($data as $row) { $this->_tvars['list'][] = array( - 'colname' => $row[$colname - 1], - 'colcode' => $row[$colcode - 1], - 'colbarcode' => $row[$colbarcode - 1], - 'colgr' => $row[$colgr - 1], - 'colqty' => $row[$colqty - 1], - 'colmsr' => $row[$colmsr - 1], - 'colinprice' => $row[$colinprice - 1], - 'colprice' => $row[$colprice - 1], - 'colbrand' => $row[$colbrand - 1] + 'colname' => $row[$colname ], + 'colcode' => $row[$colcode ], + 'colbarcode' => $row[$colbarcode ], + 'colgr' => $row[$colgr ], + 'colqty' => $row[$colqty ], + 'colmsr' => $row[$colmsr ], + 'colinprice' => $row[$colinprice ], + 'colprice' => $row[$colprice ], + 'colbrand' => $row[$colbrand ] ); } return; @@ -186,7 +190,7 @@ public function onImport($sender) { $newitems = array(); foreach ($data as $row) { - $catname = $row[$colgr - 1]; + $catname = $row[$colgr ]; if (strlen($catname) > 0) { $cat = Category::getFirst('cat_name=' . Category::qstr($catname)); if ($cat == null) { @@ -196,8 +200,8 @@ public function onImport($sender) { } } $item = null; - $itemname = trim($row[$colname - 1]); - $itemcode = trim($row[$colcode - 1]); + $itemname = trim($row[$colname ]); + $itemcode = trim($row[$colcode ]); if (strlen($itemname) > 0) { if (strlen($itemcode) > 0) { @@ -209,22 +213,22 @@ public function onImport($sender) { if ($item == null) { - $price = str_replace(',', '.', trim($row[$colprice - 1])); - $inprice = str_replace(',', '.', trim($row[$colinprice - 1])); - $qty = str_replace(',', '.', trim($row[$colqty - 1])); + $price = str_replace(',', '.', trim($row[$colprice ])); + $inprice = str_replace(',', '.', trim($row[$colinprice ])); + $qty = str_replace(',', '.', trim($row[$colqty ])); $item = new Item(); $item->itemname = $itemname; - if (strlen($row[$colcode - 1]) > 0) { - $item->item_code = trim($row[$colcode - 1]); + if (strlen($row[$colcode ]) > 0) { + $item->item_code = trim($row[$colcode ]); } - if (strlen($row[$colbarcode - 1]) > 0) { - $item->bar_code = trim($row[$colbarcode - 1]); + if (strlen($row[$colbarcode ]) > 0) { + $item->bar_code = trim($row[$colbarcode ]); } - if (strlen($row[$colmsr - 1]) > 0) { - $item->msr = trim($row[$colmsr - 1]); + if (strlen($row[$colmsr ]) > 0) { + $item->msr = trim($row[$colmsr ]); } - if (strlen($row[$colbrand - 1]) > 0) { - $item->manufacturer = trim($row[$colbrand - 1]); + if (strlen($row[$colbrand ]) > 0) { + $item->manufacturer = trim($row[$colbrand ]); } if ($price > 0) { $item->{$pt} = $price; @@ -266,7 +270,7 @@ public function onImport($sender) { $doc->amount = H::fa($amount); $doc->payamount = 0; $doc->payed = 0; - $doc->notes = 'Импорт с csv'; + $doc->notes = 'Импорт с Excel'; $doc->headerdata['store'] = $store; $doc->save(); @@ -283,7 +287,7 @@ public function onImport($sender) { public function onCImport($sender) { $t = $this->cform->ctype->getValue(); - $encode = $this->cform->cencode->getValue(); + $preview = $this->cform->cpreview->isChecked(); $passfirst = $this->cform->cpassfirst->isChecked(); $this->_tvars['preview2'] = false; @@ -293,13 +297,9 @@ public function onCImport($sender) { $colemail = $this->cform->colemail->getValue(); $colcity = $this->cform->colcity->getValue(); $coladdress = $this->cform->coladdress->getValue(); - $sep = $this->cform->csep->getText(); + - if ($encode == 0) { - $this->setError('noselencode'); - return; - } - if ($colcname == 0) { + if ($colcname === '0') { $this->setError('noselcolname'); return; } @@ -309,24 +309,38 @@ public function onCImport($sender) { $this->setError('noselfile'); return; } - - $data = array(); - if (($handle = fopen($file['tmp_name'], "r")) !== FALSE) { - - while(($row = fgets($handle)) !== FALSE) { - if ($encode == 2) { - $row = mb_convert_encoding($row, "utf-8", "windows-1251"); - } - if ($passfirst == true) { - $passfirst = false; - continue; - } - - $data[] = explode($sep, trim($row)); - } - } - fclose($handle); - + + + $data = array(); + + $oSpreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($file['tmp_name']); // Вариант и для xls и xlsX + + + $oCells = $oSpreadsheet->getActiveSheet()->getCellCollection(); + + for ($iRow = ($passfirst ? 2:1); $iRow <= $oCells->getHighestRow(); $iRow++) + { + + $row = array(); + for ($iCol = 'A'; $iCol <= $oCells->getHighestColumn(); $iCol++) + { + $oCell = $oCells->get($iCol.$iRow); + if($oCell) + { + $row[$iCol] = $oCell->getValue(); + } + + } + $data[$iRow] = $row; + + + } + + unset($oSpreadsheet); + + + + if ($preview) { $this->_tvars['preview2'] = true; @@ -334,11 +348,11 @@ public function onCImport($sender) { foreach ($data as $row) { $this->_tvars['list2'][] = array( - 'colname' => $row[$colcname - 1], - 'colphone' => $row[$colphone - 1], - 'colemail' => $row[$colemail - 1], - 'colcity' => $row[$colcity - 1], - 'coladdress' => $row[$coladdress - 1] + 'colname' => $row[$colcname ], + 'colphone' => $row[$colphone ], + 'colemail' => $row[$colemail ], + 'colcity' => $row[$colcity ], + 'coladdress' => $row[$coladdress ] ); } return; @@ -349,8 +363,8 @@ public function onCImport($sender) { foreach ($data as $row) { $c = null; - $name = $row[$colcname - 1]; - $phone = $row[$colphone - 1]; + $name = $row[$colcname ]; + $phone = $row[$colphone ]; if (strlen(trim($name)) == 0) { continue; @@ -366,17 +380,17 @@ public function onCImport($sender) { $c->type = $t; $c->customer_name = $name; - if (strlen($row[$colphone - 1]) > 0) { - $c->phone = $row[$colphone - 1]; + if (strlen($row[$colphone ]) > 0) { + $c->phone = $row[$colphone ]; } - if (strlen($row[$colemail - 1]) > 0) { - $c->email = $row[$colemail - 1]; + if (strlen($row[$colemail ]) > 0) { + $c->email = $row[$colemail ]; } - if (strlen($row[$colcity - 1]) > 0) { - $c->city = $row[$colcity - 1]; + if (strlen($row[$colcity ]) > 0) { + $c->city = $row[$colcity ]; } - if (strlen($row[$coladdress - 1]) > 0) { - $c->address = $row[$coladdress - 1]; + if (strlen($row[$coladdress ]) > 0) { + $c->address = $row[$coladdress ]; } @@ -396,7 +410,7 @@ public function onCImport($sender) { public function onNImport($sender) { $store = $this->nform->nstore->getValue(); $c = $this->nform->ncust->getKey(); - $encode = $this->nform->nencode->getValue(); + $preview = $this->nform->npreview->isChecked(); $passfirst = $this->nform->npassfirst->isChecked(); $this->_tvars['preview3'] = false; @@ -407,17 +421,13 @@ public function onNImport($sender) { $colqty = $this->nform->ncolqty->getValue(); $colprice = $this->nform->ncolprice->getValue(); $colmsr = $this->nform->ncolmsr->getValue(); - $sep = $this->nform->nsep->getText(); + - if ($encode == 0) { - $this->setError('noselencode'); - return; - } - if ($colname == 0) { + if ($colname === '0') { $this->setError('noselcolname'); return; } - if ($colqty == 0) { + if ($colqty === '0') { $this->setError('noselcolqty'); return; } @@ -435,21 +445,30 @@ public function onNImport($sender) { } $data = array(); - if (($handle = fopen($file['tmp_name'], "r")) !== FALSE) { - - while(($row = fgets($handle)) !== FALSE) { - if ($encode == 2) { - $row = mb_convert_encoding($row, "utf-8", "windows-1251"); - } - if ($passfirst == true) { - $passfirst = false; - continue; - } - - $data[] = explode($sep, trim($row)); - } - } - fclose($handle); + $oSpreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($file['tmp_name']); // Вариант и для xls и xlsX + + + $oCells = $oSpreadsheet->getActiveSheet()->getCellCollection(); + + for ($iRow = ($passfirst ? 2:1); $iRow <= $oCells->getHighestRow(); $iRow++) + { + + $row = array(); + for ($iCol = 'A'; $iCol <= $oCells->getHighestColumn(); $iCol++) + { + $oCell = $oCells->get($iCol.$iRow); + if($oCell) + { + $row[$iCol] = $oCell->getValue(); + } + + } + $data[$iRow] = $row; + + + } + + unset($oSpreadsheet); if ($preview) { @@ -458,11 +477,11 @@ public function onNImport($sender) { foreach ($data as $row) { $this->_tvars['list'][] = array( - 'colname' => $row[$colname - 1], - 'colcode' => $row[$colcode - 1], - 'colqty' => $row[$colqty - 1], - 'colmsr' => $row[$colmsr - 1], - 'colprice' => $row[$colprice - 1] + 'colname' => $row[$colname ], + 'colcode' => $row[$colcode ], + 'colqty' => $row[$colqty ], + 'colmsr' => $row[$colmsr ], + 'colprice' => $row[$colprice ] ); } return; @@ -474,8 +493,8 @@ public function onNImport($sender) { $item = null; - $itemname = trim($row[$colname - 1]); - $itemcode = trim($row[$colcode - 1]); + $itemname = trim($row[$colname ]); + $itemcode = trim($row[$colcode ]); if (strlen($itemname) > 0) { if (strlen($itemcode) > 0) { @@ -485,17 +504,17 @@ public function onNImport($sender) { $item = Item::getFirst('itemname=' . Item::qstr($itemname)); } - $price = str_replace(',', '.', trim($row[$colprice - 1])); - $qty = str_replace(',', '.', trim($row[$colqty - 1])); + $price = str_replace(',', '.', trim($row[$colprice ])); + $qty = str_replace(',', '.', trim($row[$colqty ])); if ($item == null) { $item = new Item(); $item->itemname = $itemname; - if (strlen($row[$colcode - 1]) > 0) { - $item->item_code = trim($row[$colcode - 1]); + if (strlen($row[$colcode ]) > 0) { + $item->item_code = trim($row[$colcode ]); } if (strlen($row[$colmsr - 1]) > 0) { - $item->msr = trim($row[$colmsr - 1]); + $item->msr = trim($row[$colmsr ]); } @@ -530,7 +549,7 @@ public function onNImport($sender) { $doc->amount = H::fa($amount); $doc->payamount = 0; $doc->payed = 0; - $doc->notes = 'Импорт с csv'; + $doc->notes = 'Импорт с Excel'; $doc->headerdata['store'] = $store; $doc->customer_id = $c; $doc->headerdata['customer_name'] = $this->nform->ncust->getText(); diff --git a/www/templates/lang.json b/www/templates/lang.json index feb5745c6..895844f27 100644 --- a/www/templates/lang.json +++ b/www/templates/lang.json @@ -325,6 +325,7 @@ "valusd": "Доллар", "valeuro": "Евро", "valrub": "Рубль", + "total": "Итого", "refreshed": "Обновлено", "sent": "Отправлено", diff --git a/www/templates/pages/service/export.html b/www/templates/pages/service/export.html index e2c04a12b..70a3d2735 100644 --- a/www/templates/pages/service/export.html +++ b/www/templates/pages/service/export.html @@ -27,21 +27,7 @@

Экспорт документов

-
- -
- -
-
-
- -
- - -
-
+
@@ -101,17 +87,7 @@

Экспорт номенклатуры

-
- - -
-
- - - -
+
@@ -136,17 +112,7 @@

Экспорт контрагентов

-
- - -
-
- - - -
+
diff --git a/www/templates/pages/service/import.html b/www/templates/pages/service/import.html index 6ae50e302..fa6b2ff26 100644 --- a/www/templates/pages/service/import.html +++ b/www/templates/pages/service/import.html @@ -6,7 +6,7 @@

Импорт номенклатуры @@ -33,17 +33,7 @@

Импорт номенклатуры -
- - - -
-
- - -
+
@@ -63,7 +53,7 @@

Импорт номенклатуры

- +
@@ -153,7 +143,7 @@

Импорт номенклатуры

Импорт накладной

-
- - - -
-
- - -
+
@@ -205,7 +185,7 @@

Импорт накладной

- +
@@ -275,7 +255,7 @@

Импорт накладной

Импорт контрагентов @@ -296,18 +276,7 @@

Импорт контрагентов

- -
- - - -
-
- - -
+
@@ -330,7 +299,7 @@

Импорт контрагентов

- +
diff --git a/www/templates_ua/lang.json b/www/templates_ua/lang.json index 0e0913e85..21526954f 100644 --- a/www/templates_ua/lang.json +++ b/www/templates_ua/lang.json @@ -315,6 +315,7 @@ "valusd": "Долар", "valeuro": "Євро", "valrub": "Рубль", + "total": "Всього", "refreshed": "Оновлено", "sent": "Відправлено", diff --git a/www/templates_ua/pages/service/export.html b/www/templates_ua/pages/service/export.html index 0b247d7da..69a542446 100644 --- a/www/templates_ua/pages/service/export.html +++ b/www/templates_ua/pages/service/export.html @@ -27,21 +27,7 @@

Експорт документів

-
- -
- -
-
-
- -
- - -
-
+
@@ -101,17 +87,7 @@

Експорт номенклатури

-
- - -
-
- - - -
+
@@ -136,17 +112,7 @@

Експорт контрагентів

-
- - -
-
- - - -
+
diff --git a/www/templates_ua/pages/service/import.html b/www/templates_ua/pages/service/import.html index 7459b0d8a..a0859ea18 100644 --- a/www/templates_ua/pages/service/import.html +++ b/www/templates_ua/pages/service/import.html @@ -6,7 +6,7 @@

Імпорт номенклатури @@ -20,7 +20,7 @@

Імпорт номенклатури

@@ -33,17 +33,7 @@

Імпорт номенклатури

-
- - - -
-
- - -
+
@@ -64,7 +54,7 @@

Імпорт номенклатури

- +
@@ -155,7 +145,7 @@

Імпорт номенклатури

Імпорт накладної

-
- - - -
-
- - -
+
@@ -206,7 +186,7 @@

Імпорт накладної

- +
@@ -277,7 +257,7 @@

Імпорт накладної

Імпорт контрагентів @@ -300,17 +280,7 @@

Імпорт контрагентів

-
- - - -
-
- - -
+
@@ -333,7 +303,7 @@

Імпорт контрагентів

- +
From c39618a48de0c787fcfdead132ae747fa0f25c09 Mon Sep 17 00:00:00 2001 From: Leon Date: Tue, 29 Dec 2020 17:08:41 +0200 Subject: [PATCH 10/11] check --- www/app/pages/doc/poscheck.php | 40 +++++++++++++++++++++++- www/app/pages/doc/returnissue.php | 4 +-- www/templates/lang.json | 1 + www/templates/pages/doc/poscheck.html | 6 ++++ www/templates_ua/lang.json | 1 + www/templates_ua/pages/doc/poscheck.html | 6 ++++ 6 files changed, 55 insertions(+), 3 deletions(-) diff --git a/www/app/pages/doc/poscheck.php b/www/app/pages/doc/poscheck.php index 100075b98..fbceab9e4 100644 --- a/www/app/pages/doc/poscheck.php +++ b/www/app/pages/doc/poscheck.php @@ -65,7 +65,7 @@ public function __construct($docid = 0, $basedocid = 0) { $this->docform->add(new SubmitLink('addcode'))->onClick($this, 'addcodeOnClick'); $this->docform->add(new DropDownChoice('store', Store::getList(), H::getDefStore()))->onChange($this, 'OnChangeStore'); - // $this->docform->add(new DropDownChoice('pos', \App\Entity\Pos::find(''))); + $this->docform->add(new DropDownChoice('pos', \App\Entity\Pos::findArray('pos_name', ''))); $this->docform->add(new SubmitLink('addcust'))->onClick($this, 'addcustOnClick'); @@ -479,7 +479,42 @@ public function savedocOnClick($sender) { $this->_doc->packDetails('detaildata', $this->_itemlist); $this->_doc->packDetails('services', $this->_serlist); $this->_doc->amount = $this->docform->total->getText(); + $this->_doc->headerdata['pos'] = $this->docform->pos->getValue(); + + $pos = \App\Entity\Pos::load($this->_doc->headerdata['pos']); + + if ($pos->usefisc == 1 && $sender->id == 'execdoc') { + + $ret = \App\Modules\PPO\PPOHelper::check($this->_doc); + if ($ret['success'] == false && $ret['docnumber'] > 0) { + //повторяем для нового номера + $pos->fiscdocnumber = $ret['docnumber']; + $pos->save(); + $ret = \App\Modules\PPO\PPOHelper::check($this->_doc); + + } + if ($ret['success'] == false) { + $this->setError($ret['data']); + return; + } else { + // $this->setSuccess("Выполнено") ; + if ($ret['docnumber'] > 0) { + $pos->fiscdocnumber = $ret['doclocnumber'] + 1; + $pos->save(); + $this->_doc->headerdata["fiscalnumber"] = $ret['docnumber']; + } else { + $this->setError("ppo_noretnumber"); + return; + + } + + } + + } + + + $isEdited = $this->_doc->document_id > 0; $conn = \ZDB\DB::getConnect(); @@ -744,6 +779,9 @@ private function checkForm() { if (($this->docform->store->getValue() > 0) == false) { $this->setError("noselstore"); } + if (($this->docform->pos->getValue() > 0) == false) { + $this->setError("noselposterm"); + } $p = $this->docform->payment->getValue(); $c = $this->docform->customer->getKey(); if ($p == 0) { diff --git a/www/app/pages/doc/returnissue.php b/www/app/pages/doc/returnissue.php index bf336518d..1e1df3ac0 100644 --- a/www/app/pages/doc/returnissue.php +++ b/www/app/pages/doc/returnissue.php @@ -257,9 +257,9 @@ public function savedocOnClick($sender) { $isEdited = $this->_doc->document_id > 0; - $pos_id = $this->docform->pos->getValue(); + $pos_id = $this->docform->pos->getValue(); - if($pos_id>0) { + if($pos_id>0 && $sender->id == 'execdoc') { $pos = \App\Entity\Pos::load($pos_id); if ($this->_basedocid > 0) { diff --git a/www/templates/lang.json b/www/templates/lang.json index 895844f27..e96ea44ec 100644 --- a/www/templates/lang.json +++ b/www/templates/lang.json @@ -326,6 +326,7 @@ "valeuro": "Евро", "valrub": "Рубль", "total": "Итого", + "noselposterm": "Не выбран POS терминал", "refreshed": "Обновлено", "sent": "Отправлено", diff --git a/www/templates/pages/doc/poscheck.html b/www/templates/pages/doc/poscheck.html index 3d3c3e8ad..f946cc71e 100644 --- a/www/templates/pages/doc/poscheck.html +++ b/www/templates/pages/doc/poscheck.html @@ -30,6 +30,12 @@

Кассовый чек

Добавить нового
+
+ + +
diff --git a/www/templates_ua/lang.json b/www/templates_ua/lang.json index 21526954f..90e4d6669 100644 --- a/www/templates_ua/lang.json +++ b/www/templates_ua/lang.json @@ -316,6 +316,7 @@ "valeuro": "Євро", "valrub": "Рубль", "total": "Всього", + "noselposterm": "Не вибраний POS термiнал", "refreshed": "Оновлено", "sent": "Відправлено", diff --git a/www/templates_ua/pages/doc/poscheck.html b/www/templates_ua/pages/doc/poscheck.html index 015b147bf..95ffb342a 100644 --- a/www/templates_ua/pages/doc/poscheck.html +++ b/www/templates_ua/pages/doc/poscheck.html @@ -30,6 +30,12 @@

Касовий чек

Додати нового
+
+ + +
From b83f045d45be8c25ee843468f6259596afd3e6c5 Mon Sep 17 00:00:00 2001 From: "HOME\\leonm" Date: Tue, 29 Dec 2020 20:26:05 +0200 Subject: [PATCH 11/11] v4.8.0 --- www/config/config.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www/config/config.ini b/www/config/config.ini index 99c24f795..d5273becc 100644 --- a/www/config/config.ini +++ b/www/config/config.ini @@ -29,5 +29,5 @@ note=1 ; модуль органайзера(базы знаний) issue=0 ; модуль Проекты и задачи woocomerce=0 ; интеграция с вукомерсе tecdoc=0 ; поиск по базе автозапчастей -ppo=1 ; фискализация +ppo=0 ; фискализация \ No newline at end of file

{{name}}
{{article}} {{price}}
{{{img}}}
{{barcode}}