Пример #1
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()
Пример #2
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)
Пример #3
0
    def insertGuardian(self, data):
	data = list(data)
	nb_name = self.GetName()
	if nb_name =='g':   relationship = 'guardian'
	elif nb_name =='f': relationship = 'father'
	else:               relationship = 'mother'
	data.append(relationship)
	
	sql = "INSERT INTO guardians (name, address, faith_id, \
				    dob, telp1, telp2,\
				    wilayah, pob, occ_main_id, \
				    occ_other, nationality, relationship) \
			    VALUES ('%s', '%s', %d, \
				    '%s', '%s', '%s', \
				    '%s', '%s', %d, \
				    '%s', %d, %d)" % tuple(data)
	#rintsql
	guardian_id = fetch.updateDB(sql)
	
	sql = "UPDATE students SET "
	if nb_name =='g':   sql += " guardian_id "
	elif nb_name =='f': sql += " father_id "
	else:               sql == " mother_id "
	sql += "= %d WHERE id = %d" % (guardian_id, self.student_id)
	    
	fetch.updateDB(sql)
Пример #4
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)
Пример #5
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()
Пример #6
0
 def updateDB(self, excul_group_id, members):
     sql = "DELETE FROM excul_students \
             WHERE excul_group_id =%d " % excul_group_id
     fetch.updateDB(sql)
     for key in members:
         student_id, name, form = members[key]
         sql = "INSERT INTO excul_students \
                            (student_id, excul_group_id) \
                     VALUES (%d, %d)" % (student_id, excul_group_id)
         fetch.updateDB(sql)
Пример #7
0
 def updateCourse(self):
     if not (self.course_name  == self.origional_name
         and self.school_id    == self.origional_school_id
         and self.course_level == self.origional_course_level) :
         sql = " UPDATE courses \
                    SET name='%s', course_level=%d, school_id=%d \
                  WHERE id = %d"  % (self.course_name, self.course_level , self.school_id, self.course_id)
         txt = 'This will effect all records past and present'
         #fetch.msg(txt)
         fetch.updateDB(sql)
Пример #8
0
 def OnSave(self, evt):
     if gVar.student_id:
         sql, data = self.updateBooking()
     else:
         sql, data = self.insertNewStudent()
      
     if sql:
         #fetch.updateDB_data(sql,data)
         fetch.updateDB(sql)
         self.button_save.Hide()
         self.button_edit.SetLabelText('Edit')
         self.enableCtrls(False)    
Пример #9
0
    def OnSave(self, evt):
        course_ids_list = self.item_picker.GetAllSelectionIds()
        course_ids = str(course_ids_list).strip('[]')
	
	sql = "DELETE \
		 FROM courses_by_year \
		WHERE schYr = %d" % gVar.schYr
	#rintsql
	#rintfetch.updateDB(sql)
	
	data = ()
	for course_id in course_ids_list:
	    sql = "INSERT INTO courses_by_year (course_id, schYr)  \
                     VALUES (%d, %d)" % (course_id, gVar.schYr)
	    #rintsql
	    fetch.updateDB(sql)
Пример #10
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)
Пример #11
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()
Пример #12
0
 def save(self, id):
     eng   = self.spinCtrl_eng.GetValue()
     math  = self.spinCtrl_maths.GetValue()
     sci   = self.spinCtrl_sci.GetValue()
     notes = self.text_ctrl_notes.GetValue()
     needs = self.checkbox_special_needs.GetValue()
     
     sql = "  UPDATE students SET \
                     admission_test_results = '%d,%d,%d', \
                     special_needs = %d, \
                     observation_notes = '%s' \
               WHERE id = %d " % (
                     eng, math, sci,
                     needs,
                     notes,
                     self.student_id)
     ##rintsql
     fetch.updateDB(sql)
Пример #13
0
 def update(self, activity_id, teacher_id):
     if activity_id == self.activity_id and teacher_id == self.teacher_id:
         # ' no changes made '
         return True
     
     sql = "UPDATE excul SET activity_id =%d, employee_id= %d \
             WHERE id = %d"  % (activity_id, teacher_id, self.excul_id)
     #rintsql
     return fetch.updateDB(sql)
Пример #14
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)
Пример #15
0
    def updateGuardian(self, data):
	data = list(data)
	
	nb_name = self.GetName()
	if nb_name =='g':   relationship = 'guardian'
	elif nb_name =='f': relationship = 'father'
	else:               relationship = 'mother'
	data.append(relationship)
	
	##rint'DATA Update Guardian >>', data
		
	sql = "UPDATE guardians \
	          SET (name='%s', address='%s', faith_id=%d, \
			dob = '%s', telp1='%s', telp2='%s',\
			wilayah  = '%s', pob='%s', occ_main_id=%d, \
			occ_other = '%s', nationality_id = %d, relationship='s') \
		WHERE id = %d" % (tuple(data), self.guardian_id)
	#rintsql
	fetch.updateDB(sql)
Пример #16
0
 def OnSave(self, evt):
     if self.new_year:
         sql = "INSERT  INTO schYrs (schYr) VALUES (%d)" % self.new_year
         #rintsql
         yid = fetch.updateDB(sql)
         #rintyid
         
     
     self.schYr =  int(self.choice_schYr.GetStringSelection())
                  
     #rintself.schYr
     self.EndModal(0) 
Пример #17
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)
Пример #18
0
 def OnSave(self, evt):
     #rint'OnSave'
     name =    self.text_ctrl_supplier_name.GetValue().strip()
     address = self.text_ctrl_supplier_address.GetValue()
     telp =    self.text_ctrl_supplier_telp.GetValue()
     if not name:
         fetch.msg('Name required')
         return
     
     if self.editing == True:
         sql = "UPDATE acc_suppliers \
                   SET name='%s', address = '%s', telp='%s' \
                 WHERE id = %d" % (name, address, telp, self.sid)
         # update list
         
     else:
         sql = "INSERT INTO acc_suppliers \
                       (name, address, telp) \
                VALUES ('%s', '%s' ,'%s')" % (name, address, telp)
         
     fetch.updateDB(sql)
     self.displayData()
     self.OnCancel(wx.Event)
Пример #19
0
 def save(self, student_id):
     try: booking_date = self.datectrl_Booking_Fee.GetDbReadyValue()
     except: booking_date = 'Null'
              
     try: observation_date = self.datectrl_Observation.GetDbReadyValue()
     except: observation_date = 'Null'
     
     try: offering_letter_date = self.datectrl_Offer_Letter.GetDbReadyValue()
     except: offering_letter_date = 'Null'
         
     try: admission_fee_date = self.datectrl_Admission_Fee.GetDbReadyValue()
     except: admission_fee_date = 'Null'
           
     try: admission_fee = int(self.text_ctrl_admission.GetValue())
     except: admission_fee = 0
     
     try:booking_fee = int(self.text_ctrl_booking.GetValue())
     except: booking_fee = 0
     
     observation_note = self.text_ctrl_observation_note.GetValue()
    
     ###rintbooking_date, observation_date, offering_letter_date, admission_fee_date
     a = " booking_date = '%s'"         % booking_date        
     b = " observation_date = '%s'"     % observation_date
     c = " offering_letter_date = '%s'" % offering_letter_date
     d = " admission_fee_date = '%s'"   % admission_fee_date
     e = " admission_fee = %d"          % int(admission_fee)
     f = " booking_fee = %d"            % int(booking_fee)
     g = " observation_note = '%s'"     % observation_note
     ###rint ' a,b,c,d, student_id', a,b,c,d, student_id
     sql = "UPDATE students SET \
                   %s, %s, %s,%s, %s, %s, %s \
             WHERE id = %d" % (
                   a,b,c,d,e,f,g,
                   student_id)
     ###rintsql
     fetch.updateDB(sql)
Пример #20
0
 def OnSave(self, evt):
     description  = self.text_ctrl_description.GetValue()
     price        = self.text_ctrl_price.GetValue()
     is_recurring = self.checkbox_is_recurring.GetValue()
     monthly      = self.checkbox_monthly.GetValue()
     valid_from   = self.datectrl_from.GetDbReadyValue()
     valid_to     = self.datectrl_to.GetDbReadyValue()
     product_type = fetch.cmbID(self.choice_type)
     if not price or not description:
         fetch.msg('Not all fields complete')
     
 
     #rint"values",  description, price, is_recurring, monthly, valid_from, valid_to, product_type
     
     if fetch.is_unique_product(description):
         sql = "INSERT INTO acc_products \
                           (description, price, is_recurring, \
                            recurring_monthly, valid_from, valid_to, type) \
                     VALUES ('%s', %d, %d, %d, '%s', '%s', %d) " % (
                             description, int(price), is_recurring,
                             monthly, valid_from, valid_to, product_type)
         #rintsql
         fetch.updateDB(sql)
     self.Close()
Пример #21
0
    def insert(self, dayNo):
        sql = "INSERT INTO excul_schedule \
                  SET day = %d, semester = %d, school_id = %d, schYr = %d" % (
                      dayNo, self.semester_no, self.school_id, gVar.schYr)

        fetch.updateDB(sql)
Пример #22
0
 def remove(self, dayNo):
     sql = "DELETE FROM excul_schedule \
             WHERE day = %d AND semester = %d AND school_id = %d AND schYr = %d" % (
                   dayNo, self.semester_no, self.school_id, gVar.schYr)
     print sql
     fetch.updateDB(sql)
Пример #23
0
 def insertNewActivity(self, activity_name, description):
     if self.activityNameAvailable(activity_name):
         sql = "INSERT INTO excul_activities\
                        SET name ='%s', description ='%s' "  % (activity_name, description)
         #rintsql
         return fetch.updateDB(sql)
Пример #24
0
 def insertNewActivity(self, activity_id, teacher_id):
     sql = "INSERT INTO excul \
                    SET exculset_id =%d, activity_id =%d, employee_id= %d"  % (
                        self.exculset_id, activity_id, teacher_id)
     #rintsql
     return fetch.updateDB(sql)