Pedidos a proveedor: mejorada la reserva para obras y dirección de entrega.
git-svn-id: https://192.168.0.254/svn/Proyectos.Tecsitel_FactuGES2/trunk@741 0c75b7a4-871f-7646-8a2f-f78d34cc349f
This commit is contained in:
parent
100a6a501e
commit
562ad3812d
@ -98,47 +98,11 @@ inherited frViewDireccionEntregaPedidoProv: TfrViewDireccionEntregaPedidoProv
|
||||
object RadioButton1: TRadioButton
|
||||
Left = 10
|
||||
Top = 39
|
||||
Width = 383
|
||||
Width = 231
|
||||
Height = 17
|
||||
Action = actListaObras
|
||||
TabOrder = 2
|
||||
end
|
||||
object cbListaObras: TcxDBLookupComboBox
|
||||
Left = 414
|
||||
Top = 37
|
||||
Anchors = [akLeft, akTop, akRight]
|
||||
DataBinding.DataField = 'ID_ALMACEN'
|
||||
DataBinding.DataSource = dsPedido
|
||||
Properties.DropDownListStyle = lsFixedList
|
||||
Properties.ImmediatePost = True
|
||||
Properties.KeyFieldNames = 'ID'
|
||||
Properties.ListColumns = <
|
||||
item
|
||||
FieldName = 'NOMBRE'
|
||||
end>
|
||||
Properties.ListOptions.AnsiSort = True
|
||||
Properties.ListOptions.GridLines = glNone
|
||||
Properties.ListOptions.ShowHeader = False
|
||||
Properties.ListOptions.SyncMode = True
|
||||
Properties.ListSource = dsObras
|
||||
Properties.PostPopupValueOnTab = True
|
||||
Properties.OnValidate = cbListaObrasPropertiesValidate
|
||||
Style.BorderColor = clWindowFrame
|
||||
Style.BorderStyle = ebs3D
|
||||
Style.HotTrack = False
|
||||
Style.LookAndFeel.NativeStyle = True
|
||||
Style.LookAndFeel.SkinName = ''
|
||||
Style.ButtonStyle = bts3D
|
||||
Style.PopupBorderStyle = epbsFrame3D
|
||||
StyleDisabled.LookAndFeel.NativeStyle = True
|
||||
StyleDisabled.LookAndFeel.SkinName = ''
|
||||
StyleFocused.LookAndFeel.NativeStyle = True
|
||||
StyleFocused.LookAndFeel.SkinName = ''
|
||||
StyleHot.LookAndFeel.NativeStyle = True
|
||||
StyleHot.LookAndFeel.SkinName = ''
|
||||
TabOrder = 3
|
||||
Width = 128
|
||||
end
|
||||
object edtEntregarA: TcxDBButtonEdit
|
||||
Left = 10
|
||||
Top = 209
|
||||
@ -170,6 +134,19 @@ inherited frViewDireccionEntregaPedidoProv: TfrViewDireccionEntregaPedidoProv
|
||||
TabOrder = 7
|
||||
Width = 334
|
||||
end
|
||||
object lblNombreObra: TcxDBLabel
|
||||
Left = 247
|
||||
Top = 37
|
||||
DataBinding.DataField = 'NOMBRE_OBRA'
|
||||
DataBinding.DataSource = dsPedido
|
||||
Style.HotTrack = False
|
||||
Style.LookAndFeel.SkinName = ''
|
||||
StyleDisabled.LookAndFeel.SkinName = ''
|
||||
StyleFocused.LookAndFeel.SkinName = ''
|
||||
StyleHot.LookAndFeel.SkinName = ''
|
||||
Height = 21
|
||||
Width = 121
|
||||
end
|
||||
object dxLayoutGroup1: TdxLayoutGroup
|
||||
ShowCaption = False
|
||||
Hidden = True
|
||||
@ -215,13 +192,12 @@ inherited frViewDireccionEntregaPedidoProv: TfrViewDireccionEntregaPedidoProv
|
||||
ControlOptions.AutoColor = True
|
||||
ControlOptions.ShowBorder = False
|
||||
end
|
||||
object dxLayoutControl1Item6: TdxLayoutItem
|
||||
AutoAligns = [aaVertical]
|
||||
object dxLayoutControl1Item9: TdxLayoutItem
|
||||
AutoAligns = []
|
||||
AlignHorz = ahClient
|
||||
Offsets.Left = 15
|
||||
AlignVert = avCenter
|
||||
ShowCaption = False
|
||||
Visible = False
|
||||
Control = cbListaObras
|
||||
Control = lblNombreObra
|
||||
ControlOptions.ShowBorder = False
|
||||
end
|
||||
end
|
||||
@ -290,6 +266,7 @@ inherited frViewDireccionEntregaPedidoProv: TfrViewDireccionEntregaPedidoProv
|
||||
end
|
||||
end
|
||||
object dsPedido: TDADataSource
|
||||
OnDataChange = dsPedidoDataChange
|
||||
Left = 352
|
||||
Top = 8
|
||||
end
|
||||
|
||||
@ -9,7 +9,7 @@ uses
|
||||
cxDBLookupEdit, cxDBLookupComboBox, StdCtrls, cxControls, DB, uDADataTable,
|
||||
ActnList, uBizAlmacenes, uAlmacenesController, uPedidosProveedorController,
|
||||
Buttons, uDAInterfaces, uBizObras, uObrasController, cxButtonEdit, cxDBEdit,
|
||||
ExtCtrls;
|
||||
ExtCtrls, cxLabel, cxDBLabel;
|
||||
|
||||
type
|
||||
IViewDireccionEntregaPedidoProv = interface(IViewBase)
|
||||
@ -39,8 +39,6 @@ type
|
||||
dxLayoutControl1Item5: TdxLayoutItem;
|
||||
dxLayoutControl1Item4: TdxLayoutItem;
|
||||
RadioButton1: TRadioButton;
|
||||
dxLayoutControl1Item6: TdxLayoutItem;
|
||||
cbListaObras: TcxDBLookupComboBox;
|
||||
dsObras: TDADataSource;
|
||||
actListaObras: TAction;
|
||||
Bevel1: TBevel;
|
||||
@ -50,34 +48,36 @@ type
|
||||
dxLayoutControl1Group1: TdxLayoutGroup;
|
||||
dxLayoutControl1Group2: TdxLayoutGroup;
|
||||
dxLayoutControl1Group3: TdxLayoutGroup;
|
||||
lblNombreObra: TcxDBLabel;
|
||||
dxLayoutControl1Item9: TdxLayoutItem;
|
||||
procedure actListaAlmacenesExecute(Sender: TObject);
|
||||
procedure actOtroExecute(Sender: TObject);
|
||||
procedure cbListaAlmacenesPropertiesValidate(Sender: TObject; var DisplayValue: Variant; var ErrorText: TCaption; var Error: Boolean);
|
||||
procedure cbListaObrasPropertiesValidate(Sender: TObject; var DisplayValue: Variant; var ErrorText: TCaption; var Error: Boolean);
|
||||
procedure bModificarClick(Sender: TObject);
|
||||
procedure txtDireccionDblClick(Sender: TObject);
|
||||
procedure actListaObrasExecute(Sender: TObject);
|
||||
procedure edtEntregarAPropertiesButtonClick(Sender: TObject;
|
||||
AButtonIndex: Integer);
|
||||
procedure dsPedidoDataChange(Sender: TObject; Field: TField);
|
||||
protected
|
||||
FAlmacenesController : IAlmacenesController;
|
||||
FAlmacenes: IBizAlmacen;
|
||||
FObrasController : IObrasController;
|
||||
FObras: IBizObra;
|
||||
FObra: IBizObra;
|
||||
FPedido : IBizPedidoProveedor;
|
||||
FController : IPedidosProveedorController;
|
||||
function GetPedidoProveedor: IBizPedidoProveedor;
|
||||
procedure SetPedidoProveedor(const Value: IBizPedidoProveedor);
|
||||
procedure CambioDireccionAlmacen;
|
||||
procedure CambioDireccionObra;
|
||||
procedure RefrescarDireccion;
|
||||
procedure PrepararObra;
|
||||
procedure RefrescarControles;
|
||||
procedure SetReadOnly(Value: Boolean); override;
|
||||
procedure ID_OBRAOnChange(Sender: TDACustomField);
|
||||
procedure RecuperarObra;
|
||||
public
|
||||
property PedidoProveedor: IBizPedidoProveedor read GetPedidoProveedor write SetPedidoProveedor;
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
procedure PrepararObra;
|
||||
procedure CambioDireccionObra;
|
||||
end;
|
||||
|
||||
implementation
|
||||
@ -90,21 +90,20 @@ uses
|
||||
procedure TfrViewDireccionEntregaPedidoProv.actListaAlmacenesExecute(Sender: TObject);
|
||||
begin
|
||||
actListaAlmacenes.Checked := True;
|
||||
RefrescarDireccion;
|
||||
RefrescarControles;
|
||||
end;
|
||||
|
||||
procedure TfrViewDireccionEntregaPedidoProv.actListaObrasExecute(
|
||||
Sender: TObject);
|
||||
begin
|
||||
actListaObras.Checked := True;
|
||||
RefrescarDireccion;
|
||||
RefrescarControles;
|
||||
CambioDireccionObra;
|
||||
end;
|
||||
|
||||
procedure TfrViewDireccionEntregaPedidoProv.actOtroExecute(Sender: TObject);
|
||||
begin
|
||||
actOtro.Checked := True;
|
||||
// txtDireccion.Enabled := True;
|
||||
|
||||
if Assigned(FPedido) then
|
||||
begin
|
||||
@ -116,7 +115,7 @@ begin
|
||||
FPedido.ID_ALMACEN := 0;
|
||||
end;
|
||||
end;
|
||||
RefrescarDireccion;
|
||||
RefrescarControles;
|
||||
end;
|
||||
|
||||
procedure TfrViewDireccionEntregaPedidoProv.bModificarClick(Sender: TObject);
|
||||
@ -135,32 +134,24 @@ begin
|
||||
FPedido.POBLACION := FAlmacenes.POBLACION;
|
||||
FPedido.PROVINCIA := FAlmacenes.PROVINCIA;
|
||||
FPedido.CODIGO_POSTAL := FAlmacenes.CODIGO_POSTAL;
|
||||
RefrescarDireccion;
|
||||
RefrescarControles;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrViewDireccionEntregaPedidoProv.CambioDireccionObra;
|
||||
begin
|
||||
if Assigned(FPedido) and Assigned(FObras) then
|
||||
if Assigned(FPedido) and Assigned(FObra) then
|
||||
begin
|
||||
FPedido.Edit;
|
||||
FPedido.CALLE := FObras.CALLE;
|
||||
FPedido.POBLACION := FObras.POBLACION;
|
||||
FPedido.POBLACION := FObras.POBLACION;
|
||||
FPedido.PROVINCIA := FObras.PROVINCIA;
|
||||
FPedido.CODIGO_POSTAL := FObras.CODIGO_POSTAL;
|
||||
RefrescarDireccion;
|
||||
FPedido.CALLE := FObra.CALLE;
|
||||
FPedido.POBLACION := FObra.POBLACION;
|
||||
FPedido.POBLACION := FObra.POBLACION;
|
||||
FPedido.PROVINCIA := FObra.PROVINCIA;
|
||||
FPedido.CODIGO_POSTAL := FObra.CODIGO_POSTAL;
|
||||
RefrescarControles;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrViewDireccionEntregaPedidoProv.cbListaObrasPropertiesValidate(
|
||||
Sender: TObject; var DisplayValue: Variant; var ErrorText: TCaption;
|
||||
var Error: Boolean);
|
||||
begin
|
||||
if Assigned(FPedido) and Assigned(FObras) and (FPedido.ID_ALMACEN <> FObras.ID) then
|
||||
CambioDireccionObra;
|
||||
end;
|
||||
|
||||
procedure TfrViewDireccionEntregaPedidoProv.cbListaAlmacenesPropertiesValidate(
|
||||
Sender: TObject; var DisplayValue: Variant; var ErrorText: TCaption;
|
||||
var Error: Boolean);
|
||||
@ -179,27 +170,43 @@ begin
|
||||
dsAlmacenes.DataTable := FAlmacenes.DataTable;
|
||||
|
||||
FObrasController := TObrasController.Create;
|
||||
FObras := FObrasController.BuscarTodos;
|
||||
FObras.DataTable.Active := True;
|
||||
dsObras.DataTable := FObras.DataTable;
|
||||
|
||||
FObra := NIL;
|
||||
end;
|
||||
|
||||
destructor TfrViewDireccionEntregaPedidoProv.Destroy;
|
||||
begin
|
||||
cbListaObras.Properties.OnValidate := Nil;
|
||||
//cbListaObras.Properties.OnValidate := Nil;
|
||||
cbListaAlmacenes.Properties.OnValidate := Nil;
|
||||
|
||||
FAlmacenesController := Nil;
|
||||
FAlmacenes := Nil;
|
||||
|
||||
FObrasController := Nil;
|
||||
FObras := Nil;
|
||||
FObra := NIL;
|
||||
|
||||
FController := NIL;
|
||||
inherited;
|
||||
end;
|
||||
|
||||
procedure TfrViewDireccionEntregaPedidoProv.dsPedidoDataChange(Sender: TObject;
|
||||
Field: TField);
|
||||
begin
|
||||
inherited;
|
||||
|
||||
if Assigned(Field) and (Field.FieldName = 'ID_OBRA') then
|
||||
begin
|
||||
PrepararObra;
|
||||
if actListaObras.Enabled then
|
||||
begin
|
||||
if not Assigned(FObra) then
|
||||
RecuperarObra;
|
||||
CambioDireccionObra
|
||||
end
|
||||
else
|
||||
FObra := NIL;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrViewDireccionEntregaPedidoProv.edtEntregarAPropertiesButtonClick(
|
||||
Sender: TObject; AButtonIndex: Integer);
|
||||
var
|
||||
@ -209,9 +216,15 @@ begin
|
||||
inherited;
|
||||
AID_Subcontrata := -1;
|
||||
|
||||
{ ********************************************************* REPASAR
|
||||
if actListaObras.Checked then
|
||||
AID_Subcontrata := FObras.ID_SUBCONTRATA;}
|
||||
if not FPedido.ID_OBRAIsNull then
|
||||
begin
|
||||
RecuperarObra;
|
||||
if FObrasController.LocalizarEjecucionActiva(FObra.Ejecuciones) then
|
||||
begin
|
||||
if not FObra.Ejecuciones.ID_SUBCONTRATAIsNull then
|
||||
AID_Subcontrata := FObra.Ejecuciones.ID_SUBCONTRATA;
|
||||
end;
|
||||
end;
|
||||
|
||||
APersonaContacto := FPedido.PERSONA_CONTACTO;
|
||||
|
||||
@ -227,14 +240,16 @@ begin
|
||||
Result := FPedido;
|
||||
end;
|
||||
|
||||
procedure TfrViewDireccionEntregaPedidoProv.ID_OBRAOnChange(
|
||||
Sender: TDACustomField);
|
||||
procedure TfrViewDireccionEntregaPedidoProv.RecuperarObra;
|
||||
begin
|
||||
PrepararObra;
|
||||
CambioDireccionObra;
|
||||
if Assigned(FObra) and (FObra.ID = FPedido.ID_OBRA) then
|
||||
Exit; // No hace falta volver a recuperarla
|
||||
|
||||
FObra := FObrasController.Buscar(FPedido.ID_OBRA);
|
||||
FObra.Open;
|
||||
end;
|
||||
|
||||
procedure TfrViewDireccionEntregaPedidoProv.RefrescarDireccion;
|
||||
procedure TfrViewDireccionEntregaPedidoProv.RefrescarControles;
|
||||
begin
|
||||
txtDireccion.Caption := '';
|
||||
if Assigned(FPedido) then
|
||||
@ -243,8 +258,6 @@ begin
|
||||
begin
|
||||
cbListaAlmacenes.Enabled := False;
|
||||
cbListaAlmacenes.Text := '';
|
||||
cbListaObras.Enabled := False;
|
||||
cbListaObras.Text := '';
|
||||
|
||||
txtDireccion.Enabled := True;
|
||||
txtDireccion.Caption := FPedido.CALLE;
|
||||
@ -255,8 +268,6 @@ begin
|
||||
else if (actListaAlmacenes.Checked) then
|
||||
begin
|
||||
txtDireccion.Enabled := False;
|
||||
cbListaObras.Enabled := False;
|
||||
cbListaObras.Text := '';
|
||||
|
||||
cbListaAlmacenes.Enabled := True;
|
||||
cbListaAlmacenes.DroppedDown := True;
|
||||
@ -268,9 +279,6 @@ begin
|
||||
txtDireccion.Enabled := False;
|
||||
cbListaAlmacenes.Enabled := False;
|
||||
cbListaAlmacenes.Text := '';
|
||||
|
||||
cbListaObras.Enabled := True;
|
||||
cbListaObras.DroppedDown := True;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
@ -281,34 +289,24 @@ begin
|
||||
if FPedido.ID_OBRAIsNull then
|
||||
begin
|
||||
actListaObras.Enabled := False;
|
||||
actListaObras.Caption := 'Recibir el pedido en la dirección de la obra.';
|
||||
|
||||
if actListaObras.Checked then
|
||||
actListaAlmacenes.Execute;
|
||||
end
|
||||
else begin
|
||||
else
|
||||
actListaObras.Enabled := True;
|
||||
|
||||
FObras.DataTable.First;
|
||||
FObras.DataTable.Locate('ID', FPedido.ID_OBRA, []);
|
||||
actListaObras.Caption := 'Recibir el pedido en la dirección de la obra (' + FObras.NOMBRE + ')';
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrViewDireccionEntregaPedidoProv.SetPedidoProveedor(
|
||||
const Value: IBizPedidoProveedor);
|
||||
begin
|
||||
cbListaAlmacenes.Properties.OnValidate := NIL;
|
||||
cbListaObras.Properties.OnValidate := NIL;
|
||||
dsPedido.DataTable := nil;
|
||||
|
||||
FPedido := Value;
|
||||
|
||||
dsPedido.DataTable := FPedido.DataTable;
|
||||
FPedido.DataTable.FieldByName('ID_OBRA').OnChange := ID_OBRAOnChange;
|
||||
|
||||
cbListaAlmacenes.Properties.OnValidate := cbListaAlmacenesPropertiesValidate;
|
||||
cbListaObras.Properties.OnValidate := cbListaObrasPropertiesValidate;
|
||||
|
||||
if (FPedido.EsNuevo) then
|
||||
CambioDireccionAlmacen
|
||||
@ -323,7 +321,7 @@ begin
|
||||
actOtro.Checked := True;
|
||||
end;
|
||||
PrepararObra;
|
||||
RefrescarDireccion;
|
||||
RefrescarControles;
|
||||
end;
|
||||
|
||||
procedure TfrViewDireccionEntregaPedidoProv.SetReadOnly(Value: Boolean);
|
||||
|
||||
@ -1,22 +1,19 @@
|
||||
inherited frViewObraReserva: TfrViewObraReserva
|
||||
Width = 586
|
||||
Height = 73
|
||||
Height = 68
|
||||
OnShow = CustomViewShow
|
||||
ExplicitWidth = 586
|
||||
ExplicitHeight = 73
|
||||
ExplicitHeight = 68
|
||||
object dxLayoutControl1: TdxLayoutControl
|
||||
Left = 0
|
||||
Top = 0
|
||||
Width = 586
|
||||
Height = 73
|
||||
Height = 68
|
||||
Align = alClient
|
||||
ParentBackground = True
|
||||
TabOrder = 0
|
||||
TabStop = False
|
||||
AutoContentSizes = [acsWidth, acsHeight]
|
||||
ExplicitHeight = 66
|
||||
DesignSize = (
|
||||
586
|
||||
73)
|
||||
object Label1: TLabel
|
||||
Left = 10
|
||||
Top = 10
|
||||
@ -24,43 +21,6 @@ inherited frViewObraReserva: TfrViewObraReserva
|
||||
Height = 13
|
||||
Caption = 'Reservar el material de este pedido para la obra:'
|
||||
end
|
||||
object cbListaObrasReserva: TcxDBLookupComboBox
|
||||
Left = 25
|
||||
Top = 31
|
||||
Anchors = [akLeft, akTop, akRight]
|
||||
DataBinding.DataField = 'ID_OBRA'
|
||||
DataBinding.DataSource = dsPedido
|
||||
Properties.DropDownListStyle = lsFixedList
|
||||
Properties.ImmediatePost = True
|
||||
Properties.KeyFieldNames = 'ID'
|
||||
Properties.ListColumns = <
|
||||
item
|
||||
SortOrder = soAscending
|
||||
FieldName = 'NOMBRE'
|
||||
end>
|
||||
Properties.ListOptions.AnsiSort = True
|
||||
Properties.ListOptions.GridLines = glNone
|
||||
Properties.ListOptions.ShowHeader = False
|
||||
Properties.ListOptions.SyncMode = True
|
||||
Properties.ListSource = dsObras
|
||||
Properties.PostPopupValueOnTab = True
|
||||
Properties.OnEditValueChanged = cbListaObrasReservaPropertiesEditValueChanged
|
||||
Style.BorderColor = clWindowFrame
|
||||
Style.BorderStyle = ebs3D
|
||||
Style.HotTrack = False
|
||||
Style.LookAndFeel.NativeStyle = True
|
||||
Style.LookAndFeel.SkinName = ''
|
||||
Style.ButtonStyle = bts3D
|
||||
Style.PopupBorderStyle = epbsFrame3D
|
||||
StyleDisabled.LookAndFeel.NativeStyle = True
|
||||
StyleDisabled.LookAndFeel.SkinName = ''
|
||||
StyleFocused.LookAndFeel.NativeStyle = True
|
||||
StyleFocused.LookAndFeel.SkinName = ''
|
||||
StyleHot.LookAndFeel.NativeStyle = True
|
||||
StyleHot.LookAndFeel.SkinName = ''
|
||||
TabOrder = 0
|
||||
Width = 168
|
||||
end
|
||||
object Button3: TBitBtn
|
||||
Left = 432
|
||||
Top = 29
|
||||
@ -105,6 +65,18 @@ inherited frViewObraReserva: TfrViewObraReserva
|
||||
FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00
|
||||
FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00}
|
||||
end
|
||||
object cbObraReserva: TComboBox
|
||||
Left = 10
|
||||
Top = 31
|
||||
Width = 475
|
||||
Height = 21
|
||||
AutoDropDown = True
|
||||
AutoCloseUp = True
|
||||
Style = csDropDownList
|
||||
ItemHeight = 13
|
||||
TabOrder = 0
|
||||
OnChange = cbObraReservaChange
|
||||
end
|
||||
object dxLayoutGroup1: TdxLayoutGroup
|
||||
ShowCaption = False
|
||||
Hidden = True
|
||||
@ -121,13 +93,12 @@ inherited frViewObraReserva: TfrViewObraReserva
|
||||
Hidden = True
|
||||
LayoutDirection = ldHorizontal
|
||||
ShowBorder = False
|
||||
object dxLayoutControl1Item6: TdxLayoutItem
|
||||
object dxLayoutControl1Item5: TdxLayoutItem
|
||||
AutoAligns = []
|
||||
AlignHorz = ahClient
|
||||
AlignVert = avCenter
|
||||
Offsets.Left = 15
|
||||
ShowCaption = False
|
||||
Control = cbListaObrasReserva
|
||||
Control = cbObraReserva
|
||||
ControlOptions.ShowBorder = False
|
||||
end
|
||||
object dxLayoutControl1Item2: TdxLayoutItem
|
||||
@ -144,10 +115,6 @@ inherited frViewObraReserva: TfrViewObraReserva
|
||||
Left = 200
|
||||
Top = 8
|
||||
end
|
||||
object dsObras: TDADataSource
|
||||
Left = 160
|
||||
Top = 8
|
||||
end
|
||||
object PngImageList: TPngImageList
|
||||
PngImages = <
|
||||
item
|
||||
|
||||
@ -23,27 +23,31 @@ type
|
||||
dxLayoutControl1: TdxLayoutControl;
|
||||
dxLayoutGroup1: TdxLayoutGroup;
|
||||
dsPedido: TDADataSource;
|
||||
dxLayoutControl1Item6: TdxLayoutItem;
|
||||
cbListaObrasReserva: TcxDBLookupComboBox;
|
||||
dsObras: TDADataSource;
|
||||
Label1: TLabel;
|
||||
dxLayoutControl1Item1: TdxLayoutItem;
|
||||
dxLayoutControl1Item2: TdxLayoutItem;
|
||||
Button3: TBitBtn;
|
||||
dxLayoutControl1Group1: TdxLayoutGroup;
|
||||
PngImageList: TPngImageList;
|
||||
ActionList1: TActionList;
|
||||
actVerObra: TAction;
|
||||
cbObraReserva: TComboBox;
|
||||
dxLayoutControl1Item5: TdxLayoutItem;
|
||||
dxLayoutControl1Group1: TdxLayoutGroup;
|
||||
procedure actVerObraExecute(Sender: TObject);
|
||||
procedure actVerObraUpdate(Sender: TObject);
|
||||
procedure cbListaObrasReservaPropertiesEditValueChanged(Sender: TObject);
|
||||
procedure cbObraReservaChange(Sender: TObject);
|
||||
procedure CustomViewShow(Sender: TObject);
|
||||
protected
|
||||
FObrasController : IObrasController;
|
||||
FObras: IBizObra;
|
||||
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;
|
||||
public
|
||||
property PedidoProveedor: IBizPedidoProveedor read GetPedidoProveedor write SetPedidoProveedor;
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
@ -59,50 +63,87 @@ uses
|
||||
uStringsUtils;
|
||||
|
||||
procedure TfrViewObraReserva.actVerObraExecute(Sender: TObject);
|
||||
var
|
||||
AObra : IBizObra;
|
||||
AID : Integer;
|
||||
begin
|
||||
inherited;
|
||||
FObrasController.Ver(FObras);
|
||||
AID := StrToInt(FListaObras.Values[FListaObras.Names[cbObraReserva.ItemIndex-1]]);
|
||||
AObra := FObrasController.Buscar(AID);
|
||||
if Assigned(AObra) then
|
||||
try
|
||||
FObrasController.Ver(AObra);
|
||||
finally
|
||||
AObra := NIL;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrViewObraReserva.actVerObraUpdate(Sender: TObject);
|
||||
begin
|
||||
inherited;
|
||||
(Sender as TAction).Enabled := Assigned(FObras) and
|
||||
(not EsCadenaVacia(cbListaObrasReserva.Text));
|
||||
(Sender as TAction).Enabled := Assigned(FListaObras) and
|
||||
(not EsCadenaVacia(cbObraReserva.Text));
|
||||
end;
|
||||
|
||||
procedure TfrViewObraReserva.cbListaObrasReservaPropertiesEditValueChanged(
|
||||
Sender: TObject);
|
||||
procedure TfrViewObraReserva.CargarObra;
|
||||
var
|
||||
i : integer;
|
||||
begin
|
||||
cbObraReserva.ItemIndex := 0;
|
||||
|
||||
if not FPedido.Active then
|
||||
FPedido.Open;
|
||||
|
||||
if not FPedido.ID_OBRAIsNull then
|
||||
begin
|
||||
for i := 0 to FListaObras.Count - 1 do
|
||||
begin
|
||||
if IntToStr(FPedido.ID_OBRA) = FListaObras.Values[FListaObras.Names[i]] then
|
||||
begin
|
||||
cbObraReserva.ItemIndex := i + 1;
|
||||
Exit;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrViewObraReserva.cbObraReservaChange(Sender: TObject);
|
||||
begin
|
||||
inherited;
|
||||
{ if Assigned(FPedido) and (FPedido.Active) then
|
||||
begin
|
||||
if not (FPedido.ID_OBRAIsNull) and (FPedido.NOMBRE_OBRA <> cbListaObrasReserva.Text) then
|
||||
begin
|
||||
FPedido.Edit;
|
||||
FPedido.NOMBRE_OBRA := cbListaObrasReserva.Text;
|
||||
end;
|
||||
end;}
|
||||
SalvarObra;
|
||||
end;
|
||||
|
||||
constructor TfrViewObraReserva.Create(AOwner: TComponent);
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
inherited;
|
||||
FController := TPedidosProveedorController.Create;
|
||||
FObrasController := TObrasController.Create;
|
||||
FObras := FObrasController.BuscarTodos;
|
||||
FObras.DataTable.Active := True;
|
||||
dsObras.DataTable := FObras.DataTable;
|
||||
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;
|
||||
end;
|
||||
|
||||
procedure TfrViewObraReserva.CustomViewShow(Sender: TObject);
|
||||
begin
|
||||
inherited;
|
||||
cbObraReserva.Enabled := not Self.ReadOnly;
|
||||
end;
|
||||
|
||||
destructor TfrViewObraReserva.Destroy;
|
||||
begin
|
||||
cbListaObrasReserva.Properties.OnEditValueChanged := NIL;
|
||||
|
||||
FObrasController := Nil;
|
||||
FObras := Nil;
|
||||
|
||||
FController := NIL;
|
||||
|
||||
FreeANDNIL(FListaObras);
|
||||
inherited;
|
||||
end;
|
||||
|
||||
@ -111,16 +152,42 @@ begin
|
||||
Result := FPedido;
|
||||
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]];
|
||||
FPedido.Edit;
|
||||
FPedido.ID_OBRA := StrToInt(AID);
|
||||
FPedido.NOMBRE_OBRA := FListaObras.Names[cbObraReserva.ItemIndex-1];
|
||||
end
|
||||
else begin
|
||||
FPedido.Edit;
|
||||
FPedido.ClearField('ID_OBRA');
|
||||
FPedido.ClearField('NOMBRE_OBRA');
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrViewObraReserva.SetPedidoProveedor(
|
||||
const Value: IBizPedidoProveedor);
|
||||
begin
|
||||
dsPedido.DataTable := nil;
|
||||
cbListaObrasReserva.Properties.OnEditValueChanged := NIL;
|
||||
|
||||
FPedido := Value;
|
||||
dsPedido.DataTable := FPedido.DataTable;
|
||||
cbListaObrasReserva.Properties.OnEditValueChanged := cbListaObrasReservaPropertiesEditValueChanged;
|
||||
CargarObra;
|
||||
end;
|
||||
|
||||
|
||||
procedure TfrViewObraReserva.SetReadOnly(Value: Boolean);
|
||||
begin
|
||||
inherited;
|
||||
if (csLoading in Self.ComponentState) then
|
||||
Exit;
|
||||
cbObraReserva.Enabled := not Self.ReadOnly;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
@ -15,7 +15,6 @@ inherited frViewPedidoProveedor: TfrViewPedidoProveedor
|
||||
TabOrder = 0
|
||||
TabStop = False
|
||||
AutoContentSizes = [acsWidth, acsHeight]
|
||||
ExplicitHeight = 546
|
||||
DesignSize = (
|
||||
965
|
||||
560)
|
||||
@ -171,6 +170,10 @@ inherited frViewPedidoProveedor: TfrViewPedidoProveedor
|
||||
ExplicitTop = 200
|
||||
end
|
||||
inherited cbListaAlmacenes: TcxDBLookupComboBox
|
||||
Style.LookAndFeel.SkinName = ''
|
||||
StyleDisabled.LookAndFeel.SkinName = ''
|
||||
StyleFocused.LookAndFeel.SkinName = ''
|
||||
StyleHot.LookAndFeel.SkinName = ''
|
||||
end
|
||||
inherited bModificar: TBitBtn
|
||||
Left = 294
|
||||
@ -179,23 +182,39 @@ inherited frViewPedidoProveedor: TfrViewPedidoProveedor
|
||||
ExplicitTop = 164
|
||||
end
|
||||
inherited txtDireccion: TStaticText
|
||||
Height = 37
|
||||
ExplicitHeight = 37
|
||||
Height = 68
|
||||
ExplicitHeight = 68
|
||||
end
|
||||
inherited RadioButton1: TRadioButton
|
||||
Width = 342
|
||||
ExplicitWidth = 342
|
||||
Width = 223
|
||||
ExplicitWidth = 223
|
||||
end
|
||||
inherited cbListaObras: TcxDBLookupComboBox
|
||||
Left = 373
|
||||
ExplicitLeft = 373
|
||||
Left = 364
|
||||
Style.LookAndFeel.SkinName = ''
|
||||
StyleDisabled.LookAndFeel.SkinName = ''
|
||||
StyleFocused.LookAndFeel.SkinName = ''
|
||||
StyleHot.LookAndFeel.SkinName = ''
|
||||
ExplicitLeft = 364
|
||||
ExplicitWidth = 82
|
||||
Width = 82
|
||||
end
|
||||
inherited edtEntregarA: TcxDBButtonEdit
|
||||
Top = 231
|
||||
Style.LookAndFeel.SkinName = ''
|
||||
StyleDisabled.LookAndFeel.SkinName = ''
|
||||
StyleFocused.LookAndFeel.SkinName = ''
|
||||
StyleHot.LookAndFeel.SkinName = ''
|
||||
ExplicitTop = 231
|
||||
end
|
||||
inherited lblNombreObra: TcxDBLabel
|
||||
Left = 239
|
||||
Style.LookAndFeel.SkinName = ''
|
||||
StyleDisabled.LookAndFeel.SkinName = ''
|
||||
StyleFocused.LookAndFeel.SkinName = ''
|
||||
StyleHot.LookAndFeel.SkinName = ''
|
||||
ExplicitLeft = 239
|
||||
end
|
||||
end
|
||||
inherited ActionList1: TActionList
|
||||
Left = 72
|
||||
@ -433,29 +452,23 @@ inherited frViewPedidoProveedor: TfrViewPedidoProveedor
|
||||
Height = 72
|
||||
ExplicitWidth = 432
|
||||
ExplicitHeight = 72
|
||||
DesignSize = (
|
||||
432
|
||||
72)
|
||||
inherited Label1: TLabel
|
||||
Width = 235
|
||||
ExplicitWidth = 235
|
||||
end
|
||||
inherited cbListaObrasReserva: TcxDBLookupComboBox
|
||||
ExplicitWidth = 397
|
||||
Width = 397
|
||||
end
|
||||
inherited Button3: TBitBtn
|
||||
Left = 278
|
||||
ExplicitLeft = 278
|
||||
end
|
||||
inherited cbObraReserva: TComboBox
|
||||
Width = 475
|
||||
ExplicitWidth = 475
|
||||
end
|
||||
end
|
||||
inherited dsPedido: TDADataSource
|
||||
Left = 192
|
||||
Top = 24
|
||||
end
|
||||
inherited dsObras: TDADataSource
|
||||
Top = 24
|
||||
end
|
||||
inherited PngImageList: TPngImageList
|
||||
Left = 224
|
||||
Top = 24
|
||||
|
||||
@ -78,6 +78,8 @@ type
|
||||
procedure actVerPedidoCliUpdate(Sender: TObject);
|
||||
procedure frViewProveedorPedidoButton1Click(Sender: TObject);
|
||||
procedure frViewProveedorPedidoButton2Click(Sender: TObject);
|
||||
procedure frViewObraReserva1cbListaObrasReservaPropertiesEditValueChanged(
|
||||
Sender: TObject);
|
||||
protected
|
||||
FPedido : IBizPedidoProveedor;
|
||||
FViewProveedorPedido : TfrViewDatosYSeleccionProveedor;
|
||||
@ -144,6 +146,15 @@ begin
|
||||
inherited;
|
||||
end;
|
||||
|
||||
procedure TfrViewPedidoProveedor.frViewObraReserva1cbListaObrasReservaPropertiesEditValueChanged(
|
||||
Sender: TObject);
|
||||
begin
|
||||
inherited;
|
||||
ShowMessage('Hola');
|
||||
frViewDireccionEntregaPedidoProv1.PrepararObra;
|
||||
frViewDireccionEntregaPedidoProv1.CambioDireccionObra;
|
||||
end;
|
||||
|
||||
procedure TfrViewPedidoProveedor.frViewProveedorPedidoButton1Click(Sender: TObject);
|
||||
begin
|
||||
if Assigned(Pedido) and Assigned(Pedido.Proveedor) and
|
||||
|
||||
@ -13,11 +13,19 @@ inherited frViewProveedorPedido: TfrViewProveedorPedido
|
||||
273)
|
||||
inherited edtlNombre: TcxDBTextEdit
|
||||
Left = 118
|
||||
Style.LookAndFeel.SkinName = ''
|
||||
StyleDisabled.LookAndFeel.SkinName = ''
|
||||
StyleFocused.LookAndFeel.SkinName = ''
|
||||
StyleHot.LookAndFeel.SkinName = ''
|
||||
ExplicitLeft = 118
|
||||
end
|
||||
inherited edtNIFCIF: TcxDBTextEdit
|
||||
Left = 118
|
||||
Top = 153
|
||||
Style.LookAndFeel.SkinName = ''
|
||||
StyleDisabled.LookAndFeel.SkinName = ''
|
||||
StyleFocused.LookAndFeel.SkinName = ''
|
||||
StyleHot.LookAndFeel.SkinName = ''
|
||||
TabOrder = 7
|
||||
ExplicitLeft = 118
|
||||
ExplicitTop = 153
|
||||
@ -25,6 +33,10 @@ inherited frViewProveedorPedido: TfrViewProveedorPedido
|
||||
inherited edtCalle: TcxDBTextEdit
|
||||
Left = 118
|
||||
Top = 180
|
||||
Style.LookAndFeel.SkinName = ''
|
||||
StyleDisabled.LookAndFeel.SkinName = ''
|
||||
StyleFocused.LookAndFeel.SkinName = ''
|
||||
StyleHot.LookAndFeel.SkinName = ''
|
||||
TabOrder = 8
|
||||
ExplicitLeft = 118
|
||||
ExplicitTop = 180
|
||||
@ -32,6 +44,10 @@ inherited frViewProveedorPedido: TfrViewProveedorPedido
|
||||
inherited edtPoblacion: TcxDBTextEdit
|
||||
Left = 118
|
||||
Top = 207
|
||||
Style.LookAndFeel.SkinName = ''
|
||||
StyleDisabled.LookAndFeel.SkinName = ''
|
||||
StyleFocused.LookAndFeel.SkinName = ''
|
||||
StyleHot.LookAndFeel.SkinName = ''
|
||||
TabOrder = 9
|
||||
ExplicitLeft = 118
|
||||
ExplicitTop = 207
|
||||
@ -39,6 +55,10 @@ inherited frViewProveedorPedido: TfrViewProveedorPedido
|
||||
inherited edtProvincia: TcxDBTextEdit
|
||||
Left = 118
|
||||
Top = 234
|
||||
Style.LookAndFeel.SkinName = ''
|
||||
StyleDisabled.LookAndFeel.SkinName = ''
|
||||
StyleFocused.LookAndFeel.SkinName = ''
|
||||
StyleHot.LookAndFeel.SkinName = ''
|
||||
TabOrder = 11
|
||||
ExplicitLeft = 118
|
||||
ExplicitTop = 234
|
||||
@ -46,6 +66,10 @@ inherited frViewProveedorPedido: TfrViewProveedorPedido
|
||||
inherited edtCodigoPostal: TcxDBTextEdit
|
||||
Left = 381
|
||||
Top = 207
|
||||
Style.LookAndFeel.SkinName = ''
|
||||
StyleDisabled.LookAndFeel.SkinName = ''
|
||||
StyleFocused.LookAndFeel.SkinName = ''
|
||||
StyleHot.LookAndFeel.SkinName = ''
|
||||
TabOrder = 10
|
||||
ExplicitLeft = 381
|
||||
ExplicitTop = 207
|
||||
@ -72,10 +96,14 @@ inherited frViewProveedorPedido: TfrViewProveedorPedido
|
||||
Style.BorderStyle = ebs3D
|
||||
Style.HotTrack = False
|
||||
Style.LookAndFeel.NativeStyle = True
|
||||
Style.LookAndFeel.SkinName = ''
|
||||
StyleDisabled.LookAndFeel.NativeStyle = True
|
||||
StyleDisabled.LookAndFeel.SkinName = ''
|
||||
StyleDisabled.TextColor = clWindowText
|
||||
StyleFocused.LookAndFeel.NativeStyle = True
|
||||
StyleFocused.LookAndFeel.SkinName = ''
|
||||
StyleHot.LookAndFeel.NativeStyle = True
|
||||
StyleHot.LookAndFeel.SkinName = ''
|
||||
TabOrder = 5
|
||||
Height = 21
|
||||
Width = 585
|
||||
@ -95,10 +123,14 @@ inherited frViewProveedorPedido: TfrViewProveedorPedido
|
||||
Style.BorderStyle = ebs3D
|
||||
Style.HotTrack = False
|
||||
Style.LookAndFeel.NativeStyle = True
|
||||
Style.LookAndFeel.SkinName = ''
|
||||
StyleDisabled.LookAndFeel.NativeStyle = True
|
||||
StyleDisabled.LookAndFeel.SkinName = ''
|
||||
StyleDisabled.TextColor = clWindowText
|
||||
StyleFocused.LookAndFeel.NativeStyle = True
|
||||
StyleFocused.LookAndFeel.SkinName = ''
|
||||
StyleHot.LookAndFeel.NativeStyle = True
|
||||
StyleHot.LookAndFeel.SkinName = ''
|
||||
TabOrder = 4
|
||||
Height = 21
|
||||
Width = 121
|
||||
@ -118,10 +150,14 @@ inherited frViewProveedorPedido: TfrViewProveedorPedido
|
||||
Style.BorderStyle = ebs3D
|
||||
Style.HotTrack = False
|
||||
Style.LookAndFeel.NativeStyle = True
|
||||
Style.LookAndFeel.SkinName = ''
|
||||
StyleDisabled.LookAndFeel.NativeStyle = True
|
||||
StyleDisabled.LookAndFeel.SkinName = ''
|
||||
StyleDisabled.TextColor = clWindowText
|
||||
StyleFocused.LookAndFeel.NativeStyle = True
|
||||
StyleFocused.LookAndFeel.SkinName = ''
|
||||
StyleHot.LookAndFeel.NativeStyle = True
|
||||
StyleHot.LookAndFeel.SkinName = ''
|
||||
TabOrder = 3
|
||||
Height = 21
|
||||
Width = 169
|
||||
|
||||
Loading…
Reference in New Issue
Block a user