FactuGES2/Source/Modulos/Recibos de cliente/Views/uEditorFechaPago.pas

144 lines
4.1 KiB
ObjectPascal
Raw Blame History

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;
type
TfEditorFechaPago = class(TfEditorBasico, IEditorFechaPago)
Label1: TLabel;
eFechaPago: TcxDateEdit;
bAceptar: TButton;
bCancelar: TButton;
Label2: TLabel;
Panel1: TPanel;
eContabilizar: TcxCheckBox;
eRefSubCuenta: TcxTextEdit;
eSubCuenta: TcxTextEdit;
BitBtn3: TBitBtn;
eIDSubcuenta: TcxTextEdit;
procedure FormShow(Sender: TObject);
procedure eFechaPagoPropertiesChange(Sender: TObject);
procedure eContabilizarPropertiesChange(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure BitBtn3Click(Sender: TObject);
procedure eIDSubcuentaPropertiesChange(Sender: TObject);
procedure bAceptarClick(Sender: TObject);
private
FController : ISubcuentasController;
FIdSubCuenta : Integer;
FIgnorarContabilidad : Integer;
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;
constructor Create(AOwner: TComponent); override;
end;
var
fEditorFechaPago: TfEditorFechaPago;
implementation
{$R *.dfm}
uses uBizSubCuentas;
procedure TfEditorFechaPago.bAceptarClick(Sender: TObject);
begin
if (not eContabilizar.Checked)
and (eIdSubcuenta.Text = '') then
raise Exception.Create ('Es necesario que elija la SubCuenta donde se realizar<61> el pago');
end;
procedure TfEditorFechaPago.BitBtn3Click(Sender: TObject);
var
ASubCuenta: IBizSubcuenta;
begin
ASubCuenta := FController.ElegirSubCuenta(FController.BuscarTodos,'sssss', False);
eIDSubcuenta.Text := IntToStr(ASubcuenta.ID);
eRefSubCuenta.Text := ASubcuenta.REF_SUBCUENTA;
eSubCuenta.Text := ASubcuenta.DESCRIPCION;
ASubCuenta := Nil;
end;
constructor TfEditorFechaPago.Create(AOwner: TComponent);
begin
inherited;
FController := TSubcuentasController.Create;
end;
procedure TfEditorFechaPago.eContabilizarPropertiesChange(Sender: TObject);
begin
FIgnorarContabilidad := eContabilizar.EditValue;
end;
procedure TfEditorFechaPago.eFechaPagoPropertiesChange(Sender: TObject);
begin
FechaPago := eFechaPago.Date;
end;
procedure TfEditorFechaPago.eIDSubcuentaPropertiesChange(Sender: TObject);
begin
if not VarIsNull(eIDSubCuenta.EditValue) then
FIDSubCuenta := eIDSubCuenta.EditValue;
end;
procedure TfEditorFechaPago.FormClose(Sender: TObject; var Action: TCloseAction);
begin
FController := Nil;
end;
procedure TfEditorFechaPago.FormShow(Sender: TObject);
begin
if (length(eFechaPago.Text) = 0) then
eFechaPago.Date := Date;
// FController.
end;
function TfEditorFechaPago.GetFechaPago: TDateTime;
begin
Result := FFechaPago;
end;
function TfEditorFechaPago.GetIdSubCuenta: Integer;
begin
Result := eIDSubCuenta.EditValue; //FIdSubCuenta;
end;
function TfEditorFechaPago.GetIgnorarContabilidad: Integer;
begin
Result := FIgnorarContabilidad;
end;
procedure TfEditorFechaPago.SetFechaPago(const Value: TDateTime);
begin
FFechaPago := Value;
eFechaPago.EditValue := FFechaPago;
end;
procedure TfEditorFechaPago.SetIdSubCuenta(const Value: Integer);
begin
FIdSubCuenta := Value;
end;
procedure TfEditorFechaPago.SetIgnorarContabilidad(const Value: Integer);
begin
FIgnorarContabilidad := Value;
eContabilizar.EditValue := FIgnorarContabilidad;
end;
end.