diff --git a/Build/Build.fbl6 b/Build/Build.fbl6 index 54aa129..7c07b56 100644 Binary files a/Build/Build.fbl6 and b/Build/Build.fbl6 differ diff --git a/Database/scripts/factuges.sql b/Database/scripts/factuges.sql index 56c2e92..68e6e73 100644 --- a/Database/scripts/factuges.sql +++ b/Database/scripts/factuges.sql @@ -4251,9 +4251,10 @@ AND (ARTICULOS.COMISIONABLE = 1) CREATE VIEW V_INF_FAC_CLIENTE_TOTAL_ANO( ID_EMPRESA, ANO, + BASE_IMPONIBLE, IMPORTE_TOTAL) AS -select ID_EMPRESA, EXTRACT(YEAR FROM FECHA_FACTURA) as ANO, SUM(IMPORTE_TOTAL) as IMPORTE_TOTAL +select ID_EMPRESA, EXTRACT(YEAR FROM FECHA_FACTURA) as ANO, SUM(BASE_IMPONIBLE) as BASE_IMPONIBLE, SUM(IMPORTE_TOTAL) as IMPORTE_TOTAL from FACTURAS_CLIENTE group by 1,2 ; @@ -4296,9 +4297,10 @@ group by 1,2 CREATE VIEW V_INF_FAC_PROVEEDOR_TOTAL_ANO( ID_EMPRESA, ANO, + BASE_IMPONIBLE, IMPORTE_TOTAL) AS -select ID_EMPRESA, EXTRACT(YEAR FROM FECHA_FACTURA) as ANO, SUM(IMPORTE_TOTAL) as IMPORTE_TOTAL +select ID_EMPRESA, EXTRACT(YEAR FROM FECHA_FACTURA) as ANO, SUM(BASE_IMPONIBLE) as BASE_IMPONIBLE, SUM(IMPORTE_TOTAL) as IMPORTE_TOTAL from FACTURAS_PROVEEDOR group by 1,2 ; @@ -4313,6 +4315,7 @@ CREATE VIEW V_INF_FAC_CLIENTE( ID_CLIENTE, NOMBRE, IMPORTE_DESCUENTO, + BASE_IMPONIBLE, IMPORTE_TOTAL, IMPORTE_TOTAL_ANO) AS @@ -4320,12 +4323,13 @@ select f.ID_EMPRESA, EXTRACT(YEAR FROM f.FECHA_FACTURA) as ANO, CAST((DIV(EXTRACT(MONTH FROM f.FECHA_FACTURA),7)+1) AS SMALLINT) as SEMESTRE, CAST((DIV(EXTRACT(MONTH FROM f.FECHA_FACTURA)+2,3)) AS SMALLINT) as TRIMESTRE, EXTRACT(MONTH FROM f.FECHA_FACTURA) as MES, -f.FECHA_FACTURA, f.ID_CLIENTE, f.NOMBRE, f.IMPORTE_DESCUENTO, f.IMPORTE_TOTAL, v.importe_total as IMPORTE_TOTAL_ANO +f.FECHA_FACTURA, f.ID_CLIENTE, f.NOMBRE, f.IMPORTE_DESCUENTO, f.BASE_IMPONIBLE, f.IMPORTE_TOTAL, v.base_imponible as IMPORTE_TOTAL_ANO from FACTURAS_CLIENTE f inner join V_INF_FAC_CLIENTE_TOTAL_ANO v on ((v.id_empresa = f.id_empresa) and (v.Ano = EXTRACT(YEAR FROM f.FECHA_FACTURA))) order by 1,2,3,4,5 asc ; + CREATE VIEW V_INF_FAC_PROVEEDOR( ID_EMPRESA, ANO, @@ -4336,6 +4340,7 @@ CREATE VIEW V_INF_FAC_PROVEEDOR( ID_PROVEEDOR, NOMBRE, IMPORTE_DESCUENTO, + BASE_IMPONIBLE, IMPORTE_TOTAL, IMPORTE_TOTAL_ANO) AS @@ -4343,12 +4348,13 @@ select f.ID_EMPRESA, EXTRACT(YEAR FROM f.FECHA_FACTURA) as ANO, CAST((DIV(EXTRACT(MONTH FROM f.FECHA_FACTURA),7)+1) AS SMALLINT) as SEMESTRE, CAST((DIV(EXTRACT(MONTH FROM f.FECHA_FACTURA)+2,3)) AS SMALLINT) as TRIMESTRE, EXTRACT(MONTH FROM f.FECHA_FACTURA) as MES, -f.FECHA_FACTURA, f.ID_PROVEEDOR, f.NOMBRE, f.IMPORTE_DESCUENTO, f.IMPORTE_TOTAL, v.importe_total as IMPORTE_TOTAL_ANO +f.FECHA_FACTURA, f.ID_PROVEEDOR, f.NOMBRE, f.IMPORTE_DESCUENTO, f.BASE_IMPONIBLE, f.IMPORTE_TOTAL, v.base_imponible as IMPORTE_TOTAL_ANO from FACTURAS_PROVEEDOR f inner join V_INF_FAC_PROVEEDOR_TOTAL_ANO v on ((v.id_empresa = f.id_empresa) and (v.Ano = EXTRACT(YEAR FROM f.FECHA_FACTURA))) order by 1,2,3,4,5 asc ; + CREATE VIEW V_INF_FAC_DET_PROVEEDOR( ID, ID_EMPRESA, @@ -4385,7 +4391,7 @@ when FD.DESCUENTO = 0 then 0 else ((FD.CANTIDAD * FD.IMPORTE_UNIDAD) - FD.IMPORTE_TOTAL) end as IMPORTE_DESCUENTO, FD.IMPORTE_TOTAL, -v.importe_total as IMPORTE_TOTAL_ANO +v.base_imponible as IMPORTE_TOTAL_ANO from facturas_proveedor_detalles FD @@ -4431,7 +4437,7 @@ when FD.DESCUENTO = 0 then 0 else ((FD.CANTIDAD * FD.IMPORTE_UNIDAD) - FD.IMPORTE_TOTAL) end as IMPORTE_DESCUENTO, FD.IMPORTE_TOTAL, -v.importe_total as IMPORTE_TOTAL_ANO +v.base_imponible as IMPORTE_TOTAL_ANO from facturas_cliente_detalles FD @@ -4441,8 +4447,6 @@ inner join V_INF_FAC_CLIENTE_TOTAL_ANO v on ((v.id_empresa = f.id_empresa) and ( where (FD.TIPO_DETALLE = 'Concepto') ; - - CREATE VIEW V_INF_ALB_CLIENTE_AUX( ID_ALBARAN, SERVIDOS, diff --git a/Source/Base/Base.RES b/Source/Base/Base.RES index 1641339..8b251f3 100644 Binary files a/Source/Base/Base.RES and b/Source/Base/Base.RES differ diff --git a/Source/Base/Base.dproj b/Source/Base/Base.dproj index bbd92a3..96996f1 100644 --- a/Source/Base/Base.dproj +++ b/Source/Base/Base.dproj @@ -54,6 +54,58 @@ MainSource + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
DataModuleImpresiones
TDataModule @@ -63,58 +115,6 @@ TDataModule
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
fConfigurarConexion
TForm diff --git a/Source/Cliente/FactuGES.dproj b/Source/Cliente/FactuGES.dproj index 1197e55..23f3566 100644 --- a/Source/Cliente/FactuGES.dproj +++ b/Source/Cliente/FactuGES.dproj @@ -53,7 +53,7 @@ Delphi.Personality VCLApplication -FalseTrueFalseC:\Archivos de programa\Borland\Delphi7\Bin\TrueFalse4240FalseFalseFalseFalseFalse30821252Rodax Software S.L.4.2.4.0FactuGESFactuGES4.2.4.0FactuGES.dprFalse +FalseTrueFalseC:\Archivos de programa\Borland\Delphi7\Bin\TrueFalse4250FalseFalseFalseFalseFalse30821252Rodax Software S.L.4.2.5.0FactuGESFactuGES4.2.5.0FactuGES.dprFalse diff --git a/Source/Cliente/FactuGES.rc b/Source/Cliente/FactuGES.rc index e716d49..7a6af45 100644 --- a/Source/Cliente/FactuGES.rc +++ b/Source/Cliente/FactuGES.rc @@ -1,7 +1,7 @@ MAINICON ICON "C:\Codigo\Resources\Iconos\Factuges.ico" 1 VERSIONINFO -FILEVERSION 4,2,4,0 -PRODUCTVERSION 4,2,4,0 +FILEVERSION 4,2,5,0 +PRODUCTVERSION 4,2,5,0 FILEFLAGSMASK 0x3FL FILEFLAGS 0x00L FILEOS 0x40004L @@ -13,10 +13,10 @@ BEGIN BLOCK "0C0A04E4" BEGIN VALUE "CompanyName", "Rodax Software S.L.\0" - VALUE "FileVersion", "4.2.4.0\0" + VALUE "FileVersion", "4.2.5.0\0" VALUE "InternalName", "FactuGES\0" VALUE "ProductName", "FactuGES\0" - VALUE "ProductVersion", "4.2.4.0\0" + VALUE "ProductVersion", "4.2.5.0\0" END END BLOCK "VarFileInfo" diff --git a/Source/Cliente/FactuGES.res b/Source/Cliente/FactuGES.res index 51b1b5b..37bfc4a 100644 Binary files a/Source/Cliente/FactuGES.res and b/Source/Cliente/FactuGES.res differ diff --git a/Source/Informes/1/InfFacturaCliente.fr3 b/Source/Informes/1/InfFacturaCliente.fr3 index 98ae36b..1f28e7a 100644 --- a/Source/Informes/1/InfFacturaCliente.fr3 +++ b/Source/Informes/1/InfFacturaCliente.fr3 @@ -1,5 +1,5 @@ - + @@ -12,8 +12,8 @@ - - + + diff --git a/Source/Informes/1/InformeListadoFacturasClienteGrafComp.fr3 b/Source/Informes/1/InformeListadoFacturasClienteGrafComp.fr3 index 3e6604f..f6b5873 100644 --- a/Source/Informes/1/InformeListadoFacturasClienteGrafComp.fr3 +++ b/Source/Informes/1/InformeListadoFacturasClienteGrafComp.fr3 @@ -1,16 +1,16 @@ - + - + - - + + @@ -21,9 +21,9 @@ - + - + @@ -36,43 +36,49 @@ - - - - + + + + + - - + + + - - + + - - + + + - - + + - + - + + - - - + + + + - + - - + + + diff --git a/Source/Informes/1/InformeListadoFacturasProveedorGrafComp.fr3 b/Source/Informes/1/InformeListadoFacturasProveedorGrafComp.fr3 index 278b7ec..d29d06b 100644 --- a/Source/Informes/1/InformeListadoFacturasProveedorGrafComp.fr3 +++ b/Source/Informes/1/InformeListadoFacturasProveedorGrafComp.fr3 @@ -1,16 +1,16 @@ - + - + - - + + @@ -21,9 +21,9 @@ - + - + @@ -35,33 +35,37 @@ - - - - - + + + + + + - - - - - - + + + + + + + - - + + - - + + + - - + + - - - + + + + diff --git a/Source/Informes/2/InfFacturaCliente.fr3 b/Source/Informes/2/InfFacturaCliente.fr3 index de228c6..3fff9cc 100644 --- a/Source/Informes/2/InfFacturaCliente.fr3 +++ b/Source/Informes/2/InfFacturaCliente.fr3 @@ -1,5 +1,5 @@ - + @@ -10,8 +10,8 @@ - - + + diff --git a/Source/Informes/2/InformeListadoFacturasClienteGrafComp.fr3 b/Source/Informes/2/InformeListadoFacturasClienteGrafComp.fr3 index 632e127..1221247 100644 --- a/Source/Informes/2/InformeListadoFacturasClienteGrafComp.fr3 +++ b/Source/Informes/2/InformeListadoFacturasClienteGrafComp.fr3 @@ -1,5 +1,5 @@ - + @@ -17,16 +17,15 @@ - - + - + - + - + @@ -36,44 +35,50 @@ - - - - - + + + + + + - - - + + + + - - + + - - + + + - - + + - + - + + - - - - + + + + + - + - - + + + diff --git a/Source/Informes/2/InformeListadoFacturasProveedorGrafComp.fr3 b/Source/Informes/2/InformeListadoFacturasProveedorGrafComp.fr3 index 7149096..61544b1 100644 --- a/Source/Informes/2/InformeListadoFacturasProveedorGrafComp.fr3 +++ b/Source/Informes/2/InformeListadoFacturasProveedorGrafComp.fr3 @@ -1,5 +1,5 @@ - + @@ -17,16 +17,15 @@ - - + - + - + - + @@ -36,33 +35,37 @@ - - - - - + + + + + + - - - - - - + + + + + + + - - + + - - + + + - - + + - - - + + + + diff --git a/Source/Informes/5/InfFacturaCliente.fr3 b/Source/Informes/5/InfFacturaCliente.fr3 index b4bfa69..ed37ee1 100644 --- a/Source/Informes/5/InfFacturaCliente.fr3 +++ b/Source/Informes/5/InfFacturaCliente.fr3 @@ -1,5 +1,5 @@ - + @@ -9,8 +9,8 @@ - - + + diff --git a/Source/Informes/5/InformeListadoFacturasClienteGrafComp.fr3 b/Source/Informes/5/InformeListadoFacturasClienteGrafComp.fr3 index 632e127..58a619d 100644 --- a/Source/Informes/5/InformeListadoFacturasClienteGrafComp.fr3 +++ b/Source/Informes/5/InformeListadoFacturasClienteGrafComp.fr3 @@ -1,5 +1,5 @@ - + @@ -17,16 +17,15 @@ - - + - + - + - + @@ -36,44 +35,50 @@ - - - - - + + + + + + - - - + + + + - - + + - - + + + - - + + - + - + + - - - - + + + + + - + - - + + + diff --git a/Source/Informes/5/InformeListadoFacturasProveedorGrafComp.fr3 b/Source/Informes/5/InformeListadoFacturasProveedorGrafComp.fr3 index 7149096..449ea66 100644 --- a/Source/Informes/5/InformeListadoFacturasProveedorGrafComp.fr3 +++ b/Source/Informes/5/InformeListadoFacturasProveedorGrafComp.fr3 @@ -1,5 +1,5 @@ - + @@ -17,16 +17,15 @@ - - + - + - + - + @@ -36,33 +35,37 @@ - - - - - + + + + + + - - - - - - + + + + + + + - - + + - - + + + - - + + - - - + + + + diff --git a/Source/Modulos/Facturas de cliente/Reports/uRptFacturasCliente_Server.dfm b/Source/Modulos/Facturas de cliente/Reports/uRptFacturasCliente_Server.dfm index ea60f43..2df2809 100644 --- a/Source/Modulos/Facturas de cliente/Reports/uRptFacturasCliente_Server.dfm +++ b/Source/Modulos/Facturas de cliente/Reports/uRptFacturasCliente_Server.dfm @@ -17,6 +17,10 @@ object RptFacturasCliente: TRptFacturasCliente Name = 'ANO' Value = '' end + item + Name = 'ANO2' + Value = '' + end item Name = 'NTOP' Value = '' @@ -28,20 +32,28 @@ object RptFacturasCliente: TRptFacturasCliente Default = True Name = 'IBX' SQL = - 'select P.ANO, C.REFERENCIA, COALESCE(C.NOMBRE, P.NOMBRE) as NOMB' + - 'RE,'#10'SUM(P.IMPORTE_DESCUENTO) as IMPORTE_DESCUENTO, SUM(P.IMPORTE' + - '_NETO) as IMPORTE_TOTAL,'#10'SUM(P.IMPORTE_TOTAL) as IMPORTE_COBRADO' + - ','#10'case when SUM(P.IMPORTE_NETO) = 0 then 0'#10'else ((SUM(P.IMPORTE_' + - 'DESCUENTO) * 100) / SUM(P.IMPORTE_NETO)) end as PORCENTAJE'#10#10'from' + - ' V_INF_FAC_DET_CLIENTE P'#10'left join CONTACTOS C on P.ID_CLIENTE =' + - ' C.ID'#10#10'where p.ID_EMPRESA = :ID_EMPRESA'#10'and P.ANO = :ANO'#10'group b' + - 'y 1,2,3'#10'order by 1,5 desc'#10'rows 1 to :NTOP'#10 + 'select REFERENCIA, NOMBRE, sum(ANO1) as ANO1, sum (ANO2) as ANO2' + + ', sum (IMPORTE_DESCUENTO) as IMPORTE_DESCUENTO,'#10'sum (IMPORTE_DES' + + 'CUENTO2) as IMPORTE_DESCUENTO2, sum (IMPORTE_TOTAL) as IMPORTE_T' + + 'OTAL, sum (IMPORTE_COBRADO) as IMPORTE_COBRADO,'#10'sum (PORCENTAJE)' + + ' as PORCENTAJE'#10'from'#10'('#10'select C.REFERENCIA as REFERENCIA, COALESC' + + 'E(C.NOMBRE, P.NOMBRE) as NOMBRE, P.ANO as ANO1, 0 as ANO2,'#10'SUM(P' + + '.IMPORTE_DESCUENTO) as IMPORTE_DESCUENTO, 0 as IMPORTE_DESCUENTO' + + '2, SUM(P.IMPORTE_NETO) as IMPORTE_TOTAL,'#10'SUM(P.IMPORTE_TOTAL) as' + + ' IMPORTE_COBRADO,'#10'case when SUM(P.IMPORTE_NETO) = 0 then 0'#10'else ' + + '((SUM(P.IMPORTE_DESCUENTO) * 100) / SUM(P.IMPORTE_NETO)) end as ' + + 'PORCENTAJE'#10#10'from V_INF_FAC_DET_CLIENTE P'#10'left join CONTACTOS C o' + + 'n P.ID_CLIENTE = C.ID'#10'where p.ID_EMPRESA = :ID_EMPRESA'#10'and P.ANO' + + ' = :ANO'#10'group by 1,2,3,4'#10#10'union'#10#10'select C2.REFERENCIA as REFEREN' + + 'CIA, COALESCE(C2.NOMBRE, P2.NOMBRE) as NOMBRE, 0 as ANO1, P2.ANO' + + ' as ANO2,'#10' 0 as IMPORTE_DESCUENTO, SUM(P2.IMPORTE_DESCUENTO) as ' + + 'IMPORTE_DESCUENTO2, 0 as IMPORTE_TOTAL,'#10' 0 as IMPORTE_COBRADO, 0' + + ' as PORCENTAJE'#10'from V_INF_FAC_DET_CLIENTE P2'#10'left join CONTACTOS' + + ' C2 on P2.ID_CLIENTE = C2.ID'#10'where p2.ID_EMPRESA = :ID_EMPRESA'#10'a' + + 'nd P2.ANO = :ANO2'#10'group by 1,2,3,4,5'#10')'#10#10'group by 1,2'#10'having (sum' + + '(ANO1) > 0)'#10'order by 3,5 desc'#10'rows 1 to :NTOP'#10#10#10#10 StatementType = stSQL ColumnMappings = < - item - DatasetField = 'ANO' - TableField = 'ANO' - end item DatasetField = 'REFERENCIA' TableField = 'REFERENCIA' @@ -65,14 +77,22 @@ object RptFacturasCliente: TRptFacturasCliente item DatasetField = 'PORCENTAJE' TableField = 'PORCENTAJE' + end + item + DatasetField = 'ANO1' + TableField = 'ANO1' + end + item + DatasetField = 'ANO2' + TableField = 'ANO2' + end + item + DatasetField = 'IMPORTE_DESCUENTO2' + TableField = 'IMPORTE_DESCUENTO2' end> end> Name = 'InformeListadoClientesMayorDescuentoResumen' Fields = < - item - Name = 'ANO' - DataType = datSmallInt - end item Name = 'REFERENCIA' DataType = datString @@ -83,10 +103,22 @@ object RptFacturasCliente: TRptFacturasCliente DataType = datString Size = 255 end + item + Name = 'ANO1' + DataType = datLargeInt + end + item + Name = 'ANO2' + DataType = datLargeInt + end item Name = 'IMPORTE_DESCUENTO' DataType = datCurrency end + item + Name = 'IMPORTE_DESCUENTO2' + DataType = datCurrency + end item Name = 'IMPORTE_TOTAL' DataType = datCurrency @@ -133,15 +165,15 @@ object RptFacturasCliente: TRptFacturasCliente ') then (100 - (periodo2.IMPORTE_TOTAL*100))'#10'else (100 - ((period' + 'o2.IMPORTE_TOTAL*100)/periodo1.IMPORTE_TOTAL))'#10'end as Porcentaje' + #10#10'FROM'#10'periodos_aux'#10'left join'#10'(select comp1.ID_EMPRESA, comp1.AN' + - 'O, SEMESTRE as NFILA, SUM(comp1.IMPORTE_TOTAL) as IMPORTE_TOTAL'#10 + - 'from V_INF_FAC_CLIENTE comp1'#10'where ID_EMPRESA = :ID_EMPRESA1'#10'and' + - ' (ANO = :ANO1)'#10'group by 1,2,3'#10'order by 1 desc,2 asc) periodo1 on' + - ' (VALOR = periodo1.NFILA)'#10#10'left join'#10'(select comp2.ID_EMPRESA, c' + - 'omp2.ANO, SEMESTRE as NFILA, SUM(comp2.IMPORTE_TOTAL) as IMPORTE' + - '_TOTAL'#10'from V_INF_FAC_CLIENTE comp2'#10'where ID_EMPRESA = :ID_EMPRE' + - 'SA2'#10'and (ANO = :ANO2)'#10'group by 1,2,3'#10'order by 1 desc,2 asc) peri' + - 'odo2 on (VALOR = periodo2.NFILA)'#10#10'where periodo= '#39'SEMESTRAL'#39#10'ord' + - 'er by valor asc'#10#10 + 'O, SEMESTRE as NFILA, SUM(comp1.BASE_IMPONIBLE) as IMPORTE_TOTAL' + + #10'from V_INF_FAC_CLIENTE comp1'#10'where ID_EMPRESA = :ID_EMPRESA1'#10'an' + + 'd (ANO = :ANO1)'#10'group by 1,2,3'#10'order by 1 desc,2 asc) periodo1 o' + + 'n (VALOR = periodo1.NFILA)'#10#10'left join'#10'(select comp2.ID_EMPRESA, ' + + 'comp2.ANO, SEMESTRE as NFILA, SUM(comp2.BASE_IMPONIBLE) as IMPOR' + + 'TE_TOTAL'#10'from V_INF_FAC_CLIENTE comp2'#10'where ID_EMPRESA = :ID_EMP' + + 'RESA2'#10'and (ANO = :ANO2)'#10'group by 1,2,3'#10'order by 1 desc,2 asc) pe' + + 'riodo2 on (VALOR = periodo2.NFILA)'#10#10'where periodo= '#39'SEMESTRAL'#39#10'o' + + 'rder by valor asc'#10#10 StatementType = stSQL ColumnMappings = < item @@ -246,15 +278,15 @@ object RptFacturasCliente: TRptFacturasCliente ') then (100 - (periodo2.IMPORTE_TOTAL*100))'#10'else (100 - ((period' + 'o2.IMPORTE_TOTAL*100)/periodo1.IMPORTE_TOTAL))'#10'end as Porcentaje' + #10#10'FROM'#10'periodos_aux'#10'left join'#10'(select comp1.ID_EMPRESA, comp1.AN' + - 'O, MES as NFILA, SUM(comp1.IMPORTE_TOTAL) as IMPORTE_TOTAL'#10'from ' + - 'V_INF_FAC_CLIENTE comp1'#10'where ID_EMPRESA = :ID_EMPRESA1'#10'and (ANO' + - ' = :ANO1)'#10'group by 1,2,3'#10'order by 1 desc,2 asc) periodo1 on (VAL' + - 'OR = periodo1.NFILA)'#10#10'left join'#10'(select comp2.ID_EMPRESA, comp2.' + - 'ANO, MES as NFILA, SUM(comp2.IMPORTE_TOTAL) as IMPORTE_TOTAL'#10'fro' + - 'm V_INF_FAC_CLIENTE comp2'#10'where ID_EMPRESA = :ID_EMPRESA2'#10'and (A' + - 'NO = :ANO2)'#10'group by 1,2,3'#10'order by 1 desc,2 asc) periodo2 on (V' + - 'ALOR = periodo2.NFILA)'#10#10'where periodo= '#39'MENSUAL'#39#10'order by valor ' + - 'asc'#10#10 + 'O, MES as NFILA, SUM(comp1.BASE_IMPONIBLE) as IMPORTE_TOTAL'#10'from' + + ' V_INF_FAC_CLIENTE comp1'#10'where ID_EMPRESA = :ID_EMPRESA1'#10'and (AN' + + 'O = :ANO1)'#10'group by 1,2,3'#10'order by 1 desc,2 asc) periodo1 on (VA' + + 'LOR = periodo1.NFILA)'#10#10'left join'#10'(select comp2.ID_EMPRESA, comp2' + + '.ANO, MES as NFILA, SUM(comp2.BASE_IMPONIBLE) as IMPORTE_TOTAL'#10'f' + + 'rom V_INF_FAC_CLIENTE comp2'#10'where ID_EMPRESA = :ID_EMPRESA2'#10'and ' + + '(ANO = :ANO2)'#10'group by 1,2,3'#10'order by 1 desc,2 asc) periodo2 on ' + + '(VALOR = periodo2.NFILA)'#10#10'where periodo= '#39'MENSUAL'#39#10'order by valo' + + 'r asc'#10#10 StatementType = stSQL ColumnMappings = < item @@ -336,6 +368,10 @@ object RptFacturasCliente: TRptFacturasCliente Name = 'ANO' Value = '' end + item + Name = 'ANO2' + Value = '' + end item Name = 'NTOP' Value = '' @@ -347,19 +383,26 @@ object RptFacturasCliente: TRptFacturasCliente Default = True Name = 'IBX' SQL = - 'select P.ANO, C.REFERENCIA, COALESCE(C.NOMBRE, P.NOMBRE) as NOMB' + - 'RE, p.Importe_TOTAL_ANO,'#10'COUNT(P.FECHA_FACTURA) as NUMFAC, SUM(P' + - '.IMPORTE_TOTAL) as IMPORTE_TOTAL,'#10'((SUM(P.IMPORTE_TOTAL)*100)/p.' + - 'Importe_TOTAL_ANO) as PORCENTAJE'#10#10'from V_INF_FAC_CLIENTE P'#10'left ' + - 'join CONTACTOS C on P.ID_CLIENTE = C.ID'#10#10'where p.ID_EMPRESA = :I' + - 'D_EMPRESA'#10'and P.ANO = :ANO'#10'group by 1,2,3,4'#10'order by 1,6 desc'#10'ro' + - 'ws 1 to :NTOP'#10#10 + 'select REFERENCIA, NOMBRE, sum(ANO1) as ANO1, sum (ANO2) as ANO2' + + ', sum (Importe_TOTAL_ANO) as IMPORTE_TOTAL_ANO,'#10'sum (NUMFAC) as ' + + 'NUMFAC, sum (IMPORTE_TOTAL) as IMPORTE_TOTAL_ANO1, sum (IMPORTE_' + + 'TOTAL_ANO2) as IMPORTE_TOTAL_ANO2,'#10'sum (PORCENTAJE) as PORCENTAJ' + + 'E'#10'from'#10'('#10'select C.REFERENCIA as REFERENCIA, COALESCE(C.NOMBRE, P' + + '.NOMBRE) as NOMBRE, P.ANO as ANO1, 0 as ANO2, p.Importe_TOTAL_AN' + + 'O,'#10'COUNT(P.FECHA_FACTURA) as NUMFAC, SUM(P.BASE_IMPONIBLE) as IM' + + 'PORTE_TOTAL, 0 as IMPORTE_TOTAL_ANO2,'#10'((SUM(P.BASE_IMPONIBLE)*10' + + '0)/p.Importe_TOTAL_ANO) as PORCENTAJE'#10'from V_INF_FAC_CLIENTE P'#10'l' + + 'eft join CONTACTOS C on P.ID_CLIENTE = C.ID'#10'where p.ID_EMPRESA =' + + ' :ID_EMPRESA'#10'and P.ANO = :ANO'#10'group by 1,2,3,4,5'#10#10'union'#10#10'select ' + + 'C2.REFERENCIA as REFERENCIA, COALESCE(C2.NOMBRE, P2.NOMBRE) as N' + + 'OMBRE, 0 as ANO1, P2.ANO as ANO2, 0 as Importe_TOTAL_ANO,'#10'0 as N' + + 'UMFAC, 0 as IMPORTE_TOTAL, SUM(P2.BASE_IMPONIBLE) as IMPORTE_TOT' + + 'AL_ANO2, 0 as PORCENTAJE'#10'from V_INF_FAC_CLIENTE P2'#10'left join CON' + + 'TACTOS C2 on P2.ID_CLIENTE = C2.ID'#10'where p2.ID_EMPRESA = :ID_EMP' + + 'RESA'#10'and P2.ANO = :ANO2'#10'group by 1,2,3,4,5,6,7'#10')'#10#10'group by 1,2'#10'h' + + 'aving (sum(ANO1) > 0)'#10'order by 3,7 desc'#10'rows 1 to :NTOP'#10#10 StatementType = stSQL ColumnMappings = < - item - DatasetField = 'ANO' - TableField = 'ANO' - end item DatasetField = 'REFERENCIA' TableField = 'REFERENCIA' @@ -376,21 +419,29 @@ object RptFacturasCliente: TRptFacturasCliente DatasetField = 'NUMFAC' TableField = 'NUMFAC' end - item - DatasetField = 'IMPORTE_TOTAL' - TableField = 'IMPORTE_TOTAL' - end item DatasetField = 'PORCENTAJE' TableField = 'PORCENTAJE' + end + item + DatasetField = 'ANO1' + TableField = 'ANO1' + end + item + DatasetField = 'ANO2' + TableField = 'ANO2' + end + item + DatasetField = 'IMPORTE_TOTAL_ANO1' + TableField = 'IMPORTE_TOTAL_ANO1' + end + item + DatasetField = 'IMPORTE_TOTAL_ANO2' + TableField = 'IMPORTE_TOTAL_ANO2' end> end> Name = 'InformeListadoClientesMayorFacturacionResumen' Fields = < - item - Name = 'ANO' - DataType = datSmallInt - end item Name = 'REFERENCIA' DataType = datString @@ -401,16 +452,28 @@ object RptFacturasCliente: TRptFacturasCliente DataType = datString Size = 255 end + item + Name = 'ANO1' + DataType = datLargeInt + end + item + Name = 'ANO2' + DataType = datLargeInt + end item Name = 'IMPORTE_TOTAL_ANO' DataType = datCurrency end item Name = 'NUMFAC' - DataType = datInteger + DataType = datLargeInt end item - Name = 'IMPORTE_TOTAL' + Name = 'IMPORTE_TOTAL_ANO1' + DataType = datCurrency + end + item + Name = 'IMPORTE_TOTAL_ANO2' DataType = datCurrency end item @@ -451,15 +514,15 @@ object RptFacturasCliente: TRptFacturasCliente ') then (100 - (periodo2.IMPORTE_TOTAL*100))'#10'else (100 - ((period' + 'o2.IMPORTE_TOTAL*100)/periodo1.IMPORTE_TOTAL))'#10'end as Porcentaje' + #10#10'FROM'#10'periodos_aux'#10'left join'#10'(select comp1.ID_EMPRESA, comp1.AN' + - 'O, TRIMESTRE as NFILA, SUM(comp1.IMPORTE_TOTAL) as IMPORTE_TOTAL' + - #10'from V_INF_FAC_CLIENTE comp1'#10'where ID_EMPRESA = :ID_EMPRESA1'#10'an' + - 'd (ANO = :ANO1)'#10'group by 1,2,3'#10'order by 1 desc,2 asc) periodo1 o' + - 'n (VALOR = periodo1.NFILA)'#10#10'left join'#10'(select comp2.ID_EMPRESA, ' + - 'comp2.ANO, TRIMESTRE as NFILA, SUM(comp2.IMPORTE_TOTAL) as IMPOR' + - 'TE_TOTAL'#10'from V_INF_FAC_CLIENTE comp2'#10'where ID_EMPRESA = :ID_EMP' + - 'RESA2'#10'and (ANO = :ANO2)'#10'group by 1,2,3'#10'order by 1 desc,2 asc) pe' + - 'riodo2 on (VALOR = periodo2.NFILA)'#10#10'where periodo= '#39'TRIMESTRAL'#39#10 + - 'order by valor asc'#10#10 + 'O, TRIMESTRE as NFILA, SUM(comp1.BASE_IMPONIBLE) as IMPORTE_TOTA' + + 'L'#10'from V_INF_FAC_CLIENTE comp1'#10'where ID_EMPRESA = :ID_EMPRESA1'#10'a' + + 'nd (ANO = :ANO1)'#10'group by 1,2,3'#10'order by 1 desc,2 asc) periodo1 ' + + 'on (VALOR = periodo1.NFILA)'#10#10'left join'#10'(select comp2.ID_EMPRESA,' + + ' comp2.ANO, TRIMESTRE as NFILA, SUM(comp2.BASE_IMPONIBLE) as IMP' + + 'ORTE_TOTAL'#10'from V_INF_FAC_CLIENTE comp2'#10'where ID_EMPRESA = :ID_E' + + 'MPRESA2'#10'and (ANO = :ANO2)'#10'group by 1,2,3'#10'order by 1 desc,2 asc) ' + + 'periodo2 on (VALOR = periodo2.NFILA)'#10#10'where periodo= '#39'TRIMESTRAL' + + #39#10'order by valor asc'#10#10 StatementType = stSQL ColumnMappings = < item @@ -1534,6 +1597,10 @@ object RptFacturasCliente: TRptFacturasCliente Name = 'ANO' Value = '' end + item + Name = 'ANO2' + Value = '' + end item Name = 'NTOP' Value = '' @@ -1544,18 +1611,26 @@ object RptFacturasCliente: TRptFacturasCliente ConnectionType = 'Interbase' Default = True SQL = - 'select P.ANO, C.REFERENCIA, COALESCE(C.NOMBRE, '#39'Agente no asigna' + - 'do'#39') as NOMBRE, p.Importe_TOTAL_ANO,'#10'SUM(P.IMPORTE_TOTAL) as IMP' + - 'ORTE_TOTAL, ((SUM(P.IMPORTE_TOTAL)*100)/p.Importe_TOTAL_ANO) as ' + - 'PORCENTAJE'#10#10'from V_INF_FAC_DET_CLIENTE P'#10'left join CONTACTOS C o' + - 'n P.ID_AGENTE = C.ID'#10#10'where p.ID_EMPRESA = :ID_EMPRESA'#10'and P.ANO' + - ' = :ANO'#10'group by 1,2,3,4'#10'order by 1,6 desc'#10'rows 1 to :NTOP'#10 + 'select REFERENCIA, NOMBRE, sum(ANO1) as ANO1, sum (ANO2) as ANO2' + + ', sum (IMPORTE_TOTAL_ANO) as IMPORTE_TOTAL_ANO,'#10'sum (IMPORTE_TOT' + + 'AL_ANO1) as IMPORTE_TOTAL_ANO1, sum (IMPORTE_TOTAL_ANO2) as IMPO' + + 'RTE_TOTAL_ANO2,'#10'sum (PORCENTAJE) as PORCENTAJE'#10'from'#10'('#10'select C.R' + + 'EFERENCIA as REFERENCIA, COALESCE(C.NOMBRE, '#39'Agente no asignado'#39 + + ') as NOMBRE, P.ANO as ANO1, 0 as ANO2,'#10'p.IMPORTE_TOTAL_ANO, SUM(' + + 'P.IMPORTE_TOTAL) as IMPORTE_TOTAL_ANO1, 0 as IMPORTE_TOTAL_ANO2,' + + #10' ((SUM(P.IMPORTE_TOTAL)*100)/p.IMPORTE_TOTAL_ANO) as PORCENTAJE' + + #10#10'from V_INF_FAC_DET_CLIENTE P'#10'left join CONTACTOS C on P.ID_AGE' + + 'NTE = C.ID'#10'where p.ID_EMPRESA = :ID_EMPRESA'#10'and P.ANO = :ANO'#10'gro' + + 'up by 1,2,3,4,5'#10#10'union'#10#10'select C2.REFERENCIA as REFERENCIA, COAL' + + 'ESCE(C2.NOMBRE, '#39'Agente no asignado'#39') as NOMBRE, 0 as ANO1, P2.A' + + 'NO as ANO2,'#10' 0 as IMPORTE_TOTAL_ANO, 0 as IMPORTE_TOTAL_ANO1, SU' + + 'M(P2.IMPORTE_TOTAL) as IMPORTE_TOTAL_ANO2,'#10' 0 as PORCENTAJE'#10'from' + + ' V_INF_FAC_DET_CLIENTE P2'#10'left join CONTACTOS C2 on P2.ID_AGENTE' + + ' = C2.ID'#10'where p2.ID_EMPRESA = :ID_EMPRESA'#10'and P2.ANO = :ANO2'#10'gr' + + 'oup by 1,2,3,4,5,6'#10')'#10#10'group by 1,2'#10'having (sum(ANO1) > 0)'#10'order ' + + 'by 3,6 desc'#10'rows 1 to :NTOP'#10#10 StatementType = stSQL ColumnMappings = < - item - DatasetField = 'ANO' - TableField = 'ANO' - end item DatasetField = 'REFERENCIA' TableField = 'REFERENCIA' @@ -1568,21 +1643,29 @@ object RptFacturasCliente: TRptFacturasCliente DatasetField = 'IMPORTE_TOTAL_ANO' TableField = 'IMPORTE_TOTAL_ANO' end - item - DatasetField = 'IMPORTE_TOTAL' - TableField = 'IMPORTE_TOTAL' - end item DatasetField = 'PORCENTAJE' TableField = 'PORCENTAJE' + end + item + DatasetField = 'ANO1' + TableField = 'ANO1' + end + item + DatasetField = 'ANO2' + TableField = 'ANO2' + end + item + DatasetField = 'IMPORTE_TOTAL_ANO1' + TableField = 'IMPORTE_TOTAL_ANO1' + end + item + DatasetField = 'IMPORTE_TOTAL_ANO2' + TableField = 'IMPORTE_TOTAL_ANO2' end> end> Name = 'InformeListadoAgentesMayorFacturacionResumen' Fields = < - item - Name = 'ANO' - DataType = datSmallInt - end item Name = 'REFERENCIA' DataType = datString @@ -1593,12 +1676,24 @@ object RptFacturasCliente: TRptFacturasCliente DataType = datString Size = 255 end + item + Name = 'ANO1' + DataType = datLargeInt + end + item + Name = 'ANO2' + DataType = datLargeInt + end item Name = 'IMPORTE_TOTAL_ANO' DataType = datCurrency end item - Name = 'IMPORTE_TOTAL' + Name = 'IMPORTE_TOTAL_ANO1' + DataType = datCurrency + end + item + Name = 'IMPORTE_TOTAL_ANO2' DataType = datCurrency end item @@ -1677,24 +1772,24 @@ object RptFacturasCliente: TRptFacturasCliente 'riodo_ingresos2.IMPORTE_TOTAL, 0) - coalesce(periodo_gastos2.IMP' + 'ORTE_TOTAL, 0))))'#10'end'#10'end as Porcentaje_Aumento_Beneficios'#10#10'FROM' + #10'periodos_aux'#10'left join'#10'(select comp1.ID_EMPRESA, comp1.ANO, MES' + - ' as NFILA, SUM(comp1.IMPORTE_TOTAL) as IMPORTE_TOTAL'#10'from V_INF_' + - 'FAC_CLIENTE comp1'#10'where ID_EMPRESA = :ID_EMPRESA1'#10'and (ANO = :AN' + - 'O1)'#10'group by 1,2,3'#10'order by 1 desc,2 asc) periodo_ingresos1 on (' + - 'VALOR = periodo_ingresos1.NFILA)'#10#10'left join'#10'(select comp2.ID_EMP' + - 'RESA, comp2.ANO, MES as NFILA, SUM(comp2.IMPORTE_TOTAL) as IMPOR' + - 'TE_TOTAL'#10'from V_INF_FAC_PROVEEDOR comp2'#10'where ID_EMPRESA = :ID_E' + - 'MPRESA1'#10'and (ANO = :ANO1)'#10'group by 1,2,3'#10'order by 1 desc,2 asc) ' + - 'periodo_gastos1 on (VALOR = periodo_gastos1.NFILA)'#10#10'left join'#10'(s' + - 'elect comp3.ID_EMPRESA, comp3.ANO, MES as NFILA, SUM(comp3.IMPOR' + - 'TE_TOTAL) as IMPORTE_TOTAL'#10'from V_INF_FAC_CLIENTE comp3'#10'where ID' + - '_EMPRESA = :ID_EMPRESA2'#10'and (ANO = :ANO2)'#10'group by 1,2,3'#10'order b' + - 'y 1 desc,2 asc) periodo_ingresos2 on (VALOR = periodo_ingresos2.' + - 'NFILA)'#10#10'left join'#10'(select comp4.ID_EMPRESA, comp4.ANO, MES as NF' + - 'ILA, SUM(comp4.IMPORTE_TOTAL) as IMPORTE_TOTAL'#10'from V_INF_FAC_PR' + - 'OVEEDOR comp4'#10'where ID_EMPRESA = :ID_EMPRESA2'#10'and (ANO = :ANO2)'#10 + - 'group by 1,2,3'#10'order by 1 desc,2 asc) periodo_gastos2 on (VALOR ' + - '= periodo_gastos2.NFILA)'#10#10#10'where periodo= '#39'MENSUAL'#39#10'order by val' + - 'or asc'#10 + ' as NFILA, SUM(comp1.BASE_IMPONIBLE) as IMPORTE_TOTAL'#10'from V_INF' + + '_FAC_CLIENTE comp1'#10'where ID_EMPRESA = :ID_EMPRESA1'#10'and (ANO = :A' + + 'NO1)'#10'group by 1,2,3'#10'order by 1 desc,2 asc) periodo_ingresos1 on ' + + '(VALOR = periodo_ingresos1.NFILA)'#10#10'left join'#10'(select comp2.ID_EM' + + 'PRESA, comp2.ANO, MES as NFILA, SUM(comp2.BASE_IMPONIBLE) as IMP' + + 'ORTE_TOTAL'#10'from V_INF_FAC_PROVEEDOR comp2'#10'where ID_EMPRESA = :ID' + + '_EMPRESA1'#10'and (ANO = :ANO1)'#10'group by 1,2,3'#10'order by 1 desc,2 asc' + + ') periodo_gastos1 on (VALOR = periodo_gastos1.NFILA)'#10#10'left join'#10 + + '(select comp3.ID_EMPRESA, comp3.ANO, MES as NFILA, SUM(comp3.BAS' + + 'E_IMPONIBLE) as IMPORTE_TOTAL'#10'from V_INF_FAC_CLIENTE comp3'#10'where' + + ' ID_EMPRESA = :ID_EMPRESA2'#10'and (ANO = :ANO2)'#10'group by 1,2,3'#10'orde' + + 'r by 1 desc,2 asc) periodo_ingresos2 on (VALOR = periodo_ingreso' + + 's2.NFILA)'#10#10'left join'#10'(select comp4.ID_EMPRESA, comp4.ANO, MES as' + + ' NFILA, SUM(comp4.BASE_IMPONIBLE) as IMPORTE_TOTAL'#10'from V_INF_FA' + + 'C_PROVEEDOR comp4'#10'where ID_EMPRESA = :ID_EMPRESA2'#10'and (ANO = :AN' + + 'O2)'#10'group by 1,2,3'#10'order by 1 desc,2 asc) periodo_gastos2 on (VA' + + 'LOR = periodo_gastos2.NFILA)'#10#10#10'where periodo= '#39'MENSUAL'#39#10'order by' + + ' valor asc'#10 StatementType = stSQL ColumnMappings = < item @@ -1933,24 +2028,24 @@ object RptFacturasCliente: TRptFacturasCliente 'riodo_ingresos2.IMPORTE_TOTAL, 0) - coalesce(periodo_gastos2.IMP' + 'ORTE_TOTAL, 0))))'#10'end'#10'end as Porcentaje_Aumento_Beneficios'#10#10#10'FRO' + 'M'#10'periodos_aux'#10'left join'#10'(select comp1.ID_EMPRESA, comp1.ANO, TR' + - 'IMESTRE as NFILA, SUM(comp1.IMPORTE_TOTAL) as IMPORTE_TOTAL'#10'from' + - ' V_INF_FAC_CLIENTE comp1'#10'where ID_EMPRESA = :ID_EMPRESA1'#10'and (AN' + - 'O = :ANO1)'#10'group by 1,2,3'#10'order by 1 desc,2 asc) periodo_ingreso' + - 's1 on (VALOR = periodo_ingresos1.NFILA)'#10#10'left join'#10'(select comp2' + - '.ID_EMPRESA, comp2.ANO, TRIMESTRE as NFILA, SUM(comp2.IMPORTE_TO' + - 'TAL) as IMPORTE_TOTAL'#10'from V_INF_FAC_PROVEEDOR comp2'#10'where ID_EM' + - 'PRESA = :ID_EMPRESA1'#10'and (ANO = :ANO1)'#10'group by 1,2,3'#10'order by 1' + - ' desc,2 asc) periodo_gastos1 on (VALOR = periodo_gastos1.NFILA)'#10 + - #10'left join'#10'(select comp3.ID_EMPRESA, comp3.ANO, TRIMESTRE as NFI' + - 'LA, SUM(comp3.IMPORTE_TOTAL) as IMPORTE_TOTAL'#10'from V_INF_FAC_CLI' + - 'ENTE comp3'#10'where ID_EMPRESA = :ID_EMPRESA2'#10'and (ANO = :ANO2)'#10'gro' + - 'up by 1,2,3'#10'order by 1 desc,2 asc) periodo_ingresos2 on (VALOR =' + - ' periodo_ingresos2.NFILA)'#10#10'left join'#10'(select comp4.ID_EMPRESA, c' + - 'omp4.ANO, TRIMESTRE as NFILA, SUM(comp4.IMPORTE_TOTAL) as IMPORT' + - 'E_TOTAL'#10'from V_INF_FAC_PROVEEDOR comp4'#10'where ID_EMPRESA = :ID_EM' + - 'PRESA2'#10'and (ANO = :ANO2)'#10'group by 1,2,3'#10'order by 1 desc,2 asc) p' + - 'eriodo_gastos2 on (VALOR = periodo_gastos2.NFILA)'#10#10#10'where period' + - 'o= '#39'TRIMESTRAL'#39#10'order by valor asc'#10 + 'IMESTRE as NFILA, SUM(comp1.BASE_IMPONIBLE) as IMPORTE_TOTAL'#10'fro' + + 'm V_INF_FAC_CLIENTE comp1'#10'where ID_EMPRESA = :ID_EMPRESA1'#10'and (A' + + 'NO = :ANO1)'#10'group by 1,2,3'#10'order by 1 desc,2 asc) periodo_ingres' + + 'os1 on (VALOR = periodo_ingresos1.NFILA)'#10#10'left join'#10'(select comp' + + '2.ID_EMPRESA, comp2.ANO, TRIMESTRE as NFILA, SUM(comp2.BASE_IMPO' + + 'NIBLE) as IMPORTE_TOTAL'#10'from V_INF_FAC_PROVEEDOR comp2'#10'where ID_' + + 'EMPRESA = :ID_EMPRESA1'#10'and (ANO = :ANO1)'#10'group by 1,2,3'#10'order by' + + ' 1 desc,2 asc) periodo_gastos1 on (VALOR = periodo_gastos1.NFILA' + + ')'#10#10'left join'#10'(select comp3.ID_EMPRESA, comp3.ANO, TRIMESTRE as N' + + 'FILA, SUM(comp3.BASE_IMPONIBLE) as IMPORTE_TOTAL'#10'from V_INF_FAC_' + + 'CLIENTE comp3'#10'where ID_EMPRESA = :ID_EMPRESA2'#10'and (ANO = :ANO2)'#10 + + 'group by 1,2,3'#10'order by 1 desc,2 asc) periodo_ingresos2 on (VALO' + + 'R = periodo_ingresos2.NFILA)'#10#10'left join'#10'(select comp4.ID_EMPRESA' + + ', comp4.ANO, TRIMESTRE as NFILA, SUM(comp4.BASE_IMPONIBLE) as IM' + + 'PORTE_TOTAL'#10'from V_INF_FAC_PROVEEDOR comp4'#10'where ID_EMPRESA = :I' + + 'D_EMPRESA2'#10'and (ANO = :ANO2)'#10'group by 1,2,3'#10'order by 1 desc,2 as' + + 'c) periodo_gastos2 on (VALOR = periodo_gastos2.NFILA)'#10#10#10'where pe' + + 'riodo= '#39'TRIMESTRAL'#39#10'order by valor asc'#10 StatementType = stSQL ColumnMappings = < item @@ -2189,24 +2284,24 @@ object RptFacturasCliente: TRptFacturasCliente 'riodo_ingresos2.IMPORTE_TOTAL, 0) - coalesce(periodo_gastos2.IMP' + 'ORTE_TOTAL, 0))))'#10'end'#10'end as Porcentaje_Aumento_Beneficios'#10#10#10'FRO' + 'M'#10'periodos_aux'#10'left join'#10'(select comp1.ID_EMPRESA, comp1.ANO, SE' + - 'MESTRE as NFILA, SUM(comp1.IMPORTE_TOTAL) as IMPORTE_TOTAL'#10'from ' + - 'V_INF_FAC_CLIENTE comp1'#10'where ID_EMPRESA = :ID_EMPRESA1'#10'and (ANO' + - ' = :ANO1)'#10'group by 1,2,3'#10'order by 1 desc,2 asc) periodo_ingresos' + - '1 on (VALOR = periodo_ingresos1.NFILA)'#10#10'left join'#10'(select comp2.' + - 'ID_EMPRESA, comp2.ANO, SEMESTRE as NFILA, SUM(comp2.IMPORTE_TOTA' + - 'L) as IMPORTE_TOTAL'#10'from V_INF_FAC_PROVEEDOR comp2'#10'where ID_EMPR' + - 'ESA = :ID_EMPRESA1'#10'and (ANO = :ANO1)'#10'group by 1,2,3'#10'order by 1 d' + - 'esc,2 asc) periodo_gastos1 on (VALOR = periodo_gastos1.NFILA)'#10#10'l' + - 'eft join'#10'(select comp3.ID_EMPRESA, comp3.ANO, SEMESTRE as NFILA,' + - ' SUM(comp3.IMPORTE_TOTAL) as IMPORTE_TOTAL'#10'from V_INF_FAC_CLIENT' + - 'E comp3'#10'where ID_EMPRESA = :ID_EMPRESA2'#10'and (ANO = :ANO2)'#10'group ' + - 'by 1,2,3'#10'order by 1 desc,2 asc) periodo_ingresos2 on (VALOR = pe' + - 'riodo_ingresos2.NFILA)'#10#10'left join'#10'(select comp4.ID_EMPRESA, comp' + - '4.ANO, SEMESTRE as NFILA, SUM(comp4.IMPORTE_TOTAL) as IMPORTE_TO' + - 'TAL'#10'from V_INF_FAC_PROVEEDOR comp4'#10'where ID_EMPRESA = :ID_EMPRES' + - 'A2'#10'and (ANO = :ANO2)'#10'group by 1,2,3'#10'order by 1 desc,2 asc) perio' + - 'do_gastos2 on (VALOR = periodo_gastos2.NFILA)'#10#10#10'where periodo= '#39 + - 'SEMESTRAL'#39#10'order by valor asc'#10 + 'MESTRE as NFILA, SUM(comp1.BASE_IMPONIBLE) as IMPORTE_TOTAL'#10'from' + + ' V_INF_FAC_CLIENTE comp1'#10'where ID_EMPRESA = :ID_EMPRESA1'#10'and (AN' + + 'O = :ANO1)'#10'group by 1,2,3'#10'order by 1 desc,2 asc) periodo_ingreso' + + 's1 on (VALOR = periodo_ingresos1.NFILA)'#10#10'left join'#10'(select comp2' + + '.ID_EMPRESA, comp2.ANO, SEMESTRE as NFILA, SUM(comp2.BASE_IMPONI' + + 'BLE) as IMPORTE_TOTAL'#10'from V_INF_FAC_PROVEEDOR comp2'#10'where ID_EM' + + 'PRESA = :ID_EMPRESA1'#10'and (ANO = :ANO1)'#10'group by 1,2,3'#10'order by 1' + + ' desc,2 asc) periodo_gastos1 on (VALOR = periodo_gastos1.NFILA)'#10 + + #10'left join'#10'(select comp3.ID_EMPRESA, comp3.ANO, SEMESTRE as NFIL' + + 'A, SUM(comp3.BASE_IMPONIBLE) as IMPORTE_TOTAL'#10'from V_INF_FAC_CLI' + + 'ENTE comp3'#10'where ID_EMPRESA = :ID_EMPRESA2'#10'and (ANO = :ANO2)'#10'gro' + + 'up by 1,2,3'#10'order by 1 desc,2 asc) periodo_ingresos2 on (VALOR =' + + ' periodo_ingresos2.NFILA)'#10#10'left join'#10'(select comp4.ID_EMPRESA, c' + + 'omp4.ANO, SEMESTRE as NFILA, SUM(comp4.BASE_IMPONIBLE) as IMPORT' + + 'E_TOTAL'#10'from V_INF_FAC_PROVEEDOR comp4'#10'where ID_EMPRESA = :ID_EM' + + 'PRESA2'#10'and (ANO = :ANO2)'#10'group by 1,2,3'#10'order by 1 desc,2 asc) p' + + 'eriodo_gastos2 on (VALOR = periodo_gastos2.NFILA)'#10#10#10'where period' + + 'o= '#39'SEMESTRAL'#39#10'order by valor asc'#10 StatementType = stSQL ColumnMappings = < item @@ -3924,27 +4019,65 @@ object RptFacturasCliente: TRptFacturasCliente PrintOptions.Printer = 'Por defecto' PrintOptions.PrintOnSheet = 0 ReportOptions.CreateDate = 37800.807714351900000000 - ReportOptions.LastChange = 41151.740285150460000000 + ReportOptions.LastChange = 41197.580220925930000000 ScriptLanguage = 'PascalScript' ScriptText.Strings = ( - 'procedure mContinuaOnBeforePrint(Sender: TfrxComponent);' + 'procedure Chart1OnBeforePrint(Sender: TfrxComponent);' 'begin' - ' if Engine.FinalPass then' + ' if ( <> 0) then' + ' begin ' + + ' TLineSeries(Chart1.Series[0]).Title := '#39'Total facturado '#39' +' + + ' VarToStr();' + ' end;' + ' ' + ' if ( > 0) then' + ' begin ' + + ' TLineSeries(Chart1.Series[1]).Title := '#39'Total facturado '#39' +' + + ' VarToStr();' + ' end' + ' else' + ' begin ' + ' Chart1.Series[1].Active := False;' + ' end; ' + 'end;' + '' + 'procedure Memo16OnBeforePrint(Sender: TfrxComponent);' + 'var' + ' Valor:Double; ' + 'begin' + + ' Valor := SUM() * 100; ' + + ' if (SUM()' + + ' = 0) then' + ' Valor := 100 - Valor ' + ' else' + + ' Valor := 100 - (Valor/SUM()); ' + '' + ' memo16.lines.add(FormatFloat('#39'#,##0.00 %'#39',Valor));' + 'end;' + '' + 'procedure Memo46OnBeforePrint(Sender: TfrxComponent);' + 'begin' + ' if ( > 0) then' ' begin' - ' if ( = ) then' - ' begin ' - ' mContinua.Visible := False;' - ' end ' - ' else' - ' begin ' - ' mContinua.Visible := True;' - ' end ' - ' end; ' + ' Memo46.visible := True;' + ' Memo47.visible := True; ' + ' end ' + ' else' + ' begin' + ' Memo46.visible := False;' + ' Memo47.visible := False; ' + ' end; ' 'end;' '' 'begin' - '' - 'end.') + 'end. ') ShowProgress = False StoreInDFM = False OnGetValue = frxReportGetValue @@ -4479,10 +4612,6 @@ object RptFacturasCliente: TRptFacturasCliente object tbl_InformeListadoClientesMayorFacturacionResumen: TDAMemDataTable RemoteUpdatesOptions = [] Fields = < - item - Name = 'ANO' - DataType = datSmallInt - end item Name = 'REFERENCIA' DataType = datString @@ -4493,16 +4622,28 @@ object RptFacturasCliente: TRptFacturasCliente DataType = datString Size = 255 end + item + Name = 'ANO1' + DataType = datLargeInt + end + item + Name = 'ANO2' + DataType = datLargeInt + end item Name = 'IMPORTE_TOTAL_ANO' DataType = datCurrency end item Name = 'NUMFAC' - DataType = datInteger + DataType = datLargeInt end item - Name = 'IMPORTE_TOTAL' + Name = 'IMPORTE_TOTAL_ANO1' + DataType = datCurrency + end + item + Name = 'IMPORTE_TOTAL_ANO2' DataType = datCurrency end item @@ -4518,6 +4659,10 @@ object RptFacturasCliente: TRptFacturasCliente Name = 'ANO' Value = '' end + item + Name = 'ANO2' + Value = '' + end item Name = 'NTOP' Value = '' @@ -4550,10 +4695,6 @@ object RptFacturasCliente: TRptFacturasCliente object tbl_InformeListadoClientesMayorDescuentoResumen: TDAMemDataTable RemoteUpdatesOptions = [] Fields = < - item - Name = 'ANO' - DataType = datSmallInt - end item Name = 'REFERENCIA' DataType = datString @@ -4564,10 +4705,22 @@ object RptFacturasCliente: TRptFacturasCliente DataType = datString Size = 255 end + item + Name = 'ANO1' + DataType = datLargeInt + end + item + Name = 'ANO2' + DataType = datLargeInt + end item Name = 'IMPORTE_DESCUENTO' DataType = datCurrency end + item + Name = 'IMPORTE_DESCUENTO2' + DataType = datCurrency + end item Name = 'IMPORTE_TOTAL' DataType = datCurrency @@ -4578,7 +4731,7 @@ object RptFacturasCliente: TRptFacturasCliente end item Name = 'PORCENTAJE' - DataType = datCurrency + DataType = datDecimal end> Params = < item @@ -4589,6 +4742,10 @@ object RptFacturasCliente: TRptFacturasCliente Name = 'ANO' Value = '' end + item + Name = 'ANO2' + Value = '' + end item Name = 'NTOP' Value = '' @@ -4621,10 +4778,6 @@ object RptFacturasCliente: TRptFacturasCliente object tbl_InformeListadoAgentesMayorFacturacionResumen: TDAMemDataTable RemoteUpdatesOptions = [] Fields = < - item - Name = 'ANO' - DataType = datSmallInt - end item Name = 'REFERENCIA' DataType = datString @@ -4635,16 +4788,24 @@ object RptFacturasCliente: TRptFacturasCliente DataType = datString Size = 255 end + item + Name = 'ANO1' + DataType = datLargeInt + end + item + Name = 'ANO2' + DataType = datLargeInt + end item Name = 'IMPORTE_TOTAL_ANO' DataType = datCurrency end item - Name = 'NUMFAC' - DataType = datInteger + Name = 'IMPORTE_TOTAL_ANO1' + DataType = datCurrency end item - Name = 'IMPORTE_TOTAL' + Name = 'IMPORTE_TOTAL_ANO2' DataType = datCurrency end item @@ -4660,6 +4821,10 @@ object RptFacturasCliente: TRptFacturasCliente Name = 'ANO' Value = '' end + item + Name = 'ANO2' + Value = '' + end item Name = 'NTOP' Value = '' diff --git a/Source/Modulos/Facturas de cliente/Reports/uRptFacturasCliente_Server.pas b/Source/Modulos/Facturas de cliente/Reports/uRptFacturasCliente_Server.pas index d36da46..07b43b1 100644 --- a/Source/Modulos/Facturas de cliente/Reports/uRptFacturasCliente_Server.pas +++ b/Source/Modulos/Facturas de cliente/Reports/uRptFacturasCliente_Server.pas @@ -845,6 +845,7 @@ begin ATabla.ParamByName('ID_EMPRESA').AsInteger := FIdEmpresa; ATabla.ParamByName('ANO').AsVariant := FAno1; + ATabla.ParamByName('ANO2').AsVariant := FAno2; ATabla.ParamByName('NTOP').AsInteger := FTopN; ATabla.Active := True; end; diff --git a/Source/Modulos/Facturas de proveedor/Reports/uRptFacturasProveedor_Server.dfm b/Source/Modulos/Facturas de proveedor/Reports/uRptFacturasProveedor_Server.dfm index 86ad308..8c44217 100644 --- a/Source/Modulos/Facturas de proveedor/Reports/uRptFacturasProveedor_Server.dfm +++ b/Source/Modulos/Facturas de proveedor/Reports/uRptFacturasProveedor_Server.dfm @@ -56,6 +56,10 @@ object RptFacturasProveedor: TRptFacturasProveedor Name = 'ANO' Value = '' end + item + Name = 'ANO2' + Value = '' + end item Name = 'NTOP' Value = '' @@ -67,19 +71,26 @@ object RptFacturasProveedor: TRptFacturasProveedor Default = True Name = 'IBX' SQL = - 'select P.ANO, C.REFERENCIA, COALESCE(C.NOMBRE, P.NOMBRE) as NOMB' + - 'RE, p.Importe_TOTAL_ANO,'#10'COUNT(P.FECHA_FACTURA) as NUMFAC, SUM(P' + - '.IMPORTE_TOTAL) as IMPORTE_TOTAL,'#10'((SUM(P.IMPORTE_TOTAL)*100)/p.' + - 'Importe_TOTAL_ANO) as PORCENTAJE'#10#10'from V_INF_FAC_PROVEEDOR P'#10'lef' + - 't join CONTACTOS C on P.ID_PROVEEDOR = C.ID'#10#10'where p.ID_EMPRESA ' + - '= :ID_EMPRESA'#10'and P.ANO = :ANO'#10'group by 1,2,3,4'#10'order by 1,6 des' + - 'c'#10'rows 1 to :NTOP'#10#10 + 'select REFERENCIA, NOMBRE, sum(ANO1) as ANO1, sum (ANO2) as ANO2' + + ', sum (Importe_TOTAL_ANO) as IMPORTE_TOTAL_ANO,'#10'sum (NUMFAC) as ' + + 'NUMFAC, sum (IMPORTE_TOTAL) as IMPORTE_TOTAL_ANO1, sum (IMPORTE_' + + 'TOTAL_ANO2) as IMPORTE_TOTAL_ANO2,'#10'sum (PORCENTAJE) as PORCENTAJ' + + 'E'#10'from'#10'('#10'select C.REFERENCIA as REFERENCIA, COALESCE(C.NOMBRE, P' + + '.NOMBRE) as NOMBRE, P.ANO as ANO1, 0 as ANO2, p.Importe_TOTAL_AN' + + 'O,'#10'COUNT(P.FECHA_FACTURA) as NUMFAC, SUM(P.BASE_IMPONIBLE) as IM' + + 'PORTE_TOTAL, 0 as IMPORTE_TOTAL_ANO2,'#10'((SUM(P.BASE_IMPONIBLE)*10' + + '0)/p.Importe_TOTAL_ANO) as PORCENTAJE'#10'from V_INF_FAC_PROVEEDOR P' + + #10'left join CONTACTOS C on P.ID_PROVEEDOR = C.ID'#10'where p.ID_EMPRE' + + 'SA = :ID_EMPRESA'#10'and P.ANO = :ANO'#10'group by 1,2,3,4,5'#10#10'union'#10#10'sel' + + 'ect C2.REFERENCIA as REFERENCIA, COALESCE(C2.NOMBRE, P2.NOMBRE) ' + + 'as NOMBRE, 0 as ANO1, P2.ANO as ANO2, 0 as Importe_TOTAL_ANO,'#10'0 ' + + 'as NUMFAC, 0 as IMPORTE_TOTAL, SUM(P2.BASE_IMPONIBLE) as IMPORTE' + + '_TOTAL_ANO2, 0 as PORCENTAJE'#10'from V_INF_FAC_PROVEEDOR P2'#10'left jo' + + 'in CONTACTOS C2 on P2.ID_PROVEEDOR = C2.ID'#10'where p2.ID_EMPRESA =' + + ' :ID_EMPRESA'#10'and P2.ANO = :ANO2'#10'group by 1,2,3,4,5,6,7'#10')'#10#10'group ' + + 'by 1,2'#10'having (sum(ANO1) > 0)'#10'order by 3,7 desc'#10'rows 1 to :NTOP'#10 StatementType = stSQL ColumnMappings = < - item - DatasetField = 'ANO' - TableField = 'ANO' - end item DatasetField = 'REFERENCIA' TableField = 'REFERENCIA' @@ -96,21 +107,29 @@ object RptFacturasProveedor: TRptFacturasProveedor DatasetField = 'NUMFAC' TableField = 'NUMFAC' end - item - DatasetField = 'IMPORTE_TOTAL' - TableField = 'IMPORTE_TOTAL' - end item DatasetField = 'PORCENTAJE' TableField = 'PORCENTAJE' + end + item + DatasetField = 'ANO1' + TableField = 'ANO1' + end + item + DatasetField = 'ANO2' + TableField = 'ANO2' + end + item + DatasetField = 'IMPORTE_TOTAL_ANO1' + TableField = 'IMPORTE_TOTAL_ANO1' + end + item + DatasetField = 'IMPORTE_TOTAL_ANO2' + TableField = 'IMPORTE_TOTAL_ANO2' end> end> Name = 'InformeListadoProveedoresMayorFacturacionResumen' Fields = < - item - Name = 'ANO' - DataType = datSmallInt - end item Name = 'REFERENCIA' DataType = datString @@ -121,16 +140,28 @@ object RptFacturasProveedor: TRptFacturasProveedor DataType = datString Size = 255 end + item + Name = 'ANO1' + DataType = datLargeInt + end + item + Name = 'ANO2' + DataType = datLargeInt + end item Name = 'IMPORTE_TOTAL_ANO' DataType = datCurrency end item Name = 'NUMFAC' - DataType = datInteger + DataType = datLargeInt end item - Name = 'IMPORTE_TOTAL' + Name = 'IMPORTE_TOTAL_ANO1' + DataType = datCurrency + end + item + Name = 'IMPORTE_TOTAL_ANO2' DataType = datCurrency end item @@ -148,6 +179,10 @@ object RptFacturasProveedor: TRptFacturasProveedor Name = 'ANO' Value = '' end + item + Name = 'ANO2' + Value = '' + end item Name = 'NTOP' Value = '' @@ -159,20 +194,28 @@ object RptFacturasProveedor: TRptFacturasProveedor Default = True Name = 'IBX' SQL = - 'select P.ANO, C.REFERENCIA, COALESCE(C.NOMBRE, P.NOMBRE) as NOMB' + - 'RE,'#10'SUM(P.IMPORTE_DESCUENTO) as IMPORTE_DESCUENTO, SUM(P.IMPORTE' + - '_NETO) as IMPORTE_TOTAL,'#10'SUM(P.IMPORTE_TOTAL) as IMPORTE_COBRADO' + - ','#10'case when SUM(P.IMPORTE_NETO) = 0 then 0'#10'else ((SUM(P.IMPORTE_' + - 'DESCUENTO) * 100) / SUM(P.IMPORTE_NETO)) end as PORCENTAJE'#10#10'from' + - ' V_INF_FAC_DET_PROVEEDOR P'#10'left join CONTACTOS C on P.ID_PROVEED' + - 'OR = C.ID'#10#10'where p.ID_EMPRESA = :ID_EMPRESA'#10'and P.ANO = :ANO'#10'gro' + - 'up by 1,2,3'#10'order by 1,5 desc'#10'rows 1 to :NTOP'#10 + 'select REFERENCIA, NOMBRE, sum(ANO1) as ANO1, sum (ANO2) as ANO2' + + ', sum (IMPORTE_DESCUENTO) as IMPORTE_DESCUENTO,'#10'sum (IMPORTE_DES' + + 'CUENTO2) as IMPORTE_DESCUENTO2, sum (IMPORTE_TOTAL) as IMPORTE_T' + + 'OTAL, sum (IMPORTE_COBRADO) as IMPORTE_COBRADO,'#10'sum (PORCENTAJE)' + + ' as PORCENTAJE'#10'from'#10'('#10'select C.REFERENCIA as REFERENCIA, COALESC' + + 'E(C.NOMBRE, P.NOMBRE) as NOMBRE, P.ANO as ANO1, 0 as ANO2,'#10'SUM(P' + + '.IMPORTE_DESCUENTO) as IMPORTE_DESCUENTO, 0 as IMPORTE_DESCUENTO' + + '2, SUM(P.IMPORTE_NETO) as IMPORTE_TOTAL,'#10'SUM(P.IMPORTE_TOTAL) as' + + ' IMPORTE_COBRADO,'#10'case when SUM(P.IMPORTE_NETO) = 0 then 0'#10'else ' + + '((SUM(P.IMPORTE_DESCUENTO) * 100) / SUM(P.IMPORTE_NETO)) end as ' + + 'PORCENTAJE'#10#10'from V_INF_FAC_DET_PROVEEDOR P'#10'left join CONTACTOS C' + + ' on P.ID_PROVEEDOR = C.ID'#10'where p.ID_EMPRESA = :ID_EMPRESA'#10'and P' + + '.ANO = :ANO'#10'group by 1,2,3,4'#10#10'union'#10#10'select C2.REFERENCIA as REF' + + 'ERENCIA, COALESCE(C2.NOMBRE, P2.NOMBRE) as NOMBRE, 0 as ANO1, P2' + + '.ANO as ANO2,'#10' 0 as IMPORTE_DESCUENTO, SUM(P2.IMPORTE_DESCUENTO)' + + ' as IMPORTE_DESCUENTO2, 0 as IMPORTE_TOTAL,'#10' 0 as IMPORTE_COBRAD' + + 'O, 0 as PORCENTAJE'#10'from V_INF_FAC_DET_PROVEEDOR P2'#10'left join CO' + + 'NTACTOS C2 on P2.ID_PROVEEDOR = C2.ID'#10'where p2.ID_EMPRESA = :ID_' + + 'EMPRESA'#10'and P2.ANO = :ANO2'#10'group by 1,2,3,4,5'#10')'#10#10'group by 1,2'#10'ha' + + 'ving (sum(ANO1) > 0)'#10'order by 3,5 desc'#10'rows 1 to :NTOP'#10#10 StatementType = stSQL ColumnMappings = < - item - DatasetField = 'ANO' - TableField = 'ANO' - end item DatasetField = 'REFERENCIA' TableField = 'REFERENCIA' @@ -196,14 +239,22 @@ object RptFacturasProveedor: TRptFacturasProveedor item DatasetField = 'PORCENTAJE' TableField = 'PORCENTAJE' + end + item + DatasetField = 'ANO1' + TableField = 'ANO1' + end + item + DatasetField = 'ANO2' + TableField = 'ANO2' + end + item + DatasetField = 'IMPORTE_DESCUENTO2' + TableField = 'IMPORTE_DESCUENTO2' end> end> Name = 'InformeListadoProveedoresMayorDescuentoResumen' Fields = < - item - Name = 'ANO' - DataType = datSmallInt - end item Name = 'REFERENCIA' DataType = datString @@ -214,10 +265,22 @@ object RptFacturasProveedor: TRptFacturasProveedor DataType = datString Size = 255 end + item + Name = 'ANO1' + DataType = datLargeInt + end + item + Name = 'ANO2' + DataType = datLargeInt + end item Name = 'IMPORTE_DESCUENTO' DataType = datCurrency end + item + Name = 'IMPORTE_DESCUENTO2' + DataType = datCurrency + end item Name = 'IMPORTE_TOTAL' DataType = datCurrency @@ -264,15 +327,15 @@ object RptFacturasProveedor: TRptFacturasProveedor ') then (100 - (periodo2.IMPORTE_TOTAL*100))'#10'else (100 - ((period' + 'o2.IMPORTE_TOTAL*100)/periodo1.IMPORTE_TOTAL))'#10'end as Porcentaje' + #10#10'FROM'#10'periodos_aux'#10'left join'#10'(select comp1.ID_EMPRESA, comp1.AN' + - 'O, TRIMESTRE as NFILA, SUM(comp1.IMPORTE_TOTAL) as IMPORTE_TOTAL' + - #10'from V_INF_FAC_PROVEEDOR comp1'#10'where ID_EMPRESA = :ID_EMPRESA1'#10 + - 'and (ANO = :ANO1)'#10'group by 1,2,3'#10'order by 1 desc,2 asc) periodo1' + - ' on (VALOR = periodo1.NFILA)'#10#10'left join'#10'(select comp2.ID_EMPRESA' + - ', comp2.ANO, TRIMESTRE as NFILA, SUM(comp2.IMPORTE_TOTAL) as IMP' + - 'ORTE_TOTAL'#10'from V_INF_FAC_PROVEEDOR comp2'#10'where ID_EMPRESA = :ID' + - '_EMPRESA2'#10'and (ANO = :ANO2)'#10'group by 1,2,3'#10'order by 1 desc,2 asc' + - ') periodo2 on (VALOR = periodo2.NFILA)'#10#10'where periodo= '#39'TRIMESTR' + - 'AL'#39#10'order by valor asc'#10#10 + 'O, TRIMESTRE as NFILA, SUM(comp1.BASE_IMPONIBLE) as IMPORTE_TOTA' + + 'L'#10'from V_INF_FAC_PROVEEDOR comp1'#10'where ID_EMPRESA = :ID_EMPRESA1' + + #10'and (ANO = :ANO1)'#10'group by 1,2,3'#10'order by 1 desc,2 asc) periodo' + + '1 on (VALOR = periodo1.NFILA)'#10#10'left join'#10'(select comp2.ID_EMPRES' + + 'A, comp2.ANO, TRIMESTRE as NFILA, SUM(comp2.BASE_IMPONIBLE) as I' + + 'MPORTE_TOTAL'#10'from V_INF_FAC_PROVEEDOR comp2'#10'where ID_EMPRESA = :' + + 'ID_EMPRESA2'#10'and (ANO = :ANO2)'#10'group by 1,2,3'#10'order by 1 desc,2 a' + + 'sc) periodo2 on (VALOR = periodo2.NFILA)'#10#10'where periodo= '#39'TRIMES' + + 'TRAL'#39#10'order by valor asc'#10#10 StatementType = stSQL ColumnMappings = < item @@ -377,15 +440,15 @@ object RptFacturasProveedor: TRptFacturasProveedor ') then (100 - (periodo2.IMPORTE_TOTAL*100))'#10'else (100 - ((period' + 'o2.IMPORTE_TOTAL*100)/periodo1.IMPORTE_TOTAL))'#10'end as Porcentaje' + #10#10'FROM'#10'periodos_aux'#10'left join'#10'(select comp1.ID_EMPRESA, comp1.AN' + - 'O, SEMESTRE as NFILA, SUM(comp1.IMPORTE_TOTAL) as IMPORTE_TOTAL'#10 + - 'from V_INF_FAC_PROVEEDOR comp1'#10'where ID_EMPRESA = :ID_EMPRESA1'#10'a' + - 'nd (ANO = :ANO1)'#10'group by 1,2,3'#10'order by 1 desc,2 asc) periodo1 ' + - 'on (VALOR = periodo1.NFILA)'#10#10'left join'#10'(select comp2.ID_EMPRESA,' + - ' comp2.ANO, SEMESTRE as NFILA, SUM(comp2.IMPORTE_TOTAL) as IMPOR' + - 'TE_TOTAL'#10'from V_INF_FAC_PROVEEDOR comp2'#10'where ID_EMPRESA = :ID_E' + - 'MPRESA2'#10'and (ANO = :ANO2)'#10'group by 1,2,3'#10'order by 1 desc,2 asc) ' + - 'periodo2 on (VALOR = periodo2.NFILA)'#10#10'where periodo= '#39'SEMESTRAL'#39 + - #10'order by valor asc'#10#10 + 'O, SEMESTRE as NFILA, SUM(comp1.BASE_IMPONIBLE) as IMPORTE_TOTAL' + + #10'from V_INF_FAC_PROVEEDOR comp1'#10'where ID_EMPRESA = :ID_EMPRESA1'#10 + + 'and (ANO = :ANO1)'#10'group by 1,2,3'#10'order by 1 desc,2 asc) periodo1' + + ' on (VALOR = periodo1.NFILA)'#10#10'left join'#10'(select comp2.ID_EMPRESA' + + ', comp2.ANO, SEMESTRE as NFILA, SUM(comp2.BASE_IMPONIBLE) as IMP' + + 'ORTE_TOTAL'#10'from V_INF_FAC_PROVEEDOR comp2'#10'where ID_EMPRESA = :ID' + + '_EMPRESA2'#10'and (ANO = :ANO2)'#10'group by 1,2,3'#10'order by 1 desc,2 asc' + + ') periodo2 on (VALOR = periodo2.NFILA)'#10#10'where periodo= '#39'SEMESTRA' + + 'L'#39#10'order by valor asc'#10#10 StatementType = stSQL ColumnMappings = < item @@ -490,15 +553,15 @@ object RptFacturasProveedor: TRptFacturasProveedor ') then (100 - (periodo2.IMPORTE_TOTAL*100))'#10'else (100 - ((period' + 'o2.IMPORTE_TOTAL*100)/periodo1.IMPORTE_TOTAL))'#10'end as Porcentaje' + #10#10'FROM'#10'periodos_aux'#10'left join'#10'(select comp1.ID_EMPRESA, comp1.AN' + - 'O, MES as NFILA, SUM(comp1.IMPORTE_TOTAL) as IMPORTE_TOTAL'#10'from ' + - 'V_INF_FAC_PROVEEDOR comp1'#10'where ID_EMPRESA = :ID_EMPRESA1'#10'and (A' + - 'NO = :ANO1)'#10'group by 1,2,3'#10'order by 1 desc,2 asc) periodo1 on (V' + - 'ALOR = periodo1.NFILA)'#10#10'left join'#10'(select comp2.ID_EMPRESA, comp' + - '2.ANO, MES as NFILA, SUM(comp2.IMPORTE_TOTAL) as IMPORTE_TOTAL'#10'f' + - 'rom V_INF_FAC_PROVEEDOR comp2'#10'where ID_EMPRESA = :ID_EMPRESA2'#10'an' + - 'd (ANO = :ANO2)'#10'group by 1,2,3'#10'order by 1 desc,2 asc) periodo2 o' + - 'n (VALOR = periodo2.NFILA)'#10#10'where periodo= '#39'MENSUAL'#39#10'order by va' + - 'lor asc'#10 + 'O, MES as NFILA, SUM(comp1.BASE_IMPONIBLE) as IMPORTE_TOTAL'#10'from' + + ' V_INF_FAC_PROVEEDOR comp1'#10'where ID_EMPRESA = :ID_EMPRESA1'#10'and (' + + 'ANO = :ANO1)'#10'group by 1,2,3'#10'order by 1 desc,2 asc) periodo1 on (' + + 'VALOR = periodo1.NFILA)'#10#10'left join'#10'(select comp2.ID_EMPRESA, com' + + 'p2.ANO, MES as NFILA, SUM(comp2.BASE_IMPONIBLE) as IMPORTE_TOTAL' + + #10'from V_INF_FAC_PROVEEDOR comp2'#10'where ID_EMPRESA = :ID_EMPRESA2'#10 + + 'and (ANO = :ANO2)'#10'group by 1,2,3'#10'order by 1 desc,2 asc) periodo2' + + ' on (VALOR = periodo2.NFILA)'#10#10'where periodo= '#39'MENSUAL'#39#10'order by ' + + 'valor asc'#10 StatementType = stSQL ColumnMappings = < item @@ -2666,10 +2729,6 @@ object RptFacturasProveedor: TRptFacturasProveedor object tbl_InformeListadoProveedoresMayorFacturacionResumen: TDAMemDataTable RemoteUpdatesOptions = [] Fields = < - item - Name = 'ANO' - DataType = datSmallInt - end item Name = 'REFERENCIA' DataType = datString @@ -2680,16 +2739,28 @@ object RptFacturasProveedor: TRptFacturasProveedor DataType = datString Size = 255 end + item + Name = 'ANO1' + DataType = datLargeInt + end + item + Name = 'ANO2' + DataType = datLargeInt + end item Name = 'IMPORTE_TOTAL_ANO' DataType = datCurrency end item Name = 'NUMFAC' - DataType = datInteger + DataType = datLargeInt end item - Name = 'IMPORTE_TOTAL' + Name = 'IMPORTE_TOTAL_ANO1' + DataType = datCurrency + end + item + Name = 'IMPORTE_TOTAL_ANO2' DataType = datCurrency end item @@ -2705,6 +2776,10 @@ object RptFacturasProveedor: TRptFacturasProveedor Name = 'ANO' Value = '' end + item + Name = 'ANO2' + Value = '' + end item Name = 'NTOP' Value = '' @@ -2737,10 +2812,6 @@ object RptFacturasProveedor: TRptFacturasProveedor object tbl_InformeListadoProveedoresMayorDescuentoResumen: TDAMemDataTable RemoteUpdatesOptions = [] Fields = < - item - Name = 'ANO' - DataType = datSmallInt - end item Name = 'REFERENCIA' DataType = datString @@ -2751,10 +2822,22 @@ object RptFacturasProveedor: TRptFacturasProveedor DataType = datString Size = 255 end + item + Name = 'ANO1' + DataType = datLargeInt + end + item + Name = 'ANO2' + DataType = datLargeInt + end item Name = 'IMPORTE_DESCUENTO' DataType = datCurrency end + item + Name = 'IMPORTE_DESCUENTO2' + DataType = datCurrency + end item Name = 'IMPORTE_TOTAL' DataType = datCurrency @@ -2765,7 +2848,7 @@ object RptFacturasProveedor: TRptFacturasProveedor end item Name = 'PORCENTAJE' - DataType = datCurrency + DataType = datDecimal end> Params = < item @@ -2776,6 +2859,10 @@ object RptFacturasProveedor: TRptFacturasProveedor Name = 'ANO' Value = '' end + item + Name = 'ANO2' + Value = '' + end item Name = 'NTOP' Value = '' diff --git a/Source/Modulos/Facturas de proveedor/Reports/uRptFacturasProveedor_Server.pas b/Source/Modulos/Facturas de proveedor/Reports/uRptFacturasProveedor_Server.pas index 9bf9feb..ec905aa 100644 --- a/Source/Modulos/Facturas de proveedor/Reports/uRptFacturasProveedor_Server.pas +++ b/Source/Modulos/Facturas de proveedor/Reports/uRptFacturasProveedor_Server.pas @@ -636,6 +636,7 @@ begin ATabla.ParamByName('ID_EMPRESA').AsInteger := FIdEmpresa; ATabla.ParamByName('ANO').AsVariant := FAno1; + ATabla.ParamByName('ANO2').AsVariant := FAno2; ATabla.ParamByName('NTOP').AsInteger := FTopN; ATabla.Active := True; end; diff --git a/Source/Servidor/FactuGES_Server.RES b/Source/Servidor/FactuGES_Server.RES index c1c9f94..f07adb0 100644 Binary files a/Source/Servidor/FactuGES_Server.RES and b/Source/Servidor/FactuGES_Server.RES differ diff --git a/Source/Servidor/FactuGES_Server.dproj b/Source/Servidor/FactuGES_Server.dproj index 32f4237..c04c115 100644 --- a/Source/Servidor/FactuGES_Server.dproj +++ b/Source/Servidor/FactuGES_Server.dproj @@ -35,7 +35,7 @@ Delphi.Personality - FalseTrueFalse/standaloneTrueFalse4240FalseFalseFalseFalseFalse308212524.2.4.04.2.4.0lunes, 30 de julio de 2012 17:17 + FalseTrueFalse/standaloneTrueFalse4250FalseFalseFalseFalseFalse308212524.2.5.04.2.5.0viernes, 31 de agosto de 2012 19:05 ExpressPrinting System by Developer Express Inc. FactuGES_Server.dprFalse diff --git a/Source/Servidor/FactuGES_Server.rc b/Source/Servidor/FactuGES_Server.rc index 93fd221..dd75013 100644 --- a/Source/Servidor/FactuGES_Server.rc +++ b/Source/Servidor/FactuGES_Server.rc @@ -1,7 +1,7 @@ MAINICON ICON "C:\Codigo\Resources\Iconos\Servidor.ico" 1 VERSIONINFO -FILEVERSION 4,2,4,0 -PRODUCTVERSION 4,2,4,0 +FILEVERSION 4,2,5,0 +PRODUCTVERSION 4,2,5,0 FILEFLAGSMASK 0x3FL FILEFLAGS 0x00L FILEOS 0x40004L @@ -12,9 +12,9 @@ BEGIN BEGIN BLOCK "0C0A04E4" BEGIN - VALUE "FileVersion", "4.2.4.0\0" - VALUE "ProductVersion", "4.2.4.0\0" - VALUE "CompileDate", "viernes, 31 de agosto de 2012 19:05\0" + VALUE "FileVersion", "4.2.5.0\0" + VALUE "ProductVersion", "4.2.5.0\0" + VALUE "CompileDate", "lunes, 15 de octubre de 2012 18:34\0" END END BLOCK "VarFileInfo"