Пример #1
0
        public static void CapNhatBaoCao(CT_BC_DOANHSO chiTiet, int soTien)
        {
            CT_BC_DOANHSO_DAO.CapNhatBaoCao(chiTiet, soTien); //Cập nhật tổng doanh thu
            DataTable dt = HIEUXE_BUS.GetMaHieuXe();          //Lấy danh sách mã hiệu xe

            foreach (DataRow row in dt.Rows)
            {
                CT_BC_DOANHSO _chiTiet = new CT_BC_DOANHSO();
                _chiTiet.MaBCDS   = chiTiet.MaBCDS;
                _chiTiet.MaHieuXe = row.ItemArray[0].ToString();
                _chiTiet.MaCTBC   = CT_BC_DOANHSO_DAO.GetMaBCDS(_chiTiet.MaBCDS, _chiTiet.MaHieuXe);
                CT_BC_DOANHSO_DAO.CapNhatTiLe(_chiTiet);
            }
        }
        public static void CapNhatTiLe(CT_BC_DOANHSO chiTiet)
        {
            DataAccessHelper db  = new DataAccessHelper();
            SqlCommand       cmd = db.Command("CAPNHATTILE");

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@MACTBC", chiTiet.MaCTBC);
            cmd.Parameters.AddWithValue("@MABCDS", chiTiet.MaBCDS);

            SqlDataAdapter da = new SqlDataAdapter(cmd);

            db.dt = new DataTable();
            da.Fill(db.dt);
        }
        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 ThemCTBC(CT_BC_DOANHSO chiTiet)
        {
            DataAccessHelper db  = new DataAccessHelper();
            SqlCommand       cmd = db.Command("THEMCT_BCDS");

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@MACTBC", chiTiet.MaCTBC);
            cmd.Parameters.AddWithValue("@MABCDS", chiTiet.MaBCDS);
            cmd.Parameters.AddWithValue("@MAHIEUXE", chiTiet.MaHieuXe);

            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);
            }
        }
Пример #6
0
 public static void CapNhatSoLuotSua(CT_BC_DOANHSO chiTiet)
 {
     CT_BC_DOANHSO_DAO.CapNhatSoLuotSua(chiTiet);
 }
Пример #7
0
 public static void ThemCTBC(CT_BC_DOANHSO chiTiet)
 {
     CT_BC_DOANHSO_DAO.ThemCTBC(chiTiet); //Thêm ct_bcds mới (MACTBC, MABCDS, MAHX)
 }