unit uViewRemesaCliente;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, uViewBase, ExtCtrls, StdCtrls, Buttons, DB, uDADataTable,
  DBCtrls, Grids, DBGrids, Mask, ComCtrls, uCustomView, JvComponent,
  JvFormAutoSize, cxControls, cxContainer, cxEdit, cxTextEdit,
  cxDBEdit, dxLayoutControl, cxCheckBox, PngSpeedButton, cxImage, ActnList,
  ImgList, PngImageList, cxGraphics, cxMaskEdit, cxDropDownEdit,
  uFamiliasController, cxSpinEdit, cxCurrencyEdit,
  uBizRemesasCliente, uRemesasClienteController, cxCalendar,
  dxLayoutLookAndFeels, cxLookupEdit, cxDBLookupEdit, cxDBLookupComboBox,
  cxImageComboBox, uDAInterfaces;

type
  IViewRemesaCliente = interface(IViewBase)
  ['{7F5C4A4F-DD34-4E6E-A053-7528E62D1D64}']
    function GetRemesaCliente: IBizRemesaCliente;
    procedure SetRemesaCliente(const Value: IBizRemesaCliente);
    property RemesaCliente: IBizRemesaCliente read GetRemesaCliente write SetRemesaCliente;

    function GetController : IRemesasClienteController;
    procedure SetController (const Value : IRemesasClienteController);
    property Controller : IRemesasClienteController read GetController write SetController;
  end;

  TfrViewRemesaCliente = class(TfrViewBase, IViewRemesaCliente)
    dsDataTable: TDADataSource;
    dxLayoutControlRemesaClienteGroup_Root: TdxLayoutGroup;
    dxLayoutControlRemesaCliente: TdxLayoutControl;
    dxLayoutControlRemesaClienteGroup1: TdxLayoutGroup;
    dxLayoutControlRemesaClienteItem3: TdxLayoutItem;
    eReferencia: TcxDBTextEdit;
    dxLayoutControlRemesaClienteItem8: TdxLayoutItem;
    eDescripcion: TcxDBTextEdit;
    dxLayoutControlRemesaClienteGroup3: TdxLayoutGroup;
    dxLayoutControlRemesaClienteItem4: TdxLayoutItem;
    edtFechaRemesa: TcxDBDateEdit;
    dxLayoutControlRemesaClienteGroup5: TdxLayoutGroup;
    dxLayoutLookAndFeelList1: TdxLayoutLookAndFeelList;
    dxLayoutOfficeLookAndFeel1: TdxLayoutOfficeLookAndFeel;
    dxLayoutControlRemesaClienteItem9: TdxLayoutItem;
    cbCuentaBancaria: TcxDBLookupComboBox;
    dsDatosBanco: TDADataSource;
    dxLayoutControlRemesaClienteGroup2: TdxLayoutGroup;
    cbTipo: TcxDBImageComboBox;
    dxLayoutControlRemesaClienteItem1: TdxLayoutItem;

  protected
    FController: IRemesasClienteController;
    FRemesaCliente: IBizRemesaCliente;
    function GetRemesaCliente: IBizRemesaCliente;
    procedure SetRemesaCliente(const Value: IBizRemesaCliente); virtual;
    function GetController : IRemesasClienteController;
    procedure SetController (const Value : IRemesasClienteController);
  public
    property RemesaCliente: IBizRemesaCliente read GetRemesaCliente write SetRemesaCliente;
    property Controller : IRemesasClienteController read GetController write SetController;
    constructor Create(AOwner: TComponent); override;
  end;

implementation

{$R *.dfm}

uses
  uDataModuleUsuarios, uFactuGES_App;


{ TfrViewRemesaClientes }

{
******************************* TfrViewRemesaClientes ********************************
}

function TfrViewRemesaCliente.GetRemesaCliente: IBizRemesaCliente;
begin
  Result := FRemesaCliente;
end;

constructor TfrViewRemesaCliente.Create(AOwner: TComponent);
var
  AItem : TcxImageComboBoxItem;
begin
  inherited;
  cbTipo.Properties.Items.BeginUpdate;

  AItem := cbTipo.Properties.Items.Add;
  AItem.Tag := 1;
  AItem.Description := CTE_TIPO_REMESA;
  AItem.Value := CTE_TIPO_REMESA;

  AItem := cbTipo.Properties.Items.Add;
  AItem.Tag := 2;
  AItem.Description := CTE_TIPO_TALON;
  AItem.Value := CTE_TIPO_TALON;

  AItem := cbTipo.Properties.Items.Add;
  AItem.Tag := 3;
  AItem.Description := CTE_TIPO_EFECTIVO;
  AItem.Value := CTE_TIPO_EFECTIVO;

  AItem := cbTipo.Properties.Items.Add;
  AItem.Tag := 4;
  AItem.Description := CTE_TIPO_TRANSFERENCIA;
  AItem.Value := CTE_TIPO_TRANSFERENCIA;

  cbTipo.Properties.Items.EndUpdate;  
end;

function TfrViewRemesaCliente.GetController: IRemesasClienteController;
begin
  Result := FController;
end;

procedure TfrViewRemesaCliente.SetRemesaCliente(const Value: IBizRemesaCliente);
begin
  FRemesaCliente := Value;

  if Assigned(FRemesaCliente) then
  begin
    dsDataTable.DataTable := FRemesaCliente.DataTable;
    dsDatosBanco.DataTable := AppFactuGES.EmpresaActiva.DatosBancarios.DataTable;
    dsDatosBanco.DataTable.Active := True;
  end
  else begin
    dsDataTable.DataTable := NIL;
    dsDatosBanco.DataTable := NIL;
  end;
end;

procedure TfrViewRemesaCliente.SetController(const Value: IRemesasClienteController);
begin
  FController := Value;
end;

end.

