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

SF.net SVN: ledger-smb:[4601] trunk/LedgerSMB/Scripts/import_csv.pm



Revision: 4601
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4601&view=rev
Author:   einhverfr
Date:     2012-03-27 05:03:11 +0000 (Tue, 27 Mar 2012)
Log Message:
-----------
Beginnings of timecard csv import

Modified Paths:
--------------
    trunk/LedgerSMB/Scripts/import_csv.pm

Modified: trunk/LedgerSMB/Scripts/import_csv.pm
===================================================================
--- trunk/LedgerSMB/Scripts/import_csv.pm	2012-03-27 04:26:45 UTC (rev 4600)
+++ trunk/LedgerSMB/Scripts/import_csv.pm	2012-03-27 05:03:11 UTC (rev 4601)
@@ -22,6 +22,9 @@
    gl       =>  ['accno', 'debit', 'credit', 'source', 'memo'],
    ap_multi =>  ['vendor', 'amount', 'account', 'ap', 'description', 
                  'invnumber', 'transdate'],
+   timecard =>  ['employee', 'projectnumber', 'transdate', 'partnumber',
+                 'description', 'qty', 'noncharge', 'sellprice', 'allocated',
+                'notes'],
 };
 our $preprocess = {};
 our $postprocess = {};
@@ -176,6 +179,20 @@
                }
                $dbh->commit;
              },
+ timecard => sub {
+               use LedgerSMB::JC;
+               my ($request, $entries) = @_;
+               my $myconfig = {};
+               for my $entry (@$entries) {
+                   my $jc = {dbh => $request->{dbh}};
+                   my $counter = 0;
+                   for my $col (@{$cols->{timecard}}){
+                       $jc->{$col} = $entry->[$counter];
+                       ++$counter;
+                   }
+                   LedgerSMB::JC->save($myconfig, $jc);
+               }
+             },
 };
 
 sub parse_file {

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