This commit is contained in:
2022-07-12 21:41:03 +00:00
parent 42c0555923
commit d611304fa3
3 changed files with 224 additions and 211 deletions

View File

@@ -56,8 +56,8 @@
this.dataGridViewTextBoxColumn2 = new System.Windows.Forms.DataGridViewCheckBoxColumn(); this.dataGridViewTextBoxColumn2 = new System.Windows.Forms.DataGridViewCheckBoxColumn();
this.dataGridViewTextBoxColumn3 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.dataGridViewTextBoxColumn3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.label1 = new System.Windows.Forms.Label(); this.lblAyaNovaGridTitle = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label(); this.lblQuickBooksGridTitle = new System.Windows.Forms.Label();
this.menuStrip1.SuspendLayout(); this.menuStrip1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.gridAya)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.gridAya)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.gridQB)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.gridQB)).BeginInit();
@@ -324,38 +324,38 @@
// splitContainer1.Panel1 // splitContainer1.Panel1
// //
this.splitContainer1.Panel1.Controls.Add(this.gridAya); this.splitContainer1.Panel1.Controls.Add(this.gridAya);
this.splitContainer1.Panel1.Controls.Add(this.label1); this.splitContainer1.Panel1.Controls.Add(this.lblAyaNovaGridTitle);
// //
// splitContainer1.Panel2 // splitContainer1.Panel2
// //
this.splitContainer1.Panel2.Controls.Add(this.gridQB); this.splitContainer1.Panel2.Controls.Add(this.gridQB);
this.splitContainer1.Panel2.Controls.Add(this.label2); this.splitContainer1.Panel2.Controls.Add(this.lblQuickBooksGridTitle);
this.splitContainer1.Size = new System.Drawing.Size(783, 533); this.splitContainer1.Size = new System.Drawing.Size(783, 533);
this.splitContainer1.SplitterDistance = 338; this.splitContainer1.SplitterDistance = 338;
this.splitContainer1.SplitterWidth = 64; this.splitContainer1.SplitterWidth = 64;
this.splitContainer1.TabIndex = 6; this.splitContainer1.TabIndex = 6;
// //
// label1 // lblAyaNovaGridTitle
// //
this.label1.Dock = System.Windows.Forms.DockStyle.Top; this.lblAyaNovaGridTitle.Dock = System.Windows.Forms.DockStyle.Top;
this.label1.Font = new System.Drawing.Font("Tahoma", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.lblAyaNovaGridTitle.Font = new System.Drawing.Font("Tahoma", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label1.ForeColor = System.Drawing.Color.Navy; this.lblAyaNovaGridTitle.ForeColor = System.Drawing.Color.Navy;
this.label1.Location = new System.Drawing.Point(0, 0); this.lblAyaNovaGridTitle.Location = new System.Drawing.Point(0, 0);
this.label1.Name = "label1"; this.lblAyaNovaGridTitle.Name = "lblAyaNovaGridTitle";
this.label1.Size = new System.Drawing.Size(338, 23); this.lblAyaNovaGridTitle.Size = new System.Drawing.Size(338, 23);
this.label1.TabIndex = 5; this.lblAyaNovaGridTitle.TabIndex = 5;
this.label1.Text = "AyaNova"; this.lblAyaNovaGridTitle.Text = "AyaNova";
// //
// label2 // lblQuickBooksGridTitle
// //
this.label2.Dock = System.Windows.Forms.DockStyle.Top; this.lblQuickBooksGridTitle.Dock = System.Windows.Forms.DockStyle.Top;
this.label2.Font = new System.Drawing.Font("Tahoma", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.lblQuickBooksGridTitle.Font = new System.Drawing.Font("Tahoma", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label2.ForeColor = System.Drawing.Color.ForestGreen; this.lblQuickBooksGridTitle.ForeColor = System.Drawing.Color.ForestGreen;
this.label2.Location = new System.Drawing.Point(0, 0); this.lblQuickBooksGridTitle.Location = new System.Drawing.Point(0, 0);
this.label2.Name = "label2"; this.lblQuickBooksGridTitle.Name = "lblQuickBooksGridTitle";
this.label2.Size = new System.Drawing.Size(381, 23); this.lblQuickBooksGridTitle.Size = new System.Drawing.Size(381, 23);
this.label2.TabIndex = 6; this.lblQuickBooksGridTitle.TabIndex = 6;
this.label2.Text = "QuickBooks"; this.lblQuickBooksGridTitle.Text = "QuickBooks";
// //
// Map // Map
// //
@@ -400,8 +400,8 @@
private System.Windows.Forms.DataGridView gridAya; private System.Windows.Forms.DataGridView gridAya;
private System.Windows.Forms.DataGridView gridQB; private System.Windows.Forms.DataGridView gridQB;
private System.Windows.Forms.SplitContainer splitContainer1; private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.Label label1; private System.Windows.Forms.Label lblAyaNovaGridTitle;
private System.Windows.Forms.Label label2; private System.Windows.Forms.Label lblQuickBooksGridTitle;
private System.Windows.Forms.ToolStripMenuItem exportSelectedItemsToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem exportSelectedItemsToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem linkSelectedItemsToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem linkSelectedItemsToolStripMenuItem;
private System.Windows.Forms.DataGridViewTextBoxColumn AyaName; private System.Windows.Forms.DataGridViewTextBoxColumn AyaName;

View File

@@ -57,10 +57,11 @@ namespace AyaNovaQBI
Initialize(); Initialize();
gridAya.ClearSelection(); gridAya.ClearSelection();
gridQB.ClearSelection(); gridQB.ClearSelection();
this.Text = "Customers";
lblQuickBooksGridTitle.Text = "QuickBooks - Customers";
lblAyaNovaGridTitle.Text = "AyaNova - Customers";
} }
#region EXPORT #region EXPORT
private async void exportSelectedItemsToolStripMenuItem_Click(object sender, EventArgs e) private async void exportSelectedItemsToolStripMenuItem_Click(object sender, EventArgs e)
{ {
@@ -655,6 +656,191 @@ namespace AyaNovaQBI
} }
#endregion link manually #endregion link manually
#region UPDATE
private async void updateSelectedItemsToolStripMenuItem_Click(object sender, EventArgs e)
{
if (gridAya.SelectedRows.Count == 0 && gridQB.SelectedRows.Count == 0) return;
bool IsAyaGrid = false;
IsAyaGrid = gridAya.SelectedRows.Count > 0;
string sFrom = IsAyaGrid ? "QuickBooks" : "AyaNova";
string sTo = IsAyaGrid ? "AyaNova" : "QuickBooks";
MapApproveUpdateSelectedItems s = new MapApproveUpdateSelectedItems();
string sType = "";
switch (_Type)
{
case AyaType.Customer:
sType = "Customers";
break;
case AyaType.Vendor:
sType = "Vendors";
break;
case AyaType.Part:
sType = "Parts";
s.ShowUpdatePriceCostOnlyCheckBox = true;
break;
}
s.UpdateMessage = $"Update selected {sTo} {sType} from {sFrom} ";
if (s.ShowDialog() == DialogResult.Cancel)
return;
bool PricesOnly = s.PriceOnly;
s.Dispose();
Waiting w = new Waiting();
w.Show();
w.Ops = $"Updating {sTo} {sType} from {sFrom}...";
try
{
menuStrip1.Enabled = gridQB.Enabled = gridAya.Enabled = false;
bool SaveIntegration = false;
if (IsAyaGrid)
{
#region AyaGrid so UPDATE AYANOVA FROM QB
switch (_Type)
{
case AyaType.Customer:
await util.PopulateQBClientCacheAsync();
break;
case AyaType.Vendor:
await util.PopulateQBVendorCacheAsync();
break;
case AyaType.Part:
await util.PopulateQBItemCacheAsync();
break;
}
foreach (DataGridViewRow r in gridAya.SelectedRows)
{
string AyaName = r.Cells[0].Value.ToString();
long AyaId = (long)r.Cells[1].Value;
//only linked items can be updated
IntegrationItem im = util.QBIntegration.Items.FirstOrDefault(z => z.ObjectId == AyaId && z.AType == _Type);
if (im != null)
{
w.Step = AyaName;
switch (_Type)
{
case AyaType.Customer:
await util.RefreshAyaNovaCustomerFromQBAsync(im);
break;
case AyaType.Vendor:
await util.RefreshAyaNovaVendorFromQBAsync(im);
break;
case AyaType.Part:
await util.RefreshAyaNovaPartFromQBAsync(im, PricesOnly);
break;
}
SaveIntegration = true;
}
}
switch (_Type)
{
case AyaType.Customer:
w.Step = "Refreshing AyaNova Customers cache";
await util.PopulateAyaClientList();
break;
case AyaType.Vendor:
w.Step = "Refreshing AyaNova Vendors cache";
await util.PopulateAyaVendorList();
break;
case AyaType.Part:
w.Step = "Refreshing AyaNova Parts cache";
await util.PopulateAyaPartList();
break;
}
#endregion AyaGrid
}
else
{
#region QB GRID
foreach (DataGridViewRow r in gridQB.SelectedRows)
{
var QBItemName = r.Cells[0].Value.ToString();
var QBItemId = r.Cells[1].Value.ToString();
//only linked items can be updated
IntegrationItem im = util.QBIntegration.Items.FirstOrDefault(z => z.IntegrationItemId == QBItemId && z.AType == _Type);
if (im != null)
{
w.Step = QBItemName;
switch (_Type)
{
case AyaType.Customer:
await util.RefreshQBCustomerFromAyaNovaAsync(im);
break;
case AyaType.Vendor:
await util.RefreshQBVendorFromAyaNovaAsync(im);
break;
case AyaType.Part:
await util.RefreshQBPartFromAyaNova(im, PricesOnly);
break;
}
SaveIntegration = true;
}
}
switch (_Type)
{
case AyaType.Customer:
w.Step = "Refreshing QB Customers cache";
await util.PopulateQBClientCacheAsync();
break;
case AyaType.Vendor:
w.Step = "Refreshing QB Vendors cache";
await util.PopulateQBVendorCacheAsync();
break;
case AyaType.ServiceRate:
case AyaType.TravelRate:
case AyaType.Part:
w.Step = "Refreshing QB Items cache";
await util.PopulateQBItemCacheAsync();
break;
}
#endregion qb grid
}
if (SaveIntegration)
{
await util.SaveIntegrationObject();
Initialize();
}
}
catch (Exception ex)
{
w.Visible = false;
await util.CrackDisplayAndIntegrationLogException(ex, "QBI:Map:UpdateSelectedItems");
}
finally
{
w.Close();
menuStrip1.Enabled = gridQB.Enabled = gridAya.Enabled = true;
}
}//eof
#endregion update
#region Initialize stuff #region Initialize stuff
/// <summary> /// <summary>
/// Determine if row should be added to grid or now /// Determine if row should be added to grid or now
@@ -892,6 +1078,8 @@ namespace AyaNovaQBI
if (_Type == AyaType.Customer) return; if (_Type == AyaType.Customer) return;
_Type = AyaType.Customer; _Type = AyaType.Customer;
this.Text = "Customers"; this.Text = "Customers";
lblQuickBooksGridTitle.Text = "QuickBooks - Customers";
lblAyaNovaGridTitle.Text = "AyaNova - Customers";
updateSelectedItemsToolStripMenuItem.Visible = true; updateSelectedItemsToolStripMenuItem.Visible = true;
Initialize(); Initialize();
} }
@@ -902,6 +1090,8 @@ namespace AyaNovaQBI
if (_Type == AyaType.ServiceRate) return; if (_Type == AyaType.ServiceRate) return;
_Type = AyaType.ServiceRate; _Type = AyaType.ServiceRate;
this.Text = "Service rates"; this.Text = "Service rates";
lblQuickBooksGridTitle.Text = "QuickBooks - Service / Other items";
lblAyaNovaGridTitle.Text = "AyaNova - Service rates";
updateSelectedItemsToolStripMenuItem.Visible = false; updateSelectedItemsToolStripMenuItem.Visible = false;
Initialize(); Initialize();
} }
@@ -912,6 +1102,8 @@ namespace AyaNovaQBI
if (_Type == AyaType.TravelRate) return; if (_Type == AyaType.TravelRate) return;
_Type = AyaType.TravelRate; _Type = AyaType.TravelRate;
this.Text = "Travel rates"; this.Text = "Travel rates";
lblQuickBooksGridTitle.Text = "QuickBooks - Service / Other items";
lblAyaNovaGridTitle.Text = "AyaNova - Travel rates";
updateSelectedItemsToolStripMenuItem.Visible = false; updateSelectedItemsToolStripMenuItem.Visible = false;
Initialize(); Initialize();
} }
@@ -922,6 +1114,8 @@ namespace AyaNovaQBI
if (_Type == AyaType.Part) return; if (_Type == AyaType.Part) return;
_Type = AyaType.Part; _Type = AyaType.Part;
this.Text = "Parts"; this.Text = "Parts";
lblQuickBooksGridTitle.Text = "QuickBooks - Inventory / non-inventory / assembly items";
lblAyaNovaGridTitle.Text = "AyaNova - Parts";
updateSelectedItemsToolStripMenuItem.Visible = true; updateSelectedItemsToolStripMenuItem.Visible = true;
Initialize(); Initialize();
if (!util.QBIntegration.Items.Any(z => z.AType == AyaType.Vendor)) if (!util.QBIntegration.Items.Any(z => z.AType == AyaType.Vendor))
@@ -943,6 +1137,8 @@ namespace AyaNovaQBI
if (_Type == AyaType.Vendor) return; if (_Type == AyaType.Vendor) return;
_Type = AyaType.Vendor; _Type = AyaType.Vendor;
this.Text = "Vendors"; this.Text = "Vendors";
lblQuickBooksGridTitle.Text = "QuickBooks - Vendors";
lblAyaNovaGridTitle.Text = "AyaNova - Vendors";
updateSelectedItemsToolStripMenuItem.Visible = true; updateSelectedItemsToolStripMenuItem.Visible = true;
Initialize(); Initialize();
} }
@@ -991,187 +1187,5 @@ namespace AyaNovaQBI
private async void updateSelectedItemsToolStripMenuItem_Click(object sender, EventArgs e)
{
if (gridAya.SelectedRows.Count == 0 && gridQB.SelectedRows.Count == 0) return;
bool IsAyaGrid = false;
IsAyaGrid = gridAya.SelectedRows.Count > 0;
string sFrom = IsAyaGrid ? "QuickBooks" : "AyaNova";
string sTo = IsAyaGrid ? "AyaNova" : "QuickBooks";
MapApproveUpdateSelectedItems s = new MapApproveUpdateSelectedItems();
string sType = "";
switch (_Type)
{
case AyaType.Customer:
sType = "Customers";
break;
case AyaType.Vendor:
sType = "Vendors";
break;
case AyaType.Part:
sType = "Parts";
s.ShowUpdatePriceCostOnlyCheckBox = true;
break;
}
s.UpdateMessage = $"Update selected {sTo} {sType} from {sFrom} ";
if (s.ShowDialog() == DialogResult.Cancel)
return;
bool PricesOnly = s.PriceOnly;
s.Dispose();
Waiting w = new Waiting();
w.Show();
w.Ops = $"Updating {sTo} {sType} from {sFrom}...";
try
{
menuStrip1.Enabled = gridQB.Enabled = gridAya.Enabled = false;
bool SaveIntegration = false;
if (IsAyaGrid)
{
#region AyaGrid so UPDATE AYANOVA FROM QB
switch (_Type)
{
case AyaType.Customer:
await util.PopulateQBClientCacheAsync();
break;
case AyaType.Vendor:
await util.PopulateQBVendorCacheAsync();
break;
case AyaType.Part:
await util.PopulateQBItemCacheAsync();
break;
}
foreach (DataGridViewRow r in gridAya.SelectedRows)
{
string AyaName = r.Cells[0].Value.ToString();
long AyaId = (long)r.Cells[1].Value;
//only linked items can be updated
IntegrationItem im = util.QBIntegration.Items.FirstOrDefault(z => z.ObjectId == AyaId && z.AType == _Type);
if (im != null)
{
w.Step = AyaName;
switch (_Type)
{
case AyaType.Customer:
await util.RefreshAyaNovaCustomerFromQBAsync(im);
break;
case AyaType.Vendor:
await util.RefreshAyaNovaVendorFromQBAsync(im);
break;
case AyaType.Part:
await util.RefreshAyaNovaPartFromQBAsync(im, PricesOnly);
break;
}
SaveIntegration = true;
}
}
switch (_Type)
{
case AyaType.Customer:
w.Step = "Refreshing AyaNova Customers cache";
await util.PopulateAyaClientList();
break;
case AyaType.Vendor:
w.Step = "Refreshing AyaNova Vendors cache";
await util.PopulateAyaVendorList();
break;
case AyaType.Part:
w.Step = "Refreshing AyaNova Parts cache";
await util.PopulateAyaPartList();
break;
}
#endregion AyaGrid
}
else
{
#region QB GRID
foreach (DataGridViewRow r in gridQB.SelectedRows)
{
var QBItemName = r.Cells[0].Value.ToString();
var QBItemId = r.Cells[1].Value.ToString();
//only linked items can be updated
IntegrationItem im = util.QBIntegration.Items.FirstOrDefault(z => z.IntegrationItemId == QBItemId && z.AType == _Type);
if (im != null)
{
w.Step = QBItemName;
switch (_Type)
{
case AyaType.Customer:
await util.RefreshQBCustomerFromAyaNovaAsync(im);
break;
case AyaType.Vendor:
await util.RefreshQBVendorFromAyaNovaAsync(im);
break;
case AyaType.Part:
await util.RefreshQBPartFromAyaNova(im, PricesOnly);
break;
}
SaveIntegration = true;
}
}
switch (_Type)
{
case AyaType.Customer:
w.Step = "Refreshing QB Customers cache";
await util.PopulateQBClientCacheAsync();
break;
case AyaType.Vendor:
w.Step = "Refreshing QB Vendors cache";
await util.PopulateQBVendorCacheAsync();
break;
case AyaType.ServiceRate:
case AyaType.TravelRate:
case AyaType.Part:
w.Step = "Refreshing QB Items cache";
await util.PopulateQBItemCacheAsync();
break;
}
#endregion qb grid
}
if (SaveIntegration)
{
await util.SaveIntegrationObject();
Initialize();
}
}
catch (Exception ex)
{
w.Visible = false;
await util.CrackDisplayAndIntegrationLogException(ex, "QBI:Map:UpdateSelectedItems");
}
finally
{
w.Close();
menuStrip1.Enabled = gridQB.Enabled = gridAya.Enabled = true;
}
}//eof
}//eoc }//eoc
}//eons }//eons

View File

@@ -2,9 +2,6 @@
change accounting integration status to be appropriate for viewing in workorder
Proper case and something like "Accounting integration edit".
link and sync title not initiated to customers on open requires seletion in menu of object type toset link and sync title not initiated to customers on open requires seletion in menu of object type toset
@@ -14,6 +11,8 @@ setup wizard all dialogs showing in taskbar wrong logo remove from tbar or fix l
Test persisted form settings for server url (ONCE POSTED NEW BUILD OF AYANOVA TO TEST SERVER) Test persisted form settings for server url (ONCE POSTED NEW BUILD OF AYANOVA TO TEST SERVER)
Docs mention must be accoutning role user Docs mention must be accoutning role user
Docs mention that any existing work order statuses that might be set on wo to be invoiced MUST have Accounting role added to their REMOVE and ADD,
also POSTWOSTATUS must have allow ADD accounting role
docs mention status required for it to work don't fuck with it and if necessary how to fix it docs mention status required for it to work don't fuck with it and if necessary how to fix it
Docs should not refer to autoclose anymore, it's status driven now Docs should not refer to autoclose anymore, it's status driven now
DOCS UI use "Link" and do not use "map" anywhere DOCS UI use "Link" and do not use "map" anywhere