unit journal; {$mode ObjFPC}{$H+} interface uses Classes, SysUtils,cgiReport,xpMemParamManagerUnit; type { TRepJournal } TRepJournal=class(TReportCommand) private public class function CommandSubClass: string; override; procedure Prepare; override; procedure OnFillVariables(AVariables: TxpMemParamManager); override; end; implementation uses journalscripts,commandcol; { TRepJournal } class function TRepJournal.CommandSubClass: string; begin Result:='journal'; end; procedure TRepJournal.Prepare; var ReportSQL: TSQLScripts48; TempStr : string; begin inherited; ReportSQL := TSQLScripts48.Create(self.Processor, GetInt('schoolyear'), GetInt('class'), GetInt('course'), true); try ReportSQL.OneGroup := '26'; ReportSQL.TwoGroup := '12'; ReportSQL.ThreeGroup := '8'; ReportSQL.FourGroup := '6'; ReportSQL.PageStart := '1'; ReportSQL.PageContinue := ''; if not (ReportSQL.CreateReport) then begin //Raise Exception.Create('Ошибка!!!!');; Exit; end; finally ReportSQL.Free; end; end; procedure TRepJournal.OnFillVariables(AVariables: TxpMemParamManager); begin AVariables['ClassName'] := processor.QueryValue(format('select name from group_histrory where gid=%d and school_year=%d',[getInt('class'),getInt('schoolyear')])); AVariables['School_Year'] := 'на ' + processor.QueryValue(format('select name from school_year where xp_key=%d',[getInt('schoolyear')]))+' учебный год' + #13#10; AVariables['ClassTeacher'] := ''; AVariables['EmptyReport'] := true; AVariables['TermCount'] := Processor.QueryValue('SELECT COUNT(*) FROM tmp_report_journal_SheduleTerms_terms;'); AVariables['StartPage'] := 0; AVariables['ContinuePage'] := 0; AVariables['GOU_Address'] := Processor.QueryValue('select xp_fclear_parasites(CAST(`value` AS CHAR(1000))) as a from options where `name` = ''ResidingTown'';');; AVariables['GOU_NAME_Full'] := Processor.QueryValue('SELECT value from options WHERE name like ''GOU_FullName''') + #13#10; end; Initialization TCommandCollection.Register(TRepJournal); end.