2010-03-02 17:56:21 +00:00
|
|
|
|
using System;
|
2014-11-06 10:39:11 +00:00
|
|
|
|
using System.Linq;
|
2010-03-02 17:56:21 +00:00
|
|
|
|
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;
|
2014-11-06 10:39:11 +00:00
|
|
|
|
using Tanshu.Accounts.Entities;
|
2010-03-02 17:56:21 +00:00
|
|
|
|
|
|
|
|
|
namespace Tanshu.Accounts.PointOfSale
|
|
|
|
|
{
|
2016-07-04 06:21:39 +00:00
|
|
|
|
public partial class CheckoutForm : Form
|
2010-03-02 17:56:21 +00:00
|
|
|
|
{
|
2011-03-11 18:49:48 +00:00
|
|
|
|
CheckoutBI _coProxy;
|
|
|
|
|
bool _loading;
|
2016-07-04 06:21:39 +00:00
|
|
|
|
public CheckoutForm()
|
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();
|
|
|
|
|
}
|
|
|
|
|
|
2016-07-04 06:21:39 +00:00
|
|
|
|
private void CheckoutForm_Load(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;
|
|
|
|
|
_loading = false;
|
2014-11-06 10:39:11 +00:00
|
|
|
|
FillUsers();
|
2010-03-02 17:56:21 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void FillUsers()
|
|
|
|
|
{
|
2011-04-11 12:55:45 +00:00
|
|
|
|
_loading = true;
|
2018-08-24 10:41:33 +00:00
|
|
|
|
_coProxy = new CheckoutBI(dtpStart.Value, dtpFinish.Value);
|
2010-03-02 17:56:21 +00:00
|
|
|
|
cmbCashier.DisplayMember = "Name";
|
|
|
|
|
cmbCashier.ValueMember = "UserID";
|
2018-08-24 10:41:33 +00:00
|
|
|
|
cmbCashier.DataSource = _coProxy.Cashiers;
|
2014-11-06 10:39:11 +00:00
|
|
|
|
_loading = false;
|
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
|
|
|
|
{
|
2018-08-24 10:41:33 +00:00
|
|
|
|
if (_loading)
|
2010-03-02 17:56:21 +00:00
|
|
|
|
return;
|
2018-08-24 10:41:33 +00:00
|
|
|
|
_coProxy.Cashier = (User)cmbCashier.SelectedItem;
|
|
|
|
|
var list = _coProxy.amounts.ToList();
|
2014-11-06 10:39:11 +00:00
|
|
|
|
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;
|
2010-03-02 17:56:21 +00:00
|
|
|
|
}
|
|
|
|
|
|
2018-08-24 10:41:33 +00:00
|
|
|
|
//private void ShowStatement()
|
|
|
|
|
//{
|
|
|
|
|
// if (_loading || cmbCashier.SelectedValue == null)
|
|
|
|
|
// return;
|
|
|
|
|
// _coProxy = new CheckoutBI((Guid)cmbCashier.SelectedValue, dtpStart.Value, dtpFinish.Value);
|
|
|
|
|
// 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;
|
|
|
|
|
//}
|
|
|
|
|
|
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 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
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|