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

View File

@ -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;
}

View File

@ -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 { }
}
}

View File

@ -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; }