Tarea #1178 -> Al enviar por email un albarán de proveedor, preguntar si se quiere con precios o no (como al imprimir)
git-svn-id: https://192.168.0.254/svn/Proyectos.LuisLeon_FactuGES2/trunk@182 b2cfbe5a-eba1-4a0c-8b32-7feea0a119f2
This commit is contained in:
parent
ac3fa65c56
commit
87562cd1b4
@ -11,6 +11,15 @@ type
|
|||||||
function GetAlbaranes: IBizAlbaranProveedor;
|
function GetAlbaranes: IBizAlbaranProveedor;
|
||||||
procedure SetAlbaranes(const Value: IBizAlbaranProveedor);
|
procedure SetAlbaranes(const Value: IBizAlbaranProveedor);
|
||||||
property Albaranes: IBizAlbaranProveedor read GetAlbaranes write SetAlbaranes;
|
property Albaranes: IBizAlbaranProveedor read GetAlbaranes write SetAlbaranes;
|
||||||
|
|
||||||
|
function GetVerPrecios: Boolean;
|
||||||
|
procedure SetVerPrecios(const Value: Boolean);
|
||||||
|
property VerPrecios: Boolean read GetVerPrecios write SetVerPrecios;
|
||||||
|
|
||||||
|
function GetVerRefProveedor: Boolean;
|
||||||
|
procedure SetVerRefProveedor(const Value: Boolean);
|
||||||
|
property VerRefProveedor: Boolean read GetVerRefProveedor write SetVerRefProveedor;
|
||||||
|
|
||||||
function ShowModal : Integer;
|
function ShowModal : Integer;
|
||||||
procedure Release;
|
procedure Release;
|
||||||
end;
|
end;
|
||||||
|
|||||||
@ -65,12 +65,15 @@ type
|
|||||||
function Print(AAlbaran : IBizAlbaranProveedor; AllItems: Boolean = false;
|
function Print(AAlbaran : IBizAlbaranProveedor; AllItems: Boolean = false;
|
||||||
const VerPrecios: Boolean = True; const VerRefProveedor: Boolean = True): Boolean;
|
const VerPrecios: Boolean = True; const VerRefProveedor: Boolean = True): Boolean;
|
||||||
|
|
||||||
procedure GenerarEmailAlbaran(AAlbaran : IBizAlbaranProveedor);
|
procedure GenerarEmailAlbaran(AAlbaran : IBizAlbaranProveedor;
|
||||||
function EnviarEmailAlbaranes(AAlbaranes : IBizAlbaranProveedor): Boolean;
|
const VerPrecios: Boolean = True; const VerRefProveedor: Boolean = True);
|
||||||
|
function EnviarEmailAlbaranes(AAlbaranes : IBizAlbaranProveedor;
|
||||||
|
const VerPrecios: Boolean = True; const VerRefProveedor: Boolean = True): Boolean;
|
||||||
function EnviarAlbaranPorEMail(AAlbaran: IBizAlbaranProveedor;
|
function EnviarAlbaranPorEMail(AAlbaran: IBizAlbaranProveedor;
|
||||||
const AEnviarDirectamente: Boolean = True;
|
const AEnviarDirectamente: Boolean = True;
|
||||||
const ADireccionEMail: String = ''; const AAsuntoEMail: String = '';
|
const ADireccionEMail: String = ''; const AAsuntoEMail: String = '';
|
||||||
const ATextoEMail: String = ''): Boolean;
|
const ATextoEMail: String = ''; const VerPrecios: Boolean = True;
|
||||||
|
const VerRefProveedor: Boolean = True): Boolean;
|
||||||
|
|
||||||
function DarListaAnosAlbaranes: TStringList;
|
function DarListaAnosAlbaranes: TStringList;
|
||||||
procedure FiltrarAno(AAlbaran: IBizAlbaranProveedor; ADynWhereDataTable: WideString; const Ano: String);
|
procedure FiltrarAno(AAlbaran: IBizAlbaranProveedor; ADynWhereDataTable: WideString; const Ano: String);
|
||||||
@ -158,12 +161,15 @@ type
|
|||||||
function Print(AAlbaran : IBizAlbaranProveedor; AllItems: Boolean = false;
|
function Print(AAlbaran : IBizAlbaranProveedor; AllItems: Boolean = false;
|
||||||
const VerPrecios: Boolean = True; const VerRefProveedor: Boolean = True): Boolean;
|
const VerPrecios: Boolean = True; const VerRefProveedor: Boolean = True): Boolean;
|
||||||
|
|
||||||
procedure GenerarEmailAlbaran(AAlbaran : IBizAlbaranProveedor);
|
procedure GenerarEmailAlbaran(AAlbaran : IBizAlbaranProveedor;
|
||||||
function EnviarEmailAlbaranes(AAlbaranes : IBizAlbaranProveedor): Boolean;
|
const VerPrecios: Boolean = True; const VerRefProveedor: Boolean = True);
|
||||||
|
function EnviarEmailAlbaranes(AAlbaranes : IBizAlbaranProveedor;
|
||||||
|
const VerPrecios: Boolean = True; const VerRefProveedor: Boolean = True): Boolean;
|
||||||
function EnviarAlbaranPorEMail(AAlbaran: IBizAlbaranProveedor;
|
function EnviarAlbaranPorEMail(AAlbaran: IBizAlbaranProveedor;
|
||||||
const AEnviarDirectamente: Boolean = True;
|
const AEnviarDirectamente: Boolean = True;
|
||||||
const ADireccionEMail: String = ''; const AAsuntoEMail: String = '';
|
const ADireccionEMail: String = ''; const AAsuntoEMail: String = '';
|
||||||
const ATextoEMail: String = ''): Boolean;
|
const ATextoEMail: String = ''; const VerPrecios: Boolean = True;
|
||||||
|
const VerRefProveedor: Boolean = True): Boolean;
|
||||||
|
|
||||||
function DarListaAnosAlbaranes: TStringList;
|
function DarListaAnosAlbaranes: TStringList;
|
||||||
procedure FiltrarAno(AAlbaran: IBizAlbaranProveedor; ADynWhereDataTable: WideString; const Ano: String);
|
procedure FiltrarAno(AAlbaran: IBizAlbaranProveedor; ADynWhereDataTable: WideString; const Ano: String);
|
||||||
@ -947,9 +953,11 @@ begin
|
|||||||
HideHourglassCursor;
|
HideHourglassCursor;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TAlbaranesProveedorController.EnviarAlbaranPorEMail(
|
function TAlbaranesProveedorController.EnviarAlbaranPorEMail(
|
||||||
AAlbaran: IBizAlbaranProveedor; const AEnviarDirectamente: Boolean;
|
AAlbaran: IBizAlbaranProveedor; const AEnviarDirectamente: Boolean;
|
||||||
const ADireccionEMail, AAsuntoEMail, ATextoEMail: String): Boolean;
|
const ADireccionEMail, AAsuntoEMail, ATextoEMail: String;
|
||||||
|
const VerPrecios: Boolean; const VerRefProveedor: Boolean): Boolean;
|
||||||
var
|
var
|
||||||
AReportController : IAlbaranesProveedorReportController;
|
AReportController : IAlbaranesProveedorReportController;
|
||||||
AFicheroTMP : TFileName;
|
AFicheroTMP : TFileName;
|
||||||
@ -957,6 +965,8 @@ var
|
|||||||
AAsunto : String;
|
AAsunto : String;
|
||||||
AListaEmail : TStringList;
|
AListaEmail : TStringList;
|
||||||
begin
|
begin
|
||||||
|
Result := False;
|
||||||
|
|
||||||
if not Assigned(AAlbaran) then
|
if not Assigned(AAlbaran) then
|
||||||
raise Exception.Create ('Albaran no asignada (EnviarAlbaranPorEMail)');
|
raise Exception.Create ('Albaran no asignada (EnviarAlbaranPorEMail)');
|
||||||
|
|
||||||
@ -996,7 +1006,7 @@ begin
|
|||||||
|
|
||||||
AReportController := TAlbaranesProveedorReportController.Create;
|
AReportController := TAlbaranesProveedorReportController.Create;
|
||||||
try
|
try
|
||||||
AReportController.ExportToPDF(AAlbaran.ID, AFicheroTMP);
|
AReportController.ExportToPDF(AAlbaran.ID, AFicheroTMP, VerPrecios, VerRefProveedor);
|
||||||
Result := EnviarEMailMAPI(AAsunto, ATextoEMail, AFicheroTMP, '', '', AAlbaran.Proveedor.NOMBRE, AEMail, AEnviarDirectamente);
|
Result := EnviarEMailMAPI(AAsunto, ATextoEMail, AFicheroTMP, '', '', AAlbaran.Proveedor.NOMBRE, AEMail, AEnviarDirectamente);
|
||||||
if Result then
|
if Result then
|
||||||
_AnadirMarcaEnvioCorreo(AAlbaran);
|
_AnadirMarcaEnvioCorreo(AAlbaran);
|
||||||
@ -1009,12 +1019,14 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function TAlbaranesProveedorController.EnviarEmailAlbaranes(
|
function TAlbaranesProveedorController.EnviarEmailAlbaranes(
|
||||||
AAlbaranes: IBizAlbaranProveedor): Boolean;
|
AAlbaranes: IBizAlbaranProveedor; const VerPrecios: Boolean;
|
||||||
|
const VerRefProveedor: Boolean): Boolean;
|
||||||
var
|
var
|
||||||
ADialog : IDialogListaAlbaranesProveedorEnvioEMail;
|
ADialog : IDialogListaAlbaranesProveedorEnvioEMail;
|
||||||
ARespuesta : Integer;
|
ARespuesta : Integer;
|
||||||
begin
|
begin
|
||||||
ADialog := NIL;
|
ADialog := NIL;
|
||||||
|
Result := False;
|
||||||
|
|
||||||
if not Assigned(AAlbaranes) then
|
if not Assigned(AAlbaranes) then
|
||||||
raise Exception.Create ('Albaranes no asignadas (EnviarAlbaranesPorEMail)');
|
raise Exception.Create ('Albaranes no asignadas (EnviarAlbaranesPorEMail)');
|
||||||
@ -1030,6 +1042,8 @@ begin
|
|||||||
begin
|
begin
|
||||||
try
|
try
|
||||||
ADialog.Albaranes := AAlbaranes;
|
ADialog.Albaranes := AAlbaranes;
|
||||||
|
ADialog.VerPrecios := VerPrecios;
|
||||||
|
ADialog.VerRefProveedor := VerRefProveedor;
|
||||||
ARespuesta := ADialog.ShowModal;
|
ARespuesta := ADialog.ShowModal;
|
||||||
Result := (ARespuesta = mrOK)
|
Result := (ARespuesta = mrOK)
|
||||||
finally
|
finally
|
||||||
@ -1281,8 +1295,6 @@ var
|
|||||||
AReportController : IAlbaranesProveedorReportController;
|
AReportController : IAlbaranesProveedorReportController;
|
||||||
ID_Albaranes: TIntegerList;
|
ID_Albaranes: TIntegerList;
|
||||||
begin
|
begin
|
||||||
Result := False;
|
|
||||||
|
|
||||||
AReportController := TAlbaranesProveedorReportController.Create;
|
AReportController := TAlbaranesProveedorReportController.Create;
|
||||||
ID_Albaranes := TIntegerList.Create;
|
ID_Albaranes := TIntegerList.Create;
|
||||||
|
|
||||||
@ -1375,7 +1387,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TAlbaranesProveedorController.GenerarEmailAlbaran(
|
procedure TAlbaranesProveedorController.GenerarEmailAlbaran(
|
||||||
AAlbaran: IBizAlbaranProveedor);
|
AAlbaran: IBizAlbaranProveedor; const VerPrecios: Boolean;
|
||||||
|
const VerRefProveedor: Boolean);
|
||||||
begin
|
begin
|
||||||
if not Assigned(AAlbaran) then
|
if not Assigned(AAlbaran) then
|
||||||
raise Exception.Create ('Albaranes no asignadas (GenerarEmailAlbaran)');
|
raise Exception.Create ('Albaranes no asignadas (GenerarEmailAlbaran)');
|
||||||
@ -1387,7 +1400,9 @@ begin
|
|||||||
try
|
try
|
||||||
RecuperarProveedor(AAlbaran);
|
RecuperarProveedor(AAlbaran);
|
||||||
RecuperarClienteFinal(AAlbaran);
|
RecuperarClienteFinal(AAlbaran);
|
||||||
EnviarAlbaranPorEMail(AAlbaran, False, AAlbaran.Proveedor.EMAIL_ADMINISTRACION);
|
EnviarAlbaranPorEMail(AAlbaran, False,
|
||||||
|
AAlbaran.Proveedor.EMAIL_ADMINISTRACION, '', '',
|
||||||
|
VerPrecios, VerRefProveedor);
|
||||||
finally
|
finally
|
||||||
HideHourglassCursor;
|
HideHourglassCursor;
|
||||||
end;
|
end;
|
||||||
|
|||||||
@ -16,15 +16,25 @@ type
|
|||||||
private
|
private
|
||||||
FAlbaranes : IBizAlbaranProveedor;
|
FAlbaranes : IBizAlbaranProveedor;
|
||||||
FController : IAlbaranesProveedorController;
|
FController : IAlbaranesProveedorController;
|
||||||
|
FVerPrecios : Boolean;
|
||||||
|
FVerRefProveedor : Boolean;
|
||||||
protected
|
protected
|
||||||
function GetAlbaranes: IBizAlbaranProveedor;
|
function GetAlbaranes: IBizAlbaranProveedor;
|
||||||
procedure SetAlbaranes(const Value: IBizAlbaranProveedor);
|
procedure SetAlbaranes(const Value: IBizAlbaranProveedor);
|
||||||
|
|
||||||
|
function GetVerPrecios: Boolean;
|
||||||
|
procedure SetVerPrecios(const Value: Boolean);
|
||||||
|
|
||||||
|
function GetVerRefProveedor: Boolean;
|
||||||
|
procedure SetVerRefProveedor(const Value: Boolean);
|
||||||
|
|
||||||
procedure RellenarLista;
|
procedure RellenarLista;
|
||||||
procedure BorrarLista;
|
procedure BorrarLista;
|
||||||
public
|
public
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
property Albaranes: IBizAlbaranProveedor read GetAlbaranes write SetAlbaranes;
|
property Albaranes: IBizAlbaranProveedor read GetAlbaranes write SetAlbaranes;
|
||||||
|
property VerPrecios: Boolean read GetVerPrecios write SetVerPrecios;
|
||||||
|
property VerRefProveedor: Boolean read GetVerRefProveedor write SetVerRefProveedor;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
@ -52,7 +62,9 @@ begin
|
|||||||
begin
|
begin
|
||||||
if not EsCadenaVacia(FAlbaranes.Proveedor.EMAIL_ADMINISTRACION) then
|
if not EsCadenaVacia(FAlbaranes.Proveedor.EMAIL_ADMINISTRACION) then
|
||||||
begin
|
begin
|
||||||
if FController.EnviarAlbaranPorEMail(FAlbaranes, True, FAlbaranes.Proveedor.EMAIL_ADMINISTRACION) then
|
if FController.EnviarAlbaranPorEMail(FAlbaranes, True,
|
||||||
|
FAlbaranes.Proveedor.EMAIL_ADMINISTRACION, '', '',
|
||||||
|
FVerPrecios, FVerRefProveedor) then
|
||||||
begin
|
begin
|
||||||
ListView1.Items[i].SubItems[2] := 'Correo generado';
|
ListView1.Items[i].SubItems[2] := 'Correo generado';
|
||||||
ModalResult := mrOk;
|
ModalResult := mrOk;
|
||||||
@ -100,6 +112,8 @@ begin
|
|||||||
inherited;
|
inherited;
|
||||||
ModalResult := mrCancel;
|
ModalResult := mrCancel;
|
||||||
FController := TAlbaranesProveedorController.Create;
|
FController := TAlbaranesProveedorController.Create;
|
||||||
|
FVerPrecios := True;
|
||||||
|
FVerRefProveedor := True;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TfDialogListaAlbaranesProveedorEnvioEMail.GetAlbaranes: IBizAlbaranProveedor;
|
function TfDialogListaAlbaranesProveedorEnvioEMail.GetAlbaranes: IBizAlbaranProveedor;
|
||||||
@ -107,6 +121,16 @@ begin
|
|||||||
Result := FAlbaranes;
|
Result := FAlbaranes;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TfDialogListaAlbaranesProveedorEnvioEMail.GetVerPrecios: Boolean;
|
||||||
|
begin
|
||||||
|
Result := FVerPrecios;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TfDialogListaAlbaranesProveedorEnvioEMail.GetVerRefProveedor: Boolean;
|
||||||
|
begin
|
||||||
|
Result := FVerRefProveedor;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TfDialogListaAlbaranesProveedorEnvioEMail.RellenarLista;
|
procedure TfDialogListaAlbaranesProveedorEnvioEMail.RellenarLista;
|
||||||
var
|
var
|
||||||
i : Integer;
|
i : Integer;
|
||||||
@ -163,4 +187,16 @@ begin
|
|||||||
BorrarLista;
|
BorrarLista;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TfDialogListaAlbaranesProveedorEnvioEMail.SetVerPrecios(
|
||||||
|
const Value: Boolean);
|
||||||
|
begin
|
||||||
|
FVerPrecios := Value;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TfDialogListaAlbaranesProveedorEnvioEMail.SetVerRefProveedor(
|
||||||
|
const Value: Boolean);
|
||||||
|
begin
|
||||||
|
FVerRefProveedor := Value;
|
||||||
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|||||||
@ -97,21 +97,29 @@ end;
|
|||||||
procedure TfEditorAlbaranesProveedor.actEnviarEMailExecute(Sender: TObject);
|
procedure TfEditorAlbaranesProveedor.actEnviarEMailExecute(Sender: TObject);
|
||||||
var
|
var
|
||||||
AAlbaranes : IBizAlbaranProveedor;
|
AAlbaranes : IBizAlbaranProveedor;
|
||||||
|
FImprimirPrecios : Boolean;
|
||||||
|
FImprimirRefProveedor : Boolean;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
|
FImprimirPrecios := True;
|
||||||
|
FImprimirRefProveedor := True;
|
||||||
|
|
||||||
if ViewGrid.NumSeleccionados = 1 then
|
if ViewGrid.NumSeleccionados = 1 then begin
|
||||||
FController.GenerarEmailAlbaran(FAlbaranes)
|
if ElegirOpcionesImpresionAlbaranProveedor(FImprimirPrecios, FImprimirRefProveedor) then
|
||||||
|
FController.GenerarEmailAlbaran(FAlbaranes, FImprimirPrecios, FImprimirRefProveedor)
|
||||||
|
end
|
||||||
else begin
|
else begin
|
||||||
ShowHourglassCursor;
|
ShowHourglassCursor;
|
||||||
try
|
try
|
||||||
SeleccionarFilasDesdeGrid(ViewGrid._FocusedView, (Albaranes as ISeleccionable).SelectedRecords);
|
SeleccionarFilasDesdeGrid(ViewGrid._FocusedView, (Albaranes as ISeleccionable).SelectedRecords);
|
||||||
AAlbaranes := (Controller as IAlbaranesProveedorController).ExtraerSeleccionados(Albaranes) as IBizAlbaranProveedor;
|
AAlbaranes := (Controller as IAlbaranesProveedorController).ExtraerSeleccionados(Albaranes) as IBizAlbaranProveedor;
|
||||||
|
|
||||||
if Assigned(AAlbaranes) then
|
if Assigned(AAlbaranes) then begin
|
||||||
if FController.EnviarEmailAlbaranes(AAlbaranes) then
|
if ElegirOpcionesImpresionAlbaranProveedor(FImprimirPrecios, FImprimirRefProveedor) then
|
||||||
|
if FController.EnviarEmailAlbaranes(AAlbaranes, FImprimirPrecios, FImprimirRefProveedor) then
|
||||||
RefrescarInterno;
|
RefrescarInterno;
|
||||||
|
end;
|
||||||
finally
|
finally
|
||||||
AAlbaranes := NIL;
|
AAlbaranes := NIL;
|
||||||
HideHourglassCursor;
|
HideHourglassCursor;
|
||||||
|
|||||||
Reference in New Issue
Block a user