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

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



Revision: 2569
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2569&view=rev
Author:   einhverfr
Date:     2009-04-20 04:41:06 +0000 (Mon, 20 Apr 2009)

Log Message:
-----------
Batch numbers now visible on Ar/Ap screens

Modified Paths:
--------------
    trunk/LedgerSMB/Form.pm
    trunk/bin/aa.pl

Modified: trunk/LedgerSMB/Form.pm
===================================================================
--- trunk/LedgerSMB/Form.pm	2009-04-18 17:53:48 UTC (rev 2568)
+++ trunk/LedgerSMB/Form.pm	2009-04-20 04:41:06 UTC (rev 2569)
@@ -1675,8 +1675,11 @@
     if ($self->{"${table}number"} eq ''){
         $self->{"${table}number"} = $self->{$table};
     }
+
     my $name = $self->like( lc $self->{$table} );
-    
+
+    $self->{"${table}number"}=$self->like(lc $self->{"${table}number"});#added % and % for searching key vendor/customer number.
+
     # Vendor and Customer are now views into entity_credit_account.
     my $query = qq/
 		SELECT c.*, e.name, e.control_code FROM entity_credit_account c
@@ -3587,8 +3590,80 @@
     $rv;
 }
 
+
+
+
+#dummy function used to see all the keys of form 
+
+sub testdisplayform
+{
+
+    my $self=shift;
+
+    foreach(keys(%$self))
+    {
+
+	 print STDERR "testdisplay $_  => $self->{$_}\n" if ($_ eq "customer_id");
+
+    }
+
+
+
+}
+
+# New block of code to get control code from batch table
+
+
+sub get_batch_control_code {
+
+    my ( $self, $dbh, $batch_id) = @_;
+
+    my ($query,$sth,$control);
+       
+
+    if ( !$dbh ) {
+        $dbh = $self->{dbh};
+    }
+
+    $query=qq|select control_code from batch where id=?|;
+    $sth=$dbh->prepare($query) || $self->dberror($query);
+    $sth->execute($batch_id) || $self->dberror($query);
+    $control=$sth->fetchrow();
+    $sth->finish();
+    return $control;   
+
+}
+
+
+#end get control code from batch table
+
+
+#start description
+
+sub get_batch_description {
+
+    my ( $self, $dbh, $batch_id) = @_;
+
+    my ($query,$sth,$desc);
+       
+
+    if ( !$dbh ) {
+        $dbh = $self->{dbh};
+    }
+
+    $query=qq|select description from batch where id=?|;
+    $sth=$dbh->prepare($query) || $self->dberror($query);
+    $sth->execute($batch_id) || $self->dberror($query);
+    $desc=$sth->fetchrow();
+    $sth->finish();
+    return $desc;   
+
+}
+
+#end decrysiption
+
 1;
 
+
 =back
 
-

Modified: trunk/bin/aa.pl
===================================================================
--- trunk/bin/aa.pl	2009-04-18 17:53:48 UTC (rev 2568)
+++ trunk/bin/aa.pl	2009-04-20 04:41:06 UTC (rev 2569)
@@ -396,6 +396,13 @@
 sub form_header {
 
     $title = $form->{title};
+
+    if($form->{batch_id})
+    {
+		$form->{batch_control_code}=$form->get_batch_control_code($form->{dbh},$form->{batch_id});
+		$form->{batch_description}=$form->get_batch_description($form->{dbh},$form->{batch_id});
+    }
+	
     if ($form->{reverse} == 0){
        $form->{title} = $locale->text("$title $form->{ARAP} Transaction");
     }
@@ -597,11 +604,30 @@
 		</td>
 	      </tr>
 |;
+		if($form->{batch_id})
+		{
+		print qq|	<tr>
+		<th align="right" nowrap>| . 
+			$locale->text('Batch Control Code') . qq|</th>
+		<td>$form->{batch_control_code}</td>
+	      </tr>
+		<tr>
+		<th align="right" nowrap>| . 
+			$locale->text('Batch Name') . qq|</th>
+		<td>$form->{batch_description}</td>
+	      </tr>
+
+|;
+
+		}
+
+
+
 		if ($form->{entity_control_code}){
 			print qq|
 	        <tr>
 		<th align="right" nowrap>| . 
-			$locale->text('Control Code') . qq|</th>
+			$locale->text('Entity Control Code') . qq|</th>
 		<td colspan=3>$form->{entity_control_code}</td>
 	      </tr>
 	        <tr>
@@ -1181,12 +1207,20 @@
         }
     }
 
+    
+    
     if ( AA->post_transaction( \%myconfig, \%$form ) ) {
         $form->update_status( \%myconfig );
         if ( $form->{printandpost} ) {
             &{"print_$form->{formname}"}( $old_form, 1 );
         }
 	print STDERR "Redirecting\n";
+
+        if(defined($form->{batch_id}) and $form->{batch_id})
+	{
+        	$form->{callback}.= qq|&batch_id=$form->{batch_id}|;
+	}
+
         $form->redirect( $locale->text('Transaction posted!') );
     }
     else {


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