本文整理汇总了PHP中getInventoryCurrencyInfo函数的典型用法代码示例。如果您正苦于以下问题:PHP getInventoryCurrencyInfo函数的具体用法?PHP getInventoryCurrencyInfo怎么用?PHP getInventoryCurrencyInfo使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getInventoryCurrencyInfo函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getData
public function getData()
{
parent::getData();
if (empty($this->_data["currency_id"]) && !empty($this->_id)) {
$this->_currencyData = getInventoryCurrencyInfo($this->getModuleName(), $this->_id);
foreach ($this->_currencyData as $key => $value) {
$this->_data[$key] = $value;
}
$db = PearDatabase::getInstance();
$sql = "select id from vtiger_ws_entity WHERE name = 'Currency'";
$res = $db->query($sql);
$wstabid = $db->query_result($res, 0, "id");
$this->_data["currency_id"] = $wstabid . "x" . $this->_data["currency_id"];
$this->_currencyID = $this->_data["currency_id"];
}
#var_dump($this->_listitems);
return $this->_data;
}
示例2: getDetailAssociatedProducts
/** This function returns a HTML output of associated vtiger_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;
$log->debug("Entering getDetailAssociatedProducts(" . $module . "," . get_class($focus) . ") method ...");
global $adb;
global $mod_strings;
global $theme;
global $log;
global $app_strings, $current_user;
$theme_path = "themes/" . $theme . "/";
$image_path = $theme_path . "images/";
if (vtlib_isModuleActive("Products")) {
$hide_stock = 'no';
} else {
$hide_stock = 'yes';
}
if ($module != 'PurchaseOrder') {
if (GlobalVariable::getVariable('B2B', '1') == '1') {
$acvid = $focus->column_fields['account_id'];
} else {
$acvid = $focus->column_fields['contact_id'];
}
if ($hide_stock == 'no') {
$colspan = '2';
} else {
$colspan = '1';
}
} else {
$acvid = $focus->column_fields['vendor_id'];
$colspan = '1';
}
//Get the taxtype of this entity
$taxtype = getInventoryTaxType($module, $focus->id);
$currencytype = getInventoryCurrencyInfo($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_ITEM_DETAILS'] . '</b></td>
<td class="dvInnerHeader" align="center" colspan="2"><b>' . $app_strings['LBL_CURRENCY'] . ' : </b>' . getTranslatedCurrencyString($currencytype['currency_name']) . ' (' . $currencytype['currency_symbol'] . ')
</td>
<td class="dvInnerHeader" align="center" colspan="2"><b>' . $app_strings['LBL_TAX_MODE'] . ' : </b>' . $app_strings[$taxtype] . '
</td>
</tr>
<tr valign="top">
<td width=40% class="lvtCol"><font color="red">*</font>
<b>' . $app_strings['LBL_ITEM_NAME'] . '</b>
</td>';
//Add Quantity in Stock column for SO, Quotes and Invoice
if (($module == 'Quotes' || $module == 'SalesOrder' || $module == 'Invoice') && $hide_stock == 'no') {
$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="right"><b>' . $app_strings['LBL_LIST_PRICE'] . '</b></td>
<td width=12% nowrap class="lvtCol" align="right"><b>' . $app_strings['LBL_TOTAL'] . '</b></td>
<td width=13% valign="top" class="lvtCol" align="right"><b>' . $app_strings['LBL_NET_PRICE'] . '</b></td>
</tr>
';
// DG 15 Aug 2006
// Add "ORDER BY sequence_no" to retain add order on all inventoryproductrel items
if ($module == 'Quotes' || $module == 'PurchaseOrder' || $module == 'SalesOrder' || $module == 'Invoice') {
$query = "select case when vtiger_products.productid != '' then vtiger_products.productname else vtiger_service.servicename end as productname," . " case when vtiger_products.productid != '' then 'Products' else 'Services' end as entitytype," . " case when vtiger_products.productid != '' then vtiger_products.unit_price else vtiger_service.unit_price end as unit_price," . " case when vtiger_products.productid != '' then vtiger_products.qtyinstock else 'NA' end as qtyinstock, vtiger_inventoryproductrel.* " . " from vtiger_inventoryproductrel" . " left join vtiger_products on vtiger_products.productid=vtiger_inventoryproductrel.productid " . " left join vtiger_service on vtiger_service.serviceid=vtiger_inventoryproductrel.productid " . " where id=? ORDER BY sequence_no";
}
$result = $adb->pquery($query, array($focus->id));
$num_rows = $adb->num_rows($result);
$netTotal = '0.00';
for ($i = 1; $i <= $num_rows; $i++) {
$sub_prod_query = $adb->pquery("SELECT productid from vtiger_inventorysubproductrel WHERE id=? AND sequence_no=?", array($focus->id, $i));
$subprodname_str = '';
if ($adb->num_rows($sub_prod_query) > 0) {
for ($j = 0; $j < $adb->num_rows($sub_prod_query); $j++) {
$sprod_id = $adb->query_result($sub_prod_query, $j, 'productid');
$sprod_name = getProductName($sprod_id);
$str_sep = "";
if ($j > 0) {
$str_sep = ":";
}
$subprodname_str .= $str_sep . " - " . $sprod_name;
}
}
$subprodname_str = str_replace(":", "<br>", $subprodname_str);
$productid = $adb->query_result($result, $i - 1, 'productid');
$entitytype = $adb->query_result($result, $i - 1, 'entitytype');
$productname = $adb->query_result($result, $i - 1, 'productname');
$productname = '<a href="index.php?action=DetailView&record=' . $productid . '&module=' . $entitytype . '">' . $productname . '</a>';
if ($subprodname_str != '') {
$productname .= "<br/><span style='color:#C0C0C0;font-style:italic;'>" . $subprodname_str . "</span>";
}
$comment = $adb->query_result($result, $i - 1, 'comment');
$qtyinstock = $adb->query_result($result, $i - 1, 'qtyinstock');
$qty = $adb->query_result($result, $i - 1, 'quantity');
//.........这里部分代码省略.........
示例3: getListViewRecords
//.........这里部分代码省略.........
$timeFieldValue = $this->db->query_result($result, $i, $timeField);
if (!empty($timeFieldValue)) {
$value .= ' ' . $timeFieldValue;
//TO make sure it takes time value as well
$fieldDataType = 'datetime';
}
}
if ($fieldDataType == 'datetime') {
$value = Vtiger_Datetime_UIType::getDateTimeValue($value);
} else {
if ($fieldDataType == 'date') {
$date = new DateTimeField($value);
$value = $date->getDisplayDate();
}
}
} elseif ($value == '0000-00-00') {
$value = '';
}
} elseif ($field->getFieldDataType() == 'time') {
if (!empty($value)) {
$userModel = Users_Privileges_Model::getCurrentUserModel();
if ($userModel->get('hour_format') == '12') {
$value = Vtiger_Time_UIType::getTimeValueInAMorPM($value);
}
}
} elseif ($field->getFieldDataType() == 'currency') {
if ($value != '') {
if ($field->getUIType() == 72) {
if ($fieldName == 'unit_price') {
$currencyId = getProductBaseCurrency($recordId, $module);
$cursym_convrate = getCurrencySymbolandCRate($currencyId);
$currencySymbol = $cursym_convrate['symbol'];
} else {
$currencyInfo = getInventoryCurrencyInfo($module, $recordId);
$currencySymbol = $currencyInfo['currency_symbol'];
}
$value = CurrencyField::convertToUserFormat($value, null, true);
$row['currencySymbol'] = $currencySymbol;
$value = CurrencyField::appendCurrencySymbol($value, $currencySymbol);
} else {
if (!empty($value)) {
$value = CurrencyField::convertToUserFormat($value);
$currencyModal = new CurrencyField($value);
$currencyModal->initialize();
$value = $currencyModal->appendCurrencySymbol($value, $currencyModal->currencySymbol);
}
}
}
} elseif ($field->getFieldDataType() == 'url') {
$matchPattern = "^[\\w]+:\\/\\/^";
preg_match($matchPattern, $rawValue, $matches);
if (!empty($matches[0])) {
$value = '<a class="urlField cursorPointer" title="' . $rawValue . '" href="' . $rawValue . '" target="_blank">' . textlength_check($value) . '</a>';
} else {
$value = '<a class="urlField cursorPointer" title="' . $rawValue . '" href="http://' . $rawValue . '" target="_blank">' . textlength_check($value) . '</a>';
}
} elseif ($field->getFieldDataType() == 'email') {
$current_user = vglobal('current_user');
if ($current_user->internal_mailer == 1) {
//check added for email link in user detailview
$value = "<a class='emailField' onclick=\"Vtiger_Helper_Js.getInternalMailer({$recordId}," . "'{$fieldName}','{$module}');\">" . textlength_check($value) . "</a>";
} else {
$value = '<a class="emailField" href="mailto:' . $rawValue . '">' . textlength_check($value) . '</a>';
}
} elseif ($field->getFieldDataType() == 'boolean') {
if ($value === 'on') {
示例4: getValue
//.........这里部分代码省略.........
if ($email_check == 1) {
$email_check = 4;
} else {
$email_check = 3;
}
}
}
$querystr = "SELECT fieldid,fieldlabel,columnname FROM vtiger_field WHERE tabid=? and uitype=13 and vtiger_field.presence in (0,2)";
$queryres = $adb->pquery($querystr, array(getTabid($module)));
//Change this index 0 - to get the vtiger_fieldid based on email or yahooid
$fieldid = $adb->query_result($queryres, 0, 'fieldid');
$slashes_name = popup_from_html($name);
$slashes_name = htmlspecialchars($slashes_name, ENT_QUOTES, $default_charset);
$value = '<a href="javascript:window.close();" onclick=\'return set_return_emails(' . $entity_id . ',' . $fieldid . ',"' . decode_html($slashes_name) . '","' . $emailaddress . '","' . $emailaddress2 . '","' . $email_check . '"); \'>' . $name . '</a>';
} else {
$firstname = $adb->query_result($list_result, $list_result_count, "first_name");
$lastname = $adb->query_result($list_result, $list_result_count, "last_name");
$name = $lastname . ' ' . $firstname;
$emailaddress = $adb->query_result($list_result, $list_result_count, "email1");
$slashes_name = popup_from_html($name);
$slashes_name = htmlspecialchars($slashes_name, ENT_QUOTES, $default_charset);
$email_check = 1;
$value = '<a href="javascript:window.close();" onclick=\'return set_return_emails(' . $entity_id . ',-1,"' . decode_html($slashes_name) . '","' . $emailaddress . '","' . $emailaddress2 . '","' . $email_check . '"); \'>' . textlength_check($name) . '</a>';
}
} elseif ($popuptype == "specific_vendor_address") {
require_once 'modules/Vendors/Vendors.php';
$acct_focus = new Vendors();
$acct_focus->retrieve_entity_info($entity_id, "Vendors");
$slashes_temp_val = popup_from_html($temp_val);
$slashes_temp_val = htmlspecialchars($slashes_temp_val, ENT_QUOTES, $default_charset);
$xyz = array('street', 'city', 'postalcode', 'pobox', 'country', 'state');
for ($i = 0; $i < 6; $i++) {
if (getFieldVisibilityPermission($module, $current_user->id, $xyz[$i]) == '0') {
$acct_focus->column_fields[$xyz[$i]] = $acct_focus->column_fields[$xyz[$i]];
} else {
$acct_focus->column_fields[$xyz[$i]] = '';
}
}
$bill_street = str_replace(array("\r", "\n"), array('\\r', '\\n'), popup_decode_html($acct_focus->column_fields['street']));
$value = '<a href="javascript:window.close();" onclick=\'set_return_address("' . $entity_id . '", "' . nl2br(decode_html($slashes_temp_val)) . '", "' . $bill_street . '", "' . popup_decode_html($acct_focus->column_fields['city']) . '", "' . popup_decode_html($acct_focus->column_fields['state']) . '", "' . popup_decode_html($acct_focus->column_fields['postalcode']) . '", "' . popup_decode_html($acct_focus->column_fields['country']) . '","' . popup_decode_html($acct_focus->column_fields['pobox']) . '");\'>' . $temp_val . '</a>';
} elseif ($popuptype == "specific_campaign") {
$slashes_temp_val = popup_from_html($temp_val);
$slashes_temp_val = htmlspecialchars($slashes_temp_val, ENT_QUOTES, $default_charset);
$value = '<a href="javascript:window.close();" onclick=\'set_return_specific_campaign("' . $entity_id . '", "' . nl2br(decode_html($slashes_temp_val)) . '");\'>' . $temp_val . '</a>';
} else {
if ($colname == "lastname") {
$temp_val = getFullNameFromQResult($list_result, $list_result_count, $module);
}
$slashes_temp_val = popup_from_html($temp_val);
$slashes_temp_val = htmlspecialchars($slashes_temp_val, ENT_QUOTES, $default_charset);
$log->debug("Exiting getValue method ...");
if ($_REQUEST['maintab'] == 'Calendar') {
$value = '<a href="javascript:window.close();" onclick=\'set_return_todo("' . $entity_id . '", "' . nl2br(decode_html($slashes_temp_val)) . '");\'>' . $temp_val . '</a>';
} else {
$value = '<a href="javascript:window.close();" onclick=\'set_return("' . $entity_id . '", "' . nl2br(decode_html($slashes_temp_val)) . '");\'>' . $temp_val . '</a>';
}
}
} else {
if ($module == "Leads" && $colname == "lastname" || $module == "Contacts" && $colname == "lastname") {
$value = '<a href="index.php?action=DetailView&module=' . $module . '&record=' . $entity_id . '&parenttab=' . $tabname . '">' . $temp_val . '</a>';
} elseif ($module == "Calendar") {
$actvity_type = $adb->query_result($list_result, $list_result_count, 'activitytype');
$actvity_type = $actvity_type != '' ? $actvity_type : $adb->query_result($list_result, $list_result_count, 'type');
if ($actvity_type == "Task") {
$value = '<a href="index.php?action=DetailView&module=' . $module . '&record=' . $entity_id . '&activity_mode=Task&parenttab=' . $tabname . '">' . $temp_val . '</a>';
} else {
$value = '<a href="index.php?action=DetailView&module=' . $module . '&record=' . $entity_id . '&activity_mode=Events&parenttab=' . $tabname . '">' . $temp_val . '</a>';
}
} elseif ($module == "Vendors") {
$value = '<a href="index.php?action=DetailView&module=Vendors&record=' . $entity_id . '&parenttab=' . $tabname . '">' . $temp_val . '</a>';
} elseif ($module == "PriceBooks") {
$value = '<a href="index.php?action=DetailView&module=PriceBooks&record=' . $entity_id . '&parenttab=' . $tabname . '">' . $temp_val . '</a>';
} elseif ($module == "SalesOrder") {
$value = '<a href="index.php?action=DetailView&module=SalesOrder&record=' . $entity_id . '&parenttab=' . $tabname . '">' . $temp_val . '</a>';
} elseif ($module == 'Emails') {
$value = $temp_val;
} else {
$value = '<a href="index.php?action=DetailView&module=' . $module . '&record=' . $entity_id . '&parenttab=' . $tabname . '">' . $temp_val . '</a>';
}
}
} elseif ($fieldname == 'expectedroi' || $fieldname == 'actualroi' || $fieldname == 'actualcost' || $fieldname == 'budgetcost' || $fieldname == 'expectedrevenue') {
$rate = $user_info['conv_rate'];
$value = convertFromDollar($temp_val, $rate);
} elseif (($module == 'Invoice' || $module == 'Quotes' || $module == 'PurchaseOrder' || $module == 'SalesOrder') && ($fieldname == 'hdnGrandTotal' || $fieldname == 'hdnSubTotal' || $fieldname == 'txtAdjustment' || $fieldname == 'hdnDiscountAmount' || $fieldname == 'hdnS_H_Amount')) {
$currency_info = getInventoryCurrencyInfo($module, $entity_id);
$currency_id = $currency_info['currency_id'];
$currency_symbol = $currency_info['currency_symbol'];
$value = $currency_symbol . $temp_val;
} else {
$value = $temp_val;
}
}
}
// Mike Crowe Mod --------------------------------------------------------Make right justified and vtiger_currency value
if (in_array($uitype, array(71, 72, 7, 9, 90))) {
$value = '<span align="right">' . $value . '</div>';
}
$log->debug("Exiting getValue method ...");
return $value;
}
示例5: getAllTaxes
} else {
$smarty->assign("MOD_SEQ_ID", $focus->column_fields[$mod_seq_field['name']]);
}
//if create Invoice, get all available product taxes and shipping & Handling taxes
if ($focus->mode != 'edit') {
$tax_details = getAllTaxes('available');
$sh_tax_details = getAllTaxes('available', 'sh');
} else {
$tax_details = getAllTaxes('available', '', $focus->mode, $focus->id);
$sh_tax_details = getAllTaxes('available', 'sh', 'edit', $focus->id);
}
$smarty->assign('GROUP_TAXES', $tax_details);
$smarty->assign('SH_TAXES', $sh_tax_details);
$smarty->assign("CURRENCIES_LIST", getAllCurrencies());
if ($focus->mode == 'edit') {
$inventory_cur_info = getInventoryCurrencyInfo('Invoice', $focus->id);
$smarty->assign("INV_CURRENCY_ID", $inventory_cur_info['currency_id']);
} else {
$smarty->assign("INV_CURRENCY_ID", $currencyid);
}
$smarty->assign('CREATEMODE', vtlib_purify($_REQUEST['createmode']));
// Gather the help information associated with fields
$smarty->assign('FIELDHELPINFO', vtlib_getFieldHelpInfo($currentModule));
$picklistDependencyDatasource = Vtiger_DependencyPicklist::getPicklistDependencyDatasource($currentModule);
$smarty->assign("PICKIST_DEPENDENCY_DATASOURCE", Zend_Json::encode($picklistDependencyDatasource));
//Get Service or Product by default when create
$smarty->assign('PRODUCT_OR_SERVICE', GlobalVariable::getVariable('product_service_default', 'Products', $currentModule, $current_user->id));
//Set taxt type group or individual by default when create
$smarty->assign('TAX_TYPE', GlobalVariable::getVariable('Tax_Type_Default', 'individual', $currentModule, $current_user->id));
//Show or not the Header to copy address to left or right
$smarty->assign('SHOW_COPY_ADDRESS', GlobalVariable::getVariable('Show_Copy_Adress_Header', 'yes', $currentModule, $current_user->id));
示例6: getModuleSequenceField
// Module Sequence Numbering
$mod_seq_field = getModuleSequenceField($currentModule);
if ($focus->mode != 'edit' && $mod_seq_field != null) {
$autostr = getTranslatedString('MSG_AUTO_GEN_ON_SAVE');
$mod_seq_string = $adb->pquery("SELECT prefix, cur_id from vtiger_modentity_num where semodule = ? and active=1", array($currentModule));
$mod_seq_prefix = $adb->query_result($mod_seq_string, 0, 'prefix');
$mod_seq_no = $adb->query_result($mod_seq_string, 0, 'cur_id');
if ($adb->num_rows($mod_seq_string) == 0 || $focus->checkModuleSeqNumber($focus->table_name, $mod_seq_field['column'], $mod_seq_prefix . $mod_seq_no)) {
echo '<br><font color="#FF0000"><b>' . getTranslatedString('LBL_DUPLICATE') . ' ' . getTranslatedString($mod_seq_field['label']) . ' - ' . getTranslatedString('LBL_CLICK') . ' <a href="index.php?module=Settings&action=CustomModEntityNo&parenttab=Settings&selmodule=' . $currentModule . '">' . getTranslatedString('LBL_HERE') . '</a> ' . getTranslatedString('LBL_TO_CONFIGURE') . ' ' . getTranslatedString($mod_seq_field['label']) . '</b></font>';
} else {
$smarty->assign("MOD_SEQ_ID", $autostr);
}
} else {
$smarty->assign("MOD_SEQ_ID", $focus->column_fields[$mod_seq_field['name']]);
}
// END
$smarty->assign("CURRENCIES_LIST", getAllCurrencies());
if ($focus->mode == 'edit' || $_REQUEST['isDuplicate'] == 'true') {
$inventory_cur_info = getInventoryCurrencyInfo('SalesOrder', $focus->id);
$smarty->assign("INV_CURRENCY_ID", $inventory_cur_info['currency_id']);
} else {
$smarty->assign("INV_CURRENCY_ID", $currencyid);
}
$check_button = Button_Check($module);
$smarty->assign("CHECK", $check_button);
$smarty->assign("DUPLICATE", vtlib_purify($_REQUEST['isDuplicate']));
if ($focus->mode == 'edit') {
$smarty->display("Inventory/InventoryEditView.tpl");
} else {
$smarty->display('Inventory/InventoryCreateView.tpl');
}
示例7: getFieldDisplayValue
function getFieldDisplayValue($moduleName, $recordId, $fieldInstance, $value)
{
global $current_user;
$adb = PearDatabase::getInstance();
$fieldName = $fieldInstance->getFieldName();
$uitype = $fieldInstance->getUIType();
if ($moduleName == 'Documents') {
if ($fieldName == 'filesize') {
$filesize = $value;
if (empty($fieldsize)) {
$value = '--';
} elseif ($filesize < 1024) {
$value = $filesize . ' B';
} elseif ($filesize > 1024 && $filesize < 1048576) {
$value = round($filesize / 1024, 2) . ' KB';
} else {
if ($filesize > 1048576) {
$value = round($filesize / (1024 * 1024), 2) . ' MB';
}
}
}
if ($fieldName == 'filestatus') {
if ($value == 1) {
$value = getTranslatedString('yes', $moduleName);
} elseif ($value == 0) {
$value = getTranslatedString('no', $moduleName);
} else {
$value = '--';
}
}
if ($fieldName == 'filetype') {
if ($value == 1) {
$value = getTranslatedString('yes', $moduleName);
} elseif ($value == 0) {
$value = getTranslatedString('no', $moduleName);
} else {
$value = '--';
}
}
}
if ($fieldInstance->getUIType() == '27') {
if ($value == 'I') {
$value = getTranslatedString('LBL_INTERNAL', $moduleName);
} elseif ($value == 'E') {
$value = getTranslatedString('LBL_EXTERNAL', $moduleName);
} else {
$value = ' --';
}
}
if ($fieldInstance->getFieldDataType() == 'picklist') {
$isRoleBased = vtws_isRoleBasedPicklist($fieldName);
if ($isRoleBased && ($fieldName != 'activitytype' || $value != 'Task')) {
$accessiblePicklistValues = getAssignedPicklistValues($fieldName, $current_user->roleid, $adb);
if (!empty($value) && !is_admin($current_user) && !in_array($value, $accessiblePicklistValues)) {
$value = "<font color='red'>" . getTranslatedString('LBL_NOT_ACCESSIBLE', $moduleName) . "</font>";
} else {
$value = getTranslatedString($value, $moduleName);
}
} else {
$value = getTranslatedString($value, $moduleName);
}
}
if ($fieldInstance->getFieldDataType() == 'date' || $fieldInstance->getFieldDataType() == 'datetime' || $fieldInstance->getFieldDataType() == 'time') {
if ($value != '' && $value != '0000-00-00') {
$date = new DateTimeField($value);
if ($fieldInstance->getFieldDataType() == 'date') {
$value = $date->getDisplayDate();
}
if ($fieldInstance->getFieldDataType() == 'datetime') {
$value = $date->getDisplayDateTimeValue();
}
if ($fieldInstance->getFieldDataType() == 'time') {
$value = $date->getDisplayTime();
}
} else {
$value = '';
}
}
if ($fieldInstance->getFieldDataType() == 'currency') {
if ($value != '' && $value != 0) {
if ($fieldInstance->getUIType() == 72) {
if ($fieldName == 'unit_price') {
$currencyId = getProductBaseCurrency($recordId, $moduleName);
$cursym_convrate = getCurrencySymbolandCRate($currencyId);
$currencySymbol = $cursym_convrate['symbol'];
} else {
$currencyInfo = getInventoryCurrencyInfo($moduleName, $recordId);
$currencySymbol = $currencyInfo['currency_symbol'];
}
$currencyValue = CurrencyField::convertToUserFormat($value, null, true);
$value = CurrencyField::appendCurrencySymbol($currencyValue, $currencySymbol);
} else {
$currencyField = new CurrencyField($value);
$value = $currencyField->getDisplayValueWithSymbol();
}
}
}
if ($fieldInstance->getFieldDataType() == 'url') {
$matchPattern = "^[\\w]+:\\/\\/^";
preg_match($matchPattern, $value, $matches);
//.........这里部分代码省略.........
示例8: getDetailViewDisplayValue
/**
* Function that converts the Number into Users Currency along with currency symbol
* @param Users $user
* @param Boolean $skipConversion
* @return Formatted Currency
*/
public function getDetailViewDisplayValue($value, $recordId, $uiType)
{
$currencyModal = new CurrencyField($value);
$currencyModal->initialize();
if ($uiType == '72' && $recordId) {
$moduleName = $this->get('field')->getModuleName();
if ($this->get('field')->getName() == 'unit_price') {
$currencyId = getProductBaseCurrency($recordId, $moduleName);
$cursym_convrate = getCurrencySymbolandCRate($currencyId);
$currencySymbol = $cursym_convrate['symbol'];
} else {
$currencyInfo = getInventoryCurrencyInfo($moduleName, $recordId);
$currencySymbol = $currencyInfo['currency_symbol'];
}
} else {
$currencySymbol = $currencyModal->currencySymbol;
}
return $currencyModal->appendCurrencySymbol($value, $currencySymbol);
}
示例9: 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 ($value != '' && !$is_admin && $this->picklistRoleMap[$fieldName] && !in_array($value, $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') {
$date = new DateTimeField($value);
$value = $date->getDisplayDate();
if ($field->getFieldDataType() == 'datetime') {
$value .= ' ' . $date->getDisplayTime();
}
} elseif ($value == '0000-00-00') {
$value = '';
}
} elseif ($field->getFieldDataType() == 'currency') {
if ($value != '') {
if ($field->getUIType() == 72) {
if ($fieldName == 'unit_price') {
$currencyId = getProductBaseCurrency($recordId, $module);
$cursym_convrate = getCurrencySymbolandCRate($currencyId);
$currencySymbol = $cursym_convrate['symbol'];
} else {
$currencyInfo = getInventoryCurrencyInfo($module, $recordId);
$currencySymbol = $currencyInfo['currency_symbol'];
}
$value = number_format($value, 2, '.', '');
$currencyValue = CurrencyField::convertToUserFormat($value, null, true);
$value = CurrencyField::appendCurrencySymbol($currencyValue, $currencySymbol);
} else {
//changes made to remove vtiger_currency symbol infront of each
//vtiger_potential amount
if ($value != 0) {
$value = CurrencyField::convertToUserFormat($value);
}
}
}
} elseif ($field->getFieldDataType() == 'url') {
$matchPattern = "^[\\w]+:\\/\\/^";
preg_match($matchPattern, $rawValue, $matches);
if (!empty($matches[0])) {
$value = '<a href="' . $rawValue . '" target="_blank">' . textlength_check($value) . '</a>';
} else {
$value = '<a href="http://' . $rawValue . '" target="_blank">' . textlength_check($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');\">" . textlength_check($value) . "</a>";
} else {
$value = '<a href="mailto:' . $rawValue . '">' . textlength_check($value) . '</a>';
}
} elseif ($field->getFieldDataType() == 'boolean') {
if ($value == 1) {
$value = getTranslatedString('yes', $module);
示例10: getAllTaxes
}
} else {
$smarty->assign("MOD_SEQ_ID", $focus->column_fields[$mod_seq_field['name']]);
}
//if create SO, get all available product taxes and shipping & Handling taxes
if ($focus->mode != 'edit') {
$tax_details = getAllTaxes('available');
$sh_tax_details = getAllTaxes('available', 'sh');
} else {
$tax_details = getAllTaxes('available', '', $focus->mode, $focus->id);
$sh_tax_details = getAllTaxes('available', 'sh', 'edit', $focus->id);
}
$smarty->assign('GROUP_TAXES', $tax_details);
$smarty->assign('SH_TAXES', $sh_tax_details);
$smarty->assign("CURRENCIES_LIST", getAllCurrencies());
if ($focus->mode == 'edit') {
$inventory_cur_info = getInventoryCurrencyInfo('Issuecards', $focus->id);
$smarty->assign("INV_CURRENCY_ID", $inventory_cur_info['currency_id']);
} else {
$smarty->assign("INV_CURRENCY_ID", $currencyid);
}
$smarty->assign('CREATEMODE', vtlib_purify($_REQUEST['createmode']));
// Gather the help information associated with fields
$smarty->assign('FIELDHELPINFO', vtlib_getFieldHelpInfo($currentModule));
$picklistDependencyDatasource = Vtiger_DependencyPicklist::getPicklistDependencyDatasource($currentModule);
$smarty->assign("PICKIST_DEPENDENCY_DATASOURCE", Zend_Json::encode($picklistDependencyDatasource));
//Get Service or Product by default when create
$smarty->assign('PRODUCT_OR_SERVICE', GlobalVariable::getVariable('product_service_default', 'Products', $currentModule, $current_user->id));
//Set taxt type group or individual by default when create
$smarty->assign('TAX_TYPE', GlobalVariable::getVariable('Tax_Type_Default', 'individual', $currentModule, $current_user->id));
$smarty->display('Inventory/InventoryEditView.tpl');
示例11: getOutputHtml
//.........这里部分代码省略.........
array_push($editview_label[1], $account_selected);
array_push($editview_label[2], "Accounts");
}
if (vtlib_isModuleActive('Contacts')) {
array_push($editview_label[0], $app_strings['COMBO_CONTACTS']);
array_push($editview_label[1], $contact_selected);
array_push($editview_label[2], "Contacts");
}
$fieldvalue[] = $parent_name;
$fieldvalue[] = $value;
} elseif ($uitype == 9 || $uitype == 7) {
$editview_label[] = getTranslatedString($fieldlabel, $module_name);
$fldrs = $adb->pquery('select typeofdata from vtiger_field
where vtiger_field.fieldname=? and vtiger_field.tabid=?', array($fieldname, getTabid($module_name)));
$typeofdata = $adb->query_result($fldrs, 0, 0);
$typeinfo = explode('~', $typeofdata);
if ($typeinfo[0] == 'I') {
$fieldvalue[] = $value;
} else {
$currencyField = new CurrencyField($value);
$decimals = CurrencyField::getDecimalsFromTypeOfData($typeofdata);
$currencyField->initialize($current_user);
$currencyField->setNumberofDecimals(min($decimals, $currencyField->getCurrencyDecimalPlaces()));
$fieldvalue[] = $currencyField->getDisplayValue(null, false, true);
}
} elseif ($uitype == 71 || $uitype == 72) {
$currencyField = new CurrencyField($value);
// Some of the currency fields like Unit Price, Total, Sub-total etc of Inventory modules, do not need currency conversion
if ($col_fields['record_id'] != '' && $uitype == 72) {
if ($fieldname == 'unit_price') {
$rate_symbol = getCurrencySymbolandCRate(getProductBaseCurrency($col_fields['record_id'], $module_name));
$currencySymbol = $rate_symbol['symbol'];
} else {
$currency_info = getInventoryCurrencyInfo($module, $col_fields['record_id']);
$currencySymbol = $currency_info['currency_symbol'];
}
$fieldvalue[] = $currencyField->getDisplayValue(null, true);
} else {
$decimals = CurrencyField::getDecimalsFromTypeOfData($typeofdata);
$currencyField->initialize($current_user);
$currencyField->setNumberofDecimals(min($decimals, $currencyField->getCurrencyDecimalPlaces()));
$fieldvalue[] = $currencyField->getDisplayValue(null, false, true);
$currencySymbol = $currencyField->getCurrencySymbol();
}
$editview_label[] = getTranslatedString($fieldlabel, $module_name) . ': (' . $currencySymbol . ')';
} 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);
}
示例12: getDetailAssociatedProducts
/** This function returns a HTML output of associated vtiger_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;
$log->debug("Entering getDetailAssociatedProducts(" . $module . "," . get_class($focus) . ") method ...");
global $adb, $default_charset;
global $mod_strings;
global $theme;
global $log;
global $app_strings, $current_user, $current_language;
$theme_path = "themes/" . $theme . "/";
$image_path = $theme_path . "images/";
//crm-now: added to select comma or dot as numberformat
//European Format
if ($current_language == 'en_us') {
//US Format
$decimal_precision = 2;
$decimals_separator = '.';
$thousands_separator = ',';
} else {
//European Format
$decimal_precision = 2;
$decimals_separator = ',';
$thousands_separator = '.';
}
if ($module != 'PurchaseOrder') {
$colspan = '2';
} else {
$colspan = '1';
}
//Get the taxtype of this entity
$taxtype = getInventoryTaxType($module, $focus->id);
$currencytype = getInventoryCurrencyInfo($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_ITEM_DETAILS'] . '</b></td>
<td class="dvInnerHeader" align="center" colspan="2"><b>' . $app_strings['LBL_CURRENCY'] . ' : </b>' . getTranslatedCurrencyString($currencytype['currency_name']) . ' (' . $currencytype['currency_symbol'] . ')
</td>
<td class="dvInnerHeader" align="center" colspan="2"><b>' . $app_strings['LBL_TAX_MODE'] . ' : </b>' . $app_strings[$taxtype] . '
</td>
</tr>
<tr valign="top">
<td width=40% class="lvtCol"><font color="red">*</font>
<b>' . $app_strings['LBL_ITEM_NAME'] . '</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="right"><b>' . $app_strings['LBL_LIST_PRICE'] . '</b></td>
<td width=12% nowrap class="lvtCol" align="right"><b>' . $app_strings['LBL_TOTAL'] . '</b></td>
<td width=13% valign="top" class="lvtCol" align="right"><b>' . $app_strings['LBL_NET_PRICE'] . '</b></td>
</tr>
';
// DG 15 Aug 2006
// Add "ORDER BY sequence_no" to retain add order on all inventoryproductrel items
if ($module == 'Quotes' || $module == 'PurchaseOrder' || $module == 'SalesOrder' || $module == 'Invoice') {
$query = "select case when vtiger_products.productid != '' then vtiger_products.productname else vtiger_service.servicename end as productname," . " case when vtiger_products.productid != '' then 'Products' else 'Services' end as entitytype," . " case when vtiger_products.productid != '' then vtiger_products.unit_price else vtiger_service.unit_price end as unit_price," . " case when vtiger_products.productid != '' then vtiger_products.productcode else 'NA' end as productcode," . " case when vtiger_products.productid != '' then vtiger_products.qtyinstock else 'NA' end as qtyinstock, vtiger_inventoryproductrel.* " . " from vtiger_inventoryproductrel" . " left join vtiger_products on vtiger_products.productid=vtiger_inventoryproductrel.productid " . " left join vtiger_service on vtiger_service.serviceid=vtiger_inventoryproductrel.productid " . " where id=? ORDER BY sequence_no";
}
$result = $adb->pquery($query, array($focus->id));
$num_rows = $adb->num_rows($result);
$netTotal = '0.00';
for ($i = 1; $i <= $num_rows; $i++) {
$sub_prod_query = $adb->pquery("SELECT productid from vtiger_inventorysubproductrel WHERE id=? AND sequence_no=?", array($focus->id, $i));
$subprodname_str = '';
if ($adb->num_rows($sub_prod_query) > 0) {
for ($j = 0; $j < $adb->num_rows($sub_prod_query); $j++) {
$sprod_id = $adb->query_result($sub_prod_query, $j, 'productid');
$sprod_name = getProductName($sprod_id);
$str_sep = "";
if ($j > 0) {
$str_sep = ":";
}
$subprodname_str .= $str_sep . " - " . $sprod_name;
}
}
$subprodname_str = str_replace(":", "<br>", $subprodname_str);
$productid = $adb->query_result($result, $i - 1, 'productid');
$entitytype = $adb->query_result($result, $i - 1, 'entitytype');
$productname = $adb->query_result($result, $i - 1, 'productname');
//crm-now added to display product code and description
$productcode = $adb->query_result($result, $i - 1, 'productcode');
//html to utf8 conversion (necessary because stored at inventoryproductrel table)
$productdescription = nl2br($adb->query_result($result, $i - 1, 'description'));
$productdescription = html_entity_decode($productdescription, ENT_QUOTES, $default_charset);
$comment = nl2br(from_html($adb->query_result($result, $i - 1, 'comment')));
if ($subprodname_str != '') {
$productname .= "<br/><span style='color:#C0C0C0;font-style:italic;'>" . $subprodname_str . "</span>";
}
//.........这里部分代码省略.........
示例13: getListViewRecords
//.........这里部分代码省略.........
$timeField = 'time_end';
}
}
$timeFieldValue = $this->db->query_result($result, $i, $timeField);
if (!empty($timeFieldValue)) {
$value .= ' ' . $timeFieldValue;
//TO make sure it takes time value as well
$fieldDataType = 'datetime';
}
}
if ($fieldDataType == 'datetime') {
$value = Vtiger_Datetime_UIType::getDateTimeValue($value);
} else {
if ($fieldDataType == 'date') {
$date = new DateTimeField($value);
$value = $date->getDisplayDate();
}
}
} elseif ($value == '0000-00-00') {
$value = '';
}
} elseif ($field->getFieldDataType() == 'time') {
if (!empty($value)) {
$value = Vtiger_Time_UIType::getTimeValueInAMorPM($value);
}
} elseif ($field->getFieldDataType() == 'currency') {
if ($value != '') {
if ($field->getUIType() == 72) {
if ($fieldName == 'unit_price') {
$currencyId = getProductBaseCurrency($recordId, $module);
$cursym_convrate = getCurrencySymbolandCRate($currencyId);
$currencySymbol = $cursym_convrate['symbol'];
} else {
$currencyInfo = getInventoryCurrencyInfo($module, $recordId);
$currencySymbol = $currencyInfo['currency_symbol'];
}
$value = CurrencyField::convertToUserFormat($value, null, true);
$row['currencySymbol'] = $currencySymbol;
// $value = CurrencyField::appendCurrencySymbol($currencyValue, $currencySymbol);
} else {
if (!empty($value)) {
$value = CurrencyField::convertToUserFormat($value);
}
}
}
} elseif ($field->getFieldDataType() == 'url') {
$matchPattern = "^[\\w]+:\\/\\/^";
preg_match($matchPattern, $rawValue, $matches);
if (!empty($matches[0])) {
$value = '<a class="urlField cursorPointer" href="' . $rawValue . '" target="_blank">' . textlength_check($value) . '</a>';
} else {
$value = '<a class="urlField cursorPointer" href="http://' . $rawValue . '" target="_blank">' . textlength_check($value) . '</a>';
}
} elseif ($field->getFieldDataType() == 'email') {
global $current_user;
if ($current_user->internal_mailer == 1) {
//check added for email link in user detailview
$value = "<a class='emailField' onclick=\"Vtiger_Helper_Js.getInternalMailer({$recordId}," . "'{$fieldName}');\">" . textlength_check($value) . "</a>";
} else {
$value = '<a class="emailField" href="mailto:' . $rawValue . '">' . textlength_check($value) . '</a>';
}
} elseif ($field->getFieldDataType() == 'boolean') {
if ($value === 'on') {
$value = 1;
} else {
if ($value == 'off') {
示例14: 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 ($value != '' && !$is_admin && $this->picklistRoleMap[$fieldName] && !in_array($value, $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') {
$date = new DateTimeField($value);
$value = $date->getDisplayDate();
if ($field->getFieldDataType() == 'datetime') {
$value .= ' ' . $date->getDisplayTime();
}
} elseif ($value == '0000-00-00') {
$value = '';
}
} elseif ($field->getFieldDataType() == 'currency') {
if ($value != '') {
if ($field->getUIType() == 72) {
if ($fieldName == 'unit_price') {
$currencyId = getProductBaseCurrency($recordId, $module);
$cursym_convrate = getCurrencySymbolandCRate($currencyId);
$currencySymbol = $cursym_convrate['symbol'];
} else {
$currencyInfo = getInventoryCurrencyInfo($module, $recordId);
$currencySymbol = $currencyInfo['currency_symbol'];
}
$value = number_format($value, 2, '.', '');
$currencyValue = CurrencyField::convertToUserFormat($value, null, true);
$value = CurrencyField::appendCurrencySymbol($currencyValue, $currencySymbol);
} else {
//changes made to remove vtiger_currency symbol in front of each potential amount
if ($value != 0) {
$value = CurrencyField::convertToUserFormat($value);
}
}
}
} elseif ($field->getFieldDataType() == 'url') {
$matchPattern = "^[\\w]+:\\/\\/^";
preg_match($matchPattern, $rawValue, $matches);
if (!empty($matches[0])) {
$value = '<a href="' . $rawValue . '" target="_blank">' . textlength_check($value) . '</a>';
} else {
$value = '<a href="http://' . $rawValue . '" target="_blank">' . textlength_check($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');\">" . textlength_check($value) . "</a>";
} else {
$value = '<a href="mailto:' . $rawValue . '">' . textlength_check($value) . '</a>';
}
} elseif ($field->getFieldDataType() == 'boolean') {
if ($value == 1) {
$value = getTranslatedString('yes', $module);
} elseif ($value == 0) {
示例15: getAllTaxes
} else {
$smarty->assign("MOD_SEQ_ID", $focus->column_fields[$mod_seq_field['name']]);
}
//if create PO, get all available product taxes and shipping & Handling taxes
if ($focus->mode != 'edit') {
$tax_details = getAllTaxes('available');
$sh_tax_details = getAllTaxes('available', 'sh');
} else {
$tax_details = getAllTaxes('available', '', $focus->mode, $focus->id);
$sh_tax_details = getAllTaxes('available', 'sh', 'edit', $focus->id);
}
$smarty->assign('GROUP_TAXES', $tax_details);
$smarty->assign('SH_TAXES', $sh_tax_details);
$smarty->assign("CURRENCIES_LIST", getAllCurrencies());
if ($focus->mode == 'edit') {
$inventory_cur_info = getInventoryCurrencyInfo('PurchaseOrder', $focus->id);
$smarty->assign("INV_CURRENCY_ID", $inventory_cur_info['currency_id']);
} else {
$smarty->assign("INV_CURRENCY_ID", $currencyid);
}
$smarty->assign('CREATEMODE', vtlib_purify($_REQUEST['createmode']));
// Gather the help information associated with fields
$smarty->assign('FIELDHELPINFO', vtlib_getFieldHelpInfo($currentModule));
$picklistDependencyDatasource = Vtiger_DependencyPicklist::getPicklistDependencyDatasource($currentModule);
$smarty->assign("PICKIST_DEPENDENCY_DATASOURCE", Zend_Json::encode($picklistDependencyDatasource));
//Get Service or Product by default when create
$smarty->assign('PRODUCT_OR_SERVICE', GlobalVariable::getVariable('product_service_default', 'Products', $currentModule, $current_user->id));
//Set taxt type group or individual by default when create
$smarty->assign('TAX_TYPE', GlobalVariable::getVariable('Tax_Type_Default', 'individual', $currentModule, $current_user->id));
//Show or not the Header to copy address to left or right
$smarty->assign('SHOW_COPY_ADDRESS', GlobalVariable::getVariable('Show_Copy_Adress_Header', 'yes', $currentModule, $current_user->id));