87 lines
3.0 KiB
C#
87 lines
3.0 KiB
C#
using System;
|
|
using System.Linq;
|
|
using System.Windows.Forms;
|
|
using Tanshu.Accounts.Repository;
|
|
using Tanshu.Accounts.Print;
|
|
using Tanshu.Accounts.Entities;
|
|
|
|
namespace Tanshu.Accounts.PointOfSale
|
|
{
|
|
public partial class CheckoutForm : Form
|
|
{
|
|
CheckoutBI _coProxy;
|
|
bool _loading;
|
|
public CheckoutForm()
|
|
{
|
|
_loading = true;
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void CheckoutForm_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;
|
|
FillUsers();
|
|
}
|
|
|
|
private void FillUsers()
|
|
{
|
|
_loading = true;
|
|
_coProxy = new CheckoutBI(dtpStart.Value, dtpFinish.Value);
|
|
cmbCashier.DisplayMember = "Name";
|
|
cmbCashier.ValueMember = "UserID";
|
|
cmbCashier.DataSource = _coProxy.Cashiers;
|
|
_loading = false;
|
|
}
|
|
|
|
private void CmbCashierSelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
if (_loading)
|
|
return;
|
|
_coProxy.Cashier = (User)cmbCashier.SelectedItem;
|
|
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 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;
|
|
//}
|
|
|
|
private void DtpStartValueChanged(object sender, EventArgs e)
|
|
{
|
|
FillUsers();
|
|
}
|
|
|
|
private void DtpFinishValueChanged(object sender, EventArgs e)
|
|
{
|
|
FillUsers();
|
|
}
|
|
|
|
private void BtnPrintClick(object sender, EventArgs e)
|
|
{
|
|
Thermal.PrintClosing(_coProxy);
|
|
}
|
|
}
|
|
} |