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

$refid                 = (int) filter_var($_REQUEST['refid'], FILTER_SANITIZE_STRING);
$goldPerOunce        = (float) filter_var($_REQUEST['goldrate'], FILTER_SANITIZE_STRING);
//vdump($_POST['action'], !empty($refid), !empty($goldrate));

if( $_POST['action']=="ordmain_updateGoldRate" && !empty($refid) && !empty($goldPerOunce) ){
    
$dbh->beginTransaction();
    if(
ordmain_updategoldRate($refid$goldPerOunce)){
        
//todo: update bom material
        
updateOrderBOMMaterialPrice($refid$goldPerOunce);
        
//todo: update cost and price
        //todo: may repack PACKED but not INVOICED        
        
$dbh->commit();
        
        print( 
json_encode( array('success'=>true) ) );
        exit;        
    }else{        
        
$dbh->rollback();
        
        print( 
json_encode( array('success'=>false) ) );
        exit;        
    }
}
print( 
json_encode( array('success'=>false) ) );
exit;