Task #1457 & 1281 : operation ouverture séparée

This commit is contained in:
Dany De Bontridder 2018-01-11 16:52:26 +01:00
parent e892d79c53
commit 6c00cee4be
17 changed files with 192 additions and 72 deletions

View file

@ -286,10 +286,9 @@ if ( isset($_GET['view'] ) )
$bal->to_poste=$_GET['to_poste'];
if ( isset($_GET['unsold'])) $bal->unsold=true;
$previous=(isset($_GET['previous_exc']))?1:0;
$row=$bal->get_row($_GET['from_periode'],
$_GET['to_periode'],
$previous);
$from_periode=$http->get("from_periode","number");
$to_periode=$http->get("to_periode","number");
$row=$bal->get_row($from_periode,$to_periode);
$previous= (isset ($row[0]['sum_cred_previous']))?1:0;
$periode=new Periode($cn);
@ -312,18 +311,18 @@ if ( isset($_GET['view'] ) )
echo '<th>Solde N-1</th>';
}
echo '<th>'._('Ouverture').'</th>';
echo '<th>D&eacute;bit</th>';
echo '<th>Cr&eacute;dit</th>';
echo '<th>Solde D&eacute;biteur </th>';
echo '<th>Solde Cr&eacute;diteur</th>';
if ( isset($_GET['lvl1']) || isset($_GET['lvl2']) || isset($_GET['lvl3']))
echo '<th>Solde</th>';
echo '<th>Solde</th>';
// if ( isset($_GET['lvl1']) || isset($_GET['lvl2']) || isset($_GET['lvl3']))
// echo '<th>Solde</th>';
$i=0;
if ( $previous == 1) {
$a_sum=array('sum_cred','sum_deb','solde_deb','solde_cred','sum_cred_previous','sum_deb_previous','solde_deb_previous','solde_cred_previous');
}
else {
$a_sum=array('sum_cred','sum_deb','solde_deb','solde_cred') ;
$a_sum=array('sum_cred','sum_deb','solde_deb','solde_cred','sum_deb_ope','sum_cred_ope') ;
}
foreach($a_sum as $a)
{
@ -374,10 +373,21 @@ if ( isset($_GET['view'] ) )
echo td(nbm(abs($delta_previous))." $side_previous",'class="previous_year" style="text-align:right;font-weight:bold;" ');
}
echo td(nbm(${'lvl'.$ind}['sum_deb']),'style="text-align:right;font-weight:bold;" ');
echo td(nbm(${'lvl'.$ind}['sum_cred']),'style="text-align:right;font-weight:bold;"');
echo td(nbm(${'lvl'.$ind}['solde_deb']),'style="text-align:right;font-weight:bold;"');
echo td(nbm(${'lvl'.$ind}['solde_cred']),'style="text-align:right;font-weight:bold;"');
/*echo td(nbm(${'lvl'.$ind}['sum_deb']),'style="text-align:right;font-weight:bold;" ');
echo td(nbm(${'lvl'.$ind}['sum_cred']),'style="text-align:right;font-weight:bold;"');*/
// Ouverture
$solde3=bcsub(${'lvl'.$ind}['sum_deb_ope'],${'lvl'.$ind}['sum_cred_ope']);
$side3=($solde3<0)?" C":" D";
$side3=($solde3==0)?" ":$side3;
echo td(nbm(abs($solde3)).$side3);
// Saldo debit
$solde_deb=bcsub(${'lvl'.$ind}['sum_deb'],${'lvl'.$ind}['sum_deb_ope']);
echo td(nbm($solde_deb),'style="text-align:right;font-weight:bold;"');
// Saldo cred
$solde_cred=bcsub(${'lvl'.$ind}['sum_cred'],${'lvl'.$ind}['sum_cred_ope']);
echo td(nbm($solde_cred),'style="text-align:right;font-weight:bold;"');
$delta=bcsub(${'lvl'.$ind}['solde_cred'],${'lvl'.$ind}['solde_deb']);
$side=($delta > 0 ) ? "C":"D";
echo td(nbm(abs($delta))." $side",'style="text-align:right;font-weight:bold;" ');
@ -407,6 +417,7 @@ if ( isset($_GET['view'] ) )
echo '<TR class="'.$tr.'">';
echo td($view_history);
echo td(h($r['label']));
if ($previous == 1 ) {
echo td(nbm($r['sum_deb_previous']),' class="previous_year"');
echo td(nbm($r['sum_cred_previous']),' class="previous_year" ');
@ -423,10 +434,19 @@ if ( isset($_GET['view'] ) )
$r['sum_cred_previous']);
}
echo td(nbm($r['sum_deb']),'style="text-align:right;"');
echo td(nbm($r['sum_cred']),'style="text-align:right;"');
echo td(nbm($r['solde_deb']),'style="text-align:right;"');
echo td(nbm($r['solde_cred']),'style="text-align:right;"');
$solde=bcsub($r['sum_deb_ope'],$r['sum_cred_ope']);
$side=($solde < 0)?" C":" D";
$side=($solde==0)?"":$side;
echo td(nbm(abs($solde)).$side,'style="text-align:right;"');
echo td(nbm(bcsub($r['sum_deb'],$r['sum_deb_ope'])),'style="text-align:right;"');
echo td(nbm(bcsub($r['sum_cred'],$r['sum_cred_ope'])),'style="text-align:right;"');
$solde2=bcsub($r['sum_deb'],$r['sum_cred']);
$side=($solde2 < 0)?" C":" D";
$side=($solde2==0)?"":$side;
echo td(nbm(abs($solde2)).$side,'style="text-align:right;"');
if ( isset($_GET['lvl1']) || isset($_GET['lvl2']) || isset($_GET['lvl3'])) echo '<td></td>';
echo '</TR>';