/var/www/enzatesting.onesolution.hk/ord_setd_split_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
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
<?php 
$formid 
"Order";
require_once 
"inc/configure.php";

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

function 
setting_option($all_setting$default=""){
    
//return false;
    
$s '';
    foreach (
$all_setting as $i=>$setting){
        if(
$setting == $default){
            
$selected ' selected = "selected" ';
        }
        else{
            
$selected '';
        }
        
$s .= "<option value='$setting$selected >$setting - ".master::resolveOprName($setting)."</option>";
    }
    return 
$s;    
}

function 
stone_option($all_stone$default=""){
    
//vdump($all_stone);
    
$s '';
    foreach (
$all_stone as $i=>$stone){
        
$stone_itemno $stone['itemno'];
        
$opr_refid $stone['refid'];
        if(
$stone == $default){
            
$selected ' selected = "selected" ';
        }
        else{
            
$selected '';
        }
        
$s .= "<option value='$opr_refid' title='$stone_itemno$selected >$stone_itemno (".master::resolveOprName($stone['opr_code']).")</option>";
    }
    return 
$s;
}

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

if(
$barcode){
    
$refid = (int)parseJCBarcode($barcode);
    
//echo"BC";
}

if(
$refid){
    
$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.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
        
        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
        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);        
} else {
    
//header("Location: ord_fild_index.php");
    //exit;
}
//vdump($status);

if($status=="RESUME"){
    
//if JC is already checked-in, redirect to checkout page
    
header("Location: ord_fild_split_resumeform.php?refid=$refid");
    exit;        
}

//if JC is ready to checkin:
//calculate checkin weight and accessory to be fill
if($status=="OK"){    
     
$all_setting_option = array();
    
//get last checkout weight
    
$tx getLastTx($refid);  
    
$checkin_weight weightConv($tx['ttlwt'], $tx['uom_wt'], "gr");
    
    
//get items in SETO
    
$sql "SELECT
            dbo.ord_route.opr_code as parent_opr_code,
            dbo.ord_subroute.*
            FROM
            dbo.ord_dtl
            INNER JOIN dbo.ord_route ON dbo.ord_route.orddtl_refid = dbo.ord_dtl.refid
            INNER JOIN dbo.ord_subroute ON dbo.ord_subroute.ordroute_refid = dbo.ord_route.refid
            WHERE
            dbo.ord_dtl.refid = :refid AND
            dbo.ord_route.opr_code = 'SETO' AND
            dbo.ord_subroute.ordroute_refid = :route_refid"
;
    
$sth $dbh->prepare($sql);
    
$sth->execute( array(':refid' => $refid':route_refid' => $checkin_info['refid']) );
    while(
$r $sth->fetch()){
      
//vdump($r['itemno']);
      //store all setting method for user selection
      
if(in_array($r['opr_code'], $all_setting_option)===false){
        
$all_setting_option[] = $r['opr_code'];  
      }
      
      
//find the itemno in different BOM Cat
      
$bomcat getBomcategy($r['itemno']);
      if(
$bomcat){
          
//get BOM and inv_master details by itemno 
          
if($bomcat == "diamond"){
            
$sql2=  "SELECT
                    dbo.ord_item_bom.orddtl_refid,
                    dbo.ord_item_bom.qty,
                    dbo.ord_item_bom.uom_qty,
                    dbo.ord_item_bom.weight,
                    dbo.ord_item_bom.uom_wt,
                    dbo.ord_item_bom.actual_qty,
                    dbo.ord_item_bom.itemref,
                    dbo.ord_item_bom.itemno,
                    dbo.ord_item_bom.itemnoid,
                    dbo.ord_item_bom.bomcategy,
                    dbo.inv_diamond.name_en,
                    dbo.inv_diamond.name_sc
                    
                    FROM
                    dbo.ord_item_bom
                    INNER JOIN dbo.inv_diamond ON dbo.ord_item_bom.itemnoid = dbo.inv_diamond.refid
                    WHERE
                    dbo.ord_item_bom.orddtl_refid = :refid AND
                    dbo.ord_item_bom.bomcategy = 'diamond' AND
                    dbo.inv_diamond.itemno = :itemno"
;
          }elseif(
$bomcat =="stone"){
              
$sql2="SELECT
                    dbo.ord_item_bom.orddtl_refid,
                    dbo.ord_item_bom.qty,
                    dbo.ord_item_bom.uom_qty,
                    dbo.ord_item_bom.weight,
                    dbo.ord_item_bom.uom_wt,
                    dbo.ord_item_bom.actual_qty,
                    dbo.ord_item_bom.itemref,
                    dbo.ord_item_bom.itemno,
                    dbo.ord_item_bom.itemnoid,
                    dbo.ord_item_bom.bomcategy,
                    dbo.inv_stone.name_en,
                    dbo.inv_stone.name_sc
                    FROM
                    dbo.ord_item_bom
                    INNER JOIN dbo.inv_stone ON dbo.ord_item_bom.itemnoid = dbo.inv_stone.refid
                    WHERE
                    dbo.ord_item_bom.orddtl_refid = :refid AND
                    dbo.ord_item_bom.bomcategy = 'stone' AND
                    dbo.inv_stone.itemno = :itemno"
;              
              
          }else {
              
$sql2 ="";
          }
          
          if(
$sql2){
                  
              
$sth2 $dbh->prepare($sql2);
              
$q $sth2->execute( array(':refid' => $refid,
                                    
':itemno' => $r['itemno']) );
              
//echo $sth2->getSQL( array(':refid' => $refid, ':itemno' => $r['itemno']) );
              
pdo_showerror($sth2$q);
              if(
$fp $sth2->fetch()){
                  
//vdump($fp);
                  //convert actual weight to unit of gram
                  
$fp['act_wt'] = weightConv($fp['actual_qty'], $fp['uom_wt'], "gr");
                  
$fp['opr_code'] = $r['opr_code'];
                  
$fp['refid'] = $r['refid'];
                  
$set_part[] = $fp;
                  
//$checkin_weight += $fp['act_wt'];
              
}
          }
      }
    }
}
//vdump( $tx);
//$allowCheckout = ord_finishedPicking($refid);
?>
<!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/SpryValidationTextField.js" type="text/javascript"></script>
<link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
<script>
i = 0;
$(document).ready(function() {

    $( "#checkout-form" ).dialog({
        autoOpen: false,
        modal: true
    });
    $( "#checkout_trig" ).click(function() {
        $( "#checkout-form" ).dialog( "open" );
    });
    
    $(".focus").focus();
    
    //form check
    $('#checkinform').submit(function() {
        return checkform();
    });
/*      $('.sigPad').signaturePad({
          drawOnly:true,
          bgColour: '#EEE',
          lineColour: '#AAA',
          lineTop:500,
          output: '.sign'
      });
      
      var sign_display = $('.sign_display').signaturePad({displayOnly:true});
      
      $('#submit').click(function(){
          alert( $('.sign').val() );
          sign_display.regenerate( $('.sign').val() );
      });*/
      
    $(".add_stone_button").click(function(){
        //console.log($(this).closest(".stone_table").find("tbody>tr:hidden"));
        //clone hidden row
        var st_row = $(this).closest(".stone_table").find("tbody>tr:hidden").clone(true).show();        
        st_row.find("input").each(function() {
            var n = $(this).attr("name");
            //alert(i+' nam'+n);
            $(this).attr({
                'name': function(_, name) { 
                    return name.replace(/\d+/,i) 
                }       
            });
        });            
        st_row.find("select").each(function() {
            $(this).attr({
                'name': function(_, name) { 
                    return name.replace(/\d+/,i) 
                }       
            });
        });                    
        i++;
        //console.log($(this).closest(".stone_table").find("tbody>tr:last"));
        //st_row.insertAfter("#stone_table tbody>tr:last");
        st_row.insertAfter($(this).closest(".stone_table").find("tbody>tr:last"));
        rebind();
    });     
    
    //calculate totals
    //count_itemqty();
    //count_itemwt();
    
});    


function localbind(){
     
    $('.ci_wt').unbind("change, blur");
    $(".ci_wt").bind("change, blur", CalcSubtotal);
         
    $('.ci_qty').unbind("change, blur");
    $(".ci_qty").bind("change, blur", auto_fillwt);
    $(".ci_qty").bind("change, blur", count_itemqty);
    
    $('.ci_itemno').unbind("change, blur");
    $(".ci_itemno").bind("change, blur", count_itemqty);
    //$('.ci_itemno').unbind("change, blur");
    $(".ci_itemno").bind("change, blur", count_itemwt);    
        
    $('.ci2_wt_ct').unbind("change, blur");
    $(".ci2_wt_ct").bind("change, blur", count_itemwt);
    //$('.ci2_wt_ct').unbind("change, blur");
    $(".ci2_wt_ct").bind("change, blur", CalcSubtotal);    
        
    
    count_itemqty();
    count_itemwt();    

}

function confirmCheckin(){
    return confirm("Are you sure you want to checkin now?");
}

function CalcSubtotal(){
    //console.log('CalcSubtotal');
    var row = $(this).parent().parent(); //tr>td>input
    var qty = parseFloat( row.find(".ci_wt").val()) || 0; // ||0 handles NaN as zero
    var unitprice = parseFloat( row.find(".ci2_wt_ct").val())/5;
    row.find(".ci2_wt").val(unitprice.toFixed(3));

    var subtotal = (qty+unitprice);
    row.find(".subttl_wt").val(subtotal.toFixed(3));
    CalculateGrandtotal();
}

function CalculateGrandtotal(){    
    var gt=new Number(0); 
    $( ".subttl_wt" ).each( function() {        
        var num = new Number($(this).val());
        gt = gt + num;
    } );
    $( ".ci_wt" ).each( function() {        
        var num = new Number($(this).val());
        gt = gt + num;
    } );    
    $("#checkin_wt").val(gt.toFixed(3));


function count_itemqty(){
    //console.log('count_itemqty');
    var ttl_qty = new Object();
        
    $( ".ci_qty" ).each( function() {
        //console.log(  parseFloat( $(this).attr("value")) );        
        var updated_itemno = $(this).closest("tr").find("select.ci_itemno option:selected").prop("title");
        if( isNaN(ttl_qty[updated_itemno]) ){
            ttl_qty[updated_itemno] = parseFloat( $(this).val());
        }else{
            ttl_qty[updated_itemno] += parseFloat( $(this).val());
        }
        
    } );    
    //show result
    $(".itemqty").val(0);
    for(var key in ttl_qty){
        //content += key+' : '+ttl_qty[key]+'\n';
        //var inputid= 'qty'+key;
        $("#qty_"+key).val(ttl_qty[key]);
    }
}

function count_itemwt(){
    //console.log('count_itemwt');
    var ttl_wt = new Object();
        
    $( ".ci2_wt_ct" ).each( function() {
        //console.log(  parseFloat( $(this).attr("value")) );        
        var updated_itemno = $(this).closest("tr").find("select.ci_itemno option:selected").prop("title");
        if( isNaN(ttl_wt[updated_itemno]) ){
            ttl_wt[updated_itemno] = parseFloat( $(this).val());
        }else{
            ttl_wt[updated_itemno] += parseFloat( $(this).val());
        }
        
    } );    
    //show result
    $(".itemwt").val(0);
    for(var key in ttl_wt){
        //content += key+' : '+ttl_qty[key]+'\n';
        //var inputid= 'qty'+key;
        $("#wt_"+key).val(ttl_wt[key]);
    }
    //console.log(ttl_wt);
}

function auto_fillwt(){
    var qty = parseFloat($(this).val()); 
    
    var row = $(this).closest("tr");
    var itemno = row.find("select.ci_itemno option:selected").prop("title");
    var stone_wt =  parseFloat(row.find("input.ci2_wt_ct").val()) || 0; 
    //console.log(itemno, qty, stone_wt );
    if( true || stone_wt==0 ){
        itemweight = parseFloat($("#stonewt_"+itemno).val()) * qty;
        //console.log( $("#stonewt_"+itemno).val() );
        row.find("input.ci2_wt_ct").val( itemweight.toFixed(3) );
        //trigger event
        row.find("input.ci2_wt_ct").change();
        row.find("input.ci2_wt_ct").blur();
    }
}

function checkform(){
    var valid = true;
    $( "input.stoneqty" ).each( function() {
        //compare with itemqty
        var row = $(this).closest("tr");
        //console.log( row );        
        var exp_qty = parseFloat( $(this).val() );        
        var input_qty = parseFloat( row.find("input.itemqty").val() );        
        if(input_qty>exp_qty){
            valid = false;
            //console.log( exp_qty, input_qty );        
        }
    } );    
    
    if(valid==false){
        alert("<?=INVALID?><?=WS?><?=QTY?>");    
    }
    
    return valid;
}
</script>
</head>
<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_setd_index.php" name="myform" id="myform" 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($row) { ?> 
            <form action="ord_setd_split_checkin.php" name="checkinform" id="checkinform" method="post" enctype="multipart/form-data">
                          <input type="hidden" name="action" value="ord_setd_split_checkin" />   
            <?php //if(!empty($row)){ ?><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>
<?php if($status=="OK") { ?> 
                        <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'])?>?barcode=<?=$barcode?>"><img src="image/icon_undo.jpg" width="20" height="20" /></a></td>
<?php ?>                         

                        <!--<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>-->

                        <!--<td width="20" class="separator"><a href="dgn_drawing_print.php?refid=<?=$row['refid']?>" target="_new"><?=PRINT_?></a></td>-->
                        <td class="separator stext1"><?=SETD?>
                          - <span>
                          <?=CHECKIN?>
                          </span></td>
                        <td class="separator etext1"><?=generateJCBarcode($row['refid'])?>
                          - <span>
                          <?=$row['itemno']?>
                          </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_setd_index.php?act=resume" onclick="return ConfirmClose()"><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"><!--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">
                        
                          <div id="tabs-2">
                            <table width="100%" border="0">
                              <tr>
                                <td><?=DATE?><?=date("Y-m-d")?></td>
                                <td><?=STATUS?>
                            <?php if($status=="INVALID"){ ?>
                                <span class="ui-state-error xlfont"><?=$msg?></span>
                                <script>
                                $(document).ready(function() {
                                    alert('<?=$msg?>');
                                });
                                </script>    
                            <?php } else {
                                print 
$msg
                            }
?>
                            </td>
                                <td><?=LAST?><?=WS?><?=CHECKOUT?><?=WS?><?=WEIGHT?>: <input type="text" name="checkin_wt_ref" value="<?=qtyf($checkin_weight)?>" class="shortfield positive" readonly="readonly" />gr</td>
                                <td>&nbsp;</td>
                              </tr>
                              <tr>
                                <td colspan="4">&nbsp;</td>
                              </tr>
                              <tr>
                                <td><?=ORDER?><?=WS?><?=NUMBER?></td>
                                <td><?=ITEMNO?></td>
                                <td><?=QTY?></td>
                                <td>&nbsp;</td>
                              </tr>
                              <tr>
                                <td><?=$row['order_nbr']?></td>
                                <td><a href="#" class="ctip" name="product[itemno]" id="product[itemno]" ctip="ajax_thumb_inv_product.php?itemno=<?=$row['itemno']?>&formid=<?=$formid?>"><?=$row['itemno']?></a></td>
                                <td><?=numf($row['qty'])?></td>
                                <td>&nbsp;</td>
                              </tr>
                              <tr>
                                <td colspan="4">&nbsp;</td>
                              </tr>
                              
                                                            
                              <tr>
                                <td colspan="4">
                                <table border="1">        
         <tr>
            <th><?=MOLDNO?></th>
            <th><?=DETAIL?></th>
        </tr><?php
        
//get more data from database
        
$sql="SELECT
                dbo.dgn_master_submold.mold_subno,
                dbo.dgn_master_submold.img_src,
                dbo.dgn_master_submold.img_path            
                FROM
                dbo.ord_dtl
                INNER JOIN dbo.inv_product ON dbo.ord_dtl.product_refid = dbo.inv_product.refid
                INNER JOIN dbo.dgn_master_mold ON dbo.inv_product.mold_refid = dbo.dgn_master_mold.refid
                INNER JOIN dbo.dgn_master_submold ON dbo.dgn_master_submold.mold_refid = dbo.dgn_master_mold.refid
                WHERE
                dbo.ord_dtl.refid = :refid
                "
;
        
$sth_opr $dbh->prepare($sql);
        
$sth_opr->execute(  array(':refid' => $refid) );
        
//echo $sth_opr->getSQL(  array(':refid' => $refid) );
        
$mnum=0;
        
$i=0;
        while(
$mold=$sth_opr->fetch()){
            
$mnum++;
            
$i++;
/*            if($mold['match']){
                $isnew = "1";
            }else{
                $isnew = "0";
            }*/
?> 
        <tr>
            <td valign="top"><?=$mold['mold_subno']?><input type="hidden" name="submold[<?=$mnum?>][moldno_main]" value="<?=$mold['mold_subno']?>" readonly="readonly" class="shortfield" /><input type="hidden" name="submold[<?=$mnum?>][isnew]" value="<?=$isnew?>" readonly="readonly" />
            <br/><?=showThumb($mold)?></td>
            <td valign="top">
                <table border="1" class="stone_table" width="820px">
                <tr>
                    <th><?=ITEMNO?> <a class="uibutton add_stone_button">+</a></th>
                    <th><?=QTY?></th>
                    <!--<th><?=CAST?><?=WS?><?=WEIGHT?><br/>(gr)</th>-->
                    <th><?=STONE?><?=WS?><?=WEIGHT?><br/>(ct)</th>
                    <th><?=STONE?><?=WS?><?=WEIGHT?><br/>(gr)</th>
                    <th><?=TOTAL?><?=WS?><?=WEIGHT?><br/>(gr)</th>
                    <th><?=CHECKIN?></th>
                    <!--<th><?=SETTING?></th>-->
                    <!--<th><?=WORKER?></th>
                    <th></th>-->
                    <th width="45px"><?=EDIT?></th>
                    </tr>
            <?php if(!empty($set_part)){ ?>
                <tr style="display:none">      
                    <td><select name="submold[0][ordsubroute_refid]" class="ci_itemno"><?=stone_option($set_part)?></select></td>
                    <td><input type="text" name="submold[0][qty]" value="0" class="positive minifield ci_qty" /></td>
                    <!--<td>&nbsp;</td>-->
                    <td><input type="text" name="submold[0][checkinstone_wt_ct]" value="0" class="positive minifield ci2_wt_ct" />ct</td>
                    <td><input type="text" name="submold[0][checkinstone_wt]" value="0" class="positive minifield ci2_wt" readonly="readonly" />gr</td>
                    <td><input type="text" name="submold[0][ttl_wt]" value="0" class="positive minifield subttl_wt" readonly="readonly" />gr</td>
                    <td align="center"><input type="checkbox" name="submold[0][checkinbox]" checked="checked" class="checkinbox"/></td>
                    <!--<td><select name="submold[0][setting]"><?=setting_option($all_setting_option)?></select></td>-->
                    <!--<td>&nbsp;</td>
                    <td>&nbsp;</td>-->
                    <td><input type="hidden" name="submold[0][moldno]" value="<?=$mold['mold_subno']?>" /><a href="#" class="deleteRowButton uibutton"><?=X?></a></td>
                </tr>   
           <?php ?>
          
                </table>
                <table width="500px">
                <tr>
                <th><?=CAST?><?=WS?><?=WEIGHT?>:</th>
                <td><input type="text" name="mold[<?=$mold['mold_subno']?>][castwt]" value="" class="ci_wt positive shortfield" />gr</td>
                <th><?=WORKER?>:</th>
                <td>
                    <!--<input type="text" name="mold[<?=$mold['mold_subno']?>][worker]" value="" class="shortfield" />-->
                    <?=input_masterWorkerBarcode('name="mold['.$mold['mold_subno'].'][worker]" class="shortfield"'$mold['mold_subno'], ''false)?>
                </td>
                <!--<th><?=SIGNATURE?>:</th>
                    <td>
                    <input type="text" name="mold[<?=$mold['mold_subno']?>][signature]" value="" class="" />
                    
                    </td>-->
                </tr>
                </table>
            </td>
        </tr> <?php ?></table><?=CHECKIN?><?=WS?><?=WEIGHT?>: <input type="text" name="checkin_wt" id="checkin_wt" value="0" class="shortfield positive" readonly="readonly" />gr
                              </td>
                              </tr>
                             

                              <tr>
                                <td colspan="4"><!--signature-->&nbsp;
                                </td>
                              </tr>    
                                <tr>
                                <td colspan="4">                                
                                <?php if($set_part){ ?>
                                <table id="pickingtable" border="1"><caption class="xlfont0"><b><?=STONE?> / <?=DIAMOND?></b></caption>
                                <tr>
                                    <th><?=ITEMNO?></th>
                                    <th><?=NAME?></th>
                                    <th><?=QTY?></th>
                                    <th><?=WEIGHT?> (ct/pcs)</th>
                                    <th><?=PICKING?><?=WS?><?=WEIGHT?> (ct)</th>
                                    <th><?=PICKING?><?=WS?><?=WEIGHT?> (gr)</th>
                                    <th><?=SETTING?></th>
                                    <th><?=TOTAL?><?=WS?><?=QTY?></th>
                                    <th><?=TOTAL?><?=WS?><?=WEIGHT?> (ct)</th>
                                </tr>        
                                        <?php foreach ($set_part as $p){ ?>

                                <tr>
                                    <td><?=$p['itemno']?></td>
                                    <td><?=$p['name_'.SYS_LANG]?></td>
                                    <td align="center"><?=numf($p['qty']*$row['qty'])?><?=$p['uom_qty']?><input type="hidden" value="<?=$p['qty']*$row['qty']?>" id="stoneqty_<?=$p['itemno']?>" class="positive shortfield stoneqty" readonly="readonly"/></td>
                                    <td align="center"><?=qtyf($p['actual_qty']/($p['qty']*$row['qty']))?>ct<input type="hidden" value="<?=$p['actual_qty']/($p['qty']*$row['qty'])?>" id="stonewt_<?=$p['itemno']?>" class="positive shortfield stonewt" readonly="readonly"/></td>                                    
                                    <td align="center"><?=qtyf($p['actual_qty'])?>ct</td> 
                                    <td align="center"><?=qtyf($p['act_wt'])?>gr</td>    
                                    <td><?=master::resolveOprName($p['opr_code'])?></td>   
                                    <td><input type="text" value="0" id="qty_<?=$p['itemno']?>" class="positive shortfield itemqty" readonly="readonly"/></td>                                    
                                    <td><input type="text" value="0" id="wt_<?=$p['itemno']?>" class="positive shortfield itemwt" readonly="readonly"/>ct</td>                                    
                                </tr>
                                    <?php ?>
                                </table>    
                                <?php ?>
                                </td>
                              </tr>                                                        
                            </table>
                            <?php if(ord_finishedPickingExceptNonmetalAccessory($refid)===false){ ?>
                                <span class="ui-state-error xlfont"><?=WARNING?><?=PICKING?><?=WS?><?=IS_NOT_FINISHED?></span>
                                <script>
                                $(document).ready(function() {
                                    alert('<?=WARNING?><?=PICKING?><?=WS?><?=IS_NOT_FINISHED?>');
                                });
                                </script>    
                            <?php ?>
                          </div>
                          
                          <div id="tabs-4">
                            <p>
</p></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" />
                        
                      </div>
                      <!--end scontent-->

                    </div>
                    
                    
                    
                    <!-- end of mainform--></td>
                  <td valign="top"></td>
                </tr>
              </table>
              <?php //} ?>
              </form>
              
              <?php ?></td>
          </tr>
        </table></td>
    </tr>
  </table>
<script>var i = Number(<?=$i?>)+1;</script>  
</body>
</html>