0000618: Affichage des stocks

This commit is contained in:
Dany De Bontridder 2012-06-16 00:00:01 +00:00
parent dcd1095130
commit 43c484eaa9
7 changed files with 240 additions and 10 deletions

View file

@ -25,7 +25,7 @@
include_once ("ac_common.php");
require_once('class_database.php');
require_once('class_itext.php');
html_page_start($_SESSION['g_theme']);
@html_page_start($_SESSION['g_theme']);
$rep=new Database();
include_once ("class_user.php");
$User=new User($rep);

View file

@ -643,6 +643,16 @@ class HtmlInput
from stock_repository join user_sec_repository using (r_id)
where
ur_right='W' and p_id=".sql_string($profile).
" order by 2" );
return $sel;
}
if ($p_mode == 'R')
{
$sel->value=$p_cn->make_array("
select r_id,r_name
from stock_repository join user_sec_repository using (r_id)
where
p_id=".sql_string($profile).
" order by 2" );
return $sel;
}

View file

@ -440,18 +440,20 @@ class Periode
*the this->p_id must be set
*\return a string with the date (DD.MM.YYYY)
*/
public function first_day()
public function first_day($p=0)
{
list($p_start,$p_end)=$this->get_date_limit($this->p_id);
if ($p==0) $p=$this->p_id;
list($p_start,$p_end)=$this->get_date_limit($p);
return $p_start;
}
/*!\brief return the last day of periode
*the this->p_id must be set
*\return a string with the date (DD.MM.YYYY)
*/
public function last_day()
public function last_day($p=0)
{
list($p_start,$p_end)=$this->get_date_limit($this->p_id);
if ($p==0) $p=$this->p_id;
list($p_start,$p_end)=$this->get_date_limit($p);
return $p_end;
}
@ -500,12 +502,12 @@ class Periode
throw new Exception('Erreur insertion période');
}
}
if ( $nb_periode==12 && $this->insert('01.12.'.$p_exercice,'31.12.'.$p_exercice,$p_exercice) != 0 )
{
if ( $nb_periode==12 && $this->insert('01.12.'.$p_exercice,'31.12.'.$p_exercice,$p_exercice) != 0 )
{
throw new Exception('Erreur insertion période');
}
if ( $nb_periode==13)
{
if ( $nb_periode==13)
{
if ($this->insert('01.12.'.$p_exercice,'30.12.'.$p_exercice,$p_exercice) != 0 ) throw new Exception('Erreur insertion période');
if ($this->insert('31.12.'.$p_exercice,'31.12.'.$p_exercice,$p_exercice) != 0 ) throw new Exception('Erreur insertion période');
}

View file

@ -0,0 +1,48 @@
<?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 ddebontridder@yahoo.fr
/**
* @file
* @brief
*
*/
global $g_user,$cn,$g_parameter;
require_once 'class_stock.php';
require_once 'class_periode.php';
$stock=new Stock();
$array=$_GET;
if ( ! isset ($array['wdate_start']) || ! isset ($array['wdate_end']))
{
// Date start / end
$exercice = $g_user->get_exercice();
$periode = new Periode($cn);
list($periode_start, $periode_end) = $periode->get_limit($exercice);
$array['wdate_start'] = $periode_start->first_day();
$array['wdate_end'] =$periode_end->last_day();
}
$stock->history($array);
?>

View file

@ -0,0 +1,83 @@
<?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 ddebontridder@yahoo.fr
/**
* @file
* @brief show the result of stock history
*
*/
?>
<div class="content">
<?=$nav_bar?>
<table class="result">
<tr>
<th><?=$tb->get_header(0);?></th>
<th><?=$tb->get_header(1);?></th>
<th><?=$tb->get_header(2);?></th>
<th><?=$tb->get_header(3);?></th>
<th>Opération</th>
<th><?=$tb->get_header(4);?></th>
<th><?=$tb->get_header(5);?></th>
<th><?=$tb->get_header(6);?></th>
<th><?=$tb->get_header(7);?></th>
</tr>
<?
for ($i=0;$i<$max_row;$i++):
$row=Database::fetch_array($res, $i);
$class=($i%2==0)?' class="even" ':' class="odd" ';
?>
<tr <?=$class?>>
<td>
<?=$row['cdate']?>
</td>
<td>
<?=$row['sg_code']?>
</td>
<td>
<?=$row['r_name']?>
</td>
<td>
<?=HtmlInput::card_detail($row['qcode'],$row['fname'])?>
</td>
<td>
<?=HtmlInput::detail_op($row['jr_id'],$row['jr_internal'])?>
</td>
<td>
<?=$row['ccomment']?>
</td>
<td class="num">
<?=nbm($row['j_montant'])?>
</td>
<td class="num">
<?=nbm($row['sg_quantity'])?>
</td>
<td>
<?=$row['direction']?>
</td>
</tr>
<? endfor;?>
</table>
<?=$nav_bar?>
</div>

View file

@ -0,0 +1,70 @@
<?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 ddebontridder@yahoo.fr
/**
* @file
* @brief show box for search
*
*/
?>
<div id="histo_search_d" class="inner_box" style="width:60%;height:280px;display:none">
<?= HtmlInput::title_box("Recherche", "histo_search_d", "hide")?>
<form method="GET">
<?= HtmlInput::get_to_hidden(array("gDossier", "ac"))?>
<table>
<tr>
<td> Fiche </td>
<td> <?= $wcard->input()?><?=$wcard->search()?> </td>
</tr>
<tr>
<td> A partir de </td>
<td> <?= $wdate_start->input()?> </td>
</tr>
<tr>
<td> Jusque </td>
<td> <?= $wdate_end->input()?> </td>
</tr>
<tr>
<td> Dépôt </td>
<td> <?= $wrepo->input()?> </td>
</tr>
<tr>
<td> Montant supérieur ou égal à </td>
<td> <?= $wamount_start->input()?> </td>
</tr>
<tr>
<td> Montant inférieur ou égal à </td>
<td> <?= $wamount_end->input()?> </td>
</tr>
<tr>
<td> Code Stock </td>
<td> <?= $wcode_stock->input()?> </td>
</tr>
<tr>
<td> Direction </td>
<td> <?= $wdirection->input()?> </td>
</tr>
</table>
<?=HtmlInput::submit("search_histo_b","Recherche")?>
</form>
</div>

View file

@ -269,4 +269,21 @@ alter table user_sec_action_profile add constraint user_sec_action_profile_p_id_
ALTER TABLE stock_goods ADD COLUMN r_id bigint;
update stock_goods set r_id=1;
CREATE INDEX fk_stock_good_repository_r_id ON stock_goods (r_id );
alter table action_gestion drop ag_cal;
alter table action_gestion drop ag_cal;
update menu_ref set me_file=null where me_code='STOCK';
insert into menu_ref (me_code,me_file,me_menu,me_description,me_type) values ('STOCK_HISTO','stock_histo.inc.php','Historique stock','Historique des mouvement de stock','ME');
insert into menu_ref (me_code,me_file,me_menu,me_description,me_type) values ('STOCK_STATE','stock_state.inc.php','Etat des stock','Etat des stock','ME');
insert into profile_menu(me_code,me_code_dep,p_id,p_order,p_type_display) values ('STOCK_HISTO','STOCK',1,10,'E');
insert into profile_menu(me_code,me_code_dep,p_id,p_order,p_type_display) values ('STOCK_STATE','STOCK',1,20,'E');
insert into profile_menu(me_code,me_code_dep,p_id,p_order,p_type_display) values ('STOCK_HISTO','STOCK',2,10,'E');
insert into profile_menu(me_code,me_code_dep,p_id,p_order,p_type_display) values ('STOCK_STATE','STOCK',2,20,'E');
-- clean stock_goods
delete from stock_goods where sg_code is null or sg_code='' or sg_code not in (select ad_value from fiche_detail as fd where ad_id=19 and ad_value is not null);
CREATE INDEX fki_jrnx_j_grpt ON jrnx (j_grpt );
CREATE INDEX fki_jrn_jr_grpt_id ON jrn (jr_grpt_id );