Java tutorial
package com.planning.project.controller; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; import com.itextpdf.text.Document; import com.itextpdf.text.DocumentException; import com.itextpdf.text.Element; import com.itextpdf.text.Font; import com.itextpdf.text.Image; import com.itextpdf.text.Paragraph; import com.itextpdf.text.Phrase; import com.itextpdf.text.pdf.BaseFont; import com.itextpdf.text.pdf.PdfPCell; import com.itextpdf.text.pdf.PdfPTable; import com.itextpdf.text.pdf.PdfWriter; import com.planning.project.entity.TbActivity; import com.planning.project.entity.TbAddmoneynovara; import com.planning.project.entity.TbAddmoneyvara; import com.planning.project.entity.TbAllowancesrental; import com.planning.project.entity.TbApproPlaceType; import com.planning.project.entity.TbComlecturer; import com.planning.project.entity.TbDescriptionstatement; import com.planning.project.entity.TbDetailSka; import com.planning.project.entity.TbDetailSm; import com.planning.project.entity.TbEmploy; import com.planning.project.entity.TbExpenpaper; import com.planning.project.entity.TbFee; import com.planning.project.entity.TbFormProject; import com.planning.project.entity.TbFormSubproject; import com.planning.project.entity.TbGasolineDetail; import com.planning.project.entity.TbInsurance; import com.planning.project.entity.TbMaketimeformeal; import com.planning.project.entity.TbMaterial; import com.planning.project.entity.TbMeetingofthesnack; import com.planning.project.entity.TbOthercompensation; import com.planning.project.entity.TbPublicutility; import com.planning.project.entity.TbRemunerationcommittee; import com.planning.project.entity.TbRentalproperty; import com.planning.project.entity.TbRentshouse; import com.planning.project.entity.TbRepairofequipment; import com.planning.project.entity.TbSocialsecurity; import com.planning.project.entity.TbTargetgroup; import com.planning.project.entity.TbTax; import com.planning.project.entity.TbTeachextra; import com.planning.project.entity.TbThecertificationdrink; import com.planning.project.entity.TbThecertificationfood; import com.planning.project.entity.TbThegift; import com.planning.project.entity.TbWageservice; public class CreatePDF { private static Font TIME_ROMAN = new Font(Font.FontFamily.TIMES_ROMAN, 18, Font.BOLD); private static Font TIME_ROMAN_SMALL = new Font(Font.FontFamily.COURIER, 12, Font.BOLD); /** * @param args * @throws Exception */ public static Document createPDFBudwork(String file, TbDescriptionstatement tbDescriptionstatement, List<TbAddmoneyvara> tbAddmoneyvaras, List<TbAddmoneynovara> tbAddmoneynovaras, List<TbRemunerationcommittee> tbRemunerationcommittees, List<TbMaketimeformeal> tbMaketimeformeals, List<TbRentshouse> tbRentshouses, List<TbTeachextra> tbTeachextras, List<TbExpenpaper> tbExpenpapers, List<TbComlecturer> tbComlecturers, List<TbOthercompensation> tbOthercompensations, List<TbAllowancesrental> tbAllowancesrentals, List<TbRepairofequipment> tbRepairofequipments, List<TbWageservice> tbWageservices, List<TbMeetingofthesnack> tbMeetingofthesnacks, List<TbSocialsecurity> tbSocialsecuritys, List<TbRentalproperty> tbRentalpropertys, List<TbThecertificationfood> tbThecertificationfoods, List<TbThecertificationdrink> tbThecertificationdrinks, List<TbThegift> tbThegifts, List<TbTax> tbTaxs, List<TbFee> tbFees, List<TbInsurance> tbInsurances, List<TbEmploy> tbEmploys, List<TbMaterial> tbMaterials1, List<TbMaterial> tbMaterials2, List<TbMaterial> tbMaterials3, List<TbMaterial> tbMaterials4, List<TbMaterial> tbMaterials5, List<TbMaterial> tbMaterials6, List<TbMaterial> tbMaterials7, List<TbMaterial> tbMaterials8, List<TbMaterial> tbMaterials9, List<TbMaterial> tbMaterials10, List<TbMaterial> tbMaterials11, List<TbPublicutility> tbPublicutilitys, List<TbGasolineDetail> tbGasolineDetails) throws Exception { Document document = null; try { Font font16 = new Font( BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED)); font16.setSize(16); document = new Document(); PdfWriter.getInstance(document, new FileOutputStream(file)); document.open(); Paragraph paragraph = new Paragraph(); addMetaData(document); addTitlePageBud(document); createPagePDFBudwork(document, tbDescriptionstatement); createHeadlistBudwork(document, "1"); PdfPTable table = createtableAddmoneyvara(tbAddmoneyvaras, tbDescriptionstatement.getSumAddmoneyvara()); document.add(table); table.setSpacingBefore(25); table = createtableAddmoneynovara(tbAddmoneynovaras, tbDescriptionstatement.getSumAddmoneynovara()); table.setSpacingBefore(25); document.add(table); table = createtableRemunerationcommittee(tbRemunerationcommittees, tbDescriptionstatement.getSumRemunerationcomnittee()); table.setSpacingBefore(25); document.add(table); table = createtableMaketimeformeal(tbMaketimeformeals, tbDescriptionstatement.getSumMaketimeformeals()); table.setSpacingBefore(25); document.add(table); table = createtableRentshouse(tbRentshouses, tbDescriptionstatement.getSumRentshouse()); table.setSpacingBefore(25); document.add(table); table = createtableTeachextra(tbTeachextras, tbDescriptionstatement.getSumTeachextra()); table.setSpacingBefore(25); document.add(table); table = createtableExpenpaper(tbExpenpapers, tbDescriptionstatement.getSumExpenpaper()); table.setSpacingBefore(25); document.add(table); table = createtableComlecturer(tbComlecturers, tbDescriptionstatement.getSumComlecturer()); table.setSpacingBefore(25); document.add(table); table = createtableOthercompensation(tbOthercompensations, tbDescriptionstatement.getSumOthercompensation()); table.setSpacingBefore(25); document.add(table); createHeadlistBudwork(document, "2"); table = createtableAllowancesrental(tbAllowancesrentals, tbDescriptionstatement.getSumAllowancesrental()); table.setSpacingBefore(25); document.add(table); table = createtableGasolineDetail(tbGasolineDetails, tbDescriptionstatement.getSumGasoline()); table.setSpacingBefore(25); document.add(table); table = createtableRepairofequipment(tbRepairofequipments, tbDescriptionstatement.getSumRepairofequipment()); table.setSpacingBefore(25); document.add(table); table = createtableWageservice(tbWageservices, tbDescriptionstatement.getSumWageservice()); table.setSpacingBefore(25); document.add(table); table = createtableMeetingofthesnack(tbMeetingofthesnacks, tbDescriptionstatement.getSumMeetingofthesnack()); table.setSpacingBefore(25); document.add(table); table = createtableSocialsecurity(tbSocialsecuritys, tbDescriptionstatement.getSumSocialsecurity()); table.setSpacingBefore(25); document.add(table); table = createtableRentalproperty(tbRentalpropertys, tbDescriptionstatement.getSumRentalproperty()); table.setSpacingBefore(25); document.add(table); table = createtableThecertificationfood(tbThecertificationfoods, tbDescriptionstatement.getSumThecertificationfood()); table.setSpacingBefore(25); document.add(table); table = createtableThecertificationdrinks(tbThecertificationdrinks, tbDescriptionstatement.getSumThecertificationdrink()); table.setSpacingBefore(25); document.add(table); table = createtableThegift(tbThegifts, tbDescriptionstatement.getSumThegift()); table.setSpacingBefore(25); document.add(table); table = createtableTax(tbTaxs, tbDescriptionstatement.getSumTax()); table.setSpacingBefore(25); document.add(table); table = createtableFee(tbFees, tbDescriptionstatement.getSumFee()); table.setSpacingBefore(25); document.add(table); table = createtableInsurance(tbInsurances, tbDescriptionstatement.getSumInsurance()); table.setSpacingBefore(25); document.add(table); table = createtableEmploy(tbEmploys, tbDescriptionstatement.getSumEmploy()); table.setSpacingBefore(25); document.add(table); createHeadlistBudwork(document, "3"); table = createtableMaterial1(tbMaterials1, tbDescriptionstatement.getSumMOffice()); table.setSpacingBefore(25); document.add(table); table = createtableMaterial2(tbMaterials2, tbDescriptionstatement.getSumMBuild()); table.setSpacingBefore(25); document.add(table); table = createtableMaterial3(tbMaterials3, tbDescriptionstatement.getSumMKitchen()); table.setSpacingBefore(25); document.add(table); table = createtableMaterial4(tbMaterials4, tbDescriptionstatement.getSumMElectrical()); table.setSpacingBefore(25); document.add(table); table = createtableMaterial5(tbMaterials5, tbDescriptionstatement.getSumMMedic()); table.setSpacingBefore(25); document.add(table); table = createtableMaterial6(tbMaterials6, tbDescriptionstatement.getSumMStudy()); table.setSpacingBefore(25); document.add(table); table = createtableMaterial7(tbMaterials7, tbDescriptionstatement.getSumMBook()); table.setSpacingBefore(25); document.add(table); table = createtableMaterial8(tbMaterials8, tbDescriptionstatement.getSumMFarm()); table.setSpacingBefore(25); document.add(table); table = createtableMaterial9(tbMaterials9, tbDescriptionstatement.getSumMCom()); table.setSpacingBefore(25); document.add(table); table = createtableMaterial10(tbMaterials10, tbDescriptionstatement.getSumMMul()); table.setSpacingBefore(25); document.add(table); table = createtableMaterial11(tbMaterials11, tbDescriptionstatement.getSumMOther()); table.setSpacingBefore(25); document.add(table); createHeadlistBudwork(document, "4"); table = createtablePublicutility(tbPublicutilitys, tbDescriptionstatement.getSumPublicutility()); table.setSpacingBefore(25); document.add(table); document.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (DocumentException e) { e.printStackTrace(); } return document; } // formProjectttt public static Document createPDFFormProject(String file, TbFormProject tbFormProject, List<TbActivity> activity, List<TbDetailSka> detailSka, List<TbDetailSm> detailSms, TbFormSubproject subProject, TbTargetgroup target) throws Exception { Document document = null; try { document = new Document(); PdfWriter.getInstance(document, new FileOutputStream(file)); document.open(); addMetaData(document); addTitlePageProject(document); createPagePDFFormProject(document, tbFormProject, activity, detailSka, detailSms, subProject); PdfPTable table = createtableTargetGroup(target); document.add(table); table.setSpacingBefore(25); table = createtableTargetGroup2(target); table.setSpacingBefore(25); document.add(table); createPagePDFFormProject2(document, tbFormProject, activity, detailSka, detailSms, subProject); table = createtableFollowCheck(subProject); table.setSpacingBefore(25); document.add(table); table = createtablePro(tbFormProject); table.setSpacingBefore(25); document.add(table); createPagePDFFormProject3(document, tbFormProject, activity, detailSka, detailSms, subProject); document.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (DocumentException e) { e.printStackTrace(); } return document; } // formProjectttt public static Document createPDFActivity(String file, Long activityId) throws Exception { Document document = null; try { document = new Document(); PdfWriter.getInstance(document, new FileOutputStream(file)); document.open(); addMetaData(document); addTitlePageProject(document); Paragraph created = new Paragraph(); created.setFont(TIME_ROMAN_SMALL); created.add(activityId.toString()); created.setAlignment(Element.ALIGN_RIGHT); document.add(created); document.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (DocumentException e) { e.printStackTrace(); } return document; } private static void addMetaData(Document document) { document.addTitle("Generate PDF report"); document.addSubject("Generate PDF report"); document.addAuthor("Java Honk"); document.addCreator("Java Honk"); } private static void addTitlePage(Document document) throws DocumentException, IOException { Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED)); font.setSize(24); String imagepath = "src/main/webapp/resources/images/curt.gif"; Image img = Image.getInstance(imagepath); img.scaleToFit(70f, 70f); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MM/dd/yyyy"); Paragraph created = new Paragraph(); created.setFont(TIME_ROMAN_SMALL); created.add("Report created on " + simpleDateFormat.format(new Date())); created.setAlignment(Element.ALIGN_RIGHT); Paragraph logo = new Paragraph(); logo.setFont(TIME_ROMAN_SMALL); logo.add(img); logo.setAlignment(Element.ALIGN_LEFT); document.add(created); document.add(logo); // Paragraph created = new Paragraph(); // created.setFont(TIME_ROMAN_SMALL); // created.add("Report created on " + simpleDateFormat.format(new // Date())); // created.setAlignment(Element.ALIGN_RIGHT); Paragraph paragraph = new Paragraph(); paragraph.setFont(font); paragraph.add("FormProject "); paragraph.setAlignment(Element.ALIGN_CENTER); document.add(paragraph); creteEmptyLine(created, 1); } private static void creteEmptyLine(Paragraph paragraph, int number) { for (int i = 0; i < number; i++) { paragraph.add(new Paragraph(" ")); } } private static void creteLine(Paragraph paragraph, int number) { for (int i = 0; i < number; i++) { paragraph.add( new Paragraph("_____________________________________________________________________________")); } } private static void createTable(Document document) throws DocumentException, IOException { Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED)); font.setSize(16); Paragraph paragraph = new Paragraph(); paragraph.setFont(font); creteEmptyLine(paragraph, 2); document.add(paragraph); PdfPTable table = new PdfPTable(7); paragraph.add(""); PdfPCell c1 = new PdfPCell(new Phrase("asasas", font)); c1.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(c1); c1 = new PdfPCell(new Phrase("/?", font)); c1.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(c1); c1 = new PdfPCell(new Phrase("?", font)); c1.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(c1); TbActivity ac = new TbActivity(); c1 = new PdfPCell(new Phrase("", font)); c1.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(c1); c1 = new PdfPCell(new Phrase("", font)); c1.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(c1); c1 = new PdfPCell(new Phrase("", font)); c1.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(c1); c1 = new PdfPCell(new Phrase("", font)); c1.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(c1); table.setHeaderRows(1); paragraph.add(""); for (int i = 0; i < 7; i++) { table.setWidthPercentage(100); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE); table.addCell(paragraph); } document.add(table); } // FormProject private static void createPagePDFFormProject(Document document, TbFormProject tbFormProject, List<TbActivity> activity, List<TbDetailSka> detailSka, List<TbDetailSm> detailSms, TbFormSubproject subProject) throws DocumentException, IOException { Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED)); font.setSize(16); int acNo = 0; Paragraph openning = new Paragraph(); Paragraph ska = new Paragraph(); Paragraph sms = new Paragraph(); Paragraph notice = new Paragraph(); Paragraph address = new Paragraph(); Paragraph readyTodo = new Paragraph(); readyTodo.setFont(font); address.setFont(font); ska.setFont(font); sms.setFont(font); notice.setFont(font); openning.setFont(font); openning.add(" : " + tbFormProject.getTbFaculty().getFacultyName()); creteEmptyLine(openning, 1); openning.add("?" + tbFormProject.getTbStrBud().getStrBudName()); creteEmptyLine(openning, 1); openning.add("? : " + tbFormProject.getTbPlan().getPlansName()); creteEmptyLine(openning, 1); openning.add("? : " + tbFormProject.getTbStrMin().getStrMinName()); creteEmptyLine(openning, 1); openning.add("? : " + tbFormProject.getTbMisUni().getMisUniName()); creteEmptyLine(openning, 1); openning.add(" : " + tbFormProject.getTbSubUni().getSubUniName()); creteEmptyLine(openning, 1); openning.add("? : " + tbFormProject.getTbProduct().getProductName()); creteEmptyLine(openning, 1); openning.add( "? : " + tbFormProject.getTbProjectname().getProjectnameName()); creteEmptyLine(openning, 1); openning.add("? : " + tbFormProject.getTbPerson().getPersonName() + " " + tbFormProject.getTbPerson().getPersonLastname()); creteEmptyLine(openning, 1); openning.add(" : " + tbFormProject.getTotal()); creteEmptyLine(openning, 1); openning.add("? : " + tbFormProject.getAllocateMoney()); creteEmptyLine(openning, 1); openning.add(" : " + (Long.parseLong(tbFormProject.getAllocateMoney()) - Long.parseLong(tbFormProject.getMoneyBalance()))); creteEmptyLine(openning, 1); openning.add(" : " + tbFormProject.getMoneyBalance()); creteLine(openning, 1); creteEmptyLine(openning, 1); for (TbActivity ac : activity) { acNo++; openning.add("??" + acNo + ":" + ac.getActivityName() + "?? : " + ac.getAddressName()); creteEmptyLine(openning, 1); openning.add("?? : " + ac.getStartdate() + "?? : " + ac.getEnddate()); creteEmptyLine(openning, 1); openning.add("? : " + ac.getAllocateMoney() + " : " + ac.getMoneyBalance()); creteEmptyLine(openning, 1); openning.add(" : " + (Long.parseLong(ac.getAllocateMoney()) - Long.parseLong(ac.getMoneyBalance()))); creteLine(openning, 1); creteEmptyLine(openning, 1); } ska.add(" ?? (?)"); creteEmptyLine(ska, 1); for (TbDetailSka de : detailSka) { ska.add(de.getTbSkaType().getSkaTypeName() + " : " + de.getTbSkaIndicatorsFac().getSkaIndicatorsFacName() + " : " + de.getTbSkaIndicatorsHouse().getSkaIndicatorsHouseName()); creteEmptyLine(ska, 1); } sms.add(" ??? ()"); creteEmptyLine(sms, 1); for (TbDetailSm sm : detailSms) { sms.add(sm.getTbSmsCategory().getSmsCategoryName() + " " + " " + sm.getTbSmsIndicator().getSmsIndicatorsName()); creteEmptyLine(sms, 1); } notice.add( " : ??????? ?????? "); creteEmptyLine(notice, 1); address.add("? : " + " : " + subProject.getTbAmphur().getAmphurTh() + " : " + subProject.getTbProvince().getProvinceTh()); creteEmptyLine(address, 1); readyTodo.add("?"); creteEmptyLine(readyTodo, 1); readyTodo.add("? : " + subProject.getTbApproPlaceType().getApproPlaceTypeName()); creteEmptyLine(readyTodo, 1); readyTodo.add("?/ : " + subProject.getTbApproPoint1().getApproPointName()); creteEmptyLine(readyTodo, 1); readyTodo.add("/? : " + subProject.getTbApproPoint2().getApproPointName()); creteEmptyLine(readyTodo, 1); readyTodo.add("?? : " + subProject.getTbApproProjectType().getApproProjectTypeName()); creteEmptyLine(readyTodo, 1); document.add(openning); document.add(ska); document.add(sms); document.add(notice); document.add(address); document.add(readyTodo); } public static PdfPTable createtableTargetGroup(TbTargetgroup targetGroup) throws DocumentException, Exception { Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED)); font.setSize(16); PdfPTable table = new PdfPTable(3); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell = new PdfPCell(new Phrase("? ", font)); cell.setColspan(5); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("?()", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase( " ()", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); table.addCell(new PdfPCell(new Phrase("", font))); table.addCell(new PdfPCell(new Phrase(targetGroup.getJooutMana(), font))); table.addCell(new PdfPCell(new Phrase(targetGroup.getJoinMana(), font))); table.addCell(new PdfPCell(new Phrase("", font))); table.addCell(new PdfPCell(new Phrase(targetGroup.getJooutTeach(), font))); table.addCell(new PdfPCell(new Phrase(targetGroup.getJoinTeach(), font))); table.addCell(new PdfPCell(new Phrase("", font))); table.addCell(new PdfPCell(new Phrase(targetGroup.getJooutEmp(), font))); table.addCell(new PdfPCell(new Phrase(targetGroup.getJoinEmp(), font))); table.addCell(new PdfPCell(new Phrase("??", font))); table.addCell(new PdfPCell(new Phrase(targetGroup.getJooutStu(), font))); table.addCell(new PdfPCell(new Phrase(targetGroup.getJoinStu(), font))); table.addCell(new PdfPCell(new Phrase("/?", font))); table.addCell(new PdfPCell(new Phrase(targetGroup.getJooutCommu(), font))); table.addCell(new PdfPCell(new Phrase(targetGroup.getJoinCommu(), font))); table.addCell( new PdfPCell(new Phrase("?/?", font))); table.addCell(new PdfPCell(new Phrase(targetGroup.getJooutDisable(), font))); table.addCell(new PdfPCell(new Phrase(targetGroup.getJoinDisable(), font))); table.addCell(new PdfPCell(new Phrase("", font))); table.addCell(new PdfPCell(new Phrase(targetGroup.getJooutOther(), font))); table.addCell(new PdfPCell(new Phrase(targetGroup.getJoinOther(), font))); return table; } public static PdfPTable createtableTargetGroup2(TbTargetgroup targetGroup) throws DocumentException, Exception { Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED)); font.setSize(16); PdfPTable table = new PdfPTable(3); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell = new PdfPCell(new Phrase("?", font)); cell.setColspan(5); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("?()", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase( " ()", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); table.addCell(new PdfPCell(new Phrase("", font))); table.addCell(new PdfPCell(new Phrase(targetGroup.getActoutMana(), font))); table.addCell(new PdfPCell(new Phrase(targetGroup.getActinMana(), font))); table.addCell(new PdfPCell(new Phrase("", font))); table.addCell(new PdfPCell(new Phrase(targetGroup.getActoutTeach(), font))); table.addCell(new PdfPCell(new Phrase(targetGroup.getActinTeach(), font))); table.addCell(new PdfPCell(new Phrase("", font))); table.addCell(new PdfPCell(new Phrase(targetGroup.getActoutEmp(), font))); table.addCell(new PdfPCell(new Phrase(targetGroup.getActinEmp(), font))); table.addCell(new PdfPCell(new Phrase("??", font))); table.addCell(new PdfPCell(new Phrase(targetGroup.getActoutStu(), font))); table.addCell(new PdfPCell(new Phrase(targetGroup.getJoinStu(), font))); table.addCell(new PdfPCell(new Phrase("?", font))); table.addCell(new PdfPCell(new Phrase(targetGroup.getActoutLect(), font))); table.addCell(new PdfPCell(new Phrase(targetGroup.getActinLect(), font))); return table; } // FormProject private static void createPagePDFFormProject2(Document document, TbFormProject tbFormProject, List<TbActivity> activity, List<TbDetailSka> detailSka, List<TbDetailSm> detailSms, TbFormSubproject subProject) throws DocumentException, IOException { Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED)); font.setSize(16); Paragraph openning = new Paragraph(); openning.setFont(font); creteLine(openning, 1); openning.add("??? "); creteEmptyLine(openning, 1); openning.add("????"); creteEmptyLine(openning, 1); openning.add("??? : " + subProject.getTbMonth1().getMonthLong()); creteEmptyLine(openning, 1); openning.add( "? : " + subProject.getTbMonth2().getMonthLong()); creteEmptyLine(openning, 1); openning.add( "??????? : " + subProject.getTbMonth3().getMonthLong()); creteEmptyLine(openning, 1); openning.add("??"); creteEmptyLine(openning, 1); openning.add( "? ???? : " + subProject.getTbMonth4().getMonthLong()); creteEmptyLine(openning, 1); openning.add( "??? : " + subProject.getTbMonth5().getMonthLong()); creteEmptyLine(openning, 1); openning.add( "//????? : " + subProject.getTbMonth6().getMonthLong()); creteEmptyLine(openning, 1); openning.add( "??? : ( 3 ?) : " + subProject.getWorkflowPlanBudget()); creteLine(openning, 1); creteEmptyLine(openning, 1); document.add(openning); } public static PdfPTable createtableFollowCheck(TbFormSubproject subProject) throws DocumentException, Exception { Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED)); font.setSize(16); PdfPTable table = new PdfPTable(3); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell = new PdfPCell(new Phrase( "?? (C_Check)", font)); cell.setColspan(3); table.addCell(cell); cell = new PdfPCell(new Phrase("?", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase( "??", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("?", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); table.addCell(new PdfPCell(new Phrase( "????", font))); table.addCell(new PdfPCell(new Phrase(subProject.getFollowCCheckTool(), font))); table.addCell(new PdfPCell(new Phrase(subProject.getFollowCCheckTime(), font))); table.addCell(new PdfPCell(new Phrase( "??", font))); table.addCell(new PdfPCell(new Phrase(subProject.getAssesCCheckTool(), font))); table.addCell(new PdfPCell(new Phrase(subProject.getAssesCCheckTime(), font))); table.addCell(new PdfPCell(new Phrase( "?? /", font))); table.addCell(new PdfPCell(new Phrase(subProject.getFollowInCCheckTool(), font))); table.addCell(new PdfPCell(new Phrase(subProject.getFollowInCCheckTime(), font))); return table; } public static PdfPTable createtablePro(TbFormProject tbFormProject) throws DocumentException, Exception { Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED)); font.setSize(16); PdfPTable table = new PdfPTable(5); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell = new PdfPCell(new Phrase( "/ :/", font)); cell.setColspan(5); table.addCell(cell); cell = new PdfPCell( new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); table.addCell(new PdfPCell(new Phrase("", font))); table.addCell(new PdfPCell(new Phrase(tbFormProject.getProQuantitative(), font))); table.addCell(new PdfPCell(new Phrase(tbFormProject.getProQualitative(), font))); table.addCell(new PdfPCell(new Phrase(tbFormProject.getProTiming(), font))); table.addCell(new PdfPCell(new Phrase(tbFormProject.getProCost(), font))); table.addCell(new PdfPCell(new Phrase("", font))); table.addCell(new PdfPCell(new Phrase(tbFormProject.getAnsQuantitative(), font))); table.addCell(new PdfPCell(new Phrase(tbFormProject.getAnsQualtitative(), font))); table.addCell(new PdfPCell(new Phrase(tbFormProject.getAnsTiming(), font))); table.addCell(new PdfPCell(new Phrase(tbFormProject.getAnsCost(), font))); return table; } private static void createPagePDFFormProject3(Document document, TbFormProject tbFormProject, List<TbActivity> activity, List<TbDetailSka> detailSka, List<TbDetailSm> detailSms, TbFormSubproject subProject) throws DocumentException, IOException { Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED)); font.setSize(16); Paragraph openning = new Paragraph(); openning.setFont(font); creteLine(openning, 1); creteEmptyLine(openning, 1); openning.add( "(?????)"); creteEmptyLine(openning, 1); openning.add(": " + tbFormProject.getResults()); creteEmptyLine(openning, 1); openning.add( "?/ ? ()"); creteEmptyLine(openning, 1); openning.add(": " + tbFormProject.getProblem()); creteEmptyLine(openning, 1); openning.add( "??/? ()"); creteEmptyLine(openning, 1); openning.add(": " + tbFormProject.getDevelopmentPlan()); creteEmptyLine(openning, 1); openning.add( "???"); creteEmptyLine(openning, 1); document.add(openning); openning.add( "?? (???? ? ? ??? ?? ?)"); creteEmptyLine(openning, 1); openning.add(": " + tbFormProject.getRiskPolitics()); creteEmptyLine(openning, 1); openning.add( "????/?"); creteEmptyLine(openning, 1); openning.add(": " + tbFormProject.getRiskDefPolitics()); creteLine(openning, 1); creteEmptyLine(openning, 1); openning.add( "??/? (??? ?/? /?? ?? ?)"); creteEmptyLine(openning, 1); openning.add(": " + tbFormProject.getRiskPolicy()); creteEmptyLine(openning, 1); openning.add( "????/?"); creteEmptyLine(openning, 1); openning.add(": " + tbFormProject.getRiskDefPolicy()); creteLine(openning, 1); creteEmptyLine(openning, 1); openning.add( "??? (? ??? ? ? ??)"); creteEmptyLine(openning, 1); openning.add(": " + tbFormProject.getRiskWorkflow()); creteEmptyLine(openning, 1); openning.add( "????/?"); creteEmptyLine(openning, 1); openning.add(": " + tbFormProject.getRiskDefWorkflow()); creteLine(openning, 1); creteEmptyLine(openning, 1); openning.add( "???? (? ?? ?????)"); creteEmptyLine(openning, 1); openning.add(": " + tbFormProject.getRiskFinance()); creteEmptyLine(openning, 1); openning.add( "????/?"); creteEmptyLine(openning, 1); openning.add(": " + tbFormProject.getRiskDefFinance()); creteLine(openning, 1); creteEmptyLine(openning, 1); openning.add( " (? ???)"); creteEmptyLine(openning, 1); openning.add(": " + tbFormProject.getRiskTechnology()); creteEmptyLine(openning, 1); openning.add( "????/?"); creteEmptyLine(openning, 1); openning.add(": " + tbFormProject.getRiskDefTechnology()); creteLine(openning, 1); creteEmptyLine(openning, 1); openning.add( "? (????? ?)"); creteEmptyLine(openning, 1); openning.add(": " + tbFormProject.getRiskEnvironment()); creteEmptyLine(openning, 1); openning.add( "????/?"); creteEmptyLine(openning, 1); openning.add(": " + tbFormProject.getRiskDefEnvironment()); creteLine(openning, 1); creteEmptyLine(openning, 1); document.add(openning); } private static void addTitlePageProject(Document document) throws DocumentException, IOException { Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED)); font.setSize(24); String imagepath = "src/main/webapp/resources/images/logo.jpg"; Image img = Image.getInstance(imagepath); img.scaleToFit(70f, 70f); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MM/dd/yyyy"); Paragraph created = new Paragraph(); created.setFont(TIME_ROMAN_SMALL); created.add("Report created on " + simpleDateFormat.format(new Date())); created.setAlignment(Element.ALIGN_RIGHT); Paragraph logo = new Paragraph(); logo.setFont(TIME_ROMAN_SMALL); logo.add(img); logo.setAlignment(Element.ALIGN_LEFT); document.add(created); document.add(logo); // Paragraph created = new Paragraph(); // created.setFont(TIME_ROMAN_SMALL); // created.add("Report created on " + simpleDateFormat.format(new // Date())); // created.setAlignment(Element.ALIGN_RIGHT); Paragraph paragraph = new Paragraph(); paragraph.setFont(font); paragraph.add( "??"); paragraph.setAlignment(Element.ALIGN_CENTER); document.add(paragraph); creteEmptyLine(created, 1); } // Budwork private static void createPagePDFBudwork(Document document, TbDescriptionstatement tbDescriptionstatement) throws DocumentException, IOException { Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED)); font.setSize(16); Paragraph title = new Paragraph(); title.setFont(font); creteEmptyLine(title, 1); title.setFont(font); title.add(": " + tbDescriptionstatement.getTbBudget().getBudgetName()); creteEmptyLine(title, 1); title.add(": " + tbDescriptionstatement.getTbYear().getYearValue()); creteEmptyLine(title, 1); title.add(": " + tbDescriptionstatement.getTbFaculty().getFacultyName()); creteEmptyLine(title, 1); title.add( ": " + tbDescriptionstatement.getTbFaculty().getTbCampus().getCampusName()); creteEmptyLine(title, 1); title.add(" : " + tbDescriptionstatement.getTbProduct().getProductName()); creteEmptyLine(title, 1); title.add(": " + tbDescriptionstatement.getTbBudgetType().getBdTypeName()); creteEmptyLine(title, 1); title.add(": " + tbDescriptionstatement.getTotal() + " "); creteEmptyLine(title, 1); /* * title.add(": " + * tbDescriptionstatement.getAllocateMoney() + " "); * creteEmptyLine(title, 1); title.add(": " * + (Integer.parseInt(tbDescriptionstatement.getAllocateMoney()) - * Integer.parseInt(tbDescriptionstatement.getMoneyBalance())) + " " * ); creteEmptyLine(title, 1); title.add(": " + * tbDescriptionstatement.getMoneyBalance() + " "); * creteEmptyLine(title, 1); */ document.add(title); } // Budwork private static void createHeadlistBudwork(Document document, String check) throws DocumentException, IOException { Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED)); font.setSize(18); Paragraph title = new Paragraph(); title.setFont(font); creteEmptyLine(title, 1); if (check == "1") { title.add("1. ?"); } else if (check == "2") { title.add("2. "); } else if (check == "3") { title.add("3. "); } else if (check == "4") { title.add("4. "); } creteLine(title, 1); creteEmptyLine(title, 1); document.add(title); } private static void addTitlePageBud(Document document) throws DocumentException, IOException { Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED)); font.setSize(24); String imagepath = "src/main/webapp/resources/images/logo.jpg"; Image img = Image.getInstance(imagepath); img.scaleToFit(70f, 70f); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MM/dd/yyyy"); Paragraph created = new Paragraph(); created.setFont(TIME_ROMAN_SMALL); created.add("Report created on " + simpleDateFormat.format(new Date())); created.setAlignment(Element.ALIGN_RIGHT); Paragraph logo = new Paragraph(); logo.setFont(TIME_ROMAN_SMALL); logo.add(img); logo.setAlignment(Element.ALIGN_LEFT); document.add(created); document.add(logo); // Paragraph created = new Paragraph(); // created.setFont(TIME_ROMAN_SMALL); // created.add("Report created on " + simpleDateFormat.format(new // Date())); // created.setAlignment(Element.ALIGN_RIGHT); Paragraph paragraph = new Paragraph(); paragraph.setFont(font); paragraph.add( "?"); paragraph.setAlignment(Element.ALIGN_CENTER); document.add(paragraph); creteEmptyLine(created, 1); } // table tbAddmoneyvaras public static PdfPTable createtableAddmoneyvara(List<TbAddmoneyvara> tbAddmoneyvaras, String getSumAddmoneyvara) throws DocumentException, Exception { Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED)); font.setSize(16); PdfPTable table = new PdfPTable(5); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell = new PdfPCell(new Phrase( "1.1 ? () ??? ", font)); cell.setColspan(5); table.addCell(cell); cell = new PdfPCell( new Phrase(" = " + getSumAddmoneyvara + " ", font)); cell.setColspan(5); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("-?", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("?", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase(" /", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase(" / ", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); int count = 0; for (TbAddmoneyvara items : tbAddmoneyvaras) { count++; table.addCell(new PdfPCell(new Phrase(String.valueOf(count), font))); table.addCell(new PdfPCell(new Phrase( items.getTbPerson().getPersonName() + " " + items.getTbPerson().getPersonLastname(), font))); table.addCell(new PdfPCell(new Phrase(items.getAddmvaraDate().toString(), font))); table.addCell(new PdfPCell(new Phrase(items.getAddmvaraPrice(), font))); table.addCell(new PdfPCell(new Phrase(items.getAddmvaraSum(), font))); } return table; } // table tbAddmoneynovaras public static PdfPTable createtableAddmoneynovara(List<TbAddmoneynovara> tbAddmoneynovaras, String getSumAddmoneynovara) throws DocumentException, Exception { Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED)); font.setSize(16); PdfPTable table = new PdfPTable(5); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell = new PdfPCell(new Phrase( "1.2 ? () ??? ", font)); cell.setColspan(5); table.addCell(cell); cell = new PdfPCell( new Phrase(" = " + getSumAddmoneynovara + " ", font)); cell.setColspan(5); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("-?", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("?", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase(" /", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase(" / ", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); int count = 0; for (TbAddmoneynovara items : tbAddmoneynovaras) { count++; table.addCell(new PdfPCell(new Phrase(String.valueOf(count), font))); table.addCell(new PdfPCell(new Phrase( items.getTbPerson().getPersonName() + " " + items.getTbPerson().getPersonLastname(), font))); table.addCell(new PdfPCell(new Phrase(items.getAddmnovaraDate().toString(), font))); table.addCell(new PdfPCell(new Phrase(items.getAddmnovaraPrice(), font))); table.addCell(new PdfPCell(new Phrase(items.getAddmnovaraSum(), font))); } return table; } // table tbRemunerationcommittees public static PdfPTable createtableRemunerationcommittee(List<TbRemunerationcommittee> tbRemunerationcommittees, String getSumRemunerationcommittees) throws DocumentException, Exception { Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED)); font.setSize(16); PdfPTable table = new PdfPTable(6); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell = new PdfPCell( new Phrase("1.3?? ", font)); cell.setColspan(6); table.addCell(cell); cell = new PdfPCell(new Phrase( " = " + getSumRemunerationcommittees + " ", font)); cell.setColspan(6); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("??", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); int count = 0; for (TbRemunerationcommittee items : tbRemunerationcommittees) { count++; table.addCell(new PdfPCell(new Phrase(String.valueOf(count), font))); table.addCell(new PdfPCell(new Phrase(items.getRemunQty(), font))); table.addCell(new PdfPCell(new Phrase(items.getRemunPrice(), font))); table.addCell(new PdfPCell(new Phrase(items.getRemunTime(), font))); table.addCell(new PdfPCell(new Phrase(items.getRemunSum(), font))); table.addCell(new PdfPCell(new Phrase(items.getRemunRemark(), font))); } return table; } // table tbMaketimeformeals public static PdfPTable createtableMaketimeformeal(List<TbMaketimeformeal> tbMaketimeformeals, String getSumMaketimeformeals) throws DocumentException, Exception { Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED)); font.setSize(16); PdfPTable table = new PdfPTable(7); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell = new PdfPCell( new Phrase("1.4 ??", font)); cell.setColspan(7); table.addCell(cell); cell = new PdfPCell( new Phrase(" = " + getSumMaketimeformeals + " ", font)); cell.setColspan(7); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("??", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); int count = 0; for (TbMaketimeformeal items : tbMaketimeformeals) { count++; table.addCell(new PdfPCell(new Phrase(String.valueOf(count), font))); table.addCell(new PdfPCell(new Phrase(items.getWork(), font))); table.addCell(new PdfPCell(new Phrase(items.getJobovertime(), font))); table.addCell(new PdfPCell(new Phrase(items.getPerformerquantityperson(), font))); table.addCell(new PdfPCell(new Phrase(items.getPerformerquantityday(), font))); table.addCell(new PdfPCell(new Phrase(items.getPerformerquantitymoney(), font))); table.addCell(new PdfPCell(new Phrase(items.getPerformerquantitymoneytotal(), font))); } return table; } // table tbRentshouses public static PdfPTable createtableRentshouse(List<TbRentshouse> tbRentshouses, String getSumRentshouses) throws DocumentException, Exception { Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED)); font.setSize(16); PdfPTable table = new PdfPTable(4); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell = new PdfPCell(new Phrase("1.5 ", font)); cell.setColspan(4); table.addCell(cell); cell = new PdfPCell( new Phrase(" = " + getSumRentshouses + " ", font)); cell.setColspan(4); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase(" - ?", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("/", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase(" / ", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); int count = 0; for (TbRentshouse items : tbRentshouses) { count++; table.addCell(new PdfPCell(new Phrase(String.valueOf(count), font))); table.addCell(new PdfPCell(new Phrase( items.getTbPerson().getPersonName() + " " + items.getTbPerson().getPersonLastname(), font))); table.addCell(new PdfPCell(new Phrase(items.getRentshousePrice(), font))); table.addCell(new PdfPCell(new Phrase(items.getRentshouseSum(), font))); } return table; } // table tbTeachextras public static PdfPTable createtableTeachextra(List<TbTeachextra> tbTeachextras, String getSumTeachextra) throws DocumentException, Exception { Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED)); font.setSize(16); PdfPTable table = new PdfPTable(6); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell = new PdfPCell(new Phrase( "1.6 ??? ()", font)); cell.setColspan(6); table.addCell(cell); cell = new PdfPCell( new Phrase(" = " + getSumTeachextra + " ", font)); cell.setColspan(6); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); int count = 0; for (TbTeachextra items : tbTeachextras) { count++; table.addCell(new PdfPCell(new Phrase(String.valueOf(count), font))); table.addCell(new PdfPCell(new Phrase(items.getTtPerson(), font))); table.addCell(new PdfPCell(new Phrase(items.getTtHour(), font))); table.addCell(new PdfPCell(new Phrase(items.getTtWeek(), font))); table.addCell(new PdfPCell(new Phrase(items.getTtBath(), font))); table.addCell(new PdfPCell(new Phrase(items.getTtSum(), font))); } return table; } // table tbExpenpapers public static PdfPTable createtableExpenpaper(List<TbExpenpaper> tbExpenpapers, String getSum) throws DocumentException, Exception { Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED)); font.setSize(16); PdfPTable table = new PdfPTable(5); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell = new PdfPCell(new Phrase( "1.6 ??? (?)", font)); cell.setColspan(5); table.addCell(cell); cell = new PdfPCell(new Phrase(" = " + getSum + " ", font)); cell.setColspan(5); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); int count = 0; for (TbExpenpaper items : tbExpenpapers) { count++; table.addCell(new PdfPCell(new Phrase(String.valueOf(count), font))); table.addCell(new PdfPCell(new Phrase(items.getEpQty(), font))); table.addCell(new PdfPCell(new Phrase(items.getEpMany(), font))); table.addCell(new PdfPCell(new Phrase(items.getEpPrice(), font))); table.addCell(new PdfPCell(new Phrase(items.getEpSum(), font))); } return table; } // table tbComlecturers public static PdfPTable createtableComlecturer(List<TbComlecturer> tbComlecturers, String getSum) throws DocumentException, Exception { Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED)); font.setSize(16); PdfPTable table = new PdfPTable(6); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell = new PdfPCell(new Phrase( "1.6 ??? (?????)", font)); cell.setColspan(6); table.addCell(cell); cell = new PdfPCell(new Phrase(" = " + getSum + " ", font)); cell.setColspan(6); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("??", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); int count = 0; for (TbComlecturer items : tbComlecturers) { count++; table.addCell(new PdfPCell(new Phrase(String.valueOf(count), font))); table.addCell(new PdfPCell(new Phrase(items.getClTopic(), font))); table.addCell(new PdfPCell(new Phrase(items.getClPerson(), font))); table.addCell(new PdfPCell(new Phrase(items.getClMany(), font))); table.addCell(new PdfPCell(new Phrase(items.getClBath(), font))); table.addCell(new PdfPCell(new Phrase(items.getClSum(), font))); } return table; } // table tbOthercompensations public static PdfPTable createtableOthercompensation(List<TbOthercompensation> tbOthercompensations, String getSum) throws DocumentException, Exception { Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED)); font.setSize(16); PdfPTable table = new PdfPTable(4); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell = new PdfPCell(new Phrase("1.7 ?", font)); cell.setColspan(4); table.addCell(cell); cell = new PdfPCell(new Phrase(" = " + getSum + " ", font)); cell.setColspan(4); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("?", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("?", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); int count = 0; for (TbOthercompensation items : tbOthercompensations) { count++; table.addCell(new PdfPCell(new Phrase(String.valueOf(count), font))); table.addCell(new PdfPCell(new Phrase(items.getMoney(), font))); table.addCell(new PdfPCell(new Phrase(items.getDetail(), font))); table.addCell(new PdfPCell(new Phrase(items.getCalculation(), font))); } return table; } // table tbAllowancesrentals public static PdfPTable createtableAllowancesrental(List<TbAllowancesrental> tbAllowancesrentals, String getSum) throws DocumentException, Exception { Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED)); font.setSize(16); PdfPTable table = new PdfPTable(6); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell = new PdfPCell(new Phrase( "2.1 ??", font)); cell.setColspan(6); table.addCell(cell); cell = new PdfPCell(new Phrase(" = " + getSum + " ", font)); cell.setColspan(6); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("?", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); int count = 0; for (TbAllowancesrental items : tbAllowancesrentals) { count++; table.addCell(new PdfPCell(new Phrase(String.valueOf(count), font))); table.addCell(new PdfPCell(new Phrase(items.getAllowancesmoneytotal(), font))); table.addCell(new PdfPCell(new Phrase(items.getAccommodationmoneytotal(), font))); table.addCell(new PdfPCell(new Phrase(items.getTravelingexpensesmoneytotal(), font))); table.addCell(new PdfPCell(new Phrase(items.getRemark(), font))); table.addCell(new PdfPCell(new Phrase(items.getSum(), font))); } return table; } // table tbGasolineDetails public static PdfPTable createtableGasolineDetail(List<TbGasolineDetail> tbGasolineDetails, String getSum) throws DocumentException, Exception { Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED)); font.setSize(16); PdfPTable table = new PdfPTable(6); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell = new PdfPCell(new Phrase( "2.2 ??", font)); cell.setColspan(6); table.addCell(cell); cell = new PdfPCell(new Phrase(" = " + getSum + " ", font)); cell.setColspan(6); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("/", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("/", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("/", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); int count = 0; for (TbGasolineDetail items : tbGasolineDetails) { count++; table.addCell(new PdfPCell(new Phrase(String.valueOf(count), font))); table.addCell(new PdfPCell(new Phrase(items.getTbcar().getCarNumberlicense(), font))); table.addCell(new PdfPCell(new Phrase(items.getTbCarStatus().getCarStatusName(), font))); table.addCell(new PdfPCell(new Phrase(items.getPriceRepaircar(), font))); table.addCell(new PdfPCell(new Phrase(items.getPriceGasoline(), font))); table.addCell(new PdfPCell(new Phrase(items.getTotal(), font))); } return table; } // table tbRepairofequipments public static PdfPTable createtableRepairofequipment(List<TbRepairofequipment> tbRepairofequipments, String getSum) throws DocumentException, Exception { Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED)); font.setSize(16); PdfPTable table = new PdfPTable(5); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell = new PdfPCell( new Phrase("2.3 ?", font)); cell.setColspan(5); table.addCell(cell); cell = new PdfPCell(new Phrase(" = " + getSum + " ", font)); cell.setColspan(5); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("?", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); int count = 0; for (TbRepairofequipment items : tbRepairofequipments) { count++; table.addCell(new PdfPCell(new Phrase(String.valueOf(count), font))); table.addCell(new PdfPCell(new Phrase(items.getDetail(), font))); table.addCell(new PdfPCell(new Phrase(items.getQuantity(), font))); table.addCell(new PdfPCell(new Phrase(items.getPrice(), font))); table.addCell(new PdfPCell(new Phrase(items.getTotal(), font))); } return table; } // table tbWageservices public static PdfPTable createtableWageservice(List<TbWageservice> tbWageservices, String getSum) throws DocumentException, Exception { Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED)); font.setSize(16); PdfPTable table = new PdfPTable(5); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell = new PdfPCell(new Phrase("2.4 ?", font)); cell.setColspan(5); table.addCell(cell); cell = new PdfPCell(new Phrase(" = " + getSum + " ", font)); cell.setColspan(5); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("?", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); int count = 0; for (TbWageservice items : tbWageservices) { count++; table.addCell(new PdfPCell(new Phrase(String.valueOf(count), font))); table.addCell(new PdfPCell(new Phrase(items.getDetail(), font))); table.addCell(new PdfPCell(new Phrase(items.getChartertime_(), font))); table.addCell(new PdfPCell(new Phrase(items.getChartermoney(), font))); table.addCell(new PdfPCell(new Phrase(items.getMoneytotal(), font))); } return table; } // table tbMeetingofthesnacks public static PdfPTable createtableMeetingofthesnack(List<TbMeetingofthesnack> tbMeetingofthesnacks, String getSum) throws DocumentException, Exception { Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED)); font.setSize(16); PdfPTable table = new PdfPTable(6); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell = new PdfPCell(new Phrase("2.5", font)); cell.setColspan(6); table.addCell(cell); cell = new PdfPCell(new Phrase(" = " + getSum + " ", font)); cell.setColspan(6); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); int count = 0; for (TbMeetingofthesnack items : tbMeetingofthesnacks) { count++; table.addCell(new PdfPCell(new Phrase(String.valueOf(count), font))); table.addCell(new PdfPCell(new Phrase(items.getMeetingofthesnackmoney(), font))); table.addCell(new PdfPCell(new Phrase(items.getQuantityperson(), font))); table.addCell(new PdfPCell(new Phrase(items.getQuantitymoney(), font))); table.addCell(new PdfPCell(new Phrase(items.getQuantitytime(), font))); table.addCell(new PdfPCell(new Phrase(items.getMoneytotal(), font))); } return table; } // table tbSocialsecuritys public static PdfPTable createtableSocialsecurity(List<TbSocialsecurity> tbSocialsecuritys, String getSum) throws DocumentException, Exception { Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED)); font.setSize(16); PdfPTable table = new PdfPTable(3); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell = new PdfPCell(new Phrase( "2.6 ? ( 5% )", font)); cell.setColspan(3); table.addCell(cell); cell = new PdfPCell(new Phrase(" = " + getSum + " ", font)); cell.setColspan(3); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell( new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); int count = 0; for (TbSocialsecurity items : tbSocialsecuritys) { count++; table.addCell(new PdfPCell(new Phrase(String.valueOf(count), font))); table.addCell(new PdfPCell(new Phrase(items.getPrice(), font))); table.addCell(new PdfPCell(new Phrase(items.getTotal(), font))); } return table; } // table tbRentalpropertys public static PdfPTable createtableRentalproperty(List<TbRentalproperty> tbRentalpropertys, String getSum) throws DocumentException, Exception { Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED)); font.setSize(16); PdfPTable table = new PdfPTable(4); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell = new PdfPCell(new Phrase("2.7 ", font)); cell.setColspan(4); table.addCell(cell); cell = new PdfPCell(new Phrase(" = " + getSum + " ", font)); cell.setColspan(4); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("?", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); int count = 0; for (TbRentalproperty items : tbRentalpropertys) { count++; table.addCell(new PdfPCell(new Phrase(String.valueOf(count), font))); table.addCell(new PdfPCell(new Phrase(items.getDetailrental(), font))); table.addCell(new PdfPCell(new Phrase(items.getNamerental(), font))); table.addCell(new PdfPCell(new Phrase(items.getMoney(), font))); } return table; } // table tbThecertificationfoods public static PdfPTable createtableThecertificationfood(List<TbThecertificationfood> tbThecertificationfoods, String getSum) throws DocumentException, Exception { Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED)); font.setSize(16); PdfPTable table = new PdfPTable(6); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell = new PdfPCell( new Phrase("2.8 ", font)); cell.setColspan(6); table.addCell(cell); cell = new PdfPCell(new Phrase(" = " + getSum + " ", font)); cell.setColspan(6); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); int count = 0; for (TbThecertificationfood items : tbThecertificationfoods) { count++; table.addCell(new PdfPCell(new Phrase(String.valueOf(count), font))); table.addCell(new PdfPCell(new Phrase(items.getDetail(), font))); table.addCell(new PdfPCell(new Phrase(items.getQuantityperson(), font))); table.addCell(new PdfPCell(new Phrase(items.getQuantitymoney(), font))); table.addCell(new PdfPCell(new Phrase(items.getQuantitytime(), font))); table.addCell(new PdfPCell(new Phrase(items.getSum(), font))); } return table; } // table tbThecertificationdrinks public static PdfPTable createtableThecertificationdrinks( List<TbThecertificationdrink> tbThecertificationdrinks, String getSum) throws DocumentException, Exception { Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED)); font.setSize(16); PdfPTable table = new PdfPTable(6); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell = new PdfPCell(new Phrase( "2.9 ", font)); cell.setColspan(6); table.addCell(cell); cell = new PdfPCell(new Phrase(" = " + getSum + " ", font)); cell.setColspan(6); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); int count = 0; for (TbThecertificationdrink items : tbThecertificationdrinks) { count++; table.addCell(new PdfPCell(new Phrase(String.valueOf(count), font))); table.addCell(new PdfPCell(new Phrase(items.getDetail(), font))); table.addCell(new PdfPCell(new Phrase(items.getQuantityperson(), font))); table.addCell(new PdfPCell(new Phrase(items.getQuantitymoney(), font))); table.addCell(new PdfPCell(new Phrase(items.getQuantitytime(), font))); table.addCell(new PdfPCell(new Phrase(items.getSum(), font))); } return table; } // table tbThegifts public static PdfPTable createtableThegift(List<TbThegift> tbThegifts, String getSum) throws DocumentException, Exception { Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED)); font.setSize(16); PdfPTable table = new PdfPTable(6); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell = new PdfPCell(new Phrase( "2.10 ? ", font)); cell.setColspan(6); table.addCell(cell); cell = new PdfPCell(new Phrase(" = " + getSum + " ", font)); cell.setColspan(6); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); int count = 0; for (TbThegift items : tbThegifts) { count++; table.addCell(new PdfPCell(new Phrase(String.valueOf(count), font))); table.addCell(new PdfPCell(new Phrase(items.getDetail(), font))); table.addCell(new PdfPCell(new Phrase(items.getQuantityperson(), font))); table.addCell(new PdfPCell(new Phrase(items.getQuantitymoney(), font))); table.addCell(new PdfPCell(new Phrase(items.getQuantitytime(), font))); table.addCell(new PdfPCell(new Phrase(items.getMoneytotal(), font))); } return table; } // table tbTaxs public static PdfPTable createtableTax(List<TbTax> tbTaxs, String getSum) throws DocumentException, Exception { Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED)); font.setSize(16); PdfPTable table = new PdfPTable(5); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell = new PdfPCell(new Phrase("2.11 ", font)); cell.setColspan(5); table.addCell(cell); cell = new PdfPCell(new Phrase(" = " + getSum + " ", font)); cell.setColspan(5); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); int count = 0; for (TbTax items : tbTaxs) { count++; table.addCell(new PdfPCell(new Phrase(String.valueOf(count), font))); table.addCell(new PdfPCell(new Phrase(items.getDetail(), font))); table.addCell(new PdfPCell(new Phrase(items.getMoney(), font))); table.addCell(new PdfPCell(new Phrase(items.getTime(), font))); table.addCell(new PdfPCell(new Phrase(items.getMoneytotal(), font))); } return table; } // table tbFees public static PdfPTable createtableFee(List<TbFee> tbFees, String getSum) throws DocumentException, Exception { Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED)); font.setSize(16); PdfPTable table = new PdfPTable(5); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell = new PdfPCell(new Phrase("2.12 ", font)); cell.setColspan(5); table.addCell(cell); cell = new PdfPCell(new Phrase(" = " + getSum + " ", font)); cell.setColspan(5); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); int count = 0; for (TbFee items : tbFees) { count++; table.addCell(new PdfPCell(new Phrase(String.valueOf(count), font))); table.addCell(new PdfPCell(new Phrase(items.getDetail(), font))); table.addCell(new PdfPCell(new Phrase(items.getMoney(), font))); table.addCell(new PdfPCell(new Phrase(items.getTime(), font))); table.addCell(new PdfPCell(new Phrase(items.getMoneytotal(), font))); } return table; } // table tbInsurances public static PdfPTable createtableInsurance(List<TbInsurance> tbInsurances, String getSum) throws DocumentException, Exception { Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED)); font.setSize(16); PdfPTable table = new PdfPTable(5); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell = new PdfPCell(new Phrase("2.13 ?", font)); cell.setColspan(5); table.addCell(cell); cell = new PdfPCell(new Phrase(" = " + getSum + " ", font)); cell.setColspan(5); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); int count = 0; for (TbInsurance items : tbInsurances) { count++; table.addCell(new PdfPCell(new Phrase(String.valueOf(count), font))); table.addCell(new PdfPCell(new Phrase(items.getDetail(), font))); table.addCell(new PdfPCell(new Phrase(items.getMoney(), font))); table.addCell(new PdfPCell(new Phrase(items.getTime(), font))); table.addCell(new PdfPCell(new Phrase(items.getMoneytotal(), font))); } return table; } // table tbEmploys public static PdfPTable createtableEmploy(List<TbEmploy> tbEmploys, String getSum) throws DocumentException, Exception { Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED)); font.setSize(16); PdfPTable table = new PdfPTable(4); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell = new PdfPCell(new Phrase("2.14 ", font)); cell.setColspan(4); table.addCell(cell); cell = new PdfPCell(new Phrase(" = " + getSum + " ", font)); cell.setColspan(4); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("?", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("?", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); int count = 0; for (TbEmploy items : tbEmploys) { count++; table.addCell(new PdfPCell(new Phrase(String.valueOf(count), font))); table.addCell(new PdfPCell(new Phrase(items.getEmploymoney(), font))); table.addCell(new PdfPCell(new Phrase(items.getDetail(), font))); table.addCell(new PdfPCell(new Phrase(items.getCalculation(), font))); } return table; } // table tbMaterials1 public static PdfPTable createtableMaterial1(List<TbMaterial> tbMaterials1, String getSum) throws DocumentException, Exception { Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED)); font.setSize(16); PdfPTable table = new PdfPTable(6); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell = new PdfPCell(new Phrase("3.1 ?", font)); cell.setColspan(6); table.addCell(cell); cell = new PdfPCell(new Phrase(" = " + getSum + " ", font)); cell.setColspan(6); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("??", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); int count = 0; for (TbMaterial items : tbMaterials1) { count++; table.addCell(new PdfPCell(new Phrase(String.valueOf(count), font))); table.addCell(new PdfPCell(new Phrase(items.getMName(), font))); table.addCell(new PdfPCell(new Phrase(items.getMQty(), font))); table.addCell(new PdfPCell(new Phrase(items.getMNub(), font))); table.addCell(new PdfPCell(new Phrase(items.getMPrice(), font))); table.addCell(new PdfPCell(new Phrase(items.getMTotal(), font))); } return table; } // table tbMaterials2 public static PdfPTable createtableMaterial2(List<TbMaterial> tbMaterials2, String getSum) throws DocumentException, Exception { Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED)); font.setSize(16); PdfPTable table = new PdfPTable(6); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell = new PdfPCell(new Phrase("3.2 ?", font)); cell.setColspan(6); table.addCell(cell); cell = new PdfPCell(new Phrase(" = " + getSum + " ", font)); cell.setColspan(6); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("??", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); int count = 0; for (TbMaterial items : tbMaterials2) { count++; table.addCell(new PdfPCell(new Phrase(String.valueOf(count), font))); table.addCell(new PdfPCell(new Phrase(items.getMName(), font))); table.addCell(new PdfPCell(new Phrase(items.getMQty(), font))); table.addCell(new PdfPCell(new Phrase(items.getMNub(), font))); table.addCell(new PdfPCell(new Phrase(items.getMPrice(), font))); table.addCell(new PdfPCell(new Phrase(items.getMTotal(), font))); } return table; } // table tbMaterials3 public static PdfPTable createtableMaterial3(List<TbMaterial> tbMaterials3, String getSum) throws DocumentException, Exception { Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED)); font.setSize(16); PdfPTable table = new PdfPTable(6); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell = new PdfPCell( new Phrase("3.3 ", font)); cell.setColspan(6); table.addCell(cell); cell = new PdfPCell(new Phrase(" = " + getSum + " ", font)); cell.setColspan(6); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("??", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); int count = 0; for (TbMaterial items : tbMaterials3) { count++; table.addCell(new PdfPCell(new Phrase(String.valueOf(count), font))); table.addCell(new PdfPCell(new Phrase(items.getMName(), font))); table.addCell(new PdfPCell(new Phrase(items.getMQty(), font))); table.addCell(new PdfPCell(new Phrase(items.getMNub(), font))); table.addCell(new PdfPCell(new Phrase(items.getMPrice(), font))); table.addCell(new PdfPCell(new Phrase(items.getMTotal(), font))); } return table; } // table tbMaterials4 public static PdfPTable createtableMaterial4(List<TbMaterial> tbMaterials4, String getSum) throws DocumentException, Exception { Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED)); font.setSize(16); PdfPTable table = new PdfPTable(6); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell = new PdfPCell( new Phrase("3.4 ?", font)); cell.setColspan(6); table.addCell(cell); cell = new PdfPCell(new Phrase(" = " + getSum + " ", font)); cell.setColspan(6); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("??", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); int count = 0; for (TbMaterial items : tbMaterials4) { count++; table.addCell(new PdfPCell(new Phrase(String.valueOf(count), font))); table.addCell(new PdfPCell(new Phrase(items.getMName(), font))); table.addCell(new PdfPCell(new Phrase(items.getMQty(), font))); table.addCell(new PdfPCell(new Phrase(items.getMNub(), font))); table.addCell(new PdfPCell(new Phrase(items.getMPrice(), font))); table.addCell(new PdfPCell(new Phrase(items.getMTotal(), font))); } return table; } // table tbMaterials5 public static PdfPTable createtableMaterial5(List<TbMaterial> tbMaterials5, String getSum) throws DocumentException, Exception { Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED)); font.setSize(16); PdfPTable table = new PdfPTable(6); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell = new PdfPCell(new Phrase( "3.5 ??", font)); cell.setColspan(6); table.addCell(cell); cell = new PdfPCell(new Phrase(" = " + getSum + " ", font)); cell.setColspan(6); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("??", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); int count = 0; for (TbMaterial items : tbMaterials5) { count++; table.addCell(new PdfPCell(new Phrase(String.valueOf(count), font))); table.addCell(new PdfPCell(new Phrase(items.getMName(), font))); table.addCell(new PdfPCell(new Phrase(items.getMQty(), font))); table.addCell(new PdfPCell(new Phrase(items.getMNub(), font))); table.addCell(new PdfPCell(new Phrase(items.getMPrice(), font))); table.addCell(new PdfPCell(new Phrase(items.getMTotal(), font))); } return table; } // table tbMaterials6 public static PdfPTable createtableMaterial6(List<TbMaterial> tbMaterials6, String getSum) throws DocumentException, Exception { Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED)); font.setSize(16); PdfPTable table = new PdfPTable(6); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell = new PdfPCell(new Phrase("3.6 ??", font)); cell.setColspan(6); table.addCell(cell); cell = new PdfPCell(new Phrase(" = " + getSum + " ", font)); cell.setColspan(6); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("??", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); int count = 0; for (TbMaterial items : tbMaterials6) { count++; table.addCell(new PdfPCell(new Phrase(String.valueOf(count), font))); table.addCell(new PdfPCell(new Phrase(items.getMName(), font))); table.addCell(new PdfPCell(new Phrase(items.getMQty(), font))); table.addCell(new PdfPCell(new Phrase(items.getMNub(), font))); table.addCell(new PdfPCell(new Phrase(items.getMPrice(), font))); table.addCell(new PdfPCell(new Phrase(items.getMTotal(), font))); } return table; } // table tbMaterials7 public static PdfPTable createtableMaterial7(List<TbMaterial> tbMaterials7, String getSum) throws DocumentException, Exception { Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED)); font.setSize(16); PdfPTable table = new PdfPTable(6); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell = new PdfPCell(new Phrase("3.7 ", font)); cell.setColspan(6); table.addCell(cell); cell = new PdfPCell(new Phrase(" = " + getSum + " ", font)); cell.setColspan(6); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("??", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); int count = 0; for (TbMaterial items : tbMaterials7) { count++; table.addCell(new PdfPCell(new Phrase(String.valueOf(count), font))); table.addCell(new PdfPCell(new Phrase(items.getMName(), font))); table.addCell(new PdfPCell(new Phrase(items.getMQty(), font))); table.addCell(new PdfPCell(new Phrase(items.getMNub(), font))); table.addCell(new PdfPCell(new Phrase(items.getMPrice(), font))); table.addCell(new PdfPCell(new Phrase(items.getMTotal(), font))); } return table; } // table tbMaterials8 public static PdfPTable createtableMaterial8(List<TbMaterial> tbMaterials8, String getSum) throws DocumentException, Exception { Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED)); font.setSize(16); PdfPTable table = new PdfPTable(6); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell = new PdfPCell(new Phrase("3.8 ??", font)); cell.setColspan(6); table.addCell(cell); cell = new PdfPCell(new Phrase(" = " + getSum + " ", font)); cell.setColspan(6); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("??", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); int count = 0; for (TbMaterial items : tbMaterials8) { count++; table.addCell(new PdfPCell(new Phrase(String.valueOf(count), font))); table.addCell(new PdfPCell(new Phrase(items.getMName(), font))); table.addCell(new PdfPCell(new Phrase(items.getMQty(), font))); table.addCell(new PdfPCell(new Phrase(items.getMNub(), font))); table.addCell(new PdfPCell(new Phrase(items.getMPrice(), font))); table.addCell(new PdfPCell(new Phrase(items.getMTotal(), font))); } return table; } // table tbMaterials9 public static PdfPTable createtableMaterial9(List<TbMaterial> tbMaterials9, String getSum) throws DocumentException, Exception { Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED)); font.setSize(16); PdfPTable table = new PdfPTable(6); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell = new PdfPCell( new Phrase("3.9 ", font)); cell.setColspan(6); table.addCell(cell); cell = new PdfPCell(new Phrase(" = " + getSum + " ", font)); cell.setColspan(6); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("??", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); int count = 0; for (TbMaterial items : tbMaterials9) { count++; table.addCell(new PdfPCell(new Phrase(String.valueOf(count), font))); table.addCell(new PdfPCell(new Phrase(items.getMName(), font))); table.addCell(new PdfPCell(new Phrase(items.getMQty(), font))); table.addCell(new PdfPCell(new Phrase(items.getMNub(), font))); table.addCell(new PdfPCell(new Phrase(items.getMPrice(), font))); table.addCell(new PdfPCell(new Phrase(items.getMTotal(), font))); } return table; } // table tbMaterials10 public static PdfPTable createtableMaterial10(List<TbMaterial> tbMaterials10, String getSum) throws DocumentException, Exception { Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED)); font.setSize(16); PdfPTable table = new PdfPTable(6); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell = new PdfPCell( new Phrase("3.10 ???", font)); cell.setColspan(6); table.addCell(cell); cell = new PdfPCell(new Phrase(" = " + getSum + " ", font)); cell.setColspan(6); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("??", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); int count = 0; for (TbMaterial items : tbMaterials10) { count++; table.addCell(new PdfPCell(new Phrase(String.valueOf(count), font))); table.addCell(new PdfPCell(new Phrase(items.getMName(), font))); table.addCell(new PdfPCell(new Phrase(items.getMQty(), font))); table.addCell(new PdfPCell(new Phrase(items.getMNub(), font))); table.addCell(new PdfPCell(new Phrase(items.getMPrice(), font))); table.addCell(new PdfPCell(new Phrase(items.getMTotal(), font))); } return table; } // table tbMaterials11 public static PdfPTable createtableMaterial11(List<TbMaterial> tbMaterials11, String getSum) throws DocumentException, Exception { Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED)); font.setSize(16); PdfPTable table = new PdfPTable(6); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell = new PdfPCell(new Phrase("3.11 ", font)); cell.setColspan(6); table.addCell(cell); cell = new PdfPCell(new Phrase(" = " + getSum + " ", font)); cell.setColspan(6); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("??", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); int count = 0; for (TbMaterial items : tbMaterials11) { count++; table.addCell(new PdfPCell(new Phrase(String.valueOf(count), font))); table.addCell(new PdfPCell(new Phrase(items.getMName(), font))); table.addCell(new PdfPCell(new Phrase(items.getMQty(), font))); table.addCell(new PdfPCell(new Phrase(items.getMNub(), font))); table.addCell(new PdfPCell(new Phrase(items.getMPrice(), font))); table.addCell(new PdfPCell(new Phrase(items.getMTotal(), font))); } return table; } // table tbPublicutilitys public static PdfPTable createtablePublicutility(List<TbPublicutility> tbPublicutilitys, String getSum) throws DocumentException, Exception { Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED)); font.setSize(16); PdfPTable table = new PdfPTable(6); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell = new PdfPCell( new Phrase("4.1 ?", font)); cell.setColspan(6); table.addCell(cell); cell = new PdfPCell(new Phrase(" = " + getSum + " ", font)); cell.setColspan(6); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); int count = 0; for (TbPublicutility items : tbPublicutilitys) { count++; table.addCell(new PdfPCell(new Phrase(String.valueOf(count), font))); table.addCell(new PdfPCell(new Phrase(items.getPubEle(), font))); table.addCell(new PdfPCell(new Phrase(items.getPubWater(), font))); table.addCell(new PdfPCell(new Phrase(items.getPubTel(), font))); table.addCell(new PdfPCell(new Phrase(items.getPubEms(), font))); table.addCell(new PdfPCell(new Phrase(items.getPubOther(), font))); table.addCell(new PdfPCell(new Phrase(items.getPubSum(), font))); } return table; } }