[%   FILTER latex %]
\documentclass[a4paper]{article}
\usepackage{longtable}
\usepackage[margin=1cm]{geometry}
\begin{document}
[%- PROCESS 'dynatable.tex' -%]
[%-
    columns = [ 
              { col_id = 'parts_id',
                  type = 'hidden' },
              { col_id = 'int_partnumber'
                  name = text('Partnumber')
                  type = 'text'
                pwidth = 1
                },
                { col_id = 'description'
                  name = text('Description')
                  type = 'text'
                pwidth = 4
                } ];
%] [%-
     IF account_class == 1;
         columns.push(
                  {col_id = 'lastcost'
                     name = text('Last Cost') 
                   pwidth = 1
                     type = 'text_input'},
                  {col_id = 'partnumber',
                     name = text('Vendor Partnumber') 
                   pwidth = 1
                     type = 'text_input'},
                  {col_id = 'leadtime',
                     name = text('Lead Time') 
                   pwidth = 1
                     type = 'text_input'}
         );

     ELSE;

         columns.push(
                  {col_id = 'sellprice'
                     name = text('Sell Price') 
                   pwidth = 1
                     type = 'input_text'},
                  {col_id = 'validfrom',
                     name = text('Valid From') 
                   pwidth = 1
                     type = 'input_text'},
                  {col_id = 'validto',
                     name = text('Valid To') 
                   pwidth = 1
                     type = 'input_text'},
                  {col_id = 'qty',
                     name = text('Min Qty') 
                   pwidth = 1
                     type = 'input_text'},
         );
                        
     END;
-%][%-
     columns.push({col_id = 'currency',
                     name = text('Currency'),
                   pwidth = 1
                     type = 'text'},
     );
      PROCESS dynatable
    attributes = { id = 'pricematrix' }
         tbody = { rows = pricematrix }
    firsthead = '\multicolumn{4}{l}{' _ text('Pricelist for [_1]', name)
                  _ '}';

   IF pricematrix_pricegroup.size() > 0 ;
     PROCESS dynatable
         tbody = { rows = pricematrix_pricegroup };
   END;
-%]
\end{document}
[%  END %]
