This commit is contained in:
mmrbnjd
2024-08-08 18:20:21 +03:30
parent cd95332a3d
commit 70df7d48b4
5 changed files with 119 additions and 19 deletions

View File

@@ -456,5 +456,15 @@ namespace Back.Controllers
return BadRequest(new List<string> { "خطای ناشناخته" }); return BadRequest(new List<string> { "خطای ناشناخته" });
} }
} }
[HttpGet("GetBillTypes")]
public async Task<ActionResult<List<IdName<int>>>> GetBillTypes()
{
return Ok(await _servTaxPayer.GetBillTypes());
}
[HttpGet("GetPatterns")]
public async Task<ActionResult<List<IdName<int>>>> GetPatterns()
{
return Ok(await _servTaxPayer.GetPatterns(true));
}
} }
} }

View File

@@ -12,6 +12,7 @@ namespace Back.Services
{ {
private readonly IAsyncRepository<SentTax> _repoSentTax; private readonly IAsyncRepository<SentTax> _repoSentTax;
private readonly IAsyncRepository<Pattern> _repoPattern; private readonly IAsyncRepository<Pattern> _repoPattern;
private readonly IAsyncRepository<BillType> _repoBillType;
private readonly IAsyncRepository<Invoice> _invoiceRepo; private readonly IAsyncRepository<Invoice> _invoiceRepo;
private readonly IAsyncRepository<InvoiceItem> _invoiceitemRepo; private readonly IAsyncRepository<InvoiceItem> _invoiceitemRepo;
private readonly IAsyncRepository<FildModeInPattern> _fildModeInPatternRepo; private readonly IAsyncRepository<FildModeInPattern> _fildModeInPatternRepo;
@@ -20,7 +21,7 @@ namespace Back.Services
public servTaxPayer(IAsyncRepository<SentTax> repoSentTax, IAsyncRepository<Pattern> repoPattern public servTaxPayer(IAsyncRepository<SentTax> repoSentTax, IAsyncRepository<Pattern> repoPattern
, IAsyncRepository<Invoice> invoiceRepo, IAsyncRepository<FildModeInPattern> fildModeInPatternRepo , IAsyncRepository<Invoice> invoiceRepo, IAsyncRepository<FildModeInPattern> fildModeInPatternRepo
, IAsyncRepository<Coding> codingRepo, IAsyncRepository<SpecialCondition> specialConditionRepo , IAsyncRepository<Coding> codingRepo, IAsyncRepository<SpecialCondition> specialConditionRepo
, IAsyncRepository<InvoiceItem> invoiceitemRepo) , IAsyncRepository<InvoiceItem> invoiceitemRepo, IAsyncRepository<BillType> repoBillType)
{ {
_repoSentTax = repoSentTax; _repoSentTax = repoSentTax;
_repoPattern = repoPattern; _repoPattern = repoPattern;
@@ -29,6 +30,7 @@ namespace Back.Services
_codingRepo = codingRepo; _codingRepo = codingRepo;
_specialConditionRepo = specialConditionRepo; _specialConditionRepo = specialConditionRepo;
_invoiceitemRepo = invoiceitemRepo; _invoiceitemRepo = invoiceitemRepo;
_repoBillType = repoBillType;
} }
public async Task<bool> ExistSuccessfulorSendorpendingInvoiceinCompanyID(int CompanyID) public async Task<bool> ExistSuccessfulorSendorpendingInvoiceinCompanyID(int CompanyID)
{ {
@@ -45,10 +47,19 @@ namespace Back.Services
&& (w.SentStatus == SentStatus.Successful || w.SentStatus == SentStatus.Send || w.SentStatus == SentStatus.pending) && (w.SentStatus == SentStatus.Successful || w.SentStatus == SentStatus.Send || w.SentStatus == SentStatus.pending)
&& w.invoice.CompanyID != CompanyID).AnyAsync(); && w.invoice.CompanyID != CompanyID).AnyAsync();
} }
public async Task<List<IdName<int>>> GetPatterns() public async Task<List<IdName<int>>> GetPatterns(bool inp=false)
{ {
if(inp)
return await _repoPattern.Get(w => w.Status).Select(s => new IdName<int> { ID = s.inp, Title = s.Title }).ToListAsync();
else
return await _repoPattern.Get(w=>w.Status).Select(s => new IdName<int> { ID = s.ID, Title = s.Title }).ToListAsync(); return await _repoPattern.Get(w=>w.Status).Select(s => new IdName<int> { ID = s.ID, Title = s.Title }).ToListAsync();
}
public async Task<List<IdName<int>>> GetBillTypes()
{
return await _repoBillType.GetAll().Select(s => new IdName<int> { ID = s.inty, Title = s.Title }).ToListAsync();
} }
public async Task<bool> UpdateInvoice(Invoice invoice) public async Task<bool> UpdateInvoice(Invoice invoice)
{ {

View File

@@ -12,6 +12,8 @@ namespace Front
public readonly HttpClientController _hc; public readonly HttpClientController _hc;
private List<ForCustomerSearch>? Cus = null; private List<ForCustomerSearch>? Cus = null;
private List<IdName<int>>? Patterns = null; private List<IdName<int>>? Patterns = null;
private List<IdName<int>>? Patternsbyinp = null;
private List<IdName<int>>? BillTypes = null;
private List<IdName<int>>? Units = null; private List<IdName<int>>? Units = null;
private List<CODIdName<int>>? Cods = null; private List<CODIdName<int>>? Cods = null;
private CompanyDTO? InfoCompany = null; private CompanyDTO? InfoCompany = null;
@@ -68,6 +70,34 @@ namespace Front
return Patterns; return Patterns;
} }
public async Task<List<IdName<int>>?> GetPatternsbyinp()
{
if (Patternsbyinp == null)
{
var request = await _hc.Get($"TaxPayer/GetPatterns");
if (request.IsSuccessStatusCode)
{
Patternsbyinp = await request.Content.ReadFromJsonAsync<List<IdName<int>>>();
}
}
return Patternsbyinp;
}
public async Task<List<IdName<int>>?> GetBillTypes()
{
if (BillTypes == null)
{
var request = await _hc.Get($"TaxPayer/GetBillTypes");
if (request.IsSuccessStatusCode)
{
BillTypes = await request.Content.ReadFromJsonAsync<List<IdName<int>>>();
}
}
return BillTypes;
}
public async Task<CompanyDTO?> GetInfoCompany() public async Task<CompanyDTO?> GetInfoCompany()
{ {

View File

@@ -4,6 +4,7 @@
@using Shared.DTOs @using Shared.DTOs
@layout PanelLayout @layout PanelLayout
@inject HttpClientController hc; @inject HttpClientController hc;
@inject Fixedvalues fv;
<Preload LoadingText="در حال بارگذاری..." /> <Preload LoadingText="در حال بارگذاری..." />
<ConfirmDialog @ref="dialog" /> <ConfirmDialog @ref="dialog" />
<Toasts AutoHide="true" Delay="6000" class="p-3" Messages="messages" Placement="ToastsPlacement.TopRight" /> <Toasts AutoHide="true" Delay="6000" class="p-3" Messages="messages" Placement="ToastsPlacement.TopRight" />
@@ -74,11 +75,11 @@ else
{ {
if (item.Des != null && item.Des.Count() > 0 && !FullInvoice) if (item.Des != null && item.Des.Count() > 0 && !FullInvoice)
{ {
<Badge style="cursor: pointer;" @onclick="()=>ShowConditions(item.Des,item.fName)" Color="BadgeColor.Primary" IndicatorType="BadgeIndicatorType.RoundedPill">شرایط خاص</Badge> <Badge style="cursor: pointer;" @onclick="()=>ShowConditions(item.Des,item.fName)" Color="BadgeColor.Primary" IndicatorType="BadgeIndicatorType.RoundedPill">شرایط خاص</Badge>
<label style="color:red;" class="form-label">@item.fName</label> <label style="color:red;" class="form-label">@item.fName</label>
} }
else else
{ {
@@ -90,10 +91,10 @@ else
{ {
if (item.Des != null && item.Des.Count() > 0 && !FullInvoice) if (item.Des != null && item.Des.Count() > 0 && !FullInvoice)
{ {
<Badge style="cursor: pointer;" @onclick="()=>ShowConditions(item.Des,item.fName)" Color="BadgeColor.Primary" IndicatorType="BadgeIndicatorType.RoundedPill">شرایط خاص</Badge> <Badge style="cursor: pointer;" @onclick="()=>ShowConditions(item.Des,item.fName)" Color="BadgeColor.Primary" IndicatorType="BadgeIndicatorType.RoundedPill">شرایط خاص</Badge>
<label class="form-label">@item.fName</label> <label class="form-label">@item.fName</label>
} }
else else
{ {
@@ -122,7 +123,48 @@ else
} }
else if (item.InputBox == "autofild") else if (item.InputBox == "autofild")
{ {
<input @bind-value="item.Value" style="text-align:center;" class="form-control" type="text" placeholder="@item.fName" disabled /> 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;
}
<input @bind-value="item.Value" style="text-align:center;" class="form-control" type="text" placeholder="@item.fName" disabled />
}
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;
}
<input @bind-value="item.Value" style="text-align:center;" class="form-control" type="text" placeholder="@item.fName" disabled />
}
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;
}
<input @bind-value="item.Value" style="text-align:center;" class="form-control" type="text" placeholder="@item.fName" disabled />
}
else
{
<input @bind-value="item.Value" style="text-align:center;" class="form-control" type="text" placeholder="@item.fName" disabled />
}
} }
@@ -167,8 +209,8 @@ else
{ {
if (itemB.Des != null && itemB.Des.Count() > 0 && !FullInvoice) if (itemB.Des != null && itemB.Des.Count() > 0 && !FullInvoice)
{ {
<Badge style="cursor: pointer;" @onclick="()=>ShowConditions(itemB.Des,itemB.fName)" Color="BadgeColor.Primary" IndicatorType="BadgeIndicatorType.RoundedPill">شرایط خاص</Badge> <Badge style="cursor: pointer;" @onclick="()=>ShowConditions(itemB.Des,itemB.fName)" Color="BadgeColor.Primary" IndicatorType="BadgeIndicatorType.RoundedPill">شرایط خاص</Badge>
<label style="color:red;" class="form-label">@itemB.fName</label> <label style="color:red;" class="form-label">@itemB.fName</label>
} }
else else
{ {
@@ -179,8 +221,8 @@ else
{ {
if (itemB.Des != null && itemB.Des.Count() > 0 && !FullInvoice) if (itemB.Des != null && itemB.Des.Count() > 0 && !FullInvoice)
{ {
<Badge style="cursor: pointer;" @onclick="()=>ShowConditions(itemB.Des,itemB.fName)" Color="BadgeColor.Primary" IndicatorType="BadgeIndicatorType.RoundedPill">شرایط خاص</Badge> <Badge style="cursor: pointer;" @onclick="()=>ShowConditions(itemB.Des,itemB.fName)" Color="BadgeColor.Primary" IndicatorType="BadgeIndicatorType.RoundedPill">شرایط خاص</Badge>
<label class="form-label">@itemB.fName</label> <label class="form-label">@itemB.fName</label>
} }
else else
{ {
@@ -212,6 +254,8 @@ else
{ {
<input @bind-value="itemB.Value" style="text-align:center;" class="form-control" type="text" placeholder="@itemB.fName" disabled /> <input @bind-value="itemB.Value" style="text-align:center;" class="form-control" type="text" placeholder="@itemB.fName" disabled />
} }
else else
{ {
@@ -269,6 +313,8 @@ else
@code { @code {
private List<IdName<int>>? Patterns = new List<IdName<int>>();
private List<IdName<int>>? BillTypes = new List<IdName<int>>();
private Modal modal = default!; private Modal modal = default!;
private ConfirmDialog dialog = default!; private ConfirmDialog dialog = default!;
[Parameter] public int? InvoiceID { get; set; } [Parameter] public int? InvoiceID { get; set; }
@@ -285,6 +331,9 @@ else
protected override async Task OnParametersSetAsync() protected override async Task OnParametersSetAsync()
{ {
PreloadService.Show(SpinnerColor.Dark); PreloadService.Show(SpinnerColor.Dark);
Patterns = await fv.GetPatternsbyinp();
BillTypes = await fv.GetBillTypes();
await LoadData(); await LoadData();
PreloadService.Hide(); PreloadService.Hide();
@@ -352,7 +401,7 @@ else
} }
else else
{ {
ShowMessage(ToastType.Danger, "خطای در آماده سازی اطلاعات رخ داده"); ShowMessage(ToastType.Danger, "خطای در آماده سازی اطلاعات رخ داده");
} }
} }
else else

View File

@@ -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/") }); //builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("http://195.88.208.142:7075/api/") });
//Home //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 //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"); CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("fa-Ir");