From 096413c165b0e6d6cde60eb3a03c8f34eeeab7ec Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Fri, 1 Jul 2022 00:24:27 +0000 Subject: [PATCH] --- AyaNovaQBI/AyaNovaQBI.csproj | 18 +++ AyaNovaQBI/SetInfoOnly.Designer.cs | 101 +++++++++++++ AyaNovaQBI/SetInfoOnly.cs | 43 ++++++ AyaNovaQBI/SetInfoOnly.resx | 120 +++++++++++++++ AyaNovaQBI/SetQBClass.cs | 1 - AyaNovaQBI/SetQBInvoiceTemplate.Designer.cs | 127 ++++++++++++++++ AyaNovaQBI/SetQBInvoiceTemplate.cs | 48 ++++++ AyaNovaQBI/SetQBInvoiceTemplate.resx | 120 +++++++++++++++ AyaNovaQBI/util.cs | 156 ++++++++++---------- 9 files changed, 655 insertions(+), 79 deletions(-) create mode 100644 AyaNovaQBI/SetInfoOnly.Designer.cs create mode 100644 AyaNovaQBI/SetInfoOnly.cs create mode 100644 AyaNovaQBI/SetInfoOnly.resx create mode 100644 AyaNovaQBI/SetQBInvoiceTemplate.Designer.cs create mode 100644 AyaNovaQBI/SetQBInvoiceTemplate.cs create mode 100644 AyaNovaQBI/SetQBInvoiceTemplate.resx diff --git a/AyaNovaQBI/AyaNovaQBI.csproj b/AyaNovaQBI/AyaNovaQBI.csproj index 2f8cb6d..62e595d 100644 --- a/AyaNovaQBI/AyaNovaQBI.csproj +++ b/AyaNovaQBI/AyaNovaQBI.csproj @@ -105,6 +105,12 @@ + + Form + + + SetInfoOnly.cs + Form @@ -117,6 +123,12 @@ SetQBClass.cs + + Form + + + SetQBInvoiceTemplate.cs + Form @@ -161,12 +173,18 @@ Resources.resx True + + SetInfoOnly.cs + SetQBChargeAs.cs SetQBClass.cs + + SetQBInvoiceTemplate.cs + SetWOStatus.cs diff --git a/AyaNovaQBI/SetInfoOnly.Designer.cs b/AyaNovaQBI/SetInfoOnly.Designer.cs new file mode 100644 index 0000000..ce6002a --- /dev/null +++ b/AyaNovaQBI/SetInfoOnly.Designer.cs @@ -0,0 +1,101 @@ +namespace AyaNovaQBI +{ + partial class SetInfoOnly + { + /// + /// 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.lblDescription = new System.Windows.Forms.Label(); + 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.Dock = System.Windows.Forms.DockStyle.Top; + this.lblTitle.Font = new System.Drawing.Font("Tahoma", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblTitle.Location = new System.Drawing.Point(0, 0); + this.lblTitle.Name = "lblTitle"; + this.lblTitle.Size = new System.Drawing.Size(637, 30); + this.lblTitle.TabIndex = 7; + // + // lblDescription + // + this.lblDescription.Dock = System.Windows.Forms.DockStyle.Top; + this.lblDescription.Font = new System.Drawing.Font("Tahoma", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblDescription.Location = new System.Drawing.Point(0, 30); + this.lblDescription.Name = "lblDescription"; + this.lblDescription.Size = new System.Drawing.Size(637, 165); + this.lblDescription.TabIndex = 8; + // + // SetInfoOnly + // + 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.lblDescription); + this.Controls.Add(this.lblTitle); + this.Controls.Add(this.btnOK); + this.Controls.Add(this.btnCancel); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; + this.Name = "SetInfoOnly"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "SetInfoOnly"; + this.Load += new System.EventHandler(this.SetQBClass_load); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Button btnOK; + private System.Windows.Forms.Button btnCancel; + private System.Windows.Forms.Label lblTitle; + private System.Windows.Forms.Label lblDescription; + } +} \ No newline at end of file diff --git a/AyaNovaQBI/SetInfoOnly.cs b/AyaNovaQBI/SetInfoOnly.cs new file mode 100644 index 0000000..238b750 --- /dev/null +++ b/AyaNovaQBI/SetInfoOnly.cs @@ -0,0 +1,43 @@ +using System; +using System.Data; +using System.Windows.Forms; + +namespace AyaNovaQBI +{ + public partial class SetInfoOnly : Form + { + public SetInfoOnly() + { + InitializeComponent(); + } + + + public string DialogTitle { get; set; } + + public string OptionTitle { get; set; } + + public string OptionDescription { 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"]; + + + } + + + private void btnOK_Click(object sender, EventArgs e) + { + + DialogResult = DialogResult.OK; + Close(); + } + } +} diff --git a/AyaNovaQBI/SetInfoOnly.resx b/AyaNovaQBI/SetInfoOnly.resx new file mode 100644 index 0000000..29dcb1b --- /dev/null +++ b/AyaNovaQBI/SetInfoOnly.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 diff --git a/AyaNovaQBI/SetQBClass.cs b/AyaNovaQBI/SetQBClass.cs index bac9732..9d4b8b4 100644 --- a/AyaNovaQBI/SetQBClass.cs +++ b/AyaNovaQBI/SetQBClass.cs @@ -34,7 +34,6 @@ namespace AyaNovaQBI cbQBClasses.DataSource = QBClasses; cbQBClasses.DisplayMember = "FullName"; cbQBClasses.ValueMember = "ID"; - // cbQBClasses.SelectedValue = SelectedQBClass; lblStatus.Text = "QuickBooks transaction class"; } diff --git a/AyaNovaQBI/SetQBInvoiceTemplate.Designer.cs b/AyaNovaQBI/SetQBInvoiceTemplate.Designer.cs new file mode 100644 index 0000000..bb2d1c1 --- /dev/null +++ b/AyaNovaQBI/SetQBInvoiceTemplate.Designer.cs @@ -0,0 +1,127 @@ +namespace AyaNovaQBI +{ + partial class SetQBInvoiceTemplate + { + /// + /// 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.lblDescription = new System.Windows.Forms.Label(); + this.lblStatus = new System.Windows.Forms.Label(); + this.cbQBItems = 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.Dock = System.Windows.Forms.DockStyle.Top; + this.lblTitle.Font = new System.Drawing.Font("Tahoma", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblTitle.Location = new System.Drawing.Point(0, 0); + this.lblTitle.Name = "lblTitle"; + this.lblTitle.Size = new System.Drawing.Size(637, 30); + this.lblTitle.TabIndex = 7; + // + // lblDescription + // + this.lblDescription.Dock = System.Windows.Forms.DockStyle.Top; + this.lblDescription.Font = new System.Drawing.Font("Tahoma", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblDescription.Location = new System.Drawing.Point(0, 30); + this.lblDescription.Name = "lblDescription"; + this.lblDescription.Size = new System.Drawing.Size(637, 165); + this.lblDescription.TabIndex = 8; + // + // lblStatus + // + this.lblStatus.AutoSize = true; + this.lblStatus.Dock = System.Windows.Forms.DockStyle.Top; + this.lblStatus.Location = new System.Drawing.Point(0, 195); + this.lblStatus.Name = "lblStatus"; + this.lblStatus.Size = new System.Drawing.Size(0, 13); + this.lblStatus.TabIndex = 10; + // + // cbQBItems + // + this.cbQBItems.Dock = System.Windows.Forms.DockStyle.Top; + this.cbQBItems.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cbQBItems.FormattingEnabled = true; + this.cbQBItems.Location = new System.Drawing.Point(0, 208); + this.cbQBItems.Name = "cbQBItems"; + this.cbQBItems.Size = new System.Drawing.Size(637, 21); + this.cbQBItems.TabIndex = 11; + // + // SetQBInvoiceTemplate + // + 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.cbQBItems); + this.Controls.Add(this.lblStatus); + this.Controls.Add(this.lblDescription); + this.Controls.Add(this.lblTitle); + this.Controls.Add(this.btnOK); + this.Controls.Add(this.btnCancel); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; + this.Name = "SetQBInvoiceTemplate"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "SetQBInvoiceTemplate"; + 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 lblDescription; + private System.Windows.Forms.Label lblStatus; + private System.Windows.Forms.ComboBox cbQBItems; + } +} \ No newline at end of file diff --git a/AyaNovaQBI/SetQBInvoiceTemplate.cs b/AyaNovaQBI/SetQBInvoiceTemplate.cs new file mode 100644 index 0000000..5dc2717 --- /dev/null +++ b/AyaNovaQBI/SetQBInvoiceTemplate.cs @@ -0,0 +1,48 @@ +using System; +using System.Data; +using System.Windows.Forms; + +namespace AyaNovaQBI +{ + public partial class SetQBInvoiceTemplate : Form + { + public SetQBInvoiceTemplate() + { + InitializeComponent(); + } + + + public string DialogTitle { get; set; } + + public string OptionTitle { get; set; } + + public string OptionDescription { get; set; } + + + public DataTable QBInvoiceTemplates { get; set; } + public string SelectedQBInvoiceTemplate { 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"]; + + cbQBItems.DataSource = QBInvoiceTemplates; + cbQBItems.DisplayMember = "FullName"; + cbQBItems.ValueMember = "ID"; + lblStatus.Text = "QuickBooks invoice template:"; + } + + + private void btnOK_Click(object sender, EventArgs e) + { + + DialogResult = DialogResult.OK; + Close(); + } + } +} diff --git a/AyaNovaQBI/SetQBInvoiceTemplate.resx b/AyaNovaQBI/SetQBInvoiceTemplate.resx new file mode 100644 index 0000000..29dcb1b --- /dev/null +++ b/AyaNovaQBI/SetQBInvoiceTemplate.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 diff --git a/AyaNovaQBI/util.cs b/AyaNovaQBI/util.cs index ac10378..4239410 100644 --- a/AyaNovaQBI/util.cs +++ b/AyaNovaQBI/util.cs @@ -1042,103 +1042,103 @@ namespace AyaNovaQBI TRCLASSOK: - #endregion + #endregion - // #region QB InvoiceTemplate - // //Templates are only supported in xml 3 or greater (all countries) - // //if Set everything (first run) then display a dialog about it - // if (QVersion < 3 && SetEverything == true) - // { + #region QB InvoiceTemplate + //Templates are only supported in xml 3 or greater (all countries) + //if Set everything (first run) then display a dialog about it + if (QVersion > 3 && SetEverything == true) + { - // SetInfoOnly s3a = new SetInfoOnly(); - // s3a.DialogTitle = "AyaNova QBI setup - Invoice template"; - // s3a.OptionTitle = "Invoice template - NOT SUPPORTED"; - // s3a.OptionDescription = - // "QBI can use a specific QuickBooks Invoice template for printing work orders.\r\n" + - // "However, your version of QuickBooks does not support integrating this \r\n" + - // "feature with 3rd party applications such as AyaNova QBI.\r\n" + + SetInfoOnly s3a = new SetInfoOnly(); + s3a.DialogTitle = "AyaNova QBI setup - Invoice template"; + s3a.OptionTitle = "Invoice template - NOT SUPPORTED"; + s3a.OptionDescription = + "QBI can use a specific QuickBooks Invoice template for printing work orders.\r\n" + + "However, your version of QuickBooks does not support integrating this \r\n" + + "feature with 3rd party applications such as AyaNova QBI.\r\n" + - // "Supported versions of QuickBooks for using Invoice templates with QBI are:\r\n\r\n" + - // "U.S., Canadian or U.K. QuickBooks 2004 or newer\r\n\r\n" + + "Supported versions of QuickBooks for using Invoice templates with QBI are:\r\n\r\n" + + "U.S., Canadian or U.K. QuickBooks 2004 or newer\r\n\r\n" + - // "If you upgrade your QuickBooks in future you will be able to select this option\r\n" + - // "for now it is disabled and the default invoice template will be used"; + "If you upgrade your QuickBooks in future you will be able to select this option\r\n" + + "for now it is disabled and the default invoice template will be used"; - // s3a.ShowDialog(); + s3a.ShowDialog(); - // goto TRInvoiceTemplateOK; - // } + goto TRInvoiceTemplateOK; + } - // //Subsequent, non-setup, runs with unsupported version - // if (QVersion < 3) - // goto TRInvoiceTemplateOK; + //Subsequent, non-setup, runs with unsupported version + if (QVersion < 3) + goto TRInvoiceTemplateOK; - // //Validate any existing - // if (QDat.QBInvoiceTemplate != null && QDat.QBInvoiceTemplate != "") - // { - // //if something is set but there are no InvoiceTemplates - // //then just clear it and move along - // if (QBInvoiceTemplates.Rows.Count == 1) - // { - // QDat.QBInvoiceTemplate = ""; - // goto TRInvoiceTemplateOK; - // } + //Validate any existing + if (QDat.QBInvoiceTemplate != null && QDat.QBInvoiceTemplate != "") + { + //if something is set but there are no InvoiceTemplates + //then just clear it and move along + if (QBInvoiceTemplates.Rows.Count == 1) + { + QDat.QBInvoiceTemplate = ""; + goto TRInvoiceTemplateOK; + } - // //Something is set and there *are* tr InvoiceTemplates so - // //let's validate it... - // if (QBInvoiceTemplates.Rows.Contains(QDat.QBInvoiceTemplate)) - // { - // if (!SetEverything) - // goto TRInvoiceTemplateOK; - // } - // else - // { - // MessageBox.Show("The QuickBooks Invoice Template previously set for invoicing\r\n" + - // "no longer appears to be valid. You will next be prompted to re-select it."); - // } - // } + //Something is set and there *are* tr InvoiceTemplates so + //let's validate it... + if (QBInvoiceTemplates.Rows.Contains(QDat.QBInvoiceTemplate)) + { + if (!SetEverything) + goto TRInvoiceTemplateOK; + } + else + { + MessageBox.Show("The QuickBooks Invoice Template previously set for invoicing\r\n" + + "no longer appears to be valid. You will next be prompted to re-select it."); + } + } - // //Perhaps there are no InvoiceTemplates, this is the default - // //if not then don't prompt for it obviously :) - // //also if it was empty and were not in first setup mode then - // //don't bother prompting it might be the users choice. - // //todo: make something besides and empty string to indicate - // //deliberately non selected items - // if (QBInvoiceTemplates.Rows.Count == 1 || SetEverything == false) - // goto TRInvoiceTemplateOK; + //Perhaps there are no InvoiceTemplates, this is the default + //if not then don't prompt for it obviously :) + //also if it was empty and were not in first setup mode then + //don't bother prompting it might be the users choice. + //todo: make something besides and empty string to indicate + //deliberately non selected items + if (QBInvoiceTemplates.Rows.Count == 1 || SetEverything == false) + goto TRInvoiceTemplateOK; - // //We've arrived here because there is no setting for InvoiceTemplates - // //Or the user want's to change it - // //and there are some defined in QB - // SetQBInvoiceTemplate s3b = new SetQBInvoiceTemplate(); - // s3b.DialogTitle = "AyaNova QBI setup - Invoice template"; - // s3b.OptionTitle = "Invoice template"; - // s3b.OptionDescription = "QBI needs to know what QuickBooks Invoice template you want \r\n" + - // "QBI to set for invoices created from Work orders.\r\n\r\n" + - // "QuickBooks Invoice templates are used in QuickBooks to specify different print formats\r\n" + - // "for invoices. If you do not use Invoice templates or are not sure what they are\r\n" + - // "select < Use default > from the list below.\r\n\r\n" + - // "This setting is required."; - // s3b.QBInvoiceTemplates = QBInvoiceTemplates; + //We've arrived here because there is no setting for InvoiceTemplates + //Or the user want's to change it + //and there are some defined in QB + SetQBInvoiceTemplate s3b = new SetQBInvoiceTemplate(); + s3b.DialogTitle = "AyaNova QBI setup - Invoice template"; + s3b.OptionTitle = "Invoice template"; + s3b.OptionDescription = "QBI needs to know what QuickBooks Invoice template you want \r\n" + + "QBI to set for invoices created from Work orders.\r\n\r\n" + + "QuickBooks Invoice templates are used in QuickBooks to specify different print formats\r\n" + + "for invoices. If you do not use Invoice templates or are not sure what they are\r\n" + + "select < Use default > from the list below.\r\n\r\n" + + "This setting is required."; + s3b.QBInvoiceTemplates = QBInvoiceTemplates; - // s3b.SelectedQBInvoiceTemplate = QDat.QBInvoiceTemplate; + s3b.SelectedQBInvoiceTemplate = QDat.QBInvoiceTemplate; - // if (s3b.ShowDialog() == DialogResult.Cancel) - // { - // return pfstat.Cancel; + if (s3b.ShowDialog() == DialogResult.Cancel) + { + return pfstat.Cancel; - // } - // else - // QDat.QBInvoiceTemplate = s3b.SelectedQBInvoiceTemplate; - // s3b.Dispose(); - // s3b = null; + } + else + QDat.QBInvoiceTemplate = s3b.SelectedQBInvoiceTemplate; + s3b.Dispose(); + s3b = null; - //TRInvoiceTemplateOK: + TRInvoiceTemplateOK: - // #endregion + #endregion // #region QB Terms