[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[2605] trunk
- Subject: SF.net SVN: ledger-smb:[2605] trunk
- From: ..hidden..
- Date: Wed, 20 May 2009 19:52:41 +0000
Revision: 2605
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2605&view=rev
Author: einhverfr
Date: 2009-05-20 19:52:41 +0000 (Wed, 20 May 2009)
Log Message:
-----------
Tax form (1099 or equiv) tracking on invoices and line items
Modified Paths:
--------------
trunk/LedgerSMB/AA.pm
trunk/LedgerSMB/Form.pm
trunk/LedgerSMB/IS.pm
trunk/bin/aa.pl
trunk/bin/io.pl
trunk/bin/is.pl
trunk/scripts/menu.pl
Modified: trunk/LedgerSMB/AA.pm
===================================================================
--- trunk/LedgerSMB/AA.pm 2009-05-20 19:00:10 UTC (rev 2604)
+++ trunk/LedgerSMB/AA.pm 2009-05-20 19:52:41 UTC (rev 2605)
@@ -205,6 +205,7 @@
amount => $amount{fxamount}{$i},
project_id => $project_id,
description => $form->{"description_$i"},
+ taxformcheck => $form->{"taxformcheck_$i"},
cleared => $cleared,
fx_transaction => 0
};
@@ -217,6 +218,7 @@
amount => $amount,
project_id => $project_id,
description => $form->{"description_$i"},
+ taxformcheck => $form->{"taxformcheck_$i"},
cleared => $cleared,
fx_transaction => 1
};
@@ -298,7 +300,10 @@
if ( $dbh->selectrow_array($query) ) {
- # delete detail records
+ # delete detail records
+
+ $dbh->do($query) || $form->dberror($query);
+
$query = qq|
DELETE FROM acc_trans
WHERE trans_id = $id|;
@@ -320,10 +325,9 @@
$query = qq|
INSERT INTO $table (invnumber, person_id,
entity_credit_account)
- VALUES (?, (select e.id from person p, entity e, users u
- where u.username = ?
- AND e.id = u.entity_id
- AND p.entity_id = e.id ), ?)|;
+ VALUES (?, (select u.entity_id from users u
+ join entity e on(e.id = u.entity_id)
+ where u.username=? and u.entity_id in(select p.entity_id from person p) ), ?)|;
# the second param is undef, as the DBI api expects a hashref of
# attributes to pass to $dbh->prepare. This is not used here.
@@ -410,6 +414,9 @@
my $ref;
# add individual transactions
+
+ my $taxformfound=AA->taxform_exist($form,$form->{"$form->{vc}_id"});
+
foreach $ref ( @{ $form->{acc_trans}{lineitems} } ) {
# insert detail records in acc_trans
if ( $ref->{amount} ) {
@@ -428,8 +435,20 @@
$ref->{project_id}, $ref->{description},
$ref->{fx_transaction}, $ref->{cleared}
);
- $dbh->prepare($query)->execute(@queryargs)
+ $dbh->prepare($query)->execute(@queryargs)
|| $form->dberror($query);
+
+ $query="select max(entry_id) from acc_trans;";
+ my $sth1=$dbh->prepare($query);
+
+ $sth1->execute();
+
+ my $entry_id=$sth1->fetchrow() || $form->dberror($query);
+
+ my $report=($taxformfound and $ref->{taxformcheck})?"true":"false";
+
+ AA->update_ac_tax_form($form,$dbh,$entry_id,$report);
+
}
}
@@ -661,7 +680,7 @@
id => $form->{id}
);
- $form->audittrail( $dbh, "", \%audittrail );
+ #$form->audittrail( $dbh, "", \%audittrail );
$form->save_recurring( $dbh, $myconfig );
@@ -1139,7 +1158,6 @@
my $sth = $dbh->prepare($query);
$sth->execute(@queryargs) || $form->dberror($query);
-
$ref = $sth->fetchrow_hashref(NAME_lc);
$form->db_parse_numeric(sth => $sth, hashref => $ref);
if ( $form->{id} ) {
@@ -1202,7 +1220,7 @@
WHERE e.curr = o.curr
AND e.transdate = o.transdate)
FROM oe o
- WHERE o.entity_credit_account = ?
+ WHERE o.entity_id = ?
AND o.quotation = '0' AND o.closed = '0'|;
$sth = $dbh->prepare($query);
@@ -1298,9 +1316,10 @@
chop $form->{taxaccounts};
# setup last accounts used for this customer/vendor
- if ( !$form->{id} && $form->{type} !~ /_(order|quotation)/ ) {
- $query = qq|
+ if ( !$form->{id} && $form->{type} !~ /_(order|quotation)/ ) {
+
+ $query = qq|
SELECT c.accno, c.description, c.link,
c.category,
ac.project_id,
@@ -1321,6 +1340,7 @@
my $i = 0;
+
while ( $ref = $sth->fetchrow_hashref(NAME_lc) ) {
$form->{department_id} = $ref->{department_id};
if ( $ref->{link} =~ /_amount/ ) {
@@ -1351,4 +1371,86 @@
$dbh->commit;
}
+sub taxform_exist
+{
+
+ my ( $self,$form,$cv_id) = @_;
+
+ my $query = "select country_taxform_id from entity_credit_account where id=?";
+
+ my $sth = $form->{dbh}->prepare($query);
+
+ $sth->execute($cv_id) || $form->dberror($query);
+
+ my $retval=0;
+
+ while(my $val=$sth->fetchrow())
+ {
+ $retval=1;
+ }
+
+ return $retval;
+
+
+}
+
+sub update_ac_tax_form
+{
+
+ my ( $self,$form,$dbh,$entry_id,$report) = @_;
+
+ my $query=qq|select count(*) from ac_tax_form where entry_id=?|;
+ my $sth=$dbh->prepare($query);
+ $sth->execute($entry_id) || $form->dberror($query);
+
+ my $found=0;
+
+ while(my $ret1=$sth->fetchrow())
+ {
+ $found=1;
+
+ }
+
+ if($found)
+ {
+ my $query = qq|update ac_tax_form set reportable=? where entry_id=?|;
+ my $sth = $dbh->prepare($query);
+ $sth->execute($report,$entry_id) || $form->dberror($query);
+ }
+ else
+ {
+ my $query = qq|insert into ac_tax_form(entry_id,reportable) values(?,?)|;
+ my $sth = $dbh->prepare($query);
+ $sth->execute($entry_id,$report) || $form->dberror("Sada $query");
+ }
+
+ $dbh->commit();
+
+
+}
+
+
+sub get_taxcheck
+{
+
+ my ( $self,$form,$entry_id,$dbh) = @_;
+
+ my $query=qq|select reportable from ac_tax_form where entry_id=?|;
+ my $sth=$dbh->prepare($query);
+ $sth->execute($entry_id) || $form->dberror($query);
+
+ my $found=0;
+
+ while(my $ret1=$sth->fetchrow())
+ {
+
+ if($ret1 eq "t" || $ret1) # this if is not required because when reportable is false, control would not come inside while itself.
+ { $found=1; }
+
+ }
+
+ return($found);
+
+}
+
1;
Modified: trunk/LedgerSMB/Form.pm
===================================================================
--- trunk/LedgerSMB/Form.pm 2009-05-20 19:00:10 UTC (rev 2604)
+++ trunk/LedgerSMB/Form.pm 2009-05-20 19:52:41 UTC (rev 2605)
@@ -2319,7 +2319,7 @@
# get amounts from individual entries
$query = qq|
SELECT c.accno, c.description, a.source, a.amount,
- a.memo, a.transdate, a.cleared, a.project_id,
+ a.memo,a.entry_id, a.transdate, a.cleared, a.project_id,
p.projectnumber
FROM acc_trans a
JOIN chart c ON (c.id = a.chart_id)
Modified: trunk/LedgerSMB/IS.pm
===================================================================
--- trunk/LedgerSMB/IS.pm 2009-05-20 19:00:10 UTC (rev 2604)
+++ trunk/LedgerSMB/IS.pm 2009-05-20 19:52:41 UTC (rev 2605)
@@ -818,6 +818,7 @@
}
sub post_invoice {
+
my ( $self, $myconfig, $form ) = @_;
$form->{invnumber} = $form->update_defaults( $myconfig, "sinumber", $dbh )
unless $form->{invnumber};
@@ -942,6 +943,11 @@
}
}
+
+
+ my $taxformfound=IS->taxform_exist($form,$form->{"customer_id"});
+
+
foreach $i ( 1 .. $form->{rowcount} ) {
my $allocated = 0;
$form->{"qty_$i"} = $form->parse_amount( $myconfig, $form->{"qty_$i"} );
@@ -1143,6 +1149,12 @@
$form->{"notes_$i"},
$invoice_id
) || $form->dberror($query);
+
+ my $report=($taxformfound and $form->{"taxformcheck_$i"})?"true":"false";
+
+ IS->update_invoice_tax_form($form,$dbh,$invoice_id,$report);
+
+
if (defined $form->{approved}) {
$query = qq| UPDATE ar SET approved = ? WHERE id = ?|;
@@ -1974,7 +1986,7 @@
# retrieve individual items
$query = qq|
- SELECT i.description, i.qty, i.fxsellprice,
+ SELECT i.id as invoice_id,i.description, i.qty, i.fxsellprice,
i.sellprice, i.discount, i.parts_id AS id,
i.unit, i.deliverydate, i.project_id,
pr.projectnumber, i.serialnumber, i.notes,
@@ -2045,7 +2057,7 @@
$ref->{partsgroup} = $ref->{partsgrouptranslation}
if $ref->{partsgrouptranslation};
- push @{ $form->{invoice_details} }, $ref;
+ push @{ $form->{invoice_details} }, $ref;
}
$sth->finish;
@@ -2486,5 +2498,88 @@
+sub taxform_exist
+{
+
+ my ( $self,$form,$customer_id) = @_;
+
+ my $query = "select country_taxform_id from entity_credit_account where id=?";
+
+ my $sth = $form->{dbh}->prepare($query);
+
+ $sth->execute($customer_id) || $form->dberror($query);
+
+ my $retval=0;
+
+ while(my $val=$sth->fetchrow())
+ {
+ $retval=1;
+ }
+
+ return $retval;
+
+
+}
+
+
+sub update_invoice_tax_form
+{
+
+ my ( $self,$form,$dbh,$invoice_id,$report) = @_;
+
+ my $query=qq|select count(*) from invoice_tax_form where invoice_id=?|;
+ my $sth=$dbh->prepare($query);
+ $sth->execute($invoice_id) || $form->dberror($query);
+
+ my $found=0;
+
+ while(my $ret1=$sth->fetchrow())
+ {
+ $found=1;
+
+ }
+
+ if($found)
+ {
+ my $query = qq|update invoice_tax_form set reportable=? where invoice_id=?|;
+ my $sth = $dbh->prepare($query);
+ $sth->execute($report,$invoice_id) || $form->dberror($query);
+ }
+ else
+ {
+ my $query = qq|insert into invoice_tax_form(invoice_id,reportable) values(?,?)|;
+ my $sth = $dbh->prepare($query);
+ $sth->execute($invoice_id,$report) || $form->dberror("$query");
+ }
+
+ $dbh->commit();
+
+}
+
+sub get_taxcheck
+{
+
+ my ( $self,$form,$invoice_id,$dbh) = @_;
+
+ my $query=qq|select reportable from invoice_tax_form where invoice_id=?|;
+ my $sth=$dbh->prepare($query);
+ $sth->execute($invoice_id) || $form->dberror($query);
+
+ my $found=0;
+
+ while(my $ret1=$sth->fetchrow())
+ {
+
+ if($ret1 eq "t" || $ret1) # this if is not required because when reportable is false, control would not come inside while itself.
+ { $found=1; }
+
+ }
+
+ return($found);
+
+}
+
+
+
1;
Modified: trunk/bin/aa.pl
===================================================================
--- trunk/bin/aa.pl 2009-05-20 19:00:10 UTC (rev 2604)
+++ trunk/bin/aa.pl 2009-05-20 19:52:41 UTC (rev 2605)
@@ -92,6 +92,7 @@
sub add {
$form->{title} = "Add";
+
$form->{callback} =
"$form->{script}?action=add&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}"
unless $form->{callback};
@@ -137,15 +138,17 @@
}
sub display_form {
+
&form_header;
&form_footer;
}
sub create_links {
+
if ( $form->{script} eq 'ap.pl' ) {
$form->{ARAP} = 'AP';
- $form->{vc} = 'vendor';
+ $form->{vc} = 'vendor';
}
elsif ( $form->{script} eq 'ar.pl' ) {
$form->{ARAP} = 'AR';
@@ -256,6 +259,7 @@
foreach $key ( keys %{ $form->{"$form->{ARAP}_links"} } ) {
+
$form->{"select$key"} = "";
foreach $ref ( @{ $form->{"$form->{ARAP}_links"}{$key} } ) {
$form->{"select$key"} .=
@@ -264,7 +268,10 @@
# if there is a value we have an old entry
for $i ( 1 .. scalar @{ $form->{acc_trans}{$key} } ) {
+
+
if ( $key eq "$form->{ARAP}_paid" ) {
+
$form->{"$form->{ARAP}_paid_$i"} =
"$form->{acc_trans}{$key}->[$i-1]->{accno}--$form->{acc_trans}{$key}->[$i-1]->{description}";
$form->{"paid_$i"} =
@@ -300,13 +307,22 @@
}
else {
+
+
+
$form->{"${akey}_$i"} =
$form->{acc_trans}{$key}->[ $i - 1 ]->{amount} * $ml;
if ( $akey eq 'amount' ) {
$form->{"description_$i"} =
$form->{acc_trans}{$key}->[ $i - 1 ]->{memo};
- $form->{rowcount}++;
+
+ $form->{"entry_id_$i"} =
+ $form->{acc_trans}{$key}->[ $i - 1 ]->{entry_id};
+
+ $form->{"taxformcheck_$i"}=1 if(AA->get_taxcheck($form,$form->{"entry_id_$i"},$form->{dbh}));
+
+ $form->{rowcount}++;
$netamount += $form->{"${akey}_$i"};
$form->{"projectnumber_$i"} =
@@ -320,6 +336,9 @@
}
$form->{"${key}_$i"} =
"$form->{acc_trans}{$key}->[$i-1]->{accno}--$form->{acc_trans}{$key}->[$i-1]->{description}";
+
+
+
}
}
}
@@ -537,9 +556,10 @@
$form->header;
- print qq|
+ print qq|
<body onload="document.forms[0].${focus}.focus()" />
+
<form method=post action=$form->{script}>
<input type=hidden name=type value="$form->{formname}">
<input type=hidden name=title value="$title">
@@ -689,6 +709,7 @@
<th></th>
<th>| . $locale->text('Account') . qq|</th>
<th>| . $locale->text('Description') . qq|</th>
+ <th>| . $locale->text('Tax Form Applied') . qq|</th>
$project
</tr>
|;
@@ -705,7 +726,7 @@
# format amounts
$form->{"amount_$i"} =
- $form->format_amount( \%myconfig, $form->{"amount_$i"}, 2 );
+ $form->format_amount( \%myconfig,$form->{"amount_$i"}, 2 );
$project = qq|
<td align=right><select name="projectnumber_$i">$selectprojectnumber</select></td>
@@ -722,15 +743,27 @@
qq|<td><input name="description_$i" size=40 value="$form->{"description_$i"}"></td>|;
}
+ $taxchecked="";
+ if($form->{"taxformcheck_$i"})
+ {
+ $taxchecked="checked";
+
+ }
+
+ $taxformcheck=qq|<td><input type="checkbox" name="taxformcheck_$i" value="1" $taxchecked></td>|;
print qq|
<tr valign=top>
<td><input name="amount_$i" size=10 value="$form->{"amount_$i"}" accesskey="$i"></td>
<td></td>
<td><select name="$form->{ARAP}_amount_$i">$selectamount</select></td>
$description
+ $taxformcheck
$project
</tr>
|;
+
+ $form->hide_form( "entry_id_$i"); #New block of code to pass entry_id
+
}
foreach $item ( split / /, $form->{taxaccounts} ) {
@@ -923,6 +956,9 @@
{ ndx => 7, key => 'H', value => $locale->text('Schedule') },
'delete' =>
{ ndx => 8, key => 'D', value => $locale->text('Delete') },
+
+ 'save_info' =>
+ { ndx => 9, key => 'I', value => $locale->text('Save Info') },
);
if (!$form->{approved} && !$form->{batch_id}){
$button{approve} = {
@@ -962,13 +998,13 @@
}
else {
- for ( "post_as_new", "print_and_post_as_new", "delete" ) {
+ for ( "post_as_new", "print_and_post_as_new", "delete","save_info" ) {
delete $button{$_};
}
delete $button{"print_and_post"} if !${LedgerSMB::Sysconfig::latex};
if ( $transdate && ($transdate <= $closedto) ) {
- for ( "post", "print_and_post" ) { delete $button{$_} }
+ for ( "post", "print_and_post","save_info" ) { delete $button{$_} }
}
}
@@ -1013,6 +1049,7 @@
my $draft = LedgerSMB::DBObject::Draft->new({base => $lsmb});
$draft->approve();
+
if ($form->{callback}){
print "Location: $form->{callback}\n";
print "Status: 302 Found\n\n";
@@ -1037,7 +1074,7 @@
$form->parse_amount( \%myconfig, $form->{exchangerate} );
@flds =
- ( "amount", "$form->{ARAP}_amount", "projectnumber", "description" );
+ ( "amount", "$form->{ARAP}_amount", "projectnumber", "description","taxformcheck" );
$count = 0;
@a = ();
for $i ( 1 .. $form->{rowcount} ) {
@@ -1210,17 +1247,23 @@
if ( AA->post_transaction( \%myconfig, \%$form ) ) {
- $form->update_status( \%myconfig );
- if ( $form->{printandpost} ) {
- &{"print_$form->{formname}"}( $old_form, 1 );
+
+ $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}|;
}
+
+ if(defined($form->{batch_id}) and $form->{batch_id})
+ {
+ $form->{callback}.= qq|&batch_id=$form->{batch_id}|;
+ }
+
$form->redirect( $locale->text('Transaction posted!') );
}
else {
@@ -1229,6 +1272,53 @@
}
+# New Function Body starts Here
+
+
+
+sub save_info {
+
+
+ my $taxformfound=0;
+
+ $taxformfound=AA->taxform_exist($form,$form->{"$form->{vc}_id"});
+
+ foreach my $i(1..($form->{rowcount}))
+ {
+
+ if($form->{"taxformcheck_$i"} and $taxformfound)
+ {
+
+ AA->update_ac_tax_form($form,$form->{dbh},$form->{"entry_id_$i"},"true") if($form->{"entry_id_$i"});
+
+ }
+ else
+ {
+
+ AA->update_ac_tax_form($form,$form->{dbh},$form->{"entry_id_$i"},"false") if($form->{"entry_id_$i"});
+
+ }
+
+ }
+
+ if ($form->{callback}){
+ print "Location: $form->{callback}\n";
+ print "Status: 302 Found\n\n";
+ print "<html><body>";
+ my $url = $form->{callback};
+ print qq|If you are not redirected automatically, click <a href="$url">|
+ . qq|here</a>.</body></html>|;
+
+ } else {
+ $form->info($locale->text('Draft Posted'));
+ }
+
+}
+
+
+#New function starts Here
+
+
sub delete {
$form->{title} = $locale->text('Confirm!');
@@ -1953,6 +2043,7 @@
# sums and tax on reports by Antonio Gallardo
#
$i = 0;
+
foreach $ref ( @{ $form->{transactions} } ) {
$i++;
@@ -2135,7 +2226,7 @@
. "</th>";
}
- for (@column_index) { print "\n$column_data{$_}" }
+ for (@column_index) { print STDERR qq|______ $_ => $column_data{$_} ______________|; print "\n$column_data{$_}" }
if ( $myconfig{acs} !~ /$form->{ARAP}--$form->{ARAP}/ ) {
$i = 1;
@@ -2190,6 +2281,7 @@
if ( !$form->{till} ) {
foreach $item ( sort { $a->{order} <=> $b->{order} } %button ) {
+
print $item->{code};
}
}
Modified: trunk/bin/io.pl
===================================================================
--- trunk/bin/io.pl 2009-05-20 19:00:10 UTC (rev 2604)
+++ trunk/bin/io.pl 2009-05-20 19:52:41 UTC (rev 2605)
@@ -167,6 +167,9 @@
push @column_index, @{LedgerSMB::Sysconfig::io_lineitem_columns};
+ push @column_index, "taxformcheck";#increase the number of elements by pushing into column_index.(Ex: NEw added element
+ # taxformcheck & check the screen AR->Sales Invoice) do everything before colspan ;
+
my $colspan = $#column_index + 1;
$form->{invsubtotal} = 0;
@@ -193,7 +196,8 @@
qq|<th class=listheading nowrap>| . $locale->text('Bin') . qq|</th>|;
$column_data{onhand} =
qq|<th class=listheading nowrap>| . $locale->text('OH') . qq|</th>|;
-
+ $column_data{taxformcheck} =
+ qq|<th class=listheading nowrap>| . $locale->text('TaxForm') . qq|</th>|;
print qq|
<tr>
<td>
@@ -302,13 +306,26 @@
}
}
+
+
+
+
$delivery = qq|
<td colspan=2 nowrap>
<b>${$delvar}</b>
<input name="${delvar}_$i" size=11 title="$myconfig{dateformat}" value="$form->{"${delvar}_$i"}"></td>
|;
- $column_data{runningnumber} =
+
+ $taxchecked="";
+ if($form->{"taxformcheck_$i"})
+ {
+ $taxchecked="checked";
+
+ }
+
+
+$column_data{runningnumber} =
qq|<td><input name="runningnumber_$i" size=3 value=$i></td>|;
$column_data{partnumber} =
qq|<td><input name="partnumber_$i" size=15 value="$form->{"partnumber_$i"}" accesskey="$i" title="[Alt-$i]">$skunumber</td>|;
@@ -337,7 +354,7 @@
. qq|</td>|;
$column_data{bin} = qq|<td>$form->{"bin_$i"}</td>|;
$column_data{onhand} = qq|<td>$form->{"onhand_$i"}</td>|;
-
+ $column_data{taxformcheck} = qq|<td><input type="checkbox" name="taxformcheck_$i" value="1" $taxchecked></td>|;
print qq|
<tr valign=top>|;
@@ -351,7 +368,7 @@
|;
for (
- qw(orderitems_id id bin weight listprice lastcost taxaccounts pricematrix sku onhand assembly inventory_accno_id income_accno_id expense_accno_id)
+ qw(orderitems_id id bin weight listprice lastcost taxaccounts pricematrix sku onhand assembly inventory_accno_id income_accno_id expense_accno_id invoice_id)
)
{
$form->hide_form("${_}_$i");
@@ -366,16 +383,16 @@
<select name="projectnumber_$i">$form->{selectprojectnumber}</select>
| if $form->{selectprojectnumber};
- if ( ( $rows = $form->numtextrows( $form->{"notes_$i"}, 46, 6 ) ) > 1 )
+ if ( ( $rows = $form->numtextrows( $form->{"notes_$i"}, 36, 6 ) ) > 1 )
{
$form->{"notes_$i"} = $form->quote( $form->{"notes_$i"} );
$notes =
-qq|<td><textarea name="notes_$i" rows=$rows cols=46 wrap=soft>$form->{"notes_$i"}</textarea></td>|;
+qq|<td><textarea name="notes_$i" rows=$rows cols=36 wrap=soft>$form->{"notes_$i"}</textarea></td>|;
}
else {
$form->{"notes_$i"} = $form->quote( $form->{"notes_$i"} );
$notes =
-qq|<td><input name="notes_$i" size=48 value="$form->{"notes_$i"}"></td>|;
+qq|<td><input name="notes_$i" size=38 value="$form->{"notes_$i"}"></td>|;
}
$serial = qq|
Modified: trunk/bin/is.pl
===================================================================
--- trunk/bin/is.pl 2009-05-20 19:00:10 UTC (rev 2604)
+++ trunk/bin/is.pl 2009-05-20 19:52:41 UTC (rev 2605)
@@ -293,8 +293,11 @@
$form->{"qty_$i"} =
$form->format_amount( \%myconfig, $form->{"qty_$i"} );
$form->{"oldqty_$i"} = $form->{"qty_$i"};
+
+ $form->{"taxformcheck_$i"}=1 if(IS->get_taxcheck($form,$form->{"invoice_id_$i"},$form->{dbh}));
- for (qw(partnumber sku description unit)) {
+
+ for (qw(partnumber sku description unit)) {
$form->{"${_}_$i"} = $form->quote( $form->{"${_}_$i"} );
}
$form->{rowcount} = $i;
@@ -783,8 +786,14 @@
{ ndx => 12, key => 'O', value => $locale->text('On Hold') },
'void' =>
{ ndx => 12, key => 'V', value => $locale->text('Void') },
+ 'save_info' =>
+ { ndx => 13, key => 'I', value => $locale->text('Save Info') },
+
);
+
+
+
if ( $form->{id} ) {
if ( $form->{locked} || $transdate <= $closedto ) {
@@ -1215,3 +1224,50 @@
&edit(); # it was already IN edit for this to be reached.
}
}
+
+
+
+sub save_info {
+
+
+ my $taxformfound=0;
+
+ $taxformfound=IS->taxform_exist($form,$form->{"customer_id"});
+
+ print STDERR qq|___Rowcount=$form->{rowcount} _______|;
+
+ foreach my $i(1..($form->{rowcount}))
+ {
+ print STDERR qq| taxformcheck_$i = $form->{"taxformcheck_$i"} and taxformfound= $taxformfound ___________|;
+
+ if($form->{"taxformcheck_$i"} and $taxformfound)
+ {
+
+ IS->update_invoice_tax_form($form,$form->{dbh},$form->{"invoice_id_$i"},"true") if($form->{"invoice_id_$i"});
+
+ }
+ else
+ {
+
+ IS->update_invoice_tax_form($form,$form->{dbh},$form->{"invoice_id_$i"},"false") if($form->{"invoice_id_$i"});
+
+ }
+
+ }
+
+ if ($form->{callback}){
+ print "Location: $form->{callback}\n";
+ print "Status: 302 Found\n\n";
+ print "<html><body>";
+ my $url = $form->{callback};
+ print qq|If you are not redirected automatically, click <a href="$url">|
+ . qq|here</a>.</body></html>|;
+
+ } else {
+ $form->info($locale->text('Draft Posted'));
+ }
+
+}
+
+
+
Modified: trunk/scripts/menu.pl
===================================================================
--- trunk/scripts/menu.pl 2009-05-20 19:00:10 UTC (rev 2604)
+++ trunk/scripts/menu.pl 2009-05-20 19:52:41 UTC (rev 2605)
@@ -79,8 +79,6 @@
if ($userpw->will_expire_soon){
$request->{main} = 'user.pl?action=preference_screen';
} else {
- $request->{main} = "splash.html"
- if !$request->{main};
$request->{main} = "am.pl?action=recurring_transactions"
if $request->{main} eq 'recurring_transactions';
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.