Historic of CARD or ACCOUNTING in HTML DIV with link to the visible operation

This commit is contained in:
Dany De Bontridder 2010-07-02 23:14:22 +00:00
parent ceb83c6b11
commit 977591b2e4
10 changed files with 154 additions and 47 deletions

View file

@ -433,13 +433,51 @@ function go_next_concerned() {
}
return true;
}
function view_history_account(p_value,dossier)
{
layer++;id='det'+layer;
var popup={'id':id,'cssclass':'op_detail','html':loading(),'drag':true};
querystring='?gDossier='+dossier+'&act=de&pcm_val='+p_value+'&div='+id;
add_div(popup);
var action=new Ajax.Request(
"ajax_history.php",
{
method:'get',
parameters:querystring,
onFailure:error_box,
onSuccess:success_box
}
);
g(id).style.top=posY-40;
g(id).style.left=posX-10;
}
/*!\brief
* \param p_value jrn.jr_id
* \param p_jrn ledger number
* \param p_vue easy or expert view of the operation
* \param p_value f_id of the card
*/
function view_history_card(p_value,dossier)
{
layer++;id='det'+layer;
var popup={'id':id,'cssclass':'op_detail','html':loading(),'drag':true};
querystring='?gDossier='+dossier+'&act=de&f_id='+p_value+'&div='+id;
add_div(popup);
var action=new Ajax.Request(
"ajax_history.php",
{
method:'get',
parameters:querystring,
onFailure:error_box,
onSuccess:success_box
}
);
g(id).style.top=posY-40;
g(id).style.left=posX-10;
}
/*!\brief
* \param p_value jrn.jr_id
*/
function modifyOperation(p_value,dossier)
{
layer++;id='det'+layer;

View file

@ -264,11 +264,12 @@ function get_solde_detail($p_cond="") {
*/
function HtmlTable()
function HtmlTable($p_array=null )
{
if ( $p_array==null)$p_array=$_REQUEST;
$this->get_name();
list($array,$tot_deb,$tot_cred)=$this->get_row_date( $_REQUEST['from_periode'],
$_REQUEST['to_periode']
list($array,$tot_deb,$tot_cred)=$this->get_row_date( $p_array['from_periode'],
$p_array['to_periode']
);
if ( count($this->row ) == 0 )
@ -288,8 +289,11 @@ function get_solde_detail($p_cond="") {
"</TR>";
foreach ( $this->row as $op ) {
$vw_operation=sprintf('<A class="detail" style="text-decoration:underline" HREF="javascript:modifyOperation(\'%s\',\'%s\')" >%s</A>',
$op['jr_id'], dossier::id(), $op['jr_internal']);
echo "<TR>".
"<TD>".$op['jr_internal']."</TD>".
"<TD>".$vw_operation."</TD>".
"<TD>".$op['j_date']."</TD>".
"<TD>".h($op['description']).' '.h($op['jr_pj_number'])."</TD>".
"<TD>".$op['deb_montant']."</TD>".

View file

@ -541,8 +541,8 @@ jr_comment||' ('||jr_internal||')'||case when jr_pj_number is not null and jr_pj
}
//DEBUG
$r.=sprintf('<A class="detail" HREF="javascript:modifyOperation(\'%s\',\'%s\',\'%s\',\'%s\')" >%s</A>',
$row['jr_id'], $gDossier, $row['jrn_def_id'],$vue, $row['jr_internal']);
$r.=sprintf('<A class="detail" HREF="javascript:modifyOperation(\'%s\',\'%s\')" >%s</A>',
$row['jr_id'], $gDossier, $row['jr_internal']);
$r.="</TD>";
if ( $this->type=='') $r.=td($row['jrn_def_name']);
// date

View file

@ -1038,7 +1038,7 @@ av_text1=>'name'
if ( $p_array == null)
$p_array=$_REQUEST;
$name=h($this->getName());
$name=h($this->getName()).'['.$this->strAttribut(ATTR_DEF_QUICKCODE).']';
list($array,$tot_deb,$tot_cred)=$this->get_row_date( $p_array['from_periode'],
$p_array['to_periode']
@ -1049,7 +1049,7 @@ av_text1=>'name'
$rep="";
echo '<h2 class="info">'.$this->id." ".$name.'</h2>';
echo '<h2 class="info">'." ".$name.'</h2>';
echo "<TABLE class=\"result\" width=\"100%\">";
echo "<TR>".
"<TH>"._('Code interne')." </TH>".
@ -1060,8 +1060,11 @@ av_text1=>'name'
"</TR>";
foreach ( $this->row as $op ) {
$vw_operation=sprintf('<A class="detail" style="text-decoration:underline" HREF="javascript:modifyOperation(\'%s\',\'%s\')" >%s</A>',
$op['jr_id'], dossier::id(), $op['jr_internal']);
echo "<TR>".
"<TD>".$op['jr_internal']."</TD>".
"<TD>".$vw_operation."</TD>".
"<TD>".$op['j_date_fmt']."</TD>".
"<TD>".h($op['description'])."</TD>".
"<TD>".$op['deb_montant']."</TD>".

View file

@ -0,0 +1,11 @@
<div style="text-align:right;height:13px">
<?
if ($div != "popup") {
$callback=$_SERVER['PHP_SELF'];
$str=$_SERVER['QUERY_STRING']."&act=de&ajax=$callback";
echo '<A style="margin-right:5px;background-color:blue;color:white;text-decoration:none" HREF="javascript:void(0)" onclick="var a=window.open(\'popup.php?'.$str.'\',\'\',\'toolbar=0,width=600,height=400,scrollbars=yes,resizable=yes,status=0,location=0\'); a.focus();removeDiv(\''.$div.'\')">
!pop me up ! </A>';
echo '<A style="background-color:blue;color:white;text-decoration:none" HREF="javascript:void(0)" onclick="removeDiv(\''.$div.'\');">Fermer</A>';
}
?>
</div>

View file

@ -21,13 +21,11 @@ $bk=new Fiche($cn,$obj->det->array[0]['qp_supplier']);
echo td(_('Client'));
/**
*@file
*@todo ajouter la possiblité d'avoir l'historique si on cliques sur le quick_code
*@quant_fin les opérations avec visa ne sont pas rentrées dans quant_fin, donc il faut
* faire une procédure pl/sql : chercher les enregistrements qui ne sont pas dans quant_fin
* et celui qui est ni client ni fournisseur est forcément le compte banque, insérer.
*@todo Ajouter une clef unique sur quant_fin.jr_id, quant_purchase.j_id et quant_sold.j_id
*/
echo td(h($bk->getName())).td($bk->get_quick_code());;
$view_history= sprintf('<A class="detail" HREF="javascript:view_history_card(\'%s\',\'%s\')" >%s</A>',
$bk->id, $gDossier, $bk->get_quick_code());
echo td(h($bk->getName())).td($view_history);;
?>
</tr>
<tr>
@ -79,7 +77,11 @@ echo '</tr>';
$row='';
$q=$obj->det->array[$e];
$fiche=new Fiche($cn,$q['qp_fiche']);
$row=td($fiche->strAttribut(ATTR_DEF_QUICKCODE));
$view_history= sprintf('<A class="detail" HREF="javascript:view_history_card(\'%s\',\'%s\')" >%s</A>',
$fiche->id, $gDossier, $fiche->strAttribut(ATTR_DEF_QUICKCODE));
$row=td($view_history);
$row.=td($fiche->strAttribut(ATTR_DEF_NAME));
$row.=td($q['qp_vat_code'],'class="num"');
$row.=td(sprintf("%.2f",$q['qp_price']),'class="num"');
@ -137,8 +139,21 @@ echo th(_('Crédit'),' style="text-align:right"');
echo '</tr>';
for ($e=0;$e<count($detail->det->array);$e++) {
$row=''; $q=$detail->det->array;
$row=td($q[$e]['j_poste']);
$row.=td($q[$e]['j_qcode']);
$view_history= sprintf('<A class="detail" style="text-decoration:underline" HREF="javascript:view_history_account(\'%s\',\'%s\')" >%s</A>',
$q[$e]['j_poste'], $gDossier, $q[$e]['j_poste']);
$row.=td($view_history);
if ( $q[$e]['j_qcode'] !=''){
$fiche=new Fiche($cn);
$fiche->get_by_qcode($q[$e]['j_qcode']);
$view_history= sprintf('<A class="detail" style="text-decoration:underline" HREF="javascript:view_history_card(\'%s\',\'%s\')" >%s</A>',
$fiche->id,$gDossier, $q[$e]['j_qcode']);
}
else
$view_history='';
$row.=td($view_history);
/* $row=td($q[$e]['j_poste']); */
/* $row.=td($q[$e]['j_qcode']); */
if ( $q[$e]['j_qcode'] !='') {
// nom de la fiche
$ff=new Fiche($cn);

View file

@ -14,25 +14,24 @@
<tr>
<?
$bk=new Fiche($cn,$obj->det->array[0]['qf_bank']);
echo td($bk->get_quick_code());
$view_history= sprintf('<A class="detail" HREF="javascript:view_history_card(\'%s\',\'%s\')" >%s</A>',
$bk->id, $gDossier, $bk->get_quick_code());
echo td(h($bk->getName())).td($view_history);;
/**
*@file
*@todo ajouter la possiblité d'avoir l'historique si on cliques sur le quick_code
*@quant_fin les opérations avec visa ne sont pas rentrées dans quant_fin, donc il faut
* faire une procédure pl/sql : chercher les enregistrements qui ne sont pas dans quant_fin
* et celui qui est ni client ni fournisseur est forcément le compte banque, insérer.
*@todo Ajouter une clef unique sur quant_fin.jr_id, quant_purchase.j_id et quant_sold.j_id
*/
echo td(h($bk->getName()));
?>
</tr>
<tr>
<?
$bk=new Fiche($cn,$obj->det->array[0]['qf_other']);
echo td($bk->get_quick_code());
$view_history= sprintf('<A class="detail" HREF="javascript:view_history_card(\'%s\',\'%s\')" >%s</A>',
$bk->id, $gDossier, $bk->get_quick_code());
echo td(h($bk->getName()));
echo td($view_history);
?>
</tr>
@ -77,8 +76,19 @@ echo th(_('Crédit'),' style="text-align:right"');
echo '</tr>';
for ($e=0;$e<count($detail->det->array);$e++) {
$row=''; $q=$detail->det->array;
$row=td($q[$e]['j_poste']);
$row.=td($q[$e]['j_qcode']);
$view_history= sprintf('<A class="detail" style="text-decoration:underline" HREF="javascript:view_history_account(\'%s\',\'%s\')" >%s</A>',
$q[$e]['j_poste'], $gDossier, $q[$e]['j_poste']);
$row.=td($view_history);
if ( $q[$e]['j_qcode'] !=''){
$fiche=new Fiche($cn);
$fiche->get_by_qcode($q[$e]['j_qcode']);
$view_history= sprintf('<A class="detail" style="text-decoration:underline" HREF="javascript:view_history_card(\'%s\',\'%s\')" >%s</A>',
$fiche->id,$gDossier, $q[$e]['j_qcode']);
}
else
$view_history='';
$row.=td($view_history);
if ( $q[$e]['j_qcode'] !='') {
// nom de la fiche
$ff=new Fiche($cn);

View file

@ -71,8 +71,20 @@ echo th(_('Crédit'), 'style="text-align:right"');
echo '</tr>';
for ($e=0;$e<count($obj->det->array);$e++) {
$row=''; $q=$obj->det->array;
$row=td($q[$e]['j_poste']);
$row.=td($q[$e]['j_qcode']);
$view_history= sprintf('<A class="detail" style="text-decoration:underline" HREF="javascript:view_history_account(\'%s\',\'%s\')" >%s</A>',
$q[$e]['j_poste'], $gDossier, $q[$e]['j_poste']);
$row.=td($view_history);
if ( $q[$e]['j_qcode'] !='') {
$fiche=new Fiche($cn);
$fiche->get_by_qcode($q[$e]['j_qcode']);
$view_history= sprintf('<A class="detail" style="text-decoration:underline" HREF="javascript:view_history_card(\'%s\',\'%s\')" >%s</A>',
$fiche->id, $gDossier, $q[$e]['j_qcode']);
}
else
$view_history='';
$row.=td($view_history);
if ( $q[$e]['j_qcode'] !='') {
// nom de la fiche
$ff=new Fiche($cn);

View file

@ -21,13 +21,11 @@ $bk=new Fiche($cn,$obj->det->array[0]['qs_client']);
echo td(_('Client'));
/**
*@file
*@todo ajouter la possiblité d'avoir l'historique si on cliques sur le quick_code
*@quant_fin les opérations avec visa ne sont pas rentrées dans quant_fin, donc il faut
* faire une procédure pl/sql : chercher les enregistrements qui ne sont pas dans quant_fin
* et celui qui est ni client ni fournisseur est forcément le compte banque, insérer.
*@todo Ajouter une clef unique sur quant_fin.jr_id, quant_purchase.j_id et quant_sold.j_id
*/
echo td(h($bk->getName())).td($bk->get_quick_code());;
$view_history= sprintf('<A class="detail" HREF="javascript:view_history_card(\'%s\',\'%s\')" >%s</A>',
$bk->id, $gDossier, $bk->get_quick_code());
echo td(h($bk->getName())).td($view_history);;
?>
</tr>
<tr>
@ -79,7 +77,10 @@ echo '</tr>';
$row='';
$q=$obj->det->array[$e];
$fiche=new Fiche($cn,$q['qs_fiche']);
$row=td($fiche->strAttribut(ATTR_DEF_QUICKCODE));
$view_history= sprintf('<A class="detail" HREF="javascript:view_history_card(\'%s\',\'%s\')" >%s</A>',
$fiche->id, $gDossier, $fiche->strAttribut(ATTR_DEF_QUICKCODE));
$row=td($view_history);
$row.=td($fiche->strAttribut(ATTR_DEF_NAME));
$row.=td($q['qs_vat_code'],'class="num"');
$row.=td(sprintf("%.2f",$q['qs_price']),'class="num"');
@ -136,22 +137,34 @@ echo th(_('Débit'),' style="text-align:right"');
echo th(_('Crédit'),' style="text-align:right"');
echo '</tr>';
for ($e=0;$e<count($detail->det->array);$e++) {
$row=''; $q=$detail->det->array;
$row=td($q[$e]['j_poste']);
$row.=td($q[$e]['j_qcode']);
if ( $q[$e]['j_qcode'] !='') {
$row=''; $q=$detail->det->array[$e];
$view_history= sprintf('<A class="detail" style="text-decoration:underline" HREF="javascript:view_history_account(\'%s\',\'%s\')" >%s</A>',
$q['j_poste'], $gDossier, $q['j_poste']);
$row.=td($view_history);
if ( $q['j_qcode'] !=''){
$fiche=new Fiche($cn);
$fiche->get_by_qcode($q['j_qcode']);
$view_history= sprintf('<A class="detail" style="text-decoration:underline" HREF="javascript:view_history_card(\'%s\',\'%s\')" >%s</A>',
$fiche->id,$gDossier, $q['j_qcode']);
}
else
$view_history='';
$row.=td($view_history);
if ( $q['j_qcode'] !='') {
// nom de la fiche
$ff=new Fiche($cn);
$ff->get_by_qcode( $q[$e]['j_qcode']);
$ff->get_by_qcode( $q['j_qcode']);
$row.=td($ff->strAttribut(h(ATTR_DEF_NAME)));
} else {
// libellé du compte
$name=$cn->get_value('select pcm_lib from tmp_pcmn where pcm_val=$1',array($q[$e]['j_poste']));
$name=$cn->get_value('select pcm_lib from tmp_pcmn where pcm_val=$1',array($q['j_poste']));
$row.=td(h($name));
}
$montant=td(sprintf("%.2f",$q[$e]['j_montant']),'class="num"');
$row.=($q[$e]['j_debit']=='t')?$montant:td('');
$row.=($q[$e]['j_debit']=='f')?$montant:td('');
$montant=td(sprintf("%.2f",$q['j_montant']),'class="num"');
$row.=($q['j_debit']=='t')?$montant:td('');
$row.=($q['j_debit']=='f')?$montant:td('');
echo tr($row);
}

View file

@ -1,6 +1,7 @@
1. Ajout balance par catégorie de fiche
2. DONE3. changer le code pour ajouter de la CA ou la modifier dans un DIV HTML, le fichier jrn.php devient inutile (deprecated)
3. DONE16 Détail opération dans DIV HTML
4. Dans les détails d'opérations, on a aussi des liens vers les historiques par fiche ou par poste comptable
TODO1 réecriture de quant_* la liaison avec la jrn se fait à travers jr_id et non pas jr_internal qui n'est pas indexé.
Conséquence : réécriture de code, correction modop, ...