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.
79 lines
2.5 KiB
79 lines
2.5 KiB
using BiskLog_Point_Of_Sale.Cashier_Module.Invoice;
|
|
using BiskLog_Point_Of_Sale.Invoice;
|
|
using BiskLog_Point_Of_Sale.Multiple_Login;
|
|
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 Point_Of_Sale_Managment.Cashier_Module.Invoice
|
|
{
|
|
public partial class CashierquantityInvoice : Form
|
|
{
|
|
CashierAddInvoice addInvoice;
|
|
string codeOfProduct = "";
|
|
public CashierquantityInvoice(CashierAddInvoice invoice,string productCode = null)
|
|
{
|
|
InitializeComponent();
|
|
addInvoice = invoice;
|
|
codeOfProduct = productCode;
|
|
}
|
|
|
|
private void txtqty_TextChanged(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private async void quantityManual_KeyDown(object sender, KeyEventArgs e)
|
|
{
|
|
|
|
if (e.KeyCode == Keys.Enter)
|
|
{
|
|
int quantity = int.Parse(txtqty.Text);
|
|
Task<int> task = new Task<int>(() =>
|
|
{
|
|
int result = addInvoice.AddToList(quantity, codeOfProduct);
|
|
return result;
|
|
});
|
|
task.Start();
|
|
int finalResult = await task;
|
|
if (finalResult == 1)
|
|
{
|
|
this.Close();
|
|
}
|
|
else if(finalResult == 2)
|
|
{
|
|
string title = "Product is out of stock";
|
|
string message = "Sorry you do not have enough quantity of the item available";
|
|
NoAction noAction = new NoAction(title,message);
|
|
noAction.BringToFront();
|
|
noAction.ShowDialog();
|
|
}
|
|
else
|
|
{
|
|
string title = "Sorry an error has occured";
|
|
string message = "Sorry, there was an error while adding the item to the invoice";
|
|
NoAction noAction = new NoAction(title, message);
|
|
noAction.BringToFront();
|
|
noAction.ShowDialog();
|
|
this.Close();
|
|
}
|
|
}
|
|
}
|
|
private void Txtqty_KeyPress(object sender, KeyPressEventArgs e)
|
|
{
|
|
if (e.KeyChar == 8)
|
|
{
|
|
}
|
|
else if ((e.KeyChar < 48) || (e.KeyChar > 57))
|
|
{
|
|
e.Handled = true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|