Informes
git-svn-id: https://192.168.0.254/svn/Proyectos.LuisLeon_FactuGES/trunk@84 c93665c3-c93d-084d-9b98-7d5f4a9c3376
This commit is contained in:
parent
f9c4563427
commit
48c4934983
Binary file not shown.
@ -2098,7 +2098,7 @@ AND (ARTICULOS.INVENTARIABLE = 1);
|
||||
CREATE VIEW V_VENTAS_ARTICULOS(
|
||||
ID_FACTURA,
|
||||
ID_EMPRESA,
|
||||
ID_REFERENCIA_FACTURA,
|
||||
REFERENCIA_FACTURA,
|
||||
FECHA_FACTURA,
|
||||
IMPORTE_TOTAL_FACTURA,
|
||||
ID_COMISION_FACTURA,
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@ -100,6 +100,7 @@ contains
|
||||
MD5 in 'Utiles\MD5.pas',
|
||||
uPasswordUtils in 'Utiles\uPasswordUtils.pas',
|
||||
uInfoProjectUtils in 'Utiles\uInfoProjectUtils.pas',
|
||||
uActualizacion in 'uActualizacion.pas' {fActualizacion: Form};
|
||||
uActualizacion in 'uActualizacion.pas' {fActualizacion: Form},
|
||||
uInformeRegistryUtils in 'ClassRegistry\uInformeRegistryUtils.pas';
|
||||
|
||||
end.
|
||||
|
||||
Binary file not shown.
@ -32,11 +32,17 @@ type
|
||||
end;
|
||||
|
||||
IDataModuleRegistry = Interface( IComponentRegistry )
|
||||
['{28E3BF72-1378-4136-B1FB-027FBB8FE99B}']
|
||||
['{9D8D1D23-6A5C-4351-9393-093CD8B76788}']
|
||||
function CreateDatamodule( const aClassOrDisplayname: String;
|
||||
aOwner: TComponent = nil ): TDatamodule;
|
||||
end;
|
||||
|
||||
IReportRegistry = Interface( IComponentRegistry )
|
||||
['{49D3C8D5-8FEE-4F15-A6D2-51CB1DB29F8D}']
|
||||
function CreateReport( const aClassOrDisplayname: String;
|
||||
aOwner: TComponent = nil ): TInterfacedObject;
|
||||
end;
|
||||
|
||||
TClassRegistry = class( TInterfacedObject, IClassRegistry )
|
||||
private
|
||||
FList: TStringlist;
|
||||
@ -88,6 +94,13 @@ type
|
||||
aOwner: TComponent = nil ): TDatamodule;
|
||||
end;
|
||||
|
||||
TReportRegistry = class( TComponentRegistry, IReportRegistry )
|
||||
protected
|
||||
procedure ValidateMinAcceptableClass(var aMinAcceptableClass: TClass ); override;
|
||||
function CreateReport( const aClassOrDisplayname: String;
|
||||
aOwner: TComponent = nil ): TInterfacedObject;
|
||||
end;
|
||||
|
||||
EClassRegistryError = class( Exception );
|
||||
|
||||
implementation
|
||||
@ -302,4 +315,22 @@ begin
|
||||
aMinAcceptableClass := TDatamodule;
|
||||
end;
|
||||
|
||||
{ TReportRegistry }
|
||||
|
||||
function TReportRegistry.CreateReport(const aClassOrDisplayname: String;
|
||||
aOwner: TComponent): TInterfacedObject;
|
||||
begin
|
||||
Result := CreateObject( aClassOrDisplayname) As TInterfacedObject;
|
||||
// Result := CreateComponent( aClassOrDisplayname, aOwner ) As TInterfacedObject;
|
||||
end;
|
||||
|
||||
procedure TReportRegistry.ValidateMinAcceptableClass(
|
||||
var aMinAcceptableClass: TClass);
|
||||
begin
|
||||
inherited;
|
||||
If not aMinAcceptableClass.InheritsFrom( TInterfacedObject )
|
||||
Then
|
||||
aMinAcceptableClass := TInterfacedObject;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
59
Source/Base/ClassRegistry/uInformeRegistryUtils.pas
Normal file
59
Source/Base/ClassRegistry/uInformeRegistryUtils.pas
Normal file
@ -0,0 +1,59 @@
|
||||
unit uInformeRegistryUtils;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, Forms, uClassRegistryUtils;
|
||||
|
||||
type
|
||||
IInformeRegistry = interface (IReportRegistry)
|
||||
['{F6AC050F-5547-4E1F-AA44-DA0D06EDA4D7}']
|
||||
function CreateInforme(const aClassOrDisplayname: String;
|
||||
aOwner: TComponent = NIL): TInterfacedObject;
|
||||
end;
|
||||
|
||||
TInformeRegistry = class(TReportRegistry, IInformeRegistry)
|
||||
protected
|
||||
function CreateInforme(const aClassOrDisplayname: String;
|
||||
aOwner: TComponent = nil): TInterfacedObject;
|
||||
end;
|
||||
|
||||
function CreateInforme(const AName: String; const IID: TGUID; out Intf): Boolean;
|
||||
|
||||
var
|
||||
InformeRegistry : IInformeRegistry;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
SysUtils, cxControls;
|
||||
|
||||
function CreateInforme(const AName: String; const IID: TGUID; out Intf): Boolean;
|
||||
begin
|
||||
ShowHourglassCursor;
|
||||
try
|
||||
Result := Supports(InformeRegistry.CreateInforme(AName, Application), IID, Intf);
|
||||
finally
|
||||
HideHourglassCursor;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
{ TInformeRegistry }
|
||||
|
||||
function TInformeRegistry.CreateInforme(const aClassOrDisplayname: String;
|
||||
aOwner: TComponent): TInterfacedObject;
|
||||
begin
|
||||
if not Assigned(AOwner) then
|
||||
AOwner := Application;
|
||||
Result := CreateObject( aClassOrDisplayname) as TInterfacedObject;
|
||||
end;
|
||||
|
||||
|
||||
initialization
|
||||
InformeRegistry := TInformeRegistry.Create;
|
||||
|
||||
finalization
|
||||
InformeRegistry := NIL;
|
||||
|
||||
end.
|
||||
@ -577,6 +577,8 @@ object fPantallaPrincipal: TfPantallaPrincipal
|
||||
end
|
||||
end
|
||||
object JvXPMenuItemPainter1: TJvXPMenuItemPainter
|
||||
SelectionFrameBrush.Color = 13811126
|
||||
SelectionFramePen.Color = 6956042
|
||||
Left = 424
|
||||
Top = 256
|
||||
end
|
||||
|
||||
@ -463,6 +463,10 @@ begin
|
||||
HostManager.LoadModule('HistoricoMovimientos_plugin.bpl');
|
||||
HostManager.LoadModule('RemesasProveedor_plugin.bpl');
|
||||
HostManager.LoadModule('Referencias_plugin.bpl');
|
||||
|
||||
HostManager.LoadModule('Informes_plugin.bpl');
|
||||
HostManager.LoadModule('InfVentasArticulo_plugin.bpl');
|
||||
|
||||
{
|
||||
HostManager.LoadModule('PedidosMontaje_plugin.bpl');
|
||||
HostManager.LoadModule('CobrosMontaje_plugin.bpl');
|
||||
|
||||
@ -8,13 +8,7 @@
|
||||
<Option Name="GUID">{897CD5E4-3D47-418F-BD7A-AD0C0C4FDE6A}</Option>
|
||||
</Option>
|
||||
</PersonalityInfo>
|
||||
<Default.Personality>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<Projects>
|
||||
<Default.Personality> <Projects>
|
||||
<Projects Name="DataAbstract_D10.bpl">DataAbstract_D10\DataAbstract_D10.bdsproj</Projects>
|
||||
<Projects Name="Base.bpl">Base\Base.bdsproj</Projects>
|
||||
<Projects Name="ControllerBase.bpl">Base\ControllerBase\ControllerBase.bdsproj</Projects>
|
||||
@ -25,11 +19,6 @@
|
||||
<Projects Name="Usuarios.bpl">Base\Usuarios\Usuarios.bdsproj</Projects>
|
||||
<Projects Name="Empresas_view.bpl">Modulos\Empresas\Views\Empresas_view.bdsproj</Projects>
|
||||
<Projects Name="Empresas_plugin.bpl">Modulos\Empresas\Plugin\Empresas_plugin.bdsproj</Projects>
|
||||
<Projects Name="FormasPago_model.bpl">Modulos\Formas de pago\Model\FormasPago_model.bdsproj</Projects>
|
||||
<Projects Name="FormasPago_data.bpl">Modulos\Formas de pago\Data\FormasPago_data.bdsproj</Projects>
|
||||
<Projects Name="FormasPago_controller.bpl">Modulos\Formas de pago\Controller\FormasPago_controller.bdsproj</Projects>
|
||||
<Projects Name="FormasPago_view.bpl">Modulos\Formas de pago\Views\FormasPago_view.bdsproj</Projects>
|
||||
<Projects Name="FormasPago_plugin.bpl">Modulos\Formas de pago\Plugin\FormasPago_plugin.bdsproj</Projects>
|
||||
<Projects Name="TiposIVA_model.bpl">Modulos\Tipos de IVA\Model\TiposIVA_model.bdsproj</Projects>
|
||||
<Projects Name="TiposIVA_data.bpl">Modulos\Tipos de IVA\Data\TiposIVA_data.bdsproj</Projects>
|
||||
<Projects Name="TiposIVA_controller.bpl">Modulos\Tipos de IVA\Controller\TiposIVA_controller.bdsproj</Projects>
|
||||
@ -45,11 +34,6 @@
|
||||
<Projects Name="Almacenes_controller.bpl">Modulos\Almacenes\Controller\Almacenes_controller.bdsproj</Projects>
|
||||
<Projects Name="Almacenes_view.bpl">Modulos\Almacenes\Views\Almacenes_view.bdsproj</Projects>
|
||||
<Projects Name="Almacenes_plugin.bpl">Modulos\Almacenes\Plugin\Almacenes_plugin.bdsproj</Projects>
|
||||
<Projects Name="Familias_model.bpl">Modulos\Familias\Model\Familias_model.bdsproj</Projects>
|
||||
<Projects Name="Familias_data.bpl">Modulos\Familias\Data\Familias_data.bdsproj</Projects>
|
||||
<Projects Name="Familias_controller.bpl">Modulos\Familias\Controller\Familias_controller.bdsproj</Projects>
|
||||
<Projects Name="Familias_view.bpl">Modulos\Familias\Views\Familias_view.bdsproj</Projects>
|
||||
<Projects Name="Familias_plugin.bpl">Modulos\Familias\Plugin\Familias_plugin.bdsproj</Projects>
|
||||
<Projects Name="Articulos_model.bpl">Modulos\Articulos\Model\Articulos_model.bdsproj</Projects>
|
||||
<Projects Name="Articulos_data.bpl">Modulos\Articulos\Data\Articulos_data.bdsproj</Projects>
|
||||
<Projects Name="Articulos_controller.bpl">Modulos\Articulos\Controller\Articulos_controller.bdsproj</Projects>
|
||||
@ -101,12 +85,19 @@
|
||||
<Projects Name="AlbaranesProveedor_plugin.bpl">Modulos\Albaranes de proveedor\Plugin\AlbaranesProveedor_plugin.bdsproj</Projects>
|
||||
<Projects Name="FactuGES.exe">Cliente\FactuGES.bdsproj</Projects>
|
||||
<Projects Name="FactuGES_Server.exe">Servidor\FactuGES_Server.bdsproj</Projects>
|
||||
<Projects Name="Referencias_model.bpl">Modulos\Referencias\Model\Referencias_model.bdsproj</Projects>
|
||||
<Projects Name="Referencias_data.bpl">Modulos\Referencias\Data\Referencias_data.bdsproj</Projects>
|
||||
<Projects Name="Referencias_controller.bpl">Modulos\Referencias\Controller\Referencias_controller.bdsproj</Projects>
|
||||
<Projects Name="Referencias_view.bpl">Modulos\Referencias\Views\Referencias_view.bdsproj</Projects>
|
||||
<Projects Name="Referencias_plugin.bpl">Modulos\Referencias\Plugin\Referencias_plugin.bdsproj</Projects>
|
||||
<Projects Name="Targets">DataAbstract_D10.bpl Base.bpl ControllerBase.bpl GUIBase.bpl Empresas_model.bpl Empresas_data.bpl Empresas_controller.bpl Usuarios.bpl Empresas_view.bpl Empresas_plugin.bpl FormasPago_model.bpl FormasPago_data.bpl FormasPago_controller.bpl FormasPago_view.bpl FormasPago_plugin.bpl TiposIVA_model.bpl TiposIVA_data.bpl TiposIVA_controller.bpl TiposIVA_view.bpl TiposIVA_plugin.bpl Contactos_model.bpl Contactos_data.bpl Contactos_controller.bpl Contactos_view.bpl Contactos_plugin.bpl Almacenes_model.bpl Almacenes_data.bpl Almacenes_controller.bpl Almacenes_view.bpl Almacenes_plugin.bpl Familias_model.bpl Familias_data.bpl Familias_controller.bpl Familias_view.bpl Familias_plugin.bpl Articulos_model.bpl Articulos_data.bpl Articulos_controller.bpl Articulos_view.bpl Articulos_plugin.bpl RecibosCliente_model.bpl RecibosCliente_data.bpl RecibosCliente_controller.bpl RecibosCliente_view.bpl RecibosCliente_plugin.bpl RemesasCliente_model.bpl RemesasCliente_data.bpl RemesasCliente_controller.bpl BancaElectronica_controller.bpl BancaElectronica_view.bpl RemesasCliente_view.bpl RemesasCliente_plugin.bpl PedidosCliente_model.bpl PedidosCliente_data.bpl PedidosCliente_controller.bpl AlbaranesCliente_model.bpl AlbaranesCliente_data.bpl AlbaranesCliente_controller.bpl FacturasCliente_model.bpl FacturasCliente_data.bpl FacturasCliente_controller.bpl PedidosProveedor_model.bpl PedidosProveedor_data.bpl PedidosProveedor_controller.bpl Inventario_model.bpl Inventario_data.bpl Inventario_controller.bpl AlbaranesProveedor_model.bpl AlbaranesProveedor_data.bpl AlbaranesProveedor_controller.bpl PedCli_PedProv_relation.bpl PedCli_AlbCli_relation.bpl PedidosCliente_view.bpl PedidosCliente_plugin.bpl AlbaranesCliente_view.bpl AlbaranesCliente_plugin.bpl FacturasCliente_view.bpl FacturasCliente_plugin.bpl Inventario_view.bpl Inventario_plugin.bpl PedidosProveedor_view.bpl PedidosProveedor_plugin.bpl AlbaranesProveedor_view.bpl AlbaranesProveedor_plugin.bpl FactuGES.exe FactuGES_Server.exe Referencias_model.bpl Referencias_data.bpl Referencias_controller.bpl Referencias_view.bpl Referencias_plugin.bpl</Projects>
|
||||
<Projects Name="Informes_model.bpl">Modulos\Informes base\Model\Informes_model.bdsproj</Projects>
|
||||
<Projects Name="Informes_data.bpl">Modulos\Informes base\Data\Informes_data.bdsproj</Projects>
|
||||
<Projects Name="InformesBase_controller.bpl">Modulos\Informes base\Controller\InformesBase_controller.bdsproj</Projects>
|
||||
<Projects Name="Informes_controller.bpl">Modulos\Informes base\Controller\Informes_controller.bdsproj</Projects>
|
||||
<Projects Name="Informes_view.bpl">Modulos\Informes base\Views\Informes_view.bdsproj</Projects>
|
||||
<Projects Name="InformesBase_view.bpl">Modulos\Informes base\Views\InformesBase_view.bdsproj</Projects>
|
||||
<Projects Name="Informes_plugin.bpl">Modulos\Informes base\Plugin\Informes_plugin.bdsproj</Projects>
|
||||
<Projects Name="InfVentasArticulo_model.bpl">Modulos\Informe ventas por articulo\Model\InfVentasArticulo_model.bdsproj</Projects>
|
||||
<Projects Name="InfVentasArticulo_data.bpl">Modulos\Informe ventas por articulo\Data\InfVentasArticulo_data.bdsproj</Projects>
|
||||
<Projects Name="InfVentasArticulo_controller.bpl">Modulos\Informe ventas por articulo\Controller\InfVentasArticulo_controller.bdsproj</Projects>
|
||||
<Projects Name="InfVentasArticulo_view.bpl">Modulos\Informe ventas por articulo\Views\InfVentasArticulo_view.bdsproj</Projects>
|
||||
<Projects Name="InfVentasArticulo_plugin.bpl">Modulos\Informe ventas por articulo\Plugin\InfVentasArticulo_plugin.bdsproj</Projects>
|
||||
<Projects Name="Targets">DataAbstract_D10.bpl Base.bpl ControllerBase.bpl GUIBase.bpl Empresas_model.bpl Empresas_data.bpl Empresas_controller.bpl Usuarios.bpl Empresas_view.bpl Empresas_plugin.bpl TiposIVA_model.bpl TiposIVA_data.bpl TiposIVA_controller.bpl TiposIVA_view.bpl TiposIVA_plugin.bpl Contactos_model.bpl Contactos_data.bpl Contactos_controller.bpl Contactos_view.bpl Contactos_plugin.bpl Almacenes_model.bpl Almacenes_data.bpl Almacenes_controller.bpl Almacenes_view.bpl Almacenes_plugin.bpl Articulos_model.bpl Articulos_data.bpl Articulos_controller.bpl Articulos_view.bpl Articulos_plugin.bpl RecibosCliente_model.bpl RecibosCliente_data.bpl RecibosCliente_controller.bpl RecibosCliente_view.bpl RecibosCliente_plugin.bpl RemesasCliente_model.bpl RemesasCliente_data.bpl RemesasCliente_controller.bpl BancaElectronica_controller.bpl BancaElectronica_view.bpl RemesasCliente_view.bpl RemesasCliente_plugin.bpl PedidosCliente_model.bpl PedidosCliente_data.bpl PedidosCliente_controller.bpl AlbaranesCliente_model.bpl AlbaranesCliente_data.bpl AlbaranesCliente_controller.bpl FacturasCliente_model.bpl FacturasCliente_data.bpl FacturasCliente_controller.bpl PedidosProveedor_model.bpl PedidosProveedor_data.bpl PedidosProveedor_controller.bpl Inventario_model.bpl Inventario_data.bpl Inventario_controller.bpl AlbaranesProveedor_model.bpl AlbaranesProveedor_data.bpl AlbaranesProveedor_controller.bpl PedCli_PedProv_relation.bpl PedCli_AlbCli_relation.bpl PedidosCliente_view.bpl PedidosCliente_plugin.bpl AlbaranesCliente_view.bpl AlbaranesCliente_plugin.bpl FacturasCliente_view.bpl FacturasCliente_plugin.bpl Inventario_view.bpl Inventario_plugin.bpl PedidosProveedor_view.bpl PedidosProveedor_plugin.bpl AlbaranesProveedor_view.bpl AlbaranesProveedor_plugin.bpl FactuGES.exe FactuGES_Server.exe Informes_model.bpl Informes_data.bpl InformesBase_controller.bpl Informes_controller.bpl Informes_view.bpl InformesBase_view.bpl Informes_plugin.bpl InfVentasArticulo_model.bpl InfVentasArticulo_data.bpl InfVentasArticulo_controller.bpl InfVentasArticulo_view.bpl InfVentasArticulo_plugin.bpl</Projects>
|
||||
</Projects>
|
||||
<Dependencies/>
|
||||
</Default.Personality>
|
||||
|
||||
@ -510,6 +510,54 @@
|
||||
</Interface>
|
||||
</Interfaces>
|
||||
</Service>
|
||||
<Service Name="srvInformes" UID="{F9CF6FB0-FD73-40E3-88C9-48D7981DF770}" Ancestor="DARemoteService">
|
||||
<Interfaces>
|
||||
<Interface Name="Default" UID="{2E96455F-58CB-4DE2-9D3C-D590DAEA6DB4}">
|
||||
<Operations>
|
||||
<Operation Name="GetNextAutoInc" UID="{3D18DF4C-CA7B-4B40-9B29-46A649D9DBB8}">
|
||||
<Parameters>
|
||||
<Parameter Name="Result" DataType="Integer" Flag="Result">
|
||||
</Parameter>
|
||||
<Parameter Name="GeneratorName" DataType="String" Flag="In" >
|
||||
</Parameter>
|
||||
</Parameters>
|
||||
</Operation>
|
||||
</Operations>
|
||||
</Interface>
|
||||
</Interfaces>
|
||||
</Service>
|
||||
<Service Name="srvInfVentasArticulo" UID="{07AA678D-ED16-4C0B-A327-FA0A456D0376}" Ancestor="DARemoteService">
|
||||
<Interfaces>
|
||||
<Interface Name="Default" UID="{31CD7B1B-CA98-4F92-A6D5-B3B02360613F}">
|
||||
<Operations>
|
||||
<Operation Name="GetData" UID="{D080A686-76BA-4C2F-AD01-56FAFDA54586}">
|
||||
<Parameters>
|
||||
<Parameter Name="Result" DataType="Binary" Flag="Result">
|
||||
</Parameter>
|
||||
<Parameter Name="DatasetName" DataType="String" Flag="In" >
|
||||
</Parameter>
|
||||
<Parameter Name="MaxRecords" DataType="Integer" Flag="In" >
|
||||
</Parameter>
|
||||
<Parameter Name="Columns" DataType="String" Flag="In" >
|
||||
</Parameter>
|
||||
<Parameter Name="Params" DataType="TDADatasetParamArray" Flag="In" >
|
||||
</Parameter>
|
||||
</Parameters>
|
||||
</Operation>
|
||||
<Operation Name="GetSchema" UID="{C6A0FD57-73EC-4D1D-BA4C-54DF90C39F7B}">
|
||||
<Parameters>
|
||||
<Parameter Name="Result" DataType="Binary" Flag="Result">
|
||||
</Parameter>
|
||||
<Parameter Name="DatasetName" DataType="String" Flag="In" >
|
||||
</Parameter>
|
||||
<Parameter Name="Columns" DataType="String" Flag="In" >
|
||||
</Parameter>
|
||||
</Parameters>
|
||||
</Operation>
|
||||
</Operations>
|
||||
</Interface>
|
||||
</Interfaces>
|
||||
</Service>
|
||||
</Services>
|
||||
<Structs>
|
||||
<Struct Name="TRdxLoginInfo" UID="{9F208C71-2B14-4C46-949C-42D84960FC58}" AutoCreateParams="1">
|
||||
|
||||
@ -44,6 +44,8 @@ const
|
||||
IsrvHistoricoMovimientos_IID : TGUID = '{F1BE4D4C-017B-476D-A009-0D1B8D1A20CE}';
|
||||
IsrvRemesasProveedor_IID : TGUID = '{6540A037-9847-4650-89BB-7B349C6004DF}';
|
||||
IsrvReferencias_IID : TGUID = '{5EFE7CE2-3D74-4B4C-8D7A-0926A1D7A5BB}';
|
||||
IsrvInformes_IID : TGUID = '{2E96455F-58CB-4DE2-9D3C-D590DAEA6DB4}';
|
||||
IsrvInfVentasArticulo_IID : TGUID = '{31CD7B1B-CA98-4F92-A6D5-B3B02360613F}';
|
||||
|
||||
{ Event ID's }
|
||||
|
||||
@ -73,6 +75,8 @@ type
|
||||
IsrvHistoricoMovimientos = interface;
|
||||
IsrvRemesasProveedor = interface;
|
||||
IsrvReferencias = interface;
|
||||
IsrvInformes = interface;
|
||||
IsrvInfVentasArticulo = interface;
|
||||
|
||||
TRdxEmpresasArray = class;
|
||||
|
||||
@ -624,6 +628,46 @@ type
|
||||
|
||||
end;
|
||||
|
||||
{ IsrvInformes }
|
||||
IsrvInformes = interface(IDARemoteService)
|
||||
['{2E96455F-58CB-4DE2-9D3C-D590DAEA6DB4}']
|
||||
function GetNextAutoInc(const GeneratorName: String): Integer;
|
||||
end;
|
||||
|
||||
{ CosrvInformes }
|
||||
CosrvInformes = class
|
||||
class function Create(const aMessage: IROMessage; aTransportChannel: IROTransportChannel): IsrvInformes;
|
||||
end;
|
||||
|
||||
{ TsrvInformes_Proxy }
|
||||
TsrvInformes_Proxy = class(TDARemoteService_Proxy, IsrvInformes)
|
||||
protected
|
||||
function __GetInterfaceName:string; override;
|
||||
|
||||
function GetNextAutoInc(const GeneratorName: String): Integer;
|
||||
end;
|
||||
|
||||
{ IsrvInfVentasArticulo }
|
||||
IsrvInfVentasArticulo = interface(IDARemoteService)
|
||||
['{31CD7B1B-CA98-4F92-A6D5-B3B02360613F}']
|
||||
function GetData(const DatasetName: String; const MaxRecords: Integer; const Columns: String; const Params: TDADatasetParamArray): Binary;
|
||||
function GetSchema(const DatasetName: String; const Columns: String): Binary;
|
||||
end;
|
||||
|
||||
{ CosrvInfVentasArticulo }
|
||||
CosrvInfVentasArticulo = class
|
||||
class function Create(const aMessage: IROMessage; aTransportChannel: IROTransportChannel): IsrvInfVentasArticulo;
|
||||
end;
|
||||
|
||||
{ TsrvInfVentasArticulo_Proxy }
|
||||
TsrvInfVentasArticulo_Proxy = class(TDARemoteService_Proxy, IsrvInfVentasArticulo)
|
||||
protected
|
||||
function __GetInterfaceName:string; override;
|
||||
|
||||
function GetData(const DatasetName: String; const MaxRecords: Integer; const Columns: String; const Params: TDADatasetParamArray): Binary;
|
||||
function GetSchema(const DatasetName: String; const Columns: String): Binary;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
@ -2012,6 +2056,109 @@ begin
|
||||
result := 'srvReferencias';
|
||||
end;
|
||||
|
||||
{ CosrvInformes }
|
||||
|
||||
class function CosrvInformes.Create(const aMessage: IROMessage; aTransportChannel: IROTransportChannel): IsrvInformes;
|
||||
begin
|
||||
result := TsrvInformes_Proxy.Create(aMessage, aTransportChannel);
|
||||
end;
|
||||
|
||||
{ TsrvInformes_Proxy }
|
||||
|
||||
function TsrvInformes_Proxy.__GetInterfaceName:string;
|
||||
begin
|
||||
result := 'srvInformes';
|
||||
end;
|
||||
|
||||
function TsrvInformes_Proxy.GetNextAutoInc(const GeneratorName: String): Integer;
|
||||
var
|
||||
__request, __response : TMemoryStream;
|
||||
begin
|
||||
__request := TMemoryStream.Create;
|
||||
__response := TMemoryStream.Create;
|
||||
|
||||
try
|
||||
__Message.Initialize(__TransportChannel, 'FactuGES', __InterfaceName, 'GetNextAutoInc');
|
||||
__Message.Write('GeneratorName', TypeInfo(String), GeneratorName, []);
|
||||
__Message.Finalize;
|
||||
|
||||
__Message.WriteToStream(__request);
|
||||
__TransportChannel.Dispatch(__request, __response);
|
||||
__Message.ReadFromStream(__response);
|
||||
|
||||
__Message.Read('Result', TypeInfo(Integer), result, []);
|
||||
finally
|
||||
__request.Free;
|
||||
__response.Free;
|
||||
end
|
||||
end;
|
||||
|
||||
{ CosrvInfVentasArticulo }
|
||||
|
||||
class function CosrvInfVentasArticulo.Create(const aMessage: IROMessage; aTransportChannel: IROTransportChannel): IsrvInfVentasArticulo;
|
||||
begin
|
||||
result := TsrvInfVentasArticulo_Proxy.Create(aMessage, aTransportChannel);
|
||||
end;
|
||||
|
||||
{ TsrvInfVentasArticulo_Proxy }
|
||||
|
||||
function TsrvInfVentasArticulo_Proxy.__GetInterfaceName:string;
|
||||
begin
|
||||
result := 'srvInfVentasArticulo';
|
||||
end;
|
||||
|
||||
function TsrvInfVentasArticulo_Proxy.GetData(const DatasetName: String; const MaxRecords: Integer; const Columns: String; const Params: TDADatasetParamArray): Binary;
|
||||
var
|
||||
__request, __response : TMemoryStream;
|
||||
begin
|
||||
result := nil;
|
||||
__request := TMemoryStream.Create;
|
||||
__response := TMemoryStream.Create;
|
||||
|
||||
try
|
||||
__Message.Initialize(__TransportChannel, 'FactuGES', __InterfaceName, 'GetData');
|
||||
__Message.Write('DatasetName', TypeInfo(String), DatasetName, []);
|
||||
__Message.Write('MaxRecords', TypeInfo(Integer), MaxRecords, []);
|
||||
__Message.Write('Columns', TypeInfo(String), Columns, []);
|
||||
__Message.Write('Params', TypeInfo(DataAbstract_Intf.TDADatasetParamArray), Params, []);
|
||||
__Message.Finalize;
|
||||
|
||||
__Message.WriteToStream(__request);
|
||||
__TransportChannel.Dispatch(__request, __response);
|
||||
__Message.ReadFromStream(__response);
|
||||
|
||||
__Message.Read('Result', TypeInfo(Binary), result, []);
|
||||
finally
|
||||
__request.Free;
|
||||
__response.Free;
|
||||
end
|
||||
end;
|
||||
|
||||
function TsrvInfVentasArticulo_Proxy.GetSchema(const DatasetName: String; const Columns: String): Binary;
|
||||
var
|
||||
__request, __response : TMemoryStream;
|
||||
begin
|
||||
result := nil;
|
||||
__request := TMemoryStream.Create;
|
||||
__response := TMemoryStream.Create;
|
||||
|
||||
try
|
||||
__Message.Initialize(__TransportChannel, 'FactuGES', __InterfaceName, 'GetSchema');
|
||||
__Message.Write('DatasetName', TypeInfo(String), DatasetName, []);
|
||||
__Message.Write('Columns', TypeInfo(String), Columns, []);
|
||||
__Message.Finalize;
|
||||
|
||||
__Message.WriteToStream(__request);
|
||||
__TransportChannel.Dispatch(__request, __response);
|
||||
__Message.ReadFromStream(__response);
|
||||
|
||||
__Message.Read('Result', TypeInfo(Binary), result, []);
|
||||
finally
|
||||
__request.Free;
|
||||
__response.Free;
|
||||
end
|
||||
end;
|
||||
|
||||
initialization
|
||||
RegisterROClass(TRdxLoginInfo);
|
||||
RegisterROClass(TRdxEmpresasArray);
|
||||
@ -2039,6 +2186,8 @@ initialization
|
||||
RegisterProxyClass(IsrvHistoricoMovimientos_IID, TsrvHistoricoMovimientos_Proxy);
|
||||
RegisterProxyClass(IsrvRemesasProveedor_IID, TsrvRemesasProveedor_Proxy);
|
||||
RegisterProxyClass(IsrvReferencias_IID, TsrvReferencias_Proxy);
|
||||
RegisterProxyClass(IsrvInformes_IID, TsrvInformes_Proxy);
|
||||
RegisterProxyClass(IsrvInfVentasArticulo_IID, TsrvInfVentasArticulo_Proxy);
|
||||
|
||||
|
||||
finalization
|
||||
@ -2068,5 +2217,7 @@ finalization
|
||||
UnregisterProxyClass(IsrvHistoricoMovimientos_IID);
|
||||
UnregisterProxyClass(IsrvRemesasProveedor_IID);
|
||||
UnregisterProxyClass(IsrvReferencias_IID);
|
||||
UnregisterProxyClass(IsrvInformes_IID);
|
||||
UnregisterProxyClass(IsrvInfVentasArticulo_IID);
|
||||
|
||||
end.
|
||||
|
||||
@ -200,6 +200,21 @@ type
|
||||
published
|
||||
end;
|
||||
|
||||
TsrvInformes_Invoker = class(TDARemoteService_Invoker)
|
||||
private
|
||||
protected
|
||||
published
|
||||
procedure Invoke_GetNextAutoInc(const __Instance:IInterface; const __Message:IROMessage; const __Transport:IROTransport; out __oResponseOptions:TROResponseOptions);
|
||||
end;
|
||||
|
||||
TsrvInfVentasArticulo_Invoker = class(TDARemoteService_Invoker)
|
||||
private
|
||||
protected
|
||||
published
|
||||
procedure Invoke_GetData(const __Instance:IInterface; const __Message:IROMessage; const __Transport:IROTransport; out __oResponseOptions:TROResponseOptions);
|
||||
procedure Invoke_GetSchema(const __Instance:IInterface; const __Message:IROMessage; const __Transport:IROTransport; out __oResponseOptions:TROResponseOptions);
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
@ -1108,4 +1123,91 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
{ TsrvInformes_Invoker }
|
||||
|
||||
procedure TsrvInformes_Invoker.Invoke_GetNextAutoInc(const __Instance:IInterface; const __Message:IROMessage; const __Transport:IROTransport; out __oResponseOptions:TROResponseOptions);
|
||||
{ function GetNextAutoInc(const GeneratorName: String): Integer; }
|
||||
var
|
||||
GeneratorName: String;
|
||||
lResult: Integer;
|
||||
begin
|
||||
try
|
||||
__Message.Read('GeneratorName', TypeInfo(String), GeneratorName, []);
|
||||
|
||||
lResult := (__Instance as IsrvInformes).GetNextAutoInc(GeneratorName);
|
||||
|
||||
__Message.Initialize(__Transport, 'FactuGES', 'srvInformes', 'GetNextAutoIncResponse');
|
||||
__Message.Write('Result', TypeInfo(Integer), lResult, []);
|
||||
__Message.Finalize;
|
||||
|
||||
finally
|
||||
end;
|
||||
end;
|
||||
|
||||
{ TsrvInfVentasArticulo_Invoker }
|
||||
|
||||
procedure TsrvInfVentasArticulo_Invoker.Invoke_GetData(const __Instance:IInterface; const __Message:IROMessage; const __Transport:IROTransport; out __oResponseOptions:TROResponseOptions);
|
||||
{ function GetData(const DatasetName: String; const MaxRecords: Integer; const Columns: String; const Params: TDADatasetParamArray): Binary; }
|
||||
var
|
||||
DatasetName: String;
|
||||
MaxRecords: Integer;
|
||||
Columns: String;
|
||||
Params: DataAbstract_Intf.TDADatasetParamArray;
|
||||
lResult: Binary;
|
||||
__lObjectDisposer: TROObjectDisposer;
|
||||
begin
|
||||
Params := nil;
|
||||
lResult := nil;
|
||||
try
|
||||
__Message.Read('DatasetName', TypeInfo(String), DatasetName, []);
|
||||
__Message.Read('MaxRecords', TypeInfo(Integer), MaxRecords, []);
|
||||
__Message.Read('Columns', TypeInfo(String), Columns, []);
|
||||
__Message.Read('Params', TypeInfo(DataAbstract_Intf.TDADatasetParamArray), Params, []);
|
||||
|
||||
lResult := (__Instance as IsrvInfVentasArticulo).GetData(DatasetName, MaxRecords, Columns, Params);
|
||||
|
||||
__Message.Initialize(__Transport, 'FactuGES', 'srvInfVentasArticulo', 'GetDataResponse');
|
||||
__Message.Write('Result', TypeInfo(Binary), lResult, []);
|
||||
__Message.Finalize;
|
||||
|
||||
finally
|
||||
__lObjectDisposer := TROObjectDisposer.Create(__Instance);
|
||||
try
|
||||
__lObjectDisposer.Add(Params);
|
||||
__lObjectDisposer.Add(lResult);
|
||||
finally
|
||||
__lObjectDisposer.Free();
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TsrvInfVentasArticulo_Invoker.Invoke_GetSchema(const __Instance:IInterface; const __Message:IROMessage; const __Transport:IROTransport; out __oResponseOptions:TROResponseOptions);
|
||||
{ function GetSchema(const DatasetName: String; const Columns: String): Binary; }
|
||||
var
|
||||
DatasetName: String;
|
||||
Columns: String;
|
||||
lResult: Binary;
|
||||
__lObjectDisposer: TROObjectDisposer;
|
||||
begin
|
||||
lResult := nil;
|
||||
try
|
||||
__Message.Read('DatasetName', TypeInfo(String), DatasetName, []);
|
||||
__Message.Read('Columns', TypeInfo(String), Columns, []);
|
||||
|
||||
lResult := (__Instance as IsrvInfVentasArticulo).GetSchema(DatasetName, Columns);
|
||||
|
||||
__Message.Initialize(__Transport, 'FactuGES', 'srvInfVentasArticulo', 'GetSchemaResponse');
|
||||
__Message.Write('Result', TypeInfo(Binary), lResult, []);
|
||||
__Message.Finalize;
|
||||
|
||||
finally
|
||||
__lObjectDisposer := TROObjectDisposer.Create(__Instance);
|
||||
try
|
||||
__lObjectDisposer.Add(lResult);
|
||||
finally
|
||||
__lObjectDisposer.Free();
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
Binary file not shown.
@ -119,7 +119,14 @@ uses
|
||||
schRecibosProveedorClient_Intf in '..\Modulos\Recibos de proveedor\Model\schRecibosProveedorClient_Intf.pas',
|
||||
schRecibosProveedorServer_Intf in '..\Modulos\Recibos de proveedor\Model\schRecibosProveedorServer_Intf.pas',
|
||||
schRecibosClienteClient_Intf in '..\Modulos\Recibos de cliente\Model\schRecibosClienteClient_Intf.pas',
|
||||
schRecibosClienteServer_Intf in '..\Modulos\Recibos de cliente\Model\schRecibosClienteServer_Intf.pas';
|
||||
schRecibosClienteServer_Intf in '..\Modulos\Recibos de cliente\Model\schRecibosClienteServer_Intf.pas',
|
||||
srvInformes_Impl in '..\Modulos\Informes base\Servidor\srvInformes_Impl.pas' {srvInformes: TDARemoteService},
|
||||
srvInfVentasArticulo_Impl in '..\Modulos\Informe ventas por articulo\Servidor\srvInfVentasArticulo_Impl.pas' {srvInfVentasArticulo: TDARemoteService},
|
||||
schInfVentasArticuloClient_Intf in '..\Modulos\Informe ventas por articulo\Model\schInfVentasArticuloClient_Intf.pas',
|
||||
schInfVentasArticuloServer_Intf in '..\Modulos\Informe ventas por articulo\Model\schInfVentasArticuloServer_Intf.pas',
|
||||
schInformesServer_Intf in '..\Modulos\Informes base\Model\schInformesServer_Intf.pas',
|
||||
schInformesClient_Intf in '..\Modulos\Informes base\Model\schInformesClient_Intf.pas',
|
||||
uSchemaUtilsServer in 'Utiles\uSchemaUtilsServer.pas';
|
||||
|
||||
{$R *.res}
|
||||
{$R ..\Servicios\RODLFile.res}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
161
Source/Servidor/Utiles/uSchemaUtilsServer.pas
Normal file
161
Source/Servidor/Utiles/uSchemaUtilsServer.pas
Normal file
@ -0,0 +1,161 @@
|
||||
unit uSchemaUtilsServer;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils,
|
||||
uROClientIntf, uROTypes, uROServer, uROServerIntf, uROSessions,
|
||||
DARemoteService_Impl,
|
||||
DataAbstract_Intf,
|
||||
uDAClasses, uDAInterfaces, uDADataTable;
|
||||
|
||||
type
|
||||
TReplicarDataSet = class
|
||||
protected
|
||||
function GenerateNewSQL : String;
|
||||
public
|
||||
Service : TDARemoteService;
|
||||
Columnas : String;
|
||||
ColumnasQueSuman : String;
|
||||
SourceDataSetName : String;
|
||||
function GetNewDataSet : IDADataset;
|
||||
end;
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
{ TReplicaDataSet }
|
||||
|
||||
uses
|
||||
RegExpr,
|
||||
Dialogs, JclStrings;
|
||||
|
||||
function TReplicarDataSet.GenerateNewSQL: String;
|
||||
var
|
||||
AColumnList : TStringList;
|
||||
ASQL: TStringList;
|
||||
ds : IDADataset;
|
||||
i : integer;
|
||||
Separador : String;
|
||||
bHayAgrupacion : Boolean;
|
||||
APos : Integer;
|
||||
|
||||
function GetTrueFieldName(AField : string; ConAlias : Boolean = True) : String;
|
||||
var
|
||||
ARegExpr : TRegExpr;
|
||||
begin
|
||||
Result := AField; // Por si el campo no tuviera alias
|
||||
ARegExpr := TRegExpr.Create;
|
||||
try
|
||||
ARegExpr.ModifierI := True; // case insensitive
|
||||
ARegExpr.InputString := ds.SQL;
|
||||
ARegExpr.Expression := '[^ ,]+[ ]+AS[ ]+' + AField; // buscar (xxxx.xxxx AS AField) o (xxxx AS AField)
|
||||
ARegExpr.Expression := ARegExpr.Expression + '|'; // o
|
||||
ARegExpr.Expression := ARegExpr.Expression + '[^ ,]+\.' + AField; // buscar xxxx.AField
|
||||
if ARegExpr.Exec then
|
||||
Result := ARegExpr.Match[0];
|
||||
|
||||
if not ConAlias then
|
||||
begin
|
||||
ARegExpr.InputString := Result;
|
||||
ARegExpr.Expression := '^[^ ,]+'; // Para quedarme con el campo sin alias
|
||||
if ARegExpr.Exec then
|
||||
Result := ARegExpr.Match[0]
|
||||
end;
|
||||
finally
|
||||
FreeAndNil(ARegExpr);
|
||||
end;
|
||||
end;
|
||||
|
||||
begin
|
||||
AColumnList := TStringList.Create;
|
||||
ASQL := TStringList.Create;
|
||||
ds := Service.ServiceSchema.NewDataset(Service.Connection, SourceDataSetName);
|
||||
bHayAgrupacion := False;
|
||||
try
|
||||
AColumnList.CommaText := Columnas;
|
||||
|
||||
with ASQL do
|
||||
begin
|
||||
Insert(0, 'SELECT DISTINCT');
|
||||
Insert(1, ''); // Lista de campos
|
||||
Insert(2, Copy(ds.SQL, Pos('FROM', ds.SQL), Length(ds.SQL)));
|
||||
Insert(3, ''); // Group by
|
||||
Separador := '';
|
||||
|
||||
for i := 0 to AColumnList.Count - 1 do
|
||||
begin
|
||||
if Assigned(ds.FindField(AColumnList[i])) then
|
||||
begin
|
||||
if i > 0 then
|
||||
Separador := ',';
|
||||
|
||||
if Pos('#'+AColumnList[i]+'#', ColumnasQueSuman) > 0 then
|
||||
begin
|
||||
Strings[1] := Strings[1] + Separador + 'SUM(' + GetTrueFieldName(AColumnList[i], False) + ') AS ' + AColumnList[i];
|
||||
bHayAgrupacion := True;
|
||||
end
|
||||
else begin
|
||||
Strings[1] := Strings[1] + Separador + GetTrueFieldName(AColumnList[i]);
|
||||
if Length(Strings[3]) = 0 then
|
||||
Strings[3] := 'GROUP BY '
|
||||
else begin
|
||||
if (Strings[3] <> 'GROUP BY ') then
|
||||
Strings[3] := Strings[3] + Separador;
|
||||
end;
|
||||
Strings[3] := Strings[3] + GetTrueFieldName(AColumnList[i], False);
|
||||
end;
|
||||
end;
|
||||
end; // for
|
||||
|
||||
if not bHayAgrupacion then
|
||||
Delete(3);
|
||||
end;
|
||||
Result := ASQL.Text;
|
||||
finally
|
||||
AColumnList.Free;
|
||||
ASQL.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
|
||||
function TReplicarDataSet.GetNewDataSet: IDADataset;
|
||||
var
|
||||
SQL: String;
|
||||
ASchemaDataSet: TDADataSet;
|
||||
AField: TDAField;
|
||||
AColumnList : TStringList;
|
||||
i, j : Integer;
|
||||
begin
|
||||
SQL := GenerateNewSQL;
|
||||
Result := Service.Connection.NewDataset(SQL, SourceDataSetName);
|
||||
|
||||
ASchemaDataSet := Service.ServiceSchema.Datasets.DatasetByName(SourceDataSetName);
|
||||
if Assigned(ASchemaDataSet) then
|
||||
begin
|
||||
Result.Params.AssignParamCollection(ASchemaDataSet.Params);
|
||||
Result.Fields.AssignFieldCollection(ASchemaDataSet.Fields);
|
||||
AColumnList := TStringList.Create;
|
||||
try
|
||||
AColumnList.CommaText := Columnas;
|
||||
j := 0;
|
||||
i := Result.Fields.Count;
|
||||
while i > 0 do
|
||||
begin
|
||||
if AColumnList.IndexOf(Result.Fields[j].Name) = -1 then
|
||||
Result.Fields.Delete(j)
|
||||
else
|
||||
j := j + 1; // Un campo que dejo
|
||||
i := i - 1; // Un campo menos por revisar
|
||||
end;
|
||||
finally
|
||||
AColumnList.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
Result.Close;
|
||||
Result.Where.Clear;
|
||||
end;
|
||||
|
||||
end.
|
||||
Reference in New Issue
Block a user