29 require_once
'class_rapport_avance_sql.php';
30 require_once
'class_formulaire_param_detail.php';
45 switch ($form->p_type)
48 return new Formulaire_Title1($form);
50 return new Formulaire_Title2($form);
52 return new Formulaire_Title3($form);
56 return new Formulaire_Text($form);
58 return new Formulaire_Notice($form);
75 $title = str_replace(array(
'/',
'*',
'<',
'>',
'*',
'.',
'+',
':',
'?',
'!',
" ",
";"),
"_",
$title);
77 $out = fopen(
"php://output",
"w");
78 header(
'Pragma: public');
79 header(
'Content-type: application/bin');
80 header(
'Content-Disposition: attachment;filename="' .
$title .
'.bin"', FALSE);
81 fputcsv($out, array(
"RAPAV",
'4'),
";");
82 fputcsv($out, array(
$form->f_title,
$form->f_description),
";");
83 $array = $cn->get_array(
"select p_id,p_code, p_libelle, p_type, p_order, f_id, t_id
84 from rapport_advanced.formulaire_param where f_id=$1", array($p_id));
85 for ($i = 0; $i < count(
$array); $i++)
87 fputcsv($out,
$array[$i],
";");
89 fputcsv($out, array(
'RAPAV_DETAIL'),
";");
90 $array = $cn->get_array(
"select
91 fp_id, p_id, tmp_val, tva_id, fp_formula, fp_signed, jrn_def_type,
92 tt_id, type_detail, with_tmp_val, type_sum_account, operation_pcm_val,date_paid
93 from rapport_advanced.formulaire_param_detail where p_id in (select p_id from rapport_advanced.formulaire_param where f_id=$1)", array($p_id));
94 for ($i = 0; $i < count(
$array); $i++)
96 fputcsv($out,
$array[$i],
";");
103 $in = fopen($filename,
"r");
107 $a = fgetcsv($in, 0,
";");
108 if (
$a[0] !=
"RAPAV")
110 throw new Exception(
'Formulaire invalide');
116 $first = fgetcsv($in, 0,
";");
117 $form->f_title = $first[0];
118 if (isset($first[1]))
119 $form->f_description = $first[1];
122 while (($csv = fgetcsv($in, 0,
";")) != FALSE)
124 if ($csv[0] !=
"RAPAV_DETAIL")
130 $cn->get_array(
"INSERT INTO rapport_advanced.restore_formulaire_param(
131 p_id, p_code, p_libelle, p_type, p_order, f_id, t_id)
132 VALUES ($1, $2, $3, $4, $5, $6, $7)", $csv);
136 while (($csv = fgetcsv($in, 0,
";")) != FALSE)
139 for ($o = 0; $o < count($csv); $o++)
152 $cn->get_array(
"INSERT INTO rapport_advanced.restore_formulaire_param_detail(
153 fp_id, p_id, tmp_val, tva_id, fp_formula, fp_signed, jrn_def_type,
154 tt_id, type_detail, with_tmp_val, type_sum_account, operation_pcm_val,date_paid)
155 VALUES ($1, $2, $3, $4, $5, $6, $7,$8, $9, $10, $11, $12,$13)", $t);
161 $array=$cn->get_array(
"select p_id,p_code,p_libelle,p_order,f_id,t_id from rapport_advanced.restore_formulaire_param where f_id=$1",array(
$form->f_id));
163 $cn->prepare(
'detail',
'select p_id,tmp_val,tva_id,fp_formula,fp_signed, jrn_def_type,tt_id,type_detail,with_tmp_val,type_sum_account,operation_pcm_val,date_paid
164 from rapport_advanced.restore_formulaire_param_detail where p_id=$1');
166 for ($e=0;$e<$nb;$e++)
169 $new_pid=$cn->get_value(
"insert into rapport_advanced.formulaire_param (p_code, p_libelle, p_type, p_order, f_id, t_id)
170 select p_code, p_libelle, p_type, p_order, f_id, t_id
171 from rapport_advanced.restore_formulaire_param where p_id=$1 returning p_id",array(
$array[$e][
'p_id']));
173 $cn->exec_sql(
"insert into rapport_advanced.formulaire_param_detail
190 nextval('rapport_advanced.formulaire_param_detail_fp_id_seq'),
205 rapport_advanced.restore_formulaire_param_detail where p_id =$1
206 ",array(
$array[$e][
'p_id']));
210 $cn->exec_sql(
'delete from rapport_advanced.restore_formulaire_param where f_id=$1',array(
$form->f_id));
213 catch (Exception $exc)
215 echo $exc->getMessage();
216 error_log($exc->getMessage());
217 error_log($exc->getTraceAsString());
253 $a_value = $cn->get_array(
"select fp_id,type_detail from rapport_advanced.formulaire_param_detail where p_id=$1", array($p_id));
267 echo h1($this->obj->p_libelle,
"");
272 echo h1($this->obj->p_libelle,
' class="title"');
284 echo
'<p>'.$this->obj->p_libelle.
'<p>';
289 echo
'<p>'.$this->obj->p_libelle.
'<p>';
301 echo span($this->obj->p_libelle,
' class="notice" ');
306 echo span($this->obj->p_libelle,
' class="notice"');
319 echo h2($this->obj->p_libelle,
'class="title"');
324 echo h2($this->obj->p_libelle,
'class="title"');
337 echo
"<h3>" . $this->obj->p_libelle .
"</h3>";
342 echo
"<h3 class=\"title\">" . $this->obj->p_libelle .
"</h3>";
357 $this->
id = $e->p_id;
363 echo $this->obj->p_libelle;
374 $elt = $this->parametre[$p_index][
'type_detail'];
378 return new RAPAV_Formula($this->parametre[$p_index][
'fp_id']);
384 return new RAPAV_Compute($this->parametre[$p_index][
'fp_id']);
387 return new RAPAV_Account($this->parametre[$p_index][
'fp_id']);
400 echo
'<h4 class="title">' . $this->obj->p_libelle .
"(" . $this->obj->p_code .
")" .
'</h4>';
401 echo HtmlInput::hidden(
'p_id[]', $this->obj->p_id);
402 $max = count($this->parametre);
403 echo HtmlInput::hidden(
"count_" . $this->
id,
$max);
406 echo
'<table id="table_' . $this->
id .
'">';
407 for ($i = 0; $i <
$max; $i++)
411 echo
'<tr id="tr_' . $formula->fp_id .
'">';
413 echo $formula->display_row();
415 echo $formula->button_delete();
416 echo $formula->button_modify();
423 echo HtmlInput::button_anchor(
424 "Ajout d'une ligne",
"javascript:void(0)",
"add_row" . $this->
id, sprintf(
"onclick=\"add_param_detail('%s','%s','%s','%s');\"",
$_REQUEST[
'plugin_code'],
$_REQUEST[
'ac'],
$_REQUEST[
'gDossier'], $this->
id)
433 parent::__construct($e);
437 $elt = $this->parametre[$p_index][
'type_detail'];
438 return new RAPAV_Account($this->parametre[$p_index][
'fp_id']);
445 echo
'<h4 class="title">' . $this->obj->p_libelle .
"(" . $this->obj->p_code .
")" .
'</h4>';
446 echo HtmlInput::hidden(
'p_id[]', $this->obj->p_id);
447 $max = count($this->parametre);
448 echo HtmlInput::hidden(
"count_" . $this->
id,
$max);
451 echo
'<table id="table_' . $this->
id .
'">';
452 for ($i = 0; $i <
$max; $i++)
456 echo
'<tr id="tr_' . $formula->fp_id .
'">';
458 echo $formula->display_row();
460 echo $formula->button_delete();
461 echo $formula->button_modify();
468 echo HtmlInput::button_anchor(
469 "Ajout d'une ligne",
"javascript:void(0)",
"add_row" . $this->
id, sprintf(
"onclick=\"add_param_detail('%s','%s','%s','%s');\"",
$_REQUEST[
'plugin_code'],
$_REQUEST[
'ac'],
$_REQUEST[
'gDossier'], $this->
id)
473 $('add_row".$this->id.
"').hide();
poste comptable utilisé avec le poste comptable, choix entre diff crédit - debit, diff débit-crédit...
poste comptable utilisé avec le poste comptable, choix entre diff crédit - debit, diff débit-crédit...
if(isset($_POST['remove'])) $array