home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 16 / CD_ASCQ_16_0994.iso / news / 4611 / fw16d.ins / IDE / SOURCE / REPORT.PRG < prev    next >
Text File  |  1994-05-25  |  3KB  |  90 lines

  1. // FiveWin Report Tools
  2.  
  3. #include "FiveWin.ch"
  4.  
  5. static aRptBmps
  6.  
  7. //----------------------------------------------------------------------------//
  8.  
  9. function ReportNew()
  10.  
  11.    local cRptName
  12.    local nStart := 1
  13.  
  14.    while File( cRptName := ( "REPORT" + SubStr( Str( nStart + 100, 3 ), 2 ) ;
  15.                              + ".rpt" ) )
  16.       nStart++
  17.    end
  18.  
  19.    if ! File( cRptName )
  20.       DbCreate( cRptName, { { "TYPE",     "N",  1, 0 },;
  21.                             { "DESCRIPT", "C", 50, 0 } } )
  22.    endif
  23.  
  24.    ReportOpen( cRptName )
  25.  
  26. return nil
  27.  
  28. //----------------------------------------------------------------------------//
  29.  
  30. function ReportOpen( cRptName )
  31.  
  32.    local oWndRpt, oIco, oBrw, oBar
  33.    local cAlias
  34.    field Type, Descript
  35.  
  36.    DEFAULT cRptName := cGetFile( "FiveWin IDE Report ( *.rpt ) | *.rpt",;
  37.                                  "Select a Report" ),;
  38.            aRptBmps := GetRptBmps()
  39.  
  40.    if ! Empty( cRptName )
  41.       USE ( cRptName ) NEW SHARED
  42.       cAlias = Alias()
  43.       If RecCount() == 0
  44.          APPEND BLANK ; RLock() ; ( cAlias )->Type := 1 ; UNLOCK
  45.          APPEND BLANK ; RLock() ; ( cAlias )->Type := 1 ; UNLOCK
  46.          APPEND BLANK ; RLock() ; ( cAlias )->Type := 1 ; UNLOCK
  47.          APPEND BLANK ; RLock() ; ( cAlias )->Type := 1 ; UNLOCK
  48.  
  49.          APPEND BLANK ; RLock() ; ( cAlias )->Type := 2 ; UNLOCK
  50.          APPEND BLANK ; RLock() ; ( cAlias )->Type := 2 ; UNLOCK
  51.          APPEND BLANK ; RLock() ; ( cAlias )->Type := 2 ; UNLOCK
  52.          APPEND BLANK ; RLock() ; ( cAlias )->Type := 2 ; UNLOCK
  53.  
  54.          APPEND BLANK ; RLock() ; ( cAlias )->Type := 3 ; UNLOCK
  55.          APPEND BLANK ; RLock() ; ( cAlias )->Type := 3 ; UNLOCK
  56.          APPEND BLANK ; RLock() ; ( cAlias )->Type := 3 ; UNLOCK
  57.          APPEND BLANK ; RLock() ; ( cAlias )->Type := 3 ; UNLOCK
  58.       endif
  59.       INDEX ON Field->Type TO ( cAlias )
  60.       SET INDEX TO ( cAlias )
  61.    else
  62.       return nil
  63.    endif
  64.  
  65.    DEFINE ICON oIco RESOURCE "Report"
  66.  
  67.    DEFINE WINDOW oWndRpt FROM 1, 1 TO 23, 33 ;
  68.       TITLE "Report: " + cNoPath( cNoExt( cRptName ) ) MDICHILD ;
  69.       ICON oIco
  70.  
  71.    DEFINE BUTTONBAR oBar OF oWndRpt
  72.  
  73.    DEFINE BUTTON RESOURCE "Exec" OF oBar ;
  74.       MESSAGE "Execute this report"
  75.  
  76.    @  0, 0 LISTBOX oBrw ;
  77.       FIELDS aRptBmps[ ( cAlias )->( Type ) ], ( cAlias )->( Descript ) ;
  78.       HEADERS "", "Description" ;
  79.       COLSIZES 16, 200 ;
  80.       SIZE 400, 400
  81.  
  82.    oWndRpt:SetControl( oBrw )
  83.  
  84.    ACTIVATE WINDOW oWndRpt ;
  85.       VALID oBrw:lCloseArea()
  86.  
  87. return nil
  88.  
  89. //----------------------------------------------------------------------------//
  90.