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
260 lines
6.3 KiB
ObjectPascal
260 lines
6.3 KiB
ObjectPascal
unit uIdiomasController;
|
|
|
|
interface
|
|
|
|
|
|
uses
|
|
Classes, SysUtils, uDADataTable, uEditorDBItem,
|
|
uIDataModuleIdiomas, uBizIdiomas, uControllerBase;
|
|
|
|
type
|
|
IIdiomasController = interface(IControllerBase)
|
|
['{A591421F-8F4A-4B4C-ADCD-17070BBA4602}']
|
|
function BuscarTodos: IBizIdioma;
|
|
function BuscarTodosMenosDefault: IBizIdioma;
|
|
// procedure VerTodos(AIdiomas: IBizIdioma);
|
|
// procedure Anadir(AFamilia : IBizIdioma);
|
|
// function Eliminar(AFamilia : IBizIdioma): Boolean;
|
|
// function Guardar(AFamilia : IBizIdioma): Boolean;
|
|
// procedure DescartarCambios(AFamilia : IBizIdioma);
|
|
// function Localizar(AIdiomas: IBizIdioma; ADescripcion:String): Boolean;
|
|
function DarListaIdiomas: TStringList;
|
|
end;
|
|
|
|
TIdiomasController = class(TControllerBase, IIdiomasController)
|
|
protected
|
|
FDataModule : IDataModuleIdiomas;
|
|
|
|
// procedure RecibirAviso(ASujeto: ISujeto; ADataTable: IDAStronglyTypedDataTable); override;
|
|
function CreateEditor(const AName : String; const IID: TGUID; out Intf): Boolean;
|
|
|
|
// function ValidarAlmacen(AFamilia: IBizIdioma): Boolean;
|
|
|
|
//Estos son los tres métodos a sobre escribir si se desea heredar toda la logica de
|
|
//este controller
|
|
procedure AsignarDataModule; virtual;
|
|
procedure ValidarObjetos; virtual;
|
|
|
|
public
|
|
constructor Create; override;
|
|
destructor Destroy; override;
|
|
|
|
// function Eliminar(AFamilia : IBizIdioma): Boolean;
|
|
// function Guardar(AFamilia : IBizIdioma): Boolean;
|
|
// procedure DescartarCambios(AFamilia : IBizIdioma); virtual;
|
|
// procedure Anadir(AFamilia : IBizIdioma);
|
|
function BuscarTodos: IBizIdioma;
|
|
function BuscarTodosMenosDefault: IBizIdioma;
|
|
// procedure VerTodos(AIdiomas: IBizIdioma);
|
|
// function Localizar(AIdiomas: IBizIdioma; ADescripcion:String): Boolean;
|
|
function DarListaIdiomas: TStringList;
|
|
end;
|
|
|
|
implementation
|
|
|
|
uses
|
|
cxControls, DB, uEditorRegistryUtils, schIdiomasClient_Intf,
|
|
uDataModuleIdiomas,
|
|
// uIEditorIdiomas,
|
|
uDAInterfaces, uDataTableUtils,
|
|
uDateUtils, uROTypes, DateUtils, Controls, Windows;
|
|
|
|
{ TIdiomasController }
|
|
{
|
|
procedure TIdiomasController.Anadir(AFamilia: IBizIdioma);
|
|
begin
|
|
AFamilia.Insert;
|
|
end;
|
|
}
|
|
procedure TIdiomasController.AsignarDataModule;
|
|
begin
|
|
FDataModule := TDataModuleIdiomas.Create(Nil);
|
|
end;
|
|
|
|
function TIdiomasController.BuscarTodos: IBizIdioma;
|
|
begin
|
|
Result := FDataModule.GetItems;
|
|
end;
|
|
|
|
function TIdiomasController.BuscarTodosMenosDefault: IBizIdioma;
|
|
var
|
|
Condicion: TDAWhereExpression;
|
|
begin
|
|
ShowHourglassCursor;
|
|
try
|
|
Result := BuscarTodos;
|
|
|
|
with Result.DataTable.DynamicWhere do
|
|
begin
|
|
// (REFERENCIA >= Ref)
|
|
Condicion := NewBinaryExpression(NewField('', fld_IdiomasISO), NewConstant(IDIOMA_DEFAULT, datString), dboNotEqual);
|
|
if IsEmpty then
|
|
Expression := Condicion
|
|
else
|
|
Expression := NewBinaryExpression(Expression, Condicion, dboAnd);
|
|
end;
|
|
|
|
finally
|
|
HideHourglassCursor;
|
|
end;
|
|
end;
|
|
|
|
constructor TIdiomasController.Create;
|
|
begin
|
|
inherited;
|
|
AsignarDataModule;
|
|
end;
|
|
|
|
function TIdiomasController.CreateEditor(const AName: String; const IID: TGUID; out Intf): Boolean;
|
|
begin
|
|
Result := Supports(EditorRegistry.CreateEditor(AName), IID, Intf);
|
|
end;
|
|
|
|
function TIdiomasController.DarListaIdiomas: TStringList;
|
|
var
|
|
AIdiomas: IBizIdioma;
|
|
begin
|
|
AIdiomas := BuscarTodos;
|
|
AIdiomas.DataTable.Active := True;
|
|
Result := TStringList.Create;
|
|
try
|
|
with Result do
|
|
begin
|
|
AIdiomas.DataTable.First;
|
|
while not AIdiomas.DataTable.EOF do
|
|
begin
|
|
Add(AIdiomas.DESCRIPCION);
|
|
AIdiomas.DataTable.Next;
|
|
end;
|
|
end;
|
|
finally
|
|
AIdiomas := NIL;
|
|
end;
|
|
end;
|
|
{
|
|
procedure TIdiomasController.DescartarCambios(AFamilia: IBizIdioma);
|
|
begin
|
|
if not Assigned(AFamilia) then
|
|
raise Exception.Create ('Almacen no asignado');
|
|
|
|
ShowHourglassCursor;
|
|
try
|
|
if (AFamilia.State in dsEditModes) then
|
|
AFamilia.Cancel;
|
|
|
|
AFamilia.DataTable.CancelUpdates;
|
|
finally
|
|
HideHourglassCursor;
|
|
end;
|
|
end;
|
|
}
|
|
destructor TIdiomasController.Destroy;
|
|
begin
|
|
FDataModule := Nil;
|
|
inherited;
|
|
end;
|
|
{
|
|
function TIdiomasController.ValidarAlmacen(AFamilia: IBizIdioma): Boolean;
|
|
begin
|
|
Result := False;
|
|
|
|
if not Assigned(AFamilia) then
|
|
raise Exception.Create ('Familia no asignada');
|
|
|
|
if (AFamilia.DataTable.State in dsEditModes) then
|
|
AFamilia.DataTable.Post;
|
|
|
|
Result := True;
|
|
end;
|
|
}
|
|
procedure TIdiomasController.ValidarObjetos;
|
|
begin
|
|
//
|
|
end;
|
|
{
|
|
procedure TIdiomasController.VerTodos(AIdiomas: IBizIdioma);
|
|
var
|
|
AEditor : IEditorIdiomas;
|
|
begin
|
|
AEditor := NIL;
|
|
|
|
CreateEditor('EditorIdiomas', IEditorIdiomas, AEditor);
|
|
if Assigned(AEditor) then
|
|
try
|
|
AEditor.Controller := Self; //OJO ORDEN MUY IMPORTANTE
|
|
AEditor.Idiomas := AIdiomas;
|
|
AEditor.ShowModal;
|
|
finally
|
|
AEditor.Release;
|
|
AEditor := NIL;
|
|
end;
|
|
end;
|
|
|
|
function TIdiomasController.Eliminar(AFamilia: IBizIdioma): Boolean;
|
|
begin
|
|
Result := False;
|
|
|
|
if not Assigned(AFamilia) then
|
|
raise Exception.Create ('Almacen no asignada');
|
|
|
|
ShowHourglassCursor;
|
|
try
|
|
if (AFamilia.State in dsEditModes) then
|
|
AFamilia.Cancel;
|
|
|
|
AFamilia.Delete;
|
|
AFamilia.DataTable.ApplyUpdates;
|
|
|
|
Result := True;
|
|
finally
|
|
HideHourglassCursor;
|
|
end;
|
|
end;
|
|
|
|
procedure TIdiomasController.RecibirAviso(ASujeto: ISujeto; ADataTable: IDAStronglyTypedDataTable);
|
|
begin
|
|
inherited;
|
|
//
|
|
end;
|
|
|
|
function TIdiomasController.Guardar(AFamilia: IBizIdioma): Boolean;
|
|
begin
|
|
Result := False;
|
|
|
|
if not Assigned(AFamilia) then
|
|
raise Exception.Create ('Familia no asignada');
|
|
|
|
ValidarObjetos;
|
|
|
|
if ValidarAlmacen(AFamilia) then
|
|
begin
|
|
ShowHourglassCursor;
|
|
try
|
|
AFamilia.DataTable.ApplyUpdates;
|
|
Result := True;
|
|
finally
|
|
HideHourglassCursor;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
function TIdiomasController.Localizar(AIdiomas: IBizIdioma; ADescripcion: String): Boolean;
|
|
begin
|
|
Result := True;
|
|
ShowHourglassCursor;
|
|
try
|
|
with AIdiomas.DataTable do
|
|
begin
|
|
DisableControls;
|
|
First;
|
|
if not Locate(fld_IdiomasDESCRIPCION, ADescripcion, []) then
|
|
Result := False;
|
|
EnableControls;
|
|
end;
|
|
finally
|
|
HideHourglassCursor;
|
|
end;
|
|
end;
|
|
}
|
|
end.
|