2011-11-14 17:40:41 +00:00
|
|
|
|
unit uEditorRemesasCliente;
|
|
|
|
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
|
|
|
|
|
|
|
uses
|
|
|
|
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
|
|
|
|
Dialogs, uEditorBase, ToolWin, ComCtrls, JvExControls, JvComponent,
|
|
|
|
|
|
JvNavigationPane, uViewRemesasCliente, uBizRemesasCliente, ActnList, DBActns, uViewGrid,
|
|
|
|
|
|
Menus, uDataModuleBase, ImgList, PngImageList, TB2Dock, TB2Toolbar, TBX,
|
|
|
|
|
|
TB2Item, StdActns, TB2ExtItems, TBXExtItems, TB2MRU, DB, uDADataTable,
|
|
|
|
|
|
JvFormAutoSize, uDAScriptingProvider, uDACDSDataTable, JvAppStorage,
|
|
|
|
|
|
JvAppRegistryStorage, JvFormPlacement, ExtCtrls, uCustomView, uViewBase,
|
|
|
|
|
|
uViewBarraSeleccion, pngimage, uIEditorRemesasCliente, uEditorGridBase,
|
|
|
|
|
|
JvComponentBase, uViewGridBase, uRemesasClienteController, JvExComCtrls,
|
|
|
|
|
|
JvStatusBar, JSDialog, uDAInterfaces;
|
|
|
|
|
|
|
|
|
|
|
|
type
|
|
|
|
|
|
TfEditorRemesasCliente = class(TfEditorGridBase, IEditorRemesasCliente)
|
|
|
|
|
|
actVolcarDisco: TAction;
|
|
|
|
|
|
TBXSeparatorItem17: TTBXSeparatorItem;
|
|
|
|
|
|
N4: TMenuItem;
|
|
|
|
|
|
Volcaradisco1: TMenuItem;
|
|
|
|
|
|
TBXSubmenuItem2: TTBXSubmenuItem;
|
|
|
|
|
|
TBXItem38: TTBXItem;
|
|
|
|
|
|
JsListaRemesasNoEliminadas: TJSDialog;
|
|
|
|
|
|
JsPrevisualizarDialog: TJSDialog;
|
|
|
|
|
|
JsImprimirDialog: TJSDialog;
|
|
|
|
|
|
procedure FormShow(Sender: TObject);
|
|
|
|
|
|
procedure actVolcarDiscoExecute(Sender: TObject);
|
|
|
|
|
|
procedure actVolcarDiscoUpdate(Sender: TObject);
|
2013-06-03 16:01:08 +00:00
|
|
|
|
procedure OnListaAnosChange(Sender: TObject; const Text: string);
|
|
|
|
|
|
|
2011-11-14 17:40:41 +00:00
|
|
|
|
private
|
|
|
|
|
|
FRemesasCliente: IBizRemesaCliente;
|
|
|
|
|
|
FController : IRemesasClienteController;
|
2013-06-03 16:01:08 +00:00
|
|
|
|
|
2011-11-14 17:40:41 +00:00
|
|
|
|
protected
|
|
|
|
|
|
function GetRemesasCliente: IBizRemesaCliente;
|
|
|
|
|
|
procedure SetRemesasCliente(const Value: IBizRemesaCliente);
|
2013-06-03 16:01:08 +00:00
|
|
|
|
|
2011-11-14 17:40:41 +00:00
|
|
|
|
function GetController : IRemesasClienteController; virtual;
|
|
|
|
|
|
procedure SetController (const Value : IRemesasClienteController); virtual;
|
|
|
|
|
|
|
|
|
|
|
|
procedure NuevoInterno; override;
|
|
|
|
|
|
procedure EliminarInterno; override;
|
|
|
|
|
|
procedure ModificarInterno; override;
|
|
|
|
|
|
procedure PrevisualizarInterno; override;
|
|
|
|
|
|
procedure ImprimirInterno; override;
|
2013-06-03 16:01:08 +00:00
|
|
|
|
procedure RefrescarInterno; override;
|
2011-11-14 17:40:41 +00:00
|
|
|
|
|
|
|
|
|
|
//Si queremos crear otra vista para el editor heredado solo tendriamos que
|
|
|
|
|
|
//sobreescribir este metodo
|
|
|
|
|
|
procedure AsignarVista; virtual;
|
|
|
|
|
|
|
|
|
|
|
|
public
|
|
|
|
|
|
procedure PonerTitulos(const ATitulo: string = ''); override;
|
|
|
|
|
|
property RemesasCliente: IBizRemesaCliente read GetRemesasCliente write SetRemesasCliente;
|
|
|
|
|
|
property Controller : IRemesasClienteController read GetController write SetController;
|
|
|
|
|
|
constructor Create(AOwner: TComponent); override;
|
|
|
|
|
|
destructor Destroy; override;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
|
|
|
|
|
|
uses
|
|
|
|
|
|
uCustomEditor, uDataModuleRemesasCliente, uDataModuleUsuarios,
|
|
|
|
|
|
uGridUtils, uDBSelectionListUtils, uFactuGES_App,
|
|
|
|
|
|
uEditorDBBase, uBizFamilias, uFamiliasController,
|
|
|
|
|
|
// uBancaElectronicaController,
|
|
|
|
|
|
cxGrid, cxGridCustomTableView; //, uListaRemesasCliente;
|
|
|
|
|
|
|
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
****************************** TfEditorRemesasCliente *******************************
|
|
|
|
|
|
}
|
|
|
|
|
|
procedure TfEditorRemesasCliente.FormShow(Sender: TObject);
|
|
|
|
|
|
begin
|
2013-06-03 16:01:08 +00:00
|
|
|
|
cbxListaAnos.OnChange := OnListaAnosChange; //OJO SIEMPRE ANTES DEL INHERITED
|
|
|
|
|
|
|
2011-11-14 17:40:41 +00:00
|
|
|
|
inherited;
|
|
|
|
|
|
|
|
|
|
|
|
if not Assigned(ViewGrid) then
|
|
|
|
|
|
raise Exception.Create('No hay ninguna vista asignada');
|
|
|
|
|
|
|
|
|
|
|
|
if not Assigned(RemesasCliente) then
|
|
|
|
|
|
raise Exception.Create('No hay ning<6E>n RemesaCliente asignado');
|
|
|
|
|
|
|
|
|
|
|
|
RemesasCliente.DataTable.Active := True;
|
|
|
|
|
|
ViewGrid.GotoFirst;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
function TfEditorRemesasCliente.GetRemesasCliente: IBizRemesaCliente;
|
|
|
|
|
|
begin
|
|
|
|
|
|
Result := FRemesasCliente;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorRemesasCliente.ImprimirInterno;
|
|
|
|
|
|
var
|
|
|
|
|
|
Respuesta : Integer;
|
|
|
|
|
|
ARemesasCliente: IBizRemesaCliente;
|
|
|
|
|
|
AllItems: Boolean;
|
|
|
|
|
|
begin
|
|
|
|
|
|
ARemesasCliente := 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, (RemesasCliente as ISeleccionable).SelectedRecords);
|
|
|
|
|
|
ARemesasCliente := (Controller as IRemesasClienteController).ExtraerSeleccionados(RemesasCliente) as IBizRemesaCliente;
|
|
|
|
|
|
end
|
|
|
|
|
|
else
|
|
|
|
|
|
ARemesasCliente := RemesasCliente;
|
|
|
|
|
|
|
|
|
|
|
|
if Assigned(ARemesasCliente) then
|
2013-06-03 16:01:08 +00:00
|
|
|
|
if FController.Print(ARemesasCliente, AllItems) then
|
|
|
|
|
|
RefrescarInterno;
|
2011-11-14 17:40:41 +00:00
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
function TfEditorRemesasCliente.GetController: IRemesasClienteController;
|
|
|
|
|
|
begin
|
|
|
|
|
|
Result := FController;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorRemesasCliente.ModificarInterno;
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
FController.Ver(RemesasCliente);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorRemesasCliente.NuevoInterno;
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
FController.Anadir(RemesasCliente);
|
|
|
|
|
|
FController.Ver(RemesasCliente);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2013-06-03 16:01:08 +00:00
|
|
|
|
procedure TfEditorRemesasCliente.OnListaAnosChange(Sender: TObject; const Text: string);
|
|
|
|
|
|
begin
|
|
|
|
|
|
Controller.FiltrarAno(RemesasCliente, DynWhereDataTable, Text);
|
|
|
|
|
|
if RemesasCliente.DataTable.Active then
|
|
|
|
|
|
RefrescarInterno;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2011-11-14 17:40:41 +00:00
|
|
|
|
procedure TfEditorRemesasCliente.PonerTitulos(const ATitulo: string);
|
|
|
|
|
|
var
|
|
|
|
|
|
FTitulo : String;
|
|
|
|
|
|
begin
|
|
|
|
|
|
FTitulo := 'Lista de remesas de cobro - ' + AppFactuGES.EmpresaActiva.NOMBRE;
|
|
|
|
|
|
inherited PonerTitulos(FTitulo);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorRemesasCliente.PrevisualizarInterno;
|
|
|
|
|
|
var
|
|
|
|
|
|
Respuesta : Integer;
|
|
|
|
|
|
ARemesasCliente: IBizRemesaCliente;
|
|
|
|
|
|
AllItems: Boolean;
|
|
|
|
|
|
begin
|
|
|
|
|
|
ARemesasCliente := 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, (RemesasCliente as ISeleccionable).SelectedRecords);
|
|
|
|
|
|
ARemesasCliente := (Controller as IRemesasClienteController).ExtraerSeleccionados(RemesasCliente) as IBizRemesaCliente;
|
|
|
|
|
|
end
|
|
|
|
|
|
else
|
|
|
|
|
|
ARemesasCliente := RemesasCliente;
|
|
|
|
|
|
|
|
|
|
|
|
if Assigned(ARemesasCliente) then
|
|
|
|
|
|
FController.Preview(ARemesasCliente, AllItems);
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
2013-06-03 16:01:08 +00:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorRemesasCliente.RefrescarInterno;
|
|
|
|
|
|
begin
|
|
|
|
|
|
//Volvemos a cargar los a<>os de las remesas
|
|
|
|
|
|
if Assigned(FController) then
|
|
|
|
|
|
ListaAnos := FController.DarListaAnosRemesas;
|
|
|
|
|
|
|
|
|
|
|
|
inherited;
|
2011-11-14 17:40:41 +00:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorRemesasCliente.SetRemesasCliente(const Value: IBizRemesaCliente);
|
|
|
|
|
|
begin
|
|
|
|
|
|
FRemesasCliente := Value;
|
2013-06-03 16:01:08 +00:00
|
|
|
|
|
|
|
|
|
|
if Assigned(FRemesasCliente) then
|
|
|
|
|
|
begin
|
|
|
|
|
|
//Se guarda el where de la sentencia origen, por si el editor tiene filtros que
|
|
|
|
|
|
//afecten a este where y en un futuro se desea volver al where origen (filtro de a<>o))
|
|
|
|
|
|
DynWhereDataTable := FRemesasCliente.DataTable.DynamicWhere.Xml;
|
|
|
|
|
|
|
|
|
|
|
|
dsDataTable.DataTable := FRemesasCliente.DataTable;
|
|
|
|
|
|
if Assigned(ViewGrid) then
|
|
|
|
|
|
(ViewGrid as IViewRemesasCliente).RemesasCliente := RemesasCliente;
|
|
|
|
|
|
end;
|
2011-11-14 17:40:41 +00:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorRemesasCliente.SetController(const Value: IRemesasClienteController);
|
|
|
|
|
|
begin
|
|
|
|
|
|
FController := Value;
|
2013-06-03 16:01:08 +00:00
|
|
|
|
|
|
|
|
|
|
if Assigned(FController) then
|
|
|
|
|
|
ListaAnos := FController.DarListaAnosRemesas;
|
2011-11-14 17:40:41 +00:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
destructor TfEditorRemesasCliente.Destroy;
|
|
|
|
|
|
begin
|
|
|
|
|
|
FRemesasCliente := NIL;
|
|
|
|
|
|
FController := NIl;
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorRemesasCliente.EliminarInterno;
|
|
|
|
|
|
var
|
|
|
|
|
|
ARemesas: IBizRemesaCliente;
|
|
|
|
|
|
AllItems: Boolean;
|
|
|
|
|
|
begin
|
|
|
|
|
|
ARemesas := Nil;
|
|
|
|
|
|
AllItems := False;
|
|
|
|
|
|
|
|
|
|
|
|
if MultiSelect and Assigned(ViewGrid) then
|
|
|
|
|
|
AllItems := (ViewGrid.NumSeleccionados > 1);
|
|
|
|
|
|
|
|
|
|
|
|
if AllItems then
|
|
|
|
|
|
begin
|
|
|
|
|
|
if (Application.MessageBox('<27>Desea borrar las remesas de cobro seleccionadas?', 'Atenci<63>n', MB_YESNO) = IDYES) then
|
|
|
|
|
|
begin
|
|
|
|
|
|
SeleccionarFilasDesdeGrid(ViewGrid._FocusedView, (RemesasCliente as ISeleccionable).SelectedRecords);
|
|
|
|
|
|
ARemesas := (Controller as IRemesasClienteController).ExtraerSeleccionados(RemesasCliente) as IBizRemesaCliente;
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
else begin
|
|
|
|
|
|
if (Application.MessageBox('<27>Desea borrar esta remesa de cobro?', 'Atenci<63>n', MB_YESNO) = IDYES) then
|
|
|
|
|
|
ARemesas := RemesasCliente;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
if Assigned(ARemesas) then
|
|
|
|
|
|
begin
|
|
|
|
|
|
FController.Eliminar(ARemesas, AllItems);
|
|
|
|
|
|
if AllItems then
|
|
|
|
|
|
begin
|
|
|
|
|
|
if (ARemesas.DataTable.RecordCount > 0) then
|
|
|
|
|
|
begin
|
|
|
|
|
|
with ARemesas.DataTable do
|
|
|
|
|
|
begin
|
|
|
|
|
|
First;
|
|
|
|
|
|
while not EOF do
|
|
|
|
|
|
begin
|
|
|
|
|
|
JsListaRemesasNoEliminadas.Content.Add('Ref. remesa: ' + ARemesas.REFERENCIA + ' ' + ARemesas.NOMBRE);
|
|
|
|
|
|
Next;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
JsListaRemesasNoEliminadas.Execute;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
actRefrescar.Execute;
|
|
|
|
|
|
ViewGrid.GotoFirst;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorRemesasCliente.actVolcarDiscoExecute(Sender: TObject);
|
|
|
|
|
|
//var
|
|
|
|
|
|
// ABancaController : IBancaElectronicaController;
|
|
|
|
|
|
begin
|
|
|
|
|
|
{ inherited;
|
|
|
|
|
|
ABancaController := TBancaElectronicaController.Create;
|
|
|
|
|
|
try
|
|
|
|
|
|
ABancaController.GenerarFicheroNorma19(FRemesasCliente.ID);
|
|
|
|
|
|
finally
|
|
|
|
|
|
ABancaController := NIL;
|
|
|
|
|
|
end;
|
|
|
|
|
|
}
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorRemesasCliente.actVolcarDiscoUpdate(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
if HayDatos and Assigned(ViewGrid) then
|
|
|
|
|
|
(Sender as TAction).Enabled := not (dsDataTable.DataTable.State in dsEditModes)
|
|
|
|
|
|
and not ViewGrid.IsEmpty
|
|
|
|
|
|
else
|
|
|
|
|
|
(Sender as TAction).Enabled := False;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorRemesasCliente.AsignarVista;
|
|
|
|
|
|
begin
|
|
|
|
|
|
ViewGrid := CreateView(TfrViewRemesasCliente) as IViewRemesasCliente;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
constructor TfEditorRemesasCliente.Create(AOwner: TComponent);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
AsignarVista;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
end.
|
|
|
|
|
|
|
2013-06-03 16:01:08 +00:00
|
|
|
|
|