Item Modifier added

This commit is contained in:
unknown
2011-01-22 18:08:30 +05:30
parent 3ea5fc75ab
commit 98e1e1df30
42 changed files with 674 additions and 284 deletions

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<connectionStrings>
<add name="connection" connectionString="Server=frodo;Initial Catalog=PeithoSales;User ID=sa;Password=123456" />
<add name="connection" connectionString="Server=.;Initial Catalog=PeithoSales;User ID=sa;Password=123456" />
</connectionStrings>
<appSettings>
<add key ="Location" value ="Ground"/>

View File

@ -44,6 +44,11 @@ namespace Tanshu.Accounts.PointOfSale
{
BillHelperFunctions.AddProductToGrid(productID, bindingSource, bill);
ShowAmount();
ProductBO product = ProductBI.GetProduct(productID);
if (ProductGroupModifierBI.HasCompulsoryModifier(product.ProductGroupID))
saleForm.ShowModifiers(product.ProductGroupID);
}
public void ShowCustomerList(bool reset)
{
@ -449,6 +454,13 @@ namespace Tanshu.Accounts.PointOfSale
}
//private Dictionary<string,string> modifiers;
public void AddModifier(string modifierID)
{
MessageBox.Show(modifierID);
}
internal void SettleBill()
{
if (billInfo == null)
@ -464,6 +476,11 @@ namespace Tanshu.Accounts.PointOfSale
case SettleOptions.Cancel:
break;
case SettleOptions.Cash:
break;
case SettleOptions.CreditCard:
break;
case SettleOptions.NoCharge:
break;
}
throw new NotImplementedException();

View File

@ -14,5 +14,6 @@ namespace Tanshu.Accounts.PointOfSale
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 SetUserName(string name);
void ShowModifiers(Guid productGroupID);
}
}

View File

@ -226,7 +226,7 @@ namespace Tanshu.Accounts.PointOfSale
{
if (roleBI.IsAllowed)
{
new ProductBI().UpdateShortName();
ProductBI.UpdateShortName();
using (SalesForm frmSale = new SalesForm(new BillController()))
frmSale.ShowDialog();
}

View File

@ -145,7 +145,7 @@
//
// bsTypes
//
this.bsTypes.DataSource = typeof(Tanshu.Accounts.Contracts.ProductTypeBO);
this.bsTypes.DataSource = typeof(Tanshu.Accounts.Contracts.ProductGroupBO);
//
// cmbUnits
//

View File

@ -22,7 +22,7 @@ namespace Tanshu.Accounts.PointOfSale
private void Products_Load(object sender, EventArgs e)
{
productList = new ProductBI().GetProducts();
productList = ProductBI.GetProducts();
bsProducts.DataSource = productList;
FillCombos();
bsProducts.MoveFirst();
@ -48,7 +48,7 @@ namespace Tanshu.Accounts.PointOfSale
new StringType ("Bottle"),
new StringType ("Pack" )};
bsTypes.DataSource = new ProductTypeBI().GetProductTypes();
bsTypes.DataSource = new ProductGroupBI().GetProductGroups();
bsPurchaseLedgers.DataSource = new LedgerBI().GetLedgersOfType('P');
bsSalesLedgers.DataSource = new LedgerBI().GetLedgersOfType('X');
bsSalesTax.DataSource = new LedgerBI().GetLedgersOfType('T');
@ -81,7 +81,7 @@ namespace Tanshu.Accounts.PointOfSale
btnExit_Click(sender, e);
else
{
productList = new ProductBI().GetProducts();
productList = ProductBI.GetProducts();
bsProducts.DataSource = productList;
LockControls(false);
}
@ -97,9 +97,9 @@ namespace Tanshu.Accounts.PointOfSale
{
if (MessageBox.Show("Are you sure?", "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
{
if (new ProductBI().Delete(productList.Single(p => p.Code == Convert.ToInt32(txtUniqueID.Text)).ProductID))
if (ProductBI.Delete(productList.Single(p => p.Code == Convert.ToInt32(txtUniqueID.Text)).ProductID))
{
productList = new ProductBI().GetProducts();
productList = ProductBI.GetProducts();
btnNavFirst_Click(sender, e);
}
}
@ -142,12 +142,12 @@ namespace Tanshu.Accounts.PointOfSale
UserBO user = Session.User;
ProductBO product = new ProductBO();
if (!addNew)
product = new ProductBI().GetProduct(productList.ElementAt(bsProducts.Position).ProductID);
product = ProductBI.GetProduct(productList.ElementAt(bsProducts.Position).ProductID);
product.Name = txtName.Text;
product.MinimumLevel = Convert.ToDecimal(txtMinimumLevel.Text);
product.MaximumLevel = Convert.ToDecimal(txtMaximumLevel.Text);
product.Units = cmbUnits.Text;
product.ProductTypeID = new Guid(cmbProductTypes.SelectedValue.ToString());
product.ProductGroupID = new Guid(cmbProductTypes.SelectedValue.ToString());
product.SalePrice = Convert.ToDecimal(txtSalePrice.Text);
if (cmbPurchaseLedger.SelectedValue != null)
product.PurchaseLedgerID = new Guid(cmbPurchaseLedger.SelectedValue.ToString());
@ -158,9 +158,9 @@ namespace Tanshu.Accounts.PointOfSale
product.PurchasePrice = Convert.ToDecimal(txtPurchasePrice.Text);
product.SaleTaxID = new Guid(cmbSalesTax.SelectedValue.ToString());
if (addNew)
new ProductBI().Insert(product);
ProductBI.Insert(product);
else
new ProductBI().Update(product);
ProductBI.Update(product);
return true;
#endregion
@ -221,7 +221,7 @@ namespace Tanshu.Accounts.PointOfSale
}
private void lblNavLocation_Click(object sender, EventArgs e)
{
using (SelectProduct selectProduct = new SelectProduct(new ProductBI().GetFilteredProducts, true))
using (SelectProduct selectProduct = new SelectProduct(ProductBI.GetFilteredProducts, true))
{
selectProduct.ShowDialog();
if (selectProduct.SelectedItem != null)

View File

@ -66,7 +66,7 @@ namespace Tanshu.Accounts.PointOfSale
}
case Keys.F7:
{
using (SelectProduct selectProduct = new SelectProduct(new ProductBI().GetFilteredProducts, true))
using (SelectProduct selectProduct = new SelectProduct(ProductBI.GetFilteredProducts, true))
{
selectProduct.ShowDialog();
if (selectProduct.SelectedItem != null)
@ -165,7 +165,7 @@ namespace Tanshu.Accounts.PointOfSale
btnPrevious.Visible = true;
btnNext.Visible = true;
page = 0;
var list = new ProductTypeBI().GetProductTypes();
var list = new ProductGroupBI().GetProductGroups();
ControlFactory.GenerateButtons(ref pnlBilling, ref buttonHeads, new Rectangle(889, 90, 85, 498), 1, pageSize, 2, page, list, new ButtonClickDelegate(productTypeButton_Click));
}
else
@ -175,13 +175,26 @@ namespace Tanshu.Accounts.PointOfSale
ControlFactory.GenerateTables(ref pnlBilling, ref buttonHeads, new Rectangle(390, 94, 499, 385), 6, 10, 2, new FoodTableBI().GetFoodTables(), new ButtonClickDelegate(tableButton_Click));
}
}
public void ShowModifiers(Guid productGroupID)
{
ControlFactory.GenerateModifiers(ref pnlBilling, ref buttonList, new Rectangle(390, 94, 499, 385), 5, 6, 2, ProductGroupModifierBI.GetProductGroupModifiers(productGroupID), new ButtonClickDelegate(modifierButton_Click));
}
private void modifierButton_Click(object sender, EventArgs e)
{
Button button = sender as Button;
if (button == null)
return;
string tag = (string)button.Tag;
billController.AddModifier(tag);
}
private void productTypeButton_Click(object sender, EventArgs e)
{
Button button = sender as Button;
if (button == null)
return;
Guid tag = (Guid)button.Tag;
ControlFactory.GenerateButtons(ref pnlBilling, ref buttonList, new Rectangle(390, 94, 499, 385), 5, 6, 2, new ProductBI().GetProducts(tag), new ButtonClickDelegate(productButton_Click));
ControlFactory.GenerateButtons(ref pnlBilling, ref buttonList, new Rectangle(390, 94, 499, 385), 5, 6, 2, ProductBI.GetProducts(tag), new ButtonClickDelegate(productButton_Click));
}
private void productButton_Click(object sender, EventArgs e)
{
@ -365,7 +378,7 @@ namespace Tanshu.Accounts.PointOfSale
private void btnPrevious_Click(object sender, EventArgs e)
{
page--;
var list = new ProductTypeBI().GetProductTypes();
var list = new ProductGroupBI().GetProductGroups();
if (page == -1)
page = 0;
@ -374,7 +387,7 @@ namespace Tanshu.Accounts.PointOfSale
private void btnNext_Click(object sender, EventArgs e)
{
page++;
var list = new ProductTypeBI().GetProductTypes();
var list = new ProductGroupBI().GetProductGroups();
int pages = Convert.ToInt32(Math.Ceiling(Convert.ToDouble(list.Count) / Convert.ToDouble(pageSize)));
if (page == pages)
page--;

View File

@ -31,13 +31,15 @@
this.dtpFrom = new System.Windows.Forms.DateTimePicker();
this.dtpTo = new System.Windows.Forms.DateTimePicker();
this.btnGo = new System.Windows.Forms.Button();
this.txtTwelve = new System.Windows.Forms.TextBox();
this.txtFive = new System.Windows.Forms.TextBox();
this.txtFour = new System.Windows.Forms.TextBox();
this.txtZero = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.txtStatus = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.txtTwelve = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// dtpFrom
@ -56,7 +58,7 @@
//
// btnGo
//
this.btnGo.Location = new System.Drawing.Point(12, 142);
this.btnGo.Location = new System.Drawing.Point(12, 168);
this.btnGo.Name = "btnGo";
this.btnGo.Size = new System.Drawing.Size(268, 23);
this.btnGo.TabIndex = 5;
@ -64,13 +66,13 @@
this.btnGo.UseVisualStyleBackColor = true;
this.btnGo.Click += new System.EventHandler(this.btnGo_Click);
//
// txtTwelve
// txtFive
//
this.txtTwelve.Location = new System.Drawing.Point(50, 116);
this.txtTwelve.Name = "txtTwelve";
this.txtTwelve.Size = new System.Drawing.Size(230, 20);
this.txtTwelve.TabIndex = 4;
this.txtTwelve.Text = "0";
this.txtFive.Location = new System.Drawing.Point(50, 116);
this.txtFive.Name = "txtFive";
this.txtFive.Size = new System.Drawing.Size(230, 20);
this.txtFive.TabIndex = 4;
this.txtFive.Text = "0";
//
// txtFour
//
@ -111,30 +113,49 @@
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(12, 119);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(36, 13);
this.label3.Size = new System.Drawing.Size(21, 13);
this.label3.TabIndex = 8;
this.label3.Text = "12.5%";
this.label3.Text = "5%";
//
// txtStatus
//
this.txtStatus.Location = new System.Drawing.Point(12, 171);
this.txtStatus.Location = new System.Drawing.Point(12, 197);
this.txtStatus.Name = "txtStatus";
this.txtStatus.ReadOnly = true;
this.txtStatus.Size = new System.Drawing.Size(268, 20);
this.txtStatus.TabIndex = 9;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(12, 145);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(36, 13);
this.label4.TabIndex = 11;
this.label4.Text = "12.5%";
//
// txtTwelve
//
this.txtTwelve.Location = new System.Drawing.Point(50, 142);
this.txtTwelve.Name = "txtTwelve";
this.txtTwelve.Size = new System.Drawing.Size(230, 20);
this.txtTwelve.TabIndex = 10;
this.txtTwelve.Text = "0";
//
// UpdateForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(292, 203);
this.ClientSize = new System.Drawing.Size(292, 229);
this.Controls.Add(this.label4);
this.Controls.Add(this.txtTwelve);
this.Controls.Add(this.txtStatus);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.txtZero);
this.Controls.Add(this.txtFour);
this.Controls.Add(this.txtTwelve);
this.Controls.Add(this.txtFive);
this.Controls.Add(this.btnGo);
this.Controls.Add(this.dtpTo);
this.Controls.Add(this.dtpFrom);
@ -150,12 +171,14 @@
private System.Windows.Forms.DateTimePicker dtpFrom;
private System.Windows.Forms.DateTimePicker dtpTo;
private System.Windows.Forms.Button btnGo;
private System.Windows.Forms.TextBox txtTwelve;
private System.Windows.Forms.TextBox txtFive;
private System.Windows.Forms.TextBox txtFour;
private System.Windows.Forms.TextBox txtZero;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox txtStatus;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.TextBox txtTwelve;
}
}

View File

@ -46,6 +46,8 @@ namespace Tanshu.Accounts.PointOfSale
if (last == -1)
processDelegate.BeginInvoke(dtpFrom.Value, dtpTo.Value, GetTextboxValue(txtTwelve), .125M, new AsyncCallback(CallbackMethod), null);
if (last == .125M)
processDelegate.BeginInvoke(dtpFrom.Value, dtpTo.Value, GetTextboxValue(txtFive), .05M, new AsyncCallback(CallbackMethod), null);
if (last == .05M)
processDelegate.BeginInvoke(dtpFrom.Value, dtpTo.Value, GetTextboxValue(txtFour), .04M, new AsyncCallback(CallbackMethod), null);
if (last == .04M)
processDelegate.BeginInvoke(dtpFrom.Value, dtpTo.Value, GetTextboxValue(txtZero), 0M, new AsyncCallback(CallbackMethod), null);

View File

@ -29,9 +29,9 @@
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = 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();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
this.label1 = new System.Windows.Forms.Label();
this.txtDiff = new System.Windows.Forms.TextBox();
this.dgvPending = new System.Windows.Forms.DataGridView();
@ -93,14 +93,14 @@
| System.Windows.Forms.AnchorStyles.Right)));
this.dgvPending.AutoGenerateColumns = false;
this.dgvPending.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.DisplayedCells;
dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle4.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle4.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
dataGridViewCellStyle4.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle4.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle4.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.dgvPending.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle4;
dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.dgvPending.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
this.dgvPending.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvPending.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.selectDataGridViewItem,
@ -119,25 +119,25 @@
this.printedDataGridViewCheckBoxColumn,
this.alarmTimeDataGridViewTextBoxColumn});
this.dgvPending.DataSource = this.bsPending;
dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle5.BackColor = System.Drawing.SystemColors.Window;
dataGridViewCellStyle5.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
dataGridViewCellStyle5.ForeColor = System.Drawing.SystemColors.ControlText;
dataGridViewCellStyle5.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle5.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dgvPending.DefaultCellStyle = dataGridViewCellStyle5;
dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Window;
dataGridViewCellStyle2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.ControlText;
dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dgvPending.DefaultCellStyle = dataGridViewCellStyle2;
this.dgvPending.Location = new System.Drawing.Point(12, 38);
this.dgvPending.MultiSelect = false;
this.dgvPending.Name = "dgvPending";
dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle6.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle6.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
dataGridViewCellStyle6.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle6.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle6.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.dgvPending.RowHeadersDefaultCellStyle = dataGridViewCellStyle6;
dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle3.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle3.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
dataGridViewCellStyle3.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle3.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle3.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.dgvPending.RowHeadersDefaultCellStyle = dataGridViewCellStyle3;
this.dgvPending.RowHeadersVisible = false;
this.dgvPending.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.dgvPending.Size = new System.Drawing.Size(743, 500);
@ -335,6 +335,7 @@
this.cmbTax.Items.AddRange(new object[] {
"0%",
"4%",
"5%",
"12.5%"});
this.cmbTax.Location = new System.Drawing.Point(371, 10);
this.cmbTax.Name = "cmbTax";

View File

@ -31,6 +31,8 @@ namespace Tanshu.Accounts.PointOfSale.Updates
tax = 0;
else if (cmbTax.Text == "4%")
tax = .04M;
else if (cmbTax.Text == "5%")
tax = .05M;
else if (cmbTax.Text == "12.5%")
tax = .125M;
decimal target = Convert.ToDecimal(txtTarget.Text);