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)
AS
select
V_INF_MARGEN_VENTAS.id_empresa,
V_INF_MARGEN_VENTAS.id_cliente,
V_INF_MARGEN_VENTAS.id_articulo,
MARGEN_VENTAS.id_empresa,
MARGEN_VENTAS.id_cliente,
MARGEN_VENTAS.id_articulo,
CLIENTES.NIF_CIF,
CLIENTES.NOMBRE,
@ -2545,52 +2545,52 @@ ARTICULOS.DESCRIPCION,
ARTICULOS.COMISIONABLE,
ARTICULOS.INVENTARIABLE,
COALESCE(V_INF_MARGEN_VENTAS.importe_unidad_ult_vent, 0),
COALESCE(V_INF_MARGEN_VENTAS.importe_neto_ult_vent, 0),
COALESCE(V_INF_MARGEN_VENTAS.importe_porte_ult_vent, 0),
COALESCE(MARGEN_VENTAS.importe_unidad_ult_vent, 0),
COALESCE(MARGEN_VENTAS.importe_neto_ult_vent, 0),
COALESCE(MARGEN_VENTAS.importe_porte_ult_vent, 0),
COALESCE(V_INF_MARGEN_VENTAS.importe_unidad_pro_vent, 0),
COALESCE(V_INF_MARGEN_VENTAS.importe_neto_pro_vent, 0),
COALESCE(V_INF_MARGEN_VENTAS.importe_porte_pro_vent, 0),
COALESCE(MARGEN_VENTAS.importe_unidad_pro_vent, 0),
COALESCE(MARGEN_VENTAS.importe_neto_pro_vent, 0),
COALESCE(MARGEN_VENTAS.importe_porte_pro_vent, 0),
COALESCE(ARTICULOS.PRECIO_COSTE, 0),
COALESCE(ARTICULOS.PRECIO_NETO, 0),
COALESCE(ARTICULOS.PRECIO_PORTE, 0),
COALESCE(V_INF_MARGEN_COMPRAS.importe_unidad_ult_comp, 0),
COALESCE(V_INF_MARGEN_COMPRAS.importe_neto_ult_comp, 0),
COALESCE(V_INF_MARGEN_COMPRAS.importe_porte_ult_comp, 0),
COALESCE(MARGEN_COMPRAS.importe_unidad_ult_comp, 0),
COALESCE(MARGEN_COMPRAS.importe_neto_ult_comp, 0),
COALESCE(MARGEN_COMPRAS.importe_porte_ult_comp, 0),
COALESCE(V_INF_MARGEN_COMPRAS.importe_unidad_pro_comp, 0),
COALESCE(V_INF_MARGEN_COMPRAS.importe_neto_pro_comp, 0),
COALESCE(V_INF_MARGEN_COMPRAS.importe_porte_pro_comp, 0),
COALESCE(MARGEN_COMPRAS.importe_unidad_pro_comp, 0),
COALESCE(MARGEN_COMPRAS.importe_neto_pro_comp, 0),
COALESCE(MARGEN_COMPRAS.importe_porte_pro_comp, 0),
/*MARGEN CON ULTIMA VENTA*/
V_INF_MARGEN_VENTAS.importe_neto_ult_vent - ARTICULOS.PRECIO_NETO as imp_margen_ult_vent_compra,
CASE
MARGEN_VENTAS.importe_neto_ult_vent - ARTICULOS.PRECIO_NETO as imp_margen_ult_vent_compra,
CASE
WHEN ARTICULOS.PRECIO_NETO = 0 THEN 100
WHEN (V_INF_MARGEN_VENTAS.importe_neto_ult_vent - ARTICULOS.PRECIO_NETO) > 0 THEN
(ARTICULOS.PRECIO_NETO * 100) / V_INF_MARGEN_VENTAS.importe_neto_ult_vent
WHEN (MARGEN_VENTAS.importe_neto_ult_vent - ARTICULOS.PRECIO_NETO) > 0 THEN
(ARTICULOS.PRECIO_NETO * 100) / MARGEN_VENTAS.importe_neto_ult_vent
ELSE 0
END
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
WHEN V_INF_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
(V_INF_MARGEN_COMPRAS.importe_neto_ult_comp * 100) / V_INF_MARGEN_VENTAS.importe_neto_ult_vent
WHEN MARGEN_COMPRAS.importe_neto_ult_comp = 0 THEN 100
WHEN (MARGEN_VENTAS.importe_neto_ult_vent - MARGEN_COMPRAS.importe_neto_ult_comp) > 0 THEN
(MARGEN_COMPRAS.importe_neto_ult_comp * 100) / MARGEN_VENTAS.importe_neto_ult_vent
ELSE 0
END
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,
CASE
WHEN V_INF_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
(V_INF_MARGEN_COMPRAS.importe_neto_pro_comp * 100) / V_INF_MARGEN_VENTAS.importe_neto_ult_vent
MARGEN_VENTAS.importe_neto_ult_vent - MARGEN_COMPRAS.importe_neto_pro_comp as imp_margen_ult_vent_pro_comp,
CASE
WHEN MARGEN_COMPRAS.importe_neto_pro_comp = 0 THEN 100
WHEN (MARGEN_VENTAS.importe_neto_ult_vent - MARGEN_COMPRAS.importe_neto_pro_comp) > 0 THEN
(MARGEN_COMPRAS.importe_neto_pro_comp * 100) / MARGEN_VENTAS.importe_neto_ult_vent
ELSE 0
END
as por_margen_ult_vent_pro_comp,
@ -2598,48 +2598,123 @@ as por_margen_ult_vent_pro_comp,
/*MARGEN CON VENTAS PROMEDIO*/
V_INF_MARGEN_VENTAS.importe_neto_pro_vent - ARTICULOS.PRECIO_NETO as imp_margen_pro_vent_compra,
CASE
MARGEN_VENTAS.importe_neto_pro_vent - ARTICULOS.PRECIO_NETO as imp_margen_pro_vent_compra,
CASE
WHEN ARTICULOS.PRECIO_NETO = 0 THEN 100
WHEN (V_INF_MARGEN_VENTAS.importe_neto_pro_vent - ARTICULOS.PRECIO_NETO) > 0 THEN
(ARTICULOS.PRECIO_NETO * 100) / V_INF_MARGEN_VENTAS.importe_neto_pro_vent
WHEN (MARGEN_VENTAS.importe_neto_pro_vent - ARTICULOS.PRECIO_NETO) > 0 THEN
(ARTICULOS.PRECIO_NETO * 100) / MARGEN_VENTAS.importe_neto_pro_vent
ELSE 0
END
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,
CASE
WHEN V_INF_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
(V_INF_MARGEN_COMPRAS.importe_neto_ult_comp * 100) / V_INF_MARGEN_VENTAS.importe_neto_pro_vent
MARGEN_VENTAS.importe_neto_pro_vent - MARGEN_COMPRAS.importe_neto_ult_comp as imp_margen_pro_vent_ult_comp,
CASE
WHEN MARGEN_COMPRAS.importe_neto_ult_comp = 0 THEN 100
WHEN (MARGEN_VENTAS.importe_neto_pro_vent - MARGEN_COMPRAS.importe_neto_ult_comp) > 0 THEN
(MARGEN_COMPRAS.importe_neto_ult_comp * 100) / MARGEN_VENTAS.importe_neto_pro_vent
ELSE 0
END
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,
CASE
WHEN V_INF_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
(V_INF_MARGEN_COMPRAS.importe_neto_pro_comp * 100) / V_INF_MARGEN_VENTAS.importe_neto_pro_vent
MARGEN_VENTAS.importe_neto_pro_vent - MARGEN_COMPRAS.importe_neto_pro_comp as imp_margen_pro_vent_pro_comp,
CASE
WHEN MARGEN_COMPRAS.importe_neto_pro_comp = 0 THEN 100
WHEN (MARGEN_VENTAS.importe_neto_pro_vent - MARGEN_COMPRAS.importe_neto_pro_comp) > 0 THEN
(MARGEN_COMPRAS.importe_neto_pro_comp * 100) / MARGEN_VENTAS.importe_neto_pro_vent
ELSE 0
END
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
on (v_inf_margen_compras.id_empresa = v_INF_MARGEN_ventas.id_empresa)
and (v_inf_margen_compras.id_articulo = v_INF_MARGEN_ventas.id_articulo)
from
(select
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
on (ARTICULOS.ID = v_INF_MARGEN_ventas.id_articulo)
from v_inf_ultima_venta
left join CONTACTOS CLIENTES on (CLIENTES.ID = V_INF_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)
union all
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 */

Binary file not shown.

Binary file not shown.

View File

@ -1,2 +1,2 @@
[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>
</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="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="FactuGES.exe">Cliente\FactuGES.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>
<Dependencies/>
</Default.Personality>

Binary file not shown.

Binary file not shown.

View File

@ -14,7 +14,7 @@ inherited fEditorClientes: TfEditorClientes
ExplicitWidth = 786
inherited Image1: TImage
Left = 759
Picture.Data = {
Picture.Data = {
0A54504E474F626A65637489504E470D0A1A0A0000000D494844520000001800
0000180806000000E0773DF80000000970485973000017120000171201679FD2
520000000467414D410000B18E7CFB51930000033B4944415478DADD957F6856
@ -87,16 +87,6 @@ inherited fEditorClientes: TfEditorClientes
ExplicitWidth = 786
ExplicitHeight = 270
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
inherited frViewFiltroBase1: TfrViewFiltroBase

View File

@ -5,7 +5,7 @@ inherited fEditorProveedores: TfEditorProveedores
inherited JvNavPanelHeader: TJvNavPanelHeader
Caption = 'Lista de proveedores'
inherited Image1: TImage
Picture.Data = {
Picture.Data = {
0A54504E474F626A65637489504E470D0A1A0A0000000D494844520000001800
0000180806000000E0773DF80000000970485973000017120000171201679FD2
520000000467414D410000AA11B57D14DC0000034D4944415478DADD957D6855
@ -68,13 +68,6 @@ inherited fEditorProveedores: TfEditorProveedores
ExplicitWidth = 543
ExplicitHeight = 195
inherited cxGridView: TcxGridDBTableView
DataController.Summary.FooterSummaryItems = <
item
Format = '0 proveedores'
Kind = skCount
FieldName = 'ID'
Column = frViewProveedores1.cxGridViewREFERENCIA
end>
end
end
inherited frViewFiltroBase1: TfrViewFiltroBase
@ -86,16 +79,16 @@ inherited fEditorProveedores: TfEditorProveedores
Width = 543
ExplicitWidth = 543
inherited txtFiltroTodo: TcxTextEdit
ExplicitWidth = 273
Width = 273
ExplicitWidth = 457
Width = 457
end
inherited edtFechaIniFiltro: TcxDateEdit
ExplicitWidth = 121
Width = 121
ExplicitWidth = 240
Width = 240
end
inherited edtFechaFinFiltro: TcxDateEdit
Left = 277
ExplicitLeft = 277
Left = 337
ExplicitLeft = 337
ExplicitWidth = 201
Width = 201
end

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -11,29 +11,175 @@ object srvInfMargenArticulo: TsrvInfMargenArticulo
DataDictionary = DataDictionary
Datasets = <
item
Params = <>
Params = <
item
Name = 'FECHAINI'
BlobType = dabtUnknown
Value = ''
ParamType = daptInput
end
item
Name = 'FECHAFIN'
BlobType = dabtUnknown
Value = ''
ParamType = daptInput
end>
Statements = <
item
Connection = 'IBX'
TargetTable = 'V_INF_MARGEN_ARTICULOS'
TargetTable = 'INF_MARGEN_ARTICULOS'
SQL =
'SELECT'#10' ID_EMPRESA,'#10' ID_CLIENTE,'#10' ID_ARTICULO,'#10' NIF_' +
'CIF_CLIENTE,'#10' NOMBRE_CLIENTE,'#10' NOMBRE_COMERCIAL_CLIENTE,'#10' ' +
' NIF_CIF_AGENTE,'#10' NOMBRE_AGENTE,'#10' FAMILIA,'#10' REFERENCI' +
'A,'#10' REFERENCIA_PROV,'#10' DESCRIPCION,'#10' COMISIONABLE,'#10' I' +
'NVENTARIABLE,'#10' IMP_UNIDAD_ULT_VENT,'#10' IMP_NETO_ULT_VENT,'#10' ' +
' IMP_PORTE_ULT_VENT,'#10' IMP_UNIDAD_PRO_VENT,'#10' IMP_NETO_PRO_' +
'VENT,'#10' IMP_PORTE_PRO_VENT,'#10' IMP_UNIDAD_COMPRA,'#10' IMP_NET' +
'O_COMPRA,'#10' IMP_PORTE_COMPRA,'#10' IMP_UNIDAD_ULT_COMP,'#10' IMP' +
'_NETO_ULT_COMP,'#10' IMP_PORTE_ULT_COMP,'#10' IMP_UNIDAD_PRO_COMP,' +
#10' IMP_NETO_PRO_COMP,'#10' IMP_PORTE_PRO_COMP,'#10' IMP_MARGEN_U' +
'LT_VENT_COMPRA,'#10' POR_MARGEN_ULT_VENT_COMPRA,'#10' IMP_MARGEN_U' +
'LT_VENT_ULT_COMP,'#10' POR_MARGEN_ULT_VENT_ULT_COMP,'#10' IMP_MARG' +
'EN_ULT_VENT_PRO_COMP,'#10' POR_MARGEN_ULT_VENT_PRO_COMP,'#10' IMP_' +
'MARGEN_PRO_VENT_COMPRA,'#10' POR_MARGEN_PRO_VENT_COMPRA,'#10' IMP_' +
'MARGEN_PRO_VENT_ULT_COMP,'#10' POR_MARGEN_PRO_VENT_ULT_COMP,'#10' ' +
'IMP_MARGEN_PRO_VENT_PRO_COMP,'#10' POR_MARGEN_PRO_VENT_PRO_COMP'#10' ' +
' '#10'FROM V_INF_MARGEN_ARTICULOS'
'SELECT'#10#10' INF_MARGEN_ARTICULOS.ID_EMPRESA,'#10' INF_MARGEN_ARTI' +
'CULOS.ID_CLIENTE,'#10' INF_MARGEN_ARTICULOS.ID_ARTICULO,'#10' INF_' +
'MARGEN_ARTICULOS.NIF_CIF_CLIENTE,'#10' INF_MARGEN_ARTICULOS.NOMBR' +
'E_CLIENTE,'#10' INF_MARGEN_ARTICULOS.NOMBRE_COMERCIAL_CLIENTE,'#10' ' +
' INF_MARGEN_ARTICULOS.NIF_CIF_AGENTE,'#10' INF_MARGEN_ARTICULOS.' +
'NOMBRE_AGENTE,'#10' INF_MARGEN_ARTICULOS.FAMILIA,'#10' INF_MARGEN_' +
'ARTICULOS.REFERENCIA,'#10' INF_MARGEN_ARTICULOS.REFERENCIA_PROV,'#10 +
' INF_MARGEN_ARTICULOS.DESCRIPCION,'#10' INF_MARGEN_ARTICULOS.C' +
'OMISIONABLE,'#10' INF_MARGEN_ARTICULOS.INVENTARIABLE,'#10' INF_MAR' +
'GEN_ARTICULOS.IMP_UNIDAD_ULT_VENT,'#10' INF_MARGEN_ARTICULOS.IMP_' +
'NETO_ULT_VENT,'#10' INF_MARGEN_ARTICULOS.IMP_PORTE_ULT_VENT,'#10' ' +
'INF_MARGEN_ARTICULOS.IMP_UNIDAD_PRO_VENT,'#10' INF_MARGEN_ARTICUL' +
'OS.IMP_NETO_PRO_VENT,'#10' INF_MARGEN_ARTICULOS.IMP_PORTE_PRO_VEN' +
'T,'#10' INF_MARGEN_ARTICULOS.IMP_UNIDAD_COMPRA,'#10' INF_MARGEN_AR' +
'TICULOS.IMP_NETO_COMPRA,'#10' INF_MARGEN_ARTICULOS.IMP_PORTE_COMP' +
'RA,'#10' INF_MARGEN_ARTICULOS.IMP_UNIDAD_ULT_COMP,'#10' INF_MARGEN' +
'_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
ColumnMappings = <
item

View File

@ -37,8 +37,9 @@ uses
{Generated:} FactuGES_Invk, uSchemaUtilsServer, dialogs;
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_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_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 = '#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 = '';
@ -67,7 +68,7 @@ begin
Service := Self;
Columnas := Columns;
ColumnasQueSuman := CAMPOS_SUMA;
ColumnasQueAVG := CAMPOS_AVG1 + CAMPOS_AVG2;
ColumnasQueAVG := CAMPOS_AVG1 + CAMPOS_AVG2 + CAMPOS_AVG3;
try
ds := GetNewDataSet;
finally

View File

@ -191,30 +191,28 @@ inherited fEditorInfMargenArticulo: TfEditorInfMargenArticulo
ParentFont = False
TabOrder = 4
ReadOnly = False
ExplicitWidth = 671
ExplicitHeight = 424
ExplicitTop = 102
ExplicitWidth = 679
ExplicitHeight = 452
inherited TBXMultiDock1: TTBXMultiDock
Height = 347
ExplicitHeight = 319
ExplicitHeight = 347
inherited pnlParametros: TTBXDockablePanel
ExplicitHeight = 158
inherited pcParametros: TPageControl
Height = 69
ExplicitHeight = 55
ExplicitHeight = 69
inherited TabSheet5: TTabSheet
ExplicitLeft = 0
ExplicitTop = 0
ExplicitWidth = 0
ExplicitHeight = 29
end
inherited tsColumnas: TTabSheet
ExplicitHeight = 45
ExplicitHeight = 59
inherited frViewColumnas1: TfrViewColumnas
Height = 59
ExplicitHeight = 45
ExplicitHeight = 59
inherited lbColumnas: TcxCheckListBox
Height = 30
ExplicitHeight = 16
ExplicitHeight = 30
end
end
end
@ -234,10 +232,10 @@ inherited fEditorInfMargenArticulo: TfEditorInfMargenArticulo
ExplicitHeight = 173
inherited TBXPageScroller1: TTBXPageScroller
Height = 151
ExplicitHeight = 137
ExplicitHeight = 151
inherited pcTareas: TPageControl
Height = 103
ExplicitHeight = 89
ExplicitHeight = 103
inherited tsSumarios: TTabSheet
ExplicitHeight = 48
inherited frViewSumarios1: TfrViewSumarios
@ -250,17 +248,17 @@ inherited fEditorInfMargenArticulo: TfEditorInfMargenArticulo
end
end
inherited tsFiltros: TTabSheet
ExplicitHeight = 79
ExplicitHeight = 93
inherited frViewFiltros1: TfrViewFiltros
Height = 93
ExplicitHeight = 79
ExplicitHeight = 93
inherited cxFilterControl1: TcxFilterControl
Height = 34
ExplicitHeight = 20
ExplicitHeight = 34
end
inherited TBXAlignmentPanel3: TTBXAlignmentPanel
Top = 63
ExplicitTop = 49
ExplicitTop = 63
end
end
end
@ -270,26 +268,117 @@ inherited fEditorInfMargenArticulo: TfEditorInfMargenArticulo
end
inherited TBXMultiDock2: TTBXMultiDock
Width = 679
ExplicitWidth = 671
ExplicitWidth = 679
inherited pnlIntervaloFechas: TTBXDockablePanel
ExplicitWidth = 663
inherited TBXAlignmentPanel3: TTBXAlignmentPanel
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
inherited frViewInfMargenArticuloGrid1: TfrViewInfMargenArticuloGrid
Width = 457
Height = 347
ExplicitWidth = 449
ExplicitHeight = 319
ExplicitWidth = 457
ExplicitHeight = 347
inherited cxGrid: TcxGrid
Width = 457
Height = 347
ExplicitWidth = 449
ExplicitHeight = 319
ExplicitWidth = 457
ExplicitHeight = 347
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]
end
inherited cxGridViewFAMILIA: TcxGridDBColumn [10]

View File

@ -125,9 +125,11 @@ begin
end;
procedure TfEditorInfMargenArticulo.actRefrescarExecute(Sender: TObject);
begin
inherited;
frViewInfMargenArticulo1.Refresh;
while (frViewInfMargenArticulo1.frViewInfMargenArticuloGrid1.FocusedView.Controller.FocusedRecord is TcxGridGroupRow) do
begin
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
actPropiedades.Execute;
actRefrescar.Execute;
if not frViewInfMargenArticulo1.frViewInfMargenArticuloGrid1.HayColumnasDePromedio then
begin
frViewInfMargenArticulo1.TBXMultiDock2.Visible := False;
actRefrescar.Execute;
end;
end;
procedure TfEditorInfMargenArticulo.actPrevisualizarExecute(

View File

@ -83,7 +83,6 @@ inherited frViewInfMargenArticulo: TfrViewInfMargenArticulo
inherited TBXMultiDock2: TTBXMultiDock
Width = 834
Height = 105
Visible = False
ExplicitWidth = 834
ExplicitHeight = 105
inherited pnlIntervaloFechas: TTBXDockablePanel
@ -98,6 +97,48 @@ inherited frViewInfMargenArticulo: TfrViewInfMargenArticulo
ExplicitTop = 71
ExplicitWidth = 814
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
inline frViewInfMargenArticuloGrid1: TfrViewInfMargenArticuloGrid [2]
@ -123,6 +164,88 @@ inherited frViewInfMargenArticulo: TfrViewInfMargenArticulo
Height = 343
ExplicitWidth = 612
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
inherited dxPrintStyleManager1: TdxPrintStyleManager
inherited dxPrintStyleManager1Style1: TdxPSPrintStyle

View File

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

View File

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

View File

@ -86,6 +86,7 @@ type
public
procedure Refresh; override;
constructor Create(AOwner: TComponent); override;
function HayColumnasDePromedio: boolean;
end;
implementation
@ -102,9 +103,27 @@ begin
Result := cxGridView;
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;
var
FocusedRow, TopRow : Integer;
FocusedRow, TopRow, i : Integer;
begin
inherited;
{ Refrescar las filas del grid a partir del dataset y colocar la fila
@ -118,6 +137,10 @@ begin
FocusedView.DataController.FocusedRowIndex := FocusedRow;
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;

View File

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

View File

@ -91,7 +91,7 @@ end;
procedure TfrViewInfVentasArticuloGrid.Refresh;
var
FocusedRow, TopRow : Integer;
FocusedRow, TopRow, i : Integer;
begin
inherited;
{ Refrescar las filas del grid a partir del dataset y colocar la fila
@ -105,6 +105,10 @@ begin
FocusedView.DataController.FocusedRowIndex := FocusedRow;
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;

View File

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

View File

@ -90,7 +90,7 @@ type
procedure SetOnViewChanged(const Value : TNotifyEvent); virtual;
function GetOnFilterChanged: TNotifyEvent; virtual;
procedure SetOnFilterChanged(const Value: TNotifyEvent); virtual;
function GetViewProperties: String; virtual;
function GetViewProperties: String; virtual;
procedure SetViewProperties(const Value: String); virtual;
function GetFilterValueList(index: Integer) : TStringList; virtual;
procedure ActivarEventos; virtual;

View File

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

View File

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

Binary file not shown.

Binary file not shown.

View File

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

View File

@ -68,11 +68,11 @@ type
actVerPedidoCli: TAction;
procedure CustomViewCreate(Sender: TObject);
procedure CustomViewDestroy(Sender: TObject);
procedure frViewProveedorPedidoButton1Click(Sender: TObject);
procedure frViewProveedorPedidoButton2Click(Sender: TObject);
procedure bFormasPagoClick(Sender: TObject);
procedure actVerPedidoCliExecute(Sender: TObject);
procedure actVerPedidoCliUpdate(Sender: TObject);
procedure frViewProveedorPedidoButton1Click(Sender: TObject);
procedure frViewProveedorPedidoButton2Click(Sender: TObject);
protected
FPedido : IBizPedidoProveedor;
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
Exit;
end;
frViewProveedorPedido.actElegirContacto.Execute;
frViewProveedorPedido.actAnadirContacto.Execute;
end;
function TfrViewPedidoProveedor.GetPedido: IBizPedidoProveedor;

View File

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

View File

@ -77,6 +77,7 @@ type
procedure actElegirDireccionUpdate(Sender: TObject);
procedure bFormasPagoClick(Sender: TObject);
procedure frViewClientePedidoButton1Click(Sender: TObject);
procedure frViewClientePedidoButton2Click(Sender: TObject);
protected
FPedido : IBizPedidoCliente;
FViewClientePedido : TfrViewDatosYSeleccionCliente;
@ -172,6 +173,17 @@ begin
frViewClientePedido.actElegirContacto.Execute;
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;
begin
Result := FPedido;

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<BorlandProject>
<PersonalityInfo>
<Option>
@ -175,13 +175,14 @@
<VersionInfoKeys Name="ProductName"></VersionInfoKeys>
<VersionInfoKeys Name="ProductVersion">2.2.1.0</VersionInfoKeys>
<VersionInfoKeys Name="Comments"></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>
</Delphi.Personality>
<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>
</Delphi.Personality>
<ModelSupport>False</ModelSupport>
<!-- EurekaLog First Line
<!-- EurekaLog First Line
[Exception Log]
EurekaLog Version=519
Activate=0

View File

@ -126,10 +126,10 @@ uses
schArticulosClient_Intf in '..\Modulos\Articulos\Model\schArticulosClient_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},
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',
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 ..\Servicios\RODLFile.res}

View File

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