noalyss Version-9
Public Member Functions | Data Fields
Acc_Balance Class Reference

Class for manipulating data to print the balance of account. More...

+ Collaboration diagram for Acc_Balance:

Public Member Functions

 __construct ($p_cn)
 = 0) More...
 
 filter_cat ($p_array)
 set the $this->jrn to the cat, filter the ledger thanks the type (key in the array) More...
 
 summary_add ($p_array, $p_accounting, $p_deb, $p_cred)
 Add the current amount (d /c) to the right item in the array, in order to compute a summary (1 to 5 , 6 charge and 7 profit ), the return value is an array. More...
 
 summary_display ($p_array)
 Display the summary of result in HTML. More...
 
 summary_display_pdf ($p_array, $p_pdf)
 Display the summary of result in PDF. More...
 
 summary_init ()
 create an empty array for computing the summary More...
 

Data Fields

 $db
 
 $from_poste
 
 $jrn
 
 $row
 
 $to_poste
 
 $unsold
 

Detailed Description

Class for manipulating data to print the balance of account.

Definition at line 27 of file acc_balance.class.php.

Constructor & Destructor Documentation

◆ __construct()

Acc_Balance::__construct (   $p_cn)

= 0)

Definition at line 35 of file acc_balance.class.php.

36 {
37 $this->db=$p_cn;
38 $this->jrn=array();
39 $this->from_poste="";
40 $this->to_poste="";
41 $this->unsold=false;
42 }
$anc_grandlivre from_poste
$anc_grandlivre to_poste
$bal jrn
$SecUser db

References db, from_poste, jrn, and to_poste.

Member Function Documentation

◆ filter_cat()

Acc_Balance::filter_cat (   $p_array)

set the $this->jrn to the cat, filter the ledger thanks the type (key in the array)

Parameters
arrayof integer 0->Sale,1->Purchase,2->Financial,3->ODS
See also
Acc_Ledgger::array_cat

Definition at line 304 of file acc_balance.class.php.

305 {
306 if ( empty($p_array) )
307 {
308 $this->jrn=null;
309 return;
310 }
311 /* get the list of jrn of the cat. */
312
314 $this->jrn=array();
315 for ($e=0;$e<count($array);$e++)
316 {
317 if ( isset($p_array[$e]))
318 {
319 $t_a=$this->db->get_array('select jrn_def_id from jrn_def where jrn_def_type=$1',array($array[$e]['cat']));
320 for ( $f=0;$f < count($t_a);$f++) $this->jrn[]=$t_a[$f]['jrn_def_id'];
321 }
322 }
323
324 }
static array_cat()
create an array of the existing cat, to be used in a checkbox form

References $array, $e, $f, $p_array, Acc_Ledger\array_cat(), and jrn.

+ Here is the call graph for this function:

◆ summary_add()

Acc_Balance::summary_add (   $p_array,
  $p_accounting,
  $p_deb,
  $p_cred 
)

Add the current amount (d /c) to the right item in the array, in order to compute a summary (1 to 5 , 6 charge and 7 profit ), the return value is an array.

See also
Acc_Balance::summary_init()
Parameters
array$p_arrayarray with the result
string$p_accountingaccounting
numeric$p_deb
numeric$p_cred
Returns
array

Definition at line 347 of file acc_balance.class.php.

348 {
349 if (trim($p_accounting)=="") return $p_array;
350 // Summary
351 $first_digit=trim($p_accounting);
352 $first_digit_trim=$first_digit[0];
353 if ( $first_digit_trim >0 && $first_digit_trim < 6) {
354 $p_array["1_5"]["deb"]=bcadd( $p_array["1_5"]["deb"],$p_deb);
355 $p_array["1_5"]["cred"]=bcadd( $p_array["1_5"]["cred"],$p_cred);
356 }
357 elseif ($first_digit_trim == "6") {
358 $p_array["6"]["deb"]=bcadd( $p_array["6"]["deb"],$p_deb);
359 $p_array["6"]["cred"]=bcadd( $p_array["6"]["cred"],$p_cred);
360 }
361 elseif ($first_digit_trim=="7") {
362 $p_array["7"]["deb"]=bcadd( $p_array["7"]["deb"],$p_deb);
363 $p_array["7"]["cred"]=bcadd( $p_array["7"]["cred"],$p_cred);
364
365 }
366 return $p_array;
367 }
if( $delta< 0) elseif( $delta==0)

References $p_array, and elseif.

◆ summary_display()

Acc_Balance::summary_display (   $p_array)

Display the summary of result in HTML.

See also
Acc_Balance::summary_init()
Parameters
array$p_array

Definition at line 373 of file acc_balance.class.php.

374 {
375 echo "<table>";
376 echo "<tr>";
377 echo td(_("Class 1-5"));
378 $diff=bcsub($p_array["1_5"]["deb"],$p_array["1_5"]["cred"]);
379 echo td(nbm(abs($diff),2),' class="num"');
380 $side=($diff < 0)?"C":"D";
381 $side=($diff == 0)?"=":$side;
382 echo td($side);
383 echo "</tr>";
384 echo "<tr>";
385 echo td(_("Class 6"));
386 $diff6=bcsub($p_array["6"]["deb"],$p_array["6"]["cred"]);
387 echo td(nbm(abs($diff6),2),' class="num"');
388 $side=($diff6 < 0)?"C":"D";
389 $side=($diff6 == 0)?"=":$side;
390 echo td($side);
391 echo "</tr>";
392 echo "<tr>";
393 echo td(_("Class 7"));
394 $diff7=bcsub($p_array["7"]["deb"],$p_array["7"]["cred"]);
395 echo td(nbm(abs($diff7),2),' class="num"');
396 $side=($diff7 < 0)?"C":"D";
397 $side=($diff7 == 0)?"=":$side;
398 echo td($side);
399 echo "</tr>";
400 echo "<tr>";
401 echo td(_("Solde 6/7"));
402 $diff=bcadd($diff6,$diff7);
403 echo td(nbm(abs($diff),2),' class="num"');
404 $side=($diff < 0)?"C":"D";
405 $side=($diff == 0)?"=":$side;
406 echo td($side);
407 echo "</tr>";
408 echo "</table>";
409 }
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.
Definition: ac_common.php:137
$side

References $diff, $p_array, $side, nbm(), and td().

+ Here is the call graph for this function:

◆ summary_display_pdf()

Acc_Balance::summary_display_pdf (   $p_array,
  $p_pdf 
)

Display the summary of result in PDF.

Parameters
array$p_array
PDF$p_pdf
See also
Acc_Balance::summary_init()

Definition at line 416 of file acc_balance.class.php.

417 {
418 $p_pdf->write_cell(30,6,_("Class 1-5"));
419 $diff=bcsub($p_array["1_5"]["deb"],$p_array["1_5"]["cred"]);
420 $p_pdf->write_cell(50,6,
421 nbm(abs($diff),2),0,0,'R');
422 $side=($diff < 0)?"C":"D";
423 $side=($diff == 0)?"=":$side;
424 $p_pdf->write_cell(10,6,$side);
425 $p_pdf->line_new();
426
427 $p_pdf->write_cell(30,6,_("Class 6"));
428 $diff6=bcsub($p_array["6"]["deb"],$p_array["6"]["cred"]);
429 $p_pdf->write_cell(50,6,nbm(abs($diff6),2),0,0,'R');
430 $side=($diff6 < 0)?"C":"D";
431 $side=($diff6 == 0)?"=":$side;
432 $p_pdf->write_cell(10,6,$side);
433 $p_pdf->line_new();
434
435 $p_pdf->write_cell(30,6,_("Class 7"));
436 $diff7=bcsub($p_array["7"]["deb"],$p_array["7"]["cred"]);
437 $p_pdf->write_cell(50,6,nbm(abs($diff7),2),0,0,'R');
438 $side=($diff7 < 0)?"C":"D";
439 $side=($diff7 == 0)?"=":$side;
440 $p_pdf->write_cell(10,6,$side);
441 $p_pdf->line_new();
442
443 $p_pdf->write_cell(30,6,_("Solde 6/7"));
444 $diff=bcadd($diff6,$diff7);
445 $p_pdf->write_cell(50,6,nbm(abs($diff),2),0,0,'R');
446 $side=($diff < 0)?"C":"D";
447 $side=($diff == 0)?"=":$side;
448 $p_pdf->write_cell(10,6,$side);
449 $p_pdf->line_new();
450 }

References $diff, $p_array, $side, and nbm().

+ Here is the call graph for this function:

◆ summary_init()

Acc_Balance::summary_init ( )

create an empty array for computing the summary

Definition at line 328 of file acc_balance.class.php.

329 {
330 $array=[];
331 $array["1_5"]=["deb"=>0,"cred"=>0];
332 $array["6"]=["deb"=>0,"cred"=>0];
333 $array["7"]=["deb"=>0,"cred"=>0];
334 return $array;
335 }

References $array.

Field Documentation

◆ $db

Acc_Balance::$db

Definition at line 29 of file acc_balance.class.php.

◆ $from_poste

Acc_Balance::$from_poste

from_poste filter on the post

Definition at line 32 of file acc_balance.class.php.

◆ $jrn

Acc_Balance::$jrn

< row for ledger idx of a table of ledger create by user->get_ledger

Definition at line 31 of file acc_balance.class.php.

◆ $row

Acc_Balance::$row

< database connection

Definition at line 30 of file acc_balance.class.php.

◆ $to_poste

Acc_Balance::$to_poste

to_poste filter on the post

Definition at line 33 of file acc_balance.class.php.

◆ $unsold

Acc_Balance::$unsold

Definition at line 34 of file acc_balance.class.php.


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