[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[4387] branches/1.3
- Subject: SF.net SVN: ledger-smb:[4387] branches/1.3
- From: ..hidden..
- Date: Tue, 06 Mar 2012 09:58:07 +0000
Revision: 4387
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4387&view=rev
Author: einhverfr
Date: 2012-03-06 09:58:06 +0000 (Tue, 06 Mar 2012)
Log Message:
-----------
nonbillable field in timecards now stored in db
Modified Paths:
--------------
branches/1.3/Changelog
branches/1.3/LedgerSMB/JC.pm
branches/1.3/sql/Pg-database.sql
branches/1.3/sql/modules/Fixes.sql
Modified: branches/1.3/Changelog
===================================================================
--- branches/1.3/Changelog 2012-03-06 03:06:44 UTC (rev 4386)
+++ branches/1.3/Changelog 2012-03-06 09:58:06 UTC (rev 4387)
@@ -6,6 +6,7 @@
* Reduced log messages when upgrading/creating db, for some log levels (Chris T)
* Changed db setup not to use createdb for simple admin of pg_hba.conf (Chris T)
* Corrected type = 'password' not handled properly in elements.html (Chris T)
+* Non-billable information now retained in db for timecards (Chris T)
Changelog for 1.3.12
* Corrected processing of <?lsmb tags in order/invoice numbers (Chris T)
Modified: branches/1.3/LedgerSMB/JC.pm
===================================================================
--- branches/1.3/LedgerSMB/JC.pm 2012-03-06 03:06:44 UTC (rev 4386)
+++ branches/1.3/LedgerSMB/JC.pm 2012-03-06 09:58:06 UTC (rev 4387)
@@ -86,6 +86,8 @@
delete $form->{"${_}a"};
}
+ $form->{noncharge} = $form->{non_billable};
+
$query = qq|
SELECT s.printed, s.spoolfile, s.formname
FROM status s
@@ -518,7 +520,14 @@
my $sth;
my ( $null, $project_id ) = split /--/, $form->{projectnumber};
+ for (qw(qty sellprice allocated noncharge)) {
+ $form->{$_} = $form->parse_amount( $myconfig, $form->{$_} );
+ }
+ my ($total, $nonbillable);
+ $nonbillable = $form->{noncharge} || 0;
+ $total = $form->{qty} + $nonbillable;
+
if ( $form->{id} ) {
# check if it was a job
@@ -557,10 +566,12 @@
my $uid = localtime;
$uid .= "$$";
- $query = qq|INSERT INTO jcitems (description, person_id)
- SELECT '$uid', id
+ $query = qq|INSERT INTO jcitems
+ (description, person_id, total, non_billable)
+ SELECT ?, id, ?, ?
FROM person WHERE entity_id = person__get_my_entity_id()|;
- $dbh->do($query) || $form->dberror($query);
+ my $isth = $dbh->prepare($query) || $form->dberror($query);
+ $isth->execute($uid, $total, $nonbillable)|| $form->dberror($query);
$query = qq|SELECT id FROM jcitems WHERE description = '$uid'|;
( $form->{id} ) = $dbh->selectrow_array($query);
@@ -603,7 +614,9 @@
checkedout = ?::timestamp,
person_id = (SELECT id FROM person
WHERE entity_id = ?),
- notes = ?
+ notes = ?,
+ total = ?,
+ non_billable = ?
WHERE id = ?|;
$sth = $dbh->prepare($query);
$sth->execute(
@@ -619,6 +632,8 @@
"$outdate $form->{outhour}:$form->{outmin}:$form->{outsec}",
$form->{employee_id},
$form->{notes},
+ $total,
+ $nonbillable,
$form->{id}
) || $form->dberror($query);
Modified: branches/1.3/sql/Pg-database.sql
===================================================================
--- branches/1.3/sql/Pg-database.sql 2012-03-06 03:06:44 UTC (rev 4386)
+++ branches/1.3/sql/Pg-database.sql 2012-03-06 09:58:06 UTC (rev 4387)
@@ -1832,7 +1832,9 @@
checkedin timestamp with time zone,
checkedout timestamp with time zone,
person_id integer references person(id) not null,
- notes text
+ notes text,
+ total numeric not null,
+ non_billable numeric not null default 0
);
COMMENT ON TABLE jcitems IS $$ Time and materials cards.
Modified: branches/1.3/sql/modules/Fixes.sql
===================================================================
--- branches/1.3/sql/modules/Fixes.sql 2012-03-06 03:06:44 UTC (rev 4386)
+++ branches/1.3/sql/modules/Fixes.sql 2012-03-06 09:58:06 UTC (rev 4387)
@@ -243,3 +243,13 @@
UPDATE update menu_node set position = 3 where position = 2 and parent = 229;
update menu_node set parent = 229 where id = 233;
COMMIT;
+
+BEGIN; -- timecard additional info
+ALTER TABLE jcitems ADD total numeric NOT NULL DEFAULT 0;
+ALTER TABLE jcitems ADD non_billable numeric NOT NULL DEFAULT 0;
+
+UPDATE jcitems
+ SET total = qty
+ WHERE qty IS NOT NULL and total = 0;
+
+COMMIT;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.