diff --git a/AyaNovaQBI/AyaNovaQBI.csproj b/AyaNovaQBI/AyaNovaQBI.csproj index 22edf1b..0601548 100644 --- a/AyaNovaQBI/AyaNovaQBI.csproj +++ b/AyaNovaQBI/AyaNovaQBI.csproj @@ -105,6 +105,12 @@ + + Form + + + SetQBChargeAs.cs + Form @@ -149,6 +155,9 @@ Resources.resx True + + SetQBChargeAs.cs + SetWOStatus.cs diff --git a/AyaNovaQBI/SetQBChargeAs.Designer.cs b/AyaNovaQBI/SetQBChargeAs.Designer.cs new file mode 100644 index 0000000..6d95f9b --- /dev/null +++ b/AyaNovaQBI/SetQBChargeAs.Designer.cs @@ -0,0 +1,127 @@ +namespace AyaNovaQBI +{ + partial class SetQBChargeAs + { + /// + /// 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; + // + // SetQBChargeAs + // + 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 = "SetQBChargeAs"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "SetQBChargeAs"; + this.Load += new System.EventHandler(this.SetQBChargeAsLoad); + 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/SetQBChargeAs.cs b/AyaNovaQBI/SetQBChargeAs.cs new file mode 100644 index 0000000..f42b406 --- /dev/null +++ b/AyaNovaQBI/SetQBChargeAs.cs @@ -0,0 +1,79 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace AyaNovaQBI +{ + public partial class SetQBChargeAs : Form + { + public SetQBChargeAs() + { + InitializeComponent(); + } + + + public string DialogTitle { get; set; } + + public string OptionTitle { get; set; } + + public string OptionDescription { get; set; } + + + public DataTable QBItems { get; set; } + public string SelectedQBItem { get; set; } + + private void SetQBChargeAsLoad(object sender, EventArgs e) + { + this.Text = DialogTitle; + this.lblDescription.Text = OptionDescription; + this.lblTitle.Text = OptionTitle; + this.btnCancel.Text = util.AyaTranslations["Cancel"]; + this.btnOK.Text = util.AyaTranslations["OK"]; + + + + this.cbQBItems.DataSource = QBItems; + this.cbQBItems.DisplayMember = "FullName"; + this.cbQBItems.ValueMember = "ID"; + this.cbQBItems.SelectedValue = SelectedQBItem; + + this.lblStatus.Text = util.AyaTranslations["WorkOrderStatus"]; + + + ////NVCHANGED + //GenericNVList ls = GenericNVList.GetList("aWorkorderStatus", "aID", "aName", true, false, false); + + //if (_Pre) + // this.cbStatus.SelectedItem = this.cbStatus.Items.Add(Guid.Empty, "< Any status >"); + //else + // this.cbStatus.SelectedItem = this.cbStatus.Items.Add(Guid.Empty, "< Do not change status >"); + + + //foreach (DictionaryEntry d in ls.BindableList) + //{ + // Guid gItem = new Guid(d.Key.ToString()); + // Infragistics.Win.ValueListItem v = this.cbStatus.Items.Add(gItem, d.Value.ToString()); + // if (_SelectedStatus == gItem) + // { + // this.cbStatus.SelectedItem = v; + + // } + //} + + + } + + private void btnOK_Click(object sender, EventArgs e) + { + + this.DialogResult = DialogResult.OK; + this.Close(); + } + } +} diff --git a/AyaNovaQBI/SetQBChargeAs.resx b/AyaNovaQBI/SetQBChargeAs.resx new file mode 100644 index 0000000..29dcb1b --- /dev/null +++ b/AyaNovaQBI/SetQBChargeAs.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 417f446..1f842e9 100644 --- a/AyaNovaQBI/util.cs +++ b/AyaNovaQBI/util.cs @@ -866,122 +866,122 @@ namespace AyaNovaQBI POSTSTATUSOK: #endregion - // #region Outside service charge as - // //Validate any existing status - // if (SetEverything == false && QDat.OutsideServiceChargeAs != null && QDat.OutsideServiceChargeAs != "") - // { - // if (QBItems.Rows.Contains(QDat.OutsideServiceChargeAs)) - // goto OUTSIDESERVICECHARGEASOK; - // else - // { - // MessageBox.Show("The QuickBooks Item previously set for invoicing Outside Service items\r\n" + - // "No longer appears to be valid. You will next be prompted to re-select a valid \r\n" + - // "QuickBooks Item."); - // } - // } + #region Outside service charge as + //Validate any existing status + if (SetEverything == false && QDat.OutsideServiceChargeAs != null && QDat.OutsideServiceChargeAs != "") + { + if (QBItems.Rows.Contains(QDat.OutsideServiceChargeAs)) + goto OUTSIDESERVICECHARGEASOK; + else + { + MessageBox.Show("The QuickBooks Item previously set for invoicing Outside Service items\r\n" + + "No longer appears to be valid. You will next be prompted to re-select a valid \r\n" + + "QuickBooks Item."); + } + } - // //We've arrived here because there is no valid setting for OutsideServiceChargeAs - // SetQBChargeAs s2 = new SetQBChargeAs(); - // s2.DialogTitle = "AyaNova QBI setup - Charge outside service as?"; - // s2.OptionTitle = "Outside service"; - // s2.OptionDescription = "QBI needs to know what QuickBooks Item you want \r\n" + - // "to use when invoicing the AyaNova \"Outside service\" portion of a work order.\r\n\r\n" + - // "Outside service is any 3rd party repair that is billable to the customer.\r\n\r\n" + - // "This setting is mandatory / required."; - // s2.QBItems = QBItems; - // s2.SelectedQBItem = QDat.OutsideServiceChargeAs; - // //s2.SelectedQBItem=QDat.PreWOStatus; - // if (s2.ShowDialog() == DialogResult.Cancel) - // { - // return pfstat.Cancel; + //We've arrived here because there is no valid setting for OutsideServiceChargeAs + SetQBChargeAs s2 = new SetQBChargeAs(); + s2.DialogTitle = "AyaNova QBI setup - Charge outside service as?"; + s2.OptionTitle = "Outside service"; + s2.OptionDescription = "QBI needs to know what QuickBooks Item you want \r\n" + + "to use when invoicing the AyaNova \"Outside service\" portion of a work order.\r\n\r\n" + + "Outside service is any 3rd party repair that is billable to the customer.\r\n\r\n" + + "This setting is mandatory / required."; + s2.QBItems = QBItems; + s2.SelectedQBItem = QDat.OutsideServiceChargeAs; + //s2.SelectedQBItem=QDat.PreWOStatus; + if (s2.ShowDialog() == DialogResult.Cancel) + { + return pfstat.Cancel; - // } - // else - // QDat.OutsideServiceChargeAs = s2.SelectedQBItem; - // s2.Dispose(); - // s2 = null; + } + else + QDat.OutsideServiceChargeAs = s2.SelectedQBItem; + s2.Dispose(); + s2 = null; - //OUTSIDESERVICECHARGEASOK: + OUTSIDESERVICECHARGEASOK: - // #endregion + #endregion - // #region Misc expense charge as - // //Validate any existing - // if (SetEverything == false && QDat.MiscExpenseChargeAs != null && QDat.MiscExpenseChargeAs != "") - // { - // //if(QBItems.Rows.Contains(QDat.MiscExpenseChargeAs)) - // goto MISCCHARGEASOK; - // // else - // // { - // // MessageBox.Show("The QuickBooks Item previously set for invoicing Misc. Expense items\r\n" + - // // "No longer appears to be valid. You will next be prompted to re-select a valid \r\n" + - // // "QuickBooks Item."); - // // } - // } + #region Misc expense charge as + //Validate any existing + if (SetEverything == false && QDat.MiscExpenseChargeAs != null && QDat.MiscExpenseChargeAs != "") + { + //if(QBItems.Rows.Contains(QDat.MiscExpenseChargeAs)) + goto MISCCHARGEASOK; + // else + // { + // MessageBox.Show("The QuickBooks Item previously set for invoicing Misc. Expense items\r\n" + + // "No longer appears to be valid. You will next be prompted to re-select a valid \r\n" + + // "QuickBooks Item."); + // } + } - // //We've arrived here because there is no valid setting for Misc expense - // s2 = new SetQBChargeAs(); - // s2.DialogTitle = "AyaNova QBI setup - Charge Misc. Expense as?"; - // s2.OptionTitle = "Miscellaneous expenses"; - // s2.OptionDescription = "QBI needs to know what QuickBooks Item you want \r\n" + - // "to use when invoicing the AyaNova \"Miscellaneous expense\" portion of a work order.\r\n\r\n" + - // "This setting is mandatory / required."; - // s2.QBItems = QBItems; - // s2.SelectedQBItem = QDat.MiscExpenseChargeAs; + //We've arrived here because there is no valid setting for Misc expense + s2 = new SetQBChargeAs(); + s2.DialogTitle = "AyaNova QBI setup - Charge Misc. Expense as?"; + s2.OptionTitle = "Miscellaneous expenses"; + s2.OptionDescription = "QBI needs to know what QuickBooks Item you want \r\n" + + "to use when invoicing the AyaNova \"Miscellaneous expense\" portion of a work order.\r\n\r\n" + + "This setting is mandatory / required."; + s2.QBItems = QBItems; + s2.SelectedQBItem = QDat.MiscExpenseChargeAs; - // if (s2.ShowDialog() == DialogResult.Cancel) - // { - // return pfstat.Cancel; + if (s2.ShowDialog() == DialogResult.Cancel) + { + return pfstat.Cancel; - // } - // else - // QDat.MiscExpenseChargeAs = s2.SelectedQBItem; - // s2.Dispose(); - // s2 = null; + } + else + QDat.MiscExpenseChargeAs = s2.SelectedQBItem; + s2.Dispose(); + s2 = null; - //MISCCHARGEASOK: + MISCCHARGEASOK: - // #endregion + #endregion - // #region Workorder item loan charge as - // //Validate any existing - // if (SetEverything == false && QDat.WorkorderItemLoanChargeAs != null && QDat.WorkorderItemLoanChargeAs != "") - // { - // //if(QBItems.Rows.Contains(QDat.MiscExpenseChargeAs)) - // goto LOANCHARGEASOK; - // // else - // // { - // // MessageBox.Show("The QuickBooks Item previously set for invoicing Misc. Expense items\r\n" + - // // "No longer appears to be valid. You will next be prompted to re-select a valid \r\n" + - // // "QuickBooks Item."); - // // } - // } + #region Workorder item loan charge as + //Validate any existing + if (SetEverything == false && QDat.WorkorderItemLoanChargeAs != null && QDat.WorkorderItemLoanChargeAs != "") + { + //if(QBItems.Rows.Contains(QDat.MiscExpenseChargeAs)) + goto LOANCHARGEASOK; + // else + // { + // MessageBox.Show("The QuickBooks Item previously set for invoicing Misc. Expense items\r\n" + + // "No longer appears to be valid. You will next be prompted to re-select a valid \r\n" + + // "QuickBooks Item."); + // } + } - // //We've arrived here because there is no valid setting for Misc expense - // s2 = new SetQBChargeAs(); - // s2.DialogTitle = "AyaNova QBI setup - Charge loan item as?"; - // s2.OptionTitle = "Work order loans"; - // s2.OptionDescription = "QBI needs to know what QuickBooks Item you want \r\n" + - // "to use when invoicing the AyaNova \"Workorder item loan\" portion of a work order.\r\n\r\n" + - // "This setting is mandatory / required."; - // s2.QBItems = QBItems; - // s2.SelectedQBItem = QDat.WorkorderItemLoanChargeAs; - // if (s2.ShowDialog() == DialogResult.Cancel) - // { - // return pfstat.Cancel; + //We've arrived here because there is no valid setting for Misc expense + s2 = new SetQBChargeAs(); + s2.DialogTitle = "AyaNova QBI setup - Charge loan item as?"; + s2.OptionTitle = "Work order loans"; + s2.OptionDescription = "QBI needs to know what QuickBooks Item you want \r\n" + + "to use when invoicing the AyaNova \"Workorder item loan\" portion of a work order.\r\n\r\n" + + "This setting is mandatory / required."; + s2.QBItems = QBItems; + s2.SelectedQBItem = QDat.WorkorderItemLoanChargeAs; + if (s2.ShowDialog() == DialogResult.Cancel) + { + return pfstat.Cancel; - // } - // else - // QDat.WorkorderItemLoanChargeAs = s2.SelectedQBItem; - // s2.Dispose(); - // s2 = null; + } + else + QDat.WorkorderItemLoanChargeAs = s2.SelectedQBItem; + s2.Dispose(); + s2 = null; - //LOANCHARGEASOK: + LOANCHARGEASOK: - // #endregion + #endregion // #region QB Transaction class // //Validate any existing