public QuotationType()
 {
     this.quotationLineField                        = new ObservableCollection <QuotationLineType>();
     this.quotedMonetaryTotalField                  = new MonetaryTotalType();
     this.taxTotalField                             = new ObservableCollection <TaxTotalType>();
     this.destinationCountryField                   = new CountryType();
     this.allowanceChargeField                      = new ObservableCollection <AllowanceChargeType>();
     this.transactionConditionsField                = new TransactionConditionsType();
     this.paymentMeansField                         = new PaymentMeansType();
     this.deliveryTermsField                        = new DeliveryTermsType();
     this.deliveryField                             = new ObservableCollection <DeliveryType>();
     this.originatorCustomerPartyField              = new CustomerPartyType();
     this.buyerCustomerPartyField                   = new CustomerPartyType();
     this.sellerSupplierPartyField                  = new SupplierPartyType();
     this.signatureField                            = new ObservableCollection <SignatureType>();
     this.contractField                             = new ObservableCollection <ContractType>();
     this.additionalDocumentReferenceField          = new ObservableCollection <DocumentReferenceType>();
     this.requestForQuotationDocumentReferenceField = new DocumentReferenceType();
     this.validityPeriodField                       = new PeriodType();
     this.lineCountNumericField                     = new LineCountNumericType();
     this.pricingCurrencyCodeField                  = new PricingCurrencyCodeType();
     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>();
 }
Beispiel #2
0
        void LlenarMontosTotales(En_ComprobanteElectronico Comprobante, ref DebitNoteType debitNote)
        {
            MonetaryTotalType oTotal = new MonetaryTotalType
            {
                LineExtensionAmount = new LineExtensionAmountType
                {
                    Value      = Comprobante.TotalValorVenta,
                    currencyID = Comprobante.Moneda.Trim()
                },
                TaxInclusiveAmount = new TaxInclusiveAmountType
                {
                    Value      = Comprobante.TotalPrecioVenta,
                    currencyID = Comprobante.Moneda.Trim()
                },
                PayableAmount = new PayableAmountType
                {
                    Value      = Comprobante.ImporteTotal,
                    currencyID = Comprobante.Moneda.Trim()
                },
                ChargeTotalAmount = new ChargeTotalAmountType
                {
                    Value      = Comprobante.TotalCargo,
                    currencyID = Comprobante.Moneda.Trim()
                },
                AllowanceTotalAmount = new AllowanceTotalAmountType
                {
                    Value      = Comprobante.TotalDescuento,
                    currencyID = Comprobante.Moneda.Trim()
                }
            };

            debitNote.RequestedMonetaryTotal = oTotal;
        }
Beispiel #3
0
        public MonetaryTotalType getLegalMonetaryTotal()
        {
            MonetaryTotalType mtt = new MonetaryTotalType()
            {
                PayableAmount = new PayableAmountType()
                {
                    currencyID = Interface["Tmoneda"],
                    Value      = Interface["TotImporTotal"]
                }
            };

            if (Interface["TotDctoGlobal"] != "" && Interface["TotDctoGlobal"] != "0.00")
            {
                mtt.AllowanceTotalAmount = new AllowanceTotalAmountType()
                {
                    currencyID = Interface["Tmoneda"],
                    Value      = Interface["TotDctoGlobal"]
                };
            }

            if (Interface["TotSumOCargo"] != "" && Interface["TotSumOCargo"] != "0.00")
            {
                mtt.ChargeTotalAmount = new ChargeTotalAmountType()
                {
                    currencyID = Interface["Tmoneda"],
                    Value      = Interface["TotSumOCargo"]
                };
            }

            return(mtt);
        }
 public CreditNoteType()
 {
     this._creditNoteLine                 = new List <CreditNoteLineType>();
     this._legalMonetaryTotal             = new MonetaryTotalType();
     this._taxTotal                       = new List <TaxTotalType>();
     this._allowanceCharge                = new List <AllowanceChargeType>();
     this._paymentAlternativeExchangeRate = new ExchangeRateType();
     this._paymentExchangeRate            = new ExchangeRateType();
     this._pricingExchangeRate            = new ExchangeRateType();
     this._taxExchangeRate                = new ExchangeRateType();
     this._paymentTerms                   = new List <PaymentTermsType>();
     this._paymentMeans                   = new List <PaymentMeansType>();
     this._deliveryTerms                  = new List <DeliveryTermsType>();
     this._delivery                       = new List <DeliveryType>();
     this._taxRepresentativeParty         = new PartyType();
     this._sellerSupplierParty            = new SupplierPartyType();
     this._buyerCustomerParty             = new CustomerPartyType();
     this._payeeParty                     = new PartyType();
     this._accountingCustomerParty        = new CustomerPartyType();
     this._accountingSupplierParty        = new SupplierPartyType();
     this._signature                      = new List <SignatureType>();
     this._originatorDocumentReference    = new List <DocumentReferenceType>();
     this._statementDocumentReference     = new List <DocumentReferenceType>();
     this._additionalDocumentReference    = new List <DocumentReferenceType>();
     this._contractDocumentReference      = new List <DocumentReferenceType>();
     this._receiptDocumentReference       = new List <DocumentReferenceType>();
     this._despatchDocumentReference      = new List <DocumentReferenceType>();
     this._billingReference               = new List <BillingReferenceType>();
     this._orderReference                 = new OrderReferenceType();
     this._discrepancyResponse            = new List <ResponseType>();
     this._invoicePeriod                  = new List <PeriodType>();
     this._buyerReference                 = new BuyerReferenceType();
     this._lineCountNumeric               = new LineCountNumericType();
     this._accountingCost                 = new AccountingCostType();
     this._accountingCostCode             = new AccountingCostCodeType();
     this._paymentAlternativeCurrencyCode = new PaymentAlternativeCurrencyCodeType();
     this._paymentCurrencyCode            = new PaymentCurrencyCodeType();
     this._pricingCurrencyCode            = new PricingCurrencyCodeType();
     this._taxCurrencyCode                = new TaxCurrencyCodeType();
     this._documentCurrencyCode           = new DocumentCurrencyCodeType();
     this._note = new List <NoteType>();
     this._creditNoteTypeCode = new CreditNoteTypeCodeType();
     this._taxPointDate       = new TaxPointDateType();
     this._issueTime          = new IssueTimeType();
     this._issueDate          = new IssueDateType();
     this._uUID               = new UUIDType();
     this._copyIndicator      = new CopyIndicatorType();
     this._id                 = new IDType();
     this._profileExecutionID = new ProfileExecutionIDType();
     this._profileID          = new ProfileIDType();
     this._customizationID    = new CustomizationIDType();
     this._uBLVersionID       = new UBLVersionIDType();
     this._uBLExtensions      = new List <UBLExtensionType>();
 }
        public MonetaryTotalType CalculateLegalMonetaryTotal()
        {
            MonetaryTotalType legalMonetaryTotal = new MonetaryTotalType
            {
                LineExtensionAmount = new LineExtensionAmountType {
                    Value = 0
                },

                TaxExclusiveAmount = new TaxExclusiveAmountType {
                    Value = 0
                },

                TaxInclusiveAmount = new TaxInclusiveAmountType {
                    Value = 0
                },

                AllowanceTotalAmount = new AllowanceTotalAmountType {
                    Value = 0
                },

                PayableAmount = new PayableAmountType {
                    Value = 0
                }
            };

            foreach (var line in baseInvoiceUBL.InvoiceLine)
            {
                foreach (var allowance in line.AllowanceCharge)
                {
                    legalMonetaryTotal.AllowanceTotalAmount.currencyID = allowance.Amount.currencyID;
                    legalMonetaryTotal.AllowanceTotalAmount.Value     += allowance.Amount.Value;
                    legalMonetaryTotal.TaxInclusiveAmount.currencyID   = line.LineExtensionAmount.currencyID;

                    legalMonetaryTotal.TaxInclusiveAmount.Value += line.LineExtensionAmount.Value -
                                                                   allowance.Amount.Value + line.TaxTotal.TaxAmount.Value;
                }

                legalMonetaryTotal.LineExtensionAmount.currencyID = line.LineExtensionAmount.currencyID;
                legalMonetaryTotal.LineExtensionAmount.Value     += line.LineExtensionAmount.Value;


                legalMonetaryTotal.PayableAmount.currencyID = line.LineExtensionAmount.currencyID;
                legalMonetaryTotal.PayableAmount.Value      = legalMonetaryTotal.TaxInclusiveAmount.Value;

                foreach (var tax in line.TaxTotal.TaxSubtotal)
                {
                    legalMonetaryTotal.TaxExclusiveAmount.currencyID = tax.TaxableAmount.currencyID;
                    legalMonetaryTotal.TaxExclusiveAmount.Value     += tax.TaxableAmount.Value;
                }
            }
            return(legalMonetaryTotal);
        }
Beispiel #6
0
 public DebitNoteType()
 {
     this.debitNoteLineField          = new ObservableCollection <DebitNoteLineType>();
     this.requestedMonetaryTotalField = new MonetaryTotalType();
     this.taxTotalField = new ObservableCollection <TaxTotalType>();
     this.paymentAlternativeExchangeRateField = new ExchangeRateType();
     this.paymentExchangeRateField            = new ExchangeRateType();
     this.pricingExchangeRateField            = new ExchangeRateType();
     this.taxExchangeRateField                = new ExchangeRateType();
     this.paymentTermsField                   = new ObservableCollection <PaymentTermsType>();
     this.paymentMeansField                   = new ObservableCollection <PaymentMeansType>();
     this.deliveryTermsField                  = new ObservableCollection <DeliveryTermsType>();
     this.deliveryField                       = new ObservableCollection <DeliveryType>();
     this.allowanceChargeField                = new ObservableCollection <AllowanceChargeType>();
     this.prepaidPaymentField                 = new ObservableCollection <PaymentType>();
     this.taxRepresentativePartyField         = new PartyType();
     this.sellerSupplierPartyField            = new SupplierPartyType();
     this.buyerCustomerPartyField             = new CustomerPartyType();
     this.payeePartyField                     = new PartyType();
     this.accountingCustomerPartyField        = new CustomerPartyType();
     this.accountingSupplierPartyField        = new SupplierPartyType();
     this.signatureField                      = new ObservableCollection <SignatureType>();
     this.additionalDocumentReferenceField    = new ObservableCollection <DocumentReferenceType>();
     this.contractDocumentReferenceField      = new ObservableCollection <DocumentReferenceType>();
     this.statementDocumentReferenceField     = new ObservableCollection <DocumentReferenceType>();
     this.receiptDocumentReferenceField       = new ObservableCollection <DocumentReferenceType>();
     this.despatchDocumentReferenceField      = new ObservableCollection <DocumentReferenceType>();
     this.billingReferenceField               = new ObservableCollection <BillingReferenceType>();
     this.orderReferenceField                 = new OrderReferenceType();
     this.discrepancyResponseField            = new ObservableCollection <ResponseType>();
     this.invoicePeriodField                  = new ObservableCollection <PeriodType>();
     this.lineCountNumericField               = new LineCountNumericType();
     this.accountingCostField                 = new AccountingCostType();
     this.accountingCostCodeField             = new AccountingCostCodeType();
     this.paymentAlternativeCurrencyCodeField = new PaymentAlternativeCurrencyCodeType();
     this.paymentCurrencyCodeField            = new PaymentCurrencyCodeType();
     this.pricingCurrencyCodeField            = new PricingCurrencyCodeType();
     this.taxCurrencyCodeField                = new TaxCurrencyCodeType();
     this.documentCurrencyCodeField           = new DocumentCurrencyCodeType();
     this.taxPointDateField                   = new TaxPointDateType();
     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>();
 }
 //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;
     }
 }
Beispiel #8
0
 public OrderType()
 {
     this.orderLineField = new ObservableCollection <OrderLineType>();
     this.anticipatedMonetaryTotalField = new MonetaryTotalType();
     this.taxTotalField                     = new ObservableCollection <TaxTotalType>();
     this.destinationCountryField           = new CountryType();
     this.paymentExchangeRateField          = new ExchangeRateType();
     this.pricingExchangeRateField          = new ExchangeRateType();
     this.taxExchangeRateField              = new ExchangeRateType();
     this.allowanceChargeField              = new ObservableCollection <AllowanceChargeType>();
     this.transactionConditionsField        = new TransactionConditionsType();
     this.paymentTermsField                 = new ObservableCollection <PaymentTermsType>();
     this.paymentMeansField                 = new ObservableCollection <PaymentMeansType>();
     this.deliveryTermsField                = new ObservableCollection <DeliveryTermsType>();
     this.deliveryField                     = new ObservableCollection <DeliveryType>();
     this.accountingCustomerPartyField      = new CustomerPartyType();
     this.freightForwarderPartyField        = new PartyType();
     this.originatorCustomerPartyField      = new CustomerPartyType();
     this.sellerSupplierPartyField          = new SupplierPartyType();
     this.buyerCustomerPartyField           = new CustomerPartyType();
     this.signatureField                    = new ObservableCollection <SignatureType>();
     this.projectReferenceField             = new ObservableCollection <ProjectReferenceType>();
     this.contractField                     = new ObservableCollection <ContractType>();
     this.additionalDocumentReferenceField  = new ObservableCollection <DocumentReferenceType>();
     this.catalogueReferenceField           = new CatalogueReferenceType();
     this.originatorDocumentReferenceField  = new DocumentReferenceType();
     this.orderDocumentReferenceField       = new ObservableCollection <DocumentReferenceType>();
     this.quotationDocumentReferenceField   = new DocumentReferenceType();
     this.validityPeriodField               = new ObservableCollection <PeriodType>();
     this.lineCountNumericField             = new LineCountNumericType();
     this.accountingCostField               = new AccountingCostType();
     this.accountingCostCodeField           = new AccountingCostCodeType();
     this.customerReferenceField            = new CustomerReferenceType();
     this.taxCurrencyCodeField              = new TaxCurrencyCodeType();
     this.pricingCurrencyCodeField          = new PricingCurrencyCodeType();
     this.documentCurrencyCodeField         = new DocumentCurrencyCodeType();
     this.requestedInvoiceCurrencyCodeField = new RequestedInvoiceCurrencyCodeType();
     this.noteField               = new ObservableCollection <NoteType>();
     this.orderTypeCodeField      = new OrderTypeCodeType();
     this.issueTimeField          = new IssueTimeType();
     this.issueDateField          = new IssueDateType();
     this.uUIDField               = new UUIDType();
     this.copyIndicatorField      = new CopyIndicatorType();
     this.salesOrderIDField       = new SalesOrderIDType();
     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>();
 }
 public ReminderType()
 {
     this.reminderLineField                   = new ObservableCollection <ReminderLineType>();
     this.legalMonetaryTotalField             = new MonetaryTotalType();
     this.taxTotalField                       = new ObservableCollection <TaxTotalType>();
     this.paymentAlternativeExchangeRateField = new ExchangeRateType();
     this.paymentExchangeRateField            = new ExchangeRateType();
     this.pricingExchangeRateField            = new ExchangeRateType();
     this.taxExchangeRateField                = new ExchangeRateType();
     this.allowanceChargeField                = new ObservableCollection <AllowanceChargeType>();
     this.prepaidPaymentField                 = new ObservableCollection <PaymentType>();
     this.paymentTermsField                   = new ObservableCollection <PaymentTermsType>();
     this.paymentMeansField                   = new ObservableCollection <PaymentMeansType>();
     this.taxRepresentativePartyField         = new PartyType();
     this.payeePartyField                     = new PartyType();
     this.accountingCustomerPartyField        = new CustomerPartyType();
     this.accountingSupplierPartyField        = new SupplierPartyType();
     this.signatureField                      = new ObservableCollection <SignatureType>();
     this.additionalDocumentReferenceField    = new ObservableCollection <DocumentReferenceType>();
     this.reminderPeriodField                 = new ObservableCollection <PeriodType>();
     this.lineCountNumericField               = new LineCountNumericType();
     this.accountingCostField                 = new AccountingCostType();
     this.accountingCostCodeField             = new AccountingCostCodeType();
     this.paymentAlternativeCurrencyCodeField = new PaymentAlternativeCurrencyCodeType();
     this.paymentCurrencyCodeField            = new PaymentCurrencyCodeType();
     this.pricingCurrencyCodeField            = new PricingCurrencyCodeType();
     this.taxCurrencyCodeField                = new TaxCurrencyCodeType();
     this.documentCurrencyCodeField           = new DocumentCurrencyCodeType();
     this.taxPointDateField                   = new TaxPointDateType();
     this.noteField = new ObservableCollection <NoteType>();
     this.reminderSequenceNumericField = new ReminderSequenceNumericType();
     this.reminderTypeCodeField        = new ReminderTypeCodeType();
     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>();
 }
Beispiel #10
0
        void LlenarMontosTotales(En_ComprobanteElectronico Comprobante, ref InvoiceType invoice)
        {
            MonetaryTotalType oTotal = new MonetaryTotalType
            {
                LineExtensionAmount = new LineExtensionAmountType
                {
                    Value      = Comprobante.TotalValorVenta,
                    currencyID = Comprobante.Moneda.Trim()
                },
                TaxInclusiveAmount = new TaxInclusiveAmountType
                {
                    Value      = Comprobante.TotalPrecioVenta,
                    currencyID = Comprobante.Moneda.Trim()
                },
                PayableAmount = new PayableAmountType
                {
                    Value      = Comprobante.ImporteTotal,
                    currencyID = Comprobante.Moneda.Trim()
                }
            };

            if (Comprobante.TotalCargo > 0)
            {
                ChargeTotalAmountType oChargeTotalAmount = new ChargeTotalAmountType
                {
                    Value      = Comprobante.TotalCargo,
                    currencyID = Comprobante.Moneda.Trim()
                };
                oTotal.ChargeTotalAmount = oChargeTotalAmount;
            }

            if (Comprobante.TotalDescuento > 0)
            {
                AllowanceTotalAmountType oAllowanceTotalAmount = new AllowanceTotalAmountType
                {
                    Value      = Comprobante.TotalDescuento,
                    currencyID = Comprobante.Moneda.Trim()
                };
                oTotal.AllowanceTotalAmount = oAllowanceTotalAmount;
            }

            invoice.LegalMonetaryTotal = oTotal;
        }
Beispiel #11
0
        //Valores totales del documento
        #region LegalMonetaryTotal
        private MonetaryTotalType MonetaryTotal()
        {
            MonetaryTotalType legalMonetaryTotal = new MonetaryTotalType()
            {
                //Total valor de venta
                LineExtensionAmount = new LineExtensionAmountType
                {
                    Value      = Convert.ToDecimal(100),
                    currencyID = ConstantesAtributo.PEN
                },
                //Total precio de venta (incluye impuestos)
                TaxInclusiveAmount = new TaxInclusiveAmountType
                {
                    Value      = Convert.ToDecimal(99),
                    currencyID = ConstantesAtributo.PEN
                },
                //Monto total de Descuentos
                AllowanceTotalAmount = new AllowanceTotalAmountType
                {
                    Value      = Convert.ToDecimal(80),
                    currencyID = ConstantesAtributo.PEN
                },
                //Otros Cargos del Comprobante
                ChargeTotalAmount = new ChargeTotalAmountType
                {
                    Value      = Convert.ToDecimal(70),
                    currencyID = ConstantesAtributo.PEN
                },
                //Total de Anticipos
                PrepaidAmount = new PrepaidAmountType
                {
                    Value      = 0,
                    currencyID = ConstantesAtributo.PEN
                },
                //Importe total de la venta
                PayableAmount = new PayableAmountType
                {
                    Value = Convert.ToDecimal(50),
                }
            };

            return(legalMonetaryTotal);
        }
Beispiel #12
0
 public InvoiceType()
 {
     this._invoiceLine        = new List <InvoiceLineType>();
     this._legalMonetaryTotal = new MonetaryTotalType();
     //this._withholdingTaxTotal = new List<TaxTotalType>();
     //this._taxTotal = new List<TaxTotalType>();
     //this._paymentAlternativeExchangeRate = new ExchangeRateType();
     //this._paymentExchangeRate = new ExchangeRateType();
     //this._pricingExchangeRate = new ExchangeRateType();
     //this._taxExchangeRate = new ExchangeRateType();
     //this._allowanceCharge = new List<AllowanceChargeType>();
     //this._paymentTerms = new PaymentTermsType();
     //this._paymentMeans = new List<PaymentMeansType>();
     //this._delivery = new List<DeliveryType>();
     //this._taxRepresentativeParty = new PartyType();
     //this._sellerSupplierParty = new SupplierPartyType();
     //this._buyerCustomerParty = new CustomerPartyType();
     this._accountingCustomerParty = new CustomerPartyType();
     this._accountingSupplierParty = new SupplierPartyType();
     this._signature = new List <SignatureType>();
     //this._additionalDocumentReference = new List<DocumentReferenceType>();
     //this._contractDocumentReference = new List<DocumentReferenceType>();
     //this._originatorDocumentReference = new List<DocumentReferenceType>();
     //this._receiptDocumentReference = new List<DocumentReferenceType>();
     //this._despatchDocumentReference = new List<DocumentReferenceType>();
     //this._billingReference = new List<BillingReferenceType>();
     //this._orderReference = new OrderReferenceType();
     this._invoicePeriod    = new PeriodType();
     this._lineCountNumeric = new LineCountNumericType();
     //this._accountingCost = new AccountingCostType();
     //this._paymentAlternativeCurrencyCode = new PaymentAlternativeCurrencyCodeType();
     //this._paymentCurrencyCode = new PaymentCurrencyCodeType();
     //this._pricingCurrencyCode = new PricingCurrencyCodeType();
     //this._taxCurrencyCode = new TaxCurrencyCodeType();
     this._documentCurrencyCode = new DocumentCurrencyCodeType();
     //this._note = new List<NoteType>();
     this._invoiceTypeCode = new InvoiceTypeCodeType();
     this._issueTime       = new IssueTimeType();
     this._issueDate       = new IssueDateType();
     this._uUID            = new UUIDType();
     this._copyIndicator   = new CopyIndicatorType();
     this._id = new IDType();
 }
Beispiel #13
0
        private void button1_Click(object sender, EventArgs e)
        {
            SignatureType[] signatureCac = new SignatureType[]
            {
                new SignatureType()
                {
                    ID = new IDType {
                        Value = "LlamaSign"
                    },
                    SignatoryParty = new PartyType
                    {
                        PartyIdentification = new PartyIdentificationType[]
                        {
                            new PartyIdentificationType
                            {
                                ID = new IDType
                                {
                                    schemeID = "20600695771",
                                    Value    = "20600695771"
                                }
                            }
                        },
                        PartyName = new PartyNameType[]
                        {
                            new PartyNameType
                            {
                                Name = new NameType1 {
                                    Value = "LLAMA.PE SA"
                                }
                            }
                        }
                    },
                    DigitalSignatureAttachment = new AttachmentType
                    {
                        ExternalReference = new ExternalReferenceType
                        {
                            URI = new URIType {
                                Value = "#LlamaSign"
                            }
                        }
                    }
                }
            };


            SupplierPartyType accountingSupplierParty = new SupplierPartyType()
            {
                Party = new PartyType
                {
                    PartyLegalEntity = new PartyLegalEntityType[]
                    {
                        new PartyLegalEntityType
                        {
                            RegistrationName = new RegistrationNameType
                            {
                                Value = "LLAMA.PE SA"
                            },
                        }
                    },
                    PartyName = new PartyNameType[]
                    {
                        new PartyNameType
                        {
                            Name = new NameType1 {
                                Value = "LLAMA.PE SA"
                            }
                        }
                    },
                    PostalAddress = new AddressType
                    {
                        ID = new IDType {
                            Value = "0001"
                        },
                        District = new DistrictType {
                            Value = "a"
                        },
                        CityName = new CityNameType {
                            Value = "a"
                        },
                        StreetName = new StreetNameType {
                            Value = ""
                        },
                        CitySubdivisionName = new CitySubdivisionNameType {
                            Value = ""
                        },
                        Country = new CountryType
                        {
                            IdentificationCode = new IdentificationCodeType {
                                Value = "aaa"
                            }
                        },
                        CountrySubentity = new CountrySubentityType {
                            Value = ""
                        },
                    }
                },
                AdditionalAccountID = new AdditionalAccountIDType[]
                {
                    new AdditionalAccountIDType {
                        Value = "20553510661"
                    }
                },
                CustomerAssignedAccountID = new CustomerAssignedAccountIDType {
                    Value = "20553510661"
                }
            };

            CustomerPartyType accountingCustomerParty = new CustomerPartyType()
            {
                Party = new PartyType
                {
                    PartyLegalEntity = new PartyLegalEntityType[]
                    {
                        new PartyLegalEntityType
                        {
                            RegistrationName = new RegistrationNameType
                            {
                                Value = "TU CLIENTE SAC",
                            }
                        }
                    },
                    PartyName = new PartyNameType[]
                    {
                        new PartyNameType
                        {
                            Name = new NameType1 {
                                Value = "LLAMA.PE S.A."
                            }
                        }
                    },
                    PostalAddress = new AddressType
                    {
                        ID = new IDType {
                            Value = "0001"
                        },
                        District = new DistrictType {
                            Value = "a"
                        },
                        CityName = new CityNameType {
                            Value = "a"
                        },
                        StreetName = new StreetNameType {
                            Value = ""
                        },
                        CitySubdivisionName = new CitySubdivisionNameType {
                            Value = ""
                        },
                        Country = new CountryType
                        {
                            IdentificationCode = new IdentificationCodeType {
                                Value = "aaa"
                            }
                        },
                        CountrySubentity = new CountrySubentityType {
                            Value = ""
                        },
                    }
                },
                AdditionalAccountID = new AdditionalAccountIDType[]
                {
                    new AdditionalAccountIDType {
                        Value = "20000000001"
                    }
                },
                CustomerAssignedAccountID = new CustomerAssignedAccountIDType {
                    Value = "20000000001"
                }
            };
            //AccountingCustomerParty
            List <TaxTotalType> taxTotal = new List <TaxTotalType>()
            {
                new TaxTotalType()
                {
                    TaxAmount = new TaxAmountType {
                        currencyID = "PEN", Value = Convert.ToDecimal(7891.2)
                    },
                    TaxSubtotal = new TaxSubtotalType[]
                    {
                        new TaxSubtotalType
                        {
                            TaxAmount = new TaxAmountType {
                                currencyID = "PEN", Value = Convert.ToDecimal(7891.2)
                            },
                            TaxableAmount = new TaxableAmountType {
                                Value = Convert.ToDecimal(43840.00)
                            },
                            TaxCategory = new TaxCategoryType
                            {
                                ID = new IDType {
                                    Value = "S"
                                },
                                TierRange = new TierRangeType {
                                    Value = "s"
                                },
                                TaxExemptionReasonCode = new TaxExemptionReasonCodeType
                                {
                                    Value = ""
                                },
                                TaxScheme = new TaxSchemeType
                                {
                                    ID = new IDType {
                                        Value = "1000"
                                    },
                                    Name = new NameType1 {
                                        Value = "IGV"
                                    },
                                    TaxTypeCode = new TaxTypeCodeType {
                                        Value = "VAT"
                                    }
                                }
                            },
                            Percent = new PercentType1 {
                                Value = 18
                            }
                        }
                    },
                }
            };
            MonetaryTotalType legalMonetaryTotal = new MonetaryTotalType()
            {
                PayableAmount = new PayableAmountType {
                    currencyID = "PEN", Value = 15485
                },
                AllowanceTotalAmount = new AllowanceTotalAmountType {
                    currencyID = "PEN", Value = 15424
                },
                ChargeTotalAmount = new ChargeTotalAmountType {
                    currencyID = "PEN", Value = 5555
                }
            };
            XmlDocument xmlDoc     = new XmlDocument();
            XmlElement  xmlElement = xmlDoc.CreateElement("AdditionalInformation", "urn:sunat:names:specification:ubl:peru:schema:xsd:SunatAggregateComponents-1");

            UBLExtensionType[] uBLExtensions = new UBLExtensionType[]
            {
                new UBLExtensionType
                {
                    ExtensionContent = xmlElement
                },
                new UBLExtensionType()
                {
                    ExtensionContent = xmlElement
                },
                //Extension1 = new UBLExtension { ExtensionContent = new ExtensionContent { AdditionalInformation = new AdditionalInformation { AdditionalMonetaryTotals = new List<AdditionalMonetaryTotal>(), SunatTransaction = new SunatTransaction(), AdditionalProperties = new List<AdditionalProperty>() } } },
                //Extension2 = new UBLExtension { ExtensionContent = new ExtensionContent { AdditionalInformation = new AdditionalInformation { AdditionalMonetaryTotals = new List<AdditionalMonetaryTotal>(), SunatTransaction = new SunatTransaction(), AdditionalProperties = new List<AdditionalProperty>() } } },
            };

            Invoice invoice = new Invoice()
            {
                UBLExtensions = uBLExtensions,
                UBLVersionID  = new UBLVersionIDType
                {
                    Value = "2.1"
                },
                ID = new IDType
                {
                    Value = "F001-1"
                },
                CustomizationID = new CustomizationIDType
                {
                    Value = "2.0"
                },
                IssueDate = new IssueDateType
                {
                    Value = Convert.ToDateTime("2017-05-14 15:42:20")
                },
                IssueTime = new IssueTimeType
                {
                    Value = Convert.ToDateTime("2017-05-14 15:42:20"),
                },
                DueDate = new DueDateType
                {
                    Value = Convert.ToDateTime("2017-05-15 15:42:20"),
                },
                InvoiceTypeCode = new InvoiceTypeCodeType
                {
                    Value = "01"
                },
                Note = new List <NoteType>
                {
                    new NoteType {
                        Value = "SETENTA Y UN MIL TRESCIENTOS CINCUENTICUATRO Y 99/100"
                    }
                }.ToArray(),
                    DocumentCurrencyCode = new DocumentCurrencyCodeType
                {
                    Value = "PEN"
                },
                    LineCountNumeric = new LineCountNumericType
                {
                    Value = 1
                },
                    Signature = signatureCac,
                    AccountingSupplierParty = accountingSupplierParty,
                    AccountingCustomerParty = accountingCustomerParty,
                    TaxTotal           = taxTotal.ToArray(),
                    LegalMonetaryTotal = legalMonetaryTotal,
                    ProfileID          = new ProfileIDType
                {
                    Value = "0101"
                },
                    OrderReference = new OrderReferenceType
                {
                    ID = new IDType
                    {
                        Value = ""
                    }
                }
            };

            //XmlSerializer serializer = new XmlSerializer(typeof(Invoice));
            //FileStream fStream = File.Open(@"D:\XML.xml", FileMode.Create);

            //XmlWriter xmlWriter = new XmlTextWriter(fStream, Encoding.Unicode);

            //serializer.Serialize(xmlWriter, invoice);

            //fStream.Close();

            XmlSerializer xmlSerializer = new XmlSerializer(typeof(Invoice));

            using (Stream stream = new FileStream(@"D:\XML.xml", FileMode.Create))

                using (XmlWriter xmlWriter = new XmlTextWriter(stream, Encoding.Unicode))
                {
                    xmlSerializer.Serialize(xmlWriter, invoice);
                }
        }
 public void SetLegalMonetaryTotal(MonetaryTotalType legalMonetoryTotal)
 {
     baseInvoiceUBL.LegalMonetaryTotal = legalMonetoryTotal;
 }
 /// <summary>
 /// Toplam parasal değerler
 /// </summary>
 public virtual void SetLegalMonetaryTotal(MonetaryTotalType legalMonetoryTotal)
 {
     BaseUBL.LegalMonetaryTotal = legalMonetoryTotal;
 }