ConstruccionesCNJ_FactuGES/Modulos/Cobros con montaje/Views/uEditorCobroMontaje.pas
2007-06-21 15:50:59 +00:00

83 lines
2.8 KiB
ObjectPascal

unit uEditorCobroMontaje;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, dxLayoutLookAndFeels, DB, uDADataTable,
JvAppStorage, JvAppRegistryStorage, JvComponentBase, JvFormPlacement, ImgList,
PngImageList, StdActns, ActnList, ComCtrls, TBX, TB2Item, TB2Dock, TB2Toolbar,
pngimage, ExtCtrls, JvExControls, JvComponent, JvNavigationPane,
uEditorCobroCliente, uIEditorCobroMontaje, uCobrosClienteController,
uBizCobrosCliente, uCustomView, uViewBase, uViewCobroCliente, JvExComCtrls,
JvStatusBar;
type
TfEditorCobroMontaje = class(TfEditorCobroCliente, IEditorCobroMontaje)
protected
procedure OnMontajeChanged(Sender : TObject);
//Si queremos crear otra vista para el editor heredado solo tendriamos que
//sobreescribir este metodo
procedure AsignarVista; override;
//Para asignar los objetos de negocio que necesita la vista
procedure SetController (const Value : ICobrosClienteController); override;
procedure SetCobro(const Value: IBizCobroCliente); override;
end;
implementation
{$R *.dfm}
uses uViewCobroMontaje, uBizCobrosMontaje, uCobrosMontajeController,
uBizMontajesDetalles;
{ TfEditorCobroMontaje }
procedure TfEditorCobroMontaje.AsignarVista;
var
AViewCobroMontaje: TfrViewCobroMontaje;
begin
AViewCobroMontaje := TfrViewCobroMontaje.create(Self);
with AViewCobroMontaje do
begin
Parent := pagGeneral;
Align := alClient;
dxLayoutCobroCliente.LookAndFeel := dxLayoutOfficeLookAndFeel1;
end;
ViewCobroCliente := AViewCobroMontaje;
end;
procedure TfEditorCobroMontaje.OnMontajeChanged(Sender: TObject);
begin
(Cobro as IBizCobroMontaje).Montaje := ((ViewCobroCliente as IViewCobroMontaje).ViewMontajeCobro.Montaje as IBizMontajeDetalles);
if (Application.MessageBox('¿Desea asignar el cliente del montaje seleccionado al cobro?', 'Atención', MB_YESNO) = IDYES) then
begin
(Controller as ICobrosMontajeController).MontajeController.RecuperarCliente((Cobro as IBizCobroMontaje).Montaje);
ViewCobroCliente.ViewClienteCobro.Cliente := (Cobro as IBizCobroMontaje).Montaje.Cliente;
end;
end;
procedure TfEditorCobroMontaje.SetCobro(const Value: IBizCobroCliente);
begin
inherited;
if Assigned(FViewCobro) then
begin
(ViewCobroCliente as IViewCobroMontaje).ViewMontajeCobro.Montaje := (FCobro as IBizCobroMontaje).Montaje;
(ViewCobroCliente as IViewCobroMontaje).ViewMontajeCobro.OnMontajeChanged := OnMontajeChanged;
end;
end;
procedure TfEditorCobroMontaje.SetController(const Value: ICobrosClienteController);
begin
inherited;
if Assigned(FController) then
(ViewCobroCliente as IViewCobroMontaje).ViewMontajeCobro.Controller := (FController as ICobrosMontajeController).MontajeController;
end;
end.