def displayCourseDetails(self): res = fetch.course_info(self.course_id) #course_name, course_level, section_name, school_id, code #rint'fetch.course_info:', res if not res: return False self.course_name = res[0] self.course_level = res[1] self.school_id = res[2] self.origional_name = '"%s"' % self.course_name self.origional_course_level = self.course_level self.origional_school_id = self.school_id loadCmb.restore(self.choice_schools, self.school_id) loadCmb.courseLevels_forSchool(self.choice_levels, self.school_id) txt = "Edit Course %s" % self.course_name self.SetTitle(txt) self.text_ctrl_course_name.SetValue(self.course_name) x = self.choice_levels.GetItems() loadCmb.restore_str(self.choice_levels, str(self.course_level) ) return True
def displayData(self, month_from=1): self.month_from = month_from self.text_ctrl_from.SetValue(self.monthNames[month_from]) for key in self.monthNames: if key > 1: self.choice_to.Append(self.monthNames[key], key) loadCmb.restore(self.choice_to, 2)
def displayData(self, student_id, NoInduk, form_id): #rint'panel_edit_booking_status : displayData' loadCmb.courses_forYear(self.choice_course, gVar.schYr+1) self.form_id = form_id # query for rereg sql = "SELECT s.id, s.name sbf.rereg_status \ FROM students s \ JOIN students_by_form sbf ON sbf.student_id = s.id \ WHERE s.id = d \ AND sbf.form_id = %d" % (student_id, form_id) res = fetch.getOneDict(sql) name = res['name'] self.text_ctrl_name.SetValue(name) rereg_statusData = res['rereg_status'] if rereg_statusData: rereg_statusData = rereg_statusData.split(',') rereg_status = rereg_statusData[0] if not rereg_status: rereg_status ='?' else: rereg_status = "?" try: course_id = rereg_statusData[1] except: course_id = 0 try: refNo = rereg_statusData[2] except: refNo = '' self.showHideCourses(rereg_status =='continue')# or rereg_status =='retake') if rereg_status =='?': self.choice_status.Select(0) # ? else: if rereg_status == "exit": self.choice_status.Select(3) elif rereg_status == "retake": self.choice_status.Select(2) #loadCmb.restore(self.choice_course, course_id) elif rereg_status == "continue": #rint"rereg_status == continue" self.choice_status.Select(1) loadCmb.restore(self.choice_course, course_id) self.text_ctrl_refNo.SetValue('') self.Layout()
def OnAddYear(self, evt): if not self.new_year: res = fetch.getDig( "SELECT MAX(schYr) FROM schYrs" ) yid = fetch.nextID('schYrs') if res : self.new_year = res + 1 self.choice_schYr.Append(str(self.new_year), yid) loadCmb.restore(self.choice_schYr, yid) else: fetch.msg('A new year has already been added. Save First')
def setGen(self, selectedItemID, aList, cmb): if aList: r = aList[0] if len(r) != 2: fetch.msg('list error') if len(aList) > 1: selectedItemID = self.setComboItems(cmb, aList) elif len(aList)==1: selectedItemID = aList[0][0] loadCmb.restore(cmb, selectedItemID) else: self.clearPostcodeCtrls((cmb,)) return selectedItemID
def displayData(self, guardian_type, guardian_id, student_id): if guardian_id: self.editMode = True else: if self.student_has_other_guardian(student_id): self.editMode = True else: self.editMode = False # #rint'Guardian displayData', guardian_type, guardian_id, student_id self.guardian_type = guardian_type self.guardian_id = guardian_id self.student_id = student_id self.clearCtrls() if not guardian_id: return data = self.loadData(guardian_id) # unpack data (name, address, faith_id, dob, HP, telp, wilayah, # pob, occupation_main, occupation_other, nationality) name, address, faith_id, dob, telp, hp, wilayah, pob, occupation_main_id, occupation_other, nationality_id = data self.text_ctrl_name.SetValue(name) self.address = address self.text_ctrl_address.SetValue(address) loadCmb.restore(self.combo_box_faith, faith_id) self.date_ctrl_dob.SetValue(dob) self.text_ctrl_telp.SetValue(hp) self.text_ctrl_hp.SetValue(telp) # wilayah # pob loadCmb.restore(self.combo_occupation_main, occupation_main_id) self.text_ctrl_occupation_other.SetValue(str(occupation_other)) # nationality if guardian_type == 'guardian': try: relationship = fetch.guardianRelationship(student_id) index = self.combo_box_relationship.FindString(relationship) self.combo_box_relationship.SetSelection(index) self.label_relationship.Show() self.combo_box_relationship.Show() except: pass else: self.label_relationship.Hide() self.combo_box_relationship.Hide()
def displayDetails(self): sql = "SELECT code, code AS code, name FROM acc_accounts" DATA = fetch.DATA(sql) #rint sql, DATA for key in DATA: data = DATA[key] self.acc_code = str(data[1]) a, b, c, d = (self.acc_code[:1], self.acc_code[1:3], self.acc_code[3:5], self.acc_code[5:]) k = '%s.%s.%s.%s' % (a, b, c, d) DATA[key] = (data[0], k, data[2]) self.vList.SetItemMap(DATA) acc_catagory_id = fetch.acc_catagory_id(self.acc_code) loadCmb.restore(self.choice_account_catagory, acc_catagory_id)
def setComboItems(self, cmb, itemsList): selectedID = fetch.cmbID(cmb) cmb.Freeze() cmb.Clear() for row in itemsList: cmb.Append(str(row[1]), row[0]) cmb.Insert(' ', 0) cmb.Thaw() selectedID = loadCmb.restore(cmb, selectedID) if not selectedID: if len(itemsList) == 1: selectedID = itemsList[0][0] loadCmb.restore(cmb, selectedID) return selectedID
def loadCmbsUnderKecID(self, kecamatanID): loadCmb.restore(self.combo_kecamatan, kecamatanID) selectedKabupatenID = fetch.cmbID(self.combo_kabupaten) selectedProvinceID = fetch.cmbID(self.combo_province) # step 1: working down ------------------------------- # do for kabupaten -------------------------------- kabupatenList = fetch.kabupatenForKecamatanID(kecamatanID) if selectedKabupatenID in self.idList(kabupatenList): return kabupatenID = self.setGen(selectedKabupatenID, kabupatenList, self.combo_kabupaten) provinceID = self.provincesForKabupaten(kabupatenID, selectedKabupatenID) self.countriesForProvince(provinceID, selectedProvinceID) loadCmb.address_items(self.combo_kelurahan, 'kelurahan', kecamatanID)
def OnPostcode(self, evt): #rint'OnPostcode' if self.numCtrlActive: return postcode = self.num_ctrl_postcode.GetValue() if postcode: for c in self.combos: c.SetSelection(-1) sql = "SELECT id, itemName \ FROM address_items \ WHERE itemType= 'kecamatan' \ AND postcode = %d" % postcode res = fetch.getOneDict(sql) if res: iid = res['id'] kecamatan = res['itemName'] loadCmb.restore(self.combo_kecamatan, iid) #fetch.msg('postcode') self.loadCmbsUnderKecID(iid)
def displayData(self, student_id, NoInduk, KKelas): #rint"panel_edit_rereg_status : displayData" # query for bookings #sql = "SELECT Kode, Nama, Status FROM CSiswa WHERE Kode%d" % student_id loadCmb.courses_forYear(self.choice_course, gVar.schYr+1) self.KKelas = KKelas self.NoInduk = NoInduk # query for rereg sql = "SELECT s.id, s.NoInduk, s.name, sbf.rereg_status, sbf.next_course_id \ FROM students_by_form \ JOIN students ON sbf.student_id = Siswa.id \ WHERE sbf.student_id = '%s' \ AND f.id = %d" % (student_id, form_id) res = fetch.getOneDict(sql) self.next_level = fetch.form_level(KKelas)+1 #rintsql, res if res: name = res['Nama'] self.text_ctrl_name.SetValue(name) rereg_status = res['ReregStatus'] course_id = res['NextCourseID'] if rereg_status =='?': self.choice_status.Select(0) # ? elif rereg_status == "continue": #rint "continue" loadCmb.courses_forLevel_forYear(self.choice_course, gVar.schYr+1, self.next_level) loadCmb.restore(self.choice_course, course_id) elif rereg_status == "retake": self.choice_status.Select(2) elif rereg_status == "exit": self.choice_status.Select(3) self.showHideCourses(rereg_status =='continue' or rereg_status =='retake') self.text_ctrl_refNo.SetValue('') self.Layout()
def displayData(self, jid=0): self.jurnal_id = jid self.loadSuppliers() self.loadDivisions() self.loadAccounts() if jid: self.jurnal_id = jid txt = 'Edit Transaction No. %d' % self.jurnal_id self.SetTitle(txt) sql = "SELECT Kode, Tanggal, Transaksi + Keterangan AS description, \ NoBuktiKantor, NoBuktiSuplier, KSuplier, KDivisi, PettyCash \ FROM Jurnal \ WHERE Kode = %d" % self.jurnal_id res = fetch.getOneDict(sql) #rintsql, res self.checkbox_pettycash.SetValue(res['PettyCash']) #self.text_ctrl_nobuktikantor.SetValue(res['NoBuktiKantor']) self.datepicker_ctrl_1.SetValue(res['Tanggal']) self.text_ctrl_tans_descript.SetValue(res['description']) self.text_ctrl_supplierrefno.SetValue(res['NoBuktiSuplier']) loadCmb.restore(self.choice_supplier, res['KSuplier']) loadCmb.restore(self.choice_division, res['KDivisi']) self.listDebitItems() self.listCreditItems() else: self.jurnal_id = fetch.nextID('Jurnal') self.text_ctrl_ckrefno.SetValue(str(self.jurnal_id))
def displaySelected(self): #rint'displaySelected : self.acc_code=', self.acc_code codeStr = str(self.acc_code) a = codeStr[ :1] b = codeStr[1:3] c = codeStr[3:5] d = codeStr[5: ] self.text_ctrl_acc_code_1.SetValue(a) self.text_ctrl_acc_code_2.SetValue(b) self.text_ctrl_acc_code_3.SetValue(c) self.text_ctrl_acc_code_4.SetValue(d) name = fetch.acc_name(self.acc_code) self.text_ctrl_section_name.SetValue(name) acc_catagory_id = fetch.acc_catagory_id(self.acc_code) loadCmb.restore(self.choice_account_catagory, acc_catagory_id) bal = fetch.acc_balance(self.acc_code) bal = "{:,}".format(bal) self.text_ctrl_balance.SetValue(bal)
def displayData(self, student_id): self.student_details = student_details = fetch.studentDetails_id(student_id) if not student_details: # rint'not details found' return else: pass # rint'student_details : ', student_details name = student_details["name"] self.text_ctrl_name.SetValue(name) dob = student_details["dob"] self.datectrl_dob.SetValue(dob) faith_id = student_details["faith_id"] loadCmb.restore(self.choice_faith, faith_id) pob = str(student_details["pob"]) loadCmb.restore_str(self.choice_pob, pob) blood_group_id = str(student_details["blood_type_id"]) if student_details["gender"]: self.choice_gender.SetSelection(1) else: self.choice_gender.SetSelection(2) self.setCmb(self.choice_siblings_by_birth, student_details["siblings_by_birth"]) self.setCmb(self.choice_siblings_step, student_details["siblings_step"]) self.setCmb(self.choice_siblings_adopted, student_details["siblings_adopted"]) if student_details["child_no"]: child_no = student_details["child_no"] else: child_no = 1 self.choice_birth_order.SetSelection(child_no - 1)
def displayData(self, student_id): #rintself.GetName(), "make student id open to class student_id=", student_id self.clearCtrls() self.student_id = student_id if not student_id: return student_details = fetch.studentDetails_id(student_id) #rint student_details if not student_details: return name = student_details['Nama'] x = str(student_details['TgLahir']) dob = x.split(' ')[0] ailment = ''#str(student_details['student_ailment']) faith_id = student_details['Agama'] previous_school_id = student_details['KSekolahAsal'] birth_place = str(student_details['TempatLahir']) edu_status = '' # ??? is this still needed edu_notes = '' # ??? seperate quiry on table "edu_notes" #address = ''#str(student_details['address_line1']) + "\n" + str(student_details['address_line2']) #address += str(student_details['city']) + "\n" + str(student_details['state']) #address += str(student_details['pin_code']) + "\n" + str(student_details['country_id']) #telephone = ''# str(student_details['phone1']) + "\n" + str(student_details['phone2']) blood_group_id = str(student_details['GolDarah']) blood_group = ''#fetch.bloodGroup(blood_group_id) siblings_birth = student_details['SaudaraKandung'] siblings_step = student_details['SaudaraTiri'] siblings_adopted = student_details['SaudaraAngkat'] if not siblings_step: siblings_step=0 if not siblings_adopted: siblings_adopted =0 birth_order = student_details['AnakKe'] if not birth_order: birth_order = 1 if student_details['Pria']: gender_index = 1 else: gender_index = 2 self.text_ctrl_name.SetValue(name) self.text_ctrl_current_edu_status.SetValue(edu_status) self.text_ctrl_edu_notes.SetValue(edu_notes) self.text_ctrl_medical_notes.SetValue(ailment) #self.text_ctrl_address.SetValue('') #self.text_ctrl_telephone.SetValue('') if dob: # "should be of format : 2012-06-26" self.date_ctrl_dob.SetValue(dob) self.spin_sibling_by_birth.SetValue(siblings_birth) self.spin_sibling_step.SetValue(siblings_step) self.spin_sib_adopted.SetValue(siblings_adopted) self.spin_birth_order.SetValue(birth_order) self.choice_gender.SetSelection(gender_index) loadCmb.restore(self.choice_faith, faith_id) loadCmb.restore_str(self.choice_pob, birth_place) loadCmb.restore(self.choice_schools, previous_school_id) loadCmb.restore_str(self.choice_status, edu_status) loadCmb.restore_str(self.choice_blood_group, blood_group)
def displayData(self): self.student_id = student_id = gVar.student_id #return #rint"panel_edit_booking : displayData" self.clearCtrls() if student_id == 0: self.enableCtrls(True) self.button_edit.SetLabelText('Cancel') sql = "SELECT MAX (id) FROM students" student_id = fetch.getDig(sql)+1 self.label_ctrl_booking_id.SetLabelText(str(student_id)) else: self.button_save.Hide() self.button_edit.SetLabelText('Edit') self.enableCtrls(False) loadCmb.courses_forYear(self.choice_joining_course, gVar.schYr) self.text_ctrl_student_name.Enable(student_id == 0) if student_id: sql = "SELECT * FROM students WHERE student_id = %d" % int(student_id) res = fetch.getOneDict(sql) name = res['name'] student_id = res['student_id'] gender = res['gender'] register_course_id = res['register_course_id'] registration_status = res['reg_status'] dob = res['dob'] schYr = res['register_schYr'] self.label_heading.SetLabelText('Editing Booking For:') self.label_ctrl_booking_id.SetLabelText(str(student_id)) self.text_ctrl_student_name.SetValue(name) if gender: self.choice_gender.SetSelection(0) else: self.choice_gender.SetSelection(1) self.date_dob.SetValue(dob) course_id = res['register_course_id'] loadCmb.restore(self.choice_joining_course, course_id) #KSekolahPindah = res['KSekolahPindah'] #loadCmb.restore(self.choice_previous_school, KSekolahPindah) #if not registration_status: registration_status = 0 loadCmb.restore(self.choice_status, registration_status) sql = "SELECT * \ FROM acc_invoices i \ JOIN acc_invoice_items ii ON ii.invoice_id = i.id \ WHERE i.student_id = %d ORDER BY (ck_ref)" % gVar.student_id res = fetch.getAllDict(sql) mystr ="" for r in res: k = r.pop('student_id') ck_ref = r.pop('ck_ref') mystr += '%s : %s \n' % ('ck_ref', ck_ref) date = r.pop('Tanggal') mystr += '%s : %s \n' % ('Date', date) for key in r: val = r[key] if val: l = '%s : %s \n' % (key, r[key]) mystr += l mystr += "\n" self.text_ctrl_notes.SetValue(mystr) """ self.date_booking_fee = DateCtrl(self.panel_booking, -1) self.text_ctrl_booking_receiptNo = wx.TextCtrl(self.panel_booking, -1, "") self.date_test = DateCtrl(self.panel_booking, -1) self.choice_result_test = wx.Choice(self.panel_booking, -1, choices=["A: Strong", "B: Good", "C: Medium", "D:Weak", "E:Very Weak"]) self.date_retest = DateCtrl(self.panel_booking, -1) self.choice_result_retest = wx.Choice(self.panel_booking, -1, choices=["Acceptable", "Not Acceptable"]) self.date_offer_letter_sent = DateCtrl(self.panel_booking, -1) self.text_ctrl_offer_ref = wx.TextCtrl(self.panel_booking, -1, "") self.date_offer_accepted = DateCtrl(self.panel_booking, -1) self.text_ctrl_accept_receiptNo = wx.TextCtrl(self.panel_booking, -1, "") self.text_ctrl_notes = wx.TextCtrl(self.panel_notes, -1, "", style=wx.TE_MULTILINE)""" else: self.enableCtrls()
def restore_id(self, cmb): if not loadCmb.restore(self.combo_province, self.restoreID): self.combo_province.SetSelection(0) self.enableCombos()