Exemple #1
0
$flds = " b2bpav.*, org.vCompanyName as vBuyer2, org.vCompCode, bpo.vProductName as vProduct, bpo.vProductCode ";
$jtbl = " LEFT JOIN " . PRJ_DB_PREFIX . "_bproduct_organization bpo on bpo.iProductId=b2bpav.iProductId\r\n            LEFT JOIN " . PRJ_DB_PREFIX . "_organization_master org on org.iOrganizationID=b2bpav.iBuyer2Id ";
$vb2bprdtls = $b2bpavObj->getJoinTableInfo($jtbl, $flds, " AND b2bpav.iAssociationId={$iAssociationId} ", ' b2bpav.iVerifiedID DESC ', '', ' LIMIT 0,1');
$vrq = $b2bpavObj->isVerifyReq($vb2bprdtls);
$vsts = '';
if ($vrq == 'vreq') {
    $vsts = $b2bpavObj->chkRecVrf($vb2bprdtls);
    if ($vsts == 'nr' || $vsts == 'om') {
        header('Location: ' . SITE_URL_DUM . 'b2bprodtasoclist');
        exit;
    }
} else {
    if ($vrq == 'nr') {
        $flds = " b2bpa.*, org.vCompanyName as vBuyer2, org.vCompCode, bpo.vProductName as vProduct, bpo.vProductCode ";
        $jtbl = " LEFT JOIN " . PRJ_DB_PREFIX . "_bproduct_organization bpo on bpo.iProductId=b2bpa.iProductId\r\n               LEFT JOIN " . PRJ_DB_PREFIX . "_organization_master org on org.iOrganizationID=b2bpa.iBuyer2Id ";
        $vb2bprdtls = $b2bpaObj->getJoinTableInfo($jtbl, $flds, " AND iAssociationId={$iAssociationId} ");
        $vrq = $b2bpavObj->isVerifyReq($vb2bprdtls);
        if ($vrq == 'vreq') {
            $vsts = $b2bpavObj->chkRecVrf($vb2bprdtls);
            if ($vsts == 'nr' || $vsts == 'om') {
                header('Location: ' . SITE_URL_DUM . 'b2bprodtasoclist');
                exit;
            }
        } else {
            if ($vrq == 'nr') {
                header('Location: ' . SITE_URL_DUM . 'b2bprodtasoclist');
                exit;
            }
        }
    }
}
        $cursort_type = 'ASC';
    } else {
        $cursort_type = 'DESC';
    }
    $orderBy = " {$cursort} {$cursort_type}";
} else {
    $orderBy = " b2bpa.dADate DESC ";
}
## ENDS HERE ###
$where .= " AND NOT (b2bpa.eStatus='Delete' AND b2bpa.eNeedToVerify!='Yes') ";
$limit = " LIMIT " . ($page - 1) * $REC_LIMIT_FRONT . ", " . $REC_LIMIT_FRONT . " ";
$jtbl = "";
/*	$fields = " b2bpa.*, (Select vCompanyName from b2b_organization_master where iOrganizationID=iBuyerOrganizationID) as vBuyerOrg,
					GROUP_CONCAT((Select DISTINCT CONCAT(vCompanyName,' (',b2bpa.vSupplierCode,')') from b2b_organization_master where iOrganizationID=b2bpa.iSupplierAssocationID )) as vSupplierOrg "; 	// AND (b2bpa.eStatus='Active' || b2bpa.eStatus = 'Inactive') AND b2bpa.eNeedToVerify!='Yes'
*/
$fields = "b2bpa.*, (Select vCompanyName from " . PRJ_DB_PREFIX . "_organization_master where iOrganizationID=b2bpa.iBuyer2Id) as vBuyer2,\r\n\t\t\t\t\t (Select vProductName from " . PRJ_DB_PREFIX . "_bproduct_organization where iProductId=b2bpa.iProductId) as vProduct";
// (Select CONCAT(vCompanyName,' (',b2bpa.vSupplierCode,')') from b2b_organization_master where iOrganizationID=b2bpa.iSupplierAssocationID) as vSupplierOrg
$asocs = $assObj->getJoinTableInfo($jtbl, $fields, $where, $orderBy, $groupBy, $limit, 'yes');
// prints($asocs); exit;
$count = $asocs['tot'];
unset($asocs['tot']);
if (!isset($pgajxobj)) {
    require_once SITE_CLASS_GEN . "class.paging-ajax.php";
}
$pgajxobj = new Paging($count, $page, "listb2bprdtassocs", $REC_LIMIT_FRONT);
$paging = $pgajxobj->getListPG($page);
$pgmsg = $pgajxobj->setMessage("Records");
$smarty->assign('count', $count);
$smarty->assign('asocs', $asocs);
$smarty->assign('paging', $paging);
$smarty->assign('pgmsg', $pgmsg);