narsil/Tanshu.Accounts.PointOfSale/Sales/SettleAmountsForm.cs
unknown 831ec37cda Reprint and Printed bill editing logged.
Printed bill can no longer be changed, any changes voids the bill and prints a new one.
Added option to Split Bill.
Kot printed with right time.
Numerous bug fixes.
2011-08-23 12:40:05 +05:30

76 lines
2.4 KiB
C#

using System;
using System.Drawing;
using System.Windows.Forms;
using Tanshu.Accounts.Entities;
using Tanshu.Accounts.Contracts;
using Tanshu.Common.KeyboardControl;
namespace Tanshu.Accounts.PointOfSale
{
public partial class SettleAmountsForm : Form
{
private IKeyboardControl _keyboardControl;
private readonly decimal _amount;
private readonly SettleOption _settleOption;
private decimal _settleAmount;
public SettleAmountsForm(IKeyboardControl keyboardControl, SettleOption settleOption, decimal amount)
{
InitializeComponent();
_keyboardControl = keyboardControl;
_amount = amount;
_settleOption = settleOption;
_settleAmount = 0;
var control = keyboardControl as UserControl;
if (control != null)
{
control.Location = new System.Drawing.Point(3, 49);
this.Controls.Add(control);
this.Size = this.SizeFromClientSize(new Size(3 + control.Width + 3, 49 + control.Height + 3));
}
}
public decimal AmountSettled
{
get
{
return _settleAmount;
}
}
private void SettleChoicesFormLoad(object sender, EventArgs e)
{
var attribute = (DisplayAttribute)_settleOption.GetType().GetField(_settleOption.ToString()).GetCustomAttributes(typeof(DisplayAttribute), false)[0];
this.Text = attribute.Name;
txtAmount.Text = string.Format("Pending Amount: Rs. {0}", _amount);
txtCurrentAmount.Text = string.Format("{0:#,#00}", _amount);
txtCurrentAmount.Focus();
}
private void TxtCurrentAmountKeyDown(object sender, KeyEventArgs e)
{
switch (e.KeyCode)
{
case Keys.Escape:
_settleAmount = 0;
this.Close();
break;
case Keys.Return:
{
decimal settleAmount;
if (!Decimal.TryParse(txtCurrentAmount.Text, out settleAmount))
return;
if (settleAmount > _amount)
settleAmount = _amount;
_settleAmount = settleAmount;
this.Close();
}
break;
}
}
}
}