Ajout Compta Analytique

Ajout bouton popup pour la date
Modif Recherche
This commit is contained in:
sparkyx 2007-09-15 15:49:42 +00:00
parent 033d90120d
commit 2d6f253dc1
76 changed files with 7527 additions and 125 deletions

View file

@ -172,6 +172,12 @@ function html_page_start($p_theme="",$p_script="",$p_script2="")
<link rel=\"stylesheet\" type=\"text/css\" href=\"style-print.css\" media=\"print\">".
$p_script2. "
</HEAD><script src=\"js/scripts.js\" type=\"text/javascript\"></script>";
echo '<script language="javascript" src="js/calendar.js"></script>
<script type="text/javascript" src="js/lang/calendar-en.js"></script>
<script language="javascript" src="js/calendar-setup.js"></script>
<LINK REL="stylesheet" type="text/css" href="calendar-blue.css" media="screen">
';
echo "<BODY $p_script>";
}
/*!

View file

@ -48,31 +48,6 @@ $str_hidden.=$hidden->IOValue("sub",$sub);
//------------------------------------------------------------------------------
// listing
if ( $sub=='listing') {
/*
$from=new widget ('text','from','from');
$from->size=10;
$from->value=(isset($_GET['from']))?$_GET['from']:"";
$to=new widget('text','to','to');
$to->value=(isset($_GET['to']))?$_GET['to']:"";
$to->size=10;
$plan_id=new widget("select","pa_id","pa_id");
$plan_id->selected=(isset($_GET['pa_id']))?$_GET['pa_id']:"Plan 2";
echo '<form method="get">';
echo dossier::hidden();
echo $hidden->IOValue("result","1");
echo $str_hidden;
echo "Depuis : ".$from->IOValue();
echo "jusque : ".$to->IOValue();
$plan=new PlanAnalytic($cn);
$plan_id->value=make_array($cn,"select pa_id, pa_name from plan_analytique order by pa_name");
echo "Plan Analytique :".$plan_id->IOValue();
echo $plan_id->Submit("recherche","recherche");
echo '</form>';
echo '<span class="notice"> Les dates sont en format DD.MM.YYYY</span>';
*/
require_once ('class_list_ca.php');
$list=new list_ca($cn);
$list->get_request();
@ -109,5 +84,15 @@ if ($sub == 'bs') {
//------------------------------------------------------------------------------
// crossed balance
if ( $sub == 'bc2') {
require_once ('class_balance_ca_bc.php');
$bc=new balance_ca_bc($cn);
$bc->get_request ();
echo '<form method="get">';
echo $bc->display_form($str_hidden);
echo '</form>';
if ( isset($_GET['result'])) {
echo $bc->show_button('ca_bc_csv.php','ca_bc_pdf.php',$str_hidden);
echo $bc->display_html();
}
}

View file

@ -128,7 +128,7 @@ class action
}
// Compute the widget
// Date
$date=new widget("text");
$date=new widget("js_date");
$date->readonly=$readonly;
$date->name="ag_timestamp";
$date->value=$this->ag_timestamp;

View file

@ -0,0 +1,74 @@
<?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 this class is the mother class for the CA balance
*
*
*/
require_once('postgres.php');
require_once('debug.php');
require_once('constant.php');
class print_ca {
var $db; /*!< $db database connection */
var $to; /*!< $to start date */
var $from; /*!< $from end date */
var $from_poste; /*!< $from_poste from poste */
var $to_poste; /*!< $to_poste to the poste */
function balance($p_cn) {
$this->db=$p_cn;
}
/*!
* \brief
* \param
* \param
* \param
*
*
* \return
*/
function get_request() {
$this->to=(isset($_REQUEST['from']))?$_REQUEST['from']:"";
$this->to=(isset($_REQUEST['to']))?$_REQUEST['to']:"";
$this->to=(isset($_REQUEST['from_poste']))?$_REQUEST['from_poste']:"";
$this->to=(isset($_REQUEST['to_poste']))?$_REQUEST['to_poste']:"";
}
/*!
* \brief
* \param
* \param
* \param
*
*
* \return
*/
function display_form() {
}
}

View file

@ -0,0 +1,524 @@
<?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
* Print the crossed balance between 2 plan
*
*/
require_once ('class_print_ca.php');
require_once ('class_plananalytic.php');
class balance_ca_bc extends print_ca
{
/*!
* \brief
* \param
* \param
* \param
*
*
* \return
*/
function display_html ()
{
$r="";
$array=$this->get_data();
$odd=0;
if ( is_array($array) == false ){
return $array;
}
$old="";
$tot_deb=0;
$tot_cred=0;
foreach ( $array as $row) {
$odd++;
$r.=($odd%2==0)?'<tr class="odd">':'</tr>';
// the name and po_id
// $r.=sprintf("<td>%s</td>",$row['po_id']);
if ( $old == $row['a_po_name'] ) {
$r.='<td></td>';
} else {
if ( $tot_deb != 0 && $tot_cred !=0 ) {
$r.="<tr>";
$r.="<td>Total </td> <td></td><td> $tot_deb </td> <td>$tot_cred</td>";
$s=abs($tot_deb-$tot_cred);
$d=($tot_deb>$tot_cred)?'debit':'credit';
$r.="<td>$s</td><td>$d</td>";
$r.="</tr>";
}
$tot_deb=0;
$tot_cred=0;
// new
$r.="</table>";
$r.="<table class=\"mtitle\">";
$r.="<tr>";
$r.="<th>Poste comptable Analytique</th>";
$r.="<th>Poste comptable Analytique</th>";
$r.="<th>D&eacute;bit</th>";
$r.="<th>Cr&eacute;dit</th>";
$r.="<th>Solde</th>";
$r.="<th>D/C</th>";
$r.="</tr>";
$r.=sprintf("<td>%s</td>",$row['a_po_name']);
$old=$row['a_po_name'];
}
$tot_deb+=$row['a_d'];
$tot_cred+=$row['a_c'];
$r.=sprintf("<td>%s</td>",$row['b_po_name']);
$r.=sprintf("<td>%12.2f</td>",$row['a_d']);
$r.=sprintf("<td>%12.2f</td>",$row['a_c']);
$r.=sprintf("<td>%12.2f</td>",$row['a_solde']);
$r.=sprintf("<td>%s</td>",$row['a_debit']);
$r.="</tr>";
}
if ( $tot_deb != 0 || $tot_cred !=0 ) {
$r.="<tr>";
$r.="<td>Total </td> <td></td><td> $tot_deb </td> <td>$tot_cred</td>";
$s=abs($tot_deb-$tot_cred);
$d=($tot_deb>$tot_cred)?'debit':'credit';
$r.="<td>$s</td><td>$d</td>";
$r.="</tr>";
}
$r.="</table>";
return $r;
}
/*!
* \brief Display the result in pdf
*
* \return none
*/
function display_pdf()
{
$array=$this->get_data();
$offset=0;
$page=1;
$pagesize=50;
$count=ceil(count($array)/$pagesize);
$pdf= new Cezpdf("A4");
$pdf->selectFont('./addon/fonts/Helvetica.afm');
$pa=new PlanAnalytic($this->db,$this->pa_id);
$pa->get();
$pb=new PlanAnalytic($this->db,$this->pa_id2);
$pb->get();
$titre=sprintf("Balance croise plan %s %s ",
$pa->name,
$pb->name);
$filtre_date="";
$filtre_pa="";
$filtre_pb="";
if ( $this->from !="" ||$this->to !="")
$filtre_date=sprintf("Filtre date %s %s",
$this->from,
$this->to);
if ( $this->from_poste !="" ||$this->to_poste !="")
$filtre_pa=sprintf("Filtre poste plan1 %s %s",
($this->from_poste!="")?"de ".$this->from_poste:" ",
($this->to_poste!="")?"jusque ".$this->to_poste:"");
if ( $this->from_poste2 !="" ||$this->to_poste2 !="")
$filtre_pb=sprintf("Filtre poste plan2 %s %s",
($this->from_poste2!="")?"de ".$this->from_poste2:" ",
($this->to_poste2!="")?"jusque ".$this->to_poste2:"");
for ($i_loop=0;$i_loop<=$count;$i_loop++) {
$view=$array;
$view=array_splice($view,$offset,$pagesize);
header_pdf($this->db,$pdf);
$pdf->ezText($filtre_date,'8');
$pdf->ezText($filtre_pa,'8');
$pdf->ezText($filtre_pb,'8');
$pdf->ezTable($view,
array("a_po_name"=>"id",
"b_po_name"=>"Poste Comptable",
"a_d"=>"Debit",
"a_c"=>"Credit",
"a_solde"=>"Solde",
"a_debit"=>"Debit/Credit"),
$titre,
array('shaded'=>1,'showHeadings'=>1,'width'=>500,
'cols'=>array('a_d'=> array('justification'=>'right'),
'a_solde'=> array('justification'=>'right'),
'a_c'=> array('justification'=>'right'))));
$page++;
$pdf->ezNewPage();
$offset+=$pagesize;
}
$this->show_pdf_sum($pdf,$array);
$pdf->ezStream();
}
/*!
* \brief
* \param
* \param
* \param
*
*
* \return
*/
function display_csv()
{
$r="";
$r.='"Poste comptable Analytique",';
$r.='"Poste comptable Analytique",';
$r.='"Debit",';
$r.='"Credit",';
$r.='"Solde",';
$r.='"D/C",';
$r.="\r\n";
$array=$this->get_data();
if ( is_array($array) == false ){
return $array;
}
foreach ( $array as $row) {
$r.=sprintf('"%s",',$row['a_po_name']);
$r.=sprintf('"%s",',$row['b_po_name']);
$r.=sprintf("%12.2f,",$row['a_d']);
$r.=sprintf("%12.2f,",$row['a_c']);
$r.=sprintf("%12.2f,",$row['a_solde']);
$r.=sprintf('"%s"',$row['a_debit']);
$r.="\r\n";
}
return $r;
}
/*!
* \brief
* \param
* \param
* \param
*
*
* \return
*/
function display_form($p_string='')
{
$r=parent::display_form($p_string);
// show the second plan
$r.='<span style="padding:5px;margin:5px;border:2px double blue;display:block;">';
$plan=new PlanAnalytic($this->db);
$plan_id=new widget("select","","pa_id2");
$plan_id->value=make_array($this->db,"select pa_id, pa_name from plan_analytique order by pa_name");
$plan_id->selected=$this->pa_id2;
$r.= "Plan Analytique :".$plan_id->IOValue();
$poste=new widget("text");
$poste->size=10;
$r.="Entre le poste ".$poste->IOValue("from_poste2",$this->from_poste2);
$choose=new widget("button");
$choose->name="Choix Poste";
$choose->label="Recherche";
$choose->javascript="onClick=search_ca('".$_REQUEST['PHPSESSID']."',".dossier::id().",'from_poste2','pa_id')";
$r.=$choose->IOValue();
$r.=" et le poste ".$poste->IOValue("to_poste2",$this->to_poste2);
$choose->javascript="onClick=search_ca('".$_REQUEST['PHPSESSID']."',".dossier::id().",'to_poste2','pa_id2')";
$r.=$choose->IOValue();
$r.='<span class="notice" style="display:block">Selectionnez le plan qui vous int&eacute;resse avant de cliquer sur Recherche</span>';
$r.='</span>';
$r.='<input type="SUBMIT" value="Afficher">';
return $r;
}
/*!
* \brief
* \param
* \param
* \param
*
*
* \return
*/
function show_button($url_csv,$url_pdf,$p_string="")
{
$r="";
$submit=new widget();
$submit->table=0;
$hidden=new widget("hidden");
$r.= '<form method="GET" action="'.$url_pdf.'" style="display:inline">';
$r.= $p_string;
$r.= dossier::hidden();
$r.= $hidden->IOValue("to",$this->to);
$r.= $hidden->IOValue("from",$this->from);
$r.= $hidden->IOValue("pa_id",$this->pa_id);
$r.= $hidden->IOValue("from_poste",$this->from_poste);
$r.= $hidden->IOValue("to_poste",$this->to_poste);
$r.= $hidden->IOValue("pa_id2",$this->pa_id2);
$r.= $hidden->IOValue("from_poste2",$this->from_poste2);
$r.= $hidden->IOValue("to_poste2",$this->to_poste2);
$r.= $submit->Submit('bt_pdf',"Export en PDF");
$r.= '</form>';
$r.= '<form method="GET" action="'.$url_csv.'" style="display:inline">';
$r.= $hidden->IOValue("to",$this->to);
$r.= $hidden->IOValue("from",$this->from);
$r.= $hidden->IOValue("pa_id",$this->pa_id);
$r.= $hidden->IOValue("from_poste",$this->from_poste);
$r.= $hidden->IOValue("to_poste",$this->to_poste);
$r.= $hidden->IOValue("pa_id2",$this->pa_id2);
$r.= $hidden->IOValue("from_poste2",$this->from_poste2);
$r.= $hidden->IOValue("to_poste2",$this->to_poste2);
$r.= $p_string;
$r.= dossier::hidden();
$r.= $submit->Submit('bt_csv',"Export en CSV");
$r.= '</form>';
return $r;
}
/*!
* \brief
* \param
* \param
* \param
*
*
* \return
*/
function get_request()
{
parent::get_request();
$this->from_poste2=(isset($_REQUEST['from_poste2']))?$_REQUEST['from_poste2']:"";
$this->to_poste2=(isset($_REQUEST['to_poste2']))?$_REQUEST['to_poste2']:"";
$this->pa_id2=(isset($_REQUEST['pa_id2']))?$_REQUEST['pa_id2']:"";
}
/*!
* \brief
* \param
* \param
* \param
*
*
* \return
*/
function get_data()
{
$filter_poste="";
$and="";
if ( $this->from_poste != "" ){
$filter_poste.=" $and upper(pa.po_name)>= upper('".pg_escape_string($this->from_poste)."')";
$and=" and ";
}
if ( $this->to_poste != "" ){
$filter_poste.=" $and upper(pa.po_name)<= upper('".pg_escape_string($this->to_poste)."')";
$and=" and ";
}
if ( $this->from_poste2 != "" ){
$filter_poste.=" $and upper(pb.po_name)>= upper('".pg_escape_string($this->from_poste2)."')";
$and=" and ";
}
if ( $this->to_poste2 != "" ){
$filter_poste.=" $and upper(pb.po_name)<= upper('".pg_escape_string($this->to_poste2)."')";
$and=" and ";
}
$sql="
select a_po_id ,
pa.po_name as a_po_name,
b_po_id,
pb.po_name as b_po_name,
sum(a_oa_amount_c) as a_c,
sum(a_oa_amount_d) as a_d
from (select
a.po_id as a_po_id,
b.po_id as b_po_id,
case when a.oa_debit='t' then a.oa_amount else 0 end as a_oa_amount_d,
case when a.oa_debit='f' then a.oa_amount else 0 end as a_oa_amount_c
from
operation_analytique as a join operation_analytique as b using (oa_group)
where a.pa_id=".
$this->pa_id."
and b.pa_id=".$this->pa_id2." ".$this->set_sql_filter()."
) as m join poste_analytique as pa on ( a_po_id=pa.po_id)
join poste_analytique as pb on (b_po_id=pb.po_id)
where
$filter_poste
group by a_po_id,b_po_id,pa.po_name,pb.po_name
order by 1;
";
$res=ExecSql($this->db,$sql);
if ( pg_NumRows($res) == 0 )
return null;
$a=array();
$count=0;
$array=pg_fetch_all($res);
foreach ($array as $row) {
$a[$count]['a_po_id']=$row['a_po_id'];
$a[$count]['a_d']=$row['a_d'];
$a[$count]['a_c']=$row['a_c'];
$a[$count]['b_po_id']=$row['b_po_id'];
$a[$count]['a_po_name']=$row['a_po_name'];
$a[$count]['b_po_name']=$row['b_po_name'];
$a[$count]['a_solde']=abs($row['a_d']-$row['a_c']);
$a[$count]['a_debit']=($row['a_d']>$row['a_c'])?"debit":"credit";
$count++;
}
return $a;
}
/*!
* \brief
* \param
* \param
* \param
*
*
* \return
*/
function set_sql_filter()
{
$sql="";
$and=" and ";
if ( $this->from != "" ){
$sql.="$and oa_date >= to_date('".$this->from."','DD.MM.YYYY')";
}
if ( $this->to != "" ){
$sql.=" $and oa_date <= to_date('".$this->to."','DD.MM.YYYY')";
}
return $sql;
}
/*!
* \brief add
* \param
* \param
* \param
*
*
* \return
*/
function show_pdf_sum (&$pdf,$p_array)
{
$tot_deb=0;
$tot_cred=0;
$old="";
$first=true;
foreach ( $p_array as $row) {
if ( $old != $row['a_po_name'] && $first==false )
{
$s=abs($tot_deb-$tot_cred);
$d=($tot_deb>$tot_cred)?'debit':'credit';
$r=sprintf(" $old Debit %12.2f Credit 12.2f solde %12.2f %s",
$tot_deb,
$tot_cred,
$s,
$d);
$pdf->ezText($r,9);
$tot_deb=0;
$tot_cred=0;
$old=$row['a_po_name'];
}
if ( $first ) {
$first=false;
$old=$row['a_po_name'];
}
$tot_deb+=$row['a_d'];
$tot_cred+=$row['a_c'];
}
$s=abs($tot_deb-$tot_cred);
$d=($tot_deb>$tot_cred)?'debit':'credit';
$r=sprintf(" %s Debit %12.2f Credit %12.2f solde %12.2f %s",
$old,
$tot_deb,
$tot_cred,
$s,
$d);
$pdf->ezText($r,9);
}
/*!
* \brief
* \param
* \param
* \param
*
*
* \return
*/
static function test_me()
{
$a=DbConnect(dossier::id());
$bal=new balance_ca_bc($a);
$bal->get_request();
echo '<form method="GET">';
echo $bal->display_form();
echo '</form>';
if ( isset($_GET['result'])) {
print_r($bal);
echo $bal->show_button("","");
echo "<h1>HTML</h1>";
echo $bal->display_html();
echo "<h1>CSV</h1>";
echo $bal->display_csv();
}
}
}

View file

@ -33,19 +33,6 @@ include_once("class.ezpdf.php");
require_once ('header_print.php');
class balance_ca_bs extends print_ca {
/*!
* \brief
* \param
* \param
* \param
*
*
* \return
*/
function get_request(){
parent::get_request();
$this->pa_id=(isset($_REQUEST['pa_id']))?$_REQUEST['pa_id']:"";
}
/*!
* \brief
@ -166,31 +153,16 @@ class balance_ca_bs extends print_ca {
*/
function display_form($p_string="") {
$r=parent::display_form($p_string);
$poste=new widget("text");
$poste->size=10;
$r.="Entre le poste ".$poste->IOValue("from_poste",$this->from_poste);
$r.=" et le poste ".$poste->IOValue("to_poste",$this->to_poste);
$plan=new PlanAnalytic($this->db);
$plan_id=new widget("select","","pa_id");
$plan_id->value=make_array($this->db,"select pa_id, pa_name from plan_analytique order by pa_name");
$plan_id->selected=$this->pa_id;
$r.= "Plan Analytique :".$plan_id->IOValue();
$r.= $plan_id->Submit("recherche","recherche");
$r.= '</form>';
$r.= '<span class="notice"> Les dates sont en format DD.MM.YYYY</span>';
$r.= '<input type="submit" value="Afficher">';
return $r;
}
/*!
* \brief
* \param
* \param
* \param
*
* \brief Display the result in pdf
*
* \return array to display
* \return none
*/
function display_pdf()
{

View file

@ -64,7 +64,7 @@ class groupop
*
*/
function form($p_readonly=0){
$wDate=new widget("text","Date : ","pdate",$this->date);
$wDate=new widget("js_date","Date : ","pdate",$this->date);
$wDate->table=1;
$wDate->size=10;
$wDate->readonly=$p_readonly;

View file

@ -41,22 +41,10 @@ require_once ('class_operation.php');
class list_ca extends print_ca {
function display_form($p_string="") {
$plan_id=new widget("select","pa_id","pa_id");
$plan_id->selected=$this->pa_id;
$r= '<form method="get">';
$r.=$p_string;
$r.=parent::display_form();
$poste=new widget("text");
$r.="Entre le poste ".$poste->IOValue("from_poste",$this->from_poste);
$r.=" et le poste ".$poste->IOValue("to_poste",$this->to_poste);
$plan=new PlanAnalytic($this->db);
$plan_id->value=make_array($this->db,"select pa_id, pa_name from plan_analytique order by pa_name");
$r.= "Plan Analytique :".$plan_id->IOValue();
$r.= $plan_id->Submit("recherche","recherche");
echo '<form method="get">';
$r=parent::display_form($p_string);
$r.='<input type="submit" name="result" value="Afficher">';
$r.= '</form>';
$r.= '<span class="notice"> Les dates sont en format DD.MM.YYYY</span>';
return $r;
}

View file

@ -170,5 +170,13 @@ class PlanAnalytic
$a=CountSql($this->db,"select pa_id from plan_analytique");
return $a;
}
function exist() {
$a=CountSql($this->db,"select pa_id from plan_analytique where pa_id=".
pg_escape_string($this->pa_id));
return ($a==0)?false:true;
}
}
?>

View file

@ -71,7 +71,8 @@ class print_ca {
$this->to_poste=$_REQUEST['to_poste'];
if ( isset($_REQUEST['pa_id']))
$this->pa_id=$_REQUEST['pa_id'];
else
$this->pa_id="";
}
/*!
@ -84,11 +85,11 @@ class print_ca {
* \return
*/
function display_form($p_hidden="") {
$from=new widget ('text','from','from');
$from=new widget ('js_date','from','from');
$from->size=10;
$from->value=$this->from;
$to=new widget('text','to','to');
$to=new widget('js_date','to','to');
$to->value=$this->to;
$to->size=10;
@ -105,7 +106,31 @@ class print_ca {
$r.=$hidden->IOValue("result","1");
$r.="Depuis : ".$from->IOValue();
$r.= "jusque : ".$to->IOValue();
$r.= '<span class="notice"> Les dates sont en format DD.MM.YYYY</span>';
$r.=$p_hidden;
$r.='<span style="padding:5px;margin:5px;border:2px double blue;display:block;">';
$plan=new PlanAnalytic($this->db);
$plan_id=new widget("select","","pa_id");
$plan_id->value=make_array($this->db,"select pa_id, pa_name from plan_analytique order by pa_name");
$plan_id->selected=$this->pa_id;
$r.= "Plan Analytique :".$plan_id->IOValue();
$poste=new widget("text");
$poste->size=10;
$r.="Entre le poste ".$poste->IOValue("from_poste",$this->from_poste);
$choose=new widget("button");
$choose->name="Choix Poste";
$choose->label="Recherche";
$choose->javascript="onClick=search_ca('".$_REQUEST['PHPSESSID']."',".dossier::id().",'from_poste','pa_id')";
$r.=$choose->IOValue();
$r.=" et le poste ".$poste->IOValue("to_poste",$this->to_poste);
$choose->javascript="onClick=search_ca('".$_REQUEST['PHPSESSID']."',".dossier::id().",'to_poste','pa_id')";
$r.=$choose->IOValue();
$r.='<span class="notice" style="display:block">Selectionnez le plan qui vous int&eacute;resse avant de cliquer sur Recherche</span>';
$r.='</span>';
return $r;
}
}

View file

@ -55,7 +55,7 @@
* - JS_TVA open a popup window for the VAT
* - JS_CONCERNED open a popup window for search a operation, if extra == 0 then
* get the amount thx javascript
* - js_DATE show a calendar
*
* For JS_SEARCH_POST,JS_SEARCH or JS_SEARCH_ONLY
* - $extra contains 'cred', 'deb', 'all' or a list of fiche_def_ref (frd_id)
@ -331,7 +331,7 @@ class widget {
<INPUT class="inp" TYPE="button" onClick=SearchPoste(\'%s\','.dossier::id().',\'%s\',\'%s\') value="Recherche">
%s</TD><TD>
<INPUT TYPE="Text" NAME="%s" ID="%s" VALUE="%s" SIZE="8">
<INPUT style="border:groove 1px blue;" TYPE="Text" NAME="%s" ID="%s" VALUE="%s" SIZE="8">
</TD>',
$l_sessid,
$this->name,
@ -347,7 +347,7 @@ class widget {
<INPUT TYPE="button" onClick=SearchPosteFilter(\'%s\','.dossier::id().',\'%s\',\'%s\',\'%s\') value="Recherche">
%s</TD><TD>
<INPUT TYPE="Text" NAME="%s" id="%s" VALUE="%s" SIZE="8">
<INPUT style="border:groove 1px blue;" TYPE="Text" NAME="%s" id="%s" VALUE="%s" SIZE="8">
</TD>',
$l_sessid,
$this->name,
@ -563,6 +563,48 @@ class widget {
' onClick="'.$this->javascript.'">';
return $r;
}
//------------------------------------------------------------------------
// JS_DATE
//------------------------------------------------------------------------
if ( strtolower($this->type)=="js_date") {
if ( $this->readonly) {
$r="<span> Date : ".$this->value;
$r='<input type="hidden" name="'.$this->name.'"'.
'id="'.$this->name.'"'.
' value = "'.$this->value.'"></span>';
} else {
$r='<input type="text" name="'.$this->name.'" id="'.$this->name.'"'.
'style="border:solid 1px blue;"'.
'size="10"'.
' value ="'.$this->value.'"'.
'/>'.
'<img src="image/x-office-calendar.png" id="'.$this->name.'_trigger"'.
' style="cursor: pointer; border: 1px solid red;" '.
'onmouseover="this.style.background=\'red\';" onmouseout="this.style.background=\'\'" />';
$r.='<script type="text/javascript">'.
'Calendar.setup({'.
// 'date : "'.$this->value.'",
'inputField : "'.$this->name.'", // id of the input field
ifFormat : "%d.%m.%Y", // format of the input field
button : "'.$this->name.'_trigger", // trigger for the calendar (button ID)
align : "Bl", // alignment (defaults to "Bl")
singleClick : true
});
</script>
';
}
if ($this->table==1) {
if ( $this->label != "") {
$r="<TD style=\"border:groove 1px blue;\">".$this->label."</TD><TD>".$r."</TD>";
}else {
$r="<TD>".$r."</TD>";
}
}
return $r;
}
return "INVALID WIDGET $this->type ";
} //end function
/* Debug

View file

@ -176,7 +176,7 @@ $periode_end=make_array($cn,"select p_id,to_char(p_end,'DD-MM-YYYY') from parm_p
print $w->IOValue('to_periode',$periode_end);
print "</TR>";
//--- by date
$date=new widget('text');
$date=new widget('js_date');
$date->table=1;
$date->label="Calendrier depuis :";
echo $date->IOValue('from_date');

View file

@ -501,13 +501,23 @@ $sort_echeance="<th> <A class=\"mtitle\" HREF=\"?$url&o=ea\">$image_asc</A>Ech
$l_s_montant=trim($l_s_montant);
// replace comma by dot
$l_s_montant=str_replace(',','.',$l_s_montant);
$l_st_montant=trim($l_st_montant);
// replace comma by dot
$l_st_montant=str_replace(',','.',$l_st_montant);
echo_debug('user_common',__LINE__,"l_s_montant $l_s_montant");
if ( ereg("^[0-9]+$", $l_s_montant) || ereg ("^[0-9]+\.[0-9]+$", $l_s_montant) )
{
$sql.=$l_and." jr_montant $l_mont_sel $l_s_montant";
$sql.=$l_and." jr_montant >= $l_s_montant";
$l_and=" and ";
}
if ( ereg("^[0-9]+$", $l_st_montant) || ereg ("^[0-9]+\.[0-9]+$", $l_st_montant) )
{
$sql.=$l_and." jr_montant <= $l_st_montant";
$l_and=" and ";
}
// date
if ( isDate($l_date_start) != null )
{

View file

@ -66,7 +66,9 @@ echo_debug('user_form_ach.php',__LINE__,"Enter FormAchInput($p_cn,$p_jrn,$p_peri
}
// The date
list ($l_date_start,$l_date_end)=GetPeriode($p_cn,$p_periode);
$op_date=( ! isset($e_date) ) ?substr($l_date_start,2,8):$e_date;
// $op_date=( ! isset($e_date) )
// ?substr($l_date_start,2,8):$e_date;
$op_date=( ! isset($e_date) ) ?$l_date_start:$e_date;
$e_ech=(isset($e_ech))?$e_ech:"";
$e_comm=(isset($e_comm))?$e_comm:"";
@ -99,7 +101,7 @@ echo_debug('user_form_ach.php',__LINE__,"Enter FormAchInput($p_cn,$p_jrn,$p_peri
$r.='<TABLE>';
// Date widget
//--
$Date=new widget("text");
$Date=new widget("js_date");
$Date->SetReadOnly($pview_only);
$Date->table=1;
$r.="<tr>";

View file

@ -143,8 +143,8 @@ function FormFin($p_cn,$p_jrn,$p_periode,$p_submit,$p_array=null,$pview_only=tru
// The date
list ($l_date_start,$l_date_end)=GetPeriode($p_cn,$p_periode);
$flag=(isset($e_date))?1:0;
$e_date=( ! isset($e_date) ) ? substr($l_date_start,2,8):$e_date;
// $e_date=( ! isset($e_date) ) ? substr($l_date_start,2,8):$e_date;
$e_date=( ! isset($e_date) ) ? $l_date_start:$e_date;
// Comment
$e_comment=(isset($e_comment))?$e_comment:"";
@ -174,7 +174,7 @@ function FormFin($p_cn,$p_jrn,$p_periode,$p_submit,$p_array=null,$pview_only=tru
$r.="<FORM NAME=\"form_detail\" enctype=\"multipart/form-data\" ACTION=\"$href\" METHOD=\"POST\">";
$r.=dossier::hidden();
$r.='<TABLE>';
$Date=new widget("text");
$Date=new widget("js_date");
$Date->SetReadOnly($pview_only);
$Date->table=1;
$r.="<tr>";

View file

@ -61,7 +61,9 @@ function FormODS($p_cn,$p_jrn,$p_periode,$p_submit,$p_array=null,$pview_only=tru
// The date
list ($l_date_start,$l_date_end)=GetPeriode($p_cn,$p_periode);
$flag=(isset($e_date))?1:0;
$e_date=( ! isset($e_date) ) ? substr($l_date_start,2,8):$e_date;
// $e_date=( ! isset($e_date) ) ?
// substr($l_date_start,2,8):$e_date;
$e_date=( ! isset($e_date) ) ? $l_date_start:$e_date;
// Verify if valid date
if ( $flag==1 and VerifyOperationDate($p_cn,$p_periode,$e_date) == null) {
@ -85,7 +87,7 @@ function FormODS($p_cn,$p_jrn,$p_periode,$p_submit,$p_array=null,$pview_only=tru
$r.=dossier::hidden();
$r.='<TABLE>';
// Date
$wDate=new widget('text');
$wDate=new widget('js_date');
$wDate->SetReadOnly($pview_only);
$wDate->table=1;
$r.="<TR>".$wDate->IOValue("e_date",$e_date,'Date')."</TR>";

View file

@ -53,7 +53,9 @@ function FormVenInput($p_cn,$p_jrn,$p_periode,$p_array=null,$pview_only=true,$p_
}
// The date
list ($l_date_start,$l_date_end)=GetPeriode($p_cn,$p_periode);
$op_date=( ! isset($e_date) ) ?substr($l_date_start,2,8):$e_date;
// $op_date=( ! isset($e_date) )
// ?substr($l_date_start,2,8):$e_date;
$op_date=( ! isset($e_date) ) ?$l_date_start:$e_date;
$e_ech=(isset($e_ech))?$e_ech:"";
$e_comm=(isset($e_comm))?$e_comm:"";
// $e_jrn=(isset($e_jrn))?$e_jrn:"";
@ -91,7 +93,7 @@ function FormVenInput($p_cn,$p_jrn,$p_periode,$p_array=null,$pview_only=true,$p_
$r.='<TABLE>';
// Date
//--
$Date=new widget("text");
$Date=new widget("js_date");
$Date->SetReadOnly($pview_only);
$Date->table=1;
$Date->tabindex=1;

View file

@ -416,23 +416,25 @@ function u_ShowMenuRecherche($p_cn,$p_jrn,$p_sessid,$p_array=null)
}
// Find the journal property
/*
$opt='<OPTION VALUE="="> =';
$opt.='<OPTION VALUE="<="> <=';
$opt.='<OPTION VALUE="<"> <';
$opt.='<OPTION VALUE=">"> >';
$opt.='<OPTION VALUE=">="> >=';
*/
if ( ! isset ($p_date_start)) $p_date_start="";
if ( ! isset ($p_date_end)) $p_date_end="";
if ( ! isset ($p_mont_sel))$p_mont_sel="";
if ( ! isset ($p_s_comment))$p_s_comment="";
if ( ! isset ($p_s_montant)) $p_s_montant="";
if ( ! isset ($p_st_montant)) $p_st_montant="";
if ( ! isset ($p_s_internal)) $p_s_internal="";
if ( ! isset ($p_poste)) $p_poste="";
if ( ! isset ($p_qcode)) $p_qcode="";
if ( $p_mont_sel != "" ) $opt.='<OPTION value="'.$p_mont_sel.'" SELECTED> '.$p_mont_sel;
// if ( $p_mont_sel != "" ) $opt.='<OPTION value="'.$p_mont_sel.'" SELECTED> '.$p_mont_sel;
$r="";
// $r.= '<div style="border-style:outset;border-width:1pt;">';
@ -445,18 +447,34 @@ function u_ShowMenuRecherche($p_cn,$p_jrn,$p_sessid,$p_array=null)
$r.="<table><tr><TD>";
$r.= '<TABLE>';
$r.= "<TR>";
$r.= '<TD COLSPAN="3"> Date compris entre</TD> ';
$r.= '<TD COLSPAN="3"> Date comprise entre</TD> ';
$r.= "</TR> <TR>";
$r.= '<TD> <INPUT TYPE="TEXT" NAME="date_start" SIZE="10" VALUE="'.$p_date_start.'"></TD>';
$r.= '<TD>et <INPUT TYPE="TEXT" NAME="date_end" size="10" Value="'.$p_date_end.'"></TD>';
$date_start=new widget('js_date');
$date_start->name="date_start";
$date_start->value=$p_date_start;
$date_start->table=0;
$date_end=new widget('js_date');
$date_end->name="date_end";
$date_end->value=$p_date_end;
$date_end->table=0;
// $r.= '<TD> <INPUT TYPE="TEXT" NAME="date_start" SIZE="10" VALUE="'.$p_date_start.'"></TD>';
//$r.= '<TD>et <INPUT TYPE="TEXT" NAME="date_end" size="10"
//Value="'.$p_date_end.'"></TD>';
$r.='<td>'.$date_start->IOValue();
$r.=" et ";
$r.=$date_end->IOValue().'</td>';
$r.= '</TD><TD>';
$r.= "</TR> <TR>";
$r.= "<TD> Montant ";
$r.= ' <SELECT NAME="mont_sel">'.$opt.' </SELECT></TD><TD>';
$r.= ' <INPUT TYPE="TEXT" NAME="s_montant" SIZE="10" VALUE="'.$p_s_montant.'"></TD>';
$r.= "<TD> Montant compris entre ";
// $r.= ' <SELECT NAME="mont_sel">'.$opt.' </SELECT></TD><TD>';
$r.= ' <INPUT TYPE="TEXT" style="border:groove 1px blue;" NAME="s_montant" SIZE="10" VALUE="'.$p_s_montant.'">';
$r.= ' et <INPUT TYPE="TEXT" style="border:groove 1px blue;" NAME="st_montant" SIZE="10" VALUE="'.$p_st_montant.'"></TD>';
$r.= '</TR><TR valigne="top">';
$r.='<TD > Internal code </td>';
$r.='<TD ><input type="text" name="s_internal" value="'.$p_s_internal.'"></td>';
$r.='<TD > Internal code ';
$r.='<input type="text" style="border:groove 1px blue;"name="s_internal" value="'.$p_s_internal.'"></td>';
$r.='</TR><TR><TD colspan="2"><i>vous pouvez spécifier uniquement <br>une partie (VEN, num&eacute;ro d\'op&eacute;ration...)</i></td>';
@ -492,7 +510,7 @@ function u_ShowMenuRecherche($p_cn,$p_jrn,$p_sessid,$p_array=null)
$r.= '<TD colspan="3"> Le commentaire contient </TD>';
$r.= "</TR><TR>";
$r.= '<TD COLSPAN="3"> <INPUT TYPE="TEXT" NAME="s_comment" VALUE="'.$p_s_comment.'"></TD>';
$r.= '<TD COLSPAN="3"> <INPUT TYPE="TEXT" style="border:groove 1px blue;" NAME="s_comment" VALUE="'.$p_s_comment.'"></TD>';
$r.= "</TR><TR>";
$r.= '<TD COLSPAN="3"><INPUT TYPE="SUBMIT" VALUE="Recherche" NAME="viewsearch"></TD>';
$r.= "</TR>";