本文整理汇总了PHP中getAssociatedProducts函数的典型用法代码示例。如果您正苦于以下问题:PHP getAssociatedProducts函数的具体用法?PHP getAssociatedProducts怎么用?PHP getAssociatedProducts使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getAssociatedProducts函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getProductDetailsBlockInfo
/**
* This function returns the Product detail block values in array format.
* Input Parameter are $module - module name, $focus - module object, $num_of_products - no.of vtiger_products associated with it * $associated_prod = associated product details
* column vtiger_fields/
*/
function getProductDetailsBlockInfo($mode, $module, $focus = '', $num_of_products = '', $associated_prod = '')
{
global $log;
$log->debug("Entering getProductDetailsBlockInfo(" . $mode . "," . $module . "," . $num_of_products . "," . $associated_prod . ") method ...");
$productDetails = array();
$productBlock = array();
if ($num_of_products == '') {
$num_of_products = getNoOfAssocProducts($module, $focus);
}
$productDetails['no_products'] = $num_of_products;
if ($associated_prod == '') {
$productDetails['product_details'] = getAssociatedProducts($module, $focus);
} else {
$productDetails['product_details'] = $associated_prod;
}
if ($focus != '') {
$productBlock[] = array('mode' => $focus->mode);
$productBlock[] = $productDetails['product_details'];
$productBlock[] = array('taxvalue' => $focus->column_fields['txtTax']);
$productBlock[] = array('taxAdjustment' => $focus->column_fields['txtAdjustment']);
$productBlock[] = array('hdnSubTotal' => $focus->column_fields['hdnSubTotal']);
$productBlock[] = array('hdnGrandTotal' => $focus->column_fields['hdnGrandTotal']);
} else {
$productBlock[] = array(array());
}
$log->debug("Exiting getProductDetailsBlockInfo method ...");
return $productBlock;
}
示例2: getDetailsForInventoryModule
/**
* Function get details of taxes for this record
* Function calls from Edit/Create view of Inventory Records
* @param <Object> $focus
* @return <Array> List of individual taxes
*/
function getDetailsForInventoryModule($focus)
{
$productId = $this->getId();
$currentUser = Users_Record_Model::getCurrentUserModel();
$productDetails = getAssociatedProducts($this->getModuleName(), $focus, $productId);
$currentUserModel = Users_Record_Model::getCurrentUserModel();
$convertedPriceDetails = $this->getModule()->getPricesForProducts($currentUserModel->get('currency_id'), array($productId));
$productDetails[1]['listPrice1'] = number_format($convertedPriceDetails[$productId], $currentUserModel->get('no_of_currency_decimals'), '.', '');
$totalAfterDiscount = $productDetails[1]['totalAfterDiscount1'];
$productTaxes = $productDetails[1]['taxes'];
if (!empty($productDetails)) {
$taxCount = count($productTaxes);
$taxTotal = '0';
for ($i = 0; $i < $taxCount; $i++) {
$taxValue = $productTaxes[$i]['percentage'];
$taxAmount = $totalAfterDiscount * $taxValue / 100;
$taxTotal = $taxTotal + $taxAmount;
$productDetails[1]['taxes'][$i]['amount'] = $taxAmount;
$productDetails[1]['taxTotal1'] = $taxTotal;
}
$netPrice = $totalAfterDiscount + $taxTotal;
$productDetails[1]['netPrice1'] = $netPrice;
$productDetails[1]['final_details']['hdnSubTotal'] = $netPrice;
$productDetails[1]['final_details']['grandTotal'] = $netPrice;
}
for ($i = 1; $i <= count($productDetails); $i++) {
$productId = $productDetails[$i]['hdnProductId' . $i];
$productPrices = $this->getModule()->getPricesForProducts($currentUser->get('currency_id'), array($productId), $this->getModuleName());
$productDetails[$i]['listPrice' . $i] = number_format($productPrices[$productId], $currentUser->get('no_of_currency_decimals'), '.', '');
}
return $productDetails;
}
示例3: 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;
}
示例4: loadRecord
function loadRecord($id)
{
global $current_user;
$this->focus = $focus = CRMEntity::getInstance($this->moduleName);
$focus->retrieve_entity_info($id, $this->moduleName);
$focus->apply_field_security();
$focus->id = $id;
$this->associated_products = getAssociatedProducts($this->moduleName, $focus);
}
示例5: 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;
}
示例6: replaceProductList
function replaceProductList($pdftype, $id, $templateid, $content, $tcpdf)
{
require_once 'include/utils/CommonUtils.php';
require_once 'include/fields/CurrencyField.php';
require_once 'modules/' . $pdftype . '/' . $pdftype . '.php';
$focus = new $pdftype();
$focus->retrieve_entity_info($id, $pdftype);
$focus->id = $focus->column_fields["record_id"];
$associated_products = getAssociatedProducts($pdftype, $focus);
$num_products = count($associated_products);
//This $final_details array will contain the final total, discount, Group Tax, S&H charge, S&H taxes
$final_details = $associated_products[1]['final_details'];
//getting the Net Total
$price_subtotal = number_format($final_details["hdnSubTotal"], 2, '.', ',');
//Final discount amount/percentage
$discount_amount = $final_details["discount_amount_final"];
$discount_percent = $final_details["discount_percentage_final"];
if ($discount_amount != "") {
$price_discount = number_format($discount_amount, 2, '.', ',');
} else {
if ($discount_percent != "") {
//This will be displayed near Discount label - used in include/fpdf/templates/body.php
$final_price_discount_percent = "(" . number_format($discount_percent, 2, '.', ',') . " %)";
$price_discount = number_format($discount_percent * $final_details["hdnSubTotal"] / 100, 2, '.', ',');
} else {
$price_discount = "0.00";
}
}
//Grand Total
$price_total = number_format($final_details["grandTotal"], 2, '.', ',');
//To calculate the group tax amount
if ($final_details['taxtype'] == 'group') {
$group_tax_total = $final_details['tax_totalamount'];
$price_salestax = number_format($group_tax_total, 2, '.', ',');
$group_total_tax_percent = '0.00';
$group_tax_details = $final_details['taxes'];
for ($i = 0; $i < count($group_tax_details); $i++) {
$group_total_tax_percent = $group_total_tax_percent + $group_tax_details[$i]['percentage'];
}
}
$prod_line = array();
$lines = 0;
//This is to get all prodcut details as row basis
for ($i = 1, $j = $i - 1; $i <= $num_products; $i++, $j++) {
$product_name[$i] = $associated_products[$i]['productName' . $i];
$subproduct_name[$i] = split("<br>", $associated_products[$i]['subprod_names' . $i]);
$comment[$i] = $associated_products[$i]['comment' . $i];
$product_id[$i] = $associated_products[$i]['hdnProductId' . $i];
$qty[$i] = $associated_products[$i]['qty' . $i];
$unit_price[$i] = number_format($associated_products[$i]['unitPrice' . $i], 2, '.', ',');
$list_price[$i] = $associated_products[$i]['listPrice' . $i];
// number_format($associated_products[$i]['listPrice'.$i],2,'.',',');
$list_pricet[$i] = $associated_products[$i]['listPrice' . $i];
$discount_total[$i] = $associated_products[$i]['discountTotal' . $i];
//aded for 5.0.3 pdf changes
$product_code[$i] = $associated_products[$i]['hdnProductcode' . $i];
$taxable_total = $qty[$i] * $list_pricet[$i] - $discount_total[$i];
$producttotal = $taxable_total;
$total_taxes = '0.00';
if ($focus->column_fields["hdnTaxType"] == "individual") {
$total_tax_percent = '0.00';
//This loop is to get all tax percentage and then calculate the total of all taxes
for ($tax_count = 0; $tax_count < count($associated_products[$i]['taxes']); $tax_count++) {
$tax_percent = $associated_products[$i]['taxes'][$tax_count]['percentage'];
$total_tax_percent = $total_tax_percent + $tax_percent;
$tax_amount = $taxable_total * $tax_percent / 100;
$total_taxes = $total_taxes + $tax_amount;
}
$producttotal = $taxable_total + $total_taxes;
$product_line[$j]["tax_percentage"] = $total_tax_percent;
$product_line[$j]["Tax"] = $total_taxes;
$price_salestax += $total_taxes;
}
$prod_total[$i] = $producttotal;
// number_format($producttotal,2,'.',',');
$product_line[$j]["Product Code"] = $product_code[$i];
$product_line[$j]["Qty"] = $qty[$i];
$product_line[$j]["Price"] = $list_price[$i];
$product_line[$j]["Discount"] = $discount_total[$i];
$product_line[$j]["Total"] = $prod_total[$i];
$lines++;
$product_line[$j]["Product Name"] = decode_html($product_name[$i]);
$prod_line[$j] = 1;
for ($count = 0; $count < count($subproduct_name[$i]); $count++) {
if ($lines % 12 != 0) {
$product_line[$j]["Product Name"] .= "\n" . decode_html($subproduct_name[$i][$count]);
$prod_line[$j]++;
} else {
$j++;
$product_line[$j]["Product Name"] = decode_html($product_name[$i]);
$product_line[$j]["Product Name"] .= "\n" . decode_html($subproduct_name[$i][$count]);
$prod_line[$j] = 2;
$lines++;
}
$lines++;
}
if ($comment[$i] != '') {
$product_line[$j]["Product Name"] .= "\n" . decode_html($comment[$i]);
$prod_line[$j]++;
$lines++;
//.........这里部分代码省略.........
示例7: getProductDetailsBlockInfo
$smarty->assign("NAME", "");
}
if (isset($_REQUEST['convertmode']) && $_REQUEST['convertmode'] == 'quotetoinvoice') {
$smarty->assign("MODE", $quote_focus->mode);
$se_array = getProductDetailsBlockInfo($quote_focus->mode, "Quotes", $quote_focus);
} elseif (isset($_REQUEST['convertmode']) && ($_REQUEST['convertmode'] == 'sotoinvoice' || $_REQUEST['convertmode'] == 'update_so_val')) {
$smarty->assign("MODE", $focus->mode);
$se_array = getProductDetailsBlockInfo($focus->mode, "SalesOrder", $so_focus);
$txtTax = $so_focus->column_fields['txtTax'] != '' ? $so_focus->column_fields['txtTax'] : '0.000';
$txtAdj = $so_focus->column_fields['txtAdjustment'] != '' ? $so_focus->column_fields['txtAdjustment'] : '0.000';
$associated_prod = getAssociatedProducts("SalesOrder", $so_focus);
$smarty->assign("ASSOCIATEDPRODUCTS", $associated_prod);
$smarty->assign("MODE", $focus->mode);
} elseif ($focus->mode == 'edit') {
$smarty->assign("UPDATEINFO", updateInfo($focus->id));
$associated_prod = getAssociatedProducts("Invoice", $focus);
$smarty->assign("ASSOCIATEDPRODUCTS", $associated_prod);
$smarty->assign("MODE", $focus->mode);
} elseif (isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') {
$associated_prod = $INVOICE_associated_prod;
$smarty->assign("AVAILABLE_PRODUCTS", 'true');
$smarty->assign("MODE", $focus->mode);
} elseif (isset($_REQUEST['product_id']) && $_REQUEST['product_id'] != '' || isset($_REQUEST['opportunity_id']) && $_REQUEST['opportunity_id'] != '') {
$smarty->assign("ASSOCIATEDPRODUCTS", $associated_prod);
$InvTotal = getInventoryTotal($_REQUEST['return_module'], $_REQUEST['return_id']);
$smarty->assign("MODE", $focus->mode);
//this is to display the Product Details in first row when we create new PO from Product relatedlist
if ($_REQUEST['return_module'] == 'Products') {
$smarty->assign("PRODUCT_ID", vtlib_purify($_REQUEST['product_id']));
$smarty->assign("PRODUCT_NAME", getProductName($_REQUEST['product_id']));
$smarty->assign("UNIT_PRICE", vtlib_purify($_REQUEST['product_id']));
示例8: getAssociatedProducts
$smarty->assign("CATEGORY", $category);
$log->info("Order view");
if (isset($focus->name)) {
$smarty->assign("NAME", $focus->name);
} else {
$smarty->assign("NAME", "");
}
if (isset($_REQUEST['convertmode']) && ($_REQUEST['convertmode'] == 'quotetoso' || $_REQUEST['convertmode'] == 'update_quote_val')) {
$txtTax = $quote_focus->column_fields['txtTax'] != '' ? $quote_focus->column_fields['txtTax'] : '0.000';
$txtAdj = $quote_focus->column_fields['txtAdjustment'] != '' ? $quote_focus->column_fields['txtAdjustment'] : '0.000';
$associated_prod = getAssociatedProducts("Quotes", $quote_focus);
$smarty->assign("ASSOCIATEDPRODUCTS", $associated_prod);
$smarty->assign("MODE", $focus->mode);
} elseif ($focus->mode == 'edit') {
$smarty->assign("UPDATEINFO", updateInfo($focus->id));
$associated_prod = getAssociatedProducts("SalesOrder", $focus);
$smarty->assign("ASSOCIATEDPRODUCTS", $associated_prod);
$smarty->assign("MODE", $focus->mode);
} elseif (isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') {
$smarty->assign("ASSOCIATEDPRODUCTS", $SO_associated_prod);
$smarty->assign("AVAILABLE_PRODUCTS", 'true');
$smarty->assign("MODE", $focus->mode);
} elseif (isset($_REQUEST['potential_id']) && $_REQUEST['potential_id'] != '' || isset($_REQUEST['product_id']) && $_REQUEST['product_id'] != '') {
$smarty->assign("ASSOCIATEDPRODUCTS", $associated_prod);
$InvTotal = getInventoryTotal($_REQUEST['return_module'], $_REQUEST['return_id']);
$smarty->assign("MODE", $focus->mode);
//this is to display the Product Details in first row when we create new PO from Product relatedlist
if ($_REQUEST['return_module'] == 'Products') {
$smarty->assign("PRODUCT_ID", vtlib_purify($_REQUEST['product_id']));
$smarty->assign("PRODUCT_NAME", getProductName($_REQUEST['product_id']));
$smarty->assign("UNIT_PRICE", vtlib_purify($_REQUEST['product_id']));
示例9: get_inventory_products
function get_inventory_products($id, $module, $customerid, $sessionid)
{
require_once 'include/utils/UserInfoUtil.php';
require_once 'include/utils/utils.php';
global $adb, $site_URL, $log;
$user = new Users();
$userid = getPortalUserid();
$current_user = $user->retrieveCurrentUserInfoFromFile($userid);
$isPermitted = check_permission($customerid, $module, $id);
if ($isPermitted == false) {
return array("#NOT AUTHORIZED#");
}
include_once "modules/{$module}/{$module}.php";
$focus = CRMEntity::getInstance($module);
$focus->id = $id;
$associated_prod = getAssociatedProducts($module, $focus);
$output[0] = $associated_prod;
return $output;
}
示例10: loadRecord
function loadRecord($id)
{
parent::loadRecord($id);
$this->associated_products = getAssociatedProducts($this->moduleName, $this->focus);
}
示例11: isset
$smarty->assign("THEME", $theme);
$smarty->assign('IMAGE_PATH', "themes/{$theme}/images/");
$smarty->assign('ID', $focus->id);
$smarty->assign('MODE', $focus->mode);
$smarty->assign('CREATEMODE', isset($_REQUEST['createmode']) ? vtlib_purify($_REQUEST['createmode']) : '');
$smarty->assign('CHECK', Button_Check($currentModule));
$smarty->assign('DUPLICATE', $isduplicate);
if ($focus->mode == 'edit' || $isduplicate) {
$recordName = array_values(getEntityName($currentModule, $record));
$recordName = $recordName[0];
$smarty->assign('NAME', $recordName);
$smarty->assign('UPDATEINFO', updateInfo($record));
}
if ($focus->mode == 'edit') {
$smarty->assign('UPDATEINFO', updateInfo($focus->id));
$associated_prod = getAssociatedProducts('Issuecards', $focus);
$smarty->assign('ASSOCIATEDPRODUCTS', $associated_prod);
$smarty->assign('MODE', $focus->mode);
} elseif (isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') {
$smarty->assign('ASSOCIATEDPRODUCTS', $associated_prod);
$smarty->assign('AVAILABLE_PRODUCTS', 'true');
$smarty->assign('MODE', $focus->mode);
}
$cbMap = cbMap::getMapByName($currentModule . 'InventoryDetails', 'MasterDetailLayout');
if ($cbMap != null) {
$cbMapFields = $cbMap->MasterDetailLayout();
$smarty->assign('moreinfofields', "'" . implode("','", $cbMapFields['detailview']['fieldnames']) . "'");
if (empty($associated_prod)) {
// creating
$product_Detail = $col_fields = array();
foreach ($cbMapFields['detailview']['fields'] as $mdfield) {
示例12: array_values
$smarty->assign('DUPLICATE', $isduplicate);
if ($focus->mode == 'edit' || $isduplicate) {
$recordName = array_values(getEntityName($currentModule, $record));
$recordName = $recordName[0];
$smarty->assign('NAME', $recordName);
$smarty->assign('UPDATEINFO', updateInfo($record));
}
if (isset($_REQUEST['convertmode']) && ($_REQUEST['convertmode'] == 'quotetoso' || $_REQUEST['convertmode'] == 'update_quote_val')) {
$txtTax = $quote_focus->column_fields['txtTax'] != '' ? $quote_focus->column_fields['txtTax'] : '0.000';
$txtAdj = $quote_focus->column_fields['txtAdjustment'] != '' ? $quote_focus->column_fields['txtAdjustment'] : '0.000';
$associated_prod = getAssociatedProducts('Quotes', $quote_focus);
$smarty->assign('ASSOCIATEDPRODUCTS', $associated_prod);
$smarty->assign('MODE', $focus->mode);
} elseif ($focus->mode == 'edit') {
$smarty->assign('UPDATEINFO', updateInfo($focus->id));
$associated_prod = getAssociatedProducts('SalesOrder', $focus);
$smarty->assign('ASSOCIATEDPRODUCTS', $associated_prod);
$smarty->assign('MODE', $focus->mode);
} elseif (isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') {
$smarty->assign('ASSOCIATEDPRODUCTS', $SO_associated_prod);
$smarty->assign('AVAILABLE_PRODUCTS', 'true');
$smarty->assign('MODE', $focus->mode);
}
if (isset($_REQUEST['return_module'])) {
$smarty->assign("RETURN_MODULE", vtlib_purify($_REQUEST['return_module']));
} else {
$smarty->assign("RETURN_MODULE", "SalesOrder");
}
if (isset($_REQUEST['return_action'])) {
$smarty->assign("RETURN_ACTION", vtlib_purify($_REQUEST['return_action']));
} else {
示例13: replaceProductTable
function replaceProductTable($pdftype, $id, $templateid, $content, $tcpdf)
{
$permitted_modules = vglobal('permitted_modules');
if (in_array($pdftype, $permitted_modules)) {
/* ------------------- COLUMN CONFIGURATION -------------------
In this part, you can decide which columns you want to appear
and which are not in the table of positions and invoice summary table
If the variable responsible for this column has the value TRUE
will be displayed and if FALSE it will not be displayed
*/
// The columns for the table from the list of items on the invoice
$kolumnyDlaPozycjiFaktur = array();
// column ordinal
$enable_ordinal_column = TRUE;
// Column name of the product
$enable_productname_column = TRUE;
// column number
$enable_amount_column = TRUE;
// unit price column
$enable_listprice_column = TRUE;
// net price column
$enable_netprice_column = TRUE;
// discount column
$enable_discount_column = TRUE;
// Vat column (%)
$enable_vatpercentage_column = TRUE;
// Vat column (currency)
$enable_vatamount_column = TRUE;
// Gross column
$enable_gross_column = TRUE;
// Taxes in PLN
$enable_taxes_inPLN = TRUE;
// Column for a summary in the gray box
$wyswietlaj = array($enable_ordinal_column, $enable_productname_column, $enable_amount_column, $enable_listprice_column, $enable_netprice_column, $enable_discount_column, $enable_vatpercentage_column, $enable_vatamount_column, $enable_gross_column, $enable_taxes_inPLN);
$kolumnyDlaPodsumowaniaFaktur = array();
// shipping costs
$enable_summary_shipping = TRUE;
// tax on shipping costs
$enable_summary_shippingtax = TRUE;
// correction
$enable_summary_correction = TRUE;
// to pay
$enable_summary_topay = TRUE;
// total rebate
$enable_summary_rebate = TRUE;
// the percentage of tax column
$enable_summary_taxpercentage = TRUE;
// tax amount column
$enable_summary_taxamount = TRUE;
//show the date of the course
$enable_date_of_the_course = TRUE;
//----------------------------------------------------
$newdate = vglobal('newdate');
$current_user = vglobal('current_user');
$adb = PearDatabase::getInstance();
$currentModule = vglobal('currentModule');
require_once 'include/utils/utils.php';
$current_language = Users_Record_Model::getCurrentUserModel()->get('language');
include "languages/" . $current_language . "/OSSPdf.php";
include_once "languages/" . $current_language . "/Vtiger.php";
require_once 'include/utils/CommonUtils.php';
require_once 'include/fields/CurrencyField.php';
require_once 'modules/' . $pdftype . '/' . $pdftype . '.php';
$displays_a_summary_of_invoices = TRUE;
if ($pdftype == 'OSSCorrectedInvoice') {
require_once 'modules/' . $pdftype . '/utils.php';
$displays_a_summary_of_invoices = FALSE;
$pdftype = 'Invoice';
$id_sql = "SELECT invoiceid FROM vtiger_osscorrectedinvoice WHERE osscorrectedinvoiceid = {$id}";
$id_result = $adb->query($id_sql, true);
$id = $adb->query_result($id_result, 0, 'invoiceid');
}
$focus = new $pdftype();
$focus->retrieve_entity_info($id, $pdftype);
$currency_id = $focus->column_fields['currency_id'];
$pobierz = $adb->query("select currency_symbol, currency_code from vtiger_currency_info where id = '{$currency_id}'", true);
$symbol_waluty = $adb->query_result($pobierz, 0, "currency_symbol");
$kod_aktualnej_waluty = $adb->query_result($pobierz, 0, "currency_code");
$focus->id = $focus->column_fields["record_id"];
if ($pdftype == 'OSSInvoiceCost') {
$associated_products = OSSgetAssociatedProducts($pdftype, $focus);
} else {
$associated_products = getAssociatedProducts($pdftype, $focus);
}
$czyDrukowacKolumneZPrzeliczonymPodatkiem = FALSE;
$moduleFilePath = "modules/OSSCurrencyUpdate/OSSCurrencyUpdate.php";
$moduleFilePathTpl = "Smarty/templates/modules/OSSCurrencyUpdate/index.tpl";
$checkInDatabaseSql = "SELECT * FROM vtiger_tab WHERE name = 'OSSCurrencyUpdate'";
$pobierzGluwnaWaluteSql = $adb->query("select currency_code from vtiger_currency_info where id = '1'", true);
$kod_waluty = $adb->query_result($pobierzGluwnaWaluteSql, 0, "currency_code");
$checkInDatabaseResult = $adb->query($checkInDatabaseSql, true);
$numDB = $adb->num_rows($checkInDatabaseResult);
if (file_exists($moduleFilePath) && file_exists($moduleFilePathTpl) && $numDB > 0 && $kod_waluty == 'PLN' && $kod_aktualnej_waluty != 'PLN' && vtlib_isModuleActive('OSSCurrencyUpdate')) {
$czyDrukowacKolumneZPrzeliczonymPodatkiem = TRUE;
}
if ($czyDrukowacKolumneZPrzeliczonymPodatkiem == TRUE) {
require_once $moduleFilePath;
//.........这里部分代码省略.........
示例14: get_quote_pdf
/**
* Function to generate Quote pdf
*/
function get_quote_pdf()
{
require_once 'include/tcpdf/pdf.php';
require_once 'include/tcpdf/pdfconfig.php';
require_once 'include/database/PearDatabase.php';
require_once 'modules/Quotes/Quotes.php';
global $adb, $app_strings, $current_user;
// would you like and end page? 1 for yes 0 for no
$endpage = "1";
$focus = new Quotes();
$focus->retrieve_entity_info($_REQUEST['record'], "Quotes");
$focus->apply_field_security();
$account_name = getAccountName($focus->column_fields[account_id]);
$quote_no = $focus->column_fields[quote_no];
if ($focus->column_fields["hdnTaxType"] == "individual") {
$product_taxes = 'true';
} else {
$product_taxes = 'false';
}
$sql = "select currency_symbol from vtiger_currency_info where id=?";
$result = $adb->pquery($sql, array($focus->column_fields['currency_id']));
$currency_symbol = $adb->query_result($result, 0, 'currency_symbol');
// **************** BEGIN POPULATE DATA ********************
$account_id = $focus->column_fields[account_id];
$quote_id = $_REQUEST['record'];
// Quote Information
$valid_till = $focus->column_fields["validtill"];
$valid_till = getDisplayDate($valid_till);
$bill_street = $focus->column_fields["bill_street"];
$bill_city = $focus->column_fields["bill_city"];
$bill_state = $focus->column_fields["bill_state"];
$bill_code = $focus->column_fields["bill_code"];
$bill_country = $focus->column_fields["bill_country"];
$contact_name = getContactName($focus->column_fields["contact_id"]);
$ship_street = $focus->column_fields["ship_street"];
$ship_city = $focus->column_fields["ship_city"];
$ship_state = $focus->column_fields["ship_state"];
$ship_code = $focus->column_fields["ship_code"];
$ship_country = $focus->column_fields["ship_country"];
$conditions = from_html($focus->column_fields["terms_conditions"]);
$description = from_html($focus->column_fields["description"]);
$status = $focus->column_fields["quotestage"];
// Company information
$add_query = "select * from vtiger_organizationdetails";
$result = $adb->pquery($add_query, array());
$num_rows = $adb->num_rows($result);
if ($num_rows > 0) {
$org_name = $adb->query_result($result, 0, "organizationname");
$org_address = $adb->query_result($result, 0, "address");
$org_city = $adb->query_result($result, 0, "city");
$org_state = $adb->query_result($result, 0, "state");
$org_country = $adb->query_result($result, 0, "country");
$org_code = $adb->query_result($result, 0, "code");
$org_phone = $adb->query_result($result, 0, "phone");
$org_fax = $adb->query_result($result, 0, "fax");
$org_website = $adb->query_result($result, 0, "website");
$logo_name = $adb->query_result($result, 0, "logoname");
}
//Population of Product Details - Starts
//we can cut and paste the following lines in a file and include that file here is enough. For that we have to put a new common file. we will do this later
//NOTE : Removed currency symbols and added with Grand Total text. it is enough to show the currency symbol in one place
//we can also get the NetTotal, Final Discount Amount/Percent, Adjustment and GrandTotal from the array $associated_products[1]['final_details']
//get the Associated Products for this Invoice
$focus->id = $focus->column_fields["record_id"];
$associated_products = getAssociatedProducts("Quotes", $focus);
$num_products = count($associated_products);
//This $final_details array will contain the final total, discount, Group Tax, S&H charge, S&H taxes and adjustment
$final_details = $associated_products[1]['final_details'];
//getting the Net Total
$price_subtotal = number_format($final_details["hdnSubTotal"], 2, '.', ',');
//Final discount amount/percentage
$discount_amount = $final_details["discount_amount_final"];
$discount_percent = $final_details["discount_percentage_final"];
if ($discount_amount != "") {
$price_discount = number_format($discount_amount, 2, '.', ',');
} else {
if ($discount_percent != "") {
//This will be displayed near Discount label - used in include/fpdf/templates/body.php
$final_price_discount_percent = "(" . number_format($discount_percent, 2, '.', ',') . " %)";
$price_discount = number_format($discount_percent * $final_details["hdnSubTotal"] / 100, 2, '.', ',');
} else {
$price_discount = "0.00";
}
}
//Adjustment
$price_adjustment = number_format($final_details["adjustment"], 2, '.', ',');
//Grand Total
$price_total = number_format($final_details["grandTotal"], 2, '.', ',');
//To calculate the group tax amount
if ($final_details['taxtype'] == 'group') {
$group_tax_total = $final_details['tax_totalamount'];
$price_salestax = number_format($group_tax_total, 2, '.', ',');
$group_total_tax_percent = '0.00';
$group_tax_details = $final_details['taxes'];
for ($i = 0; $i < count($group_tax_details); $i++) {
$group_total_tax_percent = $group_total_tax_percent + $group_tax_details[$i]['percentage'];
}
//.........这里部分代码省略.........
示例15: updateInfo
$smarty->assign('UPDATEINFO', updateInfo($record));
}
if (isset($_REQUEST['convertmode']) && $_REQUEST['convertmode'] == 'quotetoinvoice') {
$smarty->assign("MODE", $quote_focus->mode);
$se_array = getProductDetailsBlockInfo($quote_focus->mode, "Quotes", $quote_focus);
} elseif (isset($_REQUEST['convertmode']) && ($_REQUEST['convertmode'] == 'sotoinvoice' || $_REQUEST['convertmode'] == 'update_so_val')) {
$smarty->assign('MODE', $focus->mode);
$se_array = getProductDetailsBlockInfo($focus->mode, "SalesOrder", $so_focus);
$txtTax = $so_focus->column_fields['txtTax'] != '' ? $so_focus->column_fields['txtTax'] : '0.000';
$txtAdj = $so_focus->column_fields['txtAdjustment'] != '' ? $so_focus->column_fields['txtAdjustment'] : '0.000';
$associated_prod = getAssociatedProducts('SalesOrder', $so_focus);
$smarty->assign('ASSOCIATEDPRODUCTS', $associated_prod);
$smarty->assign('MODE', $focus->mode);
} elseif ($focus->mode == 'edit') {
$smarty->assign('UPDATEINFO', updateInfo($focus->id));
$associated_prod = getAssociatedProducts('Invoice', $focus);
$smarty->assign('ASSOCIATEDPRODUCTS', $associated_prod);
$smarty->assign('MODE', $focus->mode);
} elseif (isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') {
$associated_prod = $INVOICE_associated_prod;
$smarty->assign('AVAILABLE_PRODUCTS', 'true');
$smarty->assign('MODE', $focus->mode);
}
$smarty->assign('ASSOCIATEDPRODUCTS', $associated_prod);
if (isset($_REQUEST['return_module'])) {
$smarty->assign("RETURN_MODULE", vtlib_purify($_REQUEST['return_module']));
} else {
$smarty->assign("RETURN_MODULE", "Invoice");
}
if (isset($_REQUEST['return_action'])) {
$smarty->assign("RETURN_ACTION", vtlib_purify($_REQUEST['return_action']));