<?php 
  $header_file=APPPATH.'views/include/header.php';
  require($header_file);
  $sidenav_file=APPPATH.'views/include/sidenav.php';
  require($sidenav_file);
  $c_t_w_file=APPPATH.'views/currency_to_words.php';
  require($c_t_w_file);
  ?>
<style>
	.border_none
	{
		border: none!important;
	}
	@media print {
	    .other
		{
			width: 99.6%!important;
		}
		.dnone
		{
		    display : block!important;
		}
		
/*	html, body {
    width: 210mm;
    height: 297mm;
  }*/



        @page {
          size: A4;
          margin : 0.5cm 0cm 1cm 0.5cm!important;
          /*margin : 0;
          width:8.27in!impor*/
        }
	}
</style>  
  
  <style>

	
	td.left_align {
        text-align: left!important;
    }
    th.right_align {
        text-align: right!important;
    }
</style>
<!-- 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-6 col-12 mb-2 breadcrumb-new">
            <h3 class="content-header-title mb-0 d-inline-block">Issues</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="#">Issues</a>
                  </li>
                  <li class="breadcrumb-item active">Issues
                  </li>
                </ol>
              </div>
            </div>
          </div>
         
        </div>
        <div class="content-body"><section class="card">
  <div id="invoice-template" class="card-body p-4">
    <!-- Invoice Items Details -->
    <div id="invoice-items-details" class="pt-2">
      <div class="row" id="ele3">
        <div class="table-responsive col-12">
        <?php
          foreach($issue as $iss)
        ?>
            <div class="col-sm-12">
				<h1 style="text-align:center;"> By2Coffee <br/>
					<!--#611/S/31/1B, block F, <br/> Doddakelasandra Ind Area, <br/> Uttarahalli Hobli, <br/>Bangalore-62 080-22977742 <br/> 080-22977742<br/>
					GSTIN : 29AAFCP9453Q1ZE--> </h1>
			</div>
			<div class="col-sm-6">
				<h4 style="text-align:right;">   
				</div>
				<div class="col-sm-12" style="   ">
					<h3 style="text-align:center;margin-top: -3px;">ISSUE DETAIL</h3><hr>
				</div>
			</div>
			

            <table class="table table-bordered ">
                
                <thead>
                           
                    <tr>
    					<td colspan="5" class="border_none">
					    	<h6 align="left"><strong >Issue Date</strong><strong >:</strong><strong><?php echo date('d-m-Y',strtotime($iss->issue_date)); ?></strong></h6>
							
						    <!--<h6 align="left"><strong>Issue Time</strong><strong>:</strong><strong><?php // echo $iss->issue_time; ?></strong></h6>-->
							
							<h6 align="left"><strong>DC No</strong><strong>:</strong><strong><?php echo $iss->issue_no; ?></strong></h6>
						
    						
    					</td>
    					<td colspan="5" class="border_none">
    					    <h6 align="right"><strong>Branch Name</strong><strong>:</strong><strong><?php //echo $order->outlet_name; ?>
									<?php 
								$oname = $iss->outlet_name;
								$query = $this->db->query("select * from address where outlet ='$oname'");
        						foreach($query->result_array() as $row)
        						//$company_name=$row['company_name'];
        						echo $oname; ?></strong></h6>
								
    					    <h6 align="right"><strong>Vehicle Name</strong><strong>:</strong><strong><?php echo $iss->vehicle_name; ?></strong></h6>
								
    					    <h6 align="right"><strong>GSTIN No</strong><strong>:</strong><strong><?php 
								
        						$gstin_no=$row['gstin_no'];
								
								echo $gstin_no; ?></strong></h6>
								
    						
    					</td>
    				</tr>
					<tr>
						<th class=" text-capitalize">
							Sl.No
						</th>
						<th class="text-center text-capitalize">
							Item name
						</th>
						<th class="text-center text-capitalize">
							HSN Code
						</th>
						<th class="text-center text-capitalize">
							Rate
						</th>
						<th class="text-center text-capitalize">
							Qty
						</th>
						<th class="text-center text-capitalize">
							Value
						</th>
						<th class="text-center text-capitalize">
							Tax
						</th>
						<th class="text-center text-capitalize">
							Tax Amt
						</th>
						<th class="text-center text-capitalize">
							Total Amt
						</th>
					</tr>
				</thead>
				<tbody>
					<?php
						$count = 1;
						foreach($issue_item as $isitem){
						
						?>
						<tr>
							<td class="text-center"><?php echo $count; ?></td>
							<td class="text-left"><?php echo $isitem->indent_item_name; ?></td>
							<td class="text-left"><?php echo $isitem->hsn_code; ?></td>
							<td class="text-center"><input type="hidden" name="price" id="price" class="t_price" value="<?php echo $isitem->issues_price; ?>" ><?php echo $isitem->issues_price; ?></td>
							<td class="text-center"><?php echo $isitem->indent_qty; ?></td>
							<td class="text-center"><input type="hidden" name="price_total" id="price_total" class="price_total" value="<?php echo $isitem->basic_price; ?>" ><?php echo $isitem->basic_price; ?></td>
							<td class="text-center"><?php echo $isitem->tax; ?>%</td>
							<td class="text-center"><input type="hidden" name="tax" id="tax" class="t_tax" value="<?php echo $isitem->tax_amount; ?>" ><?php echo $isitem->tax_amount; ?></td>
							<td class="text-center"><input type="hidden" name="total" id="total" class="t_amt" value="<?php echo $isitem->total_amount; ?>" ><?php echo $isitem->total_amount; ?></td>
						</tr>
						<?php
							$count++;
						}
					?>
					
					<tr>
						<?php  
							$amount = $iss->total;
						$b = (int)$amount; ?>
						<input type="hidden" name="amount" id="amount" value="<?php echo $b; ?>" >
						<td class="text-left text-capitalize" colspan="7" rowspan="1" style="text-align:left!important;">Amount in Words : 
							<p id="output" class="text-left">
								<?php echo $currency_object->get_bd_amount_in_text($iss->total); ?>
							</p>
						</td>
						<!--<td class="text-center">Round Off</td>
						<td class="text-center"><?php //echo $row['round_off'] ?></td>-->
						<td class="text-center"><strong>Grand Total</strong></td>
						<td class="text-center"><strong><?php echo $iss->total; ?></strong></td>
					</tr>
					<!--	<tr>
						<td class="text-center"><strong>Grand Total</strong></td>
						<td class="text-center"><strong><?php //echo $order->total_amt; ?></strong></td>
					</tr>-->
				</tbody>
			</table>
			<br/>
			<div class="col-sm-12 text-right">
				<div class="col-xl-12 ">
					<h6 align="right"><strong>For By2Coffee</strong></h6>
					</br>
					</br>
					<h6 align="right"><strong>Authorized Signature</strong></h6>
				</div>
			</div>
		
        </div>
      </div>
  
    </div>

    <!-- Invoice Footer -->
    <div id="invoice-footer">
      <div class="row">
        <div class="col-sm-7 col-12 text-center text-sm-left">
          <!--<h6>Terms & Condition</h6>
          <p>Test pilot isn't always the healthiest business.</p>-->
        </div>
        <div class="col-sm-5 col-12 text-center">
          <button type="button" id="print_receipt" class="btn btn-info btn-sm my-1 print_receipt"><i class="la la-paper-plane-o mr-50"></i>
            Print
            Invoice</button>
        </div>
      </div>
    </div>
    <!-- Invoice Footer -->

  </div>
</section>
</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>
  $("#print_receipt").click(function() {
    jQuery.print('#ele3');
    setTimeout("closePrintView()", 50);
  });
  function closePrintView() {
    window.location = '<?php echo site_url('MaterialRequest/issuesCList');?>';
  } 
  
</script>
  