'
'Class description:
'
!short:Report class structure:
Classn Report:
~~~~~~~~~~~~~~
This class is used for report creation.

Common use:
~~~~~~~~~~~
LOCAL OBJECT Rep OF Report  //new object created
Rep:Init(...)               //initialised
Rep:AddTop(...)             //report header appended
Rep:AddField(...)           //repeatedly appended the report columns
...                         //...definitions
Rep:AddBottom(...)          //bottom line appended

This object initialisation adds this object as task to the task stack
and the task swapper does the activating and finishing of this object.

Source code is in C_Report.prg

!seealso: c_finfo.ngo:FInfo c_info.ngo:Info c_view.ngo:View c_color.ngo:Color ob_class.ngo:"Class hierarchy"

!short:~~~~~~~~~~~~~~~~~~~~~~~
!short:create class Report from DBrowse
!short:  export:
!short:  var FName      //""
^BReport:FName^N: read-only: character
  Report file name.

!short:  var Handle     //-1
^BReport:Handle^N: private: numeric
  Access variable to file FName.

!short:  var Width      //0
^BReport:Width^N: private: numeric
  Report width in number of characters (columns)

!short:  var TopText    //""
^BReport:Top^N: read-only: character
  Report header, the lines can be separated by semicolon (;)

!short:  var Fields     //{}
^BReport:Fields^N: read-only: array
  The columns definition in form of:
  Fields:={}
  AAdd( Field, {cTitle,cField,cPicture,lTotal,cSubTotal} )
  ...
  Where:
  cTitle    - is column heading
  cField    - is a full name of database field (alias->field).
  cPicture  - is a picture mask definition for this field
  lTotal    - is true if the field should be totaled
  cSubTotal - is the database filed name after which we shall total or ""

!short:  var FSizes     //{}
^BReport:FSizes^N: read-only: array
  Report file column sizes.

!short:  var Totals     //{}
^BReport:Totals^N: read-only: array
  Report file column totals.

!short:  var BottomText //""
^BReport:BottomText^N: read-only: character
  Bottom text of the report, the rows are separated with semicolon (;).

!short:  var OldOrder   //0
^BReport:OldOrder^N: private: numeric
  When creating the report can be a new index file activated, so the last
  opened index file number is stored here to restore the indexes after the
  report is created or when switching to other task.

!short:  var OnlyTotals //false
^BReport:OnlyTotals^N: public: logical
  Default is false, i.e. standart report creation; if you set it to true,
  then will be output only subtotals and totals.

!short:  method New=ReportNew            //o:New() --> self
^BReport:New()^N: public: return self
  Object is filled with default values. The following predcessor variables
  are modified:

  ^UReport:InfoBlock^N: public: code_block: override
    The code block for writing the processed record number of selected
    database to the bottom window  border is stored here.

  ^UReport:DoneBlock^N: public: code_block: override
    If the user inerrupts the report creation, the output file and the
    temporary index file must be closed and deleted.

!short:  method Init=ReportInit          //o:Init(Name,R,C,Rs,Cs,Clr,Shd) --> true
^BReport:Init(Name,R,C,Rs,Cs,Clr,Shadow)^N: public: return true
  The object is initialised with the same parameters as the predcessor
  method Init() of class Box.

!short:  method AddData=ReportAddData    //o:AddData(cTop,aFields,cBottom,lnlyTotals) --> true
^BReport:AddData(cTop,aFields,cBottom,lOnlyTotals)^N: public: return true
  The instvar variables Top, Fields, Bottom and OnlyTotals of this object
  can be directly modified. The parameter values are directly assigned to
  instvar variables of the object.

!short:  method AddTop=ReportAddTop      //o:AddTop(cTop) --> true
^BReport:AddTop(cTop)^N: public: return true
  The parameter cTop is copied to instvar variable Top of this object.

!short:  method AddField=ReportAddField  //o:AddField(cTitle,cField,cPic,lTot,cSubT) --> true
^BReport:AddField(cTitle,cField,cPicture,lTotal,cSubTotal)^N:
  public: return true
  The instvar variable Fields of this object is created, the repeated
  calling of this method fills the value of its parameters to this variable.
  See the structure and meaning of instvar variable Fields.

!short:  method AddBottom=ReportAddBottom//o:AddBottom(cBottom) --> true
^BReport:AddBottom(cBottom)^N: return true
  The cBottom parameter is copied to instvar variable Bottom of this object.

!short:  method VPaint=ReportVPaint      //o:VPaint() --> true
^BReport:VPaint()^N: private: return true
  The paint method for displaying this class of objects.

!short:  method VProcess=ReportVProcess  //o:VProcess() --> true
^BReport:VProcess();^N: private: return true
  This method creates the report, after that destroys itself and creates the
  child process to view the created report.

!short:  endclass

