function t_target_realisasiGrid_BeforeShowRow(&$sender)
{
    $t_target_realisasiGrid_BeforeShowRow = true;
    $Component =& $sender;
    $Container =& CCGetParentContainer($sender);
    global $t_target_realisasiGrid;
    //Compatibility
    //End t_target_realisasiGrid_BeforeShowRow
    //Custom Code @725-2A29BDB7
    // -------------------------
    // Write your own code here.
    global $selected_id;
    global $t_target_realisasi_jenis_bulanForm;
    // Write your own code here.
    /*if ($selected_id<0) {
     		$selected_id = $Component->DataSource->p_year_period_id->GetValue();
    		}*/
    $img_radio = "<img border=\"0\" src=\"../images/radio.gif\">";
    $Style = $styles[0];
    if ($Component->DataSource->p_finance_period_id->GetValue() == $selected_id) {
        $img_radio = "<img border=\"0\" src=\"../images/radio_s.gif\">";
        $Style = $styles[1];
        $is_show_form = 1;
        $Component->DLink->Parameters = CCRemoveParam($Component->DLink->Parameters, 'p_finance_period_id');
        $t_target_realisasi_jenis_bulanForm->bulan->SetValue($Component->DataSource->bulan->GetValue());
        //$pid = $Component->DataSource->p_year_period_id->GetValue();
        //$Component->p_year_period_id2->SetValue($pid);
    }
    // End Bdr
    if (count($styles)) {
        //$Style = $styles[($Component->RowNumber - 1) % count($styles)];
        if (strlen($Style) && !strpos($Style, "=")) {
            $Style = (strpos($Style, ":") ? 'style="' : 'class="') . $Style . '"';
        }
        $Component->Attributes->SetValue("rowStyle", $Style);
    }
    $Component->DLink->SetValue($img_radio);
    // Bdr
    $target = $Component->DataSource->target_amount->GetValue();
    $realisasi = $Component->DataSource->realisasi_amt->GetValue();
    $penalty = $Component->DataSource->penalty_amt->GetValue();
    $debt = $Component->DataSource->debt_amt->GetValue();
    if (!empty($target)) {
        $percent = number_format(($realisasi + $penalty + $debt) / $target * 100, 2, ".", ",");
    } else {
        $percent = 0;
    }
    $Component->percentage->SetValue("{$percent} %");
    $Component->total_amt->SetValue($realisasi + $penalty + $debt);
    // -------------------------
    //End Custom Code
    //Close t_target_realisasiGrid_BeforeShowRow @2-DFE61ABB
    return $t_target_realisasiGrid_BeforeShowRow;
}
function Task_Buka_BeforeShow(&$sender)
{
    $Task_Buka_BeforeShow = true;
    $Component =& $sender;
    $Container =& CCGetParentContainer($sender);
    global $Task;
    //Compatibility
    //End Task_Buka_BeforeShow
    //Custom Code @128-2A29BDB7
    // -------------------------
    // Write your own code here.
    global $open_iframe;
    global $ais_create_doc;
    global $ais_manual;
    global $auser_id_doc;
    global $auser_id_donor;
    global $auser_id_login;
    global $auser_id_taken;
    global $acurr_ctl_id;
    global $acurr_doc_type_id;
    global $acurr_proc_id;
    global $acurr_doc_id;
    global $acurr_doc_status;
    global $acurr_proc_status;
    global $aprev_ctl_id;
    global $aprev_doc_type_id;
    global $aprev_proc_id;
    global $aprev_doc_id;
    global $ainteractive_msg;
    global $aslot_1;
    global $aslot_2;
    global $aslot_3;
    global $aslot_4;
    global $aslot_5;
    global $profile;
    global $filenm;
    global $paramstr;
    global $openform;
    global $paramtr2;
    global $qs;
    $Task->Buka->Attributes->SetValue("read", "Terima");
    $profile = $Task->PROFILE_TYPE->GetFormattedValue();
    if ($Task->IS_READ->GetFormattedValue() == "Y") {
        $Task->Buka->Attributes->SetValue("read", "Buka");
    }
    $ais_create_doc = "N";
    $ais_manual = "N";
    $auser_id_login = CCGetUserID();
    $auser_id_doc = $Task->P_APP_USER_ID_DONOR->GetFormattedValue();
    $auser_id_donor = $Task->P_APP_USER_ID_DONOR->GetFormattedValue();
    $auser_id_taken = $Task->P_APP_USER_ID_TAKEOVER->GetFormattedValue();
    $acurr_ctl_id = $Task->T_CTL_ID->GetFormattedValue();
    $acurr_doc_type_id = $Task->P_W_DOC_TYPE_ID->GetFormattedValue();
    $acurr_proc_id = $Task->P_W_PROC_ID->GetFormattedValue();
    $acurr_doc_id = $Task->DOC_ID->GetFormattedValue();
    $acurr_doc_status = $Task->DOC_STS->GetFormattedValue();
    $acurr_proc_status = $Task->PROC_STS->GetFormattedValue();
    $aprev_ctl_id = $Task->PREV_CTL_ID->GetFormattedValue();
    $aprev_doc_type_id = $Task->PREV_DOC_TYPE_ID->GetFormattedValue();
    $aprev_proc_id = $Task->PREV_PROC_ID->GetFormattedValue();
    $aprev_doc_id = $Task->PREV_DOC_ID->GetFormattedValue();
    $ainteractive_msg = $Task->MESSAGE->GetFormattedValue();
    $aslot_1 = $Task->SLOT_1->GetFormattedValue();
    $aslot_2 = $Task->SLOT_2->GetFormattedValue();
    $aslot_3 = $Task->SLOT_3->GetFormattedValue();
    $aslot_4 = $Task->SLOT_4->GetFormattedValue();
    $aslot_5 = $Task->SLOT_5->GetFormattedValue();
    if ($profile != "INBOX") {
        $Task->Buka->Attributes->SetValue("read", "View");
    }
    $filenm = $Task->FILENAME->GetFormattedValue();
    if (!strpos($filenm, "?")) {
        $filenm = $filenm . "?buka=yes";
    } else {
        $filenm = $filenm . "buka=yes";
    }
    $paramstr = "&FILENM=" . $Task->FILENAME->GetFormattedValue() . "&CURR_DOC_ID=" . $acurr_doc_id . "&CURR_DOC_TYPE_ID=" . $acurr_doc_type_id . "&CURR_PROC_ID=" . $acurr_proc_id . "&CURR_CTL_ID=" . $acurr_ctl_id . "&USER_ID_DOC=" . $auser_id_doc . "&USER_ID_DONOR=" . $auser_id_donor . "&USER_ID_LOGIN="******"&USER_ID_TAKEN=" . $auser_id_taken . "&IS_CREATE_DOC=" . $ais_create_doc . "&IS_MANUAL=" . $ais_manual . "&CURR_PROC_STATUS=" . $acurr_proc_status . "&CURR_DOC_STATUS=" . $acurr_doc_status . "&PREV_DOC_ID=" . $aprev_doc_id . "&PREV_DOC_TYPE_ID=" . $aprev_doc_type_id . "&PREV_PROC_ID=" . $aprev_proc_id . "&PREV_CTL_ID=" . $aprev_ctl_id . "&SLOT_1=" . $aslot_1 . "&SLOT_2=" . $aslot_2 . "&SLOT_3=" . $aslot_3 . "&SLOT_4=" . $aslot_4 . "&SLOT_5=" . $aslot_5 . "&MESSAGE=" . $ainteractive_msg;
    $openform = $filenm . $paramstr;
    if ($profile == "INBOX") {
        if (CCGetFromGet("IS_TAKEN", "") == "") {
            //--------------------------------------------------------------------
            // PEMBERIAN VARIABEL
            //--------------------------------------------------------------------
            $qs = CCGetQueryString("QueryString", "");
            $qs = CCRemoveParam($qs, "IS_TAKEN");
            $qs = CCRemoveParam($qs, "TAKEN_CTL");
            if ($qs == "") {
                $qs = "?";
            }
            //-------------------------------
            global $FileName;
            $qs = $FileName . "?buka=yes&" . $qs . "&TAKEN_CTL=" . $acurr_ctl_id . "&IS_TAKEN=Y" . $paramstr;
            $openform = "javascript:location.href='" . $qs . "'; return false;";
            $Task->Buka->Attributes->SetValue('taskbuka', $openform);
        } else {
            if (CCGetFromGet("IS_TAKEN", "") != "" && CCGetFromGet("TAKEN_CTL", "") != "") {
                //--------------------------------------------------------------------
                // CALL FUNGSI UPDATE TAKEN DATE DAN IS_READ
                //--------------------------------------------------------------------
                //$dbh = new PDO('pgsql:host=localhost;dbname=sikp_db;port=5444', "sikp", "sikp");
                $dbConn = new clsDBConnSIKP();
                $qs = "begin " . " pack_task_profile.taken_task ( " . CCGetFromGet("TAKEN_CTL", "") . ", '" . CCGetUserLogin() . "'," . (empty($acurr_doc_type_id) ? "null" : $acurr_doc_type_id) . " ); " . "end;";
                //$stmt = $dbh->exec($qs);
                //$dbh = null;
                $dbConn->query($qs);
                $dbh = null;
                //--------------------------------------------------------------------
                // OPEN FORM
                //--------------------------------------------------------------------
                if (CCGetFromGet("TAKEN_CTL", "") == CCGetFromGet("CURR_CTL_ID", "")) {
                    $paramtr2 = "&FILENM=" . CCGetFromGet("FILENM", "") . "&TAKEN_CTL=&IS_TAKEN=" . "&CURR_DOC_ID=" . CCGetFromGet("CURR_DOC_ID", "") . "&CURR_DOC_TYPE_ID=" . CCGetFromGet("CURR_DOC_TYPE_ID", "") . "&CURR_PROC_ID=" . CCGetFromGet("CURR_PROC_ID", "") . "&CURR_CTL_ID=" . CCGetFromGet("CURR_CTL_ID", "") . "&USER_ID_DOC=" . CCGetFromGet("USER_ID_DOC", "") . "&USER_ID_DONOR=" . CCGetFromGet("USER_ID_DONOR", "") . "&USER_ID_LOGIN="******"USER_ID_LOGIN", "") . "&USER_ID_TAKEN=" . CCGetFromGet("USER_ID_TAKEN", "") . "&IS_CREATE_DOC=" . CCGetFromGet("IS_CREATE_DOC", "") . "&IS_MANUAL=" . CCGetFromGet("IS_MANUAL", "") . "&CURR_PROC_STATUS=" . CCGetFromGet("CURR_PROC_STATUS", "") . "&CURR_DOC_STATUS=" . CCGetFromGet("CURR_DOC_STATUS", "") . "&PREV_DOC_ID=" . CCGetFromGet("PREV_DOC_ID", "") . "&PREV_DOC_TYPE_ID=" . CCGetFromGet("PREV_DOC_TYPE_ID", "") . "&PREV_PROC_ID=" . CCGetFromGet("PREV_PROC_ID", "") . "&PREV_CTL_ID=" . CCGetFromGet("PREV_CTL_ID", "") . "&SLOT_1=" . CCGetFromGet("SLOT_1", "") . "&SLOT_2=" . CCGetFromGet("SLOT_2", "") . "&SLOT_3=" . CCGetFromGet("SLOT_3", "") . "&SLOT_4=" . CCGetFromGet("SLOT_4", "") . "&SLOT_5=" . CCGetFromGet("SLOT_5", "") . "&MESSAGE=" . CCGetFromGet("MESSAGE", "");
                    $filenm = CCGetFromGet("FILENM", "");
                    if ($filenm != "") {
                        if (!strpos($filenm, "?")) {
                            $filenm = $filenm . "?buka=yes";
                        } else {
                            $filenm = $filenm . "buka=yes";
                        }
                        $openform = $filenm . $paramtr2;
                        echo "<script language='javascript'>";
                        echo "location.href='" . $openform . "';";
                        echo "</script>";
                        exit;
                        return;
                    } else {
                        echo "Form tidak ditemukan!";
                        die;
                    }
                }
            } else {
                $openform = "javascript:alert('Error open form'); return false;";
                $Task->Buka->Attributes->SetValue('taskbuka', $openform);
            }
        }
    } else {
        $openform = $openform . "&TAKEN_CTL=&IS_TAKEN=&IS_VIEW_ONLY=Y";
        //$openform =  "javascript:view_task('" . $openform . "'); return false;" ;
        $openform = "javascript:location.href='" . $openform . "'; return false;";
        $Task->Buka->Attributes->SetValue('taskbuka', $openform);
    }
    // -------------------------
    //End Custom Code
    //Close Task_Buka_BeforeShow @58-D8913CA3
    return $Task_Buka_BeforeShow;
}
function Page_OnInitializeView(&$sender)
{
    $Page_OnInitializeView = true;
    $Component =& $sender;
    $Container =& CCGetParentContainer($sender);
    global $t_bphtb_restitution_list;
    //Compatibility
    //End Page_OnInitializeView
    //Custom Code @66-2A29BDB7
    // -------------------------
    // Write your own code here.
    $submitted = CCGetFromGet('submit');
    $url = CCGetQueryString('QueryString', '');
    if ($submitted) {
        $dbConn = new clsDBConnSIKP();
        $sql = "select count(*) as jml from t_product_order_control where doc_id = " . CCGetFromGet('t_customer_order_id') . "and p_w_doc_type_id = 510";
        $dbConn->query($sql);
        $jumlah_data;
        if ($dbConn->next_record()) {
            $jumlah_data = $dbConn->f('jml');
        }
        if ($jumlah_data == 0) {
            $sql = "select sikp.f_first_submit_engine(510," . CCGetFromGet('t_customer_order_id') . ",'" . CCGetSession('UserLogin') . "')";
            $dbConn->query($sql);
            if ($dbConn->next_record()) {
                $hasil = $dbConn->f('f_first_submit_engine');
                echo "\r\n\t\t\t\t\t<script>\r\n\t\t\t\t\t\talert('" . $hasil . "');\r\n\t\t\t\t\t</script>\r\n\t\t\t\t";
            }
        } else {
            echo "\r\n\t\t\t\t<script>\r\n\t\t\t\t\talert('Data Restitusi Sudah Tersubmit');\r\n\t\t\t\t</script>\r\n\t\t\t";
        }
        $dbConn->close();
        $url = CCRemoveParam($url, 'submit');
        $url = CCRemoveParam($url, 't_bphtb_restitusi_id');
        $url = CCRemoveParam($url, 't_customer_order_id');
        echo "\r\n\t\t\t\t<script>\r\n\t\t\t\t\tlocation.href='t_bphtb_restitution_list.php?" . $url . "';\r\n\t\t\t\t</script>\r\n\t\t\t";
        exit;
    }
    global $selected_id;
    $selected_id = -1;
    $selected_id = CCGetFromGet("t_bphtb_registration_id", $selected_id);
    // -------------------------
    //End Custom Code
    //Close Page_OnInitializeView @1-81DF8332
    return $Page_OnInitializeView;
}
function V_SUBMITTER_Button_Back_OnClick(&$sender)
{
    $V_SUBMITTER_Button_Back_OnClick = true;
    $Component =& $sender;
    $Container =& CCGetParentContainer($sender);
    global $V_SUBMITTER;
    //Compatibility
    //End V_SUBMITTER_Button_Back_OnClick
    //Custom Code @148-2A29BDB7
    // -------------------------
    // Write your own code here.
    global $ais_create_doc;
    global $ais_manual;
    global $auser_id_doc;
    global $auser_id_donor;
    global $auser_id_login;
    global $auser_id_taken;
    global $acurr_ctl_id;
    global $acurr_doc_type_id;
    global $acurr_proc_id;
    global $acurr_doc_id;
    global $acurr_doc_status;
    global $acurr_proc_status;
    global $aprev_ctl_id;
    global $aprev_doc_type_id;
    global $aprev_proc_id;
    global $aprev_doc_id;
    global $ainteractive_msg;
    global $aslot_1;
    global $aslot_2;
    global $aslot_3;
    global $aslot_4;
    global $aslot_5;
    global $o_submitter_id;
    global $o_error_message;
    global $o_result_msg;
    global $o_warning;
    $o_submitter_id = null;
    $o_error_message = "";
    $o_result_msg = "";
    $o_warning = "";
    $btn_call = CCGetFromGet("execute", "");
    if (empty($btn_call)) {
        $ais_create_doc = "'" . CCGetFromGet("IS_CREATE_DOC", "N") . "'";
        $ais_manual = "'" . CCGetFromGet("IS_MANUAL", "N") . "'";
        $auser_id_doc = CCGetFromGet("USER_ID_DOC", "null");
        $auser_id_doc = empty($auser_id_doc) ? "null" : $auser_id_doc;
        $auser_id_donor = CCGetFromGet("USER_ID_DONOR", "null");
        $auser_id_donor = empty($auser_id_donor) ? "null" : $auser_id_donor;
        $auser_id_login = CCGetUserID();
        $auser_id_taken = CCGetFromGet("USER_ID_TAKEN", "null");
        if ($auser_id_taken == "null") {
            $auser_id_taken = $auser_id_login;
        }
        $acurr_ctl_id = CCGetFromGet("CURR_CTL_ID", "null");
        $acurr_ctl_id = empty($acurr_ctl_id) ? "null" : $acurr_ctl_id;
        $acurr_doc_type_id = CCGetFromGet("CURR_DOC_TYPE_ID", "null");
        $acurr_doc_type_id = empty($acurr_doc_type_id) ? "null" : $acurr_doc_type_id;
        $acurr_proc_id = CCGetFromGet("CURR_PROC_ID", "null");
        $acurr_proc_id = empty($acurr_proc_id) ? "null" : $acurr_proc_id;
        $acurr_doc_id = CCGetFromGet("CURR_DOC_ID", "null");
        $acurr_doc_id = empty($acurr_doc_id) ? "null" : $acurr_doc_id;
        $acurr_doc_status = CCGetFromGet("CURR_DOC_STATUS", "null");
        $acurr_doc_status = $acurr_doc_status == "null" ? "null" : "'" . $acurr_doc_status . "'";
        $acurr_proc_status = CCGetFromGet("CURR_PROC_STATUS", "0");
        $acurr_proc_status = $acurr_proc_status == "null" ? "null" : "'" . $acurr_proc_status . "'";
        $aprev_ctl_id = CCGetFromGet("PREV_CTL_ID", "null");
        $aprev_ctl_id = empty($aprev_ctl_id) ? "null" : $aprev_ctl_id;
        $aprev_doc_type_id = CCGetFromGet("PREV_DOC_TYPE_ID", "null");
        $aprev_doc_type_id = empty($aprev_doc_type_id) ? "null" : $aprev_doc_type_id;
        $aprev_proc_id = CCGetFromGet("PREV_PROC_ID", "null");
        $aprev_proc_id = empty($aprev_proc_id) ? "null" : $aprev_proc_id;
        $aprev_doc_id = CCGetFromGet("PREV_DOC_ID", "null");
        $aprev_doc_id = empty($aprev_doc_id) ? "null" : $aprev_doc_id;
        $ainteractive_msg = $V_SUBMITTER->INTERACTIVE_MESSAGE->GetValue();
        $ainteractive_msg = empty($ainteractive_msg) ? "null" : "'" . $ainteractive_msg . "'";
        $aslot_1 = CCGetFromGet("SLOT_1", "null");
        $aslot_1 = $aslot_1 == "null" ? "null" : "'" . $aslot_1 . "'";
        $aslot_2 = CCGetFromGet("SLOT_2", "null");
        $aslot_2 = $aslot_2 == "null" ? "null" : "'" . $aslot_2 . "'";
        $aslot_3 = CCGetFromGet("SLOT_3", "null");
        $aslot_3 = $aslot_3 == "null" ? "null" : "'" . $aslot_3 . "'";
        $aslot_4 = CCGetFromGet("SLOT_4", "null");
        $aslot_4 = $aslot_4 == "null" ? "null" : "'" . $aslot_4 . "'";
        $aslot_5 = CCGetFromGet("SLOT_5", "null");
        $aslot_5 = $aslot_ == "null" ? "null" : "'" . $aslot_5 . "'";
        $submit = $o_submitter_id;
        $dbConn = new clsDBConnSIKP();
        $SeQuery = "select seq_submitter_id.nextval as seq from dual";
        $dbConn->query($SeQuery);
        while ($dbConn->next_record()) {
            $o_submitter_id = $dbConn->f("seq");
        }
        $s = "begin " . "pack_workflow_mpd.back_engine(" . $o_submitter_id . ", " . $ais_create_doc . ", " . $ais_manual . ", " . $auser_id_doc . ", " . $auser_id_donor . ", " . $auser_id_login . ", " . $auser_id_taken . ", " . $acurr_ctl_id . ", " . $acurr_doc_type_id . ", " . $acurr_proc_id . ", " . $acurr_doc_id . ", " . $acurr_doc_status . ", " . $acurr_proc_status . ", " . $aprev_ctl_id . ", " . $aprev_doc_type_id . ", " . $aprev_proc_id . ", " . $aprev_doc_id . ", " . $ainteractive_msg . ", " . $aslot_1 . ", " . $aslot_2 . ", " . $aslot_3 . ", " . $aslot_4 . ", " . $aslot_5 . "); end;";
        //die($s);
        $dbConn->query($s);
        $arr = "";
        if (empty($arr)) {
            $errQuery = "select error_message, return_message, warning from submitter where submitter_id = " . $o_submitter_id;
            $dbConn->query($errQuery);
            while ($dbConn->next_record()) {
                $o_error_message = $dbConn->f("error_message");
                $o_result_msg = $dbConn->f("return_message");
                $o_warning = $dbConn->f("warning");
            }
        } else {
            print_r($arr);
        }
        $V_SUBMITTER->SUBMITTER_ID->SetValue($o_submitter_id);
        $V_SUBMITTER->ERROR_MESSAGE->SetValue($o_error_message);
        $V_SUBMITTER->RETURN_MESSAGE->SetValue($o_result_msg);
        $V_SUBMITTER->WARNING->SetValue($o_warning);
        if ($V_SUBMITTER->RETURN_MESSAGE->GetValue() != "0") {
            global $redirectloader;
            if (CCGetFromGet("CURR_PROC_ID", "") == "1") {
                $redirectloader = "../workflow/workflow_summary.php?ELEMENT_ID=" . "10" . CCGetFromGet("CURR_DOC_TYPE_ID", NULL) . "0" . "2" . "0" . $auser_id_login . "&P_W_DOC_TYPE_ID=" . CCGetFromGet("CURR_DOC_TYPE_ID", NULL) . "&P_W_PROC_ID=" . "2" . "&PROFILE_TYPE=INBOX&P_APP_USER_ID=" . $auser_id_login . "&sumworkflowDir=Asc&sumworkflowPageSize=50";
            } else {
                $redirectloader = "../workflow/workflow_summary.php?ELEMENT_ID=" . "20" . CCGetFromGet("CURR_DOC_TYPE_ID", NULL) . "0" . CCGetFromGet("CURR_PROC_ID", NULL) . "0" . $auser_id_login . "&P_W_DOC_TYPE_ID=" . CCGetFromGet("CURR_DOC_TYPE_ID", NULL) . "&P_W_PROC_ID=" . CCGetFromGet("CURR_PROC_ID", NULL) . "&PROFILE_TYPE=OUTBOX&P_APP_USER_ID=" . $auser_id_login . "&sumworkflowDir=Asc&sumworkflowPageSize=50";
            }
            // refresh parent by javascript
            echo "<script language='javascript'>";
            echo " parent.window.opener.location.href = '" . $redirectloader . "';";
            echo "</script>";
        }
        // end  refresh background summary inbox
        // redirect for new $o_submitter_id
        //global $qs;
        $qs = CCGetQueryString("QueryString", "");
        $qs = CCRemoveParam($qs, "submitter_id");
        $qs = CCRemoveParam($qs, "Button_Submit");
        $qs = CCAddParam($qs, "submitter_id", $o_submitter_id);
        $qs = CCAddParam($qs, "ERROR_MESSAGE", $o_error_message);
        $qs = CCAddParam($qs, "RETURN_MESSAGE", $o_result_msg);
        $qs = CCAddParam($qs, "WARNING", $o_warning);
        $qs = CCAddParam($qs, "execute", "1");
        global $FileName;
        $qs = $FileName . "?" . $qs;
        echo "<script language='javascript'>";
        echo "location.href='" . $qs . "';";
        echo "</script>";
        exit;
        return;
    }
    // -------------------------
    //End Custom Code
    //Close V_SUBMITTER_Button_Back_OnClick @147-8D710DBF
    return $V_SUBMITTER_Button_Back_OnClick;
}