<?php
$user = auth()->user();
?>
<script src="assets/js/king-table.js"></script>
<div class="content">
	<div class="main-content">
		<!-- DATA EXPORT -->
		<form id="frmothercharges" name="frmothercharges" method="get" data-parsley-validate novalidate>
<input type="hidden" name="_token" id="_token" value="<?php echo e(csrf_token()); ?>">
<div class="widget widget-table">
			<div class="widget-header">
				<h3><i class="fa fa-eye"></i> <?php echo e(__('report.search_records')); ?> </h3>
			</div>
			<div class="widget-content">
			<?php
			/*
				<div class="row">
					<div class="col-md-6">{{ __('mylanguage.select_grade') }}
						<input type="hidden" id="edit_grd_id" name="edit_grd_id" value="{{ isset($data) ? $data['grd_id'] : '0'  }}">
						<select id="grd_id" name="grd_id" class="form-control" >
							<option value="">-- {{ __('mylanguage.select_grade') }} --</option>
						</select>
					</div>
					<div class="col-md-6">{{ __('report.fund_type') }}
						<input type="hidden" id="edit_ftyp_id" name="edit_ftyp_id" value="{{ isset($data) ? $data['ftyp_id'] : '0'  }}">
						<select name="ftyp_id" id="ftyp_id" class="form-control">
							<option value=""> -- {{ __('grade.fund_type') }} --</option>
						</select>
					</div>
				</div>
			*/
			?>
				<div class="row">
					<?php
					/*
					<div class="col-md-4">{{ __('report.transaction_type') }} 
						<input type="hidden" id="edit_grfn_paycycle" name="edit_grfn_paycycle" value="{{ $data['grfn_paycycle'] }}">
						<select name="grfn_paycycle" id="grfn_paycycle" class="form-control" required>
							<option value="">-- {{ __('grade.billing_cycle') }} --</option>
							<option value="Payment">Payment</option>
							<option value="Daily">{{ __('grade.Daily') }}</option>
							<option value="Weekly">{{ __('grade.Weekly') }}</option>
							<option value="Monthly">{{ __('grade.Monthly') }}</option>
							<option value="Quarterly">{{ __('grade.Quarterly') }}</option>
							<option value="Semiannually">{{ __('grade.Semiannually') }}</option>
							<option value="Yearly">{{ __('grade.Yearly') }}</option>
							<option value="Onetime">{{ __('grade.Onetime') }}</option>
						</select>
					</div>
					
					<div class="col-md-4">{{ __('report.transaction_fdate') }}
					<input type="date" class="form-control" name="fdate" id="fdate"  value="{{ isset($data) ? $data['fdate'] : date('Y-m-d') }}">
					</div>
					*/
					?>
					<div class="col-md-1"><?php echo e(__('report.transaction_tdate')); ?></div>
					<div class="col-md-4">
						<input type="date" class="form-control" name="tdate" id="tdate"  value="<?php echo e(isset($data) ? $data['tdate'] : date('Y-m-d')); ?>">
					</div>
					<div class="col-md-7">
						<button type="button" id="btnsubmitall" name="btnsubmitall" class="btn btn-default sideClick1" ><i class="fa fa-arrows" aria-hidden="true"></i> Filter Records</button>
					</div>
				</div>
			</div>
			<?php
			/*
			<div class="widget-header">
				<center>
		<button type="button" id="btnsubmitall" name="btnsubmitall" class="btn btn-default sideClick1" ><i class="fa fa-arrows" aria-hidden="true"></i> Filter Records</button>
				</center>
			</div>
			*/
			?>
		</div>
		</form>
		<!-- END DATA EXPORT -->
<hr>
		<!-- DATA EXPORT -->
		<div class="widget widget-table">
			<div class="widget-header">
				<h3><i class="fa fa-table"></i> <?php echo e(__('report.ministatement')); ?></h3>
			</div>
			<div class="widget-content">
				<table  class="table table-sorting table-striped table-hover table-bordered datatable">
					<thead>
						<tr>
							<th> <?php echo e(__('report.ministatement')); ?> :- <?php echo e(date("d-m-Y",strtotime($data['tdate']))); ?></th>
							<th style='width: 125px;text-align: right;'><?php echo e(__('report.transaction_bill')); ?></th>	
						</tr>
					</thead>
					<tbody>
						<tr>
							<th> <?php echo e(__('report.previousstatement')); ?> </th>
							<td style='width: 125px;text-align: right;'>
							 <?php echo e($data['trn_transaction'][0]->prepaidamt + $data['trn_transaction'][0]->preadvamt + $data['trn_transaction'][0]->preprepayamt); ?></td>	
						</tr>
						<tr>
							<th> <?php echo e(__('report.todaysministatement')); ?> </th>
							<td style='width: 125px;text-align: right;'> <?php echo e($data['trn_transaction'][0]->currpaidamt + $data['trn_transaction'][0]->curradvamt + $data['trn_transaction'][0]->currprepayamt); ?></td>	
						</tr>
						<tr>
							<th style='text-align: right;'>Total :</th>
							<th style='text-align: right;'><?php echo e($data['trn_transaction'][0]->prepaidamt + $data['trn_transaction'][0]->preadvamt + $data['trn_transaction'][0]->preprepayamt + $data['trn_transaction'][0]->currpaidamt + $data['trn_transaction'][0]->curradvamt + $data['trn_transaction'][0]->currprepayamt); ?></th>				
						</tr>
					</tbody>
				</table>
			</div>
			<div class="widget-header">
				<center>
<a type="button" id="btnprintreport" name="btnprintreport" href="splminitransprint?tdate=<?php echo e($data['tdate']); ?>" class="btn btn-default" target="_blank" ><i class="fa fa-print" aria-hidden="true"  ></i> Print report</a>
				</center>
			</div>
		</div>
		<!-- END DATA EXPORT -->
	</div>
</div>
<!-- /main -->
<style>
.modal-dialog.modal-100 {
    width: 90%;
    /*margin: 30px auto;*/
}
</style>

<script>
	$('.createMod').click(function(e)
	{   
		e.preventDefault();
		$('#sideMenu').load($(this).attr('href'));
	});
	
</script>
<script>
	//load Full fund types 	edit_grd_id edit_grd_id
	$(document).ready(function(){
		var edit_grd_id = $('#edit_grd_id').val();
		$.ajax({
		type: "GET",
		url:"/loadgradelist",
		dataType: "json",
		success: function (data) {
			$.each(data,function(i,obj)
			{
				if(edit_grd_id ==0)
				{
					var div_data="<option value="+obj.grd_id+">"+obj.grd_grade+" (" + obj.grd_prefix + ")</option>";	
				}
				else 
				{
					if(edit_grd_id == obj.grd_id)
					{
						var div_data="<option value="+obj.grd_id+" selected>"+obj.grd_grade+" (" + obj.grd_prefix + ")</option>";	
					}
					else{
						var div_data="<option value="+obj.grd_id+">"+obj.grd_grade+" (" + obj.grd_prefix + ")</option>";		
					}
				}
				$(div_data).appendTo('#grd_id');
				$(div_data).appendTo('#grd_selectgradeid');
			});  
		}
		});
	});
</script>
<script>
	//load Full fund types 	edit_ftyp_id edit_grd_id
	$(document).ready(function(){
		var edit_ftyp_id = $('#edit_ftyp_id').val();
		$.ajax({
		type: "GET",
		url:"/loadfundtypelist",
		dataType: "json",
		success: function (data) {
		$.each(data,function(i,obj)
		{
			if(edit_ftyp_id ==0)
			{
				var div_data="<option value="+obj.ftyp_id+">"+obj.ftyp_fundtype+"</option>";	
			}
			else 
			{
				if(edit_ftyp_id == obj.ftyp_id)
				{
					var div_data="<option value="+obj.ftyp_id+" selected>"+obj.ftyp_fundtype+"</option>";	
				}
				else{
					var div_data="<option value="+obj.ftyp_id+">"+obj.ftyp_fundtype+"</option>";		
				}
			}
		 $(div_data).appendTo('#ftyp_id'); 
		});  
		}
		});
	});
</script>
<script>
/*
	$(document).ready(function(){
		var selectedval = document.getElementById("edit_grfn_paycycle").value;
		$('#grfn_paycycle').val(selectedval);
	});
*/
</script>
<script>
	function reloadtransreport()
	{
			document.getElementById("btnsubmitall").innerHTML = "<i class='fa fa-arrows fa-spin' aria-hidden='true'></i> Fetching Records";
			var _token = $("input[name='_token']").val();
			var member_id =  $('#member_id').val();
			var grd_id =  $('#grd_id').val();
			var ftyp_id  =  $('#ftyp_id').val();
			var grfn_paycycle =  $('#grfn_paycycle').val();
			var fdate =  $('#fdate').val();
				$.ajax({
					url: "/transactionreport",
					type: 'get',
					//data: {_token:_token, member_id:member_id, grd_id: grd_id, ftyp_id: ftyp_id, grfn_paycycle: grfn_paycycle, fdate:fdate, tdate:tdate},
					success: function(data)
					{
						$('#reloadrecord').html(data);
						document.getElementById("btnsubmitall").innerHTML = "<i class='fa fa-arrows' aria-hidden='true'></i> Filter Records";
					}
				});
	}
</script>
<script>
$('.sideClick1').click(function(e)
{
	//document.getElementById("btnsubmitall").innerHTML = "<i class='fa fa-arrows fa-spin' aria-hidden='true'></i> Fetching Records";
	var _token = $("input[name='_token']").val();
	//var member_id =  $('#member_id').val();
	//var grd_id =  $('#grd_id').val();
	//var ftyp_id  =  $('#ftyp_id').val();
	//var grfn_paycycle =  $('#grfn_paycycle').val();
	//var fdate =  $('#fdate').val();
	var tdate =  $('#tdate').val();
	var submit =  $('#btnsubmitall').val();
	e.preventDefault();
	//$('#sideMenu').load('transactionreport?member_id=' + member_id + '&grd_id='+grd_id + '&ftyp_id='+ ftyp_id + '&grfn_paycycle='+grfn_paycycle + '&fdate='+fdate + '&tdate='+tdate+'&submit=submit');
	$('#sideMenu').load('jamathminitransreport?tdate='+tdate+'&submit=submit');
});
</script>