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