@extends('admin.master') @section('title', 'Customer Ledger Report') @section('page_css') @endsection @section('content')
Filter Ledger Report
{{ Form::open(['route' => 'report.customer_ledger_report', 'method' => 'POST', 'class' => 'form-horizontal']) }}
{!! Form::text('start_date', $start_date, ['class'=>'form-control custom-input start_date', 'required'=>'required', 'readonly']) !!}
{!! Form::text('end_date', $end_date, ['class'=>'form-control custom-input end_date', 'required'=>'required', 'readonly']) !!}
{{ Form::select('customer_id', $customer, is_scalar($customer_id) ? $customer_id : null, ['id' => 'customer_id_select', 'class' => 'form-control custom-input select2', 'placeholder' => '--- Choose Customer ---', 'required']) }}
{{ Form::close() }}
@if(isset($customer_id) && $customer_id != '') @php // Fetching customer details directly from the database $selected_customer_name = is_scalar($customer_id) && isset($customer[$customer_id]) ? $customer[$customer_id] : '---'; $customer_phone = 'N/A'; $customer_code = 'N/A'; $sales_person = 'N/A'; try { $cust_data = \DB::table('customers')->where('id', $customer_id)->first(); if($cust_data) { $customer_phone = $cust_data->phone ?? $cust_data->mobile ?? 'N/A'; $customer_code = $cust_data->code ?? 'N/A'; // Fetching the user who created this customer $creator_id = $cust_data->created_by ?? $cust_data->user_id ?? null; if($creator_id) { $user_data = \DB::table('users')->where('id', $creator_id)->first(); $sales_person = $user_data ? $user_data->name : 'N/A'; } } } catch (\Exception $e) { // Fail gracefully if column names don't exactly match } @endphp
GOODLUCK iT
Customer Ledger Report
{{ $selected_customer_name }}

Code: {{ $customer_code }}

Phone: {{ $customer_phone }}

Sales Person : {{ $sales_person }}

Payment Term:

@endif @include('admin.report.customer_ledger_report_data')
@endsection @section('page_scripts') @endsection