2010-03-02 17:56:21 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Windows.Forms;
|
2011-01-30 07:14:05 +00:00
|
|
|
|
using Tanshu.Accounts.Repository;
|
2010-03-02 17:56:21 +00:00
|
|
|
|
using Tanshu.Accounts.Print;
|
|
|
|
|
|
|
|
|
|
namespace Tanshu.Accounts.PointOfSale
|
|
|
|
|
{
|
2011-03-11 18:49:48 +00:00
|
|
|
|
public partial class CashierCheckoutForm : Form
|
2010-03-02 17:56:21 +00:00
|
|
|
|
{
|
2011-03-11 18:49:48 +00:00
|
|
|
|
CheckoutBI _coProxy;
|
|
|
|
|
bool _loading;
|
|
|
|
|
public CashierCheckoutForm()
|
2010-03-02 17:56:21 +00:00
|
|
|
|
{
|
2011-03-11 18:49:48 +00:00
|
|
|
|
_loading = true;
|
2010-03-02 17:56:21 +00:00
|
|
|
|
InitializeComponent();
|
|
|
|
|
}
|
|
|
|
|
|
2011-04-11 12:55:45 +00:00
|
|
|
|
private void CashierCheckoutFormLoad(object sender, EventArgs e)
|
2010-03-02 17:56:21 +00:00
|
|
|
|
{
|
|
|
|
|
dtpStart.Format = DateTimePickerFormat.Custom;
|
2011-02-09 12:03:22 +00:00
|
|
|
|
dtpStart.CustomFormat = "dd-MMM-yyyy";
|
2011-03-11 18:49:48 +00:00
|
|
|
|
dtpStart.Value = DateTime.Now.Date;
|
2010-03-02 17:56:21 +00:00
|
|
|
|
dtpFinish.Format = DateTimePickerFormat.Custom;
|
2011-02-09 12:03:22 +00:00
|
|
|
|
dtpFinish.CustomFormat = "dd-MMM-yyyy";
|
2011-03-11 18:49:48 +00:00
|
|
|
|
dtpFinish.Value = DateTime.Now.Date;
|
2010-03-02 17:56:21 +00:00
|
|
|
|
FillUsers();
|
2011-03-11 18:49:48 +00:00
|
|
|
|
_loading = false;
|
2010-03-02 17:56:21 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void FillUsers()
|
|
|
|
|
{
|
2011-04-11 12:55:45 +00:00
|
|
|
|
var loading = _loading;
|
|
|
|
|
_loading = true;
|
2010-03-02 17:56:21 +00:00
|
|
|
|
cmbCashier.DisplayMember = "Name";
|
|
|
|
|
cmbCashier.ValueMember = "UserID";
|
2011-06-23 12:47:48 +00:00
|
|
|
|
using (var bi = new UserBI())
|
|
|
|
|
cmbCashier.DataSource = bi.ListActive(dtpStart.Value.Date.AddHours(7), dtpFinish.Value.Date.AddDays(1).AddHours(7));
|
2011-04-11 12:55:45 +00:00
|
|
|
|
_loading = loading;
|
2010-03-02 17:56:21 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-04-11 12:55:45 +00:00
|
|
|
|
private void CmbCashierSelectedIndexChanged(object sender, EventArgs e)
|
2010-03-02 17:56:21 +00:00
|
|
|
|
{
|
|
|
|
|
EmployeeStatus();
|
2011-01-30 07:14:05 +00:00
|
|
|
|
//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()
|
|
|
|
|
{
|
2011-03-11 18:49:48 +00:00
|
|
|
|
if (_loading || cmbCashier.SelectedValue == null)
|
2010-03-02 17:56:21 +00:00
|
|
|
|
return;
|
2011-03-11 18:49:48 +00:00
|
|
|
|
_coProxy = new CheckoutBI((int)cmbCashier.SelectedValue, dtpStart.Value, dtpFinish.Value);
|
2011-04-11 12:55:45 +00:00
|
|
|
|
txtOpening.Text = string.Format("{0:#,##0.00}", _coProxy.Opening);
|
2011-03-11 18:49:48 +00:00
|
|
|
|
txtReceipts.Text = string.Format("{0:#,##0.00}", _coProxy.Receipts);
|
|
|
|
|
txtAdvanceReceived.Text = string.Format("{0:#,##0.00}", _coProxy.AdvanceReceipts);
|
|
|
|
|
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);
|
2011-04-11 12:55:45 +00:00
|
|
|
|
txtCashReceipts.Text = string.Format("{0:#,##0.00}", _coProxy.CashReceipts);
|
2011-03-11 18:49:48 +00:00
|
|
|
|
txtPayments.Text = string.Format("{0:#,##0.00}", _coProxy.CashPayments);
|
|
|
|
|
txtAdditionalVoids.Text = string.Format("{0:#,##0.00}", _coProxy.AdditionalVoids);
|
|
|
|
|
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);
|
2011-04-11 12:55:45 +00:00
|
|
|
|
txtSales.Text = string.Format("{0:#,##0.00}", _coProxy.CashReceipts);
|
2011-03-11 18:49:48 +00:00
|
|
|
|
txtClosingCash.Text = string.Format("{0:#,##0.00}", _coProxy.ClosingBalance);
|
|
|
|
|
txtStatus.Text = _coProxy.Status;
|
2010-03-02 17:56:21 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-04-11 12:55:45 +00:00
|
|
|
|
private void DtpStartValueChanged(object sender, EventArgs e)
|
2010-03-02 17:56:21 +00:00
|
|
|
|
{
|
2011-04-11 12:55:45 +00:00
|
|
|
|
FillUsers();
|
2010-03-02 17:56:21 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-04-11 12:55:45 +00:00
|
|
|
|
private void DtpFinishValueChanged(object sender, EventArgs e)
|
2010-03-02 17:56:21 +00:00
|
|
|
|
{
|
2011-04-11 12:55:45 +00:00
|
|
|
|
FillUsers();
|
2010-03-02 17:56:21 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-04-11 12:55:45 +00:00
|
|
|
|
private void BtnCalculateClick(object sender, EventArgs e)
|
2010-03-02 17:56:21 +00:00
|
|
|
|
{
|
|
|
|
|
decimal deposited = 0;
|
|
|
|
|
if (!decimal.TryParse(txtDeposited.Text, out deposited))
|
|
|
|
|
deposited = 0;
|
|
|
|
|
|
2011-03-11 18:49:48 +00:00
|
|
|
|
_coProxy.Calculate(deposited, 0);
|
|
|
|
|
txtStatus.Text = _coProxy.Status;
|
2010-03-02 17:56:21 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-04-11 12:55:45 +00:00
|
|
|
|
private void BtnPrintClick(object sender, EventArgs e)
|
2010-03-02 17:56:21 +00:00
|
|
|
|
{
|
2011-03-11 18:49:48 +00:00
|
|
|
|
Thermal.PrintClosing(_coProxy);
|
2010-03-02 17:56:21 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|