From 2e26823b2ff32fb66fd7fc0e97ebe58c3be45c54 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Sun, 10 Jul 2022 00:29:01 +0000 Subject: [PATCH] --- AyaNovaQBI/AyaNovaQBI.csproj | 9 ++ AyaNovaQBI/FixInvoiceProblems.cs | 77 +++++++------- AyaNovaQBI/FixPriceDifference.Designer.cs | 119 +++++++++++++++++++++ AyaNovaQBI/FixPriceDifference.cs | 48 +++++++++ AyaNovaQBI/FixPriceDifference.resx | 120 ++++++++++++++++++++++ 5 files changed, 334 insertions(+), 39 deletions(-) create mode 100644 AyaNovaQBI/FixPriceDifference.Designer.cs create mode 100644 AyaNovaQBI/FixPriceDifference.cs create mode 100644 AyaNovaQBI/FixPriceDifference.resx diff --git a/AyaNovaQBI/AyaNovaQBI.csproj b/AyaNovaQBI/AyaNovaQBI.csproj index f649b93..4fd08c3 100644 --- a/AyaNovaQBI/AyaNovaQBI.csproj +++ b/AyaNovaQBI/AyaNovaQBI.csproj @@ -98,6 +98,12 @@ FixInvoiceProblems.cs + + Form + + + FixPriceDifference.cs + Form @@ -258,6 +264,9 @@ FixInvoiceProblems.cs + + FixPriceDifference.cs + InvoiceTemplateBuilder.cs diff --git a/AyaNovaQBI/FixInvoiceProblems.cs b/AyaNovaQBI/FixInvoiceProblems.cs index faf84b3..a7e76fd 100644 --- a/AyaNovaQBI/FixInvoiceProblems.cs +++ b/AyaNovaQBI/FixInvoiceProblems.cs @@ -32,20 +32,19 @@ namespace AyaNovaQBI Close(); } - private void grid_CellContentClick(object sender, DataGridViewCellEventArgs e) + private async void grid_CellContentClick(object sender, DataGridViewCellEventArgs e) { var senderGrid = (DataGridView)sender; - if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn ) - { - //MessageBox.Show($"Row was {e.RowIndex}"); + { + var mm=MisMatches[e.RowIndex];//grid event index is same row as collection index so this saves hassles with rows and accessors - switch ((Util.MisMatchReason)e.Cell.Row.Cells["Reason"].Value) + switch (mm.Reason) { - case Util.MisMatchReason.NothingToInvoice: + case util.MisMatchReason.NothingToInvoice: MessageBox.Show("Nothing to invoice"); break; - case Util.MisMatchReason.PriceDifferent: + case util.MisMatchReason.PriceDifferent: { #region price problem FixPriceDifference d = new FixPriceDifference(); @@ -117,7 +116,7 @@ namespace AyaNovaQBI break; case "CHANGEQB": //Change the QB price to use the price on this workorder item part - Util.ChangeQBItemPrice(e.Cell.Row.Cells["QBListID"].Value.ToString(), (decimal)e.Cell.Row.Cells["AyaPrice"].Value); + util.ChangeQBItemPrice(e.Cell.Row.Cells["QBListID"].Value.ToString(), (decimal)e.Cell.Row.Cells["AyaPrice"].Value); break; } @@ -131,7 +130,7 @@ namespace AyaNovaQBI #endregion price prob. } break; - case Util.MisMatchReason.NotLinkedToQB: + case util.MisMatchReason.NotLinkedToQB: { #region link problem LinkOrImportAyaObject d = new LinkOrImportAyaObject(); @@ -149,12 +148,12 @@ namespace AyaNovaQBI { case RootObjectTypes.Client: d.CanImport = true; - d.QBItems = Util.QBClients; + d.QBItems = util.QBClients; if (d.ShowDialog() == DialogResult.Cancel) return; if (d.Choice == "IMPORT") { ArrayList alErrors = new ArrayList(); - Util.ImportAyaClient((Guid)e.Cell.Row.Cells["RootObjectID"].Value, alErrors); + util.ImportAyaClient((Guid)e.Cell.Row.Cells["RootObjectID"].Value, alErrors); //display errors if any if (alErrors.Count != 0) { @@ -180,7 +179,7 @@ namespace AyaNovaQBI else { //it's a link by default - if (d.SelectedQBItem == null || d.SelectedQBItem == "" || !Util.QBClients.Rows.Contains(d.SelectedQBItem)) + if (d.SelectedQBItem == null || d.SelectedQBItem == "" || !util.QBClients.Rows.Contains(d.SelectedQBItem)) return; QBItemName = d.SelectedQBItemName; @@ -190,76 +189,76 @@ namespace AyaNovaQBI break; case RootObjectTypes.Rate: d.CanImport = false; - d.QBItems = Util.QBItems; + d.QBItems = util.QBItems; if (d.ShowDialog() == DialogResult.Cancel) return; - if (d.SelectedQBItem == null || d.SelectedQBItem == "" || !Util.QBItems.Rows.Contains(d.SelectedQBItem)) + if (d.SelectedQBItem == null || d.SelectedQBItem == "" || !util.QBItems.Rows.Contains(d.SelectedQBItem)) return; QBItemName = d.SelectedQBItemName; break; case RootObjectTypes.Part: d.CanImport = false; - d.QBItems = Util.QBItems; + d.QBItems = util.QBItems; if (d.ShowDialog() == DialogResult.Cancel) return; - if (d.SelectedQBItem == null || d.SelectedQBItem == "" || !Util.QBItems.Rows.Contains(d.SelectedQBItem)) + if (d.SelectedQBItem == null || d.SelectedQBItem == "" || !util.QBItems.Rows.Contains(d.SelectedQBItem)) return; QBItemName = d.SelectedQBItemName; break; case RootObjectTypes.WorkorderItemOutsideService: d.CanImport = false; - d.QBItems = Util.QBItems; + d.QBItems = util.QBItems; if (d.ShowDialog() == DialogResult.Cancel) return; - if (d.SelectedQBItem == null || d.SelectedQBItem == "" || !Util.QBItems.Rows.Contains(d.SelectedQBItem)) + if (d.SelectedQBItem == null || d.SelectedQBItem == "" || !util.QBItems.Rows.Contains(d.SelectedQBItem)) return; - Util.QDat.OutsideServiceChargeAs = d.SelectedQBItem; + util.QDat.OutsideServiceChargeAs = d.SelectedQBItem; //Case 299 - Util.QBI.AIObject = Util.QDat.XMLData; - //Util.QBI.AIObject = Util.QDat; + util.QBI.AIObject = util.QDat.XMLData; + //util.QBI.AIObject = util.QDat; - Util.QBI = (Integration)Util.QBI.Save(); - Util.QDat.IsDirty = false; + util.QBI = (Integration)util.QBI.Save(); + util.QDat.IsDirty = false; goto REMOVEITEMS; case RootObjectTypes.WorkorderItemLoan: d.CanImport = false; - d.QBItems = Util.QBItems; + d.QBItems = util.QBItems; if (d.ShowDialog() == DialogResult.Cancel) return; - if (d.SelectedQBItem == null || d.SelectedQBItem == "" || !Util.QBItems.Rows.Contains(d.SelectedQBItem)) + if (d.SelectedQBItem == null || d.SelectedQBItem == "" || !util.QBItems.Rows.Contains(d.SelectedQBItem)) return; - Util.QDat.WorkorderItemLoanChargeAs = d.SelectedQBItem; + util.QDat.WorkorderItemLoanChargeAs = d.SelectedQBItem; //Case 299 - Util.QBI.AIObject = Util.QDat.XMLData; - //Util.QBI.AIObject = Util.QDat; - Util.QBI = (Integration)Util.QBI.Save(); - Util.QDat.IsDirty = false; + util.QBI.AIObject = util.QDat.XMLData; + //util.QBI.AIObject = util.QDat; + util.QBI = (Integration)util.QBI.Save(); + util.QDat.IsDirty = false; goto REMOVEITEMS; case RootObjectTypes.WorkorderItemMiscExpense: d.CanImport = false; - d.QBItems = Util.QBItems; + d.QBItems = util.QBItems; if (d.ShowDialog() == DialogResult.Cancel) return; - if (d.SelectedQBItem == null || d.SelectedQBItem == "" || !Util.QBItems.Rows.Contains(d.SelectedQBItem)) + if (d.SelectedQBItem == null || d.SelectedQBItem == "" || !util.QBItems.Rows.Contains(d.SelectedQBItem)) return; - Util.QDat.MiscExpenseChargeAs = d.SelectedQBItem; + util.QDat.MiscExpenseChargeAs = d.SelectedQBItem; //Case 299 - Util.QBI.AIObject = Util.QDat.XMLData; - //Util.QBI.AIObject = Util.QDat; - Util.QBI = (Integration)Util.QBI.Save(); - Util.QDat.IsDirty = false; + util.QBI.AIObject = util.QDat.XMLData; + //util.QBI.AIObject = util.QDat; + util.QBI = (Integration)util.QBI.Save(); + util.QDat.IsDirty = false; goto REMOVEITEMS; @@ -267,13 +266,13 @@ namespace AyaNovaQBI //add the new link - IntegrationMap m = Util.QBI.Maps.Add(Util.QBI); + IntegrationMap m = util.QBI.Maps.Add(util.QBI); m.RootObjectID = (Guid)e.Cell.Row.Cells["RootObjectID"].Value; m.RootObjectType = (RootObjectTypes)e.Cell.Row.Cells["ObjectType"].Value; m.ForeignID = d.SelectedQBItem; m.Name = QBItemName; m.LastSync = System.DateTime.Now; - Util.QBI = (Integration)Util.QBI.Save(); + util.QBI = (Integration)util.QBI.Save(); REMOVEITEMS: diff --git a/AyaNovaQBI/FixPriceDifference.Designer.cs b/AyaNovaQBI/FixPriceDifference.Designer.cs new file mode 100644 index 0000000..51727b4 --- /dev/null +++ b/AyaNovaQBI/FixPriceDifference.Designer.cs @@ -0,0 +1,119 @@ +namespace AyaNovaQBI +{ + partial class FixPriceDifference + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.btnOK = new System.Windows.Forms.Button(); + this.btnCancel = new System.Windows.Forms.Button(); + this.lblTitle = new System.Windows.Forms.Label(); + this.lblStatus = new System.Windows.Forms.Label(); + this.cbQBClasses = new System.Windows.Forms.ComboBox(); + this.SuspendLayout(); + // + // btnOK + // + this.btnOK.Location = new System.Drawing.Point(550, 368); + this.btnOK.Name = "btnOK"; + this.btnOK.Size = new System.Drawing.Size(75, 23); + this.btnOK.TabIndex = 6; + this.btnOK.Text = "OK"; + this.btnOK.UseVisualStyleBackColor = true; + this.btnOK.Click += new System.EventHandler(this.btnOK_Click); + // + // btnCancel + // + this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.btnCancel.Location = new System.Drawing.Point(4, 368); + this.btnCancel.Name = "btnCancel"; + this.btnCancel.Size = new System.Drawing.Size(75, 23); + this.btnCancel.TabIndex = 5; + this.btnCancel.Text = "Cancel"; + this.btnCancel.UseVisualStyleBackColor = true; + // + // lblTitle + // + this.lblTitle.BackColor = System.Drawing.SystemColors.Window; + this.lblTitle.Dock = System.Windows.Forms.DockStyle.Top; + this.lblTitle.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblTitle.ForeColor = System.Drawing.SystemColors.WindowText; + this.lblTitle.Location = new System.Drawing.Point(0, 0); + this.lblTitle.Name = "lblTitle"; + this.lblTitle.Size = new System.Drawing.Size(637, 84); + this.lblTitle.TabIndex = 7; + this.lblTitle.Text = "title"; + this.lblTitle.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // lblStatus + // + this.lblStatus.AutoSize = true; + this.lblStatus.Dock = System.Windows.Forms.DockStyle.Top; + this.lblStatus.Location = new System.Drawing.Point(0, 84); + this.lblStatus.Name = "lblStatus"; + this.lblStatus.Size = new System.Drawing.Size(0, 13); + this.lblStatus.TabIndex = 10; + // + // cbQBClasses + // + this.cbQBClasses.Dock = System.Windows.Forms.DockStyle.Top; + this.cbQBClasses.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cbQBClasses.FormattingEnabled = true; + this.cbQBClasses.Location = new System.Drawing.Point(0, 97); + this.cbQBClasses.Name = "cbQBClasses"; + this.cbQBClasses.Size = new System.Drawing.Size(637, 21); + this.cbQBClasses.TabIndex = 11; + // + // FixPriceDifference + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this.btnCancel; + this.ClientSize = new System.Drawing.Size(637, 403); + this.Controls.Add(this.cbQBClasses); + this.Controls.Add(this.lblStatus); + this.Controls.Add(this.lblTitle); + this.Controls.Add(this.btnOK); + this.Controls.Add(this.btnCancel); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; + this.Name = "FixPriceDifference"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "FixPriceDifference"; + this.Load += new System.EventHandler(this.SetQBClass_load); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Button btnOK; + private System.Windows.Forms.Button btnCancel; + private System.Windows.Forms.Label lblTitle; + private System.Windows.Forms.Label lblStatus; + private System.Windows.Forms.ComboBox cbQBClasses; + } +} \ No newline at end of file diff --git a/AyaNovaQBI/FixPriceDifference.cs b/AyaNovaQBI/FixPriceDifference.cs new file mode 100644 index 0000000..055ee68 --- /dev/null +++ b/AyaNovaQBI/FixPriceDifference.cs @@ -0,0 +1,48 @@ +using System; +using System.Data; +using System.Windows.Forms; + +namespace AyaNovaQBI +{ + public partial class FixPriceDifference : Form + { + public FixPriceDifference() + { + InitializeComponent(); + } + + + public string DialogTitle { get; set; } + + public string OptionTitle { get; set; } + + public string OptionDescription { get; set; } + + + public DataTable QBClasses { get; set; } + public string SelectedQBClass { get; set; } + + + private void SetQBClass_load(object sender, EventArgs e) + { + Text = DialogTitle; + lblDescription.Text = OptionDescription; + lblTitle.Text = OptionTitle; + btnCancel.Text = util.AyaTranslations["Cancel"]; + btnOK.Text = util.AyaTranslations["OK"]; + + cbQBClasses.DataSource = QBClasses; + cbQBClasses.DisplayMember = "FullName"; + cbQBClasses.ValueMember = "ID"; + lblStatus.Text = "QuickBooks transaction class"; + } + + + private void btnOK_Click(object sender, EventArgs e) + { + + DialogResult = DialogResult.OK; + Close(); + } + } +} diff --git a/AyaNovaQBI/FixPriceDifference.resx b/AyaNovaQBI/FixPriceDifference.resx new file mode 100644 index 0000000..29dcb1b --- /dev/null +++ b/AyaNovaQBI/FixPriceDifference.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file