@extends('layouts.master') @section('title', 'Journal Voucher | ') @section('content') @include('partials.header') @include('partials.sidebar') @php function convertNumberToWords($number) { $hyphen = '-'; $conjunction = ' and '; $separator = ', '; $negative = 'negative '; $decimal = ' point '; $dictionary = [ 0 => 'zero', 1 => 'one', 2 => 'two', 3 => 'three', 4 => 'four', 5 => 'five', 6 => 'six', 7 => 'seven', 8 => 'eight', 9 => 'nine', 10 => 'ten', 11 => 'eleven', 12 => 'twelve', 13 => 'thirteen', 14 => 'fourteen', 15 => 'fifteen', 16 => 'sixteen', 17 => 'seventeen', 18 => 'eighteen', 19 => 'nineteen', 20 => 'twenty', 30 => 'thirty', 40 => 'forty', 50 => 'fifty', 60 => 'sixty', 70 => 'seventy', 80 => 'eighty', 90 => 'ninety', 100 => 'hundred', 1000 => 'thousand', 100000 => 'lakh', 10000000 => 'crore' ]; if (!is_numeric($number)) return false; if ((int) $number < 0) return $negative . convertNumberToWords(abs($number)); $string = ''; $number = (int)$number; if ($number < 21) $string = $dictionary[$number]; elseif ($number < 100) { $tens = ((int)($number / 10)) * 10; $units = $number % 10; $string = $dictionary[$tens]; if ($units) $string .= $hyphen . $dictionary[$units]; } else { foreach ([10000000 => 'crore', 100000 => 'lakh', 1000 => 'thousand', 100 => 'hundred'] as $value => $word) { if ($number >= $value) { $count = (int)($number / $value); $number %= $value; $string .= convertNumberToWords($count) . ' ' . $word; if ($number) $string .= ' '; } } if ($number) $string .= convertNumberToWords($number); } return ucfirst($string); } @endphp

Journal Voucher

{{-- Top Info (Vertical Layout) --}}
Type: {{ $voucherDetails[0]->VoucherType }}
ID: {{ $voucherDetails[0]->Id }}
Site: {{ $voucherDetails[0]->Paid_To }}
Date: {{ \Carbon\Carbon::parse($voucherDetails[0]->VoucherDate)->format('d-m-Y') }}
{{-- Voucher Table --}} @foreach($voucherDetails as $detail) @endforeach
Account # Account Title Remarks Debit Credit
{{ $detail->Account_Id }} {{ $detail->Account_Title }} {{ $detail->Entry_Narration }} @if($detail->entryType == 'D') {{ number_format($detail->Amount, 2) }} @endif @if($detail->entryType == 'C') {{ number_format($detail->Amount, 2) }} @endif
Totals {{ number_format($totalDebit, 2) }} {{ number_format($totalCredit, 2) }}
Amount in Words: Rupees {{ convertNumberToWords(round($totalDebit)) }} Only

{{-- Signatures --}}
Prepared By Approved By Received By
{{-- Buttons --}} {{-- Footer Note --}}

Note: All borders and lines are graphical for printing purposes.

{{-- Print Function --}} @endsection