/var/www/enzatesting.onesolution.hk/invstocktake_diamond_history.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
<?php 
$formid 
"Inventory";
require_once 
"inc/configure.php";

if(
havePermission("STr")==false){
    
myerror(INVALID.WS.PERMISSION);    
}

$companyid setDefaultReqVar("companyid"$system_var['COMPANY_FACTORY']);
$bomcategy setDefaultReqVar("bomcategy""diamond");
$refid setDefaultReqVar("refid"'');
$location setDefaultReqVar("location"'');


if(
$refid && $row=getDB("inv_diamond"$refid) ){
    
$header $row;
    
$uom_qty $header['uom_inventory'];
    
$uom_wt $header['uom_wt'];
} else {
    
myerror("Invalid request");
}

?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ENZA</title>
<link rel="stylesheet" type="text/css" href="css/style.css" />
<?php require_once "inc/jsheader.php"?>

<script>
$(document).ready(function(){

});
</script>
</head>
<body>

<form action="#" name="myform" id="validateForm" method="post" >
<input type="hidden" name="action" value="inv_stocktake_history" />
<input type="hidden" name="refid" value="<?=$row['refid']?>" />
<input type="hidden" name="bomcategy" value="<?=$bomcategy?>" />
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--  <tr>
    <td valign="top" class="top"><?php //require"mod_webhead.php"; ?></td>
  </tr>-->
  <tr>
    <td><table width="100%" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <!--<td valign="top" class="menu_bg"><?php //require"mod_menu.php"; ?></td>-->
        <td valign="top" class="padding1"><table width="100%" border="0" cellpadding="0" cellspacing="0">
          <tr></tr>
          <tr>
            <td class="c3_bg"><table width="100%" border="0" cellpadding="0" cellspacing="0">
              <tr>
                <!--<td width="20" class="separator"><input type="image" src="image/icon_save.jpg" width="20" height="20" class="pressnhide2" /></td>-->
                <!--<td width="20" class="separator"><a href="<?=basename($_SERVER['REQUEST_URI'])?>"><img src="image/icon_undo.jpg" width="20" height="20" /></a></td>-->
                <!--<td width="20" class="separator"><img src="image/icon_redo.jpg" width="20" height="20" /></td>
                <td width="20" class="separator"><img src="image/icon_delete.jpg" width="20" height="20" /></td>-->
                <td class="separator stext1"><?=STOCKTAKE?><?=WS?><?=HISTORY?> - <span><?=DIAMOND?></span></td>
                <td class="separator etext1"><?=$row['itemno']?> - <span><?=$row['name_'.SYS_LANG]?></span> (<?=numf($header['weight'] ,3)?><?=$header['uom_wt']?>/<?=$header['uom_inventory']?>)</td>
                <!--<td width="200" align="right" class="separator etext2"><?=LAST_MODIFY?><?=lastUpdate($row)?></td>-->
                <td width="50" align="right" class="separator etext2"><a href="#" onclick="fbox_close()"><img src="image/icon_close.jpg" width="20" height="20" align="absmiddle" /><?=CLOSE?></a></td>
              </tr>
            </table></td>
          </tr>
          <tr>
            <td valign="top" class="c2_bg" style="height:auto">
            <!--main form-->
                <table width="100%" border="0" class="tablelist">
                <tr>
                    <th><?=DESC?></th>
                    <th><?=REFERENCE?><?=WS?><?=NUMBER?></th>
                    <th><?=REFERENCE?><?=WS?><?=NUMBER?><?=WS?>2</th>
                    <th><?=DATE?></th>
                    <th><?=QTY?>(+)</th>
                    <th><?=WEIGHT?>(+)</th>
                    <th><?=QTY?>(-)</th>
                    <th><?=WEIGHT?>(-)</th>
                </tr>
                

                

                
                <tr>
                    <td><?=OPENING_BALANCE?></td>
                    <td class="code">&nbsp;</td>
                    <td class="code">&nbsp;</td>
                    <td><?=datef(inv_getLastStocktakeEndtime($companyid))?></td>
                    <td class="tdalignright"><?=numf(inv_getLastSTQty($companyid$bomcategy$refid))?></td>
                    <td class="tdalignright"><?=numf(inv_getLastSTWt($companyid$bomcategy$refid), 3)?></td>
                    <td class="tdalignright">&nbsp;</td>
                    <td class="tdalignright">&nbsp;</td>
                </tr>

<?php
    $sql 
"SELECT
dbo.ord_poset.actqty,
dbo.ord_poset.uom_qty,
dbo.ord_poset.wt,
dbo.ord_poset.uom_wt,
dbo.ord_poset.createdate,
dbo.ord_pomain.refid,
dbo.ord_pomain.pono,
dbo.ord_poset.supplierivc_ref
FROM
dbo.ord_podtl
INNER JOIN dbo.ord_poset ON dbo.ord_poset.podtl_refid = dbo.ord_podtl.refid
INNER JOIN dbo.ord_pomain ON dbo.ord_podtl.pomain_refid = dbo.ord_pomain.refid
WHERE
dbo.ord_podtl.bomcategy = :bomcategy AND
dbo.ord_podtl.itemnoid = :itemnoid AND
dbo.ord_poset.recdate > :stocktake_time AND
dbo.ord_pomain.buyer = :companyid"
;

$sth $dbh->prepare($sql);
$sth->execute( array(':bomcategy' => $bomcategy':itemnoid' => $refid':companyid' => $companyid':stocktake_time'=>inv_getLastStocktakeEndtime($companyid)) );
//echo $sth->getSQL( array(':bomcategy' => $bomcategy, ':itemnoid' => $refid, ':companyid' => $companyid, ':stocktake_time'=>inv_getLastStocktakeEndtime($companyid)) ) . HTML_EOL;
                            
while($row $sth->fetch()) { ?> 
                
                <tr>
                    <td><?=PURCHASED?></td>
                    <td class="code"><?=$row['supplierivc_ref']?></td>
                    <td class="code"><?=$row['pono']?></td>
                    <td><?=datef($row['createdate'])?></td>
                    <td class="tdalignright"><?=numf($row['actqty'])?></td>
                    <td class="tdalignright"><?=numf($row['wt'], 3)?></td>                    
                    <td class="tdalignright">&nbsp;</td>
                    <td class="tdalignright">&nbsp;</td>
                </tr>    
<?php ?>

<?php
    $sql 
"SELECT
dbo.ord_txpick.refid,
dbo.ord_txpick.txmain_refid,
dbo.ord_txpick.ordbom_refid,
dbo.ord_txpick.txqty,
dbo.ord_txpick.txwt,
dbo.ord_txpick.worker,
dbo.ord_txpick.repick_reason,
dbo.ord_txpick.checkin_time,
dbo.ord_dtl.itemno,
dbo.ord_txmain.orddtl_refid

FROM
dbo.ord_txpick
INNER JOIN dbo.ord_txmain ON dbo.ord_txpick.txmain_refid = dbo.ord_txmain.refid
INNER JOIN dbo.ord_dtl ON dbo.ord_txmain.orddtl_refid = dbo.ord_dtl.refid
WHERE
dbo.ord_txpick.checkin_time > :stocktake_time AND
dbo.ord_txpick.bomcategy = :bomcategy AND
dbo.ord_txpick.itemnoid = :itemnoid AND
dbo.ord_txpick.status = 'PICK'"
;

$sth $dbh->prepare($sql);
$sth->execute( array(':bomcategy' => $bomcategy':itemnoid' => $refid':stocktake_time'=>inv_getLastStocktakeEndtime($companyid)) );
//echo $sth->getSQL( array(':bomcategy' => $bomcategy, ':itemnoid' => $refid, ':stocktake_time'=>inv_getLastStocktakeEndtime($companyid)) ) . HTML_EOL;
                            
while($row $sth->fetch()) { ?>                
                <tr>
                    <td><?=PICKED?></td>
                    <td class="code"><?=generateJCBarcode($row['orddtl_refid'])?></td>
                    <td class="code"><?=$row['itemno']?></td>
                    <td><?=datef($row['checkin_time'])?></td>
                    <td class="tdalignright">&nbsp;</td>
                    <td class="tdalignright">&nbsp;</td>
                    <td class="tdalignright"><?=numf($row['txqty'])?></td>
                    <td class="tdalignright"><?=numf($row['txwt'])?></td>                    
                </tr>        
<?php ?>

<?php
    $sql 
"SELECT
dbo.ord_txpick.refid,
dbo.ord_txpick.txmain_refid,
dbo.ord_txpick.ordbom_refid,
dbo.ord_txpick.txqty,
dbo.ord_txpick.txwt,
dbo.ord_txpick.worker,
dbo.ord_txpick.repick_reason,
dbo.ord_txpick.checkin_time,
dbo.ord_txpick.status,
dbo.ord_dtl.itemno,
dbo.ord_txmain.orddtl_refid
FROM
dbo.ord_txpick
INNER JOIN dbo.ord_txmain ON dbo.ord_txpick.txmain_refid = dbo.ord_txmain.refid
INNER JOIN dbo.ord_dtl ON dbo.ord_txmain.orddtl_refid = dbo.ord_dtl.refid
WHERE
dbo.ord_txpick.checkin_time > :stocktake_time AND
dbo.ord_txpick.bomcategy = :bomcategy AND
dbo.ord_txpick.itemnoid = :itemnoid AND
dbo.ord_txpick.status IN ('RETURN', 'DAMAGE')"
;

$sth $dbh->prepare($sql);
$sth->execute( array(':bomcategy' => $bomcategy':itemnoid' => $refid':stocktake_time'=>inv_getLastStocktakeEndtime($companyid)) );
//echo $sth->getSQL( array(':bomcategy' => $bomcategy, ':itemnoid' => $refid, ':stocktake_time'=>inv_getLastStocktakeEndtime($companyid)) ) . HTML_EOL;
                            
while($row $sth->fetch()) { ?>                 
                <tr>
                    <td><?=RECEIVED?> (<?=$row['status']?>)</td>
                    <td class="code"><?=generateJCBarcode($row['orddtl_refid'])?></td>
                    <td class="code"><?=$row['itemno']?></td>
                    <td><?=datef($row['checkin_time'])?></td>
                    <td class="tdalignright"><?=numf($row['txqty'])?></td>
                    <td class="tdalignright"><?=numf($row['txwt'], 3)?></td>        
                    <td class="tdalignright">&nbsp;</td>
                    <td class="tdalignright">&nbsp;</td>
                </tr>                                                                        
<?php ?>
 
                
                <tr><td colspan="8"><hr/></td></tr>    
                <tr>
                    <td><?=EXPECTED_INVENTORY?></td>
                    <td class="code">&nbsp;</td>
                    <td class="code">&nbsp;</td>
                    <td><?=date("Y-m-d h:i:s")?></td>
                    
                    <td class="tdalignright"><?=numf(inv_getSafeQty($companyid$bomcategy$refid))?></td>
                    <td class="tdalignright"><?=numf(inv_getSafeWt($companyid$bomcategy$refid), 3)?></td>    
                    <td class="tdalignright">&nbsp;</td>
                    <td class="tdalignright">&nbsp;</td>                
                </tr>
                
                </table>

            <!-- end of mainform-->
            </td>
          </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
</table>
</form>

</body>
</html>