/var/www/enzatesting.onesolution.hk/01_20240711_full_backup/ord_engd_modifyform.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
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
<?php 
$formid 
"Order";
require_once 
"inc/configure.php";

$opr_param['opr_code']     = "EGRA";

/*function egra_checkin($orddtl_refid, $opr_param){
    //write tx details to tx subtable
    global $dbh;        
    $sql = "INSERT INTO ord_txegra (
                txmain_refid, worker, txqty, act_svc_duration,
                createby, createdate, lastupby, lastupdate
            ) VALUES (
                :txmain_refid, :worker, :txqty, :act_svc_duration,
                :createby, GETDATE(), :lastupby, GETDATE()
            )";
    $sth = $dbh->prepare($sql);
    $q = $sth->execute(  array( ':txmain_refid' => $opr_param['txmain_refid'],                                             
                            ':worker' => $opr_param['worker'], 
                            ':txqty' => $opr_param['txqty'],    
                            ':act_svc_duration' => $opr_param['act_svc_duration'],                                          
                            ':createby' => $opr_param['createby'],
                            ':lastupby' => $opr_param['lastupby']) );    
    echo $sth->getSQL( array( ':txmain_refid' => $opr_param['txmain_refid'],                                             
                            ':moldno' => $opr_param['moldno'],
                            ':worker' => $opr_param['worker'], 
                            ':worker_sign' => $opr_param['worker_sign'],    
                            ':checkin_wt' => $opr_param['checkin_wt'], 
                            ':txqty' => $opr_param['txqty'],                                             
                            ':createby' => $opr_param['createby'],
                            ':lastupby' => $opr_param['lastupby']) );        
    pdo_showerror($sth, $q);                                                
                                           
}*/


$checkin_info oprReadyForCheckin($refid$opr_param$status);

$refid = (int)setDefaultReqVar("refid"'');
$barcode setDefaultReqVar("barcode"'');

if(
$barcode){
    
$refid = (int)parseJCBarcode($barcode);
}

if(
$refid){
    
$dbh->beginTransaction();
    
    
$sql="SELECT
            dbo.ord_dtl.refid,
            dbo.ord_main.refid AS main_refid,
            dbo.ord_main.order_nbr,
            dbo.master_customer.custname_en,
            dbo.master_customer.custname_sc,
            dbo.master_customer.stamp_src,
            dbo.master_customer.stamp_path,
            dbo.master_customer.stamp_remark,
            dbo.master_customer.refid AS cust_refid,
            dbo.ord_main.launch_date,
            dbo.ord_main.del_date,
            dbo.ord_dtl.itemno,
            dbo.ord_dtl.qty,
            dbo.ord_dtl.[size],
            dbo.ord_dtl.remark,
            dbo.inv_product.mold_refid,
            dbo.inv_product.[size] AS prod_size
            
            FROM
            dbo.ord_main
            INNER JOIN dbo.ord_dtl ON dbo.ord_dtl.main_refid = dbo.ord_main.refid
            INNER JOIN dbo.master_customer ON dbo.ord_main.custcode = dbo.master_customer.custcode
            INNER JOIN dbo.inv_product ON dbo.inv_product.refid = dbo.ord_dtl.product_refid
            WHERE
            dbo.ord_dtl.refid = :refid    "
;    $sth $dbh->prepare($sql);
    
$sth->execute(  array(':refid' => $refid) );
    
//echo $sth->getSQL(  array(':refid' => $refid) );    
    
$row $sth->fetch();
    
$checkin_info oprReadyForCheckin($refid$opr_param$status);
    
//vdump($checkin_info);
    
if($status=="OK"){
        
//checkin now
        
$opr_param['subtable']         = "ord_txegra";
        
//$opr_param['php_function']    = "egra_checkin";
        
$opr_param['createby']        = filter_var($_SESSION['user'], FILTER_SANITIZE_STRING);
        
$opr_param['lastupby']        = filter_var($_SESSION['user'], FILTER_SANITIZE_STRING);
        
//$opr_param['checkin_wt']     = getLastTxWeight($refid);
        
ord_updateJCLocation($refid$checkin_info['refid'], $opr_param);
        
$checkin_time ord_checkin($refid$checkin_info['refid'], $opr_param);        
    }
    elseif(
$status=="RESUME"){}    
    
$dbh->commit();    //exit;
    
    
$checkout_info oprReadyForCheckout($refid$opr_param);
    
//vdump($checkout_info); 
    
    
$checkin_time = new DateTime($checkout_info['checkin_time']);
    
$checkin_duration $checkin_time->diff( new DateTime("now") ); //compared to NOW
    
$act_svc_duration numf(dateintervalToHour($checkin_duration));
    
$sth=null;    
        
} else {

}

?>
<!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 src="SpryAssets/SpryValidationCheckbox.js" type="text/javascript"></script>
<script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<script>

$(document).ready(function() {

    //refreshMOLD();
    
    $( "#checkout-form" ).dialog({
        autoOpen: false,
        modal: true
    });
    $( "#checkout_trig" ).click(function() {
        $( "#checkout-form" ).dialog( "open" );
    });
    
    $(".focus").focus();
    
});    


function localbind(){

}

function confirmCheckout(){
    return confirm("<?=ARE_YOU_SURE_YOU_WANT_TO_.WS.CHECKOUT?>?");
}

</script>

<link href="SpryAssets/SpryValidationCheckbox.css" rel="stylesheet" type="text/css" />
<link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
</head>
<?=wip_transferWarning($opr_param$halt$false);?>

<?php if($halt){ exit; } ?>
<body><?=""//vdump($checkin_info);?>
  <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"?>
            <br/>
            <span class="mod_menu"><a href="ord_deptcheckinform.php?dept=<?=$opr_param['opr_code']?>" target="_new" class="fboxs uibutton" ><?=DEPARTMENT?><?=WS?><?=CHECKIN?></a></span>
            
            <form action="ord_engd_index.php" name="quickform" id="quickform" method="post" enctype="multipart/form-data">
                <span class="stext1"><br/><?=JOB_CARD?>:</span><br/>
                <input type="text" name="barcode" class="focus shortfield"  />
                <input type="submit" name="S" value="<?=SUBMIT?>" />
                </form>
                </td>
            <td valign="top" class="padding1">
<?php if(!empty($row)){ ?>

<?=wip_transferWarning($opr_param$halt);?>

<?php if($halt){ exit; } ?>
                <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" /></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 width="20" class="separator"><a href="#" id="print_trig"><span class="ui-icon0 ui-icon-print" ><?=PRINT_?></span></a></td>-->
                        <?php //vdump($checkin_info);
                        
if($checkout_info){ ?>
                        <td width="20" class="separator">                        
                        <a href="#" id="checkout_trig" class="uibutton">
                          <?=CHECKOUT?></a></td><?php ?>
                        <!--<td width="20" class="separator"><a href="dgn_drawing_print.php?refid=<?=$row['refid']?>" target="_new"><?=PRINT_?></a></td>-->
                        <td class="separator stext1"><?=ENGD?>
                          <!--- <span>
                          <?=MODIFY?>
                          </span>--></td>
                        <td class="separator etext1"><?=ord_htmllink_jobcard($row['refid'], '''class="fbox"');?>
                          - <span>
                          <?=ord_htmllink_invproduct($row['itemno'], '''class="ctip fbox" ctip="ajax_thumb_inv_product.php?itemno='.$row['itemno'].'&formid='.$formid.'"')?>
                          </span></td>
                        <td width="200" align="right" class="separator etext2"><?=CHECKIN?>:
                          <?=datef($checkin_info['checkin_time'])?></td>
                        <td width="80" align="right" class="separator etext2"><a href="ord_engd_index.php?act=resume" onclick="return ConfirmSave('myform')" class="closebtn"><?=CLOSE?></a>
  <input type="hidden" name="godest" id="godest" />
  <input type="hidden" name="formdest" value="ord_engd_index.php?act=resume" /></td>
                      </tr>
                    </table></td>
                </tr>
                <tr>
                  <td valign="top" class="c2_bg"><!--main form--> 
                    
                    
                    
                    <div id="tabs" class="ui-tabs">
                      <ul>
                        <li><a href="#tabs-2">
                          <?=GENERAL?>
                          </a></li>
                        <li><a href="#tabs-4">
                          <?=DETAIL?>
                          </a></li>
                      </ul>
                      <div id="scontent">
                        <form action="ord_engd_modify.php" name="myform" id="myform" method="post" enctype="multipart/form-data">
                          <input type="hidden" name="action" value="ord_engd_modifyform" />
                          <div id="tabs-2">
                            <p> 
                            <table width="100%" border="0">
                            <tr>
                            <td class="tdvaligntop">
                                <table border="0" >
                                <tr><td><?=JOB_CARD?></td><td><?=generateJCBarcode($row['refid'])?></td></tr>
                                <tr><td colspan="2"><hr/></td></tr>
                                <tr><td><?=ORDER?><?=WS?><?=NUMBER?></td><td><?=$row['order_nbr']?></td></tr>
                                <tr><td><?=CUSTOMER?><?=WS?><?=NAME?></td><td><?=$row['custname_'.SYS_LANG]?></td></tr>
                                <tr><td><?=LAUNCH_DATE?></td><td><?=datef($row['launch_date'])?></td></tr>
                                <tr><td><?=DELIVERY?><?=WS?><?=DATE?></td><td><?=datef($row['del_date'])?></td></tr>
                                <tr><td><?=ITEMNO?></td><td><?=$row['itemno']?></td></tr>
                                <tr><td><?=QTY?></td><td><?=numf($row['qty'])?></td></tr>
                                <tr><td><?=FINGERSIZE?></td><td><?=$row['size']?></td></tr>
                                <tr><td><?=REMARKS?></td><td><?=$row['remark']?></td></tr>
                                <tr><td><?=STATUS?></td><td>
                            <?php if($status=="INVALID"){ ?>
                                <span class="ui-state-error xlfont"><?=$msg?></span>
                                <script>
                                $(document).ready(function() {
                                    alert('<?=$msg?>');
                                });
                                </script>    
                            <?php } else {
                                print 
$msg
                            }
?></td></tr>
                                </table>
                            </td>
                            <td class="tdvaligntop">                                
                                <table border="1" id="stamp_table">
                                <caption><?=CUSTOMER?><?=WS?><?=STAMP?>&nbsp;<a href="master_customer_stamp_modifyform.php?refid=<?=$row['cust_refid']?>" class="fboxs uibutton"><?=EDIT?></a>&nbsp;<a href="<?=basename($_SERVER['REQUEST_URI'])?>" class="uibutton"><?=REFRESH?></a></caption>
                                <tr><td class="tdvaligntop"><?=STAMP?></td><td><?php if($row['stamp_src']){?><?=showThumb($row300200'stamp_src''stamp_path')?><?php ?></td></tr>
                                <tr><td class="tdvaligntop"><?=STAMP?><?=WS?><?=REMARKS?></td><td><?=evl($row['stamp_remark'], '')?></td></tr>
                                </table></td>
                            </tr>
                            </table>
                            </p>
                          </div>
                          
                          <div id="tabs-4">
                            

                          </div>

                          <input type="hidden" name="last_status" value="<?=$row['status']?>" />
                          <input type="hidden" name="refid" value="<?=$refid?>" id="refid" />
                          <input type="hidden" name="edit" value="<?=$editable?>" id="edit" />
                        </form>
                      </div>
                      <!--end scontent-->

                    </div>
                    
                    
                    
                    <!-- end of mainform--></td>
                  <td valign="top"></td>
                </tr>
              </table><?php ?></td>
          </tr>
        </table></td>
    </tr>
  </table>
<!-- checkout form -->
<?php if($status=="OK" || $status=="RESUME"){ ?>
<div id="checkout-form" title="<?=CHECKOUT?>">
     <form action="ord_engd_checkout.php" method="post" enctype="multipart/form-data" onsubmit0="return confirmCheckout();">
     <input type="hidden" name="action" value="ord_engd_checkout" />
     <input type="hidden" name="refid" value="<?=$refid?>" />
     <input type="hidden" name="qty" value="<?=numf($row['qty'])?>" />
     <input type="hidden" name="route_refid" value="<?=$checkin_info['refid']?>" />
     <input type="hidden" name="txmain_refid" value="<?=$checkin_info['ordtxmain_refid']?>" />
    <table>
    <tr>
        <td><?=WORKER?><?=WS?><?=NAME?></td>
        <td><span id="sprytextfield2">
          <input type="text" name="worker" />
        </span></td>
    </tr>
    <tr>
        <td><?=TIME?></td>
        <td><span id="sprytextfield3">
          <input type="text" name="act_svc_duration" value="<?=numf($act_svc_duration)?>" class="positive minifield" />hr</span>          <input type="hidden" name="uom_duration" value="hr" class="microfield" readonly="readonly" /></td>
    </tr>    
    <tr>
        <td>&nbsp;</td>
        <td class="tdalignright"><input type="submit" value="<?=CHECKOUT?>" class="uibutton pressnhide2" /></td>
    </tr> 
       
    </table>
    </form>
</div>
<?php ?>


<?=""//vdump($row);?>
<!-- end of checkout form -->
<script type="text/javascript">
var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2");
var sprytextfield3 = new Spry.Widget.ValidationTextField("sprytextfield3");
</script>

</body>
</html>