2007-06-21 16:02:50 +00:00
|
|
|
|
unit srvFacturasCliente_Impl;
|
|
|
|
|
|
|
|
|
|
|
|
{----------------------------------------------------------------------------}
|
|
|
|
|
|
{ This unit was automatically generated by the RemObjects SDK after reading }
|
|
|
|
|
|
{ the RODL file associated with this project . }
|
|
|
|
|
|
{ }
|
|
|
|
|
|
{ This is where you are supposed to code the implementation of your objects. }
|
|
|
|
|
|
{----------------------------------------------------------------------------}
|
|
|
|
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
|
|
|
|
|
|
|
uses
|
|
|
|
|
|
{vcl:} Classes, SysUtils,
|
|
|
|
|
|
{RemObjects:} uROClientIntf, uROTypes, uROServer, uROServerIntf, uROSessions,
|
|
|
|
|
|
{Ancestor Implementation:} DARemoteService_Impl,
|
|
|
|
|
|
{Used RODLs:} DataAbstract_Intf,
|
|
|
|
|
|
{Generated:} FactuGES_Intf, uDADataTable, uDACDSDataTable, frxClass, DB,
|
|
|
|
|
|
frxDBSet, uDAScriptingProvider, uDABusinessProcessor, uDAClasses,
|
|
|
|
|
|
uDataModuleServer, uDAInterfaces, frxDCtrl, frxDMPExport, frxGradient,
|
|
|
|
|
|
frxChBox, frxCross, frxRich, frxChart, frxOLE, frxBarcode, uDABINAdapter;
|
|
|
|
|
|
|
|
|
|
|
|
type
|
|
|
|
|
|
{ TsrvFacturasCliente }
|
|
|
|
|
|
TsrvFacturasCliente = class(TDARemoteService, IsrvFacturasCliente)
|
|
|
|
|
|
frxDBDetalles: TfrxDBDataset;
|
|
|
|
|
|
frxDBCabecera: TfrxDBDataset;
|
|
|
|
|
|
DADataCabecera: TDADataSource;
|
|
|
|
|
|
DADataDetalles: TDADataSource;
|
|
|
|
|
|
tbl_FacturaCliente: TDACDSDataTable;
|
|
|
|
|
|
tbl_DetallesFacturaCliente: TDACDSDataTable;
|
|
|
|
|
|
frxBarCodeObject1: TfrxBarCodeObject;
|
|
|
|
|
|
frxOLEObject1: TfrxOLEObject;
|
|
|
|
|
|
frxChartObject1: TfrxChartObject;
|
|
|
|
|
|
frxRichObject1: TfrxRichObject;
|
|
|
|
|
|
frxCrossObject1: TfrxCrossObject;
|
|
|
|
|
|
frxCheckBoxObject1: TfrxCheckBoxObject;
|
|
|
|
|
|
frxGradientObject1: TfrxGradientObject;
|
|
|
|
|
|
frxDotMatrixExport1: TfrxDotMatrixExport;
|
|
|
|
|
|
frxDialogControls1: TfrxDialogControls;
|
|
|
|
|
|
DABINAdapter: TDABINAdapter;
|
2007-09-12 14:41:49 +00:00
|
|
|
|
frxReport1: TfrxReport;
|
2009-03-05 18:57:06 +00:00
|
|
|
|
schFacturasCliente: TDASchema;
|
2007-06-21 16:02:50 +00:00
|
|
|
|
private
|
|
|
|
|
|
protected
|
|
|
|
|
|
{ IsrvFacturasCliente methods }
|
|
|
|
|
|
function GetNextAutoinc: Integer;
|
|
|
|
|
|
function PuedoEliminarFactura(const CodigoFactura: Integer): Boolean;
|
|
|
|
|
|
function ExisteFacturaDeAlbaran(const CodigoAlbaran: Integer; out CodigoFactura: Integer): Boolean;
|
|
|
|
|
|
function GenerateReport(const Codigo: Integer; const TamLetra: Integer): Binary;
|
|
|
|
|
|
function DarNuevaReferencia: String;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
|
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
|
uses
|
|
|
|
|
|
Dialogs,
|
|
|
|
|
|
{Generated:} FactuGES_Invk, uRORemoteDataModule,
|
|
|
|
|
|
fServerForm, Variants, IB, schFacturasClienteClient_Intf;
|
|
|
|
|
|
|
|
|
|
|
|
procedure Create_srvFacturasCliente(out anInstance : IUnknown);
|
|
|
|
|
|
begin
|
|
|
|
|
|
anInstance := TsrvFacturasCliente.Create(NIL);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
{ srvFacturasCliente }
|
|
|
|
|
|
function TsrvFacturasCliente.DarNuevaReferencia: String;
|
|
|
|
|
|
var
|
|
|
|
|
|
dsReferencia: IDADataset;
|
|
|
|
|
|
begin
|
|
|
|
|
|
dsReferencia := schFacturasCliente.NewDataset(Connection, 'DarReferenciaFactura');
|
|
|
|
|
|
dsReferencia.Active := True;
|
|
|
|
|
|
Result := dsReferencia.FieldByName('REFERENCIA').AsString;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
function TsrvFacturasCliente.ExisteFacturaDeAlbaran(
|
|
|
|
|
|
const CodigoAlbaran: Integer; out CodigoFactura: Integer): Boolean;
|
|
|
|
|
|
begin
|
|
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
function TsrvFacturasCliente.GenerateReport(const Codigo: Integer; const TamLetra: Integer): Binary;
|
|
|
|
|
|
var
|
|
|
|
|
|
dsMaster: IDADataset;
|
|
|
|
|
|
dsDetail: IDADataset;
|
|
|
|
|
|
AStream: TMemoryStream;
|
|
|
|
|
|
begin
|
|
|
|
|
|
AStream := TMemoryStream.Create;
|
|
|
|
|
|
Result := Binary.Create;
|
|
|
|
|
|
try
|
|
|
|
|
|
dsMaster := schFacturasCliente.NewDataset(Connection, 'InformeCabeceraFacturaCliente', ['CODIGO'], [Codigo]);
|
|
|
|
|
|
dsDetail := schFacturasCliente.NewDataset(Connection, 'InformeDetallesFacturaCliente', ['CODIGOFACTURA'], [Codigo], False);
|
|
|
|
|
|
dsDetail.Active := True;
|
|
|
|
|
|
|
|
|
|
|
|
AStream.Clear;
|
|
|
|
|
|
ServiceAdapter.WriteDataset(AStream, dsMaster, [woRows, woSchema], -1);
|
|
|
|
|
|
ServiceAdapter.ReadDataset(AStream, tbl_FacturaCliente, TRUE, '', TRUE, TRUE);
|
|
|
|
|
|
|
|
|
|
|
|
AStream.Clear;
|
|
|
|
|
|
ServiceAdapter.WriteDataset(AStream, dsDetail, [woRows, woSchema], -1);
|
|
|
|
|
|
ServiceAdapter.ReadDataset(AStream, tbl_DetallesFacturaCliente, TRUE, '', TRUE, TRUE);
|
|
|
|
|
|
|
|
|
|
|
|
frxReport1.LoadFromFile(DarRutaInformes + 'InfFacturaCliente.fr3', True);
|
|
|
|
|
|
|
|
|
|
|
|
//Tama<6D>o de letra
|
|
|
|
|
|
if TamLetra <> 0 then
|
|
|
|
|
|
frxReport1.Styles.Find('Concepto normal').Font.Size := TamLetra;
|
|
|
|
|
|
|
|
|
|
|
|
frxReport1.PrepareReport;
|
|
|
|
|
|
frxReport1.PreviewPages.SaveToStream(Result);
|
|
|
|
|
|
finally
|
|
|
|
|
|
AStream.Free;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
function TsrvFacturasCliente.GetNextAutoinc: Integer;
|
|
|
|
|
|
begin
|
|
|
|
|
|
Result := uDataModuleServer.GetNextAutoinc(Connection, 'GEN_FACTURASCLIENTE');
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
function TsrvFacturasCliente.PuedoEliminarFactura(
|
|
|
|
|
|
const CodigoFactura: Integer): Boolean;
|
|
|
|
|
|
begin
|
|
|
|
|
|
// ?
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
initialization
|
|
|
|
|
|
TROClassFactory.Create('srvFacturasCliente', Create_srvFacturasCliente, TsrvFacturasCliente_Invoker);
|
|
|
|
|
|
|
|
|
|
|
|
finalization
|
|
|
|
|
|
|
|
|
|
|
|
end.
|