unit uViewEntradaSalidaArticulos;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter,
  cxData, cxDataStorage, cxEdit, DB, cxDBData, ImgList, PngImageList,
  uDADataTable, ActnList, ComCtrls, ToolWin, cxGridLevel, cxClasses,
  cxControls, cxGridCustomView, cxGridCustomTableView, cxGridTableView,
  cxGridDBTableView, cxGrid, cxDBLookupComboBox, uViewGrid, StdCtrls,
  dxPSGlbl, dxPSUtl, dxPSEngn, dxPrnPg, dxBkgnd, dxWrap,
  dxPrnDev, dxPSCompsProvider, dxPSFillPatterns, dxPSEdgePatterns,
  cxGridCustomPopupMenu, cxGridPopupMenu, dxPSCore, dxPScxCommon, dxPScxGrid6Lnk,
  uAlmacenesController, uBizAlmacenes, TB2Item, TBX, TB2Dock, TB2Toolbar,
  uDataModuleInventario, cxRichEdit, cxTextEdit, dxPgsDlg, TBXDkPanels,
  uViewFiltroBase, cxSpinEdit, uDAInterfaces;
   
type
  IViewViewEntradaSalidaArticulos = interface(IViewGrid)
    ['{C195FC01-604A-484E-A809-0ED49890DBBE}']
//    function GetAlmacenes: IBizAlmacen;
//    property Almacenes: IBizAlmacen read GetAlmacenes;
  end;

  TfrViewEntradaSalidaArticulos = class(TfrViewGrid, IViewViewEntradaSalidaArticulos)
    DADataSourceAlmacenes: TDADataSource;
    cxGridViewRecID: TcxGridDBColumn;
    cxGridViewID: TcxGridDBColumn;
    cxGridViewID_ARTICULO: TcxGridDBColumn;
    cxGridViewCANTIDAD: TcxGridDBColumn;
    cxGridViewID_PEDIDO_PROVEEDOR: TcxGridDBColumn;
    cxGridViewID_PEDIDO_CLIENTE: TcxGridDBColumn;
    cxGridViewREFERENCIA_PED_CLI: TcxGridDBColumn;
    cxGridViewDESCRIPCION: TcxGridDBColumn;
    cxGridViewID_EMPRESA: TcxGridDBColumn;
    cxGridViewREFERENCIA: TcxGridDBColumn;
    cxGridViewREFERENCIA_PROV: TcxGridDBColumn;
    cxGridViewSTOCK: TcxGridDBColumn;
    cxStyle_CANTIDAD_IMPAR: TcxStyle;
    cxStyle_CANTIDAD_PAR: TcxStyle;
    procedure cxGridViewStylesGetContentStyle(
      Sender: TcxCustomGridTableView; ARecord: TcxCustomGridRecord;
      AItem: TcxCustomGridTableItem; out AStyle: TcxStyle);
  private
//Es para cuando el almacen destino sea relativo a cada artículo, como lo vamos a
//hacer relativo al conjunto esto sobra
//    FController: IAlmacenesController;
//    FAlmacenes: IBizAlmacen;
//    function GetAlmacenes: IBizAlmacen;
  public
//    property Almacenes: IBizAlmacen read GetAlmacenes;
//    constructor Create(AOwner : TComponent); override;
//    destructor destroy; override;
  end;

implementation
{$R *.dfm}

uses uDataModuleAlmacenes;

{ TfrViewEntradaArticulosInventario }

{constructor TfrViewEntradaSalidaArticulos.Create(AOwner: TComponent);
begin
  inherited;
  FController := TAlmacenesController.Create;
  FAlmacenes := FController.BuscarTodos;
  DADataSourceAlmacenes.DataTable := FAlmacenes.DataTable;
  DADataSourceAlmacenes.DataTable.Active := True;
end;

destructor TfrViewEntradaSalidaArticulos.destroy;
begin
  FController := Nil;
  inherited;
end;

function TfrViewEntradaSalidaArticulos.getAlmacenes: IBizAlmacen;
begin
  Result := FAlmacenes;
end;}

{ TfrViewEntradaSalidaArticulos }

{ TfrViewEntradaSalidaArticulos }

procedure TfrViewEntradaSalidaArticulos.cxGridViewStylesGetContentStyle(
  Sender: TcxCustomGridTableView; ARecord: TcxCustomGridRecord;
  AItem: TcxCustomGridTableItem; out AStyle: TcxStyle);
begin
  inherited;
  if Assigned(AItem) then
  begin
    if AItem.Index = cxGridViewCANTIDAD.Index then
    begin
      if Odd(ARecord.Index) then
        AStyle := cxStyle_NORMAL_PAR
      else
        AStyle := cxStyle_NORMAL_IMPAR;
      AStyle.Font.Style := [fsBold];
    end
    else begin
      if Odd(ARecord.Index) then
        AStyle := cxStyle_ORDENADO_PAR
      else
        AStyle := cxStyle_ORDENADO_IMPAR;
    end;
  end;
end;

end.
