noalyss Version-9
NOALYSS : serveur de comptabilité et ERP (2002)
Loading...
Searching...
No Matches
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)
 
 filter_cat ($p_array)
 set the $this->jrn to the cat, filter the ledger thanks the type (key in the array)
 
 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.
 
 summary_display ($p_array)
 Display the summary of result in HTML.
 
 summary_display_pdf ($p_array, $p_pdf)
 Display the summary of result in PDF.
 
 summary_init ()
 create an empty array for computing the summary
 

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 305 of file acc_balance.class.php.

306 {
307 if ( empty($p_array) )
308 {
309 $this->jrn=null;
310 return;
311 }
312 /* get the list of jrn of the cat. */
313
315 $this->jrn=array();
316 for ($e=0;$e<count($array);$e++)
317 {
318 if ( isset($p_array[$e]))
319 {
320 $t_a=$this->db->get_array('select jrn_def_id from jrn_def where jrn_def_type=$1',array($array[$e]['cat']));
321 for ( $f=0;$f < count($t_a);$f++) $this->jrn[]=$t_a[$f]['jrn_def_id'];
322 }
323 }
324
325 }
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(), db, 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 348 of file acc_balance.class.php.

349 {
350 if (trim($p_accounting)=="") return $p_array;
351 // Summary
352 $first_digit=trim($p_accounting);
353 $first_digit_trim=$first_digit[0];
354 if ( $first_digit_trim >0 && $first_digit_trim < 6) {
355 $p_array["1_5"]["deb"]=bcadd( $p_array["1_5"]["deb"],$p_deb);
356 $p_array["1_5"]["cred"]=bcadd( $p_array["1_5"]["cred"],$p_cred);
357 }
358 elseif ($first_digit_trim == "6") {
359 $p_array["6"]["deb"]=bcadd( $p_array["6"]["deb"],$p_deb);
360 $p_array["6"]["cred"]=bcadd( $p_array["6"]["cred"],$p_cred);
361 }
362 elseif ($first_digit_trim=="7") {
363 $p_array["7"]["deb"]=bcadd( $p_array["7"]["deb"],$p_deb);
364 $p_array["7"]["cred"]=bcadd( $p_array["7"]["cred"],$p_cred);
365
366 }
367 return $p_array;
368 }
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 374 of file acc_balance.class.php.

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

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

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 329 of file acc_balance.class.php.

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

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: