Fix: Tax Analysis Report and Management Get VAT Sale now show the same sales.

It also finally makes it work properly.
This commit is contained in:
tanshu 2016-05-14 19:28:18 +05:30
parent 5f0f80ed1e
commit 09a8b546cf
2 changed files with 9 additions and 11 deletions

View File

@ -736,10 +736,12 @@ and v.VoucherType = :regular";
{
var s = sale.SingleOrDefault(x => x.Rate == inv.Inv.VatRate);
var c = credit.SingleOrDefault(x => x.Date == inv.Date);
if (s == null)
throw new ArgumentException("Unknown type of vat rate encountered");
if (c == null)
throw new ArgumentException("Unknown date encountered");
if (s == null) // Temp ignore and move on
continue;
//throw new ArgumentException("Unknown type of vat rate encountered");
if (c == null) // Means no credit card for the day
c = new CreditJson() { _date = inv.Date.ToString("dd-MMM-yyyy"), Amount = 0 };
// throw new ArgumentException("Unknown date encountered");
if (Math.Abs(s.Amount) < 10)
continue; // Close enough for now
if (s.Amount > 0 && c.Amount < 10)

View File

@ -141,19 +141,15 @@ from Voucher v
inner join v.Kots k
inner join k.Inventories i
inner join i.Vat va
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 in (:cash, :creditCard, :billToCompany)
)
where v.Date >= :startDate and v.Date <= :finishDate and v.Void = false and v.VoucherType not in (:nc, :staff)
group by i.VatRate, va.Name
";
var list = _session
.CreateQuery(query)
.SetParameter("startDate", startDate)
.SetParameter("finishDate", finishDate)
.SetParameter("cash", SettleOption.Cash)
.SetParameter("creditCard", SettleOption.CreditCard)
.SetParameter("billToCompany", SettleOption.BillToCompany)
.SetParameter("nc", VoucherType.NoCharge)
.SetParameter("staff", VoucherType.Staff)
.List<object[]>();
foreach (var item in list)
outList.Add(new TaxAnalysis() { Name = string.Format("{0} - {1:#.##%;(#.##%);0%}", (string)item[0], (decimal)item[1]), TaxRate = (decimal)item[1], TaxAmount = (decimal)item[2], NetSale = (decimal)item[3] });