home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Interactive Guide / c-cplusplus-interactive-guide.iso / c_ref / csource1 / program4 / rpt_call.smp < prev    next >
Text File  |  1993-02-20  |  3KB  |  91 lines

  1.  
  2. #include "inkey.ch"
  3. #include "wat.ch"
  4.  
  5. // The defaults to change
  6. #define   ACTL_    {"PRN"   ,  ;
  7.                     .T.     ,  ;
  8.                     NIL     ,  ;
  9.                     .F.     ,  ;
  10.                    "NONE"   ,  ;
  11.                     .F.     ,  ;
  12.            chr(27)+chr(48)  ,  ;
  13.                     NIL     ,  ;
  14.                       1     ,  ;
  15.                   64000     ,  ;
  16.                       1     ,  ;
  17.                   "LINE"    ,  ;
  18.                       1     ,  ;
  19.                      68     ,  ;
  20.                       0     ,  ;
  21.                       0     ,  ;
  22.                     210     ,  ;
  23.                       1     ,  ;
  24.                      .F.         }
  25.  
  26. //────────────────────────────────────────────────────────────────────────────
  27.     FUNCTION Rpt_Call( cwant )
  28. *-- Purpose: To print the reports.
  29. *-- Updated: Mon  10-12-1992  11:47:56
  30. //────────────────────────────────────────────────────────────────────────────
  31.   LOCAL cScrSave, ar_, sortby, dte, ctl_ := ACTL_, cb, bSavErr
  32.  
  33.   Pushdbf()
  34.   Pushv()
  35.   cScrSave := scrsave(0,0, maxrow(), maxcol())
  36.   DO CASE
  37.      CASE cwant == 'Dept Purch'
  38.           // ar_ := PrtDPur()
  39.           IF Lastkey() != K_ESC
  40.              Sortby    := 'DEPT. of PURCHASE  '
  41.              Dte       := dtoc(ar_[1])+" - "+ dtoc(ar_[2])
  42.  
  43.                 SELECT (select('PropDept'))
  44.              // Save current status of propdept.dbf
  45.                 Pushdbf()
  46.                 dbsetorder(1)
  47.                 dbseek(ar_[3])
  48.                 SELECT (select('Property'))
  49.              // Save current status of property.dbf
  50.                 Pushdbf()
  51.                 dbsetorder(6)
  52.              // You could do better.  I know you could.
  53.                 SET FILTER TO property->deptpur   >= ar_[3] .AND.;
  54.                               property->deptpur   <= ar_[4] .AND.;
  55.                               property->PurchDate >= ar_[1] .AND.;
  56.                               property->PurchDate <= ar_[2]
  57.                 dbgotop()     // Activate the filter
  58.  
  59.              // Test to see if there is at least one item to print.
  60.                 IF eof()
  61.                    Alert("There is nothing to print, you dummy!")
  62.                 ELSE
  63.                    IF(ar_[5], ctl_[1] := "DEPTPUR.DOC",)
  64.                    devpos( maxrow(), maxcol() )
  65.  //──> Good Part
  66.              // Skip.
  67.              // If the dept is the same, do nothing, else goto next dept.
  68.              // eof() returns a logical value to the variable lDone.
  69.                 cb :=  {|brk_| dbskip(1), ;
  70.                        IF(brk_[1]==property->deptpur, NIL,;
  71.                                    propdept->(dbseek(property->deptpur))),;
  72.                        eof()}
  73.  
  74.                     // ────────────────────────────────────────┐
  75.                        RptDept2( , cb, ctl_, Sortby, Dte)
  76.                     //─────────────────────────────────────────┘
  77.  //──> Good Part End
  78.  
  79.                 ENDIF
  80.                 SET FILTER TO
  81.                 Popdbf()
  82.                 SELECT (select('PropDept'))
  83.                 Popdbf()
  84.              ENDIF
  85.   ENDCASE
  86.   Popv()
  87.   Popdbf()
  88.   ScrRest( cScrSave )
  89.   RETURN NIL
  90.  
  91.