Beispiel #1
0
    def OnSave(self, evt):
        # aim to make this generic
        
	table  = 'guardians' 
	column = 'address'
	
	street    = str(self.text_ctrl_street.GetValue())
	house     = str(self.text_ctrl_house.GetValue())
	estate    = str(fetch.cmbValue(self.combo_estate))
	block     = str(self.text_ctrl_block.GetValue())
	road      = str(self.text_ctrl_road.GetValue())
	kelurahan = str(fetch.cmbValue(self.combo_kelurahan))
	kecamatan = self.combo_kecamatan.GetStringSelection()
	kabupaten = str(fetch.cmbValue(self.combo_kabupaten))
	postcode  = str(self.num_ctrl_postcode.GetValue())
	province  = str(fetch.cmbValue(self.combo_province))
	country   = str(fetch.cmbValue(self.combo_country))
			    
	if not street or not house or not province:
	    fetch.msg('At least houseNo, street & province are needed')
	    return
	
	address =','.join((street,house,estate,block,road,kelurahan,kecamatan,kabupaten,postcode,province,country))
        sql = "UPDATE %s \
                  SET address = '%s' \
                WHERE id =%d" %(table, address, self.guardian_id)
        #rintsql
        fetch.updateDB(sql)
Beispiel #2
0
    def Save(self):
        # rint' save bio '
        name = self.text_ctrl_name.GetValue()
        dob = self.datectrl_dob.GetDbReadyValue()
        pob = fetch.cmbValue(self.choice_pob)
        faith_id = fetch.cmbID(self.choice_faith)
        gender = fetch.cmbID(self.choice_gender) == 1

        siblings_by_birth = int(fetch.cmbValue(self.choice_siblings_by_birth))
        siblings_step = int(fetch.cmbValue(self.choice_siblings_step))
        siblings_adopted = int(fetch.cmbValue(self.choice_siblings_adopted))
        child_no = int(fetch.cmbValue(self.choice_birth_order))

        sql = (
            "UPDATE students \
                  SET name='%s', dob ='%s',  pob ='%s', faith_id =%d, gender=%d, \
                      siblings_by_birth =%d, siblings_step = %d,      siblings_adopted = %d, child_no =%d \
                WHERE id =%d"
            % (
                name,
                dob,
                pob,
                faith_id,
                gender,
                siblings_by_birth,
                siblings_step,
                siblings_adopted,
                child_no,
                gVar.student_id,
            )
        )
        # rintsql
        fetch.updateDB(sql)
Beispiel #3
0
 def edit(self, cmb1, cmb2, itemType):
     #rint'edit   type:',itemType
     
     nextItem = ''
     
     self.restore_id = self.cmbID(cmb1)
     restoreString = fetch.cmbValue(cmb1)
     if not self.restore_id:
         # prepare data for new entry
         if itemType=='country':
             self.next_item_id = 0
         else:
             if cmb2:
                 next_item_id = self.cmbID(cmb2)
                 #rintcmb2.GetName(), 'next_item_id', next_item_id
                 nextItem   = fetch.cmbValue(cmb2)
                 if not next_item_id:
                     fetch.msg('Please Select A Follow On Item')
                     return
     
     dlg = DlgAddrItemEditor.create(None)
     try:
         dlg.displayData(self.restore_id, itemType, nextItem)
         if dlg.ShowModal() == wx.ID_OK:
             itemName = dlg.itemName
             if not itemName: return
             
             # prevent duplicate name if country
             # prevent duplicate name where next item same
             # warning of other duplicate names -if not kelurahan
             
             if self.restore_id: # editing an item
                 if itemName == restoreString:
                     return
                 else:
                     sql = "UPDATE address_items \
                               SET name ='%s' \
                             WHERE %id = %d" % (itemName, self.restore_id)
                     #rint sql
                     cmb1.SetValue(itemName)
                     
             else: # insert a new item
                 if self.next_item_id: 
                     sql = "INSERT INTO address_items \
                                   (name, type, next_item_id) \
                            VALUES ('%s', '%s', '%s')" % (
                                    itemName, itemType, self.next_item_id)
                 else:
                     sql = "INSERT INTO address_items \
                                   (name, type) \
                            VALUES ('%s', '%s')" % (
                                    itemName, itemType)
                 #rintsql
                 fetch.updateDB(sql)
                   
     finally:    
         dlg.Destroy()
Beispiel #4
0
    def OnChoiceStatusChange(self, evt):
        rereg_status = fetch.cmbValue(self.choice_status)
        self.showHideCourses(rereg_status =='continue')# or rereg_status =='retake')

        rereg_status = fetch.cmbValue(self.choice_status)
        if rereg_status =='continue':
            # load choice of next level courses
            pass
            
        if rereg_status =='retake':
            # load choices - same level courses
            pass
        
        self.Layout()    
Beispiel #5
0
    def OnChoiceStatusChange(self, evt):
        rereg_status = fetch.cmbValue(self.choice_status)
        self.showHideCourses(rereg_status =='continue')# or rereg_status =='retake')

        loadCmb
        rereg_status = fetch.cmbValue(self.choice_status)
        if rereg_status =='continue':
            #rint"gVar.schYr+1, self.next_level", gVar.schYr+1, self.next_level
            loadCmb.courses_forLevel_forYear(self.choice_course, gVar.schYr+1, self.next_level)
            
        if rereg_status =='retake':
            # load choices - same level courses
            pass
        
        self.Layout()    
Beispiel #6
0
    def OnSave(self, evt):
	street    = str(self.text_ctrl_street.GetValue()).strip()
	house     = str(self.text_ctrl_house.GetValue()).strip()
	estate    = str(fetch.cmbValue(self.combo_box_estate))
	block     = str(self.text_ctrl_block.GetValue()).strip()
	road      = str(self.text_ctrl_road.GetValue()).strip()
	kelurahan = str(fetch.cmbValue(self.combo_kelurahan))
	kecamatan = str(fetch.cmbValue(self.combo_kecamatan))
	kabupaten = str(fetch.cmbValue(self.combo_kabupaten))
	postcode  = str(self.num_ctrl_postcode.GetValue())
	province  = str(fetch.cmbValue(self.combo_province))
	country   = str(fetch.cmbValue(self.combo_country))
			    
	if not street or not house or not province:
	    fetch.msg('At least houseNo, street & province are needed')
	    return
	
	address =','.join((street,house,estate,block,road,kelurahan,kecamatan,kabupaten,postcode,province,country))
        #rintgVar.table, gVar.column, address, gVar.guardian_id
	sql = "UPDATE %s \
                  SET %s= '%s' \
                WHERE id = %d" %(gVar.table, gVar.column, address, gVar.guardian_id)
        #rintsql
        fetch.updateDB(sql)
	gVar.editedFlag = True
	#rint'set gVar.editedFlag to True'
	self.GetTopLevelParent().goBack()
Beispiel #7
0
   def OnAddCredit(self, evt):
       #rint'Add credit'
       gVar.listCtrl = 'c'
       account_id=fetch.cmbID(self.choice_credits)
 
       if self.id_in_grid(account_id, self.grid_credits): return
       
       if self.id_in_grid(account_id, self.grid_debits):
           fetch.msg('can add this account, already in debits')
       
       account = fetch.cmbValue(self.choice_credits)
       #rint'OnAddCredit', account
       
       self.grid_credits.appendItem((account_id, account, 0))
       self.grid_credits.calcTotal()
Beispiel #8
0
    def getValues(self):
        return (self.text_ctrl_street.GetValue().strip(),
		self.text_ctrl_house.GetValue().strip(),
		str(fetch.cmbValue(self.combo_box_estate)),
		self.text_ctrl_block.GetValue().strip(),
		self.text_ctrl_road.GetValue().strip(),
                str(fetch.cmbValue(self.combo_kelurahan)),
                str(fetch.cmbValue(self.combo_kecamatan)),
                str(fetch.cmbValue(self.combo_kabupaten)),
		str(self.num_ctrl_postcode.GetValue()),
                str(fetch.cmbValue(self.combo_province)),
		str(fetch.cmbValue(self.combo_country)))
Beispiel #9
0
 def OnSave(self, evt):
     status = fetch.cmbValue(self.choice_status)
     refNo  = self.text_ctrl_refNo.GetValue()
     course_id = fetch.cmbID(self.choice_course)
     
     if status == "?": 
         ReregStatus = "?"
         
     elif status =="exit":
         ReregStatus = "exit,%s" % (refNo, )
         
     else:
         ReregStatus = "%s, %d, %s" % (status, course_id, refNo)
     
     
     sql = "UPDATE SiswaPerKelas SET ReregStatus = '%s' WHERE KKelas =%d AND NoInduk ='%s' " % (ReregStatus, self.KKelas, self.NoInduk)
     #rintsql
     fetch.updateDB(sql)
Beispiel #10
0
 def OnSave(self, evt):
     gVar.lastPanel=self
     status = fetch.cmbValue(self.choice_status)
     refNo  = self.text_ctrl_refNo.GetValue()
     course_id = fetch.cmbID(self.choice_course)
     
     if status == "?": 
         ReregStatus = "?"
         
     elif status =="exit":
         ReregStatus = "exit,%s" % (refNo, )
         
     else:
         ReregStatus = "%s, %d, %s" % (status, course_id, refNo)
     
     
     sql = "UPDATE students_by_form \
               SET rereg_status = '%s' \
             WHERE form_id =%d \
               AND student_id =%d " % (ReregStatus, self.form_id, self.student_id)
     #rintsql
     fetch.updateDB(sql)
Beispiel #11
0
 def OnProvince(self, event):
     #rint'OnProvince '
     print
     selectedProvinceID = self.cmbID(self.combo_province)
     province           = fetch.cmbValue(self.combo_province)
     
     if selectedProvinceID:
         #rint'Selected province ', selectedProvinceID , ':', province
         #rint'work down'
         
         #rint'Get country for selected province (there should only be one)', selectedProvinceID
         countryList = fetch.countriesForProvinceID(selectedProvinceID)
         #rint'countryList ',countryList
         if countryList:
             selectedCountryID = self.cmbID(self.combo_country)
             #rint' this should select the country if there is one'
             self.setGen(selectedCountryID, countryList, self.combo_country)
         
         # work up ---------------------
         #rint' work up'
         kabupatenList       = fetch.kabupatenForProvinceID(selectedProvinceID)
         selectedKabupatenID = self.cmbID(self.combo_kabupaten)
         #rint'kabupatenList, ',kabupatenList , ',    SelectedKabupatenID', selectedKabupatenID
         if selectedKabupatenID in self.idList(kabupatenList):
             return
         self.clearPostcodeCtrls((self.combo_kecamatan,
                                  self.combo_kabupaten,
                                  self.combo_kelurahan))
         #  kabupaten --------------------------
         if kabupatenList:
             #rint'Has kabupatenList'
             kabupatenID = self.setComboItems(self.combo_kabupaten, kabupatenList)
             if selectedKabupatenID != kabupatenID:
                 pass
                 # select kecamatan for all kabupaten in list
                 
     else:
         pass
Beispiel #12
0
 def OnKec(self, event):
     #rint'OnKec'
     selectedKecamatanID = self.cmbID(self.combo_kecamatan)
     kecamatan           = fetch.cmbValue(self.combo_kecamatan)
     selectedKabupatenID = self.cmbID(self.combo_kabupaten)
     selectedProvinceID  = self.cmbID(self.combo_province)
     
     if selectedKecamatanID:
         self.postcodeForKecamatan(selectedKecamatanID)
         #  working down ----------------
         kabupatenList = fetch.kabupatenForKecamatanID(selectedKecamatanID)
         if kabupatenList:
             kabupatenID  = self.setGen(selectedKabupatenID, kabupatenList, self.combo_kabupaten)
             if selectedKabupatenID != kabupatenID:
                 provinceList       = fetch.provincesForKabupatenID(kabupatenID)
                 selectedProvinceID = self.cmbID(self.combo_province)
                 provinceID         = self.setGen(selectedProvinceID, provinceList, self.combo_province)
                 if selectedProvinceID != provinceID:
                     self.countriesForProvince(provinceID, provinceID)
         # step 2 - work up
         self.resetCmb(self.combo_kelurahan)
         alist = fetch.kelurahanForKecamatanID(selectedKecamatanID)
         self.setComboItems(self.combo_kelurahan, alist)
Beispiel #13
0
 def OnKab(self, event):
     #rint'OnKab  get cmbID(self.combo_kabupaten)'
     pass
     selectedKabupatenID = self.cmbID(self.combo_kabupaten)
     ##rint'selectedKabupatenID =', selectedKabupatenID
     if not selectedKabupatenID:
         ##rint'selectedKabupatenID = None ?????', selectedKabupatenID 
         return
     
     kabupaten           = fetch.cmbValue(self.combo_kabupaten)
     
     provinceList        = fetch.provincesForKabupaten(kabupaten)
     selectedProvinceID  = self.cmbID(self.combo_province)
     provinceID          = self.setGen(selectedProvinceID, provinceList, self.combo_province)
     if selectedProvinceID != provinceID:
         self.countriesForProvince(provinceID, selectedProvinceID)
     
     # step 2: work upward -----------------------
     kecamatenList = fetch.kecamatanForKabupatenID(selectedKabupatenID)
     if kecamatenList:
         selectedKecamatenID = self.cmbID(self.combo_kecamatan)
         kecamatenID = self.setComboItems(self.combo_kecamatan, kecamatenList)
         if kecamatenID != selectedKecamatenID:
             self.resetCmb(self.combo_kelurahan)
Beispiel #14
0
 def OnEstate(self, evt):
     #rint 'OnEstate'
     if fetch.cmbValue(self.combo_box_estate)=="Perum. Cemara Asri":
         #rint 'Perum. Cemara Asri'
         self.InCemaraAsri(wx.Event)