Scripts to transition database to new version.

Changed inventory and product entities to split Vat and Service Tax and IsScTaxable.
Added MessageBox on startup to inform about Debug Mode.
Updated ProductForm for the change.
Work still needs to be done on Thermal Printing where the hack for VAT on Food and VAT on Liqour is still there.
Now No Service Tax on Delivery Works as promised.
This commit is contained in:
unknown 2012-04-08 17:58:15 +05:30
parent 964d0a78bf
commit 2d1030abf6
20 changed files with 519 additions and 145 deletions

@ -0,0 +1,85 @@
BEGIN TRANSACTION
GO
ALTER TABLE dbo.Entities_Inventories
DROP CONSTRAINT FK53E4F7FE3F88CAB6
GO
ALTER TABLE dbo.Entities_Inventories
DROP CONSTRAINT FK53E4F7FEDB70F42
GO
CREATE TABLE dbo.Tmp_Entities_Inventories
(
InventoryID int NOT NULL IDENTITY (1, 1),
Quantity decimal(19, 5) NOT NULL,
Price decimal(19, 5) NOT NULL,
FullPrice decimal(19, 5) NOT NULL,
ServiceTax decimal(19, 5) NOT NULL,
Vat decimal(19, 5) NOT NULL,
Discount decimal(19, 5) NOT NULL,
ServiceCharge decimal(19, 5) NOT NULL,
IsScTaxable bit NOT NULL,
Amount AS CASE WHEN IsScTaxable = 1 THEN Quantity * Price * (1 - Discount) * (1 + ServiceCharge) * (1 + ServiceTax + Vat) ELSE Quantity * Price * (1 - Discount) * (1 + ServiceCharge + ServiceTax + Vat) END,
KotID int NULL,
ProductID int NULL
) ON [PRIMARY]
GO
SET IDENTITY_INSERT dbo.Tmp_Entities_Inventories ON
GO
IF EXISTS(SELECT * FROM dbo.Entities_Inventories)
EXEC('INSERT INTO dbo.Tmp_Entities_Inventories (InventoryID, Quantity, Price, FullPrice, ServiceTax, Vat, Discount, ServiceCharge, IsScTaxable, KotID, ProductID)
SELECT InventoryID, Quantity, Price, FullPrice, 0, Tax, Discount, ServiceCharge, 1, KotID, ProductID FROM dbo.Entities_Inventories WITH (HOLDLOCK TABLOCKX)')
GO
SET IDENTITY_INSERT dbo.Tmp_Entities_Inventories OFF
GO
ALTER TABLE dbo.Entities_InventoryModifiers
DROP CONSTRAINT FK695304F8BA29671A
GO
DROP TABLE dbo.Entities_Inventories
GO
EXECUTE sp_rename N'dbo.Tmp_Entities_Inventories', N'Entities_Inventories', 'OBJECT'
GO
ALTER TABLE dbo.Entities_Inventories ADD CONSTRAINT
PK__Entities_Inventories PRIMARY KEY CLUSTERED
(
InventoryID
) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX IX_Entities_Inventories ON dbo.Entities_Inventories
(
KotID
) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
ALTER TABLE dbo.Entities_Inventories ADD CONSTRAINT
FK53E4F7FEDB70F42 FOREIGN KEY
(
KotID
) REFERENCES dbo.Entities_Kots
(
KotID
) ON UPDATE NO ACTION
ON DELETE NO ACTION
GO
ALTER TABLE dbo.Entities_Inventories ADD CONSTRAINT
FK53E4F7FE3F88CAB6 FOREIGN KEY
(
ProductID
) REFERENCES dbo.Entities_Products
(
ProductID
) ON UPDATE NO ACTION
ON DELETE NO ACTION
GO
ALTER TABLE dbo.Entities_InventoryModifiers ADD CONSTRAINT
FK695304F8BA29671A FOREIGN KEY
(
InventoryID
) REFERENCES dbo.Entities_Inventories
(
InventoryID
) ON UPDATE NO ACTION
ON DELETE NO ACTION
GO
COMMIT

@ -0,0 +1,40 @@
select distinct vat from entities_inventories
select * from entities_taxes
update entities_inventories set issctaxable = 0, servicetax = 0, vat = 0
where vat = 0.00000
update entities_inventories set issctaxable = 1, servicetax = 0, vat = 0.13125
where vat = 0.13125
update entities_inventories set issctaxable = 1, servicetax = 0, vat = 0.26250
where vat = 0.26250
update entities_inventories set issctaxable = 0, servicetax = 0.03708, vat = 0.13125
where vat = 0.15303
update entities_inventories set issctaxable = 0, servicetax = 0.03708, vat = 0.1575
where vat = 0.17690
update entities_inventories set issctaxable = 0, servicetax = 0.0309, vat = 0.13125
where vat = 0.14741
update entities_inventories set issctaxable = 0, servicetax = 0.0309, vat = 0.2625
where vat = 0.26673
update entities_inventories set issctaxable = 0, servicetax = 0.03, vat = 0.13125
where vat = 0.14659
update entities_inventories set issctaxable = 0, servicetax = 0.03, vat = 0.2625
where vat = 0.26591
UPDATE Entities_Taxes SET Name = 'VAT on Food 12.5%', Rate = .13125 WHERE TaxID = 1
UPDATE Entities_Taxes SET Name = 'VAT on Liquor 15%', Rate = .1575 WHERE TaxID = 2
UPDATE Entities_Taxes SET Name = 'Cental Govt. ST 12%', Rate = 0.03708 WHERE TaxID = 3
UPDATE Entities_Taxes SET Name = 'Tax Paid / Free', Rate = 0 WHERE TaxID = 4

@ -0,0 +1,102 @@
BEGIN TRANSACTION
GO
ALTER TABLE dbo.Entities_Products
DROP CONSTRAINT FK66E1235A95976D16
GO
ALTER TABLE dbo.Entities_Products
DROP CONSTRAINT FK66E1235AEB4DC236
GO
CREATE TABLE dbo.Tmp_Entities_Products
(
ProductID int NOT NULL IDENTITY (1, 1),
Code int NULL,
Name nvarchar(100) NOT NULL,
Units nvarchar(20) NOT NULL,
ServiceCharge decimal(19, 5) NOT NULL,
IsScTaxable bit NOT NULL,
Price decimal(19, 5) NOT NULL,
FullPrice decimal(19, 5) NOT NULL,
Discontinued bit NOT NULL,
SortOrder int NULL,
ProductGroupID int NOT NULL,
ServiceTaxID int NOT NULL,
VatID int NOT NULL,
BaseCode int NOT NULL,
Quantity decimal(19, 5) NOT NULL
) ON [PRIMARY]
GO
SET IDENTITY_INSERT dbo.Tmp_Entities_Products ON
GO
IF EXISTS(SELECT * FROM dbo.Entities_Products)
EXEC('INSERT INTO dbo.Tmp_Entities_Products (ProductID, Code, Name, Units, ServiceCharge, IsScTaxable, Price, FullPrice, Discontinued, SortOrder, ProductGroupID, ServiceTaxID, VatID, BaseCode, Quantity)
SELECT ProductID, Code, Name, Units, ServiceCharge, 0, Price, FullPrice, Discontinued, SortOrder, ProductGroupID, CASE WHEN TaxID = 4 THEN 4 ELSE 3 END, TaxID, BaseCode, Quantity FROM dbo.Entities_Products WITH (HOLDLOCK TABLOCKX)')
GO
SET IDENTITY_INSERT dbo.Tmp_Entities_Products OFF
GO
ALTER TABLE dbo.Entities_Inventories
DROP CONSTRAINT FK53E4F7FE3F88CAB6
GO
DROP TABLE dbo.Entities_Products
GO
EXECUTE sp_rename N'dbo.Tmp_Entities_Products', N'Entities_Products', 'OBJECT'
GO
ALTER TABLE dbo.Entities_Products ADD CONSTRAINT
PK__Entities_Product__737017C0 PRIMARY KEY CLUSTERED
(
ProductID
) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
ALTER TABLE dbo.Entities_Products ADD CONSTRAINT
IX_Entities_Products_Name UNIQUE NONCLUSTERED
(
Name,
Units
) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
ALTER TABLE dbo.Entities_Products ADD CONSTRAINT
FK66E1235AEB4DC236 FOREIGN KEY
(
VatID
) REFERENCES dbo.Entities_Taxes
(
TaxID
) ON UPDATE NO ACTION
ON DELETE NO ACTION
GO
ALTER TABLE dbo.Entities_Products ADD CONSTRAINT
FK66E1235A95976D16 FOREIGN KEY
(
ProductGroupID
) REFERENCES dbo.Entities_ProductGroups
(
ProductGroupID
) ON UPDATE NO ACTION
ON DELETE NO ACTION
GO
ALTER TABLE dbo.Entities_Products ADD CONSTRAINT
FK_Entities_Products_Entities_Taxes FOREIGN KEY
(
ServiceTaxID
) REFERENCES dbo.Entities_Taxes
(
TaxID
) ON UPDATE NO ACTION
ON DELETE NO ACTION
GO
ALTER TABLE dbo.Entities_Inventories ADD CONSTRAINT
FK53E4F7FE3F88CAB6 FOREIGN KEY
(
ProductID
) REFERENCES dbo.Entities_Products
(
ProductID
) ON UPDATE NO ACTION
ON DELETE NO ACTION
GO
COMMIT

@ -27,12 +27,27 @@ namespace Tanshu.Accounts.Contracts
}
}
public decimal Tax { get; set; }
public decimal TaxAmount
public bool IsScTaxable { get; set; }
public decimal ServiceTax { get; set; }
public decimal ServiceTaxAmount
{
get
{
return Quantity * Price * (1 - _discount) * (1 + ServiceCharge) * Tax;
if (IsScTaxable)
return Quantity * Price * (1 - Discount) * (1 + ServiceCharge) * ServiceTax;
return Quantity * Price * (1 - Discount) * ServiceTax;
}
}
public decimal Vat { get; set; }
public decimal VatAmount
{
get
{
if (IsScTaxable)
return Quantity * Price * (1 - Discount) * (1 + ServiceCharge) * Vat;
return Quantity * Price * (1 - Discount) * Vat;
}
}
@ -41,7 +56,7 @@ namespace Tanshu.Accounts.Contracts
{
get
{
return Quantity * Price * (1 - _discount) * ServiceCharge;
return Quantity * Price * (1 - Discount) * ServiceCharge;
}
}
@ -49,7 +64,7 @@ namespace Tanshu.Accounts.Contracts
{
get
{
return Quantity * Price * _discount;
return Quantity * Price * Discount;
}
}
@ -57,7 +72,7 @@ namespace Tanshu.Accounts.Contracts
{
get
{
return Quantity * Price * (1 - _discount);
return Quantity * Price * (1 - Discount);
}
}
@ -67,7 +82,9 @@ namespace Tanshu.Accounts.Contracts
{
get
{
return Price * Quantity * (1 - _discount) * (1 + ServiceCharge) * (1 + Tax);
if (IsScTaxable)
return Quantity * Price * (1 - Discount) * (1 + ServiceCharge) * (1 + ServiceTax + Vat);
return Quantity * Price * (1 - Discount) * (1 + ServiceCharge + ServiceTax + Vat);
}
}
@ -107,7 +124,9 @@ namespace Tanshu.Accounts.Contracts
Quantity = 1;
Price = product.Price;
FullPrice = product.FullPrice;
Tax = product.Tax.Rate;
IsScTaxable = product.IsScTaxable;
ServiceTax = product.ServiceTax.Rate;
Vat = product.Vat.Rate;
ServiceCharge = product.ServiceCharge;
Discount = 0;
Printed = false;
@ -123,7 +142,7 @@ namespace Tanshu.Accounts.Contracts
FullPrice = 0;
Printed = true;
Quantity = 0;
Tax = -1;
Vat = -1;
ServiceCharge = 0;
}
@ -137,7 +156,7 @@ namespace Tanshu.Accounts.Contracts
FullPrice = 0;
Printed = true;
Quantity = 0;
Tax = -1;
Vat = -1;
ServiceCharge = 0;
}

@ -23,17 +23,24 @@ namespace Tanshu.Accounts.Entities
public virtual decimal Quantity { get; set; }
public virtual decimal Price { get; set; }
public virtual decimal FullPrice { get; set; }
public virtual decimal Tax { get; set; }
public virtual decimal Discount { get; set; }
public virtual decimal ServiceCharge { get; set; }
public virtual bool IsScTaxable { get; set; }
public virtual decimal ServiceTax { get; set; }
public virtual decimal Vat { get; set; }
public virtual decimal Discount { get; set; }
[Cascade]
public virtual IList<InventoryModifier> InventoryModifier { get; set; }
[Formula(Formula = "Quantity * Price * (1 - Discount) * (1 + ServiceCharge) * (1 + Tax)")]
[Formula(Formula = "CASE WHEN IsScTaxable = 1 THEN Quantity * Price * (1 - Discount) * (1 + ServiceCharge) * (1 + ServiceTax + Vat) ELSE Quantity * Price * (1 - Discount) * (1 + ServiceCharge + ServiceTax + Vat) END")]
public virtual decimal Amount
{
get { return Quantity * Price * (1 + Tax) * (1 + ServiceCharge) * (1 - Discount); }
get
{
if (IsScTaxable)
return Quantity * Price * (1 - Discount) * (1 + ServiceCharge) * (1 + ServiceTax + Vat);
return Quantity * Price * (1 - Discount) * (1 + ServiceCharge + ServiceTax + Vat);
}
private set { }
}
}

@ -12,8 +12,10 @@ namespace Tanshu.Accounts.Entities
[NotNull]
public virtual ProductGroup ProductGroup { get; set; }
[NotNull]
public virtual Tax Tax { get; set; }
public virtual Tax Vat { get; set; }
public virtual Tax ServiceTax { get; set; }
public virtual decimal ServiceCharge { get; set; }
public virtual bool IsScTaxable { get; set; }
public virtual decimal Price { get; set; }
public virtual decimal FullPrice { get; set; }
public virtual bool Discontinued { get; set; }

@ -280,7 +280,7 @@ namespace Tanshu.Accounts.PointOfSale
private void ShowAmount()
{
var taxAmount = _bill.Values.Sum(b => b.TaxAmount);
var taxAmount = _bill.Values.Sum(b => b.ServiceTaxAmount + b.VatAmount);
var discountAmount = _bill.Values.Sum(b => b.DiscountAmount);
var grossAmount = _bill.Values.Sum(b => b.GrossAmount);
var valueAmount = _bill.Values.Sum(b => b.Value);
@ -394,7 +394,9 @@ namespace Tanshu.Accounts.PointOfSale
Price = inv.Price,
Printed = true,
Quantity = inv.Quantity,
Tax = inv.Tax,
IsScTaxable = inv.IsScTaxable,
ServiceTax = inv.ServiceTax,
Vat = inv.Vat,
ServiceCharge = inv.ServiceCharge,
};
foreach (var mod in inv.InventoryModifier)
@ -976,7 +978,9 @@ namespace Tanshu.Accounts.PointOfSale
FullPrice = item.Value.FullPrice,
Discount = item.Value.Discount,
ServiceCharge = item.Value.ServiceCharge,
Tax = item.Value.Tax
IsScTaxable = item.Value.IsScTaxable,
ServiceTax = item.Value.ServiceTax,
Vat = item.Value.Vat
};
foreach (var mod in item.Value.Modifiers)
inv.InventoryModifier.Add(new InventoryModifier { Modifier = mod });

@ -144,6 +144,9 @@ namespace Tanshu.Accounts.PointOfSale
private void MainForm_Load(object sender, EventArgs e)
{
#if (DEBUG)
MessageBox.Show("This software does not print kots!!!","Debug Mode", MessageBoxButtons.OK , MessageBoxIcon.Exclamation);
#endif
CheckRoles();
}

@ -32,7 +32,7 @@
this.Label4 = new System.Windows.Forms.Label();
this.bsProductGroups = new System.Windows.Forms.BindingSource(this.components);
this.Label7 = new System.Windows.Forms.Label();
this.bsTax = new System.Windows.Forms.BindingSource(this.components);
this.bsServiceTax = new System.Windows.Forms.BindingSource(this.components);
this.label5 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.txtProductID = new System.Windows.Forms.TextBox();
@ -41,7 +41,7 @@
this.txtUnits = new System.Windows.Forms.TextBox();
this.txtName = new System.Windows.Forms.TextBox();
this.txtPrice = new System.Windows.Forms.TextBox();
this.cmbTax = new System.Windows.Forms.ComboBox();
this.cmbVat = new System.Windows.Forms.ComboBox();
this.chkDiscontinued = new System.Windows.Forms.CheckBox();
this.txtServiceCharge = new System.Windows.Forms.TextBox();
this.btnAddProductGroup = new System.Windows.Forms.Button();
@ -51,18 +51,24 @@
this.label1 = new System.Windows.Forms.Label();
this.txtSortOrder = new System.Windows.Forms.TextBox();
this.txtFullPrice = new System.Windows.Forms.TextBox();
this.cmbServiceTax = new System.Windows.Forms.ComboBox();
this.label6 = new System.Windows.Forms.Label();
this.chkIsScTaxable = new System.Windows.Forms.CheckBox();
this.bsVat = new System.Windows.Forms.BindingSource(this.components);
((System.ComponentModel.ISupportInitialize)(this.bsProductGroups)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.bsTax)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.bsServiceTax)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.bsVat)).BeginInit();
this.SuspendLayout();
//
// Label4
//
this.Label4.AutoSize = true;
this.Label4.Location = new System.Drawing.Point(12, 68);
this.Label4.Location = new System.Drawing.Point(25, 82);
this.Label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.Label4.Name = "Label4";
this.Label4.Size = new System.Drawing.Size(114, 13);
this.Label4.Size = new System.Drawing.Size(110, 17);
this.Label4.TabIndex = 15;
this.Label4.Text = "Price / Full Price / Tax";
this.Label4.Text = "Price / Full Price";
//
// bsProductGroups
//
@ -71,102 +77,113 @@
// Label7
//
this.Label7.AutoSize = true;
this.Label7.Location = new System.Drawing.Point(70, 119);
this.Label7.Location = new System.Drawing.Point(93, 174);
this.Label7.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.Label7.Name = "Label7";
this.Label7.Size = new System.Drawing.Size(36, 13);
this.Label7.Size = new System.Drawing.Size(48, 17);
this.Label7.TabIndex = 17;
this.Label7.Text = "Group";
//
// bsTax
// bsServiceTax
//
this.bsTax.DataSource = typeof(Tanshu.Accounts.Entities.Tax);
this.bsServiceTax.DataSource = typeof(Tanshu.Accounts.Entities.Tax);
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(26, 93);
this.label5.Location = new System.Drawing.Point(35, 142);
this.label5.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(80, 13);
this.label5.Size = new System.Drawing.Size(105, 17);
this.label5.TabIndex = 16;
this.label5.Text = "Service Charge";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(12, 15);
this.label3.Location = new System.Drawing.Point(16, 18);
this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(94, 13);
this.label3.Size = new System.Drawing.Size(119, 17);
this.label3.TabIndex = 13;
this.label3.Text = "Product ID / Code";
//
// txtProductID
//
this.txtProductID.Location = new System.Drawing.Point(112, 12);
this.txtProductID.Location = new System.Drawing.Point(149, 15);
this.txtProductID.Margin = new System.Windows.Forms.Padding(4);
this.txtProductID.Name = "txtProductID";
this.txtProductID.ReadOnly = true;
this.txtProductID.Size = new System.Drawing.Size(189, 20);
this.txtProductID.Size = new System.Drawing.Size(251, 22);
this.txtProductID.TabIndex = 12;
//
// txtCode
//
this.txtCode.AccessibleName = "";
this.txtCode.Location = new System.Drawing.Point(307, 12);
this.txtCode.Location = new System.Drawing.Point(409, 15);
this.txtCode.Margin = new System.Windows.Forms.Padding(4);
this.txtCode.Name = "txtCode";
this.txtCode.Size = new System.Drawing.Size(96, 20);
this.txtCode.Size = new System.Drawing.Size(127, 22);
this.txtCode.TabIndex = 0;
this.txtCode.WordWrap = false;
//
// Label2
//
this.Label2.AutoSize = true;
this.Label2.Location = new System.Drawing.Point(36, 41);
this.Label2.Location = new System.Drawing.Point(48, 50);
this.Label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.Label2.Name = "Label2";
this.Label2.Size = new System.Drawing.Size(70, 13);
this.Label2.Size = new System.Drawing.Size(89, 17);
this.Label2.TabIndex = 14;
this.Label2.Text = "Name / Units";
//
// txtUnits
//
this.txtUnits.AccessibleName = "";
this.txtUnits.Location = new System.Drawing.Point(307, 38);
this.txtUnits.Location = new System.Drawing.Point(409, 47);
this.txtUnits.Margin = new System.Windows.Forms.Padding(4);
this.txtUnits.Name = "txtUnits";
this.txtUnits.Size = new System.Drawing.Size(96, 20);
this.txtUnits.Size = new System.Drawing.Size(127, 22);
this.txtUnits.TabIndex = 2;
//
// txtName
//
this.txtName.AccessibleName = "";
this.txtName.Location = new System.Drawing.Point(112, 38);
this.txtName.Location = new System.Drawing.Point(149, 47);
this.txtName.Margin = new System.Windows.Forms.Padding(4);
this.txtName.Name = "txtName";
this.txtName.Size = new System.Drawing.Size(189, 20);
this.txtName.Size = new System.Drawing.Size(251, 22);
this.txtName.TabIndex = 1;
//
// txtPrice
//
this.txtPrice.AccessibleName = "";
this.txtPrice.Location = new System.Drawing.Point(132, 64);
this.txtPrice.Location = new System.Drawing.Point(149, 79);
this.txtPrice.Margin = new System.Windows.Forms.Padding(4);
this.txtPrice.Name = "txtPrice";
this.txtPrice.Size = new System.Drawing.Size(84, 20);
this.txtPrice.Size = new System.Drawing.Size(111, 22);
this.txtPrice.TabIndex = 3;
this.txtPrice.Text = "0";
//
// cmbTax
// cmbVat
//
this.cmbTax.DataSource = this.bsTax;
this.cmbTax.DisplayMember = "Name";
this.cmbTax.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbTax.Location = new System.Drawing.Point(307, 65);
this.cmbTax.Name = "cmbTax";
this.cmbTax.Size = new System.Drawing.Size(96, 21);
this.cmbTax.TabIndex = 4;
this.cmbTax.ValueMember = "TaxID";
this.cmbVat.DataSource = this.bsVat;
this.cmbVat.DisplayMember = "Name";
this.cmbVat.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbVat.Location = new System.Drawing.Point(284, 107);
this.cmbVat.Margin = new System.Windows.Forms.Padding(4);
this.cmbVat.Name = "cmbVat";
this.cmbVat.Size = new System.Drawing.Size(116, 24);
this.cmbVat.TabIndex = 4;
this.cmbVat.ValueMember = "TaxID";
//
// chkDiscontinued
//
this.chkDiscontinued.AutoSize = true;
this.chkDiscontinued.Location = new System.Drawing.Point(307, 92);
this.chkDiscontinued.Location = new System.Drawing.Point(409, 141);
this.chkDiscontinued.Margin = new System.Windows.Forms.Padding(4);
this.chkDiscontinued.Name = "chkDiscontinued";
this.chkDiscontinued.Size = new System.Drawing.Size(88, 17);
this.chkDiscontinued.Size = new System.Drawing.Size(112, 21);
this.chkDiscontinued.TabIndex = 7;
this.chkDiscontinued.Text = "Discontinued";
this.chkDiscontinued.UseVisualStyleBackColor = true;
@ -174,17 +191,19 @@
// txtServiceCharge
//
this.txtServiceCharge.AccessibleName = "Phone 1";
this.txtServiceCharge.Location = new System.Drawing.Point(112, 90);
this.txtServiceCharge.Location = new System.Drawing.Point(149, 139);
this.txtServiceCharge.Margin = new System.Windows.Forms.Padding(4);
this.txtServiceCharge.Name = "txtServiceCharge";
this.txtServiceCharge.Size = new System.Drawing.Size(73, 20);
this.txtServiceCharge.Size = new System.Drawing.Size(96, 22);
this.txtServiceCharge.TabIndex = 5;
this.txtServiceCharge.Text = "0";
//
// btnAddProductGroup
//
this.btnAddProductGroup.Location = new System.Drawing.Point(307, 116);
this.btnAddProductGroup.Location = new System.Drawing.Point(409, 171);
this.btnAddProductGroup.Margin = new System.Windows.Forms.Padding(4);
this.btnAddProductGroup.Name = "btnAddProductGroup";
this.btnAddProductGroup.Size = new System.Drawing.Size(96, 21);
this.btnAddProductGroup.Size = new System.Drawing.Size(128, 26);
this.btnAddProductGroup.TabIndex = 9;
this.btnAddProductGroup.Text = "Add Group";
//
@ -195,17 +214,19 @@
this.cmbProductGroup.DataSource = this.bsProductGroups;
this.cmbProductGroup.DisplayMember = "Name";
this.cmbProductGroup.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbProductGroup.Location = new System.Drawing.Point(112, 116);
this.cmbProductGroup.Location = new System.Drawing.Point(149, 171);
this.cmbProductGroup.Margin = new System.Windows.Forms.Padding(4);
this.cmbProductGroup.Name = "cmbProductGroup";
this.cmbProductGroup.Size = new System.Drawing.Size(189, 21);
this.cmbProductGroup.Size = new System.Drawing.Size(251, 24);
this.cmbProductGroup.TabIndex = 8;
this.cmbProductGroup.ValueMember = "ProductGroupID";
//
// btnCancel
//
this.btnCancel.Location = new System.Drawing.Point(328, 143);
this.btnCancel.Location = new System.Drawing.Point(437, 204);
this.btnCancel.Margin = new System.Windows.Forms.Padding(4);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(75, 75);
this.btnCancel.Size = new System.Drawing.Size(100, 92);
this.btnCancel.TabIndex = 11;
this.btnCancel.Text = "&Cancel";
this.btnCancel.UseVisualStyleBackColor = true;
@ -213,9 +234,10 @@
//
// btnOk
//
this.btnOk.Location = new System.Drawing.Point(247, 143);
this.btnOk.Location = new System.Drawing.Point(329, 204);
this.btnOk.Margin = new System.Windows.Forms.Padding(4);
this.btnOk.Name = "btnOk";
this.btnOk.Size = new System.Drawing.Size(75, 75);
this.btnOk.Size = new System.Drawing.Size(100, 92);
this.btnOk.TabIndex = 10;
this.btnOk.Text = "&Ok";
this.btnOk.UseVisualStyleBackColor = true;
@ -224,35 +246,78 @@
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(196, 93);
this.label1.Location = new System.Drawing.Point(261, 142);
this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(26, 13);
this.label1.Size = new System.Drawing.Size(34, 17);
this.label1.TabIndex = 18;
this.label1.Text = "Sort";
//
// txtSortOrder
//
this.txtSortOrder.AccessibleName = "";
this.txtSortOrder.Location = new System.Drawing.Point(228, 90);
this.txtSortOrder.Location = new System.Drawing.Point(304, 139);
this.txtSortOrder.Margin = new System.Windows.Forms.Padding(4);
this.txtSortOrder.Name = "txtSortOrder";
this.txtSortOrder.Size = new System.Drawing.Size(73, 20);
this.txtSortOrder.Size = new System.Drawing.Size(96, 22);
this.txtSortOrder.TabIndex = 6;
this.txtSortOrder.Text = "0";
//
// txtFullPrice
//
this.txtFullPrice.AccessibleName = "";
this.txtFullPrice.Location = new System.Drawing.Point(222, 64);
this.txtFullPrice.Location = new System.Drawing.Point(268, 79);
this.txtFullPrice.Margin = new System.Windows.Forms.Padding(4);
this.txtFullPrice.Name = "txtFullPrice";
this.txtFullPrice.Size = new System.Drawing.Size(79, 20);
this.txtFullPrice.Size = new System.Drawing.Size(104, 22);
this.txtFullPrice.TabIndex = 19;
this.txtFullPrice.Text = "0";
//
// cmbServiceTax
//
this.cmbServiceTax.DataSource = this.bsServiceTax;
this.cmbServiceTax.DisplayMember = "Name";
this.cmbServiceTax.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbServiceTax.Location = new System.Drawing.Point(149, 107);
this.cmbServiceTax.Margin = new System.Windows.Forms.Padding(4);
this.cmbServiceTax.Name = "cmbServiceTax";
this.cmbServiceTax.Size = new System.Drawing.Size(127, 24);
this.cmbServiceTax.TabIndex = 20;
this.cmbServiceTax.ValueMember = "TaxID";
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(25, 110);
this.label6.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(115, 17);
this.label6.TabIndex = 21;
this.label6.Text = "Service Tax / Vat";
//
// chkIsScTaxable
//
this.chkIsScTaxable.AutoSize = true;
this.chkIsScTaxable.Location = new System.Drawing.Point(409, 109);
this.chkIsScTaxable.Margin = new System.Windows.Forms.Padding(4);
this.chkIsScTaxable.Name = "chkIsScTaxable";
this.chkIsScTaxable.Size = new System.Drawing.Size(114, 21);
this.chkIsScTaxable.TabIndex = 22;
this.chkIsScTaxable.Text = "Is Sc Taxable";
this.chkIsScTaxable.UseVisualStyleBackColor = true;
//
// bsVat
//
this.bsVat.DataSource = typeof(Tanshu.Accounts.Entities.Tax);
//
// ProductForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(415, 230);
this.ClientSize = new System.Drawing.Size(553, 340);
this.Controls.Add(this.chkIsScTaxable);
this.Controls.Add(this.label6);
this.Controls.Add(this.cmbServiceTax);
this.Controls.Add(this.txtFullPrice);
this.Controls.Add(this.txtSortOrder);
this.Controls.Add(this.label1);
@ -265,7 +330,7 @@
this.Controls.Add(this.Label7);
this.Controls.Add(this.txtPrice);
this.Controls.Add(this.label5);
this.Controls.Add(this.cmbTax);
this.Controls.Add(this.cmbVat);
this.Controls.Add(this.txtUnits);
this.Controls.Add(this.txtName);
this.Controls.Add(this.Label2);
@ -273,6 +338,7 @@
this.Controls.Add(this.txtProductID);
this.Controls.Add(this.label3);
this.Controls.Add(this.Label4);
this.Margin = new System.Windows.Forms.Padding(4);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "ProductForm";
@ -280,7 +346,8 @@
this.Text = "Products";
this.Load += new System.EventHandler(this.Products_Load);
((System.ComponentModel.ISupportInitialize)(this.bsProductGroups)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.bsTax)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.bsServiceTax)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.bsVat)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@ -291,7 +358,7 @@
internal System.Windows.Forms.Label Label4;
internal System.Windows.Forms.Label Label7;
private System.Windows.Forms.BindingSource bsProductGroups;
private System.Windows.Forms.BindingSource bsTax;
private System.Windows.Forms.BindingSource bsServiceTax;
internal System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox txtProductID;
@ -300,7 +367,7 @@
internal System.Windows.Forms.TextBox txtUnits;
internal System.Windows.Forms.TextBox txtName;
internal System.Windows.Forms.TextBox txtPrice;
internal System.Windows.Forms.ComboBox cmbTax;
internal System.Windows.Forms.ComboBox cmbVat;
private System.Windows.Forms.CheckBox chkDiscontinued;
internal System.Windows.Forms.TextBox txtServiceCharge;
internal System.Windows.Forms.Button btnAddProductGroup;
@ -310,5 +377,9 @@
internal System.Windows.Forms.Label label1;
internal System.Windows.Forms.TextBox txtSortOrder;
internal System.Windows.Forms.TextBox txtFullPrice;
internal System.Windows.Forms.ComboBox cmbServiceTax;
internal System.Windows.Forms.Label label6;
private System.Windows.Forms.CheckBox chkIsScTaxable;
private System.Windows.Forms.BindingSource bsVat;
}
}

@ -28,9 +28,11 @@ namespace Tanshu.Accounts.PointOfSale
txtUnits.Text = product.Units;
txtPrice.Text = product.Price.ToString("#.##");
txtFullPrice.Text = product.FullPrice.ToString("#.##");
cmbTax.SelectedValue = product.Tax.TaxID;
cmbVat.SelectedValue = product.Vat.TaxID;
cmbServiceTax.SelectedValue = product.ServiceTax.TaxID;
txtServiceCharge.Text = product.ServiceCharge.ToString("#.##");
chkDiscontinued.Checked = product.Discontinued;
chkIsScTaxable.Checked = product.IsScTaxable;
cmbProductGroup.SelectedValue = product.ProductGroup.ProductGroupID;
txtSortOrder.Text = product.SortOrder.ToString();
}
@ -46,7 +48,10 @@ namespace Tanshu.Accounts.PointOfSale
using (var bi = new ProductGroupBI())
bsProductGroups.DataSource = bi.List();
using (var bi = new TaxBI())
bsTax.DataSource = bi.List();
{
bsServiceTax.DataSource = bi.List();
bsVat.DataSource = bi.List();
}
}
private void btnAddCategory_Click(object sender, EventArgs e)
@ -92,9 +97,13 @@ namespace Tanshu.Accounts.PointOfSale
product.FullPrice = price;
// Tax
if (cmbTax.SelectedItem == null)
if (cmbVat.SelectedItem == null)
return null;
product.Tax = (Tax)cmbTax.SelectedItem;
product.Vat = (Tax)cmbVat.SelectedItem;
if (cmbServiceTax.SelectedItem == null)
return null;
product.ServiceTax = (Tax)cmbServiceTax.SelectedItem;
decimal serviceCharge;
if (!decimal.TryParse(txtServiceCharge.Text, out serviceCharge))
@ -103,6 +112,7 @@ namespace Tanshu.Accounts.PointOfSale
return null;
product.ServiceCharge = serviceCharge;
product.IsScTaxable = chkIsScTaxable.Checked;
product.Discontinued = chkDiscontinued.Checked;
int sortOrder;
if (!int.TryParse(txtSortOrder.Text, out sortOrder))

@ -120,8 +120,11 @@
<metadata name="bsProductGroups.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>211, 17</value>
</metadata>
<metadata name="bsTax.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>129, 17</value>
<metadata name="bsServiceTax.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>56, 25</value>
</metadata>
<metadata name="bsVat.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>382, 17</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>102</value>

@ -38,7 +38,7 @@
this.bsList = new System.Windows.Forms.BindingSource(this.components);
this.nameDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.unitsDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Tax = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Vat = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Group = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.serviceChargeDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.salePriceDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
@ -51,9 +51,10 @@
// btnAdd
//
this.btnAdd.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnAdd.Location = new System.Drawing.Point(12, 255);
this.btnAdd.Location = new System.Drawing.Point(16, 314);
this.btnAdd.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.btnAdd.Name = "btnAdd";
this.btnAdd.Size = new System.Drawing.Size(75, 75);
this.btnAdd.Size = new System.Drawing.Size(100, 92);
this.btnAdd.TabIndex = 68;
this.btnAdd.Text = "&Add";
this.btnAdd.Click += new System.EventHandler(this.btnAdd_Click);
@ -62,9 +63,10 @@
//
this.btnEdit.AccessibleName = "Done";
this.btnEdit.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnEdit.Location = new System.Drawing.Point(93, 255);
this.btnEdit.Location = new System.Drawing.Point(124, 314);
this.btnEdit.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.btnEdit.Name = "btnEdit";
this.btnEdit.Size = new System.Drawing.Size(75, 75);
this.btnEdit.Size = new System.Drawing.Size(100, 92);
this.btnEdit.TabIndex = 62;
this.btnEdit.Text = "&Edit";
this.btnEdit.Click += new System.EventHandler(this.btnEdit_Click);
@ -73,9 +75,10 @@
//
this.btnExit.AccessibleName = "Done";
this.btnExit.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnExit.Location = new System.Drawing.Point(286, 255);
this.btnExit.Location = new System.Drawing.Point(381, 314);
this.btnExit.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.btnExit.Name = "btnExit";
this.btnExit.Size = new System.Drawing.Size(75, 75);
this.btnExit.Size = new System.Drawing.Size(100, 92);
this.btnExit.TabIndex = 61;
this.btnExit.Text = "E&xit";
this.btnExit.Click += new System.EventHandler(this.btnExit_Click);
@ -94,7 +97,7 @@
this.dgvProductTypes.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.nameDataGridViewTextBoxColumn,
this.unitsDataGridViewTextBoxColumn,
this.Tax,
this.Vat,
this.Group,
this.serviceChargeDataGridViewTextBoxColumn,
this.salePriceDataGridViewTextBoxColumn,
@ -102,14 +105,16 @@
this.sortOrderDataGridViewTextBoxColumn});
this.dgvProductTypes.DataSource = this.bsList;
this.dgvProductTypes.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically;
this.dgvProductTypes.Location = new System.Drawing.Point(12, 12);
this.dgvProductTypes.Location = new System.Drawing.Point(16, 15);
this.dgvProductTypes.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.dgvProductTypes.MultiSelect = false;
this.dgvProductTypes.Name = "dgvProductTypes";
this.dgvProductTypes.ReadOnly = true;
this.dgvProductTypes.RowHeadersVisible = false;
this.dgvProductTypes.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing;
this.dgvProductTypes.RowTemplate.Height = 24;
this.dgvProductTypes.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.dgvProductTypes.Size = new System.Drawing.Size(349, 237);
this.dgvProductTypes.Size = new System.Drawing.Size(465, 292);
this.dgvProductTypes.TabIndex = 74;
this.dgvProductTypes.CellFormatting += new System.Windows.Forms.DataGridViewCellFormattingEventHandler(this.dgvProductTypes_CellFormatting);
//
@ -123,7 +128,7 @@
this.nameDataGridViewTextBoxColumn.HeaderText = "Name";
this.nameDataGridViewTextBoxColumn.Name = "nameDataGridViewTextBoxColumn";
this.nameDataGridViewTextBoxColumn.ReadOnly = true;
this.nameDataGridViewTextBoxColumn.Width = 60;
this.nameDataGridViewTextBoxColumn.Width = 70;
//
// unitsDataGridViewTextBoxColumn
//
@ -131,15 +136,15 @@
this.unitsDataGridViewTextBoxColumn.HeaderText = "Units";
this.unitsDataGridViewTextBoxColumn.Name = "unitsDataGridViewTextBoxColumn";
this.unitsDataGridViewTextBoxColumn.ReadOnly = true;
this.unitsDataGridViewTextBoxColumn.Width = 56;
this.unitsDataGridViewTextBoxColumn.Width = 65;
//
// Tax
// Vat
//
this.Tax.DataPropertyName = "Tax";
this.Tax.HeaderText = "Tax";
this.Tax.Name = "Tax";
this.Tax.ReadOnly = true;
this.Tax.Width = 50;
this.Vat.DataPropertyName = "Vat";
this.Vat.HeaderText = "Vat";
this.Vat.Name = "Vat";
this.Vat.ReadOnly = true;
this.Vat.Width = 54;
//
// Group
//
@ -147,7 +152,7 @@
this.Group.HeaderText = "ProductGroup";
this.Group.Name = "Group";
this.Group.ReadOnly = true;
this.Group.Width = 98;
this.Group.Width = 122;
//
// serviceChargeDataGridViewTextBoxColumn
//
@ -157,7 +162,7 @@
this.serviceChargeDataGridViewTextBoxColumn.HeaderText = "SC";
this.serviceChargeDataGridViewTextBoxColumn.Name = "serviceChargeDataGridViewTextBoxColumn";
this.serviceChargeDataGridViewTextBoxColumn.ReadOnly = true;
this.serviceChargeDataGridViewTextBoxColumn.Width = 46;
this.serviceChargeDataGridViewTextBoxColumn.Width = 51;
//
// salePriceDataGridViewTextBoxColumn
//
@ -167,7 +172,7 @@
this.salePriceDataGridViewTextBoxColumn.HeaderText = "Price";
this.salePriceDataGridViewTextBoxColumn.Name = "salePriceDataGridViewTextBoxColumn";
this.salePriceDataGridViewTextBoxColumn.ReadOnly = true;
this.salePriceDataGridViewTextBoxColumn.Width = 77;
this.salePriceDataGridViewTextBoxColumn.Width = 65;
//
// discontinuedDataGridViewCheckBoxColumn
//
@ -175,7 +180,7 @@
this.discontinuedDataGridViewCheckBoxColumn.HeaderText = "Discontinued";
this.discontinuedDataGridViewCheckBoxColumn.Name = "discontinuedDataGridViewCheckBoxColumn";
this.discontinuedDataGridViewCheckBoxColumn.ReadOnly = true;
this.discontinuedDataGridViewCheckBoxColumn.Width = 75;
this.discontinuedDataGridViewCheckBoxColumn.Width = 96;
//
// sortOrderDataGridViewTextBoxColumn
//
@ -183,17 +188,18 @@
this.sortOrderDataGridViewTextBoxColumn.HeaderText = "SortOrder";
this.sortOrderDataGridViewTextBoxColumn.Name = "sortOrderDataGridViewTextBoxColumn";
this.sortOrderDataGridViewTextBoxColumn.ReadOnly = true;
this.sortOrderDataGridViewTextBoxColumn.Width = 77;
this.sortOrderDataGridViewTextBoxColumn.Width = 96;
//
// ProductListForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(373, 342);
this.ClientSize = new System.Drawing.Size(497, 421);
this.Controls.Add(this.dgvProductTypes);
this.Controls.Add(this.btnAdd);
this.Controls.Add(this.btnEdit);
this.Controls.Add(this.btnExit);
this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "ProductListForm";
@ -213,17 +219,17 @@
internal System.Windows.Forms.Button btnExit;
private System.Windows.Forms.DataGridView dgvProductTypes;
private System.Windows.Forms.BindingSource bsList;
//private System.Windows.Forms.DataGridViewTextBoxColumn discountLimitDataGridViewTextBoxColumn;
//private System.Windows.Forms.DataGridViewTextBoxColumn groupTypeDataGridViewTextBoxColumn;
//private System.Windows.Forms.DataGridViewTextBoxColumn productGroupDataGridViewTextBoxColumn;
//private System.Windows.Forms.DataGridViewTextBoxColumn taxDataGridViewTextBoxColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn nameDataGridViewTextBoxColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn unitsDataGridViewTextBoxColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn Tax;
private System.Windows.Forms.DataGridViewTextBoxColumn Vat;
private System.Windows.Forms.DataGridViewTextBoxColumn Group;
private System.Windows.Forms.DataGridViewTextBoxColumn serviceChargeDataGridViewTextBoxColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn salePriceDataGridViewTextBoxColumn;
private System.Windows.Forms.DataGridViewCheckBoxColumn discontinuedDataGridViewCheckBoxColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn sortOrderDataGridViewTextBoxColumn;
//private System.Windows.Forms.DataGridViewTextBoxColumn discountLimitDataGridViewTextBoxColumn;
//private System.Windows.Forms.DataGridViewTextBoxColumn groupTypeDataGridViewTextBoxColumn;
//private System.Windows.Forms.DataGridViewTextBoxColumn productGroupDataGridViewTextBoxColumn;
//private System.Windows.Forms.DataGridViewTextBoxColumn taxDataGridViewTextBoxColumn;
}
}

@ -46,7 +46,7 @@ namespace Tanshu.Accounts.PointOfSale
return;
if (e.Value.ToString() == "Castle.Proxies.TaxProxy")
{
e.Value = ((Product)bsList[e.RowIndex]).Tax.Name;
e.Value = ((Product)bsList[e.RowIndex]).Vat.Name;
}
else if (e.Value.ToString() == "Castle.Proxies.ProductGroupProxy")
{

@ -117,7 +117,7 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="Tax.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="Vat.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Group.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">

@ -203,7 +203,7 @@ namespace Tanshu.Accounts.PointOfSale.Sales
var dgv = sender as DataGridView;
var data = dgv.Rows[e.RowIndex].DataBoundItem as BillItemValue;
if (data.Tax == -1)
if (data.Vat == -1)
{
e.CellStyle.SelectionBackColor = Color.Blue;
e.CellStyle.BackColor = Color.LightBlue;

@ -58,12 +58,17 @@ namespace Tanshu.Accounts.Print
private static decimal Amount(IEnumerable<Inventory> list)
{
return list.Sum(item => item.Quantity * item.Price * (1 - item.Discount) * (1 + item.ServiceCharge) * (1 + item.Tax));
return list.Sum(item => item.Amount);
}
private static decimal Tax(IEnumerable<Inventory> list)
private static decimal ServiceTax(IEnumerable<Inventory> list)
{
return list.Sum(item => item.Quantity * item.Price * (1 - item.Discount) * (1 + item.ServiceCharge) * item.Tax);
return list.Sum(item => item.Quantity * item.Price * (1 - item.Discount) * (1 + (item.IsScTaxable ? item.ServiceCharge : 0)) * item.ServiceTax);
}
private static decimal SplitTax(IEnumerable<Inventory> list, decimal rate)
{
return list.Where(x => x.Vat == rate).Sum(item => item.Quantity * item.Price * (1 - item.Discount) * (1 + (item.IsScTaxable ? item.ServiceCharge : 0)) * item.Vat);
}
private static decimal ServiceCharge(IEnumerable<Inventory> list)
@ -323,8 +328,7 @@ namespace Tanshu.Accounts.Print
printText += DrawLine;
foreach (var item in list)
{
printText += string.Format("\n\r{0,-22} {1,9:#,##0.00} {2,9:#,##0.00}", item.Product, item.Sale,
item.NC);
printText += string.Format("\n\r{0,-22} {1,9:#,##0.00} {2,9:#,##0.00} {3,9:#,##0.00}", item.Product, item.Sale, item.NC, item.Staff);
}
printText += DrawEqual;
return PrintRaw(PrintLocationBI.BasePrinter, printText, "Sale Detail " + user);

@ -33,32 +33,21 @@ namespace Tanshu.Accounts.Print
billText += "\n\r" + FormatText("Service Charge : ", 33, Align.Right) + FormatBillNum(amount, 9);
// Begin Service Tax and VAT Hack
decimal st = 0;
amount = list.Values.Where(x => x.Tax == 0.14741M).Sum(item => item.Quantity * item.Price * (1 - item.Discount) * (1 + item.ServiceCharge) * item.Tax);
st = amount * 0.190564292M;
amount = amount * (1 - 0.190564292M);
amount = SplitTax(list.Values, .13125M);
if (amount != 0)
billText += "\n\r" + FormatText("VAT on Food : ", 33, Align.Right) +
FormatBillNum(amount, 9);
amount = list.Values.Where(x => x.Tax == 0.26673M).Sum(item => item.Quantity * item.Price * (1 - item.Discount) * (1 + item.ServiceCharge) * item.Tax);
st += amount * 0.105316973M;
amount = amount * (1 - 0.105316973M);
amount = SplitTax(list.Values, .1575M);
if (amount != 0)
billText += "\n\r" + FormatText("VAT on Liqour : ", 33, Align.Right) +
FormatBillNum(amount, 9);
if (st != 0)
amount = ServiceTax(list.Values);
if (amount != 0)
billText += "\n\r" + FormatText("Cental Govt. ST : ", 33, Align.Right) +
FormatBillNum(st, 9);
//// Original
//amount = Tax(list.Values);
//if (amount != 0)
// billText += "\n\r" + FormatText("VAT (incl. surcharge) : ", 33, Align.Right) +
// FormatBillNum(amount, 9);
// End Service Tax and VAT Hack
FormatBillNum(amount, 9);
amount = Amount(list.Values);
if (amount != 0)

@ -40,7 +40,8 @@ namespace Tanshu.Accounts.Repository
foreach (var item in list)
{
NHibernateUtil.Initialize(item.ProductGroup);
NHibernateUtil.Initialize(item.Tax);
NHibernateUtil.Initialize(item.ServiceTax);
NHibernateUtil.Initialize(item.Vat);
}
return list;
}
@ -55,7 +56,8 @@ namespace Tanshu.Accounts.Repository
foreach (var item in list)
{
NHibernateUtil.Initialize(item.ProductGroup);
NHibernateUtil.Initialize(item.Tax);
NHibernateUtil.Initialize(item.ServiceTax);
NHibernateUtil.Initialize(item.Vat);
}
return list;
}

@ -321,16 +321,38 @@ and vs.Settled != :noCharge and vs.Settled != :unsettled and vs.Settled != :amou
.UniqueResult() ?? 0M;
outList.Add(new SalesAnalysis() { GroupType = "Service Charge", Amount = (decimal)amt });
#endregion
#region Tax
#region Service Tax
query = @"
select i.Tax, Sum(i.Quantity * i.Price * (1 - i.Discount) * (1 + i.ServiceCharge) * i.Tax)
select Sum(i.Quantity * i.Price * (1 - i.Discount) * (1 + case when i.IsScTaxable then i.ServiceCharge else 0 end) * i.ServiceTax)
from Voucher v
inner join v.Kots k
inner join k.Inventories i
where v.Date >= :startDate and v.Date <= :finishDate and v.Void = false
and exists (select Voucher from VoucherSettlement vs where vs.Voucher = v
and vs.Settled != :noCharge and vs.Settled != :unsettled and vs.Settled != :amount and vs.Settled != :roundoff and vs.Settled != :staff)
group by i.Tax
";
amt = session
.CreateQuery(query)
.SetParameter("startDate", startDate)
.SetParameter("finishDate", finishDate)
.SetParameter("noCharge", SettleOption.NoCharge)
.SetParameter("unsettled", SettleOption.Unsettled)
.SetParameter("amount", SettleOption.Amount)
.SetParameter("roundoff", SettleOption.RoundOff)
.SetParameter("staff", SettleOption.Staff)
.UniqueResult() ?? 0M;
outList.Add(new SalesAnalysis() { GroupType = "Service Tax", Amount = (decimal)amt });
#endregion
#region Vat
query = @"
select i.Vat, Sum(i.Quantity * i.Price * (1 - i.Discount) * (1 + case when i.IsScTaxable then i.ServiceCharge else 0 end) * i.Vat)
from Voucher v
inner join v.Kots k
inner join k.Inventories i
where v.Date >= :startDate and v.Date <= :finishDate and v.Void = false
and exists (select Voucher from VoucherSettlement vs where vs.Voucher = v
and vs.Settled != :noCharge and vs.Settled != :unsettled and vs.Settled != :amount and vs.Settled != :roundoff and vs.Settled != :staff)
group by i.Vat
";
var list = session
.CreateQuery(query)

@ -162,18 +162,23 @@ namespace Tanshu.Accounts.Repository
foreach (var item in voucher.Kots.SelectMany(kot => kot.Inventories))
{
item.ServiceCharge = 0;
item.Tax = 0;
item.ServiceTax = 0;
item.Vat = 0;
}
break;
case VoucherType.TakeAway:
foreach (var item in voucher.Kots.SelectMany(kot => kot.Inventories))
{
item.ServiceCharge = 0;
item.ServiceTax = 0;
}
break;
case VoucherType.Staff:
foreach (var item in voucher.Kots.SelectMany(kot => kot.Inventories))
{
item.ServiceCharge = 0;
item.Tax = 0;
item.ServiceTax = 0;
item.Vat = 0;
}
break;
}