noalyss  Version-6.7.2
Public Member Functions | Static Public Member Functions | Data Fields | Private Member Functions
Acc_Account_Ledger Class Reference

Manage the account from the table jrn, jrnx or tmp_pcmn. More...

Public Member Functions

 __construct ($p_cn, $p_id)
 belong_ledger ($p_jrn)
 verify that the poste belong to a ledger
 build_sql_account ($p_jrn)
 build a sql statement thanks a array found with get_account_ledger
 do_exist ()
 check if the poste exist in the tmp_pcmn
 find_card ()
 Find the card which is using the current account.
 get ()
 Get all the value for this object from the database the data member are set.
 get_account_ledger ($p_jrn)
 With the id of the ledger, get the col jrn_def_class_deb.
 get_amount_side ($p_amount)
 return the letter C if amount is > 0, D if < 0 or =
 get_name ()
 Return the name of a account it doesn't change any data member.
 get_row ($p_from, $p_to)
 Get data for accounting entry between 2 periode.
 get_row_date ($p_from, $p_to, $let=0, $solded=0)
 Get data for accounting entry between 2 date.
 get_solde ($p_cond=" true ")
 give the balance of an account
 get_solde_detail ($p_cond="")
 give the balance of an account
 HtmlTable ($p_array=null, $let=0, $from_div=0)
 HtmlTable, display a HTML of a poste for the asked period.
 isTVA ()
 isTva tell is a poste is used for VAT
 load ()
 Get all the value for this object from the database the data member are set.

Static Public Member Functions

static HtmlTableHeader ($actiontarget="poste")
 Display HTML Table Header (button)
static test_me ()

Data Fields

 $db
 $id
 $label
 $parent
 $row
 $tot_cred
 $tot_deb

Private Member Functions

 get_row_sql ($Res)
 get the row thanks the resource

Detailed Description

Manage the account from the table jrn, jrnx or tmp_pcmn.

Definition at line 30 of file class_acc_account_ledger.php.


Constructor & Destructor Documentation

Acc_Account_Ledger::__construct ( p_cn,
p_id 
)

Definition at line 39 of file class_acc_account_ledger.php.

References db.

    {
        $this->db=$p_cn;
        $this->id=$p_id;
    }

Member Function Documentation

verify that the poste belong to a ledger

Returns:
0 ok, -1 no

Definition at line 554 of file class_acc_account_ledger.php.

References $max, $sql, db, sql_string(), and trim().

    {
        $filter=$this->db->get_value("select jrn_def_class_cred from jrn_def where jrn_def_id=$p_jrn");
        if ( trim ($filter) == '')
            return 0;

        $valid_cred=explode(" ",$filter);
        $sql="select count(*) as poste from tmp_pcmn where ";
        // Creation query
        $or="";
        $SqlFilter="";
        foreach ( $valid_cred as $item_cred)
        {
            if ( strlen (trim($item_cred)))
            {
                if ( strstr($item_cred,"*") == true )
                {
                    $item_cred=strtr($item_cred,"*","%");
                    $SqlItem="$or pcm_val::text like '".sql_string($item_cred)."'";
                    $or="  or ";
                }
                else
                {
                    $SqlItem="$or pcm_val::text = '".sql_string($item_cred)."' ";
                    $or="  or ";
                }
                $SqlFilter=$SqlFilter.$SqlItem;
            }
        }//foreach
        $sql.=$SqlFilter." and pcm_val::text='".sql_string($this->id)."'";
        $max=$this->db->get_value($sql);
        if ($max > 0 )
            return 0;
        else
            return -1;
    }

build a sql statement thanks a array found with get_account_ledger

Parameters:
$p_jrnjrn_id
Returns:
an emty string if nothing is found or a valid SQL statement like
    pcm_val like ... or pcm_val like ...
Note:
See also:
get_account_ledger

Definition at line 614 of file class_acc_account_ledger.php.

References $array, $sql, get_account_ledger(), and trim().

    {
        $array=$this->get_account_ledger($p_jrn);
        if ( empty($array) ) return "";
        $sql="";
        foreach ( $array as $item_cred)
        {
            if ( strlen (trim($item_cred))>0 )
            {
                if ( strstr($item_cred,"*") == true )
                {
                    $item_cred=strtr($item_cred,"*","%");
                    $sql_tmp=" pcm_val::text like '$item_cred' or";
                }
                else
                {
                    $sql_tmp=" pcm_val::text = '$item_cred' or";
                }
                $sql.=$sql_tmp;
            }
        }//foreach
        /* remove the last or */
        $sql=substr($sql,0,strlen($sql)-2);
        return $sql;
    }

check if the poste exist in the tmp_pcmn

Returns:
the number of line (normally 1 or 0)

Definition at line 191 of file class_acc_account_ledger.php.

References $ret, $sql, db, and Database\num_row().

    {
        $sql="select pcm_val from tmp_pcmn where pcm_val= $1";
        $ret=$this->db->exec_sql($sql,array($this->id));
        return Database::num_row($ret) ;
    }

Find the card which is using the current account.

Returns:
an array of f_id

Definition at line 643 of file class_acc_account_ledger.php.

References $sql, and db.

        {
                $sql="select f_id from fiche_detail where ad_id=$1 and ad_value=$2";
                $account=$this->db->get_array($sql,array(ATTR_DEF_ACCOUNT,$this->id));
                return $account;
        }

Get all the value for this object from the database the data member are set.

Returns:
false if this account doesn't exist otherwise true

Definition at line 217 of file class_acc_account_ledger.php.

References echo, and load().

    {
        echo "OBSOLETE Acc_Account_Ledger->get(), a remplacer par Acc_Account_Ledger->load()";
        return $this->load();
    }

With the id of the ledger, get the col jrn_def_class_deb.

Parameters:
$p_jrnjrn_id
Returns:
array of value, or an empty array if nothing is found
Note:
See also:

Definition at line 596 of file class_acc_account_ledger.php.

References $l, $row, db, and trim().

Referenced by build_sql_account().

    {
        $l=new Acc_Ledger($this->db,$p_jrn);
        $row=$l->get_propertie();
        if ( strlen(trim($row['jrn_def_class_deb'])) == 0 ) return array();
        $valid_account=explode(" ",$row['jrn_def_class_deb']);
        return $valid_account;
    }

return the letter C if amount is > 0, D if < 0 or =

Parameters:
type$p_amount
Returns:
string

Definition at line 439 of file class_acc_account_ledger.php.

                {
                        if ($p_amount == 0)
                                return "=";
                        if ($p_amount < 0)
                                return "C";
                        if ($p_amount > 0)
                                return "D";
                }

Return the name of a account it doesn't change any data member.

Returns:
string with the pcm_lib

Definition at line 172 of file class_acc_account_ledger.php.

References $r, $ret, db, Database\fetch_array(), name, and Database\num_row().

Referenced by HtmlTable().

    {
        $ret=$this->db->exec_sql(
                 "select pcm_lib from tmp_pcmn where
                 pcm_val=$1",array($this->id));
        if ( Database::num_row($ret) != 0)
        {
            $r=Database::fetch_array($ret);
            $this->name=$r['pcm_lib'];
        }
        else
        {
            $this->name="Poste inconnu";
        }
        return $this->name;
    }
Acc_Account_Ledger::get_row ( p_from,
p_to 
)

Get data for accounting entry between 2 periode.

Parameters:
$p_fromperiode from
$p_toend periode
Returns:
double array (j_date,deb_montant,cred_montant,description,jrn_name,j_debit,jr_internal) (tot_deb,tot_credit

Definition at line 83 of file class_acc_account_ledger.php.

References $periode, $Res, db, get_row_sql(), and sql_filter_per().

    {
        $periode=sql_filter_per($this->db,$p_from,$p_to,'p_id','jr_tech_per');

        $Res=$this->db->exec_sql("select distinct j_id,jr_id,to_char(j_date,'DD.MM.YYYY') as j_date_fmt,j_date,".
                                 "case when j_debit='t' then j_montant else 0 end as deb_montant,".
                                 "case when j_debit='f' then j_montant else 0 end as cred_montant,".
                                 " jr_comment as description,jrn_def_name as jrn_name,".
                                 "j_debit, jr_internal,jr_pj_number ".
                                 " from jrnx left join jrn_def on jrn_def_id=j_jrn_def ".
                                 " left join jrn on jr_grpt_id=j_grpt".
                                 " where j_poste=".$this->id." and ".$periode.
                                 " order by j_date");
        return $this->get_row_sql($Res);
    }
Acc_Account_Ledger::get_row_date ( p_from,
p_to,
let = 0,
solded = 0 
)

Get data for accounting entry between 2 date.

Parameters:
$p_fromdate from
$p_toend date
$let0 means all rows, 1 only lettered, 2 only unlettered
$solded0 means all account, 1 means only accounts with a saldo <> 0
Note:
the data are filtered by the access of the current user
Returns:
double array (j_date,deb_montant,cred_montant,description,jrn_name,j_debit,jr_internal) (tot_deb,tot_credit

Definition at line 110 of file class_acc_account_ledger.php.

References $g_user, $r, $Res, $solded, db, and get_row_sql().

Referenced by HtmlTable().

    {
        global $g_user;
        $filter_sql=$g_user->get_ledger_sql('ALL',3);
        $sql_let='';
        switch ($let)
        {
        case 0:
                break;
        case 1:
            $sql_let=' and j_id in (select j_id from letter_cred union select j_id from letter_deb)';
            break;
        case '2':
            $sql_let=' and j_id not in (select j_id from letter_cred union select j_id from letter_deb) ';
            break;
        }
        if ( $solded == 1)
          {
            $filter=str_replace('jrn_def_id','jr_def_id',$filter_sql);
            $bal_sql="select sum(amount_deb) as s_deb,sum(amount_cred) as s_cred, j_poste
                                from                                            (select case when j_debit='t' then j_montant else 0 end as amount_deb,
                                                                case when j_debit='f' then j_montant else 0 end as amount_cred,
                                                                j_poste
                                                                from jrnx join jrn on (j_grpt = jr_grpt_id)
                                                                where
                                                                j_poste=$1 and
                                                                $filter and
                                                                ( to_date($2,'DD.MM.YYYY') <= j_date and
                                  to_date($3,'DD.MM.YYYY') >= j_date  )) as signed_amount
                                                group by j_poste
                                                ";
            $r=$this->db->get_array($bal_sql,array($this->id,$p_from,$p_to));
            if ( $this->db->count() == 0 ) return array();
            if ($r[0]['s_deb']==$r[0]['s_cred']) return array();
          }
        $Res=$this->db->exec_sql("select  jr_id,to_char(j_date,'DD.MM.YYYY') as j_date_fmt,j_date,".
                                 "case when j_debit='t' then j_montant else 0 end as deb_montant,".
                                 "case when j_debit='f' then j_montant else 0 end as cred_montant,".
                                 " case when j_text is null or j_text = '' then jr_comment 
                                   else jr_comment||' '||j_text  end
                as description,jrn_def_name as jrn_name,".
                                 "j_debit, jr_internal,jr_pj_number,
                                                                 coalesce(comptaproc.get_letter_jnt(j_id),-1) as letter ".
                                 ",pcm_lib ".
                                 ",jr_tech_per,p_exercice,jrn_def_name".
                                 " from jrnx left join jrn_def on (jrn_def_id=j_jrn_def )".
                                 " left join jrn on (jr_grpt_id=j_grpt)".
                                 " left join tmp_pcmn on (j_poste=pcm_val)".
                                 " left join parm_periode on (p_id=jr_tech_per) ".
                                 " where j_poste=$1 and ".
                                 " ( to_date($2,'DD.MM.YYYY') <= j_date and ".
                                 "   to_date($3,'DD.MM.YYYY') >= j_date )".
                                 " and $filter_sql  $sql_let ".
                                 " order by j_date,substring(jr_pj_number,'[0-9]+$') asc",array($this->id,$p_from,$p_to));
        return $this->get_row_sql($Res);
    }
Acc_Account_Ledger::get_row_sql ( Res) [private]

get the row thanks the resource

Returns:
double array (j_date,deb_montant,cred_montant,description,jrn_name,j_debit,jr_internal) (tot_deb,tot_credit)

Definition at line 49 of file class_acc_account_ledger.php.

References $array, $Max, $Res, $tot_cred, $tot_deb, Database\fetch_array(), and Database\num_row().

Referenced by get_row(), and get_row_date().

    {
        $array=array();
        $tot_cred=0.0;
        $tot_deb=0.0;
        $Max=Database::num_row($Res);
        if ( $Max == 0 ) return null;
        for ($i=0;$i<$Max;$i++)
        {
            $array[]=Database::fetch_array($Res,$i);
            if ($array[$i]['j_debit']=='t')
            {
                $tot_deb+=$array[$i]['deb_montant'] ;
            }
            else
            {
                $tot_cred+=$array[$i]['cred_montant'] ;
            }
        }
        $this->row=$array;
        $this->tot_deb=$tot_deb;
        $this->tot_cred=$tot_cred;
        return array($array,$tot_deb,$tot_cred);

    }
Acc_Account_Ledger::get_solde ( p_cond = " true ")

give the balance of an account

Returns:
balance of the account

Definition at line 230 of file class_acc_account_ledger.php.

References $Max, $r, $Res, db, Database\fetch_array(), and Database\num_row().

    {
        $Res=$this->db->exec_sql("select sum(deb) as sum_deb, sum(cred) as sum_cred from
                                 ( select j_poste,
                                 case when j_debit='t' then j_montant else 0 end as deb,
                                 case when j_debit='f' then j_montant else 0 end as cred
                                 from jrnx join tmp_pcmn on j_poste=pcm_val
                                 where
                                 j_poste::text like ('$this->id'::text) and
                                 $p_cond
                                 ) as m  ");
        $Max=Database::num_row($Res);
        if ($Max==0) return 0;
        $r=Database::fetch_array($Res,0);

        return abs($r['sum_deb']-$r['sum_cred']);
    }

give the balance of an account

Returns:
balance of the account

Definition at line 253 of file class_acc_account_ledger.php.

References $Max, $r, $Res, $sql, db, Database\fetch_array(), and Database\num_row().

Referenced by Acc_Ledger_Fin\confirm().

    {

        if ( $p_cond != "") $p_cond=" and ".$p_cond;
        $sql="select sum(deb) as sum_deb, sum(cred) as sum_cred from
             ( select j_poste,
             case when j_debit='t' then j_montant else 0 end as deb,
             case when j_debit='f' then j_montant else 0 end as cred
             from jrnx
             where
             j_poste::text like ('$this->id'::text)
             $p_cond
             ) as m  ";

        $Res=$this->db->exec_sql($sql);
        $Max=Database::num_row($Res);

        if ($Max==0)
        {
            return array('debit'=>0,
                         'credit'=>0,
                         'solde'=>0)     ;
        }
        $r=Database::fetch_array($Res,0);
// if p_start is < p_end the query returns null to avoid any problem
// we set it to 0
        if ($r['sum_deb']=='')
            $r['sum_deb']=0.0;
        if ($r['sum_cred']=='')
            $r['sum_cred']=0.0;

        return array('debit'=>$r['sum_deb'],
                     'credit'=>$r['sum_cred'],
                     'solde'=>abs($r['sum_deb']-$r['sum_cred']));
    }
Acc_Account_Ledger::HtmlTable ( p_array = null,
let = 0,
from_div = 0 
)

HtmlTable, display a HTML of a poste for the asked period.

Parameters:
$p_arrayarray for filter
$letlettering of operation 0
Returns:
-1 if nothing is found otherwise 0

Definition at line 320 of file class_acc_account_ledger.php.

References $_REQUEST, $array, $class, $diff, $from_div, $idx, $op, $p_array, $progress, $rep, $side, $tot_cred, $tot_deb, echo, format_date(), get_name(), get_row_date(), h(), id, name, nbm(), show_reconcile(), td(), and th().

    {
        if ( $p_array==null)$p_array=$_REQUEST;
        $this->get_name();
        list($array,$tot_deb,$tot_cred)=$this->get_row_date( $p_array['from_periode'],
                                                             $p_array['to_periode'],$let
                                                           );

        if ( count($this->row ) == 0 )
            return -1;

        $rep="";

        echo '<h2 class="title">'.$this->id." ".$this->name.'</h2>';
        if ( $from_div == 0)
                        echo "<TABLE class=\"resultfooter\" style=\"border-collapse:separate;margin:1%;width:98%;;border-spacing:0px 5px\">";
                else
                        echo "<TABLE class=\"resultfooter\" style=\"border-collapse:separate;margin:1%;width:98%;;border-spacing:0px 2px\">";
        echo '<tbody>';
        echo "<TR>".
        "<TH style=\"text-align:left\"> Date</TH>".
        "<TH style=\"text-align:left\"> n° de pièce </TH>".
        "<TH style=\"text-align:left\"> Code interne </TH>".
        "<TH style=\"text-align:left\"> Description </TH>".
        "<TH style=\"text-align:right\"> D&eacute;bit  </TH>".
        "<TH style=\"text-align:right\"> Cr&eacute;dit </TH>".
        th('Prog.','style="text-align:right"').
        th('Let.','style="text-align:right"');
        "</TR>"
        ;
        $progress=0;$sum_deb=0;$sum_cred=0;
        bcscale(2);
        $old_exercice="";
        $idx=0;
        foreach ( $this->row as $op )
        {
            $vw_operation = sprintf('<A class="detail" style="text-decoration:underline;color:red" HREF="javascript:modifyOperation(\'%s\',\'%s\')" >%s</A>', $op['jr_id'], dossier::id(), $op['jr_internal']);
            $let = '';
                        $html_let = "";
                        if ($op['letter'] != -1)
                        {
                                $let = strtoupper(base_convert($op['letter'], 10, 36));
                                $html_let = HtmlInput::show_reconcile($from_div, $let);
                        }
                        $tmp_diff=bcsub($op['deb_montant'],$op['cred_montant']);

            /*
             * reset prog. balance to zero if we change of exercice
             */
            if ( $old_exercice != $op['p_exercice'])
              {
                if ( $old_exercice != '')
                  {
                    $progress=bcsub($sum_deb,$sum_cred);
                        $side="&nbsp;".$this->get_amount_side($progress);
                    echo "<TR style=\"font-weight:bold\">".
                      "<TD></TD>".
                      td('').
                      "<TD></TD>".
                      "<TD>Totaux</TD>".
                      "<TD style=\"text-align:right\">".nbm($sum_deb)."</TD>".
                      "<TD style=\"text-align:right\">".nbm($sum_cred)."</TD>".
                      td(nbm(abs($progress)).$side,'style="text-align:right"').
                      td('').
                      "</TR>";
                    $sum_cred=0;
                    $sum_deb=0;
                    $progress=0;

                  }
              }
            $progress=bcadd($progress,$tmp_diff);
                $side="&nbsp;".$this->get_amount_side($progress);
            $sum_cred=bcadd($sum_cred,$op['cred_montant']);
            $sum_deb=bcadd($sum_deb,$op['deb_montant']);
                if ($idx%2 == 0) $class='class="odd"'; else $class=' class="even"';
                $idx++;

            echo "<TR $class name=\"tr_" . $let . "_" . $from_div . "\">" .
                        "<TD>".smaller_date(format_date($op['j_date']))."</TD>".
              td(h($op['jr_pj_number'])).
              "<TD>".$vw_operation."</TD>".
              "<TD>".h($op['description'])."</TD>".
              "<TD style=\"text-align:right\">".nbm($op['deb_montant'])."</TD>".
              "<TD style=\"text-align:right\">".nbm($op['cred_montant'])."</TD>".
              td(nbm(abs($progress)).$side,'style="text-align:right"').

              td($html_let, ' style="color:red;text-align:right"') .
                        "</TR>";
            $old_exercice=$op['p_exercice'];
        }
        echo '<tfoot>';
        $solde_type=($sum_deb>$sum_cred)?"solde débiteur":"solde créditeur";
        $diff=bcsub($sum_deb,$sum_cred);
                $side="&nbsp;".$this->get_amount_side($diff);
        echo "<TR style=\"font-weight:bold\">".
        "<TD >Totaux</TD><td></td>".
        "<TD ></TD>".
        "<TD></TD>".
          "<TD  style=\"text-align:right\">".nbm($sum_deb)."</TD>".
          "<TD  style=\"text-align:right\">".nbm($sum_cred)."</TD>".
          "<TD style=\"text-align:right\">".nbm(abs($diff)).$side."</TD>".

        "</TR>";
        echo   "<tr><TD>$solde_type</TD><td></td>".
          "<TD style=\"text-align:right\">".nbm(abs($diff))."</TD>".
        "</TR>";
        echo '</tfoot>';
        echo '</tbody>';

        echo "</table>";

        return;
    }
static Acc_Account_Ledger::HtmlTableHeader ( actiontarget = "poste") [static]

Display HTML Table Header (button)

Returns:
none

Definition at line 453 of file class_acc_account_ledger.php.

References $_REQUEST, $hid, echo, exit, HtmlInput\hidden(), HtmlInput\print_window(), and HtmlInput\submit().

    {
      switch($actiontarget)
        {
        case 'poste':
          $action_csv='CSV:postedetail';
          $action_pdf='PDF:postedetail';
          break;
        case 'gl_comptes':
          $action_csv='CSV:glcompte';
          $action_pdf='PDF:glcompte';
          break;
        default:
          throw new Exception(" Fonction HtmlTableHeader argument actiontarget invalid");
          exit;
        }
        $hid=new IHidden();

        echo "<table  >";
        echo '<TR>';
        $str_ople=(isset($_REQUEST['ople']))?HtmlInput::hidden('ople',$_REQUEST['ople']):'';
        if ($actiontarget=='poste')
          {
            echo '<TD><form method="GET" ACTION="">'.
              dossier::hidden().
              HtmlInput::submit('bt_other',"Autre poste").
              $hid->input("type","poste").$hid->input('ac',$_REQUEST['ac'])."</form></TD>";
          }


        echo '<TD><form method="GET" ACTION="export.php">'.
        dossier::hidden().
        HtmlInput::submit('bt_pdf',"Export PDF").
        HtmlInput::hidden('act',$action_pdf).
        $hid->input("type","poste").$str_ople.
        $hid->input('p_action','impress').
        $hid->input("from_periode",$_REQUEST['from_periode']).
        $hid->input("to_periode",$_REQUEST['to_periode'])
          ;

        if ( isset($_REQUEST['letter'] )) echo HtmlInput::hidden('letter','2');
        if ( isset($_REQUEST['solded'] )) echo HtmlInput::hidden('solded','1');

        if (isset($_REQUEST['from_poste']))
          echo HtmlInput::hidden('from_poste',$_REQUEST['from_poste']);

        if (isset($_REQUEST['to_poste']))
          echo HtmlInput::hidden('to_poste',$_REQUEST['to_poste']);

        if (isset($_REQUEST['poste_id']))
          echo HtmlInput::hidden("poste_id",$_REQUEST['poste_id']);

        if (isset($_REQUEST['poste_fille']))
            echo $hid->input('poste_fille','on');
        if (isset($_REQUEST['oper_detail']))
            echo $hid->input('oper_detail','on');

        echo "</form></TD>";

        echo '<TD><form method="GET" ACTION="export.php">'.
        dossier::hidden().
        HtmlInput::submit('bt_csv',"Export CSV").
        HtmlInput::hidden('act',$action_csv).
        $hid->input("type","poste").$str_ople.
        $hid->input('p_action','impress').
        $hid->input("from_periode",$_REQUEST['from_periode']).
          $hid->input("to_periode",$_REQUEST['to_periode']);

        if (isset($_REQUEST['from_poste']))
          echo HtmlInput::hidden('from_poste',$_REQUEST['from_poste']);

        if (isset($_REQUEST['to_poste']))
          echo HtmlInput::hidden('to_poste',$_REQUEST['to_poste']);

        if (isset($_REQUEST['poste_id']))
          echo HtmlInput::hidden("poste_id",$_REQUEST['poste_id']);

        if ( isset($_REQUEST['letter'] )) echo HtmlInput::hidden('letter','2');
        if ( isset($_REQUEST['solded'] )) echo HtmlInput::hidden('solded','1');

        if (isset($_REQUEST['poste_fille']))
            echo $hid->input('poste_fille','on');
        if (isset($_REQUEST['oper_detail']))
            echo $hid->input('oper_detail','on');
        if (isset($_REQUEST['poste_id'])) echo $hid->input("poste_id",$_REQUEST['poste_id']);

        echo "</form></TD>";
        echo "</form></TD>";
        echo '<td style="vertical-align:top">';
        echo HtmlInput::print_window();
        echo '</td>';
        echo '</tr>';
        echo "</table>";


    }

isTva tell is a poste is used for VAT

Parameters:
none
Returns:
1 is Yes otherwise 0

Definition at line 295 of file class_acc_account_ledger.php.

References db.

    {
        // Load TVA array
        $a_TVA=$this->db->get_array('select tva_poste
                                    from tva_rate');
        foreach ( $a_TVA as $line_tva)
        {
            if ( $line_tva['tva_poste']  == '' )
                continue;
            list($tva_deb,$tva_cred)=explode(',',$line_tva['tva_poste']);
            if ( $this->id == $tva_deb ||
                    $this->id == $tva_cred )
            {
                return 1;
            }
        }
        return 0;

    }

Get all the value for this object from the database the data member are set.

Returns:
false if this account doesn't exist otherwise true

Definition at line 201 of file class_acc_account_ledger.php.

References $r, $ret, db, Database\fetch_all(), and label.

Referenced by get().

    {
        $ret=$this->db->exec_sql("select pcm_lib,pcm_val_parent from
                                 tmp_pcmn where pcm_val=$1",array($this->id));
        $r=Database::fetch_all($ret);

        if ( ! $r ) return false;
        $this->label=$r[0]['pcm_lib'];
        $this->parent=$r[0]['pcm_val_parent'];
        return true;

    }
static Acc_Account_Ledger::test_me ( ) [static]

Definition at line 649 of file class_acc_account_ledger.php.

References $a, $cn, echo, and id.

    {
        $cn=new Database(dossier::id());
        $a=new Acc_Account_Ledger($cn,550);
        echo ' Journal 4 '.$a->belong_ledger(4);

    }

Field Documentation

Acc_Account_Ledger::$db

$db database connection

Definition at line 32 of file class_acc_account_ledger.php.

Acc_Account_Ledger::$id

$id poste_id (pcm_val)

Definition at line 33 of file class_acc_account_ledger.php.

Acc_Account_Ledger::$label

$label label of the poste

Definition at line 34 of file class_acc_account_ledger.php.

Acc_Account_Ledger::$parent

$parent parent account

Definition at line 35 of file class_acc_account_ledger.php.

Acc_Account_Ledger::$row

$row double array see get_row

Definition at line 36 of file class_acc_account_ledger.php.

Referenced by get_account_ledger().

Acc_Account_Ledger::$tot_cred

value by get_row

Definition at line 38 of file class_acc_account_ledger.php.

Referenced by get_row_sql(), and HtmlTable().

Acc_Account_Ledger::$tot_deb

value set by get_row

Definition at line 37 of file class_acc_account_ledger.php.

Referenced by get_row_sql(), and HtmlTable().


The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Enumerations