@extends('layouts.admin') @section('page-title') {{ __('Account Drilldown Report') }} @endsection @section('breadcrumb') @endsection @section('content')
{{ Form::open(['route' => ['chart-of-account.show', $account->id], 'method' => 'GET', 'id' => 'report_drilldown']) }} {{-- @dd($account->name) --}}
{{ Form::label('start_date', __('Start Date'), ['class' => 'form-label']) }} {{ Form::date('start_date', $filter['startDateRange'], ['class' => 'month-btn form-control']) }}
{{ Form::label('end_date', __('End Date'), ['class' => 'form-label']) }} {{ Form::date('end_date', $filter['endDateRange'], ['class' => 'month-btn form-control']) }}
{{ Form::label('account', __('Account'), ['class' => 'form-label']) }} {{ Form::select('account', $accounts, isset($_GET['account']) ? $_GET['account'] : '', ['class' => 'form-control select']) }}
{{ Form::close() }}
{{-- --}}
{{ __('Report') }} :
{{ __('Account Drilldown') }}
@if (!empty($account))
{{ __('Account Name') }} :
{{ $account->name }}
{{ __('Account Code') }} :
{{ $account->code }}
@endif
{{ __('Duration') }} :
{{ $filter['startDateRange'] . ' to ' . $filter['endDateRange'] }}
@php $balance = 0; $totalDebit = 0; $totalCredit = 0; $chartDatas = App\Models\Utility::getAccountData($account->id, $filter['startDateRange'], $filter['endDateRange']); $accountName = \App\Models\ChartOfAccount::find($account->id); @endphp @foreach ($chartDatas['invoice'] as $invoiceData) @php $invoice = \App\Models\Invoice::where('id', $invoiceData->invoice_id)->first(); @endphp @php $total = $invoiceData->price * $invoiceData->quantity; $balance += $total; $totalCredit += $total; @endphp @endforeach @foreach ($chartDatas['invoicepayment'] as $invoicePaymentData) @php $invoice = \App\Models\Invoice::where('id', $invoicePaymentData->invoice_id)->first(); @endphp @php $balance += $invoicePaymentData->amount; $totalCredit += $invoicePaymentData->amount; @endphp @endforeach @foreach ($chartDatas['revenue'] as $revenueData) @php $balance += $revenueData->amount; $totalCredit += $revenueData->amount; @endphp @endforeach @foreach ($chartDatas['bill'] as $billProduct) @php $bill = \App\Models\Bill::find($billProduct->bill_id); $vendor = \App\Models\Vender::find(!empty($bill) ? $bill->vender_id : ''); @endphp @php $total = $billProduct->price * $billProduct->quantity; $balance -= $total; $totalCredit -= $total; @endphp @endforeach @foreach ($chartDatas['billdata'] as $billData) @php $bill = \App\Models\Bill::find($billData->ref_id); $vendor = \App\Models\Vender::find(!empty($bill) ? $bill->vender_id : ''); @endphp @if (!empty($bill->bill_id)) @else @endif @php $balance -= $billData->price; $totalDebit -= $billData->price; @endphp @endforeach @foreach ($chartDatas['billpayment'] as $billPaymentData) @php $bill = \App\Models\BillPayment::where('bill_id', $billPaymentData->bill_id)->first(); $billId = \App\Models\Bill::find($billPaymentData->bill_id); $vendor = \App\Models\Vender::find($billId->vender_id); @endphp @php $balance += $billPaymentData->amount; $totalDebit += $billPaymentData->amount; @endphp @endforeach @foreach ($chartDatas['payment'] as $paymentData) @php $vendor = \App\Models\Vender::find($paymentData->vender_id); @endphp @php $balance += $paymentData->amount; $totalDebit += $paymentData->amount; @endphp @endforeach @php $debit = 0; $credit = 0; @endphp @foreach ($chartDatas['journalItem'] as $journalItemData) @endforeach
{{ __('Account Name') }} {{ __('Name') }} {{ __('Transaction Type') }} {{ __('Transaction Date') }} {{ __('Debit') }} {{ __('Credit') }} {{ __('Balance') }}
{{ $accountName->name }}{{ !empty($invoice->customer) ? $invoice->customer->name : '-' }} {{ \Auth::user()->invoiceNumberFormat($invoice->invoice_id) }} {{ $invoiceData->created_at->format('d-m-Y') }} -{{ \Auth::user()->priceFormat($total) }} {{ \Auth::user()->priceFormat($balance) }}
{{ $accountName->name }}{{ !empty($invoice->customer) ? $invoice->customer->name : '-' }} {{ \Auth::user()->invoiceNumberFormat($invoice->invoice_id) }} {{ __(' Manually Payment') }} {{ $invoicePaymentData->created_at->format('d-m-Y') }} - {{ \Auth::user()->priceFormat($invoicePaymentData->amount) }}{{ \Auth::user()->priceFormat($balance) }}
{{ $accountName->name }} {{ !empty($revenueData->customer) ? $revenueData->customer->name : '-' }} {{ __('Revenue') }} {{ $revenueData->created_at->format('d-m-Y') }} - {{ \Auth::user()->priceFormat($revenueData->amount) }}{{ \Auth::user()->priceFormat($balance) }}
{{ $accountName->name }}{{ !empty($vendor) ? $vendor->name : '-' }} {{ \Auth::user()->billNumberFormat($bill->bill_id) }} {{ $billProduct->created_at->format('d-m-Y') }}{{ \Auth::user()->priceFormat($total) }} - {{ \Auth::user()->priceFormat($balance) }}
{{ $accountName->name }} {{ !empty($vendor) ? $vendor->name : '-' }}{{ \Auth::user()->billNumberFormat($bill->bill_id) }}-{{ $billData->created_at->format('d-m-Y') }} {{ \Auth::user()->priceFormat($billData->price) }} -{{ \Auth::user()->priceFormat($balance) }}
{{ $accountName->name }} {{ !empty($vendor) ? $vendor->name : '-' }} {{ \Auth::user()->billNumberFormat($billId->bill_id) }}{{ __(' Manually Payment') }} {{ $billPaymentData->created_at->format('d-m-Y') }} {{ \Auth::user()->priceFormat($billPaymentData->amount) }} -{{ \Auth::user()->priceFormat($totalCredit - $totalDebit) }}
{{ $accountName->name }} {{ !empty($vendor) ? $vendor->name : '-' }} {{ __('Payment') }} {{ $paymentData->created_at->format('d-m-Y') }} {{ \Auth::user()->priceFormat($paymentData->amount) }} -{{ \Auth::user()->priceFormat($totalCredit - $totalDebit) }}
{{ $accountName->name }} {{ '-' }} {{ AUth::user()->journalNumberFormat($journalItemData->journal_id) }} {{ $journalItemData->created_at->format('d-m-Y') }} {{ Auth::user()->priceFormat($journalItemData->debit) }} {{ \Auth::user()->priceFormat($journalItemData->credit) }} @if ($journalItemData->debit) @php $balance-= $journalItemData->debit @endphp @else @php $balance+= $journalItemData->credit @endphp @endif {{ \Auth::user()->priceFormat($balance) }}
@endsection