Added ST Number to bill.
Fixed error were unprinted bill was not removed from table when voided.
This commit is contained in:
@ -1,13 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Drawing;
|
||||
using Tanshu.Accounts.Contracts;
|
||||
using Tanshu.Accounts.Entities;
|
||||
using System.Collections;
|
||||
using Tanshu.Accounts.Repository;
|
||||
using Tanshu.Common.KeyboardControl;
|
||||
|
||||
namespace Tanshu.Accounts.Helpers
|
||||
@ -20,7 +16,7 @@ namespace Tanshu.Accounts.Helpers
|
||||
{
|
||||
IList<FoodTable> list = new List<FoodTable>();
|
||||
int pageLength, stop;
|
||||
PageSetup(ref panel, start, inList as IList, out pageLength, out stop);
|
||||
PageSetup(panel, start, inList as IList, size, out pageLength, out stop);
|
||||
if (start != 0)
|
||||
list.Add(new FoodTable() { FoodTableID = start - pageLength, Name = "Previous" });
|
||||
for (int i = start; i < stop; i++)
|
||||
@ -34,7 +30,7 @@ namespace Tanshu.Accounts.Helpers
|
||||
{
|
||||
var item = list[i];
|
||||
var status = item.Status;
|
||||
var control = GetButton(string.Format("g{0}", i), item.Name, size.X, size.Y, item, bcDelegate);
|
||||
var control = GetButton(string.Format("g{0}", i), item.Name, size, item, bcDelegate);
|
||||
if (status == "printed")
|
||||
control.BackColor = Color.Green;
|
||||
else if (status == "running")
|
||||
@ -46,7 +42,7 @@ namespace Tanshu.Accounts.Helpers
|
||||
{
|
||||
IList<Product> list = new List<Product>();
|
||||
int pageLength, stop;
|
||||
PageSetup(ref panel, start, inList as IList, out pageLength, out stop);
|
||||
PageSetup(panel, start, inList as IList, size, out pageLength, out stop);
|
||||
if (start != 0)
|
||||
list.Add(new Product() { ProductID = start - pageLength, Name = "Previous" });
|
||||
for (int i = start; i < stop; i++)
|
||||
@ -59,7 +55,7 @@ namespace Tanshu.Accounts.Helpers
|
||||
for (var i = 0; i < list.Count; i++)
|
||||
{
|
||||
var item = list[i];
|
||||
var control = GetButton(string.Format("p{0}", i), item.Units == string.Empty ? item.Name : string.Format("{0} ({1})", item.Name, item.Units), size.X, size.Y, item, bcDelegate);
|
||||
var control = GetButton(string.Format("p{0}", i), item.Units == string.Empty ? item.Name : string.Format("{0} ({1})", item.Name, item.Units), size, item, bcDelegate);
|
||||
if (item.Price == 0)
|
||||
control.BackColor = Color.Yellow;
|
||||
panel.Controls.Add(control);
|
||||
@ -72,7 +68,7 @@ namespace Tanshu.Accounts.Helpers
|
||||
for (int i = 0; i < list.Count; i++)
|
||||
{
|
||||
var item = list[i];
|
||||
var control = GetUnselectableCheckbox(i.ToString(), item, size.X, size.Y, item, bcDelegate);
|
||||
var control = GetUnselectableCheckbox(i.ToString(), item, size, item, bcDelegate);
|
||||
panel.Controls.Add(control);
|
||||
}
|
||||
}
|
||||
@ -81,7 +77,7 @@ namespace Tanshu.Accounts.Helpers
|
||||
{
|
||||
IList<ProductGroup> list = new List<ProductGroup>();
|
||||
int pageLength, stop;
|
||||
PageSetup(ref panel, start, inList as IList, out pageLength, out stop);
|
||||
PageSetup(panel, start, inList as IList, size, out pageLength, out stop);
|
||||
if (start != 0)
|
||||
list.Add(new ProductGroup() { ProductGroupID = start - pageLength, Name = "Previous" });
|
||||
for (int i = start; i < stop; i++)
|
||||
@ -94,7 +90,7 @@ namespace Tanshu.Accounts.Helpers
|
||||
for (int i = 0; i < list.Count; i++)
|
||||
{
|
||||
var item = list[i];
|
||||
var control = GetButton(string.Format("g{0}", i), item.Name, size.X, size.Y, item, bcDelegate);
|
||||
var control = GetButton(string.Format("g{0}", i), item.Name, size, item, bcDelegate);
|
||||
panel.Controls.Add(control);
|
||||
}
|
||||
}
|
||||
@ -113,18 +109,20 @@ namespace Tanshu.Accounts.Helpers
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
var item = list[i];
|
||||
var control = GetCheckbox(i.ToString(), item.Name, size.X, size.Y, item, bcDelegate);
|
||||
var control = GetCheckbox(i.ToString(), item.Name, size, item, bcDelegate);
|
||||
control.Checked = selection.Contains(item);
|
||||
panel.Controls.Add(control);
|
||||
controlList.Add(control);
|
||||
}
|
||||
}
|
||||
|
||||
private static void PageSetup(ref FlowLayoutPanel panel, int start, IList inList, out int pageLength, out int stop)
|
||||
private static void PageSetup(FlowLayoutPanel panel, int start, ICollection inList, Point size, out int pageLength, out int stop)
|
||||
{
|
||||
panel.Controls.Clear();
|
||||
pageLength = (panel.Height / (3 + 75 + 3));
|
||||
pageLength *= (panel.Width / (3 + 75 + 3));
|
||||
var marginWidth = panel.Margin.Right + panel.Margin.Left;
|
||||
var marginHeight = panel.Margin.Top + panel.Margin.Bottom;
|
||||
pageLength = (panel.ClientSize.Height / (marginHeight + size.Y));
|
||||
pageLength *= (panel.ClientSize.Width / (marginWidth + size.X));
|
||||
pageLength -= 2;
|
||||
if (inList.Count <= pageLength)
|
||||
start = 0;
|
||||
@ -135,28 +133,28 @@ namespace Tanshu.Accounts.Helpers
|
||||
stop = inList.Count;
|
||||
|
||||
}
|
||||
private static Button GetButton(string name, string text, int width, int height, object tag, ButtonClickDelegate bcDelegate)
|
||||
private static Button GetButton(string name, string text, Point size, object tag, ButtonClickDelegate bcDelegate)
|
||||
{
|
||||
Button control = new Button()
|
||||
var control = new Button()
|
||||
{
|
||||
Name = name,
|
||||
Text = text,
|
||||
Width = width,
|
||||
Height = height,
|
||||
Width = size.X,
|
||||
Height = size.Y,
|
||||
Tag = tag,
|
||||
};
|
||||
if (bcDelegate != null)
|
||||
control.Click += new EventHandler(bcDelegate);
|
||||
return control;
|
||||
}
|
||||
private static UnselectableCheckbox GetUnselectableCheckbox(string name, string text, int width, int height, object tag, ButtonClickDelegate bcDelegate)
|
||||
private static UnselectableCheckbox GetUnselectableCheckbox(string name, string text, Point size, object tag, ButtonClickDelegate bcDelegate)
|
||||
{
|
||||
UnselectableCheckbox control = new UnselectableCheckbox()
|
||||
var control = new UnselectableCheckbox()
|
||||
{
|
||||
Name = name,
|
||||
Text = text,
|
||||
Width = width,
|
||||
Height = height,
|
||||
Width = size.X,
|
||||
Height = size.Y,
|
||||
Tag = tag,
|
||||
Appearance = Appearance.Button,
|
||||
|
||||
@ -165,14 +163,14 @@ namespace Tanshu.Accounts.Helpers
|
||||
control.Click += new EventHandler(bcDelegate);
|
||||
return control;
|
||||
}
|
||||
private static CheckBox GetCheckbox(string name, string text, int width, int height, object tag, ButtonClickDelegate bcDelegate)
|
||||
private static CheckBox GetCheckbox(string name, string text, Point size, object tag, ButtonClickDelegate bcDelegate)
|
||||
{
|
||||
CheckBox control = new CheckBox()
|
||||
var control = new CheckBox()
|
||||
{
|
||||
Name = name,
|
||||
Text = text,
|
||||
Width = width,
|
||||
Height = height,
|
||||
Width = size.X,
|
||||
Height = size.Y,
|
||||
Tag = tag,
|
||||
Appearance = Appearance.Button,
|
||||
|
||||
|
||||
Reference in New Issue
Block a user