/var/www/enzatesting.onesolution.hk/invstocktake_stone_index.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
<?php 
$formid 
"Inventory";
require_once 
"inc/configure.php";

$bomcategy "stone";

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

//store request param to session
search_stoneField($_REQUEST['act'], $_REQUEST['stonetype'], $_REQUEST['stoneqlty'], $_REQUEST['stonecolor'], $_REQUEST['stoneshape'], $_REQUEST['stonesize'], $_REQUEST['verified'] );    
//echo"sho = form";
//vdump($_REQUEST);
$companyid setDefaultReqVar("companyid"$system_var['COMPANY_FACTORY']);
$refid setDefaultReqVar("refid"'');
$verified setDefaultReqVar("verified"'1');

$p = (int)evl($_REQUEST["pg"], evl($_REQUEST["p"], 1));
$perp = (int)setDefaultReqVar("perp"50);
list(
$row_offset_start$row_offset_end) = page_offset($p$perp);

$sql_clause='';
    
$searchno=getSearchStoneNo($_REQUEST['stonetype'], $_REQUEST['stoneqlty'], $_REQUEST['stonecolor'], $_REQUEST['stoneshape'], $_REQUEST['stonesize'] );    
$sql_param[':searchno'] = $searchno;

if( 
$_REQUEST['verified']!='ALL' ){
    
$sql_clause .= 'AND verified = :verified ';
    
$sql_param[':verified'] = $verified;            
}
?><!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><?=$system_var['COMPANY_NAME']?></title>
<link rel="stylesheet" type="text/css" href="css/style.css" />
<?php require_once "inc/jsheader.php"?>
<script>
$(document).ready(function() {
    $("input.inv_onstocktake_cb").on("click", function(event){
        event.preventDefault();
    });
    
    $(".inv_unchanged_btn").click(function(e){
        var refid = $(this).first().attr("data-refid");
        var tdcell = $(this).closest(".action_td");
        $.blockUI({  theme:     true,
                title:    'ENZA', 
                message:  '<p><?=LOADING?>...<br/><br/><span style="float:right;" ><input type="button" name="<?=CLOSE?>" value="<?=CLOSE?>" onclick="$.unblockUI();" /></span></p>', 
                baseZ: 2000     }); 
        //alert('c'+$('#custcode').val());
        //load select option of product    
        
        $.get("invstocktake_rawmat_unchanged.php",{  
                  formid: "<?=$formid?>",
                  action: "inv_stocktake_rawmat_unchange",
                  refid: refid,
                  bomcategy: "<?=$bomcategy?>",
                  companyid: "<?=$companyid?>"
              },
              function(data){
                  //alert(data);
                  tdcell.html(data);
            });  
        $.unblockUI();
        
        e.preventDefault();
    });
});
</script>
</head>
<body>
<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 width="200" 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="c1_bg">
            <form action="invstocktake_stone_index.php" method="post">
            <table width="100%" border="0" cellpadding="0" cellspacing="0" class="search">
              <tr>
                <td width="120" valign="top" rowspan="2" ><?=STOCKTAKE?>:<br />
                  <span class="stext1"><?=STONE?>:</span><br />
<a href="invstocktake_stone_index2.php?companyid=<?=$companyid?>" target="_blank">Full List</a></td>
                <td valign="top" rowspan="2">                
                <table>
                <tr>
                <td class="stext2">SS-<?=STONETYPE?></td>
                <td class="stext2"><select name="stonetype"><option value=""></option><?=master_option("STONETYPE"$_REQUEST['stonetype'], true)?></select></td>
                </tr>
                <tr>
                <td class="stext2">QQ-<?=STONEQLTY?></td>
                <td class="stext2"><select name="stoneqlty"><option value=""></option><?=master_option("STONEQLTY"$_REQUEST['stoneqlty'], true)?></select></td>
                </tr>
                <tr>
                <td class="stext2">CC-<?=STONECOLOR?></td>
                <td class="stext2"><select name="stonecolor"><option value=""></option><?=master_option("STONECOLOR"$_REQUEST['stonecolor'], true)?></select></td>
                </tr>
                <tr>
                <td class="stext2">PP-<?=STONESHAPE?></td>
                <td class="stext2"><select name="stoneshape"><option value=""></option><?=master_option("STONESHAPE"$_REQUEST['stoneshape'], true)?></select></td>
                </tr>
                <tr>
                <td class="stext2">XXXXX-<?=SIZE?></td>
                <td class="stext2"><input type="text" name="stonesize" value="<?=$_REQUEST['stonesize']?>" size="5" maxlength="5"/></td>
                </tr>
                <tr>
                <td class="stext2"><?=VERIFIED?></td>
                <td class="stext2"><select name="verified"><?=master_option("VERIFIED"$_REQUEST['verified'], true)?>
<option value="ALL" <?=($_REQUEST['verified']=="ALL")? "selected" ""?> >All</option>
</select></td>
                </tr>
                </table>
</td>
                <td align="right" valign="top"><input type="image" src="image/btn_search.jpg" width="64" height="20" />&nbsp; <!--<a href="inv_stone_addform.php" ><img src="image/btn_new.jpg" width="52" height="20" /></a>&nbsp;--><a href="<?=basename($_SERVER['PHP_SELF'])?>"><img src="image/icon_close.jpg" width="20" height="20" align="top" alt="<?=CLEAR?>" /></a></td>
              </tr>
              <tr>
              <?php    //get number of row 
    
$sql "SELECT count(*) as cnt
FROM
inv_stone
INNER JOIN master_type_code AS stoneshape ON stoneshape.codeid = inv_stone.stoneshape
INNER JOIN master_type_code AS itemgp ON itemgp.codeid = inv_stone.itemgp
INNER JOIN master_type_code AS verified ON verified.codeid = inv_stone.verified
WHERE
stoneshape.typeid = 'STONESHAPE' AND
verified.typeid = 'VERIFIED' AND
itemgp.typeid = 'ITEMGP'
AND itemno like :searchno
$sql_clause";    

    
$sth $dbh->prepare($sql);
    
$sth->execute$sql_param );
//echo $sth->getSQL( $sql_param ) . HTML_EOL;
                            
    
$row $sth->fetch();
    
$ttlrow $row['cnt'];
    
//vdump($row);                
?>    
                <td class="tdalignright tdvalignbottom"><?=pagination($ttlrow$p$perp)?></td>
              </tr>              
<!--              <tr>
                <td height="25" colspan="3" valign="bottom" class="stext2">        </td>
                </tr>-->
            </table>
</form></td>
          </tr>
          <tr>
            <td valign="top" class="c2_bg"><table width="100%" border="0" cellpadding="0" cellspacing="0">
              <tr>
                <td valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" class="tablelist floathead">
                  <thead><tr>
                        <th><?=ITEMNO?></th>
                        <th><?=ITEMNAME?></th>
                        <th colspan="2"><?=SAFE?> (<?=QTY?>)</th>
                        <th colspan="2"><?=SAFE?> (<?=WEIGHT?>)</th>
                        <th colspan="2"><?=COUNTED?> (<?=QTY?>)</th>
                        <th colspan="2"><?=CHECKED?> (<?=WEIGHT?>)</th>           
                        <th colspan="2"><?=GAP?> (<?=QTY?>)</th>
                        <th colspan="2"><?=GAP?> (<?=WEIGHT?>)</th> 
                        <th><?=ITEMGP?></th>
                        <th><?=STONESHAPE?></th>
                        <th><?=VERIFIED?></th>
                        <!--<th>Delete</th>-->
                        <th><?=NST?></th>
                        <th><?=ACTION?></th>
                    </tr></thead>
<?php


    $sql 
"SELECT * FROM(
    SELECT inv_stone.*, 
stoneshape.codedesc_en AS stoneshape_en,
stoneshape.codedesc_sc AS stoneshape_sc,
itemgp.codedesc_en AS group_en,
itemgp.codedesc_sc AS group_sc,
verified.codedesc_en AS verified_en,
verified.codedesc_sc AS verified_sc,
                ROW_NUMBER() OVER (ORDER BY itemno) as RowNum

FROM
inv_stone
INNER JOIN master_type_code AS stoneshape ON stoneshape.codeid = inv_stone.stoneshape
INNER JOIN master_type_code AS itemgp ON itemgp.codeid = inv_stone.itemgp
INNER JOIN master_type_code AS verified ON verified.codeid = inv_stone.verified
WHERE
stoneshape.typeid = 'STONESHAPE' AND
verified.typeid = 'VERIFIED' AND
itemgp.typeid = 'ITEMGP'
AND itemno like :searchno
$sql_clause
) AS ROWCST 
            WHERE RowNum >= 
$row_offset_start AND RowNum <= $row_offset_end
            ORDER BY RowNum"
;    

    
$sth $dbh->prepare($sql);
    
$sth->execute$sql_param );
//echo $sth->getSQL( $sql_param ) . HTML_EOL;
                            
    
while($row $sth->fetch()) {
        
$checked = empty($row['nostocktake']) ? '' 'checked="checked"';
        
?>
                  <tr>
                    <td class="code"><a href="invstocktake_stone_modifyform.php?companyid=<?=$companyid?>&refid=<?=$row['refid']?>" class="fbox"><?=$row['itemno']?></a></td>
                    <td><?=$row['name_'.SYS_LANG]?></td> 
                    <td class="tdalignright"><?=$lastQty numf(inv_getSafeQty($companyid$bomcategy$row['refid']))?></td><td class="tdalignleft"><?=$row['uom_inventory']?></td>
                    <td class="tdalignright"><?=$lastWt numf(inv_getSafeWt($companyid$bomcategy$row['refid']), 3)?></td><td class="tdalignleft"><?=$row['uom_wt']?></td>          
                    <td class="tdalignright"><?=$currQty numf(inv_getCurrentSTQty($companyid$bomcategy$row['refid']))?></td><td class="tdalignleft"><?=$row['uom_inventory']?></td>
                    <td class="tdalignright"><?=$currWt numf(inv_getCurrentSTWt($companyid$bomcategy$row['refid']), 3)?></td><td class="tdalignleft"><?=$row['uom_wt']?></td> 
                    
                    <td class="tdalignright"><?=numf($lastQty $currQty)?></td><td class="tdalignleft"><?=$row['uom_inventory']?></td>
                    <td class="tdalignright"><?=numf($lastWt $currWt3)?></td><td class="tdalignleft"><?=$row['uom_wt']?></td>
                    
                    <td><?=$row['group_'.SYS_LANG]?></td>
                    <td><?=$row['stoneshape_'.SYS_LANG]?></td>
                    <td><?=$row['verified_'.SYS_LANG]?></td>                    
                    <td><input type="checkbox" name="nostocktake" data-refid="<?=$row['refid']?>" class="inv_onstocktake_cb" <?=$checked?> /></td>
                    <td class="action_td tdalignmid"><?php if( empty($row['nostocktake']) && inv_allowUnchangedBtn($companyid$bomcategy$row['refid']) ){?>
                        <button type="button" class="inv_unchanged_btn" data-refid="<?=$row['refid']?>" ><?=NO_MOVEMENT?></button> 
                    <?php } else {?>&nbsp;<?php ?></td>
                  </tr>
<?php ?>
                </table></td>
<!--                <td width="150" valign="top" class="product_image"><img src="image/image2.jpg" width="150" height="150" /></td>-->
              </tr>
            </table></td>
          </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
</table>
</body>
</html>