Example #1
0
        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());
        }
Example #3
0
        TaxSubtotalType LlenarSubTotalDetalle(decimal MontoBase, decimal MontoTotalImpuesto, string Moneda, decimal PorcentajeImpuesto, string CodigoInternacionalTributo, string NombreTributo, string CodigoTributo, string AfectacionIGV)
        {
            TaxSubtotalType oSubtotal = new TaxSubtotalType
            {
                TaxableAmount = new TaxableAmountType
                {
                    Value      = MontoBase,
                    currencyID = Moneda
                },
                TaxAmount = new TaxAmountType
                {
                    Value      = MontoTotalImpuesto,
                    currencyID = Moneda
                },
                TaxCategory = new TaxCategoryType
                {
                    Percent = new PercentType1
                    {
                        Value = PorcentajeImpuesto
                    },
                    TaxExemptionReasonCode = new TaxExemptionReasonCodeType
                    {
                        listAgencyName = "PE:SUNAT",
                        listName       = "Afectacion del IGV",
                        listURI        = "urn:pe:gob:sunat:cpe:see:gem:catalogos:catalogo07",
                        Value          = AfectacionIGV
                    },
                    TaxScheme = new TaxSchemeType
                    {
                        ID = new IDType
                        {
                            schemeAgencyName = "PE:SUNAT",
                            schemeName       = "Codigo de tributos",
                            schemeURI        = "urn:pe:gob:sunat:cpe:see:gem:catalogos:catalogo05",
                            Value            = CodigoInternacionalTributo
                        },
                        Name = new NameType1
                        {
                            Value = NombreTributo
                        },
                        TaxTypeCode = new TaxTypeCodeType
                        {
                            Value = CodigoTributo
                        }
                    }
                }
            };

            return(oSubtotal);
        }
Example #4
0
        TaxSubtotalType LlenarSubTotalCabecera(decimal MontoOperaciones, decimal MontoTotalImpuesto, string Moneda, decimal PorcentajeImpuesto, string CodigoInternacionalTributo, string NombreTributo, string CodigoTributo)
        {
            TaxSubtotalType oSubtotal = new TaxSubtotalType
            {
                TaxableAmount = new TaxableAmountType
                {
                    Value      = MontoOperaciones,
                    currencyID = Moneda
                },
                TaxAmount = new TaxAmountType
                {
                    Value      = MontoTotalImpuesto,
                    currencyID = Moneda
                },
                Percent = new PercentType1
                {
                    Value = PorcentajeImpuesto
                },
                TaxCategory = new TaxCategoryType
                {
                    TaxScheme = new TaxSchemeType
                    {
                        ID = new IDType
                        {
                            schemeAgencyName = "PE:SUNAT",
                            schemeName       = "Codigo de tributos",
                            schemeURI        = "urn:pe:gob:sunat:cpe:see:gem:catalogos:catalogo05",
                            Value            = CodigoInternacionalTributo
                        },
                        Name = new NameType1
                        {
                            Value = NombreTributo
                        },
                        TaxTypeCode = new TaxTypeCodeType
                        {
                            Value = CodigoTributo
                        }
                    }
                }
            };

            return(oSubtotal);
        }
Example #5
0
        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));
        }
Example #6
0
        void LlenarDetalle(En_ComprobanteElectronico Comprobante, ref DebitNoteType debitNote)
        {
            List <DebitNoteLineType> oListaDetalle = new List <DebitNoteLineType>();

            foreach (En_ComprobanteDetalle oDet in Comprobante.ComprobanteDetalle)
            {
                List <DescriptionType> oListaDescripcion = new List <DescriptionType>();

                DescriptionType oDescripcion = new DescriptionType();
                oDescripcion.Value = oDet.Descripcion;
                oListaDescripcion.Add(oDescripcion);

                foreach (string oDes in oDet.MultiDescripcion)
                {
                    DescriptionType oDescrip = new DescriptionType();
                    oDescrip.Value = oDes.ToString();
                    oListaDescripcion.Add(oDescrip);
                }



                List <TaxSubtotalType> oListaSubtotal = new List <TaxSubtotalType>();

                foreach (En_ComprobanteDetalleImpuestos odetImpuesto in oDet.ComprobanteDetalleImpuestos)
                {
                    TaxSubtotalType oSubTotal = new TaxSubtotalType();
                    oSubTotal = LlenarSubTotalDetalle(odetImpuesto.MontoBase, odetImpuesto.MontoTotalImpuesto, Comprobante.Moneda.Trim(), odetImpuesto.Porcentaje, odetImpuesto.CodigoInternacionalTributo, odetImpuesto.NombreTributo, odetImpuesto.CodigoTributo, odetImpuesto.AfectacionIGV);
                    oListaSubtotal.Add(oSubTotal);
                }

                DebitNoteLineType oInvoiceLine = new DebitNoteLineType
                {
                    ID = new IDType
                    {
                        Value = oDet.Item.ToString()
                    },
                    DebitedQuantity = new DebitedQuantityType
                    {
                        unitCode = oDet.UnidadMedida.Trim().ToUpper(),
                        unitCodeListAgencyName = "United Nations Economic Commission for Europe",
                        unitCodeListID         = "UN/ECE rec 20",
                        Value = oDet.Cantidad
                    },
                    LineExtensionAmount = new LineExtensionAmountType
                    {
                        Value      = oDet.Total,
                        currencyID = Comprobante.Moneda.Trim()
                    },
                    PricingReference = new PricingReferenceType
                    {
                        AlternativeConditionPrice = new PriceType[] {
                            new PriceType {
                                PriceAmount = new PriceAmountType {
                                    Value      = oDet.ValorVentaUnitarioIncIgv,
                                    currencyID = Comprobante.Moneda.Trim()
                                },
                                PriceTypeCode = new PriceTypeCodeType {
                                    Value          = oDet.CodigoTipoPrecio,
                                    listAgencyName = "PE:SUNAT",
                                    listName       = "Tipo de Precio",
                                    listURI        = "urn:pe:gob:sunat:cpe:see:gem:catalogos:catalogo16"
                                }
                            }
                        }
                    },
                    TaxTotal = new TaxTotalType[] {
                        new TaxTotalType {
                            TaxAmount = new TaxAmountType {
                                Value      = oDet.ImpuestoTotal,
                                currencyID = Comprobante.Moneda.Trim()
                            },
                            TaxSubtotal = oListaSubtotal.ToArray()
                        }
                    },
                    Price = new PriceType
                    {
                        PriceAmount = new PriceAmountType
                        {
                            Value      = oDet.ValorVentaUnitario,
                            currencyID = Comprobante.Moneda.Trim()
                        }
                    },
                    Item = new ItemType
                    {
                        Description = oListaDescripcion.ToArray(),

                        SellersItemIdentification = new ItemIdentificationType
                        {
                            ID = new IDType
                            {
                                Value = oDet.Codigo
                            }
                        },
                        CommodityClassification = new CommodityClassificationType[]
                        {
                            new CommodityClassificationType {
                                CommodityCode = new CommodityCodeType
                                {
                                    listAgencyName = "GS1 US",
                                    listID         = "UNSPSC",
                                    listName       = "Item Classification",
                                    Value          = oDet.CodigoSunat
                                }
                            }
                        }
                    }
                };
                oListaDetalle.Add(oInvoiceLine);
            }
            ;
            debitNote.DebitNoteLine = oListaDetalle.ToArray();
        }
Example #7
0
        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);
        }
Example #8
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);
        }
        //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());
        }
Example #10
0
        private TaxSubtotalType[] SubTotalEkle()
        {
            List <TaxSubtotalType> Liste = new List <TaxSubtotalType>();
            string _TT_TaxableAmount     = "";
            string _TT_TaxAmount         = "";
            string _TT_TaxPercent        = "";
            string _TT_TaxableAmount_1   = "";
            string _TT_TaxAmount_1       = "";
            string _TT_TaxPercent_1      = "";
            string _TT_TaxableAmount_2   = "";
            string _TT_TaxAmount_2       = "";
            string _TT_TaxPercent_2      = "";
            string _TT_TaxableAmount_3   = "";
            string _TT_TaxAmount_3       = "";
            string _TT_TaxPercent_3      = "";
            string _TT_TaxableAmount_4   = "";
            string _TT_TaxAmount_4       = "";
            string _TT_TaxPercent_4      = "";
            string _TT_TaxableAmount_5   = "";
            string _TT_TaxAmount_5       = "";
            string _TT_TaxPercent_5      = "";

            _TT_TaxableAmount   = Convert.ToString(_TT_TaxableAmount);
            _TT_TaxAmount       = Convert.ToString(_TT_TaxAmount);
            _TT_TaxPercent      = Convert.ToString(_TT_TaxPercent);
            _TT_TaxableAmount_1 = Convert.ToString(_TT_TaxableAmount_1);
            _TT_TaxAmount_1     = Convert.ToString(_TT_TaxAmount_1);
            _TT_TaxPercent_1    = Convert.ToString(_TT_TaxPercent_1);
            _TT_TaxableAmount_2 = Convert.ToString(_TT_TaxableAmount_2);
            _TT_TaxAmount_2     = Convert.ToString(_TT_TaxAmount_2);
            _TT_TaxPercent_2    = Convert.ToString(_TT_TaxPercent_2);
            _TT_TaxableAmount_3 = Convert.ToString(_TT_TaxableAmount_3);
            _TT_TaxAmount_3     = Convert.ToString(_TT_TaxAmount_3);
            _TT_TaxPercent_3    = Convert.ToString(_TT_TaxPercent_3);
            _TT_TaxableAmount_4 = Convert.ToString(_TT_TaxableAmount_4);
            _TT_TaxAmount_4     = Convert.ToString(_TT_TaxAmount_4);
            _TT_TaxPercent_4    = Convert.ToString(_TT_TaxPercent_4);
            _TT_TaxableAmount_5 = Convert.ToString(_TT_TaxableAmount_5);
            _TT_TaxAmount_5     = Convert.ToString(_TT_TaxAmount_5);
            _TT_TaxPercent_5    = Convert.ToString(_TT_TaxPercent_5);

            if (_TT_TaxAmount_1 != "0,00")
            {
                if (_TT_TaxAmount_1 != "0.00")
                {
                    TaxSubtotalType TaxSubtotal = new TaxSubtotalType()
                    {
                        TaxableAmount = new TaxableAmountType {
                            currencyID = "TRY", Value = Convert.ToDecimal(_TT_TaxableAmount_1)
                        },

                        TaxAmount = new TaxAmountType {
                            currencyID = "TRY", Value = Convert.ToDecimal(_TT_TaxAmount_1)
                        },
                        CalculationSequenceNumeric = new CalculationSequenceNumericType {
                            Value = 1
                        },
                        Percent = new PercentType1 {
                            Value = Convert.ToDecimal(_TT_TaxPercent_1)
                        },
                        TaxCategory = new TaxCategoryType
                        {
                            TaxScheme = new TaxSchemeType {
                                TaxTypeCode = new TaxTypeCodeType {
                                    Value = "0015"
                                }
                            }
                        }
                    };
                    Liste.Add(TaxSubtotal);
                }
            }
            if (_TT_TaxAmount_2 != "0,00")
            {
                if (_TT_TaxAmount_2 != "0.00")
                {
                    TaxSubtotalType TaxSubtotal = new TaxSubtotalType()
                    {
                        TaxableAmount = new TaxableAmountType {
                            currencyID = "TRY", Value = Convert.ToDecimal(_TT_TaxableAmount_2)
                        },

                        TaxAmount = new TaxAmountType {
                            currencyID = "TRY", Value = Convert.ToDecimal(_TT_TaxAmount_2)
                        },
                        CalculationSequenceNumeric = new CalculationSequenceNumericType {
                            Value = 2
                        },
                        Percent = new PercentType1 {
                            Value = Convert.ToDecimal(_TT_TaxPercent_2)
                        },
                        TaxCategory = new TaxCategoryType
                        {
                            TaxScheme = new TaxSchemeType {
                                TaxTypeCode = new TaxTypeCodeType {
                                    Value = "0015"
                                }
                            }
                        }
                    };
                    Liste.Add(TaxSubtotal);
                }
            }
            if (_TT_TaxAmount_3 != "0,00")
            {
                if (_TT_TaxAmount_3 != "0.00")
                {
                    TaxSubtotalType TaxSubtotal = new TaxSubtotalType()
                    {
                        TaxableAmount = new TaxableAmountType {
                            currencyID = "TRY", Value = Convert.ToDecimal(_TT_TaxableAmount_3)
                        },

                        TaxAmount = new TaxAmountType {
                            currencyID = "TRY", Value = Convert.ToDecimal(_TT_TaxAmount_3)
                        },
                        CalculationSequenceNumeric = new CalculationSequenceNumericType {
                            Value = 3
                        },
                        Percent = new PercentType1 {
                            Value = Convert.ToDecimal(_TT_TaxPercent_3)
                        },
                        TaxCategory = new TaxCategoryType
                        {
                            TaxScheme = new TaxSchemeType {
                                TaxTypeCode = new TaxTypeCodeType {
                                    Value = "0015"
                                }
                            }
                        }
                    };
                    Liste.Add(TaxSubtotal);
                }
            }
            if (_TT_TaxAmount_4 != "0,00")
            {
                if (_TT_TaxAmount_4 != "0.00")
                {
                    TaxSubtotalType TaxSubtotal = new TaxSubtotalType()
                    {
                        TaxableAmount = new TaxableAmountType {
                            currencyID = "TRY", Value = Convert.ToDecimal(_TT_TaxableAmount_4)
                        },

                        TaxAmount = new TaxAmountType {
                            currencyID = "TRY", Value = Convert.ToDecimal(_TT_TaxAmount_4)
                        },
                        CalculationSequenceNumeric = new CalculationSequenceNumericType {
                            Value = 4
                        },
                        Percent = new PercentType1 {
                            Value = Convert.ToDecimal(_TT_TaxPercent_4)
                        },
                        TaxCategory = new TaxCategoryType
                        {
                            TaxScheme = new TaxSchemeType {
                                TaxTypeCode = new TaxTypeCodeType {
                                    Value = "0015"
                                }
                            }
                        }
                    };
                    Liste.Add(TaxSubtotal);
                }
            }
            if (_TT_TaxAmount_5 != "0,00")
            {
                if (_TT_TaxAmount_5 != "0.00")
                {
                    TaxSubtotalType TaxSubtotal = new TaxSubtotalType()
                    {
                        TaxableAmount = new TaxableAmountType {
                            currencyID = "TRY", Value = Convert.ToDecimal(_TT_TaxableAmount_5)
                        },

                        TaxAmount = new TaxAmountType {
                            currencyID = "TRY", Value = Convert.ToDecimal(_TT_TaxAmount_5)
                        },
                        CalculationSequenceNumeric = new CalculationSequenceNumericType {
                            Value = 5
                        },
                        Percent = new PercentType1 {
                            Value = Convert.ToDecimal(_TT_TaxPercent_5)
                        },
                        TaxCategory = new TaxCategoryType
                        {
                            TaxScheme = new TaxSchemeType {
                                TaxTypeCode = new TaxTypeCodeType {
                                    Value = "0015"
                                }
                            }
                        }
                    };
                    Liste.Add(TaxSubtotal);
                }
            }
            return(Liste.ToArray());
        }