...
This commit is contained in:
@@ -35,7 +35,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="Service">
|
||||
<HintPath>..\..\Dlls\Service.dll</HintPath>
|
||||
<HintPath>..\..\..\LocalGit\TaxPayerTools\Service\bin\Debug\Service.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
using Back.Services;
|
||||
using Back.Data.Models;
|
||||
using Back.Services;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Shared.DTOs;
|
||||
@@ -17,7 +18,7 @@ namespace Back.Controllers
|
||||
_servUser = servUser;
|
||||
}
|
||||
[HttpGet("GetInvoice/{ID}")]
|
||||
public async Task<ActionResult<InvoiceDTO?>> Get(int ID)
|
||||
public async Task<ActionResult<_TaxPayer.Atemplatefield?>> Get(int ID)
|
||||
{
|
||||
var claim = HttpContext.User.Claims.First(c => c.Type == "UserID");
|
||||
var UserID = claim.Value;
|
||||
@@ -28,6 +29,12 @@ namespace Back.Controllers
|
||||
|
||||
else
|
||||
{
|
||||
if (!result.PatternID.HasValue)
|
||||
return BadRequest(new List<string> { "ابتدا برای این صورتحساب الگو در نظر بگیرید" });
|
||||
|
||||
if (result.invoiceType == InvoiceType.Bidding)
|
||||
return BadRequest(new List<string> { "صورتحساب در وضعیت پیش نویس نمیتواند ارسال شود" });
|
||||
|
||||
if (await _servTaxPayer.ExistSuccessfulorSendorpendingInvoice(result))
|
||||
return BadRequest(new List<string> { "این صورتحساب قبلا به سازمان ارسال شده"});
|
||||
|
||||
@@ -42,15 +49,7 @@ namespace Back.Controllers
|
||||
|
||||
|
||||
|
||||
if (!result.PatternID.HasValue)
|
||||
return BadRequest(new List<string> { "ابتدا برای این صورتحساب الگو در نظر بگیرید" });
|
||||
|
||||
if (result.invoiceType==InvoiceType.Bidding)
|
||||
return BadRequest(new List<string> { "صورتحساب در وضعیت پیش نویس نمیتواند ارسال شود" });
|
||||
|
||||
|
||||
|
||||
return Ok(result);
|
||||
return Ok(await _servTaxPayer.GetFildInvoiceForPreparation(result));
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -11,12 +11,19 @@ namespace Back.Services
|
||||
private readonly IAsyncRepository<SentTax> _repoSentTax;
|
||||
private readonly IAsyncRepository<Pattern> _repoPattern;
|
||||
private readonly IAsyncRepository<Invoice> _invoiceRepo;
|
||||
private readonly IAsyncRepository<FildModeInPattern> _fildModeInPatternRepo;
|
||||
private readonly IAsyncRepository<Coding> _codingRepo;
|
||||
private readonly IAsyncRepository<SpecialCondition> _specialConditionRepo;
|
||||
public servTaxPayer(IAsyncRepository<SentTax> repoSentTax, IAsyncRepository<Pattern> repoPattern
|
||||
, IAsyncRepository<Invoice> invoiceRepo)
|
||||
, IAsyncRepository<Invoice> invoiceRepo, IAsyncRepository<FildModeInPattern> fildModeInPatternRepo
|
||||
, IAsyncRepository<Coding> codingRepo, IAsyncRepository<SpecialCondition> specialConditionRepo)
|
||||
{
|
||||
_repoSentTax = repoSentTax;
|
||||
_repoPattern = repoPattern;
|
||||
_invoiceRepo = invoiceRepo;
|
||||
_fildModeInPatternRepo = fildModeInPatternRepo;
|
||||
_codingRepo = codingRepo;
|
||||
_specialConditionRepo = specialConditionRepo;
|
||||
}
|
||||
public async Task<bool> ExistSuccessfulorSendorpendingInvoiceinCompanyID(int CompanyID)
|
||||
{
|
||||
@@ -49,11 +56,94 @@ namespace Back.Services
|
||||
#endregion
|
||||
//-----------------------
|
||||
return await invok
|
||||
.Include(inc => inc.Customer)
|
||||
.Include(inc => inc.company)
|
||||
.Include(inc => inc.company)
|
||||
.Include(inc => inc.pattern)
|
||||
.Include(inc => inc.payments)
|
||||
.Include(inc => inc.invoice)
|
||||
.Include(inc => inc.invoiceDetails)
|
||||
.ThenInclude(inc => inc.cODItem)
|
||||
.ThenInclude(inc => inc.CODUnit)
|
||||
.FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
public async Task<_TaxPayer.Atemplatefield> GetFildInvoiceForPreparation(Invoice InvoiceItem)
|
||||
{
|
||||
_TaxPayer.Atemplatefield ret = new _TaxPayer.Atemplatefield();
|
||||
|
||||
|
||||
var invok = _fildModeInPatternRepo.Get
|
||||
(w => w.PatternID == InvoiceItem.PatternID && w.FildModeID != 4 && (w.Fild.InputBox == "fild" || w.Fild.InputBox == "fromdb" || w.Fild.InputBox == "autofild") && w.pattern.Status);
|
||||
|
||||
//-----------------------head
|
||||
var head = await invok.Where(w => w.Fild.Title == "H").Select(s => new _TaxPayer.Fild()
|
||||
{
|
||||
FildID = s.FildID,
|
||||
eName = s.Fild.Name == "indatim" ? "InvoicIssueDate" : s.Fild.Name == "Indati2m" ? "InvoiceDate" : s.Fild.Name == "cdcd" ? "CottageDateOfCustomsDeclaration" : s.Fild.Name,
|
||||
fName = s.Fild.Type,
|
||||
ModeID = s.FildModeID,
|
||||
ModeTitle = s.FildMode.Title,
|
||||
Title = s.Fild.Title,
|
||||
InputBox = s.Fild.Name == "indatim" || s.Fild.Name == "Indati2m" || s.Fild.Name == "cdcd" ? "fild" : s.Fild.InputBox
|
||||
|
||||
}).ToListAsync();
|
||||
foreach (_TaxPayer.Fild item in head)
|
||||
{
|
||||
var resval = InvoiceItem.GetType().GetProperties().Where(w => w.Name == item.eName).Select(s => s.GetValue(InvoiceItem)).FirstOrDefault();
|
||||
item.Value = resval == null ? "" : (item.eName == "InvoicIssueDate" || item.eName == "InvoiceDate" || item.eName == "CottageDateOfCustomsDeclaration" ? resval.ToString().ShamciToFormatShamci() : 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.header = new _TaxPayer.Filds() { ID = InvoiceItem.ID, filds = head };
|
||||
//-------------------body
|
||||
var body = await invok.Where(w => w.Fild.Title == "B").Select(s => new _TaxPayer.Fild()
|
||||
{
|
||||
FildID = s.FildID,
|
||||
eName = s.Fild.Name,
|
||||
fName = s.Fild.Type,
|
||||
ModeID = s.FildModeID,
|
||||
ModeTitle = s.FildMode.Title,
|
||||
Title = s.Fild.Title,
|
||||
InputBox = s.Fild.InputBox
|
||||
|
||||
}).ToListAsync();
|
||||
foreach (var invoicedetail in InvoiceItem.invoiceDetails)
|
||||
{
|
||||
foreach (_TaxPayer.Fild item in body)
|
||||
{
|
||||
var resval = InvoiceItem.GetType().GetProperties().Where(w => w.Name == item.eName).Select(s => s.GetValue(InvoiceItem)).FirstOrDefault();
|
||||
item.Value = resval == null ? "" : 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 });
|
||||
}
|
||||
//-----------------payment
|
||||
var pay = await invok.Where(w => w.Fild.Title == "P").Select(s => new _TaxPayer.Fild()
|
||||
{
|
||||
FildID = s.FildID,
|
||||
eName = s.Fild.Name == "pdt" ? "PaymentDateTime" : s.Fild.Name,
|
||||
fName = s.Fild.Type,
|
||||
ModeID = s.FildModeID,
|
||||
ModeTitle = s.FildMode.Title,
|
||||
Title = s.Fild.Title,
|
||||
InputBox = s.Fild.Name == "pdt" ? "fild" : s.Fild.InputBox
|
||||
|
||||
}).ToListAsync();
|
||||
foreach (var invoicepay in InvoiceItem.payments)
|
||||
{
|
||||
foreach (_TaxPayer.Fild item in pay)
|
||||
{
|
||||
var resval = InvoiceItem.GetType().GetProperties().Where(w => w.Name == item.eName).Select(s => s.GetValue(InvoiceItem)).FirstOrDefault();
|
||||
item.Value = resval == null ? "" : 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.Payments.Add(new _TaxPayer.Filds() { ID = invoicepay.ID, filds = pay });
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
42
Shared/DTOs/_TaxPayer.cs
Normal file
42
Shared/DTOs/_TaxPayer.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Shared.DTOs
|
||||
{
|
||||
public class _TaxPayer
|
||||
{
|
||||
public class Atemplatefield
|
||||
{
|
||||
public Filds header { get; set; }
|
||||
public List<Filds> Bodys { get; set; }
|
||||
public List<Filds> Payments { get; set; }
|
||||
|
||||
}
|
||||
public class Filds
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public List<Fild> filds { get; set; }
|
||||
}
|
||||
public class Fild
|
||||
{
|
||||
public int FildID { get; set; }
|
||||
public string fName { get; set; }
|
||||
public string eName { get; set; }
|
||||
public int ModeID { get; set; }
|
||||
public string ModeTitle { get; set; }
|
||||
public string Title { get; set; }
|
||||
public string InputBox { get; set; }
|
||||
public List<Coding> DefVals { get; set; }
|
||||
public string? Value { get; set; }
|
||||
public string[] Des { get; set; }
|
||||
}
|
||||
public class Coding
|
||||
{
|
||||
public string ID { get; set; }
|
||||
public string Name { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
@@ -296,7 +296,7 @@
|
||||
{
|
||||
<div class="form-group col-md-2">
|
||||
<br />
|
||||
<Button class="mt-3" Color="ButtonColor.Dark" @onclick="ShowReport" Type="ButtonType.Button">
|
||||
<Button class="mt-3" Color="ButtonColor.Dark" @onclick="showTaxPayer" Type="ButtonType.Button">
|
||||
ارسال به سامانه مودیان
|
||||
</Button>
|
||||
</div>
|
||||
@@ -419,7 +419,13 @@
|
||||
|
||||
}
|
||||
|
||||
|
||||
private async Task showTaxPayer()
|
||||
{
|
||||
if (InvoiceID.HasValue)
|
||||
{
|
||||
hc._nav.NavigateTo($"TaxPayerInvoiceItem/{InvoiceID}");
|
||||
}
|
||||
}
|
||||
private async Task ShowReport()
|
||||
{
|
||||
if (InvoiceID.HasValue)
|
||||
|
@@ -13,19 +13,19 @@
|
||||
[Parameter] public int? InvoiceID { get; set; }
|
||||
List<ToastMessage> messages = new List<ToastMessage>();
|
||||
[Inject] protected PreloadService PreloadService { get; set; } = default!;
|
||||
public InvoiceDTO? invoice { get; set; }
|
||||
public _TaxPayer.Atemplatefield? invoice { get; set; }
|
||||
// alert
|
||||
AlertColor alertColor = AlertColor.Primary;
|
||||
IconName alertIconName = IconName.CheckCircleFill;
|
||||
bool Hidealert = true;
|
||||
string alertMessage = "";
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
await LoadData();
|
||||
|
||||
await base.OnInitializedAsync();
|
||||
await base.OnParametersSetAsync();
|
||||
}
|
||||
|
||||
}
|
||||
@functions{
|
||||
private void ShowSuccessAlert(string msg)
|
||||
@@ -48,7 +48,7 @@
|
||||
var rsp = await hc.Get($"TaxPayer/GetInvoice/{InvoiceID}");
|
||||
if (rsp.IsSuccessStatusCode)
|
||||
{
|
||||
invoice = await rsp.Content.ReadFromJsonAsync<InvoiceDTO>();
|
||||
invoice = await rsp.Content.ReadFromJsonAsync<_TaxPayer.Atemplatefield?>();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@@ -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");
|
||||
|
||||
|
Reference in New Issue
Block a user