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

Public Member Functions

 insert ()
 
 from_array ($p_array)
 
 display ()
 
 load ()
 
 verify ()
 
 update ()
 
 compute ()
 
 display_declaration_amount ($p_readonly=false)
 
 find_tva_code ($p_array)
 
 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 269 of file class_ext_list_intra.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_List_Intra::compute ( )
inherited

Definition at line 166 of file class_ext_list_intra.php.

References $a, $array, $fiche, $sql, and Listing\find_tva_code().

166  {
167  /* retrieve accounting customer */
168  $code_customer=new Acc_Parm_Code($this->db);
169  $code_customer->p_code='CUSTOMER';
170  $code_customer->load();
171  $a=$this->find_tva_code('CLINTRA');
172 
173  if (trim($a)=='') $a=-1;
174  $sql=<<<EOF
175  select sum(j_montant) as amount,j_qcode
176  from jrnx
177  where j_grpt in (select distinct j_grpt from quant_sold join jrnx using (j_id) where qs_vat_code in ($a) )
178  and j_poste::text like $1||'%'
179  and (j_date >= to_date($2,'DD.MM.YYYY') and j_date <= to_date($3,'DD.MM.YYYY'))
180  group by j_qcode
181 EOF;
182  // get all of them
183  $all=$this->db->get_array($sql,array($code_customer->p_value,
184  $this->start_periode,
185  $this->end_periode
186  )
187  );
188  $array=array();
189 
190  // retrieve missing and compute an array
191  for ($i=0;$i<count($all);$i++){
192  $child=new Ext_List_Intra_Child($this->db);
193  $child->set_parameter('amount',$all[$i]['amount']);
194  switch ($this->flag_periode) {
195  case 1:
196  // by month
197  $child->set_parameter('periode',sprintf('%02d%s',$this->periode_dec,$this->exercice));
198  break;
199  case 2:
200  /* quaterly */
201  $child->set_parameter('periode',sprintf('3%d%s',$this->periode_dec,$this->exercice));
202  break;
203  case 3:
204  /* yearly */
205  $child->set_parameter('periode',sprintf('00%s',$this->periode_dec,$this->exercice));
206  break;
207  } // end switch
208 
209  $child->set_parameter('qcode',$all[$i]['j_qcode']);
210  $fiche=new Fiche($this->db);
211  $fiche->get_by_qcode($all[$i]['j_qcode'],false);
212  $num_tva=$fiche->strAttribut(ATTR_DEF_NUMTVA);
213 
214  if ( trim($num_tva) === "") {continue;}
215  $child->set_parameter('tva_num',$num_tva);
216 
217  $child->set_parameter('name_child',$fiche->strAttribut(ATTR_DEF_NAME));
218  $child->set_parameter('code','L');
219 
220  $array[]=$child;
221  }//end for
222  $this->aChild=$array;
223  }
for($i=0;$i<$max;$i++)
Definition: test_file.php:62
if(isset($_POST['remove'])) $array
find_tva_code($p_array)
$sql
Ext_List_Intra::display ( )
inherited

Definition at line 84 of file class_ext_list_intra.php.

References $_REQUEST, $r, Ext_List_Intra\display_declaration_amount(), Ext_Tva_Gen\display_info(), and id.

84  {
85  $r= '<form class="print" id="readonly">';
86  $r.=$this->display_info();
87  $r.=HtmlInput::request_to_hidden(array('ac'));
89  $r.='</form>';
90  $js_remove=sprintf("onclick=\"if ( confirm('%s')){remove_form('%s',%d,%d,'li');}\"",
91  "Vous confirmez vouloir effacer ?",
92  $_REQUEST['plugin_code'],
93  dossier::id(),
94  $this->i_id);
95 
96  $r.=HtmlInput::button('Effacer','Effacer',$js_remove);
97  $r.= create_script("$('readonly').disable();");
98  return $r;
99  }
$select_type id
$r
display_info()
display the information about the company
display_declaration_amount($p_readonly=false)
$_REQUEST['sb']
Definition: am_print.php:39
Ext_List_Intra::display_declaration_amount (   $p_readonly = false)
inherited
Todo:
finish it

Definition at line 227 of file class_ext_list_intra.php.

References $a, $amount, $f, $r, $res, and Ext_Tva_Gen\get_parameter().

Referenced by Ext_List_Intra\display().

227  {
228  $res='<fieldset><legend>Listing</legend>';
229 
230  $res.= '<table id="tb_dsp" class="result" style="width:80%;">';
231  $clean=new IButton();
232  $clean->label='Efface ligne';
233  $clean->javascript="deleteRow('tb_dsp',this);";
234 
235  $r='';
236  $r.=th('QuickCode');
237  $r.=th('Name');
238  $r.=th('Code Pays et numéro de TVA');
239  $r.=th('Code Pays et numéro de TVA');
240  $r.=th('montant');
241  $r.=th('periode');
242  $r.=th('');
243  $amount=0;
244  $res.=tr($r);
245  for ($i=0;$i<count($this->aChild);$i++) {
246  $a=new IText('qcode[]',$this->aChild[$i]->get_parameter('qcode'));
247  $b=new IText('name_child[]',$this->aChild[$i]->get_parameter('name_child'));
248  $c=new IText('tva_num_child[]',$this->aChild[$i]->get_parameter('tva_num'));
249  $d=new IText('tvacode[]',$this->aChild[$i]->get_parameter('code'));
250  $e=new INum('amount[]',$this->aChild[$i]->get_parameter('amount'));
251  $f=new IText('periode[]',$this->aChild[$i]->get_parameter('periode'));
252 
253  $amount+=round($this->aChild[$i]->get_parameter('amount'),2);
254  $r=td($a->input());
255  $r.=td($b->input());
256  $r.=td($c->input());
257  $r.=td($d->input());
258  $r.=td($e->input());
259  $r.=td($f->input());
260  if (! $p_readonly) $r.=td($clean->input());
261  $res.=tr($r);
262 
263  }
264  if ( $p_readonly)
265  {
266  $r=td('');
267  $r.=td('');
268  $r.=td('');
269  $r.=td(hb('Total'));
270  $r.=td(hb(sprintf('%.02f',$amount)));
271  $r.=td('');
272  $r.=td('');
273  $res.=tr($r);
274  }
275  $res.='</table>';
276  $res.='</fieldset>';
277  return $res;
278  }
$f
Definition: show_field.php:4
$r
$res
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 Ext_Tva\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
Listing::find_tva_code (   $p_array)
inherited

Definition at line 29 of file class_listing.php.

References $array.

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

30  {
31  $array=$this->db->make_list("
32  select distinct tva_id from tva_belge.parameter_chld
33  where
34  pcode=$1",
35  array($p_array));
36 
37  return $array;
38  }
if(isset($_POST['remove'])) $array
Ext_List_Intra::from_array (   $p_array)
inherited

Definition at line 48 of file class_ext_list_intra.php.

References $amount, $array, $name, and $periode.

48  {
49  if( isset($p_array['name_child'])) {
50  $name=$p_array['name_child'];
51  $qcode=$p_array['qcode'];
52  $code=$p_array['tvacode'];
53  $tva_num=$p_array['tva_num_child'];
54  $amount=$p_array['amount'];
55  $periode=$p_array['periode'];
56  $array=array();
57  // retrieve missing and compute an array
58  for ($i=0;$i<count($name);$i++){
59  $child=new Ext_List_Intra_Child($this->db);
60  $child->set_parameter('amount',$amount[$i]);
61  $child->set_parameter('periode',$periode[$i]);
62  $child->set_parameter('qcode',$qcode[$i]);
63  $child->set_parameter('code',$code[$i]);
64  $child->set_parameter('name_child',$name[$i]);
65  $child->set_parameter('tva_num',$tva_num[$i]);
66 
67  $array[]=$child;
68  }//end for
69  $this->aChild=$array;
70  } else
71  $this->aChild=array();
72 
73  $this->start_periode=$p_array['start_periode'];
74  $this->end_periode=$p_array['end_periode'];
75  $this->flag_periode=$p_array['flag_periode'];
76  $this->tva_name=$p_array['name'];
77  $this->num_tva=$p_array['num_tva'];
78  $this->adress=$p_array['adress'];
79  $this->country=$p_array['country'];
80  $this->periode_dec=$p_array['periode_dec'];
81  $this->exercice=$p_array['exercice'];
82 
83  }
$periode
if(isset($_POST['remove'])) $array
$name
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(), Ext_Tva\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_List_Intra_Child::insert ( )

Definition at line 280 of file class_ext_list_intra.php.

References $sql, and $variable.

281  {
282  protected $variable=array(
283  "id"=>"ic_id",
284  "tva_num"=>"ic_tvanum",
285  "amount"=>"ic_amount",
286  "code"=>"ic_code",
287  "periode"=>"ic_periode",
288  "depend"=>"i_id",
289  "qcode"=>"ic_qcode",
290  "name_child"=>'ic_name'
291  );
292  function insert() {
293 $sql=<<<EOF
294 INSERT INTO tva_belge.intracomm_chld(
295  i_id, ic_tvanum, ic_amount, ic_code, ic_periode, ic_qcode,
$sql
Ext_List_Intra::load ( )
inherited

Definition at line 100 of file class_ext_list_intra.php.

References $array, $res, and $sql.

100  {
101  $sql="select * from tva_belge.intracomm where i_id=$1";
102 
103  $res=$this->db->get_array(
104  $sql,
105  array($this->i_id)
106  );
107  if ( $this->db->count() == 0 ) return 0;
108  foreach ($res[0] as $idx=>$value) { $this->$idx=$value; }
109  // load child
110  $sql="select * from tva_belge.intracomm_chld where i_id=$1";
111  $res=$this->db->get_array(
112  $sql,
113  array($this->i_id)
114  );
115  $nb=$this->db->count();
116  $array=array();
117  // retrieve missing and compute an array
118  for ($i=0;$i<$nb;$i++){
119  $child=new Ext_List_Intra_Child($this->db);
120  foreach ($res[$i] as $idx=>$value){
121  $child->$idx=$value;
122  }
123  $array[]=$child;
124  }//end for
125  $this->aChild=$array;
126 
127  return 1;
128  }
if(isset($_POST['remove'])) $array
$res
$sql
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_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 Ext_Tva\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_List_Intra::update ( )
inherited

Definition at line 163 of file class_ext_list_intra.php.

163  {
164  }
Ext_List_Intra::verify ( )
inherited

Definition at line 129 of file class_ext_list_intra.php.

129  {
130  return 0;
131  }

Field Documentation

Ext_List_Intra_Child::$variable
protected
Initial value:
=array(
"id"=>"ic_id",
"tva_num"=>"ic_tvanum",
"amount"=>"ic_amount",
"code"=>"ic_code",
"periode"=>"ic_periode",
"depend"=>"i_id",
"qcode"=>"ic_qcode",
"name_child"=>'ic_name'
)

Definition at line 270 of file class_ext_list_intra.php.

Referenced by insert().


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