$bodyHtml .= $pdf->createTr(false, $mod_strings["LBL_CODE"], $product->pnum, $mod_strings["LBL_ACCOUNT_NAME"], $product->account_name); $bodyHtml .= $pdf->createTr(true, $mod_strings["LBL_NAME"], $product->name, $mod_strings["LBL_CONTACT_NAME"], $product->contact_name); $bodyHtml .= $pdf->createHeading($mod_strings["LBL_REQUEST_INFORMATION"]); $bodyHtml .= $pdf->createTr(false, $mod_strings["LBL_ASSIGNED_USER_ID"], $focus->assigned_user_name, $mod_strings["LBL_DUE_DATE"], $focus->due_date); $bodyHtml .= $pdf->createTr(true, $mod_strings["LBL_DATE_ENTERED"], $dateEntered, $mod_strings["LBL_DATE_MODIFIED"], $dateModified); $bodyHtml .= $pdf->createHeading($mod_strings["LBL_GENERAL"]); $bodyHtml .= $pdf->createTr(false, $mod_strings["LBL_QUANTITY"], $focus->quantity, $mod_strings["LBL_PERIODIC"], $periodic); $bodyHtml .= $pdf->createTr(false, $mod_strings["LBL_FILES"], $focus->files, $mod_strings["LBL_SAMPLES"], $samples); $bodyHtml .= $pdf->createTr(false, $mod_strings["LBL_SPECIAL_REQUIREMENTS"], $focus->special_requirements, null, null, true); $bodyHtml .= $pdf->createTr(true, $mod_strings["LBL_DESCRIPTION"], $description, null, null, true); $bodyHtml .= $pdf->createHeading($mod_strings["LBL_OPERATIONS"]); $bodyHtml .= $pdf->createTr(true, $mod_strings["LBL_OPERATIONS_DESCRIPTION"], $focus->operation_description, null, null, true); $bodyHtml .= $pdf->createHeading($mod_strings["LBL_OTHERS"]); $bodyHtml .= $pdf->createTr(true, $mod_strings["LBL_TRANSPORT"], $focus->transport, $mod_strings["LBL_PACK"], $focus->pack); $bodyHtml .= $pdf->createHeading($mod_strings["LBL_COMPONENTS_LIST"]); $bodyHtml .= $pdf->genCells($mod_strings["LBL_NAME"], true, true, false); $bodyHtml .= $pdf->genCells($mod_strings["LBL_TYPE"]); $bodyHtml .= $pdf->genCells($mod_strings["LBL_PAPER_DESCRIPTION"]); $bodyHtml .= $pdf->genCells($mod_strings["LBL_COLORS_A"]); $bodyHtml .= $pdf->genCells($mod_strings["LBL_COLORS_B"], false, false, true); $bodyHtml .= $pdf->CompRows($list); $bodyHtml .= "</table>"; $bodyHtml .= "<newpage>"; //Get the components' ids $list = null; $query = "SELECT id FROM `estimates_components` WHERE parent_id='" . $focus->id . "' AND deleted=0 AND parent_bean = 'ClientRequest'"; //$query = "SELECT id FROM `estimates_components` WHERE deleted=0 AND parent_bean = 'ClientRequest'"; $result = $focus->db->query($query, true, "Error filling layout fields: "); while ($row = $focus->db->fetchByAssoc($result)) { $list[] = $row['id']; }
} } else { ${$curr} = $currency->getDefaultCurrencyName(); } //begin the Body's html creation (the Header and Footer are called later) $bodyHtml .= $pdf->sectionHeading($mod_strings["LBL_MODULE_NAME"], $focus->name, $focus->quotenum); $bodyHtml .= $pdf->createHeading(); $bodyHtml .= $pdf->createTr(false, $mod_strings["LBL_NAME"], $focus->name, $mod_strings["LBL_QUOTENUM"], $focus->quotenum); $bodyHtml .= $pdf->createTr(false, $mod_strings["LBL_OPPORTUNITY_NAME"], $focus->opportunity_name, $mod_strings["LBL_STAGE"], $stage); $bodyHtml .= $pdf->createTr(false, $mod_strings["LBL_ACCOUNT_NAME"], $focus->account_name, $mod_strings["LBL_BILLTOCONTACTNAME"], $focus->billtocontactname); $bodyHtml .= $pdf->createTr(false, $mod_strings["LBL_CURRENCY"], $curr, $mod_strings["LBL_PAYMENT_METHOD"], $payment_method); $bodyHtml .= $pdf->createTr(false, $mod_strings["LBL_PAYMENT_TERM"], $payment_term, $mod_strings["LBL_SHIPPING_TERM"], $shipping_term); $bodyHtml .= $pdf->createTr(false, $mod_strings["LBL_ASSIGNEDUSER"], $focus->assigned_user_name, $mod_strings["LBL_VALIDUNTIL"], $focus->validuntil); $bodyHtml .= $pdf->createTr(true, $mod_strings["LBL_BILLTOADDRESS"], $address); $bodyHtml .= $pdf->createHeading($mod_strings["LBL_LINEITEMS"]); $bodyHtml .= $pdf->genCells($mod_strings["LBL_PRODUCT"], true, true, false, "20%"); $bodyHtml .= $pdf->genCells($mod_strings["LBL_PRODUCT_NUMBER"], false, false, false, "20%"); $bodyHtml .= $pdf->genCells($mod_strings["LBL_TOTAL_PAPER"]); $bodyHtml .= $pdf->genCells($mod_strings["LBL_TOTAL_PREPRESS"]); $bodyHtml .= $pdf->genCells($mod_strings["LBL_TOTAL_PRESS"]); $bodyHtml .= $pdf->genCells($mod_strings["LBL_TOTAL_OPERATIONS"]); $bodyHtml .= $pdf->genCells($mod_strings["LBL_TOTAL_PRICE"]); $bodyHtml .= $pdf->genCells($mod_strings["LBL_QUOTED_PRICE"], false, false, true); //var_dump($bodyHtml2); //die; if (!empty($focus->estimate_id)) { $bodyHtml .= $focus->add_quote_estimate($focus->estimate_id, false, true); } $bodyHtml .= "</table>"; $xtpl = new XTemplate("CreatePDF.html"); $xtpl->assign("HEADER", $pdf->headerPDF());
$bodyHtml .= $pdf->createTr(false, $mod_strings["LBL_PAPER_TOTAL"], $total_paper, $mod_strings["LBL_PREPRESS_TOTAL"], $total_prepress); $bodyHtml .= $pdf->createTr(false, $mod_strings["LBL_PRESS_TOTAL"], $total_press, $mod_strings["LBL_OPERATIONS_TOTAL"], $total_operations); $bodyHtml .= $pdf->createTr(true, $mod_strings["LBL_STATUS"], $status); //$bodyHtml .= "<newpage>"; $paperEst = $focus->paperEstimate($focus->component_id, null, false, true); $pressEst = $focus->pressEstimate($focus->component_id, null, false, true); $operationsEst = $focus->operationsEstimate($focus->component_id, false, true); $prepressEst = $focus->prepressEstimate($focus->component_id, false, true); $compsHtml = ""; $compsHtml .= $pdf->sectionHeading($mod_strings["LBL_DETAILED_INFO"]); //shortcuts $singlePrice = $paperEst["paper_singleprice"] . " " . $mod_strings["LBL_UNITS"]; $paperPrice = $paperEst["total_paper_price"] . " " . $mod_strings["LBL_UNITS"]; //paper $compsHtml .= $pdf->createHeading($mod_strings["LBL_PAPER"]); $compsHtml .= $pdf->genCells($mod_strings["LBL_CLEAN_QTY_QP"], true, true, false); $compsHtml .= $pdf->genCells($mod_strings["LBL_PAPERWOST_QP"]); $compsHtml .= $pdf->genCells($mod_strings["LBL_QP"]); $compsHtml .= $pdf->genCells($mod_strings["LBL_SHETS_QP"]); $compsHtml .= $pdf->genCells($mod_strings["LBL_PAGES"]); $compsHtml .= $pdf->genCells($mod_strings["LBL_PAPER_SINGLE_PRICE"]); $compsHtml .= $pdf->genCells($mod_strings["LBL_PAPER_TOTAL"]); $compsHtml .= $pdf->genCells($mod_strings["LBL_PAPER_FROM_CLIENT"], false, false, true); $compsHtml .= $pdf->genCells($paperEst["clean_quantity_qp"], true, false, false); $compsHtml .= $pdf->genCells($paperEst["paperwaste_qp"]); $compsHtml .= $pdf->genCells($paperEst["qp"]); $compsHtml .= $pdf->genCells($paperEst["sheets_qp"]); $compsHtml .= $pdf->genCells($paperEst["pages"]); $compsHtml .= $pdf->genCells($singlePrice); $compsHtml .= $pdf->genCells($paperPrice); $compsHtml .= $pdf->genCells($paperEst["client_paper"], false, false, true);
//HTML2FPDF contains the functions - headerPDF, footerPDF, createHeading, createTr $pdf = new HTML2FPDF(); //Shortcuts $status = $app_list_strings['estimate_component_status'][$focus->sub_status]; //begin the Body's html creation (the Header and Footer are called later) $bodyHtml = ""; $bodyHtml .= $pdf->sectionHeading($mod_strings["LBL_MODULE_NAME"], $focus->name, $focus->number); $bodyHtml .= $pdf->createHeading($mod_strings["LBL_PRODUCT_INFORMATION"]); $bodyHtml .= $pdf->createTr(false, $mod_strings["LBL_CODE"], $focus->number, $mod_strings["LBL_ACCOUNT_NAME"], $focus->account_name); $bodyHtml .= $pdf->createTr(false, $mod_strings["LBL_NAME"], $focus->name, $mod_strings["LBL_CONTACT_NAME"], $focus->contact_name); $bodyHtml .= $pdf->createTr(true, $mod_strings["LBL_STATUS"], $status); $bodyHtml .= $pdf->createHeading($mod_strings["LBL_ESTIMATE_QTY"]); $bodyHtml .= $pdf->createTr(false, $mod_strings["LBL_QUANTITY"], $focus->quantity, $mod_strings["LBL_SAMPLES"], $focus->samples); $bodyHtml .= $pdf->createTr(true, $mod_strings["LBL_DEADLINE"], $focus->deadline, $mod_strings["LBL_FILE"], $focus->file); $bodyHtml .= $pdf->createHeading($mod_strings["LBL_COMPONENTS_LIST"]); $bodyHtml .= $pdf->genCells($mod_strings["LBL_COMP_NAME"], true, true, false); $bodyHtml .= $pdf->genCells($mod_strings["LBL_COMP_TYPE"]); $bodyHtml .= $pdf->genCells($mod_strings["LBL_COMP_NUMBER"]); $bodyHtml .= $pdf->genCells($mod_strings["LBL_COMP_PAPER"], false, false, false, "25%"); $bodyHtml .= $pdf->genCells($mod_strings["LBL_COMP_FSIZE_H"]); $bodyHtml .= $pdf->genCells($mod_strings["LBL_COMP_FSIZE_W"], false, false, true); $bodyHtml .= $pdf->CompRows($list); $bodyHtml .= "</table>"; $bodyHtml .= "<newpage>"; $list = null; $query = "SELECT id FROM `estimates_components` WHERE parent_id='" . $focus->id . "' AND deleted=0"; $result = $focus->db->query($query, true, "Error filling layout fields: "); while ($row = $focus->db->fetchByAssoc($result)) { $list[] = $row['id']; } //Initializing of EstimateComponents object, needs to be done for every record