diff --git a/Back/Data/Models/Invoice.cs b/Back/Data/Models/Invoice.cs index dcee9b4..1bff243 100644 --- a/Back/Data/Models/Invoice.cs +++ b/Back/Data/Models/Invoice.cs @@ -66,7 +66,7 @@ namespace Back.Data.Models public decimal? tocv { get { return invoiceDetails.Sum(i => i.sscv); } } //مجموع سهم مالیات بر ارزش افزوده از پرداخت [MaxLength(18)] - public decimal? tvop { get { return invoiceDetails.Sum(i => i.vop); } } + public decimal? tvop { get { return Math.Floor(invoiceDetails.Sum(i => i.vop).GetValueOrDefault()); } } //نوع شخص خریدار [MaxLength(1)] public int tob { get { return Customer.CustomerType == CustomerType.WithoutIdentity ? 0 : (int)Customer.CustomerType; } } diff --git a/Back/Data/Models/InvoiceItem.cs b/Back/Data/Models/InvoiceItem.cs index 9ae160d..f56703a 100644 --- a/Back/Data/Models/InvoiceItem.cs +++ b/Back/Data/Models/InvoiceItem.cs @@ -33,19 +33,19 @@ namespace Back.Data.Models [MaxLength(18)] public decimal? vam { get { - return vra==0 ? 0 : invoice?.pattern?.ID == 9 ? fee*vra/100 : + return Math.Floor((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; + : vra * adis / 100).GetValueOrDefault()); } } //جمع کل اجرت ،حق العمل و سود [MaxLength(18)] public decimal? tcpbs { get { return consfee + spro + bros; } } //سهم نقدی از پرداخت [MaxLength(18)] - public decimal? cop { get { return (tsstam * invoice?.cap) / invoice?.tadis; } } + public decimal? cop { get { return Math.Floor(((tsstam * invoice?.cap) / invoice?.tadis).GetValueOrDefault()); } } //سهم مالیات بر ارزش افزوده از پرداخت [MaxLength(18)] - public decimal? vop { get { return vra == 0 ? 0 : (vam * invoice?.cap) / invoice?.tadis; } } + public decimal? vop { get { return vra == 0 ? 0 : Math.Floor(((vam * invoice?.cap) / invoice?.tadis).GetValueOrDefault()); } } //مبلغ کل کالا/خدمت [MaxLength(18)] public decimal? tsstam { get diff --git a/Back/Services/PreparationTaxInvoice.cs b/Back/Services/PreparationTaxInvoice.cs index 86da7c3..5848d0b 100644 --- a/Back/Services/PreparationTaxInvoice.cs +++ b/Back/Services/PreparationTaxInvoice.cs @@ -120,8 +120,8 @@ namespace Back.Services public string? Bsrn { get { return string.IsNullOrEmpty(bitem.bsrn) ? null : bitem.bsrn; } } public decimal? Tsstam { get { return bitem.tsstam; } } public decimal? Cui { get { return level == 5 || level == 13 ? bitem.cui : null; } } - public decimal? Cpr { get { return null; } } - public long? Sovat { get { return bitem.sovat; } } + public decimal? Cpr { get { return level == 4 && bitem.cpr.HasValue ? bitem.cpr : null; } } + public long? Sovat { get { return level == 4 && bitem.sovat.HasValue ? bitem.sovat : null; } } } } diff --git a/Back/Services/servTaxPayer.cs b/Back/Services/servTaxPayer.cs index 7bbf442..5ec8a3e 100644 --- a/Back/Services/servTaxPayer.cs +++ b/Back/Services/servTaxPayer.cs @@ -130,7 +130,7 @@ 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 || item.eName == "tvop" || item.eName == "tvam" ? ((decimal)resval).ToString("N0") : resval.ToString()); if (item.eName == "insp" ) // زمانی که صورتحساب فقط نسیه بود مبلغ کل فاکتور در نسیه نشسته شود @@ -140,7 +140,7 @@ namespace Back.Services 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.Value = rescalcinsp == null ? "" : rescalcinsp.ToString().Split('.').Length == 2 || item.eName == "tvop" || item.eName == "tvam" ? ((decimal)rescalcinsp).ToString("N0") : rescalcinsp.ToString(); } } @@ -174,11 +174,9 @@ namespace Back.Services { item.Value = ""; } - else if (resval.ToString().Split('.').Length == 2 ) + else if (resval.ToString().Split('.').Length == 2 || item.eName == "vam" || item.eName == "cop" || item.eName == "vop") { - if (item.eName == "cfee") - { - } + try { item.Value = ((decimal)resval).ToString("N0");