[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[2606] trunk
- Subject: SF.net SVN: ledger-smb:[2606] trunk
- From: ..hidden..
- Date: Thu, 21 May 2009 05:55:42 +0000
Revision: 2606
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2606&view=rev
Author: einhverfr
Date: 2009-05-21 05:55:42 +0000 (Thu, 21 May 2009)
Log Message:
-----------
Committing more tax form patches
Modified Paths:
--------------
trunk/LedgerSMB/AA.pm
trunk/LedgerSMB/DBObject/Admin.pm
trunk/LedgerSMB/IR.pm
trunk/LedgerSMB/IS.pm
trunk/UI/Admin/edit_user.html
trunk/UI/Contact/contact.html
trunk/sql/modules/Company.sql
trunk/sql/modules/admin.sql
Modified: trunk/LedgerSMB/AA.pm
===================================================================
--- trunk/LedgerSMB/AA.pm 2009-05-20 19:52:41 UTC (rev 2605)
+++ trunk/LedgerSMB/AA.pm 2009-05-21 05:55:42 UTC (rev 2606)
@@ -1376,7 +1376,7 @@
my ( $self,$form,$cv_id) = @_;
- my $query = "select country_taxform_id from entity_credit_account where id=?";
+ my $query = "select taxform_id from entity_credit_account where id=?";
my $sth = $form->{dbh}->prepare($query);
Modified: trunk/LedgerSMB/DBObject/Admin.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Admin.pm 2009-05-20 19:52:41 UTC (rev 2605)
+++ trunk/LedgerSMB/DBObject/Admin.pm 2009-05-21 05:55:42 UTC (rev 2606)
@@ -84,6 +84,9 @@
);
$user->get();
$user->save();
+ $self->{user} = $user;
+ $self->{employee} = $employee;
+ $user->debug({file => '/tmp/user11'});
}
sub save_roles {
@@ -240,7 +243,7 @@
my $self = shift @_;
# print STDERR "attempting to get roles";
- my @s_rows = $self->call_procedure(procname=>'admin__get_roles',args=>[$self->{company}]);
+ my @s_rows = $self->call_procedure(procname=>'admin__get_roles');
my @rows;
for my $role (@s_rows) {
my $rolname = $role->{'admin__get_roles'};
Modified: trunk/LedgerSMB/IR.pm
===================================================================
--- trunk/LedgerSMB/IR.pm 2009-05-20 19:52:41 UTC (rev 2605)
+++ trunk/LedgerSMB/IR.pm 2009-05-21 05:55:42 UTC (rev 2606)
@@ -174,6 +174,9 @@
? $exchangerate
: $form->parse_amount( $myconfig, $form->{exchangerate} );
+
+ my $taxformfound=IR->taxform_exist($form,$form->{"vendor_id"});
+
for my $i ( 1 .. $form->{rowcount} ) {
$form->{"qty_$i"} = $form->parse_amount( $myconfig, $form->{"qty_$i"} );
@@ -302,6 +305,11 @@
$form->{"notes_$i"},
$invoice_id
) || $form->dberror($query);
+
+ my $report=($taxformfound and $form->{"taxformcheck_$i"})?"true":"false";
+ IR->update_invoice_tax_form($form,$dbh,$invoice_id,$report);
+
+
if (defined $form->{approved}) {
$query = qq| UPDATE ap SET approved = ? WHERE id = ?|;
@@ -1110,7 +1118,7 @@
SELECT a.invnumber, a.transdate, a.duedate,
a.ordnumber, a.quonumber, a.paid, a.taxincluded,
a.notes, a.intnotes, a.curr AS currency,
- a.vendor_id, a.language_code, a.ponumber,
+ a.entity_credit_account as vendor_id, a.language_code, a.ponumber,
a.on_hold, a.reverse
FROM ap a
WHERE id = ?|;
@@ -1137,7 +1145,7 @@
# retrieve individual items
$query = qq|
- SELECT p.partnumber, i.description, i.qty,
+ SELECT i.id as invoice_id,p.partnumber, i.description, i.qty,
i.fxsellprice, i.sellprice,
i.parts_id AS id, i.unit, p.bin,
i.deliverydate,
@@ -1442,6 +1450,8 @@
$sth->finish;
}
+
+
sub toggle_on_hold {
my $self = shift @_;
@@ -1477,4 +1487,101 @@
}
}
+
+
+
+
+sub taxform_exist
+{
+
+ my ( $self,$form,$vendor_id) = @_;
+
+ my $query = "select country_taxform_id from entity_credit_account where id=?";
+
+ my $sth = $form->{dbh}->prepare($query);
+
+ $sth->execute($vendor_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/LedgerSMB/IS.pm
===================================================================
--- trunk/LedgerSMB/IS.pm 2009-05-20 19:52:41 UTC (rev 2605)
+++ trunk/LedgerSMB/IS.pm 2009-05-21 05:55:42 UTC (rev 2606)
@@ -948,6 +948,11 @@
my $taxformfound=IS->taxform_exist($form,$form->{"customer_id"});
+
+
+ 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"} );
@@ -2011,6 +2016,7 @@
$sth->execute( $form->{language_code}, $form->{id} )
|| $form->dberror($query);
+
# foreign currency
&exchangerate_defaults( $dbh, $form );
@@ -2503,6 +2509,89 @@
my ( $self,$form,$customer_id) = @_;
+ my $query = "select 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);
+
+}
+
+
+
+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);
Modified: trunk/UI/Admin/edit_user.html
===================================================================
--- trunk/UI/Admin/edit_user.html 2009-05-20 19:52:41 UTC (rev 2605)
+++ trunk/UI/Admin/edit_user.html 2009-05-21 05:55:42 UTC (rev 2606)
@@ -19,14 +19,14 @@
<tr>
<td><?lsmb text('Username') ?></td>
<td>
- <input type="password" name="username" value="<?lsmb user.user.username ?>"/>
+ <input type="text" name="username" value="<?lsmb user.user.username ?>"/>
</td>
</tr>
<?lsmb END?>
<tr>
<td><?lsmb text('Password') ?></td>
<td>
- <input type="text" name="password" value="<?lsmb user.user.password ?>"/>
+ <input type="password" name="password" value="<?lsmb user.user.password ?>"/>
</td>
</tr>
Modified: trunk/UI/Contact/contact.html
===================================================================
--- trunk/UI/Contact/contact.html 2009-05-20 19:52:41 UTC (rev 2605)
+++ trunk/UI/Contact/contact.html 2009-05-21 05:55:42 UTC (rev 2606)
@@ -459,12 +459,12 @@
<tr id="taxform-threshold-row">
<td> <?lsmb INCLUDE select element_data = {
- name = "taxform1_id"
+ name = "taxform_id"
options = taxform_list
- default_values = [ ]
+ default_values = [taxform_id]
text_attr = "form_name"
value_attr = "id"
- label = text('Taxforms:') #'
+ label = text('Taxforms:')
} ?>
</td>
Modified: trunk/sql/modules/Company.sql
===================================================================
--- trunk/sql/modules/Company.sql 2009-05-20 19:52:41 UTC (rev 2605)
+++ trunk/sql/modules/Company.sql 2009-05-21 05:55:42 UTC (rev 2606)
@@ -275,7 +275,7 @@
FOR t_country_tax_form IN
- SELECT country_id as count_id,form_name as taxform_name,id as taxform_id
+ SELECT *
FROM country_tax_form where country_id in(SELECT country_id from entity where id=in_entity_id)
LOOP
@@ -395,9 +395,9 @@
in_curr char, in_startdate date, in_enddate date,
in_threshold NUMERIC,
in_ar_ap_account_id int,
- in_cash_account_id int
+ in_cash_account_id int,
+ in_taxform_id int
-
) returns INT as $$
DECLARE
@@ -433,7 +433,8 @@
startdate = in_startdate,
enddate = in_enddate,
threshold = in_threshold,
- discount_terms = in_discount_terms
+ discount_terms = in_discount_terms,
+ taxform_id = in_taxform_id
where id = in_credit_id;
IF FOUND THEN
Modified: trunk/sql/modules/admin.sql
===================================================================
--- trunk/sql/modules/admin.sql 2009-05-20 19:52:41 UTC (rev 2605)
+++ trunk/sql/modules/admin.sql 2009-05-21 05:55:42 UTC (rev 2606)
@@ -257,7 +257,7 @@
r.oid = ar.roleid
LOOP
- RETURN NEXT u_role.rolname;
+ RETURN NEXT u_role.rolname::text;
END LOOP;
RETURN;
@@ -555,7 +555,7 @@
t_dbname := current_database();
FOR v_rol in
SELECT
- rolname
+ *
from
pg_roles
where
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.