Jump to content

dev botao

LocalizaRegistro SPED PIS COFINS


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

Recommended Posts


    with dtmprincipal.ACBrSpedFiscal1.Bloco_0.Registro0001 do

    begin

      if not Registro0150.LocalizaRegistro(cod_part_exibir) then

      begin

        with Registro0150.New do

        begin

           //preencher aqui os campos

        end;

      end;

    end;


Prezados,

Bom dia,

No SPED FISCAL eu usava o codigo acima para adicionar o registro 0150, ou seja, antes de inserir eu verificava se o mesmo nao existia, mas no sped PIS cofins nao estou conseguindo usar este bloco. A funcao LocalizaRegistro ou substituida por alguma outra? alguem sabe como devo fazer este bloco agora?

Vlw.

Link to comment
Share on other sites

Pessoal,

como não obtive resposta, quebrei a cabeça e criei minha própria função para localizar registros 0150, 0190 e 0200. Seguem os procedimento, caso alguém precise.

Obs: substituir dtmprincipal.acbrpiscofins1 pelo local onde está o componente acbrpiscofins


Function TDtmSpedF_Base.LocalizarRegistro0150(pCOD_EST0140, pCOD_PART0150: string): boolean;

var

  indice140,IntFor150: integer;

begin

  Result := false;

  indice140 := ObterIndiceRegistro0140(pCOD_EST0140);

  if indice140 < 0 then

    raise Exception.Create(pCOD_EST0140 + ' não encontrado no registro 0140');

  with dtmprincipal.ACBrSPEDPisCofins1.Bloco_0.Registro0001 do

  begin

    for IntFor150 := 0 to Registro0140.Items[indice140].Registro0150.Count - 1 do

    begin

      if Registro0140.Items[indice140].Registro0150.Items[IntFor150].COD_PART = pCOD_PART0150 then

      begin

        Result := True;

        Break;

      end;

    end;

  end;

end;


function TDtmSpedF_Base.ObterIndiceRegistro0140(

  pCOD_EST0140: string): integer;

var

  intFor140,IntFor150: integer;

begin

  Result := -1;

  with dtmprincipal.ACBrSPEDPisCofins1.Bloco_0.Registro0001 do

  begin

    for intFor140 := 0 to Registro0140.Count - 1 do

    begin

      if Registro0140.Items[intFor140].COD_EST = pCOD_EST0140 then

      begin

        Result := intFor140;

        Break;

      end;

    end;

  end;

end;


function TDtmSpedF_Base.LocalizarRegistro0190(pCOD_EST0140,

  pUNID: string): boolean;

var

  indice140,IntFor190: integer;

begin

  Result := false;

  indice140 := ObterIndiceRegistro0140(pCOD_EST0140);

  if indice140 < 0 then

    raise Exception.Create(pCOD_EST0140 + ' não encontrado no registro 0140');

  with dtmprincipal.ACBrSPEDPisCofins1.Bloco_0.Registro0001 do

  begin

    for IntFor190 := 0 to Registro0140.Items[indice140].Registro0190.Count - 1 do

    begin

      if Registro0140.Items[indice140].Registro0190.Items[IntFor190].UNID = pUNID then

      begin

        Result := True;

        Break;

      end;

    end;

  end;



end;


function TDtmSpedF_Base.LocalizarRegistro0200(pCOD_EST0140,

  pCOD_ITEM: String): boolean;

var

  indice140,IntFor200: integer;

begin

  Result := false;

  indice140 := ObterIndiceRegistro0140(pCOD_EST0140);

  if indice140 < 0 then

    raise Exception.Create(pCOD_EST0140 + ' não encontrado no registro 0140');

  with dtmprincipal.ACBrSPEDPisCofins1.Bloco_0.Registro0001 do

  begin

    for IntFor200 := 0 to Registro0140.Items[indice140].Registro0200.Count - 1 do

    begin

      if Registro0140.Items[indice140].Registro0200.Items[IntFor200].COD_ITEM = pCOD_ITEM then

      begin

        Result := True;

        Break;

      end;

    end;

  end;

end;



Link to comment
Share on other sites

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.