[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 166/323: PRINTBAL : add opening , correct
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 166/323: PRINTBAL : add opening , correct |
Date: |
Wed, 14 Mar 2018 17:38:43 -0400 (EDT) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit 1a6b26b536885321bf08773144598728cec6225d
Author: Dany De Bontridder <address@hidden>
Date: Fri Feb 9 23:03:50 2018 +0100
PRINTBAL : add opening , correct
---
include/balance.inc.php | 52 ++++++++++++++++-------------------
include/class/acc_balance.class.php | 17 ++++++------
include/export/export_balance_pdf.php | 36 +++++++++++++++---------
3 files changed, 56 insertions(+), 49 deletions(-)
diff --git a/include/balance.inc.php b/include/balance.inc.php
index 7661e05..859be10 100644
--- a/include/balance.inc.php
+++ b/include/balance.inc.php
@@ -297,7 +297,7 @@ if ( isset($_GET['view'] ) )
$previous=(isset($_GET['previous_exc']))?1:0;
$from_periode=$http->get("from_periode","number");
$to_periode=$http->get("to_periode","number");
- $row=$bal->get_row($from_periode,$to_periode);
+ $row=$bal->get_row($from_periode,$to_periode,$previous);
$previous= (isset ($row[0]['sum_cred_previous']))?1:0;
$periode=new Periode($cn);
@@ -314,21 +314,17 @@ if ( isset($_GET['view'] ) )
if ( $previous == 1 ){
echo '<th>'._("Débit N-1").'</th>';
echo '<th>'._('Crédit N-1').'</th>';
- echo '<th>'._('Solde Débiteur N-1').'</th>';
- echo '<th>'._('Solde Créditeur N-1').'</th>';
- if ( isset($_GET['lvl1']) || isset($_GET['lvl2']) ||
isset($_GET['lvl3']))
- echo '<th>Solde N-1</th>';
+ echo '<th>'._('Solde N-1').'</th>';
}
echo '<th>'._('Ouverture').'</th>';
echo '<th>'._('Débit').'</th>';
echo '<th>'._('Crédit').'</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');
+
$a_sum=array('sum_cred','sum_deb','solde_deb','solde_cred','sum_deb_ope','sum_cred_ope','sum_cred_previous','sum_deb_previous','solde_previous');
}
else {
$a_sum=array('sum_cred','sum_deb','solde_deb','solde_cred','sum_deb_ope','sum_cred_ope')
;
@@ -357,7 +353,9 @@ if ( isset($_GET['view'] ) )
else
$tr="odd";
$view_history=HtmlInput::history_account($r['poste'], $r['poste'],
"",$exercice);
-
+ if ($previous == 1 ) {
+
$r['solde_previous']=bcsub($r['solde_deb_previous'],$r['solde_cred_previous']);
+ }
/*
* level x
*/
@@ -371,23 +369,22 @@ if ( isset($_GET['view'] ) )
echo '<tr class="highlight">';
echo td(${'lvl'.$ind.'_old'},'style="font-weight:bold;"');
echo td(${'lvl'.$ind.'_old'}." "._("Total niveau")."
".$ind,'style="font-weight:bold;"');
+
+ // compare with previous exercice
if ($previous==1) {
echo
td(nbm(${'lvl'.$ind}['sum_deb_previous']),'class="previous_year"
style="font-weight:bold;"');
echo td(nbm(${'lvl'.$ind}['sum_cred_previous']),'
class="previous_year" style="font-weight:bold;" ');
- echo
td(nbm(${'lvl'.$ind}['solde_deb_previous']),'class="previous_year"
style="font-weight:bold;"');
- echo
td(nbm(${'lvl'.$ind}['solde_cred_previous']),'class="previous_year"
style="font-weight:bold;"');
-
$delta_previous=bcsub(${'lvl'.$ind}['solde_cred_previous'],${'lvl'.$ind}['solde_deb_previous']);
- $side_previous=($delta_previous > 0 ) ? "C":"D";
+ $delta_previous=${'lvl'.$ind}['solde_previous'];
+ $side_previous=($delta_previous > 0 ) ? "D":"C";
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;"');*/
+
// 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);
+ echo
td(nbm(abs($solde3)).$side3,'style="text-align:right;font-weight:bold;"');
// Saldo debit
$solde_deb=bcsub(${'lvl'.$ind}['sum_deb'],${'lvl'.$ind}['sum_deb_ope']);
@@ -409,12 +406,12 @@ if ( isset($_GET['view'] ) )
}
}
- foreach($a_sum as $a)
- {
- $lvl1[$a]=bcadd($lvl1[$a],$r[$a]);
- $lvl2[$a]=bcadd($lvl2[$a],$r[$a]);
- $lvl3[$a]=bcadd($lvl3[$a],$r[$a]);
- }
+ foreach($a_sum as $a)
+ {
+ $lvl1[$a]=bcadd($lvl1[$a],$r[$a]);
+ $lvl2[$a]=bcadd($lvl2[$a],$r[$a]);
+ $lvl3[$a]=bcadd($lvl3[$a],$r[$a]);
+ }
// For the Total row , there is no accounting
if ( $r['poste'] == "") {
$tr="highlight";
@@ -429,12 +426,11 @@ if ( isset($_GET['view'] ) )
if ($previous == 1 ) {
echo td(nbm($r['sum_deb_previous']),' class="previous_year"');
echo td(nbm($r['sum_cred_previous']),' class="previous_year" ');
- echo td(nbm($r['solde_deb_previous']),' class="previous_year"');
- echo td(nbm($r['solde_cred_previous']),'class="previous_year" ');
- if ( isset($_GET['lvl1']) ||
- isset($_GET['lvl2']) ||
- isset($_GET['lvl3']))
- echo '<td></td>';
+
$solde_previous=bcsub($r['solde_deb_previous'],$r['solde_cred_previous']);
+ $side=($solde_previous<0)?"D":"C";
+ $side=($solde_previous==0)?"":$side;
+ $r['solde_previous']=$solde_previous;
+ echo td(nbm(abs($solde_previous))." ".$side,'
class="previous_year"');
$summary_prev_tab=$bal->summary_add($summary_prev_tab,
$r['poste'],
diff --git a/include/class/acc_balance.class.php
b/include/class/acc_balance.class.php
index 0c65a23..d0c956f 100644
--- a/include/class/acc_balance.class.php
+++ b/include/class/acc_balance.class.php
@@ -138,12 +138,17 @@ class Acc_Balance
$per_sql_previous=sql_filter_per($this->db,$previous_start->p_id,$previous_end->p_id,'p_id','j_tech_per');
$sql="
with m as
- ( select j_poste,sum(deb) as sdeb,sum(cred) as
scred
+ ( select j_poste,sum(deb) as sdeb,sum(cred) as
scred,
+ sum(deb_op) as sum_deb_ope ,
+ sum(cred_op) as sum_cred_ope
from
(select j_poste,
case when j_debit='t' then j_montant else
0 end as deb,
- case when j_debit='f' then j_montant else
0 end as cred
+ case when j_debit='f' then j_montant else
0 end as cred ,
+ case when j_debit='t' and jr_optype='OPE'
then j_montant else 0 end as deb_op,
+ case when j_debit='f' and jr_optype='OPE'
then j_montant else 0 end as cred_op
from jrnx
+ join jrn on (j_grpt=jr_grpt_id)
join tmp_pcmn on (j_poste=pcm_val)
left join parm_periode on (j_tech_per =
p_id)
join jrn_def on (j_jrn_def=jrn_def_id)
@@ -152,15 +157,11 @@ class Acc_Balance
$and $filter_sql and $per_sql
) as sub_m group by j_poste order by
j_poste ) ,
p as ( select j_poste,sum(deb) as sdeb,
- sum(cred) as scred ,
- sum(deb_op) as sum_deb_ope ,
- sum(cred_op) as sum_cred_ope
+ sum(cred) as scred
from
(select j_poste,
case when j_debit='t' then j_montant
else 0 end as deb,
- case when j_debit='f' then j_montant
else 0 end as cred ,
- case when j_debit='t' and
jr_optype='OPE' then j_montant else 0 end as deb_op,
- case when j_debit='f' and
jr_optype='OPE' then j_montant else 0 end as cred_op
+ case when j_debit='f' then j_montant
else 0 end as cred
from jrnx join tmp_pcmn on
(j_poste=pcm_val)
left join parm_periode on (j_tech_per
= p_id)
join jrn_def on (j_jrn_def=jrn_def_id)
diff --git a/include/export/export_balance_pdf.php
b/include/export/export_balance_pdf.php
index 4879bca..bc0d4ea 100644
--- a/include/export/export_balance_pdf.php
+++ b/include/export/export_balance_pdf.php
@@ -110,11 +110,15 @@ $pPeriode=new Periode($cn);
$a=$pPeriode->get_date_limit($from_periode);
$b=$pPeriode->get_date_limit($to_periode);
$per_text=" du ".$a['p_start']." au ".$b['p_end'];
+
+// If compare with previous exercice ,
+// we use the landscape mode
if ($previous == 1 ) {
$pdf=new PDFLand($cn);
} else {
$pdf= new PDF($cn);
}
+
$pdf->setDossierInfo(" Balance ".$per_text);
$pdf->AliasNbPages();
$pdf->AddPage();
@@ -129,9 +133,9 @@ if ($previous == 1 ){
$pdf->write_cell(20,6,'Solde N-1',0,0,'R');
}
$pdf->write_cell(25,6,_('Ouverture'),0,0,'R');
-$pdf->write_cell(25,6,'Total Débit',0,0,'R');
-$pdf->write_cell(25,6,'Total Crédit',0,0,'R');
-$pdf->write_cell(25,6,'Solde Débiteur',0,0,'R');
+$pdf->write_cell(25,6,_('Total Débit'),0,0,'R');
+$pdf->write_cell(25,6,_('Total Crédit'),0,0,'R');
+$pdf->write_cell(25,6,_('Solde Débiteur'),0,0,'R');
$pdf->line_new();
$pdf->SetFont('DejaVuCond','',8);
@@ -185,20 +189,19 @@ if (! empty($array))
if ($previous == 1 ) {
$delta_previous=bcsub(${'nlvl'.$ind}['solde_cred_previous'],${'nlvl'.$ind}['solde_deb_previous']);
$side_previous=($delta_previous < 0) ? "D":"C";
- $pdf->write_cell(30,6,"n-1 : " .nbm($delta_previous)."
$side_previous",0,0,'R');
- $pdf->write_cell(30,6," n : ".nbm($delta)."
$side",0,0,'R');
+ $pdf->write_cell(60,6," ",0,0,'R');
$pdf->write_cell(22,6,nbm(${'nlvl'.$ind}['sum_deb_previous']),0,0,'R');
$pdf->write_cell(22,6,nbm(${'nlvl'.$ind}['sum_cred_previous']),0,0,'R');
-
$pdf->write_cell(22,6,nbm(${'nlvl'.$ind}['solde_deb_previous']),0,0,'R');
-
$pdf->write_cell(22,6,nbm(${'nlvl'.$ind}['solde_cred_previous']),0,0,'R');
+ $pdf->write_cell(22,6,nbm(abs($delta_previous))."
$side_previous",0,0,'R');
+
} else {
$pdf->write_cell(60,6," ",0,0,'R');
-
$solde_lv=bcsub(${'nlvl'.$ind}['sum_deb_ope'],${'nlvl'.$ind}['sum_cred_ope']);
- $side_lv=($solde_lv<0)?" D":" C";
- $side_lv=($solde_lv==0)?" ":$side_lv;
-
$pdf->write_cell(25,6,nbm(abs($solde_lv)).$side_lv,0,0,'R');
}
+
$solde_lv=bcsub(${'nlvl'.$ind}['sum_deb_ope'],${'nlvl'.$ind}['sum_cred_ope']);
+ $side_lv=($solde_lv<0)?" C":" D";
+ $side_lv=($solde_lv==0)?" ":$side_lv;
+ $pdf->write_cell(25,6,nbm(abs($solde_lv)).$side_lv,0,0,'R');
$pdf->write_cell(25,6,nbm(bcsub(${'nlvl'.$ind}['sum_deb'],${'nlvl'.$ind}['sum_deb_ope'])),0,0,'R');
$pdf->write_cell(25,6,nbm(bcsub(${'nlvl'.$ind}['sum_cred'],${'nlvl'.$ind}['sum_cred_ope'])),0,0,'R');
$solde_lv=bcsub(${'nlvl'.$ind}['solde_deb'],${'nlvl'.$ind}['solde_cred']);
@@ -240,8 +243,15 @@ if (! empty($array))
if ($previous == 1 ) {
$pdf->write_cell(22,6,nbm($value['sum_deb_previous']),0,0,'R',$fill);
$pdf->write_cell(22,6,nbm($value['sum_cred_previous']),0,0,'R',$fill);
-
$pdf->write_cell(22,6,nbm($value['solde_deb_previous']),0,0,'R',$fill);
-
$pdf->write_cell(22,6,nbm($value['solde_cred_previous']),0,0,'R',$fill);
+
+//
$pdf->write_cell(22,6,nbm($value['solde_deb_previous']),0,0,'R',$fill);
+//
$pdf->write_cell(22,6,nbm($value['solde_cred_previous']),0,0,'R',$fill);
+
$solde_previous=bcsub($value['solde_cred_previous'],$value['solde_deb_previous']);
+ $side_previous=($solde_previous<0)?" D":" C";
+ $side_previous=($solde_previous==0)?"":$side_previous;
+
+
$pdf->write_cell(22,6,nbm(abs($solde_previous)).$side_previous,0,0,'R',$fill);
+
$tp_deb_previous=bcadd($tp_deb_previous,$value['sum_deb_previous']);
$tp_cred_previous=bcadd($tp_cred_previous,$value['sum_cred_previous']);
$tp_sold_previous=bcadd($tp_sold_previous,$value['solde_deb_previous']);
- [Noalyss-commit] [noalyss] 145/323: merge rel6919.9, (continued)
- [Noalyss-commit] [noalyss] 145/323: merge rel6919.9, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 159/323: bug: error js in Icon_Action::close, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 171/323: History based on the date of the operation which it comes from, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 162/323: esthetic : improve title2, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 158/323: bug: cannot create user, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 167/323: Suppress obsolete files, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 174/323: Improve Documentation, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 172/323: History accounting / card : first column is date, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 176/323: Manage_Table_SQL : Add tips for some col, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 164/323: Periode : change with exercice, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 166/323: PRINTBAL : add opening , correct,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 177/323: PRINTBAL : correct bug , exercice not get, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 173/323: Esthetic : put the anchor at a better place, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 154/323: FIX : PRINTJRN, ledger PDF and CSV, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 168/323: suppress useless file, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 169/323: Install : accept postgresql 10, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 165/323: PRINTBAL translate, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 197/323: CSS classic 7 : menu use font OpenSansRegular instead of SansaLight, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 199/323: CSS classic 7 : menu use font OpenSansRegular instead of SansaLight, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 163/323: Remove unused file, Dany De Bontridder, 2018/03/14
- [Noalyss-commit] [noalyss] 201/323: CSS : page login : forgotten email, Dany De Bontridder, 2018/03/14