-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfilereader.py
More file actions
executable file
·49 lines (39 loc) · 2.39 KB
/
filereader.py
File metadata and controls
executable file
·49 lines (39 loc) · 2.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import csv
writer = csv.writer(open('/home/srrajan/Desktop/partner migration/python/final.csv', 'wb'))
headline=['Partner code','POS','GB','$txn','Profit','Markup','Fee','Tax']
writer.writerow(headline)
reader = csv.DictReader(open('/home/srrajan/Desktop/partner migration/python/All partners.csv', 'rb'))
for row in reader:
GB=''
txn=''
Profit=''
Tax=''
Markup=''
Fee=''
partnercode = row['PARTNER_CODE']
pos=str(partnercode).split("_")[0]
pricingmodel = row['PRICING_\nMODEL_NAME']
if 'Booking' in str(pricingmodel):
GB='Yes'
elif 'Transaction' in str(pricingmodel):
txn='Yes'
elif 'Profit' in str(pricingmodel):
Profit='Yes'
elif 'Formula' in str(pricingmodel):
formula = row['FORMULA']
if 'totalComponentTax' in str(formula) or 'hotelComponentTax' in str(formula):
Tax='Yes'
if 'baseMarkupAmount' in str(formula) or 'hotelPropertyMarkup' in str(formula) or 'distributionPartnerMarkup' in str(formula) or 'hotelMarkupAllRooms' in str(formula):
Markup='Yes'
if 'distributorFee' in str(formula) or 'distPartnerFee' in str(formula) or 'optiFee' in str(formula) or 'customerServiceFee' in str(formula) or 'hotelServiceFee' in str(formula) or 'hotelOptifee' in str(formula) or 'distributorFeeAllRooms' in str(formula):
Fee='Yes'
exceptionformula = ['EXCEPTION_\nFORMULA1']
if 'totalComponentTax' in str(exceptionformula) or 'hotelComponentTax' in str(exceptionformula):
Tax='Yes'
if 'baseMarkupAmount' in str(exceptionformula) or 'hotelPropertyMarkup' in str(exceptionformula) or 'distributionPartnerMarkup' in str(exceptionformula) or 'hotelMarkupAllRooms' in str(exceptionformula):
Markup='Yes'
if 'distributorFee' in str(exceptionformula) or 'distPartnerFee' in str(exceptionformula) or 'optiFee' in str(exceptionformula) or 'customerServiceFee' in str(exceptionformula) or 'hotelServiceFee' in str(exceptionformula) or 'hotelOptifee' in str(exceptionformula) or 'distributorFeeAllRooms' in str(exceptionformula):
Fee='Yes'
data=[partnercode,pos,GB,txn,Profit,Markup,Fee,Tax]
print data
writer.writerow(data)