git-svn-id: https://192.168.0.254/svn/Proyectos.Noviseda_FactuGES2/trunk@132 f33bb606-9f5c-448d-9c99-757f00063c96
152 lines
4.5 KiB
ObjectPascal
152 lines
4.5 KiB
ObjectPascal
unit uEditorVendedores;
|
||
|
||
interface
|
||
|
||
uses
|
||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||
uEditorContactos, Menus, DB, uDADataTable, JvAppStorage,
|
||
JvAppRegistryStorage, JvComponentBase, JvFormPlacement, ImgList, PngImageList,
|
||
StdActns, ActnList, uCustomView, uViewBase, uViewBarraSeleccion, ComCtrls,
|
||
TB2ExtItems, SpTBXItem, TB2Item, TB2Dock, TB2Toolbar, ExtCtrls,
|
||
JvExControls, JvComponent, JvNavigationPane, uViewGridBase, uViewGrid,
|
||
uViewContactos, uIEditorVendedores, pngimage,
|
||
JvExComCtrls, JvStatusBar, JSDialog, uContactosController, uDAInterfaces,
|
||
uViewVendedores, dxGDIPlusClasses, StdCtrls, TntStdCtrls, SpTBXEditors;
|
||
|
||
type
|
||
TfEditorVendedores = class(TfEditorContactos, IEditorVendedores)
|
||
frViewVendedores1: TfrViewVendedores;
|
||
JsPrevisualizarDialog: TJSDialog;
|
||
JsImprimirDialog: TJSDialog;
|
||
JsListaContactosNoEliminados: TJSDialog;
|
||
SpTBXSubmenuItem1: TSpTBXSubmenuItem;
|
||
SpTBXItem2: TSpTBXItem;
|
||
actDocumentosPedidos: TAction;
|
||
ActClientes: TAction;
|
||
SpTBXItem3: TSpTBXItem;
|
||
procedure actDocumentosPedidosExecute(Sender: TObject);
|
||
procedure actDocumentosPedidosUpdate(Sender: TObject);
|
||
procedure ActClientesExecute(Sender: TObject);
|
||
procedure ActClientesUpdate(Sender: TObject);
|
||
|
||
protected
|
||
procedure EliminarInterno; override;
|
||
procedure ImprimirInterno; override;
|
||
procedure PrevisualizarInterno; override;
|
||
|
||
public
|
||
constructor Create(AOwner: TComponent); override;
|
||
procedure PonerTitulos(const ATitulo: string = ''); override;
|
||
end;
|
||
|
||
implementation
|
||
|
||
uses
|
||
uGridUtils, uEditorGridBase, uDataModuleUsuarios, uDialogUtils, uBizContactos,
|
||
uVendedoresController, uDBSelectionListUtils, uFactuGES_App;
|
||
|
||
{$R *.dfm}
|
||
|
||
procedure TfEditorVendedores.ActClientesExecute(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
(FController as IVendedoresController).VerClientesDeVendedor(IBizVendedor(FContactos));
|
||
end;
|
||
|
||
procedure TfEditorVendedores.ActClientesUpdate(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
(Sender as TAction).Enabled := HayDatos
|
||
and not ViewGrid.IsEmpty
|
||
and ViewGrid.EsSeleccionCeldaDatos
|
||
end;
|
||
|
||
procedure TfEditorVendedores.actDocumentosPedidosExecute(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
(FController as IVendedoresController).VerPedidosDeVendedor(IBizVendedor(FContactos));
|
||
end;
|
||
|
||
procedure TfEditorVendedores.actDocumentosPedidosUpdate(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
(Sender as TAction).Enabled := HayDatos
|
||
and not ViewGrid.IsEmpty
|
||
and ViewGrid.EsSeleccionCeldaDatos
|
||
end;
|
||
|
||
constructor TfEditorVendedores.Create(AOwner: TComponent);
|
||
begin
|
||
inherited;
|
||
ViewGrid := frViewVendedores1;
|
||
end;
|
||
|
||
procedure TfEditorVendedores.EliminarInterno;
|
||
var
|
||
AContactos: IBizContacto;
|
||
AllItems: Boolean;
|
||
begin
|
||
AContactos := Nil;
|
||
AllItems := False;
|
||
|
||
if MultiSelect and Assigned(ViewGrid) then
|
||
AllItems := (ViewGrid.NumSeleccionados > 1);
|
||
|
||
if AllItems then
|
||
begin
|
||
if (Application.MessageBox('<27>Desea borrar los vendedores seleccionados?', 'Atenci<63>n', MB_YESNO) = IDYES) then
|
||
begin
|
||
SeleccionarFilasDesdeGrid(ViewGrid._FocusedView, (Contactos as ISeleccionable).SelectedRecords);
|
||
AContactos := (Controller as IVendedoresController).ExtraerSeleccionados(Contactos) as IBizContacto;
|
||
end
|
||
end
|
||
else begin
|
||
if (Application.MessageBox('<27>Desea borrar el vendedor seleccionado?', 'Atenci<63>n', MB_YESNO) = IDYES) then
|
||
AContactos := Contactos;
|
||
end;
|
||
|
||
if Assigned(AContactos) then
|
||
begin
|
||
(FController as IVendedoresController).Eliminar(AContactos, AllItems);
|
||
if AllItems then
|
||
begin
|
||
if (AContactos.DataTable.RecordCount > 0) then
|
||
begin
|
||
with AContactos.DataTable do
|
||
begin
|
||
First;
|
||
while not EOF do
|
||
begin
|
||
JsListaContactosNoEliminados.Content.Add('Vendedor: ' + AContactos.NOMBRE);
|
||
Next;
|
||
end;
|
||
end;
|
||
JsListaContactosNoEliminados.Execute;
|
||
end;
|
||
actRefrescar.Execute;
|
||
end;
|
||
end;
|
||
|
||
ViewGrid.GotoFirst;
|
||
end;
|
||
|
||
procedure TfEditorVendedores.ImprimirInterno;
|
||
begin
|
||
inherited;
|
||
end;
|
||
|
||
procedure TfEditorVendedores.PonerTitulos(const ATitulo: string);
|
||
var
|
||
FTitulo : String;
|
||
begin
|
||
FTitulo := 'Lista de vendedores - ' + AppFactuGES.EmpresaActiva.NOMBRE;
|
||
inherited PonerTitulos(FTitulo);
|
||
end;
|
||
|
||
procedure TfEditorVendedores.PrevisualizarInterno;
|
||
begin
|
||
inherited;
|
||
end;
|
||
|
||
end.
|