private FormBlock AddBlock(FormPage page, decimal x, decimal y, decimal width, string text, TextAlignEnum textAlign) { decimal xScale = 0.08333m; // 0.0839m; decimal yScale = 0.16667m; // 0.1656m; var block = new FormBlock { TextAlign = textAlign, Left = 0.06m + xScale * x, Top = 0.06m + yScale * y, Width = xScale * width, Height = yScale * 1.1m, Text = text }; page.Blocks.Add(block); return block; }
private FormBlock AddBlock(FormPage page, decimal x, decimal y, decimal width, string text) { return AddBlock(page, x, y, width, text, TextAlignEnum.left); }
public List<FormPage> TransformJ400ToFormPages(J400Claim j400) { List<FormPage> pages = new List<FormPage>(); int pageCount = 1 + ((j400.ServiceLines.Count - 1) / 10); FormPage page = null; for (int i = 0; i < j400.ServiceLines.Count; i++) { if (i % 10 == 0) { page = new FormPage(); pages.Add(page); page.MasterReference = "j400"; page.ImagePath = _formImagePath; AddBlock(page, 43, 8, 38, j400.Field12_SubscriberInformation.Line1); AddBlock(page, 43, 9, 38, j400.Field12_SubscriberInformation.Line2); AddBlock(page, 43, 10, 38, j400.Field12_SubscriberInformation.Line3); AddBlock(page, 43, 11, 38, j400.Field12_SubscriberInformation.Line4); AddBlock(page, 43, 13, 10, string.Format("{0:MM/dd/yyyy}", j400.Field13_SubscriberDateOfBirth)); AddBlock(page, 57, 13, 1, j400.Field14_SubscriberGender_Female ? "X" : ""); AddBlock(page, 60, 13, 1, j400.Field14_SubscriberGender_Male ? "X" : ""); AddBlock(page, 65, 13, 15, j400.Field15_SubscriberId); AddBlock(page, 43, 15, 11, j400.Field16_SubscriberGroupNumber); AddBlock(page, 56, 15, 24, 'X'.Repeat(24)); AddBlock(page, 43, 18, 1, j400.Field18_PatientRelationshipToSubscriber_Self ? "X": ""); AddBlock(page, 48, 18, 1, j400.Field18_PatientRelationshipToSubscriber_Spouse ? "X" : ""); AddBlock(page, 54, 18, 1, j400.Field18_PatientRelationshipToSubscriber_Dependent ? "X" : ""); AddBlock(page, 63, 18, 1, j400.Field04_OtherDentalOrMedicalCoverage ? "X" : ""); AddBlock(page, 43, 20, 38, j400.Field20_PatientInformation.Line1); AddBlock(page, 43, 21, 38, j400.Field20_PatientInformation.Line2); AddBlock(page, 43, 22, 38, j400.Field20_PatientInformation.Line3); AddBlock(page, 43, 23, 38, j400.Field20_PatientInformation.Line4); AddBlock(page, 43, 25, 10, string.Format("{0:MM/dd/yyyy}", j400.Field21_PatientDateOfBirth)); AddBlock(page, 57, 25, 1, j400.Field22_PatientGender_Female ? "X" : ""); AddBlock(page, 60, 25, 1, j400.Field22_PatientGender_Male ? "X" : ""); AddBlock(page, 64, 25, 17, j400.Field23_PatientAccountNumber); } decimal y = 29 + (i % 10); var line = j400.ServiceLines[i]; AddBlock(page, 2, y, 10, string.Format("{0:MM/dd/yyyy}", line.Field24_ProcedureDate)); AddBlock(page, 13, y, 2, line.Field25_AreaOfOralCavity); AddBlock(page, 16, y, 2, line.Field26_ToothSystem); AddBlock(page, 19, y, 11, line.Field27_ToothNumberOrLetter); AddBlock(page, 31, y, 5, line.Field28_ToothSurface); AddBlock(page, 37, y, 5, line.Field29_ProcedureCode); AddBlock(page, 43, y, 31, 'D'.Repeat(31)); // line.Field30_Description); string amount = string.Format("{0:0.00}", line.Field31_Fee).Replace(".",""); AddBlock(page, 81 - amount.Length, y, amount.Length, amount); if (i % 10 == 9 || i == j400.ServiceLines.Count - 1) // Footer { } } return pages; }
public virtual List<FormPage> TransformUB04ToFormPages(UB04Claim ub04) { List<FormPage> pages = new List<FormPage>(); int pageCount = 1 + ((ub04.ServiceLines.Count - 1) / 22); FormPage page = null; for (int i = 0; i < ub04.ServiceLines.Count; i++) { if (i % 22 == 0) { page = new FormPage(); pages.Add(page); page.MasterReference = "ub04"; page.ImagePath = _formImagePath; // header // Box 1 AddBlock(page, 2, 1, 28, ub04.Field01_BillingProvider.Line1); AddBlock(page, 2, 2, 28, ub04.Field01_BillingProvider.Line2); AddBlock(page, 2, 3, 28, ub04.Field01_BillingProvider.Line3); AddBlock(page, 2, 4, 28, ub04.Field01_BillingProvider.Line4); // Box 2 AddBlock(page, 32, 1, 28, ub04.Field02_PayToProvider.Line1); AddBlock(page, 32, 2, 28, ub04.Field02_PayToProvider.Line2); AddBlock(page, 32, 3, 28, ub04.Field02_PayToProvider.Line3); AddBlock(page, 32, 4, 28, ub04.Field02_PayToProvider.Line4); // Box 3 AddBlock(page, 65, 1, 27, ub04.Field03a_PatientControlNumber); AddBlock(page, 65, 2, 27, ub04.Field03b_MedicalRecordNumber); // Box 4 AddBlock(page, 94, 2, 5, ub04.Field04_TypeOfBill); // Box 5 AddBlock(page, 62, 4, 10, ub04.Field05_FederalTaxId); // Box 6 - Statement Covers Period AddBlock(page, 74, 4, 9, ub04.Field06_StatementCoversPeriod.FromDate); AddBlock(page, 82, 4, 9, ub04.Field06_StatementCoversPeriod.ThroughDate); // Box 7 - Blank AddBlock(page, 91, 3, 8, ub04.Field07.Line1); AddBlock(page, 91, 4, 8, ub04.Field07.Line2); // Box 8 AddBlock(page, 15, 5, 21, ub04.Field08_PatientName_a); AddBlock(page, 3, 6, 33, ub04.Field08_PatientName_b); // Box 9 AddBlock(page, 51, 5, 48, ub04.Field09_PatientAddress.a_Street); AddBlock(page, 39, 6, 37, ub04.Field09_PatientAddress.b_City); AddBlock(page, 78, 6, 2, ub04.Field09_PatientAddress.c_State); AddBlock(page, 83, 6, 10, ub04.Field09_PatientAddress.d_PostalCode); AddBlock(page, 96, 6, 3, ub04.Field09_PatientAddress.e_CountryCode); // Box 10 AddBlock(page, 2, 8, 8, ub04.Field10_Birthdate); // Box 11 AddBlock(page, 13, 8, 1, ub04.Field11_Sex); // Box 12-15 AddBlock(page, 16, 8, 6, ub04.Field12_AdmissionDate); AddBlock(page, 23, 8, 2, ub04.Field13_AdmissionHour); AddBlock(page, 27, 8, 2, ub04.Field14_AdmissionType); AddBlock(page, 30, 8, 2, ub04.Field15_AdmissionSource); // Box 16 AddBlock(page, 34, 8, 2, ub04.Field16_DischargeHour); // Box 17 AddBlock(page, 38, 8, 2, ub04.Field17_DischargeStatus); // Box 18 - 28 Condition Codes AddBlock(page, 41, 8, 2, ub04.Field18_ConditionCode01); AddBlock(page, 45, 8, 2, ub04.Field19_ConditionCode02); AddBlock(page, 48, 8, 2, ub04.Field20_ConditionCode03); AddBlock(page, 52, 8, 2, ub04.Field21_ConditionCode04); AddBlock(page, 56, 8, 2, ub04.Field22_ConditionCode05); AddBlock(page, 59, 8, 2, ub04.Field23_ConditionCode06); AddBlock(page, 63, 8, 2, ub04.Field24_ConditionCode07); AddBlock(page, 66, 8, 2, ub04.Field25_ConditionCode08); AddBlock(page, 70, 8, 2, ub04.Field26_ConditionCode09); AddBlock(page, 73.5m, 8, 2, ub04.Field27_ConditionCode10); AddBlock(page, 77, 8, 2, ub04.Field28_ConditionCode11); // Box 29 AddBlock(page, 81, 8, 2, ub04.Field29_AccidentState); // Box 30 AddBlock(page, 85, 8, 14, ub04.Field30); // Box 31 AddBlock(page, 2, 10, 2, ub04.Field31a_Occurrence.Code); AddBlock(page, 6, 10, 6, ub04.Field31a_Occurrence.Date); AddBlock(page, 2, 11, 2, ub04.Field31b_Occurrence.Code); AddBlock(page, 6, 11, 6, ub04.Field31b_Occurrence.Date); // Box 32 AddBlock(page, 14, 10, 2, ub04.Field32a_Occurrence.Code); AddBlock(page, 18, 10, 6, ub04.Field32a_Occurrence.Date); AddBlock(page, 14, 11, 2, ub04.Field32b_Occurrence.Code); AddBlock(page, 18, 11, 6, ub04.Field32b_Occurrence.Date); // Box 33 AddBlock(page, 26, 10, 2, ub04.Field33a_Occurrence.Code); AddBlock(page, 30, 10, 6, ub04.Field33a_Occurrence.Date); AddBlock(page, 26, 11, 2, ub04.Field33b_Occurrence.Code); AddBlock(page, 30, 11, 6, ub04.Field33b_Occurrence.Date); // Box 34 AddBlock(page, 38, 10, 2, ub04.Field34a_Occurrence.Code); AddBlock(page, 41, 10, 6, ub04.Field34a_Occurrence.Date); AddBlock(page, 38, 11, 2, ub04.Field34b_Occurrence.Code); AddBlock(page, 41, 11, 6, ub04.Field34b_Occurrence.Date); // Box 35 AddBlock(page, 50, 10, 2, ub04.Field35a_OccurrenceSpan.Code); AddBlock(page, 53, 10, 6, ub04.Field35a_OccurrenceSpan.FromDate); AddBlock(page, 62, 10, 6, ub04.Field35a_OccurrenceSpan.ThroughDate); AddBlock(page, 50, 11, 2, ub04.Field35b_OccurrenceSpan.Code); AddBlock(page, 53, 11, 6, ub04.Field35b_OccurrenceSpan.FromDate); AddBlock(page, 62, 11, 6, ub04.Field35b_OccurrenceSpan.ThroughDate); // Box 36 AddBlock(page, 70, 10, 2, ub04.Field36a_OccurrenceSpan.Code); AddBlock(page, 74, 10, 6, ub04.Field36a_OccurrenceSpan.FromDate); AddBlock(page, 82, 10, 6, ub04.Field36a_OccurrenceSpan.ThroughDate); AddBlock(page, 70, 11, 2, ub04.Field36b_OccurrenceSpan.Code); AddBlock(page, 74, 11, 6, ub04.Field36b_OccurrenceSpan.FromDate); AddBlock(page, 82, 11, 6, ub04.Field36b_OccurrenceSpan.ThroughDate); // Box 37 - Blank AddBlock(page, 90, 10, 9, ub04.Field37.Line1); AddBlock(page, 90, 11, 9, ub04.Field37.Line2); // Box 38 - Responsible Party AddBlock(page, 2, 12, 48, ub04.Field38_ResponsibleParty.Line1); AddBlock(page, 2, 13, 48, ub04.Field38_ResponsibleParty.Line2); AddBlock(page, 2, 14, 48, ub04.Field38_ResponsibleParty.Line3); AddBlock(page, 2, 15, 48, ub04.Field38_ResponsibleParty.Line4); AddBlock(page, 2, 16, 48, ub04.Field38_ResponsibleParty.Line5); // Box 39 - Value Codes AddBlock(page, 53, 13, 2, ub04.Field39a_Value.Code); AddBlock(page, 57, 13, 12, String.Format("{0:0.00}", ub04.Field39a_Value.Amount).Replace('.', ' '), TextAlignEnum.right); AddBlock(page, 53, 14, 2, ub04.Field39b_Value.Code); AddBlock(page, 57, 14, 12, String.Format("{0:0.00}", ub04.Field39b_Value.Amount).Replace('.', ' '), TextAlignEnum.right); AddBlock(page, 53, 15, 2, ub04.Field39c_Value.Code); AddBlock(page, 57, 15, 12, String.Format("{0:0.00}", ub04.Field39c_Value.Amount).Replace('.', ' '), TextAlignEnum.right); AddBlock(page, 53, 16, 2, ub04.Field39d_Value.Code); AddBlock(page, 57, 16, 12, String.Format("{0:0.00}", ub04.Field39d_Value.Amount).Replace('.', ' '), TextAlignEnum.right); // Box 40 AddBlock(page, 69, 13, 2, ub04.Field40a_Value.Code); AddBlock(page, 72.5m, 13, 12, String.Format("{0:0.00}", ub04.Field40a_Value.Amount).Replace('.', ' '), TextAlignEnum.right); AddBlock(page, 69, 14, 2, ub04.Field40b_Value.Code); AddBlock(page, 72.5m, 14, 12, String.Format("{0:0.00}", ub04.Field40b_Value.Amount).Replace('.', ' '), TextAlignEnum.right); AddBlock(page, 69, 15, 2, ub04.Field40c_Value.Code); AddBlock(page, 72.5m, 15, 12, String.Format("{0:0.00}", ub04.Field40c_Value.Amount).Replace('.', ' '), TextAlignEnum.right); AddBlock(page, 69, 16, 2, ub04.Field40d_Value.Code); AddBlock(page, 72.5m, 16, 12, String.Format("{0:0.00}", ub04.Field40d_Value.Amount).Replace('.', ' '), TextAlignEnum.right); // Box 41 - Value Codes AddBlock(page, 84, 13, 2, ub04.Field41a_Value.Code); AddBlock(page, 88, 13, 12, String.Format("{0:0.00}", ub04.Field41a_Value.Amount).Replace('.', ' '), TextAlignEnum.right); AddBlock(page, 84, 14, 2, ub04.Field41b_Value.Code); AddBlock(page, 88, 14, 12, String.Format("{0:0.00}", ub04.Field41b_Value.Amount).Replace('.', ' '), TextAlignEnum.right); AddBlock(page, 84, 15, 2, ub04.Field41c_Value.Code); AddBlock(page, 88, 15, 12, String.Format("{0:0.00}", ub04.Field41c_Value.Amount).Replace('.', ' '), TextAlignEnum.right); AddBlock(page, 84, 16, 2, ub04.Field41d_Value.Code); AddBlock(page, 88, 16, 12, String.Format("{0:0.00}", ub04.Field41d_Value.Amount).Replace('.', ' '), TextAlignEnum.right); } // service lines decimal y = 18 + (i % 22); var line = ub04.ServiceLines[i]; // Box 42 - 49 - Service Lines AddBlock(page, 2, y, 4, line.Field42_RevenueCode); AddBlock(page, 7, y, 29, line.Field43_Description); AddBlock(page, 37, y, 17, line.Field44_ProcedureCodes); AddBlock(page, 56, y, 6, line.Field45_ServiceDate); AddBlock(page, 64, y, 9, line.Field46_ServiceUnits, TextAlignEnum.right); AddBlock(page, 74, y, 11, String.Format("{0:0.00}", line.Field47_TotalCharges).Replace('.',' '), TextAlignEnum.right); AddBlock(page, 86, y, 11, String.Format("{0:0.00}", line.Field48_NonCoveredCharges).Replace('.',' '), TextAlignEnum.right); AddBlock(page, 97, y, 2, line.Field49); if (i % 22 == 21 || i == ub04.ServiceLines.Count - 1) // Footer { int pageIndex = 1 + ((i - 1) / 22); AddBlock(page, 13, 40, 3, pageIndex.ToString(), TextAlignEnum.right); AddBlock(page, 20, 40, 3, pageCount.ToString(), TextAlignEnum.right); AddBlock(page, 74, 40, 11, String.Format("{0:0.00}", ub04.Field47_Line23_TotalCharges).Replace('.',' '), TextAlignEnum.right); AddBlock(page, 86, 40, 11, String.Format("{0:0.00}", ub04.Field48_Line23_NonCoveredCharges).Replace('.',' '), TextAlignEnum.right); // Box 50 AddBlock(page, 2, 42, 26, ub04.PayerA_Primary.Field50_PayerName); AddBlock(page, 2, 43, 26, ub04.PayerB_Secondary.Field50_PayerName); AddBlock(page, 2, 44, 26, ub04.PayerC_Tertiary.Field50_PayerName); // Box 51 AddBlock(page, 29, 42, 17, ub04.PayerA_Primary.Field51_HealthPlanId); AddBlock(page, 29, 43, 17, ub04.PayerB_Secondary.Field51_HealthPlanId); AddBlock(page, 29, 44, 17, ub04.PayerC_Tertiary.Field51_HealthPlanId); // Box 52 - Release of Info AddBlock(page, 46.5m, 42, 2, ub04.PayerA_Primary.Field52_ReleaseOfInfoCertIndicator); AddBlock(page, 46.5m, 43, 2, ub04.PayerB_Secondary.Field52_ReleaseOfInfoCertIndicator); AddBlock(page, 46.5m, 44, 2, ub04.PayerC_Tertiary.Field52_ReleaseOfInfoCertIndicator); // Box 53 AddBlock(page, 50, 42, 2, ub04.PayerA_Primary.Field53_AssignmentOfBenefitsCertIndicator); AddBlock(page, 50, 43, 2, ub04.PayerB_Secondary.Field53_AssignmentOfBenefitsCertIndicator); AddBlock(page, 50, 44, 2, ub04.PayerC_Tertiary.Field53_AssignmentOfBenefitsCertIndicator); // Box 54 AddBlock(page, 54.25m, 42, 11, String.Format("{0:0.00}", ub04.PayerA_Primary.Field54_PriorPayments).Replace('.',' '), TextAlignEnum.right); AddBlock(page, 54.25m, 43, 11, String.Format("{0:0.00}", ub04.PayerB_Secondary.Field54_PriorPayments).Replace('.', ' '), TextAlignEnum.right); AddBlock(page, 54.25m, 44, 11, String.Format("{0:0.00}", ub04.PayerC_Tertiary.Field54_PriorPayments).Replace('.', ' '), TextAlignEnum.right); // Box 55 AddBlock(page, 66.5m, 42, 12, String.Format("{0:0.00}", ub04.PayerA_Primary.Field55_EstimatedAmountDue).Replace('.', ' '), TextAlignEnum.right); AddBlock(page, 66.5m, 43, 12, String.Format("{0:0.00}", ub04.PayerB_Secondary.Field55_EstimatedAmountDue).Replace('.', ' '), TextAlignEnum.right); AddBlock(page, 66.5m, 44, 12, String.Format("{0:0.00}", ub04.PayerC_Tertiary.Field55_EstimatedAmountDue).Replace('.', ' '), TextAlignEnum.right); // Box 56 AddBlock(page, 85, 41, 10, ub04.Field56_NationalProviderIdentifier); // Box 57 AddBlock(page, 82, 42, 17, ub04.Field57_OtherProviderIdA); AddBlock(page, 82, 43, 17, ub04.Field57_OtherProviderIdB); AddBlock(page, 82, 44, 17, ub04.Field57_OtherProviderIdC); // Box 58 AddBlock(page, 2, 46, 29, ub04.PayerA_Primary.Field58_InsuredsName); AddBlock(page, 2, 47, 29, ub04.PayerB_Secondary.Field58_InsuredsName); AddBlock(page, 2, 48, 29, ub04.PayerC_Tertiary.Field58_InsuredsName); // Box 59 AddBlock(page, 33, 46, 2, ub04.PayerA_Primary.Field59_PatientRelationship); AddBlock(page, 33, 47, 2, ub04.PayerB_Secondary.Field59_PatientRelationship); AddBlock(page, 33, 48, 2, ub04.PayerC_Tertiary.Field59_PatientRelationship); // Box 60 AddBlock(page, 36, 46, 23, ub04.PayerA_Primary.Field60_InsuredsUniqueId); AddBlock(page, 36, 47, 23, ub04.PayerB_Secondary.Field60_InsuredsUniqueId); AddBlock(page, 36, 48, 23, ub04.PayerC_Tertiary.Field60_InsuredsUniqueId); // Box 61 AddBlock(page, 60, 46, 17, ub04.PayerA_Primary.Field61_GroupName); AddBlock(page, 60, 47, 17, ub04.PayerB_Secondary.Field61_GroupName); AddBlock(page, 60, 48, 17, ub04.PayerC_Tertiary.Field61_GroupName); // Box 62 AddBlock(page, 78, 46, 21, ub04.PayerA_Primary.Field62_InsuredsGroupNumber); AddBlock(page, 78, 47, 21, ub04.PayerB_Secondary.Field62_InsuredsGroupNumber); AddBlock(page, 78, 48, 21, ub04.PayerC_Tertiary.Field62_InsuredsGroupNumber); // Box 63 AddBlock(page, 2, 50, 35, ub04.Field63A_TreatmentAuthorizationCode); AddBlock(page, 2, 51, 35, ub04.Field63B_TreatmentAuthorizationCode); AddBlock(page, 2, 52, 35, ub04.Field63C_TreatmentAuthorizationCode); // Box 64 - Document Control Number AddBlock(page, 39, 50, 30, ub04.Field64A_DocumentControlNumber); AddBlock(page, 39, 51, 30, ub04.Field64B_DocumentControlNumber); AddBlock(page, 39, 52, 30, ub04.Field64C_DocumentControlNumber); // Box 65 - Employer Name AddBlock(page, 70, 50, 29, ub04.Field65a_EmployerName); AddBlock(page, 70, 51, 29, ub04.Field65b_EmployerName); AddBlock(page, 70, 52, 29, ub04.Field65c_EmployerName); // Box 66 - ICD Version AddBlock(page, 1, 54, 1, ub04.Field66_Version); // Box 67 - Primary Diagnosis AddBlock(page, 3, 53, 6, ub04.Field67_PrincipleDiagnosis.Code); AddBlock(page, 10.5m, 53, 1, ub04.Field67_PrincipleDiagnosis.PresentOnAdmissionIndicator); // Box 67A AddBlock(page, 13, 53, 6, ub04.Field67A_Diagnosis.Code); AddBlock(page, 20, 53, 1, ub04.Field67A_Diagnosis.PresentOnAdmissionIndicator); // Box 67B AddBlock(page, 22, 53, 6, ub04.Field67B_Diagnosis.Code); AddBlock(page, 29.75m, 53, 1, ub04.Field67B_Diagnosis.PresentOnAdmissionIndicator); // Box 67C AddBlock(page, 32, 53, 6, ub04.Field67C_Diagnosis.Code); AddBlock(page, 39.25m, 53, 1, ub04.Field67C_Diagnosis.PresentOnAdmissionIndicator); // Box 67D AddBlock(page, 42, 53, 6, ub04.Field67D_Diagnosis.Code); AddBlock(page, 49m, 53, 1, ub04.Field67D_Diagnosis.PresentOnAdmissionIndicator); // Box 67E AddBlock(page, 51, 53, 6, ub04.Field67E_Diagnosis.Code); AddBlock(page, 58.5m, 53, 1, ub04.Field67E_Diagnosis.PresentOnAdmissionIndicator); // Box 67F AddBlock(page, 61, 53, 6, ub04.Field67F_Diagnosis.Code); AddBlock(page, 68m, 53, 1, ub04.Field67F_Diagnosis.PresentOnAdmissionIndicator); // Box 67G AddBlock(page, 70, 53, 6, ub04.Field67G_Diagnosis.Code); AddBlock(page, 77.75m, 53, 1, ub04.Field67G_Diagnosis.PresentOnAdmissionIndicator); // Box 67H AddBlock(page, 80, 53, 6, ub04.Field67H_Diagnosis.Code); AddBlock(page, 87.25m, 53, 1, ub04.Field67H_Diagnosis.PresentOnAdmissionIndicator); // Box 67I AddBlock(page, 3, 54, 6, ub04.Field67I_Diagnosis.Code); AddBlock(page, 10.5m, 54, 1, ub04.Field67I_Diagnosis.PresentOnAdmissionIndicator); // Box 67J AddBlock(page, 13, 54, 6, ub04.Field67J_Diagnosis.Code); AddBlock(page, 20, 54, 1, ub04.Field67J_Diagnosis.PresentOnAdmissionIndicator); // Box 67K AddBlock(page, 22, 54, 6, ub04.Field67K_Diagnosis.Code); AddBlock(page, 29.75m, 54, 1, ub04.Field67K_Diagnosis.PresentOnAdmissionIndicator); // Box 67L AddBlock(page, 32, 54, 6, ub04.Field67L_Diagnosis.Code); AddBlock(page, 39.25m, 54, 1, ub04.Field67L_Diagnosis.PresentOnAdmissionIndicator); // Box 67M AddBlock(page, 42, 54, 6, ub04.Field67M_Diagnosis.Code); AddBlock(page, 49m, 54, 1, ub04.Field67M_Diagnosis.PresentOnAdmissionIndicator); // Box 67N AddBlock(page, 51, 54, 6, ub04.Field67N_Diagnosis.Code); AddBlock(page, 58.5m, 54, 1, ub04.Field67N_Diagnosis.PresentOnAdmissionIndicator); // Box 67O AddBlock(page, 61, 54, 6, ub04.Field67O_Diagnosis.Code); AddBlock(page, 68m, 54, 1, ub04.Field67O_Diagnosis.PresentOnAdmissionIndicator); // Box 67P AddBlock(page, 70, 54, 6, ub04.Field67P_Diagnosis.Code); AddBlock(page, 77.75m, 54, 1, ub04.Field67P_Diagnosis.PresentOnAdmissionIndicator); // Box 67Q AddBlock(page, 80, 54, 6, ub04.Field67Q_Diagnosis.Code); AddBlock(page, 87.25m, 54, 1, ub04.Field67Q_Diagnosis.PresentOnAdmissionIndicator); // Box 68 AddBlock(page, 90, 53, 9, ub04.Field68.Line1); AddBlock(page, 90, 54, 9, ub04.Field68.Line2); // Box 69 - Admitting Diagnosis AddBlock(page, 6, 55, 6, ub04.Field69_AdmittingDiagnosisCode.Code); // Box 70 - Patient Reason Diagnosis AddBlock(page, 21, 55, 6, ub04.Field70a_PatientReasonDiagnosisCode.Code); AddBlock(page, 29, 55, 6, ub04.Field70b_PatientReasonDiagnosisCode.Code); AddBlock(page, 38, 55, 6, ub04.Field70c_PatientReasonDiagnosisCode.Code); // Box 71 - PPS Code AddBlock(page, 51, 55, 5, ub04.Field71_PPSCode); // Box 72 - External Cause of Injury AddBlock(page, 59, 55, 6, ub04.Field72a_ExternalCauseOfInjury.Code); AddBlock(page, 67m, 55, 1, ub04.Field72a_ExternalCauseOfInjury.PresentOnAdmissionIndicator); AddBlock(page, 69, 55, 6, ub04.Field72b_ExternalCauseOfInjury.Code); AddBlock(page, 76.75m, 55, 1, ub04.Field72b_ExternalCauseOfInjury.PresentOnAdmissionIndicator); AddBlock(page, 79, 55, 6, ub04.Field72c_ExternalCauseOfInjury.Code); AddBlock(page, 86.25m, 55, 1, ub04.Field72c_ExternalCauseOfInjury.PresentOnAdmissionIndicator); // Box 73 - Blank AddBlock(page, 89, 55, 10, ub04.Field73); // Box 74 AddBlock(page, 2, 57, 8, ub04.Field74_PrincipalProcedure.Code); AddBlock(page, 12, 57, 6, ub04.Field74_PrincipalProcedure.Date); AddBlock(page, 20, 57, 8, ub04.Field74a_OtherProcedure.Code); AddBlock(page, 29, 57, 6, ub04.Field74a_OtherProcedure.Date); AddBlock(page, 38, 57, 8, ub04.Field74b_OtherProcedure.Code); AddBlock(page, 48, 57, 6, ub04.Field74b_OtherProcedure.Date); AddBlock(page, 2, 59, 8, ub04.Field74c_OtherProcedure.Code); AddBlock(page, 12, 59, 6, ub04.Field74c_OtherProcedure.Date); AddBlock(page, 20, 59, 8, ub04.Field74d_OtherProcedure.Code); AddBlock(page, 29, 59, 6, ub04.Field74d_OtherProcedure.Date); AddBlock(page, 38, 59, 8, ub04.Field74e_OtherProcedure.Code); AddBlock(page, 48, 59, 6, ub04.Field74e_OtherProcedure.Date); // Box 75 AddBlock(page, 56, 56, 4, ub04.Field75.Line1); AddBlock(page, 56, 57, 4, ub04.Field75.Line2); AddBlock(page, 56, 58, 4, ub04.Field75.Line3); AddBlock(page, 56, 59, 4, ub04.Field75.Line4); // Box 76 AddBlock(page, 72, 56, 10, ub04.Field76_AttendingPhysician.Npi); AddBlock(page, 86, 56, 2, ub04.Field76_AttendingPhysician.IdentifierQualifier); AddBlock(page, 89, 56, 10, ub04.Field76_AttendingPhysician.Identifier); AddBlock(page, 64, 57, 18, ub04.Field76_AttendingPhysician.LastName); AddBlock(page, 86, 57, 13, ub04.Field76_AttendingPhysician.FirstName); // Box 77 AddBlock(page, 72, 58, 10, ub04.Field77_OperatingPhysician.Npi); AddBlock(page, 86, 58, 2, ub04.Field77_OperatingPhysician.IdentifierQualifier); AddBlock(page, 89, 58, 10, ub04.Field77_OperatingPhysician.Identifier); AddBlock(page, 64, 59, 18, ub04.Field77_OperatingPhysician.LastName); AddBlock(page, 86, 59, 13, ub04.Field77_OperatingPhysician.FirstName); // Box 78 AddBlock(page, 72, 60, 10, ub04.Field78_OtherProvider.Npi); AddBlock(page, 86, 60, 2, ub04.Field78_OtherProvider.IdentifierQualifier); AddBlock(page, 89, 60, 10, ub04.Field78_OtherProvider.Identifier); AddBlock(page, 64, 61, 18, ub04.Field78_OtherProvider.LastName); AddBlock(page, 86, 61, 13, ub04.Field78_OtherProvider.FirstName); // Box 79 AddBlock(page, 72, 62, 10, ub04.Field79_OtherProvider.Npi); AddBlock(page, 86, 62, 2, ub04.Field79_OtherProvider.IdentifierQualifier); AddBlock(page, 89, 62, 10, ub04.Field79_OtherProvider.Identifier); AddBlock(page, 64, 63, 18, ub04.Field79_OtherProvider.LastName); AddBlock(page, 86, 63, 13, ub04.Field79_OtherProvider.FirstName); // Box 80 AddBlock(page, 2, 61, 27, ub04.Field80_Remarks.Line1); AddBlock(page, 2, 62, 27, ub04.Field80_Remarks.Line2); AddBlock(page, 2, 63, 27, ub04.Field80_Remarks.Line3); // Box 81 AddBlock(page, 32, 60, 2, ub04.Field81a.Qualifier); AddBlock(page, 35, 60, 10, ub04.Field81a.Code1); AddBlock(page, 48, 60, 12, ub04.Field81a.Code2); AddBlock(page, 32, 61, 2, ub04.Field81b.Qualifier); AddBlock(page, 35, 61, 10, ub04.Field81b.Code1); AddBlock(page, 48, 61, 12, ub04.Field81b.Code2); AddBlock(page, 32, 62, 2, ub04.Field81c.Qualifier); AddBlock(page, 35, 62, 10, ub04.Field81c.Code1); AddBlock(page, 48, 62, 12, ub04.Field81c.Code2); AddBlock(page, 32, 63, 2, ub04.Field81d.Qualifier); AddBlock(page, 35, 63, 10, ub04.Field81d.Code1); AddBlock(page, 48, 63, 12, ub04.Field81d.Code2); // reorder by locations; page.Blocks = page.Blocks.OrderBy(bl => bl.Top).ToList(); } } return pages; }
public virtual List<FormPage> TransformHcfa1500ToFormPages(HCFA1500Claim hcfa) { List<FormPage> pages = new List<FormPage>(); FormPage page = null; for (int i = 0; i < hcfa.Field24_ServiceLines.Count; i++) { if (i % 6 == 0) { page = new FormPage(); pages.Add(page); page.MasterReference = "hcfa1500"; page.ImagePath = _formImagePath; // Render header // LINE 1 AddBlock(page, 4, 7, 2, ConditionalMarker(hcfa.Field01_TypeOfCoverageIsMedicare)); AddBlock(page, 11, 7, 2, ConditionalMarker(hcfa.Field01_TypeOfCoverageIsMedicaid)); AddBlock(page, 18, 7, 2, ConditionalMarker(hcfa.Field01_TypeOfCoverageIsTricareChampus)); AddBlock(page, 27, 7, 2, ConditionalMarker(hcfa.Field01_TypeOfCoverageIsChampVa)); AddBlock(page, 34, 7, 2, ConditionalMarker(hcfa.Field01_TypeOfCoverageIsGroupHealthPlan)); AddBlock(page, 42, 7, 2, ConditionalMarker(hcfa.Field01_TypeOfCoverageIsFECABlkLung)); AddBlock(page, 48, 7, 2, ConditionalMarker(hcfa.Field01_TypeOfCoverageIsOther)); AddBlock(page, 53, 7, 30, hcfa.Field01a_InsuredsIDNumber); // LINE 2 AddBlock(page, 4, 9, 28.5m, hcfa.Field02_PatientsName); AddBlock(page, 34, 9, 3, hcfa.Field03_PatientsDateOfBirth.MM); AddBlock(page, 37, 9, 3, hcfa.Field03_PatientsDateOfBirth.DD); AddBlock(page, 40, 9, 3, hcfa.Field03_PatientsDateOfBirth.YY); AddBlock(page, 44.5m, 9, 2.5m, ConditionalMarker(hcfa.Field03_PatientsSexMale), TextAlignEnum.center); AddBlock(page, 49.5m, 9, 2.5m, ConditionalMarker(hcfa.Field03_PatientsSexFemale), TextAlignEnum.center); AddBlock(page, 53, 9, 30, hcfa.Field04_InsuredsName); // LINE 3 AddBlock(page, 4, 11, 28.5m, hcfa.Field05_PatientsAddress_Street); AddBlock(page, 36, 11, 2, ConditionalMarker(hcfa.Field06_PatientRelationshipToInsuredIsSelf)); //self AddBlock(page, 41, 11, 2, ConditionalMarker(hcfa.Field06_PatientRelationshipToInsuredIsSpouseOf)); //spouse AddBlock(page, 45, 11, 2, ConditionalMarker(hcfa.Field06_PatientRelationshipToInsuredIsChildOf)); //child AddBlock(page, 50, 11, 2, ConditionalMarker(hcfa.Field06_PatientRelationshipToInsuredIsOther)); // other AddBlock(page, 53, 11, 30, hcfa.Field07_InsuredsAddress_Street); // LINE 4 AddBlock(page, 4, 13, 25, hcfa.Field05_PatientsAddress_City); AddBlock(page, 29, 13, 3.5m, hcfa.Field05_PatientsAddress_State); // Field 8 unused in CMS-1500 AddBlock(page, 38, 13, 2, ConditionalMarker(hcfa.Field08_PatientStatusIsSingle)); AddBlock(page, 44, 13, 2, ConditionalMarker(hcfa.Field08_PatientStatusIsMarried)); AddBlock(page, 50, 13, 2, ConditionalMarker(hcfa.Field08_PatientStatusIsOther)); AddBlock(page, 53, 13, 23, hcfa.Field07_InsuredsAddress_City); AddBlock(page, 77, 13, 6, hcfa.Field07_InsuredsAddress_State); // LINE 5 AddBlock(page, 4, 15, 13, hcfa.Field05_PatientsAddress_Zip); AddBlock(page, 18, 15, 14.5m, hcfa.Field05_PatientsTelephone); // Field 8 unused in CMS-1500 AddBlock(page, 38, 15, 2, ConditionalMarker(hcfa.Field08_PatientStatusIsEmployed)); AddBlock(page, 44, 15, 2, ConditionalMarker(hcfa.Field08_PatientStatusIsFullTimeStudent)); AddBlock(page, 50, 15, 2, ConditionalMarker(hcfa.Field08_PatientStatusIsPartTimeStudent)); AddBlock(page, 53, 15, 12, hcfa.Field07_InsuredsAddress_Zip); AddBlock(page, 68.5m, 15, 14.5m, hcfa.Field07_InsuredsPhoneNumber); // LINE 6 AddBlock(page, 4, 17, 28.5m, hcfa.Field09_OtherInsuredsName); AddBlock(page, 53, 17, 30, hcfa.Field09a_OtherInsuredsPolicyOrGroup); // LINE 7 AddBlock(page, 4, 19, 28.5m, hcfa.Field09a_OtherInsuredsPolicyOrGroup); AddBlock(page, 38, 19, 2, ConditionalMarker(hcfa.Field10a_PatientConditionRelatedToEmployment)); AddBlock(page, 44, 19, 2, ConditionalMarker(!hcfa.Field10a_PatientConditionRelatedToEmployment)); AddBlock(page, 56, 19, 3, hcfa.Field11a_InsuredsDateOfBirth.MM); AddBlock(page, 59, 19, 3, hcfa.Field11a_InsuredsDateOfBirth.DD); AddBlock(page, 62, 19, 3, hcfa.Field11a_InsuredsDateOfBirth.YY); AddBlock(page, 71.25m, 19, 2, ConditionalMarker(hcfa.Field11a_InsuredsSexIsMale), TextAlignEnum.center); AddBlock(page, 78.5m, 19, 2, ConditionalMarker(hcfa.Field11a_InsuredsSexIsFemale), TextAlignEnum.center); // LINE 8 // Field 9b is not supplied by 837P data. AddBlock(page, 5, 21, 3, hcfa.Field09b_OtherInsuredsDateOfBirth.MM); AddBlock(page, 8, 21, 3, hcfa.Field09b_OtherInsuredsDateOfBirth.DD); AddBlock(page, 11, 21, 3, hcfa.Field09b_OtherInsuredsDateOfBirth.YY); AddBlock(page, 21, 21, 2, ConditionalMarker(hcfa.Field09b_OtherInsuredIsMale)); AddBlock(page, 27, 21, 2, ConditionalMarker(hcfa.Field09b_OtherInsuredIsFemale)); AddBlock(page, 38, 21, 2, ConditionalMarker(hcfa.Field10b_PatientConditionRelatedToAutoAccident)); AddBlock(page, 44, 21, 2, ConditionalMarker(!hcfa.Field10b_PatientConditionRelatedToAutoAccident)); AddBlock(page, 48, 21, 2.5m, hcfa.Field10b_PatientConditionRelToAutoAccidentState); AddBlock(page, 53, 21, 30, hcfa.Field09c_OtherInsuredsEmployerNameOrSchoolName); // LINE 9 AddBlock(page, 4, 23, 28.5m, hcfa.Field09c_OtherInsuredsEmployerNameOrSchoolName); AddBlock(page, 38, 23, 2, ConditionalMarker(hcfa.Field10c_PatientConditionRelatedToOtherAccident)); AddBlock(page, 44, 23, 2, ConditionalMarker(!hcfa.Field10c_PatientConditionRelatedToOtherAccident)); AddBlock(page, 53, 23, 30, hcfa.Field09d_OtherInsuredsInsurancePlanNameOrProgramName); // LINE 10 AddBlock(page, 4, 25, 28.5m, hcfa.Field09d_OtherInsuredsInsurancePlanNameOrProgramName); AddBlock(page, 33, 25, 20, hcfa.Field10d_ReservedForLocalUse); AddBlock(page, 55, 25, 2, ConditionalMarker(hcfa.Field11d_IsThereOtherHealthBenefitPlan)); AddBlock(page, 60, 25, 2, ConditionalMarker(!hcfa.Field11d_IsThereOtherHealthBenefitPlan)); // LINE 11 AddBlock(page, 9, 29, 25, hcfa.Field12_PatientsOrAuthorizedSignature, TextAlignEnum.center); AddBlock(page, 39, 29, 14, hcfa.Field12_PatientsOrAuthorizedSignatureDate.ToString(), TextAlignEnum.center); AddBlock(page, 59, 29, 24, hcfa.Field13_InsuredsOrAuthorizedSignature, TextAlignEnum.center); // LINE 12 if (hcfa.Field14_DateOfCurrentIllnessInjuryOrPregnancy != null) { AddBlock(page, 5, 31, 3, hcfa.Field14_DateOfCurrentIllnessInjuryOrPregnancy.MM); AddBlock(page, 8, 31, 3, hcfa.Field14_DateOfCurrentIllnessInjuryOrPregnancy.DD); AddBlock(page, 11, 31, 3, hcfa.Field14_DateOfCurrentIllnessInjuryOrPregnancy.YY); } // Field 15 AddBlock(page, 40, 31, 3, hcfa.Field15_DatePatientHadSameOrSimilarIllness.MM); AddBlock(page, 43, 31, 3, hcfa.Field15_DatePatientHadSameOrSimilarIllness.DD); AddBlock(page, 46, 31, 3, hcfa.Field15_DatePatientHadSameOrSimilarIllness.YY); if (hcfa.Field16_DatePatientUnableToWork_Start != null) { AddBlock(page, 57, 31, 3, hcfa.Field16_DatePatientUnableToWork_Start.MM); AddBlock(page, 60, 31, 3, hcfa.Field16_DatePatientUnableToWork_Start.DD); AddBlock(page, 63, 31, 3, hcfa.Field16_DatePatientUnableToWork_Start.YY); } if (hcfa.Field16_DatePatientUnableToWork_End != null) { AddBlock(page, 71, 31, 3, hcfa.Field16_DatePatientUnableToWork_End.MM); AddBlock(page, 74, 31, 3, hcfa.Field16_DatePatientUnableToWork_End.DD); AddBlock(page, 77, 31, 3, hcfa.Field16_DatePatientUnableToWork_End.YY); } // LINE 13 AddBlock(page, 4, 33, 26, hcfa.Field17_ReferringProviderOrOtherSource_Name); AddBlock(page, 33, 32, 3, hcfa.Field17a_OtherID_Qualifier); AddBlock(page, 36, 32, 16, hcfa.Field17a_OtherID_Number); AddBlock(page, 36, 33, 16, hcfa.Field17b_NationalProviderIdentifier); // Field 18 AddBlock(page, 57, 33, 3, hcfa.Field18_HospitalizationDateFrom.MM); AddBlock(page, 60, 33, 3, hcfa.Field18_HospitalizationDateFrom.DD); AddBlock(page, 63, 33, 3, hcfa.Field18_HospitalizationDateFrom.YY); AddBlock(page, 71, 33, 3, hcfa.Field18_HospitalizationDateTo.MM); AddBlock(page, 74, 33, 3, hcfa.Field18_HospitalizationDateTo.DD); AddBlock(page, 77, 33, 3, hcfa.Field18_HospitalizationDateTo.YY); // LINE 14 AddBlock(page, 4, 35, 49, hcfa.Field19_ReservedForLocalUse); AddBlock(page, 55, 35, 2, ConditionalMarker(hcfa.Field20_OutsideLab)); AddBlock(page, 60, 35, 2, ConditionalMarker(!hcfa.Field20_OutsideLab)); AddBlock(page, 65, 35, 9, hcfa.Field20_OutsideLab ? Convert.ToString(hcfa.Field20_OutsideLabCharges) : "", TextAlignEnum.right); AddBlock(page, 74, 35, 9, "", TextAlignEnum.right); // Note, we do not use second charge box at all here. // Line 15 AddBlock(page, 6.5m, 37, 8, hcfa.Field21_Diagnosis1); AddBlock(page, 33.5m, 37, 8, hcfa.Field21_Diagnosis3); AddBlock(page, 53, 37, 11, hcfa.Field22_MedicaidSubmissionCode); AddBlock(page, 65, 37, 18, hcfa.Field22_OriginalReferenceNumber); // Line 16 AddBlock(page, 6.5m, 39, 8, hcfa.Field21_Diagnosis2); AddBlock(page, 33.5m, 39, 8, hcfa.Field21_Diagnosis4); AddBlock(page, 53, 39, 30, hcfa.Field23_PriorAuthorizationNumber); } // Render service lines decimal y = 42 + 2 * (i % 6); var line = hcfa.Field24_ServiceLines[i]; AddBlock(page, 4, y, 60, line.CommentLine); AddBlock(page, 68, y, 3, line.RenderingProviderIdQualifier); AddBlock(page, 71, y, 12, line.RenderingProviderId); AddBlock(page, 4, y + 1, 3, line.DateFrom.MM); AddBlock(page, 7, y + 1, 3, line.DateFrom.DD); AddBlock(page, 10, y + 1, 3, line.DateFrom.YY); AddBlock(page, 13, y + 1, 3, line.DateTo.MM); AddBlock(page, 16, y + 1, 3, line.DateTo.DD); AddBlock(page, 19, y + 1, 3, line.DateTo.YY); AddBlock(page, 22, y + 1, 3, line.PlaceOfService); AddBlock(page, 25, y + 1, 2, line.EmergencyIndicator); AddBlock(page, 29, y + 1, 6, line.ProcedureCode); AddBlock(page, 36, y + 1, 3, line.Mod1); AddBlock(page, 39, y + 1, 3, line.Mod2); AddBlock(page, 42, y + 1, 3, line.Mod3); AddBlock(page, 45, y + 1, 3, line.Mod4); AddBlock(page, 48, y + 1, 2, line.DiagnosisPointer1); AddBlock(page, 49, y + 1, 2, line.DiagnosisPointer2); AddBlock(page, 50, y + 1, 2, line.DiagnosisPointer3); AddBlock(page, 51, y + 1, 2, line.DiagnosisPointer4); AddBlock(page, 53, y + 1, 9, String.Format("{0:0.00}", line.Charges).Replace(".", " "), TextAlignEnum.right); AddBlock(page, 62, y + 1, 4, String.Format("{0}", line.DaysOrUnits), TextAlignEnum.right); AddBlock(page, 66, y + 1, 2, line.EarlyPeriodicScreeningDiagnosisAndTreatment); AddBlock(page, 71, y + 1, 12, line.RenderingProviderNpi); if (i % 6 == 5 || i == hcfa.Field24_ServiceLines.Count - 1) // Footer { // Render footer AddBlock(page, 4, 55, 15, hcfa.Field25_FederalTaxIDNumber); if (hcfa.Field25_IsSSN) AddBlock(page, 20, 55, 2, "X"); if (hcfa.Field25_IsEIN) AddBlock(page, 22, 55, 2, "X"); AddBlock(page, 26, 55, 14, hcfa.Field26_PatientAccountNumber); if (hcfa.Field27_AcceptAssignment.HasValue) { if (hcfa.Field27_AcceptAssignment.Value == true) AddBlock(page, 41, 55, 2, "X"); else AddBlock(page, 46, 55, 2, "X"); } AddBlock(page, 55, 55, 9, String.Format("{0:0.00}", hcfa.Field28_TotalCharge).Replace(".", " "), TextAlignEnum.right); AddBlock(page, 65, 55, 9, String.Format("{0:0.00}", hcfa.Field29_AmountPaid).Replace(".", " "), TextAlignEnum.right); AddBlock(page, 74, 55, 9, String.Format("{0:0.00}", hcfa.Field30_BalanceDue).Replace(".", " "), TextAlignEnum.right); // Box 31 if (hcfa.Field31_PhysicianOrSupplierSignatureIsOnFile.HasValue) { AddBlock(page, 4, 58, 21, "PROVIDER SIGNATURE", TextAlignEnum.center); if (hcfa.Field31_PhysicianOrSupplierSignatureIsOnFile.Value == true) AddBlock(page, 4, 59, 21, "IS ON FILE", TextAlignEnum.center); else AddBlock(page, 4, 59, 21, "NOT ON FILE", TextAlignEnum.center); } // Box 32 AddBlock(page, 26, 57, 27, hcfa.Field32_ServiceFacilityLocation_Name); AddBlock(page, 26, 58, 27, hcfa.Field32_ServiceFacilityLocation_Street); AddBlock(page, 26, 59, 27, String.Format("{0}, {1} {2}", hcfa.Field32_ServiceFacilityLocation_City, hcfa.Field32_ServiceFacilityLocation_State, hcfa.Field32_ServiceFacilityLocation_Zip)); AddBlock(page, 27, 60, 10, hcfa.Field32a_ServiceFacilityLocation_Npi); AddBlock(page, 38, 60, 15, hcfa.Field32b_ServiceFacilityLocation_OtherID); // Box 33 AddBlock(page, 69, 56, 27, hcfa.Field33_BillingProvider_TelephoneNumber); AddBlock(page, 53, 57, 27, hcfa.Field33_BillingProvider_Name); AddBlock(page, 53, 58, 27, hcfa.Field33_BillingProvider_Street); AddBlock(page, 53, 59, 27, String.Format("{0}, {1} {2}", hcfa.Field33_BillingProvider_City, hcfa.Field33_BillingProvider_State, hcfa.Field33_BillingProvider_Zip)); AddBlock(page, 54, 60, 10, hcfa.Field33a_BillingProvider_Npi); AddBlock(page, 65, 60, 15, hcfa.Field33b_BillingProvider_OtherID); } } return pages; }