|
noalyss
Version-6.7.2
|
concerns the predefined operation for ODS ledger More...
Public Member Functions | |
| __construct ($cn, $p_id=0) | |
| 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 | |
concerns the predefined operation for ODS ledger
Definition at line 30 of file class_pre_op_ods.php.
| Pre_op_ods::__construct | ( | $ | cn, |
| $ | p_id = 0 |
||
| ) |
Reimplemented from Pre_operation_detail.
Definition at line 33 of file class_pre_op_ods.php.
References $cn.
{
parent::__construct($cn,$p_id);
$this->operation->od_direct='f';
}
compute an array accordingly with the FormVenView function
Definition at line 88 of file class_pre_op_ods.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)
{
$c=($row['opd_debit']=='t')?'d':'c';
$array+=array("e_account".$count=>$row['opd_poste'],
"e_account".$count."_amount"=>$row['opd_amount'],
"e_account".$count."_type"=>$c
);
$count++;
}
return $array;
}
Reimplemented from Pre_operation_detail.
Definition at line 39 of file class_pre_op_ods.php.
{
parent::get_post();
$this->operation->od_direct='f';
for ($i=0;$i<$this->operation->nb_item;$i++)
{
$this->{"e_account".$i}=$_POST['e_account'.$i];
$this->{"e_account".$i."_amount"}=$_POST['e_account'.$i."_amount"];
$this->{"e_account".$i."_type"}=$_POST['e_account'.$i."_type"];
}
}
| Pre_op_ods::load | ( | ) |
load the data from the database and return an array
Definition at line 109 of file class_pre_op_ods.php.
References $array, $res, $sql, db, and Database\fetch_all().
Referenced by compute_array().
| Pre_op_ods::save | ( | ) |
save the detail and op in the database
Definition at line 56 of file class_pre_op_ods.php.
References $e, $sql, db, echo, and false.
{
try
{
$this->db->start();
if ($this->operation->save() == false )
return;
// save the selling
for ($i=0;$i<$this->operation->nb_item;$i++)
{
$sql=sprintf('insert into op_predef_detail (opd_poste,opd_amount,'.
'opd_debit,od_id)'.
' values '.
"('%s',%.2f,'%s',%d)",
$this->{"e_account".$i},
$this->{"e_account".$i."_amount"},
($this->{"e_account".$i."_type"}=='d')?'t':'f',
$this->operation->od_id
);
$this->db->exec_sql($sql);
}
}
catch (Exception $e)
{
echo ($e->getMessage());
$this->db->rollback();
}
}
| Pre_op_ods::set_od_id | ( | $ | p_id | ) |
Definition at line 118 of file class_pre_op_ods.php.
{
$this->operation->od_id=$p_id;
}
| Pre_op_ods::$op |
Definition at line 32 of file class_pre_op_ods.php.