This commit is contained in:
mmrbnjd
2024-12-10 17:17:17 +03:30
parent 384bcbc20f
commit f2de3710f6
4 changed files with 276 additions and 76 deletions

View File

@@ -186,7 +186,7 @@ namespace Back.Controllers
#region Inital Send
InvoiceHeaderDto header = new InvoiceHeaderDto();
PreparationHeaderTaxInvoice preparation = new PreparationHeaderTaxInvoice(result, _actionTaxPayer);
int level = result.pattern.ID;
@@ -196,84 +196,110 @@ namespace Back.Controllers
header = new InvoiceHeaderDto
{
//شماره منحصر به فرد مالیاتی
Taxid = _actionTaxPayer.GenerateTaxid(result.inno, result.InvoiceDate.Replace("/", "").Trim()),
Taxid = preparation.Taxid,
//زمان صدور
Indatim = result.indatim ?? null,
Indatim = preparation.Indatim,
//زمان ایجاد
Indati2m = result.Indati2m ?? null,
Indati2m = preparation.Indati2m,
// صورتحساب نوع *
Inty = result.inty ?? 1,
Inty = preparation.Inty,
//سریال صورت حساب
Inno = string.IsNullOrEmpty(result.inno) ? null : result.inno,
Inno = preparation.Inno,
//شماره منحصر به فرد مالیاتی صورتحساب مرجع
Irtaxid = result.invoiceType == InvoiceType.BackFrmSale || result.invoiceType == InvoiceType.Repair ? result.invoice.taxid
: result.invoiceType == InvoiceType.Cancellation ? result.taxid : null,
Irtaxid = preparation.Irtaxid,
//الگوی صورتحساب *
Inp = result.inp ?? 1,
Inp = preparation.Inp,
//موضوع صورتحساب *
Ins = result.ins ?? 1,
Ins = preparation.Ins,
//شماره اقتصادی فروشنده به جاش شناسه ملی داده شد
Tins = string.IsNullOrEmpty(result.tins) ? null : result.tins,
Tins = preparation.Tins,
//نوع شخص خریدار
Tob = level == 10 ? null : result.tob==5 ? 1 : result.tob==6 ? 4 : result.tob,
Tob = preparation.Tob,
//شماره/شناسه ملی/شناسه مشارکت مدنی / کد فراگیر
Bid = level == 10 || string.IsNullOrEmpty(result.bid) || !string.IsNullOrEmpty(result.tinb)
|| result.tob == 1 || result.tob == 2 || result.tob == 3 || result.tob == 4 ? null : result.bid,
Bid = preparation.Bid,
//شماره اقتصادی خریدار
Tinb = level == 10 || string.IsNullOrEmpty(result.tinb) || result.tob == 5 || result.tob == 6 ? null : result.tinb,
Tinb = preparation.Tinb,
//کد شعبه فروشنده
Sbc = string.IsNullOrEmpty(result.sbc) ? null : result.sbc,
Sbc = preparation.Sbc,
//کد پستی خریدار
Bpc = level == 10 || string.IsNullOrEmpty(result.bpc) || !string.IsNullOrEmpty(result.tinb)
|| result.tob == 1 || result.tob == 2 || result.tob == 3 || result.tob == 4 ? null : result.bpc,
Bpc = preparation.Bpc,
//کد شعبه خریدار
Bbc = level == 10 || string.IsNullOrEmpty(result.bbc) ? null : result.bbc,
Bbc = preparation.Bbc,
//نوع پرواز
Ft = level == 9 ? result.ft : null,
Ft = preparation.Ft,
//شماره گذرنامه خریدار
Bpn = (level == 9 || level == 4) && !string.IsNullOrEmpty(result.bpn) ? result.bpn : null,
Bpn = preparation.Bpn,
//شماره پروانه گمرکی
Scln = (level == 3 || level == 4) && !string.IsNullOrEmpty(result.scln) ? result.scln : null,
Scln = preparation.Scln,
//کد گمرک محل اظهار فروشنده
Scc = (level == 3 || level == 4 || level == 10) && !string.IsNullOrEmpty(result.scc) ? result.scc : null,
Scc = preparation.Scc,
//شماره کدتاژ اظهارنامه گمرکی
Cdcn = level == 10 ? result.cdcn : null,
Cdcn = preparation.Cdcn,
//تاریخ کوتاژ اظهارنامه گمرکی
Cdcd = level == 10 ? result.cdcd : null,
Cdcd = preparation.Cdcd,
//شناسه یکتای ثبت قزارداد فروشنده
Crn = (level == 3 || level == 4 || level == 5 || level == 6) && !string.IsNullOrEmpty(result.crn) ? result.crn : null,
Crn = preparation.Crn,
//شماره اشتراک/شناسه قبض بهره بردار
Billid = level == 8 ?result.billid:null,
Billid = preparation.Billid,
//مجموع مبلغ قبل از کسر تخفیف
Tprdis = level == 10 ? null : result.tprdis ?? null,
Tprdis = preparation.Tprdis,
//مجموع تخفیفات
Tdis = level == 10 ? null : result.tdis ?? null,
Tdis = preparation.Tdis,
// مجموع مبلغ پس از کسر تخفیف
Tadis = level == 10 ? null : result.tadis ?? null,
Tadis = preparation.Tadis,
//مجموع مالیات بر ارزش افزوده
Tvam = result.tvam ?? null,
Tvam = preparation.Tvam,
// مجموع سایر مالیات، عوارض و وجوه قانونی
Todam = result.todam ?? null,
Todam = preparation.Todam,
//صورتحساب مجموع
Tbill = result.tbill ?? null,
Tbill = preparation.Tbill,
//مجموع وزن خالض
Tonw = level == 10 ? result.tonw : null,
Tonw = preparation.Tonw,
//مجموع ارزش ریالی
Torv = level == 10 ? result.torv : null,
Torv = preparation.Torv,
//مجموع ارزش ارزی
Tocv = level == 10 ? result.tocv : null,
Tocv = preparation.Tocv,
// تسویه روش
Setm = level == 8|| level == 10|| level == 11|| level == 13 || result.setm == 0 ? null : result.setm ?? null,
Setm = preparation.Setm,
//نقدی پرداختی مبلغ
Cap = level == 8 || level == 10 || level == 11 || level == 13 ?null : result.cap ?? null,
Cap = preparation.Cap,
//پرداختی نسیه
Insp = level == 8 || level == 10 || level == 11 || level == 13 ? null : result.insp ?? null,
Insp = preparation.Insp,
//مجموع سهم مالیات بر ارزش افزوده از پرداخت
Tvop = level == 8 || level == 10 || level == 11 || level == 13 ? null : result.tvop ?? null,
Tvop = preparation.Tvop,
//مالیات موضوع 17
Tax17 = level == 10 || string.IsNullOrEmpty(result.seventeentax) ? null : Convert.ToDecimal(result.seventeentax),
Tax17 = preparation.Tax17,
//شماره اقتصادی آژانس
Tinc = level == 9 && !string.IsNullOrEmpty(result.tinc) ? result.tinc : null
Tinc = preparation.Tinc,
//تاریخ اعلامیه فروش
Asd=null,
//شماره اعلامیه فروش
Asn = null,
//شماره ناوگان
Cno=null,
//شهر مقصد
Dci = null,
//کشور مقصد
Dco = null,
//کد ملی/ کد فراگیر اتباع غیر ایرانی راننده) در حمل و نقل جاده ای(
Did = null,
//شماره بارنامه
Lno = null,
//شماره بارنامه مرجع
Lrno = null,
//نوع بارنامه/ نوع حمل
Lt = null,
//شهر مبدا
Oci = null,
//کشور مبدا
Ocu = null,
//شناسه ملی/ شماره ملی/ شناسه مشارکت مدنی/ کد فراگیر اتباع غیر ایرانی گیرنده
Rid = null,
//کالاهای حمل شده
Sg = new List<ShippingGoodDto>(),
//شناسه ملی/ شماره ملی/ شناسه مشارکت مدنی / کد فراگیر اتباع غیر ایرانی فرستنده
Tid =null
};
#endregion header
@@ -285,74 +311,77 @@ namespace Back.Controllers
foreach (var bitem in result.invoiceDetails)
{
InvoiceBodyDto item = new InvoiceBodyDto();
PreparationBodyTaxInvoice preparationBody = new PreparationBodyTaxInvoice(bitem, level);
#region body
item = new InvoiceBodyDto
{
//شناسه کالا / خدمت
Sstid = bitem.sstid,
Sstid = preparationBody.Sstid,
//شرح کاال/خدمت
Sstt = bitem.sstt,
Sstt = preparationBody.Sstt,
// تعداد
Am = level==4 ?null: bitem.am,
Am = preparationBody.Am,
//واحد اندازه گیری
Mu = level == 4 || string.IsNullOrEmpty(bitem.mu) ? null : bitem.mu,
Mu = preparationBody.Mu,
//وزن خالص
Nw=level==10 ? bitem.nw : null,
Nw= preparationBody.Nw,
// مبلغ واحد
Fee = level == 4 ? null : bitem.fee,
Fee = preparationBody.Fee,
//میزان ارز
Cfee = bitem.cfee == 0|| level ==8 || level==10 ?null: bitem.cfee ,
Cfee = preparationBody.Cfee ,
//نوع ارز
Cut = level == 8 || string.IsNullOrEmpty(bitem.cut) ? null : bitem.cut,
Cut = preparationBody.Cut,
//نرخ برابری ارز با ریال
Exr = level == 8 ?null: bitem.exr,
Exr = preparationBody.Exr,
// ارزش ریالی کاا
Ssrv= level == 10 ?bitem.ssrv : null,
Ssrv= preparationBody.Ssrv,
// ارزش ارزی کاا
Sscv= level == 10 ? bitem.sscv : null,
Sscv= preparationBody.Sscv,
//مبلغ قبل از تخفیف
Prdis = level == 10 ? null : bitem.prdis,
Prdis = preparationBody.Prdis,
//مبلغ تخفیف
Dis = level == 10 ? null : bitem.dis,
Dis = preparationBody.Dis,
//مبلغ بعد از تخفیف
Adis = level == 10 ? null : bitem.adis,
Adis = preparationBody.Adis,
//نرخ مالیات بر ارزش افزوده
Vra = bitem.vra,
Vra = preparationBody.Vra,
//مبلغ مالیات بر ارزش افزوده
Vam = bitem.vam,
Vam = preparationBody.Vam,
//موضوع سایر مالیات و عوارض
Odt = string.IsNullOrEmpty(bitem.odt) ? null : bitem.odt,
Odt = preparationBody.Odt,
//نرخ سایر مالیات و عوارض
Odr = bitem.odr,
Odr = preparationBody.Odr,
//مبلغ سایر مالیات و عوارض
Odam = bitem.odam,
Odam = preparationBody.Odam,
//موضوع سایر وجوه قانونی
Olt = string.IsNullOrEmpty(bitem.olt) ? null : bitem.olt,
Olt = preparationBody.Olt,
//نرخ سایر وجوه قانونی
Olr = bitem.olr,
Olr = preparationBody.Olr,
//مبلغ سایر وجوه قانونی
Olam = bitem.olam,
Olam = preparationBody.Olam,
//اجرت ساخت
Consfee = level ==5 || level ==13 ?bitem.consfee : null,
Consfee = preparationBody.Consfee,
// سود فروشنده
Spro= level == 5 || level == 13 ? bitem.spro : null,
Spro= preparationBody.Spro,
//حقالعمل
Bros= level == 5 || level == 13 ? bitem.bros : null,
Bros= preparationBody.Bros,
//جمع کل اجرت، حقالعمل و سود
Tcpbs= level == 5 || level == 13 ? bitem.tcpbs : null,
Tcpbs= preparationBody.Tcpbs,
//سهم نقدی از پرداخت
Cop = level==8 ||level==10 ||level==11||level==13 ? null : bitem.cop,
Cop = preparationBody.Cop,
//سهم مالیات بر لرزش افزوده از پرداخت
Vop = level == 8 || level == 10 || level == 11 || level == 13 ? null : bitem.vop,
Vop = preparationBody.Vop,
//شناسه یکتای ثبت قرارداد حق العمل کاری
Bsrn = string.IsNullOrEmpty(bitem.bsrn) ? null : bitem.bsrn,
Bsrn = preparationBody.Bsrn,
// مبلغ کل کالا / خدمت
Tsstam = bitem.tsstam,
//فاوت نرخ خرید و فروش ارز/ کارمزد فروش ارز
// Pspd=level==4 ?bitem.pspd: null,
Tsstam = preparationBody.Tsstam,
//عیار
Cui =level==5||level==13?bitem.cui: null
Cui = preparationBody.Cui,
// نرخ خرید ارز
Cpr = preparationBody.Cpr,
//ماخذ مالیات بر ارزش افزوده در الگوی فروش ارز
Sovat = preparationBody.Sovat
};
#endregion
InvoiceBody.Add(item);