[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpcompta-dev] r4922 - in phpcompta/trunk/include: . template
From: |
phpcompta-dev |
Subject: |
[Phpcompta-dev] r4922 - in phpcompta/trunk/include: . template |
Date: |
Mon, 18 Jun 2012 12:07:54 +0200 (CEST) |
Author: danydb
Date: 2012-06-18 12:07:54 +0200 (Mon, 18 Jun 2012)
New Revision: 4922
Added:
phpcompta/trunk/include/template/stock_summary_list.php
Modified:
phpcompta/trunk/include/class_stock.php
phpcompta/trunk/include/stock_state.inc.php
phpcompta/trunk/include/template/stock_summary_table.php
Log:
0000618: Affichage des stocks
Modified: phpcompta/trunk/include/class_stock.php
===================================================================
--- phpcompta/trunk/include/class_stock.php 2012-06-18 09:22:47 UTC (rev
4921)
+++ phpcompta/trunk/include/class_stock.php 2012-06-18 10:07:54 UTC (rev
4922)
@@ -423,15 +423,15 @@
with fiche_stock as (select distinct ad_value from fiche_detail
where ad_id=19 and coalesce(ad_value,'') != '') ,
stock_in as (select
coalesce(sum(sg_quantity),0) as qin,r_id,sg_code from stock_goods where
sg_type='c'
and (
- (j_id is not null and j_id in (select
j_id from jrnx where j_date <= '2010-12-31')
- or sg_tech_date <= '2010-12-31')
+ (j_id is not null and j_id in (select
j_id from jrnx where j_date <= to_date($2,'DD.MM.YYYY'))
+ or sg_tech_date <=
to_date($2,'DD.MM.YYYY'))
)
group by r_id,sg_code) ,
stock_out as (select
coalesce(sum(sg_quantity),0) as qout ,r_id,sg_code from stock_goods
where sg_type='d'
and (
- (j_id is not null and j_id in (select
j_id from jrnx where j_date <= '2010-12-31')
- or sg_tech_date <= '2010-12-31')
+ (j_id is not null and j_id in (select
j_id from jrnx where j_date <= to_date($2,'DD.MM.YYYY'))
+ or sg_tech_date <=
to_date($2,'DD.MM.YYYY'))
)
group by r_id,sg_code)
select distinct
@@ -449,9 +449,34 @@
and sg.r_id in (select r_id from
user_sec_repository where p_id=$1)
";
- $cn->exec_sql($sql_repo_detail,array($g_user->get_profile()));
+
+ // Build condition
+ $end_date=$cn->get_value("select
to_char(max(p_end),'DD.MM.YYYY') from parm_periode");
+ if (isset($p_array['state_exercice']))
+ {
+ if (
isDate($p_array['state_exercice'])==$p_array['state_exercice'])
+ {
+ $end_date=$p_array['state_exercice'];
+ }
+ }
+
$cn->exec_sql($sql_repo_detail,array($g_user->get_profile(),$end_date));
$a_code=$cn->get_array("select distinct sg_code from
tmp_stockgood_detail where s_id=$1",array($tmp_id));
- require_once 'template/stock_summary.php' ;
+ if (isset($p_array['present']))
+ {
+ $present=$p_array['present'];
+ }
+ else
+ {
+ $present='T';
+ }
+ if ($present == 'T')
+ {
+ require_once 'template/stock_summary_table.php' ;
+ }
+ if ($present=='L')
+ {
+ require_once 'template/stock_summary_list.php';
+ }
}
}
Modified: phpcompta/trunk/include/stock_state.inc.php
===================================================================
--- phpcompta/trunk/include/stock_state.inc.php 2012-06-18 09:22:47 UTC (rev
4921)
+++ phpcompta/trunk/include/stock_state.inc.php 2012-06-18 10:07:54 UTC (rev
4922)
@@ -29,8 +29,24 @@
global $cn,$g_parameter,$g_user;
require_once 'class_stock.php';
+// Show the form
+// Get by exercice
+// Get type = table or list
+$iexercice=new ISelect('state_exercice');
+$iexercice->value=$cn->make_array("select max(p_end) as date_end, p_exercice
from parm_periode group by p_exercice order by 2 desc");
+$iexercice->selected=(isset($_GET['state_exercice']))?$_GET['state_exercice']:"";
+
+$presentation=new ISelect("present");
+$presentation->value=array (
+ array("value"=>"T","label"=>"Tableau récapitulatif"),
+ array("value"=>"L","label"=>"Liste")
+);
+$presentation->selected=(isset($_GET['present']))?$_GET['present']:"T";
+require_once 'template/stock_state_search.php';
+
$stock=new Stock();
+
$stock->summary($_GET);
?>
Added: phpcompta/trunk/include/template/stock_summary_list.php
===================================================================
--- phpcompta/trunk/include/template/stock_summary_list.php
(rev 0)
+++ phpcompta/trunk/include/template/stock_summary_list.php 2012-06-18
10:07:54 UTC (rev 4922)
@@ -0,0 +1,99 @@
+<?php
+
+/*
+ * This file is part of PhpCompta.
+ *
+ * PhpCompta is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * PhpCompta is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with PhpCompta; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+/* $Revision$ */
+
+// Copyright Author Dany De Bontridder address@hidden
+
+/**
+ * @file
+ * @brief show the result to stock state in list format (more detailled)
+ *
+ */
+$a_repo=$cn->get_array("select distinct t.r_id,r_name,r_adress,r_country from
stock_repository as s join tmp_stockgood_detail as t
+ on (s.r_id=t.r_id)
+ where
+ s_id=$1
+ order by 2
+ ",array($tmp_id));
+?>
+<? for ($r=0;$r<count($a_repo);$r++):?>
+<h1><?=$a_repo[$r]['r_name']?></h1>
+<p><?=$a_repo[$r]['r_adress']?></p>
+<p><?=$a_repo[$r]['r_country']?></p>
+<table class="result">
+ <tr>
+ <th>Code</th>
+ <th>Détail</th>
+ <th style="text-align: right">IN</th>
+ <th style="text-align: right">OUT</th>
+ <th style="text-align: right">En Stock</th>
+ </tr>
+ <?
+ $a_stock=$cn->get_array(
+ "
+ select coalesce(sum(s_qin),0) as
qin,coalesce(sum(s_qout),0) as qout,sg_code
+ from tmp_stockgood_detail
where r_id=$1 and s_id=$2
+ group by sg_code
+ order by sg_code
+
+ ",array($a_repo[$r]['r_id'],$tmp_id));
+ for ($s=0;$s<count($a_stock);$s++):
+ $a_card=$cn->get_array(
+ "
+ select f_id,vw_name,quick_code
+ from vw_fiche_attr
+ where
+ f_id in (
+ select distinct f_id from
fiche_detail
+ where
+ ad_id=19 and
+ ad_value=$1)
+ order by vw_name,quick_code
+ ",array($a_stock[$s]['sg_code']));
+ ?>
+ <tr>
+ <td>
+ <?=HtmlInput::card_detail($a_stock[$s]['sg_code'])?>
+ </td>
+ <td>
+ <?
+ $sep="";
+ for ( $c=0;$c<count($a_card);$c++):
+ echo
$sep.HtmlInput::card_detail($a_card[$c]['quick_code'], $a_card[$c]['vw_name'],
' class="line" ');
+ $sep=" ,";
+ endfor;
+ if ( count($a_card)== 0 ) echo '<span
class="notice"> Erreur Code non utilisé </span>';
+ ?>
+ </td>
+ <td class="num">
+ <?=nbm($a_stock[$s]['qin'])?>
+ </td>
+ <td class="num">
+ <?=nbm($a_stock[$s]['qout'])?>
+
+ </td>
+ <td class="num">
+
<?=nbm(bcsub($a_stock[$s]['qin'],$a_stock[$s]['qout']))?>
+ </td>
+ </tr>
+<? endfor; ?>
+</table>
+<? endfor; ?>
+
Modified: phpcompta/trunk/include/template/stock_summary_table.php
===================================================================
--- phpcompta/trunk/include/template/stock_summary_table.php 2012-06-18
09:22:47 UTC (rev 4921)
+++ phpcompta/trunk/include/template/stock_summary_table.php 2012-06-18
10:07:54 UTC (rev 4922)
@@ -54,7 +54,8 @@
$n_in=0;$n_out=0;
for ($e = 0; $e < count($a_repository); $e++):
- $array = $cn->get_array("select * from
tmp_stockgood_detail where r_id=$1 and sg_code=$2",
array($a_repository[$e]['r_id'], $a_code[$x]['sg_code']));
+ $array = $cn->get_array("select * from
tmp_stockgood_detail where r_id=$1 and sg_code=$2 and s_id=$3"
+ ,
array($a_repository[$e]['r_id'], $a_code[$x]['sg_code'],$tmp_id));
?>
<td>
<?
---
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] r4922 - in phpcompta/trunk/include: . template,
phpcompta-dev <=