Reprint and Printed bill editing logged.

Printed bill can no longer be changed, any changes voids the bill and prints a new one.
Added option to Split Bill.
Kot printed with right time.
Numerous bug fixes.
This commit is contained in:
unknown
2011-08-23 12:40:05 +05:30
parent 226cc30057
commit 831ec37cda
28 changed files with 625 additions and 286 deletions

View File

@ -32,8 +32,8 @@ namespace Tanshu.Accounts.PointOfSale.Sales
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();
@ -81,6 +81,7 @@ namespace Tanshu.Accounts.PointOfSale.Sales
this.btnCustomer = new System.Windows.Forms.Button();
this.bsWaiter = new System.Windows.Forms.BindingSource(this.components);
this.bsPending = new System.Windows.Forms.BindingSource(this.components);
this.btnSplitBill = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.dgvProducts)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.bindingSource)).BeginInit();
this.pnlBilling.SuspendLayout();
@ -204,15 +205,14 @@ namespace Tanshu.Accounts.PointOfSale.Sales
this.dgvProducts.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.dgvProducts.Size = new System.Drawing.Size(372, 412);
this.dgvProducts.TabIndex = 0;
this.dgvProducts.VirtualMode = true;
this.dgvProducts.CellFormatting += new System.Windows.Forms.DataGridViewCellFormattingEventHandler(this.dgvProducts_CellFormatting);
//
// 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";
@ -223,9 +223,9 @@ namespace Tanshu.Accounts.PointOfSale.Sales
//
this.printedDataGridViewTextBoxColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
this.printedDataGridViewTextBoxColumn.DataPropertyName = "Quantity";
dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
dataGridViewCellStyle2.Format = "N2";
this.printedDataGridViewTextBoxColumn.DefaultCellStyle = dataGridViewCellStyle2;
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;
@ -306,6 +306,7 @@ namespace Tanshu.Accounts.PointOfSale.Sales
this.flpActions.Controls.Add(this.btnSettle);
this.flpActions.Controls.Add(this.btnMore);
this.flpActions.Controls.Add(this.btnMoveKot);
this.flpActions.Controls.Add(this.btnSplitBill);
this.flpActions.Dock = System.Windows.Forms.DockStyle.Bottom;
this.flpActions.Location = new System.Drawing.Point(0, 607);
this.flpActions.Name = "flpActions";
@ -594,6 +595,16 @@ namespace Tanshu.Accounts.PointOfSale.Sales
//
this.bsPending.DataSource = typeof(Tanshu.Accounts.Contracts.PendingBills);
//
// btnSplitBill
//
this.btnSplitBill.Location = new System.Drawing.Point(165, 84);
this.btnSplitBill.Name = "btnSplitBill";
this.btnSplitBill.Size = new System.Drawing.Size(75, 75);
this.btnSplitBill.TabIndex = 161;
this.btnSplitBill.Text = "Split Bill";
this.btnSplitBill.UseVisualStyleBackColor = true;
this.btnSplitBill.Click += new System.EventHandler(this.btnSplitBill_Click);
//
// SalesForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -670,6 +681,7 @@ namespace Tanshu.Accounts.PointOfSale.Sales
private System.Windows.Forms.Button btnMore;
private System.Windows.Forms.Button btnMoveKot;
private readonly BillController _billController;
private System.Windows.Forms.Button btnSplitBill;
}
}

View File

@ -99,13 +99,13 @@ namespace Tanshu.Accounts.PointOfSale.Sales
//{
// selectProduct.ShowDialog();
// if (selectProduct.SelectedItem != null)
// _billController.AddProductToGrid(selectProduct.SelectedItem.ProductID);
// _billController.AddProduct(selectProduct.SelectedItem.ProductID);
//}
break;
}
case Keys.F8:
{
_billController.LoadBillFromTable(null);
_billController.LoadBill(null);
break;
}
case Keys.F11:
@ -120,7 +120,8 @@ namespace Tanshu.Accounts.PointOfSale.Sales
}
case Keys.Delete:
{
_billController.ProductRemove();
_billController.SetQuantity(-1, false);
//_billController.ProductRemove();
break;
}
case Keys.Add:
@ -156,7 +157,7 @@ namespace Tanshu.Accounts.PointOfSale.Sales
private void SalesForm_Load(object sender, EventArgs e)
{
_billController.FormLoad();
ChangeFormState(SaleFormState.Waiting);
FormState = SaleFormState.Waiting;
}
private void btnCustomer_Click(object sender, EventArgs e)
@ -276,6 +277,7 @@ namespace Tanshu.Accounts.PointOfSale.Sales
private void btnMoveTable_Click(object sender, EventArgs e)
{
_billController.MoveTable();
}
private void btnMore_Click(object sender, EventArgs e)
@ -300,6 +302,7 @@ namespace Tanshu.Accounts.PointOfSale.Sales
btnMoveTable.Visible = more;
btnMoveKot.Visible = more;
btnVoid.Visible = more;
btnSplitBill.Visible = more;
}
private void btnMoveKot_Click(object sender, EventArgs e)
@ -309,7 +312,7 @@ namespace Tanshu.Accounts.PointOfSale.Sales
#region Helper Functions
public void ClearBill(OrderedDictionary<BillItemKey, BillItemValue> bill)
public void ClearBill(List<BillItemValue> bill)
{
txtBillID.Text = "";
txtKotID.Text = "";
@ -324,9 +327,10 @@ namespace Tanshu.Accounts.PointOfSale.Sales
txtServiceCharge.Text = "0.00";
txtGrossAmount.Text = "0.00";
txtAmount.Text = "0.00";
bindingSource.DataSource = bill.Values;
bindingSource.CurrencyManager.Position = 0; //Hack for Mono
bindingSource.DataSource = bill;
MoreButton(false);
ChangeFormState(SaleFormState.Waiting);
FormState = SaleFormState.Waiting;
}
public void ShowAmount(decimal discountAmount, decimal grossAmount, decimal serviceChargeAmount,
@ -341,15 +345,19 @@ namespace Tanshu.Accounts.PointOfSale.Sales
dgvProducts.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.DisplayedCells);
}
private void ChangeFormState(SaleFormState state)
public SaleFormState FormState
{
flpGroup.Controls.Clear();
flpMain.Controls.Clear();
if (state == SaleFormState.Billing)
ControlFactory.GenerateGroups(ref flpGroup, new Point(75, 75), 0, _productGroupList, productTypeButton_Click);
else
using (var bi = new FoodTableBI())
ControlFactory.GenerateTables(ref flpMain, new Point(75, 75), 0, bi.List(), tableButton_Click);
set
{
flpGroup.Controls.Clear();
flpMain.Controls.Clear();
if (value == SaleFormState.Billing)
ControlFactory.GenerateGroups(ref flpGroup, new Point(75, 75), 0, _productGroupList, productTypeButton_Click);
else
using (var bi = new FoodTableBI())
ControlFactory.GenerateTables(ref flpMain, new Point(75, 75), 0, bi.List(), tableButton_Click);
}
}
private void productTypeButton_Click(object sender, EventArgs e)
@ -388,7 +396,7 @@ namespace Tanshu.Accounts.PointOfSale.Sales
}
else
{
_billController.AddProductToGrid(item);
_billController.AddProduct(item);
}
}
@ -409,10 +417,10 @@ namespace Tanshu.Accounts.PointOfSale.Sales
}
else
{
string tableName = item.Name;
_billController.LoadBillFromTable(tableName);
var tableName = item.Name;
_billController.LoadBill(tableName);
txtTableID.Text = tableName;
ChangeFormState(SaleFormState.Billing);
FormState = SaleFormState.Billing;
}
}
@ -431,11 +439,6 @@ namespace Tanshu.Accounts.PointOfSale.Sales
_billController.SaveKot((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);
@ -444,11 +447,13 @@ namespace Tanshu.Accounts.PointOfSale.Sales
private void btnDiscount_Click(object sender, EventArgs e)
{
_billController.ShowDiscount();
//if (dgvProducts.Rows.Count > 0)
// billController.SetDiscount(billController.CurrentProduct, -1);
}
#endregion
private void btnSplitBill_Click(object sender, EventArgs e)
{
_billController.SplitBill();
}
}
}

View File

@ -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>

View File

@ -1,6 +1,6 @@
namespace Tanshu.Accounts.PointOfSale
{
partial class FrmSettleAmounts
partial class SettleAmountsForm
{
/// <summary>
/// Required designer variable.
@ -52,7 +52,7 @@
this.txtCurrentAmount.TabIndex = 0;
this.txtCurrentAmount.KeyDown += new System.Windows.Forms.KeyEventHandler(this.TxtCurrentAmountKeyDown);
//
// FrmSettleAmounts
// SettleAmountsForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
@ -62,7 +62,7 @@
this.Controls.Add(this.txtAmount);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.MaximizeBox = false;
this.Name = "FrmSettleAmounts";
this.Name = "SettleAmountsForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Settle Bill";
this.Load += new System.EventHandler(this.SettleChoicesFormLoad);

View File

@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using Tanshu.Accounts.Entities;
@ -8,13 +7,13 @@ using Tanshu.Common.KeyboardControl;
namespace Tanshu.Accounts.PointOfSale
{
public partial class FrmSettleAmounts : Form
public partial class SettleAmountsForm : Form
{
private IKeyboardControl _keyboardControl;
private readonly decimal _amount;
private readonly SettleOption _settleOption;
private decimal _settleAmount;
public FrmSettleAmounts(IKeyboardControl keyboardControl, SettleOption settleOption, decimal amount)
public SettleAmountsForm(IKeyboardControl keyboardControl, SettleOption settleOption, decimal amount)
{
InitializeComponent();

View File

@ -30,7 +30,7 @@ namespace Tanshu.Accounts.PointOfSale
if (button.Tag is SettleOption)
{
var settleOption = (SettleOption)button.Tag;
using (var frm = new FrmSettleAmounts(new NumpadControl(), settleOption, _amount))
using (var frm = new SettleAmountsForm(new NumpadControl(), settleOption, _amount))
{
frm.ShowDialog();
UpdateChoice(settleOption, frm.AmountSettled, _list[button]);