noalyss Version-9
stock_summary_table.php
Go to the documentation of this file.
1<?php
2/*
3 * This file is part of NOALYSS.
4 *
5 * NOALYSS is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * NOALYSS is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with NOALYSS; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19/* $Revision$ */
20
21// Copyright Author Dany De Bontridder danydb@aevalys.eu
22
23/**
24 * @file
25 * @brief show State of the stock
26 *
27 */
28?>
29<div class="content">
30<table class="result">
31 <tr>
32 <th>
33 <?php echo _("Code Stock")?>
34 </th>
35 <?php for ($i = 0; $i < count($a_repository); $i++):?>
36 <th>
37 <?php echo h( $a_repository[$i]['r_name'])?>
38 </th>
39 <?php endfor;?>
40 <th>
41 <?php echo _("Total")?>
42 </th>
43 </tr>
44 <?php
45 for ($x = 0; $x < count($a_code); $x++):
46 $class=($x%2==0)?' class="odd" ':' class="even" ';
47 ?>
48
49 <tr <?php echo $class?> >
50 <td>
51 <?php echo HtmlInput::card_detail($a_code[$x]['sg_code'],"","",true)?>
52 </td>
53 <?php
54 $n_in=0;$n_out=0;
55 for ($e = 0; $e < count($a_repository); $e++):
56
57 $array = $cn->get_array("select coalesce(sum(s_qin)) as s_qin,coalesce(sum(s_qout)) as s_qout
58 from tmp_stockgood_detail
59 where r_id=$1 and sg_code=$2 and s_id=$3"
60 , array($a_repository[$e]['r_id'], $a_code[$x]['sg_code'],$tmp_id));
61 ?>
62 <td>
63 <?php
64 if (count($array)==0):
65 echo 0;
66 else:
67 $n_in+=$array[0]['s_qin'];
68 $n_out+=$array[0]['s_qout'];
69 ?>
70 <table>
71 <tr>
72 <td>
73 <?php echo _("IN")?> :
74 </td>
75 <td class="num">
76 <?php echo nbm($array[0]['s_qin'])?>
77 </td>
78 </tr>
79 <tr>
80 <td>
81 <?php echo _("OUT")?> :
82 </td>
83 <td class="num">
84 <?php echo nbm($array[0]['s_qout'])?>
85 </td>
86 </tr>
87 <tr>
88 <td>
89 <?php echo _("DIFF")?> :
90 </td>
91 <td class="num">
92 <?php echo nbm((bcsub($array[0]['s_qin']??0,$array[0]['s_qout']??0)))?>
93 </td>
94 </tr>
95 </table>
96 <?php
97 endif;
98 ?>
99 </td>
100 <?php
101 endfor; // loop e
102 ?>
103 <td>
104<table>
105 <tr>
106 <td>
107 <?php echo _("IN")?> :
108 </td>
109 <td class="num">
110 <?php echo nbm($n_in)?>
111 </td>
112 </tr>
113 <tr>
114 <td>
115 <?php echo _("OUT")?> :
116 </td>
117 <td class="num">
118 <?php echo nbm($n_out)?>
119 </td>
120 </tr>
121 <tr>
122 <td>
123 <?php echo _("DIFF")?> :
124 </td>
125 <td class="num">
126 <?php echo nbm((bcsub($n_in,$n_out)))?>
127 </td>
128 </tr>
129 </table>
130 </td>
131 </tr>
132 <?php
133 endfor; // loop x
134 ?>
135</table>
136</div>
th($p_string, $p_extra='', $raw='')
Definition: ac_common.php:58
tr($p_string, $p_extra='')
Definition: ac_common.php:88
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
h( $row[ 'oa_description'])
$class
static card_detail($p_qcode, $pname='', $p_style="", $p_nohistory=false, $nofollowup=false)
show the detail of a card
$all table