Jump to content
Fórum Script Brasil
  • 0

impressão de carne - logica


Alexandre Rocha
 Share

Question

// salta de 15 em 15, pois são 5

$qtparcela = "5"; // quantidade de parcelas por carne

$qtcarne = "3"; // quanitade de carnes por folha

$limite = 3 * $qtparcela; // controle para o proximo carne

$a1 = "1"; // carne topo

$b2 = "2"; // carne meio

$c3 = "3"; // carne rodape

$abc = $a1; // controla em qual dos 3 carnes ir implementar salto

$posicao = "topo";

switch ($posicao){

case "topo":

$abc=$a1+$qtcarne;

$a1=$abc;

if ($a1+$qtcarne > $limite) {

$a1=$limite;

$posicao="meio";

$b2=$b2-$qtcarne;

}

echo "a1: $a1<br>";

break;

case "meio":

$abc=$b2+$qtcarne;

$b2=$abc;

if ($b2+$qtcarne > $limite) {

$b2=$limite;

$posicao="rodape";

$c3=$c3-$qtcarne;

}

echo "b2: $b2<br>";

break;

case "rodape":

$abc=$c3+$qtcarne;

$c3=$abc;

if ($c3+$qtcarne > $limite) {

$c3=$limite;

$posicao="topo";

$abc=$limite+1;

$salto=$limite*2;

}

echo "c3: $c3<br>";

break;

}

resultado abaixo: no registro 12 foi para o 16, o certo era ir ate 15, e depois sim, começar em 15 e ir até 30, repetindo o incremtento, alguém pode me ajudar?

1

4

7

10

13

2

5

8

11

14

3

6

9

12

16

18

15

16

18

15

16

18

15

16

18

15

16

18

15

16

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



  • Forum Statistics

    • Total Topics
      150.8k
    • Total Posts
      648.8k
×
×
  • Create New...