using System; using System.Windows.Forms; using Tanshu.Accounts.Repository; 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); 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(); } private void cmbCashier_SelectedIndexChanged(object sender, EventArgs e) { EmployeeStatus(); //log.Warn(string.Format("User Checkout: {0} by {1}", coProxy.Cashier, Session.User.Name)); } 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); txtOpening.Text = string.Format("{0:#,##0.00}", coProxy); 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); txtAdvanceAdjusted.Text = string.Format("{0:#,##0.00}", coProxy.AdvanceAdjusted); 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); txtPending.Text = string.Format("{0:#,##0.00}", coProxy.PendingBills); txtSales.Text = string.Format("{0:#,##0.00}", coProxy.NetSales); txtClosingCash.Text = string.Format("{0:#,##0.00}", coProxy.ClosingBalance ); 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); } private void txtSales_TextChanged(object sender, EventArgs e) { } } }