git-svn-id: https://192.168.0.254/svn/Proyectos.AbetoDesign_FactuGES/trunk@36 93f398dd-4eb6-7a46-baf6-13f46f578da2
207 lines
6.3 KiB
ObjectPascal
207 lines
6.3 KiB
ObjectPascal
{
|
|
===============================================================================
|
|
Copyright (©) 2007. Rodax Software.
|
|
===============================================================================
|
|
Los contenidos de este fichero son propiedad de Rodax Software titular del
|
|
copyright. Este fichero sólo podrá ser copiado, distribuido y utilizado,
|
|
en su totalidad o en parte, con el permiso escrito de Rodax Software, o de
|
|
acuerdo con los términos y condiciones establecidas en el acuerdo/contrato
|
|
bajo el que se suministra.
|
|
-----------------------------------------------------------------------------
|
|
Web: www.rodax-software.com
|
|
===============================================================================
|
|
Fecha primera versión:
|
|
Versión actual: 1.0.0
|
|
Fecha versión actual:
|
|
===============================================================================
|
|
Modificaciones:
|
|
|
|
Fecha Comentarios
|
|
---------------------------------------------------------------------------
|
|
===============================================================================
|
|
}
|
|
|
|
unit uDataModuleRecibosCliente;
|
|
|
|
interface
|
|
|
|
uses
|
|
SysUtils, Classes, DB, uDAClientDataModule, uDADataTable, uDABINAdapter,
|
|
uDAScriptingProvider, uDACDSDataTable, uROWinInetHttpChannel, uROTypes,
|
|
uRORemoteService, uROClient, uROBinMessage,
|
|
uDADesigntimeCall, uDataModuleBase, uIntegerListUtils,
|
|
|
|
uIDataModuleRecibosCliente, uIDataModuleRecibosClienteReport,
|
|
uBizRecibosCliente, uBizPagosCliente, uBizRecibosCliCompensados, uDAInterfaces,
|
|
uDAMemDataTable, uDADataStreamer, uDABin2DataStreamer, uDARemoteDataAdapter;
|
|
|
|
type
|
|
TDataModuleRecibosCliente = class(TDataModuleBase, IDataModuleRecibosCliente, IDataModuleRecibosClienteReport)
|
|
RORemoteService: TRORemoteService;
|
|
rda_RecibosCliente: TDARemoteDataAdapter;
|
|
Bin2DataStreamer: TDABin2DataStreamer;
|
|
tbl_PagosCliente: TDAMemDataTable;
|
|
ds_PagosCliente: TDADataSource;
|
|
tbl_RecibosCliente: TDAMemDataTable;
|
|
ds_RecibosCliente: TDADataSource;
|
|
tbl_RecibosCompensadosCli: TDAMemDataTable;
|
|
ds_RecibosCompensadosCli: TDADataSource;
|
|
tbl_ListaAnosRecibos: TDAMemDataTable;
|
|
ds_ListaAnosRecibos: TDADataSource;
|
|
procedure DAClientDataModuleCreate(Sender: TObject);
|
|
|
|
protected
|
|
function _GetPagos: IBizPagosCliente;
|
|
function _GetRecibosCompensados : IBizRecibosCompensadosCli;
|
|
public
|
|
function GetAnosItems : TStringList;
|
|
function GetItems: IBizRecibosCliente;
|
|
function GetItem(const ID : Integer) : IBizRecibosCliente;
|
|
function NewItem : IBizRecibosCliente;
|
|
function GetReport(const ListaID: TIntegerList): Binary;
|
|
end;
|
|
|
|
implementation
|
|
|
|
{$R *.DFM}
|
|
|
|
uses
|
|
FactuGES_Intf, uDataModuleConexion, uDataTableUtils, cxControls,
|
|
schRecibosClienteClient_Intf;
|
|
|
|
{ TDataModuleRecibosCliente }
|
|
|
|
|
|
function TDataModuleRecibosCliente.GetReport(const ListaID: TIntegerList): Binary;
|
|
var
|
|
AParam : TIntegerArray;
|
|
begin
|
|
AParam := ListaID.ToIntegerArray;
|
|
try
|
|
Result := (RORemoteService as IsrvRecibosCliente).GenerateReport(AParam);
|
|
finally
|
|
FreeANDNIL(AParam);
|
|
end;
|
|
end;
|
|
|
|
procedure TDataModuleRecibosCliente.DAClientDataModuleCreate(Sender: TObject);
|
|
begin
|
|
RORemoteService.Channel := dmConexion.Channel;
|
|
RORemoteService.Message := dmConexion.Message;
|
|
end;
|
|
|
|
function TDataModuleRecibosCliente._GetPagos: IBizPagosCliente;
|
|
var
|
|
APagos : TDAMemDataTable;
|
|
begin
|
|
ShowHourglassCursor;
|
|
try
|
|
APagos := CloneDataTable(tbl_PagosCliente);
|
|
with APagos do
|
|
begin
|
|
BusinessRulesID := BIZ_CLIENT_IBIZPAGOSCLIENTE;
|
|
DetailOptions := DetailOptions - [dtDisableLogOfCascadeDeletes, dtDisableLogOfCascadeUpdates];
|
|
end;
|
|
Result := (APagos as IBizPagosCliente);
|
|
finally
|
|
HideHourglassCursor;
|
|
end;
|
|
end;
|
|
|
|
function TDataModuleRecibosCliente._GetRecibosCompensados: IBizRecibosCompensadosCli;
|
|
var
|
|
ARecibosCompensados : TDAMemDataTable;
|
|
begin
|
|
ShowHourglassCursor;
|
|
try
|
|
ARecibosCompensados := CloneDataTable(tbl_RecibosCompensadosCli);
|
|
with ARecibosCompensados do
|
|
begin
|
|
BusinessRulesID := BIZ_CLIENT_RECIBOS_COMPENSADOSCLI;
|
|
DetailOptions := DetailOptions - [dtDisableLogOfCascadeDeletes, dtDisableLogOfCascadeUpdates];
|
|
end;
|
|
Result := (ARecibosCompensados as IBizRecibosCompensadosCli);
|
|
finally
|
|
HideHourglassCursor;
|
|
end;
|
|
end;
|
|
|
|
function TDataModuleRecibosCliente.GetItems: IBizRecibosCliente;
|
|
var
|
|
AIBizRecibosCliente : TDAMemDataTable;
|
|
begin
|
|
ShowHourglassCursor;
|
|
try
|
|
AIBizRecibosCliente := CloneDataTable(tbl_RecibosCliente);
|
|
// EL CAMPO REFERENCIA TIENE QUE SER AUTOREFRESH!!!!!
|
|
AIBizRecibosCliente.FieldByName(fld_RecibosClienteREFERENCIA).ServerAutoRefresh := TRUE;
|
|
|
|
AIBizRecibosCliente.BusinessRulesID := BIZ_CLIENT_IBizRecibosCliente;
|
|
|
|
with TBizRecibosCliente(AIBizRecibosCliente.BusinessEventsObj) do
|
|
Pagos := _GetPagos;
|
|
|
|
with TBizRecibosCliente(AIBizRecibosCliente.BusinessEventsObj) do
|
|
RecibosCompensados := _GetRecibosCompensados;
|
|
|
|
Result := (AIBizRecibosCliente as IBizRecibosCliente);
|
|
finally
|
|
HideHourglassCursor;
|
|
end;
|
|
end;
|
|
|
|
function TDataModuleRecibosCliente.NewItem: IBizRecibosCliente;
|
|
begin
|
|
Result := GetItem(ID_NULO)
|
|
end;
|
|
|
|
function TDataModuleRecibosCliente.GetAnosItems: TStringList;
|
|
var
|
|
AListaAnos: TStringList;
|
|
begin
|
|
AListaAnos := TStringList.Create;
|
|
ShowHourglassCursor;
|
|
try
|
|
with tbl_ListaAnosRecibos do
|
|
begin
|
|
Open;
|
|
First;
|
|
while not eof do
|
|
begin
|
|
AListaAnos.Add(Format('%s=%s', [Fields[0].AsString, Fields[0].AsString]));
|
|
Next;
|
|
end;
|
|
Close;
|
|
end;
|
|
Result := AListaAnos;
|
|
finally
|
|
HideHourglassCursor;
|
|
end;
|
|
end;
|
|
|
|
function TDataModuleRecibosCliente.GetItem(const ID: Integer): IBizRecibosCliente;
|
|
var
|
|
Condicion: TDAWhereExpression;
|
|
begin
|
|
ShowHourglassCursor;
|
|
try
|
|
Result := Self.GetItems;
|
|
|
|
with Result.DataTable.DynamicWhere do
|
|
begin
|
|
// (ID = :ID)
|
|
Condicion := NewBinaryExpression(NewField('V_RECIBOS_CLIENTE', fld_RecibosClienteID), NewConstant(ID, datInteger), dboEqual);
|
|
|
|
if IsEmpty then
|
|
Expression := Condicion
|
|
else
|
|
Expression := NewBinaryExpression(Expression, Condicion, dboAnd);
|
|
end;
|
|
|
|
finally
|
|
HideHourglassCursor;
|
|
end;
|
|
end;
|
|
|
|
end.
|