#05AB1E, 35 34 bytes
.γa}2ôε`„PN…- =2ä‡s∍}J©¶ĆìĆ'_®∍DŠ»
Try it online or verify all test cases.
.γ # Consecutive group the (implicit) input by:
a # Check if the character is a letter
}2ô # After the group by: split it into parts of size 2
ε # Map each pair of integer + letter to:
` # Pop and push them separated to the stack
„PN # Push string "PN"
…- = # Push string "- ="
2ä # Split it into 2 parts: ["- ","="]
‡ # Transliterate the "P" to "- " and "N" to "="
s # Swap to take the integer value
∍ # Extend (or shorten) the string to that length
}J # After the map: join all parts together to a single string
© # And store it in variable `®` (without popping)
¶ # Push a newline character "\n"
Ć # Double it "\n\n"
ì # Prepend it in front of the string
Ć # Enclose the string, appending it's own first character
'_ '# Push string "_"
®∍ # Extend it to a size equal to the length of string `®`
D # Duplicate it
Š # Triple swap the three values on the stack from a,b,c to c,a,b
» # Join the values on the stack with newline delimiter
# (after which the result is output implicitly)