29if ( ! defined (
'ALLOWED') ) die(
'Appel direct ne sont pas permis');
34 var Bank_Reconciliation =
41 activate_checkbox_range:
function (p_range_name) {
42 let node_lstCheckBox = document.getElementsByClassName(p_range_name);
43 var aCheckBox=Array.from(node_lstCheckBox)
44 if (aCheckBox == undefined) {
45 console.error(
"Bank_Reconciliation.activate_checkbox_range_failed")
48 aCheckBox.forEach(elt => elt.addEventListener (
'click',function (event) {
49 Bank_Reconciliation.checkbox_set_range(event, elt, p_range_name);
52 checkbox_set_range:
function (evt, elt, p_name) {
57 var aName = document.getElementsByClassName(p_name);
61 for (var i = 0; i < aName.length; i++) {
62 if (aName[i] == elt) {
66 if (aName[i] == lastcheck) {
75 var check = (aName[
from].checked) ?
true :
false;
76 for (x =
from; x <= end; x++) {
77 aName[x].checked = check;
78 if( x < end && x >
from ) {
79 Bank_Reconciliation.update_selected(aName[x],aName[x].getAttribute(
'amount_operation'));
80 Bank_Reconciliation.update_remain(aName[x],aName[x].getAttribute(
'amount_operation'));
86 update_selected:
function (p_node,p_amount) {
88 p_amount=parseFloat(p_amount);
92 var
selected=parseFloat($(
'selected_amount').innerHTML)+p_amount;
93 $(
'selected_amount').innerHTML=Math.round(
selected*100)/100;
95 var
selected=parseFloat($(
'selected_amount').innerHTML)-p_amount;
96 $(
'selected_amount').innerHTML=Math.round(
selected*100)/100;
100 if (console) {console.error(
'Bank_Reconciliation.update_selected :'+e.message);}
103 update_remain:
function (p_node,p_amount) {
104 p_amount=parseFloat(p_amount);
106 if ( parseFloat($(
'delta_amount').innerHTML) == 0)
return;
109 var
selected=parseFloat($(
'remain_amount').innerHTML)-p_amount;
110 $(
'remain_amount').innerHTML=Math.round(
selected*100)/100;
112 var
selected=parseFloat($(
'remain_amount').innerHTML)+p_amount;
113 $(
'remain_amount').innerHTML=Math.round(
selected*100)/100;
117 if (console) {console.error(
'Bank_Reconciliation.update_remain :'+e.message);}
121 update_delta:
function () {
123 var delta=parseFloat($(
'end_extrait').
value)-parseFloat($(
'start_extrait').
value);
124 delta=Math.round(delta*100)/100;
125 $(
'delta_amount').innerHTML=delta;
126 var remain=delta-parseFloat($(
'selected_amount').innerHTML);
127 $(
'remain_amount').innerHTML=Math.round(remain*100)/100;
129 if (console) {console.error(
'Bank_Reconciliation.update_delta :' +e.message);}
132 recompute:
function (p_form) {
136 for (i=0;i<form.length;i++) {
137 var e=form.elements[i];
138 if (e.type==
'checkbox') {
142 remove_waiting_box();
144 if (console) {console.error(
'Bank_Reconciliation.recompute :' +e.message);}
150echo
'<div class="content">';
155 if ( isset(
$a[
'jrn_def_id'])) {
175 echo
'<span class="notice">';
176 echo _(
'Donnée invalide');
182 echo
'<span class="notice">';
183 echo _(
'Donnée invalide');
192 $receipt_nb=
$http->post(
"ext");
193 if (trim($receipt_nb) ==
'' && isset(
$_POST[
'op'])) {
196 if (trim($receipt_nb) !=
'' && isset(
$_POST[
'op']))
203 $cn->exec_sql(
'update jrn set jr_pj_number=$1 where jr_id=$2', array(
$_POST[
'ext'],
$array[
$i]));
204 $tot = bcadd(
$tot,
$cn->get_value(
'select qf_amount from quant_fin where jr_id=$1', array(
$array[
$i])));
211 alert(
"D'après l'extrait il y aurait du avoir un montant de $diff à rapprocher alors qu'il y a $tot rapprochés, mise à jour annulée, la différence est de $remain");
212 echo
'<div class="error">';
213 echo
'<p>'.$g_failed._(
"D'après l'extrait il y aurait du avoir un montant de $diff à rapprocher alors qu'il y a $tot rapprochés, la différence est de $remain <br>mise à jour annulée").
'</p>';
216 _(
'Attention : Fichier non chargé').
222 echo
'<div class="content">'.$g_succeed.
' Mise à jour extrait '.
$_POST[
'ext'].
'</div>';
224 $oid=
$cn->upload(
'file_receipt');
226 if ( $oid !=
false ) {
229 $cn->exec_sql(
"update jrn set jr_pj=$1 , jr_pj_name=$2,
230 jr_pj_type=$3 where jr_id=$4",
231 array($oid,$_FILES[
'file_receipt'][
'name'] ,$_FILES[
'file_receipt'][
'type'],
$array[
$i]));
243echo
'<div class="content">';
244echo
'<form method="get">';
248 exit(
'Pas de journal disponible');
249echo
'<div id="jrn_name_div">';
250echo
'<h1 id="jrn_name" style="display:inline">' .
$Ledger->get_name() .
'</h1>';
252$wLedger->javascript =
"onchange='this.form.submit()';";
256echo
'<span id="bkname" style="display:block">' .
hb(
h(
$Ledger->get_bank_name())) .
'</span>';
258echo
'<form method="post" id="rec1" enctype="multipart/form-data">';
260echo dossier::hidden();
265 to_char(jr_date,'DD.MM.YYYY') as fmt_date,
267 to_char(jr_date,'YYYYMMDD') as raw_date
268 from jrn where jr_def_id=$1 and (jr_pj_number is null or jr_pj_number='') order by jr_date", array(
$Ledger->id));
276$nstart_extrait->javascript=
'onchange="format_number(this,2);Bank_Reconciliation.update_delta();"';
280$nend_extrait->javascript=
'onchange="format_number(this,2);Bank_Reconciliation.update_delta();"';
282echo _(
"Extrait / relevé :") .
$iextrait->input();
287$take_end->javascript=
"document.getElementById('start_extrait').value=document.getElementById('end_extrait').value;document.getElementById('end_extrait').focus()";
291echo _(
'Cherche').Icon_Action::infobulle(25);
295echo
'<span style="display:block">';
299$select_all->javascript=
"Bank_Reconciliation.recompute('rec1')";
300echo
'<table id="t_rec_bk" class="sortable" style="width:90%;margin-left:5%">';
305$r.=
th(
'Montant',
' style="text-align:right"');
306$r.=
'<th class="sorttable_nosort" style="text-align:center">'.$select_all->input().
'</th>';
317 $iradio->set_range(
"operation_ck");
321 $r.=
'<td sorttable_customkey="'.$row[
'raw_date'].
'">'.
$row[
'fmt_date'].
'</td>';
324 $amount=
$cn->get_value(
'select qf_amount from quant_fin where jr_id=$1', array(
$row[
'jr_id']));
325 $r.=
'<td class="num sorttable_numeric" sorttable_customkey="'.$amount.
'" style="text-align:right">'.
nbm (
$amount).
'</td>';
329 $iradio->value =
$row[
'jr_id'];
330 $iradio->selected=
false;
331 $iradio->set_attribute(
"amount_operation",
$amount);
332 $iradio->javascript=sprintf(
' onchange = "Bank_Reconciliation.update_selected(this,%s);Bank_Reconciliation.update_remain(this,%s)"',
$amount,
$amount);
341 $iradio->selected=
true;
350 echo
tr(
$r,
' class="odd" ');
352 echo
tr(
$r,
' class="even" ');
358$filter_year =
" j_tech_per in (select p_id from parm_periode where p_exercice='" .
$g_user->get_exercice() .
"')";
368echo
'<div style="float:right;margin-right:100px;font-size:120%;font-weight:bolder">';
369echo
'<table id="total_div_id">';
372 <td>'._(
'Différence relevé').
'</td>
373 <td id="delta_amount" class="num" >'.
$delta.
'</td>
376 <td>'._(
'Montant sélectionné').
'</td>
380 <td>'._(
'Reste à selectionner').
'</td>
389echo
td(
"Solde compte ");
390echo
td(
nbm(bcsub(
$saldo[
'debit'] ,
$saldo[
'credit'])),
' style="text-align:right"');
394echo
td(
"Solde non rapproché ");
399echo
td(
"Solde rapproché ");
405echo
td(
"Total montant ");
412echo _(
"Pièce justificative"),
" " ,
414echo
'<p class="text-align:center">';
422 (
function () {Bank_Reconciliation.activate_checkbox_range(
'operation_ck');})()
th($p_string, $p_extra='', $raw='')
echo_warning($p_string)
warns
NoAccess($js=1)
Echo no access and stop.
tr($p_string, $p_extra='')
td($p_string='', $p_extra='')
surround the string with td
nbm($p_number, $p_dec=2)
format the number with a sep.
alert($p_msg, $buffer=false)
alert in javascript
global $g_user
if no group available , then stop
h( $row[ 'oa_description'])
the class Acc_Ledger_Fin inherits from Acc_Ledger, this object permit to manage the financial ledger
define Class fiche and fiche def, those class are using class attribut. When adding or modifing new c...
Html Input for uploading file, must be in a form with enctype="multipart/form-data".
This class handles only the numeric input, the input will call a javascript to change comma to period...
static infobulle($p_comment)
Display a info in a bubble, text is in message_javascript.
if(isset($_GET["p_jrn"]) && $jrn_priv=="X") $end_extrait
for($e=0; $e< count($afiche); $e++) exit