<!DOCTYPE html>
<html>
	<head>
		<title><?php echo $title; ?></title>
		<base href="<?php echo base_url(); ?>">
		<meta charset="utf-8">
		<!-- Tell the browser to be responsive to screen width -->
		<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">

		<link rel="shortcut icon" href="assets/images/favicon.png" type="image/x-icon">

		<!-- Theme style -->
		<link rel="stylesheet" href="assets/AdminLTE-3.2.0/dist/css/adminlte.min.css">

		<!-- Google Font: Source Sans Pro -->
		<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700&display=fallback">
	</head>

	<body>
		<div class="wrapper">
			<!-- Main content -->
			<section class="content">
				<div class="container-fluid">
					<!-- Small boxes (Stat box) -->
					<div class="row">
						<div class="col-md-12">
							<!-- Invoice content -->
							<div class="invoice p-3 mb-3">
								<!-- title row -->
								<div class="row mb-4">
									<div class="col-12">
										<h2 class="page-header">
											<img src="<?php echo $this->session->company_logo; ?>" width="115" class="img">
											<small class="float-right"><?php echo $this->session->company_name; ?></small>
										</h2>
										<h3 class="text-center">Purchase Return Report</h3>
									</div>
								</div>

								<!-- info row -->
								<div class="row invoice-info mb-4">
									<div class="col-md-6 invoice-col">
										<strong>Date From:</strong> <?php echo date( 'jS M, Y ', strtotime( date_to_db( $start_date ) ) ); ?><br>
										<strong>Date To:</strong> <?php echo date( 'jS M, Y ', strtotime( date_to_db( $end_date ) ) ); ?>
									</div>
								</div>

								<!-- Table row -->
								<div class="row">
									<div class="col-md-12">
										<table class="table table-striped table-bordered table-hover">
											<thead>
												<tr>
													<th>SL No</th>
													<th>Purchase Return No</th>
													<th class="text-center">Purchase Return Date</th>
													<th class="text-right">Item Quantity</th>
													<th class="text-right">Total Price</th>
												</tr>
											</thead>
											<tbody>
												<?php
													$i        = 1;
													$quantity = 0;
													$price    = 0;
													foreach ( $purchase as $key => $value ) {
														if ( $value['item_quantity'] ) {
														?>
														<tr>
															<td><?php echo $i; ?></td>
															<td><?php echo $value['purchase_return_no']; ?></td>
															<td class="text-center"><?php echo $value['purchase_return_date']; ?></td>
															<td class="text-right"><?php echo number_format( $value['item_quantity'] ?? 0 ); ?></td>
															<td class="text-right"><?php echo number_format( $value['total_price'] ?? 0, 2 ); ?></td>
														</tr>
														<?php
															$quantity += $value['item_quantity'];
															$price += $value['total_price'];
															$i++;
														}
													}
												?>
											</tbody>
											<tfoot>
												<tr>
													<td class="text-center" colspan="3"><b>Grand Total</b></td>
													<td class="text-right"><?php echo number_format( $quantity ?? 0 ); ?></td>
													<td class="text-right"><?php echo number_format( $price ?? 0, 2 ); ?></td>
												</tr>
											</tfoot>
										</table>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</section>
		</div>
	</body>
</html>