DAFTAR PUSTAKA. Fowler, Martin. UML Distilled Third Edition, Panduan Singkat Bahasa Pemodelan Objek Standar Penerbit Andi

DAFTAR PUSTAKA A Miftakul Huda, Aplikasi Inventory multi store plus management dengan java, 2011. Elekmedia Komputindo. Fowler, Martin. UML Distilled...
5 downloads 0 Views 442KB Size
DAFTAR PUSTAKA

A Miftakul Huda, Aplikasi Inventory multi store plus management dengan java, 2011. Elekmedia Komputindo. Fowler, Martin. UML Distilled Third Edition, Panduan Singkat Bahasa Pemodelan Objek Standar. 2004. Penerbit Andi. Revilla, Alejandro. jPOS Programmer's Guide, jPOS Extended Edition. 2008. http://www.jpos.org. Neuman, B.Clifford. Medvinsky, Gennady. Requirements for Network Payment: The NetChequeTM Perspective. 1995. Information Sciences Institute, University of Southern California. Pressman, Roger S. Rekayasa Perangkat Lunak. 2002. Penerbit Andi. N.Asokan, Janson, Phil, Steiner, Michael, Waidner, Michael. Electronic Payment Systems. 1996. Zurich Research Laboratory. Switzerland. David K. Gifford, Lawrence C. Stewart. Andrew C. Payne, G. Winfield Treese. Payment Switches for Open Networks. 1995. USENIX Workshop on Electronic Commerce, New York. Martinus Ady H, Pengenalan dengan jPOS, 2011. http://www.jug.or.id Brands, Stefan. Electronic Cash Brands. 1998. Brands Technologies, The Netherlands.

92

LAMPIRAN

ISO Server 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. 40. 41. 42. 43. 44. 45. 46. 47. 48. 49.

package qpaymentserver; import java.io.IOException; import java.util.logging.Level; import java.util.logging.Logger; import org.jpos.iso.BaseChannel; import org.jpos.iso.ISOException; import org.jpos.iso.ISOMsg; import org.jpos.iso.ISOPackager; import org.jpos.iso.ISORequestListener; import org.jpos.iso.ISOServer; import org.jpos.iso.ISOSource; import org.jpos.iso.ServerChannel; import org.jpos.iso.channel.ASCIIChannel; import org.jpos.iso.packager.GenericPackager; public class server implements ISORequestListener { public static void main(String[] args) throws ISOException { String hostname = "localhost"; int portNumber = 12345; // membuat sebuah packager ISOPackager packager = new GenericPackager("packager/iso93ascii.xml"); // membuat channel ServerChannel channel = new ASCIIChannel(hostname, portNumber, packager); // membuat server ISOServer server = new ISOServer(portNumber, channel, null); server.addISORequestListener(new server()); new Thread(server).start(); System.out.println("Server siap menerima koneksi pada port [" + portNumber+"]"); } public boolean process(ISOSource isoSrc, ISOMsg isoMsg) { try { System.out.println("Server menerima koneksi ["+((BaseChannel)isoSrc).getSocket().getInetAddress().getHostAddress()+"]"); if (isoMsg.getMTI().equalsIgnoreCase("1800")) { acceptNetworkMsg(isoSrc, isoMsg); } } catch (IOException ex) { Logger.getLogger(server.class.getName()).log(Level.SEVERE, null, ex); } catch (ISOException ex) { Logger.getLogger(server.class.getName()).log(Level.SEVERE, null, ex); } return false; } private void acceptNetworkMsg(ISOSource isoSrc, ISOException, IOException {

92

dari

ISOMsg isoMsg) throws

50. 51. 52. 53. 54. 55. 56. } 57. }

System.out.println("Accepting Network Management Request"); ISOMsg reply = (ISOMsg) isoMsg.clone(); reply.setMTI("1810"); reply.set(39, "00"); isoSrc.send(reply);

ISO Client 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. 40. 41. 42. 43. 44. 45.

package qpaymentclient; import java.io.IOException; import java.text.SimpleDateFormat; import java.util.Date; import org.jpos.iso.ISOException; import org.jpos.iso.ISOMUX; import org.jpos.iso.MUX; import org.jpos.iso.ISOMsg; import org.jpos.iso.ISOPackager; import org.jpos.iso.ISORequest; import org.jpos.iso.channel.ASCIIChannel; import org.jpos.iso.packager.GenericPackager; //listener get data from database import java.sql.*; import com.dbMIF.DBQuery; import javax.management.Query; import java.io.*; import java.util.*; public class client { public static void main(String[] args) throws IOException, ISOException { String hostname = "localhost"; int portNumber = 12345; Connection Conn; boolean result = false; LinkedList list = null; String str; int num; //koneksi ke database Integer vID = 1; String jServer = "localhost"; String jUser = "root"; String jPassword = "explorindo"; String jDatabase = "qpayment"; String urlValue = ""; String strQupdate = ""; String strQ = "select * from translation where status = 0 order by id asc";// and id="+vID+""; try { Class.forName("com.mysql.jdbc.Driver");

92

46. 47. 48. 49. 50. 51. 52. 53. 54. 55. 56. 57. 58. 59. 60. 61. 62. 63. 64. 65. 66. 67. 68. 69. 70. 71. 72. 73. 74. 75. 76. 77. 78. 79. 80.

urlValue "jdbc:mysql://"+jServer+"/"+jDatabase+"?user="+jUser+"&password="+jPassword;

=

Conn = DriverManager.getConnection(urlValue); DBQuery q = new DBQuery(); q.setConnection(Conn); Statement s = Conn.createStatement(); //s.executeQuery("select count(id) from translation where status = 0"); s.executeQuery("select * from translation where status = 0 order by id asc"); q.setStrSql(strQ); q.makeResulset(); ResultSet rs = s.getResultSet(); if(rs!=null){ while(rs.next()){ String ambilID = rs.getString("id"); list = new LinkedList(); int total = q.getRowCount(); int n = Integer.parseInt(ambilID); list.add(n); while(!list.isEmpty()){ vID = list.remove(); //strQID = "and id="+vID; //System.out.println(strQID); //System.out.println(rs.getString("setmerchant")); //System.out.println(rs.getString("setamount")); //System.out.println(rs.getString("setdesc"));

// membuat sebuah packager ISOPackager packager = new GenericPackager("packager/iso93ascii.xml"); 81. // membuat channel 82. ASCIIChannel channel = new ASCIIChannel(hostname, portNumber, packager); 83. 84. ISOMUX isoMux = new ISOMUX(channel) { 85. @Override 86. protected String getKey(ISOMsg m) throws ISOException { 87. return super.getKey(m); 88. } 89. }; 90. 91. new Thread(isoMux).start(); 92. 93. // bikin network request 94. ISOMsg networkReq = new ISOMsg(); 95. networkReq.setMTI("1800"); 96. networkReq.set(18, rs.getString("setmerchant")); 97. networkReq.set(4, rs.getString("setamount")); 98. networkReq.set(104, rs.getString("setdesc")); 99. networkReq.set(7, new SimpleDateFormat("yyyyMMdd").format(new Date()));

92

100.

//networkReq.set(7, new SimpleDateFormat("yyyyMMdd").format(q.getString("setyyyymmdd"))); 101. networkReq.set(11, "000001"); 102. networkReq.set(12, new SimpleDateFormat("HHmmss").format(new Date())); 103. //networkReq.set(12, new SimpleDateFormat("HHmmss").format(q.getString("sethhmmss"))); 104. //networkReq.set(13, new SimpleDateFormat("MMdd").format(new Date())); 105. networkReq.set(2,rs.getString("setprimaryaccountnumber")); //Primary Account Number 106. 107. ISORequest req = new ISORequest(networkReq); 108. isoMux.queue(req); 109. 110. ISOMsg reply = req.getResponse(50*1000); 111. if (reply != null) { 112. System.out.println("Request ["+new String(networkReq.pack()) + "]"); 113. System.out.println("Response ["+new String(reply.pack()) + "]"); 114. strQupdate = "update translation set status =1 where id="+vID+""; 115. q.setStrSql(strQupdate); 116. q.preparedStatement(); 117. q.executeUpdate(); 118. 119. } 120. } 121. 122. } 123. 124. } 125. 126. } //end of try 127. 128. catch(SQLException e){ 129. System.out.println("Koneksi Gagal > "+e.toString()); 130. } 131. 132. catch(ClassNotFoundException e){ 133. System.out.println("jdbc.Driver tidak ditemukan"); 134. } 135. 136. } 137. 138. } 139.

Packager ISO ISO93ASCII 1. 2. 3. 4. 5. 6. 7. 8.



92

67. 68. 69. 70. 71. 72. 73. 74. 75. 76. 77. 78. 79. 80. 81. 82. 83. 84. 85. 86. 87. 88. 89. 90. 91. 92. 93. 94. 95. 96. 97. 98. 99. 100. 101. 102. 103. 104. 105. 106. 107. 108. 109. 110. 111. 112. 113. 114. 115. 116. 117. 118. 119. 120. 121. 122. 123. 124.



92

357. 358. 359. 360. 361. 362. 363. 364. 365. 366. 367. 368. 369. 370. 371. 372. 373. 374. 375. 376. 377. 378. 379. 380. 381. 382. 383. 384. 385. 386. 387. 388. 389. 390. 391. 392. 393. 394. 395. 396. 397. 398. 399. 400. 401. 402. 403. 404. 405. 406. 407. 408. 409. 410. 411. 412. 413. 414.



92

647. 652.

GenericPackager DTD 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30.



Core Controller 1. class CI_Controller { 2. 3. private static $instance; 4. 5. public function __construct() 6. { 7. self::$instance =& $this; 8. foreach (is_loaded() as $var => $class) 9. { 10. $this->$var =& load_class($class); 11. } 12. 13. $this->load =& load_class('Loader', 'core'); 14.

92

15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. }

$this->load->_base_classes =& is_loaded(); $this->load->_ci_autoloader(); log_message('debug', "Controller Class Initialized"); } public static function &get_instance() { return self::$instance; }

Controller Site 28. class Site extends CI_Controller 29. { 30. function __construct() 31. { 32. parent::__construct(); 33. $this->is_logged_in(); 34. $this->load->helper('date'); 35. $this->load->library('form_validation'); 36. $this->load->helper('fpdf'); 37. $this->load->model('Membership_model'); 38. $this->load->model('Data_model'); 39. } 40. 41. function members_area() 42. { 43. $data['msg']= ''; 44. $isedit = $this->session->userdata('isedit'); 45. if($isedit != '1') { 46. $data['main_content'] = 'home_area'; 47. $this->load->view('includes/template', $data); 48. } else { 49. $this->admin_area(); 50. } 51. } 52. 53. function about() 54. { 55. $data['msg']= ''; 56. $data['main_content'] = 'includes/about'; 57. $this->load->view('includes/template', $data); 58. } 59. 60. function admin_area() 61. { 62. $data['msg']= ''; 63. $data['main_content'] = 'admin/admin_area'; 64. $this->load->view('includes/template', $data); 65. } 66. 67. function report() 68. {

92

69. 70. 71.

$nim = $this->session->userdata('nim'); $sdg = 'gdg'; $data['gdg_list'] = >getAllAmortizationGDGByNimType($nim,$sdg); 72. $data['main_content'] = 'report/report_area'; 73. $this->load->view('includes/template', $data); 74. } 75. 76. function reportsdg() 77. { 78. $nim = $this->session->userdata('nim'); 79. $sks = 'sdg'; 80. $data['sdg_list'] = >getAllAmortizationSDGByNimType($nim,$sks); 81. $data['main_content'] = 'report/report_sdgarea'; 82. $this->load->view('includes/template', $data); 83. } 84. 85. function reportsks() 86. { 87. $nim = $this->session->userdata('nim'); 88. $sks = 'sks'; 89. $data['sks_list'] = >getAllAmortizationSKSByNimType($nim,$sks); 90. $data['main_content'] = 'report/report_sksarea'; 91. $this->load->view('includes/template', $data); 92. } 93. 94. function reportcuti() 95. { 96. $nim = $this->session->userdata('nim'); 97. $cuti = 'cuti'; 98. $data['cuti_list'] = >getAllAmortizationCUTIByNimType($nim,$cuti); 99. $data['main_content'] = 'report/report_areacuti'; 100. $this->load->view('includes/template', $data); 101. } 102. 103. function reportlain() 104. { 105. $nim = $this->session->userdata('nim'); 106. $lain = 'lain'; 107. $data['lain_list'] = >getAllAmortizationLAINByNimType($nim,$lain); 108. $data['main_content'] = 'report/report_arealain'; 109. $this->load->view('includes/template', $data); 110. } 111. 112. function mahasiswa() 113. { 114. $nim = $this->session->userdata('nim'); 115. $gdg = 'gdg'; 116. $sks = 'sks'; 117. $sdg = 'sdg'; 118. $cuti = 'cuti'; 119. $lain = 'lain'; 120. $data['gdg_list'] = >getAllAmortizationGDGByNimType($nim,$gdg);

92

$this->Data_model-

$this->Data_model-

$this->Data_model-

$this->Data_model-

$this->Data_model-

$this->Data_model-

121.

$data['sks_list'] = >getAllAmortizationSKSByNimType($nim,$sks); 122. $data['sdg_list'] = >getAllAmortizationSDGByNimType($nim,$sdg); 123. $data['cuti_list'] = >getAllAmortizationCUTIByNimType($nim,$cuti); 124. $data['lain_list'] = >getAllAmortizationLAINByNimType($nim,$lain); 125. $data['nim_list'] = $this->Data_model->getAllmember(); 126. $data['main_content'] = 'admin/listmhs_area'; 127. $this->load->view('includes/template', $data); 128. } 129. 130. function mhsdetail(){ 131. $nim = $this->uri->segment(3); 132. $data['mhs'] = $this->uri->segment(3); 133. $data['detail'] = $this->Data_model->detailMhs($nim); 134. $data['main_content'] = 'admin/detailmhs'; 135. $this->load->view('includes/template', $data); 136. } 137. 138. function status() 139. { 140. $nim = $this->session->userdata('nim'); 141. $gdg = 'gdg'; 142. $sks = 'sks'; 143. $sdg = 'sdg'; 144. $cuti = 'cuti'; 145. $lain = 'lain'; 146. $data['gdg_list'] = >getAllAmortizationGDGByNimType($nim,$gdg); 147. $data['sks_list'] = >getAllAmortizationSKSByNimType($nim,$sks); 148. $data['sdg_list'] = >getAllAmortizationSDGByNimType($nim,$sdg); 149. $data['cuti_list'] = >getAllAmortizationCUTIByNimType($nim,$cuti); 150. $data['lain_list'] = >getAllAmortizationLAINByNimType($nim,$lain); 151. $data['nim_list'] = $this->Data_model->getAllmember(); 152. $data['main_content'] = 'admin/status_transaksi'; 153. $this->load->view('includes/template', $data); 154. } 155. 156. function transaksiBerhasil(){ 157. $id = 1; 158. $data['status_list'] = $this->Data_model->getStatusToday($id); 159. $data['main_content'] = 'admin/success_status'; 160. $this->load->view('includes/template', $data); 161. } 162. 163. function transaksiGagal(){ 164. $id = 0; 165. $data['status_list'] = $this->Data_model->getStatusToday($id); 166. $data['main_content'] = 'admin/failed_status'; 167. $this->load->view('includes/template', $data); 168. } 169.

92

$this->Data_model$this->Data_model$this->Data_model$this->Data_model-

$this->Data_model$this->Data_model$this->Data_model$this->Data_model$this->Data_model-

170. 171. 172. 173. 174. 175. 176. 177. 178.

function editAmor() { $nim = $this->session->userdata('nim'); $gdg = 'gdg'; $sks = 'sks'; $sdg = 'sdg'; $cuti = 'cuti'; $lain = 'lain'; $data['gdg_list'] = >getAllAmortizationGDGByNimType($nim,$gdg); 179. $data['sks_list'] = >getAllAmortizationSKSByNimType($nim,$sks); 180. $data['sdg_list'] = >getAllAmortizationSDGByNimType($nim,$sdg); 181. $data['cuti_list'] = >getAllAmortizationCUTIByNimType($nim,$cuti); 182. $data['lain_list'] = >getAllAmortizationLAINByNimType($nim,$lain); 183. $data['nim_list'] = $this->Data_model->getAllmember(); 184. $data['main_content'] = 'amor_area'; 185. $this->load->view('includes/template', $data); 186. } 187. 188. function editDetail($nim){ 189. $nim = $this->uri->segment(3); 190. $gdg = 'gdg'; 191. $data['mhs'] = $this->uri->segment(3); 192. $data['gdg_list'] = >getAllAmortizationGDGByNimType($nim,$gdg); 193. $data['main_content'] = 'report/edit_detail'; 194. $this->load->view('includes/template', $data); 195. 196. } 197. 198. function editDetailSks($nim){ 199. $nim = $this->uri->segment(3); 200. $sks = 'sks'; 201. $data['mhs'] = $this->uri->segment(3); 202. $data['sks_list'] = >getAllAmortizationSKSByNimType($nim,$sks); 203. $data['main_content'] = 'report/edit_detailsks'; 204. $this->load->view('includes/template', $data); 205. 206. } 207. 208. function editDetailSdg($nim){ 209. $nim = $this->uri->segment(3); 210. $sdg = 'sdg'; 211. $data['mhs'] = $this->uri->segment(3); 212. $data['sdg_list'] = >getAllAmortizationSDGByNimType($nim,$sdg); 213. $data['main_content'] = 'report/edit_detailsdg'; 214. $this->load->view('includes/template', $data); 215. 216. } 217. 218. function editDetailCuti($nim){ 219. $nim = $this->uri->segment(3);

92

$this->Data_model$this->Data_model$this->Data_model$this->Data_model$this->Data_model-

$this->Data_model-

$this->Data_model-

$this->Data_model-

220. 221. 222.

$cuti = 'cuti'; $data['mhs'] = $this->uri->segment(3); $data['cuti_list'] = $this->Data_model>getAllAmortizationCUTIByNimType($nim,$cuti); 223. $data['main_content'] = 'report/edit_detailcuti'; 224. $this->load->view('includes/template', $data); 225. 226. } 227. 228. function editDetailLain($nim){ 229. $nim = $this->uri->segment(3); 230. $lain = 'lain'; 231. $data['mhs'] = $this->uri->segment(3); 232. $data['lain_list'] = $this->Data_model>getAllAmortizationLAINByNimType($nim,$lain); 233. $data['main_content'] = 'report/edit_detaillain'; 234. $this->load->view('includes/template', $data); 235. 236. } 237. 238. function updateAmorByTgl($tgl,$nim,$angs){ 239. $tgl = $this->uri->segment(3); 240. $nim = $this->uri->segment(4); 241. $angs = $this->uri->segment(5); 242. 243. $updated = $this->Data_model->updateAmorByTgl($tgl,$nim,$angs); 244. $output = '{"tgl":"'.$tgl.'","nim":"'.$nim.'","angs":"'.$angs.'"}'; 245. echo $output; 246. } 247. 248. function updateAmorByValue($values,$nim,$angs){ 249. $values = $this->uri->segment(3); 250. $nim = $this->uri->segment(4); 251. $angs = $this->uri->segment(5); 252. 253. $updated = $this->Data_model->updateAmorByAmount($values,$nim,$angs); 254. $output = '{"values":"'.$values.'","nim":"'.$nim.'","angs":"'.$angs.'"}'; 255. echo $output; 256. } 257. 258. 259. function is_logged_in() 260. { 261. $is_logged_in = $this->session->userdata('is_logged_in'); 262. if(!isset($is_logged_in) || $is_logged_in != true) 263. { 264. redirect('/login', 'refresh'); 265. } 266. } 267. 268. function add_save() 269. { 270. $transactionInfo = array( //add to database translation 271. 'nim' => $this->input->post('nim'), 272. 'setmti' => $this->input->post('setmti'), 273. 'setprimaryaccountnumber' => $this->input>post('setprimaryaccountnumber'), 274. 'setmerchant' => $this->input->post('setmerchant'),

92

275. 276. 277.

'setamount' => $this->input->post('setamount'), 'setdesc' => $this->input->post('setdesc'), 'setyyyymmdd' => $this->input>post('setyyyymmdd'), 278. 'sethhmmss' => $this->input>post('sethhmmss') 279. ); 280. 281. $this->Data_model->add_record($transactionInfo); 282. $this->session->set_flashdata('message',$msg); 283. redirect('/site/members_area', 'refresh'); 284. 285. } 286. 287. 288. function getPDF() { 289. $nim = $this->session->userdata('nim'); 290. header("Content-Type: application/pdf"); 291. $header = array('Angsuran','Tgl Jadwal','Jumlah Tagihan','Tgl Bayar','Bayar Tagihan', 'TYPE'); 292. $this->fpdf->FPDF('P','cm','A4'); 293. $this->fpdf->Ln(); 294. $this->fpdf->AddPage(); 295. $this->fpdf->setFont('Arial','B',14); 296. $this->fpdf->Text(1,4,'Laporan Pembiayaan Mahasiswa'); 297. $this->fpdf->ln(1); 298. $this->fpdf->Image(''.base_url().'img/umb-logo.gif',1,1,10,2,''); 299. $this->fpdf->ln(3); 300. $this->fpdf->setFont('Arial','',9); 301. $this->fpdf->write(0,'NIM :'.$this->session->userdata('nim').' FAKULTAS :'.$this->session->userdata('faculty').''); 302. $this->fpdf->ln(); 303. $this->fpdf->write(1,'NAMA :'.$this->session->userdata('nama').' JURUSAN :'.$this->session->userdata('major').''); 304. $this->fpdf->ln(1); 305. $trxbefore = $this->Data_model->sumTagihan($nim); 306. $trxafter = $this->Data_model->sumSdhBayar($nim); 307. $total = $trxbefore - $trxafter; 308. $this->fpdf->write(1,'Total Tagihan : ' .number_format($trxbefore). ' Telah Di Bayar : ' .number_format($trxafter). ' Kewajiban Total : ' .number_format($total)); 309. $this->fpdf->ln(2); 310. $trx = $this->Data_model->amortizationInfo($nim); 311. $this->showTable($header); 312. $this->fpdf->Output('reportTransaction-'.$this->session->userdata('nim').'.pdf','D'); 313. 314. } 315. 316. function showTable($header) 317. { 318. $nim = $this->session->userdata('nim'); 319. $this->load->helper('fpdf'); 320. $this->fpdf->SetFillColor(50,200,255); 321. $this->fpdf->SetTextColor(255); 322. $this->fpdf->SetDrawColor(224,235,255); 323. $this->fpdf->SetLineWidth(0); 324. $this->fpdf->SetFont('','B'); 325.

92

326. 327. 328. 329. 330. 331. 332. 333. 334. 335. 336. 337. 338. 339. 340.

$w = array(3,3,3,3,3,4); for($i=0;$ifpdf->Cell($w[$i],1,$header[$i],10,0,'C',true); $this->fpdf->Ln();

$this->fpdf->SetFillColor(224,235,255); $this->fpdf->SetTextColor(0); $this->fpdf->SetFont(''); $data['data_list'] = $this->Data_model->amortizationInfo($nim); $count=1; $fill = false; foreach($data['data_list'] as $key) { $this->fpdf->Cell($w[0],1,$key->installmentnumber,'LR',0,'C',$fill); $this->fpdf->Cell($w[1],1,$key->installmentdate,'LR',0,'C',$fill); $this->fpdf->Cell($w[2],1,number_format($key>installmentamount),'LR',0,'C',$fill); 341. $this->fpdf->Cell($w[3],1,$key->installmentdatetransaction,'LR',0,'C',$fill); 342. $this->fpdf->Cell($w[4],1,number_format($key>installmentamounttransaction),'LR',0,'C',$fill); 343. $this->fpdf->Cell($w[5],1,$this->Data_model->getTypeName($key>type),'LR',0,'L',$fill); 344. $this->fpdf->Ln(); 345. $fill = !$fill; 346. } 347. $this->fpdf->Cell(array_sum($w),0,'','T'); 348. }

Controller Main 1. class Main extends CI_Controller 2. { 3. function __construct() 4. { 5. parent::__construct(); 6. $this->load->helper('date'); 7. $this->load->library('form_validation'); 8. $this->load->helper('fpdf'); 9. $this->load->model('Membership_model'); 10. $this->load->model('Data_model'); 11. } 12. 13. function index() 14. { 15. $nim = $this->Data_model->getStatusNim(); 16. if(!empty($nim)) { 17. $description = $this->Data_model->getStatusDetail($nim); 18. $type = $description->type; 19. $pembayaran = $this->Data_model->getTypeName($type); 20. $amount = $description->amount; 21. $tujuan = $this->Data_model->getRecipientTrx($nim); 22. $nama = $tujuan->nama; 23. $alamat = $tujuan->email; 24. 25. $this->Data_model->updateAmorFull1(); 26. $this->Data_model->updateAmorFull2(); 27. 28. $config['protocol'] = 'smtp';

92

29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. 40.

$config['smtp_host'] = 'ssl://smtp.googlemail.com'; $config['smtp_port'] = 465; $config['smtp_user'] = '[email protected]'; $config['smtp_pass'] = 'qpayment'; $this->load->library('email', $config); $this->email->set_newline("\r\n"); $this->email->from('[email protected]', 'QPayment System'); $this->email->to($alamat); $this->email->subject('QPayment Notifications'); $this->email->message('Dear '.$nama.', Your Transaction '.$pembayaran.' was successfully created.

41. 42. 43. 44. 45. 46. 47. 48. 49. 50. 51. 52. 53. 54. 55. 56. 57. 58. 59. 60. 61. 62. 63. 64. 65. }

Rp

'.number_format($amount).'

Thanks - QPayment System http://m.rizqtech.net '); if($this->email->send()) { echo 'Confirmation email was sent'; } else { show_error($this->email->print_debugger()); } }else{ echo "There is no update"; } }

Controller Login 1. class Login extends CI_Controller { 2. 3. function __construct() 4. { 5. parent::__construct(); 6. $this->load->helper('date'); 7. $this->load->library('form_validation'); 8. $this->load->helper('string'); 9. $this->load->library('email'); 10. $this->load->library('encrypt'); 11. } 12. 13. 14. function index() 15. { 16. $data['main_content'] = 'login_form';

92

for

17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32.

$nim = $this->input->post('nim', TRUE); $password = $this->input->post('password', TRUE); if (isset($nim) && $nim != '') { // if they tried to login $user_id = $this->site_sentry->login_routine(); } else { $data['page_title'] = $this->lang->line('login_login'); $this->load->view('includes/template', $data); } }

function login_fail($errorcode='001') { $data['main_content'] = 'login_form'; $errordesc = str_split($errorcode); $data['errormsg']['userError'] = ($errordesc[0]=='0')?$this->lang>line('login_wrong_username'):''; 33. $data['errormsg']['passError'] = ($errordesc[1]=='0')?$this->lang>line('login_wrong_password'):''; 34. $data['errormsg']['isactive'] = ($errordesc[2]=='0')?$this->lang>line('login_isdeactivated'):''; 35. $data['page_title'] = $this->lang->line('login_login'); 36. 37. $this->load->view('includes/template', $data); 38. } 39. 40. function signup() 41. { 42. $data['main_content'] = 'signup_form'; 43. $this->load->view('includes/template', $data); 44. } 45. 46. function logout() 47. { 48. $usercode = $this->session->userdata('nim'); 49. $user_set = array('logged_in'=>false); 50. $user_where = array('nim'=>$usercode); 51. $this->db->update('mahasiswa',$user_set,$user_where); 52. $this->session->sess_destroy(); 53. $this->index(); 54. } 55. 56. }

QPayment Lang 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11.

$lang['actions_required_fields'] = 'Required Fields'; $lang['no_authorize_access'] = 'Not Authorized To Access !'; $lang['no_rekening'] = 'Nomor Rekening'; $lang['nominal'] = 'Nominal'; $lang['bank_provider'] = 'Bank Provider'; $lang['nim'] = 'Nomor Induk Mahasiswa'; $lang['nama'] = 'Nama Mahasiswa'; $lang['trans_succes'] = 'Transaksi Berhasil'; $lang['trans_failed'] = 'Transaksi Gagal'; $lang['login_wrong_username'] = 'NIM tidak ditemukan'; $lang['login_wrong_password'] = 'Salah Password';

92

12. $lang['login_isdeactivated'] = 'User Not Active';

Library Site Sentry 1. class Site_sentry { 2. 3. 4. function Site_sentry() 5. { 6. $this->obj =& get_instance(); 7. } 8. 9. function is_logged_in() 10. { 11. if ($this->obj->session) { 12. 13. //If user has valid session, and such is logged in 14. if ($this->obj->session->userdata('is_logged_in')) { 15. return TRUE; 16. } else { 17. return FALSE; 18. } 19. } else { 20. return FALSE; 21. } 22. } 23. 24. function login_routine() 25. { 26. //Initialise the Encryption Library 27. $this->obj->load->library('encrypt'); 28. 29. //Make the input nim and password into variables 30. $password = $this->obj->input->post('password'); 31. $nim = $this->obj->input->post('nim'); 32. //Use the input nim and password and check against 'users' table 33. $this->obj->db->where('nim',$nim); 34. $query = $this->obj->db->get('mahasiswa'); 35. 36. $login_result = FALSE; 37. $userfound=false; 38. $passfound=false; 39. if($query->num_rows()>0){ 40. foreach($query->result() as $row){ 41. if($this->obj->encrypt->decode($row->password) == $password){ 42. if($row->statusmhs=='statusactive'){ 43. $errorcode='111'; 44. $login_result = TRUE; 45. $nim = $row->nim; 46. $nama = $row->nama; 47. $major_code = $row->major; 48. $email = $row->email; 49. $isedit = $row->isedit; 50. 51. /*Update last logon & logged_in status*/

92

52.

$this->obj->db->where('nim', $nim);

53.

$this->obj->db->set('logged_in', $login_result);

54.

$this->obj->db->set('lastlogon', date('Y-m-d H:i:s'));

55.

$this->obj->db->set('logincounter', $row->logincounter + 1);

56.

$this->obj->db>update('mahasiswa');

57. 58. 59. 60. 61. 62. 63. 64. 65. 66. 67. 68. 69. 70.

}else $errorcode='110'; }else $errorcode='101'; } }else{ $errorcode = '011'; } //die('errcode = '.$errorcode); //If nim and password match set the logged in flag in 'ci_sessions' if ($login_result==1) { // Get all user's menu $this->obj->load->model('Membership_model'); //$allowed_sloc = $this->obj->membership_model>getName($nim);//add by rizq@04-07-2011

71. 72. 73. 74.

// Set session's menu session_start(); //$_SESSION['allowed_sloc'] = $allowed_sloc; //add by rizq@04-07-2011

75. 76. 77. 78.

$credentials = array( 'nim' => $nim, 'nama' => $nama, 'major' => $this->obj->Membership_model>getMajor($nim),

79.

'faculty' =>

$this->obj->Membership_model-

>getFaculty($nim), 80. 81. 82. 83. 84. 85. 86. 87. 88. 89. 90. 91. 92. 93. 94. 95. 96. 97. 98. 99. 100.

'email' => $email, 'isedit' => $isedit, 'is_logged_in' => true ); //echo 'array credential = '.$credentials; $this->obj->session->set_userdata($credentials); //On success redirect user to default page if ($isedit =='1') { redirect('site/admin_area'); exit; }else{ redirect('site/members_area'); exit; } } else { //On error send user back to login page, and add error message redirect('login/login_fail/'.$errorcode); exit;

92

101. 102. 103. 104. 105. }

} }

Application Config 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. 40. 41. 42. 43.

$config['base_url'] = 'https://localhost/qpaymentphp'; $config['index_page'] = ''; $config['uri_protocol'] = 'REQUEST_URI'; $config['url_suffix'] = ''; $config['language'] = 'english'; $config['charset'] = 'UTF-8'; $config['enable_hooks'] = FALSE; $config['subclass_prefix'] = 'MY_'; $config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-'; $config['allow_get_array'] = TRUE; $config['enable_query_strings'] = FALSE; $config['controller_trigger'] = 'c'; $config['function_trigger'] = 'm'; $config['directory_trigger'] = 'd'; // experimental not currently in use $config['log_threshold'] = 0; $config['log_path'] = ''; $config['log_date_format'] = 'Y-m-d H:i:s'; $config['cache_path'] = ''; $config['encryption_key'] = 'rizq_ONb!41@{Z)pLs]u_a:_^:5nQGx_7G-dU'; $config['sess_cookie_name'] = 'ci_session'; $config['sess_expiration'] = 7200; $config['sess_expire_on_close'] = FALSE; $config['sess_encrypt_cookie'] = FALSE; $config['sess_use_database'] = FALSE; $config['sess_table_name'] = 'ci_sessions'; $config['sess_match_ip'] = FALSE; $config['sess_match_useragent'] = TRUE; $config['sess_time_to_update'] = 300; $config['cookie_prefix'] = ""; $config['cookie_domain'] = ""; $config['cookie_path'] = "/"; $config['cookie_secure'] = FALSE; $config['global_xss_filtering'] = FALSE; $config['csrf_protection'] = FALSE; $config['csrf_token_name'] = 'csrf_test_name'; $config['csrf_cookie_name'] = 'csrf_cookie_name'; $config['csrf_expire'] = 7200; $config['compress_output'] = FALSE; $config['time_reference'] = 'local'; $config['rewrite_short_tags'] = FALSE; $config['proxy_ips'] = ''; define("LGLO","510"); // Login-Logout $config['fonts_path']= "font/";

Application Database 1. 2. 3.

$active_group = 'default'; $active_record = TRUE; $db['default']['hostname'] = 'localhost';

92

4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17.

$db['default']['username'] = 'root'; $db['default']['password'] = 'explorindo'; $db['default']['database'] = 'qpayment'; $db['default']['dbdriver'] = 'mysql'; $db['default']['dbprefix'] = ''; $db['default']['pconnect'] = TRUE; $db['default']['db_debug'] = TRUE; $db['default']['cache_on'] = FALSE; $db['default']['cachedir'] = ''; $db['default']['char_set'] = 'utf8'; $db['default']['dbcollat'] = 'utf8_general_ci'; $db['default']['swap_pre'] = ''; $db['default']['autoinit'] = TRUE; $db['default']['stricton'] = FALSE;

Core Model 1. class CI_Model { 2. function __construct() 3. { 4. log_message('debug', "Model Class Initialized"); 5. } 6. function __get($key) 7. { 8. $CI =& get_instance(); 9. return $CI->$key; 10. } 11. }

Data Model 1. class Data_model extends CI_Model { 2. 3. function add_record($data) 4. { 5. $this->db->insert('translation', $data); 6. return; 7. } 8. 9. function getAllAmortizationGDGByNimType($nim,$type) 10. { 11. $sql = "SELECT a.installmentnumber as angsuran, a.installmentdate as tgljadwal, a.installmentamount as jmltagihan, 12. a.installmentdatetransaction as tglbayar, a.installmentamounttransaction as bayartagihan 13. FROM amortization a 14. WHERE a.nim = '$nim' AND a.type = '$type' ORDER BY a.id"; 15. $query = $this->db->query($sql); 16. return $query->result(); 17. } 18. 19. function getAllAmortizationSKSByNimType($nim,$type) 20. { 21. $sql = "SELECT a.installmentnumber as angsuran, a.installmentdate as tgljadwal, a.installmentamount as jmltagihan,

92

22.

a.installmentdatetransaction as tglbayar, a.installmentamounttransaction as bayartagihan

23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. 40. 41. 42. 43. 44. 45. 46. 47. 48. 49. 50. 51. 52. 53. 54. 55. 56. 57. 58. 59. 60. 61. 62. 63. 64. 65. 66. 67. 68. 69. 70. 71. 72.

FROM amortization a WHERE a.nim = '$nim' AND a.type = '$type' ORDER BY a.id"; $query = $this->db->query($sql); return $query->result(); } function getAllAmortizationSDGByNimType($nim,$type) { $sql = "SELECT a.installmentnumber as angsuran, a.installmentdate as tgljadwal, a.installmentamount as jmltagihan, a.installmentdatetransaction as tglbayar, a.installmentamounttransaction as bayartagihan FROM amortization a WHERE a.nim = '$nim' AND a.type = '$type' ORDER BY a.id"; $query = $this->db->query($sql); return $query->result(); } function getAllAmortizationCUTIByNimType($nim,$type) { $sql = "SELECT a.installmentnumber as angsuran, a.installmentdate as tgljadwal, a.installmentamount as jmltagihan, a.installmentdatetransaction as tglbayar, a.installmentamounttransaction as bayartagihan FROM amortization a WHERE a.nim = '$nim' AND a.type = '$type' ORDER BY a.id"; $query = $this->db->query($sql); return $query->result(); } function getAllAmortizationLAINByNimType($nim,$type) { $sql = "SELECT a.installmentnumber as angsuran, a.installmentdate as tgljadwal, a.installmentamount as jmltagihan, a.installmentdatetransaction as tglbayar, a.installmentamounttransaction as bayartagihan FROM amortization a WHERE a.nim = '$nim' AND a.type = '$type' ORDER BY a.id"; $query = $this->db->query($sql); return $query->result(); } function getAllmember(){ $sql = "SELECT DISTINCT nim, nama FROM mahasiswa WHERE isedit in ('0')"; $query = $this->db->query($sql); return $query->result(); } function sumTagihan($nim) { $this->db->select_sum('installmentamount'); $this->db->where('nim', $nim); $query = $this->db->get('amortization'); return $query->row()->installmentamount;

92

73. 74. 75. 76. 77. 78. 79. 80. 81. 82. 83. 84. 85. 86. 87. 88. 89. 90. 91. 92. 93. 94. 95. 96. 97. 98. 99. 100. 101. 102. 103. 104. 105.

} function sumSdhBayar($nim) { $this->db->select_sum('installmentamounttransaction'); $this->db->where('nim', $nim); $query = $this->db->get('amortization'); return $query->row()->installmentamounttransaction; } function getTypeName($type) { if(!empty($type)){ $this->db->select('name'); $this->db->where('id',$type); $nama = $this->db->get('mst_code')->row(); return isset($nama->name)?$nama->name:$type; }else return ''; } function amortizationInfo($nim) { $sql = "SELECT installmentnumber, installmentdate,installmentamount, installmentdatetransaction,installmentamounttransaction,type FROM amortization"; $query = $this->db->query($sql); return $query->result(); }

function updateTglGDG($info){ $this->db->where('nim', $info['nim']); $this->db->where('installmentnumber', $info['installmentnumber']); $this->db>set('installmentdatetransaction',$info['installmentdatetransaction']); 106. $this->db->update('amortization'); 107. } 108. 109. function detailMhs($nim){ 110. $this->db->where('nim_id', $nim); 111. return $this->db->get('mahasiswadetail')->row(); 112. } 113. 114. function getStatusToday($id){ 115. 116. $this->db->where('status', $id); 117. $this->db->where('issent', $id); 118. return $this->db->get('translation'); 119. 120. } 121. 122. function updateAmorByTgl($tgl, $nim, $angs){ 123. $this->db->where('nim', $nim); 124. $this->db->where('installmentnumber', $angs); 125. $data = array('installmentdatetransaction' => $tgl); 126. $this->db->update('amortization', $data); 127. 128. } 129.

92

130. 131. 132. 133. 134. 135. 136. 137. 138. 139. 140. 141. 142. 143. 144. 145. 146. 147. 148. 149. 150. 151. 152. 153. 154. 155. 156. 157. 158. 159. 160. 161. 162. 163. 164. 165. 166. 167.

function updateAmorByAmount($values, $nim, $angs){ $this->db->where('nim', $nim); $this->db->where('installmentnumber', $angs); $data = array('installmentamounttransaction' => $values); $this->db->update('amortization', $data); } function getTrxCode($trxcode) { $this->db->select('name'); $this->db->where('id', $trxcode); $row = $this->db->get('mst_code')->row(); return isset($row->name)?$row->name:''; }

function getStatusNim() { $this->db->select('nim'); $nim = $this->db->get('getstatusnim')->row(); return isset($nim->nim)?$nim->nim:''; } function getStatusDetail($nim) { $this->db->where('nim',$nim); return $this->db->get('getstatusnim')->row(); } function getRecipientTrx($nim) { $this->db->where('nim_id',$nim); return $this->db->get('mahasiswadetail')->row(); }

function updateAmorFull1(){ $sql = "UPDATE amortization SET installmentdatetransaction = (SELECT tgl FROM getstatusnim), 168. installmentamounttransaction = (SELECT amount FROM getstatusnim) 169. WHERE installmentamounttransaction = 0 170. AND id = (SELECT id FROM getminid) 171. AND nim = (SELECT nim FROM getstatusnim) 172. AND TYPE = (SELECT TYPE FROM getstatusnim)"; 173. $result = $this->db->query($sql); 174. } 175. 176. function updateAmorFull2(){ 177. $sql = "UPDATE translation SET issent = 1 WHERE id = (SELECT id FROM getmaxid)"; 178. $result = $this->db->query($sql); 179. } 180. 181. }

Membership Model 92

1. class Membership_model extends CI_Model { 2. 3. function validate() 4. { 5. $this->db->where('nim', $this->input->post('nim')); 6. $this->db->where('password', md5($this->input->post('password'))); 7. $query = $this->db->get('mahasiswa'); 8. 9. if($query->num_rows == 1) 10. { 11. return true; 12. } 13. 14. } 15. 16. function create_member() 17. { 18. 19. $new_member_insert_data = array( 20. 'first_name' => $this->input->post('first_name'), 21. 'last_name' => $this->input->post('last_name'), 22. 'email_address' => $this->input->post('email_address'), 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. 40. 41. 42. 43. 44. 45. 46. 47. 48. 49. 50. 51. 52. 53. 54. 55. 56.

'username' => $this->input->post('username'), 'password' => md5($this->input->post('password')) ); $insert = $this->db->insert('membership', $new_member_insert_data); return $insert; } function getName($usercode) { $this->db->select('nama'); $this->db->where('nim', $usercode); $row = $this->db->get('mahasiswa')->row(); return isset($row->nama)?$row->nama:''; } function getFaculty($usercode) { $sql = "SELECT b.nama_fakultas FROM mahasiswa a JOIN faculty b ON b.major = a.major WHERE a.nim = '$usercode'"; $query = $this->db->query($sql); $faculty = ''; if($query->num_rows() > 0){ foreach($query->result() as $row){ $faculty = $row->nama_fakultas; } } return $faculty; } function getMajor($usercode) {

92

57. 58. 59. 60. 61. 62. 63. 64. 65. 66. 67. 68. 69. 70. 71. 72. }

$sql = "SELECT b.nama_jurusan FROM mahasiswa a JOIN faculty b ON b.major = a.major WHERE a.nim = '$usercode'"; $query = $this->db->query($sql); $major = ''; if($query->num_rows() > 0){ foreach($query->result() as $row){ $major = $row->nama_jurusan; } } return $major; }

View Admin Area 1. 2. 3. 4. 5. 6. 7. 8.

QPayment System

  Status Transaksi 9. Mahasiswa Terdaftar 10. Pengecekan Amortisasi 11. 12. 13. 14. About 15. Log Out 16. 17. 18. 19.

View Detail Mahasiswa 1. 2. 3. 4. 5. 6. 7.



92

18.

19. Transaksi Sebesar Rupiah 20. 21. 22. 23. 24. 25. 26. 27. 28.

View Transaksi Berhasil 1. 2. 3. 4. 5. 6.

18. 19. Transaksi Sebesar Rupiah 20. 21. 22. 23. 24. 25. 26. 27. 28.

View Daftar Mahasiswa 1. 2. 3. 4.

- 19. 20. 21. 22. 23. 24. 25. 26.

View Status Transaksi 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13.

Suggest Documents