Add Documentation + cosmetics

This commit is contained in:
sparkyx 2007-12-24 15:27:30 +00:00
parent 40ec2ccb05
commit 6ea1cc1a04
15 changed files with 132 additions and 87 deletions

View file

@ -91,6 +91,7 @@ echo ShowItem(array(
//
echo '</div>';
echo '</div>';
$cn=DbConnect($gDossier);
/*! \todo module budget add the security

View file

@ -20,10 +20,10 @@
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
/* !\file
/*!\file
*/
/* \brief this class handle the different bilan, from the table bilan
/*! \brief this class handle the different bilan, from the table bilan
*
*/
require_once ('postgres.php');

View file

@ -23,7 +23,7 @@
/*!\file
*/
/* \brief acException extends Exception
/*! \brief acException extends Exception
*
*/
class AcException extends Exception {

View file

@ -25,7 +25,7 @@
* Print the crossed balance between 2 plan
*/
/* \brief
/*! \brief
* Print the crossed balance between 2 plan
*
*/

View file

@ -20,11 +20,11 @@
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
/* !\file
/*!\file
*/
/* \brief
* Concerns the Analytic class
/*! \brief
* Concerns the Analytic plan (table plan_analytique)
*/
require_once("constant.php");
require_once("postgres.php");

View file

@ -20,10 +20,10 @@
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
/* !\file
/*!\file
*/
/* \brief this class is the mother class for the CA printing
/*! \brief this class is the mother class for the CA printing
*
*
*/

View file

@ -21,6 +21,8 @@
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
/*! \file
*/
/*!
* \brief class to manage the table bud_detail
*
*/

View file

@ -21,7 +21,9 @@
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
/*!\file
* \brief it is a object including the class bud_detail bud_card,and
*/
/*! \brief it is a object including the class bud_detail bud_card,and
* bud_detail_periode,
* the purpose is to insert or save into bud_detail_periode
*/
@ -41,7 +43,8 @@ class Bud_Data {
var $bd_id;
var $pcm_val;
var $amount;
var $amount; /*!< array of amount, the key is the
p_id and the content is the amount */
var $cn;
var $bud_detail_periode;
@ -54,6 +57,10 @@ class Bud_Data {
}
/*!\brief Load Data from Database
*
* \return an array of Bud_Data objects
*/
function load() {
if ( $this->po_id == -1)
$sql_po_id="po_id is null";
@ -88,6 +95,7 @@ class Bud_Data {
echo_debug(__FILE__,__LINE__," load ");
echo_debug(__FILE__,__LINE__,$obj);
try {
// get the the bud_detail_periode for this bud_detail
$arg=array($obj->bd_id);
$res2=ExecSqlParam($this->cn,$sql_periode,$arg);
$per=pg_fetch_all($res2);
@ -104,14 +112,18 @@ class Bud_Data {
$p_id=$row2['p_id'];
$obj->amount[$p_id]=$row2['bdp_amount'];
}
$ret[]=clone $obj;
}
$ret[]=clone $obj;
}
echo_debug(__FILE__.':'.__LINE__,'Return load',$ret);
return $ret;
}
/*!\brief create a empty row (subform)
*
* \return a Bud_Data object
*/
function create_empty_row() {
private function create_empty_row() {
$ret=new Bud_Data($this->cn,$this->bh_id,$this->po_id);
$ret->bd_id=0;
$ret->pcm_lib="";
@ -124,12 +136,22 @@ class Bud_Data {
}
return $ret;
}
/*!\brief convert the array loaded from the database into data member
* \param array
*
*/
private function load_from_array($p_array) {
foreach (array('bd_id','bh_id','bc_id','pcm_val','pcm_lib','bh_name','bc_code') as $key) {
$this->{$key}=$p_array[$key];
}
}
/*!\brief create all the row of the form, MAX_BUD_DETAIL is the
* maximum of sub form the form may contains (defined in constant.php)
*
* \return string with html code
*/
function form() {
$r="";
$array=$this->load();
@ -154,6 +176,10 @@ class Bud_Data {
return $r;
}
/*!\brief Create one form
* \param the style
* \return string
*/
private function create_row($p_style="odd") {
static $p_number=0;
@ -206,10 +232,6 @@ class Bud_Data {
$button_change->javascript='bud_form_enable('.$p_number.')';
$r.=$button_change->IOValue('button_change'.$p_number);
$button_escape=new widget('button','Echapper');
$button_escape->javascript='bud_form_disable('.$p_number.')';
$button_escape->extra='style="display:none"';
$r.=$button_escape->IOValue('button_escape'.$p_number);
$button_save=new widget('button','Sauve');
$button_save->javascript='bud_form_save('.$p_number.')';
@ -220,10 +242,20 @@ class Bud_Data {
$button_delete->javascript='bud_form_delete('.$p_number.')';
$button_delete->extra='style="display:none"';
$r.=$button_delete->IOValue('button_delete'.$p_number);
$button_escape=new widget('button','Echapper');
$button_escape->javascript='bud_form_disable('.$p_number.')';
$button_escape->extra='style="display:none"';
$r.=$button_escape->IOValue('button_escape'.$p_number);
$r.='<span id="Result'.$p_number.'"></span>';
$r.="<hr>";
return $r;
}
/*!\brief Load all the card of a Hypothese
*
* \return double array [0][bc_id, bc_code]
*/
private function load_bud_card() {
if ( !isset ($this->array_bud_card) )
@ -233,6 +265,11 @@ class Bud_Data {
return $this->array_bud_card;
}
/*!\brief create the heading line for the table ( of a form)
*
* \return String
*/
private function header_table() {
if ( ! isset ($this->header ) ){
$r='<table style="border: 2px outset blue; width: 100%;">';
@ -246,6 +283,12 @@ class Bud_Data {
}
return $this->header;
}
/*!\brief convert an array into an object Bud_Detail_Periode the
* array must contains the keys bd_id, po_id,bc_id,pcm_val, bh_id
* and amount_xx where xx stands for the p_id (pk of parm_periode)
* \param array
*
*/
function get_from_array($p_array) {
foreach (array('bd_id','po_id','bc_id','pcm_val','bh_id') as $attr) {
@ -257,6 +300,11 @@ class Bud_Data {
$this->get_form_detail_periode($p_array);
echo_debug(__FILE__.':'.__LINE__.'- get_from_array','',$this);
}
/*!\brief Add in the table Bud_Detail and Bud_Detail_Periode
*
*/
function add() {
$r=$this->extract_bud_detail();
$r->add();
@ -268,6 +316,9 @@ class Bud_Data {
}
}
/*!\brief create an object Bud_Detail thanks the attr. of an object Bud_Data
* \return an object Bud_Detail
*/
function extract_bud_detail() {
foreach ( array('bd_id','po_id','bc_id','pcm_val','bh_id') as $r1) {
@ -278,8 +329,12 @@ class Bud_Data {
$r->get_from_array($a);
return $r;
}
/*!\brief update the table bud_detail and bud_detail_periode
*
*/
function update() {
$r=$this->extract_bud_detail();
$r->update();
ExecSql($this->cn,"delete from bud_detail_periode where bd_id =".$this->bd_id);
@ -289,9 +344,18 @@ class Bud_Data {
}
}
/*!\brief delete in bud_detail
*/
function delete_by_bd_id() {
ExecSql($this->cn,'delete from bud_detail where bd_id='.$this->bd_id);
}
/*!\brief transform an array containing the word amount_xx where xx
* stand for the p_id ( parm_periode primary key) into the data
* member this->bud_detail_periode
* \param the array
*/
private function get_form_detail_periode($p_array){
echo_debug(__FILE__.':'.__LINE__.'- get_form_detail_periode arg:','',$p_array);
extract ($p_array);
@ -310,6 +374,10 @@ class Bud_Data {
}
}
/*!\brief Test the class in debug mode
*/
static function test_me() {
echo JS_PROTOTYPE_JS;
echo JS_BUD_SCRIPT;

View file

@ -47,6 +47,10 @@ class Bud_Detail {
$this->po_id=null;$this->bc_id=null;$this->pcm_val=null;
$this->bh_id=null;
}
/*!\brief insert into the database and set the this->bd_id of the
* inserted row
* \return the bd_id
*/
function add () {
$array=array($this->po_id,
$this->bc_id,
@ -58,7 +62,9 @@ class Bud_Detail {
$a=ExecSqlParam($this->db,$sql,$array);
$this->bd_id=pg_fetch_result($a,0,0);
}
/*!\brief update thanks the bd_id if bd_id == 0 returns directly
*
*/
function update() {
if ( $this->bd_id == 0) return;
$sql="update bud_detail set po_id=$1,".
@ -74,10 +80,14 @@ class Bud_Detail {
ExecSqlParam($this->db,$sql,$array);
}
/*!\brief delete in bud_detail
*/
function delete() {
ExecSql($this->db,"delete from bud_detail where bd_id=".$this->bd_id);
}
/*!\brief load one row from the table Bud_Detail and makes an
object of it
*/
function load()
{
if ( $this->bd_id == 0 ) return ;
@ -96,17 +106,19 @@ class Bud_Detail {
}
static function get_list($p_cn,$p_bh_id,$pa_id=0) {
$pa_filter=($pa_id)?" and pa_id = $pa_id ":"";
$sql="select * from bud_detail join bud_detail_periode using(bd_id) ".
" right join parm_periode using (p_id) ".
" where bh_id= $bh_id $pa_filter ";
}
/*!\brief convert an array into in data member
*
*
*/
function get_from_array($p_array) {
foreach (array('bd_id','po_id','bc_id','pcm_val','bh_id') as $attr)
if ( isset ( $p_array[$attr] ))
$this->$attr=$p_array[$attr];
}
/*!\brief test the object for developper
*
*/
static function test_me() {
$cn=DbConnect(dossier::id());
$a=new Bud_Detail($cn);

View file

@ -23,7 +23,7 @@
/*!\file
*/
/*! \brief
/*! \brief manage the table bud_detail_periode
*
*/
@ -43,12 +43,16 @@ class Bud_Detail_Periode{
$this->p_id=0;
$this->bdp_amount=0;
}
/*!\brief delete
*/
function delete () {
$sql="delete from bud_detail_periode where bdp_id=".$this->bdp_id;
ExecSql($this->cn,$sql);
}
/*!\brief add a row in the table bud_detail_periode and set the
this->bdp_id with the value in the row
*
*/
function add(){
$sql="insert into bud_detail_periode(bdp_amount,p_id,bd_id) values ($1,$2,$3)".
" returning bdp_id";
@ -60,7 +64,9 @@ class Bud_Detail_Periode{
echo "Erreur : ".$e->getMessage();
}
}
/*!\brief for developper
*
*/
static function test_me() {
$cn=DbConnect(dossier::id());

View file

@ -21,6 +21,9 @@
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
/*!\file
*/
/*!
* \brief manage the database bud_hypo concerning the hypothese for
* different hyp.
*

View file

@ -1,52 +0,0 @@
<?php
/*
* This file is part of PhpCompta.
*
* PhpCompta is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* PhpCompta is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PhpCompta; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* $Revision$ */
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
/*! \file
* \brief class for the table document_type
*/
/*! \brief class for the table document_type
* \enum dt_id pk document_type
* \enum dt_value value
*/
class Document_type
{
/*! document_type
* \brief constructor
* \param $p_cn database connx
*/
function document_type($p_cn)
{
$this->db=$p_cn;
$this->dt_id=-1;
}
/*!
* \brief Get all the data for this dt_id
*/
function get()
{
$sql="select * from document_type where dt_id=".$this->dt_id;
$R=ExecSql($this->db,$sql);
$r=pg_fetch_array($R,0);
$this->dt_id=$r['dt_id'];
$this->dt_value=$r['dt_value'];
}
}

View file

@ -20,13 +20,13 @@
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
/* !\file
/*!\file
* \brief the class for the dossier, everywhere we need to know to
* which folder we are connected, because we can't use $_SESSION, we
* need to pass the dossier_id via a _GET or a POST variable
*/
/* \brief manage the current dossier, everywhere we need to know to
/*! \brief manage the current dossier, everywhere we need to know to
* which folder we are connected, because we can't use $_SESSION, we
* need to pass the dossier_id via a _GET or a POST variable
*

View file

@ -20,10 +20,10 @@
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
/* !\file
/*!\file
*/
/* \brief
/*! \brief mother class for gestion
*
*/
class gestion_table

View file

@ -20,10 +20,10 @@
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
/* !\file
/*!\file
*/
/* \brief manage the predefined operation, link to the table op_def
/*! \brief manage the predefined operation, link to the table op_def
* and op_def_detail
*
*/
@ -150,6 +150,11 @@ class Pre_operation
$this->p_jrn=$p_jrn;
}
}
/*!\brief mother of the pre_op_XXX, it contains only one data : an
* object Pre_Operation. The child class contains an array of
* Pre_Operation object
*/
class Pre_operation_detail {
var $operation;
function __construct($p_cn) {