diff --git a/Database/FACTUGES.FDB b/Database/FACTUGES.FDB index 5b94368a..e9d9a90f 100644 Binary files a/Database/FACTUGES.FDB and b/Database/FACTUGES.FDB differ diff --git a/Database/factuges.sql b/Database/factuges.sql index 848ac355..c965a060 100644 --- a/Database/factuges.sql +++ b/Database/factuges.sql @@ -17,7 +17,12 @@ DECLARE EXTERNAL FUNCTION MOD RETURNS DOUBLE PRECISION BY VALUE ENTRY_POINT 'IB_UDF_mod' MODULE_NAME 'ib_udf'; - +DECLARE EXTERNAL FUNCTION SUBSTR + CSTRING(254), + SMALLINT, + SMALLINT +RETURNS CSTRING(254) FREE_IT +ENTRY_POINT 'IB_UDF_substr' MODULE_NAME 'ib_udf'; /******************************************************************************/ diff --git a/Source/Base/Base.bdsproj b/Source/Base/Base.bdsproj index fd07f729..140231de 100644 --- a/Source/Base/Base.bdsproj +++ b/Source/Base/Base.bdsproj @@ -214,9 +214,9 @@ ExpressGDI+ Library by Developer Express Inc. - diff --git a/Source/Base/GUIBase/GUIBase.bdsproj b/Source/Base/GUIBase/GUIBase.bdsproj index 57b9c1e2..52b5e8c7 100644 --- a/Source/Base/GUIBase/GUIBase.bdsproj +++ b/Source/Base/GUIBase/GUIBase.bdsproj @@ -181,9 +181,9 @@ TeeChart Components - diff --git a/Source/Modulos/Facturas de cliente/Controller/uFacturasClienteController.pas b/Source/Modulos/Facturas de cliente/Controller/uFacturasClienteController.pas index 5afd29ca..99f5fa49 100644 --- a/Source/Modulos/Facturas de cliente/Controller/uFacturasClienteController.pas +++ b/Source/Modulos/Facturas de cliente/Controller/uFacturasClienteController.pas @@ -55,6 +55,9 @@ type function ElegirFacturas(AFacturas : IBizFacturaCliente; AMensaje: String; AMultiSelect: Boolean): IBizFacturaCliente; function ExtraerSeleccionados(ARecibosCliente: IBizFacturaCliente; const ViewGrid: IViewGridBase = Nil) : IBizFacturaCliente; + + function DarListaAnosFacturas: TStringList; + procedure FiltrarAno(AFactura: IBizFacturaCliente; AWhereDataTable: String; const Ano: String); end; TFacturasClienteController = class(TObservador, IFacturasClienteController) @@ -123,6 +126,9 @@ type function ElegirFacturas(AFacturas : IBizFacturaCliente; AMensaje: String; AMultiSelect: Boolean): IBizFacturaCliente; function ExtraerSeleccionados(AFacturasCliente: IBizFacturaCliente; Const ViewGrid: IViewGridBase = Nil) : IBizFacturaCliente; + + function DarListaAnosFacturas: TStringList; + procedure FiltrarAno(AFactura: IBizFacturaCliente; AWhereDataTable: String; const Ano: String); end; implementation @@ -549,6 +555,11 @@ begin Result := Supports(EditorRegistry.CreateEditor(AName), IID, Intf); end; +function TFacturasClienteController.DarListaAnosFacturas: TStringList; +begin + Result := FDataModule.GetAnosItems; +end; + procedure TFacturasClienteController.DescartarCambios(AFactura: IBizFacturaCliente); begin if not Assigned(AFactura) then @@ -1028,6 +1039,31 @@ begin end; end; +procedure TFacturasClienteController.FiltrarAno(AFactura: IBizFacturaCliente; AWhereDataTable: String; const Ano: String); +var + FechaIni: String; + FechaFin: String; + +begin + AFactura.DataTable.Where.Clear; + AFactura.DataTable.Where.AddText(AWhereDataTable); + + if (Ano <> 'Todos') then + begin + // Filtrar las facturas actuales por empresa + FechaIni := '01.01.' + Ano; + FechaFin := '31.12.' + Ano; + with AFactura.DataTable.Where do + begin + if NotEmpty then + AddOperator(opAND); + AddCondition(fld_FacturasClienteFECHA_FACTURA, cMajorOrEqual, FechaIni); + AddOperator(opAND); + AddCondition(fld_FacturasClienteFECHA_FACTURA, cLessOrEqual, FechaFin); + end; + end; +end; + procedure TFacturasClienteController.FiltrarEmpresa(AFactura: IBizFacturaCliente); begin if AFactura.DataTable.Active then diff --git a/Source/Modulos/Facturas de cliente/Data/uDataModuleFacturasCliente.dfm b/Source/Modulos/Facturas de cliente/Data/uDataModuleFacturasCliente.dfm index 5f09b32f..17c941b9 100644 --- a/Source/Modulos/Facturas de cliente/Data/uDataModuleFacturasCliente.dfm +++ b/Source/Modulos/Facturas de cliente/Data/uDataModuleFacturasCliente.dfm @@ -919,4 +919,113 @@ object DataModuleFacturasCliente: TDataModuleFacturasCliente Left = 48 Top = 324 end + object tbl_ListaAnosFacturas: TDACDSDataTable + RemoteUpdatesOptions = [] + Fields = < + item + Name = 'ANO' + DataType = datString + Size = 254 + BlobType = dabtUnknown + DisplayWidth = 0 + Alignment = taLeftJustify + InPrimaryKey = False + Calculated = False + Lookup = False + LookupCache = False + end> + Params = <> + MasterMappingMode = mmDataRequest + StreamingOptions = [soDisableEventsWhileStreaming] + SchemaCall.MethodName = 'GetDatasetSchema' + SchemaCall.Params = < + item + Name = 'Result' + ParamType = fResult + DataType = rtBinary + end + item + Name = 'aDatasetName' + ParamType = fIn + DataType = rtString + Value = 'ListaAnosFacturas' + end> + DataRequestCall.MethodName = 'GetDatasetDataEx' + DataRequestCall.Params = < + item + Name = 'Result' + ParamType = fResult + DataType = rtBinary + end + item + Name = 'DatasetName' + ParamType = fIn + DataType = rtString + Value = 'ListaAnosFacturas' + end + item + Name = 'Params' + ParamType = fIn + DataType = rtUserDefined + UserClassName = 'TDADatasetParamArray' + end + item + Name = 'UserFilter' + ParamType = fIn + DataType = rtString + Value = '' + end + item + Name = 'IncludeSchema' + ParamType = fIn + DataType = rtBoolean + Value = False + end + item + Name = 'MaxRecords' + ParamType = fIn + DataType = rtInteger + Value = -1 + end> + DataUpdateCall.MethodName = 'UpdateData' + DataUpdateCall.Params = < + item + Name = 'Result' + ParamType = fResult + DataType = rtBinary + end + item + Name = 'Delta' + ParamType = fIn + DataType = rtBinary + end> + ScriptCall.MethodName = 'GetDatasetScripts' + ScriptCall.Params = < + item + Name = 'Result' + ParamType = fResult + DataType = rtString + Value = '' + end + item + Name = 'DatasetNames' + ParamType = fIn + DataType = rtString + Value = 'ListaAnosFacturas' + end> + ReadOnly = False + RemoteService = RORemoteService + Adapter = DABinAdapter + DetailOptions = [dtCascadeOpenClose, dtCascadeApplyUpdates, dtAutoFetch, dtCascadeDelete, dtCascadeUpdate, dtDisableLogOfCascadeDeletes, dtDisableLogOfCascadeUpdates, dtIncludeInAllInOneFetch] + MasterOptions = [moCascadeOpenClose, moCascadeApplyUpdates, moCascadeDelete, moCascadeUpdate, moDisableLogOfCascadeDeletes, moDisableLogOfCascadeUpdates] + LogicalName = 'ListaAnosFacturas' + IndexDefs = <> + Left = 208 + Top = 232 + end + object ds_ListaAnosFacturas: TDADataSource + DataTable = tbl_ListaAnosFacturas + Left = 208 + Top = 176 + end end diff --git a/Source/Modulos/Facturas de cliente/Data/uDataModuleFacturasCliente.pas b/Source/Modulos/Facturas de cliente/Data/uDataModuleFacturasCliente.pas index a3087577..f51d625c 100644 --- a/Source/Modulos/Facturas de cliente/Data/uDataModuleFacturasCliente.pas +++ b/Source/Modulos/Facturas de cliente/Data/uDataModuleFacturasCliente.pas @@ -22,11 +22,14 @@ type LoginRemoteService: TRORemoteService; ROWinInetHTTPChannel1: TROWinInetHTTPChannel; ROBinMessage1: TROBinMessage; + tbl_ListaAnosFacturas: TDACDSDataTable; + ds_ListaAnosFacturas: TDADataSource; procedure DAClientDataModuleCreate(Sender: TObject); private function _CloneDataTable (const ADataTable : TDACDSDataTable): TDACDSDataTable; overload; function _GetDetalles : IBizDetallesFacturaCliente; public + function GetAnosItems : TStringList; function GetItems : IBizFacturaCliente; function GetItem(const ID : Integer) : IBizFacturaCliente; function GetNextID(const DataSetName : String) : Integer; @@ -130,6 +133,30 @@ begin end; end; +function TDataModuleFacturasCliente.GetAnosItems: TStringList; +var + AListaAnos: TStringList; +begin + AListaAnos := TStringList.Create; + ShowHourglassCursor; + try + with tbl_ListaAnosFacturas do + begin + Open; + First; + while not eof do + begin + AListaAnos.Add(Format('%s=%s', [Fields[0].AsString, Fields[0].AsString])); + Next; + end; + Close; + end; + Result := AListaAnos; + finally + HideHourglassCursor; + end; +end; + function TDataModuleFacturasCliente.GetItem(const ID: Integer): IBizFacturaCliente; begin ShowHourglassCursor; diff --git a/Source/Modulos/Facturas de cliente/FacturasCliente_Group.bdsgroup b/Source/Modulos/Facturas de cliente/FacturasCliente_Group.bdsgroup index 4fac7f7b..8ce0dc65 100644 --- a/Source/Modulos/Facturas de cliente/FacturasCliente_Group.bdsgroup +++ b/Source/Modulos/Facturas de cliente/FacturasCliente_Group.bdsgroup @@ -10,6 +10,8 @@ + + ..\..\Base\Base.bdsproj ..\..\Base\ControllerBase\ControllerBase.bdsproj @@ -33,7 +35,14 @@ ..\Facturas de proveedor\Views\FacturasProveedor_view.bdsproj ..\Pedidos de cliente\Views\PedidosCliente_view.bdsproj ..\Pedidos de cliente\Controller\PedidosCliente_controller.bdsproj - Base.bpl ControllerBase.bpl GUIBase.bpl Contactos_model.bpl Contactos_data.bpl Contactos_controller.bpl Articulos_model.bpl Articulos_data.bpl Articulos_controller.bpl Contactos_view.bpl Articulos_view.bpl FacturasCliente_model.bpl FacturasCliente_data.bpl FacturasCliente_controller.bpl AlbCli_FacCli_relation.bpl FacturasCliente_view.bpl FactuGES.exe FactuGES_Server.exe AlbaranesCliente_controller.bpl FacturasProveedor_view.bpl PedidosCliente_view.bpl PedidosCliente_controller.bpl + ..\Albaranes de cliente\Views\AlbaranesCliente_view.bdsproj + ..\Albaranes de proveedor\Views\AlbaranesProveedor_view.bdsproj + ..\Pedidos a proveedor\Views\PedidosProveedor_view.bdsproj + ..\Recibos de cliente\Views\RecibosCliente_view.bdsproj + ..\Recibos de proveedor\Views\RecibosProveedor_view.bdsproj + ..\Remesas de cliente\Views\RemesasCliente_view.bdsproj + ..\Remesas de proveedor\Views\RemesasProveedor_view.bdsproj + Base.bpl ControllerBase.bpl GUIBase.bpl Contactos_model.bpl Contactos_data.bpl Contactos_controller.bpl Articulos_model.bpl Articulos_data.bpl Articulos_controller.bpl Contactos_view.bpl Articulos_view.bpl FacturasCliente_model.bpl FacturasCliente_data.bpl FacturasCliente_controller.bpl AlbCli_FacCli_relation.bpl FacturasCliente_view.bpl FactuGES.exe FactuGES_Server.exe AlbaranesCliente_controller.bpl FacturasProveedor_view.bpl PedidosCliente_view.bpl PedidosCliente_controller.bpl AlbaranesCliente_view.bpl AlbaranesProveedor_view.bpl PedidosProveedor_view.bpl RecibosCliente_view.bpl RecibosProveedor_view.bpl RemesasCliente_view.bpl RemesasProveedor_view.bpl diff --git a/Source/Modulos/Facturas de cliente/Model/Data/uIDataModuleFacturasCliente.pas b/Source/Modulos/Facturas de cliente/Model/Data/uIDataModuleFacturasCliente.pas index cd4cd675..1970e6af 100644 --- a/Source/Modulos/Facturas de cliente/Model/Data/uIDataModuleFacturasCliente.pas +++ b/Source/Modulos/Facturas de cliente/Model/Data/uIDataModuleFacturasCliente.pas @@ -9,6 +9,7 @@ uses type IDataModuleFacturasCliente = interface ['{B0BDC388-E831-4946-B736-E817E3EA4B7C}'] + function GetAnosItems : TStringList; function GetItems: IBizFacturaCliente; function GetItem(const ID : Integer) : IBizFacturaCliente; function GetNextID(const DataSetName : String) : Integer; diff --git a/Source/Modulos/Facturas de cliente/Model/schFacturasClienteClient_Intf.pas b/Source/Modulos/Facturas de cliente/Model/schFacturasClienteClient_Intf.pas index f51fe21e..927a7240 100644 --- a/Source/Modulos/Facturas de cliente/Model/schFacturasClienteClient_Intf.pas +++ b/Source/Modulos/Facturas de cliente/Model/schFacturasClienteClient_Intf.pas @@ -9,14 +9,16 @@ const { Data table rules ids Feel free to change them to something more human readable but make sure they are unique in the context of your application } - RID_DarReferencia = '{F07C0630-2482-4183-B171-5F9A8689D08B}'; - RID_FacturasCliente = '{6DFFB254-B69F-4A64-A33F-92E0568329FD}'; - RID_FacturasCliente_Detalles = '{9EB4A221-1FE5-4D7F-8A74-0331667B2F11}'; - RID_FacturasCliente_Detalles_Refresh = '{28FE35F0-46C2-493C-B30C-DFBE5B2DB181}'; - RID_FacturasCliente_Refresh = '{B30DD588-2914-4443-BBD5-50D4F138F95F}'; + RID_DarReferencia = '{A621C326-E4EC-467B-ADBC-3405D36E60EE}'; + RID_ListaAnosFacturas = '{4BE1F671-5EAA-439D-AFB9-0AD7989ADF34}'; + RID_FacturasCliente = '{428E1B81-D8A3-4C5E-B021-5E4BF418E6B7}'; + RID_FacturasCliente_Detalles = '{8FB6D423-E42F-4A10-8C35-736C711FFA32}'; + RID_FacturasCliente_Detalles_Refresh = '{3618523F-C786-4185-A189-80867AA103C0}'; + RID_FacturasCliente_Refresh = '{3DCA7D8A-2508-4E3A-BE11-B6E06C9EA8B6}'; { Data table names } nme_DarReferencia = 'DarReferencia'; + nme_ListaAnosFacturas = 'ListaAnosFacturas'; nme_FacturasCliente = 'FacturasCliente'; nme_FacturasCliente_Detalles = 'FacturasCliente_Detalles'; nme_FacturasCliente_Detalles_Refresh = 'FacturasCliente_Detalles_Refresh'; @@ -28,6 +30,12 @@ const { DarReferencia field indexes } idx_DarReferenciaVALOR = 0; + { ListaAnosFacturas fields } + fld_ListaAnosFacturasANO = 'ANO'; + + { ListaAnosFacturas field indexes } + idx_ListaAnosFacturasANO = 0; + { FacturasCliente fields } fld_FacturasClienteID = 'ID'; fld_FacturasClienteID_EMPRESA = 'ID_EMPRESA'; @@ -247,7 +255,7 @@ const type { IDarReferencia } IDarReferencia = interface(IDAStronglyTypedDataTable) - ['{9DABABE4-9529-4D46-8390-02D72879F053}'] + ['{DC6A031B-D148-478D-9BCA-101202CCC948}'] { Property getters and setters } function GetVALORValue: String; procedure SetVALORValue(const aValue: String); @@ -274,9 +282,38 @@ type end; + { IListaAnosFacturas } + IListaAnosFacturas = interface(IDAStronglyTypedDataTable) + ['{FF89EDF2-3698-477F-B6DE-83A3FE03F68E}'] + { Property getters and setters } + function GetANOValue: String; + procedure SetANOValue(const aValue: String); + + + { Properties } + property ANO: String read GetANOValue write SetANOValue; + end; + + { TListaAnosFacturasDataTableRules } + TListaAnosFacturasDataTableRules = class(TDADataTableRules, IListaAnosFacturas) + private + protected + { Property getters and setters } + function GetANOValue: String; virtual; + procedure SetANOValue(const aValue: String); virtual; + + { Properties } + property ANO: String read GetANOValue write SetANOValue; + + public + constructor Create(aDataTable: TDADataTable); override; + destructor Destroy; override; + + end; + { IFacturasCliente } IFacturasCliente = interface(IDAStronglyTypedDataTable) - ['{A4A64CE1-E0C3-42E1-9FE3-3CCFC56E8149}'] + ['{AACD7C2D-E96C-430C-A07F-12AF77A42630}'] { Property getters and setters } function GetIDValue: Integer; procedure SetIDValue(const aValue: Integer); @@ -515,7 +552,7 @@ type { IFacturasCliente_Detalles } IFacturasCliente_Detalles = interface(IDAStronglyTypedDataTable) - ['{48DB542A-94AF-49A6-9B13-E3FB282FAB21}'] + ['{B6A306E7-6C2F-46BC-A313-C6F68ED5C577}'] { Property getters and setters } function GetIDValue: Integer; procedure SetIDValue(const aValue: Integer); @@ -622,7 +659,7 @@ type { IFacturasCliente_Detalles_Refresh } IFacturasCliente_Detalles_Refresh = interface(IDAStronglyTypedDataTable) - ['{1ED3E85F-9BE1-4DBC-A810-895CB87EFF7B}'] + ['{6C0D8072-B0E3-4774-A560-8336A4DFBF60}'] { Property getters and setters } function GetIDValue: Integer; procedure SetIDValue(const aValue: Integer); @@ -729,7 +766,7 @@ type { IFacturasCliente_Refresh } IFacturasCliente_Refresh = interface(IDAStronglyTypedDataTable) - ['{4774EBB6-EE6F-4091-982C-0BE9F6733DF7}'] + ['{C8BA494B-931B-4C73-8E06-1F3846B17070}'] { Property getters and setters } function GetIDValue: Integer; procedure SetIDValue(const aValue: Integer); @@ -992,6 +1029,28 @@ begin end; +{ TListaAnosFacturasDataTableRules } +constructor TListaAnosFacturasDataTableRules.Create(aDataTable: TDADataTable); +begin + inherited; +end; + +destructor TListaAnosFacturasDataTableRules.Destroy; +begin + inherited; +end; + +function TListaAnosFacturasDataTableRules.GetANOValue: String; +begin + result := DataTable.Fields[idx_ListaAnosFacturasANO].AsString; +end; + +procedure TListaAnosFacturasDataTableRules.SetANOValue(const aValue: String); +begin + DataTable.Fields[idx_ListaAnosFacturasANO].AsString := aValue; +end; + + { TFacturasClienteDataTableRules } constructor TFacturasClienteDataTableRules.Create(aDataTable: TDADataTable); begin @@ -2044,6 +2103,7 @@ end; initialization RegisterDataTableRules(RID_DarReferencia, TDarReferenciaDataTableRules); + RegisterDataTableRules(RID_ListaAnosFacturas, TListaAnosFacturasDataTableRules); RegisterDataTableRules(RID_FacturasCliente, TFacturasClienteDataTableRules); RegisterDataTableRules(RID_FacturasCliente_Detalles, TFacturasCliente_DetallesDataTableRules); RegisterDataTableRules(RID_FacturasCliente_Detalles_Refresh, TFacturasCliente_Detalles_RefreshDataTableRules); diff --git a/Source/Modulos/Facturas de cliente/Model/schFacturasClienteServer_Intf.pas b/Source/Modulos/Facturas de cliente/Model/schFacturasClienteServer_Intf.pas index 66eaf2ed..2a830b51 100644 --- a/Source/Modulos/Facturas de cliente/Model/schFacturasClienteServer_Intf.pas +++ b/Source/Modulos/Facturas de cliente/Model/schFacturasClienteServer_Intf.pas @@ -9,16 +9,17 @@ const { Delta rules ids Feel free to change them to something more human readable but make sure they are unique in the context of your application } - RID_DarReferenciaDelta = '{A361CA72-14B0-4A2F-8D48-594E3B6757B5}'; - RID_FacturasClienteDelta = '{9D0AFD95-68E6-4552-A9E1-0BD9CDCF5EF5}'; - RID_FacturasCliente_DetallesDelta = '{B9A181BB-83C6-4C37-8D94-8870ECFA5672}'; - RID_FacturasCliente_Detalles_RefreshDelta = '{D18A6A64-A4BC-49E2-9F4C-7EB197491CAF}'; - RID_FacturasCliente_RefreshDelta = '{1929E045-A3F6-43D9-ACCD-B31FA5847473}'; + RID_DarReferenciaDelta = '{DCB4C31D-2825-4AED-A0D5-085D371E73FF}'; + RID_ListaAnosFacturasDelta = '{BE0BAF1D-C955-44C4-872C-6DD555772691}'; + RID_FacturasClienteDelta = '{91BB9203-1A6A-4FC1-AD02-41A181969867}'; + RID_FacturasCliente_DetallesDelta = '{7DCB2097-1E44-42CC-BA9E-9CF8645A18E3}'; + RID_FacturasCliente_Detalles_RefreshDelta = '{4C1BB5AD-9C14-47AC-8CB9-B298E9CBC9E4}'; + RID_FacturasCliente_RefreshDelta = '{94A51D8A-EC34-4716-8531-4CC62F89C1CD}'; type { IDarReferenciaDelta } IDarReferenciaDelta = interface(IDarReferencia) - ['{A361CA72-14B0-4A2F-8D48-594E3B6757B5}'] + ['{DCB4C31D-2825-4AED-A0D5-085D371E73FF}'] { Property getters and setters } function GetOldVALORValue : String; @@ -45,9 +46,38 @@ type end; + { IListaAnosFacturasDelta } + IListaAnosFacturasDelta = interface(IListaAnosFacturas) + ['{BE0BAF1D-C955-44C4-872C-6DD555772691}'] + { Property getters and setters } + function GetOldANOValue : String; + + { Properties } + property OldANO : String read GetOldANOValue; + end; + + { TListaAnosFacturasBusinessProcessorRules } + TListaAnosFacturasBusinessProcessorRules = class(TDABusinessProcessorRules, IListaAnosFacturas, IListaAnosFacturasDelta) + private + protected + { Property getters and setters } + function GetANOValue: String; virtual; + function GetOldANOValue: String; virtual; + procedure SetANOValue(const aValue: String); virtual; + + { Properties } + property ANO : String read GetANOValue write SetANOValue; + property OldANO : String read GetOldANOValue; + + public + constructor Create(aBusinessProcessor: TDABusinessProcessor); override; + destructor Destroy; override; + + end; + { IFacturasClienteDelta } IFacturasClienteDelta = interface(IFacturasCliente) - ['{9D0AFD95-68E6-4552-A9E1-0BD9CDCF5EF5}'] + ['{91BB9203-1A6A-4FC1-AD02-41A181969867}'] { Property getters and setters } function GetOldIDValue : Integer; function GetOldID_EMPRESAValue : Integer; @@ -321,7 +351,7 @@ type { IFacturasCliente_DetallesDelta } IFacturasCliente_DetallesDelta = interface(IFacturasCliente_Detalles) - ['{B9A181BB-83C6-4C37-8D94-8870ECFA5672}'] + ['{7DCB2097-1E44-42CC-BA9E-9CF8645A18E3}'] { Property getters and setters } function GetOldIDValue : Integer; function GetOldID_FACTURAValue : Integer; @@ -441,7 +471,7 @@ type { IFacturasCliente_Detalles_RefreshDelta } IFacturasCliente_Detalles_RefreshDelta = interface(IFacturasCliente_Detalles_Refresh) - ['{D18A6A64-A4BC-49E2-9F4C-7EB197491CAF}'] + ['{4C1BB5AD-9C14-47AC-8CB9-B298E9CBC9E4}'] { Property getters and setters } function GetOldIDValue : Integer; function GetOldID_FACTURAValue : Integer; @@ -561,7 +591,7 @@ type { IFacturasCliente_RefreshDelta } IFacturasCliente_RefreshDelta = interface(IFacturasCliente_Refresh) - ['{1929E045-A3F6-43D9-ACCD-B31FA5847473}'] + ['{94A51D8A-EC34-4716-8531-4CC62F89C1CD}'] { Property getters and setters } function GetOldIDValue : Integer; function GetOldID_EMPRESAValue : Integer; @@ -865,6 +895,33 @@ begin end; +{ TListaAnosFacturasBusinessProcessorRules } +constructor TListaAnosFacturasBusinessProcessorRules.Create(aBusinessProcessor: TDABusinessProcessor); +begin + inherited; +end; + +destructor TListaAnosFacturasBusinessProcessorRules.Destroy; +begin + inherited; +end; + +function TListaAnosFacturasBusinessProcessorRules.GetANOValue: String; +begin + result := BusinessProcessor.CurrentChange.NewValueByName[fld_ListaAnosFacturasANO]; +end; + +function TListaAnosFacturasBusinessProcessorRules.GetOldANOValue: String; +begin + result := BusinessProcessor.CurrentChange.OldValueByName[fld_ListaAnosFacturasANO]; +end; + +procedure TListaAnosFacturasBusinessProcessorRules.SetANOValue(const aValue: String); +begin + BusinessProcessor.CurrentChange.NewValueByName[fld_ListaAnosFacturasANO] := aValue; +end; + + { TFacturasClienteBusinessProcessorRules } constructor TFacturasClienteBusinessProcessorRules.Create(aBusinessProcessor: TDABusinessProcessor); begin @@ -2419,6 +2476,7 @@ end; initialization RegisterBusinessProcessorRules(RID_DarReferenciaDelta, TDarReferenciaBusinessProcessorRules); + RegisterBusinessProcessorRules(RID_ListaAnosFacturasDelta, TListaAnosFacturasBusinessProcessorRules); RegisterBusinessProcessorRules(RID_FacturasClienteDelta, TFacturasClienteBusinessProcessorRules); RegisterBusinessProcessorRules(RID_FacturasCliente_DetallesDelta, TFacturasCliente_DetallesBusinessProcessorRules); RegisterBusinessProcessorRules(RID_FacturasCliente_Detalles_RefreshDelta, TFacturasCliente_Detalles_RefreshBusinessProcessorRules); diff --git a/Source/Modulos/Facturas de cliente/Servidor/srvFacturasCliente_Impl.dfm b/Source/Modulos/Facturas de cliente/Servidor/srvFacturasCliente_Impl.dfm index abed2fb2..8b129ddf 100644 --- a/Source/Modulos/Facturas de cliente/Servidor/srvFacturasCliente_Impl.dfm +++ b/Source/Modulos/Facturas de cliente/Servidor/srvFacturasCliente_Impl.dfm @@ -63,6 +63,39 @@ object srvFacturasCliente: TsrvFacturasCliente BusinessRulesClient.ScriptLanguage = rslPascalScript BusinessRulesServer.ScriptLanguage = rslPascalScript end + item + Params = <> + Statements = < + item + Connection = 'IBX' + SQL = + 'select ANO from'#10'(select distinct(substr(FECHA_FACTURA, 1,4)) as ' + + 'ANO'#10'from facturas_cliente'#10'order by 1 desc)'#10#10'UNION ALL'#10#10'select di' + + 'stinct '#39'Todos'#39' as ANO'#10'from empresas' + StatementType = stSQL + ColumnMappings = < + item + DatasetField = 'ANO' + TableField = 'ANO' + end> + end> + Name = 'ListaAnosFacturas' + Fields = < + item + Name = 'ANO' + DataType = datString + Size = 254 + BlobType = dabtUnknown + DisplayWidth = 0 + Alignment = taLeftJustify + InPrimaryKey = False + Calculated = False + Lookup = False + LookupCache = False + end> + BusinessRulesClient.ScriptLanguage = rslPascalScript + BusinessRulesServer.ScriptLanguage = rslPascalScript + end item Params = <> Statements = < diff --git a/Source/Modulos/Facturas de cliente/Views/FacturasCliente_view.bdsproj b/Source/Modulos/Facturas de cliente/Views/FacturasCliente_view.bdsproj index efbc429c..b9630538 100644 --- a/Source/Modulos/Facturas de cliente/Views/FacturasCliente_view.bdsproj +++ b/Source/Modulos/Facturas de cliente/Views/FacturasCliente_view.bdsproj @@ -172,9 +172,9 @@ - diff --git a/Source/Modulos/Facturas de cliente/Views/uEditorFacturasCliente.dfm b/Source/Modulos/Facturas de cliente/Views/uEditorFacturasCliente.dfm index 8034064d..06b40e26 100644 --- a/Source/Modulos/Facturas de cliente/Views/uEditorFacturasCliente.dfm +++ b/Source/Modulos/Facturas de cliente/Views/uEditorFacturasCliente.dfm @@ -60,6 +60,18 @@ inherited fEditorFacturasCliente: TfEditorFacturasCliente Action = actEnviarEMail end end + inherited tbxFiltro: TTBXToolbar + ExplicitWidth = 435 + inherited lblAno: TTBXLabelItem + Visible = True + end + inherited cbxListaAnos: TTBXComboBoxItem + Visible = True + end + inherited sepAno: TTBXSeparatorItem + Visible = True + end + end inherited tbxMenu: TTBXToolbar ExplicitWidth = 640 object TBXSubmenuItem3: TTBXSubmenuItem [4] @@ -69,6 +81,10 @@ inherited fEditorFacturasCliente: TfEditorFacturasCliente end end end + inherited TBXTMain2: TTBXToolbar + Left = 435 + ExplicitLeft = 435 + end end inherited StatusBar: TJvStatusBar Top = 556 diff --git a/Source/Modulos/Facturas de cliente/Views/uEditorFacturasCliente.pas b/Source/Modulos/Facturas de cliente/Views/uEditorFacturasCliente.pas index 32d708c8..7ed9dbe6 100644 --- a/Source/Modulos/Facturas de cliente/Views/uEditorFacturasCliente.pas +++ b/Source/Modulos/Facturas de cliente/Views/uEditorFacturasCliente.pas @@ -41,13 +41,14 @@ type procedure actNuevoAbonoExecute(Sender: TObject); procedure actEnviarEMailExecute(Sender: TObject); procedure actEnviarEMailUpdate(Sender: TObject); + procedure OnListaAnosChange(Sender: TObject; const Text: string); private FFacturas: IBizFacturaCliente; FController : IFacturasClienteController; + protected function GetFacturas: IBizFacturaCliente; procedure SetFacturas(const Value: IBizFacturaCliente); - function GetController : IFacturasClienteController; virtual; procedure SetController (const Value : IFacturasClienteController); virtual; procedure NuevoInterno; override; @@ -56,10 +57,12 @@ type procedure DuplicarInterno; override; procedure ImprimirInterno; override; procedure PrevisualizarInterno; override; + procedure RefrescarInterno; override; + public - procedure PonerTitulos(const ATitulo: string = ''); override; property Facturas: IBizFacturaCliente read GetFacturas write SetFacturas; property Controller : IFacturasClienteController read GetController write SetController; + procedure PonerTitulos(const ATitulo: string = ''); override; constructor Create(AOwner: TComponent); override; destructor Destroy; override; end; @@ -155,6 +158,13 @@ begin end; end; +procedure TfEditorFacturasCliente.OnListaAnosChange(Sender: TObject; const Text: string); +begin + Controller.FiltrarAno(Facturas, WhereDataTable, Text); + if Facturas.DataTable.Active then + RefrescarInterno; +end; + constructor TfEditorFacturasCliente.Create(AOwner: TComponent); begin inherited; @@ -237,6 +247,8 @@ end; procedure TfEditorFacturasCliente.FormShow(Sender: TObject); begin + cbxListaAnos.OnChange := OnListaAnosChange; + inherited; if not Assigned(ViewGrid) then @@ -401,17 +413,37 @@ begin end; end; +procedure TfEditorFacturasCliente.RefrescarInterno; +begin + //Volvemos a cargar los años de las facturas + if Assigned(FController) then + ListaAnos := FController.DarListaAnosFacturas; + + inherited; +end; + procedure TfEditorFacturasCliente.SetController(const Value: IFacturasClienteController); begin FController := Value; + + if Assigned(FController) then + ListaAnos := FController.DarListaAnosFacturas; end; procedure TfEditorFacturasCliente.SetFacturas(const Value: IBizFacturaCliente); begin FFacturas := Value; - dsDataTable.DataTable := FFacturas.DataTable; - if Assigned(ViewGrid) then - (ViewGrid as IViewFacturasCliente).Facturas := Facturas; + + if Assigned(FFacturas) then + begin + //Se guarda el where de la sentencia origen, por si el editor tiene filtros que + //afecten a este where y en un futuro se desea volver al where origen (filtro de año)) + WhereDataTable := FFacturas.DataTable.Where.Clause; + + dsDataTable.DataTable := FFacturas.DataTable; + if Assigned(ViewGrid) then + (ViewGrid as IViewFacturasCliente).Facturas := Facturas; + end; end; end. diff --git a/Source/Modulos/Facturas de proveedor/Controller/uFacturasProveedorController.pas b/Source/Modulos/Facturas de proveedor/Controller/uFacturasProveedorController.pas index b87415ec..929a46ff 100644 --- a/Source/Modulos/Facturas de proveedor/Controller/uFacturasProveedorController.pas +++ b/Source/Modulos/Facturas de proveedor/Controller/uFacturasProveedorController.pas @@ -54,6 +54,9 @@ type const AEnviarDirectamente: Boolean = True; const ADireccionEMail: String = ''; const AAsuntoEMail: String = ''; const ATextoEMail: String = ''): Boolean; + + function DarListaAnosFacturas: TStringList; + procedure FiltrarAno(AFactura: IBizFacturaProveedor; AWhereDataTable: String; const Ano: String); end; TFacturasProveedorController = class(TObservador, IFacturasProveedorController) @@ -123,6 +126,9 @@ type const AEnviarDirectamente: Boolean = True; const ADireccionEMail: String = ''; const AAsuntoEMail: String = ''; const ATextoEMail: String = ''): Boolean; + + function DarListaAnosFacturas: TStringList; + procedure FiltrarAno(AFactura: IBizFacturaProveedor; AWhereDataTable: String; const Ano: String); end; implementation @@ -554,6 +560,11 @@ begin Result := Supports(EditorRegistry.CreateEditor(AName), IID, Intf); end; +function TFacturasProveedorController.DarListaAnosFacturas: TStringList; +begin + Result := FDataModule.GetAnosItems; +end; + procedure TFacturasProveedorController.DescartarCambios(AFactura: IBizFacturaProveedor); begin if not Assigned(AFactura) then @@ -1029,6 +1040,31 @@ begin end; end; +procedure TFacturasProveedorController.FiltrarAno(AFactura: IBizFacturaProveedor; AWhereDataTable: String; const Ano: String); +var + FechaIni: String; + FechaFin: String; + +begin + AFactura.DataTable.Where.Clear; + AFactura.DataTable.Where.AddText(AWhereDataTable); + + if (Ano <> 'Todos') then + begin + // Filtrar las facturas actuales por empresa + FechaIni := '01.01.' + Ano; + FechaFin := '31.12.' + Ano; + with AFactura.DataTable.Where do + begin + if NotEmpty then + AddOperator(opAND); + AddCondition(fld_FacturasProveedorFECHA_FACTURA, cMajorOrEqual, FechaIni); + AddOperator(opAND); + AddCondition(fld_FacturasProveedorFECHA_FACTURA, cLessOrEqual, FechaFin); + end; + end; +end; + procedure TFacturasProveedorController.FiltrarEmpresa(AFactura: IBizFacturaProveedor); begin if AFactura.DataTable.Active then diff --git a/Source/Modulos/Facturas de proveedor/Data/uDataModuleFacturasProveedor.dfm b/Source/Modulos/Facturas de proveedor/Data/uDataModuleFacturasProveedor.dfm index 3c587e38..2e388ef6 100644 --- a/Source/Modulos/Facturas de proveedor/Data/uDataModuleFacturasProveedor.dfm +++ b/Source/Modulos/Facturas de proveedor/Data/uDataModuleFacturasProveedor.dfm @@ -901,4 +901,113 @@ object DataModuleFacturasProveedor: TDataModuleFacturasProveedor Left = 400 Top = 104 end + object tbl_ListaAnosFacturas: TDACDSDataTable + RemoteUpdatesOptions = [] + Fields = < + item + Name = 'ANO' + DataType = datString + Size = 254 + BlobType = dabtUnknown + DisplayWidth = 0 + Alignment = taLeftJustify + InPrimaryKey = False + Calculated = False + Lookup = False + LookupCache = False + end> + Params = <> + MasterMappingMode = mmDataRequest + StreamingOptions = [soDisableEventsWhileStreaming] + SchemaCall.MethodName = 'GetDatasetSchema' + SchemaCall.Params = < + item + Name = 'Result' + ParamType = fResult + DataType = rtBinary + end + item + Name = 'aDatasetName' + ParamType = fIn + DataType = rtString + Value = 'ListaAnosFacturas' + end> + DataRequestCall.MethodName = 'GetDatasetDataEx' + DataRequestCall.Params = < + item + Name = 'Result' + ParamType = fResult + DataType = rtBinary + end + item + Name = 'DatasetName' + ParamType = fIn + DataType = rtString + Value = 'ListaAnosFacturas' + end + item + Name = 'Params' + ParamType = fIn + DataType = rtUserDefined + UserClassName = 'TDADatasetParamArray' + end + item + Name = 'UserFilter' + ParamType = fIn + DataType = rtString + Value = '' + end + item + Name = 'IncludeSchema' + ParamType = fIn + DataType = rtBoolean + Value = False + end + item + Name = 'MaxRecords' + ParamType = fIn + DataType = rtInteger + Value = -1 + end> + DataUpdateCall.MethodName = 'UpdateData' + DataUpdateCall.Params = < + item + Name = 'Result' + ParamType = fResult + DataType = rtBinary + end + item + Name = 'Delta' + ParamType = fIn + DataType = rtBinary + end> + ScriptCall.MethodName = 'GetDatasetScripts' + ScriptCall.Params = < + item + Name = 'Result' + ParamType = fResult + DataType = rtString + Value = '' + end + item + Name = 'DatasetNames' + ParamType = fIn + DataType = rtString + Value = 'ListaAnosFacturas' + end> + ReadOnly = False + RemoteService = RORemoteService + Adapter = DABinAdapter + DetailOptions = [dtCascadeOpenClose, dtCascadeApplyUpdates, dtAutoFetch, dtCascadeDelete, dtCascadeUpdate, dtDisableLogOfCascadeDeletes, dtDisableLogOfCascadeUpdates, dtIncludeInAllInOneFetch] + MasterOptions = [moCascadeOpenClose, moCascadeApplyUpdates, moCascadeDelete, moCascadeUpdate, moDisableLogOfCascadeDeletes, moDisableLogOfCascadeUpdates] + LogicalName = 'ListaAnosFacturas' + IndexDefs = <> + Left = 320 + Top = 272 + end + object ds_ListaAnosFacturas: TDADataSource + DataTable = tbl_ListaAnosFacturas + Left = 320 + Top = 216 + end end diff --git a/Source/Modulos/Facturas de proveedor/Data/uDataModuleFacturasProveedor.pas b/Source/Modulos/Facturas de proveedor/Data/uDataModuleFacturasProveedor.pas index e8e1b0d6..e0e63b6f 100644 --- a/Source/Modulos/Facturas de proveedor/Data/uDataModuleFacturasProveedor.pas +++ b/Source/Modulos/Facturas de proveedor/Data/uDataModuleFacturasProveedor.pas @@ -22,6 +22,8 @@ type ds_FacturasProveedor: TDADataSource; tbl_FacturasProveedor_Detalles: TDACDSDataTable; ds_FacturasProveedor_Detalles: TDADataSource; + tbl_ListaAnosFacturas: TDACDSDataTable; + ds_ListaAnosFacturas: TDADataSource; procedure DAClientDataModuleCreate(Sender: TObject); private function _CloneDataTable (const ADataTable : TDACDSDataTable): TDACDSDataTable; overload; @@ -36,6 +38,7 @@ type function GetReport(const AFacturaID: String): Binary; function GetRptPDFFacturas(const AID: Integer; const ShowLogotipo: Boolean = False): Binary; + function GetAnosItems : TStringList; end; implementation @@ -121,6 +124,30 @@ begin end; end; +function TDataModuleFacturasProveedor.GetAnosItems: TStringList; +var + AListaAnos: TStringList; +begin + AListaAnos := TStringList.Create; + ShowHourglassCursor; + try + with tbl_ListaAnosFacturas do + begin + Open; + First; + while not eof do + begin + AListaAnos.Add(Format('%s=%s', [Fields[0].AsString, Fields[0].AsString])); + Next; + end; + Close; + end; + Result := AListaAnos; + finally + HideHourglassCursor; + end; +end; + function TDataModuleFacturasProveedor.GetItem(const ID: Integer): IBizFacturaProveedor; begin ShowHourglassCursor; diff --git a/Source/Modulos/Facturas de proveedor/Model/Data/uIDataModuleFacturasProveedor.pas b/Source/Modulos/Facturas de proveedor/Model/Data/uIDataModuleFacturasProveedor.pas index eec61a03..72bdcd73 100644 --- a/Source/Modulos/Facturas de proveedor/Model/Data/uIDataModuleFacturasProveedor.pas +++ b/Source/Modulos/Facturas de proveedor/Model/Data/uIDataModuleFacturasProveedor.pas @@ -9,6 +9,7 @@ uses type IDataModuleFacturasProveedor = interface ['{FD0F5B2F-5556-4031-86F0-EFF96805FD66}'] + function GetAnosItems : TStringList; function GetItems: IBizFacturaProveedor; function GetItem(const ID : Integer) : IBizFacturaProveedor; function GetNextID(const DataSetName : String) : Integer; diff --git a/Source/Modulos/Facturas de proveedor/Model/schFacturasProveedorClient_Intf.pas b/Source/Modulos/Facturas de proveedor/Model/schFacturasProveedorClient_Intf.pas index 3cac050a..6621a582 100644 --- a/Source/Modulos/Facturas de proveedor/Model/schFacturasProveedorClient_Intf.pas +++ b/Source/Modulos/Facturas de proveedor/Model/schFacturasProveedorClient_Intf.pas @@ -9,19 +9,27 @@ const { Data table rules ids Feel free to change them to something more human readable but make sure they are unique in the context of your application } - RID_darReferencia = '{3702A8D4-542B-4B43-9C44-D838C5B94D06}'; - RID_FacturasProveedor = '{DF304139-ED00-47CD-82B3-2FB5BC641650}'; - RID_FacturasProveedor_Detalles = '{74A5AB9E-6DA2-4517-B5BB-20F9FF441D4A}'; - RID_FacturasProveedor_Detalles_Refresh = '{8C687B77-B589-4613-9908-935FB59DA5FB}'; - RID_FacturasProveedor_Refresh = '{81F6B50C-EF92-49C7-8207-D3BD0156CCAE}'; + RID_ListaAnosFacturas = '{70EAC624-449A-4C2D-A171-02AFF36ABAD3}'; + RID_darReferencia = '{0274F164-968D-45A1-85A1-759FEDE0316D}'; + RID_FacturasProveedor = '{A120C0B7-5F66-4256-8D73-08D1720667DF}'; + RID_FacturasProveedor_Detalles = '{4DA06E3C-AE72-4BCF-A4BE-52778C461BCE}'; + RID_FacturasProveedor_Detalles_Refresh = '{A446C1C0-E31A-4D15-BB72-825834D5A48C}'; + RID_FacturasProveedor_Refresh = '{1EC31E89-5AEF-4057-BFCB-4719F6F17A56}'; { Data table names } + nme_ListaAnosFacturas = 'ListaAnosFacturas'; nme_darReferencia = 'darReferencia'; nme_FacturasProveedor = 'FacturasProveedor'; nme_FacturasProveedor_Detalles = 'FacturasProveedor_Detalles'; nme_FacturasProveedor_Detalles_Refresh = 'FacturasProveedor_Detalles_Refresh'; nme_FacturasProveedor_Refresh = 'FacturasProveedor_Refresh'; + { ListaAnosFacturas fields } + fld_ListaAnosFacturasANO = 'ANO'; + + { ListaAnosFacturas field indexes } + idx_ListaAnosFacturasANO = 0; + { darReferencia fields } fld_darReferenciaVALOR = 'VALOR'; @@ -237,9 +245,38 @@ const idx_FacturasProveedor_RefreshFECHA_VENCIMIENTO = 33; type + { IListaAnosFacturas } + IListaAnosFacturas = interface(IDAStronglyTypedDataTable) + ['{8C8C7921-105D-4816-B414-3A838B66BDED}'] + { Property getters and setters } + function GetANOValue: String; + procedure SetANOValue(const aValue: String); + + + { Properties } + property ANO: String read GetANOValue write SetANOValue; + end; + + { TListaAnosFacturasDataTableRules } + TListaAnosFacturasDataTableRules = class(TDADataTableRules, IListaAnosFacturas) + private + protected + { Property getters and setters } + function GetANOValue: String; virtual; + procedure SetANOValue(const aValue: String); virtual; + + { Properties } + property ANO: String read GetANOValue write SetANOValue; + + public + constructor Create(aDataTable: TDADataTable); override; + destructor Destroy; override; + + end; + { IdarReferencia } IdarReferencia = interface(IDAStronglyTypedDataTable) - ['{83152272-9537-4CC0-B2B9-52D3DCB94CC1}'] + ['{F4DA60C5-AA5C-4C19-A6F1-AC34598B7253}'] { Property getters and setters } function GetVALORValue: String; procedure SetVALORValue(const aValue: String); @@ -268,7 +305,7 @@ type { IFacturasProveedor } IFacturasProveedor = interface(IDAStronglyTypedDataTable) - ['{1D0E8202-D645-489F-9E75-F8C3E625DA5D}'] + ['{27F3C7CA-62C3-4BA7-9174-40ECDD054CE1}'] { Property getters and setters } function GetIDValue: Integer; procedure SetIDValue(const aValue: Integer); @@ -495,7 +532,7 @@ type { IFacturasProveedor_Detalles } IFacturasProveedor_Detalles = interface(IDAStronglyTypedDataTable) - ['{E79A8CFF-C4FB-4165-BD40-1A655B5560FC}'] + ['{04247BEA-5459-456E-8FED-8AA310EC3032}'] { Property getters and setters } function GetIDValue: Integer; procedure SetIDValue(const aValue: Integer); @@ -602,7 +639,7 @@ type { IFacturasProveedor_Detalles_Refresh } IFacturasProveedor_Detalles_Refresh = interface(IDAStronglyTypedDataTable) - ['{7AF91EA7-7E55-42D9-99DF-E0D1BBDA4678}'] + ['{284DC1B7-E465-4F55-B460-883905501260}'] { Property getters and setters } function GetIDValue: Integer; procedure SetIDValue(const aValue: Integer); @@ -709,7 +746,7 @@ type { IFacturasProveedor_Refresh } IFacturasProveedor_Refresh = interface(IDAStronglyTypedDataTable) - ['{49436B87-CB54-4066-BCFF-BDDE2410A264}'] + ['{6C448004-0E85-4BC6-9086-99379FF83405}'] { Property getters and setters } function GetIDValue: Integer; procedure SetIDValue(const aValue: Integer); @@ -938,6 +975,28 @@ implementation uses Variants; +{ TListaAnosFacturasDataTableRules } +constructor TListaAnosFacturasDataTableRules.Create(aDataTable: TDADataTable); +begin + inherited; +end; + +destructor TListaAnosFacturasDataTableRules.Destroy; +begin + inherited; +end; + +function TListaAnosFacturasDataTableRules.GetANOValue: String; +begin + result := DataTable.Fields[idx_ListaAnosFacturasANO].AsString; +end; + +procedure TListaAnosFacturasDataTableRules.SetANOValue(const aValue: String); +begin + DataTable.Fields[idx_ListaAnosFacturasANO].AsString := aValue; +end; + + { TdarReferenciaDataTableRules } constructor TdarReferenciaDataTableRules.Create(aDataTable: TDADataTable); begin @@ -1971,6 +2030,7 @@ end; initialization + RegisterDataTableRules(RID_ListaAnosFacturas, TListaAnosFacturasDataTableRules); RegisterDataTableRules(RID_darReferencia, TdarReferenciaDataTableRules); RegisterDataTableRules(RID_FacturasProveedor, TFacturasProveedorDataTableRules); RegisterDataTableRules(RID_FacturasProveedor_Detalles, TFacturasProveedor_DetallesDataTableRules); diff --git a/Source/Modulos/Facturas de proveedor/Model/schFacturasProveedorServer_Intf.pas b/Source/Modulos/Facturas de proveedor/Model/schFacturasProveedorServer_Intf.pas index 9cde4034..0cabb21c 100644 --- a/Source/Modulos/Facturas de proveedor/Model/schFacturasProveedorServer_Intf.pas +++ b/Source/Modulos/Facturas de proveedor/Model/schFacturasProveedorServer_Intf.pas @@ -9,16 +9,46 @@ const { Delta rules ids Feel free to change them to something more human readable but make sure they are unique in the context of your application } - RID_darReferenciaDelta = '{0E73F199-FA0A-4189-9760-9CE6C99E7EB3}'; - RID_FacturasProveedorDelta = '{4F3FA98F-4BC6-416A-8B47-C9E2B0B2FAA7}'; - RID_FacturasProveedor_DetallesDelta = '{946B1AE8-1695-4BB3-8A7A-9827305E2ACE}'; - RID_FacturasProveedor_Detalles_RefreshDelta = '{D52663D1-8475-4406-90D4-19CD1638018B}'; - RID_FacturasProveedor_RefreshDelta = '{37B84B46-1766-4FBF-89EF-D435761DD571}'; + RID_ListaAnosFacturasDelta = '{DAA042A6-D72B-4F6C-B3C1-3E1D4418A214}'; + RID_darReferenciaDelta = '{122C0944-862E-48BC-9974-D9EF9C6EB3CC}'; + RID_FacturasProveedorDelta = '{7A5E7012-A904-480D-B951-B387CF375EB8}'; + RID_FacturasProveedor_DetallesDelta = '{A862E9E7-CDCC-4455-A054-F1209C9404C0}'; + RID_FacturasProveedor_Detalles_RefreshDelta = '{2A5AD3A0-DD3C-468E-8A3E-C4DBDB5408CB}'; + RID_FacturasProveedor_RefreshDelta = '{BFF6F42D-413B-449C-8469-4DB070D778B9}'; type + { IListaAnosFacturasDelta } + IListaAnosFacturasDelta = interface(IListaAnosFacturas) + ['{DAA042A6-D72B-4F6C-B3C1-3E1D4418A214}'] + { Property getters and setters } + function GetOldANOValue : String; + + { Properties } + property OldANO : String read GetOldANOValue; + end; + + { TListaAnosFacturasBusinessProcessorRules } + TListaAnosFacturasBusinessProcessorRules = class(TDABusinessProcessorRules, IListaAnosFacturas, IListaAnosFacturasDelta) + private + protected + { Property getters and setters } + function GetANOValue: String; virtual; + function GetOldANOValue: String; virtual; + procedure SetANOValue(const aValue: String); virtual; + + { Properties } + property ANO : String read GetANOValue write SetANOValue; + property OldANO : String read GetOldANOValue; + + public + constructor Create(aBusinessProcessor: TDABusinessProcessor); override; + destructor Destroy; override; + + end; + { IdarReferenciaDelta } IdarReferenciaDelta = interface(IdarReferencia) - ['{0E73F199-FA0A-4189-9760-9CE6C99E7EB3}'] + ['{122C0944-862E-48BC-9974-D9EF9C6EB3CC}'] { Property getters and setters } function GetOldVALORValue : String; @@ -47,7 +77,7 @@ type { IFacturasProveedorDelta } IFacturasProveedorDelta = interface(IFacturasProveedor) - ['{4F3FA98F-4BC6-416A-8B47-C9E2B0B2FAA7}'] + ['{7A5E7012-A904-480D-B951-B387CF375EB8}'] { Property getters and setters } function GetOldIDValue : Integer; function GetOldID_EMPRESAValue : Integer; @@ -307,7 +337,7 @@ type { IFacturasProveedor_DetallesDelta } IFacturasProveedor_DetallesDelta = interface(IFacturasProveedor_Detalles) - ['{946B1AE8-1695-4BB3-8A7A-9827305E2ACE}'] + ['{A862E9E7-CDCC-4455-A054-F1209C9404C0}'] { Property getters and setters } function GetOldIDValue : Integer; function GetOldID_FACTURAValue : Integer; @@ -427,7 +457,7 @@ type { IFacturasProveedor_Detalles_RefreshDelta } IFacturasProveedor_Detalles_RefreshDelta = interface(IFacturasProveedor_Detalles_Refresh) - ['{D52663D1-8475-4406-90D4-19CD1638018B}'] + ['{2A5AD3A0-DD3C-468E-8A3E-C4DBDB5408CB}'] { Property getters and setters } function GetOldIDValue : Integer; function GetOldID_FACTURAValue : Integer; @@ -547,7 +577,7 @@ type { IFacturasProveedor_RefreshDelta } IFacturasProveedor_RefreshDelta = interface(IFacturasProveedor_Refresh) - ['{37B84B46-1766-4FBF-89EF-D435761DD571}'] + ['{BFF6F42D-413B-449C-8469-4DB070D778B9}'] { Property getters and setters } function GetOldIDValue : Integer; function GetOldID_EMPRESAValue : Integer; @@ -810,6 +840,33 @@ implementation uses Variants, uROBinaryHelpers; +{ TListaAnosFacturasBusinessProcessorRules } +constructor TListaAnosFacturasBusinessProcessorRules.Create(aBusinessProcessor: TDABusinessProcessor); +begin + inherited; +end; + +destructor TListaAnosFacturasBusinessProcessorRules.Destroy; +begin + inherited; +end; + +function TListaAnosFacturasBusinessProcessorRules.GetANOValue: String; +begin + result := BusinessProcessor.CurrentChange.NewValueByName[fld_ListaAnosFacturasANO]; +end; + +function TListaAnosFacturasBusinessProcessorRules.GetOldANOValue: String; +begin + result := BusinessProcessor.CurrentChange.OldValueByName[fld_ListaAnosFacturasANO]; +end; + +procedure TListaAnosFacturasBusinessProcessorRules.SetANOValue(const aValue: String); +begin + BusinessProcessor.CurrentChange.NewValueByName[fld_ListaAnosFacturasANO] := aValue; +end; + + { TdarReferenciaBusinessProcessorRules } constructor TdarReferenciaBusinessProcessorRules.Create(aBusinessProcessor: TDABusinessProcessor); begin @@ -2330,6 +2387,7 @@ end; initialization + RegisterBusinessProcessorRules(RID_ListaAnosFacturasDelta, TListaAnosFacturasBusinessProcessorRules); RegisterBusinessProcessorRules(RID_darReferenciaDelta, TdarReferenciaBusinessProcessorRules); RegisterBusinessProcessorRules(RID_FacturasProveedorDelta, TFacturasProveedorBusinessProcessorRules); RegisterBusinessProcessorRules(RID_FacturasProveedor_DetallesDelta, TFacturasProveedor_DetallesBusinessProcessorRules); diff --git a/Source/Modulos/Facturas de proveedor/Servidor/srvFacturasProveedor_Impl.dfm b/Source/Modulos/Facturas de proveedor/Servidor/srvFacturasProveedor_Impl.dfm index f9aa3a43..cf3402cb 100644 --- a/Source/Modulos/Facturas de proveedor/Servidor/srvFacturasProveedor_Impl.dfm +++ b/Source/Modulos/Facturas de proveedor/Servidor/srvFacturasProveedor_Impl.dfm @@ -16,6 +16,35 @@ object srvFacturasProveedor: TsrvFacturasProveedor DataDictionary = DataDictionary Diagrams = Diagrams Datasets = < + item + Params = <> + Statements = < + item + Connection = 'IBX' + SQL = + 'select ANO from'#10'(select distinct(substr(FECHA_FACTURA, 1,4)) as ' + + 'ANO'#10'from facturas_proveedor'#10'order by 1 desc)'#10#10'UNION ALL'#10#10'select ' + + 'distinct '#39'Todos'#39' as ANO'#10'from empresas' + StatementType = stSQL + ColumnMappings = <> + end> + Name = 'ListaAnosFacturas' + Fields = < + item + Name = 'ANO' + DataType = datString + Size = 254 + BlobType = dabtUnknown + DisplayWidth = 0 + Alignment = taLeftJustify + InPrimaryKey = False + Calculated = False + Lookup = False + LookupCache = False + end> + BusinessRulesClient.ScriptLanguage = rslPascalScript + BusinessRulesServer.ScriptLanguage = rslPascalScript + end item Params = < item diff --git a/Source/Modulos/Facturas de proveedor/Views/uEditorFacturasProveedor.dfm b/Source/Modulos/Facturas de proveedor/Views/uEditorFacturasProveedor.dfm index 21f4db3e..7129c3e3 100644 --- a/Source/Modulos/Facturas de proveedor/Views/uEditorFacturasProveedor.dfm +++ b/Source/Modulos/Facturas de proveedor/Views/uEditorFacturasProveedor.dfm @@ -61,9 +61,26 @@ inherited fEditorFacturasProveedor: TfEditorFacturasProveedor Action = actEnviarEMail end end + inherited tbxFiltro: TTBXToolbar + DockPos = -6 + ExplicitWidth = 435 + inherited lblAno: TTBXLabelItem + Visible = True + end + inherited cbxListaAnos: TTBXComboBoxItem + Visible = True + end + inherited sepAno: TTBXSeparatorItem + Visible = True + end + end inherited tbxMenu: TTBXToolbar ExplicitWidth = 640 end + inherited TBXTMain2: TTBXToolbar + Left = 435 + ExplicitLeft = 435 + end end inherited StatusBar: TJvStatusBar Top = 647 diff --git a/Source/Modulos/Facturas de proveedor/Views/uEditorFacturasProveedor.pas b/Source/Modulos/Facturas de proveedor/Views/uEditorFacturasProveedor.pas index 05861c17..5fd14b50 100644 --- a/Source/Modulos/Facturas de proveedor/Views/uEditorFacturasProveedor.pas +++ b/Source/Modulos/Facturas de proveedor/Views/uEditorFacturasProveedor.pas @@ -39,21 +39,27 @@ type procedure actNuevoAbonoExecute(Sender: TObject); procedure actEnviarEMailExecute(Sender: TObject); procedure actEnviarEMailUpdate(Sender: TObject); + procedure OnListaAnosChange(Sender: TObject; const Text: string); + private FFacturas: IBizFacturaProveedor; FController : IFacturasProveedorController; + protected function GetFacturas: IBizFacturaProveedor; procedure SetFacturas(const Value: IBizFacturaProveedor); function GetController : IFacturasProveedorController; virtual; procedure SetController (const Value : IFacturasProveedorController); virtual; + procedure NuevoInterno; override; procedure EliminarInterno; override; procedure ModificarInterno; override; procedure DuplicarInterno; override; procedure ImprimirInterno; override; procedure PrevisualizarInterno; override; + procedure RefrescarInterno; override; + public procedure PonerTitulos(const ATitulo: string = ''); override; property Facturas: IBizFacturaProveedor read GetFacturas write SetFacturas; @@ -241,6 +247,8 @@ end; procedure TfEditorFacturasProveedor.FormShow(Sender: TObject); begin + cbxListaAnos.OnChange := OnListaAnosChange; //OJO SIEMPRE ANTES DEL INHERITED + inherited; if not Assigned(ViewGrid) then @@ -355,6 +363,13 @@ begin end; end; +procedure TfEditorFacturasProveedor.OnListaAnosChange(Sender: TObject; const Text: string); +begin + Controller.FiltrarAno(Facturas, WhereDataTable, Text); + if Facturas.DataTable.Active then + RefrescarInterno; +end; + procedure TfEditorFacturasProveedor.PonerTitulos(const ATitulo: string); var FTitulo : String; @@ -404,17 +419,37 @@ begin end; end; +procedure TfEditorFacturasProveedor.RefrescarInterno; +begin + //Volvemos a cargar los años de las facturas + if Assigned(FController) then + ListaAnos := FController.DarListaAnosFacturas; + + inherited; +end; + procedure TfEditorFacturasProveedor.SetController(const Value: IFacturasProveedorController); begin FController := Value; + + if Assigned(FController) then + ListaAnos := FController.DarListaAnosFacturas; end; procedure TfEditorFacturasProveedor.SetFacturas(const Value: IBizFacturaProveedor); begin FFacturas := Value; - dsDataTable.DataTable := FFacturas.DataTable; - if Assigned(ViewGrid) then - (ViewGrid as IViewFacturasProveedor).Facturas := Facturas; + + if Assigned(FFacturas) then + begin + //Se guarda el where de la sentencia origen, por si el editor tiene filtros que + //afecten a este where y en un futuro se desea volver al where origen (filtro de año)) + WhereDataTable := FFacturas.DataTable.Where.Clause; + + dsDataTable.DataTable := FFacturas.DataTable; + if Assigned(ViewGrid) then + (ViewGrid as IViewFacturasProveedor).Facturas := Facturas; + end; end; end. diff --git a/Source/Modulos/Pedidos a proveedor/Controller/uPedidosProveedorController.pas b/Source/Modulos/Pedidos a proveedor/Controller/uPedidosProveedorController.pas index 5900beb9..d0ebfe0c 100644 --- a/Source/Modulos/Pedidos a proveedor/Controller/uPedidosProveedorController.pas +++ b/Source/Modulos/Pedidos a proveedor/Controller/uPedidosProveedorController.pas @@ -4,7 +4,7 @@ interface uses - SysUtils, uDADataTable, uEditorDBItem, + Classes, SysUtils, uDADataTable, uEditorDBItem, uControllerBase, uIDataModulePedidosProveedor, uProveedoresController, uDetallesPedidoProveedorController, uBizPedidosProveedor, uViewGridBase; @@ -56,6 +56,9 @@ type const AEnviarDirectamente: Boolean = True; const ADireccionEMail: String = ''; const AAsuntoEMail: String = ''; const ATextoEMail: String = ''): Boolean; + + function DarListaAnosPedidos: TStringList; + procedure FiltrarAno(APedido: IBizPedidoProveedor; AWhereDataTable: String; const Ano: String); end; TPedidosProveedorController = class(TObservador, IPedidosProveedorController) @@ -129,6 +132,9 @@ type const AEnviarDirectamente: Boolean = True; const ADireccionEMail: String = ''; const AAsuntoEMail: String = ''; const ATextoEMail: String = ''): Boolean; + + function DarListaAnosPedidos: TStringList; + procedure FiltrarAno(APedido: IBizPedidoProveedor; AWhereDataTable: String; const Ano: String); end; implementation @@ -139,7 +145,7 @@ uses uBizDetallesPedidoProveedor, uBizContactos, uDataTableUtils, uDataModuleUsuarios, schPedidosProveedorClient_Intf, uDAInterfaces, uPedidosProveedorReportController, uDateUtils, uIEditorPedidoProveedor, uIEditorElegirPedidosProveedor, - Dialogs, uIEditorDireccionEntregaPedidoProveedor, Classes, + Dialogs, uIEditorDireccionEntregaPedidoProveedor, uIEditorSituacionPedidoProveedor, Variants, uDataModuleRegistroCorreos, uIDialogListaPedidosProvEnvioEMail, uSistemaFunc, uStringsUtils, uDialogElegirEMail, Forms, uEMailUtils; @@ -222,6 +228,11 @@ begin Result := Supports(EditorRegistry.CreateEditor(AName), IID, Intf); end; +function TPedidosProveedorController.DarListaAnosPedidos: TStringList; +begin + Result := FDataModule.GetAnosItems; +end; + procedure TPedidosProveedorController.DescartarCambios(APedido: IBizPedidoProveedor); begin if not Assigned(APedido) then @@ -814,6 +825,31 @@ begin end; end; +procedure TPedidosProveedorController.FiltrarAno(APedido: IBizPedidoProveedor; AWhereDataTable: String; const Ano: String); +var + FechaIni: String; + FechaFin: String; + +begin + APedido.DataTable.Where.Clear; + APedido.DataTable.Where.AddText(AWhereDataTable); + + if (Ano <> 'Todos') then + begin + // Filtrar las facturas actuales por empresa + FechaIni := '01.01.' + Ano; + FechaFin := '31.12.' + Ano; + with APedido.DataTable.Where do + begin + if NotEmpty then + AddOperator(opAND); + AddCondition(fld_PedidosProveedorFECHA_PEDIDO, cMajorOrEqual, FechaIni); + AddOperator(opAND); + AddCondition(fld_PedidosProveedorFECHA_PEDIDO, cLessOrEqual, FechaFin); + end; + end; +end; + procedure TPedidosProveedorController.FiltrarEmpresa( APedido: IBizPedidoProveedor); begin diff --git a/Source/Modulos/Pedidos a proveedor/Data/uDataModulePedidosProveedor.dfm b/Source/Modulos/Pedidos a proveedor/Data/uDataModulePedidosProveedor.dfm index 5f84e7d5..bab31402 100644 --- a/Source/Modulos/Pedidos a proveedor/Data/uDataModulePedidosProveedor.dfm +++ b/Source/Modulos/Pedidos a proveedor/Data/uDataModulePedidosProveedor.dfm @@ -1102,4 +1102,113 @@ object DataModulePedidosProveedor: TDataModulePedidosProveedor Left = 312 Top = 200 end + object tbl_ListaAnosPedidos: TDACDSDataTable + RemoteUpdatesOptions = [] + Fields = < + item + Name = 'ANO' + DataType = datString + Size = 254 + BlobType = dabtUnknown + DisplayWidth = 0 + Alignment = taLeftJustify + InPrimaryKey = False + Calculated = False + Lookup = False + LookupCache = False + end> + Params = <> + MasterMappingMode = mmDataRequest + StreamingOptions = [soDisableEventsWhileStreaming] + SchemaCall.MethodName = 'GetDatasetSchema' + SchemaCall.Params = < + item + Name = 'Result' + ParamType = fResult + DataType = rtBinary + end + item + Name = 'aDatasetName' + ParamType = fIn + DataType = rtString + Value = 'ListaAnosPedidos' + end> + DataRequestCall.MethodName = 'GetDatasetDataEx' + DataRequestCall.Params = < + item + Name = 'Result' + ParamType = fResult + DataType = rtBinary + end + item + Name = 'DatasetName' + ParamType = fIn + DataType = rtString + Value = 'ListaAnosPedidos' + end + item + Name = 'Params' + ParamType = fIn + DataType = rtUserDefined + UserClassName = 'TDADatasetParamArray' + end + item + Name = 'UserFilter' + ParamType = fIn + DataType = rtString + Value = '' + end + item + Name = 'IncludeSchema' + ParamType = fIn + DataType = rtBoolean + Value = False + end + item + Name = 'MaxRecords' + ParamType = fIn + DataType = rtInteger + Value = -1 + end> + DataUpdateCall.MethodName = 'UpdateData' + DataUpdateCall.Params = < + item + Name = 'Result' + ParamType = fResult + DataType = rtBinary + end + item + Name = 'Delta' + ParamType = fIn + DataType = rtBinary + end> + ScriptCall.MethodName = 'GetDatasetScripts' + ScriptCall.Params = < + item + Name = 'Result' + ParamType = fResult + DataType = rtString + Value = '' + end + item + Name = 'DatasetNames' + ParamType = fIn + DataType = rtString + Value = 'ListaAnosPedidos' + end> + ReadOnly = False + RemoteService = RORemoteService + Adapter = DABinAdapter + DetailOptions = [dtCascadeOpenClose, dtCascadeApplyUpdates, dtAutoFetch, dtCascadeDelete, dtCascadeUpdate, dtDisableLogOfCascadeDeletes, dtDisableLogOfCascadeUpdates, dtIncludeInAllInOneFetch] + MasterOptions = [moCascadeOpenClose, moCascadeApplyUpdates, moCascadeDelete, moCascadeUpdate, moDisableLogOfCascadeDeletes, moDisableLogOfCascadeUpdates] + LogicalName = 'ListaAnosPedidos' + IndexDefs = <> + Left = 152 + Top = 216 + end + object ds_ListaAnosPedidos: TDADataSource + DataTable = tbl_ListaAnosPedidos + Left = 152 + Top = 168 + end end diff --git a/Source/Modulos/Pedidos a proveedor/Data/uDataModulePedidosProveedor.pas b/Source/Modulos/Pedidos a proveedor/Data/uDataModulePedidosProveedor.pas index 00eca759..25ece79e 100644 --- a/Source/Modulos/Pedidos a proveedor/Data/uDataModulePedidosProveedor.pas +++ b/Source/Modulos/Pedidos a proveedor/Data/uDataModulePedidosProveedor.pas @@ -26,6 +26,8 @@ type LoginRemoteService: TRORemoteService; tbl_PedidosProveedor_Articulos_Pendientes: TDACDSDataTable; ds_PedidosProveedor_Articulos_Pendientes: TDADataSource; + tbl_ListaAnosPedidos: TDACDSDataTable; + ds_ListaAnosPedidos: TDADataSource; procedure DAClientDataModuleCreate(Sender: TObject); private @@ -46,6 +48,8 @@ type // Report function GetReport(const AID: String): Binary; function GetRptPDF(const AID: Integer; const ShowLogotipo: Boolean = False): Binary; + + function GetAnosItems : TStringList; end; implementation @@ -137,6 +141,30 @@ begin end; end; +function TDataModulePedidosProveedor.GetAnosItems: TStringList; +var + AListaAnos: TStringList; +begin + AListaAnos := TStringList.Create; + ShowHourglassCursor; + try + with tbl_ListaAnosPedidos do + begin + Open; + First; + while not eof do + begin + AListaAnos.Add(Format('%s=%s', [Fields[0].AsString, Fields[0].AsString])); + Next; + end; + Close; + end; + Result := AListaAnos; + finally + HideHourglassCursor; + end; +end; + function TDataModulePedidosProveedor.GetArticulosPendientes(const IDPedido: Integer): IBizDetallesPedidoProveedorPend; var AArticulos : TDACDSDataTable; diff --git a/Source/Modulos/Pedidos a proveedor/Model/Data/uIDataModulePedidosProveedor.pas b/Source/Modulos/Pedidos a proveedor/Model/Data/uIDataModulePedidosProveedor.pas index fbf28b0c..f759ed71 100644 --- a/Source/Modulos/Pedidos a proveedor/Model/Data/uIDataModulePedidosProveedor.pas +++ b/Source/Modulos/Pedidos a proveedor/Model/Data/uIDataModulePedidosProveedor.pas @@ -3,11 +3,12 @@ unit uIDataModulePedidosProveedor; interface uses - uBizPedidosProveedor, uBizDetallesPedidoProveedor; + Classes, uBizPedidosProveedor, uBizDetallesPedidoProveedor; type IDataModulePedidosProveedor = interface ['{280AA760-26CC-4962-AB08-6C473199DF86}'] + function GetAnosItems : TStringList; function GetItems: IBizPedidoProveedor; function GetItem(const ID : Integer) : IBizPedidoProveedor; function GetNextID(const DataSetName : String) : Integer; diff --git a/Source/Modulos/Pedidos a proveedor/Model/schPedidosProveedorClient_Intf.pas b/Source/Modulos/Pedidos a proveedor/Model/schPedidosProveedorClient_Intf.pas index 63030667..64b7c314 100644 --- a/Source/Modulos/Pedidos a proveedor/Model/schPedidosProveedorClient_Intf.pas +++ b/Source/Modulos/Pedidos a proveedor/Model/schPedidosProveedorClient_Intf.pas @@ -9,14 +9,16 @@ const { Data table rules ids Feel free to change them to something more human readable but make sure they are unique in the context of your application } - RID_DarReferencia = '{569D9087-BBEE-4EC6-9A84-936628C183A9}'; - RID_PedidosProveedor = '{92B50C29-DC14-4FD5-A1C1-B6B4DCD3EEBD}'; - RID_PedidosProveedor_Detalles = '{B6ECB5AB-5B23-468C-9F17-B8826F1F7D3A}'; - RID_PedidosProveedor_Detalles_Refresh = '{36A9B592-23EC-4FE7-BB3A-81B2BCF9928C}'; - RID_PedidosProveedor_Refresh = '{39391BDC-E558-43CE-A6AF-5D3A22627534}'; - RID_PedidosProveedor_Articulos_Pendientes = '{AA412BC5-2D68-45DC-AC60-97540E357854}'; + RID_ListaAnosPedidos = '{290AFB7D-0056-420C-945C-021352CC3963}'; + RID_DarReferencia = '{554DA6CD-358E-4506-BB1C-856F2F70CC2F}'; + RID_PedidosProveedor = '{89837A68-B255-4A32-9192-C1970E124121}'; + RID_PedidosProveedor_Detalles = '{66A8F285-16A6-4A12-ACE2-D931DDC1DCFB}'; + RID_PedidosProveedor_Detalles_Refresh = '{9AAF8998-076D-4D08-A0B9-7F73281C1748}'; + RID_PedidosProveedor_Refresh = '{5930F96F-FADD-49D0-9FB7-B72B3E99FAAE}'; + RID_PedidosProveedor_Articulos_Pendientes = '{77D750C6-07EA-41E5-86EB-1D6394278CA6}'; { Data table names } + nme_ListaAnosPedidos = 'ListaAnosPedidos'; nme_DarReferencia = 'DarReferencia'; nme_PedidosProveedor = 'PedidosProveedor'; nme_PedidosProveedor_Detalles = 'PedidosProveedor_Detalles'; @@ -24,6 +26,12 @@ const nme_PedidosProveedor_Refresh = 'PedidosProveedor_Refresh'; nme_PedidosProveedor_Articulos_Pendientes = 'PedidosProveedor_Articulos_Pendientes'; + { ListaAnosPedidos fields } + fld_ListaAnosPedidosANO = 'ANO'; + + { ListaAnosPedidos field indexes } + idx_ListaAnosPedidosANO = 0; + { DarReferencia fields } fld_DarReferenciaVALOR = 'VALOR'; @@ -267,9 +275,38 @@ const idx_PedidosProveedor_Articulos_PendientesREFERENCIA_PROVEEDOR = 5; type + { IListaAnosPedidos } + IListaAnosPedidos = interface(IDAStronglyTypedDataTable) + ['{F4595921-1C65-49CA-8758-0AA47C2F500B}'] + { Property getters and setters } + function GetANOValue: String; + procedure SetANOValue(const aValue: String); + + + { Properties } + property ANO: String read GetANOValue write SetANOValue; + end; + + { TListaAnosPedidosDataTableRules } + TListaAnosPedidosDataTableRules = class(TDADataTableRules, IListaAnosPedidos) + private + protected + { Property getters and setters } + function GetANOValue: String; virtual; + procedure SetANOValue(const aValue: String); virtual; + + { Properties } + property ANO: String read GetANOValue write SetANOValue; + + public + constructor Create(aDataTable: TDADataTable); override; + destructor Destroy; override; + + end; + { IDarReferencia } IDarReferencia = interface(IDAStronglyTypedDataTable) - ['{64D07D1A-5773-40AD-A317-0371C1E4D403}'] + ['{BD142307-84CF-49B4-8C99-CA7611194394}'] { Property getters and setters } function GetVALORValue: String; procedure SetVALORValue(const aValue: String); @@ -298,7 +335,7 @@ type { IPedidosProveedor } IPedidosProveedor = interface(IDAStronglyTypedDataTable) - ['{DB7BC08B-43B9-486E-AB73-628B2C885199}'] + ['{B972EDC1-558B-4001-8066-E3A5FBE288B3}'] { Property getters and setters } function GetIDValue: Integer; procedure SetIDValue(const aValue: Integer); @@ -543,7 +580,7 @@ type { IPedidosProveedor_Detalles } IPedidosProveedor_Detalles = interface(IDAStronglyTypedDataTable) - ['{E9EF64AB-0C7A-4F49-8856-34144A2E42AC}'] + ['{4DBD5169-6684-4F63-A58A-6715FB2EC4F6}'] { Property getters and setters } function GetIDValue: Integer; procedure SetIDValue(const aValue: Integer); @@ -650,7 +687,7 @@ type { IPedidosProveedor_Detalles_Refresh } IPedidosProveedor_Detalles_Refresh = interface(IDAStronglyTypedDataTable) - ['{B1FF840E-8E77-4AD8-B8A8-4E749525408D}'] + ['{A8412934-58C7-446E-91F7-7F0F8FC8003D}'] { Property getters and setters } function GetIDValue: Integer; procedure SetIDValue(const aValue: Integer); @@ -757,7 +794,7 @@ type { IPedidosProveedor_Refresh } IPedidosProveedor_Refresh = interface(IDAStronglyTypedDataTable) - ['{4D420826-77D4-4AA6-A215-8E176224B9B2}'] + ['{1BBADE38-A5FC-4F34-988C-5AFB6BA4DDE1}'] { Property getters and setters } function GetIDValue: Integer; procedure SetIDValue(const aValue: Integer); @@ -1002,7 +1039,7 @@ type { IPedidosProveedor_Articulos_Pendientes } IPedidosProveedor_Articulos_Pendientes = interface(IDAStronglyTypedDataTable) - ['{1DF9A26D-11AD-4D01-9C56-88D2D9839665}'] + ['{F3FE7A3C-4442-4871-B639-EA9CD5C91DCB}'] { Property getters and setters } function GetID_PEDIDOValue: Integer; procedure SetID_PEDIDOValue(const aValue: Integer); @@ -1063,6 +1100,28 @@ implementation uses Variants; +{ TListaAnosPedidosDataTableRules } +constructor TListaAnosPedidosDataTableRules.Create(aDataTable: TDADataTable); +begin + inherited; +end; + +destructor TListaAnosPedidosDataTableRules.Destroy; +begin + inherited; +end; + +function TListaAnosPedidosDataTableRules.GetANOValue: String; +begin + result := DataTable.Fields[idx_ListaAnosPedidosANO].AsString; +end; + +procedure TListaAnosPedidosDataTableRules.SetANOValue(const aValue: String); +begin + DataTable.Fields[idx_ListaAnosPedidosANO].AsString := aValue; +end; + + { TDarReferenciaDataTableRules } constructor TDarReferenciaDataTableRules.Create(aDataTable: TDADataTable); begin @@ -2230,6 +2289,7 @@ end; initialization + RegisterDataTableRules(RID_ListaAnosPedidos, TListaAnosPedidosDataTableRules); RegisterDataTableRules(RID_DarReferencia, TDarReferenciaDataTableRules); RegisterDataTableRules(RID_PedidosProveedor, TPedidosProveedorDataTableRules); RegisterDataTableRules(RID_PedidosProveedor_Detalles, TPedidosProveedor_DetallesDataTableRules); diff --git a/Source/Modulos/Pedidos a proveedor/Model/schPedidosProveedorServer_Intf.pas b/Source/Modulos/Pedidos a proveedor/Model/schPedidosProveedorServer_Intf.pas index 762779b1..bb9ea9fa 100644 --- a/Source/Modulos/Pedidos a proveedor/Model/schPedidosProveedorServer_Intf.pas +++ b/Source/Modulos/Pedidos a proveedor/Model/schPedidosProveedorServer_Intf.pas @@ -9,17 +9,47 @@ const { Delta rules ids Feel free to change them to something more human readable but make sure they are unique in the context of your application } - RID_DarReferenciaDelta = '{B28F26DA-2A46-4DAA-A0D5-1DDBCA844BED}'; - RID_PedidosProveedorDelta = '{7E20BCA7-2527-4CB5-B584-2D2341893091}'; - RID_PedidosProveedor_DetallesDelta = '{8C0FC64F-23A1-4A84-9026-FDAA9F3AA72D}'; - RID_PedidosProveedor_Detalles_RefreshDelta = '{801C5F9B-3CD7-4AFC-B4AD-F8F194EF8B1F}'; - RID_PedidosProveedor_RefreshDelta = '{1B4B8841-EF46-426A-BED9-0C6175972907}'; - RID_PedidosProveedor_Articulos_PendientesDelta = '{DA326CEB-0C27-4873-BA40-1A58EC0FF8F8}'; + RID_ListaAnosPedidosDelta = '{B82AE96C-74FC-4147-AA8C-BB2935F7190F}'; + RID_DarReferenciaDelta = '{9FD6B0FB-52EB-42CB-821C-1844BFF2165A}'; + RID_PedidosProveedorDelta = '{958AB2DC-FEE5-4840-9CE2-6DA8CCF1B940}'; + RID_PedidosProveedor_DetallesDelta = '{FD11BE1D-B1BC-4F0A-82D9-1FDF68A45811}'; + RID_PedidosProveedor_Detalles_RefreshDelta = '{2826119A-BB2A-4993-B9D2-ECEAA9B69EF9}'; + RID_PedidosProveedor_RefreshDelta = '{2EE41CA1-25EE-47C7-AAF1-926A3CE0A94A}'; + RID_PedidosProveedor_Articulos_PendientesDelta = '{0D0784C9-B751-4869-BE03-EA0DA4DC09BA}'; type + { IListaAnosPedidosDelta } + IListaAnosPedidosDelta = interface(IListaAnosPedidos) + ['{B82AE96C-74FC-4147-AA8C-BB2935F7190F}'] + { Property getters and setters } + function GetOldANOValue : String; + + { Properties } + property OldANO : String read GetOldANOValue; + end; + + { TListaAnosPedidosBusinessProcessorRules } + TListaAnosPedidosBusinessProcessorRules = class(TDABusinessProcessorRules, IListaAnosPedidos, IListaAnosPedidosDelta) + private + protected + { Property getters and setters } + function GetANOValue: String; virtual; + function GetOldANOValue: String; virtual; + procedure SetANOValue(const aValue: String); virtual; + + { Properties } + property ANO : String read GetANOValue write SetANOValue; + property OldANO : String read GetOldANOValue; + + public + constructor Create(aBusinessProcessor: TDABusinessProcessor); override; + destructor Destroy; override; + + end; + { IDarReferenciaDelta } IDarReferenciaDelta = interface(IDarReferencia) - ['{B28F26DA-2A46-4DAA-A0D5-1DDBCA844BED}'] + ['{9FD6B0FB-52EB-42CB-821C-1844BFF2165A}'] { Property getters and setters } function GetOldVALORValue : String; @@ -48,7 +78,7 @@ type { IPedidosProveedorDelta } IPedidosProveedorDelta = interface(IPedidosProveedor) - ['{7E20BCA7-2527-4CB5-B584-2D2341893091}'] + ['{958AB2DC-FEE5-4840-9CE2-6DA8CCF1B940}'] { Property getters and setters } function GetOldIDValue : Integer; function GetOldID_EMPRESAValue : Integer; @@ -329,7 +359,7 @@ type { IPedidosProveedor_DetallesDelta } IPedidosProveedor_DetallesDelta = interface(IPedidosProveedor_Detalles) - ['{8C0FC64F-23A1-4A84-9026-FDAA9F3AA72D}'] + ['{FD11BE1D-B1BC-4F0A-82D9-1FDF68A45811}'] { Property getters and setters } function GetOldIDValue : Integer; function GetOldID_PEDIDOValue : Integer; @@ -449,7 +479,7 @@ type { IPedidosProveedor_Detalles_RefreshDelta } IPedidosProveedor_Detalles_RefreshDelta = interface(IPedidosProveedor_Detalles_Refresh) - ['{801C5F9B-3CD7-4AFC-B4AD-F8F194EF8B1F}'] + ['{2826119A-BB2A-4993-B9D2-ECEAA9B69EF9}'] { Property getters and setters } function GetOldIDValue : Integer; function GetOldID_PEDIDOValue : Integer; @@ -569,7 +599,7 @@ type { IPedidosProveedor_RefreshDelta } IPedidosProveedor_RefreshDelta = interface(IPedidosProveedor_Refresh) - ['{1B4B8841-EF46-426A-BED9-0C6175972907}'] + ['{2EE41CA1-25EE-47C7-AAF1-926A3CE0A94A}'] { Property getters and setters } function GetOldIDValue : Integer; function GetOldID_EMPRESAValue : Integer; @@ -850,7 +880,7 @@ type { IPedidosProveedor_Articulos_PendientesDelta } IPedidosProveedor_Articulos_PendientesDelta = interface(IPedidosProveedor_Articulos_Pendientes) - ['{DA326CEB-0C27-4873-BA40-1A58EC0FF8F8}'] + ['{0D0784C9-B751-4869-BE03-EA0DA4DC09BA}'] { Property getters and setters } function GetOldID_PEDIDOValue : Integer; function GetOldREFERENCIAValue : String; @@ -917,6 +947,33 @@ implementation uses Variants, uROBinaryHelpers; +{ TListaAnosPedidosBusinessProcessorRules } +constructor TListaAnosPedidosBusinessProcessorRules.Create(aBusinessProcessor: TDABusinessProcessor); +begin + inherited; +end; + +destructor TListaAnosPedidosBusinessProcessorRules.Destroy; +begin + inherited; +end; + +function TListaAnosPedidosBusinessProcessorRules.GetANOValue: String; +begin + result := BusinessProcessor.CurrentChange.NewValueByName[fld_ListaAnosPedidosANO]; +end; + +function TListaAnosPedidosBusinessProcessorRules.GetOldANOValue: String; +begin + result := BusinessProcessor.CurrentChange.OldValueByName[fld_ListaAnosPedidosANO]; +end; + +procedure TListaAnosPedidosBusinessProcessorRules.SetANOValue(const aValue: String); +begin + BusinessProcessor.CurrentChange.NewValueByName[fld_ListaAnosPedidosANO] := aValue; +end; + + { TDarReferenciaBusinessProcessorRules } constructor TDarReferenciaBusinessProcessorRules.Create(aBusinessProcessor: TDABusinessProcessor); begin @@ -2633,6 +2690,7 @@ end; initialization + RegisterBusinessProcessorRules(RID_ListaAnosPedidosDelta, TListaAnosPedidosBusinessProcessorRules); RegisterBusinessProcessorRules(RID_DarReferenciaDelta, TDarReferenciaBusinessProcessorRules); RegisterBusinessProcessorRules(RID_PedidosProveedorDelta, TPedidosProveedorBusinessProcessorRules); RegisterBusinessProcessorRules(RID_PedidosProveedor_DetallesDelta, TPedidosProveedor_DetallesBusinessProcessorRules); diff --git a/Source/Modulos/Pedidos a proveedor/Servidor/srvPedidosProveedor_Impl.dfm b/Source/Modulos/Pedidos a proveedor/Servidor/srvPedidosProveedor_Impl.dfm index d9935c9d..d038311c 100644 --- a/Source/Modulos/Pedidos a proveedor/Servidor/srvPedidosProveedor_Impl.dfm +++ b/Source/Modulos/Pedidos a proveedor/Servidor/srvPedidosProveedor_Impl.dfm @@ -15,6 +15,35 @@ object srvPedidosProveedor: TsrvPedidosProveedor ConnectionManager = dmServer.ConnectionManager DataDictionary = DADataDictionary Datasets = < + item + Params = <> + Statements = < + item + Connection = 'IBX' + SQL = + 'select ANO from'#10'(select distinct(substr(FECHA_PEDIDO, 1,4)) as A' + + 'NO'#10'from pedidos_proveedor'#10'order by 1 desc)'#10#10'UNION ALL'#10#10'select di' + + 'stinct '#39'Todos'#39' as ANO'#10'from empresas' + StatementType = stSQL + ColumnMappings = <> + end> + Name = 'ListaAnosPedidos' + Fields = < + item + Name = 'ANO' + DataType = datString + Size = 254 + BlobType = dabtUnknown + DisplayWidth = 0 + Alignment = taLeftJustify + InPrimaryKey = False + Calculated = False + Lookup = False + LookupCache = False + end> + BusinessRulesClient.ScriptLanguage = rslPascalScript + BusinessRulesServer.ScriptLanguage = rslPascalScript + end item Params = < item diff --git a/Source/Modulos/Pedidos a proveedor/Views/uEditorPedidosProveedor.dfm b/Source/Modulos/Pedidos a proveedor/Views/uEditorPedidosProveedor.dfm index 84e6507a..0cb9ec26 100644 --- a/Source/Modulos/Pedidos a proveedor/Views/uEditorPedidosProveedor.dfm +++ b/Source/Modulos/Pedidos a proveedor/Views/uEditorPedidosProveedor.dfm @@ -49,11 +49,25 @@ inherited fEditorPedidosProveedor: TfEditorPedidosProveedor Action = actEnviarEMail end end + inherited tbxFiltro: TTBXToolbar + ExplicitWidth = 435 + inherited lblAno: TTBXLabelItem + Visible = True + end + inherited cbxListaAnos: TTBXComboBoxItem + Visible = True + end + inherited sepAno: TTBXSeparatorItem + Visible = True + end + end inherited tbxMenu: TTBXToolbar ExplicitWidth = 700 end inherited TBXTMain2: TTBXToolbar + Left = 435 Visible = True + ExplicitLeft = 435 ExplicitWidth = 119 object TBXItem39: TTBXItem Action = actRecibirPedido diff --git a/Source/Modulos/Pedidos a proveedor/Views/uEditorPedidosProveedor.pas b/Source/Modulos/Pedidos a proveedor/Views/uEditorPedidosProveedor.pas index bce05291..f22aa8b6 100644 --- a/Source/Modulos/Pedidos a proveedor/Views/uEditorPedidosProveedor.pas +++ b/Source/Modulos/Pedidos a proveedor/Views/uEditorPedidosProveedor.pas @@ -34,6 +34,7 @@ type procedure actEliminarUpdate(Sender: TObject); procedure actEnviarEMailExecute(Sender: TObject); procedure actEnviarEMailUpdate(Sender: TObject); + procedure OnListaAnosChange(Sender: TObject; const Text: string); protected FPedidos: IBizPedidoProveedor; @@ -44,12 +45,15 @@ type function GetController : IPedidosProveedorController; virtual; procedure SetController (const Value : IPedidosProveedorController); virtual; + procedure NuevoInterno; override; procedure ModificarInterno; override; procedure EliminarInterno; override; procedure DuplicarInterno; override; procedure ImprimirInterno; override; procedure PrevisualizarInterno; override; + procedure RefrescarInterno; override; + public procedure PonerTitulos(const ATitulo: string = ''); override; @@ -212,6 +216,8 @@ end; procedure TfEditorPedidosProveedor.FormShow(Sender: TObject); begin + cbxListaAnos.OnChange := OnListaAnosChange; //OJO SIEMPRE ANTES DEL INHERITED + inherited; if not Assigned(ViewGrid) then @@ -307,6 +313,13 @@ begin end; +procedure TfEditorPedidosProveedor.OnListaAnosChange(Sender: TObject; const Text: string); +begin + Controller.FiltrarAno(Pedidos, WhereDataTable, Text); + if Pedidos.DataTable.Active then + RefrescarInterno; +end; + procedure TfEditorPedidosProveedor.PonerTitulos(const ATitulo: string); var FTitulo : String; @@ -356,17 +369,38 @@ begin end; end; +procedure TfEditorPedidosProveedor.RefrescarInterno; +begin + //Volvemos a cargar los años de las facturas + if Assigned(FController) then + ListaAnos := FController.DarListaAnosPedidos; + + inherited; +end; + procedure TfEditorPedidosProveedor.SetController(const Value: IPedidosProveedorController); begin FController := Value; + + if Assigned(FController) then + ListaAnos := FController.DarListaAnosPedidos; end; procedure TfEditorPedidosProveedor.SetPedidos(const Value: IBizPedidoProveedor); begin FPedidos := Value; - dsDataTable.DataTable := FPedidos.DataTable; - if Assigned(ViewGrid) then - (ViewGrid as IViewPedidosProveedor).Pedidos := Pedidos; + + + if Assigned(FPedidos) then + begin + //Se guarda el where de la sentencia origen, por si el editor tiene filtros que + //afecten a este where y en un futuro se desea volver al where origen (filtro de año)) + WhereDataTable := FPedidos.DataTable.Where.Clause; + + dsDataTable.DataTable := FPedidos.DataTable; + if Assigned(ViewGrid) then + (ViewGrid as IViewPedidosProveedor).Pedidos := Pedidos; + end; end; end. diff --git a/Source/Modulos/Pedidos de cliente/Controller/uPedidosClienteController.pas b/Source/Modulos/Pedidos de cliente/Controller/uPedidosClienteController.pas index 4f398a58..2c3af54f 100644 --- a/Source/Modulos/Pedidos de cliente/Controller/uPedidosClienteController.pas +++ b/Source/Modulos/Pedidos de cliente/Controller/uPedidosClienteController.pas @@ -4,7 +4,7 @@ interface uses - SysUtils, uDADataTable, uEditorDBItem, + Classes, SysUtils, uDADataTable, uEditorDBItem, uControllerBase, uIDataModulePedidosCliente, uClientesController, uDetallesPedidoClienteController, uBizPedidosCliente, uBizDireccionesContacto, uBizDetallesPedidoCliente, uViewGridBase; @@ -60,6 +60,9 @@ type const ATextoEMail: String = ''): Boolean; function ArticulosPendientes(const ID : Integer): IBizPedidoClienteArticulosPend; + + function DarListaAnosPedidos: TStringList; + procedure FiltrarAno(APedido: IBizPedidoCliente; AWhereDataTable: String; const Ano: String); end; TPedidosClienteController = class(TObservador, IPedidosClienteController) @@ -133,6 +136,9 @@ type const ATextoEMail: String = ''): Boolean; function ArticulosPendientes(const ID : Integer): IBizPedidoClienteArticulosPend; + + function DarListaAnosPedidos: TStringList; + procedure FiltrarAno(APedido: IBizPedidoCliente; AWhereDataTable: String; const Ano: String); end; implementation @@ -140,7 +146,7 @@ implementation uses uROTypes, Controls, cxControls, DB, uEditorRegistryUtils, uEditorPreview, DateUtils, uIEditorPedidosCliente, uDataModulePedidosCliente, Variants, - uBizContactos, uDataTableUtils, uDataModuleUsuarios, Classes, + uBizContactos, uDataTableUtils, uDataModuleUsuarios, schPedidosClienteClient_Intf, uDAInterfaces, uDateUtils, uIEditorPedidoCliente, uIEditorElegirPedidosCliente, uIEditorDireccionEntregaPedidoCliente, schContactosClient_Intf, uPedidosClienteReportController, uDataModuleRegistroCorreos, @@ -284,6 +290,11 @@ begin Result := Supports(EditorRegistry.CreateEditor(AName), IID, Intf); end; +function TPedidosClienteController.DarListaAnosPedidos: TStringList; +begin + Result := FDataModule.GetAnosItems; +end; + procedure TPedidosClienteController.DescartarCambios(APedido: IBizPedidoCliente); begin if not Assigned(APedido) then @@ -797,6 +808,32 @@ begin end; end; +procedure TPedidosClienteController.FiltrarAno(APedido: IBizPedidoCliente; AWhereDataTable: String; const Ano: String); +var + FechaIni: String; + FechaFin: String; + +begin + APedido.DataTable.Where.Clear; + APedido.DataTable.Where.AddText(AWhereDataTable); + + if (Ano <> 'Todos') then + begin + // Filtrar las pedidos actuales por empresa + FechaIni := '01.01.' + Ano; + FechaFin := '31.12.' + Ano; + with APedido.DataTable.Where do + begin + if NotEmpty then + AddOperator(opAND); + AddCondition(fld_PedidosClienteFECHA_PEDIDO, cMajorOrEqual, FechaIni); + AddOperator(opAND); + AddCondition(fld_PedidosClienteFECHA_PEDIDO, cLessOrEqual, FechaFin); + end; + end; + +end; + procedure TPedidosClienteController.FiltrarEmpresa( APedido: IBizPedidoCliente); begin diff --git a/Source/Modulos/Pedidos de cliente/Data/uDataModulePedidosCliente.dfm b/Source/Modulos/Pedidos de cliente/Data/uDataModulePedidosCliente.dfm index 76ce7077..83305a44 100644 --- a/Source/Modulos/Pedidos de cliente/Data/uDataModulePedidosCliente.dfm +++ b/Source/Modulos/Pedidos de cliente/Data/uDataModulePedidosCliente.dfm @@ -1220,4 +1220,113 @@ object DataModulePedidosCliente: TDataModulePedidosCliente Left = 440 Top = 256 end + object tbl_ListaAnosPedidos: TDACDSDataTable + RemoteUpdatesOptions = [] + Fields = < + item + Name = 'ANO' + DataType = datString + Size = 254 + BlobType = dabtUnknown + DisplayWidth = 0 + Alignment = taLeftJustify + InPrimaryKey = False + Calculated = False + Lookup = False + LookupCache = False + end> + Params = <> + MasterMappingMode = mmDataRequest + StreamingOptions = [soDisableEventsWhileStreaming] + SchemaCall.MethodName = 'GetDatasetSchema' + SchemaCall.Params = < + item + Name = 'Result' + ParamType = fResult + DataType = rtBinary + end + item + Name = 'aDatasetName' + ParamType = fIn + DataType = rtString + Value = 'ListaAnosPedidos' + end> + DataRequestCall.MethodName = 'GetDatasetDataEx' + DataRequestCall.Params = < + item + Name = 'Result' + ParamType = fResult + DataType = rtBinary + end + item + Name = 'DatasetName' + ParamType = fIn + DataType = rtString + Value = 'ListaAnosPedidos' + end + item + Name = 'Params' + ParamType = fIn + DataType = rtUserDefined + UserClassName = 'TDADatasetParamArray' + end + item + Name = 'UserFilter' + ParamType = fIn + DataType = rtString + Value = '' + end + item + Name = 'IncludeSchema' + ParamType = fIn + DataType = rtBoolean + Value = False + end + item + Name = 'MaxRecords' + ParamType = fIn + DataType = rtInteger + Value = -1 + end> + DataUpdateCall.MethodName = 'UpdateData' + DataUpdateCall.Params = < + item + Name = 'Result' + ParamType = fResult + DataType = rtBinary + end + item + Name = 'Delta' + ParamType = fIn + DataType = rtBinary + end> + ScriptCall.MethodName = 'GetDatasetScripts' + ScriptCall.Params = < + item + Name = 'Result' + ParamType = fResult + DataType = rtString + Value = '' + end + item + Name = 'DatasetNames' + ParamType = fIn + DataType = rtString + Value = 'ListaAnosPedidos' + end> + ReadOnly = False + RemoteService = RORemoteService + Adapter = DABinAdapter + DetailOptions = [dtCascadeOpenClose, dtCascadeApplyUpdates, dtAutoFetch, dtCascadeDelete, dtCascadeUpdate, dtDisableLogOfCascadeDeletes, dtDisableLogOfCascadeUpdates, dtIncludeInAllInOneFetch] + MasterOptions = [moCascadeOpenClose, moCascadeApplyUpdates, moCascadeDelete, moCascadeUpdate, moDisableLogOfCascadeDeletes, moDisableLogOfCascadeUpdates] + LogicalName = 'ListaAnosPedidos' + IndexDefs = <> + Left = 520 + Top = 112 + end + object ds_ListaAnosPedidos: TDADataSource + DataTable = tbl_ListaAnosPedidos + Left = 520 + Top = 48 + end end diff --git a/Source/Modulos/Pedidos de cliente/Data/uDataModulePedidosCliente.pas b/Source/Modulos/Pedidos de cliente/Data/uDataModulePedidosCliente.pas index fff0118c..8b33189f 100644 --- a/Source/Modulos/Pedidos de cliente/Data/uDataModulePedidosCliente.pas +++ b/Source/Modulos/Pedidos de cliente/Data/uDataModulePedidosCliente.pas @@ -27,6 +27,8 @@ type ds_PedidoCliente_Articulos_Pendientes: TDADataSource; tbl_PedidoCliente_ArticulosPendientesPedirAProv: TDACDSDataTable; ds_PedidoCliente_ArticulosPendientesPedirAProv: TDADataSource; + tbl_ListaAnosPedidos: TDACDSDataTable; + ds_ListaAnosPedidos: TDADataSource; procedure DAClientDataModuleCreate(Sender: TObject); private @@ -47,6 +49,8 @@ type // Report function GetReport(const AID: String; const ShowLogotipo: Boolean = False): Binary; function GetRptPDF(const AID: Integer; const ShowLogotipo: Boolean = False): Binary; + + function GetAnosItems : TStringList; end; implementation @@ -137,6 +141,30 @@ begin end; end; +function TDataModulePedidosCliente.GetAnosItems: TStringList; +var + AListaAnos: TStringList; +begin + AListaAnos := TStringList.Create; + ShowHourglassCursor; + try + with tbl_ListaAnosPedidos do + begin + Open; + First; + while not eof do + begin + AListaAnos.Add(Format('%s=%s', [Fields[0].AsString, Fields[0].AsString])); + Next; + end; + Close; + end; + Result := AListaAnos; + finally + HideHourglassCursor; + end; +end; + function TDataModulePedidosCliente.GetArticulosPendientes( const IDPedido: Integer): IBizPedidoClienteArticulosPend; var diff --git a/Source/Modulos/Pedidos de cliente/Model/Data/uIDataModulePedidosCliente.pas b/Source/Modulos/Pedidos de cliente/Model/Data/uIDataModulePedidosCliente.pas index 2d5bd0c5..91a2ef34 100644 --- a/Source/Modulos/Pedidos de cliente/Model/Data/uIDataModulePedidosCliente.pas +++ b/Source/Modulos/Pedidos de cliente/Model/Data/uIDataModulePedidosCliente.pas @@ -3,11 +3,12 @@ unit uIDataModulePedidosCliente; interface uses - uBizPedidosCliente, uBizDetallesPedidoCliente; + Classes, uBizPedidosCliente, uBizDetallesPedidoCliente; type IDataModulePedidosCliente = interface ['{F0DDD126-9E62-4FEC-A849-FDCA75718F5B}'] + function GetAnosItems : TStringList; function GetItems: IBizPedidoCliente; function GetItem(const ID : Integer) : IBizPedidoCliente; function GetNextID(const DataSetName : String) : Integer; diff --git a/Source/Modulos/Pedidos de cliente/Model/schPedidosClienteClient_Intf.pas b/Source/Modulos/Pedidos de cliente/Model/schPedidosClienteClient_Intf.pas index 7e17b02b..c2d45a70 100644 --- a/Source/Modulos/Pedidos de cliente/Model/schPedidosClienteClient_Intf.pas +++ b/Source/Modulos/Pedidos de cliente/Model/schPedidosClienteClient_Intf.pas @@ -9,15 +9,17 @@ const { Data table rules ids Feel free to change them to something more human readable but make sure they are unique in the context of your application } - RID_PedidoCliente_ArticulosPendientesPedirAProv = '{4866506D-B7AD-48C1-AA0E-7F3259ADC372}'; - RID_DarReferencia = '{8014D812-7F3F-4918-90BF-807C1840C700}'; - RID_PedidosCliente = '{282EAEF6-17F1-485F-80D9-ED71D2C0B016}'; - RID_PedidosCliente_Detalles = '{09D5B882-A47C-42D1-B80D-8DFF76F70F10}'; - RID_PedidosCliente_Refresh = '{028AFA09-EB59-40AC-8EAF-C6320FD9105A}'; - RID_PedidosCliente_Detalles_Refresh = '{DE07DB2B-7CB4-48F9-8ADC-177DFF9166F8}'; - RID_PedidoCliente_Articulos_Pendientes = '{BA23D65A-A8BE-4EDB-878B-534180C048E5}'; + RID_ListaAnosPedidos = '{A8BF7EC3-3A8B-4ADC-BDB7-A733020AC74D}'; + RID_PedidoCliente_ArticulosPendientesPedirAProv = '{AA12C258-2C76-4668-B1AD-E2546DD86BBC}'; + RID_DarReferencia = '{E3D18DE1-33E2-4605-B4C6-9965ECC16B40}'; + RID_PedidosCliente = '{1CF72627-1238-4A61-9E2E-DC0F059E11CE}'; + RID_PedidosCliente_Detalles = '{920BEDAF-84DA-46E6-B11D-6C89F144ADFB}'; + RID_PedidosCliente_Refresh = '{0B02AE04-8937-4159-B241-D05CB9E0B0B2}'; + RID_PedidosCliente_Detalles_Refresh = '{F6C41177-85FD-473C-81BF-94C18C9CCD4C}'; + RID_PedidoCliente_Articulos_Pendientes = '{6B013D42-70AA-4DA8-ADD6-E466F9CABDA6}'; { Data table names } + nme_ListaAnosPedidos = 'ListaAnosPedidos'; nme_PedidoCliente_ArticulosPendientesPedirAProv = 'PedidoCliente_ArticulosPendientesPedirAProv'; nme_DarReferencia = 'DarReferencia'; nme_PedidosCliente = 'PedidosCliente'; @@ -26,6 +28,12 @@ const nme_PedidosCliente_Detalles_Refresh = 'PedidosCliente_Detalles_Refresh'; nme_PedidoCliente_Articulos_Pendientes = 'PedidoCliente_Articulos_Pendientes'; + { ListaAnosPedidos fields } + fld_ListaAnosPedidosANO = 'ANO'; + + { ListaAnosPedidos field indexes } + idx_ListaAnosPedidosANO = 0; + { PedidoCliente_ArticulosPendientesPedirAProv fields } fld_PedidoCliente_ArticulosPendientesPedirAProvID_PEDIDO = 'ID_PEDIDO'; fld_PedidoCliente_ArticulosPendientesPedirAProvID_ARTICULO = 'ID_ARTICULO'; @@ -265,9 +273,38 @@ const idx_PedidoCliente_Articulos_PendientesCANTIDAD_PENDIENTE = 3; type + { IListaAnosPedidos } + IListaAnosPedidos = interface(IDAStronglyTypedDataTable) + ['{B7C11B2A-6E4A-4350-916F-433C5A608472}'] + { Property getters and setters } + function GetANOValue: String; + procedure SetANOValue(const aValue: String); + + + { Properties } + property ANO: String read GetANOValue write SetANOValue; + end; + + { TListaAnosPedidosDataTableRules } + TListaAnosPedidosDataTableRules = class(TDADataTableRules, IListaAnosPedidos) + private + protected + { Property getters and setters } + function GetANOValue: String; virtual; + procedure SetANOValue(const aValue: String); virtual; + + { Properties } + property ANO: String read GetANOValue write SetANOValue; + + public + constructor Create(aDataTable: TDADataTable); override; + destructor Destroy; override; + + end; + { IPedidoCliente_ArticulosPendientesPedirAProv } IPedidoCliente_ArticulosPendientesPedirAProv = interface(IDAStronglyTypedDataTable) - ['{3C606C79-CCB1-4981-A4A1-50814B9C6AB1}'] + ['{7BE36BBA-03FB-4429-B62E-96095DFA3279}'] { Property getters and setters } function GetID_PEDIDOValue: Integer; procedure SetID_PEDIDOValue(const aValue: Integer); @@ -326,7 +363,7 @@ type { IDarReferencia } IDarReferencia = interface(IDAStronglyTypedDataTable) - ['{2CA2F013-394E-443E-AD5A-C8C3FD287B5C}'] + ['{DA2DF3D7-A974-4014-81AA-86FC6A6CF896}'] { Property getters and setters } function GetVALORValue: String; procedure SetVALORValue(const aValue: String); @@ -355,7 +392,7 @@ type { IPedidosCliente } IPedidosCliente = interface(IDAStronglyTypedDataTable) - ['{ECE661D7-1653-475F-8A03-A88242EA7F98}'] + ['{8B94E384-CF25-4B29-8717-E22CCF6FEC19}'] { Property getters and setters } function GetIDValue: Integer; procedure SetIDValue(const aValue: Integer); @@ -576,7 +613,7 @@ type { IPedidosCliente_Detalles } IPedidosCliente_Detalles = interface(IDAStronglyTypedDataTable) - ['{DC02EC1B-51E9-40CC-A3F1-B4D1D75448E0}'] + ['{3E9F8DFC-08A1-4FE6-B3E0-A8D35B4713F8}'] { Property getters and setters } function GetIDValue: Integer; procedure SetIDValue(const aValue: Integer); @@ -683,7 +720,7 @@ type { IPedidosCliente_Refresh } IPedidosCliente_Refresh = interface(IDAStronglyTypedDataTable) - ['{D2BB5DB6-04DF-497A-BA7C-36324598582A}'] + ['{DA0A11AA-8112-4F55-9C26-FCE234AB2667}'] { Property getters and setters } function GetIDValue: Integer; procedure SetIDValue(const aValue: Integer); @@ -904,7 +941,7 @@ type { IPedidosCliente_Detalles_Refresh } IPedidosCliente_Detalles_Refresh = interface(IDAStronglyTypedDataTable) - ['{CEA381F6-75A1-48AD-9A9D-BDFF73BA4C76}'] + ['{3EE0B65C-375E-4C0E-903D-69798136D6A7}'] { Property getters and setters } function GetIDValue: Integer; procedure SetIDValue(const aValue: Integer); @@ -1011,7 +1048,7 @@ type { IPedidoCliente_Articulos_Pendientes } IPedidoCliente_Articulos_Pendientes = interface(IDAStronglyTypedDataTable) - ['{584AEFF3-D810-4B52-A619-38006EB43574}'] + ['{5FCCA01A-C6BB-42BE-BD6F-25FD004B4D8A}'] { Property getters and setters } function GetID_ARTICULOValue: Integer; procedure SetID_ARTICULOValue(const aValue: Integer); @@ -1060,6 +1097,28 @@ implementation uses Variants; +{ TListaAnosPedidosDataTableRules } +constructor TListaAnosPedidosDataTableRules.Create(aDataTable: TDADataTable); +begin + inherited; +end; + +destructor TListaAnosPedidosDataTableRules.Destroy; +begin + inherited; +end; + +function TListaAnosPedidosDataTableRules.GetANOValue: String; +begin + result := DataTable.Fields[idx_ListaAnosPedidosANO].AsString; +end; + +procedure TListaAnosPedidosDataTableRules.SetANOValue(const aValue: String); +begin + DataTable.Fields[idx_ListaAnosPedidosANO].AsString := aValue; +end; + + { TPedidoCliente_ArticulosPendientesPedirAProvDataTableRules } constructor TPedidoCliente_ArticulosPendientesPedirAProvDataTableRules.Create(aDataTable: TDADataTable); begin @@ -2199,6 +2258,7 @@ end; initialization + RegisterDataTableRules(RID_ListaAnosPedidos, TListaAnosPedidosDataTableRules); RegisterDataTableRules(RID_PedidoCliente_ArticulosPendientesPedirAProv, TPedidoCliente_ArticulosPendientesPedirAProvDataTableRules); RegisterDataTableRules(RID_DarReferencia, TDarReferenciaDataTableRules); RegisterDataTableRules(RID_PedidosCliente, TPedidosClienteDataTableRules); diff --git a/Source/Modulos/Pedidos de cliente/Model/schPedidosClienteServer_Intf.pas b/Source/Modulos/Pedidos de cliente/Model/schPedidosClienteServer_Intf.pas index 2e0ace48..162f5f33 100644 --- a/Source/Modulos/Pedidos de cliente/Model/schPedidosClienteServer_Intf.pas +++ b/Source/Modulos/Pedidos de cliente/Model/schPedidosClienteServer_Intf.pas @@ -9,18 +9,48 @@ const { Delta rules ids Feel free to change them to something more human readable but make sure they are unique in the context of your application } - RID_PedidoCliente_ArticulosPendientesPedirAProvDelta = '{9DF33AF3-48FE-41B5-887B-98F4D7DFC83A}'; - RID_DarReferenciaDelta = '{BBA79BFA-59B0-4129-82AB-0D3BD9C217F2}'; - RID_PedidosClienteDelta = '{ECFDA30A-0379-4A81-ADF5-8668C838FA92}'; - RID_PedidosCliente_DetallesDelta = '{6293C9B7-58C6-4082-9BB3-C22E56A1E4F8}'; - RID_PedidosCliente_RefreshDelta = '{6B062172-1FB8-4C75-8D2D-7F749CA52D3F}'; - RID_PedidosCliente_Detalles_RefreshDelta = '{9B82DF9B-6228-4B13-ACB5-B18EB4559B30}'; - RID_PedidoCliente_Articulos_PendientesDelta = '{58C4E6B6-FDC3-4283-8FA6-7D23B0A1C2CF}'; + RID_ListaAnosPedidosDelta = '{72B93EDB-61B4-4067-9C49-839CF8C12F0D}'; + RID_PedidoCliente_ArticulosPendientesPedirAProvDelta = '{71CD0BAA-A9CA-4590-B190-F2827A7F9586}'; + RID_DarReferenciaDelta = '{3C370241-8868-4857-BB76-F0D014CBFFEF}'; + RID_PedidosClienteDelta = '{D8A3D195-E200-43EF-B7DD-D0E6C06B2D93}'; + RID_PedidosCliente_DetallesDelta = '{12D37153-BEC6-45CF-BB9B-381CC1C4AC1B}'; + RID_PedidosCliente_RefreshDelta = '{EBF93E3E-EC20-4B5B-BA36-F10AFD7C5FA3}'; + RID_PedidosCliente_Detalles_RefreshDelta = '{6EC1CD96-189D-4F49-A529-AAC0513C4EF4}'; + RID_PedidoCliente_Articulos_PendientesDelta = '{087CF6A1-BD59-41DA-8636-85D3390A7A8C}'; type + { IListaAnosPedidosDelta } + IListaAnosPedidosDelta = interface(IListaAnosPedidos) + ['{72B93EDB-61B4-4067-9C49-839CF8C12F0D}'] + { Property getters and setters } + function GetOldANOValue : String; + + { Properties } + property OldANO : String read GetOldANOValue; + end; + + { TListaAnosPedidosBusinessProcessorRules } + TListaAnosPedidosBusinessProcessorRules = class(TDABusinessProcessorRules, IListaAnosPedidos, IListaAnosPedidosDelta) + private + protected + { Property getters and setters } + function GetANOValue: String; virtual; + function GetOldANOValue: String; virtual; + procedure SetANOValue(const aValue: String); virtual; + + { Properties } + property ANO : String read GetANOValue write SetANOValue; + property OldANO : String read GetOldANOValue; + + public + constructor Create(aBusinessProcessor: TDABusinessProcessor); override; + destructor Destroy; override; + + end; + { IPedidoCliente_ArticulosPendientesPedirAProvDelta } IPedidoCliente_ArticulosPendientesPedirAProvDelta = interface(IPedidoCliente_ArticulosPendientesPedirAProv) - ['{9DF33AF3-48FE-41B5-887B-98F4D7DFC83A}'] + ['{71CD0BAA-A9CA-4590-B190-F2827A7F9586}'] { Property getters and setters } function GetOldID_PEDIDOValue : Integer; function GetOldID_ARTICULOValue : Integer; @@ -84,7 +114,7 @@ type { IDarReferenciaDelta } IDarReferenciaDelta = interface(IDarReferencia) - ['{BBA79BFA-59B0-4129-82AB-0D3BD9C217F2}'] + ['{3C370241-8868-4857-BB76-F0D014CBFFEF}'] { Property getters and setters } function GetOldVALORValue : String; @@ -113,7 +143,7 @@ type { IPedidosClienteDelta } IPedidosClienteDelta = interface(IPedidosCliente) - ['{ECFDA30A-0379-4A81-ADF5-8668C838FA92}'] + ['{D8A3D195-E200-43EF-B7DD-D0E6C06B2D93}'] { Property getters and setters } function GetOldIDValue : Integer; function GetOldID_EMPRESAValue : Integer; @@ -366,7 +396,7 @@ type { IPedidosCliente_DetallesDelta } IPedidosCliente_DetallesDelta = interface(IPedidosCliente_Detalles) - ['{6293C9B7-58C6-4082-9BB3-C22E56A1E4F8}'] + ['{12D37153-BEC6-45CF-BB9B-381CC1C4AC1B}'] { Property getters and setters } function GetOldIDValue : Integer; function GetOldID_PEDIDOValue : Integer; @@ -486,7 +516,7 @@ type { IPedidosCliente_RefreshDelta } IPedidosCliente_RefreshDelta = interface(IPedidosCliente_Refresh) - ['{6B062172-1FB8-4C75-8D2D-7F749CA52D3F}'] + ['{EBF93E3E-EC20-4B5B-BA36-F10AFD7C5FA3}'] { Property getters and setters } function GetOldIDValue : Integer; function GetOldID_EMPRESAValue : Integer; @@ -739,7 +769,7 @@ type { IPedidosCliente_Detalles_RefreshDelta } IPedidosCliente_Detalles_RefreshDelta = interface(IPedidosCliente_Detalles_Refresh) - ['{9B82DF9B-6228-4B13-ACB5-B18EB4559B30}'] + ['{6EC1CD96-189D-4F49-A529-AAC0513C4EF4}'] { Property getters and setters } function GetOldIDValue : Integer; function GetOldID_PEDIDOValue : Integer; @@ -859,7 +889,7 @@ type { IPedidoCliente_Articulos_PendientesDelta } IPedidoCliente_Articulos_PendientesDelta = interface(IPedidoCliente_Articulos_Pendientes) - ['{58C4E6B6-FDC3-4283-8FA6-7D23B0A1C2CF}'] + ['{087CF6A1-BD59-41DA-8636-85D3390A7A8C}'] { Property getters and setters } function GetOldID_ARTICULOValue : Integer; function GetOldCANTIDAD_PEDValue : Integer; @@ -912,6 +942,33 @@ implementation uses Variants, uROBinaryHelpers; +{ TListaAnosPedidosBusinessProcessorRules } +constructor TListaAnosPedidosBusinessProcessorRules.Create(aBusinessProcessor: TDABusinessProcessor); +begin + inherited; +end; + +destructor TListaAnosPedidosBusinessProcessorRules.Destroy; +begin + inherited; +end; + +function TListaAnosPedidosBusinessProcessorRules.GetANOValue: String; +begin + result := BusinessProcessor.CurrentChange.NewValueByName[fld_ListaAnosPedidosANO]; +end; + +function TListaAnosPedidosBusinessProcessorRules.GetOldANOValue: String; +begin + result := BusinessProcessor.CurrentChange.OldValueByName[fld_ListaAnosPedidosANO]; +end; + +procedure TListaAnosPedidosBusinessProcessorRules.SetANOValue(const aValue: String); +begin + BusinessProcessor.CurrentChange.NewValueByName[fld_ListaAnosPedidosANO] := aValue; +end; + + { TPedidoCliente_ArticulosPendientesPedirAProvBusinessProcessorRules } constructor TPedidoCliente_ArticulosPendientesPedirAProvBusinessProcessorRules.Create(aBusinessProcessor: TDABusinessProcessor); begin @@ -2580,6 +2637,7 @@ end; initialization + RegisterBusinessProcessorRules(RID_ListaAnosPedidosDelta, TListaAnosPedidosBusinessProcessorRules); RegisterBusinessProcessorRules(RID_PedidoCliente_ArticulosPendientesPedirAProvDelta, TPedidoCliente_ArticulosPendientesPedirAProvBusinessProcessorRules); RegisterBusinessProcessorRules(RID_DarReferenciaDelta, TDarReferenciaBusinessProcessorRules); RegisterBusinessProcessorRules(RID_PedidosClienteDelta, TPedidosClienteBusinessProcessorRules); diff --git a/Source/Modulos/Pedidos de cliente/Servidor/srvPedidosCliente_Impl.dfm b/Source/Modulos/Pedidos de cliente/Servidor/srvPedidosCliente_Impl.dfm index 28288976..6dbf2dac 100644 --- a/Source/Modulos/Pedidos de cliente/Servidor/srvPedidosCliente_Impl.dfm +++ b/Source/Modulos/Pedidos de cliente/Servidor/srvPedidosCliente_Impl.dfm @@ -15,6 +15,35 @@ object srvPedidosCliente: TsrvPedidosCliente ConnectionManager = dmServer.ConnectionManager DataDictionary = DADataDictionary Datasets = < + item + Params = <> + Statements = < + item + Connection = 'IBX' + SQL = + 'select ANO from'#10'(select distinct(substr(FECHA_PEDIDO, 1,4)) as A' + + 'NO'#10'from pedidos_cliente'#10'order by 1 desc)'#10#10'UNION ALL'#10#10'select dist' + + 'inct '#39'Todos'#39' as ANO'#10'from empresas' + StatementType = stSQL + ColumnMappings = <> + end> + Name = 'ListaAnosPedidos' + Fields = < + item + Name = 'ANO' + DataType = datString + Size = 254 + BlobType = dabtUnknown + DisplayWidth = 0 + Alignment = taLeftJustify + InPrimaryKey = False + Calculated = False + Lookup = False + LookupCache = False + end> + BusinessRulesClient.ScriptLanguage = rslPascalScript + BusinessRulesServer.ScriptLanguage = rslPascalScript + end item Params = < item diff --git a/Source/Modulos/Pedidos de cliente/Views/uEditorPedidosCliente.dfm b/Source/Modulos/Pedidos de cliente/Views/uEditorPedidosCliente.dfm index 8e57812e..e7807473 100644 --- a/Source/Modulos/Pedidos de cliente/Views/uEditorPedidosCliente.dfm +++ b/Source/Modulos/Pedidos de cliente/Views/uEditorPedidosCliente.dfm @@ -129,6 +129,18 @@ inherited fEditorPedidosCliente: TfEditorPedidosCliente Action = actEnviarEmail end end + inherited tbxFiltro: TTBXToolbar + ExplicitWidth = 435 + inherited lblAno: TTBXLabelItem + Visible = True + end + inherited cbxListaAnos: TTBXComboBoxItem + Visible = True + end + inherited sepAno: TTBXSeparatorItem + Visible = True + end + end inherited tbxMenu: TTBXToolbar ExplicitWidth = 674 object TBXSubmenuItem2: TTBXSubmenuItem [4] @@ -144,7 +156,9 @@ inherited fEditorPedidosCliente: TfEditorPedidosCliente end end inherited TBXTMain2: TTBXToolbar + Left = 435 Visible = True + ExplicitLeft = 435 ExplicitWidth = 91 object TBXItem40: TTBXItem Action = actGenerar diff --git a/Source/Modulos/Pedidos de cliente/Views/uEditorPedidosCliente.pas b/Source/Modulos/Pedidos de cliente/Views/uEditorPedidosCliente.pas index 7cdee704..2765e0b1 100644 --- a/Source/Modulos/Pedidos de cliente/Views/uEditorPedidosCliente.pas +++ b/Source/Modulos/Pedidos de cliente/Views/uEditorPedidosCliente.pas @@ -43,6 +43,7 @@ type procedure actGenerarUpdate(Sender: TObject); procedure actEnviarEmailExecute(Sender: TObject); procedure actEnviarEmailUpdate(Sender: TObject); + procedure OnListaAnosChange(Sender: TObject; const Text: string); protected FPedidos: IBizPedidoCliente; @@ -60,6 +61,7 @@ type procedure DuplicarInterno; override; procedure ImprimirInterno; override; procedure PrevisualizarInterno; override; + procedure RefrescarInterno; override; //Si queremos crear otra vista para el editor heredado solo tendriamos que //sobreescribir este metodo @@ -281,6 +283,8 @@ end; procedure TfEditorPedidosCliente.FormShow(Sender: TObject); begin + cbxListaAnos.OnChange := OnListaAnosChange; //OJO SIEMPRE ANTES QUE EL INHERITED + inherited; if not Assigned(ViewGrid) then @@ -358,6 +362,13 @@ begin FController.Ver(Pedidos); end; +procedure TfEditorPedidosCliente.OnListaAnosChange(Sender: TObject; const Text: string); +begin + Controller.FiltrarAno(Pedidos, WhereDataTable, Text); + if Pedidos.DataTable.Active then + RefrescarInterno; +end; + procedure TfEditorPedidosCliente.PonerTitulos(const ATitulo: string); var FTitulo : String; @@ -407,17 +418,37 @@ begin end; end; +procedure TfEditorPedidosCliente.RefrescarInterno; +begin + //Volvemos a cargar los años de los pedidos + if Assigned(FController) then + ListaAnos := FController.DarListaAnosPedidos; + + inherited; +end; + procedure TfEditorPedidosCliente.SetController(const Value: IPedidosClienteController); begin FController := Value; + + if Assigned(FController) then + ListaAnos := FController.DarListaAnosPedidos; end; procedure TfEditorPedidosCliente.SetPedidos(const Value: IBizPedidoCliente); begin FPedidos := Value; - dsDataTable.DataTable := FPedidos.DataTable; - if Assigned(ViewGrid) then - (ViewGrid as IViewPedidosCliente).Pedidos := Pedidos; + + if Assigned(FPedidos) then + begin + //Se guarda el where de la sentencia origen, por si el editor tiene filtros que + //afecten a este where y en un futuro se desea volver al where origen (filtro de año)) + WhereDataTable := FPedidos.DataTable.Where.Clause; + + dsDataTable.DataTable := FPedidos.DataTable; + if Assigned(ViewGrid) then + (ViewGrid as IViewPedidosCliente).Pedidos := Pedidos; + end; end; end. diff --git a/Source/Modulos/Recibos de cliente/Controller/uRecibosClienteController.pas b/Source/Modulos/Recibos de cliente/Controller/uRecibosClienteController.pas index c75d68c4..085b02de 100644 --- a/Source/Modulos/Recibos de cliente/Controller/uRecibosClienteController.pas +++ b/Source/Modulos/Recibos de cliente/Controller/uRecibosClienteController.pas @@ -83,6 +83,9 @@ type const AEnviarDirectamente: Boolean = True; const ADireccionEMail: String = ''; const AAsuntoEMail: String = ''; const ATextoEMail: String = ''): Boolean; + + function DarListaAnosRecibos: TStringList; + procedure FiltrarAno(ARecibo: IBizRecibosCliente; AWhereDataTable: String; const Ano: String); end; TRecibosClienteController = class(TObservador, IRecibosClienteController) @@ -152,6 +155,9 @@ type const AEnviarDirectamente: Boolean = True; const ADireccionEMail: String = ''; const AAsuntoEMail: String = ''; const ATextoEMail: String = ''): Boolean; + + function DarListaAnosRecibos: TStringList; + procedure FiltrarAno(ARecibo: IBizRecibosCliente; AWhereDataTable: String; const Ano: String); end; implementation @@ -444,6 +450,11 @@ begin Result := Buscar(ID_NULO); end; +function TRecibosClienteController.DarListaAnosRecibos: TStringList; +begin + Result := FDataModule.GetAnosItems; +end; + function TRecibosClienteController.DarNuevaReferencia(ID_FACTURA: Integer; REFERENCIA: String): String; var ARecibosCliente: IBizRecibosCliente; @@ -591,6 +602,7 @@ begin if Assigned(AEditor) then with AEditor do begin + Controller := Self; //OJO ORDEN MUY IMPORTANTE RecibosCliente := ARecibosCliente; MultiSelect := True; ShowEmbedded; @@ -980,6 +992,31 @@ begin end; end; +procedure TRecibosClienteController.FiltrarAno(ARecibo: IBizRecibosCliente; AWhereDataTable: String; const Ano: String); +var + FechaIni: String; + FechaFin: String; + +begin + ARecibo.DataTable.Where.Clear; + ARecibo.DataTable.Where.AddText(AWhereDataTable); + + if (Ano <> 'Todos') then + begin + // Filtrar las facturas actuales por empresa + FechaIni := '01.01.' + Ano; + FechaFin := '31.12.' + Ano; + with ARecibo.DataTable.Where do + begin + if NotEmpty then + AddOperator(opAND); + AddCondition(fld_RecibosClienteFECHA_EMISION, cMajorOrEqual, FechaIni); + AddOperator(opAND); + AddCondition(fld_RecibosClienteFECHA_EMISION, cLessOrEqual, FechaFin); + end; + end; +end; + procedure TRecibosClienteController.Preview(ARecibosCliente: IBizRecibosCliente; AllItems: Boolean = false); var AReportController : IRecibosClienteReportController; diff --git a/Source/Modulos/Recibos de cliente/Data/uDataModuleRecibosCliente.dfm b/Source/Modulos/Recibos de cliente/Data/uDataModuleRecibosCliente.dfm index f1eb50c7..66cf5dfc 100644 --- a/Source/Modulos/Recibos de cliente/Data/uDataModuleRecibosCliente.dfm +++ b/Source/Modulos/Recibos de cliente/Data/uDataModuleRecibosCliente.dfm @@ -67,6 +67,8 @@ object DataModuleRecibosCliente: TDataModuleRecibosCliente ProbeFrequency = 60000 UserAgent = 'RemObjects SDK' TargetURL = 'http://localhost:8099/bin' + Login.Username = '1' + Login.Password = 'Luis' Left = 48 Top = 272 end @@ -1133,4 +1135,113 @@ object DataModuleRecibosCliente: TDataModuleRecibosCliente Left = 328 Top = 248 end + object tbl_ListaAnosRecibos: TDACDSDataTable + RemoteUpdatesOptions = [] + Fields = < + item + Name = 'ANO' + DataType = datString + Size = 254 + BlobType = dabtUnknown + DisplayWidth = 0 + Alignment = taLeftJustify + InPrimaryKey = False + Calculated = False + Lookup = False + LookupCache = False + end> + Params = <> + MasterMappingMode = mmDataRequest + StreamingOptions = [soDisableEventsWhileStreaming] + SchemaCall.MethodName = 'GetDatasetSchema' + SchemaCall.Params = < + item + Name = 'Result' + ParamType = fResult + DataType = rtBinary + end + item + Name = 'aDatasetName' + ParamType = fIn + DataType = rtString + Value = 'ListaAnosRecibos' + end> + DataRequestCall.MethodName = 'GetDatasetDataEx' + DataRequestCall.Params = < + item + Name = 'Result' + ParamType = fResult + DataType = rtBinary + end + item + Name = 'DatasetName' + ParamType = fIn + DataType = rtString + Value = 'ListaAnosRecibos' + end + item + Name = 'Params' + ParamType = fIn + DataType = rtUserDefined + UserClassName = 'TDADatasetParamArray' + end + item + Name = 'UserFilter' + ParamType = fIn + DataType = rtString + Value = '' + end + item + Name = 'IncludeSchema' + ParamType = fIn + DataType = rtBoolean + Value = False + end + item + Name = 'MaxRecords' + ParamType = fIn + DataType = rtInteger + Value = -1 + end> + DataUpdateCall.MethodName = 'UpdateData' + DataUpdateCall.Params = < + item + Name = 'Result' + ParamType = fResult + DataType = rtBinary + end + item + Name = 'Delta' + ParamType = fIn + DataType = rtBinary + end> + ScriptCall.MethodName = 'GetDatasetScripts' + ScriptCall.Params = < + item + Name = 'Result' + ParamType = fResult + DataType = rtString + Value = '' + end + item + Name = 'DatasetNames' + ParamType = fIn + DataType = rtString + Value = 'ListaAnosRecibos' + end> + ReadOnly = False + RemoteService = RORemoteService + Adapter = DABinAdapter + DetailOptions = [dtCascadeOpenClose, dtCascadeApplyUpdates, dtAutoFetch, dtCascadeDelete, dtCascadeUpdate, dtDisableLogOfCascadeDeletes, dtDisableLogOfCascadeUpdates, dtIncludeInAllInOneFetch] + MasterOptions = [moCascadeOpenClose, moCascadeApplyUpdates, moCascadeDelete, moCascadeUpdate, moDisableLogOfCascadeDeletes, moDisableLogOfCascadeUpdates] + LogicalName = 'ListaAnosRecibos' + IndexDefs = <> + Left = 160 + Top = 168 + end + object ds_ListaAnosRecibos: TDADataSource + DataTable = tbl_ListaAnosRecibos + Left = 160 + Top = 112 + end end diff --git a/Source/Modulos/Recibos de cliente/Data/uDataModuleRecibosCliente.pas b/Source/Modulos/Recibos de cliente/Data/uDataModuleRecibosCliente.pas index 92e33da2..52bf1b91 100644 --- a/Source/Modulos/Recibos de cliente/Data/uDataModuleRecibosCliente.pas +++ b/Source/Modulos/Recibos de cliente/Data/uDataModuleRecibosCliente.pas @@ -48,6 +48,8 @@ type ds_PagosCliente: TDADataSource; tbl_RecibosCompensadosCli: TDACDSDataTable; ds_RecibosCompensadosCli: TDADataSource; + tbl_ListaAnosRecibos: TDACDSDataTable; + ds_ListaAnosRecibos: TDADataSource; procedure DAClientDataModuleCreate(Sender: TObject); protected function DarNombreGenerador(DataSetName: String): String; virtual; @@ -61,6 +63,8 @@ type function NewItem : IBizRecibosCliente; function GetReport(const ID: String): Binary; function GetRptPDF(const AID: Integer; const ShowLogotipo: Boolean = False): Binary; + + function GetAnosItems : TStringList; end; implementation @@ -190,6 +194,30 @@ begin Result := GetItem(ID_NULO) end; +function TDataModuleRecibosCliente.GetAnosItems: TStringList; +var + AListaAnos: TStringList; +begin + AListaAnos := TStringList.Create; + ShowHourglassCursor; + try + with tbl_ListaAnosRecibos do + begin + Open; + First; + while not eof do + begin + AListaAnos.Add(Format('%s=%s', [Fields[0].AsString, Fields[0].AsString])); + Next; + end; + Close; + end; + Result := AListaAnos; + finally + HideHourglassCursor; + end; +end; + function TDataModuleRecibosCliente.GetItem(const ID: Integer): IBizRecibosCliente; begin ShowHourglassCursor; diff --git a/Source/Modulos/Recibos de cliente/Model/Data/uIDataModuleRecibosCliente.pas b/Source/Modulos/Recibos de cliente/Model/Data/uIDataModuleRecibosCliente.pas index 42832fe7..284fe4ce 100644 --- a/Source/Modulos/Recibos de cliente/Model/Data/uIDataModuleRecibosCliente.pas +++ b/Source/Modulos/Recibos de cliente/Model/Data/uIDataModuleRecibosCliente.pas @@ -26,11 +26,12 @@ unit uIDataModuleRecibosCliente; interface uses - uBizRecibosCliente; + Classes, uBizRecibosCliente; type IDataModuleRecibosCliente = interface ['{F4F02C9E-E861-4938-8A2D-FE971A41EE92}'] + function GetAnosItems : TStringList; function GetItems: IBizRecibosCliente; function GetNextID(const DataSetName : String) : Integer; function GetItem(const ID : Integer) : IBizRecibosCliente; diff --git a/Source/Modulos/Recibos de cliente/Model/schRecibosClienteClient_Intf.pas b/Source/Modulos/Recibos de cliente/Model/schRecibosClienteClient_Intf.pas index 9032321d..c768ed36 100644 --- a/Source/Modulos/Recibos de cliente/Model/schRecibosClienteClient_Intf.pas +++ b/Source/Modulos/Recibos de cliente/Model/schRecibosClienteClient_Intf.pas @@ -9,17 +9,25 @@ const { Data table rules ids Feel free to change them to something more human readable but make sure they are unique in the context of your application } - RID_RecibosCliente = '{3A31A595-D48C-4913-88A1-753A1DBBA5C4}'; - RID_RecibosCliente_Refresh = '{F9FF0068-D1C5-43A2-BEDE-19310B8CEB7D}'; - RID_PagosCliente = '{36B21D04-17C3-45EB-BBC9-F864DAEE8BEE}'; - RID_RecibosCompensadosCli = '{0768E6E5-C46A-44B5-9FE5-CCE0089141BF}'; + RID_ListaAnosRecibos = '{F2409BB9-C9B3-44EA-9642-D2B782E76EC4}'; + RID_RecibosCliente = '{B3602898-1B21-4F62-ADCF-FBC749E176FC}'; + RID_RecibosCliente_Refresh = '{BD5B5013-8C5F-4117-81E7-1109FF474874}'; + RID_PagosCliente = '{47521D6F-8CA8-4F32-8300-B17922C1EBF3}'; + RID_RecibosCompensadosCli = '{BA08F41B-F985-45EE-BFE3-07999C72FA54}'; { Data table names } + nme_ListaAnosRecibos = 'ListaAnosRecibos'; nme_RecibosCliente = 'RecibosCliente'; nme_RecibosCliente_Refresh = 'RecibosCliente_Refresh'; nme_PagosCliente = 'PagosCliente'; nme_RecibosCompensadosCli = 'RecibosCompensadosCli'; + { ListaAnosRecibos fields } + fld_ListaAnosRecibosANO = 'ANO'; + + { ListaAnosRecibos field indexes } + idx_ListaAnosRecibosANO = 0; + { RecibosCliente fields } fld_RecibosClienteID = 'ID'; fld_RecibosClienteID_RECIBO_COMPENSADO = 'ID_RECIBO_COMPENSADO'; @@ -217,9 +225,38 @@ const idx_RecibosCompensadosCliID_EMPRESA = 15; type + { IListaAnosRecibos } + IListaAnosRecibos = interface(IDAStronglyTypedDataTable) + ['{89DE9459-2A91-4F1A-B39F-F1D9016A2D2A}'] + { Property getters and setters } + function GetANOValue: String; + procedure SetANOValue(const aValue: String); + + + { Properties } + property ANO: String read GetANOValue write SetANOValue; + end; + + { TListaAnosRecibosDataTableRules } + TListaAnosRecibosDataTableRules = class(TDADataTableRules, IListaAnosRecibos) + private + protected + { Property getters and setters } + function GetANOValue: String; virtual; + procedure SetANOValue(const aValue: String); virtual; + + { Properties } + property ANO: String read GetANOValue write SetANOValue; + + public + constructor Create(aDataTable: TDADataTable); override; + destructor Destroy; override; + + end; + { IRecibosCliente } IRecibosCliente = interface(IDAStronglyTypedDataTable) - ['{071E91B1-00CA-4F7E-AEDD-ACF4B65D0B94}'] + ['{D261ED1D-212D-47BA-A684-790B6F3C301B}'] { Property getters and setters } function GetIDValue: Integer; procedure SetIDValue(const aValue: Integer); @@ -428,7 +465,7 @@ type { IRecibosCliente_Refresh } IRecibosCliente_Refresh = interface(IDAStronglyTypedDataTable) - ['{9CBDE222-CACC-4694-BEB7-73E4EA38087C}'] + ['{2A3C390B-23ED-44EC-82E5-49490E998071}'] { Property getters and setters } function GetIDValue: Integer; procedure SetIDValue(const aValue: Integer); @@ -637,7 +674,7 @@ type { IPagosCliente } IPagosCliente = interface(IDAStronglyTypedDataTable) - ['{9038B034-EDDD-4CE6-A24E-D9F12F7CF8E3}'] + ['{49C05D5F-2FAA-4BE7-8806-CDEEEBD1BB79}'] { Property getters and setters } function GetIDValue: Integer; procedure SetIDValue(const aValue: Integer); @@ -732,7 +769,7 @@ type { IRecibosCompensadosCli } IRecibosCompensadosCli = interface(IDAStronglyTypedDataTable) - ['{38498E3F-092B-4877-A3E9-EEB66C7B6806}'] + ['{57951F5C-8B70-478A-8C4B-FB93AD63B4D5}'] { Property getters and setters } function GetIDValue: Integer; procedure SetIDValue(const aValue: Integer); @@ -853,6 +890,28 @@ implementation uses Variants; +{ TListaAnosRecibosDataTableRules } +constructor TListaAnosRecibosDataTableRules.Create(aDataTable: TDADataTable); +begin + inherited; +end; + +destructor TListaAnosRecibosDataTableRules.Destroy; +begin + inherited; +end; + +function TListaAnosRecibosDataTableRules.GetANOValue: String; +begin + result := DataTable.Fields[idx_ListaAnosRecibosANO].AsString; +end; + +procedure TListaAnosRecibosDataTableRules.SetANOValue(const aValue: String); +begin + DataTable.Fields[idx_ListaAnosRecibosANO].AsString := aValue; +end; + + { TRecibosClienteDataTableRules } constructor TRecibosClienteDataTableRules.Create(aDataTable: TDADataTable); begin @@ -1802,6 +1861,7 @@ end; initialization + RegisterDataTableRules(RID_ListaAnosRecibos, TListaAnosRecibosDataTableRules); RegisterDataTableRules(RID_RecibosCliente, TRecibosClienteDataTableRules); RegisterDataTableRules(RID_RecibosCliente_Refresh, TRecibosCliente_RefreshDataTableRules); RegisterDataTableRules(RID_PagosCliente, TPagosClienteDataTableRules); diff --git a/Source/Modulos/Recibos de cliente/Model/schRecibosClienteServer_Intf.pas b/Source/Modulos/Recibos de cliente/Model/schRecibosClienteServer_Intf.pas index 6dd5eeac..1811be5e 100644 --- a/Source/Modulos/Recibos de cliente/Model/schRecibosClienteServer_Intf.pas +++ b/Source/Modulos/Recibos de cliente/Model/schRecibosClienteServer_Intf.pas @@ -9,15 +9,45 @@ const { Delta rules ids Feel free to change them to something more human readable but make sure they are unique in the context of your application } - RID_RecibosClienteDelta = '{AA27035C-016E-417B-827B-D8851447786A}'; - RID_RecibosCliente_RefreshDelta = '{25876270-8B70-4853-9E59-581AC90FFE3C}'; - RID_PagosClienteDelta = '{9FB42929-5B3B-45A1-9DB1-E7004D6BCFA4}'; - RID_RecibosCompensadosCliDelta = '{33B534EA-40C6-4D0D-B7B3-496DF8B28FB3}'; + RID_ListaAnosRecibosDelta = '{AFB3F9CF-8D5C-40FD-AC65-7B9BBD04E7D8}'; + RID_RecibosClienteDelta = '{9E317E04-A207-4CD5-87CB-323881FF3991}'; + RID_RecibosCliente_RefreshDelta = '{07DDE83E-B15B-4B40-86AE-40A0E920D8D6}'; + RID_PagosClienteDelta = '{1DDDA700-4544-40C4-9763-D46B3F058E28}'; + RID_RecibosCompensadosCliDelta = '{692B5FAD-7002-4B0C-A0C5-5FC22CC3A75C}'; type + { IListaAnosRecibosDelta } + IListaAnosRecibosDelta = interface(IListaAnosRecibos) + ['{AFB3F9CF-8D5C-40FD-AC65-7B9BBD04E7D8}'] + { Property getters and setters } + function GetOldANOValue : String; + + { Properties } + property OldANO : String read GetOldANOValue; + end; + + { TListaAnosRecibosBusinessProcessorRules } + TListaAnosRecibosBusinessProcessorRules = class(TDABusinessProcessorRules, IListaAnosRecibos, IListaAnosRecibosDelta) + private + protected + { Property getters and setters } + function GetANOValue: String; virtual; + function GetOldANOValue: String; virtual; + procedure SetANOValue(const aValue: String); virtual; + + { Properties } + property ANO : String read GetANOValue write SetANOValue; + property OldANO : String read GetOldANOValue; + + public + constructor Create(aBusinessProcessor: TDABusinessProcessor); override; + destructor Destroy; override; + + end; + { IRecibosClienteDelta } IRecibosClienteDelta = interface(IRecibosCliente) - ['{AA27035C-016E-417B-827B-D8851447786A}'] + ['{9E317E04-A207-4CD5-87CB-323881FF3991}'] { Property getters and setters } function GetOldIDValue : Integer; function GetOldID_RECIBO_COMPENSADOValue : Integer; @@ -256,7 +286,7 @@ type { IRecibosCliente_RefreshDelta } IRecibosCliente_RefreshDelta = interface(IRecibosCliente_Refresh) - ['{25876270-8B70-4853-9E59-581AC90FFE3C}'] + ['{07DDE83E-B15B-4B40-86AE-40A0E920D8D6}'] { Property getters and setters } function GetOldIDValue : Integer; function GetOldID_RECIBO_COMPENSADOValue : Integer; @@ -495,7 +525,7 @@ type { IPagosClienteDelta } IPagosClienteDelta = interface(IPagosCliente) - ['{9FB42929-5B3B-45A1-9DB1-E7004D6BCFA4}'] + ['{1DDDA700-4544-40C4-9763-D46B3F058E28}'] { Property getters and setters } function GetOldIDValue : Integer; function GetOldID_RECIBOValue : Integer; @@ -601,7 +631,7 @@ type { IRecibosCompensadosCliDelta } IRecibosCompensadosCliDelta = interface(IRecibosCompensadosCli) - ['{33B534EA-40C6-4D0D-B7B3-496DF8B28FB3}'] + ['{692B5FAD-7002-4B0C-A0C5-5FC22CC3A75C}'] { Property getters and setters } function GetOldIDValue : Integer; function GetOldID_RECIBO_COMPENSADOValue : Integer; @@ -738,6 +768,33 @@ implementation uses Variants, uROBinaryHelpers; +{ TListaAnosRecibosBusinessProcessorRules } +constructor TListaAnosRecibosBusinessProcessorRules.Create(aBusinessProcessor: TDABusinessProcessor); +begin + inherited; +end; + +destructor TListaAnosRecibosBusinessProcessorRules.Destroy; +begin + inherited; +end; + +function TListaAnosRecibosBusinessProcessorRules.GetANOValue: String; +begin + result := BusinessProcessor.CurrentChange.NewValueByName[fld_ListaAnosRecibosANO]; +end; + +function TListaAnosRecibosBusinessProcessorRules.GetOldANOValue: String; +begin + result := BusinessProcessor.CurrentChange.OldValueByName[fld_ListaAnosRecibosANO]; +end; + +procedure TListaAnosRecibosBusinessProcessorRules.SetANOValue(const aValue: String); +begin + BusinessProcessor.CurrentChange.NewValueByName[fld_ListaAnosRecibosANO] := aValue; +end; + + { TRecibosClienteBusinessProcessorRules } constructor TRecibosClienteBusinessProcessorRules.Create(aBusinessProcessor: TDABusinessProcessor); begin @@ -2137,6 +2194,7 @@ end; initialization + RegisterBusinessProcessorRules(RID_ListaAnosRecibosDelta, TListaAnosRecibosBusinessProcessorRules); RegisterBusinessProcessorRules(RID_RecibosClienteDelta, TRecibosClienteBusinessProcessorRules); RegisterBusinessProcessorRules(RID_RecibosCliente_RefreshDelta, TRecibosCliente_RefreshBusinessProcessorRules); RegisterBusinessProcessorRules(RID_PagosClienteDelta, TPagosClienteBusinessProcessorRules); diff --git a/Source/Modulos/Recibos de cliente/Servidor/srvRecibosCliente_Impl.dfm b/Source/Modulos/Recibos de cliente/Servidor/srvRecibosCliente_Impl.dfm index b73aa4c0..886e8d08 100644 --- a/Source/Modulos/Recibos de cliente/Servidor/srvRecibosCliente_Impl.dfm +++ b/Source/Modulos/Recibos de cliente/Servidor/srvRecibosCliente_Impl.dfm @@ -15,6 +15,35 @@ object srvRecibosCliente: TsrvRecibosCliente ConnectionManager = dmServer.ConnectionManager DataDictionary = DADataDictionary Datasets = < + item + Params = <> + Statements = < + item + Connection = 'IBX' + SQL = + 'select ANO from'#10'(select distinct(substr(FECHA_EMISION, 1,4)) as ' + + 'ANO'#10'from recibos_cliente'#10'order by 1 desc)'#10#10'UNION ALL'#10#10'select dis' + + 'tinct '#39'Todos'#39' as ANO'#10'from empresas' + StatementType = stSQL + ColumnMappings = <> + end> + Name = 'ListaAnosRecibos' + Fields = < + item + Name = 'ANO' + DataType = datString + Size = 254 + BlobType = dabtUnknown + DisplayWidth = 0 + Alignment = taLeftJustify + InPrimaryKey = False + Calculated = False + Lookup = False + LookupCache = False + end> + BusinessRulesClient.ScriptLanguage = rslPascalScript + BusinessRulesServer.ScriptLanguage = rslPascalScript + end item Params = <> Statements = < diff --git a/Source/Modulos/Recibos de cliente/Views/uEditorRecibosCliente.dfm b/Source/Modulos/Recibos de cliente/Views/uEditorRecibosCliente.dfm index 4424292b..13391a53 100644 --- a/Source/Modulos/Recibos de cliente/Views/uEditorRecibosCliente.dfm +++ b/Source/Modulos/Recibos de cliente/Views/uEditorRecibosCliente.dfm @@ -46,9 +46,25 @@ inherited fEditorRecibosCliente: TfEditorRecibosCliente Action = actEnviarEMail end end + inherited tbxFiltro: TTBXToolbar + ExplicitWidth = 435 + inherited lblAno: TTBXLabelItem + Visible = True + end + inherited cbxListaAnos: TTBXComboBoxItem + Visible = True + end + inherited sepAno: TTBXSeparatorItem + Visible = True + end + end inherited tbxMenu: TTBXToolbar ExplicitWidth = 645 end + inherited TBXTMain2: TTBXToolbar + Left = 435 + ExplicitLeft = 435 + end end inherited StatusBar: TJvStatusBar Top = 542 diff --git a/Source/Modulos/Recibos de cliente/Views/uEditorRecibosCliente.pas b/Source/Modulos/Recibos de cliente/Views/uEditorRecibosCliente.pas index 988b0e33..a117327d 100644 --- a/Source/Modulos/Recibos de cliente/Views/uEditorRecibosCliente.pas +++ b/Source/Modulos/Recibos de cliente/Views/uEditorRecibosCliente.pas @@ -49,12 +49,16 @@ type procedure FormShow(Sender: TObject); procedure actEnviarEMailExecute(Sender: TObject); procedure actEnviarEMailUpdate(Sender: TObject); + procedure OnListaAnosChange(Sender: TObject; const Text: string); + private FRecibosCliente: IBizRecibosCliente; FController : IRecibosClienteController; + protected function GetRecibosCliente: IBizRecibosCliente; procedure SetRecibosCliente(const Value: IBizRecibosCliente); + function GetController : IRecibosClienteController; procedure SetController (const Value : IRecibosClienteController); @@ -64,6 +68,8 @@ type procedure DuplicarInterno; override; procedure ImprimirInterno; override; procedure PrevisualizarInterno; override; + procedure RefrescarInterno; override; + public procedure PonerTitulos(const ATitulo: string = ''); override; property RecibosCliente: IBizRecibosCliente read GetRecibosCliente write SetRecibosCliente; @@ -144,6 +150,8 @@ end; procedure TfEditorRecibosCliente.FormShow(Sender: TObject); begin + cbxListaAnos.OnChange := OnListaAnosChange; //OJO SIEMPRE ANTES QUE EL INHERITED + inherited; if not Assigned(ViewGrid) then @@ -221,6 +229,13 @@ begin //No se pueden añadir recibos nuevos end; +procedure TfEditorRecibosCliente.OnListaAnosChange(Sender: TObject; const Text: string); +begin + Controller.FiltrarAno(RecibosCliente, WhereDataTable, Text); + if RecibosCliente.DataTable.Active then + RefrescarInterno; +end; + procedure TfEditorRecibosCliente.PonerTitulos(const ATitulo: string); var FTitulo : String; @@ -270,17 +285,38 @@ begin end; end; +procedure TfEditorRecibosCliente.RefrescarInterno; +begin + //Volvemos a cargar los años de las facturas + if Assigned(FController) then + ListaAnos := FController.DarListaAnosRecibos; + + inherited; +end; + procedure TfEditorRecibosCliente.SetController(const Value: IRecibosClienteController); begin FController := Value; + + if Assigned(FController) then + ListaAnos := FController.DarListaAnosRecibos; end; procedure TfEditorRecibosCliente.SetRecibosCliente(const Value: IBizRecibosCliente); begin FRecibosCliente := Value; - dsDataTable.DataTable := FRecibosCliente.DataTable; - if Assigned(ViewGrid) then - (ViewGrid as IViewRecibosCliente).Recibos := FRecibosCliente; + + + if Assigned(FRecibosCliente) then + begin + //Se guarda el where de la sentencia origen, por si el editor tiene filtros que + //afecten a este where y en un futuro se desea volver al where origen (filtro de año)) + WhereDataTable := FRecibosCliente.DataTable.Where.Clause; + + dsDataTable.DataTable := FRecibosCliente.DataTable; + if Assigned(ViewGrid) then + (ViewGrid as IViewRecibosCliente).Recibos := FRecibosCliente; + end; end; end. diff --git a/Source/Modulos/Recibos de proveedor/Controller/uRecibosProveedorController.pas b/Source/Modulos/Recibos de proveedor/Controller/uRecibosProveedorController.pas index d68f0cb1..ff80e51f 100644 --- a/Source/Modulos/Recibos de proveedor/Controller/uRecibosProveedorController.pas +++ b/Source/Modulos/Recibos de proveedor/Controller/uRecibosProveedorController.pas @@ -71,6 +71,9 @@ type procedure Preview(ARecibosProveedor : IBizRecibosProveedor); procedure Print(ARecibosProveedor : IBizRecibosProveedor); + + function DarListaAnosRecibos: TStringList; + procedure FiltrarAno(AREcibo: IBizRecibosProveedor; AWhereDataTable: String; const Ano: String); end; TRecibosProveedorController = class(TObservador, IRecibosProveedorController) @@ -132,6 +135,9 @@ type procedure Preview(ARecibosProveedor : IBizRecibosProveedor); procedure Print(ARecibosProveedor : IBizRecibosProveedor); + + function DarListaAnosRecibos: TStringList; + procedure FiltrarAno(AREcibo: IBizRecibosProveedor; AWhereDataTable: String; const Ano: String); end; implementation @@ -377,6 +383,11 @@ begin Result := Buscar(ID_NULO); end; +function TRecibosProveedorController.DarListaAnosRecibos: TStringList; +begin + Result := FDataModule.GetAnosItems; +end; + function TRecibosProveedorController.DarNuevaReferencia(ID_FACTURA: Integer; REFERENCIA: String): String; var ARecibosProveedor: IBizRecibosProveedor; @@ -522,7 +533,10 @@ begin try CreateEditor('EditorRecibosProveedor', IEditorRecibosProveedor, AEditor); with AEditor do + begin + Controller := Self; //OJO ORDEN MUY IMPORTANTE RecibosProveedor := ARecibosProveedor; + end; finally HideHourglassCursor; end; @@ -773,6 +787,31 @@ begin end; end; +procedure TRecibosProveedorController.FiltrarAno(AREcibo: IBizRecibosProveedor; AWhereDataTable: String; const Ano: String); +var + FechaIni: String; + FechaFin: String; + +begin + ARecibo.DataTable.Where.Clear; + ARecibo.DataTable.Where.AddText(AWhereDataTable); + + if (Ano <> 'Todos') then + begin + // Filtrar las facturas actuales por empresa + FechaIni := '01.01.' + Ano; + FechaFin := '31.12.' + Ano; + with ARecibo.DataTable.Where do + begin + if NotEmpty then + AddOperator(opAND); + AddCondition(fld_RecibosProveedorFECHA_EMISION, cMajorOrEqual, FechaIni); + AddOperator(opAND); + AddCondition(fld_RecibosProveedorFECHA_EMISION, cLessOrEqual, FechaFin); + end; + end; +end; + procedure TRecibosProveedorController.Preview(ARecibosProveedor: IBizRecibosProveedor); var AReportController : IRecibosProveedorReportController; diff --git a/Source/Modulos/Recibos de proveedor/Data/uDataModuleRecibosProveedor.dfm b/Source/Modulos/Recibos de proveedor/Data/uDataModuleRecibosProveedor.dfm index 3eda0753..19f25e3e 100644 --- a/Source/Modulos/Recibos de proveedor/Data/uDataModuleRecibosProveedor.dfm +++ b/Source/Modulos/Recibos de proveedor/Data/uDataModuleRecibosProveedor.dfm @@ -66,7 +66,7 @@ object DataModuleRecibosProveedor: TDataModuleRecibosProveedor ProbeServers = False ProbeFrequency = 60000 UserAgent = 'RemObjects SDK' - TargetURL = 'http://localhost:8090/bin' + TargetURL = 'http://localhost:8099/bin' Left = 48 Top = 272 end @@ -1130,4 +1130,113 @@ object DataModuleRecibosProveedor: TDataModuleRecibosProveedor Left = 320 Top = 256 end + object tbl_ListaAnosRecibos: TDACDSDataTable + RemoteUpdatesOptions = [] + Fields = < + item + Name = 'ANO' + DataType = datString + Size = 254 + BlobType = dabtUnknown + DisplayWidth = 0 + Alignment = taLeftJustify + InPrimaryKey = False + Calculated = False + Lookup = False + LookupCache = False + end> + Params = <> + MasterMappingMode = mmDataRequest + StreamingOptions = [soDisableEventsWhileStreaming] + SchemaCall.MethodName = 'GetDatasetSchema' + SchemaCall.Params = < + item + Name = 'Result' + ParamType = fResult + DataType = rtBinary + end + item + Name = 'aDatasetName' + ParamType = fIn + DataType = rtString + Value = 'ListaAnosRecibos' + end> + DataRequestCall.MethodName = 'GetDatasetDataEx' + DataRequestCall.Params = < + item + Name = 'Result' + ParamType = fResult + DataType = rtBinary + end + item + Name = 'DatasetName' + ParamType = fIn + DataType = rtString + Value = 'ListaAnosRecibos' + end + item + Name = 'Params' + ParamType = fIn + DataType = rtUserDefined + UserClassName = 'TDADatasetParamArray' + end + item + Name = 'UserFilter' + ParamType = fIn + DataType = rtString + Value = '' + end + item + Name = 'IncludeSchema' + ParamType = fIn + DataType = rtBoolean + Value = False + end + item + Name = 'MaxRecords' + ParamType = fIn + DataType = rtInteger + Value = -1 + end> + DataUpdateCall.MethodName = 'UpdateData' + DataUpdateCall.Params = < + item + Name = 'Result' + ParamType = fResult + DataType = rtBinary + end + item + Name = 'Delta' + ParamType = fIn + DataType = rtBinary + end> + ScriptCall.MethodName = 'GetDatasetScripts' + ScriptCall.Params = < + item + Name = 'Result' + ParamType = fResult + DataType = rtString + Value = '' + end + item + Name = 'DatasetNames' + ParamType = fIn + DataType = rtString + Value = 'ListaAnosRecibos' + end> + ReadOnly = False + RemoteService = RORemoteService + Adapter = DABinAdapter + DetailOptions = [dtCascadeOpenClose, dtCascadeApplyUpdates, dtAutoFetch, dtCascadeDelete, dtCascadeUpdate, dtDisableLogOfCascadeDeletes, dtDisableLogOfCascadeUpdates, dtIncludeInAllInOneFetch] + MasterOptions = [moCascadeOpenClose, moCascadeApplyUpdates, moCascadeDelete, moCascadeUpdate, moDisableLogOfCascadeDeletes, moDisableLogOfCascadeUpdates] + LogicalName = 'ListaAnosRecibos' + IndexDefs = <> + Left = 168 + Top = 304 + end + object ds_ListaAnosRecibos: TDADataSource + DataTable = tbl_ListaAnosRecibos + Left = 168 + Top = 248 + end end diff --git a/Source/Modulos/Recibos de proveedor/Data/uDataModuleRecibosProveedor.pas b/Source/Modulos/Recibos de proveedor/Data/uDataModuleRecibosProveedor.pas index c4103d0c..59cdf6bb 100644 --- a/Source/Modulos/Recibos de proveedor/Data/uDataModuleRecibosProveedor.pas +++ b/Source/Modulos/Recibos de proveedor/Data/uDataModuleRecibosProveedor.pas @@ -48,6 +48,8 @@ type ds_RecibosProveedor: TDADataSource; tbl_RecibosCompensadosProv: TDACDSDataTable; ds_RecibosCompensadosProv: TDADataSource; + tbl_ListaAnosRecibos: TDACDSDataTable; + ds_ListaAnosRecibos: TDADataSource; procedure DAClientDataModuleCreate(Sender: TObject); protected function DarNombreGenerador(DataSetName: String): String; virtual; @@ -61,6 +63,7 @@ type function NewItem : IBizRecibosProveedor; function GetReport(const ID: Integer): Binary; + function GetAnosItems : TStringList; end; implementation @@ -177,6 +180,30 @@ begin Result := GetItem(ID_NULO) end; +function TDataModuleRecibosProveedor.GetAnosItems: TStringList; +var + AListaAnos: TStringList; +begin + AListaAnos := TStringList.Create; + ShowHourglassCursor; + try + with tbl_ListaAnosRecibos do + begin + Open; + First; + while not eof do + begin + AListaAnos.Add(Format('%s=%s', [Fields[0].AsString, Fields[0].AsString])); + Next; + end; + Close; + end; + Result := AListaAnos; + finally + HideHourglassCursor; + end; +end; + function TDataModuleRecibosProveedor.GetItem(const ID: Integer): IBizRecibosProveedor; begin ShowHourglassCursor; diff --git a/Source/Modulos/Recibos de proveedor/Model/Data/uIDataModuleRecibosProveedor.pas b/Source/Modulos/Recibos de proveedor/Model/Data/uIDataModuleRecibosProveedor.pas index 4b21d7c2..e1991281 100644 --- a/Source/Modulos/Recibos de proveedor/Model/Data/uIDataModuleRecibosProveedor.pas +++ b/Source/Modulos/Recibos de proveedor/Model/Data/uIDataModuleRecibosProveedor.pas @@ -26,11 +26,12 @@ unit uIDataModuleRecibosProveedor; interface uses - uBizRecibosProveedor; + Classes, uBizRecibosProveedor; type IDataModuleRecibosProveedor = interface ['{0EEAF672-1509-4695-90B0-0D6EBB81B6C5}'] + function GetAnosItems : TStringList; function GetItems: IBizRecibosProveedor; function GetNextID(const DataSetName : String) : Integer; function GetItem(const ID : Integer) : IBizRecibosProveedor; diff --git a/Source/Modulos/Recibos de proveedor/Model/schRecibosProveedorClient_Intf.pas b/Source/Modulos/Recibos de proveedor/Model/schRecibosProveedorClient_Intf.pas index 8aa50153..7bf46138 100644 --- a/Source/Modulos/Recibos de proveedor/Model/schRecibosProveedorClient_Intf.pas +++ b/Source/Modulos/Recibos de proveedor/Model/schRecibosProveedorClient_Intf.pas @@ -9,17 +9,25 @@ const { Data table rules ids Feel free to change them to something more human readable but make sure they are unique in the context of your application } - RID_RecibosCompensadosProv = '{63570371-F94E-4DAD-A5D6-3615FADEBAD4}'; - RID_RecibosProveedor = '{01D52742-DC1E-482F-A9A8-772A8B7FD75D}'; - RID_RecibosProveedor_Refresh = '{5F724DAB-29AB-4E61-BDC2-C3F476CF30F0}'; - RID_PagosProveedor = '{6B536629-405F-46A8-9008-9871D317EE04}'; + RID_ListaAnosRecibos = '{FABFE323-72E1-4714-A4EB-63025727A2F3}'; + RID_RecibosCompensadosProv = '{2F2458FB-EB0A-4CDF-8289-C46BA178D6DA}'; + RID_RecibosProveedor = '{5A5DD4C8-CE95-4428-A09D-BE403CEEBB40}'; + RID_RecibosProveedor_Refresh = '{67465BB0-C8AB-4135-A7D8-2884BC3D40DA}'; + RID_PagosProveedor = '{BB4589D4-EF3B-4D95-8CDC-41DE2E8E856C}'; { Data table names } + nme_ListaAnosRecibos = 'ListaAnosRecibos'; nme_RecibosCompensadosProv = 'RecibosCompensadosProv'; nme_RecibosProveedor = 'RecibosProveedor'; nme_RecibosProveedor_Refresh = 'RecibosProveedor_Refresh'; nme_PagosProveedor = 'PagosProveedor'; + { ListaAnosRecibos fields } + fld_ListaAnosRecibosANO = 'ANO'; + + { ListaAnosRecibos field indexes } + idx_ListaAnosRecibosANO = 0; + { RecibosCompensadosProv fields } fld_RecibosCompensadosProvID = 'ID'; fld_RecibosCompensadosProvID_RECIBO_COMPENSADO = 'ID_RECIBO_COMPENSADO'; @@ -217,9 +225,38 @@ const idx_PagosProveedorUSUARIO = 11; type + { IListaAnosRecibos } + IListaAnosRecibos = interface(IDAStronglyTypedDataTable) + ['{99555B42-5EAF-4BB2-BB1A-B2DD1BAA22EA}'] + { Property getters and setters } + function GetANOValue: String; + procedure SetANOValue(const aValue: String); + + + { Properties } + property ANO: String read GetANOValue write SetANOValue; + end; + + { TListaAnosRecibosDataTableRules } + TListaAnosRecibosDataTableRules = class(TDADataTableRules, IListaAnosRecibos) + private + protected + { Property getters and setters } + function GetANOValue: String; virtual; + procedure SetANOValue(const aValue: String); virtual; + + { Properties } + property ANO: String read GetANOValue write SetANOValue; + + public + constructor Create(aDataTable: TDADataTable); override; + destructor Destroy; override; + + end; + { IRecibosCompensadosProv } IRecibosCompensadosProv = interface(IDAStronglyTypedDataTable) - ['{A73311E9-6383-4A33-B880-1E50E74E7119}'] + ['{B307BEAA-EBF5-4F4B-814D-BDB02BB63336}'] { Property getters and setters } function GetIDValue: Integer; procedure SetIDValue(const aValue: Integer); @@ -338,7 +375,7 @@ type { IRecibosProveedor } IRecibosProveedor = interface(IDAStronglyTypedDataTable) - ['{BBBE2FC9-D743-448A-A741-C9C1919A0618}'] + ['{38664EF9-172A-4E7C-9195-5D3B63279533}'] { Property getters and setters } function GetIDValue: Integer; procedure SetIDValue(const aValue: Integer); @@ -547,7 +584,7 @@ type { IRecibosProveedor_Refresh } IRecibosProveedor_Refresh = interface(IDAStronglyTypedDataTable) - ['{B98899CB-80FA-49C3-A650-463AEA8A49A6}'] + ['{40DA5BFF-5A7E-468A-87E2-239FFF4AC7CF}'] { Property getters and setters } function GetIDValue: Integer; procedure SetIDValue(const aValue: Integer); @@ -756,7 +793,7 @@ type { IPagosProveedor } IPagosProveedor = interface(IDAStronglyTypedDataTable) - ['{81F0AAB6-D43A-4832-9A2F-D4F8C013F6FA}'] + ['{381D94DF-9A80-48EE-9404-910096E811A9}'] { Property getters and setters } function GetIDValue: Integer; procedure SetIDValue(const aValue: Integer); @@ -853,6 +890,28 @@ implementation uses Variants; +{ TListaAnosRecibosDataTableRules } +constructor TListaAnosRecibosDataTableRules.Create(aDataTable: TDADataTable); +begin + inherited; +end; + +destructor TListaAnosRecibosDataTableRules.Destroy; +begin + inherited; +end; + +function TListaAnosRecibosDataTableRules.GetANOValue: String; +begin + result := DataTable.Fields[idx_ListaAnosRecibosANO].AsString; +end; + +procedure TListaAnosRecibosDataTableRules.SetANOValue(const aValue: String); +begin + DataTable.Fields[idx_ListaAnosRecibosANO].AsString := aValue; +end; + + { TRecibosCompensadosProvDataTableRules } constructor TRecibosCompensadosProvDataTableRules.Create(aDataTable: TDADataTable); begin @@ -1802,6 +1861,7 @@ end; initialization + RegisterDataTableRules(RID_ListaAnosRecibos, TListaAnosRecibosDataTableRules); RegisterDataTableRules(RID_RecibosCompensadosProv, TRecibosCompensadosProvDataTableRules); RegisterDataTableRules(RID_RecibosProveedor, TRecibosProveedorDataTableRules); RegisterDataTableRules(RID_RecibosProveedor_Refresh, TRecibosProveedor_RefreshDataTableRules); diff --git a/Source/Modulos/Recibos de proveedor/Model/schRecibosProveedorServer_Intf.pas b/Source/Modulos/Recibos de proveedor/Model/schRecibosProveedorServer_Intf.pas index c376463f..87971512 100644 --- a/Source/Modulos/Recibos de proveedor/Model/schRecibosProveedorServer_Intf.pas +++ b/Source/Modulos/Recibos de proveedor/Model/schRecibosProveedorServer_Intf.pas @@ -9,15 +9,45 @@ const { Delta rules ids Feel free to change them to something more human readable but make sure they are unique in the context of your application } - RID_RecibosCompensadosProvDelta = '{BA2DCF11-7070-4929-857C-AB7731AF7924}'; - RID_RecibosProveedorDelta = '{4C7167E6-9FB3-46CC-9733-EDC6BB1778BA}'; - RID_RecibosProveedor_RefreshDelta = '{3C6253BF-134D-4B04-97C7-A02E2933935D}'; - RID_PagosProveedorDelta = '{1BDCAA45-F48F-47E8-947D-8D70E87FF7A3}'; + RID_ListaAnosRecibosDelta = '{BFF440E9-12BC-425B-8040-CBECEF5190CB}'; + RID_RecibosCompensadosProvDelta = '{016D5CE9-683B-4A12-8274-656BD000E183}'; + RID_RecibosProveedorDelta = '{FE478D0D-F8F0-4399-B6EC-12BED231E97D}'; + RID_RecibosProveedor_RefreshDelta = '{3B183AEE-00B6-4C9F-8D57-B9BA4A7939B2}'; + RID_PagosProveedorDelta = '{773645D4-A67B-4355-BD24-3AF6431F4FD9}'; type + { IListaAnosRecibosDelta } + IListaAnosRecibosDelta = interface(IListaAnosRecibos) + ['{BFF440E9-12BC-425B-8040-CBECEF5190CB}'] + { Property getters and setters } + function GetOldANOValue : String; + + { Properties } + property OldANO : String read GetOldANOValue; + end; + + { TListaAnosRecibosBusinessProcessorRules } + TListaAnosRecibosBusinessProcessorRules = class(TDABusinessProcessorRules, IListaAnosRecibos, IListaAnosRecibosDelta) + private + protected + { Property getters and setters } + function GetANOValue: String; virtual; + function GetOldANOValue: String; virtual; + procedure SetANOValue(const aValue: String); virtual; + + { Properties } + property ANO : String read GetANOValue write SetANOValue; + property OldANO : String read GetOldANOValue; + + public + constructor Create(aBusinessProcessor: TDABusinessProcessor); override; + destructor Destroy; override; + + end; + { IRecibosCompensadosProvDelta } IRecibosCompensadosProvDelta = interface(IRecibosCompensadosProv) - ['{BA2DCF11-7070-4929-857C-AB7731AF7924}'] + ['{016D5CE9-683B-4A12-8274-656BD000E183}'] { Property getters and setters } function GetOldIDValue : Integer; function GetOldID_RECIBO_COMPENSADOValue : Integer; @@ -151,7 +181,7 @@ type { IRecibosProveedorDelta } IRecibosProveedorDelta = interface(IRecibosProveedor) - ['{4C7167E6-9FB3-46CC-9733-EDC6BB1778BA}'] + ['{FE478D0D-F8F0-4399-B6EC-12BED231E97D}'] { Property getters and setters } function GetOldIDValue : Integer; function GetOldID_RECIBO_COMPENSADOValue : Integer; @@ -390,7 +420,7 @@ type { IRecibosProveedor_RefreshDelta } IRecibosProveedor_RefreshDelta = interface(IRecibosProveedor_Refresh) - ['{3C6253BF-134D-4B04-97C7-A02E2933935D}'] + ['{3B183AEE-00B6-4C9F-8D57-B9BA4A7939B2}'] { Property getters and setters } function GetOldIDValue : Integer; function GetOldID_RECIBO_COMPENSADOValue : Integer; @@ -629,7 +659,7 @@ type { IPagosProveedorDelta } IPagosProveedorDelta = interface(IPagosProveedor) - ['{1BDCAA45-F48F-47E8-947D-8D70E87FF7A3}'] + ['{773645D4-A67B-4355-BD24-3AF6431F4FD9}'] { Property getters and setters } function GetOldIDValue : Integer; function GetOldID_RECIBOValue : Integer; @@ -738,6 +768,33 @@ implementation uses Variants, uROBinaryHelpers; +{ TListaAnosRecibosBusinessProcessorRules } +constructor TListaAnosRecibosBusinessProcessorRules.Create(aBusinessProcessor: TDABusinessProcessor); +begin + inherited; +end; + +destructor TListaAnosRecibosBusinessProcessorRules.Destroy; +begin + inherited; +end; + +function TListaAnosRecibosBusinessProcessorRules.GetANOValue: String; +begin + result := BusinessProcessor.CurrentChange.NewValueByName[fld_ListaAnosRecibosANO]; +end; + +function TListaAnosRecibosBusinessProcessorRules.GetOldANOValue: String; +begin + result := BusinessProcessor.CurrentChange.OldValueByName[fld_ListaAnosRecibosANO]; +end; + +procedure TListaAnosRecibosBusinessProcessorRules.SetANOValue(const aValue: String); +begin + BusinessProcessor.CurrentChange.NewValueByName[fld_ListaAnosRecibosANO] := aValue; +end; + + { TRecibosCompensadosProvBusinessProcessorRules } constructor TRecibosCompensadosProvBusinessProcessorRules.Create(aBusinessProcessor: TDABusinessProcessor); begin @@ -2137,6 +2194,7 @@ end; initialization + RegisterBusinessProcessorRules(RID_ListaAnosRecibosDelta, TListaAnosRecibosBusinessProcessorRules); RegisterBusinessProcessorRules(RID_RecibosCompensadosProvDelta, TRecibosCompensadosProvBusinessProcessorRules); RegisterBusinessProcessorRules(RID_RecibosProveedorDelta, TRecibosProveedorBusinessProcessorRules); RegisterBusinessProcessorRules(RID_RecibosProveedor_RefreshDelta, TRecibosProveedor_RefreshBusinessProcessorRules); diff --git a/Source/Modulos/Recibos de proveedor/RecibosProveedor_Group.bdsgroup b/Source/Modulos/Recibos de proveedor/RecibosProveedor_Group.bdsgroup index 4544959f..2709e73a 100644 --- a/Source/Modulos/Recibos de proveedor/RecibosProveedor_Group.bdsgroup +++ b/Source/Modulos/Recibos de proveedor/RecibosProveedor_Group.bdsgroup @@ -8,9 +8,7 @@ - - - + ..\..\Base\Base.bdsproj ..\..\Base\ControllerBase\ControllerBase.bdsproj ..\..\Base\GUIBase\GUIBase.bdsproj @@ -29,7 +27,8 @@ Plugin\RecibosProveedor_plugin.bdsproj ..\..\Cliente\FactuGES.bdsproj ..\..\Servidor\FactuGES_Server.bdsproj - Base.bpl ControllerBase.bpl GUIBase.bpl Contactos_model.bpl Contactos_data.bpl Contactos_controller.bpl Articulos_view.bpl Articulos_model.bpl Articulos_data.bpl Articulos_controller.bpl Contactos_view.bpl RecibosProveedor_model.bpl RecibosProveedor_data.bpl RecibosProveedor_controller.bpl RecibosProveedor_view.bpl RecibosProveedor_plugin.bpl FactuGES.exe FactuGES_Server.exe + ..\Facturas de cliente\Views\FacturasCliente_view.bdsproj + Base.bpl ControllerBase.bpl GUIBase.bpl Contactos_model.bpl Contactos_data.bpl Contactos_controller.bpl Articulos_view.bpl Articulos_model.bpl Articulos_data.bpl Articulos_controller.bpl Contactos_view.bpl RecibosProveedor_model.bpl RecibosProveedor_data.bpl RecibosProveedor_controller.bpl RecibosProveedor_view.bpl RecibosProveedor_plugin.bpl FactuGES.exe FactuGES_Server.exe FacturasCliente_view.bpl diff --git a/Source/Modulos/Recibos de proveedor/Servidor/srvRecibosProveedor_Impl.dfm b/Source/Modulos/Recibos de proveedor/Servidor/srvRecibosProveedor_Impl.dfm index f2924034..2973da36 100644 --- a/Source/Modulos/Recibos de proveedor/Servidor/srvRecibosProveedor_Impl.dfm +++ b/Source/Modulos/Recibos de proveedor/Servidor/srvRecibosProveedor_Impl.dfm @@ -15,6 +15,35 @@ object srvRecibosProveedor: TsrvRecibosProveedor ConnectionManager = dmServer.ConnectionManager DataDictionary = DADataDictionary Datasets = < + item + Params = <> + Statements = < + item + Connection = 'IBX' + SQL = + 'select ANO from'#10'(select distinct(substr(FECHA_EMISION, 1,4)) as ' + + 'ANO'#10'from recibos_proveedor'#10'order by 1 desc)'#10#10'UNION ALL'#10#10'select d' + + 'istinct '#39'Todos'#39' as ANO'#10'from empresas' + StatementType = stSQL + ColumnMappings = <> + end> + Name = 'ListaAnosRecibos' + Fields = < + item + Name = 'ANO' + DataType = datString + Size = 254 + BlobType = dabtUnknown + DisplayWidth = 0 + Alignment = taLeftJustify + InPrimaryKey = False + Calculated = False + Lookup = False + LookupCache = False + end> + BusinessRulesClient.ScriptLanguage = rslPascalScript + BusinessRulesServer.ScriptLanguage = rslPascalScript + end item Params = < item diff --git a/Source/Modulos/Recibos de proveedor/Views/uEditorRecibosProveedor.dfm b/Source/Modulos/Recibos de proveedor/Views/uEditorRecibosProveedor.dfm index 8fdf639f..52fa27f4 100644 --- a/Source/Modulos/Recibos de proveedor/Views/uEditorRecibosProveedor.dfm +++ b/Source/Modulos/Recibos de proveedor/Views/uEditorRecibosProveedor.dfm @@ -2,7 +2,6 @@ inherited fEditorRecibosProveedor: TfEditorRecibosProveedor Caption = 'Lista de recibos de proveedor' ClientHeight = 664 ClientWidth = 638 - ExplicitTop = -173 ExplicitWidth = 646 ExplicitHeight = 691 PixelsPerInch = 96 @@ -44,9 +43,25 @@ inherited fEditorRecibosProveedor: TfEditorRecibosProveedor inherited tbxMain: TTBXToolbar ExplicitWidth = 276 end + inherited tbxFiltro: TTBXToolbar + ExplicitWidth = 435 + inherited lblAno: TTBXLabelItem + Visible = True + end + inherited cbxListaAnos: TTBXComboBoxItem + Visible = True + end + inherited sepAno: TTBXSeparatorItem + Visible = True + end + end inherited tbxMenu: TTBXToolbar ExplicitWidth = 638 end + inherited TBXTMain2: TTBXToolbar + Left = 435 + ExplicitLeft = 435 + end end inherited StatusBar: TJvStatusBar Top = 645 diff --git a/Source/Modulos/Recibos de proveedor/Views/uEditorRecibosProveedor.pas b/Source/Modulos/Recibos de proveedor/Views/uEditorRecibosProveedor.pas index c34b4ed1..0900ced9 100644 --- a/Source/Modulos/Recibos de proveedor/Views/uEditorRecibosProveedor.pas +++ b/Source/Modulos/Recibos de proveedor/Views/uEditorRecibosProveedor.pas @@ -33,9 +33,9 @@ uses TBX, TB2Item, TB2Dock, TB2Toolbar, ExtCtrls, JvExControls, JvNavigationPane, uViewGrid, pngimage, JvComponentBase, JvExComCtrls, JvStatusBar, uViewBase, uViewBarraSeleccion, uViewGridBase, - uEditorGridBase, uCustomView, - - uBizRecibosProveedor, uIEditorRecibosProveedor, uRecibosProveedorController, + uEditorGridBase, uCustomView, + + uBizRecibosProveedor, uIEditorRecibosProveedor, uRecibosProveedorController, uViewRecibosProveedor; type @@ -43,12 +43,16 @@ type TfEditorRecibosProveedor = class(TfEditorGridBase, IEditorRecibosProveedor) frViewRecibosProveedor1: TfrViewRecibosProveedor; procedure FormShow(Sender: TObject); + procedure OnListaAnosChange(Sender: TObject; const Text: string); + private FRecibosProveedor: IBizRecibosProveedor; FController : IRecibosProveedorController; + protected function GetRecibosProveedor: IBizRecibosProveedor; procedure SetRecibosProveedor(const Value: IBizRecibosProveedor); + function GetController : IRecibosProveedorController; procedure SetController (const Value : IRecibosProveedorController); @@ -58,6 +62,8 @@ type procedure DuplicarInterno; override; procedure ImprimirInterno; override; procedure PrevisualizarInterno; override; + procedure RefrescarInterno; override; + public procedure PonerTitulos(const ATitulo: string = ''); override; property RecibosProveedor: IBizRecibosProveedor read GetRecibosProveedor write SetRecibosProveedor; @@ -105,6 +111,8 @@ end; procedure TfEditorRecibosProveedor.FormShow(Sender: TObject); begin + cbxListaAnos.OnChange := OnListaAnosChange; //OJO SIEMPRE ANTES DEL INHERITED + inherited; if not Assigned(ViewGrid) then @@ -145,6 +153,13 @@ begin //No se pueden añadir recibos nuevos end; +procedure TfEditorRecibosProveedor.OnListaAnosChange(Sender: TObject; const Text: string); +begin + Controller.FiltrarAno(RecibosProveedor, WhereDataTable, Text); + if RecibosProveedor.DataTable.Active then + RefrescarInterno; +end; + procedure TfEditorRecibosProveedor.PonerTitulos(const ATitulo: string); var FTitulo : String; @@ -158,17 +173,37 @@ begin inherited; end; +procedure TfEditorRecibosProveedor.RefrescarInterno; +begin + //Volvemos a cargar los años de los recibos + if Assigned(FController) then + ListaAnos := FController.DarListaAnosRecibos; + + inherited; +end; + procedure TfEditorRecibosProveedor.SetController(const Value: IRecibosProveedorController); begin FController := Value; + + if Assigned(FController) then + ListaAnos := FController.DarListaAnosRecibos; end; procedure TfEditorRecibosProveedor.SetRecibosProveedor(const Value: IBizRecibosProveedor); begin FRecibosProveedor := Value; - dsDataTable.DataTable := FRecibosProveedor.DataTable; - if Assigned(ViewGrid) then - (ViewGrid as IViewRecibosProveedor).Recibos := FRecibosProveedor; + + if Assigned(FRecibosProveedor) then + begin + //Se guarda el where de la sentencia origen, por si el editor tiene filtros que + //afecten a este where y en un futuro se desea volver al where origen (filtro de año)) + WhereDataTable := FRecibosProveedor.DataTable.Where.Clause; + + dsDataTable.DataTable := FRecibosProveedor.DataTable; + if Assigned(ViewGrid) then + (ViewGrid as IViewRecibosProveedor).Recibos := FRecibosProveedor; + end; end; end. diff --git a/Source/Modulos/Remesas de cliente/Controller/uRemesasClienteController.pas b/Source/Modulos/Remesas de cliente/Controller/uRemesasClienteController.pas index 5e524856..d2f6c92e 100644 --- a/Source/Modulos/Remesas de cliente/Controller/uRemesasClienteController.pas +++ b/Source/Modulos/Remesas de cliente/Controller/uRemesasClienteController.pas @@ -35,6 +35,9 @@ type procedure RecuperarRecibos(ARemesaCliente: IBizRemesaCliente); function ExtraerSeleccionados(ARemesasCliente: IBizRemesaCliente; Const ViewGrid: IViewGridBase = Nil) : IBizRemesaCliente; + + function DarListaAnosRemesas: TStringList; + procedure FiltrarAno(ARemesa: IBizRemesaCliente; AWhereDataTable: String; const Ano: String); end; TRemesasClienteController = class(TObservador, IRemesasClienteController) @@ -81,6 +84,9 @@ type function ExtraerSeleccionados(ARemesasCliente: IBizRemesaCliente; Const ViewGrid: IViewGridBase = Nil) : IBizRemesaCliente; virtual; function ElegirRecibosCliente(ARemesaCliente : IBizRemesaCliente): Boolean; procedure EliminarReciboCliente(ARemesaCliente : IBizRemesaCliente); + + function DarListaAnosRemesas: TStringList; + procedure FiltrarAno(ARemesa: IBizRemesaCliente; AWhereDataTable: String; const Ano: String); end; implementation @@ -162,6 +168,11 @@ begin Result := Supports(EditorRegistry.CreateEditor(AName), IID, Intf); end; +function TRemesasClienteController.DarListaAnosRemesas: TStringList; +begin + Result := FDataModule.GetAnosItems; +end; + procedure TRemesasClienteController.DescartarCambios(ARemesaCliente: IBizRemesaCliente); begin if not Assigned(ARemesaCliente) then @@ -467,6 +478,31 @@ begin end; end; +procedure TRemesasClienteController.FiltrarAno(ARemesa: IBizRemesaCliente; AWhereDataTable: String; const Ano: String); +var + FechaIni: String; + FechaFin: String; + +begin + ARemesa.DataTable.Where.Clear; + ARemesa.DataTable.Where.AddText(AWhereDataTable); + + if (Ano <> 'Todos') then + begin + // Filtrar las remesas actuales por empresa + FechaIni := '01.01.' + Ano; + FechaFin := '31.12.' + Ano; + with ARemesa.DataTable.Where do + begin + if NotEmpty then + AddOperator(opAND); + AddCondition(fld_RemesasClienteFECHA_REMESA, cMajorOrEqual, FechaIni); + AddOperator(opAND); + AddCondition(fld_RemesasClienteFECHA_REMESA, cLessOrEqual, FechaFin); + end; + end; +end; + procedure TRemesasClienteController.FiltrarEmpresa(ARemesaCliente: IBizRemesaCliente); begin if ARemesaCliente.DataTable.Active then diff --git a/Source/Modulos/Remesas de cliente/Data/uDataModuleRemesasCliente.dfm b/Source/Modulos/Remesas de cliente/Data/uDataModuleRemesasCliente.dfm index 6c8eb65f..e1d69b5e 100644 --- a/Source/Modulos/Remesas de cliente/Data/uDataModuleRemesasCliente.dfm +++ b/Source/Modulos/Remesas de cliente/Data/uDataModuleRemesasCliente.dfm @@ -423,4 +423,113 @@ object DataModuleRemesasCliente: TDataModuleRemesasCliente Left = 288 Top = 88 end + object tbl_ListaAnosRemesas: TDACDSDataTable + RemoteUpdatesOptions = [] + Fields = < + item + Name = 'ANO' + DataType = datString + Size = 254 + BlobType = dabtUnknown + DisplayWidth = 0 + Alignment = taLeftJustify + InPrimaryKey = False + Calculated = False + Lookup = False + LookupCache = False + end> + Params = <> + MasterMappingMode = mmDataRequest + StreamingOptions = [soDisableEventsWhileStreaming] + SchemaCall.MethodName = 'GetDatasetSchema' + SchemaCall.Params = < + item + Name = 'Result' + ParamType = fResult + DataType = rtBinary + end + item + Name = 'aDatasetName' + ParamType = fIn + DataType = rtString + Value = 'ListaAnosRemesas' + end> + DataRequestCall.MethodName = 'GetDatasetDataEx' + DataRequestCall.Params = < + item + Name = 'Result' + ParamType = fResult + DataType = rtBinary + end + item + Name = 'DatasetName' + ParamType = fIn + DataType = rtString + Value = 'ListaAnosRemesas' + end + item + Name = 'Params' + ParamType = fIn + DataType = rtUserDefined + UserClassName = 'TDADatasetParamArray' + end + item + Name = 'UserFilter' + ParamType = fIn + DataType = rtString + Value = '' + end + item + Name = 'IncludeSchema' + ParamType = fIn + DataType = rtBoolean + Value = False + end + item + Name = 'MaxRecords' + ParamType = fIn + DataType = rtInteger + Value = -1 + end> + DataUpdateCall.MethodName = 'UpdateData' + DataUpdateCall.Params = < + item + Name = 'Result' + ParamType = fResult + DataType = rtBinary + end + item + Name = 'Delta' + ParamType = fIn + DataType = rtBinary + end> + ScriptCall.MethodName = 'GetDatasetScripts' + ScriptCall.Params = < + item + Name = 'Result' + ParamType = fResult + DataType = rtString + Value = '' + end + item + Name = 'DatasetNames' + ParamType = fIn + DataType = rtString + Value = 'ListaAnosRemesas' + end> + ReadOnly = False + RemoteService = RORemoteService + Adapter = DABinAdapter + DetailOptions = [dtCascadeOpenClose, dtCascadeApplyUpdates, dtAutoFetch, dtCascadeDelete, dtCascadeUpdate, dtDisableLogOfCascadeDeletes, dtDisableLogOfCascadeUpdates, dtIncludeInAllInOneFetch] + MasterOptions = [moCascadeOpenClose, moCascadeApplyUpdates, moCascadeDelete, moCascadeUpdate, moDisableLogOfCascadeDeletes, moDisableLogOfCascadeUpdates] + LogicalName = 'ListaAnosRemesas' + IndexDefs = <> + Left = 176 + Top = 160 + end + object ds_ListaAnosRemesas: TDADataSource + DataTable = tbl_ListaAnosRemesas + Left = 176 + Top = 88 + end end diff --git a/Source/Modulos/Remesas de cliente/Data/uDataModuleRemesasCliente.pas b/Source/Modulos/Remesas de cliente/Data/uDataModuleRemesasCliente.pas index b8dda9cf..d8eb2cd2 100644 --- a/Source/Modulos/Remesas de cliente/Data/uDataModuleRemesasCliente.pas +++ b/Source/Modulos/Remesas de cliente/Data/uDataModuleRemesasCliente.pas @@ -19,6 +19,8 @@ type ROBinMessage1: TROBinMessage; tbl_RemesasCliente: TDACDSDataTable; ds_RemesasCliente: TDADataSource; + tbl_ListaAnosRemesas: TDACDSDataTable; + ds_ListaAnosRemesas: TDADataSource; procedure DAClientDataModuleCreate(Sender: TObject); protected @@ -33,6 +35,8 @@ type // Report function GetReport(const ID: String): Binary; + + function GetAnosItems : TStringList; end; implementation @@ -91,6 +95,30 @@ begin CloneDataTable(ADataTable, Result); end; +function TDataModuleRemesasCliente.GetAnosItems: TStringList; +var + AListaAnos: TStringList; +begin + AListaAnos := TStringList.Create; + ShowHourglassCursor; + try + with tbl_ListaAnosRemesas do + begin + Open; + First; + while not eof do + begin + AListaAnos.Add(Format('%s=%s', [Fields[0].AsString, Fields[0].AsString])); + Next; + end; + Close; + end; + Result := AListaAnos; + finally + HideHourglassCursor; + end; +end; + function TDataModuleRemesasCliente.GetItem(const ID: Integer): IBizRemesaCliente; begin ShowHourglassCursor; diff --git a/Source/Modulos/Remesas de cliente/Model/Data/uIDataModuleRemesasCliente.pas b/Source/Modulos/Remesas de cliente/Model/Data/uIDataModuleRemesasCliente.pas index e89ade1f..1b3ec25f 100644 --- a/Source/Modulos/Remesas de cliente/Model/Data/uIDataModuleRemesasCliente.pas +++ b/Source/Modulos/Remesas de cliente/Model/Data/uIDataModuleRemesasCliente.pas @@ -3,11 +3,12 @@ unit uIDataModuleRemesasCliente; interface uses - uBizRemesasCliente; + Classes, uBizRemesasCliente; type IDataModuleRemesasCliente = interface ['{9047C468-78DE-404E-9047-1125B382FE3B}'] + function GetAnosItems : TStringList; function GetItems: IBizRemesaCliente; function GetItem(const ID : Integer) : IBizRemesaCliente; function GetNextID(const DataSetName : String) : Integer; diff --git a/Source/Modulos/Remesas de cliente/Model/schRemesasClienteClient_Intf.pas b/Source/Modulos/Remesas de cliente/Model/schRemesasClienteClient_Intf.pas index 95f09886..5b1adad7 100644 --- a/Source/Modulos/Remesas de cliente/Model/schRemesasClienteClient_Intf.pas +++ b/Source/Modulos/Remesas de cliente/Model/schRemesasClienteClient_Intf.pas @@ -9,15 +9,23 @@ const { Data table rules ids Feel free to change them to something more human readable but make sure they are unique in the context of your application } - RID_darReferencia = '{B51817C3-0E66-46C0-9913-CD22E47DEDCF}'; - RID_RemesasCliente = '{C58CD9F2-60DE-4E16-9EC6-0792C6FA4739}'; - RID_RemesasCliente_Refresh = '{565D1E0B-F210-4FBE-A49D-31D731D3D946}'; + RID_ListaAnosRemesas = '{C821D04E-EFDE-42BF-8F2B-99FD4FAF9547}'; + RID_darReferencia = '{B15925D1-0E5F-437A-BB81-1A66E3503BDE}'; + RID_RemesasCliente = '{10177270-8028-4076-A370-23B61F8AFA94}'; + RID_RemesasCliente_Refresh = '{7DB2286C-C11F-44F1-B2B2-CF55A0B760FF}'; { Data table names } + nme_ListaAnosRemesas = 'ListaAnosRemesas'; nme_darReferencia = 'darReferencia'; nme_RemesasCliente = 'RemesasCliente'; nme_RemesasCliente_Refresh = 'RemesasCliente_Refresh'; + { ListaAnosRemesas fields } + fld_ListaAnosRemesasANO = 'ANO'; + + { ListaAnosRemesas field indexes } + idx_ListaAnosRemesasANO = 0; + { darReferencia fields } fld_darReferenciaVALOR = 'VALOR'; @@ -109,9 +117,38 @@ const idx_RemesasCliente_RefreshSUFIJO_N58 = 18; type + { IListaAnosRemesas } + IListaAnosRemesas = interface(IDAStronglyTypedDataTable) + ['{87635282-9C38-46C3-94AF-677D38E12D01}'] + { Property getters and setters } + function GetANOValue: String; + procedure SetANOValue(const aValue: String); + + + { Properties } + property ANO: String read GetANOValue write SetANOValue; + end; + + { TListaAnosRemesasDataTableRules } + TListaAnosRemesasDataTableRules = class(TDADataTableRules, IListaAnosRemesas) + private + protected + { Property getters and setters } + function GetANOValue: String; virtual; + procedure SetANOValue(const aValue: String); virtual; + + { Properties } + property ANO: String read GetANOValue write SetANOValue; + + public + constructor Create(aDataTable: TDADataTable); override; + destructor Destroy; override; + + end; + { IdarReferencia } IdarReferencia = interface(IDAStronglyTypedDataTable) - ['{63DE6705-0083-4EB0-A969-D0A7EA49C2D3}'] + ['{68E16B74-99A8-473F-81FC-9D35481D444A}'] { Property getters and setters } function GetVALORValue: String; procedure SetVALORValue(const aValue: String); @@ -140,7 +177,7 @@ type { IRemesasCliente } IRemesasCliente = interface(IDAStronglyTypedDataTable) - ['{8069DEA4-13BC-4DDC-8280-C385C6FEA141}'] + ['{5B2D5FF2-7A89-433D-96F6-196E16620625}'] { Property getters and setters } function GetIDValue: Integer; procedure SetIDValue(const aValue: Integer); @@ -277,7 +314,7 @@ type { IRemesasCliente_Refresh } IRemesasCliente_Refresh = interface(IDAStronglyTypedDataTable) - ['{70773417-03B3-44E1-BE83-EC8D300A2E34}'] + ['{96877B1C-EA17-46B5-A8A4-51BEF5B2D4E4}'] { Property getters and setters } function GetIDValue: Integer; procedure SetIDValue(const aValue: Integer); @@ -416,6 +453,28 @@ implementation uses Variants; +{ TListaAnosRemesasDataTableRules } +constructor TListaAnosRemesasDataTableRules.Create(aDataTable: TDADataTable); +begin + inherited; +end; + +destructor TListaAnosRemesasDataTableRules.Destroy; +begin + inherited; +end; + +function TListaAnosRemesasDataTableRules.GetANOValue: String; +begin + result := DataTable.Fields[idx_ListaAnosRemesasANO].AsString; +end; + +procedure TListaAnosRemesasDataTableRules.SetANOValue(const aValue: String); +begin + DataTable.Fields[idx_ListaAnosRemesasANO].AsString := aValue; +end; + + { TdarReferenciaDataTableRules } constructor TdarReferenciaDataTableRules.Create(aDataTable: TDADataTable); begin @@ -843,6 +902,7 @@ end; initialization + RegisterDataTableRules(RID_ListaAnosRemesas, TListaAnosRemesasDataTableRules); RegisterDataTableRules(RID_darReferencia, TdarReferenciaDataTableRules); RegisterDataTableRules(RID_RemesasCliente, TRemesasClienteDataTableRules); RegisterDataTableRules(RID_RemesasCliente_Refresh, TRemesasCliente_RefreshDataTableRules); diff --git a/Source/Modulos/Remesas de cliente/Model/schRemesasClienteServer_Intf.pas b/Source/Modulos/Remesas de cliente/Model/schRemesasClienteServer_Intf.pas index aa6b1edf..1911badb 100644 --- a/Source/Modulos/Remesas de cliente/Model/schRemesasClienteServer_Intf.pas +++ b/Source/Modulos/Remesas de cliente/Model/schRemesasClienteServer_Intf.pas @@ -9,14 +9,44 @@ const { Delta rules ids Feel free to change them to something more human readable but make sure they are unique in the context of your application } - RID_darReferenciaDelta = '{A22BAD63-61D2-4A59-B8D5-75E81DA5DC76}'; - RID_RemesasClienteDelta = '{9092926B-D466-4D6C-A6BF-5446307DF549}'; - RID_RemesasCliente_RefreshDelta = '{BA819617-6407-45A8-A07F-3EBEE792DED6}'; + RID_ListaAnosRemesasDelta = '{27FFB589-C200-4B87-9E63-02E33044F952}'; + RID_darReferenciaDelta = '{B841812F-0D02-4C8E-931B-A31251CBB6E0}'; + RID_RemesasClienteDelta = '{2081F08D-A611-495B-9003-96A9CF4CA182}'; + RID_RemesasCliente_RefreshDelta = '{A171C918-A8E4-43F4-9D3E-36EF727AACB6}'; type + { IListaAnosRemesasDelta } + IListaAnosRemesasDelta = interface(IListaAnosRemesas) + ['{27FFB589-C200-4B87-9E63-02E33044F952}'] + { Property getters and setters } + function GetOldANOValue : String; + + { Properties } + property OldANO : String read GetOldANOValue; + end; + + { TListaAnosRemesasBusinessProcessorRules } + TListaAnosRemesasBusinessProcessorRules = class(TDABusinessProcessorRules, IListaAnosRemesas, IListaAnosRemesasDelta) + private + protected + { Property getters and setters } + function GetANOValue: String; virtual; + function GetOldANOValue: String; virtual; + procedure SetANOValue(const aValue: String); virtual; + + { Properties } + property ANO : String read GetANOValue write SetANOValue; + property OldANO : String read GetOldANOValue; + + public + constructor Create(aBusinessProcessor: TDABusinessProcessor); override; + destructor Destroy; override; + + end; + { IdarReferenciaDelta } IdarReferenciaDelta = interface(IdarReferencia) - ['{A22BAD63-61D2-4A59-B8D5-75E81DA5DC76}'] + ['{B841812F-0D02-4C8E-931B-A31251CBB6E0}'] { Property getters and setters } function GetOldVALORValue : String; @@ -45,7 +75,7 @@ type { IRemesasClienteDelta } IRemesasClienteDelta = interface(IRemesasCliente) - ['{9092926B-D466-4D6C-A6BF-5446307DF549}'] + ['{2081F08D-A611-495B-9003-96A9CF4CA182}'] { Property getters and setters } function GetOldIDValue : Integer; function GetOldID_EMPRESAValue : Integer; @@ -200,7 +230,7 @@ type { IRemesasCliente_RefreshDelta } IRemesasCliente_RefreshDelta = interface(IRemesasCliente_Refresh) - ['{BA819617-6407-45A8-A07F-3EBEE792DED6}'] + ['{A171C918-A8E4-43F4-9D3E-36EF727AACB6}'] { Property getters and setters } function GetOldIDValue : Integer; function GetOldID_EMPRESAValue : Integer; @@ -358,6 +388,33 @@ implementation uses Variants, uROBinaryHelpers; +{ TListaAnosRemesasBusinessProcessorRules } +constructor TListaAnosRemesasBusinessProcessorRules.Create(aBusinessProcessor: TDABusinessProcessor); +begin + inherited; +end; + +destructor TListaAnosRemesasBusinessProcessorRules.Destroy; +begin + inherited; +end; + +function TListaAnosRemesasBusinessProcessorRules.GetANOValue: String; +begin + result := BusinessProcessor.CurrentChange.NewValueByName[fld_ListaAnosRemesasANO]; +end; + +function TListaAnosRemesasBusinessProcessorRules.GetOldANOValue: String; +begin + result := BusinessProcessor.CurrentChange.OldValueByName[fld_ListaAnosRemesasANO]; +end; + +procedure TListaAnosRemesasBusinessProcessorRules.SetANOValue(const aValue: String); +begin + BusinessProcessor.CurrentChange.NewValueByName[fld_ListaAnosRemesasANO] := aValue; +end; + + { TdarReferenciaBusinessProcessorRules } constructor TdarReferenciaBusinessProcessorRules.Create(aBusinessProcessor: TDABusinessProcessor); begin @@ -980,6 +1037,7 @@ end; initialization + RegisterBusinessProcessorRules(RID_ListaAnosRemesasDelta, TListaAnosRemesasBusinessProcessorRules); RegisterBusinessProcessorRules(RID_darReferenciaDelta, TdarReferenciaBusinessProcessorRules); RegisterBusinessProcessorRules(RID_RemesasClienteDelta, TRemesasClienteBusinessProcessorRules); RegisterBusinessProcessorRules(RID_RemesasCliente_RefreshDelta, TRemesasCliente_RefreshBusinessProcessorRules); diff --git a/Source/Modulos/Remesas de cliente/Servidor/srvRemesasCliente_Impl.dfm b/Source/Modulos/Remesas de cliente/Servidor/srvRemesasCliente_Impl.dfm index fec14ac8..d3ebd8a6 100644 --- a/Source/Modulos/Remesas de cliente/Servidor/srvRemesasCliente_Impl.dfm +++ b/Source/Modulos/Remesas de cliente/Servidor/srvRemesasCliente_Impl.dfm @@ -190,6 +190,35 @@ object srvRemesasCliente: TsrvRemesasCliente DataDictionary = DataDictionary Diagrams = Diagrams Datasets = < + item + Params = <> + Statements = < + item + Connection = 'IBX' + SQL = + 'select ANO from'#10'(select distinct(substr(FECHA_REMESA, 1,4)) as A' + + 'NO'#10'from remesas_cliente'#10'order by 1 desc)'#10#10'UNION ALL'#10#10'select dist' + + 'inct '#39'Todos'#39' as ANO'#10'from empresas' + StatementType = stSQL + ColumnMappings = <> + end> + Name = 'ListaAnosRemesas' + Fields = < + item + Name = 'ANO' + DataType = datString + Size = 254 + BlobType = dabtUnknown + DisplayWidth = 0 + Alignment = taLeftJustify + InPrimaryKey = False + Calculated = False + Lookup = False + LookupCache = False + end> + BusinessRulesClient.ScriptLanguage = rslPascalScript + BusinessRulesServer.ScriptLanguage = rslPascalScript + end item Params = < item diff --git a/Source/Modulos/Remesas de cliente/Views/uEditorRemesasCliente.dfm b/Source/Modulos/Remesas de cliente/Views/uEditorRemesasCliente.dfm index f66d1d2f..b7563a19 100644 --- a/Source/Modulos/Remesas de cliente/Views/uEditorRemesasCliente.dfm +++ b/Source/Modulos/Remesas de cliente/Views/uEditorRemesasCliente.dfm @@ -50,7 +50,16 @@ inherited fEditorRemesasCliente: TfEditorRemesasCliente end end inherited tbxFiltro: TTBXToolbar - ExplicitWidth = 269 + ExplicitWidth = 363 + inherited lblAno: TTBXLabelItem + Visible = True + end + inherited cbxListaAnos: TTBXComboBoxItem + Visible = True + end + inherited sepAno: TTBXSeparatorItem + Visible = True + end inherited tbxEditFiltro: TTBXEditItem EditOptions = [tboUseEditWhenVertical] end @@ -68,9 +77,9 @@ inherited fEditorRemesasCliente: TfEditorRemesasCliente end end inherited TBXTMain2: TTBXToolbar - Left = 269 + Left = 363 DockPos = 267 - ExplicitLeft = 269 + ExplicitLeft = 363 end end inherited StatusBar: TJvStatusBar diff --git a/Source/Modulos/Remesas de cliente/Views/uEditorRemesasCliente.pas b/Source/Modulos/Remesas de cliente/Views/uEditorRemesasCliente.pas index d1e663a4..92bda386 100644 --- a/Source/Modulos/Remesas de cliente/Views/uEditorRemesasCliente.pas +++ b/Source/Modulos/Remesas de cliente/Views/uEditorRemesasCliente.pas @@ -28,12 +28,15 @@ type procedure FormShow(Sender: TObject); procedure actVolcarDiscoExecute(Sender: TObject); procedure actVolcarDiscoUpdate(Sender: TObject); + procedure OnListaAnosChange(Sender: TObject; const Text: string); + private FRemesasCliente: IBizRemesaCliente; FController : IRemesasClienteController; protected function GetRemesasCliente: IBizRemesaCliente; procedure SetRemesasCliente(const Value: IBizRemesaCliente); + function GetController : IRemesasClienteController; virtual; procedure SetController (const Value : IRemesasClienteController); virtual; @@ -42,7 +45,7 @@ type procedure ModificarInterno; override; procedure PrevisualizarInterno; override; procedure ImprimirInterno; override; - + procedure RefrescarInterno; override; //Si queremos crear otra vista para el editor heredado solo tendriamos que //sobreescribir este metodo @@ -72,6 +75,8 @@ uses } procedure TfEditorRemesasCliente.FormShow(Sender: TObject); begin + cbxListaAnos.OnChange := OnListaAnosChange; //OJO SIEMPRE ANTES DEL INHERITED + inherited; if not Assigned(ViewGrid) then @@ -149,6 +154,13 @@ begin FController.Ver(RemesasCliente); end; +procedure TfEditorRemesasCliente.OnListaAnosChange(Sender: TObject; const Text: string); +begin + Controller.FiltrarAno(RemesasCliente, WhereDataTable, Text); + if RemesasCliente.DataTable.Active then + RefrescarInterno; +end; + procedure TfEditorRemesasCliente.PonerTitulos(const ATitulo: string); var FTitulo : String; @@ -198,17 +210,37 @@ begin end; end; +procedure TfEditorRemesasCliente.RefrescarInterno; +begin + //Volvemos a cargar los años de las facturas + if Assigned(FController) then + ListaAnos := FController.DarListaAnosRemesas; + + inherited; +end; + procedure TfEditorRemesasCliente.SetRemesasCliente(const Value: IBizRemesaCliente); begin FRemesasCliente := Value; - dsDataTable.DataTable := FRemesasCliente.DataTable; - if Assigned(ViewGrid) then - (ViewGrid as IViewRemesasCliente).RemesasCliente := RemesasCliente; + + if Assigned(FRemesasCliente) then + begin + //Se guarda el where de la sentencia origen, por si el editor tiene filtros que + //afecten a este where y en un futuro se desea volver al where origen (filtro de año)) + WhereDataTable := FRemesasCliente.DataTable.Where.Clause; + + dsDataTable.DataTable := FRemesasCliente.DataTable; + if Assigned(ViewGrid) then + (ViewGrid as IViewRemesasCliente).RemesasCliente := RemesasCliente; + end; end; procedure TfEditorRemesasCliente.SetController(const Value: IRemesasClienteController); begin FController := Value; + + if Assigned(FController) then + ListaAnos := FController.DarListaAnosRemesas; end; destructor TfEditorRemesasCliente.Destroy; diff --git a/Source/Modulos/Remesas de proveedor/Controller/uRemesasProveedorController.pas b/Source/Modulos/Remesas de proveedor/Controller/uRemesasProveedorController.pas index 1f6b158b..b9956a9a 100644 --- a/Source/Modulos/Remesas de proveedor/Controller/uRemesasProveedorController.pas +++ b/Source/Modulos/Remesas de proveedor/Controller/uRemesasProveedorController.pas @@ -35,6 +35,9 @@ type procedure RecuperarRecibos(ARemesaProveedor: IBizRemesaProveedor); function ExtraerSeleccionados(ARemesasProveedor: IBizRemesaProveedor; Const ViewGrid: IViewGridBase = Nil) : IBizRemesaProveedor; + + function DarListaAnosRemesas: TStringList; + procedure FiltrarAno(ARemesa: IBizRemesaProveedor; AWhereDataTable: String; const Ano: String); end; TRemesasProveedorController = class(TObservador, IRemesasProveedorController) @@ -81,6 +84,9 @@ type function ExtraerSeleccionados(ARemesasProveedor: IBizRemesaProveedor; Const ViewGrid: IViewGridBase = Nil) : IBizRemesaProveedor; virtual; function ElegirRecibosProveedor(ARemesaProveedor : IBizRemesaProveedor): Boolean; procedure EliminarReciboProveedor(ARemesaProveedor : IBizRemesaProveedor); + + function DarListaAnosRemesas: TStringList; + procedure FiltrarAno(ARemesa: IBizRemesaProveedor; AWhereDataTable: String; const Ano: String); end; implementation @@ -162,6 +168,11 @@ begin Result := Supports(EditorRegistry.CreateEditor(AName), IID, Intf); end; +function TRemesasProveedorController.DarListaAnosRemesas: TStringList; +begin + Result := FDataModule.GetAnosItems; +end; + procedure TRemesasProveedorController.DescartarCambios(ARemesaProveedor: IBizRemesaProveedor); begin if not Assigned(ARemesaProveedor) then @@ -467,6 +478,31 @@ begin end; end; +procedure TRemesasProveedorController.FiltrarAno(ARemesa: IBizRemesaProveedor; AWhereDataTable: String; const Ano: String); +var + FechaIni: String; + FechaFin: String; + +begin + ARemesa.DataTable.Where.Clear; + ARemesa.DataTable.Where.AddText(AWhereDataTable); + + if (Ano <> 'Todos') then + begin + // Filtrar las remesas actuales por empresa + FechaIni := '01.01.' + Ano; + FechaFin := '31.12.' + Ano; + with ARemesa.DataTable.Where do + begin + if NotEmpty then + AddOperator(opAND); + AddCondition(fld_RemesasProveedorFECHA_REMESA, cMajorOrEqual, FechaIni); + AddOperator(opAND); + AddCondition(fld_RemesasProveedorFECHA_REMESA, cLessOrEqual, FechaFin); + end; + end; +end; + procedure TRemesasProveedorController.FiltrarEmpresa(ARemesaProveedor: IBizRemesaProveedor); begin if ARemesaProveedor.DataTable.Active then diff --git a/Source/Modulos/Remesas de proveedor/Data/uDataModuleRemesasProveedor.dfm b/Source/Modulos/Remesas de proveedor/Data/uDataModuleRemesasProveedor.dfm index 4e14af74..e3349859 100644 --- a/Source/Modulos/Remesas de proveedor/Data/uDataModuleRemesasProveedor.dfm +++ b/Source/Modulos/Remesas de proveedor/Data/uDataModuleRemesasProveedor.dfm @@ -421,4 +421,113 @@ object DataModuleRemesasProveedor: TDataModuleRemesasProveedor Left = 272 Top = 96 end + object tbl_ListaAnosRemesas: TDACDSDataTable + RemoteUpdatesOptions = [] + Fields = < + item + Name = 'ANO' + DataType = datString + Size = 254 + BlobType = dabtUnknown + DisplayWidth = 0 + Alignment = taLeftJustify + InPrimaryKey = False + Calculated = False + Lookup = False + LookupCache = False + end> + Params = <> + MasterMappingMode = mmDataRequest + StreamingOptions = [soDisableEventsWhileStreaming] + SchemaCall.MethodName = 'GetDatasetSchema' + SchemaCall.Params = < + item + Name = 'Result' + ParamType = fResult + DataType = rtBinary + end + item + Name = 'aDatasetName' + ParamType = fIn + DataType = rtString + Value = 'ListaAnosRemesas' + end> + DataRequestCall.MethodName = 'GetDatasetDataEx' + DataRequestCall.Params = < + item + Name = 'Result' + ParamType = fResult + DataType = rtBinary + end + item + Name = 'DatasetName' + ParamType = fIn + DataType = rtString + Value = 'ListaAnosRemesas' + end + item + Name = 'Params' + ParamType = fIn + DataType = rtUserDefined + UserClassName = 'TDADatasetParamArray' + end + item + Name = 'UserFilter' + ParamType = fIn + DataType = rtString + Value = '' + end + item + Name = 'IncludeSchema' + ParamType = fIn + DataType = rtBoolean + Value = False + end + item + Name = 'MaxRecords' + ParamType = fIn + DataType = rtInteger + Value = -1 + end> + DataUpdateCall.MethodName = 'UpdateData' + DataUpdateCall.Params = < + item + Name = 'Result' + ParamType = fResult + DataType = rtBinary + end + item + Name = 'Delta' + ParamType = fIn + DataType = rtBinary + end> + ScriptCall.MethodName = 'GetDatasetScripts' + ScriptCall.Params = < + item + Name = 'Result' + ParamType = fResult + DataType = rtString + Value = '' + end + item + Name = 'DatasetNames' + ParamType = fIn + DataType = rtString + Value = 'ListaAnosRemesas' + end> + ReadOnly = False + RemoteService = RORemoteService + Adapter = DABinAdapter + DetailOptions = [dtCascadeOpenClose, dtCascadeApplyUpdates, dtAutoFetch, dtCascadeDelete, dtCascadeUpdate, dtDisableLogOfCascadeDeletes, dtDisableLogOfCascadeUpdates, dtIncludeInAllInOneFetch] + MasterOptions = [moCascadeOpenClose, moCascadeApplyUpdates, moCascadeDelete, moCascadeUpdate, moDisableLogOfCascadeDeletes, moDisableLogOfCascadeUpdates] + LogicalName = 'ListaAnosRemesas' + IndexDefs = <> + Left = 152 + Top = 160 + end + object ds_ListaAnosRemesas: TDADataSource + DataTable = tbl_ListaAnosRemesas + Left = 152 + Top = 96 + end end diff --git a/Source/Modulos/Remesas de proveedor/Data/uDataModuleRemesasProveedor.pas b/Source/Modulos/Remesas de proveedor/Data/uDataModuleRemesasProveedor.pas index e067e672..6d0529a9 100644 --- a/Source/Modulos/Remesas de proveedor/Data/uDataModuleRemesasProveedor.pas +++ b/Source/Modulos/Remesas de proveedor/Data/uDataModuleRemesasProveedor.pas @@ -19,6 +19,8 @@ type ROBinMessage1: TROBinMessage; tbl_RemesasProveedor: TDACDSDataTable; ds_RemesasProveedor: TDADataSource; + tbl_ListaAnosRemesas: TDACDSDataTable; + ds_ListaAnosRemesas: TDADataSource; procedure DAClientDataModuleCreate(Sender: TObject); protected @@ -33,6 +35,8 @@ type // Report function GetReport(const ID: String): Binary; + + function GetAnosItems : TStringList; end; implementation @@ -91,6 +95,30 @@ begin CloneDataTable(ADataTable, Result); end; +function TDataModuleRemesasProveedor.GetAnosItems: TStringList; +var + AListaAnos: TStringList; +begin + AListaAnos := TStringList.Create; + ShowHourglassCursor; + try + with tbl_ListaAnosRemesas do + begin + Open; + First; + while not eof do + begin + AListaAnos.Add(Format('%s=%s', [Fields[0].AsString, Fields[0].AsString])); + Next; + end; + Close; + end; + Result := AListaAnos; + finally + HideHourglassCursor; + end; +end; + function TDataModuleRemesasProveedor.GetItem(const ID: Integer): IBizRemesaProveedor; begin ShowHourglassCursor; diff --git a/Source/Modulos/Remesas de proveedor/Model/Data/uIDataModuleRemesasProveedor.pas b/Source/Modulos/Remesas de proveedor/Model/Data/uIDataModuleRemesasProveedor.pas index c21c96fc..1a318b59 100644 --- a/Source/Modulos/Remesas de proveedor/Model/Data/uIDataModuleRemesasProveedor.pas +++ b/Source/Modulos/Remesas de proveedor/Model/Data/uIDataModuleRemesasProveedor.pas @@ -3,11 +3,12 @@ unit uIDataModuleRemesasProveedor; interface uses - uBizRemesasProveedor; + Classes, uBizRemesasProveedor; type IDataModuleRemesasProveedor = interface ['{6073E44A-0B61-4D26-BCDE-33150D88C91B}'] + function GetAnosItems : TStringList; function GetItems: IBizRemesaProveedor; function GetItem(const ID : Integer) : IBizRemesaProveedor; function GetNextID(const DataSetName : String) : Integer; diff --git a/Source/Modulos/Remesas de proveedor/Model/schRemesasProveedorClient_Intf.pas b/Source/Modulos/Remesas de proveedor/Model/schRemesasProveedorClient_Intf.pas index 1234e9f8..73698fbe 100644 --- a/Source/Modulos/Remesas de proveedor/Model/schRemesasProveedorClient_Intf.pas +++ b/Source/Modulos/Remesas de proveedor/Model/schRemesasProveedorClient_Intf.pas @@ -9,15 +9,23 @@ const { Data table rules ids Feel free to change them to something more human readable but make sure they are unique in the context of your application } - RID_darReferencia = '{C46DD694-0C93-4DC1-806C-761CB55A3E78}'; - RID_RemesasProveedor = '{D4F4C043-452C-4C78-AC2A-2BFED8440BB3}'; - RID_RemesasProveedor_Refresh = '{423CFB65-3863-4ADA-B9B3-318A7C13A13D}'; + RID_ListaAnosRemesas = '{25DE85B4-DA4E-4DA7-ACC0-960EC1B035C5}'; + RID_darReferencia = '{5181C1C2-7262-4AE3-8F53-785C9B2333EE}'; + RID_RemesasProveedor = '{45E53708-C9B3-493F-A7E5-07E44D1E3B40}'; + RID_RemesasProveedor_Refresh = '{CD0FFFE0-5E3E-437B-83A9-D5AFAEB972DE}'; { Data table names } + nme_ListaAnosRemesas = 'ListaAnosRemesas'; nme_darReferencia = 'darReferencia'; nme_RemesasProveedor = 'RemesasProveedor'; nme_RemesasProveedor_Refresh = 'RemesasProveedor_Refresh'; + { ListaAnosRemesas fields } + fld_ListaAnosRemesasANO = 'ANO'; + + { ListaAnosRemesas field indexes } + idx_ListaAnosRemesasANO = 0; + { darReferencia fields } fld_darReferenciaVALOR = 'VALOR'; @@ -109,9 +117,38 @@ const idx_RemesasProveedor_RefreshSUFIJO_N58 = 18; type + { IListaAnosRemesas } + IListaAnosRemesas = interface(IDAStronglyTypedDataTable) + ['{C6918980-686B-43C9-ADD9-24F2869D2548}'] + { Property getters and setters } + function GetANOValue: String; + procedure SetANOValue(const aValue: String); + + + { Properties } + property ANO: String read GetANOValue write SetANOValue; + end; + + { TListaAnosRemesasDataTableRules } + TListaAnosRemesasDataTableRules = class(TDADataTableRules, IListaAnosRemesas) + private + protected + { Property getters and setters } + function GetANOValue: String; virtual; + procedure SetANOValue(const aValue: String); virtual; + + { Properties } + property ANO: String read GetANOValue write SetANOValue; + + public + constructor Create(aDataTable: TDADataTable); override; + destructor Destroy; override; + + end; + { IdarReferencia } IdarReferencia = interface(IDAStronglyTypedDataTable) - ['{BCC59268-E9D7-4AFD-8FED-205F17C495DC}'] + ['{58F7E4B9-122E-4B0E-A8FC-2250E8DFE0F3}'] { Property getters and setters } function GetVALORValue: String; procedure SetVALORValue(const aValue: String); @@ -140,7 +177,7 @@ type { IRemesasProveedor } IRemesasProveedor = interface(IDAStronglyTypedDataTable) - ['{1EC2C43E-91B7-4DB1-B5B8-DA5D4F579C1E}'] + ['{12BC2EC9-3D9C-40C6-A8C6-81808D261864}'] { Property getters and setters } function GetIDValue: Integer; procedure SetIDValue(const aValue: Integer); @@ -277,7 +314,7 @@ type { IRemesasProveedor_Refresh } IRemesasProveedor_Refresh = interface(IDAStronglyTypedDataTable) - ['{2A8FF214-38C0-48F1-B20F-952E755DDCF9}'] + ['{43F4455C-1139-452D-8D91-7B9011C927E1}'] { Property getters and setters } function GetIDValue: Integer; procedure SetIDValue(const aValue: Integer); @@ -416,6 +453,28 @@ implementation uses Variants; +{ TListaAnosRemesasDataTableRules } +constructor TListaAnosRemesasDataTableRules.Create(aDataTable: TDADataTable); +begin + inherited; +end; + +destructor TListaAnosRemesasDataTableRules.Destroy; +begin + inherited; +end; + +function TListaAnosRemesasDataTableRules.GetANOValue: String; +begin + result := DataTable.Fields[idx_ListaAnosRemesasANO].AsString; +end; + +procedure TListaAnosRemesasDataTableRules.SetANOValue(const aValue: String); +begin + DataTable.Fields[idx_ListaAnosRemesasANO].AsString := aValue; +end; + + { TdarReferenciaDataTableRules } constructor TdarReferenciaDataTableRules.Create(aDataTable: TDADataTable); begin @@ -843,6 +902,7 @@ end; initialization + RegisterDataTableRules(RID_ListaAnosRemesas, TListaAnosRemesasDataTableRules); RegisterDataTableRules(RID_darReferencia, TdarReferenciaDataTableRules); RegisterDataTableRules(RID_RemesasProveedor, TRemesasProveedorDataTableRules); RegisterDataTableRules(RID_RemesasProveedor_Refresh, TRemesasProveedor_RefreshDataTableRules); diff --git a/Source/Modulos/Remesas de proveedor/Model/schRemesasProveedorServer_Intf.pas b/Source/Modulos/Remesas de proveedor/Model/schRemesasProveedorServer_Intf.pas index 4913526b..290a1a95 100644 --- a/Source/Modulos/Remesas de proveedor/Model/schRemesasProveedorServer_Intf.pas +++ b/Source/Modulos/Remesas de proveedor/Model/schRemesasProveedorServer_Intf.pas @@ -9,14 +9,44 @@ const { Delta rules ids Feel free to change them to something more human readable but make sure they are unique in the context of your application } - RID_darReferenciaDelta = '{144B45A9-6550-4495-B484-6F00D72EE60B}'; - RID_RemesasProveedorDelta = '{0847F13C-BE25-4D9C-900C-846F8E6879E1}'; - RID_RemesasProveedor_RefreshDelta = '{37A3A546-CFF5-4D40-A35B-5E2544E59472}'; + RID_ListaAnosRemesasDelta = '{332B5E0D-C5DD-41C5-A1FD-CD4D650B98C3}'; + RID_darReferenciaDelta = '{13C48250-38D1-4E4D-B718-17A1F1067E24}'; + RID_RemesasProveedorDelta = '{04481F3E-D933-4486-A71F-E0CDEADFB4B1}'; + RID_RemesasProveedor_RefreshDelta = '{BC664756-CB71-4EE1-8F61-56371F5B8D7F}'; type + { IListaAnosRemesasDelta } + IListaAnosRemesasDelta = interface(IListaAnosRemesas) + ['{332B5E0D-C5DD-41C5-A1FD-CD4D650B98C3}'] + { Property getters and setters } + function GetOldANOValue : String; + + { Properties } + property OldANO : String read GetOldANOValue; + end; + + { TListaAnosRemesasBusinessProcessorRules } + TListaAnosRemesasBusinessProcessorRules = class(TDABusinessProcessorRules, IListaAnosRemesas, IListaAnosRemesasDelta) + private + protected + { Property getters and setters } + function GetANOValue: String; virtual; + function GetOldANOValue: String; virtual; + procedure SetANOValue(const aValue: String); virtual; + + { Properties } + property ANO : String read GetANOValue write SetANOValue; + property OldANO : String read GetOldANOValue; + + public + constructor Create(aBusinessProcessor: TDABusinessProcessor); override; + destructor Destroy; override; + + end; + { IdarReferenciaDelta } IdarReferenciaDelta = interface(IdarReferencia) - ['{144B45A9-6550-4495-B484-6F00D72EE60B}'] + ['{13C48250-38D1-4E4D-B718-17A1F1067E24}'] { Property getters and setters } function GetOldVALORValue : String; @@ -45,7 +75,7 @@ type { IRemesasProveedorDelta } IRemesasProveedorDelta = interface(IRemesasProveedor) - ['{0847F13C-BE25-4D9C-900C-846F8E6879E1}'] + ['{04481F3E-D933-4486-A71F-E0CDEADFB4B1}'] { Property getters and setters } function GetOldIDValue : Integer; function GetOldID_EMPRESAValue : Integer; @@ -200,7 +230,7 @@ type { IRemesasProveedor_RefreshDelta } IRemesasProveedor_RefreshDelta = interface(IRemesasProveedor_Refresh) - ['{37A3A546-CFF5-4D40-A35B-5E2544E59472}'] + ['{BC664756-CB71-4EE1-8F61-56371F5B8D7F}'] { Property getters and setters } function GetOldIDValue : Integer; function GetOldID_EMPRESAValue : Integer; @@ -358,6 +388,33 @@ implementation uses Variants, uROBinaryHelpers; +{ TListaAnosRemesasBusinessProcessorRules } +constructor TListaAnosRemesasBusinessProcessorRules.Create(aBusinessProcessor: TDABusinessProcessor); +begin + inherited; +end; + +destructor TListaAnosRemesasBusinessProcessorRules.Destroy; +begin + inherited; +end; + +function TListaAnosRemesasBusinessProcessorRules.GetANOValue: String; +begin + result := BusinessProcessor.CurrentChange.NewValueByName[fld_ListaAnosRemesasANO]; +end; + +function TListaAnosRemesasBusinessProcessorRules.GetOldANOValue: String; +begin + result := BusinessProcessor.CurrentChange.OldValueByName[fld_ListaAnosRemesasANO]; +end; + +procedure TListaAnosRemesasBusinessProcessorRules.SetANOValue(const aValue: String); +begin + BusinessProcessor.CurrentChange.NewValueByName[fld_ListaAnosRemesasANO] := aValue; +end; + + { TdarReferenciaBusinessProcessorRules } constructor TdarReferenciaBusinessProcessorRules.Create(aBusinessProcessor: TDABusinessProcessor); begin @@ -980,6 +1037,7 @@ end; initialization + RegisterBusinessProcessorRules(RID_ListaAnosRemesasDelta, TListaAnosRemesasBusinessProcessorRules); RegisterBusinessProcessorRules(RID_darReferenciaDelta, TdarReferenciaBusinessProcessorRules); RegisterBusinessProcessorRules(RID_RemesasProveedorDelta, TRemesasProveedorBusinessProcessorRules); RegisterBusinessProcessorRules(RID_RemesasProveedor_RefreshDelta, TRemesasProveedor_RefreshBusinessProcessorRules); diff --git a/Source/Modulos/Remesas de proveedor/Servidor/srvRemesasProveedor_Impl.dfm b/Source/Modulos/Remesas de proveedor/Servidor/srvRemesasProveedor_Impl.dfm index 98616534..a71ec5c7 100644 --- a/Source/Modulos/Remesas de proveedor/Servidor/srvRemesasProveedor_Impl.dfm +++ b/Source/Modulos/Remesas de proveedor/Servidor/srvRemesasProveedor_Impl.dfm @@ -190,6 +190,35 @@ object srvRemesasProveedor: TsrvRemesasProveedor DataDictionary = DataDictionary Diagrams = Diagrams Datasets = < + item + Params = <> + Statements = < + item + Connection = 'IBX' + SQL = + 'select ANO from'#10'(select distinct(substr(FECHA_REMESA, 1,4)) as A' + + 'NO'#10'from remesas_proveedor'#10'order by 1 desc)'#10#10'UNION ALL'#10#10'select di' + + 'stinct '#39'Todos'#39' as ANO'#10'from empresas' + StatementType = stSQL + ColumnMappings = <> + end> + Name = 'ListaAnosRemesas' + Fields = < + item + Name = 'ANO' + DataType = datString + Size = 254 + BlobType = dabtUnknown + DisplayWidth = 0 + Alignment = taLeftJustify + InPrimaryKey = False + Calculated = False + Lookup = False + LookupCache = False + end> + BusinessRulesClient.ScriptLanguage = rslPascalScript + BusinessRulesServer.ScriptLanguage = rslPascalScript + end item Params = < item diff --git a/Source/Modulos/Remesas de proveedor/Views/uEditorRemesasProveedor.dfm b/Source/Modulos/Remesas de proveedor/Views/uEditorRemesasProveedor.dfm index 3721f86f..2070545e 100644 --- a/Source/Modulos/Remesas de proveedor/Views/uEditorRemesasProveedor.dfm +++ b/Source/Modulos/Remesas de proveedor/Views/uEditorRemesasProveedor.dfm @@ -4,7 +4,6 @@ inherited fEditorRemesasProveedor: TfEditorRemesasProveedor Caption = 'Lista de remesas de pago' ClientWidth = 820 ExplicitWidth = 828 - ExplicitHeight = 240 PixelsPerInch = 96 TextHeight = 13 inherited JvNavPanelHeader: TJvNavPanelHeader @@ -49,7 +48,16 @@ inherited fEditorRemesasProveedor: TfEditorRemesasProveedor end end inherited tbxFiltro: TTBXToolbar - ExplicitWidth = 269 + ExplicitWidth = 363 + inherited lblAno: TTBXLabelItem + Visible = True + end + inherited cbxListaAnos: TTBXComboBoxItem + Visible = True + end + inherited sepAno: TTBXSeparatorItem + Visible = True + end inherited tbxEditFiltro: TTBXEditItem EditOptions = [tboUseEditWhenVertical] end @@ -67,8 +75,8 @@ inherited fEditorRemesasProveedor: TfEditorRemesasProveedor end end inherited TBXTMain2: TTBXToolbar - Left = 334 - ExplicitLeft = 334 + Left = 363 + ExplicitLeft = 363 end end inherited StatusBar: TJvStatusBar diff --git a/Source/Modulos/Remesas de proveedor/Views/uEditorRemesasProveedor.pas b/Source/Modulos/Remesas de proveedor/Views/uEditorRemesasProveedor.pas index 0ed71018..b691b90d 100644 --- a/Source/Modulos/Remesas de proveedor/Views/uEditorRemesasProveedor.pas +++ b/Source/Modulos/Remesas de proveedor/Views/uEditorRemesasProveedor.pas @@ -28,12 +28,16 @@ type procedure FormShow(Sender: TObject); procedure actVolcarDiscoExecute(Sender: TObject); procedure actVolcarDiscoUpdate(Sender: TObject); + procedure OnListaAnosChange(Sender: TObject; const Text: string); + private FRemesasProveedor: IBizRemesaProveedor; FController : IRemesasProveedorController; + protected function GetRemesasProveedor: IBizRemesaProveedor; procedure SetRemesasProveedor(const Value: IBizRemesaProveedor); + function GetController : IRemesasProveedorController; virtual; procedure SetController (const Value : IRemesasProveedorController); virtual; @@ -42,7 +46,7 @@ type procedure ModificarInterno; override; procedure PrevisualizarInterno; override; procedure ImprimirInterno; override; - + procedure RefrescarInterno; override; //Si queremos crear otra vista para el editor heredado solo tendriamos que //sobreescribir este metodo @@ -72,6 +76,8 @@ uses } procedure TfEditorRemesasProveedor.FormShow(Sender: TObject); begin + cbxListaAnos.OnChange := OnListaAnosChange; //OJO SIEMPRE ANTES DEL INHERITED + inherited; if not Assigned(ViewGrid) then @@ -149,6 +155,13 @@ begin FController.Ver(RemesasProveedor); end; +procedure TfEditorRemesasProveedor.OnListaAnosChange(Sender: TObject; const Text: string); +begin + Controller.FiltrarAno(RemesasProveedor, WhereDataTable, Text); + if RemesasProveedor.DataTable.Active then + RefrescarInterno; +end; + procedure TfEditorRemesasProveedor.PonerTitulos(const ATitulo: string); var FTitulo : String; @@ -198,17 +211,37 @@ begin end; end; +procedure TfEditorRemesasProveedor.RefrescarInterno; +begin + //Volvemos a cargar los años de las remesas + if Assigned(FController) then + ListaAnos := FController.DarListaAnosRemesas; + + inherited; +end; + procedure TfEditorRemesasProveedor.SetRemesasProveedor(const Value: IBizRemesaProveedor); begin FRemesasProveedor := Value; - dsDataTable.DataTable := FRemesasProveedor.DataTable; - if Assigned(ViewGrid) then - (ViewGrid as IViewRemesasProveedor).RemesasProveedor := RemesasProveedor; + + if Assigned(FRemesasProveedor) then + begin + //Se guarda el where de la sentencia origen, por si el editor tiene filtros que + //afecten a este where y en un futuro se desea volver al where origen (filtro de año)) + WhereDataTable := FRemesasProveedor.DataTable.Where.Clause; + + dsDataTable.DataTable := FRemesasProveedor.DataTable; + if Assigned(ViewGrid) then + (ViewGrid as IViewRemesasProveedor).RemesasProveedor := RemesasProveedor; + end; end; procedure TfEditorRemesasProveedor.SetController(const Value: IRemesasProveedorController); begin FController := Value; + + if Assigned(FController) then + ListaAnos := FController.DarListaAnosRemesas; end; destructor TfEditorRemesasProveedor.Destroy; diff --git a/Source/Servidor/FactuGES_Server.bdsproj b/Source/Servidor/FactuGES_Server.bdsproj index 3b2982ce..826c1dd2 100644 --- a/Source/Servidor/FactuGES_Server.bdsproj +++ b/Source/Servidor/FactuGES_Server.bdsproj @@ -183,7 +183,7 @@ False