git-svn-id: https://192.168.0.254/svn/Proyectos.Tecsitel_FactuGES2/trunk@608 0c75b7a4-871f-7646-8a2f-f78d34cc349f
115 lines
3.3 KiB
ObjectPascal
115 lines
3.3 KiB
ObjectPascal
unit uEditorDBItem;
|
||
|
||
interface
|
||
|
||
uses
|
||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||
uEditorItem, ImgList, PngImageList, StdActns, ActnList, TBX,
|
||
TB2Item, TB2Dock, TB2Toolbar, ComCtrls, JvExControls, JvComponent,
|
||
JvNavigationPane, DB, uDADataTable, uEditorDBBase, JvFormAutoSize,
|
||
StdCtrls, uDAScriptingProvider, uDACDSDataTable, AppEvnts, uCustomView,
|
||
uViewBase, JvAppStorage, JvAppRegistryStorage,
|
||
JvFormPlacement, pngimage, ExtCtrls, JvComponentBase, dxLayoutLookAndFeels,
|
||
JvExComCtrls, JvStatusBar, uDAInterfaces, cxControls, cxContainer, cxEdit,
|
||
cxLabel;
|
||
|
||
type
|
||
IEditorDBItem = interface(IEditorDBBase)
|
||
['{497AE4CE-D061-4F75-A29A-320F8565FF54}']
|
||
end;
|
||
|
||
TfEditorDBItem = class(TfEditorDBBase, IEditorDBItem)
|
||
pgPaginas: TPageControl;
|
||
pagGeneral: TTabSheet;
|
||
imgStatus: TImage;
|
||
lblDesbloquear: TcxLabel;
|
||
procedure lblDesbloquearClick(Sender: TObject);
|
||
protected
|
||
procedure EliminarInterno; override;
|
||
procedure PrevisualizarInterno; override;
|
||
procedure ImprimirInterno; override;
|
||
procedure ActualizarEstadoEditor; override;
|
||
end;
|
||
|
||
implementation
|
||
|
||
uses
|
||
uEditorBase, uDialogUtils, uDataTableUtils;
|
||
|
||
{$R *.dfm}
|
||
|
||
procedure TfEditorDBItem.ActualizarEstadoEditor;
|
||
begin
|
||
inherited;
|
||
if HayDatos then
|
||
begin
|
||
if lblDesbloquear.Enabled then
|
||
lblDesbloquear.Visible := ReadOnly;
|
||
|
||
if (Self.Modified) and (dsDataTable.DataTable.State <> dsInsert) then
|
||
begin
|
||
StatusBar.Panels[0].Text := ' Se han producido cambios';
|
||
imgStatus.Visible := True;
|
||
end
|
||
else begin
|
||
imgStatus.Visible := False;
|
||
StatusBar.Panels[0].Text := '';
|
||
end
|
||
end;
|
||
end;
|
||
|
||
procedure TfEditorDBItem.EliminarInterno;
|
||
begin
|
||
inherited;
|
||
actCerrar.Execute;
|
||
end;
|
||
|
||
procedure TfEditorDBItem.ImprimirInterno;
|
||
begin
|
||
inherited;
|
||
if Modified then
|
||
begin
|
||
if (ShowConfirmMessage('Se han producido cambios', 'Se han producido cambios y no se puede imprimir hasta que no se guarden.' + #13#10 +
|
||
'<27>Desea guardarlos ahora?') = IDYES) then
|
||
actGuardar.Execute
|
||
else
|
||
ShowInfoMessage('Recuerde guardar los cambios si quiere previsualizar o imprimir.');
|
||
end;
|
||
end;
|
||
|
||
procedure TfEditorDBItem.lblDesbloquearClick(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
|
||
if (ShowConfirmMessage('<27>Desbloquear los datos para permitir cambios?', 'Actualmente, los datos de esta ficha no se pueden modificar.' + #13#10 +
|
||
'Temporalmente puede desbloquear la ficha para realizar cambios puntuales. <20>Desea continuar?') = IDYES) then
|
||
begin
|
||
lblDesbloquear.Visible := False;
|
||
lblDesbloquear.Enabled := False;
|
||
SetDataTableReadOnly(dsDataTable.DataTable, False);
|
||
Self.ReadOnly := False;
|
||
ActualizarEstadoEditor;
|
||
end;
|
||
end;
|
||
|
||
procedure TfEditorDBItem.PrevisualizarInterno;
|
||
begin
|
||
inherited;
|
||
if Modified then
|
||
begin
|
||
if (ShowConfirmMessage('Se han producido cambios', 'Se han producido cambios y no se puede previsualizar hasta que no se guarden.' + #10#13 +
|
||
'<27>Desea guardarlos ahora?') = IDYES) then
|
||
actGuardar.Execute
|
||
else
|
||
ShowInfoMessage('Recuerde guardar los cambios si quiere previsualizar o imprimir.');
|
||
end;
|
||
end;
|
||
|
||
initialization
|
||
RegisterClass(TfEditorDBItem);
|
||
|
||
finalization
|
||
UnRegisterClass(TfEditorDBItem);
|
||
|
||
end.
|