public void Insert_UpdateHoaDon(string smaphid, string smakm, bool strangthai, string smaDV, string smaloai) { string[] sChuoiLap = DateTime.Now.ToShortDateString().Split('/'); string sMaHD = HDon_PTA.TaoMa("SODH", 8); HDon_DATA.MaHD = sMaHD; HDon_DATA.MaPH = smaphid; HDon_DATA.MaKM = smakm; HDon_DATA.ThanhTien = 0; HDon_DATA.TongTien = float.Parse(TongTienDV.ToString()); HDon_DATA.TrangThai = strangthai; HDon_DATA.ThucAn = smaDV; HDon_DATA.MaLoai = smaloai; HDon_DATA.NgayLap = sChuoiLap[1].ToString(); HDon_DATA.ThangLap = sChuoiLap[0].ToString(); HDon_DATA.NamLap = sChuoiLap[2].ToString(); HDon_PTA.Insert_Update_Delete(HDon_DATA, "Insert"); }
private void btn_TraPhong_Click(object sender, EventArgs e) { txt_SoLuon.Clear(); double kqTongTien = 0; if (sMaPHID != "" && sMaPNDelete != "") { sGioRa = DateTime.Now.ToShortTimeString(); sTempRa = DateTime.Now.ToString(); lbl_Giora.Text = sGioRa; var time = TinhGio(lbl_Giovao.Text, sGioRa); lbl_TGHat.Text = time.Hours + ":" + time.Minutes.ToString("00"); if (lbl_TienDatCoc.Text != "") { kqTongTien = double.Parse(TinhTienTheoGio(time)) + TongTienDV - float.Parse(lbl_TienDatCoc.Text); } else { kqTongTien = double.Parse(TinhTienTheoGio(time)) + TongTienDV; } TienGio = double.Parse(TinhTienTheoGio(time)).ToString(); lbl_TongTien.Text = kqTongTien.ToString("#,##0 VND"); PH_DATA.TrangThai = 0; PH_DATA.NgayVao = "0"; PH_DATA.GioHT = ""; PH_DATA.GioSau = ""; lbl_ThanhTien.Text = TongTienDV.ToString("#,##0 VND"); GetTableNP(sMaPNDelete); if (iupdate == 1) { PH_DATA.TrangThai = 0; iupdate = 0; lst_NhanPhong.Items.Clear(); } else if (iupdate == 0 || iupdate == -1) { PH_DATA.TrangThai = 1; } ShowThongTinNhanPhong(sMaPHID); GanTablePhong(sMaPHID); ShowListViewPhong(sDk); lbl_GioBT.BackColor = Color.White; lbl_GioCD.BackColor = Color.White; MaPH = sMaPHID; NgayVao = lbl_ngay.Text; NamePhong = lbl_TenPhong.Text; GioVao = lbl_Giovao.Text; GioRa = lbl_Giora.Text; SoTiengGio = lbl_TGHat.Text; NameLP = lbl_LoaiPhong.Text; TongTienPhong = lbl_TongTien.Text; TienDV = lbl_ThanhTien.Text; NameKH = txt_KhachHang.Text; MessageBox.Show("Tra phong thanh cong !!!", "Thong Bao"); } else { MessageBox.Show("Xin Vui Long Chon Phong Hat!", "Thong Bao"); lst_Phong.Focus(); } sMaPNDelete = ""; }