Exemplo n.º 1
0
        public async Task <ActionResult <BaseResponse> > Get()
        {
            List <BookReport> list = new List <BookReport>();
            var books = await _context.BOOKS.ToListAsync();

            for (int i = 1; i < books.Count; i++)
            {
                int totalAmount = 0;
                var input       = await _context.INPUTS.Where(x => x.bookId == books[i].id).ToListAsync();

                for (int j = 0; j < input.Count; j++)
                {
                    totalAmount += input[j].amount;
                }
                BookReport report = new BookReport();
                report.name            = books[i].name;
                report.nowStock        = books[i].stock;
                report.oldStock        = books[i].stock - totalAmount;
                report.additionalStock = totalAmount;
                list.Add(report);
            }
            return(new BaseResponse
            {
                ErrorCode = Roles.Success,
                Message = "Completed create report!",
                Data = list
            });
        }
Exemplo n.º 2
0
        public BookReportViewerForm()
        {
            InitializeComponent();
            filterSortSlidePanel.IsOpen = false;

            SQLSelectCommandModel command = new SQLSelectCommandModel();

            command.Table   = "Book";
            command.Columns = "*";

            DataSet   dataSet = new DataSet();
            DataTable table   = SQLCommandController.SelectFrom(command, "Book");

            dataSet.Tables.Add(table);

            BookReport report = new BookReport();

            report.SetDataSource(dataSet);
            crystalReportViewer.ReportSource = report;
        }