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 if ( window.getComputedStyle(aName[x].parentNode.parentNode).display ==
"none" ) {
continue; }
78 aName[x].checked = check;
79 if( x < end && x >
from ) {
80 Bank_Reconciliation.update_selected(aName[x],aName[x].getAttribute(
'amount_operation'));
81 Bank_Reconciliation.update_remain(aName[x],aName[x].getAttribute(
'amount_operation'));
87 update_selected:
function (p_node,p_amount) {
89 p_amount=parseFloat(p_amount);
93 var
selected=parseFloat($(
'selected_amount').innerHTML)+p_amount;
94 $(
'selected_amount').innerHTML=Math.round(
selected*100)/100;
96 var
selected=parseFloat($(
'selected_amount').innerHTML)-p_amount;
97 $(
'selected_amount').innerHTML=Math.round(
selected*100)/100;
101 if (console) {console.error(
'Bank_Reconciliation.update_selected :'+e.message);}
104 update_remain:
function (p_node,p_amount) {
105 p_amount=parseFloat(p_amount);
107 if ( parseFloat($(
'delta_amount').innerHTML) == 0)
return;
110 var
selected=parseFloat($(
'remain_amount').innerHTML)-p_amount;
111 $(
'remain_amount').innerHTML=Math.round(
selected*100)/100;
113 var
selected=parseFloat($(
'remain_amount').innerHTML)+p_amount;
114 $(
'remain_amount').innerHTML=Math.round(
selected*100)/100;
118 if (console) {console.error(
'Bank_Reconciliation.update_remain :'+e.message);}
122 update_delta:
function () {
124 var delta=parseFloat($(
'end_extrait').
value)-parseFloat($(
'start_extrait').
value);
125 delta=Math.round(delta*100)/100;
126 $(
'delta_amount').innerHTML=delta;
127 var remain=delta-parseFloat($(
'selected_amount').innerHTML);
128 $(
'remain_amount').innerHTML=Math.round(remain*100)/100;
130 if (console) {console.error(
'Bank_Reconciliation.update_delta :' +e.message);}
133 recompute:
function (p_form) {
137 for (i=0;i<form.length;i++) {
138 var e=form.elements[i];
139 if (e.type==
'checkbox' && window.getComputedStyle(e.parentNode.parentNode).display !=
"none" )
144 remove_waiting_box();
146 if (console) {console.error(
'Bank_Reconciliation.recompute :' +e.message);}
152echo
'<div class="content">';
157 if ( isset(
$a[
'jrn_def_id'])) {
177 echo
'<span class="notice">';
178 echo
_(
'Donnée invalide');
184 echo
'<span class="notice">';
185 echo
_(
'Donnée invalide');
194 $receipt_nb=
$http->post(
"ext");
195 if (trim($receipt_nb) ==
'' && isset(
$_POST[
'op'])) {
198 if (trim($receipt_nb) !=
'' && isset(
$_POST[
'op']))
205 $cn->exec_sql(
'update jrn set jr_pj_number=$1 where jr_id=$2', array(
$_POST[
'ext'],
$array[
$i]));
206 $tot = bcadd(
$tot,
$cn->get_value(
'select qf_amount from quant_fin where jr_id=$1', array(
$array[
$i])));
213 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");
214 echo
'<div class="error">';
215 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>';
218 _(
'Attention : Fichier non chargé').
224 echo
'<div class="content">'.$g_succeed.
' Mise à jour extrait '.
$_POST[
'ext'].
'</div>';
226 $oid=
$cn->upload(
'file_receipt',
true);
228 if ( $oid !=
false ) {
231 $cn->exec_sql(
"update jrn set jr_pj=$1 , jr_pj_name=$2,
232 jr_pj_type=$3 where jr_id=$4",
233 array($oid,$_FILES[
'file_receipt'][
'name'] ,$_FILES[
'file_receipt'][
'type'],
$array[
$i]));
245echo
'<div class="content">';
246echo
'<form method="get">';
250 exit(
'Pas de journal disponible');
251echo
'<div id="jrn_name_div">';
252echo
'<h1 id="jrn_name" style="display:inline">' .
$Ledger->get_name() .
'</h1>';
254$wLedger->javascript =
"onchange='this.form.submit()';";
256echo HtmlInput::submit(
'ref',
'Rafraîchir');
258echo
'<span id="bkname" style="display:block">' .
hb(
h(
$Ledger->get_bank_name())) .
'</span>';
260echo
'<form method="post" id="rec1" enctype="multipart/form-data">';
262echo dossier::hidden();
263echo HtmlInput::get_to_hidden(array(
'sa',
'p_action',
'p_jrn'));
267 to_char(jr_date,'DD.MM.YYYY') as fmt_date,
269 to_char(jr_date,'YYYYMMDD') as raw_date
270 from jrn where jr_def_id=$1 and (jr_pj_number is null or jr_pj_number='') order by jr_date", array(
$Ledger->id));
278$nstart_extrait->javascript=
'onchange="format_number(this,2);Bank_Reconciliation.update_delta();"';
282$nend_extrait->javascript=
'onchange="format_number(this,2);Bank_Reconciliation.update_delta();"';
284echo
_(
"Extrait / relevé :") .
$iextrait->input();
289$take_end->javascript=
"document.getElementById('start_extrait').value=document.getElementById('end_extrait').value;document.getElementById('end_extrait').focus()";
293echo
_(
'Cherche').Icon_Action::infobulle(25);
294echo HtmlInput::filter_table(
"t_rec_bk",
"0,1,2,3",
"1");
296echo HtmlInput::submit(
'save',
'Mettre à jour le n° de relevé bancaire');
297echo
'<span style="display:block">';
301$select_all->javascript=
"Bank_Reconciliation.recompute('rec1')";
302echo
'<table id="t_rec_bk" class="sortable" style="width:90%;margin-left:5%">';
307$r.=
th(
'Montant',
' style="text-align:right"');
308$r.=
'<th class="sorttable_nosort" style="text-align:center">'.$select_all->input().
'</th>';
319 $iradio->set_range(
"operation_ck");
322 $js = HtmlInput::detail_op(
$row[
'jr_id'],
$row[
'jr_internal']);
323 $r.=
'<td sorttable_customkey="'.$row[
'raw_date'].
'">'.
$row[
'fmt_date'].
'</td>';
326 $amount=
$cn->get_value(
'select qf_amount from quant_fin where jr_id=$1', array(
$row[
'jr_id']));
327 $r.=
'<td class="num sorttable_numeric" sorttable_customkey="'.$amount.
'" style="text-align:right">'.
nbm (
$amount).
'</td>';
331 $iradio->value =
$row[
'jr_id'];
332 $iradio->selected=
false;
333 $iradio->set_attribute(
"amount_operation",
$amount);
334 $iradio->javascript=sprintf(
' onchange = "Bank_Reconciliation.update_selected(this,%s);Bank_Reconciliation.update_remain(this,%s)"',
$amount,
$amount);
343 $iradio->selected=
true;
350 $r.=
td(HtmlInput::hidden(
'jrid['.
$i.
']',
$row[
'jr_id']) . $iradio->input(),
'sorttable_customkey="1" style="text-align:center" ');
352 echo
tr(
$r,
' class="odd" ');
354 echo
tr(
$r,
' class="even" ');
360$filter_year =
" j_tech_per in (select p_id from parm_periode where p_exercice='" .
$g_user->get_exercice() .
"')";
370echo
'<div style="float:right;margin-right:100px;font-size:120%;font-weight:bolder">';
371echo
'<table id="total_div_id">';
374 <td>'._(
'Différence relevé').
'</td>
375 <td id="delta_amount" class="num" >'.
$delta.
'</td>
378 <td>'.
_(
'Montant sélectionné').
'</td>
382 <td>'.
_(
'Reste à selectionner').
'</td>
391echo
td(
"Solde compte ");
392echo
td(
nbm(bcsub(
$saldo[
'debit'] ,
$saldo[
'credit'])),
' style="text-align:right"');
396echo
td(
"Solde non rapproché ");
401echo
td(
"Solde rapproché ");
407echo
td(
"Total montant ");
414echo
_(
"Pièce justificative"),
" " ,
416echo
'<p class="text-align:center">';
417echo HtmlInput::submit(
'save',
'Mettre à jour le n° de relevé bancaire');
424 (
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
catch(Exception $exc) if(! $g_user->can_write_action($ag_id)) $r
h( $row[ 'oa_description'])
foreach(array( 'l', 'gDossier') as $a) if(is_numeric($l)==false) $Ledger
_("actif, passif,charge,...")
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