[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 97/162: Currency : SQL quant_fin is adapted
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 97/162: Currency : SQL quant_fin is adapted |
Date: |
Sat, 11 Jul 2020 13:23:50 -0400 (EDT) |
sparkyx pushed a commit to annotated tag E-4
in repository noalyss.
commit 5d16283d952ff00646cee3796ea331dad25b3bcb
Author: Dany De Bontridder <danydb@noalyss.eu>
AuthorDate: Wed Nov 28 12:27:16 2018 +0100
Currency : SQL quant_fin is adapted
---
include/sql/patch/upgrade130.sql | 46 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 46 insertions(+)
diff --git a/include/sql/patch/upgrade130.sql b/include/sql/patch/upgrade130.sql
new file mode 100644
index 0000000..cfecdda
--- /dev/null
+++ b/include/sql/patch/upgrade130.sql
@@ -0,0 +1,46 @@
+begin;
+
+CREATE OR REPLACE FUNCTION isnumeric(text) RETURNS BOOLEAN AS $$
+DECLARE x NUMERIC;
+BEGIN
+ x = $1::NUMERIC;
+ RETURN TRUE;
+EXCEPTION WHEN others THEN
+ RETURN FALSE;
+END;
+$$
+STRICT
+LANGUAGE plpgsql IMMUTABLE;
+
+CREATE OR REPLACE FUNCTION isdate(text,text) RETURNS BOOLEAN AS $$
+DECLARE x timestamp;
+BEGIN
+ x := to_date($1,$2);
+ RETURN TRUE;
+EXCEPTION WHEN others THEN
+ RETURN FALSE;
+END;
+$$
+LANGUAGE plpgsql;
+
+ALTER TABLE public.jrn_def ADD currency_id int NULL;
+ALTER TABLE public.jrn_def ALTER COLUMN currency_id SET DEFAULT 0;
+update public.jrn_def set currency_id = 0 ;
+ALTER TABLE public.jrn_def ALTER COLUMN currency_id SET NOT NULL;
+ALTER TABLE public.jrn_def ADD CONSTRAINT jrn_def_currency_fk FOREIGN KEY
(currency_id) REFERENCES public.currency(id);
+
+COMMENT ON COLUMN public.jrn_def.currency_id IS 'Default currency for
financial ledger';
+
+
+alter table quant_fin add j_id bigint;
+
+with j_fin as (
+select jrnx.j_id,quant_fin.qf_id from quant_fin join jrn using (jr_id) join
jrnx on (j_grpt=jr_grpt_id and f_id=qf_other)
+)
+update quant_fin set j_id =j_fin.j_id from j_fin where
j_fin.qf_id=quant_fin.qf_id;
+
+alter table quant_fin add constraint jrnx_j_id_fk foreign key (j_id )
references jrnx(j_id) on delete cascade on update cascade;
+
+
+insert into version (val,v_description) values (131,'Currency : adapt
quant_fin');
+commit;
- [Noalyss-commit] [noalyss] 88/162: Merge branch 'master' into r700-currency, (continued)
- [Noalyss-commit] [noalyss] 88/162: Merge branch 'master' into r700-currency, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 87/162: PHP 7.2 : fix incomptability, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 89/162: translate, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 92/162: Merge branch 'master' into r700-currency, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 93/162: Fin : currency , add missing info into Operation_Currency, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 91/162: currency : adapt for FIN, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 96/162: Currency : financial use the rate depending of the operation date, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 90/162: acc_ledger_fin : cosmetic : input, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 94/162: Fin currency : detail operation show currency , rate and amount, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 95/162: Modify quant_fin , we add a column j_id to have a fk to jrnx and operation_currency, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 97/162: Currency : SQL quant_fin is adapted,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 98/162: Version DB 131, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 99/162: reverse for quant_fin, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 100/162: Reverse for Currency, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 102/162: Currency : adapt for bank saldo, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 103/162: Currency : export PDF and CSV with currency for printing financial ledger listing(oneline), Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 101/162: Background color, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 104/162: acc_ledger_fin . translation, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 106/162: Currency : All ledger's listing mode , html , csv and pdf, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 111/162: Currency : ledger printing for FIN + detail operation, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 105/162: Indentation, Dany De Bontridder, 2020/07/11