147 lines
4.0 KiB
ObjectPascal
147 lines
4.0 KiB
ObjectPascal
|
|
unit uEditorPedidosCliente;
|
|||
|
|
|
|||
|
|
interface
|
|||
|
|
|
|||
|
|
uses
|
|||
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|||
|
|
Dialogs, 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,
|
|||
|
|
uBizPedidosCliente, uIEditorPedidosCliente, uPedidosClienteController,
|
|||
|
|
uCustomView, uViewBase, uViewBarraSeleccion, uViewGridBase,
|
|||
|
|
uViewPedidosCliente, JvExComCtrls, JvStatusBar;
|
|||
|
|
|
|||
|
|
type
|
|||
|
|
TfEditorPedidosCliente = class(TfEditorGridBase, IEditorPedidosCliente)
|
|||
|
|
frViewPedidosCliente1: TfrViewPedidosCliente;
|
|||
|
|
procedure FormShow(Sender: TObject);
|
|||
|
|
|
|||
|
|
protected
|
|||
|
|
FPedidos: IBizPedidoCliente;
|
|||
|
|
FController : IPedidosClienteController;
|
|||
|
|
|
|||
|
|
function GetPedidos: IBizPedidoCliente;
|
|||
|
|
procedure SetPedidos(const Value: IBizPedidoCliente);
|
|||
|
|
|
|||
|
|
function GetController : IPedidosClienteController; virtual;
|
|||
|
|
procedure SetController (const Value : IPedidosClienteController); virtual;
|
|||
|
|
procedure NuevoInterno; override;
|
|||
|
|
procedure ModificarInterno; override;
|
|||
|
|
procedure EliminarInterno; override;
|
|||
|
|
procedure DuplicarInterno; override;
|
|||
|
|
public
|
|||
|
|
procedure PonerTitulos(const ATitulo: string = ''); override;
|
|||
|
|
property Pedidos: IBizPedidoCliente read GetPedidos write SetPedidos;
|
|||
|
|
property Controller : IPedidosClienteController read GetController write SetController;
|
|||
|
|
constructor Create(AOwner: TComponent); override;
|
|||
|
|
destructor Destroy; override;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
implementation
|
|||
|
|
|
|||
|
|
uses
|
|||
|
|
uDataModulePedidosCliente, uDataModuleUsuarios;
|
|||
|
|
|
|||
|
|
{$R *.dfm}
|
|||
|
|
|
|||
|
|
{
|
|||
|
|
*************************** TfEditorPedidosCliente ***************************
|
|||
|
|
}
|
|||
|
|
constructor TfEditorPedidosCliente.Create(AOwner: TComponent);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
ViewGrid := frViewPedidosCliente1; //CreateView(TfrViewPedidosCliente) as IViewPedidosCliente;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
destructor TfEditorPedidosCliente.Destroy;
|
|||
|
|
begin
|
|||
|
|
FPedidos := NIL;
|
|||
|
|
FController := NIL;
|
|||
|
|
inherited;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfEditorPedidosCliente.DuplicarInterno;
|
|||
|
|
var
|
|||
|
|
APedido : IBizPedidoCliente;
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
APedido := FController.Duplicar(Pedidos);
|
|||
|
|
try
|
|||
|
|
FController.Ver(APedido);
|
|||
|
|
finally
|
|||
|
|
actRefrescar.Execute;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfEditorPedidosCliente.EliminarInterno;
|
|||
|
|
begin
|
|||
|
|
if (Application.MessageBox('<27>Desea borrar esta factura de cliente?', 'Atenci<63>n', MB_YESNO) = IDYES) then
|
|||
|
|
begin
|
|||
|
|
FController.Eliminar(Pedidos);
|
|||
|
|
inherited;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfEditorPedidosCliente.FormShow(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
|
|||
|
|
if not Assigned(ViewGrid) then
|
|||
|
|
raise Exception.Create('No hay ninguna vista asignada');
|
|||
|
|
|
|||
|
|
if not Assigned(Pedidos) then
|
|||
|
|
raise Exception.Create('No hay ning<6E>n presupuesto asignado');
|
|||
|
|
|
|||
|
|
Pedidos.DataTable.Active := True;
|
|||
|
|
ViewGrid.GotoFirst;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
function TfEditorPedidosCliente.GetController: IPedidosClienteController;
|
|||
|
|
begin
|
|||
|
|
Result := FController;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
function TfEditorPedidosCliente.GetPedidos: IBizPedidoCliente;
|
|||
|
|
begin
|
|||
|
|
Result := FPedidos;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfEditorPedidosCliente.ModificarInterno;
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
FController.Ver(Pedidos);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfEditorPedidosCliente.NuevoInterno;
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
FController.Anadir(Pedidos);
|
|||
|
|
FController.Ver(Pedidos);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfEditorPedidosCliente.PonerTitulos(const ATitulo: string);
|
|||
|
|
var
|
|||
|
|
FTitulo : String;
|
|||
|
|
begin
|
|||
|
|
FTitulo := 'Lista de pedidos a Cliente - ' + dmUsuarios.EmpresaActual.NOMBRE;
|
|||
|
|
inherited PonerTitulos(FTitulo);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfEditorPedidosCliente.SetController(const Value: IPedidosClienteController);
|
|||
|
|
begin
|
|||
|
|
FController := Value;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfEditorPedidosCliente.SetPedidos(const Value: IBizPedidoCliente);
|
|||
|
|
begin
|
|||
|
|
FPedidos := Value;
|
|||
|
|
dsDataTable.DataTable := FPedidos.DataTable;
|
|||
|
|
if Assigned(ViewGrid) then
|
|||
|
|
(ViewGrid as IViewPedidosCliente).Pedidos := Pedidos;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end.
|