<?php

namespace App\Controllers\Operator;

use App\Controllers\BaseController;

use App\Models\Kkmodel;
use App\Models\Kolektormodel;
use App\Models\Operatormodel;
use App\Models\Tarifmodel;
use App\Models\Diskonmodel;
use App\Models\Invoicemodel;
use App\Models\Strukmodel;
use App\Models\Strukdetailmodel;
use App\Models\Transaksimodel;

class Home extends BaseController
{
    public function index()
    {
        $user_data = service("user_data");
        $data['user'] = $user_data->data;
        
        $transaksimodel = new Transaksimodel();

        $data['total_transaksi_completed'] = $transaksimodel->getTotalTransaksiCompleted();
        $data['total_transaksi_draft'] = $transaksimodel->getTotalTransaksiDraft();
        $data['total_transaksi_pending'] = $transaksimodel->getTotalTransaksiPending();
        $data['total_transaksi_canceled'] = $transaksimodel->getTotalTransaksiCanceled();
        $data['total_transaksi'] =  $data['total_transaksi_completed'] + $data['total_transaksi_draft'] + $data['total_transaksi_pending'] + $data['total_transaksi_canceled'];

        $data['total_penerimaan'] = $transaksimodel->getTotalPenerimaan();
        $data['total_tunggakan'] = $transaksimodel->getTotalTunggakan();

        $invoicemodel = new Invoicemodel();
        $data['total_invoice_open'] = $invoicemodel->getTotalOpen();
        $data['total_invoice_closed'] = $invoicemodel->getTotalClosed();
        return view('operator/home',$data);
    }
}
