Ir para conteúdo
  • Cadastre-se

dev botao

PAF-ECF REQ XXX ITEM 1 Relatorio de Meios de Pagamento


leywander
  • Este tópico foi criado há 4218 dias atrás.
  • Talvez seja melhor você criar um NOVO TÓPICO do que postar uma resposta aqui.

Recommended Posts

Boa pessoal!

Estou passando o Roteiro de Analise PAF-ECF Versao 1.8 - julho/2012 Aplicavel à versão 01.12 da ER-PAF-ECF, observado o ATO COTEPE ICMS 36, DE 4 DE SETEMBRO DE 2012 (ESPECIFICAÇÃO DE REQUISITOS DO PAF-ECF (ER-PAF-ECF)

VERSÃO 01.13).

Bem relacionado ao topico, estou passando o Teste 028 e observando o REQ XXX Item 1 alinea "b) a identificação do meio de pagamento e, quando for o caso de cartão, identificar se é crédito, débito ou similar;"

pude obsevar que a função ACBrECF.PafMF_RelMeiosPagamento não identifica se a forma de pagamento é Credito ou Debito, entao, fiz alguma alterações onde:

- Transações TEF serão acumulados precedidos do tipo de transação sendo, (D) para Debito e © Credito.

Para controlar esse tipo de TEF foi realizadas algumas alterações, seguem:

[+] - Adicionado

[*] - Alterado

Unit ACBrECFClass ;

{ Definindo novo tipo para armazenar as Formas de Pagamento }

TACBrECFFormaPagamento = class

 private

    fsIndice: String;

    fsDescricao: String;

    fsPermiteVinculado: Boolean;

    fsTotal: Double;

    fsData: TDateTime;

    fsTipoDoc: String;

    fsDebitoCredito: string; //[+]

 public

    constructor create ;

    procedure Assign( AFormaPagamento : TACBrECFFormaPagamento ) ;


    property Indice    : String read fsIndice    write fsIndice ;

    property Descricao : String read fsDescricao write fsDescricao ;

    property PermiteVinculado : Boolean read fsPermiteVinculado

                                       write fsPermiteVinculado ;

    property Total : Double read fsTotal write fsTotal ;

    property Data: TDateTime read fsData write fsData;

    property TipoDoc: String read fsTipoDoc write fsTipoDoc;

    property DebitoCredito: string read fsDebitoCredito write fsDebitoCredito; // [+]

end;
Unit ACBrECF ;
procedure TACBrECF.PafMF_RelMeiosPagamento(

  const AFormasPagamento: TACBrECFFormasPagamento;

  const ATituloRelatorio: String;

  const AIndiceRelatorio: Integer);

var

  DataAtual: TDateTime;

  Relatorio: TStringList;

  I: Integer;

  TamLin: Integer;

  SubTotal: Double;

  FPAcumuladas: TACBrECFFormasPagamento;

  FPTotalizado: TACBrECFFormasPagamento;

  DC: string; // [+]


  function ProcurarFormaPagamento(const AFormaPagto: TACBrECFFormaPagamento;

    const AFormasPagamento: TACBrECFFormasPagamento;

    const AConsideraTipoDoc: Boolean = True) :TACBrECFFormaPagamento;

  var

    I: Integer;

  begin

    Result := nil;

    for I := 0 to AFormasPagamento.Count - 1 do

    begin

      if AConsideraTipoDoc then

      begin

        if (AFormaPagto.Data = AFormasPagamento[I].Data) and

          (AnsiUpperCase(AFormasPagamento[I].Descricao) = AnsiUpperCase(AFormaPagto.Descricao)) and

          (AnsiUpperCase(AFormasPagamento[I].TipoDoc) = AnsiUpperCase(AFormaPagto.TipoDoc)) and

          [color=#FF0040](AnsiUpperCase(AFormasPagamento[I].DebitoCredito) = AnsiUpperCase(AFormaPagto.DebitoCredito))[/color] then

        begin

          Result := AFormasPagamento[I];

          Exit;

        end;

      end

      else

      begin

        if (AFormaPagto.Data = AFormasPagamento[I].Data) and

          (AnsiUpperCase(AFormasPagamento[I].Descricao) = AnsiUpperCase(AFormaPagto.Descricao)) and

          [color=#FF0040](AnsiUpperCase(AFormasPagamento[I].DebitoCredito) = AnsiUpperCase(AFormaPagto.DebitoCredito))[/color] then

        begin

          Result := AFormasPagamento[I];

          Exit;

        end;

      end;

    end;

  end;


  procedure AcumularValorFP(const AFormaPagto: TACBrECFFormaPagamento;

    const AConsideraTipoDoc: Boolean; var ALista: TACBrECFFormasPagamento);

  var

    FP: TACBrECFFormaPagamento;

  begin

    FP := ProcurarFormaPagamento(AFormaPagto, ALista, AConsideraTipoDoc);


    if FP <> nil then

      FP.Total := FP.Total + AFormaPagto.Total

    else

    begin

      with ALista.New do

      begin

        Data      := AFormaPagto.Data;

        Descricao := AFormaPagto.Descricao;

        Total     := AFormaPagto.Total;

        TipoDoc   := AFormaPagto.TipoDoc;

        DebitoCredito := AFormaPagto.DebitoCredito;

      end;

    end;

  end;


  procedure AddCabecalho(const AData: TDateTime);

  begin

    if AData > 0 then

    begin

      Relatorio.Add('');

      Relatorio.Add(ACBrStr('DATA DE ACUMULAÇÃO: ' + FormatDateTime('dd/mm/yyyy', AData) + ''));

    end;


    Relatorio.Add(ACBrStr('Identificação   Tipo                    Valor R$'));

    Relatorio.Add(

      padL('', 15, '-') + ' ' +

      padL('', 19, '-') + ' ' +

      padL('', 12, '-')

    );

  end;


  procedure AddSubTotal;

  begin

    Relatorio.Add('');

    Relatorio.Add(Format('Sub-Total                           %12.2n', [SubTotal]));

    Relatorio.Add('');

    Relatorio.Add('');


    SubTotal  := 0.00;

  end;


begin

  fsNumSerieCache := '' ;  // Isso força a Leitura do Numero de Série

  DoVerificaValorGT ;


  TamLin := ECF.Colunas;


  // montagem do relatorio

  Relatorio := TStringList.Create;

  try

    Relatorio.Clear;

    Relatorio.Add('');


    if AIndiceRelatorio <= 0 then

    begin

      Relatorio.Add('');

      Relatorio.Add('MEIOS DE PAGAMENTO');

      Relatorio.Add('');

      Relatorio.Add('');

    end;


    if Trim(ATituloRelatorio) <> '' then

      Relatorio.Add(PadC(ATituloRelatorio, TamLin));


    // *************************************************************************

    // impressão do relatório acumulando por data, descricao e tipo de documento

    // *************************************************************************

    FPAcumuladas := TACBrECFFormasPagamento.Create;

    FPTotalizado := TACBrECFFormasPagamento.Create;

    try

      // acumular as formas por data, descricao e tipo de documento

      FPAcumuladas.Clear;

      AFormasPagamento.Ordenar;

      for I := 0 to AFormasPagamento.Count - 1 do

        AcumularValorFP(AFormasPagamento[I], True, FPAcumuladas);


      // gerar o relatório

      DataAtual := 0.0;

      FPAcumuladas.Ordenar;

      for I := 0 to FPAcumuladas.Count - 1 do

      begin

        if DataAtual <> FPAcumuladas[I].Data then

        begin

          // SUB-TOTAL

          if (DataAtual > 0) then

            AddSubTotal;


          // cabecalho

          DataAtual := FPAcumuladas[I].Data;

          AddCabecalho(DataAtual);

        end;


        // Atualiza informação de DC = (D)Debito ou (C)Credito // [+]

        if Trim(FPAcumuladas[I].DebitoCredito) <> '' then

          DC := '('+FPAcumuladas[I].DebitoCredito+')'

        else

         DC := ''; 


        // dados dos pagamentos

        Relatorio.Add(Format('%s %s %s', [

          padL(DC+FPAcumuladas[I].Descricao, 15), //[*]

          padL(FPAcumuladas[I].TipoDoc, 19),

          Format('%12.2n', [FPAcumuladas[I].Total])

        ]));


        // acumuladores

        AcumularValorFP(FPAcumuladas[I], True, FPTotalizado);

        SubTotal := SubTotal + FPAcumuladas[I].Total;

      end;


      // sub-total do ultimo dia

      AddSubTotal;


      // ***********************************************************************

      // impressão do total geral

      // ***********************************************************************

      Relatorio.Add('');

      Relatorio.Add(padC('TOTAL GERAL', TamLin));

      if Trim(ATituloRelatorio) <> '' then

        Relatorio.Add(padC(ATituloRelatorio, TamLin));


      Relatorio.Add('');

      Relatorio.Add(ACBrStr('Identificação                           Valor R$'));

      Relatorio.Add(

        PadR('', 27, '-') + ' ' +

        PadR('', 20, '-')

      );


      // acumular os valores totais das formas

      FPAcumuladas.Clear;

      FPTotalizado.Ordenar;

      for I := 0 to FPTotalizado.Count - 1 do

      begin

        FPTotalizado[I].Data := 0;

        AcumularValorFP(FPTotalizado[I], False, FPAcumuladas);

      end;


      // impressão das linhas de totalização

      SubTotal  := 0.00;

      FPAcumuladas.Ordenar;

      for I := 0 to FPAcumuladas.Count - 1 do

      begin

        // Atualiza informação de DC = (D)Debito ou (C)Credito //[+]

        if Trim(FPAcumuladas[I].DebitoCredito) <> '' then

          DC := '('+FPAcumuladas[I].DebitoCredito+')'

        else

         DC := ''; 


        Relatorio.Add(Format('%s %s', [

          padL(DC+FPAcumuladas[I].Descricao, 27), //[*]

          Format('%20.2n', [FPAcumuladas[I].Total]) ]));


        SubTotal := SubTotal + FPAcumuladas[I].Total;

      end;


      // somatorio total

      Relatorio.Add('');

      Relatorio.Add(Format('TOTAL                %27.2n', [SubTotal]));

      Relatorio.Add('');

    finally

      FreeAndNil(FPAcumuladas);

      FPTotalizado.Free;

    end;


    // impressão do relatório

    Self.RelatorioGerencial(Relatorio, 1, AIndiceRelatorio);

  finally

    Relatorio.Free;

  end;

end;

Então fica ai a disposição dos moderadores e colaboradores do fórum, se realmente eu estiver correto, poderão implementar no ACBr.

Link para o comentário
Compartilhar em outros sites

Boa tarde regys.silveira!

Perfeitamente, mas quando o usuario escolhe uma forma de pagamento TEF, por exemplo "Cartao Credito", só que na operação com o GP escolhe Debito ai não vai ficar fiel a informação que será no relatório. Já que tenho meios de testar na aplicação se a operação TEF foi Credito ou Debido posso amarrar isso passando essa informação para o componente.

Exemplo como estou testando:


  if (ACBrTEFD.RespostasPendentes[IndiceTransacaoTef].TipoTransacao >= 10) and

    (ACBrTEFD.RespostasPendentes[IndiceTransacaoTef].TipoTransacao <= 12) then

      TotalTipoPagamento.CartaoDebitoOuCredito := 'C';


 if (ACBrTEFD.RespostasPendentes[IndiceTransacaoTef].TipoTransacao >= 20) and

    (ACBrTEFD.RespostasPendentes[IndiceTransacaoTef].TipoTransacao <= 25) then

       TotalTipoPagamento.CartaoDebitoOuCredito := 'D';

Link para o comentário
Compartilhar em outros sites

Oi regys.silveira, entendi!

Realmente você esta certo, fica a cargo da softhouse fazer esse controle e passar para descrição da forma de pagamento. Mas de qual quer forma já ficam o pessoal avisado. Não tem graça o componente fazer tudo, né!

Esse PAF-ECF ainda vai deixar muita gente doido.

Obrigado pelo pronto atendimento.

Link para o comentário
Compartilhar em outros sites

  • Este tópico foi criado há 4218 dias atrás.
  • Talvez seja melhor você criar um NOVO TÓPICO do que postar uma resposta aqui.

Crie uma conta ou entre para comentar

Você precisar ser um membro para fazer um comentário

Criar uma conta

Crie uma nova conta em nossa comunidade. É fácil!

Crie uma nova conta

Entrar

Já tem uma conta? Faça o login.

Entrar Agora
×
×
  • Criar Novo...

Informação Importante

Colocamos cookies em seu dispositivo para ajudar a tornar este site melhor. Você pode ajustar suas configurações de cookies, caso contrário, assumiremos que você está bem para continuar.