コード例 #1
0
        /// <summary>
        /// Genera Documento de Perecepcion
        /// </summary>
        /// <param name="doc">Pereception UBL2.0</param>
        /// <returns>Path of XML</returns>
        public XmlFileResult GenerateDocPerception(PerceptionType doc)
        {
            var filename = $"{doc.AgentParty.PartyIdentification[0].ID.Value}-40-{doc.ID.Value}";

            return(new XmlFileResult
            {
                Success = true,
                FileName = filename,
                Content = UtilsXmlDoc.GenFile(ref _result, doc, _certificado)
            });
        }
コード例 #2
0
        /// <summary>
        /// Genera y Firma Documento de Guia de Remision.
        /// </summary>
        /// <param name="doc">Guia de Remision UBL2.1</param>
        /// <returns>XML</returns>
        public XmlFileResult GenerateDocGuia(DespatchAdviceType doc)
        {
            var filename = $"{doc.DespatchSupplierParty.CustomerAssignedAccountID.Value}-09-{doc.ID.Value}";

            return(new XmlFileResult
            {
                Success = true,
                FileName = filename,
                Content = UtilsXmlDoc.GenFile(ref _result, doc, _certificado)
            });
        }
コード例 #3
0
        /// <summary>
        /// Genera un documento XML para Resumen de Reversion.
        /// </summary>
        /// <param name="voidedHeaderEntity">Entidad Voided</param>
        /// <returns>XML</returns>
        public XmlFileResult GenerarDocumentoVoided(VoidedHeader voidedHeaderEntity)
        {
            try
            {
                #region Filename
                var id          = $"RR-{DateTime.Today:yyyyMMdd}-{voidedHeaderEntity.CorrelativoArchivo}";
                var xmlFilename = voidedHeaderEntity.RucEmisor + "-" + id;
                #endregion

                #region Gen Voided
                var voidedDoc = new VoidedDocumentsType
                {
                    ID              = id,
                    ReferenceDate   = voidedHeaderEntity.FechaEmision,
                    CustomizationID = "1.0",
                    IssueDate       = DateTime.Today.Date,
                    UBLExtensions   = new[]
                    {
                        new UBLExtensionType
                        {
                            ExtensionContent = new AdditionalsInformationType()
                        },
                    },
                    Signature = UtilsXmlDoc.GetSignature(voidedHeaderEntity),
                    AccountingSupplierParty = UtilsXmlDoc.GetInfoEmisor(voidedHeaderEntity),
                    VoidedDocumentsLine     = UtilsXmlDoc.GetVoidedLines(voidedHeaderEntity.DetallesDocumento)
                };
                #endregion

                return(new XmlFileResult
                {
                    Success = true,
                    FileName = xmlFilename,
                    Content = UtilsXmlDoc.GenFile(ref _result, voidedDoc, _certificado)
                });
            }
            catch (Exception er)
            {
                _result.Success = false;
                _result.Error   = er.Message;
                _result.Target  = "XmlOtrosCeGenerator.GenerarDocumentoVoided()";
                return(null);
            }
        }
コード例 #4
0
        private XmlFileResult FromDocument <TSunat>(TSunat doc, string filename)
            where TSunat : UblBaseDocumentType
        {
            var pobjOperationResult = new OperationResult();
            var ct = UtilsXmlDoc.GenFile(ref pobjOperationResult, doc, _certificado);

            var result = new XmlFileResult();

            if (pobjOperationResult.Success)
            {
                result.Success  = true;
                result.FileName = filename;
                result.Content  = ct;
            }
            else
            {
                result.Error = pobjOperationResult.Error;
            }

            return(result);
        }