@php // Customize Number Of Filters Per Line $number_of_filters_per_line = 3; $report_filters = getFilters(array_filter(request()->all())); function getFilters($params) { $transaction = new \App\Models\Transaction(); $common = new \App\Models\Common(); $filters = []; // Enter Params Where Primary Key Is Passed $model_params = [ // 'branch_id' => ['label' => 'Project' , 'model'=> 'App\Models\Branch' ,'input_column'=>'id', 'output_column'=>'name'], E.g Entry 'branch_id' => ['label' => 'Project' , 'model'=> 'App\Models\Branch' ], 'branch' => ['label' => 'Project' , 'model'=> 'App\Models\Branch' ], 'project_id' => ['label' => 'Project' , 'model'=> 'App\Models\Branch' ], 'project' => ['label' => 'Project' , 'model'=> 'App\Models\Branch' ], 'item_id' => ['label' => 'Item' , 'model'=> 'App\Models\Item' ], 'customer_id' => ['label' => 'Customer' , 'model'=> 'App\Models\Customer' ], 'group_id' => ['label' => 'Group' , 'model'=> 'App\Models\IncomeExpenseGroup'], 'sub_group' => ['label' => 'Sub Group' , 'model'=> 'App\Models\IncomeExpenseGroup'], 'warehouse_id' => ['label' => 'Warehouse' , 'model'=> 'App\Models\Warehouse' ,'output_column'=>'warehouse_name'], 'from_warehouse_id' => ['label' => 'From Warehouse' , 'model'=> 'App\Models\Warehouse' ,'output_column'=>'warehouse_name'], 'to_warehouse_id' => ['label' => 'To Warehouse' , 'model'=> 'App\Models\Warehouse' ,'output_column'=>'warehouse_name'], 'block_id' => ['label' => 'Block' , 'model'=> 'App\Models\Block' ], 'block' => ['label' => 'Block' , 'model'=> 'App\Models\Block' ], 'floor_id' => ['label' => 'Floor' , 'model'=> 'App\Models\PropertyFloor' ], 'floor' => ['label' => 'Floor' , 'model'=> 'App\Models\PropertyFloor' ], 'product_type_id' => ['label' => 'Product Type' , 'model'=> 'App\Models\ProductType' ], 'internal_dealer_id' => ['label' => 'Internal Dealer' , 'model'=> 'App\Models\Employee' ], 'external_dealer_id' => ['label' => 'External Dealer' , 'model'=> 'App\Models\Employee' ], 'dealer_id' => ['label' => 'Dealer' , 'model'=> 'App\Models\Employee' ], 'external_employee_id' => ['label' => 'External Dealer' , 'model'=> 'App\Models\Employee' ], 'employee_id' => ['label' => 'Employee' , 'model'=> 'App\Models\Employee' ], 'recovery_agent' => ['label' => 'User' , 'model'=> 'App\Models\User' ], 'user_id' => ['label' => 'User' , 'model'=> 'App\Models\User' ], 'vendor_id' => ['label' => 'Vendor' , 'model'=> 'App\Models\Vendor' ], 'vendor_head_id' => ['label' => 'Vendor Name' , 'model'=> 'App\Models\IncomeExpenseHead' ], 'income_expense_head_id'=> ['label' => 'Head of Account' , 'model'=> 'App\Models\IncomeExpenseHead' ], 'head_ids' => ['label' => 'Head of Accounts' , 'model'=> 'App\Models\IncomeExpenseHead' ], 'vendor_id' => ['label' => 'Vendor' , 'model'=> 'App\Models\Vendor' ], 'bank_head_id' => ['label' => 'Bank Name' , 'model'=> 'App\Models\IncomeExpenseHead' ], 'property_type_id' => ['label' => 'Property Type' , 'model'=> 'App\Models\ProductType' ], 'product_type' => ['label' => 'Product Type' , 'model'=> 'App\Models\ProductType' ], 'category_id' => ['label' => 'Category' , 'model'=> 'App\Models\Category' ], 'hrm_employee_id' => ['label' => 'Employee' , 'model'=> 'App\Models\Employee' ], 'department_id' => ['label' => 'Department' , 'model'=> 'App\Models\Department' ,'output_column'=>'department_name'], 'contractor' => ['label' => 'Contractor' , 'model'=> 'App\Models\Contractor' ], 'bill_terms' => ['label' => 'Bill Term' , 'model'=> 'App\Models\MntBillTerm' ], ]; // Enter Params Where Direct Value Is Applied $non_model_params =[ // 'from' => ['label' => 'From' , 'is_date' => true , 'replace_value' => false , 'is_bit_value' => false ], E.G ENTRY 'from' => ['label' => 'From' , 'is_date' => true ], 'to' => ['label' => 'To' , 'is_date' => true ], 'with_bf' => ['label' => 'With Bf' , 'is_bit_value' => true ], 'is_summary' => ['label' => 'Summary' , 'is_bit_value' => true ], 'summary' => ['label' => 'Summary' , 'is_bit_value' => true ], 'with_zero_transactions' => ['label' => 'With Zero Transactions' , 'is_bit_value' => true ], 'distribution_type' => ['label' => 'Distribution Type' , 'replace_value' => true ], 'report_type' => ['label' => 'Report Type' , 'replace_value' => true ], 'issue_no' => ['label' => 'Issue No' ], 'transfer_no' => ['label' => 'Transfer No' ], 'issue_return_no' => ['label' => 'Issue Return No' ], 'payment_status' => ['label' => 'Payment Status' ], 'purchase_return_no' => ['label' => 'Purchase Return No' ], 'grn_no' => ['label' => 'Grn No' ], 'utilization_no' => ['label' => 'Utilization No' ], 'registration_no' => ['label' => 'Registration No' ], 'installment_type' => ['label' => 'Installment Type' , 'replace_value' => true ], 'sale_status' => ['label' => 'Sale Status' ], 'sort_by' => ['label' => 'Sort By' , 'replace_value' => true ], 'mobile' => ['label' => 'Mobile No' ], 'cnic' => ['label' => 'Cnic No' ], 'flat_size' => ['label' => 'Unit Size' ], 'show_last_payment' => ['label' => 'Show Last Payment' , 'is_bit_value' => true ], 'show_sub_total_on_excel' => ['label' => 'Show Sub Total On Excel' , 'is_bit_value' => true ], 'is_horizontal' => ['label' => 'Horizontal View' , 'is_bit_value' => true ], 'schedule_type' => ['label' => 'Schedule Type' ], 'receipt_no' => ['label' => 'Receipt No' ], 'approval_status' => ['label' => 'Approval Status' , 'replace_value' => true ], 'receipt_type' => ['label' => 'Receipt Type' ], 'official_state' => ['label' => 'Official State' ], 'payment_mode' => ['label' => 'Payment Mode' ], 'official_unofficial' => ['label' => 'Official / Unofficial' ], 'voucher_no' => ['label' => 'Voucher Number' ], 'type' => ['label' => 'Type' ], 'mode' => ['label' => 'Mode' ], 'sorting_order' => ['label' => 'Sorting Order' , 'replace_value' => true ], 'created_by' => ['label' => 'Created By' ], 'module_type' => ['label' => 'Show Transactions From' ], 'cheque_number' => ['label' => 'Cheque No' ], 'particulars' => ['label' => 'Particulars' ], 'voucher_type' => ['label' => 'Voucher Type' ], 'pr_status' => ['label' => 'PR Status' ], 'payment_type' => ['label' => 'Payment Type' ], 'group' => ['label' => 'With Group' , 'is_bit_value' => true ], 'cheque_no' => ['label' => 'Cheque No' ], 'type' => ['label' => 'Type' , 'replace_value' => true ], 'status' => ['label' => 'Status' , 'replace_value' => true ], 'cheque_date_from' => ['label' => 'Cheque Date From' , 'is_date' => true ], 'cheque_date_to' => ['label' => 'Cheque Date To' , 'is_date' => true ], 'voucher_date_from' => ['label' => 'Voucher Date From' , 'is_date' => true ], 'voucher_date_to' => ['label' => 'Voucher Date To' , 'is_date' => true ], 'product_name' => ['label' => 'Product Name' ], 'mobile' => ['label' => 'Mobile No' ], 'from_year' => ['label' => 'From Year' , 'is_date' => true ], 'year' => ['label' => 'Year' ], 'to_year' => ['label' => 'To Year' , 'is_date' => true ], 'unit_number' => ['label' => 'Unit Number' ], 'nic' => ['label' => 'NIC' ], 'payment_priority' => ['label' => 'Payment Priority' ], 'customer' => ['label' => 'Customer' ], 'product_id' => ['label' => 'Product' ], 'term_name' => ['label' => 'Term Name' ], 'file_name' => ['label' => 'File Name' ], 'show_status' => ['label' => 'Show Status' , 'is_bit_value' => true ], 'receipt_check' => ['label' => 'Receipt Check' , 'is_bit_value' => true ], 'apply_paid_date' => ['label' => 'Apply Paid Date' , 'is_bit_value' => true ], 'show_balance' => ['label' => 'Show Balance' , 'is_bit_value' => true ], 'collected_amount' => ['label' => 'Collected Amount' , 'is_bit_value' => true ], 'sort_by' => ['label' => 'sort_by' , 'replace_value' => true ], 'token_only' => ['label' => 'Token Only' , 'replace_value' => true , 'is_bit_value' => true ], 'rate_per_size' => ['label' => 'Rate Per Size' , 'replace_value' => true , 'is_bit_value' => true ], 'mode_of_payment' => ['label' => 'Mode of Payment' ], 'floor_wise' => ['label' => 'Floor Wise' ], 'floor_number' => ['label' => 'Floor No' ], 'term' => ['label' => 'Term' ], 'purchase_order_id' => ['label' => 'Purchase Order' ], 'requisition_id' => ['label' => 'Requisition Order' ], 'pv_voucher_no' => ['label' => 'PV Voucher No' ], 'po_voucher_no' => ['label' => 'PO Voucher No' ], 'category_and_layouts' => ['label' => 'Category and Layouts' , 'is_bit_value' => true ], 'adverstisement_status' => ['label' => 'Adverstisement Status' ], 'product_status' => ['label' => 'Product Status' ], 'show_entities' => ['label' => 'Vouchers' ], 'sms_type' => ['label' => 'SMS Type' ], 'tracking_id' => ['label' => 'Tracking ID' ], 'consignment_no' => ['label' => 'Consignment No' ], 'month' => ['label' => 'Month' ], 'due_term' => ['label' => 'Due Term' ], 'bill_year' => ['label' => 'Bill Year' ], 'filter' => ['label' => 'Filter' , 'replace_value' => true ], 'additional_setting' => ['label' => 'Additional Setting' , 'replace_value' => true ], 'is_official' => ['label' => 'Official Status' , 'replace_value' => true ], 'include_transfered_sales' => ['label' => 'Include Transfered Sales' , 'is_bit_value' => true ], 'application_status' => ['label' => 'Application Status' , 'replace_value' => true ], 'date_type' => ['label' => 'Date Type' , 'replace_value' => true ], 'collection_from' => ['label' => 'Collection From' , 'is_date' => true , 'replace_value' => true], 'collection_to' => ['label' => 'Collection To' , 'is_date' => true , 'replace_value' => true], 'with_heads' => ['label' => 'With Heads' , 'replace_value' => true], 'without_heads' => ['label' => 'Without Heads' , 'replace_value' => true], ]; $replace_values = [ 'branch' => 'Project', 'branch_id' => 'Project', 'summary' => 'Summary', 'detailed' => 'Detailed', 'warehouse' => 'Warehouse', 'all' => 'All', 'approved' => 'Approved', 'un_approved' => 'Un Approved', 'date_of_collection'=>'Date Of Collection', 'created_date'=>'Created Date', 'separate' => 'Separate', 'combine' => 'Combine', 'official' => 'Official', 'unofficial' => 'Unofficial', 'in_Progress' => 'In Progress', 'completed' => 'Completed', 'open' => 'Open', 'cheque_date' => 'Cheque Date', 'voucher_date' => 'Voucher Date', 'collection_from' => 'Collection From', 'collection_to' => 'Collection TO', ]; foreach ($params as $param_key => $param_value) { $is_exists = false; $paramName = ''; $paramValue = null; if(!empty(($non_model_params[$param_key] ??null) )){ $is_exists = true; $paramItems = $non_model_params[$param_key]; $paramName = $paramItems['label']; $is_replace_value = $paramItems['replace_value'] ?? false; $is_bit_value = $paramItems['is_bit_value'] ?? false; $is_date = $paramItems['is_date'] ?? false; $paramValue = $param_value; // If FIlter Is In Array Form // Filter Is then Comma Separated // Replace Value Functionality is Working on Array Filters too. if(is_array($param_value)){ $paramValues = $param_value; if($is_replace_value == true){ $paramValues= []; foreach ($param_value as $param_child_value) { $paramValues[]= $replace_values[$param_child_value] ?? $param_child_value ; } } $paramValue = implode(', ',$paramValues) ; }else{ if($is_replace_value == true){ $paramValue = $replace_values[$paramValue] ?? $paramValue ; } if($param_key == 'month' ){ $paramValue = $common::getMonthName($paramValue) ?? $paramValue; } if($is_bit_value == true){ $paramValue = $paramValue == 1 ? 'YES' : 'NO' ; } if($is_date == true){ $paramValue = $transaction->date_format($paramValue); } } } elseif(!empty(($model_params[$param_key] ??null) )){ $is_exists = true; $modelItem = $model_params[$param_key]; $model = $modelItem['model'] ?? null; $input_column = $modelItem['input_column']?? 'id'; $output_column = $modelItem['output_column']?? 'name'; $paramName = $modelItem['label'] ?? null; if(is_array($param_value)){ $paramValues = $param_value; $paramValues= []; foreach ($param_value as $param_child_value) { $paramValues[]= $model::where($input_column,$param_child_value)->first()->{$output_column} ?? '-'; } $paramValue = implode(', ',$paramValues) ; }else{ $paramValue = $model::where($input_column,$param_value)->first()->{$output_column} ?? '-' ; } } if($is_exists && !empty($paramValue)){ $filters[$paramName] = $paramValue; } } return $filters; } @endphp @if(count($report_filters) > 0) {{-- Loop for Param Array --}} @foreach ($report_filters as $filter_name => $filter_value) @php $tr_start_condition = $loop->iteration == 1 || $loop->iteration%($number_of_filters_per_line+1) === 0 ; $tr_end_condition = $loop->iteration == count($report_filters) || $loop->iteration%($number_of_filters_per_line) === 0; @endphp @if($tr_start_condition ) @endif @if($tr_end_condition) @endif @endforeach
{{ $filter_name }}: {{ $filter_value }}

@endif @php @endphp