[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpcompta-dev] r4279 - phpcompta/trunk/include
From: |
phpcompta-dev |
Subject: |
[Phpcompta-dev] r4279 - phpcompta/trunk/include |
Date: |
Sun, 30 Oct 2011 20:32:48 +0100 (CET) |
Author: danydb
Date: 2011-10-30 20:32:47 +0100 (Sun, 30 Oct 2011)
New Revision: 4279
Modified:
phpcompta/trunk/include/class_acc_ledger.php
phpcompta/trunk/include/export_histo_csv.php
phpcompta/trunk/include/export_ledger_csv.php
Log:
improve query, to avoid call to get_tiers
Modified: phpcompta/trunk/include/class_acc_ledger.php
===================================================================
--- phpcompta/trunk/include/class_acc_ledger.php 2011-10-30 19:32:17 UTC
(rev 4278)
+++ phpcompta/trunk/include/class_acc_ledger.php 2011-10-30 19:32:47 UTC
(rev 4279)
@@ -737,24 +737,8 @@
//
$href=basename($_SERVER['PHP_SELF']);
- /* switch ($href)
- {
- // user_jrn.php
- case 'compta.php':
- $vue="S"; //Expert View
- break;
- case 'commercial.php':
- $vue="S"; //Simple View
- break;
- case 'recherche.php':
- $vue=(isset($_GET['expert']))?'E':'S';
- break;
- default:
- echo_error('user_form_ach.php',__LINE__,'Erreur invalid
request uri');
- exit (-1);
- }*/
- //DEBUG
+
$r.=sprintf('<A class="detail" style="text-decoration:underline"
HREF="javascript:modifyOperation(\'%s\',\'%s\')" >%s </A>',
$row['jr_id'], $gDossier, $row['jr_internal']);
$r.="</TD>";
@@ -774,7 +758,7 @@
$r.="</TD>";
// Tiers
- $other=$this->get_tiers($row['jrn_def_type'],$row['jr_id']);
+ $other=($row['quick_code']!='')?'['.$row['quick_code'].']
'.$row['name'].' '.$row['first_name']:'';
$r.=td($other);
// comment
$r.="<TD>";
@@ -2277,9 +2261,32 @@
jr_pj_name,
p_closed,
jr_pj_number,
- n_text
+ n_text,
+ case
+ when jrn_def_type='VEN' then
+ (select ad_value from fiche_detail where ad_id=1
+ and f_id=(select max(qs_client) from quant_sold join jrnx
using (j_id) join jrn as e on (e.jr_grpt_id=j_grpt) where e.jr_id=x.jr_id))
+ when jrn_def_type = 'ACH' then
+ (select ad_value from fiche_detail where ad_id=1
+ and f_id=(select max(qp_supplier) from quant_purchase join jrnx
using (j_id) join jrn as e on (e.jr_grpt_id=j_grpt) where e.jr_id=x.jr_id))
+ when jrn_def_type = 'FIN' then
+ (select ad_value from fiche_detail where ad_id=1
+ and f_id=(select qf_other from quant_fin where
quant_fin.jr_id=x.jr_id))
+ end as name,
+ case
+ when jrn_def_type='VEB' then (select ad_value from fiche_detail
where ad_id=32 and f_id=(select max(qs_client) from quant_sold join jrnx using
(j_id) join jrn as e on (e.jr_grpt_id=j_grpt) where e.jr_id=x.jr_id))
+ when jrn_def_type = 'ACH' then (select ad_value from fiche_detail
where ad_id=32 and f_id=(select max(qp_supplier) from quant_purchase join jrnx
using (j_id) join jrn as e on (e.jr_grpt_id=j_grpt) where e.jr_id=x.jr_id))
+ when jrn_def_type = 'FIN' then (select ad_value from fiche_detail
where ad_id=32 and f_id=(select qf_other from quant_fin where
quant_fin.jr_id=x.jr_id))
+ end as first_name,
+ case
+ when jrn_def_type='VEN' then (select ad_value from fiche_detail
where ad_id=23 and f_id=(select max(qs_client) from quant_sold join jrnx using
(j_id) join jrn as e on (e.jr_grpt_id=j_grpt) where e.jr_id=x.jr_id))
+ when jrn_def_type = 'ACH' then (select ad_value from fiche_detail
where ad_id=23 and f_id=(select max(qp_supplier) from quant_purchase join jrnx
using (j_id) join jrn as e on (e.jr_grpt_id=j_grpt) where e.jr_id=x.jr_id))
+ when jrn_def_type = 'FIN' then (select ad_value from fiche_detail
where ad_id=23 and f_id=(select qf_other from quant_fin where
quant_fin.jr_id=x.jr_id))
+ end as quick_code
+
+
from
- jrn left join jrn_note using(jr_id)
+ jrn as X left join jrn_note using(jr_id)
join jrn_def on jrn_def_id=jr_def_id
join parm_periode on p_id=jr_tech_per";
Modified: phpcompta/trunk/include/export_histo_csv.php
===================================================================
--- phpcompta/trunk/include/export_histo_csv.php 2011-10-30 19:32:17 UTC
(rev 4278)
+++ phpcompta/trunk/include/export_histo_csv.php 2011-10-30 19:32:47 UTC
(rev 4279)
@@ -53,12 +53,13 @@
printf('"%s";',$res[$i]['jr_date']);
printf('"%s";',$res[$i]['jr_ech']);
printf('"%s";',$res[$i]['jr_pj_number']);
-
printf('"%s";',$ledger->get_tiers($res[$i]['jrn_def_type'],$res[$i]['jr_id']));
+ printf('"%s";',$res[$i]['quick_code']);
+ printf('"%s %s";',$res[$i]['name'],$res[$i]['first_name']);
printf('"%s";',$res[$i]['jr_comment']);
printf('"%s";',$res[$i]['n_text']);
$amount=$res[$i]['jr_montant'];
-
+
if ( $res[$i]['jrn_def_type'] == 'FIN')
{
$positive = $cn->get_value("select qf_amount from quant_fin where
jr_id=$1",array($res[$i]['jr_id']));
Modified: phpcompta/trunk/include/export_ledger_csv.php
===================================================================
--- phpcompta/trunk/include/export_ledger_csv.php 2011-10-30 19:32:17 UTC
(rev 4278)
+++ phpcompta/trunk/include/export_ledger_csv.php 2011-10-30 19:32:47 UTC
(rev 4279)
@@ -106,7 +106,7 @@
"\r\n");
foreach ($Row as $line)
{
-
+
echo $line['num'].";";
echo $line['date'].";";
echo $line['jr_pj_number'].";";
@@ -120,18 +120,18 @@
if ( $line['jrn_def_type'] == 'FIN' ) {
$positive = $cn->get_value("select qf_amount from quant_fin ".
" where jr_id=".$line['jr_id']);
-
+
echo nb($positive);
echo ";";
}
- else
+ else
{
echo nb($line['montant']).";";
}
-
+
printf("\r\n");
}
- }
+ }
//-----------------------------------------------------
if ( $jrn_type=='ACH' || $jrn_type=='VEN')
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpcompta-dev] r4279 - phpcompta/trunk/include,
phpcompta-dev <=