SHARE
TWEET

Untitled

a guest Aug 23rd, 2019 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. bool TFrmEDREPGE0::Insere_INFORET(short pIDGroupBox)
  2. {
  3.   AnsiString lNatRend = edNatRend->Codigo;
  4.  
  5.   _edrepgres_inforet->empresa       = _Empresa;
  6.   _edrepgres_inforet->filial        = _Filial;
  7.   _edrepgres_inforet->fornec        = edBeneficiario->Codigo;
  8.   _edrepgres_inforet->dt_pgto       = data_antiga(edDataPgto->Codigo);
  9.   _edrepgres_inforet->id_interno_pg = _IdInterno;
  10.   _edrepgres_inforet->data_alter    = read_date();
  11.   _edrepgres_inforet->hora_alter    = read_time();
  12.  
  13.   memmove(_edrepgres_inforet->arq_orig,   "PJ",             2);
  14.   memmove(_edrepgres_inforet->nat_rend,   lNatRend.c_str(), 9);
  15.   str_antiga(_edrepgres_inforet->cgc_cpf, _CGC,            14);
  16.   str_antiga(_edrepg->operador, getSession()->Operador(),  10);  
  17.  
  18.   switch (pIDGroupBox)
  19.   {
  20.     case GB_IR:     memmove(_edrepgres_inforet->tp_ret, "IR",     2);
  21.                     break;
  22.     case GB_CSLL:   memmove(_edrepgres_inforet->tp_ret, "CSLL",   4);
  23.                     break;
  24.     case GB_PIS:    memmove(_edrepgres_inforet->tp_ret, "PIS",    3);
  25.                     break;
  26.     case GB_COFINS: memmove(_edrepgres_inforet->tp_ret, "COFINS", 6);
  27.                     break;
  28.   }  
  29.  
  30.   //ver se já tem esse registro... se tiver, dá update, se não, include
  31.   _edrepgres_inforet->key0(B_GETEQ, _Empresa, _Filial, _edrepgres_inforet->cgc_cpf, _edrepgres_inforet->fornec, _edrepgres_inforet->arq_orig, _edrepgres_inforet->nat_rend, _edrepgres_inforet->dt_pgto, _edrepgres_inforet->id_interno_pg, _edrepgres_inforet->tp_ret);
  32.  
  33.   short lTipoManut;
  34.  
  35.   if (_edrepgres_inforet->b_status() == 0)
  36.     lTipoManut = tmAlterar;
  37.   else
  38.     lTipoManut = tmIncluir;
  39.  
  40.   b_begin();
  41.  
  42.   try
  43.   {
  44.     switch (lTipoManut)
  45.     {
  46.       case tmIncluir: _edrepgres_inforet->b_insert ();
  47.                       break;
  48.       case tmAlterar: _edrepgres_inforet->b_update ();
  49.                       break;
  50.     }
  51.  
  52.     if (tem_erro ())
  53.       GErros->Verifica ();
  54.  
  55.     b_end ();
  56.   }
  57.   catch (Exception &lErro)
  58.   {
  59.     if (b_trans_ativ ())
  60.       b_abort ();
  61.  
  62.     throw;
  63.   }
  64.  
  65.   return true;
  66. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top