2007-06-21 16:02:50 +00:00
|
|
|
|
unit uDataModuleMontajes;
|
|
|
|
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
|
|
|
|
|
|
|
uses {vcl:} SysUtils, Classes, DB, DBClient,
|
|
|
|
|
|
{RemObjects:} uDAClientDataModule, uDADataTable, uDABINAdapter,
|
|
|
|
|
|
uROServiceComponent, uRORemoteService, uROClient, uROBinMessage,
|
|
|
|
|
|
uROWinInetHttpChannel, uDAScriptingProvider, uDACDSDataTable,
|
|
|
|
|
|
uBizMontajes, uBizPresupuestosCliente, schMontajesClient_Intf;
|
|
|
|
|
|
|
|
|
|
|
|
type
|
|
|
|
|
|
TdmMontajes = class(TDAClientDataModule)
|
|
|
|
|
|
DABINAdapter: TDABINAdapter;
|
|
|
|
|
|
RORemoteService: TRORemoteService;
|
|
|
|
|
|
tbl_Montajes: TDACDSDataTable;
|
|
|
|
|
|
ds_Montajes: TDADataSource;
|
|
|
|
|
|
tbl_FichaBeneficios: TDACDSDataTable;
|
|
|
|
|
|
ds_FichaBeneficios: TDADataSource;
|
|
|
|
|
|
tbl_FichaBeneficios_Aux: TDACDSDataTable;
|
|
|
|
|
|
ds_FichaBeneficios_Aux: TDADataSource;
|
2009-03-05 18:57:06 +00:00
|
|
|
|
tbl_ListaAnosMontajes: TDACDSDataTable;
|
|
|
|
|
|
ds_ListaAnosMontajes: TDADataSource;
|
2007-06-21 16:02:50 +00:00
|
|
|
|
procedure DAClientDataModuleCreate(Sender: TObject);
|
|
|
|
|
|
public
|
|
|
|
|
|
function GetItems: IBizMontaje; overload;
|
|
|
|
|
|
function GetItemsPendientes(Situacion: TEnumSituacion): IBizMontaje;
|
|
|
|
|
|
function GetItemsSeleccionados(ASource : IBizMontaje): IBizMontaje;
|
|
|
|
|
|
function GetItem(Codigo : Integer): IBizMontaje;
|
|
|
|
|
|
function GetItems(CodigoPresupuesto : Integer): IBizMontaje; overload;
|
|
|
|
|
|
function GetNextAutoinc(const Generador: String): integer;
|
|
|
|
|
|
procedure PreviewFicha(const Codigo:Integer);
|
|
|
|
|
|
procedure PrintFicha(const Codigo:Integer);
|
|
|
|
|
|
procedure PreviewEtiquetas(const Codigo : Integer; const NumEtiquetas : Integer);
|
|
|
|
|
|
procedure PrintEtiquetas(const Codigo : Integer; const NumEtiquetas : Integer);
|
|
|
|
|
|
function PuedoEliminarMontaje(Codigo : Integer) : Boolean;
|
2009-06-04 14:37:09 +00:00
|
|
|
|
function darFichaBeneficiosAux(const Tipo: String): IFichaBeneficios_Aux;
|
2007-06-21 16:02:50 +00:00
|
|
|
|
procedure NuevoMontaje(AMontaje: IBizMontaje; APresupuesto: IBizPresupuestos);
|
|
|
|
|
|
function CambiarSituacion(CodigoPresupuesto: Integer; Situacion: TEnumSituacion): String;
|
2009-03-05 18:57:06 +00:00
|
|
|
|
function DarNuevaReferencia (TipoMontaje : String) : String;
|
|
|
|
|
|
|
|
|
|
|
|
function DarListaAnosMontajes: TStringList;
|
|
|
|
|
|
procedure FiltrarAno(AMontajes: IBizMontaje; AWhereDataTable: String; const Ano: String);
|
2007-06-21 16:02:50 +00:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
var
|
|
|
|
|
|
dmMontajes: TdmMontajes;
|
|
|
|
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
|
|
|
|
|
|
{$R *.DFM}
|
|
|
|
|
|
|
|
|
|
|
|
uses
|
2009-03-05 18:57:06 +00:00
|
|
|
|
Controls, cxControls, Forms, uDAInterfaces, DataAbstract_Intf, FactuGES_Intf,
|
2007-06-21 16:02:50 +00:00
|
|
|
|
uDataTableUtils, uROTypes, uEditorPreview,
|
|
|
|
|
|
Dialogs, uDataModuleBase, uDBSelectionList,
|
|
|
|
|
|
uDataModuleContactos, uDataModulePresupuestos;
|
|
|
|
|
|
|
|
|
|
|
|
const
|
|
|
|
|
|
MAX_RECORDS = 100;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
procedure TdmMontajes.DAClientDataModuleCreate(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
RORemoteService.Channel := dmBase.Channel;
|
|
|
|
|
|
RORemoteService.Message := dmBase.Message;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
function TdmMontajes.GetItems: IBizMontaje;
|
|
|
|
|
|
var
|
|
|
|
|
|
dtMontajes: TDACDSDataTable;
|
|
|
|
|
|
dtFichaBeneficiosMontaje: TDACDSDataTable;
|
|
|
|
|
|
ACursor: TCursor;
|
|
|
|
|
|
begin
|
|
|
|
|
|
ACursor := Screen.Cursor;
|
|
|
|
|
|
Screen.Cursor := crHourGlass;
|
|
|
|
|
|
try
|
|
|
|
|
|
dtMontajes := TDACDSDataTable.Create(NIL);
|
|
|
|
|
|
CloneDataTable(tbl_Montajes, dtMontajes);
|
|
|
|
|
|
dtMontajes.BusinessRulesID := 'BizMontaje';
|
|
|
|
|
|
|
|
|
|
|
|
dtFichaBeneficiosMontaje := TDACDSDataTable.Create(NIL);
|
|
|
|
|
|
CloneDataTable(tbl_FichaBeneficios, dtFichaBeneficiosMontaje);
|
|
|
|
|
|
with dtFichaBeneficiosMontaje do
|
|
|
|
|
|
begin
|
|
|
|
|
|
BusinessRulesID := 'BizFichaBeneficiosMontaje';
|
|
|
|
|
|
DetailOptions := DetailOptions - [dtDisableLogOfCascadeDeletes, dtDisableLogOfCascadeUpdates];
|
|
|
|
|
|
end;
|
|
|
|
|
|
(dtMontajes as IBizMontaje).FichaBeneficios := (dtFichaBeneficiosMontaje as IBizFichaBeneficiosMontaje);
|
|
|
|
|
|
|
|
|
|
|
|
Result := (dtMontajes as IBizMontaje);
|
|
|
|
|
|
finally
|
|
|
|
|
|
Screen.Cursor := ACursor;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
{function TdmAlmacenes.GetCliente(Codigo: Integer): IBizCliente;
|
|
|
|
|
|
var
|
|
|
|
|
|
// dtContactos: TDACDSDataTable;
|
|
|
|
|
|
// dtCategorias: TDACDSDataTable;
|
|
|
|
|
|
// ACursor: TCursor;
|
|
|
|
|
|
begin
|
|
|
|
|
|
{ ACursor := Screen.Cursor;
|
|
|
|
|
|
Screen.Cursor := crHourGlass;
|
|
|
|
|
|
try
|
|
|
|
|
|
dtContactos := TDACDSDataTable.Create(NIL);
|
|
|
|
|
|
CloneDataTable(tbl_Contactos, dtContactos);
|
|
|
|
|
|
dtContactos.BusinessRulesID := 'BizCliente';
|
|
|
|
|
|
|
|
|
|
|
|
dtCategorias := TDACDSDataTable.Create(NIL);
|
|
|
|
|
|
CloneDataTable(tbl_CategoriasContacto, dtCategorias);
|
|
|
|
|
|
dtCategorias.BusinessRulesID := 'BizCategoria';
|
|
|
|
|
|
(dtContactos as IBizContacto).Categorias := (dtCategorias as IBizCategoriasContacto);
|
|
|
|
|
|
|
|
|
|
|
|
Result := (dtContactos as IBizCliente);
|
|
|
|
|
|
GetCliente(Result, Codigo);
|
|
|
|
|
|
finally
|
|
|
|
|
|
Screen.Cursor := ACursor;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function TdmMontajes.GetItem(Codigo: Integer): IBizMontaje;
|
|
|
|
|
|
var
|
|
|
|
|
|
AMontaje: IBizMontaje;
|
|
|
|
|
|
begin
|
|
|
|
|
|
AMontaje := GetItems;
|
|
|
|
|
|
with AMontaje.DataTable do
|
|
|
|
|
|
begin
|
|
|
|
|
|
if Active then
|
|
|
|
|
|
Active := False;
|
|
|
|
|
|
Where.Clear;
|
|
|
|
|
|
Where.OpenBraket;
|
|
|
|
|
|
Where.AddText('MON.' + fld_MONTAJESCODIGO + ' = ' + IntToStr(Codigo), False);
|
|
|
|
|
|
Where.CloseBraket;
|
|
|
|
|
|
end;
|
|
|
|
|
|
Result := AMontaje;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
function TdmMontajes.GetNextAutoinc(const Generador: String): integer;
|
|
|
|
|
|
begin
|
|
|
|
|
|
Result := (RORemoteService as IsrvMontajes).GetNextAutoinc(Generador);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
function TdmMontajes.GetItemsSeleccionados(ASource: IBizMontaje): IBizMontaje;
|
|
|
|
|
|
var
|
|
|
|
|
|
aObj : ISelectedRowList;
|
|
|
|
|
|
dtMontaje : IBizMontaje;
|
|
|
|
|
|
i : integer;
|
|
|
|
|
|
begin
|
|
|
|
|
|
if Supports(ASource, ISelectedRowList, aObj) then
|
|
|
|
|
|
begin
|
|
|
|
|
|
if (aObj.SelectedRows.Count = 1) then
|
|
|
|
|
|
begin
|
|
|
|
|
|
ASource.DataTable.GotoBookmark(aObj.SelectedRows[0]);
|
|
|
|
|
|
Result := GetItem(ASource.CODIGO);
|
|
|
|
|
|
Exit;
|
|
|
|
|
|
end
|
|
|
|
|
|
else
|
|
|
|
|
|
dtMontaje := GetItems;
|
|
|
|
|
|
end
|
|
|
|
|
|
else
|
|
|
|
|
|
raise Exception.Create('Interface no soportada (GetItemsSeleccionados)');
|
|
|
|
|
|
|
|
|
|
|
|
if dtMontaje.DataTable.Active then
|
|
|
|
|
|
dtMontaje.DataTable.Active := False;
|
|
|
|
|
|
with dtMontaje.DataTable.Where do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Clear;
|
|
|
|
|
|
for i := 0 to aObj.SelectedRows.Count - 1 do
|
|
|
|
|
|
begin
|
|
|
|
|
|
ASource.DataTable.GotoBookmark(aObj.SelectedRows[i]);
|
|
|
|
|
|
if i > 0 then
|
|
|
|
|
|
AddOperator(opAND);
|
|
|
|
|
|
AddCondition(fld_MontajesCODIGO, cEqual, ASource.CODIGO);
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
Result := dtMontaje;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
function TdmMontajes.GetItemsPendientes(Situacion: TEnumSituacion): IBizMontaje;
|
|
|
|
|
|
var
|
|
|
|
|
|
dsMontajes : IBizMontaje;
|
|
|
|
|
|
begin
|
|
|
|
|
|
dsMontajes := GetItems;
|
|
|
|
|
|
with dsMontajes.DataTable.Where do
|
|
|
|
|
|
begin
|
|
|
|
|
|
if not Empty then
|
|
|
|
|
|
AddOperator(opAND);
|
|
|
|
|
|
Clear;
|
|
|
|
|
|
OpenBraket;
|
|
|
|
|
|
case Situacion of
|
|
|
|
|
|
sitPendientes: begin
|
|
|
|
|
|
AddText('MONTAJES.' + fld_MontajesSITUACION + '=' + '''' + SITUACION_PENDIENTERECEPCION + '''', False);
|
|
|
|
|
|
AddText('OR MONTAJES.' + fld_MontajesSITUACION + '=' + '''' + SITUACION_PENDIENTEMONTAJE + '''', False);
|
|
|
|
|
|
AddText('OR MONTAJES.' + fld_MontajesSITUACION + '=' + '''' + SITUACION_PENDIENTEPAGO + '''', False);
|
|
|
|
|
|
end;
|
|
|
|
|
|
sitPendienteRecepcion: AddText('MONTAJES.' + fld_MontajesSITUACION + '=' + '''' + SITUACION_PENDIENTERECEPCION + '''', False);
|
|
|
|
|
|
sitPendienteMontaje: AddText('MONTAJES.' + fld_MontajesSITUACION + '=' + '''' + SITUACION_PENDIENTEMONTAJE + '''', False);
|
|
|
|
|
|
sitPendientePago: AddText('MONTAJES.' + fld_MontajesSITUACION + '=' + '''' + SITUACION_PENDIENTEPAGO + '''', False);
|
|
|
|
|
|
sitPagado: AddText('MONTAJES.' + fld_MontajesSITUACION + '=' + '''' + SITUACION_PAGADO + '''', False);
|
|
|
|
|
|
end;
|
|
|
|
|
|
CloseBraket;
|
|
|
|
|
|
end;
|
|
|
|
|
|
Result := dsMontajes;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
function TdmMontajes.PuedoEliminarMontaje(Codigo: Integer): Boolean;
|
|
|
|
|
|
begin
|
|
|
|
|
|
Result := (RORemoteService as IsrvMontajes).PuedoEliminarMontaje(Codigo);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TdmMontajes.PreviewFicha(Const Codigo:Integer);
|
|
|
|
|
|
var
|
|
|
|
|
|
AStream: TMemoryStream;
|
|
|
|
|
|
AEditorPreview : TfEditorPreview;
|
|
|
|
|
|
begin
|
|
|
|
|
|
AStream := Binary.Create;
|
|
|
|
|
|
AEditorPreview := TfEditorPreview.Create(Application);
|
|
|
|
|
|
try
|
|
|
|
|
|
AStream := (RemoteService as ISrvMontajes).GenerateReportFicha(Codigo);
|
|
|
|
|
|
AEditorPreview.Report.PreviewPages.LoadFromStream(AStream);
|
|
|
|
|
|
AEditorPreview.ShowModal;
|
|
|
|
|
|
finally
|
|
|
|
|
|
AEditorPreview.Release;
|
|
|
|
|
|
AStream.Free;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TdmMontajes.PrintFicha(Const Codigo:Integer);
|
|
|
|
|
|
var
|
|
|
|
|
|
AStream: TMemoryStream;
|
|
|
|
|
|
AEditorPreview : TfEditorPreview;
|
|
|
|
|
|
begin
|
|
|
|
|
|
AStream := Binary.Create;
|
|
|
|
|
|
AEditorPreview := TfEditorPreview.Create(Application);
|
|
|
|
|
|
try
|
|
|
|
|
|
AStream := (RemoteService as ISrvMontajes).GenerateReportFicha(Codigo);
|
|
|
|
|
|
AEditorPreview.Report.PreviewPages.LoadFromStream(AStream);
|
|
|
|
|
|
AEditorPreview.Print;
|
|
|
|
|
|
finally
|
|
|
|
|
|
AEditorPreview.Release;
|
|
|
|
|
|
AStream.Free;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TdmMontajes.PreviewEtiquetas(const Codigo : Integer;
|
|
|
|
|
|
const NumEtiquetas : Integer);
|
|
|
|
|
|
var
|
|
|
|
|
|
AStream: TMemoryStream;
|
|
|
|
|
|
AEditorPreview : TfEditorPreview;
|
|
|
|
|
|
begin
|
|
|
|
|
|
AStream := Binary.Create;
|
|
|
|
|
|
AEditorPreview := TfEditorPreview.Create(Application);
|
|
|
|
|
|
try
|
|
|
|
|
|
AStream := (RemoteService as ISrvMontajes).GenerateReportEtiquetas(Codigo, NumEtiquetas);
|
|
|
|
|
|
AEditorPreview.Report.PreviewPages.LoadFromStream(AStream);
|
|
|
|
|
|
AEditorPreview.ShowModal;
|
|
|
|
|
|
finally
|
|
|
|
|
|
AEditorPreview.Release;
|
|
|
|
|
|
AStream.Free;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TdmMontajes.PrintEtiquetas(const Codigo : Integer;
|
|
|
|
|
|
const NumEtiquetas : Integer);
|
|
|
|
|
|
var
|
|
|
|
|
|
AStream: TMemoryStream;
|
|
|
|
|
|
AEditorPreview : TfEditorPreview;
|
|
|
|
|
|
begin
|
|
|
|
|
|
AStream := Binary.Create;
|
|
|
|
|
|
AEditorPreview := TfEditorPreview.Create(Application);
|
|
|
|
|
|
try
|
|
|
|
|
|
AStream := (RemoteService as ISrvMontajes).GenerateReportEtiquetas(Codigo, NumEtiquetas);
|
|
|
|
|
|
AEditorPreview.Report.PreviewPages.LoadFromStream(AStream);
|
|
|
|
|
|
AEditorPreview.Print;
|
|
|
|
|
|
finally
|
|
|
|
|
|
AEditorPreview.Release;
|
|
|
|
|
|
AStream.Free;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TdmMontajes.NuevoMontaje(AMontaje: IBizMontaje; APresupuesto: IBizPresupuestos);
|
|
|
|
|
|
begin
|
|
|
|
|
|
if not Assigned(AMontaje) then
|
|
|
|
|
|
begin
|
|
|
|
|
|
AMontaje := getItem(-1);
|
|
|
|
|
|
AMontaje.DataTable.Active := True;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2009-06-04 14:37:09 +00:00
|
|
|
|
//Siempre antes de la inserci<63>n que en el onnew de la clase de negocio se sepa que tipo de montaje ser<65>
|
|
|
|
|
|
//y poder generar la ficha de beneficios correspondiente
|
|
|
|
|
|
AMontaje.TipoFichaBeneficios := APresupuesto.TIPO;
|
|
|
|
|
|
|
2007-06-21 16:02:50 +00:00
|
|
|
|
AMontaje.Insert;
|
|
|
|
|
|
AMontaje.Presupuesto := APresupuesto;
|
|
|
|
|
|
AMontaje.Post;
|
|
|
|
|
|
AMontaje.DataTable.ApplyUpdates;
|
|
|
|
|
|
|
|
|
|
|
|
// if not AnadirFichaBeneficios(AMontaje.CODIGO) then
|
|
|
|
|
|
// raise Exception.Create('Error al crear ficha de beneficios');
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2009-06-04 14:37:09 +00:00
|
|
|
|
function TdmMontajes.darFichaBeneficiosAux(const Tipo: String): IFichaBeneficios_Aux;
|
2007-06-21 16:02:50 +00:00
|
|
|
|
var
|
|
|
|
|
|
dtFichaBeneficiosAux: TDACDSDataTable;
|
|
|
|
|
|
ACursor: TCursor;
|
|
|
|
|
|
begin
|
|
|
|
|
|
ACursor := Screen.Cursor;
|
|
|
|
|
|
Screen.Cursor := crHourGlass;
|
|
|
|
|
|
try
|
|
|
|
|
|
dtFichaBeneficiosAux := TDACDSDataTable.Create(NIL);
|
|
|
|
|
|
CloneDataTable(tbl_FichaBeneficios_Aux, dtFichaBeneficiosAux);
|
|
|
|
|
|
dtFichaBeneficiosAux.BusinessRulesID := 'BizFichaBeneficiosAux';
|
2009-06-04 14:37:09 +00:00
|
|
|
|
dtFichaBeneficiosAux.ParamByName('TIPO').AsString := Tipo;
|
2007-06-21 16:02:50 +00:00
|
|
|
|
Result := (dtFichaBeneficiosAux as IFichaBeneficios_Aux);
|
|
|
|
|
|
finally
|
|
|
|
|
|
Screen.Cursor := ACursor;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
function TdmMontajes.CambiarSituacion(CodigoPresupuesto: Integer; Situacion: TEnumSituacion): String;
|
|
|
|
|
|
var
|
|
|
|
|
|
AMontaje: IBizMontaje;
|
|
|
|
|
|
begin
|
|
|
|
|
|
Result := '';
|
|
|
|
|
|
AMontaje := GetItems(CodigoPresupuesto);
|
|
|
|
|
|
AMontaje.DataTable.Active := True;
|
|
|
|
|
|
|
|
|
|
|
|
AMontaje.DataTable.First;
|
|
|
|
|
|
while not AMontaje.DataTable.EOF do
|
|
|
|
|
|
begin
|
|
|
|
|
|
AMontaje.DataTable.Edit;
|
|
|
|
|
|
Case Situacion of
|
|
|
|
|
|
sitPendientes: AMontaje.SITUACION := SITUACION_PENDIENTE;
|
|
|
|
|
|
sitPendienteRecepcion: AMontaje.SITUACION := SITUACION_PENDIENTERECEPCION;
|
|
|
|
|
|
sitPendienteMontaje: AMontaje.SITUACION := SITUACION_PENDIENTEMONTAJE;
|
|
|
|
|
|
sitPendientePago: AMontaje.SITUACION := SITUACION_PENDIENTEPAGO;
|
|
|
|
|
|
sitPagado: AMontaje.SITUACION := SITUACION_PAGADO;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
if (Length(Result) > 0) then
|
|
|
|
|
|
Result := Result + ', ';
|
|
|
|
|
|
Result := Result + AMontaje.REFERENCIA;
|
|
|
|
|
|
|
|
|
|
|
|
AMontaje.DataTable.Post;
|
|
|
|
|
|
AMontaje.DataTable.Next;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
//Solo si se han hecho cambios
|
|
|
|
|
|
if (Length(Result) > 0) then
|
|
|
|
|
|
AMontaje.DataTable.ApplyUpdates;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
function TdmMontajes.GetItems(CodigoPresupuesto: Integer): IBizMontaje;
|
|
|
|
|
|
var
|
|
|
|
|
|
AMontaje: IBizMontaje;
|
|
|
|
|
|
begin
|
|
|
|
|
|
AMontaje := GetItems;
|
|
|
|
|
|
with AMontaje.DataTable do
|
|
|
|
|
|
begin
|
|
|
|
|
|
if Active then
|
|
|
|
|
|
Active := False;
|
|
|
|
|
|
Where.Clear;
|
|
|
|
|
|
Where.OpenBraket;
|
|
|
|
|
|
Where.AddText('MON.' + fld_MONTAJESCODIGOPRESUPUESTO + ' = ' + IntToStr(CodigoPresupuesto), False);
|
|
|
|
|
|
Where.CloseBraket;
|
|
|
|
|
|
end;
|
|
|
|
|
|
Result := AMontaje;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
function TdmMontajes.DarNuevaReferencia(TipoMontaje: String): String;
|
|
|
|
|
|
begin
|
|
|
|
|
|
Result := (RORemoteService as IsrvMontajes).DarNuevaReferencia(TipoMontaje);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2009-03-05 18:57:06 +00:00
|
|
|
|
function TdmMontajes.DarListaAnosMontajes: TStringList;
|
|
|
|
|
|
var
|
|
|
|
|
|
AListaAnos: TStringList;
|
|
|
|
|
|
begin
|
|
|
|
|
|
AListaAnos := TStringList.Create;
|
|
|
|
|
|
ShowHourglassCursor;
|
|
|
|
|
|
try
|
|
|
|
|
|
with tbl_ListaAnosMontajes 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;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TdmMontajes.FiltrarAno(AMontajes: IBizMontaje; AWhereDataTable: String; const Ano: String);
|
|
|
|
|
|
var
|
|
|
|
|
|
FechaIni: String;
|
|
|
|
|
|
FechaFin: String;
|
|
|
|
|
|
|
|
|
|
|
|
begin
|
|
|
|
|
|
AMontajes.DataTable.Where.Clear;
|
|
|
|
|
|
AMontajes.DataTable.Where.AddText(AWhereDataTable);
|
|
|
|
|
|
|
|
|
|
|
|
if (Ano <> 'Todos') then
|
|
|
|
|
|
begin
|
|
|
|
|
|
// Filtrar los presupuestos actuales por a<>os
|
|
|
|
|
|
FechaIni := '01.01.' + Ano;
|
|
|
|
|
|
FechaFin := '31.12.' + Ano;
|
|
|
|
|
|
with AMontajes.DataTable.Where do
|
|
|
|
|
|
begin
|
|
|
|
|
|
if NotEmpty then
|
|
|
|
|
|
AddOperator(opAND);
|
|
|
|
|
|
AddCondition(fld_MontajesFECHAINICIO, cMajorOrEqual, FechaIni);
|
|
|
|
|
|
AddOperator(opAND);
|
|
|
|
|
|
AddCondition(fld_MontajesFECHAINICIO, cLessOrEqual, FechaFin);
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2007-06-21 16:02:50 +00:00
|
|
|
|
initialization
|
|
|
|
|
|
dmMontajes := TdmMontajes.Create(nil);
|
|
|
|
|
|
|
|
|
|
|
|
finalization
|
|
|
|
|
|
FreeAndNil(dmMontajes);
|
|
|
|
|
|
|
|
|
|
|
|
end.
|
|
|
|
|
|
|