diff --git a/Source/Base/Controladores/uControllerDetallesBase.pas b/Source/Base/Controladores/uControllerDetallesBase.pas index f1d62201..dbda2ed5 100644 --- a/Source/Base/Controladores/uControllerDetallesBase.pas +++ b/Source/Base/Controladores/uControllerDetallesBase.pas @@ -144,33 +144,36 @@ var AsignarDtoPosicion: Integer; begin - AsignarDtoPosicion := 0; - AField := ADataTable.DataTable.FindField(CAMPO_POSICION); - if not Assigned(AField) then - raise Exception.Create('Campo ' + CAMPO_POSICION + ' no encontrado (AsignarDescuento)'); + if ADescuento >= 0 then + begin + AsignarDtoPosicion := 0; + AField := ADataTable.DataTable.FindField(CAMPO_POSICION); + if not Assigned(AField) then + raise Exception.Create('Campo ' + CAMPO_POSICION + ' no encontrado (AsignarDescuento)'); - BeginUpdate(ADataTable); - try - with ADataTable do - begin - for i := 0 to High(POSICION) do + BeginUpdate(ADataTable); + try + with ADataTable do begin - DataTable.First; - AsignarDtoPosicion := POSICION[i]; - if DataTable.Locate(CAMPO_POSICION, AsignarDtoPosicion, []) then + for i := 0 to High(POSICION) do begin - if (DataTable.FieldByName(CAMPO_TIPO).AsString = TIPO_DETALLE_CONCEPTO) then - begin - DataTable.Edit; - DataTable.FieldByName(CAMPO_DESCUENTO).AsVariant := ADescuento; - DataTable.Post; - end; + DataTable.First; + AsignarDtoPosicion := POSICION[i]; + if DataTable.Locate(CAMPO_POSICION, AsignarDtoPosicion, []) then + begin + if (DataTable.FieldByName(CAMPO_TIPO).AsString = TIPO_DETALLE_CONCEPTO) then + begin + DataTable.Edit; + DataTable.FieldByName(CAMPO_DESCUENTO).AsVariant := ADescuento; + DataTable.Post; + end; + end; end; + Renumerar(DataTable, AsignarDtoPosicion); end; - Renumerar(DataTable, AsignarDtoPosicion); + finally + EndUpdate(ADataTable); end; - finally - EndUpdate(ADataTable); end; end; diff --git a/Source/Base/Utiles/uGridClipboardUtils.pas b/Source/Base/Utiles/uGridClipboardUtils.pas index a9bb2aa0..7a19b826 100644 --- a/Source/Base/Utiles/uGridClipboardUtils.pas +++ b/Source/Base/Utiles/uGridClipboardUtils.pas @@ -27,14 +27,8 @@ uses cxVariants, CtlToRTF, Clipbrd, DB, cxExport, cxGridExportLink, cxCustomData, uSistemaFunc, ClipboardUtils, cxDBData, cxGridLevel, uStringsUtils, cxClasses, cxControls, cxGridCustomView, cxGridCustomTableView, - cxGridTableView, cxGridDBTableView, cxGridDBDataDefinitions, uGridStatusUtils; - -const - TIPO_DETALLE_CONCEPTO = 'Concepto'; - CAMPO_ID = 'ID'; - CAMPO_POSICION = 'POSICION'; - CAMPO_TIPO = 'TIPO_DETALLE'; - CAMPO_CONCEPTO = 'CONCEPTO'; + cxGridTableView, cxGridDBTableView, cxGridDBDataDefinitions, uGridStatusUtils, + uDADataTable, uCalculosUtils, uControllerDetallesBase; type TTipoAnadir = (taAnadir, taInsertar); @@ -55,165 +49,6 @@ begin end; - -function _DesplazarNPosiciones(ADataSet: TDataSet; NumOrdenIni: Variant; NPosiciones: Variant): Integer; -{ -Funcin que desplaza NPosiciones el numero de orden a partir del elemento con el -nmero de orden dado. Devuelve el numero de orden del primer elemento del hueco -generado -} -var - AuxNumOrden: Integer; - AuxNumPos: Integer; - AField: TField; -begin - - AField := ADataSet.FindField(CAMPO_POSICION); - if not Assigned(AField) then - raise Exception.Create('Campo ' + CAMPO_POSICION + ' no encontrado (DesplazarNPosiciones)'); - - if VarIsNull(NPosiciones) then - AuxNumPos := 1 - else - AuxNumPos := NPosiciones; - - if VarIsNull(NumOrdenIni) then - AuxNumOrden := 0 - else - AuxNumOrden := NumOrdenIni + 1; //Aadimos por abajo siempre - - Result := AuxNumOrden; - - with ADataSet do - begin - First; - while not EOF do - begin - if (FieldByName(CAMPO_POSICION).AsInteger >= AuxNumOrden) then - begin - if not (State in dsEditModes) then - Edit; - FieldByName(CAMPO_POSICION).AsInteger := FieldByName(CAMPO_POSICION).AsInteger + AuxNumPos; - Post; - end; - Next; - end; - end; -end; - - -procedure _NuevaTupla(ADataSet: TDataSet; ATipoAnadir: TTipoAnadir = taInsertar); -var - AuxNumOrden : Integer; -begin - ADataSet.DisableControls; - try - with ADataSet do - begin - AuxNumOrden := _DesplazarNPosiciones(ADataSet, FieldByName(CAMPO_POSICION).AsVariant, 1); - - case ATipoAnadir of - taAnadir: Append; - taInsertar: Insert; - end; - - FieldByName(CAMPO_POSICION).AsInteger := AuxNumOrden; - FieldByName(CAMPO_TIPO).AsVariant := TIPO_DETALLE_CONCEPTO; - end; - finally - ADataSet.EnableControls; - end; -end; - - -procedure _Renumerar(ADataSet: TDataSet); -{ -procedimiento que renumera todos los conceptos de la tabla dada por parametro -} -var - i, j : Integer; - AField: TField; -begin - AField := ADataSet.FindField(CAMPO_POSICION); - - if not Assigned(AField) then - raise Exception.Create('Campo ' + CAMPO_POSICION + ' no encontrado (renumerar)'); - - with ADataSet do - begin - for i:=0 to RecordCount-1 do - begin - First; - if not Locate(CAMPO_POSICION, i, []) then - begin - j := i; - First; - while not Locate(CAMPO_POSICION, j, []) do - begin - Inc(j); - First; - end; - - if not (State in dsEditModes) then - Edit; - - FieldByName(CAMPO_POSICION).AsInteger := i; - Post; - end; - end; - end; -end; - - - -{procedure RenumerarCampoPosicion(ADataSet : TDataSet); -var - i, j : Integer; - AField : TField; - AList : TStringList; -begin - AList := TStringList.Create; - try - ADataSet.First; - for i:=0 to ADataSet.RecordCount-1 do - begin - AList.Add(ADataSet.FieldByName('POSICION').AsString); - ADataSet.Next; - end; - ShowMessage(AList.Text); - finally - FreeANDNIL(AList); - end; - - - - AField := ADataSet.FindField('POSICION'); - if Assigned(AField) and not (ADataSet.IsEmpty) then - begin - with ADataSet do - begin - for i:=0 to RecordCount-1 do - begin - First; - if not Locate('POSICION', i, []) then - begin - j := i; - First; - while not Locate('POSICION', j, []) do - begin - Inc(j); - First; - end; - end; - Edit; - FieldByName('POSICION').AsInteger := i; - Post; - end; - end; - end; -end;} - - function _BuscarColumna (AView: TcxGridDBTableView; const AName, ATypeValue : String; var AIndex : Integer) : Boolean; var @@ -246,7 +81,6 @@ procedure LoadGridRowsFromStream(AView : TcxGridDBTableView; AStream: TStream; var AValueNameList: TStringList; AValueTypeList: TStringList; - ADataSet : TDataSet; ARecordID : Integer; ARecordIndex : Integer; bEstabaVacia : Boolean; @@ -259,6 +93,10 @@ var AValue : Variant; AIndex : integer; + //Se adapta para que se utilicen las mismas funciones que en el controllerbase + AControllerDetallesBase: IControllerDetallesBase; + ADataTable: IDAStronglyTypedDataTable; + begin if not Assigned(AView) then raise Exception.Create('Vista no asignada (SaveGridViewToStream)'); @@ -266,12 +104,15 @@ begin if not Assigned(AStream) then raise Exception.Create('Stream no asignado (SaveGridViewToStream)'); - ADataSet := AView.DataController.DataSource.DataSet; + if not Supports((AView.DataController.DataSource as TDADataSource).DataTable, IDAStronglyTypedDataTable, ADataTable) then + raise Exception.Create('DataTable asignado no soporta IDAStronglyTypedDataTable)'); + AReader := TcxReader.Create(AStream); AValueNameList := TStringList.Create; AValueTypeList := TStringList.Create; try + AControllerDetallesBase:= TControllerDetallesBase.Create; AIndex := -1; ACaption := AReader.ReadAnsiString; NumCols := AReader.ReadInteger; // n de columnas @@ -285,7 +126,7 @@ begin end; NumFilas := AReader.ReadInteger; - bEstabaVacia := ADataSet.IsEmpty; + bEstabaVacia := ADataTable.IsEmpty; AView.DataController.BeginUpdate; try @@ -297,7 +138,7 @@ begin if ARecordIndex >= 0 then begin ARecordID := AView.DataController.GetRecordId(ARecordIndex); - ADataSet.Locate(AView.DataController.KeyFieldNames, ARecordID, []); + ADataTable.Locate(AView.DataController.KeyFieldNames, ARecordID, []); end; end; @@ -305,16 +146,16 @@ begin begin // Insertar una tupla de la forma adecuada if bEstabaVacia then - _NuevaTupla(ADataSet, taAnadir) + begin + AControllerDetallesBase.Add(ADataTable,TIPO_DETALLE_CONCEPTO); + ADataTable.Edit; + end else begin if iContador = 0 then - ADataSet.Edit + ADataTable.Edit else begin - ADataSet.Next; - if ADataSet.EOF then - _NuevaTupla(ADataSet, taAnadir) - else - _NuevaTupla(ADataSet, taInsertar) + AControllerDetallesBase.Add(ADataTable,TIPO_DETALLE_CONCEPTO); + ADataTable.Edit; end; end; @@ -324,23 +165,18 @@ begin AValue := AReader.ReadVariant; if (Pos(AValueNameList[iCols], AView.DataController.KeyFieldNames) = 0) then begin - if (AValueNameList[iCols] = 'POSICION') then - ADataSet.FieldByName('POSICION').Value := ADataSet.RecNo - else - if _BuscarColumna(AView, AValueNameList[iCols], AValueTypeList[iCols], AIndex) then - begin - if AIndex <> -1 then - ADataSet.FieldByName(AView.DataController.GetItemField(AIndex).FieldName).Value := AValue; - end; + if (AValueNameList[iCols] <> CAMPO_POSICION) then + if _BuscarColumna(AView, AValueNameList[iCols], AValueTypeList[iCols], AIndex) then + begin + if AIndex <> -1 then + ADataTable.DataTable.FieldByName(AView.DataController.GetItemField(AIndex).FieldName).Value := AValue; + end; end; end; finally - ADataSet.Post; + ADataTable.Post; end; end; - - _Renumerar(ADataSet); - finally AView.DataController.EndUpdate; end; @@ -348,6 +184,7 @@ begin FreeANDNIL(AReader); FreeANDNIL(AValueNameList); FreeANDNIL(AValueTypeList); + AControllerDetallesBase := Nil; end; end; {$ENDREGION} @@ -629,13 +466,23 @@ end; procedure CortarSeleccionGridAlPortapapeles (AGrid : TcxGrid); +var + //Se adapta para que se utilicen las mismas funciones que en el controllerbase + AControllerDetallesBase: IControllerDetallesBase; + ADataTable : TDADataTable; + begin + if Assigned(AGrid) then + ADataTable := ((AGrid.ActiveView as TcxGridDBTableView).DataController.DataSource as TDADataSource).DataTable; + ShowHourglassCursor; try + AControllerDetallesBase := TControllerDetallesBase.Create; CopiarSeleccionGridAlPortapapeles(AGrid); AGrid.ActiveView.DataController.DeleteSelection; - _Renumerar(TcxGridDBTableView(AGrid.ActiveView).DataController.DataSet); + AControllerDetallesBase.Renumerar(ADataTable, ADataTable.FieldByName(CAMPO_POSICION).AsInteger); finally + AControllerDetallesBase := Nil; HideHourglassCursor; end; end; @@ -678,18 +525,25 @@ var AGridStatus : TcxGridStatus; ATextList : TStringList; - ADataSet : TDataSet; - ARecordID : Integer; ARecordIndex : Integer; bEstabaVacia : Boolean; AView : TcxGridDBTableView; iContador : Integer; + + //Se adapta para que se utilicen las mismas funciones que en el controllerbase + AControllerDetallesBase: IControllerDetallesBase; + ADataTable: IDAStronglyTypedDataTable; + begin + if not Assigned(AGrid) then raise Exception.Create('Grid no asignado (PegarTextoDesdePortapapeles)'); + if not Supports(((AGrid.ActiveView as TcxGridDBTableView).DataController.DataSource as TDADataSource).DataTable, IDAStronglyTypedDataTable, ADataTable) then + raise Exception.Create('DataTable asignado no soporta IDAStronglyTypedDataTable)'); + RegistrarFormatos; if not Clipboard.HasFormat(CF_TEXT) then @@ -703,8 +557,8 @@ begin ATextList := TStringList.Create; try CopyStringsFromClipboard(CF_TEXT, ATextList); - ADataSet := AView.DataController.DataSource.DataSet; - bEstabaVacia := ADataSet.IsEmpty; + AControllerDetallesBase := TControllerDetallesBase.Create; + bEstabaVacia := ADataTable.IsEmpty; AView.DataController.BeginUpdate; try // Localizar el punto donde se empieza a insertar @@ -714,7 +568,7 @@ begin if ARecordIndex >= 0 then begin ARecordID := AView.DataController.GetRecordId(ARecordIndex); - ADataSet.Locate(AView.DataController.KeyFieldNames, ARecordID, []); + ADataTable.Locate(AView.DataController.KeyFieldNames, ARecordID, []); end; end; @@ -722,28 +576,27 @@ begin begin // Insertar una tupla de la forma adecuada if bEstabaVacia then - _NuevaTupla(ADataSet, taAnadir) + begin + AControllerDetallesBase.Add(ADataTable,TIPO_DETALLE_CONCEPTO); + ADataTable.Edit; + end else begin if iContador = 0 then - ADataSet.Edit + ADataTable.Edit else begin - ADataSet.Next; - if ADataSet.EOF then - _NuevaTupla(ADataSet, taAnadir) - else - _NuevaTupla(ADataSet, taInsertar) + AControllerDetallesBase.Add(ADataTable,TIPO_DETALLE_CONCEPTO); + ADataTable.Edit; end; end; try - ADataSet.Edit; - ADataSet.FieldByName('CONCEPTO').AsString := ATextList[iContador]; + ADataTable.Edit; + ADataTable.DataTable.FieldByName('CONCEPTO').AsString := ATextList[iContador]; finally - ADataSet.Post; + ADataTable.Post; end; end; - _Renumerar(ADataSet); finally AView.DataController.EndUpdate; end; @@ -754,6 +607,7 @@ begin Clipboard.Close; AGridStatus.Restore(TcxGridDBTableView(AGrid.ActiveView)); FreeAndNil(AGridStatus); + AControllerDetallesBase := Nil; end; end; diff --git a/Source/GUIBase/uEditorDBItem.dfm b/Source/GUIBase/uEditorDBItem.dfm index 53548e08..5608817c 100644 --- a/Source/GUIBase/uEditorDBItem.dfm +++ b/Source/GUIBase/uEditorDBItem.dfm @@ -77,6 +77,10 @@ inherited fEditorDBItem: TfEditorDBItem TabOrder = 2 object pagGeneral: TTabSheet Caption = 'General' + ExplicitLeft = 0 + ExplicitTop = 0 + ExplicitWidth = 0 + ExplicitHeight = 0 end end inherited StatusBar: TJvStatusBar diff --git a/Source/GUIBase/uViewDetallesBase.pas b/Source/GUIBase/uViewDetallesBase.pas index 095cdff4..bdbcfe84 100644 --- a/Source/GUIBase/uViewDetallesBase.pas +++ b/Source/GUIBase/uViewDetallesBase.pas @@ -1143,7 +1143,7 @@ procedure TfrViewDetallesBase.actDetallesCopiarExecute(Sender: TObject); begin ShowHourglassCursor; try - CopiarSeleccionGridAlPortapapeles(_Grid); + CopiarSeleccionGridAlPortapapeles(_Grid, True); finally HideHourglassCursor; end; diff --git a/Source/Informes/1/AlbaranCliente.rdx b/Source/Informes/1/AlbaranCliente.rdx index b57095c8..9416825f 100644 Binary files a/Source/Informes/1/AlbaranCliente.rdx and b/Source/Informes/1/AlbaranCliente.rdx differ diff --git a/Source/Informes/1/AlbaranProveedor.rdx b/Source/Informes/1/AlbaranProveedor.rdx index e92655b1..f1317eb2 100644 Binary files a/Source/Informes/1/AlbaranProveedor.rdx and b/Source/Informes/1/AlbaranProveedor.rdx differ diff --git a/Source/Informes/1/InfAlbaranCliente.fr3 b/Source/Informes/1/InfAlbaranCliente.fr3 index 34427208..781ea69d 100644 --- a/Source/Informes/1/InfAlbaranCliente.fr3 +++ b/Source/Informes/1/InfAlbaranCliente.fr3 @@ -1,10 +1,10 @@ - + - + diff --git a/Source/Informes/1/InfAlbaranProveedor.fr3 b/Source/Informes/1/InfAlbaranProveedor.fr3 index 9e125e93..477cc57d 100644 --- a/Source/Informes/1/InfAlbaranProveedor.fr3 +++ b/Source/Informes/1/InfAlbaranProveedor.fr3 @@ -1,10 +1,10 @@ - + - + @@ -12,7 +12,7 @@ - + diff --git a/Source/Informes/1/InfPedidoProveedor.fr3 b/Source/Informes/1/InfPedidoProveedor.fr3 index 7901d52a..b019d6b4 100644 --- a/Source/Informes/1/InfPedidoProveedor.fr3 +++ b/Source/Informes/1/InfPedidoProveedor.fr3 @@ -1,10 +1,10 @@ - + - + @@ -12,9 +12,9 @@ - + - + diff --git a/Source/Informes/1/PedidoProveedor.rdx b/Source/Informes/1/PedidoProveedor.rdx index f5bd1be5..ce9002f1 100644 Binary files a/Source/Informes/1/PedidoProveedor.rdx and b/Source/Informes/1/PedidoProveedor.rdx differ diff --git a/Source/Informes/2/InfAlbaranCliente.fr3 b/Source/Informes/2/InfAlbaranCliente.fr3 index 0af47dfc..ff933220 100644 --- a/Source/Informes/2/InfAlbaranCliente.fr3 +++ b/Source/Informes/2/InfAlbaranCliente.fr3 @@ -1,15 +1,15 @@ - + - + - - + + - + @@ -18,8 +18,8 @@ - - + + diff --git a/Source/Informes/2/InfAlbaranProveedor.fr3 b/Source/Informes/2/InfAlbaranProveedor.fr3 index ac2e9aa3..a243bcf3 100644 --- a/Source/Informes/2/InfAlbaranProveedor.fr3 +++ b/Source/Informes/2/InfAlbaranProveedor.fr3 @@ -1,5 +1,5 @@ - + @@ -10,20 +10,20 @@ - - + + - - + + - - + + - + diff --git a/Source/Informes/2/InfPedidoProveedor.fr3 b/Source/Informes/2/InfPedidoProveedor.fr3 index 63889b88..08edb864 100644 --- a/Source/Informes/2/InfPedidoProveedor.fr3 +++ b/Source/Informes/2/InfPedidoProveedor.fr3 @@ -1,5 +1,5 @@ - + @@ -12,21 +12,21 @@ - - - - + + + + - + - - + + - - + + diff --git a/Source/Modulos/Pedidos a proveedor/Views/PedidosProveedor_view.dpk b/Source/Modulos/Pedidos a proveedor/Views/PedidosProveedor_view.dpk index 48152ac5..0c14a28b 100644 --- a/Source/Modulos/Pedidos a proveedor/Views/PedidosProveedor_view.dpk +++ b/Source/Modulos/Pedidos a proveedor/Views/PedidosProveedor_view.dpk @@ -38,7 +38,38 @@ requires Obras_controller, PedProv_AlbProv_relation, PedProv_FacProv_relation, - GestorInformes_controller; + GestorInformes_controller, + rtl, + vcl, + dbrtl, + vcldb, + PNG_D10, + PngComponentsD10, + vclactnband, + vclx, + cxLibraryD11, + dxThemeD11, + dxGDIPlusD11, + dxCoreD11, + cxExtEditorsD11, + cxDataD11, + cxEditorsD11, + vcljpg, + DataAbstract_Core_D11, + dsnap, + adortl, + RemObjects_Core_D11, + GUISDK_D11R, + designide, + xmlrtl, + dxLayoutControlD11, + dxComnD11, + JvStdCtrlsD11R, + JclVcl, + Jcl, + JvCoreD11R, + JvSystemD11R, + JvCtrlsD11R; contains uPedidosProveedorViewRegister in 'uPedidosProveedorViewRegister.pas', @@ -57,6 +88,7 @@ contains uViewProveedorPedido in 'uViewProveedorPedido.pas' {frViewProveedorPedido: TFrame}, uEditorElegirPersonaContactoPedido in 'uEditorElegirPersonaContactoPedido.pas' {fEditorElegirPersonaContactoPedido: TfEditorSituacionPedidoProveedor}, uViewObraReserva in 'uViewObraReserva.pas' {frViewObraReserva: TFrame}, - uDialogOpcionesImpresionPedidosProveedor in 'uDialogOpcionesImpresionPedidosProveedor.pas' {fDialogOpcionesImpresionPedidosProveedor: TForm}; + uDialogOpcionesImpresionPedidosProveedor in 'uDialogOpcionesImpresionPedidosProveedor.pas' {fDialogOpcionesImpresionPedidosProveedor: TForm}, + uViewDatosYSeleccionProveedorPedido in 'uViewDatosYSeleccionProveedorPedido.pas'{frViewDatosYSeleccionProveedorPedido: TFrame}; end. diff --git a/Source/Modulos/Pedidos a proveedor/Views/PedidosProveedor_view.dproj b/Source/Modulos/Pedidos a proveedor/Views/PedidosProveedor_view.dproj index 9aeb692e..09d4bfe1 100644 --- a/Source/Modulos/Pedidos a proveedor/Views/PedidosProveedor_view.dproj +++ b/Source/Modulos/Pedidos a proveedor/Views/PedidosProveedor_view.dproj @@ -49,20 +49,45 @@ MainSource + + + + + + + + + + + + + + + + + + + + + + + + +
fDialogOpcionesImpresionPedidosProveedor
TForm @@ -100,6 +125,7 @@ TfEditorSituacionPedidoProveedor
+
frViewDetallesPedidoProveedor
TFrame @@ -128,6 +154,12 @@
frViewProveedorPedido
TFrame
+ + + + + +