private void btnPrint_Click(object sender, EventArgs e) { frmViewReport frmView = new frmViewReport(detailVanDe); frmView.Show(); }
private void btnPrintBill_Click(object sender, EventArgs e) { if (iCurrentReceiptID >= 0) { int i; DataSetHoaDon dsBill = new DataSetHoaDon(); DataSet dsSP = new DataAccess().getChitietHDXuatByID(iCurrentReceiptID); DataSet dsHD = new DataAccess().getHoadonxuatByIDHoadonXuat(iCurrentReceiptID); for (i = 0; i < dsSP.Tables[0].Rows.Count; i++) { DataRow dr1 = dsBill.Tables["RDatadetail"].NewRow(); dr1["STT"] = (i + 1).ToString(); dr1["TenSanPham"] = dsSP.Tables[0].Rows[i]["TenSanPham"].ToString(); dr1["DVT"] = dsSP.Tables[0].Rows[i]["DVT"].ToString(); dr1["DonGia"] = dsSP.Tables[0].Rows[i]["Gia"].ToString(); dr1["Soluong"] = dsSP.Tables[0].Rows[i]["Soluong"].ToString(); dr1["ThanhTien"] = Convert.ToDecimal(dsSP.Tables[0].Rows[i]["Thanhtien"]).ToString("###,###,###,###"); dsBill.Tables["RDatadetail"].Rows.Add(dr1); } DataRow dr2 = dsBill.Tables["RDatadetail"].NewRow(); dr2["STT"] = (i + 2).ToString(); dr2["TenSanPham"] = "Tiền phòng"; dr2["DVT"] = ("Giờ").ToString(); dr2["DonGia"] = txtRoomPrice.Text; TimeSpan ts = Convert.ToDateTime(dsHD.Tables[0].Rows[0]["GioKT"]). TimeOfDay.Subtract(Convert.ToDateTime(dsHD.Tables[0].Rows[0]["GioBD"]).TimeOfDay); double playmin = ts.Hours + Convert.ToDouble(ts.Minutes) / 60; dr2["Soluong"] = playmin.ToString("##.00"); dr2["ThanhTien"] = txtHourMoney.Text; dsBill.Tables["RDatadetail"].Rows.Add(dr2); DataRow dr3 = dsBill.Tables["RDatadetail"].NewRow(); dr3["STT"] = (i + 3).ToString(); dr3["TenSanPham"] = "Phụ thu"; //dr3["DVT"] = ("").ToString(); dr3["DonGia"] = txtExtra.Text; dr3["Soluong"] = "1"; dr3["ThanhTien"] = txtExtra.Text; dsBill.Tables["RDatadetail"].Rows.Add(dr3); DataRow dr4 = dsBill.Tables["RDatadetail"].NewRow(); dr4["STT"] = (i + 4).ToString(); dr4["TenSanPham"] = "Thuế"; dr4["DVT"] = ("%").ToString(); // dr4["DonGia"] = "Phần Trăm"; dr4["Soluong"] = txtTax.Text; if (txtBilltotal.Text == "") { dr4["ThanhTien"] = "0"; } else { dr4["ThanhTien"] = (Convert.ToDouble(txtBilltotal.Text) * Convert.ToDouble(txtTax.Text) / (100 + Convert.ToDouble(txtTax.Text))).ToString("###,###,##0"); } dsBill.Tables["RDatadetail"].Rows.Add(dr4); //read Company Information form file StreamReader reader = null; string strCompanyName = ""; string strCompanyAddress = ""; string strCompanyPhone = ""; try { reader = new StreamReader("COMConfig.txt"); while (!reader.EndOfStream) { string line = reader.ReadLine(); int indexEqual = line.IndexOf('='); string title = line.Substring(0, indexEqual); string data = line.Substring(indexEqual + 1, line.Length - indexEqual - 1); switch (title) { case "[COMPORT]": break; case "[BAUDRATE]": break; case "[STOPBITS]": break; case "[PARITY]": break; case "[DATABITS]": break; case "[CompanyName]": strCompanyName = Convert.ToString(data); break; case "[Address]": strCompanyAddress = Convert.ToString(data); break; case "[Phone]": strCompanyPhone = Convert.ToString(data); break; default: break; } } reader.Close(); } catch { MessageBox.Show("Thông tin trong file COMConfig.txt chưa đúng!. \nVui lòng cập nhật lại thông tin của file này!"); } DataRow dr = dsBill.Tables["HeaderData"].NewRow(); dr["Ngayxuat"] = txtTime.Text; dr["Phong"] = txtRoom.Text; dr["GiaPhong"] = txtRoomPrice.Text; dr["HoadonID"] = iCurrentReceiptID.ToString(); dr["GioBD"] = Convert.ToDateTime(dsHD.Tables[0].Rows[0]["GioBD"]).ToShortTimeString(); dr["GioKT"] = Convert.ToDateTime(dsHD.Tables[0].Rows[0]["GioKT"]).ToShortTimeString(); dr["Nhanvien"] = cboEmployee.Text; dr["Thue"] = txtTax.Text; dr["Tiengiam"] = txtReduce.Text; dr["Phuthu"] = txtExtra.Text; dr["Tiengio"] = txtHourMoney.Text; dr["Tienhang"] = txtProductMoney.Text; dr["Tongcong"] = txtBilltotal.Text; dr["TenCongTy"] = strCompanyName; dr["DiaChi"] = "ĐC: " + strCompanyAddress; dr["SoDT"] = "ĐT: " + strCompanyPhone; dsBill.Tables["HeaderData"].Rows.Add(dr); if (dsBill != null) { frmViewReport frmView = new frmViewReport(dsBill); frmView.Show(); } } }
private void button3_Click(object sender, EventArgs e) { if (TonKhoReport != null) { frmViewReport frmView = new frmViewReport(TonKhoReport); frmView.Show(); } }
private void btnViewReport_Click(object sender, EventArgs e) { if (detailReport != null) { frmViewReport frmView = new frmViewReport(detailReport); frmView.Show(); } }
private void btnTKHDViewReport_Click(object sender, EventArgs e) { if (TKHDReport != null) { frmViewReport frmView = new frmViewReport(TKHDReport); frmView.Show(); } //btnTKHDViewReport.Enabled = false; }