From 19dd1b4e86a2245bc13d3d9604489b2f05bb6e14 Mon Sep 17 00:00:00 2001 From: david Date: Wed, 13 Oct 2010 15:14:18 +0000 Subject: [PATCH] =?UTF-8?q?Revisi=C3=B3n=20#535=20->=20Retoque=20al=20c?= =?UTF-8?q?=C3=B3digo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://192.168.0.254/svn/Proyectos.Acana_FactuGES2/trunk@540 f4e31baf-9722-1c47-927c-6f952f962d4b --- .../uPresupuestosClienteController.pas | 100 ++++++++++-------- 1 file changed, 56 insertions(+), 44 deletions(-) diff --git a/Source/Modulos/Presupuestos de cliente/Controller/uPresupuestosClienteController.pas b/Source/Modulos/Presupuestos de cliente/Controller/uPresupuestosClienteController.pas index 6b81c8ad..96c94b43 100644 --- a/Source/Modulos/Presupuestos de cliente/Controller/uPresupuestosClienteController.pas +++ b/Source/Modulos/Presupuestos de cliente/Controller/uPresupuestosClienteController.pas @@ -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;