...
This commit is contained in:
@@ -35,7 +35,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>
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using Back.Services;
|
|||||||
using Back.Validations;
|
using Back.Validations;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Microsoft.AspNetCore.Http.HttpResults;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Shared.DTOs;
|
using Shared.DTOs;
|
||||||
using Shared.DTOs.Serch;
|
using Shared.DTOs.Serch;
|
||||||
@@ -38,7 +39,7 @@ namespace Back.Controllers
|
|||||||
|
|
||||||
}
|
}
|
||||||
[HttpGet("Get/{ID}")]
|
[HttpGet("Get/{ID}")]
|
||||||
public async Task<ActionResult<InvoiceGridDTO>?> GetAll(int ID)
|
public async Task<ActionResult<InvoiceDTO>?> GetAll(int ID)
|
||||||
{
|
{
|
||||||
var claim = HttpContext.User.Claims.First(c => c.Type == "UserID");
|
var claim = HttpContext.User.Claims.First(c => c.Type == "UserID");
|
||||||
var UserID = claim.Value;
|
var UserID = claim.Value;
|
||||||
@@ -191,7 +192,7 @@ namespace Back.Controllers
|
|||||||
return Ok(await _servInvoice.DeleteInvoice(invoice));
|
return Ok(await _servInvoice.DeleteInvoice(invoice));
|
||||||
}
|
}
|
||||||
[HttpPost("ChangeInvoiceType/{InvoiceID}")]// ok
|
[HttpPost("ChangeInvoiceType/{InvoiceID}")]// ok
|
||||||
public async Task<ActionResult<int>> ChangeInvoiceType(int InvoiceID, InvoiceType invoiceType)
|
public async Task<ActionResult<InvoiceDTO>> ChangeInvoiceType(int InvoiceID, InvoiceType invoiceType)
|
||||||
{
|
{
|
||||||
//-----GetUserAndCompany
|
//-----GetUserAndCompany
|
||||||
var claim = HttpContext.User.Claims.First(c => c.Type == "UserID");
|
var claim = HttpContext.User.Claims.First(c => c.Type == "UserID");
|
||||||
@@ -229,7 +230,7 @@ namespace Back.Controllers
|
|||||||
|
|
||||||
case InvoiceType.Repair:
|
case InvoiceType.Repair:
|
||||||
await _servInvoice.ChangeInvoiceType(Invoice, invoiceType, false);
|
await _servInvoice.ChangeInvoiceType(Invoice, invoiceType, false);
|
||||||
return Ok(await _servInvoice.AddInvoice(new Invoice()
|
var result = await _servInvoice.AddInvoice(new Invoice()
|
||||||
{
|
{
|
||||||
|
|
||||||
Title = Invoice.Title,
|
Title = Invoice.Title,
|
||||||
@@ -243,11 +244,13 @@ namespace Back.Controllers
|
|||||||
BillReference = Invoice.ID,
|
BillReference = Invoice.ID,
|
||||||
IsDeleted = false,
|
IsDeleted = false,
|
||||||
PatternID = Invoice.PatternID
|
PatternID = Invoice.PatternID
|
||||||
}, false));
|
}, false);
|
||||||
|
if (result > 0)
|
||||||
|
return Ok(await _servInvoice.GetInvoice(user.RolUsers.First().CompanyID,result));
|
||||||
|
break;
|
||||||
case InvoiceType.BackFrmSale:
|
case InvoiceType.BackFrmSale:
|
||||||
await _servInvoice.ChangeInvoiceType(Invoice, invoiceType, false);
|
await _servInvoice.ChangeInvoiceType(Invoice, invoiceType, false);
|
||||||
return Ok(await _servInvoice.AddInvoice(new Invoice()
|
var result1 = await _servInvoice.AddInvoice(new Invoice()
|
||||||
{
|
{
|
||||||
|
|
||||||
Title = Invoice.Title,
|
Title = Invoice.Title,
|
||||||
@@ -261,7 +264,10 @@ namespace Back.Controllers
|
|||||||
BillReference = Invoice.ID,
|
BillReference = Invoice.ID,
|
||||||
IsDeleted = false,
|
IsDeleted = false,
|
||||||
PatternID = Invoice.PatternID
|
PatternID = Invoice.PatternID
|
||||||
}, false));
|
}, false);
|
||||||
|
if (result1 > 0)
|
||||||
|
return Ok(await _servInvoice.GetInvoice(user.RolUsers.First().CompanyID, result1));
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return BadRequest(new List<string> { $"تغییر وضعیت از {Invoice.invoiceType.GetEnumDisplayName()} به {invoiceType.GetEnumDisplayName()} امکان پذیر نیست این صورتحساب به سامانه مودیان ارسال شده" });
|
return BadRequest(new List<string> { $"تغییر وضعیت از {Invoice.invoiceType.GetEnumDisplayName()} به {invoiceType.GetEnumDisplayName()} امکان پذیر نیست این صورتحساب به سامانه مودیان ارسال شده" });
|
||||||
@@ -286,8 +292,8 @@ namespace Back.Controllers
|
|||||||
{
|
{
|
||||||
switch (invoiceType)
|
switch (invoiceType)
|
||||||
{
|
{
|
||||||
case InvoiceType.Sale:
|
//case InvoiceType.Sale:
|
||||||
return Ok(await _servInvoice.ChangeInvoiceType(Invoice, invoiceType));
|
// return Ok(await _servInvoice.ChangeInvoiceType(Invoice, invoiceType));
|
||||||
|
|
||||||
case InvoiceType.CANCEL:
|
case InvoiceType.CANCEL:
|
||||||
return Ok(await _servInvoice.ChangeInvoiceType(Invoice, invoiceType));
|
return Ok(await _servInvoice.ChangeInvoiceType(Invoice, invoiceType));
|
||||||
@@ -320,7 +326,7 @@ namespace Back.Controllers
|
|||||||
|
|
||||||
case InvoiceType.BackFrmSale:
|
case InvoiceType.BackFrmSale:
|
||||||
await _servInvoice.ChangeInvoiceType(Invoice, invoiceType, false);
|
await _servInvoice.ChangeInvoiceType(Invoice, invoiceType, false);
|
||||||
return Ok(await _servInvoice.AddInvoice(new Invoice()
|
var result2 = await _servInvoice.AddInvoice(new Invoice()
|
||||||
{
|
{
|
||||||
|
|
||||||
Title = Invoice.Title,
|
Title = Invoice.Title,
|
||||||
@@ -334,7 +340,10 @@ namespace Back.Controllers
|
|||||||
BillReference = Invoice.ID,
|
BillReference = Invoice.ID,
|
||||||
IsDeleted = false,
|
IsDeleted = false,
|
||||||
PatternID = Invoice.PatternID
|
PatternID = Invoice.PatternID
|
||||||
}, false));
|
}, false);
|
||||||
|
if (result2 > 0)
|
||||||
|
return Ok(await _servInvoice.GetInvoice(user.RolUsers.First().CompanyID, result2));
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return BadRequest(new List<string> { $"تغییر وضعیت از {Invoice.invoiceType.GetEnumDisplayName()} به {invoiceType.GetEnumDisplayName()} امکان پذیر نیست این صورتحساب به سامانه مودیان ارسال شده" });
|
return BadRequest(new List<string> { $"تغییر وضعیت از {Invoice.invoiceType.GetEnumDisplayName()} به {invoiceType.GetEnumDisplayName()} امکان پذیر نیست این صورتحساب به سامانه مودیان ارسال شده" });
|
||||||
@@ -362,23 +371,23 @@ namespace Back.Controllers
|
|||||||
case InvoiceType.Cancellation:
|
case InvoiceType.Cancellation:
|
||||||
return Ok(await _servInvoice.ChangeInvoiceType(Invoice, invoiceType));
|
return Ok(await _servInvoice.ChangeInvoiceType(Invoice, invoiceType));
|
||||||
|
|
||||||
case InvoiceType.Repair:
|
//case InvoiceType.Repair:
|
||||||
await _servInvoice.ChangeInvoiceType(Invoice, invoiceType, false);
|
// await _servInvoice.ChangeInvoiceType(Invoice, invoiceType, false);
|
||||||
return Ok(await _servInvoice.AddInvoice(new Invoice()
|
// return Ok(await _servInvoice.AddInvoice(new Invoice()
|
||||||
{
|
// {
|
||||||
|
|
||||||
Title = Invoice.Title,
|
// Title = Invoice.Title,
|
||||||
Des = Invoice.Des,
|
// Des = Invoice.Des,
|
||||||
invoiceType = invoiceType,
|
// invoiceType = invoiceType,
|
||||||
CustomerID = Invoice.CustomerID,
|
// CustomerID = Invoice.CustomerID,
|
||||||
CompanyID = Invoice.CompanyID,
|
// CompanyID = Invoice.CompanyID,
|
||||||
InvoicIssueDate = Invoice.InvoicIssueDate.Replace("/", ""),
|
// InvoicIssueDate = Invoice.InvoicIssueDate.Replace("/", ""),
|
||||||
InvoiceDate = Invoice.InvoicIssueDate.Replace("/", ""),
|
// InvoiceDate = Invoice.InvoicIssueDate.Replace("/", ""),
|
||||||
LastChangeUserID = Convert.ToInt32(UserID),
|
// LastChangeUserID = Convert.ToInt32(UserID),
|
||||||
BillReference = Invoice.ID,
|
// BillReference = Invoice.ID,
|
||||||
IsDeleted = false,
|
// IsDeleted = false,
|
||||||
PatternID = Invoice.PatternID
|
// PatternID = Invoice.PatternID
|
||||||
}, false));
|
// }, false));
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return BadRequest(new List<string> { $"تغییر وضعیت از {Invoice.invoiceType.GetEnumDisplayName()} به {invoiceType.GetEnumDisplayName()} امکان پذیر نیست این صورتحساب به سامانه مودیان ارسال شده" });
|
return BadRequest(new List<string> { $"تغییر وضعیت از {Invoice.invoiceType.GetEnumDisplayName()} به {invoiceType.GetEnumDisplayName()} امکان پذیر نیست این صورتحساب به سامانه مودیان ارسال شده" });
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ namespace Back.Services
|
|||||||
{
|
{
|
||||||
#region AdvancedSearch
|
#region AdvancedSearch
|
||||||
var invok = _invoiceRepo
|
var invok = _invoiceRepo
|
||||||
.Get(w => w.CompanyID == CompanyID && !w.IsDeleted);
|
.Get(w => w.CompanyID == CompanyID && !w.IsDeleted && !w.BillReference.HasValue);
|
||||||
|
|
||||||
if (itemSerch.InvoiceID != null)
|
if (itemSerch.InvoiceID != null)
|
||||||
invok = invok.Where(w => w.ID == itemSerch.InvoiceID);
|
invok = invok.Where(w => w.ID == itemSerch.InvoiceID);
|
||||||
@@ -209,7 +209,7 @@ namespace Back.Services
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public async Task<bool> ChangeInvoiceType(Invoice invoiceitem, InvoiceType item, bool action = true)
|
public async Task<InvoiceDTO?> ChangeInvoiceType(Invoice invoiceitem, InvoiceType item, bool action = true)
|
||||||
{
|
{
|
||||||
string old = invoiceitem.invoiceType.GetEnumDisplayName();
|
string old = invoiceitem.invoiceType.GetEnumDisplayName();
|
||||||
invoiceitem.invoiceType = item;
|
invoiceitem.invoiceType = item;
|
||||||
@@ -226,8 +226,19 @@ namespace Back.Services
|
|||||||
UserID = invoiceitem.LastChangeUserID
|
UserID = invoiceitem.LastChangeUserID
|
||||||
});
|
});
|
||||||
if (action)
|
if (action)
|
||||||
return await _invoiceRepo.UpdateAsync(invoiceitem);
|
{
|
||||||
else return true;
|
var result = await _invoiceRepo.UpdateAsync(invoiceitem);
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
return await GetInvoice(invoiceitem.CompanyID.Value, invoiceitem.ID);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else return await GetInvoice(invoiceitem.CompanyID.Value, invoiceitem.ID);
|
||||||
//_contextMongodb.InsertItem(new SysLog()
|
//_contextMongodb.InsertItem(new SysLog()
|
||||||
//{
|
//{
|
||||||
// TraceIdentifierID = _httpContextAccessor.HttpContext.TraceIdentifier,
|
// TraceIdentifierID = _httpContextAccessor.HttpContext.TraceIdentifier,
|
||||||
@@ -249,7 +260,7 @@ namespace Back.Services
|
|||||||
// Route = _httpContextAccessor.HttpContext.Request.Path,
|
// Route = _httpContextAccessor.HttpContext.Request.Path,
|
||||||
// Type = "catch"
|
// Type = "catch"
|
||||||
//});
|
//});
|
||||||
return false;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
<div class="@NavMenuCssClass nav-scrollable" @onclick="ToggleNavMenu">
|
<div class="@NavMenuCssClass nav-scrollable" @onclick="ToggleNavMenu">
|
||||||
<nav class="flex-column">
|
<nav class="flex-column">
|
||||||
<div class="nav-item px-3">
|
<div class="nav-item px-3">
|
||||||
<NavLink class="nav-link" href="" Match="NavLinkMatch.All">
|
<NavLink class="nav-link" href="/" Match="NavLinkMatch.All">
|
||||||
<span class="bi bi-house-door-fill-nav-menu" aria-hidden="true"></span> Home
|
<span class="bi bi-house-door-fill-nav-menu" aria-hidden="true"></span> Home
|
||||||
</NavLink>
|
</NavLink>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -27,30 +27,30 @@
|
|||||||
@switch (invoice.invoiceType)
|
@switch (invoice.invoiceType)
|
||||||
{
|
{
|
||||||
case(InvoiceType.Bidding):
|
case(InvoiceType.Bidding):
|
||||||
<button class="button" id="cut"><span>فاکتور</span></button>
|
<button class="button" @onclick="() => ChangeStatus(InvoiceType.Sale)" id="cut"><span>فاکتور</span></button>
|
||||||
<button class="button" id="sred1"><span>لغو</span></button>
|
<button class="button" @onclick="() => ChangeStatus(InvoiceType.CANCEL)" id="sred1"><span>لغو</span></button>
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case (InvoiceType.Sale):
|
case (InvoiceType.Sale):
|
||||||
<button class="button" id="copy"><span>برگشت فروش</span></button>
|
<button class="button" @onclick="() => ChangeStatus(InvoiceType.BackFrmSale)" id="copy"><span>برگشت فروش</span></button>
|
||||||
<button class="button" id="paste"><span>اصلاح</span></button>
|
<button class="button" @onclick="() => ChangeStatus(InvoiceType.Repair)" id="paste"><span>اصلاح</span></button>
|
||||||
<button class="button" id="sred"><span>ابطال</span></button>
|
<button class="button" @onclick="() => ChangeStatus(InvoiceType.Cancellation)" id="sred"><span>ابطال</span></button>
|
||||||
<button class="button" id="sred1"><span>لغو</span></button>
|
<button class="button" id="sred1" @onclick="() => ChangeStatus(InvoiceType.CANCEL)"><span>لغو</span></button>
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case (InvoiceType.BackFrmSale):
|
case (InvoiceType.BackFrmSale):
|
||||||
<button class="button" id="sred"><span>ابطال</span></button>
|
<button class="button" @onclick="() => ChangeStatus(InvoiceType.Cancellation)" id="sred"><span>ابطال</span></button>
|
||||||
<button class="button" id="sred1"><span>لغو</span></button>
|
<button class="button" @onclick="() => ChangeStatus(InvoiceType.CANCEL)" id="sred1"><span>لغو</span></button>
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case (InvoiceType.Repair):
|
case (InvoiceType.Repair):
|
||||||
<button class="button" id="sred"><span>ابطال</span></button>
|
<button class="button" @onclick="() => ChangeStatus(InvoiceType.Cancellation)" id="sred"><span>ابطال</span></button>
|
||||||
<button class="button" id="sred1"><span>لغو</span></button>
|
<button class="button" @onclick="() => ChangeStatus(InvoiceType.CANCEL)" id="sred1"><span>لغو</span></button>
|
||||||
<button class="button" id="copy"><span>برگشت فروش</span></button>
|
<button class="button" id="copy" @onclick="() => ChangeStatus(InvoiceType.BackFrmSale)"><span>برگشت فروش</span></button>
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case (InvoiceType.Cancellation):
|
case (InvoiceType.Cancellation):
|
||||||
<button class="button" id="sred1"><span>لغو</span></button>
|
<button class="button" id="sred1" @onclick="() => ChangeStatus(InvoiceType.CANCEL)"><span>لغو</span></button>
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -236,6 +236,13 @@
|
|||||||
<InputText style=" text-align: center;" @bind-Value="invoice.Udate" class="form-control" id="inputUdate" readonly />
|
<InputText style=" text-align: center;" @bind-Value="invoice.Udate" class="form-control" id="inputUdate" readonly />
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@* @if (invoice.BillReference.HasValue)
|
||||||
|
{
|
||||||
|
<div class="row g-3">
|
||||||
|
<Button Color="ButtonColor.Link"><NavLink href="InvoiceDetails/@invoice.BillReference.Value">صورتحساب مرجع</NavLink></Button>
|
||||||
|
</div>
|
||||||
|
} *@
|
||||||
|
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<br />
|
<br />
|
||||||
@if (InvoiceID == 0 || InvoiceID == null)
|
@if (InvoiceID == 0 || InvoiceID == null)
|
||||||
@@ -337,6 +344,27 @@
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
private async Task ChangeStatus(InvoiceType type)
|
||||||
|
{
|
||||||
|
var rsp = await hc.Post<InvoiceType>($"Invoice/ChangeInvoiceType/{InvoiceID}",type);
|
||||||
|
if (rsp.IsSuccessStatusCode)
|
||||||
|
{
|
||||||
|
var resinvoice = await rsp.Content.ReadFromJsonAsync<InvoiceDTO>();
|
||||||
|
if (resinvoice!=null)
|
||||||
|
{
|
||||||
|
invoice = resinvoice;
|
||||||
|
ShowSuccessAlert("تغییر وضعیت با موفقیت انجام شد");
|
||||||
|
}
|
||||||
|
else ShowDangerAlert("خطایی در اجرای عملیات رخ داده");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var request = await rsp.Content.ReadFromJsonAsync<List<string>>();
|
||||||
|
ShowDangerAlert(request[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private async Task LoadData()
|
private async Task LoadData()
|
||||||
{
|
{
|
||||||
PreloadService.Show(SpinnerColor.Dark);
|
PreloadService.Show(SpinnerColor.Dark);
|
||||||
|
|||||||
@@ -34,9 +34,9 @@ builder.Services.AddScoped(sp => new UserAuthenticationDTO()
|
|||||||
}) ;
|
}) ;
|
||||||
|
|
||||||
|
|
||||||
//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/") });
|
||||||
|
|
||||||
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