#12 -> Enviar documentos por correo electrónico. Presupuestos y albaranes de cliente.

git-svn-id: https://192.168.0.254/svn/Proyectos.Tecsitel_FactuGES2/trunk@531 0c75b7a4-871f-7646-8a2f-f78d34cc349f
This commit is contained in:
David Arranz 2008-08-25 14:12:55 +00:00
parent eba6454bce
commit 1b741365bc
10 changed files with 1519 additions and 132 deletions

View File

@ -107,13 +107,13 @@ begin
begin begin
if not IsValidEmail(edtEMail.Text) then if not IsValidEmail(edtEMail.Text) then
begin begin
ShowErrorMessage('Elegir dirección de correo electrónico', 'La dirección de correo electrónica no es válida. Compruebe que está bien escrita.'); ShowErrorMessage('La dirección de correo electrónica no es válida', 'Para poder continuar, compruebe que ha indicado una dirección de correo y que está bien escrita.');
edtEMail.SetFocus; edtEMail.SetFocus;
CanClose := False; CanClose := False;
end; end;
end end
else begin else begin
ShowErrorMessage('Elegir dirección de correo electrónico', 'Debe indicar una dirección de correo electrónico.'); ShowErrorMessage('Debe indicar una dirección de correo electrónico.', 'Para poder continuar debe elegir o indicar una dirección de correo electrónico.');
edtEMail.SetFocus; edtEMail.SetFocus;
CanClose := False; CanClose := False;
end; end;

View File

@ -54,6 +54,7 @@ type
procedure CopiarDireccionEnvio (const ADireccionEnvio: IBizDireccionesContacto; procedure CopiarDireccionEnvio (const ADireccionEnvio: IBizDireccionesContacto;
AAlbaran: IBizAlbaranCliente); AAlbaran: IBizAlbaranCliente);
procedure QuitarDireccionEnvio(AAlbaran: IBizAlbaranCliente); procedure QuitarDireccionEnvio(AAlbaran: IBizAlbaranCliente);
procedure EnviarAlbaranPorEMail(AAlbaran : IBizAlbaranCliente);
procedure RecuperarCliente(AAlbaran: IBizAlbaranCliente); procedure RecuperarCliente(AAlbaran: IBizAlbaranCliente);
function CambiarSituacion(AAlbaran : IBizAlbaranCliente; function CambiarSituacion(AAlbaran : IBizAlbaranCliente;
ANuevaSituacion: String; AFechaEnvio : TDateTime = 0; ANuevaSituacion: String; AFechaEnvio : TDateTime = 0;
@ -127,6 +128,7 @@ type
function EsModificable(AAlbaran: IBizAlbaranCliente): Boolean; function EsModificable(AAlbaran: IBizAlbaranCliente): Boolean;
function EsEliminable(AAlbaran: IBizAlbaranCliente): Boolean; function EsEliminable(AAlbaran: IBizAlbaranCliente): Boolean;
procedure EnviarAlbaranPorEMail(AAlbaran : IBizAlbaranCliente);
function CambiarSituacion(AAlbaran : IBizAlbaranCliente; function CambiarSituacion(AAlbaran : IBizAlbaranCliente;
ANuevaSituacion: String; AFechaEnvio : TDateTime = 0; ANuevaSituacion: String; AFechaEnvio : TDateTime = 0;
AFechaRecibido : TDateTime = 0; AFechaRecibido : TDateTime = 0;
@ -152,7 +154,8 @@ uses
// Pedidos no estará en TECSITEL // Pedidos no estará en TECSITEL
// uPedidosClienteController, uBizPedidosCliente, uBizDetallesPedidoCliente, schPedidosClienteClient_Intf, // uPedidosClienteController, uBizPedidosCliente, uBizDetallesPedidoCliente, schPedidosClienteClient_Intf,
uDialogUtils, Windows, Forms, Dialogs, uGUIBase, uIntegerListUtils; uDialogUtils, Windows, Forms, Dialogs, uGUIBase, uIntegerListUtils,
uSistemaFunc, uEMailUtils, uDialogElegirEMail;
@ -738,6 +741,51 @@ begin
end; end;
end; end;
procedure TAlbaranesClienteController.EnviarAlbaranPorEMail(
AAlbaran: IBizAlbaranCliente);
var
AReportController : IAlbaranesClienteReportController;
AFicheroTMP : TFileName;
AEMail : String;
AListaEmail : TStringList;
begin
if not Assigned(AAlbaran) then
raise Exception.Create ('Albarán no asignado (EnviarAlbaranPorEMail)');
if AAlbaran.DataTable.Active then
AAlbaran.DataTable.Active := True;
AFicheroTMP := DarFicheroPDFTemporal(EscapeIllegalChars(AAlbaran.REFERENCIA));
AListaEmail := TStringList.Create;
try
RecuperarCliente(AAlbaran);
AAlbaran.Cliente.DataTable.Active := True;
if not AAlbaran.Cliente.EMAIL_1IsNull then
AListaEmail.Add(AAlbaran.Cliente.EMAIL_1);
if not AAlbaran.Cliente.EMAIL_2IsNull then
AListaEmail.Add(AAlbaran.Cliente.EMAIL_2);
if not ElegirEMail(AListaEmail, AEMail) then
Exit;
finally
FreeANDNIL(AListaEmail);
end;
ShowHourglassCursor;
AReportController := TAlbaranesClienteReportController.Create;
try
AReportController.ExportToPDF(AAlbaran.ID, AFicheroTMP);
SendMailMAPI('Albarán ' + AAlbaran.REFERENCIA, '', AFicheroTMP, '', '', AAlbaran.Cliente.NOMBRE, AEMail);
finally
SysUtils.DeleteFile(AFicheroTMP);
AReportController := NIL;
HideHourglassCursor;
end;
end;
function TAlbaranesClienteController.EsEliminable(AAlbaran: IBizAlbaranCliente): Boolean; function TAlbaranesClienteController.EsEliminable(AAlbaran: IBizAlbaranCliente): Boolean;
begin begin
if not Assigned(AAlbaran) then if not Assigned(AAlbaran) then

View File

@ -15,6 +15,7 @@ type
procedure EtiquetasPreview(const AID : integer; Const withRefCliente: Boolean); procedure EtiquetasPreview(const AID : integer; Const withRefCliente: Boolean);
procedure EtiquetasPrint(const AID : integer; Const withRefCliente: Boolean); procedure EtiquetasPrint(const AID : integer; Const withRefCliente: Boolean);
function ExportToWord(const AID: Integer; const AFileName : String = ''): Boolean; function ExportToWord(const AID: Integer; const AFileName : String = ''): Boolean;
function ExportToPDF(const AID: Integer; const AFileName : String = ''): Boolean;
end; end;
TAlbaranesClienteReportController = class(TControllerBase, IAlbaranesClienteReportController) TAlbaranesClienteReportController = class(TControllerBase, IAlbaranesClienteReportController)
@ -29,6 +30,7 @@ type
procedure Preview(const AListaID : TIntegerList); procedure Preview(const AListaID : TIntegerList);
procedure Print(const AListaID : TIntegerList); procedure Print(const AListaID : TIntegerList);
function ExportToWord(const AID: Integer; const AFileName : String = ''): Boolean; function ExportToWord(const AID: Integer; const AFileName : String = ''): Boolean;
function ExportToPDF(const AID: Integer; const AFileName : String = ''): Boolean;
procedure EtiquetasPreview(const AID : integer; const withRefCliente: Boolean); procedure EtiquetasPreview(const AID : integer; const withRefCliente: Boolean);
procedure EtiquetasPrint(const AID : integer; const withRefCliente: Boolean); procedure EtiquetasPrint(const AID : integer; const withRefCliente: Boolean);
end; end;
@ -115,6 +117,29 @@ begin
end; end;
end; end;
function TAlbaranesClienteReportController.ExportToPDF(const AID: Integer;
const AFileName: String): Boolean;
var
AStream: Binary;
begin
Result := False;
if EsCadenaVacia(AFileName) then
Exit;
ShowHourglassCursor;
try
AStream := FDataModule.GetRptPDFAlbaran(AID);
try
AStream.SaveToFile(AFileName);
Result := True;
finally
FreeAndNil(AStream);
end;
finally
HideHourglassCursor;
end;
end;
function TAlbaranesClienteReportController.ExportToWord(const AID: Integer; function TAlbaranesClienteReportController.ExportToWord(const AID: Integer;
const AFileName: String): Boolean; const AFileName: String): Boolean;
var var

View File

@ -13,7 +13,8 @@ uses
uViewIncidencias, uAlbaranesClienteController, uViewDetallesBase, uViewDetallesAlbaranCliente, uViewIncidencias, uAlbaranesClienteController, uViewDetallesBase, uViewDetallesAlbaranCliente,
dxLayoutLookAndFeels, JvExComCtrls, JvStatusBar, uViewTotales, dxLayoutLookAndFeels, JvExComCtrls, JvStatusBar, uViewTotales,
uIEditorAlbaranCliente, uBizAlbaranesCliente, uViewAlbaranCliente, uIEditorAlbaranCliente, uBizAlbaranesCliente, uViewAlbaranCliente,
uViewDetallesDTO, uViewDetallesArticulos, uDAInterfaces; uViewDetallesDTO, uViewDetallesArticulos, uDAInterfaces,
uViewDetallesArticulosParaVenta;
type type
TfEditorAlbaranCliente = class(TfEditorDBItem, IEditorAlbaranCliente) TfEditorAlbaranCliente = class(TfEditorDBItem, IEditorAlbaranCliente)
@ -24,6 +25,11 @@ type
dxLayoutOfficeLookAndFeel1: TdxLayoutOfficeLookAndFeel; dxLayoutOfficeLookAndFeel1: TdxLayoutOfficeLookAndFeel;
frViewDetallesAlbaranCliente1: TfrViewDetallesAlbaranCliente; frViewDetallesAlbaranCliente1: TfrViewDetallesAlbaranCliente;
frViewTotales1: TfrViewTotales; frViewTotales1: TfrViewTotales;
actEnviarEMail: TAction;
TBXSubmenuItem2: TTBXSubmenuItem;
TBXItem7: TTBXItem;
TBXItem33: TTBXItem;
TBXSeparatorItem6: TTBXSeparatorItem;
procedure FormShow(Sender: TObject); procedure FormShow(Sender: TObject);
procedure CustomEditorClose(Sender: TObject; var Action: TCloseAction); procedure CustomEditorClose(Sender: TObject; var Action: TCloseAction);
@ -34,6 +40,8 @@ type
var DisplayValue: Variant; var ErrorText: TCaption; var Error: Boolean); var DisplayValue: Variant; var ErrorText: TCaption; var Error: Boolean);
procedure frViewTotales1edtIVAPropertiesValidate(Sender: TObject; procedure frViewTotales1edtIVAPropertiesValidate(Sender: TObject;
var DisplayValue: Variant; var ErrorText: TCaption; var Error: Boolean); var DisplayValue: Variant; var ErrorText: TCaption; var Error: Boolean);
procedure actEnviarEMailExecute(Sender: TObject);
procedure actEnviarEMailUpdate(Sender: TObject);
private private
procedure RecalcularPortePorUnidad; procedure RecalcularPortePorUnidad;
@ -86,10 +94,21 @@ uses
{ {
**************************** TfEditorAlbaranCliente **************************** **************************** TfEditorAlbaranCliente ****************************
} }
procedure TfEditorAlbaranCliente.actEnviarEMailExecute(Sender: TObject);
begin
inherited;
FController.EnviarAlbaranPorEMail(FAlbaran);
end;
procedure TfEditorAlbaranCliente.actEnviarEMailUpdate(Sender: TObject);
begin
inherited;
(Sender as TAction).Enabled := HayDatos;
end;
procedure TfEditorAlbaranCliente.AsignarVista; procedure TfEditorAlbaranCliente.AsignarVista;
var var
AViewAlbaranCliente: TfrViewAlbaranCliente; AViewAlbaranCliente: TfrViewAlbaranCliente;
begin begin
AViewAlbaranCliente := TfrViewAlbaranCliente.create(Self); AViewAlbaranCliente := TfrViewAlbaranCliente.create(Self);
with AViewAlbaranCliente do with AViewAlbaranCliente do

View File

@ -37,47 +37,47 @@ inherited fEditorAlbaranDevCliente: TfEditorAlbaranDevCliente
end end
inherited pgPaginas: TPageControl inherited pgPaginas: TPageControl
inherited pagContenido: TTabSheet inherited pagContenido: TTabSheet
ExplicitLeft = 4
ExplicitTop = 24
ExplicitWidth = 751
ExplicitHeight = 378
inherited frViewDetallesAlbaranCliente1: TfrViewDetallesAlbaranCliente inherited frViewDetallesAlbaranCliente1: TfrViewDetallesAlbaranCliente
inherited ToolBar1: TToolBar inherited ToolBar1: TToolBar
inherited FontSize: TEdit inherited FontSize: TEdit
Width = 58 Width = 58
ExplicitWidth = 58 ExplicitWidth = 58
end end
inherited UpDown1: TUpDown inherited UpDown1: TUpDown [7]
Left = 602 Left = 602
Top = 0
ExplicitLeft = 602 ExplicitLeft = 602
ExplicitTop = 0
end end
inherited ToolButton9: TToolButton [9] inherited ToolButton13: TToolButton [8]
end
inherited ToolButton6: TToolButton
Left = 0 Left = 0
ExplicitLeft = 0 ExplicitLeft = 0
end end
inherited ToolButton12: TToolButton [10] inherited ToolButton7: TToolButton
Left = 145 Left = 66
ExplicitLeft = 145 ExplicitLeft = 66
end end
inherited ToolButton6: TToolButton [11] inherited ToolButton8: TToolButton
Left = 153 Left = 133
ExplicitLeft = 153 ExplicitLeft = 133
end end
inherited ToolButton8: TToolButton [12] inherited ToolButton12: TToolButton
Left = 219 Left = 216
ExplicitLeft = 219 ExplicitLeft = 216
end end
inherited ToolButton10: TToolButton [13] inherited ToolButton9: TToolButton
Left = 302 Left = 224
ExplicitLeft = 302 ExplicitLeft = 224
end end
inherited ToolButton11: TToolButton [14] inherited ToolButton10: TToolButton
Left = 427 Left = 369
ExplicitLeft = 427 ExplicitLeft = 369
end end
inherited ToolButton7: TToolButton [15] inherited ToolButton11: TToolButton
Left = 568 Left = 494
ExplicitLeft = 568 ExplicitLeft = 494
end end
end end
inherited cxGridPopupMenu: TcxGridPopupMenu inherited cxGridPopupMenu: TcxGridPopupMenu
@ -92,10 +92,6 @@ inherited fEditorAlbaranDevCliente: TfEditorAlbaranDevCliente
end end
end end
inherited pagInicidencias: TTabSheet inherited pagInicidencias: TTabSheet
ExplicitLeft = 4
ExplicitTop = 24
ExplicitWidth = 751
ExplicitHeight = 378
inherited frViewIncidenciasCli: TfrViewIncidencias inherited frViewIncidenciasCli: TfrViewIncidencias
inherited GroupBox1: TGroupBox inherited GroupBox1: TGroupBox
inherited eIncidencias: TcxDBMemo inherited eIncidencias: TcxDBMemo
@ -113,7 +109,9 @@ inherited fEditorAlbaranDevCliente: TfEditorAlbaranDevCliente
LookAndFeel = dxLayoutOfficeLookAndFeel1 LookAndFeel = dxLayoutOfficeLookAndFeel1
inherited Bevel3: TBevel inherited Bevel3: TBevel
Left = 351 Left = 351
Height = 54
ExplicitLeft = 351 ExplicitLeft = 351
ExplicitHeight = 54
end end
inherited Bevel4: TBevel inherited Bevel4: TBevel
Left = 467 Left = 467
@ -122,106 +120,62 @@ inherited fEditorAlbaranDevCliente: TfEditorAlbaranDevCliente
ExplicitWidth = 285 ExplicitWidth = 285
end end
inherited ImporteDto: TcxDBCurrencyEdit inherited ImporteDto: TcxDBCurrencyEdit
Style.LookAndFeel.SkinName = ''
Style.IsFontAssigned = True Style.IsFontAssigned = True
StyleDisabled.LookAndFeel.SkinName = ''
StyleFocused.LookAndFeel.SkinName = ''
StyleHot.LookAndFeel.SkinName = ''
ExplicitWidth = 151 ExplicitWidth = 151
Width = 151 Width = 151
end end
inherited ImporteIVA: TcxDBCurrencyEdit inherited ImporteIVA: TcxDBCurrencyEdit
Left = 538 Left = 538
Style.LookAndFeel.SkinName = ''
Style.IsFontAssigned = True Style.IsFontAssigned = True
StyleDisabled.LookAndFeel.SkinName = ''
StyleFocused.LookAndFeel.SkinName = ''
StyleHot.LookAndFeel.SkinName = ''
ExplicitLeft = 538 ExplicitLeft = 538
ExplicitWidth = 219 ExplicitWidth = 219
Width = 219 Width = 219
end end
inherited ImporteTotal: TcxDBCurrencyEdit inherited ImporteTotal: TcxDBCurrencyEdit
Left = 468 Left = 468
Style.LookAndFeel.SkinName = ''
Style.IsFontAssigned = True Style.IsFontAssigned = True
StyleDisabled.LookAndFeel.SkinName = ''
StyleFocused.LookAndFeel.SkinName = ''
StyleHot.LookAndFeel.SkinName = ''
ExplicitLeft = 468 ExplicitLeft = 468
ExplicitWidth = 289 ExplicitWidth = 289
Width = 289 Width = 289
end end
inherited edtDescuento: TcxDBSpinEdit inherited edtDescuento: TcxDBSpinEdit
Style.LookAndFeel.SkinName = ''
Style.IsFontAssigned = True Style.IsFontAssigned = True
StyleDisabled.LookAndFeel.SkinName = ''
StyleFocused.LookAndFeel.SkinName = ''
StyleHot.LookAndFeel.SkinName = ''
end end
inherited edtIVA: TcxDBSpinEdit inherited edtIVA: TcxDBSpinEdit
Left = 467 Left = 467
Style.LookAndFeel.SkinName = ''
Style.IsFontAssigned = True Style.IsFontAssigned = True
StyleDisabled.LookAndFeel.SkinName = ''
StyleFocused.LookAndFeel.SkinName = ''
StyleHot.LookAndFeel.SkinName = ''
ExplicitLeft = 467 ExplicitLeft = 467
end end
inherited ImporteBase: TcxDBCurrencyEdit inherited ImporteBase: TcxDBCurrencyEdit
Left = 467 Left = 467
Style.LookAndFeel.SkinName = ''
Style.IsFontAssigned = True Style.IsFontAssigned = True
StyleDisabled.LookAndFeel.SkinName = ''
StyleFocused.LookAndFeel.SkinName = ''
StyleHot.LookAndFeel.SkinName = ''
ExplicitLeft = 467 ExplicitLeft = 467
ExplicitWidth = 290 ExplicitWidth = 290
Width = 290 Width = 290
end end
inherited edtRE: TcxDBSpinEdit inherited edtRE: TcxDBSpinEdit
Left = 467 Left = 467
Style.LookAndFeel.SkinName = ''
Style.IsFontAssigned = True Style.IsFontAssigned = True
StyleDisabled.LookAndFeel.SkinName = ''
StyleFocused.LookAndFeel.SkinName = ''
StyleHot.LookAndFeel.SkinName = ''
ExplicitLeft = 467 ExplicitLeft = 467
end end
inherited ImporteRE: TcxDBCurrencyEdit inherited ImporteRE: TcxDBCurrencyEdit
Left = 538 Left = 538
Style.LookAndFeel.SkinName = ''
Style.IsFontAssigned = True Style.IsFontAssigned = True
StyleDisabled.LookAndFeel.SkinName = ''
StyleFocused.LookAndFeel.SkinName = ''
StyleHot.LookAndFeel.SkinName = ''
ExplicitLeft = 538 ExplicitLeft = 538
ExplicitWidth = 219 ExplicitWidth = 219
Width = 219 Width = 219
end end
inherited eImporteNeto: TcxDBCurrencyEdit inherited eImporteNeto: TcxDBCurrencyEdit
Style.LookAndFeel.SkinName = ''
Style.IsFontAssigned = True Style.IsFontAssigned = True
StyleDisabled.LookAndFeel.SkinName = ''
StyleFocused.LookAndFeel.SkinName = ''
StyleHot.LookAndFeel.SkinName = ''
ExplicitWidth = 222 ExplicitWidth = 222
Width = 222 Width = 222
end end
inherited ePorte: TcxDBCurrencyEdit inherited ePorte: TcxDBCurrencyEdit
Style.LookAndFeel.SkinName = ''
Style.IsFontAssigned = True Style.IsFontAssigned = True
StyleDisabled.LookAndFeel.SkinName = ''
StyleFocused.LookAndFeel.SkinName = ''
StyleHot.LookAndFeel.SkinName = ''
ExplicitWidth = 222 ExplicitWidth = 222
Width = 222 Width = 222
end end
inherited eIVA: TcxDBLookupComboBox inherited eIVA: TcxDBLookupComboBox
Style.LookAndFeel.SkinName = ''
StyleDisabled.LookAndFeel.SkinName = ''
StyleFocused.LookAndFeel.SkinName = ''
StyleHot.LookAndFeel.SkinName = ''
ExplicitWidth = 84 ExplicitWidth = 84
Width = 84 Width = 84
end end
@ -230,12 +184,7 @@ inherited fEditorAlbaranDevCliente: TfEditorAlbaranDevCliente
ExplicitLeft = 203 ExplicitLeft = 203
end end
inherited cbRecargoEquivalencia: TcxDBCheckBox inherited cbRecargoEquivalencia: TcxDBCheckBox
Style.LookAndFeel.SkinName = ''
StyleDisabled.LookAndFeel.SkinName = ''
StyleFocused.LookAndFeel.SkinName = ''
StyleHot.LookAndFeel.SkinName = ''
ExplicitWidth = 222 ExplicitWidth = 222
ExplicitHeight = 21
Width = 222 Width = 222
end end
inherited dxLayoutControl1Group_Root: TdxLayoutGroup inherited dxLayoutControl1Group_Root: TdxLayoutGroup

View File

@ -10,7 +10,8 @@ uses
JvStatusBar, uViewIncidencias, uCustomView, uViewBase, uViewDetallesBase, JvStatusBar, uViewIncidencias, uCustomView, uViewBase, uViewDetallesBase,
uViewDetallesDTO, uViewDetallesArticulos, uViewDetallesAlbaranCliente, TBX, uViewDetallesDTO, uViewDetallesArticulos, uViewDetallesAlbaranCliente, TBX,
TB2Item, TB2Dock, TB2Toolbar, pngimage, ExtCtrls, JvExControls, JvComponent, TB2Item, TB2Dock, TB2Toolbar, pngimage, ExtCtrls, JvExControls, JvComponent,
JvNavigationPane, uIEditorAlbaranDevCliente, uDAInterfaces, dxGDIPlusClasses; JvNavigationPane, uIEditorAlbaranDevCliente, uDAInterfaces, dxGDIPlusClasses,
uViewDetallesArticulosParaVenta;
type type
TfEditorAlbaranDevCliente = class(TfEditorAlbaranCliente, IEditorAlbaranDevCliente) TfEditorAlbaranDevCliente = class(TfEditorAlbaranCliente, IEditorAlbaranDevCliente)

View File

@ -2,7 +2,6 @@ inherited fEditorAlbaranesCliente: TfEditorAlbaranesCliente
Caption = 'Lista de albaranes de cliente' Caption = 'Lista de albaranes de cliente'
ClientWidth = 583 ClientWidth = 583
ExplicitWidth = 591 ExplicitWidth = 591
ExplicitHeight = 240
PixelsPerInch = 96 PixelsPerInch = 96
TextHeight = 13 TextHeight = 13
inherited JvNavPanelHeader: TJvNavPanelHeader inherited JvNavPanelHeader: TJvNavPanelHeader
@ -131,6 +130,12 @@ inherited fEditorAlbaranesCliente: TfEditorAlbaranesCliente
end end
inherited tbxMenu: TTBXToolbar inherited tbxMenu: TTBXToolbar
ExplicitWidth = 583 ExplicitWidth = 583
object TBXSubmenuItem2: TTBXSubmenuItem [4]
Caption = 'A&cciones'
object TBXItem39: TTBXItem
Action = actEnviarEMail
end
end
end end
inherited TBXTMain2: TTBXToolbar inherited TBXTMain2: TTBXToolbar
Visible = True Visible = True
@ -221,6 +226,12 @@ inherited fEditorAlbaranesCliente: TfEditorAlbaranesCliente
OnExecute = actGenerarEtiquetasExecute OnExecute = actGenerarEtiquetasExecute
OnUpdate = actGenerarEtiquetasUpdate OnUpdate = actGenerarEtiquetasUpdate
end end
object actEnviarEMail: TAction
Category = 'Acciones'
Caption = 'Enviar por e-mail...'
OnExecute = actEnviarEMailExecute
OnUpdate = actEnviarEMailUpdate
end
end end
inherited SmallImages: TPngImageList inherited SmallImages: TPngImageList
PngImages = < PngImages = <
@ -1672,6 +1683,9 @@ inherited fEditorAlbaranesCliente: TfEditorAlbaranesCliente
object Generarfactura1: TMenuItem [7] object Generarfactura1: TMenuItem [7]
Action = actGenerarFactura Action = actGenerarFactura
end end
object Enviarporemail1: TMenuItem [12]
Action = actEnviarEMail
end
end end
object JsNuevoAlbaranDialog: TJSDialog object JsNuevoAlbaranDialog: TJSDialog
Content.Strings = ( Content.Strings = (

View File

@ -36,6 +36,10 @@ type
actGenerarEtiquetas: TAction; actGenerarEtiquetas: TAction;
TBXItem38: TTBXItem; TBXItem38: TTBXItem;
JsListaAlbaranesNoEliminados: TJSDialog; JsListaAlbaranesNoEliminados: TJSDialog;
actEnviarEMail: TAction;
Enviarporemail1: TMenuItem;
TBXSubmenuItem2: TTBXSubmenuItem;
TBXItem39: TTBXItem;
procedure FormShow(Sender: TObject); procedure FormShow(Sender: TObject);
procedure actGenerarFacturaUpdate(Sender: TObject); procedure actGenerarFacturaUpdate(Sender: TObject);
procedure actGenerarFacturaExecute(Sender: TObject); procedure actGenerarFacturaExecute(Sender: TObject);
@ -48,6 +52,8 @@ type
procedure actConfirmarRecepcionUpdate(Sender: TObject); procedure actConfirmarRecepcionUpdate(Sender: TObject);
procedure actGenerarEtiquetasExecute(Sender: TObject); procedure actGenerarEtiquetasExecute(Sender: TObject);
procedure actGenerarEtiquetasUpdate(Sender: TObject); procedure actGenerarEtiquetasUpdate(Sender: TObject);
procedure actEnviarEMailExecute(Sender: TObject);
procedure actEnviarEMailUpdate(Sender: TObject);
protected protected
FAlbaranes: IBizAlbaranCliente; FAlbaranes: IBizAlbaranCliente;
@ -199,6 +205,22 @@ begin
and ViewGrid.esSeleccionCeldaDatos; and ViewGrid.esSeleccionCeldaDatos;
end; end;
procedure TfEditorAlbaranesCliente.actEnviarEMailExecute(Sender: TObject);
begin
inherited;
FController.EnviarAlbaranPorEMail(FAlbaranes);
end;
procedure TfEditorAlbaranesCliente.actEnviarEMailUpdate(Sender: TObject);
begin
inherited;
if HayDatos and Assigned(ViewGrid) then
(Sender as TAction).Enabled := ViewGrid.EsSeleccionCeldaDatos
and (ViewGrid.NumSeleccionados > 0)
else
(Sender as TAction).Enabled := False;
end;
procedure TfEditorAlbaranesCliente.actEnviarExecute(Sender: TObject); procedure TfEditorAlbaranesCliente.actEnviarExecute(Sender: TObject);
//var //var
// AInventarioController : IInventarioController; // AInventarioController : IInventarioController;

View File

@ -222,10 +222,11 @@ end;
procedure TfEditorPresupuestosCliente.actEnviarEMailUpdate(Sender: TObject); procedure TfEditorPresupuestosCliente.actEnviarEMailUpdate(Sender: TObject);
begin begin
inherited; inherited;
(Sender as TAction).Enabled := HayDatos if HayDatos and Assigned(ViewGrid) then
and not (ViewGrid.NumSeleccionados > 1) (Sender as TAction).Enabled := ViewGrid.EsSeleccionCeldaDatos
and ViewGrid.esSeleccionCeldaDatos; and (ViewGrid.NumSeleccionados > 0)
else
(Sender as TAction).Enabled := False;
end; end;
procedure TfEditorPresupuestosCliente.actGenerarAlbaranCliExecute(Sender: TObject); procedure TfEditorPresupuestosCliente.actGenerarAlbaranCliExecute(Sender: TObject);