2007-10-26 18:19:55 +00:00
|
|
|
|
unit uEditorPresupuestoCliente;
|
|
|
|
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
|
|
|
|
|
|
|
uses
|
|
|
|
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
|
|
|
|
uEditorDBItem, DB, uDADataTable, JvAppStorage,
|
|
|
|
|
|
JvAppRegistryStorage, JvComponent, JvFormPlacement, ImgList,
|
|
|
|
|
|
PngImageList, StdActns, ActnList, ComCtrls, TBX, TB2Item, TB2Dock,
|
|
|
|
|
|
TB2Toolbar, ExtCtrls, JvExControls, JvNavigationPane,
|
|
|
|
|
|
uCustomView, uViewBase, JvComponentBase,
|
|
|
|
|
|
StdCtrls, pngimage, AppEvnts, cxControls, cxContainer, cxEdit, cxTextEdit, cxMemo, cxDBEdit,
|
|
|
|
|
|
uViewIncidencias,
|
|
|
|
|
|
uPresupuestosClienteController,
|
|
|
|
|
|
uViewDetallesBase,
|
|
|
|
|
|
dxLayoutLookAndFeels, JvExComCtrls, JvStatusBar, uViewTotales,
|
|
|
|
|
|
uIEditorPresupuestoCliente, uBizPresupuestosCliente, uViewPresupuestoCliente,
|
|
|
|
|
|
uViewDetallesDTO, uViewDetallesArticulos, uViewDetallesPresupuestoCliente,
|
2008-08-06 18:18:27 +00:00
|
|
|
|
uDAInterfaces, cxRichEdit, cxDBRichEdit, JvGIF, uViewRichEditor, cxPC,
|
2008-08-27 14:17:04 +00:00
|
|
|
|
uViewDetallesArticulosParaVenta, uViewDocumentos,
|
2008-11-06 11:19:46 +00:00
|
|
|
|
uViewDocumentosPresupuestoCliente, uViewDatosYSeleccionClientePresupuesto,
|
2008-11-11 18:55:52 +00:00
|
|
|
|
cxLabel, uViewTotalesPresupuesto;
|
2007-10-26 18:19:55 +00:00
|
|
|
|
|
|
|
|
|
|
type
|
|
|
|
|
|
TfEditorPresupuestoCliente = class(TfEditorDBItem, IEditorPresupuestoCliente)
|
|
|
|
|
|
pagContenido: TTabSheet;
|
|
|
|
|
|
pagInicidencias: TTabSheet;
|
|
|
|
|
|
frViewIncidenciasCli: TfrViewIncidencias;
|
|
|
|
|
|
dxLayoutLookAndFeelList1: TdxLayoutLookAndFeelList;
|
|
|
|
|
|
dxLayoutOfficeLookAndFeel1: TdxLayoutOfficeLookAndFeel;
|
2007-11-13 19:36:56 +00:00
|
|
|
|
pagPortada: TTabSheet;
|
|
|
|
|
|
pagMemoria: TTabSheet;
|
2007-12-11 16:24:53 +00:00
|
|
|
|
Panel1: TPanel;
|
|
|
|
|
|
Image2: TImage;
|
|
|
|
|
|
Panel2: TPanel;
|
|
|
|
|
|
Image3: TImage;
|
|
|
|
|
|
frViewRichEditor1: TfrViewRichEditor;
|
|
|
|
|
|
frViewRichEditor2: TfrViewRichEditor;
|
2008-02-05 15:31:14 +00:00
|
|
|
|
frViewDetallesPresupuestoCliente1: TfrViewDetallesPresupuestoCliente;
|
2008-08-06 18:18:27 +00:00
|
|
|
|
actGenerarCertificado: TAction;
|
|
|
|
|
|
TBXSubmenuItem2: TTBXSubmenuItem;
|
|
|
|
|
|
TBXItem7: TTBXItem;
|
|
|
|
|
|
TBXSeparatorItem6: TTBXSeparatorItem;
|
|
|
|
|
|
TBXItem33: TTBXItem;
|
2008-08-21 17:01:02 +00:00
|
|
|
|
actEnviarPorEMail: TAction;
|
|
|
|
|
|
TBXItem34: TTBXItem;
|
|
|
|
|
|
TBXItem35: TTBXItem;
|
2008-08-27 14:17:04 +00:00
|
|
|
|
pagDocumentos: TTabSheet;
|
|
|
|
|
|
frViewDocumentosPresupuestoCliente1: TfrViewDocumentosPresupuestoCliente;
|
2008-11-11 18:55:52 +00:00
|
|
|
|
frViewTotalesPresupuesto1: TfrViewTotalesPresupuesto;
|
2007-10-26 18:19:55 +00:00
|
|
|
|
|
2007-11-13 19:36:56 +00:00
|
|
|
|
procedure FormShow(Sender: TObject);
|
2007-10-26 18:19:55 +00:00
|
|
|
|
procedure CustomEditorClose(Sender: TObject; var Action: TCloseAction);
|
|
|
|
|
|
procedure frViewTotales1ePortePropertiesValidate(Sender: TObject;
|
|
|
|
|
|
var DisplayValue: Variant; var ErrorText: TCaption; var Error: Boolean);
|
2008-08-06 18:18:27 +00:00
|
|
|
|
procedure actGenerarCertificadoExecute(Sender: TObject);
|
|
|
|
|
|
procedure actGenerarCertificadoUpdate(Sender: TObject);
|
2008-08-12 14:02:15 +00:00
|
|
|
|
procedure pgPaginasChanging(Sender: TObject; var AllowChange: Boolean);
|
2008-08-21 17:01:02 +00:00
|
|
|
|
procedure actEnviarPorEMailExecute(Sender: TObject);
|
|
|
|
|
|
procedure actEnviarPorEMailUpdate(Sender: TObject);
|
2008-08-27 16:15:43 +00:00
|
|
|
|
procedure actEliminarUpdate(Sender: TObject);
|
2012-06-28 11:43:25 +00:00
|
|
|
|
procedure pagPortadaShow(Sender: TObject);
|
|
|
|
|
|
procedure pagMemoriaShow(Sender: TObject);
|
2007-10-26 18:19:55 +00:00
|
|
|
|
private
|
|
|
|
|
|
procedure RecalcularPortePorUnidad;
|
|
|
|
|
|
|
|
|
|
|
|
protected
|
2007-11-05 17:49:11 +00:00
|
|
|
|
FPresupuesto: IBizPresupuestoCliente;
|
|
|
|
|
|
FViewPresupuesto: IViewPresupuestoCliente;
|
2008-09-19 10:11:52 +00:00
|
|
|
|
FViewClientePresupuesto :IViewDatosYSeleccionClientePresupuesto;
|
2007-10-26 18:19:55 +00:00
|
|
|
|
FController : IPresupuestosClienteController;
|
|
|
|
|
|
|
|
|
|
|
|
function GetController : IPresupuestosClienteController;
|
|
|
|
|
|
procedure SetController (const Value : IPresupuestosClienteController); virtual;
|
|
|
|
|
|
|
2007-11-05 17:49:11 +00:00
|
|
|
|
function GetPresupuesto: IBizPresupuestoCliente;
|
|
|
|
|
|
procedure SetPresupuesto(const Value: IBizPresupuestoCliente); virtual;
|
2007-10-26 18:19:55 +00:00
|
|
|
|
|
2007-11-05 17:49:11 +00:00
|
|
|
|
function GetViewPresupuesto: IViewPresupuestoCliente;
|
|
|
|
|
|
procedure SetViewPresupuesto(const Value: IViewPresupuestoCliente);
|
2007-10-26 18:19:55 +00:00
|
|
|
|
|
|
|
|
|
|
procedure PrevisualizarInterno; override;
|
|
|
|
|
|
procedure ImprimirInterno; override;
|
|
|
|
|
|
procedure GuardarInterno; override;
|
|
|
|
|
|
procedure EliminarInterno; override;
|
|
|
|
|
|
|
2007-11-05 17:49:11 +00:00
|
|
|
|
property ViewPresupuesto: IViewPresupuestoCliente read GetViewPresupuesto write SetViewPresupuesto;
|
2007-10-26 18:19:55 +00:00
|
|
|
|
|
|
|
|
|
|
procedure OnClienteChanged(Sender : TObject);
|
|
|
|
|
|
|
|
|
|
|
|
//Si queremos crear otra vista para el editor heredado solo tendriamos que
|
|
|
|
|
|
//sobreescribir este metodo
|
|
|
|
|
|
procedure AsignarVista; virtual;
|
|
|
|
|
|
|
|
|
|
|
|
procedure PonerTitulos(const ATitulo: string = ''); override;
|
2008-08-28 15:12:50 +00:00
|
|
|
|
function GetModified: Boolean; override;
|
|
|
|
|
|
procedure SetModified(const Value : Boolean); override;
|
2009-11-25 12:24:10 +00:00
|
|
|
|
function PuedoImprimir: Boolean; override;
|
|
|
|
|
|
function PuedoEnviar: Boolean; virtual;
|
2008-08-28 15:12:50 +00:00
|
|
|
|
|
2007-10-26 18:19:55 +00:00
|
|
|
|
public
|
|
|
|
|
|
property Controller : IPresupuestosClienteController read GetController write SetController;
|
2007-11-05 17:49:11 +00:00
|
|
|
|
property Presupuesto: IBizPresupuestoCliente read GetPresupuesto write SetPresupuesto;
|
2007-10-26 18:19:55 +00:00
|
|
|
|
constructor Create(AOwner: TComponent); override;
|
|
|
|
|
|
destructor Destroy; override;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
|
|
|
|
|
|
uses
|
|
|
|
|
|
uViewDatosYSeleccionCliente, uDataModuleUsuarios, uClientesController,
|
2010-07-12 18:03:50 +00:00
|
|
|
|
uBizDireccionesContacto, uDialogUtils, uFactuGES_App, uDataTableUtils,
|
|
|
|
|
|
uDialogOpcionesImpresionPresupuestosCliente;
|
2007-10-26 18:19:55 +00:00
|
|
|
|
|
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
|
|
|
|
|
|
|
{ TfEditorPresupuestoCliente }
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
**************************** TfEditorPresupuestoCliente ****************************
|
|
|
|
|
|
}
|
2008-08-27 16:15:43 +00:00
|
|
|
|
procedure TfEditorPresupuestoCliente.actEliminarUpdate(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
if (Sender as TAction).Enabled then
|
|
|
|
|
|
(Sender as TAction).Enabled := (FPresupuesto.SITUACION = SITUACION_PRESUPUESTO_PENDIENTE);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2008-08-21 17:01:02 +00:00
|
|
|
|
procedure TfEditorPresupuestoCliente.actEnviarPorEMailExecute(Sender: TObject);
|
|
|
|
|
|
begin
|
2009-11-25 12:24:10 +00:00
|
|
|
|
if actEnviarPorEMail.Enabled then
|
|
|
|
|
|
begin
|
|
|
|
|
|
if Modified then
|
|
|
|
|
|
begin
|
|
|
|
|
|
if (ShowConfirmMessage('Se han producido cambios', 'Se han producido cambios y no se puede enviar por email hasta que no se guarden.' + #10#13 +
|
|
|
|
|
|
'<27>Desea guardarlos ahora?') = IDYES) then
|
|
|
|
|
|
begin
|
|
|
|
|
|
GuardarInterno;
|
|
|
|
|
|
FController.EnviarPresupuestoPorEMail(Presupuesto);
|
|
|
|
|
|
end
|
|
|
|
|
|
else
|
|
|
|
|
|
ShowInfoMessage('Recuerde guardar los cambios si quiere enviar por email.');
|
|
|
|
|
|
end
|
|
|
|
|
|
else
|
|
|
|
|
|
FController.EnviarPresupuestoPorEMail(Presupuesto);
|
|
|
|
|
|
end;
|
2008-08-21 17:01:02 +00:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorPresupuestoCliente.actEnviarPorEMailUpdate(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
2009-11-25 12:24:10 +00:00
|
|
|
|
(Sender as TAction).Enabled := HayDatos and PuedoEnviar;
|
2008-08-21 17:01:02 +00:00
|
|
|
|
end;
|
|
|
|
|
|
|
2008-08-06 18:18:27 +00:00
|
|
|
|
procedure TfEditorPresupuestoCliente.actGenerarCertificadoExecute(
|
|
|
|
|
|
Sender: TObject);
|
|
|
|
|
|
begin
|
2008-08-08 10:19:02 +00:00
|
|
|
|
if FController.GenerarCertificados(Presupuesto, False) then
|
|
|
|
|
|
ShowInfoMessage('Generar certificado de trabajo', 'Se ha generado el certificado de trabajos.')
|
2008-08-06 18:18:27 +00:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorPresupuestoCliente.actGenerarCertificadoUpdate(
|
|
|
|
|
|
Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
(Sender as TAction).Enabled := HayDatos and
|
|
|
|
|
|
(FPresupuesto.SITUACION = SITUACION_PRESUPUESTO_ACEPTADO);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2007-10-26 18:19:55 +00:00
|
|
|
|
procedure TfEditorPresupuestoCliente.AsignarVista;
|
|
|
|
|
|
var
|
|
|
|
|
|
AViewPresupuestoCliente: TfrViewPresupuestoCliente;
|
|
|
|
|
|
|
|
|
|
|
|
begin
|
|
|
|
|
|
AViewPresupuestoCliente := TfrViewPresupuestoCliente.create(Self);
|
|
|
|
|
|
with AViewPresupuestoCliente do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Parent := pagGeneral;
|
|
|
|
|
|
Align := alClient;
|
|
|
|
|
|
dxLayoutControl1.LookAndFeel := dxLayoutOfficeLookAndFeel1;
|
|
|
|
|
|
end;
|
2007-11-05 17:49:11 +00:00
|
|
|
|
ViewPresupuesto := AViewPresupuestoCliente;
|
2007-10-26 18:19:55 +00:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
constructor TfEditorPresupuestoCliente.Create(AOwner: TComponent);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
pgPaginas.ActivePageIndex := 0;
|
|
|
|
|
|
AsignarVista;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorPresupuestoCliente.CustomEditorClose(Sender: TObject;
|
|
|
|
|
|
var Action: TCloseAction);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
2008-08-27 16:15:43 +00:00
|
|
|
|
//GESTION_DOCUMENTOS
|
|
|
|
|
|
//Este m<>todo eliminar<61> el directorio temporal si se ha creado
|
|
|
|
|
|
frViewDocumentosPresupuestoCliente1.actEliminarTodo.Execute;
|
2008-11-11 18:55:52 +00:00
|
|
|
|
|
2007-11-05 17:49:11 +00:00
|
|
|
|
FViewPresupuesto := NIL;
|
2008-09-19 10:11:52 +00:00
|
|
|
|
FViewClientePresupuesto := NIL;
|
2007-11-05 17:49:11 +00:00
|
|
|
|
FPresupuesto := NIL;
|
2007-10-26 18:19:55 +00:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
destructor TfEditorPresupuestoCliente.Destroy;
|
|
|
|
|
|
begin
|
|
|
|
|
|
// Utilizar mejor OnClose;
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorPresupuestoCliente.EliminarInterno;
|
|
|
|
|
|
begin
|
2008-06-02 10:30:38 +00:00
|
|
|
|
if (ShowConfirmMessage('<27>Desea borrar este presupuesto de cliente?', '') = IDYES) then
|
2007-10-26 18:19:55 +00:00
|
|
|
|
begin
|
2007-11-05 17:49:11 +00:00
|
|
|
|
FController.Eliminar(FPresupuesto);
|
2007-10-26 18:19:55 +00:00
|
|
|
|
inherited
|
|
|
|
|
|
end
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorPresupuestoCliente.FormShow(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
|
2007-11-05 17:49:11 +00:00
|
|
|
|
if not Assigned(FViewPresupuesto) then
|
2007-10-26 18:19:55 +00:00
|
|
|
|
raise Exception.Create('No hay ninguna vista asignada');
|
|
|
|
|
|
|
2007-11-05 17:49:11 +00:00
|
|
|
|
if not Assigned(Presupuesto) then
|
2008-09-19 10:11:52 +00:00
|
|
|
|
raise Exception.Create('No hay ning<6E>n presupuesto asignado');
|
2007-10-26 18:19:55 +00:00
|
|
|
|
|
|
|
|
|
|
pgPaginas.ActivePage := pagGeneral;
|
2013-06-04 16:13:04 +00:00
|
|
|
|
//Para AZACAN NO HAY PORTADA EN PRESUPUESTOS
|
|
|
|
|
|
if (AppFactuGES.EmpresaActiva.ID = 3) then
|
|
|
|
|
|
pagPortada.TabVisible := false;
|
|
|
|
|
|
|
2008-09-19 10:11:52 +00:00
|
|
|
|
Presupuesto.DataTable.Active := True;
|
2007-10-26 18:19:55 +00:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorPresupuestoCliente.frViewTotales1ePortePropertiesValidate(
|
|
|
|
|
|
Sender: TObject; var DisplayValue: Variant; var ErrorText: TCaption;
|
|
|
|
|
|
var Error: Boolean);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
2008-11-11 18:55:52 +00:00
|
|
|
|
{ if (not VarIsNull(DisplayValue)) and (Length(DisplayValue) > 0) then
|
2007-11-05 17:49:11 +00:00
|
|
|
|
FPresupuesto.IMPORTE_PORTE := DisplayValue
|
2007-10-26 18:19:55 +00:00
|
|
|
|
else
|
2007-11-05 17:49:11 +00:00
|
|
|
|
FPresupuesto.IMPORTE_PORTE := 0;
|
2008-11-11 18:55:52 +00:00
|
|
|
|
}
|
2007-12-05 19:10:31 +00:00
|
|
|
|
// RecalcularPortePorUnidad; En los documentos de cliente no se desglosa el porte por articulo
|
2007-10-26 18:19:55 +00:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
function TfEditorPresupuestoCliente.GetController: IPresupuestosClienteController;
|
|
|
|
|
|
begin
|
|
|
|
|
|
Result := FController;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2008-08-28 15:12:50 +00:00
|
|
|
|
function TfEditorPresupuestoCliente.GetModified: Boolean;
|
|
|
|
|
|
begin
|
2008-12-23 10:48:13 +00:00
|
|
|
|
// inherited; <- No llamar al padre porque queremos tratamiento especial.
|
|
|
|
|
|
if ReadOnly then
|
|
|
|
|
|
Result := False
|
|
|
|
|
|
else begin
|
|
|
|
|
|
Result := DataTableModified(dsDataTable.DataTable);
|
|
|
|
|
|
|
|
|
|
|
|
if not Result then
|
|
|
|
|
|
Result := frViewDocumentosPresupuestoCliente1.Modified;
|
|
|
|
|
|
end;
|
2008-08-28 15:12:50 +00:00
|
|
|
|
end;
|
|
|
|
|
|
|
2007-11-05 17:49:11 +00:00
|
|
|
|
function TfEditorPresupuestoCliente.GetPresupuesto: IBizPresupuestoCliente;
|
2007-10-26 18:19:55 +00:00
|
|
|
|
begin
|
2007-11-05 17:49:11 +00:00
|
|
|
|
Result := FPresupuesto;
|
2007-10-26 18:19:55 +00:00
|
|
|
|
end;
|
|
|
|
|
|
|
2007-11-05 17:49:11 +00:00
|
|
|
|
function TfEditorPresupuestoCliente.GetViewPresupuesto: IViewPresupuestoCliente;
|
2007-10-26 18:19:55 +00:00
|
|
|
|
begin
|
2007-11-05 17:49:11 +00:00
|
|
|
|
Result := FViewPresupuesto;
|
2007-10-26 18:19:55 +00:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorPresupuestoCliente.GuardarInterno;
|
|
|
|
|
|
var
|
|
|
|
|
|
bEsNuevo : Boolean;
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
|
|
|
|
|
|
ShowHourglassCursor;
|
|
|
|
|
|
// frViewDetallesPresupuestoCliente1.SaveGridStatus;
|
|
|
|
|
|
frViewDetallesPresupuestoCliente1.BeginUpdate;
|
|
|
|
|
|
try
|
2007-11-05 17:49:11 +00:00
|
|
|
|
bEsNuevo := FPresupuesto.EsNuevo;
|
2008-08-27 16:15:43 +00:00
|
|
|
|
//GESTION_DOCUMENTOS
|
|
|
|
|
|
if FController.Guardar(FPresupuesto) then
|
|
|
|
|
|
frViewDocumentosPresupuestoCliente1.actActualizarServidor.Execute;
|
2008-08-27 14:17:04 +00:00
|
|
|
|
|
2007-10-26 18:19:55 +00:00
|
|
|
|
finally
|
|
|
|
|
|
frViewDetallesPresupuestoCliente1.EndUpdate;
|
|
|
|
|
|
// frViewDetallesPresupuestoCliente1.RestoreGridStatus;
|
|
|
|
|
|
HideHourglassCursor;
|
|
|
|
|
|
end;
|
|
|
|
|
|
if bEsNuevo then
|
2008-08-20 15:17:37 +00:00
|
|
|
|
ShowInfoMessage('El presupuesto se ha dado de alta con el c<>digo ' + FPresupuesto.REFERENCIA);
|
2007-10-26 18:19:55 +00:00
|
|
|
|
|
|
|
|
|
|
Modified := False;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorPresupuestoCliente.ImprimirInterno;
|
2010-07-12 18:03:50 +00:00
|
|
|
|
var
|
|
|
|
|
|
AVerSello: Integer;
|
|
|
|
|
|
bPrevisualizar: Boolean;
|
2007-10-26 18:19:55 +00:00
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
2010-07-12 18:03:50 +00:00
|
|
|
|
bPrevisualizar := True;
|
|
|
|
|
|
|
|
|
|
|
|
if (AppFactuGES.EmpresaActiva.ID = 1) then
|
|
|
|
|
|
//Preguntamos si desea que en los presupuestos se vea el Sello de Paco u Oscar,
|
|
|
|
|
|
//solo para empresa Tecsitel
|
2014-02-18 22:41:52 +00:00
|
|
|
|
bPrevisualizar := ElegirOpcionesImpresionPresupuestoCliente(AVerSello);
|
2010-07-12 18:03:50 +00:00
|
|
|
|
|
|
|
|
|
|
if bPrevisualizar and Assigned(FPresupuesto) then
|
|
|
|
|
|
if not Modified then
|
2014-02-18 22:41:52 +00:00
|
|
|
|
FController.Print(FPresupuesto, False, AVerSello);
|
2007-10-26 18:19:55 +00:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorPresupuestoCliente.OnClienteChanged(Sender: TObject);
|
|
|
|
|
|
begin
|
2007-11-05 17:49:11 +00:00
|
|
|
|
if Assigned(FPresupuesto) then
|
2008-12-11 15:50:00 +00:00
|
|
|
|
begin
|
|
|
|
|
|
FPresupuesto.Cliente := ViewPresupuesto.ViewClientePresupuesto.Cliente;
|
|
|
|
|
|
|
2009-03-27 10:57:28 +00:00
|
|
|
|
//Desactivado porque en presupuestos no utilizan el cat<61>logo de clientes
|
|
|
|
|
|
// if (FPresupuesto.Detalles.RecordCount > 0) then
|
|
|
|
|
|
// FController.DetallesController.ActualizarDetalles(FPresupuesto.Detalles, FPresupuesto.Cliente);
|
2008-12-11 15:50:00 +00:00
|
|
|
|
end;
|
2007-10-26 18:19:55 +00:00
|
|
|
|
end;
|
|
|
|
|
|
|
2012-06-28 11:43:25 +00:00
|
|
|
|
procedure TfEditorPresupuestoCliente.pagMemoriaShow(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
frViewRichEditor2.RichEdit.SetFocus;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorPresupuestoCliente.pagPortadaShow(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
frViewRichEditor1.RichEdit.SetFocus;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2008-08-12 14:02:15 +00:00
|
|
|
|
procedure TfEditorPresupuestoCliente.pgPaginasChanging(Sender: TObject;
|
|
|
|
|
|
var AllowChange: Boolean);
|
|
|
|
|
|
var
|
|
|
|
|
|
ACadena : String;
|
2007-10-26 18:19:55 +00:00
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
2007-11-05 17:49:11 +00:00
|
|
|
|
if (not Assigned(FPresupuesto)) or (FPresupuesto.ID_CLIENTE = 0) then
|
2007-10-26 18:19:55 +00:00
|
|
|
|
begin
|
2008-08-12 14:02:15 +00:00
|
|
|
|
ACadena := 'Antes de introducir conceptos debe elegir un cliente para este presupuesto';
|
|
|
|
|
|
ShowWarningMessage(ACadena);
|
|
|
|
|
|
AllowChange := False;
|
2007-12-20 21:05:11 +00:00
|
|
|
|
end
|
2007-10-26 18:19:55 +00:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorPresupuestoCliente.PonerTitulos(const ATitulo: string);
|
|
|
|
|
|
var
|
|
|
|
|
|
FTitulo : String;
|
|
|
|
|
|
begin
|
|
|
|
|
|
FTitulo := ATitulo;
|
2007-11-05 17:49:11 +00:00
|
|
|
|
if (FTitulo = '') and Assigned(FPresupuesto) then
|
2007-10-26 18:19:55 +00:00
|
|
|
|
begin
|
2007-11-05 17:49:11 +00:00
|
|
|
|
if FPresupuesto.EsNuevo then
|
2007-11-18 15:07:51 +00:00
|
|
|
|
FTitulo := 'Nuevo presupuesto de cliente'
|
2007-10-26 18:19:55 +00:00
|
|
|
|
else
|
2007-11-05 17:49:11 +00:00
|
|
|
|
FTitulo := 'Presupuesto de cliente' + ' - ' + FPresupuesto.Cliente.Nombre + ' - ' + FPresupuesto.SITUACION;
|
2007-10-26 18:19:55 +00:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
inherited PonerTitulos(FTitulo);
|
2007-11-18 15:07:51 +00:00
|
|
|
|
Self.Caption := FTitulo + ' (' + AppFactuGES.EmpresaActiva.NOMBRE + ')';
|
2007-10-26 18:19:55 +00:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorPresupuestoCliente.PrevisualizarInterno;
|
2010-07-12 18:03:50 +00:00
|
|
|
|
var
|
|
|
|
|
|
AVerSello: Integer;
|
|
|
|
|
|
bPrevisualizar: Boolean;
|
2007-10-26 18:19:55 +00:00
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
2010-07-12 18:03:50 +00:00
|
|
|
|
bPrevisualizar := True;
|
|
|
|
|
|
|
|
|
|
|
|
if (AppFactuGES.EmpresaActiva.ID = 1) then
|
|
|
|
|
|
//Preguntamos si desea que en los presupuestos se vea el Sello de Paco u Oscar,
|
|
|
|
|
|
//solo para empresa Tecsitel
|
2014-02-18 22:41:52 +00:00
|
|
|
|
bPrevisualizar := ElegirOpcionesImpresionPresupuestoCliente(AVerSello);
|
2010-07-12 18:03:50 +00:00
|
|
|
|
|
|
|
|
|
|
if bPrevisualizar and Assigned(FPresupuesto) then
|
|
|
|
|
|
if not Modified then
|
2014-02-18 22:41:52 +00:00
|
|
|
|
FController.Preview(FPresupuesto, False, AVerSello);
|
2007-10-26 18:19:55 +00:00
|
|
|
|
end;
|
|
|
|
|
|
|
2009-11-25 12:24:10 +00:00
|
|
|
|
function TfEditorPresupuestoCliente.PuedoEnviar: Boolean;
|
|
|
|
|
|
begin
|
|
|
|
|
|
Result := not Presupuesto.Cliente.IDIsNull;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2009-11-24 11:10:50 +00:00
|
|
|
|
function TfEditorPresupuestoCliente.PuedoImprimir: Boolean;
|
|
|
|
|
|
begin
|
|
|
|
|
|
Result := inherited PuedoImprimir and (not Presupuesto.Cliente.IDIsNull);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2007-10-26 18:19:55 +00:00
|
|
|
|
procedure TfEditorPresupuestoCliente.RecalcularPortePorUnidad;
|
|
|
|
|
|
begin
|
|
|
|
|
|
//Esta l<>gica se llamar<61> en el editor porque es para facilitar el rellenado de informaci<63>n del documento
|
|
|
|
|
|
//no puede ir en la clase de negocio porque no es una l<>gica que tenga sentido fuera del editor.
|
|
|
|
|
|
if Assigned(Controller)
|
|
|
|
|
|
and Assigned(Controller.DetallesController) then
|
2007-11-05 17:49:11 +00:00
|
|
|
|
Controller.DetallesController.DesglosarPorteDetalles(FPresupuesto.IMPORTE_PORTE, FPresupuesto.Detalles)
|
2007-10-26 18:19:55 +00:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorPresupuestoCliente.SetController(const Value: IPresupuestosClienteController);
|
|
|
|
|
|
begin
|
|
|
|
|
|
FController := Value;
|
|
|
|
|
|
|
|
|
|
|
|
if Assigned(FController) then
|
|
|
|
|
|
begin
|
2008-09-19 10:11:52 +00:00
|
|
|
|
// ViewPresupuesto.ViewClientePresupuesto.Controller := Controller.ClienteController;
|
2007-10-26 18:19:55 +00:00
|
|
|
|
frViewDetallesPresupuestoCliente1.Controller := Controller.DetallesController;
|
2008-11-11 18:55:52 +00:00
|
|
|
|
|
2008-08-27 16:15:43 +00:00
|
|
|
|
//GESTION_DOCUMENTOS
|
2008-08-27 14:17:04 +00:00
|
|
|
|
frViewDocumentosPresupuestoCliente1.Controller := Controller;
|
2008-11-11 18:55:52 +00:00
|
|
|
|
|
|
|
|
|
|
frViewTotalesPresupuesto1.Controller := FController;
|
2007-10-26 18:19:55 +00:00
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2008-08-28 15:12:50 +00:00
|
|
|
|
procedure TfEditorPresupuestoCliente.SetModified(const Value: Boolean);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
frViewDocumentosPresupuestoCliente1.Modified := Value;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2007-11-05 17:49:11 +00:00
|
|
|
|
procedure TfEditorPresupuestoCliente.SetPresupuesto(const Value: IBizPresupuestoCliente);
|
2007-10-26 18:19:55 +00:00
|
|
|
|
begin
|
2007-11-05 17:49:11 +00:00
|
|
|
|
FPresupuesto := Value;
|
2007-10-26 18:19:55 +00:00
|
|
|
|
|
2007-11-05 17:49:11 +00:00
|
|
|
|
if Assigned(FPresupuesto) then
|
2007-10-26 18:19:55 +00:00
|
|
|
|
begin
|
2007-11-05 17:49:11 +00:00
|
|
|
|
dsDataTable.DataTable := FPresupuesto.DataTable;
|
2007-10-26 18:19:55 +00:00
|
|
|
|
frViewIncidenciasCli.DADataSource.DataTable := dsDataTable.DataTable;
|
2008-11-11 18:55:52 +00:00
|
|
|
|
frViewTotalesPresupuesto1.DADataSource.DataTable := dsDataTable.DataTable;
|
2008-11-27 16:14:51 +00:00
|
|
|
|
|
2007-11-05 17:49:11 +00:00
|
|
|
|
if Assigned(FViewPresupuesto) then
|
2007-10-26 18:19:55 +00:00
|
|
|
|
begin
|
2008-08-20 15:17:37 +00:00
|
|
|
|
ViewPresupuesto.ViewClientePresupuesto.OnClienteChanged := NIL;
|
2008-09-19 10:11:52 +00:00
|
|
|
|
try
|
|
|
|
|
|
FViewPresupuesto.Presupuesto := FPresupuesto;
|
|
|
|
|
|
frViewDetallesPresupuestoCliente1.Detalles := FPresupuesto.Detalles;
|
|
|
|
|
|
frViewDetallesPresupuestoCliente1.Presupuesto := FPresupuesto; //Para poder sacar los descuento del articulos segun el cliente seleccionado
|
|
|
|
|
|
|
|
|
|
|
|
//GESTION_DOCUMENTOS
|
|
|
|
|
|
frViewDocumentosPresupuestoCliente1.Presupuesto := FPresupuesto;
|
2008-11-11 18:55:52 +00:00
|
|
|
|
|
|
|
|
|
|
frViewTotalesPresupuesto1.Presupuesto := FPresupuesto;
|
2008-11-27 16:14:51 +00:00
|
|
|
|
|
2008-09-19 10:11:52 +00:00
|
|
|
|
finally
|
|
|
|
|
|
ViewPresupuesto.ViewClientePresupuesto.OnClienteChanged := OnClienteChanged;
|
|
|
|
|
|
end;
|
2007-10-26 18:19:55 +00:00
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2007-11-05 17:49:11 +00:00
|
|
|
|
procedure TfEditorPresupuestoCliente.SetViewPresupuesto(const Value: IViewPresupuestoCliente);
|
2007-10-26 18:19:55 +00:00
|
|
|
|
begin
|
2007-11-05 17:49:11 +00:00
|
|
|
|
FViewPresupuesto := Value;
|
2007-10-26 18:19:55 +00:00
|
|
|
|
|
2008-09-19 10:11:52 +00:00
|
|
|
|
if Assigned(FViewPresupuesto) then
|
|
|
|
|
|
begin
|
|
|
|
|
|
FViewClientePresupuesto := FViewPresupuesto.ViewClientePresupuesto;
|
|
|
|
|
|
|
|
|
|
|
|
if Assigned(Presupuesto) then
|
|
|
|
|
|
FViewPresupuesto.Presupuesto := Presupuesto;
|
|
|
|
|
|
end;
|
2007-10-26 18:19:55 +00:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
end.
|