Example #1
0
 private void btnDongY_Click(object sender, EventArgs e)
 {
     if (hd == 1)
     {
         if (MessageBox.Show("Bạn có chắc là muốn xóa hóa đơn này chứ ?") == DialogResult.OK)
         {
             BUS.BUSCTCHIETKHAU _CTCK = new BUS.BUSCTCHIETKHAU();
             foreach (DTO.DTOCTCHIETKHAU _ck in _CTCK.LayTatCaCTCHIETKHAU().Where(a => a.MAHD == LayHoaDon().MAHD))
             {
                 _CTCK.XoaCTCHIETKHAU(_ck.MACK,_ck.MAHD);
             }
             BUS.BUSCTPHUTHU _CTPT = new BUS.BUSCTPHUTHU();
             foreach (DTO.DTOCTPHUTHU _pt in _CTPT.LayTatCaCTPHUTHU().Where(a => a.MAHD == LayHoaDon().MAHD))
             {
                 _CTPT.XoaCTPHUTHU(_pt.MAPT, _pt.MAHD);
             }
             HoaDon.XoaHOADON(LayHoaDon().MAHD);
             LoadHoaDon();
             BUS.BUSPHIEUNHANPHONG _np = new BUS.BUSPHIEUNHANPHONG();
             DTO.DTOPHIEUNHANPHONG _dtonp=_np.LayTheoMaPHIEUNHANPHONG(LayHoaDon().MAPHIEU)[0];
             _dtonp.THANHTOAN = false;
             _np.CapnhatPHIEUNHANPHONG(_dtonp);
             DTO.DTOCheckData _cdHoadon = checkdata.LayTheoMaCheckData("PHIEUNHANPHONG").Last();
             _cdHoadon.Version += 1;
             checkdata.CapnhatCheckData(_cdHoadon);
             btnXoaHD.Visible = true;
             btnDongY.Visible = false;
             btnHuy.Visible = false;
             hd = 0;
         }
     }
 }
Example #2
0
        private void gridViewHoaDon_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
        {
            if (txtMaHD.Text.Trim() == "") return;
            BUS.BUSCHIETKHAU _ChietKhau = new BUS.BUSCHIETKHAU();
            BUS.BUSPHUTHU _PhuThu = new BUS.BUSPHUTHU();
            BUS.BUSCTCHIETKHAU _CTCK = new BUS.BUSCTCHIETKHAU();
            BUS.BUSCTPHUTHU _CTPT = new BUS.BUSCTPHUTHU();
            BUS.BUSDICHVU _DichVu = new BUS.BUSDICHVU();
            BUS.BUSCHITIETDV _CTDV = new BUS.BUSCHITIETDV();

            var _ctck = from a in _ChietKhau.LayTatCaCHIETKHAU()
                        join b in _CTCK.LayTatCaCTCHIETKHAU() on a.MACK equals b.MACK
                        where b.MAHD == Convert.ToInt32(txtMaHD.Text)
                        select new
                        {
                            MACK = a.MACK,
                            TENCK = a.TENCK,
                            PHANTRAMCK = b.PHANTRAMCK
                        };
            grdCK.DataSource = _ctck.Where(a => a.MACK != 23).ToList(); ;
            var _ctpt = from a in _PhuThu.LayTatCaPHUTHU()
                        join b in _CTPT.LayTatCaCTPHUTHU() on a.MAPT equals b.MAPT
                        where b.MAHD == Convert.ToInt32(txtMaHD.Text)
                        select new
                        {
                            MAPT = a.MAPT,
                            TENPT = a.TENPT,
                            PHANTRAMPT = b.PHANTRAMPT
                        };
            grdPT.DataSource = _ctpt.Where(a => a.MAPT != 15).ToList();
            var _ctdv = from a in _DichVu.LayTatCaDICHVU()
                        join b in _CTDV.LayTatCaCHITIETDV() on a.MADV equals b.MADV
                        where b.MAPHIEU == Convert.ToInt32(cmbMaPhieu.SelectedValue)
                        select new
                        {
                            MADV = a.MADV,
                            TENDV = a.TENDV,
                            NGAYTHUE = b.NGAYTHUE,
                            SOLUONGDV = b.SOLUONGDV,
                            GIADV = b.GIADV
                        };
            grdDV.DataSource = _ctdv;
        }