Exemple #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");
        }
        /// <summary>
        /// Registro D
        /// </summary>
        private void ProcessarDocumentosFiscaisServicoICMS()
        {
            this.ProcessarNotasFiscaisServicosComunicacao();
            this.UpdateStatusAsynchronousExecution("Gerando Registro D001");
            RegistroD001 regD001 = new RegistroD001();

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

            RegistroD990 regD990 = DadosArquivoPisCofinsService.GetRegistroD990();

            DadosArquivoPisCofinsService.PersistirRegistro(regD990);
            this.UpdateStatusAsynchronousExecution("Gerando Registro D990");
        }
        private void ProcessarConhecimentosTransporte()
        {
            IEnumerable <RegistroD101> registrosD101;
            IEnumerable <RegistroD110> registrosD110;
            IEnumerable <RegistroD120> registrosD120;
            IEnumerable <RegistroD130> registrosD130;
            IEnumerable <RegistroD190> registrosD190;

            IEnumerable <RegistroD100> registrosD100 =
                conhecimentoTransporteService.GetRegistrosD100();

            foreach (RegistroD100 regD100 in registrosD100)
            {
                this.UpdateStatusAsynchronousExecution("Gerando Registro D100");
                dadosArquivoContmaticService.PersistirRegistro(regD100);

                // Processa informações do cliente ou fornecedor vinculado a uma nota fiscal
                this.ProcessarParticipante(regD100.COD_PART);

                // registrosD101 = conhecimentoTransporteService.GetRegistrosD101(  VERIFICAR COM ÉRICK


                if (regD100.ST_DOC_CANCELADO != "S") // Não persiste registros filhos caso haja cancelamento
                {
                    registrosD110 = conhecimentoTransporteService.GetRegistrosD110(
                        regD100.PK_NOTAFIS);
                    foreach (RegistroD110 regD110 in registrosD110)
                    {
                        dadosArquivoContmaticService.PersistirRegistro(regD110);
                        this.UpdateStatusAsynchronousExecution("Gerando Registro D110");
                    }

                    registrosD120 = conhecimentoTransporteService.GetRegistrosD120(
                        regD100.PK_NOTAFIS);
                    foreach (RegistroD120 regD120 in registrosD120)
                    {
                        dadosArquivoContmaticService.PersistirRegistro(regD120);
                        this.UpdateStatusAsynchronousExecution("Gerando Registro D120");
                    }

                    registrosD130 = conhecimentoTransporteService.GetRegistrosD130(
                        regD100.PK_NOTAFIS);
                    foreach (RegistroD130 regD130 in registrosD130)
                    {
                        dadosArquivoContmaticService.PersistirRegistro(regD130);
                        this.UpdateStatusAsynchronousExecution("Gerando Registro D130");

                        // Gravação de informações de Participantes
                        this.ProcessarParticipante(regD130.COD_PART_CONSG);
                        this.ProcessarParticipante(regD130.COD_PART_RED);
                    }

                    registrosD190 = conhecimentoTransporteService.GetRegistrosD190(
                        regD100.PK_NOTAFIS);
                    foreach (RegistroD190 regD190 in registrosD190)
                    {
                        dadosArquivoContmaticService.PersistirRegistro(regD190);
                        this.UpdateStatusAsynchronousExecution("Gerando Registro D190");
                    }
                }
            }
            this.ProcessarNotaServicoComunicacao();

            RegistroD001 regD001 = new RegistroD001();

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

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

            RegistroD990 regD990 = dadosArquivoContmaticService.GetRegistroD990();

            dadosArquivoContmaticService.PersistirRegistro(regD990);
            this.UpdateStatusAsynchronousExecution("Gerando Registro D990");
        }