Exemplo n.º 1
0
        public ActionResult JournalVoucherReport()
        {
            var viewmodel = new ReportFiltersViewModel();

            viewmodel.MonthlyReportRules         = _journalVoucherRuleService.GetAll();
            viewmodel.MonthlyImportExceptionRule = _monthlyImportExceptionRuleService.GetAll();
            return(View(viewmodel));
        }
Exemplo n.º 2
0
        public ActionResult JournalVoucherReport(ReportFiltersViewModel viewmodel)
        {
            if (ModelState.IsValid)
            {
                if (viewmodel.ExcelFile != null && viewmodel.ExcelFile.ContentLength > 0)
                {
                    SaveUploadedFile(viewmodel.ExcelFile, Server.MapPath("~/Uploads/WarrantReport/"));
                    viewmodel.MonthlyImportExceptionRule = _monthlyImportExceptionRuleService.GetAll();
                    MemoryStream stream = _journalVoucherReportUseCase.Execute(viewmodel.ExcelFile.InputStream,
                                                                               viewmodel.Date.Value.Year,
                                                                               viewmodel.MonthlyImportExceptionRule);

                    return(File(stream, Constants.ExcelFilesMimeType, string.Format(Constants.JournalVoucherReportExcelFileName, viewmodel.Date.Value.Year)));
                }
            }
            return(View(viewmodel));
        }
Exemplo n.º 3
0
        public ActionResult GenerateReportTest(ReportFiltersViewModel rep)
        {
            string SQL = "SELECT " +
                         "l.nome AS Localidade, " +
                         "i.patrimonio AS Patrimonio, " +
                         "c.nome AS Categoria, " +
                         "s.nome AS Status " +
                         "FROM " +
                         "localidade l INNER JOIN item i on l.id = i.localidade " +
                         "INNER JOIN item_categoria c ON c.id = i.categoria " +
                         "INNER JOIN item_status s ON s.id = i.status";


            string WHERE           = " ";
            bool   GotBeforeFilter = false;

            if (rep.LOC.ID > 0 || rep.ITEMCAT.ID > 0 || rep.STA.Id > 0)
            {
                WHERE += " WHERE ";

                if (rep.LOC.ID > 0)
                {
                    WHERE          += " l.id = " + rep.LOC.ID;
                    GotBeforeFilter = true;
                }

                if (rep.ITEMCAT.ID > 0)
                {
                    if (GotBeforeFilter)
                    {
                        WHERE += " AND ";
                    }

                    WHERE += " c.id = " + rep.ITEMCAT.ID;

                    GotBeforeFilter = true;
                }

                if (rep.STA.Id > 0)
                {
                    if (GotBeforeFilter)
                    {
                        WHERE += " AND ";
                    }

                    WHERE += " s.id = " + rep.STA.Id;
                }
            }


            string ORDER = " ORDER BY 1,3,4"; // implementar opção para o usuário escolher via DropDownList

            SQL += WHERE + ORDER;

            List <string> fields = new List <string>();

            fields.Add("Localidade");
            fields.Add("Patrimonio");
            fields.Add("Categoria");
            fields.Add("Status");

            Relatorio rel = new Relatorio(
                SQL,
                4,
                fields,
                "Itens",
                "Listagem de itens",
                ""
                );

            return(rel.GenerateReport());
        }