You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
			
				
					86 lines
				
				2.1 KiB
			
		
		
			
		
	
	
					86 lines
				
				2.1 KiB
			| 
											10 months ago
										 | using BiskLog_Point_Of_Sale.Classes; | ||
|  | using System; | ||
|  | using System.Drawing; | ||
|  | using System.Windows.Forms; | ||
|  | 
 | ||
|  | namespace Point_Of_Sale_Managment.CashierModule | ||
|  | { | ||
|  |     public partial class Discount : Form | ||
|  |     { | ||
|  |         int discount; | ||
|  |         NewSalesPOS formSale; | ||
|  | 
 | ||
|  | 
 | ||
|  |         public Discount(NewSalesPOS formsales) | ||
|  |         { | ||
|  |             InitializeComponent(); | ||
|  |             formSale = formsales; | ||
|  |         } | ||
|  | 
 | ||
|  |         private void Discount_Load(object sender, EventArgs e) | ||
|  |         { | ||
|  |             discount = 0; | ||
|  |             textBox1.Focus(); | ||
|  |         } | ||
|  | 
 | ||
|  |         private void Discount_KeyDown(object sender, KeyEventArgs e) | ||
|  |         { | ||
|  |             if (e.KeyCode == Keys.Enter) | ||
|  |             { | ||
|  |                 try | ||
|  |                 { | ||
|  |                     discount = int.Parse(textBox1.Text); | ||
|  |                     formSale.LoadDiscount(discount); | ||
|  |                     Close(); | ||
|  |                 } | ||
|  |                 catch (Exception ex) | ||
|  |                 { | ||
|  |                     ErrorLogging.WriteToFile(ex.ToString()); | ||
|  |                     discount = 0; | ||
|  |                     Close(); | ||
|  |                 } | ||
|  |             } | ||
|  |             else if (e.KeyCode == Keys.Escape) | ||
|  |             { | ||
|  |                 Close(); | ||
|  |             } | ||
|  |         } | ||
|  | 
 | ||
|  |         private void TextBox1_TextChanged(object sender, EventArgs e) | ||
|  |         { | ||
|  | 
 | ||
|  |         } | ||
|  | 
 | ||
|  |         private void TextBox1_KeyPress(object sender, KeyPressEventArgs e) | ||
|  |         { | ||
|  |             if (e.KeyChar == 46) | ||
|  |             { | ||
|  |                 // accepts . character
 | ||
|  |             } | ||
|  |             else if (e.KeyChar == 8) | ||
|  |             { | ||
|  |                 //accepts backspace
 | ||
|  |             } | ||
|  |             else if ((e.KeyChar < 48) || (e.KeyChar > 57)) //ascii code 48-57 between 0-9
 | ||
|  |             { | ||
|  |                 e.Handled = true; | ||
|  |             } | ||
|  |         } | ||
|  | 
 | ||
|  |         private void ExitBTN_Click(object sender, EventArgs e) | ||
|  |         { | ||
|  |             this.Close(); | ||
|  |         } | ||
|  | 
 | ||
|  |         private void ExitBTN_MouseEnter(object sender, EventArgs e) | ||
|  |         { | ||
|  |             exitBTN.BackColor = Color.Crimson; | ||
|  |         } | ||
|  | 
 | ||
|  |         private void ExitBTN_MouseLeave(object sender, EventArgs e) | ||
|  |         { | ||
|  |             exitBTN.BackColor = Color.Transparent; | ||
|  |         } | ||
|  |     } | ||
|  | } |