Ejemplo n.º 1
0
        public static void NhapPhieuThuTien(PhieuThuTien phieuThuTien)
        {
            PhieuThuTienDAL.NhapPhieuThuTien(phieuThuTien);
            string hieuXe = XeDAL.GetHieuXe(phieuThuTien.BienSo);
            string maBCDT = BaoCaoDoanhThuBLL.GetMaBC(phieuThuTien.NgayThu.Month, phieuThuTien.NgayThu.Year);

            if (maBCDT == "")
            {
                maBCDT = BaoCaoDoanhThuBLL.AutoMABC();

                BaoCaoDoanhThu baoCao = new BaoCaoDoanhThu();
                baoCao.MaBaoCaoDoanhThu = maBCDT;
                baoCao.Thang            = phieuThuTien.NgayThu.Month;
                baoCao.Nam = phieuThuTien.NgayThu.Year;

                BaoCaoDoanhThuBLL.ThemBC(baoCao);
            }

            ChiTietBaoCaoDoanhThu chiTiet = new ChiTietBaoCaoDoanhThu();

            chiTiet.MaBC   = maBCDT;
            chiTiet.MaCTBC = ChiTietBaoCaoDoanhThuBLL.GetMaCTBC(maBCDT, hieuXe);
            chiTiet.HieuXe = hieuXe;

            if (chiTiet.MaCTBC == "")
            {
                chiTiet.MaCTBC = ChiTietBaoCaoDoanhThuBLL.AutoMACTBC();
                ChiTietBaoCaoDoanhThuBLL.ThemCTBC(chiTiet);
            }

            ChiTietBaoCaoDoanhThuBLL.CapNhatBaoCao(chiTiet, phieuThuTien.SoTienThu);
        }
Ejemplo n.º 2
0
        public static void CapNhatBaoCao(ChiTietBaoCaoDoanhThu chiTiet, decimal soTien)
        {
            ChiTietBaoCaoDoanhThuDAL.CapNhatBaoCao(chiTiet, soTien);
            DataTable dt = HieuXeBLL.GetHieuXe();

            foreach (DataRow row in dt.Rows)
            {
                ChiTietBaoCaoDoanhThu _chiTiet = new ChiTietBaoCaoDoanhThu();
                _chiTiet.MaBC   = chiTiet.MaBC;
                _chiTiet.HieuXe = row.ItemArray[0].ToString();
                _chiTiet.MaCTBC = ChiTietBaoCaoDoanhThuDAL.GetMaBCDT(_chiTiet.MaBC, _chiTiet.HieuXe);
                ChiTietBaoCaoDoanhThuDAL.CapNhatTiLe(_chiTiet);
            }
        }
Ejemplo n.º 3
0
        public static void CapNhatTiLe(ChiTietBaoCaoDoanhThu chiTiet)
        {
            DataAccessHelper db  = new DataAccessHelper();
            SqlCommand       cmd = db.Command("CAPNHATTILE");

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

            SqlDataAdapter da = new SqlDataAdapter(cmd);

            db.dt = new DataTable();
            da.Fill(db.dt);
        }
Ejemplo n.º 4
0
        public static void ThemCTBC(ChiTietBaoCaoDoanhThu chiTiet)
        {
            DataAccessHelper db  = new DataAccessHelper();
            SqlCommand       cmd = db.Command("THEMCT_BCDT");

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@MACTBC", chiTiet.MaCTBC);
            cmd.Parameters.AddWithValue("@MABC", chiTiet.MaBC);
            cmd.Parameters.AddWithValue("@HIEUXE", chiTiet.HieuXe);

            SqlDataAdapter da = new SqlDataAdapter(cmd);

            db.dt = new DataTable();
            da.Fill(db.dt);
        }
Ejemplo n.º 5
0
        public static void ThemBC(BaoCaoDoanhThu baoCao)
        {
            BaoCaoDoanhThuDAL.ThemBaoCao(baoCao);
            DataTable dt = HieuXeBLL.GetHieuXe();

            foreach (DataRow row in dt.Rows)
            {
                ChiTietBaoCaoDoanhThu chiTiet = new ChiTietBaoCaoDoanhThu();
                chiTiet.MaCTBC = ChiTietBaoCaoDoanhThuBLL.AutoMACTBC();
                chiTiet.MaBC   = baoCao.MaBaoCaoDoanhThu;
                chiTiet.HieuXe = row.ItemArray[0].ToString();

                ChiTietBaoCaoDoanhThuBLL.ThemCTBC(chiTiet);
            }
        }
Ejemplo n.º 6
0
        public static void ThemPhieuSuaChua(PhieuSuaChua psc)
        {
            PhieuSuaChuaDAL.ThemPhieuSuaChua(psc);

            string hieuXe = XeDAL.GetHieuXe(psc.BienSo);
            string maBCDT = BaoCaoDoanhThuBLL.GetMaBC(psc.NgaySuaChua.Month, psc.NgaySuaChua.Year);

            if (maBCDT == "")
            {
                maBCDT = BaoCaoDoanhThuBLL.AutoMABC();

                BaoCaoDoanhThu baoCao = new BaoCaoDoanhThu();
                baoCao.MaBaoCaoDoanhThu = maBCDT;
                baoCao.Thang            = psc.NgaySuaChua.Month;
                baoCao.Nam = psc.NgaySuaChua.Year;

                BaoCaoDoanhThuBLL.ThemBC(baoCao);
            }

            ChiTietBaoCaoDoanhThu chiTiet = new ChiTietBaoCaoDoanhThu();

            chiTiet.MaBC   = maBCDT;
            chiTiet.MaCTBC = ChiTietBaoCaoDoanhThuBLL.GetMaCTBC(maBCDT, hieuXe);

            if (chiTiet.MaCTBC == "")
            {
                chiTiet.MaCTBC = ChiTietBaoCaoDoanhThuBLL.AutoMACTBC();
                chiTiet.HieuXe = hieuXe;
                ChiTietBaoCaoDoanhThuBLL.ThemCTBC(chiTiet);
            }

            ChiTietBaoCaoDoanhThuBLL.CapNhatSoLuotSua(chiTiet);

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

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

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

                BaoCaoTonBLL.ThemBC(BCT);
            }
        }
Ejemplo n.º 7
0
 public static void CapNhatSoLuotSua(ChiTietBaoCaoDoanhThu chiTiet)
 {
     ChiTietBaoCaoDoanhThuDAL.CapNhatSoLuotSua(chiTiet);
 }
Ejemplo n.º 8
0
 public static void ThemCTBC(ChiTietBaoCaoDoanhThu chiTiet)
 {
     ChiTietBaoCaoDoanhThuDAL.ThemCTBC(chiTiet);
 }