Tema: consulta
Ver Mensaje Individual
  #1 (permalink)  
Antiguo 08/11/2010, 17:46
karmatron
 
Fecha de Ingreso: agosto-2004
Mensajes: 71
Antigüedad: 20 años, 4 meses
Puntos: 0
consulta

Es posible pasar el siguiente codigo a una consulta sql?


if({Customer.CustID}='D-0696') then (
IF ({CashDtl.TranType}='adjust' and {CashDtl.TranAmt}>0 and {InvcHead.CreditMemo}=true and ({InvcHead.InvoiceSuffix}='CM' or {InvcHead.InvoiceSuffix}='UR' )) then (-1)*{CashDtl.TranAmt}
else IF ({CashDtl.TranType}='adjust' and {CashDtl.TranAmt}<0 and {InvcHead.CreditMemo}=true and ({InvcHead.InvoiceSuffix}='cm' or {InvcHead.InvoiceSuffix}='ur')) then abs({CashDtl.TranAmt})
else if({CashDtl.TranType}='ADJUST' and {CashDtl.TranAmt}<0 and {InvcHead.CreditMemo}=false) then abs({CashDtl.TranAmt})
else if({CashDtl.TranType}='ADJUST' and {CashDtl.TranAmt}>0 and {InvcHead.CreditMemo}=false) then (-1)*({CashDtl.TranAmt})
// else if ({CashDtl.TranType}='PayInv' and {CashDtl.TranAmt}<0 and {InvcHead.InvoiceSuffix}='UR') then {CashDtl.TranAmt}
else if ({CashDtl.TranType}='PayInv' and {CashDtl.TranAmt}>0 and {InvcHead.InvoiceSuffix}='') then {CashDtl.TranAmt}
else if ({CashDtl.TranType}='PayInv' and {InvcHead.CreditMemo}=true and {CashDtl.TranAmt}< 0 and ({InvcHead.InvoiceSuffix}='CM' or {InvcHead.InvoiceSuffix}='UR')) then {CashDtl.TranAmt}
else if({CashDtl.TranType}='CMemo' and {InvcHead.CreditMemo}=true and {CashDtl.TranAmt}>0 and ({InvcHead.InvoiceSuffix}='CM' or {InvcHead.InvoiceSuffix}='UR' )) then (-1)*{CashDtl.TranAmt}
else if({CashDtl.TranType}='CMemo' and {InvcHead.CreditMemo}=false and {CashDtl.TranAmt}<0) then abs({CashDtl.TranAmt}))
else if({CashDtl.Posted}=false) then 0
else IF ({CashDtl.TranType}='adjust' and {CashDtl.TranAmt}>0 and {InvcHead.CreditMemo}=true and ({InvcHead.InvoiceSuffix}='CM' or {InvcHead.InvoiceSuffix}='UR' )) then (-1)*{CashDtl.TranAmt}
else IF ({CashDtl.TranType}='adjust' and {CashDtl.TranAmt}<0 and {InvcHead.CreditMemo}=true and ({InvcHead.InvoiceSuffix}='cm' or {InvcHead.InvoiceSuffix}='ur')) then abs({CashDtl.TranAmt})
else if({CashDtl.TranType}='ADJUST' and {CashDtl.TranAmt}<0 and {InvcHead.CreditMemo}=false) then abs({CashDtl.TranAmt})
else if({CashDtl.TranType}='ADJUST' and {CashDtl.TranAmt}>0 and {InvcHead.CreditMemo}=false) then (-1)*({CashDtl.TranAmt})
// else if ({CashDtl.TranType}='PayInv' and {CashDtl.TranAmt}<0 and {InvcHead.InvoiceSuffix}='UR') then {CashDtl.TranAmt}
else if ({CashDtl.TranType}='PayInv' and {CashDtl.TranAmt}>0 and {InvcHead.InvoiceSuffix}='') then {CashDtl.TranAmt}
else if ({CashDtl.TranType}='PayInv' and {InvcHead.CreditMemo}=true and {CashDtl.TranAmt}< 0 and ({InvcHead.InvoiceSuffix}='CM' or {InvcHead.InvoiceSuffix}='UR')) then {CashDtl.TranAmt}
else if({CashDtl.TranType}='CMemo' and {InvcHead.CreditMemo}=true and {CashDtl.TranAmt}>0 and ({InvcHead.InvoiceSuffix}='CM' or {InvcHead.InvoiceSuffix}='UR' )) then (-1)*{CashDtl.TranAmt}
else if({CashDtl.TranType}='CMemo' and {InvcHead.CreditMemo}=false and {CashDtl.TranAmt}<0) then abs({CashDtl.TranAmt})
)

gracias