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

Manage the table parm_code which contains the custom parameter for the module accountancy. More...

Public Member Functions

 Acc_Parm_Code ($p_cn, $p_id=-1)
 display ()
 Display an object, with the tag.
 form ()
 Display a form to enter info about a parm_code object with the tag.
 load ()
 Complete a parm_code object thanks the p_code.
 load_all ()
 Load all parmCode return an array of Acc_Parm_Code object.
 save ()
 update a parm_object into the database p_code is _not_ updatable

Data Fields

 $db
 $p_code
 $p_comment
 $p_value

Detailed Description

Manage the table parm_code which contains the custom parameter for the module accountancy.

Definition at line 31 of file class_acc_parm_code.php.


Member Function Documentation

Acc_Parm_Code::Acc_Parm_Code ( p_cn,
p_id = -1 
)

Definition at line 38 of file class_acc_parm_code.php.

References db, and load().

Referenced by load_all().

    {
        $this->db=$p_cn;
        $this->p_code=$p_id;
        if ( $p_id != -1 )
            $this->load();
    }

Display an object, with the tag.

Returns:
string

Definition at line 108 of file class_acc_parm_code.php.

References $r.

    {
        $r="";
        $r.= '<TD>'.$this->p_code.'</TD>';
        $r.= '<TD>'.h($this->p_comment).'</TD>';
        $r.= '<TD>'.$this->p_value.'</TD>';

        return $r;
    }

Display a form to enter info about a parm_code object with the tag.

Returns:
string

Definition at line 124 of file class_acc_parm_code.php.

References $comment, $poste, $r, $value, and Dossier\hidden().

    {
        $comment=new IText();
        $comment->name='p_comment';
        $comment->value=$this->p_comment;
        $comment->size=45;
        $value=new IPoste();
        $value->name='p_value';
        $value->value=$this->p_value;
        $value->size=7;
        $value->set_attribute('ipopup','ipop_account');
        $value->set_attribute('account','p_value');
        $poste=new IText();
        $poste->setReadOnly(true);
        $poste->size=strlen($this->p_code)+1;
        $poste->name='p_code';
        $poste->value=$this->p_code;
        $r="";
        $r.='<tr>';
        $r.='<td align="right"> Code </td>';
        $r.= '<TD>'.$poste->input().'</TD>';
        $r.='</tr>';
        $r.='<tr>';
        $r.='<td align="right"> Commentaire </td>';
        $r.= '<TD>'.$comment->input().'</TD>';
        $r.='</tr>';
        $r.='<tr>';
        $r.='<td align="right"> Poste comptable </td>';
        $r.= '<TD>'.$value->input();
        $r.='<span id="p_value_label"></span></td>';
        $r.='</tr>';
        $r.=Dossier::hidden();
        return $r;

    }

Complete a parm_code object thanks the p_code.

Returns:
array

Definition at line 168 of file class_acc_parm_code.php.

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

Referenced by Acc_Parm_Code().

    {
        if ( $this->p_code == -1 ) return "p_code non initialisé";
        $sql='select * from parm_code where p_code=$1 ';

        $Res=$this->db->exec_sql($sql,array($this->p_code));

        if ( Database::num_row($Res) == 0 ) return 'INCONNU';
        $row= Database::fetch_array($Res,0);
        $this->p_value=$row['p_value'];
        $this->p_comment=$row['p_comment'];

    }

Load all parmCode return an array of Acc_Parm_Code object.

Returns:
array

Definition at line 54 of file class_acc_parm_code.php.

References $array, $idx, $r, $Res, $row, $sql, Acc_Parm_Code(), db, and Database\fetch_all().

    {
        $sql="select * from parm_code order by p_code";
        $Res=$this->db->exec_sql($sql);
        $r= Database::fetch_all($Res);
        $idx=0;
        $array=array();

        if ( $r === false ) return null;
        foreach ($r as $row )
        {
            $o=new Acc_Parm_Code($this->db,$row['p_code']);
            $array[$idx]=$o;
            $idx++;
        }

        return $array;
    }

update a parm_object into the database p_code is _not_ updatable

Returns:
nothing

Definition at line 79 of file class_acc_parm_code.php.

References $acc, $Res, $sql, alert(), db, false, and sql_string().

    {
        // if p_code=="" nothing to save
        if ( $this->p_code== -1) return;
        // check if the account exists
        $acc=new Acc_Account_Ledger($this->db,$this->p_value);
        if ( $acc->load() == false )
        {
            alert("Ce compte n'existe pas");
        }
        else
        {
            $this->p_comment=sql_string($this->p_comment);
            $this->p_value=sql_string($this->p_value);
            $this->p_code=sql_string($this->p_code);
            $sql="update parm_code set ".
                 "p_comment='".$this->p_comment."'  ".
                 ",p_value='".$this->p_value."'  ".
                 "where p_code='".$this->p_code."'";
            $Res=$this->db->exec_sql($sql);
        }
    }

Field Documentation

Acc_Parm_Code::$db

$db database connection

Definition at line 33 of file class_acc_parm_code.php.

Acc_Parm_Code::$p_code

$p_code parm_code.p_code primary key

Definition at line 34 of file class_acc_parm_code.php.

Acc_Parm_Code::$p_comment

$p_comment parm_code.p_comment

Definition at line 36 of file class_acc_parm_code.php.

Acc_Parm_Code::$p_value

$p_value parm_code.p_value

Definition at line 35 of file class_acc_parm_code.php.


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