Work
This commit is contained in:
parent
c9209dc9a5
commit
474d3bf5b1
86 changed files with 675 additions and 529 deletions
6
AccountProject/drools-lesson2/drools-lesson1 (1).iml
Normal file
6
AccountProject/drools-lesson2/drools-lesson1 (1).iml
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="false">
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
|
|
@ -1,34 +1,32 @@
|
|||
//#created on: 30 oct. 2010
|
||||
|
||||
package cours
|
||||
|
||||
//#list any import classes here.
|
||||
|
||||
import droolscours.Account;
|
||||
import droolscours.AccountingPeriod;
|
||||
import droolscours.CashFlow;
|
||||
import droolscours.util.OutputDisplay;
|
||||
|
||||
//#declare any global variables here
|
||||
|
||||
|
||||
global OutputDisplay showResult;
|
||||
|
||||
|
||||
rule "Account and accounting period both exist"
|
||||
|
||||
when
|
||||
Account( )
|
||||
AccountingPeriod( )
|
||||
then
|
||||
showResult.showText("Un compte est un accountingperiod existe");
|
||||
|
||||
end
|
||||
rule "Credit rule"
|
||||
|
||||
when
|
||||
$cash :CashFlow( $aDate : mvtDate, $no : accountNo ,type == CashFlow.CREDIT )
|
||||
$acc : Account(accountno ==$no )
|
||||
$period : AccountingPeriod( startDate <= $aDate && endDate >= $aDate)
|
||||
then
|
||||
$acc.setBalance($acc.getBalance()+$cash.getAmount());
|
||||
showResult.showText("Account no "+$acc.getAccountno()+ " has now a balance of "+$acc.getBalance());
|
||||
end
|
||||
rule "Debit rule"
|
||||
|
||||
when
|
||||
$cash :CashFlow( $no : accountNo ,type == CashFlow.CREDIT )
|
||||
$cash :CashFlow( $aDate : mvtDate, $no : accountNo ,type == CashFlow.DEBIT )
|
||||
$acc : Account(accountno ==$no )
|
||||
$period : AccountingPeriod( startDate <= $aDate && endDate >= $aDate)
|
||||
then
|
||||
$acc.setBalance($acc.getBalance()+$cash.getAmount());
|
||||
showResult.showText("le compte no "+$no+ " a maintenant une valeur de "+$acc.getBalance());
|
||||
$acc.setBalance($acc.getBalance()-$cash.getAmount());
|
||||
showResult.showText("Account no "+$acc.getAccountno()+ " has now a balance of "+$acc.getBalance());
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
editor.link_modal.header
Reference in a new issue