id,'unit_price') != '0'){ echo ""; echo "
"; echo "
$app_strings[LBL_UNIT_PRICE_NOT_PERMITTED]
$app_strings[LBL_GO_BACK]
"; echo "
"; exit(); } $smarty=new vtigerCRM_Smarty; $smarty->assign("MOD", $mod_strings); $smarty->assign("APP", $app_strings); $smarty->assign("THEME", $theme); $smarty->assign("IMAGE_PATH",$image_path); $focus = new PriceBooks(); //Retreive the list of PriceBooks $list_query = getListQuery("PriceBooks"); $list_query .= ' and vtiger_pricebook.active<>0 ORDER BY pricebookid DESC '; $list_result = $adb->query($list_query); $num_rows = $adb->num_rows($list_result); $record_string= "Total No of PriceBooks : ".$num_rows; //Retreiving the array of already releated products $sql1="select vtiger_crmentity.crmid, vtiger_pricebookproductrel.pricebookid,vtiger_products.unit_price from vtiger_pricebookproductrel inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_pricebookproductrel.productid inner join vtiger_products on vtiger_products.productid=vtiger_pricebookproductrel.productid where vtiger_crmentity.deleted=0 and vtiger_pricebookproductrel.productid=?"; $res1 = $adb->pquery($sql1, array($productid)); $num_prod_rows = $adb->num_rows($res1); $pbk_array = Array(); for($i=0; $i<$num_prod_rows; $i++) { $pbkid=$adb->query_result($res1,$i,"pricebookid"); $pbk_array[$pbkid] = $pbkid; } $pro_unit_price = getUnitPrice($productid, $currentModule); $prod_price_details = getPriceDetailsForProduct($productid, $pro_unit_price); $prod_cur_price = array(); for($i=0; $i '; //we should not display the Add to PriceBook button if there is no pricebooks to associate if($num_rows != $num_prod_rows) $other_text .=' '; $other_text .=''; $other_text .=' '; $smarty->assign("PRICEBOOKLISTHEADER", get_form_header($current_module_strings['LBL_LIST_PRICEBOOK_FORM_TITLE'], $other_text, false )); //List View Table Header $list_header = ''; $list_header .= ''; $list_header .=''; $list_header .= ''.$mod_strings['LBL_PRICEBOOK'].''; $list_header .= ''.$app_strings['LBL_CURRENCY'].''; $list_header .= ''.$mod_strings['LBL_PRODUCT_UNIT_PRICE'].''; $list_header .= ''.$mod_strings['LBL_PB_LIST_PRICE'].''; $list_header .= ''; $smarty->assign("LISTHEADER", $list_header); $list_body =''; for($i=0; $i<$num_rows; $i++) { $entity_id = $adb->query_result($list_result,$i,"crmid"); if(! array_key_exists($entity_id, $pbk_array)) { $pk_currency_id = $adb->query_result($list_result,$i,"currency_id"); $pk_currency_name = $adb->query_result($list_result,$i,"currency_name"); $unit_price = $prod_cur_price[$pk_currency_id]; $field_name = $entity_id."_listprice"; $unit_price_array[]='"'.$unit_price.'"'; $field_name_array[]="'".$field_name."'"; $list_body .= ''; $list_body .= ''; $list_body .= ''.$adb->query_result($list_result,$i,"bookname").''; $list_body .= ''.$pk_currency_name.''; $list_body .= ''.$unit_price.''; $list_body .=''; if(isPermitted("PriceBooks","EditView","") == 'yes') $list_body .= ''; else $list_body .= ''; $list_body .= ''; } } $smarty->assign("UNIT_PRICE_ARRAY",implode(",",$unit_price_array)); $smarty->assign("FIELD_NAME_ARRAY",implode(",",$field_name_array)); if($order_by !='') $url_string .="&order_by=".$order_by; if($sorder !='') $url_string .="&sorder=".$sorder; $smarty->assign("LISTENTITY", $list_body); $smarty->assign("RETURN_MODULE", vtlib_purify($_REQUEST['return_module'])); $smarty->assign("RETURN_ACTION", vtlib_purify($_REQUEST['return_action'])); $smarty->assign("RETURN_ID", $productid); $smarty->assign("CATEGORY", $parenttab); $smarty->display("AddProductToPriceBooks.tpl"); ?>