using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Billing
{
public partial class frm_PrintBill : Form
{
public double balance=0,billamount=0,cashtendered=0;
public frm_PrintBill()
{
InitializeComponent();
}
private void btn_Cancel_Click(object sender, EventArgs e)
{
this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.Close();
}
private void txt_CashTendered_KeyUp(object sender, KeyEventArgs e)
{
if(e.KeyCode==Keys.Enter)
{
if (txt_CashTendered.TextLength > 0)
{
billamount = Convert.ToDouble(txt_Amount.Text);
cashtendered = Convert.ToDouble(txt_CashTendered.Text);
balance = cashtendered - billamount;
txt_CashTendered.Text = string.Format("{0:0.00}", cashtendered);
txt_Balance.Text = string.Format("{0:0.00}", balance);
this.SelectNextControl(txt_CashTendered, true, true, true, true);
}
else
{
return;
}
}
}
private void btn_Print_Click(object sender, EventArgs e)
{
if (txt_CashTendered.TextLength <= 0)
{
return;
}
else
{
this.DialogResult = System.Windows.Forms.DialogResult.OK;
}
}
}
}
No comments:
Post a Comment