Breaking Changes. Upgrade Script in Sql directory. Deployed
This commit is contained in:
@ -15,58 +15,54 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
BindingSource bindingSource;
|
||||
OrderedDictionary<BillItemKey, BillInventory> bill;
|
||||
BillItemKey oldKey;
|
||||
BillItemKey newKey;
|
||||
public BillHelperFunctions(BindingSource bindingSource, OrderedDictionary<BillItemKey, BillInventory> bill, int productID)
|
||||
{
|
||||
this.bindingSource = bindingSource;
|
||||
this.bill = bill;
|
||||
this.oldKey = new BillItemKey(productID, false);
|
||||
this.newKey = new BillItemKey(productID, true);
|
||||
this.newKey = new BillItemKey(productID, 0);
|
||||
}
|
||||
public void SetDiscount(string name, decimal discount)
|
||||
{
|
||||
if (discount > 1 || discount < 0)
|
||||
return;
|
||||
decimal maxDiscount = SaleVoucherBI.GetProductDiscountLimit(newKey.ProductID);
|
||||
decimal maxDiscount = VoucherBI.GetProductDiscountLimit(newKey.ProductID);
|
||||
if (discount > maxDiscount)
|
||||
MessageBox.Show(string.Format("Maximum discount for {0} is {1:P}", name, maxDiscount), "Excessive Discount", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
if (bill.ContainsKey(oldKey))
|
||||
bill[oldKey].Discount = discount;
|
||||
if (bill.ContainsKey(newKey))
|
||||
bill[newKey].Discount = discount;
|
||||
return;
|
||||
foreach (var item in bill)
|
||||
{
|
||||
if (item.Value.ProductID == newKey.ProductID)
|
||||
item.Value.Discount = discount;
|
||||
}
|
||||
}
|
||||
#region Add Product
|
||||
public BillInventory AddProduct()
|
||||
{
|
||||
BillInventory product;
|
||||
if ((!bill.ContainsKey(oldKey)) && (!bill.ContainsKey(newKey)))
|
||||
if (bill.ContainsKey(newKey))
|
||||
{
|
||||
//No new or old
|
||||
product = SaleVoucherBI.GetDefaultSaleBillItem(newKey.ProductID);
|
||||
product = AddProduct(product);
|
||||
}
|
||||
else if (bill.ContainsKey(newKey))
|
||||
{
|
||||
//Has new or both
|
||||
bindingSource.CurrencyManager.Position = bill.IndexOfKey(newKey);
|
||||
product = bill[newKey];
|
||||
product.Quantity += 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
//Has only old
|
||||
product = SaleVoucherBI.GetDefaultSaleBillItem(oldKey.ProductID);
|
||||
product.Discount = bill[oldKey].Discount;
|
||||
product.Price = bill[oldKey].Price;
|
||||
{ //Has only old
|
||||
product = VoucherBI.GetDefaultSaleBillItem(newKey.ProductID);
|
||||
foreach (var item in bill)
|
||||
{
|
||||
if (item.Key.ProductID == newKey.ProductID)
|
||||
{
|
||||
product.Discount = item.Value.Discount;
|
||||
product.Price = item.Value.Price;
|
||||
}
|
||||
}
|
||||
product = AddProduct(product);
|
||||
}
|
||||
return product;
|
||||
}
|
||||
private BillInventory AddProduct(BillInventory product)
|
||||
{
|
||||
bill.Add(new BillItemKey(product.ProductID, true), product);
|
||||
bill.Add(new BillItemKey(product.ProductID, 0), product);
|
||||
bindingSource.DataSource = bill.Values;
|
||||
bindingSource.CurrencyManager.Position = bindingSource.CurrencyManager.Count + 1;
|
||||
return product;
|
||||
@ -75,48 +71,28 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
#region Quantity
|
||||
public void SetQuantity(BillInventory product, decimal quantity, bool prompt)
|
||||
{
|
||||
if (product.Printed)
|
||||
return;
|
||||
if (prompt && !GetInput("Price", ref quantity))
|
||||
return;
|
||||
|
||||
if (product.Printed == 0)
|
||||
{ // new
|
||||
if (!prompt)
|
||||
quantity += product.Quantity;
|
||||
SetQuantity(product, quantity);
|
||||
}
|
||||
else if (bill.ContainsKey(newKey))
|
||||
{
|
||||
BillInventory newProduct = bill[newKey];
|
||||
if (prompt)
|
||||
SetQuantity(newProduct, quantity - product.Printed);
|
||||
else
|
||||
SetQuantity(newProduct, newProduct.Quantity + quantity);
|
||||
}
|
||||
else
|
||||
{
|
||||
////Has only old
|
||||
if (prompt)
|
||||
quantity -= product.Printed;
|
||||
if (quantity > 0 || Session.IsAllowed(RoleConstants.EDIT_PRINTED_PRODUCT))
|
||||
{
|
||||
var newProduct = SaleVoucherBI.GetDefaultSaleBillItem(product.ProductID);
|
||||
newProduct.Price = product.Price;
|
||||
newProduct.Discount = product.Discount;
|
||||
newProduct = AddProduct(newProduct);
|
||||
SetQuantity(newProduct, quantity);
|
||||
}
|
||||
}
|
||||
if (!prompt)
|
||||
quantity += product.Quantity;
|
||||
SetQuantity(product, quantity);
|
||||
}
|
||||
private void SetQuantity(BillInventory product, decimal quantity)
|
||||
{
|
||||
if (quantity < 0 && !Session.IsAllowed(RoleConstants.EDIT_PRINTED_PRODUCT))
|
||||
return;
|
||||
if (bill.ContainsKey(oldKey))
|
||||
var total = quantity;
|
||||
foreach (var item in bill)
|
||||
{
|
||||
var totalQuantity = bill[oldKey].Quantity + quantity;
|
||||
if (totalQuantity < 0)
|
||||
quantity += 0 - totalQuantity;
|
||||
if (item.Value.ProductID == newKey.ProductID)
|
||||
total += item.Value.Quantity;
|
||||
}
|
||||
|
||||
if (total < 0)
|
||||
quantity -= total;
|
||||
product.Quantity = quantity;
|
||||
}
|
||||
#endregion
|
||||
@ -129,10 +105,11 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
return;
|
||||
if (rate == 0 && !Session.IsAllowed(RoleConstants.ZERO_RATE))
|
||||
return;
|
||||
if (bill.ContainsKey(new BillItemKey(product.ProductID, true)))
|
||||
bill[new BillItemKey(product.ProductID, true)].Price = rate;
|
||||
if (bill.ContainsKey(new BillItemKey(product.ProductID, false)))
|
||||
bill[new BillItemKey(product.ProductID, false)].Price = rate;
|
||||
foreach (var item in bill)
|
||||
{
|
||||
if (item.Value.ProductID == newKey.ProductID)
|
||||
item.Value.Price = rate;
|
||||
}
|
||||
}
|
||||
private void InputBox_Validating(object sender, InputBoxValidatingArgs e)
|
||||
{
|
||||
|
||||
@ -14,7 +14,7 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
public partial class BillSettleForm : Form
|
||||
{
|
||||
private int settleOption = SettleOptionFactory.Unsettled;
|
||||
private SettleOption settleOption = SettleOption.Unsettled;
|
||||
public BillSettleForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
@ -22,38 +22,38 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
|
||||
private void btnCash_Click(object sender, EventArgs e)
|
||||
{
|
||||
settleOption = SettleOptionFactory.Cash;
|
||||
settleOption = SettleOption.Cash;
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void btnCreditCard_Click(object sender, EventArgs e)
|
||||
{
|
||||
settleOption = SettleOptionFactory.CreditCard;
|
||||
settleOption = SettleOption.CreditCard;
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void btnNC_Click(object sender, EventArgs e)
|
||||
{
|
||||
settleOption = SettleOptionFactory.NoCharge;
|
||||
settleOption = SettleOption.NoCharge;
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void btnCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
settleOption = SettleOptionFactory.Unsettled;
|
||||
settleOption = SettleOption.Unsettled;
|
||||
this.Close();
|
||||
}
|
||||
private void btnStaff_Click(object sender, EventArgs e)
|
||||
{
|
||||
settleOption = SettleOptionFactory.Staff;
|
||||
settleOption = SettleOption.Staff;
|
||||
this.Close();
|
||||
}
|
||||
private void btnBillToCompany_Click(object sender, EventArgs e)
|
||||
{
|
||||
settleOption = SettleOptionFactory.BillToCompany;
|
||||
settleOption = SettleOption.BillToCompany;
|
||||
this.Close();
|
||||
}
|
||||
public int optionChosen
|
||||
public SettleOption optionChosen
|
||||
{
|
||||
get
|
||||
{
|
||||
|
||||
@ -16,16 +16,14 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
public partial class DiscountForm : Form
|
||||
{
|
||||
private IList<ProductGroup> source;
|
||||
private IList<UnselectableCheckbox> list;
|
||||
private IList<int> selection;
|
||||
private IList<string> source;
|
||||
private HashSet<string> selection;
|
||||
decimal discount;
|
||||
public DiscountForm(IList<ProductGroup> source)
|
||||
public DiscountForm(IList<string> source)
|
||||
{
|
||||
InitializeComponent();
|
||||
this.source = source;
|
||||
list = new List<UnselectableCheckbox>();
|
||||
selection = new List<int>();
|
||||
selection = new HashSet<string>();
|
||||
}
|
||||
|
||||
private void button_Click(object sender, EventArgs e)
|
||||
@ -33,13 +31,13 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
CheckBox button = sender as CheckBox;
|
||||
if (button == null)
|
||||
return;
|
||||
var pg = (ProductGroup)button.Tag;
|
||||
var item = (string)button.Tag;
|
||||
if (button.CheckState == CheckState.Checked)
|
||||
selection.Add(pg.ProductGroupID);
|
||||
selection.Add(item);
|
||||
else
|
||||
selection.Remove(pg.ProductGroupID);
|
||||
selection.Remove(item);
|
||||
}
|
||||
public decimal Selection(out IList<int> list)
|
||||
public decimal Selection(out HashSet<string> list)
|
||||
{
|
||||
list = selection;
|
||||
return discount;
|
||||
@ -52,7 +50,7 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
|
||||
private void DiscountForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
ControlFactory.GenerateGroups(ref flpModifier, ref list, new Point(75, 75), source, new ButtonClickDelegate(button_Click));
|
||||
ControlFactory.GenerateGroups(ref flpModifier, new Point(75, 75), source, new ButtonClickDelegate(button_Click));
|
||||
}
|
||||
|
||||
private void txtAmount_KeyDown(object sender, KeyEventArgs e)
|
||||
|
||||
104
Tanshu.Accounts.PointOfSale/Sales/SalesForm.Designer.cs
generated
104
Tanshu.Accounts.PointOfSale/Sales/SalesForm.Designer.cs
generated
@ -29,9 +29,8 @@
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
this.label7 = new System.Windows.Forms.Label();
|
||||
this.txtDiscount = new System.Windows.Forms.TextBox();
|
||||
this.Label12 = new System.Windows.Forms.Label();
|
||||
@ -48,9 +47,11 @@
|
||||
this.flpActions = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.btnQuantity = new System.Windows.Forms.Button();
|
||||
this.btnRate = new System.Windows.Forms.Button();
|
||||
this.btnDelete = new System.Windows.Forms.Button();
|
||||
this.btnDiscount = new System.Windows.Forms.Button();
|
||||
this.btnModifier = new System.Windows.Forms.Button();
|
||||
this.btnWaiter = new System.Windows.Forms.Button();
|
||||
this.btnMoveTable = new System.Windows.Forms.Button();
|
||||
this.btnPrintKot = new System.Windows.Forms.Button();
|
||||
this.btnPrintBill = new System.Windows.Forms.Button();
|
||||
this.btnClear = new System.Windows.Forms.Button();
|
||||
@ -72,11 +73,11 @@
|
||||
this.txtKotID = new System.Windows.Forms.TextBox();
|
||||
this.btnCustomer = new System.Windows.Forms.Button();
|
||||
this.printedDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.additionalDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.bindingSource = new System.Windows.Forms.BindingSource(this.components);
|
||||
this.bsWaiter = new System.Windows.Forms.BindingSource(this.components);
|
||||
this.bsPending = new System.Windows.Forms.BindingSource(this.components);
|
||||
this.btnDelete = new System.Windows.Forms.Button();
|
||||
this.btnMore = new System.Windows.Forms.Button();
|
||||
this.btnMoveKot = new System.Windows.Forms.Button();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dgvProducts)).BeginInit();
|
||||
this.pnlBilling.SuspendLayout();
|
||||
this.flpActions.SuspendLayout();
|
||||
@ -189,8 +190,7 @@
|
||||
this.dgvProducts.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.dgvProducts.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
||||
this.Display,
|
||||
this.printedDataGridViewTextBoxColumn,
|
||||
this.additionalDataGridViewTextBoxColumn});
|
||||
this.printedDataGridViewTextBoxColumn});
|
||||
this.dgvProducts.DataSource = this.bindingSource;
|
||||
this.dgvProducts.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically;
|
||||
this.dgvProducts.Location = new System.Drawing.Point(12, 90);
|
||||
@ -206,13 +206,15 @@
|
||||
//
|
||||
// Display
|
||||
//
|
||||
this.Display.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
|
||||
this.Display.DataPropertyName = "Display";
|
||||
dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.Display.DefaultCellStyle = dataGridViewCellStyle1;
|
||||
dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.Display.DefaultCellStyle = dataGridViewCellStyle3;
|
||||
this.Display.HeaderText = "Display";
|
||||
this.Display.MinimumWidth = 250;
|
||||
this.Display.Name = "Display";
|
||||
this.Display.ReadOnly = true;
|
||||
this.Display.Width = 5;
|
||||
this.Display.Width = 250;
|
||||
//
|
||||
// pnlBilling
|
||||
//
|
||||
@ -278,10 +280,13 @@
|
||||
this.flpActions.Controls.Add(this.btnModifier);
|
||||
this.flpActions.Controls.Add(this.btnWaiter);
|
||||
this.flpActions.Controls.Add(this.btnPrintKot);
|
||||
this.flpActions.Controls.Add(this.btnMoveTable);
|
||||
this.flpActions.Controls.Add(this.btnPrintBill);
|
||||
this.flpActions.Controls.Add(this.btnClear);
|
||||
this.flpActions.Controls.Add(this.btnVoid);
|
||||
this.flpActions.Controls.Add(this.btnSettle);
|
||||
this.flpActions.Controls.Add(this.btnMore);
|
||||
this.flpActions.Controls.Add(this.btnMoveKot);
|
||||
this.flpActions.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.flpActions.Location = new System.Drawing.Point(0, 607);
|
||||
this.flpActions.Name = "flpActions";
|
||||
@ -308,6 +313,16 @@
|
||||
this.btnRate.UseVisualStyleBackColor = true;
|
||||
this.btnRate.Click += new System.EventHandler(this.btnRate_Click);
|
||||
//
|
||||
// btnDelete
|
||||
//
|
||||
this.btnDelete.Location = new System.Drawing.Point(165, 3);
|
||||
this.btnDelete.Name = "btnDelete";
|
||||
this.btnDelete.Size = new System.Drawing.Size(75, 75);
|
||||
this.btnDelete.TabIndex = 157;
|
||||
this.btnDelete.Text = "Delete";
|
||||
this.btnDelete.UseVisualStyleBackColor = true;
|
||||
this.btnDelete.Click += new System.EventHandler(this.btnDelete_Click);
|
||||
//
|
||||
// btnDiscount
|
||||
//
|
||||
this.btnDiscount.Location = new System.Drawing.Point(246, 3);
|
||||
@ -338,6 +353,16 @@
|
||||
this.btnWaiter.UseVisualStyleBackColor = true;
|
||||
this.btnWaiter.Click += new System.EventHandler(this.btnWaiter_Click);
|
||||
//
|
||||
// btnMoveTable
|
||||
//
|
||||
this.btnMoveTable.Location = new System.Drawing.Point(570, 3);
|
||||
this.btnMoveTable.Name = "btnMoveTable";
|
||||
this.btnMoveTable.Size = new System.Drawing.Size(75, 75);
|
||||
this.btnMoveTable.TabIndex = 158;
|
||||
this.btnMoveTable.Text = "Move Table";
|
||||
this.btnMoveTable.UseVisualStyleBackColor = true;
|
||||
this.btnMoveTable.Click += new System.EventHandler(this.btnMoveTable_Click);
|
||||
//
|
||||
// btnPrintKot
|
||||
//
|
||||
this.btnPrintKot.Location = new System.Drawing.Point(489, 3);
|
||||
@ -350,7 +375,7 @@
|
||||
//
|
||||
// btnPrintBill
|
||||
//
|
||||
this.btnPrintBill.Location = new System.Drawing.Point(570, 3);
|
||||
this.btnPrintBill.Location = new System.Drawing.Point(651, 3);
|
||||
this.btnPrintBill.Name = "btnPrintBill";
|
||||
this.btnPrintBill.Size = new System.Drawing.Size(75, 75);
|
||||
this.btnPrintBill.TabIndex = 144;
|
||||
@ -360,7 +385,7 @@
|
||||
//
|
||||
// btnClear
|
||||
//
|
||||
this.btnClear.Location = new System.Drawing.Point(651, 3);
|
||||
this.btnClear.Location = new System.Drawing.Point(732, 3);
|
||||
this.btnClear.Name = "btnClear";
|
||||
this.btnClear.Size = new System.Drawing.Size(75, 75);
|
||||
this.btnClear.TabIndex = 148;
|
||||
@ -370,7 +395,7 @@
|
||||
//
|
||||
// btnVoid
|
||||
//
|
||||
this.btnVoid.Location = new System.Drawing.Point(732, 3);
|
||||
this.btnVoid.Location = new System.Drawing.Point(813, 3);
|
||||
this.btnVoid.Name = "btnVoid";
|
||||
this.btnVoid.Size = new System.Drawing.Size(75, 75);
|
||||
this.btnVoid.TabIndex = 143;
|
||||
@ -380,7 +405,7 @@
|
||||
//
|
||||
// btnSettle
|
||||
//
|
||||
this.btnSettle.Location = new System.Drawing.Point(813, 3);
|
||||
this.btnSettle.Location = new System.Drawing.Point(894, 3);
|
||||
this.btnSettle.Name = "btnSettle";
|
||||
this.btnSettle.Size = new System.Drawing.Size(75, 75);
|
||||
this.btnSettle.TabIndex = 155;
|
||||
@ -524,24 +549,15 @@
|
||||
//
|
||||
// printedDataGridViewTextBoxColumn
|
||||
//
|
||||
this.printedDataGridViewTextBoxColumn.DataPropertyName = "Printed";
|
||||
dataGridViewCellStyle2.Format = "N2";
|
||||
this.printedDataGridViewTextBoxColumn.DefaultCellStyle = dataGridViewCellStyle2;
|
||||
this.printedDataGridViewTextBoxColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
|
||||
this.printedDataGridViewTextBoxColumn.DataPropertyName = "Quantity";
|
||||
dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
|
||||
dataGridViewCellStyle4.Format = "N2";
|
||||
this.printedDataGridViewTextBoxColumn.DefaultCellStyle = dataGridViewCellStyle4;
|
||||
this.printedDataGridViewTextBoxColumn.HeaderText = "Printed";
|
||||
this.printedDataGridViewTextBoxColumn.Name = "printedDataGridViewTextBoxColumn";
|
||||
this.printedDataGridViewTextBoxColumn.ReadOnly = true;
|
||||
this.printedDataGridViewTextBoxColumn.Width = 5;
|
||||
//
|
||||
// additionalDataGridViewTextBoxColumn
|
||||
//
|
||||
this.additionalDataGridViewTextBoxColumn.DataPropertyName = "Additional";
|
||||
dataGridViewCellStyle3.Format = "N2";
|
||||
dataGridViewCellStyle3.NullValue = null;
|
||||
this.additionalDataGridViewTextBoxColumn.DefaultCellStyle = dataGridViewCellStyle3;
|
||||
this.additionalDataGridViewTextBoxColumn.HeaderText = "Additional";
|
||||
this.additionalDataGridViewTextBoxColumn.Name = "additionalDataGridViewTextBoxColumn";
|
||||
this.additionalDataGridViewTextBoxColumn.ReadOnly = true;
|
||||
this.additionalDataGridViewTextBoxColumn.Width = 5;
|
||||
this.printedDataGridViewTextBoxColumn.Width = 65;
|
||||
//
|
||||
// bindingSource
|
||||
//
|
||||
@ -555,15 +571,25 @@
|
||||
//
|
||||
this.bsPending.DataSource = typeof(Tanshu.Accounts.Contracts.PendingBills);
|
||||
//
|
||||
// btnDelete
|
||||
// btnMore
|
||||
//
|
||||
this.btnDelete.Location = new System.Drawing.Point(165, 3);
|
||||
this.btnDelete.Name = "btnDelete";
|
||||
this.btnDelete.Size = new System.Drawing.Size(75, 75);
|
||||
this.btnDelete.TabIndex = 157;
|
||||
this.btnDelete.Text = "Delete";
|
||||
this.btnDelete.UseVisualStyleBackColor = true;
|
||||
this.btnDelete.Click += new System.EventHandler(this.btnDelete_Click);
|
||||
this.btnMore.Location = new System.Drawing.Point(3, 84);
|
||||
this.btnMore.Name = "btnMore";
|
||||
this.btnMore.Size = new System.Drawing.Size(75, 75);
|
||||
this.btnMore.TabIndex = 159;
|
||||
this.btnMore.Text = "More";
|
||||
this.btnMore.UseVisualStyleBackColor = true;
|
||||
this.btnMore.Click += new System.EventHandler(this.btnMore_Click);
|
||||
//
|
||||
// btnMoveKot
|
||||
//
|
||||
this.btnMoveKot.Location = new System.Drawing.Point(84, 84);
|
||||
this.btnMoveKot.Name = "btnMoveKot";
|
||||
this.btnMoveKot.Size = new System.Drawing.Size(75, 75);
|
||||
this.btnMoveKot.TabIndex = 160;
|
||||
this.btnMoveKot.Text = "Move Kot";
|
||||
this.btnMoveKot.UseVisualStyleBackColor = true;
|
||||
this.btnMoveKot.Click += new System.EventHandler(this.btnMoveKot_Click);
|
||||
//
|
||||
// SalesForm
|
||||
//
|
||||
@ -634,10 +660,12 @@
|
||||
private System.Windows.Forms.Button btnModifier;
|
||||
private System.Windows.Forms.FlowLayoutPanel flpGroup;
|
||||
private System.Windows.Forms.FlowLayoutPanel flpMain;
|
||||
private System.Windows.Forms.Button btnDelete;
|
||||
private System.Windows.Forms.Button btnMoveTable;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Display;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn printedDataGridViewTextBoxColumn;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn additionalDataGridViewTextBoxColumn;
|
||||
private System.Windows.Forms.Button btnDelete;
|
||||
private System.Windows.Forms.Button btnMore;
|
||||
private System.Windows.Forms.Button btnMoveKot;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -17,8 +17,6 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
public partial class SalesForm : Form, ISaleForm
|
||||
{
|
||||
BillController billController;
|
||||
List<Button> buttonList = new List<Button>();
|
||||
List<Button> buttonHeads = new List<Button>();
|
||||
|
||||
public SalesForm(BillController billController)
|
||||
{
|
||||
@ -133,24 +131,21 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
txtGrossAmount.Text = "0.00";
|
||||
txtAmount.Text = "0.00";
|
||||
bindingSource.DataSource = bill.Values;
|
||||
MoreButton(false);
|
||||
ChangeFormState(SaleFormState.Waiting);
|
||||
}
|
||||
private void ChangeFormState(SaleFormState state)
|
||||
{
|
||||
foreach (var button in buttonList)
|
||||
button.Dispose();
|
||||
foreach (var button in buttonHeads)
|
||||
button.Dispose();
|
||||
buttonList = new List<Button>();
|
||||
buttonHeads = new List<Button>();
|
||||
flpGroup.Controls.Clear();
|
||||
flpMain.Controls.Clear();
|
||||
if (state == SaleFormState.Billing)
|
||||
{
|
||||
var list = new ProductGroupBI().GetProductGroups();
|
||||
ControlFactory.GenerateGroups(ref flpGroup, ref buttonHeads, new Point(75, 75), 0, list, new ButtonClickDelegate(productTypeButton_Click));
|
||||
ControlFactory.GenerateGroups(ref flpGroup, new Point(75, 75), 0, list, new ButtonClickDelegate(productTypeButton_Click));
|
||||
}
|
||||
else
|
||||
{
|
||||
ControlFactory.GenerateTables(ref flpMain, ref buttonHeads, new Point(75, 75), 0, new FoodTableBI().List(), new ButtonClickDelegate(tableButton_Click));
|
||||
ControlFactory.GenerateTables(ref flpMain, new Point(75, 75), 0, new FoodTableBI().List(), new ButtonClickDelegate(tableButton_Click));
|
||||
}
|
||||
}
|
||||
|
||||
@ -166,11 +161,11 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
if (start < 0)
|
||||
start = 0;
|
||||
var list = new ProductGroupBI().GetProductGroups();
|
||||
ControlFactory.GenerateGroups(ref flpGroup, ref buttonHeads, new Point(75, 75), start, list, new ButtonClickDelegate(productTypeButton_Click));
|
||||
ControlFactory.GenerateGroups(ref flpGroup, new Point(75, 75), start, list, new ButtonClickDelegate(productTypeButton_Click));
|
||||
}
|
||||
else
|
||||
{
|
||||
ControlFactory.GenerateProducts(ref flpMain, ref buttonList, new Point(75, 75), 0, ProductBI.GetProducts(item.ProductGroupID), new ButtonClickDelegate(productButton_Click));
|
||||
ControlFactory.GenerateProducts(ref flpMain, new Point(75, 75), 0, ProductBI.GetProducts(item.ProductGroupID), new ButtonClickDelegate(productButton_Click));
|
||||
}
|
||||
}
|
||||
private void productButton_Click(object sender, EventArgs e)
|
||||
@ -185,7 +180,7 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
if (start < 0)
|
||||
start = 0;
|
||||
var list = ProductBI.GetProducts();
|
||||
ControlFactory.GenerateProducts(ref flpMain, ref buttonList, new Point(75, 75), start, list, new ButtonClickDelegate(productButton_Click));
|
||||
ControlFactory.GenerateProducts(ref flpMain, new Point(75, 75), start, list, new ButtonClickDelegate(productButton_Click));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -204,7 +199,7 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
if (start < 0)
|
||||
start = 0;
|
||||
var list = new FoodTableBI().List();
|
||||
ControlFactory.GenerateTables(ref flpMain, ref buttonHeads, new Point(75, 75), start, list, new ButtonClickDelegate(tableButton_Click));
|
||||
ControlFactory.GenerateTables(ref flpMain, new Point(75, 75), start, list, new ButtonClickDelegate(tableButton_Click));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -315,7 +310,12 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
DataGridView dgv = sender as DataGridView;
|
||||
BillInventory data = dgv.Rows[e.RowIndex].DataBoundItem as BillInventory;
|
||||
|
||||
if (data.Printed > 0)
|
||||
if (data.Tax == -1)
|
||||
{
|
||||
e.CellStyle.SelectionBackColor = Color.Blue;
|
||||
e.CellStyle.BackColor = Color.LightBlue;
|
||||
}
|
||||
else if (data.Printed)
|
||||
{
|
||||
e.CellStyle.SelectionBackColor = Color.HotPink;
|
||||
e.CellStyle.BackColor = Color.LightPink;
|
||||
@ -389,14 +389,43 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
|
||||
private void btnDelete_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (dgvProducts.Rows.Count <= 0)
|
||||
return;
|
||||
var p = billController.CurrentProduct;
|
||||
if (p.Quantity > 1)
|
||||
billController.SetQuantity(-1, false);
|
||||
else
|
||||
billController.ProductRemove();
|
||||
billController.SetQuantity(-1, false);
|
||||
}
|
||||
|
||||
private void btnMoveTable_Click(object sender, EventArgs e)
|
||||
{
|
||||
billController.MoveTable();
|
||||
}
|
||||
|
||||
private void btnMore_Click(object sender, EventArgs e)
|
||||
{
|
||||
var button = sender as Button;
|
||||
if (button.Text == "More")
|
||||
MoreButton(true);
|
||||
else if (button.Text == "Less")
|
||||
MoreButton(false);
|
||||
else
|
||||
throw new InvalidOperationException("Button State incorrect");
|
||||
}
|
||||
private void MoreButton(bool more)
|
||||
{
|
||||
btnMore.Text = more ? "Less" : "More";
|
||||
btnQuantity.Visible = !more;
|
||||
btnRate.Visible = more;
|
||||
btnDelete.Visible = !more;
|
||||
btnDiscount.Visible = !more;
|
||||
btnModifier.Visible = !more;
|
||||
btnMoveTable.Visible = more;
|
||||
btnMoveKot.Visible = more;
|
||||
btnVoid.Visible = more;
|
||||
|
||||
}
|
||||
|
||||
private void btnMoveKot_Click(object sender, EventArgs e)
|
||||
{
|
||||
billController.MergeKot();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -123,6 +123,12 @@
|
||||
<metadata name="bindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="Display.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="bindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="bsWaiter.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>148, 17</value>
|
||||
</metadata>
|
||||
|
||||
65
Tanshu.Accounts.PointOfSale/Sales/frmMoveTable.Designer.cs
generated
Normal file
65
Tanshu.Accounts.PointOfSale/Sales/frmMoveTable.Designer.cs
generated
Normal file
@ -0,0 +1,65 @@
|
||||
namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
partial class frmMoveTable
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.flpTables = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// flpTables
|
||||
//
|
||||
this.flpTables.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.flpTables.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.flpTables.Location = new System.Drawing.Point(0, 0);
|
||||
this.flpTables.Name = "flpTables";
|
||||
this.flpTables.Size = new System.Drawing.Size(847, 492);
|
||||
this.flpTables.TabIndex = 7;
|
||||
//
|
||||
// frmMoveTable
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(847, 492);
|
||||
this.Controls.Add(this.flpTables);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
||||
this.MaximizeBox = false;
|
||||
this.Name = "frmMoveTable";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "Move Table / Kot";
|
||||
this.Load += new System.EventHandler(this.frmMoveTable_Load);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.FlowLayoutPanel flpTables;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
69
Tanshu.Accounts.PointOfSale/Sales/frmMoveTable.cs
Normal file
69
Tanshu.Accounts.PointOfSale/Sales/frmMoveTable.cs
Normal file
@ -0,0 +1,69 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using Tanshu.Accounts.Entities;
|
||||
using Tanshu.Accounts.Contracts;
|
||||
using Tanshu.Accounts.SqlDAO;
|
||||
using Tanshu.Accounts.Helpers;
|
||||
using Tanshu.Common.KeyboardControl;
|
||||
|
||||
namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
public partial class frmMoveTable : Form
|
||||
{
|
||||
private IList<FoodTable> source;
|
||||
private FoodTable selection;
|
||||
private bool allowMerge;
|
||||
public frmMoveTable(IList<FoodTable> source, bool allowMerge)
|
||||
{
|
||||
InitializeComponent();
|
||||
this.source = source;
|
||||
selection = null;
|
||||
this.allowMerge = allowMerge;
|
||||
}
|
||||
public FoodTable Selection
|
||||
{
|
||||
get
|
||||
{
|
||||
return selection;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void frmMoveTable_Load(object sender, EventArgs e)
|
||||
{
|
||||
ControlFactory.GenerateTables(ref flpTables, new Point(75, 75), 0, source, new ButtonClickDelegate(tableButton_Click));
|
||||
}
|
||||
private void tableButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
Button button = sender as Button;
|
||||
if (button == null)
|
||||
return;
|
||||
var item = button.Tag as FoodTable;
|
||||
if (item.Name == "Previous" || item.Name == "Next")
|
||||
{
|
||||
int start = item.FoodTableID;
|
||||
if (start < 0)
|
||||
start = 0;
|
||||
ControlFactory.GenerateTables(ref flpTables, new Point(75, 75), start, source, new ButtonClickDelegate(tableButton_Click));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (item.Status != null && item.Status != string.Empty && !allowMerge)
|
||||
{
|
||||
MessageBox.Show("Cannot move to a running table", "Cannot Move", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
else if (MessageBox.Show(string.Format("Move selected table to table {0}", item.Name), "Move", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||
{
|
||||
selection = item;
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
120
Tanshu.Accounts.PointOfSale/Sales/frmMoveTable.resx
Normal file
120
Tanshu.Accounts.PointOfSale/Sales/frmMoveTable.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
Reference in New Issue
Block a user