<?php 
	$header_file=APPPATH.'views/include/header.php';
	require($header_file);
	$sidenav_file=APPPATH.'views/include/sidenav.php';
	require($sidenav_file);	?>
  
    <!-- BEGIN: Content-->
    <div class="app-content content">
      <div class="content-overlay"></div>
      <div class="content-wrapper">
        <div class="content-header row">
          <div class="content-header-left col-md-12 col-12 mb-2 breadcrumb-new">
            <h3 class="content-header-title mb-0 d-inline-block">Daily Stock Update</h3>
            <div class="row breadcrumbs-top d-inline-block">
              <div class="breadcrumb-wrapper col-12">
                <ol class="breadcrumb">
                  <li class="breadcrumb-item"><a href="#">Home</a>
                  </li>
                  <li class="breadcrumb-item"><a href="#">Daily Stock Update </a>
                  </li>
                  <li class="breadcrumb-item active">Daily Stock Update
                  </li>
                </ol>
              </div>
            </div>
          </div>
          
        </div>
        <div class="content-body"><!-- Basic form layout section start -->
<section id="basic-form-layouts">
	



	<div class="row justify-content-md-center">
		<div class="col-md-12">
			<div class="card">
				<!-- <div class="card-header">
					<a class="heading-elements-toggle"><i class="la la-ellipsis-v font-medium-3"></i></a>
					<div class="heading-elements">
						<ul class="list-inline mb-0">
							<li><a data-action="collapse"><i class="ft-minus"></i></a></li>
							<li><a data-action="reload"><i class="ft-rotate-cw"></i></a></li>
							<li><a data-action="expand"><i class="ft-maximize"></i></a></li>
							<li><a data-action="close"><i class="ft-x"></i></a></li>
						</ul>
					</div>
				</div>-->
				<div class="card-content collapse show">
					<div class="card-body">

						
					<div class="row justify-content-md-center">	
						<div class="col-md-6">
						<!--	<h4 class="card-title" id="basic-layout-form-center">Raw Material</h4>
							<form class="form" autocomplete="off" action="<?php echo site_url('Stock_update/export_DStock');?>" method="post">
								<div class="row">
									<div class="col-md-6">
										<div class="form-body">
											<div class="form-group">
											<?php $cur_date = date("d-m-Y"); 
											$branch_id = $_SESSION['branch_id'];
											$branch_name = $_SESSION['branch_name'];
											$full_name = $_SESSION['full_name']; ?>
											<input class="form-control" type="hidden" name="branchname" id="branchname" value="<?php echo $_SESSION['branch_name']?>">
												<input type="submit" name="export_stk_format" class="btn btn-primary" value="Raw Material Download">
											</div>
										</div>
									</div>
								</div>
							</form>
							<form class="form" autocomplete="off" action="<?php echo site_url('Stock_update/importDailyStock');?>"  method="post" enctype="multipart/form-data">
								<div class="row">
									<div class="col-md-6">
										<div class="form-group">
										<input type="file" name="stk_upload" id="stk_upload" class="form-control" required />
										</div>
									</div>
									
									<div class="col-md-6">
										<div class="form-group">
											<input type="submit" name="upload" id="rstk" onclick="return confirm('Are you sure you want to submit this form?')"  class="btn btn-primary" value="Raw Material Upload">
										</div>
									</div>
								</div>				
							</form>	
						</div>-->
						<div class="col-md-12">
							<h4 class="card-title" id="basic-layout-form-center">Finished Product</h4>
							<form class="form" autocomplete="off" action="<?php echo site_url('Stock_update/exportDPrStock');?>" method="post">
								<div class="row">
									<div class="col-md-8">
										<div class="form-body">
											<div class="form-group">
											<?php $cur_date = date("d-m-Y"); 
											$branch_id = $_SESSION['branch_id'];
											$branch_name = $_SESSION['branch_name'];
											$full_name = $_SESSION['full_name']; ?>
											<input class="form-control" type="hidden" name="branchname" id="branchname" value="<?php echo $_SESSION['branch_name']?>">
												<input type="submit" name="export_stk_format" class="btn btn-info" value="Finished Product Download">
											</div>
										</div>
									</div>
								</div>
							</form>
							<form class="form" autocomplete="off" action="<?php echo site_url('Stock_update/importDailyPrStock');?>"  method="post" enctype="multipart/form-data">
								<div class="row">
									<div class="col-md-8">
										<div class="form-group">
											<!--<label>UPLOAD</label>-->
											<input type="file" name="prstk_upload" id="prstk_upload" class="form-control" required />
										</div>
									</div>
									<div class="col-md-4">
										<div class="form-group">
											<input type="submit" name="prupload" id="fstk" onclick="return confirm('Are you sure you want to submit this form?')"  class="btn btn-info" value="Finished Product Upload">
										</div>
									</div>									
								</div>								
							</form>
						</div>
					</div>

					</div>
				</div>
			</div>
		</div>
	</div>

</section>
<!-- // Basic form layout section end -->
        </div>
      </div>
    </div>
    <?php //require('include/theme_customizer.php');?>

   <?php 
  $footer_file=APPPATH.'views/include/footer.php';
	require($footer_file);
	?>

<script>
$('#rstk').click(function(){
            
	function containsWord(haystack, needle) {
		return (" " + haystack + " ").indexOf(" " + needle + " ") !== -1;
	}
	
	var br = $('#branchname').val();
	var filename = $('#stk_upload').val();
	var flname = filename.split('\\').pop().split('/').pop();
	//alert(flname);
   if(flname.includes("Daily_Stock_Update(RM)_"+br+"_"))
   {
	   //alert("yes");
	   return true;
	}
   else
   {
	   alert("Please choose the proper file");
	   return false;
   }
});
</script>
<script>
$('#fstk').click(function(){
		
	function containsWord(haystack, needle) {
		return (" " + haystack + " ").indexOf(" " + needle + " ") !== -1;
	}
	
	var br = $('#branchname').val();
	var filename = $('#prstk_upload').val();
	var flname = filename.split('\\').pop().split('/').pop();
	//alert(br);
	if(flname.includes("Daily_Stock_Update(FP)_"+br+"_"))
   {
	  // alert("yes");
	   return true;
   }
   else
   {
	   alert("Please choose the proper file");
	   return false;
   }
});
</script>
<script>
   $("form").submit(function() {
        // submit more than once return false
        $(this).submit(function() {
            return false;
        });
        // submit once return true
        return true;
    });
</script>
	
  </body>
  <!-- END: Body-->

<!-- Mirrored from pixinvent.com/modern-admin-clean-bootstrap-4-dashboard-html-template/html/ltr/vertical-modern-menu-template/form-layout-basic.html by HTTrack Website Copier/3.x [XR&CO'2014], Mon, 27 Apr 2020 09:38:02 GMT -->
</html>