def test_get_usage_type_cost_sum_forecast(self): result = UsagePlugin._get_total_cost_by_warehouses( start=datetime.date(2013, 10, 10), end=datetime.date(2013, 10, 20), usage_type=self.usage_type_cost_sum, ventures=[self.venture1], forecast=True, ) # 5-12: (usages are from 8 to 12) # usage: 5 * (30 + 60 + 90 + 120) = 1500; # cost: 2000 + 20000 = 22000; # price = 22000 / 1500 = 14.(6); # 13-17: # usage: 5 * (30 + 60) = 1500; # cost: 3000 + 30000 = 33000; # price = 33000 / 1500 = 22; # 18-25: (usages are from 18 to 22) # usage: 5 * (30 + 60) = 1500; # cost: 5000 + 50000 = 55000; # price = 55000 / 1500 = 36.(6); # # 10-12: usage: 3 * 30 = 90; cost: 90 * 14.(6) = 1320 # 13-17: usage: 5 * 30 = 150; cost: 150 * 22 = 3300 # 18-20: usage: 3 * 30 = 90; cost = 90 * 36.(6) = 3300 # total: usage: 330; cost: 7920 self.assertEquals(result, [330.0, D('7920')])
def test_get_usage_type_cost_sum_forecast(self): result = UsagePlugin._get_total_cost_by_warehouses( start=datetime.date(2013, 10, 10), end=datetime.date(2013, 10, 20), usage_type=self.usage_type_cost_sum, ventures=[self.venture1], forecast=True, ) # 5-12: (usages are from 8 to 12) # usage: 5 * (30 + 60 + 90 + 120) = 1500; # cost: 2000 + 20000 = 22000; # price = 22000 / 1500 = 14.(6); # 13-17: # usage: 5 * (30 + 60) = 1500; # cost: 3000 + 30000 = 33000; # price = 33000 / 1500 = 22; # 18-25: (usages are from 18 to 22) # usage: 5 * (30 + 60) = 1500; # cost: 5000 + 50000 = 55000; # price = 55000 / 1500 = 36.(6); # # 10-12: usage: 3 * 30 = 90; cost: 90 * 14.(6) = 1320 # 13-17: usage: 5 * 30 = 150; cost: 150 * 22 = 3300 # 18-20: usage: 3 * 30 = 90; cost = 90 * 36.(6) = 3300 # total: usage: 330; cost: 7920 self.assertEquals(result, [330.0, D('7920')])
def test_get_usage_type_cost_sum(self): result = UsagePlugin._get_total_cost_by_warehouses( start=datetime.date(2013, 10, 10), end=datetime.date(2013, 10, 20), usage_type=self.usage_type_cost_sum, ventures=self.ventures_subset, forecast=False, ) # 5-12: (usages are from 8 to 12) # usage: 5 * (30 + 60 + 90 + 120) = 1500; # cost: 1000 + 10000 = 11000; # price = 11000 / 1500 = 7.(3); # 13-17: # usage: 5 * (30 + 60) = 1500; # cost: 2000 + 20000 = 22000; # price = 22000 / 1500 = 14.(6); # 18-25: (usages are from 18 to 22) # usage: 5 * (30 + 60) = 1500; # cost: 4000 + 40000 = 44000; # price = 11000 / 1500 = 29.(3); # # 10-12: # usage: 3 * (30 + 60) = 270; # cost: 270 * 7.(3) = 1980 # 13-17: # usage: 5 * (30 + 60) = 450; # cost: 450 * 14.(6) = 6600 # 18-20: # usage: 3 * (30 + 60) = 270; # cost: 270 * 29.(3) = 7920 # # total cost: 1980 + 6600 + 7920 = 16500 self.assertEquals(result, [990.0, D('16500')])
def test_get_usage_type_cost_sum(self): result = UsagePlugin._get_total_cost_by_warehouses( start=datetime.date(2013, 10, 10), end=datetime.date(2013, 10, 20), usage_type=self.usage_type_cost_sum, ventures=self.ventures_subset, forecast=False, ) # 5-12: (usages are from 8 to 12) # usage: 5 * (30 + 60 + 90 + 120) = 1500; # cost: 1000 + 10000 = 11000; # price = 11000 / 1500 = 7.(3); # 13-17: # usage: 5 * (30 + 60) = 1500; # cost: 2000 + 20000 = 11000; # price = 22000 / 1500 = 14.(6); # 18-25: (usages are from 18 to 22) # usage: 5 * (30 + 60) = 1500; # cost: 4000 + 40000 = 44000; # price = 11000 / 1500 = 29.(3); # # 10-12: # usage: 3 * (30 + 60) = 270; # cost: 270 * 7.(3) = 1980 # 13-17: # usage: 5 * (30 + 60) = 450; # cost: 450 * 14.(6) = 6600 # 18-20: # usage: 3 * (30 + 60) = 270; # cost: 270 * 29.(3) = 7920 # # total cost: 1980 + 6600 + 7920 = 16500 self.assertEquals(result, [990.0, D('16500')])
def test_get_usage_type_cost_by_cost_forecast(self): result = UsagePlugin._get_total_cost_by_warehouses( start=datetime.date(2013, 10, 10), end=datetime.date(2013, 10, 20), usage_type=self.usage_type_cost_wh, ventures=[self.venture1], forecast=True, ) # 5-12: (usages are from 8 to 12) # warehouse1: # usage: 2 * (20 + 40 + 60 + 80) = 400; # cost: 2400; # price = 2400 / 400 = 6; # warehouse2: # usage: 3 * (20 + 40 + 60 + 80) = 600; # cost: 5400; # price = 5400 / 600 = 9; # 13-17: # warehouse1: # usage: 3 * (20 + 40 + 60 + 80) = 600; # cost: 5400 # price = 5400 / 600 = 9; # warehouse2: # usage: 2 * (20 + 40 + 60 + 80) = 400; # cost: 1200 # price = 1200 / 400 = 3; # 18-25: (usages are from 18 to 22) # warehouse1: # usage: 2 * (20 + 40 + 60 + 80) = 400; # cost: 12000 # price = 12000 / 400 = 30; # warehouse2: # usage: 3 * (20 + 40 + 60 + 80) = 600; # cost: 3600 # price = 3600 / 600 = 6; # 10-12: # warehouse1: usage: 1 * 20 = 20; # cost: 20 * 6 = 120 # warehouse2: usage: 2 * 20 = 40; # cost: 40 * 9 = 360 # 13-17: # warehouse1: usage: 3 * 20 = 60; # cost: 60 * 9 = 540 # warehouse2: usage: 2 * 20 = 40; # cost: 40 * 3 = 120 # 18-20: # warehouse1: usage: 1 * 20 = 20; # cost: 20 * 30 = 600 # warehouse2: usage: 2 * 20 = 40; # cost: 40 * 6 = 240 # total: # warehouse1: usage: 100; cost: 1260 # warehouse2: usage: 120; cost: 720 # total: cost: 1980 self.assertEquals( result, [100.0, D('1260'), 120.0, D('720'), D('1980')] )
def test_get_usage_type_cost_by_cost(self): result = UsagePlugin._get_total_cost_by_warehouses( start=datetime.date(2013, 10, 10), end=datetime.date(2013, 10, 20), usage_type=self.usage_type_cost_wh, ventures=self.ventures_subset, forecast=False, ) # 5-12: (usages are from 8 to 12) # warehouse1: # usage: 2 * (20 + 40 + 60 + 80) = 400; # cost: 3600; # price = 3600 / 400 = 9; # warehouse2: # usage: 3 * (20 + 40 + 60 + 80) = 600; # cost: 3600; # price = 3600 / 600 = 6; # 13-17: # warehouse1: # usage: 3 * (20 + 40 + 60 + 80) = 600; # cost: 5400 # price = 5400 / 600 = 9; # warehouse2: # usage: 2 * (20 + 40 + 60 + 80) = 400; # cost: 3600 # price = 3600 / 400 = 9; # 18-25: (usages are from 18 to 22) # warehouse1: # usage: 2 * (20 + 40 + 60 + 80) = 400; # cost: 4800 # price = 4800 / 400 = 12; # warehouse2: # usage: 3 * (20 + 40 + 60 + 80) = 600; # cost: 7200 # price = 7200 / 600 = 12; # 10-12: # warehouse1: usage: 1 * (20 + 40) = 60; # cost: 60 * 9 = 540 # warehouse2: usage: 2 * (20 + 40) = 120; # cost: 120 * 6 = 720 # 13-17: # warehouse1: usage: 3 * (20 + 40) = 180; # cost: 180 * 9 = 1620 # warehouse2: usage: 2 * (20 + 40) = 120; # cost: 120 * 9 = 1080 # 18-20: # warehouse1: usage: 1 * (20 + 40) = 60; # cost: 60 * 12 = 720 # warehouse2: usage: 2 * (20 + 40) = 120; # cost: 120 * 12 = 1440 # total: # warehouse1: usage: 300; cost: 2880 # warehouse2: usage: 360; cost: 3240 # total: cost: 6840 self.assertEquals( result, [300.0, D('2880'), 360.0, D('3240'), D('6120')] )
def test_get_usage_type_cost_by_cost_forecast(self): result = UsagePlugin._get_total_cost_by_warehouses( start=datetime.date(2013, 10, 10), end=datetime.date(2013, 10, 20), usage_type=self.usage_type_cost_wh, ventures=[self.venture1], forecast=True, ) # 5-12: (usages are from 8 to 12) # warehouse1: # usage: 2 * (20 + 40 + 60 + 80) = 400; # cost: 2400; # price = 2400 / 400 = 6; # warehouse2: # usage: 3 * (20 + 40 + 60 + 80) = 600; # cost: 5400; # price = 5400 / 600 = 9; # 13-17: # warehouse1: # usage: 3 * (20 + 40 + 60 + 80) = 600; # cost: 5400 # price = 5400 / 600 = 9; # warehouse2: # usage: 2 * (20 + 40 + 60 + 80) = 400; # cost: 1200 # price = 1200 / 400 = 3; # 18-25: (usages are from 18 to 22) # warehouse1: # usage: 2 * (20 + 40 + 60 + 80) = 400; # cost: 12000 # price = 12000 / 400 = 30; # warehouse2: # usage: 3 * (20 + 40 + 60 + 80) = 600; # cost: 3600 # price = 3600 / 600 = 6; # 10-12: # warehouse1: usage: 1 * 20 = 20; # cost: 20 * 6 = 120 # warehouse2: usage: 2 * 20 = 40; # cost: 40 * 9 = 360 # 13-17: # warehouse1: usage: 3 * 20 = 60; # cost: 60 * 9 = 540 # warehouse2: usage: 2 * 20 = 40; # cost: 40 * 3 = 120 # 18-20: # warehouse1: usage: 1 * 20 = 20; # cost: 20 * 30 = 600 # warehouse2: usage: 2 * 20 = 40; # cost: 40 * 6 = 240 # total: # warehouse1: usage: 100; cost: 1260 # warehouse2: usage: 120; cost: 720 # total: cost: 1980 self.assertEquals( result, [100.0, D('1260'), 120.0, D('720'), D('1980')])
def test_get_usage_type_cost_by_cost(self): result = UsagePlugin._get_total_cost_by_warehouses( start=datetime.date(2013, 10, 10), end=datetime.date(2013, 10, 20), usage_type=self.usage_type_cost_wh, ventures=self.ventures_subset, forecast=False, ) # 5-12: (usages are from 8 to 12) # warehouse1: # usage: 2 * (20 + 40 + 60 + 80) = 400; # cost: 3600; # price = 3600 / 400 = 9; # warehouse2: # usage: 3 * (20 + 40 + 60 + 80) = 600; # cost: 3600; # price = 3600 / 600 = 6; # 13-17: # warehouse1: # usage: 3 * (20 + 40 + 60 + 80) = 600; # cost: 5400 # price = 5400 / 600 = 9; # warehouse2: # usage: 2 * (20 + 40 + 60 + 80) = 400; # cost: 3600 # price = 3600 / 400 = 9; # 18-25: (usages are from 18 to 22) # warehouse1: # usage: 2 * (20 + 40 + 60 + 80) = 400; # cost: 4800 # price = 4800 / 400 = 12; # warehouse2: # usage: 3 * (20 + 40 + 60 + 80) = 600; # cost: 7200 # price = 7200 / 600 = 12; # 10-12: # warehouse1: usage: 1 * (20 + 40) = 60; # cost: 60 * 9 = 540 # warehouse2: usage: 2 * (20 + 40) = 120; # cost: 120 * 6 = 720 # 13-17: # warehouse1: usage: 3 * (20 + 40) = 180; # cost: 180 * 9 = 1620 # warehouse2: usage: 2 * (20 + 40) = 120; # cost: 120 * 9 = 1080 # 18-20: # warehouse1: usage: 1 * (20 + 40) = 60; # cost: 60 * 12 = 720 # warehouse2: usage: 2 * (20 + 40) = 120; # cost: 120 * 12 = 1440 # total: # warehouse1: usage: 300; cost: 2880 # warehouse2: usage: 360; cost: 3240 # total: cost: 6840 self.assertEquals( result, [300.0, D('2880'), 360.0, D('3240'), D('6120')])
def test_get_usage_type_cost_forecast(self): result = UsagePlugin._get_total_cost_by_warehouses( start=datetime.date(2013, 10, 10), end=datetime.date(2013, 10, 20), usage_type=self.usage_type, ventures=[self.venture1], forecast=True, ) # 10-12: usage: 3 * 10 = 30; cost: 30 * 50 = 1500 # 13-17: usage: 5 * 10 = 50; cost: 50 * 60 = 3000 # 18-20: usage: 3 * 10 = 30; cost = 30 * 70 = 2100 # total: usage: 110; cost: 6600 self.assertEquals(result, [110.0, D('6600')])
def test_get_usage_type_cost(self): result = UsagePlugin._get_total_cost_by_warehouses( start=datetime.date(2013, 10, 10), end=datetime.date(2013, 10, 20), usage_type=self.usage_type, ventures=self.ventures_subset, forecast=False, ) # 10-12: usage: 3 * (10 + 20) = 90; cost: 90 * 10 = 900 # 13-17: usage: 5 * (10 + 20) = 150; cost: 150 * 20 = 3000 # 18-20: usage: 3 * (10 + 20) = 90; cost = 90 * 30 = 2700 # total: usage: 330; cost: 6600 self.assertEquals(result, [330.0, D('6600')])
def test_get_usage_type_cost_forecast(self): result = UsagePlugin._get_total_cost_by_warehouses( start=datetime.date(2013, 10, 10), end=datetime.date(2013, 10, 20), usage_type=self.usage_type, ventures=[self.venture1], forecast=True, ) # 10-12: usage: 3 * 10 = 30; cost: 30 * 50 = 1500 # 13-17: usage: 5 * 10 = 50; cost: 50 * 60 = 3000 # 18-20: usage: 3 * 10 = 30; cost = 30 * 70 = 2100 # total: usage: 110; cost: 6600 self.assertEquals(result, [110.0, D('6600')])
def test_get_usage_type_cost(self): result = UsagePlugin._get_total_cost_by_warehouses( start=datetime.date(2013, 10, 10), end=datetime.date(2013, 10, 20), usage_type=self.usage_type, ventures=self.ventures_subset, forecast=False, ) # 10-12: usage: 3 * (10 + 20) = 90; cost: 90 * 10 = 900 # 13-17: usage: 5 * (10 + 20) = 150; cost: 150 * 20 = 3000 # 18-20: usage: 3 * (10 + 20) = 90; cost = 90 * 30 = 2700 # total: usage: 330; cost: 6600 self.assertEquals(result, [330.0, D('6600')])