private void BtnAddBillRoom_Click(object sender, EventArgs e) { // Thêm chi tiết thanh toán của phòng đã chọn vào DataGrid var BillDate = DateTime.ParseExact(deBillDate.Text, "d/M/yyyy", CultureInfo.InvariantCulture).ToString("d"); var dr = RoomBillBUS.GetLeasePayment(this.cbAddBillRoomID.Text, BillDate).Rows[0]; this.dgvBillRoom.Rows.Add( dr["MaPhong"], dr["SoNgayThue"], Convert.ToInt64(dr["DonGia"]).ToString("N0"), Convert.ToInt64(dr["PhuThuKhachThem"]).ToString("N0"), Convert.ToInt64(dr["PhuThuKhachNuocNgoai"]).ToString("N0"), Convert.ToInt64(dr["ThanhTien"]).ToString("N0")); }
private void BtnCreate_Click(object sender, EventArgs e) { if (this.tbChange.Text[0] == '-') { MessageBox.Show( "Số tiền nhận chưa đủ tiền thanh toán", "THANH TOÁN HOÁ ĐƠN THẤT BẠI", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { var BillDate = DateTime.ParseExact(this.tbBillDate.Text, "d/M/yyyy", CultureInfo.InvariantCulture); var bill = new RoomBillDTO(); bill.BillDate = DateTime.ParseExact(this.tbBillDate.Text, "d/M/yyyy", CultureInfo.InvariantCulture).ToString("d"); bill.CustomerName = this.tbBillCustomer.Text; bill.CustomerAddress = this.tbBillAddress.Text; bill.BillCost = Convert.ToInt64(this.tbBillPrice.Text.Replace(",", "")); RoomBillBUS.InsertBill(bill); foreach (DataGridViewRow row in this.dgvBillData.Rows) { var roomID = row.Cells["PaidRoomID"].Value.ToString(); var price = Convert.ToInt64(row.Cells["PaidRoomTotalPrice"].Value.ToString().Replace(",", "")); RoomLeaseBUS.InsertRoomLeasePayment(roomID, price); } MainForm mainForm = (MainForm)Owner; mainForm.ReLoadRoomData(); mainForm.ReLoadAvailableRoom(); mainForm.ReCreateBill(); MessageBox.Show( "Thanh toán hoá đơn thành công", "THANH TOÁN HOÁ ĐƠN THÀNH CÔNG", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } }
//Tab 05: Room-Revenue Report private void BtnCreateMonthRevenue_Click(object sender, EventArgs e) { this.dgvRevenueList.Rows.Clear(); var dt = RoomBillBUS.GetMonthRevenueReport(Convert.ToInt16(this.cbRevenueMonth.SelectedItem.ToString())); if (dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { this.dgvRevenueList.Rows.Add (dr["LoaiPhong"].ToString(), Convert.ToInt64(dr["DoanhThu"]).ToString("N0"), String.Format("{0:0.00}", dr["TiLe"])); } } else { MessageBox.Show("Không có doanh thu trong tháng " + this.cbRevenueMonth.SelectedItem.ToString(), "KHÔNG CÓ DOANH THU", MessageBoxButtons.OK, MessageBoxIcon.Information); } }