bom, como disse eu mesmo dias atrás... estou aqui para testar as soluções dos nobres professores:
Código: Selecionar todos
for nPARC := 1 to mQT_PARC
if nPARC = 1
replace CDFORNECE with mCDFORNECE,;
NUTITULO with left ( alltrim ( str ( mNU_NF ) ) , 9 ) + alltrim ( str ( nPARC ) ),;
DSHISTORI with mDSHISTORI,;
VRTITUTLO with mVR_PARC1,;
DT_VENCTO with mVCT_PARC1,;
CD_TIPCOB with mCD_TIPCOB,;
CDCON_BAN with "",;
VRJUROS with 0,;
CD_DESPES with mCD_DESPES,;
CD_SITTIT with 'A',;
CD_CHEGDP with mCD_CHEGDP,;
CD_CONTAB with ""
elseif nPARC = 2
replace CDFORNECE with mCDFORNECE,;
NUTITULO with left ( alltrim ( str ( mNU_NF ) ) , 9 ) + alltrim ( str ( nPARC ) ),;
DSHISTORI with mDSHISTORI,;
VRTITUTLO with mVR_PARC1,;
DT_VENCTO with mVCT_PARC1,;
VRTITUTLO with mVR_PARC2,;
DT_VENCTO with mVCT_PARC2,;
CD_TIPCOB with mCD_TIPCOB,;
CDCON_BAN with "",;
VRJUROS with 0,;
CD_DESPES with mCD_DESPES,;
CD_SITTIT with 'A',;
CD_CHEGDP with mCD_CHEGDP,;
CD_CONTAB with ""
elseif nPARC = 3
replace CDFORNECE with mCDFORNECE,;
NUTITULO with left ( alltrim ( str ( mNU_NF ) ) , 9 ) + alltrim ( str ( nPARC ) ),;
DSHISTORI with mDSHISTORI,;
VRTITUTLO with mVR_PARC1,;
DT_VENCTO with mVCT_PARC1,;
VRTITUTLO with mVR_PARC2,;
DT_VENCTO with mVCT_PARC2,;
VRTITUTLO with mVR_PARC3,;
DT_VENCTO with mVCT_PARC3,;
CD_TIPCOB with mCD_TIPCOB,;
CDCON_BAN with "",;
VRJUROS with 0,;
CD_DESPES with mCD_DESPES,;
CD_SITTIT with 'A',;
CD_CHEGDP with mCD_CHEGDP,;
CD_CONTAB with ""
elseif nPARC = 4
replace CDFORNECE with mCDFORNECE,;
NUTITULO with left ( alltrim ( str ( mNU_NF ) ) , 9 ) + alltrim ( str ( nPARC ) ),;
DSHISTORI with mDSHISTORI,;
VRTITUTLO with mVR_PARC1,;
DT_VENCTO with mVCT_PARC1,;
VRTITUTLO with mVR_PARC2,;
DT_VENCTO with mVCT_PARC2,;
VRTITUTLO with mVR_PARC3,;
DT_VENCTO with mVCT_PARC3,;
VRTITUTLO with mVR_PARC4,;
DT_VENCTO with mVCT_PARC4,;
CD_TIPCOB with mCD_TIPCOB,;
CDCON_BAN with "",;
VRJUROS with 0,;
CD_DESPES with mCD_DESPES,;
CD_SITTIT with 'A',;
CD_CHEGDP with mCD_CHEGDP,;
CD_CONTAB with ""
elseif nPARC = 5
replace CDFORNECE with mCDFORNECE,;
NUTITULO with left ( alltrim ( str ( mNU_NF ) ) , 9 ) + alltrim ( str ( nPARC ) ),;
DSHISTORI with mDSHISTORI,;
VRTITUTLO with mVR_PARC1,;
DT_VENCTO with mVCT_PARC1,;
VRTITUTLO with mVR_PARC2,;
DT_VENCTO with mVCT_PARC2,;
VRTITUTLO with mVR_PARC3,;
DT_VENCTO with mVCT_PARC3,;
VRTITUTLO with mVR_PARC4,;
DT_VENCTO with mVCT_PARC4,;
VRTITUTLO with mVR_PARC5,;
DT_VENCTO with mVCT_PARC5,;
CD_TIPCOB with mCD_TIPCOB,;
CDCON_BAN with "",;
VRJUROS with 0,;
CD_DESPES with mCD_DESPES,;
CD_SITTIT with 'A',;
CD_CHEGDP with mCD_CHEGDP,;
CD_CONTAB with ""
elseif nPARC = 6
replace CDFORNECE with mCDFORNECE,;
NUTITULO with left ( alltrim ( str ( mNU_NF ) ) , 9 ) + alltrim ( str ( nPARC ) ),;
DSHISTORI with mDSHISTORI,;
VRTITUTLO with mVR_PARC1,;
DT_VENCTO with mVCT_PARC1,;
VRTITUTLO with mVR_PARC2,;
DT_VENCTO with mVCT_PARC2,;
VRTITUTLO with mVR_PARC3,;
DT_VENCTO with mVCT_PARC3,;
VRTITUTLO with mVR_PARC4,;
DT_VENCTO with mVCT_PARC4,;
VRTITUTLO with mVR_PARC5,;
DT_VENCTO with mVCT_PARC5,;
VRTITUTLO with mVR_PARC6,;
DT_VENCTO with mVCT_PARC6,;
CD_TIPCOB with mCD_TIPCOB,;
CDCON_BAN with "",;
VRJUROS with 0,;
CD_DESPES with mCD_DESPES,;
CD_SITTIT with 'A',;
CD_CHEGDP with mCD_CHEGDP,;
CD_CONTAB with ""
elseif nPARC = 7
replace CDFORNECE with mCDFORNECE,;
NUTITULO with left ( alltrim ( str ( mNU_NF ) ) , 9 ) + alltrim ( str ( nPARC ) ),;
DSHISTORI with mDSHISTORI,;
VRTITUTLO with mVR_PARC1,;
DT_VENCTO with mVCT_PARC1,;
VRTITUTLO with mVR_PARC2,;
DT_VENCTO with mVCT_PARC2,;
VRTITUTLO with mVR_PARC3,;
DT_VENCTO with mVCT_PARC3,;
VRTITUTLO with mVR_PARC4,;
DT_VENCTO with mVCT_PARC4,;
VRTITUTLO with mVR_PARC5,;
DT_VENCTO with mVCT_PARC5,;
VRTITUTLO with mVR_PARC6,;
DT_VENCTO with mVCT_PARC6,;
VRTITUTLO with mVR_PARC7,;
DT_VENCTO with mVCT_PARC7,;
CD_TIPCOB with mCD_TIPCOB,;
CDCON_BAN with "",;
VRJUROS with 0,;
CD_DESPES with mCD_DESPES,;
CD_SITTIT with 'A',;
CD_CHEGDP with mCD_CHEGDP,;
CD_CONTAB with ""
endif
// MOVE_MEMORIA_ARQUIVO ()
// unlock
// commit
next
esta é apenas a parte do REPLACE, tem também a do APPEND BLANK que é semelhante.
bom, tá ficando muito grande, e penso que podemos diminuir isso daqui, mas, não consegui encaixar ou entender nenhum dos exemplos citados anteriormente (como Jairo disse) e etc...
as variáveis/campos VR_PARC (de 1 a 7) com suas respectivas VCT_PARC são preenchidas no momento em que o usuário decide em quantas parcelas irá lançar... ele tem 7 opções, como disse.
Então, uso o FOR/NEXT para isso... mas penso que poderíamos gravar de 1 a 7 em menos linhas.
só não consegui ainda encaixar os exemplos citados para isso ocorrer.