unit uViewRemesaProveedor;

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,
  uBizRemesasProveedor, uRemesasProveedorController, cxCalendar,
  dxLayoutLookAndFeels, cxLookupEdit, cxDBLookupEdit, cxDBLookupComboBox,
  cxImageComboBox, uDAInterfaces;

type
  IViewRemesaProveedor = interface(IViewBase)
  ['{A091444D-DA32-4577-9EA0-DE87D9C0F943}']
    function GetRemesaProveedor: IBizRemesaProveedor;
    procedure SetRemesaProveedor(const Value: IBizRemesaProveedor);
    property RemesaProveedor: IBizRemesaProveedor read GetRemesaProveedor write SetRemesaProveedor;

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

  TfrViewRemesaProveedor = class(TfrViewBase, IViewRemesaProveedor)
    dsDataTable: TDADataSource;
    dxLayoutControlRemesaProveedorGroup_Root: TdxLayoutGroup;
    dxLayoutControlRemesaProveedor: TdxLayoutControl;
    dxLayoutControlRemesaProveedorGroup1: TdxLayoutGroup;
    dxLayoutControlRemesaProveedorItem3: TdxLayoutItem;
    eReferencia: TcxDBTextEdit;
    dxLayoutControlRemesaProveedorItem8: TdxLayoutItem;
    eDescripcion: TcxDBTextEdit;
    dxLayoutControlRemesaProveedorGroup3: TdxLayoutGroup;
    dxLayoutControlRemesaProveedorItem4: TdxLayoutItem;
    edtFechaRemesa: TcxDBDateEdit;
    dxLayoutControlRemesaProveedorGroup5: TdxLayoutGroup;
    dxLayoutLookAndFeelList1: TdxLayoutLookAndFeelList;
    dxLayoutOfficeLookAndFeel1: TdxLayoutOfficeLookAndFeel;
    dxLayoutControlRemesaProveedorItem9: TdxLayoutItem;
    cbCuentaBancaria: TcxDBLookupComboBox;
    dsDatosBanco: TDADataSource;
    dxLayoutControlRemesaProveedorGroup2: TdxLayoutGroup;
    dxLayoutControlRemesaProveedorItem1: TdxLayoutItem;
    cbTipo: TcxDBImageComboBox;

  protected
    FController: IRemesasProveedorController;
    FRemesaProveedor: IBizRemesaProveedor;
    function GetRemesaProveedor: IBizRemesaProveedor;
    procedure SetRemesaProveedor(const Value: IBizRemesaProveedor); virtual;
    function GetController : IRemesasProveedorController;
    procedure SetController (const Value : IRemesasProveedorController);
  public
    property RemesaProveedor: IBizRemesaProveedor read GetRemesaProveedor write SetRemesaProveedor;
    property Controller : IRemesasProveedorController read GetController write SetController;
    constructor Create(AOwner: TComponent); override;
  end;

implementation

{$R *.dfm}

uses
  uDataModuleUsuarios, uFactuGES_App;


{ TfrViewRemesaProveedors }

{
******************************* TfrViewRemesaProveedors ********************************
}

function TfrViewRemesaProveedor.GetRemesaProveedor: IBizRemesaProveedor;
begin
  Result := FRemesaProveedor;
end;

constructor TfrViewRemesaProveedor.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 TfrViewRemesaProveedor.GetController: IRemesasProveedorController;
begin
  Result := FController;
end;

procedure TfrViewRemesaProveedor.SetRemesaProveedor(const Value: IBizRemesaProveedor);
begin
  FRemesaProveedor := Value;

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

procedure TfrViewRemesaProveedor.SetController(const Value: IRemesasProveedorController);
begin
  FController := Value;
end;

end.

