This commit is contained in:
Nicolas Héron 2016-05-20 14:16:10 +02:00
commit 474d3bf5b1
86 changed files with 675 additions and 529 deletions

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<kmodule xmlns="http://jboss.org/kie/6.0.0/kmodule">
<kbase name="lesson35" packages="lesson35">
<ksession name="lesson35-session"/>
</kbase>
</kmodule>

View file

@ -0,0 +1,38 @@
//#created on: 30 oct. 2010
package cours
//#list any import classes here.
import droolscours.Account;
import droolscours.AccountingPeriod;
import droolscours.CashFlow;
import droolscours.PrivateAccount;
import droolscours.Customer;
import droolscours.service.CustomerService;
import java.util.ArrayList;
import droolscours.util.OutputDisplay;
//#declare any global variables here
global OutputDisplay showResult;
global CustomerService serviceCustomer;
rule "Credit and Debit Rule"
when
$c : Account( $acc : accountno )
$p : AccountingPeriod ($sDate : startDate ,$eDate : endDate )
$totalCredit : Number( doubleValue > 100 )
from accumulate( CashFlow( type ==CashFlow.CREDIT,$value : amount, mvtDate >= $sDate && mvtDate <= $eDate,accountNo == $acc ),
init( double total = 0; ),
action( total += $value; ),
reverse( total -= $value; ),
result( total ) )
$totalDebit : Number( doubleValue > 100 )
from accumulate( CashFlow( type ==CashFlow.DEBIT,$value : amount, mvtDate >= $sDate && mvtDate <= $eDate,accountNo == $acc ),
init( double total = 0; ),
action( total += $value; ),
reverse( total -= $value; ),
result( total ) )
then
showResult.showText(" Found "+$totalCredit+" as a credit");
showResult.showText(" Found "+$totalDebit+" as a debit");
end