当前位置: 首页>>代码示例>>PHP>>正文


PHP getCurrencyDecimalPlaces函数代码示例

本文整理汇总了PHP中getCurrencyDecimalPlaces函数的典型用法代码示例。如果您正苦于以下问题:PHP getCurrencyDecimalPlaces函数的具体用法?PHP getCurrencyDecimalPlaces怎么用?PHP getCurrencyDecimalPlaces使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了getCurrencyDecimalPlaces函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getProducts

 function getProducts()
 {
     $numOfCurrencyDecimalPlaces = getCurrencyDecimalPlaces();
     $relatedProducts = getAssociatedProducts($this->getModuleName(), $this->getEntity());
     $productsCount = count($relatedProducts);
     //Updating Pre tax total
     $preTaxTotal = (double) $relatedProducts[1]['final_details']['hdnSubTotal'] + (double) $relatedProducts[1]['final_details']['shipping_handling_charge'] - (double) $relatedProducts[1]['final_details']['discountTotal_final'];
     $relatedProducts[1]['final_details']['preTaxTotal'] = number_format($preTaxTotal, $numOfCurrencyDecimalPlaces, '.', '');
     //Updating Total After Discount
     $totalAfterDiscount = (double) $relatedProducts[1]['final_details']['hdnSubTotal'] - (double) $relatedProducts[1]['final_details']['discountTotal_final'];
     $relatedProducts[1]['final_details']['totalAfterDiscount'] = number_format($totalAfterDiscount, $numOfCurrencyDecimalPlaces, '.', '');
     //Updating Tax details
     $taxtype = $relatedProducts[1]['final_details']['taxtype'];
     for ($i = 1; $i <= $productsCount; $i++) {
         $product = $relatedProducts[$i];
         $productId = $product['hdnProductId' . $i];
         $totalAfterDiscount = $product['totalAfterDiscount' . $i];
         if ($taxtype == 'individual') {
             $taxDetails = getTaxDetailsForProduct($productId, 'all');
             $taxCount = count($taxDetails);
             $taxTotal = '0';
             for ($j = 0; $j < $taxCount; $j++) {
                 $taxValue = $product['taxes'][$j]['percentage'];
                 $taxAmount = $totalAfterDiscount * $taxValue / 100;
                 $taxTotal = $taxTotal + $taxAmount;
                 $relatedProducts[$i]['taxes'][$j]['amount'] = $taxAmount;
                 $relatedProducts[$i]['taxTotal' . $i] = $taxTotal;
             }
             $netPrice = $totalAfterDiscount + $taxTotal;
             $relatedProducts[$i]['netPrice' . $i] = $netPrice;
         }
     }
     return $relatedProducts;
 }
开发者ID:gitter-badger,项目名称:openshift-salesplatform,代码行数:34,代码来源:Record.php

示例2: getProducts

 function getProducts()
 {
     $relatedProducts = getAssociatedProducts($this->getModuleName(), $this->getEntity());
     $relatedProducts[1]['final_details']['grandTotal'] = number_format($this->get('hdnGrandTotal'), getCurrencyDecimalPlaces(), '.', '');
     $relatedProducts[1]['final_details']['total_purchase'] = number_format($this->get('total_purchase'), getCurrencyDecimalPlaces(), '.', '');
     $relatedProducts[1]['final_details']['total_margin'] = number_format($this->get('total_margin'), getCurrencyDecimalPlaces(), '.', '');
     $relatedProducts[1]['final_details']['total_marginp'] = number_format($this->get('total_marginp'), getCurrencyDecimalPlaces(), '.', '');
     //Updating Pre tax total
     $preTaxTotal = (double) $relatedProducts[1]['final_details']['hdnSubTotal'] - (double) $relatedProducts[1]['final_details']['discountTotal_final'];
     $relatedProducts[1]['final_details']['preTaxTotal'] = number_format($preTaxTotal, getCurrencyDecimalPlaces(), '.', '');
     //Updating Total After Discount
     $totalAfterDiscount = (double) $relatedProducts[1]['final_details']['hdnSubTotal'] - (double) $relatedProducts[1]['final_details']['discountTotal_final'];
     $relatedProducts[1]['final_details']['totalAfterDiscount'] = number_format($totalAfterDiscount, getCurrencyDecimalPlaces(), '.', '');
     return $relatedProducts;
 }
开发者ID:rcrrich,项目名称:UpdatePackages,代码行数:15,代码来源:Record.php

示例3: getPriceBookRelatedProducts

/**	Function to display the Products which are related to the PriceBook
 *	@param string $query - query to get the list of products which are related to the current PriceBook
 *	@param object $focus - PriceBook object which contains all the information of the current PriceBook
 *	@param string $returnset - return_module, return_action and return_id which are sequenced with & to pass to the URL which is optional
 *	return array $return_data which will be formed like array('header'=>$header,'entries'=>$entries_list) where as $header contains all the header columns and $entries_list will contain all the Product entries
 */
function getPriceBookRelatedProducts($query, $focus, $returnset = '')
{
    global $log;
    $log->debug("Entering getPriceBookRelatedProducts(" . $query . "," . get_class($focus) . "," . $returnset . ") method ...");
    global $adb;
    global $app_strings;
    global $mod_strings;
    global $current_language, $current_user;
    $current_module_strings = return_module_language($current_language, 'PriceBook');
    $no_of_decimal_places = getCurrencyDecimalPlaces();
    global $list_max_entries_per_page;
    global $urlPrefix;
    global $theme;
    $pricebook_id = vtlib_purify($_REQUEST['record']);
    $theme_path = "themes/" . $theme . "/";
    $image_path = $theme_path . "images/";
    $computeCount = $_REQUEST['withCount'];
    if (PerformancePrefs::getBoolean('LISTVIEW_COMPUTE_PAGE_COUNT', false) === true || (bool) $computeCount == true) {
        $noofrows = $adb->query_result($adb->query(Vtiger_Functions::mkCountQuery($query)), 0, 'count');
    } else {
        $noofrows = null;
    }
    $module = 'PriceBooks';
    $relatedmodule = 'Products';
    if (!$_SESSION['rlvs'][$module][$relatedmodule]) {
        $modObj = new ListViewSession();
        $modObj->sortby = $focus->default_order_by;
        $modObj->sorder = $focus->default_sort_order;
        $_SESSION['rlvs'][$module][$relatedmodule] = get_object_vars($modObj);
    }
    if (isset($_REQUEST['relmodule']) && $_REQUEST['relmodule'] != '' && $_REQUEST['relmodule'] == $relatedmodule) {
        $relmodule = vtlib_purify($_REQUEST['relmodule']);
        if ($_SESSION['rlvs'][$module][$relmodule]) {
            setSessionVar($_SESSION['rlvs'][$module][$relmodule], $noofrows, $list_max_entries_per_page, $module, $relmodule);
        }
    }
    global $relationId;
    $start = RelatedListViewSession::getRequestCurrentPage($relationId, $query);
    $navigation_array = VT_getSimpleNavigationValues($start, $list_max_entries_per_page, $noofrows);
    $limit_start_rec = ($start - 1) * $list_max_entries_per_page;
    if ($adb->dbType == "pgsql") {
        $list_result = $adb->pquery($query . " OFFSET {$limit_start_rec} LIMIT {$list_max_entries_per_page}", array());
    } else {
        $list_result = $adb->pquery($query . " LIMIT {$limit_start_rec}, {$list_max_entries_per_page}", array());
    }
    $header = array();
    $header[] = $mod_strings['LBL_LIST_PRODUCT_NAME'];
    if (getFieldVisibilityPermission('Products', $current_user->id, 'productcode') == '0') {
        $header[] = $mod_strings['LBL_PRODUCT_CODE'];
    }
    if (getFieldVisibilityPermission('Products', $current_user->id, 'unit_price') == '0') {
        $header[] = $mod_strings['LBL_PRODUCT_UNIT_PRICE'];
    }
    $header[] = $mod_strings['LBL_PB_LIST_PRICE'];
    if (isPermitted("PriceBooks", "EditView", "") == 'yes' || isPermitted("PriceBooks", "Delete", "") == 'yes') {
        $header[] = $mod_strings['LBL_ACTION'];
    }
    $currency_id = $focus->column_fields['currency_id'];
    $numRows = $adb->num_rows($list_result);
    for ($i = 0; $i < $numRows; $i++) {
        $entity_id = $adb->query_result($list_result, $i, "crmid");
        $unit_price = $adb->query_result($list_result, $i, "unit_price");
        if ($currency_id != null) {
            $prod_prices = getPricesForProducts($currency_id, array($entity_id));
            $unit_price = $prod_prices[$entity_id];
        }
        $listprice = $adb->query_result($list_result, $i, "listprice");
        $field_name = $entity_id . "_listprice";
        $entries = array();
        $entries[] = textlength_check($adb->query_result($list_result, $i, "productname"));
        if (getFieldVisibilityPermission('Products', $current_user->id, 'productcode') == '0') {
            $entries[] = $adb->query_result($list_result, $i, "productcode");
        }
        if (getFieldVisibilityPermission('Products', $current_user->id, 'unit_price') == '0') {
            $entries[] = CurrencyField::convertToUserFormat($unit_price, null, true);
        }
        $entries[] = CurrencyField::convertToUserFormat($listprice, null, true);
        $action = "";
        if (isPermitted("PriceBooks", "EditView", "") == 'yes' && isPermitted('Products', 'EditView', $entity_id) == 'yes') {
            $action .= '<img style="cursor:pointer;" src="' . vtiger_imageurl('editfield.gif', $theme) . '" border="0" onClick="fnvshobj(this,\'editlistprice\'),editProductListPrice(\'' . $entity_id . '\',\'' . $pricebook_id . '\',\'' . number_format($listprice, $no_of_decimal_places, '.', '') . '\')" alt="' . $app_strings["LBL_EDIT_BUTTON"] . '" title="' . $app_strings["LBL_EDIT_BUTTON"] . '"/>';
        } else {
            $action .= '<img src="' . vtiger_imageurl('blank.gif', $theme) . '" border="0" />';
        }
        if (isPermitted("PriceBooks", "Delete", "") == 'yes' && isPermitted('Products', 'Delete', $entity_id) == 'yes') {
            if ($action != "") {
                $action .= '&nbsp;|&nbsp;';
            }
            $action .= '<img src="' . vtiger_imageurl('delete.gif', $theme) . '" onclick="if(confirm(\'' . $app_strings['ARE_YOU_SURE'] . '\')) deletePriceBookProductRel(' . $entity_id . ',' . $pricebook_id . ');" alt="' . $app_strings["LBL_DELETE"] . '" title="' . $app_strings["LBL_DELETE"] . '" style="cursor:pointer;" border="0">';
        }
        if ($action != "") {
            $entries[] = $action;
        }
        $entries_list[] = $entries;
    }
//.........这里部分代码省略.........
开发者ID:cannking,项目名称:vtigercrm-debug,代码行数:101,代码来源:RelatedListView.php

示例4: retrieve_entity_info

 /** Function to retreive the user info of the specifed user id The user info will be available in $this->column_fields array
  * @param $record -- record id:: Type integer
  * @param $module -- module:: Type varchar
  */
 function retrieve_entity_info($record, $module)
 {
     $adb = PearDatabase::getInstance();
     $log = vglobal('log');
     $log->debug("Entering into retrieve_entity_info({$record}, {$module}) method.");
     if ($record == '') {
         $log->debug("record is empty. returning null");
         return null;
     }
     $result = array();
     foreach ($this->tab_name_index as $table_name => $index) {
         $result[$table_name] = $adb->pquery("select * from " . $table_name . " where " . $index . "=?", array($record));
     }
     $tabid = getTabid($module);
     $sql1 = "select * from vtiger_field where tabid=? and vtiger_field.presence in (0,2)";
     $result1 = $adb->pquery($sql1, array($tabid));
     $noofrows = $adb->num_rows($result1);
     for ($i = 0; $i < $noofrows; $i++) {
         $fieldcolname = $adb->query_result($result1, $i, "columnname");
         $tablename = $adb->query_result($result1, $i, "tablename");
         $fieldname = $adb->query_result($result1, $i, "fieldname");
         $fld_value = $adb->query_result($result[$tablename], 0, $fieldcolname);
         $this->column_fields[$fieldname] = $fld_value;
         $this->{$fieldname} = $fld_value;
     }
     $this->column_fields["record_id"] = $record;
     $this->column_fields["record_module"] = $module;
     $currency_query = "select * from vtiger_currency_info where id=? and currency_status='Active' and deleted=0";
     $currency_result = $adb->pquery($currency_query, array($this->column_fields["currency_id"]));
     if ($adb->num_rows($currency_result) == 0) {
         $currency_query = "select * from vtiger_currency_info where id =1";
         $currency_result = $adb->pquery($currency_query, array());
     }
     $currency_array = array("\$" => "&#36;", "&euro;" => "&#8364;", "&pound;" => "&#163;", "&yen;" => "&#165;");
     $ui_curr = $currency_array[$adb->query_result($currency_result, 0, "currency_symbol")];
     if ($ui_curr == "") {
         $ui_curr = $adb->query_result($currency_result, 0, "currency_symbol");
     }
     $this->column_fields["currency_name"] = $this->currency_name = $adb->query_result($currency_result, 0, "currency_name");
     $this->column_fields["currency_code"] = $this->currency_code = $adb->query_result($currency_result, 0, "currency_code");
     $this->column_fields["currency_symbol"] = $this->currency_symbol = $ui_curr;
     $this->column_fields["conv_rate"] = $this->conv_rate = $adb->query_result($currency_result, 0, "conversion_rate");
     if ($this->column_fields['no_of_currency_decimals'] == '') {
         $this->column_fields['no_of_currency_decimals'] = $this->no_of_currency_decimals = getCurrencyDecimalPlaces();
     }
     // TODO - This needs to be cleaned up once default values for fields are picked up in a cleaner way.
     // This is just a quick fix to ensure things doesn't start breaking when the user currency configuration is missing
     if ($this->column_fields['currency_grouping_pattern'] == '' && $this->column_fields['currency_symbol_placement'] == '') {
         $this->column_fields['currency_grouping_pattern'] = $this->currency_grouping_pattern = '123,456,789';
         $this->column_fields['currency_decimal_separator'] = $this->currency_decimal_separator = '.';
         $this->column_fields['currency_grouping_separator'] = $this->currency_grouping_separator = ',';
         $this->column_fields['currency_symbol_placement'] = $this->currency_symbol_placement = '$1.0';
     }
     // TODO - This needs to be cleaned up once default values for fields are picked up in a cleaner way.
     // This is just a quick fix to ensure things doesn't start breaking when the user currency configuration is missing
     if ($this->column_fields['currency_grouping_pattern'] == '' && $this->column_fields['currency_symbol_placement'] == '') {
         $this->column_fields['currency_grouping_pattern'] = $this->currency_grouping_pattern = '123,456,789';
         $this->column_fields['currency_decimal_separator'] = $this->currency_decimal_separator = '.';
         $this->column_fields['currency_grouping_separator'] = $this->currency_grouping_separator = ',';
         $this->column_fields['currency_symbol_placement'] = $this->currency_symbol_placement = '$1.0';
     }
     $this->id = $record;
     $log->debug("Exit from retrieve_entity_info({$record}, {$module}) method.");
     return $this;
 }
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:69,代码来源:Users.php

示例5: getAssociatedProducts

 function getAssociatedProducts($module, $focus, $seid = '')
 {
     $log = vglobal('log');
     $log->debug("Entering Calculations_Record_Model getAssociatedProducts(" . $module . "," . get_class($focus) . "," . $seid . "='') method ...");
     $adb = PearDatabase::getInstance();
     $output = '';
     global $theme;
     $no_of_decimal_places = getCurrencyDecimalPlaces();
     $theme_path = "themes/" . $theme . "/";
     $image_path = $theme_path . "images/";
     $product_Detail = array();
     if ($module == 'Calculations') {
         $query = "SELECT\n\t\t\t\t\t\tcase when vtiger_products.productid != '' then vtiger_products.productname else vtiger_service.servicename end as productname,\n\t\t\t\t\t\tcase when vtiger_products.productid != '' then vtiger_products.productcode else vtiger_service.service_no end as productcode,\n\t\t\t\t\t\tcase when vtiger_products.productid != '' then vtiger_products.unit_price else vtiger_service.unit_price end as unit_price,\n\t\t\t\t\t\tcase when vtiger_products.productid != '' then vtiger_products.qtyinstock else 'NA' end as qtyinstock,\n\t\t\t\t\t\tcase when vtiger_products.productid != '' then 'Products' else 'Services' end as entitytype,\n\t\t\t\t\t\t\t\t\tvtiger_calculationsproductrel.listprice,\n\t\t\t\t\t\t\t\t\tvtiger_calculationsproductrel.description AS product_description,\n\t\t\t\t\t\t\t\t\tvtiger_calculationsproductrel.*,vtiger_crmentity.deleted,\n\t\t\t\t\t\t\t\t\tvtiger_products.usageunit,\n\t\t\t\t\t\t\t\t\tvtiger_service.service_usageunit\n\t\t\t\t\t\t\t\t\tFROM vtiger_calculationsproductrel\n\t\t\t\t\t\t\t\t\tLEFT JOIN vtiger_crmentity ON vtiger_crmentity.crmid=vtiger_calculationsproductrel.productid\n\t\t\t\t\t\t\t\t\tLEFT JOIN vtiger_products\n\t\t\t\t\t\t\t\t\t\t\tON vtiger_products.productid=vtiger_calculationsproductrel.productid\n\t\t\t\t\t\t\t\t\tLEFT JOIN vtiger_service\n\t\t\t\t\t\t\t\t\t\t\tON vtiger_service.serviceid=vtiger_calculationsproductrel.productid\n\t\t\t\t\t\t\t\t\tWHERE id=?\n\t\t\t\t\t\t\t\t\tORDER BY sequence_no";
         $params = array($focus->id);
     } elseif ($module == 'Products') {
         $query = "SELECT\n\t\t\t\t\t\t\t\t\tvtiger_products.productid,\n\t\t\t\t\t\t\t\t\tvtiger_products.productcode,\n\t\t\t\t\t\t\t\t\tvtiger_products.productname,\n\t\t\t\t\t\t\t\t\tvtiger_products.unit_price,\n\t\t\t\t\t\t\t\t\tvtiger_products.usageunit,\n\t\t\t\t\t\t\t\t\tvtiger_products.qtyinstock,vtiger_crmentity.deleted,\n\t\t\t\t\t\t\t\t\tvtiger_crmentity.description AS product_description,\n\t\t\t\t\t\t\t\t\t'Products' AS entitytype\n\t\t\t\t\t\t\t\t\tFROM vtiger_products\n\t\t\t\t\t\t\t\t\tINNER JOIN vtiger_crmentity\n\t\t\t\t\t\t\t\t\t\t\tON vtiger_crmentity.crmid=vtiger_products.productid\n\t\t\t\t\t\t\t\t\tWHERE vtiger_crmentity.deleted=0\n\t\t\t\t\t\t\t\t\t\t\tAND productid=?";
         $params = array($seid);
     } elseif ($module == 'Services') {
         $query = "SELECT\n\t\t\t\t\t\t\t\t\tvtiger_service.serviceid AS productid,\n\t\t\t\t\t\t\t\t\t'NA' AS productcode,\n\t\t\t\t\t\t\t\t\tvtiger_service.servicename AS productname,\n\t\t\t\t\t\t\t\t\tvtiger_service.unit_price AS unit_price,\n\t\t\t\t\t\t\t\t\tvtiger_service.service_usageunit AS usageunit,\n\t\t\t\t\t\t\t\t\t'NA' AS qtyinstock,vtiger_crmentity.deleted,\n\t\t\t\t\t\t\t\t\tvtiger_crmentity.description AS product_description,\n\t\t\t\t\t\t\t\t\t'Services' AS entitytype\n\t\t\t\t\t\t\t\t\tFROM vtiger_service\n\t\t\t\t\t\t\t\t\tINNER JOIN vtiger_crmentity\n\t\t\t\t\t\t\t\t\t\t\tON vtiger_crmentity.crmid=vtiger_service.serviceid\n\t\t\t\t\t\t\t\t\tWHERE vtiger_crmentity.deleted=0\n\t\t\t\t\t\t\t\t\t\t\tAND serviceid=?";
         $params = array($seid);
     }
     $result = $adb->pquery($query, $params);
     $num_rows = $adb->num_rows($result);
     for ($i = 1; $i <= $num_rows; $i++) {
         $deleted = $adb->query_result($result, $i - 1, 'deleted');
         $hdnProductId = $adb->query_result($result, $i - 1, 'productid');
         $hdnProductcode = $adb->query_result($result, $i - 1, 'productcode');
         $productname = $adb->query_result($result, $i - 1, 'productname');
         $productdescription = $adb->query_result($result, $i - 1, 'product_description');
         $comment = decode_html($adb->query_result($result, $i - 1, 'comment'));
         $qtyinstock = $adb->query_result($result, $i - 1, 'qtyinstock');
         $qty = $adb->query_result($result, $i - 1, 'quantity');
         $unitprice = $adb->query_result($result, $i - 1, 'unit_price');
         $listprice = $adb->query_result($result, $i - 1, 'listprice');
         $entitytype = $adb->query_result($result, $i - 1, 'entitytype');
         if ($entitytype == 'Services') {
             $usageunit = vtranslate($adb->query_result($result, $i - 1, 'service_usageunit'), $entitytype);
         } else {
             $usageunit = vtranslate($adb->query_result($result, $i - 1, 'usageunit'), $entitytype);
         }
         $rbh = $adb->query_result($result, $i - 1, 'rbh');
         $purchase = $adb->query_result($result, $i - 1, 'purchase');
         $margin = $adb->query_result($result, $i - 1, 'margin');
         $marginp = $adb->query_result($result, $i - 1, 'marginp');
         if ($deleted || !isset($deleted)) {
             $product_Detail[$i]['productDeleted' . $i] = true;
         } elseif (!$deleted) {
             $product_Detail[$i]['productDeleted' . $i] = false;
         }
         if (!empty($entitytype)) {
             $product_Detail[$i]['entityType' . $i] = $entitytype;
         }
         if ($listprice == '') {
             $listprice = $unitprice;
         }
         if ($qty == '') {
             $qty = 1;
         }
         //calculate productTotal
         $productTotal = $qty * $listprice;
         //Delete link in First column
         if ($i != 1) {
             $product_Detail[$i]['delRow' . $i] = "Del";
         }
         if (empty($focus->mode) && $seid != '') {
             $sub_prod_query = $adb->pquery("SELECT crmid as prod_id from vtiger_seproductsrel WHERE productid=? AND setype='Products'", array($seid));
         } else {
             $sub_prod_query = $adb->pquery("SELECT productid as prod_id from vtiger_inventorysubproductrel WHERE id=? AND sequence_no=?", array($focus->id, $i));
         }
         $subprodid_str = '';
         $subprodname_str = '';
         $subProductArray = array();
         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, 'prod_id');
                 $sprod_name = $subProductArray[] = getProductName($sprod_id);
                 $str_sep = "";
                 if ($j > 0) {
                     $str_sep = ":";
                 }
                 $subprodid_str .= $str_sep . $sprod_id;
                 $subprodname_str .= $str_sep . " - " . $sprod_name;
             }
         }
         $subprodname_str = str_replace(":", "<br>", $subprodname_str);
         $product_Detail[$i]['subProductArray' . $i] = $subProductArray;
         $product_Detail[$i]['hdnProductId' . $i] = $hdnProductId;
         $product_Detail[$i]['productName' . $i] = from_html($productname);
         /* Added to fix the issue Product Pop-up name display*/
         if ($_REQUEST['action'] == 'CreateSOPDF' || $_REQUEST['action'] == 'CreatePDF' || $_REQUEST['action'] == 'SendPDFMail') {
             $product_Detail[$i]['productName' . $i] = htmlspecialchars($product_Detail[$i]['productName' . $i]);
         }
         $product_Detail[$i]['hdnProductcode' . $i] = $hdnProductcode;
         $product_Detail[$i]['productDescription' . $i] = from_html($productdescription);
         if ($module == 'Potentials' || $module == 'Products' || $module == 'Services') {
             $product_Detail[$i]['comment' . $i] = $productdescription;
         } else {
             $product_Detail[$i]['comment' . $i] = $comment;
         }
         $listprice = number_format($listprice, $no_of_decimal_places, '.', '');
//.........这里部分代码省略.........
开发者ID:JeRRimix,项目名称:YetiForceCRM,代码行数:101,代码来源:Record.php

示例6: initialize

 /**
  * Initializes the User's Currency Details
  * @global Users $current_user
  * @param Users $user
  */
 public function initialize($user = null)
 {
     global $current_user, $default_charset;
     if (empty($user)) {
         $user = $current_user;
     }
     if (!empty($user->currency_grouping_pattern)) {
         $this->currencyFormat = html_entity_decode($user->currency_grouping_pattern, ENT_QUOTES, $default_charset);
         $this->currencySeparator = str_replace(" ", ' ', html_entity_decode($user->currency_grouping_separator, ENT_QUOTES, $default_charset));
         $this->decimalSeparator = str_replace(" ", ' ', html_entity_decode($user->currency_decimal_separator, ENT_QUOTES, $default_charset));
     }
     if (!empty($user->currency_id)) {
         $this->currencyId = $user->currency_id;
     } else {
         $this->currencyId = self::getDBCurrencyId();
     }
     $currencyRateAndSymbol = getCurrencySymbolandCRate($this->currencyId);
     $this->currencySymbol = $currencyRateAndSymbol['symbol'];
     $this->conversionRate = $currencyRateAndSymbol['rate'];
     $this->currencySymbolPlacement = $user->currency_symbol_placement;
     $this->numberOfDecimal = getCurrencyDecimalPlaces();
 }
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:27,代码来源:CurrencyField.php

示例7: buildSummaryModel

 function buildSummaryModel()
 {
     $associated_products = $this->associated_products;
     $final_details = $associated_products[1]['final_details'];
     $summaryModel = new Vtiger_PDF_Model();
     $netTotal = $discount = $handlingCharges = $handlingTaxes = 0;
     $adjustment = $grandTotal = 0;
     $productLineItemIndex = 0;
     $sh_tax_percent = 0;
     foreach ($associated_products as $productLineItem) {
         ++$productLineItemIndex;
         $netTotal += $productLineItem["netPrice{$productLineItemIndex}"];
     }
     $netTotal = number_format($netTotal + $this->totaltaxes, getCurrencyDecimalPlaces(), '.', '');
     $summaryModel->set(getTranslatedString("Net Total", $this->moduleName), $this->formatPrice($netTotal));
     $discount_amount = $final_details["discount_amount_final"];
     $discount_percent = $final_details["discount_percentage_final"];
     $discount = 0.0;
     $discount_final_percent = '0.00';
     if ($final_details['discount_type_final'] == 'amount') {
         $discount = $discount_amount;
     } else {
         if ($final_details['discount_type_final'] == 'percentage') {
             $discount_final_percent = $discount_percent;
             $discount = $discount_percent * $final_details["hdnSubTotal"] / 100;
         }
     }
     $summaryModel->set(getTranslatedString("Discount", $this->moduleName) . "({$discount_final_percent}%)", $this->formatPrice($discount));
     $group_total_tax_percent = '0.00';
     //To calculate the group tax amount
     if ($final_details['taxtype'] == 'group') {
         $group_tax_details = $final_details['taxes'];
         for ($i = 0; $i < count($group_tax_details); $i++) {
             $group_total_tax_percent += $group_tax_details[$i]['percentage'];
         }
         $summaryModel->set(getTranslatedString("Tax:", $this->moduleName) . "({$group_total_tax_percent}%)", $this->formatPrice($final_details['tax_totalamount']));
     }
     //Shipping & Handling taxes
     $sh_tax_details = $final_details['sh_taxes'];
     for ($i = 0; $i < count($sh_tax_details); $i++) {
         $sh_tax_percent = $sh_tax_percent + $sh_tax_details[$i]['percentage'];
     }
     //obtain the Currency Symbol
     $currencySymbol = $this->buildCurrencySymbol();
     $summaryModel->set(getTranslatedString("Shipping & Handling Charges", $this->moduleName), $this->formatPrice($final_details['shipping_handling_charge']));
     $summaryModel->set(getTranslatedString("Shipping & Handling Tax:", $this->moduleName) . "({$sh_tax_percent}%)", $this->formatPrice($final_details['shtax_totalamount']));
     $summaryModel->set(getTranslatedString("Adjustment", $this->moduleName), $this->formatPrice($final_details['adjustment']));
     $summaryModel->set(getTranslatedString("Grand Total:", $this->moduleName) . "(in {$currencySymbol})", $this->formatPrice($final_details['grandTotal']));
     // TODO add currency string
     if ($this->moduleName == 'Invoice') {
         $receivedVal = $this->focusColumnValue("received");
         if (!$receivedVal) {
             $this->focus->column_fields["received"] = 0;
         }
         //If Received value is exist then only Recieved, Balance details should present in PDF
         if ($this->formatPrice($this->focusColumnValue("received")) > 0) {
             $summaryModel->set(getTranslatedString("Received", $this->moduleName), $this->formatPrice($this->focusColumnValue("received")));
             $summaryModel->set(getTranslatedString("Balance", $this->moduleName), $this->formatPrice($this->focusColumnValue("balance")));
         }
     }
     return $summaryModel;
 }
开发者ID:nouphet,项目名称:vtigercrm-6.0.0-ja,代码行数:62,代码来源:InventoryPDFController.php

示例8: getAssociatedProducts

 function getAssociatedProducts($module, $focus, $seid = '')
 {
     $adb = PearDatabase::getInstance();
     $current_user = vglobal('current_user');
     $log = vglobal('log');
     $theme = vglobal('theme');
     $log->debug("Entering OSSCosts_Record_Model getAssociatedProducts(" . $module . "," . get_class($focus) . "," . $seid . "='') method ...");
     $output = '';
     $no_of_decimal_places = getCurrencyDecimalPlaces();
     $theme_path = "themes/" . $theme . "/";
     $image_path = $theme_path . "images/";
     $product_Detail = array();
     if ($module == 'OSSCosts') {
         $query = "SELECT\n\t\t\t\t\t\tcase when vtiger_products.productid != '' then vtiger_products.productname else vtiger_service.servicename end as productname,\n\t\t\t\t\t\tcase when vtiger_products.productid != '' then vtiger_products.productcode else vtiger_service.service_no end as productcode,\n\t\t\t\t\t\tcase when vtiger_products.productid != '' then vtiger_products.unit_price else vtiger_service.unit_price end as unit_price,\n\t\t\t\t\t\tcase when vtiger_products.productid != '' then vtiger_products.qtyinstock else 'NA' end as qtyinstock,\n\t\t\t\t\t\tcase when vtiger_products.productid != '' then 'Products' else 'Services' end as entitytype,\n\t\t\t\t\t\t\t\t\tvtiger_inventoryproductrel.listprice,\n\t\t\t\t\t\t\t\t\tvtiger_inventoryproductrel.description AS product_description,\n\t\t\t\t\t\t\t\t\tvtiger_inventoryproductrel.*,vtiger_crmentity.deleted,\n\t\t\t\t\t\t\t\t\tvtiger_products.usageunit,\n\t\t\t\t\t\t\t\t\tvtiger_service.service_usageunit\n\t\t\t\t\t\t\t\t\tFROM vtiger_inventoryproductrel\n\t\t\t\t\t\t\t\t\tLEFT JOIN vtiger_crmentity ON vtiger_crmentity.crmid=vtiger_inventoryproductrel.productid\n\t\t\t\t\t\t\t\t\tLEFT JOIN vtiger_products\n\t\t\t\t\t\t\t\t\t\t\tON vtiger_products.productid=vtiger_inventoryproductrel.productid\n\t\t\t\t\t\t\t\t\tLEFT JOIN vtiger_service\n\t\t\t\t\t\t\t\t\t\t\tON vtiger_service.serviceid=vtiger_inventoryproductrel.productid\n\t\t\t\t\t\t\t\t\tWHERE id=?\n\t\t\t\t\t\t\t\t\tORDER BY sequence_no";
         $params = array($focus->id);
     } elseif ($module == 'Products') {
         $query = "SELECT\n\t\t\t\t\t\t\t\t\tvtiger_products.productid,\n\t\t\t\t\t\t\t\t\tvtiger_products.productcode,\n\t\t\t\t\t\t\t\t\tvtiger_products.productname,\n\t\t\t\t\t\t\t\t\tvtiger_products.unit_price,\n\t\t\t\t\t\t\t\t\tvtiger_products.usageunit,\n\t\t\t\t\t\t\t\t\tvtiger_products.qtyinstock,vtiger_crmentity.deleted,\n\t\t\t\t\t\t\t\t\tvtiger_crmentity.description AS product_description,\n\t\t\t\t\t\t\t\t\t'Products' AS entitytype\n\t\t\t\t\t\t\t\t\tFROM vtiger_products\n\t\t\t\t\t\t\t\t\tINNER JOIN vtiger_crmentity\n\t\t\t\t\t\t\t\t\t\t\tON vtiger_crmentity.crmid=vtiger_products.productid\n\t\t\t\t\t\t\t\t\tWHERE vtiger_crmentity.deleted=0\n\t\t\t\t\t\t\t\t\t\t\tAND productid=?";
         $params = array($seid);
     } elseif ($module == 'Services') {
         $query = "SELECT\n\t\t\t\t\t\t\t\t\tvtiger_service.serviceid AS productid,\n\t\t\t\t\t\t\t\t\t'NA' AS productcode,\n\t\t\t\t\t\t\t\t\tvtiger_service.servicename AS productname,\n\t\t\t\t\t\t\t\t\tvtiger_service.unit_price AS unit_price,\n\t\t\t\t\t\t\t\t\tvtiger_service.service_usageunit AS usageunit,\n\t\t\t\t\t\t\t\t\t'NA' AS qtyinstock,vtiger_crmentity.deleted,\n\t\t\t\t\t\t\t\t\tvtiger_crmentity.description AS product_description,\n\t\t\t\t\t\t\t\t\t'Services' AS entitytype\n\t\t\t\t\t\t\t\t\tFROM vtiger_service\n\t\t\t\t\t\t\t\t\tINNER JOIN vtiger_crmentity\n\t\t\t\t\t\t\t\t\t\t\tON vtiger_crmentity.crmid=vtiger_service.serviceid\n\t\t\t\t\t\t\t\t\tWHERE vtiger_crmentity.deleted=0\n\t\t\t\t\t\t\t\t\t\t\tAND serviceid=?";
         $params = array($seid);
     }
     $result = $adb->pquery($query, $params);
     $num_rows = $adb->num_rows($result);
     $finalTaxTotal = '0.00';
     for ($i = 1; $i <= $num_rows; $i++) {
         $deleted = $adb->query_result($result, $i - 1, 'deleted');
         $hdnProductId = $adb->query_result($result, $i - 1, 'productid');
         $hdnProductcode = $adb->query_result($result, $i - 1, 'productcode');
         $productname = $adb->query_result($result, $i - 1, 'productname');
         $productdescription = $adb->query_result($result, $i - 1, 'product_description');
         $comment = $adb->query_result($result, $i - 1, 'comment');
         $qtyinstock = $adb->query_result($result, $i - 1, 'qtyinstock');
         $qty = $adb->query_result($result, $i - 1, 'quantity');
         $unitprice = $adb->query_result($result, $i - 1, 'unit_price');
         $listprice = $adb->query_result($result, $i - 1, 'listprice');
         $entitytype = $adb->query_result($result, $i - 1, 'entitytype');
         if ($entitytype == 'Services') {
             $usageunit = vtranslate($adb->query_result($result, $i - 1, 'service_usageunit'), $entitytype);
         } else {
             $usageunit = vtranslate($adb->query_result($result, $i - 1, 'usageunit'), $entitytype);
         }
         $tax = $adb->query_result($result, $i - 1, 'tax');
         if ($deleted || !isset($deleted)) {
             $product_Detail[$i]['productDeleted' . $i] = true;
         } elseif (!$deleted) {
             $product_Detail[$i]['productDeleted' . $i] = false;
         }
         if (!empty($entitytype)) {
             $product_Detail[$i]['entityType' . $i] = $entitytype;
         }
         if ($listprice == '') {
             $listprice = $unitprice;
         }
         if ($qty == '') {
             $qty = 1;
         }
         //calculate productTotal
         $productTotal = $qty * $listprice;
         //Delete link in First column
         if ($i != 1) {
             $product_Detail[$i]['delRow' . $i] = "Del";
         }
         if (empty($focus->mode) && $seid != '') {
             $sub_prod_query = $adb->pquery("SELECT crmid as prod_id from vtiger_seproductsrel WHERE productid=? AND setype='Products'", array($seid));
         } else {
             $sub_prod_query = $adb->pquery("SELECT productid as prod_id from vtiger_inventorysubproductrel WHERE id=? AND sequence_no=?", array($focus->id, $i));
         }
         $subprodid_str = '';
         $subprodname_str = '';
         $subProductArray = array();
         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, 'prod_id');
                 $sprod_name = $subProductArray[] = getProductName($sprod_id);
                 $str_sep = "";
                 if ($j > 0) {
                     $str_sep = ":";
                 }
                 $subprodid_str .= $str_sep . $sprod_id;
                 $subprodname_str .= $str_sep . " - " . $sprod_name;
             }
         }
         $subprodname_str = str_replace(":", "<br>", $subprodname_str);
         $product_Detail[$i]['subProductArray' . $i] = $subProductArray;
         $product_Detail[$i]['hdnProductId' . $i] = $hdnProductId;
         $product_Detail[$i]['productName' . $i] = from_html($productname);
         /* Added to fix the issue Product Pop-up name display*/
         if ($_REQUEST['action'] == 'CreateSOPDF' || $_REQUEST['action'] == 'CreatePDF' || $_REQUEST['action'] == 'SendPDFMail') {
             $product_Detail[$i]['productName' . $i] = htmlspecialchars($product_Detail[$i]['productName' . $i]);
         }
         $product_Detail[$i]['hdnProductcode' . $i] = $hdnProductcode;
         $product_Detail[$i]['productDescription' . $i] = from_html($productdescription);
         if ($module == 'Potentials' || $module == 'Products' || $module == 'Services') {
             $product_Detail[$i]['comment' . $i] = $productdescription;
         } else {
             $product_Detail[$i]['comment' . $i] = $comment;
         }
         if ($module != 'PurchaseOrder' && $focus->object_name != 'Order') {
             $product_Detail[$i]['qtyInStock' . $i] = decimalFormat($qtyinstock);
//.........这里部分代码省略.........
开发者ID:rcrrich,项目名称:UpdatePackages,代码行数:101,代码来源:Record.php

示例9: setTableDefinition

 public function setTableDefinition()
 {
     parent::setTableDefinition();
     $this->setTableName('company');
     # override the not null and not blank properties for the createdby column in the BaseEntity
     $this->hasColumn('createdby', 'integer', 11, array('default' => NULL));
     $this->hasColumn('refno', 'string', 15);
     $this->hasColumn('name', 'string', 255, array('notblank' => true));
     $this->hasColumn('appname', 'string', 255);
     $this->hasColumn('headertype', 'integer', null, array('default' => 0));
     $this->hasColumn('slogan', 'string', 255);
     $this->hasColumn('username', 'string', 255);
     $this->hasColumn('abbrv', 'string', 255);
     $this->hasColumn('status', 'integer', null, array('default' => NULL));
     $this->hasColumn('contactperson', 'string', 255);
     $this->hasColumn('email', 'string', 255);
     $this->hasColumn('phone', 'string', 15);
     $this->hasColumn('country', 'string', 2, array('default' => 'UG'));
     $this->hasColumn('addressline1', 'string', 255);
     $this->hasColumn('addressline2', 'string', 255);
     $this->hasColumn('city', 'string', 255);
     $this->hasColumn('postalcode', 'string', 10);
     $this->hasColumn('industrycode', 'string', 15);
     $this->hasColumn('description', 'string', 1000);
     $this->hasColumn('remarks', 'string', 255);
     $this->hasColumn('yearstart', 'date', null, array('default' => getFirstDayOfMonth(1, date('Y'))));
     $this->hasColumn('yearend', 'date', null, array('default' => getLastDayOfMonth(12, date('Y'))));
     $this->hasColumn('ipsubnets', 'string', 255);
     $this->hasColumn('hoursinday', 'string', 50, array('default' => HOURS_IN_DAY));
     $this->hasColumn('openinghour', 'string', 50, array('default' => '08:00 AM'));
     $this->hasColumn('closinghour', 'string', 50, array('default' => '05:00 PM'));
     $this->hasColumn('lunchduration', 'string', 50, array('default' => DEFAULT_LUNCH_DURATION));
     $this->hasColumn('payspaye', 'string', 50, array('default' => 1));
     $this->hasColumn('paysnssf', 'string', 50, array('default' => 1));
     $this->hasColumn('nssfemployeerate', 'string', 50, array('default' => DEFAULT_NSSF_EMP));
     $this->hasColumn('nssfcompanyrate', 'string', 50, array('default' => DEFAULT_NSSF_COM));
     $this->hasColumn('workingdays', 'string', 50);
     $this->hasColumn('maxhoursperday', 'string', 50, array('default' => HOURS_IN_DAY));
     $this->hasColumn('maxhoursperweek', 'string', 50, array('default' => HOURS_IN_WEEK));
     $this->hasColumn('defaultuserid', 'integer', null, array('default' => NULL));
     $this->hasColumn('dateapproved', 'date', null, array('default' => NULL));
     $this->hasColumn('approvedbyid', 'integer', null, array('default' => NULL));
     $this->hasColumn('isinvited', 'integer', null, array('default' => NULL));
     $this->hasColumn('invitedbyid', 'integer', null);
     $this->hasColumn('hasacceptedinvite', 'integer', null, array('default' => 0));
     $this->hasColumn('dateinvited', 'date');
     $this->hasColumn('startdate', 'date', null, array('default' => NULL));
     $this->hasColumn('enddate', 'date', null, array('default' => NULL));
     $this->hasColumn('layout', 'string', 25, array('default' => getDefaultLayout()));
     $this->hasColumn('topbar', 'string', 25, array('default' => getDefaultTopBar()));
     $this->hasColumn('sidebar', 'string', 25, array('default' => getDefaultSideBar()));
     $this->hasColumn('colortheme', 'string', 25, array('default' => getDefaultTheme()));
     $this->hasColumn('showsidebar', 'string', 25, array('default' => getDefaultShowSideBar()));
     $this->hasColumn('logo', 'string', 255);
     $this->hasColumn('defaultadminname', 'string', 255, array('default' => getDefaultAdminName()));
     $this->hasColumn('defaultadminemail', 'string', 255, array('default' => getDefaultAdminEmail()));
     $this->hasColumn('currencysymbol', 'string', 15, array('default' => getCountryCurrencySymbol()));
     $this->hasColumn('currencycode', 'string', 15, array('default' => getCountryCurrencyCode()));
     $this->hasColumn('currencydecimalplaces', 'string', 15, array('default' => getCurrencyDecimalPlaces()));
     $this->hasColumn('numberdecimalplaces', 'string', 15, array('default' => getNumberDecimalPlaces()));
     $this->hasColumn('countryisocode', 'string', 15, array('default' => getCountryCode()));
     $this->hasColumn('phonemaxlength', 'string', 15, array('default' => getMaxPhoneLength()));
     $this->hasColumn('phoneminlength', 'string', 15, array('default' => getMinPhoneLength()));
     $this->hasColumn('nationalidminlength', 'string', 15, array('default' => getNationalIDMaxLength()));
     $this->hasColumn('nationalidmaxlength', 'string', 15, array('default' => getNationalIDMinLength()));
     $this->hasColumn('countryphonecode', 'string', 15, array('default' => getDefaultPhoneCode()));
     $this->hasColumn('timezone', 'string', 255, array('default' => getTimeZine()));
 }
开发者ID:7thZoneTechnology,项目名称:hrms-1,代码行数:68,代码来源:Company.php

示例10: buildSummaryModel

 function buildSummaryModel()
 {
     $associated_products = $this->associated_products;
     $final_details = $associated_products[1]['final_details'];
     $summaryModel = new Vtiger_PDF_Model();
     $netTotal = $discount = $handlingCharges = $handlingTaxes = 0;
     $grandTotal = 0;
     $productLineItemIndex = 0;
     foreach ($associated_products as $productLineItem) {
         ++$productLineItemIndex;
         $netTotal += $productLineItem["netPrice{$productLineItemIndex}"];
     }
     $netTotal = number_format($netTotal + $this->totaltaxes, getCurrencyDecimalPlaces(), '.', '');
     $summaryModel->set(getTranslatedString("Net Total", $this->moduleName), $this->formatPrice($netTotal));
     $discount_amount = $final_details["discount_amount_final"];
     $discount_percent = $final_details["discount_percentage_final"];
     $discount = 0.0;
     $discount_final_percent = '0.00';
     if ($final_details['discount_type_final'] == 'amount') {
         $discount = $discount_amount;
     } else {
         if ($final_details['discount_type_final'] == 'percentage') {
             $discount_final_percent = $discount_percent;
             $discount = $discount_percent * $final_details["hdnSubTotal"] / 100;
         }
     }
     $summaryModel->set(getTranslatedString("Discount", $this->moduleName) . "({$discount_final_percent}%)", $this->formatPrice($discount));
     $group_total_tax_percent = '0.00';
     //To calculate the group tax amount
     if ($final_details['taxtype'] == 'group') {
         $group_tax_details = $final_details['taxes'];
         for ($i = 0; $i < count($group_tax_details); $i++) {
             $group_total_tax_percent += $group_tax_details[$i]['percentage'];
         }
         $summaryModel->set(getTranslatedString("Tax:", $this->moduleName) . "({$group_total_tax_percent}%)", $this->formatPrice($final_details['tax_totalamount']));
     }
     //obtain the Currency Symbol
     $currencySymbol = $this->buildCurrencySymbol();
     $summaryModel->set(getTranslatedString("Grand Total:", $this->moduleName) . "(in {$currencySymbol})", $this->formatPrice($final_details['grandTotal']));
     // TODO add currency string
     return $summaryModel;
 }
开发者ID:nikdejan,项目名称:YetiForceCRM,代码行数:42,代码来源:InventoryPDFController.php

示例11: getAssociatedProducts

/** This function returns the detailed list of vtiger_products associated to a given entity or a record.
* Param $module - module name
* Param $focus - module object
* Param $seid - sales entity id
* Return type is an object array
*/
function getAssociatedProducts($module, $focus, $seid = '')
{
    global $log;
    $log->debug("Entering getAssociatedProducts(" . $module . "," . get_class($focus) . "," . $seid . "='') method ...");
    global $adb;
    $output = '';
    global $theme, $current_user;
    $no_of_decimal_places = getCurrencyDecimalPlaces();
    $theme_path = "themes/" . $theme . "/";
    $image_path = $theme_path . "images/";
    $product_Detail = array();
    // DG 15 Aug 2006
    // Add "ORDER BY sequence_no" to retain add order on all inventoryproductrel items
    // SalesPlatform.ru begin Add Act and Consignment modules
    if ($module == 'Quotes' || $module == 'PurchaseOrder' || $module == 'SalesOrder' || $module == 'Invoice' || $module == 'Act' || $module == 'Consignment') {
        // SalesPlatform.ru begin
        $query = "SELECT \n\t\t\t\t\tcase when vtiger_products.productid != '' then vtiger_products.productname else vtiger_service.servicename end as productname,\n \t\t            case when vtiger_products.productid != '' then vtiger_products.productcode else vtiger_service.service_no end as productcode, \n\t\t\t\t\tcase when vtiger_products.productid != '' then vtiger_products.usageunit else vtiger_service.service_usageunit end as usageunit,\t\t\t\t\t\t\t\t\t\n\t\t\t\t\tcase when vtiger_products.productid != '' then vtiger_products.unit_code else vtiger_service.unit_code end as unit_code,\n\t\t\t\t\tcase when vtiger_products.productid != '' then vtiger_products.unit_price else vtiger_service.unit_price end as unit_price,\t\t\t\t\t\t\t\t\t\n\t\t\t\t\tcase when vtiger_products.productid != '' then vtiger_products.manuf_country else '--' end as manuf_country,\t\t\t\t\t\t\t\t\t\n\t\t\t\t\tcase when vtiger_products.productid != '' then vtiger_products.manuf_country_code else '--' end as manuf_country_code,\n\t\t\t\t\tcase when vtiger_products.productid != '' then vtiger_products.customs_id else '--' end as customs_id,\t\t\t\t\t\t\t\t\t\n \t\t            case when vtiger_products.productid != '' then vtiger_products.qtyinstock else 'NA' end as qtyinstock,\n \t\t            case when vtiger_products.productid != '' then 'Products' else 'Services' end as entitytype,\n \t\t                        vtiger_inventoryproductrel.listprice, \n \t\t                        vtiger_crmentity.description AS product_description, \n \t\t                        vtiger_inventoryproductrel.* , vtiger_crmentity.deleted\n                                    , attachments.attachment_id, attachments.attachment_name, attachments.attachment_path\n \t                            FROM vtiger_inventoryproductrel \n                                LEFT JOIN vtiger_crmentity ON vtiger_crmentity.crmid=vtiger_inventoryproductrel.productid\n \t\t                        LEFT JOIN vtiger_products \n \t\t                                ON vtiger_products.productid=vtiger_inventoryproductrel.productid \n \t\t                        LEFT JOIN vtiger_service \n \t\t                                ON vtiger_service.serviceid=vtiger_inventoryproductrel.productid \n                                        LEFT JOIN (\n                                                    SELECT vtiger_attachments.attachmentsid AS attachment_id,\n                                                        vtiger_seattachmentsrel.crmid AS attachment_crmid, \n                                                        vtiger_attachments.name AS attachment_name, \n                                                        vtiger_attachments.path AS attachment_path \n                                                    FROM vtiger_seattachmentsrel, vtiger_attachments, vtiger_inventoryproductrel \n                                                    WHERE vtiger_seattachmentsrel.crmid=vtiger_inventoryproductrel.productid AND \n                                                        vtiger_attachments.attachmentsid=vtiger_seattachmentsrel.attachmentsid \n                                                    GROUP BY attachment_crmid DESC\n                                                  ) attachments\n                                                ON attachments.attachment_crmid=vtiger_inventoryproductrel.productid                                                \n \t\t                        WHERE id=?\n \t\t                        ORDER BY sequence_no";
        /*		$query="SELECT 
            case when vtiger_products.productid != '' then vtiger_products.productname else vtiger_service.servicename end as productname,
            case when vtiger_products.productid != '' then vtiger_products.productcode else vtiger_service.service_no end as productcode, 
            case when vtiger_products.productid != '' then vtiger_products.usageunit else vtiger_service.service_usageunit end as usageunit,									
            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,
            case when vtiger_products.productid != '' then 'Products' else 'Services' end as entitytype,
                        vtiger_inventoryproductrel.listprice, 
                        vtiger_inventoryproductrel.description AS product_description, 
                        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"; */
        // SalesPlatform.ru end
        $params = array($focus->id);
    } elseif ($module == 'Potentials') {
        $query = "SELECT\n \t\t                        vtiger_products.productname,\n \t\t                        vtiger_products.productcode,\n \t\t                        vtiger_products.unit_price,\n \t\t                        vtiger_products.qtyinstock,\n \t\t                        vtiger_seproductsrel.*,vtiger_crmentity.deleted,\n \t\t                        vtiger_crmentity.description AS product_description\n \t\t                        FROM vtiger_products\n \t\t                        INNER JOIN vtiger_crmentity\n \t\t                                ON vtiger_crmentity.crmid=vtiger_products.productid\n \t\t                        INNER JOIN vtiger_seproductsrel\n \t\t                                ON vtiger_seproductsrel.productid=vtiger_products.productid\n \t\t                        WHERE vtiger_seproductsrel.crmid=?";
        $params = array($seid);
    } elseif ($module == 'Products') {
        $query = "SELECT\n \t\t                        vtiger_products.productid,\n \t\t                        vtiger_products.productcode,\n \t\t                        vtiger_products.productname,\n \t\t                        vtiger_products.unit_price,\n \t\t                        vtiger_products.qtyinstock,vtiger_crmentity.deleted,\n \t\t                        vtiger_crmentity.description AS product_description,\n \t\t                        'Products' AS entitytype\n \t\t                        FROM vtiger_products\n \t\t                        INNER JOIN vtiger_crmentity\n \t\t                                ON vtiger_crmentity.crmid=vtiger_products.productid\n \t\t                        WHERE vtiger_crmentity.deleted=0\n \t\t                                AND productid=?";
        $params = array($seid);
    } elseif ($module == 'Services') {
        $query = "SELECT\n \t\t                        vtiger_service.serviceid AS productid,\n \t\t                        'NA' AS productcode,\n \t\t                        vtiger_service.servicename AS productname,\n \t\t                        vtiger_service.unit_price AS unit_price,\n \t\t                        'NA' AS qtyinstock,vtiger_crmentity.deleted,\n \t\t                        vtiger_crmentity.description AS product_description,\n \t\t                       \t'Services' AS entitytype\n \t\t\t\t\t\t\t\tFROM vtiger_service\n \t\t                        INNER JOIN vtiger_crmentity\n \t\t                                ON vtiger_crmentity.crmid=vtiger_service.serviceid\n \t\t                        WHERE vtiger_crmentity.deleted=0\n \t\t                                AND serviceid=?";
        $params = array($seid);
    }
    $result = $adb->pquery($query, $params);
    $num_rows = $adb->num_rows($result);
    for ($i = 1; $i <= $num_rows; $i++) {
        $deleted = $adb->query_result($result, $i - 1, 'deleted');
        $hdnProductId = $adb->query_result($result, $i - 1, 'productid');
        $hdnProductcode = $adb->query_result($result, $i - 1, 'productcode');
        $productname = $adb->query_result($result, $i - 1, 'productname');
        $productdescription = $adb->query_result($result, $i - 1, 'product_description');
        $comment = $adb->query_result($result, $i - 1, 'comment');
        $qtyinstock = $adb->query_result($result, $i - 1, 'qtyinstock');
        $qty = $adb->query_result($result, $i - 1, 'quantity');
        $unitprice = $adb->query_result($result, $i - 1, 'unit_price');
        $listprice = $adb->query_result($result, $i - 1, 'listprice');
        $entitytype = $adb->query_result($result, $i - 1, 'entitytype');
        // SalesPlatform.ru begin
        if ($module == 'Quotes' || $module == 'PurchaseOrder' || $module == 'SalesOrder' || $module == 'Invoice' || $module == 'Act' || $module == 'Consignment') {
            $manuf_country = $adb->query_result($result, $i - 1, 'manuf_country');
            $customs_id = $adb->query_result($result, $i - 1, 'customs_id');
            $manuf_country_code = $adb->query_result($result, $i - 1, 'manuf_country_code');
            $unit_code = $adb->query_result($result, $i - 1, 'unit_code');
            $usageunit = $adb->query_result($result, $i - 1, 'usageunit');
            $attachment_id = $adb->query_result($result, $i - 1, 'attachment_id');
            $attachment_name = $adb->query_result($result, $i - 1, 'attachment_name');
            $attachment_path = $adb->query_result($result, $i - 1, 'attachment_path');
        }
        // SalesPlatform.ru end
        if ($deleted || !isset($deleted)) {
            $product_Detail[$i]['productDeleted' . $i] = true;
        } elseif (!$deleted) {
            $product_Detail[$i]['productDeleted' . $i] = false;
        }
        if (!empty($entitytype)) {
            $product_Detail[$i]['entityType' . $i] = $entitytype;
        }
        if ($listprice == '') {
            $listprice = $unitprice;
        }
        if ($qty == '') {
            $qty = 1;
        }
        //calculate productTotal
        $productTotal = $qty * $listprice;
        //Delete link in First column
        if ($i != 1) {
            $product_Detail[$i]['delRow' . $i] = "Del";
        }
        if (empty($focus->mode) && $seid != '') {
            $sub_prod_query = $adb->pquery("SELECT crmid as prod_id from vtiger_seproductsrel WHERE productid=? AND setype='Products'", array($seid));
//.........这里部分代码省略.........
开发者ID:zirf0,项目名称:openshift-salesplatform,代码行数:101,代码来源:EditViewUtils.php


注:本文中的getCurrencyDecimalPlaces函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。