@extends('layouts.main') @push('styles') @endpush @section('content') @if(session()->get("print_family_account_receipt_pdf") == 1) {{ Form::hidden('print_family_account_receipt_pdf', 1, ['id' => 'print_family_account_receipt_pdf']) }} @endif @if(session()->get("print_family_account_refund_receipt_pdf") == 1) {{ Form::hidden('print_family_account_refund_receipt_pdf', 1, ['id' => 'print_family_account_refund_receipt_pdf']) }} @endif

Family Account Statement {{ get_full_name($family_account_details->family_head_id, "id", "first_name", "last_name", "patients") }} ({{ get_name($family_account_details->family_head_id, "id", "number","patients") }})

@include('patient_discounts::family_accounts.menu')
@include('flash::message') @php $family_head_id = get_name($family_account_id, "id", "family_head_id", "family_accounts") @endphp {{ Form::open(['url' => 'family_accounts/' . $family_account_id . '/statement/', 'method' => 'ANY']) }}
{{ Form::hidden('family_account_id', $family_account_id) }}
{{ Form::label('search_by', __('family_accounts.date')) }} {{ Form::select('search_by', ['0'=>'Last 24 hours','1'=>'Custom Date','2'=>'Custom Range'], '', ['class' => 'form-control','id'=>'search_by', 'required']) }}

{{ Form::button(__('family_accounts.submit'),['type'=>'submit','class'=>'btn btn-success waves-effect waves-light m-r-10', 'id'=>'select_patient']) }}
{{ Form::close() }}
{{ Form::open(['url' => 'family_statement_print'])}} {{ Form::hidden('family_account_id', $family_account_id) }} {{ Form::hidden('reg_date', $reg_date) }} {{ Form::hidden('start_date', $start_date) }} {{ Form::hidden('end_date', $end_date) }} {{ Form::close() }}
@if(!is_null($reg_date))

Family Statement as at {{ streamline_date($reg_date) }}

@elseif(!is_null($start_date) && !is_null($end_date))

Family statement as at {{ streamline_date($start_date) }} {{ __('family_accounts.to') }} {{ streamline_date($end_date) }}

@endif

Family Deposits

@php $counter = 1; $total_family_deposits = 0; $current_balance_total = 0; @endphp @if(count($family_deposits) > 0) @foreach($family_deposits as $deposit) @php $family_head_id = get_name($deposit->family_account_id, "id", "family_head_id", "family_accounts") @endphp @php $family_members_array = []; $family_account_details = \Streamline\Models\FamilyAccount::withTrashed()->find($deposit->family_account_id); $family_members_array = explode(",", $family_account_details->family_members_ids); @endphp {{----}} @php $counter++; @endphp @endforeach @else @endif
# {{ __('family_accounts.deposited_on') }} Received By {{ __('family_accounts.family_head') }} {{ __('family_accounts.deposited_by') }} {{ __('family_accounts.amount_deposited') }}
{{ $counter }} {{ streamline_date($deposit->deposit_date) }} {{ get_full_name($deposit->created_by, "id", "first_name", "last_name", "users") }} {{ get_full_name($family_head_id, "id", "first_name", "last_name", "patients") }} ({{ get_name($family_head_id, "id", "number","patients") }}) @for($i = 0; $i < count($family_members_array); $i++)
  • {{ get_full_name($family_members_array[$i], "id", "first_name", "last_name", "patients") }} ({{ get_name($family_members_array[$i], "id", "number","patients") }})
  • @endfor
    {{ $deposit->deposited_by }} @php $total_family_deposits += $deposit->deposit_amount; @endphp {{ ugandan_shillings($deposit->deposit_amount) }}
    No family deposits have been made
    {{ __('family_accounts.total') }} {{ ugandan_shillings($total_family_deposits) }}

    Family consumption

    @php $counter = 1; $total_consumptions = 0; @endphp @if(count($family_consumptions) > 0) @foreach($family_consumptions as $member_consumption) @php $expenditure_type = $member_consumption->expenditure_tag; $items_received_array = []; if($expenditure_type == "Services"){ $service_deposit_record = \Streamline\Models\ServiceDeposit::where(['patient_id' => $member_consumption->patient_id, 'episode_id' => $member_consumption->episode_id])->first(); if ($service_deposit_record){ $items_received = explode(",", $service_deposit_record->items_ids); for($i = 0; $i < count($items_received); $i++){ $items_received_array[] = get_name($items_received[$i], "id", "name", "services"); } } } elseif($expenditure_type == "Treatment"){ $treatment_deposit_record = \Streamline\Models\TreatmentDeposits::where(['patient_id' => $member_consumption->patient_id, 'episode_id' => $member_consumption->episode_id])->first(); if ($treatment_deposit_record){ $items_received = explode(",", $treatment_deposit_record->treatment_items); for($i = 0; $i < count($items_received); $i++){ $items_received_array[] = get_name($items_received[$i], "id", "name", "drugs"); } } } elseif($expenditure_type == "Sundries"){ $sundries_deposit_record = \Streamline\Models\SundryDeposit::where(['patient_id' => $member_consumption->patient_id, 'episode_id' => $member_consumption->episode_id])->first(); if ($sundries_deposit_record){ $items_received = explode(",", $sundries_deposit_record->sundry_items); for($i = 0; $i < count($items_received); $i++){ $items_received_array[] = get_name($items_received[$i], "id", "name", "sundries"); } } } elseif($expenditure_type == "Investigations"){ $investigation_deposit_record = \Streamline\Models\InvestigationDeposit::where(['patient_id' => $member_consumption->patient_id, 'episode_id' => $member_consumption->episode_id])->first(); if ($investigation_deposit_record){ $items_received = explode(",", $investigation_deposit_record->investigation_items); for($i = 0; $i < count($items_received); $i++){ $items_received_array[] = get_name($items_received[$i], "id", "name", "investigations"); } } } elseif($expenditure_type == "Procedures"){ $procedure_deposit_record = \Streamline\Models\ProcedureDeposit::where(['patient_id' => $member_consumption->patient_id, 'episode_id' => $member_consumption->episode_id])->first(); if ($procedure_deposit_record){ $items_received = explode(",", $procedure_deposit_record->procedure_items); for($i = 0; $i < count($items_received); $i++){ $items_received_array[] = get_name($items_received[$i], "id", "name", "procedures"); } } } @endphp @php $family_head_id = get_name($member_consumption->family_account_id, "id", "family_head_id", "family_accounts") @endphp @php $counter++; @endphp @endforeach @else @endif
    # {{ __('family_accounts.date') }} Member {{ __('family_accounts.reason') }} {{ __('family_accounts.amount_consumed') }}
    {{ $counter }} {{ streamline_date($member_consumption->created_at) }} {{ get_full_name($member_consumption->patient_id, "id", "first_name", "last_name", "patients") }} {{ $member_consumption->expenditure_tag == "Services" ? "Consultation / Services" : $member_consumption->expenditure_tag }}
      @for($j = 0; $j < count($items_received_array); $j++)
    1. {{ $items_received_array[$j] }}
    2. @endfor
    {{ ugandan_shillings($member_consumption->amount_consumed) }} @php $total_consumptions += $member_consumption->amount_consumed; @endphp
    No family consumption has been recorded
    {{ __('family_accounts.total') }} {{ ugandan_shillings($total_consumptions) }}

    Family Refunds

    @php $counter = 1; $total_family_refunds = 0; @endphp @if(count($family_refunds) > 0) @foreach($family_refunds as $refund) @php $family_head_id = get_name($refund->family_account_id, "id", "family_head_id", "family_accounts") @endphp @php $counter++; @endphp @endforeach @else @endif
    # Refunded On Cashier {{ __('family_accounts.family_head') }} Refunded To Amount Refunded
    {{ $counter }} {{ streamline_date($refund->created_at) }} {{ get_full_name($refund->created_by, "id", "first_name", "last_name", "users") }} {{ get_full_name($family_head_id, "id", "first_name", "last_name", "patients") }} ({{ get_name($family_head_id, "id", "number","patients") }}) {{ $refund->refund_to }} @php $total_family_refunds += $refund->refund_amount; @endphp {{ ugandan_shillings($refund->refund_amount) }}
    No family refunds have been made
    {{ __('family_accounts.total') }} {{ ugandan_shillings($total_family_refunds) }}


    Current Balance: {{ is_numeric($family_account_details->current_balance) ? ugandan_shillings($family_account_details->current_balance) : "N/A" }}


    {{ Form::open(['url' => 'family_accounts/add_deposit']) }} {{ Form::hidden('family_account_id', $family_account_details->id) }} {{ Form::submit('Add deposit', ['class' => 'btn btn-success btn-block']) }} {{ Form::close() }}
    {{ Form::model($family_account_details->id ,['method' => 'DELETE', 'route' => ['family_accounts.destroy', $family_account_details->id]]) }} {{ Form::close() }}
    @endsection @push('scripts') @endpush