private void button57_Click(object sender, EventArgs e) { if (checkItemSended()) { if (!Employee.CheckGrant(StaticClass.storeId, StaticClass.cashierId, Employee.CFA_INVOICE_PRICE_CHANGE)) { return; } } FrmKeyboardNumber kb = new FrmKeyboardNumber("Nhập số lượng :"); if (kb.ShowDialog() == DialogResult.OK) { if (Convert.ToDecimal(kb.value) == 0) { Alert.Show("Không thể nhập số lượng \nbằng 0", Color.Red); } else { foreach (MyItem item in myCash1.get_RowSelected()) { myCash1.listInvoiceItem.Rows[item.Id - 1][3] = kb.value; } UpdateItemSelect(); } } }
private void button12_Click(object sender, EventArgs e) { FrmKeyboardNumber frmKeyboardNumber = new FrmKeyboardNumber("Phần trăm "); string percent = ""; DateTime saleStart = DateTime.Now; DateTime saleEnd = DateTime.Now; if (frmKeyboardNumber.ShowDialog() == DialogResult.OK) { percent = frmKeyboardNumber.value; FrmCanlendar frmCanlendar = new FrmCanlendar("Ngày bắt đầu "); if (frmCanlendar.ShowDialog() == DialogResult.OK) { saleStart = frmCanlendar.monthCalendar1.SelectionStart; frmCanlendar = new FrmCanlendar("Ngày kết thúc "); if (frmCanlendar.ShowDialog() == DialogResult.OK) { saleEnd = frmCanlendar.monthCalendar1.SelectionStart; OnSalesInfo onSalesInfo = new OnSalesInfo(saleStart, saleEnd, Convert.ToSingle(percent)); onSalesInfo.isNew = true; specialPricing.OnSaleInfoList.Add(onSalesInfo); creListBox2.Items.Add(onSalesInfo); } } } }
private void button67_Click(object sender, EventArgs e) { ArrayList arrayList = myCash1.get_RowSelected(); if (arrayList.Count > 1) { Alert.Show("Chỉ chọn một món để trả lại.", Color.Red); } else { FrmKeyboardNumber frmKeyboardNumber = new FrmKeyboardNumber("Nhập số lượng trả lại"); if (frmKeyboardNumber.ShowDialog() == System.Windows.Forms.DialogResult.OK) { decimal oldQuan = Convert.ToDecimal(myCash1.listInvoiceItem.Rows[((MyItem)arrayList[0]).Id - 1]["Quantity"]); string itemNum = myCash1.listInvoiceItem.Rows[((MyItem)arrayList[0]).Id - 1]["ItemNum"].ToString(); decimal returnQuan = Convert.ToDecimal(frmKeyboardNumber.value); if (oldQuan >= returnQuan) { object[] newrow = myCash1.listInvoiceItem.Rows[((MyItem)arrayList[0]).Id - 1].ItemArray; newrow[3] = 0 - returnQuan; newrow[1] = myCash1.listInvoiceItem.Rows.Count + 1; decimal price = (0 - returnQuan) * Convert.ToDecimal(newrow[5]); string itemName = myCash1.listInvoiceItem.Rows[((MyItem)arrayList[0]).Id - 1]["DiffItemName"].ToString(); myCash1.listInvoiceItem.Rows.Add(newrow); myCash1.addRow(itemName, String.Format("{0:0.##}", 0 - returnQuan), String.Format("{0:0,0}", price)); UpdateInfo(); } else { Alert.Show("Số lượng trả vượt quá số\n lượng bán.", Color.Red); } } } }
private void button3_Click(object sender, EventArgs e) { decimal costPer = 0; string desc = ""; string quan = ""; FrmKeyboardNumber frmKeyboardNumber = new FrmKeyboardNumber("Số lượng"); if (frmKeyboardNumber.ShowDialog() == DialogResult.OK) { quan = frmKeyboardNumber.value; FrmKeyBoard frmKeyBoard = new FrmKeyBoard(); frmKeyBoard.label1.Text = "Ghi chú"; if (frmKeyBoard.ShowDialog() == DialogResult.OK) { desc = frmKeyBoard.value; FrmKeyboardNumber frmKeyboardNumber1 = new FrmKeyboardNumber("Giá", txtGia.Text); if (frmKeyboardNumber1.ShowDialog() == DialogResult.OK) { costPer = Convert.ToDecimal(frmKeyboardNumber1.value); decimal newCostPer = (Convert.ToDecimal(txtKho.Text) * Convert.ToDecimal(txtGia.Text) + Convert.ToDecimal(quan) * costPer) / (Convert.ToDecimal(txtKho.Text) + Convert.ToDecimal(quan)); decimal sumQuan = Convert.ToDecimal(txtKho.Text) + Convert.ToDecimal(quan); get_service.UpdateInStock(StaticClass.storeId, txtInvenId.Text, sumQuan.ToString()); get_service.UpdateCostPer(StaticClass.storeId, txtInvenId.Text, newCostPer.ToString()); get_service.InsertInventory_In(txtInvenId.Text, StaticClass.storeId, quan, costPer.ToString(), DateTime.Now.ToString(), "True", desc, StaticClass.cashierId); txtKho.Text = String.Format("{0:0.##}", sumQuan); txtGia.Text = String.Format("{0:#,#}", newCostPer); inventory = get_service.GetAllInventory(StaticClass.storeId); } } } }
private void button63_Click(object sender, EventArgs e) { if (Employee.CheckGrant(StaticClass.storeId, StaticClass.cashierId, Employee.CFA_INVOICE_DISCOUNT)) { FrmKeyboardNumber frmKeyBoard = new FrmKeyboardNumber("Nhập % khấu trừ : "); if (frmKeyBoard.ShowDialog() == DialogResult.OK) { myCash1.invoiceTotal.Rows[0]["Discount"] = Convert.ToDecimal(frmKeyBoard.value) / 100; UpdateInfo(); } } }
private void button56_Click(object sender, EventArgs e) { if (Employee.CheckGrant(StaticClass.storeId, StaticClass.cashierId, Employee.CFA_INVOICE_DISCOUNT)) { FrmKeyboardNumber kb = new FrmKeyboardNumber("Nhập % khấu trừ"); if (kb.ShowDialog() == DialogResult.OK) { foreach (MyItem item in myCash1.get_RowSelected()) { Decimal disc = Convert.ToDecimal(kb.value) / 100; myCash1.listInvoiceItem.Rows[item.Id - 1][12] = disc; } UpdateItemSelect(); } } }
private void button18_Click(object sender, EventArgs e) { string[] column = { Const.Inventory.ItemNum, Const.Inventory.ItemName, Const.Inventory.Dept_ID, Const.Inventory.Cost, Const.Inventory .Price, Const.Inventory.In_Stock }; FrmSearch search = new FrmSearch(inventory, column); if (search.ShowDialog() == DialogResult.OK) { DataGridViewRow dataGridViewRow = search.selectRow; FrmKeyboardNumber frmKeyboardNumber = new FrmKeyboardNumber("Số lượng"); if (frmKeyboardNumber.ShowDialog() == DialogResult.OK) { Ingredient ingredient = new Ingredient(dataGridViewRow.Cells[0].Value.ToString(), dataGridViewRow.Cells[1].Value.ToString(), Convert.ToSingle(frmKeyboardNumber.value), 0, 0, Convert.ToDecimal(dataGridViewRow.Cells[3].Value)); ingredient.isNew = true; InventIngredients.Add(ingredient); dataGridView1.Rows.Add(new object[] { dataGridViewRow.Cells[1].Value.ToString(), String.Format("{0:0.##}", Convert.ToDecimal(frmKeyboardNumber.value)), String.Format("{0:0,0}", Convert.ToDecimal(frmKeyboardNumber.value) * Convert.ToDecimal(dataGridViewRow.Cells[3].Value)), ingredient }); } } }
private void button16_Click(object sender, EventArgs e) { FrmDayOfWeek frmDayOfWeek = new FrmDayOfWeek(); DateTime cr1 = DateTime.Now; DateTime cr2 = DateTime.Now; decimal price; int[] cr3; Prices prices; if (frmDayOfWeek.ShowDialog() == DialogResult.OK) { cr3 = new int[frmDayOfWeek.creListBox1.SelectedItems.Count]; for (int i = 0; i < frmDayOfWeek.creListBox1.SelectedItems.Count; i++) { cr3[i] = frmDayOfWeek.creListBox1.SelectedIndices[i] + 1; } FrmTime frmTime = new FrmTime("Giờ bắt đầu "); frmTime.myPassPara = startTimeText; if (frmTime.ShowDialog() == DialogResult.OK) { cr1 = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, FrmReporting.ChangeModeTime(frmTime.Hour, frmTime.Mode), frmTime.Minute, frmTime.Second); frmTime = new FrmTime("Thời gian kết thúc "); frmTime.myPassPara = startTimeText; if (frmTime.ShowDialog() == DialogResult.OK) { cr2 = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, FrmReporting.ChangeModeTime(frmTime.Hour, frmTime.Mode), frmTime.Minute, frmTime.Second); FrmKeyboardNumber frmKeyboardNumber = new FrmKeyboardNumber("Giá ", String.Format("{0:0,0}", Convert.ToDecimal(txtGiaMua.Text))); if (frmKeyboardNumber.ShowDialog() == DialogResult.OK) { price = Convert.ToDecimal(frmKeyboardNumber.value); for (int i = 0; i < cr3.Length; i++) { prices = new Prices(price, cr1, cr2, cr3[i].ToString()); prices.isNew = true; specialPricing.PricesList.Add(prices); creListBox4.Items.Add(prices); } } } } } }
private void button66_Click(object sender, EventArgs e) { if (checkItemSended()) { if (!Employee.CheckGrant(StaticClass.storeId, StaticClass.cashierId, Employee.CFA_INVOICE_PRICE_CHANGE)) { return; } } FrmKeyboardNumber kb = new FrmKeyboardNumber("Nhập giá :"); if (kb.ShowDialog() == DialogResult.OK) { foreach (MyItem item in myCash1.get_RowSelected()) { myCash1.listInvoiceItem.Rows[item.Id - 1]["origPricePer"] = kb.value; } UpdateItemSelect(); } }
private void button14_Click(object sender, EventArgs e) { FrmKeyboardNumber frmKeyboardNumber = new FrmKeyboardNumber("Số lượng "); BulkInfo bulkInfo; string quant = ""; string price = ""; if (frmKeyboardNumber.ShowDialog() == DialogResult.OK) { quant = frmKeyboardNumber.value; FrmKeyboardNumber frmKeyboardNumber1 = new FrmKeyboardNumber("Giá "); if (frmKeyboardNumber1.ShowDialog() == DialogResult.OK) { price = frmKeyboardNumber1.value; bulkInfo = new BulkInfo(Convert.ToSingle(quant), Convert.ToDecimal(price), true); specialPricing.BulkInfoList.Add(bulkInfo); creListBox3.Items.Add(bulkInfo); } } }
private void button18_Click(object sender, EventArgs e) { string[] column = { Const.Inventory.ItemNum, Const.Inventory.ItemName,Const.Inventory.Dept_ID,Const.Inventory.Cost,Const.Inventory .Price,Const.Inventory.In_Stock}; FrmSearch search = new FrmSearch(inventory, column); if(search.ShowDialog() == DialogResult.OK) { DataGridViewRow dataGridViewRow = search.selectRow; FrmKeyboardNumber frmKeyboardNumber = new FrmKeyboardNumber("Số lượng"); if(frmKeyboardNumber.ShowDialog() == DialogResult.OK) { Ingredient ingredient = new Ingredient(dataGridViewRow.Cells[0].Value.ToString(), dataGridViewRow.Cells[1].Value.ToString(), Convert.ToSingle(frmKeyboardNumber.value), 0, 0, Convert.ToDecimal(dataGridViewRow.Cells[3].Value)); ingredient.isNew = true; InventIngredients.Add(ingredient); dataGridView1.Rows.Add(new object[] { dataGridViewRow.Cells[1].Value.ToString(), String.Format("{0:0.##}", Convert.ToDecimal(frmKeyboardNumber.value)), String.Format("{0:0,0}", Convert.ToDecimal(frmKeyboardNumber.value) * Convert.ToDecimal(dataGridViewRow.Cells[3].Value)), ingredient }); } } }
private void button3_Click(object sender, EventArgs e) { decimal costPer = 0; string desc = ""; string quan = ""; FrmKeyboardNumber frmKeyboardNumber = new FrmKeyboardNumber("Số lượng"); if(frmKeyboardNumber.ShowDialog() == DialogResult.OK) { quan = frmKeyboardNumber.value; FrmKeyBoard frmKeyBoard = new FrmKeyBoard(); frmKeyBoard.label1.Text = "Ghi chú"; if(frmKeyBoard.ShowDialog() == DialogResult.OK) { desc = frmKeyBoard.value; FrmKeyboardNumber frmKeyboardNumber1 = new FrmKeyboardNumber("Giá",txtGia.Text); if(frmKeyboardNumber1.ShowDialog() == DialogResult.OK) { costPer = Convert.ToDecimal(frmKeyboardNumber1.value); decimal newCostPer = (Convert.ToDecimal(txtKho.Text)*Convert.ToDecimal(txtGia.Text) + Convert.ToDecimal(quan)*costPer)/ (Convert.ToDecimal(txtKho.Text) + Convert.ToDecimal(quan)); decimal sumQuan = Convert.ToDecimal(txtKho.Text) + Convert.ToDecimal(quan); get_service.UpdateInStock(StaticClass.storeId,txtInvenId.Text,sumQuan.ToString()); get_service.UpdateCostPer(StaticClass.storeId,txtInvenId.Text,newCostPer.ToString()); get_service.InsertInventory_In(txtInvenId.Text, StaticClass.storeId, quan, costPer.ToString(), DateTime.Now.ToString(), "True", desc, StaticClass.cashierId); txtKho.Text = String.Format("{0:0.##}", sumQuan); txtGia.Text = String.Format("{0:#,#}", newCostPer); inventory = get_service.GetAllInventory(StaticClass.storeId); } } } }
private void button14_Click(object sender, EventArgs e) { FrmKeyboardNumber frmKeyboardNumber = new FrmKeyboardNumber("Số lượng "); BulkInfo bulkInfo; string quant = ""; string price = ""; if(frmKeyboardNumber.ShowDialog() == DialogResult.OK) { quant = frmKeyboardNumber.value; FrmKeyboardNumber frmKeyboardNumber1 = new FrmKeyboardNumber("Giá "); if(frmKeyboardNumber1.ShowDialog() == DialogResult.OK) { price = frmKeyboardNumber1.value; bulkInfo = new BulkInfo(Convert.ToSingle(quant),Convert.ToDecimal(price),true); specialPricing.BulkInfoList.Add(bulkInfo); creListBox3.Items.Add(bulkInfo); } } }
private void button12_Click(object sender, EventArgs e) { FrmKeyboardNumber frmKeyboardNumber = new FrmKeyboardNumber("Phần trăm "); string percent = ""; DateTime saleStart = DateTime.Now; DateTime saleEnd = DateTime.Now; if(frmKeyboardNumber.ShowDialog() == DialogResult.OK) { percent = frmKeyboardNumber.value; FrmCanlendar frmCanlendar = new FrmCanlendar("Ngày bắt đầu "); if(frmCanlendar.ShowDialog() == DialogResult.OK) { saleStart = frmCanlendar.monthCalendar1.SelectionStart; frmCanlendar = new FrmCanlendar("Ngày kết thúc "); if(frmCanlendar.ShowDialog() == DialogResult.OK) { saleEnd = frmCanlendar.monthCalendar1.SelectionStart; OnSalesInfo onSalesInfo = new OnSalesInfo(saleStart,saleEnd,Convert.ToSingle(percent)); onSalesInfo.isNew = true; specialPricing.OnSaleInfoList.Add(onSalesInfo); creListBox2.Items.Add(onSalesInfo); } } } }
private void button56_Click(object sender, EventArgs e) { if(Employee.CheckGrant(StaticClass.storeId,StaticClass.cashierId,Employee.CFA_INVOICE_DISCOUNT)) { FrmKeyboardNumber kb = new FrmKeyboardNumber("Nhập % khấu trừ"); if (kb.ShowDialog() == DialogResult.OK) { foreach (MyItem item in myCash1.get_RowSelected()) { Decimal disc = Convert.ToDecimal(kb.value)/100; myCash1.listInvoiceItem.Rows[item.Id - 1][12] = disc; Utilities.Utils.WriteLogFile(StaticClass.cashierId + "\t" + "khau tru mat hang " + invoiceNum + " " + myCash1.listInvoiceItem.Rows[item.Id - 1]["ItemNum"].ToString() + " " + myCash1.listInvoiceItem.Rows[item.Id - 1]["Quantity"].ToString() + " " + String.Format("{0:0,0}", myCash1.listInvoiceItem.Rows[item.Id - 1]["PricePer"]) + " " + myCash1.listInvoiceItem.Rows[item.Id - 1]["LineDisc"].ToString()); } UpdateItemSelect(); } } }
private void button57_Click(object sender, EventArgs e) { if(checkItemSended()) { if(!Employee.CheckGrant(StaticClass.storeId,StaticClass.cashierId,Employee.CFA_INVOICE_QUAN_CHANGE)) { return; } } FrmKeyboardNumber kb = new FrmKeyboardNumber("Nhập số lượng :"); if(kb.ShowDialog() == DialogResult.OK) { if(Convert.ToDecimal(kb.value) == 0) { Alert.Show("Không thể nhập số lượng \nbằng 0",Color.Red); } else { foreach (MyItem item in myCash1.get_RowSelected()) { if(item.Mota.StartsWith(">")) { Utilities.Utils.WriteLogFile(StaticClass.cashierId + "\t" + "Doi so luong " + invoiceNum + " " + myCash1.listInvoiceItem.Rows[item.Id - 1]["ItemNum"].ToString() + " " + myCash1.listInvoiceItem.Rows[item.Id - 1]["Quantity"].ToString() + " " + kb.value+ " " + String.Format("{0:0,0}", myCash1.listInvoiceItem.Rows[item.Id - 1]["PricePer"])); } string itemNum = myCash1.listInvoiceItem.Rows[item.Id - 1]["ItemNum"].ToString(); float Quan = Convert.ToSingle(myCash1.listInvoiceItem.Rows[item.Id - 1]["Quantity"]); if (CheckInStock(StaticClass.storeId, itemNum, 0, Convert.ToSingle(kb.value))) { myCash1.listInvoiceItem.Rows[item.Id - 1][3] = kb.value; } } UpdateItemSelect(); } } }
private void button56_Click(object sender, EventArgs e) { if(Employee.CheckGrant(StaticClass.storeId,StaticClass.cashierId,Employee.CFA_INVOICE_DISCOUNT)) { FrmKeyboardNumber kb = new FrmKeyboardNumber("Nhập % khấu trừ"); if (kb.ShowDialog() == DialogResult.OK) { foreach (MyItem item in myCash1.get_RowSelected()) { Decimal disc = Convert.ToDecimal(kb.value)/100; myCash1.listInvoiceItem.Rows[item.Id - 1][12] = disc; } UpdateItemSelect(); } } }
private void button16_Click(object sender, EventArgs e) { FrmDayOfWeek frmDayOfWeek = new FrmDayOfWeek(); DateTime cr1 = DateTime.Now; DateTime cr2 = DateTime.Now; decimal price; int[] cr3; Prices prices ; if(frmDayOfWeek.ShowDialog() == DialogResult.OK) { cr3 = new int[frmDayOfWeek.creListBox1.SelectedItems.Count]; for (int i = 0; i < frmDayOfWeek.creListBox1.SelectedItems.Count; i++) { cr3[i] = frmDayOfWeek.creListBox1.SelectedIndices[i] + 1; } FrmTime frmTime = new FrmTime("Giờ bắt đầu "); frmTime.myPassPara = startTimeText; if(frmTime.ShowDialog() == DialogResult.OK) { cr1 = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, FrmReporting.ChangeModeTime(frmTime.Hour,frmTime.Mode), frmTime.Minute, frmTime.Second); frmTime = new FrmTime("Thời gian kết thúc "); frmTime.myPassPara = startTimeText; if(frmTime.ShowDialog() == DialogResult.OK) { cr2 = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, FrmReporting.ChangeModeTime(frmTime.Hour, frmTime.Mode), frmTime.Minute, frmTime.Second); FrmKeyboardNumber frmKeyboardNumber = new FrmKeyboardNumber("Giá ", String.Format("{0:0,0}",Convert.ToDecimal(txtGiaMua.Text))); if(frmKeyboardNumber.ShowDialog() == DialogResult.OK) { price = Convert.ToDecimal(frmKeyboardNumber.value); for (int i = 0; i < cr3.Length; i++) { prices = new Prices(price, cr1, cr2, cr3[i].ToString()); prices.isNew = true; specialPricing.PricesList.Add(prices); creListBox4.Items.Add(prices); } } } } } }
private void button57_Click(object sender, EventArgs e) { if(checkItemSended()) { if(!Employee.CheckGrant(StaticClass.storeId,StaticClass.cashierId,Employee.CFA_INVOICE_PRICE_CHANGE)) { return; } } FrmKeyboardNumber kb = new FrmKeyboardNumber("Nhập số lượng :"); if(kb.ShowDialog() == DialogResult.OK) { if(Convert.ToDecimal(kb.value) == 0) { Alert.Show("Không thể nhập số lượng \nbằng 0",Color.Red); } else { foreach (MyItem item in myCash1.get_RowSelected()) { myCash1.listInvoiceItem.Rows[item.Id - 1][3] = kb.value; } UpdateItemSelect(); } } }
private void button66_Click(object sender, EventArgs e) { if (!Employee.CheckGrant(StaticClass.storeId, StaticClass.cashierId, Employee.CFA_INVOICE_PRICE_CHANGE)) { return; } FrmKeyboardNumber kb = new FrmKeyboardNumber("Nhập giá :"); if (kb.ShowDialog() == DialogResult.OK) { foreach (MyItem item in myCash1.get_RowSelected()) { Utilities.Utils.WriteLogFile(StaticClass.cashierId + "\t" + "Doi gia mat hang " + invoiceNum + " " + myCash1.listInvoiceItem.Rows[item.Id - 1]["ItemNum"].ToString() + " " + myCash1.listInvoiceItem.Rows[item.Id - 1]["Quantity"].ToString() + " " + String.Format("{0:0,0}", myCash1.listInvoiceItem.Rows[item.Id - 1]["PricePer"]) + " " + kb.value); myCash1.listInvoiceItem.Rows[item.Id - 1]["origPricePer"] = kb.value; } UpdateItemSelect(); } }
private void button63_Click(object sender, EventArgs e) { if(Employee.CheckGrant(StaticClass.storeId,StaticClass.cashierId,Employee.CFA_INVOICE_DISCOUNT)) { FrmKeyboardNumber frmKeyBoard = new FrmKeyboardNumber("Nhập % khấu trừ : "); if (frmKeyBoard.ShowDialog() == DialogResult.OK) { myCash1.invoiceTotal.Rows[0]["Discount"] = Convert.ToDecimal(frmKeyBoard.value) / 100; UpdateInfo(); } } }
decimal PromptPrice(DataRow Item) { if (Convert.ToBoolean(Item[42])) { FrmKeyboardNumber frmKeyboardNumber = new FrmKeyboardNumber("Nhập Giá bán"); if (frmKeyboardNumber.ShowDialog() == DialogResult.OK) { return Convert.ToDecimal(frmKeyboardNumber.value); } else { return Convert.ToDecimal(-0.1234); } } else { return Convert.ToDecimal(Item[4]); } }
private void button67_Click(object sender, EventArgs e) { ArrayList arrayList = myCash1.get_RowSelected(); if(arrayList.Count > 1) { Alert.Show("Chỉ chọn một món để trả lại.",Color.Red); } else { FrmKeyboardNumber frmKeyboardNumber = new FrmKeyboardNumber("Nhập số lượng trả lại"); if(frmKeyboardNumber.ShowDialog() == System.Windows.Forms.DialogResult.OK) { decimal oldQuan = Convert.ToDecimal(myCash1.listInvoiceItem.Rows[((MyItem)arrayList[0]).Id - 1]["Quantity"]); string itemNum = myCash1.listInvoiceItem.Rows[((MyItem)arrayList[0]).Id - 1]["ItemNum"].ToString(); decimal returnQuan = Convert.ToDecimal(frmKeyboardNumber.value); if(oldQuan >= returnQuan) { object[] newrow = myCash1.listInvoiceItem.Rows[((MyItem) arrayList[0]).Id - 1].ItemArray; newrow[3] = 0 - returnQuan; newrow[1] = myCash1.listInvoiceItem.Rows.Count + 1; decimal price = (0 - returnQuan)*Convert.ToDecimal(newrow[5]); string itemName = myCash1.listInvoiceItem.Rows[((MyItem)arrayList[0]).Id - 1]["DiffItemName"].ToString(); myCash1.listInvoiceItem.Rows.Add(newrow); myCash1.addRow(itemName, String.Format("{0:0.##}",0-returnQuan), String.Format("{0:0,0}", price)); UpdateInfo(); } else { Alert.Show("Số lượng trả vượt quá số\n lượng bán.",Color.Red); } } } }
float PromptQuant(DataRow Item) { string sl = txtSoLuong.Text; txtSoLuong.Text = ""; if(Convert.ToBoolean(Item[43])) { FrmKeyboardNumber frmKeyboardNumber = new FrmKeyboardNumber("Nhập số lượng "); if(frmKeyboardNumber.ShowDialog() == DialogResult.OK) { return Convert.ToSingle(frmKeyboardNumber.value); } return -1; } else { if(sl == "") { return 1; } else { return Convert.ToSingle(sl); } } }