<?xml version="1.0" encoding="UTF-8"?>
<part class="form">
  <style>
    <property name="Geometry">{312,17,1021,733}</property>
    <property name="Name">[planos.scr]</property>
    <property name="Caption">[Selecao do Parcelemanto]</property>
    <property name="AlwaysOnTop">.F.</property>
    <property name="AutoCenter">.T.</property>
    <property name="Font">
      <font name="Verdana" width="0" height="-13" weight="400"/>
    </property>
    <property name="FormType">[dlgModal]</property>
    <property name="Modal">.F.</property>
    <property name="ScopeVarObj">[Private]</property>
    <property name="lClipper">.T.</property>
    <property name="lExitOnEnter">.F.</property>
    <property name="lExitOnESC">.T.</property>
    <property name="FromStyle">[Center]</property>
    <property name="Clipsiblings">.F.</property>
    <property name="Clipchildren">.F.</property>
    <property name="TitleBar">.T.</property>
    <property name="StyleBorder">[3 - Sizable (Default)]</property>
    <property name="nBackColor">14215660</property>
    <property name="Icon">[]</property>
    <property name="Bitmap">[icon\tela.jpg]</property>
    <property name="NoIcon">.F.</property>
    <property name="SystemMenu">.T.</property>
    <property name="Minimizebox">.F.</property>
    <property name="Maximizebox">.T.</property>
    <property name="AbsAlignment">.T.</property>
    <property name="WindowState">[1 - Normal (Default)]</property>
    <property name="minHeight">-1</property>
    <property name="maxHeight">-1</property>
    <property name="minWidth">-1</property>
    <property name="maxWidth">-1</property>
    <property name="ScrollBars">[0 - None (Default)]</property>
    <property name="DSControl">.F.</property>
  </style>
  <method name="onDlgInit">
    <![CDATA[parameters oDlg
//skel VARIAVEL zbParcela = {||Str(FPARCELAS,3)+" x "+Transform((cr_valor+wTAC_acrescimo-wValEntradaDoPlano)/FPARCELAS,"@e 999,999.99")}
//skel VARIAVEL zValorTotalAparcelar:=cr_valor
//skel VARIAVEL zValFinal:=0
//skel VARIAVEL zValPrimeiraOuUltima:=0
//skel VARIAVEL wValAjustadoDaParcela:=0
//skel VARIAVEL zbDefineValParcela:={||wValAjustadoDaParcela:=if(fParcelas>0, ROUND((cr_valor+wTAC_acrescimo-wValEntradaDoPlano)/FPARCELAS,2),0) , zValPrimeiraOuUltima:=(cr_valor+wTAC_acrescimo-wValEntradaDoPlano)-wValAjustadoDaParcela*(FPARCELAS-1), zValFinal:=cr_valor+wTAC_acrescimo, RefreshGetList()}

d_ob:lEditable = .f.
oContextMenu:=Hwg_ContextMenu()
hwg_Btn(oToolbar,10,625,143,75)
hwg_TbMt(oToolbar,'13;(wOpcao:="pede_desconto_no_fechamento",hwg_oDlgKey(oDlg,27,nBrwAtivo));Enter-Plano com Acrescimo/Desconto;Enter-Confirma Plano com Acrescimo/Desconto;sembitmap;;;Lucida Bright;-12;Enter - Confirma Plano com Acrescimo ou &Desconto;')
hwg_TbMt(oToolbar,'32;(wOpcao:="nao_pede_desconto_no_fechamento",hwg_oDlgKey(oDlg,27,nBrwAtivo));Barra-Fecha Venda;Barra-Fecha Venda;sembitmap;;;Lucida Bright;-12;Barra - Confirma Plano e &Fecha Venda;')
hwg_TbMt(oToolbar,'27;hwg_oDlgKey(oDlg,27,nBrwAtivo);Saida;Seleciona Outro Plano;sembitmap;;;Lucida Bright;-12;Esc - Volta e Seleciona Outro Plano;')
SetDlgKey(oDlg,8,26,{|| (aBrowses[nBrwAtivo,2])->(moveRec(aBrowses[nBrwAtivo,1],"UP"))})
SetDlgKey(oDlg,8,28,{|| (aBrowses[nBrwAtivo,2])->(moveRec(aBrowses[nBrwAtivo,1],"DOWN"))})
Hwg_EndMenu() 

EVAL(zbDefineValParcela)

]]>
  </method>
  <method name="onPaint">
    <![CDATA[Parameters oCtrl,hDC
oCtrl:bpaint:=NIL
D_oB:setFocus()]]>
  </method>
  <part class="status">
    <style>
      <property name="Geometry">{0,703,1021,30}</property>
      <property name="Name">[oDlgStatusBar]</property>
      <property name="aParts">{608,152,0}</property>
    </style>
  </part>
  <part class="editbox">
    <style>
      <property name="Geometry">{169,106,99,41}</property>
      <property name="Name">[owTAC_acrescimo]</property>
      <property name="varName">[wTAC_acrescimo]</property>
      <property name="BackColor">15794175</property>
      <property name="font">
        <font name="Segoe UI" width="0" height="-19" weight="700"/>
      </property>
      <property name="cPicture">[@e 999,999.99]</property>
      <property name="nMaxLength">10</property>
      <property name="ToolTip">
[Taxa de Abertura de Credito ou de Parcelamento:]      </property>
      <property name="TabIndex">0</property>
    </style>
    <method name="onLostFocus">
      <![CDATA[IF wTAC_acrescimo<0
  ALERT("Valor da TAC Invalida!")
  wTAC_acrescimo:=0
  RETURN .f.
ENDIF
zValFinal:=cr_valor+wTAC_acrescimo
RefreshGetList()
RETURN DobRefresh()
]]>
    </method>
  </part>
  <part class="editbox">
    <style>
      <property name="Geometry">{28,106,114,41}</property>
      <property name="Name">[ozValorTotalAparcelar]</property>
      <property name="varName">[zValorTotalAparcelar]</property>
      <property name="BackColor">15794175</property>
      <property name="font">
        <font name="Segoe UI" width="0" height="-21" weight="700"/>
      </property>
      <property name="cPicture">[@e 999,999.99]</property>
      <property name="nMaxLength">10</property>
      <property name="ToolTip">
[Taxa de Abertura de Credito ou de Parcelamento:]      </property>
      <property name="TabIndex">1</property>
    </style>
    <method name="onGetFocus">
      <![CDATA[.f.]]>
    </method>
  </part>
  <part class="editbox">
    <style>
      <property name="Geometry">{309,106,143,41}</property>
      <property name="Name">[ozValFinal]</property>
      <property name="varName">[zValFinal]</property>
      <property name="BackColor">15794175</property>
      <property name="font">
        <font name="Segoe UI" width="0" height="-24" weight="700"/>
      </property>
      <property name="cPicture">[@e 999,999.99]</property>
      <property name="nMaxLength">10</property>
      <property name="ToolTip">
[Taxa de Abertura de Credito ou de Parcelamento:]      </property>
      <property name="TabIndex">1</property>
    </style>
    <method name="onLostFocus">
      <![CDATA[IF zValFinal<Cr_Valor
  ALERT("Valor Liquido Invalido!")
  zValFinal:=Cr_Valor
  wTAC_acrescimo:=0
  RefreshGetList()
  RETURN .f.
ENDIF
wTAC_acrescimo:=zValFinal-cr_valor
RefreshGetList()
RETURN DobRefresh()
]]>
    </method>
  </part>
  <part class="editbox">
    <style>
      <property name="Geometry">{28,218,428,104}</property>
      <property name="Name">[ofValEntrada]</property>
      <property name="varName">[wValEntradaDoPlano]</property>
      <property name="BackColor">15794175</property>
      <property name="font">
        <font name="Segoe UI" width="0" height="-64" weight="700"/>
      </property>
      <property name="cPicture">[@e 999,999.99]</property>
      <property name="nMaxLength">10</property>
      <property name="TabIndex">2</property>
    </style>
    <method name="onLostFocus">
      <![CDATA[IF wValEntradaDoPlano>=0 .and. wValEntradaDoPlano<=zValorTotalAparcelar
   DobRefresh()
   RETURN .t.
ELSE
   ALERT("O valor da Entrada deve ser ate R$ "+LTRIM(STR(zValorTotalAparcelar,12,2)))
   RETURN .f.
ENDIF
]]>
    </method>
  </part>
  <part class="checkbox">
    <style>
      <property name="Geometry">{99,358,279,42}</property>
      <property name="Name">[oCheck1]</property>
      <property name="varName">[wFgFixaDiaDeParcelasDoPlano]</property>
      <property name="Caption">[Fixa o Vencimento para o dia:]</property>
      <property name="WordWrap">.T.</property>
      <property name="font">
        <font name="Segoe UI" width="0" height="-19" weight="400"/>
      </property>
      <property name="Transparent">.T.</property>
      <property name="TabIndex">3</property>
    </style>
    <method name="onClick">
      <![CDATA[IF wFgFixaDiaDeParcelasDoPlano
   wDiaDeVencimentoDasParcelas:=Day(s_dAtual)
ELSE
   wDiaDeVencimentoDasParcelas:=0
ENDIF
RefreshGetList()
]]>
    </method>
  </part>
  <part class="browse">
    <style>
      <property name="Geometry">{501,78,510,622}</property>
      <property name="Name">[D_oB]</property>
      <property name="Anchor">15</property>
      <property name="font">
        <font name="Segoe UI" width="0" height="-48" weight="400"/>
      </property>
      <property name="GridLinesSepColor">0</property>
      <property name="TabIndex">4</property>
    </style>
    <method name="onGetFocus">
      <![CDATA[nBrwAtivo:=1]]>
    </method>
    <method name="onPosChange">
      <![CDATA[EVAL(zbDefineValParcela)]]>
    </method>
    <method name="onInit">
      <![CDATA[hwg_TbFi(D_oB, 'Parcelamento;eVal(zbParcela);P;@S25;18;N;')
//hwg_TbFi(D_oB, 'Recalc;Changed;C;X; 6;;')
//hwg_TbFi(D_oB, 'ValProds;fValProd;N;9999.99; 7;;')
//hwg_TbFi(D_oB, 'ValVenda;fVal;N;9999.99; 7;;')
//hwg_TbFi(D_oB, 'DscProds;fValDscPrd;N;9999.99; 7;;')
//hwg_TbFi(D_oB, '**;FDSCADIC;N;9999.99; 7;;')
//hwg_TbFi(D_oB, '*;if(FDSCADIC>0,"*","");C;!; 1;;')
d_ob:lEditable = .f.
D_oB:bColorSel:= RGB(3,23,133)
D_oB:tColorSel:= RGB(255,255,255)
D_oB:Alias := alias()
D_oB:lDisableVScrollPos := .t.
D_oB:bKeyDown := {|self, wParam| (aBrowses[nBrwAtivo,2])->(hwg_oDlgKey(self, wparam,1)) , .T. }
D_oB:bOther:={|o,m,wp,lp| MessagesBrowse(o,m,wp,lp)}
D_oB:cargo:={.T.,.T.,"PLANOS",.F.,.T.,{||.T.} }
// d_ob:bEdit := {|D_oB| nKey:=13, ProcessaEscolhaDaListaDePlanos()}
AADD(aBrowses,{D_oB,D_oB:Alias,{||.f.},{|| .T.},})
]]>
    </method>
  </part>
  <part class="editbox">
    <style>
      <property name="Geometry">{384,358,64,41}</property>
      <property name="Name">[owDiaDeVencimentoDasParcelas]</property>
      <property name="varName">[wDiaDeVencimentoDasParcelas]</property>
      <property name="BackColor">15794175</property>
      <property name="font">
        <font name="Segoe UI" width="0" height="-27" weight="700"/>
      </property>
      <property name="cPicture">[99]</property>
      <property name="nMaxLength">10</property>
      <property name="TabIndex">4</property>
    </style>
    <method name="onLostFocus">
      <![CDATA[IF .not. (wDiaDeVencimentoDasParcelas>=0.AND.wDiaDeVencimentoDasParcelas<=31)
   ALERT("Voce deve confirmar um dia de vencimento valido!")
   RETURN .f.
ENDIF
RETURN .t.
]]>
    </method>
    <method name="onGetFocus">
      <![CDATA[//
RETURN wFgFixaDiaDeParcelasDoPlano]]>
    </method>
  </part>
  <part class="editbox">
    <style>
      <property name="Geometry">{80,471,147,41}</property>
      <property name="Name">[owValAjustadoDaParcela]</property>
      <property name="varName">[wValAjustadoDaParcela]</property>
      <property name="BackColor">15794175</property>
      <property name="font">
        <font name="Segoe UI" width="0" height="-27" weight="700"/>
      </property>
      <property name="cPicture">[@e 999,999.99]</property>
      <property name="nMaxLength">10</property>
      <property name="TabIndex">5</property>
    </style>
    <method name="onLostFocus">
      <![CDATA[IF wValAjustadoDaParcela<=0
   ALERT("Voce deve confirmar uma valor da percela!")
   RETURN .f.
ENDIF
 
IF ( (cr_valor+wTAC_acrescimo-wValEntradaDoPlano) - wValAjustadoDaParcela*(FPARCELAS-1) ) > 0
   zValPrimeiraOuUltima := (cr_valor+wTAC_acrescimo-wValEntradaDoPlano) - wValAjustadoDaParcela*(FPARCELAS-1)
   RETURN RefreshGetList()
ELSE
   ALERT("A parcela padrao nao pode ter valor R$ "+ALLTRIM(STR(wValAjustadoDaParcela,12,2))+"!;;Senao ovalor da primeira ou ultima parcela;ficaria negativo com valor de R$ "+LTRIM(STR(( (cr_valor-wValEntradaDoPlano) - wValAjustadoDaParcela*(FPARCELAS-1) ),12,2)))
   EVAL(zbDefineValParcela)
   RETURN .f.
ENDIF
]]>
    </method>
  </part>
  <part class="label">
    <style>
      <property name="Geometry">{24,7,847,59}</property>
      <property name="Name">[oLabel3]</property>
      <property name="Caption">[(&quot;Plano &quot;+Str(m_fplanopag,3)+&quot;: &quot;+pDesc)]</property>
      <property name="font">
        <font name="Arial" width="0" height="-37" weight="700"/>
      </property>
      <property name="Transparent">.T.</property>
      <property name="TabIndex">6</property>
    </style>
  </part>
  <part class="editbox">
    <style>
      <property name="Geometry">{299,471,155,41}</property>
      <property name="Name">[ozValPrimeiraOuUltima]</property>
      <property name="varName">[zValPrimeiraOuUltima]</property>
      <property name="BackColor">15794175</property>
      <property name="font">
        <font name="Segoe UI" width="0" height="-27" weight="700"/>
      </property>
      <property name="cPicture">[@e 999,999.99]</property>
      <property name="nMaxLength">10</property>
      <property name="TabIndex">6</property>
    </style>
    <method name="onGetFocus">
      <![CDATA[.f.]]>
    </method>
  </part>
  <part class="checkbox">
    <style>
      <property name="Geometry">{111,530,344,51}</property>
      <property name="Name">[owFgLancaDifParcelasNaPrimeira]</property>
      <property name="lInitValue">.T.</property>
      <property name="varName">[wFgLancaDifParcelasNaPrimeira]</property>
      <property name="Caption">
[Lanca a diferenca de centavos ou arredondamento na primeira parcela]      </property>
      <property name="WordWrap">.T.</property>
      <property name="font">
        <font name="Segoe UI" width="0" height="-19" weight="400"/>
      </property>
      <property name="Transparent">.T.</property>
      <property name="TabIndex">7</property>
    </style>
  </part>
  <part class="label">
    <style>
      <property name="Geometry">{28,161,428,58}</property>
      <property name="Name">[oLabel1]</property>
      <property name="Caption">[Valor da Entrada]</property>
      <property name="Justify">[Center]</property>
      <property name="font">
        <font name="Segoe UI" width="0" height="-35" weight="400"/>
      </property>
      <property name="Transparent">.T.</property>
      <property name="TabIndex">8</property>
    </style>
  </part>
  <part class="label">
    <style>
      <property name="Geometry">{16,439,211,31}</property>
      <property name="Name">[oLabel2]</property>
      <property name="Caption">[Valor da Parcela Padrao]</property>
      <property name="Justify">[Right]</property>
      <property name="font">
        <font name="Segoe UI" width="0" height="-19" weight="400"/>
      </property>
      <property name="Transparent">.T.</property>
      <property name="TabIndex">8</property>
    </style>
  </part>
  <part class="label">
    <style>
      <property name="Geometry">{283,439,171,30}</property>
      <property name="Name">[oLabel4]</property>
      <property name="Caption">[Valor da Primeira]</property>
      <property name="Justify">[Right]</property>
      <property name="font">
        <font name="Segoe UI" width="0" height="-19" weight="400"/>
      </property>
      <property name="Transparent">.T.</property>
      <property name="TabIndex">8</property>
    </style>
  </part>
  <part class="label">
    <style>
      <property name="Geometry">{169,73,100,31}</property>
      <property name="Name">[oLabel5]</property>
      <property name="Caption">[TAC - Taxa Abertura de Credito]</property>
      <property name="Justify">[Right]</property>
      <property name="font">
        <font name="Segoe UI" width="0" height="-11" weight="400"/>
      </property>
      <property name="Transparent">.T.</property>
      <property name="TabIndex">8</property>
    </style>
  </part>
  <part class="label">
    <style>
      <property name="Geometry">{36,75,106,31}</property>
      <property name="Name">[oLabel6]</property>
      <property name="Caption">[Valor Prods]</property>
      <property name="Justify">[Right]</property>
      <property name="font">
        <font name="Segoe UI" width="0" height="-19" weight="400"/>
      </property>
      <property name="Transparent">.T.</property>
      <property name="TabIndex">8</property>
    </style>
  </part>
  <part class="label">
    <style>
      <property name="Geometry">{309,75,143,31}</property>
      <property name="Name">[oLabel7]</property>
      <property name="Caption">[Valor Liquido]</property>
      <property name="Justify">[Right]</property>
      <property name="font">
        <font name="Segoe UI" width="0" height="-19" weight="400"/>
      </property>
      <property name="Transparent">.T.</property>
      <property name="TabIndex">8</property>
    </style>
  </part>
</part>
