32if (!defined(
'ALLOWED')) die(
'Appel direct ne sont pas permis');
33include_once(
"lib/ac_common.php");
34include_once(
"class/acc_balance.class.php");
35require_once NOALYSS_INCLUDE .
'/header_print.php';
51}
catch (Exception $exc) {
52 error_log(
"Missing parameters");
53 error_log($exc->getTraceAsString());
68 if (isset(
$_GET[
'r_jrn'])) {
88if (isset(
$_GET[
'unsold']))
$bal->unsold =
true;
117$pdf->SetAuthor(
'NOALYSS');
118$pdf->SetFont(
'DejaVuCond',
'', 7);
119$pdf->setTitle(_(
"Balance comptable"),
true);
120$pdf->write_cell(30, 6, _(
'poste'));
121$pdf->LongLine(60, 6, _(
'Libellé'));
123 $pdf->write_cell(20, 6,
'Débit N-1', 0, 0,
'R');
124 $pdf->write_cell(20, 6,
'Crédit N-1', 0, 0,
'R');
125 $pdf->write_cell(20, 6,
'Solde N-1', 0, 0,
'R');
127$pdf->write_cell(25, 6, _(
'Ouverture'), 0, 0,
'R');
128$pdf->write_cell(25, 6, _(
'Total Débit'), 0, 0,
'R');
129$pdf->write_cell(25, 6, _(
'Total Crédit'), 0, 0,
'R');
130$pdf->write_cell(25, 6, _(
'Solde'), 0, 0,
'R');
133$pdf->SetFont(
'DejaVuCond',
'', 8);
144 $a_sum = array(
'sum_cred',
'sum_deb',
'solde_deb',
'solde_cred',
'sum_cred_previous',
'sum_deb_previous',
'solde_deb_previous',
'solde_cred_previous',
'sum_cred_ope',
'sum_deb_ope');
146 $a_sum = array(
'sum_cred',
'sum_deb',
'solde_deb',
'solde_cred',
'sum_cred_ope',
'sum_deb_ope');
165 if (
$value[
'poste'] ==
'')
continue;
166 foreach (array(3, 2, 1) as
$ind) {
168 if (!isset(
$_GET[
'lvl' .
$ind]))
continue;
170 if (${
'lvl' .
$ind .
'_old'} ==
'') ${
'lvl' .
$ind .
'_old'} = substr(
$r[
'poste'], 0,
$ind);
171 if (${
'lvl' .
$ind .
'_old'} != substr(
$r[
'poste'], 0,
$ind)) {
172 $pdf->SetFont(
'DejaVu',
'B', 7);
173 $strTotal=sprintf(_(
"Totaux %s "),${
'lvl' .
$ind .
'_old'});
174 $pdf->LongLine(30, 6, $strTotal,
"TB");
175 $delta = bcsub(${
'nlvl' .
$ind}[
'solde_cred'], ${
'nlvl' .
$ind}[
'solde_deb']);
178 $delta_previous = bcsub(${
'nlvl' .
$ind}[
'solde_cred_previous'], ${
'nlvl' .
$ind}[
'solde_deb_previous']);
179 $side_previous = ($delta_previous < 0) ?
"D" :
"C";
180 $pdf->write_cell(60, 6, sprintf(_(
"niveau %s"),
$ind),
"TB", 0,
'R');
181 $pdf->write_cell(22, 6,
nbm(${
'nlvl' .
$ind}[
'sum_deb_previous']),
"TB", 0,
'R');
182 $pdf->write_cell(22, 6,
nbm(${
'nlvl' .
$ind}[
'sum_cred_previous']),
"TB", 0,
'R');
183 $pdf->write_cell(22, 6,
nbm(abs($delta_previous)) .
" $side_previous",
"TB", 0,
'R');
186 $pdf->write_cell(60, 6, sprintf(_(
"niveau %s"),
$ind),
"TB", 0,
'R');
189 $solde_lv = bcsub(${
'nlvl' .
$ind}[
'sum_deb_ope'], ${
'nlvl' .
$ind}[
'sum_cred_ope']);
190 $side_lv = ($solde_lv < 0) ?
" C" :
" D";
191 $side_lv = ($solde_lv == 0) ?
" " : $side_lv;
192 $pdf->write_cell(25, 6,
nbm(abs($solde_lv)) . $side_lv,
"TB", 0,
'R');
193 $pdf->write_cell(25, 6,
nbm(bcsub(${
'nlvl' .
$ind}[
'sum_deb'], ${
'nlvl' .
$ind}[
'sum_deb_ope'])),
"TB", 0,
'R');
194 $pdf->write_cell(25, 6,
nbm(bcsub(${
'nlvl' .
$ind}[
'sum_cred'], ${
'nlvl' .
$ind}[
'sum_cred_ope'])),
"TB", 0,
'R');
195 $solde_lv = bcsub(${
'nlvl' .
$ind}[
'solde_deb'], ${
'nlvl' .
$ind}[
'solde_cred']);
196 $side_lv = ($solde_lv > 0) ?
"D" :
"C";
197 $side_lv = ($solde_lv == 0) ?
"" : $side_lv;
198 $pdf->write_cell(25, 6,
nbm(abs($solde_lv)) .
" $side_lv",
"TB", 0,
'R');
200 $pdf->SetFont(
'DejaVuCond',
'', 7);
201 ${
'lvl' .
$ind .
'_old'} = substr(
$r[
'poste'], 0,
$ind);
208 $nlvl1[
$a] = bcadd($nlvl1[
$a],
$r[
$a]);
209 $nlvl2[
$a] = bcadd($nlvl2[
$a],
$r[
$a]);
210 $nlvl3[
$a] = bcadd($nlvl3[
$a],
$r[
$a]);
216 if (in_array(
$r[
'type'],array(
'CHA',
'ACT',
'PASINV',
'PROINV')) &&
$value[
'sum_deb']<
$value[
'sum_cred'])
219 $label.=
" ".mb_chr(0x26a0);
221 if (in_array(
$r[
'type'],array(
'PRO',
'PAS',
'ACTINV',
'CHAINV')) &&
$value[
'sum_deb']>
$value[
'sum_cred'])
224 $label.=
" ".mb_chr(0x26a0);
227 $pdf->LongLine(60, 6,
$value[
'label'], 0,
'L', $fill);
232 $pdf->write_cell(22, 6,
nbm(
$value[
'sum_deb_previous']), 0, 0,
'R', $fill);
233 $pdf->write_cell(22, 6,
nbm(
$value[
'sum_cred_previous']), 0, 0,
'R', $fill);
237 $solde_previous = bcsub(
$value[
'solde_cred_previous'],
$value[
'solde_deb_previous']);
238 $side_previous = ($solde_previous < 0) ?
" D" :
" C";
239 $side_previous = ($solde_previous == 0) ?
"" : $side_previous;
241 $pdf->write_cell(22, 6,
nbm(abs($solde_previous)) . $side_previous, 0, 0,
'R', $fill);
249 $value[
'sum_deb_previous'],
250 $value[
'sum_cred_previous']);
252 $solde_ope = bcsub(
$value[
'sum_deb_ope'],
$value[
'sum_cred_ope']);
255 $side_ope = ($solde_ope > 0) ?
" D" :
"C";
256 $side_ope = ($solde_ope == 0) ?
" " : $side_ope;
260 $pdf->write_cell(25, 6,
nbm(abs($solde_ope)) . $side_ope, 0, 0,
'R', $fill);
261 $pdf->write_cell(25, 6,
nbm(
$deb), 0, 0,
'R', $fill);
274 foreach (array(3, 2, 1) as
$ind) {
276 if (!isset(
$_GET[
'lvl' .
$ind]))
continue;
278 if (${
'lvl' .
$ind .
'_old'} ==
'') ${
'lvl' .
$ind .
'_old'} = substr(
$r[
'poste'], 0,
$ind);
279 if (${
'lvl' .
$ind .
'_old'} != substr(
$r[
'poste'], 0,
$ind)) {
280 $pdf->SetFont(
'DejaVu',
'B', 7);
281 $pdf->write_cell(30, 6,
"Totaux " .
$ind);
282 $pdf->write_cell(60, 6, ${
'lvl' .
$ind .
'_old'});
284 $pdf->write_cell(22, 6,
nbm(${
'nlvl' .
$ind}[
'sum_deb_previous']), 0, 0,
'R');
285 $pdf->write_cell(22, 6,
nbm(${
'nlvl' .
$ind}[
'sum_cred_previous']), 0, 0,
'R');
286 $pdf->write_cell(22, 6,
nbm(${
'nlvl' .
$ind}[
'solde_deb_previous']), 0, 0,
'R');
287 $pdf->write_cell(22, 6,
nbm(${
'nlvl' .
$ind}[
'solde_cred_previous']), 0, 0,
'R');
289 $pdf->write_cell(25, 6,
nbm(${
'nlvl' .
$ind}[
'sum_deb']), 0, 0,
'R');
290 $pdf->write_cell(25, 6,
nbm(${
'nlvl' .
$ind}[
'sum_cred']), 0, 0,
'R');
291 $solde_lv = bcsub(${
'nlvl' .
$ind}[
'solde_deb'], ${
'nlvl' .
$ind}[
'solde_cred']);
293 $pdf->write_cell(25, 6,
nbm(abs($solde_lv)) .
" $side_lv", 0, 0,
'R');
295 $pdf->SetFont(
'DejaVuCond',
'', 7);
296 ${
'lvl' .
$ind .
'_old'} = substr(
$r[
'poste'], 0,
$ind);
304 $pdf->SetFont(
'DejaVuCond',
'B', 8);
305 $pdf->write_cell(90, 6,
$r[
'label']);
322 $pdf->write_cell(25, 6,
nbm(abs(
$solde)).$solde_side,
'T', 0,
'R', 0);
329 $pdf->SetFont(
'DejaVuCond',
'B', 8);
330 $pdf->write_cell(50, 8, _(
"Résumé Exercice précédent"));
332 $pdf->SetFont(
'DejaVuCond',
'', 7);
336 $pdf->SetFont(
'DejaVuCond',
'B', 8);
337 $pdf->write_cell(50, 8, _(
"Résumé Exercice courant"));
339 $pdf->SetFont(
'DejaVuCond',
'', 7);
344$pdf->Output(
'balance-' .
$fDate .
'.pdf',
'D');
findSide($p_number)
return D if the number is smaller than 0 , C if bigger and an empty string if equal to 0.
get_array_column($p_array, $key)
nbm($p_number, $p_dec=2)
format the number with a sep.
global $g_user
if no group available , then stop
catch(Exception $exc) if(! $g_user->can_write_action($ag_id)) $r
for($i=0;$i<=6;$i++) $ind
Class for manipulating data to print the balance of account.
contains the class for connecting to Noalyss
API for creating PDF, unicode, based on tfpdf.
For the periode tables parm_periode and jrn_periode.
catch(Exception $exc) $summary_tab
foreach($a_sum as $a) $lvl1_old
if(!empty( $array)) if($is_summary==1) $fDate
empty
if(sizeof($array)==0) $pPeriode
for($e=0; $e< count($afiche); $e++) exit
for($e=2;$e< $nb_col;$e++) $a_sum
for($i=0;$i< $nb_jrn;$i++) $deb