Link to home
Create AccountLog in
Avatar of erikTsomik
erikTsomikFlag for United States of America

asked on

coldfusion logic help

I need help coming up with the logic.

I have 2 classess that been purchased on the payment plan. (the payment plan options are: 4,6 ,9 payments plan).

Let say that course 1 was purchased on 4 payment plan option. The course is consists of 1 theoretical part and 7 practical .

When payment 1 is made no practical parts are released,
when payment 2 is posted 2 practical parts get open up
when payment 3 is posted 2 more practical parts open up
when payment 4 is posted 3 more  practical parts open up

Let say that course 2 was purchased on 4 payment plan option. The course is consists of 1 theoretical part and 3 practical .

When payment 1 is made no practical parts are released,
when payment 2 is posted 1 practical parts get open up
when payment 3 is posted 1 more practical parts open up
when payment 4 is posted 1 more  practical parts open up

Let say that course 3 was purchased on 6 payment plan option. The course is consists of 1 theoretical part and 7 practical .

When payment 1 is made no practical parts are released,
when payment 2 is posted 1 practical parts get open up
when payment 3 is posted 1 more practical parts open up
when payment 4 is posted 1 more  practical parts open up
when payment 5 is posted 2 more  practical parts open up
when payment 6  is posted 2 more  practical parts open up


and so on
Avatar of sarabande
sarabande
Flag of Luxembourg image

you can make a table from a structure where all these informations easily can be defined:

struct PayPlan
{
     int courseNo;
     int payopt;
     int theo;
     int pract;
     int  partsOpen[9];
};

PayPlan cp[] = 
//  no     plan  theo     prac    p1  p2   p3   p4   p5   p6  p7   p8   p9
 {
  {  1 ,    4,      1,      7,  {  0, -2,  +2, +3,   0,   0,   0,   0,  0 },  },
  {  2 ,    4,      1,      3,  {  0, -1,  +1, +1,   0,   0,   0,   0,  0 },  },
  {  3 ,    9,      1,      7,  {  0, -1,  +1, +1,  +2,  +2,   0,   0,  0 },  },  
    ....
};  

Open in new window


negative numbers for parts mean absolute number of parts opened, positive numbers mean "more" parts,

Sara
Avatar of erikTsomik

ASKER

looks good but how would I use this
ASKER CERTIFIED SOLUTION
Avatar of sarabande
sarabande
Flag of Luxembourg image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
I took your advice and put it in the table
When payment 1 is made no practical parts are released,
when payment 2 is posted 1 practical parts get open up
when payment 3 is posted 1 more practical parts open up
when payment 4 is posted 1 more  practical parts open up
when payment 5 is posted 2 more  practical parts open up
when payment 6  is posted 2 more  practical parts open up
Out of curiosity, how is the number released determined?
Business logic
No, I meant what exactly are the rules.