D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
thread-self
/
root
/
home
/
shubmkcj
/
urbane.createerp.com
/
Filename :
add_payment.php
back
Copy
<?php ob_start(); session_start(); include 'config.php'; $login = $_SESSION['login_email']; if($login == ''){ echo '<script>location.replace("index.php")</script>'; } $id = $_GET['id']; if(isset($_SESSION["source_id"])){ $source_id = $_SESSION['source_id']; } $sql = "SELECT * FROM contact where id = '$id'"; $result = mysqli_query($conn,$sql); if(mysqli_num_rows($result) > 0){ while($row = mysqli_fetch_array($result)){ $contactId = $row["id"]; $customer_type = $row["customer_type"]; $bill_display_name = $row["bill_display_name"]; $contactPerson = $row["contact_person_name"]; $designation = $row["contact_person_designation"]; } } ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>Invoice Management | Invoice</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 href="https://code.jquery.com/ui/1.10.4/themes/ui-lightness/jquery-ui.css" rel="stylesheet"> <link href="plugins/sweet-alert2/sweetalert2.min.css" rel="stylesheet" type="text/css"> <link href="plugins/jquery-toastr/jquery.toast.min.css" rel="stylesheet" /> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.13/css/select2.min.css" /> <!--<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />--> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@ttskch/select2-bootstrap4-theme@x.x.x/dist/select2-bootstrap4.min.css"> <style> .select2-container--bootstrap4 .select2-selection--single { height: calc(1.5em + 0.75rem + 8px) !important; } .select2-container--bootstrap4 .select2-selection--single .select2-selection__arrow { position: absolute; top: 0px; right: 3px; width: 20px; } .required{ color:red; } .selectOption{ width:95% !important; display: inline-block; } .addMoreInvoice{ width:5%; display: inline-block; } </style> </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">Add Payment</h4> <ol class="breadcrumb float-right"> <li class="breadcrumb-item ">Contact Manager</li> <li class="breadcrumb-item ">All Contact</li> <li class="breadcrumb-item active">Add Payment</li> </ol> <div class="clearfix"></div> </div> </div> </div> <div class="row"> <div class="col-12"> <div class="clearfix"></div> <h3 style="text-align:center"><b><?php echo $bill_display_name;?></b> <span style="font-weight:200">Invoice Payment</span></h3><br> <div class="clearfix"></div> </div> </div> <!-- end row --> <div class="row "> <div class="col-lg-12"> <div class="card-box"> <form method="post" role="form" id="paymentForm"> <input type="hidden" name="companyId" value="<?php echo $id; ?>"> <div class="row"> <div class="col-md-5"> <div class="selectOption"> <label for="reference">Select Invoice No. <span class="required">*</span></label> <select class="form-control selectpicker" id="selectInvoiceId" name="selectInvoiceId" multiple required> <!--<option value="" selected disabled>-- Select Invoice Id --</option>--> <?php $sql1 = "SELECT * FROM `generate_invoice` where `bill_pay_name` = '$id' AND `data_delete`='NO'"; $result1 = mysqli_query($conn,$sql1); if(mysqli_num_rows($result1) > 0){ while($row1 = mysqli_fetch_array($result1)){ $invoice_row_id = $row1["id"]; $Client_invoice_Id = $row1["invoice_Id"]; $amount_paid = $row1["amount_paid"]; ?> <option value="<?php echo $invoice_row_id;?>"><?php echo $Client_invoice_Id . ' (Invoice Amount : '.$amount_paid.')';?></option> <?php } } ?> </select> </div> </div> <div class="col-md-4"> <div class="form-group"> <label for="payment_mode">Payment Mode <span class="required">*</span></label> <select class="form-control" name="payment_mode" id="payment_mode"> <option value="">-- Select Payment Mode --</option> <option value="Cash">Cash</option> <option value="Cheque">Cheque</option> <option value="Bank Transfer">Bank Transfer</option> <option value="Payment Gateway">Payment Gateway</option> </select> </div> </div> <div class="col-md-3"> <label>Date <span class="required">*</span></label> <input type="text" class="form-control" name="paymentDate" id="paymentDate" value="<?php echo date('Y-m-d') ?>"> </div> </div> <div class="row"> <div class="col-md-4"> <div class="form-group"> <label for="amount">Amount <span class="required">*</span></label> <input type="text" class="form-control" name="amount" id="amount" placeholder="Enter amount"> </div> </div> <div class="col-md-4"> <label for="reference">Invoice No.</label> <input type="text" class="form-control" name="reference" id="reference" placeholder="Enter Invoice no." readonly> </div> <div class="col-md-4"> <label for="reference">Transaction Reference No.</label> <input type="text" class="form-control" name="transaction_reference_no" id="transaction_reference_no" placeholder="Enter Transaction Reference No." readonly> </div> </div> <div class="row"> <div class="col-md-12"> <div class="form-group"> <label for="exampleInputEmail1">Remark <span class="required">*</span></label> <input type="text" class="form-control" name="remark" id="remark" placeholder="Remark"> </div> </div> </div> <div class="form-group"> <input type="hidden" name="Client_invoice_row_Id" id="Client_invoice_row_Id"> <input type="hidden" name="Client_invoice_amt" id="Client_invoice_amt"> <input type="hidden" name="Client_invoice_totalant" id="Client_invoice_totalant"> <button type="button" id="submitForm" class="btn btn-purple waves-effect waves-light">Submit</button> </div> </form> </div> </div> <!-- end col --> </div> </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/jquery/3.3.1/jquery.min.js'></script> --> <script src="https://code.jquery.com/ui/1.10.4/jquery-ui.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 src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>--> <script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.13/js/select2.min.js" ></script> </body> <script> $('#selectInvoiceId').change(function(){ var invoiceRow_ID = $('#selectInvoiceId').val(); //alert(invoiceRow_ID); $.ajax({ type: 'POST', url: 'get-inoice-id.php', data: { invoiceRow_ID: invoiceRow_ID, }, //dataType:"json", success: function (result) { //alert(result); //console.log(result); var data = JSON.parse(result); if (data.status == "true") { // alert(data.msg); $("#reference").val(data.Client_invoice_Id); $("#transaction_reference_no").val(data.Client_invoice_ref_Id); $("#amount").val(data.amount_paid); $("#Client_invoice_row_Id").val(data.Client_invoice_row_Id); $("#Client_invoice_amt").val(data.Client_invoice_amt); $("#Client_invoice_totalant").val(data.amount_paid); } else { alert(data.msg); } } }); }); $('#selectInvoiceId').select2({ theme: 'bootstrap4', placeholder: "Please select Invoice", }); $(document).ready(function() { $("#paymentDate").datepicker({ dateFormat: 'yy-mm-dd' }); }); $("#submitForm").click(function(){ var selectInvoiceRowId = $("#selectInvoiceId").val(); var selectInvoiceId = $("#reference").val(); var transaction_reference_no = $("#transaction_reference_no").val(); var payment_mode = $("#payment_mode").val(); var paymentDate = $("#paymentDate").val(); var amount = $("#amount").val(); var remark = $("#remark").val(); //alert(selectInvoiceId); if(validate()){ if(selectInvoiceRowId !="" && selectInvoiceId != "" && transaction_reference_no !="" && payment_mode != "" && paymentDate != "" && amount != "" && remark != ""){ $.ajax({ url : "PHP/response.php", data : $("#paymentForm").serialize()+"&action=AddPayment&created_by=<?php echo $login; ?>&sourceId=<?php echo $source_id; ?>", method : "POST", async : false, success : function(response){ if(response == 1){ localStorage.setItem("PaymentAdded", "true"); location.replace("contact.php"); } else if(response == 0){ errorMessage("Payment could not be added."); } else{ errorMessage(response); } }, error : function(error){ errorMessage("Payment could not be added1."); } }) }else{ //alert("dfdfgd"); errorToast("Please Input required fields "); return false; } } }) function validate(){ if($("#selectInvoiceId").val() == ""){ $("#selectInvoiceId").css('border', '1px solid red'); $(".select2-container").css('border', '1px solid red !important'); errorToast("Please Select Invoice Id"); $("#selectInvoiceId").focus(); return false; }else{ $("#selectInvoiceId").css('border', '1px solid #ced4da'); $(".select2-container").css('border', '1px solid #ced4da'); } if($("#payment_mode").val() == ""){ $("#payment_mode").css('border', '1px solid red'); errorToast("Please Select payment mode"); $("#payment_mode").focus(); return false; }else{ $("#payment_mode").css('border', '1px solid #ced4da !important'); } if($("#paymentDate").val() == ""){ $("#paymentDate").css('border', '1px solid red'); errorToast("Please enter payment date"); $("#paymentDate").focus(); return false; }else{ $("#paymentDate").css('border', '1px solid #ced4da !important'); } if($("#amount").val() == ""){ $("#amount").css('border', '1px solid red'); errorToast("Please enter amount"); $("#amount").focus(); return false; }else{ $("#amount").css('border', '1px solid #ced4da !important'); } if($("#remark").val() == ""){ $("#remark").css('border', '1px solid red'); errorToast("Please enter remark"); $("#remark").focus(); return false; }else{ $("#remark").css('border', '1px solid #ced4da !important'); } return true; } 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> </html>