Changed Checkout to correctly reflect cash. Minor updates.
This commit is contained in:
14
Tanshu.Accounts.Contracts/Helper Functions/EnumHelper.cs
Normal file
14
Tanshu.Accounts.Contracts/Helper Functions/EnumHelper.cs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
using Tanshu.Accounts.Entities;
|
||||||
|
using Tanshu.Accounts.Contracts;
|
||||||
|
|
||||||
|
namespace Tanshu.Common.Helpers
|
||||||
|
{
|
||||||
|
public static class EnumHelper
|
||||||
|
{
|
||||||
|
public static string Display(this SettleOption settleOption)
|
||||||
|
{
|
||||||
|
var attribute = (DisplayAttribute)settleOption.GetType().GetField(settleOption.ToString()).GetCustomAttributes(typeof(DisplayAttribute), false)[0];
|
||||||
|
return attribute != null ? attribute.Name : "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -113,6 +113,7 @@
|
|||||||
<Compile Include="Data Contracts Display\ProductDisplayBO.cs" />
|
<Compile Include="Data Contracts Display\ProductDisplayBO.cs" />
|
||||||
<Compile Include="Data Contracts Display\ProductDisplaySmallBO.cs" />
|
<Compile Include="Data Contracts Display\ProductDisplaySmallBO.cs" />
|
||||||
<Compile Include="Data Contracts\ProductGroupBO.cs" />
|
<Compile Include="Data Contracts\ProductGroupBO.cs" />
|
||||||
|
<Compile Include="Helper Functions\EnumHelper.cs" />
|
||||||
<Compile Include="nHibernate\IAuditable.cs" />
|
<Compile Include="nHibernate\IAuditable.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="Data Contracts Display\SalesAnalysisBO.cs" />
|
<Compile Include="Data Contracts Display\SalesAnalysisBO.cs" />
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<configuration>
|
<configuration>
|
||||||
<connectionStrings>
|
<connectionStrings>
|
||||||
<add name="FluentCon" connectionString="Server=frodo;Initial Catalog=Pets;User ID=sa;Password=123456" />
|
<add name="FluentCon" connectionString="Server=Sovereign;Initial Catalog=Pets;User ID=sa;Password=123456" />
|
||||||
</connectionStrings>
|
</connectionStrings>
|
||||||
<appSettings>
|
<appSettings>
|
||||||
<add key ="Location" value ="Office"/>
|
<add key ="Location" value ="Office"/>
|
||||||
@ -9,4 +9,13 @@
|
|||||||
<add key ="LogConnection" value ="connection"/>
|
<add key ="LogConnection" value ="connection"/>
|
||||||
<add key ="LogLevel" value ="Warn"/>
|
<add key ="LogLevel" value ="Warn"/>
|
||||||
</appSettings>
|
</appSettings>
|
||||||
|
<system.diagnostics>
|
||||||
|
<trace autoflush="true" indentsize="4">
|
||||||
|
<listeners>
|
||||||
|
<add name="myListener" type="System.Diagnostics.TextWriterTraceListener"
|
||||||
|
initializeData="TraceOutput.log" />
|
||||||
|
<remove name="Default" />
|
||||||
|
</listeners>
|
||||||
|
</trace>
|
||||||
|
</system.diagnostics>
|
||||||
</configuration>
|
</configuration>
|
||||||
@ -288,7 +288,7 @@ namespace Tanshu.Accounts.PointOfSale
|
|||||||
ClearBill();
|
ClearBill();
|
||||||
bill.Clear();
|
bill.Clear();
|
||||||
_billInfo = null;
|
_billInfo = null;
|
||||||
_billInfo = VoucherBI.GetVoucher(voucherID);
|
_billInfo = VoucherBI.Get(voucherID);
|
||||||
|
|
||||||
_customer = _billInfo.Customer;
|
_customer = _billInfo.Customer;
|
||||||
_saleForm.ShowInfo(_billInfo.BillID, _billInfo.KotID, _billInfo.CreationDate, _billInfo.Date.Value,
|
_saleForm.ShowInfo(_billInfo.BillID, _billInfo.KotID, _billInfo.CreationDate, _billInfo.Date.Value,
|
||||||
@ -352,7 +352,7 @@ namespace Tanshu.Accounts.PointOfSale
|
|||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(tableName))
|
if (!string.IsNullOrEmpty(tableName))
|
||||||
{
|
{
|
||||||
var table = new FoodTableBI().GetByName(tableName);
|
var table = new FoodTableBI().Get(tableName);
|
||||||
if (table != null && table.VoucherID != 0)
|
if (table != null && table.VoucherID != 0)
|
||||||
{
|
{
|
||||||
LoadBill(table.VoucherID);
|
LoadBill(table.VoucherID);
|
||||||
@ -366,7 +366,7 @@ namespace Tanshu.Accounts.PointOfSale
|
|||||||
var tableID = result.Text.Trim();
|
var tableID = result.Text.Trim();
|
||||||
if ((tableID != "C") && (tableID != "") && (!tableID.Contains(".")))
|
if ((tableID != "C") && (tableID != "") && (!tableID.Contains(".")))
|
||||||
{
|
{
|
||||||
var table = new FoodTableBI().GetByName(tableName);
|
var table = new FoodTableBI().Get(tableName);
|
||||||
if (table != null && table.VoucherID != 0)
|
if (table != null && table.VoucherID != 0)
|
||||||
{
|
{
|
||||||
LoadBill(table.VoucherID);
|
LoadBill(table.VoucherID);
|
||||||
|
|||||||
@ -18,22 +18,15 @@ namespace Tanshu.Accounts.PointOfSale
|
|||||||
|
|
||||||
private User form_userEvent(object sender, UserEventArgs e)
|
private User form_userEvent(object sender, UserEventArgs e)
|
||||||
{
|
{
|
||||||
User user = e.User;
|
var user = e.User;
|
||||||
|
|
||||||
if (user == null)
|
if (user == null)
|
||||||
{
|
|
||||||
using (var form = new UserForm(null))
|
using (var form = new UserForm(null))
|
||||||
{
|
|
||||||
form.ShowDialog();
|
form.ShowDialog();
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
using (var form = new UserForm(user.UserID))
|
using (var form = new UserForm(user.UserID))
|
||||||
{
|
|
||||||
form.ShowDialog();
|
form.ShowDialog();
|
||||||
}
|
|
||||||
}
|
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
return new User();
|
return new User();
|
||||||
}
|
}
|
||||||
@ -66,10 +59,8 @@ namespace Tanshu.Accounts.PointOfSale
|
|||||||
|
|
||||||
private void btnCustomer_Click(object sender, EventArgs e)
|
private void btnCustomer_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
using (var Customer = new CustomersForm(null, ""))
|
using (var frm = new CustomersForm(null, ""))
|
||||||
{
|
frm.ShowDialog();
|
||||||
Customer.ShowDialog();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnInitial_Click(object sender, EventArgs e)
|
private void btnInitial_Click(object sender, EventArgs e)
|
||||||
|
|||||||
@ -56,7 +56,7 @@
|
|||||||
this.label2 = new System.Windows.Forms.Label();
|
this.label2 = new System.Windows.Forms.Label();
|
||||||
this.label1 = new System.Windows.Forms.Label();
|
this.label1 = new System.Windows.Forms.Label();
|
||||||
this.txtPayments = new System.Windows.Forms.TextBox();
|
this.txtPayments = new System.Windows.Forms.TextBox();
|
||||||
this.txtAdvanceAdjusted = new System.Windows.Forms.TextBox();
|
this.txtCashReceipts = new System.Windows.Forms.TextBox();
|
||||||
this.txtCCReceipts = new System.Windows.Forms.TextBox();
|
this.txtCCReceipts = new System.Windows.Forms.TextBox();
|
||||||
this.txtAdditionalVoids = new System.Windows.Forms.TextBox();
|
this.txtAdditionalVoids = new System.Windows.Forms.TextBox();
|
||||||
this.txtVoidsInSystem = new System.Windows.Forms.TextBox();
|
this.txtVoidsInSystem = new System.Windows.Forms.TextBox();
|
||||||
@ -95,7 +95,7 @@
|
|||||||
this.dtpFinish.Name = "dtpFinish";
|
this.dtpFinish.Name = "dtpFinish";
|
||||||
this.dtpFinish.Size = new System.Drawing.Size(110, 20);
|
this.dtpFinish.Size = new System.Drawing.Size(110, 20);
|
||||||
this.dtpFinish.TabIndex = 42;
|
this.dtpFinish.TabIndex = 42;
|
||||||
this.dtpFinish.ValueChanged += new System.EventHandler(this.dtpFinish_ValueChanged);
|
this.dtpFinish.ValueChanged += new System.EventHandler(this.DtpFinishValueChanged);
|
||||||
//
|
//
|
||||||
// dtpStart
|
// dtpStart
|
||||||
//
|
//
|
||||||
@ -103,7 +103,7 @@
|
|||||||
this.dtpStart.Name = "dtpStart";
|
this.dtpStart.Name = "dtpStart";
|
||||||
this.dtpStart.Size = new System.Drawing.Size(110, 20);
|
this.dtpStart.Size = new System.Drawing.Size(110, 20);
|
||||||
this.dtpStart.TabIndex = 41;
|
this.dtpStart.TabIndex = 41;
|
||||||
this.dtpStart.ValueChanged += new System.EventHandler(this.dtpStart_ValueChanged);
|
this.dtpStart.ValueChanged += new System.EventHandler(this.DtpStartValueChanged);
|
||||||
//
|
//
|
||||||
// label17
|
// label17
|
||||||
//
|
//
|
||||||
@ -167,7 +167,7 @@
|
|||||||
this.btnCalculate.TabIndex = 39;
|
this.btnCalculate.TabIndex = 39;
|
||||||
this.btnCalculate.Text = "&Calculate";
|
this.btnCalculate.Text = "&Calculate";
|
||||||
this.btnCalculate.UseVisualStyleBackColor = true;
|
this.btnCalculate.UseVisualStyleBackColor = true;
|
||||||
this.btnCalculate.Click += new System.EventHandler(this.btnCalculate_Click);
|
this.btnCalculate.Click += new System.EventHandler(this.BtnCalculateClick);
|
||||||
//
|
//
|
||||||
// btnPrint
|
// btnPrint
|
||||||
//
|
//
|
||||||
@ -177,7 +177,7 @@
|
|||||||
this.btnPrint.TabIndex = 40;
|
this.btnPrint.TabIndex = 40;
|
||||||
this.btnPrint.Text = "&Print";
|
this.btnPrint.Text = "&Print";
|
||||||
this.btnPrint.UseVisualStyleBackColor = true;
|
this.btnPrint.UseVisualStyleBackColor = true;
|
||||||
this.btnPrint.Click += new System.EventHandler(this.btnPrint_Click);
|
this.btnPrint.Click += new System.EventHandler(this.BtnPrintClick);
|
||||||
//
|
//
|
||||||
// txtStatus
|
// txtStatus
|
||||||
//
|
//
|
||||||
@ -221,7 +221,7 @@
|
|||||||
this.cmbCashier.Name = "cmbCashier";
|
this.cmbCashier.Name = "cmbCashier";
|
||||||
this.cmbCashier.Size = new System.Drawing.Size(200, 21);
|
this.cmbCashier.Size = new System.Drawing.Size(200, 21);
|
||||||
this.cmbCashier.TabIndex = 37;
|
this.cmbCashier.TabIndex = 37;
|
||||||
this.cmbCashier.SelectedIndexChanged += new System.EventHandler(this.cmbCashier_SelectedIndexChanged);
|
this.cmbCashier.SelectedIndexChanged += new System.EventHandler(this.CmbCashierSelectedIndexChanged);
|
||||||
//
|
//
|
||||||
// label10
|
// label10
|
||||||
//
|
//
|
||||||
@ -273,9 +273,9 @@
|
|||||||
this.label5.AutoSize = true;
|
this.label5.AutoSize = true;
|
||||||
this.label5.Location = new System.Drawing.Point(12, 224);
|
this.label5.Location = new System.Drawing.Point(12, 224);
|
||||||
this.label5.Name = "label5";
|
this.label5.Name = "label5";
|
||||||
this.label5.Size = new System.Drawing.Size(73, 13);
|
this.label5.Size = new System.Drawing.Size(76, 13);
|
||||||
this.label5.TabIndex = 63;
|
this.label5.TabIndex = 63;
|
||||||
this.label5.Text = "Adv. Adjusted";
|
this.label5.Text = "Cash Receipts";
|
||||||
//
|
//
|
||||||
// label4
|
// label4
|
||||||
//
|
//
|
||||||
@ -322,14 +322,14 @@
|
|||||||
this.txtPayments.Size = new System.Drawing.Size(200, 20);
|
this.txtPayments.Size = new System.Drawing.Size(200, 20);
|
||||||
this.txtPayments.TabIndex = 48;
|
this.txtPayments.TabIndex = 48;
|
||||||
//
|
//
|
||||||
// txtAdvanceAdjusted
|
// txtCashReceipts
|
||||||
//
|
//
|
||||||
this.txtAdvanceAdjusted.Location = new System.Drawing.Point(99, 221);
|
this.txtCashReceipts.Location = new System.Drawing.Point(99, 221);
|
||||||
this.txtAdvanceAdjusted.Name = "txtAdvanceAdjusted";
|
this.txtCashReceipts.Name = "txtCashReceipts";
|
||||||
this.txtAdvanceAdjusted.ReadOnly = true;
|
this.txtCashReceipts.ReadOnly = true;
|
||||||
this.txtAdvanceAdjusted.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
|
this.txtCashReceipts.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
|
||||||
this.txtAdvanceAdjusted.Size = new System.Drawing.Size(200, 20);
|
this.txtCashReceipts.Size = new System.Drawing.Size(200, 20);
|
||||||
this.txtAdvanceAdjusted.TabIndex = 47;
|
this.txtCashReceipts.TabIndex = 47;
|
||||||
//
|
//
|
||||||
// txtCCReceipts
|
// txtCCReceipts
|
||||||
//
|
//
|
||||||
@ -439,7 +439,7 @@
|
|||||||
this.txtNC.Size = new System.Drawing.Size(200, 20);
|
this.txtNC.Size = new System.Drawing.Size(200, 20);
|
||||||
this.txtNC.TabIndex = 74;
|
this.txtNC.TabIndex = 74;
|
||||||
//
|
//
|
||||||
// Cashier_Checkout_Form
|
// CashierCheckoutForm
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
@ -476,7 +476,7 @@
|
|||||||
this.Controls.Add(this.label2);
|
this.Controls.Add(this.label2);
|
||||||
this.Controls.Add(this.label1);
|
this.Controls.Add(this.label1);
|
||||||
this.Controls.Add(this.txtPayments);
|
this.Controls.Add(this.txtPayments);
|
||||||
this.Controls.Add(this.txtAdvanceAdjusted);
|
this.Controls.Add(this.txtCashReceipts);
|
||||||
this.Controls.Add(this.txtCCReceipts);
|
this.Controls.Add(this.txtCCReceipts);
|
||||||
this.Controls.Add(this.txtAdditionalVoids);
|
this.Controls.Add(this.txtAdditionalVoids);
|
||||||
this.Controls.Add(this.txtVoidsInSystem);
|
this.Controls.Add(this.txtVoidsInSystem);
|
||||||
@ -489,7 +489,7 @@
|
|||||||
this.Name = "CashierCheckoutForm";
|
this.Name = "CashierCheckoutForm";
|
||||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||||
this.Text = "Cashier Checkout Form";
|
this.Text = "Cashier Checkout Form";
|
||||||
this.Load += new System.EventHandler(this.Cashier_Checkout_Form_Load);
|
this.Load += new System.EventHandler(this.CashierCheckoutFormLoad);
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
this.PerformLayout();
|
this.PerformLayout();
|
||||||
|
|
||||||
@ -525,7 +525,7 @@
|
|||||||
private System.Windows.Forms.Label label2;
|
private System.Windows.Forms.Label label2;
|
||||||
private System.Windows.Forms.Label label1;
|
private System.Windows.Forms.Label label1;
|
||||||
private System.Windows.Forms.TextBox txtPayments;
|
private System.Windows.Forms.TextBox txtPayments;
|
||||||
private System.Windows.Forms.TextBox txtAdvanceAdjusted;
|
private System.Windows.Forms.TextBox txtCashReceipts;
|
||||||
private System.Windows.Forms.TextBox txtCCReceipts;
|
private System.Windows.Forms.TextBox txtCCReceipts;
|
||||||
private System.Windows.Forms.TextBox txtAdditionalVoids;
|
private System.Windows.Forms.TextBox txtAdditionalVoids;
|
||||||
private System.Windows.Forms.TextBox txtVoidsInSystem;
|
private System.Windows.Forms.TextBox txtVoidsInSystem;
|
||||||
|
|||||||
@ -2,7 +2,6 @@
|
|||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using Tanshu.Accounts.Repository;
|
using Tanshu.Accounts.Repository;
|
||||||
using Tanshu.Accounts.Print;
|
using Tanshu.Accounts.Print;
|
||||||
using Tanshu.Accounts.Helpers;
|
|
||||||
|
|
||||||
namespace Tanshu.Accounts.PointOfSale
|
namespace Tanshu.Accounts.PointOfSale
|
||||||
{
|
{
|
||||||
@ -10,14 +9,13 @@ namespace Tanshu.Accounts.PointOfSale
|
|||||||
{
|
{
|
||||||
CheckoutBI _coProxy;
|
CheckoutBI _coProxy;
|
||||||
bool _loading;
|
bool _loading;
|
||||||
//private static readonly Tanshu.Logging.SqlLogger log = new Tanshu.Logging.SqlLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
|
||||||
public CashierCheckoutForm()
|
public CashierCheckoutForm()
|
||||||
{
|
{
|
||||||
_loading = true;
|
_loading = true;
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Cashier_Checkout_Form_Load(object sender, EventArgs e)
|
private void CashierCheckoutFormLoad(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
dtpStart.Format = DateTimePickerFormat.Custom;
|
dtpStart.Format = DateTimePickerFormat.Custom;
|
||||||
dtpStart.CustomFormat = "dd-MMM-yyyy";
|
dtpStart.CustomFormat = "dd-MMM-yyyy";
|
||||||
@ -31,12 +29,15 @@ namespace Tanshu.Accounts.PointOfSale
|
|||||||
|
|
||||||
private void FillUsers()
|
private void FillUsers()
|
||||||
{
|
{
|
||||||
|
var loading = _loading;
|
||||||
|
_loading = true;
|
||||||
cmbCashier.DisplayMember = "Name";
|
cmbCashier.DisplayMember = "Name";
|
||||||
cmbCashier.ValueMember = "UserID";
|
cmbCashier.ValueMember = "UserID";
|
||||||
cmbCashier.DataSource = UserBI.ListActive(dtpStart.Value.Date.AddHours(7), dtpFinish.Value.Date.AddDays(1).AddHours(7));
|
cmbCashier.DataSource = UserBI.ListActive(dtpStart.Value.Date.AddHours(7), dtpFinish.Value.Date.AddDays(1).AddHours(7));
|
||||||
|
_loading = loading;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cmbCashier_SelectedIndexChanged(object sender, EventArgs e)
|
private void CmbCashierSelectedIndexChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
EmployeeStatus();
|
EmployeeStatus();
|
||||||
//log.Warn(string.Format("User Checkout: {0} by {1}", coProxy.Cashier, Session.User.Name));
|
//log.Warn(string.Format("User Checkout: {0} by {1}", coProxy.Cashier, Session.User.Name));
|
||||||
@ -47,34 +48,34 @@ namespace Tanshu.Accounts.PointOfSale
|
|||||||
if (_loading || cmbCashier.SelectedValue == null)
|
if (_loading || cmbCashier.SelectedValue == null)
|
||||||
return;
|
return;
|
||||||
_coProxy = new CheckoutBI((int)cmbCashier.SelectedValue, dtpStart.Value, dtpFinish.Value);
|
_coProxy = new CheckoutBI((int)cmbCashier.SelectedValue, dtpStart.Value, dtpFinish.Value);
|
||||||
txtOpening.Text = string.Format("{0:#,##0.00}", _coProxy);
|
txtOpening.Text = string.Format("{0:#,##0.00}", _coProxy.Opening);
|
||||||
txtReceipts.Text = string.Format("{0:#,##0.00}", _coProxy.Receipts);
|
txtReceipts.Text = string.Format("{0:#,##0.00}", _coProxy.Receipts);
|
||||||
txtAdvanceReceived.Text = string.Format("{0:#,##0.00}", _coProxy.AdvanceReceipts);
|
txtAdvanceReceived.Text = string.Format("{0:#,##0.00}", _coProxy.AdvanceReceipts);
|
||||||
txtCCReceipts.Text = string.Format("{0:#,##0.00}", _coProxy.CcReceipts);
|
txtCCReceipts.Text = string.Format("{0:#,##0.00}", _coProxy.CcReceipts);
|
||||||
txtNC.Text = string.Format("{0:#,##0.00}", _coProxy.NcReceipts);
|
txtNC.Text = string.Format("{0:#,##0.00}", _coProxy.NcReceipts);
|
||||||
txtBillToCompany.Text = string.Format("{0:#,##0.00}", _coProxy.BtcReceipts);
|
txtBillToCompany.Text = string.Format("{0:#,##0.00}", _coProxy.BtcReceipts);
|
||||||
txtAdvanceAdjusted.Text = string.Format("{0:#,##0.00}", _coProxy.AdvanceAdjusted);
|
txtCashReceipts.Text = string.Format("{0:#,##0.00}", _coProxy.CashReceipts);
|
||||||
txtPayments.Text = string.Format("{0:#,##0.00}", _coProxy.CashPayments);
|
txtPayments.Text = string.Format("{0:#,##0.00}", _coProxy.CashPayments);
|
||||||
txtAdditionalVoids.Text = string.Format("{0:#,##0.00}", _coProxy.AdditionalVoids);
|
txtAdditionalVoids.Text = string.Format("{0:#,##0.00}", _coProxy.AdditionalVoids);
|
||||||
txtVoidsInSystem.Text = string.Format("{0:#,##0.00}", _coProxy.VoidsInSystem);
|
txtVoidsInSystem.Text = string.Format("{0:#,##0.00}", _coProxy.VoidsInSystem);
|
||||||
txtDiscounts.Text = string.Format("{0:#,##0.00}", _coProxy.Discount);
|
txtDiscounts.Text = string.Format("{0:#,##0.00}", _coProxy.Discount);
|
||||||
txtPending.Text = string.Format("{0:#,##0.00}", _coProxy.PendingBills);
|
txtPending.Text = string.Format("{0:#,##0.00}", _coProxy.PendingBills);
|
||||||
txtSales.Text = string.Format("{0:#,##0.00}", _coProxy.NetSales);
|
txtSales.Text = string.Format("{0:#,##0.00}", _coProxy.CashReceipts);
|
||||||
txtClosingCash.Text = string.Format("{0:#,##0.00}", _coProxy.ClosingBalance);
|
txtClosingCash.Text = string.Format("{0:#,##0.00}", _coProxy.ClosingBalance);
|
||||||
txtStatus.Text = _coProxy.Status;
|
txtStatus.Text = _coProxy.Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void dtpStart_ValueChanged(object sender, EventArgs e)
|
private void DtpStartValueChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
EmployeeStatus();
|
FillUsers();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void dtpFinish_ValueChanged(object sender, EventArgs e)
|
private void DtpFinishValueChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
EmployeeStatus();
|
FillUsers();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnCalculate_Click(object sender, EventArgs e)
|
private void BtnCalculateClick(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
decimal deposited = 0;
|
decimal deposited = 0;
|
||||||
if (!decimal.TryParse(txtDeposited.Text, out deposited))
|
if (!decimal.TryParse(txtDeposited.Text, out deposited))
|
||||||
@ -84,7 +85,7 @@ namespace Tanshu.Accounts.PointOfSale
|
|||||||
txtStatus.Text = _coProxy.Status;
|
txtStatus.Text = _coProxy.Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnPrint_Click(object sender, EventArgs e)
|
private void BtnPrintClick(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Thermal.PrintClosing(_coProxy);
|
Thermal.PrintClosing(_coProxy);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,25 +21,25 @@ namespace Tanshu.Accounts.Print
|
|||||||
[MarshalAs(UnmanagedType.LPStr)]
|
[MarshalAs(UnmanagedType.LPStr)]
|
||||||
public string pDataType;
|
public string pDataType;
|
||||||
}
|
}
|
||||||
[DllImport("winspool.Drv", EntryPoint = "OpenPrinterA", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
|
[DllImport("winspool.drv", EntryPoint = "OpenPrinterA", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
|
||||||
internal static extern bool OpenPrinter([MarshalAs(UnmanagedType.LPStr)] string szPrinter, out IntPtr hPrinter, IntPtr pd);
|
internal static extern bool OpenPrinter([MarshalAs(UnmanagedType.LPStr)] string szPrinter, out IntPtr hPrinter, IntPtr pd);
|
||||||
|
|
||||||
[DllImport("winspool.Drv", EntryPoint = "ClosePrinter", SetLastError = true, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
|
[DllImport("winspool.drv", EntryPoint = "ClosePrinter", SetLastError = true, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
|
||||||
internal static extern bool ClosePrinter(IntPtr hPrinter);
|
internal static extern bool ClosePrinter(IntPtr hPrinter);
|
||||||
|
|
||||||
[DllImport("winspool.Drv", EntryPoint = "StartDocPrinterA", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
|
[DllImport("winspool.drv", EntryPoint = "StartDocPrinterA", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
|
||||||
internal static extern bool StartDocPrinter(IntPtr hPrinter, Int32 level, [In, MarshalAs(UnmanagedType.LPStruct)] DOCINFOA di);
|
internal static extern bool StartDocPrinter(IntPtr hPrinter, Int32 level, [In, MarshalAs(UnmanagedType.LPStruct)] DOCINFOA di);
|
||||||
|
|
||||||
[DllImport("winspool.Drv", EntryPoint = "EndDocPrinter", SetLastError = true, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
|
[DllImport("winspool.drv", EntryPoint = "EndDocPrinter", SetLastError = true, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
|
||||||
internal static extern bool EndDocPrinter(IntPtr hPrinter);
|
internal static extern bool EndDocPrinter(IntPtr hPrinter);
|
||||||
|
|
||||||
[DllImport("winspool.Drv", EntryPoint = "StartPagePrinter", SetLastError = true, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
|
[DllImport("winspool.drv", EntryPoint = "StartPagePrinter", SetLastError = true, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
|
||||||
internal static extern bool StartPagePrinter(IntPtr hPrinter);
|
internal static extern bool StartPagePrinter(IntPtr hPrinter);
|
||||||
|
|
||||||
[DllImport("winspool.Drv", EntryPoint = "EndPagePrinter", SetLastError = true, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
|
[DllImport("winspool.drv", EntryPoint = "EndPagePrinter", SetLastError = true, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
|
||||||
internal static extern bool EndPagePrinter(IntPtr hPrinter);
|
internal static extern bool EndPagePrinter(IntPtr hPrinter);
|
||||||
|
|
||||||
[DllImport("winspool.Drv", EntryPoint = "WritePrinter", SetLastError = true, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
|
[DllImport("winspool.drv", EntryPoint = "WritePrinter", SetLastError = true, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
|
||||||
internal static extern bool WritePrinter(IntPtr hPrinter, IntPtr pBytes, Int32 dwCount, out Int32 dwWritten);
|
internal static extern bool WritePrinter(IntPtr hPrinter, IntPtr pBytes, Int32 dwCount, out Int32 dwWritten);
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -6,6 +6,7 @@ using Tanshu.Accounts.Contracts;
|
|||||||
using Tanshu.Accounts.Entities;
|
using Tanshu.Accounts.Entities;
|
||||||
using Tanshu.Accounts.Entities.Auth;
|
using Tanshu.Accounts.Entities.Auth;
|
||||||
using Tanshu.Accounts.Repository;
|
using Tanshu.Accounts.Repository;
|
||||||
|
using System.Diagnostics;
|
||||||
|
|
||||||
namespace Tanshu.Accounts.Print
|
namespace Tanshu.Accounts.Print
|
||||||
{
|
{
|
||||||
@ -271,13 +272,14 @@ namespace Tanshu.Accounts.Print
|
|||||||
billText += string.Format("\n\rCC Receipts : {0,26:#,##0.00}", details.CcReceipts);
|
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\rNC Amount : {0,26:#,##0.00}", details.NcReceipts);
|
||||||
billText += string.Format("\n\rBTC Amount : {0,26:#,##0.00}", details.BtcReceipts);
|
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\rAdvance Adj. : {0,26:#,##0.00}", details.AdvanceAdjusted);
|
billText += string.Format("\n\rAdvance Adj. : {0,26:#,##0.00}", details.AdvanceAdjusted);
|
||||||
//BillText += string.Format("\n\rPayments : {0,26:#,##0.00}", details.CashPayments);
|
//BillText += string.Format("\n\rPayments : {0,26:#,##0.00}", details.CashPayments);
|
||||||
//BillText += string.Format("\n\rAddl. Voids : {0,26:#,##0.00}", details.AdditionalVoids);
|
//BillText += string.Format("\n\rAddl. Voids : {0,26:#,##0.00}", details.AdditionalVoids);
|
||||||
billText += string.Format("\n\rVoids in Sys. : {0,26:#,##0.00}", details.VoidsInSystem);
|
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\rDiscounts : {0,26:#,##0.00}", details.Discount);
|
||||||
billText += string.Format("\n\rPending Bills : {0,26:#,##0.00}", details.PendingBills);
|
billText += string.Format("\n\rPending Bills : {0,26:#,##0.00}", details.PendingBills);
|
||||||
billText += string.Format("\n\rNet Sales : {0,26:#,##0.00}", details.NetSales);
|
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 += string.Format("\n\rClosing Bal. : {0,26:#,##0.00}", details.ClosingBalance);
|
||||||
billText += string.Format("\n\rCash Dep. : {0,26:#,##0.00}", details.CashDeposited);
|
billText += string.Format("\n\rCash Dep. : {0,26:#,##0.00}", details.CashDeposited);
|
||||||
billText += DrawLine;
|
billText += DrawLine;
|
||||||
@ -325,13 +327,15 @@ namespace Tanshu.Accounts.Print
|
|||||||
|
|
||||||
public static void PrintBill(int voucherID)
|
public static void PrintBill(int voucherID)
|
||||||
{
|
{
|
||||||
var voucher = VoucherBI.GetVoucher(voucherID);
|
var voucher = VoucherBI.Get(voucherID);
|
||||||
PrintRaw(PrintLocationBI.BasePrinter, DesignBill(voucher), "Bill");
|
PrintRaw(PrintLocationBI.BasePrinter, DesignBill(voucher), "Bill");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void PrintKot(int voucherID, int kotID)
|
public static void PrintKot(int voucherID, int kotID)
|
||||||
{
|
{
|
||||||
var voucher = VoucherBI.GetVoucher(voucherID);
|
var stopwatch = new Stopwatch();
|
||||||
|
stopwatch.Start();
|
||||||
|
var voucher = VoucherBI.Get(voucherID);
|
||||||
var dict = new Dictionary<PrintLocation, List<Inventory>>();
|
var dict = new Dictionary<PrintLocation, List<Inventory>>();
|
||||||
foreach (var item in voucher.Kots.Where(x => x.KotID == kotID))
|
foreach (var item in voucher.Kots.Where(x => x.KotID == kotID))
|
||||||
{
|
{
|
||||||
@ -346,13 +350,20 @@ namespace Tanshu.Accounts.Print
|
|||||||
dict[printer].Add(inventory);
|
dict[printer].Add(inventory);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
stopwatch.Stop();
|
||||||
|
Trace.TraceWarning("kot and printers built in {0} ms",stopwatch.ElapsedMilliseconds);
|
||||||
|
stopwatch.Reset();
|
||||||
foreach (var item in dict)
|
foreach (var item in dict)
|
||||||
{
|
{
|
||||||
for (var i = 0; i < item.Key.Copies; i++)
|
for (var i = 0; i < item.Key.Copies; i++)
|
||||||
{
|
{
|
||||||
|
stopwatch.Start();
|
||||||
PrintRaw(item.Key,
|
PrintRaw(item.Key,
|
||||||
DesignKot(voucher, voucher.Kots.Where(x => x.KotID == kotID).Single().Code, item.Value, i),
|
DesignKot(voucher, voucher.Kots.Where(x => x.KotID == kotID).Single().Code, item.Value, i),
|
||||||
"KOT");
|
"KOT");
|
||||||
|
stopwatch.Stop();
|
||||||
|
Trace.TraceWarning("kot designed and printed in {0} ms", stopwatch.ElapsedMilliseconds);
|
||||||
|
stopwatch.Reset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,6 +5,7 @@ using Tanshu.Accounts.Entities;
|
|||||||
using Tanshu.Accounts.Entities.Auth;
|
using Tanshu.Accounts.Entities.Auth;
|
||||||
using NHibernate.Criterion;
|
using NHibernate.Criterion;
|
||||||
using Tanshu.Accounts.Contracts;
|
using Tanshu.Accounts.Contracts;
|
||||||
|
using Tanshu.Common.Helpers;
|
||||||
|
|
||||||
namespace Tanshu.Accounts.Repository
|
namespace Tanshu.Accounts.Repository
|
||||||
{
|
{
|
||||||
@ -23,7 +24,7 @@ namespace Tanshu.Accounts.Repository
|
|||||||
public decimal VoidsInSystem { get; private set; }
|
public decimal VoidsInSystem { get; private set; }
|
||||||
public decimal Discount { get; private set; }
|
public decimal Discount { get; private set; }
|
||||||
public decimal PendingBills { get; private set; }
|
public decimal PendingBills { get; private set; }
|
||||||
public decimal NetSales { get; private set; }
|
public decimal CashReceipts { get; private set; }
|
||||||
public decimal ClosingBalance { get; private set; }
|
public decimal ClosingBalance { get; private set; }
|
||||||
public decimal RetainedOvernight { get; private set; }
|
public decimal RetainedOvernight { get; private set; }
|
||||||
public decimal CashDeposited { get; private set; } //
|
public decimal CashDeposited { get; private set; } //
|
||||||
@ -62,13 +63,13 @@ namespace Tanshu.Accounts.Repository
|
|||||||
this.FinishDate = finishDate.Date.AddDays(1).AddHours(5);
|
this.FinishDate = finishDate.Date.AddDays(1).AddHours(5);
|
||||||
|
|
||||||
string info;
|
string info;
|
||||||
PendingBills = GetPending(out info);
|
PendingBills = GetPrintInfo(out info,SettleOption.Unsettled);
|
||||||
PendingString = info;
|
PendingString = info;
|
||||||
CcReceipts = GetCreditCard(out info);
|
CcReceipts = GetPrintInfo(out info,SettleOption.CreditCard);
|
||||||
CcString = info;
|
CcString = info;
|
||||||
NcReceipts = GetNoCharge(out info);
|
NcReceipts = GetPrintInfo(out info, SettleOption.CreditCard);
|
||||||
NcString = info;
|
NcString = info;
|
||||||
BtcReceipts = GetBillToCompany(out info);
|
BtcReceipts = GetPrintInfo(out info, SettleOption.BillToCompany);
|
||||||
BtcString = info;
|
BtcString = info;
|
||||||
VoidsInSystem = GetVoids(out info);
|
VoidsInSystem = GetVoids(out info);
|
||||||
VoidsString = info;
|
VoidsString = info;
|
||||||
@ -89,21 +90,19 @@ namespace Tanshu.Accounts.Repository
|
|||||||
|
|
||||||
|
|
||||||
Cashiers = GetActiveCashiers();
|
Cashiers = GetActiveCashiers();
|
||||||
NetSales = GetNetSales();
|
CashReceipts = GetPrintInfo(out info, SettleOption.Cash);
|
||||||
Discount = GetDiscountBills(.1M, out info);
|
Discount = GetDiscountBills(.1M, out info);
|
||||||
DiscountString = info;
|
DiscountString = info;
|
||||||
ClosingBalance = Opening
|
ClosingBalance = Opening
|
||||||
+ Receipts
|
+ Receipts
|
||||||
+ AdvanceReceipts
|
+ AdvanceReceipts
|
||||||
- CcReceipts
|
|
||||||
- BtcReceipts
|
|
||||||
- AdvanceAdjusted
|
|
||||||
- CashPayments
|
- CashPayments
|
||||||
- AdditionalVoids
|
- AdditionalVoids
|
||||||
+ NetSales;
|
+ CashReceipts;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region Advances
|
||||||
private decimal GetAdvancesAdjusted()
|
private decimal GetAdvancesAdjusted()
|
||||||
{
|
{
|
||||||
using (var session = SessionManager.Session)
|
using (var session = SessionManager.Session)
|
||||||
@ -127,6 +126,8 @@ namespace Tanshu.Accounts.Repository
|
|||||||
return amt;
|
return amt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
public void Calculate(decimal cashDeposited, decimal retainedOvernight)
|
public void Calculate(decimal cashDeposited, decimal retainedOvernight)
|
||||||
{
|
{
|
||||||
this.CashDeposited = cashDeposited;
|
this.CashDeposited = cashDeposited;
|
||||||
@ -135,84 +136,123 @@ namespace Tanshu.Accounts.Repository
|
|||||||
Status = string.Format("{0:Extra Cash Rs #,##0.00; Cash Short Rs #,##0.00;Cash Perfect}", Excess);
|
Status = string.Format("{0:Extra Cash Rs #,##0.00; Cash Short Rs #,##0.00;Cash Perfect}", Excess);
|
||||||
}
|
}
|
||||||
|
|
||||||
private decimal GetPending(out string info)
|
private decimal GetPrintInfo(out string info, SettleOption settleOption)
|
||||||
{
|
{
|
||||||
using (var session = SessionManager.Session)
|
using (var session = SessionManager.Session)
|
||||||
{
|
{
|
||||||
Voucher voucher = null;
|
Voucher voucher = null;
|
||||||
decimal amount;
|
decimal amount;
|
||||||
decimal discount;
|
decimal discount;
|
||||||
info = "\n\r--- Pending Bills ------------------------";
|
info = string.Format("\n\r--- {0} ", settleOption.Display()).PadRight(44,'-');
|
||||||
var list = session.QueryOver<Voucher>(() => voucher)
|
var list = session.QueryOver<Voucher>(() => voucher)
|
||||||
.Where(i => i.LastEditDate >= StartDate &&
|
.Where(i => i.LastEditDate >= StartDate &&
|
||||||
i.LastEditDate <= FinishDate &&
|
i.LastEditDate <= FinishDate &&
|
||||||
i.User == Cashier &&
|
i.User == Cashier &&
|
||||||
i.Void == false)
|
i.Void == false)
|
||||||
.WithSubquery.WhereExists(QueryOver.Of<VoucherSettlement>().Where(x => x.Voucher.VoucherID == voucher.VoucherID && x.Settled == SettleOption.Unsettled).Select(x => x.Voucher))
|
.WithSubquery.WhereExists(QueryOver.Of<VoucherSettlement>().Where(x => x.Voucher.VoucherID == voucher.VoucherID && x.Settled == settleOption).Select(x => x.Voucher))
|
||||||
.List();
|
.List();
|
||||||
GetInfo(list, SettleOption.Unsettled, out amount, out discount, ref info);
|
GetInfo(list, SettleOption.Unsettled, out amount, out discount, ref info);
|
||||||
return amount;
|
return amount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private decimal GetNoCharge(out string info)
|
//private decimal GetPending(out string info)
|
||||||
{
|
//{
|
||||||
using (var session = SessionManager.Session)
|
// using (var session = SessionManager.Session)
|
||||||
{
|
// {
|
||||||
Voucher voucher = null;
|
// Voucher voucher = null;
|
||||||
decimal amount;
|
// decimal amount;
|
||||||
decimal discount;
|
// decimal discount;
|
||||||
info = "\n\r--- No Charge ----------------------------";
|
// info = "\n\r--- Pending Bills ------------------------";
|
||||||
var list = session.QueryOver<Voucher>(() => voucher)
|
// var list = session.QueryOver<Voucher>(() => voucher)
|
||||||
.Where(i => i.LastEditDate >= StartDate &&
|
// .Where(i => i.LastEditDate >= StartDate &&
|
||||||
i.LastEditDate <= FinishDate &&
|
// i.LastEditDate <= FinishDate &&
|
||||||
i.User == Cashier &&
|
// i.User == Cashier &&
|
||||||
i.Void == false)
|
// i.Void == false)
|
||||||
.WithSubquery.WhereExists(QueryOver.Of<VoucherSettlement>().Where(x => x.Voucher.VoucherID == voucher.VoucherID && x.Settled == SettleOption.NoCharge).Select(x => x.Voucher))
|
// .WithSubquery.WhereExists(QueryOver.Of<VoucherSettlement>().Where(x => x.Voucher.VoucherID == voucher.VoucherID && x.Settled == SettleOption.Unsettled).Select(x => x.Voucher))
|
||||||
.List();
|
// .List();
|
||||||
GetInfo(list, SettleOption.NoCharge, out amount, out discount, ref info);
|
// GetInfo(list, SettleOption.Unsettled, out amount, out discount, ref info);
|
||||||
return amount;
|
// 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);
|
//private decimal GetNoCharge(out string info)
|
||||||
return amount;
|
//{
|
||||||
}
|
// 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)
|
private decimal GetVoids(out string info)
|
||||||
{
|
{
|
||||||
using (var session = SessionManager.Session)
|
using (var session = SessionManager.Session)
|
||||||
@ -261,31 +301,6 @@ and i.Discount >= :discount";
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private decimal GetNetSales()
|
|
||||||
{
|
|
||||||
using (var session = SessionManager.Session)
|
|
||||||
{
|
|
||||||
const string query = @"
|
|
||||||
select sum(i.Amount) 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)
|
|
||||||
";
|
|
||||||
var amount = 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)
|
|
||||||
.UniqueResult<decimal>();
|
|
||||||
return amount;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void GetInfo(ICollection<Voucher> list, out decimal amount, out decimal discount, ref string info)
|
private static void GetInfo(ICollection<Voucher> list, out decimal amount, out decimal discount, ref string info)
|
||||||
{
|
{
|
||||||
amount = 0;
|
amount = 0;
|
||||||
|
|||||||
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||||||
using NHibernate;
|
using NHibernate;
|
||||||
using NHibernate.Criterion;
|
using NHibernate.Criterion;
|
||||||
using Tanshu.Accounts.Entities;
|
using Tanshu.Accounts.Entities;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace Tanshu.Accounts.Repository
|
namespace Tanshu.Accounts.Repository
|
||||||
{
|
{
|
||||||
@ -63,7 +64,7 @@ namespace Tanshu.Accounts.Repository
|
|||||||
return _session.Get<FoodTable>(foodTableID);
|
return _session.Get<FoodTable>(foodTableID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public FoodTable GetByName(string name)
|
public FoodTable Get(string name)
|
||||||
{
|
{
|
||||||
return _session.CreateCriteria<FoodTable>()
|
return _session.CreateCriteria<FoodTable>()
|
||||||
.Add(Restrictions.Eq("Name", name))
|
.Add(Restrictions.Eq("Name", name))
|
||||||
@ -122,5 +123,17 @@ namespace Tanshu.Accounts.Repository
|
|||||||
return voucher.VoucherID;
|
return voucher.VoucherID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void UpdateStatus(Voucher voucher)
|
||||||
|
{
|
||||||
|
string status;
|
||||||
|
if (!voucher.Printed)
|
||||||
|
status = "running";
|
||||||
|
else if (voucher.Settlements.Count(x => x.Settled == SettleOption.Unsettled) != 0 && voucher.Void == false)
|
||||||
|
status = "printed";
|
||||||
|
else
|
||||||
|
status = null;
|
||||||
|
UpdateStatus(voucher.TableID, voucher.VoucherID, status);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -67,7 +67,8 @@ namespace Tanshu.Accounts.Repository
|
|||||||
}
|
}
|
||||||
UpdateSettlements(voucher, session);
|
UpdateSettlements(voucher, session);
|
||||||
session.Save(voucher);
|
session.Save(voucher);
|
||||||
UpdateTable(voucher, session);
|
using (var ft = new FoodTableBI(session, true))
|
||||||
|
ft.UpdateStatus(voucher);
|
||||||
trans.Commit();
|
trans.Commit();
|
||||||
return addedKot == null ? (int?)null : addedKot.KotID;
|
return addedKot == null ? (int?)null : addedKot.KotID;
|
||||||
}
|
}
|
||||||
@ -82,13 +83,13 @@ namespace Tanshu.Accounts.Repository
|
|||||||
voucher.Settlements.Add(new VoucherSettlement() { Amount = amount, Settled = SettleOption.Amount });
|
voucher.Settlements.Add(new VoucherSettlement() { Amount = amount, Settled = SettleOption.Amount });
|
||||||
else
|
else
|
||||||
voucher.Settlements.Single(x => x.Settled == SettleOption.Amount).Amount = amount;
|
voucher.Settlements.Single(x => x.Settled == SettleOption.Amount).Amount = amount;
|
||||||
|
|
||||||
var roundoff = Math.Round(amount) - amount;
|
var roundoff = Math.Round(amount) - amount;
|
||||||
if (voucher.Settlements.Count(x => x.Settled == SettleOption.RoundOff) == 0)
|
if (voucher.Settlements.Count(x => x.Settled == SettleOption.RoundOff) == 0)
|
||||||
voucher.Settlements.Add(new VoucherSettlement() { Amount = roundoff, Settled = SettleOption.RoundOff });
|
voucher.Settlements.Add(new VoucherSettlement() { Amount = roundoff, Settled = SettleOption.RoundOff });
|
||||||
else
|
else
|
||||||
voucher.Settlements.Single(x => x.Settled == SettleOption.RoundOff).Amount = roundoff;
|
voucher.Settlements.Single(x => x.Settled == SettleOption.RoundOff).Amount = roundoff;
|
||||||
|
|
||||||
var balance = voucher.Settlements.Where(x => x.Settled != SettleOption.Unsettled).Sum(x => x.Amount) * -1;
|
var balance = voucher.Settlements.Where(x => x.Settled != SettleOption.Unsettled).Sum(x => x.Amount) * -1;
|
||||||
if (voucher.Settlements.Count(x => x.Settled == SettleOption.Unsettled) == 0)
|
if (voucher.Settlements.Count(x => x.Settled == SettleOption.Unsettled) == 0)
|
||||||
voucher.Settlements.Add(new VoucherSettlement() { Amount = balance, Settled = SettleOption.Unsettled });
|
voucher.Settlements.Add(new VoucherSettlement() { Amount = balance, Settled = SettleOption.Unsettled });
|
||||||
@ -144,7 +145,8 @@ namespace Tanshu.Accounts.Repository
|
|||||||
}
|
}
|
||||||
UpdateSettlements(voucher, session);
|
UpdateSettlements(voucher, session);
|
||||||
session.Update(voucher);
|
session.Update(voucher);
|
||||||
UpdateTable(voucher, session);
|
using (var ft = new FoodTableBI(session, true))
|
||||||
|
ft.UpdateStatus(voucher);
|
||||||
trans.Commit();
|
trans.Commit();
|
||||||
if (addedKot == null)
|
if (addedKot == null)
|
||||||
return null;
|
return null;
|
||||||
@ -153,21 +155,21 @@ namespace Tanshu.Accounts.Repository
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static private void UpdateTable(Voucher voucher, ISession session)
|
//static private void UpdateTable(Voucher voucher, ISession session)
|
||||||
{
|
//{
|
||||||
using (var ft = new FoodTableBI(session, true))
|
// using (var ft = new FoodTableBI(session, true))
|
||||||
{
|
// {
|
||||||
string status;
|
// string status;
|
||||||
if (!voucher.Printed)
|
// if (!voucher.Printed)
|
||||||
status = "running";
|
// status = "running";
|
||||||
else if (voucher.Settlements.Count(x => x.Settled == SettleOption.Unsettled) != 0 && voucher.Void == false)
|
// else if (voucher.Settlements.Count(x => x.Settled == SettleOption.Unsettled) != 0 && voucher.Void == false)
|
||||||
status = "printed";
|
// status = "printed";
|
||||||
else
|
// else
|
||||||
status = null;
|
// status = null;
|
||||||
ft.UpdateStatus(voucher.TableID, voucher.VoucherID, status);
|
// ft.UpdateStatus(voucher.TableID, voucher.VoucherID, status);
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
static public Voucher GetVoucher(int voucherID)
|
static public Voucher Get(int voucherID)
|
||||||
{
|
{
|
||||||
using (var session = SessionManager.Session)
|
using (var session = SessionManager.Session)
|
||||||
{
|
{
|
||||||
@ -198,11 +200,12 @@ namespace Tanshu.Accounts.Repository
|
|||||||
{
|
{
|
||||||
using (var trans = session.BeginTransaction())
|
using (var trans = session.BeginTransaction())
|
||||||
{
|
{
|
||||||
var saleVoucher = session.Get<Voucher>(voucherID);
|
var voucher = session.Get<Voucher>(voucherID);
|
||||||
saleVoucher.Void = true;
|
voucher.Void = true;
|
||||||
saleVoucher.VoidReason = reason;
|
voucher.VoidReason = reason;
|
||||||
session.Save(saleVoucher);
|
session.Save(voucher);
|
||||||
UpdateTable(saleVoucher, session);
|
using (var ft = new FoodTableBI(session, true))
|
||||||
|
ft.UpdateStatus(voucher);
|
||||||
trans.Commit();
|
trans.Commit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -223,7 +226,8 @@ namespace Tanshu.Accounts.Repository
|
|||||||
voucher.User = user;
|
voucher.User = user;
|
||||||
voucher.LastEditDate = DbValues.Date;
|
voucher.LastEditDate = DbValues.Date;
|
||||||
session.Update(voucher);
|
session.Update(voucher);
|
||||||
UpdateTable(voucher, session);
|
using (var ft = new FoodTableBI(session, true))
|
||||||
|
ft.UpdateStatus(voucher);
|
||||||
trans.Commit();
|
trans.Commit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,7 +21,7 @@ namespace Tanshu.Accounts.Repository
|
|||||||
{
|
{
|
||||||
using (var session = SessionManager.Session)
|
using (var session = SessionManager.Session)
|
||||||
{
|
{
|
||||||
string query = @"SELECT ISNULL('K-' + CAST(MAX(CAST(SUBSTRING(KotID, 3,8) AS int)) + 1 AS nvarchar(8)), 'K-1') FROM Entities_Vouchers";
|
const string query = @"SELECT ISNULL('K-' + CAST(MAX(CAST(SUBSTRING(KotID, 3,8) AS int)) + 1 AS nvarchar(8)), 'K-1') FROM Entities_Vouchers";
|
||||||
var sqlQuery = session.CreateSQLQuery(query);
|
var sqlQuery = session.CreateSQLQuery(query);
|
||||||
return (string)sqlQuery.UniqueResult();
|
return (string)sqlQuery.UniqueResult();
|
||||||
}
|
}
|
||||||
@ -33,7 +33,7 @@ namespace Tanshu.Accounts.Repository
|
|||||||
{
|
{
|
||||||
using (var session = SessionManager.Session)
|
using (var session = SessionManager.Session)
|
||||||
{
|
{
|
||||||
string query = @"SELECT ISNULL('S-' + CAST(MAX(CAST(SUBSTRING(Code, 3,8) AS int)) + 1 AS nvarchar(8)), 'S-1') FROM Entities_Kots";
|
const string query = @"SELECT ISNULL('S-' + CAST(MAX(CAST(SUBSTRING(Code, 3,8) AS int)) + 1 AS nvarchar(8)), 'S-1') FROM Entities_Kots";
|
||||||
var sqlQuery = session.CreateSQLQuery(query);
|
var sqlQuery = session.CreateSQLQuery(query);
|
||||||
return (string)sqlQuery.UniqueResult();
|
return (string)sqlQuery.UniqueResult();
|
||||||
}
|
}
|
||||||
@ -45,7 +45,7 @@ namespace Tanshu.Accounts.Repository
|
|||||||
{
|
{
|
||||||
using (var session = SessionManager.Session)
|
using (var session = SessionManager.Session)
|
||||||
{
|
{
|
||||||
string query = @"
|
const string query = @"
|
||||||
DECLARE @BillID nvarchar(10)
|
DECLARE @BillID nvarchar(10)
|
||||||
SELECT @BillID = ISNULL(CAST(MAX(CAST(REPLACE(BillID, '-', '') AS int)) + 1 AS nvarchar(9)), '010001') FROM Entities_Vouchers WHERE BillID LIKE '__-____'
|
SELECT @BillID = ISNULL(CAST(MAX(CAST(REPLACE(BillID, '-', '') AS int)) + 1 AS nvarchar(9)), '010001') FROM Entities_Vouchers WHERE BillID LIKE '__-____'
|
||||||
IF LEN(@BillID) = 5
|
IF LEN(@BillID) = 5
|
||||||
|
|||||||
@ -11,39 +11,39 @@ namespace Tanshu.Accounts.Contracts
|
|||||||
{
|
{
|
||||||
public static class Session
|
public static class Session
|
||||||
{
|
{
|
||||||
private static Dictionary<string, bool> roles;
|
private static Dictionary<string, bool> _roles;
|
||||||
private static User currentUser;
|
private static User _currentUser;
|
||||||
public static bool IsAuthenticated { get; private set; }
|
public static bool IsAuthenticated { get; private set; }
|
||||||
public static User User
|
public static User User
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return currentUser;
|
return _currentUser;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value != null)
|
if (value != null)
|
||||||
{
|
{
|
||||||
currentUser = value;
|
_currentUser = value;
|
||||||
IsAuthenticated = true;
|
IsAuthenticated = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
currentUser = null;
|
_currentUser = null;
|
||||||
IsAuthenticated = false;
|
IsAuthenticated = false;
|
||||||
roles = null;
|
_roles = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static bool IsAllowed(RoleConstants role)
|
public static bool IsAllowed(RoleConstants role)
|
||||||
{
|
{
|
||||||
if (currentUser == null)
|
if (_currentUser == null)
|
||||||
return false;
|
return false;
|
||||||
if (roles == null)
|
if (_roles == null)
|
||||||
roles = new Dictionary<string, bool>();
|
_roles = new Dictionary<string, bool>();
|
||||||
if (!roles.ContainsKey(role.Role))
|
if (!_roles.ContainsKey(role.Role))
|
||||||
roles.Add(role.Role, MembershipBI.IsUserInRole(currentUser.UserID, role.Role));
|
_roles.Add(role.Role, MembershipBI.IsUserInRole(_currentUser.UserID, role.Role));
|
||||||
return roles[role.Role];
|
return _roles[role.Role];
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user