function component_estimate_pdf() { global $current_language, $app_list_strings; global $pdfFontSize, $pdfColors; $fSize = $pdfFontSize["default"]; $trColor = $pdfColors["label"]; $tableColor = $pdfColors["field"]; $object = new ComponentEstimateCalc(); $mod_strings = return_module_language($current_language, $object->object_name); $html = "<table width=100% border=0 cellspacing=0 cellpadding=0 bgcolor={$tableColor}>\n\t\t\t\t\t <tr bgcolor={$trColor}> \n\t\t\t\t\t <td width=30%><font size={$fSize}>" . $mod_strings["LBL_NAME"] . "</font></td>\n\t\t\t\t\t <td><font size={$fSize}>" . $mod_strings["LBL_TOTAL"] . "</font></td> \n\t\t\t\t\t <td><font size={$fSize}>" . $mod_strings["LBL_PREPRESS_TOTAL"] . "</font></td>\n\t\t\t\t\t <td><font size={$fSize}>" . $mod_strings["LBL_PRESS_TOTAL"] . "</font></td>\n\t\t\t\t\t <td><font size={$fSize}>" . $mod_strings["LBL_PAPER_TOTAL"] . "</font></td>\n\t\t\t\t\t <td><font size={$fSize}>" . $mod_strings["LBL_OPERATIONS_TOTAL"] . "</font></td>\n\t\t\t\t\t </tr><tr><td height=1px bgcolor=#fff colspan=6></td></tr>"; $query = 'SELECT id FROM componentestimatecalc WHERE estimate_id="' . $this->estimate_id . '" AND deleted=0 '; $result = $this->db->query($query, true, "Error filling layout fields: "); $i = 0; while (($row = $this->db->fetchByAssoc($result)) != null) { $i = $i + 1; $details = "details_" . $i; $update_estimate = "update_estimate_" . $i; $object->retrieve($row['id']); $total = $object->total_prepress + $object->total_press + $object->total_paper + $object->total_operations . " " . $mod_strings['LBL_UNITS']; $total_prepress = $object->total_prepress . " " . $mod_strings["LBL_UNITS"]; $total_press = $object->total_press . " " . $mod_strings["LBL_UNITS"]; $total_paper = $object->total_paper . " " . $mod_strings["LBL_UNITS"]; $total_operations = $object->total_operations . " " . $mod_strings["LBL_UNITS"]; $html .= "<tr>\n\t\t\t\t\t <td width=30%><font size={$fSize}>{$object->name}</font></td> \n\t\t\t\t\t <td><font size={$fSize}>{$total}</font></td>\n\t\t\t\t\t <td><font size={$fSize}>{$total_prepress}</font></td>\n\t\t\t\t\t <td><font size={$fSize}>{$total_press}</font></td>\n\t\t\t\t\t <td><font size={$fSize}>{$total_paper}</font></td>\n\t\t\t\t\t <td><font size={$fSize}>{$total_operations}</font></td>\n\t\t\t\t\t </tr> \n\t\t\t\t\t</table>"; //$object->estimate_details($object->id, $details, $update_estimate ); } return $html; }
function estimate_details($id, $details = 'details', $update_estimate = 'update_estimate') { global $current_language, $app_list_strings; $object = new ComponentEstimateCalc(); $mod_strings = return_module_language($current_language, $object->object_name); $object->retrieve($id); $xtpl = new XTemplate('modules/ComponentEstimateCalc/EstimateDetails.html'); $xtpl->assign('MOD', $mod_strings); if ($object->status == "uptodate") { ///////////// DETAILS ///////////// $prepress = $object->prepressEstimate($object->component_id); $press_rate[] = $object->press_rate_a_id; $press_rate[] = $object->press_rate_b_id; $pressestimate = $object->pressEstimate($object->component_id, $press_rate); $paperestimate = $object->paperEstimate($object->component_id, $object->paper_rate_id); $operations = $object->operationsEstimate($object->component_id, true); ///Press $xtpl->assign("press_price_lines", $pressestimate['layout_html']); /// ///Paper & Paperwaste $client_paper = $paperestimate['client_paper']; $xtpl->assign("paper_singleprice", $paperestimate['paper_singleprice']); $xtpl->assign("total_paper", $paperestimate['total_paper_price']); $xtpl->assign("clean_quantity_qp", $paperestimate['clean_quantity_qp']); $xtpl->assign("paperwaste_qp", $paperestimate['paperwaste_qp']); $xtpl->assign("qp", $paperestimate['qp']); $xtpl->assign("sheets_qp", $paperestimate['sheets_qp']); $xtpl->assign("pages", $paperestimate['pages']); $xtpl->assign("paper_waste_rows", $paperestimate['paperestimate_html']); $xtpl->assign("paper_operation_waste_rows", $paperestimate['operations_html']); $xtpl->assign("client_paper", $app_list_strings['client_paper_options'][$client_paper]); /// ///Prepress $xtpl->assign("prepress_lines", $prepress['html']); /// ///Operations $xtpl->assign("operation_lines", $operations['html']); /// $xtpl->assign("details", $details); //////////////////////////////////// } else { $xtpl->assign("details", $update_estimate); } $xtpl->parse('details'); $xtpl->out('details'); }
* requirements. * * The Original Code is: SugarCRM Open Source * The Initial Developer of the Original Code is SugarCRM, Inc. * Portions created by SugarCRM are Copyright (C) 2004-2006 SugarCRM, Inc.; * All Rights Reserved. * Contributor(s): ______________________________________. */ require_once 'modules/ComponentEstimateCalc/ComponentEstimateCalc.php'; $sugarbean = new ComponentEstimateCalc(); // perform the delete if given a record to delete if (empty($_REQUEST['record'])) { $GLOBALS['log']->info('delete called without a record id specified'); } else { $record = $_REQUEST['record']; $sugarbean->retrieve($record); if (!$sugarbean->ACLAccess('Delete')) { ACLController::displayNoAccess(true); sugar_cleanup(true); } $GLOBALS['log']->info("deleting record: {$record}"); $sugarbean->delete_estimate($record); $sugarbean->mark_deleted($record); } // handle the return location variables $return_module = empty($_REQUEST['return_module']) ? 'ComponentEstimateCalc' : $_REQUEST['return_module']; $return_action = empty($_REQUEST['return_action']) ? 'index' : $_REQUEST['return_action']; $return_id = empty($_REQUEST['return_id']) ? '' : $_REQUEST['return_id']; $return_location = "index.php?module={$return_module}&action={$return_action}"; // append the return_id if given if (!empty($return_id)) {
*/ require_once 'XTemplate/xtpl.php'; require_once 'data/Tracker.php'; require_once 'modules/ComponentEstimateCalc/ComponentEstimateCalc.php'; require_once 'include/time.php'; require_once 'modules/ComponentEstimateCalc/Forms.php'; require_once 'include/formbase.php'; global $timedate; global $app_strings; global $app_list_strings; global $current_language; global $current_user; global $sugar_version, $sugar_config; $focus = new ComponentEstimateCalc(); if (!empty($_REQUEST['record'])) { $focus->retrieve($_REQUEST['record']); } if (!empty($_REQUEST['component_id']) && isset($_REQUEST['component_id']) && !is_null($_REQUEST['component_id'])) { $component_id = $_REQUEST['component_id']; } if (isset($focus->component_id) && !is_null($focus->component_id)) { $component_id = $focus->component_id; } $press_rate = array(); $press_rate[] = null; $press_rate[] = null; if (isset($_REQUEST['press_rate_a_id']) && !empty($_REQUEST['press_rate_a_id'])) { $press_rate[0] = $_REQUEST['press_rate_a_id']; } if (isset($_REQUEST['press_rate_b_id']) && !empty($_REQUEST['press_rate_b_id'])) { $press_rate[1] = $_REQUEST['press_rate_b_id'];
} echo "\n<p>\n"; echo get_module_title($mod_strings['LBL_MODULE_NAME'], $mod_strings['LBL_MODULE_NAME'] . ': ' . $focus->name, true); echo "\n</p>\n"; $theme_path = 'themes/' . $theme . '/'; $image_path = $theme_path . 'images/'; require_once $theme_path . 'layout_utils.php'; $xtpl = new XTemplate('modules/Estimates/DetailView.html'); ////Auto Estimate if (isset($_REQUEST['estimate_id']) && isset($_REQUEST['mode']) && $_REQUEST['mode'] == "auto") { $components_to_estimate = $focus->build_component_estimates_list($focus->id); for ($i = 0; $i < count($components_to_estimate); $i++) { $component_id = $components_to_estimate[$i]['id']; $componentEstimate = new ComponentEstimateCalc(); if ($components_to_estimate[$i]['outdated'] == true) { $componentEstimate->retrieve($components_to_estimate[$i]['estimate_id']); } $paperestimate = $componentEstimate->paperEstimate($component_id, null); $pressestimate = $componentEstimate->pressEstimate($component_id, null); $operations = $componentEstimate->operationsEstimate($component_id); $prepress = $componentEstimate->prepressEstimate($component_id); $componentEstimate->name = $mod_strings['LBL_EST_NAME_PREFIX'] . "-" . $components_to_estimate[$i]['name']; $componentEstimate->component_id = $components_to_estimate[$i]['id']; $componentEstimate->component_name = $components_to_estimate[$i]['name']; $componentEstimate->estimate_id = $focus->id; $componentEstimate->estimate_name = $focus->name; $componentEstimate->assigned_user_id = $current_user->id; $componentEstimate->total_paper = $paperestimate['total_paper_price']; $componentEstimate->total_press = $pressestimate['total_price']; $componentEstimate->total_prepress = $prepress['total_price']; $componentEstimate->total_operations = $operations['total_price'];
$bodyHtml .= $pdf->createTr(false, $mod_strings["LBL_ESTIMATE_TOTAL"], $total, $mod_strings["LBL_DESCRIPTION"], nl2br(url2html($focus->description))); $bodyHtml .= $pdf->createTr(false, $mod_strings["LBL_PAPER_ESTIMATE"], $total_paper, $mod_strings["LBL_PREPRESS_ESTIMATE"], $total_prepress); $bodyHtml .= $pdf->createTr(true, $mod_strings["LBL_PRESS_ESTIMATE"], $total_press, $mod_strings["LBL_OPERATIONS_ESTIMATE"], $total_operations); $bodyHtml .= $pdf->createHeading(); $bodyHtml .= $focus->component_estimate_pdf(); $bodyHtml .= "<newpage>"; //// //// //Prepress $CompEstCalc = new ComponentEstimateCalc(); $query = 'SELECT component_id FROM ' . $CompEstCalc->table_name . ' WHERE estimate_id="' . $focus->estimate_id . '" AND deleted=0 '; $result = $focus->db->query($query, true, "Error filling layout fields: "); $i = 0; while (($row = $focus->db->fetchByAssoc($result)) != null) { $i++; $CompEstCalc->retrieve($row['id']); $paperEst = $CompEstCalc->paperEstimate($row['component_id'], null, false, true); $pressEst = $CompEstCalc->pressEstimate($row['component_id'], null, false, true); $operationsEst = $CompEstCalc->operationsEstimate($row['component_id'], false, true); $prepressEst = $CompEstCalc->prepressEstimate($row['component_id'], false, true); $mod_strings_cec = return_module_language($current_language, "ComponentEstimateCalc"); $compsHtml = ""; $compsHtml .= $pdf->sectionHeading($mod_strings["LBL_EST_PDF"]); //shortcuts $singlePrice = $paperEst["paper_singleprice"] . " " . $mod_strings["LBL_UNITS"]; $paperPrice = $paperEst["total_paper_price"] . " " . $mod_strings["LBL_UNITS"]; //paper $compsHtml .= $pdf->createHeading($mod_strings_cec["LBL_PAPER"]); $compsHtml .= $pdf->genCells($mod_strings_cec["LBL_CLEAN_QTY_QP"], true, true, false); $compsHtml .= $pdf->genCells($mod_strings_cec["LBL_PAPERWOST_QP"]); $compsHtml .= $pdf->genCells($mod_strings_cec["LBL_QP"]);