示例#1
0
 private void TxtQty_KeyPress(object sender, KeyPressEventArgs e)
 {
     if (e.KeyChar == (char)13)
     {
         try
         {
             if (Validation.validateTextFields(txtQty.Text) || e.KeyChar != (char)13)
             {
                 finalTot += (double.Parse(txtUnitPrice.Text) * (int.Parse(txtQty.Text)));
                 orderDetails.Add(new OrderDetailsDTO(txtOrderID.Text, codeOfItem, int.Parse(txtQty.Text)));
                 String[] row = new String[] { txtItemCode.Text, (cmbItemDescription.SelectedItem).ToString(), txtUnitPrice.Text, txtQty.Text, (double.Parse(txtUnitPrice.Text) * (int.Parse(txtQty.Text))).ToString() };
                 tblCheckOut.Rows.Add(row);
                 txtTotalAmount.Text = finalTot.ToString();
                 ItemController.updateStockQty(new ItemDTO(codeOfItem, "", (int.Parse(txtQtyOnHand.Text) - int.Parse(txtQty.Text)), 0.0));
                 txtQtyOnHand.Text = (int.Parse(txtQtyOnHand.Text) - int.Parse(txtQty.Text)).ToString();
             }
             else
             {
                 MessageBox.Show("Please enter the quantity");
             }
         }
         catch (Exception)
         {
             MessageBox.Show("Please enter only numbers to the qty");
         }
     }
 }
示例#2
0
 private void BtnAdd_Click(object sender, EventArgs e)
 {
     finalTot += (double.Parse(txtUnitPrice.Text) * (int.Parse(txtQty.Text)));
     orderDetails.Add(new OrderDetailsDTO(txtOrderID.Text, codeOfItem, int.Parse(txtQty.Text)));
     String[] row = new String[] { (cmbItemDescription.SelectedItem).ToString(), txtItemCode.Text, txtUnitPrice.Text, txtQty.Text, (double.Parse(txtUnitPrice.Text) * (int.Parse(txtQty.Text))).ToString() };
     tblCheckOut.Rows.Add(row);
     txtTotalAmount.Text = finalTot.ToString();
     ItemController.updateStockQty(new ItemDTO(codeOfItem, "", (int.Parse(txtQtyOnHand.Text) - int.Parse(txtQty.Text)), 0.0));
     txtQtyOnHand.Text = (int.Parse(txtQtyOnHand.Text) - int.Parse(txtQty.Text)).ToString();
 }
示例#3
0
 private void BtnRemoveItems_Click(object sender, EventArgs e)
 {
     if (tblCheckOut.SelectedCells.Count > 0)
     {
         int             row         = tblCheckOut.CurrentCell.RowIndex;
         String          curValue    = tblCheckOut.CurrentCell.Value.ToString();
         DataGridViewRow selectedRow = tblCheckOut.Rows[row];
         string          code        = selectedRow.Cells[0].Value.ToString();
         txtTotalAmount.Text = (double.Parse(txtTotalAmount.Text) - double.Parse(selectedRow.Cells[4].Value.ToString())).ToString();
         ItemDTO current = ItemController.searchItem(code);
         ItemController.updateStockQty(new ItemDTO(code, "", int.Parse(selectedRow.Cells[3].Value.ToString()) + current.getQuantity(), 0.0));
         int qty = int.Parse(selectedRow.Cells[3].Value.ToString());
         txtQtyOnHand.Text = (current.getQuantity() + qty).ToString();
         tblCheckOut.Rows.RemoveAt(row);
     }
     else
     {
         MessageBox.Show("Please select a column");
     }
 }