Tarea #1351 -> En los artículos, poder indicar un precio final (precio neto) y que se calculo el descuento apropiado

git-svn-id: https://192.168.0.254/svn/Proyectos.LuisLeon_FactuGES2/trunk@230 b2cfbe5a-eba1-4a0c-8b32-7feea0a119f2
This commit is contained in:
roberto 2014-08-13 10:04:27 +00:00
parent e4a90bf0d9
commit b940998404
10 changed files with 157 additions and 54 deletions

View File

@ -53,7 +53,7 @@
<Borland.Personality>Delphi.Personality</Borland.Personality>
<Borland.ProjectType>VCLApplication</Borland.ProjectType>
<BorlandProject>
<BorlandProject><Delphi.Personality><Parameters><Parameters Name="UseLauncher">False</Parameters><Parameters Name="LoadAllSymbols">True</Parameters><Parameters Name="LoadUnspecifiedSymbols">False</Parameters></Parameters><Language><Language Name="RootDir">C:\Archivos de programa\Borland\Delphi7\Bin\</Language></Language><VersionInfo><VersionInfo Name="IncludeVerInfo">True</VersionInfo><VersionInfo Name="AutoIncBuild">False</VersionInfo><VersionInfo Name="MajorVer">4</VersionInfo><VersionInfo Name="MinorVer">4</VersionInfo><VersionInfo Name="Release">1</VersionInfo><VersionInfo Name="Build">0</VersionInfo><VersionInfo Name="Debug">False</VersionInfo><VersionInfo Name="PreRelease">False</VersionInfo><VersionInfo Name="Special">False</VersionInfo><VersionInfo Name="Private">False</VersionInfo><VersionInfo Name="DLL">False</VersionInfo><VersionInfo Name="Locale">3082</VersionInfo><VersionInfo Name="CodePage">1252</VersionInfo></VersionInfo><VersionInfoKeys><VersionInfoKeys Name="CompanyName">Rodax Software S.L.</VersionInfoKeys><VersionInfoKeys Name="FileDescription"></VersionInfoKeys><VersionInfoKeys Name="FileVersion">4.4.1.0</VersionInfoKeys><VersionInfoKeys Name="InternalName">FactuGES</VersionInfoKeys><VersionInfoKeys Name="LegalCopyright"></VersionInfoKeys><VersionInfoKeys Name="LegalTrademarks"></VersionInfoKeys><VersionInfoKeys Name="OriginalFilename"></VersionInfoKeys><VersionInfoKeys Name="ProductName">FactuGES</VersionInfoKeys><VersionInfoKeys Name="ProductVersion">4.4.1.0</VersionInfoKeys><VersionInfoKeys Name="Comments"></VersionInfoKeys></VersionInfoKeys><Excluded_Packages></Excluded_Packages><Source><Source Name="MainSource">FactuGES.dpr</Source></Source></Delphi.Personality><ModelSupport>False</ModelSupport></BorlandProject></BorlandProject>
<BorlandProject><Delphi.Personality><Parameters><Parameters Name="UseLauncher">False</Parameters><Parameters Name="LoadAllSymbols">True</Parameters><Parameters Name="LoadUnspecifiedSymbols">False</Parameters></Parameters><Language><Language Name="RootDir">C:\Archivos de programa\Borland\Delphi7\Bin\</Language></Language><VersionInfo><VersionInfo Name="IncludeVerInfo">True</VersionInfo><VersionInfo Name="AutoIncBuild">False</VersionInfo><VersionInfo Name="MajorVer">4</VersionInfo><VersionInfo Name="MinorVer">4</VersionInfo><VersionInfo Name="Release">2</VersionInfo><VersionInfo Name="Build">0</VersionInfo><VersionInfo Name="Debug">False</VersionInfo><VersionInfo Name="PreRelease">False</VersionInfo><VersionInfo Name="Special">False</VersionInfo><VersionInfo Name="Private">False</VersionInfo><VersionInfo Name="DLL">False</VersionInfo><VersionInfo Name="Locale">3082</VersionInfo><VersionInfo Name="CodePage">1252</VersionInfo></VersionInfo><VersionInfoKeys><VersionInfoKeys Name="CompanyName">Rodax Software S.L.</VersionInfoKeys><VersionInfoKeys Name="FileDescription"></VersionInfoKeys><VersionInfoKeys Name="FileVersion">4.4.2.0</VersionInfoKeys><VersionInfoKeys Name="InternalName">FactuGES</VersionInfoKeys><VersionInfoKeys Name="LegalCopyright"></VersionInfoKeys><VersionInfoKeys Name="LegalTrademarks"></VersionInfoKeys><VersionInfoKeys Name="OriginalFilename"></VersionInfoKeys><VersionInfoKeys Name="ProductName">FactuGES</VersionInfoKeys><VersionInfoKeys Name="ProductVersion">4.4.2.0</VersionInfoKeys><VersionInfoKeys Name="Comments"></VersionInfoKeys></VersionInfoKeys><Excluded_Packages></Excluded_Packages><Source><Source Name="MainSource">FactuGES.dpr</Source></Source></Delphi.Personality><ModelSupport>False</ModelSupport></BorlandProject></BorlandProject>
</ProjectExtensions>
<Import Project="$(MSBuildBinPath)\Borland.Delphi.Targets" />
<ItemGroup>

Binary file not shown.

View File

@ -51,7 +51,14 @@ requires
RemObjects_Core_D11,
dxLayoutControlD11,
dxComnD11,
Contactos_model;
Contactos_model,
PngComponentsD10,
PNG_D10,
vclactnband,
cxGridD11,
cxPageControlD11,
cxExtEditorsD11,
cxExportD11;
contains
uViewArticulos in 'uViewArticulos.pas' {frViewArticulos: TFrame},
@ -65,6 +72,7 @@ contains
uViewDetallesArticulosParaVenta in 'uViewDetallesArticulosParaVenta.pas' {frViewDetallesArticulosParaVenta: TCustomView},
uEditorArticulos in 'uEditorArticulos.pas' {fEditorArticulos: TfEditorArticulo},
uViewProveedorArticulo in 'uViewProveedorArticulo.pas' {frViewProveedorArticulo: TFrame},
uViewParametrosPrecio in 'uViewParametrosPrecio.pas' {frViewParametrosPrecio: TFrame};
uViewParametrosPrecio in 'uViewParametrosPrecio.pas' {frViewParametrosPrecio: TFrame},
uViewArticulosProveedores in 'uViewArticulosProveedores.pas';
end.

View File

@ -55,33 +55,34 @@
<DelphiCompile Include="Articulos_view.dpk">
<MainSource>MainSource</MainSource>
</DelphiCompile>
<DCCReference Include="..\..\Facturas de proveedor\adortl.dcp" />
<DCCReference Include="..\..\Facturas de proveedor\Articulos_controller.dcp" />
<DCCReference Include="..\..\Facturas de proveedor\Articulos_model.dcp" />
<DCCReference Include="..\..\Facturas de proveedor\Contactos_model.dcp" />
<DCCReference Include="..\..\Facturas de proveedor\Contactos_view.dcp" />
<DCCReference Include="..\..\Facturas de proveedor\cxDataD11.dcp" />
<DCCReference Include="..\..\Facturas de proveedor\cxEditorsD11.dcp" />
<DCCReference Include="..\..\Facturas de proveedor\cxLibraryD11.dcp" />
<DCCReference Include="..\..\Facturas de proveedor\DataAbstract_Core_D11.dcp" />
<DCCReference Include="..\..\Facturas de proveedor\dbrtl.dcp" />
<DCCReference Include="..\..\Facturas de proveedor\dsnap.dcp" />
<DCCReference Include="..\..\Facturas de proveedor\dxComnD11.dcp" />
<DCCReference Include="..\..\Facturas de proveedor\dxCoreD11.dcp" />
<DCCReference Include="..\..\Facturas de proveedor\dxGDIPlusD11.dcp" />
<DCCReference Include="..\..\Facturas de proveedor\dxLayoutControlD11.dcp" />
<DCCReference Include="..\..\Facturas de proveedor\dxThemeD11.dcp" />
<DCCReference Include="..\..\Facturas de proveedor\Fabricantes_controller.dcp" />
<DCCReference Include="..\..\Facturas de proveedor\Familias_controller.dcp" />
<DCCReference Include="..\..\Facturas de proveedor\GUIBase.dcp" />
<DCCReference Include="..\..\Facturas de proveedor\GUISDK_D11R.dcp" />
<DCCReference Include="..\..\Facturas de proveedor\RemObjects_Core_D11.dcp" />
<DCCReference Include="..\..\Facturas de proveedor\rtl.dcp" />
<DCCReference Include="..\..\Facturas de proveedor\UnidadesMedida_controller.dcp" />
<DCCReference Include="..\..\Facturas de proveedor\vcl.dcp" />
<DCCReference Include="..\..\Facturas de proveedor\vcldb.dcp" />
<DCCReference Include="..\..\Facturas de proveedor\vcljpg.dcp" />
<DCCReference Include="..\..\Facturas de proveedor\vclx.dcp" />
<DCCReference Include="adortl.dcp" />
<DCCReference Include="Articulos_controller.dcp" />
<DCCReference Include="Articulos_model.dcp" />
<DCCReference Include="Contactos_model.dcp" />
<DCCReference Include="Contactos_view.dcp" />
<DCCReference Include="cxDataD11.dcp" />
<DCCReference Include="cxEditorsD11.dcp" />
<DCCReference Include="cxExportD11.dcp" />
<DCCReference Include="cxExtEditorsD11.dcp" />
<DCCReference Include="cxGridD11.dcp" />
<DCCReference Include="cxLibraryD11.dcp" />
<DCCReference Include="cxPageControlD11.dcp" />
<DCCReference Include="DataAbstract_Core_D11.dcp" />
<DCCReference Include="dbrtl.dcp" />
<DCCReference Include="dsnap.dcp" />
<DCCReference Include="dxComnD11.dcp" />
<DCCReference Include="dxCoreD11.dcp" />
<DCCReference Include="dxGDIPlusD11.dcp" />
<DCCReference Include="dxLayoutControlD11.dcp" />
<DCCReference Include="dxThemeD11.dcp" />
<DCCReference Include="Fabricantes_controller.dcp" />
<DCCReference Include="Familias_controller.dcp" />
<DCCReference Include="GUIBase.dcp" />
<DCCReference Include="GUISDK_D11R.dcp" />
<DCCReference Include="PngComponentsD10.dcp" />
<DCCReference Include="PNG_D10.dcp" />
<DCCReference Include="RemObjects_Core_D11.dcp" />
<DCCReference Include="rtl.dcp" />
<DCCReference Include="uArticulosViewRegister.pas" />
<DCCReference Include="uEditorArticulo.pas">
<Form>fEditorArticulo</Form>
@ -95,6 +96,7 @@
<Form>fEditorElegirArticulos</Form>
<DesignClass>TfEditorElegirArticulos</DesignClass>
</DCCReference>
<DCCReference Include="UnidadesMedida_controller.dcp" />
<DCCReference Include="uViewArticulo.pas">
<Form>frViewArticulo</Form>
<DesignClass>TFrame</DesignClass>
@ -107,6 +109,7 @@
<Form>frViewArticulosPorProveedor</Form>
<DesignClass>TFrame</DesignClass>
</DCCReference>
<DCCReference Include="uViewArticulosProveedores.pas" />
<DCCReference Include="uViewDetallesArticulos.pas">
<Form>frViewDetallesArticulos</Form>
<DesignClass>TFrame</DesignClass>
@ -127,6 +130,11 @@
<Form>frViewProveedoresArticulo</Form>
<DesignClass>TFrame</DesignClass>
</DCCReference>
<DCCReference Include="vcl.dcp" />
<DCCReference Include="vclactnband.dcp" />
<DCCReference Include="vcldb.dcp" />
<DCCReference Include="vcljpg.dcp" />
<DCCReference Include="vclx.dcp" />
</ItemGroup>
</Project>
<!-- EurekaLog First Line

View File

@ -1,6 +1,6 @@
inherited frViewArticulo: TfrViewArticulo
Width = 451
Height = 304
Width = 719
Height = 451
Align = alClient
OnCreate = CustomViewCreate
OnDestroy = CustomViewDestroy
@ -9,18 +9,20 @@ inherited frViewArticulo: TfrViewArticulo
object dxLayoutControlArticulo: TdxLayoutControl
Left = 0
Top = 0
Width = 451
Height = 304
Width = 719
Height = 451
Align = alClient
ParentBackground = True
TabOrder = 0
TabStop = False
AutoContentSizes = [acsWidth]
ExplicitWidth = 451
ExplicitHeight = 304
DesignSize = (
451
304)
719
451)
object PngSpeedButton2: TPngSpeedButton
Left = 389
Left = 674
Top = 331
Width = 23
Height = 22
@ -47,7 +49,7 @@ inherited frViewArticulo: TfrViewArticulo
PngOptions = [pngBlendOnDisabled, pngGrayscaleOnDisabled]
end
object PngSpeedButton1: TPngSpeedButton
Left = 389
Left = 674
Top = 359
Width = 23
Height = 22

View File

@ -119,10 +119,9 @@ inherited frViewProveedorArticulo: TfrViewProveedorArticulo
Top = 163
DataBinding.DataField = 'PRECIO_NETO'
Properties.Alignment.Horz = taRightJustify
Properties.ReadOnly = True
Properties.ReadOnly = False
Style.BorderColor = clWindowFrame
Style.BorderStyle = ebs3D
Style.Color = clBtnFace
Style.HotTrack = False
Style.LookAndFeel.Kind = lfStandard
Style.LookAndFeel.NativeStyle = True

View File

@ -33,11 +33,15 @@ type
procedure CustomViewCreate(Sender: TObject);
procedure CustomViewDestroy(Sender: TObject);
procedure OnProveedorChange(Sender: TObject);
procedure PrecioCosteChanged(Sender: TObject);
procedure DescuentoChanged(Sender: TObject);
procedure PrecioNetoChanged(Sender: TObject);
procedure CustomViewShow(Sender: TObject);
protected
FProveedoresController : IProveedoresController;
FProveedores : IBizProveedor;
procedure DesactivarEventos;
procedure ActivarEventos;
public
{ Public declarations }
end;
@ -48,6 +52,17 @@ var
implementation
{$R *.dfm}
uses
Math;
procedure TfrViewProveedorArticulo.ActivarEventos;
begin
eProveedor.Properties.OnEditValueChanged := OnProveedorChange;
ePrecioCoste.Properties.OnEditValueChanged := PrecioCosteChanged;
eDescuento.Properties.OnEditValueChanged := DescuentoChanged;
ePrecioNeto.Properties.OnEditValueChanged := PrecioNetoChanged;
end;
procedure TfrViewProveedorArticulo.CustomViewCreate(Sender: TObject);
begin
inherited;
@ -62,9 +77,7 @@ end;
procedure TfrViewProveedorArticulo.CustomViewDestroy(Sender: TObject);
begin
ePrecioCoste.Properties.OnEditValueChanged := NIL;
eDescuento.Properties.OnEditValueChanged := NIL;
eProveedor.Properties.OnEditValueChanged := NIL;
DesactivarEventos;
FProveedoresController := NIL;
FProveedores := NIL;
inherited;
@ -73,9 +86,41 @@ end;
procedure TfrViewProveedorArticulo.CustomViewShow(Sender: TObject);
begin
inherited;
eProveedor.Properties.OnEditValueChanged := OnProveedorChange;
ePrecioCoste.Properties.OnEditValueChanged := PrecioNetoChanged;
eDescuento.Properties.OnEditValueChanged := PrecioNetoChanged;
ActivarEventos;
end;
procedure TfrViewProveedorArticulo.DesactivarEventos;
begin
ePrecioNeto.Properties.OnEditValueChanged := NIL;
ePrecioCoste.Properties.OnEditValueChanged := NIL;
eDescuento.Properties.OnEditValueChanged := NIL;
eProveedor.Properties.OnEditValueChanged := NIL;
end;
procedure TfrViewProveedorArticulo.DescuentoChanged(Sender: TObject);
var
APrecioCoste: Double;
ADescuento: Double;
begin
APrecioCoste := 0;
ADescuento := 0;
if eDescuento.EditModified then
begin
if not varIsNull(ePrecioCoste.DataBinding.Field.AsFloat) then
APrecioCoste := ePrecioCoste.DataBinding.Field.AsFloat;
if not varIsNull(eDescuento.DataBinding.Field.AsFloat) then
ADescuento := eDescuento.DataBinding.Field.AsFloat;
DesactivarEventos;
try
ePrecioNeto.DataBinding.DataSource.Edit;
ePrecioNeto.DataBinding.Field.AsFloat := APrecioCoste - ((APrecioCoste * ADescuento)/100)
finally
ActivarEventos;
end;
end;
end;
procedure TfrViewProveedorArticulo.OnProveedorChange(Sender: TObject);
@ -84,12 +129,12 @@ begin
FProveedores.first;
if FProveedores.Locate('ID', eProveedor.EditValue) then
begin
eDescuento.EditValue := FProveedores.DESCUENTO;
eDescuento.DataBinding.Field.AsFloat := FProveedores.DESCUENTO;
cbTiendaWeb.DataBinding.Field.AsInteger := FProveedores.TIENDA_WEB;
end;
end;
procedure TfrViewProveedorArticulo.PrecioNetoChanged(Sender: TObject);
procedure TfrViewProveedorArticulo.PrecioCosteChanged(Sender: TObject);
var
APrecioCoste: Double;
ADescuento: Double;
@ -97,13 +142,54 @@ begin
APrecioCoste := 0;
ADescuento := 0;
if not varIsNull(ePrecioCoste.EditValue) then
APrecioCoste := ePrecioCoste.EditValue;
if ePrecioCoste.EditModified then
begin
if not varIsNull(ePrecioCoste.DataBinding.Field.AsFloat) then
APrecioCoste := ePrecioCoste.DataBinding.Field.AsFloat;
if not varIsNull(eDescuento.EditValue) then
ADescuento := eDescuento.EditValue;
if not varIsNull(eDescuento.DataBinding.Field.AsFloat) then
ADescuento := eDescuento.DataBinding.Field.AsFloat;
ePrecioNeto.EditValue := APrecioCoste - ((APrecioCoste * ADescuento)/100)
DesactivarEventos;
try
ePrecioNeto.DataBinding.DataSource.Edit;
ePrecioNeto.DataBinding.Field.AsFloat := APrecioCoste - ((APrecioCoste * ADescuento)/100);
finally
ActivarEventos;
end;
end;
end;
procedure TfrViewProveedorArticulo.PrecioNetoChanged(Sender: TObject);
var
APrecioCoste: Double;
APrecioNeto: Double;
ADescuento : Double;
begin
APrecioCoste := 0;
APrecioNeto := 0;
ADescuento := 0;
if ePrecioNeto.EditModified then
begin
if not varIsNull(ePrecioCoste.EditValue) then
APrecioCoste := ePrecioCoste.EditValue;
if not varIsNull(ePrecioNeto.EditValue) then
APrecioNeto := ePrecioNeto.EditValue;
if (APrecioCoste <> 0) then
ADescuento := ((APrecioCoste - APrecioNeto) * 100) / APrecioCoste;
DesactivarEventos;
try
eDescuento.DataBinding.DataSource.Edit;
eDescuento.DataBinding.Field.AsFloat := RoundTo(ADescuento, -2);
finally
ActivarEventos;
end;
end;
end;
end.

Binary file not shown.

View File

@ -14,7 +14,7 @@ BEGIN
BEGIN
VALUE "FileVersion", "4.4.0.0\0"
VALUE "ProductVersion", "4.4.0.0\0"
VALUE "CompileDate", "lunes, 07 de julio de 2014 11:24\0"
VALUE "CompileDate", "viernes, 08 de agosto de 2014 17:54\0"
END
END
BLOCK "VarFileInfo"