Plugins  LAST
 All Data Structures Files Functions Variables Pages
Public Member Functions
Rapav_Declaration_Param Class Reference

Match each row of a form, this row can have several details. More...

Collaboration diagram for Rapav_Declaration_Param:
Collaboration graph

Public Member Functions

 insert ()
 insert into rapport_advanced.formulaire_param More...
 
 from_array ($p_array)
 set the attribute param with the content of the array. More...
 
 compute_date ($p_start, $p_end)
 compute the date following the attribute t_id (match rapport_advanced.periode_type and store the result into $this->start and $this-> end More...
 
 compute_child ($p_pcm_val, $p_start, $p_end)
 
 compute ($p_start, $p_end)
 
 get_depending ()
 find depending accounting More...
 

Detailed Description

Match each row of a form, this row can have several details.

Definition at line 647 of file class_rapav_declaration.php.

Member Function Documentation

Rapav_Declaration_Param::compute (   $p_start,
  $p_end 
)

Definition at line 793 of file class_rapav_declaration.php.

References $array, $cn, compute_date(), and Rapav_Declaration_Detail\factory().

794  {
795  global $cn;
796  bcscale(2);
797  $this->amount = "0";
798 
799  $array = $cn->get_array("select fp_id,p_id,tmp_val,tva_id,fp_formula,fp_signed,jrn_def_type,tt_id,type_detail,
800  with_tmp_val,type_sum_account,operation_pcm_val,jrn_def_id,date_paid
801  from rapport_advanced.formulaire_param_detail where p_id=$1", array($this->param->p_id));
802  $this->compute_date($p_start, $p_end);
803  for ($e = 0; $e < count($array); $e++)
804  {
805  $row_detail = Rapav_Declaration_Detail::factory($array[$e]);
806  $row_detail->dr_id = $this->dr_id;
807  $row_detail->d_id = $this->d_id;
808  $tmp_amount = $row_detail->compute($this->start, $this->end);
809  $this->amount = bcadd("$tmp_amount", "$this->amount");
810  $row_detail->insert();
811  }
812  }
if(isset($_POST['remove'])) $array
compute_date($p_start, $p_end)
compute the date following the attribute t_id (match rapport_advanced.periode_type and store the resu...
static factory($p_array)
create an object RAPAV_dd_Formula, RAPAV_dd_Account_Tva or Rapav_dd_compute following the idx type_de...
global $cn
Rapav_Declaration_Param::compute_child (   $p_pcm_val,
  $p_start,
  $p_end 
)

Definition at line 764 of file class_rapav_declaration.php.

References $array, $cn, compute_date(), and Rapav_Declaration_Detail\factory().

Referenced by Rapav_Declaration\add_child_account().

765  {
766  global $cn;
767  bcscale(2);
768  $this->amount = "0";
769 
770  $array = $cn->get_array("select fp_id,p_id,tmp_val,tva_id,fp_formula,fp_signed,jrn_def_type,tt_id,type_detail,
771  with_tmp_val,type_sum_account,operation_pcm_val,jrn_def_id,date_paid
772  from rapport_advanced.formulaire_param_detail where p_id=$1", array($this->param->p_id));
773  $this->compute_date($p_start, $p_end);
774  for ($e = 0; $e < count($array); $e++)
775  {
776  $row_detail = Rapav_Declaration_Detail::factory($array[$e]);
777  $row_detail->form->tmp_val=$p_pcm_val;
778  $row_detail->dr_id = $this->dr_id;
779  $row_detail->d_id = $this->d_id;
780  $tmp_amount = $row_detail->compute($this->start, $this->end);
781  $this->amount = bcadd("$tmp_amount", "$this->amount");
782  $row_detail->insert();
783  }
784  }
if(isset($_POST['remove'])) $array
compute_date($p_start, $p_end)
compute the date following the attribute t_id (match rapport_advanced.periode_type and store the resu...
static factory($p_array)
create an object RAPAV_dd_Formula, RAPAV_dd_Account_Tva or Rapav_dd_compute following the idx type_de...
global $cn
Rapav_Declaration_Param::compute_date (   $p_start,
  $p_end 
)

compute the date following the attribute t_id (match rapport_advanced.periode_type and store the result into $this->start and $this-> end

  • 1 date from the FORM
  • 2 N
  • 3 N-1
  • 4 N-2
  • 5 N-3
    Parameters
    $p_startrequested date
    $p_endrequested date

Definition at line 703 of file class_rapav_declaration.php.

References $cn, $exercice, and $periode.

Referenced by compute(), and compute_child().

704  {
705  global $g_user;
706  switch ($this->param->t_id)
707  {
708  case 1:
709  $this->start = $p_start;
710  $this->end = $p_end;
711  return;
712  break;
713  case 2:
714  list($this->start, $this->end) = $g_user->get_limit_current_exercice();
715  return;
716  break;
717  case 3:
718  $exercice = $g_user->get_exercice();
719  $exercice--;
720  break;
721  case 4:
722  $exercice = $g_user->get_exercice();
723  $exercice-=2;
724  break;
725  case 5:
726  $exercice = $g_user->get_exercice();
727  $exercice-=3;
728  break;
729  case 6:
730  list($this->start, $this->end) = $g_user->get_limit_current_exercice();
731  $this->end = $p_end;
732  return;
733  break;
734  default:
735  throw new Exception('compute_date : t_id est incorrect');
736  }
737  global $cn;
738 
739  // If exercice does not exist then
740  // set the date end and start to 01.01.1900
741 
742  $exist_exercice = $cn->get_value('select count(p_id) from parm_periode where p_exercice=$1', array($exercice));
743  if ($exist_exercice == 0)
744  {
745  $this->start = '01.01.1900';
746  $this->end = '01.01.1900';
747  return;
748  }
749  // Retrieve start & end date
750  $periode = new Periode($cn);
751  list($per_start, $per_end) = $periode->get_limit($exercice);
752  $this->start = $per_start->first_day();
753  $this->end = $per_end->last_day();
754  }
if(isset($_POST['save'])) $exercice
$periode
global $cn
Rapav_Declaration_Param::from_array (   $p_array)

set the attribute param with the content of the array.

keys :

  • 'p_id',
  • 'p_code',
  • 'p_libelle',
  • 'p_type',
  • 'p_order',
  • 'f_id',
  • 't_id'
    Parameters
    type$p_array

Definition at line 681 of file class_rapav_declaration.php.

Referenced by Rapav_Declaration\add_child_account().

682  {
683  $this->param = new Formulaire_Param();
684  foreach (array('p_id', 'p_code', 'p_libelle', 'p_type', 'p_order', 'f_id', 't_id') as $e)
685  {
686  $this->param->$e = $p_array[$e];
687  }
688  $this->param->load();
689 
690  }
manage the table rapport_avance.formulaire_param
Rapav_Declaration_Param::get_depending ( )

find depending accounting

Definition at line 816 of file class_rapav_declaration.php.

References $array, and $cn.

Referenced by Rapav_Declaration\add_child_account().

817  {
818  global $cn;
819  $accounting = $cn->get_value(" select tmp_val
820  from rapport_advanced.formulaire_param_detail
821  where p_id=$1", array($this->param->p_id));
822 
823  $array=$cn->get_array("select pcm_val,pcm_lib from tmp_pcmn where
824  pcm_val like $1||'%' order by pcm_val::text",array($accounting));
825 
826  return $array;
827  }
if(isset($_POST['remove'])) $array
global $cn
Rapav_Declaration_Param::insert ( )

insert into rapport_advanced.formulaire_param

Definition at line 653 of file class_rapav_declaration.php.

References $amount, and $data.

Referenced by Rapav_Declaration\add_child_account().

654  {
656  $data->dr_code = $this->param->p_code;
657  $data->dr_libelle = $this->param->p_libelle;
658  $data->dr_order = $this->param->p_order;
659  $data->dr_amount = $this->amount;
660  $data->d_id = $this->d_id;
661  $data->dr_id = $this->dr_id;
662  $data->dr_type = $this->param->p_type;
663  $data->dr_start = $this->dr_start;
664  $data->dr_end = $this->dr_end;
665  $data->dr_account=$this->dr_account;
666  $data->insert();
667  }

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