GetReport

This commit is contained in:
Илья Федотов 2024-06-02 09:03:59 +04:00
parent 716b25c3b1
commit 06c59932ca
5 changed files with 21 additions and 7 deletions

View File

@ -15,6 +15,6 @@ namespace ElectronicsShopContracts.ViewModels
public int OrderID { get; set; } public int OrderID { get; set; }
public double SumPayment { get; set; } public double SumPayment { get; set; }
public PaymeantOption PayOption { get; set; } = PaymeantOption.Неоплачено; public PaymeantOption PayOption { get; set; }
} }
} }

View File

@ -13,6 +13,7 @@ namespace ElectronicsShopDataModels.Models
int OrderID { get; } int OrderID { get; }
double SumPayment { get; } double SumPayment { get; }
PaymeantOption PayOption { get; } PaymeantOption PayOption { get; }
DateTime DatePaymeant { get; }
int ClientID { get; } int ClientID { get; }
} }
} }

View File

@ -14,11 +14,13 @@ namespace ElectronicsShopRestAPI.Controllers {
private readonly ILogger _logger; private readonly ILogger _logger;
private readonly IClientLogic _logic; private readonly IClientLogic _logic;
private readonly IPaymeantLogic _payLogic; private readonly IPaymeantLogic _payLogic;
private readonly IReportClientLogic _reportLogic;
public ClientController(ILogger<ClientController> logger, IClientLogic logic, IPaymeantLogic payLogic) { public ClientController(ILogger<ClientController> logger, IClientLogic logic, IPaymeantLogic payLogic, IReportClientLogic reportlogic) {
_logger = logger; _logger = logger;
_logic = logic; _logic = logic;
_payLogic = payLogic; _payLogic = payLogic;
_reportLogic = reportlogic;
} }
[HttpGet] [HttpGet]
@ -76,5 +78,10 @@ namespace ElectronicsShopRestAPI.Controllers {
throw; throw;
} }
} }
[HttpPost]
public List<ReportPaymeantsViewModel>? GetReport(DateTime _start, DateTime _end) {
var dataSource = _reportLogic.GetPaymeants(new ReportBindingModel { });
return dataSource;
}
} }
} }

View File

@ -292,5 +292,11 @@ namespace ElectronicsShopUserApp.Controllers {
var _product = APIClient.GetRequset<ProductViewModel>($"api/main/getproduct?_productid={product}"); var _product = APIClient.GetRequset<ProductViewModel>($"api/main/getproduct?_productid={product}");
return count * (_product?.Price ?? 1); return count * (_product?.Price ?? 1);
} }
[HttpGet]
public IActionResult ReportMake(DateTime startDate, DateTime endDate) {
var _report = APIClient.GetRequset<List<ReportPaymeantsViewModel>>($"api/main/getreport?_start={startDate}&_end={endDate}");
return View(_report);
}
} }
} }

View File

@ -20,13 +20,13 @@
</div> </div>
<div> <div>
<th> <th>
<input type="submit" name="getReportword" class="btn btn-primary" value="Сформировать отчет WORD" /> <a class="btn btn-primary btn-sm" asp-action="ReportMake">Сформировать</a>
</th> </th>
<th> <th>
<input type="submit" name="getReportexcel" class="btn btn-primary" value="Сформировать отчет EXCEL" />
</th> </th>
<th> <th>
<input type="submit" name="sendToMail" class="btn btn-primary" value="Отправить на почту" />
</th> </th>
</div> </div>
</div> </div>