void LlenarMontosIGV(En_ComprobanteElectronico Comprobante, ref DebitNoteType debitNote) { List <TaxSubtotalType> oListaSubtotal = new List <TaxSubtotalType>(); if (Comprobante.MontoTotales != null) { if (Comprobante.MontoTotales.Gravado != null) { if (Comprobante.MontoTotales.Gravado.GravadoIGV != null) { TaxSubtotalType oTotalGravado = LlenarSubTotalCabecera(Comprobante.MontoTotales.Gravado.GravadoIGV.MontoBase, Comprobante.MontoTotales.Gravado.GravadoIGV.MontoTotalImpuesto, Comprobante.Moneda, Comprobante.MontoTotales.Gravado.GravadoIGV.Porcentaje, "1000", "IGV", "VAT"); oListaSubtotal.Add(oTotalGravado); } } } TaxTotalType oTaxTotal = new TaxTotalType { TaxAmount = new TaxAmountType { Value = Comprobante.TotalImpuesto, currencyID = Comprobante.Moneda }, TaxSubtotal = oListaSubtotal.ToArray() }; debitNote.TaxTotal = new TaxTotalType[] { oTaxTotal }; }
/// <summary> /// Toplam verginin hesaplanması /// </summary> public virtual TaxTotalType[] CalculateTaxTotal() { List <TaxTotalType> taxTotalList = new List <TaxTotalType>(); List <TaxSubtotalType> taxSubTotalList = new List <TaxSubtotalType>(); TaxTotalType taxTotal = new TaxTotalType { TaxAmount = new TaxAmountType { Value = 0 } }; var taxSubtotal = new TaxSubtotalType { TaxableAmount = new TaxableAmountType { Value = 0 }, TaxAmount = new TaxAmountType { Value = 0 }, Percent = new PercentType1 { Value = 0 }, TaxCategory = new TaxCategoryType { TaxScheme = new TaxSchemeType { Name = new NameType1 { Value = "KDV" }, TaxTypeCode = new TaxTypeCodeType { Value = "0015" } } } }; foreach (var item in BaseUBL.InvoiceLine) { taxTotal.TaxAmount.Value += item.TaxTotal.TaxAmount.Value; taxTotal.TaxAmount.currencyID = item.TaxTotal.TaxAmount.currencyID; foreach (var tax in item.TaxTotal.TaxSubtotal) { taxSubtotal.TaxableAmount.Value += tax.TaxableAmount.Value; taxSubtotal.TaxableAmount.currencyID = tax.TaxableAmount.currencyID; taxSubtotal.TaxAmount.Value += item.TaxTotal.TaxAmount.Value; taxSubtotal.TaxAmount.currencyID = tax.TaxAmount.currencyID; taxSubtotal.Percent.Value = tax.Percent.Value; } } taxSubTotalList.Add(taxSubtotal); taxTotal.TaxSubtotal = taxSubTotalList.ToArray(); taxTotalList.Add(taxTotal); return(taxTotalList.ToArray()); }
private static decimal GetKdvTutar(TaxTotalType TaxTotal) { if (TaxTotal != null) { return(TaxTotal.TaxAmount.Value); } else { return(0); } }
private static decimal GetKdvOran(TaxTotalType TaxTotal) { if (TaxTotal != null) { return(TaxTotal.TaxSubtotal[0].Percent.Value); } else { return(0); } }
private void GetKDV(TaxTotalType taxTotal) { txtKdvTutar.Text = ""; txtKdvOrani.Text = ""; if (taxTotal != null) { txtKdvTutar.Text = taxTotal.TaxAmount.Value.ToString(); txtKdvOrani.Text = taxTotal.TaxSubtotal[0].Percent.Value.ToString(); } }
private TaxTotalType[] Taxlar(string _GenelToplamTax) { List <TaxTotalType> Liste = new List <TaxTotalType>(); string GenelToplamTax = _GenelToplamTax; TaxTotalType _taxTotalType = new TaxTotalType() { TaxAmount = new TaxAmountType { currencyID = "TRY", Value = Convert.ToDecimal(_GenelToplamTax) } }; _taxTotalType.TaxSubtotal = SubTotalEkle(); Liste.Add(_taxTotalType); return(Liste.ToArray()); }
private string XmlCreate() { InvoiceType res = new InvoiceType(); res .With(io => { #region Invoice io.UBLVersionID.Value = "2.1"; io.CustomizationID.Value = "TR1.2"; io.ProfileID.Value = "TEMELFATURA"; io.InvoiceTypeCode.Value = "SATIS"; io.ID.Value = "HKN0000000000001"; io.UUID.Value = Guid.NewGuid().ToString(); io.IssueDate.Value = DateTime.Now; io.IssueTime.Value = DateTime.Now; io.DocumentCurrencyCode.Value = "TRY"; io.LineCountNumeric.Value = 1; io.Note = new List <NoteType>(); NoteType oNewNote = new NoteType(); oNewNote.Value = "Test Dip Not"; io.Note.Add(oNewNote); //xslt base64 formatında gömme io.AdditionalDocumentReference = new List <DocumentReferenceType>(); DocumentReferenceType oNewAdd = new DocumentReferenceType(); oNewAdd.ID.Value = io.UUID.Value; oNewAdd.IssueDate.Value = DateTime.Now; oNewAdd.Attachment = new AttachmentType(); oNewAdd.Attachment .With(att => { att.EmbeddedDocumentBinaryObject = new EmbeddedDocumentBinaryObjectType(); att.EmbeddedDocumentBinaryObject.filename = io.UUID.Value + ".xslt"; att.EmbeddedDocumentBinaryObject.characterSetCode = "UTF-8"; att.EmbeddedDocumentBinaryObject.encodingCode = "Base64"; att.EmbeddedDocumentBinaryObject.mimeCode = "application/xml"; att.EmbeddedDocumentBinaryObject.Value = System.Text.Encoding.UTF8.GetBytes(File.ReadAllText(System.Windows.Forms.Application.StartupPath + "/general.xslt")); }); io.AdditionalDocumentReference.Add(oNewAdd); //irsaliye bilgilerini ekleme io.DespatchDocumentReference = new List <DocumentReferenceType>(); DocumentReferenceType onewSip = new DocumentReferenceType(); onewSip.ID.Value = "A859552"; onewSip.IssueDate.Value = DateTime.Now; io.DespatchDocumentReference.Add(onewSip); //Sipariş bilgilerini ekleme io.OrderReference = new OrderReferenceType(); io.OrderReference.ID.Value = "32123"; io.OrderReference.IssueDate.Value = DateTime.Now; #endregion #region Signature //io.Signature = new List<SignatureType>(); //SignatureType oSig = new SignatureType(); //oSig // .With(sg => // { // sg.ID = new IDType(); // sg.ID.schemeID = "VKN_TCKN"; // sg.ID.Value = "1288331521"; // sg.SignatoryParty = new PartyType(); // sg.SignatoryParty // .With(sp => // { // sp.PartyIdentification = new List<PartyIdentificationType>(); // PartyIdentificationType oPartyIdent = new PartyIdentificationType(); // oPartyIdent.ID = new IDType(); // oPartyIdent.ID.schemeID = "VKN"; // oPartyIdent.ID.Value = oSirket.RegisterNumber; // sp.PartyIdentification.Add(oPartyIdent); // sp.PostalAddress = new AddressType(); // sp.PostalAddress // .With(pa => // { // pa.StreetName = new StreetNameType(); // pa.StreetName.Value = oSirket.Address; // //pa.BuildingNumber = new BuildingNumberType(); // //pa.BuildingNumber.Value = "21"; // pa.CitySubdivisionName = new CitySubdivisionNameType(); // pa.CitySubdivisionName.Value = oSirket.District; // pa.CityName = new CityNameType(); // pa.CityName.Value = oSirket.City; // //pa.PostalZone = new PostalZoneType(); // //pa.PostalZone.Value = "34100"; // pa.Country = new CountryType(); // pa.Country.Name.Value = oSirket.Country; // }); // }); // sg.DigitalSignatureAttachment = new AttachmentType(); // sg.DigitalSignatureAttachment.ExternalReference = new ExternalReferenceType(); // sg.DigitalSignatureAttachment.ExternalReference.URI.Value = "#Signature"; // }); //io.Signature.Add(oSig); #endregion #region AccountingSupplierParty io.AccountingSupplierParty = new SupplierPartyType(); io.AccountingSupplierParty .With(asp => { asp.Party = new PartyType(); asp.Party .With(pp => { pp.WebsiteURI = new WebsiteURIType(); pp.WebsiteURI.Value = "www.hakanuçar.com.tr"; pp.PartyIdentification = new List <PartyIdentificationType>(); pp.PartyIdentification.Add( new PartyIdentificationType { ID = new IDType { schemeID = "VKN", Value = "1234567801" } } ); //Firma diğer bilgiler pp.PartyIdentification.Add( new PartyIdentificationType { ID = new IDType { schemeID = "MERSISNO", Value = "4235234" } } ); pp.PartyName = new PartyNameType(); pp.PartyName.Name.Value = "Hakan UÇAR Bilgi İşlem"; pp.PostalAddress = new AddressType(); pp.PostalAddress .With(pa => { pa.ID = new IDType(); pa.ID.Value = "1234567801"; pa.StreetName = new StreetNameType(); pa.StreetName.Value = "KOZYATAĞI"; //pa.BuildingNumber = new BuildingNumberType(); //pa.BuildingNumber.Value = "21"; pa.CitySubdivisionName = new CitySubdivisionNameType(); pa.CitySubdivisionName.Value = "Beşiktaş"; pa.CityName = new CityNameType(); pa.CityName.Value = "İstanbul"; //pa.PostalZone = new PostalZoneType(); //pa.PostalZone.Value = "341000"; pa.Country = new CountryType(); pa.Country.Name.Value = "Türkiye"; }); pp.PartyTaxScheme = new PartyTaxSchemeType(); pp.PartyTaxScheme.TaxScheme = new TaxSchemeType(); pp.PartyTaxScheme.TaxScheme.Name = new NameType1(); pp.PartyTaxScheme.TaxScheme.Name.Value = "KOZYATAĞI"; pp.Contact = new ContactType(); pp.Contact .With(co => { co.Name = new NameType1(); co.Name.Value = "Hakan UÇAR"; co.Telephone = new TelephoneType(); co.Telephone.Value = "0592 558 5588"; co.Telefax = new TelefaxType(); co.Telefax.Value = "0592 558 5588"; co.ElectronicMail = new ElectronicMailType(); co.ElectronicMail.Value = "*****@*****.**"; }); }); }); #endregion #region AccountingCustomerParty io.AccountingCustomerParty = new CustomerPartyType(); string Senaryo = "0"; switch (Senaryo) { //Temel Fatura case "0": { #region customerinf io.AccountingCustomerParty .With(cus => { cus.Party = new PartyType(); cus.Party .With(cusp => { cusp.WebsiteURI = new WebsiteURIType(); cusp.WebsiteURI.Value = "www.hakanuçar.com.tr"; cusp.PartyIdentification = new List <PartyIdentificationType>(); PartyIdentificationType pi = new PartyIdentificationType(); pi.ID = new IDType(); pi.ID.schemeID = "VKN"; pi.ID.Value = "1234567801"; cusp.PartyIdentification.Add(pi); cusp.PartyName = new PartyNameType(); cusp.PartyName.Name.Value = "Hakan UÇAR bilgi İşlem"; cusp.PostalAddress = new AddressType(); cusp.PostalAddress .With(cupa => { cupa.ID = new IDType(); cupa.ID.Value = "1234567801"; cupa.StreetName = new StreetNameType(); cupa.StreetName.Value = "Kadıköy"; cupa.CityName = new CityNameType(); cupa.CityName.Value = "İstanbul"; cupa.CitySubdivisionName = new CitySubdivisionNameType(); cupa.CitySubdivisionName.Value = "Kadıköy"; cupa.Country = new CountryType(); cupa.Country.Name.Value = "Türkiye"; cupa.PostalZone = new PostalZoneType(); cupa.PostalZone.Value = "34000"; }); cusp.Contact = new ContactType(); cusp.Contact .With(cuc => { cuc.Name = new NameType1(); cuc.Name.Value = "Hakan UÇAR"; cuc.Telephone = new TelephoneType(); cuc.Telephone.Value = "0555 55 55 55"; cuc.Telefax = new TelefaxType(); cuc.Telefax.Value = "0555 55 55 55"; cuc.ElectronicMail = new ElectronicMailType(); cuc.ElectronicMail.Value = "*****@*****.**"; }); }); }); #endregion } break; //Ticari Fatura case "1": { #region customerinf io.AccountingCustomerParty .With(cus => { cus.Party = new PartyType(); cus.Party .With(cusp => { cusp.WebsiteURI = new WebsiteURIType(); cusp.WebsiteURI.Value = "www.hakanuçar.com.tr"; cusp.PartyIdentification = new List <PartyIdentificationType>(); PartyIdentificationType pi = new PartyIdentificationType(); pi.ID = new IDType(); pi.ID.schemeID = "VKN"; pi.ID.Value = "1234567801"; cusp.PartyIdentification.Add(pi); cusp.PartyName = new PartyNameType(); cusp.PartyName.Name.Value = "Hakan UÇAR bilgi İşlem"; cusp.PostalAddress = new AddressType(); cusp.PostalAddress .With(cupa => { cupa.ID = new IDType(); cupa.ID.Value = "1234567801"; cupa.StreetName = new StreetNameType(); cupa.StreetName.Value = "Kadıköy"; cupa.CityName = new CityNameType(); cupa.CityName.Value = "İstanbul"; cupa.CitySubdivisionName = new CitySubdivisionNameType(); cupa.CitySubdivisionName.Value = "Kadıköy"; cupa.Country = new CountryType(); cupa.Country.Name.Value = "Türkiye"; cupa.PostalZone = new PostalZoneType(); cupa.PostalZone.Value = "34000"; }); cusp.Contact = new ContactType(); cusp.Contact .With(cuc => { cuc.Name = new NameType1(); cuc.Name.Value = "Hakan UÇAR"; cuc.Telephone = new TelephoneType(); cuc.Telephone.Value = "0555 55 55 55"; cuc.Telefax = new TelefaxType(); cuc.Telefax.Value = "0555 55 55 55"; cuc.ElectronicMail = new ElectronicMailType(); cuc.ElectronicMail.Value = "*****@*****.**"; }); }); }); #endregion } break; //İhracat case "2": { #region ExportCustomerInfo io.AccountingCustomerParty .With(cus => { cus.Party = new PartyType(); cus.Party .With(cusp => { cusp.WebsiteURI = new WebsiteURIType(); cusp.WebsiteURI.Value = ""; cusp.PartyIdentification = new List <PartyIdentificationType>(); PartyIdentificationType pi = new PartyIdentificationType(); pi.ID = new IDType(); pi.ID.schemeID = "VKN"; pi.ID.Value = "1460415308"; cusp.PartyIdentification.Add(pi); cusp.PartyName = new PartyNameType(); cusp.PartyName.Name.Value = "Gümrük ve Ticaret Bakanlığı Gümrükler Genel Müdürlüğü- Bilgi İşlem Dairesi Başkanlığı"; cusp.PostalAddress = new AddressType(); cusp.PostalAddress .With(cupa => { //cupa.ID = new IDType(); //cupa.ID.Value = grd.DataTable.GetValue("Vergi No", grdRowIndex).ToString(); //cupa.StreetName = new StreetNameType(); //cupa.StreetName.Value = grd.DataTable.GetValue("Adres", grdRowIndex).ToString(); cupa.CityName = new CityNameType(); cupa.CityName.Value = "Ankara"; //cupa.CitySubdivisionName = new CitySubdivisionNameType(); //cupa.CitySubdivisionName.Value = grd.DataTable.GetValue("İlçe", grdRowIndex).ToString(); cupa.Country = new CountryType(); cupa.Country.Name.Value = "Türkiye"; }); cusp.PartyTaxScheme = new PartyTaxSchemeType(); cusp.PartyTaxScheme.TaxScheme = new TaxSchemeType(); cusp.PartyTaxScheme.TaxScheme.Name = new NameType1(); cusp.PartyTaxScheme.TaxScheme.Name.Value = "Ulus"; }); }); #endregion } break; //Yolcu Beraber Fatura case "3": { #region TaxFreeInfo //oInvoice.TaxFreeInfo = new TaxFreeInfo(); //oInvoice.TaxFreeInfo // .With(txfi => // { // txfi.TouristInfo = new TouristInfo(); //Turistin bilgilerinin girileceği alandır. // txfi.TouristInfo // .With(ti => // { // ti.Name = ""; //Bu alan turistin ad bilgisi girilir. // ti.SurName = ""; //Bu alan turistin soyad bilgisi girilir. // ti.PassportNo = ""; //Bu alan turistin pasaport numarası bilgisi girilir. // ti.PassportDate = DateTime.Now; //Bu alan turistin pasaport tarihi bilgisi girilir. // ti.CountryCode = ""; //Bu alan turistin ülke kodu bilgisi girilir.(örn:TR) // ti.FinancialAccountInfo = new FinancialAccountInfo(); //Bu alana turistin banka hesap bilgileri girilir. // ti.FinancialAccountInfo // .With(fa => // { // fa.BankName = ""; //Bu alan Banka Adı bilgisi girilir. // fa.BranchName = ""; //Bu alan Banka Şube Adı bilgisi girilir. // fa.CurrencyCode = ""; //Bu alan Para Birimi bilgisi girilir. // fa.ID = ""; //Bu alan Banka Hesap Numarası bilgisi girilir. // fa.PaymentNote = ""; //Bu alan Ödeme Notu bilgisi girilir. // }); // ti.AddressInfo = new AddressInfo(); //Bu alan turistin adres bilgileri girilir. // ti.AddressInfo // .With(ai => // { // ai.Address = ""; // ai.City = ""; // ai.Country = ""; // ai.District = ""; // ai.Fax = ""; // ai.Mail = ""; // ai.Phone = ""; // ai.PostalCode = ""; // ai.WebSite = ""; // }); // }); // txfi.TaxRepresentativeInfo = new TaxRepresentativeInfo(); //Aracı kurum bilgilerinin girileceği alandır. // txfi.TaxRepresentativeInfo // .With(tri => // { // tri.RegisterNumber = ""; //Bu alana Aracı Kurumun Vergi Kimlik Numarası girilir. // tri.Alias = ""; //Bu alana Aracı Kurumun Etiket bilgisi girilir. // tri.Address = new AddressInfo();//Bu alan turistin adres bilgileri girilir // tri.Address // .With(ai => // { // ai.Address = ""; // ai.City = ""; // ai.Country = ""; // ai.District = ""; // ai.Fax = ""; // ai.Mail = ""; // ai.Phone = ""; // ai.PostalCode = ""; // ai.WebSite = ""; // }); // }); // }); #endregion } break; //EArşiv Fatura case "4": { #region customerinf //oInvoice.CustomerInfo = new PartyInfo(); //oInvoice.CustomerInfo.Address = grd.DataTable.GetValue("Adres", grdRowIndex).ToString(); //oInvoice.CustomerInfo.City = grd.DataTable.GetValue("İl", grdRowIndex).ToString();//"İstanbul"; //oInvoice.CustomerInfo.Country = grd.DataTable.GetValue("Ülke", grdRowIndex).ToString();//"Türkiye"; //oInvoice.CustomerInfo.District = grd.DataTable.GetValue("İlçe", grdRowIndex).ToString();//"Ataşehir"; //oInvoice.CustomerInfo.Fax = grd.DataTable.GetValue("Fax", grdRowIndex).ToString();//"216 688 51 99"; //oInvoice.CustomerInfo.Mail = grd.DataTable.GetValue("Email", grdRowIndex).ToString();//"*****@*****.**"; //oInvoice.CustomerInfo.Name = grd.DataTable.GetValue("Muhatap Adı", grdRowIndex).ToString();//"NES Bilgi Teknolojileri"; //oInvoice.CustomerInfo.Phone = grd.DataTable.GetValue("Telefon", grdRowIndex).ToString();// "216 688 51 00"; //oInvoice.CustomerInfo.RegisterNumber = grd.DataTable.GetValue("Vergi No", grdRowIndex).ToString();// "1234567801"; //oInvoice.CustomerInfo.TaxOffice = grd.DataTable.GetValue("Vergi Dairesi", grdRowIndex).ToString();// "KOZYATAĞI"; //oInvoice.CustomerInfo.WebSite = grd.DataTable.GetValue("Web Sitesi", grdRowIndex).ToString();// "https://nesbilgi.com.tr/"; //oInvoice.CustomerInfo.ReceiverAlias = grd.DataTable.GetValue("Alıcı Posta Etiketi", grdRowIndex).ToString();// "urn:mail:[email protected]";/ #endregion } break; default: break; } #endregion if (Senaryo == "2") { #region BuyerCustomerParty io.BuyerCustomerParty = new CustomerPartyType(); io.BuyerCustomerParty .With(cus => { cus.Party = new PartyType(); cus.Party .With(cusp => { cusp.WebsiteURI = new WebsiteURIType(); cusp.WebsiteURI.Value = "www.hakanucar.com.tr"; cusp.PartyIdentification = new List <PartyIdentificationType>(); PartyIdentificationType pi = new PartyIdentificationType(); pi.ID = new IDType(); pi.ID.schemeID = "VKN"; pi.ID.Value = "1234567801"; cusp.PartyIdentification.Add(pi); cusp.PartyName = new PartyNameType(); cusp.PartyName.Name.Value = "Hakan UÇAR Bilişim"; cusp.PostalAddress = new AddressType(); cusp.PostalAddress .With(cupa => { cupa.ID = new IDType(); cupa.ID.Value = "1234567801"; cupa.StreetName = new StreetNameType(); cupa.StreetName.Value = "Meçhul bir yer"; cupa.CityName = new CityNameType(); cupa.CityName.Value = "İstanbul"; cupa.CitySubdivisionName = new CitySubdivisionNameType(); cupa.CitySubdivisionName.Value = "Beşiktaş"; cupa.Country = new CountryType(); cupa.Country.Name.Value = "Türkiye"; cupa.PostalZone = new PostalZoneType(); cupa.PostalZone.Value = "34000"; }); cusp.Contact = new ContactType(); cusp.Contact .With(cuc => { cuc.Name = new NameType1(); cuc.Name.Value = "Hakan UÇAR"; cuc.Telephone = new TelephoneType(); cuc.Telephone.Value = "555 55 55 55"; cuc.Telefax = new TelefaxType(); cuc.Telefax.Value = "555 55 55 55"; cuc.ElectronicMail = new ElectronicMailType(); cuc.ElectronicMail.Value = "*****@*****.**"; }); }); }); #endregion } #region PaymentTerms //Ödeme Koşulu io.PaymentTerms = new PaymentTermsType(); io.PaymentTerms.Note = new NoteType(); io.PaymentTerms.Note.Value = "60 gün vadeli"; #endregion #region TaxTotal //Vergiler io.TaxTotal = new List <TaxTotalType>(); io.TaxTotal .With(tt => { TaxTotalType ott = new TaxTotalType(); ott.TaxAmount = new TaxAmountType(); ott.TaxAmount.currencyID = "TRY"; ott.TaxAmount.Value = 180; ott.TaxSubtotal = new List <TaxSubtotalType>(); TaxSubtotalType oSubt = new TaxSubtotalType(); oSubt.TaxableAmount = new TaxableAmountType(); oSubt.TaxableAmount.currencyID = "TRY"; oSubt.TaxableAmount.Value = 1000; oSubt.TaxAmount = new TaxAmountType(); oSubt.TaxAmount.currencyID = "TRY"; oSubt.TaxAmount.Value = 180; oSubt.TaxCategory = new TaxCategoryType(); oSubt.TaxCategory.TaxScheme = new TaxSchemeType(); oSubt.TaxCategory.TaxScheme.TaxTypeCode = new TaxTypeCodeType(); oSubt.TaxCategory.TaxScheme.TaxTypeCode.Value = "0015"; ott.TaxSubtotal.Add(oSubt); tt.Add(ott); }); #endregion #region InvoiceLine io.InvoiceLine = new List <InvoiceLineType>(); InvoiceLineType il = new InvoiceLineType(); il .With(iol => { //Sıra No iol.ID = new IDType(); iol.ID.Value = "1"; //Kalem Tanımı iol.Item = new ItemType(); iol.Item.Name = new NameType1(); iol.Item.Name.Value = "HP X534 Yazıcı"; iol.Item.SellersItemIdentification = new ItemIdentificationType(); iol.Item.SellersItemIdentification.ID.Value = "KLM0012"; //Kalem Miktarı iol.InvoicedQuantity = new InvoicedQuantityType(); iol.InvoicedQuantity.unitCode = "C62"; iol.InvoicedQuantity.Value = 1; //Kalem Birim Fiyatı iol.Price = new PriceType(); iol.Price.PriceAmount = new PriceAmountType(); iol.Price.PriceAmount.currencyID = "TRY"; iol.Price.PriceAmount.Value = 1000; iol.Note = new List <NoteType>(); NoteType oKlmNote = new NoteType(); oNewNote.Value = "Test kalem notu"; iol.Note.Add(oKlmNote); //iskonto //iol.AllowanceCharge = new List<AllowanceChargeType>(); //iol.AllowanceCharge // .With(all => // { // AllowanceChargeType allc = new AllowanceChargeType(); // allc.ChargeIndicator = new ChargeIndicatorType(); // allc.ChargeIndicator.Value = false; // allc.MultiplierFactorNumeric = new MultiplierFactorNumericType(); // allc.MultiplierFactorNumeric.Value = 0.0M; // allc.Amount = new AmountType2(); // allc.Amount.currencyID = "TRY"; // allc.Amount.Value = 0M; // allc.BaseAmount = new BaseAmountType(); // allc.BaseAmount.currencyID = "TRY"; // allc.BaseAmount.Value = ((decimal)Services.ObjectToDouble(fech.Item("Quantity").Value)) * // ((decimal)Services.ObjectToDouble(fech.Item("Price").Value)); // all.Add(allc); // }); if (Senaryo == "2") { iol.Delivery = new List <DeliveryType>(); DeliveryType oDelivery = new DeliveryType(); oDelivery .With(d => { DeliveryTermsType dtt = new DeliveryTermsType(); dtt.ID.schemeID = "INCOTERMS"; dtt.ID.Value = "Teslim şartı"; d.DeliveryTerms.Add(dtt); d.DeliveryAddress .With(ai => { ai.StreetName = new StreetNameType(); ai.StreetName.Value = "Meçhul bir adres"; ai.CitySubdivisionName = new CitySubdivisionNameType(); ai.CitySubdivisionName.Value = "Beşiktaş"; ai.CityName = new CityNameType(); ai.CityName.Value = "İstanbul"; ai.Country = new CountryType(); ai.Country.Name.Value = "Türkiye"; }); d.Shipment .With(shp => { shp.ID.Value = "Gümrük tarkip numarası"; GoodsItemType oGItem = new GoodsItemType(); oGItem.RequiredCustomsID.Value = "GTIP"; shp.GoodsItem.Add(oGItem); ShipmentStageType oState = new ShipmentStageType(); oState.TransportModeCode.Value = "Gönderim şekli"; shp.ShipmentStage.Add(oState); TransportHandlingUnitType othlu = new TransportHandlingUnitType(); PackageType op = new PackageType(); op.ID.Value = "Kab numarası"; op.Quantity.Value = 1; //paket adedi op.PackagingTypeCode.Value = "Kabın cinsi"; othlu.ActualPackage.Add(op); shp.TransportHandlingUnit.Add(othlu); //di.PackageBrandName = fech.Item("U_PackageBrandName").Value.ToString() == "" ? grd.DataTable.GetValue("Kabın Markası", grdRowIndex).ToString() : fech.Item("U_PackageBrandName").Value.ToString(); //Bu alana Mal/Hizmetin bulunduğu Kabın Marka isim bilgisi girilir. }); }); iol.Delivery.Add(oDelivery); } //Vergi Toplam iol.TaxTotal = new TaxTotalType(); iol.TaxTotal .With(tx => { tx.TaxAmount = new TaxAmountType(); tx.TaxAmount.currencyID = "TRY"; tx.TaxAmount.Value = 180; //Vergiler tx.TaxSubtotal = new List <TaxSubtotalType>(); tx.TaxSubtotal .With(txs => { TaxSubtotalType sbt = new TaxSubtotalType(); sbt.TaxableAmount = new TaxableAmountType(); sbt.TaxableAmount.currencyID = "TRY"; sbt.TaxableAmount.Value = 1000; sbt.TaxAmount = new TaxAmountType(); sbt.TaxAmount.currencyID = "TRY"; sbt.TaxAmount.Value = 180; sbt.Percent = new PercentType1(); sbt.Percent.Value = 18; sbt.TaxCategory = new TaxCategoryType(); sbt.TaxCategory.TaxScheme = new TaxSchemeType(); sbt.TaxCategory.TaxScheme.Name = new NameType1(); sbt.TaxCategory.TaxScheme.Name.Value = "KDV"; sbt.TaxCategory.TaxScheme.TaxTypeCode = new TaxTypeCodeType(); sbt.TaxCategory.TaxScheme.TaxTypeCode.Value = "0015"; txs.Add(sbt); }); }); //Kalem Mal Hizmet Tutarı iol.LineExtensionAmount = new LineExtensionAmountType(); iol.LineExtensionAmount.currencyID = "TRY"; iol.LineExtensionAmount.Value = 1000; }); io.InvoiceLine.Add(il); #endregion #region LegalMonetaryTotal io.LegalMonetaryTotal = new MonetaryTotalType(); //Mal Hizmet Toplam Tutar io.LegalMonetaryTotal.LineExtensionAmount = new LineExtensionAmountType(); io.LegalMonetaryTotal.LineExtensionAmount.currencyID = "TRY"; io.LegalMonetaryTotal.LineExtensionAmount.Value = 1000; //Vergiler Hariç Tutar io.LegalMonetaryTotal.TaxExclusiveAmount = new TaxExclusiveAmountType(); io.LegalMonetaryTotal.TaxExclusiveAmount.currencyID = "TRY"; io.LegalMonetaryTotal.TaxExclusiveAmount.Value = 1000; //Vergiler Dahil Tutar io.LegalMonetaryTotal.TaxInclusiveAmount = new TaxInclusiveAmountType(); io.LegalMonetaryTotal.TaxInclusiveAmount.currencyID = "TRY"; io.LegalMonetaryTotal.TaxInclusiveAmount.Value = 1180; //iskonto io.LegalMonetaryTotal.AllowanceTotalAmount = new AllowanceTotalAmountType(); io.LegalMonetaryTotal.AllowanceTotalAmount.currencyID = "TRY"; io.LegalMonetaryTotal.AllowanceTotalAmount.Value = 0M; //Ödenecek Tutar io.LegalMonetaryTotal.PayableAmount = new PayableAmountType(); io.LegalMonetaryTotal.PayableAmount.currencyID = "TRY"; io.LegalMonetaryTotal.PayableAmount.Value = 1180; #endregion }); return(UblTrSerialize.UblSerialize(res)); }
//Informacion de las lineas del documento #region InvoiceLine /// <summary> /// Generacion de InvoiceLine /// </summary> /// <returns></returns> private InvoiceLineType[] InvoiceLine(List <ITEM> ITEM_collection) { Moneda = "PEN"; //string PESUNAT = "PE:SUNAT"; List <InvoiceLineType> Items_Respuesta = new List <InvoiceLineType>();; try { foreach (var item in ITEM_collection) { #region InvoiceLine string[] DE = item.DE.Split('|'); string[] DEDR = item.DEDR.Split('|'); List <string> DEIM_LIST = item.DEIM;//.Split('|'); string[] DEDI = item.DEDI.Split('|'); InvoiceLineType Linea = new InvoiceLineType(); { //numero de orden del item Linea.ID = new IDType() { Value = DE[1].ToString() }; //(InvoicedQuantity)cantidad de unidades del item Linea.InvoicedQuantity = new InvoicedQuantityType() { Value = Convert.ToDecimal(DE[4].ToString()), unitCode = DE[3].ToString(), unitCodeListID = "UN/ECE rec 20", unitCodeListAgencyName = "United Nations Economic Commission for Europe" }; //(LineExtensionAmount)Valor de Venta del item Linea.LineExtensionAmount = new LineExtensionAmountType() { Value = Convert.ToDecimal(DE[5].ToString()), currencyID = Moneda }; #region PricingReference Linea.PricingReference = new PricingReferenceType() { //AlternativeConditionPrice AlternativeConditionPrice = new PriceType[] { new PriceType() { //(PriceAmount) precoi de venta unitario/ valor referencial PriceAmount = new PriceAmountType() { Value = Convert.ToDecimal(DE[2].ToString()), currencyID = Moneda }, //(PriceTypeCode) codigo de tipo de precio PriceTypeCode = new PriceTypeCodeType() { Value = DE[7].ToString(), listName = "SUNAT:Indicador de Tipo de Precio", listAgencyName = ConstantesAtributo.PESUNAT, listURI = ConstantesAtributo.CATALOGO16 } } } }; #endregion #region Delivery #endregion //Descuentos o Recargos de la linea #region AllowanceCharge Linea.AllowanceCharge = new AllowanceChargeType[] { new AllowanceChargeType() { ChargeIndicator = new ChargeIndicatorType() { Value = DEDR[1].ToString() == "true"?true :false }, AllowanceChargeReasonCode = new AllowanceChargeReasonCodeType() { Value = DEDR[3].ToString() }, MultiplierFactorNumeric = new MultiplierFactorNumericType() { Value = Convert.ToDecimal(DEDR[4].ToString()) }, Amount = new AmountType2() { Value = Convert.ToDecimal(DEDR[2].ToString()), currencyID = Moneda }, BaseAmount = new BaseAmountType() { Value = Convert.ToDecimal(DEDR[5].ToString()), currencyID = Moneda } } }; #endregion //Monto de tributo del item #region TaxTotal List <TaxTotalType> taxTotals = new List <TaxTotalType>(); foreach (var DEIM_Item in DEIM_LIST) { string[] DEIM = DEIM_Item.Split('|'); TaxTotalType taxTotalType = new TaxTotalType() { //Monto de tributo del ítem TaxAmount = new TaxAmountType() { Value = Convert.ToDecimal(DEIM[1].ToString()), currencyID = Moneda }, TaxSubtotal = new TaxSubtotalType[] { new TaxSubtotalType() { //Monto de la Operacion TaxableAmount = new TaxableAmountType() { Value = Convert.ToDecimal(DEIM[2].ToString()), currencyID = Moneda }, //Monto de Tributo por Item TaxAmount = new TaxAmountType() { Value = Convert.ToDecimal(DEIM[3].ToString()), currencyID = Moneda }, TaxCategory = new TaxCategoryType() { ID = new IDType() { Value = "S", schemeID = ConstantesAtributo.UNECE5305, schemeAgencyID = "6" }, Percent = new PercentType1 { Value = Convert.ToDecimal(DEIM[4].ToString()) }, TaxExemptionReasonCode = new TaxExemptionReasonCodeType() { Value = DEIM[6].ToString(), listAgencyName = ConstantesAtributo.PESUNAT, listName = "SUNAT:Codigo de Tipo de Afectación del IGV", listURI = ConstantesAtributo.CATALOGO07 }, TaxScheme = new TaxSchemeType() { ID = new IDType() { Value = DEIM[8].ToString(), }, Name = new NameType1() { Value = DEIM[9].ToString(), }, TaxTypeCode = new TaxTypeCodeType() { Value = DEIM[5].ToString() } } } } } }; taxTotals.Add(taxTotalType); } Linea.TaxTotal = taxTotals.ToArray(); #endregion #region Item Linea.Item = new ItemType() { Description = new DescriptionType[] { new DescriptionType() { Value = DEDI[1].ToString() } }, SellersItemIdentification = new ItemIdentificationType() { ID = new IDType() { Value = DE[6].ToString() } }, CommodityClassification = new CommodityClassificationType[] { new CommodityClassificationType() { ItemClassificationCode = new ItemClassificationCodeType() { Value = DEDI[6].ToString() } } } }; #endregion #region Price Linea.Price = new PriceType() { PriceAmount = new PriceAmountType() { Value = Convert.ToDecimal(DE[8].ToString()), } }; #endregion } #endregion Items_Respuesta.Add(Linea); } return(Items_Respuesta.ToArray()); } catch (Exception) { throw; } }
// #region TaxTotal private TaxTotalType[] TaxTotalType(TramaDocumento Doc) { try { //Impuestos List <TaxTotalType> taxTotal = new List <TaxTotalType>(); foreach (var Impuestos in Doc.DI) { string[] DI = Impuestos.Split('|'); TaxTotalType taxTotalType = new TaxTotalType() { TaxAmount = new TaxAmountType { currencyID = "PEN", Value = Convert.ToDecimal(DI[1].ToString()) }, TaxSubtotal = new TaxSubtotalType[] { new TaxSubtotalType { TaxAmount = new TaxAmountType { currencyID = "PEN", Value = Convert.ToDecimal(DI[2].ToString()) }, TaxableAmount = new TaxableAmountType { Value = Convert.ToDecimal(DI[6].ToString()) }, TaxCategory = new TaxCategoryType { ID = new IDType { Value = "S" }, TierRange = new TierRangeType { Value = "S" }, TaxExemptionReasonCode = new TaxExemptionReasonCodeType { Value = "" }, TaxScheme = new TaxSchemeType { ID = new IDType { Value = DI[3].ToString() }, Name = new NameType1 { Value = DI[4].ToString() }, TaxTypeCode = new TaxTypeCodeType { Value = DI[5].ToString() } } }, Percent = new PercentType1 { Value = 18 } } }, }; taxTotal.Add(taxTotalType); } return(taxTotal.ToArray()); } catch (Exception) { throw; } }
public SummaryDocumentsLineType[] getSummaryDocumentsLine() { SummaryDocumentsLineType HILT = new SummaryDocumentsLineType(); SummaryDocumentsLineType[] MILT = new SummaryDocumentsLineType[RBD.Count]; for (int i = 0; i < RBD.Count; ++i) { MILT[i] = new SummaryDocumentsLineType(); LineIDType LIT = new LineIDType(); LIT.Value = (i + 1).ToString(); MILT[i].LineID = LIT; DocumentTypeCodeType DTCT = new DocumentTypeCodeType(); DTCT.Value = RBD[i].TPO_CPE; MILT[i].DocumentTypeCode = DTCT; IdentifierType IT = new IdentifierType(); IT.Value = RBD[i].DOC_SER; MILT[i].DocumentSerialID = IT; IT = null; IT = new IdentifierType(); IT.Value = RBD[i].NUM_INI.ToString(); MILT[i].StartDocumentNumberID = IT; IT = null; IT = new IdentifierType(); IT.Value = RBD[i].NUM_FIN.ToString(); MILT[i].EndDocumentNumberID = IT; AmountType1 AT1 = new AmountType1(); AT1.Value = RBD[i].MTO_TOT; AT1.currencyID = CurrencyCodeContentType.PEN; MILT[i].TotalAmount = AT1; // START - IMPORTES PaymentType[] PT = { null, null, null }; PaidAmountType PAT; InstructionIDType IIT; // IMPORTES - GRAVADOS var ImpGravados = Convert.ToDecimal(RBD[i].MTO_GRA, CultureInfo.CreateSpecificCulture("es-PE")); if (ImpGravados > 0) { PAT = new PaidAmountType(); IIT = new InstructionIDType(); PT[0] = new PaymentType(); PAT.Value = Convert.ToDecimal(RBD[i].MTO_GRA, CultureInfo.CreateSpecificCulture("es-PE")); PAT.currencyID = CurrencyCodeContentType.PEN; IIT.Value = "01"; PT[0].PaidAmount = PAT; PT[0].InstructionID = IIT; PAT = null; IIT = null; } // IMPORTES - EXONERADOS var ImpExonerado = Convert.ToDecimal(RBD[i].MTO_EXO, CultureInfo.CreateSpecificCulture("es-PE")); if (ImpExonerado > 0) { PAT = new PaidAmountType(); IIT = new InstructionIDType(); PT[1] = new PaymentType(); PAT.Value = Convert.ToDecimal(RBD[i].MTO_EXO, CultureInfo.CreateSpecificCulture("es-PE")); PAT.currencyID = CurrencyCodeContentType.PEN; IIT.Value = "02"; PT[1].PaidAmount = PAT; PT[1].InstructionID = IIT; PAT = null; IIT = null; } // IMPORTES - INAFECTO var ImpInafecto = Convert.ToDecimal(RBD[i].MTO_INA, CultureInfo.CreateSpecificCulture("es-PE")); if (ImpInafecto > 0) { PAT = new PaidAmountType(); IIT = new InstructionIDType(); PT[2] = new PaymentType(); PAT.Value = Convert.ToDecimal(RBD[i].MTO_INA, CultureInfo.CreateSpecificCulture("es-PE")); PAT.currencyID = CurrencyCodeContentType.PEN; IIT.Value = "03"; PT[2].PaidAmount = PAT; PT[2].InstructionID = IIT; PAT = null; IIT = null; MILT[i].BillingPayment = PT; } // IMPORTES - OTROS CARGOS var ImpOtroCargos = Convert.ToDecimal(RBD[i].MTO_OCA, CultureInfo.CreateSpecificCulture("es-PE")); if (ImpOtroCargos > 0) { AllowanceChargeType[] ACT = { null }; ACT[0] = new AllowanceChargeType(); ChargeIndicatorType CIT = new ChargeIndicatorType(); CIT.Value = true; ACT[0].ChargeIndicator = CIT; AT1 = null; AT1 = new AmountType1(); AT1.Value = Convert.ToDecimal(RBD[i].MTO_OCA, CultureInfo.CreateSpecificCulture("es-PE")); AT1.currencyID = CurrencyCodeContentType.PEN; ACT[0].Amount = AT1; MILT[i].AllowanceCharge = ACT; } // END - IMPORTES // START - TAXTOTAL TaxTotalType[] TTP = { null, null, null }; TaxAmountType TAT = null; TaxSubtotalType[] TST = { null }; TaxSubtotalType[] TST2 = { null }; TaxSubtotalType[] TST3 = { null }; TaxCategoryType TCT = null; TaxSchemeType THT = null; IDType IDT = null; NameType1 TNT1 = null; TaxTypeCodeType TTCT = null; // TOTAL IGV IDT = new IDType(); IDT.Value = "1000"; TNT1 = new NameType1(); TNT1.Value = "IGV"; TTCT = new TaxTypeCodeType(); TTCT.Value = "VAT"; THT = new TaxSchemeType(); THT.ID = IDT; THT.Name = TNT1; THT.TaxTypeCode = TTCT; TCT = new TaxCategoryType(); TCT.TaxScheme = THT; TAT = new TaxAmountType(); TAT.currencyID = CurrencyCodeContentType.PEN; TAT.Value = Convert.ToDecimal(RBD[i].IMP_IGV, CultureInfo.CreateSpecificCulture("es-PE")); TST[0] = new TaxSubtotalType(); TST[0].TaxAmount = TAT; TST[0].TaxCategory = TCT; TTP[0] = new TaxTotalType(); TTP[0].TaxAmount = TAT; TTP[0].TaxSubtotal = TST; TAT = null; TST = null; TCT = null; THT = null; IDT = null; TNT1 = null; TTCT = null; // TOTAL ISC IDT = new IDType(); IDT.Value = "2000"; TNT1 = new NameType1(); TNT1.Value = "ISC"; TTCT = new TaxTypeCodeType(); TTCT.Value = "EXC"; THT = new TaxSchemeType(); THT.ID = IDT; THT.Name = TNT1; THT.TaxTypeCode = TTCT; TCT = new TaxCategoryType(); TCT.TaxScheme = THT; TAT = new TaxAmountType(); TAT.currencyID = CurrencyCodeContentType.PEN; TAT.Value = Convert.ToDecimal(RBD[i].IMP_ISC, CultureInfo.CreateSpecificCulture("es-PE")); TST2[0] = new TaxSubtotalType(); TST2[0].TaxAmount = TAT; TST2[0].TaxCategory = TCT; TTP[1] = new TaxTotalType(); TTP[1].TaxAmount = TAT; TTP[1].TaxSubtotal = TST2; TAT = null; TST = null; TCT = null; THT = null; IDT = null; TNT1 = null; TTCT = null; // TOTAL OTH IDT = new IDType(); IDT.Value = "9999"; TNT1 = new NameType1(); TNT1.Value = "OTROS"; TTCT = new TaxTypeCodeType(); TTCT.Value = "OTH"; THT = new TaxSchemeType(); THT.ID = IDT; THT.Name = TNT1; THT.TaxTypeCode = TTCT; TCT = new TaxCategoryType(); TCT.TaxScheme = THT; TAT = new TaxAmountType(); TAT.currencyID = CurrencyCodeContentType.PEN; TAT.Value = Convert.ToDecimal(RBD[i].IMP_OTH, CultureInfo.CreateSpecificCulture("es-PE")); TST3[0] = new TaxSubtotalType(); TST3[0].TaxAmount = TAT; TST3[0].TaxCategory = TCT; TTP[2] = new TaxTotalType(); TTP[2].TaxAmount = TAT; TTP[2].TaxSubtotal = TST3; TAT = null; TST = null; TCT = null; THT = null; IDT = null; TNT1 = null; TTCT = null; MILT[i].TaxTotal = TTP; // END - TAXTOTAL } return(MILT); }
private SummaryDocumentsLineType GetLineRC(RBoletasDetalle det, int i, string typerc) { detOk = false; HILT_s = new SummaryDocumentsLineType(); try { #region alter js LineIDType LIT = new LineIDType(); LIT.Value = (i + 1).ToString(); HILT_s.LineID = LIT; //tipo de documento (03, 07, 08) DocumentTypeCodeType DTCT = new DocumentTypeCodeType(); DTCT.Value = RBD[i].TPO_CPE; HILT_s.DocumentTypeCode = DTCT; #region condition code StatusType StatusTP = new StatusType(); ConditionCodeType Condition = new ConditionCodeType(); RBD[i].ConditionCode = 0; if (RBD[i].ConditionCode == 0) { if (typerc != "ANS") { Condition.Value = "1"; } else { Condition.Value = "3"; #region other //switch (RBD[i].SYSTEM_STATUS) //{ // case "XGN": // { // //Condition.Value = "1"; // break; // } // case "ANS": // { // Condition.Value = "3"; // //var res = ADE.Extras.Common.Method.Methods.Instance.DateCompare(DateTime.Now.ToString("yyyy-MM-dd"), RBD[i].FEC_EMIS.ToString("yyyy-MM-dd")); // //if (res == 1) // //{ Condition.Value = "3"; } // //else // ////{ Condition.Value = "4"; } // //{ Condition.Value = "3"; } // break; // } //} #endregion } ListDocs.Add(new Extras.Common.Method.UtilClass() { NUM_CE = RBD[i].NUM_CPE, STATUS_RC_DOC = int.Parse(Condition.Value) }); } StatusTP.ConditionCode = Condition; HILT_s.Status = new StatusType(); HILT_s.Status = StatusTP; #endregion //ID (xxxx-xxxxxxxx) IDType IdDocumentType = new IDType(); IdDocumentType.Value = RBD[i].ID; HILT_s.ID = new IDType(); HILT_s.ID = IdDocumentType; //added js AmountType1 TotAmount = new AmountType1(); TotAmount.Value = RBD[i].MTO_TOT; TotAmount.currencyID = CurrencyCodeContentType.PEN; TotAmount.currencyID = RBD[i].MONEDA.ToUpper() == "USD" ? CurrencyCodeContentType.USD : CurrencyCodeContentType.PEN; HILT_s.TotalAmount = TotAmount;//total documento CustomerPartyType CPT = new CustomerPartyType(); CPT.CustomerAssignedAccountID = new CustomerAssignedAccountIDType(); CPT.CustomerAssignedAccountID.Value = RBD[i].CustomerAssignedAccountID; AdditionalAccountIDType AAID = new AdditionalAccountIDType(); AdditionalAccountIDType[] AAIDs = new AdditionalAccountIDType[1]; AAID.Value = RBD[i].AdditionalAccountID; AAIDs[0] = AAID; CPT.AdditionalAccountID = AAIDs; HILT_s.AccountingCustomerParty = CPT; PaymentType[] billingPayment = new PaymentType[4]; PaymentType bp_item = new PaymentType(); InstructionIDType idInsType = new InstructionIDType(); PaidAmountType paidAmountType = new PaidAmountType(); #region START - IMPORTES // IMPORTES - GRAVADO var ImpGravado = Convert.ToDecimal(RBD[i].MTO_GRA, CultureInfo.CreateSpecificCulture("es-PE")); if (ImpGravado > 0) { bp_item = new PaymentType(); idInsType = new InstructionIDType(); paidAmountType = new PaidAmountType(); idInsType.Value = "01"; paidAmountType.Value = Convert.ToDecimal(RBD[i].MTO_GRA, CultureInfo.CreateSpecificCulture("es-PE")); //paidAmountType.currencyID = CurrencyCodeContentType.PEN; paidAmountType.currencyID = RBD[i].MONEDA.ToUpper() == "USD" ? CurrencyCodeContentType.USD : CurrencyCodeContentType.PEN; bp_item.PaidAmount = paidAmountType; bp_item.InstructionID = idInsType; billingPayment[0] = bp_item; } // IMPORTES - EXONERADOS var ImpExonerado = Convert.ToDecimal(RBD[i].MTO_EXO, CultureInfo.CreateSpecificCulture("es-PE")); if (ImpExonerado > 0) { bp_item = new PaymentType(); idInsType = new InstructionIDType(); paidAmountType = new PaidAmountType(); idInsType.Value = "02"; paidAmountType.Value = Convert.ToDecimal(RBD[i].MTO_EXO, CultureInfo.CreateSpecificCulture("es-PE")); //paidAmountType.currencyID = CurrencyCodeContentType.PEN; paidAmountType.currencyID = RBD[i].MONEDA.ToUpper() == "USD" ? CurrencyCodeContentType.USD : CurrencyCodeContentType.PEN; bp_item.PaidAmount = paidAmountType; bp_item.InstructionID = idInsType; billingPayment[1] = bp_item; } // IMPORTES - INAFECTO var ImpInafecto = Convert.ToDecimal(RBD[i].MTO_INA, CultureInfo.CreateSpecificCulture("es-PE")); if (ImpInafecto > 0) { bp_item = new PaymentType(); idInsType = new InstructionIDType(); paidAmountType = new PaidAmountType(); idInsType.Value = "03"; paidAmountType.Value = Convert.ToDecimal(RBD[i].MTO_INA, CultureInfo.CreateSpecificCulture("es-PE")); //paidAmountType.currencyID = CurrencyCodeContentType.PEN; paidAmountType.currencyID = RBD[i].MONEDA.ToUpper() == "USD" ? CurrencyCodeContentType.USD : CurrencyCodeContentType.PEN; bp_item.PaidAmount = paidAmountType; bp_item.InstructionID = idInsType; billingPayment[2] = bp_item; } // IMPORTES - GRATUITAS var ImpGratuitas = Convert.ToDecimal(RBD[i].MON_GRAT, CultureInfo.CreateSpecificCulture("es-PE")); if (ImpGratuitas > 0) { bp_item = new PaymentType(); idInsType = new InstructionIDType(); paidAmountType = new PaidAmountType(); idInsType.Value = "05"; paidAmountType.Value = Convert.ToDecimal(RBD[i].MON_GRAT, CultureInfo.CreateSpecificCulture("es-PE")); //paidAmountType.currencyID = CurrencyCodeContentType.PEN; paidAmountType.currencyID = RBD[i].MONEDA.ToUpper() == "USD" ? CurrencyCodeContentType.USD : CurrencyCodeContentType.PEN; bp_item.PaidAmount = paidAmountType; bp_item.InstructionID = idInsType; billingPayment[3] = bp_item; } HILT_s.BillingPayment = billingPayment; // IMPORTES - OTROS CARGOS var ImpOtroCargos = Convert.ToDecimal(RBD[i].MTO_OCA, CultureInfo.CreateSpecificCulture("es-PE")); if (ImpOtroCargos > 0) { AllowanceChargeType[] allowCharge = new AllowanceChargeType[1]; AmountType1 AT1 = new AmountType1(); ChargeIndicatorType CIT = new ChargeIndicatorType(); CIT.Value = true; allowCharge[0] = new AllowanceChargeType(); allowCharge[0].ChargeIndicator = new ChargeIndicatorType(); allowCharge[0].ChargeIndicator = CIT; AT1 = null; AT1 = new AmountType1(); AT1.Value = Convert.ToDecimal(RBD[i].MTO_OCA, CultureInfo.CreateSpecificCulture("es-PE")); //AT1.currencyID = CurrencyCodeContentType.PEN; AT1.currencyID = RBD[i].MONEDA.ToUpper() == "USD" ? CurrencyCodeContentType.USD : CurrencyCodeContentType.PEN; allowCharge[0].Amount = AT1; HILT_s.AllowanceCharge = new AllowanceChargeType[1]; HILT_s.AllowanceCharge[0] = new AllowanceChargeType(); HILT_s.AllowanceCharge[0] = allowCharge[0]; } #endregion END IMPORTES #region START IMPUESTOS TaxTotalType[] TOTs;// = new TaxTotalType[3]; TOTs = new TaxTotalType[3]; TaxTotalType TOT = new TaxTotalType(); TaxAmountType TAT = new TaxAmountType(); TaxSubtotalType TST = new TaxSubtotalType(); TaxCategoryType TCT = new TaxCategoryType(); TaxSchemeType TSchT = new TaxSchemeType(); TaxSubtotalType[] TsTi;// = new TaxSubtotalType[3]; IDType IDsch = new IDType(); NameType1 nameType = new NameType1(); TaxTypeCodeType tTCt = new TaxTypeCodeType(); //IMP IGV //var imp_igv = Convert.ToDecimal(RBD[i].IMP_IGV, CultureInfo.CreateSpecificCulture("es-PE")); //if (imp_igv > 0) //{ TOT = new TaxTotalType(); TAT = new TaxAmountType(); TST = new TaxSubtotalType(); TCT = new TaxCategoryType(); TSchT = new TaxSchemeType(); TsTi = new TaxSubtotalType[1]; //IDType IDsch = new IDType(); //NameType1 nameType = new NameType1(); //TaxTypeCodeType tTCt = new TaxTypeCodeType(); IDsch = new IDType(); nameType = new NameType1(); tTCt = new TaxTypeCodeType(); TAT.Value = Convert.ToDecimal(RBD[i].IMP_IGV, CultureInfo.CreateSpecificCulture("es-PE")); //TAT.currencyID = CurrencyCodeContentType.PEN; TAT.currencyID = RBD[i].MONEDA.ToUpper() == "USD" ? CurrencyCodeContentType.USD : CurrencyCodeContentType.PEN; IDsch.Value = "1000"; nameType.Value = "IGV"; tTCt.Value = "VAT"; TSchT.ID = IDsch; TSchT.Name = nameType; TSchT.TaxTypeCode = tTCt; TCT.TaxScheme = TSchT; TST.TaxAmount = TAT; TST.TaxCategory = TCT; TOT.TaxAmount = TAT; TsTi[0] = TST; TOT.TaxSubtotal = TsTi; TOTs[0] = TOT; //} //IMP ISC //var imp_isc = Convert.ToDecimal(RBD[i].IMP_ISC, CultureInfo.CreateSpecificCulture("es-PE")); //if (imp_isc > 0) //{ TOT = new TaxTotalType(); TAT = new TaxAmountType(); TST = new TaxSubtotalType(); TCT = new TaxCategoryType(); TSchT = new TaxSchemeType(); TsTi = new TaxSubtotalType[1]; //IDType IDsch = new IDType(); //NameType1 nameType = new NameType1(); //TaxTypeCodeType tTCt = new TaxTypeCodeType(); IDsch = new IDType(); nameType = new NameType1(); tTCt = new TaxTypeCodeType(); TAT.Value = Convert.ToDecimal(RBD[i].IMP_ISC, CultureInfo.CreateSpecificCulture("es-PE")); //TAT.currencyID = CurrencyCodeContentType.PEN; TAT.currencyID = RBD[i].MONEDA.ToUpper() == "USD" ? CurrencyCodeContentType.USD : CurrencyCodeContentType.PEN; IDsch.Value = "2000"; nameType.Value = "ISC"; tTCt.Value = "EXC"; TSchT.ID = IDsch; TSchT.Name = nameType; TSchT.TaxTypeCode = tTCt; TCT.TaxScheme = TSchT; TST.TaxAmount = TAT; TST.TaxCategory = TCT; TOT.TaxAmount = TAT; TsTi[0] = TST; TOT.TaxSubtotal = TsTi; TOTs[1] = TOT; //} //IMP OTH var imp_oth = Convert.ToDecimal(RBD[i].IMP_OTH, CultureInfo.CreateSpecificCulture("es-PE")); if (imp_oth > 0) { TOT = new TaxTotalType(); TAT = new TaxAmountType(); TST = new TaxSubtotalType(); TCT = new TaxCategoryType(); TSchT = new TaxSchemeType(); TsTi = new TaxSubtotalType[1]; //IDType IDsch = new IDType(); //NameType1 nameType = new NameType1(); //TaxTypeCodeType tTCt = new TaxTypeCodeType(); IDsch = new IDType(); nameType = new NameType1(); tTCt = new TaxTypeCodeType(); TAT.Value = Convert.ToDecimal(RBD[i].IMP_OTH, CultureInfo.CreateSpecificCulture("es-PE")); //TAT.currencyID = CurrencyCodeContentType.PEN; TAT.currencyID = RBD[i].MONEDA.ToUpper() == "USD" ? CurrencyCodeContentType.USD : CurrencyCodeContentType.PEN; IDsch.Value = "9999"; nameType.Value = "OTROS"; tTCt.Value = "OTH"; TSchT.ID = IDsch; TSchT.Name = nameType; TSchT.TaxTypeCode = tTCt; TCT.TaxScheme = TSchT; TST.TaxAmount = TAT; TST.TaxCategory = TCT; TOT.TaxAmount = TAT; TsTi[0] = TST; TOT.TaxSubtotal = TsTi; TOTs[2] = TOT; } HILT_s.TaxTotal = TOTs; #endregion END IMPUESTOS #region IF NOTE CREDI OR NOTE DEBIT if (RBD[i].TPO_CPE.Contains("07") || RBD[i].TPO_CPE.Contains("08")) { string[] array_tpodoc_afec = RBD[i].TPO_DOC_AFEC.Split(','); string[] array_nrodoc_afec = RBD[i].NRO_DOC_AFEC.Split(','); if (array_tpodoc_afec.Length == array_nrodoc_afec.Length) { BillingReferenceType[] BRs = new BillingReferenceType[array_nrodoc_afec.Length]; BillingReferenceType BR = new BillingReferenceType(); DocumentReferenceType docRef = new DocumentReferenceType(); for (int af = 0; af < array_tpodoc_afec.Length; af++) { BR = new BillingReferenceType(); docRef = new DocumentReferenceType(); IDType idref = new IDType(); idref.Value = array_nrodoc_afec[af]; DocumentTypeCodeType doctyperef = new DocumentTypeCodeType(); doctyperef.Value = array_tpodoc_afec[af]; docRef.ID = idref; docRef.DocumentTypeCode = doctyperef; BR.InvoiceDocumentReference = docRef; BRs[af] = BR; } HILT_s.BillingReference = BRs; } } #endregion //MILT[i] = HILT; #endregion detOk = true; } catch (Exception ex) { detOk = false; } return(HILT_s); }
//public void addTaxSubtotal(TaxTotalType taxTotal,string currencyCode, decimal taxableAmount, decimal taxAmount, decimal taxRate) //{ // List<TaxSubtotalType> taxSubTotalList = new List<TaxSubtotalType>(); // TaxSubtotalType taxSubtotal= new TaxSubtotalType // { // TaxableAmount = new TaxableAmountType // { // currencyID = currencyCode, // Value = taxableAmount // }, // TaxAmount = new TaxAmountType // { // currencyID = currencyCode, // Value = taxAmount // }, // CalculationSequenceNumeric = new CalculationSequenceNumericType // { // Value = 1 // }, // Percent = new PercentType1 { Value = taxRate }, // TaxCategory = new TaxCategoryType // { // TaxScheme = new TaxSchemeType // { // Name = new NameType1 { Value = nameof(EI.TaxType.KDV) }, // TaxTypeCode = new TaxTypeCodeType { Value = "0015" } // } // } // }; // taxSubTotalList.Add(taxSubtotal); // taxTotal.TaxSubtotal = taxSubTotalList.ToArray(); //} //public TaxTotalType createTaxTotal(string currencyCode, decimal totalTaxAmount) //{ // return new TaxTotalType // { // TaxAmount = new TaxAmountType // { // currencyID = currencyCode, // Value = totalTaxAmount // }, // TaxSubtotal = new TaxSubtotalType[] { } // }; //} //public virtual TaxTotalType[] invoiceTaxTotal() //{ // List<TaxTotalType> taxTotalList = new List<TaxTotalType>(); // List<TaxSubtotalType> taxSubTotalList = new List<TaxSubtotalType>(); // TaxTotalType taxTotal = new TaxTotalType { TaxAmount = new TaxAmountType { Value = 0 } }; // var taxSubtotal = new TaxSubtotalType // { // TaxableAmount = new TaxableAmountType { Value = 0 }, // TaxAmount = new TaxAmountType { Value = 0 }, // Percent = new PercentType1 { Value = 0 }, // TaxCategory = new TaxCategoryType // { // TaxScheme = new TaxSchemeType // { // Name = new NameType1 { Value = nameof(EI.TaxType.KDV) }, // TaxTypeCode = new TaxTypeCodeType // { // Value = "0015" // } // } // } // }; // foreach (var line in BaseUBL.InvoiceLine) // { // taxTotal.TaxAmount.Value += line.TaxTotal.TaxAmount.Value; // taxTotal.TaxAmount.currencyID = line.TaxTotal.TaxAmount.currencyID; // foreach (var tax in line.TaxTotal.TaxSubtotal) // { // taxSubtotal.TaxableAmount.Value += tax.TaxableAmount.Value; // taxSubtotal.TaxableAmount.currencyID = tax.TaxableAmount.currencyID; // taxSubtotal.TaxAmount.Value += line.TaxTotal.TaxAmount.Value; // taxSubtotal.TaxAmount.currencyID = tax.TaxAmount.currencyID; // taxSubtotal.Percent.Value = tax.Percent.Value; // } // } // taxSubTotalList.Add(taxSubtotal); // taxTotal.TaxSubtotal = taxSubTotalList.ToArray(); // taxTotalList.Add(taxTotal); // return taxTotalList.ToArray(); //} public virtual TaxTotalType[] invoiceTaxTotal() { List <TaxTotalType> taxTotalList = new List <TaxTotalType>(); List <TaxSubtotalType> taxSubTotalList = new List <TaxSubtotalType>(); TaxTotalType taxTotal = new TaxTotalType { TaxAmount = new TaxAmountType { Value = 0 } }; TaxSubtotalType taxSubtotal = new TaxSubtotalType { TaxableAmount = new TaxableAmountType { Value = 0 }, TaxAmount = new TaxAmountType { Value = 0 }, Percent = new PercentType1 { Value = 0 }, TaxCategory = new TaxCategoryType { TaxScheme = new TaxSchemeType { Name = new NameType1 { Value = nameof(EI.TaxType.KDV) }, TaxTypeCode = new TaxTypeCodeType { Value = "0015" } } } }; foreach (var line in baseInvoiceUBL.InvoiceLine) { taxTotal.TaxAmount.Value += line.TaxTotal.TaxAmount.Value; taxTotal.TaxAmount.currencyID = line.TaxTotal.TaxAmount.currencyID; foreach (var tax in line.TaxTotal.TaxSubtotal) { if (taxSubTotalList.Where(subtotal => subtotal.Percent.Value == tax.Percent.Value).FirstOrDefault() != null) //percent varsa { taxSubtotal.TaxableAmount.Value += tax.TaxableAmount.Value; taxSubtotal.TaxAmount.Value += line.TaxTotal.TaxAmount.Value; } else //yoksa ekle { TaxSubtotalType taxSubtotalNew = new TaxSubtotalType(); taxSubtotalNew.TaxableAmount = new TaxableAmountType { Value = tax.TaxableAmount.Value, currencyID = tax.TaxableAmount.currencyID }; taxSubtotalNew.TaxAmount = new TaxAmountType { Value = line.TaxTotal.TaxAmount.Value, currencyID = tax.TaxAmount.currencyID }; taxSubtotalNew.Percent = new PercentType1 { Value = tax.Percent.Value }; taxSubtotalNew.TaxCategory = new TaxCategoryType(); if (tax.Percent.Value == 0) { taxSubtotalNew.TaxCategory.TaxExemptionReasonCode = new TaxExemptionReasonCodeType { Value = "351" }; taxSubtotalNew.TaxCategory.TaxExemptionReason = new TaxExemptionReasonType { Value = "ReasonTaxExemtion" }; //Reson Value hard code basıldı //istenırse formdan da alınabılır } taxSubtotalNew.TaxCategory.TaxScheme = new TaxSchemeType(); taxSubtotalNew.TaxCategory.TaxScheme.Name = new NameType1 { Value = nameof(EI.TaxType.KDV) }; taxSubtotalNew.TaxCategory.TaxScheme.TaxTypeCode = new TaxTypeCodeType { Value = "0015" }; taxSubTotalList.Add(taxSubtotalNew); } } } taxTotal.TaxSubtotal = taxSubTotalList.ToArray(); taxTotalList.Add(taxTotal); return(taxTotalList.ToArray()); }
public TaxTotalType[] getTaxTotal() { TaxTotalType[] txp = new TaxTotalType[VD.Taxes.Count]; string code, taxe, last; string valu = ""; for (int i = 0; i < VD.Taxes.Count; ++i) { code = taxe = last = ""; if (VD.Taxes[i] == 4) { code = "1000"; taxe = "IGV"; last = "VAT"; valu = Interface["TotSumIGV"]; } if (VD.Taxes[i] == 5) { code = "2000"; taxe = "ISC"; last = "VAT"; valu = Interface["TotSumISC"]; } if (VD.Taxes[i] == 6) { code = "9999"; taxe = "OTROS"; last = "OTH"; valu = Interface["TotSumOTrib"]; } txp[i] = new TaxTotalType() { TaxAmount = new TaxAmountType() { currencyID = Interface["Tmoneda"], Value = valu }, TaxSubtotal = new TaxSubtotalType[] { new TaxSubtotalType { TaxAmount = new TaxAmountType() { currencyID = Interface["Tmoneda"], Value = valu }, TaxCategory = new TaxCategoryType() { TaxScheme = new TaxSchemeType() { ID = new IDType() { Value = code }, Name = new NameType1() { Value = taxe }, TaxTypeCode = new TaxTypeCodeType() { Value = last } } } } } }; } return(txp); }
public void SaveImplicitCreatedNorwegianCreditNote() { Func <decimal, AmountType> newAmountType = v => new AmountType { Value = v, currencyID = "NOK" }; // Set global defaults for Ubl documents that get created var customizationID = "urn:www.cenbii.eu:transaction:BiiCoreTrdm001:ver1.0:extentionId"; var profileID = "urn:www.cenbii.eu:profile:bii05:ver1.0"; // Set thread local default for all amounts types decending from AmountType //Ubl2.Udt.AmountType.TlsDefaultCurrencyID = "NOK"; // Create a serializable CreditNote instance. CreditNoteType doc = new CreditNoteType(); doc.CustomizationID = customizationID; doc.ProfileID = profileID; doc.ID = "654321"; doc.UBLVersionID = "2.0"; doc.DocumentCurrencyCode = "NOK"; doc.IssueDate = new DateTime(2009, 11, 12, 0, 0, 0, DateTimeKind.Utc); // <cac:BillingReference> // <cac:InvoiceDocumentReference> // <cbc:ID>123456</cbc:ID> // </cac:InvoiceDocumentReference> // </cac:BillingReference> // Becomes: doc.BillingReference = new BillingReferenceType[] { new BillingReferenceType { InvoiceDocumentReference = new DocumentReferenceType { ID = "123456" } } }; doc.AccountingSupplierParty = new SupplierPartyType { Party = new PartyType { PartyName = new [] { new PartyNameType { Name = "Leverandør" } }, PostalAddress = new AddressType { Postbox = "Postboks 123", StreetName = "Oslogate", BuildingNumber = "1", CityName = "Oslo", PostalZone = "0612", Country = new CountryType { IdentificationCode = "NO" } }, PartyLegalEntity = new PartyLegalEntityType[] { new PartyLegalEntityType { CompanyID = "NO999999999MVA" } }, Contact = new ContactType { ID = "O Hansen" }, } }; // Populating class instance the old way but are still using implicit operator assingnment functions doc.AccountingCustomerParty = new CustomerPartyType(); PartyType p = new PartyType(); doc.AccountingCustomerParty.Party = p; p.PartyIdentification = new [] { new PartyIdentificationType { ID = "456789" } }; p.PartyName = new PartyNameType[1]; p.PartyName[0] = new PartyNameType { Name = "Kjøper" }; p.PostalAddress = new AddressType(); p.PostalAddress.StreetName = "Testveien"; p.PostalAddress.BuildingNumber = "1"; p.PostalAddress.CityName = "Frogner"; p.PostalAddress.PostalZone = "2012"; p.PostalAddress.Country = new CountryType(); p.PostalAddress.Country.IdentificationCode = "NO"; // implicit operator called behind the scenes here //p.PostalAddress.Country.IdentificationCode = new CodeType { Value = "NO" }; p.PartyLegalEntity = new PartyLegalEntityType[] { new PartyLegalEntityType() }; p.PartyLegalEntity[0].CompanyID = "NO888888888MVA"; p.Contact = new ContactType { ID = "3150bdn" }; TaxTotalType tax = new TaxTotalType(); doc.TaxTotal = new TaxTotalType[1] { tax }; tax.TaxAmount = newAmountType(112.0M); tax.TaxSubtotal = new TaxSubtotalType[1] { new TaxSubtotalType() }; tax.TaxSubtotal[0].TaxableAmount = newAmountType(800.0M); tax.TaxSubtotal[0].TaxAmount = newAmountType(112.0M); tax.TaxSubtotal[0].TaxCategory = new TaxCategoryType { ID = "AA", Percent = 14.0M, TaxScheme = new TaxSchemeType { ID = "VAT" } }; doc.LegalMonetaryTotal = new MonetaryTotalType(); doc.LegalMonetaryTotal.LineExtensionAmount = new AmountType { Value = 800.0M, currencyID = "AED" }; // Note difi.no doc use "AED" instead of DocumentCurrency code. QA slip. doc.LegalMonetaryTotal.TaxExclusiveAmount = new AmountType { Value = 800.0M, currencyID = "AED" }; doc.LegalMonetaryTotal.TaxInclusiveAmount = new AmountType { Value = 912.0M, currencyID = "AED" }; doc.LegalMonetaryTotal.PayableAmount = new AmountType { Value = 912.0M, currencyID = "AED" }; doc.CreditNoteLine = new CreditNoteLineType[1]; doc.CreditNoteLine[0] = new CreditNoteLineType { ID = "1", CreditedQuantity = new QuantityType { Value = 8, unitCode = "KGM" }, LineExtensionAmount = newAmountType(800.0M), TaxTotal = new TaxTotalType[] { new TaxTotalType { TaxAmount = newAmountType(112.0M) } }, Item = new ItemType { Name = "Matprodukt-1", SellersItemIdentification = new ItemIdentificationType { ID = "23456785" }, ClassifiedTaxCategory = new TaxCategoryType[] { new TaxCategoryType { ID = "S", Percent = 14.0M, TaxScheme = new TaxSchemeType { ID = "VAT" } } } }, Price = new PriceType { PriceAmount = newAmountType(100.0M) } }; // save the creditnote to xml string filename = "ImplicitCreatedNorwegianCreditNote.xml"; UblDoc <CreditNoteType> .Save(filename, doc); // Compare it with a local copy grabbed from difi.no doc bool areEqual = UblXmlComparer.IsCopyEqual <CreditNoteType>("NorwegianCreditNoteFromDifiPdfDoc.xml", doc); Assert.AreEqual(areEqual, true, "Written UBL doc differs from original"); }
//Informacion de las lineas del documento #region InvoiceLine /// <summary> /// Generacion de InvoiceLine /// </summary> /// <returns></returns> private InvoiceLineType[] InvoiceLine() { List <InvoiceLineType> Items_Respuesta = new List <InvoiceLineType>(); //foreach (var item in ITEM_collection) //{ //} #region InvoiceLine //string[] DE = item.DE.Split('|'); //string[] DEDR = item.DEDR.Split('|'); //List<string> DEIM_LIST = item.DEIM; //string[] DEDI = item.DEDI.Split('|'); InvoiceLineType Linea = new InvoiceLineType(); { //numero de orden del item Linea.ID = new IDType() { Value = "Numero de Orden del Item" }; //(InvoicedQuantity)cantidad de unidades del item Linea.InvoicedQuantity = new InvoicedQuantityType() { Value = Convert.ToDecimal(3), unitCode = "Codigo Unitario", unitCodeListID = "UN/ECE rec 20", unitCodeListAgencyName = "United Nations Economic Commission for Europe" }; //(LineExtensionAmount)Valor de Venta del item Linea.LineExtensionAmount = new LineExtensionAmountType() { Value = Convert.ToDecimal(50), currencyID = ConstantesAtributo.PEN }; #region PricingReference Linea.PricingReference = new PricingReferenceType() { //AlternativeConditionPrice AlternativeConditionPrice = new PriceType[] { new PriceType() { //(PriceAmount) precoi de venta unitario/ valor referencial PriceAmount = new PriceAmountType() { Value = Convert.ToDecimal(50), currencyID = ConstantesAtributo.PEN }, //(PriceTypeCode) codigo de tipo de precio PriceTypeCode = new PriceTypeCodeType() { Value = "Codigo de Tipo de Precio", listName = "SUNAT:Indicador de Tipo de Precio", listAgencyName = ConstantesAtributo.PESUNAT, listURI = ConstantesAtributo.CATALOGO16 } } } }; #endregion #region Delivery #endregion //Descuentos o Recargos de la linea #region AllowanceCharge Linea.AllowanceCharge = new AllowanceChargeType[] { new AllowanceChargeType() { ChargeIndicator = new ChargeIndicatorType() { Value = true }, AllowanceChargeReasonCode = new AllowanceChargeReasonCodeType() { Value = "Codigo de cargo o descuento" }, MultiplierFactorNumeric = new MultiplierFactorNumericType() { Value = Convert.ToDecimal(0.13) }, Amount = new AmountType2() { Value = Convert.ToDecimal(20), currencyID = ConstantesAtributo.PEN }, BaseAmount = new BaseAmountType() { Value = Convert.ToDecimal(30), currencyID = ConstantesAtributo.PEN } } }; #endregion //Monto de tributo del item #region TaxTotal List <TaxTotalType> taxTotals = new List <TaxTotalType>(); //foreach (var DEIM_Item in DEIM_LIST) //{ // string[] DEIM = DEIM_Item.Split('|'); //} TaxTotalType taxTotalType = new TaxTotalType() { //Monto de tributo del ítem TaxAmount = new TaxAmountType() { Value = Convert.ToDecimal(50), currencyID = ConstantesAtributo.PEN }, TaxSubtotal = new TaxSubtotalType[] { new TaxSubtotalType() { //Monto de la Operacion TaxableAmount = new TaxableAmountType() { Value = Convert.ToDecimal(10), currencyID = ConstantesAtributo.PEN }, //Monto de Tributo por Item TaxAmount = new TaxAmountType() { Value = Convert.ToDecimal(15), currencyID = ConstantesAtributo.PEN }, TaxCategory = new TaxCategoryType() { ID = new IDType() { Value = "S", schemeID = ConstantesAtributo.UNECE5305, schemeAgencyID = "6" }, Percent = new PercentType1 { Value = Convert.ToDecimal(14) }, TaxExemptionReasonCode = new TaxExemptionReasonCodeType() { Value = "Codigo de tipo de afeectacion del igv", listAgencyName = ConstantesAtributo.PESUNAT, listName = "SUNAT:Codigo de Tipo de Afectación del IGV", listURI = ConstantesAtributo.CATALOGO07 }, TaxScheme = new TaxSchemeType() { ID = new IDType() { Value = "Codigo del tributo", }, Name = new NameType1() { Value = "Nombre del tributo", }, TaxTypeCode = new TaxTypeCodeType() { Value = "Codigo Internacional del producto" } } } } } }; taxTotals.Add(taxTotalType); Linea.TaxTotal = taxTotals.ToArray(); #endregion #region Item Linea.Item = new ItemType() { Description = new DescriptionType[] { new DescriptionType() { Value = "Descripcion del item" } }, SellersItemIdentification = new ItemIdentificationType() { ID = new IDType() { Value = "Codigo de producto" } }, CommodityClassification = new CommodityClassificationType[] { new CommodityClassificationType() { ItemClassificationCode = new ItemClassificationCodeType() { Value = "Catalogo 25 sunat" } } } }; #endregion #region Price Linea.Price = new PriceType() { PriceAmount = new PriceAmountType() { Value = Convert.ToDecimal(50), } }; #endregion } #endregion Items_Respuesta.Add(Linea); return(Items_Respuesta.ToArray()); }
private TaxTotalType[] TaxTotalType() { //Impuestos List <TaxTotalType> taxTotal = new List <TaxTotalType>(); //foreach (var Impuestos in Doc.DI) //{ // string[] DI = Impuestos.Split('|'); //} TaxTotalType taxTotalType = new TaxTotalType() { TaxAmount = new TaxAmountType { currencyID = "PEN", Value = Convert.ToDecimal("1000") }, TaxSubtotal = new TaxSubtotalType[] { new TaxSubtotalType { TaxAmount = new TaxAmountType { currencyID = "PEN", Value = Convert.ToDecimal("1000") }, TaxableAmount = new TaxableAmountType { Value = Convert.ToDecimal("1000") }, TaxCategory = new TaxCategoryType { ID = new IDType { Value = "S" }, TierRange = new TierRangeType { Value = "S" }, TaxExemptionReasonCode = new TaxExemptionReasonCodeType { Value = "" }, TaxScheme = new TaxSchemeType { ID = new IDType { Value = "Id Tributo" }, Name = new NameType1 { Value = "Nombre de tributo" }, TaxTypeCode = new TaxTypeCodeType { Value = "Código internacional de tributo" } } }, Percent = new PercentType1 { Value = 18 } } }, }; taxTotal.Add(taxTotalType); return(taxTotal.ToArray()); }