Árvore de páginas

Ponto-de-Entrada: VM011PFIN - Preenchimento de campo
Abrangências: Advanced Protheus 6.09 , Advanced Protheus 7.10 , Microsiga Protheus 8.11 , Microsiga Protheus 10
Versões: Todas
Compatível Países: Todos
Sistemas Operacionais: Todos
Compatível às Bases de Dados: Todos
Descrição:
O ponto de entrada VM011PFIN está localizado na rotina de Cálculo das Parcelas de Financiamento do Atendimento de Veículos. Ele é chamado ao se preencher o campo "Forma Pagto", "TES" ou clicar em "Calcular" na terceira tela da rotina de Atendimento (VEIVM011).
Eventos

Function FS_CALC011()

 

Local cont

Local cDia

Local nMes

Local nMesAnt

Local nValFin := 0

 

FS_VALOR011()

 

lCalcVEI := .f.

 

nValFin := (M->VV0_VALTOT-Round(nAcresFin,2))-nTotalEnt-M->VV0_VALFIN

If Round(nAcresFin,2) > 0

                M->VV0_VALTOT -= Round(nAcresFin,2)

Endif

 

if nValFin < 0

                nValFin := 0

Endif

nAcresFin := 0

dbSelectarea("SE4")

dbSetOrder(1)

if dbSeek(xFilial("SE4")+M->VV0_FORPAG)

                if (!AllTrim(SE4->E4_COND) == "0" .or. SE4->E4_TIPO == "A") .and. M->VV0_TIPFIN <> "1"

                               FG_CONDICAO(M->VV0_DATINI,strzero(M->VV0_DIA1PC,4),strzero(M->VV0_PARCEL,4),strzero(M->VV0_INTERV,4),"1","VV0_FORPAG",nValFin,cTipOpe)

                               if M->VV0_FIXDIA == "1" .and. Val(M->VV0_DIAFIX) > 0 .and. Val(M->VV0_DIAFIX) < 32

                                               cDia    := M->VV0_DIAFIX

                                               nMesAnt := 0

                                               For cont := 1 to Len(aIteParc)

                                                               if Val(cDia) > Day(LastDay(aIteParc[cont,1]))

                                                                              cDia := Str(Day(LastDay(aIteParc[cont,1])),2)

                                                               Else

                                                                              cDia := M->VV0_DIAFIX

                                                               Endif

                                                               cDia := StrZero(Val(cDia),2)

                                                               nMes := Month(aIteParc[cont,1])

                                                               if nMesAnt == nMes

                                                                              nMes := Month(aIteParc[cont,1])+1

                                                               Endif

                                                               aIteParc[cont,1] := ctod(cDia+'/'+StrZero(nMes,2)+"/"+Substr(Str(Year(aIteParc[cont,1]),4),3,2))

                                                               nMesAnt := nMes

                                               Next

                               Endif

                               /// PROBLEMA aIteParc *********************************************************************** ///

                                   If M->VV0_TIPFIN == "0" // Faturamento Proprio

                                               if M->VV0_COEFIC > 0                 

                                              

                                                               If MsgYesno("Valores de Parcela linear?",OemToAnsi(STR0012))

                                                                              nCoef   := (M->VV0_COEFIC/30)*M->VV0_INTERV

                                                                              nCoefic := 1+(nCoef/100)

                                                                              nParcAnt := aIteParc[1,2]

                                                                              nTotal  := 0     

                                                                              nTotAnt := 0    

                                                                              For cont := 1 to Len(aIteParc)             

                                                                                              nTotAnt += aIteParc[cont,2]

                                                                                              aIteParc[cont,2] := nParcAnt * nCoefic

                                                                                              nParcAnt := aIteParc[cont,2]

                                                                                              nTotal += nParcAnt

                                                                              Next           

                                                                              For cont := 1 to Len(aIteParc)             

                                                                                              aIteParc[cont,2] := nTotal/Len(aIteParc)

                                                                              Next           

                                                                              nAcresFin := nTotal - nTotAnt

                                                                              M->VV0_VALTOT += naCresFin

                                                                             

                                                               Else

               

                                                                              // Juro Composto     

                                                                              nCoef   := (M->VV0_COEFIC/30)*M->VV0_INTERV

                                                                              nCoefic := 1+(nCoef/100)

                                                                              nParcAnt := aIteParc[1,2]

                                                                              nTotal  := 0

                                                                              nTotAnt := 0

                                                                              For cont := 1 to Len(aIteParc)             

                                                                                              nTotAnt += aIteParc[cont,2]

                                                                                              aIteParc[cont,2] := nParcAnt * nCoefic

                                                                                              nParcAnt := aIteParc[cont,2]

                                                                                              nTotal  += nParcAnt

                                                                              Next           

                                                                              nAcresFin := nTotal - nTotAnt

                                                                              M->VV0_VALTOT += naCresFin

                                                               Endif                                                   

                                                              

                                               Endif

                               Endif

                Else

                               dDatPar := dDataBase

                               if !Empty(M->VV0_DATINI)

                                               dDatPar := M->VV0_DATINI

                               Endif

                               aIteParc := {{dDatPar,M->VV0_VALTOT-nTotalEnt-M->VV0_VALFIN}}

                Endif

Endif

 

If ( ExistBlock("VM011PFIN") )// Altera Parcelas do Financiamento (aIteParc)

                aParcFin := ExecBlock("VM011PFIN",.F.,.F.,{aIteParc})

                If ( ValType(aParcFin) == "A" )

                               aIteParc := aClone(aParcFin)

                EndIf

EndIf

 

if lTroco .and. nValFin <= 0  //M->VV0_VALFIN == M->VV0_VALTOT

                nValPar  := 0

                aIteParc := {{cTod(""),0}}

Endif

 

if Type("oLbParc") <> "U"

                oLbParc:SetArray(aIteParc)

                oLbParc:bLine := { || { dToc(aIteParc[oLbParc:nAt,1]),;

                Transform(aIteParc[oLbParc:nAt,2],"@E 999,999,999.99")}}

                oLbParc:Refresh()

Endif

 

lJaCal011 := .t.

 

Return(.t.)

 

Programa Fonte
VEIVM011, VM011PFIN
Sintaxe

VM011PFIN - Preenchimento de campo ( < aIteParc> , [ ] ) --> aParcelas

Parâmetros:
Nome Tipo Descrição Default Obrigatório Referência
aIteParc Array of Record Contém as parcelas do financiamento. X
Array of Record
Retorno
    aParcelas(array_of_record)
  • Retorna as parcelas com os valores modificados de acordo com a necessidade.
Exemplos
/*ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜܱ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±ÚÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄ¿±±±±³Fun‡„o    ³ VM011PFIN    ³ Autor ³ Manoel Filho       ³ Data ³ 02/04/10 ³±±±±ÃÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄ´±±±±³Descri‡„o ³ Ponto de entrada que permite a Alteracao das Parcelas de Financiamento     ³±±±±ÃÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´±±±±³Uso       ³                                                            ³±±±±ÀÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß*/User Function VM011PFIN(aParc)aParcelas := ParamIxb[1]// Modificacao de acordo com a necessidade da EmpresaReturn(aParcelas)  
Variáveis
Nome Tipo Escopo Pode Alterar descrição
Array of Record Global Não