This commit is contained in:
mmrbnjd
2024-10-22 12:31:34 +03:30
parent afd1a5ef8f
commit e748993044
4 changed files with 115 additions and 29 deletions

View File

@@ -571,5 +571,21 @@ namespace Back.Controllers
if (result == null) return NotFound(); if (result == null) return NotFound();
return Ok(result); return Ok(result);
} }
[HttpGet("CodInTaxPayerHaveBeenSentSuccessfully/{CODID}")]
public async Task<ActionResult<bool>> CodInTaxPayerHaveBeenSentSuccessfully(int CODID)
{
var claim = HttpContext.User.Claims.First(c => c.Type == "UserID");
var UserID = claim.Value;
var user = await _servUser.GetUserByUserID(Convert.ToInt32(UserID));
return Ok(await _servTaxPayer.AnyCodInTaxPayerHaveBeenSentSuccessfully(CODID, user.RolUsers.First().CompanyID));
}
[HttpGet("CustomerInTaxPayerHaveBeenSentSuccessfully/{CUSID}")]
public async Task<ActionResult<bool>> CustomerInTaxPayerHaveBeenSentSuccessfully(int CUSID)
{
var claim = HttpContext.User.Claims.First(c => c.Type == "UserID");
var UserID = claim.Value;
var user = await _servUser.GetUserByUserID(Convert.ToInt32(UserID));
return Ok(await _servTaxPayer.AnyCusInTaxPayerHaveBeenSentSuccessfully(CUSID, user.RolUsers.First().CompanyID));
}
} }
} }

View File

@@ -5,6 +5,7 @@ using Microsoft.EntityFrameworkCore;
using Back.Common; using Back.Common;
using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Extensions;
using Shared.DTOs.Serch; using Shared.DTOs.Serch;
using System.ComponentModel.Design;
namespace Back.Services namespace Back.Services
{ {
@@ -376,7 +377,20 @@ namespace Back.Services
// } // }
} }
public async Task<bool> AnyCodInTaxPayerHaveBeenSentSuccessfully(int CODID, int CompanyID)
{
return await _repoSentTax.Get(w => w.invoice.invoiceDetails.Any(a => a.CODID == CODID)
&& w.invoice.CompanyID==CompanyID
&& (w.SentStatus == SentStatus.Successful || w.SentStatus == SentStatus.Send
|| w.SentStatus == SentStatus.pending || w.SentStatus == SentStatus.IN_PROGRESS)).AnyAsync();
}
public async Task<bool> AnyCusInTaxPayerHaveBeenSentSuccessfully(int CusID, int CompanyID)
{
return await _repoSentTax.Get(w => w.invoice.CustomerID==CusID
&& w.invoice.CompanyID == CompanyID
&& (w.SentStatus == SentStatus.Successful || w.SentStatus == SentStatus.Send
|| w.SentStatus == SentStatus.pending || w.SentStatus == SentStatus.IN_PROGRESS)).AnyAsync();
}
} }
} }

View File

@@ -14,14 +14,23 @@
</div> </div>
@if (Cod.ID != 0) @if (Cod.ID != 0)
{ {
<h6 style="color:red">نکته:</h6>
<ul> <ul>
@if (_SuccessfulSubmissiontoTaxPayer)
{
<li style="color:red">با این کالا صورتحسابی به سامانه مودیان ارسال کرده اید <br />نمیتوانید آن را ویرایش کنید</li>
}
else
{
@if (_UsedInTheInvoice) @if (_UsedInTheInvoice)
{ {
<li>با این کالا صورتحسابی صادر کرده اید ،نمیتوانید نام کالا را ویرایش کنید</li> <li style="color:indianred">با این کالا صورتحسابی صادر کرده اید <br />نمیتوانید نام کالا را ویرایش کنید</li>
<br />
} }
<li>زمان ویرایش دقت کنید تغییرات میتواند روی فاکتورهای صادر شده تائیر بگذارد</li> <li style="color:dodgerblue">زمان ویرایش دقت کنید<br /> تغییرات میتواند روی فاکتورهای صادر شده تائیر بگذارد</li>
}
</ul> </ul>
} }
<div class="row g-3"> <div class="row g-3">
@@ -93,6 +102,8 @@
</Button> </Button>
} }
else else
{
@if (!_SuccessfulSubmissiontoTaxPayer)
{ {
<Button Disabled="SpinnerVisible" class="mt-3" Color="ButtonColor.Success" @onclick="OnClickUpdate" Type="ButtonType.Button"> <Button Disabled="SpinnerVisible" class="mt-3" Color="ButtonColor.Success" @onclick="OnClickUpdate" Type="ButtonType.Button">
ثبت تغییرات ثبت تغییرات
@@ -100,6 +111,8 @@ else
<Button Disabled="SpinnerVisible" class=" mt-3" Color="ButtonColor.Danger" @onclick="ShowConfirmationDeleteAsync" Type="ButtonType.Button"> <Button Disabled="SpinnerVisible" class=" mt-3" Color="ButtonColor.Danger" @onclick="ShowConfirmationDeleteAsync" Type="ButtonType.Button">
حذف حذف
</Button> </Button>
}
@if (_UsedInTheInvoice) @if (_UsedInTheInvoice)
{ {
@@ -123,6 +136,7 @@ else
bool Hidealert = true; bool Hidealert = true;
string alertMessage = ""; string alertMessage = "";
bool _UsedInTheInvoice = false; bool _UsedInTheInvoice = false;
bool _SuccessfulSubmissiontoTaxPayer = false;
[Parameter] public RCOD Cod { get; set; } [Parameter] public RCOD Cod { get; set; }
[Parameter] public EventCallback<ActionInResultComponent> OnMultipleOfThree { get; set; } [Parameter] public EventCallback<ActionInResultComponent> OnMultipleOfThree { get; set; }
[Parameter] public List<IdName<int>>? Unitrequest { get; set; } [Parameter] public List<IdName<int>>? Unitrequest { get; set; }
@@ -139,6 +153,7 @@ else
Hidealert = true; Hidealert = true;
alertMessage = ""; alertMessage = "";
await UsedInTheInvoice(); await UsedInTheInvoice();
await SuccessfulSubmissiontoTaxPayer();
SpinnerVisible = false; SpinnerVisible = false;
await base.OnParametersSetAsync(); await base.OnParametersSetAsync();
} }
@@ -160,6 +175,20 @@ else
} }
} }
public async Task SuccessfulSubmissiontoTaxPayer()
{
SpinnerVisible = true;
if (Cod.ID != 0)
{
var rsp = await hc.Get($"TaxPayer/CodInTaxPayerHaveBeenSentSuccessfully/{Cod.ID}");
if (rsp.IsSuccessStatusCode)
_SuccessfulSubmissiontoTaxPayer = await rsp.Content.ReadFromJsonAsync<bool>();
else _SuccessfulSubmissiontoTaxPayer = false;
}
SpinnerVisible = false ;
}
private void ShowSuccessAlert(string msg) private void ShowSuccessAlert(string msg)
{ {
Hidealert = false; Hidealert = false;

View File

@@ -13,16 +13,23 @@
</div> </div>
@if (Cus.ID != 0) @if (Cus.ID != 0)
{ {
<h6 style="color:red">نکته:</h6>
<ul> <ul>
@if (_SuccessfulSubmissiontoTaxPayer)
{
<li style="color:red">با این مشتری صورتحسابی به سامانه مودیان ارسال کرده اید <br />نمیتوانید آن را ویرایش کنید</li>
}
else
{
@if (_UsedInTheInvoice) @if (_UsedInTheInvoice)
{ {
<li>با این مشتری صورتحسابی صادر کرده اید ، نمیتوانید نام کامل را ویرایش کنید</li> <li style="color:indianred">با این مشتری صورتحسابی صادر کرده اید <br /> نمیتوانید نام کامل را ویرایش کنید</li>
<br />
}
<li style="color:dodgerblue">زمان ویرایش دقت کنید <br />تغییرات میتواند روی فاکتورهای صادر شده تائیر بگذارد</li>
} }
<li>زمان ویرایش دقت کنید تغییرات میتواند روی فاکتورهای صادر شده تائیر بگذارد</li>
</ul> </ul>
} }
<div class="row g-3"> <div class="row g-3">
@@ -117,6 +124,8 @@
</Button> </Button>
} }
else else
{
@if (!_SuccessfulSubmissiontoTaxPayer)
{ {
<Button Disabled="SpinnerVisible" class="mt-3" Color="ButtonColor.Success" @onclick="OnClickUpdate" Type="ButtonType.Button"> <Button Disabled="SpinnerVisible" class="mt-3" Color="ButtonColor.Success" @onclick="OnClickUpdate" Type="ButtonType.Button">
ثبت تغییرات ثبت تغییرات
@@ -124,6 +133,9 @@ else
<Button Disabled="SpinnerVisible" class="mt-3" Color="ButtonColor.Danger" @onclick="ShowConfirmationDeleteAsync" Type="ButtonType.Button"> <Button Disabled="SpinnerVisible" class="mt-3" Color="ButtonColor.Danger" @onclick="ShowConfirmationDeleteAsync" Type="ButtonType.Button">
حذف حذف
</Button> </Button>
}
@if (_UsedInTheInvoice) @if (_UsedInTheInvoice)
{ {
<Button Disabled="SpinnerVisible" class="mt-3" Color="ButtonColor.Link" @onclick="OnClickGoToInvoice" Type="ButtonType.Button"> <Button Disabled="SpinnerVisible" class="mt-3" Color="ButtonColor.Link" @onclick="OnClickGoToInvoice" Type="ButtonType.Button">
@@ -151,6 +163,7 @@ else
public int? ItemSearchCustomertype { get; set; } public int? ItemSearchCustomertype { get; set; }
[Parameter] public EventCallback<ActionInResultComponent> OnMultipleOfThree { get; set; } [Parameter] public EventCallback<ActionInResultComponent> OnMultipleOfThree { get; set; }
private ConfirmDialog dialog = default!; private ConfirmDialog dialog = default!;
bool _SuccessfulSubmissiontoTaxPayer = false;
public ActionInResultComponent result { get; set; } public ActionInResultComponent result { get; set; }
protected override async Task OnParametersSetAsync() protected override async Task OnParametersSetAsync()
{ {
@@ -164,6 +177,7 @@ else
Hidealert = true; Hidealert = true;
alertMessage = ""; alertMessage = "";
await UsedInTheInvoice(); await UsedInTheInvoice();
await SuccessfulSubmissiontoTaxPayer();
SpinnerVisible = false; SpinnerVisible = false;
await base.OnParametersSetAsync(); await base.OnParametersSetAsync();
} }
@@ -329,6 +343,19 @@ else
SpinnerVisible = !SpinnerVisible; SpinnerVisible = !SpinnerVisible;
} }
public async Task SuccessfulSubmissiontoTaxPayer()
{
SpinnerVisible = !SpinnerVisible;
if (Cus.ID != 0)
{
var rsp = await hc.Get($"TaxPayer/CustomerInTaxPayerHaveBeenSentSuccessfully/{Cus.ID}");
if (rsp.IsSuccessStatusCode)
_SuccessfulSubmissiontoTaxPayer = await rsp.Content.ReadFromJsonAsync<bool>();
else _SuccessfulSubmissiontoTaxPayer = false;
}
SpinnerVisible = !SpinnerVisible;
}
private void ShowInfoAlert(string msg) private void ShowInfoAlert(string msg)
{ {
Hidealert = false; Hidealert = false;