<?php
switch($_REQUEST[mode]) {
    case "hapus":
        if(RetRstField("SELECT fnid FROM txdelivery_order_hdr WHERE ftcustomer_code='{$_REQUEST['ftcustomer_code']}'")) {
            echo "<script>
                alert('data ini tidak dapat di delete karena sudah digunakan ...');
                window.history.back();
                </script>";   
            die("");            
        }

        break;    
}

function SaveData() {
    global $objAxpDB;
    $strSQL=array();
    $objAxpDB->Allow_Save(true);
    switch($_REQUEST[mode]) {
        case "simpan":
            if ($_REQUEST['ftcustomer_code'] == "") {
                // auto generate number when save
                $str_code = substr($_REQUEST['ftcustomer_name'],0,1);
                $ftcustomer_code=getAutoNumber($_SESSION['strbranch'],'sls005','tlcustomer','ftcustomer_code',$str_code);
                $_REQUEST['ftcustomer_code'] = $ftcustomer_code;    
            } 
            break;
    }
    return $strSQL;
}

  /* function UpdateData() {
       global $objAxpDB;
        $strSQL=array();
        $objAxpDB->Allow_Save(true);
	switch($_REQUEST[mode]) {
        case "update":
                $strSQL["DELETE Tracking Support"][]="DELETE from txtracking_detz where ftcustomer_code='{$_REQUEST['ftcustomer_code']}'";
                $i=count($_REQUEST['fnindexD0']);
                for($j=1; $j< $i; $j++){
                    $strSQL["INSERT Tracking Support"][]="INSERT INTO txtracking_detz(fnindex, ftcustomer_code, ftsupport_code, ftcreated_user, fdcreated_date, ftmodified_user, fdmodified_date)
                                                         VALUES('{$_REQUEST['fnindexD0'][$j]}', '{$_REQUEST['ftcustomer_code']}', '{$_REQUEST['ftsupport_codeD0'][$j]}','{$_SESSION['username']}',now(),'{$_SESSION['username']}',now());";
                }
            break;
        }
     return $strSQL;
   }*/

