Se para que la pregunta de si desea guardar los cambios (al enviar por email) se haga en el action de enviar por email

git-svn-id: https://192.168.0.254/svn/Proyectos.Tecsitel_FactuGES2/trunk@978 0c75b7a4-871f-7646-8a2f-f78d34cc349f
This commit is contained in:
roberto 2009-11-25 12:24:10 +00:00
parent 8e34090d13
commit b15b7f6df2
10 changed files with 301 additions and 242 deletions

View File

@ -66,52 +66,58 @@ var
AFilter : String; AFilter : String;
AObj : ISeleccionable; AObj : ISeleccionable;
i : Integer; i : Integer;
AID: Integer;
begin begin
AFilter := ''; AFilter := '';
AFiltered := False; AFiltered := False;
if OnlySelectedRows then
begin
if not Supports(ASource, ISeleccionable, aObj) then
raise Exception.Create('El origen de datos no soporta la interfaz ISeleccionable (CopyDataTable)');
{ Si la tabla está abierta, la cerramos antes de aplicar los filtros
porque por cada cambio en el filtro se hacen llamadas internas de TDADataTable. }
if ASource.Active then
ASource.Close;
// Si la tabla origen viene con un filtro, lo guardamos para luego restablecerlo.
if ASource.Filtered then
begin
AFiltered := True;
AFilter := ASource.Filter;
ASource.Filtered := False;
end;
ASource.Filter := '';
//Si no hay elemento seleccionados filtramos para que ATarget se quede vacia
if (AObj.SelectedRecords.Count = 0) then
ASource.Filter := ASource.Filter + '(' + ASource.RecIDField.FieldName + ' = ' + IntToStr(ID_NULO) + ')'
//En caso contrario filtramos por los elementos seleccionados
else
for i := 0 to AObj.SelectedRecords.Count - 1 do
begin
if (i > 0) then
ASource.Filter := ASource.Filter + ' or ';
ASource.Filter := ASource.Filter + '(' + ASource.RecIDField.FieldName + ' = ' + IntToStr(AObj.SelectedRecords.Items[i]) + ')';
end;
ASource.Filtered := True;
end;
DABin := Binary.Create;
DADataStreamer := TDABin2DataStreamer.Create(nil);
ShowHourglassCursor; ShowHourglassCursor;
ASource.DisableControls; ASource.DisableControls;
ATarget.DisableControls; ATarget.DisableControls;
AID := ASource.GetRowRecIDValue; //Se guarda la posicion de la tabla fuente
try try
if OnlySelectedRows then
begin
if not Supports(ASource, ISeleccionable, aObj) then
raise Exception.Create('El origen de datos no soporta la interfaz ISeleccionable (CopyDataTable)');
{ Si la tabla está abierta, la cerramos antes de aplicar los filtros
porque por cada cambio en el filtro se hacen llamadas internas de TDADataTable. }
if ASource.Active then
ASource.Close;
// Si la tabla origen viene con un filtro, lo guardamos para luego restablecerlo.
if ASource.Filtered then
begin
AFiltered := True;
AFilter := ASource.Filter;
ASource.Filtered := False;
end;
ASource.Filter := '';
//Si no hay elemento seleccionados filtramos para que ATarget se quede vacia
if (AObj.SelectedRecords.Count = 0) then
ASource.Filter := ASource.Filter + '(' + ASource.RecIDField.FieldName + ' = ' + IntToStr(ID_NULO) + ')'
//En caso contrario filtramos por los elementos seleccionados
else
for i := 0 to AObj.SelectedRecords.Count - 1 do
begin
if (i > 0) then
ASource.Filter := ASource.Filter + ' or ';
ASource.Filter := ASource.Filter + '(' + ASource.RecIDField.FieldName + ' = ' + IntToStr(AObj.SelectedRecords.Items[i]) + ')';
end;
ASource.Filtered := True;
end;
DABin := Binary.Create;
DADataStreamer := TDABin2DataStreamer.Create(nil);
ATarget.LogicalName := ASource.LogicalName; // We need to specify new dataset LogicalName ATarget.LogicalName := ASource.LogicalName; // We need to specify new dataset LogicalName
ATarget.RemoteFetchEnabled := False; // "Desconectamos" la tabla destino del servidor ATarget.RemoteFetchEnabled := False; // "Desconectamos" la tabla destino del servidor
@ -135,6 +141,8 @@ begin
ASource.Filtered := True; ASource.Filtered := True;
end; end;
ASource.Locate(ASource.RecIDField.FieldName, AID, []); //Se intenta restablecer la posicion inicial de la tabla fuente
finally finally
FreeAndNil(DABin); FreeAndNil(DABin);
FreeAndNil(DADataStreamer); FreeAndNil(DADataStreamer);

View File

@ -127,13 +127,15 @@ inherited fEditorAlbaranCliente: TfEditorAlbaranCliente
inherited lblDesbloquear: TcxLabel inherited lblDesbloquear: TcxLabel
Left = 667 Left = 667
ExplicitLeft = 667 ExplicitLeft = 667
AnchorX = 712
AnchorY = 14
end end
end end
inherited TBXDock: TTBXDock inherited TBXDock: TTBXDock
Width = 765 Width = 765
ExplicitWidth = 765 ExplicitWidth = 765
inherited tbxMain: TTBXToolbar inherited tbxMain: TTBXToolbar
ExplicitWidth = 613 ExplicitWidth = 488
inherited TBXItem2: TTBXItem inherited TBXItem2: TTBXItem
Visible = False Visible = False
end end
@ -208,13 +210,14 @@ inherited fEditorAlbaranCliente: TfEditorAlbaranCliente
ExplicitLeft = 278 ExplicitLeft = 278
ExplicitTop = 0 ExplicitTop = 0
end end
inherited ToolButton14: TToolButton [4] inherited ToolButton14: TToolButton
Left = 334 Left = 334
Top = 0 Top = 0
Wrap = False
ExplicitLeft = 334 ExplicitLeft = 334
ExplicitTop = 0 ExplicitTop = 0
end end
inherited FontName: TJvFontComboBox [5] inherited FontName: TJvFontComboBox
Left = 399 Left = 399
Top = 0 Top = 0
ExplicitLeft = 399 ExplicitLeft = 399
@ -223,18 +226,12 @@ inherited fEditorAlbaranCliente: TfEditorAlbaranCliente
inherited FontSize: TEdit inherited FontSize: TEdit
Left = 544 Left = 544
Top = 0 Top = 0
Width = 90 Width = 106
ExplicitLeft = 544 ExplicitLeft = 544
ExplicitTop = 0 ExplicitTop = 0
ExplicitWidth = 90 ExplicitWidth = 106
end end
inherited UpDown1: TUpDown inherited ToolButton13: TToolButton [7]
Left = 634
Top = 0
ExplicitLeft = 634
ExplicitTop = 0
end
inherited ToolButton13: TToolButton
Left = 0 Left = 0
Top = 0 Top = 0
Wrap = True Wrap = True
@ -242,47 +239,52 @@ inherited fEditorAlbaranCliente: TfEditorAlbaranCliente
ExplicitTop = 0 ExplicitTop = 0
ExplicitHeight = 27 ExplicitHeight = 27
end end
inherited ToolButton6: TToolButton [9] inherited UpDown1: TUpDown [8]
Left = 0 Left = 0
Top = 27 Top = 27
ExplicitLeft = 0 ExplicitLeft = 0
ExplicitTop = 27 ExplicitTop = 27
end end
inherited ToolButton7: TToolButton [10] inherited ToolButton6: TToolButton
Left = 66 Left = 17
Top = 27 Top = 27
ExplicitLeft = 66 ExplicitLeft = 17
ExplicitTop = 27 ExplicitTop = 27
end end
inherited ToolButton8: TToolButton [11] inherited ToolButton7: TToolButton
Left = 133 Left = 83
Top = 27 Top = 27
ExplicitLeft = 133 ExplicitLeft = 83
ExplicitTop = 27 ExplicitTop = 27
end end
inherited ToolButton12: TToolButton [12] inherited ToolButton8: TToolButton
Left = 216 Left = 150
Top = 27 Top = 27
ExplicitLeft = 216 ExplicitLeft = 150
ExplicitTop = 27
ExplicitHeight = 22
end
inherited ToolButton9: TToolButton [13]
Left = 224
Top = 27
ExplicitLeft = 224
ExplicitTop = 27 ExplicitTop = 27
end end
inherited ToolButton10: TToolButton [14] inherited ToolButton12: TToolButton
Left = 369 Left = 233
Top = 27 Top = 27
ExplicitLeft = 369 ExplicitLeft = 233
ExplicitTop = 27 ExplicitTop = 27
end end
inherited ToolButton11: TToolButton [15] inherited ToolButton9: TToolButton
Left = 494 Left = 241
Top = 27 Top = 27
ExplicitLeft = 494 ExplicitLeft = 241
ExplicitTop = 27
end
inherited ToolButton10: TToolButton
Left = 386
Top = 27
ExplicitLeft = 386
ExplicitTop = 27
end
inherited ToolButton11: TToolButton
Left = 511
Top = 27
ExplicitLeft = 511
ExplicitTop = 27 ExplicitTop = 27
end end
end end
@ -665,7 +667,9 @@ inherited fEditorAlbaranCliente: TfEditorAlbaranCliente
object actEnviarEMail: TAction object actEnviarEMail: TAction
Category = 'Acciones' Category = 'Acciones'
Caption = 'Enviar por e-mail...' Caption = 'Enviar por e-mail...'
Enabled = False
ImageIndex = 21 ImageIndex = 21
Visible = False
OnExecute = actEnviarEMailExecute OnExecute = actEnviarEMailExecute
OnUpdate = actEnviarEMailUpdate OnUpdate = actEnviarEMailUpdate
end end

View File

@ -73,6 +73,7 @@ type
procedure PonerTitulos(const ATitulo: string = ''); override; procedure PonerTitulos(const ATitulo: string = ''); override;
function PuedoImprimir: Boolean; override; function PuedoImprimir: Boolean; override;
function PuedoEnviar: Boolean; virtual;
public public
destructor Destroy; override; destructor Destroy; override;
@ -100,14 +101,28 @@ uses
procedure TfEditorFacturaCliente.actEnviarEMailExecute(Sender: TObject); procedure TfEditorFacturaCliente.actEnviarEMailExecute(Sender: TObject);
begin begin
inherited; if actEnviarEMail.Enabled then
FController.EnviarFacturaPorEMail(Factura); begin
if Modified then
begin
if (ShowConfirmMessage('Se han producido cambios', 'Se han producido cambios y no se puede enviar por email hasta que no se guarden.' + #10#13 +
'¿Desea guardarlos ahora?') = IDYES) then
begin
GuardarInterno;
FController.EnviarFacturaPorEMail(Factura);
end
else
ShowInfoMessage('Recuerde guardar los cambios si quiere enviar por email.');
end
else
FController.EnviarFacturaPorEMail(Factura);
end;
end; end;
procedure TfEditorFacturaCliente.actEnviarEMailUpdate(Sender: TObject); procedure TfEditorFacturaCliente.actEnviarEMailUpdate(Sender: TObject);
begin begin
inherited; inherited;
(Sender as TAction).Enabled := HayDatos; (Sender as TAction).Enabled := HayDatos and PuedoEnviar;
end; end;
constructor TfEditorFacturaCliente.Create(AOwner: TComponent); constructor TfEditorFacturaCliente.Create(AOwner: TComponent);
@ -368,6 +383,11 @@ begin
end; end;
end; end;
function TfEditorFacturaCliente.PuedoEnviar: Boolean;
begin
Result := not Factura.Cliente.IDIsNull;
end;
function TfEditorFacturaCliente.PuedoImprimir: Boolean; function TfEditorFacturaCliente.PuedoImprimir: Boolean;
begin begin
Result := inherited PuedoImprimir and (not Factura.Cliente.IDIsNull); Result := inherited PuedoImprimir and (not Factura.Cliente.IDIsNull);

View File

@ -5,7 +5,6 @@ inherited fEditorPedidoProveedor: TfEditorPedidoProveedor
ClientHeight = 678 ClientHeight = 678
ClientWidth = 879 ClientWidth = 879
OnClose = CustomEditorClose OnClose = CustomEditorClose
ExplicitTop = -164
ExplicitWidth = 887 ExplicitWidth = 887
ExplicitHeight = 712 ExplicitHeight = 712
PixelsPerInch = 96 PixelsPerInch = 96
@ -85,20 +84,16 @@ inherited fEditorPedidoProveedor: TfEditorPedidoProveedor
TabOrder = 1 TabOrder = 1
OnChanging = pgPaginasChanging OnChanging = pgPaginasChanging
ExplicitWidth = 873 ExplicitWidth = 873
ExplicitHeight = 534 ExplicitHeight = 531
inherited pagGeneral: TTabSheet inherited pagGeneral: TTabSheet
ExplicitLeft = 4 ExplicitLeft = 4
ExplicitTop = 24 ExplicitTop = 24
ExplicitWidth = 865 ExplicitWidth = 865
ExplicitHeight = 506 ExplicitHeight = 503
end end
object pagContenido: TTabSheet object pagContenido: TTabSheet
Caption = 'Contenido' Caption = 'Contenido'
ImageIndex = 1 ImageIndex = 1
ExplicitLeft = 0
ExplicitTop = 0
ExplicitWidth = 0
ExplicitHeight = 506
inline frViewDetallesPedidoProveedor1: TfrViewDetallesPedidoProveedor inline frViewDetallesPedidoProveedor1: TfrViewDetallesPedidoProveedor
Left = 0 Left = 0
Top = 0 Top = 0
@ -116,7 +111,7 @@ inherited fEditorPedidoProveedor: TfEditorPedidoProveedor
TabOrder = 0 TabOrder = 0
ReadOnly = False ReadOnly = False
ExplicitWidth = 865 ExplicitWidth = 865
ExplicitHeight = 506 ExplicitHeight = 503
inherited ToolBar1: TToolBar inherited ToolBar1: TToolBar
Width = 865 Width = 865
Height = 46 Height = 46
@ -140,82 +135,84 @@ inherited fEditorPedidoProveedor: TfEditorPedidoProveedor
inherited FontName: TJvFontComboBox inherited FontName: TJvFontComboBox
Left = 65 Left = 65
Top = 22 Top = 22
ExplicitLeft = 65 ExplicitLeft = 399
ExplicitTop = 22 ExplicitTop = 0
end end
inherited FontSize: TEdit inherited FontSize: TEdit
Left = 210 Left = 544
Top = 22 Top = 0
Width = 294 Width = 294
ExplicitLeft = 210 ExplicitLeft = 544
ExplicitTop = 22 ExplicitTop = 0
ExplicitWidth = 294 ExplicitWidth = 294
end end
inherited UpDown1: TUpDown inherited UpDown1: TUpDown
Left = 504 Left = 838
Top = 22 Top = 0
ExplicitLeft = 504 ExplicitLeft = 838
ExplicitTop = 22 ExplicitTop = 0
end end
inherited ToolButton13: TToolButton inherited ToolButton13: TToolButton
Left = 521 Left = 0
Top = 22 Top = 0
ExplicitLeft = 521 Wrap = True
ExplicitTop = 22 ExplicitLeft = 0
ExplicitTop = 0
ExplicitHeight = 27
end end
inherited ToolButton6: TToolButton inherited ToolButton6: TToolButton
Left = 529 Left = 0
Top = 22 Top = 27
ExplicitLeft = 529 ExplicitLeft = 0
ExplicitTop = 22 ExplicitTop = 27
end end
inherited ToolButton7: TToolButton inherited ToolButton7: TToolButton
Left = 595 Left = 66
Top = 22 Top = 27
ExplicitLeft = 595 ExplicitLeft = 66
ExplicitTop = 22 ExplicitTop = 27
end end
inherited ToolButton8: TToolButton inherited ToolButton8: TToolButton
Left = 662 Left = 133
Top = 22 Top = 27
ExplicitLeft = 662 ExplicitLeft = 133
ExplicitTop = 22 ExplicitTop = 27
end end
inherited ToolButton12: TToolButton inherited ToolButton12: TToolButton
Left = 745 Left = 216
Top = 22 Top = 27
ExplicitLeft = 745 ExplicitLeft = 216
ExplicitTop = 22 ExplicitTop = 27
end end
inherited ToolButton9: TToolButton inherited ToolButton9: TToolButton
Left = 753 Left = 224
Top = 22 Top = 27
ExplicitLeft = 753 ExplicitLeft = 224
ExplicitTop = 22 ExplicitTop = 27
end end
inherited ToolButton10: TToolButton inherited ToolButton10: TToolButton
Left = 898 Left = 369
Top = 22 Top = 27
ExplicitLeft = 898 ExplicitLeft = 369
ExplicitTop = 22 ExplicitTop = 27
end end
inherited ToolButton11: TToolButton inherited ToolButton11: TToolButton
Left = 1023 Left = 494
Top = 22 Top = 27
ExplicitLeft = 1023 ExplicitLeft = 494
ExplicitTop = 22 ExplicitTop = 27
end end
end end
inherited cxGrid: TcxGrid inherited cxGrid: TcxGrid
Top = 72 Top = 77
Width = 865 Width = 865
Height = 431 Height = 426
ExplicitTop = 77 ExplicitTop = 77
ExplicitWidth = 865 ExplicitWidth = 865
ExplicitHeight = 429 ExplicitHeight = 429
end end
inherited TBXDock1: TTBXDock inherited TBXDock1: TTBXDock
Top = 46 Top = 51
Width = 865 Width = 865
ExplicitTop = 51 ExplicitTop = 51
ExplicitWidth = 865 ExplicitWidth = 865
@ -237,10 +234,6 @@ inherited fEditorPedidoProveedor: TfEditorPedidoProveedor
object pagInicidencias: TTabSheet object pagInicidencias: TTabSheet
Caption = 'Incidencias' Caption = 'Incidencias'
ImageIndex = 2 ImageIndex = 2
ExplicitLeft = 0
ExplicitTop = 0
ExplicitWidth = 0
ExplicitHeight = 506
inline frViewIncidenciasProv: TfrViewIncidencias inline frViewIncidenciasProv: TfrViewIncidencias
Left = 0 Left = 0
Top = 0 Top = 0
@ -256,7 +249,7 @@ inherited fEditorPedidoProveedor: TfEditorPedidoProveedor
TabOrder = 0 TabOrder = 0
ReadOnly = False ReadOnly = False
ExplicitWidth = 865 ExplicitWidth = 865
ExplicitHeight = 506 ExplicitHeight = 503
inherited pnlSup: TPanel inherited pnlSup: TPanel
Width = 865 Width = 865
ExplicitWidth = 865 ExplicitWidth = 865
@ -286,7 +279,7 @@ inherited fEditorPedidoProveedor: TfEditorPedidoProveedor
item item
Width = 200 Width = 200
end> end>
ExplicitTop = 672 ExplicitTop = 659
ExplicitWidth = 879 ExplicitWidth = 879
end end
inline frViewTotales1: TfrViewTotales [4] inline frViewTotales1: TfrViewTotales [4]
@ -303,7 +296,7 @@ inherited fEditorPedidoProveedor: TfEditorPedidoProveedor
ParentFont = False ParentFont = False
TabOrder = 4 TabOrder = 4
ReadOnly = False ReadOnly = False
ExplicitTop = 632 ExplicitTop = 613
ExplicitWidth = 879 ExplicitWidth = 879
ExplicitHeight = 46 ExplicitHeight = 46
inherited dxLayoutControl1: TdxLayoutControl inherited dxLayoutControl1: TdxLayoutControl
@ -311,7 +304,7 @@ inherited fEditorPedidoProveedor: TfEditorPedidoProveedor
Height = 46 Height = 46
LookAndFeel = dxLayoutOfficeLookAndFeel1 LookAndFeel = dxLayoutOfficeLookAndFeel1
ExplicitWidth = 879 ExplicitWidth = 879
ExplicitHeight = 43 ExplicitHeight = 46
inherited Bevel3: TBevel inherited Bevel3: TBevel
Left = 458 Left = 458
Top = 11 Top = 11

View File

@ -62,6 +62,7 @@ type
procedure OnProveedorChanged(Sender : TObject); procedure OnProveedorChanged(Sender : TObject);
function PuedoImprimir: Boolean; override; function PuedoImprimir: Boolean; override;
function PuedoEnviar: Boolean; virtual;
//Si queremos crear otra vista para el editor heredado solo tendriamos que //Si queremos crear otra vista para el editor heredado solo tendriamos que
//sobreescribir este metodo //sobreescribir este metodo
@ -93,14 +94,28 @@ uses
procedure TfEditorPedidoProveedor.actEnviarEMailExecute(Sender: TObject); procedure TfEditorPedidoProveedor.actEnviarEMailExecute(Sender: TObject);
begin begin
inherited; if actEnviarEMail.Enabled then
FController.EnviarPedidoPorEMail(Pedido); begin
if Modified then
begin
if (ShowConfirmMessage('Se han producido cambios', 'Se han producido cambios y no se puede enviar por email hasta que no se guarden.' + #10#13 +
'¿Desea guardarlos ahora?') = IDYES) then
begin
GuardarInterno;
FController.EnviarPedidoPorEMail(Pedido);
end
else
ShowInfoMessage('Recuerde guardar los cambios si quiere enviar por email.');
end
else
FController.EnviarPedidoPorEMail(Pedido);
end;
end; end;
procedure TfEditorPedidoProveedor.actEnviarEMailUpdate(Sender: TObject); procedure TfEditorPedidoProveedor.actEnviarEMailUpdate(Sender: TObject);
begin begin
inherited; inherited;
(Sender as TAction).Enabled := HayDatos; (Sender as TAction).Enabled := HayDatos and PuedoEnviar;
end; end;
procedure TfEditorPedidoProveedor.AsignarVista; procedure TfEditorPedidoProveedor.AsignarVista;
@ -230,6 +245,11 @@ begin
FController.Print(FPedido, AllItems, FImprimirPrecios, FImprimirRefProveedor); FController.Print(FPedido, AllItems, FImprimirPrecios, FImprimirRefProveedor);
end; end;
function TfEditorPedidoProveedor.PuedoEnviar: Boolean;
begin
Result := not Pedido.Proveedor.IDIsNull;
end;
function TfEditorPedidoProveedor.PuedoImprimir: Boolean; function TfEditorPedidoProveedor.PuedoImprimir: Boolean;
begin begin
Result := inherited PuedoImprimir and (not Pedido.Proveedor.IDIsNull); Result := inherited PuedoImprimir and (not Pedido.Proveedor.IDIsNull);

View File

@ -313,6 +313,7 @@ var
NombreCapitulo : String; NombreCapitulo : String;
Estilo : OleVariant; Estilo : OleVariant;
begin begin
FNumCapitulos := 0;
FContadorCap := 0; FContadorCap := 0;
FNumCapOpc := 0; FNumCapOpc := 0;
with FDocumento, tbl_Detalles do with FDocumento, tbl_Detalles do
@ -347,16 +348,18 @@ begin
begin begin
NombreCapitulo := 'Capítulo ' + IntToStr(FContadorCap + 1) + '. ' + FieldByName('CONCEPTO').AsString; NombreCapitulo := 'Capítulo ' + IntToStr(FContadorCap + 1) + '. ' + FieldByName('CONCEPTO').AsString;
Inc(FContadorCap); Inc(FContadorCap);
Inc(FNumCapitulos);
end end
else begin else begin
NombreCapitulo := 'Capítulo opcional. ' + FieldByName('CONCEPTO').AsString; NombreCapitulo := 'Capítulo opcional. ' + FieldByName('CONCEPTO').AsString;
Inc(FNumCapOpc); Inc(FNumCapOpc);
Inc(FNumCapitulos);
end; end;
FWordApp.InsertText(NombreCapitulo); FWordApp.InsertText(NombreCapitulo);
FWordApp.InsertText(#13); FWordApp.InsertText(#13);
ListaCapitulos[FContadorCap].Tipo := FieldByName('TIPO_DETALLE').AsString; ListaCapitulos[FNumCapitulos].Tipo := FieldByName('TIPO_DETALLE').AsString;
ListaCapitulos[FContadorCap].Nombre := NombreCapitulo; ListaCapitulos[FNumCapitulos].Nombre := NombreCapitulo;
{ Pegar una tabla para rellenarla } { Pegar una tabla para rellenarla }
FWordApp.Application.Selection.Paste; FWordApp.Application.Selection.Paste;
Next; Next;
@ -373,7 +376,6 @@ begin
InsertarConceptos(Document.Tables.Item(Document.Tables.Count - 2)); InsertarConceptos(Document.Tables.Item(Document.Tables.Count - 2));
end; end;
end; end;
FNumCapitulos := FContadorCap;
end; end;
Result := True; Result := True;
end; end;

View File

@ -177,8 +177,6 @@ inherited fEditorPresupuestoCliente: TfEditorPresupuestoCliente
ExplicitWidth = 758 ExplicitWidth = 758
ExplicitHeight = 366 ExplicitHeight = 366
inherited pagGeneral: TTabSheet inherited pagGeneral: TTabSheet
ExplicitLeft = 4
ExplicitTop = 24
ExplicitWidth = 750 ExplicitWidth = 750
ExplicitHeight = 338 ExplicitHeight = 338
end end
@ -214,93 +212,89 @@ inherited fEditorPresupuestoCliente: TfEditorPresupuestoCliente
inherited ToolButton4: TToolButton inherited ToolButton4: TToolButton
Left = 278 Left = 278
Top = 0 Top = 0
Wrap = True
ExplicitLeft = 278 ExplicitLeft = 278
ExplicitTop = 0 ExplicitTop = 0
end end
inherited ToolButton14: TToolButton
Left = 0
Wrap = False
ExplicitLeft = 0
end
inherited FontName: TJvFontComboBox inherited FontName: TJvFontComboBox
Left = 65 Left = 334
Top = 22 Top = 0
ExplicitTop = 22 ExplicitLeft = 334
ExplicitTop = 0
end end
inherited FontSize: TEdit inherited FontSize: TEdit [5]
Top = 22 Left = 479
Top = 0
Width = 200 Width = 200
ExplicitTop = 22 ExplicitLeft = 479
ExplicitTop = 0
ExplicitWidth = 200 ExplicitWidth = 200
end end
inherited ToolButton14: TToolButton [6]
Left = 679
Top = 0
Wrap = True
ExplicitLeft = 679
end
inherited UpDown1: TUpDown inherited UpDown1: TUpDown
Left = 345 Left = 0
Top = 22 ExplicitLeft = 0
ExplicitLeft = 345
ExplicitTop = 22
end end
inherited ToolButton13: TToolButton inherited ToolButton13: TToolButton
Left = 362 Left = 17
ExplicitLeft = 17
end
inherited ToolButton6: TToolButton [9]
Left = 25
Top = 22 Top = 22
ExplicitLeft = 362 ExplicitLeft = 25
ExplicitTop = 22 ExplicitTop = 22
end end
inherited ToolButton6: TToolButton inherited ToolButton7: TToolButton [10]
Left = 370 Left = 91
Top = 22 Top = 22
ExplicitLeft = 370 Wrap = False
ExplicitLeft = 91
ExplicitTop = 22 ExplicitTop = 22
end end
inherited ToolButton7: TToolButton inherited ToolButton8: TToolButton [11]
Left = 436 Left = 158
Top = 22 Top = 22
ExplicitLeft = 436 ExplicitLeft = 158
ExplicitTop = 22 ExplicitTop = 22
end end
inherited ToolButton8: TToolButton inherited ToolButton12: TToolButton [12]
Left = 503 Left = 241
Wrap = False
ExplicitLeft = 241
ExplicitHeight = 22
end
inherited ToolButton9: TToolButton [13]
Left = 249
Top = 22 Top = 22
ExplicitLeft = 503 ExplicitLeft = 249
ExplicitTop = 22 ExplicitTop = 22
end end
inherited ToolButton12: TToolButton inherited ToolButton10: TToolButton [14]
Left = 0 Left = 394
Top = 22 Top = 22
Wrap = True ExplicitLeft = 394
ExplicitLeft = 0
ExplicitTop = 22 ExplicitTop = 22
ExplicitHeight = 27
end end
inherited ToolButton9: TToolButton inherited ToolButton11: TToolButton [15]
Left = 0 Left = 519
Top = 49 ExplicitLeft = 519
ExplicitLeft = 0
ExplicitTop = 49
end
inherited ToolButton10: TToolButton
Left = 145
Top = 49
ExplicitLeft = 145
ExplicitTop = 49
end
inherited ToolButton11: TToolButton
Left = 270
Top = 49
ExplicitLeft = 270
ExplicitTop = 49
end end
end end
inherited cxGrid: TcxGrid inherited cxGrid: TcxGrid
Top = 99 Top = 72
Width = 750 Width = 750
Height = 239 Height = 266
ExplicitTop = 104 ExplicitTop = 104
ExplicitWidth = 750 ExplicitWidth = 750
ExplicitHeight = 234 ExplicitHeight = 234
end end
inherited TBXDock1: TTBXDock inherited TBXDock1: TTBXDock
Top = 73 Top = 46
Width = 750 Width = 750
ExplicitTop = 78 ExplicitTop = 78
ExplicitWidth = 750 ExplicitWidth = 750
@ -860,36 +854,36 @@ inherited fEditorPresupuestoCliente: TfEditorPresupuestoCliente
ExplicitWidth = 764 ExplicitWidth = 764
ExplicitHeight = 125 ExplicitHeight = 125
inherited Bevel3: TBevel inherited Bevel3: TBevel
Left = 429 Left = 385
Top = 80 Top = 80
Height = 75 Height = 75
ExplicitLeft = 429 ExplicitLeft = 385
ExplicitTop = 80 ExplicitTop = 80
ExplicitHeight = 75 ExplicitHeight = 75
end end
inherited Bevel4: TBevel inherited Bevel4: TBevel
Left = 541 Left = 497
Top = 122 Top = 122
Width = 192 Width = 147
ExplicitLeft = 541 ExplicitLeft = 497
ExplicitTop = 122 ExplicitTop = 122
ExplicitWidth = 192 ExplicitWidth = 147
end end
inherited Bevel1: TBevel inherited Bevel1: TBevel
Left = 541 Left = 497
Top = 238 Top = 238
Width = 73 Width = 147
ExplicitLeft = 541 ExplicitLeft = 497
ExplicitTop = 238 ExplicitTop = 238
ExplicitWidth = 73 ExplicitWidth = 147
end end
inherited Bevel2: TBevel inherited Bevel2: TBevel
Left = 130 Left = 130
Top = 240 Top = 240
Width = 368 Width = 158
ExplicitLeft = 130 ExplicitLeft = 130
ExplicitTop = 240 ExplicitTop = 240
ExplicitWidth = 368 ExplicitWidth = 158
end end
inherited ImporteDto: TcxDBCurrencyEdit inherited ImporteDto: TcxDBCurrencyEdit
Left = 201 Left = 201
@ -905,27 +899,27 @@ inherited fEditorPresupuestoCliente: TfEditorPresupuestoCliente
Width = 87 Width = 87
end end
inherited ImporteIVA: TcxDBCurrencyEdit inherited ImporteIVA: TcxDBCurrencyEdit
Left = 612 Left = 568
Top = 157 Top = 157
Style.LookAndFeel.SkinName = '' Style.LookAndFeel.SkinName = ''
Style.IsFontAssigned = True Style.IsFontAssigned = True
StyleDisabled.LookAndFeel.SkinName = '' StyleDisabled.LookAndFeel.SkinName = ''
StyleFocused.LookAndFeel.SkinName = '' StyleFocused.LookAndFeel.SkinName = ''
StyleHot.LookAndFeel.SkinName = '' StyleHot.LookAndFeel.SkinName = ''
ExplicitLeft = 612 ExplicitLeft = 568
ExplicitTop = 157 ExplicitTop = 157
ExplicitWidth = 20 ExplicitWidth = 20
Width = 20 Width = 20
end end
inherited ImporteTotal: TcxDBCurrencyEdit inherited ImporteTotal: TcxDBCurrencyEdit
Left = 542 Left = 498
Top = 211 Top = 211
Style.LookAndFeel.SkinName = '' Style.LookAndFeel.SkinName = ''
Style.IsFontAssigned = True Style.IsFontAssigned = True
StyleDisabled.LookAndFeel.SkinName = '' StyleDisabled.LookAndFeel.SkinName = ''
StyleFocused.LookAndFeel.SkinName = '' StyleFocused.LookAndFeel.SkinName = ''
StyleHot.LookAndFeel.SkinName = '' StyleHot.LookAndFeel.SkinName = ''
ExplicitLeft = 542 ExplicitLeft = 498
ExplicitTop = 211 ExplicitTop = 211
ExplicitWidth = 90 ExplicitWidth = 90
Width = 90 Width = 90
@ -942,49 +936,49 @@ inherited fEditorPresupuestoCliente: TfEditorPresupuestoCliente
ExplicitTop = 107 ExplicitTop = 107
end end
inherited edtIVA: TcxDBSpinEdit inherited edtIVA: TcxDBSpinEdit
Left = 541 Left = 497
Top = 157 Top = 157
Style.LookAndFeel.SkinName = '' Style.LookAndFeel.SkinName = ''
Style.IsFontAssigned = True Style.IsFontAssigned = True
StyleDisabled.LookAndFeel.SkinName = '' StyleDisabled.LookAndFeel.SkinName = ''
StyleFocused.LookAndFeel.SkinName = '' StyleFocused.LookAndFeel.SkinName = ''
StyleHot.LookAndFeel.SkinName = '' StyleHot.LookAndFeel.SkinName = ''
ExplicitLeft = 541 ExplicitLeft = 497
ExplicitTop = 157 ExplicitTop = 157
end end
inherited ImporteBase: TcxDBCurrencyEdit inherited ImporteBase: TcxDBCurrencyEdit
Left = 541 Left = 497
Top = 80 Top = 80
Style.LookAndFeel.SkinName = '' Style.LookAndFeel.SkinName = ''
Style.IsFontAssigned = True Style.IsFontAssigned = True
StyleDisabled.LookAndFeel.SkinName = '' StyleDisabled.LookAndFeel.SkinName = ''
StyleFocused.LookAndFeel.SkinName = '' StyleFocused.LookAndFeel.SkinName = ''
StyleHot.LookAndFeel.SkinName = '' StyleHot.LookAndFeel.SkinName = ''
ExplicitLeft = 541 ExplicitLeft = 497
ExplicitTop = 80 ExplicitTop = 80
ExplicitWidth = 91 ExplicitWidth = 91
Width = 91 Width = 91
end end
inherited edtRE: TcxDBSpinEdit inherited edtRE: TcxDBSpinEdit
Left = 541 Left = 497
Top = 184 Top = 184
Style.LookAndFeel.SkinName = '' Style.LookAndFeel.SkinName = ''
Style.IsFontAssigned = True Style.IsFontAssigned = True
StyleDisabled.LookAndFeel.SkinName = '' StyleDisabled.LookAndFeel.SkinName = ''
StyleFocused.LookAndFeel.SkinName = '' StyleFocused.LookAndFeel.SkinName = ''
StyleHot.LookAndFeel.SkinName = '' StyleHot.LookAndFeel.SkinName = ''
ExplicitLeft = 541 ExplicitLeft = 497
ExplicitTop = 184 ExplicitTop = 184
end end
inherited ImporteRE: TcxDBCurrencyEdit inherited ImporteRE: TcxDBCurrencyEdit
Left = 612 Left = 568
Top = 184 Top = 184
Style.LookAndFeel.SkinName = '' Style.LookAndFeel.SkinName = ''
Style.IsFontAssigned = True Style.IsFontAssigned = True
StyleDisabled.LookAndFeel.SkinName = '' StyleDisabled.LookAndFeel.SkinName = ''
StyleFocused.LookAndFeel.SkinName = '' StyleFocused.LookAndFeel.SkinName = ''
StyleHot.LookAndFeel.SkinName = '' StyleHot.LookAndFeel.SkinName = ''
ExplicitLeft = 612 ExplicitLeft = 568
ExplicitTop = 184 ExplicitTop = 184
ExplicitWidth = 20 ExplicitWidth = 20
Width = 20 Width = 20
@ -1028,9 +1022,9 @@ inherited fEditorPresupuestoCliente: TfEditorPresupuestoCliente
Width = 20 Width = 20
end end
inherited bTiposIVA: TButton inherited bTiposIVA: TButton
Left = 281 Left = 237
Top = 161 Top = 161
ExplicitLeft = 281 ExplicitLeft = 237
ExplicitTop = 161 ExplicitTop = 161
end end
inherited cbRecargoEquivalencia: TcxDBCheckBox inherited cbRecargoEquivalencia: TcxDBCheckBox
@ -1042,32 +1036,32 @@ inherited fEditorPresupuestoCliente: TfEditorPresupuestoCliente
StyleHot.LookAndFeel.SkinName = '' StyleHot.LookAndFeel.SkinName = ''
ExplicitLeft = 130 ExplicitLeft = 130
ExplicitTop = 188 ExplicitTop = 188
ExplicitWidth = 221 ExplicitWidth = 158
Width = 221 Width = 158
end end
inherited edtRetencion: TcxDBSpinEdit inherited edtRetencion: TcxDBSpinEdit
Left = 541 Left = 497
Top = 258 Top = 258
Style.LookAndFeel.SkinName = '' Style.LookAndFeel.SkinName = ''
Style.IsFontAssigned = True Style.IsFontAssigned = True
StyleDisabled.LookAndFeel.SkinName = '' StyleDisabled.LookAndFeel.SkinName = ''
StyleFocused.LookAndFeel.SkinName = '' StyleFocused.LookAndFeel.SkinName = ''
StyleHot.LookAndFeel.SkinName = '' StyleHot.LookAndFeel.SkinName = ''
ExplicitLeft = 541 ExplicitLeft = 497
ExplicitTop = 258 ExplicitTop = 258
end end
inherited edtImporteRetencion: TcxDBCurrencyEdit inherited edtImporteRetencion: TcxDBCurrencyEdit
Left = 612 Left = 568
Top = 258 Top = 258
Style.LookAndFeel.SkinName = '' Style.LookAndFeel.SkinName = ''
Style.IsFontAssigned = True Style.IsFontAssigned = True
StyleDisabled.LookAndFeel.SkinName = '' StyleDisabled.LookAndFeel.SkinName = ''
StyleFocused.LookAndFeel.SkinName = '' StyleFocused.LookAndFeel.SkinName = ''
StyleHot.LookAndFeel.SkinName = '' StyleHot.LookAndFeel.SkinName = ''
ExplicitLeft = 612 ExplicitLeft = 568
ExplicitTop = 258 ExplicitTop = 258
ExplicitWidth = 180 ExplicitWidth = 20
Width = 180 Width = 20
end end
inherited edtFechaRetencion: TcxDBDateEdit inherited edtFechaRetencion: TcxDBDateEdit
Left = 130 Left = 130
@ -1078,8 +1072,8 @@ inherited fEditorPresupuestoCliente: TfEditorPresupuestoCliente
StyleHot.LookAndFeel.SkinName = '' StyleHot.LookAndFeel.SkinName = ''
ExplicitLeft = 130 ExplicitLeft = 130
ExplicitTop = 260 ExplicitTop = 260
ExplicitWidth = 280 ExplicitWidth = 158
Width = 280 Width = 158
end end
inherited cbBonificacion: TcxCheckBox inherited cbBonificacion: TcxCheckBox
Left = 21 Left = 21
@ -1102,8 +1096,6 @@ inherited fEditorPresupuestoCliente: TfEditorPresupuestoCliente
StyleHot.LookAndFeel.SkinName = '' StyleHot.LookAndFeel.SkinName = ''
ExplicitLeft = 367 ExplicitLeft = 367
ExplicitTop = 29 ExplicitTop = 29
ExplicitWidth = 325
Width = 325
end end
inherited eImporteBonificacion: TcxDBCurrencyEdit inherited eImporteBonificacion: TcxDBCurrencyEdit
Left = 449 Left = 449

View File

@ -94,6 +94,7 @@ type
function GetModified: Boolean; override; function GetModified: Boolean; override;
procedure SetModified(const Value : Boolean); override; procedure SetModified(const Value : Boolean); override;
function PuedoImprimir: Boolean; override; function PuedoImprimir: Boolean; override;
function PuedoEnviar: Boolean; virtual;
public public
property Controller : IPresupuestosClienteController read GetController write SetController; property Controller : IPresupuestosClienteController read GetController write SetController;
@ -124,14 +125,28 @@ end;
procedure TfEditorPresupuestoCliente.actEnviarPorEMailExecute(Sender: TObject); procedure TfEditorPresupuestoCliente.actEnviarPorEMailExecute(Sender: TObject);
begin begin
inherited; if actEnviarPorEMail.Enabled then
FController.EnviarPresupuestoPorEMail(Presupuesto); begin
if Modified then
begin
if (ShowConfirmMessage('Se han producido cambios', 'Se han producido cambios y no se puede enviar por email hasta que no se guarden.' + #10#13 +
'¿Desea guardarlos ahora?') = IDYES) then
begin
GuardarInterno;
FController.EnviarPresupuestoPorEMail(Presupuesto);
end
else
ShowInfoMessage('Recuerde guardar los cambios si quiere enviar por email.');
end
else
FController.EnviarPresupuestoPorEMail(Presupuesto);
end;
end; end;
procedure TfEditorPresupuestoCliente.actEnviarPorEMailUpdate(Sender: TObject); procedure TfEditorPresupuestoCliente.actEnviarPorEMailUpdate(Sender: TObject);
begin begin
inherited; inherited;
(Sender as TAction).Enabled := HayDatos; (Sender as TAction).Enabled := HayDatos and PuedoEnviar;
end; end;
procedure TfEditorPresupuestoCliente.actGenerarCertificadoExecute( procedure TfEditorPresupuestoCliente.actGenerarCertificadoExecute(
@ -337,6 +352,11 @@ begin
FController.Preview(FPresupuesto); FController.Preview(FPresupuesto);
end; end;
function TfEditorPresupuestoCliente.PuedoEnviar: Boolean;
begin
Result := not Presupuesto.Cliente.IDIsNull;
end;
function TfEditorPresupuestoCliente.PuedoImprimir: Boolean; function TfEditorPresupuestoCliente.PuedoImprimir: Boolean;
begin begin
Result := inherited PuedoImprimir and (not Presupuesto.Cliente.IDIsNull); Result := inherited PuedoImprimir and (not Presupuesto.Cliente.IDIsNull);

Binary file not shown.

View File

@ -14,7 +14,7 @@ BEGIN
BEGIN BEGIN
VALUE "FileVersion", "1.7.8.0\0" VALUE "FileVersion", "1.7.8.0\0"
VALUE "ProductVersion", "1.7.8.0\0" VALUE "ProductVersion", "1.7.8.0\0"
VALUE "CompileDate", "martes, 24 de noviembre de 2009 12:03\0" VALUE "CompileDate", "miércoles, 25 de noviembre de 2009 13:14\0"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"