id.'" and potential.sales_stage <> "'.$app_strings['LBL_CLOSE_WON'].'" and potential.sales_stage <> "'.$app_strings['LBL_CLOSE_LOST'].'" group by account.accountname order by 3 desc;'; $list_result=$adb->query($list_query); $open_accounts_list = array(); $noofrows = min($adb->num_rows($list_result),7); if (count($list_result)>0) for($i=0;$i<$noofrows;$i++) { //$parent_name=getRelatedTo("Activities",$list_result,$i); $open_accounts_list[] = Array('accountid' => $adb->query_result($list_result,$i,'accountid'), 'accountname' => $adb->query_result($list_result,$i,'accountname'), 'amount' => $adb->query_result($list_result,$i,'amount'), ); } $xtpl=new XTemplate ('modules/Accounts/ListViewTop.html'); $xtpl->assign("MOD", $current_module_strings); $xtpl->assign("APP", $app_strings); $xtpl->assign("CURRENCY_SYMBOL", getCurrencySymbol()); // Stick the form header out there. echo get_form_header($current_module_strings['LBL_TOP_ACCOUNTS'], '', false); $xtpl->assign("IMAGE_PATH", $image_path); $xtpl->assign("RETURN_URL", "&return_module=$currentModule&return_action=DetailView&return_id=" . ((is_object($focus)) ? $focus->id : "")); $oddRow = true; foreach($open_accounts_list as $account) { $account_fields = array( 'ACCOUNT_ID' => $account['accountid'], 'ACCOUNT_NAME' => $account['accountname'], 'AMOUNT' => ($account['amount']), ); $xtpl->assign("ACCOUNT", $account_fields); if($oddRow) { //todo move to themes $xtpl->assign("ROW_COLOR", 'oddListRow'); } else { //todo move to themes $xtpl->assign("ROW_COLOR", 'evenListRow'); } $oddRow = !$oddRow; $xtpl->parse("main.row"); // Put the rows in. } $xtpl->parse("main"); if (count($open_accounts_list)>0) $xtpl->out("main"); else echo "".$current_module_strings['NTC_NONE_SCHEDULED'].""; echo "
"; // Stick on the form footer echo get_form_footer(); ?>