impresion de documento tipo factura

impresion de documento tipo factura

Postby wilsongamboa » Tue Jan 22, 2019 8:06 pm

Estimados colegas buenas tardes
antes de inventar nuevamente la rueda por favor si alguien tiene un ejemplo con tprinter o treport o fastresport o pdf y lo quiera compartir como guia necesito imprimir documentos en impresoras windows de la forma de una factura con cabecera, cuerpo con varias lineas y pie de pagina
muchas gracias por su ayuda, trabajo con dbfs
saludos cordiales
Wilson 'W' Gamboa A
Wilson.josenet@gmail.com
User avatar
wilsongamboa
 
Posts: 576
Joined: Wed Oct 19, 2005 6:41 pm
Location: Quito - Ecuador

Re: impresion de documento tipo factura

Postby cmsoft » Tue Jan 22, 2019 11:02 pm

Code: Select all  Expand view
*****************************************************************************
*** Imprimir factura
*******************************************
FUNCTION ImprimirFactura()
LOCAL i, x, y, oPrn, nRow, oFont, oFont1, oFont2, oFont3, aTipoComp := {"ORIGINAL","DUPLICADO","TRIPLICADO"}
   
   
   ** Defino fonts
   DEFINE FONT oFont   NAME "ARIAL"       SIZE config->fon,config->fon*2.5
   DEFINE FONT oFont1  NAME "CALIBRI"     SIZE config->fon*1.5,config->fon*4 BOLD
   DEFINE FONT oFont2  NAME "CALIBRI"     SIZE config->fon*4,config->fon*7 BOLD
   DEFINE FONT oFont3  NAME "ARIAL"       SIZE config->fon,config->fon*2.5 BOLD
   
   PRINT oPrn NAME "Factura" PREVIEW MODAL
   oPrn:SetPortrait()
   oPrn:SetPage(9)
   FOR x := 1 TO config->copias
       PAGE   
     @ 0,0 PRINT TO oPrn IMAGE ALLTRIM(config->arch_fondo) SIZE oPrn:nHorzRes(), oPrn:nVertRes() PIXEL GRAY
       
       
       oPrn:CmBox( .5, .5, 1.5, 20.5 ) // Box arriba
     oPrn:CmBox( 1.5, .5, 5, 20.5 ) // Box datos del comprobante
     oPrn:CmBox( 5.3, .5, 7.5, 20.5 ) // Box datos del cliente
     oPrn:CmBox(   8, .5, 9, 20.5 ) // Box titulos    
     oPrn:CmBox( 22, .5, 25, 20.5 )   // Box datos del iva
     @ .8, 01.15 PRINT TO oPrn TEXT aTipoComp[x] ;
              SIZE 18,.9 CM FONT oFont1 ALIGN "C"     
     //Config->imprime 1: Logo, 2:Texto, 3: Ambos
     IF config->imprime = 2 .or. config->imprime = 3
        @ 1.6,.6 PRINT TO oPrn IMAGE "logo.jpg" SIZE 8, 3 CM
     ENDIF
     IF config->imprime = 1 .or. config->imprime = 3
           @ 2, 01 PRINT TO oPrn TEXT ALLTRIM(config->nomb_emp) ;
                  SIZE 9,1 CM FONT oFont1 ALIGN "C" LASTROW nRow
         @ nRow, 01 PRINT TO oPrn TEXT "Domicilio Comercial:"config->dire_emp ;
                  SIZE 9,1 CM FONT oFont LASTROW nRow ALIGN "C"           
       ENDIF
       oPrn:CmSay( 2  , 11, cabecera->tipoformu, oFont1 )  
       oPrn:CmBox( 1.5, 9.4, 2.7, 10.7 )   // Box cuadrito comprobante
       oPrn:CmSay( 1.5, 9.8, cabecera->letra,oFont2)
       oPrn:CmSay( 2.3, 9.5, "Cod:"+cabecera->tipfor,oFont)
       oPrn:CmSay( 2.5, 11, "Punto de venta:"+cabecera->puntovta + " Comprobante Nro:"+cabecera->nrofact,oFont)
       oPrn:CmSay( 3.0, 11, "Fecha de emision:"+DTOC(cabecera->fecha),oFont)

     oPrn:CmSay( 3.5, 11, "CUIT:"+config->cuit_emp,oFont)
     oPrn:CmSay( 4.0, 11, "Ingresos brutos:"+config->ingb_emp,oFont)   
     oPrn:CmSay( 4.5, 11, "Inicio de Actividades:"+DTOC(config->inac_emp),oFont)       
         

       
     @ 5.5, 1   PRINT TO oPrn TEXT "C.U.I.T.:" ;
              SIZE 3,.5 CM FONT oFont3 ALIGN "R"
     @ 5.5, 4.1 PRINT TO oPrn TEXT cabecera->cuit_clie ;
              SIZE 6,.5 CM FONT oFont ALIGN "L"
     @ 5.5, 9.5  PRINT TO oPrn TEXT "Razon Social:" ;
              SIZE 2.5,1 CM FONT oFont3 ALIGN "R"
     @ 5.5, 12.5 PRINT TO oPrn TEXT ALLTRIM(cabecera->nombre) ;
              SIZE 8,1 CM FONT oFont LASTROW nRow ALIGN "L"
     @ 6,1  PRINT TO oPrn TEXT "Condicion IVA:" ;
              SIZE 3,.5 CM FONT oFont3 ALIGN "R"
     @ 6,4.1 PRINT TO oPrn TEXT cabecera->coniva ;
              SIZE 6,.5 CM FONT oFont ALIGN "L"
     nRow := IF(nRow<6,6,nRow)
       @ nRow, 9.5 PRINT TO oPrn TEXT "Direccion:" ;
              SIZE 2.5,1 CM FONT oFont3 ALIGN "R"
     @ nRow, 12.5 PRINT TO oPrn TEXT ALLTRIM(cabecera->direccion) + " " + ;
                                           ALLTRIM(cabecera->localidad) ;
              SIZE 8,1 CM FONT oFont ALIGN "L"
     @ 6.5, 01 PRINT TO oPrn TEXT "Condicion venta:" ;
              SIZE 3,.5 CM FONT oFont3 ALIGN "R"
     @ 6.5, 4.1 PRINT TO oPrn TEXT cabecera->formapag;
              SIZE 6,.5 CM FONT oFont ALIGN "L"
       

       @ 8.2, 01 PRINT TO oPrn TEXT "Codigo" ;
              SIZE 2.8,.5 CM FONT oFont ALIGN "R"
     @ 8.2, 04 PRINT TO oPrn TEXT "Descripcion del producto" ;
              SIZE 7,.5 CM FONT oFont ALIGN "L"
     @ 8.2, 11 PRINT TO oPrn TEXT "Cantidad" ;
              SIZE 2,.5 CM FONT oFont ALIGN "R"
     @ 8.2, 14 PRINT TO oPrn TEXT "Pr.Unitario" ;
              SIZE 2,.5 CM FONT oFont ALIGN "R"
     @ 8.2, 17 PRINT TO oPrn TEXT "Subtotal" ;
              SIZE 3,.5 CM FONT oFont ALIGN "R"
       y := 9.2
       detalle->(DbGoTop())
       FOR i = 1 TO detalle->(RecCount())
           
         @ y, 01 PRINT TO oPrn TEXT STR(detalle->codart,13) ;
              SIZE 2.8,.5 CM FONT oFont ALIGN "R"
         @ y, 04 PRINT TO oPrn TEXT ALLTRIM(detalle->detart) ;
              SIZE 7,1 CM FONT oFont LASTROW nRow
         @ y, 11 PRINT TO oPrn TEXT STR(detalle->cantidad,08,2) ;
              SIZE 2,.5 CM FONT oFont ALIGN "R"
         @ y, 14 PRINT TO oPrn TEXT  STR(detalle->unitario,9,2) ;
              SIZE 2,.5 CM FONT oFont ALIGN "R"
         @ y, 17 PRINT TO oPrn TEXT STR(detalle->total,9,2)
              SIZE 3,.5 CM FONT oFont ALIGN "R"        
           detalle->(DBSkip())
           y := nRow + .1
        NEXT      
        y := y + .5
      @ y, 1 PRINT TO oPrn TEXT cabecera->observa ;
              SIZE 18,3 CM FONT oFont ALIGN "L"
      @ 22.5,1  PRINT TO oPrn TEXT "Percepcion IIBB "+STR(cabecera->percep,6,2)+"% $:" ;
              SIZE 5,.5 CM FONT oFont3 ALIGN "R"
      @ 22.5,6.1 PRINT TO oPrn TEXT STR(cabecera->IIBB,12,2) ;
              SIZE 3,.5 CM FONT oFont ALIGN "R"
               
      @ 22.5, 12 PRINT TO oPrn TEXT "Subtotal $:" ;
              SIZE 4,.5 CM FONT oFont3 ALIGN "R"
        @ 22.5, 17 PRINT TO oPrn TEXT STR(cabecera->subtotal,10,2) ;
              SIZE 3,.5 CM FONT oFont ALIGN "R"
      @ 23, 12 PRINT TO oPrn TEXT "Otros Tributos $:" ;
              SIZE 4,.5 CM FONT oFont3 ALIGN "R"
      @ 23, 17 PRINT TO oPrn TEXT STR(cabecera->otros,10,2) ;
              SIZE 3,.5 CM FONT oFont ALIGN "R"
      @ 23.5, 12 PRINT TO oPrn TEXT "Total $:" ;
              SIZE 4,.5 CM FONT oFont3 ALIGN "R"
      @ 23.5, 17 PRINT TO oPrn TEXT STR(cabecera->totalgen,10,2) ;
              SIZE 3,.5 CM FONT oFont ALIGN "R"       
             
       ENDPAGE
   NEXT x
   ENDPRINT
RETURN nil

Espero te sea de utilidad
Esto es con print en modo preview
User avatar
cmsoft
 
Posts: 1257
Joined: Wed Nov 16, 2005 9:14 pm
Location: Mercedes - Bs As. Argentina

Re: impresion de documento tipo factura

Postby wilsongamboa » Thu Jan 24, 2019 1:45 pm

muchas gracias por tu ayuda
ya lo estoy revisando
Gracias
Wilson
Wilson 'W' Gamboa A
Wilson.josenet@gmail.com
User avatar
wilsongamboa
 
Posts: 576
Joined: Wed Oct 19, 2005 6:41 pm
Location: Quito - Ecuador

Re: impresion de documento tipo factura

Postby karinha » Thu Jan 24, 2019 2:03 pm

Cesar Gomez, muy interesante. Usted podría por favor, publicar una imagen?

Gracias, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7613
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: impresion de documento tipo factura

Postby cmsoft » Fri Jan 25, 2019 11:20 pm

Image
Last edited by cmsoft on Tue Feb 05, 2019 2:58 am, edited 1 time in total.
User avatar
cmsoft
 
Posts: 1257
Joined: Wed Nov 16, 2005 9:14 pm
Location: Mercedes - Bs As. Argentina

Re: impresion de documento tipo factura

Postby karinha » Mon Jan 28, 2019 12:22 pm

cmsoft wrote:Image


Very good Cesar, muchas gracias.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7613
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 82 guests