...
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>
|
||||
|
||||
|
@@ -12,6 +12,11 @@ namespace Back.Common
|
||||
{
|
||||
public static class ExtentionMethods
|
||||
{
|
||||
public static List<T> Clone<T>(this IList<T> listToClone) where T : ICloneable
|
||||
{
|
||||
return listToClone.Select(item => (T)item.Clone()).ToList();
|
||||
}
|
||||
|
||||
public static string GetEnumDisplayName(this Enum enumType)
|
||||
{
|
||||
return enumType.GetType().GetMember(enumType.ToString())
|
||||
|
@@ -72,6 +72,38 @@ namespace Back.Controllers
|
||||
}
|
||||
[HttpPost("PreparationInvoiceBeforeSending")]
|
||||
public async Task<ActionResult<bool>> PreparationInvoiceBeforeSending([FromBody] Atemplatefield item)
|
||||
{
|
||||
var claim = HttpContext.User.Claims.First(c => c.Type == "UserID");
|
||||
var UserID = claim.Value;
|
||||
var user = await _servUser.GetUserByUserID(Convert.ToInt32(UserID));
|
||||
var result = await _servTaxPayer.GetInvoice(user.RolUsers.First().CompanyID, item.header.ID);
|
||||
if (result == null)
|
||||
return BadRequest(new List<string> { "صورتحساب یافت نشد" });
|
||||
|
||||
else
|
||||
{
|
||||
if (result.invoiceType == InvoiceType.Bidding)
|
||||
return BadRequest(new List<string> { "صورتحساب در وضعیت پیش نویس نمیتواند آماده ارسال شود" });
|
||||
|
||||
if (await _servTaxPayer.ExistSuccessfulorSendorpendingInvoice(result))
|
||||
return BadRequest(new List<string> { "این صورتحساب قبلا به سازمان ارسال شده" });
|
||||
|
||||
if ((result.invoiceType == InvoiceType.BackFrmSale || result.invoiceType == InvoiceType.Repair)
|
||||
&& !result.BillReference.HasValue)
|
||||
return BadRequest(new List<string> { "در وضعیت برگشت از فروش و اصلاحی باید صورتحساب مرجع وجود داشته باشد" });
|
||||
|
||||
|
||||
if ((result.invoiceType == InvoiceType.BackFrmSale || result.invoiceType == InvoiceType.Repair)
|
||||
&& !await _servTaxPayer.ExistSuccessfulorSendorpendingInvoice(result.invoice))
|
||||
return BadRequest(new List<string> { "در وضعیت برگشت از فروش و اصلاحی باید صورتحساب مرجع به سامانه مودیان ارسال شده باشد" });
|
||||
|
||||
}
|
||||
|
||||
|
||||
return Ok(await _servTaxPayer.PreparationInvoiceBeforeSending(item, result));
|
||||
}
|
||||
[HttpPost("UpdateInvoice")]
|
||||
public async Task<ActionResult<bool>> UpdateInvoice([FromBody] Atemplatefield item)
|
||||
{
|
||||
var claim = HttpContext.User.Claims.First(c => c.Type == "UserID");
|
||||
var UserID = claim.Value;
|
||||
@@ -85,8 +117,9 @@ namespace Back.Controllers
|
||||
// if (result.invoiceType == InvoiceType.Bidding)
|
||||
// return BadRequest(new List<string> { "صورتحساب در وضعیت پیش نویس نمیتواند آماده ارسال شود" });
|
||||
|
||||
// if (await _servTaxPayer.ExistSuccessfulorSendorpendingInvoice(result))
|
||||
// return BadRequest(new List<string> { "این صورتحساب قبلا به سازمان ارسال شده" });
|
||||
if (await _servTaxPayer.ExistSuccessfulorSendorpendingInvoice(result))
|
||||
return BadRequest(new List<string> { "این صورتحساب به سازمان ارسال شده"+'\n'+
|
||||
"برای تغییر ،صورتحساب را ابطال/اصلاح یا برگشت بزنید" });
|
||||
|
||||
// if ((result.invoiceType == InvoiceType.BackFrmSale || result.invoiceType == InvoiceType.Repair)
|
||||
// && !result.BillReference.HasValue)
|
||||
|
@@ -223,7 +223,12 @@ namespace Back.Services
|
||||
{
|
||||
return await _invoiceRepo
|
||||
.Get(w => w.ID == InvoiceID && w.CompanyID == CompanyID && !w.IsDeleted)
|
||||
.Include(inc => inc.invoiceDetails)
|
||||
.Include(inc => inc.invoiceDetails)
|
||||
.ThenInclude(inc => inc.cODItem)
|
||||
.ThenInclude(inc => inc.CODUnit)
|
||||
.Include(inc => inc.Customer)
|
||||
.Include(inc => inc.sentTax)
|
||||
.Include(inc => inc.pattern)
|
||||
.FirstOrDefaultAsync();
|
||||
}
|
||||
public async Task<bool> DeleteInvoice(Invoice item)
|
||||
|
@@ -130,14 +130,15 @@ namespace Back.Services
|
||||
}).ToListAsync();
|
||||
foreach (var invoicedetail in InvoiceItem.invoiceDetails)
|
||||
{
|
||||
foreach (_TaxPayer.Fild item in body)
|
||||
var Bmodel = body.Clone();
|
||||
foreach (_TaxPayer.Fild item in Bmodel)
|
||||
{
|
||||
var resval = invoicedetail.GetType().GetProperties().Where(w => w.Name == item.eName).Select(s => s.GetValue(invoicedetail)).FirstOrDefault();
|
||||
item.Value = resval == null ? "" : resval.ToString().Split('.').Length == 2 ? ((decimal)resval).ToString("N0") : resval.ToString();
|
||||
item.DefVals = item.InputBox == "fromdb" ? _codingRepo.Get(w => w.FildID == item.FildID).Select(ss => new _TaxPayer.Coding() { ID = ss.Code, Name = ss.Title }).ToList() : new List<_TaxPayer.Coding>();
|
||||
item.Des = item.ModeID == 3 ? _specialConditionRepo.Get(w => w.FildID == item.FildID).Select(ss => ss.condition).ToArray() : null;
|
||||
}
|
||||
ret.Bodys.Add(new _TaxPayer.Filds() { ID = invoicedetail.ID, filds = body });
|
||||
ret.Bodys.Add(new _TaxPayer.Filds() { ID = invoicedetail.ID, filds = Bmodel });
|
||||
}
|
||||
//-----------------payment
|
||||
var pay = await invok.Where(w => w.Fild.Title == "P").Select(s => new _TaxPayer.Fild()
|
||||
|
Reference in New Issue
Block a user