Poder confirmar recepcion de albaran desde la lista de albaranes de cliente
git-svn-id: https://192.168.0.254/svn/Proyectos.LuisLeon_FactuGES/trunk@75 c93665c3-c93d-084d-9b98-7d5f4a9c3376
This commit is contained in:
parent
659f6eddd8
commit
98f79b4d84
Binary file not shown.
@ -466,6 +466,15 @@ begin
|
||||
AAlbaran.Post;
|
||||
end;
|
||||
|
||||
//Validamos las fechas del albarán
|
||||
if not (EsFechaVacia(AAlbaran.FECHA_ENVIO)) then
|
||||
if AAlbaran.FECHA_ENVIO < AAlbaran.FECHA_PREVISTA_ENVIO then
|
||||
raise Exception.Create('La fecha de envio debe ser posterior a la fecha prevista de envio');
|
||||
|
||||
if not (EsFechaVacia(AAlbaran.FECHA_RECEPCION)) then
|
||||
if AAlbaran.FECHA_RECEPCION < AAlbaran.FECHA_ENVIO then
|
||||
raise Exception.Create('La fecha de recepcion debe ser posterior a la fecha de envio');
|
||||
|
||||
{ Asegurarse de valores en campos "automáticos" tanto
|
||||
en MODIFICACIÓN como en INSERCIÓN. }
|
||||
AAlbaran.Edit;
|
||||
|
||||
@ -133,11 +133,15 @@ inherited fEditorAlbaranesCliente: TfEditorAlbaranesCliente
|
||||
Action = actCancelarEnvio
|
||||
DisplayMode = nbdmImageAndText
|
||||
end
|
||||
object TBXItem39: TTBXItem [11]
|
||||
object TBXItem41: TTBXItem [11]
|
||||
Action = actConfirmarRecepcion
|
||||
DisplayMode = nbdmImageAndText
|
||||
end
|
||||
object TBXItem39: TTBXItem [12]
|
||||
Action = actGenerarFactura
|
||||
DisplayMode = nbdmImageAndText
|
||||
end
|
||||
object TBXSeparatorItem17: TTBXSeparatorItem [13]
|
||||
object TBXSeparatorItem17: TTBXSeparatorItem [14]
|
||||
end
|
||||
end
|
||||
inherited tbxMenu: TTBXToolbar
|
||||
@ -182,6 +186,13 @@ inherited fEditorAlbaranesCliente: TfEditorAlbaranesCliente
|
||||
OnExecute = actCancelarEnvioExecute
|
||||
OnUpdate = actCancelarEnvioUpdate
|
||||
end
|
||||
object actConfirmarRecepcion: TAction
|
||||
Category = 'Acciones'
|
||||
Caption = 'Confirmar recepcion'
|
||||
ImageIndex = 23
|
||||
OnExecute = actConfirmarRecepcionExecute
|
||||
OnUpdate = actConfirmarRecepcionUpdate
|
||||
end
|
||||
end
|
||||
inherited SmallImages: TPngImageList
|
||||
PngImages = <
|
||||
|
||||
@ -30,6 +30,8 @@ type
|
||||
TBXItem39: TTBXItem;
|
||||
actCancelarEnvio: TAction;
|
||||
TBXItem40: TTBXItem;
|
||||
actConfirmarRecepcion: TAction;
|
||||
TBXItem41: TTBXItem;
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure actGenerarFacturaUpdate(Sender: TObject);
|
||||
procedure actGenerarFacturaExecute(Sender: TObject);
|
||||
@ -38,6 +40,8 @@ type
|
||||
procedure actEliminarUpdate(Sender: TObject);
|
||||
procedure actCancelarEnvioExecute(Sender: TObject);
|
||||
procedure actCancelarEnvioUpdate(Sender: TObject);
|
||||
procedure actConfirmarRecepcionExecute(Sender: TObject);
|
||||
procedure actConfirmarRecepcionUpdate(Sender: TObject);
|
||||
|
||||
protected
|
||||
FAlbaranes: IBizAlbaranCliente;
|
||||
@ -105,6 +109,27 @@ begin
|
||||
and (FAlbaranes.SITUACION = SITUACION_ALBARAN_ENVIADO);
|
||||
end;
|
||||
|
||||
procedure TfEditorAlbaranesCliente.actConfirmarRecepcionExecute(Sender: TObject);
|
||||
begin
|
||||
inherited;
|
||||
|
||||
try
|
||||
FController.CambiarSituacion(FAlbaranes, SITUACION_ALBARAN_SERVIDO, FAlbaranes.FECHA_ENVIO, Now);
|
||||
except
|
||||
on E : Exception do
|
||||
ShowErrorMessage('Error al cambiar la situación del albarán', E.Message, E);
|
||||
end;
|
||||
actRefrescar.Execute;
|
||||
end;
|
||||
|
||||
procedure TfEditorAlbaranesCliente.actConfirmarRecepcionUpdate(Sender: TObject);
|
||||
begin
|
||||
inherited;
|
||||
(Sender as TAction).Enabled := HayDatos
|
||||
and ViewGrid.esSeleccionCeldaDatos
|
||||
and (FAlbaranes.SITUACION = SITUACION_ALBARAN_ENVIADO);
|
||||
end;
|
||||
|
||||
procedure TfEditorAlbaranesCliente.actEliminarUpdate(Sender: TObject);
|
||||
begin
|
||||
inherited;
|
||||
@ -173,7 +198,7 @@ begin
|
||||
AFactura := NIL;
|
||||
end;
|
||||
end;
|
||||
}
|
||||
}
|
||||
except
|
||||
on E : Exception do
|
||||
ShowErrorMessage('Error al cambiar la situación del albarán', E.Message, E);
|
||||
|
||||
@ -362,6 +362,7 @@ inherited frViewAlbaranCliente: TfrViewAlbaranCliente
|
||||
DataBinding.DataField = 'FECHA_RECEPCION'
|
||||
DataBinding.DataSource = DADataSource
|
||||
Properties.ImmediatePost = True
|
||||
Properties.OnValidate = eFechaRecepcionPropertiesValidate
|
||||
Style.BorderColor = clWindowFrame
|
||||
Style.BorderStyle = ebs3D
|
||||
Style.Color = clWindow
|
||||
|
||||
@ -110,6 +110,8 @@ type
|
||||
var DisplayValue: Variant; var ErrorText: TCaption; var Error: Boolean);
|
||||
procedure eFechaEnvioPropertiesValidate(Sender: TObject;
|
||||
var DisplayValue: Variant; var ErrorText: TCaption; var Error: Boolean);
|
||||
procedure eFechaRecepcionPropertiesValidate(Sender: TObject;
|
||||
var DisplayValue: Variant; var ErrorText: TCaption; var Error: Boolean);
|
||||
protected
|
||||
FAlbaran : IBizAlbaranCliente;
|
||||
FAlmacenesController : IAlmacenesController;
|
||||
@ -237,12 +239,23 @@ begin
|
||||
if VarIsNull(DisplayValue) or (DisplayValue = '') then
|
||||
begin
|
||||
if (ShowConfirmMessage('Si elimina la fecha prevista de envio, se eliminarán tambien las fechas de envio y recepción en caso de tenerlas. ¿Desea continuar?', '') = IDYES) then
|
||||
eFechaRecepcion.Enabled := false
|
||||
begin
|
||||
eFechaRecepcion.Clear;
|
||||
eFechaRecepcion.Enabled := false;
|
||||
end
|
||||
else
|
||||
DisplayValue := DateToStr(eFechaEnvio.Date);
|
||||
DisplayValue := DateToStr(eFechaEnvio.Date);
|
||||
end
|
||||
else
|
||||
eFechaRecepcion.Enabled := true;
|
||||
begin
|
||||
if (eFechaEnvio.Date >= eFechaPrevista.Date) then
|
||||
eFechaRecepcion.Enabled := true
|
||||
else
|
||||
begin
|
||||
ShowWarningMessage('La fecha de envio debe ser posterior a la fecha prevista de envio');
|
||||
eFechaEnvio.SetFocus;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrViewAlbaranCliente.eFechaPrevistaPropertiesValidate(Sender: TObject; var DisplayValue: Variant; var ErrorText: TCaption;
|
||||
@ -253,7 +266,9 @@ begin
|
||||
begin
|
||||
if (ShowConfirmMessage('Si elimina la fecha prevista de envio, se eliminarán tambien las fechas de envio y recepción en caso de tenerlas. ¿Desea continuar?', '') = IDYES) then
|
||||
begin
|
||||
eFechaEnvio.Clear;
|
||||
eFechaEnvio.Enabled := false;
|
||||
eFechaRecepcion.Clear;
|
||||
eFechaRecepcion.Enabled := false;
|
||||
end
|
||||
else
|
||||
@ -263,6 +278,22 @@ begin
|
||||
eFechaEnvio.Enabled := true;
|
||||
end;
|
||||
|
||||
procedure TfrViewAlbaranCliente.eFechaRecepcionPropertiesValidate(
|
||||
Sender: TObject; var DisplayValue: Variant; var ErrorText: TCaption;
|
||||
var Error: Boolean);
|
||||
begin
|
||||
inherited;
|
||||
if not (VarIsNull(DisplayValue) or (DisplayValue = '')) then
|
||||
begin
|
||||
if (eFechaRecepcion.Date < eFechaEnvio.Date) then
|
||||
begin
|
||||
ShowWarningMessage('La fecha de recepción debe ser posterior a la fecha de envio');
|
||||
eFechaRecepcion.SetFocus;
|
||||
end;
|
||||
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrViewAlbaranCliente.frViewClienteAlbaranactAnadirContactoUpdate(
|
||||
Sender: TObject);
|
||||
begin
|
||||
|
||||
Reference in New Issue
Block a user