D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
thread-self
/
root
/
proc
/
thread-self
/
root
/
home
/
shubmkcj
/
urbane.createerp.com
/
Filename :
in-out-report.php
back
Copy
<?php ob_start(); session_start(); include 'config.php'; $login = $_SESSION['login_email']; if($login == ''){ echo '<script>location.replace("index.php")</script>'; } ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>IN Out Payments Report</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 rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.5/css/select2.min.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="plugins/sweet-alert2/sweetalert2.min.css" rel="stylesheet" type="text/css"> <link href="plugins/jquery-toastr/jquery.toast.min.css" rel="stylesheet" /> <link href="https://code.jquery.com/ui/1.10.4/themes/ui-lightness/jquery-ui.css" rel="stylesheet"> <!-- 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" /> <style> .chatTable p{ margin-bottom:0; } .chatTable{ width:100%; } .chatTable tr:nth-child(odd) td{ text-align:left; color:#000; } .chatTable tr:nth-child(odd) td .chatInner{ background-color: #eaeaea; color:#000; margin-bottom:3px; } .chatTable tr:nth-child(even) td{ text-align:right; } .chatTable tr td .chatInner{ padding:5px; } .charDetails{ padding-left:15px; } .chatUser{ text-decoration: underline; } .chatUser em{ font-weight:800; } .table th, .table td{ text-align:center; } .table td:nth-child(1){ width:5%; } .table td:nth-child(2){ width:10%; } .table td:nth-child(3){ width:15%; } .table td:nth-child(4){ width:20%; } .table td:nth-child(5){ width:10%; } .table td:nth-child(6){ width:35%; } .table td:last-child{ width:5%; vertical-align: middle; } .comment_butn{ font-size: 10px; padding: 5px !important; } </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">IN Out Payments Generate Report</h4> <ol class="breadcrumb float-right"> <li class="breadcrumb-item"><a href="#">Sales</a></li> <li class="breadcrumb-item active">Generate Report</li> </ol> <div class="clearfix"></div> </div> </div> </div> <!-- end row --> <div class="row "> <div class="col-md-12 card-box" style=" margin: 0 auto;padding: 20px;"> <form action="" method="post" role="form" id="myform"> <!--<form action="invoice-report-download.php" method="post" role="form">--> <div class="row"> <div class="col-md-4"> <div class="form-group"> <label for="exampleInputPassword1">From Date <span class="text-danger">*</span></label> <input type="text" class="form-control" id="fromdate" name="fromdate" required> </div> </div> <div class="col-md-4"> <div class="form-group"> <label for="exampleInputPassword1">To Date <span class="text-danger">*</span></label> <input type="text" class="form-control" id="todate" name="todate" required> </div> </div> <div class="col-md-4"><p style="line-height: 1;"><br></p> <input type="hidden" value="in_out_report" name="report"> <button name="submit" type="submit" id="btnSubmit" class="btn btn-purple waves-effect waves-light">Submit</button> <!--<button type="submit" class="btn btn-purple waves-effect waves-light w-100">Report</button> --> </div> </div> </form> </div> <!-- end col --> </div> <?php if (isset($_POST['submit'])) { $rowCount = 2; $i = 1; $pro_totalAmt=0; $inv_other_chges=0; $inv_bank_chages=0; $totalPoAmtPaid=0; $totalPoBillAmtPaid=0; $amount_paid_iv=0; $totalInvoiceAmtPaid=0; $po_payment1=0; $iv_payment1=0; $totalivAmtPaid=0; $report_type = $_POST["report"]; $fromdate = $_POST["fromdate"]; $todate = $_POST["todate"]; $bill_pay_name = $_POST['bill_pay_name']; $from = date("Y-m-d", strtotime($fromdate)); $to = date("Y-m-d", strtotime($todate)); $from_date = date_create($_POST["fromdate"]); $to_date = date_create($_POST["todate"]); $form_formate_date = date_format($from_date,"Y-m-d"); $to_formate_date = date_format($to_date,"Y-m-d"); ?> <div class="row" id="showReport" > <br> <div class="col-sm-12" style="text-align:center"> <h4>Report Generate from <?php echo $fromdate;?> To <?php echo $todate;?> <br> <p><small class="text-success">(Amount in USD)</small></p> </h4> </div> <br> <div class="col-sm-12"> <div class="card-box table-responsive"> <table id="view_proforma_tracking" class="table table-bordered table-striped"> <thead> <tr class="theme-bg"> <th>PI NO</th> <th>PI Date</th> <th>PI Value</th> <th>Client Name</th> <th>PO No</th> <th>PO Date</th> <th>PO Issue to</th> <th>PO Value</th> <th>Payment to Vendor</th> <th>PO Payment Date</th> <th>Invoice No</th> <th>Invoice Date</th> <th>Invoice Value</th> <th>Client Name</th> <th>Payment Received</th> <th>Payment Date</th> <th>Remarks, if any</th> </tr> </thead> <tbody> <?php // if (date("Y-m-d", strtotime($row["date"])) >= $from && date("Y-m-d", strtotime($row["date"])) <= $to) // $sql='SELECT * FROM `proforma` WHERE STR_TO_DATE(`date`, "%d %M %Y") BETWEEN "2021-11-01" AND "2021-11-24" AND data_delete != "yes" ORDER BY STR_TO_DATE(date,"%d %M %Y") ASC'; $sql = 'SELECT * FROM `proforma` WHERE STR_TO_DATE(`date`, "%d %M %Y") BETWEEN "'.$form_formate_date.'" AND "'.$to_formate_date.'" AND data_delete != "yes" ORDER BY STR_TO_DATE(date,"%d %M %Y") ASC'; $result = $conn->query($sql) or die(mysqli_error($conn)); if (mysqli_num_rows($result) > 0) { while ($row = mysqli_fetch_assoc($result)) { $status = ""; if ($row["data_delete"] == "cancel") { $status = "Cancelled"; } $helping_id = $row['bill_pay_name']; $proforma_id = $row['proforma_id']; $proforma_date = $row['date']; $p_bank_chages=$row["bank_charge"]; $amount_paid = sprintf('%0.2f', $row["amount_paid"]); if($p_bank_chages>0){ $amount_paid=$amount_paid-$p_bank_chages; } $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']; $pro_totalAmt+=$amount_paid; ?> <tr class="gradeX"> <td><?php echo $proforma_id;?></td> <td ><?php echo $proforma_date;?></td> <td><?php echo $amount_paid;?></td> <td><?php echo ucwords(strtolower($final_bill_pay_name));?> </td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr> <?php $query_c="SELECT * FROM `conversion_rate` ORDER BY `conversion_rate`.`id` DESC LIMIT 1"; $result_c = mysqli_query($conn, $query_c); $row_c = mysqli_fetch_assoc($result_c); $last_rmb = $row_c["rmb"]; $sql_po = "SELECT * FROM `purchase_order` WHERE `purchase_order`.`proforma_id`='$proforma_id' AND `data_delete` != 'yes'"; $result_po = $conn->query($sql_po) or die(mysqli_error($conn)); $po_rowcount=mysqli_num_rows($result_po); if (mysqli_num_rows($result_po) > 0){ while ($row_po = mysqli_fetch_assoc($result_po)){ $po_id = $row_po["po_id"]; $po_order_date = $row_po["order_date"]; $po_manufacturer_id = $row_po['manufacturer']; $po_amt_in_usd = $row_po['amt_in_usd']; $po_sub_total_amt_in_usd = $row_po['sub_total_amt_in_usd']; $po_sub_total = sprintf('%0.2f', $row_po["subtotal_price"]); $po_b_chagred=$row_po["bank_charges"]; $po_amount_paid = $row_po["amount_paind"]; $po_proforma_id = $row_po["proforma_id"]; $po_sqlGetPayment = "SELECT * FROM `purchase_order_payments` WHERE `po_no` = '$po_id'"; $po_resultGetPayment = $conn->query($po_sqlGetPayment); $po_payments_rowcount=mysqli_num_rows($po_resultGetPayment); $po_get_bpn = mysqli_query($conn, "SELECT * FROM `manufacturer` where id='$po_manufacturer_id'"); $po_get_bpn_row = mysqli_fetch_assoc($po_get_bpn); $po_final_bill_pay_name = $po_get_bpn_row['manufacturer_display_name']; $po_currency = $po_get_bpn_row['currency']; if($po_currency=='RMB'){ $last_rmb=$last_rmb; }else{ $last_rmb=1; } if($po_amt_in_usd==''){ $po_amount_paid=$po_amount_paid/$last_rmb; }else{ $po_amount_paid=$po_amt_in_usd; } $po_amount_paid=sprintf('%0.2f', $po_amount_paid); $totalPoBillAmtPaid=$totalPoBillAmtPaid+$po_amount_paid; if($po_payments_rowcount>1){ ?> <tr class="gradeX"> <td></td> <td ></td> <td></td> <td></td> <td><?php echo $po_id;?></td> <td><?php echo $po_order_date;?></td> <td><?php echo $po_final_bill_pay_name;?></td> <td><?php echo $po_amount_paid;?></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr> <?php while ($po_row_payments = mysqli_fetch_assoc($po_resultGetPayment)){ $po_payment_amt = $po_row_payments["amount"]; $po_payment_in_usd = $po_row_payments["amount_in_usd"]; $po_payment_date1 = $po_row_payments["payment_date"]; $po_payment_poId = $po_row_payments["po_no"]; if($po_payment_in_usd==''){ $po_payment1 = $po_payment_amt/$last_rmb; }else{ $po_payment1=$po_payment_in_usd; } $po_payment1=sprintf('%0.2f', $po_payment1); $totalPoAmtPaid+=$po_payment1; $temp_date = date_create($po_payment_date1); $po_payment_date1 = date_format($temp_date,"j F Y"); ?> <tr class="gradeX"> <td></td> <td ></td> <td></td> <td></td> <td><?php echo $po_payment_poId;?></td> <td></td> <td></td> <td></td> <td><?php echo $po_payment1;?></td> <td><?php echo $po_payment_date1;?></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr> <?php } }else{ if($po_payments_rowcount==0){ $po_payment1=""; $po_payment_date1=""; }elseif($po_payments_rowcount==1){ $po_row_payments = mysqli_fetch_assoc($po_resultGetPayment); $po_payment_amt = $po_row_payments["amount"]; $po_payment_in_usd = $po_row_payments["amount_in_usd"]; $po_payment_date1 = $po_row_payments["payment_date"]; if($po_payment_in_usd==''){ $po_payment1 = $po_payment_amt/$last_rmb; }else{ $po_payment1=$po_payment_in_usd; } $po_payment1=sprintf('%0.2f', $po_payment1); $totalPoAmtPaid+=$po_payment1; $temp_date = date_create($po_payment_date1); $po_payment_date1 = date_format($temp_date,"j F Y"); } ?> <tr class="gradeX"> <td></td> <td ></td> <td></td> <td></td> <td><?php echo $po_id;?></td> <td><?php echo $po_order_date;?></td> <td><?php echo $po_final_bill_pay_name;?></td> <td><?php echo $po_amount_paid;?></td> <td><?php echo $po_payment1;?></td> <td><?php echo $po_payment_date1;?></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr> <?php } }} $sql_iv = "SELECT * FROM `generate_invoice` WHERE `generate_invoice`.`proforma_id`='$proforma_id' AND `data_delete` != 'yes' AND `marge_status`!='yes'"; $result_iv = $conn->query($sql_iv) or die(mysqli_error($conn)); if (mysqli_num_rows($result_iv) > 0){ while ($row_iv = mysqli_fetch_assoc($result_iv)){ $invoice_iv = $row_iv["invoice_Id"]; $helping_id_iv = $row_iv['bill_pay_name']; $date_iv = $row_iv['date']; $get_bpn_iv = mysqli_query($conn, "SELECT * FROM `contact` where id='$helping_id'"); $get_bpn_row_iv = mysqli_fetch_assoc($get_bpn_iv); $final_bill_pay_name_iv = $get_bpn_row_iv['bill_display_name']; $sub_total_iv = sprintf('%0.2f', $row_iv["sub_total"]); $b_chagred_iv=$row_iv["bank_charge"];; $amount_paid_iv = sprintf('%0.2f', $row_iv["amount_paid"]); if($b_chagred_iv>0){ $amount_paid_iv=$amount_paid_iv-$b_chagred_iv; } $totalInvoiceAmtPaid+=$amount_paid_iv; $sqlGetInvoicePayment = "SELECT * FROM `payment` WHERE `reference` = '$invoice_iv' AND `transaction_type` = 'Credit' AND `is_deleted` !='yes'"; $resultGetInvoicePayment = $conn->query($sqlGetInvoicePayment); $rowcountInvoucePayment=mysqli_num_rows($resultGetInvoicePayment); if($rowcountInvoucePayment>1){ ?> <tr class="gradeX"> <td></td> <td ></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td><?php echo $invoice_iv;?></td> <td><?php echo $date_iv;?></td> <td><?php echo $amount_paid_iv;?></td> <td><?php echo ucwords(strtolower($final_bill_pay_name_iv));?></td> <td></td> <td></td> <td></td> </tr> <?php while ($iv_row_payments = mysqli_fetch_assoc($resultGetInvoicePayment)){ $iv_payment1 = $iv_row_payments["amount"]; $iv_tax_deduction = $iv_row_payments["tax_deduction"]; $iv_payment_date1 = $iv_row_payments["payment_date"]; $iv_invoiceId1 = $iv_row_payments["reference"]; $iv_payment1=sprintf('%0.2f', $iv_payment1); $totalivAmtPaid+=$iv_payment1; $temp_iv_date = date_create($iv_payment_date1); $iv_payment_date1 = date_format($temp_iv_date,"j F Y"); ?> <tr class="gradeX"> <td></td> <td ></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td><?php echo $iv_invoiceId1;?></td> <td></td> <td></td> <td></td> <td><?php echo $iv_payment1;?></td> <td><?php echo $iv_payment_date1;?></td> <td></td> </tr> <?php } }else{ if($rowcountInvoucePayment==0){ $iv_payment1=""; $iv_payment_date1=""; }elseif($rowcountInvoucePayment==1){ $iv_row_payments = mysqli_fetch_assoc($resultGetInvoicePayment); $iv_payment1 = $iv_row_payments["amount"]; $iv_tax_deduction = $iv_row_payments["tax_deduction"]; $iv_payment_date1 = $iv_row_payments["payment_date"]; $iv_payment1=sprintf('%0.2f', $iv_payment1); $totalivAmtPaid+=$iv_payment1; $temp_iv_date = date_create($iv_payment_date1); $iv_payment_date1 = date_format($temp_iv_date,"j F Y"); } ?> <tr class="gradeX"> <td></td> <td ></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td><?php echo $invoice_iv;?></td> <td><?php echo $date_iv;?></td> <td><?php echo $amount_paid_iv;?></td> <td><?php echo ucwords(strtolower($final_bill_pay_name_iv));?></td> <td><?php echo $iv_payment1;?></td> <td><?php echo $iv_payment_date1;?></td> <td></td> </tr> <?php } } } } }?> <tr class="gradeX"> <td>Total</td> <td></td> <td><b><?php echo $pro_totalAmt;?></b></td> <td> </td> <td></td> <td></td> <td></td> <td><b><?php echo $totalPoBillAmtPaid;?></b></td> <td><b><?php echo $totalPoAmtPaid;?></b></td> <td></td> <td></td> <td></td> <td><b><?php echo $totalInvoiceAmtPaid; ?></b></td> <td></td> <td><b><?php echo $totalivAmtPaid;?></b></td> <td></td> <td></td> </tr> </tbody> </table> </div> </div> <!-- end: page --> </div> <?php }?> </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> <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='https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.5/js/select2.min.js'></script> <!-- Chart Js --> <!-- <script src="assets/pie charts/script.js"></script> --> <script src="plugins/sweet-alert2/sweetalert2.min.js"></script> <script src="plugins/jquery-toastr/jquery.toast.min.js" type="text/javascript"></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> $('#view_proforma_tracking').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"] ], "order": [], buttons: [{ extend: 'copy', title: 'report_From_<?php echo $fromdate ."_To_".$todate;?>', className: 'btn-sm' }, { extend: 'csv', title: 'report_From_<?php echo $fromdate ."_To_".$todate;?>', className: 'btn-sm' }, { extend: 'excel', title: 'report_From_<?php echo $fromdate ."_To_".$todate;?>', className: 'btn-sm' }, { extend: 'pdf', title: 'report_From_<?php echo $fromdate ."_To_".$todate;?>', className: 'btn-sm' }, { extend: 'print', title: 'report_From_<?php echo $fromdate ."_To_".$todate;?>', className: 'btn-sm' } ] }); $(document).ready(function(){ $("#reporttype").change(function() { var Customer_Value = $('option:selected', this).text(); if(Customer_Value == "Customer"){ $(".customer_input").css({"display":"block"}); } else{ $(".customer_input").css({"display":"none"}); } }); }); $(document).ready(function() { $('.select').select2(); }); $(document).ready(function(){ if (localStorage.getItem("TaxSaved") == "true") { successMessage("Tax Successfully Updated."); localStorage.setItem("TaxSaved", "false"); } }); 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() { var today = new Date(); $("#fromdate,#todate").datepicker({ dateFormat: 'dd MM yy', maxDate: today }); }); $(document).ready(function(){ $("#fromdate").datepicker("setDate", new Date()); $("#todate").datepicker("setDate", new Date()); }); function showUser(str) { $.ajax({ url: "getCustomerAddress.php?companyId=" + str, method: "GET", async: false, success: function(response) { $(".billingAddress").html(response); }, error: function(jqXHR, textStatus, errorThrown) { alert('Internal error: ' + jqXHR.responseText); } }) } </script> </body> </html>