<?php 
	$header_file=APPPATH.'views/include/header.php';
	require($header_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">Request Report</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="#">Product Request</a>
                  </li>
                  <li class="breadcrumb-item active">Request Report
                  </li>
                </ol>
              </div>
            </div>
          </div>
        
        </div>
        <div class="content-body"><!-- Zero configuration table -->
<section id="configuration">
    <div class="row">
        <div class="col-md-12">
            <div class="card">
               <div class="card-content collapse show">
                    <div class="card-body card-dashboard">
						<div class="table-responsive">
							<?php foreach($run_ord as $run) { ?>
									<input type="hidden" name="tindex"  id="tindex" class="form-control tindex" readonly="readonly" value="<?php echo $run->row_number; ?>"/>
										<input type="hidden" name="rtime[]" id="rtime" class="rtime" value="<?php echo $run->request_time; ?>" >
										<input type="hidden" name="branch[]" id="branch" class="branch" value="<?php echo $run->branchname; ?>" >
										<input type="hidden" name="rdate[]" id="rdate" class="rdate" value="<?php echo $run->request_date; ?>" >
										<input type="hidden" name="remark[]" id="remark" class="remark" value="<?php echo $run->order_remarks; ?>" >
									<table id="example2<?php echo $run->row_number; ?>" class="table table-striped table-bordered" cellspacing="0" width="100%">
										<thead>
											<h4><?php echo $run->branchname ?> - Running Order On - <?php echo $run->request_date; ?>  
											</h4> <h4>  Request No : <?php echo $run->pr_req_no;?></h4> 
										<tr>
											<th>Item Name/Outlet</th>
											<th>Quantity</th>
										</tr>
									</thead>
									<tbody>
										<?php
										$uname=$_SESSION['username'];
										$r_date = date("Y-m-d", strtotime($run->request_date));
										$request_id = $run->request_id;
										$q2 = $this->db->query("select * from product_request as P,product_request_item as PI where P.request_id=PI.request_id and P.dept='$uname' and (P.request_date='$r_date') and P.request_id='$request_id'");
										$req_res2 = $q2->result();
										foreach($req_res2 as $req_row2) { ?>
										<tr>
											<td><?php echo $req_row2->item_name; ?></td>
											<td><?php echo $req_row2->required_qty; ?></td>
										</tr>
										<?php } ?>
									</tbody>
									</table>
								<?php } ?>
						</div>
						
				
						</div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>
<!--/ Zero configuration table -->



<!--/ Language - Comma decimal place table -->

        </div>
      </div>
    </div>
    <!-- END: Content-->

   <?php //require('include/theme_customizer.php');?>
 <?php 
  $footer_file=APPPATH.'views/include/footer.php';
	require($footer_file);
	?>
<script>
	$(document).ready(function() {
	<?php 
		foreach($run_ord as $run) {	
		$i = $run->row_number;
	?>
		var branch = $(".branch").eq(<?php echo $i-1; ?>).val();
		var rdate = $(".rdate").eq(<?php echo $i-1; ?>).val();
		$('#example2<?php echo $run->row_number; ?>').DataTable( {
			"paging": false,
			"lengthChange": false,
			"searching": false,
			"ordering": false,
			"info": false,
			"lengthMenu": false,
			dom: 'Bfrtip',
			
					
			buttons: [
			   { extend: 'excel', footer: true, title: 'Request_Report(Running-Order) on ' +rdate+ ' Branch: ' +branch},
				{ extend: 'pdfHtml5', footer: true, header: true, title: 'Request_Report(Running-Order) on' +rdate+ ' Branch: ' +branch, pageSize: 'A4',  orientation: 'landscape' },
			]
		} ); <?php } ?>
	});
</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>