start with bud_synthese
This commit is contained in:
parent
16c165b0c4
commit
252fd66be7
6 changed files with 283 additions and 2 deletions
|
|
@ -72,8 +72,12 @@ Bud_Hypo::testme();
|
|||
require_once ('class_bud_detail_periode.php');
|
||||
Bud_Detail_Periode::test_me();
|
||||
|
||||
*/
|
||||
|
||||
|
||||
require_once ('class_bud_data.php');
|
||||
Bud_Data::test_me();
|
||||
*/
|
||||
|
||||
|
||||
require_once ('class_bud_synthese_hypo.php');
|
||||
Bud_Synthese_Hypo::test_me();
|
||||
|
|
|
|||
|
|
@ -165,7 +165,11 @@ class Bud_Hypo {
|
|||
|
||||
|
||||
}
|
||||
|
||||
function has_plan() {
|
||||
$this->load();
|
||||
if ( isNumber($this->pa_id)==1) return 1;
|
||||
else return 0;
|
||||
}
|
||||
static function test_me() {
|
||||
$cn=DbConnect (dossier::id());
|
||||
ExecSql($cn,"delete from bud_hypothese");
|
||||
|
|
|
|||
73
include/class_bud_synthese_acc.php
Normal file
73
include/class_bud_synthese_acc.php
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
|
||||
<?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 Manage the hypothese for the budget module
|
||||
* synthese
|
||||
*/
|
||||
require_once ('class_bud_synthese.php');
|
||||
|
||||
class Bud_Synthese_Acc extents Bud_Synthese {
|
||||
|
||||
static function make_array($p_cn) {
|
||||
$a=make_array($p_cn,'select bh_id, bh_name from bud_hypothese '
|
||||
' where pa_id is not null order by bh_name');
|
||||
ret $a;
|
||||
}
|
||||
|
||||
function form() {
|
||||
$obj=new Bud_Hypo($this->cn);
|
||||
$obj->bh_id=$this->bh_id;
|
||||
$obj->load();
|
||||
$r.='<h2 class="info">'.$obj->bh_name.'</h2>';
|
||||
$per=make_array($this->cn,"select p_id,to_char(p_start,'MM.YYYY') ".
|
||||
" from periode order by p_start,p_end");
|
||||
|
||||
$wFrom=new widget('select');
|
||||
$wFrom->name='from';
|
||||
$wFrom->value=$per;
|
||||
|
||||
$wto=new widget('select');
|
||||
$wto->name='to';
|
||||
$wto->value=$per;
|
||||
$r.="Periode de ".$wFrom->IOValue()." à ".$wto->IOValue();
|
||||
|
||||
}
|
||||
function load() {
|
||||
$per=sql_filter_per($this->cn,$this->from,$this->to,'p_id','p_id');
|
||||
$sql="select sum(bdp_amount),ga_id,pcm_val,pcm_lib ".
|
||||
" from bud_detail_periode join bud_detail using (bd_id) "
|
||||
" join bud_hypothese using (bh_id) ".
|
||||
" join tmp_pcmn using (pcm_val) ".
|
||||
" join plan_analytique using (pa_id) ".
|
||||
" join groupe_analytique using(pa_id) ".
|
||||
" where bh_id= ".$this->bh_id.' and '.$per.
|
||||
" group by ga_id,pcm_lib,pcm_val ";
|
||||
|
||||
}
|
||||
function test_me() {
|
||||
|
||||
}
|
||||
}
|
||||
29
include/class_bud_synthese_group.php
Normal file
29
include/class_bud_synthese_group.php
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
|
||||
<?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 Manage the hypothese for the budget module
|
||||
* synthese
|
||||
*/
|
||||
96
include/class_bud_synthese_hypo.php
Normal file
96
include/class_bud_synthese_hypo.php
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
|
||||
<?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 Manage the hypothese for the budget module
|
||||
* synthese
|
||||
*/
|
||||
require_once ('class_bud_synthese.php');
|
||||
|
||||
class Bud_Synthese_Hypo extends Bud_Synthese {
|
||||
/* function __construct($p_cn) { */
|
||||
/* echo "constructor ".__FILE__; */
|
||||
/* } */
|
||||
static function make_array($p_cn) {
|
||||
$a=make_array($p_cn,'select bh_id, bh_name from bud_hypothese '.
|
||||
' where pa_id is not null order by bh_name');
|
||||
return $a;
|
||||
}
|
||||
|
||||
function form() {
|
||||
$wSelect = new widget('select');
|
||||
$wSelect->name='bh_id';
|
||||
$wSelect->value=Bud_Synthese_Hypo::make_array($this->cn);
|
||||
|
||||
$r="Hypothèse :".$wSelect->IOValue();
|
||||
|
||||
$per=make_array($this->cn,"select p_id,to_char(p_start,'MM.YYYY') ".
|
||||
" from parm_periode order by p_start,p_end");
|
||||
|
||||
$wFrom=new widget('select');
|
||||
$wFrom->name='from';
|
||||
$wFrom->value=$per;
|
||||
|
||||
$wto=new widget('select');
|
||||
$wto->name='to';
|
||||
$wto->value=$per;
|
||||
$r.="Periode de ".$wFrom->IOValue()." à ".$wto->IOValue();
|
||||
$r.=dossier::hidden();
|
||||
return $r;
|
||||
}
|
||||
function load() {
|
||||
$per=sql_filter_per($this->cn,$this->from,$this->to,'p_id','p_id');
|
||||
/* $sql="select sum(bdp_amount),ga_id,pcm_val,pcm_lib ".
|
||||
" from bud_detail_periode join bud_detail using (bd_id) ".
|
||||
" join bud_hypothese using (bh_id) ".
|
||||
" join tmp_pcmn using (pcm_val) ".
|
||||
" join plan_analytique using (pa_id) ".
|
||||
" join groupe_analytique using(pa_id) ".
|
||||
" where bh_id= ".$this->bh_id.' and '.$per.
|
||||
" group by ga_id,pcm_lib,pcm_val ";
|
||||
*/
|
||||
$sql="select bd_id, pcm_val,pcm_lib,po_id,ga_id ".
|
||||
" from bud_detail join tmp_pcmn using (pcm_val) join poste_analytique using (po_id)".
|
||||
" where bh_id = ".$this->bh_id.' order by pcm_val ';
|
||||
$array=get_array($this->cn,$sql);
|
||||
|
||||
|
||||
|
||||
return $array;
|
||||
}
|
||||
static function test_me() {
|
||||
$cn=DbConnect(dossier::id());
|
||||
$obj=new Bud_Synthese_Hypo($cn);
|
||||
echo '<form method="GET">';
|
||||
echo $obj->form();
|
||||
echo widget::submit_button('recherche','Recherche');
|
||||
echo '</form>';
|
||||
print_r($_GET);
|
||||
if ( isset ($_GET['recherche'])) {
|
||||
$obj->from_array($_GET);
|
||||
print_r( $obj->load());
|
||||
}
|
||||
}
|
||||
}
|
||||
75
include/class_bud_synthese_simple.php
Normal file
75
include/class_bud_synthese_simple.php
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
<?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 Manage the synthese module : budget
|
||||
*/
|
||||
|
||||
class Bud_Synthese_Simple extends Bud_Synthese {
|
||||
|
||||
var $from_po;
|
||||
var $to_po;
|
||||
|
||||
function from_array($p_array) {
|
||||
parent::from_array($p_array);
|
||||
foreach (array ('po_from','po_to') as $l) {
|
||||
$this->$l=isset($p_array[$l])?$p_array[$l]:'';
|
||||
}
|
||||
}
|
||||
|
||||
function form() {
|
||||
$r="";
|
||||
$obj=new Bud_Hypo($this->cn);
|
||||
$obj->bh_id=$this->bh_id;
|
||||
if ( $obj->has_plan () == 1 ) {
|
||||
/* show the analytic account of this plan */
|
||||
$po=new widget('select');
|
||||
$po->name='from_po';
|
||||
$value=make_array($this->cn,'select po_id,po_name from poste_analytique '.
|
||||
' where pa_id = '.$this->bh_id.' order by po_name');
|
||||
$po->value=$value;
|
||||
$po_to=new widget('select');
|
||||
$po_to->name='to';
|
||||
$po_to->value=$value;
|
||||
$r.='Plage de poste analytique '.$po->IOValue().' à '.$po_to->IOValue();
|
||||
}
|
||||
$per=make_array($this->cn,"select p_id,to_char(p_start,'MM.YYYY') ".
|
||||
" from periode order by p_start,p_end");
|
||||
|
||||
$wFrom=new widget('select');
|
||||
$wFrom->name='from';
|
||||
$wFrom->value=$per;
|
||||
|
||||
$wto=new widget('select');
|
||||
$wto->name='to';
|
||||
$wto->value=$per;
|
||||
$r.="Periode de ".$wFrom->IOValue()." à ".$wto->IOValue();
|
||||
}
|
||||
|
||||
function load_all() {
|
||||
|
||||
|
||||
}
|
||||
static function test_me() {
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue