Jump to content
Fivewin Brasil

Bematech MP 4200 não fiscal


Theotokos

Recommended Posts

Boa noite!!!

Utilizo imprimir o pedido do cliente em duas impressoras (MP 4200 nao fiscal) uma fica no balcão e outra no caixa; Qdo a venda é a VISTA, imprime no caixa e qdo é a PRAZO imprime no balcão... 

Porem vira e mexe qdo TERMINAIS manda imprimir no CAIXA (Venda a VISTA) dá erro de impressão (msg do Windows) que não foi possivel enviar para impressora 

Eu utilizo o driver da própria impressora... ou seja, ela esta instalada no windows no micro do caixa e compartilhada na rede para os terminais...

a rotina que utilizo é assim : (parte que envia para impressora)

	If ("ORCAMENTO" $ Upper(cNomeCliente) .And. "BALCAO" $ Upper(cNomeCliente)) .Or. ;
			"VISTA" $ Upper(cNomeCliente)	
		cPrinter := cPrtVista    // Imprime na Impressora em Rede - no Caixa - Bematech MP 4200TH não fiscal
	Else
		cPrinter := cPrtPrazo    // Imprime na Impressora em Rede - no Balcao - Bematech MP 4200TH não fiscal
	EndIf

	MsgWait( "Imprimindo em "+cPrinter, "Imprimindo CUPOM", 2)
	
	FrPrn:LoadFromFile(cDirFr + cArqFr3)
	*
   FrPrn:PreviewOptions:SetButtons(1337)
   FrPrn:ReportOptions:SetName(cTitulo)
   FrPrn:PrintOptions:SetPrinter(cPrinter)
	*
   FrPrn:PrintOptions:SetShowDialog(.f.)
   FrPrn:PrepareReport()
   FrPrn:Print()
   FrPrn:SetProperty("Report", "ShowProgress", .T.)
	*
	frprn:cleardatasets()                                    //inutiliza todas as informações de database no fastreports
	frprn:destroyfr()                                        //fecha (ou 'destroi') o objeto do fastreports

Alguém que tenha passado por algo parecido, por favor, SOCORROOOOOOOO!!!!!! 

Link to comment
Share on other sites

Qual é a Versão do seu Fivewin the best? Teste com esta função abaixo:

FUNCTION DefaultPrinter() // MODIFIQUEI A PRINTER.PRG E FUNCIONA...
	   LOCAL nPrn, nRet
	   // Abre a tela para a seleção da impressora
   /*
   GetPrintDC( GetActiveWindow() )
	   // Coloca a impressora selecionada como Default do Windows
   SetDefaultPrinter( PRNGETNAME() )
   */
	   nRet := PrinterSetUp()
	   nPrn := PrnGetName()
	   IF( nRet # 0 )
	      // NADA A FAZER MUDA O DEFULT DA IMPRESSORA EM TEMPO REAL. 15/08/2016(Magda)
      SetDefaultPrinter( PRNGETNAME() ) // MUDA O DEFAULT DA IMPRESSORA
	      MsgInfo( OemToAnsi( "Aten‡Æo Usu rio:                        " )+CRLF+ ;
               OemToAnsi( "Sua Impressora DEFAULT(PadrÆo) ‚:       " )+CRLF+ ;
                        ( "-> " + nPrn                               ),      ;
               OemToAnsi( "Sua Impressora DEFAULT(PadrÆo) ‚...     " ) )
	   ELSE
	      MsgInfo( OemToAnsi( "ATEN€ÇO USUµRIO:                         " )+CRLF+ ;
               OemToAnsi( "VERIFIQUE SUA IMPRESSORA SE ESTµ LIGADA. " )+CRLF+ ;
               OemToAnsi( "OU SE ESTµ INSTALADA CORRETAMENTE...     " )+CRLF+ ;
               OemToAnsi( "TEM ALGUMA COISA ERRADA COM A IMPRESSORA?" )+CRLF+ ;
               OemToAnsi( "TECLE <ENTER> PARA CONTINUAR...          " ),      ;
               OemToAnsi( "VERIFIQUE SUA IMPRESSORA SE ESTµ LIGADA. " ) )
	      RETURN( .F. )
	   ENDIF
	RETURN NIL


Link to comment
Share on other sites

Vlw! Kapiaba! Mas o meu problema não esta em selecionar a impressora, e outra coisa, não posso a todo momento ficar mudando a impressora default, pois o mesmo terminal, uma hora vai estar imprimindo na MP 4200 do Caixa, outra hora na MP 4200 do Balcao ou ainda na HP Laser (Relatorios), então tenho todos elas instaladas nos terminais e o sistema como vc pode ver la em cima "SETA" a impressora no momento de Imprimir

FrPrn:PrintOptions:SetPrinter(cPrinter)
Link to comment
Share on other sites

Como você está SETANDO(Default) cPrinter?

tentou com:

  oFrPrn:PrintOptions:SetShowDialog(.F.) // .f. Direto na impressora
  oFrPrn:Print( .T. )

??


/*
Purpose : Save and restore the current printer.
Notes   : When an application is run, the current printer always defaults to the
          Windows default printer. Here is how default to the last used printer in
          the application. Each user can have a different default printer. The printer
          name is saved in a user.ini file under the user's section.
Author  : James Bott, jbott@compuserve.com
Date    : 04/09/04 10:53:04
Language: Fivewin Harbour 2.4. Harbour 43 Alpha.
*/
	
#include "fivewin.ch"
	
//--- Test
function main()
   local oIni, cPrinter:="", oUser
	   INI oIni file ".\user.ini"
	   oUser:= TUser():new()
   oUser:name:="James"
	   // Get application default printer for oUser
   get cPrinter section oUser:name entry "DefaultPrinter" default prnGetName() of oIni
	   msgInfo(prnGetName(), "Windows default printer is:")
	   msgInfo(cPrinter,"Application default printer from INI file is:")
	   // Set the current printer to cPrinter
   setPrinter( cPrinter )
	   msgInfo( prnGetName(), "Application Current printer as set via code is:" )
	   printerSetup()
	   // Save current printer as default
   set section oUser:name entry "DefaultPrinter" to prnGetName() of oIni
	return nil
	
//--- Set application's current printer. Returns .T. if successful.
// cPrinter must be the name of an existing print device.
function setPrinter(cPrinter)
   local cOldPrinter:="", hDC:=0, aPrn, cText:="", lSuccess:=.f.
	   if cPrinter <> prnGetName()
	      cText := StrTran(GetProfString("Devices"),Chr(0), chr(13)+chr(10))
      aPrn  := Array(Mlcount(cText, 250))
      Aeval(aPrn, {|v,e| aPrn[e] := Trim(Memoline(cText, 250, e)) } )
	      if  ascan(aPrn,cPrinter) > 0
	         cOldPrinter := GetProfString( "windows", "device" , "" )
         WriteProfString( "windows", "device", cPrinter )
         SysRefresh()
         PrinterInit()
         hDC := GetPrintDefault( GetActiveWindow() )
         if hDC>0
            lSuccess:= resetDC( hDC )
         endif
         SysRefresh()
         WriteProfString( "windows", "device", cOldPrinter  )
	      endif
	   endif
return lSuccess
	//--- User class
class TUser
   data name
   method new
   method end virtual
endclass
	method new()
   ::name:=""
return self
	// eof


Link to comment
Share on other sites

 

Como você está SETANDO(Default) cPrinter?

tentou com:

  oFrPrn:PrintOptions:SetShowDialog(.F.) // .f. Direto na impressora
  oFrPrn:Print( .T. )

??

 


/*
Purpose : Save and restore the current printer.
Notes   : When an application is run, the current printer always defaults to the
          Windows default printer. Here is how default to the last used printer in
          the application. Each user can have a different default printer. The printer
          name is saved in a user.ini file under the user's section.
Author  : James Bott, jbott@compuserve.com
Date    : 04/09/04 10:53:04
Language: Fivewin Harbour 2.4. Harbour 43 Alpha.
*/
	
#include "fivewin.ch"
	
//--- Test
function main()
   local oIni, cPrinter:="", oUser
	   INI oIni file ".\user.ini"
	   oUser:= TUser():new()
   oUser:name:="James"
	   // Get application default printer for oUser
   get cPrinter section oUser:name entry "DefaultPrinter" default prnGetName() of oIni
	   msgInfo(prnGetName(), "Windows default printer is:")
	   msgInfo(cPrinter,"Application default printer from INI file is:")
	   // Set the current printer to cPrinter
   setPrinter( cPrinter )
	   msgInfo( prnGetName(), "Application Current printer as set via code is:" )
	   printerSetup()
	   // Save current printer as default
   set section oUser:name entry "DefaultPrinter" to prnGetName() of oIni
	return nil
	
//--- Set application's current printer. Returns .T. if successful.
// cPrinter must be the name of an existing print device.
function setPrinter(cPrinter)
   local cOldPrinter:="", hDC:=0, aPrn, cText:="", lSuccess:=.f.
	   if cPrinter <> prnGetName()
	      cText := StrTran(GetProfString("Devices"),Chr(0), chr(13)+chr(10))
      aPrn  := Array(Mlcount(cText, 250))
      Aeval(aPrn, {|v,e| aPrn[e] := Trim(Memoline(cText, 250, e)) } )
	      if  ascan(aPrn,cPrinter) > 0
	         cOldPrinter := GetProfString( "windows", "device" , "" )
         WriteProfString( "windows", "device", cPrinter )
         SysRefresh()
         PrinterInit()
         hDC := GetPrintDefault( GetActiveWindow() )
         if hDC>0
            lSuccess:= resetDC( hDC )
         endif
         SysRefresh()
         WriteProfString( "windows", "device", cOldPrinter  )
	      endif
	   endif
return lSuccess
	//--- User class
class TUser
   data name
   method new
   method end virtual
endclass
	method new()
   ::name:=""
return self
	// eof

 

  oFrPrn:PrintOptions:SetShowDialog(.F.)   ESSE JA UTILIZO ASSIM
  oFrPrn:Print( .T. )  ESSE UTILIZO SEM O PARAMETRO

VOU FAZER O TESTE COM O PARAMENTRO .T. PARA VER SE MUDA ALGUMA COISA... 

VLW1 OBGDO!

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...