Ejemplo n.º 1
0
    def generateMIS(self):
        map = {
            "Jan": 1,
            "Feb": 2,
            "Mar": 3,
            "Apr": 4,
            "May": 5,
            "Jun": 6,
            "Jul": 7,
            "Aug": 8,
            "Sep": 9,
            "Oct": 10,
            "Nov": 11,
            "Dec": 12
        }

        self.pg = ProgBar("Loading...")

        if self.data_input_type.get() == 1:
            as_of_date = self.cache_most_recent_date
            self.MIS_cache_path = self.def_network_cache_path + "MIS/archived/" + self.cache_most_recent_date.strftime(
                "%Y-%m-%d")
        elif self.data_input_type.get() == 2:
            tmp_date = date(int(self.cur_year.get()),
                            map[self.cur_month.get()], 1)
            as_of_date = datetime(
                tmp_date.year, tmp_date.month,
                self.getEndOfMonth(tmp_date.month, tmp_date.year))
            self.downloadCache(as_of_date)
        elif self.data_input_type.get() == 3:
            tmp_date = date(int(self.cache_year_var.get()),
                            map[self.cache_month_var.get()], 1)
            as_of_date = datetime(
                tmp_date.year, tmp_date.month,
                self.getEndOfMonth(tmp_date.month, tmp_date.year))
            self.MIS_cache_path = self.def_network_cache_path + "MIS/archived/" + as_of_date.strftime(
                "%Y-%m-%d")

        if not self.early_terminate:
            self.loadFundMan()
            time.sleep(.25)

            self.pg.exit()
            del self.pg

            self.fundman.processFinalFunds(self.final_funds)
            self.fundman.processPassThroughFunds(self.pass_through_funds)

            path = self.report_out_path.get()
            m = MISReportGenerator(self.fundman)
            m.generateReport(path, as_of_date, self.truncate)

            subprocess.Popen("\"" + path + "\"", shell=True)
        else:
            del self.pg
            self.early_terminate = False
Ejemplo n.º 2
0
    def generateHoldingSummary(self):
        map = {
            "Jan": 1,
            "Feb": 2,
            "Mar": 3,
            "Apr": 4,
            "May": 5,
            "Jun": 6,
            "Jul": 7,
            "Aug": 8,
            "Sep": 9,
            "Oct": 10,
            "Nov": 11,
            "Dec": 12
        }

        self.pg = ProgBar("Loading...")

        if self.data_input_type.get() == 1:
            as_of_date = self.cache_most_recent_date
            self.MIS_cache_path = self.def_network_cache_path + "MIS/archived/" + self.cache_most_recent_date.strftime(
                "%Y-%m-%d")
        elif self.data_input_type.get() == 2:
            tmp_date = date(int(self.cur_year.get()),
                            map[self.cur_month.get()], 1)
            as_of_date = datetime(
                tmp_date.year, tmp_date.month,
                self.getEndOfMonth(tmp_date.month, tmp_date.year))
            self.downloadCache(as_of_date)
        elif self.data_input_type.get() == 3:
            tmp_date = date(int(self.cache_year_var.get()),
                            map[self.cache_month_var.get()], 1)
            as_of_date = datetime(
                tmp_date.year, tmp_date.month,
                self.getEndOfMonth(tmp_date.month, tmp_date.year))
            self.MIS_cache_path = self.def_network_cache_path + "MIS/archived/" + as_of_date.strftime(
                "%Y-%m-%d")

        if not self.early_terminate:
            self.loadFundMan()
            time.sleep(.25)

            self.pg.exit()
            del self.pg

            self.fundman.processFinalFunds(self.final_funds)
            self.fundman.processPassThroughFunds(self.pass_through_funds)

            path = self.report_out_path.get()
            f = FundSummaryGenerator(self.fundman)

            if self.export_type.get() == 0:
                f.generateReport(self.sort_by.get(), self.sort_order.get(),
                                 path, as_of_date)
                subprocess.Popen("\"" + path + "\"", shell=True)
            else:
                path = path.split(".")[0]
                path += ".xls"
                filename = path.split("/")

                filename = filename[len(filename) - 1]
                rep_path = path[0:len(path) - len(filename)]

                f.exportToExcel(self.sort_by.get(), self.sort_order.get(),
                                rep_path, filename)
        else:
            del self.pg
            self.early_terminate = False