
@php($message = 'Voucher preview  against   voucher details (Voucher Type:"'.$transaction->voucher_type.' "Voucher No: VR/" '.sprintf('%04d', $transaction->id).'") has been viewed')
    @php(EF::createLogs($message,'document'))
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Voucher</title>

<style type="text/css">
	
/* GENERAL CSS APPLY ALL SECTIONS*/

	.margin{
		padding-top: 8px;
	}
	
 	*{
 		margin: 0;
 		padding: 0;
 	}
	.clear{

		clear: both;
	}

	input[type=text]{
		border-top: 0;
		border-right: 0;
		border-left: 0;
		font-size: 12px;
		text-align: center;
	}



/*  #START=> MAIN SECTION */
	.main-section .row .col{
		
		margin-right: 0px;
		padding-right: 0px;
		float: left;
	}

	.main-section .row .col .check{
		vertical-align: middle;
		margin-top: 5px;
		
	}

label{
	font-size: 12pt;
}


 .border-hide{

 	border : 0;
 }

 .border-bottom{

 	border : 0;
 	border-bottom: 1px solid #000;
 }


 table{

 	border-collapse: collapse;

 	width: 100%;
 }

  table thead tr th{
 	font-size: 9pt;
 	border:1px solid #000;
 	text-align: center;
 	margin: 0;
 	padding: 2px;
 	height: 3%;
 }

 table tbody tr td{
 	font-size: 9pt;
 	border:1px solid #000;
 	text-align: center;
 	margin: 0;
 	padding: 1px;
 	height: 3%;

 }

</style>
</head>

<body class="pdf-body" style="margin:3% 5% 4% 5%;">

	
  @include('letters.pdf_letter_header')
     <br>
     <br>




	 <div class="container">
        <div class="main-section">
          {{--<center> <h3>{{strtoupper($transaction->compound_type)}} VOUCHER</h3></center>--}}
           <center><h3>{{strtoupper(EF::getFullVoucherList()[$transaction->voucher_type])}}</h3></center>
        <div class="clear">
         <br>
      <br>
  </div>
    <div class = "row margin" >
       <div class="col margin" style="width: 36%">
		<label>Voucher #<input style="width: 73%"; type="text" value="{{$transaction->voucher_type}}-{{$transaction->voucher_number}}"></label>
		</div> 
		 <div class="col margin" style="width: 35%">
		<label> Voucher Date: <input style="width: 63%"; type="text" value="{{EF::dateFormat($transaction->created_at)}}"></label>
		</div>
		  <div class="col margin" style="width: 35%">
		<label> Print Date: <input style="width: 61.8%"; type="text" value="{{EF::dateformat(date('Y-m-d'))}}"></label>
		</div> 
    </div>

          <div class="row clear">
          <table border="1" style="border-collapse: collapse; margin-top:3%; text-align: center; width:100%;">
            <thead>
              <tr>
              <th colspan="7" style="background: #E0E0E0; ">Voucher Details</th>
                
              </tr>
              <tr>


                 <th style="width:13%">Account Details</th>

                 <th style="width:9%">Customer</th>

                  <th style="width:10%">Booking Details</th>

                  <th style="width:10%">Payment Type</th>

                  <th style="width:40%">Description</th>

                  <th style="width:10%">Debit</th>

                  <th style="width:10%">Credit</th>
              </tr>
                </thead>
              <tbody>

                @php($compound_list = EF::getVoucherType())
                @php($debit = 0)
                @php($credit = 0)
               @foreach($journals as $rows)
                  @php($account = $rows->account)
                  @php($booking = $rows->booking)
                  @isset($rows->booking_id)
                  @php($plot = $booking->plot)

                  @endisset
                  @php($payment = $rows->payment)
                     @php($user = $rows->user)

                  @if($loop->first && $transaction->compound_type == $compound_list['2'])
                    <tr>

                     <td> @isset($rows->account_id){{$account->code}} {{$account->name}}@endisset</td>

                      <td> </td>
                      <td> </td>
                      <td> </td>
                      <td></td>
                      <td>{{EF::numberFormat($transaction->total_amount)}}</td>
                      <td>{{EF::numberFormat($rows->credit)}}</td>
                    </tr>

                  @elseif($loop->last && $transaction->compound_type == $compound_list['1'])
                     <tr>

                     <td>@isset($rows->account_id){{$account->code}} {{$account->name}}@endisset</td>

                      <td> </td>
                      <td> </td>
                      <td> </td>
                      <td> </td>
                      <td>{{EF::numberFormat($rows->debit)}}</td>

                      <td>{{EF::numberFormat($transaction->total_amount)}}</td>
                    </tr>
                  @else

                     @if($transaction->compound_type == $compound_list['1'] && $rows->debit > 0)
                     @include('documents.voucher_section')
                     @elseif($transaction->compound_type == $compound_list['2'] && $rows->credit > 0)
                     @include('documents.voucher_section')

                    @elseif($transaction->compound_type == $compound_list['0'])
                      @include('documents.voucher_section')
                    @endif

                  @endif

                  @php($debit += $rows->debit)
                  @php($credit += $rows->credit)

                
                @endforeach
               <tr>
                 <th colspan="5" style="background: #E0E0E0; ">Total</th>
                 <th  style="background: #E0E0E0; ">{{EF::numberFormat($debit)}}</th>
                 <th  style="background: #E0E0E0; ">{{EF::numberFormat($credit)}}</th>
               </tr>
               
        </tbody>
         
          </table>
      </div>
      <br>

      <div class = "row clear">
        <div class="col margin" style="width: 33%"> 
	 				<label><b>Payment Details</b></label>
	    	</div>
      </div>

   
       <div class = "row clear">
        		 <div class="col margin" style="width: 98%">
            		<label> Net Total: <input style="width: 95% ";   type="text" value="{{EF::numberFormat($debit)}} ({{strToUpper(EF::convertToWords($debit))}} ONLY )"></label>
            	</div>
            	
       </div>
             
        <div style="display: inline-block; ">  
              
            <div class = "row clear">
            		 <div class="col margin" style="width: 52%">
            	    	<label> Cheque # <input style="width: 78%"; type="text" value="{{$bank_detail['instrument']}}"></label>
            		</div>
            </div>


            <div class = "row clear">
                      <div class="col margin" style="width: 52%">
               <label> Deposit # <input style="width: 78%"; type="text" value="{{$bank_detail['deposit_no']}}"></label>
               </div>
               
            </div>

            <div class = "row clear">
                      <div class="col margin" style="width: 52%">
               <label> Deposit Date <input style="width: 73%"; type="text" value="{{$bank_detail['deposit_date']}}"></label>
               </div>
               
            </div>

            <div class ="row clear">
               <div class="col margin" style="width: 51%">
               <label> Created By: <input style="width: 76.5%"; type="text" @isset($journals[0]->branch->id) value="{{$journals[0]->branch->code}} - {{$journals[0]->branch->name}}"  @endisset></label>
               </div> 
            </div>
                
            <div class = "row clear">
                    <div class="col margin" style="width: 53%">
                       <label> Posted By: <input style="width: 74.5%"; type="text" value="{{Auth::user()->name ?? ''}}"></label>
                    </div>   
            </div>

         </div>


         <div style="display:inline-block; margin-top: 27.5% !important; width: 50%; margin-left:55% !important;">
                   <label>Signature <input style="width:60%;" type="text" name=""> </label>
          </div>  

     

  </div>
  </div>
</div>


	

</body>

</html>