diff --git a/Back/Controllers/TaxPayerController.cs b/Back/Controllers/TaxPayerController.cs index 98d8c2e..c5558d0 100644 --- a/Back/Controllers/TaxPayerController.cs +++ b/Back/Controllers/TaxPayerController.cs @@ -46,7 +46,7 @@ namespace Back.Controllers else { - if (!result.PatternID.HasValue || result.PatternID==0) + if (!result.PatternID.HasValue || result.PatternID == 0) return BadRequest(new List { "ابتدا برای این صورتحساب الگو در نظر بگیرید" }); if (result.invoiceType == InvoiceType.Bidding) @@ -90,8 +90,8 @@ namespace Back.Controllers //var claim = HttpContext.User.Claims.First(c => c.Type == "UserID"); //var UserID = claim.Value; //var user = await _servUser.GetUserByUserID(Convert.ToInt32(UserID)); - // return Ok(await _actionTaxPayer.login(user.RolUsers.First().CompanyID)); - return Ok(true); + // return Ok(await _actionTaxPayer.login(user.RolUsers.First().CompanyID)); + return Ok(true); return BadRequest(); @@ -425,7 +425,7 @@ namespace Back.Controllers InvoiceBody.Add(item); } - + var responseModel = await _actionTaxPayer.SendInvoice(user.RolUsers.First().CompanyID, header, InvoiceBody, new PaymentDto { }); if (responseModel == null) { @@ -435,6 +435,8 @@ namespace Back.Controllers { foreach (var item in responseModel.Body.Result) { + //ta imja + var ressenttax = new SentTax { InvoiceID = result.ID, @@ -444,7 +446,8 @@ namespace Back.Controllers ReferenceNumber = item.ReferenceNumber, uId = item.Uid, SentStatus = SentStatus.Send, - InvoiceModel = JsonConvert.SerializeObject(result), + InvoiceModel = JsonConvert.SerializeObject(result, Formatting.Indented,new JsonSerializerSettings + { PreserveReferencesHandling = PreserveReferencesHandling.Objects }), ResponseModel = JsonConvert.SerializeObject(responseModel) }; await _servTaxPayer.AddSentTax(ressenttax); @@ -495,11 +498,11 @@ namespace Back.Controllers return BadRequest(new List { "خطا در احراز هویت سازمان مالیاتی" }); DataInSendTaxDto desData = new DataInSendTaxDto(); - if (item.SentStatus==SentStatus.Send + if (item.SentStatus == SentStatus.Send || item.SentStatus == SentStatus.pending || item.SentStatus == SentStatus.IN_PROGRESS) { - + var result = await _actionTaxPayer.GetResultByUid(user.RolUsers.First().CompanyID, item.uId); if (result == null) diff --git a/Back/Data/Models/Invoice.cs b/Back/Data/Models/Invoice.cs index 3b00fe7..95e44b1 100644 --- a/Back/Data/Models/Invoice.cs +++ b/Back/Data/Models/Invoice.cs @@ -1,5 +1,6 @@ using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; +using System.Text.Json.Serialization; using Back.Common; using Shared.DTOs; namespace Back.Data.Models @@ -72,7 +73,7 @@ namespace Back.Data.Models //اریخ کوتاژ اظهارنامه گمرکی // Unix Time => from fild CottageDateOfCustomsDeclaration [MaxLength(5)] - public long? cdcd { get { return new DateTimeOffset(CottageDateOfCustomsDeclaration.Trim().ToMiladi()).ToUnixTimeMilliseconds(); } } + public long? cdcd { get { return string.IsNullOrEmpty(CottageDateOfCustomsDeclaration) ? null : new DateTimeOffset(CottageDateOfCustomsDeclaration.Trim().ToMiladi()).ToUnixTimeMilliseconds(); } } //کد پستی خریدار [MaxLength(10)] public string? bpc { get { return Customer.ZipCode; } } @@ -175,6 +176,7 @@ namespace Back.Data.Models [ForeignKey("PatternID")] public virtual Pattern? pattern { get; set; } [ForeignKey("CompanyID")] + [JsonIgnore] public virtual Company? company { get; set; } #endregion } diff --git a/Back/Services/ActionTaxPayer.cs b/Back/Services/ActionTaxPayer.cs index f3093fb..4d05c15 100644 --- a/Back/Services/ActionTaxPayer.cs +++ b/Back/Services/ActionTaxPayer.cs @@ -21,6 +21,7 @@ namespace Back.Services } public string GenerateTaxid(string FactorNo, string InvoiceDate) { + return "testTaxid"; return TaxApiService.Instance.TaxIdGenerator.GenerateTaxId(_UniqueMemory, Convert.ToInt64(FactorNo), InvoiceDate.ToMiladi()); } @@ -36,8 +37,12 @@ namespace Back.Services } public async Task> SendInvoice(int CompanyID,InvoiceHeaderDto header, List InvoiceBody, PaymentDto payment) { - var stringtest = "{\"ReferenceNumber\":\"18084a18-1eb4-41cd-8bd3-2cad73c45398\",\"Uid\":\"0a4a4ab2-8047-4c31-b765-456ddf0e9c53\",\"Status\":\"SUCCESS\",\"Data\":{\"ValueKind\":1},\"PacketType\":\"receive_invoice_confirm\",\"FiscalId\":\"A2FFKZ\"}"; - return JsonConvert.DeserializeObject>(stringtest); + return new TaxCollectData.Library.Dto.HttpResponse + ( body: new AsyncResponseModel( + 1702299112 + ,new HashSet(new List { new PacketResponse("5d0c7198-e2fd-4cc1-8802-fe498d6ccf73", "a70444a4-1810-4cea-8bcc-7acb4bc75645", null,null)}) + ,new List()), 200); + if (!await login(CompanyID)) return null; return await TaxApiService.Instance.TaxApis.SendInvoicesAsync(new List() diff --git a/TaxPayerFull/Pages/UserPanel/InvoiceItem.razor b/TaxPayerFull/Pages/UserPanel/InvoiceItem.razor index 9c2036a..b8a6c01 100644 --- a/TaxPayerFull/Pages/UserPanel/InvoiceItem.razor +++ b/TaxPayerFull/Pages/UserPanel/InvoiceItem.razor @@ -340,12 +340,12 @@ - + *@ } } diff --git a/TaxPayerFull/Program.cs b/TaxPayerFull/Program.cs index 670070e..ea0270a 100644 --- a/TaxPayerFull/Program.cs +++ b/TaxPayerFull/Program.cs @@ -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");