This commit is contained in:
2022-07-11 22:24:16 +00:00
parent d404ae94eb
commit dd2bc1490c

View File

@@ -6195,10 +6195,7 @@ namespace AyaNovaQBI
if (s.IndexOf("~SERVDATE~") != -1) if (s.IndexOf("~SERVDATE~") != -1)
{ {
var servDateString = "-"; s = s.Replace("~SERVDATE~", DateToLocalString(w.ServiceDate));
if (w.ServiceDate != null)
servDateString = ((DateTime)w.ServiceDate).ToLocalTime().ToString();
s = s.Replace("~SERVDATE~", servDateString);
} }
if (s.IndexOf("~STAT~") != -1) if (s.IndexOf("~STAT~") != -1)
@@ -6325,12 +6322,12 @@ namespace AyaNovaQBI
if (s.IndexOf("~ITEM_TAGS~") != -1) if (s.IndexOf("~ITEM_TAGS~") != -1)
{ {
s = s.Replace("~ITEM_TAGS~", String.Join(",", it.Tags)); s = s.Replace("~ITEM_TAGS~", string.Join(",", it.Tags));
} }
if (s.IndexOf("~ITEM_REQUEST_DATE~") != -1) if (s.IndexOf("~ITEM_REQUEST_DATE~") != -1)
{ {
s = s.Replace("~ITEM_REQUEST_DATE~", it.RequestDate.ToString()); s = s.Replace("~ITEM_REQUEST_DATE~", DateToLocalString(it.RequestDate));
} }
if (s.IndexOf("~ITEM_STATUS~") != -1) if (s.IndexOf("~ITEM_STATUS~") != -1)
@@ -6405,12 +6402,12 @@ namespace AyaNovaQBI
if (s.IndexOf("~SERVICE_START~") != -1) if (s.IndexOf("~SERVICE_START~") != -1)
{ {
s = s.Replace("~SERVICE_START~", wl.ServiceStartDate.ToString()); s = s.Replace("~SERVICE_START~",DateToLocalString(wl.ServiceStartDate));
} }
if (s.IndexOf("~SERVICE_STOP~") != -1) if (s.IndexOf("~SERVICE_STOP~") != -1)
{ {
s = s.Replace("~SERVICE_STOP~", wl.ServiceStopDate.ToString()); s = s.Replace("~SERVICE_STOP~", DateToLocalString(wl.ServiceStopDate));
} }
if (s.IndexOf("~SERVICE_QUANTITY~") != -1) if (s.IndexOf("~SERVICE_QUANTITY~") != -1)
@@ -6426,12 +6423,12 @@ namespace AyaNovaQBI
if (s.IndexOf("~RATE_NAME~") != -1) if (s.IndexOf("~RATE_NAME~") != -1)
{ {
s = s.Replace("~RATE_NAME~", AyaRateList[wl.ServiceRateID].Name); s = s.Replace("~RATE_NAME~", AyaServiceRateList.First(z => z.Id == wl.ServiceRateId).Name);
} }
if (s.IndexOf("~SERVICE_TECH~") != -1) if (s.IndexOf("~SERVICE_TECH~") != -1)
{ {
s = s.Replace("~SERVICE_TECH~", UserPickList.GetListOfOneSpecificUser(wl.UserID)[0].Name); s = s.Replace("~SERVICE_TECH~", wl.UserViz);
} }
if (s.IndexOf("~DETAILS~") != -1) if (s.IndexOf("~DETAILS~") != -1)
@@ -6439,9 +6436,6 @@ namespace AyaNovaQBI
s = s.Replace("~DETAILS~", wl.ServiceDetails); s = s.Replace("~DETAILS~", wl.ServiceDetails);
} }
InvoiceAddText(i, s); InvoiceAddText(i, s);
} }
} }
@@ -6456,12 +6450,12 @@ namespace AyaNovaQBI
if (s.IndexOf("~TRAVEL_START~") != -1) if (s.IndexOf("~TRAVEL_START~") != -1)
{ {
s = s.Replace("~TRAVEL_START~", wt.TravelStartDate.ToString()); s = s.Replace("~TRAVEL_START~", DateToLocalString(wt.TravelStartDate));
} }
if (s.IndexOf("~TRAVEL_STOP~") != -1) if (s.IndexOf("~TRAVEL_STOP~") != -1)
{ {
s = s.Replace("~TRAVEL_STOP~", wt.TravelStopDate.ToString()); s = s.Replace("~TRAVEL_STOP~", DateToLocalString(wt.TravelStopDate));
} }
if (s.IndexOf("~TRAVEL_QUANTITY~") != -1) if (s.IndexOf("~TRAVEL_QUANTITY~") != -1)
@@ -6476,12 +6470,12 @@ namespace AyaNovaQBI
if (s.IndexOf("~TRAVEL_RATE_NAME~") != -1) if (s.IndexOf("~TRAVEL_RATE_NAME~") != -1)
{ {
s = s.Replace("~TRAVEL_RATE_NAME~", AyaRateList[wt.TravelRateID].Name); s = s.Replace("~TRAVEL_RATE_NAME~", AyaTravelRateList.First(z => z.Id == wt.TravelRateId).Name);
} }
if (s.IndexOf("~TRAVEL_TECH~") != -1) if (s.IndexOf("~TRAVEL_TECH~") != -1)
{ {
s = s.Replace("~TRAVEL_TECH~", UserPickList.GetListOfOneSpecificUser(wt.UserID)[0].Name); s = s.Replace("~TRAVEL_TECH~", wt.UserViz);
} }
if (s.IndexOf("~TRAVEL_DETAILS~") != -1) if (s.IndexOf("~TRAVEL_DETAILS~") != -1)
@@ -6502,43 +6496,39 @@ namespace AyaNovaQBI
#region Outside fields #region Outside fields
if (!string.IsNullOrWhiteSpace(QDat.OutsideServiceChargeAs)) if (!string.IsNullOrWhiteSpace(QDat.OutsideServiceChargeAs))
{ {
foreach (var os in it.OutsideServices) foreach (var os in it.OutsideServices)
{ {
TODO: LOOPIFY FROM ANOTHER this inside biody
string s = QDat.InvoiceOutsideServiceTemplate; string s = QDat.InvoiceOutsideServiceTemplate;
if (s.IndexOf("~REPAIR_PRICE~") != -1) if (s.IndexOf("~REPAIR_PRICE~") != -1)
{ {
s = s.Replace("~REPAIR_PRICE~", it.OutsideService.RepairPrice.ToString("c")); s = s.Replace("~REPAIR_PRICE~", os.RepairPrice.ToString("c"));
} }
if (s.IndexOf("~SHIP_CHARGE~") != -1) if (s.IndexOf("~SHIP_CHARGE~") != -1)
{ {
s = s.Replace("~SHIP_CHARGE~", it.OutsideService.ShippingPrice.ToString("c")); s = s.Replace("~SHIP_CHARGE~", os.ShippingPrice.ToString("c"));
} }
if (s.IndexOf("~SENT~") != -1) if (s.IndexOf("~SENT~") != -1)
{ {
s = s.Replace("~SENT~", it.OutsideService.DateSent.ToString()); s = s.Replace("~SENT~", DateToLocalString(os.SentDate));
} }
if (s.IndexOf("~RETURNED~") != -1) if (s.IndexOf("~RETURNED~") != -1)
{ {
s = s.Replace("~RETURNED~", it.OutsideService.DateReturned.ToString()); s = s.Replace("~RETURNED~", DateToLocalString(os.ReturnDate));
} }
if (s.IndexOf("~NOTES~") != -1) if (s.IndexOf("~NOTES~") != -1)
{ {
s = s.Replace("~NOTES~", it.OutsideService.Notes); s = s.Replace("~NOTES~", os.Notes);
} }
InvoiceAddText(i, s);
} }
InvoiceAddText(i, s);
} }
#endregion outside service #endregion outside service
@@ -6566,7 +6556,7 @@ namespace AyaNovaQBI
if (s.IndexOf("~TECH~") != -1) if (s.IndexOf("~TECH~") != -1)
{ {
s = s.Replace("~TECH~", UserPickList.GetListOfOneSpecificUser(e.UserID)[0].Name); s = s.Replace("~TECH~", e.UserViz);
} }
InvoiceAddText(i, s); InvoiceAddText(i, s);
@@ -6704,6 +6694,8 @@ namespace AyaNovaQBI
} }
@@ -6790,6 +6782,15 @@ namespace AyaNovaQBI
return fileVersion.Major.ToString() + "." + fileVersion.Minor.ToString(); return fileVersion.Major.ToString() + "." + fileVersion.Minor.ToString();
} }
//v8 dates come in utc format and many are empty potentially so need to deal with that
private static string DateToLocalString(DateTime? d)
{
var servDateString = "-";
if (d != null)
servDateString = ((DateTime)d).ToLocalTime().ToString();
return servDateString;
}
#endregion general utils #endregion general utils
}//EOC }//EOC