Exemplo n.º 1
0
        private void PAF_Preenche_R()
        {
            #region Contadores

            int itemR1 = 0, itemR2 = 0, itemR3 = 0, itemR4 = 0, itemR5 = 0, itemR6 = 0, itemR7 = 0;
            var cr2 = PafR.RegistroR1.Sum(s => s.RegistroR2.Count);
            var cr3 = PafR.RegistroR1.Sum(s => s.RegistroR2.Sum(c => c.RegistroR3.Count));
            var cr4 = PafR.RegistroR1.Sum(s => s.RegistroR4.Count);
            var cr5 = PafR.RegistroR1.Sum(s => s.RegistroR4.Sum(c => c.RegistroR5.Count));
            var cr6 = PafR.RegistroR1.Sum(s => s.RegistroR6.Count);
            var cr7 = PafR.RegistroR1.Sum(s => s.RegistroR4.Sum(c => c.RegistroR7.Count) +
                                          s.RegistroR6.Sum(c => c.RegistroR7.Count));

            #endregion Contadores

            #region Arrays

            var registrosR1Rec = new ACBrPAFInterop.RegistroR1Rec[PafR.RegistroR1.Count];
            var registrosR2Rec = new ACBrPAFInterop.RegistroR2Rec[cr2];
            var registrosR3Rec = new ACBrPAFInterop.RegistroR3Rec[cr3];
            var registrosR4Rec = new ACBrPAFInterop.RegistroR4Rec[cr4];
            var registrosR5Rec = new ACBrPAFInterop.RegistroR5Rec[cr5];
            var registrosR6Rec = new ACBrPAFInterop.RegistroR6Rec[cr6];
            var registrosR7Rec = new ACBrPAFInterop.RegistroR7Rec[cr7];

            #endregion

            foreach (ACBrPAFRegistroR1 r1 in PafR.RegistroR1)
            {
                #region R1

                registrosR1Rec[itemR1].QTD_R2           = r1.RegistroR2.Count;
                registrosR1Rec[itemR1].QTD_R4           = r1.RegistroR4.Count;
                registrosR1Rec[itemR1].QTD_R6           = r1.RegistroR6.Count;
                registrosR1Rec[itemR1].NUM_FAB          = ToUTF8(r1.NUM_FAB);
                registrosR1Rec[itemR1].MF_ADICIONAL     = ToUTF8(r1.MF_ADICIONAL);
                registrosR1Rec[itemR1].TIPO_ECF         = ToUTF8(r1.TIPO_ECF);
                registrosR1Rec[itemR1].MARCA_ECF        = ToUTF8(r1.MARCA_ECF);
                registrosR1Rec[itemR1].MODELO_ECF       = ToUTF8(r1.MODELO_ECF);
                registrosR1Rec[itemR1].VERSAO_SB        = ToUTF8(r1.VERSAO_SB);
                registrosR1Rec[itemR1].DT_INST_SB       = r1.DT_INST_SB.ToOADate();
                registrosR1Rec[itemR1].HR_INST_SB       = r1.HR_INST_SB.ToOADate();
                registrosR1Rec[itemR1].NUM_SEQ_ECF      = r1.NUM_SEQ_ECF;
                registrosR1Rec[itemR1].CNPJ             = ToUTF8(r1.CNPJ);
                registrosR1Rec[itemR1].IE               = ToUTF8(r1.IE);
                registrosR1Rec[itemR1].CNPJ_SH          = ToUTF8(r1.CNPJ_SH);
                registrosR1Rec[itemR1].IE_SH            = ToUTF8(r1.IE_SH);
                registrosR1Rec[itemR1].IM_SH            = ToUTF8(r1.IM_SH);
                registrosR1Rec[itemR1].NOME_SH          = ToUTF8(r1.NOME_SH);
                registrosR1Rec[itemR1].NOME_PAF         = ToUTF8(r1.NOME_PAF);
                registrosR1Rec[itemR1].VER_PAF          = ToUTF8(r1.VER_PAF);
                registrosR1Rec[itemR1].COD_MD5          = ToUTF8(r1.COD_MD5);
                registrosR1Rec[itemR1].DT_INI           = r1.DT_INI.ToOADate();
                registrosR1Rec[itemR1].DT_FIN           = r1.DT_FIN.ToOADate();
                registrosR1Rec[itemR1].ER_PAF_ECF       = ToUTF8(r1.ER_PAF_ECF);
                registrosR1Rec[itemR1].InclusaoExclusao = r1.InclusaoExclusao;
                registrosR1Rec[itemR1].RegistroValido   = r1.RegistroValido;

                #endregion

                #region R2 e R3

                foreach (ACBrPAFRegistroR2 r2 in r1.RegistroR2)
                {
                    registrosR2Rec[itemR2].QTD_R3         = r2.RegistroR3.Count;
                    registrosR2Rec[itemR2].NUM_USU        = r2.NUM_USU;
                    registrosR2Rec[itemR2].CRZ            = r2.CRZ;
                    registrosR2Rec[itemR2].COO            = r2.COO;
                    registrosR2Rec[itemR2].CRO            = r2.CRO;
                    registrosR2Rec[itemR2].DT_MOV         = r2.DT_MOV.ToOADate();
                    registrosR2Rec[itemR2].DT_EMI         = r2.DT_EMI.ToOADate();
                    registrosR2Rec[itemR2].HR_EMI         = r2.HR_EMI.ToOADate();
                    registrosR2Rec[itemR2].VL_VBD         = Convert.ToDouble(r2.VL_VBD);
                    registrosR2Rec[itemR2].PAR_ECF        = ToUTF8(r2.PAR_ECF);
                    registrosR2Rec[itemR2].RegistroValido = r2.RegistroValido;

                    foreach (ACBrPAFRegistroR3 registroR3 in r2.RegistroR3)
                    {
                        registrosR3Rec[itemR3].TOT_PARCIAL    = ToUTF8(registroR3.TOT_PARCIAL);
                        registrosR3Rec[itemR3].VL_ACUM        = Convert.ToDouble(registroR3.VL_ACUM);
                        registrosR3Rec[itemR3].RegistroValido = registroR3.RegistroValido;
                        itemR3++;
                    }

                    itemR2++;
                }

                #endregion

                #region R4, R5 e R7
                foreach (ACBrPAFRegistroR4 r4 in r1.RegistroR4)
                {
                    registrosR4Rec[itemR4].QTD_R5         = r4.RegistroR5.Count;
                    registrosR4Rec[itemR4].QTD_R7         = r4.RegistroR7.Count;
                    registrosR4Rec[itemR4].NUM_USU        = r4.NUM_USU;
                    registrosR4Rec[itemR4].NUM_CONT       = r4.NUM_CONT;
                    registrosR4Rec[itemR4].COO            = r4.COO;
                    registrosR4Rec[itemR4].DT_INI         = r4.DT_INI.ToOADate();
                    registrosR4Rec[itemR4].SUB_DOCTO      = Convert.ToDouble(r4.SUB_DOCTO);
                    registrosR4Rec[itemR4].SUB_DESCTO     = Convert.ToDouble(r4.SUB_DESCTO);
                    registrosR4Rec[itemR4].TP_DESCTO      = ToUTF8(r4.TP_DESCTO);
                    registrosR4Rec[itemR4].SUB_ACRES      = Convert.ToDouble(r4.SUB_ACRES);
                    registrosR4Rec[itemR4].TP_ACRES       = ToUTF8(r4.TP_ACRES);
                    registrosR4Rec[itemR4].VL_TOT         = Convert.ToDouble(r4.VL_TOT);
                    registrosR4Rec[itemR4].CANC           = ToUTF8(r4.CANC);
                    registrosR4Rec[itemR4].VL_CA          = Convert.ToDouble(r4.VL_CA);
                    registrosR4Rec[itemR4].ORDEM_DA       = ToUTF8(r4.ORDEM_DA);
                    registrosR4Rec[itemR4].NOME_CLI       = ToUTF8(r4.NOME_CLI);
                    registrosR4Rec[itemR4].CNPJ_CPF       = ToUTF8(r4.CNPJ_CPF);
                    registrosR4Rec[itemR4].RegistroValido = r4.RegistroValido;

                    foreach (ACBrPAFRegistroR5 registroR5 in r4.RegistroR5)
                    {
                        registrosR5Rec[itemR5].NUM_CONT       = registroR5.NUM_CONT;
                        registrosR5Rec[itemR5].NUM_ITEM       = registroR5.NUM_ITEM;
                        registrosR5Rec[itemR5].COD_ITEM       = ToUTF8(registroR5.COD_ITEM);
                        registrosR5Rec[itemR5].DESC_ITEM      = ToUTF8(registroR5.DESC_ITEM);
                        registrosR5Rec[itemR5].QTDE_ITEM      = Convert.ToDouble(registroR5.QTDE_ITEM);
                        registrosR5Rec[itemR5].UN_MED         = ToUTF8(registroR5.UN_MED);
                        registrosR5Rec[itemR5].VL_UNIT        = Convert.ToDouble(registroR5.VL_UNIT);
                        registrosR5Rec[itemR5].DESCTO_ITEM    = Convert.ToDouble(registroR5.DESCTO_ITEM);
                        registrosR5Rec[itemR5].ACRES_ITEM     = Convert.ToDouble(registroR5.ACRES_ITEM);
                        registrosR5Rec[itemR5].VL_TOT_ITEM    = Convert.ToDouble(registroR5.VL_TOT_ITEM);
                        registrosR5Rec[itemR5].COD_TOT_PARC   = ToUTF8(registroR5.COD_TOT_PARC);
                        registrosR5Rec[itemR5].IND_CANC       = ToUTF8(registroR5.IND_CANC);
                        registrosR5Rec[itemR5].QTDE_CANC      = Convert.ToDouble(registroR5.QTDE_CANC);
                        registrosR5Rec[itemR5].VL_CANC        = Convert.ToDouble(registroR5.VL_CANC);
                        registrosR5Rec[itemR5].VL_CANC_ACRES  = Convert.ToDouble(registroR5.VL_CANC_ACRES);
                        registrosR5Rec[itemR5].IAT            = ToUTF8(registroR5.IAT);
                        registrosR5Rec[itemR5].IPPT           = ToUTF8(registroR5.IPPT);
                        registrosR5Rec[itemR5].QTDE_DECIMAL   = registroR5.QTDE_DECIMAL;
                        registrosR5Rec[itemR5].VL_DECIMAL     = registroR5.VL_DECIMAL;
                        registrosR5Rec[itemR5].RegistroValido = registroR5.RegistroValido;
                        itemR5++;
                    }

                    foreach (ACBrPAFRegistroR7 registroR7 in r4.RegistroR7)
                    {
                        registrosR7Rec[itemR7].COO            = registroR7.COO;
                        registrosR7Rec[itemR7].CCF            = registroR7.CCF;
                        registrosR7Rec[itemR7].GNF            = registroR7.GNF;
                        registrosR7Rec[itemR7].MP             = ToUTF8(registroR7.MP);
                        registrosR7Rec[itemR7].VL_PAGTO       = Convert.ToDouble(registroR7.VL_PAGTO);
                        registrosR7Rec[itemR7].IND_EST        = ToUTF8(registroR7.IND_EST);
                        registrosR7Rec[itemR7].VL_EST         = Convert.ToDouble(registroR7.VL_EST);
                        registrosR7Rec[itemR7].RegistroValido = registroR7.RegistroValido;
                        itemR7++;
                    }

                    itemR4++;
                }
                #endregion

                #region R6 e R7

                foreach (ACBrPAFRegistroR6 r6 in r1.RegistroR6)
                {
                    registrosR6Rec[itemR6].QTD_R7         = r6.RegistroR7.Count;
                    registrosR6Rec[itemR6].NUM_USU        = r6.NUM_USU;
                    registrosR6Rec[itemR6].COO            = r6.COO;
                    registrosR6Rec[itemR6].GNF            = r6.GNF;
                    registrosR6Rec[itemR6].GRG            = r6.GRG;
                    registrosR6Rec[itemR6].CDC            = r6.CDC;
                    registrosR6Rec[itemR6].DENOM          = ToUTF8(r6.DENOM);
                    registrosR6Rec[itemR6].DT_FIN         = r6.DT_FIN.ToOADate();
                    registrosR6Rec[itemR6].HR_FIN         = r6.HR_FIN.ToOADate();
                    registrosR6Rec[itemR6].RegistroValido = r6.RegistroValido;

                    foreach (ACBrPAFRegistroR7 registroR7 in r6.RegistroR7)
                    {
                        registrosR7Rec[itemR7].COO            = registroR7.COO;
                        registrosR7Rec[itemR7].CCF            = registroR7.CCF;
                        registrosR7Rec[itemR7].GNF            = registroR7.GNF;
                        registrosR7Rec[itemR7].MP             = ToUTF8(registroR7.MP);
                        registrosR7Rec[itemR7].VL_PAGTO       = Convert.ToDouble(registroR7.VL_PAGTO);
                        registrosR7Rec[itemR7].IND_EST        = ToUTF8(registroR7.IND_EST);
                        registrosR7Rec[itemR7].VL_EST         = Convert.ToDouble(registroR7.VL_EST);
                        registrosR7Rec[itemR7].RegistroValido = registroR7.RegistroValido;
                        itemR7++;
                    }

                    itemR6++;
                }

                #endregion

                itemR1++;
            }

            var ret = ACBrPAFInterop.PAF_Preenche_R(Handle, PafR.RegistroR1.Count,
                                                    registrosR1Rec,
                                                    registrosR2Rec,
                                                    registrosR3Rec,
                                                    registrosR4Rec,
                                                    registrosR5Rec,
                                                    registrosR6Rec,
                                                    registrosR7Rec);
            CheckResult(ret);
        }
Exemplo n.º 2
0
        private void PAF_Preenche_R()
        {
            #region Contadores

            int itemR1 = 0, itemR2 = 0, itemR3 = 0, itemR4 = 0, itemR5 = 0, itemR6 = 0, itemR7 = 0;
			var cr2 = PafR.RegistroR1.Sum(s => s.RegistroR2.Count);
			var cr3 = PafR.RegistroR1.Sum(s => s.RegistroR2.Sum(c => c.RegistroR3.Count));
			var cr4 = PafR.RegistroR1.Sum(s => s.RegistroR4.Count);
			var cr5 = PafR.RegistroR1.Sum(s => s.RegistroR4.Sum(c => c.RegistroR5.Count));
			var cr6 = PafR.RegistroR1.Sum(s => s.RegistroR6.Count);
			var cr7 = PafR.RegistroR1.Sum(s => s.RegistroR4.Sum(c => c.RegistroR7.Count) +
											   s.RegistroR6.Sum(c => c.RegistroR7.Count));

			#endregion Contadores

            #region Arrays

            var registrosR1Rec = new ACBrPAFInterop.RegistroR1Rec[PafR.RegistroR1.Count];
            var registrosR2Rec = new ACBrPAFInterop.RegistroR2Rec[cr2];
            var registrosR3Rec = new ACBrPAFInterop.RegistroR3Rec[cr3];
            var registrosR4Rec = new ACBrPAFInterop.RegistroR4Rec[cr4];
            var registrosR5Rec = new ACBrPAFInterop.RegistroR5Rec[cr5];
            var registrosR6Rec = new ACBrPAFInterop.RegistroR6Rec[cr6];
            var registrosR7Rec = new ACBrPAFInterop.RegistroR7Rec[cr7];

            #endregion

            foreach(ACBrPAFRegistroR1 r1 in PafR.RegistroR1)
            {
                #region R1

                registrosR1Rec[itemR1].QTD_R2 = r1.RegistroR2.Count;
                registrosR1Rec[itemR1].QTD_R4 = r1.RegistroR4.Count;
                registrosR1Rec[itemR1].QTD_R6 = r1.RegistroR6.Count;
                registrosR1Rec[itemR1].NUM_FAB = ToUTF8(r1.NUM_FAB);
                registrosR1Rec[itemR1].MF_ADICIONAL = ToUTF8(r1.MF_ADICIONAL);
                registrosR1Rec[itemR1].TIPO_ECF = ToUTF8(r1.TIPO_ECF);
                registrosR1Rec[itemR1].MARCA_ECF = ToUTF8(r1.MARCA_ECF);
                registrosR1Rec[itemR1].MODELO_ECF = ToUTF8(r1.MODELO_ECF);
                registrosR1Rec[itemR1].VERSAO_SB = ToUTF8(r1.VERSAO_SB);
                registrosR1Rec[itemR1].DT_INST_SB = r1.DT_INST_SB.ToOADate();
                registrosR1Rec[itemR1].HR_INST_SB = r1.HR_INST_SB.ToOADate();
                registrosR1Rec[itemR1].NUM_SEQ_ECF = r1.NUM_SEQ_ECF;
                registrosR1Rec[itemR1].CNPJ = ToUTF8(r1.CNPJ);
                registrosR1Rec[itemR1].IE = ToUTF8(r1.IE);
                registrosR1Rec[itemR1].CNPJ_SH = ToUTF8(r1.CNPJ_SH);
                registrosR1Rec[itemR1].IE_SH = ToUTF8(r1.IE_SH);
                registrosR1Rec[itemR1].IM_SH = ToUTF8(r1.IM_SH);
                registrosR1Rec[itemR1].NOME_SH = ToUTF8(r1.NOME_SH);
                registrosR1Rec[itemR1].NOME_PAF = ToUTF8(r1.NOME_PAF);
                registrosR1Rec[itemR1].VER_PAF = ToUTF8(r1.VER_PAF);
                registrosR1Rec[itemR1].COD_MD5 = ToUTF8(r1.COD_MD5);
                registrosR1Rec[itemR1].DT_INI = r1.DT_INI.ToOADate();
                registrosR1Rec[itemR1].DT_FIN = r1.DT_FIN.ToOADate();
                registrosR1Rec[itemR1].ER_PAF_ECF = ToUTF8(r1.ER_PAF_ECF);
                registrosR1Rec[itemR1].InclusaoExclusao = r1.InclusaoExclusao;
                registrosR1Rec[itemR1].RegistroValido = r1.RegistroValido;

                #endregion

                #region R2 e R3

                foreach(ACBrPAFRegistroR2 r2 in r1.RegistroR2)
                {
                    registrosR2Rec[itemR2].QTD_R3 = r2.RegistroR3.Count;
                    registrosR2Rec[itemR2].NUM_USU = r2.NUM_USU;
                    registrosR2Rec[itemR2].CRZ = r2.CRZ;
                    registrosR2Rec[itemR2].COO = r2.COO;
                    registrosR2Rec[itemR2].CRO = r2.CRO;
                    registrosR2Rec[itemR2].DT_MOV = r2.DT_MOV.ToOADate();
                    registrosR2Rec[itemR2].DT_EMI = r2.DT_EMI.ToOADate();
                    registrosR2Rec[itemR2].HR_EMI = r2.HR_EMI.ToOADate();
                    registrosR2Rec[itemR2].VL_VBD = Convert.ToDouble(r2.VL_VBD);
                    registrosR2Rec[itemR2].PAR_ECF = ToUTF8(r2.PAR_ECF);
                    registrosR2Rec[itemR2].RegistroValido = r2.RegistroValido;

                    foreach(ACBrPAFRegistroR3 registroR3 in r2.RegistroR3)
                    {
                        registrosR3Rec[itemR3].TOT_PARCIAL = ToUTF8(registroR3.TOT_PARCIAL);
                        registrosR3Rec[itemR3].VL_ACUM = Convert.ToDouble(registroR3.VL_ACUM);
                        registrosR3Rec[itemR3].RegistroValido = registroR3.RegistroValido;
                        itemR3++;
                    }

                    itemR2++;
                }

                #endregion

                #region R4, R5 e R7
                foreach(ACBrPAFRegistroR4 r4 in r1.RegistroR4)
                {
                    registrosR4Rec[itemR4].QTD_R5 = r4.RegistroR5.Count;
                    registrosR4Rec[itemR4].QTD_R7 = r4.RegistroR7.Count;
                    registrosR4Rec[itemR4].NUM_USU = r4.NUM_USU;
                    registrosR4Rec[itemR4].NUM_CONT = r4.NUM_CONT;
                    registrosR4Rec[itemR4].COO = r4.COO;
                    registrosR4Rec[itemR4].DT_INI = r4.DT_INI.ToOADate();
                    registrosR4Rec[itemR4].SUB_DOCTO = Convert.ToDouble(r4.SUB_DOCTO);
                    registrosR4Rec[itemR4].SUB_DESCTO = Convert.ToDouble(r4.SUB_DESCTO);
                    registrosR4Rec[itemR4].TP_DESCTO = ToUTF8(r4.TP_DESCTO);
                    registrosR4Rec[itemR4].SUB_ACRES = Convert.ToDouble(r4.SUB_ACRES);
                    registrosR4Rec[itemR4].TP_ACRES = ToUTF8(r4.TP_ACRES);
                    registrosR4Rec[itemR4].VL_TOT = Convert.ToDouble(r4.VL_TOT);
                    registrosR4Rec[itemR4].CANC = ToUTF8(r4.CANC);
                    registrosR4Rec[itemR4].VL_CA = Convert.ToDouble(r4.VL_CA);
                    registrosR4Rec[itemR4].ORDEM_DA = ToUTF8(r4.ORDEM_DA);
                    registrosR4Rec[itemR4].NOME_CLI = ToUTF8(r4.NOME_CLI);
                    registrosR4Rec[itemR4].CNPJ_CPF = ToUTF8(r4.CNPJ_CPF);
                    registrosR4Rec[itemR4].RegistroValido = r4.RegistroValido;

                    foreach(ACBrPAFRegistroR5 registroR5 in r4.RegistroR5)
                    {
                        registrosR5Rec[itemR5].NUM_CONT = registroR5.NUM_CONT;
                        registrosR5Rec[itemR5].NUM_ITEM = registroR5.NUM_ITEM;
                        registrosR5Rec[itemR5].COD_ITEM = ToUTF8(registroR5.COD_ITEM);
                        registrosR5Rec[itemR5].DESC_ITEM = ToUTF8(registroR5.DESC_ITEM);
                        registrosR5Rec[itemR5].QTDE_ITEM = Convert.ToDouble(registroR5.QTDE_ITEM);
                        registrosR5Rec[itemR5].UN_MED = ToUTF8(registroR5.UN_MED);
                        registrosR5Rec[itemR5].VL_UNIT = Convert.ToDouble(registroR5.VL_UNIT);
                        registrosR5Rec[itemR5].DESCTO_ITEM = Convert.ToDouble(registroR5.DESCTO_ITEM);
                        registrosR5Rec[itemR5].ACRES_ITEM = Convert.ToDouble(registroR5.ACRES_ITEM);
                        registrosR5Rec[itemR5].VL_TOT_ITEM = Convert.ToDouble(registroR5.VL_TOT_ITEM);
                        registrosR5Rec[itemR5].COD_TOT_PARC = ToUTF8(registroR5.COD_TOT_PARC);
                        registrosR5Rec[itemR5].IND_CANC = ToUTF8(registroR5.IND_CANC);
                        registrosR5Rec[itemR5].QTDE_CANC = Convert.ToDouble(registroR5.QTDE_CANC);
                        registrosR5Rec[itemR5].VL_CANC = Convert.ToDouble(registroR5.VL_CANC);
                        registrosR5Rec[itemR5].VL_CANC_ACRES = Convert.ToDouble(registroR5.VL_CANC_ACRES);
                        registrosR5Rec[itemR5].IAT = ToUTF8(registroR5.IAT);
                        registrosR5Rec[itemR5].IPPT = ToUTF8(registroR5.IPPT);
                        registrosR5Rec[itemR5].QTDE_DECIMAL = registroR5.QTDE_DECIMAL;
                        registrosR5Rec[itemR5].VL_DECIMAL = registroR5.VL_DECIMAL;
                        registrosR5Rec[itemR5].RegistroValido = registroR5.RegistroValido;
                        itemR5++;
                    }

                    foreach(ACBrPAFRegistroR7 registroR7 in r4.RegistroR7)
                    {
						registrosR7Rec[itemR7].COO = registroR7.COO;
                        registrosR7Rec[itemR7].CCF = registroR7.CCF;
                        registrosR7Rec[itemR7].GNF = registroR7.GNF;
                        registrosR7Rec[itemR7].MP = ToUTF8(registroR7.MP);
                        registrosR7Rec[itemR7].VL_PAGTO = Convert.ToDouble(registroR7.VL_PAGTO);
                        registrosR7Rec[itemR7].IND_EST = ToUTF8(registroR7.IND_EST);
                        registrosR7Rec[itemR7].VL_EST = Convert.ToDouble(registroR7.VL_EST);
                        registrosR7Rec[itemR7].RegistroValido = registroR7.RegistroValido;
                        itemR7++;
                    }

                    itemR4++;
                }
                #endregion

                #region R6 e R7

                foreach(ACBrPAFRegistroR6 r6 in r1.RegistroR6)
                {
                    registrosR6Rec[itemR6].QTD_R7 = r6.RegistroR7.Count;
                    registrosR6Rec[itemR6].NUM_USU = r6.NUM_USU;
                    registrosR6Rec[itemR6].COO = r6.COO;
                    registrosR6Rec[itemR6].GNF = r6.GNF;
                    registrosR6Rec[itemR6].GRG = r6.GRG;
                    registrosR6Rec[itemR6].CDC = r6.CDC;
                    registrosR6Rec[itemR6].DENOM = ToUTF8(r6.DENOM);
                    registrosR6Rec[itemR6].DT_FIN = r6.DT_FIN.ToOADate();
                    registrosR6Rec[itemR6].HR_FIN = r6.HR_FIN.ToOADate();
                    registrosR6Rec[itemR6].RegistroValido = r6.RegistroValido;

                    foreach(ACBrPAFRegistroR7 registroR7 in r6.RegistroR7)
                    {
						registrosR7Rec[itemR7].COO = registroR7.COO;
                        registrosR7Rec[itemR7].CCF = registroR7.CCF;
                        registrosR7Rec[itemR7].GNF = registroR7.GNF;
                        registrosR7Rec[itemR7].MP = ToUTF8(registroR7.MP);
                        registrosR7Rec[itemR7].VL_PAGTO = Convert.ToDouble(registroR7.VL_PAGTO);
                        registrosR7Rec[itemR7].IND_EST = ToUTF8(registroR7.IND_EST);
                        registrosR7Rec[itemR7].VL_EST = Convert.ToDouble(registroR7.VL_EST);
                        registrosR7Rec[itemR7].RegistroValido = registroR7.RegistroValido;
                        itemR7++;
                    }

                    itemR6++;
                }

                #endregion

                itemR1++;
            }

            var ret = ACBrPAFInterop.PAF_Preenche_R(Handle, PafR.RegistroR1.Count,
                                                            registrosR1Rec,
                                                            registrosR2Rec,
                                                            registrosR3Rec,
                                                            registrosR4Rec,
                                                            registrosR5Rec,
                                                            registrosR6Rec,
                                                            registrosR7Rec);
            CheckResult(ret);
        }