private void btn_thanhtoan_Click(object sender, EventArgs e) { try { if (cbb_hinhthuc.SelectedIndex == 0) { MessageBox.Show("Chưa chọn hình thức thanh toán"); } else { string tentt = cbb_hinhthuc.Text; double tiendichvu = 0; double tienthuephong = 0; double tienphuthu; double tientratruoc = double.Parse(txt_tientratruoc.Text); double tongtien; double tienphongcu = 0; if (chb_phuthu.Checked && !string.IsNullOrEmpty(txt_phuthu.Text)) { tienphuthu = double.Parse(txt_phuthu.Text.Replace(",", "")); } else { tienphuthu = 0; } if (txt_tienthuephongcu.Visible == true) { tienphongcu = double.Parse(txt_tienthuephongcu.Text.Replace(",", "")); } foreach (DataGridViewRow row in dgv_thongtin_dichvu.Rows) { tiendichvu += double.Parse(row.Cells[3].Value.ToString()); } foreach (DataGridViewRow row1 in dgv_thongtin_phong.Rows) { tienthuephong += double.Parse(row1.Cells[2].Value.ToString()); } tongtien = tiendichvu + tienthuephong - tientratruoc + tienphuthu + tienphongcu; if (cbb_hinhthuc.SelectedIndex == 1) { ThanhToanHoaDon thanhtoan = new ThanhToanHoaDon(this, conn); thanhtoan.get_tongtien(tongtien); thanhtoan.get_thongtin_thanhtoan(tentt, tienthuephong, tiendichvu, txt_mathuephong.Text, tongtien, tienphuthu, txt_ghichu.Text); thanhtoan.get_maphieuthue(txt_mathuephong.Text); thanhtoan.get_thanhtoan(cbb_hinhthuc.Text); thanhtoan.StartPosition = FormStartPosition.CenterScreen; thanhtoan.ShowDialog(); } else if (cbb_hinhthuc.SelectedIndex == 2) { ThanhToanThe the = new ThanhToanThe(this, conn); the.nguon("frm_thanhtoan"); the.get_matp_from_frmThanhtoan(txt_mathuephong.Text); the.get_tien(tienthuephong, tiendichvu, tienphuthu, txt_ghichu.Text); the.get_thongtin_thanhtoan(tongtien); the.get_thanhtoan(cbb_hinhthuc.Text); the.StartPosition = FormStartPosition.CenterScreen; the.ShowDialog(); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public Viewer_Tong(ThanhToanThe _thanhtoan, connect _conn) { InitializeComponent(); ttt = _thanhtoan; conn = _conn; }