2010-03-02 17:56:21 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
using System.Threading;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
using Tanshu.Accounts.Contracts;
|
2011-03-11 18:49:48 +00:00
|
|
|
|
using Tanshu.Accounts.Entities;
|
2010-03-02 17:56:21 +00:00
|
|
|
|
using Tanshu.Accounts.Helpers;
|
2011-03-11 18:49:48 +00:00
|
|
|
|
using Tanshu.Accounts.Repository;
|
2010-03-02 17:56:21 +00:00
|
|
|
|
using Tanshu.Common;
|
|
|
|
|
|
2011-03-11 18:49:48 +00:00
|
|
|
|
namespace Tanshu.Accounts.PointOfSale.Sales
|
2010-03-02 17:56:21 +00:00
|
|
|
|
{
|
2011-01-10 19:49:11 +00:00
|
|
|
|
public partial class SalesForm : Form, ISaleForm
|
2010-03-02 17:56:21 +00:00
|
|
|
|
{
|
2011-01-10 19:49:11 +00:00
|
|
|
|
public SalesForm(BillController billController)
|
2010-03-02 17:56:21 +00:00
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
2011-03-11 18:49:48 +00:00
|
|
|
|
this._billController = billController;
|
2011-01-10 19:49:11 +00:00
|
|
|
|
billController.InitGui(this);
|
2010-03-02 17:56:21 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-03-11 18:49:48 +00:00
|
|
|
|
#region ISaleForm Members
|
|
|
|
|
|
2011-01-10 19:49:11 +00:00
|
|
|
|
public void SetUserName(string name)
|
|
|
|
|
{
|
2011-03-11 18:49:48 +00:00
|
|
|
|
Text = name;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void SetCustomerDisplay(string name)
|
|
|
|
|
{
|
|
|
|
|
btnCustomer.Text = name;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void ShowInfo(string billID, string kotID, DateTime creationDate, DateTime date, DateTime lastEditDate,
|
|
|
|
|
string customer, string tableID, int waiterID, string waiter)
|
|
|
|
|
{
|
|
|
|
|
txtBillID.Text = billID;
|
|
|
|
|
txtKotID.Text = kotID;
|
|
|
|
|
txtCreationDate.Text = creationDate.ToString("HH:mm dd-MMM-yyyy");
|
|
|
|
|
txtDate.Text = date.ToString("HH:mm dd-MMM-yyyy");
|
|
|
|
|
txtLastEditDate.Text = lastEditDate.ToString("HH:mm dd-MMM-yyyy");
|
|
|
|
|
btnCustomer.Text = customer;
|
|
|
|
|
txtTableID.Text = tableID;
|
|
|
|
|
btnWaiter.Tag = waiterID;
|
|
|
|
|
btnWaiter.Text = string.Format("{0} - F5", waiter);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public BindingSource BindingSource
|
|
|
|
|
{
|
|
|
|
|
get { return bindingSource; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void CloseWindow()
|
|
|
|
|
{
|
|
|
|
|
Close();
|
2011-01-10 19:49:11 +00:00
|
|
|
|
}
|
2011-03-11 18:49:48 +00:00
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
2010-03-02 17:56:21 +00:00
|
|
|
|
private void SalesForm_KeyDown(object sender, KeyEventArgs e)
|
|
|
|
|
{
|
2011-01-09 23:36:24 +00:00
|
|
|
|
switch (e.KeyCode)
|
2010-03-02 17:56:21 +00:00
|
|
|
|
{
|
2011-01-09 23:36:24 +00:00
|
|
|
|
case Keys.F2:
|
|
|
|
|
{
|
2011-02-09 12:03:22 +00:00
|
|
|
|
btnQuantity_Click(sender, new EventArgs());
|
2011-01-09 23:36:24 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case Keys.F3:
|
|
|
|
|
{
|
|
|
|
|
btnDiscount_Click(sender, new EventArgs());
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case Keys.F4:
|
|
|
|
|
{
|
|
|
|
|
if (!e.Alt)
|
2011-03-11 18:49:48 +00:00
|
|
|
|
_billController.ShowCustomerList(false);
|
2011-01-09 23:36:24 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case Keys.F5:
|
|
|
|
|
{
|
|
|
|
|
btnWaiter_Click(sender, new EventArgs());
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case Keys.F7:
|
|
|
|
|
{
|
2011-03-11 18:49:48 +00:00
|
|
|
|
using (var selectProduct = new SelectProduct(ProductBI.GetFilteredProducts, true))
|
2010-03-02 17:56:21 +00:00
|
|
|
|
{
|
2011-01-09 23:36:24 +00:00
|
|
|
|
selectProduct.ShowDialog();
|
|
|
|
|
if (selectProduct.SelectedItem != null)
|
2011-03-11 18:49:48 +00:00
|
|
|
|
_billController.AddProductToGrid(selectProduct.SelectedItem.ProductID);
|
2010-03-02 17:56:21 +00:00
|
|
|
|
}
|
2011-01-09 23:36:24 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case Keys.F8:
|
|
|
|
|
{
|
2011-03-11 18:49:48 +00:00
|
|
|
|
_billController.LoadBillFromTable(null);
|
2011-01-09 23:36:24 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case Keys.F11:
|
|
|
|
|
{
|
|
|
|
|
btnPrintBill_Click(sender, e);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case Keys.F12:
|
|
|
|
|
{
|
|
|
|
|
btnPrintKot_Click(sender, e);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case Keys.Delete:
|
|
|
|
|
{
|
2011-03-11 18:49:48 +00:00
|
|
|
|
_billController.ProductRemove();
|
2011-01-09 23:36:24 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case Keys.Add:
|
|
|
|
|
{
|
2011-03-11 18:49:48 +00:00
|
|
|
|
_billController.SetQuantity(1, false);
|
2011-01-09 23:36:24 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case Keys.Subtract:
|
|
|
|
|
{
|
2011-03-11 18:49:48 +00:00
|
|
|
|
_billController.SetQuantity(-1, false);
|
2011-01-09 23:36:24 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case Keys.Up:
|
|
|
|
|
{
|
|
|
|
|
if ((bindingSource.Position >= 1) && (!dgvProducts.Focused))
|
|
|
|
|
bindingSource.Position -= 1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case Keys.Down:
|
|
|
|
|
{
|
|
|
|
|
if ((bindingSource.Position < bindingSource.Count - 1) && (!dgvProducts.Focused))
|
|
|
|
|
bindingSource.Position += 1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case Keys.Escape:
|
|
|
|
|
{
|
2011-03-11 18:49:48 +00:00
|
|
|
|
_billController.CancelBillChanges();
|
2011-01-09 23:36:24 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
2010-03-02 17:56:21 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void SalesForm_Load(object sender, EventArgs e)
|
|
|
|
|
{
|
2011-03-11 18:49:48 +00:00
|
|
|
|
_billController.FormLoad();
|
2011-01-13 20:21:02 +00:00
|
|
|
|
ChangeFormState(SaleFormState.Waiting);
|
2010-03-02 17:56:21 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-01-10 19:49:11 +00:00
|
|
|
|
private void btnCustomer_Click(object sender, EventArgs e)
|
2010-03-02 17:56:21 +00:00
|
|
|
|
{
|
2011-03-11 18:49:48 +00:00
|
|
|
|
_billController.ShowCustomerList(false);
|
2010-03-02 17:56:21 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-01-10 19:49:11 +00:00
|
|
|
|
private void btnVoid_Click(object sender, EventArgs e)
|
2010-03-02 17:56:21 +00:00
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
2011-03-11 18:49:48 +00:00
|
|
|
|
_billController.VoidBill();
|
2010-03-02 17:56:21 +00:00
|
|
|
|
}
|
2011-01-10 19:49:11 +00:00
|
|
|
|
catch (PermissionException ex)
|
2010-03-02 17:56:21 +00:00
|
|
|
|
{
|
2011-01-10 19:49:11 +00:00
|
|
|
|
MessageBox.Show(ex.Message);
|
2010-03-02 17:56:21 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2011-03-11 18:49:48 +00:00
|
|
|
|
|
2010-03-02 17:56:21 +00:00
|
|
|
|
private void btnRate_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2011-03-11 18:49:48 +00:00
|
|
|
|
_billController.ChangeRate();
|
2010-03-02 17:56:21 +00:00
|
|
|
|
}
|
2011-03-11 18:49:48 +00:00
|
|
|
|
|
2010-03-02 17:56:21 +00:00
|
|
|
|
private void btnClear_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2011-03-11 18:49:48 +00:00
|
|
|
|
_billController.CancelBillChanges();
|
2010-03-02 17:56:21 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void dgvProducts_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
|
|
|
|
|
{
|
2011-03-11 18:49:48 +00:00
|
|
|
|
var dgv = sender as DataGridView;
|
|
|
|
|
var data = dgv.Rows[e.RowIndex].DataBoundItem as BillInventory;
|
2010-03-02 17:56:21 +00:00
|
|
|
|
|
2011-02-18 16:54:48 +00:00
|
|
|
|
if (data.Tax == -1)
|
|
|
|
|
{
|
|
|
|
|
e.CellStyle.SelectionBackColor = Color.Blue;
|
|
|
|
|
e.CellStyle.BackColor = Color.LightBlue;
|
|
|
|
|
}
|
|
|
|
|
else if (data.Printed)
|
2010-03-02 17:56:21 +00:00
|
|
|
|
{
|
|
|
|
|
e.CellStyle.SelectionBackColor = Color.HotPink;
|
|
|
|
|
e.CellStyle.BackColor = Color.LightPink;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
e.CellStyle.SelectionBackColor = Color.Green;
|
|
|
|
|
e.CellStyle.BackColor = Color.LightGreen;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void btnWaiter_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2011-03-11 18:49:48 +00:00
|
|
|
|
using (var selectWaiter = new SelectWaiter(WaiterBI.GetFilteredWaiters, true))
|
2010-03-02 17:56:21 +00:00
|
|
|
|
{
|
2011-03-11 18:49:48 +00:00
|
|
|
|
selectWaiter.waiterEvent += selectWaiter_waiterEvent;
|
2010-03-02 17:56:21 +00:00
|
|
|
|
selectWaiter.ShowDialog();
|
|
|
|
|
if (selectWaiter.SelectedItem != null)
|
|
|
|
|
{
|
|
|
|
|
btnWaiter.Text = string.Format("{0} - F5", selectWaiter.SelectedItem.Name);
|
|
|
|
|
btnWaiter.Tag = selectWaiter.SelectedItem.WaiterID;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
btnWaiter.Text = "Select Waiter - F5";
|
2011-01-30 07:14:05 +00:00
|
|
|
|
btnWaiter.Tag = WaiterBI.GetWaiters()[0].WaiterID;
|
2010-03-02 17:56:21 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2011-03-11 18:49:48 +00:00
|
|
|
|
|
|
|
|
|
private Waiter selectWaiter_waiterEvent(object sender, WaiterEventArgs e)
|
2010-03-02 17:56:21 +00:00
|
|
|
|
{
|
2011-01-30 07:14:05 +00:00
|
|
|
|
Waiter waiter = e.Waiter;
|
2010-03-02 17:56:21 +00:00
|
|
|
|
if (!Thread.CurrentPrincipal.IsInRole("Waiter/Master"))
|
|
|
|
|
return waiter;
|
|
|
|
|
|
|
|
|
|
switch (e.Action)
|
|
|
|
|
{
|
|
|
|
|
case 1: // Add
|
2011-01-30 07:14:05 +00:00
|
|
|
|
WaiterBI.Insert(waiter);
|
2010-03-02 17:56:21 +00:00
|
|
|
|
e.Handled = true;
|
|
|
|
|
return waiter;
|
|
|
|
|
case 2: // Edit
|
2011-01-30 07:14:05 +00:00
|
|
|
|
WaiterBI.Update(waiter);
|
2010-03-02 17:56:21 +00:00
|
|
|
|
e.Handled = true;
|
|
|
|
|
return waiter;
|
|
|
|
|
case 3: // Delete
|
2011-01-30 07:14:05 +00:00
|
|
|
|
e.Handled = WaiterBI.Delete(waiter.WaiterID);
|
|
|
|
|
return WaiterBI.GetWaiter(1);
|
2010-03-02 17:56:21 +00:00
|
|
|
|
default:
|
|
|
|
|
throw new ArgumentException();
|
|
|
|
|
}
|
|
|
|
|
}
|
2011-01-09 23:36:24 +00:00
|
|
|
|
|
2011-01-30 07:14:05 +00:00
|
|
|
|
private void btnSettle_Click(object sender, EventArgs e)
|
2010-03-02 17:56:21 +00:00
|
|
|
|
{
|
2011-03-11 18:49:48 +00:00
|
|
|
|
_billController.SettleBill();
|
2010-03-02 17:56:21 +00:00
|
|
|
|
}
|
2011-01-17 14:55:43 +00:00
|
|
|
|
|
2011-01-30 07:14:05 +00:00
|
|
|
|
private void btnModifier_Click(object sender, EventArgs e)
|
2011-01-17 14:55:43 +00:00
|
|
|
|
{
|
2011-03-11 18:49:48 +00:00
|
|
|
|
BillInventory item = _billController.CurrentProduct;
|
2011-02-09 12:03:22 +00:00
|
|
|
|
if (item == null)
|
|
|
|
|
return;
|
2011-03-11 18:49:48 +00:00
|
|
|
|
int id = new ProductGroupBI().GetProductGroupOfProduct(item.ProductID).ProductGroupID;
|
|
|
|
|
_billController.ShowModifiers(id, item);
|
2011-01-17 14:55:43 +00:00
|
|
|
|
}
|
2011-01-31 20:33:22 +00:00
|
|
|
|
|
|
|
|
|
private void btnDelete_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2011-03-11 18:49:48 +00:00
|
|
|
|
_billController.SetQuantity(-1, false);
|
2011-02-18 16:54:48 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void btnMoveTable_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2011-03-11 18:49:48 +00:00
|
|
|
|
_billController.MoveTable();
|
2011-02-18 16:54:48 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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);
|
2011-02-09 12:03:22 +00:00
|
|
|
|
else
|
2011-02-18 16:54:48 +00:00
|
|
|
|
throw new InvalidOperationException("Button State incorrect");
|
|
|
|
|
}
|
2011-03-11 18:49:48 +00:00
|
|
|
|
|
2011-02-18 16:54:48 +00:00
|
|
|
|
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;
|
2011-01-31 20:33:22 +00:00
|
|
|
|
}
|
2011-02-18 16:54:48 +00:00
|
|
|
|
|
|
|
|
|
private void btnMoveKot_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2011-03-11 18:49:48 +00:00
|
|
|
|
_billController.MergeKot();
|
2011-02-18 16:54:48 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-03-11 18:49:48 +00:00
|
|
|
|
#region Helper Functions
|
|
|
|
|
|
|
|
|
|
public void ClearBill(OrderedDictionary<BillItemKey, BillInventory> bill)
|
|
|
|
|
{
|
|
|
|
|
txtBillID.Text = "";
|
|
|
|
|
txtKotID.Text = "";
|
|
|
|
|
txtCreationDate.Text = "";
|
|
|
|
|
txtDate.Text = "";
|
|
|
|
|
txtLastEditDate.Text = "";
|
|
|
|
|
txtTableID.Text = "";
|
|
|
|
|
btnWaiter.Text = "Waiter - F5";
|
|
|
|
|
btnWaiter.Tag = null;
|
|
|
|
|
txtGrossTax.Text = "0.00";
|
|
|
|
|
txtDiscount.Text = "0.00";
|
|
|
|
|
txtServiceCharge.Text = "0.00";
|
|
|
|
|
txtGrossAmount.Text = "0.00";
|
|
|
|
|
txtAmount.Text = "0.00";
|
|
|
|
|
bindingSource.DataSource = bill.Values;
|
|
|
|
|
MoreButton(false);
|
|
|
|
|
ChangeFormState(SaleFormState.Waiting);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void ShowAmount(decimal discountAmount, decimal grossAmount, decimal serviceChargeAmount,
|
|
|
|
|
decimal taxAmount, decimal valueAmount, List<BillInventory> bill)
|
|
|
|
|
{
|
|
|
|
|
txtGrossTax.Text = string.Format("{0:#0.00}", taxAmount);
|
|
|
|
|
txtDiscount.Text = string.Format("{0:#0.00}", discountAmount);
|
|
|
|
|
txtServiceCharge.Text = string.Format("{0:#0.00}", serviceChargeAmount);
|
|
|
|
|
txtGrossAmount.Text = string.Format("{0:#0.00}", grossAmount);
|
|
|
|
|
txtAmount.Text = string.Format("{0:#0.00}", Math.Round(valueAmount));
|
|
|
|
|
bindingSource.DataSource = bill;
|
|
|
|
|
dgvProducts.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.DisplayedCells);
|
|
|
|
|
}
|
2010-03-02 17:56:21 +00:00
|
|
|
|
|
2011-03-11 18:49:48 +00:00
|
|
|
|
private void ChangeFormState(SaleFormState state)
|
|
|
|
|
{
|
|
|
|
|
flpGroup.Controls.Clear();
|
|
|
|
|
flpMain.Controls.Clear();
|
|
|
|
|
if (state == SaleFormState.Billing)
|
|
|
|
|
{
|
|
|
|
|
IList<ProductGroup> list = new ProductGroupBI().GetProductGroups();
|
|
|
|
|
ControlFactory.GenerateGroups(ref flpGroup, new Point(75, 75), 0, list, productTypeButton_Click);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ControlFactory.GenerateTables(ref flpMain, new Point(75, 75), 0, new FoodTableBI().List(),
|
|
|
|
|
tableButton_Click);
|
|
|
|
|
}
|
|
|
|
|
}
|
2010-03-02 17:56:21 +00:00
|
|
|
|
|
2011-03-11 18:49:48 +00:00
|
|
|
|
private void productTypeButton_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
var button = sender as Button;
|
|
|
|
|
if (button == null)
|
|
|
|
|
return;
|
|
|
|
|
var item = button.Tag as ProductGroup;
|
|
|
|
|
if (item.Name == "Previous" || item.Name == "Next")
|
|
|
|
|
{
|
|
|
|
|
int start = item.ProductGroupID;
|
|
|
|
|
if (start < 0)
|
|
|
|
|
start = 0;
|
|
|
|
|
IList<ProductGroup> list = new ProductGroupBI().GetProductGroups();
|
|
|
|
|
ControlFactory.GenerateGroups(ref flpGroup, new Point(75, 75), start, list, productTypeButton_Click);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ControlFactory.GenerateProducts(ref flpMain, new Point(75, 75), 0,
|
|
|
|
|
ProductBI.GetProducts(item.ProductGroupID), productButton_Click);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void productButton_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
var button = sender as Button;
|
|
|
|
|
if (button == null)
|
|
|
|
|
return;
|
|
|
|
|
var item = button.Tag as Product;
|
|
|
|
|
if (item.Name == "Previous" || item.Name == "Next")
|
|
|
|
|
{
|
|
|
|
|
int start = item.ProductID;
|
|
|
|
|
if (start < 0)
|
|
|
|
|
start = 0;
|
|
|
|
|
IList<Product> list = ProductBI.GetProducts();
|
|
|
|
|
ControlFactory.GenerateProducts(ref flpMain, new Point(75, 75), start, list, productButton_Click);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
_billController.AddProductToGrid(item.ProductID);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void tableButton_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
var 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;
|
|
|
|
|
IList<FoodTable> list = new FoodTableBI().List();
|
|
|
|
|
ControlFactory.GenerateTables(ref flpMain, new Point(75, 75), start, list, tableButton_Click);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
string tableName = item.Name;
|
|
|
|
|
_billController.LoadBillFromTable(tableName);
|
|
|
|
|
txtTableID.Text = tableName;
|
|
|
|
|
ChangeFormState(SaleFormState.Billing);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void btnPrintBill_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (btnWaiter.Tag == null)
|
|
|
|
|
btnWaiter.Tag = WaiterBI.GetWaiters()[0].WaiterID;
|
|
|
|
|
_billController.Save(true, (int) btnWaiter.Tag, txtTableID.Text);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void btnPrintKot_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (btnWaiter.Tag == null)
|
|
|
|
|
btnWaiter.Tag = WaiterBI.GetWaiters()[0].WaiterID;
|
|
|
|
|
_billController.Save(false, (int) btnWaiter.Tag, txtTableID.Text);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void btnCancel_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
_billController.CancelBillChanges();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void btnQuantity_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
_billController.SetQuantity(0, true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void btnDiscount_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
_billController.ShowDiscount();
|
|
|
|
|
|
|
|
|
|
//if (dgvProducts.Rows.Count > 0)
|
|
|
|
|
// billController.SetDiscount(billController.CurrentProduct, -1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|