noalyss Version-9
stock_summary_list.php
Go to the documentation of this file.
1<?php
2
3/*
4 * This file is part of NOALYSS.
5 *
6 * NOALYSS is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * NOALYSS is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with NOALYSS; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20/* $Revision$ */
21
22// Copyright Author Dany De Bontridder danydb@aevalys.eu
23
24/**
25 * @file
26 * @brief show the result to stock state in list format (more detailled)
27 *
28 */
29$a_repo=$cn->get_array("select distinct t.r_id,r_name,r_adress,r_city,r_country,r_phone from stock_repository as s join tmp_stockgood_detail as t
30 on (s.r_id=t.r_id)
31 where
32 s_id=$1
33 order by 2
34 ",array($tmp_id));
35?>
36<div class="content">
37<?php for ($r=0;$r<count($a_repo);$r++):?>
38<h1><?php echo $a_repo[$r]['r_name']?></h1>
39<p><?php echo _("Adresse")?> <?php echo $a_repo[$r]['r_adress']?></p>
40<p><?php echo _("Ville")?> <?php echo $a_repo[$r]['r_city']?></p>
41<p><?php echo _("Pays")?> <?php echo $a_repo[$r]['r_country']?></p>
42<p><?php echo _("Téléphone")?> <?php echo $a_repo[$r]['r_phone']?></p>
43<table class="result">
44 <tr>
45 <th><?php echo _("Code")?></th>
46 <th><?php echo _("Détail")?></th>
47 <th style="text-align: right"><?php echo _("IN")?></th>
48 <th style="text-align: right"><?php echo _("OUT")?></th>
49 <th style="text-align: right"><?php echo _("En Stock")?></th>
50 </tr>
51 <?php
52 $a_stock=$cn->get_array(
53 "
54 select coalesce(sum(s_qin),0) as qin,coalesce(sum(s_qout),0) as qout,sg_code
55 from tmp_stockgood_detail where r_id=$1 and s_id=$2
56 group by sg_code
57 order by sg_code
58
59 ",array($a_repo[$r]['r_id'],$tmp_id));
60 for ($s=0;$s<count($a_stock);$s++):
61 $a_card=$cn->get_array(
62 "
63 select f_id,vw_name,quick_code
64 from vw_fiche_attr
65 where
66 f_id in (
67 select distinct f_id
68 from tmp_stockgood_detail
69 where
70 r_id=$1
71 and s_id=$2
72 and sg_code=$3)
73 order by vw_name,quick_code
74 ",array($a_repo[$r]['r_id'],$tmp_id,$a_stock[$s]['sg_code']));
75 ?>
76 <tr>
77 <td>
78 <?php echo HtmlInput::card_detail($a_stock[$s]['sg_code'],'','',true)?>
79 </td>
80 <td>
81 <?php
82 $sep="";
83 for ( $c=0;$c<count($a_card);$c++):
84 echo $sep.HtmlInput::card_detail($a_card[$c]['quick_code'], $a_card[$c]['vw_name'], ' class="line" ');
85 $sep=" ,";
87 if ( count($a_card)== 0 ) echo '<span class="notice">'._("Changement manuel").'</span>';
88 ?>
89 </td>
90 <td class="num">
91 <?php echo nbm($a_stock[$s]['qin'])?>
92 </td>
93 <td class="num">
94 <?php echo nbm($a_stock[$s]['qout'])?>
95
96 </td>
97 <td class="num">
98 <?php echo nbm(bcsub($a_stock[$s]['qin'],$a_stock[$s]['qout']))?>
99 </td>
100 </tr>
101<?php endfor; ?>
102</table>
103<?php endfor; ?>
104
105</div>
th($p_string, $p_extra='', $raw='')
Definition: ac_common.php:58
h1($p_string, $p_class="")
Definition: ac_common.php:72
tr($p_string, $p_extra='')
Definition: ac_common.php:88
p($p_string)
Definition: ac_common.php:39
td($p_string='', $p_extra='')
surround the string with td
Definition: ac_common.php:83
nbm($p_number, $p_dec=2)
format the number with a sep.
Definition: ac_common.php:137
catch(Exception $exc) if(! $g_user->can_write_action($ag_id)) $r
$opd_description style
static card_detail($p_qcode, $pname='', $p_style="", $p_nohistory=false, $nofollowup=false)
show the detail of a card
$all table