Passo a passo: | Pré-requisito indispensável: Realizar o fechamento do dia 31/08/2017, utilizando o Sistema Credimaster; Executar o script enviado para fixação das configurações de mora/permanência sobre as operações emitidas com data igual ou inferior à 31/08/2017. O script deverá ser executado de acordo com o Banco de Dados utilizado por cada cliente:
Banco Oracle create table t402titu_prm as select t.cd_emp, t.cd_und, t.cd_cli, t.nr_ctr, t.nr_adl, t.sg_mod, t.nr_nos_nr, e.sg_ecg, e.id_crt_ope, e.id_fma_a30, e.id_dd_a30, e.tx_prm_a30, e.sg_mon_a30, e.sg_mon_m30, e.id_fma_m30, e.id_dd_m30, e.tx_prm_m30, e.tx_spr_ope, e.id_fma_spr, e.id_bas_spr, e.pc_mlt, e.qt_dd_mlt, e.id_clc_mlt from t402titu t, t402cofi c, t402entx e where t.cd_und = c.cd_und and t.cd_cli = c.cd_cli and c.sg_ecg = e.sg_ecg and c.sg_ecg is not null and t.sg_lin_ope not in ('COB', 'CAU', 'VIN') and t.id_sit_lqd in ('PA', 'PP') and t.id_crt_prm = 'C' and t.dt_ems <= to_date('31-08-2017', 'dd-mm-yyyy') and e.dt_ini_vld = (select max(dt_ini_vld) from t402entx c1 where e.sg_ecg = c1.sg_ecg) union select t.cd_emp, t.cd_und, t.cd_cli, t.nr_ctr, t.nr_adl, t.sg_mod, t.nr_nos_nr, e.sg_ecg, e.id_crt_ope, e.id_fma_a30, e.id_dd_a30, e.tx_prm_a30, e.sg_mon_a30, e.sg_mon_m30, e.id_fma_m30, e.id_dd_m30, e.tx_prm_m30, e.tx_spr_ope, e.id_fma_spr, e.id_bas_spr, e.pc_mlt, e.qt_dd_mlt, e.id_clc_mlt from t402titu t, t402moda m, t402entx e where t.sg_mod = m.sg_mod and e.sg_ecg = m.sg_ecg and m.sg_ecg is not null and t.sg_lin_ope not in ('COB', 'CAU', 'VIN') and t.id_sit_lqd in ('PA', 'PP') and t.id_crt_prm = 'C' and t.dt_ems <= to_date('31-08-2017', 'dd-mm-yyyy') and e.dt_ini_vld = (select max(dt_ini_vld) from t402entx c1 where e.sg_ecg = c1.sg_ecg) and not exists (select 1 from t402cofi cofi where cofi.cd_und = t.cd_und and cofi.cd_cli = t.cd_cli and cofi.sg_ecg is not null ); ALTER TABLE t402titu_prm ADD CONSTRAINT t402titu_prm PRIMARY KEY (cd_emp,cd_und, cd_cli, sg_mod, nr_ctr, nr_adl, nr_nos_nr ); update t402titu a set id_crt_prm = 'T', id_crt_ope = (select b.id_crt_ope from t402titu_prm b where a.cd_emp = b.cd_emp and a.cd_und = b.cd_und and a.cd_cli = b.cd_cli and a.sg_mod = b.sg_mod and a.nr_ctr = b.nr_ctr and a.nr_adl = b.nr_adl and a.nr_nos_nr = b.nr_nos_nr), id_dd_a30 = (select b.id_dd_a30 from t402titu_prm b where a.cd_emp = b.cd_emp and a.cd_und = b.cd_und and a.cd_cli = b.cd_cli and a.sg_mod = b.sg_mod and a.nr_ctr = b.nr_ctr and a.nr_adl = b.nr_adl and a.nr_nos_nr = b.nr_nos_nr), tx_prm_a30 = (select b.tx_prm_a30 from t402titu_prm b where a.cd_emp = b.cd_emp and a.cd_und = b.cd_und and a.cd_cli = b.cd_cli and a.sg_mod = b.sg_mod and a.nr_ctr = b.nr_ctr and a.nr_adl = b.nr_adl and a.nr_nos_nr = b.nr_nos_nr), sg_id_a30 = (select b.sg_mon_a30 from t402titu_prm b where a.cd_emp = b.cd_emp and a.cd_und = b.cd_und and a.cd_cli = b.cd_cli and a.sg_mod = b.sg_mod and a.nr_ctr = b.nr_ctr and a.nr_adl = b.nr_adl and a.nr_nos_nr = b.nr_nos_nr), id_fma_a30 = (select b.id_fma_a30 from t402titu_prm b where a.cd_emp = b.cd_emp and a.cd_und = b.cd_und and a.cd_cli = b.cd_cli and a.sg_mod = b.sg_mod and a.nr_ctr = b.nr_ctr and a.nr_adl = b.nr_adl and a.nr_nos_nr = b.nr_nos_nr), id_dd_m30 = (select b.id_dd_m30 from t402titu_prm b where a.cd_emp = b.cd_emp and a.cd_und = b.cd_und and a.cd_cli = b.cd_cli and a.sg_mod = b.sg_mod and a.nr_ctr = b.nr_ctr and a.nr_adl = b.nr_adl and a.nr_nos_nr = b.nr_nos_nr), tx_prm_m30 = (select b.tx_prm_m30 from t402titu_prm b where a.cd_emp = b.cd_emp and a.cd_und = b.cd_und and a.cd_cli = b.cd_cli and a.sg_mod = b.sg_mod and a.nr_ctr = b.nr_ctr and a.nr_adl = b.nr_adl and a.nr_nos_nr = b.nr_nos_nr), sg_id_m30 = (select b.sg_mon_m30 from t402titu_prm b where a.cd_emp = b.cd_emp and a.cd_und = b.cd_und and a.cd_cli = b.cd_cli and a.sg_mod = b.sg_mod and a.nr_ctr = b.nr_ctr and a.nr_adl = b.nr_adl and a.nr_nos_nr = b.nr_nos_nr), id_fma_m30 = (select b.id_fma_m30 from t402titu_prm b where a.cd_emp = b.cd_emp and a.cd_und = b.cd_und and a.cd_cli = b.cd_cli and a.sg_mod = b.sg_mod and a.nr_ctr = b.nr_ctr and a.nr_adl = b.nr_adl and a.nr_nos_nr = b.nr_nos_nr), vr_tx_spr = (select b.tx_spr_ope from t402titu_prm b where a.cd_emp = b.cd_emp and a.cd_und = b.cd_und and a.cd_cli = b.cd_cli and a.sg_mod = b.sg_mod and a.nr_ctr = b.nr_ctr and a.nr_adl = b.nr_adl and a.nr_nos_nr = b.nr_nos_nr), id_fma_spr = (select b.id_fma_spr from t402titu_prm b where a.cd_emp = b.cd_emp and a.cd_und = b.cd_und and a.cd_cli = b.cd_cli and a.sg_mod = b.sg_mod and a.nr_ctr = b.nr_ctr and a.nr_adl = b.nr_adl and a.nr_nos_nr = b.nr_nos_nr), id_bas_spr = (select b.id_bas_spr from t402titu_prm b where a.cd_emp = b.cd_emp and a.cd_und = b.cd_und and a.cd_cli = b.cd_cli and a.sg_mod = b.sg_mod and a.nr_ctr = b.nr_ctr and a.nr_adl = b.nr_adl and a.nr_nos_nr = b.nr_nos_nr), pc_mlt = (select b.pc_mlt from t402titu_prm b where a.cd_emp = b.cd_emp and a.cd_und = b.cd_und and a.cd_cli = b.cd_cli and a.sg_mod = b.sg_mod and a.nr_ctr = b.nr_ctr and a.nr_adl = b.nr_adl and a.nr_nos_nr = b.nr_nos_nr), qt_dd_mlt = (select b.qt_dd_mlt from t402titu_prm b where a.cd_emp = b.cd_emp and a.cd_und = b.cd_und and a.cd_cli = b.cd_cli and a.sg_mod = b.sg_mod and a.nr_ctr = b.nr_ctr and a.nr_adl = b.nr_adl and a.nr_nos_nr = b.nr_nos_nr and a.pc_mlt is not null), id_clc_mlt = (select b.id_clc_mlt from t402titu_prm b where a.cd_emp = b.cd_emp and a.cd_und = b.cd_und and a.cd_cli = b.cd_cli and a.sg_mod = b.sg_mod and a.nr_ctr = b.nr_ctr and a.nr_adl = b.nr_adl and a.nr_nos_nr = b.nr_nos_nr), id_crt_mlt = 'T' where a.id_sit_lqd in ('PA', 'PP') and a.id_crt_prm = 'C' and exists (select 1 from t402titu_prm c where a.cd_emp = c.cd_emp and a.cd_und = c.cd_und and a.cd_cli = c.cd_cli and a.sg_mod = c.sg_mod and a.nr_ctr = c.nr_ctr and a.nr_adl = c.nr_adl and a.nr_nos_nr = c.nr_nos_nr); commit; update t402tiab a set id_crt_prm = 'T', id_crt_mlt = 'T', pc_mlt = (select b.pc_mlt from t402titu_prm b where a.cd_emp = b.cd_emp and a.cd_und = b.cd_und and a.cd_cli = b.cd_cli and a.sg_mod = b.sg_mod and a.nr_ctr = b.nr_ctr and a.nr_adl = b.nr_adl and a.nr_nos_nr = b.nr_nos_nr), qt_dd_mlt = (select b.qt_dd_mlt from t402titu_prm b where a.cd_emp = b.cd_emp and a.cd_und = b.cd_und and a.cd_cli = b.cd_cli and a.sg_mod = b.sg_mod and a.nr_ctr = b.nr_ctr and a.nr_adl = b.nr_adl and a.nr_nos_nr = b.nr_nos_nr) where exists (select 1 from t402titu_prm c where a.cd_emp = c.cd_emp and a.cd_und = c.cd_und and a.cd_cli = c.cd_cli and a.sg_mod = c.sg_mod and a.nr_ctr = c.nr_ctr and a.nr_adl = c.nr_adl and a.nr_nos_nr = c.nr_nos_nr);
commit; /************************************************************************************/ create table t402entx_res4558 as select * from t402entx;
Banco SQLServer
/*Create table temporária*/
CREATE TABLE t402titu_prm (
cd_emp int not null,
cd_und int not null,
cd_cli int not null,
nr_ctr numeric(10) not null,
nr_adl int not null,
sg_mod char(8) not null,
nr_nos_nr numeric(12) not null,
sg_ecg char(10) not null,
id_crt_ope char(1) null ,
id_fma_a30 char(1) null ,
id_dd_a30 char(1) null ,
tx_prm_a30 numeric(14,7) null ,
sg_mon_a30 char(10) null ,
sg_mon_m30 char(10) null ,
id_fma_m30 char(1) null ,
id_dd_m30 char(1) null ,
tx_prm_m30 numeric(14,7) null ,
tx_spr_ope numeric(14,7) null ,
id_fma_spr char(1) null ,
id_bas_spr char(1) null ,
pc_mlt numeric(5,2) null ,
qt_dd_mlt int null ,
id_clc_mlt char(1) null )
GO
/*Insere dados na temporário*/
INSERT INTO t402titu_prm
select t.cd_emp,
t.cd_und,
t.cd_cli,
t.nr_ctr,
t.nr_adl,
t.sg_mod,
t.nr_nos_nr,
e.sg_ecg,
e.id_crt_ope,
e.id_fma_a30,
e.id_dd_a30,
e.tx_prm_a30,
e.sg_mon_a30,
e.sg_mon_m30,
e.id_fma_m30,
e.id_dd_m30,
e.tx_prm_m30,
e.tx_spr_ope,
e.id_fma_spr,
e.id_bas_spr,
e.pc_mlt,
e.qt_dd_mlt,
e.id_clc_mlt
from t402titu t, t402cofi c, t402entx e
where t.cd_und = c.cd_und
and t.cd_cli = c.cd_cli
and c.sg_ecg = e.sg_ecg
and c.sg_ecg is not null
and t.sg_lin_ope not in ('COB', 'CAU', 'VIN')
and t.id_sit_lqd in ('PA', 'PP')
and t.id_crt_prm = 'C'
and t.dt_ems <= '20170831'
and e.dt_ini_vld =
(select max(dt_ini_vld) from t402entx c1 where e.sg_ecg = c1.sg_ecg)
union
select t.cd_emp,
t.cd_und,
t.cd_cli,
t.nr_ctr,
t.nr_adl,
t.sg_mod,
t.nr_nos_nr,
e.sg_ecg,
e.id_crt_ope,
e.id_fma_a30,
e.id_dd_a30,
e.tx_prm_a30,
e.sg_mon_a30,
e.sg_mon_m30,
e.id_fma_m30,
e.id_dd_m30,
e.tx_prm_m30,
e.tx_spr_ope,
e.id_fma_spr,
e.id_bas_spr,
e.pc_mlt,
e.qt_dd_mlt,
e.id_clc_mlt
from t402titu t, t402moda m, t402entx e
where t.sg_mod = m.sg_mod
and e.sg_ecg = m.sg_ecg
and m.sg_ecg is not null
and t.sg_lin_ope not in ('COB', 'CAU', 'VIN')
and t.id_sit_lqd in ('PA', 'PP')
and t.id_crt_prm = 'C'
and t.dt_ems <= '20170831'
and e.dt_ini_vld =
(select max(dt_ini_vld) from t402entx c1 where e.sg_ecg = c1.sg_ecg)
and not exists (select 1
from t402cofi cofi
where cofi.cd_und = t.cd_und and
cofi.cd_cli = t.cd_cli and
cofi.sg_ecg is not null )
/*Ajusta registro nos títulos */
update t402titu
set id_crt_prm = 'T',
id_crt_ope =
(select b.id_crt_ope
from t402titu_prm b
where t402titu.cd_emp = b.cd_emp
and t402titu.cd_und = b.cd_und
and t402titu.cd_cli = b.cd_cli
and t402titu.sg_mod = b.sg_mod
and t402titu.nr_ctr = b.nr_ctr
and t402titu.nr_adl = b.nr_adl
and t402titu.nr_nos_nr = b.nr_nos_nr),
id_dd_a30 =
(select b.id_dd_a30
from t402titu_prm b
where t402titu.cd_emp = b.cd_emp
and t402titu.cd_und = b.cd_und
and t402titu.cd_cli = b.cd_cli
and t402titu.sg_mod = b.sg_mod
and t402titu.nr_ctr = b.nr_ctr
and t402titu.nr_adl = b.nr_adl
and t402titu.nr_nos_nr = b.nr_nos_nr),
tx_prm_a30 =
(select b.tx_prm_a30
from t402titu_prm b
where t402titu.cd_emp = b.cd_emp
and t402titu.cd_und = b.cd_und
and t402titu.cd_cli = b.cd_cli
and t402titu.sg_mod = b.sg_mod
and t402titu.nr_ctr = b.nr_ctr
and t402titu.nr_adl = b.nr_adl
and t402titu.nr_nos_nr = b.nr_nos_nr),
sg_id_a30 =
(select b.sg_mon_a30
from t402titu_prm b
where t402titu.cd_emp = b.cd_emp
and t402titu.cd_und = b.cd_und
and t402titu.cd_cli = b.cd_cli
and t402titu.sg_mod = b.sg_mod
and t402titu.nr_ctr = b.nr_ctr
and t402titu.nr_adl = b.nr_adl
and t402titu.nr_nos_nr = b.nr_nos_nr),
id_fma_a30 =
(select b.id_fma_a30
from t402titu_prm b
where t402titu.cd_emp = b.cd_emp
and t402titu.cd_und = b.cd_und
and t402titu.cd_cli = b.cd_cli
and t402titu.sg_mod = b.sg_mod
and t402titu.nr_ctr = b.nr_ctr
and t402titu.nr_adl = b.nr_adl
and t402titu.nr_nos_nr = b.nr_nos_nr),
id_dd_m30 =
(select b.id_dd_m30
from t402titu_prm b
where t402titu.cd_emp = b.cd_emp
and t402titu.cd_und = b.cd_und
and t402titu.cd_cli = b.cd_cli
and t402titu.sg_mod = b.sg_mod
and t402titu.nr_ctr = b.nr_ctr
and t402titu.nr_adl = b.nr_adl
and t402titu.nr_nos_nr = b.nr_nos_nr),
tx_prm_m30 =
(select b.tx_prm_m30
from t402titu_prm b
where t402titu.cd_emp = b.cd_emp
and t402titu.cd_und = b.cd_und
and t402titu.cd_cli = b.cd_cli
and t402titu.sg_mod = b.sg_mod
and t402titu.nr_ctr = b.nr_ctr
and t402titu.nr_adl = b.nr_adl
and t402titu.nr_nos_nr = b.nr_nos_nr),
sg_id_m30 =
(select b.sg_mon_m30
from t402titu_prm b
where t402titu.cd_emp = b.cd_emp
and t402titu.cd_und = b.cd_und
and t402titu.cd_cli = b.cd_cli
and t402titu.sg_mod = b.sg_mod
and t402titu.nr_ctr = b.nr_ctr
and t402titu.nr_adl = b.nr_adl
and t402titu.nr_nos_nr = b.nr_nos_nr),
id_fma_m30 =
(select b.id_fma_m30
from t402titu_prm b
where t402titu.cd_emp = b.cd_emp
and t402titu.cd_und = b.cd_und
and t402titu.cd_cli = b.cd_cli
and t402titu.sg_mod = b.sg_mod
and t402titu.nr_ctr = b.nr_ctr
and t402titu.nr_adl = b.nr_adl
and t402titu.nr_nos_nr = b.nr_nos_nr),
vr_tx_spr =
(select b.tx_spr_ope
from t402titu_prm b
where t402titu.cd_emp = b.cd_emp
and t402titu.cd_und = b.cd_und
and t402titu.cd_cli = b.cd_cli
and t402titu.sg_mod = b.sg_mod
and t402titu.nr_ctr = b.nr_ctr
and t402titu.nr_adl = b.nr_adl
and t402titu.nr_nos_nr = b.nr_nos_nr),
id_fma_spr =
(select b.id_fma_spr
from t402titu_prm b
where t402titu.cd_emp = b.cd_emp
and t402titu.cd_und = b.cd_und
and t402titu.cd_cli = b.cd_cli
and t402titu.sg_mod = b.sg_mod
and t402titu.nr_ctr = b.nr_ctr
and t402titu.nr_adl = b.nr_adl
and t402titu.nr_nos_nr = b.nr_nos_nr),
id_bas_spr =
(select b.id_bas_spr
from t402titu_prm b
where t402titu.cd_emp = b.cd_emp
and t402titu.cd_und = b.cd_und
and t402titu.cd_cli = b.cd_cli
and t402titu.sg_mod = b.sg_mod
and t402titu.nr_ctr = b.nr_ctr
and t402titu.nr_adl = b.nr_adl
and t402titu.nr_nos_nr = b.nr_nos_nr),
pc_mlt =
(select b.pc_mlt
from t402titu_prm b
where t402titu.cd_emp = b.cd_emp
and t402titu.cd_und = b.cd_und
and t402titu.cd_cli = b.cd_cli
and t402titu.sg_mod = b.sg_mod
and t402titu.nr_ctr = b.nr_ctr
and t402titu.nr_adl = b.nr_adl
and t402titu.nr_nos_nr = b.nr_nos_nr),
qt_dd_mlt =
(select b.qt_dd_mlt
from t402titu_prm b
where t402titu.cd_emp = b.cd_emp
and t402titu.cd_und = b.cd_und
and t402titu.cd_cli = b.cd_cli
and t402titu.sg_mod = b.sg_mod
and t402titu.nr_ctr = b.nr_ctr
and t402titu.nr_adl = b.nr_adl
and t402titu.nr_nos_nr = b.nr_nos_nr),
id_clc_mlt =
(select b.id_clc_mlt
from t402titu_prm b
where t402titu.cd_emp = b.cd_emp
and t402titu.cd_und = b.cd_und
and t402titu.cd_cli = b.cd_cli
and t402titu.sg_mod = b.sg_mod
and t402titu.nr_ctr = b.nr_ctr
and t402titu.nr_adl = b.nr_adl
and t402titu.nr_nos_nr = b.nr_nos_nr),
id_crt_mlt = 'T'
where t402titu.id_sit_lqd in ('PA', 'PP')
and t402titu.id_crt_prm = 'C'
and exists (select 1
from t402titu_prm c
where t402titu.cd_emp = c.cd_emp
and t402titu.cd_und = c.cd_und
and t402titu.cd_cli = c.cd_cli
and t402titu.sg_mod = c.sg_mod
and t402titu.nr_ctr = c.nr_ctr
and t402titu.nr_adl = c.nr_adl
and t402titu.nr_nos_nr = c.nr_nos_nr)
update t402tiab
set id_crt_prm = 'T',
id_crt_mlt = 'T',
pc_mlt =
(select b.pc_mlt
from t402titu_prm b
where t402tiab.cd_emp = b.cd_emp
and t402tiab.cd_und = b.cd_und
and t402tiab.cd_cli = b.cd_cli
and t402tiab.sg_mod = b.sg_mod
and t402tiab.nr_ctr = b.nr_ctr
and t402tiab.nr_adl = b.nr_adl
and t402tiab.nr_nos_nr = b.nr_nos_nr),
qt_dd_mlt =
(select b.qt_dd_mlt
from t402titu_prm b
where t402tiab.cd_emp = b.cd_emp
and t402tiab.cd_und = b.cd_und
and t402tiab.cd_cli = b.cd_cli
and t402tiab.sg_mod = b.sg_mod
and t402tiab.nr_ctr = b.nr_ctr
and t402tiab.nr_adl = b.nr_adl
and t402tiab.nr_nos_nr = b.nr_nos_nr)
where exists (select 1
from t402titu_prm c
where t402tiab.cd_emp = c.cd_emp
and t402tiab.cd_und = c.cd_und
and t402tiab.cd_cli = c.cd_cli
and t402tiab.sg_mod = c.sg_mod
and t402tiab.nr_ctr = c.nr_ctr
and t402tiab.nr_adl = c.nr_adl
and t402tiab.nr_nos_nr = c.nr_nos_nr);
/************************************************************************************/
select * into t402entx_res4558 from t402entx
Configuração do Critério de Mora: - Acesse o sistema Credimaster, utilizando usuário com privilégios suficientes para execução das alterações nas configurações de Mora:
- Defina a abrangência desejada.
- Acesse a barra de ferramentas Documentos, selecionando a opção Operacionais ou, se preferir, clique sobre o botão localizado no canto direito da tela inicial do sistema Credimaster.
- Clique sobre a aba Mora.
- Localize o critério de mora desejado.
- Clique sobre o botão alterar.
- Altere a forma de cobrança dos encargos de mora “Até 30 dias” e “Mais de 30 dias”, conforme figura abaixo.
8. Clique sobre o botão Salvar.
|