CasperSecurity

Current Path : /var/www/orientalss.com/app/Http/Livewire/Finance/
Upload File :
Current File : /var/www/orientalss.com/app/Http/Livewire/Finance/JournalLivewire.php

<?php

namespace App\Http\Livewire\Finance;

use App\Models\EmployeeProfile;
use App\Models\EmployeeRegistration;
use App\Models\FinancialTransactions;
use App\Models\FinancialTransactionsLedgerHead;
use App\Models\LedgerHead;
use App\Models\LedgerheadType;
use App\Models\Vendor;
use Livewire\Component;
use Livewire\WithPagination;

class JournalLivewire extends Component
{
    use WithPagination;
    protected $paginationTheme = 'bootstrap';

    public $search;
    public $perPage=10;
    public $orderBy='id';
    public $orderAsc='1';
    public  $voucher_particulars, $total_debit_amount,$total_credit_amount;
    public  $finance_transaction_id,$ledger_type,$vendor_id,$ledger_head_id,$employee_id,$amount,$type,$status,$data;

    public $modelid;
    public $closemodalclick;
    public $successmsg="The TDS Section data has been saved successfully.";
    public $duplicateerrormsg="Sorry !!! TDS Section code has already exists in our database. Please Try Another Name";
    public $errormsg="Sorry !!! Something went wrong. Please Try Again.";

    protected $listeners = ['delete'];
    public $rules = [
        'ledger_type' => 'required',
      /*  'vendor_id' => 'required',*/
        'ledger_head_id' => 'required',
        'employee_id' => 'required',
        'amount' => 'required',
    ];
    public $messages = [
        'ledger_type.required' => 'This field is required',
        /*'vendor_id.required' => 'This field is required',*/
        'ledger_head_id.required' => 'This field is required',
        'employee_id.required' => 'This field is required',
        'amount.required' => 'This field is required',
    ];
    public function cleanVar()
    {
        $this->modelid = null;
        $this->ledger_type = null;
        $this->ledger_head_id = null;
        $this->vendor_id = null;
        $this->employee_id = null;
        $this->type = null;
        $this->amount = null;
        $this->showmodal = false;
    }
   /* protected $fillable = [
        'ledger_type',
        'ledger_head_id',
        'vendor_id',
        'employee_id',
        'type',
        'amount',
    ];*/
    public function save()
    {
//    /*    dd($this->ledger_head_id, $this->ledger_type, $this->employee_id, $this->amount);
       /* $data = FinancialTransactions::where('voucher_particulars', $this->voucher_particulars);
        if ($data) {
            $this->dispatchBrowserEvent('showsuccessmsg',[
                'type' => 'error',
                'message' => $this->duplicateerrormsg
            ]);
            return;
        }*/
        $response= FinancialTransactions::create([
            'voucher_particulars' => $this->voucher_particulars,
        ]);
        //dd($response);
        if ($response) {
            $this->validate($this->rules, $this->messages);
            $sectionRate = FinancialTransactionsLedgerHead::create([
                'ledger_type' => $this->ledger_type,
                'ledger_head_id' => $this->ledger_head_id,
                'vendor_id' => $this->vendor_id,
                'employee_id' => $this->employee_id,
                'type' => $this->type,
                'amount' => $this->amount,
            ]);
            if ($sectionRate) {
                $this->cleanVar();
                $this->dispatchBrowserEvent('closeOffCanvas');
                $this->dispatchBrowserEvent('showsuccessmsg', [
                    'type' => 'success',
                    'message' => $this->successmsg
                ]);
            } else {
                $this->dispatchBrowserEvent('showsuccessmsg', [
                    'type' => 'error',
                    'message' => $this->errormsg
                ]);
            }
        } else {
            $this->dispatchBrowserEvent('showsuccessmsg', [
                'type' => 'error',
                'message' => $this->errormsg
            ]);
        }
    }
    /*    public function tdsratesave(){
            {
                // dd('');
                $this->validate($this->tdsrules,$this->tdsmessages);
                $response=TdsSectionRate::where('tds_financial_year',$this->tds_financial_year)->first();
                //dd($response);
                if($response){
                    $this->dispatchBrowserEvent('showsuccessmsg',[
                        'type'=>'error',
                        'message'=>$this->duplicateerrormsg
                    ]);
                }else {
                    $response = TdsSectionRate::create([
                        'tds_financial_year'=>$this->tds_financial_year,
                        'tds_individual_rate'=>$this->tds_individual_rate,
                        'tds_company_rate'=>$this->tds_company_rate,
                        'tds_nopan_rate'=>$this->tds_nopan_rate,
                        'tds_cutoff_amount'=>$this->tds_cutoff_amount,
                    ]);
                    //dd($response);
                }
            }
        }*/

   /* public function update(){
        $this->validate($this->updatedrules,$this->messages);
        //dd($this);
        $response=TdsSection::find($this->modelid);
        //dd($tsection['id']);
        if($response){
            $response->update([
                'tds_natureof_payment'=>$this->tds_natureof_payment,
                'ledger_head_id'=>$this->ledger_head_id,
                'status'=>$this->status,
            ]);
            if($response){
                $this->cleanVar();
                $this->dispatchBrowserEvent('closeOffCanvas');
                $this->dispatchBrowserEvent('showsuccessmsg',[
                    'type'=>'success',
                    'message'=>$this->updatemsg
                ]);
            }else{
                // $this->cleanVar();
                $this->dispatchBrowserEvent('showsuccessmsg',[
                    'type'=>'error',
                    'message'=>$this->errormsg
                ]);
            }
        }
    }*/
   /* public function delete(){
        $response=TdsSectionRate::find($this->modelid);
        if($response){
            if($response->delete()){
                $this->cleanVar();
                $this->dispatchBrowserEvent('showsuccessmsg',[
                    'type'=>'success',
                    'message'=>$this->deletemsg
                ]);
            }else{
                $this->dispatchBrowserEvent('showsuccessmsg',[
                    'type'=>'error',
                    'message'=>$this->errormsg
                ]);
            }
        }
    }*/
    public function read(){
        $financial_transactions=FinancialTransactions::search($this->search)
            ->orderBy($this->orderBy, $this->orderAsc ? 'asc' : 'desc')
            ->paginate($this->perPage);
        return $financial_transactions;
    }
    public function rate(){
        $financial_transactions_ledger_heads=FinancialTransactionsLedgerHead::search($this->search)
            ->orderBy($this->orderBy, $this->orderAsc ? 'asc' : 'desc')
            ->paginate($this->perPage);
        return $financial_transactions_ledger_heads;
    }
  /*  public function mount()
    {
        // Fetch data or ensure it's set properly
        $this->ledgerhead = LedgerHead::all(); // Retrieve all ledger heads
    }*/
    public function render()
    {
        $datatable = [];
        $datatable = $this->read();
        if (sizeof($datatable) > 0) {
            foreach ($datatable as $key => $data) {
                $ledger = LedgerHead::where('id', $data->ledger_head_id)->first();
                if ($ledger) {
                    $datatable[$key]['ledger_head_name'] = $ledger->ledger_head_name
                    ;
                } else {
                    $datatable[$key]['ledger_head_name'] = "NA";
                }
            }
        }
        $this->ledgerhead = LedgerHead::all();

        $vendors = Vendor::where('status', 1)->get();
        $employees = EmployeeRegistration::where('status', 1)->get();
        //dd($employees);
        $ledgerhead = LedgerHead::where('status', 1)->get();
        return view('livewire.finance.journal-livewire',compact('datatable','vendors','employees','ledgerhead'));
    }
}
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