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
 
 | 
<?php  //product selection $formid=$_REQUEST['formid']; require_once "inc/configure.php";
  function ivcrawmatdtl_option($buyer, $supplier_refid, $bomcategy, $itemnoid, $default=0, $showdesc=true){     global $dbh;         $supplier=getDB("master_supplier", $supplier_refid);     $sql = "SELECT             dbo.ivc_rawmat_dtl.refid,             dbo.ivc_rawmat_main.ivc_nbr,             dbo.ivc_rawmat_main.refid AS ivcrawmatmain_refid,             dbo.ivc_rawmat_main.launch_date                         FROM             dbo.ivc_rawmat_main             INNER JOIN dbo.ivc_rawmat_dtl ON dbo.ivc_rawmat_dtl.ivcrawmatmain_refid = dbo.ivc_rawmat_main.refid             WHERE             dbo.ivc_rawmat_main.ivc_customer = :customer AND             dbo.ivc_rawmat_main.companyid = :supplier AND             dbo.ivc_rawmat_dtl.bomcategy = :bomcategy AND             dbo.ivc_rawmat_dtl.itemnoid = :itemnoid             ORDER BY             dbo.ivc_rawmat_main.launch_date DESC";     $sth = $dbh->prepare($sql);     $sth->execute( array(    ':customer' => $buyer,                             ':supplier' => $supplier['code'],                             ':bomcategy' => $bomcategy,                              ':itemnoid' => $itemnoid) ); /*    echo $sth->getSQL( array(    ':customer' => $buyer,                             ':supplier' => $supplier['code'],                             ':bomcategy' => $bomcategy,                              ':itemnoid' => $itemnoid) );*/                                 $s = '';     while($row = $sth->fetch(PDO::FETCH_ASSOC)) {         $selected = ($row['refid']==$default)? 'selected' : '';         $s .= '<option value="'.$row['refid'].'" '.$selected.' >'.$row['ivc_nbr'];         if($showdesc){             $s .= ' - '.$row['launch_date'];         }         $s .= '</option>'.PHP_EOL;     }     return $s; } /* formid: "<?=$formid?>",             supplier_refid: $("#supplier").val(), bomcategy: $("#dialog_bomcategy").val(), refid: $("#dialog_refid").val(), buyer: $("#buyer").val(), format: "json" */              $supplier_refid = (int)$_REQUEST['supplier_refid']; $bomcategy        = filter_var($_REQUEST['bomcategy'], FILTER_SANITIZE_STRING); $itemnoid        = (int)$_REQUEST['refid']; $buyer            = filter_var($_REQUEST['buyer'], FILTER_SANITIZE_STRING);              if(empty($supplier_refid) || empty($bomcategy) || empty($itemnoid) || empty($buyer)){     print'<option value="">'.IVALID.WS.REQUEST.'</option>';     exit; } ?> <option value=""></option><?=ivcrawmatdtl_option($buyer, $supplier_refid, $bomcategy, $itemnoid)?>
 
 
  
 |