expprt GrandLivre Analytique
This commit is contained in:
parent
610a9b8991
commit
d1381a6cbf
5 changed files with 77 additions and 46 deletions
|
|
@ -9,8 +9,8 @@ echo '<p>' . HtmlInput::submit('Recherche', 'Recherche') . '</p>';
|
|||
echo '</form>';
|
||||
if (isset($_GET['result']))
|
||||
{
|
||||
echo $gl->display_button();
|
||||
echo $gl->show_button();
|
||||
echo $gl->display_html();
|
||||
echo $gl->display_button();
|
||||
echo $gl->show_button();
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ class Anc_GrandLivre extends Anc_Print
|
|||
$pa_id_cond="";
|
||||
if ( isset ( $this->pa_id) && $this->pa_id !='')
|
||||
$pa_id_cond= "pa_id=".$this->pa_id." and";
|
||||
$array=$this->db->get_array(" select oa_id,
|
||||
$array=$this->db->get_array(" select oa_id,
|
||||
po_name,
|
||||
oa_description,
|
||||
po_description,
|
||||
|
|
@ -52,22 +52,53 @@ class Anc_GrandLivre extends Anc_Print
|
|||
to_char(oa_date,'DD.MM.YYYY') as oa_date,
|
||||
oa_amount,
|
||||
oa_group,
|
||||
j_id ,
|
||||
jr_internal,
|
||||
jr_id,
|
||||
j_id ,
|
||||
jr_internal,
|
||||
jr_id,
|
||||
jr_comment,
|
||||
j_poste,
|
||||
jrnx.f_id,
|
||||
( select ad_value from fiche_Detail where f_id=jrnx.f_id and ad_id=23) as qcode
|
||||
from operation_analytique as B join poste_analytique using(po_id)
|
||||
from operation_analytique as B join poste_analytique using(po_id)
|
||||
left join jrnx using (j_id)
|
||||
left join jrn on (j_grpt=jr_grpt_id)
|
||||
where $pa_id_cond oa_amount <> 0.0 $cond_poste
|
||||
order by po_name,oa_date ,qcode,j_poste");
|
||||
|
||||
|
||||
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
function load_csv()
|
||||
{
|
||||
$filter_date=$this->set_sql_filter();
|
||||
$cond_poste='';
|
||||
if ($this->from_poste != "" )
|
||||
$cond_poste=" and upper(po_name) >= upper('".$this->from_poste."')";
|
||||
if ($this->to_poste != "" )
|
||||
$cond_poste.=" and upper(po_name) <= upper('".$this->to_poste."')";
|
||||
$pa_id_cond="";
|
||||
if ( isset ( $this->pa_id) && $this->pa_id !='')
|
||||
$pa_id_cond= "pa_id=".$this->pa_id." and";
|
||||
$array=$this->db->get_array(" select
|
||||
po_name,
|
||||
to_char(oa_date,'DD.MM.YYYY') as oa_date,
|
||||
j_poste,
|
||||
( select ad_value from fiche_Detail where f_id=jrnx.f_id and ad_id=23) as qcode,
|
||||
jr_comment,
|
||||
jr_internal,
|
||||
case when oa_debit='t' then 'D' else 'C' end,
|
||||
oa_amount
|
||||
from operation_analytique as B join poste_analytique using(po_id)
|
||||
left join jrnx using (j_id)
|
||||
left join jrn on (j_grpt=jr_grpt_id)
|
||||
where $pa_id_cond oa_amount <> 0.0 $cond_poste
|
||||
order by po_name,oa_date ,qcode,j_poste");
|
||||
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief compute the html display
|
||||
*
|
||||
|
|
@ -120,7 +151,7 @@ class Anc_GrandLivre extends Anc_Print
|
|||
$prev=$row['po_name'];
|
||||
$ix++;
|
||||
}
|
||||
|
||||
|
||||
$r.= '<tr>';
|
||||
$detail=($row['jr_id'] != null)?HtmlInput::detail_op($row['jr_id'],$row['jr_internal']):'';
|
||||
$post_detail=($row['j_poste'] != null)?HtmlInput::history_account($row['j_poste'],$row['j_poste']):'';
|
||||
|
|
@ -192,7 +223,7 @@ class Anc_GrandLivre extends Anc_Print
|
|||
{
|
||||
$r="";
|
||||
//---Html
|
||||
$array=$this->load();
|
||||
$array=$this->load_csv();
|
||||
if ( is_array($array) == false )
|
||||
{
|
||||
return $array;
|
||||
|
|
@ -208,13 +239,14 @@ class Anc_GrandLivre extends Anc_Print
|
|||
$ix=0;$prev='xx';
|
||||
$tot_deb=$tot_cred=0;
|
||||
$aheader=array();
|
||||
$aheader=array("title"=>'Date','type'=>'string');
|
||||
$aheader=array("title"=>'Poste','type'=>'string');
|
||||
$aheader=array("title"=>'Quick_Code','type'=>'string');
|
||||
$aheader=array("title"=>'libelle','type'=>'string');
|
||||
$aheader=array("title"=>'Num.interne','type'=>'string');
|
||||
$aheader=array("title"=>'Debit','type'=>'num');
|
||||
$aheader=array("title"=>'Credit','type'=>'num');
|
||||
$aheader[]=array("title"=>'Imp. Analytique','type'=>'string');
|
||||
$aheader[]=array("title"=>'Date','type'=>'string');
|
||||
$aheader[]=array("title"=>'Poste','type'=>'string');
|
||||
$aheader[]=array("title"=>'Quick_Code','type'=>'string');
|
||||
$aheader[]=array("title"=>'libelle','type'=>'string');
|
||||
$aheader[]=array("title"=>'Num.interne','type'=>'string');
|
||||
$aheader[]=array("title"=>'Debit','type'=>'string');
|
||||
$aheader[]=array("title"=>'Credit','type'=>'num');
|
||||
Impress::array_to_csv($array, $aheader);
|
||||
}
|
||||
}
|
||||
|
|
@ -29,7 +29,7 @@ require_once('class_periode.php');
|
|||
class Impress
|
||||
{
|
||||
/*! \brief Purpose Parse a formula
|
||||
*
|
||||
*
|
||||
* \param $p_cn connexion
|
||||
* \param $p_label
|
||||
* \param $p_formula
|
||||
|
|
@ -233,39 +233,47 @@ class Impress
|
|||
* with the handle of a successull query, echo each row into CSV and
|
||||
* send it directly
|
||||
* @param type $array of data
|
||||
* @param type $aheader double array, each item of the array contains
|
||||
* @param type $aheader double array, each item of the array contains
|
||||
* a key type (num) and a key title
|
||||
*/
|
||||
static function array_to_csv($array,$aheader)
|
||||
{
|
||||
$seq="";
|
||||
for ($i=0;$i<count($i);$i++)
|
||||
for ($i=0;$i<count($aheader);$i++)
|
||||
{
|
||||
echo '"'.$aheader[$i]['title'].'"';
|
||||
echo $seq.'"'.$aheader[$i]['title'].'"';
|
||||
$seq=";";
|
||||
}
|
||||
printf("\n\r");
|
||||
|
||||
printf("\r");
|
||||
|
||||
$seq="";
|
||||
// fetch all the rows
|
||||
for ($i=0;$i<count($array);$i++)
|
||||
{
|
||||
$row=$array[$i];
|
||||
$sep2="";
|
||||
$e=0;
|
||||
// for each rows, for each value
|
||||
for ($e=0;$e<count($row);$e++)
|
||||
foreach ($array[$i] as $key=>$value)
|
||||
{
|
||||
switch ($aheader[$e]['type'])
|
||||
{
|
||||
case 'num':
|
||||
echo nb($row[$e]).$sep2;
|
||||
break;
|
||||
default:
|
||||
echo '"'.$row[$e].'"'.$sep2;
|
||||
}
|
||||
$sep2=";";
|
||||
if ($e > count($aheader)) $e=0;
|
||||
|
||||
if ( isset ($aheader[$e]['type']))
|
||||
{
|
||||
switch ($aheader[$e]['type'])
|
||||
{
|
||||
case 'num':
|
||||
echo $sep2.nb($value);
|
||||
break;
|
||||
default:
|
||||
echo $sep2.'"'.$value.'"';
|
||||
}
|
||||
} else {
|
||||
echo '"'.$value.'"'.$sep2;
|
||||
}
|
||||
$sep2=";";$e++;
|
||||
}
|
||||
printf("\n\r");
|
||||
printf("\r");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,15 +1,6 @@
|
|||
insert into menu_ref(me_code,me_menu,me_file,me_description,me_type)
|
||||
values ('CSV:AncGrandLivre','Impression Grand-Livre',null,null,'PR');
|
||||
CREATE TABLE profile_menu (
|
||||
pm_id integer NOT NULL,
|
||||
me_code text,
|
||||
me_code_dep text,
|
||||
p_id integer,
|
||||
p_order integer,
|
||||
p_type_display text NOT NULL,
|
||||
pm_default integer
|
||||
);
|
||||
|
||||
insert into profile_menu(me_code,me_code_dep,p_id,pm_default)
|
||||
insert into profile_menu(me_code,me_code_dep,p_id,p_type_display,pm_default)
|
||||
values ( 'CSV:AncGrandLivre', NULL, 1 , 'P', 0);
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ script SQL to run
|
|||
|
||||
\i mode_paiement.sql
|
||||
\i anc-modularity-imp.sql
|
||||
|
||||
\i anc-grandlivre.sql
|
||||
|
||||
create unique index qcode_idx on fiche_detail (ad_value) where ad_id=23;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue