Hi,
For this use some approch like Grid for details tables,nd a simple form for the master details,nd use some script to create a dynamic tables like grid and then finally store all master info once and all details once for a table row,its a easiest way to imlement i think.
Better use Javascript for creating Dynamic tables using some button click like "Add new" like.
I hope that will work,I m sorry if i mis guide you.
All the best.