D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
thread-self
/
root
/
home
/
shubmkcj
/
urbane.createerp.com
/
Filename :
view-delete-invoice.php
back
Copy
<!DOCTYPE html> <?php session_start(); include 'config.php'; $login = $_SESSION['login_email']; if($login = ''){ echo '<script>location.replace("index.php")</script>'; } if(isset($_SESSION["source_id"])){ $source_id = $_SESSION['source_id']; } function getPaidAmount($conn, $referenceId){ $amount = 0.00; $sqlGetPaidAmount = "SELECT amount, tax_deduction FROM payment WHERE reference = '$referenceId' AND transaction_type = 'Debit'"; $resultGetPaidAmount = mysqli_query($conn, $sqlGetPaidAmount); if($resultGetPaidAmount){ if(mysqli_num_rows($resultGetPaidAmount) > 0){ while($rowGetPaidAmount = mysqli_fetch_assoc($resultGetPaidAmount)){ $amount += $rowGetPaidAmount["amount"] + $rowGetPaidAmount["tax_deduction"]; } } } $amount = sprintf('%0.2f', $amount); return $amount; } ?> <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" /> <!-- DataTables --> <link href="plugins/datatables/dataTables.bootstrap4.min.css" rel="stylesheet" type="text/css" /> <link href="plugins/datatables/buttons.bootstrap4.min.css" rel="stylesheet" type="text/css" /> <!-- Responsive datatable examples --> <link href="plugins/datatables/responsive.bootstrap4.min.css" rel="stylesheet" type="text/css" /> <script src="assets/js/modernizr.min.js"></script> <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">Deleted Invoice</h4> <ol class="breadcrumb float-right"> <li class="breadcrumb-item"><a href="#">Sales</a></li> <li class="breadcrumb-item active">Trash</li> </ol> <div class="clearfix"></div> </div> </div> </div> <!-- end row --> <div class="row"> <div class="col-sm-12"> <div class="card-box table-responsive"> <table id="datatable" class="table table-bordered"> <thead> <tr class="bg-grey"> <th>Date</th> <th>Proforma Id</th> <th>Invoice Id</th> <th>Invoice Reference Id</th> <th>Bill Pay Name</th> <th class="text-center">Status</th> <th>Total Amount</th> <th>Due Date</th> <th class="text-center">Actions</th> </tr> </thead> <tbody> <?php $sql = "SELECT * FROM `generate_invoice` where data_delete = 'yes'"; $result = mysqli_query($conn,$sql); while( $row = mysqli_fetch_array($result)){ $status = ""; $status1 = ""; $helping_id = $row['bill_pay_name']; $get_bpn = mysqli_query($conn,"SELECT * FROM `contact` where id='$helping_id'"); $get_bpn_row = mysqli_fetch_assoc($get_bpn); $final_bill_pay_name = $get_bpn_row['bill_display_name']; $paidAmount = getPaidAmount($conn, $row['invoice_Id']); if($row['data_delete'] == "cancel"){ $status = "<a class='btn btn-danger btn-xs'>Cancelled</a>"; $status1 = "Cancelled"; }else{ if($row['amount_paid'] <= $paidAmount){ $status = "<a class='btn btn-success btn-xs'>Paid</a>"; $isPaid = true; $status1 = "Paid"; } else if($row['amount_paid'] > $paidAmount && $paidAmount > 0){ $status = "<a class='btn btn-primary btn-xs'>Partial Paid</a>"; } else{ if(strtotime($row['due_date']) < strtotime(date('Y-m-d'))){ $status = "<a class='btn btn-warning btn-xs'>Overdue</a>"; } else{ $status = "<a class='btn btn-info btn-xs'>Pending</a>"; } } } ?> <tr class="gradeX" style='font-size:13px'> <td><?php echo $row['date']; ?></td> <td><?php echo $row['proforma_id']; ?></td> <td><?php echo $row['invoice_Id']; ?></td> <td><?php echo $row['invoice_reference']; ?></td> <td><?php echo $final_bill_pay_name ?></td> <td class="text-center"><?php echo $status; ?></td> <td><?php echo $row['amount_paid']; ?></td> <td><?php echo $row['due_date']; ?></td> <td class="actions text-center"> <button type="button" class="btn btn-xs btn-success" data-toggle="tooltip" data-placement="top" title="" data-original-title="Restore" value="<?php echo $row['id'] ?>" onclick="restoreInvoice(this)"><i class="fa fa-window-restore"></i></button> <!--<button type="button" class="btn btn-xs btn-danger" data-toggle="tooltip" data-placement="top" title="" data-original-title="Permanent Delete" value="<?php // echo $row['id'] ?>" onclick="permanentDelete(this)"><i class="fa fa-trash-o"></i></button>--> </td> </tr> <?php } ?> </tbody> </table> </div> </div> <!-- end: page --> </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> --> <!-- Required datatable js --> <script src="plugins/datatables/jquery.dataTables.min.js"></script> <script src="plugins/datatables/dataTables.bootstrap4.min.js"></script> <!-- Buttons examples --> <script src="plugins/datatables/dataTables.buttons.min.js"></script> <script src="plugins/datatables/buttons.bootstrap4.min.js"></script> <script src="plugins/datatables/jszip.min.js"></script> <script src="plugins/datatables/pdfmake.min.js"></script> <script src="plugins/datatables/vfs_fonts.js"></script> <script src="plugins/datatables/buttons.html5.min.js"></script> <script src="plugins/datatables/buttons.print.min.js"></script> <script src="plugins/datatables/buttons.colVis.min.js"></script> <!-- Responsive examples --> <script src="plugins/datatables/dataTables.responsive.min.js"></script> <script src="plugins/datatables/responsive.bootstrap4.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 type="text/javascript"> $(document).ready(function() { $('#datatable').DataTable(); //Buttons examples var table = $('#datatable-buttons').DataTable({ lengthChange: false, buttons: ['copy', 'excel', 'pdf', 'colvis'] }); table.buttons().container().appendTo('#datatable-buttons_wrapper .col-md-6:eq(0)'); }); $(document).ready(function(){ if (localStorage.getItem("InvoiceRestored") == "true") { successMessage("Invoice Successfully restored."); localStorage.setItem("InvoiceRestored", "false"); } if (localStorage.getItem("InvoiceDeleted") == "true") { successMessage("Invoice Successfully permanently deleted."); localStorage.setItem("InvoiceDeleted", "false"); } }); function restoreInvoice(button){ var invoiceId = $(button).val(); swal({ title: 'Are you sure?', text: "Do you really want to restore this Invoice??", type: 'warning', showCancelButton: true, confirmButtonColor: '#4fa7f3', cancelButtonColor: '#d57171', confirmButtonText: "Yes, I'm Sure!" }).then(function () { $.ajax({ url : "PHP/response.php", data : "action=RestoreInvoice&invoiceId="+invoiceId, method : "POST", async : false, success : function(response){ if(response == "RESTORED"){ localStorage.setItem("InvoiceRestored", "true"); location.reload(); } else{ errorMessage("Invoice could not be restored."); } }, error : function(error){ errorMessage("Invoice could not be restored."); } }); }); } function permanentDelete(button){ var invoiceId = $(button).val(); swal({ title: 'Are you sure?', text: "Do you really want to delete this Invoice??", type: 'warning', showCancelButton: true, confirmButtonColor: '#4fa7f3', cancelButtonColor: '#d57171', confirmButtonText: "Yes, I'm Sure!" }).then(function () { $.ajax({ url : "PHP/response.php", data : "action=PermanentDeleteInvoice&invoiceId="+invoiceId, method : "POST", async : false, success : function(response){ if(response == "DELETED"){ localStorage.setItem("InvoiceDeleted", "true"); location.reload(); } else{ errorMessage("Invoice could not be deleted."); } }, error : function(error){ errorMessage("Invoice could not be deleted."); } }); }); } 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>