37 if ( $this->
from !=
"" )
39 $sql.=
"$and oa_date >= to_date('".$this->from.
"','DD.MM.YYYY')";
41 if ( $this->
to !=
"" )
43 $sql.=
" $and oa_date <= to_date('".$this->to.
"','DD.MM.YYYY')";
59 $cond_poste=
" and upper(po_name) >= upper('".$this->from_poste.
"')";
61 $cond_poste.=
" and upper(po_name) <= upper('".$this->to_poste.
"')";
63 if ( isset ( $this->
pa_id) && $this->
pa_id !=
'')
64 $pa_id_cond=
"pa_id=".$this->pa_id.
" and";
65 $array=$this->
db->get_array(
" select oa_id,
70 to_char(oa_date,'DD.MM.YYYY') as oa_date,
76 coalesce(jr_comment,b.oa_description) as jr_comment,
77 case when j_poste is null and b.f_id is not null then
78 (select ad_value from fiche_detail where fiche_detail.f_id=b.f_id and ad_id=23)
79 when j_poste is not null then
82 coalesce(jrnx.f_id,b.f_id) as f_id,
83 case when jrnx.f_id is not null then
84 (select ad_value from fiche_Detail where f_id=jrnx.f_id and ad_id=23)
85 when b.f_id is not null then
86 (select ad_value from fiche_Detail where f_id=b.f_id and ad_id=23)
92 (select ad_value from fiche_detail where f_id=ftiers.cardid and ad_id=23) as qcode_tiers
93 from operation_analytique as B join poste_analytique using(po_id)
94 left join jrnx using (j_id)
95 left join jrn on (j_grpt=jr_grpt_id)
96 left join ( select distinct qp_supplier as cardid,j_id from quant_purchase qp
98 select distinct qs_client,j_id from quant_sold qs
100 select distinct qf_bank,j_id from quant_fin qf ) as ftiers using (j_id)
101 where $pa_id_cond oa_amount <> 0.0 $cond_poste $filter_date
102 order by po_name,oa_date::date,qcode,j_poste");
103 $this->has_data=count(
$array);
112 $cond_poste=
" and upper(po_name) >= upper('".$this->from_poste.
"')";
114 $cond_poste.=
" and upper(po_name) <= upper('".$this->to_poste.
"')";
116 if ( isset ( $this->
pa_id) && $this->
pa_id !=
'')
117 $pa_id_cond=
"pa_id=".$this->pa_id.
" and";
118 $array=$this->
db->get_array(
" select
120 to_char(oa_date,'DD.MM.YYYY') as oa_date,
121 to_char(jr_date_paid,'DD.MM.YY') as strdate_paid,
122 case when j_poste is null and b.f_id is not null then
123 (select ad_value from fiche_detail where fiche_detail.f_id=b.f_id and ad_id=5)
124 when j_poste is not null then
128 case when jrnx.f_id is not null then
129 (select ad_value from fiche_Detail where f_id=jrnx.f_id and ad_id=23)
130 when b.f_id is not null then
131 (select ad_value from fiche_Detail where f_id=b.f_id and ad_id=23)
134 coalesce(jr_comment,b.oa_description) as jr_comment,
135 (select ad_value from fiche_detail where f_id=ftiers.cardid and ad_id=23) as qcode_tiers,
136 coalesce (jr_pj_number,'') as jr_pj_number,
137 coalesce(jr_internal,'') as jr_internal,
138 coalesce(oa_group,0) as oa_group,
139 case when oa_debit='t' then oa_amount else 0 end as amount_deb,
140 case when oa_debit='f' then oa_amount else 0 end as amount_cred,
141 case when oa_debit='f' then 'C' else 'D' end as deb_cred,
145 select string_agg( j10.jr_pj_number::text,'-')
147 left join (select jr10.jr_id , jr10.jra_concerned from jrn_rapt jr10 ) as opr_cnc1 on (j10.jr_id=opr_cnc1.jr_id or j10.jr_id=opr_cnc1.jra_concerned)
149 opr_cnc1.jr_id=jrn.jr_id
150 or opr_cnc1.jra_concerned=jrn.jr_id) as agg_jr_pj_number,
152 select string_agg( j11.jr_internal::text,'-')
154 left join (select jr11.jr_id , jr11.jra_concerned from jrn_rapt jr11 ) as opr_cnc2 on (j11.jr_id=opr_cnc2.jr_id or j11.jr_id=opr_cnc2.jra_concerned)
156 opr_cnc2.jr_id=jrn.jr_id
157 or opr_cnc2.jra_concerned=jrn.jr_id) as agg_jr_internal
158 from operation_analytique as B join poste_analytique using(po_id)
159 left join jrnx using (j_id)
160 left join jrn on (j_grpt=jr_grpt_id)
161 left join ( select distinct qp_supplier as cardid,j_id from quant_purchase qp
163 select distinct qs_client,j_id from quant_sold qs
165 select distinct qf_bank,j_id from quant_fin qf ) as ftiers using (j_id)
166 left join (select j.jr_id,string_agg( ag_id::text,'-') as str_action
168 join action_gestion_operation ago on (j.jr_id=ago.jr_id )
169 group by j.jr_id) as ac on (ac.jr_id=jrn.jr_id)
170 left join (select j9.jr_id,string_agg( ag9.ag_ref::text,'-') as str_action_ref
172 join action_gestion_operation ago9 on (j9.jr_id=ago9.jr_id )
173 join action_gestion ag9 on (ag9.ag_id =ago9.ag_id )
174 group by j9.jr_id) as ag on (ag.jr_id=jrn.jr_id)
176 $pa_id_cond oa_amount <> 0.0 $cond_poste $filter_date
177 order by po_name,oa_date::date,qcode,j_poste
193 if (CONVERT_GIF_PDF <>
'NOT' && PDFTK <>
'NOT')
204 $r.= dossier::hidden();
211 $msg = _(
"Les extensions CONVERT_GIF_PDF et PDFTK pour convertir en pdf ne sont pas installées ");
213 _(
'Export des pièces en PDF'),
214 sprintf(
'onclick="smoke.alert(\'%s\')"',
$msg));
234 $r.=
'<table class="result" style="width:100%;border-color:transparent">';
247 $r.=
'<tr class="highlight">';
249 $sign =
" ".(($tot_solde > 0) ?
'C' :
'D');
253 $r.=
'<tr>' .
'<td colspan="12" style="width:auto">' .
'<h2>' .
h(
$row[
'po_name'] .
' ' .
$row[
'po_description']) .
'</td></tr>';
256 '<th>' . _(
'Date') .
'</th>' .
257 '<th>' . _(
'Poste') .
'</th>' .
258 '<th>' . _(
'Quick_code') .
'</th>' .
259 '<th>' . _(
'Libellé') .
'</th>' .
262 '<th>' . _(
'Pièce') .
'</th>' .
263 '<th>' . _(
'Interne') .
'</th>' .
264 '<th style="text-align:right">' . _(
'Débit') .
'</th>' .
265 '<th style="text-align:right">' . _(
'Crédit') .
'</th>' .
266 '<th style="text-align:right">' . _(
'Prog.') .
'</th>' .
277 if (
$row[
'jr_tech_per'] !=
null )
297 if (
$row[
'jr_id'] !=
null && $p_with_ck==1)
303 if ($str_document !=
"")
306 $ck->set_range(
"document_export_ck");
307 $str_ck =
$ck->input();
312 '<td>' . $str_ck .
'</td>' .
313 '<td>' .
$row[
'oa_date'] .
'</td>' .
318 '<td>' . $str_document .
'</td>' .
319 td(
$row[
'jr_pj_number']) .
323 '<td class="num">' .
nbm($tot_solde).
'</td>';
326 $r.=
'<tr class="highlight">';
328 $sign = ($tot_solde > 0) ?
'C' :
'D';
343 $r.=
'<form method="GET" action="export.php" style="display:inline">';
351 $r.= dossier::hidden();
361 if ( is_array(
$array) ==
false )
370 $aheader[]=array(
"title"=>
'Imp. Analytique',
'type'=>
'string');
371 $aheader[]=array(
"title"=>
'Date',
'type'=>
'string');
372 $aheader[]=array(
"title"=>
'Date Pay',
'type'=>
'string');
373 $aheader[]=array(
"title"=>
'Poste',
'type'=>
'string');
374 $aheader[]=array(
"title"=>
'Quick_Code',
'type'=>
'string');
375 $aheader[]=array(
"title"=>
'libelle',
'type'=>
'string');
376 $aheader[]=array(
"title"=>
'tiers',
'type'=>
'string');
377 $aheader[]=array(
"title"=>
'Pièce',
'type'=>
'string');
378 $aheader[]=array(
"title"=>
'Num.interne',
'type'=>
'string');
379 $aheader[]=array(
"title"=>
'row',
'type'=>
'string');
380 $aheader[]=array(
"title"=>
'Debit',
'type'=>
'num');
381 $aheader[]=array(
"title"=>
'Credit',
'type'=>
'num');
382 $aheader[]=array(
"title"=>
'D/C',
'type'=>
'string');
383 $aheader[]=array(
"title"=>
'Action',
'type'=>
'string');
384 $aheader[]=array(
"title"=>
'Suivi',
'type'=>
'string');
385 $aheader[]=array(
"title"=>
'Rapprochement pièce',
'type'=>
'string');
386 $aheader[]=array(
"title"=>
'Rapprochement n° interne',
'type'=>
'string');
th($p_string, $p_extra='', $raw='')
td($p_string='', $p_extra='')
surround the string with td
nbm($p_number, $p_dec=2)
format the number with a sep.
catch(Exception $exc) if(! $g_user->can_write_action($ag_id)) $r
h( $row[ 'oa_description'])
catch(Exception $e) $exercice
$anc_grandlivre from_poste
report he Grand Livre for analytic
button_export_csv($p_string="")
Show the button to export CSV.
set_sql_filter()
Set the filter (account_date)
button_export_pdf($p_string="")
Show the button to export in PDF all the receipt.
load()
load the data from the database
display_html($p_with_ck=1)
compute the html display
this class is the mother class for the CA printing
static javascript_set_range($p_name)
Before calling this function , you must set a range with the function set_range.
static array_to_csv($array, $aheader, $p_filename)
with the handle of a successull query, echo each row into CSV and send it directly
For the periode tables parm_periode and jrn_periode.