[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpcompta-dev] r4739 - in phpcompta/tags/rel600: include include/templa
From: |
phpcompta-dev |
Subject: |
[Phpcompta-dev] r4739 - in phpcompta/tags/rel600: include include/template sql |
Date: |
Sat, 4 Feb 2012 02:09:50 +0100 (CET) |
Author: danydb
Date: 2012-02-04 02:09:47 +0100 (Sat, 04 Feb 2012)
New Revision: 4739
Modified:
phpcompta/tags/rel600/include/class_lettering.php
phpcompta/tags/rel600/include/export_fiche_balance_csv.php
phpcompta/tags/rel600/include/export_fiche_balance_pdf.php
phpcompta/tags/rel600/include/impress_fiche.inc.php
phpcompta/tags/rel600/include/lettering.account.inc.php
phpcompta/tags/rel600/include/lettering.card.inc.php
phpcompta/tags/rel600/include/template/letter_all.php
phpcompta/tags/rel600/sql/upgrade.sql
Log:
Mantis 519 Montre les montants diff?\195?\169rents pour les lettrages
Modified: phpcompta/tags/rel600/include/class_lettering.php
===================================================================
--- phpcompta/tags/rel600/include/class_lettering.php 2012-02-03 10:03:10 UTC
(rev 4738)
+++ phpcompta/tags/rel600/include/class_lettering.php 2012-02-04 01:09:47 UTC
(rev 4739)
@@ -292,10 +292,26 @@
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 @@
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 @@
$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,7 +483,8 @@
$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
@@ -471,6 +492,24 @@
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 @@
$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 @@
$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 @@
$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,7 +622,8 @@
$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
@@ -588,6 +631,21 @@
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 @@
$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
Modified: phpcompta/tags/rel600/include/export_fiche_balance_csv.php
===================================================================
--- phpcompta/tags/rel600/include/export_fiche_balance_csv.php 2012-02-03
10:03:10 UTC (rev 4738)
+++ phpcompta/tags/rel600/include/export_fiche_balance_csv.php 2012-02-04
01:09:47 UTC (rev 4739)
@@ -125,12 +125,16 @@
{
$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 @@
_('Débit'),
_('Crébit'),
_('Prog.'),
- _('Let.'));
+ _('Let.'),
+ _("Diff Let."));
printf("\n");
$amount_deb = 0;
$amount_cred = 0;
@@ -167,7 +172,10 @@
}
printf ("%s;",nb($prog));
if ($row['letter'] != -1)
+ {
printf('"%s";',$row['letter']);
+ printf("%s",nb($row['letter_diff']));
+ }
else
printf(";");
printf("\n");
Modified: phpcompta/tags/rel600/include/export_fiche_balance_pdf.php
===================================================================
--- phpcompta/tags/rel600/include/export_fiche_balance_pdf.php 2012-02-03
10:03:10 UTC (rev 4738)
+++ phpcompta/tags/rel600/include/export_fiche_balance_pdf.php 2012-02-04
01:09:47 UTC (rev 4739)
@@ -180,6 +180,10 @@
{
$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 @@
$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 @@
{
$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);
Modified: phpcompta/tags/rel600/include/impress_fiche.inc.php
===================================================================
--- phpcompta/tags/rel600/include/impress_fiche.inc.php 2012-02-03 10:03:10 UTC
(rev 4738)
+++ phpcompta/tags/rel600/include/impress_fiche.inc.php 2012-02-04 01:09:47 UTC
(rev 4739)
@@ -27,7 +27,7 @@
$gDossier=dossier::id();
$cn=new Database($gDossier);
-global $g_user;
+global $g_user,$g_failed;;
/**
* Show first the form
@@ -60,6 +60,7 @@
$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 @@
{
$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 @@
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 @@
}
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>';
Modified: phpcompta/tags/rel600/include/lettering.account.inc.php
===================================================================
--- phpcompta/tags/rel600/include/lettering.account.inc.php 2012-02-03
10:03:10 UTC (rev 4738)
+++ phpcompta/tags/rel600/include/lettering.account.inc.php 2012-02-04
01:09:47 UTC (rev 4739)
@@ -70,6 +70,7 @@
$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 @@
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...';
Modified: phpcompta/tags/rel600/include/lettering.card.inc.php
===================================================================
--- phpcompta/tags/rel600/include/lettering.card.inc.php 2012-02-03
10:03:10 UTC (rev 4738)
+++ phpcompta/tags/rel600/include/lettering.card.inc.php 2012-02-04
01:09:47 UTC (rev 4739)
@@ -73,6 +73,7 @@
$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 @@
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...';
Modified: phpcompta/tags/rel600/include/template/letter_all.php
===================================================================
--- phpcompta/tags/rel600/include/template/letter_all.php 2012-02-03
10:03:10 UTC (rev 4738)
+++ phpcompta/tags/rel600/include/template/letter_all.php 2012-02-04
01:09:47 UTC (rev 4739)
@@ -3,8 +3,8 @@
require_once ('class_acc_reconciliation.php');
$amount_deb=0;$amount_cred=0;
$gDossier=dossier::id();
+global $g_failed;
-
if ( count($this->content) == 0 ) :
?>
<h2 class="info2"><?=_('Désolé aucun résultat trouvé')?></h2>
@@ -54,7 +54,9 @@
";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 @@
$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 @@
</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)?>
Modified: phpcompta/tags/rel600/sql/upgrade.sql
===================================================================
--- phpcompta/tags/rel600/sql/upgrade.sql 2012-02-03 10:03:10 UTC (rev
4738)
+++ phpcompta/tags/rel600/sql/upgrade.sql 2012-02-04 01:09:47 UTC (rev
4739)
@@ -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;
\ No newline at end of file
---
PhpCompta est un logiciel de comptabilité libre en ligne (full web)
Projet opensource http://www.phpcompta.eu
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpcompta-dev] r4739 - in phpcompta/tags/rel600: include include/template sql,
phpcompta-dev <=