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

$row=null;
?>
<!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/SpryValidationSelect.js" type="text/javascript"></script>
<script>

$('html').hide(); //prevent flash of unstyled conetent
$(document).ready(function() {
    $('html').show();
    //refreshtab6();
    //refreshROUTE();
    $( "#launch_date" ).datepicker({
        dateFormat: "yy-mm-dd",
        defaultDate: "<?=date("Y-m-d")?>"
    });
                
    $( "#del_date" ).datepicker({
        dateFormat: "yy-mm-dd",
        defaultDate: "<?=$row['del_date']?>"
    });
    
    $( "#confirm_date" ).datepicker({
        dateFormat: "yy-mm-dd",
        defaultDate: "<?=$row['confirm_date']?>"
    });
            
    $( "#dialog-form" ).dialog({
        autoOpen: false,
        height: 340,
        width: 400,
        modal: true,
        buttons: {
            "<?=ADD?>": function() {
                var bValid = $('#dialog_refid option:selected').val()!="";
                //console.log(bValid);
                if ( bValid ) {                    
                    var formdata = parseform()
                    addProduct( formdata  );

                    rebind();
                    $( this ).dialog( "close" );
                }
                
            },
            "<?=CANCEL?>": function() {
                $( this ).dialog( "close" );
            }
        },
        close: function() {
            //clear dialog
            $("#dialog_refid").children().first().attr('selected', 'selected'); //pick first selection
            //empty form input
            $("#newprod_form :input:not(#custcodesel)").val('');
        }
    });
    
    $(".submitform").on("click", function(e) {
         $( "#tabs" ).tabs('select', 0);  //goto first tab
    });    
    
    $( "#add_product_button" ).click(function() {
        $( "#dialog-form" ).dialog( "open" );
    });
    
    
    $( "#dialog_refid" ).change(function() {
        var product_refid = $('#dialog_refid').val();
        
        $.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     }); 
        
        $.get("ajax_rpr_order_option.php",{  
                  formid: "<?=$formid?>",
                  custcode: $('#custcode').val(),
                  product_refid: product_refid
              },
              function(data){
                 // alert(data);
                  $('#dialog_serial').html(data);
        });  
        

        //show item detail 
        $.getJSON("ajax_json_product_detail.php",{
            formid: "Product",
            refid: product_refid,
            format: "json"
        },
          function(data)
        {
            $("#dialog_qty").val('1');            
            $("#dialog_name").val(data.itemname);
            $("#dialog_itemno").val(data.itemno);
            $("#dialog_desc").val(data.name_<?=SYS_LANG?>);
            $("#dialog_product_refid").val(data.refid);
        });
        $.unblockUI();
    });
    
    $( "#dialog_serial" ).change(function() {
        $.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($("#dialog_refid").val());
        //show item of detail 
        $.getJSON("ajax_json_productsn_detail.php",{
            formid: "<?=$formid?>",
            refid: $("#dialog_serial").val(),
            format: "json"
        },
          function(data)
        {
            //alert(data.itemno);
            // copy data to dialog
/*            if(typeof(data.sellingprice) !== 'undefined' && data.sellingprice != null) {
                //alert('weight='+data.weight+''+data.uom_wt);
                $("#dialog_sellingprice").val(data.sellingprice);
            }
            else{
                $("#dialog_sellingprice").val('0.00');
            }*/
            
            if(typeof(data.txqty) !== 'undefined' && data.txqty != null) {
                $("#dialog_qty").val(data.txqty);
            }
            else{
                $("#dialog_qty").val(1);
            }
            
            $("#dialog_weight").val(data.product_wt);
/*            $("#dialog_name").val(data.itemname);
            $("#dialog_itemno").val(data.itemno);*/
            $("#dialog_size").val(data.size);
/*            $("#dialog_desc").val(data.name_<?=SYS_LANG?>);
            
            if(typeof(data.unitcost) !== 'undefined' && data.unitcost != null) {
                //alert('weight='+data.weight+''+data.uom_wt);
                $("#dialog_unitcost").val(data.unitcost);
            }
            else{
                $("#dialog_unitcost").val('0.00');
            }
                
            $('#new_enable').val(data.readyOrder); */
    
            $('#new_enable').val(data.readyOrder);
            if(data.readyOrder != 1){ //disable add function          
  
              setTimeout( //wait unblockui
                function() 
                {
                  alert(data.msg_out);
                }, 500);
            }
                
            $.unblockUI();
        });
    });    

        
    $( "#dialog_refid" ).combobox();
    //$( "#dialog_refid" ).show();
    
    $( "#custcode" ).change(function() {
        $( "#custcodesel" ).val( $( "#custcode" ).val() );
        $( "#custcodesel" ).change();            
        $( "#uom_cy" ).val( $(this).find("option:selected").data("uom_cy") );
    });
        
    $( "#custcodesel" ).change(function() {
        $.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("ajax_inv_product_option.php",{  
                  formid: "<?=$formid?>",
                  custcode: $('#custcodesel').val()
              },
              function(data){
                 // alert(data);
                  $('#dialog_refid').html(data);
        });  
        $.unblockUI();
    });
    $( "#custcode" ).change();    
    
    $( "#updateall" ).change(function() {

        //apply to all checkbox
        if($("#updateall").attr('checked')){
            $('.update').attr('checked', true);
        }
        else{
            $('.update').attr('checked', false);
        }

    });
});    

function updatePrices(){}
function refreshtab6(){}
function refreshROUTE(){}

function CalcSubtotal()
{
    //var row = $(this).parents('tr');
    var row = $(this).parent().parent(); //tr>td>input
    var qty = parseFloat( row.find(".qty").val());
    
    var unitprice = parseFloat( row.find(".price").val());
    var subtotal = round2d(qty*unitprice);
    row.find(".subtotal").val(subtotal);

    CalculateGrandtotal();
}

function CalculateGrandtotal(){    
    var gt=new Number(0);
    var discount = $("#discount").val();
 
    $( ".subtotal" ).each( function() {
        
        var num = new Number($(this).val());
        gt = gt + num;
    } );
    gt = discountPrice(gt, discount);
    $("#totalprice").val(gt.toFixed(2));
    
    //alert(gt.toFixed(2));
    updatePrices();



function updateEntry(){
    //var rowCount = $('#bom_table tr').length;    
    
    //ent++;

    //alert(rowCount);
}

function addProduct(data){ //copy default row

    var product_table = $("#product_table >tbody >tr").length;
    //copy hidden row template
    //var mt_row = $("#product_table tbody>tr:nth-child(2)").clone(true).show();
    var mt_row = $("#product_table tr.itemrow").first().clone(true).show();
    
    mt_row.find("a, input, textarea, span").each(function() {
        var n = $(this).attr("name");
        //alert(ent+' nam'+n);
        if(typeof(n) !== 'undefined'){
            $(this).attr({
                'name': function(_, name) { 
                    return name.replace(/\d+/,ent) 
                }          
            });
        }
        
        var n = $(this).attr("id");
        //alert(ent+' nam'+n);
        if(typeof(n) !== 'undefined'){
            $(this).attr({
                'id': function(_, id) { 
                    return id.replace(/\d+/,ent) 
                }          
            });
        }        
    });
    
    mt_row.find("select").each(function() {
        $(this).children().first().attr('selected', 'selected'); //pick first selection
        var n = $(this).attr("name");
        //alert(ent+' nam'+n);
        if(typeof(n) !== 'undefined'){
            $(this).attr({
                'name': function(_, name) { 
                    return name.replace(/\d+/,ent) 
                }          
            });
        }
    });
    $('#product_table tr:last').after(mt_row);

$("a[name='product["+ent+"][itemno]']").html(data.itemno);
$("a[name='product["+ent+"][itemno]']").attr("href", "inv_product_modifyform.php?refid="+data.refid);
$("a[name='product["+ent+"][itemno]']").attr("ctip", "ajax_thumb_inv_product.php?refid="+data.refid+"&formid=<?=$formid?>");
$("a[name='product["+ent+"][itemname]']").html(data.name);
$("a[name='product["+ent+"][desc]']").html(data.desc);

$("input[name='product["+ent+"][prevordtxpako_refid]']").val(data.prevordtxpako_refid);
$("input[name='product["+ent+"][product_refid]']").val(data.refid);
$("input[name='product["+ent+"][unitprice]']").val(parseFloat(data.sellingprice)||0);
$("input[name='product["+ent+"][qty]']").val(data.qty);
$("input[name='product["+ent+"][orig_wt]']").val(parseFloat(data.weight)||0);
//$("input[name='product["+ent+"][remainqty]']").val(data.qty);
$("input[name='product["+ent+"][size]']").val(data.size);
$("input[name='product["+ent+"][unitcost]']").val(parseFloat(data.unitcost)||0);
$("input[name='product["+ent+"][amount]']").val(parseFloat(data.sellingprice*data.qty)||0);
//$("input[name='product["+ent+"][margin]']").val(data.margin);
$("input[name='product["+ent+"][remark]']").val(data.remark);
//$("input[name='product["+ent+"][product_refid]']").val(data.refid);

    
    ent++;  //alert(ent);
    tableAltCss();
}

function parseform(){

    formDataFirst = $("#newprod_form").toObject({mode: 'first'});
    //$('#testArea').html(JSON.stringify(formDataFirst, null, '\t'));
    //alert(formDataFirst);
    return formDataFirst;

}

function localbind(){
    //calculate prices
    $('.qty, .price').unbind("change, blur");
    $('.qty, .price').bind("change, blur", CalcSubtotal);
    
    $('#discount').unbind("change, blur");
    $('#discount').bind("change, blur", CalculateGrandtotal);
    
}



function calcMargin(price, cost){
    //return (price-cost)*100/price;    
    return price/cost;    
}


</script>
<style>
    .ui-autocomplete {
        max-height: 200px;
        overflow-y: auto;
        /* prevent horizontal scrollbar */
        overflow-x: hidden;
        /* add padding to account for vertical scrollbar */
        padding-right: 20px;
    }
    /* IE 6 doesn't support max-height
     * we use height instead, but this forces the menu to always be this tall
     */
    * html .ui-autocomplete {
        height: 200px;
    }
    </style>
<link href="SpryAssets/SpryValidationSelect.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form action="ord_rpr_dtl_add.php" name="myform" id="myform" method="post" enctype="multipart/form-data">
  <input type="hidden" name="action" value="ord_rpr_addform" />
  <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="submitform 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 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="#" id="download_trig"><span class="ui-icon0 ui-icon-circle-triangle-s" ></span>
                          <?=FILES?>
                          </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"><?=REPAIR_ORDER?>
                          - <span>
                          <?=ADD?>
                          </span></td>
                        <td class="separator etext1"><?=$row['custcode']?>
                          - <span>
                          <?=$row['order_nbr']?>
                          </span></td>
                        <td width="200" align="right" class="separator etext2"><?=LAST_MODIFY?>:
                          <?=lastUpdate($row)?></td>
                        <td width="80" align="right" class="separator etext2"><a href="ord_rpr_dtl_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_rpr_dtl_index.php?act=resume" /></td>
                      </tr>
                    </table></td>
                </tr>
                <tr>
                  <td valign="top" class="c2_bg"><!--main form--> 
                    
                    <!--editable-->
                    
                    <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">
                          <p>
                          <table>
                            <tr>
                              <td ><?=CUSTOMER?></td>
                              <td ><span id="spryselect1">
                                <select name="custcode" id="custcode">
                                  <option value=""></option>
                                  <?=customer_option($row['custcode'], truefalse'uom_cy')?>
                                </select>
                              <span class="selectRequiredMsg">Please select a Customer.</span></span></td>
                            </tr>
                            <tr>
                              <td ><?=CURRENCY?></td>
                              <td ><input name="uom_cy" type="text" id="uom_cy" value="<?=$row['uom_cy']?>" readonly="readonly"></td>
                            </tr>
                            <tr>
                              <td ><?=ORDER.WS.NUMBER?></td>
                              <td ><input name="order_nbr" value="<?=$row['order_nbr']?>" readonly="readonly" /></td>
                            </tr>
                            <tr>
                              <td ><?=VENDOR?></td>
                              <td ><select name="vendor" id="vendor">
                                  <option value=""></option>
                                  <?=master_option("COMPANY"$_SESSION['defaultcompany'], true)?>
                                </select></td>
                            </tr>
                            <tr>
                              <td ><?=LAUNCH_DATE?></td>
                              <td ><input name="launch_date" id="launch_date" value="<?=date("Y-m-d")?>" readonly="readonly" /></td>
                            </tr>
                            <tr>
                              <td ><?=CUSTOMER.WS.ORDER.WS.REFERENCE?></td>
                              <td ><input name="custorder_ref" value="<?=$row['custorder_ref']?>" /></td>
                            </tr>
                            <tr>
                              <td ><?=PAYMETHOD?></td>
                              <td ><select name="paymethod" id="paymethod">
                                  <option value=""></option>
                                  <?=master_option("PAYMETHOD"$row['paymethod'], true)?>
                                </select></td>
                            </tr>
                            
                            <tr>
                              <td colspan="2">&nbsp;</td>
                            </tr>
                            <tr>
                              <td ><?=STATUS?></td>
                              <td ><select name="status" id="status">
                                  <option value=""></option>
                                  <?=master_option("ORDER_STATUS""NEW"true)?>
                                </select></td>
                            </tr>
                            <tr>
                              <td ><?=DELIVERY.WS.DATE?></td>
                              <td ><input name="del_date" value="<?=$row['del_date']?>" id="del_date" /></td>
                            </tr>
                            <tr>
                              <td ><?=CONFIRM.WS.DATE?></td>
                              <td ><input name="confirm_date" id="confirm_date" value="<?=$row['confirm_date']?>" /></td>
                            </tr>
                            <tr>
                              <td ><?=REMARKS?></td>
                              <td ><textarea name="remark" cols="40" rows="5"><?=$row['remark']?></textarea></td>
                            </tr>
                            
                          </table>
                          </p>
                        </div>
                        <div id="tabs-4">
                          <p> <a id="add_product_button" class="mod_menu uibutton">+
                            <?=ADD.WS.REPAIR.WS.PRODUCT?>
                            </a>
                          <table width="100%" id="product_table" border="0" cellpadding="0" cellspacing="0" class="tablelist">
                            <tr>
                              <th><?=ITEMNO?></th>
                              <th width="150px"><?=DESC?></th>
                              
                              <th><?=SIZE?></th>
                              <th><?=WEIGHT?></th>

                              <th><?=QTY?></th>
<?php if(havePermission("DPr")){ //DP-------------------------------?>
                              <th><?=REPAIR.WS.PRICE?></th>
                              <th><?=AMOUNT?></th>
<?php //end of DP-------------------------------------------------?>
                              <th><?=REMARKS?></th>                           
                              <th><?=DELETE?></th>
                            </tr>
                            
                            <!-- Product row template-->
                            <?php $i="0";?>
                            <tr class="itemrow" style="display:none;">
                              <td class="code"><a href="inv_product_modifyform.php?refid=<?=$row1['product_refid']?>" class="fbox ctip" name="product[<?=$i?>][itemno]" id="product[<?=$i?>][itemno]" ctip="ajax_thumb_inv_product.php?refid=<?=$row1['refid']?>&formid=<?=$formid?>"><?=$row1['itemno']?>-</a>
                                <input type="hidden" name="product[<?=$i?>][product_refid]" value="<?=$row1['product_refid']?>" />
                                <input name="product[<?=$i?>][refid]" value="<?=$row1['refid']?>" type="hidden" />
                                <input name="product[<?=$i?>][prevordtxpako_refid]" value="<?=$row1['prevordtxpako_refid']?>" type="hidden" /></td>
                              <td><a name="product[<?=$i?>][desc]" id="product[<?=$i?>][desc]" ><?=$row1['name_'.SYS_LANG]?>&nbsp;</a></td>
                              <td><input type="text" name="product[<?=$i?>][size]" value="<?=$row1['size']?>" class="minifield" /></td>
                              <td><input type="text" name="product[<?=$i?>][orig_wt]" value="<?=$row1['orig_wt']?>" class="minifield positive" />gr</td>
                              
                              <td><input type="text" name="product[<?=$i?>][qty]" value="<?=numf($row1['qty'])?>" class="minifield positive qty" /></td>
                              
                             
                              <?php if(havePermission("DPr")){ //DP-------------------------------?>
                              <td><input type="text" name="product[<?=$i?>][unitprice]" value="<?=numf($row1['unitprice'])?>" class="minifield positive price" /></td>
                              <td><input type="text" name="product[<?=$i?>][amount]" value="<?=numf($row1['unitprice']*$row1['qty'])?>" class="minifield positive subtotal" readonly="readonly" /></td>
                              <?php //end of DP-------------------------------------------------?>
                              
                            
                              <td><input type="text" name="product[<?=$i?>][remark]" value="<?=$row1['remark']?>" /></td>
                  
                              <td><a href="#" class="deleteRowButton uibutton">
                                <?=X?>
                                </a></td>
                            </tr>

                          </table>
                          <div align="left"><table>
                         
<?php if(havePermission("DPr")){ //DP-------------------------------?>                          <tr>
                              <td ><?=DISCOUNT.WS.COEF?></td>
                             <td ><input name="discount" id="discount" value="<?=empty($row['discount'])?'1.00':numf($row['discount'] ,3)?>" class="positive shortfield" /></td>
                          </tr>
                          <tr>
                              <td><?=TOTAL?>:</td>
                            <td><input type="text" name="totalprice" id="totalprice" class="shortfield" readonly="readonly" /></td>
                          </tr>
<?php //end of DP------------------------------------------------------?>                          
                          </table>
                          </div>
                          </p>
                        </div>
                      </div>
                      <!--end scontent-->
                      <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 of readonly--> 
                    
                    <!-- end of mainform--></td>
                  <td valign="top"></td>
                </tr>
              </table></td>
          </tr>
        </table></td>
    </tr>
  </table>
</form>
<div id="dialog-form" title="<?=ADD.WS.PRODUCT?>">
  <form name="dialog-form" id="newprod_form">
    <table>
      <tr>
        <td><?=ITEMNO?></td>
        <td id="dialog_itemno_td" class="white_smooth"><select name="refid" id="dialog_refid" class2="ui-widget-content ui-corner-all" style="width:150px" >
            <option value="">Loading...</option>
            <?=""//inv_product_option($row['custcode'], "", true)?>
          </select></td>
      </tr>
      
      <tr>
        <td><?=ORDER.WS.NUMBER?></td>
        <td id="dialog_serial_td" class="white_smooth"><select name="prevordtxpako_refid" id="dialog_serial" class2="ui-widget-content ui-corner-all" style="width:220px" >
            <option value=""></option>
          </select></td>
      </tr>     
      
      <tr>
        <td><?=QTY?></td>
        <td id="dialog_qty_td"><input type="text" name="qty" id="dialog_qty" class="text ui-widget-content ui-corner-all positive"  style="width:60px" />
          <span name="dialog_uom_qty" id="dialog_uom_qty"></span></td>
      </tr>
      <tr>
        <td><?=SIZE?></td>
        <td id="dialog_size_td"><input type="text" name="size" id="dialog_size" class="text ui-widget-content ui-corner-all"  style="width:60px" />
          <span name="dialog_uom_qty" id="dialog_uom_qty"></span>
        </td>
      </tr>
      <tr>
        <td><?=WEIGHT?></td>
        <td id="dialog_weight_td"><input type="text" name="weight" id="dialog_weight" class="text ui-widget-content ui-corner-all positive"  style="width:60px" />
          <span name="dialog_uom_wt" id="dialog_uom_wt">gr</span></td>
      </tr>      
      <?php if(havePermission("DPr")){ //DP-------------------------------?>
      <tr>
        <td><?=REPAIR.WS.PRICE?></td>
        <td id="dialog_price_td"><input type="text" name="sellingprice" id="dialog_sellingprice" class="text ui-widget-content ui-corner-all positive" style="width:60px" />
      </td></tr>
      <?php //end of DP------------------------------------------------------?>
      <tr>
        <td><?=REMARKS?></td>
        <td id="dialog_remark_td"><input type="text" name="remark" id="dialog_remark" class="text ui-widget-content ui-corner-all"  style="width:200px" />  
          <!--<textarea name="dialog_remark" id="dialog_remark" class="text ui-widget-content ui-corner-all" cols="30" rows="3"></textarea>--></td>
      </tr>
    </table>
        <input type="hidden" name="custcodesel" id="custcodesel" readonly="readonly" />
        <input type="hidden" name="name" id="dialog_name" class="text ui-widget-content ui-corner-all"  style="width:60px" />
          <input type="hidden" name="desc" id="dialog_desc" class="text ui-widget-content ui-corner-all"  style="width:60px" />
          <input type="hidden" name="itemno" id="dialog_itemno" class="text ui-widget-content ui-corner-all"  style="width:60px" />
          <input type="hidden" name="enable" id="new_enable" readonly="readonly" />
          <?php if(havePermission("DCr")){ //DC-------------------------------?>
          <input type="hidden" name="unitcost" id="dialog_unitcost" class="text ui-widget-content ui-corner-all"  style="width:60px" />
          <input type="hidden" name="factorycost" id="dialog_factorycost" class="text ui-widget-content ui-corner-all"  style="width:60px" />
          <?php //end of DC------------------------------------------------------?>
    <!--<a id="toggle" class="uibutton">UPDATE</a>-->
  </form>
</div>
<script>
var ent = Number(<?=$i?>)+1;
var spryselect1 = new Spry.Widget.ValidationSelect("spryselect1", {validateOn:["blur", "change"]});
</script>
</body>
</html>