summaryrefslogtreecommitdiff
path: root/noncore/apps/checkbook/traninfo.cpp
Unidiff
Diffstat (limited to 'noncore/apps/checkbook/traninfo.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/checkbook/traninfo.cpp25
1 files changed, 22 insertions, 3 deletions
diff --git a/noncore/apps/checkbook/traninfo.cpp b/noncore/apps/checkbook/traninfo.cpp
index 5a770b0..460466c 100644
--- a/noncore/apps/checkbook/traninfo.cpp
+++ b/noncore/apps/checkbook/traninfo.cpp
@@ -21,24 +21,26 @@
21 -.   .:....=;==+<; General Public License along with this file; 21 -.   .:....=;==+<; General Public License along with this file;
22  -_. . .   )=.  = see the file COPYING. If not, write to the 22  -_. . .   )=.  = see the file COPYING. If not, write to the
23    --        :-=` Free Software Foundation, Inc., 23    --        :-=` Free Software Foundation, Inc.,
24 59 Temple Place - Suite 330, 24 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 25 Boston, MA 02111-1307, USA.
26 26
27*/ 27*/
28 28
29#include "traninfo.h" 29#include "traninfo.h"
30 30
31#include <qpe/config.h> 31#include <qpe/config.h>
32 32
33QString tempstr;
34
33TranInfo::TranInfo( int id, const QString &desc, const QDate &date, bool withdrawal, 35TranInfo::TranInfo( int id, const QString &desc, const QDate &date, bool withdrawal,
34 const QString &type, const QString &category, float amount, 36 const QString &type, const QString &category, float amount,
35 float fee, const QString &number, const QString &notes ) 37 float fee, const QString &number, const QString &notes )
36{ 38{
37 i = id; 39 i = id;
38 d = desc; 40 d = desc;
39 td = date; 41 td = date;
40 w = withdrawal; 42 w = withdrawal;
41 t = type; 43 t = type;
42 c = category; 44 c = category;
43 a = amount; 45 a = amount;
44 f = fee; 46 f = fee;
@@ -108,33 +110,50 @@ TranInfo::TranInfo( Config config, int entry )
108 // Transaction fee 110 // Transaction fee
109 stramount = config.readEntry( "TransactionFee", "0.00" ); 111 stramount = config.readEntry( "TransactionFee", "0.00" );
110 f = stramount.toFloat( &ok ); 112 f = stramount.toFloat( &ok );
111 113
112 // Transaction number 114 // Transaction number
113 cn = config.readEntry( "CheckNumber", "" ); 115 cn = config.readEntry( "CheckNumber", "" );
114 116
115 // Notes 117 // Notes
116 n = config.readEntry( "Comments", "" ); 118 n = config.readEntry( "Comments", "" );
117 } 119 }
118} 120}
119 121
122const QString &TranInfo::datestr()
123{
124 tempstr = QString::number( td.year() );
125 tempstr.append( '/' );
126 int tempfield = td.month();
127 if ( tempfield < 10 ) tempstr.append( '0' );
128 tempstr.append( QString::number( tempfield ) );
129 tempstr.append( '/' );
130 tempfield = td.day();
131 if ( tempfield < 10 ) tempstr.append( '0' );
132 tempstr.append( QString::number( tempfield ) );
133
134 return( tempstr );
135}
136
120void TranInfo::write( Config *config, int entry ) 137void TranInfo::write( Config *config, int entry )
121{ 138{
122 config->setGroup( QString::number( entry ) ); 139 config->setGroup( QString::number( entry ) );
123 140
124 config->writeEntry( "Description", d ); 141 config->writeEntry( "Description", d );
125 142
126 QString tempstr = QString::number( td.month() ) + "/" + 143 tempstr = QString::number( td.month() );
127 QString::number( td.day() ) + "/" + 144 tempstr.append( '/' );
128 QString::number( td.year() ); 145 tempstr.append( QString::number( td.day() ) );
146 tempstr.append( '/' );
147 tempstr.append( QString::number( td.year() ) );
129 config->writeEntry( "Date", tempstr ); 148 config->writeEntry( "Date", tempstr );
130 149
131 w ? tempstr = "true" 150 w ? tempstr = "true"
132 : tempstr = "false"; 151 : tempstr = "false";
133 config->writeEntry( "Payment", tempstr ); 152 config->writeEntry( "Payment", tempstr );
134 153
135 if ( t == "Debit Charge" || t == "Written Check" ) 154 if ( t == "Debit Charge" || t == "Written Check" )
136 tempstr = "0"; 155 tempstr = "0";
137 else if ( t == "Written Check" || t == "Automatic Payment" ) 156 else if ( t == "Written Check" || t == "Automatic Payment" )
138 tempstr = "1"; 157 tempstr = "1";
139 else if ( t == "Transfer" ) 158 else if ( t == "Transfer" )
140 tempstr = "2"; 159 tempstr = "2";