...
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()
|
||||
|
@@ -20,7 +20,7 @@ namespace Shared.DTOs
|
||||
public int ID { get; set; }
|
||||
public List<Fild> filds { get; set; }
|
||||
}
|
||||
public class Fild
|
||||
public class Fild:ICloneable
|
||||
{
|
||||
public int FildID { get; set; }
|
||||
public string fName { get; set; }
|
||||
@@ -32,6 +32,11 @@ namespace Shared.DTOs
|
||||
public List<Coding> DefVals { get; set; }
|
||||
public string? Value { get; set; }
|
||||
public string[]? Des { get; set; }
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
return this.MemberwiseClone();
|
||||
}
|
||||
}
|
||||
public class Coding
|
||||
{
|
||||
|
@@ -312,8 +312,11 @@ else
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
var rsp = await hc.Post<_TaxPayer.Atemplatefield>($"TaxPayer/PreparationInvoiceBeforeSending", invoice);
|
||||
string route = "PreparationInvoiceBeforeSending";
|
||||
if (FullInvoice)
|
||||
route = "UpdateInvoice";
|
||||
|
||||
var rsp = await hc.Post<_TaxPayer.Atemplatefield>($"TaxPayer/{route}", invoice);
|
||||
if (rsp.IsSuccessStatusCode)
|
||||
{
|
||||
var response = await rsp.Content.ReadFromJsonAsync<bool>();
|
||||
@@ -322,7 +325,7 @@ else
|
||||
if (FullInvoice)
|
||||
ShowMessage(ToastType.Success, "تغییرات با موفقیت انجام شد");
|
||||
|
||||
if (!FullInvoice)
|
||||
else
|
||||
{
|
||||
ShowMessage(ToastType.Light, "در حال ارسال صورتحساب");
|
||||
rsp = await hc.Get($"TaxPayer/SendInvoice/{InvoiceID}");
|
||||
@@ -349,9 +352,6 @@ else
|
||||
}
|
||||
else
|
||||
{
|
||||
if (FullInvoice)
|
||||
ShowMessage(ToastType.Danger, "خطای در ذخیره سازی اطلاعات رخ داده");
|
||||
else
|
||||
ShowMessage(ToastType.Danger, "خطای در آماده سازی اطلاعات رخ داده");
|
||||
}
|
||||
}
|
||||
|
@@ -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