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; }
$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"); }
$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 getDetailAssociatedProducts() { global $log; $log->debug("Entering getDetailAssociatedProducts() method ..."); global $adb; global $theme; global $log; global $app_strings, $current_user; $theme_path = "themes/" . $theme . "/"; $image_path = $theme_path . "images/"; $output = ''; $fieldlabellist = getProductFieldLabelList("SalesOrder"); $fieldnamelist = getProductFieldList("SalesOrder"); $output .= '<table class="table table-bordered table-hover table-condensedforev dvtable" 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=10% 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 from ec_inventoryproductrel inner join ec_products on ec_products.productid=ec_inventoryproductrel.productid where ec_inventoryproductrel.id=" . $this->id . " ORDER BY sequence_no"; $result = $adb->query($query); $num_rows = $adb->num_rows($result); $netTotal = '0.00'; for ($i = 1; $i <= $num_rows; $i++) { $productid = $adb->query_result($result, $i - 1, 'crmid'); $comment = $adb->query_result($result, $i - 1, 'comment'); if (empty($comment)) { $comment = " "; } $qty = $adb->query_result($result, $i - 1, 'quantity'); $listprice = $adb->query_result($result, $i - 1, 'listprice'); $total_1 = $qty * $listprice; $listprice = convertFromDollar($listprice, 1); $total = convertFromDollar($total_1, 1); $qty = convertFromDollar($qty, 1); $netprice = $total_1; $output .= '<tr valign="top">'; foreach ($fieldnamelist as $fieldname) { $fieldvalue = $adb->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>'; $netTotal = $netTotal + $netprice; } $output .= '</table>'; //Display the total, adjustment, S&H details $output .= '<table class="table table-bordered table-hover table-condensedforev dvtable" style="margin-top:5px;">'; $grandTotal = $netTotal != '' ? $netTotal : '0.00'; $grandTotal = convertFromDollar($grandTotal, 1); $output .= '<tr>'; $output .= '<td align="right" class="crmTableRow small lineOnTop"><b>' . $app_strings['LBL_GRAND_TOTAL'] . '</b></td>'; $output .= '<td align="right" class="crmTableRow small lineOnTop" width="11%"><b>¥' . $grandTotal . '</b></td>'; $output .= '</tr>'; $output .= '</table>'; $log->debug("Exiting getDetailAssociatedProducts method ..."); return $output; }
$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'); }