private List <loanrepayments> Getloansrepayments() { try { List <loanrepayments> loansrepay = new List <loanrepayments>(); List <psuedovwPayslipDetails> payslipDetails = GetPayslipDetailsList(); foreach (var ps in payslipDetails) { loanrepayments lr = new loanrepayments() { employeename = ps.Surname.Trim() + ", " + ps.OtherNames.Trim(), employeenumber = ps.EmpNo, loandescription = ps.ItemId, startdate = ps.PostDate, monthamount = ps.Amount, balance = ps.YTD }; loansrepay.Add(lr); } return(loansrepay); } catch (Exception ex) { Utils.ShowError(ex); return(null); } }
//table details private void AddBodyTableDetail(loanrepayments tr, ref int row, ref int col) { row++; col = 1; string cellrangeaddr1 = document.IntAlpha(col) + row; document.createHeaders(row, col, tr.employeenumber, cellrangeaddr1, cellrangeaddr1, 0, "WHITE", true, 10, "n"); col++; cellrangeaddr1 = document.IntAlpha(col) + row; document.createHeaders(row, col, tr.employeename, cellrangeaddr1, cellrangeaddr1, 0, "WHITE", true, 10, "n"); col++; cellrangeaddr1 = document.IntAlpha(col) + row; document.createHeaders(row, col, tr.loandescription, cellrangeaddr1, cellrangeaddr1, 0, "WHITE", true, 10, "n"); col++; cellrangeaddr1 = document.IntAlpha(col) + row; document.createHeaders(row, col, tr.startdate.ToString("dd-MMM-yyyy"), cellrangeaddr1, cellrangeaddr1, 0, "WHITE", true, 10, "n"); col++; cellrangeaddr1 = document.IntAlpha(col) + row; document.createHeaders(row, col, tr.monthamount.ToString("#,##0"), cellrangeaddr1, cellrangeaddr1, 0, "WHITE", true, 10, "n"); col++; cellrangeaddr1 = document.IntAlpha(col) + row; document.createHeaders(row, col, tr.balance.ToString("#,##0"), cellrangeaddr1, cellrangeaddr1, 0, "WHITE", true, 10, "n"); col++; }
private void AddTableRow(Table loanRePaymentsTable, loanrepayments tr) { if (tr != null) { //Totals Cell B = new Cell(new Phrase(tr.employeenumber, tcFont)); B.HorizontalAlignment = Cell.ALIGN_LEFT; loanRePaymentsTable.AddCell(B);//Col 2 Cell C = new Cell(new Phrase(tr.employeename, tcFont)); C.HorizontalAlignment = Cell.ALIGN_LEFT; loanRePaymentsTable.AddCell(C); //Col 3 Cell D = new Cell(new Phrase(tr.loandescription, tcFont)); //Lookup for descripion D.HorizontalAlignment = Cell.ALIGN_LEFT; loanRePaymentsTable.AddCell(D); //Col 2 Cell E = new Cell(new Phrase(tr.startdate.ToString("dd-MMM-yyyy"), tcFont)); E.HorizontalAlignment = Cell.ALIGN_LEFT; loanRePaymentsTable.AddCell(E);//Col 2 Cell F = new Cell(new Phrase(string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0:N0}", tr.monthamount), tcFont)); F.HorizontalAlignment = Cell.ALIGN_RIGHT; loanRePaymentsTable.AddCell(F);//Col 2 decimal _tbalance = decimal.Parse(tr.balance.ToString()); if (_tbalance < 0) { _tbalance = _tbalance * -1; } Cell G = new Cell(new Phrase(string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0:N0}", _tbalance), tcFont)); G.HorizontalAlignment = Cell.ALIGN_RIGHT; loanRePaymentsTable.AddCell(G);//Col 2 } else { Cell ErCell = new Cell(new Phrase("Payroll Must Be Closed!", tcFont)); ErCell.HorizontalAlignment = Cell.ALIGN_LEFT; loanRePaymentsTable.AddCell(ErCell);//Col 2 } }