summaryrefslogtreecommitdiff
path: root/LedgerSMB/Reconciliation
diff options
context:
space:
mode:
authoraurynn_cmd <aurynn_cmd@4979c152-3d1c-0410-bac9-87ea11338e46>2008-07-01 20:30:05 +0000
committeraurynn_cmd <aurynn_cmd@4979c152-3d1c-0410-bac9-87ea11338e46>2008-07-01 20:30:05 +0000
commitd6f5e7b43d9d0adba0f6161dbdd7f07985b25bd4 (patch)
tree771d303d20f2d2abc53de9f59d8ad191cd9f5d6d /LedgerSMB/Reconciliation
parent411e61879b0efad2c5bfdcd209b46e01a33e0f35 (diff)
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
Diffstat (limited to 'LedgerSMB/Reconciliation')
-rw-r--r--LedgerSMB/Reconciliation/CSV.pm69
1 files changed, 69 insertions, 0 deletions
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 = <FH>;
+ }
+ 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