unit uEditorCalendarioMontajes; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, uEditorCalendarioBase, dxPSGlbl, dxPSUtl, dxPSEngn, dxPrnPg, dxBkgnd, dxWrap, dxPrnDev, dxPSCompsProvider, dxPSFillPatterns, dxPSEdgePatterns, dxPrnDlg, dxPSCore, dxPScxCommon, dxPScxScheduler2Lnk, DB, uDADataTable, cxSchedulerStorage, cxSchedulerDBStorage, dxLayoutLookAndFeels, JvAppStorage, JvAppRegistryStorage, JvComponentBase, JvFormPlacement, ImgList, PngImageList, StdActns, ActnList, ComCtrls, TBX, TB2Item, TB2Dock, TB2Toolbar, pngimage, ExtCtrls, JvExControls, JvComponent, JvNavigationPane, uCustomView, uViewBase, uViewCalendarioBase, uViewCalendarioConFiltro, uEditorCalendarioConFiltro, uBizCitas; type IEditorCalendarioMontajes = interface(IEditorCalendarioConFiltro) ['{158B8A5F-5CF6-43F2-BBD0-C65212089035}'] function GetInstaladores: IBizInstaladores; procedure SetInstaladores(const Value: IBizInstaladores); property Instaladores : IBizInstaladores read GetInstaladores write SetInstaladores; end; TfEditorCalendarioMontajes = class(TfEditorCalendarioConFiltro, IEditorCalendarioMontajes) frViewCalendarioMontajes: TfrViewCalendarioConFiltro; DADataSource2: TDADataSource; procedure EventDisplayText(Sender: TObject; AEvent: TcxSchedulerControlEvent; var AText: String); procedure EventHintText(Sender: TObject; AEvent: TcxSchedulerControlEvent; var AText: String); procedure FormShow(Sender: TObject); private FInstaladores: IBizInstaladores; procedure CargarLista; override; function GetInstaladores: IBizInstaladores; procedure SetInstaladores(const Value: IBizInstaladores); protected procedure InicializarEvento (var aEvent : TcxSchedulerControlEvent); override; public property Instaladores : IBizInstaladores read GetInstaladores write SetInstaladores; constructor Create(AOwner: TComponent); override; destructor destroy; override; end; var fEditorCalendarioMontajes: TfEditorCalendarioMontajes; implementation {$R *.dfm} { TfEditorCalendarioMontajes } uses schCitasClient_Intf; procedure TfEditorCalendarioMontajes.CargarLista; begin NombreLista := 'Instaladores'; inherited; end; constructor TfEditorCalendarioMontajes.Create(AOwner: TComponent); begin inherited; ViewCitas := frViewCalendarioMontajes; end; function TfEditorCalendarioMontajes.GetInstaladores: IBizInstaladores; begin Result := FInstaladores; end; procedure TfEditorCalendarioMontajes.InicializarEvento(var aEvent: TcxSchedulerControlEvent); begin inherited; with AEvent do begin SetCustomFieldValueByName(fld_CITASTIPOTAREA, TextoTipoCita[Ord(tcMontaje)]); AllDayEvent := True; end; end; procedure TfEditorCalendarioMontajes.SetInstaladores(const Value: IBizInstaladores); begin FInstaladores := Value; if Assigned(FInstaladores) then begin DADataSource2.DataTable := FInstaladores.DataTable; if not FInstaladores.DataTable.Active then FInstaladores.DataTable.Active := True; end else DADataSource2.DataTable := Nil; end; procedure TfEditorCalendarioMontajes.EventDisplayText(Sender: TObject; AEvent: TcxSchedulerControlEvent; var AText: String); var Nombre : String; Tipo : String; begin inherited; if not VarIsNull(AEvent.GetCustomFieldValueByName(fld_CITASNOMBRECLIENTE)) then begin Nombre := VarToStr(AEvent.GetCustomFieldValueByName(fld_CITASNOMBRECLIENTE)); Tipo := VarToStr(AEvent.GetCustomFieldValueByName(fld_CITASTIPOTAREA)); AText := AEvent.Caption + ' - ' + Tipo + ' (' + Nombre + ')'; end; end; procedure TfEditorCalendarioMontajes.EventHintText(Sender: TObject; AEvent: TcxSchedulerControlEvent; var AText: String); var Nombre : String; Tipo : String; begin inherited; if not VarIsNull(AEvent.GetCustomFieldValueByName(fld_CITASNOMBRECLIENTE)) then begin Nombre := VarToStr(AEvent.GetCustomFieldValueByName(fld_CITASNOMBRECLIENTE)); Tipo := VarToStr(AEvent.GetCustomFieldValueByName(fld_CITASTIPOTAREA)); AText := AEvent.Caption + #10#13 + Tipo + ' (' + Nombre + ')'; end; end; procedure TfEditorCalendarioMontajes.FormShow(Sender: TObject); begin inherited FormShow(Sender); ViewCitas.Calendario.OnGetEventDisplayText := EventDisplayText; ViewCitas.Calendario.OnGetEventHintText := EventHintText; end; destructor TfEditorCalendarioMontajes.destroy; begin ViewCitas.Calendario.OnGetEventDisplayText := Nil; ViewCitas.Calendario.OnGetEventHintText := Nil; inherited; end; end.