noalyss Version-9
Public Member Functions | Static Public Member Functions | Data Fields
Acc_Reconciliation Class Reference

new class for managing the reconciliation it must be used instead of the function InsertRapt, ... More...

+ Inheritance diagram for Acc_Reconciliation:
+ Collaboration diagram for Acc_Reconciliation:

Public Member Functions

 __construct ($cn)
 
 auto_letter ($p_jrid)
 try to letter same card between $p_jrid and $this->jr_id More...
 
 export_csv ($p_choice)
 Export to CSV. More...
 
 fill_info ()
 
 filter_date ()
 create a string to filter thanks the date More...
 
 get ()
 Return an array of the concerned operation. More...
 
 get_amount_noautovat ($p_jrn_id, $p_default_amount)
 Retrieve the amount VAT included and autoreversed VAT excluded thanks the view v_quant_detail and return it. More...
 
 get_data ($p_choice)
 
 get_not_reconciled ()
 return array of not-reconciled operation Prepare and put in memory the SQL detail_quant More...
 
 get_reconciled ()
 return array of reconciled operation Prepare and put in memory the SQL detail_quant More...
 
 get_reconciled_amount ($p_equal=false)
 Prepare and put in memory the SQL detail_quant. More...
 
 insert ($jr_id2)
 Insert into jrn_rapt the concerned operations. More...
 
 insert_rapt ($jr_id2)
 Insert into jrn_rapt the concerned operations should not be called directly, use insert instead. More...
 
 ledger_filter ()
 Create a sql condition to filter by security and by asked ledger based on $this->a_jrn. More...
 
 prepare_query_detail_quant ()
 
 remove ($jr_id2)
 Insert into jrn_rapt the concerned operations. More...
 
 set_jr_id ($jr_id)
 
 show_detail ($p_ret)
 
 widget ()
 return a widget of type js_concerned More...
 

Static Public Member Functions

static test_me ()
 

Data Fields

 $a_jrn
 
 $db
 
 $end_day
 
 $jr_id
 
 $start_day
 

Detailed Description

new class for managing the reconciliation it must be used instead of the function InsertRapt, ...

Definition at line 32 of file acc_reconciliation.class.php.

Constructor & Destructor Documentation

◆ __construct()

Acc_Reconciliation::__construct (   $cn)

Definition at line 39 of file acc_reconciliation.class.php.

40 {
41 $this->db=$cn;
42 $this->jr_id=0;
43 $this->a_jrn=null;
44 }
$op jr_id
Definition: ajax_ledger.php:83
$acc_reconciliation a_jrn
$SecUser db

References $cn, a_jrn, db, and jr_id.

Member Function Documentation

◆ auto_letter()

Acc_Reconciliation::auto_letter (   $p_jrid)

try to letter same card between $p_jrid and $this->jr_id

Parameters
jrn.jr_id$p_jrid the operation to reconcile

Reimplemented in Acc_Reconciliation_Lettering.

Definition at line 153 of file acc_reconciliation.class.php.

154 {
155 // Try to find same card from both operation
156 $sql="select j1.f_id as fiche ,coalesce(j1.j_id,-1) as jrnx_id1,coalesce(j2.j_id,-1) as jrnx_id2,
157j1.j_poste as poste
158 from jrnx as j1
159 join jrn as jr1 on (j1.j_grpt=jr1.jr_grpt_id)
160 join jrnx as j2 on (coalesce(j1.f_id,-1)=coalesce(j2.f_id,-1) and j1.j_poste=j2.j_poste)
161 join jrn as jr2 on (j2.j_grpt=jr2.jr_grpt_id)
162 where
163 jr1.jr_id=$1
164 and
165 jr2.jr_id= $2";
166 $result=$this->db->get_array($sql,array($this->jr_id,$p_jrid));
167 if ( count($result) == 0)
168 {
169 return;
170 }
171 for ($i=0;$i<count($result);$i++)
172 {
173 if ( $result[$i]['fiche'] != -1)
174 {
175 $letter = new Lettering_Card($this->db);
176 $letter->insert_couple($result[$i]['jrnx_id1'],$result[$i]['jrnx_id2']);
177 }
178 else
179 {
180 $letter = new Lettering_Account($this->db);
181 $letter->insert_couple($result[$i]['jrnx_id1'],$result[$i]['jrnx_id2']);
182 }
183 }
184
185 }
only for operation retrieved thanks a account (jrnx.j_poste) manage the accounting entries for a give...
only for operation retrieved thanks a quick_code manage the accounting entries for a given card

References $i, $letter, $result, $sql, db, and jr_id.

Referenced by insert_rapt().

◆ export_csv()

Acc_Reconciliation::export_csv (   $p_choice)

Export to CSV.

Parameters
type$p_choice
Note
must be set before calling
  • $this->a_jrn array of ledger
  • $this->start_day start date
  • $this->end_day end date
See also
Acc_Reconciliation::get_data

Definition at line 474 of file acc_reconciliation.class.php.

475 {
476 $export=new Noalyss_Csv(_('rapprochement'));
477 $export->send_header();
478
479 $array = $this->get_data($p_choice);
480 for ($i = 0; $i < count($array); $i++)
481 {
482 // ---------------------------------------
483 // first index has 2 arrays : first & depend[]
484 // ---------------------------------------
485
486 $first = $array[$i]['first'];
487 $a_depend = array();
488 $title=array();
489 if (isset($array[$i]['depend']))
490 {
491 $a_depend = $array[$i]['depend'];
492 //----- HEADER ----
493 if ($i == 0)
494 {
495 $title[]=_('n°');
496 $title[]=_('Date');
497 $title[]=_('internal');
498 $title[]=_('libellé');
499 $title[]=_('pièce');
500 $title[]=_('journal');
501 $title[]=_('type journal');
502 $title[]=_('montant');
503 $title[]=_('<->');
504 $title[]=_('Date');
505 $title[]=_('Interne');
506 $title[]=_('libell');
507 $title[]=_('pièce');
508 $title[]=_('nom journal');
509 $title[]=_('type journal');
510 $title[]=_('montant');
511
512 }
513 }
514 else
515 {
516 //----- HEADER ----
517 if ($i == 0)
518 {
519 $title[]=_('n°');
520 $title[]=_('Date');
521 $title[]=_('interne');
522 $title[]=_('libellé');
523 $title[]=_('pièce');
524 $title[]=_('journal');
525 $title[]=_('type journal');
526 $title[]=_('montant');
527
528 }
529 }
530 $export->write_header($title);
531 //-----------------------------------------
532 //Retrieve amount without autoreversed VAT
533 //-----------------------------------------
534 $amount=$this->get_amount_noautovat($first['jr_id'],$first['jr_montant']);
535
536 // --------------------------
537 // Print First
538 // --------------------------
539 $export->add($i,"number");
540 $export->add($first['jr_date']);
541 $export->add($first['jr_internal']);
542 $export->add($first['jr_comment']);
543 $export->add($first['jr_pj_number']);
544 $export->add($first['jrn_def_name']);
545 $export->add($first['jrn_def_type']);
546 $export->add($amount,"number");
547 if (count($a_depend) > 0)
548 {
549 // --------------------------------------
550 // Print first depending operation
551 // --------------------------------------
552 $depend = $a_depend[0];
553 $export->add("<->");
554 $amount_dep=$this->get_amount_noautovat($depend['jr_id'],$depend['jr_montant']);
555 $export->add($depend['jr_date']);
556 $export->add($depend['jr_internal']);
557 $export->add($depend['jr_comment']);
558 $export->add($depend['jr_pj_number']);
559 $export->add($depend['jrn_def_name']);
560 $export->add($depend['jrn_def_type']);
561 $export->add($amount_dep,"number");
562 $export->write();
563 // --------------------------------------
564 // print other depending operation if any
565 // --------------------------------------
566 for ($e = 1; $e < count($a_depend); $e++)
567 {
568 $amount_dep=$this->get_amount_noautovat($depend['jr_id'],$depend['jr_montant']);
569 $depend = $a_depend[$e];
570 $export->add("");
571 $export->add("");
572 $export->add("");
573 $export->add("");
574 $export->add("");
575 $export->add("");
576 $export->add("");
577 $export->add("");
578 $export->add("<->");
579 $export->add($depend['jr_date']);
580 $export->add($depend['jr_internal']);
581 $export->add($depend['jr_comment']);
582 $export->add($depend['jr_pj_number']);
583 $export->add($depend['jrn_def_name']);
584 $export->add($depend['jrn_def_type']);
585 $export->add($amount_dep,"number");
586 $export->write();
587 }
588 }
589 else
590 {
591 $export->write();
592 }
593 }
594 }
get_amount_noautovat($p_jrn_id, $p_default_amount)
Retrieve the amount VAT included and autoreversed VAT excluded thanks the view v_quant_detail and ret...
Manage the CSV : manage files and write CSV record.

References $amount, $array, $e, $export, $i, $title, get_amount_noautovat(), and get_data().

+ Here is the call graph for this function:

◆ fill_info()

Acc_Reconciliation::fill_info ( )

Definition at line 264 of file acc_reconciliation.class.php.

265 {
266 $sql="select jr_id,jr_date,jr_comment,jr_internal,jr_montant,jr_pj_number,jr_def_id,jrn_def_name,jrn_def_type
267 from jrn join jrn_def on (jrn_def_id=jr_def_id)
268 where jr_id=$1";
269 $a=$this->db->get_array($sql,array($this->jr_id));
270 return $a[0];
271 }

References $a, $sql, db, and jr_id.

Referenced by get_not_reconciled(), and get_reconciled().

◆ filter_date()

Acc_Reconciliation::filter_date ( )

create a string to filter thanks the date

Returns
a sql string like jr_date > ... and jr_date < ....
Note
use the data member start_day and end_day
See also
get_reconciled get_not_reconciled

Definition at line 434 of file acc_reconciliation.class.php.

435 {
436 global $g_user;
437 list($start,$end)=$g_user->get_limit_current_exercice();
438
439 if (isDate($this->start_day) ==null)
440 {
441 $this->start_day=$start;
442 }
443 if ( isDate($this->end_day) == null)
444 {
445 $this->end_day=$end;
446 }
447 $sql=" (jr_date >= to_date('".$this->start_day."','DD.MM.YYYY')
448 and jr_date <= to_date('".$this->end_day."','DD.MM.YYYY'))";
449 return $sql;
450
451 }
isDate($p_date)
Definition: ac_common.php:236
global $g_user
if no group available , then stop
$acc_reconciliation end_day
$acc_reconciliation start_day

References $end, $g_user, $sql, $start, end_day, isDate(), and start_day.

Referenced by get_not_reconciled(), and get_reconciled().

+ Here is the call graph for this function:

◆ get()

Acc_Reconciliation::get ( )

Return an array of the concerned operation.

Parameters
databaseconnection
Returns
array if something is found or null

Definition at line 244 of file acc_reconciliation.class.php.

245 {
246 $sql=" select jr_id as cn from jrn_rapt where jra_concerned=$1
247 union
248 select jra_concerned as cn from jrn_rapt where jr_id=$2";
249 $Res=$this->db->exec_sql($sql,array($this->jr_id,$this->jr_id));
250
251 // If nothing is found return null
253
254 if ($n ==0 ) return [];
255
256 // put everything in an array
257 for ($i=0;$i<$n;$i++)
258 {
260 $r[$i]=$l['cn'];
261 }
262 return $r;
263 }
catch(Exception $exc) if(! $g_user->can_write_action($ag_id)) $r
static fetch_array($ret, $p_indice=0, $p_mode=PGSQL_ASSOC)
wrapper for the function pg_fetch_array
static num_row($ret)
wrapper for the function pg_num_rows
$Res

References $i, $l, $r, $Res, $sql, db, DatabaseCore\fetch_array(), jr_id, and DatabaseCore\num_row().

+ Here is the call graph for this function:

◆ get_amount_noautovat()

Acc_Reconciliation::get_amount_noautovat (   $p_jrn_id,
  $p_default_amount 
)

Retrieve the amount VAT included and autoreversed VAT excluded thanks the view v_quant_detail and return it.

If the operation is not a sale or a purchase , it doesn't exist in the view then the function just returns the default amount

Parameters
type$p_jrn_idjrn.jr_id
type$p_default_amountamount to return if not found in the view v_quant_detail
Returns
number

Definition at line 644 of file acc_reconciliation.class.php.

644 {
645 static $p=0;
646 if ( $p==0) {
648 $p=1;
649 }
650
651 $retdb=$this->db->execute("detail_quant",array($p_jrn_id));
652 if ( Database::num_row($retdb) != 0)
653 {
654 // then second_amount takes in account the vat_sided
655 $row=Database::fetch_array($retdb, 0);
656 $total_price=bcadd($row['price'],$row['vat_amount']);
657 $total_price=bcsub($total_price,$row['vat_sided']);
658 $first_amount=$total_price;
659
660 } else {
661 // else take the amount from jrn
662 $first_amount=$p_default_amount;
663 }
664 return $first_amount;
665
666 }
$p
Definition: array.php:34

References $p, $row, db, DatabaseCore\fetch_array(), DatabaseCore\num_row(), and prepare_query_detail_quant().

Referenced by export_csv().

+ Here is the call graph for this function:

◆ get_data()

Acc_Reconciliation::get_data (   $p_choice)
Parameters
type$p_choice
  • 0 : operation reconcilied
  • 1 : reconcilied with different amount
  • 2 : reconcilied with same amount
  • 3 : not reconcilied
Returns
$array

Definition at line 605 of file acc_reconciliation.class.php.

606 {
607 switch ($p_choice)
608 {
609 case 0:
610 $array = $this->get_reconciled();
611 break;
612 case 1:
613 $array = $this->get_reconciled_amount(false);
614 break;
615 case 2:
616 $array = $this->get_reconciled_amount(true);
617 break;
618 case 3:
619 $array = $this->get_not_reconciled();
620 break;
621 default:
622 echo "Choix invalid";
623 throw new Exception("invalide");
624 }
625 return $array;
626 }
get_not_reconciled()
return array of not-reconciled operation Prepare and put in memory the SQL detail_quant
get_reconciled()
return array of reconciled operation Prepare and put in memory the SQL detail_quant
get_reconciled_amount($p_equal=false)
Prepare and put in memory the SQL detail_quant.

References $array, get_not_reconciled(), get_reconciled(), and get_reconciled_amount().

Referenced by export_csv().

+ Here is the call graph for this function:

◆ get_not_reconciled()

Acc_Reconciliation::get_not_reconciled ( )

return array of not-reconciled operation Prepare and put in memory the SQL detail_quant

Definition at line 276 of file acc_reconciliation.class.php.

277 {
278 $filter_date=$this->filter_date();
279 /* create ledger filter */
280 $sql_jrn=$this->ledger_filter();
281
282 $array=$this->db->get_array("select distinct jr_id,jr_date from jrn where $filter_date and $sql_jrn and jr_id not in (select jr_id from jrn_rapt union select jra_concerned from jrn_rapt) order by jr_date");
283 $ret=array();
284 for ($i=0;$i<count($array);$i++)
285 {
286 $this->jr_id=$array[$i]['jr_id'];
287 $ret[$i]['first']=$this->fill_info();
288 }
289 return $ret;
290 }
ledger_filter()
Create a sql condition to filter by security and by asked ledger based on $this->a_jrn.
filter_date()
create a string to filter thanks the date

References $array, $i, $ret, db, fill_info(), filter_date(), jr_id, and ledger_filter().

Referenced by get_data().

+ Here is the call graph for this function:

◆ get_reconciled()

Acc_Reconciliation::get_reconciled ( )

return array of reconciled operation Prepare and put in memory the SQL detail_quant

Returns
Note
See also

Definition at line 328 of file acc_reconciliation.class.php.

329 {
330 $filter_date=$this->filter_date();
331
332
333 /* create ledger filter */
334 $sql_jrn=$this->ledger_filter();
335
336 $array=$this->db->get_array("select distinct jr_id,jr_date from jrn where $filter_date and $sql_jrn and jr_id in (select jr_id from jrn_rapt union select jra_concerned from jrn_rapt) order by jr_date");
337 $ret=array();
338 for ($i=0;$i<count($array);$i++)
339 {
340 $this->jr_id=$array[$i]['jr_id'];
341 $ret[$i]['first']=$this->fill_info();
342 $atmp=$this->get();
343 for ( $e=0;$e<count($atmp);$e++)
344 {
345 $this->jr_id=$atmp[$e];
346 $ret[$i]['depend'][$e]=$this->fill_info();
347 }
348 }
349
350 return $ret;
351 }

References $array, $e, $i, $ret, db, fill_info(), filter_date(), jr_id, and ledger_filter().

Referenced by get_data(), and get_reconciled_amount().

+ Here is the call graph for this function:

◆ get_reconciled_amount()

Acc_Reconciliation::get_reconciled_amount (   $p_equal = false)

Prepare and put in memory the SQL detail_quant.

Parameters

return

Note
See also

Definition at line 363 of file acc_reconciliation.class.php.

364 {
365 $array=$this->get_reconciled();
366 $ret=array();
367 bcscale(2);
369 for ($i=0;$i<count($array);$i++)
370 {
371
372 $retdb=$this->db->execute("detail_quant",array($array[$i]['first']['jr_id']));
373 if ( Database::num_row($retdb) != 0)
374 {
375 // then second_amount takes in account the vat_sided
377 $total_price=0;
378 foreach ($a_row as $row) {
379 $total_price=bcadd($total_price,$row['price']);
380 $total_price=bcadd($total_price,$row['vat_amount']);
381 $total_price=bcsub($total_price,$row['vat_sided']);
382 $total_price=bcadd($total_price,$row['nd_amount']);
383 $total_price=bcadd($total_price,$row['nd_tva_recup']);
384
385 }
386 $first_amount=$total_price;
387
388 } else {
389 // else take the amount from jrn
390 $first_amount=$array[$i]['first']['jr_montant'];
391 }
392 $second_amount=0;
393 for ($e=0;$e<count($array[$i]['depend']);$e++)
394 {
395 $retdb=$this->db->execute("detail_quant",array($array[$i]['depend'][$e]['jr_id']));
396 // if exist in v_quant_detail
397 if ( Database::num_row($retdb) != 0)
398 {
399 // then second_amount takes in account the vat_sided
401 $total_price=0;
402 foreach ($a_row as $row) {
403 $total_price=bcadd($total_price,$row['price']);
404 $total_price=bcadd($total_price,$row['vat_amount']);
405 $total_price=bcsub($total_price,$row['vat_sided']);
406 $total_price=bcadd($total_price,$row['nd_amount']);
407 $total_price=bcadd($total_price,$row['nd_tva_recup']);
408
409 }
410 $second_amount=bcadd($second_amount,$total_price);
411
412 } else {
413 // else take the amount from jrn
414 $second_amount=bcadd($second_amount,$array[$i]['depend'][$e]['jr_montant']);
415 }
416 }
417 if ( $p_equal && $first_amount==$second_amount)
418 {
419 $ret[]=$array[$i];
420 }
421 if ( ! $p_equal && $first_amount != $second_amount)
422 {
423 $ret[]=$array[$i];
424 }
425 }
426 return $ret;
427 }
static fetch_all($ret)
wrapper for the function pg_fetch_all

References $a_row, $array, $e, $i, $ret, $row, db, DatabaseCore\fetch_all(), get_reconciled(), DatabaseCore\num_row(), and prepare_query_detail_quant().

Referenced by get_data().

+ Here is the call graph for this function:

◆ insert()

Acc_Reconciliation::insert (   $jr_id2)

Insert into jrn_rapt the concerned operations.

Parameters
$jr_id2(jrn.jr_id) => jrn_rapt.jra_concerned or a string like "jr_id2,jr_id3,jr_id4..."
Returns
none

Definition at line 69 of file acc_reconciliation.class.php.

70 {
71 if ( trim($jr_id2) == "" )
72 return;
73 if ( strpos($jr_id2,',') !== 0 )
74 {
75 $aRapt=explode(',',$jr_id2);
76 foreach ($aRapt as $rRapt)
77 {
78 if ( isNumber($rRapt) == 1 )
79 {
80 $this->insert_rapt($rRapt);
81 }
82 }
83 }
84 else
85 if ( isNumber($jr_id2) == 1 )
86 {
87 $this->insert_rapt($jr_id2);
88 }
89 }
isNumber($p_int)
Definition: ac_common.php:215
insert_rapt($jr_id2)
Insert into jrn_rapt the concerned operations should not be called directly, use insert instead.

References insert_rapt(), and isNumber().

+ Here is the call graph for this function:

◆ insert_rapt()

Acc_Reconciliation::insert_rapt (   $jr_id2)

Insert into jrn_rapt the concerned operations should not be called directly, use insert instead.

Parameters
$jr_id2(jrn.jr_id) => jrn_rapt.jra_concerned
Returns
none

Definition at line 100 of file acc_reconciliation.class.php.

101 {
102 if ( isNumber($this->jr_id) == 0 || isNumber($jr_id2) == 0 )
103 {
104 return false;
105 }
106 if ( $this->jr_id==$jr_id2)
107 return true;
108
109 if ( $this->db->count_sql("select jr_id from jrn where jr_id=".$this->jr_id)==0 )
110 return false;
111 if ( $this->db->count_sql("select jr_id from jrn where jr_id=".$jr_id2)==0 )
112 return false;
113
114 // verify if exists
115 if ( $this->db->count_sql(
116 "select jra_id from jrn_rapt where jra_concerned=".$this->jr_id.
117 " and jr_id=$jr_id2
118 union
119 select jra_id from jrn_rapt where jr_id=".$this->jr_id.
120 " and jra_concerned=$jr_id2 ")
121 ==0)
122 {
123 // Ok we can insert
124 $Res=$this->db->exec_sql("insert into jrn_rapt(jr_id,jra_concerned) values ".
125 "(".$this->jr_id.",$jr_id2)");
126 // try to letter automatically same account from both operation
127 $this->auto_letter($jr_id2);
128
129 // update date of paiement -----------------------------------------------------------------------
130 $source_type=$this->db->get_value("select substr(jr_internal,1,1) from jrn where jr_id=$1",array($this->jr_id));
131 $dest_type=$this->db->get_value("select substr(jr_internal,1,1) from jrn where jr_id=$1",array($jr_id2));
132 if (($source_type =='A' || $source_type=='V') && ($dest_type != 'A' && $dest_type != 'V'))
133 {
134 // set the date on source
135 $date=$this->db->get_value('select jr_date from jrn where jr_id=$1',array($jr_id2));
136 if ( trim ($date) == '') $date=null;
137 $this->db->exec_sql('update jrn set jr_date_paid=$1 where jr_id=$2 and jr_date_paid is null ',array($date,$this->jr_id));
138 }
139 if (($source_type !='A' && $source_type !='V') && ($dest_type == 'A' || $dest_type == 'V'))
140 {
141 // set the date on dest
142 $date=$this->db->get_value('select jr_date from jrn where jr_id=$1',array($this->jr_id));
143 if (trim($date) == '') $date=null;
144 $this->db->exec_sql('update jrn set jr_date_paid=$1 where jr_id=$2 and jr_date_paid is null ',array($date,$jr_id2));
145 }
146 }
147 return true;
148 }
auto_letter($p_jrid)
try to letter same card between $p_jrid and $this->jr_id

References $date, $Res, auto_letter(), db, isNumber(), and jr_id.

Referenced by insert(), and Acc_Reconciliation_Lettering\insert_reconcilied().

+ Here is the call graph for this function:

◆ ledger_filter()

Acc_Reconciliation::ledger_filter ( )

Create a sql condition to filter by security and by asked ledger based on $this->a_jrn.

Returns
a valid sql stmt to include
See also
get_not_reconciled get_reconciled

Definition at line 297 of file acc_reconciliation.class.php.

298 {
299 global $g_user;
300 /* get the available ledgers for current user */
301 $sql=$g_user->get_ledger_sql('ALL',3);
302 $sql=noalyss_str_replace('jrn_def_id','jr_def_id',$sql);
303 $r='';
304 /* filter by this->r_jrn */
305 if ( ! empty ($this->a_jrn ) && is_array($this->a_jrn))
306 {
307 $sep='';
308 $r='and jr_def_id in (';
309 foreach( $this->a_jrn as $key=>$value)
310 {
311 $r.=$sep.$value;
312 $sep=',';
313 }
314 $r.=')';
315 }
316 return $sql.' '.$r;
317 }
noalyss_str_replace($search, $replace, $string)
Definition: ac_common.php:1553

References $g_user, $r, $sep, $sql, $value, a_jrn, and noalyss_str_replace().

Referenced by get_not_reconciled(), and get_reconciled().

+ Here is the call graph for this function:

◆ prepare_query_detail_quant()

Acc_Reconciliation::prepare_query_detail_quant ( )

Definition at line 627 of file acc_reconciliation.class.php.

628 {
629 static $seen=0;
630 if ( $seen == 1) return;
631 $this->db->prepare('detail_quant','select * from v_quant_detail where jr_id=$1');
632 $seen=1;
633 }

References db.

Referenced by get_amount_noautovat(), and get_reconciled_amount().

◆ remove()

Acc_Reconciliation::remove (   $jr_id2)

Insert into jrn_rapt the concerned operations.

Parameters
$this->jr_id(jrn.jr_id) => jrn_rapt.jr_id
$jr_id2(jrn.jr_id) => jrn_rapt.jra_concerned
Returns
none

remove also lettering between both operation

Definition at line 195 of file acc_reconciliation.class.php.

196 {
197 if ( isNumber($this->jr_id) == 0 or
198 isNumber($jr_id2) == 0 )
199 {
200 return;
201 }
202 // verify if exists
203 if ( $this->db->count_sql("select jra_id from jrn_rapt where ".
204 " jra_concerned=".$this->jr_id." and jr_id=$jr_id2
205 union
206 select jra_id from jrn_rapt where jra_concerned=$jr_id2 ".
207 " and jr_id=".$this->jr_id) !=0)
208 {
209 /**
210 * remove also lettering between both operation
211 */
212 $sql = " delete from
213 jnt_letter
214 where jl_id in ( select jl_id from jnt_letter
215 join letter_cred as lc using(jl_id)
216 join letter_deb as ld using (jl_id)
217 where
218 lc.j_id in (select j_id
219 from jrnx join jrn on (j_grpt=jr_grpt_id)
220 where jr_id in ($1,$2))
221 or
222 ld.j_id in (select j_id
223 from jrnx join jrn on (j_grpt=jr_grpt_id)
224 where jr_id in ($1,$2))
225
226
227
228 )";
229 $this->db->exec_sql($sql, array($jr_id2, $this->jr_id));
230 // Ok we can delete
231 $Res=$this->db->exec_sql("delete from jrn_rapt where ".
232 "(jra_concerned=$jr_id2 and jr_id=".$this->jr_id.") or
233 (jra_concerned=".$this->jr_id." and jr_id=$jr_id2) ");
234 }
235 }

References $Res, $sql, db, isNumber(), and jr_id.

+ Here is the call graph for this function:

◆ set_jr_id()

Acc_Reconciliation::set_jr_id (   $jr_id)

Definition at line 46 of file acc_reconciliation.class.php.

References $jr_id, and jr_id.

Referenced by Acc_Reconciliation_Lettering\insert_reconcilied().

◆ show_detail()

Acc_Reconciliation::show_detail (   $p_ret)

Definition at line 452 of file acc_reconciliation.class.php.

453 {
454 if (Database::num_row($p_ret)> 0)
455 {
456 echo '<tr class="odd">';
457 echo '<td></td>';
458 echo '<td colspan="5" style="border:1px solid black;width:auto">';
459 include NOALYSS_TEMPLATE.'/impress_reconciliation_detail.php';
460 echo '</td>';
461 echo '</tr>';
462 }
463 }

References DatabaseCore\num_row().

+ Here is the call graph for this function:

◆ test_me()

static Acc_Reconciliation::test_me ( )
static

Definition at line 667 of file acc_reconciliation.class.php.

668 {
671 var_dump($rap->get_reconciled_amount('',false));
672 }
new class for managing the reconciliation it must be used instead of the function InsertRapt,...
static connect()

References $cn, $rap, and Dossier\connect().

+ Here is the call graph for this function:

◆ widget()

Acc_Reconciliation::widget ( )

return a widget of type js_concerned

Definition at line 52 of file acc_reconciliation.class.php.

53 {
54 $wConcerned=new IConcerned();
55 $wConcerned->extra=0; // with 0 javascript search from e_amount... field (see javascript)
56
57 return $wConcerned;
58
59 }
Html Input.

Field Documentation

◆ $a_jrn

Acc_Reconciliation::$a_jrn

Definition at line 36 of file acc_reconciliation.class.php.

◆ $db

Acc_Reconciliation::$db

database connection

Definition at line 34 of file acc_reconciliation.class.php.

◆ $end_day

Acc_Reconciliation::$end_day

Definition at line 38 of file acc_reconciliation.class.php.

◆ $jr_id

Acc_Reconciliation::$jr_id

jr_id

Definition at line 35 of file acc_reconciliation.class.php.

Referenced by set_jr_id().

◆ $start_day

Acc_Reconciliation::$start_day

Definition at line 37 of file acc_reconciliation.class.php.


The documentation for this class was generated from the following file: