Exemple #1
0
 public ActionResult ReportChartBank()
 {
     try
     {
         return(Json(DashboardBusinessLogic.getInstance().getReportChartBank(), JsonRequestBehavior.AllowGet));
     }
     catch (Exception e)
     {
         Logging.getInstance().CreateLogError(e);
         return(Json(e.Message, JsonRequestBehavior.AllowGet));
     }
 }
Exemple #2
0
 public ActionResult ReportOfAccount(DashboardViewModels model)
 {
     try
     {
         return(Json(DashboardBusinessLogic.getInstance().getReportOfAccount(model), JsonRequestBehavior.AllowGet));
     }
     catch (Exception e)
     {
         Logging.getInstance().CreateLogError(e);
         return(Json(e.Message, JsonRequestBehavior.AllowGet));
     }
 }
Exemple #3
0
        private void ExcelReportCashOut(DashboardViewModels model)
        {
            ExcelPackage   Package    = new ExcelPackage();
            ExcelWorksheet ws         = Package.Workbook.Worksheets.Add("Data");
            ExcelWorksheet wsComChart = Package.Workbook.Worksheets.Add("Chart");

            OfficeOpenXml.Style.ExcelBorderStyle DefaultBorder = OfficeOpenXml.Style.ExcelBorderStyle.Thin;
            Color colFromHex = System.Drawing.ColorTranslator.FromHtml("#00b0f0");

            ws.Cells["A1"].LoadFromText("Month");
            ws.Cells["A1"].Style.Font.SetFromFont(new Font("Cambria", 10));
            ws.Cells["A1"].Style.Font.Color.SetColor(Color.White);
            ws.Cells["A1"].Style.Font.Bold        = true;
            ws.Cells["A1"].Style.Fill.PatternType = ExcelFillStyle.Solid;
            ws.Cells["A1"].Style.Fill.BackgroundColor.SetColor(colFromHex);
            ws.Cells["A1"].Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
            ws.Cells["A1"].Style.VerticalAlignment   = OfficeOpenXml.Style.ExcelVerticalAlignment.Center;
            ws.Cells["A1"].Style.Border.Bottom.Style = DefaultBorder;
            ws.Cells["A1"].Style.Border.Left.Style   = DefaultBorder;
            ws.Cells["A1"].Style.Border.Top.Style    = DefaultBorder;
            ws.Cells["A1"].Style.Border.Right.Style  = DefaultBorder;

            ws.Cells["B1"].LoadFromText("Operation");
            ws.Cells["B1"].Style.Font.SetFromFont(new Font("Cambria", 10));
            ws.Cells["B1"].Style.Font.Color.SetColor(Color.White);
            ws.Cells["B1"].Style.Font.Bold        = true;
            ws.Cells["B1"].Style.Fill.PatternType = ExcelFillStyle.Solid;
            ws.Cells["B1"].Style.Fill.BackgroundColor.SetColor(colFromHex);
            ws.Cells["B1"].Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
            ws.Cells["B1"].Style.VerticalAlignment   = OfficeOpenXml.Style.ExcelVerticalAlignment.Center;
            ws.Cells["B1"].Style.Border.Bottom.Style = DefaultBorder;
            ws.Cells["B1"].Style.Border.Left.Style   = DefaultBorder;
            ws.Cells["B1"].Style.Border.Top.Style    = DefaultBorder;
            ws.Cells["B1"].Style.Border.Right.Style  = DefaultBorder;

            ws.Cells["C1"].LoadFromText("Accounting");
            ws.Cells["C1"].Style.Font.SetFromFont(new Font("Cambria", 10));
            ws.Cells["C1"].Style.Font.Color.SetColor(Color.White);
            ws.Cells["C1"].Style.Font.Bold        = true;
            ws.Cells["C1"].Style.Fill.PatternType = ExcelFillStyle.Solid;
            ws.Cells["C1"].Style.Fill.BackgroundColor.SetColor(colFromHex);
            ws.Cells["C1"].Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
            ws.Cells["C1"].Style.VerticalAlignment   = OfficeOpenXml.Style.ExcelVerticalAlignment.Center;
            ws.Cells["C1"].Style.Border.Bottom.Style = DefaultBorder;
            ws.Cells["C1"].Style.Border.Left.Style   = DefaultBorder;
            ws.Cells["C1"].Style.Border.Top.Style    = DefaultBorder;
            ws.Cells["C1"].Style.Border.Right.Style  = DefaultBorder;

            int idx  = 1;
            var list = DashboardBusinessLogic.getInstance().getReportOfAccountCashIn(model);

            foreach (var item in list)
            {
                idx++;
                ws.Cells["A" + idx.ToString()].LoadFromText(item.Month);
                ws.Cells["A" + idx.ToString()].Style.Font.SetFromFont(new Font("Cambria", 10));
                ws.Cells["A" + idx.ToString()].Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
                ws.Cells["A" + idx.ToString()].Style.VerticalAlignment   = OfficeOpenXml.Style.ExcelVerticalAlignment.Center;
                ws.Cells["A" + idx.ToString()].Style.Border.Bottom.Style = DefaultBorder;
                ws.Cells["A" + idx.ToString()].Style.Border.Left.Style   = DefaultBorder;
                ws.Cells["A" + idx.ToString()].Style.Border.Top.Style    = DefaultBorder;
                ws.Cells["A" + idx.ToString()].Style.Border.Right.Style  = DefaultBorder;

                ws.Cells["B" + idx.ToString()].LoadFromText((Convert.ToDecimal(item.Accounting)).ToString());
                ws.Cells["B" + idx.ToString()].Style.Numberformat.Format = "#,##";
                ws.Cells["B" + idx.ToString()].Style.Font.SetFromFont(new Font("Cambria", 10));
                ws.Cells["B" + idx.ToString()].Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
                ws.Cells["B" + idx.ToString()].Style.VerticalAlignment   = OfficeOpenXml.Style.ExcelVerticalAlignment.Center;
                ws.Cells["B" + idx.ToString()].Style.Border.Bottom.Style = DefaultBorder;
                ws.Cells["B" + idx.ToString()].Style.Border.Left.Style   = DefaultBorder;
                ws.Cells["B" + idx.ToString()].Style.Border.Top.Style    = DefaultBorder;
                ws.Cells["B" + idx.ToString()].Style.Border.Right.Style  = DefaultBorder;

                ws.Cells["C" + idx.ToString()].LoadFromText((Convert.ToDecimal(item.Operation)).ToString());
                ws.Cells["C" + idx.ToString()].Style.Numberformat.Format = "#,##";
                ws.Cells["C" + idx.ToString()].Style.Font.SetFromFont(new Font("Cambria", 10));
                ws.Cells["C" + idx.ToString()].Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
                ws.Cells["C" + idx.ToString()].Style.VerticalAlignment   = OfficeOpenXml.Style.ExcelVerticalAlignment.Center;
                ws.Cells["C" + idx.ToString()].Style.Border.Bottom.Style = DefaultBorder;
                ws.Cells["C" + idx.ToString()].Style.Border.Left.Style   = DefaultBorder;
                ws.Cells["C" + idx.ToString()].Style.Border.Top.Style    = DefaultBorder;
                ws.Cells["C" + idx.ToString()].Style.Border.Right.Style  = DefaultBorder;
            }

            List <DataSerie> SeriesList = new List <DataSerie>();

            SeriesList.Add(new DataSerie()
            {
                name = "Month", Series = ws.Cells["A" + (idx - 1) + ":A" + idx], xSeries = ws.Cells["B" + (idx - 1) + ":C" + idx]
            });
            SeriesList.Add(new DataSerie()
            {
                name = "Accounting", Series = ws.Cells["B" + (idx - 1) + ":B" + idx], xSeries = ws.Cells["B" + (idx - 1) + ":C" + idx]
            });
            SeriesList.Add(new DataSerie()
            {
                name = "Operation", Series = ws.Cells["C" + (idx - 1) + ":C" + idx], xSeries = ws.Cells["B" + (idx - 1) + ":C" + idx]
            });

            ExcelChart chart = AddBarChart(wsComChart, "ReportOfAccountCashOut", OfficeOpenXml.Drawing.Chart.eChartType.ColumnClustered, SeriesList);

            chart.Title.Text = "Report Of Account Cash Out";
            chart.SetPosition(0, 0, 0, 0);
            chart.SetSize(BarOptions.width, BarOptions.Height);

            Response.Clear();
            Response.Buffer      = true;
            Response.Charset     = "";
            Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
            Response.AddHeader("content-disposition", "attachment;filename=ReportOfAccountCashOut_" + DateTime.Now.ToString("ddMMyyyyhhmmss") + ".xlsx");
            Response.BinaryWrite(Package.GetAsByteArray());
            Response.End();
        }