[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb:[4603] branches/1.3



Revision: 4603
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4603&view=rev
Author:   einhverfr
Date:     2012-03-28 00:59:15 +0000 (Wed, 28 Mar 2012)
Log Message:
-----------
Beginnings of PDF pricelists

Modified Paths:
--------------
    branches/1.3/LedgerSMB/ScriptLib/Company.pm

Added Paths:
-----------
    branches/1.3/UI/Contact/pricelist.tex
    branches/1.3/UI/lib/dynatable.tex

Modified: branches/1.3/LedgerSMB/ScriptLib/Company.pm
===================================================================
--- branches/1.3/LedgerSMB/ScriptLib/Company.pm	2012-03-27 13:48:09 UTC (rev 4602)
+++ branches/1.3/LedgerSMB/ScriptLib/Company.pm	2012-03-28 00:59:15 UTC (rev 4603)
@@ -1014,7 +1014,7 @@
                 user => $request->{_user},
                 path => 'UI/Contact' ,
                 template => 'pricelist',
-                format => 'HTML',
+                format => uc($request->{format} || 'HTML'),
                 locale => $company->{_locale},
     );
 

Added: branches/1.3/UI/Contact/pricelist.tex
===================================================================
--- branches/1.3/UI/Contact/pricelist.tex	                        (rev 0)
+++ branches/1.3/UI/Contact/pricelist.tex	2012-03-28 00:59:15 UTC (rev 4603)
@@ -0,0 +1,63 @@
+<?lsmb  FILTER latex ?>
+\documentclass[a4paper]{article}
+\usepackage{longtable}
+\usepackage[margin=1cm]{geometry}
+\begin{document}
+<?lsmb- PROCESS 'dynatable.tex' -?>
+<?lsmb-
+    columns = [ 
+              { col_id = 'parts_id',
+                  type = 'hidden' },
+              { col_id = 'int_partnumber'
+                  name = text('Partnumber')
+                  type = 'text'
+                },
+                { col_id = 'description'
+                  name = text('Description')
+                  type = 'text'
+                } ];
+?> <?lsmb-
+     IF account_class == 1;
+         columns.push(
+                  {col_id = 'lastcost'
+                     name = text('Last Cost') 
+                     type = 'text_input'},
+                  {col_id = 'partnumber',
+                     name = text('Vendor Partnumber') 
+                     type = 'text_input'},
+                  {col_id = 'leadtime',
+                     name = text('Lead Time') 
+                     type = 'input_text'}
+         );
+
+     ELSE;
+
+         columns.push(
+                  {col_id = 'sellprice'
+                     name = text('Sell Price') 
+                     type = 'input_text'},
+                  {col_id = 'validfrom',
+                     name = text('Valid From') 
+                     type = 'input_text'},
+                  {col_id = 'validto',
+                     name = text('Valid To') 
+                     type = 'input_text'},
+         );
+                        
+     END;
+-?><?lsmb-
+     columns.push({col_id = 'currency',
+                     name = text('Currency'),
+                     type = 'text'},
+     );
+      PROCESS dynatable
+    attributes = { id = 'pricematrix' }
+         tbody = { rows = pricematrix }
+
+   #IF pricematrix_pricegroup.size() > 0 ;
+   #  PROCESS dynatable
+   #      tbody = { rows = pricematrix_pricegroup };
+   #END;
+-?>
+\end{document}
+<?lsmb  END ?>

Added: branches/1.3/UI/lib/dynatable.tex
===================================================================
--- branches/1.3/UI/lib/dynatable.tex	                        (rev 0)
+++ branches/1.3/UI/lib/dynatable.tex	2012-03-28 00:59:15 UTC (rev 4603)
@@ -0,0 +1,65 @@
+<?lsmb- BLOCK dynatable;
+
+TOTAL_WIDTH=82; # cm. using A4 as a basis because it is slightly narrower than
+                # US Letter. This way the dynatable works for both paper sizes.
+                # This assumes a 1cm margin on either side. --CT
+DECLARED_WIDTH=0; 
+
+FOREACH COL IN columns;
+    DECLARED_WIDTH = DECLARED_WIDTH + COL.pwidth; # pwidth is arbitrary scale
+END; 
+
+IF DECLARED_WIDTH > 0;
+    WIDTH_PER_P = TOTAL_WIDTH / DECLARED_WIDTH;
+ELSE;
+    WIDTH_PER_P = 1;
+END;
+ ?>
+\begin{longtable}{<?lsmb-
+
+FOREACH COL IN columns;
+   IF COL.psep_before;
+      '|';
+   END;
+   IF COL.pwidth;
+       "p{" _ (COL_pwidth * WIDTH_PER_P) _ "cm}";
+   ELSIF COL.palign;
+        COL.palign;
+   ELSE;
+        'r';
+   END;
+   IF COL.psep_after;
+      '|';
+   END;
+END; 
+-?>}
+<?lsmb- IF firsthead; firsthead ?>\\
+\endfirsthead
+<?lsmb- END ?>
+<?lsmb IF head; head ?>\\<?lsmb- END ?>
+<?lsmb- -?>
+<?lsmb 
+SKIP_TYPES = ['hidden', 'radio', 'checkbox'];
+
+FOREACH COL IN columns;
+    IF 0 == SKIP_TYPES.grep(COL.type).size();
+        COL.name _ ' & ';
+    END;
+END;
+-?>\\
+\hline\hline
+\endhead
+<?lsmb
+
+FOREACH ROW IN tbody.rows;
+    FOREACH COL IN columns;
+        COL_ID = COL.col_id;
+        IF 0 == SKIP_TYPES.grep(COL.type).size();
+            ROW.$COL_ID _ ' & '; # $ 
+        END;
+    END; 
+    ?>\\
+<?lsmb
+END; # FOREACH ?>
+\end{longtable}
+<?lsmb END;  # block dynatable -?>

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.