Cambio en los informes de Contratos de cliente de todas las entidades: Cambio fecha de entrega por fecha expedicion - Solicitado por Próspero Cambio logo uecko y sellos cabecera en todos los informes de todas las entidades- Solicitado por Noelia Arreglo para que permita introducir DNI y CIFs raros - Solicitado por Mónica Las facturas proforma no se tendrán en cuenta en las facturas asociadas a los contratos, listado de contratos - Solicitado por Eva Se añade comprobación de capitulos para que avise si existe un subtotal sin capitulo correspondiente, ayudará a controlar errores en presupuestos y contratos largos. - Solicitado por Miriam En los detalles de presupuestos y contratos si eligen un articulo de la tarífa el programa no deja modificar las descripciones (Se ha detectado que lo hen hecho en ocasiones en las tiendas) - Solicitado por Miriam git-svn-id: https://192.168.0.254/svn/Proyectos.AbetoDesign_FactuGES/trunk@186 93f398dd-4eb6-7a46-baf6-13f46f578da2
279 lines
11 KiB
ObjectPascal
279 lines
11 KiB
ObjectPascal
unit uViewContratoCliente;
|
||
|
||
interface
|
||
|
||
uses
|
||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||
Dialogs, uViewBase, uBizContratosCliente, DB, uDADataTable, uCustomView,
|
||
AppEvnts, StdCtrls, Mask, DBCtrls,
|
||
uViewObservaciones, uViewDatosYSeleccionCliente,
|
||
cxGraphics, cxDropDownEdit, cxImageComboBox, cxDBEdit, cxContainer, cxEdit,
|
||
cxTextEdit, cxMaskEdit, cxCalendar, dxLayoutControl, cxControls, cxMemo,
|
||
Buttons, ActnList, cxLookupEdit,
|
||
cxDBLookupEdit, cxDBLookupComboBox, uFormasPagoController, uDAInterfaces,
|
||
uBizFormasPago, cxButtonEdit, uViewDatosYSeleccionClienteContrato, uBizContactos,
|
||
uVendedoresController, uViewDireccionEntregaContratoCli, uViewDatosYSeleccionComercial,
|
||
uContratosClienteController, uViewDatosYSeleccionInstalador;
|
||
|
||
type
|
||
IViewContratoCliente = interface(IViewBase)
|
||
['{3DE0231D-760E-437B-88E5-144B88024797}']
|
||
function GetContrato: IBizContratoCliente;
|
||
procedure SetContrato(const Value: IBizContratoCliente);
|
||
property Contrato: IBizContratoCliente read GetContrato write SetContrato;
|
||
|
||
function GetController : IContratosClienteController;
|
||
procedure SetController (const Value : IContratosClienteController);
|
||
property Controller: IContratosClienteController read GetController write SetController;
|
||
|
||
function GetViewClienteContrato: IViewDatosYSeleccionClienteContrato;
|
||
property ViewClienteContrato: IViewDatosYSeleccionClienteContrato read GetViewClienteContrato;
|
||
|
||
function GetViewDireccionEntregaContratoCli: IViewDireccionEntregaContratoCli;
|
||
property ViewDireccionEntregaContratoCli: IViewDireccionEntregaContratoCli read GetViewDireccionEntregaContratoCli;
|
||
end;
|
||
|
||
TfrViewContratoCliente = class(TfrViewBase, IViewContratoCliente)
|
||
DADataSource: TDADataSource;
|
||
dxLayoutControl1Group_Root: TdxLayoutGroup;
|
||
dxLayoutControl1: TdxLayoutControl;
|
||
dxLayoutControl1Item2: TdxLayoutItem;
|
||
edtFechaContrato: TcxDBDateEdit;
|
||
dxLayoutControl1Group1: TdxLayoutGroup;
|
||
dxLayoutControl1Group2: TdxLayoutGroup;
|
||
dxLayoutControl1Item6: TdxLayoutItem;
|
||
memObservaciones: TcxDBMemo;
|
||
dxLayoutControl1Item3: TdxLayoutItem;
|
||
eReferencia: TcxDBTextEdit;
|
||
dxLayoutControl1Group7: TdxLayoutGroup;
|
||
ActionList1: TActionList;
|
||
dxLayoutControl1Item4: TdxLayoutItem;
|
||
cbFormaPago: TcxDBLookupComboBox;
|
||
dxLayoutControl1Item5: TdxLayoutItem;
|
||
bFormasPago: TButton;
|
||
dsFormaPago: TDADataSource;
|
||
cbSituacion: TcxDBImageComboBox;
|
||
dxLayoutControl1Item10: TdxLayoutItem;
|
||
dxLayoutControl1Group8: TdxLayoutGroup;
|
||
frViewDatosYSeleccionClienteContrato1: TfrViewDatosYSeleccionClienteContrato;
|
||
dxLayoutControl1Item1: TdxLayoutItem;
|
||
dxLayoutControl1Item8: TdxLayoutItem;
|
||
memFormaPago: TcxDBMemo;
|
||
dxLayoutControl1Group3: TdxLayoutGroup;
|
||
dxLayoutControl1Item9: TdxLayoutItem;
|
||
memPlazoEntrega: TcxDBMemo;
|
||
dxLayoutControl1Group4: TdxLayoutGroup;
|
||
dxLayoutControl1Group6: TdxLayoutGroup;
|
||
dxLayoutControl1Item11: TdxLayoutItem;
|
||
dxLayoutControl1Group9: TdxLayoutGroup;
|
||
cbVendedor: TcxDBLookupComboBox;
|
||
dsVendedor: TDADataSource;
|
||
dxLayoutControl1Item7: TdxLayoutItem;
|
||
cbTipoContrato: TcxDBComboBox;
|
||
dxLayoutControl1Group11: TdxLayoutGroup;
|
||
dxLayoutControl1Item12: TdxLayoutItem;
|
||
edtlReferenciaCliente: TcxDBTextEdit;
|
||
dxLayoutControl1Group5: TdxLayoutGroup;
|
||
dxLayoutControl1Item13: TdxLayoutItem;
|
||
frViewDireccionEntregaContratoCli1: TfrViewDireccionEntregaContratoCli;
|
||
dxLayoutControl1Item14: TdxLayoutItem;
|
||
frViewDatosYSeleccionComercial1: TfrViewDatosYSeleccionComercial;
|
||
dxLayoutControl1Group10: TdxLayoutGroup;
|
||
dxLayoutControl1Item15: TdxLayoutItem;
|
||
frViewDatosYSeleccionInstalador1: TfrViewDatosYSeleccionInstalador;
|
||
procedure CustomViewCreate(Sender: TObject);
|
||
procedure CustomViewDestroy(Sender: TObject);
|
||
procedure bFormasPagoClick(Sender: TObject);
|
||
procedure frViewClienteContratoButton1Click(Sender: TObject);
|
||
procedure frViewClienteContratoButton2Click(Sender: TObject);
|
||
procedure cbFormaPagoPropertiesValidate(Sender: TObject;
|
||
var DisplayValue: Variant; var ErrorText: TCaption; var Error: Boolean);
|
||
protected
|
||
FContrato : IBizContratoCliente;
|
||
FController : IContratosClienteController;
|
||
FFormasPago : IBizFormaPago;
|
||
FVendedor : IBizVendedor;
|
||
FFormasPagoController : IFormasPagoController;
|
||
FVendedoresController : IVendedoresController;
|
||
FViewClienteContrato : IViewDatosYSeleccionClienteContrato;
|
||
FViewDireccionEntregaContratoCli : IViewDireccionEntregaContratoCli;
|
||
|
||
function GetContrato: IBizContratoCliente;
|
||
procedure SetContrato(const Value: IBizContratoCliente); virtual;
|
||
|
||
function GetController : IContratosClienteController;
|
||
procedure SetController (const Value : IContratosClienteController);
|
||
|
||
function GetViewClienteContrato: IViewDatosYSeleccionClienteContrato;
|
||
function GetViewDireccionEntregaContratoCli: IViewDireccionEntregaContratoCli;
|
||
|
||
procedure OnComercialChanged(Sender : TObject);
|
||
procedure OnInstaladorChanged(Sender : TObject);
|
||
|
||
public
|
||
property Contrato: IBizContratoCliente read GetContrato write SetContrato;
|
||
property Controller: IContratosClienteController read GetController write SetController;
|
||
|
||
property ViewClienteContrato: IViewDatosYSeleccionClienteContrato read GetViewClienteContrato;
|
||
property ViewDireccionEntregaContratoCli: IViewDireccionEntregaContratoCli read GetViewDireccionEntregaContratoCli;
|
||
|
||
end;
|
||
|
||
implementation
|
||
|
||
{$R *.dfm}
|
||
|
||
{ TfrViewContratoCliente }
|
||
|
||
uses
|
||
schContratosClienteClient_Intf, uClientesController, uBizDireccionesContacto, uFactuGES_App;
|
||
|
||
|
||
procedure TfrViewContratoCliente.bFormasPagoClick(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
if Assigned(FFormasPago) then
|
||
FFormasPagoController.VerTodos(FFormasPago);
|
||
end;
|
||
|
||
procedure TfrViewContratoCliente.cbFormaPagoPropertiesValidate(Sender: TObject;
|
||
var DisplayValue: Variant; var ErrorText: TCaption; var Error: Boolean);
|
||
begin
|
||
inherited;
|
||
Contrato.DataTable.FieldByName(fld_ContratosClienteFORMA_PAGO).AsString := FFormasPago.DESCRIPCION;
|
||
end;
|
||
|
||
procedure TfrViewContratoCliente.CustomViewCreate(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
FFormasPago := Nil;
|
||
FVendedor := Nil;
|
||
FFormasPagoController := TFormasPagoController.Create;
|
||
FVendedoresController := TVendedoresController.Create;
|
||
FViewClienteContrato := frViewDatosYSeleccionClienteContrato1;
|
||
FViewDireccionEntregaContratoCli := frViewDireccionEntregaContratoCli1;
|
||
|
||
//FILTRO DE EMPRESAS
|
||
if (AppFactuGES.EmpresaActiva.ID = CTE_EMPRESA_ABETO) then
|
||
begin
|
||
dxLayoutControl1Group10.Visible := true;
|
||
frViewDatosYSeleccionInstalador1.Visible := true;
|
||
dxLayoutControl1Item15.visible := true;
|
||
end
|
||
else
|
||
begin
|
||
dxLayoutControl1Group10.Visible := false;
|
||
frViewDatosYSeleccionInstalador1.Visible := false;
|
||
dxLayoutControl1Item15.visible := false;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrViewContratoCliente.CustomViewDestroy(Sender: TObject);
|
||
begin
|
||
frViewDatosYSeleccionComercial1.OnComercialChanged := Nil;
|
||
frViewDatosYSeleccionInstalador1.OnInstaladorChanged := Nil;
|
||
FFormasPago := Nil;
|
||
FFormasPagoController := NIL;
|
||
FVendedor := Nil;
|
||
FVendedoresController := NIL;
|
||
FViewClienteContrato := NIL;
|
||
FViewDireccionEntregaContratoCli := NIL;
|
||
inherited;
|
||
end;
|
||
|
||
procedure TfrViewContratoCliente.frViewClienteContratoButton1Click(Sender: TObject);
|
||
begin
|
||
if Assigned(Contrato) and Assigned(Contrato.Cliente) and
|
||
Assigned (Contrato.Detalles) and (Contrato.Detalles.RecordCount > 0) then
|
||
begin
|
||
if (Application.MessageBox('Los descuentos de los art<72>culos del Contrato ser<65>n actualizados con los del nuevo cliente seleccionado, <20>Desea continuar?', 'Atenci<63>n', MB_YESNO) = IDNO) then
|
||
Exit;
|
||
end;
|
||
frViewDatosYSeleccionClienteContrato1.actElegirContacto.Execute;
|
||
end;
|
||
|
||
procedure TfrViewContratoCliente.frViewClienteContratoButton2Click(Sender: TObject);
|
||
begin
|
||
if Assigned(Contrato) and Assigned(Contrato.Cliente) and
|
||
Assigned (Contrato.Detalles) and (Contrato.Detalles.RecordCount > 0) then
|
||
begin
|
||
if (Application.MessageBox('Los descuentos de los art<72>culos del Contrato ser<65>n actualizados con los del nuevo cliente seleccionado, <20>Desea continuar?', 'Atenci<63>n', MB_YESNO) = IDNO) then
|
||
Exit;
|
||
end;
|
||
frViewDatosYSeleccionClienteContrato1.actAnadirContacto.Execute;
|
||
end;
|
||
|
||
function TfrViewContratoCliente.GetContrato: IBizContratoCliente;
|
||
begin
|
||
Result := FContrato;
|
||
end;
|
||
|
||
function TfrViewContratoCliente.GetController: IContratosClienteController;
|
||
begin
|
||
Result := FController;
|
||
end;
|
||
|
||
function TfrViewContratoCliente.GetViewClienteContrato: IViewDatosYSeleccionClienteContrato;
|
||
begin
|
||
Result := FViewClienteContrato;
|
||
end;
|
||
|
||
function TfrViewContratoCliente.GetViewDireccionEntregaContratoCli: IViewDireccionEntregaContratoCli;
|
||
begin
|
||
Result := FViewDireccionEntregaContratoCli;
|
||
end;
|
||
|
||
procedure TfrViewContratoCliente.OnComercialChanged(Sender: TObject);
|
||
begin
|
||
if Assigned(FContrato) then
|
||
begin
|
||
FController.CambiarComercial(FContrato, frViewDatosYSeleccionComercial1.Comercial);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrViewContratoCliente.OnInstaladorChanged(Sender: TObject);
|
||
begin
|
||
if Assigned(FContrato) then
|
||
begin
|
||
FController.CambiarInstalador(FContrato, frViewDatosYSeleccionInstalador1.Instalador);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrViewContratoCliente.SetContrato(const Value: IBizContratoCliente);
|
||
begin
|
||
FContrato := Value;
|
||
if Assigned(FContrato) then
|
||
begin
|
||
DADataSource.DataTable := FContrato.DataTable;
|
||
|
||
FFormasPago := FFormasPagoController.BuscarTodos;
|
||
dsFormaPago.DataTable := FFormasPago.DataTable;
|
||
dsFormaPago.DataTable.Active := True;
|
||
|
||
FVendedor := (FVendedoresController.BuscarTodos as IBizVendedor);
|
||
dsVendedor.DataTable := FVendedor.DataTable;
|
||
dsVendedor.DataTable.Active := True;
|
||
|
||
FViewClienteContrato.Contrato := FContrato;
|
||
frViewDireccionEntregaContratoCli1.ContratoCliente := FContrato;
|
||
|
||
frViewDatosYSeleccionComercial1.ID_Comercial := FContrato.ID_AGENTE;
|
||
frViewDatosYSeleccionComercial1.OnComercialChanged := OnComercialChanged;
|
||
frViewDatosYSeleccionInstalador1.ID_Instalador := FContrato.ID_INSTALADOR;
|
||
frViewDatosYSeleccionInstalador1.OnInstaladorChanged := OnInstaladorChanged;
|
||
end
|
||
else begin
|
||
DADataSource.DataTable := NIL;
|
||
dsFormaPago.DataTable := NIL;
|
||
dsVendedor.DataTable := NIL;
|
||
FViewClienteContrato.Contrato := Nil;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrViewContratoCliente.SetController(const Value: IContratosClienteController);
|
||
begin
|
||
FController := Value;
|
||
end;
|
||
|
||
end.
|