This commit is contained in:
mmrbnjd
2024-10-19 18:30:02 +03:30
parent a930d1c576
commit 42a5e76cde
5 changed files with 48 additions and 30 deletions

View File

@@ -72,7 +72,7 @@ namespace Back.Controllers
}
[HttpPost("PreparationInvoiceBeforeSending")]
public async Task<ActionResult<bool>> PreparationInvoiceBeforeSending([FromBody] Atemplatefield item)
public async Task<ActionResult<Shared.DTOs._TaxPayer.Atemplatefield?>> PreparationInvoiceBeforeSending([FromBody] Atemplatefield item)
{
var claim = HttpContext.User.Claims.First(c => c.Type == "UserID");
var UserID = claim.Value;

View File

@@ -15,6 +15,7 @@ namespace Back.Data.Models
public int? BillReference { get; set; }
#endregion
#region autofild
//تاریخ و زمان صدور صورتحساب )میالدی(
@@ -94,11 +95,14 @@ namespace Back.Data.Models
[MaxLength(18)]
public decimal? cap { get {
return
setm == 1 ? tbill : setm == 2 ? 0 : tbill - insp;
setm == 1 ? tbill.GetValueOrDefault() - todam.GetValueOrDefault() - tvam.GetValueOrDefault()
: setm == 2 ? 0
: tbill.GetValueOrDefault() - todam.GetValueOrDefault() - tvam.GetValueOrDefault() - insp.GetValueOrDefault();
} }
//موضوع صورتحساب
[MaxLength(1)]
public int? ins { get { return (int)invoiceType; } }
public decimal Calcinsp { get { return tbill.GetValueOrDefault() - todam.GetValueOrDefault() - tvam.GetValueOrDefault(); } }
#endregion
#region fild
@@ -143,7 +147,7 @@ namespace Back.Data.Models
{
get
{
return pattern.BillTypeID == 3 || pattern.BillTypeID == 4 || pattern.inp == 8
return pattern.BillTypeID == 3 || pattern.BillTypeID == 4 || pattern.ID == 2 || pattern.ID == 10
? 1
: _setm;
}

View File

@@ -27,15 +27,14 @@ namespace Back.Data.Models
//میزان ارز
[MaxLength(18)]
public decimal? cfee { get { return
invoice?.pattern?.inp == 2 ? _cfee
: invoice?.pattern?.inp == 1 && exr != null && exr != 0 ? Math.Floor(fee.Value / exr.Value)
: null ; } }
invoice?.pattern?.ID == 4 ? _cfee
: exr.HasValue ? Math.Floor(fee.GetValueOrDefault() / exr.GetValueOrDefault()) : 0; } }
//مبلغ مالیات بر ارزش افزوده
[MaxLength(18)]
public decimal? vam { get
{
return vra==0 ? 0 : invoice?.pattern?.inp == 9 ? fee*vra/100 :
invoice?.pattern?.inp == 13 ? ((tcpbs+9)/100)+((prdis*vra)/100)
return vra==0 ? 0 : invoice?.pattern?.ID == 9 ? fee*vra/100 :
invoice?.pattern?.ID == 13 || invoice?.pattern?.ID == 5 ? ((tcpbs+9)/100)+((prdis*vra)/100)
: vra * adis / 100;
} }
//جمع کل اجرت ،حق العمل و سود
@@ -51,28 +50,27 @@ namespace Back.Data.Models
[MaxLength(18)]
public decimal? tsstam { get
{
if (invoice==null || invoice.pattern==null)
{
return vam + adis;
}
else
return invoice?.pattern?.inp == 9 ? fee+vam :
invoice?.pattern?.inp == 10 ? sscv + vam + odam + olam :
invoice?.pattern?.inp == 4 ? prdis + vam + odam + olam :
return /*invoice?.pattern?.ID == 9 ? fee+vam :*/
invoice?.pattern?.ID == 10 ? ssrv + vam + odam + olam :
invoice?.pattern?.ID == 4 ? prdis + vam + odam + olam :
vam + adis + odam + olam;
} }
//مبلغ بعد از تخفیف
[MaxLength(18)]
public decimal? adis { get
{
return invoice?.pattern?.inp == 13 ? prdis+ tcpbs - dis: prdis - dis;
return invoice?.pattern?.ID == 5 || invoice?.pattern?.ID == 13 ? prdis+ tcpbs - dis: prdis - dis;
} }
//مبلغ قبل از تخفیف
[MaxLength(18)]
public decimal? prdis { get { return am * fee; } }
//نرخ مالیات بر ازش افزوده
[MaxLength(5)]
public decimal? vra { get { return cODItem != null ? cODItem.TaxRate : null; } }
public decimal? vra { get { return
//صادرات مالیات ندارد
invoice?.pattern?.ID == 10 ? 0
:cODItem != null ? cODItem.TaxRate
: null; } }
//واحد اندازه گیری عنوان
public string? unitTitle { get { return cODItem!=null ? cODItem.CODUnit.Title : null; } }
#endregion

View File

@@ -129,7 +129,21 @@ namespace Back.Services
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().Split('.').Length==2 ? ((decimal)resval).ToString("N0") : resval.ToString());
item.Value = resval == null ? "" : (item.eName == "InvoicIssueDate" || item.eName == "InvoiceDate" || item.eName == "CottageDateOfCustomsDeclaration" ? resval.ToString().ShamciToFormatShamci() : resval.ToString().Split('.').Length == 2 ? ((decimal)resval).ToString("N0") : resval.ToString());
if (item.eName == "insp" )
// زمانی که صورتحساب فقط نسیه بود مبلغ کل فاکتور در نسیه نشسته شود
{
if (InvoiceItem.setm == 1) item.Value = "0";
if (InvoiceItem.setm == 2)
{
var rescalcinsp = InvoiceItem.GetType().GetProperties().Where(w => w.Name == "Calcinsp").Select(s => s.GetValue(InvoiceItem)).FirstOrDefault();
item.Value = rescalcinsp == null ? "" : rescalcinsp.ToString().Split('.').Length == 2 ? ((decimal)rescalcinsp).ToString("N0") : rescalcinsp.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*/;
}

View File

@@ -301,7 +301,6 @@ else
</div>
</div>
@if (invoice != null)
{
@* action *@
@@ -382,19 +381,22 @@ else
public async Task Send()
{
SpinnerVisible = true;
string route = "PreparationInvoiceBeforeSending";
if (FullInvoice)
route = "UpdateInvoice";
var rsp = await hc.Post<_TaxPayer.Atemplatefield>($"TaxPayer/{route}", invoice);
if (rsp.IsSuccessStatusCode)
string route = "PreparationInvoiceBeforeSending";
if (FullInvoice)
route = "UpdateInvoice";
var rsp = await hc.Post<_TaxPayer.Atemplatefield>($"TaxPayer/{route}", invoice);
if (rsp.IsSuccessStatusCode)
{
var response = await rsp.Content.ReadFromJsonAsync<bool>();
if (response)
{
var response = await rsp.Content.ReadFromJsonAsync<bool>();
if (response)
if (FullInvoice)
{
if (FullInvoice)
ShowMessage(ToastType.Success, "تغییرات با موفقیت انجام شد");
ShowMessage(ToastType.Success, "تغییرات با موفقیت انجام شد");
await LoadData();
}
else
{