Finally Deployed. Don't know the total amount of changes.
This commit is contained in:
parent
dc3576437f
commit
948cd0bf28
Sql
Tanshu.Accounts.Contracts
Data Contracts Display
Data Contracts
DisplayAttribute.csHelper Functions
Tanshu.Accounts.Contracts.csprojTanshu.Accounts.Helpers
Tanshu.Accounts.PointOfSale
Controllers
MainForm.csProducts
Reports
BillDetailsForm.csCheckoutForm.Designer.csCheckoutForm.csSaleAnalysisForm.csSaleAnalysisForm.designer.cs
Sales
Tanshu.Accounts.PointOfSale.csprojTanshu.Accounts.Print
Tanshu.Accounts.Repository
@ -382,7 +382,10 @@ BEGIN
|
||||
SELECT @KotID = ISNULL(MAX(KotID) + 1, 1) FROM Vouchers;
|
||||
IF @Printed = 1
|
||||
BEGIN
|
||||
SELECT @BillID = ISNULL(MAX(BillID) + 1, 1) FROM Vouchers WHERE VoucherType = @VoucherType;
|
||||
IF @VoucherType IN (1,3)
|
||||
SELECT @BillID = ISNULL(MAX(BillID) + 1, 1) FROM Vouchers WHERE VoucherType IN (1, 3);
|
||||
ELSE
|
||||
SELECT @BillID = ISNULL(MAX(BillID) + 1, 1) FROM Vouchers WHERE VoucherType = @VoucherType;
|
||||
IF @BillID % 10000 = 0
|
||||
SELECT @BillID = @BillID + 1;
|
||||
END
|
||||
@ -414,7 +417,10 @@ BEGIN
|
||||
|
||||
IF @Printed = 1 AND @BillID IS NULL
|
||||
BEGIN
|
||||
SELECT @BillID = ISNULL(MAX(BillID) + 1, 1) FROM Vouchers WHERE VoucherType = @VoucherType;
|
||||
IF @VoucherType IN (1,3)
|
||||
SELECT @BillID = ISNULL(MAX(BillID) + 1, 1) FROM Vouchers WHERE VoucherType IN (1, 3);
|
||||
ELSE
|
||||
SELECT @BillID = ISNULL(MAX(BillID) + 1, 1) FROM Vouchers WHERE VoucherType = @VoucherType;
|
||||
IF @BillID % 10000 = 0
|
||||
SELECT @BillID = @BillID + 1;
|
||||
SELECT @Date = @LastEditDate;
|
||||
|
@ -1,14 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace Tanshu.Accounts.Contracts
|
||||
{
|
||||
public class ProductDisplaySmall
|
||||
{
|
||||
public virtual int Code { get; set; }
|
||||
public virtual string Name { get; set; }
|
||||
public virtual decimal Price { get; set; }
|
||||
public virtual string Category { get; set; }
|
||||
public virtual int ProductID { get; set; }
|
||||
}
|
||||
}
|
@ -20,7 +20,7 @@ namespace Tanshu.Accounts.Contracts
|
||||
{
|
||||
public virtual DateTime Date { get; set; }
|
||||
public virtual string BillID { get; set; }
|
||||
public virtual string Settlement { get; set; }
|
||||
public virtual decimal Amount { get; set; }
|
||||
public virtual string Settlement { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,8 @@ namespace Tanshu.Accounts.Entities
|
||||
}
|
||||
public virtual Guid KotID { get; set; }
|
||||
public virtual Voucher Voucher { get; set; }
|
||||
public virtual int Code { get; set; }
|
||||
protected int _code;
|
||||
public virtual int Code { get { return _code; } }
|
||||
public virtual FoodTable Table { get; set; }
|
||||
public virtual bool Printed { get; set; }
|
||||
public virtual DateTime Date { get; set; }
|
||||
@ -39,6 +40,7 @@ namespace Tanshu.Accounts.Entities
|
||||
map.NotNullable(true);
|
||||
map.Unique(true);
|
||||
map.Generated(PropertyGeneration.Insert);
|
||||
map.Access(Accessor.NoSetter);
|
||||
});
|
||||
Property(x => x.Printed, map => map.NotNullable(true));
|
||||
Property(x => x.Date, map =>
|
||||
|
@ -9,7 +9,8 @@ namespace Tanshu.Accounts.Entities
|
||||
{
|
||||
public virtual Guid ReprintID { get; set; }
|
||||
public virtual User User { get; set; }
|
||||
public virtual DateTime Date { get; set; }
|
||||
protected DateTime _date;
|
||||
public virtual DateTime Date { get { return _date; } }
|
||||
public virtual Voucher Voucher { get; set; }
|
||||
}
|
||||
public class ReprintMap : ClassMapping<Reprint>
|
||||
@ -26,6 +27,7 @@ namespace Tanshu.Accounts.Entities
|
||||
{
|
||||
map.NotNullable(true);
|
||||
map.Generated(PropertyGeneration.Insert);
|
||||
map.Access(Accessor.NoSetter);
|
||||
});
|
||||
ManyToOne(x => x.User, map =>
|
||||
{
|
||||
|
@ -4,25 +4,25 @@ namespace Tanshu.Accounts.Entities
|
||||
{
|
||||
public enum SettleOption
|
||||
{
|
||||
[Display("Unsettled", false, 1)]
|
||||
[Display("Unsettled", false, 1, true)]
|
||||
Unsettled = 1,
|
||||
[Display("Cash", true, 2)]
|
||||
[Display("Cash", true, 2, false)]
|
||||
Cash = 2,
|
||||
[Display("Credit Card", true, 2)]
|
||||
[Display("Credit Card", true, 2, true)]
|
||||
CreditCard = 3,
|
||||
[Display("No Charge", true, 3)]
|
||||
[Display("No Charge", true, 3, true)]
|
||||
NoCharge = 4,
|
||||
[Display("Bill To Company", true, 2)]
|
||||
[Display("Bill To Company", true, 2, true)]
|
||||
BillToCompany = 5,
|
||||
[Display("Tip", true, 2)]
|
||||
[Display("Tip", true, 2, true)]
|
||||
Tip = 6,
|
||||
[Display("Round Off", false, 1)]
|
||||
[Display("Round Off", false, 1, false)]
|
||||
RoundOff = 7,
|
||||
[Display("Amount", false, 1)]
|
||||
[Display("Amount", false, 1, false)]
|
||||
Amount = 8,
|
||||
[Display("Settled", false, 1)]
|
||||
Settled = 9,
|
||||
[Display("Staff",true,4)]
|
||||
[Display("Void", false, 1, true)]
|
||||
Void = 9,
|
||||
[Display("Staff", true, 4, true)]
|
||||
Staff = 10
|
||||
}
|
||||
}
|
@ -18,7 +18,6 @@ namespace Tanshu.Accounts.Entities
|
||||
public Voucher(User user)
|
||||
: this()
|
||||
{
|
||||
this.Date = null;
|
||||
this.User = user;
|
||||
VoucherType = VoucherType.Regular;
|
||||
}
|
||||
@ -37,13 +36,17 @@ namespace Tanshu.Accounts.Entities
|
||||
|
||||
public virtual Guid VoucherID { get; set; }
|
||||
|
||||
public virtual DateTime? Date { get; set; }
|
||||
protected DateTime _date;
|
||||
public virtual DateTime Date { get { return _date; } }
|
||||
|
||||
public virtual int Pax { get; set; }
|
||||
public virtual User User { get; set; }
|
||||
public virtual DateTime CreationDate { get; set; }
|
||||
public virtual DateTime LastEditDate { get; set; }
|
||||
public virtual int? BillID { get; set; }
|
||||
protected DateTime _creationDate;
|
||||
public virtual DateTime CreationDate { get { return _creationDate; } }
|
||||
protected DateTime _lastEditDate;
|
||||
public virtual DateTime LastEditDate { get { return _lastEditDate; } }
|
||||
protected int? _billID;
|
||||
public virtual int? BillID { get { return _billID; } }
|
||||
public virtual FoodTable Table { get; set; }
|
||||
public virtual Waiter Waiter { get; set; }
|
||||
public virtual Customer Customer { get; set; }
|
||||
@ -53,9 +56,35 @@ namespace Tanshu.Accounts.Entities
|
||||
public virtual string VoidReason { get; set; }
|
||||
public virtual bool Printed { get; set; }
|
||||
public virtual VoucherType VoucherType { get; set; }
|
||||
public virtual int KotID { get; set; }
|
||||
protected int _kotID;
|
||||
public virtual int KotID { get { return _kotID; } }
|
||||
public virtual IList<Kot> Kots { get; set; }
|
||||
public virtual IList<Reprint> Reprints { get; set; }
|
||||
public virtual string FullBillID
|
||||
{
|
||||
get
|
||||
{
|
||||
if (BillID.HasValue)
|
||||
{
|
||||
switch (VoucherType)
|
||||
{
|
||||
case VoucherType.NoCharge:
|
||||
return "NC-" + BillID.Value.ToString();
|
||||
case VoucherType.Staff:
|
||||
return "ST-" + BillID.Value.ToString();
|
||||
case VoucherType.TakeAway:
|
||||
case VoucherType.Regular:
|
||||
default:
|
||||
return (BillID.Value / 10000).ToString() + "-" + (BillID.Value % 10000).ToString();
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return "K-" + KotID.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class VoucherMap : ClassMapping<Voucher>
|
||||
@ -72,21 +101,33 @@ namespace Tanshu.Accounts.Entities
|
||||
{
|
||||
map.NotNullable(true);
|
||||
map.Generated(PropertyGeneration.Always);
|
||||
map.Access(Accessor.NoSetter);
|
||||
});
|
||||
Property(x => x.Pax);
|
||||
Property(x => x.VoucherType, map => map.NotNullable(true));
|
||||
Property(x => x.VoucherType, map =>
|
||||
{
|
||||
map.NotNullable(true);
|
||||
map.UniqueKey("UQ_BillID_VoucherType");
|
||||
});
|
||||
Property(x => x.Narration);
|
||||
Property(x => x.CreationDate, map =>
|
||||
{
|
||||
map.NotNullable(true);
|
||||
map.Generated(PropertyGeneration.Insert);
|
||||
map.Access(Accessor.NoSetter);
|
||||
});
|
||||
Property(x => x.LastEditDate, map =>
|
||||
{
|
||||
map.NotNullable(true);
|
||||
map.Generated(PropertyGeneration.Always);
|
||||
map.Access(Accessor.NoSetter);
|
||||
});
|
||||
Property(x => x.BillID, map =>
|
||||
{
|
||||
map.Generated(PropertyGeneration.Always);
|
||||
map.Access(Accessor.NoSetter);
|
||||
map.UniqueKey("UQ_BillID_VoucherType");
|
||||
});
|
||||
Property(x => x.BillID, map => map.Generated(PropertyGeneration.Always));
|
||||
Property(x => x.Void, map => map.NotNullable(true));
|
||||
Property(x => x.VoidReason);
|
||||
Property(x => x.Printed, map => map.NotNullable(true));
|
||||
@ -94,6 +135,7 @@ namespace Tanshu.Accounts.Entities
|
||||
{
|
||||
map.NotNullable(true);
|
||||
map.Generated(PropertyGeneration.Insert);
|
||||
map.Access(Accessor.NoSetter);
|
||||
});
|
||||
ManyToOne(x => x.User, map =>
|
||||
{
|
||||
|
@ -12,8 +12,15 @@ namespace Tanshu.Accounts.Contracts
|
||||
Group = group;
|
||||
}
|
||||
|
||||
public string Name { get; set; }
|
||||
public int Group { get; set; }
|
||||
public bool ShowInChoices { get; set; }
|
||||
public DisplayAttribute(string name, bool showInChoices, int group, bool print)
|
||||
: this(name, showInChoices, group)
|
||||
{
|
||||
Print = print;
|
||||
}
|
||||
|
||||
public string Name { get; private set; }
|
||||
public int Group { get; private set; }
|
||||
public bool ShowInChoices { get; private set; }
|
||||
public bool Print { get; private set; }
|
||||
}
|
||||
}
|
@ -10,6 +10,11 @@ namespace Tanshu.Common.Helpers
|
||||
var attribute = (DisplayAttribute)settleOption.GetType().GetField(settleOption.ToString()).GetCustomAttributes(typeof(DisplayAttribute), false)[0];
|
||||
return attribute != null ? attribute.Name : "";
|
||||
}
|
||||
public static bool Print(this SettleOption settleOption)
|
||||
{
|
||||
var attribute = (DisplayAttribute)settleOption.GetType().GetField(settleOption.ToString()).GetCustomAttributes(typeof(DisplayAttribute), false)[0];
|
||||
return attribute != null ? attribute.Print : false;
|
||||
}
|
||||
public static bool Visible(this SettleOption settleOption)
|
||||
{
|
||||
var attribute = (DisplayAttribute)settleOption.GetType().GetField(settleOption.ToString()).GetCustomAttributes(typeof(DisplayAttribute), false)[0];
|
||||
|
@ -70,9 +70,6 @@
|
||||
<Compile Include="Data Contracts Display\BillItemKey.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Data Contracts Display\ProductDisplaySmallBO.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Data Contracts\Auth\UserGroup.cs" />
|
||||
<Compile Include="Data Contracts\Auth\RoleGroup.cs" />
|
||||
<Compile Include="Data Contracts\Auth\Group.cs" />
|
||||
|
@ -1,66 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using Tanshu.Accounts.Contracts;
|
||||
using Tanshu.Data;
|
||||
|
||||
namespace Tanshu.Accounts.Helpers
|
||||
{
|
||||
public class SelectProduct : Tanshu.Data.BaseSelector<ProductDisplaySmall>
|
||||
{
|
||||
public SelectProduct(GetData<ProductDisplaySmall> getData, bool autoClose)
|
||||
: base(getData, true, "List of Products")
|
||||
{
|
||||
var filters = new List<string> {"Name", "Type"};
|
||||
SetFilterColumns(filters);
|
||||
grid.Columns["ProductID"].Visible = false;
|
||||
}
|
||||
|
||||
protected override void FilterChanged(Dictionary<string, string> filter)
|
||||
{
|
||||
data = getData(filter);
|
||||
bindingSource.DataSource = data;
|
||||
}
|
||||
|
||||
protected override void UpdateDisplay(ProductDisplaySmall item)
|
||||
{
|
||||
DisplayLabel = item == null ? "" : string.Format("Chosen Product {0} with rate Rs. {1}", item.Name, item.Price);
|
||||
}
|
||||
|
||||
protected override ProductDisplaySmall HandleKeydown(object sender, ExtendedKeyEventArgs e)
|
||||
{
|
||||
e.Handled = false;
|
||||
return null;
|
||||
}
|
||||
#region Designer Code
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -63,13 +63,13 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="ControlFactory.cs" />
|
||||
<Compile Include="CustomStructs.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SelectorEvent.cs" />
|
||||
<Compile Include="SelectUser.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="CustomStructs.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SelectVoidReason.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
@ -79,9 +79,6 @@
|
||||
<Compile Include="SelectWaiter.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SelectProduct.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@ -783,7 +783,6 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
_billInfo.Printed = finalBill;
|
||||
_billInfo.Void = false;
|
||||
_billInfo.Narration = "";
|
||||
//UpdateKotDiscountAndPrice();
|
||||
var kot = GetKot(_bill.Where(x => x.Key.BillItemType == BillItemType.Product && x.Key.KotID == Guid.Empty && x.Value.Quantity != 0));
|
||||
if (kot == null)
|
||||
return null;
|
||||
@ -804,6 +803,7 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
voucher.Customer = _billInfo.Customer;
|
||||
voucher.Waiter = _billInfo.Waiter;
|
||||
voucher.Printed = finalBill;
|
||||
voucher.VoucherType = _billInfo.VoucherType;
|
||||
foreach (var item in _bill.Where(x => x.Key.BillItemType == BillItemType.Product && x.Key.KotID != Guid.Empty))
|
||||
{
|
||||
var i = voucher.Kots.Single(x => x.KotID == item.Key.KotID).Inventories.Single(x => x.Product.ProductID == item.Key.ProductID);
|
||||
|
@ -12,6 +12,7 @@ using Tanshu.Common;
|
||||
using Tanshu.Common.KeyboardControl;
|
||||
using NHibernate.Tool.hbm2ddl;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq.Expressions;
|
||||
|
||||
namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
@ -55,7 +56,7 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
frmSale.ShowDialog();
|
||||
Cache.Invalidate();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void btnProduct_Click(object sender, EventArgs e)
|
||||
@ -212,10 +213,32 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
var result = InputBox.Show("Bill Number", "0", InputBox_Validating);
|
||||
if (!result.OK)
|
||||
return;
|
||||
var billID = int.Parse(result.Text.Replace("-",""));
|
||||
|
||||
Expression<Func<Voucher, bool>> query;
|
||||
int billID;
|
||||
if (Regex.IsMatch(result.Text, @"^\d{2,}-\d{4}$"))
|
||||
{
|
||||
billID = int.Parse(result.Text.Replace("-", ""));
|
||||
query = x => x.BillID == billID && (x.VoucherType == VoucherType.Regular || x.VoucherType == VoucherType.TakeAway);
|
||||
}
|
||||
else if (Regex.IsMatch(result.Text, @"^NC-\d+$"))
|
||||
{
|
||||
billID = int.Parse(result.Text.Replace("NC-", ""));
|
||||
query = x => x.BillID == billID && x.VoucherType == VoucherType.NoCharge;
|
||||
}
|
||||
else if (Regex.IsMatch(result.Text, @"^ST-\d+$"))
|
||||
{
|
||||
billID = int.Parse(result.Text.Replace("ST-", ""));
|
||||
query = x => x.BillID == billID && x.VoucherType == VoucherType.Staff;
|
||||
}
|
||||
else
|
||||
return;
|
||||
|
||||
Voucher voucher;
|
||||
using (var bi = new VoucherBI())
|
||||
voucher = bi.Get(x => x.BillID == billID);
|
||||
voucher = bi.Get(query);
|
||||
if (voucher == null)
|
||||
return;
|
||||
if (Session.IsAllowed("Sales"))
|
||||
using (var frmSale = new SalesForm(new BillController(voucher.VoucherID, true)))
|
||||
frmSale.ShowDialog();
|
||||
|
@ -75,7 +75,7 @@
|
||||
// Label7
|
||||
//
|
||||
this.Label7.AutoSize = true;
|
||||
this.Label7.Location = new System.Drawing.Point(70, 141);
|
||||
this.Label7.Location = new System.Drawing.Point(70, 169);
|
||||
this.Label7.Name = "Label7";
|
||||
this.Label7.Size = new System.Drawing.Size(36, 13);
|
||||
this.Label7.TabIndex = 17;
|
||||
@ -88,7 +88,7 @@
|
||||
// label5
|
||||
//
|
||||
this.label5.AutoSize = true;
|
||||
this.label5.Location = new System.Drawing.Point(26, 115);
|
||||
this.label5.Location = new System.Drawing.Point(26, 143);
|
||||
this.label5.Name = "label5";
|
||||
this.label5.Size = new System.Drawing.Size(80, 13);
|
||||
this.label5.TabIndex = 16;
|
||||
@ -150,7 +150,7 @@
|
||||
this.txtPrice.AccessibleName = "";
|
||||
this.txtPrice.Location = new System.Drawing.Point(112, 64);
|
||||
this.txtPrice.Name = "txtPrice";
|
||||
this.txtPrice.Size = new System.Drawing.Size(84, 20);
|
||||
this.txtPrice.Size = new System.Drawing.Size(104, 20);
|
||||
this.txtPrice.TabIndex = 3;
|
||||
this.txtPrice.Text = "0";
|
||||
//
|
||||
@ -159,9 +159,9 @@
|
||||
this.cmbVat.DataSource = this.bsVat;
|
||||
this.cmbVat.DisplayMember = "Name";
|
||||
this.cmbVat.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.cmbVat.Location = new System.Drawing.Point(213, 87);
|
||||
this.cmbVat.Location = new System.Drawing.Point(112, 114);
|
||||
this.cmbVat.Name = "cmbVat";
|
||||
this.cmbVat.Size = new System.Drawing.Size(88, 21);
|
||||
this.cmbVat.Size = new System.Drawing.Size(189, 21);
|
||||
this.cmbVat.TabIndex = 4;
|
||||
this.cmbVat.ValueMember = "TaxID";
|
||||
//
|
||||
@ -172,7 +172,7 @@
|
||||
// chkIsActive
|
||||
//
|
||||
this.chkIsActive.AutoSize = true;
|
||||
this.chkIsActive.Location = new System.Drawing.Point(191, 115);
|
||||
this.chkIsActive.Location = new System.Drawing.Point(307, 89);
|
||||
this.chkIsActive.Name = "chkIsActive";
|
||||
this.chkIsActive.Size = new System.Drawing.Size(67, 17);
|
||||
this.chkIsActive.TabIndex = 7;
|
||||
@ -182,15 +182,15 @@
|
||||
// txtServiceCharge
|
||||
//
|
||||
this.txtServiceCharge.AccessibleName = "Phone 1";
|
||||
this.txtServiceCharge.Location = new System.Drawing.Point(112, 113);
|
||||
this.txtServiceCharge.Location = new System.Drawing.Point(112, 141);
|
||||
this.txtServiceCharge.Name = "txtServiceCharge";
|
||||
this.txtServiceCharge.Size = new System.Drawing.Size(73, 20);
|
||||
this.txtServiceCharge.Size = new System.Drawing.Size(189, 20);
|
||||
this.txtServiceCharge.TabIndex = 5;
|
||||
this.txtServiceCharge.Text = "0";
|
||||
//
|
||||
// btnAddProductGroup
|
||||
//
|
||||
this.btnAddProductGroup.Location = new System.Drawing.Point(307, 139);
|
||||
this.btnAddProductGroup.Location = new System.Drawing.Point(307, 167);
|
||||
this.btnAddProductGroup.Name = "btnAddProductGroup";
|
||||
this.btnAddProductGroup.Size = new System.Drawing.Size(96, 21);
|
||||
this.btnAddProductGroup.TabIndex = 9;
|
||||
@ -203,7 +203,7 @@
|
||||
this.cmbProductGroup.DataSource = this.bsProductGroups;
|
||||
this.cmbProductGroup.DisplayMember = "Name";
|
||||
this.cmbProductGroup.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.cmbProductGroup.Location = new System.Drawing.Point(112, 139);
|
||||
this.cmbProductGroup.Location = new System.Drawing.Point(112, 167);
|
||||
this.cmbProductGroup.Name = "cmbProductGroup";
|
||||
this.cmbProductGroup.Size = new System.Drawing.Size(189, 21);
|
||||
this.cmbProductGroup.TabIndex = 8;
|
||||
@ -211,7 +211,7 @@
|
||||
//
|
||||
// btnCancel
|
||||
//
|
||||
this.btnCancel.Location = new System.Drawing.Point(328, 166);
|
||||
this.btnCancel.Location = new System.Drawing.Point(328, 195);
|
||||
this.btnCancel.Name = "btnCancel";
|
||||
this.btnCancel.Size = new System.Drawing.Size(75, 75);
|
||||
this.btnCancel.TabIndex = 11;
|
||||
@ -221,7 +221,7 @@
|
||||
//
|
||||
// btnOk
|
||||
//
|
||||
this.btnOk.Location = new System.Drawing.Point(247, 166);
|
||||
this.btnOk.Location = new System.Drawing.Point(247, 195);
|
||||
this.btnOk.Name = "btnOk";
|
||||
this.btnOk.Size = new System.Drawing.Size(75, 75);
|
||||
this.btnOk.TabIndex = 10;
|
||||
@ -232,7 +232,7 @@
|
||||
// txtFullPrice
|
||||
//
|
||||
this.txtFullPrice.AccessibleName = "";
|
||||
this.txtFullPrice.Location = new System.Drawing.Point(201, 64);
|
||||
this.txtFullPrice.Location = new System.Drawing.Point(222, 64);
|
||||
this.txtFullPrice.Name = "txtFullPrice";
|
||||
this.txtFullPrice.Size = new System.Drawing.Size(79, 20);
|
||||
this.txtFullPrice.TabIndex = 19;
|
||||
@ -245,7 +245,7 @@
|
||||
this.cmbServiceTax.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.cmbServiceTax.Location = new System.Drawing.Point(112, 87);
|
||||
this.cmbServiceTax.Name = "cmbServiceTax";
|
||||
this.cmbServiceTax.Size = new System.Drawing.Size(96, 21);
|
||||
this.cmbServiceTax.Size = new System.Drawing.Size(189, 21);
|
||||
this.cmbServiceTax.TabIndex = 20;
|
||||
this.cmbServiceTax.ValueMember = "TaxID";
|
||||
//
|
||||
@ -261,7 +261,7 @@
|
||||
// chkIsScTaxable
|
||||
//
|
||||
this.chkIsScTaxable.AutoSize = true;
|
||||
this.chkIsScTaxable.Location = new System.Drawing.Point(307, 89);
|
||||
this.chkIsScTaxable.Location = new System.Drawing.Point(307, 144);
|
||||
this.chkIsScTaxable.Name = "chkIsScTaxable";
|
||||
this.chkIsScTaxable.Size = new System.Drawing.Size(91, 17);
|
||||
this.chkIsScTaxable.TabIndex = 22;
|
||||
@ -271,7 +271,7 @@
|
||||
// chkIsNotAvailable
|
||||
//
|
||||
this.chkIsNotAvailable.AutoSize = true;
|
||||
this.chkIsNotAvailable.Location = new System.Drawing.Point(255, 114);
|
||||
this.chkIsNotAvailable.Location = new System.Drawing.Point(307, 116);
|
||||
this.chkIsNotAvailable.Name = "chkIsNotAvailable";
|
||||
this.chkIsNotAvailable.Size = new System.Drawing.Size(57, 17);
|
||||
this.chkIsNotAvailable.TabIndex = 23;
|
||||
@ -282,7 +282,7 @@
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(415, 276);
|
||||
this.ClientSize = new System.Drawing.Size(415, 282);
|
||||
this.Controls.Add(this.chkIsNotAvailable);
|
||||
this.Controls.Add(this.chkIsScTaxable);
|
||||
this.Controls.Add(this.label6);
|
||||
|
@ -10,6 +10,7 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
public partial class BillDetailsForm : Form
|
||||
{
|
||||
IList<BillDetail> _list;
|
||||
bool _loading = true;
|
||||
public BillDetailsForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
@ -22,6 +23,7 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
|
||||
private void ShowStatement()
|
||||
{
|
||||
if (_loading) return;
|
||||
if (DateTime.Today.Subtract(dtpStart.Value.Date).Days > 5 && !Session.IsAllowed("Accounts Audit"))
|
||||
return;
|
||||
_list = new SalesAnalysisBI().GetBillDetails(dtpStart.Value, dtpFinish.Value);
|
||||
@ -41,6 +43,7 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
dtpStart.Value = DateTime.Today;
|
||||
dtpFinish.Value = DateTime.Today;
|
||||
_loading = false;
|
||||
ShowStatement();
|
||||
}
|
||||
}
|
||||
|
@ -28,67 +28,16 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.label18 = new System.Windows.Forms.Label();
|
||||
this.txtClosingCash = new System.Windows.Forms.TextBox();
|
||||
this.dtpFinish = new System.Windows.Forms.DateTimePicker();
|
||||
this.dtpStart = new System.Windows.Forms.DateTimePicker();
|
||||
this.label17 = new System.Windows.Forms.Label();
|
||||
this.label16 = new System.Windows.Forms.Label();
|
||||
this.label15 = new System.Windows.Forms.Label();
|
||||
this.label14 = new System.Windows.Forms.Label();
|
||||
this.label13 = new System.Windows.Forms.Label();
|
||||
this.label12 = new System.Windows.Forms.Label();
|
||||
this.btnCalculate = new System.Windows.Forms.Button();
|
||||
this.btnPrint = new System.Windows.Forms.Button();
|
||||
this.txtStatus = new System.Windows.Forms.TextBox();
|
||||
this.txtSales = new System.Windows.Forms.TextBox();
|
||||
this.txtDeposited = new System.Windows.Forms.TextBox();
|
||||
this.txtPending = new System.Windows.Forms.TextBox();
|
||||
this.cmbCashier = new System.Windows.Forms.ComboBox();
|
||||
this.label10 = new System.Windows.Forms.Label();
|
||||
this.label9 = new System.Windows.Forms.Label();
|
||||
this.label8 = new System.Windows.Forms.Label();
|
||||
this.label7 = new System.Windows.Forms.Label();
|
||||
this.label6 = new System.Windows.Forms.Label();
|
||||
this.label5 = new System.Windows.Forms.Label();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.txtPayments = new System.Windows.Forms.TextBox();
|
||||
this.txtCashReceipts = new System.Windows.Forms.TextBox();
|
||||
this.txtCCReceipts = new System.Windows.Forms.TextBox();
|
||||
this.txtAdditionalVoids = new System.Windows.Forms.TextBox();
|
||||
this.txtVoidsInSystem = new System.Windows.Forms.TextBox();
|
||||
this.txtDiscounts = new System.Windows.Forms.TextBox();
|
||||
this.txtRates = new System.Windows.Forms.TextBox();
|
||||
this.txtAdvanceReceived = new System.Windows.Forms.TextBox();
|
||||
this.txtReceipts = new System.Windows.Forms.TextBox();
|
||||
this.txtOpening = new System.Windows.Forms.TextBox();
|
||||
this.label11 = new System.Windows.Forms.Label();
|
||||
this.NC = new System.Windows.Forms.Label();
|
||||
this.txtBillToCompany = new System.Windows.Forms.TextBox();
|
||||
this.txtNC = new System.Windows.Forms.TextBox();
|
||||
this.dgvSale = new System.Windows.Forms.DataGridView();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dgvSale)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// label18
|
||||
//
|
||||
this.label18.AutoSize = true;
|
||||
this.label18.Location = new System.Drawing.Point(12, 432);
|
||||
this.label18.Name = "label18";
|
||||
this.label18.Size = new System.Drawing.Size(68, 13);
|
||||
this.label18.TabIndex = 71;
|
||||
this.label18.Text = "Closing Cash";
|
||||
//
|
||||
// txtClosingCash
|
||||
//
|
||||
this.txtClosingCash.Location = new System.Drawing.Point(99, 429);
|
||||
this.txtClosingCash.Name = "txtClosingCash";
|
||||
this.txtClosingCash.ReadOnly = true;
|
||||
this.txtClosingCash.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
|
||||
this.txtClosingCash.Size = new System.Drawing.Size(200, 20);
|
||||
this.txtClosingCash.TabIndex = 55;
|
||||
//
|
||||
// dtpFinish
|
||||
//
|
||||
this.dtpFinish.Location = new System.Drawing.Point(189, 12);
|
||||
@ -105,73 +54,11 @@
|
||||
this.dtpStart.TabIndex = 41;
|
||||
this.dtpStart.ValueChanged += new System.EventHandler(this.DtpStartValueChanged);
|
||||
//
|
||||
// label17
|
||||
//
|
||||
this.label17.AutoSize = true;
|
||||
this.label17.Location = new System.Drawing.Point(12, 328);
|
||||
this.label17.Name = "label17";
|
||||
this.label17.Size = new System.Drawing.Size(85, 13);
|
||||
this.label17.TabIndex = 67;
|
||||
this.label17.Text = "Discounts Given";
|
||||
//
|
||||
// label16
|
||||
//
|
||||
this.label16.AutoSize = true;
|
||||
this.label16.Location = new System.Drawing.Point(12, 354);
|
||||
this.label16.Name = "label16";
|
||||
this.label16.Size = new System.Drawing.Size(81, 13);
|
||||
this.label16.TabIndex = 68;
|
||||
this.label16.Text = "Rates Changed";
|
||||
//
|
||||
// label15
|
||||
//
|
||||
this.label15.AutoSize = true;
|
||||
this.label15.Location = new System.Drawing.Point(12, 406);
|
||||
this.label15.Name = "label15";
|
||||
this.label15.Size = new System.Drawing.Size(53, 13);
|
||||
this.label15.TabIndex = 70;
|
||||
this.label15.Text = "Net Sales";
|
||||
//
|
||||
// label14
|
||||
//
|
||||
this.label14.AutoSize = true;
|
||||
this.label14.Location = new System.Drawing.Point(12, 458);
|
||||
this.label14.Name = "label14";
|
||||
this.label14.Size = new System.Drawing.Size(82, 13);
|
||||
this.label14.TabIndex = 72;
|
||||
this.label14.Text = "Cash Deposited";
|
||||
//
|
||||
// label13
|
||||
//
|
||||
this.label13.AutoSize = true;
|
||||
this.label13.Location = new System.Drawing.Point(12, 484);
|
||||
this.label13.Name = "label13";
|
||||
this.label13.Size = new System.Drawing.Size(37, 13);
|
||||
this.label13.TabIndex = 73;
|
||||
this.label13.Text = "Status";
|
||||
//
|
||||
// label12
|
||||
//
|
||||
this.label12.AutoSize = true;
|
||||
this.label12.Location = new System.Drawing.Point(12, 380);
|
||||
this.label12.Name = "label12";
|
||||
this.label12.Size = new System.Drawing.Size(62, 13);
|
||||
this.label12.TabIndex = 69;
|
||||
this.label12.Text = "Bill Pending";
|
||||
//
|
||||
// btnCalculate
|
||||
//
|
||||
this.btnCalculate.Location = new System.Drawing.Point(12, 507);
|
||||
this.btnCalculate.Name = "btnCalculate";
|
||||
this.btnCalculate.Size = new System.Drawing.Size(287, 23);
|
||||
this.btnCalculate.TabIndex = 39;
|
||||
this.btnCalculate.Text = "&Calculate";
|
||||
this.btnCalculate.UseVisualStyleBackColor = true;
|
||||
this.btnCalculate.Click += new System.EventHandler(this.BtnCalculateClick);
|
||||
//
|
||||
// btnPrint
|
||||
//
|
||||
this.btnPrint.Location = new System.Drawing.Point(12, 536);
|
||||
this.btnPrint.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnPrint.Location = new System.Drawing.Point(15, 262);
|
||||
this.btnPrint.Name = "btnPrint";
|
||||
this.btnPrint.Size = new System.Drawing.Size(287, 23);
|
||||
this.btnPrint.TabIndex = 40;
|
||||
@ -179,40 +66,6 @@
|
||||
this.btnPrint.UseVisualStyleBackColor = true;
|
||||
this.btnPrint.Click += new System.EventHandler(this.BtnPrintClick);
|
||||
//
|
||||
// txtStatus
|
||||
//
|
||||
this.txtStatus.Location = new System.Drawing.Point(99, 481);
|
||||
this.txtStatus.Name = "txtStatus";
|
||||
this.txtStatus.ReadOnly = true;
|
||||
this.txtStatus.Size = new System.Drawing.Size(200, 20);
|
||||
this.txtStatus.TabIndex = 56;
|
||||
//
|
||||
// txtSales
|
||||
//
|
||||
this.txtSales.Location = new System.Drawing.Point(99, 403);
|
||||
this.txtSales.Name = "txtSales";
|
||||
this.txtSales.ReadOnly = true;
|
||||
this.txtSales.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
|
||||
this.txtSales.Size = new System.Drawing.Size(200, 20);
|
||||
this.txtSales.TabIndex = 54;
|
||||
//
|
||||
// txtDeposited
|
||||
//
|
||||
this.txtDeposited.Location = new System.Drawing.Point(99, 455);
|
||||
this.txtDeposited.Name = "txtDeposited";
|
||||
this.txtDeposited.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
|
||||
this.txtDeposited.Size = new System.Drawing.Size(200, 20);
|
||||
this.txtDeposited.TabIndex = 38;
|
||||
//
|
||||
// txtPending
|
||||
//
|
||||
this.txtPending.Location = new System.Drawing.Point(99, 377);
|
||||
this.txtPending.Name = "txtPending";
|
||||
this.txtPending.ReadOnly = true;
|
||||
this.txtPending.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
|
||||
this.txtPending.Size = new System.Drawing.Size(200, 20);
|
||||
this.txtPending.TabIndex = 53;
|
||||
//
|
||||
// cmbCashier
|
||||
//
|
||||
this.cmbCashier.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
@ -241,255 +94,44 @@
|
||||
this.label9.TabIndex = 58;
|
||||
this.label9.Text = "Cashier";
|
||||
//
|
||||
// label8
|
||||
// dgvSale
|
||||
//
|
||||
this.label8.AutoSize = true;
|
||||
this.label8.Location = new System.Drawing.Point(12, 302);
|
||||
this.label8.Name = "label8";
|
||||
this.label8.Size = new System.Drawing.Size(81, 13);
|
||||
this.label8.TabIndex = 66;
|
||||
this.label8.Text = "Voids in System";
|
||||
//
|
||||
// label7
|
||||
//
|
||||
this.label7.AutoSize = true;
|
||||
this.label7.Location = new System.Drawing.Point(12, 276);
|
||||
this.label7.Name = "label7";
|
||||
this.label7.Size = new System.Drawing.Size(82, 13);
|
||||
this.label7.TabIndex = 65;
|
||||
this.label7.Text = "Additional Voids";
|
||||
//
|
||||
// label6
|
||||
//
|
||||
this.label6.AutoSize = true;
|
||||
this.label6.Location = new System.Drawing.Point(12, 250);
|
||||
this.label6.Name = "label6";
|
||||
this.label6.Size = new System.Drawing.Size(53, 13);
|
||||
this.label6.TabIndex = 64;
|
||||
this.label6.Text = "Payments";
|
||||
//
|
||||
// label5
|
||||
//
|
||||
this.label5.AutoSize = true;
|
||||
this.label5.Location = new System.Drawing.Point(12, 224);
|
||||
this.label5.Name = "label5";
|
||||
this.label5.Size = new System.Drawing.Size(76, 13);
|
||||
this.label5.TabIndex = 63;
|
||||
this.label5.Text = "Cash Receipts";
|
||||
//
|
||||
// label4
|
||||
//
|
||||
this.label4.AutoSize = true;
|
||||
this.label4.Location = new System.Drawing.Point(12, 146);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(66, 13);
|
||||
this.label4.TabIndex = 62;
|
||||
this.label4.Text = "CC Receipts";
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(12, 120);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(78, 13);
|
||||
this.label3.TabIndex = 61;
|
||||
this.label3.Text = "Adv. Received";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(12, 94);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(49, 13);
|
||||
this.label2.TabIndex = 60;
|
||||
this.label2.Text = "Receipts";
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(12, 68);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(47, 13);
|
||||
this.label1.TabIndex = 59;
|
||||
this.label1.Text = "Opening";
|
||||
//
|
||||
// txtPayments
|
||||
//
|
||||
this.txtPayments.Location = new System.Drawing.Point(99, 247);
|
||||
this.txtPayments.Name = "txtPayments";
|
||||
this.txtPayments.ReadOnly = true;
|
||||
this.txtPayments.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
|
||||
this.txtPayments.Size = new System.Drawing.Size(200, 20);
|
||||
this.txtPayments.TabIndex = 48;
|
||||
//
|
||||
// txtCashReceipts
|
||||
//
|
||||
this.txtCashReceipts.Location = new System.Drawing.Point(99, 221);
|
||||
this.txtCashReceipts.Name = "txtCashReceipts";
|
||||
this.txtCashReceipts.ReadOnly = true;
|
||||
this.txtCashReceipts.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
|
||||
this.txtCashReceipts.Size = new System.Drawing.Size(200, 20);
|
||||
this.txtCashReceipts.TabIndex = 47;
|
||||
//
|
||||
// txtCCReceipts
|
||||
//
|
||||
this.txtCCReceipts.Location = new System.Drawing.Point(99, 143);
|
||||
this.txtCCReceipts.Name = "txtCCReceipts";
|
||||
this.txtCCReceipts.ReadOnly = true;
|
||||
this.txtCCReceipts.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
|
||||
this.txtCCReceipts.Size = new System.Drawing.Size(200, 20);
|
||||
this.txtCCReceipts.TabIndex = 46;
|
||||
//
|
||||
// txtAdditionalVoids
|
||||
//
|
||||
this.txtAdditionalVoids.Location = new System.Drawing.Point(99, 273);
|
||||
this.txtAdditionalVoids.Name = "txtAdditionalVoids";
|
||||
this.txtAdditionalVoids.ReadOnly = true;
|
||||
this.txtAdditionalVoids.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
|
||||
this.txtAdditionalVoids.Size = new System.Drawing.Size(200, 20);
|
||||
this.txtAdditionalVoids.TabIndex = 49;
|
||||
//
|
||||
// txtVoidsInSystem
|
||||
//
|
||||
this.txtVoidsInSystem.Location = new System.Drawing.Point(99, 299);
|
||||
this.txtVoidsInSystem.Name = "txtVoidsInSystem";
|
||||
this.txtVoidsInSystem.ReadOnly = true;
|
||||
this.txtVoidsInSystem.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
|
||||
this.txtVoidsInSystem.Size = new System.Drawing.Size(200, 20);
|
||||
this.txtVoidsInSystem.TabIndex = 50;
|
||||
//
|
||||
// txtDiscounts
|
||||
//
|
||||
this.txtDiscounts.Location = new System.Drawing.Point(99, 325);
|
||||
this.txtDiscounts.Name = "txtDiscounts";
|
||||
this.txtDiscounts.ReadOnly = true;
|
||||
this.txtDiscounts.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
|
||||
this.txtDiscounts.Size = new System.Drawing.Size(200, 20);
|
||||
this.txtDiscounts.TabIndex = 51;
|
||||
//
|
||||
// txtRates
|
||||
//
|
||||
this.txtRates.Location = new System.Drawing.Point(99, 351);
|
||||
this.txtRates.Name = "txtRates";
|
||||
this.txtRates.ReadOnly = true;
|
||||
this.txtRates.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
|
||||
this.txtRates.Size = new System.Drawing.Size(200, 20);
|
||||
this.txtRates.TabIndex = 52;
|
||||
//
|
||||
// txtAdvanceReceived
|
||||
//
|
||||
this.txtAdvanceReceived.Location = new System.Drawing.Point(99, 117);
|
||||
this.txtAdvanceReceived.Name = "txtAdvanceReceived";
|
||||
this.txtAdvanceReceived.ReadOnly = true;
|
||||
this.txtAdvanceReceived.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
|
||||
this.txtAdvanceReceived.Size = new System.Drawing.Size(200, 20);
|
||||
this.txtAdvanceReceived.TabIndex = 45;
|
||||
//
|
||||
// txtReceipts
|
||||
//
|
||||
this.txtReceipts.Location = new System.Drawing.Point(99, 91);
|
||||
this.txtReceipts.Name = "txtReceipts";
|
||||
this.txtReceipts.ReadOnly = true;
|
||||
this.txtReceipts.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
|
||||
this.txtReceipts.Size = new System.Drawing.Size(200, 20);
|
||||
this.txtReceipts.TabIndex = 44;
|
||||
//
|
||||
// txtOpening
|
||||
//
|
||||
this.txtOpening.Location = new System.Drawing.Point(99, 65);
|
||||
this.txtOpening.Name = "txtOpening";
|
||||
this.txtOpening.ReadOnly = true;
|
||||
this.txtOpening.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
|
||||
this.txtOpening.Size = new System.Drawing.Size(200, 20);
|
||||
this.txtOpening.TabIndex = 43;
|
||||
//
|
||||
// label11
|
||||
//
|
||||
this.label11.AutoSize = true;
|
||||
this.label11.Location = new System.Drawing.Point(12, 198);
|
||||
this.label11.Name = "label11";
|
||||
this.label11.Size = new System.Drawing.Size(79, 13);
|
||||
this.label11.TabIndex = 77;
|
||||
this.label11.Text = "Bill to Company";
|
||||
//
|
||||
// NC
|
||||
//
|
||||
this.NC.AutoSize = true;
|
||||
this.NC.Location = new System.Drawing.Point(12, 172);
|
||||
this.NC.Name = "NC";
|
||||
this.NC.Size = new System.Drawing.Size(58, 13);
|
||||
this.NC.TabIndex = 76;
|
||||
this.NC.Text = "No Charge";
|
||||
//
|
||||
// txtBillToCompany
|
||||
//
|
||||
this.txtBillToCompany.Location = new System.Drawing.Point(99, 195);
|
||||
this.txtBillToCompany.Name = "txtBillToCompany";
|
||||
this.txtBillToCompany.ReadOnly = true;
|
||||
this.txtBillToCompany.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
|
||||
this.txtBillToCompany.Size = new System.Drawing.Size(200, 20);
|
||||
this.txtBillToCompany.TabIndex = 75;
|
||||
//
|
||||
// txtNC
|
||||
//
|
||||
this.txtNC.Location = new System.Drawing.Point(99, 169);
|
||||
this.txtNC.Name = "txtNC";
|
||||
this.txtNC.ReadOnly = true;
|
||||
this.txtNC.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
|
||||
this.txtNC.Size = new System.Drawing.Size(200, 20);
|
||||
this.txtNC.TabIndex = 74;
|
||||
this.dgvSale.AllowUserToAddRows = false;
|
||||
this.dgvSale.AllowUserToDeleteRows = false;
|
||||
this.dgvSale.AllowUserToResizeRows = false;
|
||||
this.dgvSale.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.dgvSale.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.dgvSale.Location = new System.Drawing.Point(15, 65);
|
||||
this.dgvSale.MultiSelect = false;
|
||||
this.dgvSale.Name = "dgvSale";
|
||||
this.dgvSale.ReadOnly = true;
|
||||
this.dgvSale.RowHeadersVisible = false;
|
||||
this.dgvSale.RowTemplate.Height = 19;
|
||||
this.dgvSale.RowTemplate.ReadOnly = true;
|
||||
this.dgvSale.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
|
||||
this.dgvSale.Size = new System.Drawing.Size(287, 187);
|
||||
this.dgvSale.TabIndex = 59;
|
||||
//
|
||||
// CashierCheckoutForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(311, 571);
|
||||
this.Controls.Add(this.label11);
|
||||
this.Controls.Add(this.NC);
|
||||
this.Controls.Add(this.txtBillToCompany);
|
||||
this.Controls.Add(this.txtNC);
|
||||
this.Controls.Add(this.label18);
|
||||
this.Controls.Add(this.txtClosingCash);
|
||||
this.ClientSize = new System.Drawing.Size(311, 297);
|
||||
this.Controls.Add(this.dgvSale);
|
||||
this.Controls.Add(this.dtpFinish);
|
||||
this.Controls.Add(this.dtpStart);
|
||||
this.Controls.Add(this.label17);
|
||||
this.Controls.Add(this.label16);
|
||||
this.Controls.Add(this.label15);
|
||||
this.Controls.Add(this.label14);
|
||||
this.Controls.Add(this.label13);
|
||||
this.Controls.Add(this.label12);
|
||||
this.Controls.Add(this.btnCalculate);
|
||||
this.Controls.Add(this.btnPrint);
|
||||
this.Controls.Add(this.txtStatus);
|
||||
this.Controls.Add(this.txtSales);
|
||||
this.Controls.Add(this.txtDeposited);
|
||||
this.Controls.Add(this.txtPending);
|
||||
this.Controls.Add(this.cmbCashier);
|
||||
this.Controls.Add(this.label10);
|
||||
this.Controls.Add(this.label9);
|
||||
this.Controls.Add(this.label8);
|
||||
this.Controls.Add(this.label7);
|
||||
this.Controls.Add(this.label6);
|
||||
this.Controls.Add(this.label5);
|
||||
this.Controls.Add(this.label4);
|
||||
this.Controls.Add(this.label3);
|
||||
this.Controls.Add(this.label2);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.txtPayments);
|
||||
this.Controls.Add(this.txtCashReceipts);
|
||||
this.Controls.Add(this.txtCCReceipts);
|
||||
this.Controls.Add(this.txtAdditionalVoids);
|
||||
this.Controls.Add(this.txtVoidsInSystem);
|
||||
this.Controls.Add(this.txtDiscounts);
|
||||
this.Controls.Add(this.txtRates);
|
||||
this.Controls.Add(this.txtAdvanceReceived);
|
||||
this.Controls.Add(this.txtReceipts);
|
||||
this.Controls.Add(this.txtOpening);
|
||||
this.MaximizeBox = false;
|
||||
this.Name = "CashierCheckoutForm";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "Cashier Checkout Form";
|
||||
this.Load += new System.EventHandler(this.CashierCheckoutFormLoad);
|
||||
this.Load += new System.EventHandler(this.CashierCheckoutForm_Load);
|
||||
((System.ComponentModel.ISupportInitialize)(this.dgvSale)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
@ -497,46 +139,12 @@
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Label label18;
|
||||
private System.Windows.Forms.TextBox txtClosingCash;
|
||||
private System.Windows.Forms.DateTimePicker dtpFinish;
|
||||
private System.Windows.Forms.DateTimePicker dtpStart;
|
||||
private System.Windows.Forms.Label label17;
|
||||
private System.Windows.Forms.Label label16;
|
||||
private System.Windows.Forms.Label label15;
|
||||
private System.Windows.Forms.Label label14;
|
||||
private System.Windows.Forms.Label label13;
|
||||
private System.Windows.Forms.Label label12;
|
||||
private System.Windows.Forms.Button btnCalculate;
|
||||
private System.Windows.Forms.Button btnPrint;
|
||||
private System.Windows.Forms.TextBox txtStatus;
|
||||
private System.Windows.Forms.TextBox txtSales;
|
||||
private System.Windows.Forms.TextBox txtDeposited;
|
||||
private System.Windows.Forms.TextBox txtPending;
|
||||
private System.Windows.Forms.ComboBox cmbCashier;
|
||||
private System.Windows.Forms.Label label10;
|
||||
private System.Windows.Forms.Label label9;
|
||||
private System.Windows.Forms.Label label8;
|
||||
private System.Windows.Forms.Label label7;
|
||||
private System.Windows.Forms.Label label6;
|
||||
private System.Windows.Forms.Label label5;
|
||||
private System.Windows.Forms.Label label4;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.TextBox txtPayments;
|
||||
private System.Windows.Forms.TextBox txtCashReceipts;
|
||||
private System.Windows.Forms.TextBox txtCCReceipts;
|
||||
private System.Windows.Forms.TextBox txtAdditionalVoids;
|
||||
private System.Windows.Forms.TextBox txtVoidsInSystem;
|
||||
private System.Windows.Forms.TextBox txtDiscounts;
|
||||
private System.Windows.Forms.TextBox txtRates;
|
||||
private System.Windows.Forms.TextBox txtAdvanceReceived;
|
||||
private System.Windows.Forms.TextBox txtReceipts;
|
||||
private System.Windows.Forms.TextBox txtOpening;
|
||||
private System.Windows.Forms.Label label11;
|
||||
private System.Windows.Forms.Label NC;
|
||||
private System.Windows.Forms.TextBox txtBillToCompany;
|
||||
private System.Windows.Forms.TextBox txtNC;
|
||||
private System.Windows.Forms.DataGridView dgvSale;
|
||||
}
|
||||
}
|
@ -1,7 +1,10 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using Tanshu.Accounts.Repository;
|
||||
using Tanshu.Accounts.Print;
|
||||
using Tanshu.Accounts.Entities;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
@ -15,7 +18,7 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void CashierCheckoutFormLoad(object sender, EventArgs e)
|
||||
private void CashierCheckoutForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
dtpStart.Format = DateTimePickerFormat.Custom;
|
||||
dtpStart.CustomFormat = "dd-MMM-yyyy";
|
||||
@ -23,42 +26,38 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
dtpFinish.Format = DateTimePickerFormat.Custom;
|
||||
dtpFinish.CustomFormat = "dd-MMM-yyyy";
|
||||
dtpFinish.Value = DateTime.Now.Date;
|
||||
FillUsers();
|
||||
_loading = false;
|
||||
FillUsers();
|
||||
}
|
||||
|
||||
private void FillUsers()
|
||||
{
|
||||
var loading = _loading;
|
||||
_loading = true;
|
||||
cmbCashier.DisplayMember = "Name";
|
||||
cmbCashier.ValueMember = "UserID";
|
||||
using (var bi = new UserBI())
|
||||
cmbCashier.DataSource = bi.ListActive(dtpStart.Value.Date.AddHours(7), dtpFinish.Value.Date.AddDays(1).AddHours(7));
|
||||
_loading = loading;
|
||||
_loading = false;
|
||||
}
|
||||
|
||||
private void CmbCashierSelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
EmployeeStatus();
|
||||
//log.Warn(string.Format("User Checkout: {0} by {1}", coProxy.Cashier, Session.User.Name));
|
||||
ShowStatement();
|
||||
}
|
||||
|
||||
private void EmployeeStatus()
|
||||
private void ShowStatement()
|
||||
{
|
||||
if (_loading || cmbCashier.SelectedValue == null)
|
||||
return;
|
||||
_coProxy = new CheckoutBI((Guid)cmbCashier.SelectedValue, dtpStart.Value, dtpFinish.Value);
|
||||
txtCCReceipts.Text = string.Format("{0:#,##0.00}", _coProxy.CcReceipts);
|
||||
txtNC.Text = string.Format("{0:#,##0.00}", _coProxy.NcReceipts);
|
||||
txtBillToCompany.Text = string.Format("{0:#,##0.00}", _coProxy.BtcReceipts);
|
||||
txtCashReceipts.Text = string.Format("{0:#,##0.00}", _coProxy.CashReceipts);
|
||||
txtVoidsInSystem.Text = string.Format("{0:#,##0.00}", _coProxy.VoidsInSystem);
|
||||
txtDiscounts.Text = string.Format("{0:#,##0.00}", _coProxy.Discount);
|
||||
txtPending.Text = string.Format("{0:#,##0.00}", _coProxy.PendingBills);
|
||||
txtSales.Text = string.Format("{0:#,##0.00}", _coProxy.CashReceipts);
|
||||
txtClosingCash.Text = string.Format("{0:#,##0.00}", _coProxy.ClosingBalance);
|
||||
txtStatus.Text = _coProxy.Status;
|
||||
var list = _coProxy.amounts.ToList() ;
|
||||
dgvSale.DataSource = list;
|
||||
dgvSale.AutoGenerateColumns = true;
|
||||
dgvSale.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
|
||||
dgvSale.Columns[0].HeaderText = "Item";
|
||||
dgvSale.Columns[1].HeaderText = "Amount";
|
||||
dgvSale.Columns[1].DefaultCellStyle.Format = "#,##0.00;(#,##0.00);0";
|
||||
dgvSale.Columns[1].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
|
||||
}
|
||||
|
||||
private void DtpStartValueChanged(object sender, EventArgs e)
|
||||
@ -71,16 +70,6 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
FillUsers();
|
||||
}
|
||||
|
||||
private void BtnCalculateClick(object sender, EventArgs e)
|
||||
{
|
||||
decimal deposited = 0;
|
||||
if (!decimal.TryParse(txtDeposited.Text, out deposited))
|
||||
deposited = 0;
|
||||
|
||||
_coProxy.Calculate();
|
||||
txtStatus.Text = _coProxy.Status;
|
||||
}
|
||||
|
||||
private void BtnPrintClick(object sender, EventArgs e)
|
||||
{
|
||||
Thermal.PrintClosing(_coProxy);
|
||||
|
@ -9,11 +9,25 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
public partial class frmSaleAnalysisForm : Form
|
||||
{
|
||||
IList<SalesAnalysis> _list;
|
||||
bool _loading;
|
||||
public frmSaleAnalysisForm()
|
||||
{
|
||||
_loading = true;
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void SaleAnalysisForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
dtpStart.Format = DateTimePickerFormat.Custom;
|
||||
dtpStart.CustomFormat = "dd-MMM-yyyy";
|
||||
dtpStart.Value = DateTime.Now.Date;
|
||||
dtpFinish.Format = DateTimePickerFormat.Custom;
|
||||
dtpFinish.CustomFormat = "dd-MMM-yyyy";
|
||||
dtpFinish.Value = DateTime.Now.Date;
|
||||
_loading = false;
|
||||
ShowStatement();
|
||||
}
|
||||
|
||||
private void dtpStart_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
ShowStatement();
|
||||
@ -21,6 +35,8 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
|
||||
private void ShowStatement()
|
||||
{
|
||||
if (_loading)
|
||||
return;
|
||||
if (DateTime.Today.Subtract(dtpStart.Value.Date).Days > 5 &&
|
||||
!Session.IsAllowed("Accounts Audit"))
|
||||
return;
|
||||
@ -39,13 +55,6 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
ShowStatement();
|
||||
}
|
||||
|
||||
private void Sale_Analysis_Form_Load(object sender, EventArgs e)
|
||||
{
|
||||
dtpStart.Value = DateTime.Today;
|
||||
dtpFinish.Value = DateTime.Today;
|
||||
ShowStatement();
|
||||
}
|
||||
|
||||
private void btnPrint_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_list != null)
|
||||
|
@ -110,7 +110,7 @@
|
||||
this.Name = "frmSaleAnalysisForm";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "Sale Analysis Form";
|
||||
this.Load += new System.EventHandler(this.Sale_Analysis_Form_Load);
|
||||
this.Load += new System.EventHandler(this.SaleAnalysisForm_Load);
|
||||
((System.ComponentModel.ISupportInitialize)(this.dgvSale)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
@ -45,13 +45,10 @@ namespace Tanshu.Accounts.PointOfSale.Sales
|
||||
}
|
||||
else
|
||||
{
|
||||
if (voucher.BillID.HasValue)
|
||||
{
|
||||
txtBillID.Text = voucher.BillID.Value.ToString();
|
||||
}
|
||||
txtBillID.Text = voucher.FullBillID;
|
||||
txtKotID.Text = "K-" + voucher.KotID.ToString();
|
||||
txtCreationDate.Text = voucher.CreationDate.ToString("HH:mm dd-MMM-yyyy");
|
||||
txtDate.Text = voucher.Date.Value.ToString("HH:mm dd-MMM-yyyy");
|
||||
txtDate.Text = voucher.Date.ToString("HH:mm dd-MMM-yyyy");
|
||||
txtLastEditDate.Text = voucher.LastEditDate.ToString("HH:mm dd-MMM-yyyy");
|
||||
btnCustomer.Text = voucher.Customer.Name;
|
||||
txtTableID.Text = voucher.Table.Name;
|
||||
|
@ -51,10 +51,6 @@
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\Include\NHibernate\Iesi.Collections.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\Include\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NHibernate, Version=3.0.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\Include\NHibernate\NHibernate.dll</HintPath>
|
||||
|
@ -92,44 +92,18 @@ namespace Tanshu.Accounts.Print
|
||||
billText += string.Format("\n\r{0:dd-MMM-yy} To {1:dd-MMM-yy} @ {2:dd-MMM-yyyy HH:mm}",
|
||||
details.StartDate, details.FinishDate, DateTime.Now);
|
||||
billText += DrawLine;
|
||||
billText += string.Format("\n\rCC Receipts : {0,26:#,##0.00}", details.CcReceipts);
|
||||
billText += string.Format("\n\rNC Amount : {0,26:#,##0.00}", details.NcReceipts);
|
||||
billText += string.Format("\n\rBTC Amount : {0,26:#,##0.00}", details.BtcReceipts);
|
||||
billText += string.Format("\n\rCash Amount : {0,26:#,##0.00}", details.CashReceipts);
|
||||
billText += string.Format("\n\rVoids in Sys. : {0,26:#,##0.00}", details.VoidsInSystem);
|
||||
billText += string.Format("\n\rDiscounts : {0,26:#,##0.00}", details.Discount);
|
||||
billText += string.Format("\n\rPending Bills : {0,26:#,##0.00}", details.PendingBills);
|
||||
billText += string.Format("\n\rNet Sales : {0,26:#,##0.00}", details.CashReceipts);
|
||||
billText += string.Format("\n\rClosing Bal. : {0,26:#,##0.00}", details.ClosingBalance);
|
||||
billText += DrawLine;
|
||||
billText += string.Format("\n\rOld Pending : {0,26:#,##0.00}", details.OldPending);
|
||||
billText += string.Format("\n\rOld Receipts : {0,26:#,##0.00}", details.OldReceipts);
|
||||
billText += string.Format("\n\rOld Voided : {0,26:#,##0.00}", details.OldVoided);
|
||||
billText += DrawEqual;
|
||||
billText += "\n\r" + FormatText(details.Status, 42, Align.Centre);
|
||||
foreach (var item in details.amounts)
|
||||
{
|
||||
billText += string.Format("\n\r{0} : {1,26:#,##0.00}", item.Key.Display(), item.Value);
|
||||
}
|
||||
billText += DrawEqual;
|
||||
billText += string.Format("\n\rActive Cashiers : {0}", details.Cashiers);
|
||||
|
||||
if (details.PendingString.Length > 0)
|
||||
billText += details.PendingString;
|
||||
foreach (var item in details.info.Where(x => x.Key.Print()))
|
||||
{
|
||||
billText += item.Value;
|
||||
}
|
||||
|
||||
if (details.CcString.Length > 0)
|
||||
billText += details.CcString;
|
||||
|
||||
if (details.NcString.Length > 0)
|
||||
billText += details.NcString;
|
||||
|
||||
if (details.BtcString.Length > 0)
|
||||
billText += details.BtcString;
|
||||
|
||||
if (details.VoidsString.Length > 0)
|
||||
billText += details.VoidsString;
|
||||
|
||||
if (details.PaymentString.Length > 0)
|
||||
billText += details.PaymentString;
|
||||
|
||||
if (details.DiscountString.Length > 0)
|
||||
billText += details.DiscountString;
|
||||
return PrintRaw(Cache.BasePrinter, billText, "Closing");
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq.Expressions;
|
||||
using System.Configuration;
|
||||
using Tanshu.Accounts.Entities.Auth;
|
||||
|
||||
namespace Tanshu.Accounts.Repository
|
||||
{
|
||||
@ -14,6 +15,9 @@ namespace Tanshu.Accounts.Repository
|
||||
private static Dictionary<int, PrintLocation> locations = new Dictionary<int, PrintLocation>();
|
||||
private static string location = ConfigurationManager.AppSettings["Location"].ToLowerInvariant();
|
||||
|
||||
private static IList<Role> roles = null;
|
||||
|
||||
private static bool _log = false;
|
||||
public static IList<ProductGroup> ProductGroups()
|
||||
{
|
||||
if (cache == null)
|
||||
@ -58,10 +62,31 @@ namespace Tanshu.Accounts.Repository
|
||||
}
|
||||
return locations[location.GetHashCode() ^ productGroupID.GetHashCode()];
|
||||
}
|
||||
public static IList<Role> UserRoles(Guid userID)
|
||||
{
|
||||
if (roles == null)
|
||||
{
|
||||
using (var bi = new UserBI())
|
||||
{
|
||||
roles = bi.Roles(userID);
|
||||
}
|
||||
}
|
||||
return roles;
|
||||
}
|
||||
public static void ClearRoles()
|
||||
{
|
||||
roles = null;
|
||||
}
|
||||
|
||||
public static void Invalidate()
|
||||
{
|
||||
cache = null;
|
||||
locations = new Dictionary<int, PrintLocation>();
|
||||
}
|
||||
public static bool Log
|
||||
{
|
||||
get { return _log; }
|
||||
set { _log = value; }
|
||||
}
|
||||
}
|
||||
}
|
@ -6,317 +6,107 @@ using Tanshu.Accounts.Entities.Auth;
|
||||
using NHibernate.Criterion;
|
||||
using Tanshu.Accounts.Contracts;
|
||||
using Tanshu.Common.Helpers;
|
||||
using NHibernate;
|
||||
using NHibernate.Transform;
|
||||
|
||||
namespace Tanshu.Accounts.Repository
|
||||
{
|
||||
public class CheckoutBI
|
||||
{
|
||||
#region Properties
|
||||
public decimal CcReceipts { get; private set; }
|
||||
public decimal NcReceipts { get; private set; }
|
||||
public decimal BtcReceipts { get; private set; }
|
||||
public decimal VoidsInSystem { get; private set; }
|
||||
public decimal Discount { get; private set; }
|
||||
public decimal PendingBills { get; private set; }
|
||||
public decimal CashReceipts { get; private set; }
|
||||
public decimal ClosingBalance { get; private set; }
|
||||
public decimal Excess { get; private set; }
|
||||
public string Status { get; private set; }
|
||||
public Dictionary<SettleOption, int> amounts = new Dictionary<SettleOption, int>();
|
||||
public Dictionary<SettleOption, string> info = new Dictionary<SettleOption, string>();
|
||||
public string Cashiers { get; private set; }
|
||||
public User Cashier { get; private set; }
|
||||
|
||||
public decimal OldPending { get; private set; }
|
||||
public decimal OldReceipts { get; private set; }
|
||||
public decimal OldVoided { get; private set; }
|
||||
|
||||
public DateTime StartDate { get; private set; }
|
||||
public DateTime FinishDate { get; private set; }
|
||||
|
||||
public string PendingString { get; private set; }
|
||||
public string CcString { get; private set; }
|
||||
public string NcString { get; private set; }
|
||||
public string BtcString { get; private set; }
|
||||
public string VoidsString { get; private set; }
|
||||
public string DiscountString { get; private set; }
|
||||
|
||||
public string PaymentString { get; private set; }
|
||||
public string Manager
|
||||
{
|
||||
get { return Session.User.Name; }
|
||||
}
|
||||
#endregion
|
||||
protected readonly ISession _session;
|
||||
|
||||
private IDictionary<SettleOption, IList<Voucher>> vList = new Dictionary<SettleOption, IList<Voucher>>();
|
||||
public CheckoutBI(Guid cashier, DateTime startDate, DateTime finishDate)
|
||||
{
|
||||
using (var session = SessionManager.Session)
|
||||
{
|
||||
using (var bi = new UserBI())
|
||||
this.Cashier = bi.Get(x => x.UserID == cashier);
|
||||
this.StartDate = startDate.Date.AddHours(6);
|
||||
this.FinishDate = finishDate.Date.AddDays(1).AddHours(5);
|
||||
_session = SessionManager.Session;
|
||||
StartDate = startDate.Date.AddHours(6);
|
||||
FinishDate = finishDate.Date.AddDays(1).AddHours(5);
|
||||
|
||||
string info;
|
||||
PendingBills = GetPrintInfo(out info, SettleOption.Unsettled);
|
||||
PendingString = info;
|
||||
CcReceipts = GetPrintInfo(out info, SettleOption.CreditCard);
|
||||
CcString = info;
|
||||
NcReceipts = GetPrintInfo(out info, SettleOption.NoCharge);
|
||||
NcString = info;
|
||||
BtcReceipts = GetPrintInfo(out info, SettleOption.BillToCompany);
|
||||
BtcString = info;
|
||||
VoidsInSystem = GetVoids(out info);
|
||||
VoidsString = info;
|
||||
// Opening = dao.GetOpenings();
|
||||
// Receipts = GetReceipts();
|
||||
// CashPayments = dao.GetPayments();
|
||||
// AdditionalVoids = dao.GetAdditionalVoids();
|
||||
// RetainedOvernight = dao.GetRetainedOvernight();
|
||||
|
||||
// PaymentString = dao.GetPaymentString();
|
||||
|
||||
// OldPending = dao.GetOldPending();
|
||||
// OldReceipts = dao.GetOldReceipts();
|
||||
// OldVoided = dao.GetOldVoided();
|
||||
|
||||
|
||||
Cashiers = GetActiveCashiers();
|
||||
CashReceipts = GetPrintInfo(out info, SettleOption.Cash);
|
||||
Discount = GetDiscountBills(.1M, out info);
|
||||
DiscountString = info;
|
||||
ClosingBalance = CashReceipts;
|
||||
}
|
||||
Cashier = _session.QueryOver<User>()
|
||||
.Where(x => x.UserID == cashier)
|
||||
.SingleOrDefault();
|
||||
Cashiers = GetActiveCashiers();
|
||||
GetBillDetails();
|
||||
}
|
||||
|
||||
public void Calculate()
|
||||
public void GetBillDetails()
|
||||
{
|
||||
Excess = ClosingBalance;
|
||||
Status = string.Format("{0:Extra Cash Rs #,##0.00; Cash Short Rs #,##0.00;Cash Perfect}", Excess);
|
||||
}
|
||||
|
||||
private decimal GetPrintInfo(out string info, SettleOption settleOption)
|
||||
{
|
||||
using (var session = SessionManager.Session)
|
||||
{
|
||||
Voucher voucher = null;
|
||||
decimal amount;
|
||||
decimal discount;
|
||||
info = string.Format("\n\r--- {0} ", settleOption.Display()).PadRight(44, '-');
|
||||
var list = session.QueryOver<Voucher>(() => voucher)
|
||||
.Where(i => i.LastEditDate >= StartDate &&
|
||||
i.LastEditDate <= FinishDate &&
|
||||
i.User == Cashier &&
|
||||
i.Void == false)
|
||||
.WithSubquery.WhereExists(QueryOver.Of<VoucherSettlement>().Where(x => x.Voucher.VoucherID == voucher.VoucherID && x.Settled == settleOption).Select(x => x.Voucher))
|
||||
.List();
|
||||
GetInfo(list, settleOption, out amount, out discount, ref info);
|
||||
return amount;
|
||||
}
|
||||
}
|
||||
|
||||
//private decimal GetPending(out string info)
|
||||
//{
|
||||
// using (var session = SessionManager.Session)
|
||||
// {
|
||||
// Voucher voucher = null;
|
||||
// decimal amount;
|
||||
// decimal discount;
|
||||
// info = "\n\r--- Pending Bills ------------------------";
|
||||
// var list = session.QueryOver<Voucher>(() => voucher)
|
||||
// .Where(i => i.LastEditDate >= StartDate &&
|
||||
// i.LastEditDate <= FinishDate &&
|
||||
// i.User == Cashier &&
|
||||
// i.Void == false)
|
||||
// .WithSubquery.WhereExists(QueryOver.Of<VoucherSettlement>().Where(x => x.Voucher.VoucherID == voucher.VoucherID && x.Settled == SettleOption.Unsettled).Select(x => x.Voucher))
|
||||
// .List();
|
||||
// GetInfo(list, SettleOption.Unsettled, out amount, out discount, ref info);
|
||||
// return amount;
|
||||
// }
|
||||
//}
|
||||
|
||||
//private decimal GetNoCharge(out string info)
|
||||
//{
|
||||
// using (var session = SessionManager.Session)
|
||||
// {
|
||||
// Voucher voucher = null;
|
||||
// decimal amount;
|
||||
// decimal discount;
|
||||
// info = "\n\r--- No Charge ----------------------------";
|
||||
// var list = session.QueryOver<Voucher>(() => voucher)
|
||||
// .Where(i => i.LastEditDate >= StartDate &&
|
||||
// i.LastEditDate <= FinishDate &&
|
||||
// i.User == Cashier &&
|
||||
// i.Void == false)
|
||||
// .WithSubquery.WhereExists(QueryOver.Of<VoucherSettlement>().Where(x => x.Voucher.VoucherID == voucher.VoucherID && x.Settled == SettleOption.NoCharge).Select(x => x.Voucher))
|
||||
// .List();
|
||||
// GetInfo(list, SettleOption.NoCharge, out amount, out discount, ref info);
|
||||
// return amount;
|
||||
// }
|
||||
//}
|
||||
//private decimal GetCashReceipts(out string info)
|
||||
//{
|
||||
// using (var session = SessionManager.Session)
|
||||
// {
|
||||
// Voucher voucher = null;
|
||||
// decimal amount;
|
||||
// decimal discount;
|
||||
// info = "\n\r--- Cash Settlement ----------------------";
|
||||
// var list = session.QueryOver<Voucher>(() => voucher)
|
||||
// .Where(i => i.LastEditDate >= StartDate &&
|
||||
// i.LastEditDate <= FinishDate &&
|
||||
// i.User == Cashier &&
|
||||
// i.Void == false)
|
||||
// .WithSubquery.WhereExists(QueryOver.Of<VoucherSettlement>().Where(x => x.Voucher.VoucherID == voucher.VoucherID && x.Settled == SettleOption.Cash).Select(x => x.Voucher))
|
||||
// .List();
|
||||
// GetInfo(list, SettleOption.Cash, out amount, out discount, ref info);
|
||||
// return amount;
|
||||
// }
|
||||
//}
|
||||
//private decimal GetBillToCompany(out string info)
|
||||
//{
|
||||
// using (var session = SessionManager.Session)
|
||||
// {
|
||||
// Voucher voucher = null;
|
||||
// decimal amount;
|
||||
// decimal discount;
|
||||
// info = "\n\r--- Bill To Company ----------------------";
|
||||
// var list = session.QueryOver<Voucher>(() => voucher)
|
||||
// .Where(i => i.LastEditDate >= StartDate &&
|
||||
// i.LastEditDate <= FinishDate &&
|
||||
// i.User == Cashier &&
|
||||
// i.Void == false)
|
||||
// .WithSubquery.WhereExists(QueryOver.Of<VoucherSettlement>().Where(x => x.Voucher.VoucherID == voucher.VoucherID && x.Settled == SettleOption.BillToCompany).Select(x => x.Voucher))
|
||||
// .List();
|
||||
// GetInfo(list, SettleOption.BillToCompany, out amount, out discount, ref info);
|
||||
// return amount;
|
||||
// }
|
||||
//}
|
||||
//private decimal GetCreditCard(out string info)
|
||||
//{
|
||||
// using (var session = SessionManager.Session)
|
||||
// {
|
||||
// Voucher voucher = null;
|
||||
// decimal amount;
|
||||
// decimal discount;
|
||||
// info = "\n\r--- Credit Card Bills --------------------";
|
||||
// var list = session.QueryOver<Voucher>(() => voucher)
|
||||
// .Where(i => i.LastEditDate >= StartDate &&
|
||||
// i.LastEditDate <= FinishDate &&
|
||||
// i.User == Cashier &&
|
||||
// i.Void == false)
|
||||
// .WithSubquery.WhereExists(QueryOver.Of<VoucherSettlement>().Where(x => x.Voucher.VoucherID == voucher.VoucherID && x.Settled == SettleOption.CreditCard).Select(x => x.Voucher))
|
||||
// .List();
|
||||
|
||||
// GetInfo(list, SettleOption.CreditCard, out amount, out discount, ref info);
|
||||
// return amount;
|
||||
// }
|
||||
//}
|
||||
private decimal GetVoids(out string info)
|
||||
{
|
||||
using (var session = SessionManager.Session)
|
||||
{
|
||||
decimal amount;
|
||||
decimal discount;
|
||||
info = "\n\r--- Void Bills ---------------------------";
|
||||
var list = (from i in session.QueryOver<Voucher>()
|
||||
where i.LastEditDate >= StartDate &&
|
||||
i.LastEditDate <= FinishDate &&
|
||||
i.User == Cashier &&
|
||||
i.Void == true
|
||||
select i).List();
|
||||
GetInfo(list, out amount, out discount, ref info);
|
||||
return amount;
|
||||
}
|
||||
}
|
||||
private decimal GetDiscountBills(decimal disount, out string info)
|
||||
{
|
||||
using (var session = SessionManager.Session)
|
||||
{
|
||||
decimal amount;
|
||||
decimal discount;
|
||||
info = "\n\r--- High Discount Bills ------------------";
|
||||
const string query = @"
|
||||
select distinct(v) from Voucher v
|
||||
inner join v.Kots k
|
||||
inner join k.Inventories i
|
||||
where v.Date >= :startDate and v.Date <= :finishDate and v.User = :cashierID and v.Void = false
|
||||
and exists (select Voucher from VoucherSettlement vs where vs.Voucher = v
|
||||
and vs.Settled != :noCharge and vs.Settled != :unSettled and vs.Settled != :amount and vs.Settled != :roundoff)
|
||||
and i.Discount >= :discount";
|
||||
var list = session.CreateQuery(query)
|
||||
.SetParameter("startDate", StartDate)
|
||||
.SetParameter("finishDate", FinishDate)
|
||||
.SetParameter("cashierID", Cashier.UserID)
|
||||
.SetParameter("unSettled", SettleOption.Unsettled)
|
||||
.SetParameter("noCharge", SettleOption.NoCharge)
|
||||
.SetParameter("amount", SettleOption.Amount)
|
||||
.SetParameter("roundoff", SettleOption.RoundOff)
|
||||
.SetParameter("discount", disount)
|
||||
.List<Voucher>();
|
||||
|
||||
GetInfo(list, out amount, out discount, ref info);
|
||||
return discount;
|
||||
}
|
||||
}
|
||||
|
||||
private static void GetInfo(ICollection<Voucher> list, out decimal amount, out decimal discount, ref string info)
|
||||
{
|
||||
amount = 0;
|
||||
discount = 0;
|
||||
if (list.Count == 0)
|
||||
{
|
||||
info = string.Empty;
|
||||
if (FinishDate <= StartDate)
|
||||
return;
|
||||
}
|
||||
Voucher vAlias = null;
|
||||
VoucherSettlement vsAlias = null;
|
||||
|
||||
var list = _session.QueryOver<Voucher>(() => vAlias)
|
||||
.Left.JoinAlias(x => x.Settlements, () => vsAlias)
|
||||
.Where(x => x.Date >= StartDate && x.Date <= FinishDate && x.User == Cashier)
|
||||
.OrderBy(x => x.VoucherType).Asc
|
||||
.ThenBy(x => x.BillID).Asc
|
||||
.TransformUsing(Transformers.DistinctRootEntity)
|
||||
.List();
|
||||
|
||||
//voidInfo = "\n\r--- Void Bills ---------------------------";
|
||||
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.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------------------------------------------";
|
||||
amount += amt;
|
||||
discount += disc;
|
||||
}
|
||||
}
|
||||
if (item.Void)
|
||||
{
|
||||
if (!amounts.ContainsKey(SettleOption.Void))
|
||||
{
|
||||
amounts.Add(SettleOption.Void, 0);
|
||||
info.Add(SettleOption.Void, string.Format("\n\r--- {0} ", SettleOption.Void.Display()).PadRight(44, '-'));
|
||||
}
|
||||
|
||||
private static void GetInfo(ICollection<Voucher> list, SettleOption settleOption, out decimal amount, out decimal discount, ref string info)
|
||||
{
|
||||
amount = 0;
|
||||
discount = 0;
|
||||
if (list.Count == 0)
|
||||
{
|
||||
info = string.Empty;
|
||||
return;
|
||||
}
|
||||
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.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------------------------------------------";
|
||||
amount += amt;
|
||||
discount += disc;
|
||||
var amount = (int)(item.Settlements.Single(x => x.Settled == SettleOption.Amount).Amount * -1);
|
||||
amounts[SettleOption.Void] += amount;
|
||||
info[SettleOption.Void] += string.Format("\n\r{0:dd-MMM-yyyy HH:mm:ss} {1} {2}", item.Date, item.FullBillID, item.Customer.Name);
|
||||
info[SettleOption.Void] += string.Format("\n\rAmount: {0:#0.00}", amount);
|
||||
info[SettleOption.Void] += "\n\r------------------------------------------";
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var so in item.Settlements.Where(x => x.Settled.Visible()))
|
||||
{
|
||||
if (!amounts.ContainsKey(so.Settled))
|
||||
{
|
||||
amounts.Add(so.Settled, 0);
|
||||
info.Add(so.Settled, string.Format("\n\r--- {0} ", so.Settled.Display()).PadRight(44, '-'));
|
||||
}
|
||||
var amount = (int)so.Amount;
|
||||
amounts[so.Settled] += amount;
|
||||
info[so.Settled] += string.Format("\n\r{0:dd-MMM-yyyy HH:mm:ss} {1} {2}", item.Date, item.FullBillID, item.Customer.Name);
|
||||
info[so.Settled] += string.Format("\n\rAmount: {0:#0.00}", amount);
|
||||
info[so.Settled] += "\n\r------------------------------------------";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private string GetActiveCashiers()
|
||||
{
|
||||
var cashiers = "";
|
||||
using (var session = SessionManager.Session)
|
||||
{
|
||||
const string query = @"
|
||||
const string query = @"
|
||||
select distinct(u.Name) from Voucher v
|
||||
inner join v.User u
|
||||
where v.Date >= :startDate and v.Date <= :finishDate";
|
||||
var list = session.CreateQuery(query)
|
||||
.SetParameter("startDate", StartDate)
|
||||
.SetParameter("finishDate", FinishDate)
|
||||
.List<string>();
|
||||
foreach (var item in list)
|
||||
cashiers += item + ", ";
|
||||
return cashiers;
|
||||
}
|
||||
var list = _session.CreateQuery(query)
|
||||
.SetParameter("startDate", StartDate)
|
||||
.SetParameter("finishDate", FinishDate)
|
||||
.List<string>();
|
||||
foreach (var item in list)
|
||||
cashiers += item + ", ";
|
||||
return cashiers;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -45,18 +45,6 @@ namespace Tanshu.Accounts.Repository
|
||||
return list;
|
||||
}
|
||||
|
||||
public static List<ProductDisplaySmall> GetFilteredProducts(Dictionary<string, string> filter)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public static List<ProductDisplaySmall> GetUnFilteredProducts()
|
||||
{
|
||||
Dictionary<string, string> filter = new Dictionary<string, string>();
|
||||
filter.Add("Name", "");
|
||||
filter.Add("Type", "");
|
||||
return GetFilteredProducts(filter);
|
||||
}
|
||||
public static IList<Product> List(Guid productGroupID)
|
||||
{
|
||||
using (var session = SessionManager.Session)
|
||||
|
@ -45,18 +45,20 @@ namespace Tanshu.Accounts.Repository
|
||||
|
||||
public void Debug(object message)
|
||||
{
|
||||
if (!Cache.Log) return;
|
||||
if (message == null) return;
|
||||
var msg = message.ToString();
|
||||
if (!msg.Contains("oucher") && !_key.Contains("oucher")) return;
|
||||
if (_key != "NHibernate.SQL") return;
|
||||
Console.WriteLine(string.Format(" -- {0} ---+ {1} +---", _key, DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss.ff")));
|
||||
Console.WriteLine(message.ToString().Trim());
|
||||
}
|
||||
|
||||
public void Debug(object message, Exception exception)
|
||||
{
|
||||
if (!Cache.Log) return;
|
||||
if (message == null || exception == null) return;
|
||||
var msg = message.ToString();
|
||||
if (!msg.Contains("oucher") && !_key.Contains("oucher")) return;
|
||||
if (_key != "NHibernate.SQL") return;
|
||||
Console.WriteLine(string.Format(" -- {0} ---+ {1} +---", _key, DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss.ff")));
|
||||
Console.WriteLine(message.ToString().Trim());
|
||||
Console.WriteLine(exception.ToString());
|
||||
|
@ -1,11 +0,0 @@
|
||||
using System;
|
||||
using Tanshu.Accounts.Entities.Auth;
|
||||
|
||||
namespace Tanshu.Accounts.Repository
|
||||
{
|
||||
public class RoleBI : UnitOfWork<Role>
|
||||
{
|
||||
public bool IsAllowed(Guid userID, string roleName)
|
||||
{ throw new NotImplementedException(); }
|
||||
}
|
||||
}
|
@ -5,6 +5,8 @@ using Tanshu.Accounts.Entities;
|
||||
using Tanshu.Common;
|
||||
using Tanshu.Common.Helpers;
|
||||
using System.Linq;
|
||||
using NHibernate.Transform;
|
||||
using NHibernate.Criterion;
|
||||
|
||||
namespace Tanshu.Accounts.Repository
|
||||
{
|
||||
@ -147,31 +149,42 @@ order by g.GroupType
|
||||
return new List<BillDetail>();
|
||||
using (var session = SessionManager.Session)
|
||||
{
|
||||
const string query = @"
|
||||
select v.Date, v.BillID, s.Settled, s.Amount, v.Void, v.VoidReason
|
||||
from Voucher v
|
||||
inner join v.Settlements s
|
||||
where v.Date >= :startDate and v.Date <= :finishDate
|
||||
order by v.BillID, s.Settled
|
||||
";
|
||||
var list = session
|
||||
.CreateQuery(query)
|
||||
.SetParameter("startDate", startDate)
|
||||
.SetParameter("finishDate", finishDate)
|
||||
.List<object[]>();
|
||||
Voucher vAlias = null;
|
||||
VoucherSettlement vsAlias = null;
|
||||
|
||||
var list = session.QueryOver<Voucher>(() => vAlias)
|
||||
.Left.JoinAlias(x => x.Settlements, () => vsAlias)
|
||||
.Where(x => x.Date >= startDate && x.Date <= finishDate)
|
||||
.OrderBy(x => x.VoucherType).Asc
|
||||
.ThenBy(x => x.BillID).Asc
|
||||
.TransformUsing(Transformers.DistinctRootEntity)
|
||||
.List();
|
||||
|
||||
var outList = new List<BillDetail>();
|
||||
foreach (var item in list)
|
||||
{
|
||||
var settlement = ((SettleOption)item[2]).Display();
|
||||
if ((bool)item[4])
|
||||
settlement = string.Format("Void: {0}", (string)item[5]);
|
||||
outList.Add(new BillDetail()
|
||||
{
|
||||
Date = (DateTime)item[0],
|
||||
BillID = (string)item[1],
|
||||
Settlement = settlement,
|
||||
Amount = Math.Round((decimal)item[3],2)
|
||||
});
|
||||
if (item.Void)
|
||||
outList.Add(new BillDetail()
|
||||
{
|
||||
Date = item.Date,
|
||||
BillID = item.FullBillID,
|
||||
Settlement = string.Format("Void: {0}", item.VoidReason),
|
||||
Amount = Math.Round(item.Settlements.Single(x => x.Settled == SettleOption.Amount).Amount * -1, 2)
|
||||
});
|
||||
|
||||
else
|
||||
{
|
||||
foreach (var so in item.Settlements.Where(x => x.Settled.Visible()))
|
||||
{
|
||||
outList.Add(new BillDetail()
|
||||
{
|
||||
Date = item.Date,
|
||||
BillID = item.FullBillID,
|
||||
Settlement = so.Settled.Display(),
|
||||
Amount = Math.Round(so.Amount, 2)
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
return outList;
|
||||
}
|
||||
@ -218,28 +231,27 @@ order by pg.GroupType
|
||||
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[]>();
|
||||
Voucher vAlias = null;
|
||||
VoucherSettlement vsAlias = null;
|
||||
ICriterion amount = Restrictions.Where<VoucherSettlement>(x => x.Settled == SettleOption.Amount);
|
||||
|
||||
var listVoids = session.QueryOver<Voucher>(() => vAlias)
|
||||
.Left.JoinAlias(x => x.Settlements, () => vsAlias, amount)
|
||||
.Where(x => x.Date >= startDate && x.Date <= finishDate && x.Void == true)
|
||||
.OrderBy(x => x.VoucherType).Asc
|
||||
.ThenBy(x => x.BillID).Asc
|
||||
.TransformUsing(Transformers.DistinctRootEntity)
|
||||
.List();
|
||||
|
||||
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
|
||||
Date = item.Date,
|
||||
BillID = item.FullBillID,
|
||||
Settlement = string.Format("Void: {0}", item.VoidReason),
|
||||
Amount = Math.Round(item.Settlements.SingleOrDefault().Amount * -1, 2)
|
||||
});
|
||||
}
|
||||
var listReprint = session.QueryOver<Reprint>()
|
||||
@ -250,7 +262,7 @@ order by v.BillID, s.Settled
|
||||
outList.Add(new BillDetail()
|
||||
{
|
||||
Date = item.Date,
|
||||
BillID = item.Voucher.BillID.Value.ToString(),
|
||||
BillID = item.Voucher.FullBillID,
|
||||
Settlement = string.Format("Reprinted by {0}", item.User.Name),
|
||||
Amount = item.Voucher.Settlements.Single(x => x.Settled == SettleOption.Amount).Amount * -1
|
||||
});
|
||||
@ -267,7 +279,6 @@ order by v.BillID, s.Settled
|
||||
return new List<SalesAnalysis>();
|
||||
using (var session = SessionManager.Session)
|
||||
{
|
||||
//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
|
||||
@ -322,7 +333,7 @@ and vs.Settled != :noCharge and vs.Settled != :unsettled and vs.Settled != :amou
|
||||
#endregion
|
||||
#region Service Tax
|
||||
query = @"
|
||||
select Sum(i.Quantity * i.Price * (1 - i.Discount) * (1 + case when i.IsScTaxable then i.ServiceCharge else 0 end) * i.ServiceTax)
|
||||
select Sum(i.Quantity * i.Price * (1 - i.Discount) * (1 + case when i.IsScTaxable then i.ServiceCharge else 0 end) * i.ServiceTaxRate)
|
||||
from Voucher v
|
||||
inner join v.Kots k
|
||||
inner join k.Inventories i
|
||||
@ -344,14 +355,14 @@ and vs.Settled != :noCharge and vs.Settled != :unsettled and vs.Settled != :amou
|
||||
#endregion
|
||||
#region Vat
|
||||
query = @"
|
||||
select i.Vat, Sum(i.Quantity * i.Price * (1 - i.Discount) * (1 + case when i.IsScTaxable then i.ServiceCharge else 0 end) * i.Vat)
|
||||
select i.VatRate, Sum(i.Quantity * i.Price * (1 - i.Discount) * (1 + case when i.IsScTaxable then i.ServiceCharge else 0 end) * i.VatRate)
|
||||
from Voucher v
|
||||
inner join v.Kots k
|
||||
inner join k.Inventories i
|
||||
where v.Date >= :startDate and v.Date <= :finishDate and v.Void = false
|
||||
and exists (select Voucher from VoucherSettlement vs where vs.Voucher = v
|
||||
and vs.Settled != :noCharge and vs.Settled != :unsettled and vs.Settled != :amount and vs.Settled != :roundoff and vs.Settled != :staff)
|
||||
group by i.Vat
|
||||
group by i.VatRate
|
||||
";
|
||||
var list = session
|
||||
.CreateQuery(query)
|
||||
|
@ -1,5 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using Tanshu.Accounts.Entities.Auth;
|
||||
using System.Linq;
|
||||
using Tanshu.Accounts.Repository;
|
||||
|
||||
namespace Tanshu.Accounts.Contracts
|
||||
@ -27,6 +28,7 @@ namespace Tanshu.Accounts.Contracts
|
||||
_currentUser = null;
|
||||
IsAuthenticated = false;
|
||||
_roles = null;
|
||||
Cache.ClearRoles();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -37,7 +39,7 @@ namespace Tanshu.Accounts.Contracts
|
||||
if (_roles == null)
|
||||
_roles = new Dictionary<string, bool>();
|
||||
if (!_roles.ContainsKey(role))
|
||||
_roles.Add(role, new UserBI().IsUserInRole(_currentUser.UserID, role));
|
||||
_roles.Add(role, Cache.UserRoles(_currentUser.UserID).Any(x => x.Name == role));
|
||||
return _roles[role];
|
||||
}
|
||||
}
|
||||
|
@ -81,7 +81,6 @@ namespace Tanshu.Accounts.Repository
|
||||
db.IsolationLevel = IsolationLevel.ReadCommitted;
|
||||
db.ConnectionStringName = "Con";
|
||||
db.Timeout = 10;
|
||||
|
||||
// enabled for testing
|
||||
//db.LogFormattedSql = true;
|
||||
//db.LogSqlInConsole = true;
|
||||
@ -91,8 +90,10 @@ namespace Tanshu.Accounts.Repository
|
||||
var mapping = GetMappings();
|
||||
configure.AddDeserializedMapping(mapping, "NHSchemaTest");
|
||||
//SchemaMetadataUpdater.QuoteTableAndColumns(configure);
|
||||
//configure.SetInterceptor(new NHSQLInterceptor());
|
||||
configure.SetInterceptor(new VoucherDirty());
|
||||
|
||||
var timeout = TimeSpan.FromMinutes(10).TotalSeconds;
|
||||
configure.SetProperty("command_timeout", timeout.ToString());
|
||||
return configure;
|
||||
}
|
||||
private static HbmMapping GetMappings()
|
||||
|
@ -79,7 +79,6 @@
|
||||
<Compile Include="ProductGroupModifierBI.cs" />
|
||||
<Compile Include="QueryStore.cs" />
|
||||
<Compile Include="ReprintBI.cs" />
|
||||
<Compile Include="RoleBI.cs" />
|
||||
<Compile Include="SalesAnalysisBI.cs" />
|
||||
<Compile Include="TaxBI.cs" />
|
||||
<Compile Include="UnitOfWork.cs">
|
||||
|
@ -70,12 +70,19 @@ order by u.Name";
|
||||
}
|
||||
}
|
||||
}
|
||||
public bool IsUserInRole(Guid userID, string roleName)
|
||||
public IList<Role> Roles(Guid userID)
|
||||
{
|
||||
var user = _session.QueryOver<User>()
|
||||
.Where(x => x.UserID == userID)
|
||||
.SingleOrDefault();
|
||||
return user.UserGroups.SelectMany(x => x.Group.RoleGroups).Any(y=>y.Role.Name == roleName);
|
||||
const string query = @"
|
||||
select distinct(r) from UserGroup ug
|
||||
inner join ug.User u
|
||||
inner join ug.Group g
|
||||
inner join g.RoleGroups rg
|
||||
inner join rg.Role r
|
||||
where u.UserID = :userID
|
||||
order by r.Name";
|
||||
return _session.CreateQuery(query)
|
||||
.SetParameter("userID", userID)
|
||||
.List<Role>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -119,6 +119,8 @@ namespace Tanshu.Accounts.Repository
|
||||
var voucher = _session.QueryOver<Voucher>()
|
||||
.Where(query)
|
||||
.SingleOrDefault();
|
||||
if (voucher == null)
|
||||
return voucher;
|
||||
NHibernateUtil.Initialize(voucher.Customer);
|
||||
NHibernateUtil.Initialize(voucher.Waiter);
|
||||
NHibernateUtil.Initialize(voucher.User);
|
||||
@ -200,7 +202,7 @@ namespace Tanshu.Accounts.Repository
|
||||
_session.Update(oldTable);
|
||||
return newVoucher.VoucherID;
|
||||
}
|
||||
private static void UpdateBillType(Voucher voucher)
|
||||
private void UpdateBillType(Voucher voucher)
|
||||
{
|
||||
switch (voucher.VoucherType)
|
||||
{
|
||||
@ -212,6 +214,8 @@ namespace Tanshu.Accounts.Repository
|
||||
item.ServiceCharge = 0;
|
||||
item.ServiceTaxRate = 0;
|
||||
item.VatRate = 0;
|
||||
if (item.InventoryID != Guid.Empty)
|
||||
_session.Update(item);
|
||||
}
|
||||
break;
|
||||
case VoucherType.TakeAway:
|
||||
@ -219,6 +223,8 @@ namespace Tanshu.Accounts.Repository
|
||||
{
|
||||
item.ServiceCharge = 0;
|
||||
item.ServiceTaxRate = 0;
|
||||
if (item.InventoryID != Guid.Empty)
|
||||
_session.Update(item);
|
||||
}
|
||||
break;
|
||||
case VoucherType.Staff:
|
||||
@ -227,6 +233,8 @@ namespace Tanshu.Accounts.Repository
|
||||
item.ServiceCharge = 0;
|
||||
item.ServiceTaxRate = 0;
|
||||
item.VatRate = 0;
|
||||
if (item.InventoryID != Guid.Empty)
|
||||
_session.Update(item);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -286,7 +294,7 @@ namespace Tanshu.Accounts.Repository
|
||||
var oldVoucher = _session.Get<Voucher>(oldVoucherID);
|
||||
oldVoucher.User = Session.User;
|
||||
oldVoucher.Void = true;
|
||||
oldVoucher.VoidReason = string.Format("Bill Discounted / Changed. New Bill ID is {0}", newVoucher.BillID);
|
||||
oldVoucher.VoidReason = string.Format("Bill Discounted / Changed. New Bill ID is {0}", newVoucher.FullBillID);
|
||||
|
||||
Insert(newVoucher);
|
||||
Update(oldVoucher);
|
||||
|
Loading…
x
Reference in New Issue
Block a user