diff --git a/Source/Base/Base.dproj b/Source/Base/Base.dproj index 5f786a82..98f8938c 100644 --- a/Source/Base/Base.dproj +++ b/Source/Base/Base.dproj @@ -53,56 +53,56 @@ MainSource - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
fConfigurarConexion
@@ -127,10 +127,53 @@
dmBase
TDataModule
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -146,486 +189,3 @@ - diff --git a/Source/Base/Utiles/uSistemaFunc.pas b/Source/Base/Utiles/uSistemaFunc.pas index f47dc7de..27d0474e 100644 --- a/Source/Base/Utiles/uSistemaFunc.pas +++ b/Source/Base/Utiles/uSistemaFunc.pas @@ -32,7 +32,7 @@ function DarFicheroTemporal : String; function DarFicheroJPGTemporal : String; function DarFicheroBMPTemporal : String; function DarFicheroTIFFTemporal : String; -function DarFicheroExportar (var Fichero : String) : Boolean; +function DarFicheroWordExportar (var Fichero : String) : Boolean; function DarVersionFichero (Executable : String) : String; function DarFechaFichero (Executable : String) : String; procedure CopiarFichero(const Origen, Destino: string); @@ -127,7 +127,7 @@ begin Result := Copy(Cadena, 0, (Length(Cadena)-3)) + 'jpg'; end; -function DarFicheroExportar (var Fichero : String) : Boolean; +function DarFicheroWordExportar (var Fichero : String) : Boolean; var DialogoSalvar : TSaveDialog; begin diff --git a/Source/Base/Utiles/uStringsUtils.pas b/Source/Base/Utiles/uStringsUtils.pas index 5c43b4da..1d85dea2 100644 --- a/Source/Base/Utiles/uStringsUtils.pas +++ b/Source/Base/Utiles/uStringsUtils.pas @@ -7,10 +7,16 @@ uses procedure StringToStrings(Source:string; Delimiter:char; Target:TStrings); function StringsToString(Source:TStrings; Delimiter:char):string; +function EsCadenaVacia(const S: AnsiString): Boolean; overload; +function EsCadenaVacia(const S: Variant): Boolean; overload; +function EsNumerico(Cadena: String) : Boolean; implementation +uses + Variants, SysUtils; + { Convierte una cadena con items separados con un delimitador en un TString } procedure StringToStrings(Source:string; Delimiter:char; Target:TStrings); var i: integer; @@ -30,4 +36,27 @@ begin if Result<>'' then Delete(Result, 1, 1) end; +function EsCadenaVacia(const S: AnsiString): Boolean; +begin + Result := (Length(Trim(S)) = 0) +end; + +function EsCadenaVacia(const S: Variant): Boolean; overload; +begin + Result := True; + if VarIsNull(S) then + Exit; + Result := EsCadenaVacia(VarToStr(S)); +end; + +function EsNumerico(Cadena: String) : Boolean; +var + Codigo: Integer; + Valor: Double; +begin + Val(Cadena, Valor, Codigo); + Result := (Codigo = 0) +end; + + end. diff --git a/Source/GUIBase/GUIBase.dproj b/Source/GUIBase/GUIBase.dproj index 429c936b..37767160 100644 --- a/Source/GUIBase/GUIBase.dproj +++ b/Source/GUIBase/GUIBase.dproj @@ -58,22 +58,22 @@ MainSource - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + +
fDialogBase
diff --git a/Source/GUIBase/uEditorPreview.dfm b/Source/GUIBase/uEditorPreview.dfm index e0f99664..04f85244 100644 --- a/Source/GUIBase/uEditorPreview.dfm +++ b/Source/GUIBase/uEditorPreview.dfm @@ -6,7 +6,7 @@ inherited fEditorPreview: TfEditorPreview OnDestroy = FormDestroy OnResize = FormResize ExplicitWidth = 803 - ExplicitHeight = 492 + ExplicitHeight = 485 PixelsPerInch = 96 TextHeight = 13 inherited JvNavPanelHeader: TJvNavPanelHeader diff --git a/Source/GUIBase/uEditorPreview.pas b/Source/GUIBase/uEditorPreview.pas index 820406e4..aa78b189 100644 --- a/Source/GUIBase/uEditorPreview.pas +++ b/Source/GUIBase/uEditorPreview.pas @@ -11,7 +11,7 @@ uses pngimage, frxExportImage, frxExportPDF, frxDCtrl, frxDMPExport, frxGradient, frxChBox, frxCross, frxRich, frxOLE, frxBarcode, ExtCtrls, JvComponentBase, TBXStatusBars, JvExComCtrls, JvStatusBar, - frxExportMail, frxExportXLS, frxExportText, frxExportRTF; + frxExportMail, frxExportXLS, frxExportText, frxExportRTF, uControllerBase; type IEditorPreview = interface(IEditorBase) @@ -28,6 +28,15 @@ type procedure Print; procedure Preview; + function GetController : IControllerBase; + procedure SetController (const Value : IControllerBase); + property Controller : IControllerBase read GetController + write SetController; + + function GetListaID : String; + procedure SetListaID (const Value : String); + property ListaID : String read GetListaID + write SetListaID; end; TfEditorPreview = class(TfEditorBase, IEditorPreview) @@ -133,14 +142,26 @@ type procedure actExportarTextoExecute(Sender: TObject); private FPreview : TfrViewPreview; + FTitle : TCaption; + FController : IControllerBase; + FListaID : String; procedure OnPageChanged(Sender: TfrxPreview; PageNo: Integer); procedure UpdateZoom; protected function GetReport: TfrxReport; virtual; procedure SetTitle(const Value: string); function GetTitle: string; + procedure PonerTitulos(const ATitulo: String = ''); override; + function GetController : IControllerBase; + procedure SetController (const Value : IControllerBase); + procedure SetListaID (const Value : String); + function GetListaID : String; public constructor Create(AOwner: TComponent); override; + property ListaID : String read GetListaID + write SetListaID; + property Controller : IControllerBase read GetController + write SetController; property Title: string read GetTitle write SetTitle; property Report: TfrxReport read GetReport; procedure Print; @@ -160,6 +181,16 @@ uses { TfEditorBase1 } +function TfEditorPreview.GetController: IControllerBase; +begin + Result := FController; +end; + +function TfEditorPreview.GetListaID: String; +begin + Result := FListaID; +end; + function TfEditorPreview.GetReport: TfrxReport; begin Result := frxReport1; @@ -168,7 +199,7 @@ end; function TfEditorPreview.GetTitle: string; begin - Result := Self.Caption; + Result := FTitle; end; procedure TfEditorPreview.FormShow(Sender: TObject); @@ -389,6 +420,21 @@ begin FPreview.Preview.OnPageChanged := OnPageChanged; end; +procedure TfEditorPreview.PonerTitulos(const ATitulo: String); +var + AText : String; +begin + AText := 'Previsualizar'; + + if (Length(ATitulo) > 0) then + AText := AText + ' - ' + ATitulo + else + AText := AText + ' - ' + FTitle; + + JvNavPanelHeader.Caption := AText; + Caption := AText; +end; + procedure TfEditorPreview.Preview; begin Self.ShowModal; @@ -403,9 +449,20 @@ begin Enabled := True; end; +procedure TfEditorPreview.SetController(const Value: IControllerBase); +begin + FController := Value; +end; + +procedure TfEditorPreview.SetListaID(const Value: String); +begin + FListaID := Value; +end; + procedure TfEditorPreview.SetTitle(const Value: string); begin - Self.Caption := 'Previsualizar - ' + Value; + FTitle := Value; + PonerTitulos(FTitle); end; function TfEditorPreview.ExportToFile: String; diff --git a/Source/Informes/Presupuesto.rdx b/Source/Informes/Presupuesto.rdx new file mode 100644 index 00000000..1671401f Binary files /dev/null and b/Source/Informes/Presupuesto.rdx differ diff --git a/Source/Modulos/Presupuestos de cliente/Controller/uPresupuestosClienteController.pas b/Source/Modulos/Presupuestos de cliente/Controller/uPresupuestosClienteController.pas index 94a94798..1b222b52 100644 --- a/Source/Modulos/Presupuestos de cliente/Controller/uPresupuestosClienteController.pas +++ b/Source/Modulos/Presupuestos de cliente/Controller/uPresupuestosClienteController.pas @@ -770,13 +770,12 @@ procedure TPresupuestosClienteController.Print(APresupuesto: IBizPresupuestoClie var AReportController : IPresupuestosClienteReportController; ID_Presupuestos: TStringList; - begin AReportController := TPresupuestosClienteReportController.Create; try ID_Presupuestos := TStringList.Create; - //Si deseamos previsualizar todos los items del objeto presupuesto + //Si deseamos imprimimos todos los items del objeto presupuesto if AllItems then begin with APresupuesto.DataTable do @@ -789,7 +788,7 @@ begin end; end; end - //Solo previsualizamos el item seleccionado + //Solo imprimimos el item seleccionado else ID_Presupuestos.Add(IntToStr(APresupuesto.ID)); diff --git a/Source/Modulos/Presupuestos de cliente/Controller/uPresupuestosClienteReportController.pas b/Source/Modulos/Presupuestos de cliente/Controller/uPresupuestosClienteReportController.pas index 2bd7b616..146640a3 100644 --- a/Source/Modulos/Presupuestos de cliente/Controller/uPresupuestosClienteReportController.pas +++ b/Source/Modulos/Presupuestos de cliente/Controller/uPresupuestosClienteReportController.pas @@ -8,13 +8,14 @@ uses uBizPresupuestosCliente; type - IPresupuestosClienteReportController = interface + IPresupuestosClienteReportController = interface(IControllerBase) ['{D0686358-251C-43C4-9927-6112F2F4D3B8}'] - procedure Preview(const AID : String); - procedure Print(const AID : String); + procedure Preview(const AListaID : String); + procedure Print(const AListaID : String); + function ExportToWord(const AID: Integer; const AFileName : String = ''): Boolean; end; - TPresupuestosClienteReportController = class(TInterfacedObject, IPresupuestosClienteReportController) + TPresupuestosClienteReportController = class(TControllerBase, IPresupuestosClienteReportController) private FDataModule : IDataModulePresupuestosClienteReport; function CreateEditor(const AName: String; const IID: TGUID; out Intf): Boolean; @@ -22,8 +23,9 @@ type constructor Create; destructor Destroy; override; - procedure Preview(const AID : String); - procedure Print(const AID : String); + procedure Preview(const AListaID : String); + procedure Print(const AListaID : String); + function ExportToWord(const AID: Integer; const AFileName : String = ''): Boolean; end; @@ -32,7 +34,7 @@ implementation uses uROTypes, uEditorRegistryUtils, uIEditorPresupuestosClientePreview, uEditorPreview, uDataModulePresupuestosCliente, uEditorBase, - cxControls, uFactuGES_App; + cxControls, uFactuGES_App, uStringsUtils, uSistemaFunc; { TPresupuestosClienteReportController } @@ -54,7 +56,30 @@ begin inherited; end; -procedure TPresupuestosClienteReportController.Preview(const AID : String); +function TPresupuestosClienteReportController.ExportToWord(const AID: Integer; const AFileName : String) : Boolean; +var + AStream: Binary; + AFile : String; +begin + AFile := AFileName; + if EsCadenaVacia(AFile) and (not DarFicheroWordExportar(AFile)) then + Exit; + + ShowHourglassCursor; + try + AStream := FDataModule.GetRptWordPresupuesto(AID); + try + AStream.SaveToFile(AFile); + Result := True; + finally + FreeAndNil(AStream); + end; + finally + HideHourglassCursor; + end; +end; + +procedure TPresupuestosClienteReportController.Preview(const AListaID : String); var AStream: Binary; AEditor : IEditorPresupuestosClientePreview; @@ -62,12 +87,14 @@ begin AEditor := NIL; ShowHourglassCursor; try - AStream := FDataModule.GetReport(AID); + AStream := FDataModule.GetRptPresupuestos(AListaID); try CreateEditor('EditorPresupuestosClientePreview', IEditorPresupuestosClientePreview, AEditor); if Assigned(AEditor) then with AEditor do begin + AEditor.Controller := Self; + AEditor.ListaID := AListaID; Title := 'Presupuesto - ' + AppFactuGES.EmpresaActiva.NOMBRE; LoadFromStream(AStream); Preview; @@ -82,7 +109,7 @@ begin end; end; -procedure TPresupuestosClienteReportController.Print(const AID : String); +procedure TPresupuestosClienteReportController.Print(const AListaID : String); var AStream: Binary; AEditor : IEditorPresupuestosClientePreview; @@ -90,12 +117,14 @@ begin AEditor := NIL; ShowHourglassCursor; try - AStream := FDataModule.GetReport(AID); + AStream := FDataModule.GetRptPresupuestos(AListaID); try CreateEditor('EditorPresupuestosClientePreview', IEditorPresupuestosClientePreview, AEditor); if Assigned(AEditor) then with AEditor do begin + AEditor.Controller := Self; + AEditor.ListaID := AListaID; AEditor.LoadFromStream(AStream); AEditor.Print; AEditor.Release; diff --git a/Source/Modulos/Presupuestos de cliente/Data/uDataModulePresupuestosCliente.pas b/Source/Modulos/Presupuestos de cliente/Data/uDataModulePresupuestosCliente.pas index c2ed51d7..6bc09887 100644 --- a/Source/Modulos/Presupuestos de cliente/Data/uDataModulePresupuestosCliente.pas +++ b/Source/Modulos/Presupuestos de cliente/Data/uDataModulePresupuestosCliente.pas @@ -36,7 +36,8 @@ type function NewItem : IBizPresupuestoCliente; // Report - function GetReport(const AID: String): Binary; + function GetRptPresupuestos(const AListaID: String): Binary; + function GetRptWordPresupuesto(const AID: Integer): Binary; end; implementation @@ -60,9 +61,15 @@ begin RORemoteService.Message := dmConexion.Message; end; -function TDataModulePresupuestosCliente.GetReport(const AID: String): Binary; +function TDataModulePresupuestosCliente.GetRptPresupuestos(const AListaID: String): Binary; begin - Result := (RORemoteService as IsrvPresupuestosCliente).GenerateReport(AID) + Result := (RORemoteService as IsrvPresupuestosCliente).GenerateReport(AListaID) +end; + +function TDataModulePresupuestosCliente.GetRptWordPresupuesto( + const AID: Integer): Binary; +begin + Result := (RORemoteService as IsrvPresupuestosCliente).GenerateReportEnWord(AID) end; function TDataModulePresupuestosCliente.NewItem: IBizPresupuestoCliente; diff --git a/Source/Modulos/Presupuestos de cliente/Model/Data/uIDataModulePresupuestosClienteReport.pas b/Source/Modulos/Presupuestos de cliente/Model/Data/uIDataModulePresupuestosClienteReport.pas index be44e84f..a814b567 100644 --- a/Source/Modulos/Presupuestos de cliente/Model/Data/uIDataModulePresupuestosClienteReport.pas +++ b/Source/Modulos/Presupuestos de cliente/Model/Data/uIDataModulePresupuestosClienteReport.pas @@ -8,7 +8,8 @@ uses type IDataModulePresupuestosClienteReport = interface ['{70CEBB06-376F-4363-B80F-DDA4324E0F85}'] - function GetReport(const AID: String): Binary; + function GetRptPresupuestos(const AListaID: String): Binary; + function GetRptWordPresupuesto(const AID: Integer): Binary; end; implementation diff --git a/Source/Modulos/Presupuestos de cliente/Plugin/PresupuestosCliente_plugin.dpk b/Source/Modulos/Presupuestos de cliente/Plugin/PresupuestosCliente_plugin.dpk index 36aff96e..a4e3f8e3 100644 --- a/Source/Modulos/Presupuestos de cliente/Plugin/PresupuestosCliente_plugin.dpk +++ b/Source/Modulos/Presupuestos de cliente/Plugin/PresupuestosCliente_plugin.dpk @@ -25,9 +25,12 @@ package PresupuestosCliente_plugin; {$IMPLICITBUILD ON} requires - PluginSDK_D10R, - PresupuestosCliente_controller, - PresupuestosCliente_view; + Base, + GUIBase, + ApplicationBase, + Contactos_view, + Articulos_view, + PresupuestosCliente_controller; contains uPluginPresupuestosCliente in 'uPluginPresupuestosCliente.pas' {PluginPresupuestosCliente}; diff --git a/Source/Modulos/Presupuestos de cliente/Plugin/PresupuestosCliente_plugin.dproj b/Source/Modulos/Presupuestos de cliente/Plugin/PresupuestosCliente_plugin.dproj index c8bc7728..9cf6d44a 100644 --- a/Source/Modulos/Presupuestos de cliente/Plugin/PresupuestosCliente_plugin.dproj +++ b/Source/Modulos/Presupuestos de cliente/Plugin/PresupuestosCliente_plugin.dproj @@ -42,8 +42,32 @@ Package FalseTrueFalseTrueFalseFalseTrueFalse1000FalseFalseFalseFalseFalse308212521.0.0.01.0.0.0 - RemObjects Pascal Script - RemObjects SDK 3.0 Integration - EurekaLog 5.1.9 + + + + + + + + + + + + + + + + + + + + + + + + + Microsoft Office 2000 Sample Automation Server Wrapper Components + Microsoft Office XP Sample Automation Server Wrapper Components PresupuestosCliente_plugin.dpk @@ -51,9 +75,29 @@ MainSource - - - + + + + + + + + + + + + + + + + + + + + + + +
PluginPresupuestosCliente
@@ -61,7 +105,7 @@