diff --git a/README.md b/README.md
index 8a75ba017..a264de079 100644
--- a/README.md
+++ b/README.md
@@ -37,21 +37,22 @@ Zippy-склад
-Вимоги: PHP7.4+ Mysql 5.7+ (можлива робота з PostgerSQL)
+Вимоги: PHP8.0+ Mysql 5.7+
Налаштування системи.
--------------------
- Створити БД (кодування utf8_general_ci), виконати SQL скрипт /mysqldb/db.sql (/pgsqldb/db.sql для PostgreSql) .
+ Створити БД (кодування utf8_general_ci), виконати SQL скрипт /db/db.sql .
Зкопіювати вміст папки www у кореневий каталог сайту.
Виконати composer.json для завантаження сторонніх бібліотек (або зкачати [готову збірку](https://zippy.com.ua/download/fullzstore.zip) ).
Конфігураційні файли лежать у папці config.
- Встановити параметри з'єднання з базою даних у файлі config.php та задати налаштування поштового серверу.
+ Встановити параметри з'єднання з базою даних у файлі /config/config.php та задати налаштування поштового серверу.
В загальних налаштуваннях задати основнi параметри робочого оточення та увімкнути необхідні модулі .
Також необхідно переконатися, що дозволено право запису в папки uploads та logs.
Залогінитись дефолтним користувачем admin admin
- Змінити дефолтний пароль у профілі. Задати персональнi налаштування профiлю.
\ No newline at end of file
+ Змінити дефолтний пароль у профілі. Задати персональнi налаштування профiлю.
+
\ No newline at end of file
diff --git a/db/mysql/db.sql b/db/db.sql
similarity index 100%
rename from db/mysql/db.sql
rename to db/db.sql
diff --git a/db/postgresql/db.sql b/db/postgresql/db.sql
deleted file mode 100644
index 31d3bf54e..000000000
--- a/db/postgresql/db.sql
+++ /dev/null
@@ -1,1717 +0,0 @@
-CREATE TABLE branches (
- branch_id INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- branch_name CHARACTER VARYING(255) NOT NULL,
- details TEXT,
- disabled SMALLINT DEFAULT 0,
- CONSTRAINT PK_branches PRIMARY KEY (branch_id)
-);
-
-CREATE TABLE contracts (
- contract_id INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- customer_id INTEGER,
- firm_id INTEGER,
- createdon DATE NOT NULL,
- contract_number CHARACTER VARYING(64) NOT NULL,
- disabled SMALLINT DEFAULT 0,
- details TEXT NOT NULL,
- CONSTRAINT PK_contracts PRIMARY KEY (contract_id)
-);
-
-CREATE TABLE custitems (
- custitem_id INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- item_id INTEGER NOT NULL,
- customer_id INTEGER NOT NULL,
- quantity DECIMAL(10, 3) DEFAULT NULL,
- price DECIMAL(10, 2) NOT NULL DEFAULT 0.00,
- cust_code CHARACTER VARYING(255) NOT NULL,
- comment CHARACTER VARYING(255),
- updatedon DATE NOT NULL,
- CONSTRAINT PK_custitems PRIMARY KEY (custitem_id)
-
-);
-CREATE INDEX IF NOT EXISTS IX_custitems_item_id
-ON custitems (
- item_id
-);
-
-
-CREATE TABLE customers (
- customer_id INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- customer_name CHARACTER VARYING(255) DEFAULT NULL,
- detail TEXT NOT NULL,
- email CHARACTER VARYING(64),
- phone CHARACTER VARYING(64),
- status SMALLINT NOT NULL DEFAULT 0,
- city CHARACTER VARYING(255),
- leadstatus CHARACTER VARYING(255),
- leadsource CHARACTER VARYING(255),
- createdon DATE,
- country CHARACTER VARYING(255),
- passw CHARACTER VARYING(255),
- CONSTRAINT PK_customers PRIMARY KEY (customer_id)
-);
-CREATE TABLE docstatelog (
- log_id INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- user_id INTEGER NOT NULL,
- document_id INTEGER NOT NULL,
- docstate SMALLINT NOT NULL,
- createdon TIMESTAMP NOT NULL,
- hostname CHARACTER VARYING(64) NOT NULL,
- CONSTRAINT PK_docstatelog PRIMARY KEY (log_id)
-
-);
-CREATE INDEX IF NOT EXISTS IX_docstatelog_document_id
-ON docstatelog (
- document_id
-);
-CREATE TABLE users (
- user_id INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- userlogin CHARACTER VARYING(32) NOT NULL,
- userpass CHARACTER VARYING(255) NOT NULL,
- createdon DATE NOT NULL,
- email CHARACTER VARYING(255) DEFAULT NULL,
- acl TEXT NOT NULL,
- disabled SMALLINT NOT NULL DEFAULT 0,
- options TEXT,
- role_id INTEGER DEFAULT NULL,
- lastactive TIMESTAMP DEFAULT NULL,
- CONSTRAINT PK_users PRIMARY KEY (user_id)
-
-);
-CREATE UNIQUE INDEX IF NOT EXISTS IX_users_userlogin
-ON users (
- userlogin
-);
-
-CREATE TABLE documents (
- document_id INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- document_number CHARACTER VARYING(45) NOT NULL,
- document_date DATE NOT NULL,
- user_id INTEGER NOT NULL,
- content TEXT,
- amount DECIMAL(11, 2) DEFAULT NULL,
- meta_id INTEGER NOT NULL,
- state SMALLINT NOT NULL,
- notes CHARACTER VARYING(1024) NULL,
- customer_id INTEGER DEFAULT 0,
- payamount DECIMAL(11, 2) DEFAULT '0.00',
- payed DECIMAL(11, 2) DEFAULT '0.00',
- branch_id INTEGER DEFAULT 0,
- parent_id INTEGER DEFAULT 0,
- firm_id INTEGER DEFAULT NULL,
- lastupdate TIMESTAMP DEFAULT NULL,
- priority SMALLINT DEFAULT '100',
- CONSTRAINT PK_documents PRIMARY KEY (document_id),
- CONSTRAINT documents_ibfk_1 FOREIGN KEY (user_id) REFERENCES users (user_id)
-);
-
-CREATE INDEX IF NOT EXISTS IX_documents_document_date
-ON documents (
- document_date
-);
-CREATE INDEX IF NOT EXISTS IX_documents_customer_id
-ON documents (
- customer_id
-);
-CREATE INDEX IF NOT EXISTS IX_documents_user_id
-ON documents (
- user_id
-);
-CREATE INDEX IF NOT EXISTS IX_documents_branch_id
-ON documents (
- branch_id
-);
-
-CREATE UNIQUE INDEX IF NOT EXISTS IX_documents_unuqnumber
-ON documents (
- document_number,
- branch_id
-);
-
-
-CREATE TABLE items (
- item_id INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- itemname CHARACTER VARYING(255) DEFAULT NULL,
- description TEXT,
- detail TEXT NOT NULL,
- item_code CHARACTER VARYING(64) DEFAULT NULL,
- bar_code CHARACTER VARYING(64) DEFAULT NULL,
- cat_id INTEGER NOT NULL,
- msr CHARACTER VARYING(64) DEFAULT NULL,
- disabled SMALLINT DEFAULT 0,
- minqty DECIMAL(11, 3) DEFAULT 0.000,
- manufacturer CHARACTER VARYING(355) DEFAULT NULL,
- item_type SMALLINT DEFAULT NULL,
- CONSTRAINT PK_items PRIMARY KEY (item_id)
-
-);
-
-CREATE INDEX IF NOT EXISTS IX_items_item_code
-ON items (
- item_code
-);
-CREATE INDEX IF NOT EXISTS IX_items_itemname
-ON items (
- itemname
-);
-CREATE INDEX IF NOT EXISTS IX_items_cat_id
-ON items (
- cat_id
-);
-
-CREATE TABLE stores (
- store_id INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- storename CHARACTER VARYING(64) DEFAULT NULL,
- description CHARACTER VARYING(255) DEFAULT NULL,
- branch_id INTEGER DEFAULT 0,
- disabled SMALLINT DEFAULT 0,
- CONSTRAINT PK_stores PRIMARY KEY (store_id)
-);
-
-CREATE TABLE store_stock (
- stock_id INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- item_id INTEGER NULL,
- partion DECIMAL(11, 2) DEFAULT NULL,
- store_id INTEGER NOT NULL,
- qty DECIMAL(11, 3) DEFAULT '0.000',
- snumber CHARACTER VARYING(64) DEFAULT NULL,
- sdate DATE DEFAULT NULL,
- CONSTRAINT PK_store_stock PRIMARY KEY (stock_id),
-
- CONSTRAINT store_stock_fk FOREIGN KEY (store_id) REFERENCES stores (store_id),
- CONSTRAINT store_stock_ibfk_1 FOREIGN KEY (item_id) REFERENCES items (item_id)
-);
-
-CREATE INDEX IF NOT EXISTS IX_store_stock_item_id
-ON store_stock (
- item_id
-);
-CREATE INDEX IF NOT EXISTS IX_store_stock_store_id
-ON store_stock (
- store_id
-);
-
-
-CREATE TABLE empacc (
- ea_id INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- emp_id INTEGER NOT NULL,
- document_id INTEGER DEFAULT NULL,
- optype INTEGER DEFAULT NULL,
- createdon DATE DEFAULT NULL,
-
- amount DECIMAL(10, 2) NOT NULL,
- CONSTRAINT PK_empacc PRIMARY KEY (ea_id)
-
-);
-
-CREATE INDEX IF NOT EXISTS IX_empacc_emp_id
-ON empacc (
- emp_id
-);
-
-CREATE INDEX IF NOT EXISTS IX_empacc_document_id
-ON empacc (
- document_id
-);
-
-
-CREATE TABLE employees (
- employee_id INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- login CHARACTER VARYING(64) DEFAULT NULL,
- detail TEXT,
- disabled SMALLINT DEFAULT 0,
- emp_name CHARACTER VARYING(64) NOT NULL,
- branch_id INTEGER DEFAULT 0,
- CONSTRAINT PK_employees PRIMARY KEY (employee_id)
-);
-
-CREATE TABLE entrylist (
- entry_id BIGINT NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- document_id INTEGER NOT NULL,
- quantity DECIMAL(11, 3) DEFAULT '0.000',
- stock_id INTEGER DEFAULT NULL,
- service_id INTEGER DEFAULT NULL,
- outprice DECIMAL(10, 2) DEFAULT NULL,
- tag INTEGER DEFAULT 0,
- CONSTRAINT PK_entrylist PRIMARY KEY (entry_id),
- CONSTRAINT entrylist_ibfk_1 FOREIGN KEY (document_id) REFERENCES documents (document_id),
- CONSTRAINT entrylist_ibfk_2 FOREIGN KEY (stock_id) REFERENCES store_stock (stock_id)
-);
-CREATE INDEX IF NOT EXISTS IX_entrylist_document_id
-ON entrylist (
- document_id
-);
-
-
-CREATE OR REPLACE FUNCTION tr () RETURNS trigger
-AS $$
- BEGIN
-
- IF (TG_OP = 'DELETE') THEN
- IF old.stock_id >0 then
- update store_stock set qty=(select coalesce(sum(quantity),0) from entrylist where stock_id=old.stock_id) where store_stock.stock_id = old.stock_id;
- END IF;
- RETURN OLD;
-
- ELSIF (TG_OP = 'INSERT') THEN
- IF new.stock_id >0 then
- update store_stock set qty=(select coalesce(sum(quantity),0) from entrylist where stock_id=new.stock_id) where store_stock.stock_id = new.stock_id;
- END IF;
-
- RETURN NEW;
- END IF;
- RETURN NULL;
- END;
-$$
-LANGUAGE PLPGSQL;
-
-CREATE TRIGGER tr
-AFTER INSERT OR DELETE
-ON entrylist
-FOR EACH ROW
-EXECUTE PROCEDURE tr();
-
-
-
-CREATE TABLE equipments (
- eq_id INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- eq_name CHARACTER VARYING(255) DEFAULT NULL,
- detail TEXT,
- disabled SMALLINT DEFAULT 0,
- description TEXT,
- branch_id INTEGER NULL,
- CONSTRAINT PK_equipments PRIMARY KEY (eq_id)
-);
-
-
-CREATE TABLE eventlist (
- user_id INTEGER NOT NULL,
- eventdate TIMESTAMP NOT NULL,
- title CHARACTER VARYING(255) NOT NULL,
- description TEXT NOT NULL,
- event_id INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- customer_id INTEGER NOT NULL,
- isdone SMALLINT NOT NULL DEFAULT 0,
- event_type smallint DEFAULT 0 ,
- details text DEFAULT NULL ,
- CONSTRAINT PK_eventlist PRIMARY KEY (event_id)
-
-);
-
-CREATE INDEX IF NOT EXISTS IX_eventlist_user_id
-ON eventlist (
- user_id
-);
-
-CREATE INDEX IF NOT EXISTS IX_eventlist_customer_id
-ON eventlist (
- customer_id
-);
-
-
-CREATE TABLE files (
- file_id INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- item_id INTEGER DEFAULT NULL,
- filename CHARACTER VARYING(255) DEFAULT NULL,
- description CHARACTER VARYING(255) DEFAULT NULL,
- item_type INTEGER NOT NULL,
- mime CHARACTER VARYING(16) DEFAULT NULL,
- CONSTRAINT PK_files PRIMARY KEY (file_id)
-
-);
-
-CREATE INDEX IF NOT EXISTS IX_files_item_id
-ON files (
- item_id
-);
-
-CREATE TABLE filesdata (
- file_id INTEGER DEFAULT NULL,
- filedata BYTEA
-
-);
-
-CREATE UNIQUE INDEX IF NOT EXISTS IX_filesdata_file_id
-ON filesdata (
- file_id
-);
-
-CREATE TABLE firms (
- firm_id INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- firm_name CHARACTER VARYING(255) NOT NULL,
- details TEXT NOT NULL,
- disabled SMALLINT NOT NULL DEFAULT 0,
- CONSTRAINT PK_firms PRIMARY KEY (firm_id)
-);
-
-CREATE TABLE images (
- image_id INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- content BYTEA,
- mime CHARACTER VARYING(16) DEFAULT NULL,
- thumb BYTEA,
- CONSTRAINT PK_images PRIMARY KEY (image_id)
-);
-
-
-
-CREATE TABLE iostate (
- id INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- document_id INTEGER NOT NULL,
- iotype SMALLINT NOT NULL,
- amount DECIMAL(10, 2) NOT NULL,
- CONSTRAINT PK_iostate PRIMARY KEY (id)
-
-);
-CREATE INDEX IF NOT EXISTS IX_iostate_document_id
-ON iostate (
- document_id
-);
-
-CREATE TABLE issue_history (
- hist_id BIGINT NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- issue_id INT NOT NULL,
- createdon DATE NOT NULL,
- user_id INT NOT NULL,
- description CHARACTER VARYING(255) NOT NULL,
- CONSTRAINT PK_issue_history PRIMARY KEY (hist_id)
-
-);
-
-CREATE INDEX IF NOT EXISTS IX_issue_history_issue_id
-ON issue_history (
- issue_id
-);
-
-CREATE TABLE issue_issuelist (
- issue_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- issue_name CHARACTER VARYING(255) NOT NULL,
- details TEXT NOT NULL,
- status SMALLINT NOT NULL,
- priority SMALLINT NOT NULL,
- user_id INT NULL,
- lastupdate TIMESTAMP DEFAULT NULL,
- project_id INT NOT NULL,
- CONSTRAINT PK_issue_issuelist PRIMARY KEY (issue_id)
-
-);
-
-CREATE INDEX IF NOT EXISTS IX_issue_issuelist_project_id
-ON issue_issuelist (
- project_id
-);
-CREATE INDEX IF NOT EXISTS IX_issue_issuelist_user_id
-ON issue_issuelist (
- user_id
-);
-
-CREATE TABLE issue_projectacc (
- id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- project_id INT NOT NULL,
- user_id INT NOT NULL,
- CONSTRAINT PK_issue_projectacc PRIMARY KEY (id)
-);
-
-CREATE TABLE issue_projectlist (
- project_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- project_name CHARACTER VARYING(255) NOT NULL,
- details TEXT NOT NULL,
- customer_id INT DEFAULT NULL,
- status SMALLINT DEFAULT NULL,
- CONSTRAINT PK_issue_projectlist PRIMARY KEY (project_id)
-);
-
-CREATE TABLE issue_time (
- id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- issue_id INT NOT NULL,
- createdon TIMESTAMP NOT NULL,
- user_id INT NOT NULL,
- duration DECIMAL(10, 2) DEFAULT NULL,
- notes CHARACTER VARYING(255) DEFAULT NULL,
- CONSTRAINT PK_issue_time PRIMARY KEY (id)
-
-);
-CREATE INDEX IF NOT EXISTS IX_issue_time_issue_id
-ON issue_time (
- issue_id
-);
-
-CREATE TABLE item_cat (
- cat_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- cat_name CHARACTER VARYING(255) NOT NULL,
- detail TEXT,
- parent_id INT DEFAULT 0,
- CONSTRAINT PK_item_cat PRIMARY KEY (cat_id)
-);
-
-CREATE TABLE item_set (
- set_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- item_id INT DEFAULT NULL,
- service_id INT DEFAULT NULL,
- pitem_id INT NOT NULL,
- qty DECIMAL(11, 3) DEFAULT NULL,
- cost DECIMAL(10, 2) DEFAULT NULL,
- CONSTRAINT PK_item_set PRIMARY KEY (set_id)
-);
-
-CREATE TABLE messages (
- message_id BIGINT NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- user_id INT DEFAULT NULL,
- created TIMESTAMP DEFAULT NULL,
- checked smallint DEFAULT 0 ,
- message TEXT,
- item_id INT NOT NULL,
- item_type INT DEFAULT NULL,
- CONSTRAINT PK_messages PRIMARY KEY (message_id)
-
-);
-
-
-CREATE INDEX IF NOT EXISTS IX_messages_item_id
-ON messages (
- item_id
-);
-
-CREATE TABLE metadata (
- meta_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- meta_type SMALLINT NOT NULL,
- description CHARACTER VARYING(255) DEFAULT NULL,
- meta_name CHARACTER VARYING(255) NOT NULL,
- menugroup CHARACTER VARYING(255) DEFAULT NULL,
- disabled SMALLINT NOT NULL,
- CONSTRAINT PK_metadata PRIMARY KEY (meta_id)
-);
-
-
-CREATE TABLE mfund (
- mf_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- mf_name CHARACTER VARYING(255) NOT NULL,
- description CHARACTER VARYING(255) DEFAULT NULL,
- branch_id INT DEFAULT 0,
- detail TEXT,
- disabled SMALLINT DEFAULT 0,
- CONSTRAINT PK_mfund PRIMARY KEY (mf_id)
-);
-
-
-CREATE TABLE note_fav (
- fav_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- topic_id INT NOT NULL,
- user_id INT NOT NULL,
- CONSTRAINT PK_note_fav PRIMARY KEY (fav_id)
-);
-
-CREATE TABLE note_nodes (
- node_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- pid INT NOT NULL,
- title CHARACTER VARYING(50) NOT NULL,
- mpath CHARACTER VARYING(255) NOT NULL,
- user_id INT DEFAULT NULL,
- ispublic SMALLINT DEFAULT 0,
- CONSTRAINT PK_note_nodes PRIMARY KEY (node_id)
-
-);
-
-CREATE INDEX IF NOT EXISTS IX_note_nodes_user_id
-ON note_nodes (
- user_id
-);
-
-
-CREATE TABLE note_tags (
- tag_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- topic_id INT NOT NULL,
- tagvalue CHARACTER VARYING(255) NOT NULL,
- CONSTRAINT PK_note_tags PRIMARY KEY (tag_id)
-
-);
-CREATE INDEX IF NOT EXISTS IX_note_tags_topic_id
-ON note_tags (
- topic_id
-);
-
-
-CREATE TABLE note_topicnode (
- topic_id INT NOT NULL,
- node_id INT NOT NULL,
- tn_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- CONSTRAINT PK_note_topicnode PRIMARY KEY (tn_id)
-);
-CREATE INDEX IF NOT EXISTS IX_note_topicnode_topic_id
-ON note_topicnode (
- topic_id
-);
-CREATE INDEX IF NOT EXISTS IX_note_topicnode_node_id
-ON note_topicnode (
- node_id
-);
-
-
-CREATE TABLE note_topics (
- topic_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- title CHARACTER VARYING(255) NOT NULL,
- content TEXT NOT NULL,
- acctype SMALLINT DEFAULT 0,
- user_id INT NOT NULL,
- CONSTRAINT PK_note_topics PRIMARY KEY (topic_id)
-);
-
-CREATE TABLE notifies (
- notify_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- user_id INT NULL,
- dateshow TIMESTAMP NOT NULL,
- checked SMALLINT NOT NULL DEFAULT 0,
- message TEXT,
- sender_id INT DEFAULT NULL,
- CONSTRAINT PK_notifies PRIMARY KEY (notify_id)
-
-);
-
-CREATE INDEX IF NOT EXISTS IX_notifies_user_id
-ON notifies (
- user_id
-);
-
-CREATE TABLE options (
- optname CHARACTER VARYING(64) NOT NULL,
- optvalue TEXT NOT NULL
-
-);
-
-CREATE UNIQUE INDEX IF NOT EXISTS IX_options_optname
-ON options (
- optname
-);
-
-CREATE TABLE parealist (
- pa_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- pa_name CHARACTER VARYING(255) NOT NULL,
- CONSTRAINT PK_parealist PRIMARY KEY (pa_id)
-);
-
-
-CREATE TABLE paylist (
- pl_id BIGINT NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- document_id INT NOT NULL,
- amount DECIMAL(11, 2) NOT NULL,
- mf_id INT DEFAULT NULL,
- notes CHARACTER VARYING(255) DEFAULT NULL,
- paydate TIMESTAMP DEFAULT NULL,
- user_id INT NOT NULL,
- paytype SMALLINT NOT NULL,
- detail TEXT,
- bonus INT DEFAULT NULL,
- opertype CHARACTER VARYING(255) DEFAULT NULL,
- CONSTRAINT PK_paylist PRIMARY KEY (pl_id),
- CONSTRAINT paylist_ibfk_1 FOREIGN KEY (document_id) REFERENCES documents (document_id)
-);
-
-
-CREATE INDEX IF NOT EXISTS IX_paylist_document_id
-ON paylist (
- document_id
-);
-
-CREATE TABLE poslist (
- pos_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- pos_name CHARACTER VARYING(255) NOT NULL,
- details TEXT NOT NULL,
- branch_id INT DEFAULT 0,
- CONSTRAINT PK_poslist PRIMARY KEY (pos_id)
-);
-
-CREATE TABLE ppo_zformrep (
- id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- createdon DATE NOT NULL,
- fnpos CHARACTER VARYING(255) NOT NULL,
- fndoc CHARACTER VARYING(255) NOT NULL,
- amount DECIMAL(10, 2) NOT NULL,
- cnt SMALLINT NOT NULL,
- ramount DECIMAL(10, 2) NOT NULL,
- rcnt SMALLINT NOT NULL,
- sentxml TEXT NOT NULL,
- taxanswer BYTEA NOT NULL,
- CONSTRAINT PK_ppo_zformrep PRIMARY KEY (id)
-);
-
-CREATE TABLE ppo_zformstat (
- zf_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- pos_id INT NOT NULL,
- checktype INT NOT NULL,
- createdon TIMESTAMP 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,
- amount4 DECIMAL(10, 2) DEFAULT 0.00,
- fiscnumber CHARACTER VARYING(255),
- document_number CHARACTER VARYING(255) DEFAULT NULL,
- CONSTRAINT PK_ppo_zformstat PRIMARY KEY (zf_id)
-);
-
-
-CREATE TABLE prodproc (
- pp_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- procname CHARACTER VARYING(255) NOT NULL,
- basedoc CHARACTER VARYING(255) DEFAULT NULL,
- snumber CHARACTER VARYING(255) DEFAULT NULL,
- state SMALLINT DEFAULT 0,
- detail TEXT,
- CONSTRAINT PK_prodproc PRIMARY KEY (pp_id)
-);
-
-CREATE TABLE prodstage (
- st_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- pp_id INT NOT NULL,
- pa_id INT NOT NULL,
- state SMALLINT NOT NULL,
- stagename CHARACTER VARYING(255) NOT NULL,
- detail TEXT,
- CONSTRAINT PK_prodstage PRIMARY KEY (st_id)
-
-);
-CREATE INDEX IF NOT EXISTS IX_prodstage_pp_id
-ON prodstage (
- pp_id
-);
-CREATE TABLE prodstageagenda (
- sta_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- st_id INT NOT NULL,
- startdate TIMESTAMP NOT NULL,
- enddate TIMESTAMP NOT NULL,
- CONSTRAINT PK_prodstageagenda PRIMARY KEY (sta_id)
-
-);
-
-CREATE INDEX IF NOT EXISTS IX_prodstageagenda_st_id
-ON prodstageagenda (
- st_id
-);
-
-
-CREATE TABLE roles (
- role_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- rolename CHARACTER VARYING(255) DEFAULT NULL,
- acl TEXT,
- CONSTRAINT PK_roles PRIMARY KEY (role_id)
-);
-
-CREATE TABLE saltypes (
- st_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- salcode INT NOT NULL,
- salname CHARACTER VARYING(255) NOT NULL,
- salshortname CHARACTER VARYING(255) DEFAULT NULL,
- disabled SMALLINT NOT NULL DEFAULT 0,
- CONSTRAINT PK_saltypes PRIMARY KEY (st_id)
-);
-
-CREATE TABLE services (
- service_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- service_name CHARACTER VARYING(255) NOT NULL,
- detail TEXT,
- disabled SMALLINT DEFAULT 0,
- category CHARACTER VARYING(255) DEFAULT NULL,
- CONSTRAINT PK_services PRIMARY KEY (service_id)
-);
-
-
-
-CREATE TABLE shop_attributes (
- attribute_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- attributename CHARACTER VARYING(64) NOT NULL,
- cat_id INT NOT NULL,
- attributetype SMALLINT NOT NULL,
- valueslist TEXT,
- CONSTRAINT PK_shop_attributes PRIMARY KEY (attribute_id)
-);
-
-CREATE TABLE shop_attributes_order (
- order_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- attr_id INT NOT NULL,
- pg_id INT NOT NULL,
- ordern INT NOT NULL,
- CONSTRAINT PK_shop_attributes_order PRIMARY KEY (order_id)
-);
-
-CREATE TABLE shop_attributevalues (
- attributevalue_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- attribute_id INT NOT NULL,
- item_id INT NOT NULL,
- attributevalue CHARACTER VARYING(255) NOT NULL,
- CONSTRAINT PK_shop_attributevalues PRIMARY KEY (attributevalue_id)
-
-);
-CREATE INDEX IF NOT EXISTS IX_shop_attributevalues_attribute_id
-ON shop_attributevalues (
- attribute_id
-);
-
-CREATE TABLE shop_prod_comments (
- comment_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- item_id INT NOT NULL,
- author CHARACTER VARYING(64) NOT NULL,
- comment TEXT NOT NULL,
- created TIMESTAMP NOT NULL,
- rating SMALLINT NOT NULL DEFAULT 0,
- moderated SMALLINT NOT NULL DEFAULT 0,
- CONSTRAINT PK_shop_prod_comments PRIMARY KEY (comment_id)
-
-);
-CREATE INDEX IF NOT EXISTS IX_shop_prod_comments_item_id
-ON shop_prod_comments (
- item_id
-);
-
-CREATE TABLE shop_varitems (
- varitem_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- var_id INT NOT NULL,
- item_id INT NOT NULL,
- CONSTRAINT PK_shop_varitems PRIMARY KEY (varitem_id)
-
-
-);
-CREATE INDEX IF NOT EXISTS IX_shop_varitems_item_id
-ON shop_varitems (
- item_id
-);
-CREATE INDEX IF NOT EXISTS IX_shop_varitems_var_id
-ON shop_varitems (
- var_id
-);
-
-CREATE TABLE shop_vars (
- var_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- attr_id INT NOT NULL,
- varname CHARACTER VARYING(255) DEFAULT NULL,
- CONSTRAINT PK_shop_vars PRIMARY KEY (var_id)
-);
-
-
-
-
-
-
-
-CREATE TABLE subscribes (
- sub_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- sub_type INT DEFAULT NULL,
- reciever_type INT DEFAULT NULL,
- msg_type INT DEFAULT NULL,
- msgtext TEXT,
- detail TEXT,
- disabled INT DEFAULT 0,
- CONSTRAINT PK_subscribes PRIMARY KEY (sub_id)
-);
-
-
-CREATE TABLE timesheet (
- time_id INT NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- emp_id INT NOT NULL,
- description CHARACTER VARYING(255) DEFAULT NULL,
- t_start TIMESTAMP DEFAULT NULL,
- t_end TIMESTAMP DEFAULT NULL,
- t_type INT DEFAULT 0,
- t_break SMALLINT DEFAULT 0,
- branch_id INT DEFAULT NULL,
- CONSTRAINT PK_timesheet PRIMARY KEY (time_id)
-
-);
-
-CREATE INDEX IF NOT EXISTS IX_timesheet_emp_id
-ON timesheet (
- emp_id
-);
-
-
-
-CREATE
-
-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,
- users.lastactive AS lastactive,
- roles.rolename AS rolename,
- users.role_id AS role_id,
- roles.acl AS roleacl,
- COALESCE(employees.employee_id, 0) AS employee_id,
- (CASE WHEN employees.emp_name IS NULL 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)));
-
-
-CREATE
-
-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,
- d.lastupdate AS lastupdate,
- b.branch_name AS branch_name,
- d.firm_id AS firm_id,
- d.priority AS priority,
- 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)));
-
-
-CREATE 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)));
-
-CREATE VIEW custitems_view
-AS
-SELECT
- s.custitem_id AS custitem_id,
- s.item_id AS item_id,
- s.customer_id AS customer_id,
- s.quantity AS quantity,
- s.price AS price,
- s.updatedon AS updatedon,
- s.cust_code AS cust_code,
- s.comment AS comment,
- i.itemname AS itemname,
- i.cat_id AS cat_id,
- i.item_code AS item_code,
- i.detail AS detail,
- c.customer_name AS customer_name
-FROM ((custitems s
- JOIN items i
- ON ((s.item_id = i.item_id)))
- JOIN customers c
- ON ((s.customer_id = c.customer_id)))
-WHERE ((i.disabled <> 1)
-AND (c.status <> 1));
-
-CREATE 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,
- customers.leadsource AS leadsource,
- customers.leadstatus AS leadstatus,
- customers.createdon AS createdon,
- customers.country AS country,
- customers.passw AS passw,
- (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;
-
-
-CREATE
-
-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)));
-
-
-
-CREATE VIEW empacc_view
-AS
-SELECT
- e.ea_id AS ea_id,
- e.emp_id AS emp_id,
- e.document_id AS document_id,
- e.optype AS optype,
- d.notes AS notes,
- e.amount AS amount,
- coalesce(e.createdon,d.document_date ) AS createdon,
- d.document_number AS document_number,
- em.emp_name AS emp_name
-FROM ((empacc e
- LEFT JOIN documents d
- ON ((d.document_id = e.document_id)))
- JOIN employees em
- ON ((em.employee_id = e.emp_id)));
-
-CREATE
-
-VIEW entrylist_view
-AS
-SELECT
- entrylist.entry_id AS entry_id,
- entrylist.document_id AS document_id,
- entrylist.quantity AS quantity,
- documents.customer_id AS customer_id,
- entrylist.stock_id AS stock_id,
- entrylist.service_id AS service_id,
- entrylist.tag AS tag,
- store_stock.item_id AS item_id,
- store_stock.partion AS partion,
- documents.document_date AS document_date,
- entrylist.outprice AS outprice
-FROM ((entrylist
- LEFT JOIN store_stock
- ON ((entrylist.stock_id = store_stock.stock_id)))
- JOIN documents
- ON ((entrylist.document_id = documents.document_id)));
-
-CREATE
-
-VIEW eventlist_view
-AS
-SELECT
- e.user_id AS user_id,
- e.eventdate AS eventdate,
- e.title AS title,
- e.description AS description,
- e.event_id AS event_id,
- e.customer_id AS customer_id,
- e.isdone AS isdone,
- e.event_type AS event_type,
- e.details AS details,
- c.customer_name AS customer_name,
- uv.username AS username
-FROM ((eventlist e
- LEFT JOIN customers c
- ON ((e.customer_id = c.customer_id)))
- LEFT JOIN users_view uv
- ON ((uv.user_id = e.user_id)));
-
-
-CREATE
-
-VIEW iostate_view
-AS
-SELECT
- s.id AS id,
- s.document_id AS document_id,
- s.iotype AS iotype,
- s.amount AS amount,
- d.document_date AS document_date,
- d.branch_id AS branch_id
-FROM (iostate s
- JOIN documents d
- ON ((s.document_id = d.document_id)));
-
-CREATE
-
-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)));
-
-CREATE
-
-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)));
-
-
-
-CREATE
-
-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)));
-
-
-CREATE
-
-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)));
-
-
-CREATE
-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,
- item_set.service_id AS service_id,
- item_set.cost AS cost,
- items.itemname AS itemname,
- items.item_code AS item_code,
- services.service_name AS service_name
-FROM ((item_set
- LEFT JOIN items
- ON (((item_set.item_id = items.item_id)
- AND (items.disabled <> 1))))
- LEFT JOIN services
- ON (((item_set.service_id = services.service_id)
- AND (services.disabled <> 1))));
-
-CREATE
-
-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,
- messages.checked AS checked,
- users_view.username AS username
-FROM (messages
- LEFT JOIN users_view
- ON ((messages.user_id = users_view.user_id)));
-
-CREATE
-
-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)
- FROM note_topicnode
- WHERE (note_topicnode.node_id = note_nodes.node_id))
- AS tcnt
-FROM note_nodes;
-
-CREATE
-
-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)));
-
-CREATE
-
-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;
-
-CREATE
-
-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.bonus AS bonus,
- 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)))
- LEFT JOIN mfund m
- ON ((pl.mf_id = m.mf_id)));
-
-
-CREATE OR REPLACE
-
-VIEW prodstageagenda_view
-AS
-SELECT
- a.sta_id AS sta_id,
- a.st_id AS st_id,
- a.startdate AS startdate,
- a.enddate AS enddate,
- pv.stagename AS stagename,
- (EXTRACT(EPOCH FROM a.enddate - a.startdate) / 3600) AS hours,
-
-
- pv.pa_id AS pa_id,
- pv.pp_id AS pp_id
-FROM (prodstageagenda a
- JOIN prodstage pv
- ON ((a.st_id = pv.st_id)));
-
-
-
-CREATE
-
-VIEW prodstage_view
-AS
-SELECT
- ps.st_id AS st_id,
- ps.pp_id AS pp_id,
- ps.pa_id AS pa_id,
- ps.state AS state,
- ps.stagename AS stagename,
- COALESCE((SELECT
- MIN(pag.startdate)
- FROM prodstageagenda pag
- WHERE (pag.st_id = ps.st_id)), NULL) AS startdate,
- COALESCE((SELECT
- MAX(pag.enddate)
- FROM prodstageagenda pag
- WHERE (pag.st_id = ps.st_id)), NULL) AS enddate,
- COALESCE((SELECT
- MAX(pag.hours)
- FROM prodstageagenda_view pag
- WHERE (pag.st_id = ps.st_id)), NULL) AS hours,
- ps.detail AS detail,
- pr.procname AS procname,
- pr.snumber AS snumber,
- pr.state AS procstate,
- pa.pa_name AS pa_name
-FROM ((prodstage ps
- JOIN prodproc pr
- ON ((pr.pp_id = ps.pp_id)))
- JOIN parealist pa
- ON ((pa.pa_id = ps.pa_id)));
-
-CREATE
-
-VIEW prodproc_view
-AS
-SELECT
- p.pp_id AS pp_id,
- p.procname AS procname,
- p.basedoc AS basedoc,
- p.snumber AS snumber,
- p.state AS state,
- COALESCE((SELECT
- MIN(ps.startdate)
- FROM prodstage_view ps
- WHERE (ps.pp_id = p.pp_id)), NULL) AS startdate,
- COALESCE((SELECT
- MAX(ps.enddate)
- FROM prodstage_view ps
- WHERE (ps.pp_id = p.pp_id)), NULL) AS enddate,
- COALESCE((SELECT
- COUNT(0)
- FROM prodstage ps
- WHERE (ps.pp_id = p.pp_id)), NULL) AS stagecnt,
- p.detail AS detail
-FROM prodproc p;
-
-
-
-CREATE
-
-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;
-
-CREATE
-
-VIEW shop_attributes_view
-AS
-SELECT
- shop_attributes.attribute_id AS attribute_id,
- shop_attributes.attributename AS attributename,
- shop_attributes.cat_id AS cat_id,
- shop_attributes.attributetype AS attributetype,
- shop_attributes.valueslist AS valueslist,
- 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.cat_id = shop_attributes_order.pg_id))))
-ORDER BY shop_attributes_order.ordern;
-
-CREATE
-
-VIEW shop_products_view
-AS
-SELECT
- i.item_id AS item_id,
- i.itemname AS itemname,
- i.description AS description,
- i.detail AS detail,
- i.item_code AS item_code,
- i.bar_code AS bar_code,
- i.cat_id AS cat_id,
- i.msr AS msr,
- i.disabled AS disabled,
- i.minqty AS minqty,
- i.item_type AS item_type,
- i.manufacturer AS manufacturer,
- i.cat_name AS cat_name,
- COALESCE((SELECT
- SUM(store_stock.qty)
- FROM store_stock
- WHERE (store_stock.item_id = i.item_id)), 0) AS qty,
- COALESCE((SELECT
- COUNT(0)
- FROM shop_prod_comments c
- WHERE (c.item_id = i.item_id)), 0) AS comments,
- COALESCE((SELECT
- SUM(c.rating)
- FROM shop_prod_comments c
- WHERE (c.item_id = i.item_id)), 0) AS ratings
-FROM items_view i;
-
-CREATE
-
-VIEW shop_varitems_view
-AS
-SELECT
- shop_varitems.varitem_id AS varitem_id,
- shop_varitems.var_id AS var_id,
- shop_varitems.item_id AS item_id,
- sv.attr_id AS attr_id,
- sa.attributevalue AS attributevalue,
- it.itemname AS itemname,
- it.item_code AS item_code
-FROM (((shop_varitems
- JOIN shop_vars sv
- ON ((shop_varitems.var_id = sv.var_id)))
- JOIN shop_attributevalues sa
- ON (((sa.item_id = shop_varitems.item_id)
- AND (sv.attr_id = sa.attribute_id))))
- JOIN items it
- ON ((shop_varitems.item_id = it.item_id)));
-
-CREATE
-
-VIEW shop_vars_view
-AS
-SELECT
- shop_vars.var_id AS var_id,
- shop_vars.attr_id AS attr_id,
- shop_vars.varname AS varname,
- shop_attributes.attributename AS attributename,
- shop_attributes.cat_id AS cat_id,
- (SELECT
- COUNT(0)
- FROM shop_varitems
- WHERE (shop_varitems.var_id = shop_vars.var_id))
- AS cnt
-FROM ((shop_vars
- JOIN shop_attributes
- ON ((shop_vars.attr_id = shop_attributes.attribute_id)))
- JOIN item_cat
- ON ((shop_attributes.cat_id = item_cat.cat_id)));
-
-CREATE
-
-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)));
-
-CREATE
-
-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,
- b.branch_name AS branch_name,
- e.disabled AS disabled,
- t.branch_id AS branch_id
-FROM ((timesheet t
- JOIN employees e
- ON ((t.emp_id = e.employee_id)))
- LEFT JOIN branches b
- ON ((t.branch_id = b.branch_id)));
-
-
-
-
-CREATE TABLE stats (
- id bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- category INTEGER NOT NULL,
- keyd INTEGER NOT NULL,
- vald INTEGER NOT NULL,
- dt timestamp DEFAULT NULL,
- CONSTRAINT PK_stats PRIMARY KEY (id)
-) ;
-
-CREATE INDEX IF NOT EXISTS IX_stats_category
-ON stats (
- category
-);
-
-CREATE TABLE keyval (
- keyd CHARACTER VARYING(255) NOT NULL,
- vald text NOT NULL,
- CONSTRAINT PK_keyval PRIMARY KEY (keyd)
-)
- ;
-
-CREATE TABLE crontask (
- id INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- created TIMESTAMP NOT NULL,
- tasktype CHARACTER VARYING(64) NOT NULL,
- taskdata text DEFAULT NULL,
- starton TIMESTAMP DEFAULT NULL,
-CONSTRAINT PK_crontask PRIMARY KEY (id)
-) ;
-
-
-CREATE INDEX IF NOT EXISTS IX_customers_phone
-ON customers (
- phone
-);
-
-CREATE INDEX IF NOT EXISTS IX_documents_state
-ON documents (
- state
-);
-
-
-CREATE TABLE taglist (
- id INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- tag_type smallint NOT NULL,
- item_id INTEGER NOT NULL,
- tag_name CHARACTER VARYING(255),
-CONSTRAINT PK_taglist PRIMARY KEY (id)
-) ;
-
-
-CREATE TABLE promocodes (
- id INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- code CHARACTER VARYING(16) NOT NULL,
- type smallint NOT NULL,
- disabled smallint NOT NULL default 0,
-
- details text DEFAULT NULL,
- CONSTRAINT PK_promocodes PRIMARY KEY (id)
-) ;
-
-CREATE UNIQUE INDEX IF NOT EXISTS IX_promocodes_code
-ON promocodes (
- code
-);
-
-INSERT INTO "users" ( "userlogin", "userpass", "createdon", "email", "acl", "disabled", "options", "role_id") VALUES( 'admin', '$2y$10$GsjC.thVpQAPMQMO6b4Ma.olbIFr2KMGFz12l5/wnmxI1PEqRDQf.', '2017-01-01', 'admin@admin.admin', 'a:2:{s:9:"aclbranch";N;s:6:"onlymy";N;}', 0, 'a:6:{s:8:"defstore";s:2:"19";s:7:"deffirm";i:0;s:5:"defmf";s:1:"2";s:8:"pagesize";s:2:"15";s:11:"hidesidebar";i:0;s:8:"mainpage";s:15:"\\App\\Pages\\Main";}', 1);
-
-INSERT INTO "roles" ( "rolename", "acl") VALUES( 'admins', 'a:9:{s:7:"aclview";N;s:7:"acledit";N;s:6:"aclexe";N;s:9:"aclcancel";N;s:8:"aclstate";N;s:9:"acldelete";N;s:7:"widgets";N;s:7:"modules";N;s:9:"smartmenu";s:1:"8";}');
-UPDATE users set role_id=(select role_id from "roles" where rolename='admins' limit 1) where userlogin='admin' ;
-
-INSERT INTO "stores" ( "storename", "description") VALUES( 'Основний склад', '');
-INSERT INTO "mfund" ( "mf_name", "description", "branch_id", "detail") VALUES( 'Касса', '', NULL, '0');
-
-INSERT INTO "firms" ( "firm_name", "details", "disabled") VALUES( 'Наша фiрма', '', 0);
-INSERT INTO "customers" ( "customer_name", "detail", "email", "phone", "status", "city", "leadstatus", "leadsource", "createdon") VALUES( 'Фiз. особа', '
000014', '', '', 0, '', NULL, NULL, '2021-04-28');
-
-
-
-
-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, 'Журнал документiв', '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( 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( 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( 1, 'Заявка постачальнику', 'OrderCust', 'Закупки', 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( 1, 'Перекомплектація (расфасовка)', 'TransItem', 'Склад', 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, 'Журнал платежів', '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, 'Прибутковий ордер', '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, 'Списання ТМЦ', 'OutcomeItem', 'Склад', 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, 'АРМ касира', 'ARMPos', '', 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( 3, 'Товари на складі', 'ItemList', 'Склад', 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( 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( 4, 'Контракти', 'ContractList', '', 0);
-INSERT INTO "metadata" ( "meta_type", "description", "meta_name", "menugroup", "disabled") VALUES( 1, 'Перемiщення ТМЦ', 'MoveItem', 'Склад', 0);
-INSERT INTO "metadata" ( "meta_type", "description", "meta_name", "menugroup", "disabled") VALUES( 2, 'Робочий час', 'Timestat', '', 0);
-INSERT INTO "metadata" ( "meta_type", "description", "meta_name", "menugroup", "disabled") VALUES( 1, 'Товарно-транспортна накладна', 'TTN', 'Продажі', 0);
-INSERT INTO "metadata" ( "meta_type", "description", "meta_name", "menugroup", "disabled") VALUES( 2, 'Нелiквiднi товари', 'NoLiq', 'Склад', 0);
-INSERT INTO "metadata" ( "meta_type", "description", "meta_name", "menugroup", "disabled") VALUES( 3, 'Розрахунки з постачальниками', 'PaySelList', 'Каса та платежі', 0);
-INSERT INTO "metadata" ( "meta_type", "description", "meta_name", "menugroup", "disabled") VALUES( 3, 'Розрахунки з покупцями', 'PayBayList', 'Каса та платежі', 0);
-INSERT INTO "metadata" ( "meta_type", "description", "meta_name", "menugroup", "disabled") VALUES( 1, 'Перемiщення грошей', 'MoveMoney', 'Каса та платежі', 0);
-INSERT INTO "metadata" ( "meta_type", "description", "meta_name", "menugroup", "disabled") VALUES( 1, 'Замовленя кафе', 'OrderFood', 'Кафе', 0);
-INSERT INTO "metadata" ( "meta_type", "description", "meta_name", "menugroup", "disabled") VALUES( 5, 'АРМ касира (кафе)', 'ARMFood', 'Кафе', 0);
-INSERT INTO "metadata" ( "meta_type", "description", "meta_name", "menugroup", "disabled") VALUES( 3, 'Журнал доставок', 'DeliveryList', 'Кафе', 0);
-INSERT INTO "metadata" ( "meta_type", "description", "meta_name", "menugroup", "disabled") VALUES( 5, 'АРМ кухнi (бару)', 'ArmProdFood', 'Кафе', 0);
-INSERT INTO "metadata" ( "meta_type", "description", "meta_name", "menugroup", "disabled") VALUES( 3, 'Прибутки та видатки', 'IOState', '', 0);
-INSERT INTO "metadata" ( "meta_type", "description", "meta_name", "menugroup", "disabled") VALUES( 2, 'Замовленi товари', 'ItemOrder', 'Продажі', 0);
-INSERT INTO "metadata" ( "meta_type", "description", "meta_name", "menugroup", "disabled") VALUES( 5, 'Програма лояльності', 'Discounts', '', 0);
-INSERT INTO "metadata" ("meta_type", "description", "meta_name", "menugroup", "disabled") VALUES( 1, 'Нарахування зарплати', 'CalcSalary', 'Зарплата', 0);
-INSERT INTO "metadata" ("meta_type", "description", "meta_name", "menugroup", "disabled") VALUES( 4, 'Нарахування та утримання', 'SalaryTypeList', '', 0);
-
-INSERT INTO "metadata" ( "meta_type", "description", "meta_name", "menugroup", "disabled") VALUES( 3, 'Вир. процеси', 'ProdProcList', 'Виробництво', 0);
-INSERT INTO "metadata" ( "meta_type", "description", "meta_name", "menugroup", "disabled") VALUES( 3, 'Вир. етапи', 'ProdStageList', 'Виробництво', 0);
-INSERT INTO "metadata" ( "meta_type", "description", "meta_name", "menugroup", "disabled") VALUES( 1, 'Перемiщення партiй ТМЦ', 'MovePart', 'Склад', 0);
-INSERT INTO "metadata" ( "meta_type", "description", "meta_name", "menugroup", "disabled") VALUES( 2, 'Повернення покупцiв', 'Returnselled', 'Продажі', 0);
-INSERT INTO "metadata" ( "meta_type", "description", "meta_name", "menugroup", "disabled") VALUES( 2, 'Повернення постачальникам', 'Returnbayed', 'Закупки', 0);
-INSERT INTO "metadata" ( "meta_type", "description", "meta_name", "menugroup", "disabled") VALUES( 1, 'Отримані послуги', 'IncomeService', 'Послуги', 0);
-INSERT INTO "metadata" ("meta_type", "description", "meta_name", "menugroup", "disabled") VALUES( 2, 'Стан складiв', 'StoreItems', 'Склад', 0);
-INSERT INTO "metadata" ( "meta_type", "description", "meta_name", "menugroup", "disabled") VALUES( 3, 'Товари у постачальників', 'CustItems', '', 0);
-INSERT INTO "metadata" ( "meta_type", "description", "meta_name", "menugroup", "disabled") VALUES( 2, 'Акт звірки', 'CompareAct', 'Контрагенти', 0);
-INSERT INTO "metadata" ( "meta_type", "description", "meta_name", "menugroup", "disabled") VALUES( 2, 'Зарезервовані товари', 'Reserved', 'Склад', 0);
-INSERT INTO "metadata" (meta_type, description, meta_name, menugroup, disabled) VALUES( 2, 'OLAP аналіз', 'OLAP', 'Аналітика', 0);
-INSERT INTO "metadata" (meta_type, description, meta_name, menugroup, disabled) VALUES( 2, 'Кафе', 'OutFood', 'Продажі', 0);
-INSERT INTO "metadata" (meta_type, description, meta_name, menugroup, disabled) VALUES( 3, 'Платіжний календар', 'PayTable', 'Каса та платежі', 0);
-INSERT INTO "metadata" (meta_type, description, meta_name, menugroup, disabled) VALUES( 2, 'Кафе', 'OutFood', 'Продажі', 0);
-INSERT INTO "metadata" (meta_type, description, meta_name, menugroup, disabled) VALUES( 3, 'Платіжний календар', 'PayTable', 'Каса та платежі', 0);
-INSERT INTO "metadata" ( "meta_type", "description", "meta_name", "menugroup", "disabled") VALUES( 2, 'Управлiнський баланс', 'Balance', '', 0);
-
-
-
-
-INSERT INTO "saltypes" ("st_id", "salcode", "salname", "salshortname", "disabled") VALUES(2, 105, 'Основна зарплата', 'осн', 0);
-INSERT INTO "saltypes" ("st_id", "salcode", "salname", "salshortname", "disabled") VALUES(3, 200, 'Всього нараховано', 'вс. нар', 0);
-INSERT INTO "saltypes" ("st_id", "salcode", "salname", "salshortname", "disabled") VALUES(4, 600, 'Всього утримано', 'вс. ут', 0);
-INSERT INTO "saltypes" ("st_id", "salcode", "salname", "salshortname", "disabled") VALUES(5, 900, 'До видачi', 'До видачi', 0);
-INSERT INTO "saltypes" ("st_id", "salcode", "salname", "salshortname", "disabled") VALUES(6, 850, 'Аванс', 'Аванс', 0);
-INSERT INTO "saltypes" ("st_id", "salcode", "salname", "salshortname", "disabled") VALUES(7, 220, 'НДФО', 'НДФО', 0);
-INSERT INTO "saltypes" ("st_id", "salcode", "salname", "salshortname", "disabled") VALUES(8, 300, 'ЕСВ', 'ЕСВ', 0);
-
-INSERT INTO "options" ("optname", "optvalue") VALUES('api', 'a:3:{s:3:\"exp\";s:0:\"\";s:3:\"key\";s:4:\"test\";s:5:\"atype\";s:1:\"1\";}');
-INSERT INTO "options" ("optname", "optvalue") VALUES('common', 'YTozMjp7czo5OiJxdHlkaWdpdHMiO3M6MToiMCI7czo4OiJhbWRpZ2l0cyI7czoxOiIwIjtzOjEwOiJkYXRlZm9ybWF0IjtzOjU6ImQubS5ZIjtzOjExOiJwYXJ0aW9udHlwZSI7czoxOiIxIjtzOjY6InBob25lbCI7czoyOiIxMCI7czo2OiJwcmljZTEiO3M6MTg6ItCg0L7Qt9C00YDRltCx0L3QsCI7czo2OiJwcmljZTIiO3M6MTI6ItCe0L/RgtC+0LLQsCI7czo2OiJwcmljZTMiO3M6MDoiIjtzOjY6InByaWNlNCI7czowOiIiO3M6NjoicHJpY2U1IjtzOjA6IiI7czo4OiJkZWZwcmljZSI7czowOiIiO3M6ODoic2hvcG5hbWUiO3M6MDoiIjtzOjg6InRzX2JyZWFrIjtzOjI6IjYwIjtzOjg6InRzX3N0YXJ0IjtzOjU6IjA5OjAwIjtzOjY6InRzX2VuZCI7czo1OiIxODowMCI7czoxMToiY2hlY2tzbG9nYW4iO3M6MDoiIjtzOjExOiJhdXRvYXJ0aWNsZSI7aToxO3M6MTA6InVzZXNudW1iZXIiO2k6MDtzOjEwOiJ1c2VzY2FubmVyIjtpOjA7czoxNjoidXNlbW9iaWxlc2Nhbm5lciI7aTowO3M6OToidXNlaW1hZ2VzIjtpOjA7czoxNDoicHJpbnRvdXRxcmNvZGUiO2k6MDtzOjE0OiJub2NoZWNrYXJ0aWNsZSI7aTowO3M6MTU6InNob3dhY3RpdmV1c2VycyI7aTowO3M6ODoic2hvd2NoYXQiO2k6MDtzOjEwOiJ1c2VjYXR0cmVlIjtpOjA7czo5OiJ1c2VicmFuY2giO2k6MDtzOjEwOiJub2FsbG93Zml6IjtpOjA7czoxMDoiYWxsb3dtaW51cyI7aTowO3M6NjoidXNldmFsIjtpOjA7czo2OiJjYXBjaGEiO2k6MDtzOjk6Im51bWJlcnR0biI7aTowO30=');
-INSERT INTO "options" ("optname", "optvalue") VALUES('disc', 'a:4:{s:8:\"firstbay\";s:2:\"11\";s:6:\"bonus1\";s:0:\"\";s:6:\"level2\";s:0:\"\";s:6:\"bonus2\";s:0:\"\";}');
-INSERT INTO "options" ("optname", "optvalue") VALUES('discount', 'a:6:{s:8:\"firstbay\";s:2:\"11\";s:6:\"bonus1\";s:3:\"1.1\";s:6:\"level2\";s:0:\"\";s:6:\"bonus2\";s:0:\"\";s:6:\"summa1\";s:3:\"100\";s:6:\"summa2\";s:0:\"\";}');
-INSERT INTO "options" ("optname", "optvalue") VALUES('food', 'a:5:{s:8:\"worktype\";s:1:\"2\";s:9:\"pricetype\";s:6:\"price1\";s:8:\"delivery\";i:1;s:6:\"tables\";i:1;s:4:\"pack\";i:1;}');
-INSERT INTO "options" ("optname", "optvalue") VALUES('printer', 'a:15:{s:7:\"pheight\";s:0:\"\";s:8:\"pa4width\";s:0:\"\";s:6:\"pwidth\";s:4:\"100%\";s:9:\"pdocwidth\";s:4:\"70mm\";s:8:\"pmaxname\";s:1:\"7\";s:9:\"pricetype\";s:6:\"price1\";s:11:\"barcodetype\";s:4:\"C128\";s:9:\"pfontsize\";s:2:\"28\";s:12:\"pdocfontsize\";s:2:\"16\";s:5:\"pname\";i:1;s:5:\"pcode\";i:1;s:8:\"pbarcode\";i:1;s:7:\"pqrcode\";i:1;s:6:\"pprice\";i:1;s:6:\"pcolor\";i:0;}');
-INSERT INTO "options" ("optname", "optvalue") VALUES('salary', 'a:4:{s:13:\"codebaseincom\";s:3:\"105\";s:10:\"coderesult\";s:3:\"900\";s:4:\"calc\";s:219:\"v200 = v105\r\n//податки\r\nv220 = v200 * 0.18\r\nv300 = v200 * 0.22\r\n//всього утримано\r\nv600 =v200 - v220- v300\r\n//на руки\r\nv900 =v200 - v600-v850\r\n\r\n\r\n//приклад\r\nif(invalid){\r\n \r\n} \";s:11:\"codeadvance\";s:3:\"850\";}');
-INSERT INTO "options" ("optname", "optvalue") VALUES('shop', 'a:19:{s:7:\"defcust\";s:1:\"1\";s:11:\"defcustname\";s:29:\"Леонид Мартынюк\";s:9:\"defbranch\";N;s:9:\"ordertype\";s:1:\"2\";s:12:\"defpricetype\";s:6:\"price1\";s:5:\"email\";s:15:\"softman@ukr.net\";s:8:\"shopname\";s:18:\"Наш магаз7\";s:12:\"currencyname\";s:6:\"грн\";s:8:\"uselogin\";i:0;s:9:\"usefilter\";i:0;s:13:\"createnewcust\";i:0;s:11:\"usefeedback\";i:0;s:11:\"usemainpage\";i:0;s:7:\"aboutus\";s:16:\"PHA+PGJyPjwvcD4=\";s:7:\"contact\";s:0:\"\";s:8:\"delivery\";s:0:\"\";s:4:\"news\";s:0:\"\";s:5:\"pages\";a:2:{s:4:\"news\";O:12:\"App\\DataItem\":2:{s:2:\"id\";N;s:9:\"\0*\0fields\";a:4:{s:4:\"link\";s:4:\"news\";s:5:\"title\";s:11:\"kkkrrrrrrrr\";s:5:\"order\";s:1:\"2\";s:4:\"text\";s:24:\"PHA+ZWVlZWVlZWVlPC9wPg==\";}}s:8:\"about_us\";O:12:\"App\\DataItem\":2:{s:2:\"id\";N;s:9:\"\0*\0fields\";a:4:{s:4:\"link\";s:8:\"about_us\";s:5:\"title\";s:9:\"О нас\";s:5:\"order\";s:1:\"3\";s:4:\"text\";s:32:\"PHA+PGI+0J4g0L3QsNGBPC9iPjwvcD4=\";}}}s:5:\"phone\";s:0:\"\";}');
-INSERT INTO "options" ("optname", "optvalue") VALUES('val', 'a:2:{s:7:\"vallist\";a:2:{i:1642675955;O:12:\"App\\DataItem\":2:{s:2:\"id\";i:1642675955;s:9:\"\0*\0fields\";a:3:{s:4:\"code\";s:3:\"USD\";s:4:\"name\";s:10:\"Долар\";s:4:\"rate\";s:2:\"28\";}}i:1642676126;O:12:\"App\\DataItem\":2:{s:2:\"id\";i:1642676126;s:9:\"\0*\0fields\";a:3:{s:4:\"code\";s:4:\"EURO\";s:4:\"name\";s:8:\"Євро\";s:4:\"rate\";s:2:\"33\";}}}s:8:\"valprice\";i:0;}');
-INSERT INTO "options" ("optname", "optvalue") VALUES('version', '6.9.0');
-
-
-
diff --git a/db/postgresql/update/update610to620.sql b/db/postgresql/update/update610to620.sql
deleted file mode 100644
index 73870b8b4..000000000
--- a/db/postgresql/update/update610to620.sql
+++ /dev/null
@@ -1,71 +0,0 @@
-ALTER TABLE ppo_zformstat ADD fiscnumber CHARACTER VARYING(255) NULL ;
-ALTER TABLE item_set ADD service_id INTEGER DEFAULT NULL ;
-ALTER TABLE item_set ADD cost DECIMAL(10, 2) DEFAULT NULL ;
-
-
-
-
-ALTER
-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,
- item_set.service_id AS service_id,
- item_set.cost AS cost,
- items.itemname AS itemname,
- items.item_code AS item_code,
- services.service_name AS service_name
-FROM ((item_set
- LEFT JOIN items
- ON (((item_set.item_id = items.item_id)
- AND (items.disabled <> 1))))
- LEFT JOIN services
- ON (((item_set.service_id = services.service_id)
- AND (services.disabled <> 1))));
-
-
-ALTER TABLE documents ADD lastupdate TIMESTAMP NULL;
-
-
-
-
-ALTER 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,
- d.priority AS priority,
- d.lastupdate AS lastupdate,
- 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)));
\ No newline at end of file
diff --git a/db/postgresql/update/update620to630.sql b/db/postgresql/update/update620to630.sql
deleted file mode 100644
index 164fca805..000000000
--- a/db/postgresql/update/update620to630.sql
+++ /dev/null
@@ -1,50 +0,0 @@
-delete from metadata where meta_name='CustActivity' ;
-delete from metadata where meta_name='EmpAccRep' ;
-delete from metadata where meta_name='SalTypeRep' ;
-
-
-ALTER TABLE empacc ADD createdon DATE NULL ;
-
-DROP VIEW empacc_view ;
-
-CREATE VIEW empacc_view
-AS
-SELECT
- e.ea_id AS ea_id,
- e.emp_id AS emp_id,
- e.document_id AS document_id,
- e.optype AS optype,
- d.notes AS notes,
- e.amount AS amount,
- coalesce(e.createdon,d.document_date ) AS createdon,
- d.document_number AS document_number,
- em.emp_name AS emp_name
-FROM ((empacc e
- LEFT JOIN documents d
- ON ((d.document_id = e.document_id)))
- JOIN employees em
- ON ((em.employee_id = e.emp_id)));
-
-
-
-CREATE VIEW cust_acc_view
-AS
-SELECT
- COALESCE(SUM((CASE WHEN (d.meta_name IN ('InvoiceCust', 'GoodsReceipt', 'IncomeService', 'OutcomeMoney')) THEN d.payed WHEN ((d.meta_name = 'OutcomeMoney') AND
- (d.content LIKE '%2%')) THEN d.payed WHEN (d.meta_name = 'RetCustIssue') THEN d.payamount ELSE 0 END)), 0) AS s_passive,
- COALESCE(SUM((CASE WHEN (d.meta_name IN ('GoodsReceipt') ) THEN d.payamount WHEN ((d.meta_name = 'IncomeMoney') AND
- (d.content LIKE '%2%')) THEN d.payed WHEN (d.meta_name = 'RetCustIssue') THEN d.payed ELSE 0 END)), 0) AS s_active,
- COALESCE(SUM((CASE WHEN (d.meta_name IN ('GoodsIssue', 'TTN', 'PosCheck', 'OrderFood')) THEN d.payamount WHEN ((d.meta_name = 'OutcomeMoney') AND
- (d.content LIKE '%1%')) THEN d.payed WHEN (d.meta_name = 'ReturnIssue') THEN d.payed ELSE 0 END)), 0) AS b_passive,
- COALESCE(SUM((CASE WHEN (d.meta_name IN ('GoodsIssue', 'Order', 'PosCheck', 'OrderFood', 'Invoice', 'ServiceAct')) THEN d.payed WHEN ((d.meta_name = 'IncomeMoney') AND
- (d.content LIKE '%1%')) THEN d.payed WHEN (d.meta_name = 'ReturnIssue') THEN d.payamount ELSE 0 END)), 0) AS b_active,
- d.customer_id AS customer_id
-FROM documents_view d
-WHERE ((d.state NOT IN (0, 1, 2, 3, 15, 8))
-AND (d.customer_id > 0))
-GROUP BY d.customer_id;
-
-
-delete from options where optname='version' ;
-insert into options (optname,optvalue) values('version','6.3.0');
-
\ No newline at end of file
diff --git a/db/postgresql/update/update630to633.sql b/db/postgresql/update/update630to633.sql
deleted file mode 100644
index 55d44fec6..000000000
--- a/db/postgresql/update/update630to633.sql
+++ /dev/null
@@ -1,25 +0,0 @@
-update metadata set menugroup ='Продажі' where meta_name='ItemOrder';
-
-DROP VIEW cust_acc_view ;
-
-CREATE VIEW cust_acc_view
-AS
-SELECT
- COALESCE(SUM((CASE WHEN (d.meta_name IN ('InvoiceCust', 'GoodsReceipt', 'IncomeService', 'OutcomeMoney')) THEN d.payed WHEN ((d.meta_name = 'OutcomeMoney') AND
- (d.content LIKE '%2%')) THEN d.payed WHEN (d.meta_name = 'RetCustIssue') THEN d.payamount ELSE 0 END)), 0) AS s_passive,
- COALESCE(SUM((CASE WHEN (d.meta_name IN ('IncomeService', 'GoodsReceipt')) THEN d.payamount WHEN ((d.meta_name = 'IncomeMoney') AND
- (d.content LIKE '%2%')) THEN d.payed WHEN (d.meta_name = 'RetCustIssue') THEN d.payed ELSE 0 END)), 0) AS s_active,
- COALESCE(SUM((CASE WHEN (d.meta_name IN ('GoodsIssue', 'TTN', 'PosCheck', 'OrderFood', 'ServiceAct')) THEN d.payamount WHEN ((d.meta_name = 'OutcomeMoney') AND
- (d.content LIKE '%1%')) THEN d.payed WHEN (d.meta_name = 'ReturnIssue') THEN d.payed ELSE 0 END)), 0) AS b_passive,
- COALESCE(SUM((CASE WHEN (d.meta_name IN ('GoodsIssue', 'Order', 'PosCheck', 'OrderFood', 'Invoice', 'ServiceAct')) THEN d.payed WHEN ((d.meta_name = 'IncomeMoney') AND
- (d.content LIKE '%1%')) THEN d.payed WHEN (d.meta_name = 'ReturnIssue') THEN d.payamount ELSE 0 END)), 0) AS b_active,
- d.customer_id AS customer_id
-FROM documents_view d
-WHERE ((d.state NOT IN (0, 1, 2, 3, 15, 8, 17))
-AND (d.customer_id > 0))
-GROUP BY d.customer_id;
-
-
-delete from options where optname='version' ;
-insert into options (optname,optvalue) values('version','6.3.3');
-
\ No newline at end of file
diff --git a/db/postgresql/update/update633to640.sql b/db/postgresql/update/update633to640.sql
deleted file mode 100644
index 4dbd9f975..000000000
--- a/db/postgresql/update/update633to640.sql
+++ /dev/null
@@ -1,10 +0,0 @@
-
-INSERT INTO metadata ( meta_type, description, meta_name, menugroup, disabled) VALUES( 2, 'Акт звірки', 'CompareAct', 'Контрагенти', 0);
-INSERT INTO metadata ( meta_type, description, meta_name, menugroup, disabled) VALUES( 2, 'Зарезервовані товари', 'Reserved', 'Склад', 0);
-
-
-
-
-DELETE FROM "options" WHERE optname='version' ;
-INSERT INTO "options" (optname, optvalue) values('version','6.4.0');
-
\ No newline at end of file
diff --git a/db/postgresql/update/update640to650.sql b/db/postgresql/update/update640to650.sql
deleted file mode 100644
index daf9939f4..000000000
--- a/db/postgresql/update/update640to650.sql
+++ /dev/null
@@ -1,54 +0,0 @@
-
-CREATE OR REPLACE
-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,
- CASE WHEN pl.paydate IS NOT NULL THEN pl.paydate ELSE d.document_date END AS paydate,
-
- pl.paytype AS paytype,
- pl.bonus AS bonus,
- 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)))
- LEFT JOIN users_view u
- ON ((pl.user_id = u.user_id)))
- LEFT JOIN mfund m
- ON ((pl.mf_id = m.mf_id)));
-
-
-
-
-CREATE TABLE stats (
- id bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- category INTEGER NOT NULL,
- keyd INTEGER NOT NULL,
- vald INTEGER NOT NULL,
- dt timestamp DEFAULT NULL,
- CONSTRAINT PK_stats PRIMARY KEY (id)
-) ;
-
-CREATE INDEX IF NOT EXISTS IX_stats_category
-ON stats (
- category
-);
-
-CREATE TABLE keyval (
- keyd CHARACTER VARYING(255) NOT NULL,
- vald text NOT NULL,
- CONSTRAINT PK_keyval PRIMARY KEY (keyd)
-)
- ;
-
-DELETE FROM "options" WHERE optname='version' ;
-INSERT INTO "options" (optname, optvalue) values('version','6.5.0');
\ No newline at end of file
diff --git a/db/postgresql/update/update650to660.sql b/db/postgresql/update/update650to660.sql
deleted file mode 100644
index 52f838353..000000000
--- a/db/postgresql/update/update650to660.sql
+++ /dev/null
@@ -1,10 +0,0 @@
-
-ALTER TABLE stores ADD disabled smallint DEFAULT 0 ;
-ALTER TABLE mfund ADD disabled smallint DEFAULT 0 ;
-
-INSERT INTO "metadata" (meta_type, description, meta_name, menugroup, disabled) VALUES( 2, 'OLAP аналіз', 'OLAP', 'Аналітика', 0);
-UPDATE "metadata" set menugroup ='Аналітика' where meta_name = 'ABC' ;
-
-
-DELETE FROM "options" WHERE optname='version' ;
-INSERT INTO "options" (optname, optvalue) values('version','6.6.0');
\ No newline at end of file
diff --git a/db/postgresql/update/update660to680.sql b/db/postgresql/update/update660to680.sql
deleted file mode 100644
index fa0bacefe..000000000
--- a/db/postgresql/update/update660to680.sql
+++ /dev/null
@@ -1,84 +0,0 @@
-
-
-CREATE INDEX IF NOT EXISTS IX_customers_phone
-ON customers (
- phone
-);
-
-CREATE INDEX IF NOT EXISTS IX_documents_state
-ON documents (
- state
-);
-
-ALTER TABLE messages ADD checked smallint DEFAULT 0 ;
-ALTER TABLE eventlist ADD event_type smallint DEFAULT 0 ;
-ALTER TABLE eventlist ADD details text DEFAULT NULL ;
-
-
-DROP VIEW messages_view;
-
-CREATE OR REPLACE 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,
- messages.checked AS checked,
- users_view.username AS username
-FROM (messages
- LEFT JOIN users_view
- ON ((messages.user_id = users_view.user_id)));
-
-DROP VIEW eventlist_view;
-
-CREATE OR REPLACE VIEW eventlist_view
-AS
-SELECT
- e.user_id AS user_id,
- e.eventdate AS eventdate,
- e.title AS title,
- e.description AS description,
- e.event_id AS event_id,
- e.customer_id AS customer_id,
- e.isdone AS isdone,
- e.event_type AS event_type,
- e.details AS details,
- c.customer_name AS customer_name,
- uv.username AS username
-FROM ((eventlist e
- LEFT JOIN customers c
- ON ((e.customer_id = c.customer_id)))
- LEFT JOIN users_view uv
- ON ((uv.user_id = e.user_id)));
-
-
-
-CREATE TABLE crontask (
- id INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- created TIMESTAMP NOT NULL,
- tasktype CHARACTER VARYING(64) NOT NULL,
- taskdata text DEFAULT NULL,
- starton TIMESTAMP DEFAULT NULL,
-
-CONSTRAINT PK_crontask PRIMARY KEY (id)
-)
- ;
-
-
-CREATE TABLE taglist (
- id INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- tag_type smallint NOT NULL,
- item_id INTEGER NOT NULL,
- tag_name CHARACTER VARYING(255),
-CONSTRAINT PK_taglist PRIMARY KEY (id)
-) ;
-
-INSERT INTO "metadata" (meta_type, description, meta_name, menugroup, disabled) VALUES( 2, 'Кафе', 'OutFood', 'Продажі', 0);
-INSERT INTO "metadata" (meta_type, description, meta_name, menugroup, disabled) VALUES( 3, 'Платіжний календар', 'PayTable', 'Каса та платежі', 0);
-
-
-DELETE FROM "options" WHERE optname='version' ;
-INSERT INTO "options" (optname, optvalue) values('version','6.8.0');
\ No newline at end of file
diff --git a/db/postgresql/update/update680to690.sql b/db/postgresql/update/update680to690.sql
deleted file mode 100644
index 9c2746cdd..000000000
--- a/db/postgresql/update/update680to690.sql
+++ /dev/null
@@ -1,72 +0,0 @@
-
-
-
-CREATE TABLE promocodes (
- id INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- code CHARACTER VARYING(16) NOT NULL,
- type smallint NOT NULL,
- disabled smallint NOT NULL default 0,
-
- details text DEFAULT NULL,
- CONSTRAINT PK_promocodes PRIMARY KEY (id)
-) ;
-
-CREATE UNIQUE INDEX IF NOT EXISTS IX_promocodes_code
-ON promocodes (
- code
-);
-
-
-
-
-DROP VIEW IF EXISTS customers_view ;
-
-
-CREATE 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,
- customers.createdon AS createdon,
- customers.leadsource AS leadsource,
- customers.leadstatus AS leadstatus,
- customers.country AS country,
- customers.passw AS passw,
- (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;
-
-
-
-ALTER TABLE "equipments" ADD branch_id INTEGER NULL ;
-ALTER TABLE "ppo_zformstat" ADD amount4 DECIMAL(11, 2) DEFAULT 0.00;
-
-
-INSERT INTO "metadata" ( "meta_type", "description", "meta_name", "menugroup", "disabled") VALUES( 2, 'Управлiнський баланс', 'Balance', '', 0);
-update "metadata" set description ='Програми лояльності' where meta_name='Discounts';
-update "metadata" set description ='Отримані послуги' where meta_name='IncomeService';
-update "metadata" set description ='Прибутки та видатки' where meta_name='PayBalance';
-
-DELETE FROM "options" WHERE optname='version' ;
-INSERT INTO "options" (optname, optvalue) values('version','6.9.0');
\ No newline at end of file
diff --git a/db/mysql/update/update600to610.sql b/db/update/update600to610.sql
similarity index 100%
rename from db/mysql/update/update600to610.sql
rename to db/update/update600to610.sql
diff --git a/db/mysql/update/update610to620.sql b/db/update/update610to620.sql
similarity index 100%
rename from db/mysql/update/update610to620.sql
rename to db/update/update610to620.sql
diff --git a/db/mysql/update/update620to630.sql b/db/update/update620to630.sql
similarity index 100%
rename from db/mysql/update/update620to630.sql
rename to db/update/update620to630.sql
diff --git a/db/mysql/update/update630to633.sql b/db/update/update630to633.sql
similarity index 100%
rename from db/mysql/update/update630to633.sql
rename to db/update/update630to633.sql
diff --git a/db/mysql/update/update633to640.sql b/db/update/update633to640.sql
similarity index 100%
rename from db/mysql/update/update633to640.sql
rename to db/update/update633to640.sql
diff --git a/db/mysql/update/update640to650.sql b/db/update/update640to650.sql
similarity index 100%
rename from db/mysql/update/update640to650.sql
rename to db/update/update640to650.sql
diff --git a/db/mysql/update/update650to660.sql b/db/update/update650to660.sql
similarity index 100%
rename from db/mysql/update/update650to660.sql
rename to db/update/update650to660.sql
diff --git a/db/mysql/update/update660to680.sql b/db/update/update660to680.sql
similarity index 100%
rename from db/mysql/update/update660to680.sql
rename to db/update/update660to680.sql
diff --git a/db/mysql/update/update680to690.sql b/db/update/update680to690.sql
similarity index 100%
rename from db/mysql/update/update680to690.sql
rename to db/update/update680to690.sql
diff --git a/www/app/entity/doc/document.php b/www/app/entity/doc/document.php
index 4d22f57c7..44c6a6543 100644
--- a/www/app/entity/doc/document.php
+++ b/www/app/entity/doc/document.php
@@ -166,13 +166,7 @@ private function packData() {
$this->content .= "";
- $conn = \ZDB\DB::getConnect();
- if($conn->dataProvider=='postgres') {
- $this->content .= base64_encode(serialize($this->detaildata) );
-
- } else {
- $this->content .= serialize($this->detaildata);
- }
+ $this->content .= serialize($this->detaildata);
@@ -211,13 +205,7 @@ private function unpackData() {
$det = $xml=substr($this->content,$endxml+15) ;
- $conn = \ZDB\DB::getConnect();
- if($conn->dataProvider=='postgres') {
- $this->detaildata = @unserialize( @base64_decode($det) );
-
- } else {
- $this->detaildata = @unserialize($det) ;
- }
+ $this->detaildata = @unserialize($det) ;
if(!is_array($this->detaildata)) {
diff --git a/www/app/entity/doc/goodsreceipt.php b/www/app/entity/doc/goodsreceipt.php
index 85f699ed2..63d310bb9 100644
--- a/www/app/entity/doc/goodsreceipt.php
+++ b/www/app/entity/doc/goodsreceipt.php
@@ -122,17 +122,17 @@ public function Execute() {
if ($total > 0) {
- $item->price = H::fa($item->price * $k); //пересчитываем учетную цену
+ $iprice = H::fa($item->price * $k); //пересчитываем учетную цену
} else {
- $item->price = 0;
+ $iprice = 0;
}
- $item->amount = $item->price * $item->quantity;
- $stock = \App\Entity\Stock::getStock($this->headerdata['store'], $item->item_id, $item->price, $item->snumber, $item->sdate, true);
+ // $item->amount = $iprice * $item->quantity;
+ $stock = \App\Entity\Stock::getStock($this->headerdata['store'], $item->item_id, $iprice, $item->snumber, $item->sdate, true);
- $sc = new Entry($this->document_id, $item->price * $item->quantity, $item->quantity);
+ $sc = new Entry($this->document_id, $iprice * $item->quantity, $item->quantity);
$sc->setStock($stock->stock_id);
- // $sc->setExtCode($item->price); //Для АВС
- $sc->setOutPrice($item->price);
+ // $sc->setExtCode($iprice); //Для АВС
+ $sc->setOutPrice($iprice);
$sc->tag=Entry::TAG_BAY;
$sc->save();
diff --git a/www/app/entity/subscribe.php b/www/app/entity/subscribe.php
index 71d1d11cf..b41923a89 100644
--- a/www/app/entity/subscribe.php
+++ b/www/app/entity/subscribe.php
@@ -15,6 +15,7 @@ class Subscribe extends \ZCL\DB\Entity
{
//типы событий
public const EVENT_DOCSTATE = 1;
+ public const EVENT_NEWCUST = 2;
//типы сообщений
public const MSG_NOTIFY = 1;
public const MSG_EMAIL = 2;
@@ -27,6 +28,7 @@ class Subscribe extends \ZCL\DB\Entity
public const RSV_DOCAUTHOR = 2;
public const RSV_USER = 3;
public const RSV_WH = 4;
+ public const RSV_SYSTEM = 5;
protected function init() {
$this->sub_id = 0;
@@ -80,16 +82,18 @@ protected function beforeSave() {
public static function getEventList() {
$list = array();
$list[self::EVENT_DOCSTATE] = "Зміна статусу документа";
+ // $list[self::EVENT_NEWCUST] = "Новий контрвгент";
return $list;
}
- public static function getMsgTypeList() {
+ public static function getMsgTypeList($rt=0) {
$sms = \App\System::getOptions('sms') ;
$list = array();
- $list[self::MSG_NOTIFY] = "Системне повідомлення";
+ $list[self::MSG_NOTIFY] = "Текст";
+
if(\App\System::useEmail()) {
$list[self::MSG_EMAIL] = "E-mail";
}
@@ -106,16 +110,35 @@ public static function getMsgTypeList() {
}
+
+ if($rt==self::RSV_CUSTOMER) {
+ unset($list[self::MSG_BOT]) ;
+ unset($list[self::MSG_NOTIFY]) ;
+ }
+
+ if($rt==self::RSV_WH || $rt==self::RSV_SYSTEM) {
+ unset($list[self::MSG_EMAIL]) ;
+ unset($list[self::MSG_VIBER]) ;
+ unset($list[self::MSG_BOT]) ;
+ unset($list[self::MSG_SMS]) ;
+ }
+
return $list;
}
- public static function getRecieverList() {
+ public static function getRecieverList($et=0) {
$list = array();
- $list[self::RSV_CUSTOMER] = "Контрагент документа";
- $list[self::RSV_DOCAUTHOR] = "Автор документа";
+ if($et==self::EVENT_DOCSTATE) {
+ $list[self::RSV_DOCAUTHOR] = "Автор документу";
+ $list[self::RSV_CUSTOMER] = "Контрагент документу";
+ }
+ if($et==self::EVENT_NEWCUST) {
+ $list[self::RSV_CUSTOMER] = "Контрагент";
+ }
$list[self::RSV_USER] = "Користувач системи";
$list[self::RSV_WH] = "Web Hook";
+ $list[self::RSV_SYSTEM] = "Системний лог";
return $list;
}
@@ -171,11 +194,11 @@ public static function onDocumentState($doc_id, $state) {
$notify = $sub->user_id;
}
}
- $text = $sub->getText($doc);
+ $text = $sub->getTextDoc($doc);
if ($notify > 0 && $sub->msg_type == self::MSG_NOTIFY) {
self::sendNotify($notify, $text);
}
- if ($notify == 0 && $sub->msg_type == self::MSG_NOTIFY) {
+ if ( $sub->reciever_type== self::RSV_SYSTEM) {
self::sendNotify(\App\Entity\Notify::SYSTEM, $text);
}
@@ -225,13 +248,13 @@ public static function onDocumentState($doc_id, $state) {
return;
}
- if ($sub->msg_type != self::MSG_NOTIFY) {
+ if ($sub->reciever_type != self::RSV_SYSTEM ){
- $text="Event: Документ ".$doc->meta_desc . "({$doc->document_number}) ";
+ // $text="Event: Документ ".$doc->meta_desc . "({$doc->document_number}) ";
- $text .= (' Стан ' .\App\Entity\Doc\Document::getStateName($doc->state) );
+ // $text .= (' Стан ' .\App\Entity\Doc\Document::getStateName($doc->state) );
- self::sendNotify(\App\Entity\Notify::SYSTEM, $text);
+ // self::sendNotify(\App\Entity\Notify::SYSTEM, $text);
}
@@ -244,7 +267,7 @@ public static function onDocumentState($doc_id, $state) {
*
* @param mixed $doc
*/
- public function getText($doc) {
+ private function getTextDoc($doc) {
//в разметке одинарные
$this->msgtext = str_replace('{', '{{', $this->msgtext);
$this->msgtext = str_replace('}', '}}', $this->msgtext);
@@ -253,6 +276,8 @@ public function getText($doc) {
$header = array();
+ $header['document_id'] = $doc->document_id;
+ $header['customer_id'] = $doc->customer_id;
$header['document_number'] = $doc->document_number;
$header['doc_dn'] = intval(preg_replace('/[^0-9]/', '', $doc->document_number));
$header['document_date'] = \App\Helper::fd($doc->document_date);
diff --git a/www/app/pages/firmlist.php b/www/app/pages/firmlist.php
index 4664e32ef..9d323fe57 100644
--- a/www/app/pages/firmlist.php
+++ b/www/app/pages/firmlist.php
@@ -57,7 +57,7 @@ public function __construct() {
$this->firmdetail->add(new Button('cancel'))->onClick($this, 'cancelOnClick');
$this->add(new Form('keyform'))->setVisible(false);
- $this->keyform->add(new SubmitButton('send'))->onClick($this, 'onSend', true) ;
+ $this->keyform->add(new SubmitButton('send'))->onClick($this, 'onSend') ;
$this->keyform->add(new Button('cancelppo'))->onClick($this, 'cancelOnClick');
$this->keyform->add(new Button('delppo'))->onClick($this, 'delOnClick');
$this->keyform->add(new TextInput('password'));
@@ -247,12 +247,11 @@ public function onSend($sender) {
$certdata = !empty($certfile['tmp_name']) ? @file_get_contents($certfile['tmp_name']) : '';
if(strlen($password)==0 || strlen($keydata)==0) {
- $this->addAjaxResponse(" $('#progress').text('Не вказано необхідні дані'); $('#send').attr('disabled',null); ");
-
+ $this->setError('Не вказано необхідні дані') ;
return;
}
if(strlen($certdata)==0 && $isjks == false) {
- $this->addAjaxResponse(" $('#progress').text('Не вказано необхідні дані'); $('#send').attr('disabled',null); ");
+ $this->setError('Не вказано необхідні дані') ;
return;
}
@@ -297,8 +296,7 @@ public function onSend($sender) {
$res = json_decode($result) ;
if(strlen($res->error) > 0) {
-
- $this->addAjaxResponse(" $('#progress').text({$res->error}); $('#send').attr('disabled',null); ");
+ $this->setErrorTopPage($res->error) ;
return;
@@ -319,7 +317,8 @@ public function onSend($sender) {
if($key==null) {
- $this->addAjaxResponse(" $('#progress').text('Invalid key'); $('#send').attr('disabled',null); ");
+
+ $this->setErrorTopPage('Invalid key') ;
return;
@@ -335,8 +334,8 @@ public function onSend($sender) {
} catch(\Exception $ee) {
$msg = $ee->getMessage() ;
- $msg = str_replace("'", "`", $msg) ;
- $this->addAjaxResponse(" $('#progress').text('{$msg}'); $('#send').attr('disabled',null); ");
+ $this->setErrorTopPage($msg) ;
+ H::logerror($msg) ;
return;
}
@@ -435,10 +434,14 @@ public function onSend($sender) {
$this->_firm->ppoisjks = $isjks ? 1 : 0 ;
$this->_firm->save();
- $kl = "Ключ завантажений";
-
- $this->addAjaxResponse(" $('#progress').text('{$kl}')");
+ $this->setSuccess("Ключ завантажений") ;
+
+ $this->firmtable->setVisible(true);
+ $this->firmdetail->setVisible(false);
+ $this->keyform->setVisible(false);
+ $this->firmtable->firmlist->Reload();
+
}
}
diff --git a/www/app/pages/reference/categorylist.php b/www/app/pages/reference/categorylist.php
index 9bb2b80c2..b8aa9c199 100644
--- a/www/app/pages/reference/categorylist.php
+++ b/www/app/pages/reference/categorylist.php
@@ -23,7 +23,8 @@ class CategoryList extends \App\Pages\Base
{
private $_rn=0;
private $_category;
- public $_catlist = array();
+ public $_catlist = [];
+ public $_cplist = [];
public function __construct() {
parent::__construct();
@@ -47,59 +48,55 @@ public function __construct() {
$this->add(new Form('categoryprice'))->setVisible(false);
$this->categoryprice->add(new Label('catprname')) ;
- $this->categoryprice->onSubmit($this, 'savepriceOnClick');
+ $this->categoryprice->add(new SubmitButton('savecp'))->onClick($this, 'savepriceOnClick');
+ $this->categoryprice->add(new SubmitButton('calccp'))->onClick($this, 'calcpriceOnClick');
$this->categoryprice->add(new ClickLink("backprice",$this,"cancelOnClick"));
- $this->categoryprice->add(new TextInput('chprice1'))->setVisible(false);
- $this->categoryprice->add(new TextInput('chprice2'))->setVisible(false);
- $this->categoryprice->add(new TextInput('chprice3'))->setVisible(false);
- $this->categoryprice->add(new TextInput('chprice4'))->setVisible(false);
- $this->categoryprice->add(new TextInput('chprice5'))->setVisible(false);
+ $this->categoryprice->add(new TextInput('chprice'));
$this->categoryprice->add(new CheckBox('rnd' ));
+ $this->categoryprice->add(new DataView('cplist', new ArrayDataSource($this, '_cplist'), $this, 'pricelistOnRow'));
-
+ $ptype=[];
$common = System::getOptions('common');
if (strlen($common['price1']) > 0) {
$this->categorydetail->editprice1->setVisible(true);
$this->categorydetail->editprice1->setAttribute('placeholder', $common['price1']);
- $this->categoryprice->chprice1->setVisible(true);
- $this->categoryprice->chprice1->setAttribute('placeholder', $common['price1']);
-
+ $ptype[1] = $common['price1'];
} else {
$this->categorydetail->editprice1->setVisible(false);
}
if (strlen($common['price2']) > 0) {
$this->categorydetail->editprice2->setVisible(true);
$this->categorydetail->editprice2->setAttribute('placeholder', $common['price2']);
- $this->categoryprice->chprice2->setVisible(true);
- $this->categoryprice->chprice2->setAttribute('placeholder', $common['price2']);
+ $ptype[2] = $common['price2'];
} else {
$this->categorydetail->editprice2->setVisible(false);
}
if (strlen($common['price3']) > 0) {
$this->categorydetail->editprice3->setVisible(true);
$this->categorydetail->editprice3->setAttribute('placeholder', $common['price3']);
- $this->categoryprice->chprice4->setVisible(true);
- $this->categoryprice->chprice4->setAttribute('placeholder', $common['price3']);
+ $ptype[3] = $common['price3'];
} else {
$this->categorydetail->editprice3->setVisible(false);
}
if (strlen($common['price4']) > 0) {
$this->categorydetail->editprice4->setVisible(true);
$this->categorydetail->editprice4->setAttribute('placeholder', $common['price4']);
- $this->categoryprice->chprice4->setVisible(true);
- $this->categoryprice->chprice4->setAttribute('placeholder', $common['price4']);
+ $ptype[4] = $common['price4'];
} else {
$this->categorydetail->editprice4->setVisible(false);
}
if (strlen($common['price5']) > 0) {
$this->categorydetail->editprice5->setVisible(true);
$this->categorydetail->editprice5->setAttribute('placeholder', $common['price5']);
- $this->categoryprice->chprice5->setVisible(true);
- $this->categoryprice->chprice5->setAttribute('placeholder', $common['price5']);
+ $ptype[5] = $common['price5'];
} else {
$this->categorydetail->editprice5->setVisible(false);
}
+
+ $this->categoryprice->add(new DropDownChoice('ptype',$ptype,1 ));
+
+
$this->categorydetail->add(new \Zippy\Html\Image('editimage', '/loadimage.php?id=0'));
$this->categorydetail->add(new \Zippy\Html\Form\File('editaddfile'));
$this->categorydetail->add(new CheckBox('editdelimage'));
@@ -400,70 +397,102 @@ public function pricesOnClick($sender) {
$this->categoryprice->catprname->setText($this->_category->cat_name);
$this->categorytable->setVisible(false);
$this->categoryprice->setVisible(true);
- $this->categoryprice->chprice1->setText('');
- $this->categoryprice->chprice2->setText('');
- $this->categoryprice->chprice3->setText('');
- $this->categoryprice->chprice4->setText('');
- $this->categoryprice->chprice5->setText('');
+ $this->categoryprice->chprice->setText('');
+ $this->_cplist=[];
+
+ $this->categoryprice->cplist->Reload() ;
+
}
public function savepriceOnClick($sender) {
- $p=[];
+ $pt =intval($this->categoryprice->ptype->getValue());
+ if($pt < 1) return;
+
+ foreach($this->_cplist as $it ) {
+
+ $item= \App\Entity\Item::load($it->item_id);
+ $item->{'price'.$pt} = round($it->newp);
+ $item->save();
+ }
- $p[1]=trim($this->categoryprice->chprice1->getText());
- $p[2]=trim($this->categoryprice->chprice2->getText());
- $p[3]=trim($this->categoryprice->chprice3->getText());
- $p[4]=trim($this->categoryprice->chprice4->getText());
- $p[5]=trim($this->categoryprice->chprice5->getText());
+
+ $this->categorytable->setVisible(true);
+ $this->categoryprice->setVisible(false);
+ }
+
+ public function calcpriceOnClick($sender) {
+ $this->_cplist=[];
+
+
+ $pt =intval($this->categoryprice->ptype->getValue());
+ if($pt < 1) return;
+
+ $v =trim($this->categoryprice->chprice->getText());
+
$rnd= $this->categoryprice->rnd->isChecked();
- foreach( \App\Entity\Item::find("disabled <> 1 and cat_id=". $this->_category->cat_id) as $item ) {
- foreach($p as $i=>$v) {
- if($v=='') continue;
- $isper = strpos($v,'%') > 0;
- $v = doubleval(str_replace('%','',$v) );
+ foreach( \App\Entity\Item::find("disabled <> 1 and cat_id=". $this->_category->cat_id,'itemname') as $item ) {
+ $isper = strpos($v,'%') > 0;
+ $v = doubleval(str_replace('%','',$v) );
+
+ $ip=$item->{'price'.$pt} ;
+ if(strpos($ip,'%') > 0) continue;
+ if(strlen($ip)== 0) continue;
- $ip=$item->{'price'.$i} ;
- if(strpos($ip,'%') > 0) continue;
- if(strlen($ip)== 0) continue;
+ if($isper) {
+ $ipp= $ip * ($v/100) ;
+ $ip = $ip+$ipp;
- if($isper) {
- $ipp= $ip * ($v/100) ;
- $ip = $ip+$ipp;
-
- } else {
- $ip = $ip + $v;
- }
- $ip = round($ip);
-
- if($rnd) {
-
- $ld = $ip % 10;
- if($ld==0) $ip = $ip-1;
- if($ld==1) $ip = $ip-2;
- if($ld==2) $ip = $ip-3; if($ld==3) $ip = $ip-4;
- if($ld==4) $ip = $ip-5;
- if($ld==5) $ip = $ip+4;
- if($ld==6) $ip = $ip+3;
- if($ld==7) $ip = $ip+2;
- if($ld==8) $ip = $ip+1;
-
- }
+ } else {
+ $ip = $ip + $v;
+ }
+ $ip = round($ip);
+
+ if($rnd) {
+
+ $ld = $ip % 10;
+ if($ld==0) $ip = $ip-1;
+ if($ld==1) $ip = $ip-2;
+ if($ld==2) $ip = $ip-3;
+ if($ld==3) $ip = $ip-4;
+ if($ld==4) $ip = $ip-5;
+ if($ld==5) $ip = $ip+4;
+ if($ld==6) $ip = $ip+3;
+ if($ld==7) $ip = $ip+2;
+ if($ld==8) $ip = $ip+1;
- $item->{'price'.$i} = $ip;
- }
- $item->save();
- }
+ }
+ // $item->{'price'.$pt} = $ip;
+
+ // $item->save();
+
+
+ $di = new \App\DataItem() ;
+ $di->item_id=$item->item_id;
+ $di->name=$item->itemname;
+ $di->oldp=$item->{'price'.$pt} ;
+ $di->newp=$ip ;
+
+ $this->_cplist[$item->item_id] = $di;
+
+
+ }
-
+ $this->categoryprice->cplist->Reload() ;
- $this->categorytable->setVisible(true);
- $this->categoryprice->setVisible(false);
}
+ public function pricelistOnRow($row){
+ $item = $row->getDataItem();
+
+ $row->add(new Label('cplname', $item->name));
+ $row->add(new Label('cplold', $item->oldp));
+ $row->add(new TextInput('cplnew',new \Zippy\Binding\PropertyBinding($item, 'newp')));
+ }
+
}
diff --git a/www/app/pages/register/itemlist.php b/www/app/pages/register/itemlist.php
index 246c8b21d..19f0280d4 100644
--- a/www/app/pages/register/itemlist.php
+++ b/www/app/pages/register/itemlist.php
@@ -378,32 +378,37 @@ public function oncsv($sender) {
$header['D1'] = "Од.";
$header['E1'] = "Категорiя";
$header['F1'] = "Бренд";
- $header['G1'] = "Кiл.";
- $header['H1'] = "Обл. цiна";
+ $header['G1'] = "Комірка";
+ $header['H1'] = "Кiл.";
+ $header['I1'] = "Обл. цiна";
if($this->_tvars["noshowpartion"] == true) {
- $header['H1'] ='';
+ $header['I1'] ='';
}
if(strlen($common['price1'])) {
- $header['I1'] = $common['price1'];
+ $header['J1'] = $common['price1'];
}
if(strlen($common['price2'])) {
- $header['J1'] = $common['price2'];
+ $header['K1'] = $common['price2'];
}
if(strlen($common['price3'])) {
- $header['K1'] = $common['price3'];
+ $header['L1'] = $common['price3'];
}
if(strlen($common['price4'])) {
- $header['L1'] = $common['price4'];
+ $header['M1'] = $common['price4'];
}
if(strlen($common['price5'])) {
- $header['M1'] = $common['price5'];
+ $header['N1'] = $common['price5'];
}
- $header['N1'] = "На суму";
+ $header['O1'] = "На суму";
+ $header['P1'] = "Опис";
$i = 1;
foreach ($list as $item) {
+
+ $itemor = Item::load($item->item_id) ;
+
$i++;
$data['A' . $i] = $item->itemname;
$data['B' . $i] = $item->item_code;
@@ -411,31 +416,32 @@ public function oncsv($sender) {
$data['D' . $i] = $item->msr;
$data['E' . $i] = $item->cat_name;
$data['F' . $i] = $item->manufacturer;
+ $data['G' . $i] = $itemor->cell;
$qty = $item->getQuantity($store);
$pr = $item->getPartion($store);
- $data['G' . $i] = H::fqty($qty);
- $data['H' . $i] = H::fa($pr);
+ $data['H' . $i] = H::fqty($qty);
+ $data['I' . $i] = H::fa($pr);
if($this->_tvars["noshowpartion"] == true) {
- $data['H' . $i] ='';
+ $data['I' . $i] ='';
}
if ($item->price1 > 0) {
- $data['I' . $i] = $item->getPrice('price1', $store);
+ $data['J' . $i] = $item->getPrice('price1', $store);
}
if ($item->price2 > 0) {
- $data['J' . $i] = $item->getPrice('price2', $store);
+ $data['K' . $i] = $item->getPrice('price2', $store);
}
if ($item->price3 > 0) {
- $data['K' . $i] = $item->getPrice('price3', $store);
+ $data['L' . $i] = $item->getPrice('price3', $store);
}
if ($item->price4 > 0) {
- $data['L' . $i] = $item->getPrice('price4', $store);
+ $data['M' . $i] = $item->getPrice('price4', $store);
}
if ($item->price5 > 0) {
- $data['M' . $i] = $item->getPrice('price5', $store);
+ $data['N' . $i] = $item->getPrice('price5', $store);
}
if($pt=='price') {
@@ -443,7 +449,8 @@ public function oncsv($sender) {
} else {
$am = $qty * $item->getPrice($pt, $store) ;
}
- $data['N' . $i] = H::fa(abs($am));
+ $data['O' . $i] = H::fa(abs($am));
+ $data['P' . $i] = $itemor->description;
}
diff --git a/www/app/pages/subscribes.php b/www/app/pages/subscribes.php
index 67f569485..80cbc40a0 100644
--- a/www/app/pages/subscribes.php
+++ b/www/app/pages/subscribes.php
@@ -56,26 +56,59 @@ public function __construct() {
$this->editform->add(new ClickLink('delete'))->onClick($this, 'OnDelete');
$this->Reload();
+
}
public function update($sender) {
- $et = $this->editform->editeventtype->getValue();
- $this->editform->editdoctype->setVisible($et == Subscribe::EVENT_DOCSTATE);
- $this->editform->editstate->setVisible($et == Subscribe::EVENT_DOCSTATE);
+
+
+
+ $et = $this->editform->editeventtype->getValue();
+ if($sender->id=='editeventtype') {
+ $l=Subscribe::getRecieverList($et) ;
+ $this->editform->editrecievertype->setOptionList($l);
+ $this->editform->editrecievertype->setValue(array_shift($l));
+
+ if($et == Subscribe::EVENT_DOCSTATE) {
+ $this->editform->editdoctype->setVisible(true);
+ $this->editform->editstate->setVisible(true);
+ }
+ if($et == Subscribe::EVENT_NEWCUST) {
+ $this->editform->editdoctype->setVisible(false);
+ $this->editform->editstate->setVisible(false);
+ }
+ $this->update($this->editform->editrecievertype) ;
+ return;
+ }
$rt = $this->editform->editrecievertype->getValue();
- $this->editform->edituser->setVisible($rt == Subscribe::RSV_USER);
+
+ if($sender->id=='editrecievertype') {
+ $l=Subscribe::getMsgTypeList($rt) ;
+ $this->editform->editmsgtype->setOptionList($l);
+ $this->editform->editmsgtype->setValue(array_shift($l));
+ $this->update($this->editform->editmsgtype) ;
+ return;
+
+ }
$mt = $this->editform->editmsgtype->getValue();
- $this->editform->editmsgsubject->setVisible($mt == Subscribe::MSG_EMAIL);
- $this->editform->editattach->setVisible( $mt == Subscribe::MSG_BOT);
- $this->editform->edithtml->setVisible($mt == Subscribe::MSG_EMAIL || $mt == Subscribe::MSG_BOT);
-
- $this->editform->editurl->setVisible(false);
- if($rt == Subscribe::RSV_WH) {
- $this->editform->editmsgtype->setVisible(false);
- $this->editform->editurl->setVisible(true);
+
+ if($sender->id=='editmsgtype') {
+ $this->editform->editmsgsubject->setVisible(false);
+ $this->editform->editattach->setVisible( false);
+ $this->editform->edithtml->setVisible(false);
+ $this->editform->edituser->setVisible(false);
+ $this->editform->editmsgtype->setVisible(true);
- }
+ $this->editform->editurl->setVisible($mt == Subscribe::RSV_WH);
+
+ if($mt == Subscribe::MSG_EMAIL) {
+ $this->editform->editmsgsubject->setVisible(true);
+ }
+ return;
+
+ }
+
}
@@ -111,6 +144,8 @@ public function onAdd($sender) {
$this->editform->editeventtype->setValue(Subscribe::EVENT_DOCSTATE);
$this->editform->editrecievertype->setValue(Subscribe::EVENT_DOCSTATE);
$this->update($this->editform->editeventtype);
+
+ $this->update( $this->editform->editeventtype) ;
}
public function OnEdit($sender) {
@@ -134,6 +169,8 @@ public function OnEdit($sender) {
$this->update($this->editform->editeventtype);
$this->plist->setVisible(false);
$this->editform->setVisible(true);
+
+ $this->update( $this->editform->editeventtype) ;
}
public function OnSave($sender) {
diff --git a/www/app/system.php b/www/app/system.php
index 3f1f3694c..7480d27af 100644
--- a/www/app/system.php
+++ b/www/app/system.php
@@ -10,7 +10,7 @@
*/
class System
{
- public const CURR_VERSION= "6.9.5";
+ public const CURR_VERSION= "6.9.6";
public const REQUIRED_DB= "6.9.0";
private static $_options = array(); // для кеширования
diff --git a/www/init.php b/www/init.php
index 9273f1d7d..86436dacd 100644
--- a/www/init.php
+++ b/www/init.php
@@ -66,14 +66,8 @@
//Параметры соединения с БД
-if(($_config['db']['driver'] ?? '') =='postgres') {
+\ZDB\DB::config($_config['db']['host'], $_config['db']['name'], $_config['db']['user'], $_config['db']['pass']);
- \ZDB\DB::config($_config['db']['host'], $_config['db']['name'], $_config['db']['user'], $_config['db']['pass'], "postgres");
- $ADODB_QUOTE_FIELDNAMES = false;
-
-} else {
- \ZDB\DB::config($_config['db']['host'], $_config['db']['name'], $_config['db']['user'], $_config['db']['pass']);
-}
//проверяем соединение
diff --git a/www/templates/pages/firmlist.html b/www/templates/pages/firmlist.html
index 0eeeee823..c5539f81e 100644
--- a/www/templates/pages/firmlist.html
+++ b/www/templates/pages/firmlist.html
@@ -187,10 +187,10 @@
Завантаження ключа та сертифiкату
-
Якщо помилка з таймаутом
+
Якщо помилка з таймаутом (завантаження може зайняти кілька хвилин)
-
+
@@ -208,9 +208,9 @@ Завантаження ключа та сертифiкату
}
function check_send(){
- $('#progress').text('Завантаження...');
- $('#send').attr('disabled','disabled');
-
+
+ document.getElementById('dialogwait').showModal()
+
return true;
}
diff --git a/www/templates/pages/reference/categorylist.html b/www/templates/pages/reference/categorylist.html
index 65f36150b..a7379f988 100644
--- a/www/templates/pages/reference/categorylist.html
+++ b/www/templates/pages/reference/categorylist.html
@@ -142,26 +142,42 @@ Категорії товарів
-
+
@@ -181,7 +197,12 @@
});
-
+ function check_savecp(ele){
+
+ document.getElementById('dialogwait').showModal()
+ return true;
+
+ }