noalyss Version-10
NOALYSS : serveur de comptabilité et ERP (2002)
Loading...
Searching...
No Matches
fiche.inc.php
Go to the documentation of this file.
1<?php
2
3/*
4 * This file is part of NOALYSS.
5 *
6 * NOALYSS is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * NOALYSS is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with NOALYSS; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20// Copyright Author Dany De Bontridder danydb@aevalys.eu
21/**
22 * \file
23 * \brief printing of category of card : balance, historic
24 */
25if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
26
27$gDossier = dossier::id();
28$cn = Dossier::connect();
31
32
33/**
34 * Show first the form
35 */
36/* var categorie ISelect select card category */
37$categorie = new ISelect('cat');
38$categorie->value = $cn->make_array("select fd_id,fd_label||' ('||(select count(*) from fiche where fiche.fd_id=fiche_def.fd_id)::text||')' from fiche_def order by fd_label");
39$categorie->selected = $http->get('cat','number',0);
40
41// var $str_categorie string
43$ac = $http->request('ac');
44
45// var $icall ICheckBox : all card or only the current category
46$icall = new ICheckBox("allcard", 1);
47$icall->selected = (isset($_GET['allcard'])) ? 1 : 0;
48// var $str_icall string
49$str_icall = $icall->input();
50
51/* var $exercice string current exercice (depending of user's period preferences) */
52$exercice = $g_user->get_exercice();
53$iperiode = new Periode($cn);
54list ($first, $last) = $iperiode->get_limit($exercice);
55
56/*
57 * var $periode_start IDate start date
58 * var $periode_end IDate end date
59*/
60$periode_start = new IDate('start');
61$periode_end = new IDate('end');
62
63$periode_start->value = $http->get('start',"date",$first->first_day());
64$periode_end->value = $http->get('end','date', $last->last_day());
65
66/*
67 * var $str_start string date dd.mm.yyyy
68 * var $str_end string date dd.mm.yyyy
69 */
72
73
74
75/* var $histo ISelect choice */
76$histo = new ISelect('histo');
77$histo->value = array(
78 array('value' => -1, 'label' => _('Liste')),
79 array('value' => 0, 'label' => _('Historique')),
80 array('value' => 1, 'label' => _('Historique Lettré')),
81 array('value' => 6, 'label' => _('Historique Lettré et montants différents')),
82 array('value' => 2, 'label' => _('Historique non Lettré')),
83 array('value' => 3, 'label' => _('Résumé')),
84 array('value' => 4, 'label' => _('Balance')),
85 array('value' => 8, 'label' => _('Balance âgée')),
86 array('value' => 7, 'label' => _('Balance âgée en-cours')),
87 array('value' => 5, 'label' => _('Balance non soldée'))
88);
89$histo->javascript = 'onchange="if (this.value==3 || this.value==-1) {
90 g(&quot;trstart&quot;).style.display=&quot;none&quot;;g(&quot;trend&quot;).style.display=&quot;none&quot;;g(&quot;allcard&quot;).style.display=&quot;none&quot;;}
91 else {g(&quot;trstart&quot;).style.display=&quot;&quot;;g(&quot;trend&quot;).style.display=&quot;&quot;;g(&quot;allcard&quot;).style.display=&quot;&quot;;}"';
92
93$histo->selected = $http->get('histo',"number", -1);
94$str_histo = $histo->input();
95
96// $inactive checkbox include inactive cards
97$inactive = new ICheckbox ('inactive',1);
98$inactive->selected=$http->request('inactive','string',0);
100?>
101<div class="content">
102
103<?php
104echo '<FORM method="GET">';
105echo dossier::hidden();
106echo HtmlInput::hidden('ac', $ac);
107require_once NOALYSS_TEMPLATE.'/impress_cat_card.php';
108echo HtmlInput::submit('cat_display', _('Recherche'));
109echo '</FORM>';
110
111echo '</div>';
112$str = "if (g('histo').value==3 || g('histo').value== -1 ) {
113 g('trstart').style.display='none';g('trend').style.display='none';g('allcard').style.display='none';}
114 else {g('trstart').style.display='';g('trend').style.display='';g('allcard').style.display='';}
115 if ( g('histo').value== -1 ) { g('allcard').style.display='';}
116
117 ";
118echo create_script($str);
119echo '<hr>';
120
121//-----------------------------------------------------
122if (!isset($_GET['cat_display']))
123 return;
124
125$fd_id =$categorie->selected ;
126
127
128$h_add_card_b = new IButton('add_card');
129$h_add_card_b->label = _('Créer une nouvelle fiche');
130$h_add_card_b->javascript = "dis_blank_card({gDossier:$gDossier,fd_id:$fd_id,ref:2})";
131$str_add_card = ($g_user->check_action(FICADD) == 1) ? $h_add_card_b->input() : "";
132
133/*
134 * You show now the result
135 */
136
137$allcard = (isset($_GET['allcard'])) ? 1 : 0;
138if ( $allcard == 0 ){
139 $fiche_def=new Fiche_Def($cn,$categorie->selected );
140 $fiche_def->get();
141 echo h1($fiche_def->label,"");
142 echo h2($fiche_def->fd_description,"");
143}
144$array = Fiche::get_fiche_def($cn,$categorie->selected , 'name_asc');
145
146// if no card found , stop here
147if ($array == null && $allcard == 0 && $histo->selected != 3 )
148{
149 echo '<div class="content">';
150 echo '<h2 class="error"> '._('Aucune fiche trouvée').'</h2>';
151 echo $str_add_card;
152 echo '</div>';
153 return;
154}
155
156echo '<div class="content">';
157/* * *************************************************************************************************************
158 * Liste
159 *
160 * ***************************************************************************************************************/
161if ($histo->selected == -1)
162{
163 $array = Fiche::get_fiche_def($cn,$categorie->selected , 'name_asc',inactive: $inactive->selected);
164
165 $write = $g_user->check_action(FICADD);
166 /**
167 * If ask for move or delete
168 */
169 if (isset($_POST['action']))
170 {
171 if ($write == 1)
172 {
173 $ack = $http->post("f_id","array",[]);
174 /**
175 * Move
176 */
177 if (isset($_POST['move'])&& $_POST['move'] == 1)
178 {
179 $move_to=$http->post("move_to","number");
180 for ($i = 0; $i < count($ack); $i++)
181 {
182 $fiche = new Fiche($cn, $ack[$i]);
183 $fiche->move_to($move_to);
184 }
185 }
186 /**
187 * Delete
188 */
189 if (isset($_POST['delete'])&& $_POST['delete']==1)
190 {
191 $msg="";
192 for ($i = 0; $i < count($ack); $i++)
193 {
194 $fiche = new Fiche($cn, $ack[$i]);
195 if ( $fiche->remove(true) == 1 )
196 {
197 $msg.="\n ".$fiche->get_attribute(ATTR_DEF_QUICKCODE);
198 }
199 }
200 if ($msg != "")
201 {
202 echo '<div class="content">';
203 echo h2(_("Fiche non effacées"), ' class="error" ');
204 echo '<p class="error">'._(" Ces fiches n'ont pas été effacées ").$msg;
205 echo '</div>';
206 }
207 }
208 }
209 else
210 {
211 echo NoAccess();
212 }
213 }
214 $sql = "select f_id from fiche ";
215
216 // build SQL : all cards or only the selected category , with inactive cards included or only active
217 if ($allcard == 1 && $inactive->selected == 1)
218 {
219 // all categories , including inactive cards
220 $cond = "";
221 }elseif ($allcard == 1 && $inactive->selected== 0)
222 {
223 // all categories and only active cards
224 $cond = " where f.f_enable = '1' ";
225 }
226 elseif ($allcard == 0 && $inactive->selected == 1)
227 {
228 // one categorie , including inactive cards
229 $p_cat=$http->get("cat","number");
230 $cond = " where f.fd_id = " . sql_string($p_cat);
231 }elseif ($allcard == 0 && $inactive->selected == 0) {
232 // one categorie , without inactive cards
233 $p_cat=$http->get("cat","number");
234 $cond = " where f.fd_id = " . sql_string($p_cat);
235 $cond .= " and f.f_enable='1'";
236 }
237
238 // Create nav bar
239 $max = $cn->get_value("select count(*) from fiche as f " . $cond);
240
241 $step = $_SESSION[SESSION_KEY.'g_pagesize'];
242 $page=$http->get("page","number",1);
243 $offset=$http->get("offset","number",0);
245 $limit = ($step == -1 ) ? "" : " limit " . $step;
246 $res = $cn->exec_sql("
247 select f_id,
248 (select ad_value from fiche_detail as fd1 where ad_id=1 and fd1.f_id=f.f_id) as name,
249 (select ad_value from fiche_detail as fd1 where ad_id=23 and fd1.f_id=f.f_id) as qcode,
250 fd_label,
251 (select ad_value from fiche_detail as fd1 where ad_id=5 and fd1.f_id=f.f_id) as poste
252 from fiche as f join fiche_def as fd on (fd.fd_id=f.fd_id)
253 $cond order by 2,4 offset $offset $limit
254 ");
255 $nb_line = Database::num_row($res);
256 if ($write != 1 || $allcard != 0 ) $str_add_card="";
257 require_once NOALYSS_TEMPLATE.'/fiche_list.php';
258 echo '<hr>'.$bar;
259 return;
260}
261/* * *********************************************************************************************************************************
262 * Summary
263 *
264 * ******************************************************************************************************************************** */
265if ($histo->selected == 3)
266{
267 $array = Fiche::get_fiche_def($cn,$categorie->selected , 'name_asc',inactive: $inactive->selected);
268
269 $cat_card = new Fiche_Def($cn);
270 $cat_card->id =$http->get('cat','number');
271 $aHeading = $cat_card->load_attribute();
272 $str_add_card="";
273 if ( $allcard == 0 ) {
274 $h_add_card_b = new IButton('add_card');
275 $h_add_card_b->label = _('Créer une nouvelle fiche');
276 $h_add_card_b->javascript = "dis_blank_card({gDossier:$gDossier,fd_id:$fd_id,after_save:1,ref:2})";
278 }
279 echo $str_add_card;
280 require_once NOALYSS_TEMPLATE.'/result_cat_card_summary.php';
281
282 $hid = new IHidden();
283 echo '<form method="GET" ACTION="export.php">' . dossier::hidden() ;
284 echo $str_add_card;
285 echo
286 HtmlInput::submit('bt_csv', _("Export CSV")) .
287 HtmlInput::hidden('act', "CSV:fiche") .
288 HtmlInput::hidden('inactive', $inactive->selected) .
289 $hid->input("type", "fiche") .
290 $hid->input("ac", $http->request('ac')) .
291 $hid->input("fd_id", $http->request('cat',"number"));
292
293 echo "</form>";
294
295 return;
296}
297
298$cat=$http->get("cat","number");
299$phisto=$http->get("histo","number");
300
301$export_pdf = '<FORM METHOD="get" ACTION="export.php" style="display:inline">';
302$export_pdf.=HtmlInput::hidden('cat', $cat);
303$export_pdf.=HtmlInput::hidden('act', "PDF:fiche_balance") .
304$export_pdf.=HtmlInput::hidden('start', $periode_start->value );
305$export_pdf.=HtmlInput::hidden('end', $periode_end->value );
306$export_pdf.=HtmlInput::hidden('histo', $phisto);
307$export_pdf.=HtmlInput::request_to_hidden(array('allcard'));
308$export_pdf.=dossier::hidden();
309$export_pdf.=HtmlInput::submit('pdf', _('Export en PDF'));
310$export_pdf.='</FORM>';
311
312$export_print = HtmlInput::print_window();
313
314$export_csv = '<FORM METHOD="get" ACTION="export.php" style="display:inline">';
315$export_csv.=HtmlInput::hidden('cat', $cat);
316$export_csv.=HtmlInput::hidden('act', 'CSV:fiche_balance');
317$export_csv.=HtmlInput::hidden('start', $periode_start->value );
318$export_csv.=HtmlInput::hidden('end', $periode_end->value );
319$export_csv.=HtmlInput::hidden('histo', $phisto);
320$export_csv.=HtmlInput::request_to_hidden(array('allcard'));
321$export_csv.=dossier::hidden();
322$export_csv.=HtmlInput::submit('CSV', _('Export en CSV'));
323$export_csv.='</FORM>';
324/*
325 * Date is important is requested balance
326 */
327if (isDate($_REQUEST['start']) == null || isDate($_REQUEST['end']) == null)
328{
329 echo h2('Date invalide !', 'class="error"');
330 alert(_('Date invalide !'));
331 return;
332}
333/*************************************************************************************************************************/
334 // Balance agée tous
335/*************************************************************************************************************************/
336if ( $histo->selected == 8)
337{
338 $cat=$http->get("cat","number");
339 $bal=new Balance_Age($cn);
340 $export_csv = '<FORM METHOD="get" ACTION="export.php" style="display:inline">';
341 $export_csv .=HtmlInput::request_to_hidden(array('gDossier','ac','p_let','p_date_start'));
342 $export_csv.=HtmlInput::hidden('p_date_start',$periode_start->value );
343 $export_csv .= HtmlInput::hidden('act','CSV:balance_age');
344 $export_csv .= HtmlInput::hidden('p_let','let');
345 $export_csv .= HtmlInput::hidden('p_type','X');
348 $export_csv .= HtmlInput::submit('csv',_('Export CSV'));
349 $export_csv.='</FORM><p></p>';
350 if ( $allcard == 0 )
351 {
352 echo $export_csv;
353 $bal->display_category($periode_start->value ,$cat,'let');
354 echo $export_csv;
355 }
356 else
357 {
358 echo $export_csv;
359 $a_cat = $cn->get_array("select fd_id from vw_fiche_def where ad_id=" . ATTR_DEF_ACCOUNT . " order by fd_label asc");
360 $nb_cat=count($a_cat);
361 for ($i=0;$i < $nb_cat;$i++)
362 {
363 $bal->display_category($periode_start->value ,$a_cat[$i]['fd_id'],'let');
364 }
365 echo $export_csv;
366 }
367 return;
368}
369/*************************************************************************************************************************/
370 // Balance en-cours
371/*************************************************************************************************************************/
372if ( $histo->selected == 7)
373{
374 $bal=new Balance_Age($cn);
375
376 $cat=$http->get("cat","number");
377 $export_csv = '<FORM METHOD="get" ACTION="export.php" style="display:inline">';
378 $export_csv .=HtmlInput::request_to_hidden(array('gDossier','ac','p_let','p_date_start'));
379 $export_csv.=HtmlInput::hidden('p_date_start', $periode_start->value );
380 $export_csv .= HtmlInput::hidden('act','CSV:balance_age');
381 $export_csv .= HtmlInput::hidden('p_let','unlet');
382 $export_csv .= HtmlInput::hidden('p_type','X');
385 $export_csv .= HtmlInput::submit('csv',_('Export CSV'));
386 $export_csv.='</FORM><p></p>';
387 if ( $allcard == 0 )
388 {
389 echo $export_csv;
390 $bal->display_category($periode_start->value ,$cat,'unlet');
391 echo $export_csv;
392 }
393 else
394 {
395 echo $export_csv;
396 $a_cat = $cn->get_array("select fd_id from vw_fiche_def where ad_id=" . ATTR_DEF_ACCOUNT . " order by fd_label asc");
397 $nb_cat=count($a_cat);
398 for ($i=0;$i < $nb_cat;$i++)
399 {
400 $bal->display_category($periode_start->value ,$a_cat[$i]['fd_id'],'unlet');
401 }
402 echo $export_csv;
403 }
404 return;
405}
406/********************************************************************************************************************************
407 * Balance
408 *
409 **********************************************************************************************************************************/
410if ($histo->selected == 4 || $histo->selected == 5)
411{
412 if ( $allcard == 0 ) echo $str_add_card;
413 echo $export_pdf;
414 echo $export_csv;
415 echo $export_print;
416
417 $fd = new Fiche_Def($cn, $categorie->selected );
418 if ($allcard == 0 && $fd->hasAttribute(ATTR_DEF_ACCOUNT) == false)
419 {
420 echo alert(_("Cette catégorie n'ayant pas de poste comptable n'a pas de balance"));
421 return;
422 }
423 // all card
424 if ($allcard == 1)
425 {
426 $afiche = $cn->get_array("select fd_id from vw_fiche_def where ad_id=" . ATTR_DEF_ACCOUNT . " order by fd_label asc");
427 }
428 else
429 {
430 $afiche[0] = array('fd_id' => $categorie->selected );
431 }
432
433 for ($e = 0; $e < count($afiche); $e++)
434 {
435 $ret = $cn->exec_sql("select f_id,ad_value from fiche join fiche_detail using(f_id) where fd_id=$1 and ad_id=1 order by 2 ", array($afiche[$e]['fd_id']));
436 if ($cn->count() == 0)
437 {
438 if ($allcard == 0)
439 {
440 echo _("Aucune fiche trouvée");
441 return;
442 } else
443 continue;
444 }
445 echo '<h2 class="h-section">' . $cn->get_value("select fd_label from fiche_def where fd_id=$1", array($afiche[$e]['fd_id'])) . '</h2>';
446 $id="table_".$afiche[$e]['fd_id']."_id";
447 echo _('Filtre rapide:').HtmlInput::filter_table($id, '0,1,2', '1');
448 echo '<table class="sortable" id="'.$id.'" class="result" >';
449 echo tr(
450 th(_('Quick Code')) .
451 th(_('Libellé')) .
452 '<th>'._('Poste').Icon_Action::infobulle(27).'</th>'.
453 th(_('Débit'), 'style="text-align:right"') .
454 th(_('Crédit'), 'style="text-align:right"') .
455 th(_('Solde'), 'style="text-align:right"') .
456 th(_('D/C'), 'style="text-align:right"')
457 );
458 $idx = 0;$sum_deb=0;$sum_cred=0;$sum_solde=0;bcscale(4);
459 for ($i = 0; $i < Database::num_row($ret); $i++)
460 {
461 $start=$http->request("start",'date');
462 $end=$http->request("end",'date');
463 $filter = " (j_date >= to_date('" . $start. "','DD.MM.YYYY') " .
464 " and j_date <= to_date('" . $end . "','DD.MM.YYYY')) ";
466 $oCard = new Fiche($cn, $aCard['f_id']);
467 $solde = $oCard->get_solde_detail($filter);
468 if ($solde['debit'] == 0 && $solde['credit'] == 0)
469 continue;
470 /* only not purged card */
471 if ($_GET['histo'] == 5 && $solde['debit'] == $solde['credit'])
472 continue;
473 $class =($idx % 2 == 0) ? 'class="odd"':'class="even"';
474 $idx++;
475 $sum_cred=bcadd($sum_cred,$solde['credit']);
476 $sum_deb=bcadd($sum_deb,$solde['debit']);
477 $sum_solde=bcsub($sum_deb,$sum_cred);
478 echo tr(
479 td(HtmlInput::history_card($oCard->id, $oCard->get_attribute(ATTR_DEF_QUICKCODE))) .
480 td($oCard->get_attribute(ATTR_DEF_NAME)) .
481 td(HtmlInput::history_account($oCard->get_attribute(ATTR_DEF_ACCOUNT),$oCard->get_attribute(ATTR_DEF_ACCOUNT))).
482 td(nbm($solde['debit']), 'class="sorttable_numeric" sorttable_customkey="'.$solde['debit'].'" style="text-align:right"') .
483 td(nbm($solde['credit']), 'class="sorttable_numeric" sorttable_customkey="'.$solde['debit'].'" style="text-align:right"') .
484 td(nbm(abs($solde['solde'])), 'class="sorttable_numeric" sorttable_customkey="'.$solde['solde'].'" style="text-align:right"') .
485 td(findSide($solde['debit'] - $solde['credit']), 'style="text-align:right"'), $class
486 );
487
488
489
490 }
491 echo '<tfoot>';
492 echo tr(
493 td('').
494 td(_('Totaux')).
495 td('').
496 td(nbm($sum_deb), 'style="text-align:right"').
497 td(nbm($sum_cred), 'style="text-align:right"').
498 td(nbm(abs($sum_solde)), 'style="text-align:right"').
499 td(findSide($sum_deb - $sum_cred) , 'style="text-align:right"'),
500 ' class="highlight"');
501 echo '</tfoot>';
502 echo '</table>';
503 }
504 if ( $allcard == 0 ) echo $str_add_card;
505 echo $export_pdf;
506 echo $export_csv;
507 echo $export_print;
508
509 return;
510}
511
512/***********************************************************************************************************************************
513 * Lettering
514 *
515 **********************************************************************************************************************************/
516// all card
517if ($allcard == 1)
518{
519 $afiche = $cn->get_array("select fd_id from vw_fiche_def where ad_id=" . ATTR_DEF_ACCOUNT . " order by fd_label asc");
520}
521else
522{
523
524 $p_cat=$http->request("cat","number");
525 $afiche[0] = array('fd_id' => $p_cat);
526}
527if ( $allcard == 0) echo $str_add_card;
528echo $export_csv;
529echo $export_pdf;
530echo $export_print;
532$histo=$http->get("histo","number");
534$clean_lettering->remove_incoherent();
535
536for ($e = 0; $e < count($afiche); $e++)
537{
538 $array = Fiche::get_fiche_def($cn, $afiche[$e]['fd_id'], 'name_asc');
539
540 foreach ($array as $card)
541 {
542 $row = new Fiche($cn, $card['f_id']);
544 $letter->set_parameter('quick_code', $row->get_attribute(ATTR_DEF_QUICKCODE));
545 $letter->set_parameter('start', $periode_start->value );
546 $letter->set_parameter('end', $periode_end->value );
547 // all
548 if ($histo== 0)
549 {
550 $letter->get_all();
551 }
552
553 // lettered
554 if ($histo == 1)
555 {
556 $letter->get_letter();
557 }
558 // unlettered
559 if ($histo == 2)
560 {
561 $letter->get_unletter();
562 }
563 if ($histo== 6)
564 {
565 $letter->get_letter_diff();
566 }
567 /* skip if nothing to display */
568 if (count($letter->content) == 0)
569 continue;
570 $detail_card = HtmlInput::card_detail($row->get_attribute(ATTR_DEF_QUICKCODE), $row->get_attribute(ATTR_DEF_NAME));
571
572 echo '<h2 class="h-section">' . $detail_card ;
573 echo "poste "
574 . ":".HtmlInput::history_account($row->get_attribute(ATTR_DEF_ACCOUNT),$row->get_attribute(ATTR_DEF_ACCOUNT),'display:inline').Icon_Action::infobulle(27).'</h2>';
575
576 echo '<table class="result">';
577 echo '<tr>';
578 echo th(_('Date'));
579 echo th(_('ref'));
580 echo th(_('Interne'));
581 echo th(_('Comm'));
582 echo th(_('Code Devise'));
583 echo th(_('Devise'),'style="text-align:right"');
584 echo th(_('Débit'), 'style="width:auto;text-align:right" ');
585 echo th(_('Crédit'), 'style="width:auto;text-align:right" ');
586 echo th(_('Prog.'),'style="text-align:right"');
587 echo th(_('Let.'));
588 echo '</tr>';
589 $amount_deb = 0;
590 $amount_cred = 0;
591 $prog = 0;
592 bcscale(2);
593 for ($i = 0; $i < count($letter->content); $i++)
594 {
595 $row = $letter->content[$i];
596 $html_letter="";
597 if ($row['letter']!=-1) {
598 $html_letter=strtoupper(base_convert($row['letter'],10,36));
599 }
600 if ($i % 2 == 0)
601 echo '<tr class="even" name="tr_'.$html_letter.'_">';
602 else
603 echo '<tr class="odd" name="tr_'.$html_letter.'_">';
604
605 echo td($row['j_date_fmt']);
606 echo td(h($row['jr_pj_number']));
607 echo td(HtmlInput::detail_op($row['jr_id'], $row['jr_internal']));
608 echo td(h($row['jr_comment']));
609 echo td($row['cr_code_iso']);
610 $str_currency_amount=($row['currency_id']==0)?"":nbm($row['currency_amount'],2);
611
612 echo td($str_currency_amount,'class="num"');
613 if ($row['j_debit'] == 't')
614 {
615 echo td(nbm($row['j_montant']), ' style="text-align:right"');
616 $amount_deb=bcadd($amount_deb,$row['j_montant']);
617 $prog = bcadd($prog, $row['j_montant']);
618 echo td("");
619 }
620 else
621 {
622 echo td("");
623 echo td(nbm($row['j_montant']), ' style="text-align:right"');
624 $amount_cred=bcadd($amount_cred,$row['j_montant']);
625 $prog = bcsub($prog, $row['j_montant']);
626 }
627 $side = "&nbsp;" . $fiche->get_amount_side($prog);
628 echo td(nbm(abs($prog)) . $side, 'style="text-align:right"');
629 $html_let="";
630 if ($row['letter']!=-1) {
631 $span_error = "";
632 if ($row['letter_diff'] != 0)
633 $span_error = $g_failed;
634 echo '<td>'.HtmlInput::show_reconcile("", $html_letter,$span_error).'</td>';
635 }
636 else
637 echo td('');
638 echo '</tr>';
639 }
640 echo '</table>';
641 echo '<table>';
642 echo '<tr>';
643 echo td(_('Debit'));
644 echo td(nbm($amount_deb), ' style="font-weight:bold;text-align:right"');
645 echo '</tr>';
646 echo '<tr>';
647 echo td(_('Credit'));
648 echo td(nbm($amount_cred), ' style="font-weight:bold;text-align:right"');
649 echo '</tr>';
650 echo '<tr class="highlight">';
651 $solde=abs(round($amount_cred - $amount_deb, 2));
652 if ( $solde == 0)
653 {
654 $s=_('solde');
655 }
656 else if ($amount_deb > $amount_cred)
657 $s = _('solde débiteur');
658 else
659 $s = _('solde crediteur');
660 echo td($s);
661 echo td(nbm($solde), ' style="font-weight:bold;text-align:right"');
662 echo '</tr>';
663 echo '</table>';
664 }
665}
666if ( $allcard == 0) echo $str_add_card;
667echo $export_csv;
668echo $export_pdf;
669echo $export_print;
670?>
671
h2($p_string, $p_class="", $raw="")
Definition ac_common.php:68
th($p_string, $p_extra='', $raw='')
Definition ac_common.php:58
findSide($p_number)
return D if the number is smaller than 0 , C if bigger and an empty string if equal to 0.
isDate($p_date)
Verifie qu'une date est bien formaté en d.m.y et est valable.
h1($p_string, $p_class="")
Definition ac_common.php:72
NoAccess($js=1)
Echo no access and stop.
tr($p_string, $p_extra='')
Definition ac_common.php:88
sql_string($p_string)
Fix the problem with the quote char for the database.
td($p_string='', $p_extra='')
surround the string with td
Definition ac_common.php:83
nbm($p_number, $p_dec=2)
format the number with a sep.
alert($p_msg, $buffer=false)
alert in javascript
global $g_user
if no group available , then stop
h( $row[ 'oa_description'])
catch(Exception $e) $exercice
$clean_lettering
$_REQUEST['ac']
if(isset( $_REQUEST[ 'show'])) if(isset($_REQUEST['del'])) $ac
if(! empty( $error)) for($i=0;$i< count($error);$i++)( $last !=$error[$i]) $last
_("actif, passif,charge,...")
$_GET['qcode']
$fiche_def
$class
Display the Plugin and for each profile were it is installed or not.
compute the ageing balance, currently this code is not used
static fetch_array($ret, $p_indice=0, $p_mode=PGSQL_ASSOC)
wrapper for the function pg_fetch_array
static num_row($ret)
wrapper for the function pg_num_rows
define Class fiche and fiche def, those class are using class attribut
define Class fiche and fiche def, those class are using class attribut. When adding or modifing new c...
static get_fiche_def($p_cn, $card_category_id, $p_order='', $inactive=1)
get all the card from a categorie
static request_to_hidden(array $array)
transform $_REQUEST data to hidden
static card_detail($p_qcode, $pname='', $p_style="", $p_nohistory=false, $nofollowup=false)
show the detail of a card
static hidden($p_name, $p_value, $p_id="")
static submit($p_name, $p_value, $p_javascript="", $p_class="smallbutton")
manage the http input (get , post, request) and extract from an array
Html Input.
Html Input.
Html Input : Input a date format dd.mm.yyyy The property title should be set to indicate what it is e...
Html Input.
Html Input , create a tag <SELECT> ... </SELECT> if readonly == true then display the label correspon...
static infobulle($p_comment)
Display a info in a bubble, text is in message_javascript.
only for operation retrieved thanks a quick_code manage the accounting entries for a given card
mother class for the lettering by account and by card use the tables jnt_letter, letter_deb and lette...
global $g_failed
const ATTR_DEF_NAME
Definition constant.php:223
const ATTR_DEF_QUICKCODE
Definition constant.php:244
const ATTR_DEF_ACCOUNT
Definition constant.php:222
const FICADD
$_POST['ac']
Definition do.php:323
$str_categorie
Definition fiche.inc.php:42
$str_icall
Definition fiche.inc.php:49
$icall
Definition fiche.inc.php:46
$phisto
$str_end
Definition fiche.inc.php:71
$str_start
Definition fiche.inc.php:70
$periode_start
Definition fiche.inc.php:60
$str_add_card
$export_print
$h_add_card_b
$afiche[0]
$str_histo
Definition fiche.inc.php:94
$iperiode
Definition fiche.inc.php:53
$str_inactive
Definition fiche.inc.php:99
$categorie
Show first the form.
Definition fiche.inc.php:37
$export_pdf
$fd_id
$periode_end
Definition fiche.inc.php:61
create_script($p_string)
create the HTML for adding the script tags around of the script
catch(\Exception $e) $bar
$amount_cred
Definition letter_all.php:6
$amount_deb
Definition letter_all.php:6
if( $delta< 0) elseif( $delta==0)
$side
navigation_bar($p_offset, $p_line, $p_size=0, $p_page=1, $p_javascript="")
Create a navigation_bar (pagesize)