private void Print_click(object sender, EventArgs e) { try { Receipt_details r = new Receipt_details(); DataGridViewRow dt = dataGridView1.SelectedRows[0]; r.employeeid = dt.Cells[0].Value.ToString(); r.date = DateTime.Now.ToShortDateString(); r.room_no = dt.Cells[2].Value.ToString(); r.gamename = dt.Cells[3].Value.ToString(); r.customerid = dt.Cells[4].Value.ToString(); r.starttime = dt.Cells[5].Value.ToString(); r.endtime = dt.Cells[6].Value.ToString(); r.MoneyPerHour = numericUpDown1.Value.ToString(); r.Tax = "0.14"; r.TimeSpent = ((Convert.ToDateTime(dt.Cells[6].Value.ToString()).Subtract(Convert.ToDateTime(dt.Cells[5].Value.ToString()))).TotalMinutes / 60.0).ToString(); DataTable tempdiscount = Program.ctrl.GetDiscount(Convert.ToInt32(r.customerid)); if (tempdiscount != null) { r.Discount = tempdiscount.Rows[0][0].ToString(); } else { r.Discount = "0"; } r.TotalMoney = ((Convert.ToInt32(r.TimeSpent) * Convert.ToInt32(r.MoneyPerHour)) * (1.14) - Convert.ToInt32(r.Discount)).ToString(); reciept = new Reciept(r); reciept.Show(); } catch (Exception ex) { } }
public Reciept(Receipt_details rdetails) { InitializeComponent(); r = rdetails; }