private void btnDeleteQuatity_Click(object sender, RoutedEventArgs e) { if (dtGrid.Rows.Count > 0) { string InventoryID = GridVoucherInventory.GetFocusedRowCellValue(COL_InventoryID).ToString(); int n = BLVoucher.GetCurrentRowIndex(GridVoucherInventory, "InventoryID"); int value_Old = L3ConvertType.L3Int(GridVoucherInventory.GetCellValue(n, COL_Quantity)); int stock_Old = L3ConvertType.L3Int(GridVoucherInventory.GetCellValue(n, COL_InStock)); if (value_Old > 1) { GridVoucherInventory.SetCellValue(n, "Quantity", value_Old - 1); GridVoucherInventory.SetCellValue(n, "InStock", stock_Old + 1); CalAmountGrid(n); } else if (value_Old == 1) { GridVoucherInventory.DeleteRowFocusEvent(); } CalAmount(); btnSave.IsEnabled = true; } if (GridVoucherInventory.VisibleRowCount == 0) { btnAddQuatity.IsEnabled = false; btnDeleteQuatity.IsEnabled = false; btnAdd10Quatity.IsEnabled = false; } }
private void gridview_CellValueChanged(object sender, DevExpress.Xpf.Grid.CellValueChangedEventArgs e) { btnSave.IsEnabled = true; switch (e.Column.FieldName) { case "InventoryID": GridVoucherInventory.SetFocusedRowCellValue(COL_InventoryName, lkeInventoryID.ReturnValue("InventoryName")); GridVoucherInventory.SetFocusedRowCellValue(COL_UnitID, lkeInventoryID.ReturnValue("UnitID")); GridVoucherInventory.SetFocusedRowCellValue(COL_VAT, lkeInventoryID.ReturnValue("VAT")); GridVoucherInventory.SetFocusedRowCellValue(COL_Price, lkeInventoryID.ReturnValue("Price")); break; case "VAT": CallAmount(); break; case "Discount": CallAmount(); break; case "Quantity": CallAmount(); break; case "Price": CallAmount(); break; default: CalTotalMoney(); break; } CalTotalMoney(); }
private void LoadNumberFormat() { GridVoucherInventory.InputNumber288("n0", false, false, COL_Price); GridVoucherInventory.InputNumber288("n0", false, false, COL_Amount); GridVoucherInventory.InputNumber288("n0", false, false, COL_Discount); GridVoucherInventory.InputNumber288("n0", false, false, COL_Quantity); GridVoucherInventory.InputPercent(false, false, 28, 8, COL_Discount, COL_VAT); seTotalMoney.InputNumber288("n0", false, false); }
private void CallAmount() { object oPrice = GridVoucherInventory.GetFocusedRowCellValue(COL_Price); object oVAT = GridVoucherInventory.GetFocusedRowCellValue(COL_VAT); object oDiscount = GridVoucherInventory.GetFocusedRowCellValue(COL_Discount); object oQuantity = GridVoucherInventory.GetFocusedRowCellValue(COL_Quantity); object oAmount = L3ConvertType.Number(oQuantity) * L3ConvertType.Number(oPrice) * (1 - L3ConvertType.Number(oDiscount) + L3ConvertType.Number(oVAT)); GridVoucherInventory.SetFocusedRowCellValue(COL_Amount, oAmount); }
private void SetInputNumber() { GridVoucherInventory.InputNumber288("n1", false, false, COL_Quantity); GridVoucherInventory.InputNumber288("n0", false, false, COL_Amount); GridVoucherInventory.InputNumber288("n0", false, false, COL_Price); GridVoucherInventory.InputPercent(false, false, 28, 8, COL_VAT); GridVoucherInventory.InputNumber288("n0", false, false, COL_InStock); seTotalMoney.InputNumber288("n0", false, false); sePeople.InputNumber288("n0", false, false); }
private void CalAmountGrid(int irow) { try { GridVoucherInventory.SetCellValue(irow, "Amount", L3ConvertType.Number(GridVoucherInventory.GetCellValue(irow, "Quantity")) * L3ConvertType.Number(GridVoucherInventory.GetCellValue(irow, "Price")) * (1 - L3ConvertType.Number(GridVoucherInventory.GetCellValue(irow, "VAT")))); } catch (Exception) { MessageBox.Show("Vui lòng trỏ đúng!"); } }
private void lbeSuggestion_EditValueChanged(object sender, DevExpress.Xpf.Editors.EditValueChangedEventArgs e) { string sInventoryID = lbeSuggestion.EditValue.ToString(); DataTable dt = BLTable.SelectInventoryID(sInventoryID); string sInventoryName = ""; if (dt.Rows.Count > 0 && Convert.ToDecimal(dt.Rows[0]["InStock"]) > 0) { btnPay.IsEnabled = true; sInventoryName = L3ConvertType.L3String(dt.Rows[0]["InventoryName"]); int irow = GridVoucherInventory.FindRowByValue("InventoryID", sInventoryID); if (irow >= 0) { int value_Old = L3ConvertType.L3Int(GridVoucherInventory.GetCellValue(irow, COL_Quantity)); int stock_Old = L3ConvertType.L3Int(GridVoucherInventory.GetCellValue(irow, COL_InStock)); if (stock_Old > 0) { GridVoucherInventory.SetCellValue(irow, "Quantity", value_Old + 1); GridVoucherInventory.SetCellValue(irow, "InStock", stock_Old - 1); } CalAmountGrid(irow); } else { DataRow dr = dtGrid.NewRow(); dr["InventoryID"] = sInventoryID; dr["InventoryName"] = dt.Rows[0]["InventoryName"]; dr["UnitID"] = dt.Rows[0]["UnitID"]; dr["InStock"] = Convert.ToDecimal(dt.Rows[0]["InStock"]) - 1; dr["Quantity"] = 1; dr["Price"] = dt.Rows[0]["Price"]; dr["VAT"] = dt.Rows[0]["VAT"]; dr["Amount"] = L3ConvertType.Number(dr["Quantity"]) * L3ConvertType.Number(dr["Price"]) * (1 - L3ConvertType.Number(dr["VAT"])); dtGrid.Rows.Add(dr); } btnSave.IsEnabled = true; btnDeleteQuatity.IsEnabled = true; btnAddQuatity.IsEnabled = true; btnAdd10Quatity.IsEnabled = true; } else { MessageBox.Show("Đã hết hàng!"); } CalAmount(); txtItem.Text = ""; lbeSuggestion.Visibility = Visibility.Collapsed; lbeSuggestion.EditValue = null; }
private void btnAdd10Quatity_Click(object sender, RoutedEventArgs e) { int n = BLVoucher.GetCurrentRowIndex(GridVoucherInventory, "InventoryID"); try { int value_Old = L3ConvertType.L3Int(GridVoucherInventory.GetCellValue(n, COL_Quantity)); int stock_Old = L3ConvertType.L3Int(GridVoucherInventory.GetCellValue(n, COL_InStock)); if (stock_Old >= 10) { GridVoucherInventory.SetCellValue(n, "Quantity", value_Old + 10); GridVoucherInventory.SetCellValue(n, "InStock", stock_Old - 10); } CalAmountGrid(n); } catch (Exception) { MessageBox.Show("Lỗi!"); } CalAmount(); btnSave.IsEnabled = true; }
private void L3Window_Loaded(object sender, RoutedEventArgs e) { LoadNumberFormat(); GridVoucherInventory.SetDefaultGridControlInput(); }