本文整理汇总了PHP中CurrencyField::getDisplayValue方法的典型用法代码示例。如果您正苦于以下问题:PHP CurrencyField::getDisplayValue方法的具体用法?PHP CurrencyField::getDisplayValue怎么用?PHP CurrencyField::getDisplayValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CurrencyField
的用法示例。
在下文中一共展示了CurrencyField::getDisplayValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: CurrencyField
function wf_formatcurrency($value)
{
$currencyField = new CurrencyField($value);
return $currencyField->getDisplayValue(null, true);
}
示例3: getPDFMakerFieldValue
public function getPDFMakerFieldValue($report, $picklistArray, $dbField, $valueArray, $fieldName)
{
global $current_user, $default_charset;
$db = PearDatabase::getInstance();
$value = $valueArray[$fieldName];
$fld_type = $dbField->type;
list($module, $fieldLabel) = explode('_', $dbField->name, 2);
$fieldInfo = $this->getFieldByPDFMakerLabel($module, $fieldLabel);
$fieldType = null;
$fieldvalue = $value;
if (!empty($fieldInfo)) {
$field = WebserviceField::fromArray($db, $fieldInfo);
$fieldType = $field->getFieldDataType();
}
if ($fieldType == 'currency' && $value != '') {
// Some of the currency fields like Unit Price, Total, Sub-total etc of Inventory modules, do not need currency conversion
if ($field->getUIType() == '72') {
$curid_value = explode("::", $value);
$currency_id = $curid_value[0];
$currency_value = $curid_value[1];
$cur_sym_rate = getCurrencySymbolandCRate($currency_id);
if ($value != '') {
if ($dbField->name == 'Products_Unit_Price') {
// need to do this only for Products Unit Price
if ($currency_id != 1) {
$currency_value = (double) $cur_sym_rate['rate'] * (double) $currency_value;
}
}
$formattedCurrencyValue = CurrencyField::convertToUserFormat($currency_value, null, true);
$fieldvalue = CurrencyField::appendCurrencySymbol($formattedCurrencyValue, $cur_sym_rate['symbol']);
}
} else {
$currencyField = new CurrencyField($value);
$fieldvalue = $currencyField->getDisplayValue();
}
} elseif ($dbField->name == "PurchaseOrder_Currency" || $dbField->name == "SalesOrder_Currency" || $dbField->name == "Invoice_Currency" || $dbField->name == "Quotes_Currency" || $dbField->name == "PriceBooks_Currency") {
if ($value != '') {
$fieldvalue = getTranslatedCurrencyString($value);
}
} elseif (in_array($dbField->name, $this->ui101_fields) && !empty($value)) {
$entityNames = getEntityName('Users', $value);
$fieldvalue = $entityNames[$value];
} elseif ($fieldType == 'date' && !empty($value)) {
if ($module == 'Calendar' && $field->getFieldName() == 'due_date') {
$endTime = $valueArray['calendar_end_time'];
if (empty($endTime)) {
$recordId = $valueArray['calendar_id'];
$endTime = getSingleFieldValue('vtiger_activity', 'time_end', 'activityid', $recordId);
}
$date = new DateTimeField($value . ' ' . $endTime);
$fieldvalue = $date->getDisplayDate();
} else {
$fieldvalue = DateTimeField::convertToUserFormat($value);
}
} elseif ($fieldType == "datetime" && !empty($value)) {
$date = new DateTimeField($value);
$fieldvalue = $date->getDisplayDateTimeValue();
} elseif ($fieldType == 'time' && !empty($value) && $field->getFieldName() != 'duration_hours') {
if ($field->getFieldName() == "time_start" || $field->getFieldName() == "time_end") {
$date = new DateTimeField($value);
$fieldvalue = $date->getDisplayTime();
} else {
$fieldvalue = $value;
}
} elseif ($fieldType == "picklist" && !empty($value)) {
if (is_array($picklistArray)) {
if (is_array($picklistArray[$dbField->name]) && $field->getFieldName() != 'activitytype' && !in_array($value, $picklistArray[$dbField->name])) {
$fieldvalue = $app_strings['LBL_NOT_ACCESSIBLE'];
} else {
$fieldvalue = $this->getTranslatedString($value, $module);
}
} else {
$fieldvalue = $this->getTranslatedString($value, $module);
}
} elseif ($fieldType == "multipicklist" && !empty($value)) {
if (is_array($picklistArray[1])) {
$valueList = explode(' |##| ', $value);
$translatedValueList = array();
foreach ($valueList as $value) {
if (is_array($picklistArray[1][$dbField->name]) && !in_array($value, $picklistArray[1][$dbField->name])) {
$translatedValueList[] = $app_strings['LBL_NOT_ACCESSIBLE'];
} else {
$translatedValueList[] = $this->getTranslatedString($value, $module);
}
}
}
if (!is_array($picklistArray[1]) || !is_array($picklistArray[1][$dbField->name])) {
$fieldvalue = str_replace(' |##| ', ', ', $value);
} else {
implode(', ', $translatedValueList);
}
} elseif ($fieldType == 'double') {
if ($current_user->truncate_trailing_zeros == true) {
$fieldvalue = decimalFormat($fieldvalue);
}
}
if ($fieldvalue == "") {
return "-";
}
$fieldvalue = str_replace("<", "<", $fieldvalue);
//.........这里部分代码省略.........
示例4: getRecordValues
//.........这里部分代码省略.........
$value_pair['disp_value'] = $app_strings['no'];
} else {
$value_pair['disp_value'] = $app_strings['yes'];
}
} elseif ($ui_type == 51 || $ui_type == 50) {
$entity_id = $field_values[$j][$fld_name];
if ($module != 'Products') {
$entity_name = getAccountName($entity_id);
} else {
$entity_name = getProductName($entity_id);
}
$value_pair['disp_value'] = $entity_name;
} elseif ($ui_type == 53) {
$owner_id = $field_values[$j][$fld_name];
$ownername = getOwnerName($owner_id);
$value_pair['disp_value'] = $ownername;
} elseif ($ui_type == 57) {
$contact_id = $field_values[$j][$fld_name];
if ($contact_id != '') {
$displayValueArray = getEntityName('Contacts', $contact_id);
if (!empty($displayValueArray)) {
foreach ($displayValueArray as $key => $field_value) {
$contactname = $field_value;
}
}
}
$value_pair['disp_value'] = $contactname;
} elseif ($ui_type == 75 || $ui_type == 81) {
$vendor_id = $field_values[$j][$fld_name];
if ($vendor_id != '') {
$vendor_name = getVendorName($vendor_id);
}
$value_pair['disp_value'] = $vendor_name;
} elseif ($ui_type == 52) {
$user_id = $field_values[$j][$fld_name];
$user_name = getUserFullName($user_id);
$value_pair['disp_value'] = $user_name;
} elseif ($ui_type == 68) {
$parent_id = $field_values[$j][$fld_name];
$value_pair['disp_value'] = getAccountName($parent_id);
if ($value_pair['disp_value'] == '' || $value_pair['disp_value'] == NULL) {
$displayValueArray = getEntityName('Contacts', $parent_id);
if (!empty($displayValueArray)) {
foreach ($displayValueArray as $key => $field_value) {
$contact_name = $field_value;
}
} else {
$contact_name = '';
}
$value_pair['disp_value'] = $contact_name;
}
} elseif ($ui_type == 59) {
$product_name = getProductName($field_values[$j][$fld_name]);
if ($product_name != '') {
$value_pair['disp_value'] = $product_name;
} else {
$value_pair['disp_value'] = '';
}
} elseif ($ui_type == 58) {
$campaign_name = getCampaignName($field_values[$j][$fld_name]);
if ($campaign_name != '') {
$value_pair['disp_value'] = $campaign_name;
} else {
$value_pair['disp_value'] = '';
}
} elseif ($ui_type == 10) {
$value_pair['disp_value'] = getRecordInfoFromID($field_values[$j][$fld_name]);
} elseif ($ui_type == 5 || $ui_type == 6 || $ui_type == 23) {
if ($field_values[$j][$fld_name] != '' && $field_values[$j][$fld_name] != '0000-00-00') {
$date = new DateTimeField($field_values[$j][$fld_name]);
$value_pair['disp_value'] = $date->getDisplayDate();
if (strpos($field_values[$j][$fld_name], ' ') > -1) {
$value_pair['disp_value'] .= ' ' . $date->getDisplayTime();
}
} elseif ($field_values[$j][$fld_name] == '0000-00-00') {
$value_pair['disp_value'] = '';
} else {
$value_pair['disp_value'] = $field_values[$j][$fld_name];
}
} elseif ($ui_type == '71' || $ui_type == '72') {
$currencyField = new CurrencyField($field_values[$j][$fld_name]);
if ($ui_type == '72') {
$value_pair['disp_value'] = $currencyField->getDisplayValue(null, true);
} else {
$value_pair['disp_value'] = $currencyField->getDisplayValue();
}
} else {
$value_pair['disp_value'] = $field_values[$j][$fld_name];
}
$value_pair['org_value'] = $field_values[$j][$fld_name];
array_push($record_values[$c][$fld_label], $value_pair);
}
$c++;
}
}
$parent_array[0] = $record_values;
$parent_array[1] = $fld_array;
$parent_array[2] = $fld_array;
return $parent_array;
}
示例5: getReportFieldValue
/**
*
* @global Users $current_user
* @param ReportRun $report
* @param Array $picklistArray
* @param ADOFieldObject $dbField
* @param Array $valueArray
* @param String $fieldName
* @return String
*/
function getReportFieldValue($report, $picklistArray, $dbField, $valueArray, $fieldName)
{
global $current_user, $default_charset;
$db = PearDatabase::getInstance();
$value = $valueArray[$fieldName];
$fld_type = $dbField->type;
list($module, $fieldLabel) = explode('__', $dbField->name, 2);
$fieldInfo = getFieldByReportLabel($module, $fieldLabel);
$fieldType = null;
$fieldvalue = $value;
if (!empty($fieldInfo)) {
$field = WebserviceField::fromArray($db, $fieldInfo);
$fieldType = $field->getFieldDataType();
}
if ($fieldType == 'currency' && $value != '') {
// Some of the currency fields like Unit Price, Total, Sub-total etc of Inventory modules, do not need currency conversion
if ($field->getUIType() == '72') {
$curid_value = explode("::", $value);
$currency_id = $curid_value[0];
$currency_value = $curid_value[1];
$cur_sym_rate = getCurrencySymbolandCRate($currency_id);
if ($value != '') {
if ($dbField->name == 'Products_Unit_Price') {
// need to do this only for Products Unit Price
if ($currency_id != 1) {
$currency_value = (double) $cur_sym_rate['rate'] * (double) $currency_value;
}
}
$formattedCurrencyValue = CurrencyField::convertToUserFormat($currency_value, null, true);
$fieldvalue = CurrencyField::appendCurrencySymbol($formattedCurrencyValue, $cur_sym_rate['symbol']);
}
} else {
$currencyField = new CurrencyField($value);
$fieldvalue = $currencyField->getDisplayValue();
}
} elseif ($dbField->name == "PriceBooks_Currency") {
if ($value != '') {
$fieldvalue = getTranslatedCurrencyString($value);
}
} elseif (in_array($dbField->name, $report->ui101_fields) && !empty($value)) {
$entityNames = getEntityName('Users', $value);
$fieldvalue = $entityNames[$value];
} elseif ($fieldType == 'date' && !empty($value)) {
if ($module == 'Calendar' && $field->getFieldName() == 'due_date') {
$endTime = $valueArray['calendar_end_time'];
if (empty($endTime)) {
$recordId = $valueArray['calendar_id'];
$endTime = getSingleFieldValue('vtiger_activity', 'time_end', 'activityid', $recordId);
}
$date = new DateTimeField($value . ' ' . $endTime);
$fieldvalue = $date->getDisplayDate();
} else {
if (!($field->getUIType() == '5')) {
$date = new DateTimeField($fieldvalue);
$fieldvalue = $date->getDisplayDateTimeValue();
}
}
} elseif ($fieldType == "datetime" && !empty($value)) {
$date = new DateTimeField($value);
$fieldvalue = $date->getDisplayDateTimeValue();
} elseif ($fieldType == 'time' && !empty($value) && $field->getFieldName() != 'duration_hours') {
if ($field->getFieldName() == "time_start" || $field->getFieldName() == "time_end") {
$date = new DateTimeField($value);
$fieldvalue = $date->getDisplayTime();
} else {
$userModel = Users_Privileges_Model::getCurrentUserModel();
if ($userModel->get('hour_format') == '12') {
$value = Vtiger_Time_UIType::getTimeValueInAMorPM($value);
}
$fieldvalue = $value;
}
} elseif ($fieldType == "picklist" && !empty($value)) {
if (is_array($picklistArray)) {
if (is_array($picklistArray[$dbField->name]) && $field->getFieldName() != 'activitytype' && !in_array($value, $picklistArray[$dbField->name])) {
$fieldvalue = $app_strings['LBL_NOT_ACCESSIBLE'];
} else {
$fieldvalue = getTranslatedString($value, $module);
}
} else {
$fieldvalue = getTranslatedString($value, $module);
}
} elseif ($fieldType == "multipicklist" && !empty($value)) {
if (is_array($picklistArray[1])) {
$valueList = explode(' |##| ', $value);
$translatedValueList = array();
foreach ($valueList as $value) {
if (is_array($picklistArray[1][$dbField->name]) && !in_array($value, $picklistArray[1][$dbField->name])) {
$translatedValueList[] = $app_strings['LBL_NOT_ACCESSIBLE'];
} else {
$translatedValueList[] = getTranslatedString($value, $module);
//.........这里部分代码省略.........
示例6: replaceProductList
//.........这里部分代码省略.........
//This is to get all prodcut details as row basis
for ($i = 1, $j = $i - 1; $i <= $num_products; $i++, $j++) {
$product_name[$i] = $associated_products[$i]['productName' . $i];
$subproduct_name[$i] = split("<br>", $associated_products[$i]['subprod_names' . $i]);
$comment[$i] = $associated_products[$i]['comment' . $i];
$product_id[$i] = $associated_products[$i]['hdnProductId' . $i];
$qty[$i] = $associated_products[$i]['qty' . $i];
$unit_price[$i] = number_format($associated_products[$i]['unitPrice' . $i], 2, '.', ',');
$list_price[$i] = $associated_products[$i]['listPrice' . $i];
// number_format($associated_products[$i]['listPrice'.$i],2,'.',',');
$list_pricet[$i] = $associated_products[$i]['listPrice' . $i];
$discount_total[$i] = $associated_products[$i]['discountTotal' . $i];
//aded for 5.0.3 pdf changes
$product_code[$i] = $associated_products[$i]['hdnProductcode' . $i];
$taxable_total = $qty[$i] * $list_pricet[$i] - $discount_total[$i];
$producttotal = $taxable_total;
$total_taxes = '0.00';
if ($focus->column_fields["hdnTaxType"] == "individual") {
$total_tax_percent = '0.00';
//This loop is to get all tax percentage and then calculate the total of all taxes
for ($tax_count = 0; $tax_count < count($associated_products[$i]['taxes']); $tax_count++) {
$tax_percent = $associated_products[$i]['taxes'][$tax_count]['percentage'];
$total_tax_percent = $total_tax_percent + $tax_percent;
$tax_amount = $taxable_total * $tax_percent / 100;
$total_taxes = $total_taxes + $tax_amount;
}
$producttotal = $taxable_total + $total_taxes;
$product_line[$j]["tax_percentage"] = $total_tax_percent;
$product_line[$j]["Tax"] = $total_taxes;
$price_salestax += $total_taxes;
}
$prod_total[$i] = $producttotal;
// number_format($producttotal,2,'.',',');
$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(vtranslate('LBL_nr', 'OSSPdf'), vtranslate('LBL_productname', 'OSSPdf'), vtranslate('LBL_Quantity', 'OSSPdf'));
$data = array();
$i = 0;
foreach ($product_line as $item) {
$currfield = new CurrencyField($item["tax_percentage"]);
$tax_percentage = $currfield->getDisplayValue();
$data[$i++] = array($i, $item['Product Name'], $item['Qty']);
}
$width = array(35, 400, 100, 45, 45, 45, 45, 45, 45);
$align = array("center", "center", "center", "center", "center", "center", "center", "center", "center");
$format = array(0, "s", 0, 2, 2, 2, 2, 2, 2);
$product_table = '<table align="center" 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') {
$currfield = new CurrencyField($item);
$item = $currfield->getDisplayValue();
} else {
$itarr = explode("\n\n", $item);
$item = '<b>' . $itarr[0] . '</b><br/><small>' . $itarr[1] . '</small>';
}
$product_table .= '<td width="' . $width[$i] . '" align="' . $align[$i++] . '"><small>' . $item . '</small></td>';
}
$product_table .= '</tr>';
}
$product_table .= "</table><br/></center>";
$i = 0;
return $product_table;
}
示例7: replaceCorrectedTableProducts
//.........这里部分代码省略.........
}
if ($enable_productname_column) {
$header[1] = $mod_strings['LBL_productname'];
}
if ($enable_amount_column) {
$header[2] = $mod_strings['LBL_Quantity'];
}
if ($enable_listprice_column) {
$header[3] = $mod_strings['LBL_price'];
}
if ($enable_discount_column) {
$header[4] = $mod_strings['LBL_rabat'];
}
if ($enable_netprice_column) {
$header[5] = $mod_strings['LBL_netto'];
}
if ($enable_vatpercentage_column) {
$header[6] = $mod_strings['LBL_vat'];
}
if ($enable_vatamount_column) {
$header[7] = $mod_strings['LBL_vat_waluta'] . " (" . $symbol_waluty . ")";
}
if ($enable_gross_column) {
$header[8] = $mod_strings['LBL_brutto'];
}
if ($enable_taxes_inPLN && $czyDrukowacKolumneZPrzeliczonymPodatkiem == TRUE) {
$header[9] = $mod_strings['TAXES_IN_PLN'];
}
}
$data = array();
$i = 1;
foreach ($product_line as $item) {
$currfield = new CurrencyField($item["tax_percentage"]);
$tax_percentage = $currfield->getDisplayValue();
if ($final_details['taxtype'] == 'group') {
$netto = $item['Price'] * $item['Qty'] - $item['Discount'];
$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'];
$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, 290, 35, 45, 45, 45, 45);
$align = array("center", "center", "center", "center", "center", "center", "center");
$format = array(0, "s", 0, 2, 2, 2, 2);
} else {
$width = array(30, 200, 35, 40, 40, 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);
}
$group_sep = ' ';
$separatorSql = "SELECT currency_decimal_separator FROM vtiger_users WHERE id = '{$current_user->id}'";
$separatorResult = $db->query($separatorSql, true);
$dec_sep = $db->query_result($separatorResult, 0, 'currency_decimal_separator');
//$group_sep = $db->query_result($separatorResult, 0, 'currency_grouping_separator');
//var_dump($data);
//exit;
if ($dec_sep == '') {
$dec_sep = ' ';
}
示例8: formatPrice
function formatPrice($value, $decimal = 2)
{
$currencyField = new CurrencyField($value);
return $currencyField->getDisplayValue(null, true);
}
示例9: formatFldNumberValue
private function formatFldNumberValue($fld_value, $currency_id = "", $dec_number = "3")
{
global $log;
$log->debug("Entering ./modules/ITS4YouReports/GenerateObj.php::formatFldNumberValue");
global $log;
$log->debug("Entering ./modules/ITS4YouReports/GenerateObj.php::formatFldNumberValue");
global $log;
$log->debug("Entering ./modules/ITS4YouReports/GenerateObj.php::formatFldNumberValue");
global $log;
$log->debug("Entering ./modules/ITS4YouReports/GenerateObj.php::formatFldNumberValue");
if ($fld_value != "") {
$fld_value = number_format($fld_value, $dec_number, ".", "");
if ($currency_id != "" && isset($this->currency_symbols[$currency_id])) {
$currencyField = new CurrencyField($fld_value);
$fld_value = $currencyField->getDisplayValue(null, true);
$fld_value = CurrencyField::appendCurrencySymbol($fld_value, $this->currency_symbols[$currency_id]);
} else {
$currencyField = new CurrencyField($fld_value);
$fld_value = $currencyField->getDisplayValue(null, true);
}
}
return $fld_value;
}
示例10: sanitizeCurrencyFieldsForDisplay
function sanitizeCurrencyFieldsForDisplay($row, $meta)
{
global $current_user;
$moduleFields = $meta->getModuleFields();
foreach ($moduleFields as $fieldName => $fieldObj) {
if (($fieldObj->getFieldDataType() == "currency" || $fieldObj->getFieldDataType() == "double") && !empty($row[$fieldName])) {
$uitype = $fieldObj->getUIType();
$cryFields = new CurrencyField($row[$fieldName]);
$cryFields->initialize($current_user);
if ($uitype == '71') {
$row[$fieldName] = $cryFields->getDisplayValue($current_user, false, true);
} else {
if ($uitype == '72' || $uitype == '7' || $uitype == '9') {
$row[$fieldName] = $cryFields->getDisplayValue($current_user, true, true);
}
}
}
}
return $row;
}
示例11: getOutputHtml
//.........这里部分代码省略.........
} else {
$parent_name = "";
$value = "";
}
}
$editview_label[0] = array();
$editview_label[1] = array();
$editview_label[2] = array();
if (vtlib_isModuleActive('Accounts')) {
array_push($editview_label[0], $app_strings['COMBO_ACCOUNTS']);
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';
}
示例12: process
public function process()
{
global $site_URL;
$imagefound = false;
$variableList = $this->getTemplateVariableListForModule($this->module);
$handler = vtws_getModuleHandlerFromName($this->module, $this->user);
$meta = $handler->getMeta();
$referenceFields = $meta->getReferenceFieldDetails();
$fieldColumnMapping = $meta->getFieldColumnMapping();
$columnTableMapping = $meta->getColumnTableMapping();
$tableList = array();
$columnList = array();
$columnList_full = array();
$allColumnList = $meta->getUserAccessibleColumns();
if (count($variableList) > 0) {
foreach ($variableList as $column) {
if (in_array($column, $allColumnList)) {
$columnList[] = $column;
$columnList_full[] = $columnTableMapping[$column] . '.' . $column;
}
}
foreach ($columnList as $column) {
if (!empty($columnTableMapping[$column])) {
$tableList[$columnTableMapping[$column]] = '';
}
}
$tableList = array_keys($tableList);
$defaultTableList = $meta->getEntityDefaultTableList();
$tableList = array_merge($tableList, $defaultTableList);
$leadtables = array('vtiger_leadsubdetails', 'vtiger_leadaddress', 'vtiger_leadscf');
$leadmerge = array_intersect($tableList, $leadtables);
if (count($leadmerge) > 0 and !in_array('vtiger_leaddetails', $tableList)) {
// we need this one because the where condition for Leads uses the converted column from the main table
$tableList[] = 'vtiger_leaddetails';
}
// right now this is will be limited to module type, entities.
// need to extend it to non-module entities when we have a reliable way of getting
// record type from the given record id. non webservice id.
// can extend to non-module entity without many changes as long as the reference field
// refers to one type of entity, either module entities or non-module entities.
if (count($tableList) > 0) {
$sql = 'select ' . implode(', ', $columnList_full) . ' from ' . $tableList[0];
$moduleTableIndexList = $meta->getEntityTableIndexList();
foreach ($tableList as $index => $tableName) {
if ($tableName != $tableList[0]) {
$sql .= ' INNER JOIN ' . $tableName . ' ON ' . $tableList[0] . '.' . $moduleTableIndexList[$tableList[0]] . '=' . $tableName . '.' . $moduleTableIndexList[$tableName];
}
}
$sql .= ' WHERE';
$deleteQuery = $meta->getEntityDeletedQuery();
if (!empty($deleteQuery)) {
$sql .= " {$deleteQuery} AND";
}
$sql .= ' ' . $tableList[0] . '.' . $moduleTableIndexList[$tableList[0]] . '=?';
$params = array($this->recordId);
$db = PearDatabase::getInstance();
$result = $db->pquery($sql, $params);
$it = new SqlResultIterator($db, $result);
//assuming there can only be one row.
$values = array();
foreach ($it as $row) {
foreach ($columnList as $column) {
$values[$column] = $row->get($column);
}
}
$moduleFields = $meta->getModuleFields();
foreach ($moduleFields as $fieldName => $webserviceField) {
if (isset($values[$fieldColumnMapping[$fieldName]]) && $values[$fieldColumnMapping[$fieldName]] !== null) {
$fieldtype = $webserviceField->getFieldDataType();
if (strcasecmp($fieldtype, 'reference') === 0) {
$details = $webserviceField->getReferenceList();
if (count($details) == 1) {
$referencedObjectHandler = vtws_getModuleHandlerFromName($details[0], $this->user);
} else {
$type = getSalesEntityType($values[$fieldColumnMapping[$fieldName]]);
$referencedObjectHandler = vtws_getModuleHandlerFromName($type, $this->user);
}
$referencedObjectMeta = $referencedObjectHandler->getMeta();
$values[$fieldColumnMapping[$fieldName]] = $referencedObjectMeta->getName(vtws_getId($referencedObjectMeta->getEntityId(), $values[$fieldColumnMapping[$fieldName]]));
} elseif (strcasecmp($fieldtype, 'owner') === 0) {
$referencedObjectHandler = vtws_getModuleHandlerFromName(vtws_getOwnerType($values[$fieldColumnMapping[$fieldName]]), $this->user);
$referencedObjectMeta = $referencedObjectHandler->getMeta();
$values[$fieldColumnMapping[$fieldName]] = $referencedObjectMeta->getName(vtws_getId($referencedObjectMeta->getEntityId(), $values[$fieldColumnMapping[$fieldName]]));
} elseif (strcasecmp($fieldtype, 'picklist') === 0 or $fieldName == 'salutationtype') {
$values[$fieldColumnMapping[$fieldName]] = getTranslatedString($values[$fieldColumnMapping[$fieldName]], $this->module);
} elseif (strcasecmp($fieldtype, 'datetime') === 0) {
$values[$fieldColumnMapping[$fieldName]] = $values[$fieldColumnMapping[$fieldName]] . ' ' . DateTimeField::getDBTimeZone();
} elseif (strcasecmp($fieldtype, 'currency') === 0 or strcasecmp($fieldtype, 'double') === 0) {
$currencyField = new CurrencyField($values[$fieldColumnMapping[$fieldName]]);
$values[$fieldColumnMapping[$fieldName]] = $currencyField->getDisplayValue(null, true);
} elseif ($webserviceField->getUIType() == 69) {
$query = 'select vtiger_attachments.name, vtiger_attachments.type, vtiger_attachments.attachmentsid, vtiger_attachments.path
from vtiger_attachments
inner join vtiger_crmentity on vtiger_crmentity.crmid = vtiger_attachments.attachmentsid
inner join vtiger_seattachmentsrel on vtiger_attachments.attachmentsid=vtiger_seattachmentsrel.attachmentsid
where (vtiger_crmentity.setype LIKE "%Image" or vtiger_crmentity.setype LIKE "%Attachment")
and deleted=0 and vtiger_seattachmentsrel.crmid=?';
$params = array($this->recordId);
if (!empty($values[$fieldColumnMapping[$fieldName]])) {
$query .= ' and vtiger_attachments.name = ?';
//.........这里部分代码省略.........
示例13: replaceProductTable
//.........这里部分代码省略.........
$header[1] = vtranslate('LBL_productname', 'OSSPdf');
}
if ($enable_amount_column) {
$header[2] = vtranslate('LBL_Quantity', 'OSSPdf');
}
if ($enable_listprice_column) {
$header[3] = vtranslate('LBL_price', 'OSSPdf');
}
if ($enable_netprice_column) {
$header[4] = vtranslate('LBL_rabat', 'OSSPdf');
}
if ($enable_discount_column) {
$header[5] = vtranslate('LBL_netto', 'OSSPdf');
}
if ($enable_vatpercentage_column) {
$header[6] = vtranslate('LBL_vat', 'OSSPdf');
}
if ($enable_vatamount_column) {
$header[7] = vtranslate('LBL_vat_waluta', 'OSSPdf') . " (" . $symbol_waluty . ")";
}
if ($enable_gross_column) {
$header[8] = vtranslate('LBL_brutto', 'OSSPdf');
}
if ($enable_taxes_inPLN == TRUE && $czyDrukowacKolumneZPrzeliczonymPodatkiem == TRUE) {
$header[9] = vtranslate('TAXES_IN_PLN', 'OSSPdf');
}
}
$data = array();
$i = 1;
$suma_podatku_w_pln = 0.0;
$tax_percentage_array = array();
foreach ($product_line as $item) {
$currfield = new CurrencyField($item["tax_percentage"]);
$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']);
示例14: GenerateReport
//.........这里部分代码省略.........
/*STRING TRANSLATION starts */
$moduleLabel = '';
if (in_array($module, $modules_selected)) {
$moduleLabel = getTranslatedString($module, $module);
}
if (empty($translatedLabel)) {
$translatedLabel = getTranslatedString(str_replace('_', " ", $fld->name));
}
$headerLabel = $translatedLabel;
if (!empty($this->secondarymodule)) {
if ($moduleLabel != '') {
$headerLabel = $moduleLabel . " " . $translatedLabel;
}
}
// Check for role based pick list
$temp_val = $fld->name;
if ($fieldType == 'currency') {
// Some of the currency fields like Unit Price, Total, Sub-total etc of Inventory modules, do not need currency conversion
$cur_value = $custom_field_values[$i];
if ($field->getUIType() == '72') {
$curid_value = explode("::", $cur_value);
if (count($curid_value) == 2) {
$currency_id = $curid_value[0];
$currency_value = $curid_value[1];
$cur_sym_rate = getCurrencySymbolandCRate($currency_id);
} else {
$currency_value = $curid_value[0];
$cur_sym_rate['symbol'] = '';
}
$arraylists[$headerLabel] = number_format($currency_value, 2, '.', '');
$arraylists[getTranslatedString('LBL_CURRENCY') . ' ' . $headerLabel] = $cur_sym_rate['symbol'];
} else {
$currencyField = new CurrencyField($cur_value);
$fieldvalue = $currencyField->getDisplayValue();
$arraylists[$headerLabel] = number_format($fieldvalue, 2, '.', '');
}
} else {
$fieldvalue = getReportFieldValue($this, $picklistarray, $fld, $custom_field_values, $i);
$arraylists[$headerLabel] = $fieldvalue;
}
}
$arr_val[] = $arraylists;
set_time_limit($php_max_execution_time);
} while ($custom_field_values = $adb->fetch_array($result));
return $arr_val;
}
} elseif ($outputformat == "TOTALXLS") {
$escapedchars = array('_SUM', '_AVG', '_MIN', '_MAX');
$totalpdf = array();
$sSQL = $this->sGetSQLforReport($this->reportid, $filtersql, "COLUMNSTOTOTAL");
if (isset($this->totallist)) {
if ($sSQL != "") {
$result = $adb->query($sSQL);
$y = $adb->num_fields($result);
$custom_field_values = $adb->fetch_array($result);
foreach ($this->totallist as $key => $value) {
$fieldlist = explode(":", $key);
$mod_query = $adb->pquery("SELECT distinct(tabid) as tabid, uitype as uitype from vtiger_field where tablename = ? and columnname=?", array($fieldlist[1], $fieldlist[2]));
if ($adb->num_rows($mod_query) > 0) {
$module_name = getTabModuleName($adb->query_result($mod_query, 0, 'tabid'));
$fieldlabel = trim(str_replace($escapedchars, " ", $fieldlist[3]));
$fieldlabel = str_replace("_", " ", $fieldlabel);
if ($module_name) {
$field = getTranslatedString($module_name, $module_name) . " " . getTranslatedString($fieldlabel, $module_name);
} else {
$field = getTranslatedString($fieldlabel);
示例15: getReportFieldValue
/**
*
* @global Users $current_user
* @param ReportRun $report
* @param Array $picklistArray
* @param ADOFieldObject $dbField
* @param Array $valueArray
* @param String $fieldName
* @return String
*/
function getReportFieldValue($report, $picklistArray, $dbField, $valueArray, $fieldName)
{
global $current_user;
$db = PearDatabase::getInstance();
$value = $valueArray[$fieldName];
$fld_type = $dbField->type;
list($module, $fieldLabel) = explode('_', $dbField->name, 2);
$fieldInfo = getFieldByReportLabel($module, $fieldLabel);
$fieldType = null;
$fieldvalue = $value;
if (!empty($fieldInfo)) {
$field = WebserviceField::fromArray($db, $fieldInfo);
$fieldType = $field->getFieldDataType();
}
if ($fieldType == 'currency' && $value != '') {
// Some of the currency fields like Unit Price, Total, Sub-total etc of Inventory modules, do not need currency conversion
if ($field->getUIType() == '72') {
$curid_value = explode("::", $value);
$currency_id = $curid_value[0];
$currency_value = $curid_value[1];
$cur_sym_rate = getCurrencySymbolandCRate($currency_id);
if ($value != '') {
$formattedCurrencyValue = CurrencyField::convertToUserFormat($currency_value, null, true);
$fieldvalue = CurrencyField::appendCurrencySymbol($formattedCurrencyValue, $cur_sym_rate['symbol']);
}
} else {
$currencyField = new CurrencyField($value);
$fieldvalue = $currencyField->getDisplayValue();
}
} elseif ($dbField->name == "PurchaseOrder_Currency" || $dbField->name == "SalesOrder_Currency" || $dbField->name == "Invoice_Currency" || $dbField->name == "Quotes_Currency" || $dbField->name == "PriceBooks_Currency") {
if ($value != '') {
$fieldvalue = getTranslatedCurrencyString($value);
}
} elseif (in_array($dbField->name, $report->ui101_fields) && !empty($value)) {
if (is_numeric($value)) {
$entityNames = getEntityName('Users', $value);
$fieldvalue = $entityNames[$value];
} else {
$fieldvalue = $value;
}
} elseif ($fieldType == 'date' && !empty($value)) {
if ($module == 'Calendar' && $field->getFieldName() == 'due_date') {
$endTime = $valueArray['calendar_end_time'];
if (empty($endTime)) {
$recordId = $valueArray['calendar_id'];
$endTime = getSingleFieldValue('vtiger_activity', 'time_end', 'activityid', $recordId);
}
$date = new DateTimeField($value . ' ' . $endTime);
$fieldvalue = $date->getDisplayDate();
} else {
$fieldvalue = DateTimeField::convertToUserFormat($value);
}
} elseif ($fieldType == "datetime" && !empty($value)) {
$date = new DateTimeField($value);
$fieldvalue = $date->getDisplayDateTimeValue();
} elseif ($fieldType == 'time' && !empty($value) && $field->getFieldName() != 'duration_hours' && $field->getFieldName() != 'totaltime') {
$date = new DateTimeField($value);
$fieldvalue = $date->getDisplayTime();
} elseif ($fieldType == "picklist" && !empty($value)) {
if (is_array($picklistArray)) {
if (is_array($picklistArray[$dbField->name]) && $field->getFieldName() != 'activitytype' && !in_array($value, $picklistArray[$dbField->name])) {
$fieldvalue = $app_strings['LBL_NOT_ACCESSIBLE'];
} else {
$fieldvalue = getTranslatedString($value, $module);
}
} else {
$fieldvalue = getTranslatedString($value, $module);
}
} elseif ($fieldType == "multipicklist" && !empty($value)) {
if (is_array($picklistArray[1])) {
$valueList = explode(' |##| ', $value);
$translatedValueList = array();
foreach ($valueList as $value) {
if (is_array($picklistArray[1][$dbField->name]) && !in_array($value, $picklistArray[1][$dbField->name])) {
$translatedValueList[] = $app_strings['LBL_NOT_ACCESSIBLE'];
} else {
$translatedValueList[] = getTranslatedString($value, $module);
}
}
}
if (!is_array($picklistArray[1]) || !is_array($picklistArray[1][$dbField->name])) {
$fieldvalue = str_replace(' |##| ', ', ', $value);
} else {
implode(', ', $translatedValueList);
}
}
if ($fieldvalue == "") {
return "-";
}
$fieldvalue = str_replace("<", "<", $fieldvalue);
//.........这里部分代码省略.........