Refactor: Instead of a concept of Price/FullPrice, happy hour is now a checkbox in the product.
This needed major refactor in all parts dealing with product or inventory.
This commit is contained in:
@ -37,7 +37,6 @@
|
||||
this.Label2 = new System.Windows.Forms.Label();
|
||||
this.txtUnits = new System.Windows.Forms.TextBox();
|
||||
this.txtName = new System.Windows.Forms.TextBox();
|
||||
this.txtPrice = new System.Windows.Forms.TextBox();
|
||||
this.cmbVat = new System.Windows.Forms.ComboBox();
|
||||
this.bsVat = new System.Windows.Forms.BindingSource(this.components);
|
||||
this.chkIsActive = new System.Windows.Forms.CheckBox();
|
||||
@ -51,8 +50,8 @@
|
||||
this.chkIsScTaxable = new System.Windows.Forms.CheckBox();
|
||||
this.chkIsNotAvailable = new System.Windows.Forms.CheckBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.txtFullPrice = new System.Windows.Forms.TextBox();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.txtPrice = new System.Windows.Forms.TextBox();
|
||||
this.chkHasHappyHour = new System.Windows.Forms.CheckBox();
|
||||
((System.ComponentModel.ISupportInitialize)(this.bsProductGroups)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.bsServiceTax)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.bsVat)).BeginInit();
|
||||
@ -118,15 +117,6 @@
|
||||
this.txtName.Size = new System.Drawing.Size(189, 20);
|
||||
this.txtName.TabIndex = 0;
|
||||
//
|
||||
// txtPrice
|
||||
//
|
||||
this.txtPrice.AccessibleName = "";
|
||||
this.txtPrice.Location = new System.Drawing.Point(112, 64);
|
||||
this.txtPrice.Name = "txtPrice";
|
||||
this.txtPrice.Size = new System.Drawing.Size(104, 20);
|
||||
this.txtPrice.TabIndex = 3;
|
||||
this.txtPrice.Text = "0";
|
||||
//
|
||||
// cmbVat
|
||||
//
|
||||
this.cmbVat.DataSource = this.bsVat;
|
||||
@ -249,23 +239,24 @@
|
||||
this.label1.TabIndex = 18;
|
||||
this.label1.Text = "VAT";
|
||||
//
|
||||
// txtFullPrice
|
||||
// txtPrice
|
||||
//
|
||||
this.txtFullPrice.AccessibleName = "";
|
||||
this.txtFullPrice.Location = new System.Drawing.Point(112, 38);
|
||||
this.txtFullPrice.Name = "txtFullPrice";
|
||||
this.txtFullPrice.Size = new System.Drawing.Size(104, 20);
|
||||
this.txtFullPrice.TabIndex = 2;
|
||||
this.txtFullPrice.Text = "0";
|
||||
this.txtPrice.AccessibleName = "";
|
||||
this.txtPrice.Location = new System.Drawing.Point(112, 38);
|
||||
this.txtPrice.Name = "txtPrice";
|
||||
this.txtPrice.Size = new System.Drawing.Size(189, 20);
|
||||
this.txtPrice.TabIndex = 2;
|
||||
this.txtPrice.Text = "0";
|
||||
//
|
||||
// label3
|
||||
// chkHasHappyHour
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(15, 67);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(91, 13);
|
||||
this.label3.TabIndex = 16;
|
||||
this.label3.Text = "Happy Hour Price";
|
||||
this.chkHasHappyHour.AutoSize = true;
|
||||
this.chkHasHappyHour.Location = new System.Drawing.Point(307, 40);
|
||||
this.chkHasHappyHour.Name = "chkHasHappyHour";
|
||||
this.chkHasHappyHour.Size = new System.Drawing.Size(105, 17);
|
||||
this.chkHasHappyHour.TabIndex = 21;
|
||||
this.chkHasHappyHour.Text = "Has Happy Hour";
|
||||
this.chkHasHappyHour.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// ProductForm
|
||||
//
|
||||
@ -273,8 +264,8 @@
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(415, 285);
|
||||
this.Controls.Add(this.txtFullPrice);
|
||||
this.Controls.Add(this.label3);
|
||||
this.Controls.Add(this.chkHasHappyHour);
|
||||
this.Controls.Add(this.txtPrice);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.chkIsNotAvailable);
|
||||
this.Controls.Add(this.chkIsScTaxable);
|
||||
@ -287,7 +278,6 @@
|
||||
this.Controls.Add(this.chkIsActive);
|
||||
this.Controls.Add(this.txtServiceCharge);
|
||||
this.Controls.Add(this.Label7);
|
||||
this.Controls.Add(this.txtPrice);
|
||||
this.Controls.Add(this.lblServiceCharge);
|
||||
this.Controls.Add(this.cmbVat);
|
||||
this.Controls.Add(this.txtUnits);
|
||||
@ -318,7 +308,6 @@
|
||||
internal System.Windows.Forms.Label Label2;
|
||||
internal System.Windows.Forms.TextBox txtUnits;
|
||||
internal System.Windows.Forms.TextBox txtName;
|
||||
internal System.Windows.Forms.TextBox txtPrice;
|
||||
internal System.Windows.Forms.ComboBox cmbVat;
|
||||
private System.Windows.Forms.CheckBox chkIsActive;
|
||||
internal System.Windows.Forms.TextBox txtServiceCharge;
|
||||
@ -332,7 +321,7 @@
|
||||
private System.Windows.Forms.BindingSource bsVat;
|
||||
private System.Windows.Forms.CheckBox chkIsNotAvailable;
|
||||
internal System.Windows.Forms.Label label1;
|
||||
internal System.Windows.Forms.TextBox txtFullPrice;
|
||||
internal System.Windows.Forms.Label label3;
|
||||
internal System.Windows.Forms.TextBox txtPrice;
|
||||
private System.Windows.Forms.CheckBox chkHasHappyHour;
|
||||
}
|
||||
}
|
||||
@ -29,7 +29,7 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
txtName.Text = product.Name;
|
||||
txtUnits.Text = product.Units;
|
||||
txtPrice.Text = product.Price.ToString("#.##");
|
||||
txtFullPrice.Text = product.FullPrice.ToString("#.##");
|
||||
chkHasHappyHour.Checked = product.HasHappyHour;
|
||||
cmbVat.SelectedValue = product.Vat.TaxID;
|
||||
cmbServiceTax.SelectedValue = product.ServiceTax.TaxID;
|
||||
txtServiceCharge.Text = product.ServiceCharge.ToString("#.##");
|
||||
@ -95,24 +95,6 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
else
|
||||
product.Price = decimal.Parse(txtPrice.Text.Trim());
|
||||
|
||||
if (string.IsNullOrEmpty(txtFullPrice.Text.Trim()))
|
||||
txtFullPrice.Text = "0";
|
||||
if (!Regex.IsMatch(txtFullPrice.Text, @"^\d*([.]\d{1,5})?$"))
|
||||
{
|
||||
MessageBox.Show("Full Price is not valid, it must be a decimal >= 0");
|
||||
txtFullPrice.Focus();
|
||||
return;
|
||||
}
|
||||
else
|
||||
product.FullPrice = decimal.Parse(txtFullPrice.Text.Trim());
|
||||
|
||||
if (product.FullPrice < product.Price)
|
||||
{
|
||||
MessageBox.Show("Full Price cannot be less than the actual price.");
|
||||
txtFullPrice.Focus();
|
||||
return;
|
||||
}
|
||||
|
||||
// Tax
|
||||
if (cmbVat.SelectedItem == null)
|
||||
{
|
||||
|
||||
@ -126,6 +126,9 @@
|
||||
<metadata name="bsVat.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>382, 17</value>
|
||||
</metadata>
|
||||
<metadata name="bsVat.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>382, 17</value>
|
||||
</metadata>
|
||||
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>102</value>
|
||||
</metadata>
|
||||
|
||||
Reference in New Issue
Block a user