This commit is contained in:
mmrbnjd
2025-01-24 19:18:17 +03:30
parent 505adf6ab2
commit 48072d6e00
14 changed files with 389 additions and 67 deletions

View File

@@ -16,7 +16,7 @@
{
<ul>
@if (_SuccessfulSubmissiontoTaxPayer)
{
<li style="color:red">با این کالا صورتحسابی به سامانه مودیان ارسال کرده اید <br />نمیتوانید آن را ویرایش کنید</li>
@@ -30,7 +30,16 @@
}
<li style="color:dodgerblue">زمان ویرایش دقت کنید<br /> تغییرات میتواند روی فاکتورهای صادر شده تائیر بگذارد</li>
}
@if (InventoryValue > 0)
{
<li style="color:seagreen">موجودی کالا در انبار : @InventoryValue</li>
}
else
{
<li style="color:red">این کالا در انبار موجودی ندارد</li>
}
</ul>
}
<div class="row g-3">
@@ -38,14 +47,13 @@
<label class="col-sm-4 col-form-label" style="color:red" for="inputTitle">نام کالا</label>
@if (Cod.ID == 0 || !_UsedInTheInvoice)
{
<InputText style="text-align:center" @bind-Value="Cod.Title" type="text" class="form-control" id="inputTitle" placeholder="نام کالا"
/>
<InputText style="text-align:center" @bind-Value="Cod.Title" type="text" class="form-control" id="inputTitle" placeholder="نام کالا" />
}
else
{
<InputText style="text-align:center" @bind-Value="Cod.Title" type="text" class="form-control" id="inputTitle" placeholder="نام کالا" readonly />
}
</div>
<div class="form-group col-md-6">
<label class="col-sm-5 col-form-label" style="color:red" for="inputUnitID">واحد اندازه گیزی</label>
@@ -90,19 +98,19 @@
</div>
</div>
</form>
<div class="row g-3">
<div class="row g-3">
<div class="col-md-10">
@if (Cod.ID == 0)
{
<Button class="mt-3" Color="ButtonColor.Success" @onclick="OnClickAdd" Type="ButtonType.Button">
جدید
</Button>
}
else
{
@if (Cod.ID == 0)
{
<Button class="mt-3" Color="ButtonColor.Success" @onclick="OnClickAdd" Type="ButtonType.Button">
جدید
</Button>
}
else
{
@if (!_SuccessfulSubmissiontoTaxPayer)
{
<Button Disabled="SpinnerVisible" class="mt-3" Color="ButtonColor.Success" @onclick="OnClickUpdate" Type="ButtonType.Button">
@@ -112,19 +120,20 @@ else
حذف
</Button>
}
@if (_UsedInTheInvoice)
{
<Button Disabled="SpinnerVisible" class=" mt-3" Color="ButtonColor.Link" @onclick="OnClickGoToInvoice" Type="ButtonType.Button">
صورتحساب های مرتبط
</Button>
}
}
@if (_UsedInTheInvoice)
{
<Button Disabled="SpinnerVisible" class=" mt-3" Color="ButtonColor.Link" @onclick="OnClickGoToInvoice" Type="ButtonType.Button">
صورتحساب های مرتبط
</Button>
}
}
</div>
<div class="col-md-2" >
<div class="col-md-2">
<Spinner Visible="SpinnerVisible" Color="SpinnerColor.Primary" />
</div>
</div>
</div>
@code {
public bool SpinnerVisible { get; set; } = false;
@@ -154,6 +163,9 @@ else
alertMessage = "";
await UsedInTheInvoice();
await SuccessfulSubmissiontoTaxPayer();
// موجودی
await Inventory();
//
SpinnerVisible = false;
await base.OnParametersSetAsync();
}
@@ -165,7 +177,7 @@ else
}
public async Task UsedInTheInvoice()
{
if (Cod.ID!=0)
if (Cod.ID != 0)
{
var rsp = await hc.Get($"Cod/UsedInTheInvoice/{Cod.ID}");
if (rsp.IsSuccessStatusCode)
@@ -175,6 +187,16 @@ else
}
}
public decimal InventoryValue { get; set; } = 0;
public async Task Inventory()
{
if (Cod.ID != 0)
{
var rsp = await hc.Get($"Warehouse/Inventory/{Cod.ID}");
if (rsp.IsSuccessStatusCode)
InventoryValue = await rsp.Content.ReadFromJsonAsync<decimal>();
}
}
public async Task SuccessfulSubmissiontoTaxPayer()
{
SpinnerVisible = true;
@@ -187,7 +209,7 @@ else
else _SuccessfulSubmissiontoTaxPayer = false;
}
SpinnerVisible = false ;
SpinnerVisible = false;
}
private void ShowSuccessAlert(string msg)
{
@@ -234,7 +256,7 @@ else
SpinnerVisible = true;
if (Cod.UnitID > 0 && Cod.TaxRate >= 0 && !string.IsNullOrEmpty(Cod.Title))
{
var rsp = await hc.Put<RCOD>("Cod/Update", Cod);
if (rsp.IsSuccessStatusCode)
{
@@ -295,11 +317,11 @@ else
message2: "اطمینان دارید?");
if (confirmation)
await OnClickDelete();
await OnClickDelete();
}
}
}