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