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


PHP getTaxDetailsForProduct函数代码示例

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


在下文中一共展示了getTaxDetailsForProduct函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: saveInventoryProductDetails


//.........这里部分代码省略.........
        if ($module != 'PurchaseOrder') {
            //update the stock with existing details
            updateStk($prod_id, $qty, $focus->mode, $ext_prod_arr, $module);
        }
        //we should update discount and tax details
        $updatequery = "update vtiger_inventoryproductrel set ";
        $updateparams = array();
        //set the discount percentage or discount amount in update query, then set the tax values
        if ($_REQUEST['discount_type' . $i] == 'percentage') {
            $updatequery .= " discount_percent=?,";
            array_push($updateparams, $_REQUEST['discount_percentage' . $i]);
        } elseif ($_REQUEST['discount_type' . $i] == 'amount') {
            $updatequery .= " discount_amount=?,";
            $discount_amount = $_REQUEST['discount_amount' . $i];
            array_push($updateparams, $discount_amount);
        }
        if ($_REQUEST['taxtype'] == 'group') {
            for ($tax_count = 0; $tax_count < count($all_available_taxes); $tax_count++) {
                $tax_name = $all_available_taxes[$tax_count]['taxname'];
                if (!in_array($tax_name, $ipr_cols)) {
                    continue;
                }
                $tax_val = $all_available_taxes[$tax_count]['percentage'];
                $request_tax_name = $tax_name . "_group_percentage";
                if (isset($_REQUEST[$request_tax_name])) {
                    $tax_val = vtlib_purify($_REQUEST[$request_tax_name]);
                }
                $updatequery .= " {$tax_name} = ?,";
                array_push($updateparams, $tax_val);
            }
            $updatequery = trim($updatequery, ',') . " where id=? and productid=? and lineitem_id = ?";
            array_push($updateparams, $focus->id, $prod_id, $lineitem_id);
        } else {
            $taxes_for_product = getTaxDetailsForProduct($prod_id, 'all', $acvid);
            for ($tax_count = 0; $tax_count < count($taxes_for_product); $tax_count++) {
                $tax_name = $taxes_for_product[$tax_count]['taxname'];
                if (!in_array($tax_name, $ipr_cols)) {
                    continue;
                }
                $request_tax_name = $tax_name . "_percentage" . $i;
                $updatequery .= " {$tax_name} = ?,";
                array_push($updateparams, vtlib_purify($_REQUEST[$request_tax_name]));
            }
            $updatequery = trim($updatequery, ',') . " where id=? and productid=? and lineitem_id = ?";
            array_push($updateparams, $focus->id, $prod_id, $lineitem_id);
        }
        // jens 2006/08/19 - protect against empy update queries
        if (!preg_match('/set\\s+where/i', $updatequery)) {
            $adb->pquery($updatequery, $updateparams);
        }
    }
    //we should update the netprice (subtotal), taxtype, group discount, S&H charge, S&H taxes, adjustment and total
    //netprice, group discount, taxtype, S&H amount, adjustment and total to entity table
    $updatequery = " update {$focus->table_name} set ";
    $updateparams = array();
    $subtotal = $_REQUEST['subtotal'];
    $updatequery .= " subtotal=?,";
    array_push($updateparams, $subtotal);
    $updatequery .= " taxtype=?,";
    array_push($updateparams, $_REQUEST['taxtype']);
    //for discount percentage or discount amount
    if ($_REQUEST['discount_type_final'] == 'percentage') {
        $updatequery .= " discount_percent=?,";
        array_push($updateparams, vtlib_purify($_REQUEST['discount_percentage_final']));
    } elseif ($_REQUEST['discount_type_final'] == 'amount') {
        $discount_amount_final = vtlib_purify($_REQUEST['discount_amount_final']);
开发者ID:jaimeaga84,项目名称:corebos,代码行数:67,代码来源:InventoryUtils.php

示例3: getDetailAssociatedProducts


//.........这里部分代码省略.........
        //Convert to 2 decimals
        $unitprice = $adb->query_result($result, $i - 1, 'unit_price');
        $listprice = $adb->query_result($result, $i - 1, 'listprice');
        $total = $qty * $listprice;
        $listprice = number_format($listprice, 2, '.', '');
        //Convert to 2 decimals
        //Product wise Discount calculation - starts
        $discount_percent = $adb->query_result($result, $i - 1, 'discount_percent');
        $discount_amount = $adb->query_result($result, $i - 1, 'discount_amount');
        $totalAfterDiscount = $total;
        $productDiscount = '0.00';
        if ($discount_percent != 'NULL' && $discount_percent != '') {
            $productDiscount = $total * $discount_percent / 100;
            $productDiscount = number_format($productDiscount, 2, '.', '');
            $totalAfterDiscount = $total - $productDiscount;
            //if discount is percent then show the percentage
            $discount_info_message = "{$discount_percent} % of " . CurrencyField::convertToUserFormat($total, null, true) . " = " . CurrencyField::convertToUserFormat($productDiscount, null, true);
        } elseif ($discount_amount != 'NULL' && $discount_amount != '') {
            $productDiscount = $discount_amount;
            $productDiscount = number_format($productDiscount, 2, '.', '');
            $totalAfterDiscount = $total - $productDiscount;
            $discount_info_message = $app_strings['LBL_DIRECT_AMOUNT_DISCOUNT'] . " = " . CurrencyField::convertToUserFormat($productDiscount, null, true);
        } else {
            $discount_info_message = $app_strings['LBL_NO_DISCOUNT_FOR_THIS_LINE_ITEM'];
        }
        //Product wise Discount calculation - ends
        $totalAfterDiscount = number_format($totalAfterDiscount, 2, '.', '');
        //Convert to 2 decimals
        $netprice = $totalAfterDiscount;
        //Calculate the individual tax if taxtype is individual
        if ($taxtype == 'individual') {
            $taxtotal = '0.00';
            $tax_info_message = $app_strings['LBL_TOTAL_AFTER_DISCOUNT'] . " = " . CurrencyField::convertToUserFormat($totalAfterDiscount, null, true) . " \\n";
            $tax_details = getTaxDetailsForProduct($productid, 'all', $acvid);
            for ($tax_count = 0; $tax_count < count($tax_details); $tax_count++) {
                $tax_name = $tax_details[$tax_count]['taxname'];
                $tax_label = $tax_details[$tax_count]['taxlabel'];
                $tax_value = getInventoryProductTaxValue($focus->id, $productid, $tax_name);
                $individual_taxamount = $totalAfterDiscount * $tax_value / 100;
                $individual_taxamount = number_format($individual_taxamount, 2, '.', '');
                //Convert to 2 decimals
                $taxtotal = $taxtotal + $individual_taxamount;
                $taxtotal = number_format($taxtotal, 2, '.', '');
                //Convert to 2 decimals
                $tax_info_message .= "{$tax_label} : {$tax_value} % = " . CurrencyField::convertToUserFormat($individual_taxamount, null, true) . " \\n";
            }
            $tax_info_message .= "\\n " . $app_strings['LBL_TOTAL_TAX_AMOUNT'] . " = " . CurrencyField::convertToUserFormat($taxtotal, null, true);
            $netprice = $netprice + $taxtotal;
            $netprice = number_format($netprice, 2, '.', '');
            //Convert to 2 decimals
        }
        $sc_image_tag = '';
        if ($module == 'Invoice') {
            switch ($entitytype) {
                case 'Services':
                    if (vtlib_isModuleActive('ServiceContracts')) {
                        $sc_image_tag = '<a href="index.php?module=ServiceContracts&action=EditView&service_id=' . $productid . '&sc_related_to=' . $focus->column_fields['account_id'] . '&start_date=' . DateTimeField::convertToUserFormat($focus->column_fields['invoicedate']) . '&return_module=' . $module . '&return_id=' . $focus->id . '">' . '<img border="0" src="' . vtiger_imageurl('handshake.gif', $theme) . '" title="' . getTranslatedString('LBL_ADD_NEW', $module) . " " . getTranslatedString('ServiceContracts', 'ServiceContracts') . '" style="cursor: pointer;" align="absmiddle" />' . '</a>';
                    }
                    break;
                case 'Products':
                    if (vtlib_isModuleActive('Assets')) {
                        $sc_image_tag = '<a href="index.php?module=Assets&action=EditView&invoiceid=' . $focus->id . '&product=' . $productid . '&account=' . $focus->column_fields['account_id'] . '&datesold=' . DateTimeField::convertToUserFormat($focus->column_fields['invoicedate']) . '&return_module=' . $module . '&return_id=' . $focus->id . '" onmouseout="vtlib_listview.trigger(\'invoiceasset.onmouseout\', $(this))" onmouseover="vtlib_listview.trigger(\'cell.onmouseover\', $(this))">' . '<img border="0" src="' . vtiger_imageurl('barcode.png', $theme) . '" title="' . getTranslatedString('LBL_ADD_NEW', $module) . " " . getTranslatedString('Assets', 'Assets') . '" style="cursor: pointer;" align="absmiddle" />' . '<span style="display:none;" vtmodule="Assets" vtfieldname="invoice_product" vtrecordid="' . $focus->id . '::' . $productid . '::' . $i . '" type="vtlib_metainfo"></span>' . '</a>';
                    }
                    break;
                default:
                    $sc_image_tag = '';
开发者ID:jaimeaga84,项目名称:corebos,代码行数:67,代码来源:DetailViewUtils.php

示例4: array_values

$smarty->assign('ID', $focus->id);
$smarty->assign('MODE', $focus->mode);
$recordName = array_values(getEntityName($currentModule, $focus->id));
$recordName = $recordName[0];
$smarty->assign('NAME', $recordName);
$smarty->assign('UPDATEINFO', updateInfo($focus->id));
// Module Sequence Numbering
$mod_seq_field = getModuleSequenceField($currentModule);
if ($mod_seq_field != null) {
    $mod_seq_id = $focus->column_fields[$mod_seq_field['name']];
} else {
    $mod_seq_id = $focus->id;
}
$smarty->assign('MOD_SEQ_ID', $mod_seq_id);
//Added to display the Tax informations
$tax_details = getTaxDetailsForProduct($focus->id);
for ($i = 0; $i < count($tax_details); $i++) {
    $tax_details[$i]['percentage'] = getProductTaxPercentage($tax_details[$i]['taxname'], $focus->id);
}
$smarty->assign("TAX_DETAILS", $tax_details);
$price_details = getPriceDetailsForProduct($focus->id, $focus->unit_price, 'available_associated', $currentModule);
$smarty->assign('PRICE_DETAILS', $price_details);
$validationArray = split_validationdataArray(getDBValidationData($focus->tab_name, $tabid));
$smarty->assign('VALIDATION_DATA_FIELDNAME', $validationArray['fieldname']);
$smarty->assign('VALIDATION_DATA_FIELDDATATYPE', $validationArray['datatype']);
$smarty->assign('VALIDATION_DATA_FIELDLABEL', $validationArray['fieldlabel']);
$smarty->assign('EDIT_PERMISSION', isPermitted($currentModule, 'EditView', $record));
$smarty->assign('CHECK', $tool_buttons);
if (PerformancePrefs::getBoolean('DETAILVIEW_RECORD_NAVIGATION', true) && isset($_SESSION[$currentModule . '_listquery'])) {
    $recordNavigationInfo = ListViewSession::getListViewNavigation($focus->id);
    VT_detailViewNavigation($smarty, $recordNavigationInfo, $focus->id);
开发者ID:casati-dolibarr,项目名称:corebos,代码行数:31,代码来源:DetailView.php

示例5: vtlib_purify

<?php

/*+********************************************************************************
 * The contents of this file are subject to the vtiger CRM Public License Version 1.0
 * ("License"); You may not use this file except in compliance with the License
 * The Original Code is:  vtiger CRM Open Source
 * The Initial Developer of the Original Code is vtiger.
 * Portions created by vtiger are Copyright (C) vtiger.
 * All Rights Reserved.
 *********************************************************************************/
global $theme, $mod_strings;
$theme_path = "themes/" . $theme . "/";
$productid = vtlib_purify($_REQUEST['productid']);
$rowid = vtlib_purify($_REQUEST['curr_row']);
$product_total = vtlib_purify($_REQUEST['productTotal']);
$tax_details = getTaxDetailsForProduct($productid, 'all');
//we should pass available instead of all if we want to display only the available taxes.
$associated_tax_count = count($tax_details);
$tax_div = '
		<table width="100%" border="0" cellpadding="5" cellspacing="0" class="small" id="tax_table' . $rowid . '">
		   <tr>
			<td id="tax_div_title' . $rowid . '" nowrap align="left" ><b>' . $app_strings['LABEL_SET_TAX_FOR'] . ' : ' . $product_total . '</b></td>
			<td>&nbsp;</td>
			<td align="right"><img src="' . vtiger_imageurl('close.gif', $theme) . '" border="0" onClick="fnHidePopDiv(\'tax_div' . $rowid . '\')" style="cursor:pointer;"></td>
		   </tr>
	   ';
$net_tax_total = 0.0;
for ($i = 0, $j = $i + 1; $i < count($tax_details); $i++, $j++) {
    $tax_name = $tax_details[$i]['taxname'];
    $tax_label = $tax_details[$i]['taxlabel'];
    $tax_percentage = $tax_details[$i]['percentage'];
开发者ID:sacredwebsite,项目名称:vtigercrm,代码行数:31,代码来源:InventoryTaxAjax.php

示例6: beforeGetTaskform

 public function beforeGetTaskform($viewer)
 {
     global $adb;
     $new_module = $this->getWorkflow()->getSettings();
     $new_module = $new_module["module_name"];
     if (!empty($new_module) && $new_module != -1) {
         $viewer->assign("new_module", $new_module);
     }
     $sql = "SELECT\r\n                    vtiger_crmentity.crmid, vtiger_crmentity.smownerid, vtiger_crmentity.description,\r\n                    vtiger_products.*,\r\n                    vtiger_productcf.*\r\n                FROM vtiger_products\r\n                    INNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid = vtiger_products.productid\r\n                    INNER JOIN vtiger_productcf ON vtiger_products.productid = vtiger_productcf.productid\r\n                    LEFT JOIN vtiger_vendor ON vtiger_vendor.vendorid = vtiger_products.vendor_id\r\n                    LEFT JOIN vtiger_groups ON vtiger_groups.groupid = vtiger_crmentity.smownerid\r\n                    LEFT JOIN vtiger_users ON vtiger_users.id = vtiger_crmentity.smownerid\r\n                WHERE\r\n                    vtiger_products.productid > 0 AND\r\n                    vtiger_crmentity.deleted = 0 and\r\n                    vtiger_products.discontinued <> 0 AND\r\n                    (vtiger_products.productid NOT IN (\r\n                        SELECT crmid FROM vtiger_seproductsrel WHERE vtiger_products.productid > 0 AND setype='Products'\r\n                        )\r\n                    )";
     $result = $adb->query($sql);
     $products = array();
     $taxes = array();
     while ($row = $adb->fetchByAssoc($result)) {
         $products[$row["productid"]] = $row;
         $taxes[$row["productid"]] = getTaxDetailsForProduct($row["productid"], 'all');
         if (empty($taxes[$row["productid"]])) {
             $taxes[$row["productid"]] = array("a" => "b");
         }
     }
     $viewer->assign("taxlist", $taxes);
     $viewer->assign("productlist", $products);
     $workflows = Workflow2::getWorkflowsForModule($new_module, 1);
     $viewer->assign("extern_workflows", $workflows);
     $module = array();
     $module["Invoice"] = getTranslatedString("Invoice", "Invoice");
     $module["Quotes"] = getTranslatedString("Quotes", "Quotes");
     $module["PurchaseOrder"] = getTranslatedString("PurchaseOrder", "PurchaseOrder");
     $module["SalesOrder"] = getTranslatedString("SalesOrder", "SalesOrder");
     asort($module);
     $viewer->assign("avail_module", $module);
     $viewer->assign("orig_module_name", $this->getModuleName());
     $viewer->assign("availCurrency", getAllCurrencies());
     $viewer->assign("availTaxes", getAllTaxes("available"));
 }
开发者ID:cin-system,项目名称:vtigercrm-cin,代码行数:34,代码来源:WfTaskReverseInventory.php

示例7: getTaxDetailsForProduct

    // getUnitPrice($pdoline['productid'],$setype);
    $discount = 0;
    if (!empty($pdoline['discount'])) {
        $_REQUEST["discount{$i}"] = "on";
        $_REQUEST["discount_type{$i}"] = $pdoline['discount_type'];
        if ($pdoline['discount_type'] == 'amount') {
            $_REQUEST["discount_amount{$i}"] = $pdoline['discount_amount'];
            $discount = $pdoline['discount_amount'];
        } else {
            $_REQUEST["discount_percentage{$i}"] = $pdoline['discount_percentage'];
            $discount = $qty * $_REQUEST['listPrice' . $i] * $pdoline['discount_percentage'] / 100;
        }
    }
    $subtotal = $subtotal + $qty * $_REQUEST['listPrice' . $i] - $discount;
    if ($taxtype == "individual") {
        $taxes_for_product = getTaxDetailsForProduct($pdoline['productid'], 'all', $acvid);
        for ($tax_count = 0; $tax_count < count($taxes_for_product); $tax_count++) {
            $tax_name = $taxes_for_product[$tax_count]['taxname'];
            $tax_val = $taxes_for_product[$tax_count]['percentage'];
            $request_tax_name = $tax_name . "_percentage" . $i;
            $_REQUEST[$request_tax_name] = $tax_val;
            $totalwithtax += $qty * $_REQUEST['listPrice' . $i] * ($tax_val / 100);
        }
    }
}
$_REQUEST['totalProductCount'] = $i;
$_REQUEST['subtotal'] = round($subtotal + $totalwithtax, 2);
if ($taxtype == "individual") {
    $totaldoc = $subtotal + $totalwithtax;
    if ($element['discount_type_final'] == 'amount') {
        $totaldoc = $totaldoc - $element['hdnDiscountAmount'];
开发者ID:casati-dolibarr,项目名称:corebos,代码行数:31,代码来源:ProductLines.php

示例8: getTaxDetailsForProduct

        if (!empty($_REQUEST['vndid'])) {
            $acvid = $_REQUEST['vndid'];
        }
    } else {
        if (GlobalVariable::getVariable('B2B', '1') == '1') {
            if (!empty($_REQUEST['accid'])) {
                $acvid = $_REQUEST['accid'];
            }
        } else {
            if (!empty($_REQUEST['ctoid'])) {
                $acvid = $_REQUEST['ctoid'];
            }
        }
    }
}
$tax_details = getTaxDetailsForProduct($productid, 'all', $acvid);
//we should pass available instead of all if we want to display only the available taxes.
$associated_tax_count = count($tax_details);
$tax_div = '<table width="100%" border="0" cellpadding="5" cellspacing="0" class="small" id="tax_table' . $rowid . '">
	<tr>
		<td id="tax_div_title' . $rowid . '" nowrap align="left" ><b>' . $app_strings['LABEL_SET_TAX_FOR'] . ' : ' . $product_total . '</b></td>
		<td>&nbsp;</td>
		<td align="right"><img src="' . vtiger_imageurl('close.gif', $theme) . '" border="0" onClick="fnHidePopDiv(\'tax_div' . $rowid . '\')" style="cursor:pointer;"></td>
	</tr>';
$net_tax_total = 0.0;
for ($i = 0, $j = $i + 1; $i < count($tax_details); $i++, $j++) {
    $tax_name = $tax_details[$i]['taxname'];
    $tax_label = $tax_details[$i]['taxlabel'];
    $tax_percentage = $tax_details[$i]['percentage'];
    $tax_name_percentage = $tax_name . "_percentage" . $rowid;
    $tax_id_name = "hidden_tax" . $j . "_percentage" . $rowid;
开发者ID:casati-dolibarr,项目名称:corebos,代码行数:31,代码来源:InventoryTaxAjax.php

示例9: getAssociatedProducts


//.........这里部分代码省略.........
         $product_Detail[$i]['subprod_names' . $i] = $subprodname_str;
         $product_Detail[$i]['tax' . $i] = $tax;
         $discount_percent = decimalFormat($adb->query_result($result, $i - 1, 'discount_percent'));
         $discount_amount = $adb->query_result($result, $i - 1, 'discount_amount');
         $discount_amount = decimalFormat(number_format($discount_amount, $no_of_decimal_places, '.', ''));
         $discountTotal = '0.00';
         //Based on the discount percent or amount we will show the discount details
         //To avoid NaN javascript error, here we assign 0 initially to' %of price' and 'Direct Price reduction'(for Each Product)
         $product_Detail[$i]['discount_percent' . $i] = 0;
         $product_Detail[$i]['discount_amount' . $i] = 0;
         if ($discount_percent != 'NULL' && $discount_percent != '') {
             $product_Detail[$i]['discount_type' . $i] = "percentage";
             $product_Detail[$i]['discount_percent' . $i] = $discount_percent;
             $product_Detail[$i]['checked_discount_percent' . $i] = ' checked';
             $product_Detail[$i]['style_discount_percent' . $i] = ' style="visibility:visible"';
             $product_Detail[$i]['style_discount_amount' . $i] = ' style="visibility:hidden"';
             $discountTotal = $productTotal * $discount_percent / 100;
         } elseif ($discount_amount != 'NULL' && $discount_amount != '') {
             $product_Detail[$i]['discount_type' . $i] = "amount";
             $product_Detail[$i]['discount_amount' . $i] = $discount_amount;
             $product_Detail[$i]['checked_discount_amount' . $i] = ' checked';
             $product_Detail[$i]['style_discount_amount' . $i] = ' style="visibility:visible"';
             $product_Detail[$i]['style_discount_percent' . $i] = ' style="visibility:hidden"';
             $discountTotal = $discount_amount;
         } else {
             $product_Detail[$i]['checked_discount_zero' . $i] = ' checked';
         }
         $totalAfterDiscount = $productTotal - $discountTotal;
         $totalAfterDiscount = number_format($totalAfterDiscount, $no_of_decimal_places, '.', '');
         $discountTotal = number_format($discountTotal, $no_of_decimal_places, '.', '');
         $product_Detail[$i]['discountTotal' . $i] = $discountTotal;
         $product_Detail[$i]['totalAfterDiscount' . $i] = $totalAfterDiscount;
         $amount = '0.00';
         $tax_details = getTaxDetailsForProduct($hdnProductId, 'all');
         //First we should get all available taxes and then retrieve the corresponding tax values
         $allTaxes = getAllTaxes('available', '', 'edit', $focus->id);
         $taxtype = $this->getInventoryTaxType($module, $focus->id);
         for ($tax_count = 0; $tax_count < count($tax_details); $tax_count++) {
             $tax_name = $tax_details[$tax_count]['taxname'];
             $tax_label = $tax_details[$tax_count]['taxlabel'];
             $tax_value = '0.00';
             //condition to avoid this function call when create new PO/SO/Quotes/Invoice from Product module
             if ($focus->id != '') {
                 if ($taxtype == 'individual') {
                     //if individual then show the entered tax percentage
                     $tax_value = getInventoryProductTaxValue($focus->id, $hdnProductId, $tax_name);
                 } else {
                     //if group tax then we have to show the default value when change to individual tax
                     $tax_value = $tax_details[$tax_count]['percentage'];
                 }
             } else {
                 //if the above function not called then assign the default associated value of the product
                 $tax_value = $tax_details[$tax_count]['percentage'];
             }
             $product_Detail[$i]['taxes'][$tax_count]['taxname'] = $tax_name;
             $product_Detail[$i]['taxes'][$tax_count]['taxlabel'] = $tax_label;
             $product_Detail[$i]['taxes'][$tax_count]['percentage'] = $tax_value;
             $amount = $totalAfterDiscount * $tax_value / 100;
             $amount = number_format($amount, $no_of_decimal_places, '.', '');
             $product_Detail[$i]['taxes'][$tax_count]['amount'] = $amount;
             if ($tax == $tax_name) {
                 $finalTaxTotal += $amount;
                 $product_Detail[$i]['taxTotal' . $i] = $amount;
             }
         }
         if ($taxtype == 'group') {
开发者ID:rcrrich,项目名称:UpdatePackages,代码行数:67,代码来源:Record.php

示例10: getAssociatedProducts


//.........这里部分代码省略.........
            $product_Detail[$i]['discount_type' . $i] = "percentage";
            $product_Detail[$i]['discount_percent' . $i] = $discount_percent;
            $product_Detail[$i]['checked_discount_percent' . $i] = ' checked';
            $product_Detail[$i]['style_discount_percent' . $i] = ' style="visibility:visible"';
            $product_Detail[$i]['style_discount_amount' . $i] = ' style="visibility:hidden"';
            $discountTotal = $productTotal * $discount_percent / 100;
        } elseif ($discount_amount != 'NULL' && $discount_amount != '') {
            $product_Detail[$i]['discount_type' . $i] = "amount";
            $product_Detail[$i]['discount_amount' . $i] = $discount_amount;
            $product_Detail[$i]['checked_discount_amount' . $i] = ' checked';
            $product_Detail[$i]['style_discount_amount' . $i] = ' style="visibility:visible"';
            $product_Detail[$i]['style_discount_percent' . $i] = ' style="visibility:hidden"';
            $discountTotal = $discount_amount;
        } else {
            $product_Detail[$i]['checked_discount_zero' . $i] = ' checked';
        }
        $totalAfterDiscount = $productTotal - $discountTotal;
        $product_Detail[$i]['discountTotal' . $i] = $discountTotal;
        $product_Detail[$i]['totalAfterDiscount' . $i] = $totalAfterDiscount;
        $taxTotal = '0.00';
        $product_Detail[$i]['taxTotal' . $i] = $taxTotal;
        //Calculate netprice
        $netPrice = $totalAfterDiscount + $taxTotal;
        //if condition is added to call this function when we create PO/SO/Quotes/Invoice from Product module
        if ($module == 'PurchaseOrder' || $module == 'SalesOrder' || $module == 'Quotes' || $module == 'Invoice') {
            $taxtype = getInventoryTaxType($module, $focus->id);
            if ($taxtype == 'individual') {
                //Add the tax with product total and assign to netprice
                $netPrice = $netPrice + $taxTotal;
            }
        }
        $product_Detail[$i]['netPrice' . $i] = $netPrice;
        //First we will get all associated taxes as array
        $tax_details = getTaxDetailsForProduct($hdnProductId, 'all', $acvid);
        //Now retrieve the tax values from the current query with the name
        for ($tax_count = 0; $tax_count < count($tax_details); $tax_count++) {
            $tax_name = $tax_details[$tax_count]['taxname'];
            $tax_label = $tax_details[$tax_count]['taxlabel'];
            $tax_value = '0.00';
            //condition to avoid this function call when create new PO/SO/Quotes/Invoice from Product module
            if ($focus->id != '') {
                if ($taxtype == 'individual') {
                    //if individual then show the entered tax percentage
                    $tax_value = getInventoryProductTaxValue($focus->id, $hdnProductId, $tax_name);
                } else {
                    //if group tax then we have to show the default value when change to individual tax
                    $tax_value = $tax_details[$tax_count]['percentage'];
                }
            } else {
                //if the above function not called then assign the default associated value of the product
                $tax_value = $tax_details[$tax_count]['percentage'];
            }
            $product_Detail[$i]['taxes'][$tax_count]['taxname'] = $tax_name;
            $product_Detail[$i]['taxes'][$tax_count]['taxlabel'] = $tax_label;
            $product_Detail[$i]['taxes'][$tax_count]['percentage'] = $tax_value;
        }
    }
    //set the taxtype
    $product_Detail[1]['final_details']['taxtype'] = $taxtype;
    //Get the Final Discount, S&H charge, Tax for S&H and Adjustment values
    //To set the Final Discount details
    $finalDiscount = '0.00';
    $product_Detail[1]['final_details']['discount_type_final'] = 'zero';
    $subTotal = $focus->column_fields['hdnSubTotal'] != '' ? $focus->column_fields['hdnSubTotal'] : '0.00';
    $subTotal = number_format($subTotal, 2, '.', '');
    //Convert to 2 decimals
开发者ID:kduqi,项目名称:corebos,代码行数:67,代码来源:EditViewUtils.php

示例11: getTaxClassDetails

 /**
  * Function to get Tax Class Details for this record(Product)
  * @return <Array> List of Taxes
  */
 public function getTaxClassDetails()
 {
     $taxClassDetails = $this->get('taxClassDetails');
     if (!empty($taxClassDetails)) {
         return $taxClassDetails;
     }
     $record = $this->getId();
     if (empty($record)) {
         return $this->getAllTaxes();
     }
     $taxClassDetails = getTaxDetailsForProduct($record, 'available_associated');
     $noOfTaxes = count($taxClassDetails);
     for ($i = 0; $i < $noOfTaxes; $i++) {
         $taxValue = getProductTaxPercentage($taxClassDetails[$i]['taxname'], $this->getId());
         $taxClassDetails[$i]['percentage'] = $taxValue;
         $taxClassDetails[$i]['check_name'] = $taxClassDetails[$i]['taxname'] . '_check';
         $taxClassDetails[$i]['check_value'] = 1;
         //if the tax is not associated with the product then we should get the default value and unchecked
         if ($taxValue == '') {
             $taxClassDetails[$i]['check_value'] = 0;
             $taxClassDetails[$i]['percentage'] = getTaxPercentage($taxClassDetails[$i]['taxname']);
         }
     }
     $this->set('taxClassDetails', $taxClassDetails);
     return $taxClassDetails;
 }
开发者ID:rcrrich,项目名称:YetiForceCRM,代码行数:30,代码来源:Record.php

示例12: x15

 private function x15()
 {
     global $x0b, $x0c, $x0d, $x0e, $x0f, $x10, $x11, $x12, $x13, $x14, $x15, $x16, $x17, $x18, $x19, $x1a, $x1b, $x1c, $x1d, $x1e, $x1f, $x20, $x21, $x22, $x23, $x24, $x25, $x26;
     $taxtype = $this->x1d();
     $currencytype = $this->x1c();
     $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.productid else vtiger_service.serviceid end as psid," . " case when vtiger_products.productid != '' then vtiger_products.product_no else vtiger_service.service_no end as psno," . " case when vtiger_products.productid != '' then 'Products' else 'Services' end as entitytype," . " case when vtiger_products.productid != '' then vtiger_products.unit_price else vtiger_service.unit_price end as unit_price," . " case when vtiger_products.productid != '' then vtiger_products.usageunit else vtiger_service.service_usageunit end as usageunit," . " case when vtiger_products.productid != '' then vtiger_products.qty_per_unit else vtiger_service.qty_per_unit end as qty_per_unit," . " case when vtiger_products.productid != '' then vtiger_products.qtyinstock else 'NA' end as qtyinstock," . " case when vtiger_products.productid != '' then c1.description else c2.description end as psdescription, vtiger_inventoryproductrel.* " . " from vtiger_inventoryproductrel" . " left join vtiger_products on vtiger_products.productid=vtiger_inventoryproductrel.productid " . " left join vtiger_crmentity as c1 on c1.crmid = vtiger_products.productid " . " left join vtiger_service on vtiger_service.serviceid=vtiger_inventoryproductrel.productid " . " left join vtiger_crmentity as c2 on c2.crmid = vtiger_service.serviceid " . " where id=? ORDER BY sequence_no";
     $result = $this->db->pquery($query, array($this->focus->id));
     $num_rows = $this->db->num_rows($result);
     $netTotal = "0.00";
     $totalAfterDiscount_subtotal = 0;
     $total_subtotal = 0;
     $totalsum_subtotal = 0;
     $images = $this->x17();
     $Total_Tax_Values = array();
     for ($i = 1; $i <= $num_rows; $i++) {
         $sub_prod_query = $this->db->pquery("SELECT productid from vtiger_inventorysubproductrel WHERE id=? AND sequence_no=?", array($this->focus->id, $i));
         $subprodname_str = '';
         if ($this->db->num_rows($sub_prod_query) > 0) {
             for ($j = 0; $j < $this->db->num_rows($sub_prod_query); $j++) {
                 $sprod_id = $this->db->query_result($sub_prod_query, $j, "productid");
                 $sprod_name = getProductName($sprod_id);
                 $str_sep = "";
                 if ($j > 0) {
                     $str_sep = ":";
                 }
                 $subprodname_str .= $str_sep . " - " . $sprod_name;
             }
         }
         $subprodname_str = $x1e(":", "<br>", $subprodname_str);
         $psid = $this->db->query_result($result, $i - 1, "psid");
         $psno = $this->db->query_result($result, $i - 1, "psno");
         $productid = $this->db->query_result($result, $i - 1, "productid");
         $entitytype = $this->db->query_result($result, $i - 1, "entitytype");
         $producttitle = $productname = $this->db->query_result($result, $i - 1, "productname");
         if ($subprodname_str != "") {
             $productname .= "<br/><span style='color:#C0C0C0;font-style:italic;'>" . $subprodname_str . "</span>";
         }
         $comment = $this->db->query_result($result, $i - 1, "comment");
         $psdescription = $this->db->query_result($result, $i - 1, "psdescription");
         $inventory_prodrel_desc = $this->db->query_result($result, $i - 1, "description");
         $qtyinstock = $this->db->query_result($result, $i - 1, "qtyinstock");
         $qty = $this->db->query_result($result, $i - 1, "quantity");
         $qty_per_unit = $this->db->query_result($result, $i - 1, "qty_per_unit");
         $usageunit = $this->db->query_result($result, $i - 1, "usageunit");
         $unitprice = $this->db->query_result($result, $i - 1, "unit_price");
         $listprice = $this->db->query_result($result, $i - 1, "listprice");
         $total = $qty * $listprice;
         $discount_percent = $this->db->query_result($result, $i - 1, "discount_percent");
         $discount_amount = $this->db->query_result($result, $i - 1, "discount_amount");
         $totalAfterDiscount = $total;
         $productDiscount = "0.00";
         $productDiscountPercent = "";
         if ($discount_percent != "NULL" && $discount_percent != "") {
             $productDiscount = $total * $discount_percent / 100;
             $totalAfterDiscount = $total - $productDiscount;
             $productDiscountPercent = $discount_percent;
         } elseif ($discount_amount != "NULL" && $discount_amount != "") {
             $productDiscount = $discount_amount;
             $totalAfterDiscount = $total - $productDiscount;
         }
         $netprice = $totalAfterDiscount;
         if ($taxtype == "individual") {
             $taxtotal = "0.00";
             $tax_info_message = $mod_strings["LBL_TOTAL_AFTER_DISCOUNT"] . " = {$totalAfterDiscount} \\n";
             $tax_details = getTaxDetailsForProduct($productid, "all");
             $Tax_Values = array();
             for ($tax_count = 0; $tax_count < $x0f($tax_details); $tax_count++) {
                 $tax_name = $tax_details[$tax_count]["taxname"];
                 $tax_label = $tax_details[$tax_count]["taxlabel"];
                 $tax_value = getInventoryProductTaxValue($this->focus->id, $productid, $tax_name);
                 $individual_taxamount = $totalAfterDiscount * $tax_value / 100;
                 $taxtotal = $taxtotal + $individual_taxamount;
                 if ($tax_name != "" && $tax_value > 0) {
                     $vatblock[$tax_name . "-" . $tax_value]["label"] = $tax_label;
                     $vatblock[$tax_name . "-" . $tax_value]["netto"] += $totalAfterDiscount;
                     $vatblock[$tax_name . "-" . $tax_value]["vat"] += $x1c($individual_taxamount, $this->decimals);
                     $vatblock[$tax_name . "-" . $tax_value]["value"] = $tax_value;
                     $x0c($Tax_Values, $tax_value);
                     $x0c($Total_Tax_Values, $tax_value);
                 }
                 $netprice = $netprice + $taxtotal;
             }
             if ($x0f($Tax_Values) > 0) {
                 $tax_avg_value = $x0e($Tax_Values);
             } else {
                 $tax_avg_value = "0.00";
             }
             $Details["P"][$i]["PRODUCTVATPERCENT"] = $this->x1e($tax_avg_value);
             $Details["P"][$i]["PRODUCTVATSUM"] = $this->x1e($taxtotal);
         }
         if ($entitytype == "Products") {
             $Details["P"][$i]["PRODUCTS_CRMID"] = $psid;
             $Details["P"][$i]["SERVICES_CRMID"] = "";
         } else {
             $Details["P"][$i]["PRODUCTS_CRMID"] = "";
             $Details["P"][$i]["SERVICES_CRMID"] = $psid;
         }
         $Details["P"][$i]["PS_CRMID"] = $psid;
         $Details["P"][$i]["PS_NO"] = $psno;
         if ($comment != "") {
//.........这里部分代码省略.........
开发者ID:jmangarret,项目名称:vtigercrm,代码行数:101,代码来源:InventoryPDF.php

示例13: getDetailAssociatedProducts


//.........这里部分代码省略.........
        $listprice = $adb->query_result($result, $i - 1, 'listprice');
        $listpriceformated = number_format($listprice, $decimal_precision, $decimals_separator, $thousands_separator);
        $total = $qty * $listprice;
        $totalformated = number_format($total, $decimal_precision, $decimals_separator, $thousands_separator);
        //Product wise Discount calculation - starts
        $discount_percent = $adb->query_result($result, $i - 1, 'discount_percent');
        $discount_amount = $adb->query_result($result, $i - 1, 'discount_amount');
        $totalAfterDiscount = $total;
        $totalAfterDiscountformated = number_format($total, $decimal_precision, $decimals_separator, $thousands_separator);
        $productDiscount = '0.00';
        $productDiscountformated = number_format($productDiscount, $decimal_precision, $decimals_separator, $thousands_separator);
        if ($discount_percent != 'NULL' && $discount_percent != '') {
            $productDiscount = $total * $discount_percent / 100;
            $productDiscountformated = number_format($productDiscount, $decimal_precision, $decimals_separator, $thousands_separator);
            $totalAfterDiscount = $total - $productDiscount;
            $totalAfterDiscountformated = number_format($totalAfterDiscount, $decimal_precision, $decimals_separator, $thousands_separator);
            //if discount is percent then show the percentage
            $discount_info_message = "{$discount_percent} % " . $app_strings['of_string'] . " {$total} = {$productDiscountformated}";
        } elseif ($discount_amount != 'NULL' && $discount_amount != '') {
            $productDiscount = $discount_amount;
            $productDiscountformated = number_format($productDiscount, $decimal_precision, $decimals_separator, $thousands_separator);
            $totalAfterDiscount = $total - $productDiscount;
            $totalAfterDiscountformated = number_format($totalAfterDiscount, $decimal_precision, $decimals_separator, $thousands_separator);
            $discount_info_message = $app_strings['LBL_DIRECT_AMOUNT_DISCOUNT'] . " = {$productDiscountformated}";
        } else {
            $discount_info_message = $app_strings['LBL_NO_DISCOUNT_FOR_THIS_LINE_ITEM'];
        }
        //Product wise Discount calculation - ends
        $netprice = $totalAfterDiscount;
        //Calculate the individual tax if taxtype is individual
        if ($taxtype == 'individual') {
            $taxtotal = '0.00';
            $tax_info_message = $app_strings['LBL_TOTAL_AFTER_DISCOUNT'] . " = {$totalAfterDiscountformated} \\n";
            $tax_details = getTaxDetailsForProduct($productid, 'all');
            for ($tax_count = 0; $tax_count < count($tax_details); $tax_count++) {
                $tax_name = $tax_details[$tax_count]['taxname'];
                $tax_label = $tax_details[$tax_count]['taxlabel'];
                $tax_value = getInventoryProductTaxValue($focus->id, $productid, $tax_name);
                $individual_taxamount = $totalAfterDiscount * $tax_value / 100;
                $individual_taxamountformated = number_format(round($individual_taxamount, 2), $decimal_precision, $decimals_separator, $thousands_separator);
                $taxtotal = $taxtotal + $individual_taxamount;
                $taxtotalformated = number_format(round($taxtotal, 2), $decimal_precision, $decimals_separator, $thousands_separator);
                $tax_info_message .= "{$tax_label} : {$tax_value} % = {$individual_taxamountformated} \\n";
            }
            $tax_info_message .= "\\n " . $app_strings['LBL_TOTAL_TAX_AMOUNT'] . " = {$taxtotalformated}";
            $netprice = $netprice + $taxtotal;
        }
        $sc_image_tag = '';
        if ($entitytype == 'Services') {
            $sc_image_tag = '<a href="index.php?module=ServiceContracts&action=EditView&service_id=' . $productid . '&return_module=' . $module . '&return_id=' . $focus->id . '">' . '<img border="0" src="' . vtiger_imageurl('handshake.gif', $theme) . '" title="' . getTranslatedString('Add Service Contract', $module) . '" style="cursor: pointer;" align="absmiddle" />' . '</a>';
        }
        //For Product Name
        $output .= '
			   <tr valign="top">
				<td class="crmTableRow small lineOnTop">
					<font color="gray">' . $productcode . '</font>
					<br><font color="black">' . $productname . '</font>
					<br><font color="gray">' . $productdescription . '</font>
					<br><font color="gray">' . $comment . '</font>
				</td>';
        //Upto this added to display the Product name and comment
        if ($module != 'PurchaseOrder') {
            $output .= '<td class="crmTableRow small lineOnTop">' . $qtyinstock . '</td>';
        }
        $output .= '<td class="crmTableRow small lineOnTop">' . $qty . '</td>';
        $output .= '
开发者ID:joomlacorner,项目名称:vtigerthai,代码行数:67,代码来源:DetailViewUtils.php

示例14: getImageCount

if ($focus->id != '') {
    $smarty->assign("ROWCOUNT", getImageCount($focus->id));
}
if (isset($cust_fld)) {
    $smarty->assign("CUSTOMFIELD", $cust_fld);
}
$smarty->assign("CALENDAR_DATEFORMAT", parse_calendardate($app_strings['NTC_DATE_FORMAT']));
//Tax handling (get the available taxes only) - starts
if ($focus->mode == 'edit') {
    $retrieve_taxes = true;
    $productid = $focus->id;
    $tax_details = getTaxDetailsForProduct($productid, 'available_associated');
} elseif ($_REQUEST['isDuplicate'] == 'true') {
    $retrieve_taxes = true;
    $productid = $_REQUEST['record'];
    $tax_details = getTaxDetailsForProduct($productid, 'available_associated');
} else {
    $tax_details = getAllTaxes('available');
}
for ($i = 0; $i < count($tax_details); $i++) {
    $tax_details[$i]['check_name'] = $tax_details[$i]['taxname'] . '_check';
    $tax_details[$i]['check_value'] = 0;
}
//For Edit and Duplicate we have to retrieve the product associated taxes and show them
if ($retrieve_taxes) {
    for ($i = 0; $i < count($tax_details); $i++) {
        $tax_value = getProductTaxPercentage($tax_details[$i]['taxname'], $productid);
        $tax_details[$i]['percentage'] = $tax_value;
        $tax_details[$i]['check_value'] = 1;
        //if the tax is not associated with the product then we should get the default value and unchecked
        if ($tax_value == '') {
开发者ID:sacredwebsite,项目名称:vtigercrm,代码行数:31,代码来源:EditView.php

示例15: saveInventoryProductDetails


//.........这里部分代码省略.........
            $sub_prod = explode(":", $sub_prod_str);
            for ($j = 0; $j < count($sub_prod); $j++) {
                $query = "insert into vtiger_inventorysubproductrel(id, sequence_no, productid) values(?,?,?)";
                $qparams = array($focus->id, $prod_seq, $sub_prod[$j]);
                $adb->pquery($query, $qparams);
            }
        }
        $prod_seq++;
        if ($module != 'PurchaseOrder') {
            //update the stock with existing details
            updateStk($prod_id, $qty, $focus->mode, $ext_prod_arr, $module);
        }
        //we should update discount and tax details
        $updatequery = "update vtiger_inventoryproductrel set ";
        $updateparams = array();
        //set the discount percentage or discount amount in update query, then set the tax values
        if ($_REQUEST['discount_type' . $i] == 'percentage') {
            $updatequery .= " discount_percent=?,";
            array_push($updateparams, $_REQUEST['discount_percentage' . $i]);
        } elseif ($_REQUEST['discount_type' . $i] == 'amount') {
            $updatequery .= " discount_amount=?,";
            $discount_amount = $_REQUEST['discount_amount' . $i];
            array_push($updateparams, $discount_amount);
        }
        if ($_REQUEST['taxtype'] == 'group') {
            for ($tax_count = 0; $tax_count < count($all_available_taxes); $tax_count++) {
                $selected_tax = $_REQUEST['group_tax_option'];
                $updatequery .= " tax = ?,";
                array_push($updateparams, $selected_tax);
                $tax_name = $all_available_taxes[$tax_count]['taxname'];
                $request_tax_name = $tax_name . "_group_percentage";
                if (isset($_REQUEST[$request_tax_name])) {
                    $tax_val = vtlib_purify($_REQUEST[$request_tax_name]);
                }
                $updatequery .= " {$tax_name} = ?,";
                array_push($updateparams, $tax_val);
            }
        } else {
            $taxes_for_product = getTaxDetailsForProduct($prod_id, 'all');
            $selected_tax = $_REQUEST['tax_option' . $i];
            $updatequery .= " tax = ?,";
            array_push($updateparams, $selected_tax);
            for ($tax_count = 0; $tax_count < count($taxes_for_product); $tax_count++) {
                $tax_name = $taxes_for_product[$tax_count]['taxname'];
                $request_tax_name = $tax_name . "_percentage" . $i;
                $updatequery .= " {$tax_name} = ?,";
                array_push($updateparams, vtlib_purify($_REQUEST[$request_tax_name]));
            }
        }
        $updatequery = trim($updatequery, ',') . " where id=? and productid=? and lineitem_id = ?";
        array_push($updateparams, $focus->id, $prod_id, $lineitem_id);
        // jens 2006/08/19 - protect against empy update queries
        if (!preg_match('/set\\s+where/i', $updatequery)) {
            $adb->pquery($updatequery, $updateparams);
        }
    }
    //we should update the netprice (subtotal), taxtype, group discount, S&H charge, S&H taxes total
    //netprice, group discount, taxtype, total to entity table
    $updatequery = " update {$focus->table_name} set ";
    $updateparams = array();
    $subtotal = $_REQUEST['subtotal'];
    $updatequery .= " subtotal=?,";
    array_push($updateparams, $subtotal);
    $updatequery .= " total_purchase=?,";
    array_push($updateparams, $total_purchase);
    $updatequery .= " total_margin=?,";
    array_push($updateparams, $total_margin);
    $updatequery .= " total_marginp=?,";
    $total_marginp = 0;
    if ($total_purchase != 0) {
        $total_marginp = $total_margin / $total_purchase * 100;
    }
    array_push($updateparams, $total_marginp);
    $updatequery .= " taxtype=?,";
    array_push($updateparams, $_REQUEST['taxtype']);
    //for discount percentage or discount amount
    if ($_REQUEST['discount_type_final'] == 'percentage') {
        $updatequery .= " discount_percent=?,discount_amount=?,";
        array_push($updateparams, vtlib_purify($_REQUEST['discount_percentage_final']));
        array_push($updateparams, null);
    } elseif ($_REQUEST['discount_type_final'] == 'amount') {
        $discount_amount_final = vtlib_purify($_REQUEST['discount_amount_final']);
        $updatequery .= " discount_amount=?,discount_percent=?,";
        array_push($updateparams, $discount_amount_final);
        array_push($updateparams, null);
    } elseif ($_REQUEST['discount_type_final'] == 'zero') {
        $updatequery .= "discount_amount=?,discount_percent=?,";
        array_push($updateparams, null);
        array_push($updateparams, null);
    }
    $total = vtlib_purify($_REQUEST['total']);
    $updatequery .= " total=?";
    array_push($updateparams, $total);
    //$id_array = Array('PurchaseOrder'=>'purchaseorderid','SalesOrder'=>'salesorderid','Quotes'=>'quoteid','Invoice'=>'invoiceid');
    //Added where condition to which entity we want to update these values
    $updatequery .= " where " . $focus->table_index . "=?";
    array_push($updateparams, $focus->id);
    $adb->pquery($updatequery, $updateparams);
    $log->debug("Exit from function saveInventoryProductDetails({$module}).");
}
开发者ID:rcrrich,项目名称:UpdatePackages,代码行数:101,代码来源:InventoryUtils.php


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