Jump to content
We've recently updated our Privacy Statement, available here ×

detr820

Members
  • Posts

    3
  • Joined

  • Last visited

detr820's Achievements

Newbie

Newbie (1/14)

  • Week One Done
  • One Month Later
  • One Year In
  • First Post Rare
  • Conversation Starter Rare

Recent Badges

0

Reputation

  1. Casi resolvi el problema sustituyendo "(date_invoice, 'mm')" por "coalesce(date_invoice, currente_date), 'mm')". Estoy usando Openerp para facturar, en este sistema se crea un pedido de ventas y luego se manda a facturar, cuando el documento llega al modulo de facturacion la fecha queda en blanco hasta que la persona encargada imprime la factura. Lo que me queda es ordenar por mes, pero cuando lo hago me crea varias lineas un mismo mes, sin el order by, quedan agrupados pero no en orden. SELECTcase to_char(coalesce(date_invoice, current_date),'mm')when '01' then 'Enero' when '02' then 'Febrero' when '03' then 'Marzo' when '04' then 'Abril' when '05' then 'Mayo' when '06' then 'Junio' when '07' then 'Julio' when '08' then 'Agosto' when '09' then'Septiembre' when '10' then 'Octubre' when '11' then 'Noviembre' when'12' then 'Diciembre' end as mes,sum(case type when 'out_invoice' then amount_untaxed else -amount_untaxed end) as ventaFROMaccount_invoice where type in ('out_invoice','out_refund')group bycaseto_char(coalesce(date_invoice, current_date),'mm') when '01' then 'Enero' when '02' then 'Febrero' when '03' then 'Marzo' when '04'then 'Abril' when '05' then 'Mayo' when '06' then 'Junio' when '07'then 'Julio' when '08' then 'Agosto' when '09' then 'Septiembre' when'10' then 'Octubre' when '11' then 'Noviembre' when '12' then'Diciembre' end [/code]
  2. Como hago para filtrar valores null, estoy tratando de crear un reporte mensual a partir de la fecha, esta la convierto a mes pero hay algunas lineas que no tienen fecha y estas al hacer la conversion a mes me arroja valor NULL, necesito dejar todos los valores menos los null. (123 null; 456 enero; ...; 789 diciembre) ahora (456 enero; ...; 789 diciembre) lo que necesito Este query es la ultima version de los que he probado: selectsum(account_invoice.amount_total), case to_char(date_invoice,'mm') when '01' then 'Enero' when '02' then 'Febrero' when '03' then 'Marzo' when '04' then 'Abril' when '05' then 'Mayo' when '06' then 'Junio' when '07' then 'Julio' when '08' then 'Agosto' when '09' then 'Septiembre' when '10' then 'Octubre' when '11' then 'Noviembre' when '12' then 'Diciembre' when IS NULL then 'Nulo' endfrom account_invoicegroup bycase to_char(date_invoice,'mm') when '01' then 'Enero' when '02' then 'Febrero' when '03' then 'Marzo' when '04' then 'Abril' when '05' then 'Mayo' when '06' then 'Junio' when '07' then 'Julio' when '08' then 'Agosto' when '09' then 'Septiembre' when '10' then 'Octubre' when '11' then 'Noviembre' when '12' then 'Diciembre' when IS NULL then 'Nulo' end[/code] Gracias por la ayuda
  3. Estoy usando Jasper Soft para crear reportes de Openerp con postgre sql. Tengo este query: select sum(account_invoice.amount_total), case to_char(date_invoice,'mm') when '01' then 'Enero' when '02' then 'Febrero' when '03' then 'Marzo' when '04' then 'Abril' when '05' then 'Mayo' when '06' then 'Junio' when '07' then 'Julio' when '08' then 'Agosto' when '09' then 'Septiembre' when '10' then 'Octubre' when '11' then 'Noviembre' when '12' then 'Diciembre' end from account_invoicegroup by case to_char(date_invoice,'mm') when '01' then 'Enero' when '02' then 'Febrero' when '03' then 'Marzo' when '04' then 'Abril' when '05' then 'Mayo' when '06' then 'Junio' when '07' then 'Julio' when '08' then 'Agosto' when '09' then 'Septiembre' when '10' then 'Octubre' when '11' then 'Noviembre' when '12' then 'Diciembre' end[/code] Lo que necesito es crear un reporte donde pueda convertir la fecha a mes, luego agrupar dicho reporte por mes (ordenado tambien), Existe una forma mas corta de hacerlo? ya probe con MONTH, DATEPART y me dice que la funcion no existe. De antemano gracias.
×
×
  • Create New...