This commit is contained in:
2022-07-12 18:28:41 +00:00
parent f7e4226e66
commit ff9b45c6dc

View File

@@ -2745,19 +2745,20 @@ namespace AyaNovaQBI
if (clitem != null)
{
//add a record to the datatable
var tempName = clitem.FullName.GetValue();
var tempContact = ProcessQBString(clitem.Contact);
DataRow dr = _dtQBClients.Rows.Add(
new object[]{
clitem.ListID.GetValue(),
clitem.FullName.GetValue(),
ProcessAddress(clitem.BillAddress),
ProcessAddress(clitem.ShipAddress),
tempName,
ProcessAddress(clitem.BillAddress, tempName, tempContact),
ProcessAddress(clitem.ShipAddress, tempName, tempContact),
ProcessQBString(clitem.Phone),
ProcessQBString(clitem.Fax),
ProcessQBString(clitem.AltPhone),
ProcessQBString(clitem.Email),
ProcessQBString(clitem.Contact),
tempContact,
clitem.TimeCreated.GetValue(),
clitem.TimeModified.GetValue(),
ProcessQBString(clitem.AccountNumber),
@@ -2795,7 +2796,7 @@ namespace AyaNovaQBI
/// </summary>
/// <param name="a"></param>
/// <returns></returns>
private static Address ProcessAddress(IAddress a)
private static Address ProcessAddress(IAddress a, string filteroutname, string filteroutcontact)
{
Address b = new Address();
b.City = "";
@@ -2807,13 +2808,31 @@ namespace AyaNovaQBI
//Append each line of the address, add cr/lf for each line if present after
//the first line
//Assumption: First line always has *something* in it
b.DeliveryAddress = ProcessQBString(a.Addr1);
b.DeliveryAddress += SS("\r\n", ProcessQBString(a.Addr2), "");
b.DeliveryAddress += SS("\r\n", ProcessQBString(a.Addr3), "");
//v8: QB Sample data has redundant contact and company / person name in first two address rows, not sure if this is convention or not but filtering it out if it is present
string temp = ProcessQBString(a.Addr1);
temp.Replace(filteroutname + "\r\n", "");
temp.Replace(filteroutcontact + "\r\n", "");
b.DeliveryAddress = temp;
temp = ProcessQBString(a.Addr2);
temp.Replace(filteroutname + "\r\n", "");
temp.Replace(filteroutcontact + "\r\n", "");
b.DeliveryAddress += SS("\r\n", temp, "");
temp = ProcessQBString(a.Addr3);
temp.Replace(filteroutname + "\r\n", "");
temp.Replace(filteroutcontact + "\r\n", "");
b.DeliveryAddress += SS("\r\n", temp, "");
//Address line 4 is a qbxml 2 or higher feature
if (QVersion > 1.1)
b.DeliveryAddress += SS("\r\n", ProcessQBString(a.Addr4), "");
{
temp = ProcessQBString(a.Addr4);
temp.Replace(filteroutname + "\r\n", "");
temp.Replace(filteroutcontact + "\r\n", "");
b.DeliveryAddress += SS("\r\n", temp, "");
}
//Country specific:
b.City = ProcessQBString(a.City);
@@ -2963,20 +2982,23 @@ namespace AyaNovaQBI
if (clitem != null)
{
//add a record to the datatable
var tempName = clitem.Name.GetValue();
var tempContact = ProcessQBString(clitem.Contact);
DataRow dr = _dtQBVendors.Rows.Add(
new object[]
{
clitem.ListID.GetValue(),
clitem.Name.GetValue(),
ProcessAddress(clitem.VendorAddress),
ProcessAddress(clitem.VendorAddress),
tempName,
ProcessAddress(clitem.VendorAddress,tempName, tempContact),
ProcessAddress(clitem.VendorAddress,
tempName,
tempContact),
ProcessQBString(clitem.Phone),
ProcessQBString(clitem.Fax),
ProcessQBString(clitem.AltPhone),
ProcessQBString(clitem.Email),
ProcessQBString(clitem.Contact),
tempContact,
clitem.TimeCreated.GetValue(),
clitem.TimeModified.GetValue(),
ProcessQBString(clitem.AccountNumber)