[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpcompta-dev] r387 - tag/rel650/tva/sql
From: |
phpcompta-dev |
Subject: |
[Phpcompta-dev] r387 - tag/rel650/tva/sql |
Date: |
Sun, 1 Jul 2012 17:12:47 +0200 (CEST) |
Author: danydb
Date: 2012-07-01 17:12:46 +0200 (Sun, 01 Jul 2012)
New Revision: 387
Modified:
tag/rel650/tva/sql/patch2.sql
Log:
correct bug with unexisting tva_id
Modified: tag/rel650/tva/sql/patch2.sql
===================================================================
--- tag/rel650/tva/sql/patch2.sql 2012-06-29 22:32:26 UTC (rev 386)
+++ tag/rel650/tva/sql/patch2.sql 2012-07-01 15:12:46 UTC (rev 387)
@@ -36,7 +36,7 @@
f record;
n_size_tva int;
n_size_account int;
-
+ n_exist_tva int;
begin
for i in select pcode,pvalue,paccount from tva_belge.parameter
@@ -56,9 +56,13 @@
while n_size_account <> 0 loop
- insert into tva_belge.parameter_chld
(pcode,tva_id,pcm_val)
- values
(i.pcode,a_tva_id[n_size_tva]::numeric,a_account[n_size_account]::account_type);
+ select count(*) into n_exist_tva from tva_rate where
tva_id=a_tva_id[n_size_tva]::numeric;
+ if n_exist_tva != 0 then
+ raise notice 'TVA % exist count =
%',a_tva_id[n_size_tva],n_exist_tva;
+ insert into tva_belge.parameter_chld
(pcode,tva_id,pcm_val)
+ values
(i.pcode,a_tva_id[n_size_tva]::numeric,a_account[n_size_account]::account_type);
+ end if;
n_size_account := n_size_account -1;
end loop;
n_size_account := array_upper(a_account,1);
@@ -86,7 +90,7 @@
f record;
n_size_tva int;
n_size_account int;
-
+ n_exist_tva int;
begin
for i in select distinct pvalue from tva_belge.parameter WHERE pcode in
('GRIL00','GRIL01','GRIL02','GRIL03')
@@ -101,9 +105,12 @@
while n_size_tva <> 0 loop
-
- insert into tva_belge.parameter_chld (pcode,tva_id)
- values ('ASSUJETTI',a_tva_id[n_size_tva]::numeric);
+ select count(*) into n_exist_tva from tva_rate where
tva_id=a_tva_id[n_size_tva]::numeric;
+ raise notice 'TVA % exist count =
%',a_tva_id[n_size_tva],n_exist_tva;
+ if n_exist_tva != 0 then
+ insert into tva_belge.parameter_chld (pcode,tva_id)
+ values
('ASSUJETTI',a_tva_id[n_size_tva]::numeric);
+ end if;
n_size_tva := n_size_tva -1;
end loop;
@@ -124,4 +131,4 @@
alter table tva_belge.parameter drop column paccount;
alter table tva_belge.parameter drop column pvalue;
insert into tva_belge.version(vdesc) values ('Version 2 : amélioration
plugin');
-commit;
\ No newline at end of file
+-- commit;
\ No newline at end of file
---
PhpCompta est un logiciel de comptabilité libre en ligne (full web)
Projet opensource http://www.phpcompta.eu
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpcompta-dev] r387 - tag/rel650/tva/sql,
phpcompta-dev <=