From 09a8b546cf67ffff686d340a32671107c009a13b Mon Sep 17 00:00:00 2001 From: tanshu Date: Sat, 14 May 2016 19:28:18 +0530 Subject: [PATCH] Fix: Tax Analysis Report and Management Get VAT Sale now show the same sales. It also finally makes it work properly. --- Tanshu.Accounts.Repository/ManagementBI.cs | 10 ++++++---- Tanshu.Accounts.Repository/SalesAnalysisBI.cs | 10 +++------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/Tanshu.Accounts.Repository/ManagementBI.cs b/Tanshu.Accounts.Repository/ManagementBI.cs index c5bd3da..120c8ef 100644 --- a/Tanshu.Accounts.Repository/ManagementBI.cs +++ b/Tanshu.Accounts.Repository/ManagementBI.cs @@ -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) diff --git a/Tanshu.Accounts.Repository/SalesAnalysisBI.cs b/Tanshu.Accounts.Repository/SalesAnalysisBI.cs index ffa53ec..45177ca 100644 --- a/Tanshu.Accounts.Repository/SalesAnalysisBI.cs +++ b/Tanshu.Accounts.Repository/SalesAnalysisBI.cs @@ -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(); 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] });