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

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



Revision: 6121
          http://sourceforge.net/p/ledger-smb/code/6121
Author:   einhverfr
Date:     2013-10-09 07:17:21 +0000 (Wed, 09 Oct 2013)
Log Message:
-----------
Single day entry for timecards now recognizes business units

Modified Paths:
--------------
    trunk/LedgerSMB/Scripts/timecard.pm
    trunk/UI/timecards/timecard.html

Modified: trunk/LedgerSMB/Scripts/timecard.pm
===================================================================
--- trunk/LedgerSMB/Scripts/timecard.pm	2013-10-09 06:29:23 UTC (rev 6120)
+++ trunk/LedgerSMB/Scripts/timecard.pm	2013-10-09 07:17:21 UTC (rev 6121)
@@ -21,6 +21,7 @@
 use LedgerSMB::Report::Timecards;
 use LedgerSMB::Company_Config;
 use LedgerSMB::Business_Unit_Class;
+use LedgerSMB::Business_Unit;
 use DateTime;
 
 =head1 ROUTINES
@@ -74,18 +75,44 @@
         $request->{in_hour} = $now->hour unless defined $request->{in_hour};
         $request->{in_min} = $now->minute unless defined $request->{in_min};
     }
+    @{$request->{b_units}} = LedgerSMB::Business_Unit->list(
+          $request->{bu_class_id}, undef, 0, $request->{transdate}
+    );
     $request->{total} = $request->{qty} + $request->{non_billable};
-    my $template = LedgerSMB::Template->new(
-        user     => $request->{_user},
-        locale   => $request->{_locale},
-        path     => 'UI/timecards',
-        template => 'timecard',
-        format   => 'HTML'
-    );
-    $template->render($request);
+     my $template = LedgerSMB::Template->new(
+         user     => $request->{_user},
+         locale   => $request->{_locale},
+         path     => 'UI/timecards',
+         template => 'timecard',
+         format   => 'HTML'
+     );
+     $template->render($request);
 
 }
 
+=item timecard_screen
+
+This displays a screen for entry of timecards, either single day or week.
+
+=cut
+
+sub timecard_screen {
+    my ($request) = @_;
+    if (1 == $request->{num_days}){
+        $request->{transdate} = $request->{date_from};
+        return display($request);
+    } else {
+         my $template = LedgerSMB::Template->new(
+             user     => $request->{_user},
+             locale   => $request->{_locale},
+             path     => 'UI/timecards',
+             template => 'timecard-week',
+             format   => 'HTML'
+         );
+         $template->render($request);
+    }
+}
+
 =item save
 
 =cut

Modified: trunk/UI/timecards/timecard.html
===================================================================
--- trunk/UI/timecards/timecard.html	2013-10-09 06:29:23 UTC (rev 6120)
+++ trunk/UI/timecards/timecard.html	2013-10-09 07:17:21 UTC (rev 6121)
@@ -10,7 +10,19 @@
 <tr><th colspan="2" class="listtop"><?lsmb text('Category') ?> : 
     </th>
 </tr>
-<?lsmb # PROCESS business_units; ?>
+<tr id="business_unit">
+  <th><?lsmb text('Entered For') ?></th>
+  <td><?lsmb
+        FOREACH bu IN b_units;
+            bu.text = bu.control_code _ ' -- ' _ bu.description;
+        END;
+        PROCESS select element_data = {
+                       name = "business_unit_id"
+             default_values = [business_unit_id]
+                    options = b_units
+                  text_attr = 'text'
+                 value_attr = 'id'
+       } ?></td>
 <tr><th><?lsmb  text('Partnumber') ?></th>
     <td><?lsmb PROCESS input element_data = {
                name = 'partnumber'
@@ -112,7 +124,7 @@
    type = 'submit'
   class = 'submit'
    text = text('Update')
-  value = 'update' 
+  value = 'update_day' 
 } ?>
 <?lsmb PROCESS button element_data = {
    name = 'action'

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


------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk
_______________________________________________
Ledger-smb-commits mailing list
..hidden..
https://lists.sourceforge.net/lists/listinfo/ledger-smb-commits