...
This commit is contained in:
@@ -69,7 +69,7 @@
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<label class="col-sm-8 col-form-label">مبلغ بعد تخفیف</label>
|
||||
<InputNumber @bind-Value="itemDTO.adis" type="text" class="form-control" id="inputadis" placeholder="مبلغ تخفیف" readonly />
|
||||
<InputNumber @bind-Value="itemDTO.adis" type="text" class="form-control" id="inputadis" placeholder="مبلغ تخفیف" readonly />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row g-3">
|
||||
@@ -83,7 +83,7 @@
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label class="col-sm-6 col-form-label">مبلغ نهایی</label>
|
||||
<InputNumber @bind-Value="itemDTO.tsstam" type="text" class="form-control" id="inputvra" placeholder="مبلغ مالیات" readonly />
|
||||
<InputNumber @bind-Value="itemDTO.tsstam" type="text" class="form-control" id="inputvra" placeholder="مبلغ نهایی" readonly />
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
@@ -113,6 +113,7 @@ else
|
||||
bool Hidealert = true;
|
||||
string alertMessage = "";
|
||||
public int Tax { get; set; } = 0;
|
||||
[Parameter] public int InvoiceID { get; set; }
|
||||
[Parameter] public InvoiceItemDTO itemDTO { get; set; }
|
||||
[Parameter] public EventCallback<ActionInResultComponent> OnMultipleOfThree { get; set; }
|
||||
public List<CODIdName<int>> cods { get; set; } = new();
|
||||
@@ -135,6 +136,21 @@ else
|
||||
}
|
||||
}
|
||||
@functions {
|
||||
private void ShowSuccessAlert(string msg)
|
||||
{
|
||||
Hidealert = false;
|
||||
alertColor = AlertColor.Success;
|
||||
alertIconName = IconName.CheckCircleFill;
|
||||
alertMessage = msg;
|
||||
}
|
||||
private void ShowDangerAlert(string msg)
|
||||
{
|
||||
Hidealert = false;
|
||||
alertColor = AlertColor.Danger;
|
||||
alertIconName = IconName.ExclamationTriangleFill;
|
||||
alertMessage = msg;
|
||||
}
|
||||
//-----------------------
|
||||
private async Task prdisAsync()
|
||||
{
|
||||
if (itemDTO.ID == null)
|
||||
@@ -143,7 +159,7 @@ else
|
||||
private async Task adisAsync()
|
||||
{
|
||||
if (itemDTO.ID == null)
|
||||
itemDTO.adis= itemDTO.prdis - itemDTO.dis;
|
||||
itemDTO.adis = itemDTO.prdis - itemDTO.dis;
|
||||
|
||||
// await AftervamAsync();
|
||||
}
|
||||
@@ -155,7 +171,7 @@ else
|
||||
private async Task tsstamAsync()
|
||||
{
|
||||
if (itemDTO.ID == null)
|
||||
itemDTO.tsstam = itemDTO.vam + itemDTO.adis ;
|
||||
itemDTO.tsstam = itemDTO.vam + itemDTO.adis;
|
||||
}
|
||||
private async Task AfterAsync()
|
||||
{
|
||||
@@ -164,27 +180,28 @@ else
|
||||
await vamAsync();
|
||||
await tsstamAsync();
|
||||
}
|
||||
//-----------------------
|
||||
public async Task OnClickDelete()
|
||||
{
|
||||
|
||||
// var rsp = await hc.Delete($"Customer/Delete/{Cus.ID}");
|
||||
// if (rsp.IsSuccessStatusCode)
|
||||
// {
|
||||
// var request = await rsp.Content.ReadFromJsonAsync<bool>();
|
||||
// if (request)
|
||||
// {
|
||||
// result.Status = ComponentStatus.success;
|
||||
// result.Action = ComponentAction.delete;
|
||||
// await OnMultipleOfThree.InvokeAsync(result);
|
||||
// }
|
||||
// else ShowDangerAlert("خطایی در اجرای عملیات رخ داده");
|
||||
// }
|
||||
var rsp = await hc.Delete($"InvoiceItem/DeleteItem/{InvoiceID}/{itemDTO.ID}");
|
||||
if (rsp.IsSuccessStatusCode)
|
||||
{
|
||||
var request = await rsp.Content.ReadFromJsonAsync<bool>();
|
||||
if (request)
|
||||
{
|
||||
result.Status = ComponentStatus.success;
|
||||
result.Action = ComponentAction.delete;
|
||||
await OnMultipleOfThree.InvokeAsync(result);
|
||||
}
|
||||
else ShowDangerAlert("خطایی در اجرای عملیات رخ داده");
|
||||
}
|
||||
|
||||
// else if (rsp.StatusCode == System.Net.HttpStatusCode.NotFound)
|
||||
// {
|
||||
// ShowDangerAlert("مشتری با این شناسه یافت نشد");
|
||||
// }
|
||||
// else ShowDangerAlert("خطایی در اجرای عملیات رخ داده");
|
||||
else
|
||||
{
|
||||
var request = await rsp.Content.ReadFromJsonAsync<List<string>>();
|
||||
ShowDangerAlert(request[0]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -192,60 +209,91 @@ else
|
||||
}
|
||||
public async Task OnClickUpdate()
|
||||
{
|
||||
// if (ItemSearchCustomertype > 0 && !string.IsNullOrEmpty(Cus.FullName))
|
||||
// {
|
||||
// if (ItemSearchCustomertype > 0)
|
||||
// Cus.CustomerType = (CustomerType)ItemSearchCustomertype;
|
||||
if (itemDTO.CODID == null || itemDTO.CODID <= 0)
|
||||
{
|
||||
ShowDangerAlert("کالا انتخاب نشده");
|
||||
return;
|
||||
}
|
||||
|
||||
// var rsp = await hc.Put<RCustomer>("Customer/Update", Cus);
|
||||
// if (rsp.IsSuccessStatusCode)
|
||||
// {
|
||||
// var request = await rsp.Content.ReadFromJsonAsync<bool>();
|
||||
// if (request)
|
||||
// {
|
||||
// result.Status = ComponentStatus.success;
|
||||
// result.Action = ComponentAction.update;
|
||||
// await OnMultipleOfThree.InvokeAsync(result);
|
||||
// }
|
||||
// else ShowDangerAlert("خطایی در اجرای عملیات رخ داده");
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// var request = await rsp.Content.ReadFromJsonAsync<List<string>>();
|
||||
// ShowDangerAlert(request[0]);
|
||||
// }
|
||||
// }
|
||||
// else ShowDangerAlert("فیلدهای قرمز باید مقدار دهی شوند");
|
||||
if (itemDTO.am == null || itemDTO.am <= 0)
|
||||
{
|
||||
ShowDangerAlert("تعداد وارد نشده");
|
||||
return;
|
||||
}
|
||||
|
||||
if (itemDTO.fee == null || itemDTO.fee < 0)
|
||||
{
|
||||
ShowDangerAlert("مبلغ واحد وارد نشده");
|
||||
return;
|
||||
}
|
||||
|
||||
if (itemDTO.dis == null || itemDTO.dis < 0)
|
||||
{
|
||||
ShowDangerAlert("مبلغ تخفیف درست نیست");
|
||||
return;
|
||||
}
|
||||
var rsp = await hc.Put<InvoiceItemDTO>($"InvoiceItem/UpdateItem/{InvoiceID}", itemDTO);
|
||||
if (rsp.IsSuccessStatusCode)
|
||||
{
|
||||
var request = await rsp.Content.ReadFromJsonAsync<bool>();
|
||||
if (request)
|
||||
{
|
||||
result.Status = ComponentStatus.success;
|
||||
result.Action = ComponentAction.update;
|
||||
await OnMultipleOfThree.InvokeAsync(result);
|
||||
}
|
||||
else ShowDangerAlert("خطایی در اجرای عملیات رخ داده");
|
||||
}
|
||||
else
|
||||
{
|
||||
var request = await rsp.Content.ReadFromJsonAsync<List<string>>();
|
||||
ShowDangerAlert(request[0]);
|
||||
}
|
||||
}
|
||||
public async Task OnClickAdd()
|
||||
{
|
||||
// if (ItemSearchCustomertype > 0 && !string.IsNullOrEmpty(Cus.FullName))
|
||||
// {
|
||||
// if (ItemSearchCustomertype > 0)
|
||||
// Cus.CustomerType = (CustomerType)ItemSearchCustomertype;
|
||||
// Cus.ID = null;
|
||||
if (itemDTO.CODID == null || itemDTO.CODID <= 0)
|
||||
{
|
||||
ShowDangerAlert("کالا انتخاب نشده");
|
||||
return;
|
||||
}
|
||||
|
||||
if (itemDTO.am == null || itemDTO.am <= 0)
|
||||
{
|
||||
ShowDangerAlert("تعداد وارد نشده");
|
||||
return;
|
||||
}
|
||||
|
||||
// var rsp = await hc.Post<RCustomer>("Customer/Add", Cus);
|
||||
// if (rsp.IsSuccessStatusCode)
|
||||
// {
|
||||
// var request = await rsp.Content.ReadFromJsonAsync<bool>();
|
||||
if (itemDTO.fee == null || itemDTO.fee < 0)
|
||||
{
|
||||
ShowDangerAlert("مبلغ واحد وارد نشده");
|
||||
return;
|
||||
}
|
||||
|
||||
// if (request)
|
||||
// {
|
||||
// result.Status = ComponentStatus.success;
|
||||
// result.Action = ComponentAction.add;
|
||||
// await OnMultipleOfThree.InvokeAsync(result);
|
||||
// }
|
||||
// else ShowDangerAlert("خطایی در اجرای عملیات رخ داده");
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
if (itemDTO.dis == null || itemDTO.dis < 0)
|
||||
{
|
||||
ShowDangerAlert("مبلغ تخفیف درست نیست");
|
||||
return;
|
||||
}
|
||||
|
||||
// var request = await rsp.Content.ReadFromJsonAsync<List<string>>();
|
||||
// ShowDangerAlert(request[0]);
|
||||
// }
|
||||
// }
|
||||
// else ShowDangerAlert("فیلدهای قرمز باید مقدار دهی شوند");
|
||||
var rsp = await hc.Post<InvoiceItemDTO>($"InvoiceItem/AddItem/{InvoiceID}", itemDTO);
|
||||
if (rsp.IsSuccessStatusCode)
|
||||
{
|
||||
var request = await rsp.Content.ReadFromJsonAsync<bool>();
|
||||
|
||||
if (request)
|
||||
{
|
||||
result.Status = ComponentStatus.success;
|
||||
result.Action = ComponentAction.add;
|
||||
await OnMultipleOfThree.InvokeAsync(result);
|
||||
}
|
||||
else ShowDangerAlert("خطایی در اجرای عملیات رخ داده");
|
||||
}
|
||||
else
|
||||
{
|
||||
var request = await rsp.Content.ReadFromJsonAsync<List<string>>();
|
||||
ShowDangerAlert(request[0]);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user