[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpcompta-dev] r4089 - in phpcompta/trunk/include: . template
From: |
phpcompta-dev |
Subject: |
[Phpcompta-dev] r4089 - in phpcompta/trunk/include: . template |
Date: |
Sat, 14 May 2011 02:35:51 +0200 (CEST) |
Author: danydb
Date: 2011-05-14 02:35:50 +0200 (Sat, 14 May 2011)
New Revision: 4089
Modified:
phpcompta/trunk/include/class_anc_balance_double.php
phpcompta/trunk/include/class_anc_balance_simple.php
phpcompta/trunk/include/class_anc_listing.php
phpcompta/trunk/include/class_anc_operation.php
phpcompta/trunk/include/class_anc_plan.php
phpcompta/trunk/include/template/ledger_detail_ach.php
phpcompta/trunk/include/template/ledger_detail_misc.php
phpcompta/trunk/include/template/ledger_detail_ven.php
Log:
Fix bugs in Analytic accountancy
Modified: phpcompta/trunk/include/class_anc_balance_double.php
===================================================================
--- phpcompta/trunk/include/class_anc_balance_double.php 2011-05-13
21:52:54 UTC (rev 4088)
+++ phpcompta/trunk/include/class_anc_balance_double.php 2011-05-14
00:35:50 UTC (rev 4089)
@@ -423,9 +423,11 @@
case when a.oa_debit='f' then a.oa_amount else 0 end as
a_oa_amount_c
from
operation_analytique as a join operation_analytique as b on
(a.j_id=b.j_id and a.oa_row=b.oa_row)
- where a.pa_id=".
+ join poste_analytique as poa on (a.po_id=poa.po_id)
+ join poste_analytique as pob on (b.po_id=pob.po_id)
+ where poa.pa_id=".
$this->pa_id."
- and b.pa_id=".$this->pa_id2." ".$this->set_sql_filter()."
+ and pob.pa_id=".$this->pa_id2." ".$this->set_sql_filter()."
) as m join poste_analytique as pa on ( a_po_id=pa.po_id)
join poste_analytique as pb on (b_po_id=pb.po_id)
Modified: phpcompta/trunk/include/class_anc_balance_simple.php
===================================================================
--- phpcompta/trunk/include/class_anc_balance_simple.php 2011-05-13
21:52:54 UTC (rev 4088)
+++ phpcompta/trunk/include/class_anc_balance_simple.php 2011-05-14
00:35:50 UTC (rev 4089)
@@ -48,7 +48,7 @@
// sum debit
$sql="select m.po_id,sum(deb) as sum_deb,sum(cred) as sum_cred,";
- $sql.=" po_name||' '||po_description as po_name";
+ $sql.=" po_name||' '||coalesce(po_description,'') as po_name";
$sql.=" from ";
$sql.=" (select po_id,case when oa_debit='t' then oa_amount else 0 end
as deb,";
$sql.="case when oa_debit='f' then oa_amount else 0 end as cred ";
@@ -145,9 +145,9 @@
// the name and po_id
// $r.=sprintf("<td>%s</td>",$row['po_id']);
$r.=sprintf("<td align=\"left\">%s</td>",h($row['po_name']));
- $r.=td(nbm($row['sum_deb']));
- $r.=td(nbm($row['sum_cred']));
- $r.=td(nbm($row['solde']));
+ $r.=td(nbm($row['sum_deb']),' class="num"');
+ $r.=td(nbm($row['sum_cred']),' class="num"');
+ $r.=td(nbm($row['solde']),' class="num"');
$deb=($row['sum_deb'] > $row['sum_cred'])?"D":"C";
$deb=($row['solde'] == 0 )?'':$deb;
$r.=sprintf("<td>%s</td>",$deb);
Modified: phpcompta/trunk/include/class_anc_listing.php
===================================================================
--- phpcompta/trunk/include/class_anc_listing.php 2011-05-13 21:52:54 UTC
(rev 4088)
+++ phpcompta/trunk/include/class_anc_listing.php 2011-05-14 00:35:50 UTC
(rev 4089)
@@ -95,7 +95,7 @@
'<td>'.h($row['po_name']).'</td>'.
'<td>'.h($row['oa_description']).'</td>'.
'<td>'.$detail.'</td>'.
- '<td>'.nbm($row['oa_amount']).'</td>'.
+ '<td class="num">'.nbm($row['oa_amount']).'</td>'.
'<td>'.(($row['oa_debit']=='f')?'CREDIT':'DEBIT').'</td>';
$r.= '</tr>';
}
Modified: phpcompta/trunk/include/class_anc_operation.php
===================================================================
--- phpcompta/trunk/include/class_anc_operation.php 2011-05-13 21:52:54 UTC
(rev 4088)
+++ phpcompta/trunk/include/class_anc_operation.php 2011-05-14 00:35:50 UTC
(rev 4089)
@@ -85,7 +85,6 @@
$oa_row=(isset($this->oa_row))?$this->oa_row:"NULL";
$sql='insert into operation_analytique (
po_id,
- pa_id,
oa_amount,
oa_description,
oa_debit,
@@ -95,7 +94,6 @@
oa_row
) values ('.
$this->po_id.",".
- $this->pa_id.",".
$this->oa_amount.",".
"' ".Database::escape_string($this->oa_description)."',".
"'".$this->oa_debit."',".
@@ -135,17 +133,18 @@
$cond_poste.=" and upper(po_name) <= upper('".$p_to_poste."')";
$pa_id_cond="";
if ( isset ( $this->pa_id) && $this->pa_id !='')
- $pa_id_cond= "B.pa_id=".$this->pa_id." and";
+ $pa_id_cond= "pa_id=".$this->pa_id." and";
$sql="select oa_id,po_name,oa_description,po_description,".
- "oa_debit,to_char(oa_date,'DD.MM.YYYY') as
oa_date,oa_amount,oa_group,j_id ".
+ "oa_debit,to_char(oa_date,'DD.MM.YYYY') as
oa_date,oa_amount,oa_group,j_id ,".
+ " ( select jr_internal from jrn join jrnx on (j_grpt=jr_grpt_id)
where jrnx.j_id=B.j_id) as jr_internal ,".
+ " ( select jr_id from jrn join jrnx on (j_grpt=jr_grpt_id) where
jrnx.j_id=B.j_id) as jr_id ".
" from operation_analytique as B".
" join poste_analytique using(po_id) ".
"where $pa_id_cond oa_amount <> 0.0 $cond $cond_poste".
" order by oa_date ,oa_group,oa_debit desc,oa_id";
$RetSql=$this->db->exec_sql($sql);
-
$array=Database::fetch_all($RetSql);
return $array;
}
@@ -291,7 +290,7 @@
oa_date,
pa_id,
oa_row
- from operation_analytique
+ from operation_analytique join poste_analytique using (po_id)
where
j_id=$p_jid order by j_id,oa_row,pa_id";
$ret=$this->db->exec_sql($sql);
@@ -361,7 +360,7 @@
// for the operation connected to jrnx
$cond=sql_filter_per($this->db,$p_from,$p_to,'p_id','j_date');
$sql="select oa_id, po_id, oa_amount, oa_debit, j_date from jrnx join
operation_analytique using (j_id)
- join poste_analytique using (pa_id)
+ join poste_analytique using (po_id)
where
$cond and j_id is not null and pa_id=$p_plan_id";
@@ -369,7 +368,7 @@
$cond=sql_filter_per($this->db,$p_from,$p_to,'p_id','oa_date');
$sql="union select oa_id, po_id, oa_amount, oa_debit,oa_date from
operation_analytique
- join poste_analytique using (pa_id)
+ join poste_analytique using (po_id)
where j_id is null and
$cond and pa_id=$p_plan_id ";
try
@@ -425,7 +424,7 @@
extract ($p_array);
$result="";
$plan=new Anc_Plan($this->db);
- $a_plan=$plan->get_list();
+ $a_plan=$plan->get_list(" order by pa_id ");
if ( empty ($a_plan) ) return "";
$table_id="t".$p_seq;
$hidden=new IHidden();
@@ -461,8 +460,9 @@
{
// editable
$select->readonly=false;
- if ( isset($hplan) && isset($hplan[$p_seq][$count]) )
+ if ( isset($hplan) && isset($hplan[$p_seq][$count]) ){
$select->selected=$hplan[$p_seq][$count];
+ }
}
else
{
@@ -496,6 +496,7 @@
$button->label="Nouvelle ligne";
if ( $p_mode == 1 )
$result.=$button->input();
+
return $result;
}
/*!\brief it called for each item, the data are taken from $p_array
@@ -546,7 +547,6 @@
{
$op=new Anc_Operation($this->db);
$op->po_id=$hplan[$p_item][$e];
- $op->pa_id=$pa_id[$idx_pa_id];
$op->oa_group=$this->oa_group;
$op->j_id=$j_id;
$op->oa_amount=$val[$p_item][$row];
Modified: phpcompta/trunk/include/class_anc_plan.php
===================================================================
--- phpcompta/trunk/include/class_anc_plan.php 2011-05-13 21:52:54 UTC (rev
4088)
+++ phpcompta/trunk/include/class_anc_plan.php 2011-05-14 00:35:50 UTC (rev
4089)
@@ -53,11 +53,11 @@
* \return an array of PA (not object)
*
*/
- function get_list()
+ function get_list($p_order=" order by pa_name")
{
$array=array();
$sql="select pa_id as id,pa_name as name,".
- "pa_description as description from plan_analytique order by
pa_name";
+ "pa_description as description from plan_analytique $p_order";
$ret=$this->db->exec_sql($sql);
$array=Database::fetch_all($ret);
return $array;
@@ -163,7 +163,7 @@
function header()
{
$res="";
- $a_plan=$this->get_list();
+ $a_plan=$this->get_list(" order by pa_id");
if ( empty($a_plan)) return "";
foreach ($a_plan as $r_plan)
{
Modified: phpcompta/trunk/include/template/ledger_detail_ach.php
===================================================================
--- phpcompta/trunk/include/template/ledger_detail_ach.php 2011-05-13
21:52:54 UTC (rev 4088)
+++ phpcompta/trunk/include/template/ledger_detail_ach.php 2011-05-14
00:35:50 UTC (rev 4089)
@@ -111,7 +111,7 @@
if ($owner->MY_ANALYTIC != 'nu' && $div=='popup'){
$anc=new Anc_Plan($cn);
- $a_anc=$anc->get_list();
+ $a_anc=$anc->get_list(' order by pa_id ');
$x=count($a_anc);
/* set the width of the col */
echo '<th colspan="'.$x.'">'._('Compt. Analytique').'</th>';
Modified: phpcompta/trunk/include/template/ledger_detail_misc.php
===================================================================
--- phpcompta/trunk/include/template/ledger_detail_misc.php 2011-05-13
21:52:54 UTC (rev 4088)
+++ phpcompta/trunk/include/template/ledger_detail_misc.php 2011-05-14
00:35:50 UTC (rev 4089)
@@ -90,7 +90,7 @@
echo th(_('Crédit'), 'style="text-align:right"');
if ($owner->MY_ANALYTIC != 'nu' && $div == 'popup'){
$anc=new Anc_Plan($cn);
- $a_anc=$anc->get_list();
+ $a_anc=$anc->get_list(' order by pa_id ');
$x=count($a_anc);
/* set the width of the col */
echo '<th colspan="'.$x.'">'._('Compt. Analytique').'</th>';
Modified: phpcompta/trunk/include/template/ledger_detail_ven.php
===================================================================
--- phpcompta/trunk/include/template/ledger_detail_ven.php 2011-05-13
21:52:54 UTC (rev 4088)
+++ phpcompta/trunk/include/template/ledger_detail_ven.php 2011-05-14
00:35:50 UTC (rev 4089)
@@ -109,7 +109,7 @@
if ($owner->MY_ANALYTIC != 'nu' && $div == 'popup'){
$anc=new Anc_Plan($cn);
- $a_anc=$anc->get_list();
+ $a_anc=$anc->get_list(" order by pa_id ");
$x=count($a_anc);
/* set the width of the col */
echo '<th colspan="'.$x.'">'._('Compt. Analytique').'</th>';
@@ -117,6 +117,7 @@
/* add hidden variables pa[] to hold the value of pa_id */
echo Anc_Plan::hidden($a_anc);
}
+
echo '</tr>';
for ($e=0;$e<count($obj->det->array);$e++) {
$row='';
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpcompta-dev] r4089 - in phpcompta/trunk/include: . template,
phpcompta-dev <=