public static void ThemBC(BC_DOANHSO baoCao)
        {
            BC_DOANHSO_DAO.ThemBaoCao(baoCao);
            DataTable dt = HIEUXE_BUS.GetMaHieuXe(); //Get list mã hiệu xe

            foreach (DataRow row in dt.Rows)
            {
                CT_BC_DOANHSO chiTiet = new CT_BC_DOANHSO();
                chiTiet.MaCTBC   = CT_BC_DOANHSO_BUS.AutoMACTBC();
                chiTiet.MaBCDS   = baoCao.MaBaoCaoDoanhSo;
                chiTiet.MaHieuXe = row.ItemArray[0].ToString();

                CT_BC_DOANHSO_BUS.ThemCTBC(chiTiet);
            }
        }
        public static void ThemBaoCao(BC_DOANHSO baoCao)
        {
            DataAccessHelper db  = new DataAccessHelper();
            SqlCommand       cmd = db.Command("THEMBCDS");

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@MABC", baoCao.MaBaoCaoDoanhSo);
            cmd.Parameters.AddWithValue("@THANG", baoCao.Thang);
            cmd.Parameters.AddWithValue("@NAM", baoCao.Nam);

            SqlDataAdapter da = new SqlDataAdapter(cmd);

            db.dt = new DataTable();
            da.Fill(db.dt);
        }
        public static void ThemPhieuSuaChua(PHIEUSUACHUA psc)
        {
            PHIEUSUACHUA_DAO.ThemPhieuSuaChua(psc);

            string maHieuXe = XE_DAO.GetMaHieuXe(psc.MaXe.ToString());
            string maBCDS   = BC_DOANHSO_BUS.GetMaBC(psc.NgaySuaChua.Month, psc.NgaySuaChua.Year);

            if (maBCDS == "")
            {
                maBCDS = BC_DOANHSO_BUS.AutoMABC();

                BC_DOANHSO baoCao = new BC_DOANHSO();
                baoCao.MaBaoCaoDoanhSo = maBCDS;
                baoCao.Thang           = psc.NgaySuaChua.Month;
                baoCao.Nam             = psc.NgaySuaChua.Year;

                BC_DOANHSO_BUS.ThemBC(baoCao);
            }

            CT_BC_DOANHSO chiTiet = new CT_BC_DOANHSO();

            chiTiet.MaBCDS = maBCDS;
            chiTiet.MaCTBC = CT_BC_DOANHSO_BUS.GetMaCTBC(maBCDS, maHieuXe);

            if (chiTiet.MaCTBC == "")
            {
                chiTiet.MaCTBC   = CT_BC_DOANHSO_BUS.AutoMACTBC();
                chiTiet.MaHieuXe = maHieuXe;
                CT_BC_DOANHSO_BUS.ThemCTBC(chiTiet);
            }

            CT_BC_DOANHSO_BUS.CapNhatSoLuotSua(chiTiet);

            string maBCT = BC_TONVTPT_BUS.GetMaBCT(psc.NgaySuaChua.Month, psc.NgaySuaChua.Year);

            if (maBCT == "")
            {
                maBCT = BC_TONVTPT_BUS.AutoMABCT();

                BC_TONVTPT BCT = new BC_TONVTPT();
                BCT.MaBCT = maBCT;
                BCT.Thang = psc.NgaySuaChua.Month;
                BCT.Nam   = psc.NgaySuaChua.Year;

                BC_TONVTPT_BUS.ThemBC(BCT);
            }
        }