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 double CalTotalMoney() { double dValue = 0; foreach (DataRow row in dtGrid.Rows) { dValue += L3ConvertType.Number(row["Amount"], "n0"); } seTotalMoney.EditValue = dValue; return(dValue); }
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 btnOK_Click(object sender, RoutedEventArgs e) { decimal exchange = seAmountPayment.Value - TotalMoney; btnOK.Focus(); if (!btnOK.IsFocused) { return; } if (!AllowSave()) { return; } MessageBox.Show("Tiền thối lại: " + L3ConvertType.Number(exchange.ToString())); TotalMoney = seAmountPayment.Value; bClicked = true; Close(); }