예제 #1
0
        public ActionResult RdlcReportSaleClosing(string companyId, string branchId, string dateFrom, string dateTo, string salePersonId)
        {
            try
            {
                //if (branchId == "null")
                //{
                //    branchId = "";
                //}
                //if (dateFrom == "null")
                //{
                //    dateFrom = "";
                //}
                //if (dateTo == "null")
                //{
                //    dateTo = "";
                //}
                //if (salePersonId == "null")
                //{
                //    salePersonId = "";
                //}
                //if (!string.IsNullOrEmpty(dateFrom))
                //{
                //    DateTime? dfrom = Convert.ToDateTime(dateFrom);
                //    dfrom = new DateTime(dfrom.Value.Year, dfrom.Value.Month, dfrom.Value.Day, 0, 0, 0);
                //    dateFrom = dfrom.Value.ToString(CultureInfo.InvariantCulture);
                //}
                //if (!string.IsNullOrEmpty(dateTo))
                //{
                //    DateTime? dto = Convert.ToDateTime(dateTo);
                //    dto = new DateTime(dto.Value.Year, dto.Value.Month, dto.Value.Day, 23, 59, 59);
                //    dateTo = dto.Value.ToString(CultureInfo.InvariantCulture);
                //}
                //
                //if (!string.IsNullOrEmpty(companyId))
                //{
                //   dataSet = _rawSqlService.ReportGetAllSaleClosing(companyId, branchId, dateFrom, dateTo, salePersonId);
                //    //sales = Mapper.Map<IEnumerable<SuperShopSaleViewModel>>(_rawSqlService.GetAllSaleClosing(companyId, branchId, dateFrom, dateTo, salePersonId));
                //}

                var dataSet          = _rawSqlService.ReportGetAllSaleClosing(companyId, branchId, dateFrom, dateTo, salePersonId);
                ReportDataSource rpt = new ReportDataSource("Sale", dataSet.Tables[0]);
                RdlcReportViewerWithDate.reportDataSource = rpt;
                string rPath = "RdlcReport/RptSaleClosing.rdlc";
                Response.Redirect("~/ReportViewer/RdlcReportViewerWithDate.aspx?rPath=" + rPath + "&dfrom=" + dateFrom + "&dto=" + dateTo + "&companyId=" + companyId + "&branchId=" + branchId);
                return(View());
            }
            catch (Exception ex)
            {
                return(JavaScript($"ShowResult('{ex.Message}','failure')"));
            }
        }