コード例 #1
0
        public ActionResult PhatHang(string fromDate, string toDate, string reportId, string postId, string employeeId, string type = ".pdf")
        {
            DateTime paserFromDate = DateTime.Now;
            DateTime paserToDate   = DateTime.Now;

            try
            {
                paserFromDate = DateTime.ParseExact(fromDate, "dd/MM/yyyy", null);
                paserToDate   = DateTime.ParseExact(toDate, "dd/MM/yyyy", null);
            }
            catch
            {
                paserFromDate = DateTime.Now;
                paserToDate   = DateTime.Now;
            }

            Dictionary <string, string> paramter = new Dictionary <string, string>();

            paramter.Add("@fDate", paserFromDate.ToString("yyyy-MM-dd"));
            paramter.Add("@tDate", paserToDate.ToString("yyyy-MM-dd"));


            string path = "~/Report/baocao/test.rpt";

            if (reportId == "reportphatchitiet")
            {
                paramter.Add("@postId", postId);
                paramter.Add("@employeeId", "%" + employeeId + "%");
                path = "~/Report/baocao/rpt_phathang_nhanvien_chitiet.rpt";
            }
            else if (reportId == "reportphatvanhan")
            {
                paramter.Add("@postId", postId);
                paramter.Add("@employeeId", "%" + employeeId + "%");
                path = "~/Report/baocao/rpt_sanluongphatvalayhang.rpt";
            }
            else if (reportId == "reportbcphatvanhan")
            {
                paramter.Add("@postId", "%" + postId + "%");
                path = "~/Report/baocao/rpt_baocaosanluongbuucuc.rpt";
            }

            Stream stream = rUtils.GetReportStreamFromDatabase(path, paramter, type);

            return(File(stream, rUtils.GetContentType(type), "report_phat_hang" + type));
        }
コード例 #2
0
        public ActionResult BaoCao(string fromDate, string toDate, string reportId, string groupId, string type = ".pdf")
        {
            DateTime paserFromDate = DateTime.Now;
            DateTime paserToDate   = DateTime.Now;

            try
            {
                paserFromDate = DateTime.ParseExact(fromDate, "dd/MM/yyyy", null);
                paserToDate   = DateTime.ParseExact(toDate, "dd/MM/yyyy", null);
            }
            catch
            {
                paserFromDate = DateTime.Now;
                paserToDate   = DateTime.Now;
            }

            Dictionary <string, string> paramter = new Dictionary <string, string>();

            paramter.Add("@fdate", paserFromDate.ToString("yyyy-MM-dd"));
            paramter.Add("@tdate", paserToDate.ToString("yyyy-MM-dd"));


            string path = "~/Report/baocao/test.rpt";

            if (reportId == "bcphat")
            {
                paramter.Add("@groupId", groupId);
                path = "~/Report/baocao/cus_baocaophat.rpt";
            }
            else
            if (reportId == "bchoan")
            {
                paramter.Add("@groupId", groupId);
                path = "~/Report/baocao/cus_baocaohoan.rpt";
            }

            Stream stream = rUtils.GetReportStreamFromDatabase(path, paramter, type);

            return(File(stream, rUtils.GetContentType(type), "report_phat_hang" + type));
        }