From fe0fea3499342078867e1f075461a9325046aae8 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Tue, 29 Dec 2020 15:52:51 +0000 Subject: [PATCH] --- source/Plugins/AyaNova.Plugin.V8/V8.cs | 50 ++++++++++++++++++++++++ source/Plugins/AyaNova.Plugin.V8/util.cs | 3 +- 2 files changed, 52 insertions(+), 1 deletion(-) diff --git a/source/Plugins/AyaNova.Plugin.V8/V8.cs b/source/Plugins/AyaNova.Plugin.V8/V8.cs index da2c9d6..99cfe33 100644 --- a/source/Plugins/AyaNova.Plugin.V8/V8.cs +++ b/source/Plugins/AyaNova.Plugin.V8/V8.cs @@ -305,6 +305,7 @@ namespace AyaNova.PlugIn.V8 await ExportLocales(progress); await ExportStaffUsers(progress); await ExportRates(progress); + await ExportTaxCodes(progress); await ExportContracts(progress); await ExportHeadOffices(progress); await ExportClients(progress); @@ -1892,6 +1893,55 @@ namespace AyaNova.PlugIn.V8 } #endregion Rates + #region TaxCodes + private async System.Threading.Tasks.Task ExportTaxCodes(ProgressForm progress) + { + ResetUniqueNames(); + if (!progress.KeepGoing) return; + progress.Op("Start Tax codes export"); + progress.SubOp(""); + var ObjectTypeName = "TaxCode"; + + + //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; + List tags = new List(); + tags.Add(ImportTag); + + dynamic d = new JObject(); + d.name = GetUniqueName(i.Name); + if (IsDuplicateMapItem(i.ID, i.Name, progress)) continue; + progress.Op(ObjectTypeName + " " + d.name); + d.active = i.Active; + + d.taxA = i.TaxA; + d.taxB = i.TaxB; + d.taxOnTax = i.TaxOnTax; + + SetTags(d, tags); + + + var rMainObject = await util.PostAsync("tax-code", d.ToString()); + long RavenId = util.IdFromResponse(rMainObject); + AddMap(i.ID, RavenId); + + + //----- + + //Event log fixup + await util.EventLog(util.AyaType.TaxCode, RavenId, SafeGetUserMap(i.Creator), SafeGetUserMap(i.Modifier), i.Created, i.Modified); + + } + } + #endregion Tax codes + #region Memos private async System.Threading.Tasks.Task ExportMemos(ProgressForm progress) diff --git a/source/Plugins/AyaNova.Plugin.V8/util.cs b/source/Plugins/AyaNova.Plugin.V8/util.cs index b45ccde..0fa597d 100644 --- a/source/Plugins/AyaNova.Plugin.V8/util.cs +++ b/source/Plugins/AyaNova.Plugin.V8/util.cs @@ -575,7 +575,8 @@ namespace AyaNova.PlugIn.V8 //corebizobject Review = 61, ServiceRate = 62, - TravelRate = 63 + TravelRate = 63, + TaxCode=64