Пример #1
0
}
if (!isset($statusmasterObj)) {
    include_once SITE_CLASS_APPLICATION . "class.StatusMaster.php";
    $statusmasterObj = new StatusMaster();
}
if (!isset($orgObj)) {
    include_once SITE_CLASS_APPLICATION . "organization/class.Organization.php";
    $orgObj = new Organization();
}
// $poData=$pohObj->select($iPurchaseOrderID);
$fields = " poh.*, (select vState from b2b_state_master sm where BINARY sm.vStateCode=poh.vShipToState AND BINARY sm.vCountryCode=poh.vShipToCountry) as vShipToState,\r\n\t\t\t\t(select vCountry from b2b_country_master cm where BINARY cm.vCountryCode=poh.vShipToCountry) as vShipToCountry,\r\n\t\t\t\t(select vState from b2b_state_master sm where BINARY sm.vStateCode=poh.vBillToState AND BINARY sm.vCountryCode=poh.vBillToCountry) as vBillToState,\r\n\t\t\t\t(select vCountry from b2b_country_master cm where BINARY cm.vCountryCode=poh.vBillToCountry) as vBillToCountry,\r\n\t\t\t\t(select org.vCompanyName from b2b_organization_master org where org.iOrganizationID=poh.iSupplierOrganizationID) as vSupplierName,\r\n\t\t\t\t(select CONCAT(usr.vFirstName,' ',usr.vLastName) as name from b2b_organization_user usr where usr.iUserID=poh.iSupplierID) as vSupplierContactParty ";
$poData = $pohObj->getJoinTableInfo('', $fields, " AND iPurchaseOrderID={$iPurchaseOrderID} ");
$isdtls = $statusmasterObj->getDetails('*', " AND eFor='PO' AND vStatus_en='Issued' ");
$isdtls = $isdtls[0]['iStatusID'];
if ($uorg_type == 'Buyer2') {
    $b2us = $pohObj->getPurchaseOrderRfq2Buyer2OrgIds($iPurchaseOrderID);
    if (!in_array($curORGID, $b2us)) {
        header("Location: " . SITE_URL_DUM . "invoicelist");
        exit;
    }
} else {
    if ($poData[0]['iBuyerOrganizationID'] != $curORGID && $poData[0]['iSupplierOrganizationID'] != $curORGID) {
        header("Location: " . SITE_URL_DUM . "polist/all");
        exit;
    } else {
        if ($poData[0]['iSupplierOrganizationID'] == $curORGID && $poData[0]['iStatusID'] < $isdtls) {
            header("Location: " . SITE_URL_DUM . "polist/all");
            exit;
        }
    }
}