...
This commit is contained in:
@@ -49,20 +49,20 @@ namespace Back.Controllers
|
|||||||
if (!result.PatternID.HasValue || result.PatternID == 0)
|
if (!result.PatternID.HasValue || result.PatternID == 0)
|
||||||
return BadRequest(new List<string> { "ابتدا برای این صورتحساب الگو در نظر بگیرید" });
|
return BadRequest(new List<string> { "ابتدا برای این صورتحساب الگو در نظر بگیرید" });
|
||||||
|
|
||||||
if (result.invoiceType == InvoiceType.Bidding)
|
//if (result.invoiceType == InvoiceType.Bidding)
|
||||||
return BadRequest(new List<string> { "صورتحساب در وضعیت پیش نویس نمیتواند ارسال شود" });
|
// 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> { "این صورتحساب قبلا به سازمان ارسال شده" });
|
||||||
|
|
||||||
if ((result.invoiceType == InvoiceType.BackFrmSale || result.invoiceType == InvoiceType.Repair)
|
//if ((result.invoiceType == InvoiceType.BackFrmSale || result.invoiceType == InvoiceType.Repair)
|
||||||
&& !result.BillReference.HasValue)
|
// && !result.BillReference.HasValue)
|
||||||
return BadRequest(new List<string> { "در وضعیت برگشت از فروش و اصلاحی باید صورتحساب مرجع وجود داشته باشد" });
|
// return BadRequest(new List<string> { "در وضعیت برگشت از فروش و اصلاحی باید صورتحساب مرجع وجود داشته باشد" });
|
||||||
|
|
||||||
|
|
||||||
if ((result.invoiceType == InvoiceType.BackFrmSale || result.invoiceType == InvoiceType.Repair)
|
//if ((result.invoiceType == InvoiceType.BackFrmSale || result.invoiceType == InvoiceType.Repair)
|
||||||
&& !await _servTaxPayer.ExistSuccessfulorSendorpendingInvoice(result.invoice))
|
// && !await _servTaxPayer.ExistSuccessfulorSendorpendingInvoice(result.invoice))
|
||||||
return BadRequest(new List<string> { "در وضعیت برگشت از فروش و اصلاحی باید صورتحساب مرجع به سامانه مودیان ارسال شده باشد" });
|
// return BadRequest(new List<string> { "در وضعیت برگشت از فروش و اصلاحی باید صورتحساب مرجع به سامانه مودیان ارسال شده باشد" });
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -80,6 +80,25 @@ namespace Back.Controllers
|
|||||||
if (result == null)
|
if (result == null)
|
||||||
return BadRequest(new List<string> { "صورتحساب یافت نشد" });
|
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));
|
return Ok(await _servTaxPayer.PreparationInvoiceBeforeSending(item, result));
|
||||||
}
|
}
|
||||||
|
@@ -24,88 +24,92 @@ namespace Back.Services
|
|||||||
{
|
{
|
||||||
#region AdvancedSearch
|
#region AdvancedSearch
|
||||||
var invok = _invoiceRepo
|
var invok = _invoiceRepo
|
||||||
.Get(w => w.CompanyID == CompanyID && w.ID == ID);
|
.Get(w => w.CompanyID == CompanyID && w.ID == ID);
|
||||||
if (notloaddelete)
|
if (notloaddelete)
|
||||||
{
|
{
|
||||||
invok = invok
|
invok = invok
|
||||||
.Where(w => !w.IsDeleted);
|
.Where(w => !w.IsDeleted);
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
//-----------------------
|
//-----------------------
|
||||||
return await invok
|
|
||||||
.Include(inc => inc.invoiceDetails)
|
return await invok
|
||||||
.ThenInclude(inc => inc.cODItem)
|
.Include(inc => inc.invoiceDetails)
|
||||||
.ThenInclude(inc => inc.CODUnit)
|
.ThenInclude(inc => inc.cODItem)
|
||||||
.Include(inc=>inc.sentTax)
|
.ThenInclude(inc => inc.CODUnit)
|
||||||
//.Include(inc => inc.payments)
|
.Include(inc => inc.sentTax)
|
||||||
.Include(inc => inc.pattern)
|
//.Include(inc => inc.payments)
|
||||||
.Select(s => new InvoiceDTO()
|
.Include(inc => inc.pattern)
|
||||||
{
|
.ThenInclude(inc => inc.BillType)
|
||||||
// ExternalAccessCode=s.ExternalAccessCode,
|
.Select(s => new InvoiceDTO()
|
||||||
IsDeleted=s.IsDeleted,
|
{
|
||||||
PatternID = s.PatternID,
|
|
||||||
PatternTitle = s.pattern.Title,
|
IsDeleted = s.IsDeleted,
|
||||||
CustomerID = s.CustomerID,
|
PatternID = s.PatternID,
|
||||||
CustomerName = s.Customer.FullName,
|
PatternTitle = s.pattern.Title,
|
||||||
ID = s.ID,
|
CustomerID = s.CustomerID,
|
||||||
InvoiceDate = s.InvoiceDate.ShamciToFormatShamci(),
|
CustomerName = s.Customer.FullName,
|
||||||
invoiceTypeTitle = s.invoiceType.GetEnumDisplayName(),
|
ID = s.ID,
|
||||||
invoiceType = s.invoiceType,
|
InvoiceDate = s.InvoiceDate.ShamciToFormatShamci(),
|
||||||
Title = s.Title,
|
invoiceTypeTitle = s.invoiceType.GetEnumDisplayName(),
|
||||||
InvoicIssueDate = s.InvoicIssueDate.ShamciToFormatShamci(),
|
invoiceType = s.invoiceType,
|
||||||
BillReference = s.BillReference,
|
Title = s.Title,
|
||||||
tbill = s.tbill,
|
InvoicIssueDate = s.InvoicIssueDate.ShamciToFormatShamci(),
|
||||||
Des = s.Des,
|
BillReference = s.BillReference,
|
||||||
PreparedtoSendtoTax = s.PreparedtoSendtoTax,
|
tbill = s.tbill,
|
||||||
tdis = s.tdis,
|
Des = s.Des,
|
||||||
tvam = s.tvam,
|
PreparedtoSendtoTax = s.PreparedtoSendtoTax,
|
||||||
Udate = s.Udate.ShamciToFormatShamci(),
|
tdis = s.tdis,
|
||||||
InvoiceSendTaxs=s.sentTax.OrderBy(o => o.ID).Select(s=>new SentTaxDto()
|
//
|
||||||
{
|
tvam = s.tvam,
|
||||||
Date = s.Date.ShamciToFormatShamci(),
|
Udate = s.Udate.ShamciToFormatShamci(),
|
||||||
Time = s.Time,
|
|
||||||
ID = s.ID,
|
InvoiceSendTaxs = s.sentTax.OrderBy(o => o.ID).Select(s => new SentTaxDto()
|
||||||
InvoiceID = s.InvoiceID,
|
{
|
||||||
SentStatus = s.SentStatus,
|
Date = s.Date.ShamciToFormatShamci(),
|
||||||
InvoiceType= s.InvoiceType,
|
Time = s.Time,
|
||||||
msgInvoiceType = s.InvoiceType.GetEnumDisplayName(),
|
ID = s.ID,
|
||||||
msgSentStatus = s.SentStatus.GetEnumDisplayName()
|
InvoiceID = s.InvoiceID,
|
||||||
}).ToList(),
|
SentStatus = s.SentStatus,
|
||||||
items = s.invoiceDetails.OrderBy(o => o.ID).Select(x => new InvoiceItemDTO()
|
InvoiceType = s.InvoiceType,
|
||||||
{
|
msgInvoiceType = s.InvoiceType.GetEnumDisplayName(),
|
||||||
ID = x.ID,
|
msgSentStatus = s.SentStatus.GetEnumDisplayName()
|
||||||
CODID = x.CODID,
|
}).ToList(),
|
||||||
adis = x.adis,
|
//items = s.invoiceDetails.OrderBy(o => o.ID).Select(x => new InvoiceItemDTO()
|
||||||
am = x.am.Value,
|
//{
|
||||||
dis = x.dis,
|
// ID = x.ID,
|
||||||
fee = x.fee.Value,
|
// CODID = x.CODID,
|
||||||
mu = x.unitTitle,
|
// adis = x.adis,
|
||||||
sstt = x.sstt,
|
// am = x.am.Value,
|
||||||
tsstam = x.tsstam,
|
// dis = x.dis,
|
||||||
vam = x.vam,
|
// fee = x.fee.Value,
|
||||||
vra = x.vra,
|
// mu = x.unitTitle,
|
||||||
prdis = x.prdis
|
// sstt = x.sstt,
|
||||||
}).ToList(),
|
// tsstam = x.tsstam,
|
||||||
payments = new List<InvoicePaymentDTO>() //s.payments.OrderBy(o => o.ID).Select(x => new InvoicePaymentDTO()
|
// vam = x.vam,
|
||||||
//{
|
// vra = x.vra,
|
||||||
// ID = x.ID,
|
// prdis = x.prdis
|
||||||
// acn = x.acn,
|
//}).ToList(),
|
||||||
// iinn = x.acn,
|
payments = new List<InvoicePaymentDTO>()
|
||||||
// pcn = x.acn,
|
//s.payments.OrderBy(o => o.ID).Select(x => new InvoicePaymentDTO()
|
||||||
// pdt = x.pdt,
|
//{
|
||||||
// PaymentDateTime=x.PaymentDateTime,
|
// ID = x.ID,
|
||||||
// pid = x.pid,
|
// acn = x.acn,
|
||||||
// pmt = x.pmt,
|
// iinn = x.acn,
|
||||||
// pv = x.pv,
|
// pcn = x.acn,
|
||||||
// trmn = x.trmn,
|
// pdt = x.pdt,
|
||||||
// trn = x.acn
|
// PaymentDateTime=x.PaymentDateTime,
|
||||||
//}).ToList()
|
// pid = x.pid,
|
||||||
,
|
// pmt = x.pmt,
|
||||||
})
|
// pv = x.pv,
|
||||||
.FirstOrDefaultAsync();
|
// trmn = x.trmn,
|
||||||
|
// trn = x.acn
|
||||||
|
//}).ToList()
|
||||||
|
})
|
||||||
|
.FirstOrDefaultAsync();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
public async Task<PagingDto<InvoiceGridDTO>?> GetInvoices(int CompanyID, ItemSerchGetInvoices itemSerch)
|
public async Task<PagingDto<InvoiceGridDTO>?> GetInvoices(int CompanyID, ItemSerchGetInvoices itemSerch)
|
||||||
{
|
{
|
||||||
@@ -126,10 +130,10 @@ namespace Back.Services
|
|||||||
invok = invok.Where(w => w.Title.Contains(itemSerch.Title));
|
invok = invok.Where(w => w.Title.Contains(itemSerch.Title));
|
||||||
|
|
||||||
if (itemSerch.refInvoiceID != null)
|
if (itemSerch.refInvoiceID != null)
|
||||||
invok = invok.Where(w => w.BillReference==itemSerch.refInvoiceID);
|
invok = invok.Where(w => w.BillReference == itemSerch.refInvoiceID);
|
||||||
|
|
||||||
if(itemSerch.CodID != null)
|
if (itemSerch.CodID != null)
|
||||||
invok = invok.Where(w => w.invoiceDetails.Any(wa=>wa.CODID== itemSerch.CodID));
|
invok = invok.Where(w => w.invoiceDetails.Any(wa => wa.CODID == itemSerch.CodID));
|
||||||
//foreach (InputObj item in inputObjs)
|
//foreach (InputObj item in inputObjs)
|
||||||
// invok = invok.Where(ExMethod.GetFunc<Customer>(item.Param, item.Value));
|
// invok = invok.Where(ExMethod.GetFunc<Customer>(item.Param, item.Value));
|
||||||
|
|
||||||
@@ -143,7 +147,7 @@ namespace Back.Services
|
|||||||
.Include(inc => inc.pattern)
|
.Include(inc => inc.pattern)
|
||||||
.Select(s => new InvoiceGridDTO()
|
.Select(s => new InvoiceGridDTO()
|
||||||
{
|
{
|
||||||
|
|
||||||
CustomerID = s.CustomerID,
|
CustomerID = s.CustomerID,
|
||||||
CustomerName = s.Customer.FullName,
|
CustomerName = s.Customer.FullName,
|
||||||
ID = s.ID,
|
ID = s.ID,
|
||||||
@@ -163,7 +167,7 @@ namespace Back.Services
|
|||||||
return await _invoiceRepo.Get(w => w.ID == InvoiceID && w.CompanyID == CompanyID && !w.IsDeleted).AnyAsync();
|
return await _invoiceRepo.Get(w => w.ID == InvoiceID && w.CompanyID == CompanyID && !w.IsDeleted).AnyAsync();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<bool> checkFatherInvoiceByInvoiceID(int CompanyID, int InvoiceID)
|
public async Task<bool> checkFatherInvoiceByInvoiceID(int CompanyID, int InvoiceID)
|
||||||
{
|
{
|
||||||
return await _invoiceRepo.Get(w => w.BillReference == InvoiceID && w.CompanyID == CompanyID && !w.IsDeleted).AnyAsync();
|
return await _invoiceRepo.Get(w => w.BillReference == InvoiceID && w.CompanyID == CompanyID && !w.IsDeleted).AnyAsync();
|
||||||
@@ -183,12 +187,12 @@ namespace Back.Services
|
|||||||
var item = await _invoiceRepo.AddAsync(invoice);
|
var item = await _invoiceRepo.AddAsync(invoice);
|
||||||
return item.ID;
|
return item.ID;
|
||||||
}
|
}
|
||||||
catch (Exception ex )
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
@@ -203,9 +207,9 @@ namespace Back.Services
|
|||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -221,7 +225,7 @@ namespace Back.Services
|
|||||||
{
|
{
|
||||||
return await _invoiceRepo
|
return await _invoiceRepo
|
||||||
.Get(w => w.ID == InvoiceID && w.CompanyID == CompanyID && !w.IsDeleted)
|
.Get(w => w.ID == InvoiceID && w.CompanyID == CompanyID && !w.IsDeleted)
|
||||||
.Include(inc=>inc.invoiceDetails)
|
.Include(inc => inc.invoiceDetails)
|
||||||
.FirstOrDefaultAsync();
|
.FirstOrDefaultAsync();
|
||||||
}
|
}
|
||||||
public async Task<bool> DeleteInvoice(Invoice item)
|
public async Task<bool> DeleteInvoice(Invoice item)
|
||||||
|
@@ -334,12 +334,16 @@
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<Button class="mt-3" Color="ButtonColor.Success" @onclick="OnClickUpdate" Type="ButtonType.Button">
|
<div class="d-flex gap-2">
|
||||||
ثبت تغییرات
|
<Dropdown Color="DropdownColor.Info" Direction="DropdownDirection.Dropend">
|
||||||
</Button>
|
<DropdownToggleButton>Dropend</DropdownToggleButton>
|
||||||
<Button class="mt-3" Color="ButtonColor.Danger" @onclick="ShowConfirmationDeleteAsync" Type="ButtonType.Button">
|
<DropdownMenu>
|
||||||
حذف
|
<DropdownItem Type="ButtonType.Link" @onclick="OnClickUpdate"> ثبت تغییرات</DropdownItem>
|
||||||
</Button>
|
<DropdownItem Type="ButtonType.Link" @onclick="ShowConfirmationDeleteAsync">حذف</DropdownItem>
|
||||||
|
<DropdownItem Type="ButtonType.Link" @onclick="showFullInvoiceItem">اطلاعات تکمیلی صورتحساب</DropdownItem>
|
||||||
|
</DropdownMenu>
|
||||||
|
</Dropdown>
|
||||||
|
</div>
|
||||||
@* <Button class="mt-3" Color="ButtonColor.Primary" @onclick="ShowReport" Type="ButtonType.Button">
|
@* <Button class="mt-3" Color="ButtonColor.Primary" @onclick="ShowReport" Type="ButtonType.Button">
|
||||||
pdf
|
pdf
|
||||||
</Button>
|
</Button>
|
||||||
@@ -492,6 +496,13 @@
|
|||||||
hc._nav.NavigateTo($"TaxPayerInvoiceItem/{InvoiceID}");
|
hc._nav.NavigateTo($"TaxPayerInvoiceItem/{InvoiceID}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private async Task showFullInvoiceItem()
|
||||||
|
{
|
||||||
|
if (InvoiceID.HasValue)
|
||||||
|
{
|
||||||
|
hc._nav.NavigateTo($"FullInvoiceItem/{InvoiceID}");
|
||||||
|
}
|
||||||
|
}
|
||||||
private async Task onClickLink()
|
private async Task onClickLink()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
@page "/TaxPayerInvoiceItem/{InvoiceID:int}"
|
@page "/TaxPayerInvoiceItem/{InvoiceID:int}"
|
||||||
|
@page "/FullInvoiceItem/{InvoiceID:int}"
|
||||||
@using Front.Services
|
@using Front.Services
|
||||||
@using Shared.DTOs
|
@using Shared.DTOs
|
||||||
@layout PanelLayout
|
@layout PanelLayout
|
||||||
@@ -214,6 +215,8 @@
|
|||||||
PreloadService.Show(SpinnerColor.Dark);
|
PreloadService.Show(SpinnerColor.Dark);
|
||||||
await LoadData();
|
await LoadData();
|
||||||
PreloadService.Hide();
|
PreloadService.Hide();
|
||||||
|
|
||||||
|
var res= hc._nav.Uri.ToString();
|
||||||
await base.OnParametersSetAsync();
|
await base.OnParametersSetAsync();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user