From d6f5e7b43d9d0adba0f6161dbdd7f07985b25bd4 Mon Sep 17 00:00:00 2001 From: aurynn_cmd Date: Tue, 1 Jul 2008 20:30:05 +0000 Subject: Bulk updarte for the entirety of Reconciliation code to date. All code, SQL, and templates as provided. git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@2180 4979c152-3d1c-0410-bac9-87ea11338e46 --- LedgerSMB/Reconciliation/CSV.pm | 69 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 LedgerSMB/Reconciliation/CSV.pm (limited to 'LedgerSMB/Reconciliation') diff --git a/LedgerSMB/Reconciliation/CSV.pm b/LedgerSMB/Reconciliation/CSV.pm new file mode 100644 index 00000000..f95bf194 --- /dev/null +++ b/LedgerSMB/Reconciliation/CSV.pm @@ -0,0 +1,69 @@ +# CSV parser is basically a framework to handle any CSV files or fixed-width format files. +# Parsers are defined in CSV/parser_type. + +package LedgerSMB::Reconciliation::CSV; + +use base qw/LedgerSMB/; +use Datetime; + +sub load_file { + + my $self = shift @_; + my $filename = shift @_; + my $contents; + do { + + local $/; # I think this is the right way to outrageously cheat + open(FH,$filename); + $contents = ; + } + return $contents; +} + +sub process { + + # thoroughly implementation-dependent. + my $self = shift @_; + my $contents = $self->load_file($self->{csv_filename}); + + foreach my $line (split /\n/,$contents) { + # Unpack for the format it is inexplicably in + ($accno, + $checkno, + $issuedate + $amount + $cleared, + $last_three) = unpack("A10A10A6A10A6A3",$line); + + push @{ $self->{entries} }, { + account_num => $accno, + scn => $checkno, + issue_date => $issuedate, + amount => $amount, + cleared_date => $cleared + }; + } + # Okay, now how do I test to see if this is actually, y'know, bad data. + + for my $line (@{ $self->{entries} }) { + + # First check the account number. + # According to the docs I have, it's all numbers. + + + } + + return; +} + +sub is_error { + + +} + +sub error { + + +} + +1; \ No newline at end of file -- cgit v1.2.3