private void btnThem_Click(object sender, EventArgs e)
        {
            //PHIEUSUACHUA psc = new PHIEUSUACHUA(...);
            //PHIEUSUACHUA_BUS.ThemPhieuSuaChua(psc);

            DateTime   today   = DateTime.Now;
            string     maBCT   = BC_TONVTPT_BUS.GetMaBCT(today.Month, today.Year);
            string     maCTBCT = CT_BC_VTPT_BUS.getMaCTBCT(maBCT, cboPhuTung.Text);
            CT_BC_VTPT chitiet = new CT_BC_VTPT();

            chitiet.MaBCT    = maBCT;
            chitiet.MaCTBC   = maCTBCT;
            chitiet.MaVTPT   = cboPhuTung.Text;
            chitiet.TonCuoi  = int.Parse(txtSL.Text);
            chitiet.PhatSinh = 0;
            chitiet.TonDau   = 0;
            CT_BC_VTPT_BUS.capNhatTonCuoi(chitiet);
        }
Пример #2
0
        private void btnThemSL_Click(object sender, EventArgs e)
        {
            int         soluong = int.Parse(txtSoLuong.Text);
            frmNhapVTPT form    = new frmNhapVTPT(txtSoLuong);

            form.ShowDialog();
            if (btnThayDoi.Enabled)
            {
                DTO.VTPT phuTung = new DTO.VTPT();
                phuTung.MaVTPT     = txtMaVTPT.Text;
                phuTung.TenVTPT    = txtTenVTPT.Text;
                phuTung.SoLuongTon = int.Parse(txtSoLuong.Text);

                //cap nhat phat sinh
                DateTime today = DateTime.Now;
                string   maBCT = BC_TONVTPT_BUS.GetMaBCT(today.Month, today.Year);

                if (maBCT == "")
                {
                    BC_TONVTPT baocao = new BC_TONVTPT();

                    baocao.MaBCT = BC_TONVTPT_BUS.AutoMABCT();
                    maBCT        = baocao.MaBCT;
                    baocao.Thang = today.Month;
                    baocao.Nam   = today.Year;
                    BC_TONVTPT_BUS.ThemBC(baocao);
                }

                string     maCTBCT = CT_BC_VTPT_BUS.getMaCTBCT(maBCT, phuTung.MaVTPT);
                CT_BC_VTPT chitiet = new CT_BC_VTPT();

                chitiet.MaBCT    = maBCT;
                chitiet.MaCTBC   = maCTBCT;
                chitiet.MaVTPT   = phuTung.MaVTPT;
                chitiet.TonCuoi  = 0;
                chitiet.PhatSinh = int.Parse(txtSoLuong.Text) - soluong;
                chitiet.TonDau   = 0;
                CT_BC_VTPT_BUS.capNhatPhatSinh(chitiet);

                //PHUTUNG_BUS.ThayDoiSoLuongPhuTung(phuTung);
            }
        }