作者 |
|
RobinChase [个人空间]
注册  2012-09-06 发贴数 27 精华数 0 原创贴 0 来自 状态 正常
级别 会员 |
|
|
对零售型的公司,经常遇到针对单项商品的促销、残次品促销,但进销存软件未设置此选项。因此设想通过设置商品的扩展属性,结合相关单据的脚本,来实现这一功能。 商品的扩展属性设置请见附图。 脚本如下: int init_row() { if(res_ext_1<100)return 1; discount_price = inp_price*res_ext_1*discount/10000; discount_price = num_dec_cut(discount_price,2); skip_event_col("discount_price"); discount_amount = discount_price*inp_num; discount_amount = num_dec_cut(discount_amount,2); skip_event_col("discount_amount"); total_amount = discount_amount; total_amount = num_dec_cut(total_amount,2); skip_event_col("total_amount"); return 1; }; int cell_change() { if(res_ext_1<100)return 1; discount_price = inp_price*res_ext_1*discount/10000; discount_price = num_dec_cut(discount_price,2); skip_event_col("discount_price"); discount_amount = discount_price*inp_num; discount_amount = num_dec_cut(discount_amount,2); skip_event_col("discount_amount"); total_amount = discount_amount; total_amount = num_dec_cut(total_amount,2); skip_event_col("total_amount"); return 1; }; 由于不知道系统的内部流程逻辑,不知如此设置是否会引起其他的问题,或者是否还有更好的方法,请各位多指教。 |
|
|
于 2016-07-02 01:05 被 RobinChase 修改
|
|
RobinChase [个人空间]
注册  2012-09-06 发贴数 27 精华数 0 原创贴 0 来自 状态 正常
级别 会员 |
|
|
原脚本有点问题,刚已经修改了一下,但发现折扣设置成10(一折)时有问题,又不知道怎么解释。 谁能帮一下忙? |
|
|
于 2016-07-02 01:20 被 RobinChase 修改
|
|
RobinChase [个人空间]
注册  2012-09-06 发贴数 27 精华数 0 原创贴 0 来自 状态 正常
级别 会员 |
|
|
原脚本有点错误,又修改了一下。 int init_row() { float f_res_ext_1; f_res_ext_1=res_ext_1 if(f_res_ext_1<100 && f_res_ext_1>0) { discount_price = inp_price*res_ext_1*discount/10000; discount_price = num_dec_cut(discount_price,2); skip_event_col("discount_price"); discount_amount = discount_price*inp_num; discount_amount = num_dec_cut(discount_amount,2); skip_event_col("discount_amount"); total_amount = discount_amount; total_amount = num_dec_cut(total_amount,2); skip_event_col("total_amount"); return 1; } else { return 1; } }; int cell_change() { float f_res_ext_1; f_res_ext_1=res_ext_1 if(f_res_ext_1<100 && f_res_ext_1>0) { discount_price = inp_price*res_ext_1*discount/10000; discount_price = num_dec_cut(discount_price,2); skip_event_col("discount_price"); discount_amount = discount_price*inp_num; discount_amount = num_dec_cut(discount_amount,2); skip_event_col("discount_amount"); total_amount = discount_amount; total_amount = num_dec_cut(total_amount,2); skip_event_col("total_amount"); return 1; } else { return 1; } }; |
|
|
|
|
|