Cambios en albaranes de proveedor y facturas de proveedor para que al introducis un importe de porte se desglose automáticamente con los articulos del albaran o factura

git-svn-id: https://192.168.0.254/svn/Proyectos.LuisLeon_FactuGES/trunk@137 c93665c3-c93d-084d-9b98-7d5f4a9c3376
This commit is contained in:
roberto 2007-08-22 15:36:37 +00:00
parent 670350fbac
commit 6bfc50d3c6
41 changed files with 794 additions and 14425 deletions

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -46,6 +46,10 @@ inherited fEditorDBItem: TfEditorDBItem
TabOrder = 2
object pagGeneral: TTabSheet
Caption = 'General'
ExplicitLeft = 0
ExplicitTop = 0
ExplicitWidth = 0
ExplicitHeight = 0
end
end
inherited StatusBar: TJvStatusBar

View File

@ -8,7 +8,13 @@
<Option Name="GUID">{897CD5E4-3D47-418F-BD7A-AD0C0C4FDE6A}</Option>
</Option>
</PersonalityInfo>
<Default.Personality> <Projects>
<Default.Personality>
<Projects>
<Projects Name="DataAbstract_D10.bpl">DataAbstract_D10\DataAbstract_D10.bdsproj</Projects>
<Projects Name="Base.bpl">Base\Base.bdsproj</Projects>
<Projects Name="ControllerBase.bpl">Base\ControllerBase\ControllerBase.bdsproj</Projects>
@ -87,9 +93,12 @@
<Projects Name="FactuGES_Server.exe">Servidor\FactuGES_Server.bdsproj</Projects>
<Projects Name="PedProv_AlbProv_relation.bpl">Modulos\Relaciones\Pedidos de proveedor - Albaranes de proveedor\PedProv_AlbProv_relation.bdsproj</Projects>
<Projects Name="AlbCli_FacCli_relation.bpl">Modulos\Relaciones\Albaranes de cliente - Facturas de cliente\AlbCli_FacCli_relation.bdsproj</Projects>
<Projects Name="FacturasProveedor_controller.bpl">Modulos\Facturas de proveedor\Controller\FacturasProveedor_controller.bdsproj</Projects>
<Projects Name="AlbProv_FacProv_relation.bpl">Modulos\Relaciones\Albaranes de proveedor - Facturas de proveedor\AlbProv_FacProv_relation.bdsproj</Projects>
<Projects Name="Comisiones_view.bpl">Modulos\Comisiones\Views\Comisiones_view.bdsproj</Projects>
<Projects Name="Targets">DataAbstract_D10.bpl Base.bpl ControllerBase.bpl GUIBase.bpl Empresas_model.bpl Empresas_data.bpl Empresas_controller.bpl Usuarios.bpl Empresas_view.bpl Empresas_plugin.bpl TiposIVA_model.bpl TiposIVA_data.bpl TiposIVA_controller.bpl TiposIVA_view.bpl TiposIVA_plugin.bpl Contactos_model.bpl Contactos_data.bpl Contactos_controller.bpl Contactos_view.bpl Contactos_plugin.bpl Almacenes_model.bpl Almacenes_data.bpl Almacenes_controller.bpl Almacenes_view.bpl Almacenes_plugin.bpl Articulos_model.bpl Articulos_data.bpl Articulos_controller.bpl Articulos_view.bpl Articulos_plugin.bpl RecibosCliente_model.bpl RecibosCliente_data.bpl RecibosCliente_controller.bpl RecibosCliente_view.bpl RecibosCliente_plugin.bpl RemesasCliente_model.bpl RemesasCliente_data.bpl RemesasCliente_controller.bpl BancaElectronica_controller.bpl BancaElectronica_view.bpl RemesasCliente_view.bpl RemesasCliente_plugin.bpl PedidosCliente_model.bpl PedidosCliente_data.bpl PedidosCliente_controller.bpl AlbaranesCliente_model.bpl AlbaranesCliente_data.bpl AlbaranesCliente_controller.bpl FacturasCliente_model.bpl FacturasCliente_data.bpl FacturasCliente_controller.bpl PedidosProveedor_model.bpl PedidosProveedor_data.bpl PedidosProveedor_controller.bpl Inventario_model.bpl Inventario_data.bpl Inventario_controller.bpl AlbaranesProveedor_model.bpl AlbaranesProveedor_data.bpl AlbaranesProveedor_controller.bpl PedCli_PedProv_relation.bpl PedCli_AlbCli_relation.bpl PedidosCliente_view.bpl PedidosCliente_plugin.bpl AlbaranesCliente_view.bpl AlbaranesCliente_plugin.bpl FacturasCliente_view.bpl FacturasCliente_plugin.bpl Inventario_view.bpl Inventario_plugin.bpl PedidosProveedor_view.bpl PedidosProveedor_plugin.bpl AlbaranesProveedor_view.bpl AlbaranesProveedor_plugin.bpl FactuGES.exe FactuGES_Server.exe PedProv_AlbProv_relation.bpl AlbCli_FacCli_relation.bpl AlbProv_FacProv_relation.bpl Comisiones_view.bpl</Projects>
<Projects Name="FacturasProveedor_view.bpl">Modulos\Facturas de proveedor\Views\FacturasProveedor_view.bdsproj</Projects>
<Projects Name="FacturasProveedor_model.bpl">Modulos\Facturas de proveedor\Model\FacturasProveedor_model.bdsproj</Projects>
<Projects Name="FacturasProveedor_data.bpl">Modulos\Facturas de proveedor\Data\FacturasProveedor_data.bdsproj</Projects>
<Projects Name="Targets">DataAbstract_D10.bpl Base.bpl ControllerBase.bpl GUIBase.bpl Empresas_model.bpl Empresas_data.bpl Empresas_controller.bpl Usuarios.bpl Empresas_view.bpl Empresas_plugin.bpl TiposIVA_model.bpl TiposIVA_data.bpl TiposIVA_controller.bpl TiposIVA_view.bpl TiposIVA_plugin.bpl Contactos_model.bpl Contactos_data.bpl Contactos_controller.bpl Contactos_view.bpl Contactos_plugin.bpl Almacenes_model.bpl Almacenes_data.bpl Almacenes_controller.bpl Almacenes_view.bpl Almacenes_plugin.bpl Articulos_model.bpl Articulos_data.bpl Articulos_controller.bpl Articulos_view.bpl Articulos_plugin.bpl RecibosCliente_model.bpl RecibosCliente_data.bpl RecibosCliente_controller.bpl RecibosCliente_view.bpl RecibosCliente_plugin.bpl RemesasCliente_model.bpl RemesasCliente_data.bpl RemesasCliente_controller.bpl BancaElectronica_controller.bpl BancaElectronica_view.bpl RemesasCliente_view.bpl RemesasCliente_plugin.bpl PedidosCliente_model.bpl PedidosCliente_data.bpl PedidosCliente_controller.bpl AlbaranesCliente_model.bpl AlbaranesCliente_data.bpl AlbaranesCliente_controller.bpl FacturasCliente_model.bpl FacturasCliente_data.bpl FacturasCliente_controller.bpl PedidosProveedor_model.bpl PedidosProveedor_data.bpl PedidosProveedor_controller.bpl Inventario_model.bpl Inventario_data.bpl Inventario_controller.bpl AlbaranesProveedor_model.bpl AlbaranesProveedor_data.bpl AlbaranesProveedor_controller.bpl PedCli_PedProv_relation.bpl PedCli_AlbCli_relation.bpl PedidosCliente_view.bpl PedidosCliente_plugin.bpl AlbaranesCliente_view.bpl AlbaranesCliente_plugin.bpl FacturasCliente_view.bpl FacturasCliente_plugin.bpl Inventario_view.bpl Inventario_plugin.bpl PedidosProveedor_view.bpl PedidosProveedor_plugin.bpl AlbaranesProveedor_view.bpl AlbaranesProveedor_plugin.bpl FactuGES.exe FactuGES_Server.exe PedProv_AlbProv_relation.bpl AlbCli_FacCli_relation.bpl FacturasProveedor_controller.bpl AlbProv_FacProv_relation.bpl FacturasProveedor_view.bpl FacturasProveedor_model.bpl FacturasProveedor_data.bpl</Projects>
</Projects>
<Dependencies/>
</Default.Personality>

View File

@ -66,6 +66,7 @@ type
procedure OnNewRecord(Sender: TDADataTable); override;
procedure IniciarValoresAlbaranNuevo;
public
procedure CalcularImporteTotal;
function EsNuevo : Boolean;
@ -94,7 +95,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_PORTE; ya no se tiene en cuenta porque se desglosa por artículo
end;
procedure TBizAlbaranProveedor.CalcularImporteTotal;

View File

@ -2,11 +2,11 @@ inherited fEditorAlbaranProveedor: TfEditorAlbaranProveedor
Left = 332
Top = 147
Caption = 'Nuevo albar'#225'n de proveedor'
ClientHeight = 565
ClientHeight = 619
ClientWidth = 765
OnClose = CustomEditorClose
ExplicitWidth = 773
ExplicitHeight = 599
ExplicitHeight = 653
PixelsPerInch = 96
TextHeight = 13
inherited JvNavPanelHeader: TJvNavPanelHeader
@ -146,23 +146,26 @@ inherited fEditorAlbaranProveedor: TfEditorAlbaranProveedor
end
inherited pgPaginas: TPageControl
Width = 765
Height = 425
Height = 460
TabOrder = 1
OnChanging = pgPaginasChanging
ExplicitWidth = 765
ExplicitHeight = 425
inherited pagGeneral: TTabSheet
ExplicitLeft = 4
ExplicitTop = 24
ExplicitWidth = 757
ExplicitHeight = 397
end
object pagContenido: TTabSheet
Caption = 'Contenido'
ImageIndex = 1
ExplicitHeight = 397
inline frViewDetallesAlbaranProveedor1: TfrViewDetallesAlbaranProveedor
Left = 0
Top = 0
Width = 757
Height = 397
Height = 432
Align = alClient
BiDiMode = bdLeftToRight
Font.Charset = DEFAULT_CHARSET
@ -182,7 +185,7 @@ inherited fEditorAlbaranProveedor: TfEditorAlbaranProveedor
end
inherited cxGrid: TcxGrid
Width = 757
Height = 325
Height = 360
ExplicitWidth = 757
ExplicitHeight = 325
end
@ -198,15 +201,12 @@ inherited fEditorAlbaranProveedor: TfEditorAlbaranProveedor
object pagInicidencias: TTabSheet
Caption = 'Incidencias'
ImageIndex = 2
ExplicitLeft = 0
ExplicitTop = 0
ExplicitWidth = 0
ExplicitHeight = 0
ExplicitHeight = 397
inline frViewIncidenciasCli: TfrViewIncidencias
Left = 0
Top = 0
Width = 757
Height = 397
Height = 432
Align = alClient
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
@ -227,13 +227,13 @@ inherited fEditorAlbaranProveedor: TfEditorAlbaranProveedor
end
inherited GroupBox1: TGroupBox
Width = 757
Height = 369
Height = 404
ExplicitWidth = 757
ExplicitHeight = 369
ExplicitHeight = 423
inherited eIncidencias: TcxDBMemo
ExplicitWidth = 734
ExplicitHeight = 336
Height = 336
ExplicitHeight = 390
Height = 371
Width = 734
end
end
@ -241,7 +241,7 @@ inherited fEditorAlbaranProveedor: TfEditorAlbaranProveedor
end
end
inherited StatusBar: TJvStatusBar
Top = 546
Top = 600
Width = 765
Panels = <
item
@ -252,9 +252,9 @@ inherited fEditorAlbaranProveedor: TfEditorAlbaranProveedor
end
inline frViewTotales1: TfrViewTotales [4]
Left = 0
Top = 501
Top = 536
Width = 765
Height = 45
Height = 64
Align = alBottom
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
@ -264,9 +264,9 @@ inherited fEditorAlbaranProveedor: TfEditorAlbaranProveedor
ParentFont = False
TabOrder = 4
ReadOnly = False
ExplicitTop = 501
ExplicitTop = 536
ExplicitWidth = 765
ExplicitHeight = 45
ExplicitHeight = 64
inherited dxLayoutControl1: TdxLayoutControl
Width = 765
LookAndFeel = dxLayoutOfficeLookAndFeel1
@ -416,10 +416,21 @@ inherited fEditorAlbaranProveedor: TfEditorAlbaranProveedor
ShowCaption = False
ShowBorder = False
inherited dxLayoutControl1Group2: TdxLayoutGroup
Visible = False
inherited dxLayoutControl1Item8: TdxLayoutItem
Visible = False
end
inherited dxLayoutControl1Group6: TdxLayoutGroup
Visible = False
end
inherited dxLayoutControl1Item16: TdxLayoutItem
Visible = False
end
inherited dxLayoutControl1Item10: TdxLayoutItem
Visible = False
end
inherited dxLayoutControl1Group7: TdxLayoutGroup
Visible = False
end
end
inherited dxLayoutControl1Group5: TdxLayoutGroup
inherited dxLayoutControl1Item13: TdxLayoutItem

View File

@ -168,6 +168,12 @@ procedure TfEditorAlbaranProveedor.frViewTotales1ePortePropertiesValidate(
begin
inherited;
FAlbaran.IMPORTE_PORTE := DisplayValue;
//Esta lógica se llamará en el editor porque es para facilitar el rellenado de información del documento
//no puede ir en la clase de negocio porque no es una lógica que tenga sentido fuera del editor.
if Assigned(Controller)
and Assigned(Controller.DetallesController) then
Controller.DetallesController.DesglosarPorteDetalles(FAlbaran.IMPORTE_PORTE, FAlbaran.Detalles)
end;
function TfEditorAlbaranProveedor.GetController: IAlbaranesProveedorController;

View File

@ -22,6 +22,7 @@ type
procedure ActualizarDetalles(ADetalles: IDAStronglyTypedDataTable; AArticulos: IBizArticulo);
procedure CambiarSignoDetalles(ADetalles: IDAStronglyTypedDataTable);
procedure AnadirConceptoInicial(ADetalles: IDAStronglyTypedDataTable; AConcepto: String);
procedure DesglosarPorteDetalles(ImportePorte: Currency; ADetalles: IDAStronglyTypedDataTable);
end;
TControllerDetallesArticulos = class (TControllerDetallesDTO, IControllerDetallesArticulos)
@ -48,6 +49,7 @@ type
procedure ActualizarDetalles(ADetalles: IDAStronglyTypedDataTable; AArticulos: IBizArticulo);
procedure CambiarSignoDetalles(ADetalles: IDAStronglyTypedDataTable);
procedure AnadirConceptoInicial(ADetalles: IDAStronglyTypedDataTable; AConcepto: String);
procedure DesglosarPorteDetalles(ImportePorte: Currency; ADetalles: IDAStronglyTypedDataTable);
constructor Create; override;
destructor Destroy; override;
@ -58,7 +60,7 @@ implementation
{ TControllerDetallesArticulos }
uses Dialogs, cxControls, SysUtils, uDAInterfaces, uControllerDetallesBase, schArticulosClient_Intf;
uses DB, Dialogs, cxControls, SysUtils, uDAInterfaces, uControllerDetallesBase, schArticulosClient_Intf;
{ TControllerDetallesArticulos }
@ -304,6 +306,52 @@ begin
AsignarController;
end;
procedure TControllerDetallesArticulos.DesglosarPorteDetalles(ImportePorte: Currency; ADetalles: IDAStronglyTypedDataTable);
var
Unidades: Integer;
ImporteUnidad: Currency;
ABookmark : TBookmark;
begin
try
ABookmark := ADetalles.DataTable.GetBookMark;
ADetalles.DataTable.DisableControls;
ADetalles.DataTable.DisableEventHandlers;
ADetalles.DataTable.First;
Unidades := 0;
while not ADetalles.DataTable.eof do
begin
if (ADetalles.DataTable.FieldByName(CAMPO_ID_ARTICULOS).AsInteger > 0) then
Unidades := Unidades + ADetalles.DataTable.FieldByName(CAMPO_CANTIDAD).AsInteger;
ADetalles.DataTable.Next;
end;
if Unidades > 0 then
ImporteUnidad := ImportePorte / Unidades;
ADetalles.DataTable.First;
while not ADetalles.DataTable.eof do
begin
if (ADetalles.DataTable.FieldByName(CAMPO_ID_ARTICULOS).AsInteger > 0) then
begin
ADetalles.DataTable.Edit;
ADetalles.DataTable.FieldByName(CAMPO_IMPORTE_PORTE).AsCurrency := ImporteUnidad * ADetalles.DataTable.FieldByName(CAMPO_CANTIDAD).AsInteger;
ADetalles.DataTable.Post;
end;
ADetalles.DataTable.Next;
end;
finally
ADetalles.DataTable.EnableEventHandlers;
ADetalles.DataTable.GotoBookmark(ABookmark);
ADetalles.DataTable.FreeBookmark(ABookmark);
ADetalles.DataTable.EnableControls;
end;
ActualizarTotales(ADetalles);
end;
destructor TControllerDetallesArticulos.Destroy;
begin
FArticulosController := Nil;

View File

@ -129,7 +129,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_PORTE; ya no se tiene en cuenta porque se desglosa por artículo
end;
procedure TBizFacturaProveedor.CalcularDescuento;

View File

@ -42,7 +42,7 @@ inherited fEditorFacturaProveedor: TfEditorFacturaProveedor
Width = 788
ExplicitWidth = 788
inherited tbxMain: TTBXToolbar
ExplicitWidth = 482
ExplicitWidth = 488
inherited TBXItem2: TTBXItem
Visible = False
end
@ -165,10 +165,6 @@ inherited fEditorFacturaProveedor: TfEditorFacturaProveedor
object pagContenido: TTabSheet
Caption = 'Contenido'
ImageIndex = 1
ExplicitLeft = 0
ExplicitTop = 0
ExplicitWidth = 0
ExplicitHeight = 0
inline frViewDetallesFacturaProveedor1: TfrViewDetallesFacturaProveedor
Left = 0
Top = 0
@ -209,40 +205,40 @@ inherited fEditorFacturaProveedor: TfEditorFacturaProveedor
ExplicitLeft = 145
end
inherited UpDown1: TUpDown
Left = 187
ExplicitLeft = 187
Left = 203
ExplicitLeft = 203
end
inherited ToolButton13: TToolButton
Left = 204
ExplicitLeft = 204
Left = 220
ExplicitLeft = 220
end
inherited ToolButton6: TToolButton
Left = 212
ExplicitLeft = 212
Left = 228
ExplicitLeft = 228
end
inherited ToolButton7: TToolButton
Left = 246
ExplicitLeft = 246
Left = 262
ExplicitLeft = 262
end
inherited ToolButton8: TToolButton
Left = 280
ExplicitLeft = 280
Left = 296
ExplicitLeft = 296
end
inherited ToolButton12: TToolButton
Left = 314
ExplicitLeft = 314
Left = 330
ExplicitLeft = 330
end
inherited ToolButton9: TToolButton
Left = 322
ExplicitLeft = 322
Left = 338
ExplicitLeft = 338
end
inherited ToolButton10: TToolButton
Left = 356
ExplicitLeft = 356
Left = 372
ExplicitLeft = 372
end
inherited ToolButton11: TToolButton
Left = 390
ExplicitLeft = 390
Left = 406
ExplicitLeft = 406
end
end
inherited cxGrid: TcxGrid
@ -431,9 +427,6 @@ inherited fEditorFacturaProveedor: TfEditorFacturaProveedor
Visible = False
end
end
inherited dxLayoutControl1Item9: TdxLayoutItem
Visible = False
end
end
inherited dxLayoutControl1Group5: TdxLayoutGroup
inherited dxLayoutControl1Group3: TdxLayoutGroup

View File

@ -197,7 +197,13 @@ procedure TfEditorFacturaProveedor.frViewTotales1ePortePropertiesValidate(
var Error: Boolean);
begin
inherited;
Factura.IMPORTE_PORTE := DisplayValue;
FFactura.IMPORTE_PORTE := DisplayValue;
//Esta lógica se llamará en el editor porque es para facilitar el rellenado de información del documento
//no puede ir en la clase de negocio porque no es una lógica que tenga sentido fuera del editor.
if Assigned(Controller)
and Assigned(Controller.DetallesController) then
Controller.DetallesController.DesglosarPorteDetalles(FFactura.IMPORTE_PORTE, FFactura.Detalles)
end;
function TfEditorFacturaProveedor.GetController: IFacturasProveedorController;