Feature: Added a net field in printed bill.
This commit is contained in:
parent
330d66a7f8
commit
d4ea454add
@ -71,26 +71,6 @@ namespace Tanshu.Accounts.Print
|
|||||||
return list.Where(x => x.Vat == rate).Sum(item => item.Quantity * item.Price * (1 - item.Discount) * (1 + (item.IsScTaxable ? item.ServiceCharge : 0)) * item.Vat);
|
return list.Where(x => x.Vat == rate).Sum(item => item.Quantity * item.Price * (1 - item.Discount) * (1 + (item.IsScTaxable ? item.ServiceCharge : 0)) * item.Vat);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static decimal ServiceCharge(IEnumerable<Inventory> list)
|
|
||||||
{
|
|
||||||
return list.Sum(item => item.Quantity * item.Price * (1 - item.Discount) * item.ServiceCharge);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static decimal Discount(IEnumerable<Inventory> list)
|
|
||||||
{
|
|
||||||
return list.Sum(item => item.Quantity * item.Price * item.Discount);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static decimal Net(IEnumerable<Inventory> list)
|
|
||||||
{
|
|
||||||
return list.Sum(item => item.Quantity * item.FullPrice);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static decimal HappyHourDiscount(IEnumerable<Inventory> list)
|
|
||||||
{
|
|
||||||
return list.Sum(item => item.Quantity * (item.FullPrice - item.Price));
|
|
||||||
}
|
|
||||||
|
|
||||||
private static string Name(Product product)
|
private static string Name(Product product)
|
||||||
{
|
{
|
||||||
return string.IsNullOrEmpty(product.Units)
|
return string.IsNullOrEmpty(product.Units)
|
||||||
|
@ -16,19 +16,27 @@ namespace Tanshu.Accounts.Print
|
|||||||
billText += Products(voucher, list);
|
billText += Products(voucher, list);
|
||||||
|
|
||||||
decimal amount;
|
decimal amount;
|
||||||
amount = Net(list.Values);
|
amount = list.Values.Sum(item => item.Quantity * item.FullPrice);
|
||||||
if (amount != 0)
|
if (amount != 0)
|
||||||
billText += "\n\r" + FormatText("Net : ", 33, Align.Right) + FormatBillNum(amount, 9);
|
billText += "\n\r" + FormatText("Total : ", 33, Align.Right) + FormatBillNum(amount, 9);
|
||||||
|
|
||||||
amount = HappyHourDiscount(list.Values);
|
amount = list.Values.Sum(item => item.Quantity * (item.FullPrice - item.Price));
|
||||||
if (amount != 0)
|
if (amount != 0)
|
||||||
billText += "\n\r" + FormatText("Happy Hour Discount : ", 33, Align.Right) + FormatBillNum(amount, 9);
|
billText += "\n\r" + FormatText("Happy Hour Discount : ", 33, Align.Right) + FormatBillNum(amount, 9);
|
||||||
|
|
||||||
amount = Discount(list.Values);
|
amount = list.Values.Sum(item => item.Quantity * item.Price * item.Discount);
|
||||||
if (amount != 0)
|
if (amount != 0)
|
||||||
billText += "\n\r" + FormatText("Discount : ", 33, Align.Right) + FormatBillNum(amount, 9);
|
billText += "\n\r" + FormatText("Discount : ", 33, Align.Right) + FormatBillNum(amount, 9);
|
||||||
|
|
||||||
amount = ServiceCharge(list.Values);
|
amount = list.Values.Sum(item => item.Quantity * item.Price * (1 - item.Discount));
|
||||||
|
if (amount != 0)
|
||||||
|
{
|
||||||
|
billText += "\n\r" + FormatText(" : ", 33, Align.Right) + "---------";
|
||||||
|
billText += "\n\r" + FormatText("Net : ", 33, Align.Right) + FormatBillNum(amount, 9);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
amount = list.Values.Sum(item => item.Quantity * item.Price * (1 - item.Discount) * item.ServiceCharge);
|
||||||
if (amount != 0)
|
if (amount != 0)
|
||||||
billText += "\n\r" + FormatText("Service Charge : ", 33, Align.Right) + FormatBillNum(amount, 9);
|
billText += "\n\r" + FormatText("Service Charge : ", 33, Align.Right) + FormatBillNum(amount, 9);
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
using NHibernate.Criterion;
|
|
||||||
using Tanshu.Accounts.Entities;
|
using Tanshu.Accounts.Entities;
|
||||||
using Tanshu.Common.Helpers;
|
using Tanshu.Common.Helpers;
|
||||||
using NHibernate;
|
using NHibernate;
|
||||||
|
Loading…
Reference in New Issue
Block a user