Format properly the date and add a footer to some table

This commit is contained in:
Dany De Bontridder 2010-07-04 00:07:28 +00:00
parent 76ce776d76
commit ad0deb4751
6 changed files with 41 additions and 15 deletions

View file

@ -12,12 +12,18 @@ BODY {
font-style: italic;
}
table.result,table.document {
table.result,table.document ,table.resultfooter{
color:blue;
border:1px solid blue ;
width:100%;
border-spacing: 0px;
border-collapse:collapse;
}
table.resultfooter tfoot {
font-size:110%;
font-weight: bold;
}
table.result th, table.document th {
font-weight:bold;

View file

@ -523,6 +523,18 @@ function shrink_date ($p_date) {
$date=str_replace('.','',$p_date);
$str_date=substr($date,0,4).substr($date,6,2);
return $str_date;
}
/**
*@brief format the date, when taken from the database the format
* is MM-DD-YYYY
*@param $p_date format YYYY-MM-DD
*@return date in the format DD.MM.YYYY
*/
function format_date ($p_date) {
$date=explode('-',$p_date);
if ( count($date) != 3) return $p_date;
$str_date=$date[2].'.'.$date[1].'.'.$date[0];
return $str_date;
}
/**
*@brief ereg is not supported from the version 5.3 and is marked as

View file

@ -281,7 +281,8 @@ function get_solde_detail($p_cond="") {
$rep="";
echo '<h2 class="info">'.$this->id." ".$this->name.'</h2>';
echo "<TABLE class=\"result\" width=\"100%\">";
echo "<TABLE class=\"resultfooter\" width=\"100%\">";
echo '<tbody>';
echo "<TR>".
"<TH> Code interne </TH>".
"<TH> Date</TH>".
@ -306,15 +307,18 @@ function get_solde_detail($p_cond="") {
"</TR>";
}
echo '<tfoot>';
$solde_type=($tot_deb>$tot_cred)?"solde débiteur":"solde créditeur";
$diff=round(abs($tot_deb-$tot_cred),2);
echo "<TR>".
"<TD>$solde_type</TD>".
"<TD>$diff</TD>".
"<TD></TD>".
"<TD>$tot_deb</TD>".
"<TD>$tot_cred</TD>".
"<TD>$solde_type</TD>".
"<TD style=\"text-align:right\">$diff</TD>".
"<TD></TD>".
"<TD style=\"text-align:right\">$tot_deb</TD>".
"<TD style=\"text-align:right\">$tot_cred</TD>".
"</TR>";
echo '</tfoot>';
echo '</tbody>';
echo "</table>";

View file

@ -434,7 +434,7 @@ function display_form_plan($p_array,$p_null,$p_mode,$p_seq,$p_amount,$p_id='') {
if ( $p_mode==1 ) {
// editable
$select->readonly=false;
if ( isset($hplan) )
if ( isset($hplan) && isset($hplan[$p_seq][$count]) )
$select->selected=$hplan[$p_seq][$count];
} else {
// view only

View file

@ -1054,7 +1054,8 @@ av_text1=>'name'
$rep="";
echo '<h2 class="info">'." ".$name.'</h2>';
echo "<TABLE class=\"result\" width=\"100%\">";
echo "<TABLE class=\"resultfooter\" width=\"100%\">";
echo '<tbody>';
echo "<TR>".
"<TH>"._('Code interne')." </TH>".
"<TH>"._('Date')."</TH>".
@ -1069,10 +1070,9 @@ av_text1=>'name'
$op['jr_id'], dossier::id(), $op['jr_internal']);
$let='';
if ( $op['letter'] !=-1) $let=$op['letter'];
echo "<TR>".
"<TD>".$vw_operation."</TD>".
"<TD>".$op['j_date_fmt']."</TD>".
"<TD>".format_date($op['j_date_fmt'])."</TD>".
"<TD>".h($op['description'])."</TD>".
"<TD style=\"text-align:right\">".$op['deb_montant']."</TD>".
"<TD style=\"text-align:right\">".$op['cred_montant']."</TD>".
@ -1082,13 +1082,17 @@ av_text1=>'name'
}
$solde_type=($tot_deb>$tot_cred)?"solde débiteur":"solde créditeur";
$diff=round(abs($tot_deb-$tot_cred),2);
echo '<tfoot>';
echo "<TR>".
"<TD>$solde_type</TD>".
"<TD>$diff</TD>".
"<TD style=\"text-align:right\">$diff</TD>".
"<TD></TD>".
"<TD>$tot_deb</TD>".
"<TD>$tot_cred</TD>".
"<TD style=\"text-align:right\">$tot_deb</TD>".
"<TD style=\"text-align:right\">$tot_cred</TD>".
"</TR>";
echo '</tfoot>';
echo '</tbody>';
echo "</table>";

View file

@ -17,7 +17,7 @@ require_once ('class_anc_plan.php');
<? echo HtmlInput::hidden('whatdiv',$div).HtmlInput::hidden('jr_id',$jr_id).dossier::hidden();?>
<table>
<tr>
<? echo td('Date').td($obj->det->jr_date);?>
<? echo td('Date').td(format_date($obj->det->jr_date));?>
</tr>
<tr>