def __variables__(self): self.ID = self.table.item(self.row, 0).text() self.connBusiness = connBusiness() self.connDB = connDB(self.table.widget.windows.CURRENT_YEAR)
def __connector__(self): self.connBusiness = connBusiness()
def __connector__(self): self.connUser = connUser() self.connBusiness = connBusiness() self.connInfo = connInfo()
def __connector__(self): self.connBusiness = connBusiness() self.connDB = connDB(self.widget.windows.CURRENT_YEAR)
from pandas import DataFrame from os import listdir from setting import databaseMain import connector.connTotal as connTotal from connector.connBusiness import connBusiness from connector.connUser import connUser CONN_BUSINESS = connBusiness() CONN_USER = connUser() def returnTotalPerYear(column=False): listNumbers = CONN_BUSINESS.returnNumbers() listBusiness = CONN_BUSINESS.returnBusinesses() listYears = listdir(databaseMain) columns = ['사업명']+[f"{year.replace('.db', '')}년" for year in listYears]+['합계'] if column: return columns else: resultTotal = [] for number, business in zip(listNumbers, listBusiness): yearTotal = [] for idx, year in enumerate(listYears): year = year.replace('.db', '') listYears[idx] = year dateColumns = connTotal.returnColumns(year)[8:] businessPerYear = connTotal.returnBusinesses(year) if business in businessPerYear: sumQuery = f"SUM(`{'`), SUM(`'.join(dateColumns)}`)" query = f"Select {sumQuery} from Main Where `번호`='{number}' and `적용상태_사업`='적용' and `적용상태_부서원`='적용';" value = sum(connTotal.runQuery_return(year, query))
def __init__(self, year): self.year = year self.path = f"{setting.databaseMain}/{year}.db" self.connUser = connUser() self.connBusiness = connBusiness()