void FillTotal(Row row, TransactionReportGroupedDTO tr, FilterTransactionReport filter, int colCount, float?marginLeft = null)
        {
            var borders = new Borders
            {
                Bottom = new Border
                {
                    Visible = true,
                    Color   = _blackColor
                },
                Visible = false
            };

            FillRow(row, 0, tr.TotalName, true, ParagraphAlignment.Left, VerticalAlignment.Center, marginLeft: marginLeft, borders: borders);
            if (filter.ReportType == TransFilterType.Payment)
            {
                row.Cells[0].MergeRight = colCount - 2;
                FillRow(row, colCount - 1, tr.TotalAmount.ToMoneyString(), true, ParagraphAlignment.Right, VerticalAlignment.Center, borders: borders);
            }
            if (filter.ReportType == TransFilterType.Bill)
            {
                row.Cells[0].MergeRight = colCount - (filter.ShowUnasinged ? 5 : 6);
                FillRow(row, colCount - (filter.ShowUnasinged ? 4 : 3), tr.TotalAmount.ToMoneyString(), true, ParagraphAlignment.Right, VerticalAlignment.Center, borders: borders);
                FillRow(row, colCount - (filter.ShowUnasinged ? 3 : 2), tr.PaidTotalAmount.ToMoneyString(), true, ParagraphAlignment.Right, VerticalAlignment.Center, borders: borders);
                FillRow(row, colCount - (filter.ShowUnasinged ? 2 : 1), tr.DueTotalAmount.ToMoneyString(), true, ParagraphAlignment.Right, VerticalAlignment.Center, borders: borders);
                if (filter.ShowUnasinged)
                {
                    FillRow(row, colCount - 1, tr.UnasignedAmount.ToMoneyString(), true, ParagraphAlignment.Right, VerticalAlignment.Center, borders: borders);
                }
            }
        }
        string GetMainInfo(TransactionReportGroupedDTO trans, FilterTransactionReport filter)
        {
            StringBuilder strBuilder = new StringBuilder();

            strBuilder.Append(trans.Name);
            //fill company
            if (!string.IsNullOrEmpty(trans.Company) &&
                filter.Columns.Any(r => r.Column == ReportColumns.Company && r.IsChecked))
            {
                strBuilder.AppendLine(trans.Company);
            }

            //fill contacts
            if (trans.FamilyDetails != null)
            {
                if (trans.FamilyDetails.Contacts.Any() && filter.Columns.Any(r => r.IsChecked && r.IsContact))
                {
                    strBuilder.AppendLine();
                    foreach (ContactReportContactInfo cont in trans.FamilyDetails.Contacts)
                    {
                        if (filter.Columns.Where(s => s.Column != null)
                            .Any(r => (int)r.Column == cont.PhoneTypeID && r.IsChecked) && !string.IsNullOrEmpty(cont.PhoneNumber))
                        {
                            strBuilder.AppendFormat(" {0}: {1}; ",
                                                    GetTranslation(GetContactName(cont.PhoneTypeID, cont.MemberType)),
                                                    cont.PhoneNumber);
                        }
                    }
                }
                if (trans.FamilyDetails.Addresses.Any() &&
                    filter.Columns.Any(e => e.Column == ReportColumns.Address && e.IsChecked))
                {
                    //home address
                    if (trans.FamilyDetails.Addresses.Any(e => e.AddressTypeID == 1))
                    {
                        strBuilder.AppendLine();
                        strBuilder.Append(GetTranslation("trans_info_homeAddress"));
                        foreach (ContactReportAddress addr in trans.FamilyDetails.Addresses.Where(r => r.AddressTypeID == 1))
                        {
                            // strBuilder.AppendFormat(" {0} {1},{2} {3} {4}; ", addr.Address, addr.City, addr.State, addr.Zip, addr.Country);
                            strBuilder.Append($" {addr.Address} {addr.Address2} {addr.City}, {addr.State} {addr.Zip} {addr.Country}; ");
                        }
                    }
                    //work address
                    if (trans.FamilyDetails.Addresses.Any(e => e.AddressTypeID == 2))
                    {
                        strBuilder.AppendLine();
                        strBuilder.Append(GetTranslation("trans_info_workAddress"));
                        foreach (ContactReportAddress addr in trans.FamilyDetails.Addresses.Where(r => r.AddressTypeID == 2))
                        {
                            //  strBuilder.AppendFormat(" {0} {1},{2} {3} {4}; ", addr.Address, addr.City, addr.State, addr.Zip, addr.Country);
                            strBuilder.Append($" {addr.Address} {addr.Address2} {addr.City}, {addr.State} {addr.Zip} {addr.Country}; ");
                        }
                    }
                }
            }
            return(strBuilder.ToString());
        }
Exemplo n.º 3
0
 static void FillTotal(Row row, TransactionReportGroupedDTO tr, FilterTransactionReport filter, int colCount, float?marginLeft = null)
 {
     FillRow(row, 0, tr.TotalName, true, ParagraphAlignment.Left, VerticalAlignment.Center, marginLeft: marginLeft);
     if (filter.ReportType == TransFilterType.Payment)
     {
         row.Cells[0].MergeRight = colCount - 2;
         FillRow(row, colCount - 1, tr.TotalAmount.ToMoneyString(), true, ParagraphAlignment.Right, VerticalAlignment.Center);
     }
     if (filter.ReportType == TransFilterType.Bill)
     {
         row.Cells[0].MergeRight = colCount - 5;
         FillRow(row, colCount - 4, tr.TotalAmount.ToMoneyString(), true, ParagraphAlignment.Right, VerticalAlignment.Center);
         FillRow(row, colCount - 3, tr.PaidTotalAmount.ToMoneyString(), true, ParagraphAlignment.Right, VerticalAlignment.Center);
         FillRow(row, colCount - 2, tr.DueTotalAmount.ToMoneyString(), true, ParagraphAlignment.Right, VerticalAlignment.Center);
         FillRow(row, colCount - 1, tr.UnasignedAmount.ToMoneyString(), true, ParagraphAlignment.Right, VerticalAlignment.Center);
     }
 }