CasperSecurity

Current Path : /var/www/hrms.uiet.co.in/app/Exports/
Upload File :
Current File : /var/www/hrms.uiet.co.in/app/Exports/TaxInvoiceReportExport.php

<?php

namespace App\Exports;

use Illuminate\Contracts\View\View;
use Maatwebsite\Excel\Concerns\FromCollection;
use Maatwebsite\Excel\Concerns\FromView;
use Maatwebsite\Excel\Concerns\WithHeadings;
use Illuminate\Support\Collection;


/*class TaxInvoiceReportExport implements FromCollection, WithHeadings
{

    protected $data;
    protected $taxdata;

    public function __construct(Collection $data, Collection $taxdata)
    {
        $this->data = $data;
        $this->taxdata = $taxdata;
    }

    public function collection()
    {
        // Combine both datasets into one collection
        $combinedData = $this->data->map(function ($item) {
            return [
                $item['di_no'],
                \Carbon\Carbon::parse($item['created_at'])->format('M d, Y'),
                $item['clientinfos']['gst_no'] ?? 'N/A',
                $item['get_direct_sale_info'][0]['sac_code'] ?? '',
                $item['get_direct_sale_info'][0]['service_id'] ?? '',
                number_format((float)$item['get_direct_sale_info'][0]['taxable_amount'], 2, '.', ''),
                $item['clientinfos']['other_state'] == 1 || $item['is_other_state'] == 1 ? number_format((float)($item['get_direct_sale_info'][0]['cgst_amount'] + $item['get_direct_sale_info'][0]['sgst_amount']), 2, '.', '') : '0.00',
                $item['clientinfos']['other_state'] == 1 || $item['is_other_state'] == 1 ? '0.00' : number_format((float)$item['get_direct_sale_info'][0]['cgst_amount'], 2, '.', ''),
                $item['clientinfos']['other_state'] == 1 || $item['is_other_state'] == 1 ? '0.00' : number_format((float)$item['get_direct_sale_info'][0]['sgst_amount'], 2, '.', ''),
                number_format((float)$item['get_direct_sale_info'][0]['gst_amount'], 2, '.', ''),
                number_format((float)($item['get_direct_sale_info'][0]['taxable_amount'] + $item['get_direct_sale_info'][0]['gst_amount']), 2, '.', ''),
            ];
        })->concat($this->taxdata->map(function ($taxitem) {
            return [
                $taxitem['invoice_no'],
                \Carbon\Carbon::parse($taxitem['created_at'])->format('M d, Y'),
                $taxitem['gst_no'] ?? 'N/A',
                '', // Assuming HSN Code is empty
                $taxitem['description'],
                number_format((float)$taxitem['taxable_amount'], 2, '.', ''),
                empty($taxitem['gst_no']) || strpos($taxitem['gst_no'], '21') === 0 ? '0' : number_format((float)($taxitem['cgst_amount'] + $taxitem['sgst_amount']), 2, '.', ''),
                empty($taxitem['gst_no']) || strpos($taxitem['gst_no'], '21') === 0 ? number_format((float)$taxitem['cgst_amount'], 2, '.', '') : '0',
                empty($taxitem['gst_no']) || strpos($taxitem['gst_no'], '21') === 0 ? number_format((float)$taxitem['sgst_amount'], 2, '.', '') : '0',
                number_format((float)$taxitem['gst_amount'], 2, '.', ''),
                number_format((float)$taxitem['net_amount'], 2, '.', ''),
            ];
        }));

        return $combinedData;
    }

    public function headings(): array
    {
        return [
            'Invoice No',
            'Invoice Date',
            'GSTIN',
            'HSN Code',
            'GOODS',
            'VALUE',
            'IGST',
            'CGST',
            'SGST',
            'TOTAL GST',
            'TOTAL',
        ];
    }

}*/
class TaxInvoiceReportExport implements FromView
{
    protected $data;
    protected $taxdata;

    public function __construct($data, $taxdata)
    {
        $this->data = $data;
        $this->taxdata = $taxdata;
    }

    public function view(): View
    {
        return view('client.tax_invoices_exportdata', [
            'datatablesnew' => $this->data,
            'datatablesTax' => $this->taxdata
        ]);
    }
}
Hacker Blog, Shell İndir, Sql İnjection, XSS Attacks, LFI Attacks, Social Hacking, Exploit Bot, Proxy Tools, Web Shell, PHP Shell, Alfa Shell İndir, Hacking Training Set, DDoS Script, Denial Of Service, Botnet, RFI Attacks, Encryption
Telegram @BIBIL_0DAY