This commit is contained in:
2022-07-11 21:21:12 +00:00
parent 4dd2df03cf
commit b65a47886b
4 changed files with 170 additions and 192 deletions

View File

@@ -6345,23 +6345,19 @@ namespace AyaNovaQBI
#region Unit fields
if (!string.IsNullOrWhiteSpace(QDat.InvoiceUnitTemplate))
{
foreach (var u in it.units)
foreach (var u in it.Units)
{
string s = QDat.InvoiceUnitTemplate;
UnitPickList up = UnitPickList.GetListOfOneSpecificUnit(it.UnitID);
if (s.IndexOf("~AYAFORMAT~") != -1)
if (s.IndexOf("~UNIT_DESC~") != -1)
{
s = s.Replace("~AYAFORMAT~", up[0].UnitName());
s = s.Replace("~UNIT_DESC~", u.UnitDescriptionViz);
}
if (s.IndexOf("~UNIT_SN~") != -1)
if (s.IndexOf("~UNIT_NAME~") != -1)
{
s = s.Replace("~UNIT_SN~", up[0].Serial);
s = s.Replace("~UNIT_NAME~", u.UnitViz);
}
if (s.IndexOf("~UNIT_METER~") != -1)
@@ -6369,23 +6365,24 @@ namespace AyaNovaQBI
if (!up[0].Metered)
s = s.Replace("~UNIT_METER~", "");
else
s = s.Replace("~UNIT_METER~", Unit.LastMeterReading(up[0].ID).ToString());
s = s.Replace("~UNIT_METER~", u.UnitLastMeterViz);
}
if (s.IndexOf("~UNIT_MAKE~") != -1)
{
s = s.Replace("~UNIT_MAKE~", up[0].VendorName);
s = s.Replace("~UNIT_MAKE~", u.UnitModelVendorViz);
}
if (s.IndexOf("~UNIT_MODEL_NAME~") != -1)
{
s = s.Replace("~UNIT_MODEL_NAME~", up[0].ModelName);
s = s.Replace("~UNIT_MODEL_NAME~", u.UnitModelNameViz);
}
if (s.IndexOf("~UNIT_MODEL_NUMBER~") != -1)
{
s = s.Replace("~UNIT_MODEL_NUMBER~", up[0].ModelNumber);
}
//in v8 model number and name are combined in single name field and imported from v7 {model_number}+{model_name} so name covers both
//if (s.IndexOf("~UNIT_MODEL_NUMBER~") != -1)
//{
// s = s.Replace("~UNIT_MODEL_NUMBER~", u.viz);
//}
InvoiceAddText(i, s);
}