unit uBizContactos; interface uses uDAInterfaces, uDADataTable, uROClasses, schContactosClient_Intf, uBizContactosDatosBancarios, uBizContactosPersonal, uDBSelectionListUtils, uBizDireccionesContacto, uBizClientesDescuentos; const BIZ_CLIENT_CONTACTO = 'Client.Contacto'; BIZ_CLIENT_CLIENTE = 'Client.Cliente'; BIZ_CLIENT_PROVEEDOR = 'Client.Proveedor'; BIZ_CLIENT_EMPLEADO = 'Client.Empleado'; CATEGORIA_CLIENTE = 1; CATEGORIA_PROVEEDOR = 2; CATEGORIA_EMPLEADO = 3; PROVEEDOR_REGIMEN_IVA = 'General'; CLIENTE_REGIMEN_IVA = 'General'; PROVEEDOR_DIAS_VENCIMIENTO = 20; CLIENTE_DIAS_VENCIMIENTO = 15; CLIENTE_RECARGO_EQUIVALENCIA = 0; type IBizContacto = interface (IContactos) ['{CD585680-26B6-47A4-B684-89C468670F4A}'] procedure SetDatosBancarios(AValue : IBizContactosDatosBancarios); function GetDatosBancarios : IBizContactosDatosBancarios; property DatosBancarios : IBizContactosDatosBancarios read GetDatosBancarios write SetDatosBancarios; procedure SetPersonal(AValue : IBizContactoPersonal); function GetPersonal : IBizContactoPersonal; property Personal : IBizContactoPersonal read GetPersonal write SetPersonal; function GetCategoria : String; property Categoria : String read GetCategoria; function GetDirecciones: IBizDireccionesContacto; procedure SetDirecciones(const Value: IBizDireccionesContacto); property Direcciones : IBizDireccionesContacto read GetDirecciones write SetDirecciones; function EsNuevo : Boolean; end; IBizCliente = interface (IBizContacto) ['{EA48A6AA-AC96-4AD9-B383-F2FD4552EE76}'] function GetGRUPO_CLIENTEValue: String; procedure SetGRUPO_CLIENTEValue(const aValue: String); function GetNOMBRE_COMERCIALValue: String; procedure SetNOMBRE_COMERCIALValue(const aValue: String); function GetVENCIMIENTO_FACTURAS_1Value: Smallint; procedure SetVENCIMIENTO_FACTURAS_1Value(const aValue: Smallint); function GetVENCIMIENTO_FACTURAS_2Value: Smallint; procedure SetVENCIMIENTO_FACTURAS_2Value(const aValue: Smallint); function GetVENCIMIENTO_FACTURAS_3Value: Smallint; procedure SetVENCIMIENTO_FACTURAS_3Value(const aValue: Smallint); function GetBLOQUEADOValue: Integer; procedure SetBLOQUEADOValue(const aValue: Integer); function GetMOTIVO_BLOQUEOValue: String; procedure SetMOTIVO_BLOQUEOValue(const aValue: String); function GetRECARGO_EQUIVALENCIAValue: Integer; procedure SetRECARGO_EQUIVALENCIAValue(const aValue: Integer); function GetREGIMEN_IVAValue: String; procedure SetREGIMEN_IVAValue(const aValue: String); function GetID_TIPO_IVAValue: Integer; procedure SetID_TIPO_IVAValue(const aValue: Integer); function GetID_FORMA_PAGOValue: Integer; procedure SetID_FORMA_PAGOValue(const aValue: Integer); function GetTIENDA_WEBValue: Integer; procedure SetTIENDA_WEBValue(const aValue: Integer); function GetDESCUENTOValue: Double; procedure SetDESCUENTOValue(const aValue: Double); function GetDescuentos: IBizClienteDescuentos; procedure SetDescuentos(Value: IBizClienteDescuentos); property Descuentos: IBizClienteDescuentos read GetDescuentos write SetDescuentos; function GetFELICITACIONValue: Integer; procedure SetFELICITACIONValue(const aValue: Integer); property GRUPO_CLIENTE: String read GetGRUPO_CLIENTEValue write SetGRUPO_CLIENTEValue; property NOMBRE_COMERCIAL: String read GetNOMBRE_COMERCIALValue write SetNOMBRE_COMERCIALValue; property VENCIMIENTO_FACTURAS_1: Smallint read GetVENCIMIENTO_FACTURAS_1Value write SetVENCIMIENTO_FACTURAS_1Value; property VENCIMIENTO_FACTURAS_2: Smallint read GetVENCIMIENTO_FACTURAS_2Value write SetVENCIMIENTO_FACTURAS_2Value; property VENCIMIENTO_FACTURAS_3: Smallint read GetVENCIMIENTO_FACTURAS_3Value write SetVENCIMIENTO_FACTURAS_3Value; property BLOQUEADO: Integer read GetBLOQUEADOValue write SetBLOQUEADOValue; property MOTIVO_BLOQUEO: String read GetMOTIVO_BLOQUEOValue write SetMOTIVO_BLOQUEOValue; property RECARGO_EQUIVALENCIA: Integer read GetRECARGO_EQUIVALENCIAValue write SetRECARGO_EQUIVALENCIAValue; property REGIMEN_IVA: String read GetREGIMEN_IVAValue write SetREGIMEN_IVAValue; property ID_TIPO_IVA: Integer read GetID_TIPO_IVAValue write SetID_TIPO_IVAValue; property ID_FORMA_PAGO: Integer read GetID_FORMA_PAGOValue write SetID_FORMA_PAGOValue; property TIENDA_WEB: Integer read GetTIENDA_WEBValue write SetTIENDA_WEBValue; property DESCUENTO: Double read GetDESCUENTOValue write SetDESCUENTOValue; property FELICITACION: Integer read GetFELICITACIONValue write SetFELICITACIONValue; end; IBizProveedor = interface (IBizContacto) ['{0CC1FBB8-C2F1-4E10-87B9-D4EEB1221299}'] function GetREGIMEN_IVAValue: String; procedure SetREGIMEN_IVAValue(const aValue: String); function GetDESCUENTOValue: Float; procedure SetDESCUENTOValue(const aValue: Float); function GetDESCRIPCION_PROVEEDORValue: String; procedure SetDESCRIPCION_PROVEEDORValue(const aValue: String); function GetCODIGO_ASIGNADOValue: String; procedure SetCODIGO_ASIGNADOValue(const aValue: String); function GetID_TIPO_IVAValue: Integer; procedure SetID_TIPO_IVAValue(const aValue: Integer); function GetID_FORMA_PAGOValue: Integer; procedure SetID_FORMA_PAGOValue(const aValue: Integer); function GetTIENDA_WEBValue: Integer; procedure SetTIENDA_WEBValue(const aValue: Integer); function GetHOMOLOGADOValue: Integer; procedure SetHOMOLOGADOValue(const aValue: Integer); function GetCERTIFICACIONValue: String; procedure SetCERTIFICACIONValue(const aValue: String); function GetGRUPO_PROVEEDORValue: String; procedure SetGRUPO_PROVEEDORValue(const aValue: String); function GetSUBCONTRATAValue: SmallInt; procedure SetSUBCONTRATAValue(const aValue: SmallInt); function GetVENCIMIENTO_FACTURAS_1Value: Smallint; function GetVENCIMIENTO_FACTURAS_2Value: Smallint; function GetVENCIMIENTO_FACTURAS_3Value: Smallint; procedure SetVENCIMIENTO_FACTURAS_1Value(const Value: Smallint); procedure SetVENCIMIENTO_FACTURAS_2Value(const Value: Smallint); procedure SetVENCIMIENTO_FACTURAS_3Value(const Value: Smallint); function GetFELICITACIONValue: Integer; procedure SetFELICITACIONValue(const aValue: Integer); function GetFECHA_INGRESOValue: TDateTime; procedure SetFECHA_INGRESOValue(const aValue: TDateTime); property REGIMEN_IVA: String read GetREGIMEN_IVAValue write SetREGIMEN_IVAValue; property DESCUENTO: Float read GetDESCUENTOValue write SetDESCUENTOValue; property DESCRIPCION_PROVEEDOR: String read GetDESCRIPCION_PROVEEDORValue write SetDESCRIPCION_PROVEEDORValue; property CODIGO_ASIGNADO: String read GetCODIGO_ASIGNADOValue write SetCODIGO_ASIGNADOValue; property ID_TIPO_IVA: Integer read GetID_TIPO_IVAValue write SetID_TIPO_IVAValue; property ID_FORMA_PAGO: Integer read GetID_FORMA_PAGOValue write SetID_FORMA_PAGOValue; property TIENDA_WEB: Integer read GetTIENDA_WEBValue write SetTIENDA_WEBValue; property HOMOLOGADO: Integer read GetHOMOLOGADOValue write SetHOMOLOGADOValue; property CERTIFICACION: String read GetCERTIFICACIONValue write SetCERTIFICACIONValue; property GRUPO_PROVEEDOR: String read GetGRUPO_PROVEEDORValue write SetGRUPO_PROVEEDORValue; property SUBCONTRATA: SmallInt read GetSUBCONTRATAValue write SetSUBCONTRATAValue; property VENCIMIENTO_FACTURAS_1: Smallint read GetVENCIMIENTO_FACTURAS_1Value write SetVENCIMIENTO_FACTURAS_1Value; property VENCIMIENTO_FACTURAS_2: Smallint read GetVENCIMIENTO_FACTURAS_2Value write SetVENCIMIENTO_FACTURAS_2Value; property VENCIMIENTO_FACTURAS_3: Smallint read GetVENCIMIENTO_FACTURAS_3Value write SetVENCIMIENTO_FACTURAS_3Value; property FELICITACION: Integer read GetFELICITACIONValue write SetFELICITACIONValue; property FECHA_INGRESO: TDateTime read GetFECHA_INGRESOValue write SetFECHA_INGRESOValue; end; IBizEmpleado = interface (IBizContacto) ['{CA24021E-A227-47F9-815F-A8565DB0F748}'] function GetFECHA_NACIMIENTOValue: TDateTime; procedure SetFECHA_NACIMIENTOValue(const aValue: TDateTime); function GetCATEGORIAValue: String; procedure SetCATEGORIAValue(const aValue: String); function GetFECHA_ALTA_EMPRESAValue: TDateTime; procedure SetFECHA_ALTA_EMPRESAValue(const aValue: TDateTime); function GetFORMACION_BASEValue: IROStrings; procedure SetFORMACION_BASEValue(const aValue: IROStrings); function GetFORMACION_COMPLEValue: IROStrings; procedure SetFORMACION_COMPLEValue(const aValue: IROStrings); function GetFORMACION_RECIBIDAValue: IROStrings; procedure SetFORMACION_RECIBIDAValue(const aValue: IROStrings); function GetEXPERIENCIAValue: IROStrings; procedure SetEXPERIENCIAValue(const aValue: IROStrings); function GetFECHA_BAJAValue: TDateTime; procedure SetFECHA_BAJAValue(const aValue: TDateTime); function GetFECHA_BAJAIsNull: Boolean; procedure SetFECHA_BAJAIsNull(const aValue: Boolean); function GetCAUSA_BAJAValue: String; procedure SetCAUSA_BAJAValue(const aValue: String); property FECHA_NACIMIENTO: TDateTime read GetFECHA_NACIMIENTOValue write SetFECHA_NACIMIENTOValue; property CATEGORIA: String read GetCATEGORIAValue write SetCATEGORIAValue; property FECHA_ALTA_EMPRESA: TDateTime read GetFECHA_ALTA_EMPRESAValue write SetFECHA_ALTA_EMPRESAValue; property FORMACION_BASE: IROStrings read GetFORMACION_BASEValue write SetFORMACION_BASEValue; property FORMACION_COMPLE: IROStrings read GetFORMACION_COMPLEValue write SetFORMACION_COMPLEValue; property FORMACION_RECIBIDA: IROStrings read GetFORMACION_RECIBIDAValue write SetFORMACION_RECIBIDAValue; property EXPERIENCIA: IROStrings read GetEXPERIENCIAValue write SetEXPERIENCIAValue; property FECHA_BAJA: TDateTime read GetFECHA_BAJAValue write SetFECHA_BAJAValue; property FECHA_BAJAIsNull: Boolean read GetFECHA_BAJAIsNull write SetFECHA_BAJAIsNull; property CAUSA_BAJA: String read GetCAUSA_BAJAValue write SetCAUSA_BAJAValue; end; TBizContacto = class(TContactosDataTableRules, IBizContacto, ISeleccionable) protected FDatosBancarios : IBizContactosDatosBancarios; FDatosBancariosLink : TDADataSource; FDirecciones : IBizDireccionesContacto; FDireccionesLink : TDADataSource; FPersonal : IBizContactoPersonal; FPersonalLink : TDADataSource; FSeleccionableInterface : ISeleccionable; procedure SetDatosBancarios(AValue : IBizContactosDatosBancarios); function GetDatosBancarios : IBizContactosDatosBancarios; function GetDirecciones: IBizDireccionesContacto; procedure SetDirecciones(const Value: IBizDireccionesContacto); function GetCategoria : String; procedure SetPersonal(AValue : IBizContactoPersonal); function GetPersonal : IBizContactoPersonal; procedure OnNewRecord(Sender: TDADataTable); override; public function EsNuevo : Boolean; procedure IniciarValoresContactoNuevo; virtual; constructor Create(aDataTable: TDADataTable); override; destructor Destroy; override; property Categoria : String read GetCategoria; property Personal : IBizContactoPersonal read GetPersonal write SetPersonal; property DatosBancarios : IBizContactosDatosBancarios read GetDatosBancarios write SetDatosBancarios; property Direcciones : IBizDireccionesContacto read GetDirecciones write SetDirecciones; property SeleccionableInterface : ISeleccionable read FSeleccionableInterface write FSeleccionableInterface implements ISeleccionable; end; TBizCliente = class(TBizContacto, IBizCliente) protected FDescuentos : IBizClienteDescuentos; FDescuentosLink : TDADataSource; function GetGRUPO_CLIENTEValue: String; procedure SetGRUPO_CLIENTEValue(const aValue: String); function GetNOMBRE_COMERCIALValue: String; procedure SetNOMBRE_COMERCIALValue(const aValue: String); function GetVENCIMIENTO_FACTURAS_1Value: Smallint; procedure SetVENCIMIENTO_FACTURAS_1Value(const aValue: Smallint); function GetVENCIMIENTO_FACTURAS_2Value: Smallint; procedure SetVENCIMIENTO_FACTURAS_2Value(const aValue: Smallint); function GetVENCIMIENTO_FACTURAS_3Value: Smallint; procedure SetVENCIMIENTO_FACTURAS_3Value(const aValue: Smallint); function GetBLOQUEADOValue: Integer; procedure SetBLOQUEADOValue(const aValue: Integer); function GetMOTIVO_BLOQUEOValue: String; procedure SetMOTIVO_BLOQUEOValue(const aValue: String); function GetRECARGO_EQUIVALENCIAValue: Integer; procedure SetRECARGO_EQUIVALENCIAValue(const aValue: Integer); function GetREGIMEN_IVAValue: String; procedure SetREGIMEN_IVAValue(const aValue: String); function GetID_TIPO_IVAValue: Integer; procedure SetID_TIPO_IVAValue(const aValue: Integer); function GetID_FORMA_PAGOValue: Integer; procedure SetID_FORMA_PAGOValue(const aValue: Integer); function GetTIENDA_WEBValue: Integer; procedure SetTIENDA_WEBValue(const aValue: Integer); function GetDESCUENTOValue: Double; procedure SetDESCUENTOValue(const aValue: Double); function GetDescuentos: IBizClienteDescuentos; procedure SetDescuentos(Value: IBizClienteDescuentos); function GetFELICITACIONValue: Integer; procedure SetFELICITACIONValue(const aValue: Integer); public procedure IniciarValoresContactoNuevo; override; constructor Create(aDataTable: TDADataTable); override; destructor Destroy; override; property Descuentos: IBizClienteDescuentos read GetDescuentos write SetDescuentos; property GRUPO_CLIENTE: String read GetGRUPO_CLIENTEValue write SetGRUPO_CLIENTEValue; property NOMBRE_COMERCIAL: String read GetNOMBRE_COMERCIALValue write SetNOMBRE_COMERCIALValue; property VENCIMIENTO_FACTURAS_1: Smallint read GetVENCIMIENTO_FACTURAS_1Value write SetVENCIMIENTO_FACTURAS_1Value; property VENCIMIENTO_FACTURAS_2: Smallint read GetVENCIMIENTO_FACTURAS_2Value write SetVENCIMIENTO_FACTURAS_2Value; property VENCIMIENTO_FACTURAS_3: Smallint read GetVENCIMIENTO_FACTURAS_3Value write SetVENCIMIENTO_FACTURAS_3Value; property BLOQUEADO: Integer read GetBLOQUEADOValue write SetBLOQUEADOValue; property MOTIVO_BLOQUEO: String read GetMOTIVO_BLOQUEOValue write SetMOTIVO_BLOQUEOValue; property RECARGO_EQUIVALENCIA: Integer read GetRECARGO_EQUIVALENCIAValue write SetRECARGO_EQUIVALENCIAValue; property REGIMEN_IVA: String read GetREGIMEN_IVAValue write SetREGIMEN_IVAValue; property ID_TIPO_IVA: Integer read GetID_TIPO_IVAValue write SetID_TIPO_IVAValue; property ID_FORMA_PAGO: Integer read GetID_FORMA_PAGOValue write SetID_FORMA_PAGOValue; property TIENDA_WEB: Integer read GetTIENDA_WEBValue write SetTIENDA_WEBValue; property DESCUENTO: Double read GetDESCUENTOValue write SetDESCUENTOValue; property FELICITACION: Integer read GetFELICITACIONValue write SetFELICITACIONValue; end; TBizProveedor = class(TBizContacto, IBizProveedor) protected function GetDESCUENTOValue: Float; procedure SetDESCUENTOValue(const aValue: Float); function GetDESCRIPCION_PROVEEDORValue: String; procedure SetDESCRIPCION_PROVEEDORValue(const aValue: String); function GetCODIGO_ASIGNADOValue: String; procedure SetCODIGO_ASIGNADOValue(const aValue: String); function GetREGIMEN_IVAValue: String; procedure SetREGIMEN_IVAValue(const aValue: String); function GetID_TIPO_IVAValue: Integer; procedure SetID_TIPO_IVAValue(const aValue: Integer); function GetTIENDA_WEBValue: Integer; procedure SetTIENDA_WEBValue(const aValue: Integer); function GetID_FORMA_PAGOValue: Integer; procedure SetID_FORMA_PAGOValue(const aValue: Integer); function GetHOMOLOGADOValue: Integer; procedure SetHOMOLOGADOValue(const aValue: Integer); function GetCERTIFICACIONValue: String; procedure SetCERTIFICACIONValue(const aValue: String); function GetGRUPO_PROVEEDORValue: String; procedure SetGRUPO_PROVEEDORValue(const aValue: String); function GetSUBCONTRATAValue: SmallInt; procedure SetSUBCONTRATAValue(const aValue: SmallInt); function GetVENCIMIENTO_FACTURAS_1Value: Smallint; function GetVENCIMIENTO_FACTURAS_2Value: Smallint; function GetVENCIMIENTO_FACTURAS_3Value: Smallint; procedure SetVENCIMIENTO_FACTURAS_1Value(const Value: Smallint); procedure SetVENCIMIENTO_FACTURAS_2Value(const Value: Smallint); procedure SetVENCIMIENTO_FACTURAS_3Value(const Value: Smallint); function GetFELICITACIONValue: Integer; procedure SetFELICITACIONValue(const aValue: Integer); function GetFECHA_INGRESOValue: TDateTime; procedure SetFECHA_INGRESOValue(const aValue: TDateTime); public procedure IniciarValoresContactoNuevo; override; property DESCUENTO: Float read GetDESCUENTOValue write SetDESCUENTOValue; property DESCRIPCION_PROVEEDOR: String read GetDESCRIPCION_PROVEEDORValue write SetDESCRIPCION_PROVEEDORValue; property CODIGO_ASIGNADO: String read GetCODIGO_ASIGNADOValue write SetCODIGO_ASIGNADOValue; property REGIMEN_IVA: String read GetREGIMEN_IVAValue write SetREGIMEN_IVAValue; property ID_TIPO_IVA: Integer read GetID_TIPO_IVAValue write SetID_TIPO_IVAValue; property ID_FORMA_PAGO: Integer read GetID_FORMA_PAGOValue write SetID_FORMA_PAGOValue; property TIENDA_WEB: Integer read GetTIENDA_WEBValue write SetTIENDA_WEBValue; property HOMOLOGADO: Integer read GetHOMOLOGADOValue write SetHOMOLOGADOValue; property CERTIFICACION: String read GetCERTIFICACIONValue write SetCERTIFICACIONValue; property GRUPO_PROVEEDOR: String read GetGRUPO_PROVEEDORValue write SetGRUPO_PROVEEDORValue; property SUBCONTRATA: SmallInt read GetSUBCONTRATAValue write SetSUBCONTRATAValue; property VENCIMIENTO_FACTURAS_1: Smallint read GetVENCIMIENTO_FACTURAS_1Value write SetVENCIMIENTO_FACTURAS_1Value; property VENCIMIENTO_FACTURAS_2: Smallint read GetVENCIMIENTO_FACTURAS_2Value write SetVENCIMIENTO_FACTURAS_2Value; property VENCIMIENTO_FACTURAS_3: Smallint read GetVENCIMIENTO_FACTURAS_3Value write SetVENCIMIENTO_FACTURAS_3Value; property FELICITACION: Integer read GetFELICITACIONValue write SetFELICITACIONValue; property FECHA_INGRESO: TDateTime read GetFECHA_INGRESOValue write SetFECHA_INGRESOValue; end; TBizEmpleado = class(TBizContacto, IBizEmpleado) protected function GetFECHA_NACIMIENTOValue: TDateTime; procedure SetFECHA_NACIMIENTOValue(const aValue: TDateTime); function GetCATEGORIAValue: String; procedure SetCATEGORIAValue(const aValue: String); function GetFECHA_ALTA_EMPRESAValue: TDateTime; procedure SetFECHA_ALTA_EMPRESAValue(const aValue: TDateTime); function GetFORMACION_BASEValue: IROStrings; procedure SetFORMACION_BASEValue(const aValue: IROStrings); function GetFORMACION_COMPLEValue: IROStrings; procedure SetFORMACION_COMPLEValue(const aValue: IROStrings); function GetFORMACION_RECIBIDAValue: IROStrings; procedure SetFORMACION_RECIBIDAValue(const aValue: IROStrings); function GetEXPERIENCIAValue: IROStrings; procedure SetEXPERIENCIAValue(const aValue: IROStrings); function GetFECHA_BAJAValue: TDateTime; procedure SetFECHA_BAJAValue(const aValue: TDateTime); function GetFECHA_BAJAIsNull: Boolean; procedure SetFECHA_BAJAIsNull(const aValue: Boolean); function GetCAUSA_BAJAValue: String; procedure SetCAUSA_BAJAValue(const aValue: String); public property FECHA_NACIMIENTO: TDateTime read GetFECHA_NACIMIENTOValue write SetFECHA_NACIMIENTOValue; property CATEGORIA: String read GetCATEGORIAValue write SetCATEGORIAValue; property FECHA_ALTA_EMPRESA: TDateTime read GetFECHA_ALTA_EMPRESAValue write SetFECHA_ALTA_EMPRESAValue; property FORMACION_BASE: IROStrings read GetFORMACION_BASEValue write SetFORMACION_BASEValue; property FORMACION_COMPLE: IROStrings read GetFORMACION_COMPLEValue write SetFORMACION_COMPLEValue; property FORMACION_RECIBIDA: IROStrings read GetFORMACION_RECIBIDAValue write SetFORMACION_RECIBIDAValue; property EXPERIENCIA: IROStrings read GetEXPERIENCIAValue write SetEXPERIENCIAValue; property FECHA_BAJA: TDateTime read GetFECHA_BAJAValue write SetFECHA_BAJAValue; property FECHA_BAJAIsNull: Boolean read GetFECHA_BAJAIsNull write SetFECHA_BAJAIsNull; property CAUSA_BAJA: String read GetCAUSA_BAJAValue write SetCAUSA_BAJAValue; procedure IniciarValoresContactoNuevo; override; end; implementation uses uDataTableUtils, Classes, DateUtils, SysUtils, uFactuGES_App, Variants; { TBizContacto } constructor TBizContacto.Create(aDataTable: TDADataTable); begin inherited; FDatosBancariosLink := TDADataSource.Create(NIL); FDatosBancariosLink.DataTable := aDataTable; FDireccionesLink := TDADataSource.Create(NIL); FDireccionesLink.DataTable := aDataTable; FPersonalLink := TDADataSource.Create(NIL); FPersonalLink.DataTable := aDataTable; FSeleccionableInterface := TSeleccionable.Create(aDataTable); end; destructor TBizContacto.Destroy; begin FDatosBancarios := NIL; FDatosBancariosLink.Free; FDirecciones := NIL; FDireccionesLink.Free; FPersonal := NIL; FPersonalLink.Free; FSeleccionableInterface := NIL; inherited; end; function TBizContacto.EsNuevo: Boolean; begin Result := (ID < 0); end; function TBizContacto.GetCategoria: String; begin case ID_CATEGORIA of 1 : Result := 'Cliente'; 2 : Result := 'Proveedor'; 3 : Result := 'Empleado'; end; end; function TBizContacto.GetDatosBancarios: IBizContactosDatosBancarios; begin Result := FDatosBancarios; end; function TBizContacto.GetDirecciones: IBizDireccionesContacto; begin Result := FDirecciones; end; function TBizContacto.GetPersonal: IBizContactoPersonal; begin Result := FPersonal; end; procedure TBizContacto.IniciarValoresContactoNuevo; begin USUARIO := AppFactuGES.UsuarioActivo.UserName; end; procedure TBizContacto.OnNewRecord(Sender: TDADataTable); begin inherited; IniciarValoresContactoNuevo; end; procedure TBizContacto.SetDatosBancarios(AValue: IBizContactosDatosBancarios); begin FDatosBancarios := AValue; EnlazarMaestroDetalle(FDatosBancariosLink, FDatosBancarios); end; procedure TBizContacto.SetDirecciones(const Value: IBizDireccionesContacto); begin FDirecciones := Value; EnlazarMaestroDetalle(FDireccionesLink, FDirecciones); end; procedure TBizContacto.SetPersonal(AValue: IBizContactoPersonal); begin FPersonal := AValue; EnlazarMaestroDetalle(FPersonalLink, FPersonal); end; { TBizCliente } constructor TBizCliente.Create(aDataTable: TDADataTable); begin inherited; FDescuentos := NIL; FDescuentosLink := TDADataSource.Create(NIL); FDescuentosLink.DataTable := aDataTable; end; destructor TBizCliente.Destroy; begin FDescuentos := NIL; FreeAndNIL(FDescuentosLink); inherited; end; function TBizCliente.GetBLOQUEADOValue: Integer; begin result := DataTable.Fields[idx_ClientesBLOQUEADO].AsInteger; end; function TBizCliente.GetDescuentos: IBizClienteDescuentos; begin Result := FDescuentos; end; function TBizCliente.GetDESCUENTOValue: Double; begin result := DataTable.Fields[idx_ClientesDESCUENTO].AsFloat; end; function TBizCliente.GetFELICITACIONValue: Integer; begin result := DataTable.Fields[idx_ClientesFELICITACION].AsInteger; end; function TBizCliente.GetGRUPO_CLIENTEValue: String; begin result := DataTable.Fields[idx_ClientesGRUPO_CLIENTE].AsString; end; function TBizCliente.GetID_FORMA_PAGOValue: Integer; begin result := DataTable.Fields[idx_ClientesID_FORMA_PAGO].AsInteger; end; function TBizCliente.GetID_TIPO_IVAValue: Integer; begin result := DataTable.Fields[idx_ClientesID_TIPO_IVA].AsInteger; end; function TBizCliente.GetMOTIVO_BLOQUEOValue: String; begin result := DataTable.Fields[idx_ClientesMOTIVO_BLOQUEO].AsString; end; function TBizCliente.GetNOMBRE_COMERCIALValue: String; begin result := DataTable.Fields[idx_ClientesNOMBRE_COMERCIAL].AsString; end; procedure TBizCliente.SetBLOQUEADOValue(const aValue: Integer); begin DataTable.Fields[idx_ClientesBLOQUEADO].AsInteger := aValue; end; procedure TBizCliente.SetDescuentos(Value: IBizClienteDescuentos); begin FDescuentos := Value; EnlazarMaestroDetalle(FDescuentosLink, FDescuentos); end; procedure TBizCliente.SetDESCUENTOValue(const aValue: Double); begin DataTable.Fields[idx_ClientesDESCUENTO].AsFloat := aValue; end; procedure TBizCliente.SetFELICITACIONValue(const aValue: Integer); begin DataTable.Fields[idx_ClientesFELICITACION].AsInteger := aValue; end; procedure TBizCliente.SetGRUPO_CLIENTEValue(const aValue: String); begin DataTable.Fields[idx_ClientesGRUPO_CLIENTE].AsString := aValue; end; procedure TBizCliente.SetID_FORMA_PAGOValue(const aValue: Integer); begin DataTable.Fields[idx_ClientesID_FORMA_PAGO].AsInteger := aValue; end; procedure TBizCliente.SetID_TIPO_IVAValue(const aValue: Integer); begin DataTable.Fields[idx_ClientesID_TIPO_IVA].AsInteger := aValue; end; procedure TBizCliente.SetMOTIVO_BLOQUEOValue(const aValue: String); begin DataTable.Fields[idx_ClientesMOTIVO_BLOQUEO].AsString := aValue; end; procedure TBizCliente.SetNOMBRE_COMERCIALValue(const aValue: String); begin DataTable.Fields[idx_ClientesNOMBRE_COMERCIAL].AsString := aValue; end; function TBizCliente.GetRECARGO_EQUIVALENCIAValue: Integer; begin Result := DataTable.Fields[idx_ClientesRECARGO_EQUIVALENCIA].AsInteger; end; function TBizCliente.GetREGIMEN_IVAValue: String; begin Result := DataTable.Fields[idx_ClientesREGIMEN_IVA].AsString; end; function TBizCliente.GetTIENDA_WEBValue: Integer; begin result := DataTable.Fields[idx_ClientesTIENDA_WEB].AsInteger; end; function TBizCliente.GetVENCIMIENTO_FACTURAS_1Value: SmallInt; begin result := DataTable.Fields[idx_ClientesVENCIMIENTO_FACTURAS_1].AsSmallInt; end; function TBizCliente.GetVENCIMIENTO_FACTURAS_2Value: SmallInt; begin result := DataTable.Fields[idx_ClientesVENCIMIENTO_FACTURAS_2].AsSmallInt; end; function TBizCliente.GetVENCIMIENTO_FACTURAS_3Value: SmallInt; begin result := DataTable.Fields[idx_ClientesVENCIMIENTO_FACTURAS_3].AsSmallInt; end; procedure TBizCliente.SetRECARGO_EQUIVALENCIAValue(const aValue: Integer); begin DataTable.Fields[idx_ClientesRECARGO_EQUIVALENCIA].AsInteger := aValue; end; procedure TBizCliente.SetREGIMEN_IVAValue(const aValue: String); begin DataTable.Fields[idx_ClientesREGIMEN_IVA].AsString := aValue; end; procedure TBizCliente.SetTIENDA_WEBValue(const aValue: Integer); begin DataTable.Fields[idx_ClientesTIENDA_WEB].AsInteger := aValue; end; procedure TBizCliente.SetVENCIMIENTO_FACTURAS_1Value(const aValue: SmallInt); begin DataTable.Fields[idx_ClientesVENCIMIENTO_FACTURAS_1].AsSmallInt := aValue; end; procedure TBizCliente.SetVENCIMIENTO_FACTURAS_2Value(const aValue: SmallInt); begin DataTable.Fields[idx_ClientesVENCIMIENTO_FACTURAS_2].AsSmallInt := aValue; end; procedure TBizCliente.SetVENCIMIENTO_FACTURAS_3Value(const aValue: SmallInt); begin DataTable.Fields[idx_ClientesVENCIMIENTO_FACTURAS_3].AsSmallInt := aValue; end; procedure TBizCliente.IniciarValoresContactoNuevo; begin inherited; ID_CATEGORIA := CATEGORIA_CLIENTE; VENCIMIENTO_FACTURAS_1 := CLIENTE_DIAS_VENCIMIENTO; BLOQUEADO := 0; FELICITACION := 0; RECARGO_EQUIVALENCIA := CLIENTE_RECARGO_EQUIVALENCIA; REGIMEN_IVA := CLIENTE_REGIMEN_IVA; ID_FORMA_PAGO := AppFactuGES.EmpresaActiva.ID_FORMA_PAGO; ID_TIPO_IVA := AppFactuGES.EmpresaActiva.ID_TIPO_IVA; end; { TBizProveedor } function TBizProveedor.GetGRUPO_PROVEEDORValue: String; begin result := DataTable.Fields[idx_ProveedoresGRUPO_PROVEEDOR].AsString; end; function TBizProveedor.GetHOMOLOGADOValue: Integer; begin result := DataTable.Fields[idx_ProveedoresHOMOLOGADO].AsInteger; end; function TBizProveedor.GetID_FORMA_PAGOValue: Integer; begin result := DataTable.Fields[idx_ProveedoresID_FORMA_PAGO].AsInteger; end; function TBizProveedor.GetID_TIPO_IVAValue: Integer; begin result := DataTable.Fields[idx_ProveedoresID_TIPO_IVA].AsInteger; end; function TBizProveedor.GetREGIMEN_IVAValue: String; begin result := DataTable.Fields[idx_ProveedoresREGIMEN_IVA].AsString; end; function TBizProveedor.GetSUBCONTRATAValue: SmallInt; begin result := DataTable.Fields[idx_ProveedoresSUBCONTRATA].AsSmallInt; end; function TBizProveedor.GetTIENDA_WEBValue: Integer; begin result := DataTable.Fields[idx_ProveedoresTIENDA_WEB].AsInteger; end; function TBizProveedor.GetVENCIMIENTO_FACTURAS_1Value: Smallint; begin result := DataTable.Fields[idx_ProveedoresVENCIMIENTO_FACTURAS_1].AsSmallInt; end; function TBizProveedor.GetVENCIMIENTO_FACTURAS_2Value: Smallint; begin result := DataTable.Fields[idx_ProveedoresVENCIMIENTO_FACTURAS_2].AsSmallInt; end; function TBizProveedor.GetVENCIMIENTO_FACTURAS_3Value: Smallint; begin result := DataTable.Fields[idx_ProveedoresVENCIMIENTO_FACTURAS_3].AsSmallInt; end; procedure TBizProveedor.IniciarValoresContactoNuevo; begin inherited; ID_CATEGORIA := CATEGORIA_PROVEEDOR; REGIMEN_IVA := PROVEEDOR_REGIMEN_IVA; VENCIMIENTO_FACTURAS_1 := PROVEEDOR_DIAS_VENCIMIENTO; ID_FORMA_PAGO := AppFactuGES.EmpresaActiva.ID_FORMA_PAGO; ID_TIPO_IVA := AppFactuGES.EmpresaActiva.ID_TIPO_IVA; FELICITACION := 0; FECHA_INGRESO := DateOf(Now); end; function TBizProveedor.GetCERTIFICACIONValue: String; begin result := DataTable.Fields[idx_ProveedoresCERTIFICACION].AsString; end; function TBizProveedor.GetCODIGO_ASIGNADOValue: String; begin result := DataTable.Fields[idx_ProveedoresCODIGO_ASIGNADO].AsString; end; function TBizProveedor.GetDESCRIPCION_PROVEEDORValue: String; begin result := DataTable.Fields[idx_ProveedoresDESCRIPCION_PROVEEDOR].AsString; end; function TBizProveedor.GetDESCUENTOValue: Float; begin result := DataTable.Fields[idx_ProveedoresDESCUENTO].AsFloat; end; function TBizProveedor.GetFECHA_INGRESOValue: TDateTime; begin result := DataTable.Fields[idx_ProveedoresFECHA_INGRESO].AsDateTime; end; function TBizProveedor.GetFELICITACIONValue: Integer; begin result := DataTable.Fields[idx_ProveedoresFELICITACION].AsInteger; end; procedure TBizProveedor.SetCERTIFICACIONValue(const aValue: String); begin DataTable.Fields[idx_ProveedoresCERTIFICACION].AsString := aValue; end; procedure TBizProveedor.SetCODIGO_ASIGNADOValue(const aValue: String); begin DataTable.Fields[idx_ProveedoresCODIGO_ASIGNADO].AsString := aValue; end; procedure TBizProveedor.SetDESCRIPCION_PROVEEDORValue(const aValue: String); begin DataTable.Fields[idx_ProveedoresDESCRIPCION_PROVEEDOR].AsString := aValue; end; procedure TBizProveedor.SetDESCUENTOValue(const aValue: Float); begin DataTable.Fields[idx_ProveedoresDESCUENTO].AsFloat := aValue; end; procedure TBizProveedor.SetFECHA_INGRESOValue(const aValue: TDateTime); begin DataTable.Fields[idx_ProveedoresFECHA_INGRESO].AsDateTime := aValue; end; procedure TBizProveedor.SetFELICITACIONValue(const aValue: Integer); begin DataTable.Fields[idx_ProveedoresFELICITACION].AsInteger := aValue; end; procedure TBizProveedor.SetGRUPO_PROVEEDORValue(const aValue: String); begin DataTable.Fields[idx_ProveedoresGRUPO_PROVEEDOR].AsString := aValue; end; procedure TBizProveedor.SetHOMOLOGADOValue(const aValue: Integer); begin DataTable.Fields[idx_ProveedoresHOMOLOGADO].AsInteger := aValue; end; procedure TBizProveedor.SetID_FORMA_PAGOValue(const aValue: Integer); begin DataTable.Fields[idx_ProveedoresID_FORMA_PAGO].AsInteger := aValue; end; procedure TBizProveedor.SetID_TIPO_IVAValue(const aValue: Integer); begin DataTable.Fields[idx_ProveedoresID_TIPO_IVA].AsInteger := aValue; end; procedure TBizProveedor.SetREGIMEN_IVAValue(const aValue: String); begin DataTable.Fields[idx_ProveedoresREGIMEN_IVA].AsString := aValue; end; procedure TBizProveedor.SetSUBCONTRATAValue(const aValue: SmallInt); begin DataTable.Fields[idx_ProveedoresSUBCONTRATA].AsSmallInt := aValue; end; procedure TBizProveedor.SetTIENDA_WEBValue(const aValue: Integer); begin DataTable.Fields[idx_ProveedoresTIENDA_WEB].AsInteger := aValue; end; procedure TBizProveedor.SetVENCIMIENTO_FACTURAS_1Value(const Value: Smallint); begin DataTable.Fields[idx_ProveedoresVENCIMIENTO_FACTURAS_1].AsSmallInt := Value; end; procedure TBizProveedor.SetVENCIMIENTO_FACTURAS_2Value(const Value: Smallint); begin DataTable.Fields[idx_ProveedoresVENCIMIENTO_FACTURAS_2].AsSmallInt := Value; end; procedure TBizProveedor.SetVENCIMIENTO_FACTURAS_3Value(const Value: Smallint); begin DataTable.Fields[idx_ProveedoresVENCIMIENTO_FACTURAS_3].AsSmallInt := Value; end; { TBizEmpleado } function TBizEmpleado.GetCATEGORIAValue: String; begin result := DataTable.Fields[idx_EmpleadosCATEGORIA].AsString; end; function TBizEmpleado.GetCAUSA_BAJAValue: String; begin result := DataTable.Fields[idx_EmpleadosCAUSA_BAJA].AsString; end; function TBizEmpleado.GetEXPERIENCIAValue: IROStrings; begin result := NewROStrings(); result.Text := DataTable.Fields[idx_EmpleadosEXPERIENCIA].AsString; end; function TBizEmpleado.GetFECHA_ALTA_EMPRESAValue: TDateTime; begin result := DataTable.Fields[idx_EmpleadosFECHA_ALTA_EMPRESA].AsDateTime; end; function TBizEmpleado.GetFECHA_BAJAIsNull: Boolean; begin result := DataTable.Fields[idx_EmpleadosFECHA_BAJA].IsNull; end; function TBizEmpleado.GetFECHA_BAJAValue: TDateTime; begin result := DataTable.Fields[idx_EmpleadosFECHA_BAJA].AsDateTime; end; function TBizEmpleado.GetFECHA_NACIMIENTOValue: TDateTime; begin result := DataTable.Fields[idx_EmpleadosFECHA_NACIMIENTO].AsDateTime; end; function TBizEmpleado.GetFORMACION_BASEValue: IROStrings; begin result := NewROStrings(); result.Text := DataTable.Fields[idx_EmpleadosFORMACION_BASE].AsString; end; function TBizEmpleado.GetFORMACION_COMPLEValue: IROStrings; begin result := NewROStrings(); result.Text := DataTable.Fields[idx_EmpleadosFORMACION_COMPLE].AsString; end; function TBizEmpleado.GetFORMACION_RECIBIDAValue: IROStrings; begin result := NewROStrings(); result.Text := DataTable.Fields[idx_EmpleadosFORMACION_RECIBIDA].AsString; end; procedure TBizEmpleado.IniciarValoresContactoNuevo; begin inherited; ID_CATEGORIA := CATEGORIA_EMPLEADO; end; procedure TBizEmpleado.SetCATEGORIAValue(const aValue: String); begin DataTable.Fields[idx_EmpleadosCATEGORIA].AsString := aValue; end; procedure TBizEmpleado.SetCAUSA_BAJAValue(const aValue: String); begin DataTable.Fields[idx_EmpleadosCAUSA_BAJA].AsString := aValue; end; procedure TBizEmpleado.SetEXPERIENCIAValue(const aValue: IROStrings); begin DataTable.Fields[idx_EmpleadosEXPERIENCIA].AsString := aValue.Text; end; procedure TBizEmpleado.SetFECHA_ALTA_EMPRESAValue(const aValue: TDateTime); begin DataTable.Fields[idx_EmpleadosFECHA_ALTA_EMPRESA].AsDateTime := aValue; end; procedure TBizEmpleado.SetFECHA_BAJAIsNull(const aValue: Boolean); begin if aValue then DataTable.Fields[idx_EmpleadosFECHA_BAJA].AsVariant := Null; end; procedure TBizEmpleado.SetFECHA_BAJAValue(const aValue: TDateTime); begin DataTable.Fields[idx_EmpleadosFECHA_BAJA].AsDateTime := aValue; end; procedure TBizEmpleado.SetFECHA_NACIMIENTOValue(const aValue: TDateTime); begin DataTable.Fields[idx_EmpleadosFECHA_NACIMIENTO].AsDateTime := aValue; end; procedure TBizEmpleado.SetFORMACION_BASEValue(const aValue: IROStrings); begin DataTable.Fields[idx_EmpleadosFORMACION_BASE].AsString := aValue.Text; end; procedure TBizEmpleado.SetFORMACION_COMPLEValue(const aValue: IROStrings); begin DataTable.Fields[idx_EmpleadosFORMACION_COMPLE].AsString := aValue.Text; end; procedure TBizEmpleado.SetFORMACION_RECIBIDAValue(const aValue: IROStrings); begin DataTable.Fields[idx_EmpleadosFORMACION_RECIBIDA].AsString := aValue.Text; end; initialization RegisterDataTableRules(BIZ_CLIENT_CONTACTO, TBizContacto); RegisterDataTableRules(BIZ_CLIENT_CLIENTE, TBizCliente); RegisterDataTableRules(BIZ_CLIENT_PROVEEDOR, TBizProveedor); RegisterDataTableRules(BIZ_CLIENT_EMPLEADO, TBizEmpleado); finalization end.