Esempio n. 1
0
    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
Esempio n. 2
0
    def OnNewSupplier(self, evt):
        #rint"open dlgTextEntry 'new supplier' "
        dlg = wx.TextEntryDialog(self, 'Supplier Name', 'New Supplier Name', '')
 
        if dlg.ShowModal() == wx.ID_OK:
            new_name = dlg.GetValue().strip()
            if new_name:
                sql = "SELECT Nama FROM Suplier WHERE Nama = '%s'" % new_name
                if fetch.getCount(sql):
                    msg = "Sorry supplier '%s' already exists" % new_name
                    fetch.msg(msg)
                else:
                    sql = "INSERT INTO Suplier (Nama) VALUES ('%s')" % new_name
                    fetch.updateDB(sql)
                    self.loadSuppliers()
                    loadCmb.restore_str(self.choice_supplier, new_name)
Esempio n. 3
0
 def OnNewDivision(self, evt):
     dlg = wx.TextEntryDialog(self, 'Division Name', 'New Division Name', '')
     if dlg.ShowModal() == wx.ID_OK:
         new_name = dlg.GetValue().strip()
         if new_name:
             sql = "SELECT Nama FROM Divisi WHERE Nama = '%s'" % new_name
             if fetch.getCount(sql):
                 msg = "Sorry division '%s' already exists" % new_name
                 fetch.msg(msg)
             else:
                 next_id = fetch.nextID('Divisi')
                 sql = "INSERT INTO Divisi (Kode, Nama) VALUES (%d, '%s')" % (next_id, new_name)
                 #rintsql
                 fetch.updateDB(sql)
                 self.loadDivisions()
                 loadCmb.restore_str(self.choice_division, new_name)
     dlg.Destroy()
Esempio n. 4
0
    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)
Esempio n. 5
0
    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)
Esempio n. 6
0
 def displayData(self):
     self.schYr = gVar.schYr
     loadCmb.restore_str(self.choice_schYr, str(gVar.schYr))
Esempio n. 7
0
 def InCemaraAsri(self, event):
     self.checkbox_in_estate.SetValue(1)
     self.num_ctrl_postcode.SetValue(20371)
     self.text_ctrl_road.SetValue('Jl. Cemara')
     loadCmb.restore_str(self.combo_box_estate, 'Perum. Cemara Asri')
     loadCmb.restore_str(self.combo_kelurahan,  'Sampali')
Esempio n. 8
0
    def loadAddress(self, address):
	gVar.editedFlag = False
	# change kode to the selected address
        #sql = "SELECT AlamatA FROM OrangTua WHERE Kode = %d" % kode
        

        self.text_ctrl_address.SetValue(address)
        
	itemList = self.splitAddress(address)
	addrLen = len(itemList)
	if addrLen != 11:
	    for i in range(0, 11-addrLen):
		itemList.append('')
	street,house,estate,block,road,kelurahan,kecamatan,kabupaten,postcode,province,country = itemList

	
	street    = street.strip()
	house     = house.strip()
	estate    = estate.strip()
	block     = block.strip()
	road      = road.strip()
	kelurahan = kelurahan.strip()
	kecamatan = kecamatan.strip()
	kabupaten = kabupaten.strip()
	postcode  = postcode.strip()
	province  = province.strip()
	country   = country.strip()
	
	self.text_ctrl_block.SetValue(block)
	self.text_ctrl_house.SetValue(house)
	self.text_ctrl_road.SetValue(road)
	self.text_ctrl_street.SetValue(street)
	if estate:
	    self.checkbox_in_estate.SetValue(1)
	    self.selectResidesPanel()
	    loadCmb.restore_str(self.combo_box_estate, estate)
	  
	try :
	    postcode = int(postcode)
	    postcode = postcode*1
	    if isinstance(postcode, int):
		#rint 'postcode.isdigit'
		self.num_ctrl_postcode.SetValue(int(postcode))
		kecamatanID = fetch.cmbID(self.combo_kecamatan)
		self.loadCmbsUnderKecID(kecamatanID)
		#rint 'restore_str ,',kelurahan
		loadCmb.restore_str(self.combo_kelurahan, kelurahan)
		
	    else:
		loadCmb.restore_str(self.combo_country, country)
		loadCmb.restore_str(self.combo_country, province)
		loadCmb.restore_str(self.combo_country, kabupaten)
		loadCmb.restore_str(self.combo_country, kecamatan)
		loadCmb.restore_str(self.combo_country, kelurahan)
	except:
	    pass