当前位置: 首页>>代码示例>>Python>>正文


Python Report.select方法代码示例

本文整理汇总了Python中models.Report.select方法的典型用法代码示例。如果您正苦于以下问题:Python Report.select方法的具体用法?Python Report.select怎么用?Python Report.select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在models.Report的用法示例。


在下文中一共展示了Report.select方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: set_data_for

# 需要导入模块: from models import Report [as 别名]
# 或者: from models.Report import select [as 别名]
 def set_data_for(self, value=None):
     products = [(Product.get(id=rpt.product_id).name) for rpt in
                 Report.select(fn.Distinct(Report.product))]
     if value:
         products = [(prod.name) for prod in Product.select().where(Product.name.contains(value))
                     .where(Product.name << products).order_by(Product.name.desc())]
     self.data = [(prd, "") for prd in products]
开发者ID:Ciwara,项目名称:GCiss,代码行数:9,代码来源:invoice.py

示例2: cancellation

# 需要导入模块: from models import Report [as 别名]
# 或者: from models.Report import select [as 别名]
    def cancellation(self):

        buy = self.buy
        reports = Report.select().where(Report.buy == buy)
        list_error = [(check_befor_update_data(report)) for report in reports]
        if list_error == [] or list_error == [[]]:
            reply = QMessageBox.question(
                self,
                "Confirmation",
                "<h3 style='color:red;'>Voulez vous" " vraiment annuler ce rapport" " d'achat?</h3>",
                QMessageBox.Yes | QMessageBox.No,
                QMessageBox.No,
            )

            if reply == QMessageBox.Yes:
                from ui.dashboard import DashbordViewWidget

                buy.deletes_data()
                self.change_main_context(DashbordViewWidget)
        else:
            QMessageBox.about(
                self,
                "Alerte",
                "<h3>Vous ne pousez pas supprimer ce rapport car:</h3>"
                "<ul><li></li>"
                " %(err)s"
                "<li>Après la suppression</li></ul>" % {"err": list_error},
            )
开发者ID:Ciwara,项目名称:GCiss,代码行数:30,代码来源:buy_show.py

示例3: get_query

# 需要导入模块: from models import Report [as 别名]
# 或者: from models.Report import select [as 别名]
 def get_query(self):
     if request.args.get('method', '') == "listURI":
         # monkey patch fields
         self._fields = {self.model: ['latest', 'count', 'uri']}
         return Report.select(Report.uri, fn.Count(Report.id).alias(
             'count'), fn.Max(Report.created).alias('latest')).group_by(
             Report.uri).order_by(fn.Max(Report.created).desc())
     else:
         self._fields = {self.model: self.model._meta.get_field_names()}
         return SessionAuthResource.get_query(self)
开发者ID:ccp0101,项目名称:xssreport,代码行数:12,代码来源:api.py

示例4: set_data_for

# 需要导入模块: from models import Report [as 别名]
# 或者: from models.Report import select [as 别名]
 def set_data_for(self):
     date = self.parent.date_.text()
     self.data = [(rap.product.name,
                   formatted_number(rap.qty),
                   formatted_number(rap.selling_price),
                   rap.qty * rap.selling_price)
                  for rap in Report.select().where(
         Report.type_ == Report.S,
         Report.date < date_on_or_end(date, on=False),
         Report.date > date_on_or_end(date)
     ).order_by(Report.id.desc())]
     self.refresh()
开发者ID:Ciwara,项目名称:GCiss,代码行数:14,代码来源:apricot.py

示例5: set_data_for

# 需要导入模块: from models import Report [as 别名]
# 或者: from models.Report import select [as 别名]
    def set_data_for(self, main_date):

        reports = []
        self.totals = 0
        self.total_sum_d1 = 0
        self.total_sum_d2 = 0
        self.total_sum_d3 = 0
        self.total_sum_d4 = 0
        self.total_sum_d5 = 0
        self.total_sum_d6 = 0
        try:
            self.date_on, self.date_end = main_date.current.current
        except Exception as e:
            self.date_on, self.date_end = main_date.current
        products = [(Product.get(id=rpt.product_id).name) for rpt in
                    Report.select(fn.Distinct(Report.product)).where(
            Report.date >= self.date_on, Report.date <= self.date_end,
            Report.type_ == Report.S)]

        products = [(prod.name) for prod in Product.select().where(
            Product.name << products).order_by(Product.name.desc())]
        for prod_name in products:
            on = date_on_or_end(self.date_on)
            end = date_on_or_end(self.date_end, on=False)
            dict_store = {}
            repts = Report.select().where(Report.type_ == Report.S,
                                          Report.product == Product.get(
                                              name=prod_name))
            dict_store["product"] = prod_name

            dict_store["sum_week"] = repts.select(
                peewee.fn.SUM(Report.qty)).where(Report.date >= on,
                                                 Report.date <= end).scalar() or 0

            self.totals += (dict_store["sum_week"])
            end = on + timedelta(days=1, seconds=-1)
            dict_store["sum_d1"] = repts.select(
                peewee.fn.SUM(Report.qty)).where(Report.date >= on,
                                                 Report.date <= end).scalar() or 0
            self.total_sum_d1 += dict_store["sum_d1"]
            on += timedelta(1)
            end = on + timedelta(days=1, seconds=-1)
            dict_store["sum_d2"] = repts.select(
                peewee.fn.SUM(Report.qty)).where(Report.date >= on,
                                                 Report.date <= end).scalar() or 0
            self.total_sum_d2 += dict_store["sum_d2"]
            on += timedelta(1)
            end = on + timedelta(days=1, seconds=-1)
            dict_store["sum_d3"] = repts.select(
                peewee.fn.SUM(Report.qty)).where(Report.date >= on,
                                                 Report.date <= end).scalar() or 0
            self.total_sum_d3 += dict_store["sum_d3"]
            on += timedelta(1)
            end = on + timedelta(days=1, seconds=-1)
            dict_store["sum_d4"] = repts.select(
                peewee.fn.SUM(Report.qty)).where(Report.date >= on,
                                                 Report.date <= end).scalar() or 0
            self.total_sum_d4 += dict_store["sum_d4"]
            on += timedelta(1)
            end = on + timedelta(days=1, seconds=-1)
            dict_store["sum_d5"] = repts.select(
                peewee.fn.SUM(Report.qty)).where(Report.date >= on,
                                                 Report.date <= end).scalar() or 0
            self.total_sum_d5 += dict_store["sum_d5"]
            on += timedelta(1)
            end = on + timedelta(days=1, seconds=-1)
            dict_store["sum_d6"] = repts.select(
                peewee.fn.SUM(Report.qty)).where(Report.date >= on,
                                                 Report.date <= end).scalar() or 0
            self.total_sum_d6 += dict_store["sum_d6"]
            reports.append(dict_store)

        self.data = [(rep.get('product'), rep.get('sum_d1'),
                      rep.get('sum_d2'), rep.get('sum_d3'), rep.get('sum_d4'),
                      rep.get('sum_d5'), rep.get('sum_d6'),
                      rep.get('sum_week'), "") for rep in reports]
开发者ID:Ciwara,项目名称:GCiss,代码行数:78,代码来源:stats.py


注:本文中的models.Report.select方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。