#formato de timestamp en insert de sentencias SqlQuery
org.hibernate.dialect.Oracle9Dialect.timestamp = :vtimestamp 
org.hibernate.dialect.DB2400Dialect.timestamp  = cast(:vtimestamp as timestamp)
org.hibernate.dialect.DB2Dialect.timestamp     = cast(:vtimestamp as timestamp)
org.hibernate.dialect.SQLServerDialect.timestamp = :vtimestamp


#Inmobilizacion de cuentas com.fitbank.view.batch.auxiliar.ImmobilizeComand
org.hibernate.dialect.Oracle9Dialect.Immobilize = and t.finmovilizacion + coalesce(p.diasinmovilizacion,0) between :datefrom and :dateto -1
org.hibernate.dialect.DB2400Dialect.Immobilize  = and date(days(t.finmovilizacion) +  coalesce(p.diasinmovilizacion,0)) between :datefrom and :dateto -1
org.hibernate.dialect.DB2Dialect.Immobilize     = and date(days(t.finmovilizacion) +  coalesce(p.diasinmovilizacion,0)) between :datefrom and :dateto -1
org.hibernate.dialect.SQLServerDialect.Immobilize = and dateadd(day, coalesce(p.diasinmovilizacion,0),t.finmovilizacion) between :datefrom and :dateto -1

#Traslado de sobregiros com.fitbank.view.batch.auxiliar.TransferOverdrawCommand
org.hibernate.dialect.Oracle9Dialect.TransferOverdraw= and ((bal.fvencimiento) +  coalesce(c.diasgracia,0))  <  :dateto
org.hibernate.dialect.DB2400Dialect.TransferOverdraw= and date(days(bal.fvencimiento) +  coalesce(c.diasgracia,0))  <  :dateto
org.hibernate.dialect.DB2Dialect.TransferOverdraw= and date(days(bal.fvencimiento) +  coalesce(c.diasgracia,0))  <  :dateto
org.hibernate.dialect.SQLServerDialect.TransferOverdraw= and dateadd(day, coalesce(c.diasgracia,0),bal.fvencimiento)  <  :dateto

#Maduracion de sobregiros  com.fitbank.view.batch.auxiliar.MaturationOverdrawCommand
org.hibernate.dialect.Oracle9Dialect.MaturationOverdraw   = and abs(bal.fvencimiento - :dateto) between r.diasdesde and r.diashasta  )
org.hibernate.dialect.DB2400Dialect.MaturationOverdraw    = and abs(days(sal.fvencimiento) - days(date(:dateto))) between r.diasdesde and r.diashasta  )
org.hibernate.dialect.DB2Dialect.MaturationOverdraw      = and abs(days(sal.fvencimiento) - days(date(:dateto))) between r.diasdesde and r.diashasta  ) 
org.hibernate.dialect.SQLServerDialect.MaturationOverdraw = and datediff(day,sal.fvencimiento,:dateto) between r.diasdesde and r.diashasta ) 

#Maduracion de plazo fijo  com.fitbank.term.batch.auxiliar.MaturationCommand
org.hibernate.dialect.Oracle9Dialect.MaturationTerm   = and abs(sal.fvencimiento - :dateto) between r.diasdesde and r.diashasta  ) group by sal.ccuenta,sal.cpersona_compania
org.hibernate.dialect.DB2400Dialect.MaturationTerm    = and abs(days(sal.fvencimiento) - days(date(:dateto))) between r.diasdesde and r.diashasta  ) group by sal.ccuenta,sal.cpersona_compania
org.hibernate.dialect.DB2Dialect.MaturationTerm       = and abs(days(sal.fvencimiento) - days(date(:dateto))) between r.diasdesde and r.diashasta  ) group by sal.ccuenta,sal.cpersona_compania
org.hibernate.dialect.SQLServerDialect.MaturationTerm = and datediff(day,sal.fvencimiento,:dateto) between r.diasdesde and r.diashasta ) group by sal.ccuenta,sal.cpersona_compania

#Maduracion de prestamos  com.fitbank.loan.batch.auxiliar.MaturationCommand
org.hibernate.dialect.Oracle9Dialect.MaturationLoan   = and abs(sal.fvencimiento - :dateto) between r.diasdesde and r.diashasta  ) group by sal.ccuenta,sal.cpersona_compania
org.hibernate.dialect.DB2400Dialect.MaturationLoan    = and abs(days(sal.fvencimiento) - days(date(:dateto))) between r.diasdesde and r.diashasta  ) group by sal.ccuenta,sal.cpersona_compania
org.hibernate.dialect.DB2Dialect.MaturationLoan       = and abs(days(sal.fvencimiento) - days(date(:dateto))) between r.diasdesde and r.diashasta  ) group by sal.ccuenta,sal.cpersona_compania
org.hibernate.dialect.SQLServerDialect.MaturationLoan = and datediff(day,sal.fvencimiento,:dateto) between r.diasdesde and r.diashasta ) group by sal.ccuenta,sal.cpersona_compania

#Traslado de prestamos  com.fitbank.loan.batch.auxiliar.TransferAccountCommand
org.hibernate.dialect.Oracle9Dialect.TransferLoan = and ( (( bal.fvencimiento +  coalesce(c.diasgracia,0) ) <= :dateto  and bal.cestatuscuenta in ('003','007') )  or  (( bal.fvencimiento +  coalesce(c.diaspasoavencido,0) ) <= :dateto and bal.cestatuscuenta in ('004')) )
org.hibernate.dialect.DB2400Dialect.TransferLoan  = and ( ( date( days(bal.fvencimiento) +  coalesce(c.diasgracia,0) ) <= :dateto  and bal.cestatuscuenta in ('003','007') )  or  (date( days(bal.fvencimiento) +  coalesce(c.diaspasoavencido,0) ) <= :dateto and bal.cestatuscuenta in ('004')) )
org.hibernate.dialect.DB2Dialect.TransferLoan     = and ( ( date( days(bal.fvencimiento) +  coalesce(c.diasgracia,0) ) <= :dateto  and bal.cestatuscuenta in ('003','007') )  or  (date( days(bal.fvencimiento) +  coalesce(c.diaspasoavencido,0) ) <= :dateto and bal.cestatuscuenta in ('004')) )
org.hibernate.dialect.SQLServerDialect.TransferLoan = and ( ( dateadd( day,coalesce(c.diasgracia,0),bal.fvencimiento ) <= :dateto  and bal.cestatuscuenta in ('003','007') )  or  ( dateadd( day,coalesce(c.diaspasoavencido,0),bal.fvencimiento ) <= :dateto and bal.cestatuscuenta in ('004')) )

#Mora e ISCV prestamos  com.fitbank.loan.batch.auxiliar.DefaultProvisionCommand
org.hibernate.dialect.Oracle9Dialect.DefaultProvisionLoan = and ((sal.fvencimiento + COALESCE(c.diasgraciamora, 0) <= :dateto and sal.fvencimiento + COALESCE(c.diasgraciamora, 0) > :datefrom) or (sal.fvencimiento  <= :dateto  and sal.fvencimiento  > :datefrom)) group by sal.ccuenta, sal.cpersona_compania
org.hibernate.dialect.DB2400Dialect.DefaultProvisionLoan  = and ((date(days(sal.fvencimiento) + COALESCE(c.diasgraciamora, 0)) <= :dateto and date(days(sal.fvencimiento) + COALESCE(c.diasgraciamora, 0)) > :datefrom) or (sal.fvencimiento  <= :dateto  and sal.fvencimiento  > :datefrom)) group by sal.ccuenta, sal.cpersona_compania
org.hibernate.dialect.DB2Dialect.DefaultProvisionLoan     = and ((date(days(sal.fvencimiento) + COALESCE(c.diasgraciamora, 0)) <= :dateto and date(days(sal.fvencimiento) + COALESCE(c.diasgraciamora, 0)) > :datefrom) or (sal.fvencimiento  <= :dateto  and sal.fvencimiento  > :datefrom)) group by sal.ccuenta, sal.cpersona_compania
org.hibernate.dialect.SQLServerDialect.DefaultProvisionLoan = and ((dateadd(day,COALESCE(c.diasgraciamora,0),sal.fvencimiento)   <= :dateto and dateadd(day,COALESCE(c.diasgraciamora,0),sal.fvencimiento) > :datefrom) or (sal.fvencimiento  <= :dateto  and sal.fvencimiento  > :datefrom)) group by sal.ccuenta, sal.cpersona_compania

#Mora e ISCV prestamos  com.fitbank.loan.batch.acco.DefaultProvisionCommand
org.hibernate.dialect.Oracle9Dialect.DefaultProvisionLoanAcco = and ((sal.fvencimiento + COALESCE(c.diasgraciamora, 0) <= :dateto and sal.fvencimiento + COALESCE(c.diasgraciamora, 0) > :datefrom) or (sal.fvencimiento  <= :dateto and sal.fvencimiento  > :datefrom))
org.hibernate.dialect.DB2400Dialect.DefaultProvisionLoanAcco  = and (( date(days(sal.fvencimiento) + COALESCE(c.diasgraciamora, 0)) <= :dateto and date(days(sal.fvencimiento) + COALESCE(c.diasgraciamora, 0)) > :datefrom) or (sal.fvencimiento  <= :dateto and sal.fvencimiento  > :datefrom))
org.hibernate.dialect.DB2Dialect.DefaultProvisionLoanAcco     = and (( date(days(sal.fvencimiento) + COALESCE(c.diasgraciamora, 0)) <= :dateto and date(days(sal.fvencimiento) + COALESCE(c.diasgraciamora, 0)) > :datefrom) or (sal.fvencimiento  <= :dateto and sal.fvencimiento  > :datefrom)) 
org.hibernate.dialect.SQLServerDialect.DefaultProvisionLoanAcco = and (( dateadd(day, COALESCE(c.diasgraciamora, 0),sal.fvencimiento) <= :dateto and dateadd(day,+ COALESCE(c.diasgraciamora,0),sal.fvencimiento) > :datefrom) or (sal.fvencimiento  <= :dateto and sal.fvencimiento  > :datefrom))

