2007-11-16 20:58:56 +00:00
|
|
|
|
unit uEditorRemesaCliente;
|
|
|
|
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
|
|
|
|
|
|
|
uses
|
|
|
|
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
|
|
|
|
Dialogs, uEditorDBItem, ToolWin, ComCtrls, JvExControls, JvComponent,
|
|
|
|
|
|
uViewRemesaCliente, uBizRemesasCliente, JvNavigationPane, ActnList,
|
|
|
|
|
|
uEditorBase, StdActns, TB2Dock, TB2Toolbar, TBX, ImgList, PngImageList,
|
|
|
|
|
|
TB2Item, uEditorItem, DB, uDADataTable, uEditorDBBase, JvFormAutoSize,
|
|
|
|
|
|
uDAScriptingProvider, uDACDSDataTable, StdCtrls, pngimage, ExtCtrls,
|
|
|
|
|
|
TBXDkPanels, JvButton, AppEvnts, uCustomView, uViewBase,
|
|
|
|
|
|
JvAppStorage, JvAppRegistryStorage, JvFormPlacement, JvComponentBase,
|
|
|
|
|
|
cxCustomData,
|
|
|
|
|
|
uViewRemesasCliente, uIEditorRemesaCliente, uRemesasClienteController, JvExComCtrls,
|
|
|
|
|
|
JvStatusBar, dxLayoutLookAndFeels, uViewGridBase, uViewGrid,
|
2007-11-20 15:45:03 +00:00
|
|
|
|
uViewRecibosRemesaCliente, uViewTotales, uViewDetallesGenerico, uDAInterfaces;
|
2007-11-16 20:58:56 +00:00
|
|
|
|
|
|
|
|
|
|
type
|
|
|
|
|
|
TfEditorRemesaCliente = class(TfEditorDBItem, IEditorRemesaCliente)
|
|
|
|
|
|
dxLayoutLookAndFeelList1: TdxLayoutLookAndFeelList;
|
|
|
|
|
|
dxLayoutOfficeLookAndFeel1: TdxLayoutOfficeLookAndFeel;
|
|
|
|
|
|
frViewRemesaCliente1: TfrViewRemesaCliente;
|
|
|
|
|
|
frViewTotales1: TfrViewTotales;
|
|
|
|
|
|
frViewRecibosRemesaCliente1: TfrViewRecibosRemesaCliente;
|
|
|
|
|
|
actVolcarDisco: TAction;
|
|
|
|
|
|
TBXSubmenuItem2: TTBXSubmenuItem;
|
|
|
|
|
|
TBXItem7: TTBXItem;
|
|
|
|
|
|
TBXItem33: TTBXItem;
|
|
|
|
|
|
TBXSeparatorItem6: TTBXSeparatorItem;
|
|
|
|
|
|
procedure FormShow(Sender: TObject);
|
|
|
|
|
|
procedure CustomEditorClose(Sender: TObject; var Action: TCloseAction);
|
|
|
|
|
|
|
|
|
|
|
|
procedure actAnadirRecibosExecute(Sender: TObject);
|
|
|
|
|
|
procedure actEliminarReciboExecute(Sender: TObject);
|
|
|
|
|
|
procedure JvFormStorageRestorePlacement(Sender: TObject);
|
|
|
|
|
|
procedure JvFormStorageSavePlacement(Sender: TObject);
|
|
|
|
|
|
procedure frViewRecibosRemesaCliente1cxGridViewDataControllerSummaryAfterSummary(
|
|
|
|
|
|
ASender: TcxDataSummary);
|
|
|
|
|
|
procedure actVolcarDiscoUpdate(Sender: TObject);
|
|
|
|
|
|
procedure actVolcarDiscoExecute(Sender: TObject);
|
|
|
|
|
|
private
|
|
|
|
|
|
procedure OnRecibosChanged(Sender: TObject);
|
|
|
|
|
|
protected
|
|
|
|
|
|
FController : IRemesasClienteController;
|
|
|
|
|
|
FRemesaCliente: IBizRemesaCliente;
|
|
|
|
|
|
FViewRemesaCliente : IViewRemesaCliente;
|
|
|
|
|
|
|
|
|
|
|
|
function GetController : IRemesasClienteController;
|
|
|
|
|
|
procedure SetController (const Value : IRemesasClienteController); virtual;
|
|
|
|
|
|
function GetRemesaCliente: IBizRemesaCliente; virtual;
|
|
|
|
|
|
procedure SetRemesaCliente(const Value: IBizRemesaCliente); virtual;
|
|
|
|
|
|
function GetViewRemesaCliente: IViewRemesaCliente;
|
|
|
|
|
|
procedure SetViewRemesaCliente(const Value: IViewRemesaCliente);
|
|
|
|
|
|
property ViewRemesaCliente: IViewRemesaCliente read GetViewRemesaCliente write SetViewRemesaCliente;
|
|
|
|
|
|
|
|
|
|
|
|
procedure GuardarInterno; override;
|
|
|
|
|
|
procedure EliminarInterno; override;
|
|
|
|
|
|
procedure PrevisualizarInterno; override;
|
|
|
|
|
|
procedure ImprimirInterno; override;
|
|
|
|
|
|
procedure CerrarInterno; override;
|
|
|
|
|
|
|
|
|
|
|
|
procedure PonerTitulos(const ATitulo: string = ''); override;
|
|
|
|
|
|
function GetModified: Boolean; override;
|
|
|
|
|
|
|
|
|
|
|
|
public
|
|
|
|
|
|
property RemesaCliente: IBizRemesaCliente read GetRemesaCliente write SetRemesaCliente;
|
|
|
|
|
|
constructor Create(AOwner: TComponent); override;
|
|
|
|
|
|
destructor Destroy; override;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
|
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
|
|
|
|
|
|
|
uses
|
|
|
|
|
|
uDataTableUtils, cxControls, uDataModuleUsuarios, uDialogUtils, uCustomEditor,
|
|
|
|
|
|
uDataModuleRemesasCliente, uDataModuleBase, uBizFamilias, uFamiliasController,
|
2007-11-20 15:45:03 +00:00
|
|
|
|
uFactuGES_App;
|
|
|
|
|
|
// uBancaElectronicaController;
|
2007-11-16 20:58:56 +00:00
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
******************************* TfEditorRemesaCliente *******************************
|
|
|
|
|
|
}
|
|
|
|
|
|
function TfEditorRemesaCliente.GetRemesaCliente: IBizRemesaCliente;
|
|
|
|
|
|
begin
|
|
|
|
|
|
Result := FRemesaCliente;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
function TfEditorRemesaCliente.GetController: IRemesasClienteController;
|
|
|
|
|
|
begin
|
|
|
|
|
|
Result := FController;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
function TfEditorRemesaCliente.GetModified: Boolean;
|
|
|
|
|
|
var
|
|
|
|
|
|
bCambiado : Boolean;
|
|
|
|
|
|
begin
|
|
|
|
|
|
bCambiado := inherited GetModified;
|
|
|
|
|
|
//Si no hay cambios miramos que no los halla en la lista de recibos
|
|
|
|
|
|
if not bCambiado then
|
|
|
|
|
|
bCambiado := frViewRecibosRemesaCliente1.Modified;
|
|
|
|
|
|
Result := bCambiado;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
function TfEditorRemesaCliente.GetViewRemesaCliente: IViewRemesaCliente;
|
|
|
|
|
|
begin
|
|
|
|
|
|
Result := FViewRemesaCliente;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorRemesaCliente.GuardarInterno;
|
|
|
|
|
|
var
|
|
|
|
|
|
bEsNuevo : Boolean;
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
bEsNuevo := False;
|
|
|
|
|
|
|
|
|
|
|
|
ShowHourglassCursor;
|
|
|
|
|
|
frViewRecibosRemesaCliente1.OnViewModified := Nil;
|
|
|
|
|
|
//frViewDetallesFacturaCliente1.SaveGridStatus; // Para guardar estado del grid
|
|
|
|
|
|
// frViewDetallesFacturaCliente1.BeginUpdate; // Para que no se mueva el foco
|
|
|
|
|
|
try
|
|
|
|
|
|
bEsNuevo := FRemesaCliente.EsNuevo;
|
|
|
|
|
|
FController.Guardar(FRemesaCliente);
|
|
|
|
|
|
|
|
|
|
|
|
finally
|
|
|
|
|
|
// frViewDetallesFacturaCliente1.EndUpdate;
|
|
|
|
|
|
// frViewDetallesFacturaCliente1.RestoreGridStatus;
|
|
|
|
|
|
HideHourglassCursor;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
if bEsNuevo then
|
|
|
|
|
|
ShowInfoMessage('La remesa de cobro se ha dado de alta con el c<>digo ' + FRemesaCliente.REFERENCIA);
|
|
|
|
|
|
Modified := False;
|
|
|
|
|
|
frViewRecibosRemesaCliente1.Modified := False;
|
|
|
|
|
|
frViewRecibosRemesaCliente1.OnViewModified := OnRecibosChanged;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorRemesaCliente.ImprimirInterno;
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
FController.Print(FRemesaCliente);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorRemesaCliente.JvFormStorageRestorePlacement(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
//frViewRecibosRemesaCliente1.RestoreFromRegistry(JvAppRegistryStorage.Root);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorRemesaCliente.JvFormStorageSavePlacement(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
//frViewRecibosRemesaCliente1.StoreToRegistry(JvAppRegistryStorage.Root);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorRemesaCliente.OnRecibosChanged(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
ActualizarEstadoEditor;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorRemesaCliente.PonerTitulos(const ATitulo: string);
|
|
|
|
|
|
var
|
|
|
|
|
|
FTitulo : String;
|
|
|
|
|
|
begin
|
|
|
|
|
|
FTitulo := ATitulo;
|
|
|
|
|
|
if (FTitulo = '') and Assigned(RemesaCliente) then
|
|
|
|
|
|
begin
|
|
|
|
|
|
if RemesaCliente.EsNuevo then
|
|
|
|
|
|
FTitulo := 'Nueva remesa de cobro'
|
|
|
|
|
|
else
|
|
|
|
|
|
FTitulo := 'Remesa de cobro';
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
inherited PonerTitulos(FTitulo);
|
|
|
|
|
|
|
2007-11-18 15:07:51 +00:00
|
|
|
|
Self.Caption := FTitulo + ' (' + AppFactuGES.EmpresaActiva.NOMBRE + ')';
|
2007-11-16 20:58:56 +00:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorRemesaCliente.PrevisualizarInterno;
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
FController.Preview(FRemesaCliente);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorRemesaCliente.SetRemesaCliente(const Value: IBizRemesaCliente);
|
|
|
|
|
|
begin
|
|
|
|
|
|
FRemesaCliente := Value;
|
|
|
|
|
|
if Assigned(FRemesaCliente) then
|
|
|
|
|
|
begin
|
|
|
|
|
|
dsDataTable.DataTable := FRemesaCliente.DataTable;
|
|
|
|
|
|
frViewRecibosRemesaCliente1.RemesaCliente := FRemesaCliente;
|
|
|
|
|
|
frViewRecibosRemesaCliente1.OnViewModified := OnRecibosChanged;
|
|
|
|
|
|
end
|
|
|
|
|
|
else
|
|
|
|
|
|
begin
|
|
|
|
|
|
dsDataTable.DataTable := Nil;
|
|
|
|
|
|
frViewRecibosRemesaCliente1.RemesaCliente := Nil;
|
|
|
|
|
|
frViewRecibosRemesaCliente1.OnViewModified := Nil;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
if Assigned(FViewRemesaCliente) then
|
|
|
|
|
|
FViewRemesaCliente.RemesaCliente := FRemesaCliente;
|
|
|
|
|
|
|
|
|
|
|
|
frViewTotales1.DADataSource.DataTable := dsDataTable.DataTable;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorRemesaCliente.SetController(const Value: IRemesasClienteController);
|
|
|
|
|
|
begin
|
|
|
|
|
|
FController := Value;
|
|
|
|
|
|
if Assigned(FController) then
|
|
|
|
|
|
begin
|
|
|
|
|
|
(ViewRemesaCliente as IViewRemesaCliente).Controller := (FController as IRemesasClienteController);
|
|
|
|
|
|
frViewRecibosRemesaCliente1.Controller := (FController as IRemesasClienteController);
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorRemesaCliente.SetViewRemesaCliente(const Value: IViewRemesaCliente);
|
|
|
|
|
|
begin
|
|
|
|
|
|
FViewRemesaCliente := Value;
|
|
|
|
|
|
|
|
|
|
|
|
if Assigned(FViewRemesaCliente) and Assigned(RemesaCliente) then
|
|
|
|
|
|
begin
|
|
|
|
|
|
FViewRemesaCliente.RemesaCliente := RemesaCliente;
|
|
|
|
|
|
FViewRemesaCliente.Controller := (FController as IRemesasClienteController);
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorRemesaCliente.FormShow(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
|
|
|
|
|
|
if not Assigned(FViewRemesaCliente) then
|
|
|
|
|
|
raise Exception.Create('No hay ninguna vista asignada');
|
|
|
|
|
|
|
|
|
|
|
|
if not Assigned(RemesaCliente) then
|
|
|
|
|
|
raise Exception.Create('No hay ning<6E>n almac<61>n asignado');
|
|
|
|
|
|
|
|
|
|
|
|
RemesaCliente.DataTable.Active := True;
|
|
|
|
|
|
|
|
|
|
|
|
//Falla si lo hacemos por dfm
|
|
|
|
|
|
frViewRecibosRemesaCliente1.cxGridView.OptionsSelection.MultiSelect := False;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorRemesaCliente.frViewRecibosRemesaCliente1cxGridViewDataControllerSummaryAfterSummary(ASender: TcxDataSummary);
|
|
|
|
|
|
Var
|
|
|
|
|
|
AImporteTotal: Currency;
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
|
|
|
|
|
|
if VarIsNull(ASender.FooterSummaryValues[0]) then
|
|
|
|
|
|
AImporteTotal := 0
|
|
|
|
|
|
else
|
|
|
|
|
|
AImporteTotal := ASender.FooterSummaryValues[0];
|
|
|
|
|
|
|
|
|
|
|
|
if Assigned(RemesaCliente) then
|
|
|
|
|
|
begin
|
|
|
|
|
|
if (RemesaCliente.IMPORTE_TOTAL <> AImporteTotal) then
|
|
|
|
|
|
begin
|
|
|
|
|
|
if not RemesaCliente.DataTable.Editing then
|
|
|
|
|
|
begin
|
|
|
|
|
|
RemesaCliente.Edit;
|
|
|
|
|
|
RemesaCliente.IMPORTE_TOTAL := AImporteTotal;
|
|
|
|
|
|
RemesaCliente.Post;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
destructor TfEditorRemesaCliente.Destroy;
|
|
|
|
|
|
begin
|
|
|
|
|
|
// Utilizar mejor OnClose;
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorRemesaCliente.actAnadirRecibosExecute(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
// HayCambios := FController.ElegirRecibosCliente(RemesaCliente) OR HayCambios;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorRemesaCliente.actEliminarReciboExecute(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
// FController.EliminarReciboCliente(RemesaCliente);
|
|
|
|
|
|
// HayCambios := True;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorRemesaCliente.actVolcarDiscoExecute(Sender: TObject);
|
2007-11-20 15:45:03 +00:00
|
|
|
|
//var
|
|
|
|
|
|
// ABancaController : IBancaElectronicaController;
|
2007-11-16 20:58:56 +00:00
|
|
|
|
begin
|
2007-11-20 15:45:03 +00:00
|
|
|
|
{
|
2007-11-16 20:58:56 +00:00
|
|
|
|
inherited;
|
|
|
|
|
|
ABancaController := TBancaElectronicaController.Create;
|
|
|
|
|
|
try
|
|
|
|
|
|
ABancaController.GenerarFicheroNorma19(FRemesaCliente.ID);
|
|
|
|
|
|
finally
|
|
|
|
|
|
ABancaController := NIL;
|
|
|
|
|
|
end;
|
2007-11-20 15:45:03 +00:00
|
|
|
|
}
|
2007-11-16 20:58:56 +00:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorRemesaCliente.actVolcarDiscoUpdate(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
(Sender as TAction).Enabled := HayDatos and (not FRemesaCliente.EsNuevo);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorRemesaCliente.CerrarInterno;
|
|
|
|
|
|
begin
|
|
|
|
|
|
frViewRecibosRemesaCliente1.OnViewModified := Nil;
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
constructor TfEditorRemesaCliente.Create(AOwner: TComponent);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
pgPaginas.ActivePageIndex := 0;
|
|
|
|
|
|
FViewRemesaCliente := frViewRemesaCliente1;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorRemesaCliente.CustomEditorClose(Sender: TObject;
|
|
|
|
|
|
var Action: TCloseAction);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
dsDataTable.DataTable := NIL;
|
|
|
|
|
|
FViewRemesaCliente := NIL;
|
|
|
|
|
|
FRemesaCliente := NIL;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorRemesaCliente.EliminarInterno;
|
|
|
|
|
|
begin
|
|
|
|
|
|
if (Application.MessageBox('<27>Desea borrar esta remesa de cobro?', 'Atenci<63>n', MB_YESNO) = IDYES) then
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
if not FController.Eliminar(FRemesaCliente) then
|
|
|
|
|
|
actRefrescar.Execute;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
end.
|
|
|
|
|
|
|
2007-11-18 15:07:51 +00:00
|
|
|
|
|