Cambios en editorbase para que se fuerce el cancelupdates de las tablas datalle, porque el maestro-detalle de dataabstract no lo hace bien, cambio en pedidos de proveedor para que no de el error al entrar en la lista de pedidos, cambio en controllerdetallesbase para que sean accesible beginupdate y endupdate, y cambio en factura de cliente para que no pete al cerrar sin guardar

git-svn-id: https://192.168.0.254/svn/Proyectos.Tecsitel_FactuGES2/trunk@384 0c75b7a4-871f-7646-8a2f-f78d34cc349f
This commit is contained in:
David Arranz 2008-05-26 14:57:35 +00:00
parent 236ee2a802
commit ce1060cbe5
6 changed files with 216 additions and 92 deletions

View File

@ -24,6 +24,8 @@ type
procedure Add(ADataTable: IDAStronglyTypedDataTable; TipoConcepto: Variant);
procedure Delete(ADataTable: IDAStronglyTypedDataTable; Posicion: TIntegerArray);
procedure Move(ADataTable: IDAStronglyTypedDataTable; Posicion: TIntegerArray; Posiciones: Integer);
procedure BeginUpdate(ADataTable: IDAStronglyTypedDataTable);
procedure EndUpdate(ADataTable: IDAStronglyTypedDataTable);
// procedure Copy(SMExport: TSMExportToClipboard);
// procedure Paste;
@ -44,8 +46,6 @@ type
procedure Renumerar(DataTable: TDADataTable; LocalizaPosicion: Integer);
function DesplazarNPosiciones(DataTable: TDADataTable; NumOrdenIni: Variant; NPosiciones: Variant): Integer;
procedure Mover(DataTable: TDADataTable; Posicion: Integer; NumPosiciones: Integer);
procedure BeginUpdate(ADataTable: IDAStronglyTypedDataTable);
procedure EndUpdate(ADataTable: IDAStronglyTypedDataTable);
//Si en los hijos existen campos a tener en cuenta se sobreescribira este metodo
procedure ValidarCampos(DataTable: TDADataTable); virtual;
@ -75,6 +75,8 @@ type
procedure Add(ADataTable: IDAStronglyTypedDataTable; TipoConcepto: Variant); virtual;
procedure Delete(ADataTable: IDAStronglyTypedDataTable; Posicion: TIntegerArray); virtual;
procedure Move(ADataTable: IDAStronglyTypedDataTable; Posicion: TIntegerArray; Posiciones: Integer); virtual;
procedure BeginUpdate(ADataTable: IDAStronglyTypedDataTable);
procedure EndUpdate(ADataTable: IDAStronglyTypedDataTable);
// procedure Copy(SMExport: TSMExportToClipboard);
// procedure Paste;
@ -82,7 +84,7 @@ type
procedure ActualizarTotales(ADataTable: IDAStronglyTypedDataTable);
function DarTotalImporteTotal(ADataTable: IDAStronglyTypedDataTable): Double;
function DarListaTiposDetalle: TStringList; virtual;
function LocalizarPosicion(ADataTable: IDAStronglyTypedDataTable; const APosicion: Integer): Boolean;
function LocalizarPosicion(ADataTable: IDAStronglyTypedDataTable; const APosicion: Integer): Boolean;
end;
@ -378,12 +380,14 @@ end;
procedure TControllerDetallesBase.EndUpdate(ADataTable: IDAStronglyTypedDataTable);
begin
Dec(fUpdateCount);
CalcularTotales(True, ADataTable.DataTable);
ADataTable.DataTable.EnableControls;
if fUpdateCount = 0 then
begin
CalcularTotales(True, ADataTable.DataTable);
AvisarObservadores(ADataTable);
end;
ADataTable.DataTable.EnableControls;
HideHourglassCursor;
end;

View File

@ -115,6 +115,13 @@ begin
dsDataTable.DataTable.CancelUpdates;
//Forzamos el cancel update de los detalles porque falla si se lo dejamos por ser maestro-detalle
dtDetails := dsDataTable.DataTable.GetDetailDataTables;
for i := 0 to dtDetails.Count - 1 do
begin
(TDADataTable(dtDetails.Items[i])).CancelUpdates;
end;
{ Comprobar si el bookmark no es válido cuando estamos cancelando la
inserción de una fila nueva.
CUIDADO!! Si no es válido salta una excepción. NO devuelve false!!!}

View File

@ -585,7 +585,7 @@ begin
//En caso de ser un Abono no podra tener un importe total positivo
if (AFactura.TIPO = CTE_TIPO_ABONO) then
if (AFactura.IMPORTE_TOTAL >= 0) then
raise Exception.Create('Un abono nunca no puede tener un importe positivo');
raise Exception.Create('Un abono nunca no puede tener un importe positivo, asegurese que las cantidades sean negativas');
{ Asegurarse de valores en campos "automáticos" tanto
en MODIFICACIÓN como en INSERCIÓN. }

View File

@ -7,7 +7,7 @@ inherited fEditorFacturaCliente: TfEditorFacturaCliente
Position = poScreenCenter
OnClose = CustomEditorClose
ExplicitWidth = 837
ExplicitHeight = 635
ExplicitHeight = 642
PixelsPerInch = 96
TextHeight = 13
inherited JvNavPanelHeader: TJvNavPanelHeader
@ -104,56 +104,92 @@ inherited fEditorFacturaCliente: TfEditorFacturaCliente
815
316)
inherited eReferencia: TcxDBTextEdit
ExplicitWidth = 393
Width = 393
Style.LookAndFeel.SkinName = ''
StyleDisabled.LookAndFeel.SkinName = ''
StyleFocused.LookAndFeel.SkinName = ''
StyleHot.LookAndFeel.SkinName = ''
ExplicitWidth = 343
Width = 343
end
inherited edtFecha: TcxDBDateEdit
ExplicitWidth = 393
Width = 393
Style.LookAndFeel.SkinName = ''
StyleDisabled.LookAndFeel.SkinName = ''
StyleFocused.LookAndFeel.SkinName = ''
StyleHot.LookAndFeel.SkinName = ''
ExplicitWidth = 343
Width = 343
end
inherited memObservaciones: TcxDBMemo
ExplicitWidth = 473
ExplicitHeight = 109
Height = 109
Width = 473
Style.LookAndFeel.SkinName = ''
StyleDisabled.LookAndFeel.SkinName = ''
StyleFocused.LookAndFeel.SkinName = ''
StyleHot.LookAndFeel.SkinName = ''
ExplicitWidth = 445
ExplicitHeight = 163
Height = 163
Width = 445
end
inherited frViewClienteFactura: TfrViewDatosYSeleccionCliente
Left = 495
Width = 332
Width = 298
ExplicitLeft = 495
ExplicitWidth = 332
ExplicitWidth = 298
inherited dxLayoutControl1: TdxLayoutControl
Width = 332
Width = 298
ExplicitWidth = 332
inherited edtlNombre: TcxDBTextEdit
DataBinding.DataSource = frViewFacturaCliente1.DADataSource
Properties.OnChange = frViewClienteFacturaedtlNombrePropertiesChange
Style.LookAndFeel.SkinName = ''
StyleDisabled.LookAndFeel.SkinName = ''
StyleFocused.LookAndFeel.SkinName = ''
StyleHot.LookAndFeel.SkinName = ''
ExplicitWidth = 224
Width = 224
end
inherited edtNIFCIF: TcxDBTextEdit
DataBinding.DataSource = frViewFacturaCliente1.DADataSource
ExplicitWidth = 562
Width = 562
Style.LookAndFeel.SkinName = ''
StyleDisabled.LookAndFeel.SkinName = ''
StyleFocused.LookAndFeel.SkinName = ''
StyleHot.LookAndFeel.SkinName = ''
ExplicitWidth = 224
Width = 224
end
inherited edtCalle: TcxDBTextEdit
DataBinding.DataSource = frViewFacturaCliente1.DADataSource
ExplicitWidth = 562
Width = 562
Style.LookAndFeel.SkinName = ''
StyleDisabled.LookAndFeel.SkinName = ''
StyleFocused.LookAndFeel.SkinName = ''
StyleHot.LookAndFeel.SkinName = ''
ExplicitWidth = 224
Width = 224
end
inherited edtPoblacion: TcxDBTextEdit
DataBinding.DataSource = frViewFacturaCliente1.DADataSource
ExplicitWidth = 177
Width = 177
Style.LookAndFeel.SkinName = ''
StyleDisabled.LookAndFeel.SkinName = ''
StyleFocused.LookAndFeel.SkinName = ''
StyleHot.LookAndFeel.SkinName = ''
ExplicitWidth = 106
Width = 106
end
inherited edtProvincia: TcxDBTextEdit
DataBinding.DataSource = frViewFacturaCliente1.DADataSource
ExplicitWidth = 327
Width = 327
Style.LookAndFeel.SkinName = ''
StyleDisabled.LookAndFeel.SkinName = ''
StyleFocused.LookAndFeel.SkinName = ''
StyleHot.LookAndFeel.SkinName = ''
ExplicitWidth = 224
Width = 224
end
inherited edtCodigoPostal: TcxDBTextEdit
Left = 206
DataBinding.DataSource = frViewFacturaCliente1.DADataSource
Style.LookAndFeel.SkinName = ''
StyleDisabled.LookAndFeel.SkinName = ''
StyleFocused.LookAndFeel.SkinName = ''
StyleHot.LookAndFeel.SkinName = ''
ExplicitLeft = 206
end
inherited Button3: TBitBtn
@ -163,8 +199,12 @@ inherited fEditorFacturaCliente: TfEditorFacturaCliente
end
end
inherited cbFormaPago: TcxDBLookupComboBox
ExplicitWidth = 255
Width = 255
Style.LookAndFeel.SkinName = ''
StyleDisabled.LookAndFeel.SkinName = ''
StyleFocused.LookAndFeel.SkinName = ''
StyleHot.LookAndFeel.SkinName = ''
ExplicitWidth = 205
Width = 205
end
inherited bFormasPago: TButton
Left = 335
@ -208,13 +248,14 @@ inherited fEditorFacturaCliente: TfEditorFacturaCliente
ExplicitLeft = 278
ExplicitTop = 0
end
inherited ToolButton14: TToolButton [4]
inherited ToolButton14: TToolButton
Left = 334
Top = 0
Wrap = False
ExplicitLeft = 334
ExplicitTop = 0
end
inherited FontName: TJvFontComboBox [5]
inherited FontName: TJvFontComboBox
Left = 399
Top = 0
ExplicitLeft = 399
@ -228,7 +269,13 @@ inherited fEditorFacturaCliente: TfEditorFacturaCliente
ExplicitTop = 0
ExplicitWidth = 72
end
inherited ToolButton13: TToolButton [7]
inherited UpDown1: TUpDown
Left = 616
Top = 0
ExplicitLeft = 616
ExplicitTop = 0
end
inherited ToolButton13: TToolButton
Left = 0
Top = 0
Wrap = True
@ -236,55 +283,46 @@ inherited fEditorFacturaCliente: TfEditorFacturaCliente
ExplicitTop = 0
ExplicitHeight = 27
end
inherited UpDown1: TUpDown [8]
inherited ToolButton6: TToolButton
Left = 0
Top = 27
ExplicitLeft = 0
ExplicitTop = 27
end
inherited ToolButton6: TToolButton [9]
Left = 17
inherited ToolButton7: TToolButton
Left = 66
Top = 27
ExplicitLeft = 17
ExplicitLeft = 66
ExplicitTop = 27
end
inherited ToolButton7: TToolButton [10]
Left = 83
inherited ToolButton8: TToolButton
Left = 133
Top = 27
Wrap = False
ExplicitLeft = 83
ExplicitLeft = 133
ExplicitTop = 27
end
inherited ToolButton8: TToolButton [11]
Left = 150
inherited ToolButton12: TToolButton
Left = 216
Top = 27
ExplicitLeft = 150
ExplicitLeft = 216
ExplicitTop = 27
end
inherited ToolButton12: TToolButton [12]
Left = 233
inherited ToolButton9: TToolButton
Left = 224
Top = 27
Wrap = False
ExplicitLeft = 233
ExplicitTop = 27
ExplicitHeight = 22
end
inherited ToolButton9: TToolButton [13]
Left = 241
Top = 27
ExplicitLeft = 241
ExplicitLeft = 224
ExplicitTop = 27
end
inherited ToolButton10: TToolButton [14]
Left = 386
inherited ToolButton10: TToolButton
Left = 369
Top = 27
ExplicitLeft = 386
ExplicitLeft = 369
ExplicitTop = 27
end
inherited ToolButton11: TToolButton [15]
Left = 511
inherited ToolButton11: TToolButton
Left = 494
Top = 27
ExplicitLeft = 511
ExplicitLeft = 494
ExplicitTop = 27
end
end
@ -305,6 +343,15 @@ inherited fEditorFacturaCliente: TfEditorFacturaCliente
ExplicitWidth = 702
end
end
inherited cxGridPopupMenu: TcxGridPopupMenu
PopupMenus = <
item
GridView = frViewDetallesFacturaCliente1.cxGridView
HitTypes = [gvhtNone, gvhtCell, gvhtRecord, gvhtRowIndicator]
Index = 0
PopupMenu = frViewDetallesFacturaCliente1.GridGeneralPopupMenu
end>
end
end
end
end
@ -363,92 +410,136 @@ inherited fEditorFacturaCliente: TfEditorFacturaCliente
end
inherited ImporteDto: TcxDBCurrencyEdit
Top = 131
Style.LookAndFeel.SkinName = ''
Style.IsFontAssigned = True
StyleDisabled.LookAndFeel.SkinName = ''
StyleFocused.LookAndFeel.SkinName = ''
StyleHot.LookAndFeel.SkinName = ''
ExplicitTop = 131
ExplicitWidth = 93
Width = 93
ExplicitWidth = 250
Width = 250
end
inherited ImporteIVA: TcxDBCurrencyEdit
Left = 624
Top = 57
Style.LookAndFeel.SkinName = ''
Style.IsFontAssigned = True
StyleDisabled.LookAndFeel.SkinName = ''
StyleFocused.LookAndFeel.SkinName = ''
StyleHot.LookAndFeel.SkinName = ''
ExplicitLeft = 624
ExplicitTop = 57
ExplicitWidth = 137
Width = 137
ExplicitWidth = 183
Width = 183
end
inherited ImporteTotal: TcxDBCurrencyEdit
Left = 554
Top = 131
Style.LookAndFeel.SkinName = ''
Style.IsFontAssigned = True
StyleDisabled.LookAndFeel.SkinName = ''
StyleFocused.LookAndFeel.SkinName = ''
StyleHot.LookAndFeel.SkinName = ''
ExplicitLeft = 554
ExplicitTop = 131
ExplicitWidth = 137
Width = 137
ExplicitWidth = 253
Width = 253
end
inherited edtDescuento: TcxDBSpinEdit
Top = 131
Properties.OnValidate = frViewTotales1edtDescuentoPropertiesValidate
Style.LookAndFeel.SkinName = ''
Style.IsFontAssigned = True
StyleDisabled.LookAndFeel.SkinName = ''
StyleFocused.LookAndFeel.SkinName = ''
StyleHot.LookAndFeel.SkinName = ''
ExplicitTop = 131
end
inherited edtIVA: TcxDBSpinEdit
Left = 553
Top = 57
Style.LookAndFeel.SkinName = ''
Style.IsFontAssigned = True
StyleDisabled.LookAndFeel.SkinName = ''
StyleFocused.LookAndFeel.SkinName = ''
StyleHot.LookAndFeel.SkinName = ''
ExplicitLeft = 553
ExplicitTop = 57
end
inherited ImporteBase: TcxDBCurrencyEdit
Left = 553
Top = 30
Style.LookAndFeel.SkinName = ''
Style.IsFontAssigned = True
StyleDisabled.LookAndFeel.SkinName = ''
StyleFocused.LookAndFeel.SkinName = ''
StyleHot.LookAndFeel.SkinName = ''
ExplicitLeft = 553
ExplicitTop = 30
ExplicitWidth = 92
Width = 92
ExplicitWidth = 254
Width = 254
end
inherited edtRE: TcxDBSpinEdit
Left = 553
Top = 84
Properties.AssignedValues.MinValue = True
Style.LookAndFeel.SkinName = ''
Style.IsFontAssigned = True
StyleDisabled.LookAndFeel.SkinName = ''
StyleFocused.LookAndFeel.SkinName = ''
StyleHot.LookAndFeel.SkinName = ''
ExplicitLeft = 553
ExplicitTop = 84
end
inherited ImporteRE: TcxDBCurrencyEdit
Left = 624
Top = 84
Style.LookAndFeel.SkinName = ''
Style.IsFontAssigned = True
StyleDisabled.LookAndFeel.SkinName = ''
StyleFocused.LookAndFeel.SkinName = ''
StyleHot.LookAndFeel.SkinName = ''
ExplicitLeft = 624
ExplicitTop = 84
ExplicitWidth = 56
Width = 56
ExplicitWidth = 183
Width = 183
end
inherited eImporteNeto: TcxDBCurrencyEdit
Top = 30
Style.LookAndFeel.SkinName = ''
Style.IsFontAssigned = True
StyleDisabled.LookAndFeel.SkinName = ''
StyleFocused.LookAndFeel.SkinName = ''
StyleHot.LookAndFeel.SkinName = ''
ExplicitTop = 30
ExplicitWidth = 147
Width = 147
ExplicitWidth = 321
Width = 321
end
inherited ePorte: TcxDBCurrencyEdit
Top = 158
DataBinding.DataSource = dsDataTable
Properties.OnValidate = frViewTotales1ePortePropertiesValidate
Style.LookAndFeel.SkinName = ''
Style.IsFontAssigned = True
StyleDisabled.LookAndFeel.SkinName = ''
StyleFocused.LookAndFeel.SkinName = ''
StyleHot.LookAndFeel.SkinName = ''
OnEditing = frViewTotales1ePorteEditing
ExplicitTop = 158
ExplicitWidth = 147
Width = 147
ExplicitWidth = 321
Width = 321
end
inherited eIVA: TcxDBLookupComboBox
Top = 57
Properties.OnValidate = frViewTotales1eIVAPropertiesValidate
Style.Color = clInfoBk
Style.LookAndFeel.SkinName = ''
StyleDisabled.LookAndFeel.SkinName = ''
StyleFocused.LookAndFeel.SkinName = ''
StyleHot.LookAndFeel.SkinName = ''
ExplicitTop = 57
ExplicitWidth = 134
Width = 134
ExplicitWidth = 183
Width = 183
end
inherited bTiposIVA: TButton
Left = 293
@ -460,9 +551,13 @@ inherited fEditorFacturaCliente: TfEditorFacturaCliente
inherited cbRecargoEquivalencia: TcxDBCheckBox
Top = 84
Properties.OnEditValueChanged = frViewTotales1cbRecargoEquivalenciaPropertiesEditValueChanged
Style.LookAndFeel.SkinName = ''
StyleDisabled.LookAndFeel.SkinName = ''
StyleFocused.LookAndFeel.SkinName = ''
StyleHot.LookAndFeel.SkinName = ''
ExplicitTop = 84
ExplicitWidth = 219
Width = 219
ExplicitWidth = 321
Width = 321
end
inherited dxLayoutControl1Group_Root: TdxLayoutGroup
inherited dxLayoutControl1Group1: TdxLayoutGroup

View File

@ -72,6 +72,7 @@ type
property Controller : IFacturasClienteController read GetController write SetController;
property Factura: IBizFacturaCliente read GetFactura write SetFactura;
constructor Create(AOwner: TComponent); override;
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); override; //Importante en este punto se deben de quitar los eventos que puedan afectar a la tabla una vez se cierre el editor.
end;
implementation
@ -139,6 +140,15 @@ begin
end;
end;
procedure TfEditorFacturaCliente.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
inherited;
frViewTotales1.cbRecargoEquivalencia.Properties.OnEditValueChanged := nil;
frViewTotales1.eIVA.Properties.OnValidate := nil;
frViewTotales1.ePorte.Properties.OnValidate := nil;
end;
procedure TfEditorFacturaCliente.FormShow(Sender: TObject);
begin
inherited;

View File

@ -5,7 +5,6 @@ inherited fEditorPedidosProveedor: TfEditorPedidosProveedor
ClientWidth = 700
Position = poDesigned
ExplicitWidth = 708
ExplicitHeight = 471
PixelsPerInch = 96
TextHeight = 13
inherited JvNavPanelHeader: TJvNavPanelHeader
@ -104,9 +103,6 @@ inherited fEditorPedidosProveedor: TfEditorPedidosProveedor
Kind = skSum
Column = frViewPedidosProveedor1.cxGridViewIMPORTE_TOTAL
end>
inherited cxGridViewCODIGO: TcxGridDBColumn
IsCaptionAssigned = True
end
end
end
inherited frViewFiltroBase1: TfrViewFiltroBase
@ -118,18 +114,30 @@ inherited fEditorPedidosProveedor: TfEditorPedidosProveedor
Width = 700
ExplicitWidth = 700
inherited txtFiltroTodo: TcxTextEdit
ExplicitWidth = 457
Width = 457
Style.LookAndFeel.SkinName = ''
StyleDisabled.LookAndFeel.SkinName = ''
StyleFocused.LookAndFeel.SkinName = ''
StyleHot.LookAndFeel.SkinName = ''
ExplicitWidth = 603
Width = 603
end
inherited edtFechaIniFiltro: TcxDateEdit
ExplicitWidth = 240
Width = 240
Style.LookAndFeel.SkinName = ''
StyleDisabled.LookAndFeel.SkinName = ''
StyleFocused.LookAndFeel.SkinName = ''
StyleHot.LookAndFeel.SkinName = ''
ExplicitWidth = 267
Width = 267
end
inherited edtFechaFinFiltro: TcxDateEdit
Left = 371
Style.LookAndFeel.SkinName = ''
StyleDisabled.LookAndFeel.SkinName = ''
StyleFocused.LookAndFeel.SkinName = ''
StyleHot.LookAndFeel.SkinName = ''
ExplicitLeft = 371
ExplicitWidth = 294
Width = 294
ExplicitWidth = 319
Width = 319
end
end
inherited TBXAlignmentPanel1: TTBXAlignmentPanel
@ -164,6 +172,11 @@ inherited fEditorPedidosProveedor: TfEditorPedidosProveedor
BuiltInReportLink = True
end
end
inherited dxPrintStyleManager1: TdxPrintStyleManager
inherited dxPrintStyleManager1Style1: TdxPSPrintStyle
BuiltInStyle = True
end
end
inherited cxViewGridPopupMenu: TcxGridPopupMenu
PopupMenus = <
item
@ -172,11 +185,6 @@ inherited fEditorPedidosProveedor: TfEditorPedidosProveedor
Index = 0
end>
end
inherited dxPrintStyleManager1: TdxPrintStyleManager
inherited dxPrintStyleManager1Style1: TdxPSPrintStyle
BuiltInStyle = True
end
end
end
inherited EditorActionList: TActionList [4]
Left = 16