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

SF.net SVN: ledger-smb:[4766] trunk



Revision: 4766
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4766&view=rev
Author:   einhverfr
Date:     2012-05-24 01:05:20 +0000 (Thu, 24 May 2012)
Log Message:
-----------
Batch creation screen ported to new dynatable

Modified Paths:
--------------
    trunk/LedgerSMB/Form.pm
    trunk/LedgerSMB/IS.pm
    trunk/LedgerSMB.pm
    trunk/UI/create_batch.html
    trunk/sql/modules/COGS.sql

Modified: trunk/LedgerSMB/Form.pm
===================================================================
--- trunk/LedgerSMB/Form.pm	2012-05-23 14:35:30 UTC (rev 4765)
+++ trunk/LedgerSMB/Form.pm	2012-05-24 01:05:20 UTC (rev 4766)
@@ -1284,9 +1284,9 @@
         $sth->execute;
         ($self->{pw_expires})  = $sth->fetchrow_array;
     }
-    LedgerSMB::Company_Config::initialize($self);
     $sth->finish();
     $LedgerSMB::App_State::DBH = $self->{dbh};
+    LedgerSMB::Company_Config::initialize($self);
     $logger->trace("end");
 }
 

Modified: trunk/LedgerSMB/IS.pm
===================================================================
--- trunk/LedgerSMB/IS.pm	2012-05-23 14:35:30 UTC (rev 4765)
+++ trunk/LedgerSMB/IS.pm	2012-05-24 01:05:20 UTC (rev 4766)
@@ -1744,7 +1744,7 @@
                 amount     => $cogs * -1,
                 project_id => $project_id,
                 invoice_id => $inv_id
-              };
+              } if $cogs;
 
         push @{ $form->{acc_trans}{lineitems} },
               {
@@ -1752,7 +1752,7 @@
                 amount     => $cogs,
                 project_id => $project_id,
                 invoice_id => $inv_id
-              };
+              } if $cogs;
 
     } else {
         # Getting cogs

Modified: trunk/LedgerSMB.pm
===================================================================
--- trunk/LedgerSMB.pm	2012-05-23 14:35:30 UTC (rev 4765)
+++ trunk/LedgerSMB.pm	2012-05-24 01:05:20 UTC (rev 4766)
@@ -657,6 +657,7 @@
     my $argstr   = "";
     my @results;
     my $dbh = $LedgerSMB::App_State::DBH;
+    die 'Database handle not found!' if !$dbh;
 
     if (!defined $procname){
         $self->error('Undefined function in call_procedure.');

Modified: trunk/UI/create_batch.html
===================================================================
--- trunk/UI/create_batch.html	2012-05-23 14:35:30 UTC (rev 4765)
+++ trunk/UI/create_batch.html	2012-05-24 01:05:20 UTC (rev 4766)
@@ -3,7 +3,9 @@
         stylesheet = stylesheet
         include_stylesheet = [
 		"css/scripts/create_batch.css"
-        ]
+        ];
+       PROCESS elements.html;
+       PROCESS dynatable.html;
 ?>
 <body>
 <div class="listtop"><?lsmb text('Create New Batch') ?></div>
@@ -41,25 +43,23 @@
 <?lsmb END ?>
 </form>
 <div class="listtop"><?lsmb text('Or Add To Batch') ?></div>
-<table>
-<tr class="listheading">
-  <th class="listtop"><?lsmb text('Batch Type') ?></th>
-  <th class="listtop"><a class="listtop" href = "<?lsmb "vouchers.pl?action=create_batch&batch_type=$batch_type&order_by=control_code" ?>"><?lsmb text('Control Number') ?></th>
-  <th class="listtop"><a class="listtop" href = "<?lsmb "vouchers.pl?action=create_batch&batch_type=$batch_type&order_by=description" ?>"><?lsmb text('Description') ?></th>
-  <th class="listtop"><a class="listtop" href = "<?lsmb "vouchers.pl?action=create_batch&batch_type=$batch_type&order_by=created_by" ?>"><?lsmb text('Created By') ?></th>
-  <th class="listtop"><a class="listtop" href = "<?lsmb "vouchers.pl?action=create_batch&batch_type=$batch_type&order_by=created_on" ?>"><?lsmb text('Created On') ?></th>
-  <th class="listtop"><a class="listtop" href = "<?lsmb "vouchers.pl?action=create_batch&batch_type=$batch_type&order_by=default_date" ?>"><?lsmb text('Post Date') ?></th>
-</tr>
-<?lsmb FOR row = search_results ?>
-<tr>
-  <td><?lsmb text(row.batch_class) ?></td>
-  <td><a href="<?lsmb "vouchers.pl?action=add_vouchers&batch_type=$batch_type&id=$row.id" ?>"><?lsmb row.control_code ?></td>
-  <td><?lsmb row.description ?></td>
-  <td><?lsmb row.created_by ?></td>
-  <td><?lsmb row.created_on ?></td>
-  <td><?lsmb row.default_date?></td>
-</tr>
-<?lsmb END ?>
-</table>
+<?lsmb 
+
+FOREACH row IN search_results;
+     row.row_id = row.id;
+END;
+
+PROCESS dynatable 
+               attributes = {id = 'batch_list'}
+               tbody = {rows = search_results}
+               columns = [
+        { col_id='control_code', type='href', name=text('Control Number'), #'
+       href_base="vouchers.pl?action=add_vouchers&batch_type=$batch_type&id=" }
+        { col_id='description', type='text', name = text('Description') }
+        { col_id='created_by', type='text', name = text('Created By') } #'
+        { col_id='created_on', type='text', name = text('Created On') } #'
+         { col_id='default_date', type='text', name = text('Post Date') } #'
+       ];
+?>
 </body>
 </html>

Modified: trunk/sql/modules/COGS.sql
===================================================================
--- trunk/sql/modules/COGS.sql	2012-05-23 14:35:30 UTC (rev 4765)
+++ trunk/sql/modules/COGS.sql	2012-05-24 01:05:20 UTC (rev 4766)
@@ -24,9 +24,9 @@
 FOR t_inv IN
     SELECT i.*
       FROM invoice i
-      JOIN (select id, approved from ap 
+      JOIN (select id, approved, transdate from ap 
             union
-            select id, approved from gl) a ON a.id = i.trans_id
+            select id, approved, transdate from gl) a ON a.id = i.trans_id
      WHERE qty + allocated < 0 and a.approved
   ORDER BY a.transdate DESC, a.id DESC, i.id DESC
 LOOP
@@ -68,9 +68,9 @@
 FOR t_inv IN
     SELECT i.*
       FROM invoice i
-      JOIN (select id, approved from ap
+      JOIN (select id, approved, transdate from ap
              union
-            select id, approved from gl) a ON a.id = i.trans_id
+            select id, approved, transdate from gl) a ON a.id = i.trans_id
      WHERE qty + allocated < 0
   ORDER BY a.transdate, a.id, i.id
 LOOP

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