diff --git a/Source/Informes/6/InfPresupuestoCliente.fr3 b/Source/Informes/6/InfPresupuestoCliente.fr3 index 651ba35..6124b16 100644 --- a/Source/Informes/6/InfPresupuestoCliente.fr3 +++ b/Source/Informes/6/InfPresupuestoCliente.fr3 @@ -1,8 +1,8 @@ - + - + @@ -11,7 +11,7 @@ - + @@ -20,37 +20,39 @@ - - - - - - - - + + + + + + + + - - + + - - - - - - - - - - - - + + + + + + + + + + + + + + - + diff --git a/Source/Modulos/Presupuestos de cliente/Controller/uPresupuestosClienteController.pas b/Source/Modulos/Presupuestos de cliente/Controller/uPresupuestosClienteController.pas index 11c0683..291f6c4 100644 --- a/Source/Modulos/Presupuestos de cliente/Controller/uPresupuestosClienteController.pas +++ b/Source/Modulos/Presupuestos de cliente/Controller/uPresupuestosClienteController.pas @@ -76,6 +76,9 @@ type end; TPresupuestosClienteController = class(TControllerBase, IPresupuestosClienteController) + private + procedure _AnadirMarcaEnvioCorreo(APresupuesto: IBizPresupuestoCliente); + protected FDataModule : IDataModulePresupuestosCliente; FClienteController : IClientesController; @@ -162,7 +165,7 @@ type implementation uses - Controls, cxControls, DB, uEditorRegistryUtils, uEditorPreview, DateUtils, + Forms, Controls, cxControls, DB, uEditorRegistryUtils, uEditorPreview, DateUtils, uIEditorPresupuestosCliente, uDataModulePresupuestosCliente, Variants, uBizContactos, uDataTableUtils, uDataModuleUsuarios, uFactuGES_App, schPresupuestosClienteClient_Intf, uDAInterfaces, uDateUtils, uIEditorPresupuestoCliente, @@ -602,6 +605,39 @@ begin end; end; +procedure TPresupuestosClienteController._AnadirMarcaEnvioCorreo( + APresupuesto: IBizPresupuestoCliente); +var + ASoloLectura : Boolean; +begin + if not Assigned(APresupuesto) then + raise Exception.Create ('Presupuesto no asignado (_AnadirMarcaEnvioCorreo)'); + + if APresupuesto.DataTable.Active then + APresupuesto.DataTable.Active := True; + +// if AnadirMarcaEnvioCorreo(nme_PresupuestosCliente, APresupuesto.ID) then +// begin + DesconectarTabla(APresupuesto.DataTable); + try + ASoloLectura := APresupuesto.DataTable.ReadOnly; + if ASoloLectura then + SetDataTableReadOnly(APresupuesto.DataTable, False); + try + APresupuesto.Edit; +// APresupuesto.NUM_CORREOS := APresupuesto.NUM_CORREOS + 1; + APresupuesto.Post; + finally + if ASoloLectura then + SetDataTableReadOnly(APresupuesto.DataTable, True); + end; + finally + ConectarTabla(APresupuesto.DataTable); + end; +// end; + +end; + function TPresupuestosClienteController._Vacio: IBizPresupuestoCliente; begin Result := Buscar(ID_NULO); @@ -745,6 +781,7 @@ var AReportController : IPresupuestosClienteReportController; AFicheroTMP : TFileName; AEMail : String; + AAsunto: String; AListaEmail : TStringList; begin if not Assigned(APresupuesto) then @@ -763,10 +800,8 @@ begin else begin AListaEmail := TStringList.Create; try - if not APresupuesto.Cliente.EMAIL_1IsNull then - AListaEmail.Add(APresupuesto.Cliente.EMAIL_1) - else if not APresupuesto.Cliente.EMAIL_2IsNull then - AListaEmail.Add(APresupuesto.Cliente.EMAIL_2); + if not EsCadenaVacia(APresupuesto.Cliente.EMAIL_ADMINISTRACION) then + AListaEmail.Add(APresupuesto.Cliente.EMAIL_ADMINISTRACION); if not ElegirEMail(AListaEmail, AEMail) then Exit; @@ -775,15 +810,25 @@ begin end; end; + if not EsCadenaVacia(AAsuntoEMail) then + AAsunto := AAsuntoEMail + else + AAsunto := 'Pedido ' + APresupuesto.REFERENCIA; + ShowHourglassCursor; + Application.ProcessMessages; + AReportController := TPresupuestosClienteReportController.Create; try AReportController.ExportToPDF(APresupuesto.ID, AFicheroTMP); - Result := EnviarEMailMAPI('Presupuesto ' + APresupuesto.REFERENCIA, '', AFicheroTMP, '', '', APresupuesto.Cliente.NOMBRE, AEMail, AEnviarDirectamente); + Result := EnviarEMailMAPI(AAsunto, ATextoEMail, AFicheroTMP, '', '', APresupuesto.Cliente.NOMBRE, AEMail, AEnviarDirectamente); +// if Result then +// _AnadirMarcaEnvioCorreo(APresupuesto); finally - DeleteFile(AFicheroTMP); + SysUtils.DeleteFile(AFicheroTMP); AReportController := NIL; HideHourglassCursor; + Application.ProcessMessages; end; end; @@ -1186,7 +1231,7 @@ begin ShowHourglassCursor; try RecuperarCliente(APresupuesto); - EnviarPresupuestoPorEMail(APresupuesto); + EnviarPresupuestoPorEMail(APresupuesto, False, APresupuesto.Cliente.EMAIL_ADMINISTRACION); finally HideHourglassCursor; end; diff --git a/Source/Modulos/Presupuestos de cliente/Views/uEditorPresupuestosCliente.pas b/Source/Modulos/Presupuestos de cliente/Views/uEditorPresupuestosCliente.pas index 9ba5cc7..2b4501c 100644 --- a/Source/Modulos/Presupuestos de cliente/Views/uEditorPresupuestosCliente.pas +++ b/Source/Modulos/Presupuestos de cliente/Views/uEditorPresupuestosCliente.pas @@ -235,7 +235,7 @@ begin inherited; if ViewGrid.NumSeleccionados = 1 then - FController.EnviarPresupuestoPorEMail(FPresupuestos) + FController.GenerarEmailPresupuesto(FPresupuestos) else begin // ShowHourglassCursor; try