...
This commit is contained in:
@@ -4,6 +4,7 @@ using Back.Services;
|
||||
using Back.Validations;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Http.HttpResults;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Shared.DTOs;
|
||||
using Shared.DTOs.Serch;
|
||||
@@ -38,7 +39,7 @@ namespace Back.Controllers
|
||||
|
||||
}
|
||||
[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 UserID = claim.Value;
|
||||
@@ -191,7 +192,7 @@ namespace Back.Controllers
|
||||
return Ok(await _servInvoice.DeleteInvoice(invoice));
|
||||
}
|
||||
[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
|
||||
var claim = HttpContext.User.Claims.First(c => c.Type == "UserID");
|
||||
@@ -229,7 +230,7 @@ namespace Back.Controllers
|
||||
|
||||
case InvoiceType.Repair:
|
||||
await _servInvoice.ChangeInvoiceType(Invoice, invoiceType, false);
|
||||
return Ok(await _servInvoice.AddInvoice(new Invoice()
|
||||
var result = await _servInvoice.AddInvoice(new Invoice()
|
||||
{
|
||||
|
||||
Title = Invoice.Title,
|
||||
@@ -243,11 +244,13 @@ namespace Back.Controllers
|
||||
BillReference = Invoice.ID,
|
||||
IsDeleted = false,
|
||||
PatternID = Invoice.PatternID
|
||||
}, false));
|
||||
|
||||
}, false);
|
||||
if (result > 0)
|
||||
return Ok(await _servInvoice.GetInvoice(user.RolUsers.First().CompanyID,result));
|
||||
break;
|
||||
case InvoiceType.BackFrmSale:
|
||||
await _servInvoice.ChangeInvoiceType(Invoice, invoiceType, false);
|
||||
return Ok(await _servInvoice.AddInvoice(new Invoice()
|
||||
var result1 = await _servInvoice.AddInvoice(new Invoice()
|
||||
{
|
||||
|
||||
Title = Invoice.Title,
|
||||
@@ -261,7 +264,10 @@ namespace Back.Controllers
|
||||
BillReference = Invoice.ID,
|
||||
IsDeleted = false,
|
||||
PatternID = Invoice.PatternID
|
||||
}, false));
|
||||
}, false);
|
||||
if (result1 > 0)
|
||||
return Ok(await _servInvoice.GetInvoice(user.RolUsers.First().CompanyID, result1));
|
||||
break;
|
||||
|
||||
default:
|
||||
return BadRequest(new List<string> { $"تغییر وضعیت از {Invoice.invoiceType.GetEnumDisplayName()} به {invoiceType.GetEnumDisplayName()} امکان پذیر نیست این صورتحساب به سامانه مودیان ارسال شده" });
|
||||
@@ -286,8 +292,8 @@ namespace Back.Controllers
|
||||
{
|
||||
switch (invoiceType)
|
||||
{
|
||||
case InvoiceType.Sale:
|
||||
return Ok(await _servInvoice.ChangeInvoiceType(Invoice, invoiceType));
|
||||
//case InvoiceType.Sale:
|
||||
// return Ok(await _servInvoice.ChangeInvoiceType(Invoice, invoiceType));
|
||||
|
||||
case InvoiceType.CANCEL:
|
||||
return Ok(await _servInvoice.ChangeInvoiceType(Invoice, invoiceType));
|
||||
@@ -320,7 +326,7 @@ namespace Back.Controllers
|
||||
|
||||
case InvoiceType.BackFrmSale:
|
||||
await _servInvoice.ChangeInvoiceType(Invoice, invoiceType, false);
|
||||
return Ok(await _servInvoice.AddInvoice(new Invoice()
|
||||
var result2 = await _servInvoice.AddInvoice(new Invoice()
|
||||
{
|
||||
|
||||
Title = Invoice.Title,
|
||||
@@ -334,7 +340,10 @@ namespace Back.Controllers
|
||||
BillReference = Invoice.ID,
|
||||
IsDeleted = false,
|
||||
PatternID = Invoice.PatternID
|
||||
}, false));
|
||||
}, false);
|
||||
if (result2 > 0)
|
||||
return Ok(await _servInvoice.GetInvoice(user.RolUsers.First().CompanyID, result2));
|
||||
break;
|
||||
|
||||
default:
|
||||
return BadRequest(new List<string> { $"تغییر وضعیت از {Invoice.invoiceType.GetEnumDisplayName()} به {invoiceType.GetEnumDisplayName()} امکان پذیر نیست این صورتحساب به سامانه مودیان ارسال شده" });
|
||||
@@ -362,23 +371,23 @@ namespace Back.Controllers
|
||||
case InvoiceType.Cancellation:
|
||||
return Ok(await _servInvoice.ChangeInvoiceType(Invoice, invoiceType));
|
||||
|
||||
case InvoiceType.Repair:
|
||||
await _servInvoice.ChangeInvoiceType(Invoice, invoiceType, false);
|
||||
return Ok(await _servInvoice.AddInvoice(new Invoice()
|
||||
{
|
||||
//case InvoiceType.Repair:
|
||||
// await _servInvoice.ChangeInvoiceType(Invoice, invoiceType, false);
|
||||
// return Ok(await _servInvoice.AddInvoice(new Invoice()
|
||||
// {
|
||||
|
||||
Title = Invoice.Title,
|
||||
Des = Invoice.Des,
|
||||
invoiceType = invoiceType,
|
||||
CustomerID = Invoice.CustomerID,
|
||||
CompanyID = Invoice.CompanyID,
|
||||
InvoicIssueDate = Invoice.InvoicIssueDate.Replace("/", ""),
|
||||
InvoiceDate = Invoice.InvoicIssueDate.Replace("/", ""),
|
||||
LastChangeUserID = Convert.ToInt32(UserID),
|
||||
BillReference = Invoice.ID,
|
||||
IsDeleted = false,
|
||||
PatternID = Invoice.PatternID
|
||||
}, false));
|
||||
// Title = Invoice.Title,
|
||||
// Des = Invoice.Des,
|
||||
// invoiceType = invoiceType,
|
||||
// CustomerID = Invoice.CustomerID,
|
||||
// CompanyID = Invoice.CompanyID,
|
||||
// InvoicIssueDate = Invoice.InvoicIssueDate.Replace("/", ""),
|
||||
// InvoiceDate = Invoice.InvoicIssueDate.Replace("/", ""),
|
||||
// LastChangeUserID = Convert.ToInt32(UserID),
|
||||
// BillReference = Invoice.ID,
|
||||
// IsDeleted = false,
|
||||
// PatternID = Invoice.PatternID
|
||||
// }, false));
|
||||
|
||||
default:
|
||||
return BadRequest(new List<string> { $"تغییر وضعیت از {Invoice.invoiceType.GetEnumDisplayName()} به {invoiceType.GetEnumDisplayName()} امکان پذیر نیست این صورتحساب به سامانه مودیان ارسال شده" });
|
||||
|
Reference in New Issue
Block a user