2010-03-02 23:26:21 +05:30
|
|
|
|
using System;
|
2014-11-06 16:09:11 +05:30
|
|
|
|
using System.Linq;
|
2010-03-02 23:26:21 +05:30
|
|
|
|
using System.Windows.Forms;
|
2011-01-30 12:44:05 +05:30
|
|
|
|
using Tanshu.Accounts.Repository;
|
2010-03-02 23:26:21 +05:30
|
|
|
|
using Tanshu.Accounts.Print;
|
2014-11-06 16:09:11 +05:30
|
|
|
|
using Tanshu.Accounts.Entities;
|
|
|
|
|
using System.Collections.Generic;
|
2010-03-02 23:26:21 +05:30
|
|
|
|
|
|
|
|
|
namespace Tanshu.Accounts.PointOfSale
|
|
|
|
|
{
|
2011-03-12 00:19:48 +05:30
|
|
|
|
public partial class CashierCheckoutForm : Form
|
2010-03-02 23:26:21 +05:30
|
|
|
|
{
|
2011-03-12 00:19:48 +05:30
|
|
|
|
CheckoutBI _coProxy;
|
|
|
|
|
bool _loading;
|
|
|
|
|
public CashierCheckoutForm()
|
2010-03-02 23:26:21 +05:30
|
|
|
|
{
|
2011-03-12 00:19:48 +05:30
|
|
|
|
_loading = true;
|
2010-03-02 23:26:21 +05:30
|
|
|
|
InitializeComponent();
|
|
|
|
|
}
|
|
|
|
|
|
2014-11-06 16:09:11 +05:30
|
|
|
|
private void CashierCheckoutForm_Load(object sender, EventArgs e)
|
2010-03-02 23:26:21 +05:30
|
|
|
|
{
|
|
|
|
|
dtpStart.Format = DateTimePickerFormat.Custom;
|
2011-02-09 17:33:22 +05:30
|
|
|
|
dtpStart.CustomFormat = "dd-MMM-yyyy";
|
2011-03-12 00:19:48 +05:30
|
|
|
|
dtpStart.Value = DateTime.Now.Date;
|
2010-03-02 23:26:21 +05:30
|
|
|
|
dtpFinish.Format = DateTimePickerFormat.Custom;
|
2011-02-09 17:33:22 +05:30
|
|
|
|
dtpFinish.CustomFormat = "dd-MMM-yyyy";
|
2011-03-12 00:19:48 +05:30
|
|
|
|
dtpFinish.Value = DateTime.Now.Date;
|
|
|
|
|
_loading = false;
|
2014-11-06 16:09:11 +05:30
|
|
|
|
FillUsers();
|
2010-03-02 23:26:21 +05:30
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void FillUsers()
|
|
|
|
|
{
|
2011-04-11 18:25:45 +05:30
|
|
|
|
_loading = true;
|
2010-03-02 23:26:21 +05:30
|
|
|
|
cmbCashier.DisplayMember = "Name";
|
|
|
|
|
cmbCashier.ValueMember = "UserID";
|
2011-06-23 18:17:48 +05:30
|
|
|
|
using (var bi = new UserBI())
|
|
|
|
|
cmbCashier.DataSource = bi.ListActive(dtpStart.Value.Date.AddHours(7), dtpFinish.Value.Date.AddDays(1).AddHours(7));
|
2014-11-06 16:09:11 +05:30
|
|
|
|
_loading = false;
|
2010-03-02 23:26:21 +05:30
|
|
|
|
}
|
|
|
|
|
|
2011-04-11 18:25:45 +05:30
|
|
|
|
private void CmbCashierSelectedIndexChanged(object sender, EventArgs e)
|
2010-03-02 23:26:21 +05:30
|
|
|
|
{
|
2014-11-06 16:09:11 +05:30
|
|
|
|
ShowStatement();
|
2010-03-02 23:26:21 +05:30
|
|
|
|
}
|
|
|
|
|
|
2014-11-06 16:09:11 +05:30
|
|
|
|
private void ShowStatement()
|
2010-03-02 23:26:21 +05:30
|
|
|
|
{
|
2011-03-12 00:19:48 +05:30
|
|
|
|
if (_loading || cmbCashier.SelectedValue == null)
|
2010-03-02 23:26:21 +05:30
|
|
|
|
return;
|
2014-10-12 15:11:45 +05:30
|
|
|
|
_coProxy = new CheckoutBI((Guid)cmbCashier.SelectedValue, dtpStart.Value, dtpFinish.Value);
|
2014-11-06 16:09:11 +05:30
|
|
|
|
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;
|
2010-03-02 23:26:21 +05:30
|
|
|
|
}
|
|
|
|
|
|
2011-04-11 18:25:45 +05:30
|
|
|
|
private void DtpStartValueChanged(object sender, EventArgs e)
|
2010-03-02 23:26:21 +05:30
|
|
|
|
{
|
2011-04-11 18:25:45 +05:30
|
|
|
|
FillUsers();
|
2010-03-02 23:26:21 +05:30
|
|
|
|
}
|
|
|
|
|
|
2011-04-11 18:25:45 +05:30
|
|
|
|
private void DtpFinishValueChanged(object sender, EventArgs e)
|
2010-03-02 23:26:21 +05:30
|
|
|
|
{
|
2011-04-11 18:25:45 +05:30
|
|
|
|
FillUsers();
|
2010-03-02 23:26:21 +05:30
|
|
|
|
}
|
|
|
|
|
|
2011-04-11 18:25:45 +05:30
|
|
|
|
private void BtnPrintClick(object sender, EventArgs e)
|
2010-03-02 23:26:21 +05:30
|
|
|
|
{
|
2011-03-12 00:19:48 +05:30
|
|
|
|
Thermal.PrintClosing(_coProxy);
|
2010-03-02 23:26:21 +05:30
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|