Beispiel #1
0
        private void UF_QLMuonTra_Load(object sender, EventArgs e)
        {
            M_loadDgvTaiLieu();
            // tao bang tam
            taoBangtam();
            QLMT_T_txtTimTLTra.Text = "";
            QLMT_T_txtTimTLTra.Focus();
            QLMT_T_lblMaThe.Text      = "";
            QLMT_T_lblTienCoc.Text    = "";
            QLMT_T_lblTinhTrang.Text  = "";
            QLMT_T_lblHoTen.Text      = "";
            QLMT_T_lblEmail.Text      = "";
            QLMT_T_lblSDT.Text        = "";
            QLMT_T_txtMV.Text         = "";
            QLMT_T_txtTenNV.Text      = "";
            QLMT_T_txtGiaTL.Text      = "";
            QLMT_T_lblTongtien.Text   = "";
            QLMT_T_lblTongTienBT.Text = "";

            QLMT_T_btnXacNhanVP.Enabled  = false;
            QLMT_T_btnTinhTien.Enabled   = false;
            QLMT_T_btnXoaCT.Enabled      = false;
            QLMT_T_btnChon.Enabled       = false;
            QLMT_T_btnHuyChon.Enabled    = false;
            QLMT_T_btnXacNhanTra.Enabled = false;

            QLMT_T_chkNhanTienCoc.Checked = false;

            QLMT_TDG_txtTimMaDG.Text = "";
            QLMT_TDG_txtTimMaDG.Focus();
            QLMT_TDG_lblMaThe.Text      = "";
            QLMT_TDG_lblTienCoc.Text    = "";
            QLMT_TDG_lblTTThe.Text      = "";
            QLMT_TDG_lblHoTen.Text      = "";
            QLMT_TDG_lblEmail.Text      = "";
            QLMT_TDG_lblSDT.Text        = "";
            QLMT_TDG_txtMV.Text         = "";
            QLMT_TDG_txtTenNV.Text      = "";
            QLMT_TDG_txtGiaTL.Text      = "";
            QLMT_TDG_lblTongtien.Text   = "";
            QLMT_TDG_lblTongTienBT.Text = "";

            QLMT_TDG_btnXacNhanTra.Enabled = false;
            QLMT_TDG_btnTinhTien.Enabled   = false;
            QLMT_TDG_btnXoa.Enabled        = false;
            QLMT_TDG_btnChon.Enabled       = false;
            QLMT_TDG_btnHuyChon.Enabled    = false;
            QLMT_TDG_btnXacNhanVP.Enabled  = false;

            loadCboLoaiVP();
        }
Beispiel #2
0
        private void QLMT_TDG_btnXacNhanTra_Click(object sender, EventArgs e)
        {
            //luu phieu tra
            //cap nha phieu muon ( neu tra du thi tinh trang = true, tinh trang chi tiet = true

            List <CT_PHIEUTRA>   lstCTPT   = new List <CT_PHIEUTRA>();
            List <LOAIVIPHAM>    lstLoaivp = new List <LOAIVIPHAM>();
            List <CT_XULYVIPHAM> lstCTXL   = new List <CT_XULYVIPHAM>();

            string[] tienbt = QLMT_TDG_lblTongtien.Text.Split(' ');
            manv = Frm_Main.username;
            int      sltra   = QLMT_TDG_dgvCT_TLTra.Rows.Count - 1;
            DateTime ngaytra = DateTime.Now;
            int      mapm    = int.Parse(QLMT_TDG_dgvDSTLTra.CurrentRow.Cells[1].Value.ToString());

            //lvp.MaLoaiViPham = QLMT_T_cboLoaiVP.SelectedIndex;


            if (QLMT_TDG_dgvCT_TLTra.Rows.Count - 1 > 0)
            {
                for (int i = 0; i < QLMT_TDG_dgvCT_TLTra.Rows.Count - 1; i++)
                {
                    CT_PHIEUTRA _ct = new CT_PHIEUTRA();
                    _ct.MaVach      = QLMT_TDG_dgvCT_TLTra.Rows[i].Cells[0].Value.ToString();
                    _ct.MaPhieuMuon = int.Parse(QLMT_TDG_dgvCT_TLTra.Rows[i].Cells[1].Value.ToString());
                    lstCTPT.Add(_ct);
                }
            }


            if (QLMT_TDG_dgvCT_Vipham.Rows.Count - 1 > 0)
            {
                for (int i = 0; i < QLMT_TDG_dgvCT_Vipham.Rows.Count - 1; i++)
                {
                    CT_XULYVIPHAM ctxl = new CT_XULYVIPHAM();
                    ctxl.MaVach        = QLMT_TDG_dgvCT_Vipham.Rows[i].Cells[1].Value.ToString();
                    ctxl.MaLoaiViPham  = int.Parse(QLMT_TDG_dgvCT_Vipham.Rows[i].Cells[4].Value.ToString());
                    ctxl.TienBoiThuong = float.Parse(QLMT_TDG_dgvCT_Vipham.Rows[i].Cells[3].Value.ToString());
                    lstCTXL.Add(ctxl);
                }
            }

            // lấy ds loại vi phạm và ds tiền bồi thường

            bool phicoc;

            if (QLMT_TDG_chkTraTienCoc.Checked)
            {
                phicoc = true;
            }
            else
            {
                phicoc = false;
            }

            if (QLMT_TDG_dgvCT_TLTra.RowCount - 1 > 0)
            {
                if (qlt.luuPhieuTra(mapm, int.Parse(manv.ToString()), ngaytra, sltra, phicoc, QLMT_TDG_lblTienCoc.Text, lstCTPT))
                {
                    // luu phieu xu ly neu co
                    if (QLMT_TDG_dgvCT_Vipham.Rows.Count - 1 > 0)
                    {
                        qlt.luuPhieuXLVP(ngaytra, float.Parse(QLMT_TDG_lblTongTienBT.Text), lstCTXL, int.Parse(manv));
                        mathetv = "";
                    }
                    MessageBox.Show("Quá trình trả thành công ! ");
                }
            }
            else
            {
                MessageBox.Show("Quá trình trả thất bại !");
            }



            //luu chi tiet phieu nhap



            //reset dgv
            QLMT_TDG_dgvDSTLTra.DataSource = null;
            QLMT_TDG_dgvDSTLTra.Refresh();
            QLMT_TDG_dgvCT_Vipham.DataSource = null;
            QLMT_TDG_dgvCT_Vipham.Refresh();
            QLMT_TDG_dgvCT_TLTra.DataSource = null;
            QLMT_TDG_dgvCT_TLTra.Refresh();
            QLMT_TDG_txtTimMaDG.Text = "";
            QLMT_TDG_txtTimMaDG.Focus();
            QLMT_TDG_lblMaThe.Text      = "";
            QLMT_TDG_lblTienCoc.Text    = "";
            QLMT_TDG_lblTTThe.Text      = "";
            QLMT_TDG_lblHoTen.Text      = "";
            QLMT_TDG_lblEmail.Text      = "";
            QLMT_TDG_lblSDT.Text        = "";
            QLMT_TDG_txtMV.Text         = "";
            QLMT_TDG_txtMV.Enabled      = false;
            QLMT_TDG_txtTenNV.Text      = "";
            QLMT_TDG_txtTenNV.Enabled   = false;
            QLMT_TDG_txtGiaTL.Text      = "";
            QLMT_TDG_txtGiaTL.Enabled   = false;
            QLMT_TDG_lblTongtien.Text   = "";
            QLMT_TDG_lblTongTienBT.Text = "";

            QLMT_TDG_btnXacNhanTra.Enabled = false;
            QLMT_TDG_btnTinhTien.Enabled   = false;
            QLMT_TDG_btnXoa.Enabled        = false;
            QLMT_TDG_btnChon.Enabled       = false;
            QLMT_TDG_btnHuyChon.Enabled    = false;
            QLMT_TDG_btnXacNhanVP.Enabled  = false;
            QLMT_TDG_txtSoNgayVP.ResetText();

            ////QLMT_TDG_chkTraTienCoc.Checked = false;
        }