Jump to content
Fivewin Brasil

sistem

Membros
  • Posts

    561
  • Joined

  • Last visited

  • Days Won

    25

Posts posted by sistem

  1. 
    

    Local cHtml:="", oOle

    If !IsInternet()

    Msgalert("não conectado a internet.", "Aviso!")

    Return nil

    Endif

    Ferase(uRegPath+"\tempgmapdist.html") // uRegPath:= "c:\test"

    oOle:= CreateObject("InternetExplorer.Application")

    oOle:Visible := .t.

    oOle:ToolBar := .f.

    oOle:StatusBar := .t.

    oOle:MenuBar := .f.

    cHtml := MemoRead(uRegPath+"\gmapdist.html")

    cHtml := StrTran( cHtml, "ORIGEM", Alltrim(Empr->End_Empr)+", "+Alltrim(Empr->Nmr_Empr)+", "+Alltrim(Empr->Cid_Empr)+" - "+Empr->Est_Empr)

    cHtml := StrTran( cHtml, "DESTINO", Alltrim(Clie->End_Clie)+", "+Alltrim(Clie->Nmr_Clie)+" "+Alltrim(Clie->Cid_Clie)+" - "+Clie->Est_Clie)

    MemoWrit(uRegPath+"\tempgmapdist.html", chtml)

    oOle:Navigate2(uRegPath+"\tempgmapdist.html")

    hWnd:=oOle:hWnd

    ShowWindow(hWnd, 3 ) //SW_MAXIMIZE=3 SW_NORMAL=1 SW_MINIMIZE=6

    BringWindowToTop(hWnd)

    Return nil

    id=code>id=code>

    arquivo html => gmapdist.html

    
    

    var map, geocoder;

    var mapDisplay, directionsService;

    function initialize() {

    var myOptions = {zoom: 15,mapTypeId: google.maps.MapTypeId.ROADMAP};

    map = new google.maps.Map(document.getElementById('map_canvas'), myOptions);

    geocoder = new google.maps.Geocoder();

    var enderDe = "ORIGEM";

    var enderAte = "DESTINO";

    geocoder.geocode( { 'address': enderAte, 'region' : 'BR'},trataLocs);

    initializeDirections ();

    calcRota (enderDe, enderAte);

    }

    function initializeDirections () {

    directionsService = new google.maps.DirectionsService();

    mapDisplay = new google.maps.DirectionsRenderer();

    mapDisplay.setMap(map);

    mapDisplay.setPanel(document.getElementById("panel")) }

    function calcRota(endDe, endPara) {

    var request = {

    origin:endDe,

    destination:endPara,

    travelMode: google.maps.DirectionsTravelMode.DRIVING

    };

    directionsService.route(request, function(response, status) {

    if (status == google.maps.DirectionsStatus.OK) {

    mapDisplay.setDirections(response) }

    }) }

    function trataLocs (results, status) {

    var elem = document.getElementById('msg');

    if (status == google.maps.GeocoderStatus.OK) {

    map.setCenter(results[0].geometry.location);

    var marker = new google.maps.Marker({

    map: map,

    position: results[0].geometry.location });

    if (results.length > 1) {

    var i, txt = '';

    elem.innerHTML = 'O endereço exato não foi localizado - há ' + results.length.toString() + ' resultados aproximados.

    ';

    for (i = 0; i < results.length; i++) {

    txt = txt + '

    if (i == 0)

    txt = txt + ' selected="selected"';

    txt = txt + '>' + results.formatted_address + '

    ';

    }

    txt = txt + ''

    elem.innerHTML = elem.innerHTML + txt;

    }

    } else

    elem.innerHTML = 'Erro no tratamento do endereço :

    ' + status + '';

    }

    id=code>

    id=code>

    mapsdistw.png

    Editado por - sistem on 27/11/2012 17:33:01

  2. 
    

    Local cHtml:="", oOle

    If !IsInternet()

    Msgalert("não conectado a internet.", "Aviso!")

    Return nil

    Endif

    Ferase(uRegPath+"\tempgmapdist.html") // uRegPath:= "c:\test"

    oOle:= CreateObject("InternetExplorer.Application")

    oOle:Visible := .t.

    oOle:ToolBar := .f.

    oOle:StatusBar := .t.

    oOle:MenuBar := .f.

    cHtml := MemoRead(uRegPath+"\gmapdist.html")

    cHtml := StrTran( cHtml, "ORIGEM", Alltrim(Empr->End_Empr)+", "+Alltrim(Empr->Nmr_Empr)+", "+Alltrim(Empr->Cid_Empr)+" - "+Empr->Est_Empr)

    cHtml := StrTran( cHtml, "DESTINO", Alltrim(Clie->End_Clie)+", "+Alltrim(Clie->Nmr_Clie)+" "+Alltrim(Clie->Cid_Clie)+" - "+Clie->Est_Clie)

    MemoWrit(uRegPath+"\tempgmapdist.html", chtml)

    oOle:Navigate2(uRegPath+"\tempgmapdist.html")

    hWnd:=oOle:hWnd

    ShowWindow(hWnd, 3 ) //SW_MAXIMIZE=3 SW_NORMAL=1 SW_MINIMIZE=6

    BringWindowToTop(hWnd)

    Return nil

    id=code>id=code>

    arquivo html => gmapdist.html

    
    

    var map, geocoder;

    var mapDisplay, directionsService;

    function initialize() {

    var myOptions = {zoom: 15,mapTypeId: google.maps.MapTypeId.ROADMAP};

    map = new google.maps.Map(document.getElementById('map_canvas'), myOptions);

    geocoder = new google.maps.Geocoder();

    var enderDe = "ORIGEM";

    var enderAte = "DESTINO";

    geocoder.geocode( { 'address': enderAte, 'region' : 'BR'},trataLocs);

    initializeDirections ();

    calcRota (enderDe, enderAte);

    }

    function initializeDirections () {

    directionsService = new google.maps.DirectionsService();

    mapDisplay = new google.maps.DirectionsRenderer();

    mapDisplay.setMap(map);

    mapDisplay.setPanel(document.getElementById("panel")) }

    function calcRota(endDe, endPara) {

    var request = {

    origin:endDe,

    destination:endPara,

    travelMode: google.maps.DirectionsTravelMode.DRIVING

    };

    directionsService.route(request, function(response, status) {

    if (status == google.maps.DirectionsStatus.OK) {

    mapDisplay.setDirections(response) }

    }) }

    function trataLocs (results, status) {

    var elem = document.getElementById('msg');

    if (status == google.maps.GeocoderStatus.OK) {

    map.setCenter(results[0].geometry.location);

    var marker = new google.maps.Marker({

    map: map,

    position: results[0].geometry.location });

    if (results.length > 1) {

    var i, txt = '';

    elem.innerHTML = 'O endereço exato não foi localizado - há ' + results.length.toString() + ' resultados aproximados.

    ';

    for (i = 0; i < results.length; i++) {

    txt = txt + '

    if (i == 0)

    txt = txt + ' selected="selected"';

    txt = txt + '>' + results.formatted_address + '

    ';

    }

    txt = txt + ''

    elem.innerHTML = elem.innerHTML + txt;

    }

    } else

    elem.innerHTML = 'Erro no tratamento do endereço :

    ' + status + '';

    }

    id=code>

    id=code>

    mapsdistw.png

    Editado por - sistem on 27/11/2012 17:33:01

  3. kapiaba,

    minha versão do unidanfe só permite enviar pdf de CCe, meu caso o caminho seria ex: c:\sistem\unidanfe\email\anexos\2012-11\2012-11-23_19-05-02_27624194\23121111522734000157550010000010501000010507_01-cce.pdf não sei que versão vc esta usando. o nome do arquivo que mostra na imagem deve ser arquivo temnporario que nao foi completado com sucesso, já tentou gerar novamente?

  4. atnsoft

    RECEBER ARQUIVO

    
    

    Function recebeTxt()

    local oInternet := TInternet():New()

    local oFTP := TFTP():New( Alltrim(oApp:FtpServ), oInternet, Alltrim(oApp:FtpUsua), Alltrim(oApp:FtpSenh))

    local aFiles, cDirName := Alltrim(oApp:FtpPath)+"/sendsmart/", aTarget:={}, aSource:={}

    If !Empty( oFTP:hFTP )

    aFiles = oFTP:Directory( cDirName+"p?????????.*" )

    If Empty(aFiles)

    MsgAlert( "Nenhum arquivo encontrado.", "Alerta!" )

    Return nil

    Endif

    For nCount = 1 TO Len(aFiles)

    aAdd( aSource, Alltrim(oApp:FtpPath)+"/sendsmart/"+Alltrim(aFiles[nCount,1]) )

    aAdd( aTarget, oApp:cDir_001+Alltrim(aFiles[nCount,1]) )

    Next

    FtpGetFiles( aSource, aTarget, oFTP)

    Else

    MsgAlert( "Falha no Ftp.", "Alerta!" )

    Return nil

    Endif

    *-----------------------------------------

    Function FtpGetFiles( aSource, aTarget, oFTP )

    Local nBufSize:=4096, n, hTarget, cBuffer, nBytes, oFile, aFiles, aSizes:={}

    cBuffer:=Space( nBufSize )

    For n = 1 to Len( aSource )

    aFiles = oFTP:Directory( aSource[ n ] )

    If Len( aFiles ) > 0

    AAdd( aSizes, aFiles[ 1 ][ 2 ] )

    Else

    AAdd( aSizes, 0 )

    Endif

    Next

    For n = 1 to Len( aSource )

    hTarget = FCreate( aTarget[ n ] )

    oFile = TFtpFile():New( aSource[ n ], oFTP )

    oFile:OpenRead()

    Do while ( nBytes := Len( cBuffer := oFile:Read( nBufSize ) ) ) > 0

    FWrite( hTarget, cBuffer, nBytes )

    Enddo

    FClose( hTarget )

    oFtp:Deletefile(oFile:cFilename)

    oFile:End()

    Next

    Return nil

    id=code>id=code>

    ENVIAR ARQUIVO

    
    

    aFiles := Directory(oApp:cDir_Sit+"????"+cCod_Vend+".txt")// para todos arq.do diretorio ex: c:\arq

    If Empty(aFiles)

    MsgAlert( "Nenhum arquivo encontrado.", "Alerta!" )

    Return nil

    Endif

    For nCount = 1 TO Len(aFiles)

    aAdd( aSource, oApp:cDir_Sit+Alltrim(aFiles[nCount,1]) )

    aAdd( aTarget, Alltrim(oApp:FtpPath)+"/sendsistem/"+Alltrim(aFiles[nCount,1]) )

    Next

    oInternet := TInternet():New()

    oFTP := TFTP():New( Alltrim(oApp:FtpServ), oInternet, Alltrim(oApp:FtpUsua), Alltrim(oApp:FtpSenh) )

    If Empty( oFTP:hFTP )

    MsgStop( "Não foi possivel conectar com FTP", "Aviso!" )

    Return nil

    Endif

    FtpSendFiles( aSource, aTarget, oFTP )

    oInternet:End()

    oFtp:End()

    *---------------------------------------------

    Static Function FtpSendFiles( aSource, aTarget, oFTP )

    Local n, hSource, cBuffer, nBufSize:=2000, nBytes, nFile:=0, oFile

    cBuffer=Space(nBufSize)

    For n = 1 to Len( aSource )

    If !File( aSource[ n ] )

    MsgStop( "Archivo No Encontrado: " + aSource[ n ] )

    exit

    Endif

    hSource = FOpen( aSource[ n ] )

    FClose( hSource )

    next

    For n = 1 to Len( aSource )

    hSource = FOpen( aSource[ n ] )

    oFile = TFtpFile():New( aTarget[ n ], oFTP )

    oFile:OpenWrite()

    FSeek( hSource, 0, 0 )

    nFile := 0

    do while ( nBytes := FRead( hSource, @cBuffer, nBufSize ) ) > 0

    oFile:Write( SubStr( cBuffer, 1, nBytes ) )

    enddo

    FClose( hSource )

    oFile:End()

    Next

    Return nil

    id=code>id=code>

    Editado por - sistem on 15/11/2012 23:45:24

  5. jhilbert

    é seguir o exemplo que esta na pasta HarbourBoleto\source

    oIni:WriteString("CAB", "cCarteira", Alltrim(cCar_Cona))

    oIni:WriteString("CAB", "EspecieTit", Alltrim(Cona->Tpd_Cona))

    no exemplo hboleto.prg:

    oIni:WriteString("CAB", "cCarteira", "1")

    oIni:WriteString("CAB", "EspecieTit", "DM")

    at+

    Editado por - sistem on 15/11/2012 23:29:17

  6. alterei o exemplo hboleto.prg

    
    

    /*

    * $Id: SAFRA.prg,v 1.1 2006/09/27 11:57:19 marioargon Exp $

    */

    /*

    * Copyright 2006 Mario Simoes Filho mario@argoninformatica.com.br for original

    * Copyright 2006 Marcelo Sturm for modifications in the original project

    *

    * This program is free software; you can redistribute it and/or modify

    * it under the terms of the GNU General Public License as published by

    * the Free Software Foundation; either version 2, or (at your option)

    * any later version.

    *

    * This program is distributed in the hope that it will be useful,

    * but WITHOUT ANY WARRANTY; without even the implied warranty of

    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the

    * GNU General Public License for more details.

    *

    * You should have received a copy of the GNU General Public License

    * along with this software; see the file COPYING. If not, write to

    * the Free Software Foundation, Inc., 59 Temple Place, Suite 330,

    * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).

    *

    * As a special exception, the Harbour Project gives permission for

    * additional uses of the text contained in its release of Harbour.

    *

    * The exception is that, if you link the Harbour libraries with other

    * files to produce an executable, this does not by itself cause the

    * resulting executable to be covered by the GNU General Public License.

    * Your use of that executable is in no way restricted on account of

    * linking the Harbour library code into it.

    *

    * This exception does not however invalidate any other reasons why

    * the executable file might be covered by the GNU General Public License.

    *

    * This exception applies only to the code released by the Harbour

    * Project under the name Harbour. If you copy code from other

    * Harbour Project or Free Software Foundation releases into a copy of

    * Harbour, as the General Public License permits, the exception does

    * not apply to the code that you add in this way. To avoid misleading

    * anyone as to the status of such modified files, you must delete

    * this exception notice from them.

    *

    * If you write modifications of your own for Harbour, it is your choice

    * whether to permit this exception to apply to your modifications.

    * If you do not wish that, delete this exception notice.

    *

    */

    #include "FiveWin.ch"

    #xtranslate Default( , ) => IIF( == NIL, , )

    Function hboleto(oLbx)

    Local oFont, oDlg, oBan_Cona, nBan_Cona:=0, oNom_Agen, oCon_Cona, cCon_Cona:=Space(15),;

    cInst1:=Space(80), cInst2:=Space(80), cInst3:=Space(80), nPercMora:=0, cAce_Cona:=Cona->Ace_Cona, oAce_Cona,;

    oCar_Cona, cCar_Cona:=Cona->Car_Cona, nMultPosVnc:=0, nProtDias:=0, cTpd_Cona:=Cona->Tpd_Cona, oTpd_Cona

    DEFINE FONT oFont NAME "Arial" SIZE 0, -12

    DEFINE DIALOG oDlg FROM 4, 4 TO 20, 50 TITLE "Informar Banco / Conta Corrente"

    @ 003, 005 SAY "Agente Cobrador (Banco):" PIXEL OF oDlg FONT oFont SIZE 80, 08

    @ 021, 005 SAY "C.Corrente (CC):" PIXEL OF oDlg FONT oFont SIZE 60, 08

    @ 041, 005 SAY "Aceite:" PIXEL OF oDlg FONT oFont SIZE 60, 08

    @ 041, 028 SAY "Carteira:" PIXEL OF oDlg FONT oFont SIZE 60, 08

    @ 041, 054 SAY "Esp.Doc:" PIXEL OF oDlg FONT oFont SIZE 60, 08

    @ 041, 085 SAY "Protesto:" PIXEL OF oDlg FONT oFont SIZE 60, 08

    @ 049, 101 SAY "Dias" PIXEL OF oDlg FONT oFont SIZE 60, 08

    @ 041, 119 SAY "Multa $:" PIXEL OF oDlg FONT oFont SIZE 60, 08

    @ 041, 153 SAY "Mora %:" PIXEL OF oDlg FONT oFont SIZE 60, 08

    @ 062, 005 SAY "Instruções Cobrança:" PIXEL OF oDlg FONT oFont SIZE 60, 08

    @ 010, 005 GET oBan_Cona VAR nBan_Cona PIXEL OF oDlg VALID LkPeAg(StrZero(nBan_Cona,3), oNom_Agen, oBan_Cona) COLOR CLR_GET1,CLR_GET2 SIZE 25,10 BITMAP "" PICTURE "999" ACTION PesqAgen( oBan_Cona, oNom_Agen )

    @ 010, 032 SAY oNom_Agen VAR Iif(nBan_Cona=0, "", Agen->Nom_Agen) PIXEL OF oDlg UPDATE BORDER FONT oFont COLOR CLR_GET1,CLR_GET2 SIZE 145, 10

    @ 029, 005 GET oCon_Cona VAR cCon_Cona PIXEL OF oDlg VALID LookupCon(StrZero(nBan_Cona,3), cCon_Cona, oCon_Cona, oNom_Cona ) COLOR CLR_GET1,CLR_GET2 SIZE 45, 10 BITMAP "" PICTURE "@!" ACTION PesqCona(oCon_Cona, oNom_Cona, StrZero(nBan_Cona,3))

    @ 029, 052 SAY oNom_Cona VAR Iif(Empty(cCon_Cona), "", Cona->Nom_Cona) PIXEL OF oDlg UPDATE BORDER FONT oFont COLOR CLR_GET1,CLR_GET2 SIZE 125, 10

    @ 048, 006 GET oAce_Cona VAR cAce_Cona PICT "@!" PIXEL OF oDlg COLOR CLR_GET1,CLR_GET2 SIZE 10,10 FONT oFont

    @ 048, 030 GET oCar_Cona VAR cCar_Cona PICT "@!" PIXEL OF oDlg COLOR CLR_GET1,CLR_GET2 SIZE 15,10 FONT oFont

    @ 048, 055 GET oTpd_Cona VAR cTpd_Cona PICT "@!" PIXEL OF oDlg COLOR CLR_GET1,CLR_GET2 SIZE 15,10 FONT oFont

    @ 048, 084 GET nProtDias PICT "999" PIXEL OF oDlg COLOR CLR_GET1,CLR_GET2 RIGHT SIZE 17,10 FONT oFont

    @ 048, 118 GET nMultPosVnc PICT "9,999.99" PIXEL OF oDlg COLOR CLR_GET1,CLR_GET2 RIGHT SIZE 30,10 FONT oFont

    @ 048, 152 GET nPercMora PICT "999.99%" PIXEL OF oDlg COLOR CLR_GET1,CLR_GET2 SIZE 25,10 FONT oFont

    @ 070, 005 GET cInst1 PICT "@!" PIXEL OF oDlg COLOR CLR_GET1,CLR_GET2 SIZE 172,10 FONT oFont

    @ 082, 005 GET cInst2 PICT "@!" PIXEL OF oDlg COLOR CLR_GET1,CLR_GET2 SIZE 172,10 FONT oFont

    @ 094, 005 GET cInst3 PICT "@!" PIXEL OF oDlg COLOR CLR_GET1,CLR_GET2 SIZE 172,10 FONT oFont

    oAce_Cona:bGotFocus := {|| RecAceBol(oAce_Cona, cAce_Cona) }

    oCar_Cona:bGotFocus := {|| RecCarBol(oCar_Cona, cCar_Cona) }

    oTpd_Cona:bGotFocus := {|| RecTpdBol(oTpd_Cona, cTpd_Cona) }

    @ 108, 005 BUTTON "&Gerar" PIXEL OF oDlg SIZE 40, 10 ACTION (oDlg:End(), FunctionMainBoleto(oApp:cDir_001+"boleto.ini", StrZero(nBan_Cona,3), cCon_Cona, cInst1, cInst2, cInst3, nPercMora, nMultPosVnc, nProtDias, oLbx, cAce_Cona, cCar_Cona))

    oDlg:lHelpIcon := .f.

    ACTIVATE DIALOG oDlg CENTERED

    Return Nil

    *--------------------------------------------------------------------------------------------------------------------------------------------------

    Static Function RecAceBol(oAce_Cona, cAce_Cona)

    oAce_Cona:varput(Cona->Ace_Cona)

    oAce_Cona:Refresh()

    Return Nil

    *--------------------------------------------------------------------------------------------------------------------------------------------------

    Static Function RecTpdBol(oTpd_Cona, cTpd_Cona)

    oTpd_Cona:varput(Cona->Tpd_Cona)

    oTpd_Cona:Refresh()

    Return Nil

    *--------------------------------------------------------------------------------------------------------------------------------------------------

    Static Function RecCarBol(oCar_Cona, cCar_Cona)

    oCar_Cona:varput(Cona->Car_Cona)

    oCar_Cona:Refresh()

    Return Nil

    *--------------------------------------------------------------------------------------------------------------------------------------------------

    Static Function FunctionMainBoleto( cFileName, cBan_Cona, cCon_Cona, cInst1, cInst2, cInst3, nPercMora, nMultPosVnc, nProtDias, oLbx, cAce_Cona, cCar_Cona )

    LOCAL oIni, oRetIni, oBol

    LOCAL cDir, cDirRemessa, lPrint, lPreview, lPromptPrint, cBol, nI := 0

    CriaIni(cFileName, cBan_Cona, cCon_Cona, cInst1, cInst2, cInst3, nPercMora, nMultPosVnc, nProtDias, cAce_Cona, cCar_Cona)

    oIni = TIniFile():New(Default(cFilename, 'bol.ini'))

    oBol := oBoleto(oIni:ReadString("CAB", "Banco"))

    oBol:lBoleto := oIni:ReadBool("CAB", "lBoleto", .T.)

    oBol:lRemessa := oIni:ReadBool("CAB", "lRemessa", .F.)

    oBol:lAnsi := oIni:ReadBool("CAB", "lAnsi", .F.)

    lPrint := oIni:ReadBool("CAB", "lPrint", .F.)

    lPreview := oIni:ReadBool("CAB", "lPreview", .F.)

    lPromptPrint := oIni:ReadBool("CAB", "lPromptPrint", .F.)

    oBol:nBolsPag := oIni:ReadNumber("CAB", "nBolsPag", 2)

    oBol:cImageLnk := oIni:ReadString("CAB", "cImageLnk")

    oBol:Cedente := oIni:ReadString("CAB", "Cedente")

    oBol:CedenteCNPJ := oIni:ReadString("CAB", "CedenteCNPJ")

    oBol:cNumCC := oIni:ReadString("CAB", "cNumCC")

    oBol:cNumAgencia := oIni:ReadString("CAB", "cNumAgencia")

    oBol:cCarteira := oIni:ReadString("CAB", "cCarteira")

    oBol:EspecieTit := oIni:ReadString("CAB", "EspecieTit")

    oBol:cTipoCob := oIni:ReadString("CAB", "cTipoCob")

    oBol:nMora := oIni:ReadNumber("CAB", "nMora", 0)

    oBol:nMulta := oIni:ReadNumber("CAB", "nMulta", 0)

    oBol:nDiasProt := oIni:ReadNumber("CAB", "nDiasProt", 0)

    cDir := oIni:ReadString("CAB", "cDir")

    cDirRemessa := oIni:ReadString("CAB", "cDirRemessa")

    oBol:Open("boleto") //, cDir, cDirRemessa, cDir) // Cria html - Sempre colocar após a definição completa do Cedente, pois

    // isso influencia na criação do Arquivo Remessa.

    DO WHILE .T.

    cBol := "BOL" + LTRIM(STR(++nI))

    IF EMPTY(oIni:ReadNumber(cBol, "nValor", 0))

    EXIT

    ENDIF

    oBol:Sacado := oIni:ReadString(cBol, "Sacado")

    oBol:Endereco := oIni:ReadString(cBol, "Endereco")

    oBol:Bairro := oIni:ReadString(cBol, "Bairro")

    oBol:Cidade := oIni:ReadString(cBol, "Cidade")

    oBol:Estado := oIni:ReadString(cBol, "Estado")

    oBol:CEP := oIni:ReadString(cBol, "CEP")

    oBol:CNPJ := oIni:ReadString(cBol, "CNPJ")

    oBol:Instrucoes := oIni:ReadString(cBol, "Instrucoes", "")

    oBol:cNumDoc := oIni:ReadString(cBol, "cNumDoc", "") // seu numero do documento

    oBol:cNossoNumero := oIni:ReadString(cBol, "cNossoNumero", "") // numero do banco

    oBol:nValor := oIni:ReadNumber(cBol, "nValor", 0) // valor do boleto

    oBol:DtEmis := oIni:ReadDate(cBol, "DtEmis", DATE())

    oBol:DtVenc := oIni:ReadDate(cBol, "DtVenc", DATE())

    oBol:Execute() // monta html

    Rebb->(DbSkip())

    ENDDO

    oBol:Close()

    IF lPrint

    oBol:Print(lPreview, lPromptPrint) // Imprime o boleto */

    ENDIF

    IF oBol:lRemessa .AND. !EMPTY(oBol:oRem:NomeRem)

    oRetIni = TIniFile():New(Default(cFilename, 'bol.ini') + '.ret')

    oRetIni:WriteString("RET", "NomeRem", oBol:oRem:NomeRem)

    oRetIni:WriteString("RET", "Destino", oBol:oRem:Destino)

    oRetIni:WriteString("RET", "cNumSequencial", oBol:oRem:cNumSequencial)

    oRetIni:WriteNumber("RET", "nTitLote", oBol:oRem:nTitLote)

    oRetIni:UpdateFile()

    ENDIF

    Rebb->(DbGoTop())

    oLbx:SetFocus()

    oLbx:Refresh()

    RETURN NIL

    /* -------------------------------------------------------------------------- */

    STATIC FUNCTION CriaIni( cFileName, cBan_Cona, cCon_Cona, cInst1, cInst2, cInst3, nPercMora, nMultPosVnc, nProtDias, cAce_Cona, cCar_Cona )

    Local cInstru, nVlrMora, nNumBols:=0

    LOCAL oIni

    Ferase(cFileName)

    oIni = TIniFile():New(Default(cFilename, 'bol.ini'))

    oIni:WriteString("CAB", "Banco", cBan_Cona)

    oIni:WriteString("CAB", "cImageLnk", "")

    oIni:WriteBool("CAB", "lBoleto", .T.)

    oIni:WriteBool("CAB", "lRemessa", .T.)

    oIni:WriteBool("CAB", "lAnsi", .T.)

    oIni:WriteBool("CAB", "lPrint", .T.)

    oIni:WriteBool("CAB", "lPreview", .T.)

    oIni:WriteBool("CAB", "lPromptPrint", .T.)

    oIni:WriteNumber("CAB", "nBolsPag", 2)

    oIni:WriteString("CAB", "Cedente", Alltrim(Cona->Nom_Cona))

    oIni:WriteString("CAB", "CedenteCNPJ", Alltrim(Empr->Cgc_Empr))

    oIni:WriteString("CAB", "cNumCC", Alltrim(cCon_Cona)) // "100778-3")

    oIni:WriteString("CAB", "cNumAgencia", Alltrim(Cona->Age_Cona)) // "1748-5")

    oIni:WriteString("CAB", "cCarteira", Alltrim(cCar_Cona))

    oIni:WriteString("CAB", "EspecieTit", Alltrim(Cona->Tpd_Cona))

    oIni:WriteString("CAB", "cTipoCob", "5")

    oIni:WriteNumber("CAB", "nMora", nPercMora)

    oIni:WriteNumber("CAB", "nMulta", nMultPosVnc)

    oIni:WriteNumber("CAB", "nDiasProt", nProtDias)

    oIni:WriteString("CAB", "cDir", "")

    oIni:WriteString("CAB", "cDirRemessa", "")

    dbSelectArea( "Rebb" )

    Rebb->(DbGoTop())

    Do While !Rebb->(Eof())

    dbSelectArea( "Rece" )

    Rece->(DbSeek(Rebb->Cod_Rebb))

    dbSelectArea( "Rebb" )

    nNumBols++

    cInstru:=Alltrim(cInst1)+" "+Alltrim(cInst2)+" "+Alltrim(cInst3)

    oIni:WriteString("BOL"+Alltrim(Str(nNumBols)), "Sacado", Clie->Nom_Clie+" - "+Clie->Cod_Clie)

    oIni:WriteString("BOL"+Alltrim(Str(nNumBols)), "Endereco", alltrim(Clie->Enc_Clie)+", "+alltrim(Clie->Nmc_Clie)+" "+alltrim(Clie->Cmc_Clie))

    oIni:WriteString("BOL"+Alltrim(Str(nNumBols)), "Bairro", alltrim(Clie->Bac_Clie))

    oIni:WriteString("BOL"+Alltrim(Str(nNumBols)), "Cidade", alltrim(Clie->Cic_Clie))

    oIni:WriteString("BOL"+Alltrim(Str(nNumBols)), "Estado", alltrim(Clie->Esc_Clie))

    oIni:WriteString("BOL"+Alltrim(Str(nNumBols)), "CEP", alltrim(Clie->Cec_Clie))

    oIni:WriteString("BOL"+Alltrim(Str(nNumBols)), "CNPJ", Iif(Clie->pfj_clie, alltrim(Clie->Cgc_Clie), alltrim(Clie->Cpf_Clie)) )

    oIni:WriteString("BOL"+Alltrim(Str(nNumBols)), "Instrucoes", cInstru )

    oIni:WriteString("BOL"+Alltrim(Str(nNumBols)), "cNumDoc", Alltrim(Rece->Cod_Rece)) // seu numero do documento

    oIni:WriteString("BOL"+Alltrim(Str(nNumBols)), "cNossoNumero", NOVOCOD("NossoNumero"+Cona->Cod_Cona+".dat", 10, "rece")) // numero do banco

    oIni:WriteNumber("BOL"+Alltrim(Str(nNumBols)), "nValor", Rece->Tpg_Rece) // valor do boleto

    oIni:WriteDate("BOL"+Alltrim(Str(nNumBols)), "DtVenc", Rece->Ven_Rece) // vencimento

    Rebb->(DbSkip())

    Enddo

    RETURN oIni:UpdateFile()

    id=code>id=code>

    ainda estou testando

    tem outros exemplos sem usar arquivo .ini

    at+

  7. compilei os seguintes arquivos (fwh1205 xharbour BCC582)

    ACENTO.PRG

    HBOLETO.PRG

    HTMLPRINT.PRG

    INIFILES.PRG

    OBOLETO.PRG

    OREMESSA.PRG

    ORETORNO.PRG XHBRUN.PRG

    e comentei as seguintes linhas do arquivo XHBRUN.PRG

    // #IFNDEF __PLATFORM__Linux

    // #ENDIF

    e testei o exemplo:

    hboleto.prg

    Abraços,

×
×
  • Create New...