Arreglo, al eliminar una o varias facturas de proveedor si tiene recibos con devoluciones la factura esta pendiente y se puede borar pero por integridad no se permite borrar, antes este caso no decia nada ahora se saca un mensaje

git-svn-id: https://192.168.0.254/svn/Proyectos.Acana_FactuGES2/trunk@311 f4e31baf-9722-1c47-927c-6f952f962d4b
This commit is contained in:
David Arranz 2008-09-19 09:57:37 +00:00
parent 7947221b56
commit 2d5918b06b
15 changed files with 157 additions and 146 deletions

View File

@ -3762,7 +3762,8 @@ ALTER TABLE PEDIDOS_PROVEEDOR_DETALLES ADD CONSTRAINT FK_PEDIDOS_PROV_DET_ID_PED
ALTER TABLE REMESAS_CLIENTE ADD CONSTRAINT FK_REMESAS_CLIENTE FOREIGN KEY (ID_EMPRESA) REFERENCES EMPRESAS (ID);
ALTER TABLE REMESAS_PROVEEDOR ADD CONSTRAINT FK_REMESAS_PROVEEDOR FOREIGN KEY (ID_EMPRESA) REFERENCES EMPRESAS (ID);
ALTER TABLE TIENDA_WEB ADD CONSTRAINT FK_EMPRESAS_TIENDA_WEB FOREIGN KEY (ID_EMPRESA) REFERENCES EMPRESAS (ID) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE PAGOS_CLIENTE ADD CONSTRAINT FK_PAGOS_CLIENTE_1 FOREIGN KEY (ID_RECIBO) REFERENCES RECIBOS_CLIENTE (ID);
ALTER TABLE PAGOS_PROVEEDOR ADD CONSTRAINT FK_PAGOS_PROVEEDOR_1 FOREIGN KEY (ID_RECIBO) REFERENCES RECIBOS_PROVEEDOR (ID);
/******************************************************************************/
/**** Indices ****/

View File

@ -826,8 +826,14 @@ begin
if bEliminado then
begin
AFactura.DataTable.ApplyUpdates;
Result := True;
try
AFactura.DataTable.ApplyUpdates;
Result := True
except
//En el caso de una factura que tiene recibos con devoluciones hechas no se puede borrar aunque la factura este en situacion de pendiente
AFactura.DataTable.CancelUpdates;
Result := False;
end;
end
else
Result := False;

View File

@ -102,37 +102,17 @@ inherited fEditorFacturaCliente: TfEditorFacturaCliente
Height = 370
ExplicitWidth = 757
ExplicitHeight = 370
inherited eReferencia: TcxDBTextEdit
ExplicitWidth = 159
Width = 159
end
inherited edtFecha: TcxDBDateEdit
ExplicitWidth = 159
Width = 159
end
inherited memObservaciones: TcxDBMemo
ExplicitWidth = 301
ExplicitHeight = 159
Height = 159
Width = 301
end
inherited cbFormaPago: TcxDBLookupComboBox
ExplicitWidth = 78
Width = 78
end
inherited frViewTienda1: TfrViewTienda
inherited dxLayoutControl1: TdxLayoutControl
inherited cbTienda: TcxComboBox
ExplicitWidth = 399
Width = 399
end
end
ExplicitWidth = 713
ExplicitHeight = 29
Height = 29
Width = 713
end
inherited frViewClienteFactura1: TfrViewClienteFactura
Width = 314
ExplicitWidth = 314
Width = 334
ExplicitWidth = 334
inherited dxLayoutControl1: TdxLayoutControl
Width = 314
Width = 334
ExplicitWidth = 314
inherited Bevel1: TBevel
Width = 266
@ -140,28 +120,28 @@ inherited fEditorFacturaCliente: TfEditorFacturaCliente
end
inherited edtlNombre: TcxDBTextEdit
DataBinding.DataSource = dsDataTable
ExplicitWidth = 224
Width = 224
ExplicitWidth = 243
Width = 243
end
inherited edtNIFCIF: TcxDBTextEdit
DataBinding.DataSource = dsDataTable
ExplicitWidth = 562
Width = 562
ExplicitWidth = 243
Width = 243
end
inherited edtCalle: TcxDBTextEdit
DataBinding.DataSource = dsDataTable
ExplicitWidth = 562
Width = 562
ExplicitWidth = 243
Width = 243
end
inherited edtPoblacion: TcxDBTextEdit
DataBinding.DataSource = dsDataTable
ExplicitWidth = 177
Width = 177
ExplicitWidth = 125
Width = 125
end
inherited edtProvincia: TcxDBTextEdit
DataBinding.DataSource = dsDataTable
ExplicitWidth = 327
Width = 327
ExplicitWidth = 243
Width = 243
end
inherited edtCodigoPostal: TcxDBTextEdit
Left = 242
@ -173,8 +153,8 @@ inherited fEditorFacturaCliente: TfEditorFacturaCliente
ExplicitLeft = 132
end
inherited cxDBTextEdit1: TcxDBTextEdit
ExplicitWidth = 283
Width = 283
ExplicitWidth = 243
Width = 243
end
end
end
@ -302,14 +282,14 @@ inherited fEditorFacturaCliente: TfEditorFacturaCliente
inherited cbSubCuentas: TcxComboBox
Left = 85
ExplicitLeft = 85
ExplicitWidth = 376
Width = 376
ExplicitWidth = 429
Width = 429
end
inherited eContabilizar: TcxCheckBox
Left = 520
ExplicitLeft = 520
ExplicitWidth = 203
Width = 203
ExplicitWidth = 227
Width = 227
end
inherited dxLayoutControl1Group_Root: TdxLayoutGroup
inherited dxLayoutControl1Item1: TdxLayoutItem
@ -377,8 +357,8 @@ inherited fEditorFacturaCliente: TfEditorFacturaCliente
Top = 131
Style.IsFontAssigned = True
ExplicitTop = 131
ExplicitWidth = 93
Width = 93
ExplicitWidth = 220
Width = 220
end
inherited ImporteIVA: TcxDBCurrencyEdit
Left = 594
@ -386,8 +366,8 @@ inherited fEditorFacturaCliente: TfEditorFacturaCliente
Style.IsFontAssigned = True
ExplicitLeft = 594
ExplicitTop = 57
ExplicitWidth = 137
Width = 137
ExplicitWidth = 155
Width = 155
end
inherited ImporteTotal: TcxDBCurrencyEdit
Left = 524
@ -395,8 +375,8 @@ inherited fEditorFacturaCliente: TfEditorFacturaCliente
Style.IsFontAssigned = True
ExplicitLeft = 524
ExplicitTop = 131
ExplicitWidth = 137
Width = 137
ExplicitWidth = 225
Width = 225
end
inherited edtDescuento: TcxDBSpinEdit
Top = 131
@ -417,8 +397,8 @@ inherited fEditorFacturaCliente: TfEditorFacturaCliente
Style.IsFontAssigned = True
ExplicitLeft = 523
ExplicitTop = 30
ExplicitWidth = 92
Width = 92
ExplicitWidth = 226
Width = 226
end
inherited edtRE: TcxDBSpinEdit
Left = 523
@ -434,15 +414,15 @@ inherited fEditorFacturaCliente: TfEditorFacturaCliente
Style.IsFontAssigned = True
ExplicitLeft = 594
ExplicitTop = 84
ExplicitWidth = 56
Width = 56
ExplicitWidth = 155
Width = 155
end
inherited eImporteNeto: TcxDBCurrencyEdit
Top = 30
Style.IsFontAssigned = True
ExplicitTop = 30
ExplicitWidth = 147
Width = 147
ExplicitWidth = 291
Width = 291
end
inherited ePorte: TcxDBCurrencyEdit
Top = 158
@ -451,16 +431,16 @@ inherited fEditorFacturaCliente: TfEditorFacturaCliente
Style.IsFontAssigned = True
OnEditing = frViewTotales1ePorteEditing
ExplicitTop = 158
ExplicitWidth = 147
Width = 147
ExplicitWidth = 291
Width = 291
end
inherited eIVA: TcxDBLookupComboBox
Top = 57
Properties.OnValidate = frViewTotales1eIVAPropertiesValidate
Style.Color = clInfoBk
ExplicitTop = 57
ExplicitWidth = 134
Width = 134
ExplicitWidth = 153
Width = 153
end
inherited bTiposIVA: TButton
Left = 263
@ -473,8 +453,8 @@ inherited fEditorFacturaCliente: TfEditorFacturaCliente
Top = 84
Properties.OnEditValueChanged = frViewTotales1cbRecargoEquivalenciaPropertiesEditValueChanged
ExplicitTop = 84
ExplicitWidth = 219
Width = 219
ExplicitWidth = 291
Width = 291
end
inherited dxLayoutControl1Group_Root: TdxLayoutGroup
inherited dxLayoutControl1Group1: TdxLayoutGroup

View File

@ -143,7 +143,9 @@ begin
if (Application.MessageBox(PChar(ACadena), 'Atención', MB_YESNO) = IDYES) then
begin
FController.Eliminar(Factura);
//Es el caso de querer borrar una factura pendiente cuyos recibos tienen devoluciones
if not FController.Eliminar(Factura) then
Application.MessageBox('La factura no ha podido ser eliminada porque tiene recibos con pagos o devoluciones emitidas.', 'Atención', MB_OK);
inherited;
end;
end;

View File

@ -38,7 +38,7 @@ inherited fEditorFacturasCliente: TfEditorFacturasCliente
Width = 640
ExplicitWidth = 640
inherited tbxMain: TTBXToolbar
ExplicitWidth = 632
ExplicitWidth = 640
object TBXSubmenuItem2: TTBXSubmenuItem [0]
Caption = 'Nuevo'
DisplayMode = nbdmImageAndText
@ -133,18 +133,18 @@ inherited fEditorFacturasCliente: TfEditorFacturasCliente
Width = 640
ExplicitWidth = 640
inherited txtFiltroTodo: TcxTextEdit
ExplicitWidth = 457
Width = 457
ExplicitWidth = 543
Width = 543
end
inherited edtFechaIniFiltro: TcxDateEdit
ExplicitWidth = 240
Width = 240
ExplicitWidth = 263
Width = 263
end
inherited edtFechaFinFiltro: TcxDateEdit
Left = 367
ExplicitLeft = 367
ExplicitWidth = 244
Width = 244
ExplicitWidth = 263
Width = 263
end
end
inherited TBXAlignmentPanel1: TTBXAlignmentPanel
@ -3355,8 +3355,8 @@ inherited fEditorFacturasCliente: TfEditorFacturasCliente
82866906D6993E62F6F1C3F45D160A5305BE68FF8095CF5B4302134CFE1185EA
1FB8A1B4FF4FE32FF6FADB8B5E0000000049454E44AE426082}
Instruction.Text =
'Las siguientes facturas no han podido ser eliminadas, porque est' +
#225'n parcialmente pagadas o totalmete pagadas'
'Las siguientes facturas no han podido ser eliminadas, porque tie' +
'nen recibos con pagos o devoluciones emitidas'
Instruction.Glyph.Data = {
0A54504E474F626A65637489504E470D0A1A0A0000000D494844520000001C00
00001C0806000000720DDF940000000970485973000017120000171201679FD2

View File

@ -173,13 +173,21 @@ begin
if Assigned(AFacturas) then
begin
FController.Eliminar(AFacturas, AllItems);
if (not FController.Eliminar(AFacturas, AllItems))
and (not AllItems) then //Es el caso de querer borrar una factura pendiente cuyos recibos tienen devoluciones
begin
JsListaFacturasNoEliminadas.Content.Clear;
JsListaFacturasNoEliminadas.Content.Add('Ref. factura: ' + AFacturas.REFERENCIA + ' ' + AFacturas.NOMBRE);
JsListaFacturasNoEliminadas.Execute;
end;
if AllItems then
begin
if (AFacturas.DataTable.RecordCount > 0) then
begin
with AFacturas.DataTable do
begin
JsListaFacturasNoEliminadas.Content.Clear;
First;
while not EOF do
begin

View File

@ -833,8 +833,14 @@ begin
if bEliminado then
begin
AFactura.DataTable.ApplyUpdates;
Result := True;
try
AFactura.DataTable.ApplyUpdates;
Result := True
except
//En el caso de una factura que tiene recibos con devoluciones hechas no se puede borrar aunque la factura este en situacion de pendiente
AFactura.DataTable.CancelUpdates;
Result := False;
end;
end
else
Result := False;

View File

@ -106,42 +106,44 @@ inherited fEditorFacturaProveedor: TfEditorFacturaProveedor
732
314)
inherited eReferencia: TcxDBTextEdit
ExplicitWidth = 159
Width = 159
ExplicitWidth = 191
Width = 191
end
inherited edtFecha: TcxDBDateEdit
ExplicitWidth = 159
Width = 159
ExplicitWidth = 191
Width = 191
end
inherited memObservaciones: TcxDBMemo
ExplicitWidth = 301
ExplicitHeight = 159
Height = 159
Width = 301
ExplicitWidth = 671
Width = 671
end
inherited cbFormaPago: TcxDBLookupComboBox
ExplicitWidth = 169
Width = 169
ExplicitWidth = 53
Width = 53
end
inherited bFormasPago: TButton
Left = 183
ExplicitLeft = 183
end
inherited eReferenciaProveedor: TcxDBTextEdit
ExplicitWidth = 316
Width = 316
ExplicitWidth = 191
Width = 191
end
inherited frViewTienda1: TfrViewTienda
Width = 320
ExplicitWidth = 320
Width = 293
ExplicitWidth = 293
inherited dxLayoutControl1: TdxLayoutControl
Width = 320
Width = 293
inherited cbTienda: TcxComboBox
ExplicitWidth = 376
Width = 376
ExplicitWidth = 232
Width = 232
end
end
end
inherited edtFechaVencimiento: TcxDBDateEdit
ExplicitWidth = 191
Width = 191
end
inherited frViewProveedorFactura1: TfrViewProveedorFactura
Left = 343
Width = 350
@ -156,27 +158,27 @@ inherited fEditorFacturaProveedor: TfEditorFacturaProveedor
end
inherited edtlNombre: TcxDBTextEdit
DataBinding.DataSource = dsDataTable
ExplicitWidth = 266
Width = 266
ExplicitWidth = 259
Width = 259
end
inherited edtNIFCIF: TcxDBTextEdit
DataBinding.DataSource = dsDataTable
ExplicitWidth = 266
Width = 266
ExplicitWidth = 259
Width = 259
end
inherited edtCalle: TcxDBTextEdit
DataBinding.DataSource = dsDataTable
ExplicitWidth = 266
Width = 266
ExplicitWidth = 259
Width = 259
end
inherited edtPoblacion: TcxDBTextEdit
DataBinding.DataSource = dsDataTable
ExplicitWidth = 148
Width = 148
ExplicitWidth = 141
Width = 141
end
inherited edtProvincia: TcxDBTextEdit
ExplicitWidth = 266
Width = 266
ExplicitWidth = 259
Width = 259
end
inherited edtCodigoPostal: TcxDBTextEdit
Left = 258
@ -188,8 +190,8 @@ inherited fEditorFacturaProveedor: TfEditorFacturaProveedor
ExplicitLeft = 142
end
inherited cxDBTextEdit1: TcxDBTextEdit
ExplicitWidth = 276
Width = 276
ExplicitWidth = 259
Width = 259
end
end
end
@ -199,10 +201,6 @@ inherited fEditorFacturaProveedor: TfEditorFacturaProveedor
object pagContenido: TTabSheet
Caption = 'Contenido'
ImageIndex = 1
ExplicitLeft = 0
ExplicitTop = 0
ExplicitWidth = 0
ExplicitHeight = 0
inline frViewDetallesFacturaProveedor1: TfrViewDetallesFacturaProveedor
Left = 0
Top = 0
@ -320,14 +318,14 @@ inherited fEditorFacturaProveedor: TfEditorFacturaProveedor
inherited cbSubCuentas: TcxComboBox
Left = 92
ExplicitLeft = 92
ExplicitWidth = 376
Width = 376
ExplicitWidth = 407
Width = 407
end
inherited eContabilizar: TcxCheckBox
Left = 505
ExplicitLeft = 505
ExplicitWidth = 203
Width = 203
ExplicitWidth = 217
Width = 217
end
inherited dxLayoutControl1Group_Root: TdxLayoutGroup
inherited dxLayoutControl1Item1: TdxLayoutItem
@ -394,8 +392,8 @@ inherited fEditorFacturaProveedor: TfEditorFacturaProveedor
Top = 131
Style.IsFontAssigned = True
ExplicitTop = 131
ExplicitWidth = 93
Width = 93
ExplicitWidth = 207
Width = 207
end
inherited ImporteIVA: TcxDBCurrencyEdit
Left = 581
@ -403,8 +401,8 @@ inherited fEditorFacturaProveedor: TfEditorFacturaProveedor
Style.IsFontAssigned = True
ExplicitLeft = 581
ExplicitTop = 57
ExplicitWidth = 137
Width = 137
ExplicitWidth = 143
Width = 143
end
inherited ImporteTotal: TcxDBCurrencyEdit
Left = 511
@ -412,8 +410,8 @@ inherited fEditorFacturaProveedor: TfEditorFacturaProveedor
Style.IsFontAssigned = True
ExplicitLeft = 511
ExplicitTop = 131
ExplicitWidth = 137
Width = 137
ExplicitWidth = 213
Width = 213
end
inherited edtDescuento: TcxDBSpinEdit
Top = 131
@ -434,8 +432,8 @@ inherited fEditorFacturaProveedor: TfEditorFacturaProveedor
Style.IsFontAssigned = True
ExplicitLeft = 510
ExplicitTop = 30
ExplicitWidth = 92
Width = 92
ExplicitWidth = 214
Width = 214
end
inherited edtRE: TcxDBSpinEdit
Left = 510
@ -451,15 +449,15 @@ inherited fEditorFacturaProveedor: TfEditorFacturaProveedor
Style.IsFontAssigned = True
ExplicitLeft = 581
ExplicitTop = 84
ExplicitWidth = 56
Width = 56
ExplicitWidth = 143
Width = 143
end
inherited eImporteNeto: TcxDBCurrencyEdit
Top = 30
Style.IsFontAssigned = True
ExplicitTop = 30
ExplicitWidth = 147
Width = 147
ExplicitWidth = 278
Width = 278
end
inherited ePorte: TcxDBCurrencyEdit
Top = 158
@ -468,16 +466,16 @@ inherited fEditorFacturaProveedor: TfEditorFacturaProveedor
Style.IsFontAssigned = True
OnEditing = frViewTotales1ePorteEditing
ExplicitTop = 158
ExplicitWidth = 147
Width = 147
ExplicitWidth = 278
Width = 278
end
inherited eIVA: TcxDBLookupComboBox
Top = 57
Properties.OnValidate = frViewTotales1eIVAPropertiesValidate
Style.Color = clInfoBk
ExplicitTop = 57
ExplicitWidth = 134
Width = 134
ExplicitWidth = 140
Width = 140
end
inherited bTiposIVA: TButton
Left = 250
@ -490,8 +488,8 @@ inherited fEditorFacturaProveedor: TfEditorFacturaProveedor
Top = 84
Properties.OnEditValueChanged = frViewTotales1cbRecargoEquivalenciaPropertiesEditValueChanged
ExplicitTop = 84
ExplicitWidth = 219
Width = 219
ExplicitWidth = 278
Width = 278
end
inherited dxLayoutControl1Group_Root: TdxLayoutGroup
LookAndFeel = frViewFacturaProveedor1.dxLayoutOfficeLookAndFeel1

View File

@ -140,7 +140,9 @@ begin
if (Application.MessageBox(PChar(AMensaje), 'Atención', MB_YESNO) = IDYES) then
begin
FController.Eliminar(Factura);
//Es el caso de querer borrar una factura pendiente cuyos recibos tienen devoluciones
if not FController.Eliminar(Factura) then
Application.MessageBox('La factura no ha podido ser eliminada porque tiene recibos con pagos o devoluciones emitidas.', 'Atención', MB_OK);
inherited;
end;
end;

View File

@ -38,7 +38,7 @@ inherited fEditorFacturasProveedor: TfEditorFacturasProveedor
Width = 640
ExplicitWidth = 640
inherited tbxMain: TTBXToolbar
ExplicitWidth = 632
ExplicitWidth = 640
object TBXSubmenuItem2: TTBXSubmenuItem [0]
Caption = 'Nuevo'
DisplayMode = nbdmImageAndText
@ -131,18 +131,18 @@ inherited fEditorFacturasProveedor: TfEditorFacturasProveedor
Width = 640
ExplicitWidth = 640
inherited txtFiltroTodo: TcxTextEdit
ExplicitWidth = 457
Width = 457
ExplicitWidth = 543
Width = 543
end
inherited edtFechaIniFiltro: TcxDateEdit
ExplicitWidth = 240
Width = 240
ExplicitWidth = 263
Width = 263
end
inherited edtFechaFinFiltro: TcxDateEdit
Left = 367
ExplicitLeft = 367
ExplicitWidth = 244
Width = 244
ExplicitWidth = 263
Width = 263
end
end
inherited TBXAlignmentPanel1: TTBXAlignmentPanel
@ -3353,8 +3353,8 @@ inherited fEditorFacturasProveedor: TfEditorFacturasProveedor
82866906D6993E62F6F1C3F45D160A5305BE68FF8095CF5B4302134CFE1185EA
1FB8A1B4FF4FE32FF6FADB8B5E0000000049454E44AE426082}
Instruction.Text =
'Las siguientes facturas no han podido ser eliminadas, porque est' +
#225'n parcialmente pagadas o totalmete pagadas'
'Las siguientes facturas no han podido ser eliminadas, porque tie' +
'nen recibos con pagos o devoluciones emitidas'
Instruction.Glyph.Data = {
0A54504E474F626A65637489504E470D0A1A0A0000000D494844520000001C00
00001C0806000000720DDF940000000970485973000017120000171201679FD2

View File

@ -180,13 +180,21 @@ begin
if Assigned(AFacturas) then
begin
FController.Eliminar(AFacturas, AllItems);
if (not FController.Eliminar(AFacturas, AllItems))
and (not AllItems) then //Es el caso de querer borrar una factura pendiente cuyos recibos tienen devoluciones
begin
JsListaFacturasNoEliminadas.Content.Clear;
JsListaFacturasNoEliminadas.Content.Add('Ref. factura: ' + AFacturas.REFERENCIA + ' ' + AFacturas.NOMBRE);
JsListaFacturasNoEliminadas.Execute;
end;
if AllItems then
begin
if (AFacturas.DataTable.RecordCount > 0) then
begin
with AFacturas.DataTable do
begin
JsListaFacturasNoEliminadas.Content.Clear;
First;
while not EOF do
begin

View File

@ -13,4 +13,4 @@ BEGIN
END
/* C:\Codigo Acana\Source\Modulos\Gestion de documentos\Controller\GestorDocumentos_Controller.res */
/* C:\DOCUME~1\Usuario\CONFIG~1\Temp\dtf36A.tmp */
/* C:\DOCUME~1\Usuario\CONFIG~1\Temp\dtf1F7.tmp */

View File

@ -14,4 +14,4 @@ END
/* C:\Codigo Acana\Source\Modulos\Gestion de documentos\Data\uDataModuleGestorDocumentos.dfm */
/* C:\Codigo Acana\Source\Modulos\Gestion de documentos\Data\GestorDocumentos_data.res */
/* C:\DOCUME~1\Usuario\CONFIG~1\Temp\dtf368.tmp */
/* C:\DOCUME~1\Usuario\CONFIG~1\Temp\dtf1F5.tmp */

Binary file not shown.

View File

@ -16,7 +16,7 @@ BEGIN
VALUE "FileVersion", "2.2.4.0\0"
VALUE "ProductName", "FactuGES (Servidor)\0"
VALUE "ProductVersion", "2.2.4.0\0"
VALUE "CompileDate", "lunes, 08 de septiembre de 2008 18:46\0"
VALUE "CompileDate", "viernes, 19 de septiembre de 2008 11:50\0"
END
END
BLOCK "VarFileInfo"