Reconciliation
============== The html is done, it 's still to do * export PDF * Choice & Filter on jrn, same as balance
This commit is contained in:
parent
174fd18f65
commit
a4f7d47e55
8 changed files with 279 additions and 8 deletions
|
|
@ -54,6 +54,7 @@ echo js_include('card.js');
|
|||
echo js_include('compute.js');
|
||||
echo js_include('compute_direct.js');
|
||||
echo js_include('ajax_fiche.js');
|
||||
echo js_inc
|
||||
echo JS_INFOBULLE;
|
||||
|
||||
/* show button to return to access */
|
||||
|
|
|
|||
|
|
@ -70,7 +70,8 @@ $array=array(
|
|||
array(30,'Ereg and preg_match'),
|
||||
array(31,'IBOX'),
|
||||
array(32,'Acc_Operation & children'),
|
||||
array(33,'Ledger : reverse op')
|
||||
array(33,'Ledger : reverse op'),
|
||||
array(34,'Reconciliation')
|
||||
);
|
||||
$r='<form method="get">';
|
||||
$r.='<select name="test_select" >';
|
||||
|
|
@ -276,6 +277,10 @@ case 33:
|
|||
require_once('class_acc_ledger.php');
|
||||
Acc_Ledger::test_me('reverse');
|
||||
break;
|
||||
case 34:
|
||||
require_once('class_acc_reconciliation.php');
|
||||
Acc_Reconciliation::test_me();
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -167,6 +167,87 @@ class Acc_Reconciliation {
|
|||
}
|
||||
return $r;
|
||||
}
|
||||
function fill_info() {
|
||||
$sql="select jr_id,jr_date,jr_comment,jr_internal,jr_montant,jr_pj,jr_def_id,jrn_def_name,jrn_def_type
|
||||
from jrn join jrn_def on (jrn_def_id=jr_def_id)
|
||||
where jr_id=$1";
|
||||
$a=$this->db->get_array($sql,array($this->jr_id));
|
||||
return $a[0];
|
||||
}
|
||||
/**
|
||||
*@brief return array of not-reconciled operation
|
||||
*@param
|
||||
*@return
|
||||
*@note
|
||||
*@see
|
||||
@code
|
||||
|
||||
@endcode
|
||||
*/
|
||||
function get_not_reconciled($pa_jrn) {
|
||||
$array=$this->db->get_array("select distinct jr_id from jrn where jr_id not in (select jr_id from jrn_rapt union select jra_concerned from jrn_rapt)");
|
||||
$ret=array();
|
||||
for ($i=0;$i<count($array);$i++) {
|
||||
$this->jr_id=$array[$i]['jr_id'];
|
||||
$ret[$i]['first']=$this->fill_info();
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
/**
|
||||
*@brief return array of reconciled operation
|
||||
*@param
|
||||
*@return
|
||||
*@note
|
||||
*@see
|
||||
@code
|
||||
|
||||
@endcode
|
||||
*/
|
||||
function get_reconciled($pa_jrn)
|
||||
{
|
||||
$array=$this->db->get_array("select distinct jr_id from jrn where jr_id in (select jr_id from jrn_rapt union select jra_concerned from jrn_rapt)");
|
||||
$ret=array();
|
||||
for ($i=0;$i<count($array);$i++) {
|
||||
$this->jr_id=$array[$i]['jr_id'];
|
||||
$ret[$i]['first']=$this->fill_info();
|
||||
$atmp=$this->get();
|
||||
for ( $e=0;$e<count($atmp);$e++){
|
||||
$this->jr_id=$atmp[$e];
|
||||
$ret[$i]['depend'][$e]=$this->fill_info();
|
||||
}
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
/**
|
||||
*@brief
|
||||
*@param
|
||||
*@return
|
||||
*@note
|
||||
*@see
|
||||
@code
|
||||
|
||||
@endcode
|
||||
*/
|
||||
function get_reconciled_amount($pa_jrn,$p_equal=false)
|
||||
{
|
||||
$array=$this->get_reconciled($pa_jrn);
|
||||
$ret=array();
|
||||
for ($i=0;$i<count($array);$i++) {
|
||||
$first_amount=$array[$i]['first']['jr_montant'];
|
||||
$second_amount=0;
|
||||
for ($e=0;$e<count($array[$i]['depend']);$e++){
|
||||
$second_amount+=$array[$i]['depend'][$e]['jr_montant'];
|
||||
}
|
||||
if ( $p_equal && $first_amount==$second_amount) {
|
||||
$ret[]=$array[$i];
|
||||
}
|
||||
if ( ! $p_equal && $first_amount != $second_amount) {
|
||||
$ret[]=$array[$i];
|
||||
}
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
/*!\brief return the javascript function (static method)
|
||||
*
|
||||
static function javascript() {
|
||||
|
|
@ -176,7 +257,7 @@ class Acc_Reconciliation {
|
|||
static function test_me() {
|
||||
$cn=new Database(dossier::id());
|
||||
$rap=new Acc_Reconciliation($cn);
|
||||
$rap->set_jr_id(38);
|
||||
/* $rap->set_jr_id(38);
|
||||
$a=$rap->get();
|
||||
print_r($a);
|
||||
$rap->remove(4);
|
||||
|
|
@ -189,6 +270,9 @@ class Acc_Reconciliation {
|
|||
|
||||
$w->extra2="";
|
||||
echo $w->input();
|
||||
*/
|
||||
//var_dump($rap->get_reconciled(''));
|
||||
var_dump($rap->get_reconciled_amount('',false));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -624,18 +624,19 @@ Array
|
|||
*/
|
||||
function lo_unlink($p_oid) { return pg_lo_unlink($this->db,$p_oid); }
|
||||
|
||||
/*!\brief wrapper for the function pg_lo_unlink
|
||||
/*!\brief wrapper for the function pg_prepare
|
||||
*\param $p_string string name for pg_prepare function
|
||||
*\param $p_sql is the sql to prepare
|
||||
*\return return the result of the operation
|
||||
*/
|
||||
function prepare($p_string,$p_sql) { return pg_prepare($this->db,$p_string,$p_sql); }
|
||||
/*!\brief wrapper for the function pg_lo_unlink
|
||||
*\param $p_string string name for pg_prepare function
|
||||
/*!\brief wrapper for the function pg_execute
|
||||
*\param $p_string string name of the stmt given in pg_prepare function
|
||||
*\param $p_array contains the variables
|
||||
*\return return the result of the operation
|
||||
*\note set this->ret to the return of pg_execute
|
||||
*\return return the result of the operation,
|
||||
*/
|
||||
function execute($p_string,$p_array) { return pg_execute($this->db,$p_string,$p_array); }
|
||||
function execute($p_string,$p_array) { $this->ret=pg_execute($this->db,$p_string,$p_array); return $this->ret;}
|
||||
|
||||
/*!\brief wrapper for the function pg_lo_export
|
||||
*\param $p_oid is the oid of the log
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@ License: GPL
|
|||
*/
|
||||
/*!
|
||||
*\brief create the HTML for including of a javascript file
|
||||
* if a file is included twice, the second time it will be discarded
|
||||
* there is an alert if the file doesn't exist
|
||||
*\param $p_string name of the file
|
||||
*\return the HTML script
|
||||
*/
|
||||
|
|
@ -810,4 +812,36 @@ function escape_xml($p_xml) {
|
|||
$xml=str_replace('"','"',$xml);
|
||||
return $xml;
|
||||
}
|
||||
/**
|
||||
*load all the javascript in once
|
||||
*/
|
||||
function load_all_script()
|
||||
{
|
||||
echo JS_INFOBULLE;
|
||||
echo js_include('prototype.js');
|
||||
echo js_include('scriptaculous.js');
|
||||
echo js_include('scripts.js');
|
||||
echo js_include('effects.js');
|
||||
echo js_include('dragdrop.js');
|
||||
echo js_include('controls.js');
|
||||
echo js_include('slider.js');
|
||||
|
||||
echo js_include('acc_ledger.js');
|
||||
echo js_include('accounting_item.js');
|
||||
echo js_include('acc_report.js');
|
||||
echo js_include('ajax_fiche.js');
|
||||
echo js_include('anc_script.js');
|
||||
echo js_include('bq_import.js');
|
||||
echo js_include('builder.js');
|
||||
echo js_include('calc.js');
|
||||
echo js_include('card.js');
|
||||
echo js_include('compute_direct.js');
|
||||
echo js_include('compute.js');
|
||||
echo js_include('confirm.js');
|
||||
echo js_include('extension.js');
|
||||
echo js_include('forecast.js');
|
||||
echo js_include('gestion.js');
|
||||
echo js_include('todo_list.js');
|
||||
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -32,8 +32,9 @@ echo JS_AJAX_FICHE;
|
|||
$p_array=array(array ("?p_action=impress&type=jrn&".$str_dossier,_("Journaux")),
|
||||
array("?p_action=impress&type=gl_comptes&".$str_dossier,_("Grand Livre")), /* AG */
|
||||
array("?p_action=impress&type=poste&".$str_dossier,_("Poste")),
|
||||
array("?p_action=impress&type=fiche&".$str_dossier,_("Catégorie")),
|
||||
array("?p_action=impress&type=fiche&".$str_dossier,_("Catégorie de fiche")),
|
||||
array("?p_action=impress&type=rapport&".$str_dossier,_("Rapport")),
|
||||
array("?p_action=impress&type=rec&".$str_dossier,_("Réconciliation")),
|
||||
array('?p_action=impress&type=bal&'.$str_dossier,_('Balance des comptes')),
|
||||
array("?p_action=impress&type=bilan&".$str_dossier,_("Bilan"))
|
||||
);
|
||||
|
|
@ -53,6 +54,10 @@ include_once("impress_inc.php");
|
|||
// something is choosen
|
||||
$default=( isset ($_REQUEST['type']))?$_REQUEST['type']:"";
|
||||
switch ($default) {
|
||||
case 'rec':
|
||||
$User->can_request(IMPJRN,1);
|
||||
require_once ("impress_rec.inc.php");
|
||||
break;
|
||||
case "jrn":
|
||||
$User->can_request(IMPJRN,1);
|
||||
require_once ("impress_jrn.inc.php");
|
||||
|
|
|
|||
86
include/impress_rec.inc.php
Normal file
86
include/impress_rec.inc.php
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
<?php
|
||||
/*
|
||||
* This file is part of PhpCompta.
|
||||
*
|
||||
* PhpCompta is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PhpCompta is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with PhpCompta; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
/* $Revision$ */
|
||||
|
||||
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
|
||||
|
||||
/*!\file
|
||||
* \brief print the all the operation reconciled or not, with or without the same amount
|
||||
*/
|
||||
require_once ('class_acc_reconciliation.php');
|
||||
require_once('function_javascript.php');
|
||||
echo load_all_script();
|
||||
/**
|
||||
*@file
|
||||
*@todo add a form to filter by available ledgers
|
||||
*/
|
||||
|
||||
/**
|
||||
*@file
|
||||
*@todo add the export to PDF
|
||||
*/
|
||||
echo '<div class="content">';
|
||||
$rjrn='';
|
||||
$radio=new IRadio('choice');
|
||||
$choice=(isset($_GET['choice']))?$_GET['choice']:0;
|
||||
|
||||
echo '<form method="GET">';
|
||||
echo dossier::hidden().HtmlInput::hidden('p_action','impress').HtmlInput::hidden('type','rec');
|
||||
echo '<ol style="list-style-type:none;">';
|
||||
|
||||
$radio->selected=($choice==0)?true:false;$radio->value=0;
|
||||
echo '<li>'.$radio->input().'Opérations réconcilées'.'<li>';
|
||||
|
||||
$radio->selected=($choice==1)?true:false;$radio->value=1;
|
||||
echo '<li>'.$radio->input().'Opérations réconcilées avec des montants différents'.'<li>';
|
||||
|
||||
$radio->selected=($choice==2)?true:false;$radio->value=2;
|
||||
echo '<li>'.$radio->input().'Opérations réconcilées avec des montants identiques'.'<li>';
|
||||
|
||||
$radio->selected=($choice==3)?true:false;$radio->value=3;
|
||||
echo '<li>'.$radio->input().'Opérations non réconcilées'.'<li>';
|
||||
|
||||
echo '</lo>';
|
||||
echo '<br>';
|
||||
echo HtmlInput::submit('vis',_('Visualisation'));
|
||||
echo '</form>';
|
||||
echo '<hr>';
|
||||
echo '</div>';
|
||||
echo '<div class="content">';
|
||||
if ( ! isset($_GET['vis'])) exit();
|
||||
$a=new Acc_Reconciliation($cn);
|
||||
switch ($choice) {
|
||||
case 0:
|
||||
$array=$a->get_reconciled('');
|
||||
break;
|
||||
case 1:
|
||||
$array=$a->get_reconciled_amount('',false);
|
||||
break;
|
||||
case 2:
|
||||
$array=$a->get_reconciled_amount('',true);
|
||||
break;
|
||||
case 3:
|
||||
$array=$a->get_not_reconciled('');
|
||||
break;
|
||||
default:
|
||||
echo "Choix invalid";
|
||||
exit();
|
||||
}
|
||||
require_once('template/impress_reconciliation.php');
|
||||
exit();
|
||||
55
include/template/impress_reconciliation.php
Normal file
55
include/template/impress_reconciliation.php
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
<table class="result">
|
||||
<tr>
|
||||
<th>
|
||||
N°
|
||||
</th>
|
||||
<th>
|
||||
Date
|
||||
</th>
|
||||
<th>
|
||||
N° op
|
||||
</th>
|
||||
<th>
|
||||
n° pièce
|
||||
</th>
|
||||
<th>
|
||||
Libellé
|
||||
</th>
|
||||
<th>
|
||||
Montant
|
||||
</th>
|
||||
</tr>
|
||||
<?
|
||||
for ($i=0;$i<count($array);$i++) {
|
||||
$r='';
|
||||
$r.=td($i);
|
||||
$r.=td(format_date($array[$i]['first']['jr_date']));
|
||||
$detail=sprintf('<a class="detail" href="javascript:modifyOperation(\'%s\',%d)">%s</a>',
|
||||
$array[$i]['first']['jr_id'],$gDossier,$array[$i]['first']['jr_internal']);
|
||||
$r.=td($detail);
|
||||
$r.=td($array[$i]['first']['jr_pj']);
|
||||
$r.=td($array[$i]['first']['jr_comment']);
|
||||
$r.=td($array[$i]['first']['jr_montant']);
|
||||
echo tr($r);
|
||||
if ( isset($array[$i]['depend']) )
|
||||
{
|
||||
$limit=count($array[$i]['depend'])-1;
|
||||
for ($e=0;$e<count($array[$i]['depend']);$e++) {
|
||||
$r='';
|
||||
$r.=td($i);
|
||||
$r.=td(format_date($array[$i]['depend'][$e]['jr_date']));
|
||||
$detail=sprintf('<a class="detail" href="javascript:modifyOperation(\'%s\',%d)">%s</a>',
|
||||
$array[$i]['depend'][$e]['jr_id'],$gDossier,$array[$i]['depend'][$e]['jr_internal']);
|
||||
$r.=td($detail);
|
||||
$r.=td($array[$i]['depend'][$e]['jr_pj']);
|
||||
$r.=td($array[$i]['depend'][$e]['jr_comment']);
|
||||
$r.=td($array[$i]['depend'][$e]['jr_montant']);
|
||||
if ( $e==$limit)
|
||||
echo '<tr style="border-bottom: 1px solid #4f4f7d;">'.$r.'</tr>';
|
||||
else
|
||||
echo tr($r);
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
Loading…
Add table
Add a link
Reference in a new issue