Presupuestos de cliente: repaso porque no dejaba cambiar la persona de contacto a la que va el presupuesto ni copiaba la persona de contacto al cambiar de cliente.
git-svn-id: https://192.168.0.254/svn/Proyectos.Tecsitel_FactuGES2/trunk@797 0c75b7a4-871f-7646-8a2f-f78d34cc349f
This commit is contained in:
parent
c6af7429c8
commit
8c0c292d03
@ -83,6 +83,7 @@ begin
|
||||
FAX := AContacto.FAX;
|
||||
MOVIL := AContacto.MOVIL_1;
|
||||
EMAIL := AContacto.EMAIL_1;
|
||||
PERSONA_CONTACTO := AContacto.PERSONA_CONTACTO;
|
||||
end;
|
||||
finally
|
||||
ADireccion.DataTable.Post;
|
||||
|
||||
@ -212,16 +212,17 @@ inherited fEditorPresupuestoCliente: TfEditorPresupuestoCliente
|
||||
inherited ToolButton4: TToolButton
|
||||
Left = 278
|
||||
Top = 0
|
||||
Wrap = True
|
||||
ExplicitLeft = 278
|
||||
ExplicitTop = 0
|
||||
end
|
||||
inherited ToolButton14: TToolButton
|
||||
Left = 334
|
||||
Top = 0
|
||||
ExplicitLeft = 334
|
||||
ExplicitTop = 0
|
||||
Left = 0
|
||||
Wrap = False
|
||||
ExplicitLeft = 0
|
||||
end
|
||||
inherited FontName: TJvFontComboBox
|
||||
Left = 65
|
||||
Top = 22
|
||||
ExplicitTop = 22
|
||||
end
|
||||
|
||||
@ -282,41 +282,10 @@ begin
|
||||
end;
|
||||
|
||||
procedure TfEditorPresupuestoCliente.OnClienteChanged(Sender: TObject);
|
||||
var
|
||||
AClientesController : IClientesController;
|
||||
ADireccion : IBizDireccionesContacto;
|
||||
begin
|
||||
if Assigned(FPresupuesto) then
|
||||
begin
|
||||
FPresupuesto.Cliente := ViewPresupuesto.ViewClientePresupuesto.Cliente;
|
||||
|
||||
AClientesController := TClientesController.Create;
|
||||
try
|
||||
{ // Esto podría ser configurable en el programa
|
||||
if not AClientesController.TieneDatosBancarios(FPresupuesto.Cliente) then
|
||||
MessageBox(0, 'Este cliente no tiene datos bancarios en su ficha', 'Atención', MB_ICONWARNING or MB_OK);}
|
||||
|
||||
case FPresupuesto.Cliente.Direcciones.RecordCount of
|
||||
0 : begin
|
||||
FViewClientePresupuesto.RefrescarDireccion;
|
||||
FPresupuesto.Edit;
|
||||
FPresupuesto.IMPORTE_PORTE := 0;
|
||||
end;
|
||||
else begin
|
||||
FViewClientePresupuesto.ElegirDireccionCliente;
|
||||
end;
|
||||
end;
|
||||
|
||||
// Si el Presupuesto tiene detalles hay que mirar si los descuentos y otros campos
|
||||
// para los artículos hay que cambiarlos.
|
||||
if (FPresupuesto.Detalles.RecordCount > 0) then
|
||||
FController.DetallesController.ActualizarDetalles(FPresupuesto.Detalles, FPresupuesto.Cliente);
|
||||
|
||||
finally
|
||||
ADireccion := NIL;
|
||||
AClientesController := NIL;
|
||||
end;
|
||||
end;
|
||||
if (FPresupuesto.Detalles.RecordCount > 0) then
|
||||
FController.DetallesController.ActualizarDetalles(FPresupuesto.Detalles, FPresupuesto.Cliente);
|
||||
end;
|
||||
|
||||
procedure TfEditorPresupuestoCliente.pgPaginasChanging(Sender: TObject;
|
||||
|
||||
@ -316,6 +316,14 @@ begin
|
||||
if not FCliente.DataTable.Active then
|
||||
FCliente.DataTable.Active := True;
|
||||
edtPersonaContacto.Enabled := True;
|
||||
|
||||
if FCliente.Direcciones.RecordCount > 0 then
|
||||
ElegirDireccionCliente
|
||||
else begin
|
||||
FPresupuesto.Edit;
|
||||
FPresupuesto.PERSONA_CONTACTO := FCliente.PERSONA_CONTACTO;
|
||||
RefrescarDireccion;
|
||||
end;
|
||||
end
|
||||
else begin
|
||||
dsCliente.DataTable := NIL;
|
||||
@ -376,6 +384,7 @@ begin
|
||||
if not FCliente.DataTable.Active then
|
||||
FCliente.DataTable.Active := True;
|
||||
|
||||
edtPersonaContacto.Enabled := True;
|
||||
RefrescarDireccion;
|
||||
end
|
||||
else begin
|
||||
|
||||
Loading…
Reference in New Issue
Block a user