Plugins  LAST
 All Data Structures Files Functions Variables Pages
Public Member Functions | Static Public Member Functions | Protected Attributes
Ext_Tva Class Reference
Inheritance diagram for Ext_Tva:
Inheritance graph
Collaboration diagram for Ext_Tva:
Collaboration graph

Public Member Functions

 seek ($cond, $p_array=null)
 retrieve * row thanks a condition More...
 
 from_array ($p_array)
 
 insert ()
 
 update ()
 
 load ()
 
 delete ()
 
 verify ()
 
 compute ()
 compute the amount More...
 
 display_declaration_amount ()
 get into the table quant_purchase or quant_sold the amount of VAT More...
 
 menu ()
 
 propose_form ()
 
 display ()
 
 get_parameter ($p_string)
 
 set_parameter ($p_string, $p_value)
 
 get_info ()
 
 save ()
 
 blank ($p_year, $p_periode, $p_flag_quaterly)
 
 display_info ()
 display the information about the company More...
 

Static Public Member Functions

static choose_periode ($by_year=false)
 

Protected Attributes

 $variable
 

Detailed Description

Definition at line 30 of file class_ext_tva.php.

Member Function Documentation

Ext_Tva_Gen::blank (   $p_year,
  $p_periode,
  $p_flag_quaterly 
)
inherited

Definition at line 132 of file class_ext_tvagen.php.

References $GLOBALS, $p_year, and Ext_Tva_Gen\set_parameter().

132  {
133  // load parameter from myown
134  $own=new Own($this->db);
135  $this->set_parameter("name",$own->MY_NAME);
136  $this->set_parameter("num_tva",$own->MY_TVA);
137  $this->set_parameter('adress',$own->MY_STREET.",".$own->MY_NUMBER);
138  $this->set_parameter('country',$own->MY_COUNTRY." ".$own->MY_CP." ".$own->MY_COMMUNE);
139  $this->set_parameter('flag_periode',$p_flag_quaterly);
140  $this->set_parameter('periode_dec',$p_periode);
141  $this->set_parameter('exercice',$p_year);
142 
143  try {
144  $this->verify() ;
145  } catch ( Exception $e) {
146  echo $e->getMessage();
147  throw $e;
148  }
149  // by month
150  if ( $p_flag_quaterly == 1) {
151  // start periode = 01 to 31, $p_periode contains the month
152  $per_start="01.".$p_periode.".".$p_year;
153  $day=31;
154  $per_end="31".".".$p_periode.".".$p_year;
155  while ( checkdate($p_periode,$day,$p_year) == false && $day > 25) {
156  $day--;
157  $per_end=$day.".".$p_periode.".".$p_year;
158  }
159  if ($day < 28 ) { echo __FILE__.__LINE__." Erreur de date $day"; exit;}
160  }
161 
162  if ( $p_flag_quaterly == 2 ) {
163  // compute start periode
164  $per_start=$GLOBALS['quaterly_limit'][$p_periode][0].".".$p_year;
165  $per_end=$GLOBALS['quaterly_limit'][$p_periode][1].".".$p_year;
166 
167  }
168  if ( $p_flag_quaterly == 3 ) {
169  // compute start periode
170  $per_start='01.01.'.$p_year;
171  $per_end='31.12.'.$p_year;
172  }
173 
174  $this->set_parameter('start_periode',$per_start);
175  $this->set_parameter('end_periode',$per_end);
176 
177  }
$GLOBALS['quaterly_limit']
set_parameter($p_string, $p_value)
static Ext_Tva_Gen::choose_periode (   $by_year = false)
staticinherited

Definition at line 82 of file class_ext_tvagen.php.

References $_REQUEST, $array, $by_year, $r, $str_byyear, $str_hidden, $str_month, $str_monthly, $str_quater, $str_quaterly, $str_submit, $str_year, and $year.

82  {
83  require_once NOALYSS_INCLUDE.'/lib/class_iradio.php';
84  $monthly=new IRadio('periodic');
85  $monthly->value=1;
86 
87  // month
88  $month=new ISelect('bymonth');
89  $array=array ();
90  for ($i=0;$i<12;$i++) {
91  $array[$i]['value']=$i+1; $array[$i]['label']=sprintf('%02d',($i+1));
92  }
93  $month->value=$array;
94  $monthly->selected=true;
95  $str_monthly=$monthly->input();
96  $str_month=$month->input();
97  // year
98  $year = new IText('year');
99  $year->size=4;
100  $str_year=$year->input();
101 
102  // Tri
103  $quater=new ISelect('byquaterly');
104  $array=array();
105  for ($i=0;$i<4;$i++) {
106  $array[$i]['value']=$i+1; $array[$i]['label']=sprintf('%02d',($i+1));
107  }
108  $quater->value=$array;
109  $quaterly=new IRadio('periodic');
110  $quaterly->value=2;
111  $str_quaterly=$quaterly->input();
112  $str_quater=$quater->input();
113 
114  $str_submit=HtmlInput::submit('decl',_('Afficher'));
115  $str_hidden=HtmlInput::extension().dossier::hidden();
116  if (isset($_REQUEST['sa']))
117  $str_hidden.=HtmlInput::hidden('sa',$_REQUEST['sa']);
118  $str_hidden.=HtmlInput::request_to_hidden(array('ac'));
119  $str_byyear='';
120  if ( $by_year == true ) {
121  $yearly=new IRadio('periodic');
122  $yearly->value=3;
123  $str_byyear=$yearly->input();
124  }
125  ob_start();
126  require_once('form_periode.php');
127  $r=ob_get_contents();
128  ob_end_clean();
129  return $r;
130  }
$r
if(isset($_POST['remove'])) $array
$_REQUEST['sb']
Definition: am_print.php:39
Ext_Tva::compute ( )

compute the amount

Todo:
on ne peut pas calculer de cette façon à cause des opérations qui comprennent plusieurs taux de tva diff. il faut aller chercher les montants dans les tables quant_*
Todo:
GRIL56 - GRIL57 - GRIL61 - GRIL63

Definition at line 197 of file class_ext_tva.php.

References $amount, $array, and Ext_Tva_Gen\set_parameter().

197  {
198  // check that this exercice exist
199  $exist=$this->db->get_value('select count(*) from jrn join parm_periode on (p_id=jr_tech_per) where date_part(\'year\',p_start)=$1',array($this->exercice));
200  if ( $exist==0 ) { alert(_("Cette exercice comptable n'est pas dans ce dossier")); throw new Exception('INVALYEAR',1 ) ;}
201 
202  // set default value 0 for all
203  $keys=array_keys($this->variable);
204  for ($i = 0;$i < count($this->variable);$i++) {
205  $idx=$keys[$i];
206  $this->$idx=0;
207  if ( $idx=='d91') break;
208  }
209 
210  $ctva=new Tva_Parameter($this->db);
211  /**
212  *@todo on ne peut pas calculer de cette façon à cause des opérations qui comprennent plusieurs taux de tva diff.
213  *il faut aller chercher les montants dans les tables quant_*
214  */
215  $array=array('00','01','02','03','44','45','46','47','48','49');
216  for ($e=0;$e<count($array);$e++) {
217  // Compute frame 2
218  $oTva=new Tva_amount($this->db,'out',$this->start_periode,$this->end_periode);
219  $oTva->set_parameter('grid','GRIL'.$array[$e]);
220  $amount=$oTva->amount_operation();
221  $this->set_parameter('d'.$array[$e],$amount);
222  }
223 
224  $array=array('81','82','83','84','85','86','87','88');
225  for ($e=0;$e<count($array);$e++) {
226  // Compute frame 3
227  $oTva=new Tva_amount($this->db,'in',$this->start_periode,$this->end_periode);
228  $oTva->set_parameter('grid','GRIL'.$array[$e]);
229  $amount=$oTva->amount_operation();
230  $this->set_parameter('d'.$array[$e],$amount);
231 
232  }
233  //Frame IV
234  $array=array('54','55','56','57','61','63');
235  for ($e=0;$e<count($array);$e++) {
236  $oTva=new Tva_amount($this->db,'out',$this->start_periode,$this->end_periode);
237  $oTva->set_parameter('grid','GRIL'.$array[$e]);
238  $amount=$oTva->amount_vat();
239  $this->set_parameter('d'.$array[$e],$amount);
240 
241  }
242 
243 
244  $array=array('59','62','64');
245  for ($e=0;$e<count($array);$e++) {
246  $oTva=new Tva_amount($this->db,'in',$this->start_periode,$this->end_periode);
247  $oTva->set_parameter('grid','GRIL'.$array[$e]);
248  $amount=$oTva->amount_vat();
249  $this->set_parameter('d'.$array[$e],$amount);
250 
251  }
252  // for intracom, we compute a false VAT, have to paid it and deduce
253  $this->d55=round($this->d86*0.21+$this->d88*0.21,2);
254  $this->d59+=$this->d55;
255  /**
256  *@todo
257  * GRIL56 - GRIL57 - GRIL61 - GRIL63
258  */
259 
260  //GRILXX
261  $amount=$this->d54+$this->d55+$this->d56+$this->d57+$this->d61+$this->d63;
262  $this->set_parameter('dxx',$amount);
263 
264 
265  // GRILYY
266  $this->dyy=round($this->d59+$this->d62+$this->d64,2);
267 
268 
269  //Fram VI
270  if ( $this->dxx > $this->dyy ) $this->d71=$this->dxx-$this->dyy;
271  if ( $this->dxx < $this->dyy ) $this->d72=$this->dyy-$this->dxx;
272 
273  }
set_parameter($p_string, $p_value)
if(isset($_POST['remove'])) $array
Ext_Tva::delete ( )

Definition at line 178 of file class_ext_tva.php.

178  {
179 /* $sql="delete from tva_rate where tva_id=$1";
180  $res=$this->cn->exec_sql($sql,array($this->tva_id));
181 */
182  }
Ext_Tva::display ( )

Definition at line 533 of file class_ext_tva.php.

References $r, display_declaration_amount(), Ext_Tva_Gen\display_info(), and menu().

533  {
534  $r= '<form class="print" id="readonly">';
535  $r.=HtmlInput::request_to_hidden(array('ac'));
536  $r.='<div style="position:absolute;top:150;right:0;width:200;right-margin:3%">';
537  $r.=$this->menu();
538  $r.='</div>';
539  $r.=$this->display_info();
540  $r.=$this->display_declaration_amount();
541  $r.='</form>';
542  $r.= create_script("$('readonly').disable();");
543  return $r;
544  }
$r
display_info()
display the information about the company
display_declaration_amount()
get into the table quant_purchase or quant_sold the amount of VAT
Ext_Tva::display_declaration_amount ( )

get into the table quant_purchase or quant_sold the amount of VAT

Parameters
@param
Returns
See Also

Definition at line 283 of file class_ext_tva.php.

References $r, and Ext_Tva_Gen\get_parameter().

Referenced by display().

283  {
284  $itext_00=new INum('val[]',$this->get_parameter('d00')); $str_00=$itext_00->input().HtmlInput::hidden('tvacode[]','d00');
285  $itext_01=new INum('val[]',$this->get_parameter('d01')); $str_01=$itext_01->input().HtmlInput::hidden('tvacode[]','d01');
286  $itext_02=new INum('val[]',$this->get_parameter('d02')); $str_02=$itext_02->input().HtmlInput::hidden('tvacode[]','d02');
287  $itext_03=new INum('val[]',$this->get_parameter('d03')); $str_03=$itext_03->input().HtmlInput::hidden('tvacode[]','d03');
288  $itext_44=new INum('val[]',$this->get_parameter('d44')); $str_44=$itext_44->input().HtmlInput::hidden('tvacode[]','d44');
289  $itext_45=new INum('val[]',$this->get_parameter('d45')); $str_45=$itext_45->input().HtmlInput::hidden('tvacode[]','d45');
290  $itext_46=new INum('val[]',$this->get_parameter('d46')); $str_46=$itext_46->input().HtmlInput::hidden('tvacode[]','d46');
291  $itext_47=new INum('val[]',$this->get_parameter('d47')); $str_47=$itext_47->input().HtmlInput::hidden('tvacode[]','d47');
292  $itext_48=new INum('val[]',$this->get_parameter('d48')); $str_48=$itext_48->input().HtmlInput::hidden('tvacode[]','d48');
293  $itext_49=new INum('val[]',$this->get_parameter('d49')); $str_49=$itext_49->input().HtmlInput::hidden('tvacode[]','d49');
294  $itext_81=new INum('val[]',$this->get_parameter('d81')); $str_81=$itext_81->input().HtmlInput::hidden('tvacode[]','d81');
295  $itext_82=new INum('val[]',$this->get_parameter('d82')); $str_82=$itext_82->input().HtmlInput::hidden('tvacode[]','d82');
296  $itext_83=new INum('val[]',$this->get_parameter('d83')); $str_83=$itext_83->input().HtmlInput::hidden('tvacode[]','d83');
297  $itext_84=new INum('val[]',$this->get_parameter('d84')); $str_84=$itext_84->input().HtmlInput::hidden('tvacode[]','d84');
298  $itext_85=new INum('val[]',$this->get_parameter('d85')); $str_85=$itext_85->input().HtmlInput::hidden('tvacode[]','d85');
299  $itext_86=new INum('val[]',$this->get_parameter('d86')); $str_86=$itext_86->input().HtmlInput::hidden('tvacode[]','d86');
300  $itext_87=new INum('val[]',$this->get_parameter('d87')); $str_87=$itext_87->input().HtmlInput::hidden('tvacode[]','d87');
301  $itext_88=new INum('val[]',$this->get_parameter('d88')); $str_88=$itext_88->input().HtmlInput::hidden('tvacode[]','d88');
302 
303  $itext_54=new INum('val[]',$this->get_parameter('d54')); $str_54=$itext_54->input().HtmlInput::hidden('tvacode[]','d54');
304  $itext_55=new INum('val[]',$this->get_parameter('d55')); $str_55=$itext_55->input().HtmlInput::hidden('tvacode[]','d55');
305  $itext_56=new INum('val[]',$this->get_parameter('d56')); $str_56=$itext_56->input().HtmlInput::hidden('tvacode[]','d56');
306  $itext_57=new INum('val[]',$this->get_parameter('d57')); $str_57=$itext_57->input().HtmlInput::hidden('tvacode[]','d57');
307  $itext_63=new INum('val[]',$this->get_parameter('d63')); $str_63=$itext_63->input().HtmlInput::hidden('tvacode[]','d63');
308  $itext_61=new INum('val[]',$this->get_parameter('d61')); $str_61=$itext_61->input().HtmlInput::hidden('tvacode[]','d61');
309  $itext_xx=new INum('val[]',$this->get_parameter('dxx')); $str_xx=$itext_xx->input().HtmlInput::hidden('tvacode[]','dxx');
310  $itext_59=new INum('val[]',$this->get_parameter('d59')); $str_59=$itext_59->input().HtmlInput::hidden('tvacode[]','d59');
311  $itext_62=new INum('val[]',$this->get_parameter('d62')); $str_62=$itext_62->input().HtmlInput::hidden('tvacode[]','d62');
312  $itext_64=new INum('val[]',$this->get_parameter('d64')); $str_64=$itext_64->input().HtmlInput::hidden('tvacode[]','d64');
313  $itext_yy=new INum('val[]',$this->get_parameter('dyy')); $str_yy=$itext_yy->input().HtmlInput::hidden('tvacode[]','dyy');
314  $itext_71=new INum('val[]',$this->get_parameter('d71')); $str_71=$itext_71->input().HtmlInput::hidden('tvacode[]','d71');
315  $itext_72=new INum('val[]',$this->get_parameter('d72')); $str_72=$itext_72->input().HtmlInput::hidden('tvacode[]','d72');
316  $itext_91=new INum('val[]',$this->get_parameter('d91')); $str_91=$itext_91->input().HtmlInput::hidden('tvacode[]','d91');
317 
318 
319  ob_start();
320  require_once('form_decl.php');
321  $r=ob_get_contents();
322  ob_end_clean();
323  $r.=HtmlInput::hidden('periode_dec',$this->periode_dec);
324  return $r;
325 
326  }
$r
get_parameter($p_string)
Ext_Tva_Gen::display_info ( )
inherited

display the information about the company

Definition at line 182 of file class_ext_tvagen.php.

References $exercice, $r, and $str_date.

Referenced by Ext_List_Intra\display(), Ext_List_Assujetti\display(), and display().

182  {
183  $itva=new IText('num_tva',$this->num_tva);$str_tva=$itva->input();
184  $iname=new IText('name',$this->tva_name); $str_name=$iname->input();
185  $iadress=new IText('adress',$this->adress);$str_adress=$iadress->input();
186  $icountry=new IText('country',$this->country);$str_country=$icountry->input();
187 
188  /* date */
189 
190  if (isset($this->date_decl)) { $idate=new IText('date',format_date($this->date_decl));$str_date=$idate->input();}
191 
192  /* periode */
193 
194  if ( isset($this->start_date) ){
195  $str_start=format_date($this->start_date);
196  $str_end=format_date($this->end_date);
197 
198  }
199  $ianne=$this->exercice;
200  ob_start();
201  require_once('form_decl_info.php');
202  $r=ob_get_contents();
203  ob_end_clean();
204  return $r;
205  }
if(isset($_POST['save'])) $exercice
$r
switch($sep_field->selected) $str_date
Ext_Tva::from_array (   $p_array)

Definition at line 86 of file class_ext_tva.php.

86  {
87  $val=$p_array['val'];
88  $code=$p_array['tvacode'];
89  for ($i=0;$i<count($val);$i++) {
90  $this->$code[$i]=$val[$i];
91  }
92  $this->start_periode=$p_array['start_periode'];
93  $this->end_periode=$p_array['end_periode'];
94  $this->flag_periode=$p_array['flag_periode'];
95  $this->tva_name=$p_array['name'];
96  $this->num_tva=$p_array['num_tva'];
97  $this->adress=$p_array['adress'];
98  $this->country=$p_array['country'];
99  $this->periode_dec=$p_array['periode_dec'];
100  $this->exercice=$p_array['exercice'];
101 
102  }
Ext_Tva_Gen::get_info ( )
inherited

Definition at line 72 of file class_ext_tvagen.php.

72 { return var_export(self::$variable,true); }
Ext_Tva_Gen::get_parameter (   $p_string)
inherited

Definition at line 54 of file class_ext_tvagen.php.

Referenced by Ext_List_Intra\display_declaration_amount(), Ext_List_Assujetti\display_declaration_amount(), display_declaration_amount(), and Ext_Tva_Gen\save().

54  {
55  if ( array_key_exists($p_string,$this->variable) ) {
56  $idx=$this->variable[$p_string];
57  return $this->$idx;
58  }
59  else
60  throw new Exception (__FILE__.":".__LINE__.'Erreur attribut inexistant');
61  }
Ext_Tva::insert ( )

Definition at line 103 of file class_ext_tva.php.

References $sql, and verify().

103  {
104 
105  if ( $this->verify() != 0 ) return;
106  $sql="INSERT INTO tva_belge.declaration_amount(
107  d00, d01, d02, d03, d44, d45, d46, d47, d48, d49, d81,
108  d82, d83, d84, d85, d86, d87, d88, d54, d55, d56, d57, d61, d63,
109  dxx, d59, d62, d64, dyy, d71, d72, d91, start_date, end_date,
110  periodicity,tva_name,num_tva,adress,country,periode_dec,exercice)
111  VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12,
112  $13, $14, $15, $16, $17, $18, $19, $20, $21, $22, $23, $24, $25,
113  $26, $27, $28, $29, $30, $31, $32, to_date($33,'DD.MM.YYYY'), to_date($34,'DD.MM.YYYY'), $35,$36,
114  $37,$38,$39,$40,$41)
115  returning da_id;";
116  $this->da_id=$this->db->get_value($sql,
117  array($this->d00, /* 1 */
118  $this->d01, /* 2 */
119  $this->d02, /* 3 */
120  $this->d03, /* 4 */
121  $this->d44, /* 5 */
122  $this->d45, /* 6 */
123  $this->d46, /* 7 */
124  $this->d47, /* 8 */
125  $this->d48, /* 9 */
126  $this->d49, /* 10 */
127  $this->d81, /* 11 */
128  $this->d82, /* 12 */
129  $this->d83, /* 13 */
130  $this->d84, /* 14 */
131  $this->d85, /* 15 */
132  $this->d86, /* 16 */
133  $this->d87, /* 17 */
134  $this->d88, /* 18 */
135  $this->d54, /* 19 */
136  $this->d55, /* 20 */
137  $this->d56, /* 21 */
138  $this->d57, /* 22 */
139  $this->d61, /* 23 */
140  $this->d63, /* 24 */
141  $this->dxx, /* 25 */
142  $this->d59, /* 26 */
143  $this->d62, /* 27 */
144  $this->d64, /* 28 */
145  $this->dyy, /* 29 */
146  $this->d71, /* 30 */
147  $this->d72, /* 31 */
148  $this->d91, /* 32 */
149  $this->start_periode, /* 33 */
150  $this->end_periode, /* 34 */
151  $this->flag_periode, /* 35 */
152  $this->tva_name, /* 36 */
153  $this->num_tva, /* 37 */
154  $this->adress, /* 38 */
155  $this->country, /* 39 */
156  $this->periode_dec, /* 40 */
157  $this->exercice, /* 41 */
158 
159  ));
160  }
$sql
Ext_Tva::load ( )

Definition at line 167 of file class_ext_tva.php.

References $res, and $sql.

167  {
168 
169  $sql="select * from tva_belge.declaration_amount where da_id=$1";
170 
171  $res=$this->db->get_array(
172  $sql,
173  array($this->da_id)
174  );
175  if ( $this->db->count() == 0 ) return;
176  foreach ($res[0] as $idx=>$value) { $this->$idx=$value; }
177  }
$res
$sql
Ext_Tva::menu ( )

Definition at line 327 of file class_ext_tva.php.

References $_REQUEST, $array, $r, and id.

Referenced by display().

327  {
328  $r='';
329  $js_record=sprintf("onclick=\"record_writing('%s',%d,%d)\"",
330  $_REQUEST['plugin_code'],
331  dossier::id(),
332  $this->da_id);
333  $js_remove=sprintf("onclick=\"if ( confirm('%s')){remove_form('%s',%d,%d,'da');}\"",
334  "Vous confirmez vouloir effacer ?",
335  $_REQUEST['plugin_code'],
336  dossier::id(),
337  $this->da_id);
338 
339  $array=array (
340  array("javascript:void(0)",_("Ecriture comptable"),_("Création de l'écriture comptable"),1,$js_record),
341  array("javascript:void(0)",_("Générer fichier"),_("Création du fichier xml"),2),
342  array("javascript:void(0)",_("Effacement déclaration"),_("Effacement déclaration"),3,$js_remove)
343  );
344  $r.=ShowItem($array,'V',"mtitle","mtitle");
345  return $r;
346 
347  }
$select_type id
$r
if(isset($_POST['remove'])) $array
$_REQUEST['sb']
Definition: am_print.php:39
Ext_Tva::propose_form ( )

Definition at line 348 of file class_ext_tva.php.

References $amount, $array, $atva, $lib, $max, $per, $periode, and $r.

348  {
349  $r='';
350  /* take all the vat code */
351  $array=$this->db->get_array("select tva_poste from tva_rate");
352 
353  if ( empty($array)) return 'aucun compte pour la tva';
354 
355  $str_tva="";$sep="";
356  for ($i=0;$i<count($array);$i++) {
357  $str_tva.=$sep.$array[$i]['tva_poste'];
358  $sep=',';
359  }
360 
361  $array=explode(',',$str_tva);
362  $array=array_unique($array);
363 
364  $max=count($array);
365  $periode=new Periode($this->db);
366  $per=$periode->limit_year($this->exercice);
367  $periode->p_id=$per['start'];
368 
369  $first_day=$periode->first_day();
370  $idx=0;
371  $amount_vat=0;
372  $r.='<table class="result">';
373  for ( $i=0;$i<$max;$i++){
374  /* for each rate explode the accounting */
375  // list($deb,$cred)=explode(',',$array[$i]['tva_poste']);
376  $deb=$array[$i];
377  /* get saldo for DEBIT*/
378  $saldo=new Acc_Account_Ledger($this->db,$deb);
379 
380  /* get label */
381  $lib=$this->db->get_value('select pcm_lib from tmp_pcmn where pcm_val=$1',array($deb));
382 
383  $cond=sprintf(" j_date >=to_date('%s','DD.MM.YYYY') and j_date <= '%s'",
384  $first_day,
385  $this->end_date);
386 
387  $result=$saldo->get_solde_detail($cond);
388  if ( $result['solde']==0) continue;
389 
390  $account=new IText('account['.$idx.']');
391  $account->value=$deb;
392  $amount=new INum('amount['.$idx.']');
393  $amount->value=abs($result['solde']);
394 
395  $ICheckBox=new ICheckBox('deb['.$idx.']');
396  if ( $result['debit'] < $result['credit'] ) {
397  $amount_vat-=$result['solde']; $ICheckBox->selected=true;}
398  else {
399  $amount_vat+=$result['solde']; $ICheckBox->selected=false;
400  }
401  $idx++;
402  /* display row */
403  $r.=tr(td($account->input()).td($lib).td($amount->input()).td($ICheckBox->input()));
404 
405  }
406  /* ATVA */
407  $atva=$this->db->get_value("select pcm_val from tva_belge.parameter_chld where pcode='ATVA'");
408  if ( $atva != '' ) {
409  /* get saldo */
410  $saldo=new Acc_Account_Ledger($this->db,$atva);
411  /* get label */
412  $lib=$this->db->get_value('select pcm_lib from tmp_pcmn where pcm_val=$1',array($atva));
413 
414  $cond=sprintf(" j_date >=to_date('%s','DD.MM.YYYY') and j_date <= '%s'",
415  $first_day,
416  $this->end_date);
417  $result=$saldo->get_solde_detail($cond);
418  $ICheckBox=new ICheckBox('atva_ic');
419  $account=new IText('atva');
420  $account->value=$atva;
421  $amount=new INum('atva_amount');
422  $amount->value=abs($result['solde']);
423 
424  if ( $result['debit'] < $result['credit'] ) {
425  $amount_vat-=$result['solde']; $ICheckBox->selected=true;}
426  else {
427  $ICheckBox->selected=false;
428  $amount_vat+=$result['solde'];
429  }
430  /* display row */
431  if ( $result['solde'] != 0) $r.=tr(td($account->input()).td('Avance TVA').td($amount->input()).td($ICheckBox->input()));
432 
433  }
434  /* creance sur tva*/
435  /* CRTVA */
436  $crtva=$this->db->get_value("select pcm_val from tva_belge.parameter_chld where pcode='CRTVA'");
437  if ( $crtva != '' ) {
438  /* get saldo */
439  $saldo=new Acc_Account_Ledger($this->db,$crtva);
440  /* get label */
441  $lib=$this->db->get_value('select pcm_lib from tmp_pcmn where pcm_val=$1',array($crtva));
442 
443  $cond=sprintf(" j_date >=to_date('%s','DD.MM.YYYY') and j_date <= '%s'",
444  $first_day,
445  $this->end_date);
446  $result=$saldo->get_solde_detail($cond);
447  $ICheckBox=new ICheckBox('crtva_ic');
448  $account=new IText('crtva');
449  $account->value=$crtva;
450  $amount=new INum('crtva_amount');
451  $amount->value=abs($result['solde']);
452 
453  if ( $result['debit'] > $result['credit']) {
454  $amount_vat+=$result['solde'];
455  $ICheckBox->selected=false;
456  } else {
457  $amount_vat-=$result['solde'];
458  $ICheckBox->selected=true;
459 
460  }
461  /* display row */
462  if ( $result['solde'] != 0) $r.=tr(td($account->input()).td('Créance compte TVA').td($amount->input()).td($ICheckBox->input()));
463 
464  }
465  /* dette tva */
466  $dttva=$this->db->get_value("select pcm_val from tva_belge.parameter_chld where pcode='DTTVA'");
467  if ( $dttva != '' ) {
468  /* get saldo */
469  $saldo=new Acc_Account_Ledger($this->db,$dttva);
470  /* get label */
471  $lib=$this->db->get_value('select pcm_lib from tmp_pcmn where pcm_val=$1',array($dttva));
472 
473  $cond=sprintf(" j_date >=to_date('%s','DD.MM.YYYY') and j_date <= '%s'",
474  $first_day,
475  $this->end_date);
476  $result=$saldo->get_solde_detail($cond);
477  $ICheckBox=new ICheckBox('dttva_ic');
478  $account=new IText('dttva');
479  $account->value=$dttva;
480  $amount=new INum('dttva_amount');
481  $amount->value=abs($result['solde']);
482 
483  if ( $result['credit'] > $result['debit'] ) {
484  $amount_vat-=$result['solde'];
485  $ICheckBox->selected=true;
486  } else {
487  $ICheckBox->selected=false;
488  $amount_vat+=$result['solde'];
489  }
490  /* display row */
491  if ( $result['solde'] != 0) $r.=tr(td($account->input()).td('Dette Compte TVA').td($amount->input()).td($ICheckBox->input()));
492 
493  }
494  /* if amount_vat > 0 then we have to pay */
495  if ( $amount_vat < 0 ) {
496  /* dette tva */
497  if ( $dttva != '' ) {
498  /* get label */
499  $lib=$this->db->get_value('select pcm_lib from tmp_pcmn where pcm_val=$1',array($dttva));
500 
501  $ICheckBox=new ICheckBox('solde_ic');
502  $ICheckBox->selected=false;
503  $account=new IText('solde');
504  $account->value=$dttva;
505  $amount=new INum('solde_amount');
506  $amount->value=abs($amount_vat);
507 
508  /* display row */
509  $r.=tr(td($account->input()).td('Dette Compte TVA').td($amount->input()).td($ICheckBox->input()));
510  }
511  }else {
512  /* creance tva */
513  if ( $crtva != '' ) {
514  /* get label */
515  $lib=$this->db->get_value('select pcm_lib from tmp_pcmn where pcm_val=$1',array($crtva));
516 
517  $ICheckBox=new ICheckBox('solde_ic');
518  $ICheckBox->selected=true;
519  $account=new IText('solde');
520  $account->value=$crtva;
521  $amount=new INum('solde_amount');
522  $amount->value=abs($amount_vat);
523 
524  /* display row */
525  $r.=tr(td($account->input()).td('Créance Compte TVA').td($amount->input()).td($ICheckBox->input()));
526  }
527 
528  }
529  $r.='</table>';
530 
531  return $r;
532  }
if(isset($_POST['ftvaadd'])) if(isset($_POST['mod'])) $atva
get data from database
$periode
$r
if(isset($_POST['remove'])) $array
Ext_Tva_Gen::save ( )
inherited

Definition at line 74 of file class_ext_tvagen.php.

References Ext_Tva_Gen\get_parameter().

74  {
75  /* please adapt */
76  if ( $this->get_parameter("id") == 0 )
77  $this->insert();
78  else
79  $this->update();
80  }
get_parameter($p_string)
Ext_Tva::seek (   $cond,
  $p_array = null 
)

retrieve * row thanks a condition

Definition at line 83 of file class_ext_tva.php.

84  {
85  }
Ext_Tva_Gen::set_parameter (   $p_string,
  $p_value 
)
inherited

Definition at line 62 of file class_ext_tvagen.php.

Referenced by Ext_Tva_Gen\blank(), and compute().

62  {
63  if ( array_key_exists($p_string,$this->variable) ) {
64  $idx=$this->variable[$p_string];
65  $this->$idx=$p_value;
66  }
67  else
68  throw new Exception (__FILE__.":".__LINE__.'Erreur attribut inexistant');
69 
70 
71  }
Ext_Tva::update ( )

Definition at line 162 of file class_ext_tva.php.

References verify().

162  {
163  if ( $this->verify() != 0 ) return;
164 
165  }
Ext_Tva::verify ( )
Todo:
MY_NAME can not be empty MY_TVA contains BE and has 10 digits this->adress and $this->country can not be empty

Definition at line 184 of file class_ext_tva.php.

Referenced by insert(), and update().

184  {
185  /**
186  *@todo
187  * MY_NAME can not be empty
188  * MY_TVA contains BE and has 10 digits
189  * this->adress and $this->country can not be empty
190  */
191  return 0;
192  }

Field Documentation

Ext_Tva::$variable
protected

Definition at line 32 of file class_ext_tva.php.


The documentation for this class was generated from the following file: