<?php $iProductId = GetVar('id'); $dtls = array(); if (trim($iProductId) != '' && $iProductId > 0) { if (!isset($bProductOrgObj)) { include_once SITE_CLASS_APPLICATION . 'productorganization/class.BProductOrganization.php'; $bProductOrgObj = new BProductOrganization(); } $flds = "bpo.iProductId, bpo.vProductName, bpo.vProductCode, 'sproduct' as eProductType, bpo.eAvailability, (select vBankName from " . PRJ_DB_PREFIX . "_bank_master bm where bm.iBankId=bpo.iBankId) as vBankName, bpo.vBankAccount"; $dtls = $bProductOrgObj->getDetails($flds, " AND iProductId='{$iProductId}' "); } if (!(is_array($dtls) && count($dtls) > 0)) { $dtls = 'nrf'; } $smarty->assign("dtls", $dtls);
$arr[0] = $post_data['Data']; if (isset($arr[0]['iBuyer2Id']) && $arr[0]['iBuyer2Id'] > 0) { if (!isset($orgObj)) { include_once SITE_CLASS_APPLICATION . "organization/class.Organization.php"; $orgObj = new Organization(); } $buyer2 = $orgObj->getDetails('vCompanyName, vCompCode', " AND iOrganizationID='" . $arr[0]['iBuyer2Id'] . "'"); $arr[0]['vBuyer2'] = $buyer2[0]['vCompanyName']; $arr[0]['vB2Code'] = $buyer2[0]['vCompCode']; } if (isset($arr[0]['iProductId']) && $arr[0]['iProductId'] > 0) { if (!isset($bpoObj)) { include_once SITE_CLASS_APPLICATION . "productorganization/class.BProductOrganization.php"; $bpoObj = new BProductOrganization(); } $product = $bpoObj->getDetails('vProductName, vProductCode', " AND iProductId='" . $arr[0]['iProductId'] . "'"); $arr[0]['vProduct'] = $product[0]['vProductName']; $arr[0]['vProductCode'] = $product[0]['vProductCode']; } $arr[0]['iBuyerId'] = 0; } // pr($arr); exit; } // For OAs // pr($_SESSION); exit; if (isset($_SESSION['SESS_' . PRJ_CONST_PREFIX . '_ORGTYPE']) && $_SESSION['SESS_' . PRJ_CONST_PREFIX . '_ORGTYPE'] != 'Buyer2' && $_SESSION['SESS_' . PRJ_CONST_PREFIX . '_USRTYPE'] != 'SM') { if ($iAssociationId > 0) { header("Location: " . SITE_URL_DUM . "b2bprodtbasocview/{$iAssociationId}"); } else { header("Location: " . SITE_URL_DUM . "b2bprodtbasoclist"); }
if (trim($scd) != '' && trim($snm) == '') { $whr .= " AND bpo.vProductCode LIKE '%{$scd}%' "; } else { if (trim($scd) != '' && trim($snm) != '') { $whr .= " AND (bpo.vProductName LIKE '%{$snm}%' OR bpo.vProductCode LIKE '%{$scd}%') "; } } } if (trim($iBuyer2Id) != '' && $iBuyer2Id > 0) { $whr .= " AND bpo.iProductId IN (Select iProductId from " . PRJ_DB_PREFIX . "_buyer2_bproduct_association where iBuyer2Id={$iBuyer2Id} AND NOT (eStatus='Delete' AND eNeedToVerify='No'))"; } if (trim($sid) != '' && $sid > 0) { $whr .= " OR bpo.iProductId={$sid} "; } // echo $whr; exit; $bprdt = $bprdtObj->getDetails("*", " AND bpo.eAvailability='association' {$whr} ", " bpo.vProductName ASC "); // prints($bprdt); exit; if (is_array($bprdt) && count($bprdt) > 0) { $ln = count($bprdt); $html .= "<select id='{$fid}' name='{$fnm}' class='{$cls}' onchange='return {$oc};' style='{$styl}' title='" . $smarty->get_template_vars('LBL_SELECT') . ' ' . $smarty->get_template_vars('LBL_BPRODUCT') . "'>"; for ($l = 0; $l < $ln; $l++) { $sel = ""; if ($sid > 0 && $bprdt[$l]['iProductId'] == $sid) { $sel = "selected='selected'"; } $html .= "<option value='" . $bprdt[$l]['iProductId'] . "' {$sel} >" . $bprdt[$l]['vProductName'] . " (" . $bprdt[$l]['vProductCode'] . ")" . "</option>"; } $html .= "</select>"; } else { $html .= "<select id='{$fid}' name='{$fnm}' class='{$cls}' onchange='return {$oc};' style='{$styl}' title='" . $smarty->get_template_vars('LBL_SELECT') . ' ' . $smarty->get_template_vars('LBL_BPRODUCT') . "'>"; $html .= "<option value=''>---" . $smarty->get_template_vars('LBL_SELECT') . ' ' . $smarty->get_template_vars('LBL_BPRODUCT') . "---</option>";
$whr = ""; if (trim($productname) != '') { $whr .= " AND vProductName LIKE '{$productname}%' "; } else { if (trim($productcode) != '') { $whr .= " AND vProductCode LIKE '{$productcode}%' "; } } $dtls = array(); if ($curORGID > 0 && $orgas != '' && ($iInvoiceID > 0 || $iPurchaseOrderID > 0)) { if ($orgas == 'Buyer') { if (!isset($bProductOrgObj)) { include_once SITE_CLASS_APPLICATION . 'productorganization/class.BProductOrganization.php'; $bProductOrgObj = new BProductOrganization(); } $dtls = $bProductOrgObj->getDetails("iProductId, vProductName, vProductCode, 'bproduct' as eProductType", " AND eAvailability='{$availability}' {$whr}"); } else { if ($orgas == 'Supplier') { if (!isset($sProductOrgObj)) { include_once SITE_CLASS_APPLICATION . 'productorganization/class.SProductOrganization.php'; $sProductOrgObj = new SProductOrganization(); } $dtls = $sProductOrgObj->getDetails("iProductId, vProductName, vProductCode, 'sproduct' as eProductType", " AND eAvailability='{$availability}' {$whr}"); } else { if ($orgas == 'Both') { $sql = "(Select iProductId, vProductName, vProductCode, 'b' as eProductType from " . PRJ_DB_PREFIX . "_bproduct_organization where eAvailability='{$availability} {$whr}')\r\n\t\t\t\t\tUNION\r\n\t\t\t\t\t(Select iProductId, vProductName, vProductCode, 's' as eProductType from " . PRJ_DB_PREFIX . "_sproduct_organization where eAvailability='{$availability} {$whr}')\r\n\t\t\t\t\tORDER BY vProductName ASC"; $dtls = $dbobj->MySQLSelect($sql); } } } }