diff --git a/Back/Controllers/TaxPayerController.cs b/Back/Controllers/TaxPayerController.cs index 6182614..0183201 100644 --- a/Back/Controllers/TaxPayerController.cs +++ b/Back/Controllers/TaxPayerController.cs @@ -456,5 +456,15 @@ namespace Back.Controllers return BadRequest(new List { "خطای ناشناخته" }); } } + [HttpGet("GetBillTypes")] + public async Task>>> GetBillTypes() + { + return Ok(await _servTaxPayer.GetBillTypes()); + } + [HttpGet("GetPatterns")] + public async Task>>> GetPatterns() + { + return Ok(await _servTaxPayer.GetPatterns(true)); + } } } diff --git a/Back/Services/servTaxPayer.cs b/Back/Services/servTaxPayer.cs index bf6b3e0..63da6d0 100644 --- a/Back/Services/servTaxPayer.cs +++ b/Back/Services/servTaxPayer.cs @@ -12,6 +12,7 @@ namespace Back.Services { private readonly IAsyncRepository _repoSentTax; private readonly IAsyncRepository _repoPattern; + private readonly IAsyncRepository _repoBillType; private readonly IAsyncRepository _invoiceRepo; private readonly IAsyncRepository _invoiceitemRepo; private readonly IAsyncRepository _fildModeInPatternRepo; @@ -20,7 +21,7 @@ namespace Back.Services public servTaxPayer(IAsyncRepository repoSentTax, IAsyncRepository repoPattern , IAsyncRepository invoiceRepo, IAsyncRepository fildModeInPatternRepo , IAsyncRepository codingRepo, IAsyncRepository specialConditionRepo - , IAsyncRepository invoiceitemRepo) + , IAsyncRepository invoiceitemRepo, IAsyncRepository repoBillType) { _repoSentTax = repoSentTax; _repoPattern = repoPattern; @@ -29,6 +30,7 @@ namespace Back.Services _codingRepo = codingRepo; _specialConditionRepo = specialConditionRepo; _invoiceitemRepo = invoiceitemRepo; + _repoBillType = repoBillType; } public async Task ExistSuccessfulorSendorpendingInvoiceinCompanyID(int CompanyID) { @@ -45,10 +47,19 @@ namespace Back.Services && (w.SentStatus == SentStatus.Successful || w.SentStatus == SentStatus.Send || w.SentStatus == SentStatus.pending) && w.invoice.CompanyID != CompanyID).AnyAsync(); } - public async Task>> GetPatterns() + public async Task>> GetPatterns(bool inp=false) { + if(inp) + return await _repoPattern.Get(w => w.Status).Select(s => new IdName { ID = s.inp, Title = s.Title }).ToListAsync(); + + else return await _repoPattern.Get(w=>w.Status).Select(s => new IdName { ID = s.ID, Title = s.Title }).ToListAsync(); + } + public async Task>> GetBillTypes() + { + return await _repoBillType.GetAll().Select(s => new IdName { ID = s.inty, Title = s.Title }).ToListAsync(); + } public async Task UpdateInvoice(Invoice invoice) { diff --git a/TaxPayerFull/FixedValues.cs b/TaxPayerFull/FixedValues.cs index 9cf76d6..47419e0 100644 --- a/TaxPayerFull/FixedValues.cs +++ b/TaxPayerFull/FixedValues.cs @@ -12,6 +12,8 @@ namespace Front public readonly HttpClientController _hc; private List? Cus = null; private List>? Patterns = null; + private List>? Patternsbyinp = null; + private List>? BillTypes = null; private List>? Units = null; private List>? Cods = null; private CompanyDTO? InfoCompany = null; @@ -68,6 +70,34 @@ namespace Front return Patterns; } + public async Task>?> GetPatternsbyinp() + { + if (Patternsbyinp == null) + { + var request = await _hc.Get($"TaxPayer/GetPatterns"); + if (request.IsSuccessStatusCode) + { + Patternsbyinp = await request.Content.ReadFromJsonAsync>>(); + } + } + + + return Patternsbyinp; + } + public async Task>?> GetBillTypes() + { + if (BillTypes == null) + { + var request = await _hc.Get($"TaxPayer/GetBillTypes"); + if (request.IsSuccessStatusCode) + { + BillTypes = await request.Content.ReadFromJsonAsync>>(); + } + } + + + return BillTypes; + } public async Task GetInfoCompany() { diff --git a/TaxPayerFull/Pages/UserPanel/TaxPayerInvoiceItem.razor b/TaxPayerFull/Pages/UserPanel/TaxPayerInvoiceItem.razor index aa2ffd2..abb6a1c 100644 --- a/TaxPayerFull/Pages/UserPanel/TaxPayerInvoiceItem.razor +++ b/TaxPayerFull/Pages/UserPanel/TaxPayerInvoiceItem.razor @@ -4,6 +4,7 @@ @using Shared.DTOs @layout PanelLayout @inject HttpClientController hc; +@inject Fixedvalues fv; @@ -74,11 +75,11 @@ else { if (item.Des != null && item.Des.Count() > 0 && !FullInvoice) { - شرایط خاص - - - - + شرایط خاص + + + + } else { @@ -90,10 +91,10 @@ else { if (item.Des != null && item.Des.Count() > 0 && !FullInvoice) { - شرایط خاص - - - + شرایط خاص + + + } else { @@ -122,7 +123,48 @@ else } else if (item.InputBox == "autofild") { - + if (item.eName.ToLower() == "inty") + { + var bill = BillTypes.Where(w => w.ID == Convert.ToInt32(item.Value)).Select(s => s.Title).FirstOrDefault(); + if (bill != null) + { + item.Value = bill; + } + + + } + else if (item.eName.ToLower() == "inp") + { + var patt = Patterns.Where(w => w.ID == Convert.ToInt32(item.Value)).Select(s => s.Title).FirstOrDefault(); + if (patt != null) + { + item.Value = patt; + } + + + } + else if (item.eName.ToLower() == "ins") + { + var patt = Patterns.Where(w => w.ID == Convert.ToInt32(item.Value)).Select(s => s.Title).FirstOrDefault(); + if (patt != null) + { + item.Value = patt; + } + + + } + + + + + else + { + + + } + + + } @@ -167,8 +209,8 @@ else { if (itemB.Des != null && itemB.Des.Count() > 0 && !FullInvoice) { - شرایط خاص - + شرایط خاص + } else { @@ -179,8 +221,8 @@ else { if (itemB.Des != null && itemB.Des.Count() > 0 && !FullInvoice) { - شرایط خاص - + شرایط خاص + } else { @@ -212,6 +254,8 @@ else { + + } else { @@ -269,6 +313,8 @@ else @code { + private List>? Patterns = new List>(); + private List>? BillTypes = new List>(); private Modal modal = default!; private ConfirmDialog dialog = default!; [Parameter] public int? InvoiceID { get; set; } @@ -285,6 +331,9 @@ else protected override async Task OnParametersSetAsync() { PreloadService.Show(SpinnerColor.Dark); + Patterns = await fv.GetPatternsbyinp(); + BillTypes = await fv.GetBillTypes(); + await LoadData(); PreloadService.Hide(); @@ -352,7 +401,7 @@ else } else { - ShowMessage(ToastType.Danger, "خطای در آماده سازی اطلاعات رخ داده"); + ShowMessage(ToastType.Danger, "خطای در آماده سازی اطلاعات رخ داده"); } } else diff --git a/TaxPayerFull/Program.cs b/TaxPayerFull/Program.cs index 670070e..ea0270a 100644 --- a/TaxPayerFull/Program.cs +++ b/TaxPayerFull/Program.cs @@ -37,10 +37,10 @@ builder.Services.AddScoped(sp => new UserAuthenticationDTO() //builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("http://195.88.208.142:7075/api/") }); //Home -//builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("https://localhost:7075/api/") }); +builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("https://localhost:7075/api/") }); //farzan -builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("http://localhost:5271/api/") }); +//builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("http://localhost:5271/api/") }); CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("fa-Ir");