public RemittanceAdviceType()
 {
     this.remittanceAdviceLineField        = new ObservableCollection <RemittanceAdviceLineType>();
     this.taxTotalField                    = new ObservableCollection <TaxTotalType>();
     this.paymentMeansField                = new PaymentMeansType();
     this.payeePartyField                  = new PartyType();
     this.accountingSupplierPartyField     = new SupplierPartyType();
     this.accountingCustomerPartyField     = new CustomerPartyType();
     this.signatureField                   = new ObservableCollection <SignatureType>();
     this.additionalDocumentReferenceField = new ObservableCollection <DocumentReferenceType>();
     this.billingReferenceField            = new BillingReferenceType();
     this.invoicePeriodField               = new ObservableCollection <PeriodType>();
     this.lineCountNumericField            = new LineCountNumericType();
     this.invoicingPartyReferenceField     = new InvoicingPartyReferenceType();
     this.payerReferenceField              = new PayerReferenceType();
     this.paymentOrderReferenceField       = new PaymentOrderReferenceType();
     this.totalPaymentAmountField          = new TotalPaymentAmountType();
     this.totalCreditAmountField           = new TotalCreditAmountType();
     this.totalDebitAmountField            = new TotalDebitAmountType();
     this.documentCurrencyCodeField        = new DocumentCurrencyCodeType();
     this.noteField               = new ObservableCollection <NoteType>();
     this.issueTimeField          = new IssueTimeType();
     this.issueDateField          = new IssueDateType();
     this.uUIDField               = new UUIDType();
     this.copyIndicatorField      = new CopyIndicatorType();
     this.idField                 = new IDType();
     this.profileExecutionIDField = new ProfileExecutionIDType();
     this.profileIDField          = new ProfileIDType();
     this.customizationIDField    = new CustomizationIDType();
     this.uBLVersionIDField       = new UBLVersionIDType();
     this.uBLExtensionsField      = new ObservableCollection <UBLExtensionType>();
 }
Пример #2
0
        public BillingReferenceType[] getBillingReferenceType()
        {
            BillingReferenceType[] BRT = new BillingReferenceType[VD.da];

            string TpoNota = Interface["TpoNota"].ToString();

            if (TpoNota != "03")
            {
                for (int i = 0; i < VD.da; ++i)
                {
                    int j = i + 1;
                    BRT[i] = new BillingReferenceType
                    {
                        InvoiceDocumentReference = new DocumentReferenceType()
                        {
                            ID = new IDType()
                            {
                                Value = Interface["DocID" + j]
                            },
                            DocumentTypeCode = new DocumentTypeCodeType()
                            {
                                Value = Interface["DocTpoDoc" + j]
                            }
                        }
                    };
                }
            }


            return(BRT);
        }
Пример #3
0
        public BillingReferenceType[] getBillingReferenceType()
        {
            BillingReferenceType[] BRT = new BillingReferenceType[VD.da];

            for (int i = 0; i < VD.da; ++i)
            {
                int j = i + 1;
                BRT[i] = new BillingReferenceType
                {
                    InvoiceDocumentReference = new DocumentReferenceType()
                    {
                        ID = new IDType()
                        {
                            Value = Interface["DocID" + j]
                        },
                        DocumentTypeCode = new DocumentTypeCodeType()
                        {
                            Value = Interface["DocTpoDoc" + j]
                        }
                    }
                };
            }
            return(BRT);
        }
Пример #4
0
        void LlenarDocumentoRefenciado(En_ComprobanteElectronico Comprobante, ref DebitNoteType debitNote)
        {
            if (Comprobante.DocumentoSustentoNota != null)
            {
                debitNote.DiscrepancyResponse = new ResponseType[]
                {
                    new ResponseType {
                        Description = new DescriptionType[] {
                            new DescriptionType
                            {
                                Value = Comprobante.DocumentoSustentoNota.MotivoAnulacion
                            }
                        },
                        ResponseCode = new ResponseCodeType
                        {
                            listName       = "Tipo de nota de credito",
                            listAgencyName = "PE:SUNAT",
                            listURI        = "urn:pe:gob:sunat:cpe:see:gem:catalogos:catalogo09",
                            Value          = Comprobante.DocumentoSustentoNota.CodigoMotivoAnulacion
                        },
                        ReferenceID = new ReferenceIDType {
                            Value = Comprobante.DocumentoSustentoNota.SerieNumero
                        }
                    }
                };
            }

            if (Comprobante.DocumentoReferenciaNota != null)
            {
                List <BillingReferenceType> oListaReferencia = new List <BillingReferenceType>();

                foreach (En_DocumentoReferenciaNota oDoc in Comprobante.DocumentoReferenciaNota)
                {
                    BillingReferenceType oreferencia = new BillingReferenceType();
                    oreferencia.InvoiceDocumentReference = new DocumentReferenceType
                    {
                        ID = new IDType
                        {
                            Value = oDoc.SerieNumero
                        },
                        IssueDate = new IssueDateType
                        {
                            Value = oDoc.Fecha
                        },
                        DocumentTypeCode = new DocumentTypeCodeType
                        {
                            listName       = "Tipo de Documento",
                            listAgencyName = "PE:SUNAT",
                            listURI        = "urn:pe:gob:sunat:cpe:see:gem:catalogos:catalogo01",
                            Value          = oDoc.TipoDocumento
                        }
                    };

                    oListaReferencia.Add(oreferencia);
                }

                if (oListaReferencia.Count > 0)
                {
                    debitNote.BillingReference = oListaReferencia.ToArray();
                }
            }
        }
Пример #5
0
        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);
        }
Пример #6
0
 public BillingReference(string billingId, BillingReferenceType type)
 {
     BillingId = billingId;
     Type      = type;
 }