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

Manage the additionnal info for operation (from jrn), when an invoice is generated, the order or other info are going to be stored and used in the detail. this class maps the table jrn_info. More...

Public Member Functions

 __construct ($p_cn, $p_ji_id=0)
 count ()
 from_array ($p_array)
 insert ()
 load ()
 load_all ()
 load all the jrn_info thanks the jr_id
 save_extra ($p_jr_id, $p_array)
 save all extra information in once, called by compta_ven and compta_ach
 search_id_internal ($p_internal)
 set_id ($p_ji_id)
 set_jrn_id ($p_id)
 set_type ($p_id)
 set_value ($p_id)
 update ()

Static Public Member Functions

static test_me ()

Data Fields

 $cn
 $id_type
 $ji_id
 $ji_value
 $jr_id

Detailed Description

Manage the additionnal info for operation (from jrn), when an invoice is generated, the order or other info are going to be stored and used in the detail. this class maps the table jrn_info.

Definition at line 34 of file class_acc_ledger_info.php.


Constructor & Destructor Documentation

Acc_Ledger_Info::__construct ( p_cn,
p_ji_id = 0 
)

Definition at line 41 of file class_acc_ledger_info.php.

References cn.

    {
        $this->cn=$p_cn;
        $this->ji_id=$p_ji_id;
    }

Member Function Documentation

Definition at line 157 of file class_acc_ledger_info.php.

References $sql, and cn.

    {
        $sql="select ji_id from jrn_info where jr_id=".$this->jr_id;
        return $this->cn->count_sql($sql);
    }

Definition at line 108 of file class_acc_ledger_info.php.

References $p_array, and $value.

Referenced by load().

    {
        foreach ($p_array as $col=>$value)
        {
            $this->$col=$value;
        }
    }

Definition at line 46 of file class_acc_ledger_info.php.

References $e, $sql, cn, echo, exit, Database\fetch_result(), and jr_id.

Referenced by save_extra().

    {
        if ( ! isset ($this->jr_id) ||
                ! isset ($this->ji_value) ||
                ! isset ($this->id_type ) )
        {
            echo 'Appel incorrecte '.__FILE__.__LINE__;
            var_dump($this);
            exit();
        }
        try
        {
            $sql=$this->cn->exec_sql('insert into jrn_info(jr_id,id_type,ji_value) values ($1,$2,$3)'.
                                     ' returning ji_id ',
                                     array ($this->jr_id,$this->id_type,$this->ji_value)
                                    );
            $this->ji_id=Database::fetch_result($sql,0,0);
        }
        catch (Exception $e)
        {
            echo "Echec sauvegarde info additionnelles";
            throw $e;
        }
    }

Definition at line 93 of file class_acc_ledger_info.php.

References $r, $sql, cn, Database\fetch_array(), from_array(), and Database\num_row().

    {
        $sql="select jr_id,id_type,ji_value from jrn_info where ji_id=".$this->ji_id;
        $r=$this->cn->exec_sql($sql);
        if (Database::num_row ($r) > 0 )
        {
            $this->from_array(Database::fetch_array($r,0));
            return 0;
        }
        else
        {
            return 1;
        }

    }

load all the jrn_info thanks the jr_id

Returns:
an array of object

Definition at line 134 of file class_acc_ledger_info.php.

References $array, $r, $ret, $row, $sql, cn, echo, exit, Database\fetch_all(), jr_id, and Database\num_row().

    {
        if ( ! isset ($this->jr_id) )
        {
            echo "jr_id is not set ".__FILE__.__LINE__;
            exit();
        }

        $sql="select ji_id from jrn_info where jr_id=".$this->jr_id;
        $r=$this->cn->exec_sql($sql);
        if (Database::num_row($r) == 0 )
            return array();
        $array=Database::fetch_all($r);
        $ret=array();
        foreach ($array as $row)
        {
            $o=new Acc_Ledger_Info($this->cn,$row['ji_id']);
            $o->load();
            $ret[]=clone $o;
        }
        return $ret;

    }
Acc_Ledger_Info::save_extra ( p_jr_id,
p_array 
)

save all extra information in once, called by compta_ven and compta_ach

Parameters:
$p_jr_idis the jrn.jr_id concerned,
$p_arrayis the array with the data usually it is $_POST
Note:
will change this->jr_id
See also:
compta_ven.inc.php compta_ach.inc.php

Definition at line 184 of file class_acc_ledger_info.php.

References $p_array, insert(), jr_id, set_type(), set_value(), and trim().

    {
        $this->jr_id=$p_jr_id;
        if (strlen(trim($p_array['bon_comm'] )) != 0 )
        {
            $this->set_type('BON_COMMANDE');
            $this->set_value($p_array['bon_comm']);
            $this->insert();
        }
        if (strlen(trim($p_array['other_info'] )) != 0 )
        {
            $this->set_type('OTHER');
            $this->set_value($p_array['other_info']);
            $this->insert();
        }
    }

Definition at line 162 of file class_acc_ledger_info.php.

References $r, $sql, cn, Database\fetch_result(), jr_id, and Database\num_row().

    {
        $sql="select jr_id from jrn where jr_internal='$p_internal'";
        $r=$this->cn->exec_sql($sql);
        if (Database::num_row($r) > 0 )
        {
            $this->jr_id=Database::fetch_result($r,0,0);
            return $this->jr_id;
        }
        else
        {
            $this->jr_id=-1;
            return $this->jr_id;
        }
    }
Acc_Ledger_Info::set_id ( p_ji_id)

Definition at line 115 of file class_acc_ledger_info.php.

References $ji_id.

    {
        $this->$ji_id=$p_ji_id;
    }

Definition at line 119 of file class_acc_ledger_info.php.

References jr_id.

    {
        $this->jr_id=$p_id;
    }

Definition at line 123 of file class_acc_ledger_info.php.

Referenced by save_extra().

    {
        $this->id_type=$p_id;
    }

Definition at line 127 of file class_acc_ledger_info.php.

Referenced by save_extra().

    {
        $this->ji_value=$p_id;
    }
static Acc_Ledger_Info::test_me ( ) [static]

Definition at line 200 of file class_acc_ledger_info.php.

References $a, $cn, echo, and Dossier\id().

    {
        echo "Dossier = ".Dossier::id();
        $cn=new Database(Dossier::id());
        $a=new Acc_Ledger_Info($cn);
        $a->jr_id=3;
        $a->id_type='BON_COMMANDE';
        $a->ji_value='BON';
        var_dump($a);
        $a->insert();

        $a->set_jrn_id(7);
        $a->set_type('OTHER');
        $a->set_value('Autre test');
        $a->insert();
    }

Definition at line 70 of file class_acc_ledger_info.php.

References $e, $sql, cn, echo, exit, and jr_id.

    {
        if ( ! isset ($this->jr_id) ||
                ! isset ($this->ji_value) ||
                ! isset ($this->jr_id ) )
        {
            echo 'Appel incorrecte '.__FILE__.__LINE__;
            var_dump($this);
            exit();
        }
        try
        {
            $sql=$this->exec_sql('update jrn_info set jr_id=$1 ,id_type=$2,ji_value=$3 where ji_id=$4)'.
                                 array ($this->jr_id,$this->id_type,$this->ji_value,$this->ji_id)
                                );
        }
        catch (Exception $e)
        {
            $this->cn->rollback();
            echo "Echec sauvegarde info additionnelles";
            throw $e;
        }
    }

Field Documentation

Acc_Ledger_Info::$cn

connection

Definition at line 36 of file class_acc_ledger_info.php.

Referenced by test_me().

Acc_Ledger_Info::$id_type

type id

Definition at line 38 of file class_acc_ledger_info.php.

Acc_Ledger_Info::$ji_id

primary key

Definition at line 37 of file class_acc_ledger_info.php.

Referenced by set_id().

Acc_Ledger_Info::$ji_value

value for this

Definition at line 40 of file class_acc_ledger_info.php.

Acc_Ledger_Info::$jr_id

primary key of the table jrn

Definition at line 39 of file class_acc_ledger_info.php.


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