diff --git a/Logic/Financial/ExternalBankData.cs b/Logic/Financial/ExternalBankData.cs
index 15f47766..2f89aadd 100644
--- a/Logic/Financial/ExternalBankData.cs
+++ b/Logic/Financial/ExternalBankData.cs
@@ -225,13 +225,13 @@ namespace Swarmops.Logic.Financial
this.MasterCents = new long[0];
this.SwarmopsCents = new long[0];
this.TransactionDependencies = new object[0];
- this.ResyncAction = ExternalBankMismatchResyncAction.Unknown;
+ this.ResyncActions = new ExternalBankMismatchResyncAction[0];
}
public string Description;
public long[] MasterCents; // may have multiple txs with this description
public long[] SwarmopsCents; // may have multiple txs with this description
- public ExternalBankMismatchResyncAction ResyncAction;
+ public ExternalBankMismatchResyncAction[] ResyncActions;
public object[] TransactionDependencies; // matching the Swarmops array
}
@@ -263,6 +263,10 @@ namespace Swarmops.Logic.Financial
{
Unknown = 0,
///
+ /// No action necessary
+ ///
+ NoAction,
+ ///
/// Zero out and rewrite the Swarmops database transaction
///
RewriteSwarmops,
diff --git a/Site5/Pages/v5/Ledgers/Json-ResyncPreview.aspx.cs b/Site5/Pages/v5/Ledgers/Json-ResyncPreview.aspx.cs
index 8c0435a3..69dd200b 100644
--- a/Site5/Pages/v5/Ledgers/Json-ResyncPreview.aspx.cs
+++ b/Site5/Pages/v5/Ledgers/Json-ResyncPreview.aspx.cs
@@ -48,11 +48,14 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
foreach (ExternalBankMismatchingRecordDescription mismatchingRecord in mismatch.MismatchingRecords)
{
- childItems.Add("{\"id\":\"" + rowId + childItems.Count.ToString("##0") + "\",\"rowName\":\"" +
- JsonSanitize(mismatchingRecord.Description) + "\",\"swarmopsData\":\"" +
- PrintCentsArray(mismatchingRecord.SwarmopsCents) + "\",\"masterData\":\"" +
- PrintCentsArray(mismatchingRecord.MasterCents) + "\",\"notes\":\"" +
- JsonSanitize("-todo-") + "\"}");
+ for (int masterIndex = 0; masterIndex < mismatchingRecord.MasterCents.Count(); masterIndex++)
+ {
+ childItems.Add("{\"id\":\"" + rowId + childItems.Count.ToString("##0") + "\",\"rowName\":\"" +
+ JsonSanitize(mismatchingRecord.Description) + "\",\"swarmopsData\":\"" +
+ PrintNullableCents(mismatchingRecord.SwarmopsCents[masterIndex]) + "\",\"masterData\":\"" +
+ PrintNullableCents(mismatchingRecord.MasterCents[masterIndex]) + "\",\"notes\":\"" +
+ JsonSanitize(mismatchingRecord.ResyncActions[masterIndex].ToString()) + "\"}");
+ }
}
string childrenString = String.Join(",", childItems.ToArray());
@@ -80,6 +83,16 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
private Dictionary _hashedAccounts;
+ private string PrintNullableCents (long cents)
+ {
+ if (cents == 0)
+ {
+ return Resources.Global.Global_Missing;
+ }
+
+ return (((double)cents) / 100.0).ToString("N2"); // TODO: Verify that culture is applied
+ }
+
private string PrintCents (long cents)
{
return (((double) cents) / 100.0).ToString("N2"); // TODO: Verify that culture is applied
diff --git a/Site5/Pages/v5/Ledgers/ResyncExternalAccount.aspx.cs b/Site5/Pages/v5/Ledgers/ResyncExternalAccount.aspx.cs
index 88d307e0..88233362 100644
--- a/Site5/Pages/v5/Ledgers/ResyncExternalAccount.aspx.cs
+++ b/Site5/Pages/v5/Ledgers/ResyncExternalAccount.aspx.cs
@@ -304,16 +304,149 @@ namespace Swarmops.Frontend.Pages.v5.Ledgers
mismatchConstruction.Swarmops[swarmopsTransaction.Description].Dependencies.Add(swarmopsTransaction.Dependency);
}
- // Then, parse the construction object to the presentation object.
+ // Then, parse the intermediate construction object to the presentation-and-action object.
Dictionary mismatchingRecordList = new Dictionary();
foreach (string masterKey in mismatchConstruction.Master.Keys)
{
+ Dictionary checkMasterIndex = new Dictionary();
+ Dictionary checkSwarmopsIndex = new Dictionary();
+
+ // For each key and entry for each key;
+
+ // 1) locate an exact corresponding amount in swarmops records and log; failing that,
+ // 2) if exactly one record left in master and swarmops records, log; failing that,
+ // 3) log the rest of the master OR rest of swarmops records with no corresponding
+ // equivalent with counterpart. (May produce bad results if 2 consistent mismatches
+ // for every description.)
+
ExternalBankMismatchingRecordDescription newRecord =
new ExternalBankMismatchingRecordDescription();
newRecord.Description = masterKey;
- newRecord.MasterCents = mismatchConstruction.Master[masterKey].Cents.ToArray();
+
+ List masterCentsList = new List();
+ List swarmopsCentsList = new List();
+ List