...
This commit is contained in:
@@ -36,7 +36,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="Service">
|
||||
<HintPath>..\..\..\LocalGit\TaxPayerTools\Service\bin\Debug\Service.dll</HintPath>
|
||||
<HintPath>..\..\Dlls\Service.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
|
@@ -165,7 +165,7 @@ namespace Back.Controllers
|
||||
{
|
||||
Company.Credit -= order.TPrice;
|
||||
var comUpdate=await _servCompany.AddORUpdateCompany(Company);
|
||||
if (comUpdate!=null)
|
||||
if (comUpdate != null)
|
||||
{
|
||||
if (await _servWalt.AddDocument(new CreditDocuments
|
||||
{
|
||||
@@ -175,7 +175,14 @@ namespace Back.Controllers
|
||||
type = CreditDocumentType.Decrease,
|
||||
Value = order.TPrice
|
||||
}))
|
||||
return Ok();
|
||||
{
|
||||
if (await _servOrders.SubmitOrder(order,CompanyID))
|
||||
return Ok();
|
||||
|
||||
else
|
||||
return BadRequest(new List<string> { "خطا در بروزرسانی سرویس ها" });
|
||||
}
|
||||
|
||||
else
|
||||
return BadRequest(new List<string> { "خطا در بروزرسانی سند سفارش" });
|
||||
}
|
||||
|
@@ -9,15 +9,17 @@ namespace Back.Services
|
||||
{
|
||||
public class ServOrders
|
||||
{
|
||||
private readonly IAsyncRepository<PermissionPeriod> _repoPermissionPeriod;
|
||||
private readonly IAsyncRepository<Order> _repoOrder;
|
||||
private readonly IAsyncRepository<OrderItem> _repoOrderItem;
|
||||
|
||||
|
||||
public ServOrders(IAsyncRepository<Order> repoOrder, IAsyncRepository<OrderItem> repoOrderItem)
|
||||
public ServOrders(IAsyncRepository<Order> repoOrder, IAsyncRepository<OrderItem> repoOrderItem
|
||||
, IAsyncRepository<PermissionPeriod> repoPermissionPeriod)
|
||||
{
|
||||
_repoOrder = repoOrder;
|
||||
_repoOrderItem = repoOrderItem;
|
||||
|
||||
_repoPermissionPeriod = repoPermissionPeriod;
|
||||
}
|
||||
public async Task<PagingDto<OrderDto>> GetOrdersByCompanyID(int CompanyID, ItemSerachOrder itemSerach)
|
||||
{
|
||||
@@ -84,5 +86,30 @@ namespace Back.Services
|
||||
|
||||
}
|
||||
}
|
||||
public async Task<bool> SubmitOrder(Order ordermodel,int CompanyID)
|
||||
{
|
||||
try
|
||||
{
|
||||
foreach (OrderItem order in ordermodel.OrderItems.ToList())
|
||||
{
|
||||
var pp = await _repoPermissionPeriod.Get(w => w.PermissionID == order.PermissionID && w.CompanyID == CompanyID && w.CalculationTypeID == 1).FirstOrDefaultAsync();
|
||||
if (pp != null)
|
||||
{
|
||||
pp.RemainingAmount += order.CreditAmount;
|
||||
pp.TotalAmount += order.CreditAmount;
|
||||
await _repoPermissionPeriod.UpdateAsync(pp);
|
||||
}
|
||||
}
|
||||
ordermodel.Status = StatusOrder.Paid;
|
||||
return await _repoOrder.UpdateAsync(ordermodel);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return false;
|
||||
throw;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -144,6 +144,7 @@ namespace Back.Services
|
||||
{
|
||||
ID = user.RolUsers.First().CompanyID,
|
||||
Name = user.RolUsers.First().Company.Name,
|
||||
Credit = user.RolUsers.First().Company.Credit,
|
||||
IsAdmin = user.RolUsers.First().IsAdmin,
|
||||
Logo = user.RolUsers.First().Company.Logo == null ? null : Convert.ToBase64String(user.RolUsers.First().Company.Logo)
|
||||
|
||||
|
@@ -6,7 +6,8 @@
|
||||
public string Name { get; set; }
|
||||
public string? Logo { get; set; }
|
||||
public bool IsAdmin { get; set; }
|
||||
// public ICollection<PermissionAuthenticationDTO> permissions { get; set; } = new List<PermissionAuthenticationDTO>();
|
||||
public decimal Credit { get; set; } = 0;
|
||||
// public ICollection<PermissionAuthenticationDTO> permissions { get; set; } = new List<PermissionAuthenticationDTO>();
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,7 @@
|
||||
@using Front.Services
|
||||
@using Shared.DTOs
|
||||
@inject HttpClientController hc;
|
||||
@inject UserAuthenticationDTO userinfo
|
||||
<Preload LoadingText="در حال بارگذاری..." />
|
||||
<ConfirmDialog @ref="dialog" />
|
||||
|
||||
@@ -126,6 +127,7 @@
|
||||
string titledateapp = "تاریخ";
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
Hidealert = true;
|
||||
if (order.Status == StatusOrder.Cancel)
|
||||
{
|
||||
titledateapp += " ابطال";
|
||||
@@ -161,9 +163,7 @@
|
||||
private async Task<List<OrderItemDto>> LoadOrderItem()
|
||||
{
|
||||
|
||||
PreloadService.Show(SpinnerColor.Dark);
|
||||
var rsp = await hc.Get($"Orders/GetOrderDetails/{order.ID}");
|
||||
PreloadService.Hide();
|
||||
if (rsp.IsSuccessStatusCode)
|
||||
return await rsp.Content.ReadFromJsonAsync<List<OrderItemDto>?>();
|
||||
else
|
||||
@@ -175,11 +175,11 @@
|
||||
}
|
||||
private async Task OnClickPay()
|
||||
{
|
||||
PreloadService.Show(SpinnerColor.Dark);
|
||||
var rsp = await hc.Get($"Orders/SubmitOrderBywallet/{order.ID}");
|
||||
PreloadService.Hide();
|
||||
|
||||
if (rsp.IsSuccessStatusCode)
|
||||
{
|
||||
userinfo.Company.Credit -= order.TPrice;
|
||||
result = new ActionInResultComponent();
|
||||
result.Status = ComponentStatus.success;
|
||||
result.Action = ComponentAction.add;
|
||||
|
@@ -89,11 +89,18 @@
|
||||
<div class="layout-page">
|
||||
<!-- Navbar -->
|
||||
<nav class="layout-navbar container-xxl navbar navbar-expand-xl navbar-detached align-items-center bg-navbar-theme" id="layout-navbar">
|
||||
<div class="layout-menu-toggle navbar-nav align-items-xl-center me-3 me-xl-0 d-xl-none">
|
||||
<a class="nav-item nav-link px-0 me-xl-4" href="javascript:void(0)">
|
||||
<i class="bx bx-menu bx-sm"></i>
|
||||
</a>
|
||||
<div class="d-flex">
|
||||
<div class="avatar flex-shrink-0">
|
||||
<img src="assets/img/icons/unicons/wallet.png" alt="User">
|
||||
</div>
|
||||
<div>
|
||||
<small class="text-muted d-block">موجودی</small>
|
||||
<div class="d-flex align-items-center">
|
||||
<h6 class="mb-0 me-1">@userinfo.Company.Credit.ToString("N0")<span style="font-size: 14px">ریال</span></h6>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="navbar-nav-right d-flex align-items-center" id="navbar-collapse">
|
||||
|
||||
<ul class="navbar-nav flex-row align-items-center mr-auto f-ir">
|
||||
@@ -138,6 +145,8 @@
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
|
||||
<!--/ User -->
|
||||
@if (countnot > 0)
|
||||
{
|
||||
|
@@ -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");
|
||||
|
||||
|
Reference in New Issue
Block a user