Feature: Added a net field in printed bill.

This commit is contained in:
Tanshu 2013-10-05 15:20:32 +05:30
parent 330d66a7f8
commit d4ea454add
3 changed files with 13 additions and 26 deletions

View File

@ -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);
}
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)
{
return string.IsNullOrEmpty(product.Units)

View File

@ -16,19 +16,27 @@ namespace Tanshu.Accounts.Print
billText += Products(voucher, list);
decimal amount;
amount = Net(list.Values);
amount = list.Values.Sum(item => item.Quantity * item.FullPrice);
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)
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)
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)
billText += "\n\r" + FormatText("Service Charge : ", 33, Align.Right) + FormatBillNum(amount, 9);

View File

@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using NHibernate.Criterion;
using Tanshu.Accounts.Entities;
using Tanshu.Common.Helpers;
using NHibernate;