{{-- div for Company --}} @php $company = DB::table('gnr_company')->where('id', Auth::user()->company_id_fk)->select('name','address')->first(); @endphp {{$company->name}}
{{$company->address}}
Consolidated Balancing Report (Branch wise)
{{--

Ambala Foundation

House # 67, Block # Ka, Piciculture Housing Society, Shyamoli, Dhaka- 1207

--}} {{--

Member Ledger Report

--}}
Branch Name & Code : @if ($RequestedBranchID == 'All') All @elseif ($RequestedBranchID != 'All') @foreach ($BranchInfos as $key => $BranchInfo) {{$BranchInfo->name}}({{$BranchInfo->branchCode}}) @endforeach @endif
Branch Address : @if ($RequestedBranchID == 'All') @elseif ($RequestedBranchID != 'All') @foreach ($BranchInfos as $key => $BranchInfo) {{$BranchInfo->address}} @endforeach @endif
Reporting Date
: @php switch ($RequestedMonth) { case 1: echo "January, ".$RequestedYear; break; case 2: echo "February, ".$RequestedYear; break; case 3: echo "March, ".$RequestedYear; break; case 4: echo "April, ".$RequestedYear; break; case 5: echo "May, ".$RequestedYear; break; case 6: echo "June, ".$RequestedYear; break; case 7: echo "July, ".$RequestedYear; break; case 8: echo "August, ".$RequestedYear; break; case 9: echo "September, ".$RequestedYear; break; case 10: echo "October, ".$RequestedYear; break; case 11: echo "November, ".$RequestedYear; break; case 12: echo "december, ".$RequestedYear; break; default: echo "No Date Found!"; } @endphp {{-- @if ($SelectionType == 'N') {{$DateFrom}} - {{$DateTo}} @elseif ($SelectionType == 'Y') {{$DateTo}} @endif --}}
Print Date
: 2026-07-21

@php $SavingsBalanceColumnSize = 0; $SavingsSubTotal = array(); $SavingsTotal = array(); @endphp
{{--
--}} @if ($RequestedSavingsBalance == 'All') @else @php $SavingsBalanceColumnSize = sizeof($SavingsProduct); @endphp @endif @if ($RequestedSavingsBalance == 'All') @else @foreach ($SavingsProduct as $key => $SavingsProduct1) @endforeach @endif @php $SerialNumber = 0; @endphp @php // dd($ProCat); // $RowSize = sizeof($ProCat); $BranchCount = 0; $ProCatCount = 0; $Setvalue = 0; $BranchManagerTracker = 0; $SavingsBalanceTotal = 0; $SavingsTotalsSubTotal = 0; $SavingsTotalsTotal = 0; $BranchManagerNameTracker = 0; // dd($LoanProduct); // $NumberOfMemberTracker = 0; $NumberOfBorrowerTracker = 0; $Counter = 0; $SubTotal1 = 0; $SubTotal2 = 0; $SubTotal3 = 0; $SubTotal4 = 0; $SubTotal5 = 0; $SubTotal6 = 0; $SubTotal7 = 0; $SubTotal8 = 0; $SubTotal9 = 0; $SubTotal10 = 0; $SubTotal11 = 0; $Total1 = 0; $Total2 = 0; $Total3 = 0; $Total4 = 0; $Total5 = 0; $Total6 = 0; $Total7 = 0; $Total8 = 0; $Total9 = 0; $Total10 = 0; $Total11 = 0; @endphp @foreach ($BranchAvailable as $key1 => $BranchInfo) @php $BranchManagerNameTracker = 0; @endphp {{-- @php $NumberOfMemberTracker = 0; @endphp --}} {{-- --}} @foreach ($ProCat as $key2 => $ProCat1) @php $NumberOfMemberTracker = 0; @endphp {{-- --}} @foreach ($LoanProduct as $key3A => $LoanProduct1) @php list($Br, $PC, $CategoryRowSize, $BranchRowSize) = explode("/", $key3A); @endphp @if ($Br == $BranchInfo->id and $ProCat1->id == $PC) @foreach ($LoanProduct1 as $key3B => $LoanProduct2) {{-- {{$LoanProduct2->id}} --}} @php $RowSize = sizeof($LoanProduct2); @endphp @if ($BranchCount == 0) @if ($BranchRowSize == 2 || $BranchRowSize == 1) @php $BranchCount = $BranchCount + 1; @endphp @elseif ($BranchRowSize > 2) @php $BranchCount = $BranchCount + 1; @endphp @endif @endif @if ($ProCatCount == 0) {{-- Total Samity Number --}} @foreach ($NumberOfSamity as $key4A => $NumberOfSamity1) @if ($BranchInfo->id == $key4A) @foreach ($NumberOfSamity1 as $key4B => $NumberOfSamity2) @if ($key4B == $LoanProduct2->id) @php $SubTotal1 = $SubTotal1 + $NumberOfSamity2; @endphp @break @endif @endforeach @endif @endforeach {{-- End of Total Samity Number --}} {{-- Total Member Number --}} @foreach ($NumberOfMember as $key5 => $NumberOfMember1) @php list($Br, $Prod) = explode("/", $key5); @endphp @if ($BranchInfo->id == $Br and $LoanProduct2->id == $Prod) @php $NumberOfMemberTracker = 1; $SubTotal2 = $SubTotal2 + $NumberOfMember1; @endphp @break @endif @endforeach @if ($NumberOfMemberTracker == 0) @endif {{-- End of Total Member Number --}} {{-- Total Borrower Number --}} @foreach ($NumberOfBorrower as $key4A => $NumberOfBorrower1) @if ($BranchInfo->id == $key4A) @foreach ($NumberOfBorrower1 as $key4B => $NumberOfBorrower2) @if ($key4B == $LoanProduct2->id) @php // $NumberOfBorrowerTracker = 1; // echo '/'.$BranchInfo->id.'/'; $SubTotal3 = $SubTotal3 + $NumberOfBorrower2; @endphp @break {{-- @else @break --}} @endif @endforeach @endif @endforeach {{-- @if ($NumberOfBorrowerTracker == 0) @endif --}} {{-- End of Total Borrower Number --}} {{-- Start of the Current Loan --}} @foreach ($CurrentLoan as $key6 => $CurrentLoan1) @php list($Br, $Prod) = explode("/", $key6); @endphp @if ($Br == $BranchInfo->id and $Prod == $LoanProduct2->id) @php $SubTotal4 = $SubTotal4 + $CurrentLoan1; @endphp @break @endif @endforeach {{-- End of the Current Loan --}} {{-- Start of the Loan Outstanding Principle --}} @foreach ($LoanOutstandingPrinciple as $key7 => $LoanOutstandingPrinciple1) @php list($Br, $Prod) = explode("/", $key7); @endphp @if ($Br == $BranchInfo->id and $Prod == $LoanProduct2->id) @php $SubTotal5 = $SubTotal5 + $LoanOutstandingPrinciple1; @endphp @break @endif @endforeach {{-- End of the Loan Outstanding Principle --}} {{-- Start of Loan outstanding interest Amount --}} @foreach ($LoanOutstandingServiceCharge as $key7 => $LoanOutstandingServiceCharge1) @php list($Br, $Prod) = explode("/", $key7); @endphp @if ($Br == $BranchInfo->id and $Prod == $LoanProduct2->id) @php $SubTotal6 = $SubTotal6 + $LoanOutstandingServiceCharge1; @endphp @break @endif @endforeach {{-- End of Loan outstanding interest Amount --}} {{-- Start of the Outstanding Total --}} @foreach ($LoanOutstandingTotal as $key8 => $LoanOutstandingTotal1) @php list($Br, $Prod) = explode("/", $key8); @endphp @if ($Br == $BranchInfo->id and $Prod == $LoanProduct2->id) @php $SubTotal7 = $SubTotal7 + $LoanOutstandingTotal1; @endphp @break @endif @endforeach {{-- End of the Outstanding Total --}} {{-- Start of the Overdue Principal --}} @foreach ($OverduePrincipal as $key8 => $OverduePrincipal1) @php list($Br, $Prod) = explode("/", $key8); @endphp @if ($Br == $BranchInfo->id and $Prod == $LoanProduct2->id) @php $SubTotal8 = $SubTotal8 + $OverduePrincipal1; @endphp @break @endif @endforeach {{-- End of the Overdue Principal --}} {{-- Start of the Overdue Service Charge --}} @foreach ($OverdueServiceCharge as $key10 => $OverdueServiceCharge1) @php list($Br, $Prod) = explode("/", $key10); @endphp @if ($Br == $BranchInfo->id and $Prod == $LoanProduct2->id) @php $SubTotal9 = $SubTotal9 + $OverdueServiceCharge1; @endphp @break @endif @endforeach {{-- End of the Overdue Service Charge --}} {{-- Start of the Overdue Total --}} @foreach ($OverdueTotal as $key11 => $OverdueTotal1) @php list($Br, $Prod) = explode("/", $key11); @endphp @if ($Br == $BranchInfo->id and $Prod == $LoanProduct2->id) @php $SubTotal10 = $SubTotal10 + $OverdueTotal1; @endphp @break @endif @endforeach {{-- End of the Overdue Total --}} {{-- Start of the Savings Balance --}} @if ($RequestedSavingsBalance == 'All') @foreach ($SavingsBalance as $key12 => $SavingsBalance1) @php list($Br, $Prod) = explode("/", $key12); @endphp @if ($Br == $BranchInfo->id and $Prod == $LoanProduct2->id) @php $SubTotal11 = $SubTotal11 + $SavingsBalance1; @endphp @break @elseif ($Br == $BranchInfo->id) @break @endif @endforeach @else @foreach ($SavingsProduct as $key12 => $SavingsProduct1) @foreach ($SavingsBalance as $key12A => $SavingsBalance1) @php list($Br, $Prod, $SaveProd) = explode("/", $key12A); @endphp @if ($Br == $BranchInfo->id and $Prod == $LoanProduct2->id) @if ($SaveProd == $SavingsProduct1->id) @php $SubTotal11 = $SubTotal11 + $SavingsBalance1; $SavingsBalanceTotal = $SavingsBalanceTotal + $SavingsBalance1; $SavingsSubTotal[$SaveProd] = $SavingsSubTotal[$SaveProd] + $SavingsBalance1; @endphp @break @else @break @endif @elseif ($Br == $BranchInfo->id) {{-- {{$Br}}-{{$SaveProd}}-{{$Prod}}
--}} @break @endif @endforeach @endforeach @endif {{-- End of the Savings Balance --}} {{-- Start of the Savings Balance Total --}} @if ($RequestedSavingsBalance == 'All') {{-- --}} @else @php $SavingsTotalsSubTotal = $SavingsTotalsSubTotal + $SavingsBalanceTotal; $SavingsBalanceTotal = 0; @endphp @endif {{-- End of the Savings Balance Total --}} {{-- Start of the Branch Manager Query --}} @if ($BranchManagerTracker == 0) @if ($RequestedBranchID == 'All') @foreach ($BranchManagerName as $key => $BranchManagerName1) @if (!empty($BranchManagerName1)) @foreach ($BranchManagerName1 as $key => $BranchManagerName2) @if ($BranchInfo->id == $BranchManagerName2->id) @php $BranchManagerTracker = $BranchManagerTracker + 1; $BranchManagerNameTracker = 1; @endphp @break @endif @endforeach {{-- @elseif ($BranchManagerName1 == null) --}} @endif @endforeach @else @foreach ($BranchManagerName as $key => $BranchManagerName1) @php $BranchManagerTracker = $BranchManagerTracker + 1; $BranchManagerNameTracker = 1; @endphp @break @endforeach @endif @endif @if ($BranchManagerNameTracker == 0) @php $BranchManagerNameTracker = 1; @endphp @endif {{-- End of the Branch Manager Query --}} @php $Setvalue = $Setvalue + 1; @endphp @php $ProCatCount = $ProCatCount + 1; @endphp @endif @if ($Setvalue == 0) @php $NumberOfMemberTracker = 0; $NumberOfBorrowerTracker = 0; @endphp {{-- Total Samity Number --}} @foreach ($NumberOfSamity as $key4A => $NumberOfSamity1) @if ($BranchInfo->id == $key4A) @foreach ($NumberOfSamity1 as $key4B => $NumberOfSamity2) @if ($key4B == $LoanProduct2->id) @php $SubTotal1 = $SubTotal1 + $NumberOfSamity2; @endphp @break @endif @endforeach @endif @endforeach {{-- End of Total Samity Number --}} {{-- Total Member Number --}} @foreach ($NumberOfMember as $key5 => $NumberOfMember1) @php list($Br, $Prod) = explode("/", $key5); @endphp @if ($BranchInfo->id == $Br and $LoanProduct2->id == $Prod) @php $NumberOfMemberTracker = 1; $SubTotal2 = $SubTotal2 + $NumberOfMember1; @endphp @break @endif @endforeach @if ($NumberOfMemberTracker == 0) @endif {{-- End of Total Member Number --}} {{-- Total Borrower Number --}} @foreach ($NumberOfBorrower as $key4A => $NumberOfBorrower1) @if ($BranchInfo->id == $key4A) @foreach ($NumberOfBorrower1 as $key4B => $NumberOfBorrower2) @if ($key4B == $LoanProduct2->id) {{-- {{++$Counter}} - {{$BranchInfo->id}} --}} @php $NumberOfBorrowerTracker = 1; $SubTotal3 = $SubTotal3 + $NumberOfBorrower2; @endphp @break {{-- @else @break --}} @endif @endforeach @endif @endforeach {{-- @if ($NumberOfBorrowerTracker == 0) @endif --}} {{-- End of Total Borrower Number --}} {{-- Start of the Current Loan --}} @foreach ($CurrentLoan as $key6 => $CurrentLoan1) @php list($Br, $Prod) = explode("/", $key6); @endphp @if ($Br == $BranchInfo->id and $Prod == $LoanProduct2->id) @php $SubTotal4 = $SubTotal4 + $CurrentLoan1; @endphp @break @endif @endforeach {{-- End of the Current Loan --}} {{-- Start of the Loan Outstanding Principle --}} @foreach ($LoanOutstandingPrinciple as $key7 => $LoanOutstandingPrinciple1) @php list($Br, $Prod) = explode("/", $key7); @endphp @if ($Br == $BranchInfo->id and $Prod == $LoanProduct2->id) @php $SubTotal5 = $SubTotal5 + $LoanOutstandingPrinciple1; @endphp @break @endif @endforeach {{-- End of the Loan Outstanding Principle --}} {{-- Start of Loan outstanding interest Amount --}} @foreach ($LoanOutstandingServiceCharge as $key7 => $LoanOutstandingServiceCharge1) @php list($Br, $Prod) = explode("/", $key7); @endphp @if ($Br == $BranchInfo->id and $Prod == $LoanProduct2->id) @php $SubTotal6 = $SubTotal6 + $LoanOutstandingServiceCharge1; @endphp @break @endif @endforeach {{-- End of Loan outstanding interest Amount --}} {{-- Start of the Outstanding Total --}} @foreach ($LoanOutstandingTotal as $key8 => $LoanOutstandingTotal1) @php list($Br, $Prod) = explode("/", $key8); @endphp @if ($Br == $BranchInfo->id and $Prod == $LoanProduct2->id) @php $SubTotal7 = $SubTotal7 + $LoanOutstandingTotal1; @endphp @break @endif @endforeach {{-- End of the Outstanding Total --}} {{-- Start of the Overdue Principal --}} @foreach ($OverduePrincipal as $key9 => $OverduePrincipal1) @php list($Br, $Prod) = explode("/", $key9); @endphp @if ($Br == $BranchInfo->id and $Prod == $LoanProduct2->id) @php $SubTotal8 = $SubTotal8 + $OverduePrincipal1; @endphp @break @endif @endforeach {{-- End of the Overdue Principal --}} {{-- Start of the Overdue Service Charge --}} @foreach ($OverdueServiceCharge as $key10 => $OverdueServiceCharge1) @php list($Br, $Prod) = explode("/", $key10); @endphp @if ($Br == $BranchInfo->id and $Prod == $LoanProduct2->id) @php $SubTotal9 = $SubTotal9 + $OverdueServiceCharge1; @endphp @break @endif @endforeach {{-- End of the Overdue Service Charge --}} {{-- Start of the Overdue Total --}} @foreach ($OverdueTotal as $key11 => $OverdueTotal1) @php list($Br, $Prod) = explode("/", $key11); @endphp @if ($Br == $BranchInfo->id and $Prod == $LoanProduct2->id) @php $SubTotal10 = $SubTotal10 + $OverdueTotal1; @endphp @break @endif @endforeach {{-- End of the Overdue Total --}} {{-- Start of the Savings Balance --}} @if ($RequestedSavingsBalance == 'All') @foreach ($SavingsBalance as $key12 => $SavingsBalance1) @php list($Br, $Prod) = explode("/", $key12); @endphp @if ($Br == $BranchInfo->id and $Prod == $LoanProduct2->id) @php $SubTotal11 = $SubTotal11 + $SavingsBalance1; @endphp @break @elseif ($Br == $BranchInfo->id) @break @endif @endforeach @else @foreach ($SavingsProduct as $key12 => $SavingsProduct1) @foreach ($SavingsBalance as $key12A => $SavingsBalance1) @php list($Br, $Prod, $SaveProd) = explode("/", $key12A); @endphp @if ($Br == $BranchInfo->id and $Prod == $LoanProduct2->id) @if ($SaveProd == $SavingsProduct1->id) @php $SubTotal11 = $SubTotal11 + $SavingsBalance1; $SavingsSubTotal[$SaveProd] = $SavingsSubTotal[$SaveProd] + $SavingsBalance1; @endphp @break @else @break @endif @elseif ($Br == $BranchInfo->id) {{-- {{$Br}}-{{$SaveProd}}-{{$Prod}}
--}} @break @endif @endforeach @endforeach @endif {{-- End of the Savings Balance --}} {{-- Start of the Savings Balance Total --}} @if ($RequestedSavingsBalance == 'All') @else @php $SavingsTotalsSubTotal = $SavingsTotalsSubTotal + $SavingsBalanceTotal; $SavingsBalanceTotal = 0; @endphp @endif {{-- End of the Savings Balance Total --}} @endif @php $Setvalue = 0; @endphp @endforeach @php $SavingsBalanceTotal = 0; @endphp @endif @endforeach @php $ProCatCount = 0; @endphp @endforeach @if ($BranchCount > 0) @if ($RequestedSavingsBalance == 'All') @else @foreach ($SavingsSubTotal as $key => $SavingsSubTotal1) @php $SavingsTotal[$key] = $SavingsTotal[$key] + $SavingsSubTotal1; @endphp @endforeach @php $SavingsTotalsTotal = $SavingsTotalsTotal + $SavingsTotalsSubTotal; $SavingsTotalsSubTotal = 0; @endphp @endif @php foreach ($SavingsProduct as $key => $SavingsProduct1) { $SavingsSubTotal[$SavingsProduct1->id] = 0; } @endphp @endif @php // dd($SavingsSubTotal); $BranchCount = 0; $Setvalue = 0; $BranchManagerTracker = 0; // $BranchManagerNameTracker = 0; // $SavingsTotalsSubTotal = 0; $Total1 = $Total1 + $SubTotal1; $Total2 = $Total2 + $SubTotal2; $Total3 = $Total3 + $SubTotal3; $Total4 = $Total4 + $SubTotal4; $Total5 = $Total5 + $SubTotal5; $Total6 = $Total6 + $SubTotal6; $Total7 = $Total7 + $SubTotal7; $Total8 = $Total8 + $SubTotal8; $Total9 = $Total9 + $SubTotal9; $Total10 = $Total10 + $SubTotal10; $Total11 = $Total11 + $SubTotal11; // echo $Total7; $SubTotal1 = 0; $SubTotal2 = 0; $SubTotal3 = 0; $SubTotal4 = 0; $SubTotal5 = 0; $SubTotal6 = 0; $SubTotal7 = 0; $SubTotal8 = 0; $SubTotal9 = 0; $SubTotal10 = 0; $SubTotal11 = 0; $BranchManagerTracker = 0; // $BranchManagerNameTracker = 0; $NumberOfMemberTracker = 0; $NumberOfBorrowerTracker = 0; @endphp @endforeach {{-- @foreach ($LoanProduct as $key1 => $LoanProduct1) @foreach ($LoanProduct1 as $key2 => $LoanProduct2) @foreach ($LoanProduct2 as $key3 => $LoanProduct3) @endforeach @endforeach @endforeach --}} @if ($RequestedSavingsBalance == 'All') @else @foreach ($SavingsTotal as $key => $SavingsTotal1) @endforeach @endif {{-- --}}
SL. No.
Branch
Loan Product Category
Loan Product
No of Samity
No. of Members
No. of Borrower
Current Loan
Loan Outstanding
Overdue
Savings Balance
Savings Balance
Name of Branch Manager
Code
Name
Principal
Service Charge
Total
Principal
Service Charge
Total
{{$SavingsProduct1->name}} @php $SavingsSubTotal[$SavingsProduct1->id] = 0; $SavingsTotal[$SavingsProduct1->id] = 0; @endphp
Total
{{++$SerialNumber}} {{$BranchInfo->name}} {{ str_pad($BranchInfo->branchCode,3,0,STR_PAD_LEFT) }}
{{$ProCat1->name}}
{{++$SerialNumber}} {{ str_pad($BranchInfo->branchCode,3,0,STR_PAD_LEFT) }} {{$BranchInfo->name}}
{{++$SerialNumber}} {{ str_pad($BranchInfo->branchCode,3,0,STR_PAD_LEFT) }} {{$BranchInfo->name}}
{{$ProCat1->name}} {{$LoanProduct2->shortName}}{{$NumberOfSamity2}}{{$NumberOfMember1}}0{{$NumberOfBorrower2}}0 {{++$Counter}} - {{$BranchInfo->id}}0gg{{number_format($CurrentLoan1,2)}}{{number_format($LoanOutstandingPrinciple1,2)}}{{number_format($LoanOutstandingServiceCharge1,2)}}{{number_format($LoanOutstandingTotal1,2)}}{{number_format($OverduePrincipal1,2)}}{{number_format($OverdueServiceCharge1,2)}}{{number_format($OverdueTotal1,2)}}{{number_format($SavingsBalance1,2)}}0.00{{number_format($SavingsBalance1,2)}}0.000.00{{number_format($SavingsBalanceTotal,2)}}ll{{number_format($SavingsBalanceTotal,2)}}{{$BranchManagerName2->emp_name_english}}{{$BranchManagerName1->emp_name_english}}
{{$LoanProduct2->shortName}}{{$NumberOfSamity2}}{{$NumberOfMember1}}0{{$NumberOfBorrower2}}0 {{++$Counter}} - {{$BranchInfo->id}}0g{{number_format($CurrentLoan1,2)}}{{number_format($LoanOutstandingPrinciple1,2)}}{{number_format($LoanOutstandingServiceCharge1,2)}}{{number_format($LoanOutstandingTotal1,2)}}{{number_format($OverduePrincipal1,2)}}{{number_format($OverdueServiceCharge1,2)}}{{number_format($OverdueTotal1,2)}}{{number_format($SavingsBalance1,2)}}0.00{{number_format($SavingsBalance1,2)}}0.000.00{{number_format($SavingsBalanceTotal,2)}}
Sub Total {{$SubTotal1}} {{$SubTotal2}} {{$SubTotal3}} {{number_format($SubTotal4,2)}} {{number_format($SubTotal5,2)}} {{number_format($SubTotal6,2)}} {{number_format($SubTotal7,2)}} {{number_format($SubTotal8,2)}} {{number_format($SubTotal9,2)}} {{number_format($SubTotal10,2)}}{{number_format($SubTotal11,2)}}{{number_format($SavingsSubTotal1,2)}}{{number_format($SavingsTotalsSubTotal,2)}}
Total {{$Total1}} {{$Total2}} {{$Total3}} {{number_format($Total4,2)}} {{number_format($Total5,2)}} {{number_format($Total6,2)}} {{number_format($Total7,2)}} {{number_format($Total8,2)}} {{number_format($Total9,2)}} {{number_format($Total10,2)}}{{number_format($Total11,2)}}{{number_format($SavingsTotal1,2)}}{{number_format($SavingsTotalsTotal,2)}}{{number_format($Total11,2)}}
Prepared By :
Signature :
Designation :
Verified By :
Signature :
Designation :
Approved By :
Signature :
Designation :