noalyss Version-9
compta_fin_saldo.inc.php
Go to the documentation of this file.
1<?php
2
3/*
4 * This file is part of NOALYSS.
5 *
6 * NOALYSS is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * NOALYSS is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with NOALYSS; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21// Copyright Author Dany De Bontridder danydb@aevalys.eu
22
23/* * \file
24 *
25 *
26 * \brief show bank saldo
27 *
28 */
29if (!defined('ALLOWED'))
30 die('Appel direct ne sont pas permis');
31echo '<div class="content">';
33
34$array=$fiche->get_bk_account();
35
36echo '<div class="content">';
37echo dossier::hidden();
38global $g_user;
39// Get exercice user
40$exercice=$g_user->get_exercice();
41// display exercice user
42echo h1(_("Exercice")." ".$exercice);
43echo _('Cherche').' : '.HtmlInput::filter_table("fin_saldo_tb", '0,1,2,3', '1');
44echo '<table class="sortable" style="margin-left:2%;width:96%" class="result" id="fin_saldo_tb">';
45echo tr(th('Quick Code', ' class=" sorttable_sorted"',
47 .th(_('Compte en banque'), ' style="text-align:left"')
48 .th(_('Journal'), ' style="text-align:center"')
49 .th(_('Description'), ' style="text-align:center"')
50 .th(_("Devise"))
51 .th(_("Montant Devise"))
52 .th(_('solde opération'),
53 ' style="text-align:right" class="sorttable_numeric"')
54 .th(_('solde extrait/relevé'),
55 ' style="text-align:right" class="sorttable_numeric"')
56 .th(_('différence'),
57 ' style="text-align:right" class="sorttable_numeric"')
58);
59// Filter the saldo
60// on the current year
61$filter_year=" j_tech_per in (select p_id from parm_periode where p_exercice='".$g_user->get_exercice()."')";
62// for highligting tje line
64bcscale(2);
66$nb_array=(empty($array))?0:count($array);
67// for each account
68for ($i=0; $i<$nb_array; $i++)
69{
70 if ($array[$i]->id==0)
71 {
72 echo '<tr >';
73 echo td(h2(_("Journal mal configuré"), ' class="error" '),
74 ' colspan="5" style="width:auto" ');
75 echo '</tr>';
76 continue;
77 }
78
79
80 // get the saldo
81 $m=$array[$i]->get_solde_detail($filter_year);
82
83 $solde=bcsub($m['debit'],$m['credit']);
84
85 // print the result if the saldo is not equal to 0
86 if ($m['debit']!=0.0||$m['credit']!=0.0)
87 {
88 // Get it in currency
89 $ledger=$array[$i]->get_bank_ledger();
90 $currency_code=$ledger->get_currency()->get_code();
91
92 /**
93 * if we don't use the defaut currency
94 */
95 if ( $ledger->get_currency()->get_id() == 0)
96 {
97 $currency_amount=$solde;
98 }
99 else
100 {
101 $currency_amount=$array[$i]->get_bk_balance_currency();
102
103 }
104 /* get saldo for not reconcilied operations */
105 $saldo_not_reconcilied=$array[$i]->get_bk_balance($filter_year." and (trim(jr_pj_number) ='' or jr_pj_number is null)");
106
107
108 /* get saldo for reconcilied operation */
109
110 $saldo_reconcilied=$array[$i]->get_bk_balance($filter_year." and ( trim(jr_pj_number) != '' and jr_pj_number is not null)");
111
112 if ($idx%2!=0)
113 $odd="odd";
114 else
115 $odd="even";
116
117 $idx++;
118 echo "<tr class=\"$odd\">";
119 echo "<TD >".
121 $array[$i]->strAttribut(ATTR_DEF_QUICKCODE)).
122 "</TD>";
123
124 $saldo_rec=noalyss_bcsub($saldo_reconcilied['debit'],
125 $saldo_reconcilied['credit']);
127 $saldo_not_reconcilied['credit']);
128 echo "<TD >".
129 $array[$i]->strAttribut(ATTR_DEF_NAME).
130 "</TD>".
131 td(h($array[$i]->ledger_name)).
132 td(h($array[$i]->ledger_description)).
133 td($currency_code).
134 '<TD class="sorttable_numeric" sorttable_customkey="'.$currency_amount.'" style="text-align:right">'.
135 nbm($currency_amount).
136 '</td>'.
137 '<TD class="sorttable_numeric" sorttable_customkey="'.$solde.'" style="text-align:right">'.
138 nbm($solde).
139 "</TD>".
140 '<TD class="sorttable_numeric" sorttable_customkey="'.$saldo_rec.'" style="text-align:right">'.
141 nbm($saldo_rec).
142 "</TD>".
143 '<TD class="sorttable_numeric" sorttable_customkey="'.$diff.'" style="text-align:right">'.
144 nbm($diff).
145 "</TD>".
146 "</TR>";
148 $tot_operation=bcadd($tot_operation, $saldo_rec);
149 $tot_diff=bcadd($tot_diff, $diff);
150 }
151}// for
152echo '<tfoot>';
153echo '<tr class="highlight">';
154echo td('');
155echo td('');
156echo td('');
157echo td(_('TOTAUX'), 'style="font-weight:bold;text-align:center"');
158echo td('');
159echo td('');
160echo td(nbm($tot_extrait), 'style="font-weight:bold" class="num"');
161echo td(nbm($tot_operation), ' style="font-weight:bold" class="num"');
162echo td(nbm($tot_diff), ' style="font-weight:bold" class="num"');
163echo '</tr>';
164
165echo '</tfoot>';
166echo "</table>";
167echo "</div>";
168return;
169?>
noalyss_bcsub($p_first, $p_second, $p_decimal=4)
Definition: ac_common.php:1557
h2($p_string, $p_class="", $raw="")
Definition: ac_common.php:68
th($p_string, $p_extra='', $raw='')
Definition: ac_common.php:58
h1($p_string, $p_class="")
Definition: ac_common.php:72
tr($p_string, $p_extra='')
Definition: ac_common.php:88
td($p_string='', $p_extra='')
surround the string with td
Definition: ac_common.php:83
nbm($p_number, $p_dec=2)
format the number with a sep.
Definition: ac_common.php:137
h( $row[ 'oa_description'])
define Class fiche and fiche def, those class are using class attribut. When adding or modifing new c...
Definition: fiche.class.php:38
static filter_table($p_table_id, $p_col, $start_row)
filter the rows in a table and keep the colored row in alternance
static history_card($f_id, $p_mesg, $p_style="", $p_exercice="")
display a div with the history of the card
static infobulle($p_comment)
Display a info in a bubble, text is in message_javascript.
$saldo_reconcilied
$saldo_not_reconcilied
global $g_user
const ATTR_DEF_NAME
Definition: constant.php:216
const ATTR_DEF_QUICKCODE
Definition: constant.php:237