<?php
session_start();
include 'load.php'; 
$rno = $_GET['rno'];
$tot = 0;
$cpayinfo = mysqli_fetch_array(mysqli_query($conn, "SELECT * FROM mobile_credit_payments WHERE credit_payment_id ='$rno'"));
$customer_id = $cpayinfo['customer_id'];
$credit = $cpayinfo['amount'];
$cusinfo = mysqli_fetch_array(mysqli_query($conn, "SELECT * FROM mobilecustomers WHERE coid ='$customer_id'"));
$credit_limit =  $cusinfo['credit_limit'];
$ccredit =  $cusinfo['ccredit'];

$tot = $ccredit - $credit;



                $sql1 = "UPDATE mobilecustomers SET ccredit='$tot' WHERE coid='$customer_id'";
						if (mysqli_query($conn, $sql1)) 
						{
                            $sql = "UPDATE mobile_credit_payments SET cheque_is_paid='1' WHERE credit_payment_id='$rno'";
                            if (mysqli_query($conn, $sql)){
                                header("refresh:2;listchequepayments.php");
                            }
                        }



?>
<link rel="shortcut icon" type="image/x-icon" href="assets/img/favicon.png">

<link rel="stylesheet" href="assets/css/bootstrap.min.css">

<link rel="stylesheet" href="assets/css/animate.css">

<link rel="stylesheet" href="assets/css/dataTables.bootstrap4.min.css">

<link rel="stylesheet" href="assets/plugins/select2/css/select2.min.css">

<link rel="stylesheet" href="assets/plugins/owlcarousel/owl.carousel.min.css">
<link rel="stylesheet" href="assets/plugins/owlcarousel/owl.theme.default.min.css">

<link rel="stylesheet" href="assets/css/bootstrap-datetimepicker.min.css">

<link rel="stylesheet" href="assets/alertify/alertify.core.css">
<link rel="stylesheet" href="assets/alertify/alertify.default.css">

<link rel="stylesheet" href="assets/plugins/select2/css/select2.min.css">

<link rel="stylesheet" href="assets/plugins/fontawesome/css/fontawesome.min.css">
<link rel="stylesheet" href="assets/plugins/fontawesome/css/all.min.css">

<link rel="stylesheet" href="assets/css/style.css">

<link rel="stylesheet" href="assets/css/custom.css">
<div id="global-loader">
<div class="whirly-loader"> </div>
</div>

<script src="assets/js/jquery-3.6.0.min.js"></script>

<script src="assets/js/feather.min.js"></script>

<script src="assets/js/jquery.slimscroll.min.js"></script>

<script src="assets/js/jquery.dataTables.min.js"></script>
<script src="assets/js/dataTables.bootstrap4.min.js"></script>

<script src="assets/js/bootstrap.bundle.min.js"></script>

<script src="assets/plugins/select2/js/select2.min.js"></script>

<script src="assets/js/moment.min.js"></script>
<script src="assets/js/bootstrap-datetimepicker.min.js"></script>

<script src="assets/plugins/sweetalert/sweetalert2.all.min.js"></script>
<script src="assets/plugins/sweetalert/sweetalerts.min.js"></script>
<script src="assets/alertify/alertify.js"></script>
    <script src="assets/alertify/alertify.min.js"></script>

<script src="assets/js/script.js"></script>
<!-- <script src="process.js"></script> -->
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@10"></script>