Exemplo n.º 1
0
<?php

include 'function_DB.php';
$pp_tkh_jkp = date("Y-m-d", strtotime($_POST['dateJKP']));
$checkNewExist = $_POST['checkNewExist'];
$statusJKPapproval = $_POST['statusJKPapproval'];
if ($checkNewExist == "newMeet") {
    $sql = "INSERT INTO p_jkp_meeting_numbers(pjkmn_active,pjkmn_no_myskt,pjkmn_tkh_myskt,pjkmn_tkh_upd)\n\t\tVALUES (1," . $_POST['mNo'] . ",'" . date("Y-m-d H:i:s") . "','" . date("Y-m-d H:i:s") . "')";
    $meetingNo = insupdelQuery($sql);
    $sqlQuery = "UPDATE p_product SET pp_rs_kod = {$statusJKPapproval},pp_reasses_JKP_SKR = 0,pp_tkh_jkp='" . $pp_tkh_jkp . "',pp_jkp_no = '" . $_POST['mNo'] . "' WHERE pp_kod IN(" . rtrim($_POST['ids'], ',') . ")";
    insupdelQuery($sqlQuery);
} else {
    $sqlQuery = "UPDATE p_product SET pp_rs_kod = {$statusJKPapproval},pp_reasses_JKP_SKR = 0,pp_tkh_jkp='" . $pp_tkh_jkp . "',pp_jkp_no = '" . $_POST['mNo'] . "' WHERE pp_kod IN(" . rtrim($_POST['ids'], ',') . ")";
    insupdelQuery($sqlQuery);
}
Exemplo n.º 2
0
<?php

include 'function_DB.php';
$sql = "UPDATE p_product SET p_product.pp_status_nopayment = 1 WHERE p_product.pp_kod = " . $_POST['ppID'];
$ret = insupdelQuery($sql);
echo $ret;
Exemplo n.º 3
0
function evalPPAutoApproveReject($approveReject)
{
    $result = selectQuery("SELECT pp_rs_kod_lab,pp_rs_kod_api,pp_rs_kod_product\n\t FROM p_product WHERE pp_kod = " . $_SESSION['product_reg']['ppID'], 1);
    if ($result) {
        if (isset($result) && isset($result["pp_rs_kod_lab"]) && isset($result["pp_rs_kod_api"]) && isset($result["pp_rs_kod_product"])) {
            $pp_rs_kod = 0;
            if ($approveReject == "APPROVE") {
                if ($_SESSION['department'] == 'LAB') {
                    if (!is_null($result["pp_rs_kod_api"]) && !is_null($result["pp_rs_kod_product"]) && $result["pp_rs_kod_api"] == 1111 && $result["pp_rs_kod_product"] == 1111) {
                        $pp_rs_kod = 1111;
                    } else {
                        if (!is_null($result["pp_rs_kod_api"]) && !is_null($result["pp_rs_kod_product"]) && ($result["pp_rs_kod_api"] == 1112 || $result["pp_rs_kod_product"] == 1112)) {
                            $pp_rs_kod = 1112;
                        }
                    }
                } else {
                    if ($_SESSION['department'] == 'API') {
                        if (!is_null($result["pp_rs_kod_lab"]) && !is_null($result["pp_rs_kod_product"]) && $result["pp_rs_kod_lab"] == 1111 && $result["pp_rs_kod_product"] == 1111) {
                            $pp_rs_kod = 1111;
                        } else {
                            if (!is_null($result["pp_rs_kod_lab"]) && !is_null($result["pp_rs_kod_product"]) && ($result["pp_rs_kod_lab"] == 1112 || $result["pp_rs_kod_product"] == 1112)) {
                                $pp_rs_kod = 1112;
                            }
                        }
                    } else {
                        if ($_SESSION['department'] == 'PRODUCT') {
                            if (!is_null($result["pp_rs_kod_api"]) && !is_null($result["pp_rs_kod_lab"]) && $result["pp_rs_kod_api"] == 1111 && $result["pp_rs_kod_lab"] == 1111) {
                                $pp_rs_kod = 1111;
                            } else {
                                if (!is_null($result["pp_rs_kod_api"]) && !is_null($result["pp_rs_kod_lab"]) && ($result["pp_rs_kod_api"] == 1112 || $result["pp_rs_kod_lab"] == 1112)) {
                                    $pp_rs_kod = 1112;
                                }
                            }
                        }
                    }
                }
            } else {
                if ($approveReject == "REJECT") {
                    if ($_SESSION['department'] == 'LAB') {
                        if (!is_null($result["pp_rs_kod_api"]) && !is_null($result["pp_rs_kod_product"]) && ($result["pp_rs_kod_api"] == 1111 || $result["pp_rs_kod_api"] == 1112) && ($result["pp_rs_kod_product"] == 1111 || $result["pp_rs_kod_product"] == 1112)) {
                            $pp_rs_kod = 1112;
                        }
                    } else {
                        if ($_SESSION['department'] == 'API') {
                            if (!is_null($result["pp_rs_kod_lab"]) && !is_null($result["pp_rs_kod_product"]) && ($result["pp_rs_kod_lab"] == 1111 || $result["pp_rs_kod_lab"] == 1112) && ($result["pp_rs_kod_product"] == 1111 || $result["pp_rs_kod_product"] == 1112)) {
                                $pp_rs_kod = 1112;
                            }
                        } else {
                            if ($_SESSION['department'] == 'PRODUCT') {
                                if (!is_null($result["pp_rs_kod_api"]) && !is_null($result["pp_rs_kod_lab"]) && ($result["pp_rs_kod_lab"] == 1111 || $result["pp_rs_kod_lab"] == 1112) && ($result["pp_rs_kod_api"] == 1111 || $result["pp_rs_kod_api"] == 1112)) {
                                    $pp_rs_kod = 1112;
                                }
                            }
                        }
                    }
                }
            }
            if ($pp_rs_kod) {
                $sqlQueryAuto = "UPDATE p_product SET pp_rs_kod = " . $pp_rs_kod . " WHERE pp_kod = " . $_SESSION['product_reg']['ppID'];
                insupdelQuery($sqlQueryAuto);
            }
        }
    }
}
Exemplo n.º 4
0
<?php

include 'function_DB.php';
$sqlQuery = "UPDATE p_coh_product SET coh_status = " . $_POST['status'] . " WHERE coh_id IN(" . rtrim($_POST['ids'], ',') . ")";
insupdelQuery($sqlQuery);
if (isset($_POST) && isset($_POST["officerId"])) {
    $ppidsArr = explode(",", rtrim($_POST['ids'], ','));
    foreach ($ppidsArr as $currPpid) {
        $pikod = 0;
        $result = selectQuery("SELECT p_inbox.pi_kod as pikod FROM p_inbox \n\t\t\tWHERE p_inbox.pi_pp_kod = " . $currPpid . " AND p_inbox.pi_rlog_id_pp = " . $_POST["officerId"] . " AND p_inbox.pi_active = 1");
        if ($result) {
            if (isset($result) && isset($result["pi_kod"])) {
                $pikod = $result["pi_kod"];
            }
        } else {
            $sql = "INSERT INTO p_inbox (pi_pp_kod,pi_rlog_id_pp,pi_active ) VALUES\n\t\t\t\t ( " . $currPpid . "," . $_POST['officerId'] . ",1 )";
            $ppc_kod = insupdelQuery($sql);
        }
    }
}
Exemplo n.º 5
0
        }
        */
    }
} else {
    $coh_status = 7;
    $sqlQuery = "UPDATE p_coh_product SET coh_status =" . $coh_status . ",coh_updated_at ='" . date("Y-m-d H:i:s") . "' WHERE coh_id IN(" . rtrim($_POST['ids'], ',') . ")";
    insupdelQuery($sqlQuery);
    $dateCOH = date("Y-m-d", strtotime($_POST['dateCOH']));
    $meetingNo = 0;
    if ($_POST['mtngType'] == 1) {
        $sql = "INSERT INTO p_skr_kmesyuarat(pskm_active,pskm_no_msykt,pskm_tkh_msykt,pskm_tkh_upd) \n\t\t\tVALUES (1," . $_POST['mNo'] . ",'" . date("Y-m-d H:i:s") . "','" . date("Y-m-d H:i:s") . "')";
        $meetingNo = insupdelQuery($sql);
    } else {
        $meetingNo = $_POST['mNo'];
    }
    $pcIds = rtrim($_POST['ids'], ',');
    $pc = explode(',', $pcIds);
    foreach ($pc as $cp) {
        $curPpKod = 0;
        $sql1 = "select p_coh_product.coh_pp_kod FROM p_coh_product";
        $sql1 .= " WHERE p_coh_product.coh_id = " . $cp;
        $result = selectQuery($sql1, 1);
        if ($result) {
            if (isset($result) && isset($result["coh_pp_kod"])) {
                $curPpKod = $result["coh_pp_kod"];
            }
        }
        $sqlQuery1 = "UPDATE p_product SET pp_pskm_no_msykt =" . $meetingNo . ",pp_pskm_tkh_msykt ='" . $dateCOH . "' WHERE pp_kod = " . $curPpKod;
        insupdelQuery($sqlQuery1);
    }
}
Exemplo n.º 6
0
function evalPPAutoApproveReject($approveReject, $isLab = null, $pp_kod = null, $categoryId = null, $appeal = null)
{
    $fQPreEvalPPsFinal = false;
    if (is_null($appeal)) {
        $appeal = 0;
    }
    if (!is_null($pp_kod) && $pp_kod) {
        $result = selectQuery("SELECT pp_rs_kod_lab,pp_rs_kod_api,pp_rs_kod_product\n\t\t FROM p_product WHERE pp_kod = " . $pp_kod, 1);
    } else {
        $result = selectQuery("SELECT pp_rs_kod_lab,pp_rs_kod_api,pp_rs_kod_product\n\t\t FROM p_product WHERE pp_kod = " . $_SESSION['product_reg']['ppID'], 1);
    }
    /*
    $result = selectQuery( "SELECT pp_rs_kod_lab,pp_rs_kod_api,pp_rs_kod_product
     FROM p_product WHERE pp_kod = " . $_SESSION['product_reg']['ppID'],1 );
    */
    if ($result) {
        $ppaGoAhead = true;
        if (!isset($result["pp_rs_kod_product"])) {
            $ppaGoAhead = false;
        }
        if (qLaaIsLabApplicable($categoryId) && !isset($result["pp_rs_kod_lab"])) {
            $ppaGoAhead = false;
        }
        if (qLaaIsAPIApplicable($categoryId) && !isset($result["pp_rs_kod_api"])) {
            $ppaGoAhead = false;
        }
        if ($ppaGoAhead) {
            $pp_rs_kod = 0;
            if ($approveReject == "APPROVE") {
                if (!is_null($isLab) && $isLab == 'LAB') {
                    if (qLaaIsLabApplicable($categoryId)) {
                        if (qLaaIsAPIApplicable($categoryId)) {
                            if (!is_null($result["pp_rs_kod_api"]) && !is_null($result["pp_rs_kod_product"]) && $result["pp_rs_kod_api"] == 1111 && $result["pp_rs_kod_product"] == 1111) {
                                $pp_rs_kod = 1111;
                            } else {
                                if (!is_null($result["pp_rs_kod_api"]) && !is_null($result["pp_rs_kod_product"]) && ($result["pp_rs_kod_api"] == 1112 || $result["pp_rs_kod_product"] == 1112)) {
                                    $pp_rs_kod = 1112;
                                }
                            }
                        } else {
                            if (!is_null($result["pp_rs_kod_product"]) && $result["pp_rs_kod_product"] == 1111) {
                                $pp_rs_kod = 1111;
                            } else {
                                if (!is_null($result["pp_rs_kod_product"]) && $result["pp_rs_kod_product"] == 1112) {
                                    $pp_rs_kod = 1112;
                                }
                            }
                        }
                    }
                } else {
                    if ($_SESSION['department'] == 'API') {
                        if (qLaaIsLabApplicable($categoryId)) {
                            if (!is_null($result["pp_rs_kod_lab"]) && !is_null($result["pp_rs_kod_product"]) && $result["pp_rs_kod_lab"] == 1111 && $result["pp_rs_kod_product"] == 1111) {
                                $pp_rs_kod = 1111;
                            } else {
                                if (!is_null($result["pp_rs_kod_lab"]) && !is_null($result["pp_rs_kod_product"]) && ($result["pp_rs_kod_lab"] == 1112 || $result["pp_rs_kod_product"] == 1112)) {
                                    $pp_rs_kod = 1112;
                                }
                            }
                        } else {
                            if (!is_null($result["pp_rs_kod_product"]) && $result["pp_rs_kod_product"] == 1111) {
                                $pp_rs_kod = 1111;
                            } else {
                                if (!is_null($result["pp_rs_kod_product"]) && $result["pp_rs_kod_product"] == 1112) {
                                    $pp_rs_kod = 1112;
                                }
                            }
                        }
                    } else {
                        if ($_SESSION['department'] == 'PRODUCT') {
                            if (qLaaIsLabApplicable($categoryId) && qLaaIsAPIApplicable($categoryId)) {
                                if (!is_null($result["pp_rs_kod_api"]) && !is_null($result["pp_rs_kod_lab"]) && $result["pp_rs_kod_api"] == 1111 && $result["pp_rs_kod_lab"] == 1111) {
                                    $pp_rs_kod = 1111;
                                } else {
                                    if (!is_null($result["pp_rs_kod_api"]) && !is_null($result["pp_rs_kod_lab"]) && ($result["pp_rs_kod_api"] == 1112 || $result["pp_rs_kod_lab"] == 1112)) {
                                        $pp_rs_kod = 1112;
                                    }
                                }
                            } else {
                                if (!qLaaIsLabApplicable($categoryId) && qLaaIsAPIApplicable($categoryId)) {
                                    if (!is_null($result["pp_rs_kod_api"]) && $result["pp_rs_kod_api"] == 1111) {
                                        $pp_rs_kod = 1111;
                                    } else {
                                        if (!is_null($result["pp_rs_kod_api"]) && $result["pp_rs_kod_api"] == 1112) {
                                            $pp_rs_kod = 1112;
                                        }
                                    }
                                } else {
                                    if (qLaaIsLabApplicable($categoryId) && !qLaaIsAPIApplicable($categoryId)) {
                                        if (!is_null($result["pp_rs_kod_lab"]) && $result["pp_rs_kod_lab"] == 1111) {
                                            $pp_rs_kod = 1111;
                                        } else {
                                            if (!is_null($result["pp_rs_kod_lab"]) && $result["pp_rs_kod_lab"] == 1112) {
                                                $pp_rs_kod = 1112;
                                            }
                                        }
                                    } else {
                                        if (!qLaaIsLabApplicable($categoryId) && !qLaaIsAPIApplicable($categoryId)) {
                                            $pp_rs_kod = 1111;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            } else {
                if ($approveReject == "REJECT") {
                    if (!is_null($isLab) && $isLab == 'LAB') {
                        if (qLaaIsLabApplicable($categoryId)) {
                            if (qLaaIsAPIApplicable($categoryId)) {
                                if (!is_null($result["pp_rs_kod_api"]) && !is_null($result["pp_rs_kod_product"]) && ($result["pp_rs_kod_api"] == 1111 || $result["pp_rs_kod_api"] == 1112) && ($result["pp_rs_kod_product"] == 1111 || $result["pp_rs_kod_product"] == 1112)) {
                                    $pp_rs_kod = 1112;
                                }
                            } else {
                                if (!is_null($result["pp_rs_kod_product"]) && ($result["pp_rs_kod_product"] == 1111 || $result["pp_rs_kod_product"] == 1112)) {
                                    $pp_rs_kod = 1112;
                                }
                            }
                        }
                    } else {
                        if ($_SESSION['department'] == 'API') {
                            if (qLaaIsLabApplicable($categoryId)) {
                                if (!is_null($result["pp_rs_kod_lab"]) && !is_null($result["pp_rs_kod_product"]) && ($result["pp_rs_kod_lab"] == 1111 || $result["pp_rs_kod_lab"] == 1112) && ($result["pp_rs_kod_product"] == 1111 || $result["pp_rs_kod_product"] == 1112)) {
                                    $pp_rs_kod = 1112;
                                }
                            } else {
                                if (!is_null($result["pp_rs_kod_product"]) && ($result["pp_rs_kod_product"] == 1111 || $result["pp_rs_kod_product"] == 1112)) {
                                    $pp_rs_kod = 1112;
                                }
                            }
                        } else {
                            if ($_SESSION['department'] == 'PRODUCT') {
                                if (qLaaIsLabApplicable($categoryId) && qLaaIsAPIApplicable($categoryId)) {
                                    if (!is_null($result["pp_rs_kod_api"]) && !is_null($result["pp_rs_kod_lab"]) && ($result["pp_rs_kod_lab"] == 1111 || $result["pp_rs_kod_lab"] == 1112) && ($result["pp_rs_kod_api"] == 1111 || $result["pp_rs_kod_api"] == 1112)) {
                                        $pp_rs_kod = 1112;
                                    }
                                } else {
                                    if (!qLaaIsLabApplicable($categoryId) && qLaaIsAPIApplicable($categoryId)) {
                                        if (!is_null($result["pp_rs_kod_api"]) && ($result["pp_rs_kod_api"] == 1111 || $result["pp_rs_kod_api"] == 1112)) {
                                            $pp_rs_kod = 1112;
                                        }
                                    } else {
                                        if (qLaaIsLabApplicable($categoryId) && !qLaaIsAPIApplicable($categoryId)) {
                                            if (!is_null($result["pp_rs_kod_lab"]) && ($result["pp_rs_kod_lab"] == 1111 || $result["pp_rs_kod_lab"] == 1112)) {
                                                $pp_rs_kod = 1112;
                                            }
                                        } else {
                                            if (!qLaaIsLabApplicable($categoryId) && !qLaaIsAPIApplicable($categoryId)) {
                                                $pp_rs_kod = 1112;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            if ($pp_rs_kod) {
                if (!is_null($pp_kod) && $pp_kod) {
                    $sqlQueryAuto = "UPDATE p_product SET pp_rs_kod = " . $pp_rs_kod . " WHERE pp_kod = " . $pp_kod;
                    insupdelQuery($sqlQueryAuto);
                } else {
                    $sqlQueryAuto = "UPDATE p_product SET pp_rs_kod = " . $pp_rs_kod . " WHERE pp_kod = " . $_SESSION['product_reg']['ppID'];
                    insupdelQuery($sqlQueryAuto);
                }
                $fQPreEvalPPsFinal = true;
            } else {
                // echo "extr";
                // PP Auto Send Correspondence to client.
                evalPPAutoCorrespondAR($isLab, $pp_kod, $categoryId);
            }
        }
    }
    return $fQPreEvalPPsFinal;
}
Exemplo n.º 7
0
function evalKUTrayAutoApproveReject($approveReject, $isLab = null, $currProdId, $appeal = null)
{
    $categoryId = qGetProdCatId($currProdId);
    if (is_null($appeal)) {
        $appeal = 0;
    }
    $result = selectQuery("SELECT pp_rs_kod_lab,pp_rs_kod_api,pp_rs_kod_product\n\t\t FROM p_product WHERE pp_kod = " . $currProdId, 1);
    if ($result) {
        $pkuGoAhead = true;
        if (!isset($result["pp_rs_kod_product"])) {
            $pkuGoAhead = false;
        }
        if (qLaaIsLabApplicable($categoryId) && !isset($result["pp_rs_kod_lab"])) {
            $pkuGoAhead = false;
        }
        if (qLaaIsAPIApplicable($categoryId) && !isset($result["pp_rs_kod_api"])) {
            $pkuGoAhead = false;
        }
        if ($pkuGoAhead) {
            $pp_rs_kod = 0;
            if ($approveReject == "APPROVE") {
                if (!is_null($isLab) && $isLab == 'LAB') {
                    if (qLaaIsLabApplicable($categoryId)) {
                        if (qLaaIsAPIApplicable($categoryId)) {
                            if (!is_null($result["pp_rs_kod_api"]) && !is_null($result["pp_rs_kod_product"]) && $result["pp_rs_kod_api"] == 9008 && $result["pp_rs_kod_product"] == 9008) {
                                $pp_rs_kod = 9008;
                            } else {
                                if (!is_null($result["pp_rs_kod_api"]) && !is_null($result["pp_rs_kod_product"]) && ($result["pp_rs_kod_api"] == 9050 || $result["pp_rs_kod_product"] == 9050)) {
                                    $pp_rs_kod = 9050;
                                }
                            }
                        } else {
                            if (!is_null($result["pp_rs_kod_product"]) && $result["pp_rs_kod_product"] == 9008) {
                                $pp_rs_kod = 9008;
                            } else {
                                if (!is_null($result["pp_rs_kod_product"]) && $result["pp_rs_kod_product"] == 9050) {
                                    $pp_rs_kod = 9050;
                                }
                            }
                        }
                    }
                } else {
                    if ($_SESSION['department'] == 'API') {
                        if (qLaaIsLabApplicable($categoryId)) {
                            if (!is_null($result["pp_rs_kod_lab"]) && !is_null($result["pp_rs_kod_product"]) && $result["pp_rs_kod_lab"] == 9008 && $result["pp_rs_kod_product"] == 9008) {
                                $pp_rs_kod = 9008;
                            } else {
                                if (!is_null($result["pp_rs_kod_lab"]) && !is_null($result["pp_rs_kod_product"]) && ($result["pp_rs_kod_lab"] == 9050 || $result["pp_rs_kod_product"] == 9050)) {
                                    $pp_rs_kod = 9050;
                                }
                            }
                        } else {
                            if (!is_null($result["pp_rs_kod_product"]) && $result["pp_rs_kod_product"] == 9008) {
                                $pp_rs_kod = 9008;
                            } else {
                                if (!is_null($result["pp_rs_kod_product"]) && $result["pp_rs_kod_product"] == 9050) {
                                    $pp_rs_kod = 9050;
                                }
                            }
                        }
                    } else {
                        if ($_SESSION['department'] == 'PRODUCT') {
                            if (qLaaIsLabApplicable($categoryId) && qLaaIsAPIApplicable($categoryId)) {
                                if (!is_null($result["pp_rs_kod_api"]) && !is_null($result["pp_rs_kod_lab"]) && $result["pp_rs_kod_api"] == 9008 && $result["pp_rs_kod_lab"] == 9008) {
                                    $pp_rs_kod = 9008;
                                    // echo $pp_rs_kod;
                                } else {
                                    if (!is_null($result["pp_rs_kod_api"]) && !is_null($result["pp_rs_kod_lab"]) && ($result["pp_rs_kod_api"] == 9050 || $result["pp_rs_kod_lab"] == 9050)) {
                                        $pp_rs_kod = 9050;
                                    }
                                }
                            } else {
                                if (!qLaaIsLabApplicable($categoryId) && qLaaIsAPIApplicable($categoryId)) {
                                    if (!is_null($result["pp_rs_kod_api"]) && $result["pp_rs_kod_api"] == 9008) {
                                        $pp_rs_kod = 9008;
                                        // echo $pp_rs_kod;
                                    } else {
                                        if (!is_null($result["pp_rs_kod_api"]) && $result["pp_rs_kod_api"] == 9050) {
                                            $pp_rs_kod = 9050;
                                        }
                                    }
                                } else {
                                    if (qLaaIsLabApplicable($categoryId) && !qLaaIsAPIApplicable($categoryId)) {
                                        if (!is_null($result["pp_rs_kod_lab"]) && $result["pp_rs_kod_lab"] == 9008) {
                                            $pp_rs_kod = 9008;
                                            // echo $pp_rs_kod;
                                        } else {
                                            if (!is_null($result["pp_rs_kod_lab"]) && $result["pp_rs_kod_lab"] == 9050) {
                                                $pp_rs_kod = 9050;
                                            }
                                        }
                                    } else {
                                        if (!qLaaIsLabApplicable($categoryId) && !qLaaIsAPIApplicable($categoryId)) {
                                            $pp_rs_kod = 9008;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            } else {
                if ($approveReject == "REJECT") {
                    if (!is_null($isLab) && $isLab == 'LAB') {
                        if (qLaaIsLabApplicable($categoryId)) {
                            if (qLaaIsAPIApplicable($categoryId)) {
                                if (!is_null($result["pp_rs_kod_api"]) && !is_null($result["pp_rs_kod_product"]) && ($result["pp_rs_kod_api"] == 9008 || $result["pp_rs_kod_api"] == 9050) && ($result["pp_rs_kod_product"] == 9008 || $result["pp_rs_kod_product"] == 9050)) {
                                    $pp_rs_kod = 9050;
                                }
                            } else {
                                if (!is_null($result["pp_rs_kod_product"]) && ($result["pp_rs_kod_product"] == 9008 || $result["pp_rs_kod_product"] == 9050)) {
                                    $pp_rs_kod = 9050;
                                }
                            }
                        }
                    } else {
                        if ($_SESSION['department'] == 'API') {
                            if (qLaaIsLabApplicable($categoryId)) {
                                if (!is_null($result["pp_rs_kod_lab"]) && !is_null($result["pp_rs_kod_product"]) && ($result["pp_rs_kod_lab"] == 9008 || $result["pp_rs_kod_lab"] == 9050) && ($result["pp_rs_kod_product"] == 9008 || $result["pp_rs_kod_product"] == 9050)) {
                                    $pp_rs_kod = 9050;
                                }
                            } else {
                                if (!is_null($result["pp_rs_kod_product"]) && ($result["pp_rs_kod_product"] == 9008 || $result["pp_rs_kod_product"] == 9050)) {
                                    $pp_rs_kod = 9050;
                                }
                            }
                        } else {
                            if ($_SESSION['department'] == 'PRODUCT') {
                                if (qLaaIsLabApplicable($categoryId) && qLaaIsAPIApplicable($categoryId)) {
                                    if (!is_null($result["pp_rs_kod_api"]) && !is_null($result["pp_rs_kod_lab"]) && ($result["pp_rs_kod_lab"] == 9008 || $result["pp_rs_kod_lab"] == 9050) && ($result["pp_rs_kod_api"] == 9008 || $result["pp_rs_kod_api"] == 9050)) {
                                        $pp_rs_kod = 9050;
                                    }
                                } else {
                                    if (!qLaaIsLabApplicable($categoryId) && qLaaIsAPIApplicable($categoryId)) {
                                        if (!is_null($result["pp_rs_kod_api"]) && ($result["pp_rs_kod_api"] == 9008 || $result["pp_rs_kod_api"] == 9050)) {
                                            $pp_rs_kod = 9050;
                                        }
                                    } else {
                                        if (qLaaIsLabApplicable($categoryId) && !qLaaIsAPIApplicable($categoryId)) {
                                            if (!is_null($result["pp_rs_kod_lab"]) && ($result["pp_rs_kod_lab"] == 9008 || $result["pp_rs_kod_lab"] == 9050)) {
                                                $pp_rs_kod = 9050;
                                            }
                                        } else {
                                            if (!qLaaIsLabApplicable($categoryId) && !qLaaIsAPIApplicable($categoryId)) {
                                                $pp_rs_kod = 9050;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            if ($pp_rs_kod) {
                $sqlQueryAuto = "UPDATE p_product SET pp_rs_kod = " . $pp_rs_kod . " WHERE pp_kod = " . $currProdId;
                insupdelQuery($sqlQueryAuto);
                if ($appeal == 1) {
                    $sqlQuery = "UPDATE p_product SET pp_pkk_appeal_stat = 55,pp_pkk_tkh_appeal = '" . date('Y-m-d H:i:s') . "' WHERE pp_kod = " . $currProdId;
                    insupdelQuery($sqlQuery);
                }
                $sqlUpdFdt = "INSERT INTO p_product_status_his ( ppsh_pp_kod,ppsh_process,ppsh_date_evaluation ) VALUES ( " . $currProdId . ",'evaluation','" . date("Y-m-d H:i:s") . "' )";
                $ret = insupdelQuery($sqlUpdFdt);
            }
        }
    }
}