<?php

use Google\Service\CloudSearch\Resource\Query;

defined('BASEPATH') or exit('No direct script access allowed');

class Notifikasi_kasir extends CI_Model
{
    function nv_arisanheboh()
    {
        $this->db->select('count(*) as notif_heboh');
        $this->db->from('nota');
        $this->db->where('produk_id', '21');
        $this->db->where('status_nota', 'PROSES');
        $query = $this->db->get();
        return $query->row_array();
    }
    function nv_arisanmotor()
    {
        $this->db->select('count(*) as notif_motor');
        $this->db->from('nota');
        $this->db->where('produk_id', '22');
        $this->db->where('status_nota', 'PROSES');
        $query = $this->db->get();
        return $query->row_array();
    }
    function nv_arisanmotor_tunggakan()
    {
        $this->db->select('count(*) as notif_motor_tunggakan');
        $this->db->from('nota');
        $this->db->where('produk_id', '22');
        $this->db->where('status_nota', 'PROSES_TUNGGAKAN');
        $query = $this->db->get();
        return $query->row_array();
    }
    function nv_realisasi()
    {
        $query = $this->db->select('count(*) as notif_realisasi');
        $query = $this->db->from('p_koperasi_kontrak as A');
        $query = $this->db->join('p_koperasi_progres as B', 'B.kontrak_id=A.id');
        $query = $this->db->join('anggota as C', 'A.anggota_id=C.id');
        $query = $this->db->join('sistem_alamat as D', 'C.id_alamat=D.id');
        $query = $this->db->join('anggota_keluarga_detail as E', 'A.anggota_id=E.anggota_id');
        $query = $this->db->join('p_koperasi_aturan as F', 'A.aturan_id=F.id');
        $query = $this->db->join('sistem_login as G', 'A.login_id=G.id');
        $query = $this->db->where('A.status_kontrak', 'TERIMA');
        $query = $this->db->order_by('A.id', 'DESC');
        $query = $this->db->get();
        return $query->row_array();
    }
    function nv_angs_mingguan()
    {
        $this->db->select('count(*) as angs_mingguan');
        $this->db->from('nota');
        $this->db->where('produk_id', '121');
        $this->db->where('status_nota !=', 'TERIMA');
        $this->db->where('status_nota !=', 'TOLAK');
        $this->db->where('status_nota !=', 'TERIMA_TUNGGAKAN');
        $query = $this->db->get();
        return $query->row_array();
    }
    function nv_angs_2mingguan()
    {
        $this->db->select('count(*) as angs_2mingguan');
        $this->db->from('nota');
        $this->db->where('produk_id', '122');
        $this->db->where('status_nota !=', 'TERIMA');
        $this->db->where('status_nota !=', 'TOLAK');
        $this->db->where('status_nota !=', 'TERIMA_TUNGGAKAN');
        $query = $this->db->get();
        return $query->row_array();
    }
    function nv_angs_bulanan()
    {
        $this->db->select('count(*) as angs_bulanan');
        $this->db->from('nota');
        $this->db->where('produk_id', '123');
        $this->db->where('status_nota !=', 'TERIMA');
        $this->db->where('status_nota !=', 'TOLAK');
        $this->db->where('status_nota !=', 'TERIMA_TUNGGAKAN');
        $query = $this->db->get();
        return $query->row_array();
    }
    function nv_angs_musiman()
    {
        $this->db->select('count(*) as angs_musiman');
        $this->db->from('nota');
        $this->db->where('produk_id', '124');
        $this->db->where('status_nota !=', 'TERIMA');
        $this->db->where('status_nota !=', 'TOLAK');
        $this->db->where('status_nota !=', 'TERIMA_TUNGGAKAN');
        $query = $this->db->get();
        return $query->row_array();
    }
    function nv_angs_abulanan()
    {
        $this->db->select('count(*) as angs_abulanan');
        $this->db->from('nota');
        $this->db->where('produk_id', '125');
        $this->db->where('status_nota !=', 'TERIMA');
        $this->db->where('status_nota !=', 'TOLAK');
        $this->db->where('status_nota !=', 'TERIMA_TUNGGAKAN');
        $query = $this->db->get();
        return $query->row_array();
    }
    function nv_angs_kbulanan()
    {
        $this->db->select('count(*) as angs_kbulanan');
        $this->db->from('nota');
        $this->db->where('produk_id', '126');
        $this->db->where('status_nota !=', 'TERIMA');
        $this->db->where('status_nota !=', 'TOLAK');
        $this->db->where('status_nota !=', 'TERIMA_TUNGGAKAN');
        $query = $this->db->get();
        return $query->row_array();
    }
}
