D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
thread-self
/
root
/
proc
/
self
/
root
/
home
/
shubmkcj
/
urbane.createerp.com
/
Filename :
conversion-rate.php
back
Copy
<?php ob_start(); session_start(); include 'config.php'; if(!isset($_SESSION['login_email']) || $_SESSION['login_email'] == ''){ echo '<script>location.replace("index.php")</script>'; } $login = $_SESSION['login_email']; if(isset($_SESSION["source_id"])){ $source_id = $_SESSION['source_id']; } $query_c="SELECT * FROM `conversion_rate` ORDER BY `conversion_rate`.`id` DESC LIMIT 1"; $result_c = mysqli_query($conn, $query_c); $count_c=mysqli_num_rows($result_c); if($count_c>0){ $row_c = mysqli_fetch_assoc($result_c); $last_row_id = $row_c["id"]; $last_to_date = $row_c["to_date"]; $query = "SELECT * FROM `conversion_rate` WHERE `id` = '$last_row_id' AND `status`='active'"; $queryResult = mysqli_query($conn, $query); if($queryResult){ if(mysqli_num_rows($queryResult) > 0){ while($rows = mysqli_fetch_assoc($queryResult)){ $row_id = $rows["id"]; $usd_amt = $rows["usd"]; $rmb_amt = $rows["rmb"]; } } } } ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>Conversion Rate</title> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /> <meta content="A fully featured admin theme which can be used to build CRM, CMS, etc." name="description" /> <meta content="Coderthemes" name="author" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <!-- Font Awsome --> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> <!-- App favicon --> <link rel="shortcut icon" href="assets/images/favicon.png"> <!-- Pie Chart Css --> <link href="assets/pie charts/style.css" rel="stylesheet" type="text/css" /> <!-- App css --> <link href="assets/css/bootstrap.min.css" rel="stylesheet" type="text/css" /> <link href="assets/css/icons.css" rel="stylesheet" type="text/css" /> <link href="assets/css/metismenu.min.css" rel="stylesheet" type="text/css" /> <link href="assets/css/style.css" rel="stylesheet" type="text/css" /> <script src="assets/js/modernizr.min.js"></script> <link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.5/css/select2.min.css'> <link href="plugins/sweet-alert2/sweetalert2.min.css" rel="stylesheet" type="text/css"> <link href="plugins/jquery-toastr/jquery.toast.min.css" rel="stylesheet" /> </head> <body> <!-- Begin page --> <div id="wrapper"> <!-- Top Bar Start --> <?php include 'top-header.php'; ?> <!-- Top Bar End --> <!-- ========== Left Sidebar Start ========== --> <?php include 'left-sidebar.php'; ?> <!-- Left Sidebar End --> <!-- ============================================================== --> <!-- Start right Content here --> <!-- ============================================================== --> <div class="content-page"> <!-- Start content --> <div class="content"> <div class="container-fluid"> <div class="row"> <div class="col-12"> <div class="page-title-box"> <h4 class="page-title float-left">Conversion Rate</h4> <ol class="breadcrumb float-right"> <li class="breadcrumb-item ">Conversion</li> <li class="breadcrumb-item active">Conversion Rate</li> </ol> <div class="clearfix"></div> </div> </div> </div> <!-- end row --> <form action="" method="post" role="form" id="myform"> <div class="card-box"> <input type="hidden" name="sourceId" value="<?php echo $source_id; ?>"> <div class="row"> <div class="col-md-12"> <h5>Set USD TO RMB Conversion Rate</h5><hr /><br> </div> <div class="col-md-4"> <div class="form-group"> <label for="exampleInputEmail1">USD</label> <input type="text" class="form-control" name="usd_amt" placeholder="USD" value="1" readonly required> </div> </div> <div class="col-md-1 text-center"><br> <b style="font-size:22px">=</b> </div> <div class="col-md-4"> <div class="form-group"> <label>RMB</label> <input type="text" class="form-control" name="rmb_amt" placeholder="RMB" value="<?php if(!empty($last_row_id)){ echo $rmb_amt;} ?>" required> </div> </div> <div class="col-md-3"> <div class="form-group"><br> <center> <button name="submit" type="submit" id="btnSubmit" class="btn btn-purple waves-effect waves-light">Submit</button> </center> </div> </div> </div> </div> </form> </div> <!-- container --> </div> <!-- content --> <?php include 'copyrignt.php' ?> </div> <!-- ============================================================== --> <!-- End Right content here --> <!-- ============================================================== --> </div> <!-- END wrapper --> <!-- Chart Js --> <script src='https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.17/d3.min.js'></script> <script src='https://cdnjs.cloudflare.com/ajax/libs/c3/0.4.11/c3.min.js'></script> <script src='https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.1.3/Chart.js'></script> <!-- jQuery --> <script src="assets/js/jquery.min.js"></script> <script src="assets/js/popper.min.js"></script><!-- Popper for Bootstrap --> <script src="assets/js/bootstrap.min.js"></script> <script src="assets/js/metisMenu.min.js"></script> <script src="assets/js/waves.js"></script> <script src="assets/js/jquery.slimscroll.js"></script> <!-- Dashboard init --> <script src="assets/pages/jquery.dashboard.js"></script> <!-- App js --> <script src="assets/js/jquery.core.js"></script> <script src="assets/js/jquery.app.js"></script> <!-- Chart Js --> <!-- <!-- <script src="assets/pie charts/script.js"></script> --> --> <script src='https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.5/js/select2.min.js'></script> <script src="plugins/sweet-alert2/sweetalert2.min.js"></script> <script src="plugins/jquery-toastr/jquery.toast.min.js" type="text/javascript"></script> <script> $(document).ready(function(){ if (localStorage.getItem("InvoiceInserted") == "true") { successMessage("Conversion Rate updated"); localStorage.setItem("InvoiceInserted", "false"); } if (localStorage.getItem("ProformaUpdate") == "true") { successMessage("Proforma Successfully Update."); localStorage.setItem("ProformaUpdate", "false"); } if (localStorage.getItem("proformaDeleted") == "true") { successMessage("Proforma Successfully Deleted."); localStorage.setItem("proformaDeleted", "false"); } }); $(function () { $(".select") .select2({ placeholder: '-- select terms and condition --', width: '50%', minimumResultsForSearch: Infinity }) .on('select2:close', function() { var el = $(this); if(el.val()==="other") { var newval = prompt("Enter Terms And Condition: "); if(newval !== null) { el.append('<option>'+newval+'</option>') .val(newval); } } }); }); $("#btnSubmit").click(function(){ var check = []; var i = 0; var reg = /^([0-9]{2}[a-zA-Z]{4}([a-zA-Z]{1}|[0-9]{1})[0-9]{4}[a-zA-Z]{1}([a-zA-Z]|[0-9]){3}){0,15}$/; // var reg= /^([0-9]){2}([A-Za-z]){5}([0-9]){4}([A-Za-z]){1}([0-9]{1})([A-Za-z]){2}?$/; $('.gstInClass').each(function() { if (this.value != null || this.value != ''){ var data = this.value; if (data.match(reg)) { check[i] = true; } else { errorToast("Please Enter valid GST Number"); this.focus(); check[i] = false; } } i++; }); if(check.includes(false)){ } else{ $("#myform").submit(); } }) function deletethis(button) { $(button).parent().parent().parent().parent().remove(); } function errorToast(msg){ $.toast({ heading: 'Error!', text: msg, position: 'top-right', loaderBg: '#bf441d', icon: 'error', hideAfter: 3000, stack: 1 }); } function successMessage(msg){ swal({ title: 'Success!', text: msg, type: 'success', confirmButtonColor: '#4fa7f3' }); } function errorMessage(msg){ swal({ title: 'Error!', text: msg, type: 'error', confirmButtonColor: '#4fa7f3' }); } </script> </body> </html> <?php if (isset($_POST['submit'])) { $usd_amt = $_POST['usd_amt']; $rmb_amt = $_POST['rmb_amt']; $nowDate=date('j F Y'); if($count_c>0){ // echo "<script>alert($last_row_id)</script>"; $execute1="UPDATE `conversion_rate` SET `to_date`='$nowDate' WHERE `id`='$last_row_id'"; $resultM1 = $conn->query($execute1); } $execute="INSERT INTO `conversion_rate` (`usd`,`rmb`,`from_date`,`to_date`,`status`) VALUES('$usd_amt','$rmb_amt','$nowDate','','active')"; $resultM = $conn->query($execute); if ($resultM === TRUE) { echo '<script>localStorage.setItem("InvoiceInserted", "true");</script>'; echo '<script>location.replace("conversion-rate.php")</script>'; }else{ echo '<script>alert("fail !")</script>'; echo '<script>location.replace("conversion-rate.php")</script>'; } } ?>