tax
This commit is contained in:
@@ -276,14 +276,12 @@ namespace Back.Controllers
|
||||
IsDeleted = false,
|
||||
PatternID = Invoice.PatternID,
|
||||
setm = Invoice.setm,
|
||||
cui = Invoice.cui,
|
||||
crn = Invoice.crn,
|
||||
CottageDateOfCustomsDeclaration = Invoice.CottageDateOfCustomsDeclaration,
|
||||
ft = Invoice.ft,
|
||||
cdcn = Invoice.cdcn,
|
||||
insp = Invoice.insp,
|
||||
billid = Invoice.billid,
|
||||
pspd = Invoice.pspd,
|
||||
scc = Invoice.scc,
|
||||
scln = Invoice.scln,
|
||||
seventeentax = Invoice.seventeentax,
|
||||
@@ -308,7 +306,21 @@ namespace Back.Controllers
|
||||
olt = s.olt,
|
||||
spro = s.spro,
|
||||
sscv = s.sscv,
|
||||
ssrv = s.ssrv
|
||||
ssrv = s.ssrv,
|
||||
pspd = s.pspd,
|
||||
cui = s.cui,
|
||||
}).ToList(),
|
||||
payments=Invoice.payments.Select(s=>new InvoicePayment()
|
||||
{
|
||||
acn=s.acn,
|
||||
iinn=s.iinn,
|
||||
PaymentDateTime=s.PaymentDateTime,
|
||||
pcn=s.pcn,
|
||||
pid=s.pid,
|
||||
pmt=s.pmt,
|
||||
pv=s.pv,
|
||||
trmn=s.trmn,
|
||||
trn=s.trn,
|
||||
}).ToList()
|
||||
}, false);
|
||||
if (result > 0)
|
||||
@@ -331,14 +343,12 @@ namespace Back.Controllers
|
||||
IsDeleted = false,
|
||||
PatternID = Invoice.PatternID,
|
||||
setm = Invoice.setm,
|
||||
cui = Invoice.cui,
|
||||
crn = Invoice.crn,
|
||||
CottageDateOfCustomsDeclaration = Invoice.CottageDateOfCustomsDeclaration,
|
||||
ft = Invoice.ft,
|
||||
cdcn = Invoice.cdcn,
|
||||
insp = Invoice.insp,
|
||||
billid = Invoice.billid,
|
||||
pspd = Invoice.pspd,
|
||||
scc = Invoice.scc,
|
||||
scln = Invoice.scln,
|
||||
seventeentax = Invoice.seventeentax,
|
||||
@@ -363,7 +373,21 @@ namespace Back.Controllers
|
||||
olt = s.olt,
|
||||
spro = s.spro,
|
||||
sscv = s.sscv,
|
||||
ssrv = s.ssrv
|
||||
ssrv = s.ssrv,
|
||||
pspd = s.pspd,
|
||||
cui = s.cui,
|
||||
}).ToList(),
|
||||
payments = Invoice.payments.Select(s => new InvoicePayment()
|
||||
{
|
||||
acn = s.acn,
|
||||
iinn = s.iinn,
|
||||
PaymentDateTime = s.PaymentDateTime,
|
||||
pcn = s.pcn,
|
||||
pid = s.pid,
|
||||
pmt = s.pmt,
|
||||
pv = s.pv,
|
||||
trmn = s.trmn,
|
||||
trn = s.trn,
|
||||
}).ToList()
|
||||
}, false);
|
||||
if (result1 > 0)
|
||||
@@ -398,14 +422,12 @@ namespace Back.Controllers
|
||||
IsDeleted = false,
|
||||
PatternID = Invoice.PatternID,
|
||||
setm = Invoice.setm,
|
||||
cui = Invoice.cui,
|
||||
crn = Invoice.crn,
|
||||
CottageDateOfCustomsDeclaration = Invoice.CottageDateOfCustomsDeclaration,
|
||||
ft = Invoice.ft,
|
||||
cdcn = Invoice.cdcn,
|
||||
insp = Invoice.insp,
|
||||
billid = Invoice.billid,
|
||||
pspd = Invoice.pspd,
|
||||
scc = Invoice.scc,
|
||||
scln = Invoice.scln,
|
||||
seventeentax = Invoice.seventeentax,
|
||||
@@ -430,7 +452,21 @@ namespace Back.Controllers
|
||||
olt = s.olt,
|
||||
spro = s.spro,
|
||||
sscv = s.sscv,
|
||||
ssrv = s.ssrv
|
||||
ssrv = s.ssrv,
|
||||
pspd = s.pspd,
|
||||
cui = s.cui,
|
||||
}).ToList(),
|
||||
payments = Invoice.payments.Select(s => new InvoicePayment()
|
||||
{
|
||||
acn = s.acn,
|
||||
iinn = s.iinn,
|
||||
PaymentDateTime = s.PaymentDateTime,
|
||||
pcn = s.pcn,
|
||||
pid = s.pid,
|
||||
pmt = s.pmt,
|
||||
pv = s.pv,
|
||||
trmn = s.trmn,
|
||||
trn = s.trn,
|
||||
}).ToList()
|
||||
}, false);
|
||||
if (result2 > 0)
|
||||
@@ -490,19 +526,16 @@ namespace Back.Controllers
|
||||
IsDeleted = false,
|
||||
PatternID = Invoice.PatternID,
|
||||
setm = Invoice.setm,
|
||||
cui = Invoice.cui,
|
||||
crn = Invoice.crn,
|
||||
CottageDateOfCustomsDeclaration = Invoice.CottageDateOfCustomsDeclaration,
|
||||
ft = Invoice.ft,
|
||||
cdcn = Invoice.cdcn,
|
||||
insp = Invoice.insp,
|
||||
billid = Invoice.billid,
|
||||
pspd = Invoice.pspd,
|
||||
scc = Invoice.scc,
|
||||
scln = Invoice.scln,
|
||||
seventeentax = Invoice.seventeentax,
|
||||
tinc = Invoice.tinc,
|
||||
|
||||
tinc = Invoice.tinc,
|
||||
invoiceDetails = Invoice.invoiceDetails.Select(s => new InvoiceItem
|
||||
{
|
||||
CODID = s.CODID,
|
||||
@@ -523,7 +556,21 @@ namespace Back.Controllers
|
||||
olt = s.olt,
|
||||
spro=s.spro,
|
||||
sscv = s.sscv,
|
||||
ssrv = s.ssrv
|
||||
ssrv = s.ssrv,
|
||||
pspd= s.pspd,
|
||||
cui= s.cui,
|
||||
}).ToList(),
|
||||
payments = Invoice.payments.Select(s => new InvoicePayment()
|
||||
{
|
||||
acn = s.acn,
|
||||
iinn = s.iinn,
|
||||
PaymentDateTime = s.PaymentDateTime,
|
||||
pcn = s.pcn,
|
||||
pid = s.pid,
|
||||
pmt = s.pmt,
|
||||
pv = s.pv,
|
||||
trmn = s.trmn,
|
||||
trn = s.trn,
|
||||
}).ToList()
|
||||
}, true);
|
||||
if (result > 0)
|
||||
|
@@ -9,6 +9,7 @@ using Microsoft.EntityFrameworkCore;
|
||||
using Newtonsoft.Json;
|
||||
using Org.BouncyCastle.Asn1.Cmp;
|
||||
using Org.BouncyCastle.Ocsp;
|
||||
using Org.BouncyCastle.Utilities;
|
||||
using Shared.DTOs;
|
||||
using Shared.DTOs.Serch;
|
||||
using System;
|
||||
@@ -184,82 +185,105 @@ namespace Back.Controllers
|
||||
|
||||
#region Inital Send
|
||||
InvoiceHeaderDto header = new InvoiceHeaderDto();
|
||||
|
||||
|
||||
|
||||
int level = result.pattern.ID;
|
||||
|
||||
//header
|
||||
#region header
|
||||
if (result.inty == 1 && result.inp == 1)
|
||||
header = new InvoiceHeaderDto
|
||||
{
|
||||
//شماره منحصر به فرد مالیاتی
|
||||
Taxid = _actionTaxPayer.GenerateTaxid(result.inno, result.InvoiceDate.Replace("/", "").Trim()),
|
||||
//زمان صدور
|
||||
Indatim = result.indatim ?? null,
|
||||
//زمان ایجاد
|
||||
Indati2m = result.Indati2m ?? null,
|
||||
// صورتحساب نوع *
|
||||
Inty = result.inty ?? 1,
|
||||
//سریال صورت حساب
|
||||
Inno = string.IsNullOrEmpty(result.inno) ? null : result.inno,
|
||||
//شماره منحصر به فرد مالیاتی صورتحساب مرجع
|
||||
Irtaxid = result.invoiceType == InvoiceType.BackFrmSale || result.invoiceType == InvoiceType.Repair ? result.invoice.taxid
|
||||
: result.invoiceType == InvoiceType.Cancellation ? result.taxid : null,
|
||||
//الگوی صورتحساب *
|
||||
Inp = result.inp ?? 1,
|
||||
//موضوع صورتحساب *
|
||||
Ins = result.ins ?? 1,
|
||||
//شماره اقتصادی فروشنده به جاش شناسه ملی داده شد
|
||||
Tins = string.IsNullOrEmpty(result.tins) ? null : result.tins,
|
||||
//نوع شخص خریدار
|
||||
Tob = result.tob,
|
||||
//شماره/شناسه ملی/شناسه مشارکت مدنی / کد فراگیر
|
||||
Bid = string.IsNullOrEmpty(result.bid) ? null : result.bid,
|
||||
//شماره اقتصادی خریدار
|
||||
Tinb = string.IsNullOrEmpty(result.tinb) ? null : result.tinb,
|
||||
//کد شعبه فروشنده
|
||||
Sbc = string.IsNullOrEmpty(result.sbc) ? null : result.sbc,
|
||||
//کد پستی خریدار
|
||||
Bpc = string.IsNullOrEmpty(result.bpc) ? null : result.bpc,
|
||||
//کد شعبه خریدار
|
||||
Bbc = string.IsNullOrEmpty(result.bbc) ? null : result.bbc,
|
||||
//شماره پروانه گمرکی
|
||||
Scln = string.IsNullOrEmpty(result.scln) ? null : result.scln,
|
||||
//کد گمرک محل اظهار فروشنده
|
||||
Scc = string.IsNullOrEmpty(result.scc) ? null : result.scc,
|
||||
//شناسه یکتای ثبت قزارداد فروشنده
|
||||
Crn = string.IsNullOrEmpty(result.crn) ? null : result.crn,
|
||||
//مجموع مبلغ قبل از کسر تخفیف
|
||||
Tprdis = result.tprdis ?? null,
|
||||
//مجموع تخفیفات
|
||||
Tdis = result.tdis ?? null,
|
||||
// مجموع مبلغ پس از کسر تخفیف
|
||||
Tadis = result.tadis ?? null,
|
||||
//مجموع مالیات بر ارزش افزوده
|
||||
Tvam = result.tvam ?? null,
|
||||
// مجموع سایر مالیات، عوارض و وجوه قانونی
|
||||
Todam = result.todam ?? null,
|
||||
//صورتحساب مجموع
|
||||
Tbill = result.tbill ?? null,
|
||||
// تسویه روش
|
||||
Setm = result.setm == 0 ? null : result.setm ?? null,
|
||||
//نقدی پرداختی مبلغ
|
||||
Cap = result.cap ?? null,
|
||||
//پرداختی نسیه
|
||||
Insp = result.insp ?? null,
|
||||
//مجموع سهم مالیات بر ارزش افزوده از پرداخت
|
||||
Tvop = result.tvop ?? null,
|
||||
//مالیات موضوع 17
|
||||
Tax17 = string.IsNullOrEmpty(result.seventeentax) ? null : Convert.ToDecimal(result.seventeentax),
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
else return BadRequest(new List<string> { "این الگو فعلا در دسترس نمی باشد" });
|
||||
header = new InvoiceHeaderDto
|
||||
{
|
||||
//شماره منحصر به فرد مالیاتی
|
||||
Taxid = _actionTaxPayer.GenerateTaxid(result.inno, result.InvoiceDate.Replace("/", "").Trim()),
|
||||
//زمان صدور
|
||||
Indatim = result.indatim ?? null,
|
||||
//زمان ایجاد
|
||||
Indati2m = result.Indati2m ?? null,
|
||||
// صورتحساب نوع *
|
||||
Inty = result.inty ?? 1,
|
||||
//سریال صورت حساب
|
||||
Inno = string.IsNullOrEmpty(result.inno) ? null : result.inno,
|
||||
//شماره منحصر به فرد مالیاتی صورتحساب مرجع
|
||||
Irtaxid = result.invoiceType == InvoiceType.BackFrmSale || result.invoiceType == InvoiceType.Repair ? result.invoice.taxid
|
||||
: result.invoiceType == InvoiceType.Cancellation ? result.taxid : null,
|
||||
//الگوی صورتحساب *
|
||||
Inp = result.inp ?? 1,
|
||||
//موضوع صورتحساب *
|
||||
Ins = result.ins ?? 1,
|
||||
//شماره اقتصادی فروشنده به جاش شناسه ملی داده شد
|
||||
Tins = string.IsNullOrEmpty(result.tins) ? null : result.tins,
|
||||
//نوع شخص خریدار
|
||||
Tob = level == 10 ? null : result.tob,
|
||||
//شماره/شناسه ملی/شناسه مشارکت مدنی / کد فراگیر
|
||||
Bid = level == 10 || string.IsNullOrEmpty(result.bid) ? null : result.bid,
|
||||
//شماره اقتصادی خریدار
|
||||
Tinb = level == 10 || string.IsNullOrEmpty(result.tinb) ? null : result.tinb,
|
||||
//کد شعبه فروشنده
|
||||
Sbc = string.IsNullOrEmpty(result.sbc) ? null : result.sbc,
|
||||
//کد پستی خریدار
|
||||
Bpc = level == 10 || string.IsNullOrEmpty(result.bpc) ? null : result.bpc,
|
||||
//کد شعبه خریدار
|
||||
Bbc = level == 10 || string.IsNullOrEmpty(result.bbc) ? null : result.bbc,
|
||||
//نوع پرواز
|
||||
Ft = level == 9 ? result.ft : null,
|
||||
//شماره گذرنامه خریدار
|
||||
Bpn = (level == 9 || level == 4) && !string.IsNullOrEmpty(result.bpn) ? result.bpn : null,
|
||||
//شماره پروانه گمرکی
|
||||
Scln = (level == 3 || level == 4) && !string.IsNullOrEmpty(result.scln) ? result.scln : null,
|
||||
//کد گمرک محل اظهار فروشنده
|
||||
Scc = (level == 3 || level == 4 || level == 10) && !string.IsNullOrEmpty(result.scc) ? result.scc : null,
|
||||
//شماره کدتاژ اظهارنامه گمرکی
|
||||
Cdcn = level == 10 ? result.cdcn : null,
|
||||
//تاریخ کوتاژ اظهارنامه گمرکی
|
||||
// Cdcd = level == 10 ? result.cdcd : null,
|
||||
//شناسه یکتای ثبت قزارداد فروشنده
|
||||
Crn = (level == 3 || level == 4 || level == 5 || level == 6) && !string.IsNullOrEmpty(result.crn) ? result.crn : null,
|
||||
//شماره اشتراک/شناسه قبض بهره بردار
|
||||
Billid = level == 8 ?result.billid:null,
|
||||
//مجموع مبلغ قبل از کسر تخفیف
|
||||
Tprdis = level == 10 ? null : result.tprdis ?? null,
|
||||
//مجموع تخفیفات
|
||||
Tdis = level == 10 ? null : result.tdis ?? null,
|
||||
// مجموع مبلغ پس از کسر تخفیف
|
||||
Tadis = level == 10 ? null : result.tadis ?? null,
|
||||
//مجموع مالیات بر ارزش افزوده
|
||||
Tvam = result.tvam ?? null,
|
||||
// مجموع سایر مالیات، عوارض و وجوه قانونی
|
||||
Todam = result.todam ?? null,
|
||||
//صورتحساب مجموع
|
||||
Tbill = result.tbill ?? null,
|
||||
//مجموع وزن خالض
|
||||
Tonw = level == 10 ? result.tonw : null,
|
||||
//مجموع ارزش ریالی
|
||||
Torv = level == 10 ? result.torv : null,
|
||||
//مجموع ارزش ارزی
|
||||
Tocv = level == 10 ? result.tocv : null,
|
||||
// تسویه روش
|
||||
Setm = level == 8|| level == 10|| level == 11|| level == 13 || result.setm == 0 ? null : result.setm ?? null,
|
||||
//نقدی پرداختی مبلغ
|
||||
Cap = level == 8 || level == 10 || level == 11 || level == 13 ?null : result.cap ?? null,
|
||||
//پرداختی نسیه
|
||||
Insp = level == 8 || level == 10 || level == 11 || level == 13 ? null : result.insp ?? null,
|
||||
//مجموع سهم مالیات بر ارزش افزوده از پرداخت
|
||||
Tvop = level == 8 || level == 10 || level == 11 || level == 13 ? null : result.tvop ?? null,
|
||||
//مالیات موضوع 17
|
||||
Tax17 = level == 10 || string.IsNullOrEmpty(result.seventeentax) ? null : Convert.ToDecimal(result.seventeentax),
|
||||
//شماره اقتصادی آژانس
|
||||
Tinc = level == 9 && !string.IsNullOrEmpty(result.tinc) ? result.tinc : null
|
||||
};
|
||||
#endregion header
|
||||
|
||||
|
||||
|
||||
|
||||
//body
|
||||
List<InvoiceBodyDto> InvoiceBody = new List<InvoiceBodyDto>();
|
||||
foreach (var bitem in result.invoiceDetails)
|
||||
{
|
||||
InvoiceBodyDto item = new InvoiceBodyDto();
|
||||
#region body
|
||||
if (header.Inty == 1 && header.Inp == 1)
|
||||
|
||||
item = new InvoiceBodyDto
|
||||
{
|
||||
//شناسه کالا / خدمت
|
||||
@@ -267,23 +291,29 @@ namespace Back.Controllers
|
||||
//شرح کاال/خدمت
|
||||
Sstt = bitem.sstt,
|
||||
// تعداد
|
||||
Am = bitem.am,
|
||||
Am = level==4 ?null: bitem.am,
|
||||
//واحد اندازه گیری
|
||||
Mu = string.IsNullOrEmpty(bitem.mu) ? null : bitem.mu,
|
||||
Mu = level == 4 || string.IsNullOrEmpty(bitem.mu) ? null : bitem.mu,
|
||||
//وزن خالص
|
||||
Nw=level==10 ? bitem.nw : null,
|
||||
// مبلغ واحد
|
||||
Fee = bitem.fee,
|
||||
Fee = level == 4 ? null : bitem.fee,
|
||||
//میزان ارز
|
||||
Cfee = bitem.cfee,
|
||||
Cfee = level==8 || level==10 ?null: bitem.cfee,
|
||||
//نوع ارز
|
||||
Cut = string.IsNullOrEmpty(bitem.cut) ? null : bitem.cut,
|
||||
Cut = level == 8 || string.IsNullOrEmpty(bitem.cut) ? null : bitem.cut,
|
||||
//نرخ برابری ارز با ریال
|
||||
Exr = bitem.exr,
|
||||
Exr = level == 8 ?null: bitem.exr,
|
||||
// ارزش ریالی کاا
|
||||
Ssrv= level == 10 ?bitem.ssrv : null,
|
||||
// ارزش ارزی کاا
|
||||
Sscv= level == 10 ? bitem.sscv : null,
|
||||
//مبلغ قبل از تخفیف
|
||||
Prdis = bitem.prdis,
|
||||
Prdis = level == 10 ? null : bitem.prdis,
|
||||
//مبلغ تخفیف
|
||||
Dis = bitem.dis,
|
||||
Dis = level == 10 ? null : bitem.dis,
|
||||
//مبلغ بعد از تخفیف
|
||||
Adis = bitem.adis,
|
||||
Adis = level == 10 ? null : bitem.adis,
|
||||
//نرخ مالیات بر ارزش افزوده
|
||||
Vra = bitem.vra,
|
||||
//مبلغ مالیات بر ارزش افزوده
|
||||
@@ -300,21 +330,60 @@ namespace Back.Controllers
|
||||
Olr = bitem.olr,
|
||||
//مبلغ سایر وجوه قانونی
|
||||
Olam = bitem.olam,
|
||||
//اجرت ساخت
|
||||
Consfee = level ==5 || level ==13 ?bitem.consfee : null,
|
||||
// سود فروشنده
|
||||
Spro= level == 5 || level == 13 ? bitem.spro : null,
|
||||
//حقالعمل
|
||||
Bros= level == 5 || level == 13 ? bitem.bros : null,
|
||||
//جمع کل اجرت، حقالعمل و سود
|
||||
Tcpbs= level == 5 || level == 13 ? bitem.tcpbs : null,
|
||||
//سهم نقدی از پرداخت
|
||||
Cop = bitem.cop,
|
||||
Cop = level==8 ||level==10 ||level==11||level==13 ? null : bitem.cop,
|
||||
//سهم مالیات بر لرزش افزوده از پرداخت
|
||||
Vop = bitem.vop,
|
||||
Vop = level == 8 || level == 10 || level == 11 || level == 13 ? null : bitem.vop,
|
||||
//شناسه یکتای ثبت قرارداد حق العمل کاری
|
||||
Bsrn = string.IsNullOrEmpty(bitem.bsrn) ? null : bitem.bsrn,
|
||||
// مبلغ کل کالا / خدمت
|
||||
Tsstam = bitem.tsstam,
|
||||
//فاوت نرخ خرید و فروش ارز/ کارمزد فروش ارز
|
||||
Pspd=level==4 ?bitem.pspd: null,
|
||||
//عیار
|
||||
Cui =level==5||level==13?bitem.cui: null
|
||||
};
|
||||
#endregion
|
||||
InvoiceBody.Add(item);
|
||||
}
|
||||
|
||||
|
||||
var responseModel = await _actionTaxPayer.SendInvoice(user.RolUsers.First().CompanyID, header, InvoiceBody, new PaymentDto { });
|
||||
//Pay
|
||||
List<PaymentDto> InvoicePay = new List<PaymentDto>();
|
||||
if(level!=10)
|
||||
foreach (var pitem in result.payments)
|
||||
{
|
||||
PaymentDto payment = new PaymentDto();
|
||||
payment = new PaymentDto
|
||||
{
|
||||
Iinn=pitem.iinn,
|
||||
Acn=pitem.acn,
|
||||
Trmn=pitem.trmn,
|
||||
Pmt=pitem.pmt,
|
||||
Trn=pitem.trn,
|
||||
Pcn=pitem.pcn,
|
||||
Pid=pitem.pid,
|
||||
Pdt=pitem.pdt,
|
||||
Pv=pitem.pv,
|
||||
|
||||
};
|
||||
|
||||
InvoicePay.Add(payment);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var responseModel = await _actionTaxPayer.SendInvoice(user.RolUsers.First().CompanyID, header, InvoiceBody, InvoicePay);
|
||||
if (responseModel == null)
|
||||
{
|
||||
return BadRequest(new List<string> { "خطا در ورود به سامانه مودیان" });
|
||||
|
@@ -151,18 +151,12 @@ namespace Back.Data.Models
|
||||
public string? seventeentax { get; set; }
|
||||
//نکته باید به شمسی تبدیل شود
|
||||
public string? Cdate { get; set; }
|
||||
//تفاوت نرخ خرید و فروش ارز/ کارمزد فروش ارز
|
||||
[MaxLength(26)]
|
||||
public decimal? pspd { get; set; }
|
||||
public string? Udate { get; set; }
|
||||
public string InvoicIssueDate { get; set; }
|
||||
public string InvoiceDate { get; set; }
|
||||
public bool PreparedtoSendtoTax { get; set; } = false;
|
||||
public int LastChangeUserID { get; set; }
|
||||
public bool IsDeleted { get; set; }
|
||||
//عیار
|
||||
[MaxLength(26)]
|
||||
public decimal? cui { get; set; }
|
||||
//شماره اقتصادی آژانس
|
||||
[MaxLength(14)]
|
||||
public string? tinc { get; set; }
|
||||
|
@@ -133,6 +133,10 @@ namespace Back.Data.Models
|
||||
[MaxLength(12)]
|
||||
public string? bsrn { get; set; }
|
||||
public decimal? _cfee { get; set; }
|
||||
//تفاوت نرخ خرید و فروش ارز
|
||||
public decimal? pspd { get; set; }
|
||||
//عیار
|
||||
public decimal? cui { get; set; }
|
||||
#endregion
|
||||
|
||||
#region Navigation
|
||||
|
@@ -14,7 +14,7 @@ namespace Back.Data.Models
|
||||
#region autofild
|
||||
//تاریخ و زمان پرداخت
|
||||
[MaxLength(13)]
|
||||
public long? pdt { get { return new DateTimeOffset(PaymentDateTime.Trim().ToMiladi()).ToUnixTimeMilliseconds(); } }
|
||||
public long? pdt { get { return new DateTimeOffset(PaymentDateTime.Trim().ToMiladi()).ToUnixTimeSeconds(); } }
|
||||
#endregion
|
||||
|
||||
#region fild
|
||||
|
@@ -48,7 +48,7 @@ namespace Back.Services
|
||||
return inquiryResultModels[0];
|
||||
return null;
|
||||
}
|
||||
public async Task<TaxCollectData.Library.Dto.HttpResponse<AsyncResponseModel>> SendInvoice(int CompanyID,InvoiceHeaderDto header, List<InvoiceBodyDto> InvoiceBody, PaymentDto payment)
|
||||
public async Task<TaxCollectData.Library.Dto.HttpResponse<AsyncResponseModel>> SendInvoice(int CompanyID,InvoiceHeaderDto header, List<InvoiceBodyDto> InvoiceBody, List<PaymentDto> payments)
|
||||
{
|
||||
//return new TaxCollectData.Library.Dto.HttpResponse<AsyncResponseModel>
|
||||
// ( body: new AsyncResponseModel(
|
||||
@@ -62,7 +62,7 @@ namespace Back.Services
|
||||
{
|
||||
new()
|
||||
{
|
||||
Header =header,Body =InvoiceBody,Payments = new() {payment}
|
||||
Header =header,Body =InvoiceBody,Payments = payments
|
||||
}
|
||||
}
|
||||
, null);
|
||||
|
@@ -39,7 +39,7 @@ namespace Back.Services
|
||||
.ThenInclude(inc => inc.CODUnit)
|
||||
.Include(inc => inc.Customer)
|
||||
.Include(inc => inc.sentTax)
|
||||
//.Include(inc => inc.payments)
|
||||
.Include(inc => inc.payments)
|
||||
.Include(inc => inc.pattern)
|
||||
.ThenInclude(inc => inc.BillType)
|
||||
|
||||
@@ -92,22 +92,22 @@ namespace Back.Services
|
||||
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()
|
||||
};
|
||||
payments =
|
||||
item.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()
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
@@ -15,13 +15,14 @@ namespace Back.Services
|
||||
private readonly IAsyncRepository<BillType> _repoBillType;
|
||||
private readonly IAsyncRepository<Invoice> _invoiceRepo;
|
||||
private readonly IAsyncRepository<InvoiceItem> _invoiceitemRepo;
|
||||
private readonly IAsyncRepository<InvoicePayment> _invoicePaymentRepo;
|
||||
private readonly IAsyncRepository<FildModeInPattern> _fildModeInPatternRepo;
|
||||
private readonly IAsyncRepository<Coding> _codingRepo;
|
||||
private readonly IAsyncRepository<SpecialCondition> _specialConditionRepo;
|
||||
public servTaxPayer(IAsyncRepository<SentTax> repoSentTax, IAsyncRepository<Pattern> repoPattern
|
||||
, IAsyncRepository<Invoice> invoiceRepo, IAsyncRepository<FildModeInPattern> fildModeInPatternRepo
|
||||
, IAsyncRepository<Coding> codingRepo, IAsyncRepository<SpecialCondition> specialConditionRepo
|
||||
, IAsyncRepository<InvoiceItem> invoiceitemRepo, IAsyncRepository<BillType> repoBillType)
|
||||
, IAsyncRepository<InvoiceItem> invoiceitemRepo, IAsyncRepository<BillType> repoBillType, IAsyncRepository<InvoicePayment> invoicePaymentRepo)
|
||||
{
|
||||
_repoSentTax = repoSentTax;
|
||||
_repoPattern = repoPattern;
|
||||
@@ -31,6 +32,7 @@ namespace Back.Services
|
||||
_specialConditionRepo = specialConditionRepo;
|
||||
_invoiceitemRepo = invoiceitemRepo;
|
||||
_repoBillType = repoBillType;
|
||||
_invoicePaymentRepo= invoicePaymentRepo;
|
||||
}
|
||||
public async Task<bool> ExistSuccessfulorSendorpendingInvoiceinCompanyID(int CompanyID)
|
||||
{
|
||||
@@ -214,6 +216,18 @@ namespace Back.Services
|
||||
if (!await _invoiceitemRepo.UpdateAsync(invoiceDetItem))
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach (var pitem in FildItems.Payments)
|
||||
{
|
||||
var invoicepayments = InvoiceItem.payments.Where(w => w.ID == pitem.ID).FirstOrDefault();
|
||||
foreach (var item in pitem.filds.Where(w => w.InputBox == "fild" || w.InputBox == "fromdb"))
|
||||
{
|
||||
if (invoicepayments != null)
|
||||
SetValue(item, ref invoicepayments);
|
||||
}
|
||||
if (!await _invoicePaymentRepo.UpdateAsync(invoicepayments))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else return false;
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user