Uso de Select Printer con medidas personalizada

Moderator: Rathinagiri

Post Reply
claudiotedesco
Posts: 132
Joined: Thu Jul 31, 2008 12:05 pm

Uso de Select Printer con medidas personalizada

Post by claudiotedesco »

Mi consulta es la siguiente tengo un pequeño sistema que imprime un recibo de 14 cm x 21,59.
Cuando hice el sistema la opcion de imprimr recibo con la version 3.035 funcionaba perfecto.
Ahora le tuve que hacer unas modificaciones de datos y el recibo no imprime, es decir me hace el salto de hoja y no imprime nada, salvo que si hago SELECT PRINTER DEFAULT TO lSuccess PREVIEW sale todo bien.
Lo compile con distintas versiones de HMG y el mismo resultado
Que podría ser?
Gracias por la Ayuda
Claudio

My question is this I have a small system that prints a receipt of 14 cm x 21.59.
When did the system the option of imprimr receipt with version 3.035 worked perfect.
Now I had to make some modifications to data and receipt does not print, ie makes me jump leaf and prints nothing, except that if I SELECT DEFAULT TO PRINTER PREVIEW lSuccess everything goes well.
We compile different versions of HMG and the same result
What could it be?
Thanks for the help
Claudio

Code: Select all

*------------------------------------------------------------------------------*
Procedure PrintTest2()
*------------------------------------------------------------------------------*
Local i
Local lSuccess

SELECT PRINTER DEFAULT TO lSuccess PAPERSIZE PRINTER_PAPER_USER PAPERLENGTH 1400 PAPERWIDTH 2159 COPIES 2


If lSuccess == .T.
PrintDoc()     // recorre una tabla DBF e imprimi los datos que necesita el recibo
// MsgInfo('Impresion Finalizada')
CLOSE ALL
EndIf

Return
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

Uso de Select Printer con medidas personalizada

Post by Pablo César »

Hola claudiotedesco,

Seria interesante que describieras como haces en tu PrintDoc para encaminar al device.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
claudiotedesco
Posts: 132
Joined: Thu Jul 31, 2008 12:05 pm

Re: Uso de Select Printer con medidas personalizada

Post by claudiotedesco »

Hola

Adjunto el archivo completo para que lo ven.
Gracias

Code: Select all

#include <hmg.ch>

Function Main(precibo)
PUBLIC wreimpre := 0

Set  Multiple OFF    
SET CENTURY ON
SET DATE TO FRENCH 
IF precibo = NIL
   MsgExclamation("No existe el numero de Recibo", "ERROR")
   return  nil
ENDIF
IF VAL(precibo) = 0
   wreimpre := 1
ENDIF
        Load Window Main
        main.text_1.value := VAL(precibo)
        Main.Center
        Main.Activate
Return

*------------------------------------------------------------------------------*
Procedure PrintTest()
*------------------------------------------------------------------------------*
Local i 
Local lSuccess

*	SELECT PRINTER DIALOG TO lSuccess PREVIEW // Selecciona antes de mostrar el
	*Preview la impresora donde se desea emitir el listado	

  * SELECT PRINTER DEFAULT TO lSuccess PREVIEW PAPERSIZE PRINTER_PAPER_USER PAPERLENGTH 1400 PAPERWIDTH 2159  
   * no selecciona impresora  muestra el listado en PREVIEW                                                

  SELECT PRINTER DEFAULT TO lSuccess PREVIEW 

	If lSuccess == .T.
		PrintDoc()
//		MsgInfo('Impresion Finalizada')
    CLOSE ALL
	EndIf

Return

*------------------------------------------------------------------------------*
Procedure PrintTest2()
*------------------------------------------------------------------------------*
Local i 
Local lSuccess
                                                   
 SELECT PRINTER DEFAULT TO lSuccess PAPERSIZE PRINTER_PAPER_USER PAPERLENGTH 1400 PAPERWIDTH 2159  COPIES 2


	If lSuccess == .T.
		PrintDoc()
//		MsgInfo('Impresion Finalizada')
    CLOSE ALL
	EndIf

Return


*------------------------------------------------------------------------------*
Procedure PrintDoc
*------------------------------------------------------------------------------*
Local i
wlist_rec:= main.text_1.value

USE INMUEBLE INDEX C_INMUEB SHARE NEW 

USE LOCATARI INDEX C_LOCATA SHARE NEW

USE LIQUIDA INDEX L_LEGAJO, L_LEGAJ2 SHARE NEW

USE CONTRATO INDEX C_CONTRA SHARE NEW

USE TOTALES INDEX RECIB_TO SHARE NEW

USE CHEQUES SHARE NEW

USE LIQUID2 INDEX L2_CUEN, L2_LEGAJ SHARE NEW

SELECT TOTALES
SEEK wlist_rec
IF .NOT. FOUND()
    MSGINFO("no existe el Nº de Recibo","ERROR") 
    CLOSE DATABASES
    RETURN  nil
ENDIF
wfecha = F_PAGO_T
whora = HORA_T
wleg_rec = LEGAJO_T
wpesos1 = PESOS_T
wdolar1 = DOLAR_T
wobser = OBSERV_T
wsuma_ch = 0
IF CHEQUE_T = "S"
   SELECT CHEQUES
   SET FILTER TO wlist_rec = RECIBO_CH
   SUM CHEQUE_CH TO wsuma_ch FOR RECIBO_CH = wlist_rec
   SET FILTER TO
ENDIF
wtot_gral = wpesos1 + wdolar1 + wsuma_ch

wnombre = TOTALES->CONCEPTO_T
wcuit = " "
wtipo = " "

IF wleg_rec <> space(5)
     SELECT CONTRATO
     SEEK wleg_rec
     IF FOUND()
        winm_rec = COD_INM_CO
        wloc_rec = COD_LOC_CO
     ELSE
        winm_rec = wleg_rec
        wloc_rec = 0
     ENDIF
     SELECT INMUEBLE
     SEEK winm_rec
     IF .NOT. FOUND()
        CLOSE DATABASES
        RETURN
     ELSE
       wdeparta = DIR_IN
       wlocal = LOCAL_IN
     ENDIF
     IF TOTALES->ESTADO_2_T = "R"
        SELECT LOCATARI
        SEEK wloc_rec
        IF FOUND()
           wnombre = NOMBRE_LO
           wcuit = CUIT
           wtipo = CARACTER
        ENDIF
     ENDIF
ENDIF
*------------------------

	START PRINTDOC

			START PRINTPAGE
			wpagina := 1
      wsenaltitulo :=0	
      ENCABEZA()
        

*-------------------------------------DETALLE FACTURA

SELECT LIQUIDA
SET ORDER TO 1
SET SOFTSEEK ON

wmes := wanio := wcuenta := 0
SEEK wleg_rec+STR(wanio,4)+STR(wmes,2)+STR(wcuenta,5)
wtot_pago = 0	
wlinea:=51
DO WHILE LEGAJO_LI = wleg_rec  .AND.  !EOF()
   
   SALTO()
   
   IF ESTADO_LI = "I"  .AND. PAGO_LI = "P"  .AND. RECIBO_LI = wlist_rec
       wlinea += 3
      @ wlinea,11   PRINT MES_LI  FONT "Courier New" SIZE 8     
      @ wlinea,14   PRINT "/"     FONT "Courier New" SIZE 8  
      @ wlinea,15   PRINT ANIO_LI FONT "Courier New" SIZE 8    

      ANCHO=59
      LINEAS=MLCOUNT(RTRIM(DETALLA_LI),ANCHO)
      FOR LINEA= 1 TO LINEAS
          LIN_IMP=MEMOLINE(DETALLA_LI,ANCHO,LINEA)
          IF LINEA = 1
             @ wlinea,25 PRINT LIN_IMP    FONT "Courier New" SIZE 8
          ELSE
              wlinea += 4 
             @ wlinea,25 PRINT LIN_IMP  FONT "Courier New" SIZE 8
          ENDIF
      NEXT
	  	  
      IF CUENTA_LI = 4                                 //// AGUA
         @ wlinea,130  PRINT BIMESTR_LI  FONT "Courier New" SIZE 8  RIGHT
         @ wlinea,145  PRINT VTO_LI      FONT "Courier New" SIZE 8
      ENDIF
	  
      @ wlinea,170 PRINT "$"          FONT "Courier New" SIZE 8 RIGHT 
      @ wlinea,185 PRINT IMPORTE_LI   FONT "Courier New" SIZE 8 RIGHT 
      wtot_pago = wtot_pago + IMPORTE_LI
   ENDIF
   SKIP 1
   
ENDDO
SET SOFTSEEK OFF
wsenaltitulo := 1
SALTO()
wlinea += 5
@ wlinea,140 PRINT "TOTAL   -->" FONT "Courier New" SIZE 8  BOLD
@ wlinea,160 PRINT "$"           FONT "Courier New" SIZE 8
@ wlinea,185 PRINT wtot_pago     FONT "Courier New" SIZE 8  RIGHT
*---------------------------------------------------------------------------		
   SALTO()
   wlinea += 4
   @ wlinea,30 PRINT "FORMA DE PAGO"   FONT "Courier New" SIZE 7  BOLD  UNDERLINE 
   IF wpesos1 > 0
       SALTO()
       wlinea += 3
      @ wlinea,10 PRINT "Efectivo"  FONT "Courier New" SIZE 7
      @ wlinea,30 PRINT "......................................................................................" FONT "Courier New" SIZE 7
      @ wlinea,160 PRINT "$"         FONT "Courier New" SIZE 7 
      @ wlinea,185 PRINT wpesos1     FONT "Courier New" SIZE 7 RIGHT  
   ENDIF
   IF wdolar1 > 0
       SALTO()
       wlinea += 3
      @ wlinea,10 PRINT "Dolares"   FONT "Courier New" SIZE 7
      @ wlinea,30 PRINT "......................................................................................" FONT "Courier New" SIZE 7       
      @ wlinea,160 PRINT "u$s"       FONT "Courier New" SIZE 7  
      @ wlinea,185 PRINT wdolar1     FONT "Courier New" SIZE 7 RIGHT  
   ENDIF		
   
   SELECT TOTALES
   SEEK wlist_rec
   IF CHEQUE_T = "S"
      SELECT CHEQUES
      SET FILTER TO wlist_rec = RECIBO_CH
      GO TOP
      DO WHILE .NOT. EOF()
         SALTO()
         wlinea += 3
         @ wlinea,10  PRINT "Cheque N°:" FONT "Courier New" SIZE 7
         @ wlinea,30  PRINT NUMERO_CH FONT "Courier New" SIZE 7
         @ wlinea,70  PRINT "Bco.:" FONT "Courier New" SIZE 7
         @ wlinea,76  PRINT BANCO_CH FONT "Courier New" SIZE 7
         @ wlinea,160  PRINT "$" FONT "Courier New" SIZE 7
         @ wlinea,185  PRINT CHEQUE_CH FONT "Courier New" SIZE 7 RIGHT  
         SKIP 1
      ENDDO
      SET FILTER TO
      SALTO()
       wlinea += 5
      @ wlinea,20 PRINT "El importe recibido en cheque será acreditado, una vez ‚éste hecho efectivo, a los conceptos detallados en el presente recibo" FONT "Courier New" SIZE 6
   ENDIF
        SALTO()
		    wlinea += 4
        @ wlinea,05 PRINT LINE TO wlinea,210 PENWIDTH 0.1

   SALTO()
   wlinea += 5
   @ wlinea,30  PRINT "Firma:............................" FONT "Courier New" SIZE 7
   @ wlinea,110  PRINT "Aclaración:......................." FONT "Courier New" SIZE 7

   IF wobser <> SPACE(70)
      SALTO()
      wlinea += 5
      @ wlinea,10  PRINT wobser FONT "Courier New" SIZE 7
   ENDIF
	
*-------------------------------------------------
		    @ 125,05 PRINT LINE TO 125,210 PENWIDTH 0.1 
        				
			END PRINTPAGE
	
	END PRINTDOC

Return

*--------------------
FUNCTION ENCABEZA()
*--------------------

@ 05,17 PRINT "Empresa de Tareas" FONT "Arial" SIZE 9 BOLD
        @ 08,25 PRINT "Calle  Santos 558" FONT "Arial" SIZE 7
        @ 11,25 PRINT "Tel: 4656-7812 " FONT "Arial" SIZE 7
    		@ 16,30 PRINT "I.V.A. EXENTO" FONT "Arial" SIZE 7  

		@ 05,100 PRINT IMAGE "letrac.bmp"  WIDTH 9 HEIGHT 9
        
		@ 05,155 PRINT "RECIBO Nº:0002-"+ALLTRIM(STR(wlist_rec)) FONT "Arial" SIZE 11 BOLD
IF wreimpre = 1
    @ 08,120 PRINT "R E I M P R E S I O N" FONT "Arial" SIZE 8 BOLD  
ENDIF
		@ 12,155 PRINT "Fecha:"+DTOC(wfecha) FONT "Arial" SIZE 8 BOLD  
		
		@ 16,155 PRINT "C.U.I.T. Nº  FONT "Arial" SIZE 7 
    @ 19,155 PRINT "Ing. Brutos No Responsable" FONT "Arial" SIZE 7
    @ 22,155 PRINT "Inicio de actividades: " FONT "Arial" SIZE 7
						
		@ 26,05 PRINT LINE TO 26,210 PENWIDTH 0.1 
    
*---------------------------- LOCATARIO DATOS
    @ 28,05 PRINT "Recibimos de: " FONT "Arial" SIZE 9 
    @ 28,26 PRINT wnombre  FONT "Arial" SIZE 9 BOLD
    IF wleg_rec <> space(5)
       @ 27,165 PRINT "Legajo Nº: "+wleg_rec FONT "Arial" SIZE 10 BOLD 
       @ 34,05  PRINT "Domicilio: "+RTRIM(wdeparta)+", "+ALLTRIM(wlocal) FONT "Arial" SIZE 9
       @ 38,05  PRINT "I.V.A.: "+wtipo FONT "Arial" SIZE 9
       @ 38,80  PRINT "CUIT Nº: " + wcuit  FONT "Arial" SIZE 9
   ENDIF
   num = wtot_gral
   DES=space(200)
   caract=space(200)
   DES=CONVERSO(num, caract)
   ANCHO=78
	 DES2 = "La suma de Pesos: "+DES
	 @ 42,05  PRINT DES2 FONT "Arial" SIZE 8
  
  @ 45,05 PRINT "en concepto de: " FONT "Arial" SIZE 8
IF wsenaltitulo = 0
   @ 50,13  PRINT "Fecha"  FONT "Courier New" SIZE 8 BOLD
   @ 50,25  PRINT "Detalle" FONT "Courier New" SIZE 8 BOLD
   @ 50,130 PRINT "Bim." FONT "Courier New" SIZE 8    BOLD
   @ 50,145 PRINT "Vto." FONT "Courier New" SIZE 8    BOLD
   @ 50,170 PRINT "Importe" FONT "Courier New" SIZE 8  BOLD
ENDIF
@ 118,170 PRINT "Página: "+str(wpagina,2) FONT "Courier New" SIZE 7 BOLD   
wpagina+=1  
  RETURN
  
*----------------
FUNCTION SALTO()  
*----------------
  IF wlinea >=110
   @ 125,05  PRINT LINE TO 125,210 PENWIDTH 0.1 
   END PRINTPAGE
   START PRINTPAGE
   ENCABEZA() 
   wlinea:=51
ENDIF
RETURN



*----------------*
FUNCTION CONVERSO
*----------------*
PARAMETERS numero, string

retorno=" "
centa=numero-int(numero)
numero=int(numero)
c_numero=trim("        "+str(numero))
largo=len(c_numero)
c1_num=val(SUBSTR(c_numero,LEN(C_NUMERO)-2,3))
do  CENT_CONV with c1_num,retorno
string=retorno
c1_num=val(substr(c_numero,largo-5,3))
if c1_num <> 0
   do CENT_CONV with c1_num,retorno
   if c1_num=1
      retorno="un"
   endif
   IF LEN(RETORNO) > 0
      if SUBSTR(trim(retorno),LEN(trim(retorno))-2,3)="uno"
         retorno=TRIM(retorno)
         retorno=SUBSTR(retorno,1,len(retorno)-1)
      endif
   ENDIF

   string=trim(retorno)+" mil "+string
endif
c1_num=val(substr(c_numero,largo-8,3))
if c1_num <> 0
   do CENT_CONV with c1_num,retorno
   retorno=TRIM(retorno)
   if c1_num=1
      mill=" millon "
      RETORNO = "un"
   else
      mill=" millones "
   endif
   IF LEN(RETORNO) > 0
      if SUBSTR(retorno,LEN(RETORNO)-2,3)="uno"
         retorno="un"
      endif
   ENDIF
   string=retorno+mill+string
endif
if centa <> 0
   s_centa=str(centa*100,2)
   s_centa=SUBSTR(s_centa,LEN(S_CENTA)-1,2)+"/100"
   if len(string) > 0
      string=TRIM(string)+" con "+s_centa+" cvs."
   else
      string=s_centa+" cvs."
   endif

endif
detalle=string
return detalle

*******************
PROCEDURE CENT_CONV
*******************
parameters tr_dig, retorno

unidades= "uno       dos       tres      cuatro    cinco     seis      siete     ocho      nueve     "
unidades=unidades+"diez      once      doce      trece     catorce   quince    dieciseis diecisietedieciocho diecinueveveinte    "
decenas = "veinti     treinta y  cuarenta y cincuenta ysesenta y  setenta y  ochenta y  noventa y    "
centenas="ciento        doscientos    trescientos    cuatrocientos quinientos    seiscientos    setecientos   ochocientos   novecientos   "
c_num=str(tr_dig,3)
a=val(SUBSTR(c_num,LEN(C_NUM)-1,2))
if a=0
   retorno=""
else
   if a<21
      retorno=substr(unidades,10*a-9,10)
   else
      b=str(a,2)
      c=SUBSTR(b,1,1)
      cn=val(c)
      retorno=TRIM(substr(decenas,11*(cn-1)-10,11))+" "
      if retorno="veinti "
         retorno="veinti"
      endif
      c=substr(b,2,1)
      cn=val(c)
      if cn=0
         retorno=substr(retorno,1,len(retorno)-2)
      else
         retorno=retorno+TRIM(substr(unidades,10*cn-9,10))
      endif
   endif
endif
if VAL(c_num)>99
   b=val(SUBSTR(c_num,1,1))
   if b=1 .and. len(retorno)=0
      retorno="cien"
   else
      retorno=TRIM(substr(centenas,14*b-13,14))+" "+retorno
   endif
endif
return
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

Uso de Select Printer con medidas personalizada

Post by Pablo César »

Claudio, puedo estar errado con lo que te voy a decir, pero a mi me parece que estás intentando imprimir con @... y esta es una forma de imprimir NO GRÁFICA y si en modo RAW.
En mi opinion, deberias crear un archivo del tipo TEXTO y enviarlo a impresora y no de la forma que estás intentado que es de modo gráfico.

No todas las impresora trabajan con el MODE RAW, si es una matricial, provablemente si.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
claudiotedesco
Posts: 132
Joined: Thu Jul 31, 2008 12:05 pm

Re: Uso de Select Printer con medidas personalizada

Post by claudiotedesco »

Hola Pablo te agradezco por la ayuda
Saludos
Claudio
Post Reply