Moved to fluent. Added support for Modifiers. Fixtures to load intial test data
This commit is contained in:
@ -2,22 +2,26 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Tanshu.Accounts.BI;
|
||||
using Tanshu.Accounts.Repository;
|
||||
using Tanshu.Accounts.Helpers;
|
||||
using Tanshu.Accounts.Contracts;
|
||||
using System.Windows.Forms;
|
||||
using Tanshu.Common;
|
||||
using Tanshu.Accounts.Entities;
|
||||
using Tanshu.Accounts.Entities.Auth;
|
||||
using Tanshu.Accounts.SqlDAO;
|
||||
|
||||
|
||||
namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
public class BillController
|
||||
{
|
||||
private SaleVoucherBO billInfo;
|
||||
private Dictionary<BillItemKey, SalesBillItemBO> bill = new Dictionary<BillItemKey, SalesBillItemBO>();
|
||||
Guid? newBillID;
|
||||
private SaleVoucher billInfo;
|
||||
private OrderedDictionary<BillItemKey, BillInventory> bill = new OrderedDictionary<BillItemKey, BillInventory>();
|
||||
int? newBillID;
|
||||
|
||||
ISaleForm saleForm;
|
||||
private CustomerBO customer = new CustomerBI().GetCustomer(new Guid("F016CBAD-206C-42C0-BB1D-6006CE57BAB5"));
|
||||
private Customer customer = new CustomerBI().GetCustomer(1);
|
||||
public void InitGui(ISaleForm saleForm)
|
||||
{
|
||||
this.saleForm = saleForm;
|
||||
@ -40,19 +44,31 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
public void AddProductToGrid(Guid productID, BindingSource bindingSource)
|
||||
public void AddProductToGrid(int productID)
|
||||
{
|
||||
BillHelperFunctions.AddProductToGrid(productID, bindingSource, bill);
|
||||
BillHelperFunctions.AddProductToGrid(productID, saleForm.BindingSource, bill);
|
||||
Product product = ProductBI.GetProduct(productID);
|
||||
if (ProductGroupModifierBI.HasCompulsoryModifier(product.ProductGroup.ProductGroupID))
|
||||
{
|
||||
var item = CurrentProduct;
|
||||
ShowModifiers(product.ProductGroup.ProductGroupID, item);
|
||||
}
|
||||
ShowAmount();
|
||||
|
||||
|
||||
ProductBO product = ProductBI.GetProduct(productID);
|
||||
if (ProductGroupModifierBI.HasCompulsoryModifier(product.ProductGroupID))
|
||||
saleForm.ShowModifiers(product.ProductGroupID);
|
||||
}
|
||||
|
||||
public void ShowModifiers(int productGroupID, BillInventory item)
|
||||
{
|
||||
var list = ProductGroupModifierBI.GetProductGroupModifiers(productGroupID);
|
||||
using (var frm = new ModifierForm(list, item.Modifiers))
|
||||
{
|
||||
frm.ShowDialog();
|
||||
item.Modifiers = frm.Selection;
|
||||
}
|
||||
}
|
||||
|
||||
public void ShowCustomerList(bool reset)
|
||||
{
|
||||
if ((customer.CustomerID == new Guid("F016CBAD-206C-42C0-BB1D-6006CE57BAB5")) && (!reset))
|
||||
if ((customer.CustomerID == 1) && (!reset))
|
||||
{
|
||||
using (SelectCustomer selectCustomer = new SelectCustomer(new CustomerBI().GetFilteredCustomers, true))
|
||||
{
|
||||
@ -65,24 +81,24 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
}
|
||||
else
|
||||
{
|
||||
customer = new CustomerBI().GetCustomer(new Guid("F016CBAD-206C-42C0-BB1D-6006CE57BAB5"));
|
||||
customer = new CustomerBI().GetCustomer(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
customer = new CustomerBI().GetCustomer(new Guid("F016CBAD-206C-42C0-BB1D-6006CE57BAB5"));
|
||||
customer = new CustomerBI().GetCustomer(1);
|
||||
saleForm.SetCustomerDisplay(customer.Name);
|
||||
}
|
||||
}
|
||||
|
||||
#region Save
|
||||
// if (btnWaiter.Tag == null)
|
||||
//btnWaiter.Tag = new WaiterBI().GetWaiters()[0].WaiterID;
|
||||
//btnWaiter.Tag = WaiterBI.GetWaiters()[0].WaiterID;
|
||||
|
||||
public void Save(bool print, Guid waiterID, string tableID)
|
||||
public void Save(bool print, int waiterID, string tableID)
|
||||
{
|
||||
using (RoleBI roleBI = RoleFactoryBI.GetRoleBI(Roles.SALES_EDIT_BILL))
|
||||
using (RoleBI roleBI = RoleFactoryBI.GetRoleBI(RolesConstants.SALES_EDIT_BILL))
|
||||
{
|
||||
if ((billInfo != null) && (new SaleVoucherBI().IsBillPrinted(billInfo.VoucherID)) && (!roleBI.IsAllowed))
|
||||
{
|
||||
@ -91,7 +107,7 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
}
|
||||
if (bill.Count != 0)
|
||||
{
|
||||
Guid? saved;
|
||||
int? saved;
|
||||
if (billInfo == null)
|
||||
saved = AddNewSale(print, waiterID, tableID);
|
||||
else
|
||||
@ -106,7 +122,7 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
ClearBill();
|
||||
}
|
||||
}
|
||||
private Guid? AddNewSale(bool finalBill, Guid waiterID, string tableID)
|
||||
private int? AddNewSale(bool finalBill, int waiterID, string tableID)
|
||||
{
|
||||
if (billInfo != null)
|
||||
{
|
||||
@ -116,65 +132,83 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
|
||||
|
||||
#region SaleVoucher
|
||||
UserBO user = Session.User;
|
||||
SaleVoucherBO saleVoucher = new SaleVoucherBO
|
||||
SaleVoucher saleVoucher = new SaleVoucher
|
||||
{
|
||||
CustomerID = customer.CustomerID,
|
||||
Paid = false,
|
||||
Customer = customer,
|
||||
Settled = SettleOptionBI.GetSettleOption(SettleOptionFactory.Unsettled),
|
||||
//Paid = finalBill,
|
||||
TableID = tableID,
|
||||
WaiterID = waiterID,
|
||||
Waiter = WaiterBI.GetWaiter(waiterID),
|
||||
Printed = finalBill,
|
||||
Void = false,
|
||||
Date = DateTime.Now,
|
||||
Narration = "",
|
||||
Ref = "",
|
||||
Type = 'S',
|
||||
UserID = user.UserID
|
||||
User = Session.User
|
||||
};
|
||||
#endregion
|
||||
#region Inventories
|
||||
List<InventoryBO> iList = new SaleVoucherBI().SaleInventory(bill.Values, null);
|
||||
IList<Inventory> iList = GetInventoryForBill(bill.Values);
|
||||
#endregion
|
||||
new SaleVoucherBI().Insert(saleVoucher, iList);
|
||||
return saleVoucher.VoucherID;
|
||||
|
||||
}
|
||||
private Guid? UpdateSale(bool finalBill, Guid waiterID, string tableID)
|
||||
private int? UpdateSale(bool finalBill, int waiterID, string tableID)
|
||||
{
|
||||
UserBO user = Session.User;
|
||||
#region Voucher and SaleVoucher
|
||||
SaleVoucherBO saleVoucher = new SaleVoucherBO
|
||||
{
|
||||
VoucherID = billInfo.VoucherID,
|
||||
timestamp = (byte[])billInfo.timestamp,
|
||||
UserID = billInfo.UserID,
|
||||
Date = billInfo.Date,
|
||||
CreationDate = DateTime.Now,
|
||||
LastEditDate = DateTime.Now,
|
||||
Narration = billInfo.Narration,
|
||||
Ref = "",
|
||||
Type = 'S',
|
||||
Alarm = billInfo.Alarm,
|
||||
BillID = billInfo.BillID,
|
||||
CustomerID = customer.CustomerID,
|
||||
KotID = billInfo.KotID,
|
||||
Paid = billInfo.Paid,
|
||||
Printed = billInfo.Printed || finalBill,
|
||||
TableID = tableID,
|
||||
Void = billInfo.Void,
|
||||
VoidReason = billInfo.VoidReason,
|
||||
WaiterID = waiterID,
|
||||
SaleTimestamp = (byte[])billInfo.SaleTimestamp
|
||||
};
|
||||
if ((!billInfo.Printed) && finalBill)
|
||||
saleVoucher.Date = null;
|
||||
#region SaleVoucher
|
||||
billInfo.User = Session.User;
|
||||
billInfo.Customer = customer;
|
||||
if (!billInfo.Printed && finalBill)
|
||||
billInfo.Date = null;
|
||||
billInfo.Printed = billInfo.Printed || finalBill;
|
||||
billInfo.TableID = tableID;
|
||||
billInfo.Waiter = WaiterBI.GetWaiter(waiterID);
|
||||
//if ((!billInfo.Printed) && finalBill)
|
||||
// billInfo.Date = null;
|
||||
billInfo.Inventories = new List<Inventory>();
|
||||
#endregion
|
||||
#region Inventory
|
||||
List<InventoryBO> iList = new SaleVoucherBI().SaleInventory(bill.Values, billInfo.VoucherID);
|
||||
IList<Inventory> iList = GetInventoryForBill(bill.Values);
|
||||
#endregion
|
||||
new SaleVoucherBI().Update(saleVoucher, iList);
|
||||
return saleVoucher.VoucherID;
|
||||
new SaleVoucherBI().Update(billInfo, iList);
|
||||
return billInfo.VoucherID;
|
||||
}
|
||||
private IList<Inventory> GetInventoryForBill(ICollection<BillInventory> list)
|
||||
{
|
||||
Dictionary<int, Inventory> localList = new Dictionary<int, Inventory>();
|
||||
foreach (BillInventory item in list)
|
||||
{
|
||||
Inventory temp = new Inventory();
|
||||
if (localList.ContainsKey(item.ProductID))
|
||||
{
|
||||
temp = localList[item.ProductID];
|
||||
temp.Quantity += item.Quantity;
|
||||
}
|
||||
else
|
||||
{
|
||||
temp.Discount = item.Discount;
|
||||
temp.Product = ProductBI.GetProduct(item.ProductID);
|
||||
temp.Quantity = item.Quantity;
|
||||
temp.Rate = item.Price;
|
||||
temp.Tax = item.Tax;
|
||||
localList.Add(item.ProductID, temp);
|
||||
}
|
||||
}
|
||||
return localList.Values.ToList();
|
||||
}
|
||||
public decimal GetInput(string type, decimal basic)
|
||||
{
|
||||
decimal value;
|
||||
InputBoxResult result = InputBox.Show(type, type, basic.ToString(), InputBox_Validating);
|
||||
if (result.OK)
|
||||
{
|
||||
if (!decimal.TryParse(result.Text, out value))
|
||||
return 0;
|
||||
return value;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endregion
|
||||
public void VoidBill()
|
||||
@ -183,7 +217,7 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
if (billInfo.Printed)
|
||||
{
|
||||
using (RoleBI roleBI = RoleFactoryBI.GetRoleBI(Roles.SALES_VOID_BILL))
|
||||
using (RoleBI roleBI = RoleFactoryBI.GetRoleBI(RolesConstants.SALES_VOID_BILL))
|
||||
{
|
||||
if (roleBI.IsAllowed)
|
||||
{
|
||||
@ -209,7 +243,7 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
}
|
||||
}
|
||||
}
|
||||
CustomerBO selectCustomer_customerEvent(object sender, CustomerEventArgs e)
|
||||
Customer selectCustomer_customerEvent(object sender, CustomerEventArgs e)
|
||||
{
|
||||
using (CustomersForm form = new CustomersForm(e.CustomerID, e.Phone))
|
||||
{
|
||||
@ -217,9 +251,9 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
return form.Customer;
|
||||
}
|
||||
}
|
||||
private void PrintBill(bool finalBill, Guid voucherID)
|
||||
private void PrintBill(bool finalBill, int voucherID)
|
||||
{
|
||||
using (RoleBI roleBI = RoleFactoryBI.GetRoleBI(Roles.SALES_PRINT_KOT))
|
||||
using (RoleBI roleBI = RoleFactoryBI.GetRoleBI(RolesConstants.SALES_PRINT_KOT))
|
||||
if (!roleBI.IsAllowed)
|
||||
throw new PermissionException("You are not allowed to print KOT");
|
||||
|
||||
@ -227,7 +261,7 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
Accounts.Print.Thermal.PrintKot(voucherID, bill.Values.ToList());
|
||||
else
|
||||
{
|
||||
using (RoleBI roleBI = RoleFactoryBI.GetRoleBI(Roles.SALES_PRINT_BILL))
|
||||
using (RoleBI roleBI = RoleFactoryBI.GetRoleBI(RolesConstants.SALES_PRINT_BILL))
|
||||
{
|
||||
if (roleBI.IsAllowed)
|
||||
{
|
||||
@ -253,24 +287,21 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
list.Add(new StringType("Other"));
|
||||
return list.Where(i => i.Description.ToLower().Contains(filter["Name"].ToLower().Trim())).ToList();
|
||||
}
|
||||
public void SetNewBillID(Guid voucherID)
|
||||
public void SetNewBillID(int voucherID)
|
||||
{
|
||||
this.newBillID = voucherID;
|
||||
}
|
||||
public SalesBillItemBO CurrentProduct(int index)
|
||||
public BillInventory CurrentProduct
|
||||
{
|
||||
if ((index != -1) && (index < bill.Count))
|
||||
return bill.ElementAt(index).Value;
|
||||
else
|
||||
return null;
|
||||
|
||||
//if (dgvProducts.Rows.Count == 0)
|
||||
// return null;
|
||||
//SalesBillItemBO product = bill.ElementAt(dgvProducts.CurrentRow.Index).Value;
|
||||
//return product;
|
||||
get
|
||||
{
|
||||
return bill.ElementAt(saleForm.BindingSource.Position).Value;
|
||||
}
|
||||
}
|
||||
private void ShowAmount()
|
||||
{
|
||||
//saleForm.BindingSource.CurrencyManager.Position = 1;
|
||||
|
||||
decimal taxAmount = bill.Values.Sum(b => b.TaxAmount);
|
||||
decimal discountAmount = bill.Values.Sum(b => b.DiscountAmount);
|
||||
decimal grossAmount = bill.Values.Sum(b => b.GrossAmount);
|
||||
@ -279,122 +310,94 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
//bill.Values.ToList();
|
||||
saleForm.ShowAmount(discountAmount, grossAmount, serviceChargeAmount, taxAmount, valueAmount, bill.Values.ToList());
|
||||
}
|
||||
public void SetDiscount(SalesBillItemBO product, decimal discount)
|
||||
public void SetDiscount(BillInventory billInventory, decimal discount)
|
||||
{
|
||||
if (product == null)
|
||||
if (billInventory == null)
|
||||
return;
|
||||
BillHelperFunctions.SetDiscount(product.productID, discount, customer, bill);
|
||||
BillHelperFunctions.SetDiscount(billInventory.ProductID, discount, customer, bill);
|
||||
ShowAmount();
|
||||
}
|
||||
public void SetAmount(SalesBillItemBO product, BindingSource bindingSource, decimal amount)
|
||||
public void SetAmount(BillInventory billInventory, decimal amount)
|
||||
{
|
||||
if (product == null)
|
||||
if (billInventory == null)
|
||||
return;
|
||||
BillHelperFunctions.SetAmount(product, amount, bindingSource, bill);
|
||||
BillHelperFunctions.SetAmount(billInventory, amount, saleForm.BindingSource, bill);
|
||||
ShowAmount();
|
||||
}
|
||||
public bool ProductRemove(SalesBillItemBO product)
|
||||
public void ProductRemove(BillInventory billInventory)
|
||||
{
|
||||
if (product == null)
|
||||
return false;
|
||||
if (product.Printed > 0)
|
||||
if (billInventory == null)
|
||||
return;
|
||||
if (billInventory.Printed > 0)
|
||||
{
|
||||
using (RoleBI roleBI = RoleFactoryBI.GetRoleBI(Roles.SALES_EDIT_PRINTED_PRODUCT))
|
||||
using (RoleBI roleBI = RoleFactoryBI.GetRoleBI(RolesConstants.SALES_EDIT_PRINTED_PRODUCT))
|
||||
{
|
||||
if (roleBI.IsAllowed)
|
||||
{
|
||||
if (MessageBox.Show(string.Format("Already {0} items have been printed.\n\rAre you sure you want to delete this item?", product.Printed), "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
|
||||
return false;
|
||||
//If BillList(Location).Printed <> 0 Then ItemsDeleted.Add("Deleted " & BillList(Location).Printed & " " & BillList(Location).Name & " from Bill No " & mBillNo)
|
||||
bill.Remove(new BillItemKey(product.productID, product.Printed == 0));
|
||||
ShowAmount();
|
||||
if (MessageBox.Show(string.Format("Already {0} items have been printed.\n\rAre you sure you want to delete this item?", billInventory.Printed), "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
|
||||
return;
|
||||
}
|
||||
else
|
||||
throw new PermissionException("You are not allowed to delete already printed products");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public void SetQuantity(SalesBillItemBO product, BindingSource bindingSource, decimal quantity, bool absolute, bool prompt)
|
||||
{
|
||||
if (product == null)
|
||||
return;
|
||||
BillHelperFunctions.SetQuantity(product, quantity, absolute, prompt, bindingSource, bill);
|
||||
bill.Remove(new BillItemKey(billInventory.ProductID, billInventory.Printed == 0));
|
||||
ShowAmount();
|
||||
}
|
||||
|
||||
public void ChangeRate(int index)
|
||||
public void SetQuantity(BillInventory billInventory, decimal quantity, bool absolute, bool prompt)
|
||||
{
|
||||
using (RoleBI roleBI = RoleFactoryBI.GetRoleBI(Roles.SALES_CHANGE_RATE))
|
||||
{
|
||||
if (roleBI.IsAllowed)
|
||||
{
|
||||
SalesBillItemBO product = bill.ElementAt(index).Value;
|
||||
decimal rate = 0;
|
||||
InputBoxResult result = InputBox.Show("Enter Rate", "Rate", product.Price.ToString(), InputBox_Validating);
|
||||
if (result.OK)
|
||||
rate = Convert.ToDecimal(result.Text);
|
||||
if (rate != 0)
|
||||
{
|
||||
BillHelperFunctions.SetRate(product.productID, rate, bill);
|
||||
ShowAmount();
|
||||
}
|
||||
}
|
||||
else
|
||||
throw new PermissionException("You do not have permission to Change the Rate");
|
||||
if (billInventory == null)
|
||||
return;
|
||||
BillHelperFunctions.SetQuantity(billInventory, quantity, absolute, prompt, saleForm.BindingSource, bill);
|
||||
ShowAmount();
|
||||
}
|
||||
|
||||
public void ChangeRate()
|
||||
{
|
||||
var item = CurrentProduct;
|
||||
if (item != null)
|
||||
{
|
||||
decimal rate = 0;
|
||||
InputBoxResult result = InputBox.Show("Enter Rate", "Rate", item.Price.ToString(), InputBox_Validating);
|
||||
if (result.OK)
|
||||
rate = Convert.ToDecimal(result.Text);
|
||||
if (rate != 0)
|
||||
{
|
||||
BillHelperFunctions.SetRate(item.ProductID, rate, bill);
|
||||
ShowAmount();
|
||||
}
|
||||
}
|
||||
}
|
||||
private void InputBox_Validating(object sender, InputBoxValidatingArgs e)
|
||||
{
|
||||
}
|
||||
private void LoadBill(Guid voucherID)
|
||||
private void LoadBill(int voucherID)
|
||||
{
|
||||
ClearBill();
|
||||
List<InventoryDisplayBO> iList = new List<InventoryDisplayBO>();
|
||||
new SaleVoucherBI().GetSaleVoucher(voucherID, ref billInfo, ref iList);
|
||||
IList<Inventory> iList = new List<Inventory>();
|
||||
new SaleVoucherBI().GetSaleVoucher(voucherID, out billInfo, out iList);
|
||||
|
||||
this.customer = new CustomerBI().GetCustomer(billInfo.CustomerID);
|
||||
saleForm.ShowInfo(billInfo.BillID, billInfo.KotID, billInfo.CreationDate, billInfo.Date.Value, billInfo.LastEditDate, customer.Name, billInfo.TableID, billInfo.WaiterID, new WaiterBI().GetWaiter(billInfo.WaiterID).Name);
|
||||
this.customer = billInfo.Customer;
|
||||
saleForm.ShowInfo(billInfo.BillID, billInfo.KotID, billInfo.CreationDate, billInfo.Date.Value, billInfo.LastEditDate, customer.Name, billInfo.TableID, billInfo.Waiter.WaiterID, billInfo.Waiter.Name);
|
||||
|
||||
foreach (InventoryDisplayBO inventory in iList)
|
||||
foreach (Inventory inventory in iList)
|
||||
{
|
||||
if (inventory.ComplexProductID.HasValue)
|
||||
BillItemKey key = new BillItemKey(inventory.Product.ProductID, inventory.Quantity == 0);
|
||||
var item = new BillInventory
|
||||
{
|
||||
BillItemKey key = new BillItemKey(inventory.ComplexProductID.Value, inventory.Quantity == 0);
|
||||
if (!bill.ContainsKey(key))
|
||||
{
|
||||
decimal rate = 0, quantity = 0;
|
||||
string name = "";
|
||||
new SaleVoucherBI().GetComplexBillInformation(voucherID, inventory.ComplexProductID.Value, ref rate, ref quantity, ref name);
|
||||
bill.Add(key, new SalesBillItemBO
|
||||
{
|
||||
productID = inventory.ComplexProductID.Value,
|
||||
Discount = inventory.Discount,
|
||||
Name = name,
|
||||
Price = rate,
|
||||
Printed = quantity,
|
||||
Quantity = quantity,
|
||||
Tax = inventory.Tax,
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
ProductID = inventory.Product.ProductID,
|
||||
Discount = inventory.Discount,
|
||||
Name = inventory.Product.Name + " (" + inventory.Product.Units + ")",
|
||||
Price = inventory.Rate,
|
||||
Printed = inventory.Quantity,
|
||||
Quantity = inventory.Quantity,
|
||||
Tax = inventory.Tax,
|
||||
ServiceCharge = inventory.ServiceCharge,
|
||||
};
|
||||
foreach (var mod in inventory.InventoryModifier)
|
||||
{
|
||||
BillItemKey key = new BillItemKey(inventory.ProductID, inventory.Quantity == 0);
|
||||
bill.Add(key, new SalesBillItemBO
|
||||
{
|
||||
productID = inventory.ProductID,
|
||||
Discount = inventory.Discount,
|
||||
Name = inventory.ProductName,
|
||||
Price = inventory.Rate,
|
||||
Printed = inventory.Quantity,
|
||||
Quantity = inventory.Quantity,
|
||||
Tax = inventory.Tax,
|
||||
});
|
||||
item.Modifiers.Add(mod.Modifier);
|
||||
}
|
||||
bill.Add(key, item);
|
||||
}
|
||||
ShowAmount();
|
||||
|
||||
@ -403,10 +406,10 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
if (!string.IsNullOrEmpty(tableName))
|
||||
{
|
||||
Guid? tID = new SaleVoucherBI().GetPendingVoucherID(tableName);
|
||||
if (tID.HasValue)
|
||||
SaleVoucher voucher = new SaleVoucherBI().GetPendingVoucherID(tableName);
|
||||
if (voucher != null)
|
||||
{
|
||||
LoadBill(tID.Value);
|
||||
LoadBill(voucher.VoucherID);
|
||||
}
|
||||
|
||||
}
|
||||
@ -418,10 +421,10 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
string tableID = result.Text.Trim();
|
||||
if ((tableID != "C") && (tableID != "") && (!tableID.Contains(".")))
|
||||
{
|
||||
Guid? tID = new SaleVoucherBI().GetPendingVoucherID(tableID);
|
||||
if (tID.HasValue)
|
||||
SaleVoucher voucher = new SaleVoucherBI().GetPendingVoucherID(tableName);
|
||||
if (voucher != null)
|
||||
{
|
||||
LoadBill(tID.Value);
|
||||
LoadBill(voucher.VoucherID);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -453,40 +456,24 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//private Dictionary<string,string> modifiers;
|
||||
public void AddModifier(string modifierID)
|
||||
{
|
||||
MessageBox.Show(modifierID);
|
||||
|
||||
}
|
||||
|
||||
internal void SettleBill()
|
||||
{
|
||||
if (billInfo == null)
|
||||
return;
|
||||
SettleOptions option = SettleOptions.Cancel;
|
||||
int option = SettleOptionFactory.Unsettled;
|
||||
using (BillSettleForm frm = new BillSettleForm())
|
||||
{
|
||||
frm.ShowDialog();
|
||||
option = frm.optionChosen;
|
||||
}
|
||||
switch (option)
|
||||
if (option != SettleOptionFactory.Unsettled)
|
||||
{
|
||||
case SettleOptions.Cancel:
|
||||
break;
|
||||
case SettleOptions.Cash:
|
||||
break;
|
||||
case SettleOptions.CreditCard:
|
||||
break;
|
||||
case SettleOptions.NoCharge:
|
||||
break;
|
||||
|
||||
new SaleVoucherBI().SettleVoucher(Session.User, billInfo.VoucherID, option);
|
||||
ClearBill();
|
||||
}
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
// How to load a bill
|
||||
//LoadBill(((PendingBillsBO)bsPending.Current).voucherID);
|
||||
//LoadBill(((PendingBills)bsPending.Current).voucherID);
|
||||
// ChangeFormState(SaleFormState.Billing);
|
||||
@ -1,31 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
public class DisplayController
|
||||
{
|
||||
ISaleForm saleForm;
|
||||
public void InitGui(ISaleForm saleForm)
|
||||
{
|
||||
this.saleForm = saleForm;
|
||||
}
|
||||
private void InitComponents()
|
||||
{
|
||||
InitModel();
|
||||
InitView();
|
||||
}
|
||||
|
||||
private void InitView()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private void InitModel()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3,17 +3,19 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Tanshu.Accounts.Contracts;
|
||||
using System.Windows.Forms;
|
||||
using Tanshu.Common;
|
||||
|
||||
namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
public interface ISaleForm
|
||||
{
|
||||
void ClearBill(Dictionary<BillItemKey, SalesBillItemBO> bill);
|
||||
void ClearBill(OrderedDictionary<BillItemKey, BillInventory> bill);
|
||||
void SetCustomerDisplay(string name);
|
||||
void CloseWindow();
|
||||
void ShowAmount(decimal discountAmount, decimal grossAmount, decimal serviceChargeAmount, decimal taxAmount, decimal valueAmount, List<SalesBillItemBO> bill);
|
||||
void ShowInfo(string billID, string kotID, DateTime creationDate, DateTime date, DateTime lastEditDate, string customer, string tableID, Guid waiterID, string waiter);
|
||||
void ShowAmount(decimal discountAmount, decimal grossAmount, decimal serviceChargeAmount, decimal taxAmount, decimal valueAmount, List<BillInventory> bill);
|
||||
void ShowInfo(string billID, string kotID, DateTime creationDate, DateTime date, DateTime lastEditDate, string customer, string tableID, int waiterID, string waiter);
|
||||
void SetUserName(string name);
|
||||
void ShowModifiers(Guid productGroupID);
|
||||
BindingSource BindingSource { get; }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user