<commit_before><?php
if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class Jinvoice extends CI_Controller
{
    private $module = 'jurnal';
    private $controller = 'jinvoice';

    function __construct()
    {
        parent::__construct();
        if (!is_login()) {
            echo "<script>window.location.replace('" . base_url() . "');</script>";
            exit;
        }

        $this->load->model(array(
            'apps_model'
        ));

        $this->load->helper(active_module());
    }

    function load_auth() {
        $this->load->library('module_auth', array('module' => $this->module));
    }

    public function index()
    {
        $this->load_auth();
        if (!$this->module_auth->read) {
            $this->session->set_flashdata('msg_warning', $this->module_auth->msg_read);
            redirect('info');
        }

        $data['current']    = $this->module;
        $data['controller'] = $this->controller;
        $data['apps']       = $this->apps_model->get_active_only();

        $options = array(
            '0' => 'BLM Posting',
            '1' => 'Posted',
        );
        $this->load->view(active_module().'/vjinvoice', $data);
    }

    function grid()
    {
        $proses_id   = $this->uri->segment(4);
        $validasi_id = $this->uri->segment(5);
        $terimatgl = $this->uri->segment(6);
        $terimatgl2 = $this->uri->segment(7);

        $terimatgl = empty($terimatgl) ? date('Y-m-d') : date('Y-m-d', strtotime($terimatgl));
        $terimatgl2 = empty($terimatgl2) ? date('Y-m-d') : date('Y-m-d', strtotime($terimatgl2));


        $this->load->library('Datatables');
        //pad.get_nopd(cu.id, true) as nopd
        $this->datatables->select("s.id, s.nomor_tagihan, s.tanggal_invoice as tanggal, 
            s.nopd nopd, s.nama_op || '/ '|| s.nama_wp as customernm, 
            s.rekening_pokok as rekening_pokok,
            s.pokok as pokok,
            s.rekening_denda as rekening_denda,
            s.denda as denda,
            s.posted as posted
            ", false);
        $this->datatables->from('pad.pad_invoice as s');
        // $this->datatables->join('pad.pad_spt as spt on s.source_id=spt.id');
        // $this->datatables->join('pad.pad_customer_usaha as cu on spt.customer_usaha_id=cu.id');
        // $this->datatables->where("spt.source_nama='pad_spt'");
        
        $this->datatables->rupiah_column('6,8');
        $this->datatables->date_column('2');

        echo $this->datatables->generate();
    }

    function posting() {
      /*<commit_msg>j-invoice<commit_after><?php
if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class Jinvoice extends CI_Controller
{
    private $module = 'jurnal';
    private $controller = 'jinvoice';

    function __construct()
    {
        parent::__construct();
        if (!is_login()) {
            echo "<script>window.location.replace('" . base_url() . "');</script>";
            exit;
        }

        $this->load->model(array(
            'apps_model'
        ));

        $this->load->helper(active_module());
    }

    function load_auth() {
        $this->load->library('module_auth', array('module' => $this->module));
    }

    public function index()
    {
        $this->load_auth();
        if (!$this->module_auth->read) {
            $this->session->set_flashdata('msg_warning', $this->module_auth->msg_read);
            redirect('info');
        }

        $data['current']    = $this->module;
        $data['controller'] = $this->controller;
        $data['apps']       = $this->apps_model->get_active_only();

        $options = array(
            '0' => 'BLM Posting',
            '1' => 'Posted',
        );
        $this->load->view(active_module().'/vjinvoice', $data);
    }

    function grid()
    {
        $proses_id   = $this->uri->segment(4);
        $validasi_id = $this->uri->segment(5);
        $terimatgl = $this->uri->segment(6);
        $terimatgl2 = $this->uri->segment(7);

        $terimatgl = empty($terimatgl) ? date('Y-m-d') : date('Y-m-d', strtotime($terimatgl));
        $terimatgl2 = empty($terimatgl2) ? date('Y-m-d') : date('Y-m-d', strtotime($terimatgl2));


        $this->load->library('Datatables');
        //pad.get_nopd(cu.id, true) as nopd
        $this->datatables->select("s.id, s.nomor_tagihan, s.tanggal_invoice as tanggal, 
            s.nopd nopd, s.nama_op || '/ '|| s.nama_wp as customernm, 
            s.rekening_pokok as rekening_pokok,
            s.pokok as pokok,
            s.rekening_denda as rekening_denda,
            s.denda as denda,
            s.posted as posted
            ", false);
        $this->datatables->from('public.pad_invoice as s');
        // $this->datatables->join('pad.pad_spt as spt on s.source_id=spt.id');
        // $this->datatables->join('pad.pad_customer_usaha as cu on spt.customer_usaha_id=cu.id');
        // $this->datatables->where("spt.source_nama='pad_spt'");
        
        $this->datatables->rupiah_column('6,8');
        $this->datatables->date_column('2');

        echo $this->datatables->generate();
    }

    function posting() {
      /*
{'fraction_non_alphanumeric': 0.17943743937924345, 'fraction_numerical': 0.00504364694471387, 'mean_word_length': 2.2427672955974844, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 105, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3513709', 'n_tokens_mistral': 1770, 'n_tokens_neox': 1737, 'n_words': 264}