private ArrayList constructItems() { CTaxFormPageRv3_53 page = null; CTaxFormGroupBySupplierRv3_53 group = null; ArrayList pages = new ArrayList(); while (true) { MVTaxFormPRV3_53 m = fetchData(); if (m == null) { break; } if ((page == null) || (page.GroupCount >= 6)) { page = new CTaxFormPageRv3_53(); pages.Add(page); } if ((group == null) || !group.Name.Equals(m.SupplierName) || (group.ItemCount >= 3)) { group = new CTaxFormGroupBySupplierRv3_53(m); page.AddGroup(group); } group.AddWhItem(m); suppliers[m.SupplierName] = m.SupplierName; } if (pages.Count > 0) { int lastIdx = pages.Count - 1; CTaxFormPageRv3_53 lastPage = (CTaxFormPageRv3_53)pages[lastIdx]; if (lastPage.GroupCount == 0) { //Blank page pages.RemoveAt(lastIdx); } } return(pages); }
private void populateDetailFormValue(AcroFields pdfFormFields, int category, int pageNo, int pageCount, CTaxFormPageRv3_53 page) { String fldName = getFormFieldName(-1, -1, "CompanyTaxID"); pdfFormFields.SetField(fldName, CTaxDocumentUtil.FormatTaxIDField(company.TaxID)); fldName = getFormFieldName(-1, -1, "SheetNo"); pdfFormFields.SetField(fldName, pageNo.ToString()); fldName = getFormFieldName(-1, -1, "TotalSheet"); pdfFormFields.SetField(fldName, pageCount.ToString()); fldName = getFormFieldName(-1, -1, "TotalExpenseAmount"); pdfFormFields.SetField(fldName, CTaxDocumentUtil.FormatNumberField(actualView.ExpenseAmount)); fldName = getFormFieldName(-1, -1, "TotalWhAmount"); pdfFormFields.SetField(fldName, CTaxDocumentUtil.FormatNumberField(actualView.WhAmount)); int grpNo = 0; foreach (CTaxFormGroupBySupplierRv3_53 grp in page.Groups) { currSeq++; fldName = getFormFieldName(grpNo, -1, "SupplierTaxID"); if (taxDocType == TaxDocumentType.TaxDocRev3) { pdfFormFields.SetField(fldName, CTaxDocumentUtil.FormatTaxIDField(grp.TaxID)); } else { //53 pdfFormFields.SetField(fldName, CTaxDocumentUtil.FormatTaxIDField2(grp.TaxID)); } fldName = getFormFieldName(grpNo, -1, "SupplierAddress"); pdfFormFields.SetField(fldName, grp.Address); if (taxDocType == TaxDocumentType.TaxDocRev3) { String[] s = CTaxDocumentUtil.GetNameLastname(grp.Name); fldName = getFormFieldName(grpNo, -1, "SupplierName"); pdfFormFields.SetField(fldName, s[0]); fldName = getFormFieldName(grpNo, -1, "SupplierLastName"); pdfFormFields.SetField(fldName, s[1]); } else { //53 fldName = getFormFieldName(grpNo, -1, "SupplierName"); pdfFormFields.SetField(fldName, grp.Name); } fldName = getFormFieldName(grpNo, -1, "SeqNo"); pdfFormFields.SetField(fldName, currSeq.ToString()); int j = 0; foreach (MVTaxFormPRV3_53 row in grp.WhItems) { whAmt = whAmt + CUtil.StringToDouble(row.WhAmount); expenseAmt = expenseAmt + CUtil.StringToDouble(row.ExpenseAmt); fldName = getFormFieldName(grpNo, j, "DocumentDate"); pdfFormFields.SetField(fldName, " " + row.DocumentDateFmt); fldName = getFormFieldName(grpNo, j, "WhPayType"); pdfFormFields.SetField(fldName, " " + row.WhPayType); fldName = getFormFieldName(grpNo, j, "WhGroupDesc"); pdfFormFields.SetField(fldName, row.WhGroupDesc); fldName = getFormFieldName(grpNo, j, "WhPct"); pdfFormFields.SetField(fldName, row.WhPct); fldName = getFormFieldName(grpNo, j, "WhAmount"); pdfFormFields.SetField(fldName, CTaxDocumentUtil.FormatNumberField(row.WhAmount)); fldName = getFormFieldName(grpNo, j, "ExpenseAmt"); pdfFormFields.SetField(fldName, CTaxDocumentUtil.FormatNumberField(row.ExpenseAmt)); j++; } grpNo++; } fldName = getFormFieldName(-1, -1, "TotalExpenseAmount"); pdfFormFields.SetField(fldName, CTaxDocumentUtil.FormatNumberField(expenseAmt.ToString())); fldName = getFormFieldName(-1, -1, "TotalWhAmount"); pdfFormFields.SetField(fldName, CTaxDocumentUtil.FormatNumberField(whAmt.ToString())); }