<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?>

      <div class="main my-0">
        <div class="row mt-3 mx-0">
          <div class="col-md-6">
            <h3><?php echo $pgheading;?></h3>
          </div>
          <div class="col-md-5 text-right">
            &nbsp;
          </div>
        </div>
        
        <div class="container_fluid mt-2 px-3">
		<section class="tablewrap1">
		<div class="col-md-12">
		<div class="tablebox table-responsive">
			
		<div class="text-right mb-2">
			<strong>Posted On:</strong> <?php if($info4view) { echo dfltdttmFormat($info4view->fld_datetime); }?>			
		</div>              
           
<?php	
$totalrow = 1;
$totalamount = 0;
if(is_array($transinfo4view) && count(array_filter($transinfo4view))>0)
{
?>                                      
<table class="table-bordered">
	<thead>
	</thead>
		<tbody>
				<tr>
					<td style="vertical-align:top;" width="59%"><strong>Pass Number:</strong> <?php if($info4view) { echo $info4view->fld_refno; }?></td>
					<td style="vertical-align:top;" width="41%"><strong>Warehouse:</strong> <?php if($info4view) { echo $info4view->warehousename; }?></td>
				</tr>			
				<tr>
				<td style="vertical-align:top;"><strong>PAss Date:</strong> 
				<?php if($info4view) { echo dfltdtFormat($info4view->fld_refdate); }?></td>
					<td style="vertical-align:top;"><strong>Client:</strong> <?php if($info4view) { echo $info4view->clientname; }?></td>
					
				</tr>

				
		  </tbody>
		</table>
		<br>		
		<br>
		<h5 class="mb-0">Product Info.</h5>
		<br>
		<table class="webforms mt-0 table-responsive-sm">
		<thead>
		<tr>
			<th width="4%" class="text-left">Serial</th>
			<th width="32%" class="text-left">Product</th>
			<th width="10%">Case Qty.</th>
			<th width="10%">Bottle Qty.</th>				
			<th width="10%" class="text-left">Case<br> Price</th>
			<th width="10%" class="text-left">Bottle<br> Price</th>
			<th width="16%"  class="text-right">Sub Total <?php echo CURRENCY;?> </th>				
		</tr>
		</thead>
		<tbody>
<?php
		$poindex = 1;
		$subtotalamount = 0;
		$totalamount = 0;
		$caseqty = 0;
		$bottleqty = 0;
		foreach($transinfo4view as $row)
		{
			$subtotalamount += ($row->fld_subtotal);
			$caseqty += $row->fld_qty_case;
			$bottleqty += $row->fld_qty_bottle;
?>
						<tr>
							<td class="text-left"><?php echo $poindex;?></td>
							<td class="text-left"><?php echo $row->fld_name;?></td>
							<td class="text-center"><?php echo $row->fld_qty_case;?></td>
							 <td class="text-center"><?php echo $row->fld_qty_bottle;?></td>
							<td class="text-left"><?php echo $row->fld_price_case;?></td>
							<td class="text-left"><?php echo $row->fld_price_bottle;?></td>
							<td class="text-right"><?php echo $row->fld_subtotal;?></td>
						</tr>
<?php
$poindex++;
}													
?>
						<tr>
							<td  colspan="2">&nbsp;</td>
							<td class="text-center"><?php echo $caseqty;?></td>
							<td class="text-center"><?php echo $bottleqty;?></td>
							<td colspan="2" class="text-left"><strong>Sub Total:</strong></td>
							<td  class="text-right" ><strong><?php echo sprintf('%0.2f', $subtotalamount);?></strong></td>
						</tr> 
						<tr>
							<td  colspan="5">&nbsp;</td>
							<td class="text-left"><strong> Vat Amount :</strong></td>
							<td class="text-right">
							<?php if($info4view) { echo $info4view->fld_vatamount; }else { echo 0; }?>
							</td>
						</tr>
						<tr>
							<td  colspan="5">&nbsp;</td>
							<td class="text-left"><strong> TSC Amount :</strong></td>
							<td class="text-right">
							<?php if($info4view) { echo $info4view->fld_tscamount; }else { echo 0; }?>
							</td>
						</tr>						
							
						<tr>
							<td  colspan="5">&nbsp;</td>
							<td class="text-left"><strong> Discount :</strong></td>
							<td class="text-right">
								<?php if($info4view) { echo $info4view->fld_discount; }else { echo 0; }?>
							</td>
						</tr>
						<tr>
							<td  colspan="5">&nbsp;</td>
							<td class="text-left"><strong> Adjustment :</strong></td>
							<td class="text-right">
							<?php if($info4view) { echo $info4view->fld_adjustment; }else { echo 0; }?>
							</td>
						</tr>
					
						<tr>
							<th  colspan="5">&nbsp;</th>  
							<th class="text-left" width="15%"><strong>Net Amount:</strong></th>
							<th class="text-right" width="15%"><strong><?php if($info4view) { echo number_format($info4view->fld_amount,2); }else { echo 0; }?></strong></th>
						</tr>				
					</tbody>
				</table>
				<?php
				if($info4view->fld_remarks!="")
				{
				?>
				<p><strong>Remark: <?php echo $info4view->fld_remarks;?></strong></p>
		<?php
				}
				}													
		?>			
		<br><br>
		
  </div>
  </div>
  </section>     
	 <div class="clearfix"></div>
	</div>
	</div>
<?php
if($tasktype=="print")
{
	?>
<script>
    window.print();
    
</script>
<?php
}
?>
