Prv8 Shell
Server : Apache
System : Linux server.mata-lashes.com 3.10.0-1160.90.1.el7.x86_64 #1 SMP Thu May 4 15:21:22 UTC 2023 x86_64
User : matalashes ( 1004)
PHP Version : 8.1.29
Disable Function : NONE
Directory :  /home/matalashes/www/simulasikite.mata-lashes.com/app.bak/Models/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/matalashes/www/simulasikite.mata-lashes.com/app.bak/Models/PembelianFaktur.php
<?php

namespace App\Models;

use CodeIgniter\Model;

class PembelianFaktur extends Model
{
    protected $DBGroup = 'default';
    protected $table = 'pembelian_faktur';
    protected $primaryKey = 'pf_id';
    protected $useAutoIncrement = true;
    protected $insertID = 0;
    protected $returnType = 'object';
    protected $useSoftDeletes = true;
    protected $protectFields = true;
    protected $allowedFields = ['pf_no','ms_id','mppn_id','pf_penjual','pf_tgl_nota','pf_phone','pf_address','pf_item','pf_status','pf_status_bayar','pf_metode_bayar','pf_tempo','pf_amount','pf_tgl_bayar','pf_jml_bayar','pf_ppn','pf_subtotal','pf_grandtotal', 'deleted_at'];

    // Dates
    protected $useTimestamps = true;
    protected $dateFormat = 'datetime';
    protected $createdField = 'created_at';
    protected $updatedField = 'updated_at';
    protected $deletedField = 'deleted_at';

    // Validation
    protected $validationRules = [];
    protected $validationMessages = [];
    protected $skipValidation = false;
    protected $cleanValidationRules = true;

    // Callbacks
    protected $allowCallbacks = true;
    protected $beforeInsert = [];
    protected $afterInsert = [];
    protected $beforeUpdate = [];
    protected $afterUpdate = [];
    protected $beforeFind = [];
    protected $afterFind = [];
    protected $beforeDelete = [];
    protected $afterDelete = [];
    
    public function fieldExist($field_name)
    {
        $db = \Config\Database::connect();
        return $db->fieldExists($field_name, 'pembelian_faktur');
    }
    public static function count_faktur()
    {
        $db = \Config\Database::connect();
        $builder = $db->table('pembelian_faktur');
        $builder->select('count(*) as count');
        $builder->where('deleted_at', null);

        return $builder->get()->getFirstRow();
    }

    public static function get_hutang()
    {
        $db = \Config\Database::connect();
        $builder = $db->table('pembelian_faktur');
        $builder->select('pf_penjual, SUM(pf_amount) as hutang,pf_phone,count(*) as jml_nota');
        $builder->where('deleted_at ', null);
        $builder->where('pf_status', 1);
        $builder->where('pf_status_bayar', 0);
        $builder->groupBy('pf_penjual');

        return $builder->get()->getResult();
    }
    public static function getlist_hutang()
    {
        $db = \Config\Database::connect();
        $builder = $db->table('pembelian_faktur');
        $builder->select('*');
        $builder->where('deleted_at ', null);
        $builder->where('pf_status', 1);
        $builder->where('pf_status_bayar', 0);

        return $builder->get()->getResult();
    }
}

haha - 2025