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

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



Revision: 6556
          http://sourceforge.net/p/ledger-smb/code/6556
Author:   einhverfr
Date:     2014-01-20 07:24:18 +0000 (Mon, 20 Jan 2014)
Log Message:
-----------
Initial commit of weekly timecard save

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

Modified: trunk/LedgerSMB/Scripts/timecard.pm
===================================================================
--- trunk/LedgerSMB/Scripts/timecard.pm	2014-01-20 06:53:22 UTC (rev 6555)
+++ trunk/LedgerSMB/Scripts/timecard.pm	2014-01-20 07:24:18 UTC (rev 6556)
@@ -137,7 +137,7 @@
            $request->{partnumber}
     );
     $request->{jctype} ||= 1;
-    $request->{total} = $request->{qty} + $request{non_chargeable};
+    $request->{total} = $request->{qty} + $request->{non_chargeable};
     my $timecard = LedgerSMB::Timecard->new(%$request);
     $timecard->save;
     $request->{id} = $timecard->id;
@@ -145,6 +145,35 @@
     display($request);
 }
 
+=item save_week
+
+Saves a week of timecards.
+
+=cut
+
+sub save_week {
+    my $request = shift @_;
+    for my $row(1 .. $request->{rowcount}){
+        for my $dow (0 .. 6){
+            my $date = $request->{"transdate_$dow"};
+            my $hash = { transdate => LedgerSMB::PGDate->from_input($date) };
+            $date =~ s|[.-/]|_|g;
+            next unless $request->{"partnumber_${date}_${row}"};
+            $hash->{$_} = $request->{"${_}_${date}_${row}"} 
+                 for (qw(business_unit_id partnumber description qty
+                                 non_chargeable));
+            $hash->{parts_id} =  LedgerSMB::Timecard->get_part_id(
+                     $hash->{partnumber}
+            );
+            $hash->{jctype} ||= 1;
+            $hash->{total} = $hash->{qty} + $hash->{non_chargeable};
+            my $timecard = LedgerSMB::Timecard->new(%$hash);
+            $timecard->save;
+        }
+    }
+    new($request);
+}
+
 =item print
 
 =cut

Modified: trunk/UI/timecards/timecard-week.html
===================================================================
--- trunk/UI/timecards/timecard-week.html	2014-01-20 06:53:22 UTC (rev 6555)
+++ trunk/UI/timecards/timecard-week.html	2014-01-20 07:24:18 UTC (rev 6556)
@@ -101,8 +101,8 @@
        size = 5 } ?></div>
   <div><?lsmb text('Extra Used') ?></div>
     <div><?lsmb PROCESS input element_data = {
-       name = "non_billable_$suffix"
-      value = ${"non_billable_$suffix"}
+       name = "non_chargeable_$suffix"
+      value = ${"non_chargeable_$suffix"}
        type = text
       class = 'qty'
        size = 5 } ?></div>

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


------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
Ledger-smb-commits mailing list
..hidden..
https://lists.sourceforge.net/lists/listinfo/ledger-smb-commits