title: Organize data from table based in columns
body: <p>I have one table like this and i need to split it to analise the data better </p>
  
  <pre><code>ID | doc | name    | price | pay 
  1  | doc1| PERSON1 | 1     | 1
  2  | doc2| PERSON1 | 10    | 0
  3  | doc3| PERSON2 | 12    | 1
  4  | doc4| PERSON2 | 1     | 0
  5  | doc5| PERSON2 | 15    | 0
  6  | doc6| PERSON3 | 2     | 1
  7  | doc7| PERSON3 | 23    | 0
  8  | doc8| PERSON3 | 3     | 0
  9  | doc9| PERSON4 | 8     | 0
  </code></pre>
  
  <p>and i need an output like this and i don't know how to do it! </p>
  
  <pre><code> name         | price | pay 
   PERSON1      |       | 
   Doc1         | 1     | 1
   Doc2         | 10    | 0
   Total payed  | 1     |
   Total per pay| 10    | 
   Total        | 11    |
   PERSON2      |       | 
   Doc3         | 12    | 1
   Doc4         | 1     | 0
   Doc5         | 15    | 0
   Total payed  | 12    | 
   Total per pay| 16    | 
   Total        | 28    |
   PERSON3      |       | 
   Doc6         | 2     | 1
   Doc7         | 23    | 0
   Doc8         | 3     | 0
   Total payed  | 2     | 
   Total per pay| 26    | 
   Total        | 28    |
   PERSON4      |       | 
   Doc9         | 8     | 0
   Total payed  | 0     | 
   Total per pay| 8     | 
   Total        | 8     |
   Payed        | 15    |
   PER PAY      | 60    |
   Total SUM    | 75    |
  </code></pre>
  
  <p>Is this possible to do?</p>