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.
68 lines
1.9 KiB
68 lines
1.9 KiB
3 months ago
|
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
|
||
|
{
|
||
|
public partial class quantityTruck : Form
|
||
|
{
|
||
|
AddProductTruck formSale;
|
||
|
int number = 0;
|
||
|
public quantityTruck(AddProductTruck formsales,int qut)
|
||
|
{
|
||
|
InitializeComponent();
|
||
|
formSale = formsales;
|
||
|
number = qut;
|
||
|
}
|
||
|
|
||
|
private void txtqty_TextChanged(object sender, EventArgs e)
|
||
|
{
|
||
|
|
||
|
}
|
||
|
|
||
|
private void quantityManual_KeyDown(object sender, KeyEventArgs e)
|
||
|
{
|
||
|
|
||
|
if (e.KeyCode == Keys.Enter)
|
||
|
{
|
||
|
int quantity = int.Parse(txtqty.Text);
|
||
|
int possibility = number - quantity;
|
||
|
decimal cost = decimal.Parse(AddProductTruck.price);
|
||
|
decimal totalCost = quantity * cost;
|
||
|
if (possibility >= 0)
|
||
|
{
|
||
|
formSale.AddtoCart(quantity,totalCost);
|
||
|
this.Close();
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
string title = "Out of stock";
|
||
|
string message = "Sorry you do not have enough quantity of the item available to add to truck's inventory";
|
||
|
NoAction noAction = new NoAction(title,message);
|
||
|
noAction.BringToFront();
|
||
|
noAction.ShowDialog();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private void Txtqty_KeyPress(object sender, KeyPressEventArgs e)
|
||
|
{
|
||
|
if (e.KeyChar == 8)
|
||
|
{
|
||
|
//accepts backspace
|
||
|
}
|
||
|
else if ((e.KeyChar < 48) || (e.KeyChar > 57)) //ascii code 48-57 between 0-9
|
||
|
{
|
||
|
e.Handled = true;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|