<?php
/*
Generated by OutputBooks Team
*/

defined("\102\101\x53\x45\120\x41\x54\x48") or exit("\x4e\157\x20\144\x69\x72\x65\x63\164\40\163\143\x72\x69\x70\164\x20\x61\x63\x63\x65\x73\163\x20\141\154\x6c\157\x77\145\x64");
class Oboanalysis extends ReportParent_Controller
{
    public function __construct()
    {
        parent::__construct();
    }
    public function get_list()
    {
        goto LRUjU;
        tiYeX:
        $keywords = $this->config->item("\141\x63\143\x6f\x75\x6e\164\x5f\153\145\x79\x77\x6f\162\144\163");
        goto enJQs;
        e98tN:
        if (!empty($suggestions)) {
            $this->response->set_data($suggestions);
        }
        goto PT9QV;
        M3jRj:
        NX03d:
        goto eO2OK;
        LxcHv:
        $this->load->config("\x70\x6c\137\153\145\x79\x77\157\162\x64\163");
        goto tiYeX;
        jmcMA:
        $data = $this->request->post();
        goto V9JKW;
        iALsV:
        if (isset($data["\x62\x72\x61\156\143\x68"]) && $data["\142\x72\x61\x6e\143\x68"] == -1) {
            goto MtFkD;
            anWlC:
            $old_data = $this->shiftDateRangeBackAuto($data);
            goto gNk6r;
            gNk6r:
            $previous_data = $this->BalancesheetModel->get_bs_tb("\102", $old_data);
            goto ViNEC;
            EMSGa:
            $balancesheetdata = $this->BalancesheetModel->get_bs_tb("\102", $baldata);
            goto ZidLE;
            fR1eW:
            $previous_bal_data = null;
            goto anWlC;
            ZidLE:
            $current_bal_data = $this->OboanalysisModel->analyze_json("\x42", $balancesheetdata["\151\164\x65\x6d\x73"], $keywords);
            goto fR1eW;
            mHLeG:
            $balsuggestions = $this->OboanalysisModel->generate_bal_suggestions($data, $current_bal_data, $previous_bal_data, $current_metrics, $previous_metrics);
            goto w6BZZ;
            MtFkD:
            $data["\x74\171\x70\145"] = "\102";
            goto VhfGn;
            ViNEC:
            if (!empty($previous_data) && !empty($previous_data["\x69\x74\x65\x6d\163"])) {
                if (isset($previous_data["\x69\x74\145\x6d\163"])) {
                    $previous_bal_data = $this->OboanalysisModel->analyze_json("\102", $previous_data["\151\164\145\x6d\163"], $keywords);
                }
            }
            goto mHLeG;
            w6BZZ:
            if (!empty($balsuggestions)) {
                foreach ($balsuggestions as $val) {
                    $suggestions[] = $val;
                    JjQ15:
                }
                gwcIo:
            }
            goto ktlSR;
            VhfGn:
            $baldata = $data;
            goto EMSGa;
            ktlSR:
        }
        goto e98tN;
        ol93B:
        $data["\151\x73\x44\145\x74\141\151\154"] = false;
        goto a6VO2;
        a6VO2:
        $data["\142\162\141\156\x63\150"] = isset($data["\x62\162\141\x6e\x63\150"]) ? $data["\142\162\x61\x6e\143\x68"] : '';
        goto XWU8o;
        enJQs:
        $this->load->model("\x72\x65\160\x6f\162\164\57\x42\141\x6c\141\x6e\143\145\163\150\x65\x65\x74\x4d\x6f\x64\145\154", "\x42\x61\154\141\156\x63\145\163\150\x65\145\x74\x4d\157\144\x65\154");
        goto foiw2;
        hEKT1:
        $current_data = $this->BalancesheetModel->get_bs_tb("\x50", $data);
        goto PpGQl;
        V9JKW:
        $this->load->helper("\146\151\154\145");
        goto LxcHv;
        LRUjU:
        $current_bal_data = [];
        goto jmcMA;
        Ev8Rk:
        $old_data["\x67\162\x6f\x75\x70\x56\x69\x65\x77"] = false;
        goto m6S7V;
        foiw2:
        $data["\x64\x75\141\x6c\126\x69\x65\167"] = false;
        goto MuC54;
        m6S7V:
        $old_data["\151\x73\104\145\x74\141\151\x6c"] = false;
        goto y3IWv;
        PT9QV:
        $this->response->write();
        goto lNJlI;
        XWU8o:
        switch ($data["\146\151\154\x74\145\x72"]) {
            case "\x54\106\131":
                goto MDNPU;
                yud0Q:
                $data["\x64\141\164\145\x73"] = ["\x66\162\157\x6d\x5f\144\x61\164\145" => $from_date, "\164\x6f\137\x64\x61\x74\x65" => $cur_date];
                goto xgDQK;
                rNHIv:
                $data["\146\x72\x6f\155\137\x64\141\164\x65"] = $from_date;
                goto fPsMd;
                xgDQK:
                goto OzCol;
                goto ucIn0;
                JLPh6:
                get_financial_dates($cur_date, $from_date, $finish_date);
                goto rNHIv;
                fPsMd:
                $data["\164\x6f\x5f\x64\x61\164\145"] = $cur_date;
                goto yud0Q;
                MDNPU:
                $from_date = $finish_date = $cur_date = gmdate("\x59\55\x6d\55\x64");
                goto JLPh6;
                ucIn0:
            case "\x4c\x46\131":
                goto aDCfY;
                bppvl:
                $data["\146\162\157\155\137\144\x61\164\145"] = $from_date;
                goto SoL42;
                IxK8O:
                goto OzCol;
                goto DEZPY;
                XLSxJ:
                get_financial_dates($cur_date, $from_date, $finish_date);
                goto tPp89;
                tPp89:
                $from_date = date("\131\55\155\x2d\x64", strtotime("\55\x31\x20\171\x65\141\162", strtotime($from_date)));
                goto A1SXL;
                aDCfY:
                $from_date = $finish_date = $cur_date = gmdate("\x59\55\x6d\x2d\144");
                goto XLSxJ;
                srmEW:
                $cur_date = $finish_date;
                goto bppvl;
                SoL42:
                $data["\x74\157\137\144\x61\164\x65"] = $cur_date;
                goto Ut6h8;
                A1SXL:
                $finish_date = date("\x59\55\x6d\x2d\x64", strtotime("\55\61\40\171\x65\141\x72", strtotime($finish_date)));
                goto srmEW;
                Ut6h8:
                $data["\x64\141\164\x65\x73"] = ["\x66\x72\x6f\x6d\x5f\x64\141\x74\145" => $from_date, "\164\157\x5f\x64\x61\x74\145" => $cur_date];
                goto IxK8O;
                DEZPY:
        }
        goto M3jRj;
        MuC54:
        $data["\x74\x79\x70\145"] = "\120";
        goto LoayS;
        LoayS:
        $data["\147\x72\x6f\x75\x70\x56\x69\145\x77"] = false;
        goto ol93B;
        gHxFq:
        if (!empty($previous_data) && !empty($previous_data["\x69\x74\145\155\163"])) {
            if (isset($previous_data["\151\164\145\155\163"])) {
                $previous_metrics = $this->OboanalysisModel->analyze_json("\120", $previous_data["\x69\164\145\155\x73"], $keywords);
            }
        }
        goto xtoHs;
        y3IWv:
        $old_data["\164\171\x70\145"] = "\120";
        goto TW_7V;
        vUU8Z:
        $previous_metrics = null;
        goto xqOlp;
        xtoHs:
        $suggestions = $this->OboanalysisModel->generate_suggestions($data, $old_data, $current_metrics, $previous_metrics, $current_bal_data);
        goto iALsV;
        vhmGu:
        $current_metrics = $this->OboanalysisModel->analyze_json("\x50", $current_data["\x69\164\x65\155\163"], $keywords);
        goto vUU8Z;
        PpGQl:
        $this->load->model("\162\x65\160\157\x72\x74\57\117\x62\x6f\141\x6e\x61\154\x79\x73\151\163\115\157\x64\x65\x6c", "\x4f\x62\157\141\x6e\x61\x6c\171\163\x69\163\x4d\157\x64\145\x6c");
        goto vhmGu;
        xqOlp:
        $old_data = $this->shiftDateRangeBackAuto($data);
        goto Ev8Rk;
        eO2OK:
        OzCol:
        goto hEKT1;
        TW_7V:
        $previous_data = $this->BalancesheetModel->get_bs_tb("\x50", $old_data);
        goto gHxFq;
        lNJlI:
        return true;
        goto s2XQ_;
        s2XQ_:
    }
    function shiftDateRangeBackAuto($post_data)
    {
        goto Q1g0t;
        PWF7m:
        $to_ts = strtotime($post_data["\x74\x6f\137\144\141\164\x65"]);
        goto Ey73i;
        Ey73i:
        $fiscal_start_month = (int) get_company("\x66\x79\x53\164\x61\162\164");
        goto xsLKg;
        uPaMG:
        $prev_from = null;
        goto omAyH;
        mcMMx:
        $post_data["\x66\162\157\x6d\137\144\141\x74\x65"] = $post_data["\144\x61\164\x65\x73"][0]["\x66\162\x6f\x6d\137\144\x61\164\145"];
        goto eUTtI;
        eUTtI:
        $post_data["\x74\157\137\x64\x61\x74\x65"] = $post_data["\144\x61\164\145\163"][0]["\x74\157\x5f\x64\141\164\145"];
        goto pb65j;
        HC7JB:
        $fy_end_ts = strtotime("\55\x31\x20\144\x61\171", strtotime("\53\61\40\x79\145\x61\x72", $fy_start_ts));
        goto uPaMG;
        xsLKg:
        $from_month = (int) date("\155", $from_ts);
        goto pOP1C;
        pOP1C:
        $from_year = (int) date("\131", $from_ts);
        goto R2CLg;
        R2CLg:
        $to_year = (int) date("\x59", $to_ts);
        goto zb1Uo;
        pb65j:
        return $post_data;
        goto t5xlk;
        xWwfZ:
        $fy_start_ts = strtotime(sprintf("\45\60\64\144\55\45\60\62\x64\x2d\60\x31", $fy_start_year, $fiscal_start_month));
        goto HC7JB;
        omAyH:
        $prev_to = null;
        goto OnKNh;
        OnKNh:
        if (date("\131\55\x6d\x2d\x64", $from_ts) == date("\x59\x2d\x6d\55\x64", $fy_start_ts) && date("\131\x2d\155\55\144", $to_ts) == date("\131\55\155\x2d\144", $fy_end_ts)) {
            $prev_from = strtotime(sprintf("\x25\x30\x34\x64\x2d\45\60\x32\144\55\60\x31", $fy_start_year - 1, $fiscal_start_month));
            $prev_to = strtotime("\55\x31\40\x64\x61\171", strtotime("\x2b\x31\40\171\145\141\x72", $prev_from));
        } elseif ($from_ts >= $fy_start_ts && $to_ts <= $fy_end_ts) {
            goto FsLgS;
            wiFm7:
            $prev_from = strtotime("\x2d\x31\40\x79\145\x61\x72", $from_ts);
            goto bSDFE;
            FsLgS:
            $diff_days = floor(($to_ts - $from_ts) / (60 * 60 * 24));
            goto wiFm7;
            bSDFE:
            $prev_to = strtotime("\x2b{$diff_days}\40\144\141\171\163", $prev_from);
            goto rdufl;
            rdufl:
        } else {
            goto v3BVB;
            iNijL:
            if (!$is_quarter && !$is_week && $from_day == "\x30\61" && $to_day == $to_month_last_day) {
                $prev_from = strtotime("\146\151\162\x73\164\x20\x64\141\171\x20\x6f\146\40\154\141\x73\164\x20\x6d\157\156\164\x68", $from_ts);
                $prev_to = strtotime("\154\x61\163\x74\40\144\141\x79\x20\x6f\146\x20\x6c\x61\x73\x74\40\x6d\x6f\x6e\164\x68", $from_ts);
            } elseif (!$is_quarter && !$is_week && $from_ts == $to_ts) {
                $prev_from = strtotime("\x2d\61\40\x64\141\171", $from_ts);
                $prev_to = $prev_from;
            } elseif (!$is_quarter && !$is_week && $from_ts >= $fy_start_ts && $to_ts <= $fy_end_ts) {
                $prev_from = strtotime(sprintf("\45\60\64\144\x2d\45\60\x32\144\x2d\x30\x31", $fy_start_year - 1, $fiscal_start_month));
                $prev_to = strtotime("\x2d\x31\40\144\x61\171", strtotime("\x2b\61\x20\x79\x65\141\162", $prev_from));
            } else {
                goto C4L4f;
                cm2En:
                $prev_from = strtotime("\x2d" . ($interval_days - 1) . "\x20\144\141\x79\163", $prev_to);
                goto W2pYx;
                sf1oo:
                $prev_to = strtotime("\55\61\40\144\x61\x79", $from_ts);
                goto cm2En;
                C4L4f:
                $interval_days = floor(($to_ts - $from_ts) / (60 * 60 * 24)) + 1;
                goto sf1oo;
                W2pYx:
            }
            goto b6OII;
            v3BVB:
            $quarters = [[1, 3], [4, 6], [7, 9], [10, 12]];
            goto aANN5;
            narPo:
            fbynH:
            goto Rseiu;
            qvzsF:
            $to_day = date("\144", $to_ts);
            goto o8wpL;
            Rseiu:
            $is_week = false;
            goto q01gq;
            q01gq:
            if (!$is_quarter && ($to_ts - $from_ts) / (60 * 60 * 24) == 6) {
                goto R21wp;
                mMHp2:
                $prev_from = strtotime("\x2d\66\x20\x64\x61\171\163", $prev_to);
                goto XN1C6;
                R21wp:
                $prev_to = strtotime("\x2d\61\40\x64\x61\171", $from_ts);
                goto mMHp2;
                XN1C6:
                $is_week = true;
                goto I7XoE;
                I7XoE:
            }
            goto yHKv_;
            o8wpL:
            $to_month_last_day = date("\164", $to_ts);
            goto iNijL;
            anBnC:
            foreach ($quarters as $q) {
                goto ciXYL;
                T2UWf:
                $q_end = strtotime("\154\x61\163\x74\x20\144\141\x79\40\157\x66", strtotime(sprintf("\x25\60\64\144\x2d\x25\60\62\x64\55\60\61", $q_year, $end_month)));
                goto O4g9p;
                EGKDG:
                $q_year = $from_year;
                goto ieWYi;
                GCTJU:
                $q_start = strtotime(sprintf("\45\60\64\x64\55\x25\60\62\144\55\60\61", $q_year, $start_month));
                goto T2UWf;
                m8mp9:
                zdpoY:
                goto ZVa03;
                ieWYi:
                if ($from_month < $start_month) {
                    $q_year--;
                }
                goto GCTJU;
                ciXYL:
                list($start_month, $end_month) = $q;
                goto EGKDG;
                O4g9p:
                if (date("\131\55\155\55\x64", $from_ts) == date("\131\x2d\x6d\x2d\144", $q_start) && date("\131\55\155\x2d\144", $to_ts) == date("\131\55\x6d\x2d\x64", $q_end)) {
                    goto PjDsz;
                    AS3KE:
                    goto fbynH;
                    goto rCkCc;
                    PjDsz:
                    $prev_from = strtotime("\55\x33\40\x6d\x6f\156\x74\150\163", $q_start);
                    goto tXWm0;
                    Jfszv:
                    $is_quarter = true;
                    goto AS3KE;
                    tXWm0:
                    $prev_to = strtotime("\x6c\x61\x73\164\40\144\x61\x79\40\157\146", strtotime("\53\x32\40\155\x6f\156\164\x68\x73", $prev_from));
                    goto Jfszv;
                    rCkCc:
                }
                goto m8mp9;
                ZVa03:
            }
            goto narPo;
            aANN5:
            $is_quarter = false;
            goto anBnC;
            yHKv_:
            $from_day = date("\144", $from_ts);
            goto qvzsF;
            b6OII:
        }
        goto k0otv;
        k0otv:
        $post_data["\144\141\164\x65\163"] = [["\x66\162\157\x6d\x5f\144\141\164\145" => date("\131\x2d\155\55\144", $prev_from), "\x74\157\137\144\x61\164\x65" => date("\131\55\155\x2d\144", $prev_to)]];
        goto mcMMx;
        zb1Uo:
        $fy_start_year = $from_month < $fiscal_start_month ? $from_year - 1 : $from_year;
        goto xWwfZ;
        Q1g0t:
        $from_ts = strtotime($post_data["\x66\162\157\x6d\x5f\x64\141\164\145"]);
        goto PWF7m;
        t5xlk:
    }
    public function get_sec_list()
    {
        goto A3B_3;
        QXKcO:
        $this->load->model("\162\145\x70\157\162\x74\57\117\x62\x6f\141\x6e\x61\154\171\163\151\x73\115\157\x64\145\154", "\x4f\142\157\141\x6e\x61\x6c\171\163\x69\163\115\157\144\x65\154");
        goto frkJk;
        frkJk:
        $sec_audit = $this->OboanalysisModel->security_audit_data($data);
        goto Mw0xO;
        A3B_3:
        $data = $this->request->post();
        goto QXKcO;
        CYoQC:
        $this->response->write();
        goto Flg8d;
        Mw0xO:
        if (!empty($sec_audit)) {
            $this->response->set_data($sec_audit);
        }
        goto CYoQC;
        Flg8d:
        return true;
        goto VVW04;
        VVW04:
    }
}
