Exemple #1
0
<?php

if (!isset($b2bpbObj)) {
    include_once SITE_CLASS_APPLICATION . "organization/class.Buyer2_Buyer_BProduct_Association.php";
    $b2bpbObj = new Buyer2_Buyer_BProduct_Association();
}
if (!isset($b2bpbvObj)) {
    include_once SITE_CLASS_APPLICATION . "organization/class.Buyer2_Buyer_BProduct_Association_ToVerify.php";
    $b2bpbvObj = new Buyer2_Buyer_BProduct_Association_ToVerify();
}
$iAssociationId = GetVar('id');
// $msg = GetVar('msg');
$mod = '';
$flds = " b2bpbv.*, org.vCompanyName as vBuyer2, org.vCompCode, bpo.vProductName as vProduct, bpo.vProductCode, bo.vCompanyName as vBuyer, bo.vCompCode as vB2Code ";
$jtbl = " LEFT JOIN " . PRJ_DB_PREFIX . "_bproduct_organization bpo on bpo.iProductId=b2bpbv.iProductId\r\n            LEFT JOIN " . PRJ_DB_PREFIX . "_organization_master org on org.iOrganizationID=b2bpbv.iBuyer2Id\r\n            LEFT JOIN " . PRJ_DB_PREFIX . "_organization_master bo on bo.iOrganizationID=b2bpbv.iBuyerId ";
$vb2bprdtls = $b2bpbvObj->getJoinTableInfo($jtbl, $flds, " AND b2bpbv.iAssociationId={$iAssociationId} ", ' b2bpbv.iVerifiedID DESC ', '', ' LIMIT 0,1');
// pr($vb2bprdtls); exit;
$vrq = $b2bpbvObj->isVerifyReq($vb2bprdtls);
$vsts = '';
if ($vrq == 'vreq') {
    $vsts = $b2bpbvObj->chkRecVrf($vb2bprdtls);
    if ($vsts == 'nr' || $vsts == 'om') {
        header('Location: ' . SITE_URL_DUM . 'b2bprodtbasoclist');
        exit;
    }
} else {
    if ($vrq == 'nr') {
        $flds = " b2bpb.*, org.vCompanyName as vBuyer2, org.vCompCode, bpo.vProductName as vProduct, bpo.vProductCode, bo.vCompanyName as vBuyer, bo.vCompCode as vB2Code ";
        $jtbl = " LEFT JOIN " . PRJ_DB_PREFIX . "_bproduct_organization bpo on bpo.iProductId=b2bpb.iProductId\r\n               LEFT JOIN " . PRJ_DB_PREFIX . "_organization_master org on org.iOrganizationID=b2bpb.iBuyer2Id\r\n               LEFT JOIN " . PRJ_DB_PREFIX . "_organization_master bo on bo.iOrganizationID=b2bpb.iBuyerId ";
        $vb2bprdtls = $b2bpbObj->getJoinTableInfo($jtbl, $flds, " AND iAssociationId={$iAssociationId} ");
        $vrq = $b2bpbvObj->isVerifyReq($vb2bprdtls);
$cursort = $_POST['cursort'];
$cursorttype = $_POST['cursorttype'];
if ($cursort != '') {
    if ($cursorttype == '1') {
        $cursort_type = 'ASC';
    } else {
        $cursort_type = 'DESC';
    }
    $orderBy = " {$cursort} {$cursort_type}";
} else {
    $orderBy = " b2bpbv.dADate DESC ";
}
## ENDS HERE ###
$where .= " AND NOT (b2bpbv.eStatus='Delete' AND b2bpbv.eNeedToVerify!='Yes') AND (eStatus IN ('Modified','Need to Verify') OR eNeedToVerify='Yes') ";
$limit = " LIMIT " . ($page - 1) * $REC_LIMIT_FRONT . ", " . $REC_LIMIT_FRONT . " ";
$jtbl = "";
$fields = "b2bpbv.*, (Select vCompanyName from " . PRJ_DB_PREFIX . "_organization_master where iOrganizationID=b2bpbv.iBuyer2Id) as vBuyer2,\r\n\t\t\t\t\t(Select vProductName from " . PRJ_DB_PREFIX . "_bproduct_organization where iProductId=b2bpbv.iProductId) as vProduct,\r\n\t\t\t\t\t(Select vCompanyName from " . PRJ_DB_PREFIX . "_organization_master where iOrganizationID=b2bpbv.iBuyerId) as vBuyer";
$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, "listb2bprdtbassocsv", $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);