}
    } else {
        if ($cboPayChargeType == "LocalChargeOnly") {
            if ($getcboincludeservice == "") {
                $update = $db->query("UPDATE tbltransaction SET \n\t\t\t\t\tAnother_BranchID = '" . $cboToBranch . "', \n\t\t\t\t\tPhoneSender= '" . $txtPhoneSender . "',\n\t\t\t\t\tPhoneReceiver= '" . $txtPhoneReciever . "',\n\t\t\t\t\t`Code`= '" . $txtcode . "',\n\t\t\t\t\tCurrencyNo= '" . $cboCurrency . "',\n\t\t\t\t\tAmt= '" . $txtamt . "',\n\t\t\t\t\tLocal_Branch_Charge= '" . $txtLocalCharge . "', \n\t\t\t\t\tAnother_Branch_Charge= '" . $txtAnnotherCharge . "', \n\t\t\t\t\tTotalCharge= '" . $txtTotalCharge . "',\n\t\t\t\t\tPayChargeType= '" . $cboPayChargeType . "',\n\t\t\t\t\tTotal_To_Paid= '" . $ifLocalChargenotinclude . "'\n\t\t\t\t\tWHERE TransactionID = '" . $txtTransactionID . "'");
            } else {
                $update = $db->query("UPDATE tbltransaction SET \n\t\t\t\t\tAnother_BranchID = '" . $cboToBranch . "', \n\t\t\t\t\tPhoneSender= '" . $txtPhoneSender . "',\n\t\t\t\t\tPhoneReceiver= '" . $txtPhoneReciever . "',\n\t\t\t\t\t`Code`= '" . $txtcode . "',\n\t\t\t\t\tCurrencyNo= '" . $cboCurrency . "',\n\t\t\t\t\tAmt= '" . $txtamt . "',\n\t\t\t\t\tLocal_Branch_Charge= '" . $txtLocalCharge . "', \n\t\t\t\t\tAnother_Branch_Charge= '" . $txtAnnotherCharge . "', \n\t\t\t\t\tTotalCharge= '" . $txtTotalCharge . "',\n\t\t\t\t\tPayChargeType= '" . $cboPayChargeType . "',\n\t\t\t\t\tTotal_To_Paid= '" . $ifLocalCharge . "'\n\t\t\t\t\tWHERE TransactionID = '" . $txtTransactionID . "'");
            }
        } else {
            if ($cboPayChargeType == "NotAll") {
                $update = $db->query("UPDATE tbltransaction SET \n\t\t\t\t\tAnother_BranchID = '" . $cboToBranch . "', \n\t\t\t\t\tPhoneSender= '" . $txtPhoneSender . "',\n\t\t\t\t\tPhoneReceiver= '" . $txtPhoneReciever . "',\n\t\t\t\t\t`Code`= '" . $txtcode . "',\n\t\t\t\t\tCurrencyNo= '" . $cboCurrency . "',\n\t\t\t\t\tAmt= '" . $txtamt . "',\n\t\t\t\t\tLocal_Branch_Charge= '" . $txtLocalCharge . "', \n\t\t\t\t\tAnother_Branch_Charge= '" . $txtAnnotherCharge . "', \n\t\t\t\t\tTotalCharge= '" . $txtTotalCharge . "',\n\t\t\t\t\tPayChargeType= '" . $cboPayChargeType . "',\n\t\t\t\t\tTotal_To_Paid= " . $ifLocalChargeinclude . "\n\t\t\t\t\tWHERE TransactionID = '" . $txtTransactionID . "'");
            }
        }
    }
    if ($update) {
        cRedirect('frmTransfer.php');
    } else {
        echo "<script type='text/javascript'>alert('មានបញ្ហាបន្តិចបន្តួច! សូមបញ្ចូលម្តងទៀត!')</script>";
    }
}
?>

    <body class="skin-blue">
        <!-- header logo: style can be found in header.less -->
         <?php 
include 'nav.php';
?>
        
            <!-- Left side column. contains the logo and sidebar -->
            <?php 
include 'menu.php';
$btnSave = get('btnSave');
// update
$gettxtServiceTypeID = get('txtServiceTypeID');
$gettxtservicename = get('txtservicename');
$gettxtDesc = get('txtDesc');
$getbtnSave = get('btnSave');
if ($btnSave == 'Save') {
    $InsertServiceType = $db->query("INSERT INTO tblservicetype( ServiceTypeID, ServiceTypeName, Description ) \n\t\tVALUES (" . $autoid . ",N'" . $txtservicename . "',N'" . $txtDesc . "');");
    if ($InsertServiceType) {
        cRedirect('frmServicesType.php');
    }
}
if ($getbtnSave == 'SaveUpdate') {
    $UpdateServiceType = $db->query("UPDATE tblservicetype SET  ServiceTypeName='" . $gettxtservicename . "', Description='" . $gettxtDesc . "' \n\t\t\tWHERE ServiceTypeID='" . $gettxtServiceTypeID . "';");
    if ($UpdateServiceType) {
        cRedirect('frmServicesType.php');
    }
}
?>

    <body class="skin-blue">
        <!-- header logo: style can be found in header.less -->
         <?php 
include 'nav.php';
?>
        
            <!-- Left side column. contains the logo and sidebar -->
            <?php 
include 'menu.php';
?>
<?php 
include 'header.php';
//==================== Insert New User =======================
if (isset($_POST['btnSave'])) {
    $cboBranch = $_POST['cboBranch'];
    $txtUserName = post('txtUserName');
    $txtPassword = post('txtPassword');
    $txtLevel = post('txtLevel');
    $txtDescription = post('txtDescription');
    $txtStatus = post('txtStatus');
    $encrypted_pass = encrypt_decrypt('encrypt', $txtPassword);
    $insert = $db->query("CALL sp_Insert_UserAccount(\n\t\t\t\t'" . time() . "',\n\t\t\t\t'" . $cboBranch . "',\n\t\t\t\tN'" . sql_quote($txtUserName) . "',\n\t\t\t\tN'" . sql_quote($encrypted_pass) . "',\n\t\t\t\t'" . sql_quote($txtLevel) . "',\n\t\t\t\tN'" . sql_quote($txtDescription) . "',\n\t\t\t\t'" . sql_quote($txtStatus) . "'\t\t\t\n\t\t\t\t)");
    if ($insert) {
        cRedirect('userAccount.php');
    }
}
?>

    <body class="skin-blue">
        <!-- header logo: style can be found in header.less -->
         <?php 
include 'nav.php';
?>
        
            <!-- Left side column. contains the logo and sidebar -->
            <?php 
include 'menu.php';
?>

            <!-- Right side column. Contains the navbar and content of the page -->
            <aside class="right-side">
        if ($getcboincludeservice == "") {
            $updated = $db->query("UPDATE tbltransaction set \n\t\t\t\t\tAnother_BranchID = '" . $cboFromBranch . "', \n\t\t\t\t\tPhoneSender = '" . $txtPhoneSender . "', \n\t\t\t\t\tPhoneReceiver = '" . $txtPhoneReciever . "', \n\t\t\t\t\t`Code` = '" . $txtcode . "', \n\t\t\t\t\tCurrencyNo = '" . $cboCurrency . "', \n\t\t\t\t\tAmt = " . $txtamt . ", \n\t\t\t\t\tLocal_Branch_Charge = " . $txtLocalCharge . ", \n\t\t\t\t\tAnother_Branch_Charge = " . $txtAnnotherCharge . ", \n\t\t\t\t\tTotalCharge = " . $txtTotalCharge . ", \n\t\t\t\t\tPayChargeType = '" . $cboPayChargeType . "', \n\t\t\t\t\tTotal_To_Paid = " . $ifallnotInclude . ",\n\t\t\t\t\tDate = '" . $date_now . "'\n\t\t\t\t\tWHERE TransactionID = '" . $txtgettransactionID . "'");
        } else {
            $updated = $db->query("UPDATE tbltransaction set \n\t\t\t\t\tAnother_BranchID = '" . $cboFromBranch . "', \n\t\t\t\t\tPhoneSender = '" . $txtPhoneSender . "', \n\t\t\t\t\tPhoneReceiver = '" . $txtPhoneReciever . "', \n\t\t\t\t\t`Code` = '" . $txtcode . "', \n\t\t\t\t\tCurrencyNo = '" . $cboCurrency . "', \n\t\t\t\t\tAmt = " . $txtamt . ", \n\t\t\t\t\tLocal_Branch_Charge = " . $txtLocalCharge . ", \n\t\t\t\t\tAnother_Branch_Charge = " . $txtAnnotherCharge . ", \n\t\t\t\t\tTotalCharge = " . $txtTotalCharge . ", \n\t\t\t\t\tPayChargeType = '" . $cboPayChargeType . "', \n\t\t\t\t\tTotal_To_Paid = " . $ifallInclude . ",\n\t\t\t\t\tDate = '" . $date_now . "'\n\t\t\t\t\tWHERE TransactionID = '" . $txtgettransactionID . "'");
        }
    } else {
        if ($cboPayChargeType == "LocalChargeOnly") {
            $updated = $db->query("UPDATE tbltransaction set \n\t\t\t\tAnother_BranchID = '" . $cboFromBranch . "', \n\t\t\t\tPhoneSender = '" . $txtPhoneSender . "', \n\t\t\t\tPhoneReceiver = '" . $txtPhoneReciever . "', \n\t\t\t\t`Code` = '" . $txtcode . "', \n\t\t\t\tCurrencyNo = '" . $cboCurrency . "', \n\t\t\t\tAmt = " . $txtamt . ", \n\t\t\t\tLocal_Branch_Charge = " . $txtLocalCharge . ", \n\t\t\t\tAnother_Branch_Charge = " . $txtAnnotherCharge . ", \n\t\t\t\tTotalCharge = " . $txtTotalCharge . ", \n\t\t\t\tPayChargeType = '" . $cboPayChargeType . "', \n\t\t\t\tTotal_To_Paid = " . $ifLocalCharge . ",\n\t\t\t\tDate = '" . $date_now . "'\n\t\t\t\tWHERE TransactionID = '" . $txtgettransactionID . "'");
        } else {
            if ($cboPayChargeType == "NotAll") {
                $updated = $db->query("UPDATE tbltransaction set \n\t\t\t\tAnother_BranchID = '" . $cboFromBranch . "', \n\t\t\t\tPhoneSender = '" . $txtPhoneSender . "', \n\t\t\t\tPhoneReceiver = '" . $txtPhoneReciever . "', \n\t\t\t\t`Code` = '" . $txtcode . "', \n\t\t\t\tCurrencyNo = '" . $cboCurrency . "', \n\t\t\t\tAmt = " . $txtamt . ", \n\t\t\t\tLocal_Branch_Charge = " . $txtLocalCharge . ", \n\t\t\t\tAnother_Branch_Charge = " . $txtAnnotherCharge . ", \n\t\t\t\tTotalCharge = " . $txtTotalCharge . ", \n\t\t\t\tPayChargeType = '" . $cboPayChargeType . "', \n\t\t\t\tTotal_To_Paid = " . $ifNotall . ",\n\t\t\t\tDate = '" . $date_now . "'\n\t\t\t\tWHERE TransactionID = '" . $txtgettransactionID . "'");
            }
        }
    }
    if ($updated) {
        cRedirect('frmReciever.php');
        //echo "<script type='text/javascript'>alert('Thank!')</script>";
    } else {
        echo "<script type='text/javascript'>alert('មានបញ្ហាបន្តិចបន្តួច! សូមបញ្ចូលម្តងទៀត!')</script>";
    }
}
?>

    <body class="skin-blue">
        <!-- header logo: style can be found in header.less -->
         <?php 
include 'nav.php';
?>
        
            <!-- Left side column. contains the logo and sidebar -->
            <?php 
<?php 
include 'header.php';
?>

<?php 
// Add new product to Produtct Tem
if (isset($_POST['btnSave'])) {
    $txtName = post('txtName');
    $txtDesc = post('txtDesc');
    $Updatestock = $db->query("UPDATE tblbranch SET\n\t\t\t\t\t\t\t\tBranchName = N'" . $txtName . "',\n\t\t\t\t\t\t\t\tDecription = N'" . $txtDesc . "'\n\t\t\t\t\t\t\t\tWHERE BranchID = '" . $getBranchID . "';");
    if ($Updatestock) {
        cRedirect('frmbranch.php');
    }
    $error = "Error Internet Connection!";
}
?>

    <body class="skin-blue">
        <!-- header logo: style can be found in header.less -->
         <?php 
include 'nav.php';
?>
        
            <!-- Left side column. contains the logo and sidebar -->
            <?php 
include 'menu.php';
?>

            <!-- Right side column. Contains the navbar and content of the page -->
            <aside class="right-side">
        $x = 1;
        while ($row = $db->fetch($InsertToTableBuyDetail)) {
            $ProductID = $row->ProductID;
            $QTY = $row->QTY;
            $BuyPrice = $row->BuyPrice;
            /*Insert to tblproducts_buydetail*/
            $newinsert = $db->query("INSERT INTO tblproducts_buydetail\n\t\t\t\t\t\t\t\t\t\t\t( BuyDetailID,\n\t\t\t\t\t\t\t\t\t\t\tBuyID, \n\t\t\t\t\t\t\t\t\t\t\tUserID,\n\t\t\t\t\t\t\t\t\t\t\tProductID,\n\t\t\t\t\t\t\t\t\t\t\tQty,\n\t\t\t\t\t\t\t\t\t\t\tBuyPrice,\n\t\t\t\t\t\t\t\t\t\t\tDecription )\n\t\t\t\t\t\t\t\t\t\t\tVALUES\n\t\t\t\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t\t\t'" . time() . $x++ . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . $buyid . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . $U_id . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . $ProductID . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . $QTY . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . $BuyPrice . "',\n\t\t\t\t\t\t\t\t\t\t\t''\n\t\t\t\t\t\t\t\t\t\t\t)");
            /*Update Qty of Products*/
            $updateproductsqty = $db->query("UPDATE tblproducts \n\t\t\t\t\t\t\t\t\t\t\tSET Qty = Qty + (SELECT Qty FROM tblprdtem WHERE ProductID = '" . $ProductID . "' )\n\t\t\t\t\t\t\t\t\t\t\tWHERE ProductID = '" . $ProductID . "'\n\t\t\t\t\t\t\t\t\t\t\t");
            /*Update Qty of ProductsBranch*/
            $updateproductsqty = $db->query("UPDATE `tblproductsbranch`SET\n\t\t\t\t\t\t\t\t\t\t\tBuyPrice = (SELECT BuyPrice FROM tblprdtem WHERE ProductID = '" . $ProductID . "' ) ,\n\t\t\t\t\t\t\t\t\t\t\tOtherCost = '0',\n\t\t\t\t\t\t\t\t\t\t\tSalePrice = (SELECT SalePrice FROM tblprdtem WHERE ProductID = '" . $ProductID . "' ) ,\n\t\t\t\t\t\t\t\t\t\t\tQty = Qty + (SELECT Qty FROM tblprdtem WHERE ProductID = '" . $ProductID . "' ) ,\n\t\t\t\t\t\t\t\t\t\t\tQtyInstock = (SELECT Qty FROM tblproducts WHERE ProductID = '" . $ProductID . "' ) ,\n\t\t\t\t\t\t\t\t\t\t\tTotalBuyPrice = TotalBuyPrice + (SELECT Qty * BuyPrice FROM tblprdtem WHERE ProductID = '" . $ProductID . "' )\n\t\t\t\t\t\t\t\t\t\t\tWHERE ProductID = '" . $ProductID . "'\n\t\t\t\t\t\t\t\t\t\t\t");
        }
    }
    if ($copy) {
        $delete = $db->query("DELETE FROM `tblprdtem` WHERE IP = '" . $ip . "'");
        cRedirect('index.php');
    }
}
?>

    <body class="skin-blue">
        <!-- header logo: style can be found in header.less -->
         <?php 
include 'nav.php';
?>
        
            <!-- Left side column. contains the logo and sidebar -->
            <?php 
include 'menu.php';
?>
<?php

include 'header.php';
$error = "";
$id = get('id');
$BranchName = get('BranchName');
$Decription = get('Decription');
$UserID = $_SESSION['UserID'];
//Update Branch
if (isset($_POST['btnSaveUpdate'])) {
    $txtbranchName = post('txtbranchName');
    $txtDescrpiton = post('txtDescrpiton');
    $update = $db->query("CALL sp_Branch_Update(\n\t\t\t\t\t'" . $id . "',\n\t\t\t\t\tN'" . sql_quote($txtbranchName) . "',\n\t\t\t\t\tN'" . sql_quote($txtDescrpiton) . "'\n\t\t\t\t\t)\t\t\t\n\t\t");
    if ($update) {
        cRedirect('Branch.php');
        //$error = 'Success';
    }
}
?>
      
            <div class="row">
                <div class="col-lg-12">
                    <h1 class="page-header">Update Branch</h1>
                    
                </div>
                <!-- /.col-lg-12 -->
            </div>
            <!-- /.row -->
            <div class="row">
               
                        <div class="panel-heading">
<?php

session_start();
include 'connectionclass/connect.php';
include 'connectionclass/function.php';
$db = new MyConnection();
$db->connect();
mysql_query("SET NAMES 'UTF8'");
$LoginDate = $_SESSION['startDate'];
$UserID = $_SESSION['UserID'];
$date = new DateTime('now', new DateTimeZone('ICT'));
$_SESSION['LogoutNow'] = $date->format('d-m-Y H:i:s');
$LogoutDate = $_SESSION['LogoutNow'];
/*echo $UserID . '<br>';
echo $LoginDate.'<br>';
echo $LogoutDate;*/
$Insert = $db->query("INSERT INTO tbluserhistory (UserID,UserHistoryStartDate,UserHistoryEndDate) VALUES ('" . $UserID . "','" . $LoginDate . "',Now())");
session_destroy();
cRedirect('login.php');
                $db->connect();
                $update1 = $db->query("UPDATE tbltransaction SET isClearPayment = '1', \n\t\t\t\t\tClearPaymentDate='" . $date_now . "', ClearPayment_Description='' \n\t\t\t\t\tWHERE TransactionID = '" . $TransactionID . "'");
            }
            /*if($TransactionID == get($TransactionID))
            		{
            			echo "<script type='text/javascript'>alert('It Work')</script>";	
            		}*/
        }
        cRedirect('frmReport.php?cboTransaction=' . $cboTransaction . '&txtFrom=' . $txtFrom . '&txtTo=' . $txtTo . '&searchBranch=' . $searchBranch . '');
    }
} else {
    if ($getClear == 'All') {
        $select = $db->query("call spReport('" . $cboTransaction . "','" . $searchBranch . "');");
        $rowselect = $db->dbCountRows($select);
        if ($rowselect > 0) {
            //echo 'Clear Payment .....';
            while ($row = $db->fetch($select)) {
                $TransactionID = $row->TransactionID;
                //$getID = get("".$TransactionID."");
                $db->disconnect();
                $db->connect();
                $update1 = $db->query("UPDATE tbltransaction SET isClearPayment = '1', \n\t\t\t\t\tClearPaymentDate='" . $date_now . "', ClearPayment_Description='' \n\t\t\t\t\tWHERE TransactionID = '" . $TransactionID . "'");
                /*if($TransactionID == get($TransactionID))
                		{
                			echo "<script type='text/javascript'>alert('It Work')</script>";	
                		}*/
            }
            cRedirect('frmReport.php?cboTransaction=' . $cboTransaction . '&txtFrom=' . $txtFrom . '&txtTo=' . $txtTo . '&searchBranch=' . $searchBranch . '');
        }
    }
}
$txtBranchName = get('txtBranchName');
$txtDesc = get('txtDesc');
$btnSave = get('btnSave');
if (isset($_POST['btnSave'])) {
    $txtBranchName = $_POST['txtBranchName'];
    $txtDescription = post('txtDescription');
    $insert = $db->query("INSERT INTO tblcurrency (CurrencyNo, `Name`, Description) VALUES ('" . time() . "',N'" . $txtBranchName . "',N'" . $txtDescription . "'); ");
    if ($insert) {
        cRedirect('frmcurrency.php');
    }
    $error = "Error Internet Connection!";
}
if ($btnSave == 'SaveUpdate') {
    $updatebranch = $db->query("UPDATE tblcurrency SET Name=N'" . $txtBranchName . "', Description='" . $txtDesc . "' WHERE CurrencyNo = '" . $txtBranchID . "'; ");
    if ($updatebranch) {
        cRedirect('frmcurrency.php');
    } else {
        echo "<script type='text/javascript'>alert('មានបញ្ហាបន្តិចបន្តួច! សូមបញ្ចូលម្តងទៀត!')</script>";
    }
}
/*if($btnSave == 'Save')
		{
			$InsertServiceType=$db->query("INSERT INTO tblservicetype( ServiceTypeID, ServiceTypeName, Description ) 
		VALUES (".$autoid.",N'".$txtservicename."',N'".$txtDesc."');");
			if($InsertServiceType){
			cRedirect('frmServicesType.php');
		 	}
		}		
		if($getbtnSave == 'SaveUpdate')
		{
			$UpdateServiceType=$db->query("UPDATE tblservicetype SET  ServiceTypeName='".$gettxtservicename."', Description='".$gettxtDesc."' 
    $Password = $row->Password;
}
//==================== Insert New Branch =======================
if (isset($_POST['btnSave'])) {
    $txtUser = post('txtUser');
    $txtold = post('txtold');
    $txtNewPass = post('txtNewPass');
    $encrypt_Newpassword = encrypt_decrypt('encrypt', $txtNewPass);
    if ($txtNewPass == "") {
        echo "<script type='text/javascript'>alert('Please Insert New Password!');</script>";
    } else {
        $update = $db->query("UPDATE tblusers SET\n\t\t\t\t\t\t\t\t\tUserName='******',\n\t\t\t\t\t\t\t\t\tPassword = '******'\n\t\t\t\t\t\t\t\t\tWHERE UserID = '" . $U_id . "'\n\t\t\t\t\t\t\t\t");
        if ($update) {
            //$GLOBALS['msg'] = "Success full";
            echo "<script type='text/javascript'>alert('Success full');</script>";
            cRedirect('logout.php');
        } else {
            $GLOBALS['msg'] = "Error for update";
        }
    }
}
?>

    <body class="skin-blue">
        <!-- header logo: style can be found in header.less -->
         <?php 
include 'nav.php';
?>
        
            <!-- Left side column. contains the logo and sidebar -->
            <?php