Jump to content
Fivewin Brasil

sambomb

Membros
  • Posts

    1,951
  • Joined

  • Last visited

  • Days Won

    10

Everything posted by sambomb

  1. Um parceiro que sempre vem ajudando é a Daruma, mas para conseguir o patrocínio deles precisaria de um tempo voltado para o contexto de PAF/ECF ou então de algum outro produto deles. E no caso de conseguir o patrocínio deles seria melhor se fosse em SP para que alguém da Daruma palestre também.
  2. O custo é tempo de estadia em dias * ( Preço do hotel + Alimentação dia e noite ) + passagem ida e volta da espanha + Translado Aeroporto hotel ida e volta Então o ideal seria definir o local do evento, levantar esse valores e depois ver a disponibilidade dele e então rever os valores ( passagem e hotel costuma ter diferença de preço de acordo com a data ) Vale lembrar também que ele não fala português então pode ser necessário um tradutor o que é mais um custo. Acredito que só vale a pena trazer ele para o congresso se alguma empresa for aproveitar ele um tempo antes/depois do encontro que ae racha o translado pelo menos.
  3. cString := Space(200) //-- O tamanho do retorno esperado nResult := GetAbastecimento( @cString ) If nResult = 1 //-- O valor que indique sucesso, algumas é 0 outras é 1 ? "Sucesso?" ? cString else ? nResult ? cString end DLL32 FUNCTION GetAbastecimento(@Dado as STRING) AS _INT PASCAL LIB DllPosto
  4. aAdd(::aFields,"CAMPO1") //-- 01 aAdd(::aFields,"CAMPO2") //-- 02 aAdd(::aFields,"CAMPO3") //-- 03 aAdd(::aFields,"CAMPO4") //-- 04 For i = 1 to Len(::aFields) cCampos += ::aFields[i] + If( i + 1 > Len(::aFields),"", ";") end cAux := '{|aField| xx := ' For i = 1 to Len(::aFields) cAux += 'If(aField = "' cAux += ::aFields[i] cAux += '",' cAux += AllTrim(Str(i)) If I + 1 >= Len(::aFields) cAux += ',' cAux += AllTrim(Str(i+1)) cAux += Replicate(")",i) exit else cAux += "," end end cAux += ', aValFastReport[nRec, xx]}' bAux := &( cAux ) Result := ::oFrPrn:SetUserDataSet( "MEUARRAY",; cCampos,; {||nRec := 1},; {||nRec := nRec + 1},; {||nRec := nRec - 1},; {||nRec > Len(aValFastReport)},; bAux) ::oFrPrn:SetProperty("Principal","DataSetName","MEUARRAY") Ta ae um exemplo, só precisa adaptar pra sua realidade ae Obs.: aValFastResport é uma variável private ou pública ( eu uso como pública )
  5. Só com acesso ao fonte da RFolder que daria para ajudar a implementar algum método. O bChange normalmente vem nativo das classes que herdam da TWindow/TControl
  6. Ente os parenteses são os parâmetros da função, tem que olhar no manual ou em um exemplo ( Deplhi é o indicado pois já vai em Pascal ) e depois dos parenteses é o tipo de retorno. Os tipos possíveis são todos os do Pascal, os mais comuns são STRING, _INT, PTR
  7. Se não for usar Message nem Font não precisa usar, só adicionei no exemplo pra dar exemplo da posição que ele vem no Folder.ch
  8. Do mesmo tamanho chame com ADJUST @ 1,1 FOLDER of oWnd .... MESSAGE "" ADJUST FONT oFont....
  9. No resource: Multiline = Yes Tenho um folder com 16 abas e funciona direitinho.
  10. Pode ser questão de permissão então... Se entrar pelo prompt do DOS ( CMD ) e usar um ping google.com > C:\Ping.txt Não cria o arquivo tb?
  11. Viu como fica o arquivo C:\Ping.txt ? Como ele está preenchido?
  12. Tenta isso aqui: WinExec("ping google.com > C:\Ping.txt",0) If At("Recebidos = 4", MemoRead("C:\Ping.txt")) > 0 ? " Tem internet " Else ? " Não tem internet " End
  13. Acho que no Windows 7 x64 é SysWow64 ao invés de System32. Dei a dica pois uso a DLL na pasta do sistema e não na pasta System32
  14. O que meu suporte fez aqui foi renomear a dll do pacote 64 bits para o nome do pacote 32 bits
  15. AEVAL(DIRECTORY( "TEMP*.*" ),{ |aFILE| If(aFILE[F_DATE] < dData,FERASE(aFILE[F_NAME]),nil) } )
  16. aLinhas := HB_aTokens( MemoRead( "C:\Retorno.txt" ), CRLF )
  17. cVar := 'Cliente: <font size="'+AllTrim(Str(nSize))+'"><b>Nome do Cliente</b></font>' Assim realmente não funcionou?
  18. Esqueceu as aspas pelo visto <font size="3" color="red">This is some text!</font>
  19. Kapiaba, olha aquela classe que te passei no outro post, acredito que nela você consiga tratar isso facilmente. oDtHr1 := TDataHora():New(dData1,cHora1) oDtHr2 := TDataHora():New(dData2,cHora2) nDif := Abs( oDtHr1:Absoluto()-oDtHr2:Absoluto() ) ? "Diferença entre a data 1 e data 2 em segundos = " + AllTrim(Str(nDif)) Edit: nSecsMinuto := 60 //-- FIXO nSecsHora := nSecsMinuto * 60 //-- FIXO nSecsDia := nSecsHora * 24 //-- FIXO nDia := 0 nHora := 0 nMin := 0 cMsg := "" If nDif = 0 cMsg := "nenhuma" end While nDif > nSecsDia nDia++ nDif -= nSecsDia End While nDif > nSecsHora nHora++ nDif -= nSecsHora End While nDif > nSecsHora nMin++ nDif -= nSecsMinuto End If nDia > 0 cMsg += " Dias: " + AllTrim(Str(nDia)) end If nHora > 0 cMsg += " Horas: " + AllTrim(Str(nHora)) end If nMin > 0 cMsg += " Minutos: " + AllTrim(Str(nMin)) end If nDif > 0 cMsg += " Segundos: " + AllTrim(Str(nDif)) end ? "Diferença = " + cMsg
  20. Só vai falhar desse modo se virar o dia pois o novo vai considerar como menor na virada. Exemplo: ?Time() // 23:55:00 ?cNovo //00:10:00 ? ( Time() < cNovo ) // False Use a classe que eu fiz pra tratar data/hora /*************************************************************************** * Programa ....: DateTime.PRG * Autor .......: Samir * Date ........: 2/3/2010 às 10:30:13 * Revisado em .: 2/3/2010 às 10:30:13 * * Classe para tratar uma Date e Time em conjunto * ***************************************************************************/ #include 'FiveWin.ch' CLASS TDateTime //-- Propriedades -----------------------------------------------------// //-- Atributos a serem acessados DATA Date AS Date INIT Date() READONLY DATA Time AS Character INIT Time() READONLY DATA Secs AS Numeric Init 0 READONLY //-- Uso interno da classe DATA nSecsMinute AS Numeric Init 0 HIDDEN DATA nSecsHour AS Numeric Init 0 HIDDEN DATA nSecsDay AS Numeric Init 0 HIDDEN DATA nSecsMonth AS Numeric Init 0 HIDDEN DATA nSecsYear AS Numeric Init 0 HIDDEN //-- Métodos ----------------------------------------------------------// //-- Construção METHOD New(cDateIni,cTimeIni) CONSTRUCTOR METHOD End() METHOD Absolute(dDateReference) //-- Uso Interno METHOD Verify() HIDDEN METHOD UpdateVar() HIDDEN //-- Modificar atributos da classe METHOD SetDate(dDate) INLINE ( ::Date := dDate ) METHOD SetTime(cTime) INLINE ( ::Time := cTime, ::Secs := Secs(cTime) ) //-- Add Time METHOD AddHour(nTime) //PUBLIC METHOD AddMinute(nMinute) //PUBLIC METHOD AddSecond(nSecond) //PUBLIC //-- Add Date METHOD AddDay(nDay) //PUBLIC METHOD AddMonth(nMonth) //PUBLIC METHOD AddYear(nYear) //PUBLIC //-- Remove Tempo METHOD RemHour(nTime) //PUBLIC METHOD RemMinute(nMinute) //PUBLIC METHOD RemSecond(nSecond) //PUBLIC //-- Remove Date METHOD RemDay(nDay) //PUBLIC METHOD RemMonth(nMonth) //PUBLIC METHOD RemYear(nYear) //PUBLIC //-- Compatibilidade ( Aceitar comandos no plural ) -------------------// //-- Add Tempo METHOD AddHours(nHour) INLINE ::AddHour(nHour) METHOD AddMinutes(nMinute) INLINE ::AddMinute(nMinute) METHOD AddSeconds(nSecond) INLINE ::AddSecond(nSecond) //-- Add Date METHOD AddDays(nDay) INLINE ::AddDays(nDay) METHOD AddMonths(nMonth) INLINE ::AddMonth(nMonth) METHOD AddYears(nYear) INLINE ::AddYear(nYear) //-- Remove Tempo METHOD RemHour(nHour) INLINE ::RemHour(nHour) METHOD RemMinutes(nMinute) INLINE ::RemMinute(nMinute) METHOD RemSeconds(nSecond) INLINE ::RemSecond(nSecond) //-- Remove Date METHOD RemDays(nDay) INLINE ::RemDay(nDay) METHOD RemMonths(nMonth) INLINE ::RemMonth(nMonth) METHOD RemYears(nYear) INLINE ::RemYear(nYear) ENDCLASS /*------------------------------------------------------------------------*/ **************************************************************************** METHOD New(xDateIni,cTimeIni) CLASS TDateTime **************************************************************************** * * Initiate the object * Parametros: Nenhum * Retorno: Self (Object) * * Autor .......: Samir * Date ........: 2/3/2010 às 10:30:20 * **************************************************************************** Default xDateIni := Date(), cTimeIni := Time() If ValType(xDateIni) = "C" ::Date := cTod(xDateIni) elseif ValType(xDateIni) = "D" ::Date := xDateIni else ::Date := Date() end ::Time := cTimeIni ::Secs := Secs(cTimeIni) ::nSecsMinute := 60 //-- FIXO ::nSecsHour := ::nSecsMinute * 60 //-- FIXO ::nSecsDay := ::nSecsHour * 24 //-- FIXO //-- Atualizar Seconds do Month/Year ::UpdateVar() return Self /*------------------------------------------------------------------------*/ **************************************************************************** METHOD End() CLASS TDateTime **************************************************************************** * * Release the object from memory * Parametros: Nenhum * Retorno: Nil * * Autor .......: Samir * Date ........: 2/3/2010 às 10:30:20 * **************************************************************************** Self := Nil return nil /*------------------------------------------------------------------------*/ **************************************************************************** METHOD UpdateVar() CLASS TDateTime **************************************************************************** * * Update the second counting vars * Parametros: * Retorno: Nil * * Autor: Samir * 2/3/2010 - 13:52:18 * **************************************************************************** ::nSecsMonth := ::nSecsDay * LastDay(::Date) ::nSecsYear := ::nSecsDay * If ( IsBissexto(::Date), 366, 365 ) return nil /*------------------------------------------------------------------------*/ **************************************************************************** METHOD Verify() CLASS TDateTime **************************************************************************** * * Verify if happen and Date update based on the Seconds * Parametros: Nenhum * Retorno: Nil * * Autor .......: Samir * Date ........: 2/3/2010 às 10:30:20 * **************************************************************************** Local lRewind := .F. //-- Verify if is negative or positive If ::Secs < 0 lRewind := .T. ::Secs := Abs(::Secs) end //-- Increase If !lRewind //-- Verify if increase one Day While ::Secs > ::nSecsDay ::Secs -= ::nSecsDay ::AddDay() end //-- Update time with the rest ::Time := TString(::Secs) //-- Decrease else //-- Verify if decrease one Day While ::Secs > ::nSecsDay ::Secs -= ::nSecsDay ::RemDay() end //-- If time is negative, make reference to the last day ::RemDay() //-- Update time with the rest ::Time := TString(::nSecsDay - ::Secs) end ::UpdateVar() return nil /*------------------------------------------------------------------------*/ **************************************************************************** METHOD AddHour(nHour) CLASS TDateTime **************************************************************************** * * Add Hour * Parametros: nHour * Retorno: NIL * * Autor: Samir * 2/3/2010 - 10:33:57 * **************************************************************************** Default nHour := 1 ::Secs += nHour * ::nSecsHour ::Verify() return nil /*------------------------------------------------------------------------*/ **************************************************************************** METHOD AddMinute(nMinute) CLASS TDateTime **************************************************************************** * * Add Minute * Parametros: nMinute * Retorno: NIL * * Autor: Samir * 2/3/2010 - 10:34:30 * **************************************************************************** Default nMinute := 1 ::Secs += nMinute * ::nSecsMinute ::Verify() return nil /*------------------------------------------------------------------------*/ **************************************************************************** METHOD AddSecond(nSecond) CLASS TDateTime **************************************************************************** * * Add Second * Parametros: nSecond * Retorno: NIL * * Autor: Samir * 2/3/2010 - 10:34:58 * **************************************************************************** local Result := nil Default nSecond := 1 ::Secs += nSecond ::Verify() return nil /*------------------------------------------------------------------------*/ **************************************************************************** METHOD AddDay(nDay) CLASS TDateTime **************************************************************************** * * Add Day * Parametros: nDay * Retorno: NIL * * Autor: Samir * 2/3/2010 - 10:37:46 * **************************************************************************** local Result := nil, nMax := 0, nEndMonth := 0, nAux := 0, cAux := "" Default nDay := 1 ::Date := ::Date + nDay return nil /*------------------------------------------------------------------------*/ **************************************************************************** METHOD AddMonth(nMonth) CLASS TDateTime **************************************************************************** * * Add Month * Parametros: nMonth * Retorno: NIL * * Autor: Samir * 2/3/2010 - 10:34:30 * **************************************************************************** local Result := nil Default nMonth := 1 ::Date := IncMonth(::Date,nMonth) return nil /*------------------------------------------------------------------------*/ **************************************************************************** METHOD AddYear(nYear) CLASS TDateTime **************************************************************************** * * Add Year * Parametros: nYear * Retorno: NIL * * Autor: Samir * 2/3/2010 - 10:34:58 * **************************************************************************** local Result := nil, nDayAux := 0, nMonthAux := 0, nYearAux := 0, cDateAux := "" Default nYear := 1 nDayAux := Day( ::Date()) nMonthAux := Month(::Date()) nYearAux := Year( ::Date()) nYearAux += nYear cDateAux += StrZero(nDayAux,2) + "/" cDateAux += StrZero(nMonthAux,2) + "/" cDateAux += StrZero(nYearAux,4) ::Date := CtoD(cDateAux) return nil /*------------------------------------------------------------------------*/ **************************************************************************** METHOD RemHour(nHour) CLASS TDateTime **************************************************************************** * * Add Hour * Parametros: nHour * Retorno: NIL * * Autor: Samir * 2/3/2010 - 10:33:57 * **************************************************************************** local Result := nil Default nHour := 1 ::Secs -= nHour * ::nSecsHour ::Verify() return nil /*------------------------------------------------------------------------*/ **************************************************************************** METHOD RemMinute(nMinute) CLASS TDateTime **************************************************************************** * * Add Minute * Parametros: nMinute * Retorno: NIL * * Autor: Samir * 2/3/2010 - 10:34:30 * **************************************************************************** local Result := nil Default nMinute := 1 ::Secs -= nMinute * ::nSecsMinute ::Verify() return nil /*------------------------------------------------------------------------*/ **************************************************************************** METHOD RemSecond(nSecond) CLASS TDateTime **************************************************************************** * * Add Second * Parametros: nSecond * Retorno: NIL * * Autor: Samir * 2/3/2010 - 10:34:58 * **************************************************************************** local Result := nil Default nSecond := 1 ::Secs -= nSecond ::Verify() return nil /*------------------------------------------------------------------------*/ **************************************************************************** METHOD RemDay(nDay) CLASS TDateTime **************************************************************************** * * Add Day * Parametros: nDay * Retorno: NIL * * Autor: Samir * 2/3/2010 - 10:37:46 * **************************************************************************** local nMax := 0 Default nDay := 1 ::Date := ::Date - nDay return nil /*------------------------------------------------------------------------*/ **************************************************************************** METHOD RemMonth(nMonth) CLASS TDateTime **************************************************************************** * * Add Month * Parametros: nMonth * Retorno: NIL * * Autor: Samir * 2/3/2010 - 10:34:30 * **************************************************************************** Default nMonth := 1 ::Date := DecMonth(::Date,nMonth) return nil /*------------------------------------------------------------------------*/ **************************************************************************** METHOD RemYear(nYear) CLASS TDateTime **************************************************************************** * * Add Year * Parametros: nYear * Retorno: NIL * * Autor: Samir * 2/3/2010 - 10:34:58 * **************************************************************************** local nDayAux := 0, nMonthAux := 0, nYearAux := 0, cDateAux := "" Default nYear := 1 nDayAux := Day(::Date()) nMonthAux := Month(::Date()) nYearAux := Year(::Date()) nYearAux -= nYear cDateAux += StrZero(nDayAux,2) + "/" cDateAux += StrZero(nMonthAux,2) + "/" cDateAux += StrZero(nYearAux,4) ::Date := CtoD(cDateAux) return nil /*------------------------------------------------------------------------*/ **************************************************************************** METHOD Absolute(dDateReferencia) CLASS TDateTime **************************************************************************** * * Obter um valor absoluto em Seconds da Date mais Time * Parametros: dDateReferencia * Retorno: nValorAbsoluto * * Autor: Samir * 17/11/2010 - 10:51:08 * **************************************************************************** local nValorAbsoluto := 0, nDays := 0 Default dDateReferencia := cTod("01/01/1920") nDays := Abs( ::Date - dDateReferencia) nValorAbsoluto := nDays * ::nSecsDay nValorAbsoluto += ::Secs return nValorAbsoluto /*------------------------------------------------------------------------*/ **************************************************************************** static function IsBissexto(xDate) **************************************************************************** * * Verificar se um ano é bissexto ou não * Parametros: xDate * Retorno: lResult * * Autor: Samir * 2/3/2010 - 11:15:02 * **************************************************************************** local lResult := .T., nYear := 0 If ValType(xDate) = "D" nYear := Year(xDate) elseif ValType(xDate) = "N" nYear := xDate elseif ValType(xDate) = "C" If IsDigit(xDate) If Len(xDate) = 2 .or. Len(xDate) = 4 nYear := Val(xDate) else lResult := .F. end else lResult := .F. end else lResult := .F. end If lResult If nYear % 4 = 0 .and. nYear % 100 != 0 lResult := .T. Elseif nYear % 100 = 0 .and. nYear % 400 = 0 lResult := .T. Else lResult := .F. End else MsgInfo("Invalid Date parameter") end Return lResult /*------------------------------------------------------------------------*/ **************************************************************************** function LastDay( dDateVal ) **************************************************************************** Local nLastDay, nMonthNum, nNumDays If dDateVal = NIL dDateVal := Date() ElseIf Valtype( dDateVal ) == 'N' nMonthNum := dDateVal ElseIf Valtype( dDateVal ) == 'D' nMonthNum := Month( dDateVal ) Else Return 0 Endif nNumDays := 31 Do Case Case nMonthNum = 4 .or. nMonthNum = 6 .or. nMonthNum = 9 .or. ; nMonthNum = 11 nNumDays := 30 Case nMonthNum = 2 If Year( dDateVal ) % 4 = 0 .and. Year( dDateVal ) % 100 != 0 nNumDays := 29 Elseif Year( dDateVal ) % 100 = 0 .and. Year( dDateVal ) % 400 = 0 nNumDays := 29 Else nNumDays := 28 Endif Endcase Return( nNumDays ) /*------------------------------------------------------------------------*/ **************************************************************************** function IncMonth(dDate, nMonth) **************************************************************************** local Result := dDate, nDia := 0, nAno := 0, nMes := 0, cData := "" nDia := Day(dDate) nMes := Month(dDate) nAno := Year(dDate) nMes += nMonth nMonth := nMes if nMes > 12 if nMes % 12 == 0 nMes := 12 else nMes := nMes % 12 nAno += Trunc(nMonth / 12,0) end end if (AllTrim(Str(nMes,2,0)) $ "4,6,9,11") .and. nDia >= 30 nDia := 30 elseif (AllTrim(Str(nMes,2,0)) == "2") .and. nDia >= 28 nDia := 28 end cData := AllTrim(Str(nDia,2,0)) + '/' + AllTrim(Str(nMes,2,0)) + '/' + ; AllTrim(Str(nAno,4,0)) if Empty(CTOD(cData)) MsgAlert(cData) end Result := CtoD(cData) Return Result /*------------------------------------------------------------------------*/ **************************************************************************** function DecMonth(dDate, nMonth) **************************************************************************** local Result := dDate, nDia := 0, nAno := 0, nMes := 0, cData := "" nDia := Day(dDate) nMes := Month(dDate) nAno := Year(dDate) nAno -= Trunc(nMonth / 12,0) nMes -= ( nMonth % 12 ) if nMes <= 0 if nMonth % 12 == 0 //nMes := 12 nMes := Month(dDate) else nAno -= 1 nMes += 12 end end if (AllTrim(Str(nMes,2,0)) $ "4,6,9,11") .and. nDia = 31 nDia := 30 elseif (AllTrim(Str(nMes,2,0)) == "2") .and. nDia >= 29 nDia := 28 end cData := AllTrim(Str(nDia,2,0)) + '/' + AllTrim(Str(nMes,2,0)) + '/' + ; AllTrim(Str(nAno,4,0)) Result := CtoD(cData) Return Result /*------------------------------------------------------------------------*/
  21. Function SomaTempo( cTempo ) nNovo := Secs(cTempo) + (15*60) If nNovo > (24*60*60) nNovo -= (24*60*60) End cNovo := TString( nNovo ) Return cNovo
  22. Na verdade o Val converte o trecho válido em número, como a linguagem utilizar "." ( ponto ) como separador decimal e não "," ( vírgula ) sendo assim, 999,99 é o mesmo que 999A99 ou 999|99 para a linguagem.
×
×
  • Create New...