diff --git a/Source/Base/Base.dproj b/Source/Base/Base.dproj index 20b5c514..1236be43 100644 --- a/Source/Base/Base.dproj +++ b/Source/Base/Base.dproj @@ -53,58 +53,58 @@ MainSource + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
fConfigurarConexion
TForm diff --git a/Source/Cliente/FactuGES.dpr b/Source/Cliente/FactuGES.dpr index c094c23d..906bce24 100644 --- a/Source/Cliente/FactuGES.dpr +++ b/Source/Cliente/FactuGES.dpr @@ -2,7 +2,6 @@ program FactuGES; uses // ExceptionLog, - ExceptionLog, Forms, Windows, SysUtils, diff --git a/Source/Cliente/FactuGES.dproj b/Source/Cliente/FactuGES.dproj index 8d49b2b8..5d963ed0 100644 --- a/Source/Cliente/FactuGES.dproj +++ b/Source/Cliente/FactuGES.dproj @@ -55,30 +55,6 @@ VCLApplication FalseTrueFalseC:\Archivos de programa\Borland\Delphi7\Bin\TrueFalse1430FalseFalseFalseFalseFalse30821252Rodax Software S.L.1.4.3.0FactuGESFactuGES1.4.3.0 - - - - - - - - - - - - - - - - - - - - - - - - ExpressPrinting System by Developer Express Inc. PluginSDK for Delphi 10 (Runtime) Microsoft Office 2000 Sample Automation Server Wrapper Components diff --git a/Source/Modulos/Almacenes/Controller/uAlmacenesController.pas b/Source/Modulos/Almacenes/Controller/uAlmacenesController.pas index 4c1eb1a8..0b8eb242 100644 --- a/Source/Modulos/Almacenes/Controller/uAlmacenesController.pas +++ b/Source/Modulos/Almacenes/Controller/uAlmacenesController.pas @@ -138,7 +138,7 @@ function TAlmacenesController.DarListaAlmacenes: TStringList; begin ShowHourglassCursor; try - Result := FDataModule.DarListaAlmacenes; + Result := FDataModule.DarListaAlmacenes(AppFactuGES.EmpresaActiva.ID); finally HideHourglassCursor; end; diff --git a/Source/Modulos/Almacenes/Data/uDataModuleAlmacenes.pas b/Source/Modulos/Almacenes/Data/uDataModuleAlmacenes.pas index 99930219..e9b1f435 100644 --- a/Source/Modulos/Almacenes/Data/uDataModuleAlmacenes.pas +++ b/Source/Modulos/Almacenes/Data/uDataModuleAlmacenes.pas @@ -27,7 +27,7 @@ type function GetItems : IBizAlmacen; function GetItem(const ID : Integer) : IBizAlmacen; function NewItem : IBizAlmacen; - function DarListaAlmacenes : TStringList; + function DarListaAlmacenes(const IDEmpresa: Integer): TStringList; end; implementation @@ -51,11 +51,11 @@ begin RORemoteService.Message := dmConexion.Message; end; -function TDataModuleAlmacenes.DarListaAlmacenes: TStringList; +function TDataModuleAlmacenes.DarListaAlmacenes(const IDEmpresa: Integer): TStringList; var ABinary : Binary; begin - ABinary := (RORemoteService as IsrvAlmacenes).DarListaAlmacenes; + ABinary := (RORemoteService as IsrvAlmacenes).DarListaAlmacenes(IDEmpresa); Result := TStringList.Create; Result.LoadFromStream(ABinary); end; diff --git a/Source/Modulos/Almacenes/Model/Data/uIDataModuleAlmacenes.pas b/Source/Modulos/Almacenes/Model/Data/uIDataModuleAlmacenes.pas index a64dddee..9ecfaafd 100644 --- a/Source/Modulos/Almacenes/Model/Data/uIDataModuleAlmacenes.pas +++ b/Source/Modulos/Almacenes/Model/Data/uIDataModuleAlmacenes.pas @@ -11,7 +11,7 @@ type function GetItems: IBizAlmacen; function GetItem(const ID : Integer) : IBizAlmacen; function NewItem : IBizAlmacen; - function DarListaAlmacenes : TStringList; + function DarListaAlmacenes(const IDEmpresa: Integer): TStringList; end; implementation diff --git a/Source/Modulos/Almacenes/Servidor/srvAlmacenes_Impl.dfm b/Source/Modulos/Almacenes/Servidor/srvAlmacenes_Impl.dfm index 2bdaf2c8..017401f9 100644 --- a/Source/Modulos/Almacenes/Servidor/srvAlmacenes_Impl.dfm +++ b/Source/Modulos/Almacenes/Servidor/srvAlmacenes_Impl.dfm @@ -113,16 +113,22 @@ object srvAlmacenes: TsrvAlmacenes Diagrams = Diagrams Datasets = < item - Params = <> + Params = < + item + Name = 'ID_EMPRESA' + Value = '' + ParamType = daptInput + end> Statements = < item + Connection = 'IBX' ConnectionType = 'Interbase' Default = True TargetTable = 'ALMACENES' Name = 'IBX' SQL = 'Select ID, NOMBRE'#10'from ALMACENES'#10'where TIPO_ALMACEN = '#39'ALMACEN'#39#10 + - 'order by NOMBRE'#10#10 + 'and ID_EMPRESA = :ID_EMPRESA'#10'order by NOMBRE'#10#10 StatementType = stSQL ColumnMappings = < item diff --git a/Source/Modulos/Almacenes/Servidor/srvAlmacenes_Impl.pas b/Source/Modulos/Almacenes/Servidor/srvAlmacenes_Impl.pas index 5281af7b..0318a0e8 100644 --- a/Source/Modulos/Almacenes/Servidor/srvAlmacenes_Impl.pas +++ b/Source/Modulos/Almacenes/Servidor/srvAlmacenes_Impl.pas @@ -32,7 +32,7 @@ type procedure DataAbstractServiceBeforeAcquireConnection(aSender: TObject; var aConnectionName: string); protected - function DarListaAlmacenes: Binary; + function DarListaAlmacenes(const IDEmpresa: Integer): Binary; end; implementation @@ -66,7 +66,7 @@ begin SessionManager := dmServer.SessionManager; end; -function TsrvAlmacenes.DarListaAlmacenes: Binary; +function TsrvAlmacenes.DarListaAlmacenes(const IDEmpresa: Integer): Binary; var ASchema : TDASchema; AConn : IDAConnection; @@ -79,7 +79,7 @@ begin AConn := dmServer.ConnectionManager.NewConnection(dmServer.ConnectionManager.GetDefaultConnectionName); try - dsData := ASchema.NewDataset(AConn, 'ListaAlmacenes'); + dsData := ASchema.NewDataset(AConn, 'ListaAlmacenes', ['ID_EMPRESA'], [IntToStr(IDEmpresa)]); except RaiseError('No existe la tabla ALMACENES'); end; diff --git a/Source/Modulos/Inventario/Controller/View/uIEditorDetalleReservas.pas b/Source/Modulos/Inventario/Controller/View/uIEditorDetalleReservas.pas index ea7f29ae..906cd1ba 100644 --- a/Source/Modulos/Inventario/Controller/View/uIEditorDetalleReservas.pas +++ b/Source/Modulos/Inventario/Controller/View/uIEditorDetalleReservas.pas @@ -8,6 +8,10 @@ uses type IEditorDetalleReservas = interface(IEditorGridBase) ['{EE301C2F-98DC-49CD-B7EA-D29D0B9326D8}'] + function GetTipoReservas: String; + procedure SetTipoReservas(const Value: String); + property TipoReservas: String read GetTipoReservas write SetTipoReservas; + function GetController : IInventarioController; procedure SetController (const Value : IInventarioController); property Controller : IInventarioController read GetController write SetController; diff --git a/Source/Modulos/Inventario/Controller/uInventarioController.pas b/Source/Modulos/Inventario/Controller/uInventarioController.pas index e4b1fe50..f7b6615f 100644 --- a/Source/Modulos/Inventario/Controller/uInventarioController.pas +++ b/Source/Modulos/Inventario/Controller/uInventarioController.pas @@ -22,7 +22,7 @@ type function Ver(AArticulos: IBizInventario; AInventario : IBizInventario; APedido: IBizPedidoProveedor = Nil): Boolean; procedure VerTodos(AInventario: IBizInventario; const pTipoInventario: String); - procedure VerReservas(AArticulo: IBizInventario); + procedure VerReservas(AArticulo: IBizInventario; const ATipoReservas: String); function BuscarTodos: IBizInventario; function BuscarTodosAlmacenes: IBizInventario; @@ -138,7 +138,7 @@ type procedure VerTodos(AInventario: IBizInventario; const pTipoInventario: String); function Ver(AArticulos: IBizInventario; AInventario : IBizInventario; APedido: IBizPedidoProveedor = Nil): Boolean; - procedure VerReservas(AArticulo: IBizInventario); + procedure VerReservas(AArticulo: IBizInventario; const ATipoReservas: String); function Guardar(AArticulos : IBizInventario; const FechaMovimiento: TDateTime; const CausaMovimiento: String; AValidar:Boolean = True): Boolean; @@ -553,7 +553,7 @@ begin end; end; -procedure TInventarioController.VerReservas(AArticulo: IBizInventario); +procedure TInventarioController.VerReservas(AArticulo: IBizInventario; const ATipoReservas: String); var AEditor : IEditorDetalleReservas; begin @@ -565,6 +565,7 @@ begin with AEditor do begin Controller := Self; //OJO ORDEN MUY IMPORTANTE + TipoReservas := ATipoReservas; DetalleReservas := FDataModule.GetDetalleReservas; Articulo := AArticulo; MultiSelect := True; diff --git a/Source/Modulos/Inventario/Inventario_Group.groupproj b/Source/Modulos/Inventario/Inventario_Group.groupproj index 73a1b288..58170cd9 100644 --- a/Source/Modulos/Inventario/Inventario_Group.groupproj +++ b/Source/Modulos/Inventario/Inventario_Group.groupproj @@ -170,15 +170,6 @@ - - - - - - - - - @@ -188,6 +179,15 @@ + + + + + + + + + @@ -252,13 +252,13 @@ - + - + - + \ No newline at end of file diff --git a/Source/Modulos/Inventario/Views/Inventario_view.res b/Source/Modulos/Inventario/Views/Inventario_view.res index 1641339f..8b251f31 100644 Binary files a/Source/Modulos/Inventario/Views/Inventario_view.res and b/Source/Modulos/Inventario/Views/Inventario_view.res differ diff --git a/Source/Modulos/Inventario/Views/uEditorDetalleReservas.dfm b/Source/Modulos/Inventario/Views/uEditorDetalleReservas.dfm index c6abfd12..c92ee603 100644 --- a/Source/Modulos/Inventario/Views/uEditorDetalleReservas.dfm +++ b/Source/Modulos/Inventario/Views/uEditorDetalleReservas.dfm @@ -122,7 +122,7 @@ inherited fEditorDetalleReservas: TfEditorDetalleReservas ExplicitHeight = 419 inherited cxGrid: TcxGrid Width = 669 - Height = 291 + Height = 250 ExplicitWidth = 669 ExplicitHeight = 291 inherited cxGridView: TcxGridDBTableView @@ -219,6 +219,12 @@ inherited fEditorDetalleReservas: TfEditorDetalleReservas end end end + inherited pnlAlmacenes: TPanel + Width = 669 + inherited cxListaAlmacenesObras: TcxComboBox + ExplicitWidth = 510 + end + end inherited dxComponentPrinter: TdxComponentPrinter inherited dxComponentPrinterLink: TdxGridReportLink ReportDocument.CreationDate = 39280.678861030090000000 diff --git a/Source/Modulos/Inventario/Views/uEditorDetalleReservas.pas b/Source/Modulos/Inventario/Views/uEditorDetalleReservas.pas index 1ba4ca64..54854672 100644 --- a/Source/Modulos/Inventario/Views/uEditorDetalleReservas.pas +++ b/Source/Modulos/Inventario/Views/uEditorDetalleReservas.pas @@ -12,7 +12,7 @@ uses uViewBase, uViewBarraSeleccion, JvComponentBase, uEditorGridBase, uIEditorDetalleReservas, uBizInventario, uViewGridBase, JvExComCtrls, JvStatusBar, uViewGrid2Niveles, JSDialog, uDAInterfaces, - uInventarioController; + uInventarioController, uEditorInventario; type @@ -31,10 +31,12 @@ type procedure actTrasladarReservadosExecute(Sender: TObject); private - function SeleccionarAlmacen(Descripcion: String): Integer; + function Seleccionar(Descripcion: String; TipoSeleccion: TEnumSeleccion): Variant; function DarIDAlmacenSeleccionado(Descripcion: String): Integer; + function DarIDObraSeleccionada(Descripcion: String): Integer; protected + FTipoReservas: String; FArticulo: IBizInventario; FDetalleReservas: IBizDetalleReservas; FController : IInventarioController; @@ -43,7 +45,8 @@ type procedure SetArticulo(const Value: IBizInventario); function GetDetalleReservas: IBizDetalleReservas; procedure SetDetalleReservas(const Value: IBizDetalleReservas); - + function GetTipoReservas: String; + procedure SetTipoReservas(const Value: String); function GetController : IInventarioController; virtual; procedure SetController (const Value : IInventarioController); virtual; @@ -58,6 +61,7 @@ type property Articulo: IBizInventario read GetArticulo write SetArticulo; property DetalleReservas: IBizDetalleReservas read GetDetalleReservas write SetDetalleReservas; property Controller : IInventarioController read GetController write SetController; + property TipoReservas: String read GetTipoReservas write SetTipoReservas; // property ArticulosSeleccionados: IBizDetalleReservas read GetArticulosSeleccionados; // property MultiSelect : Boolean read GetMultiSelect write SetMultiSelect; @@ -70,10 +74,10 @@ implementation {$R *.DFM} uses - cxControls, uGridStatusUtils, uDataModuleInventario, uDataModuleUsuarios, + cxControls, Variants, uGridStatusUtils, uDataModuleInventario, uDataModuleUsuarios, uEditorBase, uDBSelectionListUtils, cxGridDBTableView, cxGridCustomTableView, uAlmacenesController, uBizAlmacenes, uFactuGES_App, uDialogUtils, - // uGenerarAlbaranesProvUtils, + uEditorElegirAlmacenObraOperacion, schInventarioClient_Intf; {, uDBSelectionList, uDataModulePedidosProveedor, @@ -141,11 +145,25 @@ begin end; function TfEditorDetalleReservas.DarIDAlmacenSeleccionado(Descripcion: String): Integer; +var + IDAlmacen: Variant; begin - if (ViewGrid._Grid.ActiveLevel.Tag = -1) then - Result := SeleccionarAlmacen(Descripcion) + IDAlmacen := (ViewGrid as IViewDetalleReservas).DarIDAlmacenObraSeleccionada; + if not VarIsNull(IDAlmacen) then + Result := IDAlmacen else - Result := ViewGrid._Grid.ActiveLevel.Tag; + Result := Seleccionar(Descripcion, tAlmacen) +end; + +function TfEditorDetalleReservas.DarIDObraSeleccionada(Descripcion: String): Integer; +var + IDObra: Variant; +begin + IDObra := (ViewGrid as IViewDetalleReservas).DarIDAlmacenObraSeleccionada; + if not VarIsNull(IDObra) then + Result := IDObra + else + Result := Seleccionar(Descripcion, TObra) end; destructor TfEditorDetalleReservas.Destroy; @@ -194,6 +212,11 @@ function TfEditorDetalleReservas.GetDetalleReservas: IBizDetalleReservas; begin Result := FDetalleReservas; end; +function TfEditorDetalleReservas.GetTipoReservas: String; +begin + Result := FTipoReservas; +end; + { function TfEditorDetalleReservas.GetMultiSelect: Boolean; begin @@ -218,10 +241,10 @@ begin inherited; end; -function TfEditorDetalleReservas.SeleccionarAlmacen(Descripcion: String): Integer; -{var +{function TfEditorDetalleReservas.SeleccionarAlmacen(Descripcion: String): Integer; +var AAlmacenes : IBizAlmacen; - Respuesta : integer;} + Respuesta : integer; begin Result := -1; { @@ -248,7 +271,6 @@ begin Respuesta := JsElegirAlmacenDialog.Execute; if Respuesta <> IDCANCEL then Result := JsElegirAlmacenDialog.RadioResult - 1000; -} end; { procedure TfEditorDetalleReservas.SetController(const Value: IDetalleReservasController); @@ -262,10 +284,68 @@ begin end; end; } +function TfEditorDetalleReservas.Seleccionar(Descripcion: String; TipoSeleccion: TEnumSeleccion): Variant; +var + ALista : TStringList; + AListaAux : TStringList; + Respuesta : Variant; + i: Integer; + +begin + Result := Null; + + with TfEditorElegirAlmacenObraOperacion.Create(NIL) do + try + case TipoSeleccion of + tAlmacen: begin + Caption := Descripcion; + eDescripcion.Caption := 'Elija sobre qué almacén desea realizar la operación.'; + eEtiqueta.Caption := 'Almacén:'; + ALista := Controller.AlmacenesController.DarListaAlmacenes; + end; + tObra: begin + Caption := Descripcion; + eDescripcion.Caption := 'Elija sobre qué obra desea realizar la operación.'; + eEtiqueta.Caption := 'Obra:'; + ALista := Controller.ObrasController.DarListaObras; + end; + tAlmacenObra: begin + Caption := Descripcion; + eDescripcion.Caption := 'Elija sobre qué almacén u obra desea realizar la operación.'; + eEtiqueta.Caption := 'Almacén/Obra:'; + ALista := Controller.AlmacenesController.DarListaAlmacenes; + AListaAux := Controller.ObrasController.DarListaObras; + + for i := 0 to AListaAux.Count - 1 do + ALista.Add(Format('%s=%s', [AListaAux.Names[i], AListaAux.Values[AListaAux.Names[i]]])); + end; + end; + + with cxListaAlmacenesObras.Properties.Items do + begin + BeginUpdate; + try + Clear; + for i := 0 to ALista.Count - 1 do + Add(ALista.Names[i]); + finally + EndUpdate; + end; + end; + + if (ShowModal = mrOk) then + Result := ALista.Values[cxListaAlmacenesObras.EditValue]; + + finally + Free; + end; +end; + procedure TfEditorDetalleReservas.SetArticulo(const Value: IBizInventario); begin FArticulo := Value; - if Assigned(FArticulo) then + if Assigned(FArticulo) + and (FArticulo.RESERVA > 0) then begin tbxEditFiltro.Text := FArticulo.REFERENCIA; end; @@ -284,6 +364,25 @@ begin if Assigned(ViewGrid) then (ViewGrid as IViewDetalleReservas).DetalleReservas := FDetalleReservas; end; +procedure TfEditorDetalleReservas.SetTipoReservas(const Value: String); +begin + FTipoReservas := Value; + + if not Assigned(FController) then + raise Exception.Create('No hay ningún controlador asignado'); + + if (FTipoReservas = CTE_INV_ALMACEN) then + begin + if Assigned(ViewGrid) then + (ViewGrid as IViewDetalleReservas).Almacenes := FController.AlmacenesController.DarListaAlmacenes; + end + else if (FTipoReservas = CTE_INV_OBRA) then + begin + if Assigned(ViewGrid) then + (ViewGrid as IViewDetalleReservas).Obras := FController.ObrasController.DarListaObras; + end; +end; + { procedure TfEditorDetalleReservas.SetMultiSelect(AValue: Boolean); begin diff --git a/Source/Modulos/Inventario/Views/uEditorInventario.dfm b/Source/Modulos/Inventario/Views/uEditorInventario.dfm index f94b3943..2d732709 100644 --- a/Source/Modulos/Inventario/Views/uEditorInventario.dfm +++ b/Source/Modulos/Inventario/Views/uEditorInventario.dfm @@ -328,6 +328,7 @@ inherited fEditorInventario: TfEditorInventario Caption = 'Recibir pedido' ImageIndex = 24 OnExecute = actRecibirPedidoExecute + OnUpdate = actRecibirPedidoUpdate end object actTrasladar: TAction Category = 'Logistica' @@ -341,6 +342,7 @@ inherited fEditorInventario: TfEditorInventario Caption = 'Reservar' ImageIndex = 25 OnExecute = actReservarExecute + OnUpdate = actReservarUpdate end object actLiberar: TAction Category = 'Logistica' @@ -363,8 +365,8 @@ inherited fEditorInventario: TfEditorInventario OnExecute = actContraerExecute end object actReservados: TAction + Category = 'Logistica' Caption = 'Ver reservados' - Enabled = False ImageIndex = 25 OnExecute = actReservadosExecute OnUpdate = actReservadosUpdate diff --git a/Source/Modulos/Inventario/Views/uEditorInventario.pas b/Source/Modulos/Inventario/Views/uEditorInventario.pas index 28b66d3d..cee74bf2 100644 --- a/Source/Modulos/Inventario/Views/uEditorInventario.pas +++ b/Source/Modulos/Inventario/Views/uEditorInventario.pas @@ -45,6 +45,10 @@ type procedure FormShow(Sender: TObject); procedure actReservadosUpdate(Sender: TObject); procedure actReservadosExecute(Sender: TObject); + procedure actNuevoUpdate(Sender: TObject); + procedure actEliminarUpdate(Sender: TObject); + procedure actRecibirPedidoUpdate(Sender: TObject); + procedure actReservarUpdate(Sender: TObject); private function Seleccionar(Descripcion: String; TipoSeleccion: TEnumSeleccion): Variant; @@ -173,17 +177,24 @@ begin // inherited; end; +procedure TfEditorInventario.actNuevoUpdate(Sender: TObject); +begin + inherited; + if (Sender as TAction).Enabled then + (Sender as TAction).Enabled := not (ViewGrid as IViewInventario).ListaAlmacenesObrasVacia; +end; + procedure TfEditorInventario.actReservadosExecute(Sender: TObject); begin inherited; - FController.VerReservas(Inventario); + FController.VerReservas(Inventario, TipoInventario); RefrescarInterno; end; procedure TfEditorInventario.actReservadosUpdate(Sender: TObject); begin inherited; - (Sender as TAction).Enabled := (Inventario.RESERVA > 0); +// (Sender as TAction).Enabled := (Inventario.RESERVA > 0); end; function TfEditorInventario.GetArticulosSeleccionados: IBizInventario; @@ -361,6 +372,13 @@ begin RefrescarInterno; end; +procedure TfEditorInventario.actRecibirPedidoUpdate(Sender: TObject); +begin + inherited; + if (Sender as TAction).Enabled then + (Sender as TAction).Enabled := not (ViewGrid as IViewInventario).ListaAlmacenesObrasVacia; +end; + procedure TfEditorInventario.actTrasladarExecute(Sender: TObject); var IDAlmacenOrigen, IDAlmacenDestino: Variant; @@ -402,12 +420,29 @@ begin end; end; +procedure TfEditorInventario.actReservarUpdate(Sender: TObject); +begin + inherited; + if (Sender as TAction).Enabled then + (Sender as TAction).Enabled := Assigned(dsDataTable.DataTable); + + if (Sender as TAction).Enabled then + (Sender as TAction).Enabled := not (ViewGrid as IViewInventario).ListaAlmacenesObrasVacia; +end; + procedure TfEditorInventario.actContraerExecute(Sender: TObject); begin if Assigned(ViewGrid) then ViewGrid.ContraerTodo; end; +procedure TfEditorInventario.actEliminarUpdate(Sender: TObject); +begin + inherited; + if (Sender as TAction).Enabled then + (Sender as TAction).Enabled := not (ViewGrid as IViewInventario).ListaAlmacenesObrasVacia; +end; + procedure TfEditorInventario.actExpandirExecute(Sender: TObject); begin if Assigned(ViewGrid) then @@ -423,12 +458,11 @@ end; procedure TfEditorInventario.actTrasladarUpdate(Sender: TObject); begin inherited; -{ - if Assigned(dsDataTable.DataTable) then - (Sender as TAction).Enabled := (not dsDataTable.DataTable.IsEmpty) - else - (Sender as TAction).Enabled := False; -} + if (Sender as TAction).Enabled then + (Sender as TAction).Enabled := Assigned(dsDataTable.DataTable); + + if (Sender as TAction).Enabled then + (Sender as TAction).Enabled := not (ViewGrid as IViewInventario).ListaAlmacenesObrasVacia; end; procedure TfEditorInventario.actLiberarUpdate(Sender: TObject); diff --git a/Source/Modulos/Inventario/Views/uViewDetalleReservas.dfm b/Source/Modulos/Inventario/Views/uViewDetalleReservas.dfm index 110cd434..5fd0638b 100644 --- a/Source/Modulos/Inventario/Views/uViewDetalleReservas.dfm +++ b/Source/Modulos/Inventario/Views/uViewDetalleReservas.dfm @@ -1,7 +1,8 @@ inherited frViewDetalleReservas: TfrViewDetalleReservas + OnShow = CustomViewShow inherited cxGrid: TcxGrid - RootLevelOptions.DetailTabsPosition = dtpTop - OnActiveTabChanged = cxGridActiveTabChanged + Top = 143 + Height = 272 inherited cxGridView: TcxGridDBTableView DataController.KeyFieldNames = 'RecID' DataController.Summary.DefaultGroupSummaryItems = < @@ -163,12 +164,50 @@ inherited frViewDetalleReservas: TfrViewDetalleReservas StyleFocused.LookAndFeel.SkinName = '' StyleHot.LookAndFeel.SkinName = '' ExplicitLeft = 383 - ExplicitWidth = 215 - Width = 215 end end end end + object pnlAlmacenes: TPanel [3] + Left = 0 + Top = 102 + Width = 607 + Height = 41 + Align = alTop + TabOrder = 3 + ExplicitLeft = -71 + ExplicitWidth = 678 + DesignSize = ( + 607 + 41) + object eAlmacen: TLabel + Left = 10 + Top = 16 + Width = 44 + Height = 13 + Caption = 'Almac'#233'n:' + end + object cxListaAlmacenesObras: TcxComboBox + Left = 87 + Top = 14 + Anchors = [akLeft, akTop, akRight] + Properties.DropDownListStyle = lsEditFixedList + Properties.DropDownRows = 25 + Properties.ImmediatePost = True + Properties.OnEditValueChanged = cxListaAlmacenesObrasPropertiesEditValueChanged + Style.LookAndFeel.Kind = lfStandard + Style.LookAndFeel.NativeStyle = True + StyleDisabled.LookAndFeel.Kind = lfStandard + StyleDisabled.LookAndFeel.NativeStyle = True + StyleFocused.LookAndFeel.Kind = lfStandard + StyleFocused.LookAndFeel.NativeStyle = True + StyleHot.LookAndFeel.Kind = lfStandard + StyleHot.LookAndFeel.NativeStyle = True + TabOrder = 0 + ExplicitWidth = 581 + Width = 510 + end + end inherited dxComponentPrinter: TdxComponentPrinter inherited dxComponentPrinterLink: TdxGridReportLink ReportDocument.CreationDate = 38673.741107951390000000 diff --git a/Source/Modulos/Inventario/Views/uViewDetalleReservas.pas b/Source/Modulos/Inventario/Views/uViewDetalleReservas.pas index 1df71e5f..e030c484 100644 --- a/Source/Modulos/Inventario/Views/uViewDetalleReservas.pas +++ b/Source/Modulos/Inventario/Views/uViewDetalleReservas.pas @@ -15,7 +15,7 @@ uses cxButtonEdit, cxGridCustomPopupMenu, cxGridPopupMenu, uViewGrid, uBizInventario, uBizAlmacenes, cxSpinEdit, uViewFiltroBase, TB2Item, TBX, TB2Toolbar, TBXDkPanels, TB2Dock, dxPgsDlg, cxCurrencyEdit, uAlmacenesController, - uDAInterfaces; + uDAInterfaces, cxContainer, cxMaskEdit, cxDropDownEdit; type IViewDetalleReservas = interface(IViewGrid) @@ -23,9 +23,14 @@ type function GetDetalleReservas: IBizDetalleReservas; procedure SetDetalleReservas(const Value: IBizDetalleReservas); property DetalleReservas: IBizDetalleReservas read GetDetalleReservas write SetDetalleReservas; - function GetAlmacenes: IBizAlmacen; - procedure SetAlmacenes(const Value: IBizAlmacen); - property Almacenes: IBizAlmacen read GetAlmacenes write SetAlmacenes; + function GetAlmacenes: TStringList; + procedure SetAlmacenes(const Value: TStringList); + property Almacenes: TStringList read GetAlmacenes write SetAlmacenes; + function GetObras: TStringList; + procedure SetObras(const Value: TStringList); + property Obras: TStringList read GetObras write SetObras; + function DarIDAlmacenObraSeleccionada: Variant; + function ListaAlmacenesObrasVacia: Boolean; end; TfrViewDetalleReservas = class(TfrViewGrid, IViewDetalleReservas) @@ -47,31 +52,52 @@ type cxGridViewREFERENCIA_FABR: TcxGridDBColumn; cxGridViewID_ALMACEN_RESERVA: TcxGridDBColumn; cxGridViewALMACEN_RESERVA: TcxGridDBColumn; - - procedure cxGridActiveTabChanged(Sender: TcxCustomGrid; ALevel: TcxGridLevel); + pnlAlmacenes: TPanel; + eAlmacen: TLabel; + cxListaAlmacenesObras: TcxComboBox; procedure cxGridViewStylesGetContentStyle(Sender: TcxCustomGridTableView; ARecord: TcxCustomGridRecord; AItem: TcxCustomGridTableItem; out AStyle: TcxStyle); + procedure cxListaAlmacenesObrasPropertiesEditValueChanged(Sender: TObject); + procedure CustomViewShow(Sender: TObject); private - FAlmacenesController: IAlmacenesController; - FAlmacenes: IBizAlmacen; - function GetAlmacenes: IBizAlmacen; - procedure SetAlmacenes(const Value: IBizAlmacen); - //Filtros relativos a la vista - procedure AnadirFiltroAlmacenes; + procedure AnadirFiltroAlmacenesObras; protected + FAlmacenes: TStringList; + FObras: TStringList; FDetalleReservas: IBizDetalleReservas; + + function GetAlmacenes: TStringList; + procedure SetAlmacenes(const Value: TStringList); + function GetObras: TStringList; + procedure SetObras(const Value: TStringList); function GetDetalleReservas: IBizDetalleReservas; procedure SetDetalleReservas(const Value: IBizDetalleReservas); + + +// FAlmacenesController: IAlmacenesController; +// function GetAlmacenes: IBizAlmacen; +// procedure SetAlmacenes(const Value: IBizAlmacen); + + public - property Almacenes: IBizAlmacen read GetAlmacenes write SetAlmacenes; property DetalleReservas: IBizDetalleReservas read GetDetalleReservas write SetDetalleReservas; procedure AnadirOtrosFiltros; override; - constructor Create(AOwner: TComponent); override; + +// property Almacenes: IBizAlmacen read GetAlmacenes write SetAlmacenes; + destructor Destroy; override; + + + + + + function DarIDAlmacenObraSeleccionada: Variant; + function ListaAlmacenesObrasVacia: Boolean; + end; implementation @@ -79,16 +105,16 @@ implementation uses uDataModuleInventario, schInventarioClient_Intf; -procedure TfrViewDetalleReservas.AnadirFiltroAlmacenes; +procedure TfrViewDetalleReservas.AnadirFiltroAlmacenesObras; var FFiltro : TcxFilterCriteriaItemList; - CodigoAlmacen: String; + CodigoAlmacen: Variant; begin - FFiltro := AddFilterGrid(fboAnd); - CodigoAlmacen := IntToStr(cxGrid.Levels.Items[cxGrid.ActiveLevel.Index].Tag); - if CodigoAlmacen <> '-1' then + CodigoAlmacen := DarIDAlmacenObraSeleccionada; + + if not VarIsNull(CodigoAlmacen) then begin FFiltro.AddItem(cxGridViewID_ALMACEN, foEqual, CodigoAlmacen, CodigoAlmacen); cxGridViewALMACEN.Visible := False; @@ -101,7 +127,7 @@ procedure TfrViewDetalleReservas.AnadirOtrosFiltros; begin inherited; - AnadirFiltroAlmacenes; + AnadirFiltroAlmacenesObras; //Finalmente activamos el filtro si tenemos algo if cxGridView.DataController.Filter.IsEmpty @@ -110,17 +136,14 @@ begin cxGrid.ActiveLevel.GridView := cxGridView; end; -constructor TfrViewDetalleReservas.Create(AOwner: TComponent); +procedure TfrViewDetalleReservas.CustomViewShow(Sender: TObject); begin inherited; - FAlmacenesController := TAlmacenesController.Create; - Almacenes := FAlmacenesController.BuscarTodos; -end; - -procedure TfrViewDetalleReservas.cxGridActiveTabChanged(Sender: TcxCustomGrid; ALevel: TcxGridLevel); -begin - inherited; - RefrescarFiltro; + if Assigned(FAlmacenes) or Assigned(FObras) then + cxListaAlmacenesObras.ItemIndex := 0 + //En el caso de ser la vista para la selección de articulos de un determinado almacén + else + pnlAlmacenes.Visible:= False; end; procedure TfrViewDetalleReservas.cxGridViewStylesGetContentStyle(Sender: @@ -142,15 +165,33 @@ begin } end; +procedure TfrViewDetalleReservas.cxListaAlmacenesObrasPropertiesEditValueChanged(Sender: TObject); +begin + inherited; + RefrescarFiltro; +end; + +function TfrViewDetalleReservas.DarIDAlmacenObraSeleccionada: Variant; +begin + //INV_ALMACENES + if Assigned(FAlmacenes) then + Result := FAlmacenes.Values[cxListaAlmacenesObras.EditValue] + //INV_OBRAS + else if Assigned(FObras) then + Result := FObras.Values[cxListaAlmacenesObras.EditValue] + else + Raise Exception.Create('No se ha asignado ninguna lista de ALMACENES'); +end; + destructor TfrViewDetalleReservas.Destroy; begin - FAlmacenesController := Nil; FAlmacenes := Nil; + FObras := Nil; FDetalleReservas := Nil; inherited; end; -function TfrViewDetalleReservas.GetAlmacenes: IBizAlmacen; +function TfrViewDetalleReservas.GetAlmacenes: TStringList; begin Result := FAlmacenes; end; @@ -160,24 +201,42 @@ begin Result := FDetalleReservas; end; -procedure TfrViewDetalleReservas.SetAlmacenes(const Value: IBizAlmacen); +function TfrViewDetalleReservas.GetObras: TStringList; +begin + Result := FObras; +end; + +function TfrViewDetalleReservas.ListaAlmacenesObrasVacia: Boolean; +begin + Result := (cxListaAlmacenesObras.Properties.Items.Count = 0); +end; + +procedure TfrViewDetalleReservas.SetAlmacenes(const Value: TStringList); var Nivel: TcxGridLevel; + i: integer; begin FAlmacenes := Value; + eAlmacen.Caption := 'Almacén'; if Assigned(FAlmacenes) then begin - if not FAlmacenes.DataTable.Active then - FAlmacenes.DataTable.Active := True; + cxGrid.BeginUpdate; + try + with cxListaAlmacenesObras.Properties.Items do + begin + BeginUpdate; + try + Clear; + for i := 0 to FAlmacenes.Count - 1 do + Add(FAlmacenes.Names[i]); + finally + EndUpdate; + end; + end; - FAlmacenes.First; - while not FAlmacenes.EOF do - begin - Nivel := cxGrid.Levels.Add; - Nivel.Caption := FAlmacenes.NOMBRE; - Nivel.Tag := FAlmacenes.ID; - FAlmacenes.Next; + finally + cxGrid.EndUpdate; end; end; end; @@ -191,4 +250,34 @@ begin dsDataSource.DataTable := Nil; end; +procedure TfrViewDetalleReservas.SetObras(const Value: TStringList); +var + Nivel: TcxGridLevel; + i: integer; +begin + FObras := Value; + eAlmacen.Caption := 'Obra'; + + if Assigned(FObras) then + begin + cxGrid.BeginUpdate; + try + with cxListaAlmacenesObras.Properties.Items do + begin + BeginUpdate; + try + Clear; + for i := 0 to FObras.Count - 1 do + Add(FObras.Names[i]); + finally + EndUpdate; + end; + end; + + finally + cxGrid.EndUpdate; + end; + end; +end; + end. diff --git a/Source/Modulos/Inventario/Views/uViewInventario.pas b/Source/Modulos/Inventario/Views/uViewInventario.pas index e308f3ed..7e28923d 100644 --- a/Source/Modulos/Inventario/Views/uViewInventario.pas +++ b/Source/Modulos/Inventario/Views/uViewInventario.pas @@ -31,6 +31,7 @@ type procedure SetObras(const Value: TStringList); property Obras: TStringList read GetObras write SetObras; function DarIDAlmacenObraSeleccionada: Variant; + function ListaAlmacenesObrasVacia: Boolean; end; TfrViewInventario = class(TfrViewGrid, IViewInventario) @@ -79,6 +80,7 @@ type procedure AnadirOtrosFiltros; override; destructor Destroy; override; function DarIDAlmacenObraSeleccionada: Variant; + function ListaAlmacenesObrasVacia: Boolean; end; implementation @@ -146,8 +148,7 @@ begin end; end; -procedure TfrViewInventario.cxListaObrasPropertiesEditValueChanged( - Sender: TObject); +procedure TfrViewInventario.cxListaObrasPropertiesEditValueChanged(Sender: TObject); begin inherited; RefrescarFiltro; @@ -168,7 +169,7 @@ end; destructor TfrViewInventario.Destroy; begin FAlmacenes := Nil; - FObras := Nil; + FObras := Nil; FInventario := Nil; inherited; end; @@ -188,6 +189,11 @@ begin Result := FObras; end; +function TfrViewInventario.ListaAlmacenesObrasVacia: Boolean; +begin + Result := (cxListaAlmacenesObras.Properties.Items.Count = 0); +end; + procedure TfrViewInventario.SetAlmacenes(const Value: TStringList); var Nivel: TcxGridLevel; diff --git a/Source/Modulos/Obras/Controller/uObrasController.pas b/Source/Modulos/Obras/Controller/uObrasController.pas index f0503299..c1838a83 100644 --- a/Source/Modulos/Obras/Controller/uObrasController.pas +++ b/Source/Modulos/Obras/Controller/uObrasController.pas @@ -263,7 +263,7 @@ function TObrasController.DarListaObras: TStringList; begin ShowHourglassCursor; try - Result := FDataModule.DarListaObras; + Result := FDataModule.DarListaObras(AppFactuGES.EmpresaActiva.ID); finally HideHourglassCursor; end; diff --git a/Source/Modulos/Obras/Data/uDataModuleObras.pas b/Source/Modulos/Obras/Data/uDataModuleObras.pas index b89e37b4..3a83bd6d 100644 --- a/Source/Modulos/Obras/Data/uDataModuleObras.pas +++ b/Source/Modulos/Obras/Data/uDataModuleObras.pas @@ -35,7 +35,7 @@ type function GetItems : IBizObra; function GetItem(const ID : Integer) : IBizObra; function NewItem : IBizObra; - function DarListaObras : TStringList; + function DarListaObras(const IDEmpresa: Integer): TStringList; end; implementation @@ -113,11 +113,11 @@ begin end; end; -function TDataModuleObras.DarListaObras: TStringList; +function TDataModuleObras.DarListaObras(const IDEmpresa: Integer): TStringList; var ABinary : Binary; begin - ABinary := (RORemoteService as IsrvObras).DarListaObras; + ABinary := (RORemoteService as IsrvObras).DarListaObras(IdEmpresa); Result := TStringList.Create; Result.LoadFromStream(ABinary); end; diff --git a/Source/Modulos/Obras/Model/Data/uIDataModuleObras.pas b/Source/Modulos/Obras/Model/Data/uIDataModuleObras.pas index 90cd23aa..8aef97d9 100644 --- a/Source/Modulos/Obras/Model/Data/uIDataModuleObras.pas +++ b/Source/Modulos/Obras/Model/Data/uIDataModuleObras.pas @@ -12,7 +12,7 @@ type function GetItems: IBizObra; function GetItem(const ID : Integer) : IBizObra; function NewItem : IBizObra; - function DarListaObras : TStringList; + function DarListaObras(const IDEmpresa: Integer) : TStringList; end; implementation diff --git a/Source/Modulos/Obras/Servidor/srvObras_Impl.dfm b/Source/Modulos/Obras/Servidor/srvObras_Impl.dfm index d2bf1ed6..6dbad51c 100644 --- a/Source/Modulos/Obras/Servidor/srvObras_Impl.dfm +++ b/Source/Modulos/Obras/Servidor/srvObras_Impl.dfm @@ -39,11 +39,11 @@ object srvObras: TsrvObras Top = 82 DiagramData = ''#13#10' '#13#10' '#13#10' '#13#10' '#13#10' '#13#10' '#13#10 + + 'idth="1202" Height="535">'#13#10' '#13#10' '#13#10' '#13#10' ' + + ''#13#10' '#13#10 + ''#13#10 end object DataDictionary: TDADataDictionary @@ -395,7 +395,12 @@ object srvObras: TsrvObras Diagrams = Diagrams Datasets = < item - Params = <> + Params = < + item + Name = 'ID_EMPRESA' + Value = '' + ParamType = daptInput + end> Statements = < item Connection = 'IBX' @@ -404,8 +409,8 @@ object srvObras: TsrvObras TargetTable = 'OBRAS' Name = 'IBX' SQL = - 'Select ID, NOMBRE'#10'from ALMACENES'#10'where TIPO_ALMACEN = '#39'OBRA'#39#10'ord' + - 'er by NOMBRE'#10#10 + 'Select ID, NOMBRE'#10'from ALMACENES'#10'where TIPO_ALMACEN = '#39'OBRA'#39#10'and' + + ' ID_EMPRESA = :ID_EMPRESA'#10'order by NOMBRE'#10#10 StatementType = stSQL ColumnMappings = < item diff --git a/Source/Modulos/Obras/Servidor/srvObras_Impl.pas b/Source/Modulos/Obras/Servidor/srvObras_Impl.pas index 5b307b4b..c293a2b2 100644 --- a/Source/Modulos/Obras/Servidor/srvObras_Impl.pas +++ b/Source/Modulos/Obras/Servidor/srvObras_Impl.pas @@ -99,7 +99,7 @@ type private procedure Log(Astr: string); protected - function DarListaObras: Binary; + function DarListaObras(const IDEmpresa: Integer): Binary; end; implementation @@ -405,7 +405,7 @@ begin dmServer.EscribirLog(Astr) end; -function TsrvObras.DarListaObras: Binary; +function TsrvObras.DarListaObras(const IDEmpresa: Integer): Binary; var ASchema : TDASchema; AConn : IDAConnection; @@ -418,7 +418,7 @@ begin AConn := dmServer.ConnectionManager.NewConnection(dmServer.ConnectionManager.GetDefaultConnectionName); try - dsData := ASchema.NewDataset(AConn, 'ListaObras'); + dsData := ASchema.NewDataset(AConn, 'ListaObras', ['ID_EMPRESA'], [IntToStr(IDEmpresa)]); except RaiseError('No existe la tabla ALMACENES'); end; diff --git a/Source/Modulos/Pedidos a proveedor/Controller/uPedidosProveedorController.pas b/Source/Modulos/Pedidos a proveedor/Controller/uPedidosProveedorController.pas index 78638bb5..938bcf27 100644 --- a/Source/Modulos/Pedidos a proveedor/Controller/uPedidosProveedorController.pas +++ b/Source/Modulos/Pedidos a proveedor/Controller/uPedidosProveedorController.pas @@ -52,6 +52,7 @@ type procedure RecuperarProveedor(APedido: IBizPedidoProveedor); procedure EnviarPedidoPorEMail(APedido: IBizPedidoProveedor); + Procedure AsignarIDObra(APedido: IBizPedidoProveedor; const IDObra: Variant); end; TPedidosProveedorController = class(TControllerBase, IPedidosProveedorController) @@ -116,7 +117,9 @@ type function ExtraerSeleccionados(APedido: IBizPedidoProveedor) : IBizPedidoProveedor; function ElegirPedidos(APedido: IBizPedidoProveedor; AMensaje: String; AMultiSelect: Boolean): IBizPedidoProveedor; - procedure EnviarPedidoPorEMail(APedido: IBizPedidoProveedor); + procedure EnviarPedidoPorEMail(APedido: IBizPedidoProveedor); + + Procedure AsignarIDObra(APedido: IBizPedidoProveedor; const IDObra: Variant); end; implementation @@ -142,6 +145,22 @@ begin FDataModule := TDataModulePedidosProveedor.Create(Nil); end; +procedure TPedidosProveedorController.AsignarIDObra(APedido: IBizPedidoProveedor; const IDObra: Variant); +begin + if Assigned(APedido) then + begin + if not APedido.DataTable.Editing then + APedido.DataTable.Edit; + + if VarIsNull(IDObra) then + APedido.ID_OBRAIsNull := true + else + APedido.ID_OBRA := IDObra; + + APedido.DataTable.Post; + end; +end; + function TPedidosProveedorController.Buscar(const ID: Integer): IBizPedidoProveedor; begin Result := FDataModule.GetItem(ID); diff --git a/Source/Modulos/Pedidos a proveedor/Views/uEditorPedidoProveedor.dfm b/Source/Modulos/Pedidos a proveedor/Views/uEditorPedidoProveedor.dfm index 7b43718d..723b1fee 100644 --- a/Source/Modulos/Pedidos a proveedor/Views/uEditorPedidoProveedor.dfm +++ b/Source/Modulos/Pedidos a proveedor/Views/uEditorPedidoProveedor.dfm @@ -112,29 +112,28 @@ inherited fEditorPedidoProveedor: TfEditorPedidoProveedor ExplicitHeight = 506 inherited ToolBar1: TToolBar Width = 865 - Height = 51 + Height = 46 ExplicitWidth = 865 - ExplicitHeight = 51 + ExplicitHeight = 46 inherited ToolButton3: TToolButton Wrap = False end inherited ToolButton4: TToolButton Left = 278 Top = 0 + Wrap = True ExplicitLeft = 278 ExplicitTop = 0 end - inherited ToolButton14: TToolButton - Left = 334 - Top = 0 - Wrap = False + inherited FontName: TJvFontComboBox + Left = 0 ExplicitLeft = 334 ExplicitTop = 0 end - inherited FontName: TJvFontComboBox - Left = 399 + inherited ToolButton14: TToolButton + Left = 479 Top = 0 - ExplicitLeft = 399 + ExplicitLeft = 479 ExplicitTop = 0 end inherited FontSize: TEdit @@ -145,7 +144,13 @@ inherited fEditorPedidoProveedor: TfEditorPedidoProveedor ExplicitTop = 0 ExplicitWidth = 278 end - inherited ToolButton13: TToolButton [7] + inherited UpDown1: TUpDown + Left = 822 + Top = 0 + ExplicitLeft = 822 + ExplicitTop = 0 + end + inherited ToolButton13: TToolButton Left = 0 Top = 0 Wrap = True @@ -153,52 +158,49 @@ inherited fEditorPedidoProveedor: TfEditorPedidoProveedor ExplicitTop = 0 ExplicitHeight = 27 end - inherited UpDown1: TUpDown [8] + inherited ToolButton11: TToolButton Left = 0 Top = 27 ExplicitLeft = 0 ExplicitTop = 27 end - inherited ToolButton6: TToolButton - Left = 17 - Top = 27 - ExplicitLeft = 17 - ExplicitTop = 27 - end - inherited ToolButton7: TToolButton - Left = 83 - Top = 27 - ExplicitLeft = 83 - ExplicitTop = 27 - end - inherited ToolButton8: TToolButton - Left = 150 - Top = 27 - ExplicitLeft = 150 - ExplicitTop = 27 - end inherited ToolButton12: TToolButton - Left = 233 + Left = 141 Top = 27 - ExplicitLeft = 233 + Wrap = False + ExplicitLeft = 141 ExplicitTop = 27 + ExplicitHeight = 22 end inherited ToolButton9: TToolButton - Left = 241 + Left = 149 Top = 27 - ExplicitLeft = 241 + ExplicitLeft = 149 ExplicitTop = 27 end inherited ToolButton10: TToolButton - Left = 386 + Left = 294 Top = 27 - ExplicitLeft = 386 + ExplicitLeft = 294 ExplicitTop = 27 end - inherited ToolButton11: TToolButton - Left = 511 + inherited ToolButton6: TToolButton + Left = 419 Top = 27 - ExplicitLeft = 511 + ExplicitLeft = 419 + ExplicitTop = 27 + end + inherited ToolButton7: TToolButton + Left = 485 + Top = 27 + Wrap = False + ExplicitLeft = 485 + ExplicitTop = 27 + end + inherited ToolButton8: TToolButton + Left = 552 + Top = 27 + ExplicitLeft = 552 ExplicitTop = 27 end end diff --git a/Source/Modulos/Pedidos a proveedor/Views/uEditorPedidoProveedor.pas b/Source/Modulos/Pedidos a proveedor/Views/uEditorPedidoProveedor.pas index 014aa353..4aeeb880 100644 --- a/Source/Modulos/Pedidos a proveedor/Views/uEditorPedidoProveedor.pas +++ b/Source/Modulos/Pedidos a proveedor/Views/uEditorPedidoProveedor.pas @@ -298,7 +298,9 @@ begin if Assigned(FController) then begin - ViewPedido.ViewProveedorPedido.Controller := Controller.ProveedorController; + if Assigned(FViewPedido) then + FViewPedido.Controller := Controller; + frViewDetallesPedidoProveedor1.Controller := Controller.DetallesController; end; end; diff --git a/Source/Modulos/Pedidos a proveedor/Views/uViewDireccionEntregaPedidoProv.dfm b/Source/Modulos/Pedidos a proveedor/Views/uViewDireccionEntregaPedidoProv.dfm index b1922e46..b7b371cb 100644 --- a/Source/Modulos/Pedidos a proveedor/Views/uViewDireccionEntregaPedidoProv.dfm +++ b/Source/Modulos/Pedidos a proveedor/Views/uViewDireccionEntregaPedidoProv.dfm @@ -1,6 +1,7 @@ inherited frViewDireccionEntregaPedidoProv: TfrViewDireccionEntregaPedidoProv Width = 484 Height = 240 + OnShow = CustomViewShow ExplicitWidth = 484 ExplicitHeight = 240 object dxLayoutControl1: TdxLayoutControl @@ -23,6 +24,12 @@ inherited frViewDireccionEntregaPedidoProv: TfrViewDireccionEntregaPedidoProv Height = 2 Shape = bsTopLine end + object lblObra: TLabel + Left = 247 + Top = 37 + Width = 3 + Height = 13 + end object rdxDestino1: TRadioButton Left = 10 Top = 12 @@ -32,7 +39,7 @@ inherited frViewDireccionEntregaPedidoProv: TfrViewDireccionEntregaPedidoProv TabOrder = 0 TabStop = True end - object rdxDestino2: TRadioButton + object rdxDestino3: TRadioButton Left = 10 Top = 67 Width = 566 @@ -95,7 +102,7 @@ inherited frViewDireccionEntregaPedidoProv: TfrViewDireccionEntregaPedidoProv TabOrder = 5 OnDblClick = txtDireccionDblClick end - object RadioButton1: TRadioButton + object rdxDestino2: TRadioButton Left = 10 Top = 39 Width = 231 @@ -135,7 +142,7 @@ inherited frViewDireccionEntregaPedidoProv: TfrViewDireccionEntregaPedidoProv Width = 334 end object lblNombreObra: TcxDBLabel - Left = 247 + Left = 256 Top = 37 DataBinding.DataField = 'NOMBRE_OBRA' DataBinding.DataSource = dsPedido @@ -188,7 +195,14 @@ inherited frViewDireccionEntregaPedidoProv: TfrViewDireccionEntregaPedidoProv AutoAligns = [aaHorizontal] AlignVert = avCenter ShowCaption = False - Control = RadioButton1 + Control = rdxDestino2 + ControlOptions.AutoColor = True + ControlOptions.ShowBorder = False + end + object dxLayoutControl1Item6: TdxLayoutItem + Caption = 'Label1' + ShowCaption = False + Control = lblObra ControlOptions.AutoColor = True ControlOptions.ShowBorder = False end @@ -207,7 +221,7 @@ inherited frViewDireccionEntregaPedidoProv: TfrViewDireccionEntregaPedidoProv Caption = 'New Item' Offsets.Top = 3 ShowCaption = False - Control = rdxDestino2 + Control = rdxDestino3 ControlOptions.AutoColor = True ControlOptions.ShowBorder = False end diff --git a/Source/Modulos/Pedidos a proveedor/Views/uViewDireccionEntregaPedidoProv.pas b/Source/Modulos/Pedidos a proveedor/Views/uViewDireccionEntregaPedidoProv.pas index aa9edb95..1844635e 100644 --- a/Source/Modulos/Pedidos a proveedor/Views/uViewDireccionEntregaPedidoProv.pas +++ b/Source/Modulos/Pedidos a proveedor/Views/uViewDireccionEntregaPedidoProv.pas @@ -22,7 +22,7 @@ type TfrViewDireccionEntregaPedidoProv = class(TfrViewBase, IViewDireccionEntregaPedidoProv) dxLayoutControl1: TdxLayoutControl; rdxDestino1: TRadioButton; - rdxDestino2: TRadioButton; + rdxDestino3: TRadioButton; cbListaAlmacenes: TcxDBLookupComboBox; dxLayoutGroup1: TdxLayoutGroup; dxLayoutItem1: TdxLayoutItem; @@ -38,7 +38,7 @@ type txtDireccion: TStaticText; dxLayoutControl1Item5: TdxLayoutItem; dxLayoutControl1Item4: TdxLayoutItem; - RadioButton1: TRadioButton; + rdxDestino2: TRadioButton; dsObras: TDADataSource; actListaObras: TAction; Bevel1: TBevel; @@ -50,6 +50,8 @@ type dxLayoutControl1Group3: TdxLayoutGroup; lblNombreObra: TcxDBLabel; dxLayoutControl1Item9: TdxLayoutItem; + lblObra: TLabel; + dxLayoutControl1Item6: TdxLayoutItem; procedure actListaAlmacenesExecute(Sender: TObject); procedure actOtroExecute(Sender: TObject); procedure cbListaAlmacenesPropertiesValidate(Sender: TObject; var DisplayValue: Variant; var ErrorText: TCaption; var Error: Boolean); @@ -59,6 +61,9 @@ type procedure edtEntregarAPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer); procedure dsPedidoDataChange(Sender: TObject; Field: TField); + procedure OnObraReservaEditValueChanged(Sender: TObject); + procedure CustomViewShow(Sender: TObject); + protected FAlmacenesController : IAlmacenesController; FAlmacenes: IBizAlmacen; @@ -71,12 +76,13 @@ type procedure CambioDireccionAlmacen; procedure RefrescarControles; procedure SetReadOnly(Value: Boolean); override; - procedure RecuperarObra; + public property PedidoProveedor: IBizPedidoProveedor read GetPedidoProveedor write SetPedidoProveedor; constructor Create(AOwner: TComponent); override; destructor Destroy; override; procedure PrepararObra; + procedure RecuperarObra; procedure CambioDireccionObra; end; @@ -173,8 +179,16 @@ begin FObra := NIL; end; +procedure TfrViewDireccionEntregaPedidoProv.CustomViewShow(Sender: TObject); +begin + inherited; +// lblNombreObra.Properties.OnEditValueChanged := OnObraReservaEditValueChanged; +end; + destructor TfrViewDireccionEntregaPedidoProv.Destroy; begin +// lblNombreObra.Properties.OnEditValueChanged := Nil; + //cbListaObras.Properties.OnValidate := Nil; cbListaAlmacenes.Properties.OnValidate := Nil; @@ -199,7 +213,7 @@ begin if actListaObras.Enabled then begin if not Assigned(FObra) then - RecuperarObra; + RecuperarObra; CambioDireccionObra end else @@ -240,6 +254,12 @@ begin Result := FPedido; end; +procedure TfrViewDireccionEntregaPedidoProv.OnObraReservaEditValueChanged( + Sender: TObject); +begin +// showmessage('hola'); +end; + procedure TfrViewDireccionEntregaPedidoProv.RecuperarObra; begin if Assigned(FObra) and (FObra.ID = FPedido.ID_OBRA) then @@ -291,7 +311,7 @@ begin actListaObras.Enabled := False; if actListaObras.Checked then - actListaAlmacenes.Execute; + actListaAlmacenes.Execute; end else actListaObras.Enabled := True; @@ -333,7 +353,7 @@ begin rdxDestino1.Enabled := not ReadOnly; rdxDestino2.Enabled := not ReadOnly; - RadioButton1.Enabled := not ReadOnly; + rdxDestino3.Enabled := not ReadOnly; end; procedure TfrViewDireccionEntregaPedidoProv.txtDireccionDblClick( diff --git a/Source/Modulos/Pedidos a proveedor/Views/uViewObraReserva.dfm b/Source/Modulos/Pedidos a proveedor/Views/uViewObraReserva.dfm index cc0562fe..23bcc4e0 100644 --- a/Source/Modulos/Pedidos a proveedor/Views/uViewObraReserva.dfm +++ b/Source/Modulos/Pedidos a proveedor/Views/uViewObraReserva.dfm @@ -1,28 +1,31 @@ inherited frViewObraReserva: TfrViewObraReserva - Width = 586 - Height = 68 + Width = 529 + Height = 74 OnShow = CustomViewShow - ExplicitWidth = 586 - ExplicitHeight = 68 + ExplicitWidth = 529 + ExplicitHeight = 74 object dxLayoutControl1: TdxLayoutControl Left = 0 Top = 0 - Width = 586 - Height = 68 + Width = 529 + Height = 74 Align = alClient ParentBackground = True TabOrder = 0 TabStop = False AutoContentSizes = [acsWidth, acsHeight] + DesignSize = ( + 529 + 74) object Label1: TLabel Left = 10 Top = 10 - Width = 235 + Width = 202 Height = 13 - Caption = 'Reservar el material de este pedido para la obra:' + Caption = 'El material de este pedido es para la obra:' end object Button3: TBitBtn - Left = 432 + Left = 375 Top = 29 Width = 144 Height = 25 @@ -65,17 +68,33 @@ inherited frViewObraReserva: TfrViewObraReserva FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00 FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00} end - object cbObraReserva: TComboBox + object cbObraReserva: TcxComboBox Left = 10 - Top = 31 - Width = 475 - Height = 21 - AutoDropDown = True - AutoCloseUp = True - Style = csDropDownList - ItemHeight = 13 + Top = 29 + Anchors = [akLeft, akTop, akRight] + Properties.DropDownListStyle = lsEditFixedList + Properties.DropDownRows = 25 + Properties.ImmediatePost = True + Properties.OnEditValueChanged = cbObraReservaPropertiesEditValueChanged + Style.BorderColor = clWindowFrame + Style.BorderStyle = ebs3D + Style.HotTrack = False + Style.LookAndFeel.Kind = lfStandard + Style.LookAndFeel.NativeStyle = True + Style.LookAndFeel.SkinName = '' + Style.ButtonStyle = bts3D + Style.PopupBorderStyle = epbsFrame3D + StyleDisabled.LookAndFeel.Kind = lfStandard + StyleDisabled.LookAndFeel.NativeStyle = True + StyleDisabled.LookAndFeel.SkinName = '' + StyleFocused.LookAndFeel.Kind = lfStandard + StyleFocused.LookAndFeel.NativeStyle = True + StyleFocused.LookAndFeel.SkinName = '' + StyleHot.LookAndFeel.Kind = lfStandard + StyleHot.LookAndFeel.NativeStyle = True + StyleHot.LookAndFeel.SkinName = '' TabOrder = 0 - OnChange = cbObraReservaChange + Width = 581 end object dxLayoutGroup1: TdxLayoutGroup ShowCaption = False @@ -93,11 +112,9 @@ inherited frViewObraReserva: TfrViewObraReserva Hidden = True LayoutDirection = ldHorizontal ShowBorder = False - object dxLayoutControl1Item5: TdxLayoutItem - AutoAligns = [] + object dxLayoutControl1Item3: TdxLayoutItem + AutoAligns = [aaVertical] AlignHorz = ahClient - AlignVert = avCenter - ShowCaption = False Control = cbObraReserva ControlOptions.ShowBorder = False end @@ -111,10 +128,6 @@ inherited frViewObraReserva: TfrViewObraReserva end end end - object dsPedido: TDADataSource - Left = 200 - Top = 8 - end object PngImageList: TPngImageList PngImages = < item diff --git a/Source/Modulos/Pedidos a proveedor/Views/uViewObraReserva.pas b/Source/Modulos/Pedidos a proveedor/Views/uViewObraReserva.pas index 5a1246e5..e009b55e 100644 --- a/Source/Modulos/Pedidos a proveedor/Views/uViewObraReserva.pas +++ b/Source/Modulos/Pedidos a proveedor/Views/uViewObraReserva.pas @@ -8,21 +8,17 @@ uses cxContainer, cxEdit, cxTextEdit, cxMaskEdit, cxDropDownEdit, cxLookupEdit, cxDBLookupEdit, cxDBLookupComboBox, StdCtrls, cxControls, DB, uDADataTable, ActnList, uBizAlmacenes, uAlmacenesController, uPedidosProveedorController, - Buttons, uDAInterfaces, uBizObras, uObrasController, cxButtonEdit, cxDBEdit, + Buttons, uDAInterfaces, uBizObras, cxButtonEdit, cxDBEdit, uObrasController, ExtCtrls, ImgList, PngImageList; type - IViewDireccionEntregaPedidoProv = interface(IViewBase) - ['{7467855C-066F-4A60-B88F-2837C8050B1E}'] - function GetPedidoProveedor: IBizPedidoProveedor; - procedure SetPedidoProveedor(const Value: IBizPedidoProveedor); - property PedidoProveedor: IBizPedidoProveedor read GetPedidoProveedor write SetPedidoProveedor; + IViewObraReserva = interface(IViewBase) + ['{571462BF-ECF3-47F1-A6F4-2C31175D0B33}'] end; - TfrViewObraReserva = class(TfrViewBase, IViewDireccionEntregaPedidoProv) + TfrViewObraReserva = class(TfrViewBase, IViewObraReserva) dxLayoutControl1: TdxLayoutControl; dxLayoutGroup1: TdxLayoutGroup; - dsPedido: TDADataSource; Label1: TLabel; dxLayoutControl1Item1: TdxLayoutItem; dxLayoutControl1Item2: TdxLayoutItem; @@ -30,28 +26,31 @@ type PngImageList: TPngImageList; ActionList1: TActionList; actVerObra: TAction; - cbObraReserva: TComboBox; - dxLayoutControl1Item5: TdxLayoutItem; + dxLayoutControl1Item3: TdxLayoutItem; + cbObraReserva: TcxComboBox; dxLayoutControl1Group1: TdxLayoutGroup; procedure actVerObraExecute(Sender: TObject); procedure actVerObraUpdate(Sender: TObject); - procedure cbObraReservaChange(Sender: TObject); procedure CustomViewShow(Sender: TObject); + procedure cbObraReservaPropertiesEditValueChanged(Sender: TObject); + private + FObras : TStringList; + FObrasController: IObrasController; + function GetObrasController: IObrasController; + procedure SetObrasController(const Value: IObrasController); + function GetObras: TStringList; + procedure SetObras(const Value: TStringList); + protected - FObrasController : IObrasController; - FListaObras : TStringList; - //FObras: IBizObra; - FPedido : IBizPedidoProveedor; - FController : IPedidosProveedorController; - function GetPedidoProveedor: IBizPedidoProveedor; - procedure SetPedidoProveedor(const Value: IBizPedidoProveedor); - procedure CargarObra; procedure SalvarObra; - procedure SetReadOnly(Value: Boolean); override; + procedure SetReadOnly(Value: Boolean); override; + public - property PedidoProveedor: IBizPedidoProveedor read GetPedidoProveedor write SetPedidoProveedor; - constructor Create(AOwner: TComponent); override; + property Obras: TStringList read GetObras write SetObras; + property ObrasController: IObrasController read GetObrasController write SetObrasController; destructor Destroy; override; + procedure ActivarObra(const IDObra:Integer); + function DarIDObraSeleccionada: Variant; end; implementation @@ -68,8 +67,7 @@ var AID : Integer; begin inherited; - AID := StrToInt(FListaObras.Values[FListaObras.Names[cbObraReserva.ItemIndex-1]]); - AObra := FObrasController.Buscar(AID); + AObra := FObrasController.Buscar(DarIDObraSeleccionada); if Assigned(AObra) then try FObrasController.Ver(AObra); @@ -81,55 +79,30 @@ end; procedure TfrViewObraReserva.actVerObraUpdate(Sender: TObject); begin inherited; - (Sender as TAction).Enabled := Assigned(FListaObras) and - (not EsCadenaVacia(cbObraReserva.Text)); + (Sender as TAction).Enabled := (cbObraReserva.Properties.Items.Count > 0) end; -procedure TfrViewObraReserva.CargarObra; +procedure TfrViewObraReserva.ActivarObra(const IDObra: Integer); var i : integer; begin cbObraReserva.ItemIndex := 0; - - if not FPedido.Active then - FPedido.Open; - - if not FPedido.ID_OBRAIsNull then + for i := 0 to FObras.Count - 1 do begin - for i := 0 to FListaObras.Count - 1 do + if IntToStr(IDObra) = FObras.Values[FObras.Names[i]] then begin - if IntToStr(FPedido.ID_OBRA) = FListaObras.Values[FListaObras.Names[i]] then - begin - cbObraReserva.ItemIndex := i + 1; - Exit; - end; + cbObraReserva.ItemIndex := i + 1; + Exit; end; end; end; -procedure TfrViewObraReserva.cbObraReservaChange(Sender: TObject); +procedure TfrViewObraReserva.cbObraReservaPropertiesEditValueChanged( + Sender: TObject); begin inherited; - SalvarObra; -end; - -constructor TfrViewObraReserva.Create(AOwner: TComponent); -var - i: Integer; -begin - inherited; - FController := TPedidosProveedorController.Create; - FObrasController := TObrasController.Create; - FListaObras := FObrasController.DarListaObras; - - cbObraReserva.Items.BeginUpdate; - try - cbObraReserva.Items.Add(''); // Para poder indicar sin obra - for i := 0 to FListaObras.Count - 1 do - cbObraReserva.Items.Add(FListaObras.Names[i]); - finally - cbObraReserva.Items.EndUpdate; - end; +showmessage('hola'); +// SalvarObra; end; procedure TfrViewObraReserva.CustomViewShow(Sender: TObject); @@ -138,49 +111,78 @@ begin cbObraReserva.Enabled := not Self.ReadOnly; end; +function TfrViewObraReserva.DarIDObraSeleccionada: Variant; +begin + if Assigned(FObras) then + Result := FObras.Values[cbObraReserva.EditValue] + else + Raise Exception.Create('No se ha asignado ninguna lista de ALMACENES'); +end; + destructor TfrViewObraReserva.Destroy; begin FObrasController := Nil; - FController := NIL; - - FreeANDNIL(FListaObras); + FObras := Nil; inherited; end; -function TfrViewObraReserva.GetPedidoProveedor: IBizPedidoProveedor; +function TfrViewObraReserva.GetObras: TStringList; begin - Result := FPedido; + Result := FObras; +end; + +function TfrViewObraReserva.GetObrasController: IObrasController; +begin + Result := FObrasController; end; procedure TfrViewObraReserva.SalvarObra; var AID : String; begin +{ // En el item 0 no hay nada if (cbObraReserva.ItemIndex > 0) then begin - AID := FListaObras.Values[FListaObras.Names[cbObraReserva.ItemIndex-1]]; + AID := FListaObras.Values[cbObraReserva.EditValue]; FPedido.Edit; FPedido.ID_OBRA := StrToInt(AID); - FPedido.NOMBRE_OBRA := FListaObras.Names[cbObraReserva.ItemIndex-1]; + FPedido.NOMBRE_OBRA := cbObraReserva.EditValue; end else begin FPedido.Edit; FPedido.ClearField('ID_OBRA'); FPedido.ClearField('NOMBRE_OBRA'); end; +} end; -procedure TfrViewObraReserva.SetPedidoProveedor( - const Value: IBizPedidoProveedor); +procedure TfrViewObraReserva.SetObras(const Value: TStringList); +var + i: Integer; + begin - dsPedido.DataTable := nil; + FObras := Value; - FPedido := Value; - dsPedido.DataTable := FPedido.DataTable; - CargarObra; + if Assigned(FObras) then + with cbObraReserva.Properties.Items do + begin + BeginUpdate; + try + Clear; +// Add(''); + for i := 0 to FObras.Count - 1 do + Add(FObras.Names[i]); + finally + EndUpdate; + end; + end; end; +procedure TfrViewObraReserva.SetObrasController(const Value: IObrasController); +begin + FObrasController := Value; +end; procedure TfrViewObraReserva.SetReadOnly(Value: Boolean); begin diff --git a/Source/Modulos/Pedidos a proveedor/Views/uViewPedidoProveedor.dfm b/Source/Modulos/Pedidos a proveedor/Views/uViewPedidoProveedor.dfm index bca3c0af..161bca80 100644 --- a/Source/Modulos/Pedidos a proveedor/Views/uViewPedidoProveedor.dfm +++ b/Source/Modulos/Pedidos a proveedor/Views/uViewPedidoProveedor.dfm @@ -3,6 +3,7 @@ inherited frViewPedidoProveedor: TfrViewPedidoProveedor Height = 560 OnCreate = CustomViewCreate OnDestroy = CustomViewDestroy + OnShow = CustomViewShow ExplicitWidth = 965 ExplicitHeight = 560 object dxLayoutControl1: TdxLayoutControl @@ -167,21 +168,17 @@ inherited frViewPedidoProveedor: TfrViewPedidoProveedor 248) inherited Bevel1: TBevel Top = 200 - Width = 566 ExplicitTop = 200 - ExplicitWidth = 566 end - inherited rdxDestino2: TRadioButton - Width = 566 - ExplicitWidth = 566 + inherited lblObra: TLabel + Left = 239 + ExplicitLeft = 239 end inherited cbListaAlmacenes: TcxDBLookupComboBox Style.LookAndFeel.SkinName = '' StyleDisabled.LookAndFeel.SkinName = '' StyleFocused.LookAndFeel.SkinName = '' StyleHot.LookAndFeel.SkinName = '' - ExplicitWidth = 551 - Width = 551 end inherited bModificar: TBitBtn Left = 294 @@ -190,12 +187,10 @@ inherited frViewPedidoProveedor: TfrViewPedidoProveedor ExplicitTop = 164 end inherited txtDireccion: TStaticText - Width = 882 Height = 68 - ExplicitWidth = 882 ExplicitHeight = 68 end - inherited RadioButton1: TRadioButton + inherited rdxDestino2: TRadioButton Width = 223 ExplicitWidth = 223 end @@ -206,18 +201,14 @@ inherited frViewPedidoProveedor: TfrViewPedidoProveedor StyleFocused.LookAndFeel.SkinName = '' StyleHot.LookAndFeel.SkinName = '' ExplicitTop = 231 - ExplicitWidth = 334 - Width = 334 end inherited lblNombreObra: TcxDBLabel - Left = 239 + Left = 248 Style.LookAndFeel.SkinName = '' StyleDisabled.LookAndFeel.SkinName = '' StyleFocused.LookAndFeel.SkinName = '' StyleHot.LookAndFeel.SkinName = '' - ExplicitLeft = 239 - ExplicitWidth = 121 - Width = 121 + ExplicitLeft = 248 end end inherited ActionList1: TActionList @@ -456,23 +447,18 @@ inherited frViewPedidoProveedor: TfrViewPedidoProveedor Height = 72 ExplicitWidth = 432 ExplicitHeight = 72 - inherited Label1: TLabel - Width = 235 - ExplicitWidth = 235 - end inherited Button3: TBitBtn Left = 278 ExplicitLeft = 278 end - inherited cbObraReserva: TComboBox - Width = 475 - ExplicitWidth = 475 + inherited cbObraReserva: TcxComboBox + Properties.OnEditValueChanged = nil + Style.LookAndFeel.SkinName = '' + StyleDisabled.LookAndFeel.SkinName = '' + StyleFocused.LookAndFeel.SkinName = '' + StyleHot.LookAndFeel.SkinName = '' end end - inherited dsPedido: TDADataSource - Left = 192 - Top = 24 - end inherited PngImageList: TPngImageList Left = 224 Top = 24 diff --git a/Source/Modulos/Pedidos a proveedor/Views/uViewPedidoProveedor.pas b/Source/Modulos/Pedidos a proveedor/Views/uViewPedidoProveedor.pas index c078e6ab..f79acf0b 100644 --- a/Source/Modulos/Pedidos a proveedor/Views/uViewPedidoProveedor.pas +++ b/Source/Modulos/Pedidos a proveedor/Views/uViewPedidoProveedor.pas @@ -13,7 +13,8 @@ uses uViewDireccionEntregaPedidoProv, cxLookupEdit, cxDBLookupEdit, // uBizPedidosCliente, uPedidosClienteController, cxDBLookupComboBox, uFormasPagoController, ActnList, uDAInterfaces, uBizFormasPago, - uViewProveedorPedido, uViewObraReserva; + uViewProveedorPedido, uViewObraReserva, uObrasController, + uPedidosProveedorController; type IViewPedidoProveedor = interface(IViewBase) @@ -22,6 +23,10 @@ type procedure SetPedido(const Value: IBizPedidoProveedor); property Pedido: IBizPedidoProveedor read GetPedido write SetPedido; + function GetController : IPedidosProveedorController; + procedure SetController (const Value : IPedidosProveedorController); + property Controller : IPedidosProveedorController read GetController write SetController; + function GetViewProveedorPedido: TfrViewDatosYSeleccionProveedor; procedure SetViewProveedorPedido(const Value: TfrViewDatosYSeleccionProveedor); property ViewProveedorPedido: TfrViewDatosYSeleccionProveedor read GetViewProveedorPedido write SetViewProveedorPedido; @@ -78,23 +83,31 @@ type procedure actVerPedidoCliUpdate(Sender: TObject); procedure frViewProveedorPedidoButton1Click(Sender: TObject); procedure frViewProveedorPedidoButton2Click(Sender: TObject); - procedure frViewObraReserva1cbListaObrasReservaPropertiesEditValueChanged( - Sender: TObject); + procedure ObraReservaEditValueChanged(Sender: TObject); + procedure CustomViewShow(Sender: TObject); + protected FPedido : IBizPedidoProveedor; + FController : IPedidosProveedorController; FViewProveedorPedido : TfrViewDatosYSeleccionProveedor; FFormasPago : IBizFormaPago; FFormasPagoController : IFormasPagoController; + FObras: TStringList; + FObrasController : IObrasController; // FPedidoCliAsociado : IBizPedidoCliente; // FPedidoCliController : IPedidosClienteController; function GetPedido: IBizPedidoProveedor; procedure SetPedido(const Value: IBizPedidoProveedor); virtual; + function GetController : IPedidosProveedorController; + procedure SetController (const Value : IPedidosProveedorController); + function GetViewProveedorPedido: TfrViewDatosYSeleccionProveedor; procedure SetViewProveedorPedido(const Value: TfrViewDatosYSeleccionProveedor); public property Pedido: IBizPedidoProveedor read GetPedido write SetPedido; + property Controller : IPedidosProveedorController read GetController write SetController; property ViewProveedorPedido: TfrViewDatosYSeleccionProveedor read GetViewProveedorPedido; end; @@ -130,6 +143,8 @@ begin inherited; FFormasPago := Nil; FFormasPagoController := TFormasPagoController.Create; + FObrasController := TObrasController.Create; + FObras := FObrasController.DarListaObras; FViewProveedorPedido := frViewProveedorPedido1; FViewProveedorPedido.MsgElegirProveedor := 'Elija el proveedor al que se le realizará el pedido.'; eReferencia.Enabled := False; @@ -141,18 +156,52 @@ end; procedure TfrViewPedidoProveedor.CustomViewDestroy(Sender: TObject); begin FViewProveedorPedido := Nil; + FController := Nil; FFormasPago := Nil; FFormasPagoController := NIL; - inherited; + FObrasController := Nil; + FreeAndNil(FObras) end; -procedure TfrViewPedidoProveedor.frViewObraReserva1cbListaObrasReservaPropertiesEditValueChanged( - Sender: TObject); +procedure TfrViewPedidoProveedor.CustomViewShow(Sender: TObject); begin inherited; - ShowMessage('Hola'); + if not FPedido.ID_OBRAISNull then + frViewObraReserva1.ActivarObra(FPedido.ID_OBRA); + + frViewObraReserva1.cbObraReserva.Properties.OnEditValueChanged := ObraReservaEditValueChanged; +end; + +procedure TfrViewPedidoProveedor.ObraReservaEditValueChanged(Sender: TObject); +var + IDObra: Variant; + +begin + inherited; + IDObra := frViewObraReserva1.DarIDObraSeleccionada; + Controller.AsignarIDObra(FPedido, IDObra); + + if not VarIsNull(IDObra) then + begin + frViewDireccionEntregaPedidoProv1.rdxDestino2.Checked := True; + frViewDireccionEntregaPedidoProv1.RecuperarObra; + frViewDireccionEntregaPedidoProv1.CambioDireccionObra; + end + else + begin + + end; + + + showmessage('Cambio a radio buton de entraga de obra'); + showmessage('cargo direccion de la obnra'); + +{showmessage('hola2'); frViewDireccionEntregaPedidoProv1.PrepararObra; + frViewDireccionEntregaPedidoProv1.RecuperarObra; frViewDireccionEntregaPedidoProv1.CambioDireccionObra; + frViewDireccionEntregaPedidoProv1.rdxDestino2.Checked := true; +} end; procedure TfrViewPedidoProveedor.frViewProveedorPedidoButton1Click(Sender: TObject); @@ -177,6 +226,11 @@ begin frViewProveedorPedido1.actAnadirContacto.Execute; end; +function TfrViewPedidoProveedor.GetController: IPedidosProveedorController; +begin + Result := FController; +end; + function TfrViewPedidoProveedor.GetPedido: IBizPedidoProveedor; begin Result := FPedido; @@ -187,6 +241,15 @@ begin Result := FViewProveedorPedido; end; +procedure TfrViewPedidoProveedor.SetController(const Value: IPedidosProveedorController); +begin + FController := Value; + + if Assigned(FController) + and Assigned(FViewProveedorPedido) then + ViewProveedorPedido.Controller := Controller.ProveedorController; +end; + procedure TfrViewPedidoProveedor.SetPedido(const Value: IBizPedidoProveedor); begin FPedido := Value; @@ -213,6 +276,15 @@ begin // end // else // eReferenciaPedidoCli.Text := 'No hay pedido asociado'; + + frViewProveedorPedido1.Proveedor := FPedido.Proveedor; + frViewDireccionEntregaPedidoProv1.PedidoProveedor := FPedido; + + + frViewObraReserva1.Obras := FObras; + frViewObraReserva1.ObrasController := FObrasController; + + end else begin DADataSource.DataTable := NIL; @@ -220,9 +292,9 @@ begin // FPedidoCliAsociado := NIL; end; - frViewProveedorPedido1.Proveedor := FPedido.Proveedor; - frViewDireccionEntregaPedidoProv1.PedidoProveedor := FPedido; - frViewObraReserva1.PedidoProveedor := FPedido; + + + end; procedure TfrViewPedidoProveedor.SetViewProveedorPedido(const Value: TfrViewDatosYSeleccionProveedor); diff --git a/Source/Modulos/Relaciones/Pedidos de proveedor - Albaranes de proveedor/uGenerarAlbaranesProvUtils.pas b/Source/Modulos/Relaciones/Pedidos de proveedor - Albaranes de proveedor/uGenerarAlbaranesProvUtils.pas index ee623f35..1e4e4182 100644 --- a/Source/Modulos/Relaciones/Pedidos de proveedor - Albaranes de proveedor/uGenerarAlbaranesProvUtils.pas +++ b/Source/Modulos/Relaciones/Pedidos de proveedor - Albaranes de proveedor/uGenerarAlbaranesProvUtils.pas @@ -394,8 +394,9 @@ begin AAlbaranesProveedorController.Guardar(AAlbaran); AAlbaranesProveedorController.Ver(AAlbaran); - //Si el pedido tiene obra de reserva, preguntamos si quiere automatizar el proceso de reserva de los materiales - if (APedido.ID_OBRA > 0) then + //Si el pedido tiene obra de relacionada y el destino del pedido no es esa obra, preguntamos si quiere reservar de los materiales para esa obra + if (APedido.ID_OBRA > 0) + and (APedido.ID_OBRA <> APedido.ID_ALMACEN) then begin if Application.MessageBox(PChar('Desea realizar la reserva del material recibido para la obra ' + APedido.NOMBRE_OBRA + ', asociada al pedido'), 'Atención', MB_YESNO) = IDYES then begin diff --git a/Source/Servicios/FactuGES.RODL b/Source/Servicios/FactuGES.RODL index be2bb36c..87c5ea3f 100644 --- a/Source/Servicios/FactuGES.RODL +++ b/Source/Servicios/FactuGES.RODL @@ -160,6 +160,8 @@ + + @@ -453,6 +455,8 @@ + + diff --git a/Source/Servicios/FactuGES_Intf.pas b/Source/Servicios/FactuGES_Intf.pas index c8a9432d..ba185e19 100644 --- a/Source/Servicios/FactuGES_Intf.pas +++ b/Source/Servicios/FactuGES_Intf.pas @@ -388,7 +388,7 @@ type { IsrvAlmacenes } IsrvAlmacenes = interface(IDataAbstractService) ['{F984D2A1-9922-4790-9B2D-A78ACFDAE82B}'] - function DarListaAlmacenes: Binary; + function DarListaAlmacenes(const IDEmpresa: Integer): Binary; end; { CosrvAlmacenes } @@ -401,7 +401,7 @@ type protected function __GetInterfaceName:string; override; - function DarListaAlmacenes: Binary; + function DarListaAlmacenes(const IDEmpresa: Integer): Binary; end; { IsrvArticulos } @@ -684,7 +684,7 @@ type { IsrvObras } IsrvObras = interface(IDataAbstractService) ['{39277224-A0BD-4249-9ACA-39D238798B25}'] - function DarListaObras: Binary; + function DarListaObras(const IDEmpresa: Integer): Binary; end; { CosrvObras } @@ -697,7 +697,7 @@ type protected function __GetInterfaceName:string; override; - function DarListaObras: Binary; + function DarListaObras(const IDEmpresa: Integer): Binary; end; { IsrvProvinciasPoblaciones } @@ -1488,11 +1488,12 @@ begin result := 'srvAlmacenes'; end; -function TsrvAlmacenes_Proxy.DarListaAlmacenes: Binary; +function TsrvAlmacenes_Proxy.DarListaAlmacenes(const IDEmpresa: Integer): Binary; begin try result := nil; __Message.InitializeRequestMessage(__TransportChannel, 'FactuGES', __InterfaceName, 'DarListaAlmacenes'); + __Message.Write('IDEmpresa', TypeInfo(Integer), IDEmpresa, []); __Message.Finalize; __TransportChannel.Dispatch(__Message); @@ -2014,11 +2015,12 @@ begin result := 'srvObras'; end; -function TsrvObras_Proxy.DarListaObras: Binary; +function TsrvObras_Proxy.DarListaObras(const IDEmpresa: Integer): Binary; begin try result := nil; __Message.InitializeRequestMessage(__TransportChannel, 'FactuGES', __InterfaceName, 'DarListaObras'); + __Message.Write('IDEmpresa', TypeInfo(Integer), IDEmpresa, []); __Message.Finalize; __TransportChannel.Dispatch(__Message); diff --git a/Source/Servicios/FactuGES_Invk.pas b/Source/Servicios/FactuGES_Invk.pas index a5455678..fe860902 100644 --- a/Source/Servicios/FactuGES_Invk.pas +++ b/Source/Servicios/FactuGES_Invk.pas @@ -435,14 +435,17 @@ end; { TsrvAlmacenes_Invoker } procedure TsrvAlmacenes_Invoker.Invoke_DarListaAlmacenes(const __Instance:IInterface; const __Message:IROMessage; const __Transport:IROTransport; out __oResponseOptions:TROResponseOptions); -{ function DarListaAlmacenes: Binary; } +{ function DarListaAlmacenes(const IDEmpresa: Integer): Binary; } var + IDEmpresa: Integer; lResult: Binary; __lObjectDisposer: TROObjectDisposer; begin lResult := nil; try - lResult := (__Instance as IsrvAlmacenes).DarListaAlmacenes; + __Message.Read('IDEmpresa', TypeInfo(Integer), IDEmpresa, []); + + lResult := (__Instance as IsrvAlmacenes).DarListaAlmacenes(IDEmpresa); __Message.InitializeResponseMessage(__Transport, 'FactuGES', 'srvAlmacenes', 'DarListaAlmacenesResponse'); __Message.Write('Result', TypeInfo(Binary), lResult, []); @@ -1002,14 +1005,17 @@ end; { TsrvObras_Invoker } procedure TsrvObras_Invoker.Invoke_DarListaObras(const __Instance:IInterface; const __Message:IROMessage; const __Transport:IROTransport; out __oResponseOptions:TROResponseOptions); -{ function DarListaObras: Binary; } +{ function DarListaObras(const IDEmpresa: Integer): Binary; } var + IDEmpresa: Integer; lResult: Binary; __lObjectDisposer: TROObjectDisposer; begin lResult := nil; try - lResult := (__Instance as IsrvObras).DarListaObras; + __Message.Read('IDEmpresa', TypeInfo(Integer), IDEmpresa, []); + + lResult := (__Instance as IsrvObras).DarListaObras(IDEmpresa); __Message.InitializeResponseMessage(__Transport, 'FactuGES', 'srvObras', 'DarListaObrasResponse'); __Message.Write('Result', TypeInfo(Binary), lResult, []); diff --git a/Source/Servicios/RODLFILE.res b/Source/Servicios/RODLFILE.res index d5f59af7..b8c2ca8b 100644 Binary files a/Source/Servicios/RODLFILE.res and b/Source/Servicios/RODLFILE.res differ diff --git a/Source/Servidor/FactuGES_Server.RES b/Source/Servidor/FactuGES_Server.RES index 701b1cd3..2896e98d 100644 Binary files a/Source/Servidor/FactuGES_Server.RES and b/Source/Servidor/FactuGES_Server.RES differ diff --git a/Source/Servidor/FactuGES_Server.dpr b/Source/Servidor/FactuGES_Server.dpr index f6fc0770..624e0c9d 100644 --- a/Source/Servidor/FactuGES_Server.dpr +++ b/Source/Servidor/FactuGES_Server.dpr @@ -17,10 +17,10 @@ uses srvLogin_Impl in 'srvLogin_Impl.pas' {srvLogin: TDARemoteService}, srvEmpresas_Impl in '..\ApplicationBase\Empresas\Servidor\srvEmpresas_Impl.pas' {srvEmpresas: TDARemoteService}, srvConfiguracion_Impl in 'Configuracion\srvConfiguracion_Impl.pas' {srvConfiguracion: TDataAbstractService}, - srvFamilias_Impl in '..\Modulos\Familias\Servidor\srvFamilias_Impl.pas', - srvFormasPago_Impl in '..\Modulos\Formas de pago\Servidor\srvFormasPago_Impl.pas', - srvTiposIVA_Impl in '..\Modulos\Tipos de IVA\Servidor\srvTiposIVA_Impl.pas', - srvUsuarios_Impl in '..\ApplicationBase\Usuarios\Servidor\srvUsuarios_Impl.pas', + srvFamilias_Impl in '..\Modulos\Familias\Servidor\srvFamilias_Impl.pas' {srvFamilias: TDataAbstractService}, + srvFormasPago_Impl in '..\Modulos\Formas de pago\Servidor\srvFormasPago_Impl.pas' {srvFormasPago: TDataAbstractService}, + srvTiposIVA_Impl in '..\Modulos\Tipos de IVA\Servidor\srvTiposIVA_Impl.pas' {srvTiposIVA: TDataAbstractService}, + srvUsuarios_Impl in '..\ApplicationBase\Usuarios\Servidor\srvUsuarios_Impl.pas' {srvUsuarios: TDataAbstractService}, RegExpr in 'Utiles\RegExpr.pas', uBusinessUtils in 'Utiles\uBusinessUtils.pas', uDatabaseUtils in 'Utiles\uDatabaseUtils.pas', @@ -89,10 +89,10 @@ uses schFabricantesServer_Intf in '..\Modulos\Fabricantes\Model\schFabricantesServer_Intf.pas', uRptPedidosProveedor_Server in '..\Modulos\Pedidos a proveedor\Reports\uRptPedidosProveedor_Server.pas' {RptPedidosProveedor: TDataModule}, uRptWordPedidoProveedor in '..\Modulos\Pedidos a proveedor\Reports\uRptWordPedidoProveedor.pas' {RptWordPedidoProveedor: TDataModule}, - srvObras_Impl in '..\Modulos\Obras\Servidor\srvObras_Impl.pas', + srvObras_Impl in '..\Modulos\Obras\Servidor\srvObras_Impl.pas' {srvObras: TDataAbstractService}, uBizObrasServer in '..\Modulos\Obras\Model\uBizObrasServer.pas', uRptRecibosCliente_Server in '..\Modulos\Recibos de cliente\Reports\uRptRecibosCliente_Server.pas' {RptRecibosCliente: TDataModule}, - srvProvinciasPoblaciones_Impl in '..\ApplicationBase\ProvinciasPoblaciones\Servidor\srvProvinciasPoblaciones_Impl.pas', + srvProvinciasPoblaciones_Impl in '..\ApplicationBase\ProvinciasPoblaciones\Servidor\srvProvinciasPoblaciones_Impl.pas' {srvProvinciasPoblaciones_Impl: TDataModule}, uBizArticulosServer in '..\Modulos\Articulos\Model\uBizArticulosServer.pas', uBizEmpresasServer in '..\ApplicationBase\Empresas\Model\uBizEmpresasServer.pas', schAlmacenesClient_Intf in '..\Modulos\Almacenes\Model\schAlmacenesClient_Intf.pas', diff --git a/Source/Servidor/FactuGES_Server.dproj b/Source/Servidor/FactuGES_Server.dproj index 1a477607..2837fc96 100644 --- a/Source/Servidor/FactuGES_Server.dproj +++ b/Source/Servidor/FactuGES_Server.dproj @@ -49,10 +49,16 @@
srvEmpresas
TDARemoteService
- + +
srvProvinciasPoblaciones_Impl
+ TDataModule +
- + +
srvUsuarios
+ TDataAbstractService +
@@ -143,10 +149,16 @@ - + +
srvFamilias
+ TDataAbstractService +
- + +
srvFormasPago
+ TDataAbstractService +
srvGestorDocumentos
TDataAbstractService @@ -170,7 +182,10 @@ - + +
srvUsuarios
+ TDataAbstractService +
@@ -247,7 +262,10 @@ - + +
srvTiposIVA
+ TDataAbstractService +
diff --git a/Source/Servidor/FactuGES_Server.rc b/Source/Servidor/FactuGES_Server.rc index 0a3d5b44..a5006874 100644 --- a/Source/Servidor/FactuGES_Server.rc +++ b/Source/Servidor/FactuGES_Server.rc @@ -14,7 +14,7 @@ BEGIN BEGIN VALUE "FileVersion", "1.4.3.0\0" VALUE "ProductVersion", "1.4.3.0\0" - VALUE "CompileDate", "jueves, 06 de noviembre de 2008 11:20\0" + VALUE "CompileDate", "viernes, 07 de noviembre de 2008 12:02\0" END END BLOCK "VarFileInfo"