unit uEditorComerciales; 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, TBXExtItems, TBX, TB2Item, TB2Dock, TB2Toolbar, ExtCtrls, JvExControls, JvComponent, JvNavigationPane, uViewGridBase, uViewGrid, uViewContactos, uIEditorComerciales, pngimage, TBXStatusBars, JvExComCtrls, JvStatusBar, JSDialog, uContactosController, uDAInterfaces, uViewComerciales, uViewVendedores, dxGDIPlusClasses; type TfEditorComerciales = class(TfEditorContactos, IEditorComerciales) JsPrevisualizarDialog: TJSDialog; JsImprimirDialog: TJSDialog; JsListaContactosNoEliminados: TJSDialog; frViewComerciales1: TfrViewComerciales; 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, uComercialesController, uDBSelectionListUtils, uFactuGES_App; {$R *.dfm} constructor TfEditorComerciales.Create(AOwner: TComponent); begin inherited; ViewGrid := frViewComerciales1; end; procedure TfEditorComerciales.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('¿Desea borrar los comerciales seleccionados?', 'Atención', MB_YESNO) = IDYES) then begin SeleccionarFilasDesdeGrid(ViewGrid._FocusedView, (Contactos as ISeleccionable).SelectedRecords); AContactos := (Controller as IComercialesController).ExtraerSeleccionados(Contactos) as IBizContacto; end end else begin if (Application.MessageBox('¿Desea borrar el comercial seleccionado?', 'Atención', MB_YESNO) = IDYES) then AContactos := Contactos; end; if Assigned(AContactos) then begin (FController as IComercialesController).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('Comercial: ' + AContactos.NOMBRE); Next; end; end; JsListaContactosNoEliminados.Execute; end; actRefrescar.Execute; end; end; ViewGrid.GotoFirst; end; procedure TfEditorComerciales.ImprimirInterno; begin inherited; end; procedure TfEditorComerciales.PonerTitulos(const ATitulo: string); var FTitulo : String; begin FTitulo := 'Lista de comerciales - ' + AppFactuGES.EmpresaActiva.NOMBRE; inherited PonerTitulos(FTitulo); end; procedure TfEditorComerciales.PrevisualizarInterno; begin inherited; end; end.