Example #1
0
        static void FillTransaction(TransactionsReportList tr, FilterTransactionReport filter, Row row, int colscCount, bool isUnassignet = false)
        {
            int index;

            if (filter.Columns.Any(r => r.TransactionColumn == TransactioReportColumns.CheckNum && r.IsChecked) && TryGetColIndexFromList(TransactioReportColumns.CheckNum, out index))
            {
                FillRow(row, index, string.IsNullOrEmpty(tr.CheckNo) ? string.Empty : tr.CheckNo, false, ParagraphAlignment.Center, VerticalAlignment.Center);
            }
            if (filter.Columns.Any(r => r.TransactionColumn == TransactioReportColumns.Date && r.IsChecked) && TryGetColIndexFromList(TransactioReportColumns.Date, out index))
            {
                FillRow(row, index, tr.Date.ToShortDateString(), false, ParagraphAlignment.Center, VerticalAlignment.Center);
            }
            if (filter.Columns.Any(r => r.TransactionColumn == TransactioReportColumns.Method && r.IsChecked) && TryGetColIndexFromList(TransactioReportColumns.Method, out index))
            {
                FillRow(row, index, Grouping.GetMethodName(tr.PaymentMethodID), false, ParagraphAlignment.Center, VerticalAlignment.Center);
            }
            if (filter.Columns.Any(r => r.TransactionColumn == TransactioReportColumns.Solicitor && r.IsChecked) && TryGetColIndexFromList(TransactioReportColumns.Solicitor, out index))
            {
                FillRow(row, index, Grouping.GetSolicitorName(tr.SolicitorID), false, ParagraphAlignment.Center, VerticalAlignment.Center);
            }
            if (filter.Columns.Any(r => r.TransactionColumn == TransactioReportColumns.Mailing && r.IsChecked) && TryGetColIndexFromList(TransactioReportColumns.Mailing, out index))
            {
                FillRow(row, index, Grouping.GetMailingName(tr.MailingID), false, ParagraphAlignment.Center, VerticalAlignment.Center);
            }
            if (filter.Columns.Any(r => r.TransactionColumn == TransactioReportColumns.CatSubcat && r.IsChecked) && TryGetColIndexFromList(TransactioReportColumns.CatSubcat, out index))
            {
                FillRow(row, index, "Category/Subcategory not done!!!", false, ParagraphAlignment.Center, VerticalAlignment.Center);
            }
            if (filter.Columns.Any(r => r.TransactionColumn == TransactioReportColumns.Department && r.IsChecked) && TryGetColIndexFromList(TransactioReportColumns.Department, out index))
            {
                FillRow(row, index, Grouping.GetDepartmentName(tr.DepartmentID), false, ParagraphAlignment.Center, VerticalAlignment.Center);
            }
            if (filter.ReportType == TransFilterType.Payment && filter.Columns.Any(r => r.TransactionColumn == TransactioReportColumns.ReceiptNum && r.IsChecked) && TryGetColIndexFromList(TransactioReportColumns.ReceiptNum, out index))
            {
                FillRow(row, index, tr.ReceiptNo.ToString(), false, ParagraphAlignment.Center, VerticalAlignment.Center);
            }
            if (filter.ReportType == TransFilterType.Payment && filter.Columns.Any(r => r.TransactionColumn == TransactioReportColumns.InvoiceNum && r.IsChecked) && TryGetColIndexFromList(TransactioReportColumns.InvoiceNum, out index))
            {
                FillRow(row, index, tr.InvoiceNo.ToString(), false, ParagraphAlignment.Center, VerticalAlignment.Center);
            }
            if (filter.Columns.Any(r => r.TransactionColumn == TransactioReportColumns.Note && r.IsChecked) && TryGetColIndexFromList(TransactioReportColumns.Note, out index))
            {
                FillRow(row, index, tr.Note, false, ParagraphAlignment.Center, VerticalAlignment.Center);
            }
            //amount
            FillRow(row, filter.ReportType == TransFilterType.Payment ? colscCount - 1 : colscCount - 4, tr.Amount.ToMoneyString(), false, ParagraphAlignment.Right, VerticalAlignment.Center);
            if (filter.ReportType == TransFilterType.Bill)
            {
                FillRow(row, colscCount - 3, isUnassignet ? "0" : CalcPaydedAmount(tr.Amount, tr.AmountDue).ToMoneyString(), false, ParagraphAlignment.Right, VerticalAlignment.Center);
            }
            if (filter.ReportType == TransFilterType.Bill)
            {
                FillRow(row, colscCount - 2, tr.AmountDue == null ? "0" : ((decimal)tr.AmountDue).ToMoneyString(), false, ParagraphAlignment.Right, VerticalAlignment.Center);
            }
            if (filter.ReportType == TransFilterType.Bill)
            {
                FillRow(row, colscCount - 1, "", false, ParagraphAlignment.Right, VerticalAlignment.Center);
            }
        }