D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
thread-self
/
root
/
home
/
shubmkcj
/
urbane.createerp.com
/
Filename :
view-search-company-invoice.php
back
Copy
<!DOCTYPE html> <?php session_start(); $id = $_GET['id']; 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']; } $contactId = ""; $companyName = ""; $contactPerson = ""; $designation = ""; $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"]; } } function create_slug($string){ $slug=strtolower(preg_replace('/[^A-Za-z0-9-]+/', '-', $string)); return $slug; } ?> <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> <style> #view_allpayment_status .openModel{ } .tabcontent { display: none; padding: 6px 12px; border: 1px solid #ccc; border-top: none; } #invoiceTablesdks td:last-child{ width:150px; } @media (min-width: 1200px){ .modal-xl { max-width: 1140px; }} </style> <!-- 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"><a href="/payment-status.php" style="color:#fff"><i class="fa fa-backward" aria-hidden="true"></i> Back To Payments</a></h4> <ol class="breadcrumb float-right"> <li class="breadcrumb-item ">Payments</li> <li class="breadcrumb-item active">Invoice</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="invoiceTablesdks" class="table table-bordered table-striped"> <thead> <tr class="theme-bg"> <th colspan="8"><h4 class="text-center text-white" style="margin:0"><?php echo $bill_display_name; ?></h4></th> </tr> <tr class="theme-bg"> <th>#</th> <th>Date</th> <th class="text-center">Proforma Id</th> <th class="text-center">Invoice Id</th> <th class="text-center">Invoice Reference Id</th> <th class="text-center">Bill Amount</th> <th class="text-center">Payment received</th> <th class="text-center">Balance</th> </tr> </thead> <tbody> <?php $serNo=0; $totatAmt=0; $total_bill_amount=0.00; $total_amt_recive=0.00; $totalDebit = 0.00; $sqlGetDebit = "SELECT amount, tax_deduction FROM payment where company_id = '$id' AND transaction_type = 'Debit'"; // echo $sqlGetDebit; $resultGetDebit = mysqli_query($conn,$sqlGetDebit); if(mysqli_num_rows($resultGetDebit) > 0){ while($row = mysqli_fetch_array($resultGetDebit)){ $totalDebit += $row["amount"]+ $row["tax_deduction"]; } } // $totalCredit = 0.00; // $sqlGetCredit = "SELECT amount FROM payment where company_id = '$id' AND transaction_type = 'Credit' "; // // echo $sqlGetCredit; // $resultGetCredit = mysqli_query($conn,$sqlGetCredit); // if(mysqli_num_rows($resultGetCredit) > 0){ // while($row = mysqli_fetch_array($resultGetCredit)){ // $totalCredit += $row["amount"] + $row["tax_deduction"]; // } // } // $totalCredit = sprintf('%0.2f', $totalCredit); // $totalCredit; // $availableCredit = $totalCredit - $totalDebit; // $availableCredit = sprintf('%0.2f', $availableCredit); $sqlAssign1 = "SELECT * FROM `generate_invoice` where `bill_pay_name`='$id' AND data_delete != 'yes' order by id desc"; $resultAssign1 = mysqli_query($conn, $sqlAssign1); if (mysqli_num_rows($resultAssign1) > 0) { while($rows = mysqli_fetch_assoc($resultAssign1)) { $aa=$rows['date']; $bb=$rows['proforma_id']; $cc=$rows['invoice_Id']; $dd=$rows['invoice_reference']; $ee=$rows['amount_paid']; $bank_charge=$rows['bank_charge']; $bill_pay_name=$rows['bill_pay_name']; $totatAmt=($totatAmt+$ee); $parts1 = explode("/", $cc); $result1 = implode(' / ', $parts1); $parts2 = explode("/", $dd); $result2 = implode(' / ', $parts2); $sqlqw = "SELECT a.*, b.bill_display_name FROM payment a left join contact b on a.company_id = b.id where a.is_deleted != 'YES' AND transaction_type = 'Credit' AND a.reference = '$cc' "; $resultqw = mysqli_query($conn,$sqlqw); while( $rowqw = mysqli_fetch_array($resultqw)){ $cred_amt=$rowqw['amount']; } $totalCredit = 0.00; $sqlGetCredit = "SELECT amount FROM payment where company_id = '$bill_pay_name' AND transaction_type = 'Credit' "; // echo $sqlGetCredit; $resultGetCredit = mysqli_query($conn,$sqlGetCredit); if(mysqli_num_rows($resultGetCredit) > 0){ while($row = mysqli_fetch_array($resultGetCredit)){ $totalCredit += $row["amount"] + $row["tax_deduction"]; } } $remain_balance=sprintf('%0.2f',($totatAmt-$cred_amt)); $total_bill_amount=$total_bill_amount+$totatAmt; $total_amt_recive=$total_amt_recive+$cred_amt; $total_amt_balnce=$total_amt_balnce+$remain_balance; ?> <tr class="gradeX"> <td><?php echo $serNo+=1;?></td> <td><?php echo $aa;?></td> <td><?php echo $bb;?></td> <td class="text-center"><?php echo $result1 ;?></td> <td class="text-center"><?php echo $result2;?></td> <td class="text-center"><?php echo sprintf('%0.2f',($totatAmt)) ;?></td> <td class="text-center"><?php echo sprintf('%0.2f',($cred_amt));?></td> <td class="text-center"><?php echo $remain_balance;?></td> </tr> <?php }}?> <!-- <tr class="gradeX">--> <!-- <td></td>--> <!-- <td></td>--> <!-- <td></td>--> <!-- <td class="text-center"></td> --> <!-- <td class="text-center">Total</td>--> <!-- <td class="text-center"><?php echo $totatAmt;?></td>--> <!--</tr>--> </tbody> <tfoot> <tr class="theme-bg"> <th></th> <th></th> <th></th> <th></th> <th></th> <th style="text-align:center; font-weight:800; font-size: 16px;"><?php echo sprintf('%0.2f',($total_bill_amount)) ;?></th> <th style="text-align:center; font-weight:800; font-size: 16px;"><?php echo sprintf('%0.2f',($total_amt_recive));?></th> <th style="text-align:center; font-weight:800; font-size: 16px;"><?php echo sprintf('%0.2f',($total_amt_balnce));?></th> </tr> <!--<tr>--> <!-- <th></th>--> <!-- <th></th>--> <!-- <th></th>--> <!-- <th></th>--> <!-- <th style="text-align:right; font-weight:400">Total Credit:</th>--> <!-- <th style="text-align:center; font-weight:800; font-size: 16px;"><?php echo "$ ".$totalCredit;?></th>--> <!--</tr>--> <!--<tr>--> <!-- <th></th>--> <!-- <th></th>--> <!-- <th></th>--> <!-- <th></th>--> <!-- <th style="text-align:right; font-weight:400">Balance</th>--> <!-- <th style="text-align:center; font-weight:800; font-size: 16px;"><?php echo "$ ".$remain_balance;?></th>--> <!--</tr>--> </tfoot> </table> </div> </div> <!-- end: page --> </div> </div> <!-- container --> </div> </div> <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="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>--> <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 --> <!-- 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"> var $ = jQuery; // $(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() { // $('#view_allemployer').DataTable( { // dom: 'Bfrtip', // buttons: [ 'copy', 'csv', 'excel', 'pdf', 'print' ] // } ); $('#invoiceTablesdks1').DataTable({ // dom: 'Bfrtip', dom: "<'row'<'col-sm-4'l><'col-sm-4 text-center'B><'col-sm-4'f>>tp", "lengthMenu": [ [10, 25, 50, -1], [10, 25, 50, "All"] ], buttons: [{ extend: 'copy', footer: true, title: 'allInvoiceData', className: 'btn-sm' }, { extend: 'csv', footer: true, title: 'allInvoiceData', className: 'btn-sm', }, { extend: 'excel', footer: true, title: 'allInvoiceData', className: 'btn-sm' }, { extend: 'pdf', footer: true, exportOptions: { columns: ':visible' }, title: 'allInvoiceData', className: 'btn-sm' }, { extend: 'print', footer: true, exportOptions: { columns: ':visible' }, title: 'allInvoiceData', className: 'btn-sm' } ] }); }); $(document).ready(function() { $('#invoiceTablesdks').DataTable( { dom: "<'row'<'col-sm-4'l><'col-sm-4 text-center'B><'col-sm-4'f>>tp", "lengthMenu": [ [10, 25, 50, -1], [10, 25, 50, "All"] ], buttons: [{ extend: 'copy', footer: true, title: '<?php echo create_slug($bill_display_name);?>', className: 'btn-sm' }, { extend: 'csv', footer: true, title: '<?php echo create_slug($bill_display_name);?>', className: 'btn-sm' }, { extend: 'excel', footer: true, title: '<?php echo create_slug($bill_display_name);?>', className: 'btn-sm' }, { extend: 'pdf', footer: true, title: '<?php echo create_slug($bill_display_name);?>', className: 'btn-sm' }, { extend: 'print', footer: true, title: '<?php echo create_slug($bill_display_name);?>', className: 'btn-sm' } ], "footerCallback": function ( row, data, start, end, display ) { var api = this.api(), data; // Remove the formatting to get integer data for summation var intVal = function ( i ) { return typeof i === 'string' ? i.replace(/[\$,]/g, '')*1 : typeof i === 'number' ? i : 0; }; // // Total over all pages // total = api // .column( 5 ) // .data() // .reduce( function (a, b) { // return intVal(a) + intVal(b); // }, 0 ); // // Total over this page // pageTotal = api // .column( 5, { page: 'current'} ) // .data() // .reduce( function (a, b) { // return intVal(a) + intVal(b); // }, 0 ); // // Update footer // $( api.column( 5 ).footer() ).html( // '$ '+"<?php echo $totatAmt;?>" // ); } } ); } ); </script> </body> </html>