on 08-27-2015 1:07 PM
Estimados tengo la siguiente consulta y quisiera agregar al final de la última columna la suma de 'valor de stocks'
Alguien sabe si se puede hacer? adjunto query e imagen de lo que necesito..
Saludos.
Select 'Alcapharma' 'Empresa', a.itemcode, a.itemname, d.itmsgrpnam, convert(int,a.onhand) 'Stock Total', convert(int,c.onhand) 'Biomedicals', convert(int,y.onhand) 'Pharma ISA' , convert(int,x.onhand) 'Retenidas Biomedicals', convert(int,z.onhand) 'Retenidas Pharma ISA', convert(int,a.iscommited) 'Reservado', convert(int,(a.onhand - a.iscommited)) 'Disponible', convert(int,a.onorder) 'Solicitado', convert(int,(a.onhand + a.onorder - a.iscommited)) 'Disponible + Solicitado', a.lstevlpric, a.avgprice, a.lastpurprc, a.stockvalue
from oitm a inner join oitw b on a.itemcode = b.itemcode and b.whscode = 'b01' inner join oitw c on a.itemcode = c.itemcode and c.whscode = 'b07' inner join oitb d on a.itmsgrpcod = d.itmsgrpcod inner join oitw x on a.itemcode = x.itemcode and x.whscode = 'b04' inner join oitw y on a.itemcode = y.itemcode and y.whscode = 'b06' inner join oitw z on a.itemcode = z.itemcode and z.whscode = 'b08'
where d.itmsgrpnam = 'Medicamentos Reg.' or d.itmsgrpnam = 'Artículo 21' and a.onhand > '0'
order by a.stockvalue desc
Hola
si te sitúas en la cabecera del informe, sobre el nombre de una columna numérica, y haces CTRL + doble clic, en la parte inferior del informe se mostrará el total.
Un saludo
Agustín Marcos Cividanes
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hola. Gracias por tu respuesta Marco, pero no es lo que necesito por que es para generar una alarma que se envíe a através de outlook. entonces el CTRL + doble click es momentáneo es decir ejecuto la Query de nuevo y ya no aparece la suma por ende no aparecerá en la alarma.
Necesito configurar algo para que aparezca siempre.
Saludos,
Hola
prueba esta consulta:
Select 'Alcapharma' 'Empresa', a.itemcode, a.itemname, d.itmsgrpnam, convert(int,a.onhand) 'Stock Total', convert(int,c.onhand) 'Biomedicals', convert(int,y.onhand) 'Pharma ISA' , convert(int,x.onhand) 'Retenidas Biomedicals', convert(int,z.onhand) 'Retenidas Pharma ISA', convert(int,a.iscommited) 'Reservado', convert(int,(a.onhand - a.iscommited)) 'Disponible', convert(int,a.onorder) 'Solicitado', convert(int,(a.onhand + a.onorder - a.iscommited)) 'Disponible + Solicitado', a.lstevlpric, a.avgprice, a.lastpurprc, a.stockvalue from oitm a inner join oitw b on a.itemcode = b.itemcode and b.whscode = 'b01' inner join oitw c on a.itemcode = c.itemcode and c.whscode = 'b07' inner join oitb d on a.itmsgrpcod = d.itmsgrpcod inner join oitw x on a.itemcode = x.itemcode and x.whscode = 'b04' inner join oitw y on a.itemcode = y.itemcode and y.whscode = 'b06' inner join oitw z on a.itemcode = z.itemcode and z.whscode = 'b08' where d.itmsgrpnam = 'Medicamentos Reg.' or d.itmsgrpnam = 'Artículo 21' and a.onhand > '0' union all Select '', '', '', '', null, null, null, null, null, null, null, null, null, null, null, null, sum(a.stockvalue) from oitm a inner join oitw b on a.itemcode = b.itemcode and b.whscode = 'b01' inner join oitw c on a.itemcode = c.itemcode and c.whscode = 'b07' inner join oitb d on a.itmsgrpcod = d.itmsgrpcod inner join oitw x on a.itemcode = x.itemcode and x.whscode = 'b04' inner join oitw y on a.itemcode = y.itemcode and y.whscode = 'b06' inner join oitw z on a.itemcode = z.itemcode and z.whscode = 'b08' where d.itmsgrpnam = 'Medicamentos Reg.' or d.itmsgrpnam = 'Artículo 21' and a.onhand > '0'
Un saludo
Agustín Marcos Cividanes
User | Count |
---|---|
98 | |
12 | |
11 | |
6 | |
6 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.