Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/inventory.corals.io/Corals/modules/Inventory/Classes/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/inventory.corals.io/Corals/modules/Inventory/Classes/Cheque.php
<?php

namespace Corals\Modules\Inventory\Classes;


use Corals\Modules\Inventory\Classes\Scopes\CreatedAtBetweenScope;
use Corals\Modules\Payment\Common\Models\Transaction;

class Cheque
{
    protected $start_date;
    protected $end_date;

    public function __construct()
    {
        $this->start_date = request()->get('start_date', now()->startOfMonth());

        $this->end_date = request()->get('end_date', now()->endOfMonth());
    }


    public function expensesCheque()
    {
        $expenses_cheque = Transaction::query()->select('payment_transactions.*','inv_suppliers.name')
            ->join('inv_orders','inv_orders.id','=','payment_transactions.sourcable_id')
            ->join('inv_suppliers','inv_suppliers.id','=','inv_orders.supplier_id')
            ->where('payment_transactions.type','=','expense')
            ->whereRaw("JSON_EXTRACT(extra,'$.gateway') = 'Cheque'");


        (new CreatedAtBetweenScope('payment_transactions','transaction_date'))->apply($expenses_cheque, $this->start_date, $this->end_date);

        return $expenses_cheque->get();
    }


    public function orderRevenueCheque()
    {
        $order_revenues_cheque = Transaction::query()->select('payment_transactions.*','users.name','inv_orders.number')
            ->join('inv_orders','inv_orders.id','=','payment_transactions.sourcable_id')
            ->join('users','users.id','=','inv_orders.user_id')
            ->where('payment_transactions.type','=','order_revenue')
            ->whereRaw("JSON_EXTRACT(extra,'$.gateway') = 'Cheque'");


        (new CreatedAtBetweenScope('payment_transactions','transaction_date'))->apply($order_revenues_cheque, $this->start_date, $this->end_date);

        return $order_revenues_cheque->get();
    }


}

Spamworldpro Mini