/// <summary> /// Emite os registros do tipo R? /// R01 Identificação do ECF, do Usuário, do PAF-ECF e da Empresa Desenvolvedora /// R02 Relação de Reduções Z /// R03 Detalhe da Redução Z /// R04 Cupom Fiscal, Nota Fiscal de Venda a Consumidor ou Bilhete de Passagem /// R05 Detalhe do Cupom Fiscal, Nota Fiscal de Venda a Consumidor ou Bilhete de Passagem /// R06 Demais documentos emitidos pelo ECF /// R07 Detalhe do Cupom Fiscal e do Documento Não Fiscal - Meio de Pagamento /// </summary> private void PreencheR() { //------------------------------------------------------------------------- // Popular todos os registros 01 na data especificada //------------------------------------------------------------------------- foreach(IRegistro01 r01 in registros01) { ACBrPAFRegistroR1 R1 = new ACBrPAFRegistroR1(); R1.NUM_FAB = r01.Impressora.Serie; R1.MF_ADICIONAL = r01.Impressora.MFAdicional; R1.TIPO_ECF = Unimake.Convert.ToString(r01.Impressora.Tipo); R1.MARCA_ECF = r01.MarcaECF; R1.MODELO_ECF = Unimake.Convert.ToString(r01.Impressora.ModeloACBR); R1.VERSAO_SB = r01.VersaoSB; R1.DT_INST_SB = r01.DataInstalacaoSB; R1.HR_INST_SB = r01.HoraInstalacaoSB; R1.NUM_SEQ_ECF = Unimake.Convert.ToInt(r01.Impressora.PDV.NumeroCaixa); R1.CNPJ = r01.Empresa.GetCPFCNPJ(); R1.IE = r01.Empresa.Juridica.IE; R1.CNPJ_SH = Settings.SoftwareHouse.CNPJ; R1.IE_SH = Settings.SoftwareHouse.IE; R1.IM_SH = Settings.SoftwareHouse.IM; R1.NOME_SH = Settings.SoftwareHouse.Nome; R1.NOME_PAF = Settings.SoftwareHouse.NomeApp; R1.VER_PAF = Settings.SoftwareHouse.Versao; R1.COD_MD5 = Cryptography.Files.MD5.GetMD5Hash(Settings.PAF.FilesFullPath); R1.DT_INI = DataInicial; R1.DT_FIN = DataFinal; R1.ER_PAF_ECF = Settings.SoftwareHouse.VersaoER; R1.InclusaoExclusao = false; R1.RegistroValido = true; //R2 e R3 foreach(IRegistro02 r02 in R1.RegistroR2) { ACBrPAFRegistroR2 R2 = new ACBrPAFRegistroR2(); R2.NUM_USU = r01.Impressora.NumeroUsuario; R2.CRZ = r02.CRZ; R2.COO = r02.COO; R2.CRO = r02.CRO; R2.DT_MOV = r02.DataMovimento; R2.DT_EMI = r02.DataHoraEmissao; R2.HR_EMI = r02.DataHoraEmissao; R2.VL_VBD = (decimal)r02.VendaBrutaDiaria; R2.PAR_ECF = r02.ParametroECFISSQN ? "S" : "N"; R2.RegistroValido = true; foreach(IRegistro03 r03 in r02.Registros03) { R2.RegistroR3.Add(new ACBrPAFRegistroR3 { TOT_PARCIAL = r03.TotalizadorParcial, VL_ACUM = (decimal)r03.ValorAcumulado, RegistroValido = true }); } R1.RegistroR2.Add(R2); } //R4, R5 e R7 foreach(IRegistro04 r04 in r01.RegistrosR4) { ACBrPAFRegistroR4 R4 = new ACBrPAFRegistroR4(); R4.NUM_USU = r04.NumeroUsuario; R4.NUM_CONT = r04.CCF; R4.COO = r04.COO; R4.DT_INI = DataInicial; R4.SUB_DOCTO = (decimal)r04.ValorSubtotal; R4.SUB_DESCTO = (decimal)r04.ValorDescontoSubtotal; R4.TP_DESCTO = r04.TipoDescontoSubtotal; R4.SUB_ACRES = (decimal)r04.ValorAcrescimoSubtotal; R4.TP_ACRES = r04.TipoAcrescimoSubtotal; R4.VL_TOT = (decimal)r04.ValorTotalLiquido; R4.CANC = r04.Cancelado; R4.VL_CA = (decimal)r04.ValorCancelamentoAcrescimoSubtotal; R4.ORDEM_DA = r04.OrdemDescontoAcrescimo; R4.NOME_CLI = r04.NomeAdquirente; R4.CNPJ_CPF = r04.CPFCNPJAdquirente; R4.RegistroValido = true; foreach(IRegistro05 r05 in r04.Registros05) { R4.RegistroR5.Add(new ACBrPAFRegistroR5 { NUM_CONT = r05.NumeroUsuario, NUM_ITEM = r05.NumeroItem, COD_ITEM = r05.CodigoProduto, DESC_ITEM = r05.Descricao, QTDE_ITEM = (decimal)r05.Quantidade, UN_MED = r05.Unidade, VL_UNIT = (decimal)r05.ValorUnitario, DESCTO_ITEM = (decimal)r05.ValorDesconto, ACRES_ITEM = (decimal)r05.ValorAcrescimo, VL_TOT_ITEM = (decimal)r05.ValorTotalLiquido, COD_TOT_PARC = r05.CodigoTotalalizadorParcial, IND_CANC = r05.Cancelado, QTDE_CANC = (decimal)r05.QuantidadeCancelada, VL_CANC = (decimal)r05.ValorCancelado, VL_CANC_ACRES = (decimal)r05.ValorCancelamentoAcrescimo, IAT = r05.IndicadorTruncamento, IPPT = r05.IndicadorProducao, QTDE_DECIMAL = r05.QuantidadeCasaDecimal, VL_DECIMAL = r05.QuantidadeCasaDecimalVlrUnit, RegistroValido = true }); } R1.RegistroR4.Add(R4); } //R6 e R7 foreach(IRegistro06 r06 in r01.RegistrosR6) { ACBrPAFRegistroR6 R6 = new ACBrPAFRegistroR6(); R6.NUM_USU = r06.NumeroUsuario; R6.COO = r06.COO; R6.GNF = r06.GNF; R6.GRG = r06.GRC; R6.CDC = r06.CDC; R6.DENOM = r06.Denominacao; R6.DT_FIN = DataFinal; R6.HR_FIN = DataFinal; R6.RegistroValido = true; foreach(IRegistro07 r07 in r06.Registros07) { R6.RegistroR7.Add(new ACBrPAFRegistroR7 { CCF = r07.CCF, GNF = r07.GNF, //TODO: Quando a baixa estiver carregando corretamento, colocar aqui: MP = r07.BaixaForma.FormaPagamento.Descricao, //TODO: Quando a baixa estiver carregando corretamento, colocar aqui: VL_PAGTO = (decimal)r07.BaixaForma.ValorBruto, IND_EST = r07.IndicadorEstorno, VL_EST = (decimal)r07.ValorEstornado, RegistroValido = true }); } R1.RegistroR6.Add(R6); } ACBrPAF.PAF_R.RegistroR1.Add(R1); } }
private void PAF_Preenche_R() { for(int i = 0; i < 10; i++) { ACBrPAFRegistroR1 R1 = new ACBrPAFRegistroR1(); R1.NUM_FAB = "NUM_FAB"; R1.MF_ADICIONAL = "MF_ADICIONAL"; R1.TIPO_ECF = "TIPO_ECF"; R1.MARCA_ECF = "MARCA_ECF"; R1.MODELO_ECF = "MODELO_ECF"; R1.VERSAO_SB = "VERSAO_SB"; R1.DT_INST_SB = DateTime.Today; R1.HR_INST_SB = DateTime.Now; R1.NUM_SEQ_ECF = i; R1.CNPJ = "12345678901234"; R1.IE = "54654987"; R1.CNPJ_SH = "12345678912345"; R1.IE_SH = "654654654"; R1.IM_SH = "65465687"; R1.NOME_SH = "No nnoNo nOnon"; R1.NOME_PAF = "Non nonoanoa"; R1.VER_PAF = "1.0"; R1.COD_MD5 = "jhg67565ahgfs65465agfs6a54sagfs564ashf"; R1.DT_INI = DateTime.Today.AddDays(-10); R1.DT_FIN = DateTime.Today; R1.ER_PAF_ECF = "lklkj"; R1.InclusaoExclusao = false; R1.RegistroValido = true; //R2 e R3 for(int j = 0; j < 10; j++) { ACBrPAFRegistroR2 R2 = new ACBrPAFRegistroR2(); R2.NUM_USU = 12121; R2.CRZ = 12121; R2.COO = 12121; R2.CRO = 12121; R2.DT_MOV = DateTime.Today; R2.DT_EMI = DateTime.Today; R2.HR_EMI = DateTime.Now; R2.VL_VBD = 12; R2.PAR_ECF = "asa"; R2.RegistroValido = true; for(int k = 0; k < 10; k++) { R2.RegistroR3.Add(new ACBrPAFRegistroR3 { TOT_PARCIAL = "Chucrute", VL_ACUM = .71M * k, RegistroValido = true }); } R1.RegistroR2.Add(R2); } //R4, R5 e R7 for(int x = 0; x < 10; x++) { ACBrPAFRegistroR4 R4 = new ACBrPAFRegistroR4(); R4.NUM_USU = 12212; R4.NUM_CONT = 1212; R4.COO = 1212; R4.DT_INI = DateTime.Today; R4.SUB_DOCTO = 21212; R4.SUB_DESCTO = 1212; R4.TP_DESCTO = "S"; R4.SUB_ACRES = 12121; R4.TP_ACRES = "D"; R4.VL_TOT = 12121; R4.CANC = "C"; R4.VL_CA = 23323; R4.ORDEM_DA = "asa"; R4.NOME_CLI = "No Non ononO n"; R4.CNPJ_CPF = "45645698741"; R4.RegistroValido = true; for(int g = 0; g < 10; g++) { R4.RegistroR5.Add(new ACBrPAFRegistroR5 { NUM_CONT = 121, NUM_ITEM = 1212, COD_ITEM = "21212", DESC_ITEM = "43434", QTDE_ITEM = 121, UN_MED = "UN", VL_UNIT = 121, DESCTO_ITEM = 343, ACRES_ITEM = 3432, VL_TOT_ITEM = 321, COD_TOT_PARC = "S", IND_CANC = "D", QTDE_CANC = 1212, VL_CANC = 12, VL_CANC_ACRES = 32, IAT = "A", IPPT = "T", QTDE_DECIMAL = 1212, VL_DECIMAL = 434, RegistroValido = false }); } for(int h = 0; h < 10; h++) { R4.RegistroR7.Add(new ACBrPAFRegistroR7 { CCF = 1212, GNF = 1212, MP = "S", VL_PAGTO = 121, IND_EST = "T", VL_EST = 36, RegistroValido = false }); } R1.RegistroR4.Add(R4); } //R6 e R7 for(int l = 0; l < 10; l++) { ACBrPAFRegistroR6 R6 = new ACBrPAFRegistroR6(); R6.NUM_USU = 121; R6.COO = 546; R6.GNF = 8; R6.GRG = 36; R6.CDC = 59; R6.DENOM = "çasdflkçflsdk"; R6.DT_FIN = DateTime.Today; R6.HR_FIN = DateTime.Now; R6.RegistroValido = R6.RegistroValido; for(int n = 0; n < 10; n++) { R6.RegistroR7.Add(new ACBrPAFRegistroR7 { CCF = 1234, GNF = 564, MP = "lksdjhf", VL_PAGTO = 12121, IND_EST = "S", VL_EST = 45, RegistroValido = true }); } R1.RegistroR6.Add(R6); } acbrPAF.PafR.RegistroR1.Add(R1); } }