Ultimos arreglos en informes para permitir intervalo de fechas y visualización de columnas

git-svn-id: https://192.168.0.254/svn/Proyectos.LuisLeon_FactuGES/trunk@133 c93665c3-c93d-084d-9b98-7d5f4a9c3376
This commit is contained in:
roberto 2007-08-21 14:39:58 +00:00
parent 91f5b806d5
commit 0ec0d589bc
72 changed files with 15188 additions and 2065 deletions

Binary file not shown.

View File

@ -2527,9 +2527,9 @@ CREATE VIEW V_INF_MARGEN_ARTICULOS(
POR_MARGEN_PRO_VENT_PRO_COMP) POR_MARGEN_PRO_VENT_PRO_COMP)
AS AS
select select
V_INF_MARGEN_VENTAS.id_empresa, MARGEN_VENTAS.id_empresa,
V_INF_MARGEN_VENTAS.id_cliente, MARGEN_VENTAS.id_cliente,
V_INF_MARGEN_VENTAS.id_articulo, MARGEN_VENTAS.id_articulo,
CLIENTES.NIF_CIF, CLIENTES.NIF_CIF,
CLIENTES.NOMBRE, CLIENTES.NOMBRE,
@ -2545,52 +2545,52 @@ ARTICULOS.DESCRIPCION,
ARTICULOS.COMISIONABLE, ARTICULOS.COMISIONABLE,
ARTICULOS.INVENTARIABLE, ARTICULOS.INVENTARIABLE,
COALESCE(V_INF_MARGEN_VENTAS.importe_unidad_ult_vent, 0), COALESCE(MARGEN_VENTAS.importe_unidad_ult_vent, 0),
COALESCE(V_INF_MARGEN_VENTAS.importe_neto_ult_vent, 0), COALESCE(MARGEN_VENTAS.importe_neto_ult_vent, 0),
COALESCE(V_INF_MARGEN_VENTAS.importe_porte_ult_vent, 0), COALESCE(MARGEN_VENTAS.importe_porte_ult_vent, 0),
COALESCE(V_INF_MARGEN_VENTAS.importe_unidad_pro_vent, 0), COALESCE(MARGEN_VENTAS.importe_unidad_pro_vent, 0),
COALESCE(V_INF_MARGEN_VENTAS.importe_neto_pro_vent, 0), COALESCE(MARGEN_VENTAS.importe_neto_pro_vent, 0),
COALESCE(V_INF_MARGEN_VENTAS.importe_porte_pro_vent, 0), COALESCE(MARGEN_VENTAS.importe_porte_pro_vent, 0),
COALESCE(ARTICULOS.PRECIO_COSTE, 0), COALESCE(ARTICULOS.PRECIO_COSTE, 0),
COALESCE(ARTICULOS.PRECIO_NETO, 0), COALESCE(ARTICULOS.PRECIO_NETO, 0),
COALESCE(ARTICULOS.PRECIO_PORTE, 0), COALESCE(ARTICULOS.PRECIO_PORTE, 0),
COALESCE(V_INF_MARGEN_COMPRAS.importe_unidad_ult_comp, 0), COALESCE(MARGEN_COMPRAS.importe_unidad_ult_comp, 0),
COALESCE(V_INF_MARGEN_COMPRAS.importe_neto_ult_comp, 0), COALESCE(MARGEN_COMPRAS.importe_neto_ult_comp, 0),
COALESCE(V_INF_MARGEN_COMPRAS.importe_porte_ult_comp, 0), COALESCE(MARGEN_COMPRAS.importe_porte_ult_comp, 0),
COALESCE(V_INF_MARGEN_COMPRAS.importe_unidad_pro_comp, 0), COALESCE(MARGEN_COMPRAS.importe_unidad_pro_comp, 0),
COALESCE(V_INF_MARGEN_COMPRAS.importe_neto_pro_comp, 0), COALESCE(MARGEN_COMPRAS.importe_neto_pro_comp, 0),
COALESCE(V_INF_MARGEN_COMPRAS.importe_porte_pro_comp, 0), COALESCE(MARGEN_COMPRAS.importe_porte_pro_comp, 0),
/*MARGEN CON ULTIMA VENTA*/ /*MARGEN CON ULTIMA VENTA*/
V_INF_MARGEN_VENTAS.importe_neto_ult_vent - ARTICULOS.PRECIO_NETO as imp_margen_ult_vent_compra, MARGEN_VENTAS.importe_neto_ult_vent - ARTICULOS.PRECIO_NETO as imp_margen_ult_vent_compra,
CASE CASE
WHEN ARTICULOS.PRECIO_NETO = 0 THEN 100 WHEN ARTICULOS.PRECIO_NETO = 0 THEN 100
WHEN (V_INF_MARGEN_VENTAS.importe_neto_ult_vent - ARTICULOS.PRECIO_NETO) > 0 THEN WHEN (MARGEN_VENTAS.importe_neto_ult_vent - ARTICULOS.PRECIO_NETO) > 0 THEN
(ARTICULOS.PRECIO_NETO * 100) / V_INF_MARGEN_VENTAS.importe_neto_ult_vent (ARTICULOS.PRECIO_NETO * 100) / MARGEN_VENTAS.importe_neto_ult_vent
ELSE 0 ELSE 0
END END
as por_margen_ult_vent_compra, as por_margen_ult_vent_compra,
V_INF_MARGEN_VENTAS.importe_neto_ult_vent - V_INF_MARGEN_COMPRAS.importe_neto_ult_comp as imp_margen_ult_vent_ult_comp, MARGEN_VENTAS.importe_neto_ult_vent - MARGEN_COMPRAS.importe_neto_ult_comp as imp_margen_ult_vent_ult_comp,
CASE CASE
WHEN V_INF_MARGEN_COMPRAS.importe_neto_ult_comp = 0 THEN 100 WHEN MARGEN_COMPRAS.importe_neto_ult_comp = 0 THEN 100
WHEN (V_INF_MARGEN_VENTAS.importe_neto_ult_vent - V_INF_MARGEN_COMPRAS.importe_neto_ult_comp) > 0 THEN WHEN (MARGEN_VENTAS.importe_neto_ult_vent - MARGEN_COMPRAS.importe_neto_ult_comp) > 0 THEN
(V_INF_MARGEN_COMPRAS.importe_neto_ult_comp * 100) / V_INF_MARGEN_VENTAS.importe_neto_ult_vent (MARGEN_COMPRAS.importe_neto_ult_comp * 100) / MARGEN_VENTAS.importe_neto_ult_vent
ELSE 0 ELSE 0
END END
as por_margen_ult_vent_ult_comp, as por_margen_ult_vent_ult_comp,
V_INF_MARGEN_VENTAS.importe_neto_ult_vent - V_INF_MARGEN_COMPRAS.importe_neto_pro_comp as imp_margen_ult_vent_pro_comp, MARGEN_VENTAS.importe_neto_ult_vent - MARGEN_COMPRAS.importe_neto_pro_comp as imp_margen_ult_vent_pro_comp,
CASE CASE
WHEN V_INF_MARGEN_COMPRAS.importe_neto_pro_comp = 0 THEN 100 WHEN MARGEN_COMPRAS.importe_neto_pro_comp = 0 THEN 100
WHEN (V_INF_MARGEN_VENTAS.importe_neto_ult_vent - V_INF_MARGEN_COMPRAS.importe_neto_pro_comp) > 0 THEN WHEN (MARGEN_VENTAS.importe_neto_ult_vent - MARGEN_COMPRAS.importe_neto_pro_comp) > 0 THEN
(V_INF_MARGEN_COMPRAS.importe_neto_pro_comp * 100) / V_INF_MARGEN_VENTAS.importe_neto_ult_vent (MARGEN_COMPRAS.importe_neto_pro_comp * 100) / MARGEN_VENTAS.importe_neto_ult_vent
ELSE 0 ELSE 0
END END
as por_margen_ult_vent_pro_comp, as por_margen_ult_vent_pro_comp,
@ -2598,48 +2598,123 @@ as por_margen_ult_vent_pro_comp,
/*MARGEN CON VENTAS PROMEDIO*/ /*MARGEN CON VENTAS PROMEDIO*/
V_INF_MARGEN_VENTAS.importe_neto_pro_vent - ARTICULOS.PRECIO_NETO as imp_margen_pro_vent_compra, MARGEN_VENTAS.importe_neto_pro_vent - ARTICULOS.PRECIO_NETO as imp_margen_pro_vent_compra,
CASE CASE
WHEN ARTICULOS.PRECIO_NETO = 0 THEN 100 WHEN ARTICULOS.PRECIO_NETO = 0 THEN 100
WHEN (V_INF_MARGEN_VENTAS.importe_neto_pro_vent - ARTICULOS.PRECIO_NETO) > 0 THEN WHEN (MARGEN_VENTAS.importe_neto_pro_vent - ARTICULOS.PRECIO_NETO) > 0 THEN
(ARTICULOS.PRECIO_NETO * 100) / V_INF_MARGEN_VENTAS.importe_neto_pro_vent (ARTICULOS.PRECIO_NETO * 100) / MARGEN_VENTAS.importe_neto_pro_vent
ELSE 0 ELSE 0
END END
as por_margen_pro_vent_compra, as por_margen_pro_vent_compra,
V_INF_MARGEN_VENTAS.importe_neto_pro_vent - V_INF_MARGEN_COMPRAS.importe_neto_ult_comp as imp_margen_pro_vent_ult_comp, MARGEN_VENTAS.importe_neto_pro_vent - MARGEN_COMPRAS.importe_neto_ult_comp as imp_margen_pro_vent_ult_comp,
CASE CASE
WHEN V_INF_MARGEN_COMPRAS.importe_neto_ult_comp = 0 THEN 100 WHEN MARGEN_COMPRAS.importe_neto_ult_comp = 0 THEN 100
WHEN (V_INF_MARGEN_VENTAS.importe_neto_pro_vent - V_INF_MARGEN_COMPRAS.importe_neto_ult_comp) > 0 THEN WHEN (MARGEN_VENTAS.importe_neto_pro_vent - MARGEN_COMPRAS.importe_neto_ult_comp) > 0 THEN
(V_INF_MARGEN_COMPRAS.importe_neto_ult_comp * 100) / V_INF_MARGEN_VENTAS.importe_neto_pro_vent (MARGEN_COMPRAS.importe_neto_ult_comp * 100) / MARGEN_VENTAS.importe_neto_pro_vent
ELSE 0 ELSE 0
END END
as por_margen_pro_vent_ult_comp, as por_margen_pro_vent_ult_comp,
V_INF_MARGEN_VENTAS.importe_neto_pro_vent - V_INF_MARGEN_COMPRAS.importe_neto_pro_comp as imp_margen_pro_vent_pro_comp, MARGEN_VENTAS.importe_neto_pro_vent - MARGEN_COMPRAS.importe_neto_pro_comp as imp_margen_pro_vent_pro_comp,
CASE CASE
WHEN V_INF_MARGEN_COMPRAS.importe_neto_pro_comp = 0 THEN 100 WHEN MARGEN_COMPRAS.importe_neto_pro_comp = 0 THEN 100
WHEN (V_INF_MARGEN_VENTAS.importe_neto_pro_vent - V_INF_MARGEN_COMPRAS.importe_neto_pro_comp) > 0 THEN WHEN (MARGEN_VENTAS.importe_neto_pro_vent - MARGEN_COMPRAS.importe_neto_pro_comp) > 0 THEN
(V_INF_MARGEN_COMPRAS.importe_neto_pro_comp * 100) / V_INF_MARGEN_VENTAS.importe_neto_pro_vent (MARGEN_COMPRAS.importe_neto_pro_comp * 100) / MARGEN_VENTAS.importe_neto_pro_vent
ELSE 0 ELSE 0
END END
as por_margen_pro_vent_pro_comp as por_margen_pro_vent_pro_comp
FROM
from V_INF_MARGEN_VENTAS /*Antigua V_INF_MARGEN_VENTAS*/
(select ID_EMPRESA, ID_CLIENTE, ID_ARTICULO, COALESCE(SUM(IMPORTE_UNIDAD_ULT_VENT),0) as importe_unidad_ult_vent,
COALESCE(SUM(IMPORTE_NETO_ULT_VENT),0) as importe_neto_ult_vent, COALESCE(SUM(IMPORTE_PORTE_ULT_VENT),0) as importe_porte_ult_vent,
COALESCE(SUM(IMPORTE_UNIDAD_PRO_VENT),0) as importe_unidad_pro_vent, COALESCE(SUM(IMPORTE_NETO_PRO_VENT),0) as importe_neto_pro_vent,
COALESCE(SUM(IMPORTE_PORTE_PRO_VENT),0) as importe_porte_pro_vent
left join v_inf_margen_compras from
on (v_inf_margen_compras.id_empresa = v_INF_MARGEN_ventas.id_empresa) (select
and (v_inf_margen_compras.id_articulo = v_INF_MARGEN_ventas.id_articulo) ID_EMPRESA, ID_CLIENTE, ID_ARTICULO,
IMPORTE_UNIDAD_VENTA as IMPORTE_UNIDAD_ULT_VENT, IMPORTE_NETO_VENTA as IMPORTE_NETO_ULT_VENT, IMPORTE_PORTE_VENTA as IMPORTE_PORTE_ULT_VENT,
null as IMPORTE_UNIDAD_PRO_VENT, null as IMPORTE_NETO_PRO_VENT, null as IMPORTE_PORTE_PRO_VENT
left join ARTICULOS from v_inf_ultima_venta
on (ARTICULOS.ID = v_INF_MARGEN_ventas.id_articulo)
left join CONTACTOS CLIENTES on (CLIENTES.ID = V_INF_MARGEN_VENTAS.ID_CLIENTE) union all
left join CLIENTES_DATOS on (CLIENTES_DATOS.ID_CLIENTE = CLIENTES.ID)
left join CONTACTOS AGENTES on (AGENTES.ID = CLIENTES_DATOS.ID_AGENTE)
where (ARTICULOS.INVENTARIABLE = 1); /*Antigua V_INF_PROMEDIO_VENTA*/
select
facturas_cliente.id_empresa,
facturas_cliente.id_cliente,
facturas_cliente_detalles.ID_ARTICULO,
null, null, null,
avg(facturas_cliente_detalles.IMPORTE_UNIDAD) as IMPORTE_UNIDAD_PRO_VENT,
avg(facturas_cliente_detalles.IMPORTE_UNIDAD - (facturas_cliente_detalles.IMPORTE_UNIDAD * (facturas_cliente_detalles.DESCUENTO / 100))) AS IMPORTE_NETO_PRO_VENT,
avg(facturas_cliente_detalles.IMPORTE_PORTE) as IMPORTE_PORTE_PRO_VENT
from facturas_cliente_detalles
left outer join facturas_cliente
on (facturas_cliente.id = facturas_cliente_detalles.id_factura)
where (facturas_cliente_detalles.ID_ARTICULO IS NOT NULL) and (facturas_cliente_detalles.ID_ARTICULO > 0) /*Quitamos conceptos libres*/
and (facturas_cliente_detalles.cantidad > 0) /*Quitamos los abonos*/
/*AND INTERVALO DE FECHAS*/
group by 1, 2, 3)
group by 1, 2, 3) MARGEN_VENTAS
LEFT JOIN
/*Antigua V_INF_MARGEN_COMPRAS*/
(select
ID_EMPRESA, ID_ARTICULO, COALESCE(SUM(IMPORTE_UNIDAD_ULT_COMP),0) as importe_unidad_ult_comp, COALESCE(SUM(IMPORTE_NETO_ULT_COMP),0) as importe_neto_ult_comp,
COALESCE(SUM(IMPORTE_PORTE_ULT_COMP),0) as importe_porte_ult_comp, COALESCE(SUM(IMPORTE_UNIDAD_PRO_COMP),0) as importe_unidad_pro_comp,
COALESCE(SUM(IMPORTE_NETO_PRO_COMP),0) as importe_neto_pro_comp, COALESCE(SUM(IMPORTE_PORTE_PRO_COMP),0) as importe_porte_pro_comp
from
(select
ID_EMPRESA, ID_ARTICULO,
IMPORTE_UNIDAD_COMPRA as IMPORTE_UNIDAD_ULT_COMP, IMPORTE_NETO_COMPRA as IMPORTE_NETO_ULT_COMP, IMPORTE_PORTE_COMPRA as IMPORTE_PORTE_ULT_COMP,
null as IMPORTE_UNIDAD_PRO_COMP, null as IMPORTE_NETO_PRO_COMP, null as IMPORTE_PORTE_PRO_COMP
from v_inf_ultima_compra
union all
/*Antigua V_INF_PROMEDIO_COMPRA*/
select
facturas_proveedor.id_empresa,
facturas_proveedor_detalles.ID_ARTICULO,
null, null, null,
avg(facturas_proveedor_detalles.IMPORTE_UNIDAD) as IMPORTE_UNIDAD_PRO_COMP,
avg(facturas_proveedor_detalles.IMPORTE_UNIDAD - (facturas_proveedor_detalles.IMPORTE_UNIDAD * (facturas_proveedor_detalles.DESCUENTO / 100))) AS IMPORTE_NETO_PRO_COMP,
avg(facturas_proveedor_detalles.IMPORTE_PORTE) as IMPORTE_PORTE_PRO_COMP
from facturas_proveedor_detalles
left outer join facturas_proveedor
on (facturas_proveedor.id = facturas_proveedor_detalles.id_factura)
where (facturas_proveedor_detalles.ID_ARTICULO IS NOT NULL) and (facturas_proveedor_detalles.ID_ARTICULO > 0) /*Quitamos conceptos libres*/
and (facturas_proveedor_detalles.cantidad > 0) /*Quitamos los abonos*/
/*AND INTERVALO DE FECHAS*/
group by 1, 2)
group by 1, 2) MARGEN_COMPRAS
ON (MARGEN_COMPRAS.id_empresa = MARGEN_VENTAS.id_empresa)
AND (MARGEN_COMPRAS.id_articulo = MARGEN_VENTAS.id_articulo)
LEFT JOIN ARTICULOS ON (ARTICULOS.ID = MARGEN_VENTAS.id_articulo)
LEFT JOIN CONTACTOS CLIENTES on (CLIENTES.ID = MARGEN_VENTAS.ID_CLIENTE)
LEFT JOIN CLIENTES_DATOS on (CLIENTES_DATOS.ID_CLIENTE = CLIENTES.ID)
LEFT JOIN CONTACTOS AGENTES on (AGENTES.ID = CLIENTES_DATOS.ID_AGENTE)
WHERE (ARTICULOS.INVENTARIABLE = 1);
/* Al igual que en Varela tendremos esta vista para hacer todos los informes que queramos de ventas, ya que estará desglosado por artículo */ /* Al igual que en Varela tendremos esta vista para hacer todos los informes que queramos de ventas, ya que estará desglosado por artículo */

Binary file not shown.

Binary file not shown.

View File

@ -1,2 +1,2 @@
[Server] [Server]
URL=http://localhost:8099/bin URL=http://localhost:8090/bin

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@ -8,9 +8,7 @@
<Option Name="GUID">{2F12F93C-605F-4442-9FAC-D846A40B7499}</Option> <Option Name="GUID">{2F12F93C-605F-4442-9FAC-D846A40B7499}</Option>
</Option> </Option>
</PersonalityInfo> </PersonalityInfo>
<Default.Personality> <Default.Personality> <Projects>
<Projects>
<Projects Name="DataAbstract_D10.bpl">DataAbstract_D10\DataAbstract_D10.bdsproj</Projects> <Projects Name="DataAbstract_D10.bpl">DataAbstract_D10\DataAbstract_D10.bdsproj</Projects>
<Projects Name="Base.bpl">Base\Base.bdsproj</Projects> <Projects Name="Base.bpl">Base\Base.bdsproj</Projects>
<Projects Name="GUIBase.bpl">Base\GUIBase\GUIBase.bdsproj</Projects> <Projects Name="GUIBase.bpl">Base\GUIBase\GUIBase.bdsproj</Projects>
@ -33,7 +31,8 @@
<Projects Name="InfMargenArticulo_plugin.bpl">Modulos\Informe margen por articulo\Plugin\InfMargenArticulo_plugin.bdsproj</Projects> <Projects Name="InfMargenArticulo_plugin.bpl">Modulos\Informe margen por articulo\Plugin\InfMargenArticulo_plugin.bdsproj</Projects>
<Projects Name="FactuGES.exe">Cliente\FactuGES.bdsproj</Projects> <Projects Name="FactuGES.exe">Cliente\FactuGES.bdsproj</Projects>
<Projects Name="FactuGES_Server.exe">Servidor\FactuGES_Server.bdsproj</Projects> <Projects Name="FactuGES_Server.exe">Servidor\FactuGES_Server.bdsproj</Projects>
<Projects Name="Targets">DataAbstract_D10.bpl Base.bpl GUIBase.bpl Informes_model.bpl Informes_data.bpl Informes_controller.bpl InformesBase_controller.bpl Informes_view.bpl InformesBase_view.bpl Informes_plugin.bpl InfVentasArticulo_model.bpl InfVentasArticulo_data.bpl InfVentasArticulo_controller.bpl InfVentasArticulo_view.bpl InfVentasArticulo_plugin.bpl InfMargenArticulo_model.bpl InfMargenArticulo_data.bpl InfMargenArticulo_controller.bpl InfMargenArticulo_view.bpl InfMargenArticulo_plugin.bpl FactuGES.exe FactuGES_Server.exe</Projects> <Projects Name="Articulos_view.bpl">Modulos\Articulos\Views\Articulos_view.bdsproj</Projects>
<Projects Name="Targets">DataAbstract_D10.bpl Base.bpl GUIBase.bpl Informes_model.bpl Informes_data.bpl Informes_controller.bpl InformesBase_controller.bpl Informes_view.bpl InformesBase_view.bpl Informes_plugin.bpl InfVentasArticulo_model.bpl InfVentasArticulo_data.bpl InfVentasArticulo_controller.bpl InfVentasArticulo_view.bpl InfVentasArticulo_plugin.bpl InfMargenArticulo_model.bpl InfMargenArticulo_data.bpl InfMargenArticulo_controller.bpl InfMargenArticulo_view.bpl InfMargenArticulo_plugin.bpl FactuGES.exe FactuGES_Server.exe Articulos_view.bpl</Projects>
</Projects> </Projects>
<Dependencies/> <Dependencies/>
</Default.Personality> </Default.Personality>

Binary file not shown.

Binary file not shown.

View File

@ -87,16 +87,6 @@ inherited fEditorClientes: TfEditorClientes
ExplicitWidth = 786 ExplicitWidth = 786
ExplicitHeight = 270 ExplicitHeight = 270
inherited cxGridView: TcxGridDBTableView inherited cxGridView: TcxGridDBTableView
DataController.Summary.FooterSummaryItems = <
item
Format = '0 clientes'
Kind = skCount
end
item
Format = '0 clientes'
Kind = skCount
Column = frViewClientes1.cxGridViewTiendaWeb
end>
end end
end end
inherited frViewFiltroBase1: TfrViewFiltroBase inherited frViewFiltroBase1: TfrViewFiltroBase

View File

@ -68,13 +68,6 @@ inherited fEditorProveedores: TfEditorProveedores
ExplicitWidth = 543 ExplicitWidth = 543
ExplicitHeight = 195 ExplicitHeight = 195
inherited cxGridView: TcxGridDBTableView inherited cxGridView: TcxGridDBTableView
DataController.Summary.FooterSummaryItems = <
item
Format = '0 proveedores'
Kind = skCount
FieldName = 'ID'
Column = frViewProveedores1.cxGridViewREFERENCIA
end>
end end
end end
inherited frViewFiltroBase1: TfrViewFiltroBase inherited frViewFiltroBase1: TfrViewFiltroBase
@ -86,16 +79,16 @@ inherited fEditorProveedores: TfEditorProveedores
Width = 543 Width = 543
ExplicitWidth = 543 ExplicitWidth = 543
inherited txtFiltroTodo: TcxTextEdit inherited txtFiltroTodo: TcxTextEdit
ExplicitWidth = 273 ExplicitWidth = 457
Width = 273 Width = 457
end end
inherited edtFechaIniFiltro: TcxDateEdit inherited edtFechaIniFiltro: TcxDateEdit
ExplicitWidth = 121 ExplicitWidth = 240
Width = 121 Width = 240
end end
inherited edtFechaFinFiltro: TcxDateEdit inherited edtFechaFinFiltro: TcxDateEdit
Left = 277 Left = 337
ExplicitLeft = 277 ExplicitLeft = 337
ExplicitWidth = 201 ExplicitWidth = 201
Width = 201 Width = 201
end end

View File

@ -2,10 +2,6 @@ inherited frViewClientes: TfrViewClientes
inherited cxGrid: TcxGrid inherited cxGrid: TcxGrid
inherited cxGridView: TcxGridDBTableView inherited cxGridView: TcxGridDBTableView
DataController.Summary.FooterSummaryItems = < DataController.Summary.FooterSummaryItems = <
item
Format = '0 clientes'
Kind = skCount
end
item item
Format = '0 clientes' Format = '0 clientes'
Kind = skCount Kind = skCount
@ -78,13 +74,8 @@ inherited frViewClientes: TfrViewClientes
Width = 121 Width = 121
end end
inherited edtFechaFinFiltro: TcxDateEdit inherited edtFechaFinFiltro: TcxDateEdit
ExplicitWidth = 121 ExplicitWidth = 201
Width = 121 Width = 201
end
end
inherited TBXAlignmentPanel1: TTBXAlignmentPanel
inherited tbxBotones: TTBXToolbar
Width = 547
end end
end end
end end

View File

@ -13,7 +13,7 @@ inherited frViewProveedores: TfrViewProveedores
item item
Format = '0 proveedores' Format = '0 proveedores'
Kind = skCount Kind = skCount
FieldName = 'ID' FieldName = 'NIF_CIF'
Column = cxGridViewNIF_CIF Column = cxGridViewNIF_CIF
end> end>
inherited cxGridViewICONO: TcxGridDBColumn inherited cxGridViewICONO: TcxGridDBColumn
@ -50,23 +50,17 @@ inherited frViewProveedores: TfrViewProveedores
inherited dxLayoutControl1: TdxLayoutControl inherited dxLayoutControl1: TdxLayoutControl
Width = 483 Width = 483
ExplicitWidth = 483 ExplicitWidth = 483
inherited txtFiltroTodo: TcxTextEdit
ExplicitWidth = 273
Width = 273
end
inherited edtFechaIniFiltro: TcxDateEdit
ExplicitWidth = 121
Width = 121
end
inherited edtFechaFinFiltro: TcxDateEdit inherited edtFechaFinFiltro: TcxDateEdit
ExplicitWidth = 225 ExplicitWidth = 149
Width = 225 Width = 149
end end
end end
inherited TBXAlignmentPanel1: TTBXAlignmentPanel inherited TBXAlignmentPanel1: TTBXAlignmentPanel
Width = 483 Width = 483
ExplicitWidth = 483
inherited tbxBotones: TTBXToolbar inherited tbxBotones: TTBXToolbar
Width = 473 Width = 473
ExplicitWidth = 473
end end
end end
end end

View File

@ -9,7 +9,7 @@ const
{ Data table rules ids { Data table rules ids
Feel free to change them to something more human readable Feel free to change them to something more human readable
but make sure they are unique in the context of your application } but make sure they are unique in the context of your application }
RID_InfMargenArticulo = '{C7326EC8-8B75-4411-A72B-D4DC22188E12}'; RID_InfMargenArticulo = '{CAD3971F-0746-414E-9D24-39D78E9C8795}';
{ Data table names } { Data table names }
nme_InfMargenArticulo = 'InfMargenArticulo'; nme_InfMargenArticulo = 'InfMargenArticulo';
@ -103,7 +103,7 @@ const
type type
{ IInfMargenArticulo } { IInfMargenArticulo }
IInfMargenArticulo = interface(IDAStronglyTypedDataTable) IInfMargenArticulo = interface(IDAStronglyTypedDataTable)
['{3F971B3F-A487-494A-9878-1F8C907698A0}'] ['{5CC3A6EA-5D25-4D3E-A94F-04B1CAD301C4}']
{ Property getters and setters } { Property getters and setters }
function GetID_EMPRESAValue: Integer; function GetID_EMPRESAValue: Integer;
procedure SetID_EMPRESAValue(const aValue: Integer); procedure SetID_EMPRESAValue(const aValue: Integer);

View File

@ -9,12 +9,12 @@ const
{ Delta rules ids { Delta rules ids
Feel free to change them to something more human readable Feel free to change them to something more human readable
but make sure they are unique in the context of your application } but make sure they are unique in the context of your application }
RID_InfMargenArticuloDelta = '{CDF81831-CF6A-48A3-8833-4574CB195605}'; RID_InfMargenArticuloDelta = '{E8D3A873-E61E-4AB3-8669-CA10D5D2CE05}';
type type
{ IInfMargenArticuloDelta } { IInfMargenArticuloDelta }
IInfMargenArticuloDelta = interface(IInfMargenArticulo) IInfMargenArticuloDelta = interface(IInfMargenArticulo)
['{CDF81831-CF6A-48A3-8833-4574CB195605}'] ['{E8D3A873-E61E-4AB3-8669-CA10D5D2CE05}']
{ Property getters and setters } { Property getters and setters }
function GetOldID_EMPRESAValue : Integer; function GetOldID_EMPRESAValue : Integer;
function GetOldID_CLIENTEValue : Integer; function GetOldID_CLIENTEValue : Integer;

View File

@ -69,9 +69,9 @@ procedure TBizInfMargenArticulo.OnBeforeDataRequestCall(
begin begin
Request.ParamByName('Columns').AsString := VisibleColumns; Request.ParamByName('Columns').AsString := VisibleColumns;
FDateParams.Clear; FDateParams.Clear;
// NewDatasetParam(FDateParams, 'FECHAINI', DataTable.ParamByName('FECHAINI').AsDateTime); NewDatasetParam(FDateParams, 'FECHAINI', DataTable.ParamByName('FECHAINI').AsDateTime);
// NewDatasetParam(FDateParams, 'FECHAFIN', DataTable.ParamByName('FECHAFIN').AsDateTime); NewDatasetParam(FDateParams, 'FECHAFIN', DataTable.ParamByName('FECHAFIN').AsDateTime);
// Request.ParamByName('Params').AsComplexType := FDateParams; Request.ParamByName('Params').AsComplexType := FDateParams;
end; end;
procedure TBizInfMargenArticulo.OnBeforeSchemaCall(DataTable: TDADataTable; Request: TDARemoteRequest); procedure TBizInfMargenArticulo.OnBeforeSchemaCall(DataTable: TDADataTable; Request: TDARemoteRequest);

View File

@ -11,29 +11,175 @@ object srvInfMargenArticulo: TsrvInfMargenArticulo
DataDictionary = DataDictionary DataDictionary = DataDictionary
Datasets = < Datasets = <
item item
Params = <> Params = <
item
Name = 'FECHAINI'
BlobType = dabtUnknown
Value = ''
ParamType = daptInput
end
item
Name = 'FECHAFIN'
BlobType = dabtUnknown
Value = ''
ParamType = daptInput
end>
Statements = < Statements = <
item item
Connection = 'IBX' Connection = 'IBX'
TargetTable = 'V_INF_MARGEN_ARTICULOS' TargetTable = 'INF_MARGEN_ARTICULOS'
SQL = SQL =
'SELECT'#10' ID_EMPRESA,'#10' ID_CLIENTE,'#10' ID_ARTICULO,'#10' NIF_' + 'SELECT'#10#10' INF_MARGEN_ARTICULOS.ID_EMPRESA,'#10' INF_MARGEN_ARTI' +
'CIF_CLIENTE,'#10' NOMBRE_CLIENTE,'#10' NOMBRE_COMERCIAL_CLIENTE,'#10' ' + 'CULOS.ID_CLIENTE,'#10' INF_MARGEN_ARTICULOS.ID_ARTICULO,'#10' INF_' +
' NIF_CIF_AGENTE,'#10' NOMBRE_AGENTE,'#10' FAMILIA,'#10' REFERENCI' + 'MARGEN_ARTICULOS.NIF_CIF_CLIENTE,'#10' INF_MARGEN_ARTICULOS.NOMBR' +
'A,'#10' REFERENCIA_PROV,'#10' DESCRIPCION,'#10' COMISIONABLE,'#10' I' + 'E_CLIENTE,'#10' INF_MARGEN_ARTICULOS.NOMBRE_COMERCIAL_CLIENTE,'#10' ' +
'NVENTARIABLE,'#10' IMP_UNIDAD_ULT_VENT,'#10' IMP_NETO_ULT_VENT,'#10' ' + ' INF_MARGEN_ARTICULOS.NIF_CIF_AGENTE,'#10' INF_MARGEN_ARTICULOS.' +
' IMP_PORTE_ULT_VENT,'#10' IMP_UNIDAD_PRO_VENT,'#10' IMP_NETO_PRO_' + 'NOMBRE_AGENTE,'#10' INF_MARGEN_ARTICULOS.FAMILIA,'#10' INF_MARGEN_' +
'VENT,'#10' IMP_PORTE_PRO_VENT,'#10' IMP_UNIDAD_COMPRA,'#10' IMP_NET' + 'ARTICULOS.REFERENCIA,'#10' INF_MARGEN_ARTICULOS.REFERENCIA_PROV,'#10 +
'O_COMPRA,'#10' IMP_PORTE_COMPRA,'#10' IMP_UNIDAD_ULT_COMP,'#10' IMP' + ' INF_MARGEN_ARTICULOS.DESCRIPCION,'#10' INF_MARGEN_ARTICULOS.C' +
'_NETO_ULT_COMP,'#10' IMP_PORTE_ULT_COMP,'#10' IMP_UNIDAD_PRO_COMP,' + 'OMISIONABLE,'#10' INF_MARGEN_ARTICULOS.INVENTARIABLE,'#10' INF_MAR' +
#10' IMP_NETO_PRO_COMP,'#10' IMP_PORTE_PRO_COMP,'#10' IMP_MARGEN_U' + 'GEN_ARTICULOS.IMP_UNIDAD_ULT_VENT,'#10' INF_MARGEN_ARTICULOS.IMP_' +
'LT_VENT_COMPRA,'#10' POR_MARGEN_ULT_VENT_COMPRA,'#10' IMP_MARGEN_U' + 'NETO_ULT_VENT,'#10' INF_MARGEN_ARTICULOS.IMP_PORTE_ULT_VENT,'#10' ' +
'LT_VENT_ULT_COMP,'#10' POR_MARGEN_ULT_VENT_ULT_COMP,'#10' IMP_MARG' + 'INF_MARGEN_ARTICULOS.IMP_UNIDAD_PRO_VENT,'#10' INF_MARGEN_ARTICUL' +
'EN_ULT_VENT_PRO_COMP,'#10' POR_MARGEN_ULT_VENT_PRO_COMP,'#10' IMP_' + 'OS.IMP_NETO_PRO_VENT,'#10' INF_MARGEN_ARTICULOS.IMP_PORTE_PRO_VEN' +
'MARGEN_PRO_VENT_COMPRA,'#10' POR_MARGEN_PRO_VENT_COMPRA,'#10' IMP_' + 'T,'#10' INF_MARGEN_ARTICULOS.IMP_UNIDAD_COMPRA,'#10' INF_MARGEN_AR' +
'MARGEN_PRO_VENT_ULT_COMP,'#10' POR_MARGEN_PRO_VENT_ULT_COMP,'#10' ' + 'TICULOS.IMP_NETO_COMPRA,'#10' INF_MARGEN_ARTICULOS.IMP_PORTE_COMP' +
'IMP_MARGEN_PRO_VENT_PRO_COMP,'#10' POR_MARGEN_PRO_VENT_PRO_COMP'#10' ' + 'RA,'#10' INF_MARGEN_ARTICULOS.IMP_UNIDAD_ULT_COMP,'#10' INF_MARGEN' +
' '#10'FROM V_INF_MARGEN_ARTICULOS' '_ARTICULOS.IMP_NETO_ULT_COMP,'#10' INF_MARGEN_ARTICULOS.IMP_PORTE' +
'_ULT_COMP,'#10' INF_MARGEN_ARTICULOS.IMP_UNIDAD_PRO_COMP,'#10' INF' +
'_MARGEN_ARTICULOS.IMP_NETO_PRO_COMP,'#10' INF_MARGEN_ARTICULOS.IM' +
'P_PORTE_PRO_COMP,'#10' INF_MARGEN_ARTICULOS.IMP_MARGEN_ULT_VENT_C' +
'OMPRA,'#10' INF_MARGEN_ARTICULOS.POR_MARGEN_ULT_VENT_COMPRA,'#10' ' +
'INF_MARGEN_ARTICULOS.IMP_MARGEN_ULT_VENT_ULT_COMP,'#10' INF_MARGE' +
'N_ARTICULOS.POR_MARGEN_ULT_VENT_ULT_COMP,'#10' INF_MARGEN_ARTICUL' +
'OS.IMP_MARGEN_ULT_VENT_PRO_COMP,'#10' INF_MARGEN_ARTICULOS.POR_MA' +
'RGEN_ULT_VENT_PRO_COMP,'#10' INF_MARGEN_ARTICULOS.IMP_MARGEN_PRO_' +
'VENT_COMPRA,'#10' INF_MARGEN_ARTICULOS.POR_MARGEN_PRO_VENT_COMPRA' +
','#10' INF_MARGEN_ARTICULOS.IMP_MARGEN_PRO_VENT_ULT_COMP,'#10' INF' +
'_MARGEN_ARTICULOS.POR_MARGEN_PRO_VENT_ULT_COMP,'#10' INF_MARGEN_A' +
'RTICULOS.IMP_MARGEN_PRO_VENT_PRO_COMP,'#10' INF_MARGEN_ARTICULOS.' +
'POR_MARGEN_PRO_VENT_PRO_COMP'#10#10'FROM'#10#10'(SELECT'#10'MARGEN_VENTAS.ID_EMP' +
'RESA AS ID_EMPRESA,'#10'MARGEN_VENTAS.ID_CLIENTE AS ID_CLIENTE,'#10'MARG' +
'EN_VENTAS.ID_ARTICULO AS ID_ARTICULO,'#10#10'CLIENTES.NIF_CIF AS NIF_C' +
'IF_CLIENTE,'#10'CLIENTES.NOMBRE AS NOMBRE_CLIENTE,'#10'CLIENTES_DATOS.NO' +
'MBRE_COMERCIAL AS NOMBRE_COMERCIAL_CLIENTE,'#10#10'AGENTES.NIF_CIF AS ' +
'NIF_CIF_AGENTE,'#10'AGENTES.NOMBRE AS NOMBRE_AGENTE,'#10#10'ARTICULOS.FAMI' +
'LIA AS FAMILIA,'#10'ARTICULOS.REFERENCIA AS REFERENCIA,'#10'ARTICULOS.RE' +
'FERENCIA_PROV AS REFERENCIA_PROV,'#10'ARTICULOS.DESCRIPCION AS DESCR' +
'IPCION,'#10'ARTICULOS.COMISIONABLE AS COMISIONABLE,'#10'ARTICULOS.INVENT' +
'ARIABLE AS INVENTARIABLE,'#10#10'COALESCE(MARGEN_VENTAS.IMPORTE_UNIDAD' +
'_ULT_VENT, 0) AS IMP_UNIDAD_ULT_VENT,'#10'COALESCE(MARGEN_VENTAS.IMP' +
'ORTE_NETO_ULT_VENT, 0) AS IMP_NETO_ULT_VENT,'#10'COALESCE(MARGEN_VEN' +
'TAS.IMPORTE_PORTE_ULT_VENT, 0) AS IMP_PORTE_ULT_VENT,'#10#10'COALESCE(' +
'MARGEN_VENTAS.IMPORTE_UNIDAD_PRO_VENT, 0) AS IMP_UNIDAD_PRO_VENT' +
','#10'COALESCE(MARGEN_VENTAS.IMPORTE_NETO_PRO_VENT, 0) AS IMP_NETO_P' +
'RO_VENT,'#10'COALESCE(MARGEN_VENTAS.IMPORTE_PORTE_PRO_VENT, 0) AS IM' +
'P_PORTE_PRO_VENT,'#10#10'COALESCE(ARTICULOS.PRECIO_COSTE, 0) AS IMP_UN' +
'IDAD_COMPRA,'#10'COALESCE(ARTICULOS.PRECIO_NETO, 0) AS IMP_NETO_COMP' +
'RA,'#10'COALESCE(ARTICULOS.PRECIO_PORTE, 0) AS IMP_PORTE_COMPRA,'#10#10'CO' +
'ALESCE(MARGEN_COMPRAS.IMPORTE_UNIDAD_ULT_COMP, 0) AS IMP_UNIDAD_' +
'ULT_COMP,'#10'COALESCE(MARGEN_COMPRAS.IMPORTE_NETO_ULT_COMP, 0) AS I' +
'MP_NETO_ULT_COMP,'#10'COALESCE(MARGEN_COMPRAS.IMPORTE_PORTE_ULT_COMP' +
', 0) AS IMP_PORTE_ULT_COMP,'#10#10'COALESCE(MARGEN_COMPRAS.IMPORTE_UNI' +
'DAD_PRO_COMP, 0) AS IMP_UNIDAD_PRO_COMP,'#10'COALESCE(MARGEN_COMPRAS' +
'.IMPORTE_NETO_PRO_COMP, 0) AS IMP_NETO_PRO_COMP,'#10'COALESCE(MARGEN' +
'_COMPRAS.IMPORTE_PORTE_PRO_COMP, 0) AS IMP_PORTE_PRO_COMP,'#10#10#10#10#10'M' +
'ARGEN_VENTAS.IMPORTE_NETO_ULT_VENT - ARTICULOS.PRECIO_NETO AS IM' +
'P_MARGEN_ULT_VENT_COMPRA,'#10'CASE'#10'WHEN ARTICULOS.PRECIO_NETO = 0 T' +
'HEN 100'#10'WHEN (MARGEN_VENTAS.IMPORTE_NETO_ULT_VENT - ARTICULOS.PR' +
'ECIO_NETO) > 0 THEN'#10' (ARTICULOS.PRECIO_NETO * 100) / MARGEN_' +
'VENTAS.IMPORTE_NETO_ULT_VENT'#10'ELSE 0'#10'END'#10'AS POR_MARGEN_ULT_VENT_C' +
'OMPRA,'#10#10'MARGEN_VENTAS.IMPORTE_NETO_ULT_VENT - MARGEN_COMPRAS.IMP' +
'ORTE_NETO_ULT_COMP AS IMP_MARGEN_ULT_VENT_ULT_COMP,'#10'CASE'#10'WHEN M' +
'ARGEN_COMPRAS.IMPORTE_NETO_ULT_COMP = 0 THEN 100'#10'WHEN (MARGEN_VE' +
'NTAS.IMPORTE_NETO_ULT_VENT - MARGEN_COMPRAS.IMPORTE_NETO_ULT_COM' +
'P) > 0 THEN'#10' (MARGEN_COMPRAS.IMPORTE_NETO_ULT_COMP * 100) / ' +
'MARGEN_VENTAS.IMPORTE_NETO_ULT_VENT'#10'ELSE 0'#10'END'#10'AS POR_MARGEN_ULT' +
'_VENT_ULT_COMP,'#10#10'MARGEN_VENTAS.IMPORTE_NETO_ULT_VENT - MARGEN_CO' +
'MPRAS.IMPORTE_NETO_PRO_COMP AS IMP_MARGEN_ULT_VENT_PRO_COMP,'#10'CAS' +
'E'#10'WHEN MARGEN_COMPRAS.IMPORTE_NETO_PRO_COMP = 0 THEN 100'#10'WHEN (' +
'MARGEN_VENTAS.IMPORTE_NETO_ULT_VENT - MARGEN_COMPRAS.IMPORTE_NET' +
'O_PRO_COMP) > 0 THEN'#10' (MARGEN_COMPRAS.IMPORTE_NETO_PRO_COMP ' +
'* 100) / MARGEN_VENTAS.IMPORTE_NETO_ULT_VENT'#10'ELSE 0'#10'END'#10'AS POR_M' +
'ARGEN_ULT_VENT_PRO_COMP,'#10#10#10#10'MARGEN_VENTAS.IMPORTE_NETO_PRO_VENT ' +
'- ARTICULOS.PRECIO_NETO AS IMP_MARGEN_PRO_VENT_COMPRA,'#10'CASE'#10'WHEN' +
' ARTICULOS.PRECIO_NETO = 0 THEN 100'#10'WHEN (MARGEN_VENTAS.IMPORTE' +
'_NETO_PRO_VENT - ARTICULOS.PRECIO_NETO) > 0 THEN'#10' (ARTICULOS' +
'.PRECIO_NETO * 100) / MARGEN_VENTAS.IMPORTE_NETO_PRO_VENT'#10'ELSE 0' +
#10'END'#10'AS POR_MARGEN_PRO_VENT_COMPRA,'#10#10'MARGEN_VENTAS.IMPORTE_NETO_' +
'PRO_VENT - MARGEN_COMPRAS.IMPORTE_NETO_ULT_COMP AS IMP_MARGEN_PR' +
'O_VENT_ULT_COMP,'#10'CASE'#10'WHEN MARGEN_COMPRAS.IMPORTE_NETO_ULT_COMP' +
' = 0 THEN 100'#10'WHEN (MARGEN_VENTAS.IMPORTE_NETO_PRO_VENT - MARGEN' +
'_COMPRAS.IMPORTE_NETO_ULT_COMP) > 0 THEN'#10' (MARGEN_COMPRAS.IM' +
'PORTE_NETO_ULT_COMP * 100) / MARGEN_VENTAS.IMPORTE_NETO_PRO_VENT' +
#10'ELSE 0'#10'END'#10'AS POR_MARGEN_PRO_VENT_ULT_COMP,'#10#10'MARGEN_VENTAS.IMPO' +
'RTE_NETO_PRO_VENT - MARGEN_COMPRAS.IMPORTE_NETO_PRO_COMP AS IMP_' +
'MARGEN_PRO_VENT_PRO_COMP,'#10'CASE'#10'WHEN MARGEN_COMPRAS.IMPORTE_NETO' +
'_PRO_COMP = 0 THEN 100'#10'WHEN (MARGEN_VENTAS.IMPORTE_NETO_PRO_VENT' +
' - MARGEN_COMPRAS.IMPORTE_NETO_PRO_COMP) > 0 THEN'#10' (MARGEN_C' +
'OMPRAS.IMPORTE_NETO_PRO_COMP * 100) / MARGEN_VENTAS.IMPORTE_NETO' +
'_PRO_VENT'#10'ELSE 0'#10'END'#10'AS POR_MARGEN_PRO_VENT_PRO_COMP'#10#10'FROM'#10#10#10'(SE' +
'LECT ID_EMPRESA, ID_CLIENTE, ID_ARTICULO, COALESCE(SUM(IMPORTE_U' +
'NIDAD_ULT_VENT),0) AS IMPORTE_UNIDAD_ULT_VENT,'#10' COALESCE(S' +
'UM(IMPORTE_NETO_ULT_VENT),0) AS IMPORTE_NETO_ULT_VENT, COALESCE(' +
'SUM(IMPORTE_PORTE_ULT_VENT),0) AS IMPORTE_PORTE_ULT_VENT,'#10' ' +
' COALESCE(SUM(IMPORTE_UNIDAD_PRO_VENT),0) AS IMPORTE_UNIDAD_PRO_' +
'VENT, COALESCE(SUM(IMPORTE_NETO_PRO_VENT),0) AS IMPORTE_NETO_PRO' +
'_VENT,'#10' COALESCE(SUM(IMPORTE_PORTE_PRO_VENT),0) AS IMPORTE' +
'_PORTE_PRO_VENT'#10#10' FROM'#10' (SELECT'#10' ID_EMPRESA, ID_CLIENTE, ' +
'ID_ARTICULO,'#10' IMPORTE_UNIDAD_VENTA AS IMPORTE_UNIDAD_ULT_VE' +
'NT, IMPORTE_NETO_VENTA AS IMPORTE_NETO_ULT_VENT, IMPORTE_PORTE_V' +
'ENTA AS IMPORTE_PORTE_ULT_VENT,'#10' NULL AS IMPORTE_UNIDAD_PRO' +
'_VENT, NULL AS IMPORTE_NETO_PRO_VENT, NULL AS IMPORTE_PORTE_PRO_' +
'VENT'#10#10' FROM V_INF_ULTIMA_VENTA'#10#10' UNION ALL'#10#10' SELECT'#10' ' +
' FACTURAS_CLIENTE.ID_EMPRESA,'#10' FACTURAS_CLIENTE.ID_CLIENT' +
'E,'#10' FACTURAS_CLIENTE_DETALLES.ID_ARTICULO,'#10' NULL, NULL' +
', NULL,'#10' AVG(FACTURAS_CLIENTE_DETALLES.IMPORTE_UNIDAD) AS I' +
'MPORTE_UNIDAD_PRO_VENT,'#10' AVG(FACTURAS_CLIENTE_DETALLES.IMPO' +
'RTE_UNIDAD - (FACTURAS_CLIENTE_DETALLES.IMPORTE_UNIDAD * (FACTUR' +
'AS_CLIENTE_DETALLES.DESCUENTO / 100))) AS IMPORTE_NETO_PRO_VENT,' +
#10' AVG(FACTURAS_CLIENTE_DETALLES.IMPORTE_PORTE) AS IMPORTE_P' +
'ORTE_PRO_VENT'#10#10' FROM FACTURAS_CLIENTE_DETALLES'#10' LEFT OUTER' +
' JOIN FACTURAS_CLIENTE'#10' ON (FACTURAS_CLIENTE.ID = FACTURAS_CL' +
'IENTE_DETALLES.ID_FACTURA)'#10#10' WHERE (FACTURAS_CLIENTE_DETALLES' +
'.ID_ARTICULO IS NOT NULL) AND (FACTURAS_CLIENTE_DETALLES.ID_ARTI' +
'CULO > 0)'#10' AND (FACTURAS_CLIENTE_DETALLES.CANTIDAD > 0)'#10' ' +
' AND (FACTURAS_CLIENTE.FECHA_FACTURA BETWEEN :FECHAINI AND :FE' +
'CHAFIN)'#10' GROUP BY 1, 2, 3)'#10#10' GROUP BY 1, 2, 3) MARGEN_VENTAS'#10 +
#10#10'LEFT JOIN'#10#10#10'(SELECT'#10' ID_EMPRESA, ID_ARTICULO, COALESCE(SUM(' +
'IMPORTE_UNIDAD_ULT_COMP),0) AS IMPORTE_UNIDAD_ULT_COMP, COALESCE' +
'(SUM(IMPORTE_NETO_ULT_COMP),0) AS IMPORTE_NETO_ULT_COMP,'#10' COA' +
'LESCE(SUM(IMPORTE_PORTE_ULT_COMP),0) AS IMPORTE_PORTE_ULT_COMP, ' +
'COALESCE(SUM(IMPORTE_UNIDAD_PRO_COMP),0) AS IMPORTE_UNIDAD_PRO_C' +
'OMP,'#10' COALESCE(SUM(IMPORTE_NETO_PRO_COMP),0) AS IMPORTE_NETO_' +
'PRO_COMP, COALESCE(SUM(IMPORTE_PORTE_PRO_COMP),0) AS IMPORTE_POR' +
'TE_PRO_COMP'#10#10' FROM'#10' (SELECT'#10' ID_EMPRESA, ID_ARTICULO,'#10' ' +
' IMPORTE_UNIDAD_COMPRA AS IMPORTE_UNIDAD_ULT_COMP, IMPORTE_NET' +
'O_COMPRA AS IMPORTE_NETO_ULT_COMP, IMPORTE_PORTE_COMPRA AS IMPOR' +
'TE_PORTE_ULT_COMP,'#10' NULL AS IMPORTE_UNIDAD_PRO_COMP, NULL A' +
'S IMPORTE_NETO_PRO_COMP, NULL AS IMPORTE_PORTE_PRO_COMP'#10#10' FRO' +
'M V_INF_ULTIMA_COMPRA'#10#10' UNION ALL'#10#10' SELECT'#10' FACTURAS_' +
'PROVEEDOR.ID_EMPRESA,'#10' FACTURAS_PROVEEDOR_DETALLES.ID_ARTIC' +
'ULO,'#10' NULL, NULL, NULL,'#10' AVG(FACTURAS_PROVEEDOR_DETALL' +
'ES.IMPORTE_UNIDAD) AS IMPORTE_UNIDAD_PRO_COMP,'#10' AVG(FACTURA' +
'S_PROVEEDOR_DETALLES.IMPORTE_UNIDAD - (FACTURAS_PROVEEDOR_DETALL' +
'ES.IMPORTE_UNIDAD * (FACTURAS_PROVEEDOR_DETALLES.DESCUENTO / 100' +
'))) AS IMPORTE_NETO_PRO_COMP,'#10' AVG(FACTURAS_PROVEEDOR_DETAL' +
'LES.IMPORTE_PORTE) AS IMPORTE_PORTE_PRO_COMP'#10#10' FROM FACTURAS_' +
'PROVEEDOR_DETALLES'#10' LEFT OUTER JOIN FACTURAS_PROVEEDOR'#10' ON' +
' (FACTURAS_PROVEEDOR.ID = FACTURAS_PROVEEDOR_DETALLES.ID_FACTURA' +
')'#10#10' WHERE (FACTURAS_PROVEEDOR_DETALLES.ID_ARTICULO IS NOT NUL' +
'L) AND (FACTURAS_PROVEEDOR_DETALLES.ID_ARTICULO > 0)'#10' AND (' +
'FACTURAS_PROVEEDOR_DETALLES.CANTIDAD > 0)'#10' AND (FACTURAS_PR' +
'OVEEDOR.FECHA_FACTURA BETWEEN :FECHAINI AND :FECHAFIN)'#10' GROUP' +
' BY 1, 2)'#10#10' GROUP BY 1, 2) MARGEN_COMPRAS'#10#10#10'ON (MARGEN_COMPRAS.' +
'ID_EMPRESA = MARGEN_VENTAS.ID_EMPRESA)'#10'AND (MARGEN_COMPRAS.ID_AR' +
'TICULO = MARGEN_VENTAS.ID_ARTICULO)'#10#10#10'LEFT JOIN ARTICULOS ON (AR' +
'TICULOS.ID = MARGEN_VENTAS.ID_ARTICULO)'#10'LEFT JOIN CONTACTOS CLIE' +
'NTES ON (CLIENTES.ID = MARGEN_VENTAS.ID_CLIENTE)'#10'LEFT JOIN CLIEN' +
'TES_DATOS ON (CLIENTES_DATOS.ID_CLIENTE = CLIENTES.ID)'#10'LEFT JOIN' +
' CONTACTOS AGENTES ON (AGENTES.ID = CLIENTES_DATOS.ID_AGENTE)) I' +
'NF_MARGEN_ARTICULOS'
StatementType = stSQL StatementType = stSQL
ColumnMappings = < ColumnMappings = <
item item

View File

@ -37,8 +37,9 @@ uses
{Generated:} FactuGES_Invk, uSchemaUtilsServer, dialogs; {Generated:} FactuGES_Invk, uSchemaUtilsServer, dialogs;
const const
CAMPOS_AVG1 = '#IMP_NETO_ULT_VENT#IMP_NETO_PRO_VENT#IMP_NETO_COMPRA#IMP_NETO_ULT_COMP#IMP_NETO_PRO_COMP#IMP_MARGEN_ULT_VENT_COMPRA#POR_MARGEN_ULT_VENT_COMPRA#IMP_MARGEN_ULT_VENT_ULT_COMP#POR_MARGEN_ULT_VENT_ULT_COMP#'; CAMPOS_AVG1 = '#IMP_NETO_ULT_VENT#IMP_NETO_PRO_VENT#IMP_PORTE_PRO_VENT#IMP_NETO_COMPRA#IMP_NETO_ULT_COMP#IMP_NETO_PRO_COMP#IMP_UNIDAD_PRO_COMP#IMP_PORTE_PRO_COMP#IMP_MARGEN_ULT_VENT_COMPRA#POR_MARGEN_ULT_VENT_COMPRA#IMP_MARGEN_ULT_VENT_ULT_COMP#';
CAMPOS_AVG2 = '#IMP_MARGEN_ULT_VENT_PRO_COMP#POR_MARGEN_ULT_VENT_PRO_COMP#IMP_MARGEN_PRO_VENT_COMPRA#POR_MARGEN_PRO_VENT_COMPRA#IMP_MARGEN_PRO_VENT_ULT_COMP#POR_MARGEN_PRO_VENT_ULT_COMP#IMP_MARGEN_PRO_VENT_PRO_COMP#POR_MARGEN_PRO_VENT_PRO_COMP#'; CAMPOS_AVG2 = '#POR_MARGEN_ULT_VENT_ULT_COMP#IMP_MARGEN_ULT_VENT_PRO_COMP#POR_MARGEN_ULT_VENT_PRO_COMP#IMP_MARGEN_PRO_VENT_COMPRA#POR_MARGEN_PRO_VENT_COMPRA#IMP_MARGEN_PRO_VENT_ULT_COMP#POR_MARGEN_PRO_VENT_ULT_COMP#IMP_MARGEN_PRO_VENT_PRO_COMP#';
CAMPOS_AVG3 = '#POR_MARGEN_PRO_VENT_PRO_COMP#IMP_UNIDAD_PRO_VENT#';
CAMPOS_SUMA = ''; CAMPOS_SUMA = '';
@ -67,7 +68,7 @@ begin
Service := Self; Service := Self;
Columnas := Columns; Columnas := Columns;
ColumnasQueSuman := CAMPOS_SUMA; ColumnasQueSuman := CAMPOS_SUMA;
ColumnasQueAVG := CAMPOS_AVG1 + CAMPOS_AVG2; ColumnasQueAVG := CAMPOS_AVG1 + CAMPOS_AVG2 + CAMPOS_AVG3;
try try
ds := GetNewDataSet; ds := GetNewDataSet;
finally finally

View File

@ -191,30 +191,28 @@ inherited fEditorInfMargenArticulo: TfEditorInfMargenArticulo
ParentFont = False ParentFont = False
TabOrder = 4 TabOrder = 4
ReadOnly = False ReadOnly = False
ExplicitWidth = 671 ExplicitTop = 102
ExplicitHeight = 424 ExplicitWidth = 679
ExplicitHeight = 452
inherited TBXMultiDock1: TTBXMultiDock inherited TBXMultiDock1: TTBXMultiDock
Height = 347 Height = 347
ExplicitHeight = 319 ExplicitHeight = 347
inherited pnlParametros: TTBXDockablePanel inherited pnlParametros: TTBXDockablePanel
ExplicitHeight = 158 ExplicitHeight = 158
inherited pcParametros: TPageControl inherited pcParametros: TPageControl
Height = 69 Height = 69
ExplicitHeight = 55 ExplicitHeight = 69
inherited TabSheet5: TTabSheet inherited TabSheet5: TTabSheet
ExplicitLeft = 0
ExplicitTop = 0
ExplicitWidth = 0
ExplicitHeight = 29 ExplicitHeight = 29
end end
inherited tsColumnas: TTabSheet inherited tsColumnas: TTabSheet
ExplicitHeight = 45 ExplicitHeight = 59
inherited frViewColumnas1: TfrViewColumnas inherited frViewColumnas1: TfrViewColumnas
Height = 59 Height = 59
ExplicitHeight = 45 ExplicitHeight = 59
inherited lbColumnas: TcxCheckListBox inherited lbColumnas: TcxCheckListBox
Height = 30 Height = 30
ExplicitHeight = 16 ExplicitHeight = 30
end end
end end
end end
@ -234,10 +232,10 @@ inherited fEditorInfMargenArticulo: TfEditorInfMargenArticulo
ExplicitHeight = 173 ExplicitHeight = 173
inherited TBXPageScroller1: TTBXPageScroller inherited TBXPageScroller1: TTBXPageScroller
Height = 151 Height = 151
ExplicitHeight = 137 ExplicitHeight = 151
inherited pcTareas: TPageControl inherited pcTareas: TPageControl
Height = 103 Height = 103
ExplicitHeight = 89 ExplicitHeight = 103
inherited tsSumarios: TTabSheet inherited tsSumarios: TTabSheet
ExplicitHeight = 48 ExplicitHeight = 48
inherited frViewSumarios1: TfrViewSumarios inherited frViewSumarios1: TfrViewSumarios
@ -250,17 +248,17 @@ inherited fEditorInfMargenArticulo: TfEditorInfMargenArticulo
end end
end end
inherited tsFiltros: TTabSheet inherited tsFiltros: TTabSheet
ExplicitHeight = 79 ExplicitHeight = 93
inherited frViewFiltros1: TfrViewFiltros inherited frViewFiltros1: TfrViewFiltros
Height = 93 Height = 93
ExplicitHeight = 79 ExplicitHeight = 93
inherited cxFilterControl1: TcxFilterControl inherited cxFilterControl1: TcxFilterControl
Height = 34 Height = 34
ExplicitHeight = 20 ExplicitHeight = 34
end end
inherited TBXAlignmentPanel3: TTBXAlignmentPanel inherited TBXAlignmentPanel3: TTBXAlignmentPanel
Top = 63 Top = 63
ExplicitTop = 49 ExplicitTop = 63
end end
end end
end end
@ -270,26 +268,117 @@ inherited fEditorInfMargenArticulo: TfEditorInfMargenArticulo
end end
inherited TBXMultiDock2: TTBXMultiDock inherited TBXMultiDock2: TTBXMultiDock
Width = 679 Width = 679
ExplicitWidth = 671 ExplicitWidth = 679
inherited pnlIntervaloFechas: TTBXDockablePanel inherited pnlIntervaloFechas: TTBXDockablePanel
ExplicitWidth = 663 ExplicitWidth = 663
inherited TBXAlignmentPanel3: TTBXAlignmentPanel inherited TBXAlignmentPanel3: TTBXAlignmentPanel
Width = 659 Width = 659
ExplicitWidth = 651 ExplicitWidth = 659
end
inherited frViewPeriodoFechas1: TfrViewPeriodoFechas
Width = 659
ExplicitWidth = 659
inherited TBXDockablePanel1: TTBXDockablePanel
ExplicitWidth = 659
inherited dxLayoutControl1: TdxLayoutControl
Width = 659
ExplicitWidth = 659
end
end
end end
end end
end end
inherited frViewInfMargenArticuloGrid1: TfrViewInfMargenArticuloGrid inherited frViewInfMargenArticuloGrid1: TfrViewInfMargenArticuloGrid
Width = 457 Width = 457
Height = 347 Height = 347
ExplicitWidth = 449 ExplicitWidth = 457
ExplicitHeight = 319 ExplicitHeight = 347
inherited cxGrid: TcxGrid inherited cxGrid: TcxGrid
Width = 457 Width = 457
Height = 347 Height = 347
ExplicitWidth = 449 ExplicitWidth = 457
ExplicitHeight = 319 ExplicitHeight = 347
inherited cxGridView: TcxGridDBTableView inherited cxGridView: TcxGridDBTableView
DataController.Summary.DefaultGroupSummaryItems = <
item
Format = ',0.00 %;-,0.00 %'
Position = spFooter
Column = frViewInfMargenArticulo1.frViewInfMargenArticuloGrid1.cxGridViewPOR_MARGEN_PRO_VENT_PRO_COMP
end
item
Format = ',0.00 %;-,0.00 %'
Column = frViewInfMargenArticulo1.frViewInfMargenArticuloGrid1.cxGridViewPOR_MARGEN_PRO_VENT_PRO_COMP
end
item
Format = ',0.00 %;-,0.00 %'
Position = spFooter
Column = frViewInfMargenArticulo1.frViewInfMargenArticuloGrid1.cxGridViewPOR_MARGEN_ULT_VENT_COMPRA
end
item
Format = ',0.00 %;-,0.00 %'
Position = spFooter
Column = frViewInfMargenArticulo1.frViewInfMargenArticuloGrid1.cxGridViewPOR_MARGEN_ULT_VENT_ULT_COMP
end
item
Format = ',0.00 %;-,0.00 %'
Position = spFooter
Column = frViewInfMargenArticulo1.frViewInfMargenArticuloGrid1.cxGridViewPOR_MARGEN_ULT_VENT_PRO_COMP
end
item
Format = ',0.00 %;-,0.00 %'
Position = spFooter
Column = frViewInfMargenArticulo1.frViewInfMargenArticuloGrid1.cxGridViewPOR_MARGEN_PRO_VENT_COMPRA
end
item
Format = ',0.00 %;-,0.00 %'
Position = spFooter
Column = frViewInfMargenArticulo1.frViewInfMargenArticuloGrid1.cxGridViewPOR_MARGEN_PRO_VENT_ULT_COMP
end
item
Format = ',0.00 %;-,0.00 %'
Column = frViewInfMargenArticulo1.frViewInfMargenArticuloGrid1.cxGridViewPOR_MARGEN_ULT_VENT_COMPRA
end
item
Format = ',0.00 %;-,0.00 %'
Column = frViewInfMargenArticulo1.frViewInfMargenArticuloGrid1.cxGridViewPOR_MARGEN_ULT_VENT_ULT_COMP
end
item
Format = ',0.00 %;-,0.00 %'
Column = frViewInfMargenArticulo1.frViewInfMargenArticuloGrid1.cxGridViewPOR_MARGEN_ULT_VENT_PRO_COMP
end
item
Format = ',0.00 %;-,0.00 %'
Column = frViewInfMargenArticulo1.frViewInfMargenArticuloGrid1.cxGridViewPOR_MARGEN_PRO_VENT_COMPRA
end
item
Format = ',0.00 %;-,0.00 %'
Column = frViewInfMargenArticulo1.frViewInfMargenArticuloGrid1.cxGridViewPOR_MARGEN_PRO_VENT_ULT_COMP
end>
DataController.Summary.FooterSummaryItems = <
item
Format = ',0.00 %;-,0.00 %'
Column = frViewInfMargenArticulo1.frViewInfMargenArticuloGrid1.cxGridViewPOR_MARGEN_PRO_VENT_PRO_COMP
end
item
Format = ',0.00 %;-,0.00 %'
Column = frViewInfMargenArticulo1.frViewInfMargenArticuloGrid1.cxGridViewPOR_MARGEN_ULT_VENT_COMPRA
end
item
Format = ',0.00 %;-,0.00 %'
Column = frViewInfMargenArticulo1.frViewInfMargenArticuloGrid1.cxGridViewPOR_MARGEN_ULT_VENT_ULT_COMP
end
item
Format = ',0.00 %;-,0.00 %'
Column = frViewInfMargenArticulo1.frViewInfMargenArticuloGrid1.cxGridViewPOR_MARGEN_ULT_VENT_PRO_COMP
end
item
Format = ',0.00 %;-,0.00 %'
Column = frViewInfMargenArticulo1.frViewInfMargenArticuloGrid1.cxGridViewPOR_MARGEN_PRO_VENT_COMPRA
end
item
Format = ',0.00 %;-,0.00 %'
Column = frViewInfMargenArticulo1.frViewInfMargenArticuloGrid1.cxGridViewPOR_MARGEN_PRO_VENT_ULT_COMP
end>
inherited cxGridViewREFERENCIA: TcxGridDBColumn [9] inherited cxGridViewREFERENCIA: TcxGridDBColumn [9]
end end
inherited cxGridViewFAMILIA: TcxGridDBColumn [10] inherited cxGridViewFAMILIA: TcxGridDBColumn [10]

View File

@ -125,9 +125,11 @@ begin
end; end;
procedure TfEditorInfMargenArticulo.actRefrescarExecute(Sender: TObject); procedure TfEditorInfMargenArticulo.actRefrescarExecute(Sender: TObject);
begin begin
inherited; inherited;
frViewInfMargenArticulo1.Refresh; frViewInfMargenArticulo1.Refresh;
while (frViewInfMargenArticulo1.frViewInfMargenArticuloGrid1.FocusedView.Controller.FocusedRecord is TcxGridGroupRow) do while (frViewInfMargenArticulo1.frViewInfMargenArticuloGrid1.FocusedView.Controller.FocusedRecord is TcxGridGroupRow) do
begin begin
frViewInfMargenArticulo1.frViewInfMargenArticuloGrid1.FocusedView.Controller.FocusedRecord.Expand(True); frViewInfMargenArticulo1.frViewInfMargenArticuloGrid1.FocusedView.Controller.FocusedRecord.Expand(True);
@ -273,7 +275,11 @@ begin
if FInforme.DataTable.State = dsInsert then // Si es nuevo obligamos a meter nombre if FInforme.DataTable.State = dsInsert then // Si es nuevo obligamos a meter nombre
actPropiedades.Execute; actPropiedades.Execute;
actRefrescar.Execute; if not frViewInfMargenArticulo1.frViewInfMargenArticuloGrid1.HayColumnasDePromedio then
begin
frViewInfMargenArticulo1.TBXMultiDock2.Visible := False;
actRefrescar.Execute;
end;
end; end;
procedure TfEditorInfMargenArticulo.actPrevisualizarExecute( procedure TfEditorInfMargenArticulo.actPrevisualizarExecute(

View File

@ -83,7 +83,6 @@ inherited frViewInfMargenArticulo: TfrViewInfMargenArticulo
inherited TBXMultiDock2: TTBXMultiDock inherited TBXMultiDock2: TTBXMultiDock
Width = 834 Width = 834
Height = 105 Height = 105
Visible = False
ExplicitWidth = 834 ExplicitWidth = 834
ExplicitHeight = 105 ExplicitHeight = 105
inherited pnlIntervaloFechas: TTBXDockablePanel inherited pnlIntervaloFechas: TTBXDockablePanel
@ -98,6 +97,48 @@ inherited frViewInfMargenArticulo: TfrViewInfMargenArticulo
ExplicitTop = 71 ExplicitTop = 71
ExplicitWidth = 814 ExplicitWidth = 814
end end
inline frViewPeriodoFechas1: TfrViewPeriodoFechas
Left = 0
Top = 0
Width = 814
Height = 71
Align = alClient
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
ParentFont = False
TabOrder = 1
ReadOnly = False
ExplicitWidth = 814
ExplicitHeight = 71
inherited TBXDockablePanel1: TTBXDockablePanel
ExplicitWidth = 814
ExplicitHeight = 71
inherited dxLayoutControl1: TdxLayoutControl
Width = 814
Height = 71
ExplicitWidth = 814
ExplicitHeight = 71
DesignSize = (
814
71)
inherited cbPeriodo: TcxComboBox
Left = 54
ExplicitLeft = 54
end
inherited edtFechaIni: TcxDateEdit
Left = 54
ExplicitLeft = 54
end
inherited edtFechaFin: TcxDateEdit
Left = 266
ExplicitLeft = 266
end
end
end
end
end end
end end
inline frViewInfMargenArticuloGrid1: TfrViewInfMargenArticuloGrid [2] inline frViewInfMargenArticuloGrid1: TfrViewInfMargenArticuloGrid [2]
@ -123,6 +164,88 @@ inherited frViewInfMargenArticulo: TfrViewInfMargenArticulo
Height = 343 Height = 343
ExplicitWidth = 612 ExplicitWidth = 612
ExplicitHeight = 343 ExplicitHeight = 343
inherited cxGridView: TcxGridDBTableView
DataController.Summary.DefaultGroupSummaryItems = <
item
Format = ',0.00 %;-,0.00 %'
Position = spFooter
Column = frViewInfMargenArticuloGrid1.cxGridViewPOR_MARGEN_PRO_VENT_PRO_COMP
end
item
Format = ',0.00 %;-,0.00 %'
Column = frViewInfMargenArticuloGrid1.cxGridViewPOR_MARGEN_PRO_VENT_PRO_COMP
end
item
Format = ',0.00 %;-,0.00 %'
Position = spFooter
Column = frViewInfMargenArticuloGrid1.cxGridViewPOR_MARGEN_ULT_VENT_COMPRA
end
item
Format = ',0.00 %;-,0.00 %'
Position = spFooter
Column = frViewInfMargenArticuloGrid1.cxGridViewPOR_MARGEN_ULT_VENT_ULT_COMP
end
item
Format = ',0.00 %;-,0.00 %'
Position = spFooter
Column = frViewInfMargenArticuloGrid1.cxGridViewPOR_MARGEN_ULT_VENT_PRO_COMP
end
item
Format = ',0.00 %;-,0.00 %'
Position = spFooter
Column = frViewInfMargenArticuloGrid1.cxGridViewPOR_MARGEN_PRO_VENT_COMPRA
end
item
Format = ',0.00 %;-,0.00 %'
Position = spFooter
Column = frViewInfMargenArticuloGrid1.cxGridViewPOR_MARGEN_PRO_VENT_ULT_COMP
end
item
Format = ',0.00 %;-,0.00 %'
Column = frViewInfMargenArticuloGrid1.cxGridViewPOR_MARGEN_ULT_VENT_COMPRA
end
item
Format = ',0.00 %;-,0.00 %'
Column = frViewInfMargenArticuloGrid1.cxGridViewPOR_MARGEN_ULT_VENT_ULT_COMP
end
item
Format = ',0.00 %;-,0.00 %'
Column = frViewInfMargenArticuloGrid1.cxGridViewPOR_MARGEN_ULT_VENT_PRO_COMP
end
item
Format = ',0.00 %;-,0.00 %'
Column = frViewInfMargenArticuloGrid1.cxGridViewPOR_MARGEN_PRO_VENT_COMPRA
end
item
Format = ',0.00 %;-,0.00 %'
Column = frViewInfMargenArticuloGrid1.cxGridViewPOR_MARGEN_PRO_VENT_ULT_COMP
end>
DataController.Summary.FooterSummaryItems = <
item
Format = ',0.00 %;-,0.00 %'
Column = frViewInfMargenArticuloGrid1.cxGridViewPOR_MARGEN_PRO_VENT_PRO_COMP
end
item
Format = ',0.00 %;-,0.00 %'
Column = frViewInfMargenArticuloGrid1.cxGridViewPOR_MARGEN_ULT_VENT_COMPRA
end
item
Format = ',0.00 %;-,0.00 %'
Column = frViewInfMargenArticuloGrid1.cxGridViewPOR_MARGEN_ULT_VENT_ULT_COMP
end
item
Format = ',0.00 %;-,0.00 %'
Column = frViewInfMargenArticuloGrid1.cxGridViewPOR_MARGEN_ULT_VENT_PRO_COMP
end
item
Format = ',0.00 %;-,0.00 %'
Column = frViewInfMargenArticuloGrid1.cxGridViewPOR_MARGEN_PRO_VENT_COMPRA
end
item
Format = ',0.00 %;-,0.00 %'
Column = frViewInfMargenArticuloGrid1.cxGridViewPOR_MARGEN_PRO_VENT_ULT_COMP
end>
end
end end
inherited dxPrintStyleManager1: TdxPrintStyleManager inherited dxPrintStyleManager1: TdxPrintStyleManager
inherited dxPrintStyleManager1Style1: TdxPSPrintStyle inherited dxPrintStyleManager1Style1: TdxPSPrintStyle

View File

@ -26,6 +26,7 @@ type
TfrViewInfMargenArticulo = class(TfrViewInformeBase, IViewInfMargenArticulo) TfrViewInfMargenArticulo = class(TfrViewInformeBase, IViewInfMargenArticulo)
actPeriodoFechas: TAction; actPeriodoFechas: TAction;
frViewInfMargenArticuloGrid1: TfrViewInfMargenArticuloGrid; frViewInfMargenArticuloGrid1: TfrViewInfMargenArticuloGrid;
frViewPeriodoFechas1: TfrViewPeriodoFechas;
procedure actRefrescarExecute(Sender: TObject); procedure actRefrescarExecute(Sender: TObject);
procedure actPeriodoFechasExecute(Sender: TObject); procedure actPeriodoFechasExecute(Sender: TObject);
protected protected
@ -109,8 +110,8 @@ begin
LoadSchema; LoadSchema;
// ParamByName('FECHAINI').AsDateTime := frViewPeriodoFechas1.FechaInicial; ParamByName('FECHAINI').AsDateTime := frViewPeriodoFechas1.FechaInicial;
// ParamByName('FECHAFIN').AsDateTime := frViewPeriodoFechas1.FechaFinal; ParamByName('FECHAFIN').AsDateTime := frViewPeriodoFechas1.FechaFinal;
Active := True; Active := True;

View File

@ -107,6 +107,7 @@ inherited frViewInfMargenArticuloGrid: TfrViewInfMargenArticuloGrid
OptionsBehavior.CellHints = True OptionsBehavior.CellHints = True
OptionsCustomize.ColumnFiltering = False OptionsCustomize.ColumnFiltering = False
OptionsCustomize.ColumnGrouping = False OptionsCustomize.ColumnGrouping = False
OptionsCustomize.ColumnsQuickCustomization = True
OptionsCustomize.DataRowSizing = True OptionsCustomize.DataRowSizing = True
OptionsCustomize.GroupRowSizing = True OptionsCustomize.GroupRowSizing = True
OptionsData.Deleting = False OptionsData.Deleting = False
@ -124,7 +125,6 @@ inherited frViewInfMargenArticuloGrid: TfrViewInfMargenArticuloGrid
OptionsView.GroupByBox = False OptionsView.GroupByBox = False
OptionsView.GroupFooters = gfAlwaysVisible OptionsView.GroupFooters = gfAlwaysVisible
OptionsView.HeaderEndEllipsis = True OptionsView.HeaderEndEllipsis = True
OptionsView.NewItemRowInfoText = 'Click here to add a new row'
Styles.FilterBox = cxStyleFilterBox Styles.FilterBox = cxStyleFilterBox
Styles.OnGetContentStyle = cxGridViewStylesGetContentStyle Styles.OnGetContentStyle = cxGridViewStylesGetContentStyle
OnColumnPosChanged = cxGridViewColumnPosChanged OnColumnPosChanged = cxGridViewColumnPosChanged
@ -136,14 +136,17 @@ inherited frViewInfMargenArticuloGrid: TfrViewInfMargenArticuloGrid
object cxGridViewID_EMPRESA: TcxGridDBColumn object cxGridViewID_EMPRESA: TcxGridDBColumn
Caption = 'Id_empresa' Caption = 'Id_empresa'
DataBinding.FieldName = 'ID_EMPRESA' DataBinding.FieldName = 'ID_EMPRESA'
Hidden = True
end end
object cxGridViewID_CLIENTE: TcxGridDBColumn object cxGridViewID_CLIENTE: TcxGridDBColumn
Caption = 'Id_cliente' Caption = 'Id_cliente'
DataBinding.FieldName = 'ID_CLIENTE' DataBinding.FieldName = 'ID_CLIENTE'
Hidden = True
end end
object cxGridViewID_ARTICULO: TcxGridDBColumn object cxGridViewID_ARTICULO: TcxGridDBColumn
Caption = 'Id_articulo' Caption = 'Id_articulo'
DataBinding.FieldName = 'ID_ARTICULO' DataBinding.FieldName = 'ID_ARTICULO'
Hidden = True
end end
object cxGridViewNIF_CIF_CLIENTE: TcxGridDBColumn object cxGridViewNIF_CIF_CLIENTE: TcxGridDBColumn
Caption = 'NIF/CIF cliente' Caption = 'NIF/CIF cliente'

View File

@ -86,6 +86,7 @@ type
public public
procedure Refresh; override; procedure Refresh; override;
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
function HayColumnasDePromedio: boolean;
end; end;
implementation implementation
@ -102,9 +103,27 @@ begin
Result := cxGridView; Result := cxGridView;
end; end;
function TfrViewInfMargenArticuloGrid.HayColumnasDePromedio: boolean;
var
i: Integer;
begin
Result := False;
//Para que el usuario pueda ocultar y desocultar columnas sin afectar al informe
for i := 0 to FocusedView.ColumnCount - 1 do
begin
if (FocusedView.Columns[i].Visible)
and (Pos('_PRO_', FocusedView.Columns[i].DataBinding.FieldName) <> 0) then
begin
Result := true;
break;
end;
end;
end;
procedure TfrViewInfMargenArticuloGrid.Refresh; procedure TfrViewInfMargenArticuloGrid.Refresh;
var var
FocusedRow, TopRow : Integer; FocusedRow, TopRow, i : Integer;
begin begin
inherited; inherited;
{ Refrescar las filas del grid a partir del dataset y colocar la fila { Refrescar las filas del grid a partir del dataset y colocar la fila
@ -118,6 +137,10 @@ begin
FocusedView.DataController.FocusedRowIndex := FocusedRow; FocusedView.DataController.FocusedRowIndex := FocusedRow;
FocusedView.Controller.TopRowIndex := TopRow; FocusedView.Controller.TopRowIndex := TopRow;
//Para que el usuario pueda ocultar y desocultar columnas sin afectar al informe
for i := 0 to FocusedView.ColumnCount - 1 do
FocusedView.Columns[i].Hidden := not FocusedView.Columns[i].Visible;
end; end;
end; end;

View File

@ -47,7 +47,6 @@ inherited frViewInfVentasArticuloGrid: TfrViewInfVentasArticuloGrid
OptionsView.GroupByBox = False OptionsView.GroupByBox = False
OptionsView.GroupFooters = gfAlwaysVisible OptionsView.GroupFooters = gfAlwaysVisible
OptionsView.HeaderEndEllipsis = True OptionsView.HeaderEndEllipsis = True
OptionsView.NewItemRowInfoText = 'Click here to add a new row'
Styles.FilterBox = cxStyleFilterBox Styles.FilterBox = cxStyleFilterBox
Styles.OnGetContentStyle = cxGridViewStylesGetContentStyle Styles.OnGetContentStyle = cxGridViewStylesGetContentStyle
OnColumnPosChanged = cxGridViewColumnPosChanged OnColumnPosChanged = cxGridViewColumnPosChanged

View File

@ -91,7 +91,7 @@ end;
procedure TfrViewInfVentasArticuloGrid.Refresh; procedure TfrViewInfVentasArticuloGrid.Refresh;
var var
FocusedRow, TopRow : Integer; FocusedRow, TopRow, i : Integer;
begin begin
inherited; inherited;
{ Refrescar las filas del grid a partir del dataset y colocar la fila { Refrescar las filas del grid a partir del dataset y colocar la fila
@ -105,6 +105,10 @@ begin
FocusedView.DataController.FocusedRowIndex := FocusedRow; FocusedView.DataController.FocusedRowIndex := FocusedRow;
FocusedView.Controller.TopRowIndex := TopRow; FocusedView.Controller.TopRowIndex := TopRow;
//Para que el usuario pueda ocultar y desocultar columnas sin afectar al informe
for i := 0 to FocusedView.ColumnCount - 1 do
FocusedView.Columns[i].Hidden := not FocusedView.Columns[i].Visible;
end; end;
end; end;

View File

@ -87,6 +87,7 @@ type
property Informe: IBizInforme read GetInforme write SetInforme; property Informe: IBizInforme read GetInforme write SetInforme;
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
destructor Destroy; override; destructor Destroy; override;
procedure Refresh; override;
end; end;
implementation implementation
@ -160,6 +161,14 @@ begin
Result := FOnViewChanged; Result := FOnViewChanged;
end; end;
procedure TfrViewInformeBase.Refresh;
var
i: Integer;
begin
inherited;
end;
procedure TfrViewInformeBase.SetOnViewChanged(const Value: TNotifyEvent); procedure TfrViewInformeBase.SetOnViewChanged(const Value: TNotifyEvent);
begin begin
FOnViewChanged := Value; FOnViewChanged := Value;

View File

@ -39,8 +39,10 @@ inherited frViewEntradaSalidaArticulos: TfrViewEntradaSalidaArticulos
end end
object cxGridViewCANTIDAD: TcxGridDBColumn object cxGridViewCANTIDAD: TcxGridDBColumn
DataBinding.FieldName = 'CANTIDAD' DataBinding.FieldName = 'CANTIDAD'
PropertiesClassName = 'TcxTextEditProperties' PropertiesClassName = 'TcxSpinEditProperties'
Properties.Alignment.Horz = taRightJustify Properties.Alignment.Horz = taRightJustify
FooterAlignmentHorz = taRightJustify
HeaderAlignmentHorz = taRightJustify
end end
object cxGridViewID_EMPRESA: TcxGridDBColumn object cxGridViewID_EMPRESA: TcxGridDBColumn
DataBinding.FieldName = 'ID_EMPRESA' DataBinding.FieldName = 'ID_EMPRESA'
@ -70,6 +72,9 @@ inherited frViewEntradaSalidaArticulos: TfrViewEntradaSalidaArticulos
end end
end end
end end
inherited pnlAgrupaciones: TTBXDockablePanel
ExplicitWidth = 554
end
inherited dxComponentPrinter: TdxComponentPrinter inherited dxComponentPrinter: TdxComponentPrinter
inherited dxComponentPrinterLink: TdxGridReportLink inherited dxComponentPrinterLink: TdxGridReportLink
ReportDocument.CreationDate = 39253.500748333330000000 ReportDocument.CreationDate = 39253.500748333330000000

View File

@ -1,4 +1,4 @@
unit uViewEntradaSalidaArticulos; unit uViewEntradaSalidaArticulos;
interface interface
@ -14,7 +14,7 @@ uses
cxGridCustomPopupMenu, cxGridPopupMenu, dxPSCore, dxPScxCommon, dxPScxGridLnk, cxGridCustomPopupMenu, cxGridPopupMenu, dxPSCore, dxPScxCommon, dxPScxGridLnk,
uAlmacenesController, uBizAlmacenes, TB2Item, TBX, TB2Dock, TB2Toolbar, uAlmacenesController, uBizAlmacenes, TB2Item, TBX, TB2Dock, TB2Toolbar,
uDataModuleInventario, cxRichEdit, cxTextEdit, dxPgsDlg, TBXDkPanels, uDataModuleInventario, cxRichEdit, cxTextEdit, dxPgsDlg, TBXDkPanels,
uViewFiltroBase; uViewFiltroBase, cxSpinEdit;
type type
IViewViewEntradaSalidaArticulos = interface(IViewGrid) IViewViewEntradaSalidaArticulos = interface(IViewGrid)

Binary file not shown.

Binary file not shown.

View File

@ -66,6 +66,12 @@ inherited frViewPedidoProveedor: TfrViewPedidoProveedor
ExplicitWidth = 71 ExplicitWidth = 71
Width = 71 Width = 71
end end
inherited Button1: TBitBtn
OnClick = frViewProveedorPedidoButton1Click
end
inherited Button2: TBitBtn
OnClick = frViewProveedorPedidoButton2Click
end
inherited Button3: TBitBtn inherited Button3: TBitBtn
Left = 135 Left = 135
ExplicitLeft = 135 ExplicitLeft = 135

View File

@ -68,11 +68,11 @@ type
actVerPedidoCli: TAction; actVerPedidoCli: TAction;
procedure CustomViewCreate(Sender: TObject); procedure CustomViewCreate(Sender: TObject);
procedure CustomViewDestroy(Sender: TObject); procedure CustomViewDestroy(Sender: TObject);
procedure frViewProveedorPedidoButton1Click(Sender: TObject);
procedure frViewProveedorPedidoButton2Click(Sender: TObject);
procedure bFormasPagoClick(Sender: TObject); procedure bFormasPagoClick(Sender: TObject);
procedure actVerPedidoCliExecute(Sender: TObject); procedure actVerPedidoCliExecute(Sender: TObject);
procedure actVerPedidoCliUpdate(Sender: TObject); procedure actVerPedidoCliUpdate(Sender: TObject);
procedure frViewProveedorPedidoButton1Click(Sender: TObject);
procedure frViewProveedorPedidoButton2Click(Sender: TObject);
protected protected
FPedido : IBizPedidoProveedor; FPedido : IBizPedidoProveedor;
FViewProveedorPedido : TfrViewDatosYSeleccionProveedor; FViewProveedorPedido : TfrViewDatosYSeleccionProveedor;
@ -157,7 +157,7 @@ begin
if (Application.MessageBox('Si cambia de proveedor, se eliminarán todos sus artículos del pedido actual, ¿Desea continuar?', 'Atención', MB_YESNO) = IDNO) then if (Application.MessageBox('Si cambia de proveedor, se eliminarán todos sus artículos del pedido actual, ¿Desea continuar?', 'Atención', MB_YESNO) = IDNO) then
Exit; Exit;
end; end;
frViewProveedorPedido.actElegirContacto.Execute; frViewProveedorPedido.actAnadirContacto.Execute;
end; end;
function TfrViewPedidoProveedor.GetPedido: IBizPedidoProveedor; function TfrViewPedidoProveedor.GetPedido: IBizPedidoProveedor;

View File

@ -1,22 +1,22 @@
inherited frViewPedidoCliente: TfrViewPedidoCliente inherited frViewPedidoCliente: TfrViewPedidoCliente
Width = 688 Width = 740
Height = 407 Height = 479
OnCreate = CustomViewCreate OnCreate = CustomViewCreate
OnDestroy = CustomViewDestroy OnDestroy = CustomViewDestroy
ExplicitWidth = 688 ExplicitWidth = 740
ExplicitHeight = 407 ExplicitHeight = 479
object dxLayoutControl1: TdxLayoutControl object dxLayoutControl1: TdxLayoutControl
Left = 0 Left = 0
Top = 0 Top = 0
Width = 688 Width = 740
Height = 407 Height = 479
Align = alClient Align = alClient
ParentBackground = True ParentBackground = True
TabOrder = 0 TabOrder = 0
AutoContentSizes = [acsWidth, acsHeight] AutoContentSizes = [acsWidth, acsHeight]
DesignSize = ( DesignSize = (
688 740
407) 479)
object edtFechaPedido: TcxDBDateEdit object edtFechaPedido: TcxDBDateEdit
Left = 116 Left = 116
Top = 82 Top = 82
@ -85,7 +85,7 @@ inherited frViewPedidoCliente: TfrViewPedidoCliente
Width = 143 Width = 143
end end
inline frViewClientePedido: TfrViewDatosYSeleccionCliente inline frViewClientePedido: TfrViewDatosYSeleccionCliente
Left = 353 Left = 388
Top = 28 Top = 28
Width = 350 Width = 350
Height = 212 Height = 212
@ -97,7 +97,7 @@ inherited frViewPedidoCliente: TfrViewPedidoCliente
ParentFont = False ParentFont = False
TabOrder = 13 TabOrder = 13
ReadOnly = False ReadOnly = False
ExplicitLeft = 353 ExplicitLeft = 388
ExplicitTop = 28 ExplicitTop = 28
inherited dxLayoutControl1: TdxLayoutControl inherited dxLayoutControl1: TdxLayoutControl
inherited edtlNombre: TcxDBTextEdit inherited edtlNombre: TcxDBTextEdit
@ -121,12 +121,18 @@ inherited frViewPedidoCliente: TfrViewPedidoCliente
Width = 327 Width = 327
end end
inherited edtCodigoPostal: TcxDBTextEdit inherited edtCodigoPostal: TcxDBTextEdit
Left = 204 Left = 238
ExplicitLeft = 204 ExplicitLeft = 238
end
inherited Button1: TBitBtn
OnClick = frViewClientePedidoButton1Click
end
inherited Button2: TBitBtn
OnClick = frViewClientePedidoButton2Click
end end
inherited Button3: TBitBtn inherited Button3: TBitBtn
Left = 94 Left = 128
ExplicitLeft = 94 ExplicitLeft = 128
end end
end end
inherited DADataSource: TDADataSource inherited DADataSource: TDADataSource
@ -178,7 +184,7 @@ inherited frViewPedidoCliente: TfrViewPedidoCliente
Width = 162 Width = 162
end end
object eCodigoPostal: TcxDBTextEdit object eCodigoPostal: TcxDBTextEdit
Left = 258 Left = 293
Top = 220 Top = 220
DataBinding.DataField = 'CODIGO_POSTAL' DataBinding.DataField = 'CODIGO_POSTAL'
DataBinding.DataSource = DADataSource DataBinding.DataSource = DADataSource
@ -255,7 +261,7 @@ inherited frViewPedidoCliente: TfrViewPedidoCliente
Width = 122 Width = 122
end end
object bElegirDireccion: TBitBtn object bElegirDireccion: TBitBtn
Left = 151 Left = 186
Top = 328 Top = 328
Width = 172 Width = 172
Height = 25 Height = 25
@ -293,7 +299,7 @@ inherited frViewPedidoCliente: TfrViewPedidoCliente
Width = 101 Width = 101
end end
object bFormasPago: TButton object bFormasPago: TButton
Left = 191 Left = 226
Top = 136 Top = 136
Width = 132 Width = 132
Height = 21 Height = 21

View File

@ -77,6 +77,7 @@ type
procedure actElegirDireccionUpdate(Sender: TObject); procedure actElegirDireccionUpdate(Sender: TObject);
procedure bFormasPagoClick(Sender: TObject); procedure bFormasPagoClick(Sender: TObject);
procedure frViewClientePedidoButton1Click(Sender: TObject); procedure frViewClientePedidoButton1Click(Sender: TObject);
procedure frViewClientePedidoButton2Click(Sender: TObject);
protected protected
FPedido : IBizPedidoCliente; FPedido : IBizPedidoCliente;
FViewClientePedido : TfrViewDatosYSeleccionCliente; FViewClientePedido : TfrViewDatosYSeleccionCliente;
@ -172,6 +173,17 @@ begin
frViewClientePedido.actElegirContacto.Execute; frViewClientePedido.actElegirContacto.Execute;
end; end;
procedure TfrViewPedidoCliente.frViewClientePedidoButton2Click(Sender: TObject);
begin
if Assigned(Pedido) and Assigned(Pedido.Cliente) and
Assigned (Pedido.Detalles) and (Pedido.Detalles.RecordCount > 0) then
begin
if (Application.MessageBox('Los descuentos de los artículos del pedido serán actualizados con los del nuevo cliente seleccionado, ¿Desea continuar?', 'Atención', MB_YESNO) = IDNO) then
Exit;
end;
frViewClientePedido.actAnadirContacto.Execute;
end;
function TfrViewPedidoCliente.GetPedido: IBizPedidoCliente; function TfrViewPedidoCliente.GetPedido: IBizPedidoCliente;
begin begin
Result := FPedido; Result := FPedido;

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<BorlandProject> <BorlandProject>
<PersonalityInfo> <PersonalityInfo>
<Option> <Option>
@ -176,12 +176,13 @@
<VersionInfoKeys Name="ProductVersion">2.2.1.0</VersionInfoKeys> <VersionInfoKeys Name="ProductVersion">2.2.1.0</VersionInfoKeys>
<VersionInfoKeys Name="Comments"></VersionInfoKeys> <VersionInfoKeys Name="Comments"></VersionInfoKeys>
<VersionInfoKeys Name="CompileDate">martes, 07 de agosto de 2007 18:15</VersionInfoKeys></VersionInfoKeys> <VersionInfoKeys Name="CompileDate">martes, 07 de agosto de 2007 18:15</VersionInfoKeys></VersionInfoKeys>
<Excluded_Packages>
<Excluded_Packages Name="C:\Archivos de programa\RemObjects Software\Pascal Script\Dcu\D10\PascalScript_RO_D10.bpl">RemObjects Pascal Script - RemObjects SDK 3.0 Integration</Excluded_Packages> <Excluded_Packages>
</Excluded_Packages> <Excluded_Packages Name="C:\Archivos de programa\RemObjects Software\Pascal Script\Dcu\D10\PascalScript_RO_D10.bpl">RemObjects Pascal Script - RemObjects SDK 3.0 Integration</Excluded_Packages>
</Delphi.Personality> </Excluded_Packages>
</Delphi.Personality>
<ModelSupport>False</ModelSupport> <ModelSupport>False</ModelSupport>
<!-- EurekaLog First Line <!-- EurekaLog First Line
[Exception Log] [Exception Log]
EurekaLog Version=519 EurekaLog Version=519
Activate=0 Activate=0

View File

@ -126,10 +126,10 @@ uses
schArticulosClient_Intf in '..\Modulos\Articulos\Model\schArticulosClient_Intf.pas', schArticulosClient_Intf in '..\Modulos\Articulos\Model\schArticulosClient_Intf.pas',
schArticulosServer_Intf in '..\Modulos\Articulos\Model\schArticulosServer_Intf.pas', schArticulosServer_Intf in '..\Modulos\Articulos\Model\schArticulosServer_Intf.pas',
srvInfMargenArticulo_Impl in '..\Modulos\Informe margen por articulo\Servidor\srvInfMargenArticulo_Impl.pas' {srvInfMargenArticulo: TDARemoteService}, srvInfMargenArticulo_Impl in '..\Modulos\Informe margen por articulo\Servidor\srvInfMargenArticulo_Impl.pas' {srvInfMargenArticulo: TDARemoteService},
schInfMargenArticuloClient_Intf in '..\Modulos\Informe margen por articulo\Model\schInfMargenArticuloClient_Intf.pas',
schInfMargenArticuloServer_Intf in '..\Modulos\Informe margen por articulo\Model\schInfMargenArticuloServer_Intf.pas',
schInfVentasArticuloClient_Intf in '..\Modulos\Informe ventas por articulo\Model\schInfVentasArticuloClient_Intf.pas', schInfVentasArticuloClient_Intf in '..\Modulos\Informe ventas por articulo\Model\schInfVentasArticuloClient_Intf.pas',
schInfVentasArticuloServer_Intf in '..\Modulos\Informe ventas por articulo\Model\schInfVentasArticuloServer_Intf.pas'; schInfVentasArticuloServer_Intf in '..\Modulos\Informe ventas por articulo\Model\schInfVentasArticuloServer_Intf.pas',
schInfMargenArticuloClient_Intf in '..\Modulos\Informe margen por articulo\Model\schInfMargenArticuloClient_Intf.pas',
schInfMargenArticuloServer_Intf in '..\Modulos\Informe margen por articulo\Model\schInfMargenArticuloServer_Intf.pas';
{$R *.res} {$R *.res}
{$R ..\Servicios\RODLFile.res} {$R ..\Servicios\RODLFile.res}

View File

@ -118,6 +118,7 @@ begin
Delete(3); Delete(3);
end; end;
Result := ASQL.Text; Result := ASQL.Text;
finally finally
AColumnList.Free; AColumnList.Free;
ASQL.Free; ASQL.Free;