...
This commit is contained in:
@@ -36,7 +36,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="Service">
|
||||
<HintPath>..\..\Dlls\Service.dll</HintPath>
|
||||
<HintPath>..\..\..\LocalGit\TaxPayerTools\Service\bin\Debug\Service.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
|
@@ -49,20 +49,20 @@ namespace Back.Controllers
|
||||
if (!result.PatternID.HasValue || result.PatternID == 0)
|
||||
return BadRequest(new List<string> { "ابتدا برای این صورتحساب الگو در نظر بگیرید" });
|
||||
|
||||
if (result.invoiceType == InvoiceType.Bidding)
|
||||
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> { "این صورتحساب قبلا به سازمان ارسال شده" });
|
||||
//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)
|
||||
// && !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> { "در وضعیت برگشت از فروش و اصلاحی باید صورتحساب مرجع به سامانه مودیان ارسال شده باشد" });
|
||||
//if ((result.invoiceType == InvoiceType.BackFrmSale || result.invoiceType == InvoiceType.Repair)
|
||||
// && !await _servTaxPayer.ExistSuccessfulorSendorpendingInvoice(result.invoice))
|
||||
// return BadRequest(new List<string> { "در وضعیت برگشت از فروش و اصلاحی باید صورتحساب مرجع به سامانه مودیان ارسال شده باشد" });
|
||||
|
||||
|
||||
|
||||
@@ -80,6 +80,25 @@ namespace Back.Controllers
|
||||
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));
|
||||
}
|
||||
@@ -87,11 +106,11 @@ namespace Back.Controllers
|
||||
public async Task<ActionResult<bool>> CheckAuth()
|
||||
{
|
||||
|
||||
//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);
|
||||
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 BadRequest();
|
||||
|
||||
@@ -103,8 +122,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));
|
||||
//if (!await _actionTaxPayer.login(user.RolUsers.First().CompanyID))
|
||||
// return BadRequest(new List<string> { "خطا در احراز هویت سازمان مالیاتی" });
|
||||
if (!await _actionTaxPayer.login(user.RolUsers.First().CompanyID))
|
||||
return BadRequest(new List<string> { "خطا در احراز هویت سازمان مالیاتی" });
|
||||
|
||||
var result = await _servTaxPayer.GetInvoice(user.RolUsers.First().CompanyID, InvoiceID);
|
||||
if (result == null)
|
||||
@@ -497,8 +516,8 @@ namespace Back.Controllers
|
||||
if (string.IsNullOrEmpty(item.uId))
|
||||
return BadRequest(new List<string> { "کد پیگیری یافت نشد" });
|
||||
|
||||
//if (!await _actionTaxPayer.login(user.RolUsers.First().CompanyID))
|
||||
// return BadRequest(new List<string> { "خطا در احراز هویت سازمان مالیاتی" });
|
||||
if (!await _actionTaxPayer.login(user.RolUsers.First().CompanyID))
|
||||
return BadRequest(new List<string> { "خطا در احراز هویت سازمان مالیاتی" });
|
||||
|
||||
DataInSendTaxDto desData = new DataInSendTaxDto();
|
||||
|
||||
|
@@ -25,12 +25,12 @@ namespace Back.Data.Models
|
||||
public string? mu { get { return cODItem != null ? cODItem.CODUnit.UnitTaxID : null; } }
|
||||
//میزان ارز
|
||||
[MaxLength(18)]
|
||||
public decimal? cfee { get { return fee / exr; } }
|
||||
public decimal? cfee { get { return exr==null || exr==0 ? null : fee / exr; } }
|
||||
//مبلغ مالیات بر ارزش افزوده
|
||||
[MaxLength(18)]
|
||||
public decimal? vam { get
|
||||
{
|
||||
return invoice?.pattern?.inp == 9 ? fee*vra/100 :
|
||||
return vra==0 ? 0 : invoice?.pattern?.inp == 9 ? fee*vra/100 :
|
||||
invoice?.pattern?.inp == 13 ? ((tcpbs+9)/100)+((prdis*vra)/100)
|
||||
: vra * adis / 100;
|
||||
} }
|
||||
|
@@ -22,24 +22,24 @@ namespace Back.Services
|
||||
}
|
||||
public string GenerateTaxid(string FactorNo, string InvoiceDate)
|
||||
{
|
||||
return "testTaxid";
|
||||
// return "testTaxid";
|
||||
return TaxApiService.Instance.TaxIdGenerator.GenerateTaxId(_UniqueMemory,
|
||||
Convert.ToInt64(FactorNo), InvoiceDate.ToMiladi());
|
||||
}
|
||||
public async Task<InquiryResultModel> GetResultByUid(int CompanyID, string uid)
|
||||
{
|
||||
return new InquiryResultModel("18084a18-1eb4-41cd-8bd3-2cad73c45398", "0a4a4ab2-8047-4c31-b765-456ddf0e9c53", "FAILED",
|
||||
JsonConvert.SerializeObject( new DataInSendTaxDto()
|
||||
{
|
||||
error=new List<MessageInSendTaxDto>()
|
||||
{
|
||||
new MessageInSendTaxDto()
|
||||
{
|
||||
code="21001",message="یک خطای تست"
|
||||
}
|
||||
}
|
||||
})
|
||||
, "receive_invoice_confirm", "A2FFKZ");
|
||||
//return new InquiryResultModel("18084a18-1eb4-41cd-8bd3-2cad73c45398", "0a4a4ab2-8047-4c31-b765-456ddf0e9c53", "SUCCESS",
|
||||
// new DataInSendTaxDto()
|
||||
// {
|
||||
// error=new List<MessageInSendTaxDto>()
|
||||
// {
|
||||
// new MessageInSendTaxDto()
|
||||
// {
|
||||
// code="21001",message="یک خطای تست"
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// , "receive_invoice_confirm", "A2FFKZ");
|
||||
if (!await login(CompanyID))
|
||||
return null;
|
||||
var uidAndFiscalId = new UidAndFiscalId(uid, _UniqueMemory);
|
||||
@@ -50,11 +50,11 @@ namespace Back.Services
|
||||
}
|
||||
public async Task<TaxCollectData.Library.Dto.HttpResponse<AsyncResponseModel>> SendInvoice(int CompanyID,InvoiceHeaderDto header, List<InvoiceBodyDto> InvoiceBody, PaymentDto payment)
|
||||
{
|
||||
return new TaxCollectData.Library.Dto.HttpResponse<AsyncResponseModel>
|
||||
( body: new AsyncResponseModel(
|
||||
1702299112
|
||||
,new HashSet<PacketResponse>(new List<PacketResponse> { new PacketResponse("5d0c7198-e2fd-4cc1-8802-fe498d6ccf73", "a70444a4-1810-4cea-8bcc-7acb4bc75645", null,null)})
|
||||
,new List<ErrorModel>()), 200);
|
||||
//return new TaxCollectData.Library.Dto.HttpResponse<AsyncResponseModel>
|
||||
// ( body: new AsyncResponseModel(
|
||||
// 1702299112
|
||||
// ,new HashSet<PacketResponse>(new List<PacketResponse> { new PacketResponse("5d0c7198-e2fd-4cc1-8802-fe498d6ccf73", "a70444a4-1810-4cea-8bcc-7acb4bc75645", null,null)})
|
||||
// ,new List<ErrorModel>()), 200);
|
||||
|
||||
if (!await login(CompanyID))
|
||||
return null;
|
||||
|
@@ -24,88 +24,90 @@ namespace Back.Services
|
||||
{
|
||||
#region AdvancedSearch
|
||||
var invok = _invoiceRepo
|
||||
.Get(w => w.CompanyID == CompanyID && w.ID == ID);
|
||||
.Get(w => w.CompanyID == CompanyID && w.ID == ID);
|
||||
if (notloaddelete)
|
||||
{
|
||||
invok = invok
|
||||
.Where(w => !w.IsDeleted);
|
||||
|
||||
}
|
||||
invok = invok
|
||||
.Where(w => !w.IsDeleted);
|
||||
|
||||
}
|
||||
#endregion
|
||||
//-----------------------
|
||||
return await invok
|
||||
.Include(inc => inc.invoiceDetails)
|
||||
.ThenInclude(inc => inc.cODItem)
|
||||
.ThenInclude(inc => inc.CODUnit)
|
||||
.Include(inc=>inc.sentTax)
|
||||
//.Include(inc => inc.payments)
|
||||
.Include(inc => inc.pattern)
|
||||
.Select(s => new InvoiceDTO()
|
||||
{
|
||||
// ExternalAccessCode=s.ExternalAccessCode,
|
||||
IsDeleted=s.IsDeleted,
|
||||
PatternID = s.PatternID,
|
||||
PatternTitle = s.pattern.Title,
|
||||
CustomerID = s.CustomerID,
|
||||
CustomerName = s.Customer.FullName,
|
||||
ID = s.ID,
|
||||
InvoiceDate = s.InvoiceDate.ShamciToFormatShamci(),
|
||||
invoiceTypeTitle = s.invoiceType.GetEnumDisplayName(),
|
||||
invoiceType = s.invoiceType,
|
||||
Title = s.Title,
|
||||
InvoicIssueDate = s.InvoicIssueDate.ShamciToFormatShamci(),
|
||||
BillReference = s.BillReference,
|
||||
tbill = s.tbill,
|
||||
Des = s.Des,
|
||||
PreparedtoSendtoTax = s.PreparedtoSendtoTax,
|
||||
tdis = s.tdis,
|
||||
tvam = s.tvam,
|
||||
Udate = s.Udate.ShamciToFormatShamci(),
|
||||
InvoiceSendTaxs=s.sentTax.OrderBy(o => o.ID).Select(s=>new SentTaxDto()
|
||||
{
|
||||
Date = s.Date.ShamciToFormatShamci(),
|
||||
Time = s.Time,
|
||||
ID = s.ID,
|
||||
InvoiceID = s.InvoiceID,
|
||||
SentStatus = s.SentStatus,
|
||||
InvoiceType= s.InvoiceType,
|
||||
msgInvoiceType = s.InvoiceType.GetEnumDisplayName(),
|
||||
msgSentStatus = s.SentStatus.GetEnumDisplayName()
|
||||
}).ToList(),
|
||||
items = s.invoiceDetails.OrderBy(o => o.ID).Select(x => new InvoiceItemDTO()
|
||||
{
|
||||
ID = x.ID,
|
||||
CODID = x.CODID,
|
||||
adis = x.adis,
|
||||
am = x.am.Value,
|
||||
dis = x.dis,
|
||||
fee = x.fee.Value,
|
||||
mu = x.unitTitle,
|
||||
sstt = x.sstt,
|
||||
tsstam = x.tsstam,
|
||||
vam = x.vam,
|
||||
vra = x.vra,
|
||||
prdis = x.prdis
|
||||
}).ToList(),
|
||||
payments = new List<InvoicePaymentDTO>() //s.payments.OrderBy(o => o.ID).Select(x => new InvoicePaymentDTO()
|
||||
//{
|
||||
// ID = x.ID,
|
||||
// acn = x.acn,
|
||||
// iinn = x.acn,
|
||||
// pcn = x.acn,
|
||||
// pdt = x.pdt,
|
||||
// PaymentDateTime=x.PaymentDateTime,
|
||||
// pid = x.pid,
|
||||
// pmt = x.pmt,
|
||||
// pv = x.pv,
|
||||
// trmn = x.trmn,
|
||||
// trn = x.acn
|
||||
//}).ToList()
|
||||
,
|
||||
})
|
||||
.FirstOrDefaultAsync();
|
||||
|
||||
var item= await invok
|
||||
.Include(inc => inc.invoiceDetails)
|
||||
.ThenInclude(inc => inc.cODItem)
|
||||
.ThenInclude(inc => inc.CODUnit)
|
||||
.Include(inc => inc.Customer)
|
||||
.Include(inc => inc.sentTax)
|
||||
//.Include(inc => inc.payments)
|
||||
.Include(inc => inc.pattern)
|
||||
.ThenInclude(inc => inc.BillType).FirstOrDefaultAsync();
|
||||
return new InvoiceDTO()
|
||||
{
|
||||
|
||||
IsDeleted = item.IsDeleted,
|
||||
PatternID = item.PatternID,
|
||||
PatternTitle = item.pattern.Title,
|
||||
CustomerID = item.CustomerID,
|
||||
CustomerName = item.Customer.FullName,
|
||||
ID = item.ID,
|
||||
InvoiceDate = item.InvoiceDate.ShamciToFormatShamci(),
|
||||
invoiceTypeTitle = item.invoiceType.GetEnumDisplayName(),
|
||||
invoiceType = item.invoiceType,
|
||||
Title = item.Title,
|
||||
InvoicIssueDate = item.InvoicIssueDate.ShamciToFormatShamci(),
|
||||
BillReference = item.BillReference,
|
||||
tbill = item.tbill,
|
||||
Des = item.Des,
|
||||
PreparedtoSendtoTax = item.PreparedtoSendtoTax,
|
||||
tdis = item.tdis,
|
||||
tvam = item.tvam,
|
||||
Udate = item.Udate.ShamciToFormatShamci(),
|
||||
|
||||
InvoiceSendTaxs = item.sentTax.OrderBy(o => o.ID).Select(s => new SentTaxDto()
|
||||
{
|
||||
Date = s.Date.ShamciToFormatShamci(),
|
||||
Time = s.Time,
|
||||
ID = s.ID,
|
||||
InvoiceID = s.InvoiceID,
|
||||
SentStatus = s.SentStatus,
|
||||
InvoiceType = s.InvoiceType,
|
||||
msgInvoiceType = s.InvoiceType.GetEnumDisplayName(),
|
||||
msgSentStatus = s.SentStatus.GetEnumDisplayName()
|
||||
}).ToList(),
|
||||
items = item.invoiceDetails.OrderBy(o => o.ID).Select(x => new InvoiceItemDTO()
|
||||
{
|
||||
ID = x.ID,
|
||||
CODID = x.CODID,
|
||||
adis = x.adis,
|
||||
am = x.am.Value,
|
||||
dis = x.dis,
|
||||
fee = x.fee.Value,
|
||||
mu = x.unitTitle,
|
||||
sstt = x.sstt,
|
||||
tsstam = x.tsstam,
|
||||
vam = x.vam,
|
||||
vra = x.vra,
|
||||
prdis = x.prdis
|
||||
}).ToList(),
|
||||
payments = new List<InvoicePaymentDTO>()
|
||||
//s.payments.OrderBy(o => o.ID).Select(x => new InvoicePaymentDTO()
|
||||
//{
|
||||
// ID = x.ID,
|
||||
// acn = x.acn,
|
||||
// iinn = x.acn,
|
||||
// pcn = x.acn,
|
||||
// pdt = x.pdt,
|
||||
// PaymentDateTime=x.PaymentDateTime,
|
||||
// pid = x.pid,
|
||||
// pmt = x.pmt,
|
||||
// pv = x.pv,
|
||||
// trmn = x.trmn,
|
||||
// trn = x.acn
|
||||
//}).ToList()
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
public async Task<PagingDto<InvoiceGridDTO>?> GetInvoices(int CompanyID, ItemSerchGetInvoices itemSerch)
|
||||
{
|
||||
@@ -126,10 +128,10 @@ namespace Back.Services
|
||||
invok = invok.Where(w => w.Title.Contains(itemSerch.Title));
|
||||
|
||||
if (itemSerch.refInvoiceID != null)
|
||||
invok = invok.Where(w => w.BillReference==itemSerch.refInvoiceID);
|
||||
invok = invok.Where(w => w.BillReference == itemSerch.refInvoiceID);
|
||||
|
||||
if(itemSerch.CodID != null)
|
||||
invok = invok.Where(w => w.invoiceDetails.Any(wa=>wa.CODID== itemSerch.CodID));
|
||||
if (itemSerch.CodID != null)
|
||||
invok = invok.Where(w => w.invoiceDetails.Any(wa => wa.CODID == itemSerch.CodID));
|
||||
//foreach (InputObj item in inputObjs)
|
||||
// invok = invok.Where(ExMethod.GetFunc<Customer>(item.Param, item.Value));
|
||||
|
||||
@@ -143,7 +145,7 @@ namespace Back.Services
|
||||
.Include(inc => inc.pattern)
|
||||
.Select(s => new InvoiceGridDTO()
|
||||
{
|
||||
|
||||
|
||||
CustomerID = s.CustomerID,
|
||||
CustomerName = s.Customer.FullName,
|
||||
ID = s.ID,
|
||||
@@ -163,7 +165,7 @@ namespace Back.Services
|
||||
return await _invoiceRepo.Get(w => w.ID == InvoiceID && w.CompanyID == CompanyID && !w.IsDeleted).AnyAsync();
|
||||
|
||||
}
|
||||
|
||||
|
||||
public async Task<bool> checkFatherInvoiceByInvoiceID(int CompanyID, int InvoiceID)
|
||||
{
|
||||
return await _invoiceRepo.Get(w => w.BillReference == InvoiceID && w.CompanyID == CompanyID && !w.IsDeleted).AnyAsync();
|
||||
@@ -183,12 +185,12 @@ namespace Back.Services
|
||||
var item = await _invoiceRepo.AddAsync(invoice);
|
||||
return item.ID;
|
||||
}
|
||||
catch (Exception ex )
|
||||
catch (Exception ex)
|
||||
{
|
||||
return -1;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
return -1;
|
||||
@@ -203,9 +205,9 @@ namespace Back.Services
|
||||
catch (Exception ex)
|
||||
{
|
||||
return -1;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -221,7 +223,7 @@ namespace Back.Services
|
||||
{
|
||||
return await _invoiceRepo
|
||||
.Get(w => w.ID == InvoiceID && w.CompanyID == CompanyID && !w.IsDeleted)
|
||||
.Include(inc=>inc.invoiceDetails)
|
||||
.Include(inc => inc.invoiceDetails)
|
||||
.FirstOrDefaultAsync();
|
||||
}
|
||||
public async Task<bool> DeleteInvoice(Invoice item)
|
||||
|
Reference in New Issue
Block a user