| Seleccionemos del botón de lista Object --- New Subroutine/Function 
  ---Y digitemos el nombre Imprimir Reporte y digitemos el siguiente código:
 rem ' -----------------------------------------------------------------rem ' Imprimir Reporte
 rem ' -----------------------------------------------------------------
 Imprimir_Reporte: Print (Pchan,err=Cerrar_Impresora)'cp',"Ferreteria 
  El Clavo Torcido S.A.",@(54),"Sistema de Inventario",@(114),"Pagina 
  :",1Print (Pchan,err=Cerrar_Impresora)Pad("Entrada de Compras ",132,"C"),
 :@(114),"Fecha :",Date(0:"%Dz/%Mz/%Yl")
 Print (Pchan,err=Cerrar_Impresora)@(114),"Hora :",Date(0:"%h:%m:%p")
 Print (Pchan,err=Cerrar_Impresora)fill(132,"-")
 Print (Pchan,err=Cerrar_Impresora)Encabezado$
 Print (Pchan,err=Cerrar_Impresora)fill(132,"-")
 Total=0 for fila%=1 to 20 gml.set%=1call "gml::tpl_prep"
 gml_tpl.row_n%=fila%
 call "gml::fetch"
 if num(gml_tpl.col$[5])=0 then: Goto Siguiente_Fila
 Dim Datos$:"Codigo:C(6),Descripcion:C(50),Cantidad:N(10),Costo:N(15),Total:N(15)" Datos.Codigo$ =gml_tpl.col$[1]Datos.Descripcion$ =gml_tpl.col$[2]
 Datos.Cantidad$ =str(num(gml_tpl.col$[3]):"##0.00")
 Datos.Costo$ =str(num(gml_tpl.col$[4]):m$)
 Datos.Total$ =str(num(gml_tpl.col$[5]):m$)
 Print (pchan,err=Cerrar_Impresora)Datos.Codigo$," 
  ",Datos.Descripcion$," :",Datos.Cantidad$," ",Datos.Costo$," 
  ",Datos.Total$ Total=Total+num(gml_tpl.col$[5]) Siguiente_Fila:next fila%
 if Total<>0 then: Print (pchan,err=Cerrar_Impresora)fill(132,"-");
 : Print (pchan,err=Cerrar_Impresora)"Total "+fill(79),Total:m$
 Cerrar_Impresora:Close (pchan)
 Return
 |