/var/www/enzatesting.onesolution.hk/ajax_dgn_master_mold.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
<?php 
$formid
=$_REQUEST['formid'];
require_once 
"inc/configure.php";


$refid        = (int)$_REQUEST['mold_refid'];
$pdt_moldno    $_REQUEST['pdt_moldno'];
$numMold    $_REQUEST['numMold'];
$uom_waxwt    $_REQUEST['uom_waxwt'];

$editable    = (int)$_REQUEST['edit'];
$wax_wt        = (float)$_REQUEST['wax_wt'];

$editfield    = ($editable>0)?'':'readonly="readonly"' ;
$formolding    $_REQUEST['formolding']=='true' 'checked="checked"':'' ;

if(
$numMold=="AUTO"){ // find number of submold from DB
    
$sql "SELECT count(*) as numMold from dgn_master_submold WHERE mold_refid = :mold_refid";        
    
$sth $dbh->prepare($sql);
    
$sth->execute( array(':mold_refid'=>$refid)  );
    
//echo $sth->getSQL( array(':mold_refid'=>$refid)  );
    
$row $sth->fetch();    
    
$numMold evl($row['numMold'], 1);
}
?>

<script>
function refreshMe(){
    $.get("ajax_dgn_master_mold.php",{  
            formid: "<?=$formid?>",
            mold_refid: $("#refid").val(),
            pdt_moldno: $("#pdt_moldno").val(),
            wax_wt: $("#wax_wt").val(),
            uom_waxwt: $("#uom_waxwt").val(),
            formolding: $("#formolding").is(':checked'),            
            numMold: $("#numMold").val(),
            edit: $("#edit").val()            
        },
    function(data){
        //alert('ref'+$("#numMold").val());
        $('#tabs-8m').html(data);
        rebind();
    });     
}
</script>
<p>
<?=NUMBER_OF_MOULD_PARTS?>: <input type="text" name="numMold" value="<?=$numMold?>" id="numMold" class="posint minifield" <?=$editfield?> />&nbsp;
<?php if($editable) { ?>
    <a href="#" onclick="refreshMe()" class="uibutton pressnhide" ><?=SET?></a>&nbsp;
<?php ?>  
<?=WEIGHT?>:<input type="text" name="wax_wt" value="<?=numf($wax_wt)?>" id="wax_wt" class="positive minifield" <?=$editfield?> />

<?php  if($editable) { ?>
    <select name="uom_waxwt" id="uom_waxwt"><?=master_option("UOM_WT"$uom_waxwt)?></select>&nbsp;<br/>
    <label for="formolding"><?=FOR_MOLDING?></label><input type="checkbox" name="formolding" id="formolding" <?=$formolding?> <?=$editfield?> />
<?php } else { ?>
    <?=$uom_waxwt?>&nbsp;<br/>
    <?=FOR_MOLDING?><?=($_REQUEST['formolding']=="true")?YES:NO?>
<?php 
}?>



<table width="100%" border="1" class="bcol">
<tr>
<th class="title1"><?=MOLD?><?=WS?><?=NUMBER?></th>
<th class="title1"><?=QTY_OF_WAX?></th>
<?php if($editable) { ?><th class="title1"><?=UPLOAD?></th><?php ?>
<th class="title1"><?=IMAGE?></th>
</tr>

<?php for($i=1$i<=$numMold$i++){ 
    
$mold_subno getMoldNo($pdt_moldno$i$refid);
    
//check any existed operation of the BOM
    
$sql "SELECT * from dgn_master_submold WHERE 
    mold_refid = :mold_refid AND
    mold_subno = :mold_subno"
;        
    
$sth $dbh->prepare($sql);
    
$sth->execute( array(':mold_refid'=>$refid,
                        
':mold_subno'=>$mold_subno)  );
/*    echo $sth->getSQL( array(':mold_refid'=>$refid,
                        ':mold_subno'=>$mold_subno)  );*/
    
$row $sth->fetch();
    
//vdump($row);?>
    <tr>
    <td><input type="text" name="submold_detail[<?=$i?>][mold_subno]" value="<?=evl($row['mold_subno'], $mold_subno)?>" /></td>
    <td><input type="text" name="submold_detail[<?=$i?>][qty]" value="<?=evl($row['qty'], 1)?>" class="shortfield posint" <?=$editfield?> /></td>
    <?php if($editable) { ?><td><input type="file" name="submold_detail[<?=$i?>][file]" value="" /></td><?php ?>
    <td class="span_img"><?=$img=showThumb($row)?>&nbsp;
    <input type="hidden" name="submold_detail[<?=$i?>][img_src]" value="<?=$row['img_src']?>" />
    <input type="hidden" name="submold_detail[<?=$i?>][img_path]" value="<?=$row['img_path']?>" />
    <?php if ($img){ ?>
    <input type="hidden" name="submold_detail[<?=$i?>][deleteimg]"  />
    <?php if($editable) { ?><a class="deleteImgButton uibutton"><?=X?></a><?php ?>
    <?php ?>
    </td>
    </tr>
<?php ?>

</table>
</p>