2019-11-18 10:36:42 +00:00
unit uEditorContratosCliente;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Menus, DB, uDADataTable, JvAppStorage,
JvAppRegistryStorage, JvComponent, JvFormPlacement, ImgList,
PngImageList, StdActns, ActnList, ComCtrls, TB2ExtItems, TBXExtItems,
TBX, TB2Item, TB2Dock, TB2Toolbar, ExtCtrls, JvExControls,
JvNavigationPane, uViewGrid, pngimage, JvComponentBase,
uEditorGridBase,
uBizContratosCliente, uIEditorContratosCliente, uContratosClienteController,
uCustomView, uViewBase, uViewBarraSeleccion, uViewGridBase,
uViewContratosCliente, JvExComCtrls, JvStatusBar, JSDialog, StdCtrls,
uDAInterfaces;
type
TfEditorContratosCliente = class( TfEditorGridBase, IEditorContratosCliente)
actGenerarAlbaranCli: TAction;
actGenerarFactura: TAction;
TBXSubmenuItem2: TTBXSubmenuItem;
TBXSeparatorItem17: TTBXSeparatorItem;
TBXItem38: TTBXItem;
TBXItem39: TTBXItem;
N4: TMenuItem;
Generar2: TMenuItem;
JsGenerarDialog: TJSDialog;
JsPrevisualizarDialog: TJSDialog;
JsImprimirDialog: TJSDialog;
TBXItem40: TTBXItem;
JsListaContratosNoEliminados: TJSDialog;
TBXItem41: TTBXItem;
Generarcertificado1: TMenuItem;
TBXSeparatorItem18: TTBXSeparatorItem;
actEnviarEMail: TAction;
TBXItem45: TTBXItem;
Enviarporemail1: TMenuItem;
actInformes: TAction;
TBXItem46: TTBXItem;
JSInformesDialog: TJSDialog;
TBXItem47: TTBXItem;
actListadoBeneficios: TAction;
TBXItem42: TTBXItem;
TBXSubmenuItem3: TTBXSubmenuItem;
TBXItem43: TTBXItem;
Generaralbarndecliente1: TMenuItem;
actGenerarPedidoProv: TAction;
TBXItem44: TTBXItem;
TBXSeparatorItem19: TTBXSeparatorItem;
actVerPedidosProveedor: TAction;
TBXItem48: TTBXItem;
TBXSeparatorItem20: TTBXSeparatorItem;
actVerFacturasProveedor: TAction;
TBXItem49: TTBXItem;
2020-01-23 18:43:09 +00:00
actAceptar: TAction;
actRechazar: TAction;
actGenerarReciboCli: TAction;
TBXSeparatorItem21: TTBXSeparatorItem;
2020-03-04 18:16:20 +00:00
actLOPD: TAction;
TBXItem50: TTBXItem;
2019-11-18 10:36:42 +00:00
procedure FormShow( Sender: TObject) ;
procedure actGenerarAlbaranCliExecute( Sender: TObject) ;
procedure actEliminarUpdate( Sender: TObject) ;
procedure actGenerarFacturaUpdate( Sender: TObject) ;
procedure actGenerarFacturaExecute( Sender: TObject) ;
procedure actGenerarPresupuestoProvExecute( Sender: TObject) ;
procedure actGenerarExecute( Sender: TObject) ;
procedure actAceptarExecute( Sender: TObject) ;
procedure actAceptarUpdate( Sender: TObject) ;
procedure actAnularExecute( Sender: TObject) ;
procedure actAnularUpdate( Sender: TObject) ;
procedure actEnviarEMailExecute( Sender: TObject) ;
procedure actEnviarEMailUpdate( Sender: TObject) ;
procedure actInformesExecute( Sender: TObject) ;
procedure OnListaAnosChange( Sender: TObject; const Text : string ) ;
procedure actListadoBeneficiosExecute( Sender: TObject) ;
procedure bCocinaClick( Sender: TObject) ;
procedure bArmarioClick( Sender: TObject) ;
procedure bBanoClick( Sender: TObject) ;
procedure bElectrodomesticoClick( Sender: TObject) ;
procedure bVariosClick( Sender: TObject) ;
procedure bObraClick( Sender: TObject) ;
procedure actGenerarAlbaranCliUpdate( Sender: TObject) ;
procedure actGenerarPedidoProvExecute( Sender: TObject) ;
procedure actGenerarPedidoProvUpdate( Sender: TObject) ;
procedure actVerPedidosProveedorExecute( Sender: TObject) ;
procedure actVerFacturasProveedorExecute( Sender: TObject) ;
2020-01-23 18:43:09 +00:00
procedure actRechazarExecute( Sender: TObject) ;
procedure actRechazarUpdate( Sender: TObject) ;
procedure actGenerarReciboCliExecute( Sender: TObject) ;
procedure actGenerarReciboCliUpdate( Sender: TObject) ;
2020-03-04 18:16:20 +00:00
procedure actLOPDExecute( Sender: TObject) ;
procedure actLOPDUpdate( Sender: TObject) ;
2020-01-23 18:43:09 +00:00
private
procedure cambiarSituacion ( const ASituacion: String ) ;
2019-11-18 10:36:42 +00:00
protected
FContratos: IBizContratoCliente;
FController : IContratosClienteController;
function GetContratos: IBizContratoCliente;
procedure SetContratos( const Value: IBizContratoCliente) ;
function GetController : IContratosClienteController; virtual ;
procedure SetController ( const Value : IContratosClienteController) ; virtual ;
procedure NuevoInterno; override ;
procedure ModificarInterno; override ;
procedure EliminarInterno; override ;
procedure DuplicarInterno; override ;
procedure ImprimirInterno; override ;
procedure PrevisualizarInterno; override ;
procedure RefrescarInterno; override ;
//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 Contratos: IBizContratoCliente read GetContratos write SetContratos;
property Controller : IContratosClienteController read GetController write SetController;
constructor Create( AOwner: TComponent) ; override ;
destructor Destroy; override ;
end ;
implementation
uses
uDataModuleContratosCliente, uDataModuleUsuarios, uFactuGES_App,
uEditorBase, uEditorDBBase, uDialogUtils, Dialogs,
2020-01-23 18:43:09 +00:00
uDBSelectionListUtils, uGridUtils, uGenerarFacturasCliUtils, uGenerarRecibosCliUtils,
uGenerarAlbaranesCliUtils, uGestorInformesController, uGenerarPedidosProvUtils,
uEditorFechaDecisionContrato;
2019-11-18 10:36:42 +00:00
{$R *.dfm}
{
* * * * * * * * * * * * * * * * * * * * * * * * * * * TfEditorContratosCliente * * * * * * * * * * * * * * * * * * * * * * * * * * *
}
procedure TfEditorContratosCliente. actAceptarExecute( Sender: TObject) ;
2020-01-23 18:43:09 +00:00
var
2019-11-18 10:36:42 +00:00
AContratos: IBizContratoCliente;
2020-01-23 18:43:09 +00:00
AllItems: Boolean ;
AFecha: TDate;
2019-11-18 10:36:42 +00:00
begin
2020-01-23 18:43:09 +00:00
AContratos : = Nil ;
2019-11-18 10:36:42 +00:00
AllItems : = False ;
//Pedimos fecha de decision y realizamos todo el proceso de asignacion, en el caso de no darla no se hace nada
2020-01-23 18:43:09 +00:00
if ElegirFechaDecisionContrato( AFecha) then
2019-11-18 10:36:42 +00:00
begin
if MultiSelect and Assigned( ViewGrid) then
AllItems : = ( ViewGrid. NumSeleccionados > 1 ) ;
if AllItems then
begin
SeleccionarFilasDesdeGrid( ViewGrid. _FocusedView, ( Contratos as ISeleccionable) . SelectedRecords) ;
AContratos : = ( Controller as IContratosClienteController) . ExtraerSeleccionados( Contratos) as IBizContratoCliente;
end
else begin
AContratos : = Contratos;
end ;
ViewGrid. _Grid. BeginUpdate;
if Assigned( AContratos) then
begin
2020-01-23 18:43:09 +00:00
FController. CambiarSituacion( AContratos, SITUACION_CONTRATO_ACEPTADO, AFecha, AllItems) ;
2019-11-18 10:36:42 +00:00
actRefrescar. Execute;
end ;
ViewGrid. _Grid. EndUpdate;
end ;
end ;
procedure TfEditorContratosCliente. actAceptarUpdate( Sender: TObject) ;
begin
inherited ;
( Sender as TAction) . Enabled : = HayDatos
and ViewGrid. esSeleccionCeldaDatos
2020-01-23 18:43:09 +00:00
and ( FContratos. SITUACION = SITUACION_CONTRATO_PENDIENTE) ;
2019-11-18 10:36:42 +00:00
end ;
procedure TfEditorContratosCliente. actAnularExecute( Sender: TObject) ;
begin
{ AContratos : = Nil ;
AllItems : = False ;
//Pedimos fecha de decision y realizamos todo el proceso de asignacion, en el caso de no darla no se hace nada
AFecha : = Null;
with TfEditorFechaDecision. Create( nil ) do
try
if ShowModal = mrOk then
AFecha : = edtFechaDecision. Date;
finally
Free;
end ;
if not VarIsNull( AFecha) then
begin
if MultiSelect and Assigned( ViewGrid) then
AllItems : = ( ViewGrid. NumSeleccionados > 1 ) ;
if AllItems then
begin
SeleccionarFilasDesdeGrid( ViewGrid. _FocusedView, ( Contratos as ISeleccionable) . SelectedRecords) ;
AContratos : = ( Controller as IContratosClienteController) . ExtraerSeleccionados( Contratos) as IBizContratoCliente;
end
else begin
AContratos : = Contratos;
end ;
ViewGrid. _Grid. BeginUpdate;
if Assigned( AContratos) then
begin
FController. CambiarSituacion( AContratos, SITUACION_PRESUPUESTO_ANULADO, AFecha, AllItems) ;
actRefrescar. Execute;
end ;
ViewGrid. _Grid. EndUpdate;
end ;
}
end ;
procedure TfEditorContratosCliente. actAnularUpdate( Sender: TObject) ;
begin
inherited ;
{
( Sender as TAction) . Enabled : = HayDatos
and ViewGrid. esSeleccionCeldaDatos
and ( FContratos. SITUACION < > SITUACION_PRESUPUESTO_ANULADO) ;
}
end ;
procedure TfEditorContratosCliente. actEliminarUpdate( Sender: TObject) ;
begin
inherited ;
if ( Sender as TAction) . Enabled then
( Sender as TAction) . Enabled : = ( FContratos. SITUACION = SITUACION_CONTRATO_PENDIENTE) ;
end ;
procedure TfEditorContratosCliente. actEnviarEMailExecute( Sender: TObject) ;
begin
inherited ;
FController. EnviarContratoPorEMail( FContratos) ;
end ;
procedure TfEditorContratosCliente. actEnviarEMailUpdate( Sender: TObject) ;
begin
inherited ;
if HayDatos and Assigned( ViewGrid) then
( Sender as TAction) . Enabled : = ViewGrid. EsSeleccionCeldaDatos
and ( ViewGrid. NumSeleccionados > 0 )
else
( Sender as TAction) . Enabled : = False ;
end ;
procedure TfEditorContratosCliente. actGenerarAlbaranCliExecute( Sender: TObject) ;
begin
inherited ;
GenerarAlbaranCli( Contratos. ID) ;
actRefrescar. Execute;
end ;
procedure TfEditorContratosCliente. actGenerarAlbaranCliUpdate( Sender: TObject) ;
begin
inherited ;
( Sender as TAction) . Enabled : = HayDatos
and not ( ViewGrid. NumSeleccionados > 1 )
and ViewGrid. esSeleccionCeldaDatos;
end ;
procedure TfEditorContratosCliente. actGenerarExecute( Sender: TObject) ;
//var
// Respuesta : Integer;
begin
inherited ;
{
Respuesta : = JsGenerarDialog. Execute;
if Respuesta < > IDCANCEL then
begin
case JsGenerarDialog. CustomButtonResult of
2 0 0 : begin // Generar factura de cliente
actGenerarFactura. Execute;
end ;
1 0 0 : begin // Generar albaran de cliente
// actGenerarAlbaranCli.Execute;
end ;
end ;
actRefrescar. Execute;
end ;
}
end ;
procedure TfEditorContratosCliente. actGenerarFacturaExecute( Sender: TObject) ;
begin
inherited ;
GenerarFacturaCli( Contratos. ID) ;
actRefrescar. Execute;
end ;
procedure TfEditorContratosCliente. actGenerarFacturaUpdate( Sender: TObject) ;
begin
inherited ;
( Sender as TAction) . Enabled : = HayDatos
and not ( ViewGrid. NumSeleccionados > 1 )
2020-01-23 18:43:09 +00:00
and ViewGrid. esSeleccionCeldaDatos
and ( FContratos. SITUACION = SITUACION_CONTRATO_ACEPTADO) ;
2019-11-18 10:36:42 +00:00
end ;
procedure TfEditorContratosCliente. actGenerarPedidoProvExecute( Sender: TObject) ;
var
ACopiarDetalles: Boolean ;
begin
inherited ;
ACopiarDetalles : = ( ShowConfirmMessage( 'Generar pedido a proveedor' , Format( '<27> Desea copiar el contenido del contrato seleccionado %s?' , [ Contratos. REFERENCIA] ) ) = IDYES) ;
GenerarPedidoProv( Contratos. ID, ACopiarDetalles) ;
end ;
procedure TfEditorContratosCliente. actGenerarPedidoProvUpdate( Sender: TObject) ;
begin
inherited ;
( Sender as TAction) . Enabled : = HayDatos and
not ( ViewGrid. NumSeleccionados > 1 ) and
ViewGrid. esSeleccionCeldaDatos and
( FContratos. SITUACION = SITUACION_CONTRATO_PENDIENTE) ;
end ;
procedure TfEditorContratosCliente. actGenerarPresupuestoProvExecute( Sender: TObject) ;
begin
inherited ;
// GenerarContratosProv(FContratos);
end ;
procedure TfEditorContratosCliente. 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
1 0 0 : begin // Listado de facturas pendientes
// AGestorInformesController.VerInformeListadoContratos;
end ;
end ;
end ;
finally
AGestorInformesController : = NIL ;
end ;
end ;
procedure TfEditorContratosCliente. actListadoBeneficiosExecute( Sender: TObject) ;
begin
inherited ;
FController. VerListadoBeneficios;
end ;
2020-03-04 18:16:20 +00:00
procedure TfEditorContratosCliente. actLOPDExecute( Sender: TObject) ;
var
AContratos: IBizContratoCliente;
begin
inherited ;
ViewGrid. SaveGridStatus;
try
SeleccionarFilasDesdeGrid( ViewGrid. _FocusedView, ( Contratos as ISeleccionable) . SelectedRecords) ;
AContratos : = ( Controller as IContratosClienteController) . ExtraerSeleccionados( Contratos) as IBizContratoCliente;
finally
ViewGrid. RestoreGridStatus;
end ;
if ( Controller as IContratosClienteController) . AsignarLOPD( AContratos) then
RefrescarInterno;
end ;
procedure TfEditorContratosCliente. actLOPDUpdate( Sender: TObject) ;
begin
inherited ;
if HayDatos and Assigned( ViewGrid) then
( Sender as TAction) . Enabled : = not ( dsDataTable. DataTable. State in dsEditModes)
and ViewGrid. esSeleccionCeldaDatos
and ( ViewGrid. NumSeleccionados > 0 )
else
( Sender as TAction) . Enabled : = False ;
end ;
2020-01-23 18:43:09 +00:00
procedure TfEditorContratosCliente. actRechazarExecute( Sender: TObject) ;
begin
cambiarSituacion( SITUACION_CONTRATO_RECHAZADO) ;
end ;
procedure TfEditorContratosCliente. actRechazarUpdate( Sender: TObject) ;
begin
inherited ;
( Sender as TAction) . Enabled : = HayDatos
and ViewGrid. esSeleccionCeldaDatos
and ( FContratos. SITUACION = SITUACION_CONTRATO_PENDIENTE) ;
end ;
procedure TfEditorContratosCliente. actGenerarReciboCliExecute( Sender: TObject) ;
begin
inherited ;
GenerarReciboCli( Contratos. ID) ;
actRefrescar. Execute;
end ;
procedure TfEditorContratosCliente. actGenerarReciboCliUpdate( Sender: TObject) ;
begin
inherited ;
( Sender as TAction) . Enabled : = HayDatos
and not ( ViewGrid. NumSeleccionados > 1 )
and ViewGrid. esSeleccionCeldaDatos
and ( FContratos. SITUACION = SITUACION_CONTRATO_ACEPTADO)
and ( FContratos. FACTURA_ASOCIADA = '' ) ;
end ;
2019-11-18 10:36:42 +00:00
procedure TfEditorContratosCliente. actVerFacturasProveedorExecute(
Sender: TObject) ;
begin
inherited ;
FController. VerFacturasProveedor( Contratos) ;
end ;
procedure TfEditorContratosCliente. actVerPedidosProveedorExecute(
Sender: TObject) ;
begin
inherited ;
FController. VerPedidosProveedor( Contratos) ;
end ;
procedure TfEditorContratosCliente. AsignarVista;
begin
ViewGrid : = CreateView( TfrViewContratosCliente) as IViewContratosCliente;
end ;
procedure TfEditorContratosCliente. bArmarioClick( Sender: TObject) ;
begin
inherited ;
if FController. Anadir( Contratos, teArmario) then
FController. Ver( Contratos) ;
end ;
procedure TfEditorContratosCliente. bBanoClick( Sender: TObject) ;
begin
inherited ;
if FController. Anadir( Contratos, teBano) then
FController. Ver( Contratos) ;
end ;
procedure TfEditorContratosCliente. bCocinaClick( Sender: TObject) ;
begin
inherited ;
if FController. Anadir( Contratos, teCocina) then
FController. Ver( Contratos) ;
end ;
procedure TfEditorContratosCliente. bElectrodomesticoClick( Sender: TObject) ;
begin
inherited ;
if FController. Anadir( Contratos, teElectrodomestico) then
FController. Ver( Contratos) ;
end ;
procedure TfEditorContratosCliente. bObraClick( Sender: TObject) ;
begin
inherited ;
if FController. Anadir( Contratos, teObra) then
FController. Ver( Contratos) ;
end ;
procedure TfEditorContratosCliente. bVariosClick( Sender: TObject) ;
begin
inherited ;
if FController. Anadir( Contratos, teVarios) then
FController. Ver( Contratos) ;
end ;
2020-01-23 18:43:09 +00:00
procedure TfEditorContratosCliente. cambiarSituacion( const ASituacion: String ) ;
var
AContratos: IBizContratoCliente;
AllItems: Boolean ;
AFecha: TDate;
begin
AContratos : = Nil ;
AllItems : = False ;
//Pedimos fecha de decision y realizamos todo el proceso de asignacion, en el caso de no darla no se hace nada
if ElegirFechaDecisionContrato( AFecha) then
begin
if MultiSelect and Assigned( ViewGrid) then
AllItems : = ( ViewGrid. NumSeleccionados > 1 ) ;
if AllItems then
begin
SeleccionarFilasDesdeGrid( ViewGrid. _FocusedView, ( Contratos as ISeleccionable) . SelectedRecords) ;
AContratos : = ( Controller as IContratosClienteController) . ExtraerSeleccionados( Contratos) as IBizContratoCliente;
end
else begin
AContratos : = Contratos;
end ;
ViewGrid. _Grid. BeginUpdate;
if Assigned( AContratos) then
begin
FController. CambiarSituacion( AContratos, ASituacion, AFecha, AllItems) ;
actRefrescar. Execute;
end ;
ViewGrid. _Grid. EndUpdate;
end ;
end ;
2019-11-18 10:36:42 +00:00
constructor TfEditorContratosCliente. Create( AOwner: TComponent) ;
begin
inherited ;
// FHeaderText := 'Lista de Contratos de cliente';
// FWindowCaption := FHeaderText;
AsignarVista;
end ;
destructor TfEditorContratosCliente. Destroy;
begin
FContratos : = NIL ;
FController : = NIL ;
inherited ;
end ;
procedure TfEditorContratosCliente. DuplicarInterno;
var
APresupuesto : IBizContratoCliente;
begin
inherited ;
APresupuesto : = FController. Duplicar( Contratos) ;
try
FController. Ver( APresupuesto) ;
finally
actRefrescar. Execute;
end ;
end ;
procedure TfEditorContratosCliente. EliminarInterno;
var
AContratos: IBizContratoCliente;
AllItems: Boolean ;
begin
AContratos : = Nil ;
AllItems : = False ;
if MultiSelect and Assigned( ViewGrid) then
AllItems : = ( ViewGrid. NumSeleccionados > 1 ) ;
if AllItems then
begin
if ( Application. MessageBox( '<27> Desea borrar los Contratos seleccionados?' , 'Atenci<63> n' , MB_YESNO) = IDYES) then
begin
SeleccionarFilasDesdeGrid( ViewGrid. _FocusedView, ( Contratos as ISeleccionable) . SelectedRecords) ;
AContratos : = ( Controller as IContratosClienteController) . ExtraerSeleccionados( Contratos) as IBizContratoCliente;
end
end
else begin
if ( Application. MessageBox( '<27> Desea borrar el presupuesto seleccionado?' , 'Atenci<63> n' , MB_YESNO) = IDYES) then
AContratos : = Contratos;
end ;
if Assigned( AContratos) then
begin
FController. Eliminar( AContratos, AllItems) ;
if AllItems then
begin
if ( AContratos. DataTable. RecordCount > 0 ) then
begin
with AContratos. DataTable do
begin
First;
while not EOF do
begin
JsListaContratosNoEliminados. Content. Add( 'Ref. Presupuesto: ' + AContratos. REFERENCIA + ' ' + AContratos. NOMBRE) ;
Next;
end ;
end ;
JsListaContratosNoEliminados. Execute;
end ;
actRefrescar. Execute;
end ;
end ;
ViewGrid. GotoFirst;
end ;
procedure TfEditorContratosCliente. FormShow( Sender: TObject) ;
begin
cbxListaAnos. OnChange : = OnListaAnosChange; //OJO SIEMPRE ANTES DEL INHERITED
inherited ;
if not Assigned( ViewGrid) then
raise Exception. Create( 'No hay ninguna vista asignada' ) ;
if not Assigned( Contratos) then
raise Exception. Create( 'No hay ning<6E> n Presupuesto asignado' ) ;
Contratos. DataTable. Active : = True ;
ViewGrid. GotoFirst;
end ;
function TfEditorContratosCliente. GetController: IContratosClienteController;
begin
Result : = FController;
end ;
function TfEditorContratosCliente. GetContratos: IBizContratoCliente;
begin
Result : = FContratos;
end ;
procedure TfEditorContratosCliente. ImprimirInterno;
var
Respuesta : Integer ;
AContratos: IBizContratoCliente;
AllItems: Boolean ;
2021-03-04 14:07:54 +00:00
FVerCondiciones : Boolean ;
2019-11-18 10:36:42 +00:00
begin
AContratos : = Nil ;
AllItems : = False ;
2021-03-04 14:07:54 +00:00
FVerCondiciones : = False ;
2019-11-18 10:36:42 +00:00
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
2 0 0 : begin // Lista de elementos visibles
inherited ;
end ;
1 0 0 : begin // Elemento Seleccionado
if AllItems then
begin
SeleccionarFilasDesdeGrid( ViewGrid. _FocusedView, ( Contratos as ISeleccionable) . SelectedRecords) ;
AContratos : = ( Controller as IContratosClienteController) . ExtraerSeleccionados( Contratos) as IBizContratoCliente;
end
else
AContratos : = Contratos;
if Assigned( AContratos) then
2021-03-04 14:07:54 +00:00
FVerCondiciones : = ShowConfirmMessage( 'Previsualizar presupuesto' , '<27> Desea previsualizar Montadores/Enganches?' ) = IDYES;
FController. Print( AContratos, AllItems, FVerCondiciones) ;
2019-11-18 10:36:42 +00:00
end ;
end ;
end ;
end ;
end ;
procedure TfEditorContratosCliente. ModificarInterno;
begin
inherited ;
2024-05-20 16:09:11 +00:00
if ( Length( Trim( Contratos. FACTURA_ASOCIADA) ) > 0 ) then
begin
if ( ShowConfirmMessage( '<27> Atenci<63> n!, el presupuesto tiene al menos una factura asociada, "no deber<65> a modificar nada", antes hablar con M<> nica.' , '<27> Desea continuar?' ) = IDYES) then
FController. Ver( Contratos) ;
end
else
FController. Ver( Contratos) ;
2019-11-18 10:36:42 +00:00
end ;
procedure TfEditorContratosCliente. NuevoInterno;
begin
inherited ;
if FController. Anadir( Contratos) then
FController. Ver( Contratos) ;
end ;
procedure TfEditorContratosCliente. OnListaAnosChange( Sender: TObject; const Text : string ) ;
begin
Controller. FiltrarAno( Contratos, DynWhereDataTable, Text ) ;
if Contratos. DataTable. Active then
RefrescarInterno;
end ;
procedure TfEditorContratosCliente. PonerTitulos( const ATitulo: string ) ;
var
FTitulo : String ;
begin
if ( ATitulo = '' ) then
2020-01-23 18:43:09 +00:00
FTitulo : = 'Lista de presupuestos de cliente - ' + AppFactuGES. EmpresaActiva. NOMBRE
2019-11-18 10:36:42 +00:00
else
FTitulo : = ATitulo;
inherited PonerTitulos( FTitulo) ;
end ;
procedure TfEditorContratosCliente. PrevisualizarInterno;
var
Respuesta : Integer ;
AContratos: IBizContratoCliente;
AllItems: Boolean ;
2021-03-04 14:07:54 +00:00
FVerCondiciones : Boolean ;
2019-11-18 10:36:42 +00:00
begin
AContratos : = Nil ;
AllItems : = False ;
2021-03-04 14:07:54 +00:00
FVerCondiciones : = False ;
2019-11-18 10:36:42 +00:00
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
2 0 0 : begin // Lista de elementos visibles
inherited ;
end ;
1 0 0 : begin // Elemento Seleccionado
if AllItems then
begin
SeleccionarFilasDesdeGrid( ViewGrid. _FocusedView, ( Contratos as ISeleccionable) . SelectedRecords) ;
AContratos : = ( Controller as IContratosClienteController) . ExtraerSeleccionados( Contratos) as IBizContratoCliente;
end
else
AContratos : = Contratos;
if Assigned( AContratos) then
2021-03-04 14:07:54 +00:00
FVerCondiciones : = ShowConfirmMessage( 'Previsualizar presupuesto' , '<27> Desea previsualizar Montadores/Enganches?' ) = IDYES;
FController. Preview( AContratos, AllItems, FVerCondiciones) ;
2019-11-18 10:36:42 +00:00
end ;
end ;
end ;
end ;
AContratos : = Nil ;
end ;
procedure TfEditorContratosCliente. RefrescarInterno;
begin
//Volvemos a cargar los a<> os de los Contratos
if Assigned( FController) then
ListaAnos : = FController. DarListaAnosContratos;
inherited ;
end ;
procedure TfEditorContratosCliente. SetController( const Value: IContratosClienteController) ;
begin
FController : = Value;
if Assigned( FController) then
ListaAnos : = FController. DarListaAnosContratos;
end ;
procedure TfEditorContratosCliente. SetContratos( const Value: IBizContratoCliente) ;
begin
FContratos : = Value;
if Assigned( FContratos) 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 : = FContratos. DataTable. DynamicWhere. Xml;
dsDataTable. DataTable : = FContratos. DataTable;
if Assigned( ViewGrid) then
( ViewGrid as IViewContratosCliente) . Contratos : = Contratos;
end ;
end ;
end .