@extends('layouts/fams_layout') @section('title', '| Report') @section('content') @php $projectSelected = isset($_GET['searchProject']) ? $_GET['searchProject'] : null; $projectTypeSelected = isset($_GET['searchProjectType']) ? $_GET['searchProjectType'] : null; $branchSelected = isset($_GET['searchBranch']) ? $_GET['searchBranch'] : null; $categorySelected = isset($_GET['searchCategory']) ? $_GET['searchCategory'] : null; $productTypeSelected = isset($_GET['searchProductType']) ? $_GET['searchProductType'] : null; $searchMethodSelected = isset($_GET['searchMethod']) ? $_GET['searchMethod'] : null; $fiscalYearSelected = isset($_GET['fiscalYear']) ? $_GET['fiscalYear'] : null; $dateFromSelected = isset($_GET['dateFrom']) ? $_GET['dateFrom'] : null; $dateToSelected = isset($_GET['dateTo']) ? $_GET['dateTo'] : null; $firstRequest = isset($_GET['fiscalYear']) ? '1' : '0'; @endphp
{!! Form::open(['url' => 'famsRegisterUseReport','method' => 'get']) !!} @php $userBranchId = Auth::user()->branchId; @endphp @if($userBranchId==1)
{!! Form::label('', 'Project:', ['class' => 'control-label pull-left']) !!}
@php $projects = DB::table('gnr_project')->select('id','name','projectCode')->get(); @endphp
@endif @if($userBranchId==1)
{!! Form::label('', 'Pro. Type:', ['class' => 'control-label pull-left']) !!}
@php if ($projectSelected!=null) { $projectTypes = DB::table('gnr_project_type')->where('projectId',$projectSelected)->select('id','name','projectTypeCode')->get(); } else{ $projectTypes = DB::table('gnr_project_type')->select('id','name','projectTypeCode')->get(); } @endphp
@endif @if($userBranchId==1)
{!! Form::label('', 'Branch:', ['class' => 'control-label pull-left']) !!}
@php $branches = DB::table('gnr_branch'); if ($projectSelected!=null) { $branches = $branches->where('projectId',$projectSelected); } if ($projectTypeSelected!=null) { $branches = $branches->where('projectTypeId',$projectTypeSelected); } $branches = $branches->orWhere('id',1)->select('id','name','branchCode')->get(); @endphp
@endif
{!! Form::label('', 'Category:', ['class' => 'control-label pull-left']) !!}
@php $categories = DB::table('fams_product_category')->select('id','name','categoryCode')->get(); @endphp
{!! Form::label('', 'Pro. Type:', ['class' => 'control-label pull-left']) !!}
@php $productTypes = DB::table('fams_product_type'); if ($categorySelected!=null) { $productTypes = $productTypes->where('productCategoryId',$categorySelected); } $productTypes = $productTypes->select('id','name','productTypeCode')->get(); @endphp
{!! 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']) !!}
@php $fiscalYears = DB::table('gnr_fiscal_year')->pluck('name','id')->toArray(); @endphp
{!! Form::submit('Search',['id'=>'search','class'=>'btn btn-primary btn-xs','style'=>'font-size:15px;']) !!}
{!! Form::close() !!}
{{-- End Filtering Group --}}

Register Use 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!=0)

@php $totalCostPrice = 0; $totalDep = 0; $totalWrittenDown = 0; @endphp @foreach($useProducts as $index => $useProduct) @php $product = DB::table('fams_product')->where('id',$useProduct->productId)->select('name','productCode','purchaseDate','totalCost','depreciationOpeningBalance')->first(); $employeeId = (int) DB::table('fams_tra_use')->where('id',$useProduct->useId)->value('employeeId'); $depAmount = DB::table('fams_depreciation_details')->where('productId',$useProduct->productId)->where('depTo','>=',$startDate)->where('depTo','<=',$endDate)->sum('amount'); @endphp @php $totalCostPrice = $totalCostPrice + $product->totalCost; $totalDep = $totalDep + $product->depreciationOpeningBalance+$depAmount; $totalWrittenDown = $totalWrittenDown + $product->totalCost-($product->depreciationOpeningBalance+$depAmount); @endphp @endforeach
SL# Purchase Date Product Name Product ID Number User Name / Use Room-Department Cost Value (Tk)
Cost Price Accumulated Dep. Written Down Value
{{$index+1}} {{date('d-m-Y',strtotime($product->purchaseDate))}} {{$product->name}} {{$product->productCode}} @php if ($employeeId>0) { $employee = DB::table('hr_emp_general_info')->where('id',$employeeId)->select('emp_id','emp_name_english')->first(); echo $employee->emp_id.'-'.$employee->emp_name_english; } else{ $roomId = (int) DB::table('fams_tra_use')->where('id',$useProduct->useId)->value('roomId'); $departmentRoom = DB::table('gnr_room')->where('id',$roomId)->value('name'); echo $departmentRoom.str_repeat(' ', (4*2)); $room = DB::table('gnr_room')->where('id',$roomId)->first(); $splitArray=str_replace(array('[', ']', '"', ''), '', $room->departmentId); $targetArray = explode(",",$splitArray); $arraySize = sizeof($targetArray); $j = 0; //var_dump($targetArray); foreach($targetArray as $departmentId){ echo App\gnr\GnrDepartment::where('id',$departmentId)->value('name'); $j++; if($j<$arraySize){ echo ' / '; } } } @endphp {{number_format($product->totalCost,2,'.',',')}} {{number_format($product->depreciationOpeningBalance+$depAmount,2,'.',',')}} {{number_format($product->totalCost-($product->depreciationOpeningBalance+$depAmount),2,'.',',')}}
Total {{number_format($totalCostPrice,2,'.',',')}} {{number_format($totalDep,2,'.',',')}} {{number_format($totalWrittenDown,2,'.',',')}}
@endif
{{-- Filtering Mehod --}} {{-- End Filtering Mehod --}} {{-- Print Page --}} {{-- EndPrint Page --}} {{-- Filtering --}}