...
This commit is contained in:
@@ -35,7 +35,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="Service">
|
<Reference Include="Service">
|
||||||
<HintPath>..\..\Dlls\Service.dll</HintPath>
|
<HintPath>..\..\..\LocalGit\TaxPayerTools\Service\bin\Debug\Service.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
using Back.Services;
|
using Back.Data.Models;
|
||||||
|
using Back.Services;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Shared.DTOs;
|
using Shared.DTOs;
|
||||||
@@ -17,7 +18,7 @@ namespace Back.Controllers
|
|||||||
_servUser = servUser;
|
_servUser = servUser;
|
||||||
}
|
}
|
||||||
[HttpGet("GetInvoice/{ID}")]
|
[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 claim = HttpContext.User.Claims.First(c => c.Type == "UserID");
|
||||||
var UserID = claim.Value;
|
var UserID = claim.Value;
|
||||||
@@ -28,6 +29,12 @@ namespace Back.Controllers
|
|||||||
|
|
||||||
else
|
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))
|
if (await _servTaxPayer.ExistSuccessfulorSendorpendingInvoice(result))
|
||||||
return BadRequest(new List<string> { "این صورتحساب قبلا به سازمان ارسال شده"});
|
return BadRequest(new List<string> { "این صورتحساب قبلا به سازمان ارسال شده"});
|
||||||
|
|
||||||
@@ -40,17 +47,9 @@ namespace Back.Controllers
|
|||||||
&& !await _servTaxPayer.ExistSuccessfulorSendorpendingInvoice(result.invoice))
|
&& !await _servTaxPayer.ExistSuccessfulorSendorpendingInvoice(result.invoice))
|
||||||
return BadRequest(new List<string> { "در وضعیت برگشت از فروش و اصلاحی باید صورتحساب مرجع به سامانه مودیان ارسال شده باشد" });
|
return BadRequest(new List<string> { "در وضعیت برگشت از فروش و اصلاحی باید صورتحساب مرجع به سامانه مودیان ارسال شده باشد" });
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return Ok(await _servTaxPayer.GetFildInvoiceForPreparation(result));
|
||||||
if (!result.PatternID.HasValue)
|
|
||||||
return BadRequest(new List<string> { "ابتدا برای این صورتحساب الگو در نظر بگیرید" });
|
|
||||||
|
|
||||||
if (result.invoiceType==InvoiceType.Bidding)
|
|
||||||
return BadRequest(new List<string> { "صورتحساب در وضعیت پیش نویس نمیتواند ارسال شود" });
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return Ok(result);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -11,12 +11,19 @@ namespace Back.Services
|
|||||||
private readonly IAsyncRepository<SentTax> _repoSentTax;
|
private readonly IAsyncRepository<SentTax> _repoSentTax;
|
||||||
private readonly IAsyncRepository<Pattern> _repoPattern;
|
private readonly IAsyncRepository<Pattern> _repoPattern;
|
||||||
private readonly IAsyncRepository<Invoice> _invoiceRepo;
|
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
|
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;
|
_repoSentTax = repoSentTax;
|
||||||
_repoPattern = repoPattern;
|
_repoPattern = repoPattern;
|
||||||
_invoiceRepo = invoiceRepo;
|
_invoiceRepo = invoiceRepo;
|
||||||
|
_fildModeInPatternRepo = fildModeInPatternRepo;
|
||||||
|
_codingRepo = codingRepo;
|
||||||
|
_specialConditionRepo = specialConditionRepo;
|
||||||
}
|
}
|
||||||
public async Task<bool> ExistSuccessfulorSendorpendingInvoiceinCompanyID(int CompanyID)
|
public async Task<bool> ExistSuccessfulorSendorpendingInvoiceinCompanyID(int CompanyID)
|
||||||
{
|
{
|
||||||
@@ -49,11 +56,94 @@ namespace Back.Services
|
|||||||
#endregion
|
#endregion
|
||||||
//-----------------------
|
//-----------------------
|
||||||
return await invok
|
return await invok
|
||||||
.Include(inc => inc.invoice)
|
.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)
|
.Include(inc => inc.invoiceDetails)
|
||||||
.ThenInclude(inc => inc.cODItem)
|
.ThenInclude(inc => inc.cODItem)
|
||||||
.ThenInclude(inc => inc.CODUnit)
|
.ThenInclude(inc => inc.CODUnit)
|
||||||
.FirstOrDefaultAsync();
|
.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">
|
<div class="form-group col-md-2">
|
||||||
<br />
|
<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>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
@@ -419,7 +419,13 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task showTaxPayer()
|
||||||
|
{
|
||||||
|
if (InvoiceID.HasValue)
|
||||||
|
{
|
||||||
|
hc._nav.NavigateTo($"TaxPayerInvoiceItem/{InvoiceID}");
|
||||||
|
}
|
||||||
|
}
|
||||||
private async Task ShowReport()
|
private async Task ShowReport()
|
||||||
{
|
{
|
||||||
if (InvoiceID.HasValue)
|
if (InvoiceID.HasValue)
|
||||||
|
@@ -13,19 +13,19 @@
|
|||||||
[Parameter] public int? InvoiceID { get; set; }
|
[Parameter] public int? InvoiceID { get; set; }
|
||||||
List<ToastMessage> messages = new List<ToastMessage>();
|
List<ToastMessage> messages = new List<ToastMessage>();
|
||||||
[Inject] protected PreloadService PreloadService { get; set; } = default!;
|
[Inject] protected PreloadService PreloadService { get; set; } = default!;
|
||||||
public InvoiceDTO? invoice { get; set; }
|
public _TaxPayer.Atemplatefield? invoice { get; set; }
|
||||||
// alert
|
// alert
|
||||||
AlertColor alertColor = AlertColor.Primary;
|
AlertColor alertColor = AlertColor.Primary;
|
||||||
IconName alertIconName = IconName.CheckCircleFill;
|
IconName alertIconName = IconName.CheckCircleFill;
|
||||||
bool Hidealert = true;
|
bool Hidealert = true;
|
||||||
string alertMessage = "";
|
string alertMessage = "";
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnParametersSetAsync()
|
||||||
{
|
{
|
||||||
await LoadData();
|
await LoadData();
|
||||||
|
await base.OnParametersSetAsync();
|
||||||
await base.OnInitializedAsync();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@functions{
|
@functions{
|
||||||
private void ShowSuccessAlert(string msg)
|
private void ShowSuccessAlert(string msg)
|
||||||
@@ -48,7 +48,7 @@
|
|||||||
var rsp = await hc.Get($"TaxPayer/GetInvoice/{InvoiceID}");
|
var rsp = await hc.Get($"TaxPayer/GetInvoice/{InvoiceID}");
|
||||||
if (rsp.IsSuccessStatusCode)
|
if (rsp.IsSuccessStatusCode)
|
||||||
{
|
{
|
||||||
invoice = await rsp.Content.ReadFromJsonAsync<InvoiceDTO>();
|
invoice = await rsp.Content.ReadFromJsonAsync<_TaxPayer.Atemplatefield?>();
|
||||||
}
|
}
|
||||||
else
|
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");
|
CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("fa-Ir");
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user