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; type TfEditorFechaPago = class(TfEditorBasico, IEditorFechaPago) Label1: TLabel; eFechaPago: TcxDateEdit; bAceptar: TButton; bCancelar: TButton; Label2: TLabel; Panel1: TPanel; frViewListaSubcuentas1: TfrViewListaSubcuentas; procedure FormShow(Sender: TObject); procedure eFechaPagoPropertiesChange(Sender: TObject); procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); procedure FormCreate(Sender: TObject); private FFechaPago : TDateTime; function GetFechaPago: TDateTime; procedure SetFechaPago(const Value: TDateTime); function GetIgnorarContabilidad: Integer; procedure SetIgnorarContabilidad(const Value: Integer); function GetIdSubCuenta: Integer; procedure SetIdSubCuenta(const Value: Integer); public property FechaPago: TDateTime Read GetFechaPago write SetFechaPago; property IgnorarContabilidad: Integer Read GetIgnorarContabilidad write SetIgnorarContabilidad; property IdSubCuenta: Integer Read GetIdSubCuenta write SetIdSubCuenta; procedure DeshabilitarContabilidad; end; var fEditorFechaPago: TfEditorFechaPago; implementation {$R *.dfm} {$INCLUDE ..\..\..\FactuGES.inc} uses uDialogUtils; procedure TfEditorFechaPago.DeshabilitarContabilidad; begin frViewListaSubCuentas1.eContabilizar.Enabled := False; end; procedure TfEditorFechaPago.eFechaPagoPropertiesChange(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) and (IdSubCuenta < 1)) then begin CanClose := False; ShowWarningMessage('Debe establecer la caja o banco donde se realiza el pago'); end end; end; procedure TfEditorFechaPago.FormCreate(Sender: TObject); begin {$IFDEF CONTABILIDAD} frViewListaSubCuentas1.TipoSubCuenta := tCajas; {$ENDIF} end; procedure TfEditorFechaPago.FormShow(Sender: TObject); begin if (length(eFechaPago.Text) = 0) then eFechaPago.Date := Date; {$IFDEF CONTABILIDAD} frViewListaSubCuentas1.Visible := true; {$ELSE} frViewListaSubCuentas1.Visible := false; {$ENDIF} 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; 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; end.