Generacion automatica de subcuenta en clientes
git-svn-id: https://192.168.0.254/svn/Proyectos.Acana_FactuGES2/trunk@160 f4e31baf-9722-1c47-927c-6f952f962d4b
This commit is contained in:
parent
c304b78a06
commit
2b113642b0
@ -82,6 +82,36 @@ object srvEjercicios: TsrvEjercicios
|
||||
DataDictionary = DataDictionary
|
||||
Diagrams = Diagrams
|
||||
Datasets = <
|
||||
item
|
||||
Params = <
|
||||
item
|
||||
Name = 'ID_EMPRESA'
|
||||
Value = ''
|
||||
ParamType = daptInput
|
||||
end>
|
||||
Statements = <
|
||||
item
|
||||
Connection = 'IBX'
|
||||
ConnectionType = 'Interbase'
|
||||
Default = True
|
||||
Name = 'IBX'
|
||||
SQL =
|
||||
'select ID'#10'from cont_ejercicios'#10'where cont_ejercicios.activo = 1'#10 +
|
||||
'and cont_ejercicios.id_empresa = :ID_EMPRESA'#10
|
||||
StatementType = stSQL
|
||||
ColumnMappings = <
|
||||
item
|
||||
DatasetField = 'ID'
|
||||
TableField = 'ID'
|
||||
end>
|
||||
end>
|
||||
Name = 'darEjercicioActivo'
|
||||
Fields = <
|
||||
item
|
||||
Name = 'ID'
|
||||
DataType = datInteger
|
||||
end>
|
||||
end
|
||||
item
|
||||
Params = <>
|
||||
Statements = <
|
||||
|
||||
@ -31,14 +31,15 @@ type
|
||||
|
||||
protected
|
||||
function GenerarPGC(const ID_EJERCICIO_COPIA: Integer; const ID_EJERCICIO: Integer): Boolean;
|
||||
|
||||
public
|
||||
function DarEjercicioActivo(const ID_EMPRESA: Integer): Integer;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.dfm}
|
||||
uses
|
||||
{Generated:} FactuGES_Invk, uBizEjerciciosServer, uDataModuleServer, uROClasses,
|
||||
{Generated:} FactuGES_Invk, uDAInterfaces, uBizEjerciciosServer, uDataModuleServer, uROClasses,
|
||||
uDatabaseUtils;
|
||||
|
||||
procedure Create_srvEjercicios(out anInstance : IUnknown);
|
||||
@ -47,6 +48,30 @@ begin
|
||||
end;
|
||||
|
||||
{ srvEjercicios }
|
||||
function TsrvEjercicios.DarEjercicioActivo(const ID_EMPRESA: Integer): Integer;
|
||||
var
|
||||
AConn : IDAConnection;
|
||||
dsData: IDADataset;
|
||||
|
||||
begin
|
||||
AConn := dmServer.ConnectionManager.NewConnection(dmServer.ConnectionManager.GetDefaultConnectionName);
|
||||
|
||||
try
|
||||
try
|
||||
dsData := schEjercicios.NewDataset(AConn, 'darEjercicioActivo', ['ID_EMPRESA'], [ID_EMPRESA]);
|
||||
dsData.Active := True;
|
||||
Result := dsData.FieldValues[0];
|
||||
AConn.CommitTransaction;
|
||||
|
||||
except
|
||||
RaiseError('Error al buscar ejercicio activo de la empresa');
|
||||
AConn.RollbackTransaction;
|
||||
end;
|
||||
finally
|
||||
dsData := NIL;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TsrvEjercicios.DARemoteServiceCreate(Sender: TObject);
|
||||
begin
|
||||
SessionManager := dmServer.SessionManager;
|
||||
|
||||
Binary file not shown.
@ -10,6 +10,7 @@
|
||||
<Projects Include="..\..\GUIBase\GUIBase.dproj" />
|
||||
<Projects Include="..\..\Servidor\FactuGES_Server.dproj" />
|
||||
<Projects Include="..\Articulos\Views\Articulos_view.dproj" />
|
||||
<Projects Include="..\Contactos\Controller\Contactos_controller.dproj" />
|
||||
<Projects Include="..\Contactos\Views\Contactos_view.dproj" />
|
||||
<Projects Include="..\Facturas de cliente\Views\FacturasCliente_view.dproj" />
|
||||
<Projects Include="..\Facturas de proveedor\Views\FacturasProveedor_view.dproj" />
|
||||
@ -52,6 +53,15 @@
|
||||
<Target Name="ApplicationBase:Make">
|
||||
<MSBuild Projects="..\..\ApplicationBase\ApplicationBase.dproj" Targets="Make" />
|
||||
</Target>
|
||||
<Target Name="Contactos_controller">
|
||||
<MSBuild Projects="..\Contactos\Controller\Contactos_controller.dproj" Targets="" />
|
||||
</Target>
|
||||
<Target Name="Contactos_controller:Clean">
|
||||
<MSBuild Projects="..\Contactos\Controller\Contactos_controller.dproj" Targets="Clean" />
|
||||
</Target>
|
||||
<Target Name="Contactos_controller:Make">
|
||||
<MSBuild Projects="..\Contactos\Controller\Contactos_controller.dproj" Targets="Make" />
|
||||
</Target>
|
||||
<Target Name="Contactos_view">
|
||||
<MSBuild Projects="..\Contactos\Views\Contactos_view.dproj" Targets="" />
|
||||
</Target>
|
||||
@ -152,13 +162,13 @@
|
||||
<MSBuild Projects="..\Articulos\Views\Articulos_view.dproj" Targets="Make" />
|
||||
</Target>
|
||||
<Target Name="Build">
|
||||
<CallTarget Targets="Base;GUIBase;ApplicationBase;Contactos_view;Contabilidad_model;Contabilidad_data;Contabilidad_controller;Contabilidad_view;Contabilidad_plugin;FactuGES;FactuGES_Server;FacturasProveedor_view;FacturasCliente_view;Articulos_view" />
|
||||
<CallTarget Targets="Base;GUIBase;ApplicationBase;Contactos_controller;Contactos_view;Contabilidad_model;Contabilidad_data;Contabilidad_controller;Contabilidad_view;Contabilidad_plugin;FactuGES;FactuGES_Server;FacturasProveedor_view;FacturasCliente_view;Articulos_view" />
|
||||
</Target>
|
||||
<Target Name="Clean">
|
||||
<CallTarget Targets="Base:Clean;GUIBase:Clean;ApplicationBase:Clean;Contactos_view:Clean;Contabilidad_model:Clean;Contabilidad_data:Clean;Contabilidad_controller:Clean;Contabilidad_view:Clean;Contabilidad_plugin:Clean;FactuGES:Clean;FactuGES_Server:Clean;FacturasProveedor_view:Clean;FacturasCliente_view:Clean;Articulos_view:Clean" />
|
||||
<CallTarget Targets="Base:Clean;GUIBase:Clean;ApplicationBase:Clean;Contactos_controller:Clean;Contactos_view:Clean;Contabilidad_model:Clean;Contabilidad_data:Clean;Contabilidad_controller:Clean;Contabilidad_view:Clean;Contabilidad_plugin:Clean;FactuGES:Clean;FactuGES_Server:Clean;FacturasProveedor_view:Clean;FacturasCliente_view:Clean;Articulos_view:Clean" />
|
||||
</Target>
|
||||
<Target Name="Make">
|
||||
<CallTarget Targets="Base:Make;GUIBase:Make;ApplicationBase:Make;Contactos_view:Make;Contabilidad_model:Make;Contabilidad_data:Make;Contabilidad_controller:Make;Contabilidad_view:Make;Contabilidad_plugin:Make;FactuGES:Make;FactuGES_Server:Make;FacturasProveedor_view:Make;FacturasCliente_view:Make;Articulos_view:Make" />
|
||||
<CallTarget Targets="Base:Make;GUIBase:Make;ApplicationBase:Make;Contactos_controller:Make;Contactos_view:Make;Contabilidad_model:Make;Contabilidad_data:Make;Contabilidad_controller:Make;Contabilidad_view:Make;Contabilidad_plugin:Make;FactuGES:Make;FactuGES_Server:Make;FacturasProveedor_view:Make;FacturasCliente_view:Make;Articulos_view:Make" />
|
||||
</Target>
|
||||
<Import Condition="Exists('$(MSBuildBinPath)\Borland.Group.Targets')" Project="$(MSBuildBinPath)\Borland.Group.Targets" />
|
||||
</Project>
|
||||
@ -338,6 +338,110 @@ object srvContabilidad: TsrvContabilidad
|
||||
DataDictionary = DataDictionary
|
||||
Diagrams = Diagrams
|
||||
Datasets = <
|
||||
item
|
||||
Params = <
|
||||
item
|
||||
Name = 'ID_EMPRESA'
|
||||
Value = ''
|
||||
ParamType = daptInput
|
||||
end
|
||||
item
|
||||
Name = 'ID_TIENDA'
|
||||
Value = ''
|
||||
ParamType = daptInput
|
||||
end>
|
||||
Statements = <
|
||||
item
|
||||
Connection = 'IBX'
|
||||
ConnectionType = 'Interbase'
|
||||
Default = True
|
||||
Name = 'IBX'
|
||||
SQL =
|
||||
'select CODIGO_CONTABLE'#10'from empresas_tiendas'#10'where ID_EMPRESA = ' +
|
||||
':ID_EMPRESA'#10'and ID = :ID_TIENDA'#10
|
||||
StatementType = stSQL
|
||||
ColumnMappings = <
|
||||
item
|
||||
DatasetField = 'CODIGO_CONTABLE'
|
||||
TableField = 'CODIGO_CONTABLE'
|
||||
end>
|
||||
end>
|
||||
Name = 'DarCodigoContableTienda'
|
||||
Fields = <
|
||||
item
|
||||
Name = 'CODIGO_CONTABLE'
|
||||
DataType = datString
|
||||
Size = 2
|
||||
end>
|
||||
end
|
||||
item
|
||||
Params = <
|
||||
item
|
||||
Name = 'ID_EJERCICIO'
|
||||
Value = ''
|
||||
ParamType = daptInput
|
||||
end
|
||||
item
|
||||
Name = 'REF_CUENTA'
|
||||
Value = ''
|
||||
ParamType = daptInput
|
||||
end>
|
||||
Statements = <
|
||||
item
|
||||
Connection = 'IBX'
|
||||
ConnectionType = 'Interbase'
|
||||
Default = True
|
||||
Name = 'IBX'
|
||||
SQL =
|
||||
'select max(cast(substr(cont_subcuentas.ref_subcuenta, 6, 10) as ' +
|
||||
'Integer))'#10'from cont_subcuentas'#10'left join cont_cuentas on cont_cu' +
|
||||
'entas.id = cont_subcuentas.id_cuenta'#10'where cont_subcuentas.id_ej' +
|
||||
'ercicio = :ID_EJERCICIO'#10'and cont_cuentas.ref_cuenta = :REF_CUENT' +
|
||||
'A'#10
|
||||
StatementType = stSQL
|
||||
ColumnMappings = <
|
||||
item
|
||||
DatasetField = 'MAX'
|
||||
TableField = 'MAX'
|
||||
end>
|
||||
end>
|
||||
Name = 'DarMaxRefSubCuenta'
|
||||
Fields = <
|
||||
item
|
||||
Name = 'MAX'
|
||||
DataType = datInteger
|
||||
end>
|
||||
end
|
||||
item
|
||||
Params = <
|
||||
item
|
||||
Name = 'ID_CONTACTO'
|
||||
Value = ''
|
||||
ParamType = daptInput
|
||||
end>
|
||||
Statements = <
|
||||
item
|
||||
Connection = 'IBX'
|
||||
ConnectionType = 'Interbase'
|
||||
Default = True
|
||||
Name = 'IBX'
|
||||
SQL =
|
||||
'select COUNT(ID)'#10'from CONT_SUBCUENTAS'#10'where ID_CONTACTO = :ID_CO' +
|
||||
'NTACTO'#10'and {where}'#10#10#10
|
||||
StatementType = stSQL
|
||||
ColumnMappings = <
|
||||
item
|
||||
DatasetField = 'COUNT'
|
||||
TableField = 'COUNT'
|
||||
end>
|
||||
end>
|
||||
Name = 'ExisteSubCuenta'
|
||||
Fields = <
|
||||
item
|
||||
Name = 'COUNT'
|
||||
DataType = datInteger
|
||||
end>
|
||||
end
|
||||
item
|
||||
Params = <>
|
||||
Statements = <
|
||||
@ -1117,6 +1221,44 @@ object srvContabilidad: TsrvContabilidad
|
||||
JoinDataTables = <>
|
||||
UnionDataTables = <>
|
||||
Commands = <
|
||||
item
|
||||
Params = <
|
||||
item
|
||||
Name = 'REFERENCIA'
|
||||
Value = ''
|
||||
end
|
||||
item
|
||||
Name = 'DESCRIPCION'
|
||||
Value = ''
|
||||
end
|
||||
item
|
||||
Name = 'ID_CUENTA'
|
||||
Value = ''
|
||||
end
|
||||
item
|
||||
Name = 'ID_EJERCICIO'
|
||||
Value = ''
|
||||
end
|
||||
item
|
||||
Name = 'ID_CONTACTO'
|
||||
Value = ''
|
||||
end>
|
||||
Statements = <
|
||||
item
|
||||
Connection = 'IBX'
|
||||
ConnectionType = 'Interbase'
|
||||
Default = True
|
||||
Name = 'IBX'
|
||||
SQL =
|
||||
'insert into CONT_SUBCUENTAS (ID, REF_SUBCUENTA, DESCRIPCION, ID_' +
|
||||
'CUENTA, ID_EJERCICIO, ID_CONTACTO)'#10'values (GEN_ID(gen_cont_subcu' +
|
||||
'entas_id, 1), :REFERENCIA, :DESCRIPCION, :ID_CUENTA, :ID_EJERCIC' +
|
||||
'IO, :ID_CONTACTO)'#10
|
||||
StatementType = stSQL
|
||||
ColumnMappings = <>
|
||||
end>
|
||||
Name = 'AnadirSubCuenta'
|
||||
end
|
||||
item
|
||||
Params = <
|
||||
item
|
||||
|
||||
@ -16,7 +16,11 @@ uses
|
||||
{Used RODLs:} DataAbstract4_Intf,
|
||||
{Generated:} FactuGES_Intf, uDADataTable, uDABINAdapter, uDAClasses,
|
||||
uDAScriptingProvider, uDABusinessProcessor, uDADataStreamer,
|
||||
uDABin2DataStreamer;
|
||||
uDABin2DataStreamer, uDAInterfaces;
|
||||
|
||||
const
|
||||
REFERENCIA_CLIENTES = 430;
|
||||
REFERENCIA_PROVEEDORES = 400;
|
||||
|
||||
type
|
||||
{ TsrvContabilidad }
|
||||
@ -33,15 +37,21 @@ type
|
||||
procedure DARemoteServiceCreate(Sender: TObject);
|
||||
procedure DataAbstractServiceBeforeAcquireConnection(aSender: TObject; var aConnectionName: string);
|
||||
private
|
||||
protected
|
||||
function darEjercicioActivo(const ID_EMPRESA: Integer): Integer;
|
||||
|
||||
public
|
||||
function TieneCuentaAsociada(const ID_CONTACTO: Integer; const ID_EMPRESA: Integer): Boolean;
|
||||
function AnadirSubCuentaCliente(const ID_CONTACTO: Integer; const ID_TIENDA: Integer; const ID_EMPRESA: Integer): Boolean;
|
||||
function AnadirSubCuentaProveedor(const ID_CONTACTO: Integer; const ID_TIENDA: Integer; const ID_EMPRESA: Integer): Boolean;
|
||||
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.dfm}
|
||||
uses
|
||||
{Generated:} FactuGES_Invk, uDataModuleServer,
|
||||
uDatabaseUtils;
|
||||
{Generated:} FactuGES_Invk, uROClasses, uDataModuleServer,
|
||||
uDatabaseUtils, srvEjercicios_Impl, Variants;
|
||||
|
||||
procedure Create_srvContabilidad(out anInstance : IUnknown);
|
||||
begin
|
||||
@ -49,6 +59,98 @@ begin
|
||||
end;
|
||||
|
||||
{ srvContabilidad }
|
||||
function TsrvContabilidad.AnadirSubCuentaCliente(const ID_CONTACTO, ID_TIENDA: Integer; const ID_EMPRESA: Integer): Boolean;
|
||||
var
|
||||
AConn : IDAConnection;
|
||||
dsData: IDADataset;
|
||||
dsCommand: IDASQLCommand;
|
||||
|
||||
RefSubCuenta: String;
|
||||
NumCuenta: Integer;
|
||||
RefTienda: String;
|
||||
NumTienda: Integer;
|
||||
|
||||
|
||||
begin
|
||||
Result := False;
|
||||
|
||||
AConn := dmServer.ConnectionManager.NewConnection(dmServer.ConnectionManager.GetDefaultConnectionName);
|
||||
|
||||
try
|
||||
try
|
||||
dsData := schContabilidad.NewDataset(AConn, 'DarMaxRefSubCuenta', ['ID_EJERCICIO', 'REF_CUENTA'], [darEjercicioActivo(ID_EMPRESA), REFERENCIA_CLIENTES]);
|
||||
dsData.Active := True;
|
||||
|
||||
if VarIsNull(dsData.FieldValues[0]) then
|
||||
NumCuenta := 0
|
||||
else
|
||||
NumCuenta := dsData.FieldValues[0];
|
||||
|
||||
Inc(NumCuenta);
|
||||
RefSubCuenta := format('%.5d', [NumCuenta]);
|
||||
dsData := NIL;
|
||||
|
||||
dsData := schContabilidad.NewDataset(AConn, 'DarCodigoContableTienda', ['ID_EMPRESA', 'ID_TIENDA'], [ID_EMPRESA, ID_TIENDA]);
|
||||
dsData.Active := True;
|
||||
|
||||
if VarIsNull(dsData.FieldValues[0]) then
|
||||
NumTienda := 0
|
||||
else
|
||||
NumTienda := dsData.FieldValues[0];
|
||||
|
||||
RefTienda := format('%.2d', [NumTienda]);
|
||||
RefSubCuenta := IntToStr(REFERENCIA_CLIENTES) + RefTienda + RefSubCuenta;
|
||||
dsData := NIL;
|
||||
AConn.CommitTransaction;
|
||||
|
||||
except
|
||||
RaiseError('Error al buscar nueva referencia para la subcuenta');
|
||||
AConn.RollbackTransaction;
|
||||
end;
|
||||
finally
|
||||
dsData := NIL;
|
||||
end;
|
||||
|
||||
// AConn := dmServer.ConnectionManager.NewConnection(dmServer.ConnectionManager.GetDefaultConnectionName);
|
||||
|
||||
try
|
||||
try
|
||||
dsCommand := schContabilidad.NewCommand(AConn, 'AnadirSubCuenta');
|
||||
with dsCommand do
|
||||
begin
|
||||
ParamByName('REFERENCIA').AsString := RefSubCuenta;
|
||||
ParamByName('DESCRIPCION').AsString := 'Cuenta de Clieeeeeeeeeeeeeeeeeeeeeeente';
|
||||
ParamByName('ID_CUENTA').AsInteger := 1;
|
||||
ParamByName('ID_EJERCICIO').AsInteger := darEjercicioActivo(ID_EMPRESA);
|
||||
ParamByName('ID_CONTACTO').AsInteger := ID_CONTACTO;
|
||||
end;
|
||||
dsCommand.Execute;
|
||||
AConn.CommitTransaction;
|
||||
Result := True;
|
||||
except
|
||||
RaiseError('Error al crear la nueva subcuenta en tablas');
|
||||
AConn.RollbackTransaction;
|
||||
end;
|
||||
finally
|
||||
dsCommand := NIL;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TsrvContabilidad.AnadirSubCuentaProveedor(const ID_CONTACTO, ID_TIENDA: Integer; const ID_EMPRESA: Integer): Boolean;
|
||||
begin
|
||||
Result := True;
|
||||
end;
|
||||
|
||||
function TsrvContabilidad.darEjercicioActivo(const ID_EMPRESA: Integer): Integer;
|
||||
begin
|
||||
with TsrvEjercicios.Create(NIL) do
|
||||
try
|
||||
Result := DarEjercicioActivo(ID_EMPRESA)
|
||||
finally
|
||||
Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TsrvContabilidad.DARemoteServiceCreate(Sender: TObject);
|
||||
begin
|
||||
SessionManager := dmServer.SessionManager;
|
||||
@ -60,6 +162,45 @@ begin
|
||||
ConnectionName := dmServer.ConnectionName;
|
||||
end;
|
||||
|
||||
function TsrvContabilidad.TieneCuentaAsociada(const ID_CONTACTO: Integer; const ID_EMPRESA: Integer): Boolean;
|
||||
var
|
||||
AConn : IDAConnection;
|
||||
dsData: IDADataset;
|
||||
AWhere : TDAWhereExpression;
|
||||
|
||||
begin
|
||||
Result := False;
|
||||
AWhere := NIL;
|
||||
|
||||
AConn := dmServer.ConnectionManager.NewConnection(dmServer.ConnectionManager.GetDefaultConnectionName);
|
||||
{ Construir la expresión del Where a partir de los parámetros
|
||||
que se han recibido.
|
||||
}
|
||||
with TDAWhereBuilder.Create do
|
||||
try
|
||||
AWhere := NewBinaryExpression(NewField('', 'ID_EJERCICIO'), NewConstant(darEjercicioActivo(ID_EMPRESA), datInteger), dboEqual);
|
||||
finally
|
||||
Free;
|
||||
end;
|
||||
|
||||
try
|
||||
try
|
||||
dsData := schContabilidad.NewDataset(AConn, 'ExisteSubCuenta', ['ID_CONTACTO'], [ID_CONTACTO]);
|
||||
dsData.DynamicWhere.Expression := AWhere;
|
||||
|
||||
dsData.Active := True;
|
||||
Result := (dsData.FieldValues[0] > 0);
|
||||
AConn.CommitTransaction;
|
||||
|
||||
except
|
||||
RaiseError('Error al buscar subcuentas del contacto');
|
||||
AConn.RollbackTransaction;
|
||||
end;
|
||||
finally
|
||||
dsData := NIL;
|
||||
end;
|
||||
end;
|
||||
|
||||
initialization
|
||||
TROClassFactory.Create('srvContabilidad', Create_srvContabilidad, TsrvContabilidad_Invoker);
|
||||
|
||||
|
||||
@ -321,10 +321,6 @@ begin
|
||||
if (SubCuentas.DataTable.State in dsEditModes) then
|
||||
SubCuentas.DataTable.Post;
|
||||
|
||||
if (IGNORAR_CONTABILIDAD = 0)
|
||||
and (SubCuentas.DataTable.RecordCount = 0) then
|
||||
raise Exception.Create('El cliente debe tener asociada una subcuenta contable');
|
||||
|
||||
if (BLOQUEADO = 0) then
|
||||
begin
|
||||
Edit;
|
||||
|
||||
@ -20,7 +20,7 @@ type
|
||||
implementation
|
||||
|
||||
uses
|
||||
uDataModuleServer, uDAClasses,
|
||||
uDataModuleServer, uDAClasses, srvContabilidad_Impl,
|
||||
schContactosClient_Intf, uBusinessUtils;
|
||||
|
||||
{ TBizClienteServer }
|
||||
@ -53,9 +53,13 @@ var
|
||||
ASchema : TDASchema;
|
||||
ACurrentConn : IDAConnection;
|
||||
ACommand : IDASQLCommand;
|
||||
idCliente: integer;
|
||||
idTienda: integer;
|
||||
idEmpresa: integer;
|
||||
|
||||
begin
|
||||
inherited;
|
||||
|
||||
|
||||
ASchema := BusinessProcessor.Schema;
|
||||
ACurrentConn := GetBusinessProcessorConnection(BusinessProcessor);
|
||||
|
||||
@ -80,6 +84,23 @@ begin
|
||||
ParamByName('PROCEDENCIA_CLIENTE').Value := aChange.NewValueByName[fld_ClientesPROCEDENCIA_CLIENTE];
|
||||
Execute;
|
||||
end;
|
||||
|
||||
|
||||
//En caso de no ignorar contabilidad se deberá dar de alta una cuenta para el cliente si el usuario no la ha asignado
|
||||
if (aChange.NewValueByName[fld_ClientesIGNORAR_CONTABILIDAD] = 0) then
|
||||
begin
|
||||
with TsrvContabilidad.Create(NIL) do
|
||||
try
|
||||
idCliente := aChange.NewValueByName[fld_ClientesID];
|
||||
idTienda := aChange.NewValueByName[fld_ClientesID_TIENDA];
|
||||
idEmpresa := aChange.NewValueByName[fld_ClientesID_EMPRESA];
|
||||
if not TieneCuentaAsociada(idCliente, idEmpresa) then
|
||||
AnadirSubCuentaCliente(idCliente, idTienda, idEmpresa);
|
||||
finally
|
||||
Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
finally
|
||||
ACommand := NIL;
|
||||
end;
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
inherited frViewSubCuentaContacto: TfrViewSubCuentaContacto
|
||||
Width = 451
|
||||
Height = 304
|
||||
Width = 575
|
||||
Align = alClient
|
||||
AutoSize = True
|
||||
OnCreate = CustomViewCreate
|
||||
@ -10,16 +9,17 @@ inherited frViewSubCuentaContacto: TfrViewSubCuentaContacto
|
||||
object layoutApunte: TdxLayoutControl
|
||||
Left = 0
|
||||
Top = 0
|
||||
Width = 451
|
||||
Height = 304
|
||||
Width = 575
|
||||
Height = 291
|
||||
Align = alClient
|
||||
ParentBackground = True
|
||||
TabOrder = 0
|
||||
AutoContentSizes = [acsWidth, acsHeight]
|
||||
ExplicitWidth = 591
|
||||
ExplicitWidth = 451
|
||||
ExplicitHeight = 304
|
||||
DesignSize = (
|
||||
451
|
||||
304)
|
||||
575
|
||||
291)
|
||||
object eRefSubCuenta: TcxDBTextEdit
|
||||
Left = 93
|
||||
Top = 37
|
||||
@ -41,7 +41,7 @@ inherited frViewSubCuentaContacto: TfrViewSubCuentaContacto
|
||||
Width = 346
|
||||
end
|
||||
object BitBtn3: TBitBtn
|
||||
Left = 119
|
||||
Left = 233
|
||||
Top = 37
|
||||
Width = 110
|
||||
Height = 25
|
||||
@ -105,7 +105,7 @@ inherited frViewSubCuentaContacto: TfrViewSubCuentaContacto
|
||||
Width = 265
|
||||
end
|
||||
object BitBtn1: TBitBtn
|
||||
Left = 235
|
||||
Left = 349
|
||||
Top = 37
|
||||
Width = 120
|
||||
Height = 25
|
||||
@ -149,7 +149,7 @@ inherited frViewSubCuentaContacto: TfrViewSubCuentaContacto
|
||||
E000E248D100E407DB00FF00FF00FF00FF00FF00FF00FF00FF00}
|
||||
end
|
||||
object BitBtn2: TBitBtn
|
||||
Left = 361
|
||||
Left = 475
|
||||
Top = 37
|
||||
Width = 90
|
||||
Height = 25
|
||||
|
||||
@ -338,6 +338,14 @@
|
||||
</Parameter>
|
||||
</Parameters>
|
||||
</Operation>
|
||||
<Operation Name="darEjercicioActivo" UID="{072973FA-4504-4633-ABD1-5BE0B05257A0}">
|
||||
<Parameters>
|
||||
<Parameter Name="Result" DataType="Integer" Flag="Result">
|
||||
</Parameter>
|
||||
<Parameter Name="ID_EMPRESA" DataType="Integer" Flag="In" >
|
||||
</Parameter>
|
||||
</Parameters>
|
||||
</Operation>
|
||||
</Operations>
|
||||
</Interface>
|
||||
</Interfaces>
|
||||
@ -377,6 +385,40 @@
|
||||
<Interfaces>
|
||||
<Interface Name="Default" UID="{04CDF2E1-EFC2-4247-AA4F-09BE782C73FA}">
|
||||
<Operations>
|
||||
<Operation Name="TieneCuentaAsociada" UID="{F18B7A99-55D5-4234-BC14-1A96C0CB83CF}">
|
||||
<Parameters>
|
||||
<Parameter Name="Result" DataType="Boolean" Flag="Result">
|
||||
</Parameter>
|
||||
<Parameter Name="ID_CONTACTO" DataType="Integer" Flag="In" >
|
||||
</Parameter>
|
||||
<Parameter Name="ID_EMPRESA" DataType="Integer" Flag="In" >
|
||||
</Parameter>
|
||||
</Parameters>
|
||||
</Operation>
|
||||
<Operation Name="AnadirSubCuentaCliente" UID="{D13C68AD-871D-46C0-886E-9E017AF1E688}">
|
||||
<Parameters>
|
||||
<Parameter Name="Result" DataType="Boolean" Flag="Result">
|
||||
</Parameter>
|
||||
<Parameter Name="ID_CONTACTO" DataType="Integer" Flag="In" >
|
||||
</Parameter>
|
||||
<Parameter Name="ID_TIENDA" DataType="Integer" Flag="In" >
|
||||
</Parameter>
|
||||
<Parameter Name="ID_EMPRESA" DataType="Integer" Flag="In" >
|
||||
</Parameter>
|
||||
</Parameters>
|
||||
</Operation>
|
||||
<Operation Name="AnadirSubCuentaProveedor" UID="{E2D673BB-FA95-456D-805D-EB75C9361C54}">
|
||||
<Parameters>
|
||||
<Parameter Name="Result" DataType="Boolean" Flag="Result">
|
||||
</Parameter>
|
||||
<Parameter Name="ID_CONTACTO" DataType="Integer" Flag="In" >
|
||||
</Parameter>
|
||||
<Parameter Name="ID_TIENDA" DataType="Integer" Flag="In" >
|
||||
</Parameter>
|
||||
<Parameter Name="ID_EMPRESA" DataType="Integer" Flag="In" >
|
||||
</Parameter>
|
||||
</Parameters>
|
||||
</Operation>
|
||||
</Operations>
|
||||
</Interface>
|
||||
</Interfaces>
|
||||
|
||||
@ -571,6 +571,7 @@ type
|
||||
IsrvEjercicios = interface(IDataAbstractService)
|
||||
['{E99052D5-4ED9-480C-B4D4-384E8C6E4B08}']
|
||||
function GenerarPGC(const ID_EJERCICIO_COPIA: Integer; const ID_EJERCICIO: Integer): Boolean;
|
||||
function darEjercicioActivo(const ID_EMPRESA: Integer): Integer;
|
||||
end;
|
||||
|
||||
{ CosrvEjercicios }
|
||||
@ -584,6 +585,7 @@ type
|
||||
function __GetInterfaceName:string; override;
|
||||
|
||||
function GenerarPGC(const ID_EJERCICIO_COPIA: Integer; const ID_EJERCICIO: Integer): Boolean;
|
||||
function darEjercicioActivo(const ID_EMPRESA: Integer): Integer;
|
||||
end;
|
||||
|
||||
{ IsrvReferencias }
|
||||
@ -613,6 +615,9 @@ type
|
||||
{ IsrvContabilidad }
|
||||
IsrvContabilidad = interface(IDataAbstractService)
|
||||
['{04CDF2E1-EFC2-4247-AA4F-09BE782C73FA}']
|
||||
function TieneCuentaAsociada(const ID_CONTACTO: Integer; const ID_EMPRESA: Integer): Boolean;
|
||||
function AnadirSubCuentaCliente(const ID_CONTACTO: Integer; const ID_TIENDA: Integer; const ID_EMPRESA: Integer): Boolean;
|
||||
function AnadirSubCuentaProveedor(const ID_CONTACTO: Integer; const ID_TIENDA: Integer; const ID_EMPRESA: Integer): Boolean;
|
||||
end;
|
||||
|
||||
{ CosrvContabilidad }
|
||||
@ -625,6 +630,9 @@ type
|
||||
protected
|
||||
function __GetInterfaceName:string; override;
|
||||
|
||||
function TieneCuentaAsociada(const ID_CONTACTO: Integer; const ID_EMPRESA: Integer): Boolean;
|
||||
function AnadirSubCuentaCliente(const ID_CONTACTO: Integer; const ID_TIENDA: Integer; const ID_EMPRESA: Integer): Boolean;
|
||||
function AnadirSubCuentaProveedor(const ID_CONTACTO: Integer; const ID_TIENDA: Integer; const ID_EMPRESA: Integer): Boolean;
|
||||
end;
|
||||
|
||||
{ IsrvUnidadesMedida }
|
||||
@ -1542,6 +1550,22 @@ begin
|
||||
end
|
||||
end;
|
||||
|
||||
function TsrvEjercicios_Proxy.darEjercicioActivo(const ID_EMPRESA: Integer): Integer;
|
||||
begin
|
||||
try
|
||||
__Message.InitializeRequestMessage(__TransportChannel, 'FactuGES', __InterfaceName, 'darEjercicioActivo');
|
||||
__Message.Write('ID_EMPRESA', TypeInfo(Integer), ID_EMPRESA, []);
|
||||
__Message.Finalize;
|
||||
|
||||
__TransportChannel.Dispatch(__Message);
|
||||
|
||||
__Message.Read('Result', TypeInfo(Integer), result, []);
|
||||
finally
|
||||
__Message.UnsetAttributes(__TransportChannel);
|
||||
__Message.FreeStream;
|
||||
end
|
||||
end;
|
||||
|
||||
{ CosrvReferencias }
|
||||
|
||||
class function CosrvReferencias.Create(const aMessage: IROMessage; aTransportChannel: IROTransportChannel): IsrvReferencias;
|
||||
@ -1598,11 +1622,66 @@ begin
|
||||
result := TsrvContabilidad_Proxy.Create(aMessage, aTransportChannel);
|
||||
end;
|
||||
|
||||
{ TsrvContabilidad_Proxy }
|
||||
|
||||
function TsrvContabilidad_Proxy.__GetInterfaceName:string;
|
||||
begin
|
||||
result := 'srvContabilidad';
|
||||
end;
|
||||
|
||||
function TsrvContabilidad_Proxy.TieneCuentaAsociada(const ID_CONTACTO: Integer; const ID_EMPRESA: Integer): Boolean;
|
||||
begin
|
||||
try
|
||||
__Message.InitializeRequestMessage(__TransportChannel, 'FactuGES', __InterfaceName, 'TieneCuentaAsociada');
|
||||
__Message.Write('ID_CONTACTO', TypeInfo(Integer), ID_CONTACTO, []);
|
||||
__Message.Write('ID_EMPRESA', TypeInfo(Integer), ID_EMPRESA, []);
|
||||
__Message.Finalize;
|
||||
|
||||
__TransportChannel.Dispatch(__Message);
|
||||
|
||||
__Message.Read('Result', TypeInfo(Boolean), result, []);
|
||||
finally
|
||||
__Message.UnsetAttributes(__TransportChannel);
|
||||
__Message.FreeStream;
|
||||
end
|
||||
end;
|
||||
|
||||
function TsrvContabilidad_Proxy.AnadirSubCuentaCliente(const ID_CONTACTO: Integer; const ID_TIENDA: Integer; const ID_EMPRESA: Integer): Boolean;
|
||||
begin
|
||||
try
|
||||
__Message.InitializeRequestMessage(__TransportChannel, 'FactuGES', __InterfaceName, 'AnadirSubCuentaCliente');
|
||||
__Message.Write('ID_CONTACTO', TypeInfo(Integer), ID_CONTACTO, []);
|
||||
__Message.Write('ID_TIENDA', TypeInfo(Integer), ID_TIENDA, []);
|
||||
__Message.Write('ID_EMPRESA', TypeInfo(Integer), ID_EMPRESA, []);
|
||||
__Message.Finalize;
|
||||
|
||||
__TransportChannel.Dispatch(__Message);
|
||||
|
||||
__Message.Read('Result', TypeInfo(Boolean), result, []);
|
||||
finally
|
||||
__Message.UnsetAttributes(__TransportChannel);
|
||||
__Message.FreeStream;
|
||||
end
|
||||
end;
|
||||
|
||||
function TsrvContabilidad_Proxy.AnadirSubCuentaProveedor(const ID_CONTACTO: Integer; const ID_TIENDA: Integer; const ID_EMPRESA: Integer): Boolean;
|
||||
begin
|
||||
try
|
||||
__Message.InitializeRequestMessage(__TransportChannel, 'FactuGES', __InterfaceName, 'AnadirSubCuentaProveedor');
|
||||
__Message.Write('ID_CONTACTO', TypeInfo(Integer), ID_CONTACTO, []);
|
||||
__Message.Write('ID_TIENDA', TypeInfo(Integer), ID_TIENDA, []);
|
||||
__Message.Write('ID_EMPRESA', TypeInfo(Integer), ID_EMPRESA, []);
|
||||
__Message.Finalize;
|
||||
|
||||
__TransportChannel.Dispatch(__Message);
|
||||
|
||||
__Message.Read('Result', TypeInfo(Boolean), result, []);
|
||||
finally
|
||||
__Message.UnsetAttributes(__TransportChannel);
|
||||
__Message.FreeStream;
|
||||
end
|
||||
end;
|
||||
|
||||
{ CosrvUnidadesMedida }
|
||||
|
||||
class function CosrvUnidadesMedida.Create(const aMessage: IROMessage; aTransportChannel: IROTransportChannel): IsrvUnidadesMedida;
|
||||
|
||||
@ -174,6 +174,7 @@ type
|
||||
protected
|
||||
published
|
||||
procedure Invoke_GenerarPGC(const __Instance:IInterface; const __Message:IROMessage; const __Transport:IROTransport; out __oResponseOptions:TROResponseOptions);
|
||||
procedure Invoke_darEjercicioActivo(const __Instance:IInterface; const __Message:IROMessage; const __Transport:IROTransport; out __oResponseOptions:TROResponseOptions);
|
||||
end;
|
||||
|
||||
TsrvReferencias_Invoker = class(TDataAbstractService_Invoker)
|
||||
@ -188,6 +189,9 @@ type
|
||||
private
|
||||
protected
|
||||
published
|
||||
procedure Invoke_TieneCuentaAsociada(const __Instance:IInterface; const __Message:IROMessage; const __Transport:IROTransport; out __oResponseOptions:TROResponseOptions);
|
||||
procedure Invoke_AnadirSubCuentaCliente(const __Instance:IInterface; const __Message:IROMessage; const __Transport:IROTransport; out __oResponseOptions:TROResponseOptions);
|
||||
procedure Invoke_AnadirSubCuentaProveedor(const __Instance:IInterface; const __Message:IROMessage; const __Transport:IROTransport; out __oResponseOptions:TROResponseOptions);
|
||||
end;
|
||||
|
||||
TsrvUnidadesMedida_Invoker = class(TDataAbstractService_Invoker)
|
||||
@ -707,6 +711,26 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TsrvEjercicios_Invoker.Invoke_darEjercicioActivo(const __Instance:IInterface; const __Message:IROMessage; const __Transport:IROTransport; out __oResponseOptions:TROResponseOptions);
|
||||
{ function darEjercicioActivo(const ID_EMPRESA: Integer): Integer; }
|
||||
var
|
||||
ID_EMPRESA: Integer;
|
||||
lResult: Integer;
|
||||
begin
|
||||
try
|
||||
__Message.Read('ID_EMPRESA', TypeInfo(Integer), ID_EMPRESA, []);
|
||||
|
||||
lResult := (__Instance as IsrvEjercicios).darEjercicioActivo(ID_EMPRESA);
|
||||
|
||||
__Message.InitializeResponseMessage(__Transport, 'FactuGES', 'srvEjercicios', 'darEjercicioActivoResponse');
|
||||
__Message.Write('Result', TypeInfo(Integer), lResult, []);
|
||||
__Message.Finalize;
|
||||
__Message.UnsetAttributes(__Transport);
|
||||
|
||||
finally
|
||||
end;
|
||||
end;
|
||||
|
||||
{ TsrvReferencias_Invoker }
|
||||
|
||||
procedure TsrvReferencias_Invoker.Invoke_DarNuevaReferencia(const __Instance:IInterface; const __Message:IROMessage; const __Transport:IROTransport; out __oResponseOptions:TROResponseOptions);
|
||||
@ -755,5 +779,77 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
{ TsrvContabilidad_Invoker }
|
||||
|
||||
procedure TsrvContabilidad_Invoker.Invoke_TieneCuentaAsociada(const __Instance:IInterface; const __Message:IROMessage; const __Transport:IROTransport; out __oResponseOptions:TROResponseOptions);
|
||||
{ function TieneCuentaAsociada(const ID_CONTACTO: Integer; const ID_EMPRESA: Integer): Boolean; }
|
||||
var
|
||||
ID_CONTACTO: Integer;
|
||||
ID_EMPRESA: Integer;
|
||||
lResult: Boolean;
|
||||
begin
|
||||
try
|
||||
__Message.Read('ID_CONTACTO', TypeInfo(Integer), ID_CONTACTO, []);
|
||||
__Message.Read('ID_EMPRESA', TypeInfo(Integer), ID_EMPRESA, []);
|
||||
|
||||
lResult := (__Instance as IsrvContabilidad).TieneCuentaAsociada(ID_CONTACTO, ID_EMPRESA);
|
||||
|
||||
__Message.InitializeResponseMessage(__Transport, 'FactuGES', 'srvContabilidad', 'TieneCuentaAsociadaResponse');
|
||||
__Message.Write('Result', TypeInfo(Boolean), lResult, []);
|
||||
__Message.Finalize;
|
||||
__Message.UnsetAttributes(__Transport);
|
||||
|
||||
finally
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TsrvContabilidad_Invoker.Invoke_AnadirSubCuentaCliente(const __Instance:IInterface; const __Message:IROMessage; const __Transport:IROTransport; out __oResponseOptions:TROResponseOptions);
|
||||
{ function AnadirSubCuentaCliente(const ID_CONTACTO: Integer; const ID_TIENDA: Integer; const ID_EMPRESA: Integer): Boolean; }
|
||||
var
|
||||
ID_CONTACTO: Integer;
|
||||
ID_TIENDA: Integer;
|
||||
ID_EMPRESA: Integer;
|
||||
lResult: Boolean;
|
||||
begin
|
||||
try
|
||||
__Message.Read('ID_CONTACTO', TypeInfo(Integer), ID_CONTACTO, []);
|
||||
__Message.Read('ID_TIENDA', TypeInfo(Integer), ID_TIENDA, []);
|
||||
__Message.Read('ID_EMPRESA', TypeInfo(Integer), ID_EMPRESA, []);
|
||||
|
||||
lResult := (__Instance as IsrvContabilidad).AnadirSubCuentaCliente(ID_CONTACTO, ID_TIENDA, ID_EMPRESA);
|
||||
|
||||
__Message.InitializeResponseMessage(__Transport, 'FactuGES', 'srvContabilidad', 'AnadirSubCuentaClienteResponse');
|
||||
__Message.Write('Result', TypeInfo(Boolean), lResult, []);
|
||||
__Message.Finalize;
|
||||
__Message.UnsetAttributes(__Transport);
|
||||
|
||||
finally
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TsrvContabilidad_Invoker.Invoke_AnadirSubCuentaProveedor(const __Instance:IInterface; const __Message:IROMessage; const __Transport:IROTransport; out __oResponseOptions:TROResponseOptions);
|
||||
{ function AnadirSubCuentaProveedor(const ID_CONTACTO: Integer; const ID_TIENDA: Integer; const ID_EMPRESA: Integer): Boolean; }
|
||||
var
|
||||
ID_CONTACTO: Integer;
|
||||
ID_TIENDA: Integer;
|
||||
ID_EMPRESA: Integer;
|
||||
lResult: Boolean;
|
||||
begin
|
||||
try
|
||||
__Message.Read('ID_CONTACTO', TypeInfo(Integer), ID_CONTACTO, []);
|
||||
__Message.Read('ID_TIENDA', TypeInfo(Integer), ID_TIENDA, []);
|
||||
__Message.Read('ID_EMPRESA', TypeInfo(Integer), ID_EMPRESA, []);
|
||||
|
||||
lResult := (__Instance as IsrvContabilidad).AnadirSubCuentaProveedor(ID_CONTACTO, ID_TIENDA, ID_EMPRESA);
|
||||
|
||||
__Message.InitializeResponseMessage(__Transport, 'FactuGES', 'srvContabilidad', 'AnadirSubCuentaProveedorResponse');
|
||||
__Message.Write('Result', TypeInfo(Boolean), lResult, []);
|
||||
__Message.Finalize;
|
||||
__Message.UnsetAttributes(__Transport);
|
||||
|
||||
finally
|
||||
end;
|
||||
end;
|
||||
|
||||
initialization
|
||||
end.
|
||||
|
||||
Binary file not shown.
@ -39,8 +39,9 @@ object dmServer: TdmServer
|
||||
item
|
||||
Name = 'IBX'
|
||||
ConnectionString =
|
||||
'IBX?Server=localhost;Database=C:\Codigo Acana\Database\ACANA.FDB' +
|
||||
';UserID=sysdba;Password=masterkey;Dialect=3;Charset=ISO8859_1;'
|
||||
'IBX?Server=localhost;Database=C:\Codigo Acana\Output\Debug\Datab' +
|
||||
'ase\FactuGES.FDB;UserID=sysdba;Password=masterkey;Dialect=3;Char' +
|
||||
'set=ISO8859_1;'
|
||||
ConnectionType = 'Interbase'
|
||||
Default = True
|
||||
end>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user