Beispiel #1
0
        public void EmitirNotaFiscal(Pedido pedido)
        {
            this.NumeroNotaFiscal = 99999;
            this.Serie            = new Random().Next(Int32.MaxValue);
            this.NomeCliente      = pedido.NomeCliente;

            this.EstadoDestino = pedido.EstadoOrigem;
            this.EstadoOrigem  = pedido.EstadoDestino;

            foreach (PedidoItem itemPedido in pedido.ItensDoPedido)
            {
                NotaFiscalItem notaFiscalItem = new NotaFiscalItem();

                //Uso padrao de Projeto Clain of Responsability, para resolver o problema de manutanção e sujeira de codigo
                CalculaCfop cfop = new CalculaCfop();
                notaFiscalItem.Cfop = cfop.ObtemCfop(pedido);

                //Centralizo para cada classe responsavel
                notaFiscalItem.AliquotaIcms = ICMS.ObtemAliquotaIcms(pedido);
                notaFiscalItem.TipoIcms     = ICMS.ObtemTipoIcms(pedido);
                notaFiscalItem.BaseIcms     = ICMS.CalculaBaseIcms(notaFiscalItem.Cfop, itemPedido.ValorItemPedido);
                notaFiscalItem.ValorIcms    = ICMS.CalculaValorIcms(notaFiscalItem);

                if (itemPedido.Brinde)
                {
                    notaFiscalItem.TipoIcms     = "60";
                    notaFiscalItem.AliquotaIcms = 0.18;
                    notaFiscalItem.ValorIcms    = notaFiscalItem.BaseIcms * notaFiscalItem.AliquotaIcms;
                }
                notaFiscalItem.NomeProduto   = itemPedido.NomeProduto;
                notaFiscalItem.CodigoProduto = itemPedido.CodigoProduto;

                // caulculo IPI
                notaFiscalItem.AliquotaIpi = IPI.CalculaAliquotaIpi(itemPedido.Brinde);
                notaFiscalItem.BaseIpi    += itemPedido.ValorItemPedido;
                notaFiscalItem.ValorIpi    = IPI.CalculaValorIpi(notaFiscalItem.BaseIpi, notaFiscalItem.AliquotaIpi);

                //Desconto Sudeste
                notaFiscalItem.Desconto = DescontosSudeste.ObtemDesconto(this.EstadoDestino);

                this.ItensDaNotaFiscal.Add(notaFiscalItem);
            }

            //Validação se persistiu xml com sucesso
            if (!Xml.Exportar(pedido))
            {
                throw new Exception("Problemas para gravar Xml");
            }

            // Salvando no Banco
            var idNota = NotaFiscalRepository.InsertNotaFiscal(this);

            foreach (var item in this.ItensDaNotaFiscal.ToList())
            {
                item.IdNotaFiscal = idNota;
                NotaFiscalRepository.InsertNotaFiscalItem(item);
            }
        }
Beispiel #2
0
        private void calcularCustos(Regra regra)
        {
            Double txComissao = 0, alq1, alq2, custo, Vd1, Vd2, Frete, federal1, federal2, ICMSD1, ICMSD2, ICMSC, alICMSC, IPI, LB1, LB2, LL1, LL2, TXFixa1, TXFixa2, comissao1, comissao2;

            custo = Convert.ToDouble(txtCusto.Text.ToString());

            alq1 = Convert.ToDouble(txtaliq1.Text.ToString());
            Vd1  = Convert.ToDouble(txtvalor1.Text.ToString());

            //Fazendo o valor 2 em relação ao desconto.
            Vd2  = (Convert.ToDouble(txtvalor1.Text.ToString()) - ((Convert.ToDouble(txtDesconto.Text.ToString()) / 100) * Convert.ToDouble(txtvalor1.Text.ToString())));
            alq2 = (((Vd2 - custo) * 100) / custo);

            txtvalor2.Text = Vd2.ToString("N");
            txtaliq2.Text  = alq2.ToString("N");

            Frete    = Convert.ToDouble(txtCusto.Text.ToString()) * ((Convert.ToDouble(txtFrete.Text.ToString())) / 100);
            federal1 = Vd1 * (regra.getFederal() / 100);
            federal2 = Vd2 * (regra.getFederal() / 100);
            alICMSC  = Convert.ToDouble(txtIcms.Text.ToString());
            IPI      = custo * (Convert.ToDouble(txtIPI.Text.ToString()) / 100);
            LB1      = custo * (alq1 / 100);
            LB2      = custo * (alq2 / 100);
            TXFixa1  = Vd1 * (regra.getTaxaDespesasFixas() / 100);
            TXFixa2  = Vd2 * (regra.getTaxaDespesasFixas() / 100);
            ICMSC    = custo * ((18 - alICMSC) / 100); // Mudar quando não usar mais aliquotas negativas para ICMSC
            //Deve-se prepara a regra para Normal e SuperSimples, neste caso só apresentarei o superSimples
            ICMSD1     = 0;
            ICMSD2     = 0;
            txComissao = (txtComissao.Text.Equals("")) ? 0 : (Convert.ToDouble(txtComissao.Text) / 100);
            comissao1  = txComissao * Vd1;
            comissao2  = txComissao * Vd2;

            LL1 = Vd1 - (custo + Frete + federal1 + IPI + ICMSC + ICMSD1 + TXFixa1 + comissao1);
            LL2 = Vd2 - (custo + Frete + federal2 + IPI + ICMSC + ICMSD2 + TXFixa2 + comissao2);

            Labfrete1.Text    = Frete.ToString("N");
            Labfrete2.Text    = Frete.ToString("N");
            LabICMS0.Text     = (ICMSC + ICMSD1).ToString("N");
            LabICMS1.Text     = (ICMSC + ICMSD2).ToString("N");
            LabFederal1.Text  = federal1.ToString("N");
            LabFederal2.Text  = federal2.ToString("N");
            LabIPI1.Text      = IPI.ToString("N");
            LabIPI2.Text      = IPI.ToString("N");
            LabLB1.Text       = LB1.ToString("N");
            LabLB2.Text       = LB2.ToString("N");
            LabFixa1.Text     = TXFixa1.ToString("N");
            LabFixa2.Text     = TXFixa2.ToString("N");
            LabLL1.Text       = (LL1 < 0)? "<font color ='red'>" + LL1.ToString("N") + "</font>" : LL1.ToString("N");
            LabLL2.Text       = (LL2 < 0) ? "<font color ='red'>" + LL2.ToString("N") + "</font>" : LL2.ToString("N");
            labComissao1.Text = comissao1.ToString("N");
            labComissao2.Text = comissao2.ToString("N");
        }
Beispiel #3
0
        static void ComDesignPattern()
        {
            Orcamento orcamento = new Orcamento(300);

            IImposto ipi = new IPI();
            IImposto iss = new ISS();

            var valorIpi = ipi.Calcular(orcamento);
            var valorIss = iss.Calcular(orcamento);

            Console.WriteLine($"Valor Orçamento: R$ {orcamento.Valor}, Valor IPI: R$ {valorIpi}, Valor ISS: R$ {valorIss}");
        }
Beispiel #4
0
        public static void Main(string[] args)
        {
            Console.WriteLine("Olá, bem-vindo!");

            string valorLido;
            double valor;
            bool   temErros;

            do
            {
                temErros = false;
                Console.Write("Digite um valor para calcular os impostos aplicados: ");
                valorLido = Console.ReadLine();
                if (!double.TryParse(valorLido, out valor))
                {
                    Console.WriteLine("Digite um valor numérico válido!");
                    temErros = true;
                }
            } while (temErros);

            Imposto icms   = new ICMS();
            Imposto ipi    = new IPI();
            Imposto cofins = new COFINS();

            double valorIcms   = icms.CalculaImposto(valor);
            double valorIpi    = ipi.CalculaImposto(valor);
            double valorCofins = cofins.CalculaImposto(valor);

            Console.WriteLine("O valor do ICMS é: {0:0.0000}", valorIcms);
            Console.WriteLine("O valor do IPI é: {0:0.0000}", valorIpi);
            if (valorCofins == 0.00)
            {
                Console.WriteLine("O COFINS não se aplica sobre esse valor");
            }
            else
            {
                Console.WriteLine("O valor do COFINS é: {0:0.0000}", valorCofins);
            }

            Console.WriteLine("------------------------------------------");
            double valorTotal = valor + valorIcms + valorIpi + valorCofins;

            Console.WriteLine("O valor total com os impostos é: {0:0.0000}", valorTotal);
        }
        public static double total()
        {
            double valor;

            Console.WriteLine("Digite um valor :");
            valor = double.Parse(Console.ReadLine());
            Console.WriteLine("");


            var    icms    = new ICMS();
            double totICms = icms.calculaImposto(valor);

            var    ipi     = new IPI();
            double totlIpi = ipi.calculaImposto(valor);

            var    imposto    = new COFINS();
            double totlCofins = imposto.calculaImposto(valor);

            double ttotalImpostos = totlCofins + totICms + totlIpi + valor;

            Console.WriteLine("Valor Final: " + ttotalImpostos);

            return(valor);
        }
Beispiel #6
0
        static void ComDesignPattern()
        {
            Orcamento orcamento = new Orcamento(500);

            Console.WriteLine($"Valor do Orcamento: R$ {orcamento.Valor}");
            Console.WriteLine();

            Imposto icms = new ICMS();
            Imposto ipi  = new IPI();
            Imposto iss  = new ISS();

            //Impostos Separados
            var valorIcms = icms.Calcular(orcamento);
            var valorIpi  = ipi.Calcular(orcamento);
            var valorIss  = iss.Calcular(orcamento);

            Console.WriteLine($"Valor do ICMS: R$ {valorIcms}");
            Console.WriteLine($"Valor do IPI: R$ {valorIpi}");
            Console.WriteLine($"Valor do ISS: R$ {valorIss}");
            Console.WriteLine();

            //Impostos Juntos
            Imposto icmsComIpi       = new ICMS(new IPI());
            Imposto ipiComIss        = new IPI(new ISS());
            Imposto icmsComIpiComIss = new ICMS(new IPI(new ISS()));

            var valorICMScomIpi       = icmsComIpi.Calcular(orcamento);
            var valorIpicomIss        = ipiComIss.Calcular(orcamento);
            var valorICMScomIpiComIss = icmsComIpiComIss.Calcular(orcamento);

            Console.WriteLine($"Valor do ICMS Com Ipi: R$ {valorICMScomIpi}");
            Console.WriteLine($"Valor do IPI com ISS: R$ {valorIpicomIss}");
            Console.WriteLine($"Valor do ICMS Com IPI e ISS: R$ {valorICMScomIpiComIss}");

            Console.ReadKey();
        }
Beispiel #7
0
        public string Run()
        {
            try
            {
                if (!string.IsNullOrEmpty(this.logo) && !File.Exists(this.logo))
                {
                    return("Arquivo de logo não localizado");
                }

                XDocument doc = XDocument.Load(arquivo);
                foreach (XElement det in doc.Descendants(ns + "det"))
                {
                    XElement imposto = det.Element(ns + "imposto");
                    XElement ICMS    = imposto.Element(ns + "ICMS");

                    if (ICMS.Element(ns + "ICMS00") == null)
                    {
                        XElement ICMS00 = new XElement(ns + "ICMS00");
                        ICMS00.Add(new XElement(ns + "CST", ""));
                        ICMS00.Add(new XElement(ns + "vBC", ""));
                        ICMS00.Add(new XElement(ns + "vICMS", ""));
                        ICMS00.Add(new XElement(ns + "pICMS", ""));

                        ICMS.Add(ICMS00);
                    }

                    if (ICMS.Element(ns + "ICMS10") == null)
                    {
                        XElement ICMS10 = new XElement(ns + "ICMS10");
                        ICMS10.Add(new XElement(ns + "CST", ""));
                        ICMS10.Add(new XElement(ns + "vBC", ""));
                        ICMS10.Add(new XElement(ns + "vICMS", ""));
                        ICMS10.Add(new XElement(ns + "pICMS", ""));

                        ICMS.Add(ICMS10);
                    }

                    if (ICMS.Element(ns + "ICMS20") == null)
                    {
                        XElement ICMS20 = new XElement(ns + "ICMS20");
                        ICMS20.Add(new XElement(ns + "CST", ""));
                        ICMS20.Add(new XElement(ns + "vBC", ""));
                        ICMS20.Add(new XElement(ns + "vICMS", ""));
                        ICMS20.Add(new XElement(ns + "pICMS", ""));

                        ICMS.Add(ICMS20);
                    }

                    if (ICMS.Element(ns + "ICMS30") == null)
                    {
                        XElement ICMS30 = new XElement(ns + "ICMS30");
                        ICMS30.Add(new XElement(ns + "CST", ""));

                        ICMS.Add(ICMS30);
                    }

                    if (ICMS.Element(ns + "ICMS40") == null)
                    {
                        XElement ICMS40 = new XElement(ns + "ICMS40");
                        ICMS40.Add(new XElement(ns + "CST", ""));

                        ICMS.Add(ICMS40);
                    }

                    if (ICMS.Element(ns + "ICMS51") == null)
                    {
                        XElement ICMS51 = new XElement(ns + "ICMS51");
                        ICMS51.Add(new XElement(ns + "CST", ""));
                        ICMS51.Add(new XElement(ns + "vBC", ""));
                        ICMS51.Add(new XElement(ns + "vICMS", ""));
                        ICMS51.Add(new XElement(ns + "pICMS", ""));

                        ICMS.Add(ICMS51);
                    }

                    if (ICMS.Element(ns + "ICMS60") == null)
                    {
                        XElement ICMS60 = new XElement(ns + "ICMS60");
                        ICMS60.Add(new XElement(ns + "CST", ""));

                        ICMS.Add(ICMS60);
                    }

                    if (ICMS.Element(ns + "ICMS70") == null)
                    {
                        XElement ICMS70 = new XElement(ns + "ICMS70");
                        ICMS70.Add(new XElement(ns + "CST", ""));
                        ICMS70.Add(new XElement(ns + "vBC", ""));
                        ICMS70.Add(new XElement(ns + "vICMS", ""));
                        ICMS70.Add(new XElement(ns + "pICMS", ""));

                        ICMS.Add(ICMS70);
                    }

                    if (ICMS.Element(ns + "ICMS90") == null)
                    {
                        XElement ICMS90 = new XElement(ns + "ICMS90");
                        ICMS90.Add(new XElement(ns + "CST", ""));
                        ICMS90.Add(new XElement(ns + "vBC", ""));
                        ICMS90.Add(new XElement(ns + "vICMS", ""));
                        ICMS90.Add(new XElement(ns + "pICMS", ""));

                        ICMS.Add(ICMS90);
                    }

                    if (ICMS.Element(ns + "ICMSPart") == null)
                    {
                        XElement ICMSPart = new XElement(ns + "ICMSPart");
                        ICMSPart.Add(new XElement(ns + "CST", ""));
                        ICMSPart.Add(new XElement(ns + "vBC", ""));
                        ICMSPart.Add(new XElement(ns + "vICMS", ""));
                        ICMSPart.Add(new XElement(ns + "pICMS", ""));

                        ICMS.Add(ICMSPart);
                    }

                    if (ICMS.Element(ns + "ICMSSN101") == null)
                    {
                        XElement ICMSSN101 = new XElement(ns + "ICMSSN101");
                        ICMSSN101.Add(new XElement(ns + "CSOSN", ""));

                        ICMS.Add(ICMSSN101);
                    }

                    if (ICMS.Element(ns + "ICMSSN102") == null)
                    {
                        XElement ICMSSN102 = new XElement(ns + "ICMSSN102");
                        ICMSSN102.Add(new XElement(ns + "CSOSN", ""));

                        ICMS.Add(ICMSSN102);
                    }

                    if (ICMS.Element(ns + "ICMSSN201") == null)
                    {
                        XElement ICMSSN201 = new XElement(ns + "ICMSSN201");
                        ICMSSN201.Add(new XElement(ns + "CSOSN", ""));

                        ICMS.Add(ICMSSN201);
                    }

                    if (ICMS.Element(ns + "ICMSSN202") == null)
                    {
                        XElement ICMSSN202 = new XElement(ns + "ICMSSN202");
                        ICMSSN202.Add(new XElement(ns + "CSOSN", ""));

                        ICMS.Add(ICMSSN202);
                    }

                    if (ICMS.Element(ns + "ICMSSN500") == null)
                    {
                        XElement ICMSSN500 = new XElement(ns + "ICMSSN500");
                        ICMSSN500.Add(new XElement(ns + "CSOSN", ""));

                        ICMS.Add(ICMSSN500);
                    }

                    if (ICMS.Element(ns + "ICMSSN900") == null)
                    {
                        XElement ICMSSN900 = new XElement(ns + "ICMSSN900");
                        ICMSSN900.Add(new XElement(ns + "CSOSN", ""));
                        ICMSSN900.Add(new XElement(ns + "vBC", ""));
                        ICMSSN900.Add(new XElement(ns + "vICMS", ""));
                        ICMSSN900.Add(new XElement(ns + "pICMS", ""));

                        ICMS.Add(ICMSSN900);
                    }

                    if (ICMS.Element(ns + "ICMSST") == null)
                    {
                        XElement ICMSST = new XElement(ns + "ICMSST");
                        ICMSST.Add(new XElement(ns + "CST", ""));

                        ICMS.Add(ICMSST);
                    }

                    if (ICMS.Element(ns + "ISSQN") == null)
                    {
                        XElement ISSQN = new XElement(ns + "ISSQN");
                        ISSQN.Add(new XElement(ns + "ISSQN", ""));

                        ICMS.Add(ISSQN);
                    }

                    XElement IPI = imposto.Element(ns + "IPI");
                    if (IPI == null)
                    {
                        IPI = new XElement(ns + "IPI");
                        imposto.Add(IPI);
                    }
                    if (IPI.Element(ns + "IPITrib") == null)
                    {
                        XElement IPITrib = new XElement(ns + "IPITrib");
                        IPITrib.Add(new XElement(ns + "pIPI", "0.00"));
                        IPITrib.Add(new XElement(ns + "vIPI", "0.00"));
                        IPI.Add(IPITrib);
                    }

                    if (det.Element(ns + "infAdProd") == null)
                    {
                        det.Add(new XElement(ns + "infAdProd", ""));
                    }
                }

                DataSet ds = new DataSet();
                ds.ReadXml(doc.CreateReader());

                if (ds.Tables["ide"].Columns["dSaiEnt"] == null)
                {
                    ds.Tables["ide"].Columns.Add("dSaiEnt");
                }
                if (ds.Tables["ide"].Columns["hSaiEnt"] == null)
                {
                    ds.Tables["ide"].Columns.Add("hSaiEnt");
                }

                if (ds.Tables["emit"].Columns["CPF"] == null)
                {
                    ds.Tables["emit"].Columns.Add("CPF");
                }
                if (ds.Tables["emit"].Columns["CNPJ"] == null)
                {
                    ds.Tables["emit"].Columns.Add("CNPJ");
                }
                if (ds.Tables["emit"].Columns["IEST"] == null)
                {
                    ds.Tables["emit"].Columns.Add("IEST");
                }

                if (ds.Tables["enderEmit"].Columns["xCpl"] == null)
                {
                    ds.Tables["enderEmit"].Columns.Add("xCpl");
                }
                if (ds.Tables["enderEmit"].Columns["CEP"] == null)
                {
                    ds.Tables["enderEmit"].Columns.Add("CEP");
                }
                if (ds.Tables["enderEmit"].Columns["fone"] == null)
                {
                    ds.Tables["enderEmit"].Columns.Add("fone");
                }

                if (ds.Tables["dest"].Columns["CPF"] == null)
                {
                    ds.Tables["dest"].Columns.Add("CPF");
                }
                if (ds.Tables["dest"].Columns["CNPJ"] == null)
                {
                    ds.Tables["dest"].Columns.Add("CNPJ");
                }
                if (ds.Tables["dest"].Columns["email"] == null)
                {
                    ds.Tables["dest"].Columns.Add("email");
                }

                if (ds.Tables["enderDest"].Columns["xCpl"] == null)
                {
                    ds.Tables["enderDest"].Columns.Add("xCpl");
                }
                if (ds.Tables["enderDest"].Columns["CEP"] == null)
                {
                    ds.Tables["enderDest"].Columns.Add("CEP");
                }
                if (ds.Tables["enderDest"].Columns["fone"] == null)
                {
                    ds.Tables["enderDest"].Columns.Add("fone");
                }

                if (ds.Tables["ISSQNTot"] == null)
                {
                    ds.Tables.Add("ISSQNTot");
                }
                if (ds.Tables["retTrib"] == null)
                {
                    ds.Tables.Add("retTrib");
                }

                if (ds.Tables["transporta"] == null)
                {
                    ds.Tables.Add("transporta");
                }
                if (ds.Tables["transporta"].Columns["CPF"] == null)
                {
                    ds.Tables["transporta"].Columns.Add("CPF");
                }
                if (ds.Tables["transporta"].Columns["CNPJ"] == null)
                {
                    ds.Tables["transporta"].Columns.Add("CNPJ");
                }
                if (ds.Tables["transporta"].Columns["IE"] == null)
                {
                    ds.Tables["transporta"].Columns.Add("IE");
                }
                if (ds.Tables["transporta"].Columns["xNome"] == null)
                {
                    ds.Tables["transporta"].Columns.Add("xNome");
                }
                if (ds.Tables["transporta"].Columns["xEnder"] == null)
                {
                    ds.Tables["transporta"].Columns.Add("xEnder");
                }
                if (ds.Tables["transporta"].Columns["xMun"] == null)
                {
                    ds.Tables["transporta"].Columns.Add("xMun");
                }
                if (ds.Tables["transporta"].Columns["UF"] == null)
                {
                    ds.Tables["transporta"].Columns.Add("UF");
                }

                if (ds.Tables["veicTransp"] == null)
                {
                    ds.Tables.Add("veicTransp");
                }
                if (ds.Tables["veicTransp"].Columns["RNTC"] == null)
                {
                    ds.Tables["veicTransp"].Columns.Add("RNTC");
                }

                if (ds.Tables["vol"] == null)
                {
                    ds.Tables.Add("vol");
                }
                if (ds.Tables["vol"].Columns["qVol"] == null)
                {
                    ds.Tables["vol"].Columns.Add("qVol");
                }
                if (ds.Tables["vol"].Columns["esp"] == null)
                {
                    ds.Tables["vol"].Columns.Add("esp");
                }
                if (ds.Tables["vol"].Columns["marca"] == null)
                {
                    ds.Tables["vol"].Columns.Add("marca");
                }
                if (ds.Tables["vol"].Columns["nVol"] == null)
                {
                    ds.Tables["vol"].Columns.Add("nVol");
                }
                if (ds.Tables["vol"].Columns["pesoL"] == null)
                {
                    ds.Tables["vol"].Columns.Add("pesoL");
                }
                if (ds.Tables["vol"].Columns["pesoB"] == null)
                {
                    ds.Tables["vol"].Columns.Add("pesoB");
                }

                if (ds.Tables["cobr"] == null)
                {
                    ds.Tables.Add("cobr");
                }
                if (ds.Tables["fat"] == null)
                {
                    ds.Tables.Add("fat");
                }
                if (ds.Tables["dup"] == null)
                {
                    ds.Tables.Add("dup");
                    ds.Tables["dup"].Columns.Add("nDup");
                    ds.Tables["dup"].Columns.Add("dVenc");
                }

                if (ds.Tables["infAdic"] == null)
                {
                    ds.Tables.Add("infAdic");
                }
                if (ds.Tables["infAdic"].Columns["infCpl"] == null)
                {
                    ds.Tables["infAdic"].Columns.Add("infCpl");
                }
                if (ds.Tables["infAdic"].Columns["infAdFisco"] == null)
                {
                    ds.Tables["infAdic"].Columns.Add("infAdFisco");
                }

                if (ds.Tables["obsCont"] == null)
                {
                    ds.Tables.Add("obsCont");
                }
                if (ds.Tables["obsFisco"] == null)
                {
                    ds.Tables.Add("obsFisco");
                }

                string       pdf     = this.arquivo.Replace("-procNFe.xml", "-danfe.pdf");
                ImageDataSet imageds = new ImageDataSet();

                imageds.Images.AddImagesRow(Logo(), Barras(ds.Tables["infProt"].Columns["chNFe"].Table.Rows[0][2] as string));

                if (string.IsNullOrEmpty(this.logo))
                {
                    VerticalNoImage vertical = new VerticalNoImage();
                    vertical.Load(Path.Combine(Environment.CurrentDirectory, "VerticalNoImage.rpt"), OpenReportMethod.OpenReportByDefault);
                    vertical.SetDataSource(ds);

                    vertical.Database.Tables["Images"].SetDataSource(imageds);
                    vertical.ExportToDisk(ExportFormatType.PortableDocFormat, pdf);
                }
                else
                {
                    Vertical vertical = new Vertical();
                    vertical.Load(Path.Combine(Environment.CurrentDirectory, "Vertical.rpt"), OpenReportMethod.OpenReportByDefault);
                    vertical.SetDataSource(ds);

                    vertical.Database.Tables["Images"].SetDataSource(imageds);
                    vertical.ExportToDisk(ExportFormatType.PortableDocFormat, pdf);
                }

                Process process = new Process();
                process.StartInfo.FileName    = pdf;
                process.StartInfo.ErrorDialog = true;

                process.Start();
            }
            catch (FileNotFoundException ex)
            {
                return("Documento xml não localizado.");
            }
            catch (Exception ex)
            {
                return(ex.ToString());
            }

            return("");
        }