private void tsbEdit_ItemClick(object sender, DevExpress.Xpf.Bars.ItemClickEventArgs e) { D07F2011 frm = new D07F2011(); int i = GridStore.View.FocusedRowData.RowHandle.Value; frm.VoucherID = L3ConvertType.L3String(GridStore.GetFocusedRowCellValue(COL_VoucherID)); frm.FormState = Lemon3.EnumFormState.FormEdit; frm.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen; frm.ShowDialog(); LoadTDBGrid(); GridStore.FocusRowHandle(i); }
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 tsbView_ItemClick(object sender, DevExpress.Xpf.Bars.ItemClickEventArgs e) { D07F2011 frm = new D07F2011(); int i = GridStore.View.FocusedRowData.RowHandle.Value; frm.VoucherID = L3ConvertType.L3String(GridStore.GetFocusedRowCellValue(COL_VoucherID)); frm.FormState = Lemon3.EnumFormState.FormView; frm.GridVoucherInventory.View.IsEnabled = false; frm.lkeSupplier.IsReadOnly = true; frm.deVoucherDate.IsReadOnly = true; frm.chePaid.IsReadOnly = true; frm.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen; frm.ShowDialog(); LoadTDBGrid(); GridStore.FocusRowHandle(i); }