<?php $__env->startSection('title', 'Customer Report List'); ?>

<?php $__env->startPush('css'); ?>
	<link rel="stylesheet" href="<?php echo e(asset('backend/plugins/select2.min.css')); ?>">
	<!-- bootstrap-datetimepicker -->
	<link rel="stylesheet" href="<?php echo e(asset('myfile/backend/assets/datepicker/zebra_datepicker.min.css')); ?>" type="text/css">
	<link rel="stylesheet" href="<?php echo e(asset('myfile/backend/assets/datepicker/examples.css')); ?>" type="text/css">
	<style>
		#search-btn{
			margin-top:24px;
		}
		/*thead{
			font-size: 11px;
		}
		tbody{
			font-size: 11px;
		}*/
	</style>
<?php $__env->stopPush(); ?>
<?php $__env->startSection('content'); ?>
<div class="right_col" role="main">
        <div class="">
            <div class="row">
                <div class="col-md-12 col-sm-12 col-xs-12">
                    <div class="x_panel">
                        <div class="x_title">
                        	<a href="<?php echo e(route('report.csri')); ?>" calss="btn" ><h2><i class="fa fa-mail-reply"></i></h2></a>
                            <h2>Customer Transaction Records </h2>
                            <ul class="nav navbar-right panel_toolbox">
                                <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
                                </li>
                                <li class="dropdown">
                                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button"
                                       aria-expanded="false"><i class="fa fa-wrench"></i></a>
                                    <ul class="dropdown-menu" role="menu">
                                        <li><a href="#">Settings 1</a>
                                        </li>
                                        <li><a href="#">Settings 2</a>
                                        </li>
                                    </ul>
                                </li>
                                <li><a class="close-link"><i class="fa fa-close"></i></a>
                                </li>
                            </ul>
                            <div class="clearfix"></div>
                        </div>
                        <div class="x_content">
							<form id="demo-form2" action="<?php echo e(route('report.csrs')); ?>" method="post" data-parsley-validate class="form" autocomplete="off" >
								<?php echo e(csrf_field()); ?>

								<div class="row">
									<div class="col-sm-1"></div>
									<div class="col-sm-3">
										<div class="form-group">
											<label>Customer List </label>
											<select name="customer_id" id="customer_id" class="form-control select2">
												<option value="All">All</option>
												<?php $__currentLoopData = $customers; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $pr): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
													<option value="<?php echo e($pr->customer_id); ?>" <?php echo $pr->customer_id == request()->customer_id ? 'selected' : '';   ?> ><?php echo e($pr->customer_name); ?> </option>
												<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
											</select>
										</div>
									</div>
									<div class="col-sm-2">
										<div class="form-group">
											<label>From</label>
											<input id="datepicker-range-start" type="text" name="from_date"  class="form-control" data-zdp_readonly_element="false">
										</div>
									</div>
									<div class="col-sm-2">
										<div class="form-group">
											<label>To</label>
											<input id="datepicker-range-end" type="text" name="to_date"  class="form-control" data-zdp_readonly_element="false">
										</div>
									</div>
									<div class="col-sm-2">
										<div class="form-group">
											<label>Report Type</label>
											<select class="form-control select2" name="report_type">
												<option value="Invoice" <?php echo request()->report_type == 'Invoice' ? 'selected' : ''; ?> >Invoice Report</option>
												<option value="Product" <?php echo request()->report_type == 'Product' ? 'selected' : ''; ?> >Product Report</option>
												<option value="Payment" <?php echo request()->report_type == 'Payment' ? 'selected' : ''; ?> >Payment Report</option>
												<option value="All_Due" <?php echo request()->report_type == 'All_Due' ? 'selected' : ''; ?> >All Due Report</option>
												<option value="Sales_Due" <?php echo request()->report_type == 'Sales_Due' ? 'selected' : ''; ?> >Sales Due Report</option>
												<option value="Statement" <?php echo request()->report_type == 'Statement' ? 'selected' : ''; ?> >Statement Report</option>
												<option value="Record" <?php echo request()->report_type == 'Record' ? 'selected' : ''; ?> >Customer Record</option>
											</select>
										</div>
									</div>
									<div class="col-sm-1">
										<div class="form-group">
											<button class="btn btn-primary btn-xs" id="search-btn">
												<i class="ace-icon fa fa-search fa-2x icon-only"></i>
											</button>
										</div>
									</div>
									<div class="col-sm-1">
										<a href="#" id="search-btn" class="btn btn-primary btn-xs" onclick="printDiv('printableArea')">
											<i class="ace-icon fa fa-print fa-2x icon-only"></i>
										</a>
									</div>
								</div>
							</form>
							<hr/>
							<div class="row">
								<div class="col-md-12 col-sm-12 col-xs-12">
									<div class="x_content" id="printableArea">
										<div class="row">
											<div class="col-xs-12 col-sm-12">
											<?php if($sales != ''): ?>
												<div class="row">
													<div class="col-xs-1"></div>
													<div class="col-xs-1">
														<img src="<?php echo e(asset('storage/about/'.about()->logo)); ?>" class="img-responsive img-thumbnail" alt="logo" width="85px" height="75px" >
													</div>
													<div class="col-xs-8">
														<div class="text-center">
															<h4><?php echo e(about()->english_name); ?></h4>
															<h5>Customer Transaction Records</h5>
														    <p>Customer Name: <?php echo e($ty != 'All' ? $ty->name : $ty); ?></p>
															<p>From: <?php echo e(date("d-m-Y", strtotime($from))); ?> - <?php echo e(date("d-m-Y", strtotime($to))); ?></p>
														</div>
													</div>
													<div class="col-xs-2"></div>
												</div>
												<table class="table table-condensed table-bordered">
													<thead>
														<tr>
															<th>SL</th>
															<th>Date</th>
														<?php if($ty == 'All'): ?>
															<th>Customer</td>
														<?php endif; ?>
															<th>Total Price</th>
															<th>Payment Amount</th>
															<th>Due Amount</th>
															<th>Previous Due</th>
															<th>Total Due</th>
															<!--<th>Message</th>-->
														</tr>
													</thead>
													<tbody>
													<?php $__currentLoopData = $sales; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key=>$sl): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
														<tr>
															<td><?php echo e($key + 1); ?></td>
															<td><?php echo e(date("d-m-Y", strtotime($sl->transaction_date))); ?></td>
														<?php if($ty == 'All'): ?>
															<th><?php echo e($sl->customer->name); ?></td>
														<?php endif; ?>
															<td><?php echo e($sl->total_price); ?></td>
															<td><?php echo e($sl->payment_amount); ?></td>
															<td><?php echo e($sl->due_amount); ?></td>
															<td><?php echo e($sl->previous_due); ?></td>
															<td><?php echo e($sl->total_due); ?></td>
															<!--<td><?php echo e($sl->message); ?></td>-->
														</tr>
													<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
														<!--<tr>
														<?php if($ty == 'All'): ?>
															<th colspan="2"></th>
														<?php else: ?>
														<th colspan="1"></th>
														<?php endif; ?>
															<th>Total=</th>
															<th><?php echo e($sales->sum('total_price')); ?></th>
														    <th><?php echo e($sales->sum('payment_amount')); ?></th>
														    <th><?php echo e($sales->sum('due_amount')); ?></th>
														    <th><?php echo e($sales->sum('previous_due')); ?></th>
														    <th><?php echo e($sales->sum('total_due')); ?></th>
														</tr>-->
													</tbody>
												</table>
											<?php if($ty != 'All'): ?>
											<?php if(!empty($sales)): ?>
												<table class="table table-bordered table-condensed" style="max-width:25%; float:right">
													<tbody>
														<tr>
															<th>Total Due:</th>
															<th><?php echo e($ty->sales->sum('due_amount')); ?></th>
														</tr>
													</tbody>
												</table>
											<?php endif; ?>
											<?php endif; ?>
											
											<?php else: ?>
												<p align="center">Sory! no data found.</p>
											<?php endif; ?>
											</div>
										</div>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
<?php $__env->stopSection(); ?>

<?php $__env->startPush('js'); ?>
<script src="<?php echo e(asset('backend/plugins/select2.min.js')); ?>"></script>
<!-- Jquery Plugin For Date Calender-->
<script type="text/javascript" src="<?php echo e(asset('myfile/backend/assets/datepicker/zebra_datepicker.src.js')); ?>"></script>
<script type="text/javascript" src="<?php echo e(asset('myfile/backend/assets/datepicker/examples.js')); ?>"></script>
<script>
  $(document).ready(function(){
	    // select2 section
        $('.select2').select2()	;
    });

  function printDiv(divName) {
		 var printContents = document.getElementById(divName).innerHTML;
		 var originalContents = document.body.innerHTML;
		 document.body.innerHTML = printContents;
		 window.print();
		 document.body.innerHTML = originalContents;
		}
</script>
<?php $__env->stopPush(); ?>
    
 
<?php echo $__env->make('backend.layouts.master', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>