git-svn-id: https://192.168.0.254/svn/Proyectos.AbetoDesign_FactuGES/trunk@142 93f398dd-4eb6-7a46-baf6-13f46f578da2
224 lines
6.7 KiB
ObjectPascal
224 lines
6.7 KiB
ObjectPascal
unit uEditorProveedores;
|
||
|
||
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,
|
||
|
||
uIEditorProveedores, uViewGridBase, uViewGrid, uViewContactos, uViewProveedores,
|
||
pngimage, TBXStatusBars, JvExComCtrls, JvStatusBar, JSDialog, uDAInterfaces;
|
||
|
||
type
|
||
TfEditorProveedores = class(TfEditorContactos, IEditorProveedores)
|
||
frViewProveedores1: TfrViewProveedores;
|
||
JsPrevisualizarDialog: TJSDialog;
|
||
JsImprimirDialog: TJSDialog;
|
||
JsListaContactosNoEliminados: TJSDialog;
|
||
TBXItem38: TTBXItem;
|
||
actInformes: TAction;
|
||
JSInformesDialog: TJSDialog;
|
||
procedure actInformesExecute(Sender: TObject);
|
||
protected
|
||
procedure ImprimirInterno; override;
|
||
procedure PrevisualizarInterno; override;
|
||
procedure EliminarInterno; override;
|
||
public
|
||
constructor Create(AOwner: TComponent); override;
|
||
procedure PonerTitulos(const ATitulo: string = ''); override;
|
||
end;
|
||
|
||
implementation
|
||
|
||
uses
|
||
uGridUtils, uEditorGridBase, uDataModuleUsuarios, uDialogUtils, uBizContactos,
|
||
uDBSelectionListUtils, uProveedoresController, uFactuGES_App, uGestorInformesController;
|
||
|
||
{$R *.dfm}
|
||
|
||
{ TfEditorProveedores }
|
||
|
||
procedure TfEditorProveedores.actInformesExecute(Sender: TObject);
|
||
var
|
||
Respuesta : Integer;
|
||
AGestorInformesController : IGestorInformesController;
|
||
|
||
begin
|
||
AGestorInformesController := TGestorInformesController.Create;
|
||
try
|
||
|
||
Respuesta := JsInformesDialog.Execute;
|
||
|
||
if Respuesta <> IDCANCEL then
|
||
begin
|
||
case JsInformesDialog.CustomButtonResult of
|
||
400 : begin // Listado de facturas de cliente
|
||
AGestorInformesController.VerInformeListadoFacturasRecibosProv(Contactos.ID);
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
finally
|
||
AGestorInformesController := NIL;
|
||
end;
|
||
end;
|
||
|
||
constructor TfEditorProveedores.Create(AOwner: TComponent);
|
||
begin
|
||
inherited;
|
||
ViewGrid := frViewProveedores1;
|
||
end;
|
||
|
||
procedure TfEditorProveedores.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 proveedores seleccionados?', 'Atenci<63>n', MB_YESNO) = IDYES) then
|
||
begin
|
||
SeleccionarFilasDesdeGrid(ViewGrid._FocusedView, (Contactos as ISeleccionable).SelectedRecords);
|
||
AContactos := (Controller as IProveedoresController).ExtraerSeleccionados(Contactos) as IBizContacto;
|
||
end
|
||
end
|
||
else begin
|
||
if (Application.MessageBox('<27>Desea borrar el proveedor seleccionado?', 'Atenci<63>n', MB_YESNO) = IDYES) then
|
||
AContactos := Contactos;
|
||
end;
|
||
|
||
if Assigned(AContactos) then
|
||
begin
|
||
(FController as IProveedoresController).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('Cliente: ' + AContactos.NOMBRE);
|
||
Next;
|
||
end;
|
||
end;
|
||
JsListaContactosNoEliminados.Execute;
|
||
end;
|
||
actRefrescar.Execute;
|
||
end;
|
||
end;
|
||
|
||
ViewGrid.GotoFirst;
|
||
end;
|
||
|
||
procedure TfEditorProveedores.ImprimirInterno;
|
||
var
|
||
Respuesta : Integer;
|
||
AProveedores: IBizProveedor;
|
||
AllItems: Boolean;
|
||
begin
|
||
inherited;
|
||
//Desactivamos la impresion de etiquetas
|
||
{
|
||
AProveedores := Nil;
|
||
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
|
||
SeleccionarFilasDesdeGrid(ViewGrid._FocusedView, (Contactos as ISeleccionable).SelectedRecords);
|
||
AProveedores := (Controller as IProveedoresController).ExtraerSeleccionados(Contactos) as IBizProveedor;
|
||
end
|
||
else
|
||
AProveedores := (Contactos as IBizProveedor);
|
||
|
||
if Assigned(AProveedores) then
|
||
(FController as IProveedoresController).Print(AProveedores, AllItems);
|
||
end;
|
||
end;
|
||
end;
|
||
end;
|
||
}
|
||
end;
|
||
|
||
procedure TfEditorProveedores.PonerTitulos(const ATitulo: string);
|
||
var
|
||
FTitulo : String;
|
||
begin
|
||
FTitulo := 'Lista de proveedores - ' + AppFactuGES.EmpresaActiva.NOMBRE;
|
||
inherited PonerTitulos(FTitulo);
|
||
end;
|
||
|
||
procedure TfEditorProveedores.PrevisualizarInterno;
|
||
var
|
||
Respuesta : Integer;
|
||
AProveedores: IBizProveedor;
|
||
AllItems: Boolean;
|
||
begin
|
||
inherited;
|
||
//Desactivamos la impresion de etiquetas
|
||
{
|
||
AProveedores := Nil;
|
||
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
|
||
SeleccionarFilasDesdeGrid(ViewGrid._FocusedView, (Contactos as ISeleccionable).SelectedRecords);
|
||
AProveedores := (Controller as IProveedoresController).ExtraerSeleccionados(Contactos) as IBizProveedor;
|
||
end
|
||
else
|
||
AProveedores := (Contactos as IBizProveedor);
|
||
|
||
if Assigned(AProveedores) then
|
||
(FController as IProveedoresController).Preview(AProveedores, AllItems);
|
||
end;
|
||
end;
|
||
end;
|
||
end;
|
||
}
|
||
end;
|
||
|
||
end.
|