| Line 12... |
Line 12... |
| 12 |
from shop2020.model.v1.catalog.impl import DataService
|
12 |
from shop2020.model.v1.catalog.impl import DataService
|
| 13 |
from shop2020.model.v1.catalog.impl.CategoryManager import CategoryManager
|
13 |
from shop2020.model.v1.catalog.impl.CategoryManager import CategoryManager
|
| 14 |
from shop2020.model.v1.catalog.impl.Convertors import to_t_item, to_t_source
|
14 |
from shop2020.model.v1.catalog.impl.Convertors import to_t_item, to_t_source
|
| 15 |
from shop2020.model.v1.catalog.impl.DataService import Item, ItemChangeLog, \
|
15 |
from shop2020.model.v1.catalog.impl.DataService import Item, ItemChangeLog, \
|
| 16 |
Category, EntityIDGenerator, SimilarItems, ProductNotification, Source, \
|
16 |
Category, EntityIDGenerator, SimilarItems, ProductNotification, Source, \
|
| 17 |
SourceItemPricing, AuthorizationLog, VoucherItemMapping
|
17 |
SourceItemPricing, AuthorizationLog, VoucherItemMapping, CategoryVatMaster
|
| 18 |
from shop2020.thriftpy.model.v1.catalog.ttypes import status, ItemShippingInfo, \
|
18 |
from shop2020.thriftpy.model.v1.catalog.ttypes import status, ItemShippingInfo, \
|
| 19 |
ItemType
|
19 |
ItemType
|
| 20 |
from shop2020.thriftpy.model.v1.inventory.ttypes import \
|
20 |
from shop2020.thriftpy.model.v1.inventory.ttypes import \
|
| 21 |
InventoryServiceException
|
21 |
InventoryServiceException
|
| 22 |
from shop2020.utils import EmailAttachmentSender
|
22 |
from shop2020.utils import EmailAttachmentSender
|
| 23 |
from shop2020.utils.EmailAttachmentSender import mail
|
23 |
from shop2020.utils.EmailAttachmentSender import mail
|
| 24 |
from shop2020.utils.Utils import to_py_date, log_risky_flag
|
24 |
from shop2020.utils.Utils import to_py_date, log_risky_flag
|
| 25 |
from sqlalchemy import desc, asc
|
25 |
from sqlalchemy import desc, asc
|
| 26 |
from sqlalchemy.sql.expression import or_, distinct, func
|
26 |
from sqlalchemy.sql.expression import or_, distinct, func, and_
|
| 27 |
from string import Template
|
27 |
from string import Template
|
| 28 |
import datetime
|
28 |
import datetime
|
| 29 |
import sys
|
29 |
import sys
|
| 30 |
import threading
|
30 |
import threading
|
| 31 |
import urllib2
|
31 |
import urllib2
|
| Line 1227... |
Line 1227... |
| 1227 |
query = Item.query.filter_by(clearance=True)
|
1227 |
query = Item.query.filter_by(clearance=True)
|
| 1228 |
query = query.filter(Item.status.in_(all_status))
|
1228 |
query = query.filter(Item.status.in_(all_status))
|
| 1229 |
query = query.group_by(Item.catalog_item_id).order_by(desc(Item.startDate)).order_by(Item.catalog_item_id)
|
1229 |
query = query.group_by(Item.catalog_item_id).order_by(desc(Item.startDate)).order_by(Item.catalog_item_id)
|
| 1230 |
clearance_sales = query.all()
|
1230 |
clearance_sales = query.all()
|
| 1231 |
return [item.catalog_item_id for item in clearance_sales]
|
1231 |
return [item.catalog_item_id for item in clearance_sales]
|
| - |
|
1232 |
|
| - |
|
1233 |
def get_vat_amount_for_item(itemId, price):
|
| - |
|
1234 |
item = Item.query.filter_by(id=itemId).first()
|
| - |
|
1235 |
vatPercentage = item.vatPercentage
|
| - |
|
1236 |
if vatPercentage is None:
|
| - |
|
1237 |
vatMaster = CategoryVatMaster.query.filter(and_(CategoryVatMaster.categoryId==item.category, CategoryVatMaster.minVal<=price, CategoryVatMaster.maxVal>=price)).first()
|
| - |
|
1238 |
vatPercentage = vatMaster.vatPercent
|
| - |
|
1239 |
if vatPercentage is None:
|
| - |
|
1240 |
vatPercentage = 0
|
| - |
|
1241 |
return (price*vatPercentage)/100
|
| - |
|
1242 |
|
| - |
|
1243 |
def get_vat_percentage_for_item(itemId, price):
|
| - |
|
1244 |
item = Item.query.filter_by(id=itemId).first()
|
| - |
|
1245 |
vatPercentage = item.vatPercentage
|
| - |
|
1246 |
if vatPercentage is None:
|
| - |
|
1247 |
vatMaster = CategoryVatMaster.query.filter(and_(CategoryVatMaster.categoryId==item.category, CategoryVatMaster.minVal<=price, CategoryVatMaster.maxVal>=price)).first()
|
| - |
|
1248 |
vatPercentage = vatMaster.vatPercent
|
| - |
|
1249 |
if vatPercentage is None:
|
| - |
|
1250 |
vatPercentage = 0
|
| - |
|
1251 |
return vatPercentage
|