Merged revisions 4739 via svnmerge from
file:///home/developper/svn/phpcompta/tags/rel600 ........ r4739 | danydb | 2012-02-04 02:09:47 +0100 (Sat, 04 Feb 2012) | 4 lines Mantis 519 Montre les montants différents pour les lettrages ........
This commit is contained in:
parent
14796e9e54
commit
2b624ca515
8 changed files with 126 additions and 40 deletions
|
|
@ -292,10 +292,26 @@ class Lettering
|
|||
ob_clean();
|
||||
return $r;
|
||||
}
|
||||
/**
|
||||
*show only the lettered records from jrnx
|
||||
*it fills the array $this->content
|
||||
*/
|
||||
protected function show_lettered_diff()
|
||||
{
|
||||
$this->get_letter_diff();
|
||||
$r="";
|
||||
ob_start();
|
||||
include('template/letter_all.php');
|
||||
$r=ob_get_contents();
|
||||
ob_clean();
|
||||
return $r;
|
||||
}
|
||||
|
||||
/**
|
||||
*show only the not lettered records from jrnx
|
||||
*it fills the array $this->content
|
||||
*/
|
||||
|
||||
protected function show_not_lettered()
|
||||
{
|
||||
$this->get_unletter();
|
||||
|
|
@ -324,6 +340,9 @@ class Lettering
|
|||
case 'letter':
|
||||
return $this->show_lettered();
|
||||
break;
|
||||
case 'letter_diff':
|
||||
return $this->show_lettered_diff();
|
||||
break;
|
||||
}
|
||||
throw new Exception ("[$p_type] is no unknown");
|
||||
}
|
||||
|
|
@ -447,7 +466,8 @@ class Lettering_Account extends Lettering
|
|||
$sql="
|
||||
select j_id,j_date,to_char(j_date,'DD.MM.YYYY') as j_date_fmt,
|
||||
j_montant,j_debit,jr_comment,jr_internal,jr_id,jr_def_id,jr_pj_number,
|
||||
coalesce(comptaproc.get_letter_jnt(j_id),-1) as letter
|
||||
coalesce(comptaproc.get_letter_jnt(j_id),-1) as letter,
|
||||
comptaproc.letter_compare(coalesce(comptaproc.get_letter_jnt(j_id),-1)) as letter_diff
|
||||
from jrnx join jrn on (j_grpt = jr_grpt_id)
|
||||
where j_poste = $1 and j_date >= to_date($2,'DD.MM.YYYY') and j_date <= to_date ($3,'DD.MM.YYYY')
|
||||
and $this->sql_ledger
|
||||
|
|
@ -463,13 +483,32 @@ class Lettering_Account extends Lettering
|
|||
$sql="
|
||||
select j_id,j_date,to_char(j_date,'DD.MM.YYYY') as j_date_fmt,jr_pj_number,
|
||||
j_montant,j_debit,jr_comment,jr_internal,jr_id,jr_def_id,
|
||||
coalesce(comptaproc.get_letter_jnt(j_id),-1) as letter
|
||||
coalesce(comptaproc.get_letter_jnt(j_id),-1) as letter,
|
||||
comptaproc.letter_compare(coalesce(comptaproc.get_letter_jnt(j_id),-1)) as letter_diff
|
||||
from jrnx join jrn on (j_grpt = jr_grpt_id)
|
||||
where j_poste = $1 and j_date >= to_date($2,'DD.MM.YYYY') and j_date <= to_date ($3,'DD.MM.YYYY')
|
||||
and $this->sql_ledger
|
||||
and j_id in (select j_id from letter_deb join jnt_letter using (jl_id) union select j_id from letter_cred join jnt_letter using (jl_id) )
|
||||
order by j_date,j_id";
|
||||
$this->content=$this->db->get_array($sql,array($this->account,$this->start,$this->end));
|
||||
}
|
||||
/**
|
||||
* same as get_all but only for lettered operation
|
||||
*/
|
||||
public function get_letter_diff()
|
||||
{
|
||||
$sql="
|
||||
select j_id,j_date,to_char(j_date,'DD.MM.YYYY') as j_date_fmt,jr_pj_number,
|
||||
j_montant,j_debit,jr_comment,jr_internal,jr_id,jr_def_id,
|
||||
coalesce(comptaproc.get_letter_jnt(j_id),-1) as letter,
|
||||
comptaproc.letter_compare(coalesce(comptaproc.get_letter_jnt(j_id),-1)) as letter_diff
|
||||
from jrnx join jrn on (j_grpt = jr_grpt_id)
|
||||
where j_poste = $1 and j_date >= to_date($2,'DD.MM.YYYY') and j_date <= to_date ($3,'DD.MM.YYYY')
|
||||
and $this->sql_ledger
|
||||
and j_id in (select j_id from letter_deb join jnt_letter using (jl_id) union select j_id from letter_cred join jnt_letter using (jl_id) )
|
||||
and comptaproc.letter_compare(coalesce(comptaproc.get_letter_jnt(j_id),-1)) <> 0
|
||||
order by j_date,j_id";
|
||||
$this->content=$this->db->get_array($sql,array($this->account,$this->start,$this->end));
|
||||
}
|
||||
/**
|
||||
* same as get_all but only for unlettered operation
|
||||
|
|
@ -480,7 +519,8 @@ class Lettering_Account extends Lettering
|
|||
$sql="
|
||||
select j_id,j_date,to_char(j_date,'DD.MM.YYYY') as j_date_fmt,jr_pj_number,
|
||||
j_montant,j_debit,jr_comment,jr_internal,jr_id,jr_def_id,
|
||||
coalesce(comptaproc.get_letter_jnt(j_id),-1) as letter
|
||||
coalesce(comptaproc.get_letter_jnt(j_id),-1) as letter,
|
||||
comptaproc.letter_compare(coalesce(comptaproc.get_letter_jnt(j_id),-1)) as letter_diff
|
||||
from jrnx join jrn on (j_grpt = jr_grpt_id)
|
||||
where j_poste = $1 and j_date >= to_date($2,'DD.MM.YYYY') and j_date <= to_date ($3,'DD.MM.YYYY')
|
||||
and $this->sql_ledger
|
||||
|
|
@ -545,7 +585,8 @@ class Lettering_Card extends Lettering
|
|||
$sql="
|
||||
select j_id,j_date,to_char(j_date,'DD.MM.YYYY') as j_date_fmt,
|
||||
j_montant,j_debit,jr_comment,jr_internal,jr_id,jr_def_id,
|
||||
coalesce(comptaproc.get_letter_jnt(j_id),-1) as letter
|
||||
coalesce(comptaproc.get_letter_jnt(j_id),-1) as letter,
|
||||
comptaproc.letter_compare(coalesce(comptaproc.get_letter_jnt(j_id),-1)) as letter_diff
|
||||
from jrnx join jrn on (j_grpt = jr_grpt_id)
|
||||
where j_qcode = upper($1) and j_date >= to_date($2,'DD.MM.YYYY') and j_date <= to_date ($3,'DD.MM.YYYY')
|
||||
and $this->sql_ledger
|
||||
|
|
@ -563,7 +604,8 @@ class Lettering_Card extends Lettering
|
|||
$sql="
|
||||
select j_id,j_date,to_char(j_date,'DD.MM.YYYY') as j_date_fmt,jr_pj_number,
|
||||
j_montant,j_debit,jr_comment,jr_internal,jr_id,jr_def_id,
|
||||
coalesce(comptaproc.get_letter_jnt(j_id),-1) as letter
|
||||
coalesce(comptaproc.get_letter_jnt(j_id),-1) as letter,
|
||||
comptaproc.letter_compare(coalesce(comptaproc.get_letter_jnt(j_id),-1)) as letter_diff
|
||||
from jrnx join jrn on (j_grpt = jr_grpt_id)
|
||||
where j_qcode = upper($1) and j_date >= to_date($2,'DD.MM.YYYY') and j_date <= to_date ($3,'DD.MM.YYYY')
|
||||
and $this->sql_ledger
|
||||
|
|
@ -580,13 +622,29 @@ class Lettering_Card extends Lettering
|
|||
$sql="
|
||||
select j_id,j_date,to_char(j_date,'DD.MM.YYYY') as j_date_fmt,jr_pj_number,
|
||||
j_montant,j_debit,jr_comment,jr_internal,jr_id,jr_def_id,
|
||||
coalesce(comptaproc.get_letter_jnt(j_id),-1) as letter
|
||||
coalesce(comptaproc.get_letter_jnt(j_id),-1) as letter,
|
||||
comptaproc.letter_compare(coalesce(comptaproc.get_letter_jnt(j_id),-1)) as letter_diff
|
||||
from jrnx join jrn on (j_grpt = jr_grpt_id)
|
||||
where j_qcode = upper($1) and j_date >= to_date($2,'DD.MM.YYYY') and j_date <= to_date ($3,'DD.MM.YYYY')
|
||||
and $this->sql_ledger
|
||||
and j_id in (select j_id from letter_deb join jnt_letter using (jl_id) union select j_id from letter_cred join jnt_letter using (jl_id) )
|
||||
order by j_date,j_id";
|
||||
$this->content=$this->db->get_array($sql,array($this->quick_code,$this->start,$this->end));
|
||||
}
|
||||
public function get_letter_diff()
|
||||
{
|
||||
$sql="
|
||||
select j_id,j_date,to_char(j_date,'DD.MM.YYYY') as j_date_fmt,jr_pj_number,
|
||||
j_montant,j_debit,jr_comment,jr_internal,jr_id,jr_def_id,
|
||||
coalesce(comptaproc.get_letter_jnt(j_id),-1) as letter,
|
||||
comptaproc.letter_compare(coalesce(comptaproc.get_letter_jnt(j_id),-1)) as letter_diff
|
||||
from jrnx join jrn on (j_grpt = jr_grpt_id)
|
||||
where j_qcode = upper($1) and j_date >= to_date($2,'DD.MM.YYYY') and j_date <= to_date ($3,'DD.MM.YYYY')
|
||||
and $this->sql_ledger
|
||||
and j_id in (select j_id from letter_deb join jnt_letter using (jl_id) union select j_id from letter_cred join jnt_letter using (jl_id) )
|
||||
and comptaproc.letter_compare(coalesce(comptaproc.get_letter_jnt(j_id),-1))<>0
|
||||
order by j_date,j_id";
|
||||
$this->content=$this->db->get_array($sql,array($this->quick_code,$this->start,$this->end));
|
||||
}
|
||||
/**
|
||||
* same as get_all but only for unlettered operation
|
||||
|
|
@ -596,7 +654,8 @@ class Lettering_Card extends Lettering
|
|||
$sql="
|
||||
select j_id,j_date,to_char(j_date,'DD.MM.YYYY') as j_date_fmt,jr_pj_number,
|
||||
j_montant,j_debit,jr_comment,jr_internal,jr_id,jr_def_id,
|
||||
coalesce(comptaproc.get_letter_jnt(j_id),-1) as letter
|
||||
coalesce(comptaproc.get_letter_jnt(j_id),-1) as letter,
|
||||
comptaproc.letter_compare(coalesce(comptaproc.get_letter_jnt(j_id),-1)) as letter_diff
|
||||
from jrnx join jrn on (j_grpt = jr_grpt_id)
|
||||
where j_qcode = upper($1) and j_date >= to_date($2,'DD.MM.YYYY') and j_date <= to_date ($3,'DD.MM.YYYY')
|
||||
and $this->sql_ledger
|
||||
|
|
|
|||
|
|
@ -125,12 +125,16 @@ else
|
|||
{
|
||||
$letter->get_unletter();
|
||||
}
|
||||
if ($_GET['histo'] == 6)
|
||||
{
|
||||
$letter->get_letter_diff();
|
||||
}
|
||||
/* skip if nothing to display */
|
||||
if (count($letter->content) == 0)
|
||||
continue;
|
||||
printf('"%s"'."\n",$row->strAttribut(ATTR_DEF_QUICKCODE), $row->strAttribut(ATTR_DEF_NAME));
|
||||
|
||||
printf('"%s";"%s";"%s";"%s";"%s";"%s";"%s"',
|
||||
printf('"%s";"%s";"%s";"%s";"%s";"%s";"%s";"%s";"%s"',
|
||||
_('Date'),
|
||||
_('ref'),
|
||||
_('Interne'),
|
||||
|
|
@ -138,7 +142,8 @@ else
|
|||
_('Débit'),
|
||||
_('Crébit'),
|
||||
_('Prog.'),
|
||||
_('Let.'));
|
||||
_('Let.'),
|
||||
_("Diff Let."));
|
||||
printf("\n");
|
||||
$amount_deb = 0;
|
||||
$amount_cred = 0;
|
||||
|
|
@ -167,7 +172,10 @@ else
|
|||
}
|
||||
printf ("%s;",nb($prog));
|
||||
if ($row['letter'] != -1)
|
||||
{
|
||||
printf('"%s";',$row['letter']);
|
||||
printf("%s",nb($row['letter_diff']));
|
||||
}
|
||||
else
|
||||
printf(";");
|
||||
printf("\n");
|
||||
|
|
|
|||
|
|
@ -180,6 +180,10 @@ else
|
|||
{
|
||||
$letter->get_unletter();
|
||||
}
|
||||
if ($_GET['histo'] == 6)
|
||||
{
|
||||
$letter->get_letter_diff();
|
||||
}
|
||||
/* skip if nothing to display */
|
||||
if (count($letter->content) == 0)
|
||||
continue;
|
||||
|
|
@ -195,7 +199,7 @@ else
|
|||
$pdf->Cell($tab[2], 7, 'Comm');
|
||||
$pdf->Cell(40, 7, 'Montant', 0, 0, 'C');
|
||||
$pdf->Cell($tab[5], 7, 'Let.', 0, 0, 'R');
|
||||
$pdf->Cell($tab[6], 7, 'Som. Let.', 0, 0, 'R');
|
||||
$pdf->Cell($tab[6], 7, 'Diff. Let.', 0, 0, 'R');
|
||||
$pdf->ln();
|
||||
|
||||
$amount_deb = 0;
|
||||
|
|
@ -236,11 +240,8 @@ else
|
|||
{
|
||||
$pdf->Cell($tab[5], 4, $row['letter'], 0, 0, $align[5], $fill);
|
||||
// get sum for this lettering
|
||||
$sql = "select sum(j_montant) from jrnx where j_debit=$1 and j_id in " .
|
||||
" (select j_id from jnt_letter join letter_deb using (jl_id) where jl_id=$2 union " .
|
||||
" select j_id from jnt_letter join letter_cred using (jl_id) where jl_id=$3)";
|
||||
$sum = $cn->get_value($sql, array($row['j_debit'], $row['letter'], $row['letter']));
|
||||
$pdf->Cell($tab[6], 4, sprintf('%.2f', $sum), '0', '0', 'R', $fill);
|
||||
|
||||
$pdf->Cell($tab[6], 4, sprintf('%.2f', $row['letter_diff']), '0', '0', 'R', $fill);
|
||||
}
|
||||
else
|
||||
$pdf->Cell($tab[5], 4, "", 0, 0, 'R', $fill);
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ require_once('class_lettering.php');
|
|||
|
||||
$gDossier=dossier::id();
|
||||
$cn=new Database($gDossier);
|
||||
global $g_user;
|
||||
global $g_user,$g_failed;;
|
||||
|
||||
/**
|
||||
* Show first the form
|
||||
|
|
@ -60,6 +60,7 @@ $histo=new ISelect('histo');
|
|||
$histo->value=array(
|
||||
array('value'=>0,'label'=>_('Historique')),
|
||||
array('value'=>1,'label'=>_('Historique Lettré')),
|
||||
array('value'=>6,'label'=>_('Historique Lettré et montants différents')),
|
||||
array('value'=>2,'label'=>_('Historique non Lettré')),
|
||||
array('value'=>3,'label'=>_('Résumé')),
|
||||
array('value'=>4,'label'=>_('Balance')),
|
||||
|
|
@ -271,6 +272,10 @@ for ($e = 0; $e < count($afiche); $e++)
|
|||
{
|
||||
$letter->get_unletter();
|
||||
}
|
||||
if ( $_GET['histo'] == 6 )
|
||||
{
|
||||
$letter->get_letter_diff();
|
||||
}
|
||||
/* skip if nothing to display */
|
||||
if (count($letter->content) == 0)
|
||||
continue;
|
||||
|
|
@ -300,9 +305,9 @@ for ($e = 0; $e < count($afiche); $e++)
|
|||
echo '<tr class="odd">';
|
||||
$row = $letter->content[$i];
|
||||
echo td($row['j_date_fmt']);
|
||||
echo td($row['jr_pj_number']);
|
||||
echo td(h($row['jr_pj_number']));
|
||||
echo td(HtmlInput::detail_op($row['jr_id'], $row['jr_internal']));
|
||||
echo td($row['jr_comment']);
|
||||
echo td(h($row['jr_comment']));
|
||||
if ($row['j_debit'] == 't')
|
||||
{
|
||||
echo td(nbm($row['j_montant']), ' style="text-align:right"');
|
||||
|
|
@ -319,7 +324,11 @@ for ($e = 0; $e < count($afiche); $e++)
|
|||
}
|
||||
echo td(nbm($prog), 'style="text-align:right"');
|
||||
if ($row['letter'] != -1)
|
||||
echo td($row['letter']);
|
||||
{
|
||||
$span_error="";
|
||||
if ( $row['letter_diff'] != 0 ) $span_error=$g_failed;
|
||||
echo td($row['letter'].$span_error);
|
||||
}
|
||||
else
|
||||
echo td('');
|
||||
echo '</tr>';
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@ $sel=new ISelect('type_let');
|
|||
$sel->value=array(
|
||||
array('value'=>0,'label'=>_('Toutes opérations')),
|
||||
array('value'=>1,'label'=>_('Opérations lettrées')),
|
||||
array('value'=>3,'label'=>_('Opérations lettrées montants différents')),
|
||||
array('value'=>2,'label'=>_('Opérations NON lettrées'))
|
||||
);
|
||||
if (isset($_GET['type_let'])) $sel->selected=$_GET['type_let'];
|
||||
|
|
@ -113,7 +114,8 @@ if ( $sel->selected == 1 )
|
|||
echo $letter->show_list('letter');
|
||||
if ( $sel->selected == 2 )
|
||||
echo $letter->show_list('unletter');
|
||||
|
||||
if ( $sel->selected == 3 )
|
||||
echo $letter->show_list('letter_diff');
|
||||
echo '</div>';
|
||||
echo '<div id="detail" style="display:none">';
|
||||
echo 'Un instant...';
|
||||
|
|
|
|||
|
|
@ -73,6 +73,7 @@ $sel=new ISelect('type_let');
|
|||
$sel->value=array(
|
||||
array('value'=>0,'label'=>_('Toutes opérations')),
|
||||
array('value'=>1,'label'=>_('Opérations lettrées')),
|
||||
array('value'=>3,'label'=>_('Opérations lettrées montants différents')),
|
||||
array('value'=>2,'label'=>_('Opérations NON lettrées'))
|
||||
);
|
||||
if (isset($_GET['type_let'])) $sel->selected=$_GET['type_let'];
|
||||
|
|
@ -118,7 +119,8 @@ if ( $sel->selected == 1 )
|
|||
echo $letter->show_list('letter');
|
||||
if ( $sel->selected == 2 )
|
||||
echo $letter->show_list('unletter');
|
||||
|
||||
if ( $sel->selected == 3 )
|
||||
echo $letter->show_list('letter_diff');
|
||||
echo '</div>';
|
||||
echo '<div id="detail" style="display:none">';
|
||||
echo 'Un instant...';
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ require_once ('class_acc_operation.php');
|
|||
require_once ('class_acc_reconciliation.php');
|
||||
$amount_deb=0;$amount_cred=0;
|
||||
$gDossier=dossier::id();
|
||||
|
||||
global $g_failed;
|
||||
|
||||
if ( count($this->content) == 0 ) :
|
||||
?>
|
||||
|
|
@ -54,7 +54,9 @@ $js="this.gDossier=".dossier::id().
|
|||
";dsp_letter(this)";
|
||||
|
||||
?>
|
||||
<A class="detail" href="javascript:<?=$js?>"><?=$letter?></A>
|
||||
<A class="detail" href="javascript:<?=$js?>"><?=$letter?>
|
||||
<? if ( $this->content[$i]['letter_diff'] != 0) echo $g_failed; ?>
|
||||
</A>
|
||||
</td>
|
||||
<td> <?= smaller_date($this->content[$i]['j_date_fmt'])?> </td>
|
||||
<td> <?=$this->content[$i]['jr_pj_number']?> </td>
|
||||
|
|
@ -80,7 +82,7 @@ $r=sprintf('<A class="detail" style="text-decoration:underline" HREF="javascript
|
|||
$operation->jr_id=$element;
|
||||
$l_amount=$this->db->get_value("select jr_montant from jrn ".
|
||||
" where jr_id=$element");
|
||||
echo "<A class=\"detail\" HREF=\"javascript:viewOperation('".$element."',".$gDossier.")\" > ".$operation->get_internal()." [ $l_amount € ]</A>";
|
||||
echo "<A class=\"detail\" HREF=\"javascript:viewOperation('".$element."',".$gDossier.")\" > ".$operation->get_internal()." [ ".nb($l_amount)." € ]</A>";
|
||||
}//for
|
||||
}// if ( $a != null ) {
|
||||
// compute amount
|
||||
|
|
@ -97,7 +99,9 @@ $amount_cred+=($this->content[$i]['j_debit']=='f')?$this->content[$i]['j_montant
|
|||
</table>
|
||||
<h2 class="info2" style="margin:0 0"> Solde débit : <?=nb($amount_deb);?>
|
||||
<h2 class="info2" style="margin:0 0"> Solde crédit : <?=nb($amount_cred);?>
|
||||
<? $solde=bcsub($amount_deb,$amount_cred);
|
||||
<?
|
||||
bcscale(2);
|
||||
$solde=bcsub($amount_deb,$amount_cred);
|
||||
if ( $solde > 0 ) :
|
||||
?>
|
||||
<h2 class="info2" style="margin:0 0"> Solde débiteur : <?=nb($solde)?>
|
||||
|
|
|
|||
|
|
@ -1,17 +1,18 @@
|
|||
alter table attr_def add ad_extra text ;
|
||||
CREATE OR REPLACE FUNCTION comptaproc.letter_compare(p_jl bigint)
|
||||
RETURNS numeric AS
|
||||
$BODY$
|
||||
declare
|
||||
nCred numeric(20,4);
|
||||
nDeb numeric(20,4);
|
||||
begin
|
||||
if p_jl = -1 then
|
||||
return 0.0;
|
||||
end if;
|
||||
select coalesce(sum(j_montant),0) into nCred from letter_cred join jrnx using (j_id) where jl_id=p_jl;
|
||||
select coalesce(sum(j_montant),0) into nDeb from letter_deb join jrnx using (j_id) where jl_id=p_jl;
|
||||
|
||||
insert into attr_def (ad_id,ad_text,ad_type,ad_size) values (33,'Date Fin','date',8);
|
||||
|
||||
ALTER TABLE fiche_detail DROP CONSTRAINT "$2";
|
||||
|
||||
ALTER TABLE fiche_detail
|
||||
ADD CONSTRAINT fiche_detail_attr_def_fk FOREIGN KEY (ad_id)
|
||||
REFERENCES attr_def (ad_id) MATCH SIMPLE
|
||||
ON UPDATE cascade ON DELETE cascade;
|
||||
|
||||
ALTER TABLE jnt_fic_attr DROP CONSTRAINT "$2";
|
||||
|
||||
ALTER TABLE jnt_fic_attr
|
||||
ADD CONSTRAINT jnt_fic_attr_attr_def_fk FOREIGN KEY (ad_id)
|
||||
REFERENCES attr_def (ad_id) MATCH SIMPLE
|
||||
ON UPDATE cascade ON DELETE cascade;
|
||||
return nDeb-nCred;
|
||||
end;
|
||||
$BODY$
|
||||
LANGUAGE plpgsql;
|
||||
Loading…
Add table
Add a link
Reference in a new issue