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:
parent
5f0f80ed1e
commit
09a8b546cf
@ -736,10 +736,12 @@ and v.VoucherType = :regular";
|
|||||||
{
|
{
|
||||||
var s = sale.SingleOrDefault(x => x.Rate == inv.Inv.VatRate);
|
var s = sale.SingleOrDefault(x => x.Rate == inv.Inv.VatRate);
|
||||||
var c = credit.SingleOrDefault(x => x.Date == inv.Date);
|
var c = credit.SingleOrDefault(x => x.Date == inv.Date);
|
||||||
if (s == null)
|
if (s == null) // Temp ignore and move on
|
||||||
throw new ArgumentException("Unknown type of vat rate encountered");
|
continue;
|
||||||
if (c == null)
|
//throw new ArgumentException("Unknown type of vat rate encountered");
|
||||||
throw new ArgumentException("Unknown date 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)
|
if (Math.Abs(s.Amount) < 10)
|
||||||
continue; // Close enough for now
|
continue; // Close enough for now
|
||||||
if (s.Amount > 0 && c.Amount < 10)
|
if (s.Amount > 0 && c.Amount < 10)
|
||||||
|
@ -141,19 +141,15 @@ from Voucher v
|
|||||||
inner join v.Kots k
|
inner join v.Kots k
|
||||||
inner join k.Inventories i
|
inner join k.Inventories i
|
||||||
inner join i.Vat va
|
inner join i.Vat va
|
||||||
where v.Date >= :startDate and v.Date <= :finishDate and v.Void = false
|
where v.Date >= :startDate and v.Date <= :finishDate and v.Void = false and v.VoucherType not in (:nc, :staff)
|
||||||
and exists (
|
|
||||||
select Voucher from VoucherSettlement vs where vs.Voucher = v and vs.Settled in (:cash, :creditCard, :billToCompany)
|
|
||||||
)
|
|
||||||
group by i.VatRate, va.Name
|
group by i.VatRate, va.Name
|
||||||
";
|
";
|
||||||
var list = _session
|
var list = _session
|
||||||
.CreateQuery(query)
|
.CreateQuery(query)
|
||||||
.SetParameter("startDate", startDate)
|
.SetParameter("startDate", startDate)
|
||||||
.SetParameter("finishDate", finishDate)
|
.SetParameter("finishDate", finishDate)
|
||||||
.SetParameter("cash", SettleOption.Cash)
|
.SetParameter("nc", VoucherType.NoCharge)
|
||||||
.SetParameter("creditCard", SettleOption.CreditCard)
|
.SetParameter("staff", VoucherType.Staff)
|
||||||
.SetParameter("billToCompany", SettleOption.BillToCompany)
|
|
||||||
.List<object[]>();
|
.List<object[]>();
|
||||||
foreach (var item in 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] });
|
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] });
|
||||||
|
Loading…
Reference in New Issue
Block a user