public ListResponse <MyRow> List(IDbConnection connection, StoreMoveListRequest request) { var user = (UserDefinition)Authorization.UserDefinition; int tn = user.TenantId; var data = connection.Query <MyRow>("usp_StoreMove", param: new { dateFrom = request.StartDate, dateTill = request.EndDate, shopid = 1, Tenant = tn }, commandType: CommandType.StoredProcedure); var response = new ListResponse <MyRow>(); response.Entities = (List <MyRow>)data; foreach (var item in response.Entities) { item.InitialQuantity = item.RestQuantity - item.IncomeQuantity + item.ExpenceQuantity; item.InitialValue = (item.RestValue - item.IncomeValue + item.ExpenceValue); if (item.InitialQuantity != 0) { item.InitialSinglePrice = item.InitialValue / item.InitialQuantity; } else { item.InitialSinglePrice = 0; } if (item.IncomeQuantity != 0) { item.IncomeSinglePrice = item.IncomeValue / item.IncomeQuantity; } else { item.IncomeSinglePrice = 0; } if (item.ExpenceQuantity != 0) { item.ExpenceSinglePrice = item.ExpenceValue / item.ExpenceQuantity; } else { item.ExpenceSinglePrice = 0; } if (item.RestQuantity != 0) { item.RestSinglePrice = item.RestValue / item.RestQuantity; } else { item.RestSinglePrice = 0; } } return(response); }
public FileContentResult ListExcel(IDbConnection connection, StoreMoveListRequest request) { var data = List(connection, request).Entities; var report = new DynamicDataReport(data, request.IncludeColumns, typeof(Columns.StoreMoveColumns)); var bytes = new ReportRepository().Render(report); return(ExcelContentResult.Create(bytes, "StoreMove_" + DateTime.Now.ToString("ddMMyyyy_HHmmss") + ".xlsx")); }
public ListResponse <MyRow> List(IDbConnection connection, StoreMoveListRequest request) { return(new MyRepository().List(connection, request)); }