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:
@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user