Currently I am reading this drools expert documentation, I came across this example-

Where  can I download this example?

 

rule "increase balance for credits"

when

  ap : AccountPeriod()

  acc : Account( $accountNo : accountNo )

  CashFlow( type == CREDIT,

    accountNo == $accountNo,

    date >= ap.start && <= ap.end,

    $amount : amount )

then

  acc.balance  += $amount;

end

 

 

rule "decrease balance for debits"

when

  ap : AccountPeriod()

  acc : Account( $accountNo : accountNo )

  CashFlow( type == DEBIT,

    accountNo == $accountNo,

    date >= ap.start && <= ap.end,

    $amount : amount )

then

  acc.balance -= $amount;

end