narsil/Tanshu.Accounts.PointOfSale/Sales/CheckoutForm.cs

94 lines
3.3 KiB
C#
Raw Normal View History

2010-03-02 17:56:21 +00:00
using System;
using System.Windows.Forms;
using Tanshu.Accounts.Repository;
2010-03-02 17:56:21 +00:00
using Tanshu.Accounts.Print;
using Tanshu.Accounts.Helpers;
namespace Tanshu.Accounts.PointOfSale
{
public partial class Cashier_Checkout_Form : Form
{
CheckoutBI coProxy;
//private static readonly Tanshu.Logging.SqlLogger log = new Tanshu.Logging.SqlLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
2010-03-02 17:56:21 +00:00
public Cashier_Checkout_Form()
{
InitializeComponent();
}
private void Cashier_Checkout_Form_Load(object sender, EventArgs e)
{
dtpStart.Format = DateTimePickerFormat.Custom;
dtpStart.CustomFormat = "dd-MMM-yyyy HH:mm:ss";
dtpStart.Value = DateTime.Now;
dtpFinish.Format = DateTimePickerFormat.Custom;
dtpFinish.CustomFormat = "dd-MMM-yyyy HH:mm:ss";
dtpFinish.Value = DateTime.Now;
FillUsers();
}
private void FillUsers()
{
cmbCashier.DisplayMember = "Name";
cmbCashier.ValueMember = "UserID";
cmbCashier.DataSource = UserBI.GetUsers();
2010-03-02 17:56:21 +00:00
}
private void cmbCashier_SelectedIndexChanged(object sender, EventArgs e)
{
EmployeeStatus();
//log.Warn(string.Format("User Checkout: {0} by {1}", coProxy.Cashier, Session.User.Name));
2010-03-02 17:56:21 +00:00
}
private void EmployeeStatus()
{
if (cmbCashier.SelectedValue == null)
return;
dtpStart.Value = Convert.ToDateTime(String.Format("{0:dd-MMM-yyyy} 00:00:00", dtpStart.Value));
dtpFinish.Value = Convert.ToDateTime(String.Format("{0:dd-MMM-yyyy} 23:59:59", dtpFinish.Value));
coProxy = new CheckoutBI((int)cmbCashier.SelectedValue, dtpStart.Value, dtpFinish.Value);
2010-03-02 17:56:21 +00:00
txtOpening.Text = coProxy.Opening.ToString();
txtReceipts.Text = coProxy.Receipts.ToString();
txtAdvanceReceived.Text = coProxy.AdvanceReceipts.ToString();
txtCCReceipts.Text = coProxy.CCReceipts.ToString();
txtAdvanceAdjusted.Text = coProxy.AdvanceAdjusted.ToString();
txtPayments.Text = coProxy.CashPayments.ToString();
txtAdditionalVoids.Text = coProxy.AdditionalVoids.ToString();
txtVoidsInSystem.Text = coProxy.VoidsInSystem.ToString();
txtPending.Text = coProxy.PendingBills.ToString();
txtSales.Text = coProxy.NetSales.ToString();
txtClosingCash.Text = coProxy.ClosingBalance.ToString();
txtStatus.Text = coProxy.Status;
}
private void dtpStart_ValueChanged(object sender, EventArgs e)
{
EmployeeStatus();
}
private void dtpFinish_ValueChanged(object sender, EventArgs e)
{
EmployeeStatus();
}
private void btnCalculate_Click(object sender, EventArgs e)
{
decimal deposited = 0;
if (!decimal.TryParse(txtDeposited.Text, out deposited))
deposited = 0;
coProxy.Calculate(deposited, 0);
txtStatus.Text = coProxy.Status;
}
private void btnPrint_Click(object sender, EventArgs e)
{
Thermal.PrintClosing(coProxy);
2010-03-02 17:56:21 +00:00
}
private void txtSales_TextChanged(object sender, EventArgs e)
{
}
}
}