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

concerns the predefined operation for FIN ledger More...

Inheritance diagram for Pre_op_fin:
Pre_operation_detail

Public Member Functions

 __construct ($cn)
 compute_array ()
 compute an array accordingly with the FormVenView function
 get_post ()
 load ()
 load the data from the database and return an array
 save ()
 save the detail and op in the database
 set_od_id ($p_id)

Data Fields

 $op

Detailed Description

concerns the predefined operation for FIN ledger

Definition at line 30 of file class_pre_op_fin.php.


Constructor & Destructor Documentation

Definition at line 33 of file class_pre_op_fin.php.

References $cn.

    {
        parent::__construct($cn);
        $this->operation->od_direct='f';
    }

Member Function Documentation

compute an array accordingly with the FormVenView function

Definition at line 96 of file class_pre_op_fin.php.

References $array, $count, $p_array, $row, and load().

    {
        $count=0;
        $a_op=$this->operation->load();
        $array=$this->operation->compute_array($a_op);
        $p_array=$this->load();
        foreach ($p_array as $row)
        {
            if ( $row['opd_debit']=='t')
            {
                $array+=array('e_bank_account'=>$row['opd_poste']);
            }
            else
            {
                $array+=array("e_other".$count=>$row['opd_poste'],
                              "e_other".$count."_amount"=>$row['opd_amount'],
                              "e_other".$count."_comment"=>$row['opd_comment']
                             );
                $count++;
            }
        }
        return $array;
    }

Reimplemented from Pre_operation_detail.

Definition at line 39 of file class_pre_op_fin.php.

    {
        parent::get_post();
        $this->operation->od_direct='f';
        $this->e_bank_account=$_POST['e_bank_account'];
        for ($i=0;$i<$this->operation->nb_item;$i++)
        {
            $this->{"e_other".$i}=$_POST['e_other'.$i];
            $this->{"e_other".$i."_comment"}=$_POST['e_other'.$i.'_comment'];
            $this->{"e_other".$i."_amount"}=$_POST['e_other'.$i."_amount"];
        }
    }

load the data from the database and return an array

Returns:
an array

Definition at line 122 of file class_pre_op_fin.php.

References $array, $res, $sql, db, and Database\fetch_all().

Referenced by compute_array().

    {
        $sql="select opd_id,opd_poste,opd_amount,opd_comment,opd_debit".
             " from op_predef_detail where od_id=".$this->operation->od_id.
             " order by opd_id";
        $res=$this->db->exec_sql($sql);
        $array=Database::fetch_all($res);
        return $array;
    }

save the detail and op in the database

Definition at line 55 of file class_pre_op_fin.php.

References $e, $sql, db, echo, and false.

    {
        try
        {
            $this->db->start();
            if ($this->operation->save() == false )
                return;
            // save the client
            $sql=sprintf('insert into op_predef_detail (od_id,opd_poste,opd_debit)'.
                         ' values '.
                         "(%d,'%s','%s')",
                         $this->operation->od_id,
                         $this->e_bank_account,
                         "t");
            $this->db->exec_sql($sql);
            // save the selling
            for ($i=0;$i<$this->operation->nb_item;$i++)
            {
                $sql=sprintf('insert into op_predef_detail (opd_poste,'.
                             'opd_amount,opd_comment,'.
                             'opd_debit,od_id)'.
                             ' values '.
                             "('%s',%.2f,'%s','%s',%d)",
                             $this->{"e_other".$i},
                             $this->{"e_other".$i."_amount"},
                             $this->{"e_other".$i."_comment"},
                             'f',
                             $this->operation->od_id
                            );
                $this->db->exec_sql($sql);
            }
        }
        catch (Exception $e)
        {
            echo ($e->getMessage());
            $this->db->rollback();
        }

    }
Pre_op_fin::set_od_id ( p_id)

Definition at line 131 of file class_pre_op_fin.php.

    {
        $this->operation->od_id=$p_id;
    }

Field Documentation

Pre_op_fin::$op

Definition at line 32 of file class_pre_op_fin.php.


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