2008-05-28 17:19:09 +00:00
|
|
|
|
unit uEditorDetallesSinRecibir;
|
|
|
|
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
|
|
|
|
|
|
|
uses
|
|
|
|
|
|
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
|
|
|
|
|
|
uCustomEditor, ImgList, PngImageList, StdActns, ActnList, TB2ExtItems, TBXExtItems, TBX, TB2Item,
|
|
|
|
|
|
TB2Dock, TB2Toolbar, JvExControls, JvComponent, JvNavigationPane,
|
|
|
|
|
|
uViewDetallesSinRecibir, Menus, DB, uDADataTable, ComCtrls, uViewGrid,
|
|
|
|
|
|
uDAScriptingProvider, uDACDSDataTable, JvAppStorage,
|
|
|
|
|
|
JvAppRegistryStorage, JvFormPlacement, pngimage, ExtCtrls, uCustomView,
|
|
|
|
|
|
uViewBase, uViewBarraSeleccion, JvComponentBase, uEditorGridBase,
|
|
|
|
|
|
uIEditorDetallesSinRecibir, uBizInventario, uViewGridBase,
|
2008-05-29 13:58:49 +00:00
|
|
|
|
JvExComCtrls, JvStatusBar, uViewGrid2Niveles, JSDialog, uInventarioController,
|
|
|
|
|
|
uBizAlmacenes;
|
2008-05-28 17:19:09 +00:00
|
|
|
|
|
|
|
|
|
|
type
|
|
|
|
|
|
|
|
|
|
|
|
TfEditorDetallesSinRecibir = class(TfEditorGridBase, IEditorDetallesSinRecibir)
|
|
|
|
|
|
TBXSeparatorItem17: TTBXSeparatorItem;
|
|
|
|
|
|
actExpandir: TAction;
|
|
|
|
|
|
actContraer: TAction;
|
|
|
|
|
|
frViewDetallesSinRecibir1: TfrViewDetallesSinRecibir;
|
|
|
|
|
|
TBXItem38: TTBXItem;
|
|
|
|
|
|
actRecibir: TAction;
|
2008-05-29 13:58:49 +00:00
|
|
|
|
JvNavPanelHeader1: TJvNavPanelHeader;
|
2008-05-28 17:19:09 +00:00
|
|
|
|
|
|
|
|
|
|
procedure FormShow(Sender: TObject);
|
|
|
|
|
|
procedure actRecibirExecute(Sender: TObject);
|
|
|
|
|
|
|
|
|
|
|
|
private
|
2008-05-29 13:58:49 +00:00
|
|
|
|
FAlmacen: IBizAlmacen;
|
|
|
|
|
|
function GetAlmacen: Integer;
|
|
|
|
|
|
procedure SetAlmacen(const Value: Integer);
|
2008-05-28 17:19:09 +00:00
|
|
|
|
|
|
|
|
|
|
protected
|
|
|
|
|
|
// FArticulo: IBizInventario;
|
|
|
|
|
|
FDetalles: IBizDetalleSinRecibir;
|
|
|
|
|
|
FController : IInventarioController;
|
|
|
|
|
|
|
|
|
|
|
|
// function GetArticulo: IBizInventario;
|
|
|
|
|
|
// procedure SetArticulo(const Value: IBizInventario);
|
|
|
|
|
|
function GetDetalles: IBizDetalleSinRecibir;
|
|
|
|
|
|
procedure SetDetalles(const Value: IBizDetalleSinRecibir);
|
|
|
|
|
|
|
|
|
|
|
|
{ procedure SetMultiSelect (AValue : Boolean);
|
|
|
|
|
|
function GetMultiSelect : Boolean;
|
|
|
|
|
|
function GetArticulosSeleccionados: IBizDetallesSinRecibir;
|
|
|
|
|
|
}
|
|
|
|
|
|
function GetController : IInventarioController;
|
|
|
|
|
|
procedure SetController (const Value : IInventarioController);
|
|
|
|
|
|
|
|
|
|
|
|
procedure ImprimirInterno; override;
|
|
|
|
|
|
procedure PrevisualizarInterno; override;
|
|
|
|
|
|
|
|
|
|
|
|
public
|
2008-05-29 13:58:49 +00:00
|
|
|
|
property Almacen: Integer read GetAlmacen write SetAlmacen;
|
2008-05-28 17:19:09 +00:00
|
|
|
|
property DetallesSinRecibir: IBizDetalleSinRecibir read GetDetalles write SetDetalles;
|
|
|
|
|
|
property Controller : IInventarioController read GetController write SetController;
|
|
|
|
|
|
|
|
|
|
|
|
// property ArticulosSeleccionados: IBizDetallesSinRecibir read GetArticulosSeleccionados;
|
|
|
|
|
|
// property MultiSelect : Boolean read GetMultiSelect write SetMultiSelect;
|
|
|
|
|
|
|
|
|
|
|
|
constructor Create(AOwner: TComponent); override;
|
|
|
|
|
|
destructor Destroy; override;
|
|
|
|
|
|
procedure PonerTitulos(const ATitulo: string = ''); override;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
{$R *.DFM}
|
|
|
|
|
|
|
|
|
|
|
|
uses
|
|
|
|
|
|
cxControls, uGridUtils, uDataModuleInventario, uDataModuleUsuarios,
|
|
|
|
|
|
uEditorBase, uDBSelectionListUtils, cxGridDBTableView, cxGridCustomTableView,
|
2008-05-29 13:58:49 +00:00
|
|
|
|
uAlmacenesController, uGenerarAlbaranesProvUtils,
|
2008-05-28 17:19:09 +00:00
|
|
|
|
schInventarioClient_Intf, uDialogUtils, uBizAlbaranesProveedor;
|
|
|
|
|
|
|
|
|
|
|
|
{, uDBSelectionList, uDataModulePedidosProveedor,
|
|
|
|
|
|
uBizPedidosProveedor, uBizMontajes, uDataModuleMontajes;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{ TfEditorDetallesSinRecibir }
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
***************************** TfEditorDetallesSinRecibir *****************************
|
|
|
|
|
|
}
|
|
|
|
|
|
procedure TfEditorDetallesSinRecibir.actRecibirExecute(Sender: TObject);
|
|
|
|
|
|
var
|
|
|
|
|
|
ArticulosSeleccionados: IBizDetalleSinRecibir;
|
|
|
|
|
|
AlbaranesProveedor: IBizAlbaranProveedor;
|
|
|
|
|
|
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
try
|
|
|
|
|
|
SeleccionarFilasDesdeGrid(ViewGrid._FocusedView, (DetallesSinRecibir as ISeleccionable).SelectedRecords);
|
|
|
|
|
|
// En SelectedRecords tengo los ID de las filas seleccionadas del grid
|
|
|
|
|
|
ArticulosSeleccionados := (Controller as IInventarioController).ExtraerSeleccionados(DetallesSinRecibir) as IBizDetalleSinRecibir;
|
|
|
|
|
|
|
|
|
|
|
|
if (ArticulosSeleccionados.DataTable.RecordCount > 0) then
|
2008-05-29 13:58:49 +00:00
|
|
|
|
begin
|
|
|
|
|
|
GenerarAlbaranesProv(ArticulosSeleccionados, AlbaranesProveedor, Almacen);
|
|
|
|
|
|
RefrescarInterno;
|
|
|
|
|
|
end
|
2008-05-28 17:19:09 +00:00
|
|
|
|
else
|
|
|
|
|
|
ShowWarningMessage('Debe seleccionar los art<72>culos que desea recibir');
|
|
|
|
|
|
|
|
|
|
|
|
finally
|
|
|
|
|
|
ArticulosSeleccionados:= Nil;
|
|
|
|
|
|
AlbaranesProveedor:= Nil;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
constructor TfEditorDetallesSinRecibir.Create(AOwner: TComponent);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
2008-05-29 13:58:49 +00:00
|
|
|
|
FAlmacen := Nil;
|
2008-05-28 17:19:09 +00:00
|
|
|
|
ViewGrid := frViewDetallesSinRecibir1;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
function TfEditorDetallesSinRecibir.DarIDAlmacenSeleccionado(Descripcion: String): Integer;
|
|
|
|
|
|
var
|
|
|
|
|
|
AAlmacenes : IBizAlmacen;
|
|
|
|
|
|
AAlmacenesController : IAlmacenesController;
|
|
|
|
|
|
Respuesta : integer;
|
|
|
|
|
|
begin
|
|
|
|
|
|
if (ViewGrid._Grid.ActiveLevel.Tag = -1) then
|
|
|
|
|
|
Result := SeleccionarAlmacen(Descripcion)
|
|
|
|
|
|
else
|
|
|
|
|
|
Result := ViewGrid._Grid.ActiveLevel.Tag;
|
|
|
|
|
|
end;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
destructor TfEditorDetallesSinRecibir.Destroy;
|
|
|
|
|
|
begin
|
|
|
|
|
|
FDetalles := NIL;
|
2008-05-29 13:58:49 +00:00
|
|
|
|
FAlmacen := NIL;
|
2008-05-28 17:19:09 +00:00
|
|
|
|
inherited;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorDetallesSinRecibir.FormShow(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
|
|
|
|
|
|
if not Assigned(ViewGrid) then
|
|
|
|
|
|
raise Exception.Create('No hay ninguna vista asignada');
|
|
|
|
|
|
|
|
|
|
|
|
if not Assigned(DetallesSinRecibir) then
|
|
|
|
|
|
raise Exception.Create('No hay ning<6E>n DetallesSinRecibir asignado');
|
|
|
|
|
|
|
|
|
|
|
|
DetallesSinRecibir.DataTable.Active := True;
|
|
|
|
|
|
ViewGrid.GotoFirst;
|
|
|
|
|
|
end;
|
|
|
|
|
|
{
|
|
|
|
|
|
function TfEditorDetallesSinRecibir.GetArticulosSeleccionados: IBizDetallesSinRecibir;
|
|
|
|
|
|
begin
|
|
|
|
|
|
SeleccionarFilasDesdeGrid((ViewGrid as IViewDetallesSinRecibir)._FocusedView, (DetallesSinRecibir as ISeleccionable).SelectedRecords);
|
|
|
|
|
|
// En Presupuestos.SelectedRecords tengo los ID de las filas seleccionadas del grid
|
|
|
|
|
|
Result := Controller.ExtraerSeleccionados(DetallesSinRecibir);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
function TfEditorDetallesSinRecibir.GetController: IDetallesSinRecibirController;
|
|
|
|
|
|
begin
|
|
|
|
|
|
Result := FController;
|
|
|
|
|
|
end;
|
|
|
|
|
|
}
|
|
|
|
|
|
{
|
|
|
|
|
|
function TfEditorDetallesSinRecibir.GetArticulo: IBizInventario;
|
|
|
|
|
|
begin
|
|
|
|
|
|
Result := FArticulo;
|
|
|
|
|
|
end;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2008-05-29 13:58:49 +00:00
|
|
|
|
function TfEditorDetallesSinRecibir.GetAlmacen: Integer;
|
|
|
|
|
|
begin
|
|
|
|
|
|
if Assigned(FAlmacen) then
|
|
|
|
|
|
Result := FAlmacen.ID
|
|
|
|
|
|
else
|
|
|
|
|
|
Result := -1;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2008-05-28 17:19:09 +00:00
|
|
|
|
function TfEditorDetallesSinRecibir.GetController: IInventarioController;
|
|
|
|
|
|
begin
|
|
|
|
|
|
Result := FController;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
function TfEditorDetallesSinRecibir.GetDetalles: IBizDetalleSinRecibir;
|
|
|
|
|
|
begin
|
|
|
|
|
|
Result := FDetalles;
|
|
|
|
|
|
end;
|
|
|
|
|
|
{
|
|
|
|
|
|
function TfEditorDetallesSinRecibir.GetMultiSelect: Boolean;
|
|
|
|
|
|
begin
|
|
|
|
|
|
Result := ViewGrid.MultiSelect;
|
|
|
|
|
|
end;
|
|
|
|
|
|
}
|
|
|
|
|
|
procedure TfEditorDetallesSinRecibir.ImprimirInterno;
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorDetallesSinRecibir.PonerTitulos(const ATitulo: string);
|
|
|
|
|
|
var
|
|
|
|
|
|
FTitulo : String;
|
|
|
|
|
|
begin
|
|
|
|
|
|
FTitulo := 'Detalle de art<72>culos sin recibir - ' + dmUsuarios.EmpresaActual.NOMBRE;
|
|
|
|
|
|
inherited PonerTitulos(FTitulo);
|
2008-05-29 13:58:49 +00:00
|
|
|
|
JvNavPanelHeader1.Caption := 'Almac<61>n de entrada: ' + FAlmacen.NOMBRE;
|
2008-05-28 17:19:09 +00:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorDetallesSinRecibir.PrevisualizarInterno;
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
end;
|
|
|
|
|
|
{
|
|
|
|
|
|
function TfEditorDetallesSinRecibir.SeleccionarAlmacen(Descripcion: String): Integer;
|
|
|
|
|
|
var
|
|
|
|
|
|
AAlmacenes : IBizAlmacen;
|
|
|
|
|
|
Respuesta : integer;
|
|
|
|
|
|
begin
|
|
|
|
|
|
Result := -1;
|
|
|
|
|
|
{
|
|
|
|
|
|
JsElegirAlmacenDialog.Instruction.Text := Descripcion;
|
|
|
|
|
|
with JsElegirAlmacenDialog.RadioButtons do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Clear;
|
|
|
|
|
|
AAlmacenes := (ViewGrid as IViewDetallesSinRecibir).Almacenes;
|
|
|
|
|
|
AAlmacenes.First;
|
|
|
|
|
|
while not AAlmacenes.EOF do
|
|
|
|
|
|
begin
|
|
|
|
|
|
with Add do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Caption := AAlmacenes.NOMBRE;
|
|
|
|
|
|
Value := 1000 + AAlmacenes.ID;
|
|
|
|
|
|
end;
|
|
|
|
|
|
//Asi sabemos que solo va a intentar chequear el primero si hemos a<>adido al menos un item
|
|
|
|
|
|
Items[0].Checked := True;
|
|
|
|
|
|
AAlmacenes.Next;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
//Sacar la pantalla de selecci<63>n y devolver el almac<61>n seleccionado.
|
|
|
|
|
|
Respuesta := JsElegirAlmacenDialog.Execute;
|
|
|
|
|
|
if Respuesta <> IDCANCEL then
|
|
|
|
|
|
Result := JsElegirAlmacenDialog.RadioResult - 1000;
|
|
|
|
|
|
end;
|
|
|
|
|
|
}
|
|
|
|
|
|
{
|
|
|
|
|
|
procedure TfEditorDetallesSinRecibir.SetController(const Value: IDetallesSinRecibirController);
|
|
|
|
|
|
begin
|
|
|
|
|
|
FController := Value;
|
|
|
|
|
|
|
|
|
|
|
|
if Assigned(FController) then
|
|
|
|
|
|
begin
|
|
|
|
|
|
if Assigned(ViewGrid) then
|
|
|
|
|
|
(ViewGrid as IViewDetallesSinRecibir).Almacenes := FController.AlmacenesController.BuscarTodos;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
}
|
|
|
|
|
|
{
|
|
|
|
|
|
procedure TfEditorDetallesSinRecibir.SetArticulo(const Value: IBizInventario);
|
|
|
|
|
|
begin
|
|
|
|
|
|
FArticulo := Value;
|
|
|
|
|
|
if Assigned(FArticulo) then
|
|
|
|
|
|
begin
|
|
|
|
|
|
tbxEditFiltro.Text := FArticulo.REFERENCIA;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
}
|
2008-05-29 13:58:49 +00:00
|
|
|
|
procedure TfEditorDetallesSinRecibir.SetAlmacen(const Value: Integer);
|
|
|
|
|
|
var
|
|
|
|
|
|
AAlmacenesController : IAlmacenesController;
|
|
|
|
|
|
begin
|
|
|
|
|
|
AAlmacenesController := TAlmacenesController.Create;
|
|
|
|
|
|
try
|
|
|
|
|
|
FAlmacen := AAlmacenesController.Buscar(Value);
|
|
|
|
|
|
FAlmacen.DataTable.Active := True;
|
|
|
|
|
|
finally
|
|
|
|
|
|
AAlmacenesController := NIL;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2008-05-28 17:19:09 +00:00
|
|
|
|
procedure TfEditorDetallesSinRecibir.SetController(const Value: IInventarioController);
|
|
|
|
|
|
begin
|
|
|
|
|
|
FController := Value;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorDetallesSinRecibir.SetDetalles(const Value: IBizDetalleSinRecibir);
|
|
|
|
|
|
begin
|
|
|
|
|
|
FDetalles := Value;
|
|
|
|
|
|
dsDataTable.DataTable := FDetalles.DataTable;
|
|
|
|
|
|
|
|
|
|
|
|
if Assigned(ViewGrid) then
|
|
|
|
|
|
(ViewGrid as IViewDetalleSinRecibir).Detalles := FDetalles;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
procedure TfEditorDetallesSinRecibir.SetMultiSelect(AValue: Boolean);
|
|
|
|
|
|
begin
|
|
|
|
|
|
ViewGrid.MultiSelect := AValue;
|
|
|
|
|
|
end;
|
|
|
|
|
|
}
|
|
|
|
|
|
end.
|
|
|
|
|
|
|