$smarty->assign("CANCELACTION", "index"); } if (isset($_REQUEST['return_viewname'])) { $smarty->assign("RETURN_VIEWNAME", $_REQUEST['return_viewname']); } $smarty->assign("THEME", $theme); $smarty->assign("IMAGE_PATH", $image_path); $smarty->assign("ID", $focus->id); $smarty->assign("OLD_ID", $old_id); $datestr = $focus->column_fields["memday940"]; $datearr = explode(" ", $datestr); $smarty->assign("curryear", $datearr[0]); $smarty->assign("currmonth", $datearr[1]); $smarty->assign("currdays", $datearr[2]); $tabid = getTabid("Memdays"); $data = getSplitDBValidationData($focus->tab_name, $tabid); $smarty->assign("VALIDATION_DATA_FIELDNAME", $data['fieldname']); $smarty->assign("VALIDATION_DATA_FIELDDATATYPE", $data['datatype']); $smarty->assign("VALIDATION_DATA_FIELDLABEL", $data['fieldlabel']); $smarty->assign("CALENDAR_LANG", $app_strings['LBL_JSCALENDAR_LANG']); if (isset($module_enable_product) && $module_enable_product) { $fieldnamelist = getProductFieldList("Memdays"); $smarty->assign("PRODUCTNAMELIST", $fieldnamelist); $fieldlabellist = getProductFieldLabelList("Memdays"); $smarty->assign("PRODUCTLABELLIST", $fieldlabellist); } if ($focus->mode == 'edit') { $smarty->display("Memdays/EditView.tpl"); } else { $smarty->display("Memdays/CreateView.tpl"); }
function getDetailAssociatedProducts() { global $log; $log->debug("Entering getDetailAssociatedProducts() method ..."); global $theme; global $log; global $app_strings, $current_user; $theme_path = "themes/" . $theme . "/"; $image_path = $theme_path . "images/"; $fieldlabellist = getProductFieldLabelList("Relsettings"); $fieldnamelist = getProductFieldList("Relsettings"); $output = ""; $output .= '<table width="100%" border="0" align="center" cellpadding="5" cellspacing="0" class="crmTable" id="proTab"> <tr valign="top"> <td colspan="50" class="dvInnerHeader"><b>' . $app_strings['LBL_PRODUCT_DETAILS'] . '</b></td> </tr> <tr valign="top">'; foreach ($fieldlabellist as $field) { $output .= '<td width="' . $field["LABEL_WIDTH"] . '" class="lvtCol"><b>' . $field["LABEL"] . '</b></td>'; } $output .= ' <td width=10% class="lvtCol"><b>' . $app_strings['LBL_QTY'] . '</b></td> <td width=10% class="lvtCol" align="left"><b>' . $app_strings['LBL_LIST_PRICE'] . '</b></td> <td width=15% wrap class="lvtCol" align="left"><b>' . $app_strings['LBL_COMMENT'] . '</b></td>'; $output .= '<td width=15% nowrap class="lvtCol" align="right"><b>' . $app_strings['LBL_PRODUCT_TOTAL'] . '</b></td>'; $output .= '</tr>'; $query = "select ec_products.*,ec_inventoryproductrel.*,ec_products.productid as crmid,ec_catalog.catalogname,ec_vendor.vendorname from ec_inventoryproductrel inner join ec_products on ec_products.productid=ec_inventoryproductrel.productid left join ec_catalog on ec_catalog.catalogid=ec_products.catalogid left join ec_vendor on ec_vendor.vendorid=ec_products.vendor_id where ec_inventoryproductrel.id=" . $this->id . " ORDER BY sequence_no"; $result = $this->db->query($query); $num_rows = $this->db->num_rows($result); for ($i = 1; $i <= $num_rows; $i++) { $productid = $this->db->query_result($result, $i - 1, 'crmid'); $comment = $this->db->query_result($result, $i - 1, 'comment'); if (empty($comment)) { $comment = " "; } $qty = $this->db->query_result($result, $i - 1, 'quantity'); $listprice = $this->db->query_result($result, $i - 1, 'listprice'); $total = $qty * $listprice; $qty = convertFromDollar($qty, 1); $listprice = convertFromDollar($listprice, 1); $total = convertFromDollar($total, 1); $output .= '<tr valign="top">'; foreach ($fieldnamelist as $fieldname) { $fieldvalue = $this->db->query_result($result, $i - 1, $fieldname); if ($fieldname == "productname") { $output .= '<td class="crmTableRow small lineOnTop" nowrap> <a href="index.php?action=DetailView&module=Products&record=' . $productid . '" target="_blank">' . $fieldvalue . '</a></td>'; } elseif (strpos($fieldname, "price")) { $fieldvalue = convertFromDollar($fieldvalue, 1); $output .= '<td class="crmTableRow small lineOnTop" nowrap> ' . $fieldvalue . '</td>'; } else { $output .= '<td class="crmTableRow small lineOnTop" nowrap> ' . $fieldvalue . '</td>'; } } $output .= '<td class="crmTableRow small lineOnTop"> ' . $qty . '</td>'; $output .= '<td class="crmTableRow small lineOnTop"> ' . $listprice . '</td>'; $output .= '<td class="crmTableRow small lineOnTop" valign="bottom" align="left"> ' . $comment . '</td>'; $output .= '<td class="crmTableRow small lineOnTop" align="right"> ' . $total . '</td>'; $output .= '</tr>'; } $output .= '</table>'; $output .= '<table width="100%" border="0" cellspacing="0" cellpadding="5" class="crmTable">'; $grandTotal = $this->column_fields['total'] != '' ? $this->column_fields['total'] : '0.00'; $grandTotal = convertFromDollar($grandTotal, 1); $output .= '<tr>'; $output .= '<td class="crmTableRow big lineOnTop" width="80%" style="border-right:1px #dadada;"> </td>'; $output .= '<td align="right" class="crmTableRow small lineOnTop"><b>' . $app_strings['LBL_GRAND_TOTAL'] . '</b></td>'; $output .= '<td align="right" class="crmTableRow small lineOnTop">' . $grandTotal . '</td>'; $output .= '</tr>'; $output .= '</table>'; $log->debug("Exiting getDetailAssociatedProducts method ..."); return $output; }
<?php require_once "include/Zend/Json.php"; global $adb; global $app_strings; global $current_user; global $log; $idlist = $_REQUEST['idlist']; $basemodule = $_REQUEST['basemodule']; $idlist = str_replace(";", ",", $idlist); $fieldlist = getProductFieldList($basemodule); //$fieldlist = array("productname","productcode","serialno","unit_price","catalogname"); //$fieldlist = array("productname","productcode","serialno","unit_price"); $productlist = array(); $query = "SELECT ec_products.productid as crmid,ec_products.*,ec_catalog.catalogname,ec_vendor.vendorname FROM ec_products left join ec_catalog on ec_catalog.catalogid=ec_products.catalogid left join ec_vendor on ec_vendor.vendorid=ec_products.vendor_id WHERE ec_products.deleted=0 and ec_products.productid in (" . $idlist . ")"; $result = $adb->query($query); $rownum = $adb->num_rows($result); if ($rownum > 0) { for ($i = 0; $i < $rownum; $i++) { $product = array(); $productid = $adb->query_result($result, $i, 'crmid'); $unit_price = $adb->query_result($result, $i, 'cost_price'); if ($unit_price == null) { $unit_price = 0; } $product["fieldlist"] = $fieldlist; $product["productid"] = $productid; $product["listprice"] = $unit_price; foreach ($fieldlist as $fieldname) { $fieldvalue = $adb->query_result($result, $i, $fieldname); if (strpos($fieldname, "price")) {
$smarty->assign("RETURN_ID", $_REQUEST['return_id']); } if (isset($_REQUEST['record'])) { $smarty->assign("CANCELACTION", "DetailView"); } else { $smarty->assign("CANCELACTION", "index"); } if (isset($_REQUEST['return_viewname'])) { $smarty->assign("RETURN_VIEWNAME", $_REQUEST['return_viewname']); } $smarty->assign("THEME", $theme); $smarty->assign("IMAGE_PATH", $image_path); $smarty->assign("ID", $focus->id); $smarty->assign("OLD_ID", $old_id); $tabid = getTabid("Maillists"); $data = getSplitDBValidationData($focus->tab_name, $tabid); $smarty->assign("VALIDATION_DATA_FIELDNAME", $data['fieldname']); $smarty->assign("VALIDATION_DATA_FIELDDATATYPE", $data['datatype']); $smarty->assign("VALIDATION_DATA_FIELDLABEL", $data['fieldlabel']); $smarty->assign("CALENDAR_LANG", $app_strings['LBL_JSCALENDAR_LANG']); if (isset($module_enable_product) && $module_enable_product) { $fieldnamelist = getProductFieldList("Maillists"); $smarty->assign("PRODUCTNAMELIST", $fieldnamelist); $fieldlabellist = getProductFieldLabelList("Maillists"); $smarty->assign("PRODUCTLABELLIST", $fieldlabellist); } if ($focus->mode == 'edit') { $smarty->display("Maillists/EditView.tpl"); } else { $smarty->display("Maillists/CreateView.tpl"); }
$smarty->assign("RETURN_ID", $_REQUEST['return_id']); } if (isset($_REQUEST['record'])) { $smarty->assign("CANCELACTION", "DetailView"); } else { $smarty->assign("CANCELACTION", "index"); } if (isset($_REQUEST['return_viewname'])) { $smarty->assign("RETURN_VIEWNAME", $_REQUEST['return_viewname']); } $smarty->assign("THEME", $theme); $smarty->assign("IMAGE_PATH", $image_path); $smarty->assign("ID", $focus->id); $smarty->assign("OLD_ID", $old_id); $tabid = getTabid("Qunfatmps"); $data = getSplitDBValidationData($focus->tab_name, $tabid); $smarty->assign("VALIDATION_DATA_FIELDNAME", $data['fieldname']); $smarty->assign("VALIDATION_DATA_FIELDDATATYPE", $data['datatype']); $smarty->assign("VALIDATION_DATA_FIELDLABEL", $data['fieldlabel']); $smarty->assign("CALENDAR_LANG", $app_strings['LBL_JSCALENDAR_LANG']); if (isset($module_enable_product) && $module_enable_product) { $fieldnamelist = getProductFieldList("Qunfatmps"); $smarty->assign("PRODUCTNAMELIST", $fieldnamelist); $fieldlabellist = getProductFieldLabelList("Qunfatmps"); $smarty->assign("PRODUCTLABELLIST", $fieldlabellist); } if ($focus->mode == 'edit') { $smarty->display("Qunfatmps/EditView.tpl"); } else { $smarty->display("Qunfatmps/CreateView.tpl"); }
function getAssociatedProductsFromQuote($quoteid) { global $log; $log->debug("Entering getAssociatedProductsFromQuote() method ..."); $output = ''; global $current_user; $product_Detail = array(); $query = "select ec_products.*,ec_inventoryproductrel.*,ec_products.productid as crmid from ec_inventoryproductrel inner join ec_products on ec_products.productid=ec_inventoryproductrel.productid where ec_inventoryproductrel.id=" . $quoteid . " ORDER BY sequence_no"; $fieldlist = getProductFieldList("SalesOrder"); $result = $this->db->query($query); $num_rows = $this->db->num_rows($result); for ($i = 1; $i <= $num_rows; $i++) { $productid = $this->db->query_result($result, $i - 1, 'crmid'); $product_Detail[$i]['delRow' . $i] = "Del"; $product_Detail[$i]['hdnProductId' . $i] = $productid; foreach ($fieldlist as $fieldname) { if ($fieldname == "productname") { $output .= '<td class="crmTableRow small lineOnTop" nowrap> <a href="index.php?action=DetailView&module=Products&record=' . $productid . '" target="_blank">' . $fieldvalue . '</a></td>'; } elseif (strpos($fieldname, "price")) { $fieldvalue = convertFromDollar($fieldvalue, 1); $output .= '<td class="crmTableRow small lineOnTop" nowrap> ' . $fieldvalue . '</td>'; } else { $output .= '<td class="crmTableRow small lineOnTop" nowrap> ' . $fieldvalue . '</td>'; } if ($fieldname != "imagename") { $fieldvalue = $this->db->query_result($result, $i - 1, $fieldname); if (strpos($fieldname, "price")) { $fieldvalue = convertFromDollar($fieldvalue, 1); } } else { $image_query = 'select ec_attachments.path, ec_attachments.attachmentsid, ec_attachments.name from ec_products left join ec_seattachmentsrel on ec_seattachmentsrel.crmid=ec_products.productid inner join ec_attachments on ec_attachments.attachmentsid=ec_seattachmentsrel.attachmentsid where productid=' . $productid; $result_image = $this->db->query($image_query); $nums = $this->db->num_rows($result_image); if ($nums > 0) { $image_id = $this->db->query_result($result_image, 0, 'attachmentsid'); $image_name = $this->db->query_result($result_image, 0, 'name'); $image_path = $this->db->query_result($result_image, 0, 'path'); $imagename = $image_path . $image_id . "_" . base64_encode_filename($image_name); } else { $imagename = ""; } } $product_Detail[$i][$fieldname . $i] = $fieldvalue; } $comment = $this->db->query_result($result, $i - 1, 'comment'); $qty = $this->db->query_result($result, $i - 1, 'quantity'); $listprice = $this->db->query_result($result, $i - 1, 'listprice'); $discountPercent = $this->db->query_result($result, $i - 1, 'discount_percent'); $discountAmount = $this->db->query_result($result, $i - 1, 'discount_amount'); if (is_numeric($discountPercent)) { $discountPercent = $discountPercent * 100; } //calculate productTotal if (is_numeric($discountAmount)) { $productTotal = $qty * $discountAmount; } else { $productTotal = $qty * $listprice; } $listprice = getConvertedPriceFromDollar($listprice); $productTotal = getConvertedPriceFromDollar($productTotal); $qty = convertFromDollar($qty, 1); $product_Detail[$i]['qty' . $i] = $qty; $product_Detail[$i]['listPrice' . $i] = $discountAmount; $product_Detail[$i]['comment' . $i] = $comment; $product_Detail[$i]['productTotal' . $i] = $productTotal; $product_Detail[$i]['netPrice' . $i] = $productTotal; } //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 = $this->column_fields['hdnSubTotal'] != '' ? $this->column_fields['hdnSubTotal'] : '0.00'; $subTotal = getConvertedPriceFromDollar($subTotal); $discountPercent = $this->column_fields['hdnDiscountPercent'] != '' ? $this->column_fields['hdnDiscountPercent'] : '0.00'; $discountAmount = $this->column_fields['hdnDiscountAmount'] != '' ? $this->column_fields['hdnDiscountAmount'] : '0.00'; if ($this->column_fields['hdnDiscountPercent'] != '' && $this->column_fields['hdnDiscountPercent'] != '0.0') { $finalDiscount = $subTotal * $discountPercent / 100; $product_Detail[1]['final_details']['discount_type_final'] = 'percentage'; $product_Detail[1]['final_details']['discount_percentage_final'] = $discountPercent; $product_Detail[1]['final_details']['checked_discount_percentage_final'] = ' checked'; $product_Detail[1]['final_details']['style_discount_percentage_final'] = ' style="visibility:visible"'; $product_Detail[1]['final_details']['style_discount_amount_final'] = ' style="visibility:hidden"'; } elseif ($this->column_fields['hdnDiscountAmount'] != '') { $finalDiscount = $this->column_fields['hdnDiscountAmount']; $finalDiscount = getConvertedPriceFromDollar($finalDiscount); $discountAmount = getConvertedPriceFromDollar($discountAmount); $product_Detail[1]['final_details']['discount_type_final'] = 'amount'; $product_Detail[1]['final_details']['discount_amount_final'] = $discountAmount; $product_Detail[1]['final_details']['checked_discount_amount_final'] = ' checked'; $product_Detail[1]['final_details']['style_discount_amount_final'] = ' style="visibility:visible"'; $product_Detail[1]['final_details']['style_discount_percentage_final'] = ' style="visibility:hidden"'; } $product_Detail[1]['final_details']['discountTotal_final'] = $finalDiscount; //To set the Shipping & Handling charge $shCharge = $this->column_fields['hdnS_H_Amount'] != '' ? $this->column_fields['hdnS_H_Amount'] : '0.00'; $shCharge = getConvertedPriceFromDollar($shCharge); $product_Detail[1]['final_details']['shipping_handling_charge'] = $shCharge; //To set the Adjustment value $adjustment = $this->column_fields['txtAdjustment'] != '' ? $this->column_fields['txtAdjustment'] : '0.00'; $adjustment = getConvertedPriceFromDollar($adjustment); $product_Detail[1]['final_details']['adjustment'] = $adjustment; //To set the grand total $grandTotal = $this->column_fields['hdnGrandTotal'] != '' ? $this->column_fields['hdnGrandTotal'] : '0.00'; $grandTotal = getConvertedPriceFromDollar($grandTotal); $product_Detail[1]['final_details']['grandTotal'] = $grandTotal; $log->debug("Exiting getAssociatedProductsFromQuote method ..."); return $product_Detail; }
$smarty->assign("RETURN_MODULE", $_REQUEST['return_module']); } else { $smarty->assign("RETURN_MODULE", "SalesOrder"); } if (isset($_REQUEST['return_action'])) { $smarty->assign("RETURN_ACTION", $_REQUEST['return_action']); } else { $smarty->assign("RETURN_ACTION", "index"); } $smarty->assign("RETURN_ID", $return_id); if (isset($_REQUEST['return_viewname'])) { $smarty->assign("RETURN_VIEWNAME", $_REQUEST['return_viewname']); } $smarty->assign("THEME", $theme); $smarty->assign("IMAGE_PATH", $image_path); $smarty->assign("MODULE", "SalesOrder"); $smarty->assign("ID", $focus->id); $fieldlabellist = getProductFieldLabelList("SalesOrder"); $smarty->assign("PRODUCTLABELLIST", $fieldlabellist); $fieldnamelist = getProductFieldList("SalesOrder"); $smarty->assign("PRODUCTNAMELIST", $fieldnamelist); $tabid = getTabid("SalesOrder"); $data = getSplitDBValidationData($focus->tab_name, $tabid); $smarty->assign("VALIDATION_DATA_FIELDNAME", $data['fieldname']); $smarty->assign("VALIDATION_DATA_FIELDDATATYPE", $data['datatype']); $smarty->assign("VALIDATION_DATA_FIELDLABEL", $data['fieldlabel']); if ($focus->mode == 'edit') { $smarty->display("SalesOrder/InventoryEditView.tpl"); } else { $smarty->display('SalesOrder/InventoryCreateView.tpl'); }