Added Basecode to Product

Added Voucher Type During Printing
Added Discount Report
Fixed Void bill table not getting cleared error
Added PAX to table
Removed Itital Setup button in MainForm as it was not doing anything
This commit is contained in:
unknown
2011-12-05 15:11:02 +05:30
parent 719dbd49d2
commit 964d0a78bf
54 changed files with 2285 additions and 1028 deletions

View File

@ -1,9 +1,5 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Windows.Forms;
using Tanshu.Accounts.Helpers;
using Tanshu.Accounts.Repository;
using Tanshu.Accounts.Contracts;
using Tanshu.Accounts.Entities;
@ -13,33 +9,33 @@ namespace Tanshu.Accounts.PointOfSale
{
public partial class CustomersForm : Form
{
private int? customerID;
private Customer customer;
private string phone;
private int? _customerID;
private Customer _customer;
private readonly string phone;
#region Form Load
public CustomersForm(int? customerID, string phone)
{
InitializeComponent();
this.customerID = customerID;
this._customerID = customerID;
this.phone = phone;
}
private void CustomersForm_Load(object sender, EventArgs e)
{
if (customerID.HasValue)
if (_customerID.HasValue)
{
using (var bi = new CustomerBI(false))
customer = bi.Get(x => x.CustomerID == customerID.Value);
_customer = bi.Get(x => x.CustomerID == _customerID.Value);
btnDelete.Enabled = true;
txtName.Text = customer.Name;
txtPhone.Text = customer.Phone;
txtAddress.Text = customer.Address;
txtRemarks.Text = customer.Remarks;
chkImportant.Checked = customer.Important;
txtName.Text = _customer.Name;
txtPhone.Text = _customer.Phone;
txtAddress.Text = _customer.Address;
txtRemarks.Text = _customer.Remarks;
chkImportant.Checked = _customer.Important;
}
else
txtPhone.Text = phone;
btnSave.Text = customerID.HasValue ? "&Update" : "&Save";
btnSave.Text = _customerID.HasValue ? "&Update" : "&Save";
}
#endregion
@ -60,7 +56,7 @@ namespace Tanshu.Accounts.PointOfSale
private void btnDelete_Click(object sender, EventArgs e)
{
using (var bi = new CustomerBI())
bi.Delete(x => x.CustomerID == customer.CustomerID);
bi.Delete(x => x.CustomerID == _customer.CustomerID);
btnCancel_Click(sender, e);
}
private void btnCancel_Click(object sender, EventArgs e)
@ -72,26 +68,24 @@ namespace Tanshu.Accounts.PointOfSale
#region Add / Edit / Delete
private bool ValidateValues()
{
bool returnType = true;
if (txtName.Text.Trim().Length == 0)
return false;
return returnType;
return txtName.Text.Trim().Length != 0;
}
private void Save()
{
if (customer == null)
customer = new Customer();
User user = Session.User;
customer.Name = txtName.Text;
customer.Phone = txtPhone.Text;
customer.Address = txtAddress.Text;
customer.Remarks = txtRemarks.Text;
customer.Important = chkImportant.Checked;
if (_customer == null)
_customer = new Customer();
_customer.Name = txtName.Text;
_customer.Phone = txtPhone.Text;
_customer.Address = txtAddress.Text;
_customer.Remarks = txtRemarks.Text;
_customer.Important = chkImportant.Checked;
using (var bi = new CustomerBI())
if (customer.CustomerID == 0)
bi.Insert(customer);
if (_customer.CustomerID == 0)
bi.Insert(_customer);
else
bi.Update(customer);
bi.Update(_customer);
}
private void Delete(int customerID)
{
@ -102,7 +96,7 @@ namespace Tanshu.Accounts.PointOfSale
public Customer Customer
{
get { return customer; }
get { return _customer; }
}
}
}

View File

@ -1,46 +1,38 @@
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 DiscountForm : Form
{
private IList<string> source;
private HashSet<string> selection;
decimal discount;
private readonly IList<string> _source;
private readonly HashSet<string> _selection;
decimal _discount;
public DiscountForm(IList<string> source)
{
InitializeComponent();
this.source = source;
selection = new HashSet<string>();
this._source = source;
_selection = new HashSet<string>();
}
private void button_Click(object sender, EventArgs e)
{
CheckBox button = sender as CheckBox;
var button = sender as CheckBox;
if (button == null)
return;
var item = (string)button.Tag;
if (button.CheckState == CheckState.Checked)
selection.Add(item);
_selection.Add(item);
else
selection.Remove(item);
_selection.Remove(item);
}
public decimal Selection(out HashSet<string> list)
{
list = selection;
return discount;
list = _selection;
return _discount;
}
private void btnClose_Click(object sender, EventArgs e)
@ -50,12 +42,12 @@ namespace Tanshu.Accounts.PointOfSale
private void DiscountForm_Load(object sender, EventArgs e)
{
ControlFactory.GenerateGroups(ref flpModifier, 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)
{
if (e.KeyCode == Keys.Return && decimal.TryParse(txtAmount.Text, out discount) && discount >= 0 && discount <= 100)
if (e.KeyCode == Keys.Return && decimal.TryParse(txtAmount.Text, out _discount) && _discount >= 0 && _discount <= 100)
{
this.DialogResult = DialogResult.OK;
this.Close();

View File

@ -0,0 +1,74 @@
namespace Tanshu.Accounts.PointOfSale
{
partial class PaxForm
{
/// <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.numpadControl1 = new Tanshu.Common.KeyboardControl.NumpadControl();
this.txtAmount = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// numpadControl1
//
this.numpadControl1.Location = new System.Drawing.Point(12, 38);
this.numpadControl1.Name = "numpadControl1";
this.numpadControl1.Size = new System.Drawing.Size(224, 224);
this.numpadControl1.TabIndex = 1;
//
// txtAmount
//
this.txtAmount.Location = new System.Drawing.Point(12, 12);
this.txtAmount.Name = "txtAmount";
this.txtAmount.Size = new System.Drawing.Size(224, 20);
this.txtAmount.TabIndex = 0;
this.txtAmount.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtAmount_KeyDown);
//
// PaxForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(248, 274);
this.ControlBox = false;
this.Controls.Add(this.txtAmount);
this.Controls.Add(this.numpadControl1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.MaximizeBox = false;
this.Name = "PaxForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Pax";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private Tanshu.Common.KeyboardControl.NumpadControl numpadControl1;
private System.Windows.Forms.TextBox txtAmount;
}
}

View File

@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using Tanshu.Accounts.Helpers;
namespace Tanshu.Accounts.PointOfSale
{
public partial class PaxForm : Form
{
int _pax;
public PaxForm()
{
InitializeComponent();
}
public int Pax
{
get { return _pax; }
}
private void txtAmount_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Return && int.TryParse(txtAmount.Text, out _pax))
{
this.DialogResult = DialogResult.OK;
this.Close();
}
else if (e.KeyCode == Keys.Escape)
{
this.DialogResult = DialogResult.Cancel;
this.Close();
}
}
}
}

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

View File

@ -32,8 +32,8 @@ namespace Tanshu.Accounts.PointOfSale.Sales
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = 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();
@ -64,6 +64,7 @@ namespace Tanshu.Accounts.PointOfSale.Sales
this.btnSettle = new System.Windows.Forms.Button();
this.btnMore = new System.Windows.Forms.Button();
this.btnMoveKot = new System.Windows.Forms.Button();
this.btnSplitBill = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.txtServiceCharge = new System.Windows.Forms.TextBox();
this.txtTableID = new System.Windows.Forms.TextBox();
@ -81,7 +82,8 @@ 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();
this.label10 = new System.Windows.Forms.Label();
this.txtPax = new System.Windows.Forms.TextBox();
((System.ComponentModel.ISupportInitialize)(this.dgvProducts)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.bindingSource)).BeginInit();
this.pnlBilling.SuspendLayout();
@ -211,8 +213,8 @@ namespace Tanshu.Accounts.PointOfSale.Sales
//
this.Display.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
this.Display.DataPropertyName = "Display";
dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.Display.DefaultCellStyle = dataGridViewCellStyle3;
dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.Display.DefaultCellStyle = dataGridViewCellStyle1;
this.Display.HeaderText = "Display";
this.Display.MinimumWidth = 250;
this.Display.Name = "Display";
@ -223,9 +225,9 @@ namespace Tanshu.Accounts.PointOfSale.Sales
//
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;
dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
dataGridViewCellStyle2.Format = "N2";
this.printedDataGridViewTextBoxColumn.DefaultCellStyle = dataGridViewCellStyle2;
this.printedDataGridViewTextBoxColumn.HeaderText = "Printed";
this.printedDataGridViewTextBoxColumn.Name = "printedDataGridViewTextBoxColumn";
this.printedDataGridViewTextBoxColumn.ReadOnly = true;
@ -239,6 +241,8 @@ namespace Tanshu.Accounts.PointOfSale.Sales
//
this.pnlBilling.AutoSize = true;
this.pnlBilling.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.pnlBilling.Controls.Add(this.label10);
this.pnlBilling.Controls.Add(this.txtPax);
this.pnlBilling.Controls.Add(this.flpMain);
this.pnlBilling.Controls.Add(this.flpGroup);
this.pnlBilling.Controls.Add(this.flpActions);
@ -453,6 +457,16 @@ namespace Tanshu.Accounts.PointOfSale.Sales
this.btnMoveKot.UseVisualStyleBackColor = true;
this.btnMoveKot.Click += new System.EventHandler(this.btnMoveKot_Click);
//
// 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);
//
// label1
//
this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
@ -496,9 +510,9 @@ namespace Tanshu.Accounts.PointOfSale.Sales
this.label9.AutoSize = true;
this.label9.Location = new System.Drawing.Point(259, 12);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(72, 13);
this.label9.Size = new System.Drawing.Size(55, 13);
this.label9.TabIndex = 136;
this.label9.Text = "Booking Time";
this.label9.Text = "Start Time";
//
// label8
//
@ -595,15 +609,22 @@ namespace Tanshu.Accounts.PointOfSale.Sales
//
this.bsPending.DataSource = typeof(Tanshu.Accounts.Contracts.PendingBills);
//
// btnSplitBill
// label10
//
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);
this.label10.AutoSize = true;
this.label10.Location = new System.Drawing.Point(804, 12);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(25, 13);
this.label10.TabIndex = 161;
this.label10.Text = "Pax";
//
// txtPax
//
this.txtPax.Location = new System.Drawing.Point(807, 28);
this.txtPax.Name = "txtPax";
this.txtPax.ReadOnly = true;
this.txtPax.Size = new System.Drawing.Size(88, 20);
this.txtPax.TabIndex = 160;
//
// SalesForm
//
@ -682,6 +703,8 @@ namespace Tanshu.Accounts.PointOfSale.Sales
private System.Windows.Forms.Button btnMoveKot;
private readonly BillController _billController;
private System.Windows.Forms.Button btnSplitBill;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.TextBox txtPax;
}
}

View File

@ -7,7 +7,6 @@ using Tanshu.Accounts.Contracts;
using Tanshu.Accounts.Entities;
using Tanshu.Accounts.Helpers;
using Tanshu.Accounts.Repository;
using Tanshu.Common;
namespace Tanshu.Accounts.PointOfSale.Sales
{
@ -42,18 +41,30 @@ namespace Tanshu.Accounts.PointOfSale.Sales
btnCustomer.Text = name;
}
public void ShowInfo(string billID, string kotID, DateTime creationDate, DateTime date, DateTime lastEditDate,
string customer, string tableID, int waiterID, string waiter)
public void SetWaiterDisplay(string name)
{
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);
btnWaiter.Text = string.Format("{0} - F5", name);
}
public void ShowInfo(Voucher voucher)
{
if (voucher.VoucherID == 0)
{
txtTableID.Text = voucher.TableID;
txtPax.Text = voucher.Pax.ToString();
}
else
{
txtBillID.Text = voucher.BillID;
txtKotID.Text = voucher.KotID;
txtCreationDate.Text = voucher.CreationDate.ToString("HH:mm dd-MMM-yyyy");
txtDate.Text = voucher.Date.Value.ToString("HH:mm dd-MMM-yyyy");
txtLastEditDate.Text = voucher.LastEditDate.ToString("HH:mm dd-MMM-yyyy");
btnCustomer.Text = voucher.Customer.Name;
txtTableID.Text = voucher.TableID;
txtPax.Text = voucher.Pax.ToString();
btnWaiter.Text = string.Format("{0} - F5", voucher.Waiter.Name);
}
}
public BindingSource BindingSource
@ -85,7 +96,7 @@ namespace Tanshu.Accounts.PointOfSale.Sales
case Keys.F4:
{
if (!e.Alt)
_billController.ShowCustomerList(false);
_billController.ShowCustomers(false);
break;
}
case Keys.F5:
@ -162,7 +173,7 @@ namespace Tanshu.Accounts.PointOfSale.Sales
private void btnCustomer_Click(object sender, EventArgs e)
{
_billController.ShowCustomerList(false);
_billController.ShowCustomers(false);
}
private void btnVoid_Click(object sender, EventArgs e)
@ -179,7 +190,7 @@ namespace Tanshu.Accounts.PointOfSale.Sales
private void btnRate_Click(object sender, EventArgs e)
{
_billController.ChangeRate();
_billController.SetRate();
}
private void btnClear_Click(object sender, EventArgs e)
@ -211,45 +222,7 @@ namespace Tanshu.Accounts.PointOfSale.Sales
private void btnWaiter_Click(object sender, EventArgs e)
{
using (var selectWaiter = new SelectWaiter(WaiterBI.GetFilteredWaiters, true))
{
selectWaiter.waiterEvent += selectWaiter_waiterEvent;
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";
btnWaiter.Tag = WaiterBI.GetWaiters()[0].WaiterID;
}
}
}
private Waiter selectWaiter_waiterEvent(object sender, WaiterEventArgs e)
{
Waiter waiter = e.Waiter;
if (!Thread.CurrentPrincipal.IsInRole("Waiter/Master"))
return waiter;
switch (e.Action)
{
case 1: // Add
WaiterBI.Insert(waiter);
e.Handled = true;
return waiter;
case 2: // Edit
WaiterBI.Update(waiter);
e.Handled = true;
return waiter;
case 3: // Delete
e.Handled = WaiterBI.Delete(waiter.WaiterID);
return WaiterBI.GetWaiter(1);
default:
throw new ArgumentException();
}
_billController.ShowWaiters(false);
}
private void btnSettle_Click(object sender, EventArgs e)
@ -277,12 +250,13 @@ namespace Tanshu.Accounts.PointOfSale.Sales
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 == null)
return;
if (button.Text == "More")
MoreButton(true);
else if (button.Text == "Less")
@ -307,7 +281,7 @@ namespace Tanshu.Accounts.PointOfSale.Sales
private void btnMoveKot_Click(object sender, EventArgs e)
{
_billController.MergeKot();
_billController.MoveKot();
}
#region Helper Functions
@ -320,8 +294,8 @@ namespace Tanshu.Accounts.PointOfSale.Sales
txtDate.Text = "";
txtLastEditDate.Text = "";
txtTableID.Text = "";
txtPax.Text = "";
btnWaiter.Text = "Waiter - F5";
btnWaiter.Tag = null;
txtGrossTax.Text = "0.00";
txtDiscount.Text = "0.00";
txtServiceCharge.Text = "0.00";
@ -366,9 +340,11 @@ namespace Tanshu.Accounts.PointOfSale.Sales
if (button == null)
return;
var item = button.Tag as ProductGroup;
if (item == null)
return;
if (item.Name == "Previous" || item.Name == "Next")
{
int start = item.ProductGroupID;
var start = item.ProductGroupID;
if (start < 0)
start = 0;
ControlFactory.GenerateGroups(ref flpGroup, new Point(75, 75), start, _productGroupList, productTypeButton_Click);
@ -419,24 +395,18 @@ namespace Tanshu.Accounts.PointOfSale.Sales
{
var tableName = item.Name;
_billController.LoadBill(tableName);
txtTableID.Text = tableName;
FormState = SaleFormState.Billing;
}
}
private void btnPrintBill_Click(object sender, EventArgs e)
{
if (btnWaiter.Tag == null)
btnWaiter.Tag = WaiterBI.GetWaiters()[0].WaiterID;
_billController.SaveBill((int)btnWaiter.Tag, txtTableID.Text);
_billController.SaveBill();
}
private void btnPrintKot_Click(object sender, EventArgs e)
{
if (btnWaiter.Tag == null)
btnWaiter.Tag = WaiterBI.GetWaiters()[0].WaiterID;
_billController.SaveKot((int)btnWaiter.Tag, txtTableID.Text);
_billController.SaveKot();
}
private void btnQuantity_Click(object sender, EventArgs e)
@ -446,7 +416,7 @@ namespace Tanshu.Accounts.PointOfSale.Sales
private void btnDiscount_Click(object sender, EventArgs e)
{
_billController.ShowDiscount();
_billController.SetDiscount();
}
#endregion

View File

@ -123,12 +123,6 @@
<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

@ -13,11 +13,12 @@ namespace Tanshu.Accounts.PointOfSale
{
private readonly IDictionary<Button, int> _list;
private decimal _amount;
public SettleChoicesForm(decimal amount)
private readonly VoucherType _voucherType;
public SettleChoicesForm(decimal amount, VoucherType voucherType)
{
InitializeComponent();
_amount = amount;
_voucherType = voucherType;
OptionsChosen = new Dictionary<SettleOption, decimal>();
_list = new Dictionary<Button, int>();
}
@ -57,10 +58,10 @@ namespace Tanshu.Accounts.PointOfSale
txtAmount.Text = string.Format("Pending Amount: Rs. {0}", _amount);
if (_optionsChosen.Count == 0)
foreach (var item in _list.Where(item => item.Value != 0))
foreach (var item in _list)
item.Key.Enabled = true;
else
foreach (var item in _list.Where(item => item.Value != group && item.Value != 0))
foreach (var item in _list.Where(item => item.Value != group))
item.Key.Enabled = false;
}
@ -82,13 +83,13 @@ namespace Tanshu.Accounts.PointOfSale
foreach (SettleOption item in Enum.GetValues(typeof(SettleOption)))
{
var attribute = item.Attribute();
if (!attribute.ShowInChoices)
if (!attribute.ShowInChoices || attribute.Group != _voucherType.Attribute().Group)
continue;
var button = new Button
{
Name = item.ToString(),
Text = attribute.Name,
Size = new System.Drawing.Size(75, 75),
Size = new Size(75, 75),
TabIndex = count,
UseVisualStyleBackColor = true,
Tag = item
@ -102,31 +103,31 @@ namespace Tanshu.Accounts.PointOfSale
{
Name = "btnOK",
Text = "OK",
Size = new System.Drawing.Size(75, 75),
Size = new Size(75, 75),
TabIndex = count,
UseVisualStyleBackColor = true,
Tag = "OK"
};
controlButton.Click += new EventHandler(ButtonClick);
flpSettlement.Controls.Add(controlButton);
_list.Add(controlButton, 0);
// _list.Add(controlButton); --- Do not add to list
count++;
controlButton = new Button
{
Name = "btnCancel",
Text = "Cancel",
Size = new System.Drawing.Size(75, 75),
Size = new Size(75, 75),
TabIndex = count,
UseVisualStyleBackColor = true,
Tag = "Cancel"
};
controlButton.Click += new EventHandler(ButtonClick);
flpSettlement.Controls.Add(controlButton);
_list.Add(controlButton, 0);
// _list.Add(controlButton); --- Do not add to list
count++;
txtAmount.TabIndex = count;
this.Size = this.SizeFromClientSize(new Size(_list.Count * (75 + 6), 3 + txtAmount.Height + 6 + 75 + 3));
this.Size = this.SizeFromClientSize(new Size(count * (75 + 6), 3 + txtAmount.Height + 6 + 75 + 3));
txtAmount.Width = flpSettlement.Width - 6;
}

View File

@ -0,0 +1,63 @@
namespace Tanshu.Accounts.PointOfSale
{
partial class VoucherTypeForm
{
/// <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.flpSettlement = new System.Windows.Forms.FlowLayoutPanel();
this.SuspendLayout();
//
// flpSettlement
//
this.flpSettlement.Dock = System.Windows.Forms.DockStyle.Fill;
this.flpSettlement.Location = new System.Drawing.Point(0, 0);
this.flpSettlement.Name = "flpSettlement";
this.flpSettlement.Size = new System.Drawing.Size(604, 87);
this.flpSettlement.TabIndex = 7;
//
// VoucherTypeForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(604, 87);
this.ControlBox = false;
this.Controls.Add(this.flpSettlement);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.MaximizeBox = false;
this.Name = "VoucherTypeForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Settle Bill";
this.Load += new System.EventHandler(this.SettleChoicesFormLoad);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.FlowLayoutPanel flpSettlement;
}
}

View File

@ -0,0 +1,93 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using Tanshu.Accounts.Entities;
using Tanshu.Common.Helpers;
namespace Tanshu.Accounts.PointOfSale
{
public partial class VoucherTypeForm : Form
{
private readonly IList<Button> _list;
public VoucherTypeForm()
{
InitializeComponent();
_list = new List<Button>();
Selection = null;
}
private void ButtonClick(object sender, EventArgs e)
{
var button = sender as Button;
if (button == null || button.Tag == null)
return;
if (button.Tag is VoucherType)
{
Selection = (VoucherType)button.Tag;
foreach (var item in _list)
item.Enabled = (VoucherType)item.Tag != Selection.Value;
}
else
{
if ((string)button.Tag == "Cancel")
Selection = null;
this.Close();
}
}
public VoucherType? Selection { get; private set; }
private void SettleChoicesFormLoad(object sender, EventArgs e)
{
var count = 0;
foreach (VoucherType item in Enum.GetValues(typeof(VoucherType)))
{
var attribute = item.Attribute();
if (!attribute.ShowInChoices)
continue;
var button = new Button
{
Name = item.ToString(),
Text = attribute.Name,
Size = new Size(75, 75),
TabIndex = count,
UseVisualStyleBackColor = true,
Tag = item
};
button.Click += new EventHandler(ButtonClick);
flpSettlement.Controls.Add(button);
_list.Add(button);
count++;
}
var controlButton = new Button
{
Name = "btnOK",
Text = "OK",
Size = new Size(75, 75),
TabIndex = count,
UseVisualStyleBackColor = true,
Tag = "OK"
};
controlButton.Click += new EventHandler(ButtonClick);
flpSettlement.Controls.Add(controlButton);
// _list.Add(controlButton); --- Do not add to list
count++;
controlButton = new Button
{
Name = "btnCancel",
Text = "Cancel",
Size = new System.Drawing.Size(75, 75),
TabIndex = count,
UseVisualStyleBackColor = true,
Tag = "Cancel"
};
controlButton.Click += new EventHandler(ButtonClick);
flpSettlement.Controls.Add(controlButton);
//_list.Add(controlButton); --- Do not add to list
count++;
this.Size = this.SizeFromClientSize(new Size(count * (75 + 6), 3 + 75 + 3));
}
}
}

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