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

if(
havePermission("STr")==false){
    
myerror(INVALID.WS.PERMISSION);    
}

$refid setDefaultReqVar("refid"'');

if(
$refid && $row=getDB("inv_product"$refid) ){
    
$header $row;
} else {
    
myerror("Invalid request");
}

?><!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><?=$system_var['COMPANY_NAME']?></title>
<link rel="stylesheet" type="text/css" href="css/style.css" />
<?php require_once "inc/jsheader.php"?>

<script>
$(document).ready(function(){

});
</script>
</head>
<body>

<form action="#" name="myform" id="validateForm" method="post" >
<input type="hidden" name="action" value="price_history" />
<input type="hidden" name="refid" value="<?=$row['refid']?>" />
<input type="hidden" name="bomcategy" value="<?=$bomcategy?>" />
<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 class="separator stext1"><?=PRICE.WS.HISTORY?> - <span><?=PRODUCT?></span></td>
                <td class="separator etext1"><?=$row['itemno']?> - <span><?=$row['name_'.SYS_LANG]?></span> (<?=numf($header['weight'] ,3)?><?=$header['uom_wt']?>/pcs)</td>
                <!--<td width="200" align="right" class="separator etext2"><?=LAST_MODIFY?><?=lastUpdate($row)?></td>-->
                <td width="80" align="right" class="separator etext2"><a href="#" onclick="fbox_close()" class="closebtn"><?=CLOSE?></a></td>
              </tr>
            </table></td>
          </tr>
          <tr>
            <td valign="top" class="c2_bg" style="height:auto">
            <!--main form-->
                <table width="100%" border="0" class="tablelist">
                <tr>
                    <th><?=DATE?></th>
                    <th><?=METAL.WS.PRICE?></th>
                    <th><?=MATERIAL.WS.COST?></th>
                    <th><?=LABOR.WS.COST?></th>
                    <th><?=FACTORY.WS.COST?></th>                    
                    <th><?=FACTORY.WS.MARKUP?></th>
                    <th><?=CURRENCY?></th>
                    <th><?=PRICE?></th>
                    <th><?=MARGIN?></th>
                    <th><?=COEF?></th>
                    <th><?=REMARKS?></th>
                </tr>
                
<?php
                $sql 
"SELECT
                dbo.inv_product_pricehistory.*
                
                FROM
                dbo.inv_product_pricehistory
                WHERE
                dbo.inv_product_pricehistory.invproduct_refid = :product_refid
                ORDER BY
                dbo.inv_product_pricehistory.refid DESC"
;            
                
$sth $dbh->prepare($sql);
                
$q $sth->execute(  array(':product_refid' => $refid) );
                
//echo $sth->getSQL( array(':product_refid' => $orddtl['product_refid']) );
                
pdo_showerror($sth$q);
                while (
$row $sth->fetch(PDO::FETCH_ASSOC) ){
                    
USD_CNY::initByDate($row['createdate']);
                    
$row['sellingprice_usd'] = USD_CNY::getUSDAmount($row['uom_cy'], $row['sellingprice'])?> 
                
                <tr>
                    <td><?=datef($row['createdate'])?></td>
                    <td class="tdalignright"><?=numfs($row['metalprice'] ,2)?></td>
                    <td class="tdalignright"><?=numfs($row['materialcost'] ,2)?></td>
                    <td class="tdalignright"><?=numfs($row['labourcost'] ,2)?></td>
                    <td class="tdalignright"><?=numfs($row['ftycost'] ,2)?></td>
                    <td class="tdalignright"><?=numf($row['ftymarkup'] ,2)?></td>
                    <td class="tdalignright"><?=$row['uom_cy']?></td>
                    <td class="tdalignright"><?=numfs($row['sellingprice'] ,2)?></td>
                    <td class="tdalignright"><?=numf(calcMargin($row['sellingprice_usd'], $row['labourcost']+$row['materialcost'] ) ,2)?>%</td>
                    <td class="tdalignright"><?=numf(calcCoef($row['sellingprice_usd'], $row['labourcost']+$row['materialcost'] ) ,2)?></td>
                    <td data-style="font-size:smaller"><?=simpleTip($row['remark'], 50)?></td>
                </tr>    
<?php ?>

                
                </table>

            <!-- end of mainform-->
            </td>
          </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
</table>
</form>

</body>
</html>