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) if (clitem != null)
{ {
//add a record to the datatable //add a record to the datatable
var tempName = clitem.FullName.GetValue();
var tempContact = ProcessQBString(clitem.Contact);
DataRow dr = _dtQBClients.Rows.Add( DataRow dr = _dtQBClients.Rows.Add(
new object[]{ new object[]{
clitem.ListID.GetValue(), clitem.ListID.GetValue(),
clitem.FullName.GetValue(), tempName,
ProcessAddress(clitem.BillAddress), ProcessAddress(clitem.BillAddress, tempName, tempContact),
ProcessAddress(clitem.ShipAddress), ProcessAddress(clitem.ShipAddress, tempName, tempContact),
ProcessQBString(clitem.Phone), ProcessQBString(clitem.Phone),
ProcessQBString(clitem.Fax), ProcessQBString(clitem.Fax),
ProcessQBString(clitem.AltPhone), ProcessQBString(clitem.AltPhone),
ProcessQBString(clitem.Email), ProcessQBString(clitem.Email),
ProcessQBString(clitem.Contact), tempContact,
clitem.TimeCreated.GetValue(), clitem.TimeCreated.GetValue(),
clitem.TimeModified.GetValue(), clitem.TimeModified.GetValue(),
ProcessQBString(clitem.AccountNumber), ProcessQBString(clitem.AccountNumber),
@@ -2795,7 +2796,7 @@ namespace AyaNovaQBI
/// </summary> /// </summary>
/// <param name="a"></param> /// <param name="a"></param>
/// <returns></returns> /// <returns></returns>
private static Address ProcessAddress(IAddress a) private static Address ProcessAddress(IAddress a, string filteroutname, string filteroutcontact)
{ {
Address b = new Address(); Address b = new Address();
b.City = ""; b.City = "";
@@ -2807,13 +2808,31 @@ namespace AyaNovaQBI
//Append each line of the address, add cr/lf for each line if present after //Append each line of the address, add cr/lf for each line if present after
//the first line //the first line
//Assumption: First line always has *something* in it //Assumption: First line always has *something* in it
b.DeliveryAddress = ProcessQBString(a.Addr1);
b.DeliveryAddress += SS("\r\n", ProcessQBString(a.Addr2), ""); //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
b.DeliveryAddress += SS("\r\n", ProcessQBString(a.Addr3), ""); 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 //Address line 4 is a qbxml 2 or higher feature
if (QVersion > 1.1) 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: //Country specific:
b.City = ProcessQBString(a.City); b.City = ProcessQBString(a.City);
@@ -2963,24 +2982,27 @@ namespace AyaNovaQBI
if (clitem != null) if (clitem != null)
{ {
//add a record to the datatable //add a record to the datatable
var tempName = clitem.Name.GetValue();
var tempContact = ProcessQBString(clitem.Contact);
DataRow dr = _dtQBVendors.Rows.Add( DataRow dr = _dtQBVendors.Rows.Add(
new object[] new object[]
{ {
clitem.ListID.GetValue(), clitem.ListID.GetValue(),
clitem.Name.GetValue(), tempName,
ProcessAddress(clitem.VendorAddress), ProcessAddress(clitem.VendorAddress,tempName, tempContact),
ProcessAddress(clitem.VendorAddress), ProcessAddress(clitem.VendorAddress,
ProcessQBString(clitem.Phone), tempName,
ProcessQBString(clitem.Fax), tempContact),
ProcessQBString(clitem.AltPhone), ProcessQBString(clitem.Phone),
ProcessQBString(clitem.Email), ProcessQBString(clitem.Fax),
ProcessQBString(clitem.Contact), ProcessQBString(clitem.AltPhone),
clitem.TimeCreated.GetValue(), ProcessQBString(clitem.Email),
clitem.TimeModified.GetValue(), tempContact,
ProcessQBString(clitem.AccountNumber) clitem.TimeCreated.GetValue(),
}); clitem.TimeModified.GetValue(),
ProcessQBString(clitem.AccountNumber)
});
} }
} // for loop } // for loop
} // if } // if