Board index » delphi » Question re: Business Logic in Client/Server Apps

Question re: Business Logic in Client/Server Apps

Hi,

I am shortly going to have to port a rather large application from
Desktop database to Interbase.

The company has asked that in the port/upgrade that we incorporate
accounting functionality (accounts payable, etc).

When the user enters a new sale, the details of the sale will post
directly into the accounts recieveable ledger blah blah blah.

The problem is that each sale could generate from '0' to 'X' accounts
payable items, depending on the type of sale.

The company has requested that we provide some sort of "control" area
where they can define what items should be posted to the recievable
ledger. The chargable items change form week to week, so understandably
they don't want us to have to change triggers / stored procs etc on a
weekly basis.

So!

can anyone give me advice on how this type of functionality could be
incorporated?

Appreciate any answers copied to me by email at 't...@cargo.iol.ie'

Many thanks,

Allen.

--
(To reply remove the NO from my address!)

 

Re:Question re: Business Logic in Client/Server Apps


If I understand the problem, you need to hav a way for users to specify the
number of places / updates for each type of sale.
What I would suggest is that you create a 'control' table which the users
can update as needed.  If it's a simple count, have 2 fields, SalesType and
NumAccounts.  If they need to specify which accounts per sale, do something
like SalesType, Account1..AccountX with a y/n or boolean value or some
such.  Then just programatically step through them.

Quote
Allen wrote:

(with snippage)
Quote
> Hi,

> The problem is that each sale could generate from '0' to 'X' accounts
> payable items, depending on the type of sale.

> The company has requested that we provide some sort of "control" area
> where they can define what items should be posted to the recievable
> ledger. The chargable items change form week to week, so understandably
> they don't want us to have to change triggers / stored procs etc on a
> weekly basis.

> So!
> --
> (To reply remove the NO from my address!)

Re:Question re: Business Logic in Client/Server Apps


Re:Question re: Business Logic in Client/Server Apps


Pam,

thanks for that - I better explain a bit better.

The client says at design time "Ok, here are the things we want to post
to the receivables ledger once a job is posted ... code them in"

- Rather than hard-code them, we wish to put them as perhaps triggers or
stored queries.

Now .... every week the client has a new business rule (don't ask - its
the nature of their game ... airline!) .... they do not want to come to
us and have us write a new stored query / trigger each time a new
"chargable item" comes along or one becomes redundant ..... they want
some way of inputting these "triggers" in a user friendly way themselves.

For example ... today, a chargable item could be ......

(number of passengers * weight allowance per passenger) * 1% of flight
cost

Whereas next week it could change to .....

((number of passengers * actual weight per passenger) * 17% of fuel
cost)/ exchange rate)

- Gets kinda weird!

I can find no easy way of doing this short of writing some sort of macro-
language that converts "user-speak" into SQL that gets stored in a memo
field. Then the trigger scans thru the memo field and creates the SQL "on
the fly" as required ..... I have no idea how this would work, just my
thoughts at this late hour!!

- Appreciate any more thoughts you many have.

- Allen.

In article <351C42EF.90E4F...@vdsinc.com>, pabdu...@vdsinc.com says...

Quote
> If I understand the problem, you need to hav a way for users to specify the
> number of places / updates for each type of sale.
> What I would suggest is that you create a 'control' table which the users
> can update as needed.  If it's a simple count, have 2 fields, SalesType and
> NumAccounts.  If they need to specify which accounts per sale, do something
> like SalesType, Account1..AccountX with a y/n or boolean value or some
> such.  Then just programatically step through them.

> Allen wrote:
> (with snippage)

--
(To reply remove the NO from my address!)

Re:Question re: Business Logic in Client/Server Apps


Quote
Allen wrote:
> Pam,

> thanks for that - I better explain a bit better.

> The client says at design time "Ok, here are the things we want to post
> to the receivables ledger once a job is posted ... code them in"

This is good - list is fixed (?)

Quote

> - Rather than hard-code them, we wish to put them as perhaps triggers or
> stored queries.

> Now .... every week the client has a new business rule (don't ask - its
> the nature of their game ... airline!) .... they do not want to come to
> us and have us write a new stored query / trigger each time a new
> "chargable item" comes along or one becomes redundant ..... they want
> some way of inputting these "triggers" in a user friendly way themselves.

> For example ... today, a chargable item could be ......

> (number of passengers * weight allowance per passenger) * 1% of flight
> cost

> Whereas next week it could change to .....

> ((number of passengers * actual weight per passenger) * 17% of fuel
> cost)/ exchange rate)

> - Gets kinda weird!

> I can find no easy way of doing this short of writing some sort of macro-
> language that converts "user-speak" into SQL that gets stored in a memo
> field. Then the trigger scans thru the memo field and creates the SQL "on
> the fly" as required ..... I have no idea how this would work, just my
> thoughts at this late hour!!

> - Appreciate any more thoughts you many have.

> - Allen.

You are going to have to create the SQL statements at run - time.No need for a
memo field, though, (unless you want the user to verify the syntax before
executing - but this might be beter done in a dialog box).
What you'll need is groups of check-boxes (or  check-list boxes) .
Set them up in a fake query - something like:

List1          ____ (box for operator)     List2             =        List3
Item1                                                    Item1
Item2                                                    Item2
Item3                                                    Item3
...

Re:Question re: Business Logic in Client/Server Apps


Actually, in this situation, it sounds like embedding the logic in a
stored procedure is the BEST solution.  You might be able to provide a
method to update the stored procedure through the UI.  The alternative
would be to provide some kind of user-editable business rule parser.  I
have seen some generic mathematical parsers mentioned in the third-party
section.  There are also some spreadsheet components that allow
user-defined formulas, though I don't know how comprehensive they are.  

Quote
Allen wrote:

> Pam,

> thanks for that - I better explain a bit better.

> The client says at design time "Ok, here are the things we want to post
> to the receivables ledger once a job is posted ... code them in"

> - Rather than hard-code them, we wish to put them as perhaps triggers or
> stored queries.

> Now .... every week the client has a new business rule (don't ask - its
> the nature of their game ... airline!) .... they do not want to come to
> us and have us write a new stored query / trigger each time a new
> "chargable item" comes along or one becomes redundant ..... they want
> some way of inputting these "triggers" in a user friendly way themselves.

> For example ... today, a chargable item could be ......

> (number of passengers * weight allowance per passenger) * 1% of flight
> cost

> Whereas next week it could change to .....

> ((number of passengers * actual weight per passenger) * 17% of fuel
> cost)/ exchange rate)

> - Gets kinda weird!

> I can find no easy way of doing this short of writing some sort of macro-
> language that converts "user-speak" into SQL that gets stored in a memo
> field. Then the trigger scans thru the memo field and creates the SQL "on
> the fly" as required ..... I have no idea how this would work, just my
> thoughts at this late hour!!

> - Appreciate any more thoughts you many have.

> - Allen.

> In article <351C42EF.90E4F...@vdsinc.com>, pabdu...@vdsinc.com says...
> > If I understand the problem, you need to hav a way for users to specify the
> > number of places / updates for each type of sale.
> > What I would suggest is that you create a 'control' table which the users
> > can update as needed.  If it's a simple count, have 2 fields, SalesType and
> > NumAccounts.  If they need to specify which accounts per sale, do something
> > like SalesType, Account1..AccountX with a y/n or boolean value or some
> > such.  Then just programatically step through them.

> > Allen wrote:
> > (with snippage)

> --
> (To reply remove the NO from my address!)

Re:Question re: Business Logic in Client/Server Apps


People, you are making something big of this when it is not.
A simple dialog with buttons for math operations (+, -, *, /), listbox with
"friendly names" of field, and one EditBox for %, and buttons for "(" and
")".That is all.

This idea is implemented in ReporthSmith. You can look there for the idea
how to do this. I hope this will help all of you.
--
ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
Regards to You all from
Igor Colovic, Belgrade, Yugoslavia, Europe
ci...@EUnet.yu
Delphi...@Yahoo.com

Other Threads