From d805eb712c0f75c78d2dc0ac410ac06dcd898946 Mon Sep 17 00:00:00 2001 From: kenny-tinoco Date: Tue, 2 Jul 2024 20:52:43 -0600 Subject: [PATCH] Refactor: Refactor PrintInvoiceView.razor file. --- .gitignore | 8 +- Academy/AcademyProfiles.razor | 3 +- Accounting/AlertService.cs | 8 +- .../PrintInvoiceView.razor} | 319 ++++++++---------- .../PrintInvoiceView.razor.cs | 41 +++ .../TariffCollectionView.razor.cs | 6 +- Accounting/TarrifArreas.razor | 8 +- Controllers/AcademyController.cs | 7 +- Controllers/TariffCollectionController.cs | 42 ++- Controllers/URL.cs | 12 +- Program.cs | 3 +- dto/Input/InvoiceDto.cs | 46 --- dto/{Input => input}/EntityMaker.cs | 6 +- dto/input/InvoiceDto.cs | 38 +++ dto/{Input => input}/PaymentDto.cs | 50 +-- dto/{Input/Tariff.cs => input/TariffDto.cs} | 74 ++-- dto/{Input => input}/TariffModal.cs | 4 +- dto/{Input => input}/TransactionDto.cs | 56 +-- dto/{Input => input}/TransactionsStudents.cs | 47 ++- model/accounting/CashierEntity.cs | 4 +- 20 files changed, 372 insertions(+), 410 deletions(-) rename Accounting/{TarriffInvoice.razor => TariffCollection/PrintInvoiceView.razor} (65%) create mode 100644 Accounting/TariffCollection/PrintInvoiceView.razor.cs delete mode 100644 dto/Input/InvoiceDto.cs rename dto/{Input => input}/EntityMaker.cs (85%) create mode 100644 dto/input/InvoiceDto.cs rename dto/{Input => input}/PaymentDto.cs (95%) rename dto/{Input/Tariff.cs => input/TariffDto.cs} (51%) rename dto/{Input => input}/TariffModal.cs (87%) rename dto/{Input => input}/TransactionDto.cs (89%) rename dto/{Input => input}/TransactionsStudents.cs (83%) diff --git a/.gitignore b/.gitignore index e993674..382124f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,9 @@ # Directorys ignores +.vs/ +.idea/ .vscode/ -bin/ + obj/ -Properties/ \ No newline at end of file +bin/ + +**/*.user \ No newline at end of file diff --git a/Academy/AcademyProfiles.razor b/Academy/AcademyProfiles.razor index 4e878d3..3cf9d1d 100644 --- a/Academy/AcademyProfiles.razor +++ b/Academy/AcademyProfiles.razor @@ -1,5 +1,6 @@ @page "/academy/tariff-profiles" -@using wsmcbl.front.Controllers.AcademyController + +@using wsmcbl.front.Controllers @using wsmcbl.front.Models.Secretary.Input @inject AcademyController controller; diff --git a/Accounting/AlertService.cs b/Accounting/AlertService.cs index 32c4f5e..04f108c 100644 --- a/Accounting/AlertService.cs +++ b/Accounting/AlertService.cs @@ -13,16 +13,16 @@ public AlertService(SweetAlertService service) public async Task AlertSuccess(string title, string text) { - await service.FireAsync(new SweetAlertOptions{ Title = title, Icon = SweetAlertIcon.Success}); + await service.FireAsync(new SweetAlertOptions{ Title = title, Text = text, Icon = SweetAlertIcon.Success}); } public async Task AlertError(string title, string text) { - await service.FireAsync(new SweetAlertOptions{ Title = title, Icon = SweetAlertIcon.Error}); + await service.FireAsync(new SweetAlertOptions{ Title = title, Text = text, Icon = SweetAlertIcon.Error}); } - public async Task AlertWarning(string title) + public async Task AlertWarning(string title) { - return await service.FireAsync(new SweetAlertOptions{Title = title, Icon = SweetAlertIcon.Warning, ShowCancelButton = true }); + await service.FireAsync(new SweetAlertOptions{Title = title, Icon = SweetAlertIcon.Warning, ShowCancelButton = true }); } } \ No newline at end of file diff --git a/Accounting/TarriffInvoice.razor b/Accounting/TariffCollection/PrintInvoiceView.razor similarity index 65% rename from Accounting/TarriffInvoice.razor rename to Accounting/TariffCollection/PrintInvoiceView.razor index 3f770cb..fc03c30 100644 --- a/Accounting/TarriffInvoice.razor +++ b/Accounting/TariffCollection/PrintInvoiceView.razor @@ -1,185 +1,134 @@ -@page "/transactions/invoices/{transactionId}" -@layout EmptyLayout -@using wsmcbl.front.Models.Accounting -@using wsmcbl.front.Controllers -@inject NavigationManager navigationManager -@inject TariffCollectionController tariffcontroller -@inject SweetAlertService Swal; - - - - - -@if (errorMessage != null) -{ -
@errorMessage
- Ir a la página principal -} -else if (invoice == null) -{ -

Cargando...

-} -else -{ -
-
Colegio Bautista Libertad
-

Entrada Norte C.C.Managua, 1c. E. 1c S. 1/2c-E.

-

Telefono: 22705587

- -

Recibo de Caja

-
- -
-
-

-
-
-

@invoice.TransactionId

-
-
- -
-
-

Cod. Estu

-
-
-

@invoice.StudentId

-
-
- -
-
-

Fecha

-
-
-

@invoice.DateTime.ToString("dd-MM-yyyy")

-
-
- -
-
-

Cajero

-
-
-

@invoice.CashierName

-
-
- -

A nombre de:

-

@invoice.StudentName

- -
DETALLE
- - - - - - - - - - @foreach (var item in invoice.Tariffs) - { - - - - - } - -
ConceptoMonto
@item.Concept @item.Amount
-
- - -
-
-

T. Bruto:

-
-
-

C$ @invoice.Subtotal

-
-
-
- -
-
-

T Neto:

-
-
-

C$ @invoice.Total

-
-
-
-
- -
-
-
-

Cliente

-
-
-
-

Administrador

-
-
-
- -
-
-
-

Balance General

-
-
-

C$ @balanceGeneral

-
-
-

NO ES VALIDO SIN FIRMA NI SELLO DEL CAJERO

-
- -} - - -@code -{ - InvoiceDto? invoice; - private bool showError; - private string? errorMessage; - private float balanceGeneral; - - [Parameter] - public string? transactionId {get; set; } - - - protected override async Task OnInitializedAsync() - { - var segments = navigationManager.ToAbsoluteUri(navigationManager.Uri).Segments; - transactionId = segments.Last().Trim('/'); - - try - { - invoice = await tariffcontroller.GetInvoice(transactionId); - - balanceGeneral = 0; - balanceGeneral = invoice!.GeneralBalance[1] - invoice.GeneralBalance[0]; - } - catch (Exception ex) - { - errorMessage = ex.Message; - showError = true; - } - } - - protected override async Task OnAfterRenderAsync(bool firstRender) - { - if (showError) - { - showError = false; // Resetear la bandera para no mostrar el error múltiples veces. - await Swal.FireAsync(new SweetAlertOptions - { - Title = "Obtuvimos unos problemas", - Text = errorMessage, - Icon = SweetAlertIcon.Error - }); - } - } - -} +@page "/transactions/invoices/{transactionId}" + +@inherits PrintInvoice; +@layout EmptyLayout + + + + +@if (errorMessage != null) +{ +
@errorMessage
+ Ir a la página principal +} +else if (invoice == null) +{ +

Cargando...

+} +else +{ +
+
Colegio Bautista Libertad
+

Entrada Norte C.C.Managua, 1c. E. 1c S. 1/2c-E.

+

Telefono: 22705587

+ +

Recibo de Caja

+
+ +
+
+

+
+
+

@invoice.TransactionId

+
+
+ +
+
+

Cod. Estu

+
+
+

@invoice.StudentId

+
+
+ +
+
+

Fecha

+
+
+

@invoice.DateTime.ToString("dd-MM-yyyy")

+
+
+ +
+
+

Cajero

+
+
+

@invoice.CashierName

+
+
+ +

A nombre de:

+

@invoice.StudentName

+ +
DETALLE
+ + + + + + + + + + @foreach (var item in invoice.detail) + { + + + + + } + +
ConceptoMonto
@item.Concept @item.Amount
+
+ + +
+
+

T. Bruto:

+
+
+

C$ @invoice.Subtotal

+
+
+
+ +
+
+

T Neto:

+
+
+

C$ @invoice.Total

+
+
+
+
+ +
+
+
+

Cliente

+
+
+
+

Administrador

+
+
+
+ +
+
+
+

Balance General

+
+
+

C$ @invoice.getGeneralBalance()

+
+
+

NO ES VALIDO SIN FIRMA NI SELLO DEL CAJERO

+
+ +} \ No newline at end of file diff --git a/Accounting/TariffCollection/PrintInvoiceView.razor.cs b/Accounting/TariffCollection/PrintInvoiceView.razor.cs new file mode 100644 index 0000000..b23d8af --- /dev/null +++ b/Accounting/TariffCollection/PrintInvoiceView.razor.cs @@ -0,0 +1,41 @@ +using Microsoft.AspNetCore.Components; +using wsmcbl.front.Controllers; +using wsmcbl.front.dto.input; + +namespace wsmcbl.front.Accounting.TariffCollection; + +public class PrintInvoice : ComponentBase +{ + [Inject] protected TariffCollectionController controller { get; set; } = null!; + [Inject] protected AlertService alertService { get; set; } = null!; + + protected InvoiceDto? invoice { get; set; } + protected string? errorMessage { get; set; } + + [Parameter] public string? transactionId { get; set; } + + protected override async Task OnParametersSetAsync() + { + try + { + if (string.IsNullOrEmpty(transactionId)) + { + throw new Exception("Transaction ID is not valid"); + } + + invoice = await controller.GetInvoice(transactionId); + } + catch(Exception e) + { + errorMessage = e.Message; + } + } + + protected override async Task OnAfterRenderAsync(bool firstRender) + { + if (firstRender && errorMessage != null) + { + await alertService.AlertError("Obtuvimos unos problemas",errorMessage); + } + } +} \ No newline at end of file diff --git a/Accounting/TariffCollection/TariffCollectionView.razor.cs b/Accounting/TariffCollection/TariffCollectionView.razor.cs index a0828db..9217a28 100644 --- a/Accounting/TariffCollection/TariffCollectionView.razor.cs +++ b/Accounting/TariffCollection/TariffCollectionView.razor.cs @@ -1,7 +1,7 @@ using Microsoft.AspNetCore.Components; using Microsoft.JSInterop; using wsmcbl.front.Controllers; -using wsmcbl.front.dto.Input; +using wsmcbl.front.dto.input; using wsmcbl.front.model.accounting; namespace wsmcbl.front.Accounting.TariffCollection; @@ -24,7 +24,7 @@ public class TariffCollection : ComponentBase private bool areArrearsApply { get; set; } = true; - protected List? tariffList { get; set; } + protected List? tariffList { get; set; } private List? tariffModalList { get; set; } protected List? tariffsToPay { get; set; } @@ -90,7 +90,7 @@ private async Task LoadStudent() controller.setStudent(student); } - protected void OnSelectItemChanged(ChangeEventArgs e, Tariff tariff) + protected void OnSelectItemChanged(ChangeEventArgs e, TariffDto tariff) { if(e.Value == null) return; diff --git a/Accounting/TarrifArreas.razor b/Accounting/TarrifArreas.razor index 8a1bf7c..998bf71 100644 --- a/Accounting/TarrifArreas.razor +++ b/Accounting/TarrifArreas.razor @@ -1,6 +1,6 @@ @page "/accouting/arreas" @using wsmcbl.front.Controllers -@using wsmcbl.front.dto.Input +@using wsmcbl.front.dto.input @inject TariffCollectionController tariffcontroller @inject SweetAlertService Swal @@ -62,12 +62,12 @@ else @code { @* Lista o tariffa a aplicar mora *@ - public List selectedTariffs = new List(); + public List selectedTariffs = new List(); public int applyArreas; @* Lista de tarifas obtenido de la API *@ - List tariffs = null!; + List tariffs = null!; protected override async Task OnInitializedAsync() @@ -76,7 +76,7 @@ else tariffs = await tariffcontroller.GetTariffs("student", "2019.1000.jarr"); } - private void OnSelectItemChanged(ChangeEventArgs e, Tariff tariff) + private void OnSelectItemChanged(ChangeEventArgs e, TariffDto tariff) { if ((bool)e.Value) { diff --git a/Controllers/AcademyController.cs b/Controllers/AcademyController.cs index be6efb8..a763175 100644 --- a/Controllers/AcademyController.cs +++ b/Controllers/AcademyController.cs @@ -1,9 +1,6 @@ -namespace wsmcbl.front.Controllers.AcademyController; - - using wsmcbl.front.Models.Secretary.Input; -using wsmcbl.front.Controllers; +namespace wsmcbl.front.Controllers; public class AcademyController(HttpClient httpClient) { @@ -11,7 +8,7 @@ public class AcademyController(HttpClient httpClient) public async Task?> GetStudents() { - var response = await _httpClient.GetAsync(URL.SECRETARY + "students"); + var response = await _httpClient.GetAsync(URL.secretary + "students"); if (response.IsSuccessStatusCode is false) { diff --git a/Controllers/TariffCollectionController.cs b/Controllers/TariffCollectionController.cs index 46c2abe..c9e89e5 100644 --- a/Controllers/TariffCollectionController.cs +++ b/Controllers/TariffCollectionController.cs @@ -1,12 +1,9 @@ -using wsmcbl.front.Accounting; -using wsmcbl.front.dto.Input; +using System.Text.Json; +using wsmcbl.front.dto.input; using wsmcbl.front.model.accounting; namespace wsmcbl.front.Controllers; -using System.Text.Json; -using wsmcbl.front.Models.Accounting; - public class TariffCollectionController { private readonly HttpClient _httpClient; @@ -16,26 +13,22 @@ public TariffCollectionController(HttpClient httpClient) cashier = new CashierEntity("caj-ktinoco"); } - public async Task> GetTariffs(string key, string value) + public async Task> GetTariffs(string key, string value) { - // Realizar solicitud HTTP GET a la API - var response = await _httpClient.GetAsync($"{URL.ACCOUNTING}tariffs/search?q={key}:{value}"); + var response = await _httpClient.GetAsync($"{URL.accounting}tariffs/search?q={key}:{value}"); - // Verificar si la solicitud fue exitosa if (response.IsSuccessStatusCode) { - // Deserializar la respuesta JSON en una lista de StudentEntity - return await response.Content.ReadFromJsonAsync>(); - } - else - { - // Manejar el error si la solicitud no fue exitosa - throw new Exception($"Error al obtener los datos de la API: {response.ReasonPhrase}"); + return await response.Content.ReadFromJsonAsync>(); } + + throw new Exception($"Error al obtener los datos de la API: {response.ReasonPhrase}"); + } + public async Task SendPay() { - var url = URL.ACCOUNTING + "transactions"; + var url = URL.accounting + "transactions"; var json = JsonSerializer.Serialize(cashier.getTransaction); @@ -54,6 +47,7 @@ public async Task SendPay() JsonElement root = doc.RootElement; return root.GetProperty("transactionId").GetString()!; } + public async Task GetInvoice(string transactionId) { var invoices = await _httpClient.GetAsync(URL.TRANSACTION+transactionId); @@ -65,10 +59,11 @@ public async Task SendPay() return await invoices.Content.ReadFromJsonAsync(); } + public async Task ActiveArrears(int idtarrif) { var url = URL.APPLYARREARS+idtarrif; - var content = new StringContent(string.Empty); // Crear un contenido vacío + var content = new StringContent(string.Empty); var response = await _httpClient.PutAsync(url, content); @@ -77,13 +72,12 @@ public async Task ActiveArrears(int idtarrif) throw new Exception($"Error al obtener los datos de la API: {response.ReasonPhrase}"); } - bool success = true; - - return success; + return true; } + public async Task?> getStudentList() { - var response = await _httpClient.GetAsync(URL.ACCOUNTING+"students"); + var response = await _httpClient.GetAsync(URL.accounting+"students"); if (response.IsSuccessStatusCode is false) { @@ -92,9 +86,10 @@ public async Task ActiveArrears(int idtarrif) return await response.Content.ReadFromJsonAsync>(); } + public async Task GetStudent(string studentId) { - var response = await _httpClient.GetAsync(URL.ACCOUNTING + $"students/{studentId}"); + var response = await _httpClient.GetAsync(URL.accounting + $"students/{studentId}"); if (response.IsSuccessStatusCode) { @@ -104,6 +99,7 @@ public async Task GetStudent(string studentId) throw new Exception($"Error al obtener el estudiante con ID {studentId}"); } + private CashierEntity cashier; public void addDetail(List tariffs, bool isApplyArrear) diff --git a/Controllers/URL.cs b/Controllers/URL.cs index bed4c05..1fcdbaa 100644 --- a/Controllers/URL.cs +++ b/Controllers/URL.cs @@ -2,11 +2,11 @@ public static class URL { - private static readonly string API_URL = "http://wsmcbl-api.somee.com/v1/"; - - public static string SECRETARY = $"{API_URL}secretary/"; + private static readonly string api = "http://wsmcbl-api.somee.com/v1"; + + public static readonly string secretary = $"{api}/secretary/"; + public static readonly string accounting = $"{api}/accounting/"; - public static string ACCOUNTING = $"{API_URL}accounting/"; - public static string TRANSACTION = $"{ACCOUNTING}transactions/invoices/"; - public static string APPLYARREARS = $"{API_URL}accounting/arrears/"; + public static string TRANSACTION = $"{accounting}transactions/invoices/"; + public static string APPLYARREARS = $"{api}accounting/arrears/"; } \ No newline at end of file diff --git a/Program.cs b/Program.cs index ac588cf..b0a5288 100644 --- a/Program.cs +++ b/Program.cs @@ -1,7 +1,6 @@ +using wsmcbl.front.Accounting; using wsmcbl.front.Controllers; using CurrieTechnologies.Razor.SweetAlert2; -using wsmcbl.front.Accounting; -using wsmcbl.front.Controllers.AcademyController; var builder = WebApplication.CreateBuilder(args); diff --git a/dto/Input/InvoiceDto.cs b/dto/Input/InvoiceDto.cs deleted file mode 100644 index 63daa76..0000000 --- a/dto/Input/InvoiceDto.cs +++ /dev/null @@ -1,46 +0,0 @@ -using wsmcbl.front.Models.Accounting.Input; - -namespace wsmcbl.front.Models.Accounting; -using Newtonsoft.Json; - -public class InvoiceDto -{ - [JsonProperty("transactionId")] - public string TransactionId { get; set; } = null!; - - [JsonProperty("cashierName")] - public string CashierName { get; set; } = null!; - - [JsonProperty("studentId")] - public string StudentId { get; set; } = null!; - - [JsonProperty("studentName")] - public string StudentName { get; set; } = null!; - - [JsonProperty("total")] - public double Total { get; set; } - - [JsonProperty("dateTime")] - public DateTime DateTime { get; set; } - - [JsonProperty("subtotal")] - public double Subtotal { get; set; } - - [JsonProperty("generalBalance")] - public float[] GeneralBalance { get; set; } - - [JsonProperty("tariffs")] - public List Tariffs { get; set; } = null!; - - public InvoiceDto(string transactionId, string cashierName, string studentId, string studentName, double total, DateTime dateTime, List tariffs) - { - TransactionId = transactionId; - CashierName = cashierName; - StudentId = studentId; - StudentName = studentName; - Subtotal = tariffs.Sum(tariff => tariff.Amount); - DateTime = dateTime; - Tariffs = tariffs; - Total = total; - } -} \ No newline at end of file diff --git a/dto/Input/EntityMaker.cs b/dto/input/EntityMaker.cs similarity index 85% rename from dto/Input/EntityMaker.cs rename to dto/input/EntityMaker.cs index a40fbf1..4f9b27c 100644 --- a/dto/Input/EntityMaker.cs +++ b/dto/input/EntityMaker.cs @@ -1,10 +1,10 @@ using wsmcbl.front.model.accounting; -namespace wsmcbl.front.dto.Input; +namespace wsmcbl.front.dto.input; public static class EntityMaker { - private static TariffModal ToModalItem(this Tariff tariff, StudentEntity student) + private static TariffModal ToModalItem(this TariffDto tariff, StudentEntity student) { var tariffModal = new TariffModal { @@ -27,7 +27,7 @@ private static TariffModal ToModalItem(this Tariff tariff, StudentEntity student return tariffModal; } - public static List ToModalList(this IEnumerable list, StudentEntity student) + public static List ToModalList(this IEnumerable list, StudentEntity student) { var listResult = new List(); listResult.AddRange(list.Select(item => item.ToModalItem(student))); diff --git a/dto/input/InvoiceDto.cs b/dto/input/InvoiceDto.cs new file mode 100644 index 0000000..6284cb7 --- /dev/null +++ b/dto/input/InvoiceDto.cs @@ -0,0 +1,38 @@ +using Newtonsoft.Json; + +namespace wsmcbl.front.dto.input; + +public class InvoiceDto +{ + [JsonProperty("transactionId")] + public string TransactionId { get; set; } = null!; + + [JsonProperty("cashierName")] + public string CashierName { get; set; } = null!; + + [JsonProperty("studentId")] + public string StudentId { get; set; } = null!; + + [JsonProperty("studentName")] + public string StudentName { get; set; } = null!; + + [JsonProperty("total")] + public double Total { get; set; } + + [JsonProperty("dateTime")] + public DateTime DateTime { get; set; } + + [JsonProperty("subtotal")] + public double Subtotal { get; set; } + + [JsonProperty("generalBalance")] + public float[]? GeneralBalance { get; set; } + + [JsonProperty("detail")] + public List detail { get; set; } = null!; + + public float getGeneralBalance() + { + return GeneralBalance[1] - GeneralBalance[0]; + } +} \ No newline at end of file diff --git a/dto/Input/PaymentDto.cs b/dto/input/PaymentDto.cs similarity index 95% rename from dto/Input/PaymentDto.cs rename to dto/input/PaymentDto.cs index 8308c7a..6a6a786 100644 --- a/dto/Input/PaymentDto.cs +++ b/dto/input/PaymentDto.cs @@ -1,25 +1,25 @@ -namespace wsmcbl.front.Models.Accounting; -using Newtonsoft.Json; - -public class PaymentDto -{ - [JsonProperty("tariffId")] - public int TariffId { get; set; } - - [JsonProperty("concept")] - public string Concept { get; set; } = null!; - - [JsonProperty("amount")] - public double Amount { get; set; } - - [JsonProperty("discount")] - public double Discount { get; set; } - - [JsonProperty("arrears")] - public double Arrears { get; set; } - - [JsonProperty("debtBalance")] - public double DebtBalance { get; set; } - -} - +namespace wsmcbl.front.Models.Accounting; +using Newtonsoft.Json; + +public class PaymentDto +{ + [JsonProperty("tariffId")] + public int TariffId { get; set; } + + [JsonProperty("concept")] + public string Concept { get; set; } = null!; + + [JsonProperty("amount")] + public double Amount { get; set; } + + [JsonProperty("discount")] + public double Discount { get; set; } + + [JsonProperty("arrears")] + public double Arrears { get; set; } + + [JsonProperty("debtBalance")] + public double DebtBalance { get; set; } + +} + diff --git a/dto/Input/Tariff.cs b/dto/input/TariffDto.cs similarity index 51% rename from dto/Input/Tariff.cs rename to dto/input/TariffDto.cs index 65f8582..0aaea50 100644 --- a/dto/Input/Tariff.cs +++ b/dto/input/TariffDto.cs @@ -1,45 +1,29 @@ -namespace wsmcbl.front.dto.Input; -using Newtonsoft.Json; - - -public class Tariff -{ - [JsonProperty("tariffId")] - public int TariffId { get; set; } - - [JsonProperty("schoolYear")] - public string SchoolYear { get; set; } = null!; - - [JsonProperty("concept")] - public string Concept { get; set; } = null!; - - [JsonProperty("amount")] - public double Amount { get; set; } - - [JsonProperty("dueDate")] - public string DueDate { get; set; } - - [JsonProperty("isLate")] - public bool IsLate { get; set; } - - [JsonProperty("type")] - public int Type { get; set; } - - - public Tariff () : this(0,"","",0.0,"1999-01-01",false,0) - { - - } - - public Tariff(int tariffId, string schoolYear, string concept, double amount, string dueDate, bool isLate, int type) - { - TariffId = tariffId; - SchoolYear = schoolYear; - Concept= concept; - Amount = amount; - DueDate = dueDate; - IsLate = isLate; - Type = type; - } -} - +using Newtonsoft.Json; + +namespace wsmcbl.front.dto.input; + +public class TariffDto +{ + [JsonProperty("tariffId")] + public int TariffId { get; set; } + + [JsonProperty("schoolYear")] + public string SchoolYear { get; set; } = null!; + + [JsonProperty("concept")] + public string Concept { get; set; } = null!; + + [JsonProperty("amount")] + public double Amount { get; set; } + + [JsonProperty("dueDate")] + public string DueDate { get; set; } + + [JsonProperty("isLate")] + public bool IsLate { get; set; } + + [JsonProperty("type")] + public int Type { get; set; } + +} + diff --git a/dto/Input/TariffModal.cs b/dto/input/TariffModal.cs similarity index 87% rename from dto/Input/TariffModal.cs rename to dto/input/TariffModal.cs index d168399..bdc13fb 100644 --- a/dto/Input/TariffModal.cs +++ b/dto/input/TariffModal.cs @@ -1,6 +1,4 @@ -using Newtonsoft.Json; - -namespace wsmcbl.front.dto.Input; +namespace wsmcbl.front.dto.input; public class TariffModal { diff --git a/dto/Input/TransactionDto.cs b/dto/input/TransactionDto.cs similarity index 89% rename from dto/Input/TransactionDto.cs rename to dto/input/TransactionDto.cs index 0c07058..ad0190c 100644 --- a/dto/Input/TransactionDto.cs +++ b/dto/input/TransactionDto.cs @@ -1,28 +1,30 @@ -namespace wsmcbl.front.Models.Accounting.Input; -using Newtonsoft.Json; -public class TransactionDto -{ - [JsonProperty("tariffId")] - public int TariffId { get; set; } - - [JsonProperty("schoolYear")] - public string SchoolYear { get; set; } = null!; - - [JsonProperty("concept")] - public string Concept { get; set; } = null!; - - [JsonProperty("amount")] - public double Amount { get; set; } - - [JsonProperty("discount")] - public double Discount { get; set; } - - [JsonProperty("arrears")] - public double Arrears { get; set; } - - [JsonProperty("subTotal")] - public double SubTotal { get; set; } - - [JsonProperty("isPaidLate")] - public bool IsPaidLate { get; set; } +using Newtonsoft.Json; + +namespace wsmcbl.front.dto.input; + +public class TransactionDto +{ + [JsonProperty("tariffId")] + public int TariffId { get; set; } + + [JsonProperty("schoolYear")] + public string SchoolYear { get; set; } = null!; + + [JsonProperty("concept")] + public string Concept { get; set; } = null!; + + [JsonProperty("amount")] + public double Amount { get; set; } + + [JsonProperty("discount")] + public double Discount { get; set; } + + [JsonProperty("arrears")] + public double Arrears { get; set; } + + [JsonProperty("subTotal")] + public double SubTotal { get; set; } + + [JsonProperty("isPaidLate")] + public bool IsPaidLate { get; set; } } \ No newline at end of file diff --git a/dto/Input/TransactionsStudents.cs b/dto/input/TransactionsStudents.cs similarity index 83% rename from dto/Input/TransactionsStudents.cs rename to dto/input/TransactionsStudents.cs index 3f775d8..61f15be 100644 --- a/dto/Input/TransactionsStudents.cs +++ b/dto/input/TransactionsStudents.cs @@ -1,25 +1,24 @@ -using wsmcbl.front.Models.Accounting.Input; - -namespace wsmcbl.front.Models.Accounting; -using Newtonsoft.Json; - -public class TransactionsStudents -{ - [JsonProperty("transactionId")] - public string TransactionId { get; set; } = null!; - - [JsonProperty("studentId")] - public string StudentId { get; set; } = null!; - - [JsonProperty("cashierId")] - public string CashierId { get; set; } = null!; - - [JsonProperty("total")] - public double Total { get; set; } - - [JsonProperty("date")] - public DateTime Date { get; set; } - - [JsonProperty("details")] - public List Details { get; set; } = null!; +using Newtonsoft.Json; + +namespace wsmcbl.front.dto.input; + +public class TransactionsStudents +{ + [JsonProperty("transactionId")] + public string TransactionId { get; set; } = null!; + + [JsonProperty("studentId")] + public string StudentId { get; set; } = null!; + + [JsonProperty("cashierId")] + public string CashierId { get; set; } = null!; + + [JsonProperty("total")] + public double Total { get; set; } + + [JsonProperty("date")] + public DateTime Date { get; set; } + + [JsonProperty("details")] + public List Details { get; set; } = null!; } \ No newline at end of file diff --git a/model/accounting/CashierEntity.cs b/model/accounting/CashierEntity.cs index d967367..a73ad66 100644 --- a/model/accounting/CashierEntity.cs +++ b/model/accounting/CashierEntity.cs @@ -1,6 +1,6 @@ -using wsmcbl.front.dto.Input; -using wsmcbl.front.Models.Accounting; +using wsmcbl.front.dto.input; using wsmcbl.front.Models.Accounting.Output; +using TransactionDto = wsmcbl.front.Models.Accounting.Output.TransactionDto; namespace wsmcbl.front.model.accounting;