unit uEditorFechaPago; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, cxControls, cxContainer, cxEdit, cxTextEdit, cxMaskEdit, cxDropDownEdit, cxCalendar, ExtCtrls, uEditorBasico, uIEditorFechaPago, cxCheckBox, uSubCuentasController, Buttons, cxDBEdit, cxGraphics, uCustomView, uViewBase, uViewListaSubCuentas, JvExStdCtrls, JvButton, JvCtrls, JvFooter, JvExExtCtrls, JvExtComponent; type TfEditorFechaPago = class(TfEditorBasico, IEditorFechaPago) Label1: TLabel; eFechaPago: TcxDateEdit; Label2: TLabel; frViewListaSubcuentas1: TfrViewListaSubcuentas; Label3: TLabel; PnlComentario: TPanel; lbComentario: TLabel; Panel1: TPanel; bAceptar: TButton; bCancelar: TButton; procedure FormShow(Sender: TObject); procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); procedure FormCreate(Sender: TObject); procedure eFechaPagoPropertiesEditValueChanged(Sender: TObject); private FFechaPago : TDateTime; FComentario: Variant; FSoloLectura: Boolean; function GetFechaPago: TDateTime; procedure SetFechaPago(const Value: TDateTime); function GetIgnorarContabilidad: Integer; procedure SetIgnorarContabilidad(const Value: Integer); function GetIdSubCuenta: Integer; procedure SetIdSubCuenta(const Value: Integer); function GetComentario: Variant; procedure SetComentario(const Value: Variant); function GetSoloLectura: Boolean; procedure SetSoloLectura(const Value: Boolean); public property FechaPago: TDateTime Read GetFechaPago write SetFechaPago; property IgnorarContabilidad: Integer Read GetIgnorarContabilidad write SetIgnorarContabilidad; property IdSubCuenta: Integer Read GetIdSubCuenta write SetIdSubCuenta; property Comentario: Variant read GetComentario write SetComentario; property SoloLectura: Boolean read GetSoloLectura write SetSoloLectura; procedure DeshabilitarContabilidad; end; implementation {$R *.dfm} {$INCLUDE ..\..\..\FactuGES.inc} uses uDialogUtils, uFactuGES_App, uBizEjercicios; procedure TfEditorFechaPago.DeshabilitarContabilidad; begin frViewListaSubCuentas1.eContabilizar.Enabled := False; end; procedure TfEditorFechaPago.eFechaPagoPropertiesEditValueChanged(Sender: TObject); begin FechaPago := eFechaPago.Date; end; procedure TfEditorFechaPago.FormCloseQuery(Sender: TObject; var CanClose: Boolean); begin CanClose := True; if Self.ModalResult = mrOk then begin if (length(eFechaPago.EditValue) = 0) then begin CanClose := False; ShowWarningMessage('Debe establecer la fecha del pago'); end; if (IgnorarContabilidad = 0) then begin if (AppFactuGES.EjercicioActivo.ESTADO = CTE_CERRADO) then begin CanClose := False; ShowWarningMessage('El pago no puede pasar a la parte contable de la aplicación porque el ejercicio activo está CERRADO'); end else if (IdSubCuenta < 1) then begin CanClose := False; ShowWarningMessage('Debe establecer la caja o banco donde se realiza el pago'); end end; end; end; procedure TfEditorFechaPago.FormCreate(Sender: TObject); begin {$IFDEF CONTABILIDAD} frViewListaSubCuentas1.TipoSubCuenta := tCajas; {$ENDIF} Comentario := Null; FSoloLectura := False; end; procedure TfEditorFechaPago.FormShow(Sender: TObject); begin if (length(eFechaPago.Text) = 0) then eFechaPago.Date := Date; {$IFDEF CONTABILIDAD} frViewListaSubCuentas1.Visible := true; if Assigned(AppFactuGES.EjercicioActivo) then begin frViewListaSubcuentas1.eContabilizar.Checked := False; end else begin frViewListaSubcuentas1.eContabilizar.Checked := True; end; {$ELSE} frViewListaSubCuentas1.Visible := false; {$ENDIF} end; function TfEditorFechaPago.GetComentario: Variant; begin Result := FComentario; end; function TfEditorFechaPago.GetFechaPago: TDateTime; begin Result := FFechaPago; end; function TfEditorFechaPago.GetIdSubCuenta: Integer; begin Result := frViewListaSubCuentas1.IdSubCuenta; end; function TfEditorFechaPago.GetIgnorarContabilidad: Integer; begin Result := frViewListaSubCuentas1.eContabilizar.EditValue; end; function TfEditorFechaPago.GetSoloLectura: Boolean; begin Result := FSoloLectura; end; procedure TfEditorFechaPago.SetComentario(const Value: Variant); begin FComentario := Value; lbComentario.Caption := ''; lbComentario.Caption := VarToStr(FComentario); if VarIsNull(FComentario) then PnlComentario.Visible := False else PnlComentario.Visible := True; end; procedure TfEditorFechaPago.SetFechaPago(const Value: TDateTime); begin FFechaPago := Value; eFechaPago.EditValue := FFechaPago; end; procedure TfEditorFechaPago.SetIdSubCuenta(const Value: Integer); begin frViewListaSubCuentas1.ElegirSubCuenta(Value); end; procedure TfEditorFechaPago.SetIgnorarContabilidad(const Value: Integer); begin frViewListaSubCuentas1.eContabilizar.EditValue := Value; frViewListaSubCuentas1.Refrescar; end; procedure TfEditorFechaPago.SetSoloLectura(const Value: Boolean); begin FSoloLectura := Value; if FSoloLectura then begin eFechaPago.Enabled := False; frViewListaSubcuentas1.ReadOnly := True; end else begin eFechaPago.Enabled := True; frViewListaSubcuentas1.ReadOnly := False; end; end; end.