<?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>
    .sub_heading{
    font-weight: 500!important;
    }
    td {
    font-size: 18px!important;
    }
    th {
    font-size: 18px!important;
    }
    h6 {
    font-size: 18px!important;
    }
    table.table.table-bordered {
        width: 87%!important;
    }
    @media print {
	@page {
	size: A5;
	margin: 0;
	}
	.sub_heading{
    font-weight: 500!important;
    }
    td {
    font-size: 18px!important;
    }
    th {
    font-size: 18px!important;
    }
    h6 {
    font-size: 18px!important;
    }
    table.table.table-bordered {
        width: 83%!important;
    }
    }
</style>
  <style>
 /* @media print
    {
    	@page {
    
    	size: 80mm 3276mm;
    	size: A4;
    	size: portrait;
    	margin: 0% 2% 0% 2%;
    	
    	}
    	html {
    	
    	background: #eee;
    	}
    	.hidden-print,
        .hidden-print * {
            display: none !important;
        }
        .fn{
            font-weight: 600!important;
        }
        td,
        th,
        tr,
        table {
            border-top: 1px solid black!important;
            border-collapse: collapse!important;
             align-content: left;
        }
        .ticket {
            width: 37%;
            max-width: 37%;
        }
        td.slno,
        th.slno{
            width: 13%!important;
            max-width: 13%!important;
            word-break: break-all!important;
        }
        
        td.descriptions,
        th.descriptions {
            width: 37%!important;
            max-width: 37%!important;
            text-align: left!important;
        }
        .centered {
            text-align: center!important;
            align-content: center!important;
        }
        .centered2{
            text-align: center!important;
            align-content: center!important;
            font-size:14px!important;
            border-top: 1px solid white!important;
        }
        td.quantity,
        th.quantity {
            width: 17%!important;
            max-width: 17%!important;
            text-align: right!important;
        }
         * {
    font-size: 12px;
    font-family: 'Verdana';
    }
	}
	 .fn{
            font-weight: 600!important;
        }
      * {
    font-size: 12px;
    font-family: 'Verdana';
    }

    td,
    th,
    tr,
    table {
        border-top: 1px solid black!important;
        border-collapse: collapse!important;
        align-content: center;
    }
    .ticket {
        width: 37%;
        max-width: 37%;
    }
    td.slno,
    th.slno{
            width: 13%!important;
    max-width: 13%!important;
        word-break: break-all!important;
    }
    td.descriptions,
    th.descriptions {
        width: 37%!important;
        max-width: 37%!important;
        text-align: left!important;
    }
    td.quantity,
    th.quantity {
        width: 17%!important;
        max-width: 17%!important;
        text-align: right!important;
    }
    
    .centered {
        text-align: center!important;
        align-content: center!important;
    }
    .centered2{
        text-align: center!important;
        align-content: center!important;
        font-size:14px!important;
        border-top: 1px solid white!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" >
        <div class="table-responsive col-12" id="ele3">
        <?php
          foreach($issue as $iss)
        ?>
            <div class="col-sm-12">
				<strong><h1 style="text-align:center;font-weight: 500;"> By2Coffee <br/>
				<h4 style="text-align:center;font-weight: 500;">	No 25, ASI Industrial Area <br/> Nayandahalli, Bangalore-65<br/>GSTIN No:29AYMPR0184Q1ZF <br/> FSSAI Lic No. 11218332000098</h4>
				<h3 style="text-align:center;margin-top: -3px;font-weight: 500;">TAX INVOICE</h3></strong>
				
			</div>
			
			
			<div class="col-sm-12">

            <table class="table table-bordered ">
                
                <thead>
                           
                    <tr>
    					<td colspan="5" class="border_none">
					    	<h6 align="left"><strong >Invoice Date</strong><strong >:</strong><strong><?php echo date('d-m-Y',strtotime($iss->issue_date)); ?></strong></h6>
							
						    <!--<h6 align="left"><strong>Invoice Time</strong><strong>:</strong><strong><?php //echo $iss->issue_time; ?></strong></h6>-->
							
							<h6 align="left"><strong>Invoice No</strong><strong>:</strong><strong><?php echo $iss->invoice_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;
								//echo $oname;
								$query = $this->db->query("select * from address where outlet='$oname'");
        						foreach($query->result_array() as $row)
        						$org_names=$row['org_name'];
        						echo $org_names; ?></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 sub_heading">
							Sl.No
						</th>
						<th class="text-center text-capitalize sub_heading">
							Item name
						</th>
						<th class="text-center text-capitalize sub_heading">
							HSN Code
						</th>
						<th class="text-center  sub_heading">
							Rate
						</th>
						<th class="text-center  sub_heading">
							Qty
						</th>
						<th class="text-center  sub_heading">
							Value
						</th>
						<th class="text-center  sub_heading">
							Tax
						</th>
						<th class="text-center sub_heading">
							Tax Amt
						</th>
						<th class="text-center text-capitalize sub_heading">
							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->issue_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->price; ?>" ><?php echo $isitem->price; ?></td>
							<td class="text-center"><?php echo $isitem->issued_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_price; ?>" ><?php echo $isitem->total_price; ?></td>
						</tr>
						<?php
							$count++;
						}
					?>
					
					<tr>
						<?php  
							foreach($issue_total as $ist)
							$amount = $ist->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($ist->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 $ist->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>
			</div>
			<br/>
			<div class="col-sm-12 text-right" style="margin-left: -142px;">
				<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>
  
    </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>     
<!-- // 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('Issues/issueFPTaxList/'.$submod_id);?>';
  } 
</script>
  