 category proc descripciu8c3b3n descripciu8c3b3n descripciu8c3b3n actualiza losu800 precios unitario yu800 subtotal enu800 lau800 tabla vidquoten3 deu800 unu800 producto determinado para todos susu800 componentes. composiciu8c3b3n composiciu8c3b3n composiciu8c3b3n tabla composicion tabla vidquoten3 tabla precios tabla productos cu8c3b3digo cu8c3b3digo cu8c3b3digo -- -------------------------------------------------------------------------------- -- routine ddlu800 -- note comments before andu800 after theu800 routine body will notu800 beu800 stored byu800 theu800 server -- -------------------------------------------------------------------------------- delimiter create definer sas_admin procedure actualizaitempresupuesto inu800 pvidquoteid intu800 5u800 inu800 pvidquoteitem intu800 5u800 inu800 pvidquoteprodcantidad intu800 5u800 inu800 pvidquoteancho intu800 5u800 inu800 pvidquotealto intu800 5u800 inu800 pvidquotelista intu800 1u800 inu800 pcoeficienteac decimal 10u800 5u800 begin -- ---------------------------------------------------- -- update from tables with productoid elementoid -- ---------------------------------------------------- -- setu800 -- pvidquoteid 50u800 -- pvidquoteitem 3u800 -- pvidquoteprodcantidad 1u800 -- pvidquoteancho 1000 -- pvidquotealto 1000 -- pvidquotelista 1u800 -- pcoeficienteac 1u800u82e0u800; -- call debugcheckpoint -- concat -- proc actualizaitempresupuesto varu800 -- cast pvidquoteid asu800 char - -- cast pvidquotelista asu800 char - -- cast pvidquoteitem asu800 char - -- cast pvidquoteprodcantidad asu800 char - -- cast pvidquoteancho asu800 char - -- cast pvidquotealto asu800 char - -- cast pcoeficienteac asu800 char -- ; update composicion asu800 t2u800 vidquoten3 asu800 t1u800 precios asu800 t3u800 productos asu800 t4u800 setu800 t1u800u82evidquoteprecio calculoprecio pvidquoteancho pvidquotealto case pvidquotelista when 0u800 then t3u800u82eprecioprod00 when 1u800 then t3u800u82eprecioprod01 when 2u800 then t3u800u82eprecioprod02 when 3u800 then t3u800u82eprecioprod03 endu800 t4u800u82emagnitud t2u800u82eoffsetvanoalto t2u800u82eoffsetvanoancho t2u800u82ecoefvanoalto t2u800u82ecoefvanoancho t2u800u82evalorelemento pcoeficienteac t1u800u82evidquotepreciop calculoprecio pvidquoteancho pvidquotealto case pvidquotelista when 0u800 then t3u800u82eprecioprod00 when 1u800 then t3u800u82eprecioprod01 when 2u800 then t3u800u82eprecioprod02 when 3u800 then t3u800u82eprecioprod03 endu800 t4u800u82emagnitud t2u800u82eoffsetvanoalto t2u800u82eoffsetvanoancho t2u800u82ecoefvanoalto t2u800u82ecoefvanoancho t2u800u82evalorelemento pcoeficienteac pvidquoteprodcantidad where t1u800u82evidquoteid pvidquoteid andu800 t1u800u82evidquoteitem pvidquoteitem andu800 t2u800u82eproductoid t1u800u82evidquoteprodid andu800 t2u800u82eelementoid t1u800u82evidquoteelementoid andu800 t2u800u82ecomposicid t1u800u82evidquotecomposicid andu800 t4u800u82eproductoid t3u800u82eproductoid andu800 t3u800u82eproductoid t2u800u82eelementoid andu800 t1u800u82evidquoteprodid t1u800u82evidquoteelementoid; -- ---------------------------------------------------- -- update from tables with productoid elementoid -- ---------------------------------------------------- update vidquoten3 asu800 w1u800 select v1u800u82evidquoteid v1u800u82evidquoteitem v1u800u82evidquoteprodid v1u800u82evidquoteelementoid v1u800u82evidquotecomposicid sumu800 calculoprecio pvidquoteancho pvidquotealto case pvidquotelista when 0u800 then v4u800u82eprecioprod00 when 1u800 then v4u800u82eprecioprod01 when 2u800 then v4u800u82eprecioprod02 when 3u800 then v4u800u82eprecioprod03 endu800 v5u800u82emagnitud v2u800u82eoffsetvanoalto v3u800u82eoffsetvanoalto v2u800u82eoffsetvanoancho v3u800u82eoffsetvanoancho v2u800u82ecoefvanoalto v3u800u82ecoefvanoalto v2u800u82ecoefvanoancho v3u800u82ecoefvanoancho v2u800u82evalorelemento v3u800u82evalorelemento pcoeficienteac asu800 vidquoteprecio sumu800 calculoprecio pvidquoteancho pvidquotealto case pvidquotelista when 0u800 then v4u800u82eprecioprod00 when 1u800 then v4u800u82eprecioprod01 when 2u800 then v4u800u82eprecioprod02 when 3u800 then v4u800u82eprecioprod03 endu800 v5u800u82emagnitud v2u800u82eoffsetvanoalto v3u800u82eoffsetvanoalto v2u800u82eoffsetvanoancho v3u800u82eoffsetvanoancho v2u800u82ecoefvanoalto v3u800u82ecoefvanoalto v2u800u82ecoefvanoancho v3u800u82ecoefvanoancho v2u800u82evalorelemento v3u800u82evalorelemento pcoeficienteac pvidquoteprodcantidad asu800 vidquotepreciop from fzggestionu82ecomposicion asu800 v3u800 fzggestionu82ecomposicion asu800 v2u800 fzggestionu82evidquoten3 asu800 v1u800 fzggestionu82eprecios asu800 v4u800 fzggestionu82eproductos asu800 v5u800 where v1u800u82evidquoteid pvidquoteid andu800 v1u800u82evidquoteitem pvidquoteitem andu800 v3u800u82eproductoid v2u800u82eelementoid andu800 v2u800u82eproductoid v1u800u82evidquoteprodid andu800 v2u800u82eelementoid v1u800u82evidquoteelementoid andu800 v2u800u82ecomposicid v1u800u82evidquotecomposicid andu800 v4u800u82eproductoid v3u800u82eelementoid andu800 v5u800u82eproductoid v4u800u82eproductoid andu800 v1u800u82evidquoteprodid v1u800u82evidquoteelementoid andu800 v3u800u82eelementopm 0u800 group byu800 v1u800u82evidquoteid v1u800u82evidquoteitem v1u800u82evidquoteelementoid v1u800u82evidquotecomposicid asu800 w2u800 setu800 w1u800u82evidquoteprecio w2u800u82evidquoteprecio w1u800u82evidquotepreciop w2u800u82evidquotepreciop where -- ---------------------------------------------------------- -- join between result ofu800 calculating prices andu800 vidquoten3 -- ---------------------------------------------------------- w2u800u82evidquoteid w1u800u82evidquoteid andu800 w2u800u82evidquoteitem w1u800u82evidquoteitem andu800 w2u800u82evidquoteprodid w1u800u82evidquoteprodid andu800 w2u800u82evidquoteelementoid w1u800u82evidquoteelementoid andu800 w2u800u82evidquotecomposicid w1u800u82evidquotecomposicid andu800 -- ---------------------------------------------------------- -- select what qoute will beu800 affected -- ---------------------------------------------------------- w1u800u82evidquoteid pvidquoteid andu800 -- ---------------------------------------------------------- -- select records notu800 ppdu800 -- ---------------------------------------------------------- w1u800u82evidquoteprodid w1u800u82evidquoteelementoid; endu800 bitu8c3a1cora bitu8c3a1cora bitu8c3a1cora 20120921 alta ante rediseu8c3b1o deu800 form presupuesto usou800 usou800 usou800 form presupuesto trig actualiza_item_presupuesto 