private void btnXuatHD_Click(object sender, EventArgs e) { var promotion = string.IsNullOrEmpty(txtPromotion.Text) ? 0 : Convert.ToDouble(txtPromotion.Text); var tongtien = string.IsNullOrEmpty(_tongTien) ? 0 : Convert.ToDouble(_tongTien); var thanhtien = tongtien - promotion; if (!txtSTK.Text.Equals("")) { if (promotion > tongtien) { MessageBox.Show("Vui lòng nhập số tiền giảm thấp hơn tổng giá trị hóa đơn."); return; } if (Convert.ToDouble(txtSTK.Text) < thanhtien) { MessageBox.Show("Hệ thống không cho phép khách hàng nợ, mong bạn thông cảm nhắc khách hàng thanh toán đúng số tiền trong hóa đơn."); } else { DialogResult kq = MessageBox.Show("Bạn có muốn thanh toán hay không?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (kq != DialogResult.No) { rpt_ThanhToan rptThanhToan = new rpt_ThanhToan(); DateTime Time = DateTime.Now; rptThanhToan.XuatHoaDon(_maHD, _tenHD, _maHD.ToString(), Program.sAccount.Name, Time, _tongTien, txtPromotion.Text, txtSTK.Text, txtTienTon.Text, thanhtien.ToString(), true); rptThanhToan.ShowDialog(); BillBUS.UpdatetBill(_maHD, tongtien, promotion, Convert.ToDouble(txtSTK.Text), Convert.ToDouble(txtTienTon.Text), thanhtien, Time, Program.sAccount.ID); _ketQua = true; Close(); } else { _ketQua = false; } } } else { MessageBox.Show("Nhập tiền khách cần thanh toán cho hóa đơn này!"); } }
private void btnTamTinh_Click(object sender, EventArgs e) { if (currentBillId <= 0) { return; } try { rpt_ThanhToan frm_TToan = new rpt_ThanhToan(); DateTime Time = DateTime.Now; frm_TToan.XuatHoaDon(currentBillId, "HÓA ĐƠN TẠM TÍNH", currentBillId.ToString(), Program.sAccount.Name, Time, string.Format("{0:0,0}", txttotalPrice.Text), "0", "0", "0", "0", true); frm_TToan.ShowDialog(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }