| Line 2... |
Line 2... |
| 2 |
# coding: ascii
|
2 |
# coding: ascii
|
| 3 |
from elixir import *
|
3 |
from elixir import *
|
| 4 |
from shop2020.model.v1.catalog.impl import DataService
|
4 |
from shop2020.model.v1.catalog.impl import DataService
|
| 5 |
from shop2020.model.v1.catalog.impl.DataService import Item, Category,\
|
5 |
from shop2020.model.v1.catalog.impl.DataService import Item, Category,\
|
| 6 |
SnapdealItem
|
6 |
SnapdealItem
|
| - |
|
7 |
from shop2020.thriftpy.model.v1.inventory import ttypes
|
| - |
|
8 |
from shop2020.thriftpy.model.v1.inventory.ttypes import WarehouseType, InventoryType
|
| 7 |
import csv
|
9 |
import csv
|
| 8 |
import datetime
|
10 |
import datetime
|
| 9 |
import optparse
|
11 |
import optparse
|
| 10 |
import xlrd
|
12 |
import xlrd
|
| 11 |
from shop2020.clients.InventoryClient import InventoryClient
|
13 |
from shop2020.clients.InventoryClient import InventoryClient
|
| Line 21... |
Line 23... |
| 21 |
sys.path.insert(0, os.getcwd())
|
23 |
sys.path.insert(0, os.getcwd())
|
| 22 |
|
24 |
|
| 23 |
|
25 |
|
| 24 |
class _SnapdealItemInfo:
|
26 |
class _SnapdealItemInfo:
|
| 25 |
|
27 |
|
| 26 |
def __init__(self, item_id, product_group, category_name, our_nlc, brand, model_name, model_number, color, weight, parent_category):
|
28 |
def __init__(self, item_id, product_group, category_name, our_nlc, brand, model_name, model_number, color, weight, parent_category, totalInventory, risky):
|
| 27 |
self.item_id = item_id
|
29 |
self.item_id = item_id
|
| 28 |
self.product_group = product_group
|
30 |
self.product_group = product_group
|
| 29 |
self.category_name = category_name
|
31 |
self.category_name = category_name
|
| 30 |
self.our_nlc = our_nlc
|
32 |
self.our_nlc = our_nlc
|
| 31 |
self.brand = brand
|
33 |
self.brand = brand
|
| 32 |
self.model_name = model_name
|
34 |
self.model_name = model_name
|
| 33 |
self.model_number = model_number
|
35 |
self.model_number = model_number
|
| 34 |
self.color = color
|
36 |
self.color = color
|
| 35 |
self.weight = weight
|
37 |
self.weight = weight
|
| 36 |
self.parent_category = parent_category
|
38 |
self.parent_category = parent_category
|
| - |
|
39 |
self.totalInventory = totalInventory
|
| - |
|
40 |
self.risky = risky
|
| 37 |
|
41 |
|
| 38 |
|
42 |
|
| 39 |
class SnapdealDetails:
|
43 |
class SnapdealDetails:
|
| 40 |
def __init__(self, supc, ourSp, offerPrice, ourInventory, otherInventory, rank, lowestSellerName,lowestSp,secondLowestSellerName,secondLowestSellerSp,secondLowestSellerInventory):
|
44 |
def __init__(self, supc, ourSp, offerPrice, ourInventory, otherInventory, rank, lowestSellerName,lowestSp,secondLowestSellerName,secondLowestSellerSp,secondLowestSellerInventory,lowestOfferPrice,secondLowestSellerOfferPrice,ourOfferPrice):
|
| 41 |
self.supc = supc
|
45 |
self.supc = supc
|
| 42 |
self.ourSp = ourSp
|
46 |
self.ourSp = ourSp
|
| 43 |
self.offerPrice = offerPrice
|
47 |
self.offerPrice = offerPrice
|
| 44 |
self.ourInventory = ourInventory
|
48 |
self.ourInventory = ourInventory
|
| 45 |
self.otherInventory = otherInventory
|
49 |
self.otherInventory = otherInventory
|
| Line 47... |
Line 51... |
| 47 |
self.lowestSellerName = lowestSellerName
|
51 |
self.lowestSellerName = lowestSellerName
|
| 48 |
self.lowestSp = lowestSp
|
52 |
self.lowestSp = lowestSp
|
| 49 |
self.secondLowestSellerName = secondLowestSellerName
|
53 |
self.secondLowestSellerName = secondLowestSellerName
|
| 50 |
self.secondLowestSellerSp = secondLowestSellerSp
|
54 |
self.secondLowestSellerSp = secondLowestSellerSp
|
| 51 |
self.secondLowestSellerInventory = secondLowestSellerInventory
|
55 |
self.secondLowestSellerInventory = secondLowestSellerInventory
|
| - |
|
56 |
self.lowestOfferPrice = lowestOfferPrice
|
| - |
|
57 |
self.secondLowestSellerOfferPrice = secondLowestSellerOfferPrice
|
| - |
|
58 |
self.ourOfferPrice = ourOfferPrice
|
| 52 |
|
59 |
|
| 53 |
|
60 |
|
| 54 |
def fetchDetails(supc_code):
|
61 |
def fetchDetails(supc_code):
|
| 55 |
url="http://www.snapdeal.com/json/gvbps?supc=%s&catId=91"%(supc_code)
|
62 |
url="http://www.snapdeal.com/json/gvbps?supc=%s&catId=91"%(supc_code)
|
| 56 |
print url
|
63 |
print url
|
| Line 62... |
Line 69... |
| 62 |
vendorInfo = json.loads(json_input)
|
69 |
vendorInfo = json.loads(json_input)
|
| 63 |
rank ,otherInventory ,ourInventory, offerPrice, ourSp,iterator = 0, 0, 0, 0, 0, 0
|
70 |
rank ,otherInventory ,ourInventory, offerPrice, ourSp,iterator = 0, 0, 0, 0, 0, 0
|
| 64 |
secondLowestSellerName=''
|
71 |
secondLowestSellerName=''
|
| 65 |
secondLowestSellerSp=0
|
72 |
secondLowestSellerSp=0
|
| 66 |
secondLowestSellerInventory=0
|
73 |
secondLowestSellerInventory=0
|
| - |
|
74 |
lowestOfferPrice = 0
|
| - |
|
75 |
secondLowestSellerOfferPrice = 0
|
| - |
|
76 |
ourOfferPrice = 0
|
| 67 |
for vendor in vendorInfo:
|
77 |
for vendor in vendorInfo:
|
| 68 |
if iterator == 0:
|
78 |
if iterator == 0:
|
| 69 |
lowestSellerName = vendor['vendorDisplayName']
|
79 |
lowestSellerName = vendor['vendorDisplayName']
|
| - |
|
80 |
lowestSp = vendor['sellingPriceBefIntCashBack']
|
| 70 |
lowestSp = vendor['sellingPrice']
|
81 |
lowestOfferPrice = vendor['sellingPrice']
|
| 71 |
|
82 |
|
| 72 |
if iterator ==1:
|
83 |
if iterator ==1:
|
| 73 |
secondLowestSellerName = vendor['vendorDisplayName']
|
84 |
secondLowestSellerName = vendor['vendorDisplayName']
|
| - |
|
85 |
secondLowestSellerSp = vendor['sellingPriceBefIntCashBack']
|
| 74 |
secondLowestSellerSp = vendor['sellingPrice']
|
86 |
secondLowestSellerOfferPrice = vendor['sellingPrice']
|
| 75 |
secondLowestSellerInventory = vendor['buyableInventory']
|
87 |
secondLowestSellerInventory = vendor['buyableInventory']
|
| 76 |
|
88 |
|
| 77 |
if vendor['vendorDisplayName'] == 'MobilesnMore':
|
89 |
if vendor['vendorDisplayName'] == 'MobilesnMore':
|
| 78 |
ourInventory = vendor['buyableInventory']
|
90 |
ourInventory = vendor['buyableInventory']
|
| - |
|
91 |
ourSp = vendor['sellingPriceBefIntCashBack']
|
| 79 |
ourSp = vendor['sellingPrice']
|
92 |
ourOfferPrice = vendor['sellingPrice']
|
| 80 |
rank = iterator +1
|
93 |
rank = iterator +1
|
| 81 |
else:
|
94 |
else:
|
| 82 |
if rank==0:
|
95 |
if rank==0:
|
| 83 |
otherInventory = otherInventory +vendor['buyableInventory']
|
96 |
otherInventory = otherInventory +vendor['buyableInventory']
|
| 84 |
|
97 |
|
| 85 |
iterator+=1
|
98 |
iterator+=1
|
| 86 |
snapdealDetails = SnapdealDetails(supc_code,ourSp,offerPrice,ourInventory,otherInventory,rank,lowestSellerName,lowestSp,secondLowestSellerName,secondLowestSellerSp,secondLowestSellerInventory)
|
99 |
snapdealDetails = SnapdealDetails(supc_code,ourSp,offerPrice,ourInventory,otherInventory,rank,lowestSellerName,lowestSp,secondLowestSellerName,secondLowestSellerSp,secondLowestSellerInventory,lowestOfferPrice,secondLowestSellerOfferPrice,ourOfferPrice)
|
| 87 |
return snapdealDetails
|
100 |
return snapdealDetails
|
| 88 |
|
101 |
|
| 89 |
|
102 |
|
| 90 |
def read_data(filename):
|
103 |
def read_data(filename):
|
| 91 |
all_lines = []
|
104 |
all_lines = []
|
| Line 102... |
Line 115... |
| 102 |
item = Item.query.filter_by(id=item_id).one()
|
115 |
item = Item.query.filter_by(id=item_id).one()
|
| 103 |
category = Category.query.filter_by(id=item.category).one()
|
116 |
category = Category.query.filter_by(id=item.category).one()
|
| 104 |
snapdeal_item = SnapdealItem.query.filter_by(item_id=item_id).one()
|
117 |
snapdeal_item = SnapdealItem.query.filter_by(item_id=item_id).one()
|
| 105 |
warehouse = iclient.getWarehouse(snapdeal_item.warehouseId)
|
118 |
warehouse = iclient.getWarehouse(snapdeal_item.warehouseId)
|
| 106 |
item_pricing = iclient.getItemPricing(item_id, warehouse.vendor.id)
|
119 |
item_pricing = iclient.getItemPricing(item_id, warehouse.vendor.id)
|
| - |
|
120 |
#TO BE USED LATER
|
| - |
|
121 |
#inventory_snapshot = iclient.getInventorySnapshot(0)
|
| - |
|
122 |
#warehouses_ours = iclient.getWarehouses(WarehouseType._NAMES_TO_VALUES.get("OURS"), InventoryType._NAMES_TO_VALUES.get("GOOD"), 0,0,0)
|
| - |
|
123 |
#warehouses_third_party = iclient.getWarehouses(WarehouseType._NAMES_TO_VALUES.get("THIRD_PARTY "), InventoryType._NAMES_TO_VALUES.get("GOOD"), 0,0,0)
|
| 107 |
one_line = _SnapdealItemInfo(item.id, item.product_group, category.label, item_pricing.nlc, item.brand, item.model_name, item.model_number, item.color, item.weight, category.parent_category_id)
|
124 |
one_line = _SnapdealItemInfo(item.id, item.product_group, category.label, item_pricing.nlc, item.brand, item.model_name, item.model_number, item.color, item.weight, category.parent_category_id, item.risky)
|
| 108 |
all_supc.append(supc)
|
125 |
all_supc.append(supc)
|
| 109 |
all_lines.append(one_line)
|
126 |
all_lines.append(one_line)
|
| 110 |
write_report("/tmp/snapdeal_running.xls", all_lines, all_supc)
|
127 |
write_report("/tmp/snapdeal_running.xls", all_lines, all_supc)
|
| 111 |
|
128 |
|
| 112 |
|
129 |
|
| Line 130... |
Line 147... |
| 130 |
sheet.write(0, 3, "SUPC", heading_xf)
|
147 |
sheet.write(0, 3, "SUPC", heading_xf)
|
| 131 |
sheet.write(0, 4, "Brand", heading_xf)
|
148 |
sheet.write(0, 4, "Brand", heading_xf)
|
| 132 |
sheet.write(0, 5, "Model Name", heading_xf)
|
149 |
sheet.write(0, 5, "Model Name", heading_xf)
|
| 133 |
sheet.write(0, 6, "Model Number", heading_xf)
|
150 |
sheet.write(0, 6, "Model Number", heading_xf)
|
| 134 |
sheet.write(0, 7, "Color", heading_xf)
|
151 |
sheet.write(0, 7, "Color", heading_xf)
|
| - |
|
152 |
sheet.write(0, 8, "Weight", heading_xf)
|
| - |
|
153 |
sheet.write(0, 9, "Risky", heading_xf)
|
| 135 |
sheet.write(0, 8, "Our SP", heading_xf)
|
154 |
sheet.write(0, 10, "Our SP", heading_xf)
|
| 136 |
sheet.write(0, 9, "Our TP", heading_xf)
|
155 |
sheet.write(0, 11, "Our TP", heading_xf)
|
| 137 |
sheet.write(0, 10, "Offer Price", heading_xf)
|
156 |
sheet.write(0, 12, "Offer Price", heading_xf)
|
| 138 |
sheet.write(0, 11, "Our Rank", heading_xf)
|
157 |
sheet.write(0, 13, "Our Rank", heading_xf)
|
| 139 |
sheet.write(0, 12, "Lowest Seller", heading_xf)
|
158 |
sheet.write(0, 14, "Lowest Seller", heading_xf)
|
| 140 |
sheet.write(0, 13, "Lowest SP", heading_xf)
|
159 |
sheet.write(0, 15, "Lowest SP", heading_xf)
|
| 141 |
sheet.write(0, 14, "Lowest TP", heading_xf)
|
160 |
sheet.write(0, 16, "Lowest TP", heading_xf)
|
| 142 |
sheet.write(0, 15, "Lowest Offer Price", heading_xf)
|
161 |
sheet.write(0, 17, "Lowest Offer Price", heading_xf)
|
| 143 |
sheet.write(0, 16, "Inventory of Top Vendors", heading_xf)
|
162 |
sheet.write(0, 18, "Inventory of Top Vendors", heading_xf)
|
| 144 |
sheet.write(0, 17, "Our Inventory", heading_xf)
|
163 |
sheet.write(0, 19, "Our Inventory", heading_xf)
|
| 145 |
sheet.write(0, 18, "Our NLC", heading_xf)
|
164 |
sheet.write(0, 20, "Our NLC", heading_xf)
|
| 146 |
sheet.write(0, 19, "Lowest Possible TP", heading_xf)
|
165 |
sheet.write(0, 21, "Lowest Possible TP", heading_xf)
|
| 147 |
sheet.write(0, 20, "Can Compete", heading_xf)
|
166 |
sheet.write(0, 22, "Can Compete", heading_xf)
|
| 148 |
sheet.write(0, 21, "Proposed TP", heading_xf)
|
167 |
sheet.write(0, 23, "Proposed TP", heading_xf)
|
| 149 |
sheet.write(0, 22, "Proposed SP", heading_xf)
|
168 |
sheet.write(0, 24, "Proposed SP", heading_xf)
|
| 150 |
|
169 |
|
| 151 |
i, sheet_iterator=1,1
|
170 |
i, sheet_iterator=1,1
|
| 152 |
for one_line in all_lines:
|
171 |
for one_line in all_lines:
|
| 153 |
supc = all_supc[i-1]
|
172 |
supc = all_supc[i-1]
|
| 154 |
supc_data = fetchDetails(supc)
|
173 |
supc_data = fetchDetails(supc)
|
| 155 |
|
174 |
|
| 156 |
courierCost = 45
|
175 |
courierCost = 45
|
| 157 |
|
176 |
|
| 158 |
if one_line.weight:
|
177 |
if one_line.weight:
|
| 159 |
slab = int((one_line.weight - .001)/.5)
|
178 |
slab = int(((one_line.weight+100) - .001)/.5)
|
| 160 |
for x in range (0,slab):
|
179 |
for x in range (0,slab):
|
| 161 |
courierCost = courierCost + 35
|
180 |
courierCost = courierCost + 35
|
| 162 |
|
181 |
|
| 163 |
courierCost = courierCost * 1.1236
|
182 |
courierCost = courierCost * 1.1236
|
| 164 |
|
183 |
|
| Line 176... |
Line 195... |
| 176 |
sheet.write(sheet_iterator, 3, supc)
|
195 |
sheet.write(sheet_iterator, 3, supc)
|
| 177 |
sheet.write(sheet_iterator, 4, one_line.brand)
|
196 |
sheet.write(sheet_iterator, 4, one_line.brand)
|
| 178 |
sheet.write(sheet_iterator, 5, one_line.model_name)
|
197 |
sheet.write(sheet_iterator, 5, one_line.model_name)
|
| 179 |
sheet.write(sheet_iterator, 6, one_line.model_number)
|
198 |
sheet.write(sheet_iterator, 6, one_line.model_number)
|
| 180 |
sheet.write(sheet_iterator, 7, one_line.color)
|
199 |
sheet.write(sheet_iterator, 7, one_line.color)
|
| - |
|
200 |
sheet.write(sheet_iterator, 8, one_line.weight)
|
| - |
|
201 |
sheet.write(sheet_iterator, 9, one_line.risky)
|
| 181 |
sheet.write(sheet_iterator, 8, supc_data.ourSp)
|
202 |
sheet.write(sheet_iterator, 10, supc_data.ourSp)
|
| 182 |
sheet.write(sheet_iterator, 9, round(supc_data.ourSp*0.9597-courierCost))
|
203 |
sheet.write(sheet_iterator, 11, round(supc_data.ourSp*0.9597-courierCost))
|
| 183 |
sheet.write(sheet_iterator, 10, supc_data.offerPrice)
|
204 |
sheet.write(sheet_iterator, 12, supc_data.offerPrice)
|
| 184 |
sheet.write(sheet_iterator, 11, supc_data.rank)
|
205 |
sheet.write(sheet_iterator, 13, supc_data.rank)
|
| 185 |
sheet.write(sheet_iterator, 12, supc_data.lowestSellerName)
|
206 |
sheet.write(sheet_iterator, 14, supc_data.lowestSellerName)
|
| 186 |
sheet.write(sheet_iterator, 13, supc_data.lowestSp)
|
207 |
sheet.write(sheet_iterator, 15, supc_data.lowestSp)
|
| 187 |
if one_line.parent_category ==10011:
|
208 |
if one_line.parent_category ==10011:
|
| 188 |
lowestTp = (supc_data.lowestSp*(1-.0803))-courierCost
|
209 |
lowestTp = (supc_data.lowestSp*(1-.0803))-courierCost
|
| 189 |
else:
|
210 |
else:
|
| 190 |
lowestTp = supc_data.lowestSp*0.9497-courierCost
|
211 |
lowestTp = supc_data.lowestSp*0.9497-courierCost
|
| 191 |
sheet.write(sheet_iterator, 14, round(lowestTp))
|
212 |
sheet.write(sheet_iterator, 16, round(lowestTp))
|
| 192 |
sheet.write(sheet_iterator, 15, )
|
213 |
sheet.write(sheet_iterator, 17, )
|
| 193 |
sheet.write(sheet_iterator, 16, supc_data.otherInventory)
|
214 |
sheet.write(sheet_iterator, 18, supc_data.otherInventory)
|
| 194 |
sheet.write(sheet_iterator, 17, supc_data.ourInventory)
|
215 |
sheet.write(sheet_iterator, 19, supc_data.ourInventory)
|
| 195 |
sheet.write(sheet_iterator, 18, one_line.our_nlc)
|
216 |
sheet.write(sheet_iterator, 20, one_line.our_nlc)
|
| 196 |
if supc_data.rank==1:
|
217 |
if supc_data.rank==1:
|
| 197 |
i+=1
|
218 |
i+=1
|
| 198 |
sheet_iterator+=1
|
219 |
sheet_iterator+=1
|
| 199 |
continue
|
220 |
continue
|
| 200 |
lowest_possible_tp = one_line.our_nlc/0.988+15+6
|
221 |
lowest_possible_tp = one_line.our_nlc/0.988+15+6
|
| 201 |
sheet.write(sheet_iterator, 19, round(lowest_possible_tp))
|
222 |
sheet.write(sheet_iterator, 21, round(lowest_possible_tp))
|
| 202 |
proposed_tp = 0
|
223 |
proposed_tp = 0
|
| 203 |
if lowestTp > lowest_possible_tp:
|
224 |
if lowestTp > lowest_possible_tp:
|
| 204 |
sheet.write(sheet_iterator, 20, "Yes")
|
225 |
sheet.write(sheet_iterator, 22, "Yes")
|
| 205 |
proposed_tp = max(lowestTp - max((10, lowestTp*0.001)), lowest_possible_tp)
|
226 |
proposed_tp = max(lowestTp - max((10, lowestTp*0.001)), lowest_possible_tp)
|
| 206 |
sheet.write(sheet_iterator, 21, round(proposed_tp))
|
227 |
sheet.write(sheet_iterator, 23, round(proposed_tp))
|
| 207 |
sheet.write(sheet_iterator, 22, round((proposed_tp+courierCost)/0.9597))
|
228 |
sheet.write(sheet_iterator, 24, round((proposed_tp+courierCost)/0.9597))
|
| 208 |
else:
|
229 |
else:
|
| 209 |
sheet.write(sheet_iterator, 20, "No")
|
230 |
sheet.write(sheet_iterator, 22, "No")
|
| 210 |
i= i+1
|
231 |
i= i+1
|
| 211 |
sheet_iterator+=1
|
232 |
sheet_iterator+=1
|
| 212 |
|
233 |
|
| 213 |
createSheetForBuyBoxItems(buyBoxItems,wbk)
|
234 |
createSheetForBuyBoxItems(buyBoxItems,wbk)
|
| 214 |
wbk.save(filename)
|
235 |
wbk.save(filename)
|
| Line 228... |
Line 249... |
| 228 |
sheet.write(0, 3, "SUPC", heading_xf)
|
249 |
sheet.write(0, 3, "SUPC", heading_xf)
|
| 229 |
sheet.write(0, 4, "Brand", heading_xf)
|
250 |
sheet.write(0, 4, "Brand", heading_xf)
|
| 230 |
sheet.write(0, 5, "Model Name", heading_xf)
|
251 |
sheet.write(0, 5, "Model Name", heading_xf)
|
| 231 |
sheet.write(0, 6, "Model Number", heading_xf)
|
252 |
sheet.write(0, 6, "Model Number", heading_xf)
|
| 232 |
sheet.write(0, 7, "Color", heading_xf)
|
253 |
sheet.write(0, 7, "Color", heading_xf)
|
| - |
|
254 |
sheet.write(0, 8, "Weight", heading_xf)
|
| - |
|
255 |
sheet.write(0, 9, "Risky", heading_xf)
|
| 233 |
sheet.write(0, 8, "Our SP", heading_xf)
|
256 |
sheet.write(0, 10, "Our SP", heading_xf)
|
| 234 |
sheet.write(0, 9, "Our TP", heading_xf)
|
257 |
sheet.write(0, 11, "Our TP", heading_xf)
|
| 235 |
sheet.write(0, 10, "Offer Price", heading_xf)
|
258 |
sheet.write(0, 12, "Offer Price", heading_xf)
|
| 236 |
sheet.write(0, 11, "Our Rank", heading_xf)
|
259 |
sheet.write(0, 13, "Our Rank", heading_xf)
|
| 237 |
sheet.write(0, 12, "Lowest Seller", heading_xf)
|
260 |
sheet.write(0, 14, "Lowest Seller", heading_xf)
|
| 238 |
sheet.write(0, 13, "Lowest Offer Price", heading_xf)
|
261 |
sheet.write(0, 15, "Lowest Offer Price", heading_xf)
|
| 239 |
sheet.write(0, 14, "Second Lowest Seller", heading_xf)
|
262 |
sheet.write(0, 16, "Second Lowest Seller", heading_xf)
|
| 240 |
sheet.write(0, 15, "Second Lowest Price", heading_xf)
|
263 |
sheet.write(0, 17, "Second Lowest Price", heading_xf)
|
| 241 |
sheet.write(0, 16, "Our Inventory", heading_xf)
|
264 |
sheet.write(0, 18, "Our Inventory", heading_xf)
|
| 242 |
sheet.write(0, 17, "Second Lowest Seller Inventory", heading_xf)
|
265 |
sheet.write(0, 19, "Second Lowest Seller Inventory", heading_xf)
|
| 243 |
sheet.write(0, 18, "Our NLC", heading_xf)
|
266 |
sheet.write(0, 20, "Our NLC", heading_xf)
|
| 244 |
sheet.write(0, 19, "Second Lowest Seller TP", heading_xf)
|
267 |
sheet.write(0, 21, "Second Lowest Seller TP", heading_xf)
|
| 245 |
|
268 |
|
| 246 |
i=1
|
269 |
i=1
|
| 247 |
|
270 |
|
| 248 |
for data in buyBoxItems:
|
271 |
for data in buyBoxItems:
|
| 249 |
supc_data =data[0]
|
272 |
supc_data =data[0]
|
| 250 |
one_line = data[1]
|
273 |
one_line = data[1]
|
| 251 |
|
274 |
|
| 252 |
courierCost = 45
|
275 |
courierCost = 45
|
| 253 |
|
276 |
|
| 254 |
if one_line.weight:
|
277 |
if one_line.weight:
|
| 255 |
slab = int((one_line.weight - .001)/.5)
|
278 |
slab = int(((one_line.weight+100) - .001)/.5)
|
| 256 |
for x in range (0,slab):
|
279 |
for x in range (0,slab):
|
| 257 |
courierCost = courierCost + 35
|
280 |
courierCost = courierCost + 35
|
| 258 |
|
281 |
|
| 259 |
courierCost = courierCost * 1.1236
|
282 |
courierCost = courierCost * 1.1236
|
| 260 |
|
283 |
|
| Line 264... |
Line 287... |
| 264 |
sheet.write(i, 3, supc_data.supc)
|
287 |
sheet.write(i, 3, supc_data.supc)
|
| 265 |
sheet.write(i, 4, one_line.brand)
|
288 |
sheet.write(i, 4, one_line.brand)
|
| 266 |
sheet.write(i, 5, one_line.model_name)
|
289 |
sheet.write(i, 5, one_line.model_name)
|
| 267 |
sheet.write(i, 6, one_line.model_number)
|
290 |
sheet.write(i, 6, one_line.model_number)
|
| 268 |
sheet.write(i, 7, one_line.color)
|
291 |
sheet.write(i, 7, one_line.color)
|
| - |
|
292 |
sheet.write(i, 8, one_line.weight)
|
| - |
|
293 |
sheet.write(i, 9, one_line.risky)
|
| 269 |
sheet.write(i, 8, supc_data.ourSp)
|
294 |
sheet.write(i, 10, supc_data.ourSp)
|
| 270 |
sheet.write(i, 9, round(supc_data.ourSp*0.9597-courierCost))
|
295 |
sheet.write(i, 11, round(supc_data.ourSp*0.9597-courierCost))
|
| 271 |
sheet.write(i, 10, supc_data.offerPrice)
|
296 |
sheet.write(i, 12, supc_data.offerPrice)
|
| 272 |
sheet.write(i, 11, supc_data.rank)
|
297 |
sheet.write(i, 13, supc_data.rank)
|
| 273 |
sheet.write(i, 12, supc_data.lowestSellerName)
|
298 |
sheet.write(i, 14, supc_data.lowestSellerName)
|
| 274 |
sheet.write(i, 13, )
|
299 |
sheet.write(i, 15, )
|
| 275 |
sheet.write(i, 14, supc_data.secondLowestSellerName)
|
300 |
sheet.write(i, 16, supc_data.secondLowestSellerName)
|
| 276 |
sheet.write(i, 15, supc_data.secondLowestSellerSp)
|
301 |
sheet.write(i, 17, supc_data.secondLowestSellerSp)
|
| 277 |
sheet.write(i, 16, supc_data.ourInventory)
|
302 |
sheet.write(i, 18, supc_data.ourInventory)
|
| 278 |
sheet.write(i, 17, supc_data.secondLowestSellerInventory)
|
303 |
sheet.write(i, 19, supc_data.secondLowestSellerInventory)
|
| 279 |
sheet.write(i, 18, one_line.our_nlc)
|
304 |
sheet.write(i, 20, one_line.our_nlc)
|
| 280 |
if one_line.parent_category ==10011:
|
305 |
if one_line.parent_category ==10011:
|
| 281 |
lowestTp = (supc_data.secondLowestSellerSp*(1-.0803))-courierCost
|
306 |
lowestTp = (supc_data.secondLowestSellerSp*(1-.0803))-courierCost
|
| 282 |
else:
|
307 |
else:
|
| 283 |
lowestTp = supc_data.secondLowestSellerSp*0.9497-courierCost
|
308 |
lowestTp = supc_data.secondLowestSellerSp*0.9497-courierCost
|
| 284 |
sheet.write(i, 19, round(lowestTp))
|
309 |
sheet.write(i, 21, round(lowestTp))
|
| 285 |
i+=1
|
310 |
i+=1
|
| 286 |
|
311 |
|
| 287 |
|
312 |
|
| 288 |
def main():
|
313 |
def main():
|
| 289 |
parser = optparse.OptionParser()
|
314 |
parser = optparse.OptionParser()
|