Merged revisions 4035,4037-4048 via svnmerge from

file:///home/developper/svn/phpcompta/branches/rel550

........
  r4037 | danydb | 2011-03-05 14:03:18 +0100 (Sat, 05 Mar 2011) | 2 lines
  
  Add request_to_hidden, post_to_hidden functions
........
  r4038 | danydb | 2011-03-05 14:04:31 +0100 (Sat, 05 Mar 2011) | 2 lines
  
  add doc. function get_to_hidden post_to_hidden
........
  r4039 | danydb | 2011-03-05 14:37:20 +0100 (Sat, 05 Mar 2011) | 1 line
  
  Fix javascript problem with date
........
  r4040 | danydb | 2011-03-05 16:29:52 +0100 (Sat, 05 Mar 2011) | 2 lines
  
  Bug cannot get the last date
........
  r4041 | danydb | 2011-03-05 16:52:57 +0100 (Sat, 05 Mar 2011) | 1 line
  
  Add default_value, request_to_hidden function 
........
  r4042 | danydb | 2011-03-05 16:53:15 +0100 (Sat, 05 Mar 2011) | 1 line
  
  Add sublevel to balance 
........
  r4043 | danydb | 2011-03-05 16:53:32 +0100 (Sat, 05 Mar 2011) | 1 line
  
  Add bank saldo 
........
  r4044 | danydb | 2011-03-05 17:06:37 +0100 (Sat, 05 Mar 2011) | 2 lines
  
  234 limite dans les dossier afficher en administration
........
  r4045 | danydb | 2011-03-05 17:12:33 +0100 (Sat, 05 Mar 2011) | 2 lines
  
  bug 234
........
  r4046 | danydb | 2011-03-07 13:05:48 +0100 (Mon, 07 Mar 2011) | 1 line
  
  add_todo_list was removed
........
  r4047 | danydb | 2011-03-07 13:13:48 +0100 (Mon, 07 Mar 2011) | 1 line
  
  Bug IDate
........
This commit is contained in:
Dany De Bontridder 2011-03-07 14:30:26 +00:00
parent ac1a34ee84
commit ab4cc9bd10
10 changed files with 220 additions and 35 deletions

View file

@ -49,12 +49,11 @@ if ( $user->check_jrn($_GET['j'])=='X' ) return '{"saldo":"0"}';
$filter_year=" j_tech_per in (select p_id from parm_periode ".
"where p_exercice='".$user->get_exercice()."')";
$acc=new Fiche($cn);
$acc->get_by_qcode($_GET['ctl'],false);
if ( $acc->belong_ledger($_GET['j']) == -1 )
return '{"saldo":"0"}';
$res=$acc->get_solde_detail($filter_year);
$id=$cn->get_value('select jrn_def_bank from jrn_def where jrn_def_id=$1',array($_GET['j']));
$acc=new Fiche($cn,$id);
$res=$acc->get_bk_balance($filter_year." and ( trim(jr_pj_number) != '' and jr_pj_number is not null)" );
if ( empty($res) ) return '{"saldo":"0"}';
@ -62,7 +61,6 @@ $solde=$res['solde'];
if ( $res['debit'] < $res['credit'] ) $solde=$solde*(-1);
//header("Content-type: text/html; charset: utf8",true);
echo '{"saldo":"'.$solde.'"}';

View file

@ -170,7 +170,7 @@ function success_get_last_date(req)
var name_ctl=a[0].firstChild.nodeValue;
var code_html=getNodeText(html[0]);
code_html=unescape_xml(code_html);
$(name_ctl).value=code_html;
document.getElementsByName(name_ctl)[0].value=code_html;
}
catch (e)
{

View file

@ -105,8 +105,56 @@ $tp_deb=0;
$tp_cred=0;
$tp_sold=0;
$tp_solc=0;
foreach(array('sum_cred','sum_deb','solde_deb','solde_cred') as $a)
{
$nlvl1[$a]=0;
$nlvl2[$a]=0;
$nlvl3[$a]=0;
}
$lvl1_old='';
$lvl2_old='';
$lvl3_old='';
bcscale(2);
for ($i=0;$i<count($array);$i++)
{
if ( ! isset($array[$i]))continue;
/*
* level x
*/
foreach (array(3,2,1) as $ind)
{
if ( ! isset($_GET['lvl'.$ind]))continue;
$r=$array[$i];
if (${'lvl'.$ind.'_old'} == '') ${'lvl'.$ind.'_old'}=substr($r['poste'],0,$ind);
if ( ${'lvl'.$ind.'_old'} != substr($r['poste'],0,$ind))
{
$pdf->SetFont('DejaVu','B',7);
$pdf->Cell(30,6,"Totaux ".$ind);
$pdf->Cell(80,6,${'lvl'.$ind.'_old'});
$pdf->Cell(20,6,nbm(${'nlvl'.$ind}['sum_deb']),0,0,'R');
$pdf->Cell(20,6,nbm(${'nlvl'.$ind}['sum_cred']),0,0,'R');
$pdf->Cell(20,6,nbm(${'nlvl'.$ind}['solde_deb']),0,0,'R');
$pdf->Cell(20,6,nbm(${'nlvl'.$ind}['solde_cred']),0,0,'R');
$pdf->Ln();
$pdf->SetFont('DejaVuCond','',7);
${'lvl'.$ind.'_old'}=substr($r['poste'],0,$ind);
foreach(array('sum_cred','sum_deb','solde_deb','solde_cred') as $a)
{
${'nlvl'.$ind}[$a]=0;
}
// xdebug_print_function_stack();exit();
}
}
foreach(array('sum_cred','sum_deb','solde_deb','solde_cred') as $a)
{
$nlvl1[$a]=bcadd($nlvl1[$a],$r[$a]);
$nlvl2[$a]=bcadd($nlvl2[$a],$r[$a]);
$nlvl3[$a]=bcadd($nlvl3[$a],$r[$a]);
}
if ( $i % 2 == 0 )
{
$pdf->SetFillColor(220,221,255);
@ -117,7 +165,7 @@ for ($i=0;$i<count($array);$i++)
$pdf->SetFillColor(0,0,0);
$fill=0;
}
if ( ! isset($array[$i]))continue;
$pdf->Cell(30,6,$array[$i]['poste'],0,0,'L',$fill);
$pdf->Cell(80,6,$array[$i]['label'],0,0,'L',$fill);
$pdf->Cell(20,6,nbm($array[$i]['sum_deb']),0,0,'R',$fill);
@ -125,19 +173,19 @@ for ($i=0;$i<count($array);$i++)
$pdf->Cell(20,6,nbm($array[$i]['solde_deb']),0,0,'R',$fill);
$pdf->Cell(20,6,nbm($array[$i]['solde_cred']),0,0,'R',$fill);
$pdf->Ln();
$tp_deb+=$array[$i]['sum_deb'];
$tp_cred+=$array[$i]['sum_cred'];
$tp_sold+=$array[$i]['solde_deb'];
$tp_solc+=$array[$i]['solde_cred'];
$tp_deb=bcadd($tp_deb,$array[$i]['sum_deb']);
$tp_cred=bcadd($tp_cred,$array[$i]['sum_cred']);
$tp_sold=bcadd($tp_sold,$array[$i]['solde_deb']);
$tp_solc=bcadd($tp_solc,$array[$i]['solde_cred']);
}
// Totaux
$pdf->SetFont('DejaVuCond','B',8);
$pdf->Cell(110,6,'Totaux');
$pdf->Cell(20,6,$tp_deb,'T',0,'R',0);
$pdf->Cell(20,6,$tp_cred,'T',0,'R',0);
$pdf->Cell(20,6,$tp_sold,'T',0,'R',0);
$pdf->Cell(20,6,$tp_solc,'T',0,'R',0);
$pdf->Cell(20,6,nbm($tp_deb),'T',0,'R',0);
$pdf->Cell(20,6,nbm($tp_cred),'T',0,'R',0);
$pdf->Cell(20,6,nbm($tp_sold),'T',0,'R',0);
$pdf->Cell(20,6,nbm($tp_solc),'T',0,'R',0);
$pdf->Ln();

View file

@ -106,6 +106,31 @@ if ( isset($_GET['p_filter']) && $_GET['p_filter']==2) $rad->selected='t';
else $rad->selected=false;
echo '<li>'.$rad->input('p_filter',2).'Filtré par catégorie'.HtmlInput::select_cat($array_cat).'</li>';
echo '</ul>';
echo 'Totaux par sous-niveaux';
$ck_lev1=new ICheckBox('lvl1');
$ck_lev2=new ICheckBox('lvl2');
$ck_lev3=new ICheckBox('lvl3');
$ck_lev1->value=1;
$ck_lev2->value=1;
$ck_lev3->value=1;
echo '<ul style="list-style-type:none">';
if (HtmlInput::default_value('lvl1',false,$_GET) !== false)
$ck_lev1->selected=true;
if (HtmlInput::default_value('lvl2',false,$_GET) !== false)
$ck_lev2->selected=true;
if (HtmlInput::default_value('lvl3',false,$_GET) !== false)
$ck_lev3->selected=true;
echo '<li>'.$ck_lev1->input().'Niveau 1</li>';
echo '<li>'.$ck_lev2->input().'Niveau 2</li>';
echo '<li>'.$ck_lev3->input().'Niveau 3</li>';
echo '</ul>';
$from_poste=new IPoste();
$from_poste->name="from_poste";
@ -162,6 +187,8 @@ if ( isset ($_GET['view'] ) )
echo HtmlInput::hidden("from_poste",$_GET['from_poste']).
HtmlInput::hidden("to_poste",$_GET['to_poste']);
echo HtmlInput::get_to_hidden(array('lvl1','lvl2','lvl3'));
echo "</form></TD>";
echo '<TD><form method="GET" ACTION="bal_csv.php">'.
@ -228,6 +255,17 @@ if ( isset($_GET['view'] ) )
echo '<th>Solde Cr&eacute;diteur</th>';
$i=0;
foreach(array('sum_cred','sum_deb','solde_deb','solde_cred') as $a)
{
$lvl1[$a]=0;
$lvl2[$a]=0;
$lvl3[$a]=0;
}
$lvl1_old='';
$lvl2_old='';
$lvl3_old='';
bcscale(2);
foreach ($row as $r)
{
$i++;
@ -238,6 +276,38 @@ if ( isset($_GET['view'] ) )
$view_history= sprintf('<A class="detail" style="text-decoration:underline" HREF="javascript:view_history_account(\'%s\',\'%s\')" >%s</A>',
$r['poste'], $gDossier, $r['poste']);
/*
* level x
*/
foreach (array(3,2,1) as $ind)
{
if ( ! isset($_GET['lvl'.$ind]))continue;
if (${'lvl'.$ind.'_old'} == '') ${'lvl'.$ind.'_old'}=substr($r['poste'],0,$ind);
if ( ${'lvl'.$ind.'_old'} != substr($r['poste'],0,$ind))
{
echo '<tr style="font-size:12px;font-height:bold">';
echo td("Total niveau ".$ind);
echo td(${'lvl'.$ind.'_old'});
echo td(nbm(${'lvl'.$ind}['sum_deb']),'style="text-align:right"');
echo td(nbm(${'lvl'.$ind}['sum_cred']),'style="text-align:right"');
echo td(nbm(${'lvl'.$ind}['solde_deb']),'style="text-align:right"');
echo td(nbm(${'lvl'.$ind}['solde_cred']),'style="text-align:right"');
echo '</tr>';
${'lvl'.$ind.'_old'}=substr($r['poste'],0,$ind);
foreach(array('sum_cred','sum_deb','solde_deb','solde_cred') as $a)
{
${'lvl'.$ind}[$a]=0;
}
}
}
foreach(array('sum_cred','sum_deb','solde_deb','solde_cred') as $a)
{
$lvl1[$a]=bcadd($lvl1[$a],$r[$a]);
$lvl2[$a]=bcadd($lvl2[$a],$r[$a]);
$lvl3[$a]=bcadd($lvl3[$a],$r[$a]);
}
echo '<TR class="'.$tr.'">';
echo td($view_history);
echo td(h($r['label']));
@ -246,6 +316,7 @@ if ( isset($_GET['view'] ) )
echo td(nbm($r['solde_deb']),'style="text-align:right"');
echo td(nbm($r['solde_cred']),'style="text-align:right"');
echo '</TR>';
}
echo '</table>';

View file

@ -247,9 +247,11 @@ class Acc_Ledger_Fin extends Acc_Ledger
// Ledger (p_jrn)
//--
$add_js="";
$add_js='onchange="update_pj();update_bank();get_last_date();ajax_saldo(\'first_sold\')";';
if ( $owner->MY_PJ_SUGGEST == 'Y') $add_js="onchange='update_pj();update_bank();get_last_date();'";
if ( $owner->MY_DATE_SUGGEST == 'Y')
$add_js='onchange="update_pj();update_bank();get_last_date();ajax_saldo(\'first_sold\')";';
$wLedger=$this->select_ledger('FIN',2);
if ($wLedger == null ) exit ('Pas de journal disponible');

View file

@ -467,19 +467,83 @@ class HtmlInput
return $r;
}
/**
*transform get to hidden
*transform request data to hidden
*@param $array is an of indices
*@param $request name of the superglobal $_POST $_GET $_REQUEST(default)
*@return html string with the hidden data
*/
static function array_to_hidden($array,$global_array )
{
$r="";
if ( count($global_array )==0) return '';
foreach ($array as $a)
{
if (isset($global_array [$a])) $r.=HtmlInput::hidden($a,$global_array [$a]);
}
return $r;
}
/**
*transform $_GET data to hidden
*@param $array is an of indices
*@see HtmlInput::request_to_hidden
*@return html string with the hidden data
*/
static function get_to_hidden($array)
{
if ( count($_GET) == 0) return "";
$r="";
foreach ( $array as $a)
{
if (isset($_GET[$a])) $r.=HtmlInput::hidden($a,$_GET[$a]);
}
$r=self::array_to_hidden($array,$_GET );
return $r;
}
/**
*transform $_POST data to hidden
*@param $array is an of indices
*@see HtmlInput::request_to_hidden
*@return html string with the hidden data
*/
static function post_to_hidden($array)
{
$r=self::array_to_hidden($array,$_POST );
return $r;
}
/**
*transform $_REQUEST data to hidden
*@param $array is an of indices
*@see HtmlInput::request_to_hidden
*@return html string with the hidden data
*/
static function request_to_hidden($array)
{
$r=self::array_to_hidden($array,$_REQUEST );
return $r;
}
}
/**
* generate an unique id for a widget,
*@param $p_prefix prefix
*@see HtmlInput::IDate
*@return string with a unique id
*/
static function generate_id($p_prefix)
{
$r=sprintf('%s_%d',$p_prefix,mt_rand(0,999999));
return $r;
}
/**
* return default if the value if the array doesn't exist
*@param $ind the index to check
*@param $default the value to return
*@param $array the array
*/
static function default_value($ind,$default,$array)
{
if ( ! isset($array[$ind]))
{
return $default;
}
return $array[$ind];
}
}

View file

@ -32,20 +32,21 @@ class IDate extends HtmlInput
$this->name=($p_name==null)?$this->name:$p_name;
$this->value=($p_value==null)?$this->value:$p_value;
if ( $this->readOnly==true) return $this->display();
$r='<input type="text" name="'.$this->name.'" id="'.$this->name.'"'.
$this->id=self::generate_id($this->name);
$r='<input type="text" name="'.$this->name.'" id="'.$this->id.'"'.
'style="border:solid 1px blue;"'.
'size="8"'.
' value ="'.$this->value.'"'.
'/>'.
'<img src="image/x-office-calendar.png" id="'.$this->name.'_trigger"'.
'<img src="image/x-office-calendar.png" id="'.$this->id.'_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
'inputField : "'.$this->id.'", // id of the input field
ifFormat : "%d.%m.%Y", // format of the input field
button : "'.$this->name.'_trigger", // trigger for the calendar (button ID)
button : "'.$this->id.'_trigger", // trigger for the calendar (button ID)
align : "Bl", // alignment (defaults to "Bl")
singleClick : true
});

View file

@ -167,7 +167,7 @@ if ( $def == 1 )
echo HtmlInput::submit('save',_('Sauve'));
echo HtmlInput::reset(_('Effacer'));
echo create_script(" get_last_date()");
echo create_script(" get_last_date();ajax_saldo('first_sold');");
exit();
}

View file

@ -165,8 +165,8 @@ if ( $sa == 'list' )
$offset=(isset($_REQUEST['offset']))?$_REQUEST['offset']:0;
$page=(isset($_REQUEST['page']))?$_REQUEST['page']:1;
$count=$cn->get_value("select count(*) from ac_dossier");
$size=10;
$size=(isset ($_SESSION['g_pagesize']))?$_SESSION['g_pagesize']:40;
if ( $size==-1) $size=200;
echo jrn_navigation_bar($offset,$count,$size,$page);
$repo=new Dossier(0);
$Res=$repo->show_dossier('all',$offset,$size);

View file

@ -24,6 +24,7 @@ $array=$todo->load_all();
echo '<div id="add_todo_list" class="add_todo_list">';
echo '<form method="post">';
$wDate=new IDate('p_date_todo');
$wDate->id='p_date_todo';
$wTitle=new IText('p_title');
$wDesc=new ITextArea('p_desc');
$wDesc->heigh=5;
@ -185,4 +186,4 @@ for($i=0;$i<count($last_operation);$i++):
</div>
</div>
</div>
</div>