Exemplo n.º 1
0
    def months_until_stockout(self):
        from corehq.apps.reports.commtrack.standard import (current_stock,
                monthly_consumption)

        current_stock = current_stock(self)
        monthly_consumption = monthly_consumption(self)
        
        if current_stock is None or monthly_consumption is None:
            return None
        else:
            return round(current_stock / monthly_consumption, ndigits=1)
Exemplo n.º 2
0
    def months_until_stockout(self):
        from corehq.apps.reports.commtrack.standard import (current_stock,
                                                            monthly_consumption
                                                            )

        current_stock = current_stock(self)
        monthly_consumption = monthly_consumption(self)

        if current_stock is None or monthly_consumption is None:
            return None
        else:
            return round(current_stock / monthly_consumption, ndigits=1)
Exemplo n.º 3
0
    def to_full_dict(self):
        from corehq.apps.reports.commtrack.standard import monthly_consumption

        data = super(SupplyPointProductCase, self).to_full_dict()
        del data['stocked_out_since']
        data['consumption_rate'] = monthly_consumption(self)

        data['supply_point_name'] = self.get_supply_point_case()['name']
        data['product_name'] = self.get_product()['name']

        #data['emergency_level'] = None
        #data['max_level'] = None

        data['months_until_stockout'] = self.months_until_stockout
        data['stockout_duration_in_months'] = self.stockout_duration_in_months

        return data
Exemplo n.º 4
0
    def to_full_dict(self):
        from corehq.apps.reports.commtrack.standard import monthly_consumption

        data = super(SupplyPointProductCase, self).to_full_dict()
        del data['stocked_out_since']
        data['consumption_rate'] = monthly_consumption(self)

        data['supply_point_name'] = self.get_supply_point_case()['name']
        data['product_name'] = self.get_product()['name']
        
        #data['emergency_level'] = None
        #data['max_level'] = None

        data['months_until_stockout'] = self.months_until_stockout
        data['stockout_duration_in_months'] = self.stockout_duration_in_months

        return data