noalyss Version-10
NOALYSS : serveur de comptabilité et ERP (2002)
Loading...
Searching...
No Matches
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/**
24 * \file
25 * \brief show bank saldo
26 *
27 */
28if (!defined('ALLOWED'))
29 die('Appel direct ne sont pas permis');
30echo '<div class="content">';
32
33$array=$fiche->get_bk_account();
34
35echo '<div class="content">';
36echo dossier::hidden();
37global $g_user;
38// Get exercice user
39$exercice=$g_user->get_exercice();
40// display exercice user
41echo h1(_("Exercice")." ".$exercice);
42echo _('Cherche').' : '.HtmlInput::filter_table("fin_saldo_tb", '0,1,2,3', '1');
43echo '<table class="sortable" style="margin-left:2%;width:96%" class="result" id="fin_saldo_tb">';
44echo tr(th('Quick Code', ' class=" sorttable_sorted"',
46 .th(_('Compte en banque'), ' style="text-align:left"')
47 .th(_('Journal'), ' style="text-align:center"')
48 .th(_('Description'), ' style="text-align:center"')
49 .th(_("Devise"))
50 .th(_("Montant Devise"))
51 .th(_('solde opération'),
52 ' style="text-align:right" class="sorttable_numeric"')
53 .th(_('solde extrait/relevé'),
54 ' style="text-align:right" class="sorttable_numeric"')
55 .th(_('différence'),
56 ' style="text-align:right" class="sorttable_numeric"')
57);
58// Filter the saldo
59// on the current year
60$filter_year=" j_tech_per in (select p_id from parm_periode where p_exercice='".$g_user->get_exercice()."')";
61// for highligting tje line
63bcscale(2);
65$nb_array=(empty($array))?0:count($array);
66// for each account
67for ($i=0; $i<$nb_array; $i++)
68{
69 if ($array[$i]->id==0)
70 {
71 echo '<tr >';
72 echo td(h2(_("Journal mal configuré"), ' class="error" '),
73 ' colspan="5" style="width:auto" ');
74 echo '</tr>';
75 continue;
76 }
77
78
79 // get the saldo
80 $m=$array[$i]->get_solde_detail($filter_year);
81
82 $solde=bcsub($m['debit'],$m['credit']);
83
84 // print the result if the saldo is not equal to 0
85 if ($m['debit']!=0.0||$m['credit']!=0.0)
86 {
87 // Get it in currency
88 $ledger=$array[$i]->get_bank_ledger();
89 $currency_code=$ledger->get_currency()->get_code();
90
91 /**
92 * if we don't use the defaut currency
93 */
94 if ( $ledger->get_currency()->get_id() == 0)
95 {
96 $currency_amount=$solde;
97 }
98 else
99 {
100 $currency_amount=$array[$i]->get_bk_balance_currency();
101
102 }
103 /* get saldo for not reconcilied operations */
104 $saldo_not_reconcilied=$array[$i]->get_bk_balance($filter_year." and (trim(jr_pj_number) ='' or jr_pj_number is null)");
105
106
107 /* get saldo for reconcilied operation */
108
109 $saldo_reconcilied=$array[$i]->get_bk_balance($filter_year." and ( trim(jr_pj_number) != '' and jr_pj_number is not null)");
110
111 if ($idx%2!=0)
112 $odd="odd";
113 else
114 $odd="even";
115
116 $idx++;
117 echo "<tr class=\"$odd\">";
118 echo "<TD >".
120 $array[$i]->get_attribute(ATTR_DEF_QUICKCODE)).
121 "</TD>";
122
123 $saldo_rec=noalyss_bcsub($saldo_reconcilied['debit'],
124 $saldo_reconcilied['credit']);
126 $saldo_not_reconcilied['credit']);
127 echo "<TD >".
128 $array[$i]->get_attribute(ATTR_DEF_NAME).
129 "</TD>".
130 td(h($array[$i]->ledger_name)).
131 td(h($array[$i]->ledger_description)).
132 td($currency_code).
133 '<TD class="sorttable_numeric" sorttable_customkey="'.$currency_amount.'" style="text-align:right">'.
134 nbm($currency_amount).
135 '</td>'.
136 '<TD class="sorttable_numeric" sorttable_customkey="'.$solde.'" style="text-align:right">'.
137 nbm($solde).
138 "</TD>".
139 '<TD class="sorttable_numeric" sorttable_customkey="'.$saldo_rec.'" style="text-align:right">'.
140 nbm($saldo_rec).
141 "</TD>".
142 '<TD class="sorttable_numeric" sorttable_customkey="'.$diff.'" style="text-align:right">'.
143 nbm($diff).
144 "</TD>".
145 "</TR>";
147 $tot_operation=bcadd($tot_operation, $saldo_rec);
148 $tot_diff=bcadd($tot_diff, $diff);
149 }
150}// for
151echo '<tfoot>';
152echo '<tr class="highlight">';
153echo td('');
154echo td('');
155echo td('');
156echo td(_('TOTAUX'), 'style="font-weight:bold;text-align:center"');
157echo td('');
158echo td('');
159echo td(nbm($tot_extrait), 'style="font-weight:bold" class="num"');
160echo td(nbm($tot_operation), ' style="font-weight:bold" class="num"');
161echo td(nbm($tot_diff), ' style="font-weight:bold" class="num"');
162echo '</tr>';
163
164echo '</tfoot>';
165echo "</table>";
166echo "</div>";
167return;
168?>
noalyss_bcsub($p_first, $p_second, $p_decimal=4)
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.
global $g_user
if no group available , then stop
h( $row[ 'oa_description'])
catch(Exception $e) $exercice
_("actif, passif,charge,...")
define Class fiche and fiche def, those class are using class attribut. When adding or modifing new c...
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_not_reconcilied
const ATTR_DEF_NAME
Definition constant.php:223
const ATTR_DEF_QUICKCODE
Definition constant.php:244