Exemplo n.º 1
0
def f_gen_rep_detailed_income ():

	title_name = 'Income Report'
	subtitle_name = 'Break-up details of Monthly Income'
	col_headings = ["#", "Month", "Type", "Amount", "Source", "Date"]
	fields = []
	datas = [] 
	file_name = "IncomeReport"
	data_incm_name = []
	data_incm_val = []
	data_comment = []
	data_dt_of_incm = []
	styles = ["bold=True, width=0.3","bold=True, width=0.7","bold=True, width=0.7","money=True, width=0.7", "width=0.7", "width=0.7"]
	for idx in range(len(months_list)):
		
		temp_month = months_list[idx]
		
		for keys in add_inc_commands.keys():
			incm_name = add_inc_commands[keys]
			
			if incm_name == 'SALARY':
				incm_type = temp_month.ttl_incm.salary
			elif incm_name == 'DIVIDEND':
				incm_type = temp_month.ttl_incm.dividend
			elif incm_name == 'INTEREST':
				incm_type = temp_month.ttl_incm.interest
			elif incm_name == 'SHARES':
				incm_type = temp_month.ttl_incm.share_trxn
			elif incm_name == 'BONUS':
				incm_type = temp_month.ttl_incm.bonus
			else:
				print "unsupported option"
				
			for sub_idx in range(len(incm_type.val)):
				data_incm_name.append(incm_name)
				data_incm_val.append(incm_type.val[sub_idx])
				data_comment.append(incm_type.src_of_incm[sub_idx])
				data_dt_of_incm.append(incm_type.dt_of_incm[sub_idx])
				fields.append(misc_utils.split_month(temp_month.name))

	
	datas.append(data_incm_name)
	datas.append(data_incm_val)
	datas.append(data_comment)
	datas.append(data_dt_of_incm)
	
	fields.append('TOTAL')
		# compute the totals
	datas[0].append("")
	datas[1].append(sum(datas[1][::-1]))
	datas[1] = misc_utils.comma_sep(datas[1],1)
	datas[2].append("")
	datas[3].append("")
	
	#pprint(fields)
	#pprint(datas)
	create_reports(fields, fileTypes, title_name, subtitle_name, col_headings, datas, proj_path, file_name, styles)
Exemplo n.º 2
0
def f_gen_rep_detailed_invst ():
	title_name = 'Investments Report'
	subtitle_name = 'Break-up details of Monthly Investments'
	col_headings = ["#", "Category"]
	fields = []
	datas = [] 
	file_name = "InvestmentReport"
	data_invst_val = []
	styles = ["bold=True, width=0.15","bold=False, width=0.85"]
	
	months_data = []

	for keys in add_invst_commands.keys():
		invst_name = add_invst_commands[keys]
		fields.append(invst_name)
		
	for idx in range(len(months_list)):
		m = 0
		invst_val = []
		temp_month = months_list[idx]
		for keys in add_invst_commands.keys():
			m = m + 1
			tmp_invst = temp_month.ttl_investment
			
			# Parse the input and take appropriate action
			eval_str = "tmp_typ = tmp_invst.typ%d" %(m)
			exec(eval_str)
			
			invst_val.append(tmp_typ.total_bal)
		datas.append(invst_val)
		
		col_headings.append(misc_utils.split_month(months_list[idx].name))
		styles.append("width=0.5, money=True")


	fields.append('TOTAL')
	# compute the totals
	y_data = []
	for j in range(len(datas)):
		datas[j].append(sum(datas[j][::-1]))
		y_data.append(datas[j][-1])
		
	horz_total = []
	for k in range(len(datas[0])):
		tmp_sum = 0
		for j in range(len(datas)):
			tmp_sum = tmp_sum + datas[j][k]
		horz_total.append(tmp_sum)
			
	datas = misc_utils.comma_sep(datas,2)
	#pprint(datas)
	#pprint(styles)
	#pprint(col_headings)
	#pprint(fields)
			
	create_reports(fields, fileTypes, title_name, subtitle_name, col_headings, datas, proj_path, file_name, styles)		
Exemplo n.º 3
0
def f_gen_rep_summary ():
	title_name = 'Expense Report'
	subtitle_name = 'Summary of Monthly Expenses'
	col_headings = ["#", "Month", "Income", "Spend", "Investments"]
	fields = []
	file_name = "SummaryReport"
	n = len(months_list)
	months_data = []
	styles = ["bold=True, width=0.3","bold=True, width=0.8","money=True, width=0.8","money=True, width=0.8", "money=True, width=0.7"]
	for idx in range(n):
		months_data.append(months_list[idx].ttl_incm.total_val)
		months_data.append(months_list[idx].ttl_spend.total_val)
		months_data.append(months_list[idx].ttl_investment.total_val)
		fields.append(misc_utils.split_month(months_list[idx].name))
	
	fields.append('TOTAL')
	datas = []
	y_data = []
	for i in [0,1,2]:
		datas.append([])
		y_data.append([])
	
	for i in [0,1,2]:
		datas[i] = months_data[i::3]
		y_data[i] = months_data[i::3]
		
	labels = ['Income', 'Expenditure', 'Investments']
	plot_data.append(y_data)
	plot_data.append(labels)
		
	# compute the totals
	datas[0].append(sum(datas[0][::-1]))
	datas[1].append(sum(datas[1][::-1]))
	datas[2].append(sum(datas[2][::-1]))
	
	datas = misc_utils.comma_sep(datas,2)
	
	#pprint(datas)
	#pprint(fields)
	#pprint(col_headings)
			
	create_reports(fields, fileTypes, title_name, subtitle_name, col_headings, datas, proj_path, file_name, styles)
Exemplo n.º 4
0
def f_gen_rep_detailed_spend ():
	title_name = 'Spend Report'
	subtitle_name = 'Break-up details of Monthly Expenses'
	col_headings = ["#", "Spend Category"]
	fields = []
	datas = [] 
	file_name = "spendReport"
	data_spend_val = []
	styles = ["bold=True, width=0.3","bold=True, width=0.9"]
	
	k = -1
	months_data = []
	
	for keys in add_spn_commands.keys():
		spend_name = add_spn_commands[keys]
		k = k + 1
		fields.append(spend_name)
		
		for idx in range(len(months_list)):
			
			temp_month = months_list[idx]
			
			if spend_name == 'FOOD':
				spend_type = temp_month.ttl_spend.food
			elif spend_name == 'FUEL':
				spend_type = temp_month.ttl_spend.fuel
			elif spend_name == 'VEHICLE':
				spend_type = temp_month.ttl_spend.vehicle
			elif spend_name == 'COMMUTATION':
				spend_type = temp_month.ttl_spend.commutation
			elif spend_name == 'RENT':
				spend_type = temp_month.ttl_spend.rent
			elif spend_name == 'ELECTRICITY':
				spend_type = temp_month.ttl_spend.electricity
			elif spend_name == 'WATER_BILL':
				spend_type = temp_month.ttl_spend.water_bill
			elif spend_name == 'INVESTMENTS':
				spend_type = temp_month.ttl_spend.investment
			elif spend_name == 'TEL_BILLS':
				spend_type = temp_month.ttl_spend.tel_bills
			elif spend_name == 'INSURANCE':
				spend_type = temp_month.ttl_spend.insurance
			elif spend_name == 'STATIONARIES':
				spend_type = temp_month.ttl_spend.stationaries
			elif spend_name == 'EMIS':
				spend_type = temp_month.ttl_spend.emis
			elif spend_name == 'MEDICAL':
				spend_type = temp_month.ttl_spend.medical
			elif spend_name == 'MISC':
				spend_type = temp_month.ttl_spend.misc
				
			else:
				print "unsupported option"
				
			months_data.append(spend_type.value)
	
	datas = []
	n = len(months_list)
	for i in range(n):
		col_headings.append(misc_utils.split_month(months_list[i].name))
		styles.append("width=0.5, money=True")
		datas.append([])
	
	if n != 1:
		for i in range(n):
			datas[i] = months_data[i::n]
	else:
		datas = [months_data]

	fields.append('TOTAL')
	# compute the totals
	y_data = []
	for j in range(len(datas)):
		datas[j].append(sum(datas[j][::-1]))
		y_data.append(datas[j][-1])
	
	horz_total = []
	for k in range(len(datas[0])):
		tmp_sum = 0
		for j in range(len(datas)):
			tmp_sum = tmp_sum + datas[j][k]
		horz_total.append(tmp_sum)
	
	col_headings.append('TOTAL')
	styles.append("width=0.5, money=True")
	datas.append(horz_total)
	datas = misc_utils.comma_sep(datas,2)
	#pprint(horz_total)
	#pprint(months_data)
	#pprint(datas)
	#pprint(col_headings)
	#pprint(fields)

	create_reports(fields, fileTypes, title_name, subtitle_name, col_headings, datas, proj_path, file_name, styles)