831ec37cda
Printed bill can no longer be changed, any changes voids the bill and prints a new one. Added option to Split Bill. Kot printed with right time. Numerous bug fixes.
28 lines
801 B
C#
28 lines
801 B
C#
using System.Reflection;
|
|
using Tanshu.Accounts.Entities;
|
|
|
|
namespace Tanshu.Common.Helpers
|
|
{
|
|
public enum VoucherFields
|
|
{
|
|
CreationDate,
|
|
LastEditDate,
|
|
Date,
|
|
BillID,
|
|
KotID
|
|
}
|
|
public static class ReflectionHelper
|
|
{
|
|
public static void SetValue(this Voucher voucher, VoucherFields field, object value)
|
|
{
|
|
var fi = typeof(Voucher).GetField(ConvertToCamelCaseUnderscore(field.ToString()), BindingFlags.NonPublic | BindingFlags.Instance);
|
|
if (fi != null)
|
|
fi.SetValue(voucher, value);
|
|
}
|
|
private static string ConvertToCamelCaseUnderscore(string propertyName)
|
|
{
|
|
return "_" + propertyName[0].ToString().ToLower() + propertyName.Substring(1);
|
|
}
|
|
|
|
}
|
|
} |