D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
thread-self
/
root
/
home
/
shubmkcj
/
urbane.createerp.com
/
Filename :
add-manufacturer-payments.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 manufacturer where id = '$id'"; $result = mysqli_query($conn,$sql); $rowGetAddress = mysqli_fetch_array($result); $manufacturerId = $rowGetAddress["id"]; $manufacturer = $rowGetAddress["manufacturer"]; $manufacturer_display_name = $rowGetAddress["manufacturer_display_name"]; $contactPerson = $rowGetAddress["contact_person_name"]; $contact_person_designation = $rowGetAddress["contact_person_designation"]; $currency = $rowGetAddress["currency"]; ?> <!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 $manufacturer_display_name ;?></b> <span style="font-weight:200">Payments Details</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="formRecordPayment"> <input type="hidden" name="companyId" value="<?php echo $id; ?>"> <div class="row"> <div class="col-md-5"> <div class="selectOption"> <label for="reference">Select PO 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 `purchase_order` where `manufacturer` = '$id' AND `data_delete`='NO'"; $result1 = mysqli_query($conn,$sql1); if(mysqli_num_rows($result1) > 0){ while($row1 = mysqli_fetch_array($result1)){ $row_id = $row1["id"]; $manufacturer_id = $row1["manufacturer"]; $po_id = $row1["po_id"]; $amount_paid = $row1["amount_paind"]; ?> <option value="<?php echo $row_id;?>"><?php echo $po_id ." ". ' (PO 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="payment_date" id="payment_date" 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> <span class="text-danger"><small>( in <?php echo $currency;?> )</small></span></label> <input type="text" class="form-control" name="pay_amt" id="pay_amt" placeholder="Enter amount"> </div> </div> <div class="col-md-4"> <label for="reference">Purchase Order No.</label> <input type="text" class="form-control" name="po_no" id="po_no" placeholder="Enter PO no." readonly> </div> <div class="col-md-4"> <label for="reference">Proforma No.</label> <input type="text" class="form-control" name="po_proforma_id" id="po_proforma_id" placeholder="Enter Transaction Proforma 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> <textarea type="text" class="form-control" name="remark" id="remark" placeholder="Remark" rows="4"></textarea> </div> </div> </div> <div class="form-group"> <input type="hidden" name="po_row_id" id="po_row_id"> <input type="hidden" name="details_payment_amount" id="details_payment_amount"> <input type="hidden" name="manufacturer_id" id="manufacturer_id" value="<?php echo $id;?>"> <button type="button" id="btnRecordPayment" 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-po-details.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); $("#pay_amt").val(data.amount_paid); $("#po_no").val(data.po_id); $("#po_proforma_id").val(data.proforma_id); $("#po_row_id").val(data.po_row_Ids); $("#details_payment_amount").val(data.client_po_amt); } else { alert(data.msg); } } }); }); $('#selectInvoiceId').select2({ theme: 'bootstrap4', placeholder: "Please select Invoice", }); $(document).ready(function() { $("#paymentDate").datepicker({ dateFormat: 'yy-mm-dd' }); }); $("#btnRecordPayment").click(function(){ var selectInvoiceRowId = $("#selectInvoiceId").val(); var po_id = $("#po_no").val(); var proforma_id = $("#proforma_id").val(); var payment_mode = $("#payment_mode").val(); var paymentDate = $("#payment_date").val(); var amount = $("#pay_amt").val(); var remark = $("#remark").val(); //alert(selectInvoiceId); if(validate()){ if(selectInvoiceRowId !="" && po_id != "" && proforma_id !="" && payment_mode != "" && paymentDate != "" && amount != "" && remark != ""){ $.ajax({ url : "PHP/response.php", data : $("#formRecordPayment").serialize()+"&action=recordPoPayment&createdBy=<?php echo $_SESSION["login_email"]; ?>&sourceId=<?php echo $source_id; ?>", method : "POST", async : false, beforeSend: function () { $("#btnRecordPayment").prop('disabled', true); // disable button $("#btnRecordPayment").text('Please Wait...'); // disable button }, success : function(response){ if(response == 1){ localStorage.setItem("PaymentAdded", "true"); location.replace("manufacturer.php"); } else if(response == 0){ errorMessage("Payment could not be added."); } else{ $('#btnRecordPayment').prop('disabled', false); errorMessage(response); } }, complete: function () { $("#btnRecordPayment").prop('disabled', false); // disable button $("#btnRecordPayment").text('Submit'); // disable button }, 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($("#payment_date").val() == ""){ $("#payment_date").css('border', '1px solid red'); errorToast("Please enter payment date"); $("#payment_date").focus(); return false; }else{ $("#payment_date").css('border', '1px solid #ced4da !important'); } if($("#pay_amt").val() == ""){ $("#pay_amt").css('border', '1px solid red'); errorToast("Please enter amount"); $("#pay_amt").focus(); return false; }else{ $("#pay_amt").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' }); } $(document).ready(function(){ if (localStorage.getItem("poInserted") == "true") { successMessage("Purchase Order Successfully Created."); localStorage.setItem("poInserted", "false"); } if (localStorage.getItem("deletePurchase") == "true") { successMessage("Purchase Order Successfully Deleted."); localStorage.setItem("deletePurchase", "false"); } if (localStorage.getItem("PaymentAdded") == "true") { successMessage("Payment Successfully Saved."); localStorage.setItem("PaymentAdded", "false"); } }); </script> </html>