2007-10-26 18:19:55 +00:00
|
|
|
|
unit uEditorPresupuestosCliente;
|
|
|
|
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
|
|
|
|
|
|
|
uses
|
|
|
|
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
|
|
|
|
Menus, DB, uDADataTable, JvAppStorage,
|
|
|
|
|
|
JvAppRegistryStorage, JvComponent, JvFormPlacement, ImgList,
|
|
|
|
|
|
PngImageList, StdActns, ActnList, ComCtrls, TB2ExtItems, TBXExtItems,
|
|
|
|
|
|
TBX, TB2Item, TB2Dock, TB2Toolbar, ExtCtrls, JvExControls,
|
|
|
|
|
|
JvNavigationPane, uViewGrid, pngimage, JvComponentBase,
|
|
|
|
|
|
uEditorGridBase,
|
|
|
|
|
|
uBizPresupuestosCliente, uIEditorPresupuestosCliente, uPresupuestosClienteController,
|
|
|
|
|
|
uCustomView, uViewBase, uViewBarraSeleccion, uViewGridBase,
|
|
|
|
|
|
uViewPresupuestosCliente, JvExComCtrls, JvStatusBar, JSDialog, StdCtrls,
|
|
|
|
|
|
uDAInterfaces;
|
|
|
|
|
|
|
|
|
|
|
|
type
|
|
|
|
|
|
TfEditorPresupuestosCliente = class(TfEditorGridBase, IEditorPresupuestosCliente)
|
|
|
|
|
|
actGenerarAlbaranCli: TAction;
|
|
|
|
|
|
actGenerarFactura: TAction;
|
|
|
|
|
|
TBXSubmenuItem2: TTBXSubmenuItem;
|
|
|
|
|
|
TBXSeparatorItem17: TTBXSeparatorItem;
|
|
|
|
|
|
TBXItem38: TTBXItem;
|
|
|
|
|
|
TBXItem39: TTBXItem;
|
|
|
|
|
|
N4: TMenuItem;
|
|
|
|
|
|
actGenerar: TAction;
|
|
|
|
|
|
Generar2: TMenuItem;
|
|
|
|
|
|
JsGenerarDialog: TJSDialog;
|
|
|
|
|
|
JsPrevisualizarDialog: TJSDialog;
|
|
|
|
|
|
JsImprimirDialog: TJSDialog;
|
|
|
|
|
|
TBXItem40: TTBXItem;
|
2007-11-05 17:49:11 +00:00
|
|
|
|
JsListaPresupuestosNoEliminados: TJSDialog;
|
2007-10-26 18:19:55 +00:00
|
|
|
|
procedure FormShow(Sender: TObject);
|
|
|
|
|
|
procedure actGenerarAlbaranCliExecute(Sender: TObject);
|
|
|
|
|
|
procedure actEliminarUpdate(Sender: TObject);
|
|
|
|
|
|
procedure actGenerarFacturaUpdate(Sender: TObject);
|
|
|
|
|
|
procedure actGenerarFacturaExecute(Sender: TObject);
|
2007-11-05 17:49:11 +00:00
|
|
|
|
procedure actGenerarPresupuestoProvExecute(Sender: TObject);
|
2007-10-26 18:19:55 +00:00
|
|
|
|
procedure actGenerarExecute(Sender: TObject);
|
|
|
|
|
|
procedure actGenerarUpdate(Sender: TObject);
|
|
|
|
|
|
|
|
|
|
|
|
protected
|
2007-11-05 17:49:11 +00:00
|
|
|
|
FPresupuestos: IBizPresupuestoCliente;
|
2007-10-26 18:19:55 +00:00
|
|
|
|
FController : IPresupuestosClienteController;
|
|
|
|
|
|
|
2007-11-05 17:49:11 +00:00
|
|
|
|
function GetPresupuestos: IBizPresupuestoCliente;
|
|
|
|
|
|
procedure SetPresupuestos(const Value: IBizPresupuestoCliente);
|
2007-10-26 18:19:55 +00:00
|
|
|
|
|
|
|
|
|
|
function GetController : IPresupuestosClienteController; virtual;
|
|
|
|
|
|
procedure SetController (const Value : IPresupuestosClienteController); virtual;
|
|
|
|
|
|
|
|
|
|
|
|
procedure NuevoInterno; override;
|
|
|
|
|
|
procedure ModificarInterno; override;
|
|
|
|
|
|
procedure EliminarInterno; override;
|
|
|
|
|
|
procedure DuplicarInterno; override;
|
|
|
|
|
|
procedure ImprimirInterno; override;
|
|
|
|
|
|
procedure PrevisualizarInterno; override;
|
|
|
|
|
|
|
|
|
|
|
|
//Si queremos crear otra vista para el editor heredado solo tendriamos que
|
|
|
|
|
|
//sobreescribir este metodo
|
|
|
|
|
|
procedure AsignarVista; virtual;
|
|
|
|
|
|
|
|
|
|
|
|
public
|
|
|
|
|
|
procedure PonerTitulos(const ATitulo: string = ''); override;
|
2007-11-05 17:49:11 +00:00
|
|
|
|
property Presupuestos: IBizPresupuestoCliente read GetPresupuestos write SetPresupuestos;
|
2007-10-26 18:19:55 +00:00
|
|
|
|
property Controller : IPresupuestosClienteController read GetController write SetController;
|
|
|
|
|
|
constructor Create(AOwner: TComponent); override;
|
|
|
|
|
|
destructor Destroy; override;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
|
|
|
|
|
|
uses
|
2007-11-18 15:07:51 +00:00
|
|
|
|
uDataModulePresupuestosCliente, uDataModuleUsuarios, uFactuGES_App,
|
2007-10-26 18:19:55 +00:00
|
|
|
|
// uBizAlbaranesCliente, uAlbaranesClienteController,
|
|
|
|
|
|
uEditorBase, uEditorDBBase, uDialogUtils,
|
|
|
|
|
|
// uFacturasClienteController, uBizFacturasCliente,
|
2008-05-30 16:56:23 +00:00
|
|
|
|
uGridStatusUtils, uDBSelectionListUtils;
|
2007-11-05 17:49:11 +00:00
|
|
|
|
// uGenerarPresupuestosProvUtils, uGenerarAlbaranesCliUtils;
|
2007-10-26 18:19:55 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
*************************** TfEditorPresupuestosCliente ***************************
|
|
|
|
|
|
}
|
|
|
|
|
|
procedure TfEditorPresupuestosCliente.actEliminarUpdate(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
if (Sender as TAction).Enabled then
|
2007-11-05 17:49:11 +00:00
|
|
|
|
(Sender as TAction).Enabled := (FPresupuestos.SITUACION = SITUACION_PRESUPUESTO_PENDIENTE);
|
2007-10-26 18:19:55 +00:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorPresupuestosCliente.actGenerarAlbaranCliExecute(Sender: TObject);
|
2008-05-20 18:50:02 +00:00
|
|
|
|
{var
|
|
|
|
|
|
IDAlbaranAux : Integer;}
|
2007-10-26 18:19:55 +00:00
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
2007-11-05 17:49:11 +00:00
|
|
|
|
// GenerarAlbaranCli(FPresupuestos.ID, IDAlbaranAux);
|
2007-10-26 18:19:55 +00:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorPresupuestosCliente.actGenerarExecute(Sender: TObject);
|
2008-05-20 18:50:02 +00:00
|
|
|
|
{var
|
|
|
|
|
|
Respuesta : Integer;}
|
2007-10-26 18:19:55 +00:00
|
|
|
|
begin
|
2007-11-19 19:13:37 +00:00
|
|
|
|
AppFactuGES.ShowCapado;
|
|
|
|
|
|
{
|
2007-10-26 18:19:55 +00:00
|
|
|
|
inherited;
|
|
|
|
|
|
|
|
|
|
|
|
Respuesta := JsGenerarDialog.Execute;
|
|
|
|
|
|
|
|
|
|
|
|
if Respuesta <> IDCANCEL then
|
|
|
|
|
|
begin
|
|
|
|
|
|
case JsGenerarDialog.CustomButtonResult of
|
2007-11-05 17:49:11 +00:00
|
|
|
|
200 : begin // Generar uno o m<>s Presupuestos a proveedor
|
|
|
|
|
|
// actGenerarPresupuestoProv.Execute;
|
2007-10-26 18:19:55 +00:00
|
|
|
|
end;
|
|
|
|
|
|
100 : begin // Albaran nuevo
|
|
|
|
|
|
actGenerarAlbaranCli.Execute;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
actRefrescar.Execute;
|
|
|
|
|
|
end;
|
2007-11-19 19:13:37 +00:00
|
|
|
|
}
|
2007-10-26 18:19:55 +00:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorPresupuestosCliente.actGenerarFacturaExecute(Sender: TObject);
|
|
|
|
|
|
{
|
|
|
|
|
|
var
|
|
|
|
|
|
AFacturasController : IFacturasClienteController;
|
|
|
|
|
|
AFactura : IBizFacturaCliente;
|
|
|
|
|
|
}
|
|
|
|
|
|
begin
|
|
|
|
|
|
{
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
AFacturasController := TFacturasClienteController.Create;
|
|
|
|
|
|
try
|
|
|
|
|
|
AFactura := AFacturasController.Nuevo;
|
2007-11-05 17:49:11 +00:00
|
|
|
|
if AFacturasController.Anadir(AFactura, FPresupuestos.ID) then
|
2007-10-26 18:19:55 +00:00
|
|
|
|
AFacturasController.Ver(AFactura);
|
|
|
|
|
|
actRefrescar.Execute;
|
|
|
|
|
|
finally
|
|
|
|
|
|
AFacturasController := NIL;
|
|
|
|
|
|
AFactura := NIL;
|
|
|
|
|
|
end;
|
|
|
|
|
|
}
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorPresupuestosCliente.actGenerarFacturaUpdate(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
(Sender as TAction).Enabled := HayDatos
|
|
|
|
|
|
and ViewGrid.esSeleccionCeldaDatos
|
2007-11-05 17:49:11 +00:00
|
|
|
|
and (FPresupuestos.SITUACION = SITUACION_PRESUPUESTO_PENDIENTE);
|
2007-10-26 18:19:55 +00:00
|
|
|
|
end;
|
|
|
|
|
|
|
2007-11-05 17:49:11 +00:00
|
|
|
|
procedure TfEditorPresupuestosCliente.actGenerarPresupuestoProvExecute(Sender: TObject);
|
2007-10-26 18:19:55 +00:00
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
2007-11-05 17:49:11 +00:00
|
|
|
|
// GenerarPresupuestosProv(FPresupuestos);
|
2007-10-26 18:19:55 +00:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorPresupuestosCliente.actGenerarUpdate(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
2008-01-04 17:21:05 +00:00
|
|
|
|
|
2007-10-26 18:19:55 +00:00
|
|
|
|
(Sender as TAction).Enabled := HayDatos and
|
|
|
|
|
|
not (ViewGrid.NumSeleccionados > 1) and
|
|
|
|
|
|
ViewGrid.esSeleccionCeldaDatos and
|
2007-11-05 17:49:11 +00:00
|
|
|
|
(FPresupuestos.SITUACION <> SITUACION_PRESUPUESTO_ANULADO);
|
2007-10-26 18:19:55 +00:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorPresupuestosCliente.AsignarVista;
|
|
|
|
|
|
begin
|
|
|
|
|
|
ViewGrid := CreateView(TfrViewPresupuestosCliente) as IViewPresupuestosCliente;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
constructor TfEditorPresupuestosCliente.Create(AOwner: TComponent);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
AsignarVista;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
destructor TfEditorPresupuestosCliente.Destroy;
|
|
|
|
|
|
begin
|
2007-11-05 17:49:11 +00:00
|
|
|
|
FPresupuestos := NIL;
|
2007-10-26 18:19:55 +00:00
|
|
|
|
FController := NIL;
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorPresupuestosCliente.DuplicarInterno;
|
|
|
|
|
|
var
|
2007-11-05 17:49:11 +00:00
|
|
|
|
APresupuesto : IBizPresupuestoCliente;
|
2007-10-26 18:19:55 +00:00
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
2007-11-05 17:49:11 +00:00
|
|
|
|
APresupuesto := FController.Duplicar(Presupuestos);
|
2007-10-26 18:19:55 +00:00
|
|
|
|
try
|
2007-11-05 17:49:11 +00:00
|
|
|
|
FController.Ver(APresupuesto);
|
2007-10-26 18:19:55 +00:00
|
|
|
|
finally
|
|
|
|
|
|
actRefrescar.Execute;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorPresupuestosCliente.EliminarInterno;
|
|
|
|
|
|
var
|
2007-11-05 17:49:11 +00:00
|
|
|
|
APresupuestos: IBizPresupuestoCliente;
|
2007-10-26 18:19:55 +00:00
|
|
|
|
AllItems: Boolean;
|
|
|
|
|
|
begin
|
2007-11-05 17:49:11 +00:00
|
|
|
|
APresupuestos := Nil;
|
2007-10-26 18:19:55 +00:00
|
|
|
|
AllItems := False;
|
|
|
|
|
|
|
|
|
|
|
|
if MultiSelect and Assigned(ViewGrid) then
|
|
|
|
|
|
AllItems := (ViewGrid.NumSeleccionados > 1);
|
|
|
|
|
|
|
|
|
|
|
|
if AllItems then
|
|
|
|
|
|
begin
|
2007-12-20 21:05:11 +00:00
|
|
|
|
if (Application.MessageBox('<27>Desea borrar los presupuestos seleccionados?', 'Atenci<63>n', MB_YESNO) = IDYES) then
|
2007-10-26 18:19:55 +00:00
|
|
|
|
begin
|
2007-11-05 17:49:11 +00:00
|
|
|
|
SeleccionarFilasDesdeGrid(ViewGrid._FocusedView, (Presupuestos as ISeleccionable).SelectedRecords);
|
|
|
|
|
|
APresupuestos := (Controller as IPresupuestosClienteController).ExtraerSeleccionados(Presupuestos) as IBizPresupuestoCliente;
|
2007-10-26 18:19:55 +00:00
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
else begin
|
2007-12-20 21:05:11 +00:00
|
|
|
|
if (Application.MessageBox('<27>Desea borrar el presupuesto seleccionado?', 'Atenci<63>n', MB_YESNO) = IDYES) then
|
2007-11-05 17:49:11 +00:00
|
|
|
|
APresupuestos := Presupuestos;
|
2007-10-26 18:19:55 +00:00
|
|
|
|
end;
|
|
|
|
|
|
|
2007-11-05 17:49:11 +00:00
|
|
|
|
if Assigned(APresupuestos) then
|
2007-10-26 18:19:55 +00:00
|
|
|
|
begin
|
2007-11-05 17:49:11 +00:00
|
|
|
|
FController.Eliminar(APresupuestos, AllItems);
|
2007-10-26 18:19:55 +00:00
|
|
|
|
if AllItems then
|
|
|
|
|
|
begin
|
2007-11-05 17:49:11 +00:00
|
|
|
|
if (APresupuestos.DataTable.RecordCount > 0) then
|
2007-10-26 18:19:55 +00:00
|
|
|
|
begin
|
2007-11-05 17:49:11 +00:00
|
|
|
|
with APresupuestos.DataTable do
|
2007-10-26 18:19:55 +00:00
|
|
|
|
begin
|
|
|
|
|
|
First;
|
|
|
|
|
|
while not EOF do
|
|
|
|
|
|
begin
|
2007-11-05 17:49:11 +00:00
|
|
|
|
// JsListaPresupuestosNoEliminados.Content.Add('Ref. Presupuesto: ' + APresupuestos.REFERENCIA + ' ' + APresupuestos.NOMBRE);
|
2007-10-26 18:19:55 +00:00
|
|
|
|
Next;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
2007-11-05 17:49:11 +00:00
|
|
|
|
JsListaPresupuestosNoEliminados.Execute;
|
2007-10-26 18:19:55 +00:00
|
|
|
|
end;
|
|
|
|
|
|
actRefrescar.Execute;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
ViewGrid.GotoFirst;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorPresupuestosCliente.FormShow(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
|
|
|
|
|
|
if not Assigned(ViewGrid) then
|
|
|
|
|
|
raise Exception.Create('No hay ninguna vista asignada');
|
|
|
|
|
|
|
2007-11-05 17:49:11 +00:00
|
|
|
|
if not Assigned(Presupuestos) then
|
|
|
|
|
|
raise Exception.Create('No hay ning<6E>n Presupuesto asignado');
|
2007-10-26 18:19:55 +00:00
|
|
|
|
|
2007-11-05 17:49:11 +00:00
|
|
|
|
Presupuestos.DataTable.Active := True;
|
2007-10-26 18:19:55 +00:00
|
|
|
|
ViewGrid.GotoFirst;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
function TfEditorPresupuestosCliente.GetController: IPresupuestosClienteController;
|
|
|
|
|
|
begin
|
|
|
|
|
|
Result := FController;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2007-11-05 17:49:11 +00:00
|
|
|
|
function TfEditorPresupuestosCliente.GetPresupuestos: IBizPresupuestoCliente;
|
2007-10-26 18:19:55 +00:00
|
|
|
|
begin
|
2007-11-05 17:49:11 +00:00
|
|
|
|
Result := FPresupuestos;
|
2007-10-26 18:19:55 +00:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorPresupuestosCliente.ImprimirInterno;
|
|
|
|
|
|
var
|
|
|
|
|
|
Respuesta : Integer;
|
2007-11-05 17:49:11 +00:00
|
|
|
|
APresupuestos: IBizPresupuestoCliente;
|
2007-10-26 18:19:55 +00:00
|
|
|
|
AllItems: Boolean;
|
|
|
|
|
|
begin
|
2007-11-05 17:49:11 +00:00
|
|
|
|
APresupuestos := Nil;
|
2007-10-26 18:19:55 +00:00
|
|
|
|
AllItems := False;
|
|
|
|
|
|
|
|
|
|
|
|
if MultiSelect and Assigned(ViewGrid) then
|
|
|
|
|
|
AllItems := (ViewGrid.NumSeleccionados > 1);
|
|
|
|
|
|
|
|
|
|
|
|
//Si esta agrupado solo podr<64> imprimir la lista de elementos visibles
|
|
|
|
|
|
if not ViewGrid.esSeleccionCeldaDatos then
|
|
|
|
|
|
inherited
|
|
|
|
|
|
else
|
|
|
|
|
|
begin
|
|
|
|
|
|
Respuesta := JsImprimirDialog.Execute;
|
|
|
|
|
|
if Respuesta <> IDCANCEL then
|
|
|
|
|
|
begin
|
|
|
|
|
|
case JsImprimirDialog.CustomButtonResult of
|
|
|
|
|
|
200 : begin // Lista de elementos visibles
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
end;
|
|
|
|
|
|
100 : begin // Elemento Seleccionado
|
|
|
|
|
|
if AllItems then
|
|
|
|
|
|
begin
|
2007-11-05 17:49:11 +00:00
|
|
|
|
SeleccionarFilasDesdeGrid(ViewGrid._FocusedView, (Presupuestos as ISeleccionable).SelectedRecords);
|
|
|
|
|
|
APresupuestos := (Controller as IPresupuestosClienteController).ExtraerSeleccionados(Presupuestos) as IBizPresupuestoCliente;
|
2007-10-26 18:19:55 +00:00
|
|
|
|
end
|
|
|
|
|
|
else
|
2007-11-05 17:49:11 +00:00
|
|
|
|
APresupuestos := Presupuestos;
|
2007-10-26 18:19:55 +00:00
|
|
|
|
|
2007-11-05 17:49:11 +00:00
|
|
|
|
if Assigned(APresupuestos) then
|
|
|
|
|
|
FController.Print(APresupuestos, AllItems);
|
2007-10-26 18:19:55 +00:00
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorPresupuestosCliente.ModificarInterno;
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
2007-11-05 17:49:11 +00:00
|
|
|
|
FController.Ver(Presupuestos);
|
2007-10-26 18:19:55 +00:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorPresupuestosCliente.NuevoInterno;
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
2007-11-05 17:49:11 +00:00
|
|
|
|
if FController.Anadir(Presupuestos) then
|
|
|
|
|
|
FController.Ver(Presupuestos);
|
2007-10-26 18:19:55 +00:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorPresupuestosCliente.PonerTitulos(const ATitulo: string);
|
|
|
|
|
|
var
|
|
|
|
|
|
FTitulo : String;
|
|
|
|
|
|
begin
|
2007-11-18 15:07:51 +00:00
|
|
|
|
FTitulo := 'Lista de presupuestos de cliente - ' + AppFactuGES.EmpresaActiva.NOMBRE;
|
2007-10-26 18:19:55 +00:00
|
|
|
|
inherited PonerTitulos(FTitulo);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorPresupuestosCliente.PrevisualizarInterno;
|
|
|
|
|
|
var
|
|
|
|
|
|
Respuesta : Integer;
|
2007-11-05 17:49:11 +00:00
|
|
|
|
APresupuestos: IBizPresupuestoCliente;
|
2007-10-26 18:19:55 +00:00
|
|
|
|
AllItems: Boolean;
|
|
|
|
|
|
begin
|
2007-11-05 17:49:11 +00:00
|
|
|
|
APresupuestos := Nil;
|
2007-10-26 18:19:55 +00:00
|
|
|
|
AllItems := False;
|
|
|
|
|
|
|
|
|
|
|
|
if MultiSelect and Assigned(ViewGrid) then
|
|
|
|
|
|
AllItems := (ViewGrid.NumSeleccionados > 1);
|
|
|
|
|
|
|
|
|
|
|
|
//Si esta agrupado solo podr<64> imprimir la lista de elementos visibles
|
|
|
|
|
|
if not ViewGrid.esSeleccionCeldaDatos then
|
|
|
|
|
|
inherited
|
|
|
|
|
|
else
|
|
|
|
|
|
begin
|
|
|
|
|
|
Respuesta := JsPrevisualizarDialog.Execute;
|
|
|
|
|
|
if Respuesta <> IDCANCEL then
|
|
|
|
|
|
begin
|
|
|
|
|
|
case JsPrevisualizarDialog.CustomButtonResult of
|
|
|
|
|
|
200 : begin // Lista de elementos visibles
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
end;
|
|
|
|
|
|
100 : begin // Elemento Seleccionado
|
|
|
|
|
|
if AllItems then
|
|
|
|
|
|
begin
|
2007-11-05 17:49:11 +00:00
|
|
|
|
SeleccionarFilasDesdeGrid(ViewGrid._FocusedView, (Presupuestos as ISeleccionable).SelectedRecords);
|
|
|
|
|
|
APresupuestos := (Controller as IPresupuestosClienteController).ExtraerSeleccionados(Presupuestos) as IBizPresupuestoCliente;
|
2007-10-26 18:19:55 +00:00
|
|
|
|
end
|
|
|
|
|
|
else
|
2007-11-05 17:49:11 +00:00
|
|
|
|
APresupuestos := Presupuestos;
|
2007-10-26 18:19:55 +00:00
|
|
|
|
|
2007-11-05 17:49:11 +00:00
|
|
|
|
if Assigned(APresupuestos) then
|
|
|
|
|
|
FController.Preview(APresupuestos, AllItems);
|
2007-10-26 18:19:55 +00:00
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
2007-11-13 19:36:56 +00:00
|
|
|
|
APresupuestos := Nil;
|
2007-10-26 18:19:55 +00:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorPresupuestosCliente.SetController(const Value: IPresupuestosClienteController);
|
|
|
|
|
|
begin
|
|
|
|
|
|
FController := Value;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2007-11-05 17:49:11 +00:00
|
|
|
|
procedure TfEditorPresupuestosCliente.SetPresupuestos(const Value: IBizPresupuestoCliente);
|
2007-10-26 18:19:55 +00:00
|
|
|
|
begin
|
2007-11-05 17:49:11 +00:00
|
|
|
|
FPresupuestos := Value;
|
|
|
|
|
|
dsDataTable.DataTable := FPresupuestos.DataTable;
|
2007-10-26 18:19:55 +00:00
|
|
|
|
if Assigned(ViewGrid) then
|
2007-11-05 17:49:11 +00:00
|
|
|
|
(ViewGrid as IViewPresupuestosCliente).Presupuestos := Presupuestos;
|
2007-10-26 18:19:55 +00:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
end.
|