@extends('layouts/fams_layout') @section('title', '| Report') @section('content') @include('successMsg')
{!! Form::open(['url' => 'famsAssetRegisterReport','method' => 'get']) !!} @php $userBranchId = Auth::user()->branchId; @endphp @if($userBranchId==1)
{!! Form::label('', 'Project:', ['class' => 'control-label pull-left']) !!}
@endif @if($userBranchId==1)
{!! Form::label('', 'Pro. Type:', ['class' => 'control-label pull-left']) !!}
@endif @if($userBranchId==1)
{!! Form::label('', 'Branch:', ['class' => 'control-label pull-left']) !!}
@endif
{!! Form::label('', 'Category:', ['class' => 'control-label pull-left']) !!}
{!! Form::label('', 'Pro. Type:', ['class' => 'control-label pull-left']) !!}
{!! Form::label('', 'Search By:', ['class' => 'control-label pull-left']) !!}
{!! Form::select('searchMethod',[''=>'Please Select','1'=>'Fiscal Year','2'=>'Current Year','3'=>'Date Range'],$searchMethodSelected,['id'=>'searchMethod','class'=>'form-control input-sm']) !!}
{!! Form::submit('Search',['id'=>'search','class'=>'btn btn-primary btn-xs','style'=>'font-size:15px;']) !!}
{!! Form::close() !!}
{{-- End Filtering Group --}}

Fixed Assets Register Report

@php if($branchSelected===0){ $selectedBranchName = "All Branches"; } else{ $selectedBranchName = DB::table('gnr_branch')->where('id',$branchSelected)->value('name'); } $selectedProjectName = DB::table('gnr_project')->where('id',$projectSelected)->value('name'); $selectedProjectTypeName = DB::table('gnr_project_type')->where('id',$projectTypeSelected)->value('name'); $selectedCategoryName = DB::table('fams_product_category')->where('id',$categorySelected)->value('name'); @endphp @if(!$firstRequest)

@php $index = 1; $totalOpeningBalnace = 0; $totalPurchase = 0; $totalAdjustmentIn = 0; $totalTransferIn = 0; $totalSale = 0; $totalAdjustmentOut = 0; $totalTransferOut = 0; $totalClosing = 0; $totalDepOpeningBalance = 0; $totalCurrentDep = 0; $totalDisposalAmount = 0; $totalDepTransferIn = 0; $totalDepTransferOut = 0; $totalDepAdjustment = 0; $totalDepClosingBalance = 0; $totalWrittenDown = 0; //echo var_dump($branches); @endphp @foreach($branchIds as $branchObj) {{-- Get the Produts belongs to this branch --}} @php $transferedAllProduct = DB::table('fams_tra_transfer as t1') ->join('fams_product as t2','t1.productId','=','t2.id') ->where('t1.branchIdFrom',$branchObj) ->where('t2.purchaseDate','<=',$endDate) ->whereIn('t2.categoryId',$categoryId) ->whereIn('t2.productTypeId',$productTypeId) ->whereIn('t2.projectId',$projectId) ->whereIn('t2.projectTypeId',$projectTypeId) ->pluck('productId'); $productsOfthisBranch = DB::table('fams_product')->where('branchId',$branchObj)->where('purchaseDate','<=',$endDate)->whereIn('projectId',$projectId)->whereIn('projectTypeId',$projectTypeId)->whereIn('categoryId',$categoryId)->whereIn('productTypeId',$productTypeId)->orWhereIn('id',$transferedAllProduct)->orderBy('purchaseDate','asc')->get(); @endphp @foreach($productsOfthisBranch as $product) @php $transferedOutProduct = DB::table('fams_tra_transfer')->where('productId',$product->id)->where('branchIdFrom',$branchObj)->where('transferDate','>=',$startDate)->get(); $transferedInProduct = DB::table('fams_tra_transfer')->where('productId',$product->id)->where('branchIdTo',$branchObj)->where('transferDate','>',$endDate)->get(); @endphp @if($branchObj==$product->branchId || sizeof($transferedOutProduct)>0) @if(sizeof($transferedInProduct)==0) @php $branchName = DB::table('gnr_branch')->where('id',$branchObj)->value('name'); $purchaseDate = date('Y-m-d', strtotime($product->purchaseDate)); //Get the Additional Charge After Start Date $postAddCharge = (float) DB::table('fams_additional_charge')->where('branchId',$branchObj)->where('productId',$product->id)->where('purchaseDate','>=',$startDate)->where('purchaseDate','<=',$endDate)->sum('amount'); if($purchaseDate<$startDate){ $additionalCharge = (float) DB::table('fams_additional_charge')->where('branchId',$branchObj)->where('productId',$product->id)->where('purchaseDate','<',$startDate)->sum('amount'); $openingBalance = (float) $product->totalCost + $additionalCharge; $purchase = $postAddCharge; } else{ $openingBalance = 0; $additionalCharge = (float) DB::table('fams_additional_charge')->where('productId',$product->id)->where('branchId',$branchObj)->where('purchaseDate','>=',$startDate)->where('purchaseDate','<=',$endDate)->sum('amount'); $purchase = (float) $product->totalCost + $additionalCharge; } //If product is sold out $soldOut = DB::table('fams_sale')->where('productId',$product->id)->where('branchId',$branchObj)->where('createdDate','>=',$startDate)->where('createdDate','<=',$endDate)->first(); if (sizeOf($soldOut)>0) { $saleAmount = $soldOut->amount; $adjustmentIn = $soldOut->profitAmount; //$adjustmentOut = Dep. Generated + Loss amount $adjustmentOut = round((float) $soldOut->lossAmount + (float) DB::table('fams_depreciation_details')->where('productId',$product->id)->sum('amount') + (float)DB::table('fams_product')->where('id',$product->id)->value('depreciationOpeningBalance'),2); //$depAdjustment = round(DB::table('fams_depreciation_details')->where('productId',$product->id)->where('depTo','>=',$startDate)->where('depTo','<=',$endDate)->sum('amount'),2); $depDisposalamount = 0; } else{ $saleAmount = 0; $adjustmentIn = 0; $adjustmentOut = 0; //If product is write offed $writeOffed = DB::table('fams_write_off')->where('productId',$product->id)->where('branchId',$branchObj)->where('createdDate','>=',$startDate)->where('createdDate','<=',$endDate)->first(); if (sizeOf($writeOffed)>0) { //$adjustmentOut = $writeOffed->lossAmount; $adjustmentOut = round((float) $additionalCharge + DB::table('fams_product')->where('id',$product->id)->value('totalCost'),2); $depDisposalamount = round((float) DB::table('fams_write_off')->where('productId',$product->id)->where('createdDate','>=',$startDate)->where('createdDate','<=',$endDate)->value('amount'),2); //$depAdjustment = round((float) $additionalCharge + DB::table('fams_product')->where('id',$product->id)->value('totalCost'),2); } else{ /*Is writeoff before start date */ $writeOffedBeforeStartDate = DB::table('fams_write_off')->where('productId',$product->id)->where('branchId',$branchObj)->where('createdDate','<',$startDate)->first(); if (sizeOf($writeOffedBeforeStartDate)>0) { continue; } /*End Is writeoff before start date */ $adjustmentOut = 0; $depDisposalamount = 0; //$depAdjustment = 20; } } //If Transfered Out Then get old product Code and Tranfer Amount $isTransferdOutProduct = DB::table('fams_tra_transfer')->where('productId',$product->id)->where('branchIdFrom',$branchObj)->where('transferDate','<=',$endDate)->orderBy('id','desc')->first(); if(sizeof($isTransferdOutProduct)>0){ $productCode = $isTransferdOutProduct->oldProductCode; $transferOutAmount = (float) $product->totalCost + (float) DB::table('fams_additional_charge')->where('productId',$product->id)->where('purchaseDate','<',$isTransferdOutProduct->transferDate)->sum('amount');; } else{ $productCode = $product->productCode; $transferOutAmount = 0; } //If product Transfered In Then get Tranfer Amount $isTransferdInProduct = DB::table('fams_tra_transfer')->where('productId',$product->id)->where('branchIdTo',$branchObj)->where('transferDate','>=',$startDate)->orderBy('id','desc')->first(); if(sizeof($isTransferdInProduct)>0){ $transferInAmount = (float) $product->totalCost + (float) DB::table('fams_additional_charge')->where('productId',$product->id)->where('purchaseDate','<',$isTransferdInProduct->transferDate)->sum('amount'); $openingBalance = 0; $purchase = 0; } else{ $transferInAmount = 0; } $closingBalance = round($openingBalance + $purchase + $adjustmentIn + $transferInAmount - $saleAmount - $adjustmentOut - $transferOutAmount,2); /////// Dep /////// $accDep = round($product->depreciationOpeningBalance + (float) DB::table('fams_depreciation_details')->where('productId',$product->id)->where('branchId',$branchObj)->where('depTo','<',$startDate)->sum('amount'),2); $currentAccDep = round((float) DB::table('fams_depreciation_details')->where('productId',$product->id)->where('branchId',$branchObj)->where('depTo','>=',$startDate)->where('depTo','<=',$endDate)->sum('amount'),2); //If product is sold out $soldOut = DB::table('fams_sale')->where('productId',$product->id)->where('branchId',$branchObj)->where('createdDate','>=',$startDate)->where('createdDate','<=',$endDate)->first(); if (sizeOf($soldOut)>0) { $depAdjustment = $accDep + $currentAccDep; } else{ /*If sold out before start date*/ $soldOutBeforeStartDate = DB::table('fams_sale')->where('productId',$product->id)->where('branchId',$branchObj)->where('createdDate','<',$startDate)->first(); if (sizeOf($soldOutBeforeStartDate)>0) { continue; } /*End If sold out before start date*/ //If product is write offed $writeOffed = DB::table('fams_write_off')->where('productId',$product->id)->where('branchId',$branchObj)->where('createdDate','>=',$startDate)->where('createdDate','<=',$endDate)->first(); if (sizeOf($writeOffed)>0) { $depAdjustment = (float) $product->totalCost + (float) DB::table('fams_additional_charge')->where('productId',$product->id)->sum('amount'); } else{ $depAdjustment = 0; } } //If product is Transfered In if(sizeof($isTransferdInProduct)>0){ $accDep=0; $depTransferInAmount = (float) DB::table('fams_tra_transfer')->where('branchIdTo',$branchObj)->where('productId',$product->id)->where('transferDate','>=',$startDate)->where('transferDate','<=',$endDate)->value('pastDep'); } else{ $depTransferInAmount = 0; } //If product Is transfered Out if(sizeof($isTransferdOutProduct)>0){ $depTransferOutAmount = $accDep + $currentAccDep; } else{ $depTransferOutAmount = 0; } $depTransferAmount = $depTransferOutAmount + $depTransferInAmount; $depClosingBalance = round($accDep + $currentAccDep + $depDisposalamount + $depTransferInAmount - $depAdjustment - $depTransferOutAmount,2); @endphp @php $index++; @endphp @endif @endif @endforeach @endforeach
SL# Purchase Date Product Name Product ID Number Branch Cost Value (Tk) Accmulated Depreciation (Tk) Written Down Value
Opening Balance Curr. Period Add Curr. Period Less Closing Balance Dep. Rate(%) Opening Balance Current Period Add/Less Closing Balance
Purchase Adjustment Transfer Sales Adjustment Transfer Depreciation Disposal Transfer In Transfer Out Adjustment
{{$index}} {{date('d-m-Y', strtotime($product->purchaseDate))}} {{$product->name}} {{$prefix.$productCode}} {{$branchName}} @if($openingBalance==0) {{""}} @else {{$openingBalance}} @endif @php $totalOpeningBalnace = $totalOpeningBalnace + $openingBalance; @endphp @if($purchase==0) {{""}} @else {{$purchase}} @endif @php $totalPurchase = $totalPurchase + $purchase; @endphp @if($adjustmentIn==0) {{""}} @else {{$adjustmentIn}} @endif @php$totalAdjustmentIn = $totalAdjustmentIn + $adjustmentIn;@endphp @if($transferInAmount==0) {{""}} @else {{$transferInAmount}} @endif @php$totalTransferIn = $totalTransferIn + $transferInAmount;@endphp @if($saleAmount==0) {{""}} @else {{$saleAmount}} @endif @php $totalSale = $totalSale + $saleAmount; @endphp @if($adjustmentOut==0) {{""}} @else {{$adjustmentOut}} @endif @php $totalAdjustmentOut = $totalAdjustmentOut + $adjustmentOut; @endphp @if($transferOutAmount==0) {{""}} @else {{$transferOutAmount}} @endif @php $totalTransferOut = $totalTransferOut + $transferOutAmount; @endphp {{$closingBalance}} @php $totalClosing = $totalClosing + $closingBalance; @endphp {{$product->depreciationPercentage}} @if($accDep==0) {{""}} @else {{number_format($accDep,2)}} @endif @php $totalDepOpeningBalance = $totalDepOpeningBalance + $accDep; @endphp @if($currentAccDep==0) {{""}} @else {{number_format($currentAccDep,2)}} @endif @php $totalCurrentDep = $totalCurrentDep + $currentAccDep; @endphp @if($depDisposalamount==0) {{""}} @else {{number_format($depDisposalamount,2)}} @endif @php $totalDisposalAmount = $totalDisposalAmount + $depDisposalamount; @endphp @if($depTransferInAmount==0) {{""}} @else {{number_format($depTransferInAmount,2)}} @endif @php $totalDepTransferIn = $totalDepTransferIn + $depTransferInAmount; @endphp @if($depTransferOutAmount==0) {{""}} @else {{number_format($depTransferOutAmount,2)}} @endif @php $totalDepTransferOut = $totalDepTransferOut + $depTransferOutAmount; @endphp @if($depAdjustment==0) {{""}} @else {{number_format($depAdjustment,2)}} @endif @php $totalDepAdjustment = $totalDepAdjustment + $depAdjustment; @endphp {{number_format($depClosingBalance,2)}} @php $totalDepClosingBalance = $totalDepClosingBalance + $depClosingBalance; @endphp {{number_format($closingBalance - $depClosingBalance,2)}} @php $totalWrittenDown = $totalWrittenDown + $closingBalance - $depClosingBalance; @endphp
Total {{$totalOpeningBalnace}} {{$totalPurchase}} {{$totalAdjustmentIn}} {{$totalTransferIn}} {{$totalSale}} {{$totalAdjustmentOut}} {{$totalTransferOut}} {{$totalClosing}} {{number_format($totalDepOpeningBalance,2)}} {{number_format($totalCurrentDep,2)}} {{number_format($totalDisposalAmount,2)}} {{number_format($totalDepTransferIn,2)}} {{number_format($totalDepTransferOut,2)}} {{number_format($totalDepAdjustment,2)}} {{number_format($totalDepClosingBalance,2)}} {{number_format($totalWrittenDown,2)}}
@endif
{{-- Filtering Mehod --}} {{-- End Filtering Mehod --}} {{-- Print Page --}} {{-- EndPrint Page --}} {{-- Filtering --}}