Exemple #1
0
        private void NhapKho_Load(object sender, EventArgs e)
        {
            listCTPN = new BindingList <CTPHIEUNHAP>();
            phieu    = new PHIEUNHAP();

            tbl_nk.DataSource = listCTPN;
            tb_Manv.Text      = MainMenu.usrId.ToString();

            col_source = new AutoCompleteStringCollection();
            DoChoiBus dcBus = new DoChoiBus();

            listDc = dcBus.dsDoChoi();
            foreach (DOCHOI a in listDc)
            {
                col_source.Add(a.MADC.ToString());
            }
            tb_masp.AutoCompleteMode         = AutoCompleteMode.SuggestAppend;
            tb_masp.AutoCompleteCustomSource = col_source;
            tb_masp.AutoCompleteSource       = AutoCompleteSource.CustomSource;

            tbl_nk.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;

            now = DateTime.Now;
            tb_NgayNhap.Text = now.ToString("dd - MM - yyyy");

            PhieuNhapBus phBus = new PhieuNhapBus();
            int          s     = phBus.dsPhieuNhap().Count;

            if (s == 0)
            {
                phieu.MAPHIEU = 1000;
            }
            else
            {
                phieu.MAPHIEU = phBus.dsPhieuNhap().Last().MAPHIEU + 1;
            }

            phieu.MANV     = MainMenu.usrId;
            phieu.NGAYNHAP = now;
            phieu.TONGGIA  = 0;

            tb_MaPhieu.Text   = phieu.MAPHIEU.ToString();
            tb_SL.Text        = "0";
            tb_TSL.Text       = tong_sl.ToString();
            tb_tong_tien.Text = tong_giatri.ToString();
        }
        // ADD_ON FUNCTION

        private void load_DsPhieuNhap_From_To()
        {
            PhieuNhapBus phieuBus = new PhieuNhapBus();

            tbl_DsPhieuNhap.DataSource = phieuBus.dsPhieuNhap(dtp_from.Value, dtp_to.Value);
            tbl_DsPhieuNhap.Refresh();
            tbl_DsPhieuNhap.ClearSelection();
            listCT.Clear();
            tbl_CtPhieuNhap.Refresh();
        }
        private void ThongKeNhapKho_Load(object sender, EventArgs e)
        {
            PhieuNhapBus phieuBus = new PhieuNhapBus();

            listPN       = new List <PHIEUNHAP>();
            listCT       = new BindingList <CTPHIEUNHAP>();
            deleted_item = new List <CTPHIEUNHAP>();
            changed_item = new List <CTPHIEUNHAP>();

            tbl_DsPhieuNhap.DataSource = phieuBus.dsPhieuNhap();
            tbl_DsPhieuNhap.Refresh();
            tbl_CtPhieuNhap.DataSource = listCT;
            tbl_CtPhieuNhap.Refresh();

            tbl_CtPhieuNhap.Columns[0].Visible  = false;
            tbl_CtPhieuNhap.Columns[2].ReadOnly = false;

            dtp_from.Value = DateTime.Parse("01/01/2000");
            dtp_to.Value   = DateTime.Now;
            load_DsPhieuNhap_From_To();
        }