replace GetInternal by Acc_Operation::get_internal

This commit is contained in:
sparkyx 2007-12-19 16:17:58 +00:00
parent 169a9c2606
commit 1da963ffda
4 changed files with 39 additions and 14 deletions

View file

@ -31,6 +31,7 @@ include_once ("postgres.php");
include_once("jrn.php");
require_once("class_widget.php");
require_once("class_acc_ledger.php");
require_once("class_acc_operation.php");
/* Admin. Dossier */
include_once ("class_user.php");
require_once('class_dossier.php');
@ -402,12 +403,11 @@ if ( $a != null ) {
foreach ($a as $key => $element) {
echo "operation concernée <br>";
$operation=new Acc_Operation($cn);
$operation->jr_id=$element;
// echo "<A
// HREF=\"jrn_op_detail.php?jrn_op=".GetGrpt($cn,$element)."\">
// ".GetInternal($cn,$element)."</A><br>";
$w=new widget("button");
$w->label=GetInternal($cn,$element);
$w->label=$operation->get_internal();
$w->javascript="modifyOperation('".$element."','".$_REQUEST['PHPSESSID']."',".dossier::id().
','.$_REQUEST['p_jrn'].",'S')";
echo $w->IOValue().'<br>';

View file

@ -26,12 +26,13 @@
*/
require_once ('class_user.php');
/*! \brief this file match the tables jrn & jrnx the purpose is to
remove or save accountant writing to these table.
* remove or save accountant writing to these table.
*
*/
class Acc_Operation
{
var $db; /*!< database connx */
var $jr_id; /*!< pk of jrn */
var $jrn_id; /*!< jrn_def_id */
var $debit; /*!< debit or credit */
var $user; /*!< current user */
@ -45,7 +46,7 @@ class Acc_Operation
* \brief constructor set automatically the attributes user and periode
* \param $p_cn the databse connection
*/
function Acc_operation($p_cn) {
function __construct($p_cn) {
$this->db=$p_cn;
$this->qcode="";
$this->user=$_SESSION['g_user'];
@ -83,7 +84,7 @@ class Acc_Operation
*\brief Insert into the table Jrn, the amount is computed from jrnx thanks the
* group id ($p_grpt)
*
* \return nothing
* \return sequence
*
*/
@ -114,7 +115,23 @@ class Acc_Operation
$Res=ExecSql($this->db,$sql);
if ( $Res == false) return false;
return GetSequence($this->db,'s_jrn');
$this->jr_id=GetSequence($this->db,'s_jrn');
return $this->jr_id;
}
/*!
* \brief Return the internal value, the property jr_id must be set before
*
* \return null si aucune valeur de trouv
*
*/
function get_internal() {
if ( ! isset($this->jr_id) )
throw new Exception('jr_id is not set',1);
$Res=ExecSql($this->db,"select jr_internal from jrn where jr_id=".$this->jr_id);
if ( pg_NumRows($Res) == 0 ) return null;
$l_line=pg_fetch_array($Res);
$this->jr_internal= $l_line['jr_internal'];
return $this->jr_internal;
}
}

View file

@ -29,6 +29,7 @@ require_once ('class_gestion_purchase.php');
require_once ('class_plananalytic.php');
require_once ('class_anc_operation.php');
require_once ('class_acc_ledger.php');
require_once ('class_acc_operation.php');
/*!
* \brief Display the form to UPDATE account operation in the expert view
*
@ -168,8 +169,10 @@ function ShowOperationExpert($p_cn,$p_jr_id,$p_mode=1)
$r.= '<div style="margin-left:30px;">';
foreach ($a as $key => $element) {
$operation=new Acc_operation($p_cn);
$operation->jr_id=$element;
$r.=sprintf ('%s <INPUT TYPE="BUTTON" VALUE="Détail" onClick="modifyOperation(\'%s\',\'%s\',%d)">',
GetInternal($p_cn,$element),
$operation->get_internal($p_cn,$element),
$element,
$sessid,
$gDossier);
@ -485,8 +488,10 @@ function ShowOperationUser($p_cn,$p_jr_id,$p_mode=1)
$r.= '<div style="margin-left:30px;">';
foreach ($a as $key => $element) {
$operation=new Acc_operation($p_cn);
$operation->jr_id=$element;
$r.=sprintf ('%s <INPUT TYPE="BUTTON" VALUE="Détail" onClick="modifyOperation(\'%s\',\'%s\',%d)">',
GetInternal($p_cn,$element),
$operation->get_internal(),
$element,
$sessid,
$gDossier);
@ -732,7 +737,7 @@ function GetData ($p_cn,$p_grpt) {
* - null si aucune valeur de trouvée
*
*/
function GetInternal($p_cn,$p_id) {
function get_internal($p_cn,$p_id) {
$Res=ExecSql($p_cn,"select jr_internal from jrn where jr_id=$p_id");
if ( pg_NumRows($Res) == 0 ) return null;

View file

@ -27,6 +27,7 @@
include_once("postgres.php");
require_once("class_document.php");
require_once("class_acc_operation.php");
/*! \file
* \brief Common functions
*/
@ -704,9 +705,11 @@ $sort_echeance="<th> <A class=\"mtitle\" HREF=\"?$url&o=ea\">$image_asc</A>Ech
foreach ($a as $key => $element)
{
$l_amount=getDbValue($p_cn,"select jr_montant from jrn ".
" where jr_id=$element");
$r.= "<A class=\"detail\" HREF=\"javascript:modifyOperation('".$element."','".$l_sessid."',".$gDossier.")\" > ".GetInternal($p_cn,$element)." [ $l_amount &euro; ]</A>";
$operation=new Acc_Operation($p_cn);
$operation->jr_id=$element;
$l_amount=getDbValue($p_cn,"select jr_montant from jrn ".
" where jr_id=$element");
$r.= "<A class=\"detail\" HREF=\"javascript:modifyOperation('".$element."','".$l_sessid."',".$gDossier.")\" > ".$operation->get_internal()." [ $l_amount &euro; ]</A>";
}//for
}// if ( $a != null ) {
$r.="</TD>";