Fix: Product, Product Category, Product Permutation, Supplier, Supplier Purchase Order, and Manufacturing Purchase Order architecture update for getting and saving data.

This commit is contained in:
2024-11-02 15:49:40 +00:00
parent 373ed9cebf
commit 4c2e05f4ae
87 changed files with 2891 additions and 1472 deletions

View File

@@ -69,9 +69,9 @@ class Currency(db.Model, Store_Base):
@classmethod @classmethod
def from_DB_get_many_product_catalogue_product_permutation(cls, query_row): def from_DB_get_many_product_catalogue_product_permutation(cls, query_row):
currency = cls() currency = cls()
currency.id_currency = query_row[5] currency.id_currency = query_row[6]
currency.code = query_row[6] currency.code = query_row[7]
currency.symbol = query_row[7] currency.symbol = query_row[8]
return currency return currency
@classmethod @classmethod
def from_DB_get_many_product_price_and_discount_and_delivery_region(cls, query_row): def from_DB_get_many_product_price_and_discount_and_delivery_region(cls, query_row):

View File

@@ -94,13 +94,13 @@ class Manufacturing_Purchase_Order(db.Model, Store_Base):
manufacturing_purchase_order = cls() manufacturing_purchase_order = cls()
manufacturing_purchase_order.id_order = json[cls.ATTR_ID_MANUFACTURING_PURCHASE_ORDER] manufacturing_purchase_order.id_order = json[cls.ATTR_ID_MANUFACTURING_PURCHASE_ORDER]
manufacturing_purchase_order.id_currency = json[cls.ATTR_ID_CURRENCY] manufacturing_purchase_order.id_currency = json[cls.ATTR_ID_CURRENCY]
manufacturing_purchase_order.cost_total_local_VAT_excl = json[cls.FLAG_COST_TOTAL_LOCAL_VAT_EXCL] manufacturing_purchase_order.cost_total_local_VAT_excl = json.get(cls.FLAG_COST_TOTAL_LOCAL_VAT_EXCL, None)
manufacturing_purchase_order.cost_total_local_VAT_incl = json[cls.FLAG_COST_TOTAL_LOCAL_VAT_INCL] manufacturing_purchase_order.cost_total_local_VAT_incl = json.get(cls.FLAG_COST_TOTAL_LOCAL_VAT_INCL, None)
manufacturing_purchase_order.price_total_local_VAT_excl = json[cls.FLAG_PRICE_TOTAL_LOCAL_VAT_EXCL] manufacturing_purchase_order.price_total_local_VAT_excl = json.get(cls.FLAG_PRICE_TOTAL_LOCAL_VAT_EXCL, None)
manufacturing_purchase_order.price_total_local_VAT_incl = json[cls.FLAG_PRICE_TOTAL_LOCAL_VAT_INCL] manufacturing_purchase_order.price_total_local_VAT_incl = json.get(cls.FLAG_PRICE_TOTAL_LOCAL_VAT_INCL, None)
manufacturing_purchase_order.active = json[cls.FLAG_ACTIVE] manufacturing_purchase_order.active = json[cls.FLAG_ACTIVE]
manufacturing_purchase_order.created_on = json[cls.FLAG_CREATED_ON] manufacturing_purchase_order.created_on = json.get(cls.FLAG_CREATED_ON, None)
manufacturing_purchase_order.name = json[cls.FLAG_NAME] manufacturing_purchase_order.name = json.get(cls.FLAG_NAME, None)
return manufacturing_purchase_order return manufacturing_purchase_order
def get_items_preview_str(self): def get_items_preview_str(self):
preview = '' preview = ''
@@ -281,10 +281,12 @@ class Manufacturing_Purchase_Order_Product_Link_Temp(db.Model, Store_Base):
id_unit_latency_manufacture = db.Column(db.Integer) id_unit_latency_manufacture = db.Column(db.Integer)
latency_manufacture: int = db.Column(db.Integer) latency_manufacture: int = db.Column(db.Integer)
display_order: int = db.Column(db.Integer) display_order: int = db.Column(db.Integer)
"""
cost_unit_local_VAT_excl: float = db.Column(db.Float) cost_unit_local_VAT_excl: float = db.Column(db.Float)
cost_unit_local_VAT_incl: float = db.Column(db.Float) cost_unit_local_VAT_incl: float = db.Column(db.Float)
price_unit_local_VAT_excl: float = db.Column(db.Float) price_unit_local_VAT_excl: float = db.Column(db.Float)
price_unit_local_VAT_incl: float = db.Column(db.Float) price_unit_local_VAT_incl: float = db.Column(db.Float)
"""
active: bool = db.Column(db.Boolean) active: bool = db.Column(db.Boolean)
guid: str = db.Column(db.String(36)) guid: str = db.Column(db.String(36))
@classmethod @classmethod
@@ -299,10 +301,12 @@ class Manufacturing_Purchase_Order_Product_Link_Temp(db.Model, Store_Base):
row.id_unit_latency_manufacture = manufacturing_purchase_order_product_link.id_unit_latency_manufacture row.id_unit_latency_manufacture = manufacturing_purchase_order_product_link.id_unit_latency_manufacture
row.latency_manufacture = manufacturing_purchase_order_product_link.latency_manufacture row.latency_manufacture = manufacturing_purchase_order_product_link.latency_manufacture
row.display_order = manufacturing_purchase_order_product_link.display_order row.display_order = manufacturing_purchase_order_product_link.display_order
"""
row.cost_unit_local_VAT_excl = manufacturing_purchase_order_product_link.cost_unit_local_VAT_excl row.cost_unit_local_VAT_excl = manufacturing_purchase_order_product_link.cost_unit_local_VAT_excl
row.cost_unit_local_VAT_incl = manufacturing_purchase_order_product_link.cost_unit_local_VAT_incl row.cost_unit_local_VAT_incl = manufacturing_purchase_order_product_link.cost_unit_local_VAT_incl
row.price_unit_local_VAT_excl = manufacturing_purchase_order_product_link.price_unit_local_VAT_excl row.price_unit_local_VAT_excl = manufacturing_purchase_order_product_link.price_unit_local_VAT_excl
row.price_unit_local_VAT_incl = manufacturing_purchase_order_product_link.price_unit_local_VAT_incl row.price_unit_local_VAT_incl = manufacturing_purchase_order_product_link.price_unit_local_VAT_incl
"""
row.active = 1 if manufacturing_purchase_order_product_link.active else 0 row.active = 1 if manufacturing_purchase_order_product_link.active else 0
return row return row
def __repr__(self): def __repr__(self):
@@ -316,10 +320,6 @@ quantity_produced: {self.quantity_produced}
{self.ATTR_ID_UNIT_MEASUREMENT_LATENCY_MANUFACTURE}: {self.id_unit_latency_manufacture} {self.ATTR_ID_UNIT_MEASUREMENT_LATENCY_MANUFACTURE}: {self.id_unit_latency_manufacture}
latency_manufacture: {self.latency_manufacture} latency_manufacture: {self.latency_manufacture}
display_order: {self.display_order} display_order: {self.display_order}
cost_unit_local_VAT_excl: {self.cost_unit_local_VAT_excl}
cost_unit_local_VAT_incl: {self.cost_unit_local_VAT_incl}
price_unit_local_VAT_excl: {self.price_unit_local_VAT_excl}
price_unit_local_VAT_incl: {self.price_unit_local_VAT_incl}
active: {self.active} active: {self.active}
guid: {self.guid} guid: {self.guid}
''' '''

View File

@@ -201,7 +201,7 @@ class Product(SQLAlchemy_ABC, Store_Base):
product.name = json[cls.FLAG_NAME] product.name = json[cls.FLAG_NAME]
product.has_variations = av.input_bool(json.get(cls.FLAG_HAS_VARIATIONS, None), cls.FLAG_HAS_VARIATIONS, f'{cls.__name__}.from_json') product.has_variations = av.input_bool(json.get(cls.FLAG_HAS_VARIATIONS, None), cls.FLAG_HAS_VARIATIONS, f'{cls.__name__}.from_json')
product.id_access_level_required = json.get(cls.ATTR_ID_ACCESS_LEVEL, None) product.id_access_level_required = json.get(cls.ATTR_ID_ACCESS_LEVEL, None)
product.active = av.input_bool(json.get(cls.FLAG_ACTIVE, None), cls.FLAG_ACTIVE, f'{cls.__name__}.from_json') product.active = 1 if av.input_bool(json[cls.FLAG_ACTIVE], cls.FLAG_ACTIVE, f'{cls.__name__}.from_json') else 0
product.can_view = json.get(cls.FLAG_CAN_VIEW, None) product.can_view = json.get(cls.FLAG_CAN_VIEW, None)
product.can_edit = json.get(cls.FLAG_CAN_EDIT, None) product.can_edit = json.get(cls.FLAG_CAN_EDIT, None)
product.can_admin = json.get(cls.FLAG_CAN_ADMIN, None) product.can_admin = json.get(cls.FLAG_CAN_ADMIN, None)
@@ -894,3 +894,14 @@ class Product_Temp(db.Model, Store_Base):
'created_on': self.created_on, 'created_on': self.created_on,
'created_by': self.created_by 'created_by': self.created_by
""" """
def __repr__(self):
return f'''Product_Temp
id_product: {self.id_product}
id_category: {self.id_category}
name: {self.name}
has_variations: {self.has_variations}
id_access_level_required: {self.id_access_level_required}
active: {self.active}
display_order: {self.display_order}
guid: {self.guid}
'''

View File

@@ -32,7 +32,7 @@ class Product_Category(SQLAlchemy_ABC, Store_Base):
NAME_ATTR_OPTION_VALUE: ClassVar[str] = Store_Base.ATTR_ID_PRODUCT_CATEGORY NAME_ATTR_OPTION_VALUE: ClassVar[str] = Store_Base.ATTR_ID_PRODUCT_CATEGORY
NAME_ATTR_OPTION_TEXT: ClassVar[str] = Store_Base.FLAG_NAME NAME_ATTR_OPTION_TEXT: ClassVar[str] = Store_Base.FLAG_NAME
__tablename__ = 'Shop_Product_Category_Temp' __tablename__ = 'Shop_Product_Category'
id_category = db.Column(db.Integer, primary_key=True) id_category = db.Column(db.Integer, primary_key=True)
code = db.Column(db.String(50)) code = db.Column(db.String(50))
name = db.Column(db.String(255)) name = db.Column(db.String(255))
@@ -214,7 +214,7 @@ class Product_Category(SQLAlchemy_ABC, Store_Base):
category.id_access_level_required = json[cls.ATTR_ID_ACCESS_LEVEL] category.id_access_level_required = json[cls.ATTR_ID_ACCESS_LEVEL]
category.name_access_level_required = json.get(cls.FLAG_ACCESS_LEVEL_REQUIRED, '') category.name_access_level_required = json.get(cls.FLAG_ACCESS_LEVEL_REQUIRED, '')
category.display_order = json[cls.FLAG_DISPLAY_ORDER] category.display_order = json[cls.FLAG_DISPLAY_ORDER]
category.active = json[cls.FLAG_ACTIVE] category.active = 1 if av.input_bool(json[cls.FLAG_ACTIVE], cls.FLAG_ACTIVE, f'{cls.__name__}.from_json') else 0
category.can_view = json.get(cls.FLAG_CAN_VIEW, False) category.can_view = json.get(cls.FLAG_CAN_VIEW, False)
category.can_edit = json.get(cls.FLAG_CAN_EDIT, False) category.can_edit = json.get(cls.FLAG_CAN_EDIT, False)
category.can_admin = json.get(cls.FLAG_CAN_ADMIN, False) category.can_admin = json.get(cls.FLAG_CAN_ADMIN, False)
@@ -471,7 +471,7 @@ class Product_Category_Temp(db.Model, Store_Base):
id_access_level_required: int = db.Column(db.Integer) id_access_level_required: int = db.Column(db.Integer)
active: bool = db.Column(db.Boolean) active: bool = db.Column(db.Boolean)
display_order: int = db.Column(db.Integer) display_order: int = db.Column(db.Integer)
guid: str = db.Column(db.BINARY(36)) guid: str = db.Column(db.String(36))
# created_on: datetime = db.Column(db.DateTime) # created_on: datetime = db.Column(db.DateTime)
# created_by: int = db.Column(db.Integer) # created_by: int = db.Column(db.Integer)

View File

@@ -38,7 +38,6 @@ class Product_Permutation(db.Model, Store_Base):
FLAG_CURRENCY_COST = f'{Currency.ATTR_ID_CURRENCY}_cost' FLAG_CURRENCY_COST = f'{Currency.ATTR_ID_CURRENCY}_cost'
FLAG_CODE_CURRENCY_COST = f'{Currency.FLAG_CODE}_cost' FLAG_CODE_CURRENCY_COST = f'{Currency.FLAG_CODE}_cost'
FLAG_SYMBOL_CURRENCY_COST = f'{Currency.FLAG_SYMBOL}_cost' FLAG_SYMBOL_CURRENCY_COST = f'{Currency.FLAG_SYMBOL}_cost'
FLAG_COST_LOCAL = 'cost_local'
FLAG_PROFIT_LOCAL_MIN = 'profit_local_min' FLAG_PROFIT_LOCAL_MIN = 'profit_local_min'
FLAG_HAS_VARIATIONS = 'has_variations' FLAG_HAS_VARIATIONS = 'has_variations'
FLAG_LATENCY_MANUFACTURE = 'latency_manufacture' FLAG_LATENCY_MANUFACTURE = 'latency_manufacture'
@@ -78,7 +77,8 @@ class Product_Permutation(db.Model, Store_Base):
symbol_currency_cost = db.Column(db.String(3)) symbol_currency_cost = db.Column(db.String(3))
""" """
# currency_cost: Currency # currency_cost: Currency
cost_local = db.Column(db.Float) cost_local_VAT_excl = db.Column(db.Float)
cost_local_VAT_incl = db.Column(db.Float)
profit_local_min = db.Column(db.Float) profit_local_min = db.Column(db.Float)
has_variations = db.Column(db.Boolean) has_variations = db.Column(db.Boolean)
latency_manufacture = db.Column(db.Integer) latency_manufacture = db.Column(db.Integer)
@@ -149,40 +149,41 @@ class Product_Permutation(db.Model, Store_Base):
permutation.id_product = query_row[1] permutation.id_product = query_row[1]
permutation.id_category = query_row[2] permutation.id_category = query_row[2]
permutation.description = query_row[3] permutation.description = query_row[3]
permutation.cost_local = query_row[4] permutation.cost_local_VAT_excl = query_row[4]
permutation.cost_local_VAT_incl = query_row[5]
permutation.currency_cost = Currency.from_DB_get_many_product_catalogue_product_permutation(query_row) permutation.currency_cost = Currency.from_DB_get_many_product_catalogue_product_permutation(query_row)
permutation.profit_local_min = query_row[8] permutation.profit_local_min = query_row[9]
permutation.latency_manufacture = query_row[9] permutation.latency_manufacture = query_row[10]
permutation.id_unit_measurement_quantity = query_row[10] permutation.id_unit_measurement_quantity = query_row[11]
permutation.symbol_unit_measurement_quantity = query_row[11] permutation.symbol_unit_measurement_quantity = query_row[12]
permutation.symbol_is_suffix_not_prefix_unit_measurement_quantity = av.input_bool(query_row[12], cls.FLAG_SYMBOL_IS_SUFFIX_NOT_PREFIX_UNIT_MEASUREMENT_QUANTITY, _m, v_arg_type=v_arg_type) permutation.symbol_is_suffix_not_prefix_unit_measurement_quantity = av.input_bool(query_row[13], cls.FLAG_SYMBOL_IS_SUFFIX_NOT_PREFIX_UNIT_MEASUREMENT_QUANTITY, _m, v_arg_type=v_arg_type)
permutation.name_singular_unit_measurement_quantity = query_row[13] permutation.name_singular_unit_measurement_quantity = query_row[14]
permutation.name_plural_unit_measurement_quantity = query_row[14] permutation.name_plural_unit_measurement_quantity = query_row[15]
permutation.count_unit_measurement_per_quantity_step = query_row[15] permutation.count_unit_measurement_per_quantity_step = query_row[16]
permutation.quantity_min = query_row[16] permutation.quantity_min = query_row[17]
permutation.quantity_max = query_row[17] permutation.quantity_max = query_row[18]
permutation.quantity_stock = query_row[18] permutation.quantity_stock = query_row[19]
permutation.is_subscription = av.input_bool(query_row[19], "is_subscription", _m, v_arg_type=v_arg_type) permutation.is_subscription = av.input_bool(query_row[20], "is_subscription", _m, v_arg_type=v_arg_type)
permutation.id_unit_measurement_interval_recurrence = query_row[20] permutation.id_unit_measurement_interval_recurrence = query_row[21]
permutation.symbol_unit_measurement_interval_recurrence = query_row[21] permutation.symbol_unit_measurement_interval_recurrence = query_row[22]
permutation.symbol_is_suffix_not_prefix_unit_measurement_interval_recurrence = av.input_bool(query_row[22], cls.FLAG_SYMBOL_IS_SUFFIX_NOT_PREFIX_UNIT_MEASUREMENT_INTERVAL_RECURRENCE, _m, v_arg_type=v_arg_type) permutation.symbol_is_suffix_not_prefix_unit_measurement_interval_recurrence = av.input_bool(query_row[23], cls.FLAG_SYMBOL_IS_SUFFIX_NOT_PREFIX_UNIT_MEASUREMENT_INTERVAL_RECURRENCE, _m, v_arg_type=v_arg_type)
permutation.name_singular_unit_measurement_interval_recurrence = query_row[23] permutation.name_singular_unit_measurement_interval_recurrence = query_row[24]
permutation.name_plural_unit_measurement_interval_recurrence = query_row[24] permutation.name_plural_unit_measurement_interval_recurrence = query_row[25]
permutation.count_interval_recurrence = query_row[25] permutation.count_interval_recurrence = query_row[26]
permutation.id_stripe_product = query_row[26] permutation.id_stripe_product = query_row[27]
permutation.does_expire_faster_once_unsealed = av.input_bool(query_row[27], "does_expire_faster_once_unsealed", _m, v_arg_type=v_arg_type) permutation.does_expire_faster_once_unsealed = av.input_bool(query_row[28], "does_expire_faster_once_unsealed", _m, v_arg_type=v_arg_type)
permutation.id_unit_measurement_interval_expiration_unsealed = query_row[28] permutation.id_unit_measurement_interval_expiration_unsealed = query_row[29]
permutation.symbol_unit_measurement_interval_expiration_unsealed = query_row[29] permutation.symbol_unit_measurement_interval_expiration_unsealed = query_row[30]
permutation.symbol_is_suffix_not_prefix_unit_measurement_interval_expiration_unsealed = av.input_bool(query_row[30], cls.FLAG_SYMBOL_IS_SUFFIX_NOT_PREFIX_UNIT_MEASUREMENT_INTERVAL_EXPIRATION_UNSEALED, _m, v_arg_type=v_arg_type) permutation.symbol_is_suffix_not_prefix_unit_measurement_interval_expiration_unsealed = av.input_bool(query_row[31], cls.FLAG_SYMBOL_IS_SUFFIX_NOT_PREFIX_UNIT_MEASUREMENT_INTERVAL_EXPIRATION_UNSEALED, _m, v_arg_type=v_arg_type)
permutation.name_singular_unit_measurement_interval_expiration_unsealed = query_row[31] permutation.name_singular_unit_measurement_interval_expiration_unsealed = query_row[32]
permutation.name_plural_unit_measurement_interval_expiration_unsealed = query_row[32] permutation.name_plural_unit_measurement_interval_expiration_unsealed = query_row[33]
permutation.count_interval_expiration_unsealed = query_row[33] permutation.count_interval_expiration_unsealed = query_row[34]
permutation.has_variations = av.input_bool(query_row[34], cls.FLAG_HAS_VARIATIONS, _m, v_arg_type=v_arg_type) permutation.has_variations = av.input_bool(query_row[35], cls.FLAG_HAS_VARIATIONS, _m, v_arg_type=v_arg_type)
permutation.active = av.input_bool(query_row[35], cls.FLAG_ACTIVE, _m, v_arg_type=v_arg_type) permutation.active = av.input_bool(query_row[36], cls.FLAG_ACTIVE, _m, v_arg_type=v_arg_type)
# permutation.display_order = query_row[27] # permutation.display_order = query_row[27]
permutation.can_view = av.input_bool(query_row[36], "can_view", _m, v_arg_type=v_arg_type) permutation.can_view = av.input_bool(query_row[37], "can_view", _m, v_arg_type=v_arg_type)
permutation.can_edit = av.input_bool(query_row[37], "can_edit", _m, v_arg_type=v_arg_type) permutation.can_edit = av.input_bool(query_row[38], "can_edit", _m, v_arg_type=v_arg_type)
permutation.can_admin = av.input_bool(query_row[38], "can_admin", _m, v_arg_type=v_arg_type) permutation.can_admin = av.input_bool(query_row[39], "can_admin", _m, v_arg_type=v_arg_type)
return permutation return permutation
def from_DB_Stripe_product(query_row): def from_DB_Stripe_product(query_row):
@@ -222,7 +223,8 @@ class Product_Permutation(db.Model, Store_Base):
permutation.id_product = json[cls.ATTR_ID_PRODUCT] permutation.id_product = json[cls.ATTR_ID_PRODUCT]
permutation.id_category = json[cls.ATTR_ID_PRODUCT_CATEGORY] permutation.id_category = json[cls.ATTR_ID_PRODUCT_CATEGORY]
permutation.description = json[cls.FLAG_DESCRIPTION] permutation.description = json[cls.FLAG_DESCRIPTION]
permutation.cost_local = json[cls.FLAG_COST_LOCAL] permutation.cost_local_VAT_excl = json[cls.FLAG_COST_UNIT_LOCAL_VAT_EXCL]
permutation.cost_local_VAT_incl = json.get(cls.FLAG_COST_UNIT_LOCAL_VAT_INCL, None)
permutation.currency_cost = Currency.from_json(json, '_cost') permutation.currency_cost = Currency.from_json(json, '_cost')
permutation.profit_local_min = json[cls.FLAG_PROFIT_LOCAL_MIN] permutation.profit_local_min = json[cls.FLAG_PROFIT_LOCAL_MIN]
permutation.latency_manufacture = json[cls.FLAG_LATENCY_MANUFACTURE] permutation.latency_manufacture = json[cls.FLAG_LATENCY_MANUFACTURE]
@@ -267,7 +269,8 @@ class Product_Permutation(db.Model, Store_Base):
self.ATTR_ID_PRODUCT: self.id_product, self.ATTR_ID_PRODUCT: self.id_product,
self.ATTR_ID_PRODUCT_CATEGORY: self.id_category, self.ATTR_ID_PRODUCT_CATEGORY: self.id_category,
self.FLAG_DESCRIPTION: self.description, self.FLAG_DESCRIPTION: self.description,
self.FLAG_COST_LOCAL: self.cost_local, self.FLAG_COST_UNIT_LOCAL_VAT_EXCL: self.cost_local_VAT_excl,
self.FLAG_COST_UNIT_LOCAL_VAT_INCL: self.cost_local_VAT_incl,
self.FLAG_CURRENCY_COST: self.currency_cost.to_json(), self.FLAG_CURRENCY_COST: self.currency_cost.to_json(),
self.FLAG_PROFIT_LOCAL_MIN: self.profit_local_min, self.FLAG_PROFIT_LOCAL_MIN: self.profit_local_min,
self.FLAG_LATENCY_MANUFACTURE: self.latency_manufacture, self.FLAG_LATENCY_MANUFACTURE: self.latency_manufacture,
@@ -352,7 +355,8 @@ class Product_Permutation(db.Model, Store_Base):
id_product: {self.id_product} id_product: {self.id_product}
id_category: {self.id_category} id_category: {self.id_category}
description: {self.description} description: {self.description}
cost_local: {self.cost_local} cost_local_VAT_excl: {self.cost_local_VAT_excl}
cost_local_VAT_incl: {self.cost_local_VAT_incl}
currency_cost: {self.currency_cost} currency_cost: {self.currency_cost}
latency_manufacture: {self.latency_manufacture} latency_manufacture: {self.latency_manufacture}
id_unit_measurement_quantity: {self.id_unit_measurement_quantity} id_unit_measurement_quantity: {self.id_unit_measurement_quantity}
@@ -468,7 +472,7 @@ class Product_Permutation(db.Model, Store_Base):
Product_Permutation.FLAG_QUANTITY_STOCK: self.quantity_stock, Product_Permutation.FLAG_QUANTITY_STOCK: self.quantity_stock,
Product_Permutation.FLAG_QUANTITY_MIN: self.quantity_min, Product_Permutation.FLAG_QUANTITY_MIN: self.quantity_min,
Product_Permutation.FLAG_QUANTITY_MAX: self.quantity_max, Product_Permutation.FLAG_QUANTITY_MAX: self.quantity_max,
Product_Permutation.FLAG_COST_LOCAL: f"<strong>{self.symbol_currency_cost}</strong>{self.cost_local}" Product_Permutation.FLAG_COST_UNIT_LOCAL_VAT_EXCL: f"<strong>{self.symbol_currency_cost}</strong>{self.cost_local_VAT_excl}"
} }
Helper_App.console_log('permutation row: ', a) Helper_App.console_log('permutation row: ', a)
return a return a
@@ -498,7 +502,8 @@ class Product_Permutation_Temp(db.Model, Store_Base):
id_permutation: int = db.Column(db.Integer, primary_key=True) id_permutation: int = db.Column(db.Integer, primary_key=True)
id_product: int = db.Column(db.Integer) id_product: int = db.Column(db.Integer)
description: str = db.Column(db.String(4000)) description: str = db.Column(db.String(4000))
cost_local: float = db.Column(db.Float) cost_local_VAT_excl: float = db.Column(db.Float)
cost_local_VAT_incl: float = db.Column(db.Float)
id_currency_cost: int = db.Column(db.Integer) id_currency_cost: int = db.Column(db.Integer)
profit_local_min: float = db.Column(db.Float) profit_local_min: float = db.Column(db.Float)
latency_manufacture: int = db.Column(db.Integer) latency_manufacture: int = db.Column(db.Integer)
@@ -519,13 +524,15 @@ class Product_Permutation_Temp(db.Model, Store_Base):
@classmethod @classmethod
def from_product_permutation(cls, product_permutation): def from_product_permutation(cls, product_permutation):
Helper_App.console_log(f'Product_Permutation_Temp.from_product_permutation: {product_permutation}\ntype(cost local): {str(type(product_permutation.cost_local_VAT_excl))}')
row = cls() row = cls()
row.id_permutation = product_permutation.id_permutation row.id_permutation = product_permutation.id_permutation
row.id_product = product_permutation.id_product row.id_product = product_permutation.id_product
row.description = product_permutation.description row.description = product_permutation.description
row.cost_local = product_permutation.cost_local row.cost_local_VAT_excl = product_permutation.cost_local_VAT_excl if product_permutation.cost_local_VAT_excl != 'None' else None
row.cost_local_VAT_incl = product_permutation.cost_local_VAT_incl if product_permutation.cost_local_VAT_incl != 'None' else None
row.id_currency_cost = product_permutation.currency_cost.id_currency row.id_currency_cost = product_permutation.currency_cost.id_currency
row.profit_local_min = product_permutation.profit_local_min row.profit_local_min = product_permutation.profit_local_min if product_permutation.profit_local_min != 'None' else None
row.latency_manufacture = product_permutation.latency_manufacture row.latency_manufacture = product_permutation.latency_manufacture
row.id_unit_measurement_quantity = product_permutation.id_unit_measurement_quantity row.id_unit_measurement_quantity = product_permutation.id_unit_measurement_quantity
row.count_unit_measurement_per_quantity_step = product_permutation.count_unit_measurement_per_quantity_step row.count_unit_measurement_per_quantity_step = product_permutation.count_unit_measurement_per_quantity_step
@@ -546,7 +553,8 @@ class Product_Permutation_Temp(db.Model, Store_Base):
id_permutation: {self.id_permutation} id_permutation: {self.id_permutation}
id_product: {self.id_product} id_product: {self.id_product}
description: {self.description} description: {self.description}
cost_local: {self.cost_local} cost_local_VAT_excl: {self.cost_local_VAT_excl}
cost_local_VAT_incl: {self.cost_local_VAT_incl}
id_currency_cost: {self.id_currency_cost} id_currency_cost: {self.id_currency_cost}
profit_local_min: {self.profit_local_min} profit_local_min: {self.profit_local_min}
latency_manufacture: {self.latency_manufacture} latency_manufacture: {self.latency_manufacture}

View File

@@ -93,6 +93,7 @@ class DataStore_Store_Product_Category(DataStore_Store_Base):
'a_comment': comment, 'a_comment': comment,
'a_guid': guid, 'a_guid': guid,
'a_id_user': user.id_user, 'a_id_user': user.id_user,
'a_debug': 0,
} }
save_result = cls.db_procedure_execute('p_shop_save_product_category', argument_dict_list) save_result = cls.db_procedure_execute('p_shop_save_product_category', argument_dict_list)
save_result.close() save_result.close()

View File

@@ -99,6 +99,7 @@ class DataStore_Store_Product_Permutation(DataStore_Store_Base):
'a_comment': comment, 'a_comment': comment,
'a_guid': guid, 'a_guid': guid,
'a_id_user': user.id_user, 'a_id_user': user.id_user,
'a_debug': 0,
} }
cls.db_procedure_execute('p_shop_save_product_permutation', argument_dict_list) cls.db_procedure_execute('p_shop_save_product_permutation', argument_dict_list)
Helper_App.console_log('saved product permutations') Helper_App.console_log('saved product permutations')

182
pay_stripe.py Normal file
View File

@@ -0,0 +1,182 @@
"""
Project: PARTS Website
Author: Edward Middleton-Smith
Precision And Research Technology Systems Limited
Technology: App General
Feature: App
Description:
Initializes the Flask application, sets the configuration based on the environment, and defines two routes (/ and /about) that render templates with the specified titles.
"""
# IMPORTS
# VARIABLE INSTANTIATION
# METHODS
# IMPORTS
import os
import stripe
import json
from flask import Flask, render_template, render_template_string, jsonify, request, send_from_directory, redirect
from dotenv import load_dotenv, find_dotenv
from config import app_config
# VARIABLE INSTANTIATION
key_secret = os.environ.get("KEY_SECRET_STRIPE")
key_public = os.environ.get("KEY_PUBLIC_STRIPE") # 'pk_test_51OGrxlL7BuLKjoMpfpfw7bSmZZK1MhqMoQ5VhW2jUj7YtoEejO4vqnxKPiqTHHuh9U4qqkywbPCSI9TpFKtr4SYH007KHMWs68'
# METHODS
def create_product_price():
print(f'stripe.api_key = {stripe.api_key}')
starter_subscription = stripe.Product.create(
name="Starter Subscription",
description="$12/Month subscription",
)
starter_subscription_price = stripe.Price.create(
unit_amount=1200,
currency="usd",
recurring={"interval": "month"},
product=starter_subscription['id'],
)
# Save these identifiers
print(f"Success! Here is your starter subscription product id: {starter_subscription.id}")
print(f"Success! Here is your starter subscription price id: {starter_subscription_price.id}")
return starter_subscription_price.id
def get_file_str(f_address):
f = open(f_address)
return f.read()
# Ensure environment variables are set.
price = os.getenv('PRICE')
if price is None or price == 'price_12345' or price == '':
print('You must set a Price ID in .env. Please see the README.')
exit(0)
# For sample support and debugging, not required for production:
stripe.set_app_info(
'stripe-samples/checkout-one-time-payments',
version='0.0.1',
url='https://github.com/stripe-samples/checkout-one-time-payments')
# stripe.api_version = '2020-08-27'
stripe.api_key = key_secret # os.getenv('KEY_SECRET_STRIPE')
# app_dir = str(os.path.abspath(os.path.join(
# __file__, "..", "..")))
# static_dir = str(os.path.abspath(os.path.join(
# app_dir, os.getenv("STATIC_DIR"))))
# template_dir = str(os.path.abspath(os.path.join(
# app_dir, os.getenv("TEMPLATE_DIR"))))
app = Flask(__name__) # , static_folder=static_dir,
# static_url_path="", template_folder=template_dir)
app.config.from_object(app_config)
@app.route('/', methods=['GET'])
def home():
# return render_template(f'{app_dir}\\templates\\_home.html') # f'{app_dir}\\templates\\layout.html')
# return render_template_string(get_file_str(f'{app_dir}\\templates\\_home.html')) # f'{app_dir}\\templates\\layout.html')
return render_template('_home.html', title='Home')
@app.route('/store', methods=['GET'])
def store_home():
return render_template('_store_home.html', title='Store Home')
@app.route('/contact')
def contact():
return render_template('_contact.html', title='Contact Us')
@app.route('/config', methods=['GET'])
def get_publishable_key():
price = stripe.Price.retrieve(os.getenv('PRICE'))
return jsonify({
'publicKey': key_public, # os.getenv('KEY_PUBLIC_STRIPE'),
'unitAmount': price['unit_amount'],
'currency': price['currency']
})
# Fetch the Checkout Session to display the JSON result on the success page
@app.route('/checkout-session', methods=['GET'])
def get_checkout_session():
id = request.args.get('sessionId')
print(f'checkout session id: {id}')
checkout_session = stripe.checkout.Session.retrieve(id)
return jsonify(checkout_session)
@app.route('/create-checkout-session', methods=['POST'])
def create_checkout_session():
quantity = request.form.get('quantity', 1)
domain_url = os.getenv('DOMAIN')
try:
# Create new Checkout Session for the order
# Other optional params include:
# [billing_address_collection] - to display billing address details on the page
# [customer] - if you have an existing Stripe Customer ID
# [payment_intent_data] - lets capture the payment later
# [customer_email] - lets you prefill the email input in the form
# [automatic_tax] - to automatically calculate sales tax, VAT and GST in the checkout page
# For full details see https://stripe.com/docs/api/checkout/sessions/create
# ?session_id={CHECKOUT_SESSION_ID} means the redirect will have the session ID set as a query param
checkout_session = stripe.checkout.Session.create(
success_url=domain_url + '/success.html?session_id={CHECKOUT_SESSION_ID}',
cancel_url=domain_url + '/canceled.html',
mode='subscription', # 'payment',
# automatic_tax={'enabled': True},
line_items=[{
'price': os.getenv('PRICE'),
'quantity': quantity,
}]
)
return redirect(checkout_session.url, code=303)
except Exception as e:
return jsonify(error=str(e)), 403
@app.route('/webhook', methods=['POST'])
def webhook_received():
# You can use webhooks to receive information about asynchronous payment events.
# For more about our webhook events check out https://stripe.com/docs/webhooks.
webhook_secret = os.getenv('STRIPE_WEBHOOK_SECRET')
request_data = json.loads(request.data)
if webhook_secret:
# Retrieve the event by verifying the signature using the raw body and secret if webhook signing is configured.
signature = request.headers.get('stripe-signature')
try:
event = stripe.Webhook.construct_event(
payload=request.data, sig_header=signature, secret=webhook_secret)
data = event['data']
except Exception as e:
return e
# Get the type of webhook event sent - used to check the status of PaymentIntents.
event_type = event['type']
else:
data = request_data['data']
event_type = request_data['type']
data_object = data['object']
print('event ' + event_type)
if event_type == 'checkout.session.completed':
print('🔔 Payment succeeded!')
return jsonify({Model_View_Base.FLAG_STATUS: Model_View_Base.FLAG_SUCCESS})
if __name__ == '__main__':
# stripe.api_key = key_secret
# create_product_price()
# Setup Stripe python client library.
load_dotenv(find_dotenv())
app.run(port=4242, debug=True)

54
routes.py Normal file
View File

@@ -0,0 +1,54 @@
"""
Project: PARTS Website
Author: Edward Middleton-Smith
Precision And Research Technology Systems Limited
Technology: Backend
Feature: Controller - Webpage routing
Description:
Defines the routes and view functions for each page.
Manages the interaction between the frontend and backend.
"""
from flask import render_template, url_for, Blueprint
from app import app
from app.forms import Form_Contact
# from forms import MyForm
# from app import MyForm
from model_view_contact import Model_View_Contact
"""
@app.route('/', methods=['GET'])
def home():
return render_template('_home.html', title='Home')
@app.route('/store', methods=['GET'])
def store_home():
return render_template('_store_home.html', title='Store Home')
@app.route('/contact', methods=['GET', 'POST'])
def contact():
form = Form_Contact()
if form.validate_on_submit():
# Handle form submission
email = form.sender_email.data
CC = form.sender_CC.data
name = form.sender_name.data
msg = form.sender_message.data
# return render_template('contact.html', form=form)
# return render_template('_contact.html', title='Contact Us')
return render_template('contact.html', model=Model_View_Contact(form))
@app.route('/about')
def about():
return render_template('about.html')
@app.route('/contact', methods=['GET', 'POST'])
def contact():
form = MyForm()
if form.validate_on_submit():
# Handle form submission
pass
return render_template('contact.html', form=form)
"""

File diff suppressed because it is too large Load Diff

View File

@@ -282,6 +282,7 @@ DROP PROCEDURE IF EXISTS p_shop_get_many_storage_location;
DROP PROCEDURE IF EXISTS p_shop_get_many_currency; DROP PROCEDURE IF EXISTS p_shop_get_many_currency;
DROP PROCEDURE IF EXISTS p_shop_save_category; DROP PROCEDURE IF EXISTS p_shop_save_category;
DROP PROCEDURE IF EXISTS p_shop_save_category_test;
DROP PROCEDURE IF EXISTS p_shop_save_product_category; DROP PROCEDURE IF EXISTS p_shop_save_product_category;
DROP PROCEDURE IF EXISTS p_shop_save_product_category_test; DROP PROCEDURE IF EXISTS p_shop_save_product_category_test;
DROP PROCEDURE IF EXISTS p_shop_save_product; DROP PROCEDURE IF EXISTS p_shop_save_product;
@@ -292,6 +293,7 @@ DROP PROCEDURE IF EXISTS p_shop_get_many_product;
DROP PROCEDURE IF EXISTS p_shop_get_many_stripe_product_new; DROP PROCEDURE IF EXISTS p_shop_get_many_stripe_product_new;
DROP PROCEDURE IF EXISTS p_shop_save_permutation; DROP PROCEDURE IF EXISTS p_shop_save_permutation;
DROP PROCEDURE IF EXISTS p_shop_save_product_permutation; DROP PROCEDURE IF EXISTS p_shop_save_product_permutation;
DROP PROCEDURE IF EXISTS p_shop_save_product_permutation_test;
DROP PROCEDURE IF EXISTS p_shop_get_many_product_variation; DROP PROCEDURE IF EXISTS p_shop_get_many_product_variation;
DROP FUNCTION IF EXISTS fn_shop_get_id_product_permutation_from_variation_csv_list; DROP FUNCTION IF EXISTS fn_shop_get_id_product_permutation_from_variation_csv_list;
DROP PROCEDURE IF EXISTS p_shop_save_stock_item; DROP PROCEDURE IF EXISTS p_shop_save_stock_item;
@@ -313,6 +315,7 @@ DROP PROCEDURE IF EXISTS p_shop_save_supplier_purchase_order;
DROP PROCEDURE IF EXISTS p_shop_save_supplier_purchase_order_test; DROP PROCEDURE IF EXISTS p_shop_save_supplier_purchase_order_test;
DROP PROCEDURE IF EXISTS p_shop_get_many_supplier_purchase_order; DROP PROCEDURE IF EXISTS p_shop_get_many_supplier_purchase_order;
DROP PROCEDURE IF EXISTS p_shop_save_manufacturing_purchase_order; DROP PROCEDURE IF EXISTS p_shop_save_manufacturing_purchase_order;
DROP PROCEDURE IF EXISTS p_shop_save_manufacturing_purchase_order_test;
DROP PROCEDURE IF EXISTS p_shop_get_many_manufacturing_purchase_order; DROP PROCEDURE IF EXISTS p_shop_get_many_manufacturing_purchase_order;
DROP PROCEDURE IF EXISTS p_shop_save_customer; DROP PROCEDURE IF EXISTS p_shop_save_customer;
DROP PROCEDURE IF EXISTS p_shop_get_many_customer; DROP PROCEDURE IF EXISTS p_shop_get_many_customer;

View File

@@ -12,9 +12,9 @@ CREATE TABLE IF NOT EXISTS Shop_Product_Category_Temp (
, description VARCHAR(4000) NULL , description VARCHAR(4000) NULL
, id_access_level_required INT NOT NULL DEFAULT 1 , id_access_level_required INT NOT NULL DEFAULT 1
, display_order INT NOT NULL , display_order INT NOT NULL
, active BIT NOT NULL , active BIT NULL
, can_view BIT NULL DEFAULT NULL , can_view BIT NULL
, can_edit BIT NULL DEFAULT NULL , can_edit BIT NULL
, can_admin BIT NULL DEFAULT NULL , can_admin BIT NULL
, guid BINARY(36) NOT NULL , guid BINARY(36) NOT NULL
); );

View File

@@ -1,7 +1,7 @@
# Product Permutation # Product Permutation
-- DROP TABLE partsltd_prod.Shop_Product_Permutation;
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Product_Permutation'; SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Product_Permutation';
@@ -14,9 +14,10 @@ CREATE TABLE IF NOT EXISTS Shop_Product_Permutation (
ON UPDATE RESTRICT, ON UPDATE RESTRICT,
-- name VARCHAR(255) NOT NULL, -- name VARCHAR(255) NOT NULL,
description VARCHAR(4000) NOT NULL, description VARCHAR(4000) NOT NULL,
cost_local FLOAT NOT NULL, cost_local_VAT_excl FLOAT NULL,
cost_local_VAT_incl FLOAT NULL,
id_currency_cost INT NOT NULL, id_currency_cost INT NOT NULL,
profit_local_min FLOAT NOT NULL, profit_local_min FLOAT NULL,
-- id_currency_profit_min INT NOT NULL, -- id_currency_profit_min INT NOT NULL,
latency_manufacture INT NOT NULL, latency_manufacture INT NOT NULL,
id_unit_measurement_quantity INT NOT NULL, id_unit_measurement_quantity INT NOT NULL,
@@ -24,8 +25,8 @@ CREATE TABLE IF NOT EXISTS Shop_Product_Permutation (
FOREIGN KEY (id_unit_measurement_quantity) FOREIGN KEY (id_unit_measurement_quantity)
REFERENCES Shop_Unit_Measurement(id_unit_measurement), REFERENCES Shop_Unit_Measurement(id_unit_measurement),
count_unit_measurement_per_quantity_step FLOAT NOT NULL, count_unit_measurement_per_quantity_step FLOAT NOT NULL,
quantity_min FLOAT NOT NULL, quantity_min FLOAT NULL,
quantity_max FLOAT NOT NULL, quantity_max FLOAT NULL,
quantity_stock FLOAT NOT NULL, quantity_stock FLOAT NOT NULL,
is_subscription BIT NOT NULL, is_subscription BIT NOT NULL,
id_unit_measurement_interval_recurrence INT, id_unit_measurement_interval_recurrence INT,
@@ -49,7 +50,7 @@ CREATE TABLE IF NOT EXISTS Shop_Product_Permutation (
*/ */
count_interval_expiration_unsealed INT, count_interval_expiration_unsealed INT,
active BIT NOT NULL DEFAULT 1, active BIT NOT NULL DEFAULT 1,
display_order INT NOT NULL, -- display_order INT NOT NULL,
created_on DATETIME, created_on DATETIME,
created_by INT, created_by INT,
id_change_set INT, id_change_set INT,

View File

@@ -9,9 +9,10 @@ CREATE TABLE IF NOT EXISTS Shop_Product_Permutation_Temp (
id_permutation INT NOT NULL id_permutation INT NOT NULL
, id_product INT NOT NULL , id_product INT NOT NULL
, description VARCHAR(4000) NOT NULL , description VARCHAR(4000) NOT NULL
, cost_local FLOAT NOT NULL , cost_local_VAT_excl FLOAT NULL
, cost_local_VAT_incl FLOAT NULL
, id_currency_cost INT NOT NULL , id_currency_cost INT NOT NULL
, profit_local_min FLOAT NOT NULL , profit_local_min FLOAT NULL
, latency_manufacture INT NOT NULL , latency_manufacture INT NOT NULL
, id_unit_measurement_quantity INT NOT NULL , id_unit_measurement_quantity INT NOT NULL
, count_unit_measurement_per_quantity_step FLOAT NOT NULL , count_unit_measurement_per_quantity_step FLOAT NOT NULL

View File

@@ -28,6 +28,6 @@ CREATE TABLE IF NOT EXISTS Shop_Supplier (
, id_change_set INT , id_change_set INT
, CONSTRAINT FK_Shop_Supplier_id_change_set , CONSTRAINT FK_Shop_Supplier_id_change_set
FOREIGN KEY (id_change_set) FOREIGN KEY (id_change_set)
REFERENCES Shop_Sales_And_Purchasing_Change_Set(id_change_set) REFERENCES Shop_User_Change_Set(id_change_set)
, id_supplier_temp INT NOT NULL , id_supplier_temp INT NOT NULL
); );

View File

@@ -25,5 +25,5 @@ CREATE TABLE Shop_Supplier_Address (
, id_change_set INT , id_change_set INT
, CONSTRAINT FK_Shop_Supplier_Address_id_change_set , CONSTRAINT FK_Shop_Supplier_Address_id_change_set
FOREIGN KEY (id_change_set) FOREIGN KEY (id_change_set)
REFERENCES partsltd_prod.Shop_Sales_And_Purchasing_Change_Set(id_change_set) REFERENCES partsltd_prod.Shop_User_Change_Set(id_change_set)
); );

View File

@@ -14,10 +14,10 @@ CREATE TABLE IF NOT EXISTS Shop_Manufacturing_Purchase_Order (
CONSTRAINT FK_Manufacturing_Purchase_Order_id_currency CONSTRAINT FK_Manufacturing_Purchase_Order_id_currency
FOREIGN KEY (id_currency) FOREIGN KEY (id_currency)
REFERENCES Shop_Currency(id_currency), REFERENCES Shop_Currency(id_currency),
cost_total_local_VAT_excl FLOAT NOT NULL, cost_total_local_VAT_excl FLOAT NULL,
cost_total_local_VAT_incl FLOAT NOT NULL, cost_total_local_VAT_incl FLOAT NULL,
price_total_local_VAT_excl FLOAT NOT NULL, price_total_local_VAT_excl FLOAT NULL,
price_total_local_VAT_incl FLOAT NOT NULL, price_total_local_VAT_incl FLOAT NULL,
/* /*
latency_delivery INT NOT NULL, latency_delivery INT NOT NULL,
quantity_ordered FLOAT NOT NULL, quantity_ordered FLOAT NOT NULL,

View File

@@ -1,6 +1,8 @@
# Manufacturing Purchase Order Temp # Manufacturing Purchase Order Temp
-- DROP TABLE Shop_Manufacturing_Purchase_Order_Temp
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Manufacturing_Purchase_Order_Temp'; SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Manufacturing_Purchase_Order_Temp';
CREATE TABLE IF NOT EXISTS Shop_Manufacturing_Purchase_Order_Temp ( CREATE TABLE IF NOT EXISTS Shop_Manufacturing_Purchase_Order_Temp (
@@ -8,11 +10,11 @@ CREATE TABLE IF NOT EXISTS Shop_Manufacturing_Purchase_Order_Temp (
/* /*
cost_total_local FLOAT NOT NULL, cost_total_local FLOAT NOT NULL,
*/ */
id_currency_cost INT NOT NULL, id_currency INT NOT NULL,
cost_total_local_VAT_excl FLOAT NOT NULL, cost_total_local_VAT_excl FLOAT NULL,
cost_total_local_VAT_incl FLOAT NOT NULL, cost_total_local_VAT_incl FLOAT NULL,
price_total_local_VAT_excl FLOAT NOT NULL, price_total_local_VAT_excl FLOAT NULL,
price_total_local_VAT_incl FLOAT NOT NULL, price_total_local_VAT_incl FLOAT NULL,
/* /*
latency_delivery INT NOT NULL, latency_delivery INT NOT NULL,
quantity_ordered FLOAT NOT NULL, quantity_ordered FLOAT NOT NULL,

View File

@@ -1,6 +1,8 @@
# Manufacturing Purchase Order Product Link # Manufacturing Purchase Order Product Link
-- DROP TABLE partsltd_prod.Shop_Manufacturing_Purchase_Order_Product_Link_Audit
-- DROP TABLE partsltd_prod.Shop_Manufacturing_Purchase_Order_Product_Link
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Manufacturing_Purchase_Order_Product_Link'; SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Manufacturing_Purchase_Order_Product_Link';
@@ -9,11 +11,11 @@ CREATE TABLE IF NOT EXISTS Shop_Manufacturing_Purchase_Order_Product_Link (
, id_order INT NOT NULL , id_order INT NOT NULL
, CONSTRAINT FK_Manufacturing_Purchase_Order_Product_Link_id_order , CONSTRAINT FK_Manufacturing_Purchase_Order_Product_Link_id_order
FOREIGN KEY (id_order) FOREIGN KEY (id_order)
REFERENCES Shop_Manufacturing_Purchase_Order(id_order) REFERENCES partsltd_prod.Shop_Manufacturing_Purchase_Order(id_order)
, id_permutation INT NOT NULL , id_permutation INT NOT NULL
, CONSTRAINT FK_Manufacturing_Purchase_Order_Product_Link_id_permutation , CONSTRAINT FK_Manufacturing_Purchase_Order_Product_Link_id_permutation
FOREIGN KEY (id_permutation) FOREIGN KEY (id_permutation)
REFERENCES Shop_Product_Permutation(id_permutation) REFERENCES partsltd_prod.Shop_Product_Permutation(id_permutation)
, cost_unit_local_VAT_excl FLOAT NULL , cost_unit_local_VAT_excl FLOAT NULL
, cost_unit_local_VAT_incl FLOAT NULL , cost_unit_local_VAT_incl FLOAT NULL
, price_unit_local_VAT_excl FLOAT NULL , price_unit_local_VAT_excl FLOAT NULL
@@ -21,13 +23,13 @@ CREATE TABLE IF NOT EXISTS Shop_Manufacturing_Purchase_Order_Product_Link (
, id_unit_quantity INT NOT NULL , id_unit_quantity INT NOT NULL
, CONSTRAINT FK_Manufacturing_Purchase_Order_id_unit_quantity , CONSTRAINT FK_Manufacturing_Purchase_Order_id_unit_quantity
FOREIGN KEY (id_unit_quantity) FOREIGN KEY (id_unit_quantity)
REFERENCES Shop_Unit_Measurement(id_unit_measurement) REFERENCES partsltd_prod.Shop_Unit_Measurement(id_unit_measurement)
, quantity_used FLOAT NULL , quantity_used FLOAT NULL
, quantity_produced FLOAT NULL , quantity_produced FLOAT NULL
, id_unit_latency_manufacture INT NULL , id_unit_latency_manufacture INT NULL
, CONSTRAINT FK_MPO_id_unit_latency_manufacture , CONSTRAINT FK_MPO_id_unit_latency_manufacture
FOREIGN KEY (id_unit_latency_manufacture) FOREIGN KEY (id_unit_latency_manufacture)
REFERENCES Shop_Unit_Measurement(id_unit_measurement) REFERENCES partsltd_prod.Shop_Unit_Measurement(id_unit_measurement)
, latency_manufacture INT NULL , latency_manufacture INT NULL
, display_order INT NOT NULL , display_order INT NOT NULL
, active BIT NOT NULL , active BIT NOT NULL
@@ -38,5 +40,5 @@ CREATE TABLE IF NOT EXISTS Shop_Manufacturing_Purchase_Order_Product_Link (
, id_change_set INT NULL , id_change_set INT NULL
, CONSTRAINT FK_Manufacturing_Purchase_Order_id_change_set , CONSTRAINT FK_Manufacturing_Purchase_Order_id_change_set
FOREIGN KEY (id_change_set) FOREIGN KEY (id_change_set)
REFERENCES Shop_Sales_And_Purchasing_Change_Set(id_change_set) REFERENCES partsltd_prod.Shop_Sales_And_Purchasing_Change_Set(id_change_set)
); );

View File

@@ -9,7 +9,9 @@ SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning
CREATE TABLE IF NOT EXISTS Shop_Manufacturing_Purchase_Order_Product_Link_Temp ( CREATE TABLE IF NOT EXISTS Shop_Manufacturing_Purchase_Order_Product_Link_Temp (
id_link INT NOT NULL PRIMARY KEY, id_link INT NOT NULL PRIMARY KEY,
id_order INT NOT NULL, id_order INT NOT NULL,
id_permutation INT NOT NULL, id_product INT NULL,
id_permutation INT NULL,
csv_list_variations VARCHAR(4000) NULL,
id_unit_quantity INT NOT NULL, id_unit_quantity INT NOT NULL,
quantity_used FLOAT NULL, quantity_used FLOAT NULL,
quantity_produced FLOAT NULL, quantity_produced FLOAT NULL,

View File

@@ -69,9 +69,13 @@ BEGIN
SELECT NEW.id_permutation, 'description', OLD.description, NEW.description, NEW.id_change_set SELECT NEW.id_permutation, 'description', OLD.description, NEW.description, NEW.id_change_set
WHERE NOT (OLD.description <=> NEW.description) WHERE NOT (OLD.description <=> NEW.description)
UNION UNION
# Changed cost_local # Changed cost_local_VAT_excl
SELECT NEW.id_permutation, 'cost_local', CONVERT(OLD.cost_local, CHAR), CONVERT(NEW.cost_local, CHAR), NEW.id_change_set SELECT NEW.id_permutation, 'cost_local_VAT_excl', CONVERT(OLD.cost_local_VAT_excl, CHAR), CONVERT(NEW.cost_local_VAT_excl, CHAR), NEW.id_change_set
WHERE NOT (OLD.cost_local <=> NEW.cost_local) WHERE NOT (OLD.cost_local_VAT_excl <=> NEW.cost_local_VAT_excl)
UNION
# Changed cost_local_VAT_incl
SELECT NEW.id_permutation, 'cost_local_VAT_incl', CONVERT(OLD.cost_local_VAT_incl, CHAR), CONVERT(NEW.cost_local_VAT_incl, CHAR), NEW.id_change_set
WHERE NOT (OLD.cost_local_VAT_incl <=> NEW.cost_local_VAT_incl)
UNION UNION
# Changed id_currency_cost # Changed id_currency_cost
SELECT NEW.id_permutation, 'id_currency_cost', CONVERT(OLD.id_currency_cost, CHAR), CONVERT(NEW.id_currency_cost, CHAR), NEW.id_change_set SELECT NEW.id_permutation, 'id_currency_cost', CONVERT(OLD.id_currency_cost, CHAR), CONVERT(NEW.id_currency_cost, CHAR), NEW.id_change_set

View File

@@ -14,7 +14,7 @@ FOR EACH ROW
BEGIN BEGIN
SET NEW.created_on := IFNULL(NEW.created_on, NOW()); SET NEW.created_on := IFNULL(NEW.created_on, NOW());
-- SET NEW.created_by := IFNULL(NEW.created_by, IFNULL((SELECT id_user FROM Shop_User WHERE firstname = CURRENT_USER()), -1)); -- SET NEW.created_by := IFNULL(NEW.created_by, IFNULL((SELECT id_user FROM Shop_User WHERE firstname = CURRENT_USER()), -1));
IF NOT EXISTS (SELECT * FROM partsltd_prod.Shop_User U WHERE U.id_user = NEW.created_on LIMIT 1) THEN IF NOT EXISTS (SELECT * FROM partsltd_prod.Shop_User U WHERE U.id_user = NEW.created_by LIMIT 1) THEN
SIGNAL SQLSTATE '45000' SIGNAL SQLSTATE '45000'
SET MESSAGE_TEXT = 'Valid created by User ID must be provided.'; SET MESSAGE_TEXT = 'Valid created by User ID must be provided.';
END IF; END IF;
@@ -31,10 +31,6 @@ BEGIN
SIGNAL SQLSTATE '45000' SIGNAL SQLSTATE '45000'
SET MESSAGE_TEXT = 'New change Set ID must be provided.'; SET MESSAGE_TEXT = 'New change Set ID must be provided.';
END IF; END IF;
IF NOT EXISTS (SELECT * FROM partsltd_prod.Shop_User U WHERE U.id_user = NEW.created_on LIMIT 1) THEN
SIGNAL SQLSTATE '45000'
SET MESSAGE_TEXT = 'Valid created by User ID must be provided.';
END IF;
INSERT INTO Shop_Manufacturing_Purchase_Order_Audit ( INSERT INTO Shop_Manufacturing_Purchase_Order_Audit (
id_order, id_order,

View File

@@ -10,7 +10,8 @@ DELIMITER //
CREATE PROCEDURE p_shop_save_product_category ( CREATE PROCEDURE p_shop_save_product_category (
IN a_comment VARCHAR(500), IN a_comment VARCHAR(500),
IN a_guid BINARY(36), IN a_guid BINARY(36),
IN a_id_user INT IN a_id_user INT,
IN a_debug BIT
) )
BEGIN BEGIN
DECLARE v_code_type_error_bad_data VARCHAR(100); DECLARE v_code_type_error_bad_data VARCHAR(100);
@@ -19,7 +20,7 @@ BEGIN
DECLARE v_ids_product_permission LONGTEXT; DECLARE v_ids_product_permission LONGTEXT;
DECLARE v_id_change_set INT; DECLARE v_id_change_set INT;
DECLARE v_id_access_level_edit INT; DECLARE v_id_access_level_edit INT;
DECLARE v_now DATETIME; DECLARE v_time_start TIMESTAMP(6);
DECLARE exit handler for SQLEXCEPTION DECLARE exit handler for SQLEXCEPTION
BEGIN BEGIN
@@ -38,33 +39,33 @@ BEGIN
CREATE TEMPORARY TABLE IF NOT EXISTS tmp_Msg_Error ( CREATE TEMPORARY TABLE IF NOT EXISTS tmp_Msg_Error (
display_order INT NOT NULL PRIMARY KEY AUTO_INCREMENT display_order INT NOT NULL PRIMARY KEY AUTO_INCREMENT
, guid BINARY(36) NOT NULL
, id_type INT NULL , id_type INT NULL
, code VARCHAR(50) NOT NULL , code VARCHAR(50) NOT NULL
, msg VARCHAR(4000) NOT NULL , msg VARCHAR(4000) NOT NULL
); );
INSERT INTO tmp_Msg_Error ( INSERT INTO tmp_Msg_Error (
guid id_type
, id_type
, code , code
, msg , msg
) )
SELECT SELECT
a_guid MET.id_type
, NULL
, @errno , @errno
, @text , @text
FROM partsltd_prod.Shop_Msg_Error_Type MET
WHERE MET.code = 'MYSQL_ERROR'
; ;
SELECT * SELECT *
FROM tmp_Msg_Error; FROM tmp_Msg_Error;
DROP TABLE IF EXISTS tmp_Msg_Error; DROP TABLE IF EXISTS tmp_Msg_Error;
END; END;
SET v_time_start := CURRENT_TIMESTAMP(6);
SET v_code_type_error_bad_data := 'BAD_DATA'; SET v_code_type_error_bad_data := 'BAD_DATA';
SET v_id_type_error_bad_data := (SELECT id_type FROM Shop_Msg_Error_Type WHERE code = v_code_type_error_bad_data LIMIT 1); SET v_id_type_error_bad_data := (SELECT id_type FROM Shop_Msg_Error_Type WHERE code = v_code_type_error_bad_data LIMIT 1);
SET v_id_access_level_edit := (SELECT id_access_level FROM Shop_Access_Level WHERE code = 'EDIT' LIMIT 1); SET v_id_access_level_edit := (SELECT id_access_level FROM Shop_Access_Level WHERE code = 'EDIT' LIMIT 1);
SET a_guid := IFNULL(a_guid, UUID()); CALL p_validate_guid ( a_guid );
DROP TABLE IF EXISTS tmp_Category; DROP TABLE IF EXISTS tmp_Category;
@@ -85,7 +86,6 @@ BEGIN
CREATE TEMPORARY TABLE IF NOT EXISTS tmp_Msg_Error ( CREATE TEMPORARY TABLE IF NOT EXISTS tmp_Msg_Error (
display_order INT NOT NULL PRIMARY KEY AUTO_INCREMENT display_order INT NOT NULL PRIMARY KEY AUTO_INCREMENT
, guid BINARY(36) NOT NULL
, id_type INT NULL , id_type INT NULL
, code VARCHAR(50) NOT NULL , code VARCHAR(50) NOT NULL
, msg VARCHAR(4000) NOT NULL , msg VARCHAR(4000) NOT NULL
@@ -110,7 +110,7 @@ BEGIN
, IFNULL(PC_T.name, PC.code) AS name , IFNULL(PC_T.name, PC.code) AS name
, IFNULL(PC_T.description, PC.description) AS description , IFNULL(PC_T.description, PC.description) AS description
, IFNULL(PC_T.id_access_level_required, PC.id_access_level_required) AS id_access_level_required , IFNULL(PC_T.id_access_level_required, PC.id_access_level_required) AS id_access_level_required
, IFNULL(PC_T.active, PC.active) AS active , IFNULL(IFNULL(PC_T.active, PC.active), 1) AS active
, IFNULL(PC_T.display_order, PC.display_order) AS display_order , IFNULL(PC_T.display_order, PC.display_order) AS display_order
, IFNULL(PC_T.name, IFNULL(PC.name, IFNULL(PC_T.code, IFNULL(PC.code, IFNULL(PC_T.id_category, '(No Product Category)'))))) AS name_error , IFNULL(PC_T.name, IFNULL(PC.name, IFNULL(PC_T.code, IFNULL(PC.code, IFNULL(PC_T.id_category, '(No Product Category)'))))) AS name_error
, CASE WHEN IFNULL(PC_T.id_category, 0) < 1 THEN 1 ELSE 0 END AS is_new , CASE WHEN IFNULL(PC_T.id_category, 0) < 1 THEN 1 ELSE 0 END AS is_new
@@ -124,14 +124,12 @@ BEGIN
-- code -- code
IF EXISTS (SELECT * FROM tmp_Category t_C WHERE ISNULL(t_C.code) LIMIT 1) THEN IF EXISTS (SELECT * FROM tmp_Category t_C WHERE ISNULL(t_C.code) LIMIT 1) THEN
INSERT INTO tmp_Msg_Error ( INSERT INTO tmp_Msg_Error (
guid id_type
, id_type
, code , code
, msg , msg
) )
SELECT SELECT
a_guid AS GUID v_id_type_error_bad_data
, v_id_type_error_bad_data
, v_code_type_error_bad_data , v_code_type_error_bad_data
, CONCAT('The following category(s) do not have a code: ', GROUP_CONCAT(IFNULL(t_C.name_error, 'NULL') SEPARATOR ', ')) AS msg , CONCAT('The following category(s) do not have a code: ', GROUP_CONCAT(IFNULL(t_C.name_error, 'NULL') SEPARATOR ', ')) AS msg
FROM tmp_Category t_C FROM tmp_Category t_C
@@ -141,14 +139,12 @@ BEGIN
-- name -- name
IF EXISTS (SELECT * FROM tmp_Category t_C WHERE ISNULL(t_C.name) LIMIT 1) THEN IF EXISTS (SELECT * FROM tmp_Category t_C WHERE ISNULL(t_C.name) LIMIT 1) THEN
INSERT INTO tmp_Msg_Error ( INSERT INTO tmp_Msg_Error (
guid id_type
, id_type
, code , code
, msg , msg
) )
SELECT SELECT
a_guid AS GUID v_id_type_error_bad_data
, v_id_type_error_bad_data
, v_code_type_error_bad_data , v_code_type_error_bad_data
, CONCAT('The following category(s) do not have a name: ', GROUP_CONCAT(IFNULL(t_C.name_error, 'NULL') SEPARATOR ', ')) AS msg , CONCAT('The following category(s) do not have a name: ', GROUP_CONCAT(IFNULL(t_C.name_error, 'NULL') SEPARATOR ', ')) AS msg
FROM tmp_Category t_C FROM tmp_Category t_C
@@ -158,14 +154,12 @@ BEGIN
-- display_order -- display_order
IF EXISTS (SELECT * FROM tmp_Category t_C WHERE ISNULL(t_C.display_order) LIMIT 1) THEN IF EXISTS (SELECT * FROM tmp_Category t_C WHERE ISNULL(t_C.display_order) LIMIT 1) THEN
INSERT INTO tmp_Msg_Error ( INSERT INTO tmp_Msg_Error (
guid id_type
, id_type
, code , code
, msg , msg
) )
SELECT SELECT
a_guid AS GUID v_id_type_error_bad_data
, v_id_type_error_bad_data
, v_code_type_error_bad_data , v_code_type_error_bad_data
, CONCAT('The following category(s) do not have a display order: ', GROUP_CONCAT(IFNULL(t_C.name_error, 'NULL') SEPARATOR ', ')) AS msg , CONCAT('The following category(s) do not have a display order: ', GROUP_CONCAT(IFNULL(t_C.name_error, 'NULL') SEPARATOR ', ')) AS msg
FROM tmp_Category t_C FROM tmp_Category t_C
@@ -202,8 +196,6 @@ BEGIN
END IF; END IF;
END IF; END IF;
SET v_now := CURRENT_DATETIME();
IF NOT EXISTS (SELECT * FROM tmp_Msg_Error LIMIT 1) THEN IF NOT EXISTS (SELECT * FROM tmp_Msg_Error LIMIT 1) THEN
START TRANSACTION; START TRANSACTION;
@@ -247,7 +239,7 @@ BEGIN
, t_C.active AS active , t_C.active AS active
, t_C.display_order AS display_order , t_C.display_order AS display_order
, a_id_user AS created_by , a_id_user AS created_by
, v_now AS created_on , v_time_start AS created_on
FROM tmp_Category t_C FROM tmp_Category t_C
WHERE is_new = 1 WHERE is_new = 1
AND active = 1 AND active = 1
@@ -259,10 +251,22 @@ BEGIN
COMMIT; COMMIT;
END IF; END IF;
SELECT * FROM tmp_Msg_Error; # Errors
SELECT *
FROM tmp_Msg_Error t_ME
INNER JOIN partsltd_prod.Shop_Msg_Error_Type MET ON t_ME.id_type = MET.id_type
;
DROP TEMPORARY TABLE IF EXISTS tmp_Catgory; IF a_debug = 1 THEN
DROP TEMPORARY TABLE IF EXISTS tmp_Msg_Error; SELECT * from tmp_Catgory;
END IF;
DROP TEMPORARY TABLE tmp_Catgory;
DROP TEMPORARY TABLE tmp_Msg_Error;
IF a_debug = 1 THEN
CALL partsltd_prod.p_debug_timing_reporting ( v_time_start );
END IF;
END // END //
DELIMITER ;; DELIMITER ;;

View File

@@ -1,274 +1,75 @@
-- Clear previous proc -- Clear previous proc
DROP PROCEDURE IF EXISTS p_shop_save_product_category_test; DROP PROCEDURE IF EXISTS partsltd_prod.p_shop_save_product_category_test;
DELIMITER // DELIMITER //
CREATE PROCEDURE p_shop_save_product_category_test ( CREATE PROCEDURE p_shop_save_product_category_test ()
IN a_id_user INT,
IN a_guid BINARY(36),
IN a_comment VARCHAR(500)
)
BEGIN BEGIN
DECLARE v_code_type_error_bad_data VARCHAR(100);
DECLARE v_id_type_error_bad_data INT; DECLARE v_guid BINARY(36);
DECLARE v_id_permission_product INT; DECLARE v_time_start TIMESTAMP(6);
DECLARE v_ids_product_permission LONGTEXT;
DECLARE v_id_change_set INT;
DECLARE exit handler for SQLEXCEPTION SET v_time_start := CURRENT_TIMESTAMP(6);
BEGIN SET v_guid := 'nips';
-- Get diagnostic information
GET DIAGNOSTICS CONDITION 1 SELECT *
@sqlstate = RETURNED_SQLSTATE FROM partsltd_prod.Shop_Product_Category
, @errno = MYSQL_ERRNO ;
, @text = MESSAGE_TEXT SELECT *
; FROM partsltd_prod.Shop_Product_Category_Temp
;
-- Rollback the transaction
ROLLBACK; START TRANSACTION;
-- Select the error information INSERT INTO partsltd_prod.Shop_Product_Category_Temp (
-- SELECT 'Error' AS status, @errno AS error_code, @sqlstate AS sql_state, @text AS message; id_category
, name
CREATE TEMPORARY TABLE IF NOT EXISTS tmp_Msg_Error (
display_order INT NOT NULL PRIMARY KEY AUTO_INCREMENT
, guid BINARY(36) NOT NULL
, id_type INT NULL
, code VARCHAR(50) NOT NULL
, msg VARCHAR(4000) NOT NULL
);
INSERT INTO tmp_Msg_Error (
guid
, id_type
, code , code
, msg , description
, id_access_level_required
, display_order
, guid
) )
SELECT VALUES (
a_guid -5 -- id_category
, NULL , 'Nips' -- name
, @errno , 'Lips' -- code
, @text , 'Chips' -- description
; , 2 -- id_access_level_required
, 25 -- display_order
SELECT * FROM tmp_Msg_Error; , v_guid
DROP TABLE IF EXISTS tmp_Msg_Error; );
END;
COMMIT;
select 'p_shop_save_product_category_test'; SELECT *
FROM partsltd_prod.Shop_Product_Category_Temp
WHERE GUID = v_guid
;
SET v_code_type_error_bad_data := 'BAD_DATA'; CALL partsltd_prod.p_shop_save_product_category (
SET v_id_type_error_bad_data := (SELECT id_type FROM Shop_Msg_Error_Type WHERE code = v_code_type_error_bad_data LIMIT 1); 'Test save product category' -- comment
, v_guid -- guid
SET a_guid := IFNULL(a_guid, UUID()); , 1 -- id_user
, 1 -- debug
DROP TABLE IF EXISTS tmp_Category;
CREATE TEMPORARY TABLE tmp_Category (
id_category INT NOT NULL
, code VARCHAR(50) NOT NULL
, name VARCHAR(255) NOT NULL
, description VARCHAR(4000) NULL
, active BIT NOT NULL
, display_order INT NOT NULL
, can_view BIT NULL
, can_edit BIT NULL
, can_admin BIT NULL
, name_error VARCHAR(255) NOT NULL
, is_new BIT NOT NULL
); );
CREATE TEMPORARY TABLE IF NOT EXISTS tmp_Msg_Error ( SELECT *
display_order INT NOT NULL PRIMARY KEY AUTO_INCREMENT FROM partsltd_prod.Shop_Product_Category
, guid BINARY(36) NOT NULL ;
, id_type INT NULL SELECT *
/* FROM partsltd_prod.Shop_Product_Category_Temp
CONSTRAINT FK_tmp_Msg_Error_id_type ;
FOREIGN KEY (id_type)
REFERENCES Shop_Msg_Error_Type (id_type),
*/
, code VARCHAR(50) NOT NULL
, msg VARCHAR(4000) NOT NULL
);
-- Get data from Temp table CALL partsltd_prod.p_debug_timing_reporting ( v_time_start );
INSERT INTO tmp_Category (
id_category
, code
, name
, description
, active
, display_order
, name_error
, is_new
)
SELECT
IFNULL(PC_T.id_category, PC.id_category) AS id_category
, IFNULL(PC_T.code, PC.code) AS code
, IFNULL(PC_T.name, PC.code) AS name
, IFNULL(PC_T.description, PC.description) AS description
, IFNULL(PC_T.active, PC.active) AS active
, IFNULL(PC_T.display_order, PC.display_order) AS display_order
, IFNULL(PC_T.name, IFNULL(PC.name, IFNULL(PC_T.code, IFNULL(PC.code, IFNULL(PC_T.id_category, '(No Product Category)'))))) AS name_error
, CASE WHEN IFNULL(PC_T.id_category, 0) < 1 THEN 1 ELSE 0 END AS is_new
FROM Shop_Product_Category_Temp PC_T
LEFT JOIN Shop_Product_Category PC ON PC_T.id_category = PC.id_category
WHERE PC_T.guid = a_guid
;
-- Validation
-- Missing mandatory fields
-- code
INSERT INTO tmp_Msg_Error (
guid
, id_type
, code
, msg
)
SELECT
a_guid AS GUID
, v_id_type_error_bad_data
, v_code_type_error_bad_data
, CONCAT('The following category(s) do not have a code: ', GROUP_CONCAT(t_C.name_error SEPARATOR ', ')) AS msg
FROM tmp_Category t_C
;
-- name
INSERT INTO tmp_Msg_Error (
guid
, id_type
, code
, msg
)
SELECT
a_guid AS GUID
, v_id_type_error_bad_data
, v_code_type_error_bad_data
, CONCAT('The following category(s) do not have a name: ', GROUP_CONCAT(t_C.name_error SEPARATOR ', ')) AS msg
FROM tmp_Category t_C
;
-- display_order
INSERT INTO tmp_Msg_Error (
guid
, id_type
, code
, msg
)
SELECT
a_guid AS GUID
, v_id_type_error_bad_data
, v_code_type_error_bad_data
, CONCAT('The following category(s) do not have a display order: ', GROUP_CONCAT(t_C.name_error SEPARATOR ', ')) AS msg
FROM tmp_Category t_C
;
SELECT * FROM tmp_Category;
-- Permissions
IF NOT EXISTS (SELECT * FROM tmp_Msg_Error LIMIT 1) THEN -- (SELECT * FROM tmp_Product WHERE is_new = 0 LIMIT 1) THEN
SET v_ids_product_permission := (
SELECT GROUP_CONCAT(P.id_product SEPARATOR ',')
FROM Shop_Product P
INNER JOIN Shop_Product_Category PC
ON P.id_category = PC.id_category
AND PC.is_new = 0
);
IF NOT ISNULL(v_ids_product_permission) THEN
SET v_id_permission_product = (SELECT id_permission FROM Shop_Permission WHERE code = 'STORE_PRODUCT' LIMIT 1);
CALL p_shop_calc_user(a_guid, a_id_user, v_id_permission_product, v_ids_product_permission);
UPDATE tmp_Category t_C
INNER JOIN Shop_Product P ON t_C.id_category = P.id_product
INNER JOIN Shop_Calc_User_Temp UE_T
ON P.id_product = UE_T.id_product
AND UE_T.GUID = a_guid
SET
t_C.can_view = UE_T.can_view
, t_C.can_edit = UE_T.can_edit
, t_C.can_admin = UE_T.can_admin
;
CALL p_shop_clear_calc_user(a_guid);
END IF;
END IF;
SELECT * FROM tmp_Category;
IF NOT EXISTS (SELECT * FROM tmp_Msg_Error LIMIT 1) THEN
START TRANSACTION;
IF NOT ISNULL(v_ids_product_permission) THEN
INSERT INTO Shop_Product_Change_Set ( comment )
VALUES ( a_comment )
;
SET v_id_change_set := LAST_INSERT_ID();
UPDATE Shop_Product_Category PC
INNER JOIN tmp_Category t_C ON PC.id_category = t_C.id_category
SET
PC.id_category = t_C.id_category
, PC.code = t_C.code
, PC.name = t_P.name
, PC.description = t_C.description
, PC.display_order = t_C.display_order
, PC.active = t_C.active
, P.id_change_set = v_id_change_set
;
END IF;
INSERT INTO Shop_Product_Category (
id_category
, code
, name
, description
, display_order
, active
, created_by
, created_on
)
SELECT
t_C.id_category AS id_category
, t_C.code AS code
, t_C.name AS name
, t_C.description AS description
, t_C.active AS active
, t_P.display_order AS display_order
, a_id_user AS created_by
, v_now AS created_on
FROM tmp_Category t_C
WHERE is_new = 1
AND active = 1
;
ROLLBACK;
END IF;
SELECT * FROM tmp_Msg_Error;
SELECT * FROM tmp_Category;
DROP TEMPORARY TABLE IF EXISTS tmp_Catgory;
DROP TEMPORARY TABLE IF EXISTS tmp_Msg_Error;
END // END //
DELIMITER ;; DELIMITER ;;
/*
CALL partsltd_prod.p_shop_save_product_category_test ();
select * DELETE FROM partsltd_prod.Shop_Product_Category_Temp;
from shop_product_category;
select *
from shop_product_category_temp;
SELECT 'nips' as guid;
CALL p_shop_save_product_category_TEST (1, 'nips', 'y');
select *
from shop_product_category;
select *
from shop_product_category_temp;
DROP TABLE IF EXISTS tmp_Msg_Error;
*/

View File

@@ -64,7 +64,7 @@ BEGIN
SET v_id_type_error_bad_data := (SELECT id_type FROM Shop_Msg_Error_Type WHERE code = v_code_type_error_bad_data LIMIT 1); SET v_id_type_error_bad_data := (SELECT id_type FROM Shop_Msg_Error_Type WHERE code = v_code_type_error_bad_data LIMIT 1);
SET v_id_access_level_edit := (SELECT id_access_level FROM Shop_Access_Level WHERE code = 'EDIT' LIMIT 1); SET v_id_access_level_edit := (SELECT id_access_level FROM Shop_Access_Level WHERE code = 'EDIT' LIMIT 1);
SET a_guid := IFNULL(a_guid, UUID()); CALL p_validate_guid ( a_guid );
SET a_debug := IFNULL(a_debug, 0); SET a_debug := IFNULL(a_debug, 0);
IF a_debug = 1 THEN IF a_debug = 1 THEN

View File

@@ -33,7 +33,9 @@ BEGIN
, active , active
, guid , guid
) )
VALUES ( VALUES
/* Test 1 - Update
(
4 -- id_product 4 -- id_product
, 1 -- id_category , 1 -- id_category
, 'Laptops' -- name , 'Laptops' -- name
@@ -42,7 +44,20 @@ BEGIN
, 2 -- display_order , 2 -- display_order
, 1 -- active , 1 -- active
, v_guid , v_guid
); )
*/
/* Test 2 - Insert */
(
-14 -- id_product
, 5 -- id_category
, 'Clip' -- name
, 0 -- has_variations
, 1 -- id_access_level_required
, 1 -- display_order
, 1 -- active
, v_guid
)
;
COMMIT; COMMIT;

View File

@@ -52,7 +52,7 @@ BEGIN
WHERE MET.code = 'BAD_DATA' WHERE MET.code = 'BAD_DATA'
; ;
SET a_id_user := TRIM(IFNULL(a_id_user, 0)); SET a_id_user := IFNULL(a_id_user, 0);
SET a_get_all_product_category := IFNULL(a_get_all_product_category, 0); SET a_get_all_product_category := IFNULL(a_get_all_product_category, 0);
SET a_get_inactive_product_category := IFNULL(a_get_inactive_product_category, 0); SET a_get_inactive_product_category := IFNULL(a_get_inactive_product_category, 0);
SET a_ids_product_category := TRIM(IFNULL(a_ids_product_category, '')); SET a_ids_product_category := TRIM(IFNULL(a_ids_product_category, ''));
@@ -473,6 +473,9 @@ BEGIN
DELETE FROM tmp_Product_calc; DELETE FROM tmp_Product_calc;
DELETE FROM tmp_Permutation_calc; DELETE FROM tmp_Permutation_calc;
ELSE ELSE
SELECT * FROM Shop_Product_Category_Temp;
SELECT * FROM Shop_Product_Temp;
SELECT * FROM Shop_Product_Permutation_Temp;
*/ */
START TRANSACTION; START TRANSACTION;
@@ -546,7 +549,8 @@ BEGIN
id_permutation id_permutation
, id_product , id_product
, description , description
, cost_local , cost_local_VAT_excl
, cost_local_VAT_incl
, id_currency_cost , id_currency_cost
, profit_local_min , profit_local_min
, latency_manufacture , latency_manufacture
@@ -572,7 +576,8 @@ BEGIN
t_PP.id_permutation t_PP.id_permutation
, PP.id_product , PP.id_product
, PP.description , PP.description
, PP.cost_local , PP.cost_local_VAT_excl
, PP.cost_local_VAT_incl
, PP.id_currency_cost , PP.id_currency_cost
, PP.profit_local_min , PP.profit_local_min
, PP.latency_manufacture , PP.latency_manufacture

View File

@@ -8,7 +8,8 @@ DELIMITER //
CREATE PROCEDURE p_shop_save_product_permutation ( CREATE PROCEDURE p_shop_save_product_permutation (
IN a_comment VARCHAR(500), IN a_comment VARCHAR(500),
IN a_guid BINARY(36), IN a_guid BINARY(36),
IN a_id_user INT IN a_id_user INT,
IN a_debug BIT
) )
BEGIN BEGIN
@@ -18,7 +19,7 @@ BEGIN
DECLARE v_ids_product_permission LONGTEXT; DECLARE v_ids_product_permission LONGTEXT;
DECLARE v_id_change_set INT; DECLARE v_id_change_set INT;
DECLARE v_id_access_level_edit INT; DECLARE v_id_access_level_edit INT;
DECLARE v_now DATETIME; DECLARE v_time_start TIMESTAMP(6);
DECLARE exit handler for SQLEXCEPTION DECLARE exit handler for SQLEXCEPTION
BEGIN BEGIN
@@ -37,33 +38,34 @@ BEGIN
CREATE TEMPORARY TABLE IF NOT EXISTS tmp_Msg_Error ( CREATE TEMPORARY TABLE IF NOT EXISTS tmp_Msg_Error (
display_order INT NOT NULL PRIMARY KEY AUTO_INCREMENT display_order INT NOT NULL PRIMARY KEY AUTO_INCREMENT
, guid BINARY(36) NOT NULL
, id_type INT NULL , id_type INT NULL
, code VARCHAR(50) NOT NULL , code VARCHAR(50) NOT NULL
, msg VARCHAR(4000) NOT NULL , msg VARCHAR(4000) NOT NULL
); );
INSERT INTO tmp_Msg_Error ( INSERT INTO tmp_Msg_Error (
guid id_type
, id_type
, code , code
, msg , msg
) )
SELECT SELECT
a_guid MET.id_type
, NULL
, @errno , @errno
, @text , @text
FROM partsltd_prod.Shop_Msg_Error_Type MET
WHERE MET.code = 'MYSQL_ERROR'
LIMIT 1
; ;
SELECT * SELECT *
FROM tmp_Msg_Error; FROM tmp_Msg_Error;
DROP TABLE IF EXISTS tmp_Msg_Error; DROP TABLE IF EXISTS tmp_Msg_Error;
END; END;
SET v_time_start := CURRENT_TIMESTAMP(6);
SET v_code_type_error_bad_data := 'BAD_DATA'; SET v_code_type_error_bad_data := 'BAD_DATA';
SET v_id_type_error_bad_data := (SELECT id_type FROM Shop_Msg_Error_Type WHERE code = v_code_type_error_bad_data LIMIT 1); SET v_id_type_error_bad_data := (SELECT id_type FROM Shop_Msg_Error_Type WHERE code = v_code_type_error_bad_data LIMIT 1);
SET v_id_access_level_edit := (SELECT id_access_level FROM Shop_Access_Level WHERE code = 'EDIT' LIMIT 1); SET v_id_access_level_edit := (SELECT id_access_level FROM Shop_Access_Level WHERE code = 'EDIT' LIMIT 1);
SET a_guid := IFNULL(a_guid, UUID()); CALL p_validate_guid ( a_guid );
DROP TABLE IF EXISTS tmp_Permutation; DROP TABLE IF EXISTS tmp_Permutation;
@@ -71,14 +73,15 @@ BEGIN
id_permutation INT NOT NULL id_permutation INT NOT NULL
, id_product INT NOT NULL , id_product INT NOT NULL
, description VARCHAR(4000) NOT NULL , description VARCHAR(4000) NOT NULL
, cost_local FLOAT NOT NULL , cost_local_VAT_excl FLOAT NULL
, cost_local_VAT_incl FLOAT NULL
, id_currency_cost INT NOT NULL , id_currency_cost INT NOT NULL
, profit_local_min FLOAT NOT NULL , profit_local_min FLOAT NULL
, latency_manufacture INT NOT NULL , latency_manufacture INT NOT NULL
, id_unit_measurement_quantity INT NOT NULL , id_unit_measurement_quantity INT NOT NULL
, count_unit_measurement_per_quantity_step FLOAT NOT NULL , count_unit_measurement_per_quantity_step FLOAT NOT NULL
, quantity_min FLOAT NOT NULL , quantity_min FLOAT NULL
, quantity_max FLOAT NOT NULL , quantity_max FLOAT NULL
, quantity_stock FLOAT NOT NULL , quantity_stock FLOAT NOT NULL
, is_subscription BIT NOT NULL , is_subscription BIT NOT NULL
, id_unit_measurement_interval_recurrence INT , id_unit_measurement_interval_recurrence INT
@@ -97,7 +100,6 @@ BEGIN
CREATE TEMPORARY TABLE IF NOT EXISTS tmp_Msg_Error ( CREATE TEMPORARY TABLE IF NOT EXISTS tmp_Msg_Error (
display_order INT NOT NULL PRIMARY KEY AUTO_INCREMENT display_order INT NOT NULL PRIMARY KEY AUTO_INCREMENT
, guid BINARY(36) NOT NULL
, id_type INT NULL , id_type INT NULL
, code VARCHAR(50) NOT NULL , code VARCHAR(50) NOT NULL
, msg VARCHAR(4000) NOT NULL , msg VARCHAR(4000) NOT NULL
@@ -109,7 +111,8 @@ BEGIN
id_permutation id_permutation
, id_product , id_product
, description , description
, cost_local , cost_local_VAT_excl
, cost_local_VAT_incl
, id_currency_cost , id_currency_cost
, profit_local_min , profit_local_min
, latency_manufacture , latency_manufacture
@@ -133,7 +136,8 @@ BEGIN
PP_T.id_permutation PP_T.id_permutation
, IFNULL(PP_T.id_product, PP.id_product) AS id_product , IFNULL(PP_T.id_product, PP.id_product) AS id_product
, IFNULL(PP_T.description, PP.description) AS description , IFNULL(PP_T.description, PP.description) AS description
, IFNULL(PP_T.cost_local, PP.cost_local) AS cost_local , IFNULL(PP_T.cost_local_VAT_excl, PP.cost_local_VAT_excl) AS cost_local_VAT_excl
, IFNULL(PP_T.cost_local_VAT_incl, PP.cost_local_VAT_incl) AS cost_local_VAT_incl
, IFNULL(PP_T.id_currency_cost, PP.id_currency_cost) AS a_id_currency_cost , IFNULL(PP_T.id_currency_cost, PP.id_currency_cost) AS a_id_currency_cost
, IFNULL(PP_T.profit_local_min, PP.profit_local_min) AS profit_local_min , IFNULL(PP_T.profit_local_min, PP.profit_local_min) AS profit_local_min
, IFNULL(PP_T.latency_manufacture, PP.latency_manufacture) AS latency_manufacture , IFNULL(PP_T.latency_manufacture, PP.latency_manufacture) AS latency_manufacture
@@ -150,7 +154,7 @@ BEGIN
, IFNULL(PP_T.id_unit_measurement_interval_expiration_unsealed, PP.id_unit_measurement_interval_expiration_unsealed) AS id_unit_measurement_interval_expiration_unsealed , IFNULL(PP_T.id_unit_measurement_interval_expiration_unsealed, PP.id_unit_measurement_interval_expiration_unsealed) AS id_unit_measurement_interval_expiration_unsealed
, IFNULL(PP_T.count_interval_expiration_unsealed, PP.count_interval_expiration_unsealed) AS count_interval_expiration_unsealed , IFNULL(PP_T.count_interval_expiration_unsealed, PP.count_interval_expiration_unsealed) AS count_interval_expiration_unsealed
, IFNULL(PP_T.active, PP.active) AS active , IFNULL(PP_T.active, PP.active) AS active
, fn_shop_get_product_permutation_name(PP_T.id_permutation) , IFNULL(fn_shop_get_product_permutation_name(PP_T.id_permutation), '(No Permutation)') AS name_error
, CASE WHEN IFNULL(PP_T.id_permutation, 0) < 1 THEN 1 ELSE 0 END AS is_new , CASE WHEN IFNULL(PP_T.id_permutation, 0) < 1 THEN 1 ELSE 0 END AS is_new
FROM Shop_Product_Permutation_Temp PP_T FROM Shop_Product_Permutation_Temp PP_T
LEFT JOIN Shop_Product_Permutation PP ON PP_T.id_permutation = PP.id_permutation LEFT JOIN Shop_Product_Permutation PP ON PP_T.id_permutation = PP.id_permutation
@@ -162,67 +166,77 @@ BEGIN
-- id_product -- id_product
IF EXISTS (SELECT * FROM tmp_Permutation t_P WHERE ISNULL(t_P.id_product) LIMIT 1) THEN IF EXISTS (SELECT * FROM tmp_Permutation t_P WHERE ISNULL(t_P.id_product) LIMIT 1) THEN
INSERT INTO tmp_Msg_Error ( INSERT INTO tmp_Msg_Error (
guid id_type
, id_type , code
, id_product
, msg , msg
) )
SELECT SELECT
a_guid AS GUID v_id_type_error_bad_data
, v_id_type_error_bad_data
, v_code_type_error_bad_data , v_code_type_error_bad_data
, CONCAT('The following product permutation(s) do not have a product: ', GROUP_CONCAT(IFNULL(t_P.name_error, 'NULL') SEPARATOR ', ')) AS msg , CONCAT('The following product permutation(s) do not have a product: ', GROUP_CONCAT(t_P.name_error SEPARATOR ', ')) AS msg
FROM tmp_Permutation t_P FROM tmp_Permutation t_P
WHERE ISNULL(t_P.id_product) WHERE ISNULL(t_P.id_product)
; ;
END IF; END IF;
-- cost_local -- cost_local_VAT_excl
IF EXISTS (SELECT * FROM tmp_Permutation t_P WHERE ISNULL(t_P.cost_local) LIMIT 1) THEN IF EXISTS (SELECT * FROM tmp_Permutation t_P WHERE NOT ISNULL(t_P.cost_local_VAT_excl) AND t_P.cost_local_VAT_excl < 0 LIMIT 1) THEN
INSERT INTO tmp_Msg_Error ( INSERT INTO tmp_Msg_Error (
guid id_type
, id_type , code
, cost_local
, msg , msg
) )
SELECT SELECT
a_guid AS GUID v_id_type_error_bad_data
, v_id_type_error_bad_data
, v_code_type_error_bad_data , v_code_type_error_bad_data
, CONCAT('The following product permutation(s) do not have a local cost: ', GROUP_CONCAT(IFNULL(t_P.name_error, 'NULL') SEPARATOR ', ')) AS msg , CONCAT('The following product permutation(s) do not have a valid local cost excluding VAT: ', GROUP_CONCAT(t_P.name_error SEPARATOR ', ')) AS msg
FROM tmp_Permutation t_P FROM tmp_Permutation t_P
WHERE ISNULL(t_P.cost_local) WHERE NOT ISNULL(t_P.cost_local_VAT_excl) AND t_P.cost_local_VAT_excl < 0
;
END IF;
-- cost_local_VAT_incl
IF EXISTS (SELECT * FROM tmp_Permutation t_P WHERE NOT ISNULL(t_P.cost_local_VAT_incl) AND t_P.cost_local_VAT_incl < 0 LIMIT 1) THEN
INSERT INTO tmp_Msg_Error (
id_type
, code
, msg
)
SELECT
v_id_type_error_bad_data
, v_code_type_error_bad_data
, CONCAT('The following product permutation(s) do not have a valid local cost including VAT: ', GROUP_CONCAT(t_P.name_error SEPARATOR ', ')) AS msg
FROM tmp_Permutation t_P
WHERE NOT ISNULL(t_P.cost_local_VAT_incl) AND t_P.cost_local_VAT_incl < 0
; ;
END IF; END IF;
-- profit_local_min -- profit_local_min
IF EXISTS (SELECT * FROM tmp_Permutation t_P WHERE ISNULL(t_P.profit_local_min) LIMIT 1) THEN IF EXISTS (SELECT * FROM tmp_Permutation t_P WHERE NOT ISNULL(t_P.profit_local_min) AND t_P.profit_local_min < 0 LIMIT 1) THEN
INSERT INTO tmp_Msg_Error ( INSERT INTO tmp_Msg_Error (
guid id_type
, id_type , code
, profit_local_min
, msg , msg
) )
SELECT SELECT
a_guid AS GUID v_id_type_error_bad_data
, v_id_type_error_bad_data
, v_code_type_error_bad_data , v_code_type_error_bad_data
, CONCAT('The following product permutation(s) do not have a local minimum profit: ', GROUP_CONCAT(IFNULL(t_P.name_error, 'NULL') SEPARATOR ', ')) AS msg , CONCAT('The following product permutation(s) do not have a local minimum profit: ', GROUP_CONCAT(t_P.name_error SEPARATOR ', ')) AS msg
FROM tmp_Permutation t_P FROM tmp_Permutation t_P
WHERE ISNULL(t_P.profit_local_min) WHERE NOT ISNULL(t_P.profit_local_min) AND t_P.profit_local_min < 0
; ;
END IF; END IF;
SELECT 'NIPS';
-- latency_manufacture -- latency_manufacture
IF EXISTS (SELECT * FROM tmp_Permutation t_P WHERE ISNULL(t_P.latency_manufacture) LIMIT 1) THEN IF EXISTS (SELECT * FROM tmp_Permutation t_P WHERE ISNULL(t_P.latency_manufacture) LIMIT 1) THEN
INSERT INTO tmp_Msg_Error ( INSERT INTO tmp_Msg_Error (
guid id_type
, id_type , code
, latency_manufacture
, msg , msg
) )
SELECT SELECT
a_guid AS GUID v_id_type_error_bad_data
, v_id_type_error_bad_data
, v_code_type_error_bad_data , v_code_type_error_bad_data
, CONCAT('The following product permutation(s) do not have a manufacturing latency: ', GROUP_CONCAT(IFNULL(t_P.name_error, 'NULL') SEPARATOR ', ')) AS msg , CONCAT('The following product permutation(s) do not have a manufacturing latency: ', GROUP_CONCAT(t_P.name_error SEPARATOR ', ')) AS msg
FROM tmp_Permutation t_P FROM tmp_Permutation t_P
WHERE ISNULL(t_P.latency_manufacture) WHERE ISNULL(t_P.latency_manufacture)
; ;
@@ -230,16 +244,14 @@ BEGIN
-- id_unit_measurement_quantity -- id_unit_measurement_quantity
IF EXISTS (SELECT * FROM tmp_Permutation t_P WHERE ISNULL(t_P.id_unit_measurement_quantity) LIMIT 1) THEN IF EXISTS (SELECT * FROM tmp_Permutation t_P WHERE ISNULL(t_P.id_unit_measurement_quantity) LIMIT 1) THEN
INSERT INTO tmp_Msg_Error ( INSERT INTO tmp_Msg_Error (
guid id_type
, id_type , code
, id_unit_measurement_quantity
, msg , msg
) )
SELECT SELECT
a_guid AS GUID v_id_type_error_bad_data
, v_id_type_error_bad_data
, v_code_type_error_bad_data , v_code_type_error_bad_data
, CONCAT('The following product permutation(s) do not have a unit measurement for stock quantities: ', GROUP_CONCAT(IFNULL(t_P.name_error, 'NULL') SEPARATOR ', ')) AS msg , CONCAT('The following product permutation(s) do not have a unit measurement for stock quantities: ', GROUP_CONCAT(t_P.name_error SEPARATOR ', ')) AS msg
FROM tmp_Permutation t_P FROM tmp_Permutation t_P
WHERE ISNULL(t_P.id_unit_measurement_quantity) WHERE ISNULL(t_P.id_unit_measurement_quantity)
; ;
@@ -247,16 +259,14 @@ BEGIN
-- count_unit_measurement_per_quantity_step -- count_unit_measurement_per_quantity_step
IF EXISTS (SELECT * FROM tmp_Permutation t_P WHERE ISNULL(t_P.count_unit_measurement_per_quantity_step) LIMIT 1) THEN IF EXISTS (SELECT * FROM tmp_Permutation t_P WHERE ISNULL(t_P.count_unit_measurement_per_quantity_step) LIMIT 1) THEN
INSERT INTO tmp_Msg_Error ( INSERT INTO tmp_Msg_Error (
guid id_type
, id_type , code
, count_unit_measurement_per_quantity_step
, msg , msg
) )
SELECT SELECT
a_guid AS GUID v_id_type_error_bad_data
, v_id_type_error_bad_data
, v_code_type_error_bad_data , v_code_type_error_bad_data
, CONCAT('The following product permutation(s) do not have a count unit measurement per quantity step: ', GROUP_CONCAT(IFNULL(t_P.name_error, 'NULL') SEPARATOR ', ')) AS msg , CONCAT('The following product permutation(s) do not have a count unit measurement per quantity step: ', GROUP_CONCAT(t_P.name_error SEPARATOR ', ')) AS msg
FROM tmp_Permutation t_P FROM tmp_Permutation t_P
WHERE ISNULL(t_P.count_unit_measurement_per_quantity_step) WHERE ISNULL(t_P.count_unit_measurement_per_quantity_step)
; ;
@@ -264,16 +274,14 @@ BEGIN
-- quantity_min -- quantity_min
IF EXISTS (SELECT * FROM tmp_Permutation t_P WHERE ISNULL(t_P.quantity_min) LIMIT 1) THEN IF EXISTS (SELECT * FROM tmp_Permutation t_P WHERE ISNULL(t_P.quantity_min) LIMIT 1) THEN
INSERT INTO tmp_Msg_Error ( INSERT INTO tmp_Msg_Error (
guid id_type
, id_type , code
, quantity_min
, msg , msg
) )
SELECT SELECT
a_guid AS GUID v_id_type_error_bad_data
, v_id_type_error_bad_data
, v_code_type_error_bad_data , v_code_type_error_bad_data
, CONCAT('The following product permutation(s) do not have a minimum quantity: ', GROUP_CONCAT(IFNULL(t_P.name_error, 'NULL') SEPARATOR ', ')) AS msg , CONCAT('The following product permutation(s) do not have a minimum quantity: ', GROUP_CONCAT(t_P.name_error SEPARATOR ', ')) AS msg
FROM tmp_Permutation t_P FROM tmp_Permutation t_P
WHERE ISNULL(t_P.quantity_min) WHERE ISNULL(t_P.quantity_min)
; ;
@@ -281,16 +289,14 @@ BEGIN
-- quantity_max -- quantity_max
IF EXISTS (SELECT * FROM tmp_Permutation t_P WHERE ISNULL(t_P.quantity_max) LIMIT 1) THEN IF EXISTS (SELECT * FROM tmp_Permutation t_P WHERE ISNULL(t_P.quantity_max) LIMIT 1) THEN
INSERT INTO tmp_Msg_Error ( INSERT INTO tmp_Msg_Error (
guid id_type
, id_type , code
, quantity_max
, msg , msg
) )
SELECT SELECT
a_guid AS GUID v_id_type_error_bad_data
, v_id_type_error_bad_data
, v_code_type_error_bad_data , v_code_type_error_bad_data
, CONCAT('The following product permutation(s) do not have a maximum quantity: ', GROUP_CONCAT(IFNULL(t_P.name_error, 'NULL') SEPARATOR ', ')) AS msg , CONCAT('The following product permutation(s) do not have a maximum quantity: ', GROUP_CONCAT(t_P.name_error SEPARATOR ', ')) AS msg
FROM tmp_Permutation t_P FROM tmp_Permutation t_P
WHERE ISNULL(t_P.quantity_max) WHERE ISNULL(t_P.quantity_max)
; ;
@@ -298,16 +304,14 @@ BEGIN
-- is_subscription -- is_subscription
IF EXISTS (SELECT * FROM tmp_Permutation t_P WHERE ISNULL(t_P.is_subscription) LIMIT 1) THEN IF EXISTS (SELECT * FROM tmp_Permutation t_P WHERE ISNULL(t_P.is_subscription) LIMIT 1) THEN
INSERT INTO tmp_Msg_Error ( INSERT INTO tmp_Msg_Error (
guid id_type
, id_type , code
, is_subscription
, msg , msg
) )
SELECT SELECT
a_guid AS GUID v_id_type_error_bad_data
, v_id_type_error_bad_data
, v_code_type_error_bad_data , v_code_type_error_bad_data
, CONCAT('The following product permutation(s) do not have an is subscription?: ', GROUP_CONCAT(IFNULL(t_P.name_error, 'NULL') SEPARATOR ', ')) AS msg , CONCAT('The following product permutation(s) do not have an is subscription?: ', GROUP_CONCAT(t_P.name_error SEPARATOR ', ')) AS msg
FROM tmp_Permutation t_P FROM tmp_Permutation t_P
WHERE ISNULL(t_P.is_subscription) WHERE ISNULL(t_P.is_subscription)
; ;
@@ -315,68 +319,82 @@ BEGIN
-- does_expire_faster_once_unsealed -- does_expire_faster_once_unsealed
IF EXISTS (SELECT * FROM tmp_Permutation t_P WHERE ISNULL(t_P.does_expire_faster_once_unsealed) LIMIT 1) THEN IF EXISTS (SELECT * FROM tmp_Permutation t_P WHERE ISNULL(t_P.does_expire_faster_once_unsealed) LIMIT 1) THEN
INSERT INTO tmp_Msg_Error ( INSERT INTO tmp_Msg_Error (
guid id_type
, id_type , code
, does_expire_faster_once_unsealed
, msg , msg
) )
SELECT SELECT
a_guid AS GUID v_id_type_error_bad_data
, v_id_type_error_bad_data
, v_code_type_error_bad_data , v_code_type_error_bad_data
, CONCAT('The following product permutation(s) do not have a does expire faster once unsealed: ', GROUP_CONCAT(IFNULL(t_P.name_error, 'NULL') SEPARATOR ', ')) AS msg , CONCAT('The following product permutation(s) do not have a does expire faster once unsealed: ', GROUP_CONCAT(t_P.name_error SEPARATOR ', ')) AS msg
FROM tmp_Permutation t_P FROM tmp_Permutation t_P
WHERE ISNULL(t_P.does_expire_faster_once_unsealed) WHERE ISNULL(t_P.does_expire_faster_once_unsealed)
; ;
END IF; END IF;
-- Permissions -- Permissions
IF NOT EXISTS (SELECT * FROM tmp_Msg_Error LIMIT 1) THEN -- (SELECT * FROM tmp_Product WHERE is_new = 0 LIMIT 1) THEN SET v_ids_product_permission := (
SET v_ids_product_permission := ( SELECT GROUP_CONCAT(P.id_product SEPARATOR ',')
SELECT GROUP_CONCAT(P.id_product SEPARATOR ',') FROM Shop_Product P
FROM Shop_Product P INNER JOIN tmp_Permutation t_P
INNER JOIN tmp_Permutation t_P ON P.id_product = t_P.id_product
ON P.id_product = t_P.id_product -- AND t_P.is_new = 0
-- AND t_P.is_new = 0 );
);
IF NOT ISNULL(v_ids_product_permission) THEN SET v_id_permission_product = (SELECT id_permission FROM Shop_Permission WHERE code = 'STORE_PRODUCT' LIMIT 1);
SET v_id_permission_product = (SELECT id_permission FROM Shop_Permission WHERE code = 'STORE_PRODUCT' LIMIT 1);
IF a_debug = 1 THEN
CALL p_shop_calc_user(a_guid, a_id_user, FALSE, v_id_permission_product, v_id_access_level_edit, v_ids_product_permission); SELECT
a_guid
UPDATE tmp_Permutation t_P , a_id_user
INNER JOIN Shop_Product P ON t_P.id_product = P.id_product , FALSE AS a_get_inactive_user
INNER JOIN Shop_Calc_User_Temp UE_T , v_id_permission_product
ON P.id_product = UE_T.id_product , v_id_access_level_edit
AND UE_T.GUID = a_guid , v_ids_product_permission
SET , 0 AS a_debug
t_P.can_view = UE_T.can_view ;
, t_P.can_edit = UE_T.can_edit
, t_P.can_admin = UE_T.can_admin
;
CALL p_shop_clear_calc_user(a_guid);
IF EXISTS (SELECT * FROM tmp_Permutation t_P WHERE ISNULL(t_P.can_edit) LIMIT 1) THEN
INSERT INTO tmp_Msg_Error (
guid
, id_type
, code
, msg
)
SELECT
a_guid AS GUID
, v_id_type_error_bad_data
, v_code_type_error_bad_data
, CONCAT('The following product permutation(s) do not have product edit permission: ', GROUP_CONCAT(IFNULL(t_P.name_error, 'NULL') SEPARATOR ', ')) AS msg
FROM tmp_Permutation t_P
WHERE ISNULL(t_P.can_edit)
;
END IF;
END IF;
END IF; END IF;
SET v_now := CURRENT_DATETIME(); CALL p_shop_calc_user(
a_guid
, a_id_user
, FALSE -- a_get_inactive_user
, v_id_permission_product
, v_id_access_level_edit
, v_ids_product_permission
, 0 -- a_debug
);
UPDATE tmp_Permutation t_P
INNER JOIN Shop_Product P ON t_P.id_product = P.id_product
INNER JOIN Shop_Calc_User_Temp UE_T
ON P.id_product = UE_T.id_product
AND UE_T.GUID = a_guid
SET
t_P.can_view = UE_T.can_view
, t_P.can_edit = UE_T.can_edit
, t_P.can_admin = UE_T.can_admin
;
CALL p_shop_clear_calc_user(
a_guid
, 0 -- a_debug
);
IF EXISTS (SELECT * FROM tmp_Permutation t_P WHERE ISNULL(t_P.can_edit) LIMIT 1) THEN
INSERT INTO tmp_Msg_Error (
id_type
, code
, msg
)
SELECT
v_id_type_error_bad_data
, v_code_type_error_bad_data
, CONCAT('The following product permutation(s) do not have product edit permission: ', GROUP_CONCAT(t_P.name_error SEPARATOR ', ')) AS msg
FROM tmp_Permutation t_P
WHERE ISNULL(t_P.can_edit)
;
END IF;
IF NOT EXISTS (SELECT * FROM tmp_Msg_Error LIMIT 1) THEN IF NOT EXISTS (SELECT * FROM tmp_Msg_Error LIMIT 1) THEN
START TRANSACTION; START TRANSACTION;
@@ -393,7 +411,8 @@ BEGIN
SET SET
PP.id_product = t_P.id_product PP.id_product = t_P.id_product
, PP.description = t_P.description , PP.description = t_P.description
, PP.cost_local = t_P.cost_local , PP.cost_local_VAT_excl = t_P.cost_local_VAT_excl
, PP.cost_local_VAT_incl = t_P.cost_local_VAT_incl
, PP.id_currency_cost = t_P.id_currency_cost , PP.id_currency_cost = t_P.id_currency_cost
, PP.profit_local_min = t_P.profit_local_min , PP.profit_local_min = t_P.profit_local_min
, PP.latency_manufacture = t_P.latency_manufacture , PP.latency_manufacture = t_P.latency_manufacture
@@ -417,7 +436,8 @@ BEGIN
INSERT INTO Shop_Product_Permutation ( INSERT INTO Shop_Product_Permutation (
id_product id_product
, description , description
, cost_local , cost_local_VAT_excl
, cost_local_VAT_incl
, id_currency_cost , id_currency_cost
, profit_local_min , profit_local_min
, latency_manufacture , latency_manufacture
@@ -440,7 +460,8 @@ BEGIN
SELECT SELECT
t_P.id_product AS id_product t_P.id_product AS id_product
, t_P.description AS description , t_P.description AS description
, t_P.cost_local AS cost_local , t_P.cost_local_VAT_excl AS cost_local_VAT_excl
, t_P.cost_local_VAT_incl AS cost_local_VAT_incl
, t_P.id_currency_cost AS id_currency_cost , t_P.id_currency_cost AS id_currency_cost
, t_P.profit_local_min AS profit_local_min , t_P.profit_local_min AS profit_local_min
, t_P.latency_manufacture AS latency_manufacture , t_P.latency_manufacture AS latency_manufacture
@@ -458,7 +479,7 @@ BEGIN
, t_P.count_interval_expiration_unsealed AS count_interval_expiration_unsealed , t_P.count_interval_expiration_unsealed AS count_interval_expiration_unsealed
, t_P.active AS active , t_P.active AS active
, a_id_user AS created_by , a_id_user AS created_by
, v_now AS created_on , v_time_start AS created_on
FROM tmp_Permutation t_P FROM tmp_Permutation t_P
WHERE WHERE
is_new = 1 is_new = 1
@@ -471,10 +492,22 @@ BEGIN
COMMIT; COMMIT;
END IF; END IF;
SELECT * FROM tmp_Msg_Error; # Errors
SELECT *
FROM tmp_Msg_Error t_ME
INNER JOIN partsltd_prod.Shop_Msg_Error_Type MET ON t_ME.id_type = MET.id_type
;
DROP TEMPORARY TABLE IF EXISTS tmp_Permutation; IF a_debug = 1 THEN
DROP TEMPORARY TABLE IF EXISTS tmp_Msg_Error; SELECT * from tmp_Permutation;
END IF;
DROP TEMPORARY TABLE tmp_Permutation;
DROP TEMPORARY TABLE tmp_Msg_Error;
IF a_debug = 1 THEN
CALL partsltd_prod.p_debug_timing_reporting ( v_time_start );
END IF;
END // END //
DELIMITER ;; DELIMITER ;;

View File

@@ -0,0 +1,124 @@
-- Clear previous proc
DROP PROCEDURE IF EXISTS partsltd_prod.p_shop_save_product_permutation_test;
DELIMITER //
CREATE PROCEDURE p_shop_save_product_permutation_test ()
BEGIN
DECLARE v_guid BINARY(36);
DECLARE v_time_start TIMESTAMP(6);
SET v_time_start := CURRENT_TIMESTAMP(6);
SET v_guid := 'nips';
SELECT *
FROM partsltd_prod.Shop_Product_Permutation
;
SELECT *
FROM partsltd_prod.Shop_Product_Permutation_Temp
;
START TRANSACTION;
INSERT INTO partsltd_prod.Shop_Product_Permutation_Temp (
id_permutation
, id_product
, description
, cost_local_VAT_excl
, cost_local_VAT_incl
, id_currency_cost
, profit_local_min
, latency_manufacture
, id_unit_measurement_quantity
, count_unit_measurement_per_quantity_step
, quantity_min
, quantity_max
, quantity_stock
, is_subscription
, id_unit_measurement_interval_recurrence
, count_interval_recurrence
, id_stripe_product
, does_expire_faster_once_unsealed
, id_unit_measurement_interval_expiration_unsealed
, count_interval_expiration_unsealed
, active
, guid
)
VALUES
/* Test 1 - Insert */
(
-1 -- id_permutation
, 8 -- id_product
, 'Hair clip' -- description
, NULL -- cost_local_VAT_excl
, NULL -- cost_local_VAT_incl
, 1 -- id_currency_cost
, NULL -- profit_local_min
, 1 -- latency_manufacture
, 3 -- id_unit_measurement_quantity
, 1 -- count_unit_measurement_per_quantity_step
, 0 -- quantity_min
, 0 -- quantity_max
, 2 -- quantity_stock
, FALSE -- is_subscription
, NULL -- id_unit_measurement_interval_recurrence
, NULL -- count_interval_recurrence
, NULL -- id_stripe_product
, FALSE -- does_expire_faster_once_unsealed
, NULL -- id_unit_measurement_interval_expiration_unsealed
, NULL -- count_interval_expiration_unsealed
, 1 -- active
, v_guid
)
/* Test 2 - Update
(
4 -- id_product
, 1 -- id_category
, 'Laptops' -- name
, 0 -- has_variations
, 2 -- id_access_level_required
, 2 -- display_order
, 1 -- active
, v_guid
)
*/
;
COMMIT;
SELECT *
FROM partsltd_prod.Shop_Product_Permutation_Temp
WHERE GUID = v_guid
;
CALL partsltd_prod.p_shop_save_product_permutation (
'Test save product' -- comment
, v_guid -- guid
, 1 -- id_user
, 1 -- debug
);
SELECT *
FROM partsltd_prod.Shop_Product_Permutation
;
SELECT *
FROM partsltd_prod.Shop_Product_Permutation_Temp
;
CALL partsltd_prod.p_debug_timing_reporting ( v_time_start );
END //
DELIMITER ;;
/*
CALL partsltd_prod.p_shop_save_product_permutation_test ();
DELETE FROM partsltd_prod.Shop_Product_Permutation_Temp;
DROP TABLE IF EXISTS tmp_Msg_Error;
SELECT * FROM partsltd_prod.Shop_Product
*/

View File

@@ -429,7 +429,7 @@ BEGIN
-- Transaction -- Transaction
IF NOT EXISTS (SELECT * FROM tmp_Msg_Error) THEN IF NOT EXISTS (SELECT * FROM tmp_Msg_Error) THEN
START TRANSACTION; START TRANSACTION;
INSERT INTO partsltd_prod.Shop_Sales_And_Purchasing_Change_Set ( INSERT INTO partsltd_prod.Shop_User_Change_Set (
comment comment
, updated_last_by , updated_last_by
, updated_last_on , updated_last_on

View File

@@ -42,6 +42,7 @@ BEGIN
, active , active
, guid , guid
) )
/* Test 1 - Insert
VALUES ( VALUES (
-3 -3
, 1 , 1
@@ -54,8 +55,26 @@ BEGIN
, 'test url' , 'test url'
, 1 -- active , 1 -- active
, v_guid , v_guid
); )
*/
/* Test 2 - Update */
SELECT
id_supplier
, id_currency
, name_company
, 'Nat' AS name_contact
, 'Butchery' AS department_contact
, phone_number
, fax
, email
, website
, active
, v_guid
FROM partsltd_prod.Shop_Supplier S
WHERE S.id_supplier = 2
;
/*
INSERT INTO partsltd_prod.Shop_Supplier_Address_Temp ( INSERT INTO partsltd_prod.Shop_Supplier_Address_Temp (
id_address id_address
, id_supplier , id_supplier
@@ -68,6 +87,7 @@ BEGIN
, active , active
, GUID , GUID
) )
/ Test 1 - Insert
VALUES ( VALUES (
-4 -4
, -3 , -3
@@ -80,7 +100,23 @@ BEGIN
, 1 , 1
, v_guid , v_guid
) )
/
/ Test 2 - Update /
SELECT
id_address
, id_supplier
, id_region
, postcode
, address_line_1
, address_line_2
, city
, county
, active
, v_guid
FROM partsltd_prod.Shop_Supplier_Address SA
WHERE SA.id_supplier = 2
; ;
*/
COMMIT; COMMIT;
@@ -118,14 +154,14 @@ BEGIN
END // END //
DELIMITER ;; DELIMITER ;;
/*
CALL partsltd_prod.p_shop_save_supplier_test (); CALL partsltd_prod.p_shop_save_supplier_test ();
DELETE FROM partsltd_prod.Shop_Supplier_Temp; DELETE FROM partsltd_prod.Shop_Supplier_Temp;
DELETE FROM partsltd_prod.Shop_Supplier_Address_Temp; DELETE FROM partsltd_prod.Shop_Supplier_Address_Temp;
DROP TABLE IF EXISTS tmp_Msg_Error; DROP TABLE IF EXISTS tmp_Msg_Error;
/*
Cannot add or update a child row: a foreign key constraint fails (`partsltd_prod`.`shop_supplier_address`, CONSTRAINT `FK_Shop_Supplier_Address_id_supplier` FOREIGN KEY (`id_supplier`) REFERENCES `shop_supplier` (`id_supplier`) ON UPDATE RESTRICT) Cannot add or update a child row: a foreign key constraint fails (`partsltd_prod`.`shop_supplier`, CONSTRAINT `FK_Shop_Supplier_id_change_set` FOREIGN KEY (`id_change_set`) REFERENCES `shop_sales_and_purchasing_change_set` (`id_change_set`))
*/ */

View File

@@ -285,7 +285,7 @@ BEGIN
'A valid ID is required for the following Supplier Purchase Order(s): ' 'A valid ID is required for the following Supplier Purchase Order(s): '
, GROUP_CONCAT(CONCAT(IFNULL(t_SPO.id_stock, '(No Supplier Purchase Order)')) SEPARATOR ', ') , GROUP_CONCAT(CONCAT(IFNULL(t_SPO.id_stock, '(No Supplier Purchase Order)')) SEPARATOR ', ')
) AS msg ) AS msg
FROM tmp_Stock_Item t_SPO FROM tmp_Supplier_Purchase_Order t_SPO
LEFT JOIN partsltd_prod.Shop_Supplier_Purchase_Order SPO ON t_SPO.id_order = SPO.id_order LEFT JOIN partsltd_prod.Shop_Supplier_Purchase_Order SPO ON t_SPO.id_order = SPO.id_order
WHERE 1=1 WHERE 1=1
AND t_SPO.id_stock > 0 AND t_SPO.id_stock > 0
@@ -316,7 +316,7 @@ BEGIN
'A valid supplier is required for the following Supplier Purchase Order(s): ' 'A valid supplier is required for the following Supplier Purchase Order(s): '
, GROUP_CONCAT(CONCAT(IFNULL(t_SPO.id_stock, '(No Supplier Purchase Order)'), ' - ', t_SPO.id_supplier_ordered) SEPARATOR ', ') , GROUP_CONCAT(CONCAT(IFNULL(t_SPO.id_stock, '(No Supplier Purchase Order)'), ' - ', t_SPO.id_supplier_ordered) SEPARATOR ', ')
) AS msg ) AS msg
FROM tmp_Stock_Item t_SPO FROM tmp_Supplier_Purchase_Order t_SPO
LEFT JOIN partsltd_prod.Shop_Supplier S ON t_SPO.id_supplier_ordered = S.id_supplier LEFT JOIN partsltd_prod.Shop_Supplier S ON t_SPO.id_supplier_ordered = S.id_supplier
WHERE 1=1 WHERE 1=1
AND ( AND (
@@ -349,7 +349,7 @@ BEGIN
'A valid currency is required for the following Supplier Purchase Order(s): ' 'A valid currency is required for the following Supplier Purchase Order(s): '
, GROUP_CONCAT(CONCAT(IFNULL(t_SPO.id_stock, '(No Supplier Purchase Order)'), ' - ', t_SPO.id_currency_cost) SEPARATOR ', ') , GROUP_CONCAT(CONCAT(IFNULL(t_SPO.id_stock, '(No Supplier Purchase Order)'), ' - ', t_SPO.id_currency_cost) SEPARATOR ', ')
) AS msg ) AS msg
FROM tmp_Stock_Item t_SPO FROM tmp_Supplier_Purchase_Order t_SPO
LEFT JOIN partsltd_prod.Shop_Currency C ON t_SPO.id_currency_cost = C.id_currency LEFT JOIN partsltd_prod.Shop_Currency C ON t_SPO.id_currency_cost = C.id_currency
WHERE 1=1 WHERE 1=1
AND ( AND (
@@ -559,7 +559,7 @@ BEGIN
SELECT * from partsltd_prod.Shop_Calc_User_Temp WHERE GUID = a_guid; SELECT * from partsltd_prod.Shop_Calc_User_Temp WHERE GUID = a_guid;
END IF; END IF;
IF NOT EXISTS (SELECT can_view FROM partsltd_prod.Shop_Calc_User_Temp UE_T WHERE UE_T.GUID = a_guid) THEN IF EXISTS (SELECT * FROM partsltd_prod.Shop_Calc_User_Temp UE_T WHERE UE_T.GUID = a_guid AND IFNULL(UE_T.can_view, 0) = 0) THEN
DELETE FROM tmp_Msg_Error; DELETE FROM tmp_Msg_Error;
INSERT INTO tmp_Msg_Error ( INSERT INTO tmp_Msg_Error (
@@ -567,11 +567,18 @@ BEGIN
, code , code
, msg , msg
) )
VALUES ( SELECT
v_id_type_error_no_permission v_id_type_error_no_permission
, v_code_type_error_no_permission , v_code_type_error_no_permission
, CONCAT('You do not have view permissions for ', (SELECT name FROM partsltd_prod.Shop_Permission WHERE id_permission = v_id_permission_supplier LIMIT 1)) , CONCAT(
) 'You do not have view permissions for '
, GROUP_CONCAT(name SEPARATOR ', ')
) AS msg
FROM partsltd_prod.Shop_Permission PERM
INNER JOIN partsltd_prod.Shop_Calc_User_Temp UE_T
ON PERM.id_permission = UE_T.id_permission
AND UE_T.GUID = a_guid
AND IFNULL(UE_T.can_view, 0) = 0
; ;
END IF; END IF;

View File

@@ -39,7 +39,7 @@ BEGIN
, active , active
, GUID , GUID
) )
/* Test 1 - Insert /* Test 1 - Insert */
VALUES ( VALUES (
-1 -1
, 1 , 1
@@ -47,7 +47,7 @@ BEGIN
, 1 , 1
, v_guid , v_guid
) )
*/ /* Test 2 - Update
SELECT SELECT
id_order id_order
, id_supplier_ordered , id_supplier_ordered
@@ -56,6 +56,7 @@ BEGIN
, v_guid , v_guid
FROM partsltd_prod.Shop_Supplier_Purchase_Order FROM partsltd_prod.Shop_Supplier_Purchase_Order
WHERE id_order = 6 WHERE id_order = 6
*/
; ;
INSERT INTO partsltd_prod.Shop_Supplier_Purchase_Order_Product_Link_Temp ( INSERT INTO partsltd_prod.Shop_Supplier_Purchase_Order_Product_Link_Temp (
@@ -72,7 +73,7 @@ BEGIN
, cost_total_local_VAT_incl , cost_total_local_VAT_incl
, GUID , GUID
) )
/* Test 1 - Insert /* Test 1 - Insert */
VALUES ( VALUES (
-1 -1
, -1 , -1
@@ -87,7 +88,7 @@ BEGIN
, 6 , 6
, v_guid , v_guid
) )
*/ /* Test 2 - Update
SELECT SELECT
id_link id_link
, id_order , id_order
@@ -103,6 +104,7 @@ BEGIN
, v_guid , v_guid
FROM partsltd_prod.Shop_Supplier_Purchase_Order_Product_Link FROM partsltd_prod.Shop_Supplier_Purchase_Order_Product_Link
WHERE id_order = 6 WHERE id_order = 6
*/
; ;
COMMIT; COMMIT;
@@ -149,6 +151,7 @@ DELETE FROM partsltd_prod.Shop_Supplier_Purchase_Order_Product_Link_Temp;
DROP TABLE IF EXISTS tmp_Msg_Error; DROP TABLE IF EXISTS tmp_Msg_Error;
/*
Cannot add or update a child row: a foreign key constraint fails (`partsltd_prod`.`shop_supplier_address`, CONSTRAINT `FK_Shop_Supplier_Address_id_supplier` FOREIGN KEY (`id_supplier`) REFERENCES `shop_supplier` (`id_supplier`) ON UPDATE RESTRICT) Cannot add or update a child row: a foreign key constraint fails (`partsltd_prod`.`shop_supplier_address`, CONSTRAINT `FK_Shop_Supplier_Address_id_supplier` FOREIGN KEY (`id_supplier`) REFERENCES `shop_supplier` (`id_supplier`) ON UPDATE RESTRICT)
*/ */

View File

@@ -0,0 +1,149 @@
-- Clear previous proc
DROP PROCEDURE IF EXISTS partsltd_prod.p_shop_save_Manufacturing_purchase_order_test;
DELIMITER //
CREATE PROCEDURE p_shop_save_Manufacturing_purchase_order_test ()
BEGIN
DECLARE v_guid BINARY(36);
DECLARE v_time_start TIMESTAMP(6);
SET v_time_start := CURRENT_TIMESTAMP(6);
SET v_guid := 'nips';
SELECT *
FROM partsltd_prod.Shop_Manufacturing_Purchase_Order
;
SELECT *
FROM partsltd_prod.Shop_Manufacturing_Purchase_Order_Temp
;
SELECT *
FROM partsltd_prod.Shop_Manufacturing_Purchase_Order_Product_Link
;
SELECT *
FROM partsltd_prod.Shop_Manufacturing_Purchase_Order_Product_Link_Temp
;
START TRANSACTION;
DELETE FROM partsltd_prod.Shop_Manufacturing_Purchase_Order_Temp;
DELETE FROM partsltd_prod.Shop_Manufacturing_Purchase_Order_Product_Link_Temp;
INSERT INTO partsltd_prod.Shop_Manufacturing_Purchase_Order_Temp (
id_order
, id_currency
, active
, GUID
)
/* Test 1 - Insert */
VALUES (
-1
, 1
, 1
, v_guid
)
/* Test 2: Alter
SELECT
id_order
, id_currency
, active
, v_guid
FROM partsltd_prod.Shop_Manufacturing_Purchase_Order
WHERE id_order = 6
*/
;-- SELECT * FROM partsltd_prod.Shop_Unit_Measurement;
INSERT INTO partsltd_prod.Shop_Manufacturing_Purchase_Order_Product_Link_Temp (
id_link
, id_order
, id_permutation
, id_unit_quantity
, quantity_used
, quantity_produced
, id_unit_latency_manufacture
, latency_manufacture
, display_order
, active
, GUID
)
/* Test 1 - Insert */
VALUES (
-1 -- id_link
, -1 -- id_order
, 3 -- id_permutation
, 3 -- id_unit_quantity
, 3 -- quantity_used
, 0 -- quantity_produced
, 4 -- id_unit_latency_manufacture
, 4 -- latency_manufacture
, 1 -- display_order
, 1 -- active
, v_guid --
)
/* Test 2: Alter
SELECT
id_link
, id_order
, id_permutation
, id_unit_quantity
, quantity_used
, quantity_produced
, id_unit_latency_manufacture
, latency_manufacture
, display_order
, active
, v_guid
FROM partsltd_prod.Shop_Manufacturing_Purchase_Order_Product_Link
WHERE id_order = 6
*/
;
COMMIT;
SELECT *
FROM partsltd_prod.Shop_Manufacturing_Purchase_Order_Temp
WHERE GUID = v_guid
;
SELECT *
FROM partsltd_prod.Shop_Manufacturing_Purchase_Order_Product_Link_Temp
WHERE GUID = v_guid
;
CALL partsltd_prod.p_shop_save_Manufacturing_purchase_order (
'Test save Manufacturing Purchase Order' -- comment
, v_guid -- guid
, 1 -- id_user
, 1 -- debug
);
SELECT *
FROM partsltd_prod.Shop_Manufacturing_Purchase_Order_Temp
;
SELECT *
FROM partsltd_prod.Shop_Manufacturing_Purchase_Order_Product_Link_Temp
;
SELECT *
FROM partsltd_prod.Shop_Manufacturing_Purchase_Order
;
SELECT *
FROM partsltd_prod.Shop_Manufacturing_Purchase_Order_Product_Link
;
CALL partsltd_prod.p_debug_timing_reporting ( v_time_start );
END //
DELIMITER ;;
/*
CALL partsltd_prod.p_shop_save_Manufacturing_purchase_order_test ();
DELETE FROM partsltd_prod.Shop_Manufacturing_Purchase_Order_Temp;
DELETE FROM partsltd_prod.Shop_Manufacturing_Purchase_Order_Product_Link_Temp;
DROP TABLE IF EXISTS tmp_Msg_Error;
select * from partsltd_prod.Shop_User;
*/

View File

@@ -18,11 +18,13 @@ CREATE PROCEDURE p_shop_save_manufacturing_purchase_order (
BEGIN BEGIN
DECLARE v_code_type_error_bad_data VARCHAR(50); DECLARE v_code_type_error_bad_data VARCHAR(50);
DECLARE v_code_type_error_no_permission VARCHAR(50); DECLARE v_code_type_error_no_permission VARCHAR(50);
DECLARE v_code_type_error_warning VARCHAR(50);
DECLARE v_id_access_level_edit INT; DECLARE v_id_access_level_edit INT;
DECLARE v_id_change_set INT; DECLARE v_id_change_set INT;
DECLARE v_ids_permission_manufacturing_purchase_order VARCHAR(100); DECLARE v_ids_permission_manufacturing_purchase_order VARCHAR(100);
DECLARE v_id_type_error_bad_data INT; DECLARE v_id_type_error_bad_data INT;
DECLARE v_id_type_error_no_permission INT; DECLARE v_id_type_error_no_permission INT;
DECLARE v_id_type_error_warning INT;
DECLARE v_ids_product_permission TEXT; DECLARE v_ids_product_permission TEXT;
DECLARE v_time_start TIMESTAMP(6); DECLARE v_time_start TIMESTAMP(6);
@@ -64,6 +66,8 @@ BEGIN
SET v_id_type_error_bad_data := (SELECT id_type FROM partsltd_prod.Shop_Msg_Error_Type WHERE code = v_code_type_error_bad_data LIMIT 1); SET v_id_type_error_bad_data := (SELECT id_type FROM partsltd_prod.Shop_Msg_Error_Type WHERE code = v_code_type_error_bad_data LIMIT 1);
SET v_code_type_error_no_permission := (SELECT code FROM partsltd_prod.Shop_Msg_Error_Type WHERE code = 'NO_PERMISSION' LIMIT 1); SET v_code_type_error_no_permission := (SELECT code FROM partsltd_prod.Shop_Msg_Error_Type WHERE code = 'NO_PERMISSION' LIMIT 1);
SET v_id_type_error_no_permission := (SELECT id_type FROM partsltd_prod.Shop_Msg_Error_Type WHERE code = v_code_type_error_no_permission LIMIT 1); SET v_id_type_error_no_permission := (SELECT id_type FROM partsltd_prod.Shop_Msg_Error_Type WHERE code = v_code_type_error_no_permission LIMIT 1);
SET v_code_type_error_warning := (SELECT code FROM partsltd_prod.Shop_Msg_Error_Type WHERE code = 'WARNING' LIMIT 1);
SET v_id_type_error_warning := (SELECT id_type FROM partsltd_prod.Shop_Msg_Error_Type WHERE code = v_code_type_error_warning LIMIT 1);
SET v_ids_permission_manufacturing_purchase_order := (SELECT GROUP_CONCAT(id_permission SEPARATOR ',') FROM partsltd_prod.Shop_Permission WHERE code IN ('STORE_MANUFACTURING_PURCHASE_ORDER', 'STORE_PRODUCT')); SET v_ids_permission_manufacturing_purchase_order := (SELECT GROUP_CONCAT(id_permission SEPARATOR ',') FROM partsltd_prod.Shop_Permission WHERE code IN ('STORE_MANUFACTURING_PURCHASE_ORDER', 'STORE_PRODUCT'));
SET v_id_access_level_edit := (SELECT id_access_level FROM partsltd_prod.Shop_Access_Level WHERE code = 'EDIT' LIMIT 1); SET v_id_access_level_edit := (SELECT id_access_level FROM partsltd_prod.Shop_Access_Level WHERE code = 'EDIT' LIMIT 1);
@@ -77,28 +81,38 @@ BEGIN
-- Temporary tables -- Temporary tables
CREATE TEMPORARY TABLE tmp_Manufacturing_Purchase_Order ( CREATE TEMPORARY TABLE tmp_Manufacturing_Purchase_Order (
id_order INT NOT NULL PRIMARY KEY id_order INT NOT NULL PRIMARY KEY
, id_currency_cost INT NOT NULL , id_order_temp INT NOT NULL
, id_currency INT NOT NULL
, active BIT NOT NULL
, is_new BIT NOT NULL , is_new BIT NOT NULL
, name_error VARCHAR(1000) NOT NULL , name_error VARCHAR(1000) NOT NULL
, cost_total_local_VAT_excl FLOAT NULL
, cost_total_local_VAT_incl FLOAT NULL
, price_total_local_VAT_excl FLOAT NULL
, price_total_local_VAT_incl FLOAT NULL
); );
CREATE TEMPORARY TABLE tmp_Manufacturing_Purchase_Order_Product_Link ( CREATE TEMPORARY TABLE tmp_Manufacturing_Purchase_Order_Product_Link (
id_link INT NOT NULL PRIMARY KEY id_link INT NOT NULL PRIMARY KEY
, id_order INT NOT NULL , id_order INT NOT NULL
, id_permutation INT NOT NULL , id_product INT NULL
, id_currency_cost INT NOT NULL , id_permutation INT NULL
, quantity_used FLOAT NOT NULL , id_currency INT NOT NULL
, id_unit_quantity INT NOT NULL , id_unit_quantity INT NOT NULL
, quantity_used FLOAT NOT NULL
, quantity_produced FLOAT NULL , quantity_produced FLOAT NULL
, id_unit_latency_manufacture INT NULL , id_unit_latency_manufacture INT NULL
, latency_manufacture INT NULL , latency_manufacture INT NULL
, display_order INT NOT NULL , display_order INT NOT NULL
, active BIT NOT NULL , active BIT NOT NULL
, name_error VARCHAR(200) NOT NULL , cost_unit_local_VAT_excl FLOAT NULL
, cost_total_local_VAT_excl FLOAT NOT NULL , cost_unit_local_VAT_incl FLOAT NULL
, cost_total_local_VAT_incl FLOAT NOT NULL , cost_total_local_VAT_excl FLOAT NULL
, cost_unit_local_VAT_excl FLOAT NOT NULL , cost_total_local_VAT_incl FLOAT NULL
, cost_unit_local_VAT_incl FLOAT NOT NULL , price_unit_local_VAT_excl FLOAT NULL
, price_unit_local_VAT_incl FLOAT NULL
, price_total_local_VAT_excl FLOAT NULL
, price_total_local_VAT_incl FLOAT NULL
, has_order BIT NULL , has_order BIT NULL
, is_new BIT NOT NULL , is_new BIT NOT NULL
, name_error VARCHAR(1000) NOT NULL , name_error VARCHAR(1000) NOT NULL
@@ -113,21 +127,37 @@ BEGIN
INSERT INTO tmp_Manufacturing_Purchase_Order ( INSERT INTO tmp_Manufacturing_Purchase_Order (
id_order id_order
, id_currency_cost , id_order_temp
, id_currency
, active
, is_new
, name_error
) )
SELECT SELECT
SPO_T.id_order MPO_T.id_order
, IFNULL(IFNULL(SPO_T.id_currency_cost, MPO.id_currency_cost), 0) AS id_currency_cost , MPO_T.id_order
FROM partsltd_prod.Shop_Manufacturing_Purchase_Order_Temp SPO_T , IFNULL(IFNULL(MPO_T.id_currency, MPO.id_currency), 0) AS id_currency
LEFT JOIN partsltd_prod.Shop_Manufacturing_Purchase_Order MPO ON SPO_T.id_order = MPO.id_order , IFNULL(IFNULL(MPO_T.active, MPO.active), 1) AS active
WHERE SPO_T.GUID = a_guid , IFNULL(MPO_T.id_order, 0) < 1 AS is_new
, CASE WHEN IFNULL(MPO_T.id_order, -1) < 0 THEN
CONCAT('New Manufacturing Purchase Order ', MPO_T.id_order)
ELSE
CONCAT(
IFNULL(IFNULL(MPO_T.id_order, MPO.id_order), '(No Manufacturing Purchase Order)')
, ' - '
, IFNULL(IFNULL(MPO_T.id_currency, MPO.id_currency), '(No Currency)')
)
END AS name_error
FROM partsltd_prod.Shop_Manufacturing_Purchase_Order_Temp MPO_T
LEFT JOIN partsltd_prod.Shop_Manufacturing_Purchase_Order MPO ON MPO_T.id_order = MPO.id_order
WHERE MPO_T.GUID = a_guid
; ;
INSERT INTO tmp_Manufacturing_Purchase_Order_Product_Link ( INSERT INTO tmp_Manufacturing_Purchase_Order_Product_Link (
id_link id_link
, id_order , id_order
, id_product
, id_permutation , id_permutation
, id_currency_cost
, id_unit_quantity , id_unit_quantity
, quantity_used , quantity_used
, quantity_produced , quantity_produced
@@ -135,55 +165,126 @@ BEGIN
, latency_manufacture , latency_manufacture
, display_order , display_order
, active , active
, name_error
, is_new
, cost_total_local_VAT_excl
, cost_total_local_VAT_incl
, cost_unit_local_VAT_excl , cost_unit_local_VAT_excl
, cost_unit_local_VAT_incl , cost_unit_local_VAT_incl
, price_unit_local_VAT_excl
, price_unit_local_VAT_incl
, has_order , has_order
, is_new
) )
SELECT SELECT
IFNULL(SPOPL_T.id_link, 0) AS id_link IFNULL(MPOPL_T.id_link, 0) AS id_link
, IFNULL(IFNULL(SPOPL_T.id_order, MPOPL.id_order), 0) AS id_order , IFNULL(IFNULL(MPOPL_T.id_order, MPOPL.id_order), 0) AS id_order
, IFNULL(IFNULL(SPOPL_T.id_permutation, MPOPL.id_permutation), 0) AS id_permutation , IFNULL(MPOPL_T.id_product, PP.id_product) AS id_product
, IFNULL(IFNULL(SPOPL_T.id_currency_cost, MPOPL.id_currency_cost), 0) AS id_currency_cost , IFNULL(
, IFNULL(IFNULL(SPOPL_T.id_unit_quantity, MPOPL.id_unit_quantity), 0) AS id_unit_quantity IFNULL(
, SPOPL_T.quantity_used AS quantity_used IFNULL(
, SPOPL_T.quantity_produced AS quantity_produced MPOPL_T.id_permutation
, SPOPL_T.id_unit_latency_manufacture AS id_unit_latency_manufacture , CASE WHEN NOT ISNULL(MPOPL_T.id_product) AND NOT ISNULL(MPOPL_T.csv_list_variations) THEN
, SPOPL_T.latency_manufacture AS latency_manufacture partsltd_prod.fn_shop_get_id_product_permutation_from_variation_csv_list(MPOPL_T.id_product, MPOPL_T.csv_list_variations)
, IFNULL(SPOPL_T.display_order, RANK() OVER (PARTITION BY IFNULL(IFNULL(SPOPL_T.id_order, MPOPL.id_order), 0) ORDER BY IFNULL(IFNULL(SPOPL_T.display_order, MPOPL.display_order), 0))) AS display_order ELSE NULL END
, IFNULL(IFNULL(SPOPL_T.active, MPOPL.active), 1) AS active )
, CONCAT( , MPOPL.id_permutation
fn_shop_get_product_permutation_name(SPOPL_T.id_permutation) )
, ' - x' , 0
, IFNULL(SPOPL_T.quantity_used, '(No Quantity)') ) AS id_permutation
) AS name_error , IFNULL(IFNULL(MPOPL_T.id_unit_quantity, MPOPL.id_unit_quantity), 0) AS id_unit_quantity
, IFNULL(SPOPL_T.id_link, 0) < 1 AS is_new , MPOPL_T.quantity_used AS quantity_used
, SPOPL_T.cost_total_local_VAT_excl AS cost_total_local_VAT_excl , MPOPL_T.quantity_produced AS quantity_produced
, SPOPL_T.cost_total_local_VAT_incl AS cost_total_local_VAT_incl , MPOPL_T.id_unit_latency_manufacture AS id_unit_latency_manufacture
, SPOPL_T.cost_total_local_VAT_excl / SPOPL_T.quantity_used AS cost_unit_local_VAT_excl , MPOPL_T.latency_manufacture AS latency_manufacture
, SPOPL_T.cost_total_local_VAT_incl / SPOPL_T.quantity_used AS cost_unit_local_VAT_incl , IFNULL(MPOPL_T.display_order, RANK() OVER (PARTITION BY IFNULL(IFNULL(MPOPL_T.id_order, MPOPL.id_order), 0) ORDER BY IFNULL(IFNULL(MPOPL_T.display_order, MPOPL.display_order), 0))) AS display_order
, IFNULL(IFNULL(MPOPL_T.active, MPOPL.active), 1) AS active
-- , MPOPL_T.cost_total_local_VAT_excl / MPOPL_T.quantity_used AS cost_unit_local_VAT_excl
-- , MPOPL_T.cost_total_local_VAT_incl / MPOPL_T.quantity_used AS cost_unit_local_VAT_incl
, IFNULL(MPOPL_T.cost_unit_local_VAT_excl, MPOPL.cost_unit_local_VAT_excl) AS cost_unit_local_VAT_excl
, IFNULL(MPOPL_T.cost_unit_local_VAT_incl, MPOPL.cost_unit_local_VAT_incl) AS cost_unit_local_VAT_incl
, IFNULL(MPOPL_T.price_unit_local_VAT_excl, MPOPL.price_unit_local_VAT_excl) AS price_unit_local_VAT_excl
, IFNULL(MPOPL_T.price_unit_local_VAT_incl, MPOPL.price_unit_local_VAT_incl) AS price_unit_local_VAT_incl
, NOT ISNULL(t_MPO.id_order) AS has_order , NOT ISNULL(t_MPO.id_order) AS has_order
FROM partsltd_prod.Shop_Manufacturing_Purchase_Order_Product_Link_Temp SPOPL_T , IFNULL(MPOPL_T.id_link, 0) < 1 AS is_new
LEFT JOIN partsltd_prod.Shop_Manufacturing_Purchase_Order_Product_Link MPOPL ON SPOPL_T.id_link = MPOPL.id_link FROM partsltd_prod.Shop_Manufacturing_Purchase_Order_Product_Link_Temp MPOPL_T
LEFT JOIN tmp_Manufacturing_Purchase_Order t_MPO ON SPOPL_T.id_order = t_MPO.id_order LEFT JOIN partsltd_prod.Shop_Manufacturing_Purchase_Order_Product_Link MPOPL ON MPOPL_T.id_link = MPOPL.id_link
WHERE SPOPL_T.GUID = a_guid LEFT JOIN tmp_Manufacturing_Purchase_Order t_MPO ON MPOPL_T.id_order = t_MPO.id_order
LEFT JOIN partsltd_prod.Shop_Product_Permutation PP ON MPOPL.id_permutation = PP.id_permutation
WHERE MPOPL_T.GUID = a_guid
; ;
UPDATE tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL
-- INNER JOIN partsltd_prod.Shop_Manufacturing_Purchase_Order_Product_Link_Temp MPOPL_T ON t_MPOPL.id_order = MPOPL_T.id_order
LEFT JOIN partsltd_prod.Shop_Product_Permutation PP ON t_MPOPL.id_permutation = PP.id_permutation
LEFT JOIN partsltd_prod.Shop_Product P ON PP.id_product = P.id_product
LEFT JOIN partsltd_prod.Shop_Product_Category PC ON P.id_category = PC.id_category
SET
name_error = CONCAT(
CASE WHEN ISNULL(t_MPOPL.id_permutation) THEN
CASE WHEN ISNULL(PP.id_product) THEN
'(No Product Permutation)'
ELSE
CONCAT(
PC.name
, ' - '
, P.name
)
END
ELSE
fn_shop_get_product_permutation_name(PP.id_permutation)
END
, ' - x'
, IFNULL(t_MPOPL.quantity_used, '(No Quantity)')
, ' Used - x'
, IFNULL(t_MPOPL.quantity_produced, '(No Quantity)')
, ' Produced'
)
, cost_total_local_VAT_excl = t_MPOPL.quantity_used * t_MPOPL.cost_unit_local_VAT_excl
, cost_total_local_VAT_incl = t_MPOPL.quantity_used * t_MPOPL.cost_unit_local_VAT_incl
, price_total_local_VAT_excl = t_MPOPL.quantity_produced * t_MPOPL.price_unit_local_VAT_excl
, price_total_local_VAT_incl = t_MPOPL.quantity_produced * t_MPOPL.price_unit_local_VAT_incl
;
-- Insert missing order records
INSERT INTO tmp_Manufacturing_Purchase_Order ( INSERT INTO tmp_Manufacturing_Purchase_Order (
id_order id_order
, id_currency_cost , id_order_temp
, id_currency
, active
, is_new
, name_error
) )
SELECT SELECT
SPO_T.id_order MPO.id_order
, IFNULL(IFNULL(SPO_T.id_currency_cost, MPO.id_currency_cost), 0) AS id_currency_cost , MPO.id_order_temp
, MPO.id_currency
, MPO.active
, FALSE AS is_new
, CONCAT(
IFNULL(MPO.id_order, '(No Manufacturing Purchase Order)')
, ' - '
, IFNULL(MPO.id_currency, '(No Currency)')
) AS name_error
FROM partsltd_prod.Shop_Manufacturing_Purchase_Order MPO FROM partsltd_prod.Shop_Manufacturing_Purchase_Order MPO
INNER JOIN tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL INNER JOIN tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL
ON MPO.id_order = t_MPOPL.id_order ON MPO.id_order = t_MPOPL.id_order
AND t_MPOPL.has_order = 0 AND t_MPOPL.has_order = 0
; ;
UPDATE tmp_Manufacturing_Purchase_Order t_MPO
INNER JOIN (
SELECT
t_MPOPL.id_order
, SUM(t_MPOPL.cost_total_local_VAT_excl) AS cost_total_local_VAT_excl
, SUM(t_MPOPL.cost_total_local_VAT_incl) AS cost_total_local_VAT_incl
, SUM(t_MPOPL.price_total_local_VAT_excl) AS price_total_local_VAT_excl
, SUM(t_MPOPL.price_total_local_VAT_incl) AS price_total_local_VAT_incl
FROM tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL
GROUP BY t_MPOPL.id_order
) SUM_t_MPOPL ON t_MPO.id_order = SUM_t_MPOPL.id_order
SET
t_MPO.cost_total_local_VAT_excl = SUM_t_MPOPL.cost_total_local_VAT_excl
, t_MPO.cost_total_local_VAT_incl = SUM_t_MPOPL.cost_total_local_VAT_incl
, t_MPO.price_total_local_VAT_excl = SUM_t_MPOPL.price_total_local_VAT_excl
, t_MPO.price_total_local_VAT_incl = SUM_t_MPOPL.price_total_local_VAT_incl
;
-- Validation -- Validation
-- Manufacturing Purchase Order -- Manufacturing Purchase Order
@@ -207,20 +308,20 @@ BEGIN
, v_code_type_error_bad_data , v_code_type_error_bad_data
, CONCAT( , CONCAT(
'A valid ID is required for the following Manufacturing Purchase Order(s): ' 'A valid ID is required for the following Manufacturing Purchase Order(s): '
, GROUP_CONCAT(CONCAT(IFNULL(t_MPO.id_stock, '(No Manufacturing Purchase Order)')) SEPARATOR ', ') , GROUP_CONCAT(t_MPO.name_error SEPARATOR ', ')
) AS msg ) AS msg
FROM tmp_Stock_Item t_SPO FROM tmp_Manufacturing_Purchase_Order t_MPO
LEFT JOIN partsltd_prod.Shop_Manufacturing_Purchase_Order MPO ON t_MPO.id_order = MPO.id_order LEFT JOIN partsltd_prod.Shop_Manufacturing_Purchase_Order MPO ON t_MPO.id_order = MPO.id_order
WHERE 1=1 WHERE 1=1
AND t_MPO.id_stock > 0 AND t_MPO.id_order > 0
AND ISNULL(MPO.id_stock) AND ISNULL(MPO.id_order)
; ;
END IF; END IF;
# id_currency_cost # id_currency
IF EXISTS ( IF EXISTS (
SELECT * SELECT *
FROM tmp_Manufacturing_Purchase_Order t_MPO FROM tmp_Manufacturing_Purchase_Order t_MPO
LEFT JOIN partsltd_prod.Shop_Currency C ON t_MPO.id_currency_cost = C.id_currency LEFT JOIN partsltd_prod.Shop_Currency C ON t_MPO.id_currency = C.id_currency
WHERE 1=1 WHERE 1=1
AND ( AND (
ISNULL(C.id_currency) ISNULL(C.id_currency)
@@ -238,10 +339,10 @@ BEGIN
, v_code_type_error_bad_data , v_code_type_error_bad_data
, CONCAT( , CONCAT(
'A valid currency is required for the following Manufacturing Purchase Order(s): ' 'A valid currency is required for the following Manufacturing Purchase Order(s): '
, GROUP_CONCAT(CONCAT(IFNULL(t_MPO.id_stock, '(No Manufacturing Purchase Order)'), ' - ', t_MPO.id_currency_cost) SEPARATOR ', ') , GROUP_CONCAT(CONCAT(t_MPO.name_error, ' - ', t_MPO.id_currency) SEPARATOR ', ')
) AS msg ) AS msg
FROM tmp_Stock_Item t_SPO FROM tmp_Manufacturing_Purchase_Order t_MPO
LEFT JOIN partsltd_prod.Shop_Currency C ON t_MPO.id_currency_cost = C.id_currency LEFT JOIN partsltd_prod.Shop_Currency C ON t_MPO.id_currency = C.id_currency
WHERE 1=1 WHERE 1=1
AND ( AND (
ISNULL(C.id_currency) ISNULL(C.id_currency)
@@ -252,8 +353,8 @@ BEGIN
# id_unit_quantity # id_unit_quantity
IF EXISTS ( IF EXISTS (
SELECT * SELECT *
FROM tmp_Manufacturing_Purchase_Order t_MPO FROM tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL
LEFT JOIN partsltd_prod.Shop_Unit_Measurement UM ON t_MPO.id_unit_quantity = UM.id_unit_measurement LEFT JOIN partsltd_prod.Shop_Unit_Measurement UM ON t_MPOPL.id_unit_quantity = UM.id_unit_measurement
WHERE 1=1 WHERE 1=1
AND ( AND (
ISNULL(UM.id_unit_measurement) ISNULL(UM.id_unit_measurement)
@@ -271,10 +372,10 @@ BEGIN
, v_code_type_error_bad_data , v_code_type_error_bad_data
, CONCAT( , CONCAT(
'A valid unit measurement of quantity is required for the following Manufacturing Purchase Order(s): ' 'A valid unit measurement of quantity is required for the following Manufacturing Purchase Order(s): '
, GROUP_CONCAT(CONCAT(IFNULL(t_MPO.id_stock, '(No Manufacturing Purchase Order)'), ' - ', t_MPO.id_currency_cost) SEPARATOR ', ') , GROUP_CONCAT(CONCAT(t_MPOPL.name_error, ' - ', t_MPO.id_unit_quantity) SEPARATOR ', ')
) AS msg ) AS msg
FROM tmp_Stock_Item t_SPO FROM tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL
LEFT JOIN partsltd_prod.Shop_Unit_Measurement UM ON t_MPO.id_unit_quantity = UM.id_unit_measurement LEFT JOIN partsltd_prod.Shop_Unit_Measurement UM ON t_MPOPL.id_unit_quantity = UM.id_unit_measurement
WHERE 1=1 WHERE 1=1
AND ( AND (
ISNULL(UM.id_unit_measurement) ISNULL(UM.id_unit_measurement)
@@ -282,10 +383,10 @@ BEGIN
) )
; ;
END IF; END IF;
# Invalid quantity ordered # Invalid quantity used
IF EXISTS ( IF EXISTS (
SELECT * SELECT *
FROM tmp_Manufacturing_Purchase_Order_Product_Link FROM tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL
WHERE WHERE
ISNULL(t_MPOPL.quantity_used) ISNULL(t_MPOPL.quantity_used)
OR t_MPOPL.quantity_used <= 0 OR t_MPOPL.quantity_used <= 0
@@ -297,20 +398,22 @@ BEGIN
v_id_error_type_bad_data, v_id_error_type_bad_data,
v_code_error_type_bad_data, v_code_error_type_bad_data,
CONCAT( CONCAT(
'A valid quantity ordered is required for the following Manufacturing Purchase Order Item(s): ' 'A valid quantity used is required for the following Manufacturing Purchase Order Item(s): '
, GROUP_CONCAT(t_MPOPL.name_error SEPARATOR ', ') , GROUP_CONCAT(CONCAT(t_MPOPL.name_error, ' - ', t_MPOPL.quantity_used) SEPARATOR ', ')
) )
FROM tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL FROM tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL
WHERE WHERE
ISNULL(t_MPOPL.quantity_used) NOT ISNULL(t_MPOPL.quantity_used)
OR t_MPOPL.quantity_used <= 0 AND t_MPOPL.quantity_used <= 0
; ;
END IF; END IF;
# Invalid quantity received # Invalid quantity produced
IF EXISTS ( IF EXISTS (
SELECT * SELECT *
FROM tmp_Manufacturing_Purchase_Order_Product_Link FROM tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL
WHERE t_MPOPL.quantity_produced < 0 WHERE
NOT ISNULL(t_MPOPL.quantity_produced)
AND t_MPOPL.quantity_produced < 0
) THEN ) THEN
INSERT INTO tmp_Msg_Error ( INSERT INTO tmp_Msg_Error (
id_type, code, msg id_type, code, msg
@@ -319,24 +422,24 @@ BEGIN
v_id_error_type_bad_data, v_id_error_type_bad_data,
v_code_error_type_bad_data, v_code_error_type_bad_data,
CONCAT( CONCAT(
'A valid quantity received is required for the following Manufacturing Purchase Order Item(s): ' 'A valid quantity produced is required for the following Manufacturing Purchase Order Item(s): '
, GROUP_CONCAT(t_MPOPL.name_error, ' - ', t_MPOPL.quantity_produced SEPARATOR ', ') , GROUP_CONCAT(CONCAT(t_MPOPL.name_error, ' - ', t_MPOPL.quantity_produced) SEPARATOR ', ')
) )
FROM tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL FROM tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL
WHERE t_MPOPL.quantity_produced < 0 WHERE
NOT ISNULL(t_MPOPL.quantity_produced)
AND t_MPOPL.quantity_produced < 0
; ;
END IF; END IF;
# id_unit_latency_manufacture # id_unit_latency_manufacture
IF EXISTS ( IF EXISTS (
SELECT * SELECT *
FROM tmp_Manufacturing_Purchase_Order t_MPO FROM tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL
LEFT JOIN partsltd_prod.Shop_Unit_Measurement UM ON t_MPO.id_unit_latency_manufacture = UM.id_unit_measurement LEFT JOIN partsltd_prod.Shop_Unit_Measurement UM ON t_MPOPL.id_unit_latency_manufacture = UM.id_unit_measurement
WHERE 1=1 WHERE
AND ( ISNULL(t_MPOPL.id_unit_latency_manufacture)
NOT ISNULL(t_MPO.id_unit_latency_manufacture) OR ISNULL(UM.id_unit_measurement)
OR ISNULL(UM.id_unit_measurement) OR UM.active = 0
OR UM.active = 0
)
LIMIT 1 LIMIT 1
) THEN ) THEN
INSERT INTO tmp_Msg_Error ( INSERT INTO tmp_Msg_Error (
@@ -349,22 +452,20 @@ BEGIN
, v_code_type_error_bad_data , v_code_type_error_bad_data
, CONCAT( , CONCAT(
'A valid unit measurement of manufacture latency is required for the following Manufacturing Purchase Order(s): ' 'A valid unit measurement of manufacture latency is required for the following Manufacturing Purchase Order(s): '
, GROUP_CONCAT(CONCAT(IFNULL(t_MPO.id_stock, '(No Manufacturing Purchase Order)'), ' - ', t_MPO.id_unit_latency_manufacture) SEPARATOR ', ') , GROUP_CONCAT(CONCAT(t_MPOPL.name_error, ' - ', t_MPOPL.id_unit_latency_manufacture) SEPARATOR ', ')
) AS msg ) AS msg
FROM tmp_Stock_Item t_SPO FROM tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL
LEFT JOIN partsltd_prod.Shop_Unit_Measurement UM ON t_MPO.id_unit_latency_manufacture = UM.id_unit_measurement LEFT JOIN partsltd_prod.Shop_Unit_Measurement UM ON t_MPOPL.id_unit_latency_manufacture = UM.id_unit_measurement
WHERE 1=1 WHERE
AND ( ISNULL(t_MPOPL.id_unit_latency_manufacture)
NOT ISNULL(t_MPO.id_unit_latency_manufacture) OR ISNULL(UM.id_unit_measurement)
OR ISNULL(UM.id_unit_measurement) OR UM.active = 0
OR UM.active = 0
)
; ;
END IF; END IF;
# Invalid manufacture latency # Invalid manufacture latency
IF EXISTS ( IF EXISTS (
SELECT * SELECT *
FROM tmp_Manufacturing_Purchase_Order_Product_Link FROM tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL
WHERE t_MPOPL.latency_manufacture < 0 WHERE t_MPOPL.latency_manufacture < 0
) THEN ) THEN
INSERT INTO tmp_Msg_Error ( INSERT INTO tmp_Msg_Error (
@@ -375,13 +476,111 @@ BEGIN
v_code_error_type_bad_data, v_code_error_type_bad_data,
CONCAT( CONCAT(
'A valid manufacture latency is required for the following Manufacturing Purchase Order Item(s): ' 'A valid manufacture latency is required for the following Manufacturing Purchase Order Item(s): '
, GROUP_CONCAT(t_MPOPL.name_error, ' - ', t_MPOPL.latency_manufacture SEPARATOR ', ') , GROUP_CONCAT(CONCAT(t_MPOPL.name_error, ' - ', t_MPOPL.latency_manufacture) SEPARATOR ', ')
) )
FROM tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL FROM tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL
WHERE t_MPOPL.latency_manufacture < 0 WHERE t_MPOPL.latency_manufacture < 0
; ;
END IF; END IF;
# Invalid costs excl VAT
IF EXISTS (
SELECT *
FROM tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL
WHERE
NOT ISNULL(t_MPOPL.cost_unit_local_VAT_excl)
AND t_MPOPL.cost_unit_local_VAT_excl < 0
) THEN
INSERT INTO tmp_Msg_Error (
id_type, code, msg
)
SELECT
v_id_error_type_bad_data,
v_code_error_type_bad_data,
CONCAT(
'A valid cost excluding VAT is required for the following Manufacturing Purchase Order Item(s): '
, GROUP_CONCAT(CONCAT(t_MPOPL.name_error, ' - ', t_MPOPL.cost_unit_local_VAT_excl) SEPARATOR ', ')
)
FROM tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL
WHERE
NOT ISNULL(t_MPOPL.cost_unit_local_VAT_excl)
AND t_MPOPL.cost_unit_local_VAT_excl < 0
;
END IF;
# Invalid costs incl VAT
IF EXISTS (
SELECT *
FROM tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL
WHERE
NOT ISNULL(t_MPOPL.cost_unit_local_VAT_incl)
AND t_MPOPL.cost_unit_local_VAT_incl < 0
) THEN
INSERT INTO tmp_Msg_Error (
id_type, code, msg
)
SELECT
v_id_error_type_bad_data,
v_code_error_type_bad_data,
CONCAT(
'A valid cost including VAT is required for the following Manufacturing Purchase Order Item(s): '
, GROUP_CONCAT(CONCAT(t_MPOPL.name_error, ' - ', t_MPOPL.cost_unit_local_VAT_incl) SEPARATOR ', ')
)
FROM tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL
WHERE
NOT ISNULL(t_MPOPL.cost_unit_local_VAT_incl)
AND t_MPOPL.cost_unit_local_VAT_incl < 0
;
END IF;
# Invalid prices excl VAT
IF EXISTS (
SELECT *
FROM tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL
WHERE
NOT ISNULL(t_MPOPL.price_unit_local_VAT_excl)
AND t_MPOPL.price_unit_local_VAT_excl < 0
) THEN
INSERT INTO tmp_Msg_Error (
id_type, code, msg
)
SELECT
v_id_error_type_bad_data,
v_code_error_type_bad_data,
CONCAT(
'A valid price excluding VAT is required for the following Manufacturing Purchase Order Item(s): '
, GROUP_CONCAT(CONCAT(t_MPOPL.name_error, ' - ', t_MPOPL.price_unit_local_VAT_excl) SEPARATOR ', ')
)
FROM tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL
WHERE
NOT ISNULL(t_MPOPL.price_unit_local_VAT_excl)
AND t_MPOPL.price_unit_local_VAT_excl < 0
;
END IF;
# Invalid prices incl VAT
IF EXISTS (
SELECT *
FROM tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL
WHERE
NOT ISNULL(t_MPOPL.price_unit_local_VAT_incl)
AND t_MPOPL.price_unit_local_VAT_incl < 0
) THEN
INSERT INTO tmp_Msg_Error (
id_type, code, msg
)
SELECT
v_id_error_type_bad_data,
v_code_error_type_bad_data,
CONCAT(
'A valid price including VAT is required for the following Manufacturing Purchase Order Item(s): '
, GROUP_CONCAT(CONCAT(t_MPOPL.name_error, ' - ', t_MPOPL.price_unit_local_VAT_incl) SEPARATOR ', ')
)
FROM tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL
WHERE
NOT ISNULL(t_MPOPL.price_unit_local_VAT_incl)
AND t_MPOPL.price_unit_local_VAT_incl < 0
;
END IF;
-- Duplicates -- Duplicates
IF EXISTS ( IF EXISTS (
SELECT SELECT
@@ -398,7 +597,7 @@ BEGIN
SELECT SELECT
v_id_error_type_bad_data, v_id_error_type_bad_data,
v_code_error_type_bad_data, v_code_error_type_bad_data,
CONCAT('Duplicate records: ', GROUP_CONCAT(t_SPOPLC.name_error SEPARATOR ', ')) CONCAT('Duplicate records: ', GROUP_CONCAT(t_MPOPLC.name_error SEPARATOR ', '))
FROM ( FROM (
SELECT SELECT
id_permutation id_permutation
@@ -407,7 +606,7 @@ BEGIN
FROM tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL FROM tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL
GROUP BY id_permutation GROUP BY id_permutation
HAVING COUNT(*) > 1 HAVING COUNT(*) > 1
) t_SPOPLC ) t_MPOPLC
; ;
END IF; END IF;
-- Empty Manufacturing Purchase Order -- Empty Manufacturing Purchase Order
@@ -468,7 +667,10 @@ BEGIN
, v_ids_product_permission -- ids_product , v_ids_product_permission -- ids_product
, 0 -- a_debug , 0 -- a_debug
; ;
SELECT * from partsltd_prod.Shop_Calc_User_Temp; SELECT *
FROM partsltd_prod.Shop_Calc_User_Temp
WHERE GUID = a_guid
;
END IF; END IF;
CALL p_shop_calc_user( CALL p_shop_calc_user(
@@ -485,7 +687,7 @@ BEGIN
SELECT * from partsltd_prod.Shop_Calc_User_Temp WHERE GUID = a_guid; SELECT * from partsltd_prod.Shop_Calc_User_Temp WHERE GUID = a_guid;
END IF; END IF;
IF NOT EXISTS (SELECT can_view FROM partsltd_prod.Shop_Calc_User_Temp UE_T WHERE UE_T.GUID = a_guid) THEN IF EXISTS (SELECT * FROM partsltd_prod.Shop_Calc_User_Temp UE_T WHERE UE_T.GUID = a_guid AND IFNULL(UE_T.can_view, 0) = 0) THEN
DELETE FROM tmp_Msg_Error; DELETE FROM tmp_Msg_Error;
INSERT INTO tmp_Msg_Error ( INSERT INTO tmp_Msg_Error (
@@ -493,18 +695,94 @@ BEGIN
, code , code
, msg , msg
) )
VALUES ( SELECT
v_id_type_error_no_permission v_id_type_error_no_permission
, v_code_type_error_no_permission , v_code_type_error_no_permission
, CONCAT('You do not have view permissions for ', (SELECT name FROM partsltd_prod.Shop_Permission WHERE id_permission = v_id_permission_manufacturing LIMIT 1)) , CONCAT(
) 'You do not have view permissions for '
, GROUP_CONCAT(name SEPARATOR ', ')
)
FROM partsltd_prod.Shop_Permission PERM
INNER JOIN partsltd_prod.Shop_Calc_User_Temp UE_T
ON PERM.id_permission = UE_T.id_permission
AND UE_T.GUID = a_guid
AND IFNULL(UE_T.can_view, 0) = 0
; ;
END IF; END IF;
CALL partsltd_prod.p_shop_clear_calc_user( a_guid ); CALL partsltd_prod.p_shop_clear_calc_user(
a_guid
, 0 -- a_debug
);
-- Changed quantity used
IF EXISTS (
SELECT *
FROM tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL
INNER JOIN partsltd_prod.Shop_Manufacturing_Purchase_Order_Product_Link MPOPL ON t_MPOPL.id_link = MPOPL.id_link
INNER JOIN partsltd_prod.Shop_Stock_Item SI ON MPOPL.id_permutation = SI.id_permutation
WHERE
t_MPOPL.is_new = 0
AND t_MPOPL.quantity_used <> MPOPL.quantity_used
) THEN
INSERT INTO tmp_Msg_Error (
id_type
, code
, msg
)
SELECT
v_id_type_error_warning
, v_code_type_error_warning
, CONCAT(
'The quantity used has changed on the following orders. Please update the stock items appropriately.'
, GROUP_CONCAT(
CONCAT(
t_MPOPL.name_error
, ' - from '
, MPOPL.quantity_used
, ' to '
, t_MPOPL.quantity_used
) SEPARATOR ', '
)
) AS msg
;
END IF;
-- Changed quantity produced
IF EXISTS (
SELECT *
FROM tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL
INNER JOIN partsltd_prod.Shop_Manufacturing_Purchase_Order_Product_Link MPOPL ON t_MPOPL.id_link = MPOPL.id_link
INNER JOIN partsltd_prod.Shop_Stock_Item SI ON MPOPL.id_permutation = SI.id_permutation
WHERE
t_MPOPL.is_new = 0
AND t_MPOPL.quantity_produced <> MPOPL.quantity_produced
) THEN
INSERT INTO tmp_Msg_Error (
id_type
, code
, msg
)
SELECT
v_id_type_error_warning
, v_code_type_error_warning
, CONCAT(
'The quantity produced has changed on the following orders. Please update the stock items appropriately.'
, GROUP_CONCAT(
CONCAT(
t_MPOPL.name_error
, ' - from '
, MPOPL.quantity_produced
, ' to '
, t_MPOPL.quantity_produced
) SEPARATOR ', '
)
) AS msg
;
END IF;
IF EXISTS ( SELECT * FROM tmp_Msg_Error LIMIT 1 ) THEN IF EXISTS ( SELECT * FROM tmp_Msg_Error WHERE id_type <> v_id_type_error_warning LIMIT 1 ) THEN
DELETE FROM tmp_Manufacturing; DELETE FROM tmp_Manufacturing_Purchase_Order_Product_Link;
DELETE FROM tmp_Manufacturing_Purchase_Order;
END IF; END IF;
-- Transaction -- Transaction
@@ -524,31 +802,50 @@ BEGIN
SET v_id_change_set := LAST_INSERT_ID(); SET v_id_change_set := LAST_INSERT_ID();
INSERT INTO partsltd_prod.Shop_Manufacturing_Purchase_Order ( INSERT INTO partsltd_prod.Shop_Manufacturing_Purchase_Order (
id_currency_cost id_order_temp
, id_currency
, cost_total_local_VAT_excl , cost_total_local_VAT_excl
, cost_total_local_VAT_incl , cost_total_local_VAT_incl
, price_total_local_VAT_excl
, price_total_local_VAT_incl
, active
, created_by , created_by
, created_on , created_on
, id_change_set , id_change_set
, active
) )
SELECT SELECT
t_MPO.id_currency_cost t_MPO.id_order_temp
, SUM(t_MPOPL.cost_total_local_VAT_excl) , t_MPO.id_currency
, SUM(t_MPOPL.cost_total_local_VAT_incl) , t_MPO.cost_total_local_VAT_excl
, t_MPO.cost_total_local_VAT_incl
, t_MPO.price_total_local_VAT_excl
, t_MPO.price_total_local_VAT_incl
, t_MPO.active , t_MPO.active
, a_id_user , a_id_user
, v_time_start , v_time_start
, v_id_change_set , v_id_change_set
FROM tmp_Manufacturing_Purchase_Order t_MPO FROM tmp_Manufacturing_Purchase_Order t_MPO
INNER JOIN tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL ON t_MPO.id_order = t_MPOPL.id_order INNER JOIN tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL ON t_MPO.id_order = t_MPOPL.id_order
WHERE t_MPOPL.is_new = 1 WHERE t_MPO.is_new = 1
;
UPDATE tmp_Manufacturing_Purchase_Order t_MPO
INNER JOIN partsltd_prod.Shop_Manufacturing_Purchase_Order MPO ON t_MPO.id_order_temp = MPO.id_order_temp
SET
t_MPO.id_order = MPO.id_order
WHERE t_MPO.is_new = 1
;
UPDATE tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL
INNER JOIN tmp_Manufacturing_Purchase_Order t_MPO ON t_MPOPL.id_order = t_MPO.id_order_temp
SET
t_MPOPL.id_order = t_MPO.id_order
WHERE t_MPO.is_new = 1
; ;
INSERT INTO Shop_Manufacturing_Purchase_Order_Product_Link ( INSERT INTO Shop_Manufacturing_Purchase_Order_Product_Link (
id_order id_order
, id_permutation , id_permutation
, id_currency_cost
, id_unit_quantity , id_unit_quantity
, quantity_used , quantity_used
, quantity_produced , quantity_produced
@@ -556,15 +853,17 @@ BEGIN
, latency_manufacture , latency_manufacture
, display_order , display_order
, active , active
, cost_total_local_VAT_excl , cost_unit_local_VAT_excl
, cost_total_local_VAT_incl , cost_unit_local_VAT_incl
, price_unit_local_VAT_excl
, price_unit_local_VAT_incl
, created_by , created_by
, created_on
, id_change_set , id_change_set
) )
SELECT SELECT
t_MPOPL.id_order t_MPOPL.id_order
, t_MPOPL.id_permutation , t_MPOPL.id_permutation
, t_MPOPL.id_currency_cost
, t_MPOPL.id_unit_quantity , t_MPOPL.id_unit_quantity
, t_MPOPL.quantity_used , t_MPOPL.quantity_used
, t_MPOPL.quantity_produced , t_MPOPL.quantity_produced
@@ -572,9 +871,12 @@ BEGIN
, t_MPOPL.latency_manufacture , t_MPOPL.latency_manufacture
, t_MPOPL.display_order , t_MPOPL.display_order
, t_MPOPL.active , t_MPOPL.active
, t_MPOPL.cost_total_local_VAT_excl , t_MPOPL.cost_unit_local_VAT_excl
, t_MPOPL.cost_total_local_VAT_incl , t_MPOPL.cost_unit_local_VAT_incl
, t_MPOPL.price_unit_local_VAT_excl
, t_MPOPL.price_unit_local_VAT_incl
, a_id_user , a_id_user
, v_time_start
, v_id_change_set , v_id_change_set
FROM tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL FROM tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL
WHERE t_MPOPL.is_new = 1 WHERE t_MPOPL.is_new = 1
@@ -586,10 +888,12 @@ BEGIN
AND t_MPO.is_new = 0 AND t_MPO.is_new = 0
INNER JOIN tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL ON t_MPO.id_order = t_MPOPL.id_order INNER JOIN tmp_Manufacturing_Purchase_Order_Product_Link t_MPOPL ON t_MPO.id_order = t_MPOPL.id_order
SET SET
MPO.id_currency_cost = id_currency_cost MPO.id_currency = t_MPO.id_currency
, MPO.cost_total_local_VAT_excl = SUM(t_MPOPL.cost_total_local_VAT_excl) , MPO.cost_total_local_VAT_excl = t_MPO.cost_total_local_VAT_excl
, MPO.cost_total_local_VAT_incl = SUM(t_MPOPL.cost_total_local_VAT_incl) , MPO.cost_total_local_VAT_incl = t_MPO.cost_total_local_VAT_incl
, MPO.active = a_active , MPO.price_total_local_VAT_excl = t_MPO.price_total_local_VAT_excl
, MPO.price_total_local_VAT_incl = t_MPO.price_total_local_VAT_incl
, MPO.active = t_MPO.active
, MPO.id_change_set = v_id_change_set , MPO.id_change_set = v_id_change_set
; ;
@@ -600,7 +904,6 @@ BEGIN
SET SET
MPOPL.id_order = t_MPOPL.id_order MPOPL.id_order = t_MPOPL.id_order
, MPOPL.id_permutation = t_MPOPL.id_permutation , MPOPL.id_permutation = t_MPOPL.id_permutation
, MPOPL.id_currency_cost = t_MPOPL.id_currency_cost
, MPOPL.id_unit_quantity = t_MPOPL.id_unit_quantity , MPOPL.id_unit_quantity = t_MPOPL.id_unit_quantity
, MPOPL.quantity_used = t_MPOPL.quantity_used , MPOPL.quantity_used = t_MPOPL.quantity_used
, MPOPL.quantity_produced = t_MPOPL.quantity_produced , MPOPL.quantity_produced = t_MPOPL.quantity_produced
@@ -608,18 +911,20 @@ BEGIN
, MPOPL.latency_manufacture = t_MPOPL.latency_manufacture , MPOPL.latency_manufacture = t_MPOPL.latency_manufacture
, MPOPL.display_order = t_MPOPL.display_order , MPOPL.display_order = t_MPOPL.display_order
, MPOPL.active = t_MPOPL.active , MPOPL.active = t_MPOPL.active
, MPOPL.cost_total_local_VAT_excl = t_MPOPL.cost_total_local_VAT_excl , MPOPL.cost_unit_local_VAT_excl = t_MPOPL.cost_unit_local_VAT_excl
, MPOPL.cost_total_local_VAT_incl = t_MPOPL.cost_total_local_VAT_incl , MPOPL.cost_unit_local_VAT_incl = t_MPOPL.cost_unit_local_VAT_incl
, MPOPL.price_unit_local_VAT_excl = t_MPOPL.price_unit_local_VAT_excl
, MPOPL.price_unit_local_VAT_incl = t_MPOPL.price_unit_local_VAT_incl
, MPOPL.id_change_set = v_id_change_set , MPOPL.id_change_set = v_id_change_set
; ;
DELETE SPO_T DELETE MPO_T
FROM Shop_Manufacturing_Purchase_Order_Temp SPO_T FROM partsltd_prod.Shop_Manufacturing_Purchase_Order_Temp MPO_T
WHERE SPO_T.GUID = a_guid WHERE MPO_T.GUID = a_guid
; ;
DELETE SPOPL_T DELETE MPOPL_T
FROM Shop_Manufacturing_Purchase_Order_Product_Link_Temp SPOPL_T FROM partsltd_prod.Shop_Manufacturing_Purchase_Order_Product_Link_Temp MPOPL_T
WHERE SPOPL_T.GUID = a_guid WHERE MPOPL_T.GUID = a_guid
; ;
COMMIT; COMMIT;
@@ -661,7 +966,7 @@ INSERT INTO Shop_Manufacturing_Purchase_Order_Product_Link_Temp (
id_order, id_order,
id_permutation, id_permutation,
cost_total_local, cost_total_local,
id_currency_cost, id_currency,
quantity_used, quantity_used,
id_unit_quantity, id_unit_quantity,
quantity_produced, quantity_produced,
@@ -676,7 +981,7 @@ VALUES
-1, # id_order, -1, # id_order,
1, # id_permutation, 1, # id_permutation,
100, # cost_total_local, 100, # cost_total_local,
1, # id_currency_cost, 1, # id_currency,
1, # quantity_used, 1, # quantity_used,
1, # id_unit_quantity, 1, # id_unit_quantity,
1, # quantity_produced, 1, # quantity_produced,

View File

@@ -332,7 +332,7 @@ BEGIN
) AS name ) AS name
FROM tmp_Manufacturing_Purchase_Order t_MPO FROM tmp_Manufacturing_Purchase_Order t_MPO
INNER JOIN partsltd_prod.Shop_Manufacturing_Purchase_Order MPO ON MPO.id_order = t_MPO.id_order INNER JOIN partsltd_prod.Shop_Manufacturing_Purchase_Order MPO ON MPO.id_order = t_MPO.id_order
LEFT JOIN partsltd_prod.Shop_Currency C ON MPO.id_currency_cost = C.id_currency LEFT JOIN partsltd_prod.Shop_Currency C ON MPO.id_currency = C.id_currency
; ;
# Manufacturing Purchase Order Product Link # Manufacturing Purchase Order Product Link
@@ -380,7 +380,6 @@ END //
DELIMITER ;; DELIMITER ;;
/*
CALL p_shop_get_many_manufacturing_purchase_order ( CALL p_shop_get_many_manufacturing_purchase_order (
1 # a_id_user 1 # a_id_user
@@ -393,4 +392,5 @@ CALL p_shop_get_many_manufacturing_purchase_order (
, 0 # a_debug , 0 # a_debug
); );
/*
*/ */

View File

@@ -251,10 +251,11 @@ VALUES
# Product Permutations # Product Permutations
INSERT INTO Shop_Product_Permutation ( INSERT INTO Shop_Product_Permutation (
display_order, -- display_order,
id_product, id_product,
description, description,
cost_local, cost_local_VAT_excl,
cost_local_VAT_incl,
id_currency_cost, id_currency_cost,
profit_local_min, profit_local_min,
# id_currency_profit_min, # id_currency_profit_min,
@@ -275,10 +276,11 @@ INSERT INTO Shop_Product_Permutation (
) )
VALUES VALUES
( (
1, -- 1,
1, 1,
'Good Red', 'Good Red',
5, 5,
6,
1, 1,
3, 3,
# 1, # 1,
@@ -298,10 +300,11 @@ VALUES
, NULL , NULL
), ),
( (
2, -- 2,
1, 1,
'Good Blue', 'Good Blue',
6, 6,
7.2,
1, 1,
4, 4,
# 1, # 1,
@@ -321,10 +324,11 @@ VALUES
, NULL , NULL
), ),
( (
3, -- 3,
2, 2,
'Test product describes good', 'Test product describes good',
10, 10,
12,
1, 1,
5, 5,
# 1, # 1,
@@ -344,10 +348,11 @@ VALUES
, NULL , NULL
), ),
( (
4, -- 4,
3, 3,
'Phone describes good', 'Phone describes good',
10, 10,
12,
1, 1,
5, 5,
# 1, # 1,
@@ -367,10 +372,11 @@ VALUES
, NULL , NULL
), ),
( (
5, -- 5,
4, 4,
'Laptop describes good', 'Laptop describes good',
10, 10,
12,
1, 1,
5, 5,
# 1, # 1,
@@ -390,10 +396,11 @@ VALUES
, NULL , NULL
), ),
( (
6, -- 6,
5, 5,
'Smart watch describes good', 'Smart watch describes good',
10, 10,
12,
1, 1,
5, 5,
# 1, # 1,
@@ -742,6 +749,18 @@ VALUES
, 'https://www.maltkilnfarmshop.co.uk/' , 'https://www.maltkilnfarmshop.co.uk/'
, 1 , 1
) )
, (
-3
, 'Asda'
, NULL
, NULL
-- , 1
, ''
, NULL
, ''
, ''
, 1
)
; ;
# Supplier Addresses # Supplier Addresses

View File

@@ -187,6 +187,7 @@
7204_p_shop_get_many_product.sql 7204_p_shop_get_many_product.sql
7205_p_shop_get_many_stripe_product_new.sql 7205_p_shop_get_many_stripe_product_new.sql
7206_p_shop_save_product_permutation.sql 7206_p_shop_save_product_permutation.sql
7206_p_shop_save_product_permutation_test.sql
7210_p_shop_get_many_product_variation.sql 7210_p_shop_get_many_product_variation.sql
7219_p_shop_get_many_stock_item.sql 7219_p_shop_get_many_stock_item.sql
7220_p_shop_save_stock_item.sql 7220_p_shop_save_stock_item.sql
@@ -203,6 +204,7 @@
7403_p_shop_save_supplier_purchase_order_test.sql 7403_p_shop_save_supplier_purchase_order_test.sql
7404_p_shop_get_many_supplier_purchase_order.sql 7404_p_shop_get_many_supplier_purchase_order.sql
7415_p_shop_save_manufacturing_purchase_order.sql 7415_p_shop_save_manufacturing_purchase_order.sql
7415_p_shop_save_Manufacturing_purchase_order_test.sql
7416_p_shop_get_many_manufacturing_purchase_order.sql 7416_p_shop_get_many_manufacturing_purchase_order.sql
7421_p_shop_save_customer.sql 7421_p_shop_save_customer.sql
7422_p_shop_get_many_customer.sql 7422_p_shop_get_many_customer.sql

View File

@@ -39,7 +39,6 @@ tr {
min-height: 1px; min-height: 1px;
border-bottom: 1px solid var(--c_purple_dark); border-bottom: 1px solid var(--c_purple_dark);
border-top: 1px solid var(--c_purple_dark); border-top: 1px solid var(--c_purple_dark);
padding-bottom: 1vh;
background-color: transparent; background-color: transparent;
} }

View File

@@ -12,4 +12,8 @@ form.filter button.save, form.filter button.button-cancel {
form.filter button.save, form.filter button.button-cancel { form.filter button.save, form.filter button.button-cancel {
margin-top: 0; margin-top: 0;
margin-bottom: 0; margin-bottom: 0;
}
#formFilters .container-input.filter.active {
width: 8vh;
} }

View File

@@ -1,7 +1,8 @@
#tableMain { #tableMain {
overflow-x: auto; overflow-x: auto;
padding: 1vh 2vh; padding: 1vh 2vh;
max-width: min(calc(1vh * 80), calc(1vw * 90)); max-width: 95vw; /* min(calc(1vh * 80), calc(1vw * 90)); */
width: fit-content; width: fit-content;
margin: 1vh 2vh; margin: 1vh 2vh;
align-items: normal; align-items: normal;
@@ -12,4 +13,12 @@
width: 20vh; width: 20vh;
min-width: 20vh; min-width: 20vh;
padding: 0 0.5vh; padding: 0 0.5vh;
}
#tableMain thead tr th.active, #tableMain tbody tr td.active {
width: 6vh;
min-width: 6vh;
}
#tableMain tbody tr td.display_order, #tableMain thead tr th.display_order {
width: 5vh;
min-width: 5vh;
} }

View File

@@ -1,6 +1,6 @@
#formFilters { #formFilters {
width: 50vh; width: 100vh;
} }
#formFilters .container-input.filter.active { #formFilters .container-input.filter.active {
@@ -11,6 +11,71 @@
width: 8vh; width: 8vh;
} }
#tableMain tbody tr td.cost_total_local_vat_excl, #tableMain thead tr th.cost_total_local_vat_excl,
#tableMain tbody tr td.cost_total_local_vat_incl, #tableMain thead tr th.cost_total_local_vat_incl {
width: 10vh;
min-width: 10vh;
}
#tableMain thead tr th.order_items.collapsed,
#tableMain tbody tr td.order_items.collapsed {
width: 15vh;
min-width: 15vh;
}
#tableMain:has(tbody tr td.order_items table thead tr th.product_variations.collapsed) thead tr th.order_items,
#tableMain:has(tbody tr td.order_items table thead tr th.product_variations.collapsed) tbody tr td.order_items {
width: 100vh; /* 95vh */
min-width: 100vh;
}
#tableMain thead tr th.order_items,
#tableMain tbody tr td.order_items {
width: 110vh;
min-width: 110vh;
}
#tableMain tbody tr td.order_items table thead tr th, #tableMain tbody tr td.order_items table tbody tr td {
width: 12vh;
min-width: 12vh;
}
#tableMain tbody tr td.order_items table thead tr th.display_order, #tableMain tbody tr td.order_items table tbody tr td.display_order {
width: 5vh;
min-width: 5vh;
}
#tableMain tbody tr td.order_items table thead tr th.id_unit_measurement_quantity, #tableMain tbody tr td.order_items table tbody tr td.id_unit_measurement_quantity,
#tableMain tbody tr td.order_items table thead tr th.unit_measurement_latency_manufacture, #tableMain tbody tr td.order_items table tbody tr td.unit_measurement_latency_manufacture {
width: 6vh;
min-width: 6vh;
}
#tableMain tbody tr td.order_items table thead tr th.product_variations.collapsed, #tableMain tbody tr td.order_items table tbody tr td.product_variations.collapsed {
width: 10vh;
min-width: 10vh;
}
#tableMain tbody tr td.order_items table thead tr th.product_variations, #tableMain tbody tr td.order_items table tbody tr td.product_variations {
width: 20vh;
min-width: 20vh;
}
#tableMain tbody tr td.order_items table tbody tr td.product_variations table thead tr th, #tableMain tbody tr td.order_items table tbody tr td.product_variations table tbody tr td {
width: 8vh;
min-width: 8vh;
}
#tableMain tbody tr td.order_items table tbody tr td.product_variations table thead tr th:last-of-type, #tableMain tbody tr td.order_items table tbody tr td.product_variations table tbody tr td:last-of-type {
width: 4vh;
min-width: 4vh;
}
#tableMain tbody tr td.order_items table thead tr th.quantity_used, #tableMain tbody tr td.order_items table tbody tr td.quantity_used,
#tableMain tbody tr td.order_items table thead tr th.quantity_produced, #tableMain tbody tr td.order_items table tbody tr td.quantity_produced,
#tableMain tbody tr td.order_items table thead tr th.latency_manufacture, #tableMain tbody tr td.order_items table tbody tr td.latency_manufacture {
width: 8vh;
min-width: 8vh;
}
#tableMain tbody tr td.order_items table thead tr th.active, #tableMain tbody tr td.order_items table tbody tr td.active,
#tableMain tbody tr td.order_items table thead tr th.add, #tableMain tbody tr td.order_items table tbody tr td.delete {
width: 4vh;
min-width: 4vh;
}
#tableMain thead tr th.currency.collapsed, #tableMain tbody tr td.currency.collapsed { #tableMain thead tr th.currency.collapsed, #tableMain tbody tr td.currency.collapsed {
width: 9vh; width: 9vh;
min-width: 9vh; min-width: 9vh;
@@ -26,13 +91,4 @@
#tableMain tbody tr td.price_total_local_vat_incl, #tableMain thead tr th.price_total_local_vat_incl { #tableMain tbody tr td.price_total_local_vat_incl, #tableMain thead tr th.price_total_local_vat_incl {
width: 5vh; width: 5vh;
min-width: 5vh; min-width: 5vh;
} }
#tableMain tbody tr td.items, #tableMain thead tr th.items {
width: 40vh;
min-width: 40vh;
}
#tableMain tbody tr td.active, #tableMain thead tr th.active {
width: 5vh;
min-width: 5vh;
}

View File

@@ -41,22 +41,22 @@
} }
#tableMain:has(tbody tr td.order_items table thead tr th.product_variations.collapsed) thead tr th.order_items, #tableMain:has(tbody tr td.order_items table thead tr th.product_variations.collapsed) thead tr th.order_items,
#tableMain:has(tbody tr td.order_items table thead tr th.product_variations.collapsed) tbody tr td.order_items { #tableMain:has(tbody tr td.order_items table thead tr th.product_variations.collapsed) tbody tr td.order_items {
width: 91vh; width: 126vh;
min-width: 91vh; min-width: 126vh;
} }
#tableMain thead tr th.order_items, #tableMain thead tr th.order_items,
#tableMain tbody tr td.order_items { #tableMain tbody tr td.order_items {
width: 101vh; width: 136vh;
min-width: 101vh; min-width: 136vh;
} }
#tableMain tbody tr td.order_items table thead tr th, #tableMain tbody tr td.order_items table tbody tr td { #tableMain tbody tr td.order_items table thead tr th, #tableMain tbody tr td.order_items table tbody tr td {
width: 12vh; width: 12vh;
min-width: 12vh; min-width: 12vh;
} }
#tableMain tbody tr td.order_items table thead tr th.display_order, #tableMain tbody tr td.order_items table tbody tr td.display_order, #tableMain tbody tr td.order_items table thead tr th.display_order, #tableMain tbody tr td.order_items table tbody tr td.display_order,
#tableMain tbody tr td.order_items table thead tr th.id_unit_measurement_quantity, #tableMain tbody tr td.order_items table tbody tr td.id_unit_measurement_quantity { #tableMain tbody tr td.order_items table thead tr th.add, #tableMain tbody tr td.order_items table tbody tr td.delete {
width: 6vh; width: 5vh;
min-width: 6vh; min-width: 5vh;
} }
#tableMain tbody tr td.order_items table thead tr th.product_variations.collapsed, #tableMain tbody tr td.order_items table tbody tr td.product_variations.collapsed { #tableMain tbody tr td.order_items table thead tr th.product_variations.collapsed, #tableMain tbody tr td.order_items table tbody tr td.product_variations.collapsed {
@@ -76,8 +76,16 @@
min-width: 4vh; min-width: 4vh;
} }
#tableMain tbody tr td.order_items table thead tr th.id_unit_measurement_quantity, #tableMain tbody tr td.order_items table tbody tr td.id_unit_measurement_quantity {
width: 6vh;
min-width: 6vh;
}
#tableMain tbody tr td.order_items table thead tr th.quantity_ordered, #tableMain tbody tr td.order_items table tbody tr td.quantity_ordered, #tableMain tbody tr td.order_items table thead tr th.quantity_ordered, #tableMain tbody tr td.order_items table tbody tr td.quantity_ordered,
#tableMain tbody tr td.order_items table thead tr th.quantity_received, #tableMain tbody tr td.order_items table tbody tr td.quantity_received, #tableMain tbody tr td.order_items table thead tr th.quantity_received, #tableMain tbody tr td.order_items table tbody tr td.quantity_received,
#tableMain tbody tr td.order_items table thead tr th.cost_total_local_vat_excl, #tableMain tbody tr td.order_items table tbody tr td.cost_total_local_vat_excl,
#tableMain tbody tr td.order_items table thead tr th.cost_total_local_vat_incl, #tableMain tbody tr td.order_items table tbody tr td.cost_total_local_vat_incl,
#tableMain tbody tr td.order_items table thead tr th.cost_unit_local_vat_excl, #tableMain tbody tr td.order_items table tbody tr td.cost_unit_local_vat_excl,
#tableMain tbody tr td.order_items table thead tr th.cost_unit_local_vat_incl, #tableMain tbody tr td.order_items table tbody tr td.cost_unit_local_vat_incl,
#tableMain tbody tr td.order_items table thead tr th.latency_delivery_days, #tableMain tbody tr td.order_items table tbody tr td.latency_delivery_days { #tableMain tbody tr td.order_items table thead tr th.latency_delivery_days, #tableMain tbody tr td.order_items table tbody tr td.latency_delivery_days {
width: 8vh; width: 8vh;
min-width: 8vh; min-width: 8vh;

View File

@@ -50,4 +50,7 @@
/* Right column */ /* Right column */
.rightcolumn { .rightcolumn {
min-width: fit-content; min-width: fit-content;
} }
/* Main Table */

View File

@@ -645,7 +645,6 @@ tr {
min-height: 1px; min-height: 1px;
border-bottom: 1px solid var(--c_purple_dark); border-bottom: 1px solid var(--c_purple_dark);
border-top: 1px solid var(--c_purple_dark); border-top: 1px solid var(--c_purple_dark);
padding-bottom: 1vh;
background-color: transparent; background-color: transparent;
} }
@@ -691,10 +690,15 @@ form.filter button.save, form.filter button.button-cancel {
margin-bottom: 0; margin-bottom: 0;
} }
#formFilters .container-input.filter.active {
width: 8vh;
}
#tableMain { #tableMain {
overflow-x: auto; overflow-x: auto;
padding: 1vh 2vh; padding: 1vh 2vh;
max-width: min(calc(1vh * 80), calc(1vw * 90)); max-width: 95vw; /* min(calc(1vh * 80), calc(1vw * 90)); */
width: fit-content; width: fit-content;
margin: 1vh 2vh; margin: 1vh 2vh;
align-items: normal; align-items: normal;
@@ -706,6 +710,14 @@ form.filter button.save, form.filter button.button-cancel {
min-width: 20vh; min-width: 20vh;
padding: 0 0.5vh; padding: 0 0.5vh;
} }
#tableMain thead tr th.active, #tableMain tbody tr td.active {
width: 6vh;
min-width: 6vh;
}
#tableMain tbody tr td.display_order, #tableMain thead tr th.display_order {
width: 5vh;
min-width: 5vh;
}

View File

@@ -52,3 +52,7 @@
min-width: fit-content; min-width: fit-content;
} }
/* Main Table */

View File

@@ -52,6 +52,10 @@
min-width: fit-content; min-width: fit-content;
} }
/* Main Table */
#formFilters { #formFilters {
width: 50vh; width: 50vh;
} }

View File

@@ -52,6 +52,10 @@
min-width: fit-content; min-width: fit-content;
} }
/* Main Table */
#formFilters { #formFilters {
width: 50vh; width: 50vh;
} }

View File

@@ -52,6 +52,10 @@
min-width: fit-content; min-width: fit-content;
} }
/* Main Table */
th, td { th, td {
min-width: fit-content; min-width: fit-content;
} }

File diff suppressed because one or more lines are too long

View File

@@ -22,8 +22,6 @@ export default class API {
options.body = JSON.stringify(data); options.body = JSON.stringify(data);
} }
console.log('API request:', method, url, data);
try { try {
const response = await fetch(url, options); const response = await fetch(url, options);
if (!response.ok) { if (!response.ok) {
@@ -38,10 +36,7 @@ export default class API {
static getUrlFromHash(hash, params = null) { static getUrlFromHash(hash, params = null) {
if (hash == null) hash = hashPageHome; if (hash == null) hash = hashPageHome;
console.log("getUrlFromHash:");
console.log("base url: " + _pathHost + "\nhash: " + hash + '\nparams: ' + params);
let url = API.parameteriseUrl(_pathHost + hash, params); let url = API.parameteriseUrl(_pathHost + hash, params);
console.log("url: " + url);
return url; return url;
} }
static parameteriseUrl(url, params) { static parameteriseUrl(url, params) {

View File

@@ -48,7 +48,6 @@ class App {
handleGlobalClick(event) { handleGlobalClick(event) {
// Handle global click events // Handle global click events
console.log('Global click:', event.target);
} }
start() { start() {

View File

@@ -3,14 +3,12 @@
function handleSelectCollapse(elementSelect) { function handleSelectCollapse(elementSelect) {
let optionSelected = document.querySelectorAll(elementSelect).querySelector('option:selected'); let optionSelected = document.querySelectorAll(elementSelect).querySelector('option:selected');
optionSelected.text(optionSelected.getAttribute(attrTextCollapsed)); optionSelected.text(optionSelected.getAttribute(attrTextCollapsed));
console.log('collapsed: ', optionSelected.text());
optionSelected.classList.remove(flagExpanded); optionSelected.classList.remove(flagExpanded);
optionSelected.classList.add(flagCollapsed); optionSelected.classList.add(flagCollapsed);
} }
function handleSelectExpand(elementSelect) { function handleSelectExpand(elementSelect) {
let optionSelected = document.querySelectorAll(elementSelect).querySelector('option:selected'); let optionSelected = document.querySelectorAll(elementSelect).querySelector('option:selected');
optionSelected.text(optionSelected.getAttribute(attrTextExpanded)); optionSelected.text(optionSelected.getAttribute(attrTextExpanded));
console.log('expanded: ', optionSelected.text());
optionSelected.classList.remove(flagCollapsed); optionSelected.classList.remove(flagCollapsed);
optionSelected.classList.add(flagExpanded); optionSelected.classList.add(flagExpanded);
} }

View File

@@ -54,11 +54,9 @@ export default class DOM {
static convertForm2JSON(elementForm) { static convertForm2JSON(elementForm) {
let dataForm = {}; let dataForm = {};
if (Validation.isEmpty(elementForm)) { if (Validation.isEmpty(elementForm)) {
console.log("empty form element");
return dataForm; return dataForm;
} }
let containersFilter = elementForm.querySelectorAll('.' + flagContainerInput + '.' + flagFilter); let containersFilter = elementForm.querySelectorAll('.' + flagContainerInput + '.' + flagFilter);
console.log("containersFilter: " + containersFilter);
let containerFilter, labelFilter, keyFilter, filter; let containerFilter, labelFilter, keyFilter, filter;
for (let indexFilter = 0; indexFilter < containersFilter.length; indexFilter++) { for (let indexFilter = 0; indexFilter < containersFilter.length; indexFilter++) {
containerFilter = containersFilter[indexFilter]; containerFilter = containersFilter[indexFilter];

View File

@@ -11,7 +11,7 @@ export default class BusinessObjects {
static getOptionJsonFromObjectJson(objectJson, valueSelected = null) { static getOptionJsonFromObjectJson(objectJson, valueSelected = null) {
let keyText = objectJson[flagNameAttrOptionText]; let keyText = objectJson[flagNameAttrOptionText];
let keyValue = objectJson[flagNameAttrOptionValue]; let keyValue = objectJson[flagNameAttrOptionValue];
console.log({objectJson, keyText, keyValue}); if (_verbose) { console.log({objectJson, keyText, keyValue}); };
return BusinessObjects.getOptionJsonFromObjectJsonAndKeys(objectJson, keyText, keyValue, valueSelected); return BusinessObjects.getOptionJsonFromObjectJsonAndKeys(objectJson, keyText, keyValue, valueSelected);
} }
/* /*

View File

@@ -3,4 +3,3 @@ const _dataLoadingFlag = 'data-loading'
var _domParser = null; var _domParser = null;
// var hashPageCurrent; // moved to layout // var hashPageCurrent; // moved to layout
const keyPublicStripe = 'pk_test_51OGrxlL7BuLKjoMpfpfw7bSmZZK1MhqMoQ5VhW2jUj7YtoEejO4vqnxKPiqTHHuh9U4qqkywbPCSI9TpFKtr4SYH007KHMWs68'; const keyPublicStripe = 'pk_test_51OGrxlL7BuLKjoMpfpfw7bSmZZK1MhqMoQ5VhW2jUj7YtoEejO4vqnxKPiqTHHuh9U4qqkywbPCSI9TpFKtr4SYH007KHMWs68';
var _verbose = true;

View File

@@ -14,7 +14,7 @@ export default class BasePage {
throw new Error("Router is required"); throw new Error("Router is required");
} }
else { else {
console.log("initialising with router: ", router); if (_verbose) { console.log("initialising with router: ", router); }
} }
this.router = router; this.router = router;
this.title = titlePageCurrent; this.title = titlePageCurrent;
@@ -38,7 +38,7 @@ export default class BasePage {
} }
logInitialisation() { logInitialisation() {
console.log('Initializing ' + this.title + ' page'); if (_verbose) { console.log('Initializing ' + this.title + ' page'); }
} }
hookupCommonElements() { hookupCommonElements() {
@@ -189,7 +189,7 @@ export default class BasePage {
Events.initialiseEventHandler('form.' + flagFilter + ' button.' + flagSave, flagInitialised, (button) => { Events.initialiseEventHandler('form.' + flagFilter + ' button.' + flagSave, flagInitialised, (button) => {
button.addEventListener("click", (event) => { button.addEventListener("click", (event) => {
event.stopPropagation(); event.stopPropagation();
console.log('saving page: ', this.title); if (_verbose) { console.log('saving page: ', this.title); }
OverlayConfirm.show(); OverlayConfirm.show();
}); });
// button.classList.add(flagCollapsed); // button.classList.add(flagCollapsed);
@@ -204,7 +204,7 @@ export default class BasePage {
} }
leave() { leave() {
console.log('Leaving ' + this.title + ' page'); if (_verbose) { console.log('Leaving ' + this.title + ' page'); }
if (this.constructor === BasePage) { if (this.constructor === BasePage) {
throw new Error("Must implement leave() method."); throw new Error("Must implement leave() method.");
} }
@@ -222,11 +222,11 @@ export default class BasePage {
if (show) { if (show) {
buttonCancel.classList.remove(flagCollapsed); buttonCancel.classList.remove(flagCollapsed);
buttonSave.classList.remove(flagCollapsed); buttonSave.classList.remove(flagCollapsed);
console.log('showing buttons'); if (_verbose) { console.log('showing buttons'); }
} else { } else {
buttonCancel.classList.add(flagCollapsed); buttonCancel.classList.add(flagCollapsed);
buttonSave.classList.add(flagCollapsed); buttonSave.classList.add(flagCollapsed);
console.log('hiding buttons'); if (_verbose) { console.log('hiding buttons'); }
} }
} }

View File

@@ -134,7 +134,7 @@ export default class TableBasePage extends BasePage {
let filtersJson = DOM.convertForm2JSON(formFilters); let filtersJson = DOM.convertForm2JSON(formFilters);
this.callFilterTableContent(filtersJson) this.callFilterTableContent(filtersJson)
.then(data => { .then(data => {
console.log('Table data received:', data); if (_verbose) { console.log('Table data received:', data); }
this.callbackLoadTableContent(data); this.callbackLoadTableContent(data);
}) })
.catch(error => console.error('Error:', error)); .catch(error => console.error('Error:', error));
@@ -156,12 +156,14 @@ export default class TableBasePage extends BasePage {
this.callSaveTableContent(records, formElement, comment) this.callSaveTableContent(records, formElement, comment)
.then(data => { .then(data => {
if (data[flagStatus] == flagSuccess) { if (data[flagStatus] == flagSuccess) {
console.log('Records saved!'); if (_verbose) {
console.log('Data received:', data); console.log('Records saved!');
console.log('Data received:', data);
}
this.getAndLoadFilteredTableContent(); this.getAndLoadFilteredTableContent();
} }
else { else {
console.log("error: ", data[flagMessage]); if (_verbose) { console.log("error: ", data[flagMessage]); }
OverlayError.show(data[flagMessage]); OverlayError.show(data[flagMessage]);
} }
}) })
@@ -192,12 +194,14 @@ export default class TableBasePage extends BasePage {
this.callSaveTableContent(records, formElement, comment) this.callSaveTableContent(records, formElement, comment)
.then(data => { .then(data => {
if (data[flagStatus] == flagSuccess) { if (data[flagStatus] == flagSuccess) {
console.log('Records saved!'); if (_verbose) {
console.log('Data received:', data); console.log('Records saved!');
console.log('Data received:', data);
}
this.callbackLoadTableContent(data); this.callbackLoadTableContent(data);
} }
else { else {
console.log("error: ", data[flagMessage]); if (_verbose) { console.log("error: ", data[flagMessage]); }
OverlayError.show(data[flagMessage]); OverlayError.show(data[flagMessage]);
} }
}) })
@@ -207,7 +211,7 @@ export default class TableBasePage extends BasePage {
Events.initialiseEventHandler(idFormFilters + ' button.' + flagCancel, flagInitialised, function(button) { Events.initialiseEventHandler(idFormFilters + ' button.' + flagCancel, flagInitialised, function(button) {
button.addEventListener("click", function(event) { button.addEventListener("click", function(event) {
event.stopPropagation(); event.stopPropagation();
getAndLoadFilteredTableContent(); this.getAndLoadFilteredTableContent();
}); });
button.classList.add(flagCollapsed); button.classList.add(flagCollapsed);
}); });
@@ -255,7 +259,7 @@ export default class TableBasePage extends BasePage {
cacheRowBlank() { cacheRowBlank() {
let selectorRowNew = idTableMain + ' tbody tr.' + flagRowNew; let selectorRowNew = idTableMain + ' tbody tr.' + flagRowNew;
let rowBlankTemp = document.querySelector(selectorRowNew); let rowBlankTemp = document.querySelector(selectorRowNew);
console.log("row blank temp: ", rowBlankTemp); if (_verbose) { console.log("row blank temp: ", rowBlankTemp); }
_rowBlank = rowBlankTemp.cloneNode(true); _rowBlank = rowBlankTemp.cloneNode(true);
document.querySelectorAll(selectorRowNew).forEach(function(row) { document.querySelectorAll(selectorRowNew).forEach(function(row) {
row.remove(); row.remove();
@@ -368,10 +372,10 @@ export default class TableBasePage extends BasePage {
let wasDirtyParentRows = this.getAllIsDirtyRowsInParentTree(element); let wasDirtyParentRows = this.getAllIsDirtyRowsInParentTree(element);
let wasDirtyElement = element.classList.contains(flagDirty); let wasDirtyElement = element.classList.contains(flagDirty);
let isDirtyElement = DOM.updateAndCheckIsElementDirty(element); let isDirtyElement = DOM.updateAndCheckIsElementDirty(element);
console.log({isDirtyElement, wasDirtyElement, wasDirtyParentRows}); if (_verbose) { console.log({isDirtyElement, wasDirtyElement, wasDirtyParentRows}); }
if (isDirtyElement != wasDirtyElement) { if (isDirtyElement != wasDirtyElement) {
let td = DOM.getCellFromElement(element); let td = DOM.getCellFromElement(element);
DOM.setElementAttributeValueCurrent(td, DOM.getElementValueCurrent(element)); DOM.setElementAttributeValueCurrent(td, DOM.getElementAttributeValueCurrent(element));
this.toggleShowButtonsSaveCancel(isDirtyElement); this.toggleShowButtonsSaveCancel(isDirtyElement);
this.cascadeChangedIsDirtyNestedElementCellTable(element, isDirtyElement, wasDirtyParentRows); this.cascadeChangedIsDirtyNestedElementCellTable(element, isDirtyElement, wasDirtyParentRows);
} }
@@ -397,7 +401,7 @@ export default class TableBasePage extends BasePage {
let tr = DOM.getRowFromElement(td); let tr = DOM.getRowFromElement(td);
let isDirtyRow = isDirtyTd || DOM.hasDirtyChildrenNotDeletedContainer(tr); let isDirtyRow = isDirtyTd || DOM.hasDirtyChildrenNotDeletedContainer(tr);
let wasDirtyRow = wasDirtyParentRows.pop(); let wasDirtyRow = wasDirtyParentRows.pop();
console.log({isDirtyRow, wasDirtyRow}); if (_verbose) { console.log({isDirtyRow, wasDirtyRow}); }
if (isDirtyRow != wasDirtyRow) { if (isDirtyRow != wasDirtyRow) {
DOM.handleDirtyElement(tr, isDirtyRow); DOM.handleDirtyElement(tr, isDirtyRow);
this.toggleShowButtonsSaveCancel(isDirtyRow); this.toggleShowButtonsSaveCancel(isDirtyRow);
@@ -517,10 +521,9 @@ export default class TableBasePage extends BasePage {
cellSelector cellSelector
, optionList , optionList
, ddlHookup = (cellSelector) => { this.hookupTableCellDdls(cellSelector); } , ddlHookup = (cellSelector) => { this.hookupTableCellDdls(cellSelector); }
, changeHandler = (event, element) => { this.handleChangeTableCellDdl(event, element); } , changeHandler = (event, element) => { this.handleChangeNestedElementCellTable(event, element); }
) { ) {
this.hookupEventHandler("click", cellSelector, (event, td) => { this.hookupEventHandler("click", cellSelector, (event, td) => {
// if (td.querySelector('select')) return;
this.handleClickTableCellDdlPreview( this.handleClickTableCellDdlPreview(
event event
, td , td
@@ -532,14 +535,14 @@ export default class TableBasePage extends BasePage {
); } ); }
); );
}); });
ddlHookup(cellSelector + ' select');
} }
hookupTableCellDdls(ddlSelector, changeHandler = (event, element) => { this.handleChangeTableCellDdl(event, element); }) { hookupTableCellDdls(ddlSelector, changeHandler = (event, element) => { this.handleChangeNestedElementCellTable(event, element); }) {
this.hookupEventHandler("change", ddlSelector, (event, element) => { changeHandler(event, element); }); this.hookupEventHandler("change", ddlSelector, (event, element) => { changeHandler(event, element); });
} }
handleClickTableCellDdlPreview(event, td, optionObjectList, cellSelector, ddlHookup = (cellSelector) => { this.hookupTableCellDdls(cellSelector); }) { handleClickTableCellDdlPreview(event, td, optionObjectList, cellSelector, ddlHookup = (cellSelector) => { this.hookupTableCellDdls(cellSelector); }) {
if (td.querySelector('select')) return; if (td.querySelector('select')) return;
// td.removeEventListener("click", ddlHookup); // td.removeEventListener("click", ddlHookup);
console.log("click table cell ddl preview");
let tdNew = td.cloneNode(true); let tdNew = td.cloneNode(true);
td.parentNode.replaceChild(tdNew, td); td.parentNode.replaceChild(tdNew, td);
let idSelected = DOM.getElementAttributeValueCurrent(tdNew); let idSelected = DOM.getElementAttributeValueCurrent(tdNew);
@@ -547,7 +550,10 @@ export default class TableBasePage extends BasePage {
let ddl = document.createElement('select'); let ddl = document.createElement('select');
DOM.setElementValuesCurrentAndPrevious(ddl, idSelected); DOM.setElementValuesCurrentAndPrevious(ddl, idSelected);
let optionJson, option; let optionJson, option;
console.log({optionObjectList, cellSelector}); if (_verbose) {
console.log("click table cell ddl preview");
console.log({optionObjectList, cellSelector});
}
option = DOM.createOption(null); option = DOM.createOption(null);
ddl.appendChild(option); ddl.appendChild(option);
optionObjectList.forEach((optionObjectJson) => { optionObjectList.forEach((optionObjectJson) => {
@@ -557,8 +563,10 @@ export default class TableBasePage extends BasePage {
}); });
tdNew.appendChild(ddl); tdNew.appendChild(ddl);
let ddlSelector = cellSelector + ' select'; let ddlSelector = cellSelector + ' select';
debugger;
ddlHookup(ddlSelector); ddlHookup(ddlSelector);
} }
/*
handleChangeTableCellDdl(event, ddl) { handleChangeTableCellDdl(event, ddl) {
let row = DOM.getRowFromElement(ddl); let row = DOM.getRowFromElement(ddl);
let td = DOM.getCellFromElement(ddl); let td = DOM.getCellFromElement(ddl);
@@ -585,6 +593,7 @@ export default class TableBasePage extends BasePage {
} }
} }
} }
*/
hookupTableCellDDlPreviewsWhenNotCollapsed(cellSelector, optionList, ddlHookup = (event, element) => { this.hookupTableCellDdls(event, element); }) { hookupTableCellDDlPreviewsWhenNotCollapsed(cellSelector, optionList, ddlHookup = (event, element) => { this.hookupTableCellDdls(event, element); }) {
this.hookupEventHandler("click", cellSelector, (event, td) => { this.hookupEventHandler("click", cellSelector, (event, td) => {
let div = td.querySelector('div'); let div = td.querySelector('div');
@@ -596,7 +605,7 @@ export default class TableBasePage extends BasePage {
this.hookupChangeHandlerTableCells(ddlSelector, (event, element) => { this.handleChangeProductCategoryDdl(event, element); }); this.hookupChangeHandlerTableCells(ddlSelector, (event, element) => { this.handleChangeProductCategoryDdl(event, element); });
} }
handleChangeProductCategoryDdl(event, ddlCategory) { handleChangeProductCategoryDdl(event, ddlCategory) {
this.handleChangeTableCellDdl(event, ddlCategory); this.handleChangeNestedElementCellTable(event, ddlCategory);
let idProductCategorySelected = DOM.getElementValueCurrent(ddlCategory); let idProductCategorySelected = DOM.getElementValueCurrent(ddlCategory);
let row = DOM.getRowFromElement(ddlCategory); let row = DOM.getRowFromElement(ddlCategory);
let tdProduct = row.querySelector('td.' + flagProduct); let tdProduct = row.querySelector('td.' + flagProduct);
@@ -611,7 +620,7 @@ export default class TableBasePage extends BasePage {
option = DOM.createOption(optionJson); option = DOM.createOption(optionJson);
ddlProduct.appendChild(option); ddlProduct.appendChild(option);
}); });
this.handleChangeTableCellDdl(event, ddlProduct); this.handleChangeNestedElementCellTable(event, ddlProduct);
} }
hookupFieldsProductPermutationVariation() { hookupFieldsProductPermutationVariation() {
this.hookupPreviewsProductPermutationVariation(); this.hookupPreviewsProductPermutationVariation();
@@ -625,7 +634,6 @@ export default class TableBasePage extends BasePage {
handleClickProductPermutationVariationsPreview(event, element) { handleClickProductPermutationVariationsPreview(event, element) {
let tblVariations = element.querySelector('table.' + flagProductVariations); let tblVariations = element.querySelector('table.' + flagProductVariations);
if (!Validation.isEmpty(tblVariations)) return; if (!Validation.isEmpty(tblVariations)) return;
console.log("click product permutation variations preview");
this.toggleColumnCollapsed(flagProductVariations, false); this.toggleColumnCollapsed(flagProductVariations, false);
let permutationVariations = this.getElementProductVariations(element); let permutationVariations = this.getElementProductVariations(element);
tblVariations = document.createElement("table"); tblVariations = document.createElement("table");
@@ -650,18 +658,21 @@ export default class TableBasePage extends BasePage {
thead.appendChild(tr); thead.appendChild(tr);
tblVariations.appendChild(thead); tblVariations.appendChild(thead);
let tbody = document.createElement("tbody"); let tbody = document.createElement("tbody");
console.log('variations:', permutationVariations);
if (!Validation.isEmpty(permutationVariations)) { if (!Validation.isEmpty(permutationVariations)) {
permutationVariations.forEach((permutationVariation, index) => { permutationVariations.forEach((permutationVariation, index) => {
this.addProductPermutationVariationRow(tbody, permutationVariation); this.addProductPermutationVariationRow(tbody, permutationVariation);
}); });
} }
tblVariations.appendChild(tbody); tblVariations.appendChild(tbody);
if (_verbose) {
console.log("click product permutation variations preview");
console.log('variations:', permutationVariations);
console.log("tblVariations: ", tblVariations);
}
let cellParent = element.closest(idTableMain + ' tbody tr td.' + flagProductVariations); let cellParent = element.closest(idTableMain + ' tbody tr td.' + flagProductVariations);
cellParent.innerHTML = ''; cellParent.innerHTML = '';
cellParent.appendChild(tblVariations); cellParent.appendChild(tblVariations);
console.log("tblVariations: ", tblVariations);
this.hookupFieldsProductPermutationVariation(); this.hookupFieldsProductPermutationVariation();
} }
@@ -680,7 +691,7 @@ export default class TableBasePage extends BasePage {
permutationVariations.forEach((variation) => { permutationVariations.forEach((variation) => {
parts = variation.split(':'); parts = variation.split(':');
if (parts.length == 2) { if (parts.length == 2) {
console.log("parts: ", parts); if (_verbose) { console.log("parts: ", parts); }
new_variation_type = productVariationTypes[parts[0].trim()]; new_variation_type = productVariationTypes[parts[0].trim()];
new_variation = productVariations[parts[1].trim()]; new_variation = productVariations[parts[1].trim()];
objVariations.push({ objVariations.push({
@@ -689,7 +700,7 @@ export default class TableBasePage extends BasePage {
}); });
} }
else { else {
console.log("error: invalid variation: ", variation); if (_verbose) { console.log("error: invalid variation: ", variation); }
} }
}); });
} }
@@ -712,6 +723,7 @@ export default class TableBasePage extends BasePage {
}; };
} }
addProductPermutationVariationRow(tbody, permutationVariation) { addProductPermutationVariationRow(tbody, permutationVariation) {
if (_verbose) { console.log("permutationVariation: ", permutationVariation); }
let productVariationType, optionProductVariationTypeJson, optionProductVariationType, productVariation, optionProductVariationJson, optionProductVariation; let productVariationType, optionProductVariationTypeJson, optionProductVariationType, productVariation, optionProductVariationJson, optionProductVariation;
/* /*
if (Validation.isEmpty(variations)) { if (Validation.isEmpty(variations)) {
@@ -734,7 +746,7 @@ export default class TableBasePage extends BasePage {
if (doFilterProductVariationKeys) { if (doFilterProductVariationKeys) {
productVariationKeys = productVariationKeys.filter(variationKey => !productVariationTypeKeysSelected.has(productVariations[variationKey][attrIdProductVariationType])); productVariationKeys = productVariationKeys.filter(variationKey => !productVariationTypeKeysSelected.has(productVariations[variationKey][attrIdProductVariationType]));
} }
console.log("permutationVariation: ", permutationVariation);
let permutationVariationJson = permutationVariation[flagProductVariation]; let permutationVariationJson = permutationVariation[flagProductVariation];
let permutationVariationTypeJson = permutationVariation[flagProductVariationType]; let permutationVariationTypeJson = permutationVariation[flagProductVariationType];
@@ -747,7 +759,7 @@ export default class TableBasePage extends BasePage {
DOM.setElementAttributesValuesCurrentAndPrevious(ddlVariationType, permutationVariationTypeJson[attrIdProductVariationType]); DOM.setElementAttributesValuesCurrentAndPrevious(ddlVariationType, permutationVariationTypeJson[attrIdProductVariationType]);
optionProductVariationType = DOM.createOption(null); optionProductVariationType = DOM.createOption(null);
console.log("optionProductVariationType: ", optionProductVariationType); if (_verbose) { console.log("optionProductVariationType: ", optionProductVariationType); }
ddlVariationType.appendChild(optionProductVariationType); ddlVariationType.appendChild(optionProductVariationType);
productVariationTypeKeys.forEach((productVariationTypeKey) => { productVariationTypeKeys.forEach((productVariationTypeKey) => {
@@ -759,7 +771,7 @@ export default class TableBasePage extends BasePage {
productVariationType = productVariationTypes[productVariationTypeKey]; productVariationType = productVariationTypes[productVariationTypeKey];
optionProductVariationTypeJson = BusinessObjects.getOptionJsonFromObjectJson(productVariationType, permutationVariationTypeJson[attrIdProductVariationType]); optionProductVariationTypeJson = BusinessObjects.getOptionJsonFromObjectJson(productVariationType, permutationVariationTypeJson[attrIdProductVariationType]);
optionProductVariationType = DOM.createOption(optionProductVariationTypeJson); optionProductVariationType = DOM.createOption(optionProductVariationTypeJson);
console.log("optionProductVariationType: ", optionProductVariationType); if (_verbose) { console.log("optionProductVariationType: ", optionProductVariationType); }
ddlVariationType.appendChild(optionProductVariationType); ddlVariationType.appendChild(optionProductVariationType);
}); });
@@ -772,14 +784,14 @@ export default class TableBasePage extends BasePage {
DOM.setElementAttributesValuesCurrentAndPrevious(ddlVariation, permutationVariationJson[attrIdProductVariation]); DOM.setElementAttributesValuesCurrentAndPrevious(ddlVariation, permutationVariationJson[attrIdProductVariation]);
optionProductVariation = DOM.createOption(null); optionProductVariation = DOM.createOption(null);
console.log("optionProductVariation: ", optionProductVariation); if (_verbose) { console.log("optionProductVariation: ", optionProductVariation); }
ddlVariation.appendChild(optionProductVariation); ddlVariation.appendChild(optionProductVariation);
productVariationKeys.forEach((productVariationKey) => { productVariationKeys.forEach((productVariationKey) => {
productVariation = productVariations[productVariationKey]; productVariation = productVariations[productVariationKey];
optionProductVariationJson = BusinessObjects.getOptionJsonFromObjectJson(productVariation, permutationVariationJson[attrIdProductVariation]); optionProductVariationJson = BusinessObjects.getOptionJsonFromObjectJson(productVariation, permutationVariationJson[attrIdProductVariation]);
optionProductVariation = DOM.createOption(optionProductVariationJson); optionProductVariation = DOM.createOption(optionProductVariationJson);
console.log("optionProductVariation: ", optionProductVariation); if (_verbose) { console.log("optionProductVariation: ", optionProductVariation); }
ddlVariation.appendChild(optionProductVariation); ddlVariation.appendChild(optionProductVariation);
}); });

View File

@@ -21,12 +21,12 @@ export default class PageStoreBasket extends BasePage {
hookupStoreCardsInfo() { hookupStoreCardsInfo() {
document.querySelectorAll(idContainerInfoDelivery).addEventListener("click", function(event) { document.querySelectorAll(idContainerInfoDelivery).addEventListener("click", function(event) {
console.log("delivery modal display method"); if (_verbose) { console.log("delivery modal display method"); }
document.querySelectorAll(idOverlayInfoDelivery).css('display', 'block'); document.querySelectorAll(idOverlayInfoDelivery).css('display', 'block');
}); });
document.querySelectorAll(idContainerInfoBilling).addEventListener("click", function(event) { document.querySelectorAll(idContainerInfoBilling).addEventListener("click", function(event) {
console.log("billing modal display method"); if (_verbose) { console.log("billing modal display method"); }
document.querySelectorAll(idOverlayInfoBilling).css('display', 'block'); document.querySelectorAll(idOverlayInfoBilling).css('display', 'block');
}); });
} }
@@ -44,7 +44,7 @@ export default class PageStoreBasket extends BasePage {
elForm.submit(function(event) { elForm.submit(function(event) {
elForm = document.querySelectorAll(elForm); elForm = document.querySelectorAll(elForm);
event.preventDefault(); event.preventDefault();
console.log("delivery submit method"); if (_verbose) { console.log("delivery submit method"); }
ajaxData = {}; ajaxData = {};
ajaxData[keyInfoType] = keyInfoDelivery; ajaxData[keyInfoType] = keyInfoDelivery;
@@ -63,7 +63,7 @@ export default class PageStoreBasket extends BasePage {
Events.initialiseEventHandler(elForm, flagInitialised, function() { Events.initialiseEventHandler(elForm, flagInitialised, function() {
elForm.submit(function(event) { elForm.submit(function(event) {
event.preventDefault(); event.preventDefault();
console.log("billing submit method"); if (_verbose) { console.log("billing submit method"); }
ajaxData = {}; ajaxData = {};
ajaxData[keyInfoType] = keyInfoBilling; ajaxData[keyInfoType] = keyInfoBilling;
@@ -81,7 +81,7 @@ export default class PageStoreBasket extends BasePage {
loadInfoAddress(response) { loadInfoAddress(response) {
console.log('ajax:'); console.log(response.data); if (_verbose) { console.log('response:'); console.log(response.data); }
let infoType = response.data[keyInfoType]; let infoType = response.data[keyInfoType];
let infoAddress = response.data[infoType]; let infoAddress = response.data[infoType];
LocalStorage.setLocalStorage(infoType, infoAddress); LocalStorage.setLocalStorage(infoType, infoAddress);
@@ -119,11 +119,13 @@ export default class PageStoreBasket extends BasePage {
elOverlay = document.querySelectorAll(idOverlayInfoDelivery); elOverlay = document.querySelectorAll(idOverlayInfoDelivery);
elForm = elOverlay.querySelector('form'); elForm = elOverlay.querySelector('form');
console.log('converting billing form to json\nform ID: ' + elForm.id);
ajaxData[flagForm] = convertForm2JSON(elForm); // formData; // form.serialize(); ajaxData[flagForm] = convertForm2JSON(elForm); // formData; // form.serialize();
let keys = [keyNameFull, keyPhoneNumber, keyPostcode, keyAddress1, keyAddress2, keyCity, keyCounty]; let keys = [keyNameFull, keyPhoneNumber, keyPostcode, keyAddress1, keyAddress2, keyCity, keyCounty];
console.log('ajaxData:'); if (_verbose) {
console.log(ajaxData); console.log('converting billing form to json\nform ID: ' + elForm.id);
console.log('ajaxData:');
console.log(ajaxData);
}
ajaxData[flagForm][keyInfoIdentical] = getElementValueCurrent(elForm.querySelector('#' + keyInfoIdentical)); ajaxData[flagForm][keyInfoIdentical] = getElementValueCurrent(elForm.querySelector('#' + keyInfoIdentical));
for (var k in keys) { for (var k in keys) {
if (idOverlayInfo == idOverlayInfoBilling && ajaxData[flagForm][keyInfoIdentical]) { if (idOverlayInfo == idOverlayInfoBilling && ajaxData[flagForm][keyInfoIdentical]) {
@@ -132,8 +134,10 @@ export default class PageStoreBasket extends BasePage {
ajaxData[flagForm][keys[k]] = getElementValueCurrent(elForm.querySelector('#' + keys[k])); ajaxData[flagForm][keys[k]] = getElementValueCurrent(elForm.querySelector('#' + keys[k]));
} }
} }
console.log('ajaxData:'); if (_verbose) {
console.log(ajaxData); console.log('ajaxData:');
console.log(ajaxData);
}
return ajaxData; return ajaxData;
} }

View File

@@ -37,7 +37,7 @@ export default class PageStoreManufacturingPurchaseOrders extends TableBasePage
let inputCostTotalLocalVatIncl = row.querySelector('td.' + flagCostTotalLocalVatIncl + ' input'); let inputCostTotalLocalVatIncl = row.querySelector('td.' + flagCostTotalLocalVatIncl + ' input');
let inputPriceTotalLocalVatExcl = row.querySelector('td.' + flagPriceTotalLocalVatExcl + ' input'); let inputPriceTotalLocalVatExcl = row.querySelector('td.' + flagPriceTotalLocalVatExcl + ' input');
let inputPriceTotalLocalVatIncl = row.querySelector('td.' + flagPriceTotalLocalVatIncl + ' input'); let inputPriceTotalLocalVatIncl = row.querySelector('td.' + flagPriceTotalLocalVatIncl + ' input');
let tdItems = row.querySelector('td.' + flagOrderItems); let trsPurchaseOrderItem = row.querySelectorAll('tr.' + flagOrderItems);
let checkboxActive = row.querySelector('td.' + flagActive + ' textarea'); let checkboxActive = row.querySelector('td.' + flagActive + ' textarea');
let jsonRow = {}; let jsonRow = {};
@@ -47,11 +47,12 @@ export default class PageStoreManufacturingPurchaseOrders extends TableBasePage
jsonRow[flagCostTotalLocalVatIncl] = DOM.getElementAttributeValueCurrent(inputCostTotalLocalVatIncl); jsonRow[flagCostTotalLocalVatIncl] = DOM.getElementAttributeValueCurrent(inputCostTotalLocalVatIncl);
jsonRow[flagPriceTotalLocalVatExcl] = DOM.getElementAttributeValueCurrent(inputPriceTotalLocalVatExcl); jsonRow[flagPriceTotalLocalVatExcl] = DOM.getElementAttributeValueCurrent(inputPriceTotalLocalVatExcl);
jsonRow[flagPriceTotalLocalVatIncl] = DOM.getElementAttributeValueCurrent(inputPriceTotalLocalVatIncl); jsonRow[flagPriceTotalLocalVatIncl] = DOM.getElementAttributeValueCurrent(inputPriceTotalLocalVatIncl);
// jsonRow[flagOrderItems] = DOM.getElementAttributeValueCurrent(tdItems);
let orderItems = []; let orderItems = [];
trsPurchaseOrderItem.forEach((tr) => { if (trsPurchaseOrderItem != null) {
orderItems.push(this.getJsonRowOrderItem(tr)); trsPurchaseOrderItem.forEach((tr) => {
}); orderItems.push(this.getJsonRowOrderItem(tr));
});
}
jsonRow[flagOrderItems] = orderItems; jsonRow[flagOrderItems] = orderItems;
jsonRow[flagActive] = DOM.getElementAttributeValueCurrent(checkboxActive); jsonRow[flagActive] = DOM.getElementAttributeValueCurrent(checkboxActive);
return jsonRow; return jsonRow;
@@ -77,8 +78,6 @@ export default class PageStoreManufacturingPurchaseOrders extends TableBasePage
jsonRow[attrIdUnitMeasurementQuantity] = DOM.getElementAttributeValueCurrent(tdUnitQuantity); jsonRow[attrIdUnitMeasurementQuantity] = DOM.getElementAttributeValueCurrent(tdUnitQuantity);
jsonRow[flagQuantityUsed] = DOM.getElementAttributeValueCurrent(inputQuantityUsed); jsonRow[flagQuantityUsed] = DOM.getElementAttributeValueCurrent(inputQuantityUsed);
jsonRow[flagQuantityProduced] = DOM.getElementAttributeValueCurrent(inputQuantityProduced); jsonRow[flagQuantityProduced] = DOM.getElementAttributeValueCurrent(inputQuantityProduced);
jsonRow[flagCostTotalLocalVatExcl] = DOM.getElementAttributeValueCurrent(inputCostTotalLocalVatExcl);
jsonRow[flagCostTotalLocalVatIncl] = DOM.getElementAttributeValueCurrent(inputCostTotalLocalVatIncl);
jsonRow[flagLatencyManufacture] = DOM.getElementAttributeValueCurrent(inputLatencyManufacture); jsonRow[flagLatencyManufacture] = DOM.getElementAttributeValueCurrent(inputLatencyManufacture);
jsonRow[flagActive] = DOM.getElementAttributeValueCurrent(checkboxActive); jsonRow[flagActive] = DOM.getElementAttributeValueCurrent(checkboxActive);
@@ -91,11 +90,11 @@ export default class PageStoreManufacturingPurchaseOrders extends TableBasePage
hookupTableMain() { hookupTableMain() {
super.hookupTableMain(); super.hookupTableMain();
this.hookupCurrencyFields(); this.hookupCurrencyFields();
this.hookupCostInputs(); this.hookupCostAndPriceInputs();
this.hookupOrderItemsFields(); this.hookupOrderItemsFields();
this.hookupInputsActiveTable(); this.hookupInputsActiveTable();
} }
hookupCostInputs() { hookupCostAndPriceInputs() {
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagCostTotalLocalVatExcl + ' input'); this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagCostTotalLocalVatExcl + ' input');
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagCostTotalLocalVatIncl + ' input'); this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagCostTotalLocalVatIncl + ' input');
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagPriceTotalLocalVatExcl + ' input'); this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagPriceTotalLocalVatExcl + ' input');
@@ -110,8 +109,7 @@ export default class PageStoreManufacturingPurchaseOrders extends TableBasePage
this.hookupFieldsOrderItemUnitQuantity(); this.hookupFieldsOrderItemUnitQuantity();
this.hookupFieldsOrderItemQuantityUsed(); this.hookupFieldsOrderItemQuantityUsed();
this.hookupFieldsOrderItemQuantityProduced(); this.hookupFieldsOrderItemQuantityProduced();
this.hookupFieldsOrderItemCostTotalLocalVatExcl(); this.hookupFieldsOrderItemUnitMeasurementLatencyManufacture();
this.hookupFieldsOrderItemCostTotalLocalVatIncl();
this.hookupFieldsOrderItemLatencyManufacture(); this.hookupFieldsOrderItemLatencyManufacture();
this.hookupFieldsOrderItemActive(); this.hookupFieldsOrderItemActive();
this.hookupFieldsOrderItemAddDelete(); this.hookupFieldsOrderItemAddDelete();
@@ -124,7 +122,7 @@ export default class PageStoreManufacturingPurchaseOrders extends TableBasePage
}); });
} }
handleClickOrderItemsPreview(event, element) { handleClickOrderItemsPreview(event, element) {
console.log("click order items preview"); if (_verbose) { console.log("click order items preview"); }
this.toggleColumnHeaderCollapsed(flagOrderItems, false); this.toggleColumnHeaderCollapsed(flagOrderItems, false);
element.classList.remove(flagCollapsed); element.classList.remove(flagCollapsed);
@@ -154,10 +152,11 @@ export default class PageStoreManufacturingPurchaseOrders extends TableBasePage
thUnitQuantity.textContent = 'Unit Quantity'; thUnitQuantity.textContent = 'Unit Quantity';
let thQuantityUsed = document.createElement("th"); let thQuantityUsed = document.createElement("th");
thQuantityUsed.classList.add(flagQuantityUsed); thQuantityUsed.classList.add(flagQuantityUsed);
thQuantityUsed.textContent = 'Quantity Ordered'; thQuantityUsed.textContent = 'Quantity Used';
let thQuantityProduced = document.createElement("th"); let thQuantityProduced = document.createElement("th");
thQuantityProduced.classList.add(flagQuantityProduced); thQuantityProduced.classList.add(flagQuantityProduced);
thQuantityProduced.textContent = 'Quantity Received'; thQuantityProduced.textContent = 'Quantity Produced';
/*
let thCostTotalLocalVatExcl = document.createElement("th"); let thCostTotalLocalVatExcl = document.createElement("th");
thCostTotalLocalVatExcl.classList.add(flagCostTotalLocalVatExcl); thCostTotalLocalVatExcl.classList.add(flagCostTotalLocalVatExcl);
thCostTotalLocalVatExcl.textContent = 'Cost Total Local VAT Excl'; thCostTotalLocalVatExcl.textContent = 'Cost Total Local VAT Excl';
@@ -170,9 +169,13 @@ export default class PageStoreManufacturingPurchaseOrders extends TableBasePage
let thCostUnitLocalVatIncl = document.createElement("th"); let thCostUnitLocalVatIncl = document.createElement("th");
thCostUnitLocalVatIncl.classList.add(flagCostUnitLocalVatIncl); thCostUnitLocalVatIncl.classList.add(flagCostUnitLocalVatIncl);
thCostUnitLocalVatIncl.textContent = 'Cost Unit Local VAT Incl'; thCostUnitLocalVatIncl.textContent = 'Cost Unit Local VAT Incl';
*/
let thUnitMeasurementLatencyManufacture = document.createElement("th");
thUnitMeasurementLatencyManufacture.classList.add(flagUnitMeasurementLatencyManufacture);
thUnitMeasurementLatencyManufacture.textContent = 'Unit Measurement Latency Manufacture';
let thLatencyManufacture = document.createElement("th"); let thLatencyManufacture = document.createElement("th");
thLatencyManufacture.classList.add(flagLatencyManufacture); thLatencyManufacture.classList.add(flagLatencyManufacture);
thLatencyManufacture.textContent = 'Latency Delivery (Days)'; thLatencyManufacture.textContent = 'Latency Manufacture';
let thActive = document.createElement("th"); let thActive = document.createElement("th");
thActive.classList.add(flagActive); thActive.classList.add(flagActive);
thActive.textContent = 'Active'; thActive.textContent = 'Active';
@@ -190,10 +193,13 @@ export default class PageStoreManufacturingPurchaseOrders extends TableBasePage
tr.appendChild(thUnitQuantity); tr.appendChild(thUnitQuantity);
tr.appendChild(thQuantityUsed); tr.appendChild(thQuantityUsed);
tr.appendChild(thQuantityProduced); tr.appendChild(thQuantityProduced);
/*
tr.appendChild(thCostTotalLocalVatExcl); tr.appendChild(thCostTotalLocalVatExcl);
tr.appendChild(thCostTotalLocalVatIncl); tr.appendChild(thCostTotalLocalVatIncl);
tr.appendChild(thCostUnitLocalVatExcl); tr.appendChild(thCostUnitLocalVatExcl);
tr.appendChild(thCostUnitLocalVatIncl); tr.appendChild(thCostUnitLocalVatIncl);
*/
tr.appendChild(thUnitMeasurementLatencyManufacture);
tr.appendChild(thLatencyManufacture); tr.appendChild(thLatencyManufacture);
tr.appendChild(thActive); tr.appendChild(thActive);
tr.appendChild(thAddDelete); tr.appendChild(thAddDelete);
@@ -210,11 +216,11 @@ export default class PageStoreManufacturingPurchaseOrders extends TableBasePage
let cellNew = cell.cloneNode(false); let cellNew = cell.cloneNode(false);
cellNew.appendChild(tblOrderItems); cellNew.appendChild(tblOrderItems);
row.replaceChild(cellNew, cell); row.replaceChild(cellNew, cell);
console.log("tblOrderItems: ", tblOrderItems); if (_verbose) { console.log("tblOrderItems: ", tblOrderItems); }
this.hookupOrderItemsFields(); this.hookupOrderItemsFields();
} }
addRowManufacturingPurchaseOrderItem(tbody, orderItem) { // productVariationTypeOptions, productVariationOptions, productCategoryOptions, productOptions, unitMeasurementOptions, addRowManufacturingPurchaseOrderItem(tbody, orderItem) { // productVariationTypeOptions, productVariationOptions, productCategoryOptions, productOptions, unitMeasurementOptions,
console.log("addRowManufacturingPurchaseOrderItem: ", orderItem); if (_verbose) { console.log("addRowManufacturingPurchaseOrderItem: ", orderItem); }
let tdDisplayOrder = document.createElement("td"); let tdDisplayOrder = document.createElement("td");
tdDisplayOrder.classList.add(flagDisplayOrder); tdDisplayOrder.classList.add(flagDisplayOrder);
@@ -245,6 +251,7 @@ export default class PageStoreManufacturingPurchaseOrders extends TableBasePage
let tdVariations = document.createElement("td"); let tdVariations = document.createElement("td");
tdVariations.classList.add(flagProductVariations); tdVariations.classList.add(flagProductVariations);
tdVariations.classList.add(flagCollapsed);
DOM.setElementAttributesValuesCurrentAndPrevious(tdVariations, orderItem[attrIdProductCategory]); DOM.setElementAttributesValuesCurrentAndPrevious(tdVariations, orderItem[attrIdProductCategory]);
let divVariations = document.createElement("div"); let divVariations = document.createElement("div");
divVariations.classList.add(flagProductVariations); divVariations.classList.add(flagProductVariations);
@@ -276,6 +283,7 @@ export default class PageStoreManufacturingPurchaseOrders extends TableBasePage
DOM.setElementAttributesValuesCurrentAndPrevious(inputQuantityProduced, orderItem[flagQuantityProduced]); DOM.setElementAttributesValuesCurrentAndPrevious(inputQuantityProduced, orderItem[flagQuantityProduced]);
tdQuantityProduced.appendChild(inputQuantityProduced); tdQuantityProduced.appendChild(inputQuantityProduced);
/*
let tdCostTotalLocalVatExcl = document.createElement("td"); let tdCostTotalLocalVatExcl = document.createElement("td");
tdCostTotalLocalVatExcl.classList.add(flagCostTotalLocalVatExcl); tdCostTotalLocalVatExcl.classList.add(flagCostTotalLocalVatExcl);
let inputCostTotalLocalVatExcl = document.createElement("input"); let inputCostTotalLocalVatExcl = document.createElement("input");
@@ -307,7 +315,16 @@ export default class PageStoreManufacturingPurchaseOrders extends TableBasePage
divCostUnitLocalVatIncl.classList.add(flagCostUnitLocalVatIncl); divCostUnitLocalVatIncl.classList.add(flagCostUnitLocalVatIncl);
DOM.setElementValuesCurrentAndPrevious(divCostUnitLocalVatIncl, orderItem[flagCostUnitLocalVatIncl]); DOM.setElementValuesCurrentAndPrevious(divCostUnitLocalVatIncl, orderItem[flagCostUnitLocalVatIncl]);
tdCostUnitLocalVatIncl.appendChild(divCostUnitLocalVatIncl); tdCostUnitLocalVatIncl.appendChild(divCostUnitLocalVatIncl);
*/
let tdUnitMeasurementLatencyManufacture = document.createElement("td");
tdUnitMeasurementLatencyManufacture.classList.add(flagUnitMeasurementLatencyManufacture);
DOM.setElementAttributesValuesCurrentAndPrevious(tdUnitMeasurementLatencyManufacture, orderItem[attrIdUnitMeasurementLatencyManufacture]);
let divUnitMeasurementLatencyManufacture = document.createElement("div");
divUnitMeasurementLatencyManufacture.classList.add(flagUnitMeasurementLatencyManufacture);
// DOM.setElementValuesCurrentAndPrevious(divUnitMeasurementLatencyManufacture, orderItem[flagUnitMeasurementLatencyManufacture]);
tdUnitMeasurementLatencyManufacture.appendChild(divUnitMeasurementLatencyManufacture);
let tdLatencyManufacture = document.createElement("td"); let tdLatencyManufacture = document.createElement("td");
tdLatencyManufacture.classList.add(flagLatencyManufacture); tdLatencyManufacture.classList.add(flagLatencyManufacture);
let inputLatencyManufacture = document.createElement("input"); let inputLatencyManufacture = document.createElement("input");
@@ -343,10 +360,13 @@ export default class PageStoreManufacturingPurchaseOrders extends TableBasePage
tr.appendChild(tdUnitQuantity); tr.appendChild(tdUnitQuantity);
tr.appendChild(tdQuantityUsed); tr.appendChild(tdQuantityUsed);
tr.appendChild(tdQuantityProduced); tr.appendChild(tdQuantityProduced);
/*
tr.appendChild(tdCostTotalLocalVatExcl); tr.appendChild(tdCostTotalLocalVatExcl);
tr.appendChild(tdCostTotalLocalVatIncl); tr.appendChild(tdCostTotalLocalVatIncl);
tr.appendChild(tdCostUnitLocalVatExcl); tr.appendChild(tdCostUnitLocalVatExcl);
tr.appendChild(tdCostUnitLocalVatIncl); tr.appendChild(tdCostUnitLocalVatIncl);
*/
tr.appendChild(tdUnitMeasurementLatencyManufacture);
tr.appendChild(tdLatencyManufacture); tr.appendChild(tdLatencyManufacture);
tr.appendChild(tdActive); tr.appendChild(tdActive);
tr.appendChild(tdDelete); tr.appendChild(tdDelete);
@@ -368,9 +388,6 @@ export default class PageStoreManufacturingPurchaseOrders extends TableBasePage
hookupFieldsOrderItemProductVariations() { hookupFieldsOrderItemProductVariations() {
this.hookupEventHandler("click", idTableMain + ' td.' + flagOrderItems + ' td.' + flagProductVariations, (event, element) => this.handleClickProductPermutationVariationsPreview(event, element)); this.hookupEventHandler("click", idTableMain + ' td.' + flagOrderItems + ' td.' + flagProductVariations, (event, element) => this.handleClickProductPermutationVariationsPreview(event, element));
} }
handleChangeElementProductVariationsSubtableCell(event, element) {
this.handleChangeNestedElementCellTable(event, element); // , flagProductVariations);
}
hookupFieldsOrderItemUnitQuantity() { hookupFieldsOrderItemUnitQuantity() {
this.hookupTableCellDdlPreviews(idTableMain + ' td.' + flagOrderItems + ' td.' + flagUnitMeasurementQuantity, Utils.getListFromDict(unitMeasurements)); this.hookupTableCellDdlPreviews(idTableMain + ' td.' + flagOrderItems + ' td.' + flagUnitMeasurementQuantity, Utils.getListFromDict(unitMeasurements));
} }
@@ -380,6 +397,7 @@ export default class PageStoreManufacturingPurchaseOrders extends TableBasePage
hookupFieldsOrderItemQuantityProduced() { hookupFieldsOrderItemQuantityProduced() {
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagOrderItems + ' td.' + flagQuantityProduced + ' input'); this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagOrderItems + ' td.' + flagQuantityProduced + ' input');
} }
/*
hookupFieldsOrderItemPriceTotalLocalVatExcl() { hookupFieldsOrderItemPriceTotalLocalVatExcl() {
this.hookupChangeHandlerTableCells( this.hookupChangeHandlerTableCells(
idTableMain + ' td.' + flagOrderItems + ' td.' + flagPriceTotalLocalVatExcl + ' input' idTableMain + ' td.' + flagOrderItems + ' td.' + flagPriceTotalLocalVatExcl + ' input'
@@ -438,6 +456,7 @@ export default class PageStoreManufacturingPurchaseOrders extends TableBasePage
hookupFieldsOrderItemPriceUnitLocalVatIncl() { hookupFieldsOrderItemPriceUnitLocalVatIncl() {
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagOrderItems + ' td.' + flagPriceUnitLocalVatIncl + ' input'); this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagOrderItems + ' td.' + flagPriceUnitLocalVatIncl + ' input');
} }
*/
hookupFieldsOrderItemUnitMeasurementLatencyManufacture() { hookupFieldsOrderItemUnitMeasurementLatencyManufacture() {
this.hookupTableCellDdlPreviews(idTableMain + ' td.' + flagOrderItems + ' td.' + flagUnitMeasurementLatencyManufacture, Utils.getListFromDict(unitMeasurementsTime)); this.hookupTableCellDdlPreviews(idTableMain + ' td.' + flagOrderItems + ' td.' + flagUnitMeasurementLatencyManufacture, Utils.getListFromDict(unitMeasurementsTime));
} }
@@ -459,11 +478,11 @@ export default class PageStoreManufacturingPurchaseOrders extends TableBasePage
this.hookupEventHandler("click", idTableMain + ' td.' + flagOrderItems + ' th button.' + flagAdd, (event, element) => { this.hookupEventHandler("click", idTableMain + ' td.' + flagOrderItems + ' th button.' + flagAdd, (event, element) => {
let row = element.closest(idTableMain + ' > tbody > tr'); let row = element.closest(idTableMain + ' > tbody > tr');
let idManufacturingPurchaseOrder = row.getAttribute(attrIdManufacturingPurchaseOrder); let idManufacturingPurchaseOrder = row.getAttribute(attrIdManufacturingPurchaseOrder);
let hasActiveOrderItem = row.querySelectorAll('td.' + flagOrderItems + ' input.' + flagActive + ':checked').length > 0; // let hasActiveOrderItem = row.querySelectorAll('td.' + flagOrderItems + ' input.' + flagActive + ':checked').length > 0;
let countManufacturingOrderItemes = row.querySelectorAll('td.' + flagOrderItems + ' td.' + flagManufacturingPurchaseOrder).length; let countManufacturingOrderItems = row.querySelectorAll('td.' + flagOrderItems + ' td.' + flagManufacturingPurchaseOrder).length;
let manufacturingPurchaseOrderItem = { let manufacturingPurchaseOrderItem = {
[attrIdManufacturingPurchaseOrder]: idManufacturingPurchaseOrder, [attrIdManufacturingPurchaseOrder]: idManufacturingPurchaseOrder,
[attrIdManufacturingPurchaseOrderProductLink]: -1 - countManufacturingOrderItemes, [attrIdManufacturingPurchaseOrderProductLink]: -1 - countManufacturingOrderItems,
[attrIdProductCategory]: 0, [attrIdProductCategory]: 0,
[attrIdProduct]: 0, [attrIdProduct]: 0,
[flagProductVariations]: '', [flagProductVariations]: '',
@@ -473,10 +492,10 @@ export default class PageStoreManufacturingPurchaseOrders extends TableBasePage
[attrIdUnitMeasurementLatencyManufacture]: 0, [attrIdUnitMeasurementLatencyManufacture]: 0,
[flagLatencyManufacture]: '', [flagLatencyManufacture]: '',
[flagDisplayOrder]: countManufacturingOrderItems + 1, [flagDisplayOrder]: countManufacturingOrderItems + 1,
[flagActive]: !hasActiveOrderItem, [flagActive]: true, // !hasActiveOrderItem,
}; };
let tbody = row.querySelector('td.' + flagOrderItems + ' table tbody'); let tbody = row.querySelector('td.' + flagOrderItems + ' table tbody');
this.addRowManufacturingOrderItem(tbody, manufacturingPurchaseOrderItem); this.addRowManufacturingPurchaseOrderItem(tbody, manufacturingPurchaseOrderItem);
/* /*
if (!hasActiveOrderItem) { if (!hasActiveOrderItem) {
let tdOrderItem = row.querySelector('td.' + flagOrderItems); let tdOrderItem = row.querySelector('td.' + flagOrderItems);

View File

@@ -65,7 +65,7 @@ export default class StoreMixinPage {
}); });
dropdownCurrency.addEventListener("change", function() { dropdownCurrency.addEventListener("change", function() {
let selectedCurrency = dropdownCurrency.val(); let selectedCurrency = dropdownCurrency.val();
console.log("selected currency: ", selectedCurrency); if (_verbose) { console.log("selected currency: ", selectedCurrency); }
let basket = LocalStorage.getLocalStorage(keyBasket); let basket = LocalStorage.getLocalStorage(keyBasket);
basket[keyIdCurrency] = selectedCurrency; basket[keyIdCurrency] = selectedCurrency;
// LocalStorage.setLocalStorage(keyIdCurrency, selectedCurrency); // LocalStorage.setLocalStorage(keyIdCurrency, selectedCurrency);
@@ -109,17 +109,17 @@ export default class StoreMixinPage {
Events.initialiseEventHandler(dropdownRegion, flagInitialised, function() { Events.initialiseEventHandler(dropdownRegion, flagInitialised, function() {
dropdownRegion = document.querySelectorAll(dropdownRegion); dropdownRegion = document.querySelectorAll(dropdownRegion);
dropdownRegion.addEventListener("focus", function() { dropdownRegion.addEventListener("focus", function() {
console.log("dropdown region focused"); if (_verbose) { console.log("dropdown region focused"); }
handleSelectExpand(dropdownRegion); handleSelectExpand(dropdownRegion);
}); });
dropdownRegion.addEventListener("blur", function() { dropdownRegion.addEventListener("blur", function() {
console.log("dropdown region blurred"); if (_verbose) { console.log("dropdown region blurred"); }
handleSelectCollapse(dropdownRegion); handleSelectCollapse(dropdownRegion);
}); });
dropdownRegion.addEventListener("change", function() { dropdownRegion.addEventListener("change", function() {
handleSelectCollapse(dropdownRegion); handleSelectCollapse(dropdownRegion);
let selectedRegion = dropdownRegion.val(); let selectedRegion = dropdownRegion.val();
console.log("selected region: ", selectedRegion); if (_verbose) { console.log("selected region: ", selectedRegion); }
let basket = LocalStorage.getLocalStorage(keyBasket); let basket = LocalStorage.getLocalStorage(keyBasket);
basket[keyIdRegionDelivery] = selectedRegion; basket[keyIdRegionDelivery] = selectedRegion;
// LocalStorage.setLocalStorage(keyIdRegionDelivery, selectedRegion); // LocalStorage.setLocalStorage(keyIdRegionDelivery, selectedRegion);
@@ -138,10 +138,13 @@ export default class StoreMixinPage {
elSelector.addEventListener("change", function(event) { elSelector.addEventListener("change", function(event) {
ajaxData = {}; ajaxData = {};
ajaxData[flagForm] = convertForm2JSON(elForm); ajaxData[flagForm] = convertForm2JSON(elForm);
console.log('sending data to include VAT controller: '); console.log(ajaxData); if (_verbose) {
console.log('sending data to include VAT controller: ');
console.log(ajaxData);
}
ajaxJSONData('set include VAT', mapHashToController(hashStoreSetIsIncludedVAT), ajaxData, function() { window.location.reload() }, false); ajaxJSONData('set include VAT', mapHashToController(hashStoreSetIsIncludedVAT), ajaxData, function() { window.location.reload() }, false);
}); });
console.log("form is included VAT initialised") if (_verbose) { console.log("form is included VAT initialised"); }
}); });
} }
hookupLocalStorage() { hookupLocalStorage() {
@@ -153,7 +156,7 @@ export default class StoreMixinPage {
// console.log('d:'); console.log(d); // console.log('d:'); console.log(d);
let basketLocalStorage = LocalStorage.getLocalStorage(keyBasket); let basketLocalStorage = LocalStorage.getLocalStorage(keyBasket);
if (!StoreMixinPage.validateBasket(basketLocalStorage)) { if (!StoreMixinPage.validateBasket(basketLocalStorage)) {
console.log('locally-stored basket not valid'); if (_verbose) { console.log('locally-stored basket not valid'); }
basketLocalStorage = StoreMixinPage.makeNewBasket(); basketLocalStorage = StoreMixinPage.makeNewBasket();
} }
let basketServer = StoreMixinPage.validateBasket(userBasket) ? userBasket : basketLocalStorage; let basketServer = StoreMixinPage.validateBasket(userBasket) ? userBasket : basketLocalStorage;
@@ -216,7 +219,7 @@ export default class StoreMixinPage {
this.hookupDeleteBasketItemButtons(); this.hookupDeleteBasketItemButtons();
} }
toggleShowButtonCheckout() { toggleShowButtonCheckout() {
console.log("toggling checkout button"); if (_verbose) { console.log("toggling checkout button"); }
const buttonCheckout = document.querySelectorAll(idButtonCheckout); const buttonCheckout = document.querySelectorAll(idButtonCheckout);
const labelBasketEmpty = document.querySelectorAll(idLabelBasketEmpty); const labelBasketEmpty = document.querySelectorAll(idLabelBasketEmpty);
if (userBasket['items'].length == 0) { if (userBasket['items'].length == 0) {
@@ -228,7 +231,7 @@ export default class StoreMixinPage {
} }
} }
hookupButtonCheckout() { hookupButtonCheckout() {
console.log("hooking up checkout button"); if (_verbose) { console.log("hooking up checkout button"); }
const buttonCheckout = document.querySelectorAll(idButtonCheckout); const buttonCheckout = document.querySelectorAll(idButtonCheckout);
// let lsPage = getPageLocalStorage(hashPageCurrent); // let lsPage = getPageLocalStorage(hashPageCurrent);
Events.initialiseEventHandler(buttonCheckout, flagInitialised, function() { Events.initialiseEventHandler(buttonCheckout, flagInitialised, function() {
@@ -383,7 +386,7 @@ export default class StoreMixinPage {
getCurrencySelected() { getCurrencySelected() {
let elementSelectorCurrency = document.querySelectorAll(idSelectorCurrency); let elementSelectorCurrency = document.querySelectorAll(idSelectorCurrency);
let selectedCurrency = elementSelectorCurrency.val(); let selectedCurrency = elementSelectorCurrency.val();
console.log("selected currency: ", selectedCurrency); if (_verbose) { console.log("selected currency: ", selectedCurrency); }
return selectedCurrency; return selectedCurrency;
} }
@@ -392,13 +395,15 @@ export default class StoreMixinPage {
let d; // , lsShared; let d; // , lsShared;
let selectorCardProduct = '.card.subcard'; let selectorCardProduct = '.card.subcard';
Events.initialiseEventHandler(selectorCardProduct, flagInitialised, function(cardProduct) { Events.initialiseEventHandler(selectorCardProduct, flagInitialised, function(cardProduct) {
console.log("initialising product card: ", cardProduct); if (_verbose) { console.log("initialising product card: ", cardProduct); }
cardProduct.addEventListener("click", function(event) { cardProduct.addEventListener("click", function(event) {
// d = { keyIdProduct: product.getAttribute(attrIdProduct) } // d = { keyIdProduct: product.getAttribute(attrIdProduct) }
var elemClicked = event.target; var elemClicked = event.target;
if (elemClicked.id != 'submit') { // disable for submit buttons if (elemClicked.id != 'submit') { // disable for submit buttons
console.log("product click: " + cardProduct.getAttribute(attrIdProduct)); if (_verbose) {
console.log("permutation click: " + cardProduct.getAttribute(attrIdPermutation)); console.log("product click: " + cardProduct.getAttribute(attrIdProduct));
console.log("permutation click: " + cardProduct.getAttribute(attrIdPermutation));
}
var d = {} var d = {}
d[keyIdProduct] = cardProduct.getAttribute(attrIdProduct) d[keyIdProduct] = cardProduct.getAttribute(attrIdProduct)
d[keyIdPermutation] = cardProduct.getAttribute(attrIdPermutation) d[keyIdPermutation] = cardProduct.getAttribute(attrIdPermutation)
@@ -406,7 +411,7 @@ export default class StoreMixinPage {
goToPage(hashPageStoreProduct, d); goToPage(hashPageStoreProduct, d);
} }
}); });
console.log("click method added for product ID: " + cardProduct.getAttribute(attrIdProduct) + ', permutation ID: ', cardProduct.getAttribute(attrIdPermutation)); if (_verbose) { console.log("click method added for product ID: " + cardProduct.getAttribute(attrIdProduct) + ', permutation ID: ', cardProduct.getAttribute(attrIdPermutation)); }
}); });
} }

View File

@@ -33,13 +33,13 @@ export default class PageStoreProductCategories extends TableBasePage {
loadRowTable(rowJson) { loadRowTable(rowJson) {
if (rowJson == null) return; if (rowJson == null) return;
if (_verbose) { console.log("applying data row: ", rowJson); }
let row = _rowBlank.cloneNode(true); let row = _rowBlank.cloneNode(true);
row.classList.remove(flagRowNew); row.classList.remove(flagRowNew);
row.classList.remove(flagInitialised); row.classList.remove(flagInitialised);
row.querySelectorAll('.' + flagInitialised).forEach(function(element) { row.querySelectorAll('.' + flagInitialised).forEach(function(element) {
element.classList.remove(flagInitialised); element.classList.remove(flagInitialised);
}); });
console.log("applying data row: ", rowJson);
let sliderDisplayOrder = row.querySelector('td.' + flagDisplayOrder + ' .' + flagSlider); let sliderDisplayOrder = row.querySelector('td.' + flagDisplayOrder + ' .' + flagSlider);
let textareaCode = row.querySelector('td.' + flagCode + ' textarea'); let textareaCode = row.querySelector('td.' + flagCode + ' textarea');
let textareaName = row.querySelector('td.' + flagName + ' textarea'); let textareaName = row.querySelector('td.' + flagName + ' textarea');
@@ -75,13 +75,13 @@ export default class PageStoreProductCategories extends TableBasePage {
let jsonCategory = {}; let jsonCategory = {};
jsonCategory[attrIdProductCategory] = row.getAttribute(attrIdProductCategory); jsonCategory[attrIdProductCategory] = row.getAttribute(attrIdProductCategory);
jsonCategory[flagCode] = DOM.getElementValueCurrent(textareaCode); jsonCategory[flagCode] = DOM.getElementAttributeValueCurrent(textareaCode);
jsonCategory[flagName] = DOM.getElementValueCurrent(textareaName); jsonCategory[flagName] = DOM.getElementAttributeValueCurrent(textareaName);
jsonCategory[flagDescription] = DOM.getElementValueCurrent(textareaDescription); jsonCategory[flagDescription] = DOM.getElementAttributeValueCurrent(textareaDescription);
// jsonCategory[flagAccessLevelRequired] = tdAccessLevel.getAttribute(flagAccessLevelRequired); // jsonCategory[flagAccessLevelRequired] = tdAccessLevel.getAttribute(flagAccessLevelRequired);
jsonCategory[attrIdAccessLevel] = DOM.getElementValueCurrent(tdAccessLevel); jsonCategory[attrIdAccessLevel] = DOM.getElementAttributeValueCurrent(tdAccessLevel);
jsonCategory[flagActive] = DOM.getElementValueCurrent(inputActive); jsonCategory[flagActive] = DOM.getElementAttributeValueCurrent(inputActive);
jsonCategory[flagDisplayOrder] = sliderDisplayOrder.getAttribute(attrValueCurrent); jsonCategory[flagDisplayOrder] = DOM.getElementAttributeValueCurrent(sliderDisplayOrder);
return jsonCategory; return jsonCategory;
} }
initialiseRowNew(row) { initialiseRowNew(row) {

View File

@@ -67,12 +67,12 @@ export default class PageStoreProductPermutations extends TableBasePage {
} }
loadRowTable(rowJson) { loadRowTable(rowJson) {
/*
if (rowJson == null) return; if (rowJson == null) return;
if (_verbose) { console.log("applying data row: ", rowJson); }
/*
let tableMain = TableBasePage.getTableMain(); let tableMain = TableBasePage.getTableMain();
let row = _rowBlank.cloneNode(true); let row = _rowBlank.cloneNode(true);
row.classList.remove(flagRowNew); row.classList.remove(flagRowNew);
console.log("applying data row: ", rowJson);
let dllCategory = row.querySelector('td.' + flagProductCategory + ' select'); let dllCategory = row.querySelector('td.' + flagProductCategory + ' select');
dllCategory.value = rowJson[attrIdProductCategory]; dllCategory.value = rowJson[attrIdProductCategory];
let ddlProduct = row.querySelector('td.' + flagProduct + ' select'); let ddlProduct = row.querySelector('td.' + flagProduct + ' select');
@@ -130,7 +130,8 @@ export default class PageStoreProductPermutations extends TableBasePage {
let tdProduct = row.querySelector('td.' + flagProduct); let tdProduct = row.querySelector('td.' + flagProduct);
let tdProductVariations = row.querySelector('td.' + flagProductVariations); let tdProductVariations = row.querySelector('td.' + flagProductVariations);
let inputDescription = row.querySelector('td.' + flagDescription + ' textarea'); let inputDescription = row.querySelector('td.' + flagDescription + ' textarea');
let inputCostLocal = row.querySelector('td.' + flagCostLocal + ' input'); let inputCostLocalVatExcl = row.querySelector('td.' + flagCostUnitLocalVatExcl + ' input');
let inputCostLocalVatIncl = row.querySelector('td.' + flagCostUnitLocalVatIncl + ' input');
let tdCurrencyCost = row.querySelector('td.' + flagCurrencyCost); let tdCurrencyCost = row.querySelector('td.' + flagCurrencyCost);
let inputProfitLocalMin = row.querySelector('td.' + flagProfitLocalMin + ' input'); let inputProfitLocalMin = row.querySelector('td.' + flagProfitLocalMin + ' input');
let inputLatencyManufactureDays = row.querySelector('td.' + flagLatencyManufacture + ' input'); let inputLatencyManufactureDays = row.querySelector('td.' + flagLatencyManufacture + ' input');
@@ -155,7 +156,8 @@ export default class PageStoreProductPermutations extends TableBasePage {
jsonRow[flagProductVariations] = tdProductVariations.getAttribute(attrValueCurrent); jsonRow[flagProductVariations] = tdProductVariations.getAttribute(attrValueCurrent);
jsonRow[flagHasVariations] = jsonRow[flagProductVariations] != ''; jsonRow[flagHasVariations] = jsonRow[flagProductVariations] != '';
jsonRow[flagDescription] = inputDescription.getAttribute(attrValueCurrent); jsonRow[flagDescription] = inputDescription.getAttribute(attrValueCurrent);
jsonRow[flagCostLocal] = inputCostLocal.getAttribute(attrValueCurrent); jsonRow[flagCostUnitLocalVatExcl] = inputCostLocalVatExcl.getAttribute(attrValueCurrent);
jsonRow[flagCostUnitLocalVatIncl] = inputCostLocalVatIncl.getAttribute(attrValueCurrent);
jsonRow[flagCurrencyCost] = tdCurrencyCost.getAttribute(attrValueCurrent); jsonRow[flagCurrencyCost] = tdCurrencyCost.getAttribute(attrValueCurrent);
jsonRow[flagProfitLocalMin] = inputProfitLocalMin.getAttribute(attrValueCurrent); jsonRow[flagProfitLocalMin] = inputProfitLocalMin.getAttribute(attrValueCurrent);
jsonRow[flagLatencyManufacture] = inputLatencyManufactureDays.getAttribute(attrValueCurrent); jsonRow[flagLatencyManufacture] = inputLatencyManufactureDays.getAttribute(attrValueCurrent);
@@ -181,8 +183,10 @@ export default class PageStoreProductPermutations extends TableBasePage {
let ddlProductFilter = document.querySelector(idFormFilters + ' #' + attrIdProduct); let ddlProductFilter = document.querySelector(idFormFilters + ' #' + attrIdProduct);
let idProductFilter = DOM.getElementValueCurrent(ddlProductFilter); let idProductFilter = DOM.getElementValueCurrent(ddlProductFilter);
let hasProductFilter = !(Validation.isEmpty(idProductFilter) || idProductFilter == '0'); let hasProductFilter = !(Validation.isEmpty(idProductFilter) || idProductFilter == '0');
console.log("initialiseRowNew: ", row); if (_verbose) {
console.log({ddlCategoryFilter, idProductCategoryFilter, hasCategoryFilter, ddlProductFilter, idProductFilter, hasProductFilter}); console.log("initialiseRowNew: ", row);
console.log({ddlCategoryFilter, idProductCategoryFilter, hasCategoryFilter, ddlProductFilter, idProductFilter, hasProductFilter});
}
if (!hasCategoryFilter && !hasProductFilter) return; if (!hasCategoryFilter && !hasProductFilter) return;
if (hasCategoryFilter) { if (hasCategoryFilter) {
let ddlCategory = row.querySelector('td.' + flagProductCategory + ' select'); let ddlCategory = row.querySelector('td.' + flagProductCategory + ' select');
@@ -231,7 +235,10 @@ export default class PageStoreProductPermutations extends TableBasePage {
this.hookupTableCellDdlPreviews(idTableMain + ' td.' + flagCurrencyCost, Utils.getListFromDict(currencies)); this.hookupTableCellDdlPreviews(idTableMain + ' td.' + flagCurrencyCost, Utils.getListFromDict(currencies));
} }
hookupCostInputs(){ hookupCostInputs(){
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagCostLocal + ' input'); /*
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagCostUnitLocalVatExcl + ' input');
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagCostUnitLocalVatIncl + ' input');
*/
} }
hookupProfitFields(){ hookupProfitFields(){
// this.hookupCurrencyProfitFields(); // this.hookupCurrencyProfitFields();
@@ -268,7 +275,6 @@ export default class PageStoreProductPermutations extends TableBasePage {
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagCountUnitMeasurementPerQuantityStep + ' input'); this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagCountUnitMeasurementPerQuantityStep + ' input');
} }
hookupUnitMeasurementQuantityFields() { hookupUnitMeasurementQuantityFields() {
console.log("hooking up unit measurement quantity fields");
this.hookupTableCellDdlPreviews(idTableMain + ' td.' + flagUnitMeasurementQuantity, Utils.getListFromDict(unitMeasurements)); this.hookupTableCellDdlPreviews(idTableMain + ' td.' + flagUnitMeasurementQuantity, Utils.getListFromDict(unitMeasurements));
} }
hookupSubscriptionFields() { hookupSubscriptionFields() {

View File

@@ -40,7 +40,6 @@ export default class PageStoreProducts extends TableBasePage {
row.querySelectorAll('.' + flagInitialised).forEach(function(element) { row.querySelectorAll('.' + flagInitialised).forEach(function(element) {
element.classList.remove(flagInitialised); element.classList.remove(flagInitialised);
}); });
console.log("applying data row: ", rowJson);
let sliderDisplayOrder = row.querySelector('td.' + flagDisplayOrder + ' .' + flagSlider); let sliderDisplayOrder = row.querySelector('td.' + flagDisplayOrder + ' .' + flagSlider);
let tdProductCategory = row.querySelector('td.' + flagProductCategory); let tdProductCategory = row.querySelector('td.' + flagProductCategory);
let divProductCategory = tdProductCategory.querySelector('div.' + flagProductCategory); let divProductCategory = tdProductCategory.querySelector('div.' + flagProductCategory);

View File

@@ -115,8 +115,10 @@ export default class PageStoreStockItems extends TableBasePage {
let ddlProductFilter = document.querySelector(idFormFilters + ' #' + attrIdProduct); let ddlProductFilter = document.querySelector(idFormFilters + ' #' + attrIdProduct);
let idProductFilter = DOM.getElementValueCurrent(ddlProductFilter); let idProductFilter = DOM.getElementValueCurrent(ddlProductFilter);
let hasProductFilter = !(Validation.isEmpty(idProductFilter) || idProductFilter == '0'); let hasProductFilter = !(Validation.isEmpty(idProductFilter) || idProductFilter == '0');
console.log("initialiseRowNew: ", row); if (_verbose) {
console.log({ddlCategoryFilter, idProductCategoryFilter, hasCategoryFilter, ddlProductFilter, idProductFilter, hasProductFilter}); console.log("initialiseRowNew: ", row);
console.log({ddlCategoryFilter, idProductCategoryFilter, hasCategoryFilter, ddlProductFilter, idProductFilter, hasProductFilter});
}
if (!hasCategoryFilter && !hasProductFilter) return; if (!hasCategoryFilter && !hasProductFilter) return;
if (hasCategoryFilter) { if (hasCategoryFilter) {
let ddlCategory = row.querySelector('td.' + flagProductCategory + ' select'); let ddlCategory = row.querySelector('td.' + flagProductCategory + ' select');
@@ -222,7 +224,7 @@ export default class PageStoreStockItems extends TableBasePage {
DOM.setElementAttributesValuesCurrentAndPrevious(ddlPlant, plantJson[attrIdPlant]); DOM.setElementAttributesValuesCurrentAndPrevious(ddlPlant, plantJson[attrIdPlant]);
optionPlant = DOM.createOption(null); optionPlant = DOM.createOption(null);
console.log("optionPlant: ", optionPlant); if (_verbose) { console.log("optionPlant: ", optionPlant); }
ddlPlant.appendChild(optionPlant); ddlPlant.appendChild(optionPlant);
plantKeys.forEach((plantKey) => { plantKeys.forEach((plantKey) => {
@@ -232,7 +234,7 @@ export default class PageStoreStockItems extends TableBasePage {
valueSelected = plantJson[attrIdPlant] valueSelected = plantJson[attrIdPlant]
); );
optionPlant = DOM.createOption(optionPlantJson); optionPlant = DOM.createOption(optionPlantJson);
console.log("optionPlant: ", optionPlant); if (_verbose) { console.log("optionPlant: ", optionPlant); }
ddlPlant.appendChild(optionPlant); ddlPlant.appendChild(optionPlant);
}); });
@@ -245,7 +247,7 @@ export default class PageStoreStockItems extends TableBasePage {
DOM.setElementAttributesValuesCurrentAndPrevious(ddlStorageLocation, storageLocationJson[attrIdStorageLocation]); DOM.setElementAttributesValuesCurrentAndPrevious(ddlStorageLocation, storageLocationJson[attrIdStorageLocation]);
optionStorageLocation = DOM.createOption(null); optionStorageLocation = DOM.createOption(null);
console.log("optionStorageLocation: ", optionStorageLocation); if (_verbose) { console.log("optionStorageLocation: ", optionStorageLocation); }
ddlStorageLocation.appendChild(optionStorageLocation); ddlStorageLocation.appendChild(optionStorageLocation);
StorageLocationKeys.forEach((StorageLocationKey) => { StorageLocationKeys.forEach((StorageLocationKey) => {
@@ -255,7 +257,7 @@ export default class PageStoreStockItems extends TableBasePage {
valueSelected = storageLocationJson[attrIdStorageLocation] valueSelected = storageLocationJson[attrIdStorageLocation]
); );
optionStorageLocation = DOM.createOption(optionStorageLocationJson); optionStorageLocation = DOM.createOption(optionStorageLocationJson);
console.log("optionStorageLocation: ", optionStorageLocation); if (_verbose) { console.log("optionStorageLocation: ", optionStorageLocation); }
ddlStorageLocation.appendChild(optionStorageLocation); ddlStorageLocation.appendChild(optionStorageLocation);
}); });
@@ -270,12 +272,12 @@ export default class PageStoreStockItems extends TableBasePage {
let parent = element.parentElement; let parent = element.parentElement;
parent.innerHTML = ''; parent.innerHTML = '';
parent.appendChild(tblStorageLocation); parent.appendChild(tblStorageLocation);
console.log("tblStorageLocation: ", tblStorageLocation); if (_verbose) { console.log("tblStorageLocation: ", tblStorageLocation); }
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagPlant + ' select', (event, element) => { this.handleChangeStoragePlantDdl(event, element); }); this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagPlant + ' select', (event, element) => { this.handleChangeStoragePlantDdl(event, element); });
this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagStorageLocation + ' select', (event, element) => { this.handleChangeStorageLocationDdl(event, element); }); this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagStorageLocation + ' select', (event, element) => { this.handleChangeStorageLocationDdl(event, element); });
} }
handleChangeStoragePlantDdl(event, ddlPlant) { handleChangeStoragePlantDdl(event, ddlPlant) {
this.handleChangeTableCellDdl(event, ddlPlant); this.handleChangeNestedElementCellTable(event, ddlPlant);
let row = DOM.getRowFromElement(ddlPlant); let row = DOM.getRowFromElement(ddlPlant);
let ddlStorageLocation = row.querySelector('td.' + flagStorageLocation + ' select'); let ddlStorageLocation = row.querySelector('td.' + flagStorageLocation + ' select');
ddlStorageLocation.innerHTML = ''; ddlStorageLocation.innerHTML = '';
@@ -288,10 +290,10 @@ export default class PageStoreStockItems extends TableBasePage {
option = DOM.createOption(optionJson); option = DOM.createOption(optionJson);
ddlStorageLocation.appendChild(option); ddlStorageLocation.appendChild(option);
}); });
this.handleChangeTableCellDdl(event, ddlStorageLocation); this.handleChangeNestedElementCellTable(event, ddlStorageLocation);
} }
handleChangeStorageLocationDdl(event, ddlStorageLocation) { handleChangeStorageLocationDdl(event, ddlStorageLocation) {
this.handleChangeTableCellDdl(event, ddlStorageLocation); this.handleChangeNestedElementCellTable(event, ddlStorageLocation);
} }
hookupSealingInputs() { hookupSealingInputs() {

View File

@@ -129,7 +129,7 @@ export default class PageStoreSupplierPurchaseOrders extends TableBasePage {
}); });
} }
handleClickOrderItemsPreview(event, element) { handleClickOrderItemsPreview(event, element) {
console.log("click order items preview"); if (_verbose) { console.log("click order items preview"); }
this.toggleColumnHeaderCollapsed(flagOrderItems, false); this.toggleColumnHeaderCollapsed(flagOrderItems, false);
element.classList.remove(flagCollapsed); element.classList.remove(flagCollapsed);
@@ -216,11 +216,11 @@ export default class PageStoreSupplierPurchaseOrders extends TableBasePage {
let cellNew = cell.cloneNode(false); let cellNew = cell.cloneNode(false);
cellNew.appendChild(tblOrderItems); cellNew.appendChild(tblOrderItems);
row.replaceChild(cellNew, cell); row.replaceChild(cellNew, cell);
console.log("tblOrderItems: ", tblOrderItems); if (_verbose) { console.log("tblOrderItems: ", tblOrderItems); }
this.hookupOrderItemsFields(); this.hookupOrderItemsFields();
} }
addRowSupplierPurchaseOrderItem(tbody, orderItem) { // productVariationTypeOptions, productVariationOptions, productCategoryOptions, productOptions, unitMeasurementOptions, addRowSupplierPurchaseOrderItem(tbody, orderItem) { // productVariationTypeOptions, productVariationOptions, productCategoryOptions, productOptions, unitMeasurementOptions,
console.log("addRowSupplierPurchaseOrderItem: ", orderItem); if (_verbose) { console.log("addRowSupplierPurchaseOrderItem: ", orderItem); }
let tdDisplayOrder = document.createElement("td"); let tdDisplayOrder = document.createElement("td");
tdDisplayOrder.classList.add(flagDisplayOrder); tdDisplayOrder.classList.add(flagDisplayOrder);
@@ -255,6 +255,7 @@ export default class PageStoreSupplierPurchaseOrders extends TableBasePage {
let tdVariations = document.createElement("td"); let tdVariations = document.createElement("td");
tdVariations.classList.add(flagProductVariations); tdVariations.classList.add(flagProductVariations);
tdVariations.classList.add(flagCollapsed);
DOM.setElementAttributesValuesCurrentAndPrevious(tdVariations, orderItem[attrIdProductVariation]); DOM.setElementAttributesValuesCurrentAndPrevious(tdVariations, orderItem[attrIdProductVariation]);
let divVariations = document.createElement("div"); let divVariations = document.createElement("div");
divVariations.classList.add(flagProductVariations); divVariations.classList.add(flagProductVariations);
@@ -312,14 +313,14 @@ export default class PageStoreSupplierPurchaseOrders extends TableBasePage {
tdCostUnitLocalVatExcl.classList.add(flagCostUnitLocalVatExcl); tdCostUnitLocalVatExcl.classList.add(flagCostUnitLocalVatExcl);
let divCostUnitLocalVatExcl = document.createElement("div"); let divCostUnitLocalVatExcl = document.createElement("div");
divCostUnitLocalVatExcl.classList.add(flagCostUnitLocalVatExcl); divCostUnitLocalVatExcl.classList.add(flagCostUnitLocalVatExcl);
DOM.setElementValuesCurrentAndPrevious(divCostUnitLocalVatExcl, orderItem[flagCostUnitLocalVatExcl]); DOM.setElementValuesCurrentAndPrevious(divCostUnitLocalVatExcl, orderItem[flagCostUnitLocalVatExcl].toFixed(3));
tdCostUnitLocalVatExcl.appendChild(divCostUnitLocalVatExcl); tdCostUnitLocalVatExcl.appendChild(divCostUnitLocalVatExcl);
let tdCostUnitLocalVatIncl = document.createElement("td"); let tdCostUnitLocalVatIncl = document.createElement("td");
tdCostUnitLocalVatIncl.classList.add(flagCostUnitLocalVatIncl); tdCostUnitLocalVatIncl.classList.add(flagCostUnitLocalVatIncl);
let divCostUnitLocalVatIncl = document.createElement("div"); let divCostUnitLocalVatIncl = document.createElement("div");
divCostUnitLocalVatIncl.classList.add(flagCostUnitLocalVatIncl); divCostUnitLocalVatIncl.classList.add(flagCostUnitLocalVatIncl);
DOM.setElementValuesCurrentAndPrevious(divCostUnitLocalVatIncl, orderItem[flagCostUnitLocalVatIncl]); DOM.setElementValuesCurrentAndPrevious(divCostUnitLocalVatIncl, orderItem[flagCostUnitLocalVatIncl].toFixed(3));
tdCostUnitLocalVatIncl.appendChild(divCostUnitLocalVatIncl); tdCostUnitLocalVatIncl.appendChild(divCostUnitLocalVatIncl);
let tdLatencyDeliveryDays = document.createElement("td"); let tdLatencyDeliveryDays = document.createElement("td");
@@ -384,20 +385,11 @@ export default class PageStoreSupplierPurchaseOrders extends TableBasePage {
this.hookupEventHandler("click", idTableMain + ' td.' + flagOrderItems + ' td.' + flagProductVariations, (event, element) => this.handleClickProductPermutationVariationsPreview(event, element)); this.hookupEventHandler("click", idTableMain + ' td.' + flagOrderItems + ' td.' + flagProductVariations, (event, element) => this.handleClickProductPermutationVariationsPreview(event, element));
} }
*/ */
handleChangeElementProductVariationsSubtableCell(event, element) {
this.handleChangeNestedElementCellTable(event, element); // flagProductVariations);
}
hookupDdlsProductPermutationVariation() { hookupDdlsProductPermutationVariation() {
this.hookupTableCellDdls( this.hookupTableCellDdls(idTableMain + ' td.' + flagProductVariations + ' td.' + flagProductVariation);
idTableMain + ' td.' + flagProductVariations + ' td.' + flagProductVariation
, (event, element) => { this.handleChangeElementProductVariationsSubtableCell(event, element); }
);
} }
hookupDdlsProductPermutationVariationType() { hookupDdlsProductPermutationVariationType() {
this.hookupTableCellDdls( this.hookupTableCellDdls(idTableMain + ' td.' + flagProductVariations + ' td.' + flagProductVariationType);
idTableMain + ' td.' + flagProductVariations + ' td.' + flagProductVariationType
, (event, element) => { this.handleChangeElementProductVariationsSubtableCell(event, element); }
);
} }
hookupFieldsOrderItemUnitQuantity() { hookupFieldsOrderItemUnitQuantity() {
this.hookupTableCellDdlPreviews( this.hookupTableCellDdlPreviews(
@@ -442,7 +434,7 @@ export default class PageStoreSupplierPurchaseOrders extends TableBasePage {
let divCostUnitLocalVatExcl = row.querySelector('td.' + flagCostUnitLocalVatExcl + ' div'); let divCostUnitLocalVatExcl = row.querySelector('td.' + flagCostUnitLocalVatExcl + ' div');
let costUnitLocalVatExcl = quantityOrdered == 0 ? 0 : costTotalLocalVatExcl / quantityOrdered; let costUnitLocalVatExcl = quantityOrdered == 0 ? 0 : costTotalLocalVatExcl / quantityOrdered;
DOM.setElementValuesCurrentAndPrevious(divCostUnitLocalVatExcl, costUnitLocalVatExcl); DOM.setElementValuesCurrentAndPrevious(divCostUnitLocalVatExcl, costUnitLocalVatExcl.toFixed(3));
let rowSupplierPurchaseOrder = row.closest(idTableMain + ' > tbody > tr'); let rowSupplierPurchaseOrder = row.closest(idTableMain + ' > tbody > tr');
let divCostGrandTotalLocalVatExcl = rowSupplierPurchaseOrder.querySelector('td.' + flagCostTotalLocalVatExcl + ' div'); let divCostGrandTotalLocalVatExcl = rowSupplierPurchaseOrder.querySelector('td.' + flagCostTotalLocalVatExcl + ' div');
@@ -459,7 +451,7 @@ export default class PageStoreSupplierPurchaseOrders extends TableBasePage {
let divCostUnitLocalVatIncl = row.querySelector('td.' + flagCostUnitLocalVatIncl + ' div'); let divCostUnitLocalVatIncl = row.querySelector('td.' + flagCostUnitLocalVatIncl + ' div');
let costUnitLocalVatIncl = quantityOrdered == 0 ? 0 : costTotalLocalVatIncl / quantityOrdered; let costUnitLocalVatIncl = quantityOrdered == 0 ? 0 : costTotalLocalVatIncl / quantityOrdered;
DOM.setElementValuesCurrentAndPrevious(divCostUnitLocalVatIncl, costUnitLocalVatIncl); DOM.setElementValuesCurrentAndPrevious(divCostUnitLocalVatIncl, costUnitLocalVatIncl.toFixed(3));
let rowSupplierPurchaseOrder = row.closest(idTableMain + ' > tbody > tr'); let rowSupplierPurchaseOrder = row.closest(idTableMain + ' > tbody > tr');
let divCostGrandTotalLocalVatIncl = rowSupplierPurchaseOrder.querySelector('td.' + flagCostTotalLocalVatIncl + ' div'); let divCostGrandTotalLocalVatIncl = rowSupplierPurchaseOrder.querySelector('td.' + flagCostTotalLocalVatIncl + ' div');
@@ -485,7 +477,7 @@ export default class PageStoreSupplierPurchaseOrders extends TableBasePage {
this.hookupEventHandler("click", idTableMain + ' td.' + flagOrderItems + ' th button.' + flagAdd, (event, element) => { this.hookupEventHandler("click", idTableMain + ' td.' + flagOrderItems + ' th button.' + flagAdd, (event, element) => {
let row = element.closest(idTableMain + ' > tbody > tr'); let row = element.closest(idTableMain + ' > tbody > tr');
let idSupplierPurchaseOrder = row.getAttribute(attrIdSupplierPurchaseOrder); let idSupplierPurchaseOrder = row.getAttribute(attrIdSupplierPurchaseOrder);
let hasActiveOrderItem = row.querySelectorAll('td.' + flagOrderItems + ' input.' + flagActive + ':checked').length > 0; // let hasActiveOrderItem = row.querySelectorAll('td.' + flagOrderItems + ' input.' + flagActive + ':checked').length > 0;
let countSupplierOrderItems = row.querySelectorAll('td.' + flagOrderItems + ' td.' + flagSupplierPurchaseOrder).length; let countSupplierOrderItems = row.querySelectorAll('td.' + flagOrderItems + ' td.' + flagSupplierPurchaseOrder).length;
let supplierOrderItem = { let supplierOrderItem = {
[attrIdSupplierPurchaseOrder]: idSupplierPurchaseOrder, [attrIdSupplierPurchaseOrder]: idSupplierPurchaseOrder,
@@ -502,7 +494,7 @@ export default class PageStoreSupplierPurchaseOrders extends TableBasePage {
[flagCostUnitLocalVatIncl]: '', [flagCostUnitLocalVatIncl]: '',
[flagLatencyDeliveryDays]: '', [flagLatencyDeliveryDays]: '',
[flagDisplayOrder]: countSupplierOrderItems + 1, [flagDisplayOrder]: countSupplierOrderItems + 1,
[flagActive]: !hasActiveOrderItem, [flagActive]: true, // !hasActiveOrderItem,
}; };
let tbody = row.querySelector('td.' + flagOrderItems + ' table tbody'); let tbody = row.querySelector('td.' + flagOrderItems + ' table tbody');
this.addRowSupplierPurchaseOrderItem(tbody, supplierOrderItem); this.addRowSupplierPurchaseOrderItem(tbody, supplierOrderItem);

View File

@@ -132,7 +132,7 @@ export default class PageStoreSuppliers extends TableBasePage {
}); });
} }
handleClickAddressPreview(event, element) { handleClickAddressPreview(event, element) {
console.log("click address preview"); if (_verbose) { console.log("click address preview"); }
this.toggleColumnHeaderCollapsed(flagAddress, false); this.toggleColumnHeaderCollapsed(flagAddress, false);
element.classList.remove(flagCollapsed); element.classList.remove(flagCollapsed);
let row = DOM.getRowFromElement(element); let row = DOM.getRowFromElement(element);
@@ -192,11 +192,11 @@ export default class PageStoreSuppliers extends TableBasePage {
let cellNew = cell.cloneNode(false); let cellNew = cell.cloneNode(false);
cellNew.appendChild(tblAddresses); cellNew.appendChild(tblAddresses);
row.replaceChild(cellNew, cell); row.replaceChild(cellNew, cell);
console.log("tblAddresses: ", tblAddresses); if (_verbose) { console.log("tblAddresses: ", tblAddresses); }
this.hookupAddressFields(); this.hookupAddressFields();
} }
addRowSupplierAddress(tbody, supplierAddress, regionOptions) { addRowSupplierAddress(tbody, supplierAddress, regionOptions) {
console.log("addRowSupplierAddress: ", supplierAddress); if (_verbose) { console.log("addRowSupplierAddress: ", supplierAddress); }
let tdPostcode = document.createElement("td"); let tdPostcode = document.createElement("td");
tdPostcode.classList.add(flagPostcode); tdPostcode.classList.add(flagPostcode);
let textareaPostcode = document.createElement("textarea"); let textareaPostcode = document.createElement("textarea");
@@ -279,28 +279,25 @@ export default class PageStoreSuppliers extends TableBasePage {
tbody.appendChild(tr); tbody.appendChild(tr);
} }
hookupAddressPostcodeInputs() { hookupAddressPostcodeInputs() {
this.handleChangeElementAddressSubtableCells(idTableMain + ' td.' + flagAddress + ' textarea.' + flagPostcode); this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagAddress + ' textarea.' + flagPostcode);
}
handleChangeElementAddressSubtableCells(event, element) {
this.handleChangeNestedElementCellTable(event, element); // flagAddress);
} }
hookupAddressLine1Inputs() { hookupAddressLine1Inputs() {
this.handleChangeElementAddressSubtableCells(idTableMain + ' td.' + flagAddress + ' textarea.' + flagAddressLine1); this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagAddress + ' textarea.' + flagAddressLine1);
} }
hookupAddressLine2Inputs() { hookupAddressLine2Inputs() {
this.handleChangeElementAddressSubtableCells(idTableMain + ' td.' + flagAddress + ' textarea.' + flagAddressLine2); this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagAddress + ' textarea.' + flagAddressLine2);
} }
hookupAddressCityInputs() { hookupAddressCityInputs() {
this.handleChangeElementAddressSubtableCells(idTableMain + ' td.' + flagAddress + ' textarea.' + flagCity); this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagAddress + ' textarea.' + flagCity);
} }
hookupAddressCountyInputs() { hookupAddressCountyInputs() {
this.handleChangeElementAddressSubtableCells(idTableMain + ' td.' + flagAddress + ' textarea.' + flagCounty); this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagAddress + ' textarea.' + flagCounty);
} }
hookupAddressRegionDdls() { hookupAddressRegionDdls() {
this.handleChangeElementAddressSubtableCells(idTableMain + ' td.' + flagAddress + ' select.' + flagRegion); this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagAddress + ' select.' + flagRegion);
} }
hookupAddressActiveCheckboxes() { hookupAddressActiveCheckboxes() {
this.handleChangeElementAddressSubtableCells(idTableMain + ' td.' + flagAddress + ' input.' + flagActive, (event, element) => { this.hookupChangeHandlerTableCells(idTableMain + ' td.' + flagAddress + ' input.' + flagActive, (event, element) => {
let rowSupplierAddress = element.closest('tr'); let rowSupplierAddress = element.closest('tr');
let idAddress = rowSupplierAddress.getAttribute(attrIdSupplierAddress); let idAddress = rowSupplierAddress.getAttribute(attrIdSupplierAddress);
DOM.setElementAttributeValueCurrent(rowSupplierAddress, idAddress); DOM.setElementAttributeValueCurrent(rowSupplierAddress, idAddress);

View File

@@ -143,7 +143,7 @@ export default class Router {
return module; // [pageJson.name]; return module; // [pageJson.name];
} }
catch (error) { catch (error) {
console.log("this.pages: ", this.pages); if (_verbose) { console.log("this.pages: ", this.pages); };
console.error('Page not found:', hashPage); console.error('Page not found:', hashPage);
throw error; throw error;
} }
@@ -169,7 +169,6 @@ export default class Router {
// this.beforeLeave(); // this.beforeLeave();
/* /*
if (this.routes[hash]) { if (this.routes[hash]) {
console.log("navigating to hash: " + hash);
this.routes[hash](isPopState); this.routes[hash](isPopState);
} else { } else {
console.error(`Hash ${hash} not found`); console.error(`Hash ${hash} not found`);
@@ -323,7 +322,6 @@ export default class Router {
*/ */
static loadPageBodyFromResponse(response) { static loadPageBodyFromResponse(response) {
console.log(response.data);
DOM.loadPageBody(response.data); DOM.loadPageBody(response.data);
} }
} }

View File

@@ -27,11 +27,7 @@
<script src="{{ url_for('static', filename='js/store/home.js') }}"></script> <script src="{{ url_for('static', filename='js/store/home.js') }}"></script>
<script> <script>
var hashPageCurrent = "{{ model.HASH_PAGE_STORE_HOME }}"; {#
var hashPageCurrent = "{{ model.HASH_PAGE_STORE_HOME }}";
$(document).ready(function() { #}
console.log('Hooking up home page...');
hookupStorePageHome();
// hookupStore(); // in _shared_store.html
});
</script> </script>

View File

@@ -30,6 +30,13 @@
{{ product.form_delivery_option() }} {{ product.form_delivery_option() }}
</div> </div>
{% endif %} {% endif %}
<script>console.log('creating basket item for:');console.log('product id: {{ product.id_product }}');console.log('permutation id: {{ product.get_id_permutation() }}');console.log('quantity: {{ basket_item.quantity }}');</script> <script>
if (_verbose) {
console.log('creating basket item for:');
console.log('product id: {{ product.id_product }}');
console.log('permutation id: {{ product.get_id_permutation() }}');
console.log('quantity: {{ basket_item.quantity }}');
}
</script>
</form> </form>
</div> </div>

View File

@@ -1,6 +1,9 @@
{% if is_blank_row %} {% if is_blank_row %}
<tr class="{{ model.FLAG_ROW_NEW }} {{ model.FLAG_MANUFACTURING_PURCHASE_ORDER }}" {{ model.ATTR_ID_MANUFACTURING_PURCHASE_ORDER }}> <tr class="{{ model.FLAG_ROW_NEW }} {{ model.FLAG_MANUFACTURING_PURCHASE_ORDER }}" {{ model.ATTR_ID_MANUFACTURING_PURCHASE_ORDER }}>
<td class="{{ model.FLAG_ORDER_ITEMS }} {{ model.FLAG_COLLAPSED }}" {{ model.ATTR_VALUE_CURRENT }}="" {{ model.ATTR_VALUE_PREVIOUS }}="">
{% include 'components/store/_preview_order_items.html' %}
</td>
<td class="{{ model.FLAG_CURRENCY }}" {{ model.ATTR_VALUE_CURRENT }}="" {{ model.ATTR_VALUE_PREVIOUS }}=""> <td class="{{ model.FLAG_CURRENCY }}" {{ model.ATTR_VALUE_CURRENT }}="" {{ model.ATTR_VALUE_PREVIOUS }}="">
{% include 'components/store/_preview_DDL_currency.html' %} {% include 'components/store/_preview_DDL_currency.html' %}
</td> </td>
@@ -30,15 +33,20 @@
{{ model.ATTR_VALUE_CURRENT }}="" {{ model.ATTR_VALUE_PREVIOUS }}="" {{ model.ATTR_VALUE_CURRENT }}="" {{ model.ATTR_VALUE_PREVIOUS }}=""
></div> ></div>
</td> </td>
<td class="{{ model.FLAG_ORDER_ITEMS }} {{ model.FLAG_COLLAPSED }}" {{ model.ATTR_VALUE_CURRENT }}="" {{ model.ATTR_VALUE_PREVIOUS }}="">
{% include 'components/store/_preview_order_items.html' %}
</td>
<td class="{{ model.FLAG_ACTIVE }}"> <td class="{{ model.FLAG_ACTIVE }}">
<input class="{{ model.FLAG_ACTIVE }}" type="checkbox" checked {{ model.ATTR_VALUE_CURRENT }}="{{ model.FLAG_BOOL_TRUE }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ model.FLAG_BOOL_TRUE }}"> <input class="{{ model.FLAG_ACTIVE }}" type="checkbox" checked {{ model.ATTR_VALUE_CURRENT }}="{{ model.FLAG_BOOL_TRUE }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ model.FLAG_BOOL_TRUE }}">
</td> </td>
</tr> </tr>
{% else %} {% else %}
<tr class="{{ model.FLAG_MANUFACTURING_PURCHASE_ORDER }}" {{ model.ATTR_ID_MANUFACTURING_PURCHASE_ORDER }}="{{ order.id_order }}"> <tr class="{{ model.FLAG_MANUFACTURING_PURCHASE_ORDER }}" {{ model.ATTR_ID_MANUFACTURING_PURCHASE_ORDER }}="{{ order.id_order }}">
{% set order_items = order.items %}
{% set json_str_items = model.jsonify(model.convert_list_objects_to_list_options(order_items)) %}
<td class="{{ model.FLAG_ORDER_ITEMS }} {{ model.FLAG_COLLAPSED }}" {{ model.ATTR_VALUE_CURRENT }}="{{ json_str_items }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ json_str_items }}">
{#
{% include 'components/store/_preview_manufacturing_purchase_order_items.html' %}
#}
{% include 'components/store/_preview_order_items.html' %}
</td>
{% set currency = order.currency %} {% set currency = order.currency %}
<td class="{{ model.FLAG_CURRENCY }}" {{ model.ATTR_VALUE_CURRENT }}="{{ currency.id_currency }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ currency.id_currency }}"> <td class="{{ model.FLAG_CURRENCY }}" {{ model.ATTR_VALUE_CURRENT }}="{{ currency.id_currency }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ currency.id_currency }}">
{% include 'components/store/_preview_DDL_currency.html' %} {% include 'components/store/_preview_DDL_currency.html' %}
@@ -71,14 +79,6 @@
{{ model.ATTR_VALUE_PREVIOUS }}="{{ order.price_total_local_VAT_incl }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ order.price_total_local_VAT_incl }}"
></div> ></div>
</td> </td>
{% set order_items = order.items %}
{% set json_str_items = model.jsonify(model.convert_list_objects_to_list_options(order_items)) %}
<td class="{{ model.FLAG_ORDER_ITEMS }} {{ model.FLAG_COLLAPSED }}" {{ model.ATTR_VALUE_CURRENT }}="{{ json_str_items }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ json_str_items }}">
{#
{% include 'components/store/_preview_manufacturing_purchase_order_items.html' %}
#}
{% include 'components/store/_preview_order_items.html' %}
</td>
<td class="{{ model.FLAG_ACTIVE }}"> <td class="{{ model.FLAG_ACTIVE }}">
<input class="{{ model.FLAG_ACTIVE }}" type="checkbox" {% if order.active %}checked{% endif %} {{ model.ATTR_VALUE_CURRENT }}="{{ order.active | lower }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ order.active | lower }}"> <input class="{{ model.FLAG_ACTIVE }}" type="checkbox" {% if order.active %}checked{% endif %} {{ model.ATTR_VALUE_CURRENT }}="{{ order.active | lower }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ order.active | lower }}">
</td> </td>

View File

@@ -17,7 +17,10 @@
<td class="{{ model.FLAG_HAS_VARIATIONS }}"> <td class="{{ model.FLAG_HAS_VARIATIONS }}">
<input class="{{ model.FLAG_HAS_VARIATIONS }}" type="checkbox" {{ model.ATTR_VALUE_CURRENT }}="{{ model.FLAG_BOOL_FALSE }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ model.FLAG_BOOL_FALSE }}"> <input class="{{ model.FLAG_HAS_VARIATIONS }}" type="checkbox" {{ model.ATTR_VALUE_CURRENT }}="{{ model.FLAG_BOOL_FALSE }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ model.FLAG_BOOL_FALSE }}">
</td> </td>
<td class="{{ model.FLAG_ACCESS_LEVEL }}" {{ model.ATTR_ID_ACCESS_LEVEL }}="1" {{ model.FLAG_ACCESS_LEVEL_REQUIRED }}="View"> <td class="{{ model.FLAG_ACCESS_LEVEL }}"
{{ model.ATTR_ID_ACCESS_LEVEL }}="1" {{ model.FLAG_ACCESS_LEVEL_REQUIRED }}="View"
{{ model.ATTR_VALUE_CURRENT }}="1" {{ model.ATTR_VALUE_PREVIOUS }}="1"
>
<div class="{{ model.FLAG_ACCESS_LEVEL}}" {{ model.ATTR_ID_ACCESS_LEVEL }}="1">View</div> <div class="{{ model.FLAG_ACCESS_LEVEL}}" {{ model.ATTR_ID_ACCESS_LEVEL }}="1">View</div>
</td> </td>
<td class="{{ model.FLAG_ACTIVE }}"> <td class="{{ model.FLAG_ACTIVE }}">
@@ -46,7 +49,10 @@
<input class="{{ model.FLAG_HAS_VARIATIONS }}" type="checkbox" {% if product.has_variations %}checked{% endif %} <input class="{{ model.FLAG_HAS_VARIATIONS }}" type="checkbox" {% if product.has_variations %}checked{% endif %}
{{ model.ATTR_VALUE_CURRENT }}="{{ product.has_variations | lower }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ product.has_variations | lower }}"> {{ model.ATTR_VALUE_CURRENT }}="{{ product.has_variations | lower }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ product.has_variations | lower }}">
</td> </td>
<td class="{{ model.FLAG_ACCESS_LEVEL }}" {{ model.ATTR_ID_ACCESS_LEVEL }}="1" {{ model.FLAG_ACCESS_LEVEL_REQUIRED }}="{{ product.name_access_level_required }}"> <td class="{{ model.FLAG_ACCESS_LEVEL }}"
{{ model.ATTR_ID_ACCESS_LEVEL }}="{{ product.id_access_level_required }}" {{ model.FLAG_ACCESS_LEVEL_REQUIRED }}="{{ product.name_access_level_required }}"
{{ model.ATTR_VALUE_CURRENT }}="{{ product.id_access_level_required }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ product.id_access_level_required }}"
>
<div class="{{ model.FLAG_ACCESS_LEVEL}}" {{ model.ATTR_ID_ACCESS_LEVEL }}="{{ product.id_access_level_required }}" {{ model.ATTR_VALUE_CURRENT }}="{{ product.id_access_level_required }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ product.id_access_level_required }}">{{ product.name_access_level_required }}</div> <div class="{{ model.FLAG_ACCESS_LEVEL}}" {{ model.ATTR_ID_ACCESS_LEVEL }}="{{ product.id_access_level_required }}" {{ model.ATTR_VALUE_CURRENT }}="{{ product.id_access_level_required }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ product.id_access_level_required }}">{{ product.name_access_level_required }}</div>
</td> </td>
<td class="{{ model.FLAG_ACTIVE }}"> <td class="{{ model.FLAG_ACTIVE }}">

View File

@@ -52,9 +52,18 @@
<td class="{{ model.FLAG_UNIT_MEASUREMENT_INTERVAL_EXPIRATION_UNSEALED }}" {{ model.ATTR_VALUE_CURRENT }} {{ model.ATTR_VALUE_PREVIOUS }}> <td class="{{ model.FLAG_UNIT_MEASUREMENT_INTERVAL_EXPIRATION_UNSEALED }}" {{ model.ATTR_VALUE_CURRENT }} {{ model.ATTR_VALUE_PREVIOUS }}>
{% include 'components/store/_preview_DDL_product_permutation_interval_expiration_unsealed.html' %} {% include 'components/store/_preview_DDL_product_permutation_interval_expiration_unsealed.html' %}
</td> </td>
<td class="{{ model.FLAG_COST_LOCAL }}"> <td class="{{ model.FLAG_COST_UNIT_LOCAL_VAT_EXCL }}">
<!--
<input class="{{ model.FLAG_COST_LOCAL }}" type="number" min="0" step="0.01" <input class="{{ model.FLAG_COST_LOCAL }}" type="number" min="0" step="0.01"
value="0" {{ model.ATTR_VALUE_CURRENT }}="0" {{ model.ATTR_VALUE_PREVIOUS }}> -->
<div {{ model.ATTR_VALUE_CURRENT }}="0" {{ model.ATTR_VALUE_PREVIOUS }}>
0
</div>
</td>
<td class="{{ model.FLAG_COST_UNIT_LOCAL_VAT_INCL }}">
<div {{ model.ATTR_VALUE_CURRENT }}="0" {{ model.ATTR_VALUE_PREVIOUS }}>
0
</div>
</td> </td>
<td class="{{ model.FLAG_CURRENCY_COST }}" {{ model.ATTR_VALUE_CURRENT }} {{ model.ATTR_VALUE_PREVIOUS }}> <td class="{{ model.FLAG_CURRENCY_COST }}" {{ model.ATTR_VALUE_CURRENT }} {{ model.ATTR_VALUE_PREVIOUS }}>
{% include 'components/store/_preview_DDL_currency.html' %} {% include 'components/store/_preview_DDL_currency.html' %}
@@ -140,8 +149,11 @@
<td class="{{ model.FLAG_UNIT_MEASUREMENT_INTERVAL_EXPIRATION_UNSEALED }}" {{ model.ATTR_VALUE_CURRENT }}="{{ value }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ value }}"> <td class="{{ model.FLAG_UNIT_MEASUREMENT_INTERVAL_EXPIRATION_UNSEALED }}" {{ model.ATTR_VALUE_CURRENT }}="{{ value }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ value }}">
{% include 'components/store/_preview_DDL_product_permutation_interval_expiration_unsealed.html' %} {% include 'components/store/_preview_DDL_product_permutation_interval_expiration_unsealed.html' %}
</td> </td>
<td class="{{ model.FLAG_COST_LOCAL }}"> <td class="{{ model.FLAG_COST_UNIT_LOCAL_VAT_EXCL }}">
<input class="{{ model.FLAG_COST_LOCAL }}" type="number" min="0" value="{{ permutation.cost_local }}" {{ model.ATTR_VALUE_CURRENT }}="{{ permutation.cost_local }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ permutation.cost_local }}"> <input class="{{ model.FLAG_COST_UNIT_LOCAL_VAT_EXCL }}" type="number" min="0" value="{{ permutation.cost_local_VAT_excl }}" {{ model.ATTR_VALUE_CURRENT }}="{{ permutation.cost_local_VAT_excl }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ permutation.cost_local_VAT_excl }}">
</td>
<td class="{{ model.FLAG_COST_UNIT_LOCAL_VAT_INCL }}">
<input class="{{ model.FLAG_COST_UNIT_LOCAL_VAT_INCL }}" type="number" min="0" value="{{ permutation.cost_local_VAT_incl }}" {{ model.ATTR_VALUE_CURRENT }}="{{ permutation.cost_local_VAT_incl }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ permutation.cost_local_VAT_incl }}">
</td> </td>
{% set currency = permutation.currency_cost %} {% set currency = permutation.currency_cost %}

View File

@@ -4,6 +4,9 @@
<td class="{{ model.FLAG_SUPPLIER }}" {{ model.ATTR_VALUE_CURRENT }}="" {{ model.ATTR_VALUE_PREVIOUS }}=""> <td class="{{ model.FLAG_SUPPLIER }}" {{ model.ATTR_VALUE_CURRENT }}="" {{ model.ATTR_VALUE_PREVIOUS }}="">
{% include 'components/store/_preview_DDL_supplier.html' %} {% include 'components/store/_preview_DDL_supplier.html' %}
</td> </td>
<td class="{{ model.FLAG_ORDER_ITEMS }} {{ model.FLAG_COLLAPSED }}" {{ model.ATTR_VALUE_CURRENT }}="" {{ model.ATTR_VALUE_PREVIOUS }}="">
{% include 'components/store/_preview_order_items.html' %}
</td>
<td class="{{ model.FLAG_CURRENCY }}" {{ model.ATTR_VALUE_CURRENT }}="" {{ model.ATTR_VALUE_PREVIOUS }}=""> <td class="{{ model.FLAG_CURRENCY }}" {{ model.ATTR_VALUE_CURRENT }}="" {{ model.ATTR_VALUE_PREVIOUS }}="">
{% include 'components/store/_preview_DDL_currency.html' %} {% include 'components/store/_preview_DDL_currency.html' %}
</td> </td>
@@ -19,9 +22,6 @@
{{ model.ATTR_VALUE_CURRENT }}="" {{ model.ATTR_VALUE_PREVIOUS }}="" {{ model.ATTR_VALUE_CURRENT }}="" {{ model.ATTR_VALUE_PREVIOUS }}=""
></div> ></div>
</td> </td>
<td class="{{ model.FLAG_ORDER_ITEMS }} {{ model.FLAG_COLLAPSED }}" {{ model.ATTR_VALUE_CURRENT }}="" {{ model.ATTR_VALUE_PREVIOUS }}="">
{% include 'components/store/_preview_order_items.html' %}
</td>
<td class="{{ model.FLAG_ACTIVE }}"> <td class="{{ model.FLAG_ACTIVE }}">
<input class="{{ model.FLAG_ACTIVE }}" type="checkbox" checked {{ model.ATTR_VALUE_CURRENT }}="{{ model.FLAG_BOOL_TRUE }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ model.FLAG_BOOL_TRUE }}"> <input class="{{ model.FLAG_ACTIVE }}" type="checkbox" checked {{ model.ATTR_VALUE_CURRENT }}="{{ model.FLAG_BOOL_TRUE }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ model.FLAG_BOOL_TRUE }}">
</td> </td>
@@ -32,6 +32,11 @@
<td class="{{ model.FLAG_SUPPLIER }}" {{ model.ATTR_VALUE_CURRENT }}="{{ supplier.id_supplier }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ supplier.id_supplier }}"> <td class="{{ model.FLAG_SUPPLIER }}" {{ model.ATTR_VALUE_CURRENT }}="{{ supplier.id_supplier }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ supplier.id_supplier }}">
{% include 'components/store/_preview_DDL_supplier.html' %} {% include 'components/store/_preview_DDL_supplier.html' %}
</td> </td>
{% set order_items = order.items %}
{% set json_str_items = model.jsonify(model.convert_list_objects_to_list_options(order_items)) %}
<td class="{{ model.FLAG_ORDER_ITEMS }} {{ model.FLAG_COLLAPSED }}" {{ model.ATTR_VALUE_CURRENT }}="{{ json_str_items }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ json_str_items }}">
{% include 'components/store/_preview_order_items.html' %}
</td>
{% set currency = order.currency %} {% set currency = order.currency %}
<td class="{{ model.FLAG_CURRENCY }}" {{ model.ATTR_VALUE_CURRENT }}="{{ currency.id_currency }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ currency.id_currency }}"> <td class="{{ model.FLAG_CURRENCY }}" {{ model.ATTR_VALUE_CURRENT }}="{{ currency.id_currency }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ currency.id_currency }}">
{% include 'components/store/_preview_DDL_currency.html' %} {% include 'components/store/_preview_DDL_currency.html' %}
@@ -56,11 +61,6 @@
{{ model.ATTR_VALUE_PREVIOUS }}="{{ order.cost_total_local_VAT_incl }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ order.cost_total_local_VAT_incl }}"
></div> ></div>
</td> </td>
{% set order_items = order.items %}
{% set json_str_items = model.jsonify(model.convert_list_objects_to_list_options(order_items)) %}
<td class="{{ model.FLAG_ORDER_ITEMS }} {{ model.FLAG_COLLAPSED }}" {{ model.ATTR_VALUE_CURRENT }}="{{ json_str_items }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ json_str_items }}">
{% include 'components/store/_preview_order_items.html' %}
</td>
<td class="{{ model.FLAG_ACTIVE }}"> <td class="{{ model.FLAG_ACTIVE }}">
<input class="{{ model.FLAG_ACTIVE }}" type="checkbox" checked {{ model.ATTR_VALUE_CURRENT }}="{{ order.active | lower }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ order.active | lower }}"> <input class="{{ model.FLAG_ACTIVE }}" type="checkbox" checked {{ model.ATTR_VALUE_CURRENT }}="{{ order.active | lower }}" {{ model.ATTR_VALUE_PREVIOUS }}="{{ order.active | lower }}">
</td> </td>

View File

@@ -235,13 +235,17 @@
var _pathHost = "{{ model.get_url_host() }}"; var _pathHost = "{{ model.get_url_host() }}";
var _rowBlank = null; var _rowBlank = null;
var titlePageCurrent = "{{ model.title }}"; var titlePageCurrent = "{{ model.title }}";
var _verbose = ("{{ model.app.app_config.DEBUG }}" == "True");
</script> </script>
<!-- Stylesheets <!-- Stylesheets
<link href="{{ url_for('static', filename='css/main.css') }}" rel="stylesheet" type="text/css"/> <link href="{{ url_for('static', filename='css/main.css') }}" rel="stylesheet" type="text/css"/>
<link rel="stylesheet" loading="eager" href="{{ url_for('static', filename='dist/css/main.bundle.css') }}">
--> -->
<link rel="stylesheet" href="{{ url_for('static', filename='dist/css/main.bundle.css') }}"> <link rel="preload" as="style" href="{{ url_for('static', filename='dist/css/main.bundle.css') }}" onload="this.onload=null;this.rel='stylesheet'">
<noscript><link rel="stylesheet" href="{{ url_for('static', filename='dist/css/main.bundle.css') }}"></noscript>
{% block page_head %}{% endblock %}
</head> </head>
<body data-page="{{ model.hash_page_current }}"> <body data-page="{{ model.hash_page_current }}">
<div class="topnav"> <div class="topnav">

View File

@@ -1,14 +1,12 @@
{% extends 'layouts/layout.html' %} {% extends 'layouts/layout.html' %}
{% block title %}{{ model.title }}{% endblock %} {% block page_head %}
<link rel="preload" as="style" href="{{ url_for('static', filename='dist/css/store_basket.bundle.css') }}" onload="this.onload=null;this.rel='stylesheet'">
<noscript><link rel="stylesheet" href="{{ url_for('static', filename='dist/css/store_basket.bundle.css') }}"></noscript>
{% endblock %}
{% block page_body %} {% block page_body %}
<!-- Include Stylesheets
<link rel="stylesheet" href="{{ url_for('static', filename='css/sections/store.css') }}">
<link rel="stylesheet" href="{{ url_for('static', filename='css/store/basket.css') }}">
-->
<link rel="stylesheet" href="{{ url_for('static', filename='dist/css/store_basket.bundle.css') }}">
<!-- HTML content --> <!-- HTML content -->
<div class="{{ model.FLAG_CARD }}"> <div class="{{ model.FLAG_CARD }}">
<div class="{{ model.FLAG_CONTAINER }} {{ model.FLAG_COLUMN }}"> <div class="{{ model.FLAG_CONTAINER }} {{ model.FLAG_COLUMN }}">

View File

@@ -1,6 +1,10 @@
{% extends 'layouts/layout.html' %} {% extends 'layouts/layout.html' %}
{% block title %}{{ model.title }}{% endblock %} {% block page_head %}
<link rel="preload" as="style" href="{{ url_for('static', filename='dist/css/store_home.bundle.css') }}" onload="this.onload=null;this.rel='stylesheet'">
<noscript><link rel="stylesheet" href="{{ url_for('static', filename='dist/css/store_home.bundle.css') }}"></noscript>
{% endblock %}
{% block page_body %} {% block page_body %}
{% include 'components/store/_home_body.html' %} {% include 'components/store/_home_body.html' %}

View File

@@ -1,8 +1,11 @@
{% extends 'layouts/layout.html' %} {% extends 'layouts/layout.html' %}
{% block page_head %}
<link rel="preload" as="style" href="{{ url_for('static', filename='dist/css/store_manufacturing_purchase_orders.bundle.css') }}" onload="this.onload=null;this.rel='stylesheet'">
<noscript><link rel="stylesheet" href="{{ url_for('static', filename='dist/css/store_manufacturing_purchase_orders.bundle.css') }}"></noscript>
{% endblock %}
{% block page_body %} {% block page_body %}
<link rel="stylesheet" href="{{ url_for('static', filename='dist/css/store_manufacturing_purchase_orders.bundle.css') }}">
<form id="{{ model.ID_FORM_FILTERS }}" class="{{ model.FLAG_FILTER }} {{ model.FLAG_ROW }} {{ model.FLAG_CARD }}" action="{{ url_for('routes_store_manufacturing_purchase_order.filter_manufacturing_purchase_order') }}" method="POST"> <!-- {{ model.FLAG_CONTAINER }} --> <form id="{{ model.ID_FORM_FILTERS }}" class="{{ model.FLAG_FILTER }} {{ model.FLAG_ROW }} {{ model.FLAG_CARD }}" action="{{ url_for('routes_store_manufacturing_purchase_order.filter_manufacturing_purchase_order') }}" method="POST"> <!-- {{ model.FLAG_CONTAINER }} -->
{{ model.form_filters.hidden_tag() }} {{ model.form_filters.hidden_tag() }}
<div class="{{ model.FLAG_CONTAINER }} {{ model.FLAG_COLUMN }}"> <div class="{{ model.FLAG_CONTAINER }} {{ model.FLAG_COLUMN }}">
@@ -41,12 +44,12 @@
<table id="{{ model.ID_TABLE_MAIN }}" class="{{ model.FLAG_ROW }} {{ model.FLAG_CARD }}"> <table id="{{ model.ID_TABLE_MAIN }}" class="{{ model.FLAG_ROW }} {{ model.FLAG_CARD }}">
<thead> <thead>
<tr class="{{ model.FLAG_MANUFACTURING_PURCHASE_ORDER }}"> <tr class="{{ model.FLAG_MANUFACTURING_PURCHASE_ORDER }}">
<th class="{{ model.FLAG_ORDER_ITEMS }} {{ model.FLAG_COLLAPSED }}">Items</th>
<th class="{{ model.FLAG_CURRENCY }}">Currency</th> <th class="{{ model.FLAG_CURRENCY }}">Currency</th>
<th class="{{ model.FLAG_COST_TOTAL_LOCAL_VAT_EXCL }}">Cost Total VAT Excl.</th> <th class="{{ model.FLAG_COST_TOTAL_LOCAL_VAT_EXCL }}">Cost Total VAT Excl.</th>
<th class="{{ model.FLAG_COST_TOTAL_LOCAL_VAT_INCL }}">Cost Total VAT Incl.</th> <th class="{{ model.FLAG_COST_TOTAL_LOCAL_VAT_INCL }}">Cost Total VAT Incl.</th>
<th class="{{ model.FLAG_PRICE_TOTAL_LOCAL_VAT_EXCL }}">Price Total VAT Excl.</th> <th class="{{ model.FLAG_PRICE_TOTAL_LOCAL_VAT_EXCL }}">Price Total VAT Excl.</th>
<th class="{{ model.FLAG_PRICE_TOTAL_LOCAL_VAT_INCL }}">Price Total VAT Incl.</th> <th class="{{ model.FLAG_PRICE_TOTAL_LOCAL_VAT_INCL }}">Price Total VAT Incl.</th>
<th class="{{ model.FLAG_ORDER_ITEMS }} {{ model.FLAG_COLLAPSED }}">Items</th>
<th class="{{ model.FLAG_ACTIVE}}">Active</th> <th class="{{ model.FLAG_ACTIVE}}">Active</th>
</tr> </tr>
</thead> </thead>

View File

@@ -112,7 +112,8 @@
<th class="{{ model.FLAG_DOES_EXPIRE_FASTER_ONCE_UNSEALED }}">Expires Faster Once Unsealed?</th> <th class="{{ model.FLAG_DOES_EXPIRE_FASTER_ONCE_UNSEALED }}">Expires Faster Once Unsealed?</th>
<th class="{{ model.FLAG_COUNT_UNIT_MEASUREMENT_INTERVAL_EXPIRATION_UNSEALED }}">Count Interval Expiration Unsealed</th> <th class="{{ model.FLAG_COUNT_UNIT_MEASUREMENT_INTERVAL_EXPIRATION_UNSEALED }}">Count Interval Expiration Unsealed</th>
<th class="{{ model.FLAG_UNIT_MEASUREMENT_INTERVAL_EXPIRATION_UNSEALED }}">Interval Expiration Unsealed</th> <th class="{{ model.FLAG_UNIT_MEASUREMENT_INTERVAL_EXPIRATION_UNSEALED }}">Interval Expiration Unsealed</th>
<th class="{{ model.FLAG_COST_LOCAL }}">Cost</th> <th class="{{ model.FLAG_COST_LOCAL_VAT_EXCL }}">Cost Local VAT Excl.</th>
<th class="{{ model.FLAG_COST_LOCAL_VAT_INCL }}">Cost Local VAT Incl.</th>
<th class="{{ model.FLAG_CURRENCY_COST }}">Cost Currency</th> <th class="{{ model.FLAG_CURRENCY_COST }}">Cost Currency</th>
<th class="{{ model.FLAG_PROFIT_LOCAL_MIN }}">Profit Local Min</th> <th class="{{ model.FLAG_PROFIT_LOCAL_MIN }}">Profit Local Min</th>
<th class="{{ model.FLAG_LATENCY_MANUFACTURE }}">Manufacturing Latency</th> <th class="{{ model.FLAG_LATENCY_MANUFACTURE }}">Manufacturing Latency</th>

View File

@@ -42,10 +42,10 @@
<thead> <thead>
<tr class="{{ model.FLAG_SUPPLIER_PURCHASE_ORDER }}"> <tr class="{{ model.FLAG_SUPPLIER_PURCHASE_ORDER }}">
<th class="{{ model.FLAG_SUPPLIER }}">Supplier</th> <th class="{{ model.FLAG_SUPPLIER }}">Supplier</th>
<th class="{{ model.FLAG_ORDER_ITEMS }} {{ model.FLAG_COLLAPSED }}">Items</th>
<th class="{{ model.FLAG_CURRENCY }}">Currency</th> <th class="{{ model.FLAG_CURRENCY }}">Currency</th>
<th class="{{ model.FLAG_COST_TOTAL_LOCAL_VAT_EXCL }}">Cost Total VAT Excl.</th> <th class="{{ model.FLAG_COST_TOTAL_LOCAL_VAT_EXCL }}">Cost Total VAT Excl.</th>
<th class="{{ model.FLAG_COST_TOTAL_LOCAL_VAT_INCL }}">Cost Total VAT Incl.</th> <th class="{{ model.FLAG_COST_TOTAL_LOCAL_VAT_INCL }}">Cost Total VAT Incl.</th>
<th class="{{ model.FLAG_ORDER_ITEMS }} {{ model.FLAG_COLLAPSED }}">Items</th>
<th class="{{ model.FLAG_ACTIVE}}">Active</th> <th class="{{ model.FLAG_ACTIVE}}">Active</th>
</tr> </tr>
</thead> </thead>