This commit is contained in:
@@ -1956,7 +1956,7 @@ namespace AyaNova.PlugIn.V8
|
||||
}
|
||||
}
|
||||
#endregion Tax codes
|
||||
|
||||
|
||||
#region Memos
|
||||
private async System.Threading.Tasks.Task ExportMemos(ProgressForm progress)
|
||||
{
|
||||
@@ -2424,48 +2424,63 @@ namespace AyaNova.PlugIn.V8
|
||||
#region ServiceBank
|
||||
private async System.Threading.Tasks.Task ExportServiceBank(ProgressForm progress)
|
||||
{
|
||||
if (BankedObjects.Count == 0) return;
|
||||
ResetUniqueNames();
|
||||
if (!progress.KeepGoing) return;
|
||||
progress.Op("Start Service Bank export");
|
||||
progress.SubOp("");
|
||||
var ObjectTypeName = "ServiceBank";
|
||||
|
||||
|
||||
//Step 2: export the objects
|
||||
TaxCodes pl = TaxCodes.GetItems();
|
||||
progress.Append("Exporting " + pl.Count.ToString() + " " + ObjectTypeName + "s");
|
||||
|
||||
|
||||
|
||||
foreach (TaxCode i in pl)
|
||||
progress.Append("Exporting service bank records for " + BankedObjects.Count.ToString() + " banked objects");
|
||||
foreach (var bo in BankedObjects)
|
||||
{
|
||||
if (!progress.KeepGoing) return;
|
||||
List<string> tags = new List<string>();
|
||||
tags.Add(ImportTag);
|
||||
ServiceBankListRI pl = ServiceBankListRI.GetList(bo.Key, -1);
|
||||
progress.Append("Exporting " + pl.Count.ToString() + " service bank records for object id " + bo.Key.ToString() + " type: " + bo.Value.ToString());
|
||||
|
||||
dynamic d = new JObject();
|
||||
d.name = GetUniqueName(i.Name);
|
||||
if (IsDuplicatev7v8IdMapItem(i.ID, i.Name, progress)) continue;
|
||||
progress.Op(ObjectTypeName + " " + d.name);
|
||||
d.active = i.Active;
|
||||
//foreach (ServiceBankListRI.ServiceBankListRIInfo i in pl)
|
||||
for (int x = 0; x < pl.Count; x++)
|
||||
{
|
||||
|
||||
d.taxA = i.TaxA;
|
||||
d.taxB = i.TaxB;
|
||||
d.taxOnTax = i.TaxOnTax;
|
||||
if (!progress.KeepGoing) return;
|
||||
ServiceBankListRI.ServiceBankListRIInfo i = pl[x];
|
||||
|
||||
SetTags(d, tags);
|
||||
dynamic d = new JObject();
|
||||
d.name = i.LT_ServiceBank_Label_Description;
|
||||
progress.Op(ObjectTypeName + " " + d.name);
|
||||
d.entryDate = util.DateToV8(i.LT_ServiceBank_Label_Created);
|
||||
//Guid empty is valid, particularly if it's an adjustment for a deleted workorder or something
|
||||
d.sourceId = i.LT_ServiceBank_Label_SourceRootObjectType.Value == Guid.Empty ? 0 : Getv7v8IdMap(i.LT_ServiceBank_Label_SourceRootObjectType.Value, "Service bank record's source object id");
|
||||
d.sourceType = util.RootObjectToAyaType(i.LT_ServiceBank_Label_SourceRootObjectType.RootObjectType);
|
||||
|
||||
d.objectId = Getv7v8IdMap(bo.Key, "Service bank record's root object id");
|
||||
d.objectType = util.RootObjectToAyaType(bo.Value);
|
||||
d.incidents = i.LT_ServiceBank_Label_Incidents;
|
||||
d.incidentsBalance = i.LT_ServiceBank_Label_IncidentsBalance;
|
||||
d.currency = i.LT_ServiceBank_Label_Currency;
|
||||
d.currencyBalance = i.LT_ServiceBank_Label_CurrencyBalance;
|
||||
d.hours = i.LT_ServiceBank_Label_Hours;
|
||||
d.hoursBalance = i.LT_ServiceBank_Label_HoursBalance;
|
||||
//Last values
|
||||
if (x > 0)
|
||||
{
|
||||
ServiceBankListRI.ServiceBankListRIInfo iLast = pl[x - 1];
|
||||
d.lastEntryDate = util.DateToV8(iLast.LT_ServiceBank_Label_Created);
|
||||
d.lastIncidentsBalance = iLast.LT_ServiceBank_Label_IncidentsBalance;
|
||||
d.lastCurrencyBalance = iLast.LT_ServiceBank_Label_CurrencyBalance;
|
||||
d.lastHoursBalance = iLast.LT_ServiceBank_Label_HoursBalance;
|
||||
}
|
||||
|
||||
var rMainObject = await util.PostAsync("service-bank", d.ToString());
|
||||
long RavenId = util.IdFromResponse(rMainObject);
|
||||
// Addv7v8IdMap(i.ID, RavenId);
|
||||
|
||||
|
||||
var rMainObject = await util.PostAsync("tax-code", d.ToString());
|
||||
long RavenId = util.IdFromResponse(rMainObject);
|
||||
Addv7v8IdMap(i.ID, RavenId);
|
||||
//-----
|
||||
|
||||
//Event log fixup
|
||||
ServiceBank sb = ServiceBank.GetItem(i.LT_ServiceBank_Label_ID);
|
||||
await util.EventLog(util.AyaType.ServiceBank, RavenId, SafeGetUserMap(sb.Creator), SafeGetUserMap(sb.Creator), sb.Created, sb.Created);
|
||||
|
||||
//-----
|
||||
|
||||
//Event log fixup
|
||||
await util.EventLog(util.AyaType.TaxCode, RavenId, SafeGetUserMap(i.Creator), SafeGetUserMap(i.Modifier), i.Created, i.Modified);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion ServiceBank
|
||||
|
||||
Reference in New Issue
Block a user