/var/www/enzatesting.onesolution.hk/inv_product_index_gridview.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
<html>
<script>
$(document).ready(function() {
    $(".ajaximg_span").each(function() {
        var span = $(this);
        var refid = span.attr("data-refid");
        //console.log( refid );
        //load images
        $.get('ajax_thumb_inv_product.php', { refid: refid, formid: "Product", width: 'style="width:100%;"' },
        function(data) {
            span.html(data);
        });
    });
});    
</script>
<?php 
$num_col
=4;
?>
<table width="100%" border="1" cellspacing="10">
<?php
        
    
//$sql_param[':RECORD_PER_PAGE'] = (int)RECORD_PER_PAGE;
        
    
$sql "SELECT * FROM(
    SELECT
inv_product.*,
itemgp.codedesc_en AS group_en,
itemgp.codedesc_sc AS group_sc,
verified.codedesc_en AS verified_en,
verified.codedesc_sc AS verified_sc,
master_customer.custname_en,
master_customer.custname_sc,
                ROW_NUMBER() OVER (ORDER BY itemno) as RowNum
FROM
inv_product
INNER JOIN master_type_code AS itemgp ON itemgp.codeid = inv_product.itemgp
INNER JOIN master_type_code AS verified ON verified.codeid = inv_product.verified
INNER JOIN master_customer ON inv_product.custcode = master_customer.custcode
WHERE
itemgp.typeid = 'ITEMGP' AND
verified.typeid = 'VERIFIED' AND
itemno like :searchno
$sql_clause
) AS ROWCST 
            WHERE RowNum >= 
$row_offset_start AND RowNum <= $row_offset_end
            ORDER BY RowNum

"
;    

//echo "$sql --- $searchno";    
    
$sth $dbh->prepare($sql);
    
// $sth->bindValue(':RECORD_PER_PAGE', (int)intval(trim($_GET['skip'])), PDO::PARAM_INT); 
    
$sth->execute$sql_param );
//echo $sth->getSQL( $sql_param ) . HTML_EOL;

    
while($row $sth->fetch()) {
        
$i++;
        if (
$i%$num_col==1){
            echo 
'<tr>';    
        }        
        
?>        
        <td class="tdalignmid tdvalignbottom gridtable_td" width="25%">
        <!--a grid-->
        
            <table width="100%">
            <tr>
                <td colspan="2" class="gridcell_imgtd tdvalignmid" ><a href="inv_product_modifyform.php?refid=<?=$row['refid']?>"><span class="ajaximg_span" data-refid="<?=$row['refid']?>" ><?=LOADING?>&hellip;</span></a></td>
            </tr>    
            <tr>
                <td><table width="100%" class="gridcell">
                    <tr>
                        <td class="tdalignleft"><a href="inv_product_modifyform.php?refid=<?=$row['refid']?>" style="color:#FFF" class="vislink"><?=$row['itemno']?></a></td>
                        <td class="tdalignright"><?=$row['custname_'.SYS_LANG]?></td>
                    </tr>                
                    <tr>
                        <td colspan="2"><?=$row['name_'.SYS_LANG]?></td>
                    </tr>
                    <tr>
                        <td class="tdalignleft">
                        <?php if(havePermission("BPr") && havePermission("RPr")){ //BP RP-?>
                            <?=COST?>
                        <?php }  //BP RPr---------------------------------------------------?>
                        </td>
                        <td class="tdalignright">
                        <?php if(havePermission("PPr")){ //PPr---------------------------?>
                            <?=PRICE?>
                        <?php }  //PPr---------------------------------------------------?>    
                        </td>
                    </tr>    
                    <tr>
                        <td class="tdalignleft">
                        <?php if(havePermission("BPr") && havePermission("RPr")){ //BP RP-?>
                            USD <?=numfs($cost=getProductCost($row['refid'], 1))?> 
                        <?php }  //BP RPr---------------------------------------------------?>    
                        </td>
                        <td class="tdalignright">
                        <?php if(havePermission("PPr")){ //PPr---------------------------?>
                            <?=$row['uom_cy']?> <?= numfs($price=$row['sellingprice'])?>
                        <?php }  //PPr---------------------------------------------------?>                        
                        </td>
                    </tr>
                
                </table></td>
            </tr>            
            </table>
        <!--end of a grid-->
        </td>        
        <?php
        
if ($i%$num_col==0){
            echo 
'</tr>';    
        }
    }    
    
    while(
$i%$num_col!=0){
        
$i++;
        echo 
'<td>&nbsp;</td>';    
        if (
$i%$num_col==0){
            echo 
'</tr>';    
        }            
    }
?>


</table>
                
<!--</html>-->