54 $this->cn->exec_sql(
'create schema tva_belge');
58 CREATE TABLE tva_belge.assujetti
61 start_date date NOT NULL,
62 end_date date NOT NULL,
64 periodicity character(1) NOT NULL,
69 date_decl date DEFAULT now(),
71 CONSTRAINT assujetti_pk PRIMARY KEY (a_id)
74 $this->cn->exec_sql(
$sql);
78 CREATE TABLE tva_belge.assujetti_chld
80 ac_id serial NOT NULL,
82 ac_tvanum text NOT NULL,
83 ac_amount numeric(20,4) NOT NULL,
84 ac_vat numeric(20,4) NOT NULL,
85 ac_qcode text NOT NULL,
86 ac_name text NOT NULL,
87 CONSTRAINT assujetti_chld_pk PRIMARY KEY (ac_id),
88 CONSTRAINT assujetti_fk FOREIGN KEY (a_id)
89 REFERENCES tva_belge.assujetti (a_id) MATCH SIMPLE
90 ON UPDATE NO ACTION ON DELETE CASCADE
93 $this->cn->exec_sql(
$sql);
98 CREATE TABLE tva_belge.intracomm
100 i_id serial NOT NULL,
101 start_date date not null,
102 end_date date not null,
104 periodicity
char(1) not null,
109 date_decl date
default now(),
111 CONSTRAINT intracom_pk PRIMARY KEY (i_id)
114 $this->cn->exec_sql(
$sql);
119 CREATE TABLE tva_belge.intracomm_chld
123 ic_tvanum text NOT NULL,
124 ic_amount numeric(20,4) NOT NULL,
125 ic_code character varying(1) NOT NULL,
126 ic_periode character varying(6) NOT NULL,
127 ic_qcode text not null,
128 ic_name text not null,
129 CONSTRAINT intracom_chld_pk PRIMARY KEY (ic_id),
130 CONSTRAINT intracom_fk FOREIGN KEY (i_id)
131 REFERENCES tva_belge.intracomm (i_id) MATCH SIMPLE
132 ON UPDATE NO ACTION ON DELETE CASCADE
135 $this->cn->exec_sql(
$sql);
142 create
table tva_belge.declaration_amount
145 d00 numeric(20,4)
default 0.0 not null,
146 d01 numeric(20,4)
default 0.0 not null,
147 d02 numeric(20,4)
default 0.0 not null,
148 d03 numeric(20,4)
default 0.0 not null,
149 d44 numeric(20,4)
default 0.0 not null,
150 d45 numeric(20,4)
default 0.0 not null,
151 d46 numeric(20,4)
default 0.0 not null,
152 d47 numeric(20,4)
default 0.0 not null,
153 d48 numeric(20,4)
default 0.0 not null,
154 d49 numeric(20,4)
default 0.0 not null,
155 d81 numeric(20,4)
default 0.0 not null,
156 d82 numeric(20,4)
default 0.0 not null,
157 d83 numeric(20,4)
default 0.0 not null,
158 d84 numeric(20,4)
default 0.0 not null,
159 d85 numeric(20,4)
default 0.0 not null,
160 d86 numeric(20,4)
default 0.0 not null,
161 d87 numeric(20,4)
default 0.0 not null,
162 d88 numeric(20,4)
default 0.0 not null,
163 d54 numeric(20,4)
default 0.0 not null,
164 d55 numeric(20,4)
default 0.0 not null,
165 d56 numeric(20,4)
default 0.0 not null,
166 d57 numeric(20,4)
default 0.0 not null,
167 d61 numeric(20,4)
default 0.0 not null,
168 d63 numeric(20,4)
default 0.0 not null,
169 dxx numeric(20,4)
default 0.0 not null,
170 d59 numeric(20,4)
default 0.0 not null,
171 d62 numeric(20,4)
default 0.0 not null,
172 d64 numeric(20,4)
default 0.0 not null,
173 dyy numeric(20,4)
default 0.0 not null,
174 d71 numeric(20,4)
default 0.0 not null,
175 d72 numeric(20,4)
default 0.0 not null,
176 d91 numeric(20,4)
default 0.0 not null,
177 start_date date not null,
178 end_date date not null,
180 periodicity
char(1) not null,
185 date_decl date
default now(),
187 CONSTRAINT declaration_amount_pkey PRIMARY KEY (da_id)
190 $this->cn->exec_sql(
$sql);
195 CREATE TABLE tva_belge.parameter
200 CONSTRAINT parameter_pkey PRIMARY KEY (pcode)
203 $this->cn->exec_sql(
$sql);
206 'GRIL00'=>array(
'6',
''),
207 'GRIL01'=>array(
'3',
''),
208 'GRIL02'=>array(
'2',
''),
209 'GRIL03'=>array(
'1',
''),
210 'GRIL44'=>array(
'',
''),
211 'GRIL45'=>array(
'',
''),
212 'GRIL46'=>array(
'5',
'70%,71%'),
213 'GRIL47'=>array(
'',
''),
214 'GRIL48'=>array(
'',
'7091'),
215 'GRIL49'=>array(
'',
'7092'),
216 'GRIL81'=>array(
'1,2,3',
'60%'),
217 'GRIL82'=>array(
'1,2,3',
'61%'),
218 'GRIL83'=>array(
'1,2,3',
'22%,23%,24%,25%'),
219 'GRIL84'=>array(
'1,2,3,4',
'6091'),
220 'GRIL85'=>array(
'',
''),
221 'GRIL86'=>array(
'5',
'61%,22%,23%,24%,25%,60%'),
222 'GRIL87'=>array(
'',
''),
223 'GRIL88'=>array(
'',
''),
224 'GRIL54'=>array(
'1,2,3',
'7%'),
225 'GRIL55'=>array(
'',
''),
226 'GRIL56'=>array(
'',
''),
227 'GRIL57'=>array(
'',
''),
228 'GRIL61'=>array(
'',
''),
229 'GRIL63'=>array(
'',
''),
230 'GRIL59'=>array(
'1,2,3',
'6%,22%,23%,24%,25%'),
231 'GRIL62'=>array(
'',
''),
232 'GRIL64'=>array(
'',
''),
233 'ATVA'=>array(
'',
'4117')
236 foreach (
$array as $code=>$value) {
237 $this->cn->exec_sql(
'insert into tva_belge.parameter(pcode,pvalue,paccount) values ($1,$2,$3)',
238 array($code,$value[0],$value[1]));
create_table_assujetti_child()
create_table_declaration_amount()
create the table tva_belge.declaration_amount
install()
install the plugin, create all the needed schema, tables, proc in the database
if(isset($_POST['remove'])) $array
create_table_intra_child()