# Simple Calculation App.

Discussion in 'Application Requests' started by Offended, Jul 19, 2010.

1. ### Offended New Member Thread Starter 5

Jul 19, 2010
2
0
5
Looking to have a small app written that takes 4 different numbers and outputs a calculated result.

It's primary purpose is for my personal use at work (and if any other co-workers use an android).

I work in printing, and a job has a run length. The printed product is collated in to bundles or lifts, that we stack in a pattern in layers on a skid.

For example, if the run length is 150,000 cps(copies), each lift or bundle contains 75 copies and you can stack on a single layer, 17 lifts. we put a max of 10 layers per skid.

75 cps x 17 = 1275 cps per layer
cps per layer x 10 layers = 12,750 cps per skid.

150,000 / 12,750 = 11.76 skids.

Now obviously we have to figure out how many layers and lifts are in the final skid.

150,000 - (12,750 x 11 ) = 9750,
9750 / 75 = 130 lifts on the last skid.
130 / 17 = 7 layers
130 - (7 x 17) = 11 lifts.

the final output will display

11 full skids
7 layers
11 lifts
1,275 cps per layer
12,750 cps per box

I wrote a quick webpage to do what i wanted. Here is the php code i hacked up to do the above calculations.

PHP:
1. \$runcount = str_replace(",","",\$_REQUEST['runcount']);
2. \$layers = \$_REQUEST['layers'];
3. \$LperLayer = \$_REQUEST['LperLayer'];
4. \$quantity = \$_REQUEST['quantity'];
5.
6. \$LiftersPerRun = \$runcount / \$quantity;
7.
8. \$QperBox = \$LperLayer * \$quantity * \$layers;
9.
10. \$FullBox = floor(\$runcount / \$QperBox);
11. \$x = \$runcount - (\$FullBox * \$QperBox);
12.
13. \$Layers = floor(\$x / (\$LperLayer * \$quantity ) );
14. \$y =  \$x - (\$Layers * (\$LperLayer * \$quantity ));
15. \$Lifts = ceil(\$y / \$quantity);
16.
There are also times when we have a fixed run length and a fixed number of copies per skid, or a fixed number of skids that we need to use.

for example, one of our jobs is 750,000 cps. each box has to have no more than 40,000 cps. each lift is going to be a fixed amount, i.e. 300 cps, and the number of lifts is also known, 16 per layer. The unknown here is how many layers per box and how many total boxes we will need.

In all, i think we'll have 7 fields
Run Length
Copies per Lift
Lifts per Layer
Layers per Skid

# of Full skids
# of layers on final skid
# of lifts on final layer.

Perhaps we could fill in the known variables and the application would fill in the missing fields, regardless of what is needed.

#1
2. ### marchold Well-Known Member 16

Dec 26, 2009
47
1
16
This is an easy one, I wrote it just now.

I was a little confused because I know nothing about the printing business. Can I get you to correct the phrases I used, and check my values. Here is a screen shot:

I got 6 instead of 7 for number of layers, it does not seem to be a rounding issue because the floating point value is exactly 6, any chance it is wrong in your sample? Otherwise I need to figure out what is wrong.

Also the text like "Copies per lift or bundle?" can you suggest better phrases than the ones I used.

Once I am sure I got the math right for the 1st case I will add the code for a fixed run length and copies per skid.

I will get this one published tomorrow if you can get this information to me today.

#2
3. ### Offended New Member Thread Starter 5

Jul 19, 2010
2
0
5
A lift will be perfectly fine to use.

The number of layers is 7, the php code is what I use at BoxCount

I am at work atm and will be able to give more info tomorrow

#3
4. ### marchold Well-Known Member 16

Dec 26, 2009
47
1
16
I just published
Printers Calculator v1.0
It only does the the first case today. I will get the 2nd case done tomorrow.

#4