miércoles, 14 de marzo de 2012

Cotizaciones de ventas en Adempiere

Primero ejecutamos los siguientes scripts SQL


/*

drop table c_priceline;

drop table c_price;

*/

create table c_price
(
ad_client_id numeric(10,2) not null,
    ad_org_id numeric(10,2) not null,
    isactive char(1) default 'Y',
    created date not null,
    createdby numeric(10,2) not null,
    updated date not null,
    updatedby numeric(10,2) not null,
    c_price_id numeric(10,2) not null primary key,
    codigo character varying not null,
    descripcion character varying,
    c_bpartner_id numeric(10,2) not null,
    fecha date not null,
    num_licitacion character varying,
    c_order_id numeric(10,2),
    m_pricelist_id numeric(10,2),
    gran_total numeric(10,2),
    constraint "cprice_c_bpartner" foreign key ("c_bpartner_id") references c_bpartner("c_bpartner_id")
    on delete no action on update no action deferrable initially deferred,
    constraint "cprice_c_order" foreign key ("c_order_id") references c_order("c_order_id")
    on delete no action on update no action deferrable initially deferred,
    constraint "cprice_m_pricelist" foreign key ("m_pricelist_id") references m_pricelist("m_pricelist_id")
    on delete no action on update no action deferrable initially deferred
);

create table c_priceline
(
ad_client_id numeric(10,2) not null,
    ad_org_id numeric(10,2) not null,
    isactive char(1) default 'Y',
    created date not null,
    createdby numeric(10,2) not null,
    updated date not null,
    updatedby numeric(10,2) not null,
    c_priceline_id numeric(10,2) not null primary key,
    c_price_id numeric(10,2) not null,
    num_linea numeric(10,2) not null default 10,
    descripcion character varying,
    m_product_id numeric(10,2) not null,
    cantidad numeric(10,2) not null,
    precio numeric(10,2) not null,
    total numeric(10,2) not null default 0,
    constraint "cprice_cpriceline" foreign key ("c_price_id") references c_price("c_price_id")
    on delete no action on update no action deferrable initially deferred,
    constraint "cprice_m_product" foreign key ("m_product_id") references m_product("m_product_id")
    on delete no action on update no action deferrable initially deferred  
);

Luego agregamos las tablas, las ventanas y pestañas en el adempiere, ver enlace:

http://bseni.blogspot.com/2012/03/precio-cantidad-en-adempiere.html

Finalmente nos quedará un maestro-detalle, el cual se realizará la operación automática de precio * compra para obtener el subtotal, y con el disparador se actualizará el total del maestro.



No hay comentarios:

Publicar un comentario