def formEdit(): newRequest = TemplateLaporan() newRequest2 = RequestLaporan() session['kodeLaporan'] = request.form['kodeLaporan'] cur = newRequest.getCurrentDisplay(session['kodeLaporan']) print("Kode Laporan Edit: ", session['kodeLaporan']) return render_template("EditKolom.html", listcurrentdisplay=cur, listPIC=newRequest2.namaPIC())
def edit(): template = TemplateLaporan() if request.method == 'POST': newRequest = RequestLaporan() kode_laporan = request.form['kodeLaporan'] cur = template.getCurrentDisplay(kode_laporan) return render_template("Edit2.html",listcurrentdisplay = cur, listPIC = newRequest.namaPIC() ,listPen = newRequest.namaPenerima(), kode_laporan=kode_laporan) return render_template("Edit2.html", listKodeReport = template.getReportID())
def requestEditLap(self, prog_id, user_id,req_report, req_kodeLaporan, req_deskripsi, req_tampilan, req_deadline, req_file, req_PIC, req_penerima, req_dateAccept = None, req_endDate=None, req_status='Waiting', req_prioritas='1'): self.req_id = self.generateRequestID() self.prog_id = prog_id self.user_id = user_id self.org_id = '' self.ktgri_id = '' self.req_kodeLaporan = req_kodeLaporan self.req_deskripsi = req_deskripsi self.req_tampilan = req_tampilan self.req_periode = '' self.req_deadline = req_deadline self.req_file = req_file self.req_date = datetime.datetime.now() self.req_dateAccept = req_dateAccept self.req_endDate = req_endDate self.req_status = req_status self.req_PIC = req_PIC self.req_penerima = req_penerima self.req_prioritas = req_prioritas self.last_report = TemplateLaporan().getDataReport(req_report) self.req_judul = self.last_report[1] self.req_tujuan = self.last_report[2] try: connection = mysql.connector.connect( host='localhost', database='cms_request', user='******', password='******') if connection.is_connected(): db_Info= connection.get_server_info() print("Connected to MySQL database...",db_Info) cursor = connection.cursor() try: cursor.execute('INSERT INTO t_request VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)', (self.req_id, prog_id, user_id, self.org_id, self.ktgri_id, req_kodeLaporan, self.req_judul, req_deskripsi, self.req_tujuan, req_tampilan, self.req_periode, req_deadline, req_file, self.req_date, req_dateAccept, req_endDate, self.req_status, req_PIC, req_penerima, req_prioritas)) except Error as e: print(e) connection.commit() record = cursor.fetchone() print ("Your connected...",record) except Error as e : print("Error while connecting file MySQL", e) finally: #Closing DB Connection. if(connection.is_connected()): cursor.close() connection.close() print("MySQL connection is closed")
def requestEditLap(self, prog_id, user_id, req_report, req_kodeLaporan, req_deskripsi, req_tampilan, req_deadline, req_file, req_PIC, reqSch_hari, reqSch_bulan, reqSch_tanggal, reqSch_groupBy='Dr. Andre Lembong', reqSch_reportPIC=None, reqSch_ktgriNama=None, reqSch_orgNama=None, reqSch_aktifYN='Y', req_dateAccept=None, req_endDate=None, req_status='Waiting', req_prioritas='1', reqSch_penerima=None): self.req_id = self.generateRequestID() self.prog_id = prog_id self.user_id = user_id self.org_id = '' self.ktgri_id = '' self.req_kodeLaporan = req_kodeLaporan self.req_deskripsi = req_deskripsi self.req_tampilan = req_tampilan self.req_periode = '' self.req_deadline = req_deadline self.req_file = req_file self.req_date = datetime.datetime.now() self.req_dateAccept = req_dateAccept self.req_endDate = req_endDate self.req_status = req_status self.req_PIC = req_PIC self.req_prioritas = req_prioritas self.last_report = TemplateLaporan().getDataReport(req_report) self.req_judul = self.last_report[1] self.req_tujuan = self.last_report[2] self.reqSch_hari = reqSch_hari self.reqSch_bulan = reqSch_bulan self.reqSch_tanggal = reqSch_tanggal self.reqSch_groupBy = reqSch_groupBy self.reqSch_lastUpdate = datetime.datetime.now() try: db = databaseCMS.db_request() cursor = db.cursor() cursor.execute( 'INSERT INTO t_request VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)', (self.req_id, prog_id, user_id, self.org_id, self.ktgri_id, req_kodeLaporan, self.req_judul, req_deskripsi, self.req_tujuan, req_tampilan, self.req_periode, req_deadline, req_file, self.req_date, req_dateAccept, req_endDate, self.req_status, req_PIC, req_prioritas)) db.commit() record = cursor.fetchone() cursor.execute( 'INSERT INTO t_reqSchedule VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)', (self.req_id, reqSch_hari, reqSch_bulan, reqSch_tanggal, reqSch_groupBy, reqSch_reportPIC, reqSch_orgNama, reqSch_ktgriNama, self.reqSch_lastUpdate, reqSch_aktifYN, reqSch_penerima)) db.commit() record = cursor.fetchone() print("Your connected...", record) except Error as e: print("Error while connecting file MySQL", e) flash('Error,', e) finally: #Closing DB Connection. if (db.is_connected()): cursor.close() db.close() print("MySQL connection is closed")
def edit(): if request.method == 'GET': newRequest = TemplateLaporan() return render_template("Edit2.html", listKodeReport=newRequest.getReportID())
def formEdit(): newRequest = TemplateLaporan() session['kodeLaporan'] = request.form['kodeLaporan'] print("test", session['kodeLaporan']) cur = newRequest.getCurrentDisplay(session['kodeLaporan']) return render_template("EditKolom.html", listcurrentdisplay=cur)
def revisi(): revisi = TemplateLaporan() revisi_id = request.form['btnRevisi'] cur = revisi.getRevisiDisplay(revisi_id) return render_template("EditRevisi.html", listrevisidisplay=cur)