Пример #1
0
        private void ProcessarMovimentacoesTransporteComunicacao()
        {
            this.UpdateStatusAsynchronousExecution("Iniciando processamento de movimentações de transporte e comunicação");

            this.ProcessarConhecimentosTransporte();
            this.ProcessarNotasFiscaisServicosComunicacao();

            RegistroD001 regD001 = new RegistroD001();

            if (DadosArquivoFiscalService.BlocoPossuiRegistros("D"))
            {
                regD001.IND_MOV = "0";
            }
            else
            {
                regD001.IND_MOV = "1";
            }

            DadosArquivoFiscalService.PersistirRegistro(regD001);
            this.UpdateStatusAsynchronousExecution("Gerando Registro D001");

            RegistroD990 regD990 = DadosArquivoFiscalService.GetRegistroD990();

            DadosArquivoFiscalService.PersistirRegistro(regD990);
            this.UpdateStatusAsynchronousExecution("Gerando Registro D990");
        }
Пример #2
0
        private void ProcessarDocumentosFiscaisMercadorias()
        {
            this.UpdateStatusAsynchronousExecution("Iniciando processamento de documentos fiscais");

            this.ProcessarNotasFiscaisMercadorias();
            this.ProcessarCuponsFiscais();
            this.ProcessarNotasFiscaisEnergiaAguaGas();

            // Monta o registro de abertura do bloco, verificando se realmente existem
            // movimentações para o período especificado
            this.UpdateStatusAsynchronousExecution("Gerando Registro C001");
            RegistroC001 regC001 = new RegistroC001();

            if (DadosArquivoFiscalService.BlocoPossuiRegistros("C"))
            {
                regC001.IND_MOV = "0";
            }
            else
            {
                regC001.IND_MOV = "1";
            }
            DadosArquivoFiscalService.PersistirRegistro(regC001);

            this.UpdateStatusAsynchronousExecution("Gerando Registro C990");
            RegistroC990 regC990 = DadosArquivoFiscalService.GetRegistroC990();

            DadosArquivoFiscalService.PersistirRegistro(regC990);
        }
Пример #3
0
        private void ProcessarInventarioFisico()
        {
            // Nesta primeira versão isto ainda não será implementado; levantar posteriormente
            // se isto realmente é necessário
            this.UpdateStatusAsynchronousExecution("Iniciando processamento de movimentações de transporte e comunicação");

            IEnumerable <RegistroH005> registrosH005 =
                InventarioService.GetRegistrosH005();

            foreach (RegistroH005 regH005 in registrosH005)
            {
                this.UpdateStatusAsynchronousExecution("Gerando Registro H005");
                DadosArquivoFiscalService.PersistirRegistro(regH005);

                // Processsa informações dos itens da nota fiscal
                this.UpdateStatusAsynchronousExecution("Processando itens de documento fiscal");
                IEnumerable <RegistroH010> registrosH010 =
                    InventarioService.GetRegistrosH010(regH005.DT_INV.Value);
                foreach (RegistroH010 regH010 in registrosH010)
                {
                    this.UpdateStatusAsynchronousExecution("Gerando Registro H010");
                    DadosArquivoFiscalService.PersistirRegistro(regH010);

                    this.ProcessarUnidade(regH010.UNID);
                    this.ProcessarProduto(regH010.COD_ITEM);
                    this.ProcessarParticipante(regH010.COD_PART);
                }
            }

            // Monta o registro de abertura do bloco, verificando se realmente existem
            // movimentações para o período especificado
            this.UpdateStatusAsynchronousExecution("Gerando Registro H001");
            RegistroH001 regH001 = new RegistroH001();

            if (DadosArquivoFiscalService.BlocoPossuiRegistros("H"))
            {
                regH001.IND_MOV = "0";
            }
            else
            {
                regH001.IND_MOV = "1";
            }
            DadosArquivoFiscalService.PersistirRegistro(regH001);

            RegistroH990 regH990 = DadosArquivoFiscalService.GetRegistroH990();

            DadosArquivoFiscalService.PersistirRegistro(regH990);
            this.UpdateStatusAsynchronousExecution("Gerando Registro H990");
        }
Пример #4
0
        private void ProcessarOutrasInformacoes()
        {
            // Nesta primeira versão isto ainda não será implementado; levantar posteriormente
            // se isto realmente é necessário
            this.UpdateStatusAsynchronousExecution("Iniciando processamento de outras informações");

            this.UpdateStatusAsynchronousExecution("Gerando Registro 1010");
            Registro1010 reg1010 = OutrasInformacoesService.GetRegistro1010();

            DadosArquivoFiscalService.PersistirRegistro(reg1010);

            IEnumerable <Registro1105> registros1105;
            IEnumerable <Registro1110> registros1110;
            IEnumerable <Registro1100> registros1100 =
                OutrasInformacoesService.GetRegistros1100();

            foreach (Registro1100 reg1100 in registros1100)
            {
                this.UpdateStatusAsynchronousExecution("Gerando Registro 1100");
                DadosArquivoFiscalService.PersistirRegistro(reg1100);

                registros1105 = OutrasInformacoesService.GetRegistros1105(
                    reg1100.NRO_DE);
                foreach (Registro1105 reg1105 in registros1105)
                {
                    this.UpdateStatusAsynchronousExecution("Gerando Registro 1105");
                    DadosArquivoFiscalService.PersistirRegistro(reg1105);

                    this.ProcessarProduto(reg1105.COD_ITEM);

                    registros1110 = OutrasInformacoesService.GetRegistros1110(
                        reg1105.PK_NOTAFIS);
                    foreach (Registro1110 reg1110 in registros1110)
                    {
                        this.UpdateStatusAsynchronousExecution("Gerando Registro 1110");
                        DadosArquivoFiscalService.PersistirRegistro(reg1110);

                        this.ProcessarParticipante(reg1110.COD_PART);
                        this.ProcessarUnidade(reg1110.UNID);
                    }
                }
            }

            IEnumerable <Registro1210> registros1210;
            IEnumerable <Registro1200> registros1200 =
                OutrasInformacoesService.GetRegistros1200();

            foreach (Registro1200 reg1200 in registros1200)
            {
                this.UpdateStatusAsynchronousExecution("Gerando Registro 1200");
                DadosArquivoFiscalService.PersistirRegistro(reg1200);

                registros1210 = OutrasInformacoesService.GetRegistros1210(
                    reg1200.COD_AJ_APUR);
                foreach (Registro1210 reg1210 in registros1210)
                {
                    this.UpdateStatusAsynchronousExecution("Gerando Registro 1210");
                    DadosArquivoFiscalService.PersistirRegistro(reg1210);
                }
            }

            IEnumerable <Registro1400> registros1400 =
                OutrasInformacoesService.GetRegistros1400();

            foreach (Registro1400 reg1400 in registros1400)
            {
                this.UpdateStatusAsynchronousExecution("Gerando Registro 1400");
                DadosArquivoFiscalService.PersistirRegistro(reg1400);

                this.ProcessarProduto(reg1400.COD_ITEM);
            }

            IEnumerable <Registro1600> registros1600 =
                OutrasInformacoesService.GetRegistros1600();

            foreach (Registro1600 reg1600 in registros1600)
            {
                this.UpdateStatusAsynchronousExecution("Gerando Registro 1600");
                DadosArquivoFiscalService.PersistirRegistro(reg1600);

                this.ProcessarParticipante(reg1600.COD_PART);
            }

            IEnumerable <Registro1710> registros1710;
            IEnumerable <Registro1700> registros1700 =
                OutrasInformacoesService.GetRegistros1700();

            foreach (Registro1700 reg1700 in registros1700)
            {
                this.UpdateStatusAsynchronousExecution("Gerando Registro 1700");
                DadosArquivoFiscalService.PersistirRegistro(reg1700);

                registros1710 = OutrasInformacoesService.GetRegistros1710(
                    reg1700.COD_DISP, reg1700.COD_MOD, reg1700.SER, reg1700.SUB);
                foreach (Registro1710 reg1710 in registros1710)
                {
                    this.UpdateStatusAsynchronousExecution("Gerando Registro 1710");
                    DadosArquivoFiscalService.PersistirRegistro(reg1710);
                }
            }

            Registro1001 reg1001 = new Registro1001();

            if (DadosArquivoFiscalService.BlocoPossuiRegistros("E"))
            {
                reg1001.IND_MOV = "0";
            }
            else
            {
                reg1001.IND_MOV = "1";
            }
            DadosArquivoFiscalService.PersistirRegistro(reg1001);
            this.UpdateStatusAsynchronousExecution("Gerando Registro 1001");

            Registro1990 reg1990 = DadosArquivoFiscalService.GetRegistro1990();

            DadosArquivoFiscalService.PersistirRegistro(reg1990);
            this.UpdateStatusAsynchronousExecution("Gerando Registro 1990");
        }
Пример #5
0
        private void ProcessarApuracaoIcmsIPI()
        {
            // Nesta primeira versão isto ainda não será implementado; levantar posteriormente
            // se isto realmente é necessário
            this.UpdateStatusAsynchronousExecution("Iniciando processamento de apuração do ICMS e IPI");

            IEnumerable <RegistroE100> registrosE100;

            registrosE100 = ApuracaoServices.GetRegistrosE100();
            RegistroE110 registroE110;
            IEnumerable <RegistroE111> registrosE111;
            IEnumerable <RegistroE116> registrosE116;

            foreach (RegistroE100 regE100 in registrosE100)
            {
                this.UpdateStatusAsynchronousExecution("Gerando Registro E100");
                DadosArquivoFiscalService.PersistirRegistro(regE100);
                registroE110 = ApuracaoServices.GetRegistroE110(regE100.DT_INI.Value, regE100.DT_FIN.Value);
                DadosArquivoFiscalService.PersistirRegistro(registroE110);

                registrosE111 = ApuracaoServices.GetRegistrosE111(regE100.DT_INI.Value, regE100.DT_FIN.Value);

                foreach (RegistroE111 reg111 in registrosE111)
                {
                    DadosArquivoFiscalService.PersistirRegistro(reg111);
                    this.UpdateStatusAsynchronousExecution("Gerando Registro E110");
                }

                registrosE116 = ApuracaoServices.GetRegistrosE116(regE100.DT_INI.Value, regE100.DT_FIN.Value);
                foreach (RegistroE116 reg116 in registrosE116)
                {
                    DadosArquivoFiscalService.PersistirRegistro(reg116);
                    this.UpdateStatusAsynchronousExecution("Gerando Registro E116");
                }
            }

            IEnumerable <RegistroE200> registrosE200;

            registrosE200 = ApuracaoServices.GetRegistrosE200();
            RegistroE210 registroE210;
            IEnumerable <RegistroE250> registrosE250;

            foreach (RegistroE200 regE200 in registrosE200)
            {
                this.UpdateStatusAsynchronousExecution("Gerando Registro E200");
                DadosArquivoFiscalService.PersistirRegistro(regE200);
                registroE210 = ApuracaoServices.GetRegistroE210(regE200.DT_INI, regE200.DT_FIN, regE200.UF);
                DadosArquivoFiscalService.PersistirRegistro(registroE210);

                registrosE250 = ApuracaoServices.GetRegistrosE250(regE200.DT_INI, regE200.DT_FIN, regE200.UF);

                foreach (RegistroE250 reg250 in registrosE250)
                {
                    this.UpdateStatusAsynchronousExecution("Gerando Registro E250");
                    DadosArquivoFiscalService.PersistirRegistro(reg250);
                }
            }



            IEnumerable <RegistroE500> registrosE500;

            registrosE500 = ApuracaoServices.GetRegistrosE500();

            IEnumerable <RegistroE510> registrosE510;
            RegistroE520 regE520;
            IEnumerable <RegistroE530> registrosE530;

            foreach (RegistroE500 regE500 in registrosE500)
            {
                DadosArquivoFiscalService.PersistirRegistro(regE500);
                this.UpdateStatusAsynchronousExecution("Gerando Registro E500");

                registrosE510 = ApuracaoServices.GetRegistrosE510(
                    regE500.DT_INI.Value, regE500.DT_FIN.Value);
                foreach (RegistroE510 regE510 in registrosE510)
                {
                    DadosArquivoFiscalService.PersistirRegistro(regE510);
                    this.UpdateStatusAsynchronousExecution("Gerando Registro E510");
                }

                regE520 = ApuracaoServices.GetRegistroE520(
                    regE500.DT_INI.Value, regE500.DT_FIN.Value);
                DadosArquivoFiscalService.PersistirRegistro(regE520);
                this.UpdateStatusAsynchronousExecution("Gerando Registro E520");

                //registrosE530 = ApuracaoServices.GetRegistrosE530(
                //    regE500.DT_INI.Value, regE500.DT_FIN.Value);
                //foreach (RegistroE530 regE530 in registrosE530)
                //{
                //    DadosArquivoFiscalService.PersistirRegistro(regE530);
                //    this.UpdateStatusAsynchronousExecution("Gerando Registro E530");
                //}
            }

            RegistroE001 regE001 = new RegistroE001();

            if (DadosArquivoFiscalService.BlocoPossuiRegistros("E"))
            {
                regE001.IND_MOV = "0";
            }
            else
            {
                regE001.IND_MOV = "1";
            }
            DadosArquivoFiscalService.PersistirRegistro(regE001);
            this.UpdateStatusAsynchronousExecution("Gerando Registro E001");

            RegistroE990 regE990 = DadosArquivoFiscalService.GetRegistroE990();

            DadosArquivoFiscalService.PersistirRegistro(regE990);
            this.UpdateStatusAsynchronousExecution("Gerando Registro E990");
        }
Пример #6
0
        private void ProcessarProducao()
        {
            try
            {
                this.UpdateStatusAsynchronousExecution("Iniciando processamento do bloco K");

                RegistroK100 regK100 = ProducaoService.GetRegistroK100();
                DadosArquivoFiscalService.PersistirRegistro(regK100);

                this.UpdateStatusAsynchronousExecution("Iniciando processamento do bloco K200");
                IEnumerable <RegistroK200> reglK200 = ProducaoService.GetRegistrosK200();
                foreach (var item in reglK200)
                {
                    DadosArquivoFiscalService.PersistirRegistro(item);
                }

                this.UpdateStatusAsynchronousExecution("Iniciando processamento do bloco K220");
                IEnumerable <RegistroK220> reglK220 = ProducaoService.GetRegistrosK220();
                foreach (var item in reglK220)
                {
                    DadosArquivoFiscalService.PersistirRegistro(item);
                }

                this.UpdateStatusAsynchronousExecution("Iniciando processamento do bloco K230");
                IEnumerable <RegistroK230> reglK230 = ProducaoService.GetRegistrosK230();
                IEnumerable <RegistroK235> reglK235 = null;
                foreach (var regK230 in reglK230)
                {
                    if (regK230.COD_ITEM != "")
                    {
                        this.ProcessarProduto(regK230.COD_ITEM);
                    }
                    DadosArquivoFiscalService.PersistirRegistro(regK230);
                    reglK235 = ProducaoService.GetRegistrosK235(regK230);
                    foreach (var regK235 in reglK235)
                    {
                        if (regK235.COD_ITEM != "")
                        {
                            this.ProcessarProduto(regK230.COD_ITEM);
                        }

                        // FAZER COD_INS_SUBST
                        if (regK235.COD_INS_SUBST != "")
                        {
                            this.ProcessarConsumoEspecifico(regK235.COD_INS_SUBST);
                        }

                        DadosArquivoFiscalService.PersistirRegistro(regK235);
                    }
                }

                this.UpdateStatusAsynchronousExecution("Iniciando processamento do bloco K250");
                IEnumerable <RegistroK250> reglK250 = ProducaoService.GetRegistrosK250();
                IEnumerable <RegistroK255> reglK255 = null;
                foreach (var regk250 in reglK250)
                {
                    if (regk250.COD_ITEM != "")
                    {
                        this.ProcessarProduto(regk250.COD_ITEM);
                    }
                    DadosArquivoFiscalService.PersistirRegistro(regk250);
                    reglK255 = ProducaoService.GetRegistrosK255(regk250);

                    foreach (var regk255 in reglK255)
                    {
                        if (regk255.COD_ITEM != "")
                        {
                            this.ProcessarProduto(regk255.COD_ITEM);
                        }

                        if (regk255.COD_INS_SUBST != "")
                        {
                            this.ProcessarConsumoEspecifico(regk255.COD_INS_SUBST);
                        }
                        DadosArquivoFiscalService.PersistirRegistro(regk255);
                    }
                }

                RegistroK001 regK001 = new RegistroK001();
                if (DadosArquivoFiscalService.BlocoPossuiRegistros("K"))
                {
                    regK001.IND_MOV = "0";
                }
                else
                {
                    regK001.IND_MOV = "1";
                }
                DadosArquivoFiscalService.PersistirRegistro(regK001);
                this.UpdateStatusAsynchronousExecution("Gerando Registro K001");

                RegistroK990 regK990 = DadosArquivoFiscalService.GetRegistroK990();
                DadosArquivoFiscalService.PersistirRegistro(regK990);
                this.UpdateStatusAsynchronousExecution("Gerando Registro k990");
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }