Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
00038 require_once('class_user.php');
00039 require_once('class_dossier.php');
00040 require_once('class_fiche.php');
00041 extract($_GET);
00042
00043 foreach ( array('j','ctl') as $a )
00044 {
00045 if ( ! isset(${$a}) )
00046 {
00047 echo "missing $a";
00048 return;
00049 }
00050 }
00051
00052 if ( $g_user->check_jrn($_GET['j'])=='X' ) return '{"saldo":"0"}';
00053
00054
00055 $filter_year=" j_tech_per in (select p_id from parm_periode ".
00056 "where p_exercice='".$g_user->get_exercice()."')";
00057
00058
00059 $id=$cn->get_value('select jrn_def_bank from jrn_def where jrn_def_id=$1',array($_GET['j']));
00060 $acc=new Fiche($cn,$id);
00061
00062 $res=$acc->get_bk_balance($filter_year." and ( trim(jr_pj_number) != '' and jr_pj_number is not null)" );
00063
00064
00065 if ( empty($res) ) return '{"saldo":"0"}';
00066 $solde=$res['solde'];
00067 if ( $res['debit'] < $res['credit'] ) $solde=$solde*(-1);
00068
00069
00070 echo '{"saldo":"'.$solde.'"}';
00071
00072
00073
00074 ?>
00075