为实现打印模板配底色,如下图所似,代码放在了后面,只是为了实现这样式,所以脚本写得有点粗糙,有需要的朋友可以拿去看下,麻烦把完善后的脚本发往论坛供大家使用,谢谢! 谢谢吴老师倾力奉献! int before_draw_obj() { //---------根据产品类别将必需要底色的配色 if (to_draw_obj == 'res_name' || to_draw_obj == 'inp_unit_type_name' || to_draw_obj == 'inp_num' || to_draw_obj == 'inp_price' || to_draw_obj == 'cap_inp_price' || to_draw_obj == 'item_id' && res_cat_id == '102') pp_fill_color = 0x0000ff ; else if (to_draw_obj == 'res_name' || to_draw_obj == 'inp_unit_type_name' || to_draw_obj == 'inp_num' || to_draw_obj == 'inp_price' || to_draw_obj == 'cap_inp_price' || to_draw_obj == 'item_id' && res_cat_id == '103') pp_fill_color = 0xff0000 ; else if (to_draw_obj == 'res_name' || to_draw_obj == 'inp_unit_type_name' || to_draw_obj == 'inp_num' || to_draw_obj == 'inp_price' || to_draw_obj == 'cap_inp_price' || to_draw_obj == 'item_id' && res_cat_id == '10104') pp_fill_color = 0x0000ff ; else pp_fill_color = 0xffffff ; //---------将单价为0单元格配白色 if (to_draw_obj == 'inp_price' && inp_price == 0) pp_fill_color = 0xffffff ; //---------不同类别单元格不同值配色(以下是合计为0为白色,不为0为类别色) if (to_draw_obj == 'total_amount' && total_amount == 0 && res_cat_id == '102') pp_fill_color = 0xffffff ; if (to_draw_obj == 'total_amount' && total_amount != 0 && res_cat_id == '102') pp_fill_color = 0x0000ff ; if (to_draw_obj == 'total_amount' && total_amount == 0 && res_cat_id == '103') pp_fill_color = 0xffffff ; if (to_draw_obj == 'total_amount' && total_amount != 0 && res_cat_id == '103') pp_fill_color = 0xff0000 ; if (to_draw_obj == 'total_amount' && total_amount == 0 && res_cat_id == '10104') pp_fill_color = 0xffffff ; if (to_draw_obj == 'total_amount' && total_amount != 0 && res_cat_id == '10104') pp_fill_color = 0x0000ff ; return 1; }; |