noalyss  Version-6.7.2
 All Data Structures Namespaces Files Functions Variables Enumerations
stock_summary_table.php
Go to the documentation of this file.
00001 <?php
00002 /*
00003  *   This file is part of NOALYSS.
00004  *
00005  *   NOALYSS is free software; you can redistribute it and/or modify
00006  *   it under the terms of the GNU General Public License as published by
00007  *   the Free Software Foundation; either version 2 of the License, or
00008  *   (at your option) any later version.
00009  *
00010  *   NOALYSS is distributed in the hope that it will be useful,
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  *   GNU General Public License for more details.
00014  *
00015  *   You should have received a copy of the GNU General Public License
00016  *   along with NOALYSS; if not, write to the Free Software
00017  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018  */
00019 /* $Revision$ */
00020 
00021 // Copyright Author Dany De Bontridder danydb@aevalys.eu
00022 
00023 /**
00024  * @file
00025  * @brief show State of the stock
00026  *
00027  */
00028 ?>
00029 <div class="content">
00030 <table class="result">
00031         <tr>
00032                 <th>
00033                         <?php echo _("Code Stock")?>
00034                 </th>
00035                 <?php for ($i = 0; $i < count($a_repository); $i++):?>
00036                         <th>
00037                                 <?php echo h( $a_repository[$i]['r_name'])?>
00038                         </th>
00039                 <?php endfor;?>
00040                         <th>
00041                                 <?php echo _("Total")?>
00042                         </th>
00043         </tr>
00044         <?php 
00045         for ($x = 0; $x < count($a_code); $x++):
00046                 $class=($x%2==0)?' class="odd" ':' class="even" ';
00047                 ?>
00048 
00049                 <tr <?php echo $class?> >
00050                         <td>
00051                                 <?php echo HtmlInput::card_detail($a_code[$x]['sg_code'],"","",true)?>
00052                         </td>
00053                         <?php 
00054                         $n_in=0;$n_out=0;
00055                         for ($e = 0; $e < count($a_repository); $e++):
00056 
00057                                 $array = $cn->get_array("select coalesce(sum(s_qin)) as s_qin,coalesce(sum(s_qout)) as s_qout
00058                                                                                         from tmp_stockgood_detail
00059                                                                                  where r_id=$1 and sg_code=$2 and s_id=$3"
00060                                                 , array($a_repository[$e]['r_id'], $a_code[$x]['sg_code'],$tmp_id));
00061                                 ?>
00062                         <td>
00063                                 <?php 
00064                                         if (count($array)==0):
00065                                                 echo 0;
00066                                         else:
00067                                                 $n_in+=$array[0]['s_qin'];
00068                                                 $n_out+=$array[0]['s_qout'];
00069                                                 ?>
00070                                                 <table>
00071                                                         <tr>
00072                                                                 <td>
00073                                                                         <?php echo _("IN")?>  :
00074                                                                 </td>
00075                                                                 <td class="num">
00076                                                                         <?php echo nbm($array[0]['s_qin'])?>
00077                                                                 </td>
00078                                                         </tr>
00079                                                         <tr>
00080                                                                 <td>
00081                                                                         <?php echo _("OUT")?>  :
00082                                                                 </td>
00083                                                                 <td class="num">
00084                                                                         <?php echo nbm($array[0]['s_qout'])?>
00085                                                                 </td>
00086                                                         </tr>
00087                                                         <tr>
00088                                                                 <td>
00089                                                                         <?php echo _("DIFF")?>  :
00090                                                                 </td>
00091                                                                 <td class="num">
00092                                                                         <?php echo nbm((bcsub($array[0]['s_qin'],$array[0]['s_qout'])))?>
00093                                                                 </td>
00094                                                         </tr>
00095                                                 </table>
00096                                                 <?php 
00097                                         endif;
00098                                 ?>
00099                         </td>
00100                                 <?php 
00101                         endfor;  // loop e
00102                         ?>
00103                         <td>
00104 <table>
00105                                                         <tr>
00106                                                                 <td>
00107                                                                         <?php echo _("IN")?>  :
00108                                                                 </td>
00109                                                                 <td class="num">
00110                                                                         <?php echo nbm($n_in)?>
00111                                                                 </td>
00112                                                         </tr>
00113                                                         <tr>
00114                                                                 <td>
00115                                                                         <?php echo _("OUT")?>  :
00116                                                                 </td>
00117                                                                 <td class="num">
00118                                                                         <?php echo nbm($n_out)?>
00119                                                                 </td>
00120                                                         </tr>
00121                                                         <tr>
00122                                                                 <td>
00123                                                                         <?php echo _("DIFF")?>  :
00124                                                                 </td>
00125                                                                 <td class="num">
00126                                                                         <?php echo nbm((bcsub($n_in,$n_out)))?>
00127                                                                 </td>
00128                                                         </tr>
00129                                                 </table>
00130                         </td>
00131                 </tr>
00132                 <?php 
00133         endfor; // loop x
00134         ?>
00135 </table>
00136 </div>
 All Data Structures Namespaces Files Functions Variables Enumerations