<!DOCTYPE html>

<html class="loading" lang="en" data-textdirection="ltr">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimal-ui">

<title>Inventory</title>
<link rel="apple-touch-icon" href="https://gravitysoft.in/images/favicon.ico">
<link rel="shortcut icon" type="image/x-icon" href="https://gravitysoft.in/images/favicon.ico">
<!--<link rel="apple-touch-icon" href="<?php //echo base_url(); ?>app-assets/images/ico/favicon.png">
<link rel="shortcut icon" type="image/x-icon" href="<?php //echo base_url(); ?>app-assets/images/ico/favicon.png">-->
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i,700,700i%7CQuicksand:300,400,500,700" rel="stylesheet">
<!-- BEGIN: Vendor CSS-->
<link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>app-assets/vendors/css/vendors.min.css">
<link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>app-assets/vendors/css/ui/jquery-ui.min.css">
<link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>app-assets/css/plugins/ui/jqueryui.css">

<link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>app-assets/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>app-assets/css/bootstrap-extended.min.css">
<link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>app-assets/css/colors.min.css">
<link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>app-assets/css/components.min.css">


<link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>app-assets/vendors/css/forms/selects/select2.min.css">



<link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>app-assets/vendors/css/pickers/daterange/daterangepicker.css">
<link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>app-assets/vendors/css/pickers/pickadate/pickadate.css">
<!-- END: Vendor CSS-->


<link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>app-assets/vendors/css/tables/datatable/datatables.min.css">
<link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>app-assets/vendors/css/tables/extensions/buttons.dataTables.min.css">
<link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>app-assets/vendors/css/tables/datatable/buttons.bootstrap4.min.css">

<!-- BEGIN: Theme CSS-->

<!--<link rel="stylesheet" type="text/css" href="<?php //echo base_url(); ?>app-assets/css/bootstrap-multiselect.css">
END: Theme CSS-->

<!-- BEGIN: Page CSS-->
<link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>app-assets/css/core/menu/menu-types/vertical-menu-modern.css">
<link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>app-assets/css/core/colors/palette-gradient.min.css">

<link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>app-assets/fonts/line-awesome/css/line-awesome.min.css">
<link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>app-assets/css/plugins/pickers/daterange/daterange.min.css">
<link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>app-assets/css/pages/invoice.min.css">
<!-- END: Page CSS-->

<!-- BEGIN: Custom CSS-->

<link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>assets/css/style.css">

<link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>assets/css/toastr.css">

<!-- END: Custom CSS-->
<link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>app-assets/fonts/feather/style.min.css">
<!-- END: Custom CSS-->
<!-- <link rel="stylesheet" type="text/css" href="<?php //echo base_url(); ?>assets/css/line-awesome.min.css" rel="stylesheet">-->
<link href="https://maxcdn.icons8.com/fonts/line-awesome/1.1/css/line-awesome.min.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>assets/chosen_select/chosen.css">
<style>
/*
body{
    overscroll-behavior-y: contain;
}*/
    /*body.vertical-layout.vertical-menu-modern.menu-expanded .main-menu {
        
        width: 240px!important;
    }
    body.vertical-layout.vertical-menu-modern .content, body.vertical-layout.vertical-menu-modern .footer {
        margin-left: 221px!important;
    }
    body.vertical-layout.vertical-menu-modern.menu-expanded .content, body.vertical-layout.vertical-menu-modern.menu-expanded .footer {
    margin-left: 221px;
    }
    html body .content .content-wrapper {
    
        padding-right: 18px;
        padding-left: 2rem;
        padding-top: 1rem;
    }*/
    
    .btn-group-sm>.btn, .btn-sm {
    padding: .5rem .75rem;
    font-size: 0.865rem!important;
    line-height: 1;
    border-radius: .21rem;
}
.main-menu.menu-dark .navigation>li>a i, .main-menu.menu-light .navigation>li>a i {
    position: relative;
    top: -5px!important;
}
</style>
<style media="print" type="text/css">
    body {
        background-color: #fff !important;
          
        }
</style>
<style>
  blink {
    color: #1c87c9;
    font-size: 20px;
    font-weight: bold;
    font-family: sans-serif;
  }
  .select2-container--open .select2-dropdown--below {
    border-top: none;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    width: 250px!important;
}
</style>
</head>
<!-- END: Head-->

<!-- BEGIN: Body-->
<body class="vertical-layout vertical-menu-modern 2-columns   fixed-navbar" data-open="click" data-menu="vertical-menu-modern" data-col="2-columns">
<?php
$sql = $this->db->query("SELECT * FROM `org_detail`");
foreach($sql->result_array() as $row)  
$org_title= $row['org_title'];
$org_logo= $row['org_logo'];
$org_name= $row['org_name'];
?>
<!-- BEGIN: Header-->
	<nav class="header-navbar navbar-expand-lg navbar navbar-with-menu navbar-without-dd-arrow fixed-top navbar-semi-dark navbar-shadow">
		<div class="navbar-wrapper">
			<div class="navbar-header">
				<ul class="nav navbar-nav flex-row">
					<li class="nav-item mobile-menu d-lg-none mr-auto"><a class="nav-link nav-menu-main menu-toggle hidden-xs" href="#"><i class="ft-menu font-large-1"></i></a></li>
					<li class="nav-item mr-auto"><a class="navbar-brand" href="#"><img class="brand-logo" alt="modern admin logo" src="<?php echo base_url(); ?><?php echo $org_logo; ?>">
					<h3 class="brand-text"><?php echo $org_title;?></h3></a></li>
					<li class="nav-item d-none d-lg-block nav-toggle"><a class="nav-link modern-nav-toggle pr-0" data-toggle="collapse"><i class="toggle-icon ft-toggle-right font-medium-3 white" data-ticon="ft-toggle-right"></i></a></li>
					<li class="nav-item d-lg-none"><a class="nav-link open-navbar-container" data-toggle="collapse" data-target="#navbar-mobile"><i class="la la-ellipsis-v"></i></a></li>
				</ul>
			</div>
			<div class="navbar-container content">
				<div class="collapse navbar-collapse" id="navbar-mobile">
					<ul class="nav navbar-nav mr-auto float-left">
						<li class="nav-item nav-search"><a class="nav-link nav-link-search" href="#"><i class="ficon ft-search"></i></a>
							<div class="search-input">
							<input class="input" type="text" placeholder="Explore Modern..." tabindex="0" data-search="template-list">
							<div class="search-input-close"><i class="ft-x"></i></div>
							<ul class="search-list"></ul>
							</div>
						</li>
					</ul>
					<ul class="nav navbar-nav float-right">
					<?php 
					    $id= $_SESSION['user_id'];
					    $ugrp= $_SESSION['user_group'];
					    $bname = $_SESSION['branch_name'];
					    $to_date = date('Y-m-d');
					?>
						<!--<li class="dropdown dropdown-notification nav-item"><a class="nav-link nav-link-label text-bold-700" href="http://gsrgroup.biz/cw_chat/index.php/Login/log_sheet/<?php echo $id;?>" target="_blank">Log Sheet</a>
						</li>-->
					
					<!--Notification -->
					<!--CEO -->
					<?php if($id=='1') {
					   $q1 = $this->db->query("SELECT *,DATE_FORMAT(P.purchase_date, '%d-%m-%Y') as purchase_date, G.gnr_id as mid, DATE_FORMAT(G.grn_date, '%d-%m-%Y') as grn_date FROM purchase_order P inner join gnr_creation G on P.purchase_id=G.purchase_id where G.rjn_status='Pending' and (G.gnr_status='Pending' or G.gnr_status='Holded') and G.branchname!='CW4' and G.branchname!='CW5' ORDER BY G.gnr_id desc");
					   $g_count=$q1->num_rows();
					   if($g_count > 0)
						{
					?>
					<li class="dropdown dropdown-notification nav-item"><a class="nav-link nav-link-label text-bold-700" href="<?php echo site_url('Purchase/pendingGRN/');?>" >G<?php echo $g_count; ?></a></li>
					<?php } 
					$q2 = $this->db->query("select *,DATE_FORMAT(vdate, '%d-%m-%Y') as vdate from voucher where approval_status='Pending' and branch!='MC' order by voucher_id desc");
						$vcount=$q2->num_rows();
						if($vcount > 0)
						{
					?>
					<li class="dropdown dropdown-notification nav-item"><a class="nav-link nav-link-label text-bold-700" href="<?php echo site_url('StockManagement/pendingVoucherList/');?>" >V<?php echo $vcount; ?></a></li>
					<?php } 
					$q4 = $this->db->query("SELECT * FROM product_category C inner join recipe R on C.pr_cat_id=R.pr_cat_id where aprvl_status='Pending' order by recipe_id desc");
						$pcount=$q4->num_rows();
						if($pcount > 0)
						{
					?>
					<li class="dropdown dropdown-notification nav-item"><a class="nav-link nav-link-label text-bold-700" href="<?php echo site_url('Master/productApprove/');?>" >P<?php echo $pcount; ?></a></li>
					<?php } 
					  $q5 = $this->db->query("select g.gnr_id,g.grn_no,r.frm_user from gnr_creation g inner join remarks r on g.gnr_id=r.gnr_id where r.status='UnSeen' and r.remark_status='Pending' and r.login_id!='47' group by r.gnr_id");
						$rmcount=$q5->num_rows();
						$rmkres = $q5->result();
						if($rmcount > 0)
						{
					?>
					<li class="dropdown dropdown-user nav-item"><a class="dropdown-toggle nav-link dropdown-user-link text-bold-700" href="#" data-toggle="dropdown"><span>RM<?php echo $rmcount; ?></span></a>
					<div class="dropdown-menu dropdown-menu-right">
					<?php 
					foreach($rmkres as $rmk)
					{
					?>
					<div class="dropdown-divider"></div><span><a class="dropdown-item text-bold-700" href="<?php echo site_url('Purchase/ceo_agrn_view/'. $rmk->gnr_id); ?>"><?php echo $rmk->grn_no; ?></a>
					<a style="margin-top:-29px;margin-left:112px;" class="dropdown-item" href="<?php echo site_url('Purchase/close_remark/'.$rmk->gnr_id); ?>" onClick="return confirm('Are you sure want to close?');"><i class="ft-x"></i></a></span>
					
					<?php } ?>
					</div>
					</li>
					<?php } ?>
					<?php } ?>

                    <!--GRN Remarks -->
                    <?php if($bname=='CW' || $bname=='CW4' || $bname=='ESH') {
                    $q1 = $this->db->query("select g.gnr_id,g.grn_no,r.frm_user from gnr_creation g inner join remarks r on g.gnr_id=r.gnr_id where g.branchname='$bname' and r.status='Seen' and r.remark_status='Pending' group by r.gnr_id");
                    	$crmcount=$q1->num_rows();
						$crmkres = $q1->result();
						if($crmcount > 0)
						{
					?>
					<li class="dropdown dropdown-user nav-item"><a class="dropdown-toggle nav-link dropdown-user-link text-bold-700" href="#" data-toggle="dropdown"><span class="mr-1 user-name text-bold-700"><?php echo $crmcount; ?> notification(s)</span><span class="avatar avatar-online">Click</span></a>
						<div class="dropdown-menu dropdown-menu-right">
							<?php foreach($crmkres as $crmk)  { ?>
								<div class="dropdown-divider"></div>
								<span class="md-user-letters md-bg-cyan" style="    margin-left: 10px;"><?php //echo $crmk->gnr_id; ?></span>
								<a href="<?php echo site_url('Purchase/grn_view/'.$crmk->gnr_id.'/'); ?>" id="view" name="view" class="primary"><?php echo $crmk->grn_no; ?></a>
							<?php } ?>
						</div>
					</li>
					<?php } ?>
					<?php } ?>
					
					<!-- Holded GRN -->
					<?php if($bname=='CW' || $bname=='ESH' || $bname=='CW4' || $bname=='CW5') {
					$q2 = $this->db->query("SELECT *,DATE_FORMAT(P.purchase_date, '%d-%m-%Y') as purchase_date,G.gnr_id as mid, DATE_FORMAT(G.grn_date, '%d-%m-%Y') as grn_date FROM purchase_order P inner join gnr_creation G on P.purchase_id=G.purchase_id where G.branchname='$bname' and G.gnr_status='Holded' ORDER BY G.gnr_id desc");
					   $h_count=$q2->num_rows();
					   //$hrow = $q2->row_array();
					   if($h_count > 0)
						{
					?>
					<li class="dropdown dropdown-notification nav-item"><a class="nav-link nav-link-label text-bold-700" href="<?php echo site_url('Purchase/holdedGrn_list/');?>" >H<?php echo $h_count; ?></a></li>
					<?php } ?>
					<?php } ?>
					
					<!--Pride Bakers -->
                    <?php if($bname=='PRD') {
                    $uname = $_SESSION['username'];
                    $q1 = $this->db->query("SELECT *, DATE_FORMAT(P.request_date, '%d-%m-%Y') as request_date,DATE_FORMAT(P.approval_date, '%d-%m-%Y') as approval_date FROM product_request P where (P.status='Pending' or P.status='Approved') and P.dept='$uname' ORDER BY request_id desc");
					   $prcount=$q1->num_rows();
					   if($prcount > 0)
						{
					?>
					<li class="dropdown dropdown-notification nav-item"><a class="nav-link nav-link-label text-bold-700" href="<?php echo site_url('ProductRequest/prReqPendingList/');?>" >SO<?php echo $prcount; ?></a></li>
					<?php }
					$q2 = $this->db->query("select * from cmn_ticket order by ticket_id desc");
					$rmcount=$q2->num_rows();
					if($rmcount > 0)
						{ 
						?>
							<li class="dropdown dropdown-notification nav-item"><a class="nav-link nav-link-label text-bold-700" href="<?php echo site_url('ProductRequest/getPrideRmkkList/');?>" >RMK<?php echo $rmcount; ?></a>
							</li>
					<?php } ?>
                    <?php } ?>
				    
				    <!--Special and Runnung Orders -->
				    <?php if($bname=='CMS' || $bname=='CW-SVR' || $bname=='CW-SK' || $bname=='CW-FFK' || $bname=='CW-DCK' || $bname=='CW3-CK' || $bname=='CW2-FFK' || $bname=='CW4-SK' || $bname=='CW4-CLD' || $bname=='CW4-SPL') {
				    $uname = $_SESSION['username'];
				    $q1=$this->db->query("select * from product_request where (orders='Special Order' or orders='STSpecial Order') and dept='$uname' and issue_status='Pending'");
						$s_count=$q1->num_rows();
						if($s_count > 0)
						{
						?>
						<li class="dropdown dropdown-notification nav-item"><a class="nav-link nav-link-label text-bold-700" href="<?php echo site_url('ProductRequest/SplOrderReport/');?>" >SO<?php echo $s_count; ?></a>
						</li>
					<?php } 
					$to_date = date('Y-m-d');
					$q2=$this->db->query("select * from product_request where request_date='$to_date' and orders='Running Order' and dept='$uname' and issue_status='Pending'");
						$r_count=$q2->num_rows();
						if($r_count > 0)
						{
						?>
						<li class="dropdown dropdown-notification nav-item"><a class="nav-link nav-link-label text-bold-700" href="<?php echo site_url('ProductRequest/RunningReport/');?>" >RO<?php echo $r_count; ?></a>
						</li>
					<?php } ?>
					<?php } ?>
					
					<!--Chef -->
				    <?php if($bname=='CW_CHF') {
				    $q1=$this->db->query("select * from recipe where price='0' and raw_item_code!='' and branchname='CW_CHF'");
						$rmcount=$q1->num_rows();
						if($rmcount > 0)
						{
						?>
						<li class="dropdown dropdown-user nav-item"><a class="dropdown-toggle nav-link dropdown-user-link text-bold-700" href="#" data-toggle="dropdown"><span class="mr-1 user-name text-bold-700"><?php echo $rmcount; ?>item(s) to update price & cateorgy</span><span class="avatar avatar-online text-bold-700">Click</span></a>
								<div class="dropdown-menu dropdown-menu-right">
									<?php foreach($q1->result_array() as $row)  { ?>
										<div class="dropdown-divider"></div>
										<a href="<?php echo site_url('Master/productEdit/'. $row['recipe_id'] . '/' . $row['recipe_no']); ?>" style="font-size: 15px;" ><?php echo $row['rname']; ?></a>
									<?php } ?>
								</div>
							</li>
				    <?php } ?>   
				    <?php } ?>
				    
				    <!--CW4 Admin -->
				    <?php if($bname=='CW4_CEO') {
				    $q1 = $this->db->query("select *,DATE_FORMAT(vdate, '%d-%m-%Y') as vdate from voucher where approval_status='Pending' and branch='MC' order by voucher_id desc");
						$vcount=$q1->num_rows();
						if($vcount > 0)
						{
					?>
					<li class="dropdown dropdown-notification nav-item"><a class="nav-link nav-link-label text-bold-700" href="<?php echo site_url('StockManagement/pendingVoucherList/');?>" >V<?php echo $vcount; ?></a></li>
					<?php }
					$q2 = $this->db->query("select g.gnr_id,g.grn_no,r.frm_user from gnr_creation g inner join remarks r on g.gnr_id=r.gnr_id where r.status='UnSeen' and r.remark_status='Pending' and r.login_id='47' group by r.gnr_id");
						$rmcount=$q2->num_rows();
						$rmkres = $q2->result();
						if($rmcount > 0)
						{
					?>
					<li class="dropdown dropdown-user nav-item"><a class="dropdown-toggle nav-link dropdown-user-link text-bold-700" href="#" data-toggle="dropdown"><span>RM<?php echo $rmcount; ?></span></a>
					<div class="dropdown-menu dropdown-menu-right">
					<?php 
					foreach($rmkres as $rmk)
					{
					?>
					<div class="dropdown-divider"></div><a class="dropdown-item text-bold-700" href="<?php echo site_url('Purchase/ceo_agrn_view/'. $rmk->gnr_id); ?>"><?php echo $rmk->grn_no; ?></a>
					<a style="margin-top:-29px;margin-left:112px;" class="dropdown-item text-bold-700" href="<?php echo site_url('Purchase/close_remark/'.$rmk->gnr_id); ?>" onClick="return confirm('Are you sure want to close?');"><i class="ft-x"></i></a>
					
					<?php } ?>
					</div>
					</li>
					<?php } ?>
					<?php } ?>
					
					<!--CW5 Admin -->
				    <?php if($bname=='CW5_CEO') {
				    $q1 = $this->db->query("select *,DATE_FORMAT(vdate, '%d-%m-%Y') as vdate from voucher where approval_status='Pending' and branch='CW5' order by voucher_id desc");
						$vcount=$q1->num_rows();
						if($vcount > 0)
						{
					?>
					<li class="dropdown dropdown-notification nav-item"><a class="nav-link nav-link-label text-bold-700" href="<?php echo site_url('StockManagement/pendingVoucherList/');?>" >V<?php echo $vcount; ?></a></li>
					<?php }
					$q2 = $this->db->query("select g.gnr_id,g.grn_no,r.frm_user from gnr_creation g inner join remarks r on g.gnr_id=r.gnr_id where r.status='UnSeen' and r.remark_status='Pending' and r.login_id='69' group by r.gnr_id");
						$rmcount=$q2->num_rows();
						$rmkres = $q2->result();
						if($rmcount > 0)
						{
					?>
					<li class="dropdown dropdown-user nav-item"><a class="dropdown-toggle nav-link dropdown-user-link text-bold-700" href="#" data-toggle="dropdown"><span>RM<?php echo $rmcount; ?></span></a>
					<div class="dropdown-menu dropdown-menu-right">
					<?php 
					foreach($rmkres as $rmk)
					{
					?>
					<div class="dropdown-divider"></div><a class="dropdown-item text-bold-700" href="<?php echo site_url('Purchase/ceo_agrn_view/'. $rmk->gnr_id); ?>"><?php echo $rmk->grn_no; ?></a>
					<a style="margin-top:-29px;margin-left:112px;" class="dropdown-item" href="<?php echo site_url('Purchase/close_remark/'.$rmk->gnr_id); ?>" onClick="return confirm('Are you sure want to close?');"><i class="ft-x"></i></a>
					
					<?php } ?>
					</div>
					</li>
					<?php } ?>
					<?php } ?>
				    
					<li class="dropdown dropdown-user nav-item"><a class="dropdown-toggle nav-link dropdown-user-link" href="#" data-toggle="dropdown"><span class="mr-1 user-name text-bold-700"><?php echo $_SESSION['full_name']; ?></span><span class="avatar avatar-online"><img src="<?php echo base_url(); ?>app-assets/images/portrait/small/administrator.png" alt="avatar"><i></i></span></a>
					<div class="dropdown-menu dropdown-menu-right">
                        <a class="dropdown-item" href="<?php echo site_url('Master/changePasswrd');?>"><i class="la la-key"></i> Change Password</a>
					<div class="dropdown-divider"></div><a class="dropdown-item" href="<?php echo site_url('Login/logout_user');?>"><i class="ft-power"></i> Logout</a>
					</div>
					</li>
					</ul>
				</div>
			</div>
	</div>
	</nav>
<?php
$sidenav_file=APPPATH.'views/include/sidenav.php';
require($sidenav_file);
$thead_file=APPPATH.'views/include/thead_file.php';
$tbody_file=APPPATH.'views/include/tbody_access.php'; 
?>
<!-- END: Header-->