Added FullPrice column to display Happy Hour Pricing.
Added Void or Reprint Report. Changed Product.SalePrice -> Price Changed Inventory.Rate -> Price
This commit is contained in:
@ -314,7 +314,7 @@ and i.Discount >= :discount";
|
||||
foreach (var item in list)
|
||||
{
|
||||
var amt = item.Settlements.Where(x => x.Settled == SettleOption.Amount).Sum(x => x.Amount) * -1;
|
||||
var disc = item.Kots.Sum(x => x.Inventories.Sum(y => y.Quantity * y.Rate * y.Discount));
|
||||
var disc = item.Kots.Sum(x => x.Inventories.Sum(y => y.Quantity * y.Price * y.Discount));
|
||||
info += string.Format("\n\r{0:dd-MMM-yyyy HH:mm:ss} {1} {2}", item.Date, item.BillID, item.Customer.Name);
|
||||
info += string.Format("\n\rAmount: {0:#0.00} :: Discount: {1:#0.00}", amt, disc);
|
||||
info += "\n\r------------------------------------------";
|
||||
@ -335,7 +335,7 @@ and i.Discount >= :discount";
|
||||
foreach (var item in list)
|
||||
{
|
||||
var amt = item.Settlements.Where(x => x.Settled == settleOption).Sum(x => x.Amount);
|
||||
var disc = item.Kots.Sum(x => x.Inventories.Sum(y => y.Quantity * y.Rate * y.Discount));
|
||||
var disc = item.Kots.Sum(x => x.Inventories.Sum(y => y.Quantity * y.Price * y.Discount));
|
||||
info += string.Format("\n\r{0:dd-MMM-yyyy HH:mm:ss} {1} {2}", item.Date, item.BillID, item.Customer.Name);
|
||||
info += string.Format("\n\rAmount: {0:#0.00} :: Discount: {1:#0.00}", amt, disc);
|
||||
info += "\n\r------------------------------------------";
|
||||
|
||||
@ -4,6 +4,7 @@ using Tanshu.Accounts.Contracts;
|
||||
using Tanshu.Accounts.Entities;
|
||||
using Tanshu.Common;
|
||||
using Tanshu.Common.Helpers;
|
||||
using System.Linq;
|
||||
|
||||
namespace Tanshu.Accounts.Repository
|
||||
{
|
||||
@ -79,7 +80,7 @@ order by p.ProductGroup, concat(p.Name, ' ', p.Units)
|
||||
using (var session = SessionManager.Session)
|
||||
{
|
||||
const string query = @"
|
||||
select g.GroupType as GroupType, Sum(i.Quantity * i.Rate * (1 - i.Discount)) as Amount
|
||||
select g.GroupType as GroupType, Sum(i.Quantity * i.Price * (1 - i.Discount)) as Amount
|
||||
from Voucher v
|
||||
inner join v.Kots k
|
||||
inner join k.Inventories i
|
||||
@ -148,6 +149,56 @@ order by v.BillID, s.Settled
|
||||
return outList;
|
||||
}
|
||||
}
|
||||
public IList<BillDetail> VoidOrReprintedBillsList(DateTime startDate, DateTime finishDate)
|
||||
{
|
||||
startDate = startDate.Date.AddHours(6);
|
||||
finishDate = finishDate.Date.AddDays(1).AddHours(5);
|
||||
if (finishDate <= startDate)
|
||||
return new List<BillDetail>();
|
||||
using (var session = SessionManager.Session)
|
||||
{
|
||||
const string query = @"
|
||||
select v.Date, v.BillID, s.Amount, v.VoidReason
|
||||
from Voucher v
|
||||
inner join v.Settlements s
|
||||
where v.Date >= :startDate and v.Date <= :finishDate and v.Void = true and s.Settled = :settled
|
||||
order by v.BillID, s.Settled
|
||||
";
|
||||
var listVoids = session
|
||||
.CreateQuery(query)
|
||||
.SetParameter("startDate", startDate)
|
||||
.SetParameter("finishDate", finishDate)
|
||||
.SetParameter("settled", SettleOption.Amount)
|
||||
.List<object[]>();
|
||||
var outList = new List<BillDetail>();
|
||||
foreach (var item in listVoids)
|
||||
{
|
||||
outList.Add(new BillDetail()
|
||||
{
|
||||
Date = (DateTime)item[0],
|
||||
BillID = (string)item[1],
|
||||
Settlement = string.Format("Void: {0}", (string)item[3]),
|
||||
Amount = (decimal)item[2] * -1
|
||||
});
|
||||
}
|
||||
var listReprint = session.QueryOver<Reprint>()
|
||||
.Where(x => x.Date >= startDate && x.Date <= finishDate)
|
||||
.List();
|
||||
foreach (var item in listReprint)
|
||||
{
|
||||
outList.Add(new BillDetail()
|
||||
{
|
||||
Date = item.Date,
|
||||
BillID = item.Voucher.BillID,
|
||||
Settlement = string.Format("Reprinted by {0}", item.User.Name),
|
||||
Amount = item.Voucher.Settlements.Single(x => x.Settled == SettleOption.Amount).Amount * -1
|
||||
});
|
||||
}
|
||||
|
||||
return outList;
|
||||
}
|
||||
}
|
||||
|
||||
private static IList<SalesAnalysis> GetSettlement(IList<SalesAnalysis> outList, DateTime startDate, DateTime finishDate)
|
||||
{
|
||||
outList.Add(new SalesAnalysis() { GroupType = " -- ", Amount = 0 });
|
||||
@ -155,7 +206,7 @@ order by v.BillID, s.Settled
|
||||
return new List<SalesAnalysis>();
|
||||
using (var session = SessionManager.Session)
|
||||
{
|
||||
//select v.Settled, Sum(i.Quantity * i.Rate * (1 - i.Discount) * (1 + i.ServiceCharge) * (1 + i.Tax)) as Amount
|
||||
//select v.Settled, Sum(i.Quantity * i.Price * (1 - i.Discount) * (1 + i.ServiceCharge) * (1 + i.Tax)) as Amount
|
||||
const string query = @"
|
||||
select s.Settled, Sum(s.Amount)
|
||||
from Voucher v
|
||||
@ -188,7 +239,7 @@ order by s.Settled
|
||||
{
|
||||
#region Service Charge
|
||||
var query = @"
|
||||
select Sum(i.Quantity * i.Rate * (1 - i.Discount) * i.ServiceCharge)
|
||||
select Sum(i.Quantity * i.Price * (1 - i.Discount) * i.ServiceCharge)
|
||||
from Voucher v
|
||||
inner join v.Kots k
|
||||
inner join k.Inventories i
|
||||
@ -209,7 +260,7 @@ and vs.Settled != :noCharge and vs.Settled != :unsettled and vs.Settled != :amou
|
||||
#endregion
|
||||
#region Tax
|
||||
query = @"
|
||||
select i.Tax, Sum(i.Quantity * i.Rate * (1 - i.Discount) * (1 + i.ServiceCharge) * i.Tax)
|
||||
select i.Tax, Sum(i.Quantity * i.Price * (1 - i.Discount) * (1 + i.ServiceCharge) * i.Tax)
|
||||
from Voucher v
|
||||
inner join v.Kots k
|
||||
inner join k.Inventories i
|
||||
|
||||
@ -25,6 +25,10 @@ namespace Tanshu.Accounts.Repository
|
||||
{
|
||||
return Session.Get<Voucher>(voucherID).Printed;
|
||||
}
|
||||
public bool IsVoucherVoid(int voucherID)
|
||||
{
|
||||
return Session.Get<Voucher>(voucherID).Void;
|
||||
}
|
||||
public int? Insert(Voucher voucher)
|
||||
{
|
||||
var dt = DbValues.Date;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -104,7 +104,6 @@
|
||||
<Compile Include="Fluent\AllowNullConvention.cs" />
|
||||
<Compile Include="Fluent\EnumConvention.cs" />
|
||||
<Compile Include="Fluent\QueryStore.cs" />
|
||||
<Compile Include="Fluent\Fixtures.cs" />
|
||||
<Compile Include="Fluent\StoreConfiguration.cs" />
|
||||
<Compile Include="BusinessLayer\AdvanceBI.cs" />
|
||||
<Compile Include="BusinessLayer\CustomerBI.cs" />
|
||||
|
||||
Reference in New Issue
Block a user