@php use App\Http\Controllers\TestController; use App\Models\Demography; $ModuleId="806867ab-96a5-11eb-948a-56b1773fd56f"; $file_type = "vnd.ms-excel"; $file_name= $ReportName."-DrillDown.xls"; header("Content-Type: application/$file_type"); header("Content-Disposition: attachment; filename=$file_name"); $qry2=base64_decode($Query); $Count=$totalcount; $recordsPerPage=500; $totalRecords=$Count; $totalPages=ceil($totalRecords/$recordsPerPage); $hideColumns=[$primarykeyName,$CstmkeyName]; $ColumnName['FirstName']='First Name'; $ColumnName['LastName']='Last Name'; $ColumnName['PhoneMobile']='PhoneMobile'; $ColumnName['CallDateTime']='CallDateTime'; $ColumnName['LeadSource']='LeadSource'; $ColumnName['BranchOffice']='BranchOffice'; $ColumnName['AssignedUserId']='Assigned UserId'; $ColumnName['CreatedDate']='Created Date'; $ColumnName['UpdatedDate']='Updated Date'; $ColumnName['UpdatedBy']='Updated By'; $ColumnName['LeadDisposition']='LeadDisposition'; $ColumnName['LeadSubDisposition']='LeadSubDisposition'; $BranchOfficeDropDown=$GetDropdownLists['69']; $LeadDispositionDropDown=$GetDropdownLists['65']; $LeadSubDispositionDropDown=$GetDropdownLists['66']; $LeadSourceDropDown=$GetDropdownLists['ddfb84a7-5564-4335-9a18-f1a782c018cf']; @endphp @php $printHeader=1; $xx=0; //$totalPages=1; for($x=0;$x<$totalPages;$x++) { $startFrom=$x*$recordsPerPage; $results=DB::select($qry2." limit $startFrom,$recordsPerPage"); //$results=DB::select($qry2." limit 10"); @endphp @foreach($results as $result) @php $xx++; @endphp @if($printHeader==1) @foreach($ColumnName as $colname=>$value) @endforeach @foreach($ColumnName as $colname=>$value) @php $a=$result->$colname; if($colname=='LeadSource' && $a) { if(array_key_exists($a,$LeadSourceDropDown)) { $a=$LeadSourceDropDown[$a]; } } elseif($colname=='BranchOffice' && $a) { if(array_key_exists($a,$BranchOfficeDropDown)) { $a=$BranchOfficeDropDown[$a]; } } elseif($colname=='LeadDisposition' && $a) { if(array_key_exists($a,$LeadDispositionDropDown)) { $a=$LeadDispositionDropDown[$a]; } } elseif($colname=='LeadSubDisposition' && $a) { if(array_key_exists($a,$LeadSubDispositionDropDown)) { $a=$LeadSubDispositionDropDown[$a]; } } elseif($colname=='AssignedUserId' && $a) { if(array_key_exists($a,$getActiveUsersList)) { $a=$getActiveUsersList[$a]['name']; } } elseif($colname=='UpdatedBy' && $a) { if(array_key_exists($a,$getActiveUsersList)) { $a=$getActiveUsersList[$a]['name']; } } @endphp @endforeach @php $printHeader=0; @endphp @else @foreach($ColumnName as $colname=>$value) @php $a=$result->$colname; if($colname=='LeadSource' && $a) { if(array_key_exists($a,$LeadSourceDropDown)) { $a=$LeadSourceDropDown[$a]; } } elseif($colname=='BranchOffice' && $a) { if(array_key_exists($a,$BranchOfficeDropDown)) { $a=$BranchOfficeDropDown[$a]; } } elseif($colname=='LeadDisposition' && $a) { if(array_key_exists($a,$LeadDispositionDropDown)) { $a=$LeadDispositionDropDown[$a]; } } elseif($colname=='LeadSubDisposition' && $a) { if(array_key_exists($a,$LeadSubDispositionDropDown)) { $a=$LeadSubDispositionDropDown[$a]; } } elseif($colname=='AssignedUserId' && $a) { if(array_key_exists($a,$getActiveUsersList)) { $a=$getActiveUsersList[$a]['name']; } } elseif($colname=='UpdatedBy' && $a) { if(array_key_exists($a,$getActiveUsersList)) { $a=$getActiveUsersList[$a]['name']; } } @endphp @endforeach @endif @endforeach @php } @endphp
Slno{{$value}}
{{$xx}}{{$a}}
{{$xx}} {{$a}}
@php @endphp @php function str_replace_first($search, $replace, $subject) { $search = '/'.preg_quote($search, '/').'/'; return preg_replace($search, $replace, $subject, 1); } @endphp