This commit is contained in:
@@ -1956,7 +1956,7 @@ namespace AyaNova.PlugIn.V8
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion Tax codes
|
#endregion Tax codes
|
||||||
|
|
||||||
#region Memos
|
#region Memos
|
||||||
private async System.Threading.Tasks.Task ExportMemos(ProgressForm progress)
|
private async System.Threading.Tasks.Task ExportMemos(ProgressForm progress)
|
||||||
{
|
{
|
||||||
@@ -2424,48 +2424,63 @@ namespace AyaNova.PlugIn.V8
|
|||||||
#region ServiceBank
|
#region ServiceBank
|
||||||
private async System.Threading.Tasks.Task ExportServiceBank(ProgressForm progress)
|
private async System.Threading.Tasks.Task ExportServiceBank(ProgressForm progress)
|
||||||
{
|
{
|
||||||
|
if (BankedObjects.Count == 0) return;
|
||||||
ResetUniqueNames();
|
ResetUniqueNames();
|
||||||
if (!progress.KeepGoing) return;
|
if (!progress.KeepGoing) return;
|
||||||
progress.Op("Start Service Bank export");
|
progress.Op("Start Service Bank export");
|
||||||
progress.SubOp("");
|
progress.SubOp("");
|
||||||
var ObjectTypeName = "ServiceBank";
|
var ObjectTypeName = "ServiceBank";
|
||||||
|
progress.Append("Exporting service bank records for " + BankedObjects.Count.ToString() + " banked objects");
|
||||||
|
foreach (var bo in BankedObjects)
|
||||||
//Step 2: export the objects
|
|
||||||
TaxCodes pl = TaxCodes.GetItems();
|
|
||||||
progress.Append("Exporting " + pl.Count.ToString() + " " + ObjectTypeName + "s");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
foreach (TaxCode i in pl)
|
|
||||||
{
|
{
|
||||||
if (!progress.KeepGoing) return;
|
ServiceBankListRI pl = ServiceBankListRI.GetList(bo.Key, -1);
|
||||||
List<string> tags = new List<string>();
|
progress.Append("Exporting " + pl.Count.ToString() + " service bank records for object id " + bo.Key.ToString() + " type: " + bo.Value.ToString());
|
||||||
tags.Add(ImportTag);
|
|
||||||
|
|
||||||
dynamic d = new JObject();
|
//foreach (ServiceBankListRI.ServiceBankListRIInfo i in pl)
|
||||||
d.name = GetUniqueName(i.Name);
|
for (int x = 0; x < pl.Count; x++)
|
||||||
if (IsDuplicatev7v8IdMapItem(i.ID, i.Name, progress)) continue;
|
{
|
||||||
progress.Op(ObjectTypeName + " " + d.name);
|
|
||||||
d.active = i.Active;
|
|
||||||
|
|
||||||
d.taxA = i.TaxA;
|
if (!progress.KeepGoing) return;
|
||||||
d.taxB = i.TaxB;
|
ServiceBankListRI.ServiceBankListRIInfo i = pl[x];
|
||||||
d.taxOnTax = i.TaxOnTax;
|
|
||||||
|
|
||||||
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
|
#endregion ServiceBank
|
||||||
|
|||||||
Reference in New Issue
Block a user