Revisión #535 -> Retoque al código

git-svn-id: https://192.168.0.254/svn/Proyectos.Acana_FactuGES2/trunk@540 f4e31baf-9722-1c47-927c-6f952f962d4b
This commit is contained in:
David Arranz 2010-10-13 15:14:18 +00:00
parent 7a7a9f4e69
commit 19dd1b4e86

View File

@ -74,7 +74,7 @@ type
const AHeaderText: String = '');
procedure VerDireccionEntrega(APresupuesto : IBizPresupuestoCliente);
function Nuevo : IBizPresupuestoCliente;
function Anadir(APresupuesto : IBizPresupuestoCliente; ATipo: TEnumTiposPresupuesto) : Boolean;
function Anadir(APresupuesto : IBizPresupuestoCliente; const ATipo: TEnumTiposPresupuesto = teVarios) : Boolean;
function Eliminar(const ID : Integer): Boolean; overload;
function Eliminar(APresupuesto : IBizPresupuestoCliente; AllItems: Boolean = false): Boolean; overload;
function Guardar(APresupuesto : IBizPresupuestoCliente): Boolean;
@ -127,6 +127,8 @@ type
procedure FiltrarEmpresa(APresupuesto: IBizPresupuestoCliente);
function _Vacio : IBizPresupuestoCliente;
function ValidarPresupuesto(APresupuesto: IBizPresupuestoCliente): Boolean;
procedure RellenarValoresDefecto(APresupuesto: IBizPresupuestoCliente; ATipo: TEnumTiposPresupuesto);
public
property ClienteController: IClientesController read GetClienteController write SetClienteController;
property DetallesController: IDetallesPresupuestoClienteController read GetDetallesController write SetDetallesController;
@ -143,7 +145,7 @@ type
function Guardar(APresupuesto : IBizPresupuestoCliente): Boolean;
procedure DescartarCambios(APresupuesto : IBizPresupuestoCliente); virtual;
function Existe(const ID: Integer) : Boolean; virtual;
function Anadir(APresupuesto : IBizPresupuestoCliente; ATipo: TEnumTiposPresupuesto) : Boolean;
function Anadir(APresupuesto : IBizPresupuestoCliente; const ATipo: TEnumTiposPresupuesto = teVarios) : Boolean;
function Buscar(const ListaID: TIntegerList): IBizPresupuestoCliente; overload;
function Buscar(const ID: Integer): IBizPresupuestoCliente; overload;
function BuscarTodos: IBizPresupuestoCliente; overload;
@ -188,53 +190,13 @@ uses
{ TPresupuestosClienteController }
function TPresupuestosClienteController.Anadir(APresupuesto: IBizPresupuestoCliente; ATipo: TEnumTiposPresupuesto): Boolean;
function TPresupuestosClienteController.Anadir(APresupuesto: IBizPresupuestoCliente; const ATipo: TEnumTiposPresupuesto): Boolean;
begin
if not Assigned(APresupuesto) then
raise Exception.Create ('Presupuesto no asignado (Anadir)');
APresupuesto.Insert;
case ATipo of
teCocina: begin
APresupuesto.TIPO_PRESUPUESTO := CTE_COCINA;
APresupuesto.FORMA_PAGO.Add(AppFactuGES.Configuracion.GetSettingAsString(teBD,CTE_FORMA_PAGO_COCINA));
APresupuesto.PLAZO_ENTREGA.Add(AppFactuGES.Configuracion.GetSettingAsString(teBD,CTE_PLAZOS_ENTREGA_COCINA));
APresupuesto.OBSERVACIONES.Add(AppFactuGES.Configuracion.GetSettingAsString(teBD,CTE_OBSERVACIONES_COCINA));
(Self.DetallesController as IDetallesPresupuestoClienteController).AnadirCapitulo(TIPO_CAPITULO_C_VACIO, 'MUEBLES DE COCINA ', False, APresupuesto.Detalles);
(Self.DetallesController as IDetallesPresupuestoClienteController).AnadirCapitulo(TIPO_CAPITULO_V, 'IMPORTES ', True, APresupuesto.Detalles);
(Self.DetallesController as IDetallesPresupuestoClienteController).AnadirCapitulo(TIPO_CAPITULO_V, 'AUMENTO POR ', False, APresupuesto.Detalles);
end;
teArmario:begin
APresupuesto.TIPO_PRESUPUESTO := CTE_ARMARIO;
APresupuesto.FORMA_PAGO.Add(AppFactuGES.Configuracion.GetSettingAsString(teBD,CTE_FORMA_PAGO_ARMARIO));
APresupuesto.PLAZO_ENTREGA.Add(AppFactuGES.Configuracion.GetSettingAsString(teBD,CTE_PLAZOS_ENTREGA_ARMARIO));
APresupuesto.OBSERVACIONES.Add(AppFactuGES.Configuracion.GetSettingAsString(teBD,CTE_OBSERVACIONES_ARMARIO));
(Self.DetallesController as IDetallesPresupuestoClienteController).AnadirCapitulo(TIPO_CAPITULO_AF, 'FRENTE DE ARMARIO Nº ', False, APresupuesto.Detalles);
(Self.DetallesController as IDetallesPresupuestoClienteController).AnadirCapitulo(TIPO_CAPITULO_AI, 'INTERIOR DE ARMARIO Nº ', False, APresupuesto.Detalles);
end;
teBano: begin
APresupuesto.TIPO_PRESUPUESTO := CTE_BANO;
APresupuesto.FORMA_PAGO.Add(AppFactuGES.Configuracion.GetSettingAsString(teBD,CTE_FORMA_PAGO_BANO));
APresupuesto.PLAZO_ENTREGA.Add(AppFactuGES.Configuracion.GetSettingAsString(teBD,CTE_PLAZOS_ENTREGA_BANO));
APresupuesto.OBSERVACIONES.Add(AppFactuGES.Configuracion.GetSettingAsString(teBD,CTE_OBSERVACIONES_BANO));
(Self.DetallesController as IDetallesPresupuestoClienteController).AnadirCapitulo(TIPO_CAPITULO_B, 'MUEBLE DE BAÑO Nº ', False, APresupuesto.Detalles);
(Self.DetallesController as IDetallesPresupuestoClienteController).AnadirCapitulo(TIPO_CAPITULO_V, 'IMPORTES ', True, APresupuesto.Detalles);
end;
teElectrodomestico: begin
APresupuesto.TIPO_PRESUPUESTO := CTE_ELECTRODOMESTICO;
APresupuesto.FORMA_PAGO.Add(AppFactuGES.Configuracion.GetSettingAsString(teBD,CTE_FORMA_PAGO_ELECTRODOMESTICO));
APresupuesto.PLAZO_ENTREGA.Add(AppFactuGES.Configuracion.GetSettingAsString(teBD,CTE_PLAZOS_ENTREGA_ELECTRODOMESTICO));
APresupuesto.OBSERVACIONES.Add(AppFactuGES.Configuracion.GetSettingAsString(teBD,CTE_OBSERVACIONES_ELECTRODOMESTICO));
(Self.DetallesController as IDetallesPresupuestoClienteController).AnadirCapitulo(TIPO_CAPITULO_E, 'ELECTRODOMÉSTICOS ', False, APresupuesto.Detalles);
end;
teVarios: begin
APresupuesto.TIPO_PRESUPUESTO := CTE_VARIOS;
APresupuesto.FORMA_PAGO.Add(AppFactuGES.Configuracion.GetSettingAsString(teBD,CTE_FORMA_PAGO_VARIOS));
APresupuesto.PLAZO_ENTREGA.Add(AppFactuGES.Configuracion.GetSettingAsString(teBD,CTE_PLAZOS_ENTREGA_VARIOS));
APresupuesto.OBSERVACIONES.Add(AppFactuGES.Configuracion.GetSettingAsString(teBD,CTE_OBSERVACIONES_VARIOS));
(Self.DetallesController as IDetallesPresupuestoClienteController).AnadirCapitulo(TIPO_CAPITULO_V, 'VARIOS ', False, APresupuesto.Detalles);
end;
end;
RellenarValoresDefecto(APresupuesto, ATipo);
Result := True;
end;
@ -918,6 +880,56 @@ begin
end;
end;
procedure TPresupuestosClienteController.RellenarValoresDefecto(APresupuesto: IBizPresupuestoCliente; ATipo: TEnumTiposPresupuesto);
begin
case ATipo of
teCocina:
begin
APresupuesto.TIPO_PRESUPUESTO := CTE_COCINA;
APresupuesto.FORMA_PAGO.Add(AppFactuGES.Configuracion.GetSettingAsString(teBD, CTE_FORMA_PAGO_COCINA));
APresupuesto.PLAZO_ENTREGA.Add(AppFactuGES.Configuracion.GetSettingAsString(teBD, CTE_PLAZOS_ENTREGA_COCINA));
APresupuesto.OBSERVACIONES.Add(AppFactuGES.Configuracion.GetSettingAsString(teBD, CTE_OBSERVACIONES_COCINA));
(Self.DetallesController as IDetallesPresupuestoClienteController).AnadirCapitulo(TIPO_CAPITULO_C_VACIO, 'MUEBLES DE COCINA ', False, APresupuesto.Detalles);
(Self.DetallesController as IDetallesPresupuestoClienteController).AnadirCapitulo(TIPO_CAPITULO_V, 'IMPORTES ', True, APresupuesto.Detalles);
(Self.DetallesController as IDetallesPresupuestoClienteController).AnadirCapitulo(TIPO_CAPITULO_V, 'AUMENTO POR ', False, APresupuesto.Detalles);
end;
teArmario:
begin
APresupuesto.TIPO_PRESUPUESTO := CTE_ARMARIO;
APresupuesto.FORMA_PAGO.Add(AppFactuGES.Configuracion.GetSettingAsString(teBD, CTE_FORMA_PAGO_ARMARIO));
APresupuesto.PLAZO_ENTREGA.Add(AppFactuGES.Configuracion.GetSettingAsString(teBD, CTE_PLAZOS_ENTREGA_ARMARIO));
APresupuesto.OBSERVACIONES.Add(AppFactuGES.Configuracion.GetSettingAsString(teBD, CTE_OBSERVACIONES_ARMARIO));
(Self.DetallesController as IDetallesPresupuestoClienteController).AnadirCapitulo(TIPO_CAPITULO_AF, 'FRENTE DE ARMARIO Nº ', False, APresupuesto.Detalles);
(Self.DetallesController as IDetallesPresupuestoClienteController).AnadirCapitulo(TIPO_CAPITULO_AI, 'INTERIOR DE ARMARIO Nº ', False, APresupuesto.Detalles);
end;
teBano:
begin
APresupuesto.TIPO_PRESUPUESTO := CTE_BANO;
APresupuesto.FORMA_PAGO.Add(AppFactuGES.Configuracion.GetSettingAsString(teBD, CTE_FORMA_PAGO_BANO));
APresupuesto.PLAZO_ENTREGA.Add(AppFactuGES.Configuracion.GetSettingAsString(teBD, CTE_PLAZOS_ENTREGA_BANO));
APresupuesto.OBSERVACIONES.Add(AppFactuGES.Configuracion.GetSettingAsString(teBD, CTE_OBSERVACIONES_BANO));
(Self.DetallesController as IDetallesPresupuestoClienteController).AnadirCapitulo(TIPO_CAPITULO_B, 'MUEBLE DE BAÑO Nº ', False, APresupuesto.Detalles);
(Self.DetallesController as IDetallesPresupuestoClienteController).AnadirCapitulo(TIPO_CAPITULO_V, 'IMPORTES ', True, APresupuesto.Detalles);
end;
teElectrodomestico:
begin
APresupuesto.TIPO_PRESUPUESTO := CTE_ELECTRODOMESTICO;
APresupuesto.FORMA_PAGO.Add(AppFactuGES.Configuracion.GetSettingAsString(teBD, CTE_FORMA_PAGO_ELECTRODOMESTICO));
APresupuesto.PLAZO_ENTREGA.Add(AppFactuGES.Configuracion.GetSettingAsString(teBD, CTE_PLAZOS_ENTREGA_ELECTRODOMESTICO));
APresupuesto.OBSERVACIONES.Add(AppFactuGES.Configuracion.GetSettingAsString(teBD, CTE_OBSERVACIONES_ELECTRODOMESTICO));
(Self.DetallesController as IDetallesPresupuestoClienteController).AnadirCapitulo(TIPO_CAPITULO_E, 'ELECTRODOMÉSTICOS ', False, APresupuesto.Detalles);
end;
teVarios:
begin
APresupuesto.TIPO_PRESUPUESTO := CTE_VARIOS;
APresupuesto.FORMA_PAGO.Add(AppFactuGES.Configuracion.GetSettingAsString(teBD, CTE_FORMA_PAGO_VARIOS));
APresupuesto.PLAZO_ENTREGA.Add(AppFactuGES.Configuracion.GetSettingAsString(teBD, CTE_PLAZOS_ENTREGA_VARIOS));
APresupuesto.OBSERVACIONES.Add(AppFactuGES.Configuracion.GetSettingAsString(teBD, CTE_OBSERVACIONES_VARIOS));
(Self.DetallesController as IDetallesPresupuestoClienteController).AnadirCapitulo(TIPO_CAPITULO_V, 'VARIOS ', False, APresupuesto.Detalles);
end;
end;
end;
procedure TPresupuestosClienteController.FiltrarEmpresa(APresupuesto: IBizPresupuestoCliente);
var
Condicion: TDAWhereExpression;