} } } } } } // echo $sqlQuery; insupdelQuery($sqlQuery); // Pre-Evalution Auto function call. if ($_POST['rs'] == 1105) { if ($_POST['type'] == 1) { preEvalAutoApproveReject("APPROVE"); } else { if ($_POST['type'] == 2) { preEvalAutoApproveReject("REJECT"); } } } if ($_POST['rs'] == 1107 || $_POST['rs'] == 1109) { // Evalution PP Auto function call. if ($_POST['type'] == 1) { evalPPAutoApproveReject("APPROVE"); } else { if ($_POST['type'] == 2) { evalPPAutoApproveReject("REJECT"); } } // PP Auto Send Correspondence to client. evalPPAutoCorrespondAR(); } exit;
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; }