From f65df6dd9fe7b2fbff9628a103df442001159d43 Mon Sep 17 00:00:00 2001 From: roberto Date: Wed, 28 Jan 2009 10:45:04 +0000 Subject: [PATCH] Informes de recibos de cliente adaptada la cabecera a los parametros git-svn-id: https://192.168.0.254/svn/Proyectos.Tecsitel_FactuGES2/trunk@893 0c75b7a4-871f-7646-8a2f-f78d34cc349f --- Source/Base/Base.dproj | 102 +++++------ .../1/InformeListadoRecibosCliPendientes.fr3 | 10 +- ...eListadoRecibosCliPendientesDesglosado.fr3 | 10 +- .../1/InformeListadoRecibosCliente.fr3 | 10 +- ...InformeListadoRecibosClienteDesglosado.fr3 | 10 +- .../2/InformeListadoRecibosCliPendientes.fr3 | 12 +- ...eListadoRecibosCliPendientesDesglosado.fr3 | 14 +- .../2/InformeListadoRecibosCliente.fr3 | 20 +- ...InformeListadoRecibosClienteDesglosado.fr3 | 20 +- .../Reports/uRptFacturasCliente_Server.dfm | 30 +-- .../Reports/uRptFacturasCliente_Server.pas | 3 - .../Reports/uRptRecibosCliente_Server.pas | 171 ++++++++++++++++-- Source/Servidor/FactuGES_Server.RES | Bin 23204 -> 23208 bytes Source/Servidor/FactuGES_Server.rc | 2 +- 14 files changed, 261 insertions(+), 153 deletions(-) diff --git a/Source/Base/Base.dproj b/Source/Base/Base.dproj index b7d219a9..33f14f33 100644 --- a/Source/Base/Base.dproj +++ b/Source/Base/Base.dproj @@ -54,58 +54,58 @@ MainSource + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
fConfigurarConexion
TForm diff --git a/Source/Informes/1/InformeListadoRecibosCliPendientes.fr3 b/Source/Informes/1/InformeListadoRecibosCliPendientes.fr3 index 08c555fa..e474289d 100644 --- a/Source/Informes/1/InformeListadoRecibosCliPendientes.fr3 +++ b/Source/Informes/1/InformeListadoRecibosCliPendientes.fr3 @@ -1,16 +1,14 @@ - + - + - - - + + - diff --git a/Source/Informes/1/InformeListadoRecibosCliPendientesDesglosado.fr3 b/Source/Informes/1/InformeListadoRecibosCliPendientesDesglosado.fr3 index e3de14c6..78b8dd04 100644 --- a/Source/Informes/1/InformeListadoRecibosCliPendientesDesglosado.fr3 +++ b/Source/Informes/1/InformeListadoRecibosCliPendientesDesglosado.fr3 @@ -1,16 +1,14 @@ - + - + - - - + + - diff --git a/Source/Informes/1/InformeListadoRecibosCliente.fr3 b/Source/Informes/1/InformeListadoRecibosCliente.fr3 index 73002c12..47ddd657 100644 --- a/Source/Informes/1/InformeListadoRecibosCliente.fr3 +++ b/Source/Informes/1/InformeListadoRecibosCliente.fr3 @@ -1,16 +1,14 @@ - + - + - - - + + - diff --git a/Source/Informes/1/InformeListadoRecibosClienteDesglosado.fr3 b/Source/Informes/1/InformeListadoRecibosClienteDesglosado.fr3 index c1cd568e..3b7324a8 100644 --- a/Source/Informes/1/InformeListadoRecibosClienteDesglosado.fr3 +++ b/Source/Informes/1/InformeListadoRecibosClienteDesglosado.fr3 @@ -1,16 +1,14 @@ - + - + - - - + + - diff --git a/Source/Informes/2/InformeListadoRecibosCliPendientes.fr3 b/Source/Informes/2/InformeListadoRecibosCliPendientes.fr3 index 40a3c1fb..191ae4bf 100644 --- a/Source/Informes/2/InformeListadoRecibosCliPendientes.fr3 +++ b/Source/Informes/2/InformeListadoRecibosCliPendientes.fr3 @@ -1,16 +1,14 @@ - + - + - - - + + - @@ -45,7 +43,7 @@ - + diff --git a/Source/Informes/2/InformeListadoRecibosCliPendientesDesglosado.fr3 b/Source/Informes/2/InformeListadoRecibosCliPendientesDesglosado.fr3 index 768bdbd1..bd598f6d 100644 --- a/Source/Informes/2/InformeListadoRecibosCliPendientesDesglosado.fr3 +++ b/Source/Informes/2/InformeListadoRecibosCliPendientesDesglosado.fr3 @@ -1,16 +1,14 @@ - + - + - - - + + - @@ -25,7 +23,7 @@ - + @@ -45,7 +43,7 @@ - + diff --git a/Source/Informes/2/InformeListadoRecibosCliente.fr3 b/Source/Informes/2/InformeListadoRecibosCliente.fr3 index a9de0e78..e11ffdac 100644 --- a/Source/Informes/2/InformeListadoRecibosCliente.fr3 +++ b/Source/Informes/2/InformeListadoRecibosCliente.fr3 @@ -1,16 +1,14 @@ - + - + - - - + + - @@ -19,16 +17,16 @@ - + - + - + - + @@ -46,7 +44,7 @@ - + diff --git a/Source/Informes/2/InformeListadoRecibosClienteDesglosado.fr3 b/Source/Informes/2/InformeListadoRecibosClienteDesglosado.fr3 index f6615c38..bc4c2877 100644 --- a/Source/Informes/2/InformeListadoRecibosClienteDesglosado.fr3 +++ b/Source/Informes/2/InformeListadoRecibosClienteDesglosado.fr3 @@ -1,16 +1,14 @@ - + - + - - - + + - @@ -20,16 +18,16 @@ - + - + - + - + @@ -46,7 +44,7 @@ - + diff --git a/Source/Modulos/Facturas de cliente/Reports/uRptFacturasCliente_Server.dfm b/Source/Modulos/Facturas de cliente/Reports/uRptFacturasCliente_Server.dfm index 10402e12..95343fd7 100644 --- a/Source/Modulos/Facturas de cliente/Reports/uRptFacturasCliente_Server.dfm +++ b/Source/Modulos/Facturas de cliente/Reports/uRptFacturasCliente_Server.dfm @@ -1693,42 +1693,20 @@ object RptFacturasCliente: TRptFacturasCliente PrintOptions.Printer = 'Por defecto' PrintOptions.PrintOnSheet = 0 ReportOptions.CreateDate = 37800.807714351900000000 - ReportOptions.LastChange = 39836.552824236110000000 + ReportOptions.LastChange = 39840.805247928200000000 ScriptLanguage = 'PascalScript' ScriptText.Strings = ( - 'procedure frxReportOnStartReport(Sender: TfrxComponent);' - 'begin' - ' Set('#39'Pagina'#39', 0);' - ' Set('#39'TotalPaginas'#39', 0); ' - 'end;' - '' - 'procedure Band1OnBeforePrint(Sender: TfrxComponent);' - 'begin' - ' if not Engine.FinalPass then' - ' Set('#39'TotalPaginas'#39', ( + 1));' - '' - ' if Engine.FinalPass then' - ' Set('#39'Pagina'#39', ( + 1)); ' - 'end;' - '' 'procedure mContinuaOnBeforePrint(Sender: TfrxComponent);' 'begin' ' if Engine.FinalPass then' ' begin' - - ' //A la vez que salta este salta la asignacion de pagina por ' + - 'lo que no coincide nunca si no suponemos +1 ' + - ' ' + - ' ' + - ' ' + - ' ' - ' if (( + 1) = ) then' + ' if ( = ) then' ' begin ' - ' mContinua.Visible := True;' + ' mContinua.Visible := False;' ' end ' ' else' ' begin ' - ' mContinua.Visible := False;' + ' mContinua.Visible := True;' ' end ' ' end; ' 'end;' diff --git a/Source/Modulos/Facturas de cliente/Reports/uRptFacturasCliente_Server.pas b/Source/Modulos/Facturas de cliente/Reports/uRptFacturasCliente_Server.pas index 61700705..e6547622 100644 --- a/Source/Modulos/Facturas de cliente/Reports/uRptFacturasCliente_Server.pas +++ b/Source/Modulos/Facturas de cliente/Reports/uRptFacturasCliente_Server.pas @@ -334,9 +334,6 @@ begin FFechaVenInicio := FechaVenInicio; FFechaVenFin := FechaVenFin; FImporteMinimo := ImporteMinimo; - - if Assigned(FListaIDClientes) then - FListaIDClientes.Free; FListaIDClientes := ListaIDClientes; //Se prepara la tabla del listado general del informe diff --git a/Source/Modulos/Recibos de cliente/Reports/uRptRecibosCliente_Server.pas b/Source/Modulos/Recibos de cliente/Reports/uRptRecibosCliente_Server.pas index b15e1867..7fed244d 100644 --- a/Source/Modulos/Recibos de cliente/Reports/uRptRecibosCliente_Server.pas +++ b/Source/Modulos/Recibos de cliente/Reports/uRptRecibosCliente_Server.pas @@ -41,6 +41,8 @@ type schReport: TDASchema; DataDictionary: TDADataDictionary; procedure DataModuleCreate(Sender: TObject); + procedure DataModuleDestroy(Sender: TObject); + private FConnection: IDAConnection; FIdEmpresa: Integer; @@ -49,13 +51,17 @@ type FFechaVenInicio: Variant; FFechaVenFin: Variant; FListaIDClientes: TIntegerArray; + FListaNombresClientes : TStringList; FImporteMinimo: Currency; + FDesglosado : Boolean; procedure _GenerarRecibo(const ID : Integer); procedure PrepararTablaInforme(ATabla: TDAMemDataTable); procedure PrepararTablaResumenInforme(ATabla: IDADataset); function _GenerarInforme(const TipoInforme: String): Binary; + procedure IniciarParametrosInforme; + procedure RecuperarNombresClientes; public function GenerarRecibo(const ListaID : TIntegerArray): Binary; @@ -69,7 +75,8 @@ implementation {$R *.dfm} uses - uSistemaFunc, StrUtils, uDataModuleServer, schRecibosClienteClient_Intf; + uSistemaFunc, StrUtils, uDataModuleServer, schRecibosClienteClient_Intf, + uROServer, DataAbstract4_Intf; const rptInforme = 'InfReciboCliente.fr3'; @@ -94,6 +101,8 @@ begin FConnection := dmServer.DarNuevaConexion; frxReport.EngineOptions.NewSilentMode := simReThrow; + FListaNombresClientes := TStringList.Create; + frxDBCabecera.DataSource := DADataCabecera; frxDBCompensados.DataSource := DADataCompensados; end; @@ -112,6 +121,56 @@ begin end; end; +procedure TRptRecibosCliente.IniciarParametrosInforme; +var + ATextos : TStringList; + ACadena : String; +begin + ATextos := TStringList.Create; + + try + if (not VarIsNull(FFechaInicio)) and (not VarIsNull(FFechaFin)) then + ACadena := Format('Fechas de factura desde el %s hasta el %s', [VarToStr(FFechaInicio), VarToStr(FFechaFin)]) + else + ACadena := 'Sin rango de fechas'; + ATextos.Add(ACadena); + ACadena := ''; + + // Filtrar el informe por fechas de vencimiento + if (not VarIsNull(FFechaVenInicio)) and (not VarIsNull(FFechaVenFin)) then + begin + ACadena := Format('Vencimientos desde el %s hasta el %s', [VarToStr(FFechaVenInicio), VarToStr(FFechaVenFin)]); + ATextos.Add(ACadena); + ACadena := ''; + end; + + if (FImporteMinimo > 0) then + begin + ACadena := Format('Facturas con importe superior a %m', [FImporteMinimo]); + ATextos.Add(ACadena); + ACadena := ''; + end; + + if Assigned(FListaIDClientes) and (FListaIDClientes.Count > 0) then + begin + RecuperarNombresClientes; + ACadena := FListaNombresClientes.Text; + end + else begin + ACadena := 'Todos los clientes'; + if FDesglosado then + ACadena := ACadena + ' (desglosados)' + end; + + ATextos.Add(ACadena); + ACadena := ''; + + frxReport.Variables.Variables['TextoParametros'] := ATextos.Text; + finally + FreeAndNil(ATextos); + end; +end; + procedure TRptRecibosCliente.PrepararTablaInforme(ATabla: TDAMemDataTable); var Condicion: TDAWhereExpression; @@ -243,6 +302,101 @@ begin ATabla.Where.AddText(AWhereStr); end; +procedure TRptRecibosCliente.RecuperarNombresClientes; +var + AContactosService : IsrvContactos; + Intf : IInterface; + AClientID : TGUID; + + ATableNameArray: StringArray; + ATableRequestInfoArray: TableRequestInfoArray; + ATableRequestInfo: TableRequestInfoV5; + AStream: TMemoryStream; + ADataTable: TDAMemDataTable; + i: Integer; + AWhereBuilder : TDAWhereBuilder; + ACondicion : TDAWhereExpression; +begin + CreateGUID(AClientID); + + GetClassFactory('srvContactos').CreateInstance(AClientID, Intf); + + if Assigned(Intf) then + begin + AContactosService := Intf as IsrvContactos; + + ATableNameArray := StringArray.Create; + ATableRequestInfoArray := TableRequestInfoArray.Create; + AWhereBuilder := TDAWhereBuilder.Create; + try + ATableNameArray.Add('Clientes'); + ATableRequestInfo := TableRequestInfoV5.Create; + + with ATableRequestInfo do + begin + IncludeSchema := True; + MaxRecords := -1; + UserFilter := ''; + + AWhereBuilder.Clear; + with AWhereBuilder do + for i := 0 to FListaIDClientes.Count - 1 do + begin + ACondicion := NewBinaryExpression( + NewBinaryExpression(NewField('', 'ID'), NewConstant(FListaIDClientes[i], datInteger), dboEqual), + NewBinaryExpression(NewField('', 'ID_EMPRESA'), NewConstant(FIdEmpresa, datInteger), dboEqual), + dboAnd); + + if not AWhereBuilder.IsEmpty then + Expression := NewBinaryExpression(Expression, ACondicion, dboOr) + else + Expression := ACondicion; + end; + + WhereClause := AWhereBuilder.ExpressionToXmlNode(AWhereBuilder.Expression); + end; + + try + ATableRequestInfoArray.Add(ATableRequestInfo); + AStream := AContactosService.GetData(ATableNameArray, ATableRequestInfoArray); + if Assigned(AStream) then + begin + ADataTable := TDAMemDataTable.Create(nil); + try + ADataTable.Name := 'Clientes'; + ADataTable.LocalDataStreamer := Bin2DataStreamer; + ADataTable.RemoteFetchEnabled := False; + Bin2DataStreamer.ReadDataset(AStream, ADataTable, True); + + ADataTable.Open; + FListaNombresClientes.Clear; + for i := 0 to ADataTable.RecordCount - 1 do + begin + FListaNombresClientes.Add(ADataTable.FieldByName('NOMBRE').AsString); + ADataTable.Next; + end; + + finally + FreeANDNil(ADataTable); + end; + end; + except + on e: Exception do + dmServer.EscribirLog(e.Message); + end; + finally + FreeANDNIL(ATableRequestInfoArray); + FreeANDNIL(ATableNameArray); + FreeANDNIL(AWhereBuilder); + end; + end; +end; + +procedure TRptRecibosCliente.DataModuleDestroy(Sender: TObject); +begin + FreeANDNIL(FListaNombresClientes); +end; + function TRptRecibosCliente.GenerarInformeListadoRecibos( const IdEmpresa: Integer; const FechaInicio, FechaFin: Variant; const FechaVenInicio: Variant; FechaVenFin: Variant; @@ -265,9 +419,6 @@ begin FFechaVenInicio := FechaVenInicio; FFechaVenFin := FechaVenFin; FImporteMinimo := ImporteMinimo; - - if Assigned(FListaIDClientes) then - FListaIDClientes.Free; FListaIDClientes := ListaIDClientes; //Se prepara la tabla del listado general del informe @@ -289,7 +440,8 @@ begin Bin2DataStreamer.ReadDataset(AStream, tbl_InformeListadoRecibosResumen, TRUE, '', TRUE, TRUE); //DESGLOSADO POR CLIENTE EN ESTE INFORME NO SE DESGLOSARÁ POR CLIENTE - if Desglosado then + FDesglosado := Desglosado; + if FDesglosado then ATipoInforme := rptInformeListadoRecibosClienteDesglosado else ATipoInforme := rptInformeListadoRecibosCliente; @@ -329,9 +481,6 @@ begin FFechaVenInicio := FechaVenInicio; FFechaVenFin := FechaVenFin; FImporteMinimo := ImporteMinimo; - - if Assigned(FListaIDClientes) then - FListaIDClientes.Free; FListaIDClientes := ListaIDClientes; //Se prepara la tabla del listado general del informe @@ -365,7 +514,8 @@ begin Bin2DataStreamer.ReadDataset(AStream, tbl_InformeListadoRecibosPendResumen, TRUE, '', TRUE, TRUE); //DESGLOSADO POR CLIENTE EN ESTE INFORME NO SE DESGLOSARÁ POR CLIENTE - if Desglosado then + FDesglosado := Desglosado; + if FDesglosado then ATipoInforme := rptInformeListadoRecibosCliPendientesDesglosado else ATipoInforme := rptInformeListadoRecibosCliPendientes; @@ -393,8 +543,7 @@ begin raise Exception.Create (('Error Servidor: _GenerarInforme, no encuentra informe ' + TipoInforme)); frxReport.LoadFromFile(AInforme, True); - frxReport.Variables.Variables['FechaInicio'] := FFechaInicio; - frxReport.Variables.Variables['FechaFin'] := FFechaFin; + IniciarParametrosInforme; frxReport.PrepareReport(False); frxReport.PreviewPages.SaveToStream(Result); diff --git a/Source/Servidor/FactuGES_Server.RES b/Source/Servidor/FactuGES_Server.RES index 0a215b50fd2c1a8dd202cf627daf46154d64aa0b..959f709b36f843e192c1791ffe2e2bc84b0a5c56 100644 GIT binary patch delta 83 zcmZ3om2t&Z#tnBO7}rd`8zB!Q|3*YJa!rnmRAziOxi+$zIg3Gc^6yAl$y|m^hL;RQ n49N`n3^@#`48;sO3K4hqtw|A7_1mf84M;zM|lDO1qm6m delta 79 zcmZ3nm2t^d#tnBO7*|Zb8zB!Q|3*YJvQ3VRRAziMxi+$zIgLSi^6yAl(K3cihE#?k hhCCoy%%H=dz+l8+JlQZxo!x@Liouk@d~$r0Cjg0M7+?SZ diff --git a/Source/Servidor/FactuGES_Server.rc b/Source/Servidor/FactuGES_Server.rc index ee7b1f63..739242c8 100644 --- a/Source/Servidor/FactuGES_Server.rc +++ b/Source/Servidor/FactuGES_Server.rc @@ -14,7 +14,7 @@ BEGIN BEGIN VALUE "FileVersion", "1.6.5.0\0" VALUE "ProductVersion", "1.6.5.0\0" - VALUE "CompileDate", "viernes, 23 de enero de 2009 18:57\0" + VALUE "CompileDate", "miércoles, 28 de enero de 2009 10:50\0" END END BLOCK "VarFileInfo"