<?php  
session_start(); 
if(!isset($_SESSION['linkarisecrm']))
	{
		header('Location: index.php');
		return;
	}
include("connect.php");	

date_default_timezone_set("Asia/Singapore");
	$mdate= date('Y/m/d');
	$mdate1= date('d-m-y h:i:sa');				
	$mdate2= date('d-m-Y');
	$mdate3= date('d-m-Y');
if (isset($_POST['daterange'])) {
    // Retrieve the date range string submitted via POST
    $p1 = $_POST['daterange'];

    // Extract the individual components of the start date
    $dd1 = substr($p1, 0, 2);
    $mm1 = substr($p1, 3, 2);
    $yy1 = substr($p1, 6, 4);

    // Extract the individual components of the end date
    $dd2 = substr($p1, 14, 2);
    $mm2 = substr($p1, 17, 2);
    $yy2 = substr($p1, 20, 4);

    // Convert the start and end date components into "YYYY-MM-DD" format
    $lower = "$yy1-$mm1-$dd1";
    $upper = "$yy2-$mm2-$dd2";

    // Store the original date range and the converted lower and upper dates in session variables
    $_SESSION['daterange'] = $_POST['daterange'];
    $_SESSION['lowerdate'] = $lower;
    $_SESSION['upperdate'] = $upper;
}


	
	else
	{
		$lower =  date('Y-m-d', strtotime('-1 months'));
		$upper =  date('Y-m-d',strtotime(date('Y-m-d')));
		$startdate =  date('d-m-Y', strtotime('-1 months'));
		$enddate =  date('d-m-Y',strtotime(date('Y-m-d')));
		//$lower =  $_SESSION['lowerdate'];
		//$upper =  $_SESSION['upperdate'];
		
		//$_SESSION['cstatus']="All";
		// $status='Pending';
		// $_SESSION['cstatus']="All";
	  $_SESSION['lowerdate']=$lower;
	  $_SESSION['upperdate']=$upper; 
	 
	}
	?>
<!DOCTYPE html>
<!--
Author: Keenthemes
Product Name: Metronic - Bootstrap 5 HTML, VueJS, React, Angular. Laravel, Asp.Net Core, Ruby on Rails, Spring Boot, Blazor, Django, Express Node.js & Flask Admin Dashboard Theme
Purchase: https://1.envato.market/EA4JP
Website: http://www.keenthemes.com
Contact: support@keenthemes.com
Follow: www.twitter.com/keenthemes
Dribbble: www.dribbble.com/keenthemes
Like: www.facebook.com/keenthemes
License: For each use you must have a valid license purchased only from above link in order to legally use the theme for your project.
-->
<html lang="en">
	<!--begin::Head-->
	<head>
		<title><?php if($_SESSION['linkarisecmptype']=='Hotel'){?>
                                   Linen Job Work
															<?php } else{?>
															 Clean Clothes Job Work List
															<?php } ?></title>
		<meta charset="utf-8" />
		<meta name="description" content="The most advanced Bootstrap Admin Theme on Themeforest trusted by 100,000 beginners and professionals. Multi-demo, Dark Mode, RTL support and complete React, Angular, Vue, Asp.Net Core, Rails, Spring, Blazor, Django, Flask & Laravel versions. Grab your copy now and get life-time updates for free." />
		<meta name="keywords" content="metronic, bootstrap, bootstrap 5, angular, VueJs, React, Asp.Net Core, Rails, Spring, Blazor, Django, Flask & Laravel starter kits, admin themes, web design, figma, web development, free templates, free admin themes, bootstrap theme, bootstrap template, bootstrap dashboard, bootstrap dak mode, bootstrap button, bootstrap datepicker, bootstrap timepicker, fullcalendar, datatables, flaticon" />
		<meta name="viewport" content="width=device-width, initial-scale=1" />
		<meta property="og:locale" content="en_US" />
		<meta property="og:type" content="article" />
		<meta property="og:title" content="Metronic - Bootstrap 5 HTML, VueJS, React, Angular. Laravel, Asp.Net Core, Ruby on Rails, Spring Boot, Blazor, Django, Express Node.js & Flask Admin Dashboard Theme" />
		<meta property="og:url" content="https://keenthemes.com/metronic" />
		<meta property="og:site_name" content="Keenthemes | Metronic" />
		<link rel="canonical" href="https://preview.keenthemes.com/metronic8" />
		<link rel="shortcut icon" href="assets/media/logos/iwashlogo.jpg" />
		<!--begin::Fonts(mandatory for all pages)-->
		<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Inter:300,400,500,600,700" />
		<!--end::Fonts-->
		<!--begin::Vendor Stylesheets(used for this page only)-->
		<link href="assets/plugins/custom/datatables/datatables.bundle.css" rel="stylesheet" type="text/css" />
		<!--end::Vendor Stylesheets-->
		<!--begin::Global Stylesheets Bundle(mandatory for all pages)-->
		<link href="assets/plugins/global/plugins.bundle.css" rel="stylesheet" type="text/css" />
		<link href="assets/css/style.bundle.css" rel="stylesheet" type="text/css" />
		<!--end::Global Stylesheets Bundle-->
		
		
		 <style>
       .table-responsive::-webkit-scrollbar {
    width: 12px; /* You can adjust the width as needed */
	height: 10px;
	color: darkgrey;
}

.table-responsive:hover::-webkit-scrollbar-thumb {
    background-color: darkgrey; /* Change this to your desired color (e.g., dark grey) */
}
.table-responsive::-webkit-scrollbar-thumb {
    background-color: darkgrey; /* Change this to your desired color (e.g., dark grey) */
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background-color: black; /* Change this to your desired color on hover (e.g., black) */
}

.form-control.form-control-solid,.form-select.form-select-solid{				
		border-color: #979595;			
		}	
	
		.form-control.form-control-solid.active,.form-select.form-select-solid.active{				
		border-color: #979595;			
		}	
		
    </style>
	</head>
	<!--end::Head-->
	<!--begin::Body-->
	<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">
		<!--begin::Theme mode setup on page load-->
		<script>var defaultThemeMode = "light"; var themeMode; if ( document.documentElement ) { if ( document.documentElement.hasAttribute("data-bs-theme-mode")) { themeMode = document.documentElement.getAttribute("data-bs-theme-mode"); } else { if ( localStorage.getItem("data-bs-theme") !== null ) { themeMode = localStorage.getItem("data-bs-theme"); } else { themeMode = defaultThemeMode; } } if (themeMode === "system") { themeMode = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light"; } document.documentElement.setAttribute("data-bs-theme", themeMode); }</script>
		<!--end::Theme mode setup on page load-->
		<!--begin::App-->
		<div class="d-flex flex-column flex-root app-root" id="kt_app_root">
			<!--begin::Page-->
			<div class="app-page flex-column flex-column-fluid" id="kt_app_page">
				<!--begin::Header-->
				<?php include('header2.php'); ?>
				
				<!--end::Header-->
				<!--begin::Wrapper-->
				<div class="app-wrapper flex-column flex-row-fluid" id="kt_app_wrapper">
					<!--begin::Sidebar-->
				<?php include('sidebar2.php'); ?>
				<!--end::Sidebar-->
					<!--begin::Main-->
					<div class="app-main flex-column flex-row-fluid" id="kt_app_main">
						<!--begin::Content wrapper-->
						<div class="d-flex flex-column flex-column-fluid">
							<!--begin::Toolbar-->
							<div id="kt_app_toolbar" class="app-toolbar py-3 py-lg-6">
								<!--begin::Toolbar container-->
								<div id="kt_app_toolbar_container" class="app-container container-xxl d-flex flex-stack">
									<!--begin::Page title-->
									<div class="page-title d-flex flex-column justify-content-center flex-wrap me-3">
										<!--begin::Title-->
										<h1 class="page-heading d-flex text-dark fw-bold fs-3 flex-column justify-content-center my-0"><?php if($_SESSION['linkarisecmptype']=='Hotel'){?>
                                   Linen Job Work
															<?php } else{?>
															 Clean Clothes Job Work List
															<?php } ?></h1>
										<!--end::Title-->
										<!--begin::Breadcrumb-->
										<ul class="breadcrumb breadcrumb-separatorless fw-semibold fs-7 my-0 pt-1">
											<!--begin::Item-->
											<li class="breadcrumb-item text-muted">
												<a href="dashboard.php" class="text-muted text-hover-primary">Home</a>
											</li>
											<!--end::Item-->
											<!--begin::Item-->
											<li class="breadcrumb-item">
												<span class="bullet bg-gray-400 w-5px h-2px"></span>
											</li>
											<!--end::Item-->
											<!--begin::Item-->
											<li class="breadcrumb-item text-muted"><?php if($_SESSION['linkarisecmptype']=='Hotel'){?>
                                   Linen Job Work
															<?php } else{?>
															 Clean Clothes Job Work List
															<?php } ?></li></li>
											<!--end::Item-->
											<!--begin::Item-->
											
											<!--begin::Item-->
										
											<!--end::Item-->
										</ul>
										<!--end::Breadcrumb-->
									</div>
									<!--end::Page title-->
									<!--begin::Actions-->
									
									<!--end::Actions-->
								</div>
								<!--end::Toolbar container-->
							</div>
							<!--end::Toolbar-->
							<!--begin::Content-->
							<div id="kt_app_content" class="app-content flex-column-fluid">
								<!--begin::Content container-->
								<div id="kt_app_content_container" class="app-container container-xxl">
									<!--begin::Card-->
									<div class="card">
										
										<div class="card-toolbar">
										<!--begin::Toolbar-->
											<div class="card-header align-items-center py-5 gap-2 gap-md-0">
									<!--begin::Card title-->
								
									<!--end::Card title-->
									<form method="post" class="form-control" style="border: none;">
									<!--begin::Card toolbar-->
									<div class="card-toolbar flex-row-fluid justify-content-end gap-5">
										<!--begin::Flatpickr-->
										 <label class="control-label col-md-0">Date Range</label>
										<div class="input-group w-250px">
										
											<input class="form-control form-control rounded rounded-end"  name="daterange" placeholder="Pick date range" id="kt_ecommerce_sales_flatpickr" value="<?php if( isset($_POST['daterange']) ){ echo $_POST['daterange'];}else{ echo $startdate." to ".$enddate;}	?>"/>
										
										</div>
										<!--end::Flatpickr-->
										
										<!--begin::Add product-->
									   <div class="col-md-0">
                                                    <button type="submit" name="btnsubmit" class="btn btn-light-danger me-3">
                                                        <i class="fa fa-check"></i> Submit</button>
                                                   
                                                </div>
										<!--end::Add product-->
									</div>
									<!--end::Card toolbar-->
									</form>
								</div>
										<div class="d-flex justify-content-end" data-kt-user-table-toolbar="base">
											<!--begin::Export-->
												<a href="jobworkadd.php" class="btn btn-primary" hidden>
											<!--begin::Svg Icon | path: icons/duotune/arrows/arr075.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.5" x="11.364" y="20.364" width="16" height="2" rx="1" transform="rotate(-90 11.364 20.364)" fill="currentColor" />
													<rect x="4.36396" y="11.364" width="16" height="2" rx="1" fill="currentColor" />
												</svg>
											</span>
											<!--end::Svg Icon-->
											<?php if($_SESSION['linkarisecmptype']=='Hotel'){?>
                                  Add Linen Job Work
															<?php } else{?>
															Add Clean Clothes
															<?php } ?>
											</a>
											
											<!--end::Export-->
											<!--begin::Add user-->
											
										
											<!--end::Add user-->
										</div>
										<!--end::Toolbar-->
										<!--begin::Group actions-->
								
										<!--end::Group actions-->
										<!--begin::Modal - Adjust Balance-->
									
									<!--end::Card toolbar-->
								</div>
										<!--begin::Card body-->
										<div class="card-body py-4">
								<div class="table-responsive">
									<!--begin::Table-->
									<table class="table align-middle table-row-dashed fs-6 gy-5" id="sample_5">
								</table>
									<!--end::Table-->
								</div>
									<div class="d-flex justify-content-end">
								<a href="javascript:;" onClick ="$('#sample_5').tableExport({type:'excel',escape:'false'}); " class="btn btn-primary me-3" >
													<i class="fa fa-file-excel-o"></i> Export 
												</a>
								</div>
								</div>
										<!--end::Card body-->
									</div>
									<!--end::Card-->
								</div>
								<!--end::Content container-->
							</div>
							<!--end::Content-->
						</div>
						<!--end::Content wrapper-->
						<!--begin::Footer-->
						<?php include('footer.php'); ?>
						
						<!--end::Footer-->
					</div>
					<!--end:::Main-->
				</div>
				<!--end::Wrapper-->
			</div>
			<!--end::Page-->
		</div>
		<!--end::App-->
		<!--begin::Drawers-->
		<!--end::Drawers-->
	
		<!--begin::Javascript-->
		<script>var hostUrl = "assets/";</script>
		<!--begin::Global Javascript Bundle(mandatory for all pages)-->
		<script src="assets/plugins/global/plugins.bundle.js"></script>
		<script src="assets/js/scripts.bundle.js"></script>
		<!--end::Global Javascript Bundle-->
		<!--begin::Vendors Javascript(used for this page only)-->
		<script src="assets/plugins/custom/datatables/datatables.bundle.js"></script>
		<!--end::Vendors Javascript-->
		<!--begin::Custom Javascript(used for this page only)-->
		<script src="assets/js/custom/apps/user-management/users/list/table.js"></script>
		<script src="assets/js/custom/apps/user-management/users/list/export-users.js"></script>
		<script src="assets/js/custom/apps/user-management/users/list/add.js"></script>
		<script src="assets/js/widgets.bundle.js"></script>
		<script src="assets/js/custom/widgets.js"></script>
		<script src="assets/js/custom/apps/chat/chat.js"></script>
		<script src="assets/js/custom/utilities/modals/upgrade-plan.js"></script>
		<script src="assets/js/custom/utilities/modals/users-search.js"></script>
		<script type="text/javascript" src="myjs/64/jquery.base64.js"/></script>
		<script type="text/javascript" src="myjs/tableexport.js"/></script>
		<script type="text/javascript" src="js/notification.js"/></script>
		
<script>
$(document).ready(function() {
	$.fn.dataTable.ext.errMode = function ( settings, helpPage, message ) { console.log(message)};
    $('#sample_5').DataTable( {
        "ajax": "jobworkjson.php",
		"language": {
			 "loadingRecords": "No Data found..."
		}, 
        "columns": [

    		
    		 { "data": "srno","title":"Sr No." },
			 { "data": "op","title":"Operation" },
			    { "data": "trolleysno","title":"Trolley S.No" },
			  { "data": "trolleyqrcode","title":"Trolley No" },
		  	 { "data": "status","title":"Job Work Status" },
			  { "data": "trolleygrossweight","title":"Gross Weight" },
			  { "data": "trolleytareweight","title":"Tare Weight" },
			  { "data": "trolleynetweight","title":"Net Weight" },
			  { "data": "totalitem","title":"No of Items in Trolley" },
		  	  { "data": "nofordisplay","title":"Job Work No." },
             { "data": "jobworkdate","title":"Job Work Date" },
             { "data": "jobworktime","title":"Send Out Time" },
			  <?php if($_SESSION['linkarisecmptype']=="Hotel"){?>
             { "data": "totalweight","title":"Hotel (Net Weight) (Kg)" },
			 <?php } else {?>
			  { "data": "totalweight","title":"I-Wash (Net Weight) (Kg)" },
			  <?php } if($_SESSION['linkarisecmptype']=="Hotel"){?>
             { "data": "verifiedweight","title":"I-Wash (Verified Weight) (Kg)" },
			  <?php } else {?>
			    { "data": "verifiedweight","title":"Hotel (Verified Weight) (Kg)" },
				 <?php } ?>
             { "data": "difference","title":"Difference (Kg)" },
		 
		 	
		 	 { "data": "dispatchedby","title":"Sent Out By" },
			<?php if($_SESSION['linkarisecmptype']=="Hotel"){?>
		  	
	<?php } else {?>
	 { "data": "cmpname","title":"Hotel Name" },
	<?php } ?>
		 
			  { "data": "receiveddate","title":"Received Date" },
			  { "data": "receivedtime","title":"Received Time" },
			  { "data": "receivedby","title":"Received By" },
    ],
    "dom":
		"<'row'" +
		"<'col-sm-6 d-flex align-items-center justify-conten-start'l>" +
		"<'col-sm-6 d-flex align-items-center justify-content-end'f>" +
		">" +

		"<'table-responsive'tr>" +

		"<'row'" +
		"<'col-sm-12 col-md-5 d-flex align-items-center justify-content-center justify-content-md-start'i>" +
		"<'col-sm-12 col-md-7 d-flex align-items-center justify-content-center justify-content-md-end'p>" +
		">",
searchable: true,
      'order': [[0, 'asc']]



    } );
} );
</script>
<script>
$(document).ready(function() {
    // Setup - add a text input to each footer cell
    $('#sample_5 thead tr').clone(true).appendTo('#sample_5 thead');
    $('#sample_5 thead tr:eq(1) th').each(function(i) {
        var title = $(this).text();
        if (i !== 5 && i!==0) { // Specify the column indices where you want the search input
            $(this).html('<input type="text" placeholder="Search" />');
            $('input', this).on('keyup change', function() {
                if (table.column(i).search() !== this.value) {
                    table.column(i).search(this.value).draw();
                }
            });
        } else {
            $(this).html('<div></div>'); // For columns where you don't want the search input, add an empty div
        }
    });

    var table = $('#sample_5').DataTable({
        orderCellsTop: true,
        fixedHeader: true
    });
});
</script>

<?php

if(isset($_SESSION['msg']))
{
	$tt = $_SESSION['msg'];
	echo "<input type=\"hidden\" id=\"mymsg\" value=\"$tt\"/>";
	unset($_SESSION['msg']);
	
	
?>	
								
		<script lang="javascript">

var a = [
    function () {
	

		var mymsg = document.getElementById("mymsg").value;
		toastr.success(mymsg, "Operation Completed")
		
    },
    function () {
        $('span').show();
    },
    function () {
        $('p').fadeIn(100);
    }
];		
					

a[0]();
</script>


		
	
<?php
}

if(isset($_SESSION['msg1']))
{
	$tt1 = $_SESSION['msg1'];
	echo "<input type=\"hidden\" id=\"mymsg1\" value=\"$tt1\"/>";
	unset($_SESSION['msg1']);
	
	
	?>	
								
		<script lang="javascript">

var a = [
    function () {
	

		var mymsg = document.getElementById("mymsg1").value;
		toastr.warning(mymsg, "Error")
		
    },
    function () {
        $('span').show();
    },
    function () {
        $('p').fadeIn(100);
    }
];		
					

a[0]();
</script>
	
<?php

}
?>	

  <script>
        document.addEventListener('DOMContentLoaded', function () {
            // Get the current date
     

            // Set the default date range for the date picker
            flatpickr('#kt_ecommerce_sales_flatpickr', {
                mode: 'range', // Set the mode to 'range' for a date range picker
                dateFormat: 'd-m-Y', // Set the desired date format: "day-month-year"
               // defaultDate: [lowerDate, upperDate], // Set the default date range
            });
        });
    </script>							
		<!--end::Custom Javascript-->
		<!--end::Javascript-->
	</body>
	<!--end::Body-->
</html>
