MICROS  |  20.04.2026

MC_sales_price_per_store ve mcexport viewlarının oluşturulması gerekir. Mcexport view'ın oluşturulabilmesi için mi_ver_def tablosunda custom kullanıcısına hak verilmesi gerekmektedir. Bu hak verildikten
sonra mcexport view oluşturulabilir.
MC_sales_price_per_store;
create VIEW 'custom'.'MC_sales_price_per_store'
  as select rest_pricing_def.store_id*1000+rvc_def.obj_num as store_id,
    rest_def.rest_name as store_name,
    mi_def.mi_seq,
    mi_def.obj_num as mi_obj,
    mi_def.name_1 as mi_name_1,
    mi_def.name_2 as mi_name_2,
    mi_def.maj_grp_seq as maj_seq,
    maj_grp_def.obj_num as maj_obj,
    maj_grp_def.name as maj_name,
    mi_def.fam_grp_seq as fam_seq,
    fam_grp_def.obj_num as fam_obj,
    fam_grp_def.name as fam_name,
    mi_def.mi_grp_seq as mi_grp_seq,
    mi_grp_def.obj_num as mi_grp_obj,
    mi_grp_def.name as mi_grp_name,
    mi_price_def.preset_amt_1,
    mi_price_def.preset_amt_2,
    mi_price_def.preset_amt_3,
    mi_price_def.preset_amt_4,
    mi_price_def.preset_amt_5,
    mi_price_def.preset_amt_6,
    mi_price_def.preset_amt_7,
    mi_price_def.preset_amt_8,
    mi_price_def.preset_amt_9,
    mi_price_def.preset_amt_10,
    price_tier_def.price_tier_seq,
    price_tier_def.name as price_tier_def_name,
    mi_price_def.last_updated_by as mi_price_def_last_updated_by,
    mi_price_def.effective_from as mi_price_def_effective_from,
    mi_price_def.effective_to as mi_price_def_effective_to,
    rest_pricing_def.effective_from as rest_pricing_def_effective_from,
    rest_pricing_def.effective_to as rest_pricing_def_effective_to from
    micros.price_tier_def,
    micros.mi_def,
    micros.maj_grp_def,
    micros.fam_grp_def,
    micros.mi_grp_def,
    micros.rest_pricing_def,
    micros.mi_price_def,
    micros.rest_def,
    micros.rvc_def where
    mi_price_def.mi_seq = mi_def.mi_seq and
    rest_pricing_def.price_tier_seq = price_tier_def.price_tier_seq and
    price_tier_def.price_tier_seq = mi_price_def.price_tier_seq and
    price_tier_def.price_grp_seq = mi_price_def.price_grp_seq and
    price_tier_def.price_grp_seq = rest_pricing_def.price_grp_seq and
    mi_price_def.price_grp_seq = mi_def.price_grp_seq and
    rest_pricing_def.store_id = rest_def.store_id and
    mi_def.maj_grp_seq = maj_grp_def.maj_grp_seq and
    mi_def.fam_grp_seq = fam_grp_def.fam_grp_seq and
    mi_def.mi_grp_seq = mi_grp_def.mi_grp_seq and
    rest_pricing_def.effective_to is null
 
-----------------------------------------
Mcexport;
CREATE VIEW 'custom'.'mcexport'
  as select business_date,store_id as storeid,rvc_def.obj_num as rvcnum,(store_id*1000+rvc_def.obj_num) as expression,mi_def.obj_num,
    price_1_sls_cnt+price_2_sls_cnt+price_3_sls_cnt+price_4_sls_cnt+price_5_sls_cnt+
    price_6_sls_cnt+price_7_sls_cnt+price_8_sls_cnt+price_9_sls_cnt+price_10_sls_cnt+
    (price_1_rtn_cnt+price_2_rtn_cnt+price_3_rtn_cnt+price_4_rtn_cnt+price_5_rtn_cnt+
    price_6_rtn_cnt+price_7_rtn_cnt+price_8_rtn_cnt+price_9_rtn_cnt+price_10_rtn_cnt),
    (price_1_sls_ttl+price_2_sls_ttl+price_3_sls_ttl+price_4_sls_ttl+price_5_sls_ttl+price_6_sls_ttl+
    price_7_sls_ttl+price_8_sls_ttl+price_9_sls_ttl+price_10_sls_ttl)+
(price_1_dsc_ttl+price_2_dsc_ttl+price_3_dsc_ttl+price_4_dsc_ttl+price_5_dsc_ttl+price_6_dsc_ttl+
    price_7_dsc_ttl+price_8_dsc_ttl+price_9_dsc_ttl+price_10_dsc_ttl)
,
    1 as BIR,tr.percentage as KDV,0 as SIFIR from
    micros.dly_rvc_mi_ttl,micros.mi_def,micros.mi_ver_def mv,micros.rvc_def,micros.mi_type_class_def as mc,micros.tax_class_def as tc,
    micros.tax_rate_def as tr where
    dly_rvc_mi_ttl.mi_seq = mi_def.mi_seq and
    dly_rvc_mi_ttl.rvc_seq = rvc_def.rvc_seq and
    mc.tax_class_seq = tc.tax_class_seq and
    mv.mi_seq = micros.mi_def.mi_seq and
    mv.mi_type_seq = mc.mi_type_seq and
    ((tc.ob_tax_1_active = 'T' and tr.tax_rate_seq = 1) or
    (tc.ob_tax_2_active = 'T' and tr.tax_rate_seq = 2) or
    (tc.ob_tax_3_active = 'T' and tr.tax_rate_seq = 3) or
    (tc.ob_tax_4_active = 'T' and tr.tax_rate_seq = 4) or
    (tc.ob_tax_5_active = 'T' and tr.tax_rate_seq = 5) or
    (tc.ob_tax_6_active = 'T' and tr.tax_rate_seq = 6) or
    (tc.ob_tax_7_active = 'T' and tr.tax_rate_seq = 7) or
    (tc.ob_tax_8_active = 'T' and tr.tax_rate_seq = 8));