Our invoices prohibit modification (both to Invoices and LineIteims) if their status is "printed" for all but "full access" users. This is done through manage | Security where you can set up privilege sets that use a calculation to limit access to records in a table on a record by record basis.
See "Editing record access privileges" in FileMaker Help and check out this particular sub section: "Entering a formula for limiting access on a record-by-record basis" for a detailed description of how to set this up.
I'm not sure what you are trying to do with your category 1 and caategory 2 totals. Are these totals for the current invoice? Are they to be displayed on every line of the Line Items portal or do you want just two totals, placed outside the portal giving the invoice totals for each category?
Say you want a total of all taxable and non tax amounts as your "category 1" and "Category 2" totals.
Define two calculation fields in line items:
cCategory1amount: If ( Category = "taxable" ; Extended total )
cCategory2amount: If ( category = "Non Tax" ; Extended total )
Define two summary fields in line items: Cat1Total: as a total of cCategory1amount and Cat2Total as a total of cCategory2amount
Now place these two fields on your invoices layout, outside of your portal and you'll see a portal total for each category.
Please note that if you want to see such totals only on the printed invoice, you do not need such a complicated method. A single category field and a single summary field (Plus a sub summary part and some sorting of line item records), is all you need to achieve that result on the starter solution's print layout.