$stsdtls = $statusmasterObj->getDetails('*', " AND eFor='Invoice' AND vStatus_en='Accepted' "); $acptsts = $stsdtls; $lang = $_SESSION['SESS_' . PRJ_CONST_PREFIX . '_LANG']; $stsdtls = $statusmasterObj->getDetails("*, vStatusMsg_{$lang} as vStatusMsg", " AND eFor='Invoice' AND vStatus_en='Issued' "); $isusts = $stsdtls; $fields = " ioh.*, ioh.vExtPOCode, (select vState from b2b_state_master sm where BINARY sm.vStateCode=ioh.vBillToState AND BINARY sm.vCountryCode=ioh.vBillToCountry) as vBillToState,\r\n\t\t\t\t(select vCountry from b2b_country_master cm where BINARY cm.vCountryCode=ioh.vBillToCountry) as vBillToCountry\t"; $invoiceData = $invOrderObj->getJoinTableInfo('', $fields, " AND iInvoiceID={$iInvoiceID} "); $isdtls = $statusmasterObj->getDetails('*', " AND eFor='Invoice' AND vStatus_en='Issued' "); $isdtls = $isdtls[0]['iStatusID']; // pr($_SESSION); exit; if (!(is_array($invoiceData) && count($invoiceData) > 0)) { header("Location: " . SITE_URL_DUM . "invoicelist"); exit; } if ($uorg_type == 'Buyer2') { $b2us = $invOrderObj->getInvoiceRfq2Buyer2OrgIds($iInvoiceID); if (!in_array($curORGID, $b2us)) { header("Location: " . SITE_URL_DUM . "invoicelist"); exit; } } else { if ($invoiceData[0]['iBuyerOrganizationID'] != $curORGID && $invoiceData[0]['iSupplierOrganizationID'] != $curORGID) { header("Location: " . SITE_URL_DUM . "invoicelist/all"); exit; } else { if ($invoiceData[0]['iBuyerOrganizationID'] == $curORGID && $invoiceData[0]['iStatusID'] < $isdtls && $invoiceData[0]['eCreateByBuyer'] != 'Yes') { header("Location: " . SITE_URL_DUM . "invoicelist/all"); exit; } } }