========
You can select multi ledger, it is now adapted for great organisation with more than 600 ledgers
This commit is contained in:
Dany De Bontridder 2010-07-03 22:03:04 +00:00
parent 4a999eb2a5
commit bff16accf5
7 changed files with 105 additions and 49 deletions

View file

@ -44,7 +44,7 @@ if ( $User->check_action(IMPBAL) == 0)
echo 'poste;libelle;deb;cred;solde deb;solde cred';
printf("\n");
$bal=new Acc_Balance($cn);
$bal->jrn=$_GET['p_jrn'];
$bal->jrn=(isset($_GET['r_jrn']))?$_GET['r_jrn']:null;
$bal->from_poste=$_GET['from_poste'];
$bal->to_poste=$_GET['to_poste'];

View file

@ -514,3 +514,15 @@ function success_box(req,json)
function error_box () {
alert('IBOX : error_box ajax not implemented');
}
/**
* show the ledger choice
*/
function show_ledger_choice() {
g('div_jrn').style.visibility='visible';
}
/**
* hide the ledger choice
*/
function hide_ledger_choice() {
g('div_jrn').style.visibility='hidden';
}

View file

@ -50,7 +50,7 @@ $User->can_request(IMPBAL,1);
extract ($_GET);
$bal->jrn=$_GET['p_jrn'];
$bal->jrn=(isset($_GET['p_jrn']))?$_GET['p_jrn']:null;
$bal->from_poste=$_GET['from_poste'];
$bal->to_poste=$_GET['to_poste'];

View file

@ -861,3 +861,14 @@ div.op_detail_title {
}
div#div_jrn{
position:absolute;
border:1px solid black;
top:15%;left:100;
visibility:hidden;
z-index:2;
width:50em;
background-color:#EDF3FF;
}

View file

@ -48,14 +48,16 @@ echo js_include('dragdrop.js');
echo js_include('card.js');
echo js_include('acc_ledger.js');
echo IPoste::ipopup('ipop_account');
echo '<div class="content">';
// Show the form for period
echo '<FORM action="?p_action=impress&type=bal" method="post">';
echo '<FORM method="get">';
echo HtmlInput::hidden('p_action','impress');
echo HtmlInput::hidden('type','bal');
echo dossier::hidden();
// filter on the current year
$from=(isset($_POST["from_periode"]))?$_POST['from_periode']:"";
$from=(isset($_GET["from_periode"]))?$_GET['from_periode']:"";
$input_from=new IPeriod("from_periode",$from);
$input_from->show_end_date=false;
$input_from->type=ALL;
@ -64,7 +66,7 @@ $input_from->filter_year;
$input_from->user=$User;
echo 'Depuis :'.$input_from->input();
// filter on the current year
$to=(isset($_POST["to_periode"]))?$_POST['to_periode']:"";
$to=(isset($_GET["to_periode"]))?$_GET['to_periode']:"";
$input_to=new IPeriod("to_periode",$to);
$input_to->show_start_date=false;
$input_to->filter_year;
@ -74,29 +76,43 @@ $input_to->user=$User;
echo ' jusque :'.$input_to->input();
//-------------------------------------------------
$l=new Acc_Ledger($cn,0);
$journal=$l->select_ledger('ALL',3);
/* add a all ledger choice */
$blank=array('value'=>-1,'label'=>'Tous les journaux ');
$array=$journal->value;
$array[]=$blank;
$journal->value=$array;
$ledger=new IButton('l');
$ledger->label="Journaux";
$ledger->javascript=" show_ledger_choice()";
echo $ledger->input();
$journal->name="p_jrn";
/* create a hidden div for the ledger */
echo '<div id="div_jrn">';
echo '<h2 class="info">Choix des journaux</h2>';
$selected=(isset($_GET['r_jrn']))?$_GET['r_jrn']:null;
$array_ledger=$User->get_ledger('ALL',3);
echo '<ul>';
for ($e=0;$e<count($array_ledger);$e++){
$row=$array_ledger[$e];
$r=new ICheckBox('r_jrn['.$e.']',$row['jrn_def_id']);
if ( $selected != null && isset($selected[$e])) { $r->selected=true;}
echo '<li style="list-style-type: none;">'.$r->input().$row['jrn_def_name'].'('.$row['jrn_def_type'].')</li>';
}
echo '</ul>';
$hide=new IButton('l');
$hide->label="Cacher";
$hide->javascript=" hide_ledger_choice() ";
echo $hide->input();
echo '</div>';
if ( isset($_POST['p_jrn'])) $journal->selected=$_POST['p_jrn'];
else
$journal->selected=-1;
echo "Journal = ".$journal->input();
$from_poste=new IPoste();
$from_poste->name="from_poste";
$from_poste->set_attribute('ipopup','ipop_account');
$from_poste->set_attribute('label','from_poste_label');
$from_poste->set_attribute('account','from_poste');
$from_poste->value=(isset($_POST['from_poste']))?$_POST['from_poste']:"";
$from_poste->value=(isset($_GET['from_poste']))?$_GET['from_poste']:"";
$from_span=new ISpan("from_poste_label","");
$to_poste=new IPoste();
@ -105,7 +121,7 @@ $to_poste->set_attribute('ipopup','ipop_account');
$to_poste->set_attribute('label','to_poste_label');
$to_poste->set_attribute('account','to_poste');
$to_poste->value=(isset($_POST['to_poste']))?$_POST['to_poste']:"";
$to_poste->value=(isset($_GET['to_poste']))?$_GET['to_poste']:"";
$to_span=new ISpan("to_poste_label","");
echo "<div>";
@ -122,7 +138,7 @@ echo '<hr>';
// Form
//-----------------------------------------------------
// Show the export button
if ( isset ($_POST['view'] ) ) {
if ( isset ($_GET['view'] ) ) {
$hid=new IHidden();
@ -132,21 +148,26 @@ if ( isset ($_POST['view'] ) ) {
dossier::hidden().
HtmlInput::submit('bt_pdf',"Export PDF").
HtmlInput::hidden("p_action","impress").
HtmlInput::hidden("from_periode",$_POST['from_periode']).
HtmlInput::hidden("to_periode",$_POST['to_periode']).
HtmlInput::hidden("p_jrn",$_POST['p_jrn']).
HtmlInput::hidden("from_poste",$_POST['from_poste']).
HtmlInput::hidden("to_poste",$_POST['to_poste']);
HtmlInput::hidden("from_periode",$_GET['from_periode']).
HtmlInput::hidden("to_periode",$_GET['to_periode']);
for ($e=0;$e<count($array_ledger);$e++)
if (isset($selected[$e]))
echo HtmlInput::hidden("r_jrn[]",$e);
echo HtmlInput::hidden("from_poste",$_GET['from_poste']).
HtmlInput::hidden("to_poste",$_GET['to_poste']);
echo "</form></TD>";
echo '<TD><form method="GET" ACTION="bal_csv.php">'.
HtmlInput::submit('bt_csv',"Export CSV").
dossier::hidden().
HtmlInput::hidden("p_action","impress").
HtmlInput::hidden("from_periode",$_POST['from_periode']).
HtmlInput::hidden("to_periode",$_POST['to_periode']).
HtmlInput::hidden("p_jrn",$_POST['p_jrn']).
HtmlInput::hidden("from_poste",$_POST['from_poste']).
HtmlInput::hidden("to_poste",$_POST['to_poste']);
HtmlInput::hidden("from_periode",$_GET['from_periode']).
HtmlInput::hidden("to_periode",$_GET['to_periode']);
for ($e=0;$e<count($array_ledger);$e++)
if (isset($selected[$e]))
echo HtmlInput::hidden("r_jrn[]",$e);
echo HtmlInput::hidden("from_poste",$_GET['from_poste']).
HtmlInput::hidden("to_poste",$_GET['to_poste']);
echo "</form></TD>";
@ -159,17 +180,20 @@ if ( isset ($_POST['view'] ) ) {
//-----------------------------------------------------
// Display result
//-----------------------------------------------------
if ( isset($_POST['view'] ) ) {
if ( isset($_GET['view'] ) ) {
$bal=new Acc_Balance($cn);
$bal->jrn=$_POST['p_jrn'];
$bal->from_poste=$_POST['from_poste'];
$bal->to_poste=$_POST['to_poste'];
for ($e=0;$e<count($array_ledger);$e++)
if (isset($selected[$e]))
$bal->jrn[]=$e;
$row=$bal->get_row($_POST['from_periode'],
$_POST['to_periode']);
$bal->from_poste=$_GET['from_poste'];
$bal->to_poste=$_GET['to_poste'];
$row=$bal->get_row($_GET['from_periode'],
$_GET['to_periode']);
$periode=new Periode($cn);
$a=$periode->get_date_limit($_POST['from_periode']);
$b=$periode->get_date_limit($_POST['to_periode']);
$a=$periode->get_date_limit($_GET['from_periode']);
$b=$periode->get_date_limit($_GET['to_periode']);
echo "<h2 class=\"info\"> période du ".$a['p_start']." au ".$b['p_end']."</h2>";
echo '<table width="100%">';

View file

@ -29,13 +29,12 @@ require_once('class_acc_account.php');
class Acc_Balance {
var $db; /*! < database connection */
var $row; /*! < row for ledger*/
var $jrn; /*!< jrn_def.jr_id or -1 for all of
them */
var $jrn; /*!< idx of a table of ledger create by user->get_ledger */
var $from_poste; /*!< from_poste filter on the post */
var $to_poste; /*!< to_poste filter on the post*/
function Acc_Balance($p_cn) {
$this->db=$p_cn;
$this->jrn=-1;
$this->jrn=null;
$from_poste="";
$to_poste="";
}
@ -63,8 +62,19 @@ class Acc_Balance {
$and=""; $jrn="";
$from_poste="";$to_poste="";
if ($this->jrn!= null){
$user=new User($this->db);
$ajrn=$user->get_ledger('ALL',3);
$jrn=" j_jrn_def in (";$comma='';
for ($e=0;$e<count($this->jrn);$e++) {
$idx=$this->jrn[$e];
$jrn.=$comma.$ajrn[$idx]['jrn_def_id'];
$comma=',';
}
$jrn.=')';
$and=" and ";
}
if ($this->jrn!= -1){ $jrn=" $and j_jrn_def=".$this->jrn;$and=" and ";}
if ( strlen(trim($this->from_poste)) != 0 && $this->from_poste!=-1 ) {
$from_poste=" $and j_poste::text >= '".$this->from_poste."'"; $and=" and ";
}
@ -79,9 +89,9 @@ class Acc_Balance {
( select j_poste,
case when j_debit='t' then j_montant else 0 end as deb,
case when j_debit='f' then j_montant else 0 end as cred
from jrnx join tmp_pcmn on j_poste=pcm_val
left join parm_periode on j_tech_per = p_id
join jrn_def on (j_jrn_def=jrn_def_id)
from jrnx join tmp_pcmn on (j_poste=pcm_val)
left join parm_periode on (j_tech_per = p_id)
join jrn_def on (j_jrn_def=jrn_def_id)
where
$jrn $from_poste $to_poste
$and $filter_sql

View file

@ -12,6 +12,9 @@ Conséquence : réécriture de code, correction modop, ...
10. TODO2 Object pour extourner proprement une operation, le fichier annulation.php devient inutile (deprecated) depend de TODO1 TODO10
11. TODO17 extourne depuis DIV HTML dépend de TODO16
12. TODO10 Enlever le bouton enlever dans les listes d'opération et le mettre dans le DIV HTML qui présente les détails de l'op
13. Pour les balances, on peut choisir les journaux : adapté à ceux en ayant vraiment beaucoup
14. Depuis les lettrages, on peut aussi accèder aux détails d'une opération
15. TODO9 - dépend de TODO4 TODO2 - dans impressions, on peut avoir les détails de toutes les opérations
IDEE6, categorie de fiche, changer la présentation
@ -21,9 +24,6 @@ TODO8 ajout bouton "ajoutez ligne" pour les prévisions
IDEE1 Catégorie de fiche : changer la présentation ?
TODO9 - dépend de TODO4 TODO2 - dans impressions, on peut avoir les détails de toutes les opérations
TODO11 Ajoutez aux classes Ledger_* une fonction pour obtenir un tableau vide qui répresente le tableau utilisé par confirm, insert et veriffy
TODO12 Pour les anouveaux, les mêmes comptes se retrouvent au crédit ET au débit, il faudrait en avoir la soustraction !!
@ -32,7 +32,6 @@ TODO13 Bouton validate CA ne fonctionne plus
TODO14 confirmation quand effacement d'un PA (comptabilité analytique -> Plan Analytique)
REFLEXION1 Pièce attachée uniquement depuis détail opération ?
TODO19 Le menu Grand Livre devient recherche