unit uDataModuleCobrosMontaje;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, uDataModuleCobrosCliente, DB, uDADataTable, uDAScriptingProvider,
  uDACDSDataTable, uROClient, uROBinMessage, uROWinInetHttpChannel,
  uDADesigntimeCall, uDABINAdapter, uROServiceComponent, uRORemoteService,
  uROTypes,
  uIDataModuleCobrosMontaje, uBizCobrosMontaje, uIDataModuleCobrosMontajeReport;

type
  TDataModuleCobrosMontaje = class(TDataModuleCobrosCliente, IDataModuleCobrosMontaje, IDataModuleCobrosMontajeReport)
  protected
    procedure AsignarClaseNegocio(var ACobro: TDACDSDataTable); override;
  public
    function GetItemsMontaje(const ID : Integer) : IBizCobroMontaje;
    // Report
    function GetReport(const ACobroID: Integer): Binary;
  end;

implementation
{$R *.dfm}

uses FactuGES_Intf, cxControls, uDAInterfaces, schCobrosClienteClient_Intf;

{ TDataModuleCobrosMontaje }

procedure TDataModuleCobrosMontaje.AsignarClaseNegocio(var ACobro: TDACDSDataTable);
begin
  inherited;
  ACobro.BusinessRulesID := BIZ_CLIENT_COBRO_MONTAJE;
end;

function TDataModuleCobrosMontaje.GetItemsMontaje(const ID: Integer): IBizCobroMontaje;
begin
  ShowHourglassCursor;
  try
    Result := (Self.GetItems as IBizCobroMontaje);
    with Result.DataTable.Where do
    begin
      if NotEmpty then
        AddOperator(opAND);
      OpenBraket;
      AddText('COBROS.' + fld_CobrosClienteID_MONTAJE + ' = ' + IntToStr(ID));
      CloseBraket;
    end;
  finally
    HideHourglassCursor;
  end;
end;

function TDataModuleCobrosMontaje.GetReport(const ACobroID: Integer): Binary;
begin
  Result := (RORemoteService as IsrvCobrosCliente).GenerateReport(ACobroID)
end;

end.
