本文整理汇总了PHP中convertFromDollar函数的典型用法代码示例。如果您正苦于以下问题:PHP convertFromDollar函数的具体用法?PHP convertFromDollar怎么用?PHP convertFromDollar使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了convertFromDollar函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getTopAccounts
function getTopAccounts($maxval, $calCnt)
{
$log = LoggerManager::getLogger('top accounts_list');
$log->debug("Entering getTopAccounts() method ...");
require_once "data/Tracker.php";
require_once 'modules/Potentials/Potentials.php';
require_once 'include/logging.php';
require_once 'include/ListView/ListView.php';
global $app_strings;
global $adb;
global $current_language;
global $current_user;
$current_module_strings = return_module_language($current_language, "Accounts");
require 'user_privileges/user_privileges_' . $current_user->id . '.php';
require 'user_privileges/sharing_privileges_' . $current_user->id . '.php';
$list_query = "select vtiger_account.accountid, vtiger_account.accountname, vtiger_account.tickersymbol, sum(vtiger_potential.amount) as amount from vtiger_potential inner join vtiger_crmentity on (vtiger_potential.potentialid=vtiger_crmentity.crmid) left join vtiger_account on (vtiger_potential.related_to=vtiger_account.accountid) left join vtiger_groups on (vtiger_groups.groupid = vtiger_crmentity.smownerid) where vtiger_crmentity.deleted=0 AND vtiger_crmentity.smownerid='" . $current_user->id . "' and vtiger_potential.sales_stage not in ('Closed Won', 'Closed Lost','" . $app_strings['LBL_CLOSE_WON'] . "','" . $app_strings['LBL_CLOSE_LOST'] . "')";
if ($is_admin == false && $profileGlobalPermission[1] == 1 && $profileGlobalPermission[2] == 1 && $defaultOrgSharingPermission[6] == 3) {
$sec_parameter = getListViewSecurityParameter('Accounts');
$list_query .= $sec_parameter;
}
$list_query .= " group by vtiger_account.accountid, vtiger_account.accountname, vtiger_account.tickersymbol order by amount desc";
$list_query .= " LIMIT 0," . $adb->sql_escape_string($maxval);
if ($calCnt == 'calculateCnt') {
$list_result_rows = $adb->query(mkCountQuery($list_query));
return $adb->query_result($list_result_rows, 0, 'count');
}
$list_result = $adb->query($list_query);
$open_accounts_list = array();
$noofrows = $adb->num_rows($list_result);
if ($noofrows) {
for ($i = 0; $i < $noofrows; $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'), 'tickersymbol' => $adb->query_result($list_result, $i, 'tickersymbol'));
}
}
$title = array();
$title[] = 'myTopAccounts.gif';
$title[] = $current_module_strings['LBL_TOP_ACCOUNTS'];
$title[] = 'home_myaccount';
$header = array();
$header[] = $current_module_strings['LBL_LIST_ACCOUNT_NAME'];
$currencyid = fetchCurrency($current_user->id);
$rate_symbol = getCurrencySymbolandCRate($currencyid);
$rate = $rate_symbol['rate'];
$curr_symbol = $rate_symbol['symbol'];
$header[] = $current_module_strings['LBL_LIST_AMOUNT'] . '(' . $curr_symbol . ')';
$entries = array();
foreach ($open_accounts_list as $account) {
$value = array();
$account_fields = array('ACCOUNT_ID' => $account['accountid'], 'ACCOUNT_NAME' => $account['accountname'], 'AMOUNT' => $account['amount']);
$Top_Accounts = strlen($account['accountname']) > 20 ? substr($account['accountname'], 0, 20) . '...' : $account['accountname'];
$value[] = '<a href="index.php?action=DetailView&module=Accounts&record=' . $account['accountid'] . '">' . $Top_Accounts . '</a>';
$value[] = convertFromDollar($account['amount'], $rate);
$entries[$account['accountid']] = $value;
}
$values = array('ModuleName' => 'Accounts', 'Title' => $title, 'Header' => $header, 'Entries' => $entries);
$log->debug("Exiting getTopAccounts method ...");
if ($display_empty_home_blocks && count($entries) == 0 || count($entries) > 0) {
return $values;
}
}
示例2: getTopPotentials
function getTopPotentials($maxval, $calCnt)
{
$log = LoggerManager::getLogger('top opportunity_list');
$log->debug("Entering getTopPotentials() method ...");
require_once "data/Tracker.php";
require_once 'modules/Potentials/Potentials.php';
require_once 'include/logging.php';
require_once 'include/ListView/ListView.php';
global $app_strings;
global $adb;
global $current_language;
global $current_user;
$current_module_strings = return_module_language($current_language, "Potentials");
$title = array();
$title[] = 'myTopOpenPotentials.gif';
$title[] = $current_module_strings['LBL_TOP_OPPORTUNITIES'];
$title[] = 'home_mypot';
$where = "AND vtiger_potential.potentialid > 0 AND vtiger_potential.sales_stage not in ('Closed Won','Closed Lost','" . $current_module_strings['Closed Won'] . "','" . $current_module_strings['Closed Lost'] . "') AND vtiger_crmentity.smownerid='" . $current_user->id . "' AND vtiger_potential.amount > 0";
$header = array();
$header[] = $current_module_strings['LBL_LIST_OPPORTUNITY_NAME'];
//$header[]=$current_module_strings['LBL_LIST_ACCOUNT_NAME'];
$currencyid = fetchCurrency($current_user->id);
$rate_symbol = getCurrencySymbolandCRate($currencyid);
$rate = $rate_symbol['rate'];
$curr_symbol = $rate_symbol['symbol'];
$header[] = $current_module_strings['LBL_LIST_AMOUNT'] . '(' . $curr_symbol . ')';
$list_query = "SELECT vtiger_crmentity.crmid, vtiger_potential.potentialname,\n\t\t\tvtiger_potential.amount, potentialid\n\t\t\tFROM vtiger_potential\n\t\t\tIGNORE INDEX(PRIMARY) INNER JOIN vtiger_crmentity\n\t\t\t\tON vtiger_crmentity.crmid = vtiger_potential.potentialid";
$list_query .= getNonAdminAccessControlQuery('Potentials', $current_user);
$list_query .= "WHERE vtiger_crmentity.deleted = 0 " . $where;
$list_query .= " ORDER BY amount DESC";
$list_query .= " LIMIT " . $adb->sql_escape_string($maxval);
if ($calCnt == 'calculateCnt') {
$list_result_rows = $adb->query(mkCountQuery($list_query));
return $adb->query_result($list_result_rows, 0, 'count');
}
$list_result = $adb->query($list_query);
$open_potentials_list = array();
$noofrows = $adb->num_rows($list_result);
$entries = array();
if ($noofrows) {
for ($i = 0; $i < $noofrows; $i++) {
$open_potentials_list[] = array('name' => $adb->query_result($list_result, $i, 'potentialname'), 'id' => $adb->query_result($list_result, $i, 'potentialid'), 'amount' => $adb->query_result($list_result, $i, 'amount'));
$potentialid = $adb->query_result($list_result, $i, 'potentialid');
$potentialname = $adb->query_result($list_result, $i, 'potentialname');
$Top_Potential = strlen($potentialname) > 20 ? substr($potentialname, 0, 20) . '...' : $potentialname;
$value = array();
$value[] = '<a href="index.php?action=DetailView&module=Potentials&record=' . $potentialid . '">' . $Top_Potential . '</a>';
$value[] = convertFromDollar($adb->query_result($list_result, $i, 'amount'), $rate);
$entries[$potentialid] = $value;
}
}
$search_qry = "&query=true&Fields0=assigned_user_id&Condition0=e&Srch_value0=" . $current_user->column_fields['user_name'] . "&Fields1=sales_stage&Condition1=k&Srch_value1=closed&searchtype=advance&search_cnt=2&matchtype=all";
$values = array('ModuleName' => 'Potentials', 'Title' => $title, 'Header' => $header, 'Entries' => $entries, 'search_qry' => $search_qry);
if ($display_empty_home_blocks && count($open_potentials_list) == 0 || count($open_potentials_list) > 0) {
$log->debug("Exiting getTopPotentials method ...");
return $values;
}
}
示例3: getValue
//.........这里部分代码省略.........
}
array_push($roleids, $roleid);
//here we are checking wheather the table contains the sortorder column .If sortorder is present in the main picklist table, then the role2picklist will be applicable for this table...
$sql = "select * from vtiger_{$temptable} where {$temptable}=?";
$res = $adb->pquery($sql, array(decode_html($temp_val)));
$picklistvalueid = $adb->query_result($res, 0, 'picklist_valueid');
if ($picklistvalueid != null) {
$pick_query = "select * from vtiger_role2picklist where picklistvalueid={$picklistvalueid} and roleid in (" . generateQuestionMarks($roleids) . ")";
$res_val = $adb->pquery($pick_query, array($roleids));
$num_val = $adb->num_rows($res_val);
}
if ($num_val > 0 || $temp_acttype == 'Task' && $fieldname == 'activitytype') {
$temp_val = $temp_val;
} else {
$temp_val = "<font color='red'>" . $app_strings['LBL_NOT_ACCESSIBLE'] . "</font>";
}
}
$value = $current_module_strings[$temp_val] != '' ? $current_module_strings[$temp_val] : ($app_strings[$temp_val] != '' ? $app_strings[$temp_val] : $temp_val);
if ($value != "<font color='red'>" . $app_strings['LBL_NOT_ACCESSIBLE'] . "</font>") {
$value = textlength_check($value);
}
} elseif ($uitype == 16) {
$value = getTranslatedString($temp_val, $currentModule);
} elseif ($uitype == 71 || $uitype == 72) {
if ($temp_val != '') {
if ($fieldname == 'unit_price') {
$currency_id = getProductBaseCurrency($entity_id, $module);
$cursym_convrate = getCurrencySymbolandCRate($currency_id);
$value = "<font style='color:grey;'>" . $cursym_convrate['symbol'] . "</font> " . $temp_val;
} else {
$rate = $user_info['conv_rate'];
//changes made to remove vtiger_currency symbol infront of each vtiger_potential amount
if ($temp_val != 0) {
$value = convertFromDollar($temp_val, $rate);
} else {
$value = $temp_val;
}
}
} else {
$value = '';
}
} elseif ($uitype == 17) {
$value = '<a href="http://' . $field_val . '" target="_blank">' . $temp_val . '</a>';
} elseif ($uitype == 13 || $uitype == 104 && ($_REQUEST['action'] != 'Popup' && $_REQUEST['file'] != 'Popup')) {
if ($_SESSION['internal_mailer'] == 1) {
//check added for email link in user detailview
if ($module == 'Calendar') {
if (getActivityType($entity_id) == 'Task') {
$tabid = 9;
} else {
$tabid = 16;
}
} else {
$tabid = getTabid($module);
}
$fieldid = getFieldid($tabid, $fieldname);
if (empty($popuptype)) {
$value = '<a href="javascript:InternalMailer(' . $entity_id . ',' . $fieldid . ',\'' . $fieldname . '\',\'' . $module . '\',\'record_id\');">' . $temp_val . '</a>';
} else {
$value = $temp_val;
}
} else {
$value = '<a href="mailto:' . $field_val . '">' . $temp_val . '</a>';
}
} elseif ($uitype == 56) {
if ($temp_val == 1) {
示例4: getDetailAssociatedProducts
function getDetailAssociatedProducts()
{
global $log;
$log->debug("Entering getDetailAssociatedProducts() method ...");
global $theme;
global $log;
global $app_strings, $current_user;
$theme_path = "themes/" . $theme . "/";
$image_path = $theme_path . "images/";
$fieldlabellist = getProductFieldLabelList("Relsettings");
$fieldnamelist = getProductFieldList("Relsettings");
$output = "";
$output .= '<table width="100%" border="0" align="center" cellpadding="5" cellspacing="0" class="crmTable" id="proTab">
<tr valign="top">
<td colspan="50" class="dvInnerHeader"><b>' . $app_strings['LBL_PRODUCT_DETAILS'] . '</b></td>
</tr>
<tr valign="top">';
foreach ($fieldlabellist as $field) {
$output .= '<td width="' . $field["LABEL_WIDTH"] . '" class="lvtCol"><b>' . $field["LABEL"] . '</b></td>';
}
$output .= '
<td width=10% class="lvtCol"><b>' . $app_strings['LBL_QTY'] . '</b></td>
<td width=10% class="lvtCol" align="left"><b>' . $app_strings['LBL_LIST_PRICE'] . '</b></td>
<td width=15% wrap class="lvtCol" align="left"><b>' . $app_strings['LBL_COMMENT'] . '</b></td>';
$output .= '<td width=15% nowrap class="lvtCol" align="right"><b>' . $app_strings['LBL_PRODUCT_TOTAL'] . '</b></td>';
$output .= '</tr>';
$query = "select ec_products.*,ec_inventoryproductrel.*,ec_products.productid as crmid,ec_catalog.catalogname,ec_vendor.vendorname from ec_inventoryproductrel inner join ec_products on ec_products.productid=ec_inventoryproductrel.productid left join ec_catalog on ec_catalog.catalogid=ec_products.catalogid left join ec_vendor on ec_vendor.vendorid=ec_products.vendor_id where ec_inventoryproductrel.id=" . $this->id . " ORDER BY sequence_no";
$result = $this->db->query($query);
$num_rows = $this->db->num_rows($result);
for ($i = 1; $i <= $num_rows; $i++) {
$productid = $this->db->query_result($result, $i - 1, 'crmid');
$comment = $this->db->query_result($result, $i - 1, 'comment');
if (empty($comment)) {
$comment = " ";
}
$qty = $this->db->query_result($result, $i - 1, 'quantity');
$listprice = $this->db->query_result($result, $i - 1, 'listprice');
$total = $qty * $listprice;
$qty = convertFromDollar($qty, 1);
$listprice = convertFromDollar($listprice, 1);
$total = convertFromDollar($total, 1);
$output .= '<tr valign="top">';
foreach ($fieldnamelist as $fieldname) {
$fieldvalue = $this->db->query_result($result, $i - 1, $fieldname);
if ($fieldname == "productname") {
$output .= '<td class="crmTableRow small lineOnTop" nowrap> <a href="index.php?action=DetailView&module=Products&record=' . $productid . '" target="_blank">' . $fieldvalue . '</a></td>';
} elseif (strpos($fieldname, "price")) {
$fieldvalue = convertFromDollar($fieldvalue, 1);
$output .= '<td class="crmTableRow small lineOnTop" nowrap> ' . $fieldvalue . '</td>';
} else {
$output .= '<td class="crmTableRow small lineOnTop" nowrap> ' . $fieldvalue . '</td>';
}
}
$output .= '<td class="crmTableRow small lineOnTop"> ' . $qty . '</td>';
$output .= '<td class="crmTableRow small lineOnTop"> ' . $listprice . '</td>';
$output .= '<td class="crmTableRow small lineOnTop" valign="bottom" align="left"> ' . $comment . '</td>';
$output .= '<td class="crmTableRow small lineOnTop" align="right"> ' . $total . '</td>';
$output .= '</tr>';
}
$output .= '</table>';
$output .= '<table width="100%" border="0" cellspacing="0" cellpadding="5" class="crmTable">';
$grandTotal = $this->column_fields['total'] != '' ? $this->column_fields['total'] : '0.00';
$grandTotal = convertFromDollar($grandTotal, 1);
$output .= '<tr>';
$output .= '<td class="crmTableRow big lineOnTop" width="80%" style="border-right:1px #dadada;"> </td>';
$output .= '<td align="right" class="crmTableRow small lineOnTop"><b>' . $app_strings['LBL_GRAND_TOTAL'] . '</b></td>';
$output .= '<td align="right" class="crmTableRow small lineOnTop">' . $grandTotal . '</td>';
$output .= '</tr>';
$output .= '</table>';
$log->debug("Exiting getDetailAssociatedProducts method ...");
return $output;
}
示例5: getConvertedPriceFromDollar
/** Function used to get the converted amount from dollar which will be showed to the user
* @param float $price - amount in dollor which we want to convert to the user configured amount
* @return float $conv_price - amount in user configured currency
*/
function getConvertedPriceFromDollar($price)
{
global $current_user;
$currencyid = fetchCurrency($current_user->id);
$rate_symbol = getCurrencySymbolandCRate($currencyid);
$conv_price = convertFromDollar($price, $rate_symbol['rate']);
return $conv_price;
}
示例6: getDisplayValue
/**
* Function that converts the Number into Users Currency
* @param Users $user
* @param Boolean $skipConversion
* @return Formatted Currency
*/
public function getDisplayValue($user = null, $skipConversion = false)
{
global $current_user;
if (empty($user)) {
$user = $current_user;
}
$this->initialize($user);
$value = $this->value;
if ($skipConversion == false) {
$value = convertFromDollar($value, $this->conversionRate);
}
$number = $this->_formatCurrencyValue($value);
return $number;
}
示例7: array
$productlist = array();
$query = "SELECT ec_products.productid as crmid,ec_products.*,ec_catalog.catalogname,ec_vendor.vendorname FROM ec_products left join ec_catalog on ec_catalog.catalogid=ec_products.catalogid left join ec_vendor on ec_vendor.vendorid=ec_products.vendor_id WHERE ec_products.deleted=0 and ec_products.productid in (" . $idlist . ")";
$result = $adb->query($query);
$rownum = $adb->num_rows($result);
if ($rownum > 0) {
for ($i = 0; $i < $rownum; $i++) {
$product = array();
$productid = $adb->query_result($result, $i, 'crmid');
$unit_price = $adb->query_result($result, $i, 'cost_price');
if ($unit_price == null) {
$unit_price = 0;
}
$product["fieldlist"] = $fieldlist;
$product["productid"] = $productid;
$product["listprice"] = $unit_price;
foreach ($fieldlist as $fieldname) {
$fieldvalue = $adb->query_result($result, $i, $fieldname);
if (strpos($fieldname, "price")) {
$fieldvalue = convertFromDollar($fieldvalue, 1);
}
$product[$fieldname] = $fieldvalue;
}
$productlist[] = $product;
unset($product);
}
$json = new Zend_Json();
$jsonproduct = $json->encode($productlist);
$log->info($jsonproduct);
echo $jsonproduct;
}
die;
示例8: getListViewEntries
//.........这里部分代码省略.........
}
} elseif ($field->getUIType() == '27') {
if ($value == 'I') {
$value = getTranslatedString('LBL_INTERNAL', $module);
} elseif ($value == 'E') {
$value = getTranslatedString('LBL_EXTERNAL', $module);
} else {
$value = ' --';
}
} elseif ($field->getFieldDataType() == 'picklist') {
if (!$is_admin && $this->picklistRoleMap[$fieldName] && !in_array($tmpValue, $this->picklistValueMap[$fieldName])) {
$value = "<font color='red'>" . getTranslatedString('LBL_NOT_ACCESSIBLE', $module) . "</font>";
} else {
$value = getTranslatedString($value, $module);
$value = textlength_check($value);
}
} elseif ($field->getFieldDataType() == 'date' || $field->getFieldDataType() == 'datetime') {
if ($value != '' && $value != '0000-00-00') {
$value = getDisplayDate($value);
} elseif ($value == '0000-00-00') {
$value = '';
}
} elseif ($field->getUIType() == 71 || $field->getUIType() == 72) {
if ($value != '') {
if ($fieldName == 'unit_price') {
$currencyId = getProductBaseCurrency($recordId, $module);
$cursym_convrate = getCurrencySymbolandCRate($currencyId);
$value = "<font style='color:grey;'>" . $cursym_convrate['symbol'] . "</font> " . $value;
} else {
$rate = $user_info['conv_rate'];
//changes made to remove vtiger_currency symbol infront of each
//vtiger_potential amount
if ($value != 0) {
$value = convertFromDollar($value, $rate);
}
}
}
} elseif ($field->getFieldDataType() == 'url') {
$value = '<a href="http://' . $rawValue . '" target="_blank">' . $value . '</a>';
} elseif ($field->getFieldDataType() == 'email') {
if ($_SESSION['internal_mailer'] == 1) {
//check added for email link in user detailview
$fieldId = $field->getFieldId();
$value = "<a href=\"javascript:InternalMailer({$recordId},{$fieldId}," . "'{$fieldName}','{$module}','record_id');\">{$value}</a>";
} else {
$value = '<a href="mailto:' . $rawValue . '">' . $value . '</a>';
}
} elseif ($field->getFieldDataType() == 'boolean') {
if ($value == 1) {
$value = getTranslatedString('yes', $module);
} elseif ($value == 0) {
$value = getTranslatedString('no', $module);
} else {
$value = '--';
}
} elseif ($field->getUIType() == 98) {
$value = '<a href="index.php?action=RoleDetailView&module=Settings&parenttab=' . 'Settings&roleid=' . $value . '">' . textlength_check(getRoleName($value)) . '</a>';
} elseif ($field->getFieldDataType() == 'multipicklist') {
$value = $value != "" ? str_replace(' |##| ', ', ', $value) : "";
if (!$is_admin && $value != '') {
$valueArray = $rawValue != "" ? explode(' |##| ', $rawValue) : array();
$notaccess = '<font color="red">' . getTranslatedString('LBL_NOT_ACCESSIBLE', $module) . "</font>";
$tmp = '';
$tmpArray = array();
foreach ($valueArray as $index => $val) {
if (!$listview_max_textlength || !(strlen(preg_replace("/(<\\/?)(\\w+)([^>]*>)/i", "", $tmp)) > $listview_max_textlength)) {
示例9: getOutputHtml
//.........这里部分代码省略.........
}
} elseif ($uitype == 68) {
if (isset($_REQUEST['parent_id']) && $_REQUEST['parent_id'] != '') {
$value = $_REQUEST['parent_id'];
}
if ($value != '') {
$parent_module = getSalesEntityType($value);
if ($parent_module == "Contacts") {
$parent_name = getContactName($value);
$contact_selected = "selected";
} elseif ($parent_module == "Accounts") {
$sql = "select * from vtiger_account where accountid=?";
$result = $adb->pquery($sql, array($value));
$parent_name = $adb->query_result($result, 0, "accountname");
$account_selected = "selected";
} else {
$parent_name = "";
$value = "";
}
}
$editview_label[] = array($app_strings['COMBO_CONTACTS'], $app_strings['COMBO_ACCOUNTS']);
$editview_label[] = array($contact_selected, $account_selected);
$editview_label[] = array("Contacts", "Accounts");
$fieldvalue[] = $parent_name;
$fieldvalue[] = $value;
} elseif ($uitype == 71 || $uitype == 72) {
if ($col_fields['record_id'] != '' && $fieldname == 'unit_price') {
$rate_symbol = getCurrencySymbolandCRate(getProductBaseCurrency($col_fields['record_id'], $module_name));
$fieldvalue[] = $value;
} else {
$currency_id = fetchCurrency($current_user->id);
$rate_symbol = getCurrencySymbolandCRate($currency_id);
$rate = $rate_symbol['rate'];
$fieldvalue[] = convertFromDollar($value, $rate);
}
$currency = $rate_symbol['symbol'];
$editview_label[] = getTranslatedString($fieldlabel, $module_name) . ': (' . $currency . ')';
} elseif ($uitype == 75 || $uitype == 81) {
if ($value != '') {
$vendor_name = getVendorName($value);
} elseif (isset($_REQUEST['vendor_id']) && $_REQUEST['vendor_id'] != '') {
$value = $_REQUEST['vendor_id'];
$vendor_name = getVendorName($value);
}
$pop_type = 'specific';
if ($uitype == 81) {
$pop_type = 'specific_vendor_address';
}
$editview_label[] = getTranslatedString($fieldlabel, $module_name);
$fieldvalue[] = $vendor_name;
$fieldvalue[] = $value;
} elseif ($uitype == 76) {
if ($value != '') {
$potential_name = getPotentialName($value);
} elseif (isset($_REQUEST['potential_id']) && $_REQUEST['potential_id'] != '') {
$value = $_REQUEST['potental_id'];
$potential_name = getPotentialName($value);
}
$editview_label[] = getTranslatedString($fieldlabel, $module_name);
$fieldvalue[] = $potential_name;
$fieldvalue[] = $value;
} elseif ($uitype == 78) {
if ($value != '') {
$quote_name = getQuoteName($value);
} elseif (isset($_REQUEST['quote_id']) && $_REQUEST['quote_id'] != '') {
$value = $_REQUEST['quote_id'];
示例10: getDetailViewOutputHtml
//.........这里部分代码省略.........
$displ_date = '';
} else {
$displ_date = getDisplayDate($col_fields[$fieldname]);
}
if (empty($start_time)) {
$label_fld[] = $displ_date;
} else {
$label_fld[] = $displ_date . ' ' . $start_time;
}
} elseif ($uitype == 5 || $uitype == 23 || $uitype == 70) {
$label_fld[] = getTranslatedString($fieldlabel, $module);
$cur_date_val = $col_fields[$fieldname];
if ($col_fields['time_end'] != '' && ($tabid == 9 || $tabid == 16) && $uitype == 23) {
$end_time = $col_fields['time_end'];
}
if ($cur_date_val == '0000-00-00') {
$display_val = '';
} else {
$display_val = getDisplayDate($cur_date_val);
}
if (empty($end_time)) {
$label_fld[] = $display_val;
} else {
$label_fld[] = $display_val . ' ' . $end_time;
}
} elseif ($uitype == 71 || $uitype == 72) {
$label_fld[] = getTranslatedString($fieldlabel, $module);
if ($fieldname == 'unit_price') {
$rate_symbol = getCurrencySymbolandCRate(getProductBaseCurrency($col_fields['record_id'], $module));
$label_fld[] = $col_fields[$fieldname];
} else {
$rate_symbol = getCurrencySymbolandCRate($user_info['currency_id']);
$rate = $rate_symbol['rate'];
$label_fld[] = convertFromDollar($col_fields[$fieldname], $rate);
}
$currency = $rate_symbol['symbol'];
$label_fld["cursymb"] = $currency;
} elseif ($uitype == 75 || $uitype == 81) {
$label_fld[] = getTranslatedString($fieldlabel, $module);
$vendor_id = $col_fields[$fieldname];
if ($vendor_id != '') {
$vendor_name = getVendorName($vendor_id);
}
$label_fld[] = $vendor_name;
$label_fld["secid"] = $vendor_id;
$label_fld["link"] = "index.php?module=Vendors&action=DetailView&record=" . $vendor_id;
} elseif ($uitype == 76) {
$label_fld[] = getTranslatedString($fieldlabel, $module);
$potential_id = $col_fields[$fieldname];
if ($potential_id != '') {
$potential_name = getPotentialName($potential_id);
}
$label_fld[] = $potential_name;
$label_fld["secid"] = $potential_id;
$label_fld["link"] = "index.php?module=Potentials&action=DetailView&record=" . $potential_id;
} elseif ($uitype == 78) {
$label_fld[] = getTranslatedString($fieldlabel, $module);
$quote_id = $col_fields[$fieldname];
if ($quote_id != '') {
$quote_name = getQuoteName($quote_id);
}
$label_fld[] = $quote_name;
$label_fld["secid"] = $quote_id;
$label_fld["link"] = "index.php?module=Quotes&action=DetailView&record=" . $quote_id;
} elseif ($uitype == 79) {
$label_fld[] = getTranslatedString($fieldlabel, $module);
示例11: getAssociatedProductsFromQuote
function getAssociatedProductsFromQuote($quoteid)
{
global $log;
$log->debug("Entering getAssociatedProductsFromQuote() method ...");
$output = '';
global $current_user;
$product_Detail = array();
$query = "select ec_products.*,ec_inventoryproductrel.*,ec_products.productid as crmid from ec_inventoryproductrel inner join ec_products on ec_products.productid=ec_inventoryproductrel.productid where ec_inventoryproductrel.id=" . $quoteid . " ORDER BY sequence_no";
$fieldlist = getProductFieldList("SalesOrder");
$result = $this->db->query($query);
$num_rows = $this->db->num_rows($result);
for ($i = 1; $i <= $num_rows; $i++) {
$productid = $this->db->query_result($result, $i - 1, 'crmid');
$product_Detail[$i]['delRow' . $i] = "Del";
$product_Detail[$i]['hdnProductId' . $i] = $productid;
foreach ($fieldlist as $fieldname) {
if ($fieldname == "productname") {
$output .= '<td class="crmTableRow small lineOnTop" nowrap> <a href="index.php?action=DetailView&module=Products&record=' . $productid . '" target="_blank">' . $fieldvalue . '</a></td>';
} elseif (strpos($fieldname, "price")) {
$fieldvalue = convertFromDollar($fieldvalue, 1);
$output .= '<td class="crmTableRow small lineOnTop" nowrap> ' . $fieldvalue . '</td>';
} else {
$output .= '<td class="crmTableRow small lineOnTop" nowrap> ' . $fieldvalue . '</td>';
}
if ($fieldname != "imagename") {
$fieldvalue = $this->db->query_result($result, $i - 1, $fieldname);
if (strpos($fieldname, "price")) {
$fieldvalue = convertFromDollar($fieldvalue, 1);
}
} else {
$image_query = 'select ec_attachments.path, ec_attachments.attachmentsid, ec_attachments.name from ec_products left join ec_seattachmentsrel on ec_seattachmentsrel.crmid=ec_products.productid inner join ec_attachments on ec_attachments.attachmentsid=ec_seattachmentsrel.attachmentsid where productid=' . $productid;
$result_image = $this->db->query($image_query);
$nums = $this->db->num_rows($result_image);
if ($nums > 0) {
$image_id = $this->db->query_result($result_image, 0, 'attachmentsid');
$image_name = $this->db->query_result($result_image, 0, 'name');
$image_path = $this->db->query_result($result_image, 0, 'path');
$imagename = $image_path . $image_id . "_" . base64_encode_filename($image_name);
} else {
$imagename = "";
}
}
$product_Detail[$i][$fieldname . $i] = $fieldvalue;
}
$comment = $this->db->query_result($result, $i - 1, 'comment');
$qty = $this->db->query_result($result, $i - 1, 'quantity');
$listprice = $this->db->query_result($result, $i - 1, 'listprice');
$discountPercent = $this->db->query_result($result, $i - 1, 'discount_percent');
$discountAmount = $this->db->query_result($result, $i - 1, 'discount_amount');
if (is_numeric($discountPercent)) {
$discountPercent = $discountPercent * 100;
}
//calculate productTotal
if (is_numeric($discountAmount)) {
$productTotal = $qty * $discountAmount;
} else {
$productTotal = $qty * $listprice;
}
$listprice = getConvertedPriceFromDollar($listprice);
$productTotal = getConvertedPriceFromDollar($productTotal);
$qty = convertFromDollar($qty, 1);
$product_Detail[$i]['qty' . $i] = $qty;
$product_Detail[$i]['listPrice' . $i] = $discountAmount;
$product_Detail[$i]['comment' . $i] = $comment;
$product_Detail[$i]['productTotal' . $i] = $productTotal;
$product_Detail[$i]['netPrice' . $i] = $productTotal;
}
//Get the Final Discount, S&H charge, Tax for S&H and Adjustment values
//To set the Final Discount details
$finalDiscount = '0.00';
$product_Detail[1]['final_details']['discount_type_final'] = 'zero';
$subTotal = $this->column_fields['hdnSubTotal'] != '' ? $this->column_fields['hdnSubTotal'] : '0.00';
$subTotal = getConvertedPriceFromDollar($subTotal);
$discountPercent = $this->column_fields['hdnDiscountPercent'] != '' ? $this->column_fields['hdnDiscountPercent'] : '0.00';
$discountAmount = $this->column_fields['hdnDiscountAmount'] != '' ? $this->column_fields['hdnDiscountAmount'] : '0.00';
if ($this->column_fields['hdnDiscountPercent'] != '' && $this->column_fields['hdnDiscountPercent'] != '0.0') {
$finalDiscount = $subTotal * $discountPercent / 100;
$product_Detail[1]['final_details']['discount_type_final'] = 'percentage';
$product_Detail[1]['final_details']['discount_percentage_final'] = $discountPercent;
$product_Detail[1]['final_details']['checked_discount_percentage_final'] = ' checked';
$product_Detail[1]['final_details']['style_discount_percentage_final'] = ' style="visibility:visible"';
$product_Detail[1]['final_details']['style_discount_amount_final'] = ' style="visibility:hidden"';
} elseif ($this->column_fields['hdnDiscountAmount'] != '') {
$finalDiscount = $this->column_fields['hdnDiscountAmount'];
$finalDiscount = getConvertedPriceFromDollar($finalDiscount);
$discountAmount = getConvertedPriceFromDollar($discountAmount);
$product_Detail[1]['final_details']['discount_type_final'] = 'amount';
$product_Detail[1]['final_details']['discount_amount_final'] = $discountAmount;
$product_Detail[1]['final_details']['checked_discount_amount_final'] = ' checked';
$product_Detail[1]['final_details']['style_discount_amount_final'] = ' style="visibility:visible"';
$product_Detail[1]['final_details']['style_discount_percentage_final'] = ' style="visibility:hidden"';
}
$product_Detail[1]['final_details']['discountTotal_final'] = $finalDiscount;
//To set the Shipping & Handling charge
$shCharge = $this->column_fields['hdnS_H_Amount'] != '' ? $this->column_fields['hdnS_H_Amount'] : '0.00';
$shCharge = getConvertedPriceFromDollar($shCharge);
$product_Detail[1]['final_details']['shipping_handling_charge'] = $shCharge;
//To set the Adjustment value
$adjustment = $this->column_fields['txtAdjustment'] != '' ? $this->column_fields['txtAdjustment'] : '0.00';
$adjustment = getConvertedPriceFromDollar($adjustment);
//.........这里部分代码省略.........
示例12: getDetailAssociatedProducts
/** This function returns a HTML output of associated ec_products for a given entity (Quotes,Invoice,Sales order or Purchase order)
* Param $module - module name
* Param $focus - module object
* Return type string
*/
function getDetailAssociatedProducts($module, $focus)
{
global $log;
//changed by dingjianting on 2007-11-05 for php5.2.x
$log->debug("Entering getDetailAssociatedProducts() method ...");
global $adb;
global $theme;
global $log;
global $app_strings, $current_user;
$theme_path = "themes/" . $theme . "/";
$image_path = $theme_path . "images/";
//changed by dingjianting on 2006-12-29 for gloso project
if ($module != 'PurchaseOrder') {
if ($module == '') {
//changed by dingjianting on 2007-2-25 for gloso project and quote
//$colspan = '4';
$colspan = '7';
} else {
$colspan = '8';
}
} else {
//$colspan = '3';
$colspan = '7';
}
//Get the taxtype of this entity
//$taxtype = getInventoryTaxType($module,$focus->id);
$output = '';
//Header Rows
$output .= '<table width="100%" border="0" align="center" cellpadding="5" cellspacing="0" class="crmTable" id="proTab">
<tr valign="top">
<td colspan="' . $colspan . '" class="dvInnerHeader"><b>' . $app_strings['LBL_PRODUCT_DETAILS'] . '</b></td>
</tr>
<tr valign="top">
<td width=20% class="lvtCol">
<b>' . $app_strings['LBL_PRODUCT_NAME'] . '</b>
</td>';
$output .= '<td width=10% class="lvtCol"><b>' . $app_strings['LBL_PRODUCT_CODE'] . '</b></td>';
$output .= '<td width=15% class="lvtCol"><b>' . $app_strings['LBL_PRODUCT_SERIALNO'] . '</b></td>';
//Add Quantity in Stock column for SO, Quotes and Invoice
if ($module == 'Quotes' || $module == 'SalesOrder' || $module == 'Invoice') {
$output .= '<td width=10% class="lvtCol"><b>' . $app_strings['LBL_QTY_IN_STOCK'] . '</b></td>';
}
$output .= '
<td width=10% class="lvtCol"><b>' . $app_strings['LBL_QTY'] . '</b></td>
<td width=10% class="lvtCol" align="left"><b>' . $app_strings['LBL_LIST_PRICE'] . '</b></td>
<td width=15% wrap class="lvtCol" align="left"><b>' . $app_strings['LBL_COMMENT'] . '</b></td>';
if ($module != '') {
//changed by dingjianting on 2007-2-25 for gloso project and quote
$output .= '
<td width=10% nowrap class="lvtCol" align="right"><b>' . $app_strings['LBL_PRODUCT_TOTAL'] . '</b></td>';
}
$output .= '</tr>';
// DG 15 Aug 2006
// Add "ORDER BY sequence_no" to retain add order on all inventoryproductrel items
if ($module == 'Quotes') {
$query = "select ec_products.productname,ec_products.unit_price,ec_products.qtyinstock,ec_products.productcode,ec_products.serialno, ec_inventoryproductrel.* from ec_inventoryproductrel inner join ec_products on ec_products.productid=ec_inventoryproductrel.productid where id=" . $focus->id . " ORDER BY sequence_no";
} elseif ($module == 'PurchaseOrder') {
$query = "select ec_products.productname,ec_products.unit_price,ec_products.qtyinstock,ec_products.productcode,ec_products.serialno,ec_inventoryproductrel.* from ec_inventoryproductrel inner join ec_products on ec_products.productid=ec_inventoryproductrel.productid where id=" . $focus->id . " ORDER BY sequence_no";
} elseif ($module == 'SalesOrder') {
$query = "select ec_products.productname,ec_products.unit_price,ec_products.qtyinstock,ec_products.productcode,ec_products.serialno,ec_inventoryproductrel.* from ec_inventoryproductrel inner join ec_products on ec_products.productid=ec_inventoryproductrel.productid where id=" . $focus->id . " ORDER BY sequence_no";
} elseif ($module == 'Invoice') {
$query = "select ec_products.productname,ec_products.unit_price,ec_products.qtyinstock,ec_products.productcode,ec_products.serialno,ec_inventoryproductrel.* from ec_inventoryproductrel inner join ec_products on ec_products.productid=ec_inventoryproductrel.productid where id=" . $focus->id . " ORDER BY sequence_no";
}
$result = $adb->query($query);
$num_rows = $adb->num_rows($result);
$netTotal = '0.00';
for ($i = 1; $i <= $num_rows; $i++) {
$productid = $adb->query_result($result, $i - 1, 'productid');
$productname = $adb->query_result($result, $i - 1, 'productname');
$comment = $adb->query_result($result, $i - 1, 'comment');
if (empty($comment)) {
$comment = " ";
}
$qtyinstock = $adb->query_result($result, $i - 1, 'qtyinstock');
$qty = $adb->query_result($result, $i - 1, 'quantity');
$unitprice = $adb->query_result($result, $i - 1, 'unit_price');
$listprice = $adb->query_result($result, $i - 1, 'listprice');
$total = $qty * $listprice;
$unitprice = convertFromDollar($unitprice, 1);
$listprice = convertFromDollar($listprice, 1);
$total = convertFromDollar($total, 1);
$netprice = $total;
$productcode = $adb->query_result($result, $i - 1, 'productcode');
$serial_no = $adb->query_result($result, $i - 1, 'serialno');
//For Product Name
$output .= '
<tr valign="top">
<td class="crmTableRow small lineOnTop"> <a href="index.php?action=DetailView&module=Products&record=' . $productid . '" target="_blank">' . $productname . '</a></td>';
//Upto this added to display the Product name and comment
$output .= '<td class="crmTableRow small lineOnTop" nowrap> ' . $productcode . '</td>';
$output .= '<td class="crmTableRow small lineOnTop" nowrap> ' . $serial_no . '</td>';
if ($module != 'PurchaseOrder') {
$output .= '<td class="crmTableRow small lineOnTop"> ' . $qtyinstock . '</td>';
}
$output .= '<td class="crmTableRow small lineOnTop"> ' . $qty . '</td>';
//.........这里部分代码省略.........