private void txtCash_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == (char)Keys.Enter) { txtCost.Text = CostCodeController.CostToCode(decimal.Parse(txtCash.Text + "0") / 16); } }
private void load_batches() { try { int id = int.Parse(DGV.SelectedRows[0].Cells[0].Value.ToString()); var p = controller.GetProduct(id); List <POKO_ProductBatch> batchList = new List <POKO_ProductBatch>(); foreach (var batch in p.Batches) { POKO_ProductBatch pokobatch = new POKO_ProductBatch(); pokobatch.Id = batch.Id; pokobatch.Cash = batch.Cash; pokobatch.Credit = batch.Credit; pokobatch.Markup = batch.Markup; pokobatch.Cost = batch.Cost; pokobatch.Stock = batch.Stock; pokobatch.CostCode = CostCodeController.CostToCode(batch.Cost); pokobatch.Pid = batch.Product.Id; pokobatch.PName = batch.Product.Name; batchList.Add(pokobatch); } DGV2.DataSource = batchList; } catch (Exception e) { } }
private void EditBatch_Load(object sender, EventArgs e) { ThemeHelper.ChangeFormBackgroundColor(this); batch = controller.GetBatchById(batchid); txtCost.Text = CostCodeController.CostToCode(batch.Cost); txtCash.Text = batch.Cash.ToString(); txtCredit.Text = batch.Credit.ToString(); txtMarkup.Text = batch.Markup.ToString(); txtStock.Text = batch.Stock.ToString(); }
private void txtQty_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == (char)Keys.Enter) { try { if (txtQty.Text != "" && txtQty.Text != @"0" && decimal.Parse(txtQty.Text) <= saleDetail.ProductBatch.Stock) { saleDetail.Qty = decimal.Parse(txtQty.Text); saleDetail.Total = saleDetail.ProductBatch.Cash * saleDetail.Qty; DGV.Rows.Add(saleDetail.Product.Id, saleDetail.Product.Name, saleDetail.Product.BarcodeData, saleDetail.ProductBatch.Stock, CostCodeController.CostToCode(saleDetail.ProductBatch.Cost), saleDetail.ProductBatch.Cash, saleDetail.Qty, saleDetail.Total); SaleDetails.Add(saleDetail); } txtBarcodeData.Text = ""; txtBarcodeData.ReadOnly = false; txtBarcodeData.Focus(); txtQty.Clear(); } catch (Exception exception) { } } }