Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool TFrmEDREPGE0::Insere_INFORET(short pIDGroupBox)
- {
- AnsiString lNatRend = edNatRend->Codigo;
- _edrepgres_inforet->empresa = _Empresa;
- _edrepgres_inforet->filial = _Filial;
- _edrepgres_inforet->fornec = edBeneficiario->Codigo;
- _edrepgres_inforet->dt_pgto = data_antiga(edDataPgto->Codigo);
- _edrepgres_inforet->id_interno_pg = _IdInterno;
- _edrepgres_inforet->data_alter = read_date();
- _edrepgres_inforet->hora_alter = read_time();
- memmove(_edrepgres_inforet->arq_orig, "PJ", 2);
- memmove(_edrepgres_inforet->nat_rend, lNatRend.c_str(), 9);
- str_antiga(_edrepgres_inforet->cgc_cpf, _CGC, 14);
- str_antiga(_edrepg->operador, getSession()->Operador(), 10);
- switch (pIDGroupBox)
- {
- case GB_IR: memmove(_edrepgres_inforet->tp_ret, "IR", 2);
- break;
- case GB_CSLL: memmove(_edrepgres_inforet->tp_ret, "CSLL", 4);
- break;
- case GB_PIS: memmove(_edrepgres_inforet->tp_ret, "PIS", 3);
- break;
- case GB_COFINS: memmove(_edrepgres_inforet->tp_ret, "COFINS", 6);
- break;
- }
- //ver se já tem esse registro... se tiver, dá update, se não, include
- _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);
- short lTipoManut;
- if (_edrepgres_inforet->b_status() == 0)
- lTipoManut = tmAlterar;
- else
- lTipoManut = tmIncluir;
- b_begin();
- try
- {
- switch (lTipoManut)
- {
- case tmIncluir: _edrepgres_inforet->b_insert ();
- break;
- case tmAlterar: _edrepgres_inforet->b_update ();
- break;
- }
- if (tem_erro ())
- GErros->Verifica ();
- b_end ();
- }
- catch (Exception &lErro)
- {
- if (b_trans_ativ ())
- b_abort ();
- throw;
- }
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement