Added Service Tax and CIN Information to the bill printout
Added Nc Option in settlement Merged Vouchers and SaleVoucher table. Need to update the Sql Schema
This commit is contained in:
@ -48,7 +48,13 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
}
|
||||
else
|
||||
{
|
||||
new ProductBI().UpdateShortName();
|
||||
using (var connection = new SqlDAO.SqlConnectionDAO())
|
||||
{
|
||||
using (var dao = new SqlDAO.ProductDAO(connection))
|
||||
{
|
||||
dao.UpdateShortName();
|
||||
}
|
||||
}
|
||||
using (var frmSale = new SalesForm())
|
||||
frmSale.ShowDialog();
|
||||
}
|
||||
@ -208,7 +214,7 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
}
|
||||
else
|
||||
{
|
||||
using (SelectProduct selectProduct = new SelectProduct(new ProductBI().GetFilteredProducts, false))
|
||||
using (SelectProduct selectProduct = new SelectProduct(new FiltersBI().GetFilteredProducts, false))
|
||||
{
|
||||
selectProduct.productEvent += new ProductEventHandler(selectProduct_productEvent);
|
||||
selectProduct.ShowDialog();
|
||||
|
||||
@ -27,7 +27,14 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
FillCombos();
|
||||
if (_productID.HasValue)
|
||||
{
|
||||
product = new ProductBI().GetProduct(_productID.Value);
|
||||
using (var connection = new SqlDAO.SqlConnectionDAO())
|
||||
{
|
||||
using (var dao = new SqlDAO.ProductDAO(connection))
|
||||
{
|
||||
product = dao.GetProduct(_productID.Value);
|
||||
}
|
||||
}
|
||||
|
||||
txtUniqueID.Text = product.Code.ToString();
|
||||
txtName.Text = product.Name;
|
||||
cmbUnits.SelectedItem = product.Units;
|
||||
@ -50,9 +57,15 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
string[] units = { "Can", "Gms", "Rs.", "Piece", "Liter", "Plate", "Kg.", "Bottle", "Pack" };
|
||||
bsUnits.DataSource = units;
|
||||
bsProductGroups.DataSource = new ProductBI().GetProductGroups();
|
||||
bsVat.DataSource = new ProductBI().GetTaxes();
|
||||
bsServiceTax.DataSource = new ProductBI().GetTaxes();
|
||||
using (var connection = new SqlDAO.SqlConnectionDAO())
|
||||
{
|
||||
using (var dao = new SqlDAO.ProductDAO(connection))
|
||||
{
|
||||
bsProductGroups.DataSource = dao.GetProductGroups();
|
||||
bsVat.DataSource = dao.GetTaxes();
|
||||
bsServiceTax.DataSource = dao.GetTaxes();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
@ -62,9 +75,16 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
if (MessageBox.Show("Are you sure?", "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) != DialogResult.Yes)
|
||||
return;
|
||||
|
||||
if (new ProductBI().Delete(product.ProductID))
|
||||
|
||||
using (var connection = new SqlDAO.SqlConnectionDAO())
|
||||
{
|
||||
btnCancel_Click(sender, e);
|
||||
using (var dao = new SqlDAO.ProductDAO(connection))
|
||||
{
|
||||
if (dao.Delete(product.ProductID))
|
||||
{
|
||||
btnCancel_Click(sender, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -105,10 +125,16 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
product.ServiceTaxID = new Guid(cmbServiceTax.SelectedValue.ToString());
|
||||
product.Discontinued = chkDiscontinued.Checked;
|
||||
product.VatID = new Guid(cmbVat.SelectedValue.ToString());
|
||||
if (product.ProductID == new Guid())
|
||||
new ProductBI().Insert(product);
|
||||
else
|
||||
new ProductBI().Update(product);
|
||||
using (var connection = new SqlDAO.SqlConnectionDAO())
|
||||
{
|
||||
using (var dao = new SqlDAO.ProductDAO(connection))
|
||||
{
|
||||
if (product.ProductID == new Guid())
|
||||
dao.Insert(product);
|
||||
else
|
||||
dao.Update(product);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
@ -120,16 +120,25 @@
|
||||
<metadata name="bsProductGroups.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>251, 17</value>
|
||||
</metadata>
|
||||
<metadata name="bsProductGroups.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>251, 17</value>
|
||||
</metadata>
|
||||
<metadata name="bsUnits.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>123, 17</value>
|
||||
<value>29, 15</value>
|
||||
</metadata>
|
||||
<metadata name="bsUnits.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>29, 15</value>
|
||||
</metadata>
|
||||
<metadata name="bsVat.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>145, 54</value>
|
||||
<value>132, 16</value>
|
||||
</metadata>
|
||||
<metadata name="bsServiceTax.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>438, 54</value>
|
||||
<value>434, 13</value>
|
||||
</metadata>
|
||||
<metadata name="bsServiceTax.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>434, 13</value>
|
||||
</metadata>
|
||||
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>102</value>
|
||||
<value>65</value>
|
||||
</metadata>
|
||||
</root>
|
||||
@ -29,7 +29,15 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
}
|
||||
private void FillDataGrid()
|
||||
{
|
||||
dgExpenses.DataSource = new AdvanceBI().GetAdvances(dtpFrom.Value, dtpTo.Value, false);
|
||||
var fromDate = Convert.ToDateTime(string.Format("{0:dd-MMM-yyyy} 00:00:00", dtpFrom.Value));
|
||||
var toDate = Convert.ToDateTime(string.Format("{0:dd-MMM-yyyy} 23:59:59", dtpTo.Value));
|
||||
using (var connection = new SqlDAO.SqlConnectionDAO())
|
||||
{
|
||||
using (var dao = new SqlDAO.AdvanceDAO(connection))
|
||||
{
|
||||
dgExpenses.DataSource = dao.GetAdvances(fromDate, toDate, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
private void dtpFrom_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
@ -61,7 +69,13 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
}
|
||||
else
|
||||
{
|
||||
new AdvanceBI().Adjust((Guid)txtNarration.Tag, CurrentUser.user.UserID);
|
||||
using (var connection = new SqlDAO.SqlConnectionDAO())
|
||||
{
|
||||
using (var dao = new SqlDAO.AdvanceDAO(connection))
|
||||
{
|
||||
dao.Adjust((Guid)txtNarration.Tag, CurrentUser.user.UserID);
|
||||
}
|
||||
}
|
||||
FillDataGrid();
|
||||
}
|
||||
}
|
||||
|
||||
@ -30,7 +30,20 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
#endregion
|
||||
|
||||
#region Max Discount
|
||||
var maxDiscount = new SaleVoucherBI().GetProductDiscountLimit(productID);
|
||||
decimal maxDiscount;
|
||||
using (var connection = new SqlDAO.SqlConnectionDAO())
|
||||
{
|
||||
using (var dao = new SqlDAO.ProductDAO(connection))
|
||||
{
|
||||
maxDiscount = dao.GetProductDiscountLimit(productID);
|
||||
}
|
||||
}
|
||||
|
||||
if (discount >= 1)
|
||||
{
|
||||
MessageBox.Show(string.Format("Discount cannot be 100% or more", maxDiscount), "100% Discount", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
if (discount > maxDiscount)
|
||||
{
|
||||
if (Thread.CurrentPrincipal.IsInRole("High Discount Allowed"))
|
||||
@ -107,7 +120,14 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
private static SalesBillItemBO AddNewProduct(Guid productID, BindingSource bindingSource, Dictionary<BillItemKey, SalesBillItemBO> bill)
|
||||
{
|
||||
BillItemKey key = new BillItemKey(productID, true);
|
||||
SalesBillItemBO product = new SaleVoucherBI().GetDefaultSaleBillItem(productID);
|
||||
SalesBillItemBO product;
|
||||
using (var connection = new SqlDAO.SqlConnectionDAO())
|
||||
{
|
||||
using (var dao = new SqlDAO.ProductDAO(connection))
|
||||
{
|
||||
product = dao.GetDefaultSaleBillItem(productID);
|
||||
}
|
||||
}
|
||||
product.Quantity = 1;
|
||||
bill.Add(key, product);
|
||||
bindingSource.DataSource = bill.Values;
|
||||
|
||||
@ -33,7 +33,13 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
}
|
||||
else
|
||||
{
|
||||
new AdvanceBI().Insert(adv);
|
||||
using (var connection = new SqlDAO.SqlConnectionDAO())
|
||||
{
|
||||
using (var dao = new SqlDAO.AdvanceDAO(connection))
|
||||
{
|
||||
dao.Insert(adv);
|
||||
}
|
||||
}
|
||||
GridBind();
|
||||
PrintAdvances();
|
||||
}
|
||||
@ -56,8 +62,15 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
|
||||
private void GridBind()
|
||||
{
|
||||
var advance = new AdvanceBI().GetAdvances(dtpFrom.Value, dtpTo.Value, true);
|
||||
dgExpenses.DataSource = advance;
|
||||
var fromDate = Convert.ToDateTime(string.Format("{0:dd-MMM-yyyy} 00:00:00", dtpFrom.Value));
|
||||
var toDate = Convert.ToDateTime(string.Format("{0:dd-MMM-yyyy} 23:59:59", dtpTo.Value));
|
||||
using (var connection = new SqlDAO.SqlConnectionDAO())
|
||||
{
|
||||
using (var dao = new SqlDAO.AdvanceDAO(connection))
|
||||
{
|
||||
dgExpenses.DataSource = dao.GetAdvances(fromDate, toDate, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void dtpFrom_ValueChanged(object sender, EventArgs e)
|
||||
|
||||
@ -48,11 +48,6 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
dgvSale.Columns[2].DefaultCellStyle.Format = "#,##0.00;(#,##0.00);0";
|
||||
dgvSale.Columns[3].DefaultCellStyle.Format = "#,##0.00;(#,##0.00);0";
|
||||
}
|
||||
|
||||
|
||||
decimal freeSale = new SalesAnalysisBI().GetFreeSale(startDate, finishDate);
|
||||
|
||||
txtFreeSale.Text = String.Format("{0:#,##0.00;(#,##0.00);0}", freeSale);
|
||||
}
|
||||
|
||||
private void dtpFinish_ValueChanged(object sender, EventArgs e)
|
||||
|
||||
@ -28,8 +28,6 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.txtFreeSale = new System.Windows.Forms.TextBox();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.dgvSale = new System.Windows.Forms.DataGridView();
|
||||
this.dtpFinish = new System.Windows.Forms.DateTimePicker();
|
||||
this.dtpStart = new System.Windows.Forms.DateTimePicker();
|
||||
@ -39,23 +37,6 @@
|
||||
((System.ComponentModel.ISupportInitialize)(this.dgvSale)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// txtFreeSale
|
||||
//
|
||||
this.txtFreeSale.Location = new System.Drawing.Point(12, 487);
|
||||
this.txtFreeSale.Name = "txtFreeSale";
|
||||
this.txtFreeSale.ReadOnly = true;
|
||||
this.txtFreeSale.Size = new System.Drawing.Size(100, 20);
|
||||
this.txtFreeSale.TabIndex = 15;
|
||||
//
|
||||
// label4
|
||||
//
|
||||
this.label4.AutoSize = true;
|
||||
this.label4.Location = new System.Drawing.Point(12, 471);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(52, 13);
|
||||
this.label4.TabIndex = 23;
|
||||
this.label4.Text = "Free Sale";
|
||||
//
|
||||
// dgvSale
|
||||
//
|
||||
this.dgvSale.AllowUserToAddRows = false;
|
||||
@ -127,11 +108,9 @@
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(548, 519);
|
||||
this.ClientSize = new System.Drawing.Size(548, 478);
|
||||
this.Controls.Add(this.btnCopy);
|
||||
this.Controls.Add(this.btnPrint);
|
||||
this.Controls.Add(this.txtFreeSale);
|
||||
this.Controls.Add(this.label4);
|
||||
this.Controls.Add(this.dgvSale);
|
||||
this.Controls.Add(this.dtpFinish);
|
||||
this.Controls.Add(this.dtpStart);
|
||||
@ -149,8 +128,6 @@
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TextBox txtFreeSale;
|
||||
private System.Windows.Forms.Label label4;
|
||||
private System.Windows.Forms.DataGridView dgvSale;
|
||||
private System.Windows.Forms.DateTimePicker dtpFinish;
|
||||
private System.Windows.Forms.DateTimePicker dtpStart;
|
||||
|
||||
549
Tanshu.Accounts.PointOfSale/Sales/SalesForm.Designer.cs
generated
549
Tanshu.Accounts.PointOfSale/Sales/SalesForm.Designer.cs
generated
File diff suppressed because it is too large
Load Diff
@ -29,7 +29,7 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
private CustomerBO customer = new CustomerBI().GetCustomer(new Guid("F016CBAD-206C-42C0-BB1D-6006CE57BAB5"));
|
||||
private Guid? _advanceID;
|
||||
#endregion
|
||||
private SaleVoucherBO _billInfo;
|
||||
private VoucherBO _billInfo;
|
||||
object lockObject = new object();
|
||||
Guid? _newBillID;
|
||||
|
||||
@ -80,7 +80,7 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
}
|
||||
case Keys.F7:
|
||||
{
|
||||
using (SelectProduct selectProduct = new SelectProduct(new ProductBI().GetFilteredProducts, true))
|
||||
using (SelectProduct selectProduct = new SelectProduct(new FiltersBI().GetFilteredProducts, true))
|
||||
{
|
||||
selectProduct.ShowDialog();
|
||||
if (selectProduct.SelectedItem != null)
|
||||
@ -273,18 +273,18 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
private void btnPrintBill_Click(object sender, EventArgs e)
|
||||
{
|
||||
var val = Save(true);
|
||||
if (!val.HasValue)
|
||||
if (val == null)
|
||||
return;
|
||||
PrintBill(val.Value);
|
||||
ClearBill();
|
||||
PrintBill(val.VoucherID);
|
||||
ClearBill();
|
||||
}
|
||||
private void btnPrintKot_Click(object sender, EventArgs e)
|
||||
{
|
||||
var val = Save(false);
|
||||
if (!val.HasValue)
|
||||
if (val == null)
|
||||
return;
|
||||
PrintKOT(val.Value);
|
||||
ClearBill();
|
||||
PrintKOT(val.VoucherID);
|
||||
ClearBill();
|
||||
}
|
||||
private void btnCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
@ -324,7 +324,17 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
LoadBill(_newBillID.Value);
|
||||
ChangeFormState(SaleFormState.Billing);
|
||||
}
|
||||
ControlFactory.GenerateButtons(ref pnlBilling, new Rectangle(489, 94, 481, 385), 6, 6, 2, new ProductBI().GetUnFilteredProducts(), new ButtonClickDelegate(button_Click));
|
||||
using (var connection = new SqlDAO.SqlConnectionDAO())
|
||||
{
|
||||
using (var dao = new SqlDAO.ProductDAO(connection))
|
||||
{
|
||||
Dictionary<string, string> filter = new Dictionary<string, string>();
|
||||
filter.Add("Name", "");
|
||||
filter.Add("ProductGroup", "");
|
||||
var buttons = dao.GetFilteredProducts(filter);
|
||||
ControlFactory.GenerateButtons(ref pnlBilling, new Rectangle(489, 94, 481, 385), 6, 6, 2, buttons, new ButtonClickDelegate(button_Click));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ChangeFormState(SaleFormState state)
|
||||
@ -345,17 +355,21 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
|
||||
#region Save Bill
|
||||
|
||||
private Guid? Save(bool finalBill)
|
||||
private VoucherBO Save(bool finalBill)
|
||||
{
|
||||
decimal? amount = null;
|
||||
if (_billInfo != null && new SaleVoucherBI().IsBillPrinted(_billInfo.VoucherID))
|
||||
VoucherBO oldVoucher = null;
|
||||
if (_billInfo != null)
|
||||
oldVoucher = new VoucherBI().GetVoucher(_billInfo.VoucherID);
|
||||
|
||||
if (oldVoucher != null && oldVoucher.Printed)
|
||||
{
|
||||
if (!Thread.CurrentPrincipal.IsInRole("Sales/EditBill"))
|
||||
{
|
||||
MessageBox.Show("You are not authorized to access");
|
||||
return null;
|
||||
}
|
||||
amount = new SaleVoucherBI().Amount(_billInfo.VoucherID);
|
||||
amount = oldVoucher.Amount;
|
||||
}
|
||||
if (bill.Count == 0)
|
||||
return null;
|
||||
@ -364,7 +378,15 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
if (_advanceID.HasValue)
|
||||
{
|
||||
var billAmount = Math.Round(bill.Values.Sum(b => b.Value));
|
||||
var advanceAmount = new AdvanceBI().Get(_advanceID.Value).Amount;
|
||||
decimal advanceAmount = 0;
|
||||
using (var connection = new SqlDAO.SqlConnectionDAO())
|
||||
{
|
||||
using (var dao = new SqlDAO.AdvanceDAO(connection))
|
||||
{
|
||||
advanceAmount = dao.Get(_advanceID.Value).Amount;
|
||||
}
|
||||
}
|
||||
|
||||
if (advanceAmount > billAmount)
|
||||
{
|
||||
if (MessageBox.Show("Advance adjusted amount more than bill amount, advance will not be adjusted.\n\rContinue will bill print?", "Advace adjustment error",
|
||||
@ -375,10 +397,8 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
}
|
||||
}
|
||||
var saved = _billInfo == null ? AddNewSale(finalBill) : UpdateSale(finalBill);
|
||||
if (saved.HasValue && _advanceID.HasValue)
|
||||
new AdvanceBI().Adjust(_advanceID.Value, CurrentUser.user.UserID);
|
||||
if (amount != null)
|
||||
Log.Warn(string.Format("{4} modified bill no {0}/{1} from (Rs. {2:#,00}) to (Rs. {3:#,00})", _billInfo.BillID, _billInfo.TableID, amount.Value, new SaleVoucherBI().Amount(saved.Value), Thread.CurrentPrincipal.Identity.Name));
|
||||
Log.Warn(string.Format("{4} modified bill no {0}/{1} from (Rs. {2:#,00}) to (Rs. {3:#,00})", _billInfo.BillID, _billInfo.TableID, amount.Value, saved.Amount, Thread.CurrentPrincipal.Identity.Name));
|
||||
if (_newBillID.HasValue)
|
||||
this.Close();
|
||||
return saved;
|
||||
@ -400,8 +420,7 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
else
|
||||
Print.Thermal.PrintWaiterKot("KOT", voucherID, bill.Values.ToList());
|
||||
}
|
||||
#region Save / Update
|
||||
private Guid? AddNewSale(bool finalBill)
|
||||
private VoucherBO AddNewSale(bool finalBill)
|
||||
{
|
||||
if (_billInfo != null)
|
||||
{
|
||||
@ -412,13 +431,11 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
if (btnWaiter.Tag == null)
|
||||
btnWaiter.Tag = new WaiterBI().GetWaiters()[0].WaiterID;
|
||||
|
||||
#region SaleVoucher
|
||||
var user = CurrentUser.user;
|
||||
var saleVoucher = new SaleVoucherBO
|
||||
var voucher = new VoucherBO
|
||||
{
|
||||
CustomerID = customer.CustomerID,
|
||||
PaidStatus = PaidStatus.Pending,
|
||||
//Paid = finalBill,
|
||||
TableID = txtTableID.Text,
|
||||
WaiterID = (Guid)btnWaiter.Tag,
|
||||
Printed = finalBill,
|
||||
@ -428,33 +445,23 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
Floor = _floor,
|
||||
AdvanceID = _advanceID
|
||||
};
|
||||
#endregion
|
||||
#region Inventories
|
||||
List<InventoryBO> iList = new SaleVoucherBI().SaleInventory(bill.Values, null);
|
||||
#endregion
|
||||
new SaleVoucherBI().Insert(saleVoucher, iList);
|
||||
return saleVoucher.VoucherID;
|
||||
|
||||
voucher.Inventories = new VoucherBI().SaleInventory(bill.Values, null);
|
||||
return new VoucherBI().Insert(voucher);
|
||||
}
|
||||
private Guid? UpdateSale(bool finalBill)
|
||||
private VoucherBO UpdateSale(bool finalBill)
|
||||
{
|
||||
if (btnWaiter.Tag == null)
|
||||
btnWaiter.Tag = new WaiterBI().GetWaiters()[0].WaiterID;
|
||||
|
||||
var user = CurrentUser.user;
|
||||
#region Voucher and SaleVoucher
|
||||
var saleVoucher = new SaleVoucherBO
|
||||
var voucher = new VoucherBO
|
||||
{
|
||||
VoucherID = _billInfo.VoucherID,
|
||||
UserID = _billInfo.UserID,
|
||||
Date = _billInfo.Date,
|
||||
CreationDate = DateTime.Now,
|
||||
LastEditDate = DateTime.Now,
|
||||
Narration = _billInfo.Narration,
|
||||
Alarm = _billInfo.Alarm,
|
||||
BillID = _billInfo.BillID,
|
||||
CustomerID = customer.CustomerID,
|
||||
KotID = _billInfo.KotID,
|
||||
PaidStatus = _billInfo.PaidStatus,
|
||||
Printed = _billInfo.Printed || finalBill,
|
||||
TableID = txtTableID.Text,
|
||||
@ -464,16 +471,11 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
AdvanceID = _advanceID
|
||||
};
|
||||
if ((!_billInfo.Printed) && finalBill)
|
||||
saleVoucher.Date = null;
|
||||
#endregion
|
||||
#region Inventory
|
||||
List<InventoryBO> iList = new SaleVoucherBI().SaleInventory(bill.Values, _billInfo.VoucherID);
|
||||
#endregion
|
||||
new SaleVoucherBI().Update(saleVoucher, iList);
|
||||
return saleVoucher.VoucherID;
|
||||
voucher.Date = null;
|
||||
voucher.Inventories = new VoucherBI().SaleInventory(bill.Values, _billInfo.VoucherID);
|
||||
return new VoucherBI().Update(voucher);
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
|
||||
private void LoadBillFromTable()
|
||||
@ -484,7 +486,7 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
txtTableID.Text = result.Text.Trim();
|
||||
if ((txtTableID.Text != "C") && (txtTableID.Text != "") && (!txtTableID.Text.Contains(".")))
|
||||
{
|
||||
Guid? tID = new SaleVoucherBI().GetPendingVoucherID(txtTableID.Text, _floor);
|
||||
Guid? tID = new VoucherBI().GetPendingVoucherID(txtTableID.Text, _floor);
|
||||
if (tID.HasValue)
|
||||
{
|
||||
LoadBill(tID.Value);
|
||||
@ -499,8 +501,7 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
private void LoadBill(Guid voucherID)
|
||||
{
|
||||
ClearBill();
|
||||
var iList = new List<InventoryDisplayBO>();
|
||||
new SaleVoucherBI().GetSaleVoucher(voucherID, ref _billInfo, ref iList);
|
||||
_billInfo = new VoucherBI().GetVoucher(voucherID);
|
||||
|
||||
this.txtBillID.Text = _billInfo.BillID;
|
||||
this.txtKotID.Text = _billInfo.KotID;
|
||||
@ -508,15 +509,15 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
this.txtDate.Text = _billInfo.Date.Value.ToString("HH:mm dd-MMM-yyyy");
|
||||
this.txtLastEditDate.Text = _billInfo.LastEditDate.ToString("HH:mm dd-MMM-yyyy");
|
||||
this.txtNarration.Text = _billInfo.Narration;
|
||||
this.txtUserID.Text = new UserBI().GetUser(_billInfo.UserID).Name;
|
||||
this.customer = new CustomerBI().GetCustomer(_billInfo.CustomerID);
|
||||
this.txtUserID.Text = _billInfo.User.Name;
|
||||
this.customer = _billInfo.Customer;
|
||||
this.btnCustomer.Text = this.customer.Name;
|
||||
this.txtTableID.Text = _billInfo.TableID;
|
||||
this.btnWaiter.Tag = _billInfo.WaiterID;
|
||||
this._advanceID = _billInfo.AdvanceID;
|
||||
this.btnWaiter.Text = string.Format("{0} - F5", new WaiterBI().GetWaiter(_billInfo.WaiterID).Name);
|
||||
this.btnWaiter.Text = string.Format("{0} - F5", _billInfo.Waiter.Name);
|
||||
|
||||
foreach (var inventory in iList)
|
||||
foreach (var inventory in _billInfo.Inventories)
|
||||
{
|
||||
var key = new BillItemKey(inventory.ProductID, inventory.Quantity == 0);
|
||||
bill.Add(key, new SalesBillItemBO
|
||||
@ -561,9 +562,9 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
lock (lockObject)
|
||||
{
|
||||
pendingBills = new SaleVoucherBI().GetPendingBills(pendingList, _floor);
|
||||
pendingBills = new VoucherBI().GetPendingBills(pendingList, _floor);
|
||||
bsPending.DataSource = pendingBills;
|
||||
var alarmBills = new SaleVoucherBI().GetPendingBills(PendingType.Alarms, _floor).OrderBy(b => b.AlarmTime).ToList();
|
||||
var alarmBills = new VoucherBI().GetPendingBills(PendingType.Alarms, _floor).OrderBy(b => b.AlarmTime).ToList();
|
||||
if (alarmBills.Count > 0)
|
||||
{
|
||||
var al = alarmBills.First();
|
||||
@ -639,7 +640,7 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
if ((customer.CustomerID == new Guid("F016CBAD-206C-42C0-BB1D-6006CE57BAB5")) && (!reset))
|
||||
{
|
||||
using (SelectCustomer selectCustomer = new SelectCustomer(new CustomerBI().GetFilteredCustomers, true))
|
||||
using (SelectCustomer selectCustomer = new SelectCustomer(new FiltersBI().GetFilteredCustomers, true))
|
||||
{
|
||||
selectCustomer.customerEvent += new CustomerEventHandler(selectCustomer_customerEvent);
|
||||
selectCustomer.ShowDialog();
|
||||
@ -707,7 +708,7 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
voidReason.ShowDialog();
|
||||
if (voidReason.SelectedItem != null)
|
||||
{
|
||||
new SaleVoucherBI().VoidBill(_billInfo.VoucherID, voidReason.SelectedItem.Description, CurrentUser.user.UserID);
|
||||
new VoucherBI().VoidBill(_billInfo.VoucherID, voidReason.SelectedItem.Description, CurrentUser.user.UserID);
|
||||
ClearBill();
|
||||
}
|
||||
else
|
||||
@ -761,14 +762,14 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
private void btnPaidCash_Click(object sender, EventArgs e)
|
||||
{
|
||||
var user = CurrentUser.user;
|
||||
new SaleVoucherBI().DeclareBillsPaid(user.UserID, selectedBills, PaidStatus.Cash);
|
||||
new VoucherBI().DeclareBillsPaid(user.UserID, selectedBills, PaidStatus.Cash);
|
||||
ListUnpaidBills();
|
||||
}
|
||||
|
||||
private void btnPaidCC_Click(object sender, EventArgs e)
|
||||
{
|
||||
var user = CurrentUser.user;
|
||||
new SaleVoucherBI().DeclareBillsPaid(user.UserID, selectedBills, PaidStatus.CreditCard);
|
||||
new VoucherBI().DeclareBillsPaid(user.UserID, selectedBills, PaidStatus.CreditCard);
|
||||
ListUnpaidBills();
|
||||
}
|
||||
|
||||
@ -787,12 +788,12 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
DateTime alarmTime;
|
||||
if (result.Text == string.Empty)
|
||||
{
|
||||
new SaleVoucherBI().SetAlarm(billAlarm.voucherID, null);
|
||||
new VoucherBI().SetAlarm(billAlarm.voucherID, null);
|
||||
MessageBox.Show("Alarm Cleared", "Alarm Cleared", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
else if (DateTime.TryParseExact(result.Text, "dd-MMM-yyyy HH:mm", new CultureInfo("en-US"), DateTimeStyles.None, out alarmTime))
|
||||
{
|
||||
new SaleVoucherBI().SetAlarm(billAlarm.voucherID, alarmTime);
|
||||
new VoucherBI().SetAlarm(billAlarm.voucherID, alarmTime);
|
||||
MessageBox.Show("Alarm set", "Alarm Set", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
else
|
||||
@ -811,16 +812,14 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
var result = InputBox.Show("Bill No", "Bill No", "", InputBox_Validating);
|
||||
if (result.OK)
|
||||
{
|
||||
var saleVoucher = new SaleVoucherBO();
|
||||
var list = new List<InventoryDisplayBO>();
|
||||
new SaleVoucherBI().GetSaleVoucher(result.Text,ref saleVoucher, ref list);
|
||||
if (saleVoucher == null)
|
||||
var voucher = new VoucherBI().GetVoucher(result.Text);
|
||||
if (voucher == null)
|
||||
return;
|
||||
LoadBill(saleVoucher.VoucherID);
|
||||
LoadBill(voucher.VoucherID);
|
||||
ChangeFormState(SaleFormState.Billing);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//#region Filters
|
||||
//decimal? minValue = 0, maxValue = 0;
|
||||
@ -937,14 +936,14 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
private void btnPaidStaff_Click(object sender, EventArgs e)
|
||||
{
|
||||
var user = CurrentUser.user;
|
||||
new SaleVoucherBI().DeclareBillsPaid(user.UserID, selectedBills, PaidStatus.Staff);
|
||||
new VoucherBI().DeclareBillsPaid(user.UserID, selectedBills, PaidStatus.Staff);
|
||||
ListUnpaidBills();
|
||||
}
|
||||
|
||||
private void btnPaidCredit_Click(object sender, EventArgs e)
|
||||
{
|
||||
var user = CurrentUser.user;
|
||||
new SaleVoucherBI().DeclareBillsPaid(user.UserID, selectedBills, PaidStatus.Credit);
|
||||
new VoucherBI().DeclareBillsPaid(user.UserID, selectedBills, PaidStatus.Credit);
|
||||
ListUnpaidBills();
|
||||
}
|
||||
|
||||
@ -959,6 +958,13 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void btnPaidNc_Click(object sender, EventArgs e)
|
||||
{
|
||||
var user = CurrentUser.user;
|
||||
new VoucherBI().DeclareBillsPaid(user.UserID, selectedBills, PaidStatus.Nc);
|
||||
ListUnpaidBills();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -129,27 +129,27 @@
|
||||
<metadata name="Display.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="selectDataGridViewCheckBoxColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="TableID.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="bsPending.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>248, 17</value>
|
||||
</metadata>
|
||||
<metadata name="selectDataGridViewCheckBoxColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="TableID.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="bsPending.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>248, 17</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="selectDataGridViewCheckBoxColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="TableID.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="bsPending.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>248, 17</value>
|
||||
</metadata>
|
||||
<metadata name="selectDataGridViewCheckBoxColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="TableID.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="bsPending.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>248, 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>
|
||||
|
||||
@ -332,6 +332,10 @@
|
||||
<Project>{90C9D02C-91AF-4529-86BE-28320332DDB5}</Project>
|
||||
<Name>Tanshu.Accounts.Print</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Tanshu.Accounts.SqlDAO\Tanshu.Accounts.SqlDAO.csproj">
|
||||
<Project>{B755D152-37C3-47D6-A721-3AD17A8EF316}</Project>
|
||||
<Name>Tanshu.Accounts.SqlDAO</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
|
||||
@ -32,8 +32,8 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
DateTime startDate = Convert.ToDateTime(String.Format("{0:dd-MMM-yyyy} 00:00:00", dtpStart.Value));
|
||||
DateTime finishDate = Convert.ToDateTime(String.Format("{0:dd-MMM-yyyy} 23:59:59", dtpFinish.Value));
|
||||
|
||||
decimal freeSale = 0, voids = 0, pending = 0, net = 0, tax = 0;
|
||||
det = new SalesAnalysisBI().GetSalesTaxReturn(startDate, finishDate, ref freeSale, ref voids, ref pending, ref net, ref tax);
|
||||
decimal voids = 0, pending = 0, net = 0, vat = 0, serviceTax = 0, nc = 0;
|
||||
det = new SalesAnalysisBI().GetSalesTaxReturn(startDate, finishDate, ref voids, ref pending, ref net, ref vat, ref serviceTax, ref nc);
|
||||
|
||||
//dc.CommandTimeout = 50000;
|
||||
dgvSale.AutoGenerateColumns = true;
|
||||
@ -49,8 +49,8 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
txtVoid.Text = String.Format("{0:#,##0.00;(#,##0.00);0}", voids);
|
||||
txtPending.Text = String.Format("{0:#,##0.00;(#,##0.00);0}", pending);
|
||||
txtNet.Text = String.Format("{0:#,##0.00;(#,##0.00);0}", net);
|
||||
txtTax.Text = String.Format("{0:#,##0.00;(#,##0.00);0}", tax);
|
||||
txtGross.Text = String.Format("{0:#,##0.00;(#,##0.00);0}", net + tax);
|
||||
txtVat.Text = String.Format("{0:#,##0.00;(#,##0.00);0}", vat);
|
||||
txtServiceTax.Text = String.Format("{0:#,##0.00;(#,##0.00);0}", net + serviceTax);
|
||||
}
|
||||
|
||||
private void dtpFinish_ValueChanged(object sender, EventArgs e)
|
||||
|
||||
@ -29,8 +29,8 @@
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.txtNet = new System.Windows.Forms.TextBox();
|
||||
this.txtTax = new System.Windows.Forms.TextBox();
|
||||
this.txtGross = new System.Windows.Forms.TextBox();
|
||||
this.txtVat = new System.Windows.Forms.TextBox();
|
||||
this.txtServiceTax = new System.Windows.Forms.TextBox();
|
||||
this.txtPending = new System.Windows.Forms.TextBox();
|
||||
this.txtVoid = new System.Windows.Forms.TextBox();
|
||||
this.label5 = new System.Windows.Forms.Label();
|
||||
@ -54,21 +54,21 @@
|
||||
this.txtNet.Size = new System.Drawing.Size(100, 20);
|
||||
this.txtNet.TabIndex = 17;
|
||||
//
|
||||
// txtTax
|
||||
// txtVat
|
||||
//
|
||||
this.txtTax.Location = new System.Drawing.Point(330, 487);
|
||||
this.txtTax.Name = "txtTax";
|
||||
this.txtTax.ReadOnly = true;
|
||||
this.txtTax.Size = new System.Drawing.Size(100, 20);
|
||||
this.txtTax.TabIndex = 18;
|
||||
this.txtVat.Location = new System.Drawing.Point(330, 487);
|
||||
this.txtVat.Name = "txtVat";
|
||||
this.txtVat.ReadOnly = true;
|
||||
this.txtVat.Size = new System.Drawing.Size(100, 20);
|
||||
this.txtVat.TabIndex = 18;
|
||||
//
|
||||
// txtGross
|
||||
// txtServiceTax
|
||||
//
|
||||
this.txtGross.Location = new System.Drawing.Point(436, 487);
|
||||
this.txtGross.Name = "txtGross";
|
||||
this.txtGross.ReadOnly = true;
|
||||
this.txtGross.Size = new System.Drawing.Size(100, 20);
|
||||
this.txtGross.TabIndex = 19;
|
||||
this.txtServiceTax.Location = new System.Drawing.Point(436, 487);
|
||||
this.txtServiceTax.Name = "txtServiceTax";
|
||||
this.txtServiceTax.ReadOnly = true;
|
||||
this.txtServiceTax.Size = new System.Drawing.Size(100, 20);
|
||||
this.txtServiceTax.TabIndex = 19;
|
||||
//
|
||||
// txtPending
|
||||
//
|
||||
@ -109,18 +109,18 @@
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(327, 471);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(25, 13);
|
||||
this.label3.Size = new System.Drawing.Size(23, 13);
|
||||
this.label3.TabIndex = 26;
|
||||
this.label3.Text = "Tax";
|
||||
this.label3.Text = "Vat";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(433, 471);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(58, 13);
|
||||
this.label2.Size = new System.Drawing.Size(64, 13);
|
||||
this.label2.TabIndex = 27;
|
||||
this.label2.Text = "Gross Sale";
|
||||
this.label2.Text = "Service Tax";
|
||||
//
|
||||
// label1
|
||||
//
|
||||
@ -187,15 +187,15 @@
|
||||
this.btnPrint.UseVisualStyleBackColor = true;
|
||||
this.btnPrint.Click += new System.EventHandler(this.btnPrint_Click);
|
||||
//
|
||||
// frmSaleAnalysisForm
|
||||
// SaleTaxReportForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(548, 519);
|
||||
this.Controls.Add(this.btnPrint);
|
||||
this.Controls.Add(this.txtNet);
|
||||
this.Controls.Add(this.txtTax);
|
||||
this.Controls.Add(this.txtGross);
|
||||
this.Controls.Add(this.txtVat);
|
||||
this.Controls.Add(this.txtServiceTax);
|
||||
this.Controls.Add(this.txtPending);
|
||||
this.Controls.Add(this.txtVoid);
|
||||
this.Controls.Add(this.label5);
|
||||
@ -208,7 +208,7 @@
|
||||
this.Controls.Add(this.dtpStart);
|
||||
this.Controls.Add(this.label10);
|
||||
this.MaximizeBox = false;
|
||||
this.Name = "frmSaleAnalysisForm";
|
||||
this.Name = "SaleTaxReportForm";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "Sale Analysis Form";
|
||||
this.Load += new System.EventHandler(this.Sale_Analysis_Form_Load);
|
||||
@ -221,8 +221,8 @@
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TextBox txtNet;
|
||||
private System.Windows.Forms.TextBox txtTax;
|
||||
private System.Windows.Forms.TextBox txtGross;
|
||||
private System.Windows.Forms.TextBox txtVat;
|
||||
private System.Windows.Forms.TextBox txtServiceTax;
|
||||
private System.Windows.Forms.TextBox txtPending;
|
||||
private System.Windows.Forms.TextBox txtVoid;
|
||||
private System.Windows.Forms.Label label5;
|
||||
|
||||
Reference in New Issue
Block a user