本文整理汇总了PHP中CurrencyField::getDBInsertedValue方法的典型用法代码示例。如果您正苦于以下问题:PHP CurrencyField::getDBInsertedValue方法的具体用法?PHP CurrencyField::getDBInsertedValue怎么用?PHP CurrencyField::getDBInsertedValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CurrencyField
的用法示例。
在下文中一共展示了CurrencyField::getDBInsertedValue方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: amount_in_words
function amount_in_words($module, $id, $templateid, $content, $tcpdf)
{
$db = PearDatabase::getInstance();
$current_language = Users_Record_Model::getCurrentUserModel()->get('language');
if (!file_exists("languages/" . $current_language . "/OSSPdf.php")) {
$current_language = "en_us";
}
$mod = $module;
$module = strtolower($module);
if ($module == 'quotes') {
$idcol = "quoteid";
} else {
$idcol = $module . "id";
}
$sql = "SELECT total FROM vtiger_{$module} WHERE {$idcol} = " . $id;
$result = $db->query($sql, true);
$grand_total = $db->query_result($result, 0, 'total');
$currfield = new CurrencyField($grand_total);
$grand_total = $currfield->getDBInsertedValue($grand_total);
require_once 'include/utils/utils.php';
require_once 'include/utils/CommonUtils.php';
require_once 'modules/' . $mod . '/' . $mod . '.php';
$focus = new $mod();
$focus->retrieve_entity_info($id, $mod);
$currency_id = $focus->column_fields['currency_id'];
$pobierz = $db->query("select currency_symbol, currency_code from vtiger_currency_info where id = '{$currency_id}'", true);
$kod_aktualnej_waluty = $db->query_result($pobierz, 0, "currency_code");
$recordModel = Vtiger_Record_Model::getCleanInstance('OSSPdf');
$kwota = $recordModel->slownie($grand_total, $kod_aktualnej_waluty);
return $kwota;
}
示例2: replaceProductTableNP
//.........这里部分代码省略.........
$prod_total[$i] = $producttotal;
$product_line[$j]["Product Code"] = $product_code[$i];
$product_line[$j]["Qty"] = $qty[$i];
$product_line[$j]["Price"] = $list_price[$i];
$product_line[$j]["Discount"] = $discount_total[$i];
$product_line[$j]["Total"] = $prod_total[$i];
$lines++;
$product_line[$j]["Product Name"] = decode_html($product_name[$i]);
$prod_line[$j] = 1;
for ($count = 0; $count < count($subproduct_name[$i]); $count++) {
if ($lines % 12 != 0) {
$product_line[$j]["Product Name"] .= "\n" . decode_html($subproduct_name[$i][$count]);
$prod_line[$j]++;
} else {
$j++;
$product_line[$j]["Product Name"] = decode_html($product_name[$i]);
$product_line[$j]["Product Name"] .= "\n" . decode_html($subproduct_name[$i][$count]);
$prod_line[$j] = 2;
$lines++;
}
$lines++;
}
if ($comment[$i] != '') {
$product_line[$j]["Product Name"] .= "\n" . decode_html($comment[$i]);
$prod_line[$j]++;
$lines++;
}
}
$price_salestax = number_format($price_salestax, 2, '.', ',');
$header = array($mod_strings['LBL_nr'], $mod_strings['LBL_productname'], $mod_strings['LBL_Quantity'], $mod_strings['LBL_price'], $mod_strings['LBL_netto'], $mod_strings['LBL_rabat'], $mod_strings['LBL_vat'], $mod_strings['LBL_brutto']);
$data = array();
$i = 0;
foreach ($product_line as $item) {
$data[$i++] = array($i, $item['Product Name'], $item['Qty'], $item['Price'], $item['Price'] * $item['Qty'], $item['Discount'], 'NP', $item['Total']);
}
$width = array(30, 245, 35, 45, 45, 45, 45, 45);
$align = array("center", "center", "center", "center", "center", "center", "center", "center");
$format = array(0, "s", 0, 2, 2, 2, "np", 2);
$product_table = '<table border="1" cellpadding="2">';
$product_table .= '<tr valign="middle">';
for ($i = 0; $i < count($header); $i++) {
$product_table .= '<td width="' . $width[$i] . '" height="20" align="' . $align[$i] . '"><b><small>' . $header[$i] . '</small></b></td>';
}
$product_table .= '</tr>';
$align = array("center", "left", "center", "center", "center", "center", "center", "center", "center");
//Data
foreach ($data as $row) {
$product_table .= '<tr>';
$i = 0;
foreach ($row as $item) {
$sum[$i] += (double) $item;
if ($format[$i] == 's') {
$itarr = explode("\n\n", $item);
$item = '<b>' . $itarr[0] . '</b><br/><small>' . $itarr[1] . '</small>';
} elseif ($format[$i] == 'np') {
} else {
$currfield = new CurrencyField($item);
$item = $currfield->getDisplayValue();
}
$product_table .= '<td width="' . $width[$i] . '" align="' . $align[$i++] . '"><small>' . $item . '</small></td>';
}
$product_table .= '</tr>';
}
$product_table .= "</table>";
$i = 0;
$mod = strtolower($pdftype);
if ($mod == 'quotes') {
$idcol = "quoteid";
} else {
$idcol = $mod . "id";
}
$sql = "SELECT discount_percent, discount_amount, subtotal, total FROM vtiger_{$mod} WHERE {$idcol} = " . $this->id;
$result = $db->query($sql, true);
$grand_total = $db->query_result($result, 0, 'total');
$subtotal = $db->query_result($result, 0, "subtotal");
$discount_percent = $db->query_result($result, 0, 'discount_percent');
$discount_amount = $db->query_result($result, 0, 'discount_amount');
if ($discount_percent != 0) {
$discount = $subtotal * ($discount_percent / 100.0);
} else {
$discount = $discount_amount;
}
$currfield = new CurrencyField($grand_total);
$grand_total = $currfield->getDisplayValue();
$currfield = new CurrencyField($subtotal);
$subtotal = $currfield->getDisplayValue();
$currfield = new CurrencyField($discount);
$discount = $currfield->getDisplayValue();
$product_table .= '<table width="535px" border="1" cellpadding="2">
<tr height="10"><td align="right" valign="middle"><small><b>' . getTranslatedString('Net Total', "OSSPdf") . '</b> : ' . $subtotal . '</small></td></tr>
<tr valign="middle"><td align="right"><small><b>' . getTranslatedString("Discount Amount", "OSSPdf") . '</b> : ' . $discount . '</small></td></tr>
<tr valign="middle"><td align="right"><small><b>' . getTranslatedString("Grand Total", "OSSPdf") . '</b> : ' . $grand_total . ' (' . $symbol_waluty . ')</small></td></tr>
</table><br/>';
$content = str_replace("#product_tableNP#", $product_table, $content);
$currfield = new CurrencyField($grand_total);
$grand_total = $currfield->getDBInsertedValue($grand_total);
$kwota = $this->slownie($grand_total);
$content = str_replace("#amount_words#", $kwota, $content);
return $content;
}
示例3: addUserSearchConditions
//.........这里部分代码省略.........
$this->addCondition($name, $filter['value'], $filter['comparator']);
$columncondition = $filter['column_condition'];
if (!empty($columncondition)) {
$this->addConditionGlue($columncondition);
}
}
$this->endGroup();
$groupConditionGlue = $groupcolumns['condition'];
if (!empty($groupConditionGlue)) {
$this->addConditionGlue($groupConditionGlue);
}
}
}
$this->endGroup();
} elseif ($input['type'] == 'dbrd') {
if ($this->conditionInstanceCount > 0) {
$this->startGroup(self::$AND);
} else {
$this->startGroup('');
}
$allConditionsList = $this->getDashBoardConditionList();
$conditionList = $allConditionsList['conditions'];
$relatedConditionList = $allConditionsList['relatedConditions'];
$noOfConditions = count($conditionList);
$noOfRelatedConditions = count($relatedConditionList);
foreach ($conditionList as $index => $conditionInfo) {
$this->addCondition($conditionInfo['fieldname'], $conditionInfo['value'], $conditionInfo['operator']);
if ($index < $noOfConditions - 1 || $noOfRelatedConditions > 0) {
$this->addConditionGlue(self::$AND);
}
}
foreach ($relatedConditionList as $index => $conditionInfo) {
$this->addRelatedModuleCondition($conditionInfo['relatedModule'], $conditionInfo['conditionModule'], $conditionInfo['finalValue'], $conditionInfo['SQLOperator']);
if ($index < $noOfRelatedConditions - 1) {
$this->addConditionGlue(self::$AND);
}
}
$this->endGroup();
} else {
if (isset($input['search_field']) && $input['search_field'] != "") {
$fieldName = vtlib_purify($input['search_field']);
} else {
return;
}
if ($this->conditionInstanceCount > 0) {
$this->startGroup(self::$AND);
} else {
$this->startGroup('');
}
$moduleFields = $this->getModuleFields();
$field = $moduleFields[$fieldName];
$type = $field->getFieldDataType();
if (isset($input['search_text']) && $input['search_text'] != "") {
// search other characters like "|, ?, ?" by jagi
$value = $input['search_text'];
$stringConvert = function_exists(iconv) ? @iconv("UTF-8", $default_charset, $value) : $value;
if (!$this->isStringType($type)) {
$value = trim($stringConvert);
}
if ($type == 'picklist') {
global $mod_strings;
// Get all the keys for the for the Picklist value
$mod_keys = array_keys($mod_strings, $value);
if (sizeof($mod_keys) >= 1) {
// Iterate on the keys, to get the first key which doesn't start with LBL_ (assuming it is not used in PickList)
foreach ($mod_keys as $mod_idx => $mod_key) {
$stridx = strpos($mod_key, 'LBL_');
// Use strict type comparision, refer strpos for more details
if ($stridx !== 0) {
$value = $mod_key;
break;
}
}
}
}
if ($type == 'currency') {
// Some of the currency fields like Unit Price, Total, Sub-total etc of Inventory modules, do not need currency conversion
if ($field->getUIType() == '72') {
$value = CurrencyField::convertToDBFormat($value, null, true);
} else {
$currencyField = new CurrencyField($value);
$value = $currencyField->getDBInsertedValue();
}
}
}
if (!empty($input['operator'])) {
$operator = $input['operator'];
} elseif (trim(strtolower($value)) == 'null') {
$operator = 'e';
} else {
if (!$this->isNumericType($type) && !$this->isDateType($type)) {
$operator = 'c';
} else {
$operator = 'h';
}
}
$this->addCondition($fieldName, $value, $operator);
$this->endGroup();
}
}
示例4: getAdvancedSearchCriteriaList
function getAdvancedSearchCriteriaList($advft_criteria, $advft_criteria_groups, $module = '')
{
global $currentModule, $current_user;
if (empty($module)) {
$module = $currentModule;
}
$advfilterlist = array();
$moduleHandler = vtws_getModuleHandlerFromName($module, $current_user);
$moduleMeta = $moduleHandler->getMeta();
$moduleFields = $moduleMeta->getModuleFields();
foreach ($advft_criteria as $column_index => $column_condition) {
if (empty($column_condition)) {
continue;
}
$adv_filter_column = $column_condition["columnname"];
$adv_filter_comparator = $column_condition["comparator"];
$adv_filter_value = $column_condition["value"];
$adv_filter_column_condition = $column_condition["columncondition"];
$adv_filter_groupid = $column_condition["groupid"];
$column_info = explode(":", $adv_filter_column);
$fieldName = $column_info[2];
$fieldObj = $moduleFields[$fieldName];
$fieldType = $fieldObj->getFieldDataType();
if ($fieldType == 'currency') {
// Some of the currency fields like Unit Price, Total, Sub-total etc of Inventory modules, do not need currency conversion
if ($fieldObj->getUIType() == '72') {
$adv_filter_value = CurrencyField::convertToDBFormat($adv_filter_value, null, true);
} else {
$currencyField = new CurrencyField($adv_filter_value);
if ($module == 'Potentials' && $fieldName == 'amount') {
$currencyField->setNumberofDecimals(2);
}
$adv_filter_value = $currencyField->getDBInsertedValue();
}
}
$criteria = array();
$criteria['columnname'] = $adv_filter_column;
$criteria['comparator'] = $adv_filter_comparator;
$criteria['value'] = $adv_filter_value;
$criteria['column_condition'] = $adv_filter_column_condition;
$advfilterlist[$adv_filter_groupid]['columns'][] = $criteria;
}
foreach ($advft_criteria_groups as $group_index => $group_condition_info) {
if (empty($group_condition_info)) {
continue;
}
if (empty($advfilterlist[$group_index])) {
continue;
}
$advfilterlist[$group_index]['condition'] = $group_condition_info["groupcondition"];
$noOfGroupColumns = count($advfilterlist[$group_index]['columns']);
if (!empty($advfilterlist[$group_index]['columns'][$noOfGroupColumns - 1]['column_condition'])) {
$advfilterlist[$group_index]['columns'][$noOfGroupColumns - 1]['column_condition'] = '';
}
}
$noOfGroups = count($advfilterlist);
if (!empty($advfilterlist[$noOfGroups]['condition'])) {
$advfilterlist[$noOfGroups]['condition'] = '';
}
return $advfilterlist;
}
示例5: replaceProductTable
//.........这里部分代码省略.........
$tax_percentage = $currfield->getDisplayValue();
$tax_percentage_array[$i] = $tax_percentage;
if ($final_details['taxtype'] == 'group') {
$netto = $item['Price'] * $item['Qty'] - $item['Discount'];
// $currfield = new CurrencyField($netto);
// $currfield->getDBInsertedValue();
// $netto = $currfield->getDisplayValue();
// $currfield = new CurrencyField((float) $item['Price']);
// $currfield->getDBInsertedValue();
$item['Price'] = (double) $item['Price'];
// $currfield = new CurrencyField((float) $item['Discount']);
// $currfield->getDBInsertedValue();
$item['Discount'] = (double) $item['Discount'];
// $currfield = new CurrencyField((float) $item['Total']);
// $currfield->getDBInsertedValue();
$item['Total'] = (double) $item['Total'];
$data[$i] = array($i, $item['Product Name'], $item['Qty'], $item['Price'], $item['Discount'], $netto, $item['Total']);
} else {
$tax_pln = $item['Tax'] * $kurs_waluty;
$suma_podatku_w_pln += $tax_pln;
//$currfield = new CurrencyField( $tax_pln );
//$tax_pln = $currfield->getDisplayValue();
$netto = $item['Price'] * $item['Qty'] - $item['Discount'];
//$currfield = new CurrencyField( $netto );
//$currfield->getDBInsertedValue();
//$netto = $currfield->getDisplayValue();
////////
//$currfield = new CurrencyField( (float)$item['Price'] );
//$currfield->getDBInsertedValue();
$item['Price'] = (double) $item['Price'];
//$currfield->getDisplayValue();
////////
$currfield = new CurrencyField((double) $item['Discount']);
$currfield->getDBInsertedValue();
$item['Discount'] = (double) $item['Discount'];
//$currfield->getDisplayValue();
/////////
//$currfield = new CurrencyField( (float)$item['tax_percentage'] );
//$currfield->getDBInsertedValue();
$tax_percentage = (double) $item['tax_percentage'];
//$currfield->getDisplayValue();
//////////
//$currfield = new CurrencyField( (float)$item['Tax'] );
//$currfield->getDBInsertedValue();
$item['Tax'] = (double) $item['Tax'];
//$currfield->getDisplayValue();
///////////
//$currfield = new CurrencyField( (float)$item['Total'] );
//$currfield->getDBInsertedValue();
$item['Total'] = (double) $item['Total'];
//$currfield->getDisplayValue();
////////////
$data[$i] = array($i, $item['Product Name'], $item['Qty'], $item['Price'], $item['Discount'], $netto, $tax_percentage, $item['Tax'], $item['Total'], $tax_pln);
}
$i++;
}
if ($final_details['taxtype'] == 'group') {
$width = array(30, 200, 50, 60, 50, 70, 70);
$align = array("center", "center", "center", "center", "center", "center", "center");
$format = array(0, "s", 0, 2, 2, 2, 2);
} else {
$width = array(30, 180, 50, 60, 50, 40, 40, 40, 40, 40);
$align = array("center", "center", "center", "center", "center", "center", "center", "center", "center", "center");
$format = array(0, "s", 0, 2, 2, 2, 2, 2, 2);
}
$product_table = '<table cellpadding="2">';
示例6: addUserSearchConditions
//.........这里部分代码省略.........
foreach ($filtercolumns as $index => $filter) {
$name = explode(':', $filter['columnname']);
if (empty($name[2]) && $name[1] == 'crmid' && $name[0] == 'vtiger_crmentity') {
$name = $this->getSQLColumn('id');
} else {
$name = $name[2];
}
$this->addCondition($name, $filter['value'], $filter['comparator']);
$columncondition = $filter['column_condition'];
if (!empty($columncondition)) {
$this->addConditionGlue($columncondition);
}
}
$this->endGroup();
$groupConditionGlue = $groupcolumns['condition'];
if (!empty($groupConditionGlue)) {
$this->addConditionGlue($groupConditionGlue);
}
}
}
$this->endGroup();
} elseif ($input['type'] == 'dbrd') {
if ($this->conditionInstanceCount > 0) {
$this->startGroup(self::$AND);
} else {
$this->startGroup('');
}
$allConditionsList = $this->getDashBoardConditionList();
$conditionList = $allConditionsList['conditions'];
$relatedConditionList = $allConditionsList['relatedConditions'];
$noOfConditions = count($conditionList);
$noOfRelatedConditions = count($relatedConditionList);
foreach ($conditionList as $index => $conditionInfo) {
$this->addCondition($conditionInfo['fieldname'], $conditionInfo['value'], $conditionInfo['operator']);
if ($index < $noOfConditions - 1 || $noOfRelatedConditions > 0) {
$this->addConditionGlue(self::$AND);
}
}
foreach ($relatedConditionList as $index => $conditionInfo) {
$this->addRelatedModuleCondition($conditionInfo['relatedModule'], $conditionInfo['conditionModule'], $conditionInfo['finalValue'], $conditionInfo['SQLOperator']);
if ($index < $noOfRelatedConditions - 1) {
$this->addConditionGlue(self::$AND);
}
}
$this->endGroup();
} else {
if (isset($input['search_field']) && $input['search_field'] != "") {
$fieldName = vtlib_purify($input['search_field']);
} else {
return;
}
if ($this->conditionInstanceCount > 0) {
$this->startGroup(self::$AND);
} else {
$this->startGroup('');
}
$moduleFields = $this->getModuleFields();
$field = $moduleFields[$fieldName];
$type = $field->getFieldDataType();
if (isset($input['search_text']) && $input['search_text'] != "") {
// search other characters like "|, ?, ?" by jagi
$value = $input['search_text'];
$stringConvert = function_exists(iconv) ? @iconv("UTF-8", $default_charset, $value) : $value;
if (!$this->isStringType($type)) {
$value = trim($stringConvert);
}
if ($type == 'picklist') {
global $currentModule;
if (!isValueInPicklist($value, $field->getFieldName())) {
$value = getTranslationKeyFromTranslatedValue($currentModule, $value);
}
}
if ($type == 'currency') {
// Some of the currency fields like Unit Price, Total, Sub-total etc of Inventory modules, do not need currency conversion
if ($field->getUIType() == '72') {
$value = CurrencyField::convertToDBFormat($value, null, true);
} else {
$currencyField = new CurrencyField($value);
if ($this->getModule() == 'Potentials' && $fieldName == 'amount') {
$currencyField->setNumberofDecimals(2);
}
$value = $currencyField->getDBInsertedValue();
}
}
}
if (!empty($input['operator'])) {
$operator = $input['operator'];
} elseif (trim(strtolower($value)) == 'null') {
$operator = 'e';
} else {
if (!$this->isNumericType($type) && !$this->isDateType($type)) {
$operator = 'c';
} else {
$operator = 'h';
}
}
$this->addCondition($fieldName, $value, $operator);
$this->endGroup();
}
}