Se adaptan los presupuestos para que puedan meter bonificaciones como en el preograma antiguo.

git-svn-id: https://192.168.0.254/svn/Proyectos.Tecsitel_FactuGES2/trunk@758 0c75b7a4-871f-7646-8a2f-f78d34cc349f
This commit is contained in:
roberto 2008-11-11 18:56:40 +00:00
parent 974ea629e7
commit daa0e2a45f
3 changed files with 172 additions and 9 deletions

View File

@ -9,8 +9,8 @@ const
{ Data table rules ids
Feel free to change them to something more human readable
but make sure they are unique in the context of your application }
RID_PresupuestosCliente = '{A622155D-B03A-44D8-BA3F-20591688D917}';
RID_PresupuestosCliente_Detalles = '{4043BD1E-2206-47B4-AE7F-CB23FFF5E21B}';
RID_PresupuestosCliente = '{02B965D3-E8B3-4393-9538-6FEB6D1A79FE}';
RID_PresupuestosCliente_Detalles = '{E8F6A069-9B83-4BCB-A906-46BC95B992ED}';
{ Data table names }
nme_PresupuestosCliente = 'PresupuestosCliente';
@ -50,6 +50,8 @@ const
fld_PresupuestosClienteID_FACTURA = 'ID_FACTURA';
fld_PresupuestosClienteFACTURA = 'FACTURA';
fld_PresupuestosClientePERSONA_CONTACTO = 'PERSONA_CONTACTO';
fld_PresupuestosClienteDESCRIPCION_BONIFICACION = 'DESCRIPCION_BONIFICACION';
fld_PresupuestosClienteIMPORTE_BONIFICACION = 'IMPORTE_BONIFICACION';
{ PresupuestosCliente field indexes }
idx_PresupuestosClienteID = 0;
@ -85,6 +87,8 @@ const
idx_PresupuestosClienteID_FACTURA = 30;
idx_PresupuestosClienteFACTURA = 31;
idx_PresupuestosClientePERSONA_CONTACTO = 32;
idx_PresupuestosClienteDESCRIPCION_BONIFICACION = 33;
idx_PresupuestosClienteIMPORTE_BONIFICACION = 34;
{ PresupuestosCliente_Detalles fields }
fld_PresupuestosCliente_DetallesID = 'ID';
@ -123,7 +127,7 @@ const
type
{ IPresupuestosCliente }
IPresupuestosCliente = interface(IDAStronglyTypedDataTable)
['{67536976-E430-4AB7-875D-BE24887EFF02}']
['{F472CCF9-F91D-40E6-A3CF-8EDCBBF40A3A}']
{ Property getters and setters }
function GetIDValue: Integer;
procedure SetIDValue(const aValue: Integer);
@ -253,6 +257,14 @@ type
procedure SetPERSONA_CONTACTOValue(const aValue: String);
function GetPERSONA_CONTACTOIsNull: Boolean;
procedure SetPERSONA_CONTACTOIsNull(const aValue: Boolean);
function GetDESCRIPCION_BONIFICACIONValue: String;
procedure SetDESCRIPCION_BONIFICACIONValue(const aValue: String);
function GetDESCRIPCION_BONIFICACIONIsNull: Boolean;
procedure SetDESCRIPCION_BONIFICACIONIsNull(const aValue: Boolean);
function GetIMPORTE_BONIFICACIONValue: Currency;
procedure SetIMPORTE_BONIFICACIONValue(const aValue: Currency);
function GetIMPORTE_BONIFICACIONIsNull: Boolean;
procedure SetIMPORTE_BONIFICACIONIsNull(const aValue: Boolean);
{ Properties }
@ -322,6 +334,10 @@ type
property FACTURAIsNull: Boolean read GetFACTURAIsNull write SetFACTURAIsNull;
property PERSONA_CONTACTO: String read GetPERSONA_CONTACTOValue write SetPERSONA_CONTACTOValue;
property PERSONA_CONTACTOIsNull: Boolean read GetPERSONA_CONTACTOIsNull write SetPERSONA_CONTACTOIsNull;
property DESCRIPCION_BONIFICACION: String read GetDESCRIPCION_BONIFICACIONValue write SetDESCRIPCION_BONIFICACIONValue;
property DESCRIPCION_BONIFICACIONIsNull: Boolean read GetDESCRIPCION_BONIFICACIONIsNull write SetDESCRIPCION_BONIFICACIONIsNull;
property IMPORTE_BONIFICACION: Currency read GetIMPORTE_BONIFICACIONValue write SetIMPORTE_BONIFICACIONValue;
property IMPORTE_BONIFICACIONIsNull: Boolean read GetIMPORTE_BONIFICACIONIsNull write SetIMPORTE_BONIFICACIONIsNull;
end;
{ TPresupuestosClienteDataTableRules }
@ -465,6 +481,14 @@ type
procedure SetPERSONA_CONTACTOValue(const aValue: String); virtual;
function GetPERSONA_CONTACTOIsNull: Boolean; virtual;
procedure SetPERSONA_CONTACTOIsNull(const aValue: Boolean); virtual;
function GetDESCRIPCION_BONIFICACIONValue: String; virtual;
procedure SetDESCRIPCION_BONIFICACIONValue(const aValue: String); virtual;
function GetDESCRIPCION_BONIFICACIONIsNull: Boolean; virtual;
procedure SetDESCRIPCION_BONIFICACIONIsNull(const aValue: Boolean); virtual;
function GetIMPORTE_BONIFICACIONValue: Currency; virtual;
procedure SetIMPORTE_BONIFICACIONValue(const aValue: Currency); virtual;
function GetIMPORTE_BONIFICACIONIsNull: Boolean; virtual;
procedure SetIMPORTE_BONIFICACIONIsNull(const aValue: Boolean); virtual;
{ Properties }
property ID: Integer read GetIDValue write SetIDValue;
@ -533,6 +557,10 @@ type
property FACTURAIsNull: Boolean read GetFACTURAIsNull write SetFACTURAIsNull;
property PERSONA_CONTACTO: String read GetPERSONA_CONTACTOValue write SetPERSONA_CONTACTOValue;
property PERSONA_CONTACTOIsNull: Boolean read GetPERSONA_CONTACTOIsNull write SetPERSONA_CONTACTOIsNull;
property DESCRIPCION_BONIFICACION: String read GetDESCRIPCION_BONIFICACIONValue write SetDESCRIPCION_BONIFICACIONValue;
property DESCRIPCION_BONIFICACIONIsNull: Boolean read GetDESCRIPCION_BONIFICACIONIsNull write SetDESCRIPCION_BONIFICACIONIsNull;
property IMPORTE_BONIFICACION: Currency read GetIMPORTE_BONIFICACIONValue write SetIMPORTE_BONIFICACIONValue;
property IMPORTE_BONIFICACIONIsNull: Boolean read GetIMPORTE_BONIFICACIONIsNull write SetIMPORTE_BONIFICACIONIsNull;
public
constructor Create(aDataTable: TDADataTable); override;
@ -542,7 +570,7 @@ type
{ IPresupuestosCliente_Detalles }
IPresupuestosCliente_Detalles = interface(IDAStronglyTypedDataTable)
['{55378B5F-C9F6-4E4F-ABB3-AD8C69CC1A79}']
['{024EFB8C-2DF7-4523-85D9-3AE553B9A336}']
{ Property getters and setters }
function GetIDValue: Integer;
procedure SetIDValue(const aValue: Integer);
@ -1473,6 +1501,48 @@ begin
DataTable.Fields[idx_PresupuestosClientePERSONA_CONTACTO].AsVariant := Null;
end;
function TPresupuestosClienteDataTableRules.GetDESCRIPCION_BONIFICACIONValue: String;
begin
result := DataTable.Fields[idx_PresupuestosClienteDESCRIPCION_BONIFICACION].AsString;
end;
procedure TPresupuestosClienteDataTableRules.SetDESCRIPCION_BONIFICACIONValue(const aValue: String);
begin
DataTable.Fields[idx_PresupuestosClienteDESCRIPCION_BONIFICACION].AsString := aValue;
end;
function TPresupuestosClienteDataTableRules.GetDESCRIPCION_BONIFICACIONIsNull: boolean;
begin
result := DataTable.Fields[idx_PresupuestosClienteDESCRIPCION_BONIFICACION].IsNull;
end;
procedure TPresupuestosClienteDataTableRules.SetDESCRIPCION_BONIFICACIONIsNull(const aValue: Boolean);
begin
if aValue then
DataTable.Fields[idx_PresupuestosClienteDESCRIPCION_BONIFICACION].AsVariant := Null;
end;
function TPresupuestosClienteDataTableRules.GetIMPORTE_BONIFICACIONValue: Currency;
begin
result := DataTable.Fields[idx_PresupuestosClienteIMPORTE_BONIFICACION].AsCurrency;
end;
procedure TPresupuestosClienteDataTableRules.SetIMPORTE_BONIFICACIONValue(const aValue: Currency);
begin
DataTable.Fields[idx_PresupuestosClienteIMPORTE_BONIFICACION].AsCurrency := aValue;
end;
function TPresupuestosClienteDataTableRules.GetIMPORTE_BONIFICACIONIsNull: boolean;
begin
result := DataTable.Fields[idx_PresupuestosClienteIMPORTE_BONIFICACION].IsNull;
end;
procedure TPresupuestosClienteDataTableRules.SetIMPORTE_BONIFICACIONIsNull(const aValue: Boolean);
begin
if aValue then
DataTable.Fields[idx_PresupuestosClienteIMPORTE_BONIFICACION].AsVariant := Null;
end;
{ TPresupuestosCliente_DetallesDataTableRules }
constructor TPresupuestosCliente_DetallesDataTableRules.Create(aDataTable: TDADataTable);

View File

@ -9,13 +9,13 @@ const
{ Delta rules ids
Feel free to change them to something more human readable
but make sure they are unique in the context of your application }
RID_PresupuestosClienteDelta = '{4B300EEA-2519-4A6B-84AC-CB23A152A6EF}';
RID_PresupuestosCliente_DetallesDelta = '{CC67839F-FC02-4599-85F7-E28542F181F7}';
RID_PresupuestosClienteDelta = '{C8D94DD0-07E0-41C9-95E0-5FA8501BC80E}';
RID_PresupuestosCliente_DetallesDelta = '{DFCABCBE-B322-4F22-A380-7DE112BF13DF}';
type
{ IPresupuestosClienteDelta }
IPresupuestosClienteDelta = interface(IPresupuestosCliente)
['{4B300EEA-2519-4A6B-84AC-CB23A152A6EF}']
['{C8D94DD0-07E0-41C9-95E0-5FA8501BC80E}']
{ Property getters and setters }
function GetOldIDValue : Integer;
function GetOldID_EMPRESAValue : Integer;
@ -50,6 +50,8 @@ type
function GetOldID_FACTURAValue : Integer;
function GetOldFACTURAValue : String;
function GetOldPERSONA_CONTACTOValue : String;
function GetOldDESCRIPCION_BONIFICACIONValue : String;
function GetOldIMPORTE_BONIFICACIONValue : Currency;
{ Properties }
property OldID : Integer read GetOldIDValue;
@ -85,6 +87,8 @@ type
property OldID_FACTURA : Integer read GetOldID_FACTURAValue;
property OldFACTURA : String read GetOldFACTURAValue;
property OldPERSONA_CONTACTO : String read GetOldPERSONA_CONTACTOValue;
property OldDESCRIPCION_BONIFICACION : String read GetOldDESCRIPCION_BONIFICACIONValue;
property OldIMPORTE_BONIFICACION : Currency read GetOldIMPORTE_BONIFICACIONValue;
end;
{ TPresupuestosClienteBusinessProcessorRules }
@ -294,6 +298,18 @@ type
function GetOldPERSONA_CONTACTOIsNull: Boolean; virtual;
procedure SetPERSONA_CONTACTOValue(const aValue: String); virtual;
procedure SetPERSONA_CONTACTOIsNull(const aValue: Boolean); virtual;
function GetDESCRIPCION_BONIFICACIONValue: String; virtual;
function GetDESCRIPCION_BONIFICACIONIsNull: Boolean; virtual;
function GetOldDESCRIPCION_BONIFICACIONValue: String; virtual;
function GetOldDESCRIPCION_BONIFICACIONIsNull: Boolean; virtual;
procedure SetDESCRIPCION_BONIFICACIONValue(const aValue: String); virtual;
procedure SetDESCRIPCION_BONIFICACIONIsNull(const aValue: Boolean); virtual;
function GetIMPORTE_BONIFICACIONValue: Currency; virtual;
function GetIMPORTE_BONIFICACIONIsNull: Boolean; virtual;
function GetOldIMPORTE_BONIFICACIONValue: Currency; virtual;
function GetOldIMPORTE_BONIFICACIONIsNull: Boolean; virtual;
procedure SetIMPORTE_BONIFICACIONValue(const aValue: Currency); virtual;
procedure SetIMPORTE_BONIFICACIONIsNull(const aValue: Boolean); virtual;
{ Properties }
property ID : Integer read GetIDValue write SetIDValue;
@ -428,6 +444,14 @@ type
property PERSONA_CONTACTOIsNull : Boolean read GetPERSONA_CONTACTOIsNull write SetPERSONA_CONTACTOIsNull;
property OldPERSONA_CONTACTO : String read GetOldPERSONA_CONTACTOValue;
property OldPERSONA_CONTACTOIsNull : Boolean read GetOldPERSONA_CONTACTOIsNull;
property DESCRIPCION_BONIFICACION : String read GetDESCRIPCION_BONIFICACIONValue write SetDESCRIPCION_BONIFICACIONValue;
property DESCRIPCION_BONIFICACIONIsNull : Boolean read GetDESCRIPCION_BONIFICACIONIsNull write SetDESCRIPCION_BONIFICACIONIsNull;
property OldDESCRIPCION_BONIFICACION : String read GetOldDESCRIPCION_BONIFICACIONValue;
property OldDESCRIPCION_BONIFICACIONIsNull : Boolean read GetOldDESCRIPCION_BONIFICACIONIsNull;
property IMPORTE_BONIFICACION : Currency read GetIMPORTE_BONIFICACIONValue write SetIMPORTE_BONIFICACIONValue;
property IMPORTE_BONIFICACIONIsNull : Boolean read GetIMPORTE_BONIFICACIONIsNull write SetIMPORTE_BONIFICACIONIsNull;
property OldIMPORTE_BONIFICACION : Currency read GetOldIMPORTE_BONIFICACIONValue;
property OldIMPORTE_BONIFICACIONIsNull : Boolean read GetOldIMPORTE_BONIFICACIONIsNull;
public
constructor Create(aBusinessProcessor: TDABusinessProcessor); override;
@ -437,7 +461,7 @@ type
{ IPresupuestosCliente_DetallesDelta }
IPresupuestosCliente_DetallesDelta = interface(IPresupuestosCliente_Detalles)
['{CC67839F-FC02-4599-85F7-E28542F181F7}']
['{DFCABCBE-B322-4F22-A380-7DE112BF13DF}']
{ Property getters and setters }
function GetOldIDValue : Integer;
function GetOldID_PRESUPUESTOValue : Integer;
@ -1702,6 +1726,68 @@ begin
BusinessProcessor.CurrentChange.NewValueByName[fld_PresupuestosClientePERSONA_CONTACTO] := Null;
end;
function TPresupuestosClienteBusinessProcessorRules.GetDESCRIPCION_BONIFICACIONValue: String;
begin
result := BusinessProcessor.CurrentChange.NewValueByName[fld_PresupuestosClienteDESCRIPCION_BONIFICACION];
end;
function TPresupuestosClienteBusinessProcessorRules.GetDESCRIPCION_BONIFICACIONIsNull: Boolean;
begin
result := VarIsNull(BusinessProcessor.CurrentChange.NewValueByName[fld_PresupuestosClienteDESCRIPCION_BONIFICACION]);
end;
function TPresupuestosClienteBusinessProcessorRules.GetOldDESCRIPCION_BONIFICACIONValue: String;
begin
result := BusinessProcessor.CurrentChange.OldValueByName[fld_PresupuestosClienteDESCRIPCION_BONIFICACION];
end;
function TPresupuestosClienteBusinessProcessorRules.GetOldDESCRIPCION_BONIFICACIONIsNull: Boolean;
begin
result := VarIsNull(BusinessProcessor.CurrentChange.OldValueByName[fld_PresupuestosClienteDESCRIPCION_BONIFICACION]);
end;
procedure TPresupuestosClienteBusinessProcessorRules.SetDESCRIPCION_BONIFICACIONValue(const aValue: String);
begin
BusinessProcessor.CurrentChange.NewValueByName[fld_PresupuestosClienteDESCRIPCION_BONIFICACION] := aValue;
end;
procedure TPresupuestosClienteBusinessProcessorRules.SetDESCRIPCION_BONIFICACIONIsNull(const aValue: Boolean);
begin
if aValue then
BusinessProcessor.CurrentChange.NewValueByName[fld_PresupuestosClienteDESCRIPCION_BONIFICACION] := Null;
end;
function TPresupuestosClienteBusinessProcessorRules.GetIMPORTE_BONIFICACIONValue: Currency;
begin
result := BusinessProcessor.CurrentChange.NewValueByName[fld_PresupuestosClienteIMPORTE_BONIFICACION];
end;
function TPresupuestosClienteBusinessProcessorRules.GetIMPORTE_BONIFICACIONIsNull: Boolean;
begin
result := VarIsNull(BusinessProcessor.CurrentChange.NewValueByName[fld_PresupuestosClienteIMPORTE_BONIFICACION]);
end;
function TPresupuestosClienteBusinessProcessorRules.GetOldIMPORTE_BONIFICACIONValue: Currency;
begin
result := BusinessProcessor.CurrentChange.OldValueByName[fld_PresupuestosClienteIMPORTE_BONIFICACION];
end;
function TPresupuestosClienteBusinessProcessorRules.GetOldIMPORTE_BONIFICACIONIsNull: Boolean;
begin
result := VarIsNull(BusinessProcessor.CurrentChange.OldValueByName[fld_PresupuestosClienteIMPORTE_BONIFICACION]);
end;
procedure TPresupuestosClienteBusinessProcessorRules.SetIMPORTE_BONIFICACIONValue(const aValue: Currency);
begin
BusinessProcessor.CurrentChange.NewValueByName[fld_PresupuestosClienteIMPORTE_BONIFICACION] := aValue;
end;
procedure TPresupuestosClienteBusinessProcessorRules.SetIMPORTE_BONIFICACIONIsNull(const aValue: Boolean);
begin
if aValue then
BusinessProcessor.CurrentChange.NewValueByName[fld_PresupuestosClienteIMPORTE_BONIFICACION] := Null;
end;
{ TPresupuestosCliente_DetallesBusinessProcessorRules }
constructor TPresupuestosCliente_DetallesBusinessProcessorRules.Create(aBusinessProcessor: TDABusinessProcessor);

View File

@ -65,6 +65,7 @@ type
procedure IniciarValoresPresupuestoNuevo;
procedure IMPORTE_NETOOnChange(Sender: TDACustomField);
procedure IMPORTE_BONIFICACIONOnChange(Sender: TDACustomField);
procedure IMPORTE_PORTEOnChange(Sender: TDACustomField);
procedure DESCUENTOOnChange(Sender: TDACustomField);
procedure IVAOnChange(Sender: TDACustomField);
@ -99,7 +100,7 @@ begin
if not Self.DataTable.Editing then
Edit;
IMPORTE_DESCUENTO := IMPORTE_NETO * (DESCUENTO/100);
BASE_IMPONIBLE := IMPORTE_NETO - IMPORTE_DESCUENTO + IMPORTE_PORTE;
BASE_IMPONIBLE := IMPORTE_NETO - IMPORTE_DESCUENTO - IMPORTE_BONIFICACION + IMPORTE_PORTE;
end;
procedure TBizPresupuestoCliente.CalcularImporteTotal;
@ -134,6 +135,7 @@ begin
with DataTable do
begin
FieldByName(fld_PresupuestosClienteIMPORTE_NETO).OnChange := IMPORTE_NETOOnChange;
FieldByName(fld_PresupuestosClienteIMPORTE_BONIFICACION).OnChange := IMPORTE_BONIFICACIONOnChange;
FieldByName(fld_PresupuestosClienteIMPORTE_PORTE).OnChange := IMPORTE_PORTEOnChange;
FieldByName(fld_PresupuestosClienteDESCUENTO).OnChange := DESCUENTOOnChange;
FieldByName(fld_PresupuestosClienteIVA).OnChange := IVAOnChange;
@ -181,6 +183,11 @@ begin
Result := FCliente;
end;
procedure TBizPresupuestoCliente.IMPORTE_BONIFICACIONOnChange(Sender: TDACustomField);
begin
CalcularImporteTotal;
end;
procedure TBizPresupuestoCliente.IMPORTE_NETOOnChange(Sender: TDACustomField);
begin
CalcularImporteTotal;