예제 #1
0
파일: summarytab.py 프로젝트: mape90/VetApp
    def __init__(self, parent=None,item=None):
        GenericTab.__init__(self, parent=parent, item=None)
        self.ui = Ui_SummaryTab()
        self.ui.setupUi(self)
        self.returnItem = False
        self.visitanimal = None

        if type(item) is dict:
            if 'owner' in item:
                self.ui.ownerNameLabel.setText(item['owner'].name)
            else:
                logERROR(self, "SummaryTab.init: owner not found from dict")
            if 'visitanimal' in item:
                self.visitanimal = item['visitanimal']
                self.ui.animalNameLabel.setText(item['visitanimal'].animal.name)
            else:
                logERROR(self, "SummaryTab.init: owner not found from dict")
            if 'text' in item:
                self.addText(item['text'])
            else:
                logERROR(self, "SummaryTab.init: text not found from dict")
        else:
            logDEBUG(self, "SummaryTab.init: item is not dict it is: "+ item)
        
        self.session = SqlHandler.newSession()
        
        self.itemSearchEdit = SearchLineEdit(tabcreator=AddNewSummary, 
                                             session=self.session, 
                                             parent=self, 
                                             function=SqlHandler.searchSummary)
        
        self.configure()
        self.configureConnctions()
예제 #2
0
 def canCloseTab(self):
     logDEBUG(self, 'GenericTab  FUNCTIO: CanCloseTab')
     if self.hasChanged():
         if self.saveAble():
             return self.askUserIfCanClose()
         else:
             return True
     else:
         return True
예제 #3
0
    def getTotalPrice(self):
        total = 0.0
        for i in range(0, 4):
            tmp = self.getALVXPrice(i)
            logDEBUG("tmp", tmp)
            total += tmp

        logDEBUG("Total price: ", total)
        return total
예제 #4
0
파일: bill.py 프로젝트: mape90/VetApp
 def getTotalPrice(self):
     total = 0.0
     for i in range(0,4):
         tmp = self.getALVXPrice(i)
         logDEBUG("tmp", tmp )
         total += tmp
     
     logDEBUG("Total price: ", total)
     return total
예제 #5
0
파일: operation.py 프로젝트: mape90/VetApp
 def getItems(self):
     tmp = []
     if hasattr(self.base, 'item'):
         logDEBUG(self.base, "has item")
         tmp.append(self.base.item)
     if hasattr(self, 'items'):
         logDEBUG(self, "has items")
         for i in self.items: #list has surgery items
             tmp.append(i.item)
     return tmp
예제 #6
0
 def getItems(self):
     tmp = []
     if hasattr(self.base, 'item'):
         logDEBUG(self.base, "has item")
         tmp.append(self.base.item)
     if hasattr(self, 'items'):
         logDEBUG(self, "has items")
         for i in self.items:  #list has surgery items
             tmp.append(i.item)
     return tmp
예제 #7
0
 def askUserIfCanClose(self):
     logDEBUG(self, 'GenericTab FUNCTIO: askUserIfCanClose')
     reply = QMessageBox.question(self, 'Viesti', self.getMessageBoxText(),
                                  QMessageBox.Save, QMessageBox.Cancel,
                                  QMessageBox.Discard)
     if reply == QMessageBox.Save:
         self.saveTab()
         return True
     elif reply == QMessageBox.Discard:
         return True
     else:
         return False
예제 #8
0
파일: operation.py 프로젝트: mape90/VetApp
 def _addItemToPrice(self, item, price_dict, _count = 1):
     _type = item.getType()
     logDEBUG("Operation -> getPriceDict() item type: ", _type)
     _price = (item.price * _count)
     if(_type in ['Vaccine', 'Drug','Medicine']):
         price_dict["medicine_price"] += _price
     elif(_type in ['Feed']):
         price_dict["diet_price"] += _price
     elif(_type in ['Item']):
         price_dict["accesories_price"] += _price
     else:
         logERROR("Operation -> getPriceDict(), base.item has unspesified type: ", _type)
     return price_dict
예제 #9
0
 def _addItemToPrice(self, item, price_dict, _count=1):
     _type = item.getType()
     logDEBUG("Operation -> getPriceDict() item type: ", _type)
     _price = (item.price * _count)
     if (_type in ['Vaccine', 'Drug', 'Medicine']):
         price_dict["medicine_price"] += _price
     elif (_type in ['Feed']):
         price_dict["diet_price"] += _price
     elif (_type in ['Item']):
         price_dict["accesories_price"] += _price
     else:
         logERROR(
             "Operation -> getPriceDict(), base.item has unspesified type: ",
             _type)
     return price_dict
예제 #10
0
 def saveTab(self):
     logDEBUG(self, 'GenericTab FUNCTIO: SaveTab')
     #check if tab is valid
     if self.saveAble():
         #check if there is items
         if self.item == None:
             #here self.item can be set because newToSaved will handle it
             self.item = self.makeItem()
             SqlHandler.addItem(self.session, self.item)
             self.update()
             Tabmanager.newToSaved(self)
         else:
             self.item.update(self.getData())
             SqlHandler.commitSession(self.session)
     else:
         from models.translationtables import g_save_error_message
         self.errorMessage(g_save_error_message)
예제 #11
0
 def saveAndCloseTab(self):
     logDEBUG(self, 'GenericTab FUNCTIO: saveAndCloseTab')
     tmp_item = None
     if self.saveAble():
         if self.item == None:
             self.item = self.makeItem()
             SqlHandler.addItem(self.session, self.item)
         else:
             if self.hasChanged():
                 #update item if it has changes
                 self.item.update(self.getData())
                 SqlHandler.commitSession(self.session)
             else:
                 pass  #logDEBUG(self,'No')
         self.closeTab()
     else:
         from models.translationtables import g_save_error_message
         self.errorMessage(g_save_error_message)
예제 #12
0
 def openItemFromSearch(self):
     item = self.itemSearchEdit.getCurrentItem()
     if item :
         self.openItem(item)
     else:
         logDEBUG(self,"openItemFromSearch:  item is None");
예제 #13
0
 def closeTab(self):  #SLOT
     logDEBUG(self, 'GenericTab FUNCTIO: closeTab')
     if self.canCloseTab():
         Tabmanager.closeTab(tab=self)
예제 #14
0
 def openItemFromSearch(self):
     item = self.itemSearchEdit.getCurrentItem()
     if item:
         self.openItem(item)
     else:
         logDEBUG(self, "openItemFromSearch:  item is None")