private SignatureType[] SignatureTypes(TramaDocumento Doc) { try { string[] EN = Doc.EN.Split('|'); //informacion adicional a la firma SignatureType[] signatureCac = new SignatureType[] { new SignatureType() { ID = new IDType { Value = "LlamaSign" }, SignatoryParty = new PartyType { PartyIdentification = new PartyIdentificationType[] { new PartyIdentificationType { ID = new IDType { schemeID = EN[8].ToString(), Value = EN[8].ToString() } } }, PartyName = new PartyNameType[] { new PartyNameType { Name = new NameType1 { Value = EN[10].ToString() } } } }, DigitalSignatureAttachment = new AttachmentType { ExternalReference = new ExternalReferenceType { URI = new URIType { Value = EN[8].ToString() } } } } }; return(signatureCac); } catch (Exception) { throw; } }
//Valores totales del documento #region LegalMonetaryTotal /// <summary> /// Generacion de MonetaryTotal /// </summary> /// <param name="DOC"></param> /// <returns></returns> private MonetaryTotalType MonetaryTotal(TramaDocumento DOC) { string[] ENEX = DOC.ENEX.Split('|'); string[] EN = DOC.EN.Split('|'); try { MonetaryTotalType legalMonetaryTotal = new MonetaryTotalType() { //Total valor de venta LineExtensionAmount = new LineExtensionAmountType { Value = Convert.ToDecimal(EN[21].ToString()), currencyID = Moneda }, //Total precio de venta (incluye impuestos) TaxInclusiveAmount = new TaxInclusiveAmountType { Value = Convert.ToDecimal(ENEX[9].ToString()), currencyID = Moneda }, //Monto total de Descuentos AllowanceTotalAmount = new AllowanceTotalAmountType { Value = Convert.ToDecimal(EN[23].ToString()), currencyID = Moneda }, //Otros Cargos del Comprobante ChargeTotalAmount = new ChargeTotalAmountType { Value = Convert.ToDecimal(EN[24].ToString()), currencyID = Moneda }, //Total de Anticipos PrepaidAmount = new PrepaidAmountType { Value = 0, currencyID = Moneda }, //Importe total de la venta PayableAmount = new PayableAmountType { Value = Convert.ToDecimal(EN[25].ToString()), } }; return(legalMonetaryTotal); } 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; } }
// informacion del cliente #region AccountingSupplierParty private CustomerPartyType CustomerPartyType(TramaDocumento Doc) { try { string[] EN = Doc.EN.Split('|'); //cliente CustomerPartyType accountingCustomerParty = new CustomerPartyType() { Party = new PartyType { PartyLegalEntity = new PartyLegalEntityType[] { new PartyLegalEntityType { RegistrationName = new RegistrationNameType { Value = EN[19].ToString(), } } }, PartyName = new PartyNameType[] { new PartyNameType { Name = new NameType1 { Value = EN[19].ToString() } } }, PostalAddress = new AddressType { ID = new IDType { Value = "0001" }, District = new DistrictType { Value = "Distrito" }, CityName = new CityNameType { Value = "Ciudad" }, StreetName = new StreetNameType { Value = "Calle 1" }, CitySubdivisionName = new CitySubdivisionNameType { Value = "" }, Country = new CountryType { IdentificationCode = new IdentificationCodeType { Value = "PE" } }, CountrySubentity = new CountrySubentityType { Value = "" }, } }, AdditionalAccountID = new AdditionalAccountIDType[] { new AdditionalAccountIDType { Value = EN[18].ToString() } }, CustomerAssignedAccountID = new CustomerAssignedAccountIDType { Value = EN[18].ToString() } }; return(accountingCustomerParty); } catch (Exception) { throw; } }
private SupplierPartyType SupplierPartyType(TramaDocumento Doc) { try { string[] EN = Doc.EN.Split('|'); //proveedor SupplierPartyType accountingSupplierParty = new SupplierPartyType() { Party = new PartyType { PartyLegalEntity = new PartyLegalEntityType[] { new PartyLegalEntityType { RegistrationName = new RegistrationNameType { Value = EN[10].ToString() }, } }, PartyName = new PartyNameType[] { new PartyNameType { Name = new NameType1 { Value = EN[11].ToString() } } }, PartyTaxScheme = new PartyTaxSchemeType[] { new PartyTaxSchemeType { RegistrationName = new RegistrationNameType() { Value = EN[11].ToString() }, CompanyID = new CompanyIDType() { Value = EN[17].ToString(), schemeID = EN[17].ToString(), schemeName = "SUNAT:Identificador de Documento de Identidad", schemeAgencyName = ConstantesAtributo.PESUNAT, schemeURI = ConstantesAtributo.CATALOGO06 }, RegistrationAddress = new AddressType { AddressTypeCode = new AddressTypeCodeType() { Value = "0000" } } } }, PostalAddress = new AddressType { ID = new IDType { Value = "0001" }, District = new DistrictType { Value = EN[16].ToString() }, CityName = new CityNameType { Value = EN[14].ToString() }, StreetName = new StreetNameType { Value = "" }, CitySubdivisionName = new CitySubdivisionNameType { Value = "" }, Country = new CountryType { IdentificationCode = new IdentificationCodeType { Value = "" } }, CountrySubentity = new CountrySubentityType { Value = "" }, } }, AdditionalAccountID = new AdditionalAccountIDType[] { new AdditionalAccountIDType { Value = EN[8].ToString() } }, CustomerAssignedAccountID = new CustomerAssignedAccountIDType { Value = EN[8].ToString() } }; return(accountingSupplierParty); } catch (Exception) { throw; } }