打印:单次消费,选中单选按钮,点击打印小票。
页面一加载,调一个prepareprint();方法,然后判断状态是2的是已付款的,状态是2的才能打印。擦拭的时候吧状态一览添加出来。script.js里边写上状态,html里边字儿#状态#。
function prepareprint(){
$("#print_btn").on("click",function(){
var target_id="";
var chkObjs = document.getElementsByName("resultlist");
for(var i=0;i<chkObjs.length;i++)
{
if(chkObjs[i].checked)
{
target_id = chkObjs[i].value;
//alert(target_id);
break;
}
}
if(target_id!=""){
var status=$("input[type=‘radio‘][name=resultlist]:checked").attr("code");
//alert(status);
if(status=="2"){
var url = "${def:context}/action/project/erpClub/print/ticket/singleticket?pk_value="+target_id+"&print_type=ticket";
ajaxCall(url,{
method : "get",
progress : true,
dataType : "script",
success : function() {
}
});
}else{
ccms.dialog.notice("请先付款!");
}
}else{
ccms.dialog.notice("请选择记录后再操作!");
}
});
}
SQL:select
(SELECT tenantry_name FROM t_tenantry WHERE tenantry_id = ${def:tenantry}) as vc_head,
(SELECT vc_content FROM e_cnfg WHERE vc_category = ‘Wish‘) as vc_foot,
e_singleitem.vc_code as bills_code,
e_singleitemdef.vc_name,--货号名称
e_singleitem.f_price,--单价
e_singleitem.f_amount,--数量
e_singleitem.f_money,--金额
(select string_agg((e_singleitemdef.vc_name || ‘\n‘ || e_singleitem.vc_itemcode || ‘ ‘ || e_singleitem.f_price || ‘*‘||e_singleitem.f_amount||‘ ‘||e_singleitem.f_money),‘\n‘) from e_singleitemdef where vc_code =e_singleitem.vc_itemcode) as gouwu_xiaopiao,
(select count(1) from e_singleitemdef where vc_code =e_singleitem.vc_itemcode) as gouwu_jianshu,
(case e_singleitem.i_paytype when 1 then ‘现金/银行卡支付‘ when 2 then ‘储蓄卡支付‘ else ‘‘ end) as i_paytype,
e_singleitem.f_cash,
e_singleitem.f_card,
e_singleitem.f_check,
e_singleitem.f_other,
e_singleitem.vc_cardcode,
hr_staff.name as vc_ouser,
e_singleitem.f_getmoney,
---e_singleitem.vc_cardcode,
--hr_staff.name as vc_ouser,
----e_singleitem.vc_iuser,
e_singleitem.vc_auser,----收款人
e_singleitem.c_adate,----收款时间
e_singleitem.vc_iuser,
e_singleitem.vc_itemcode--货号编号
from e_singleitem
left join e_singleitemdef on e_singleitemdef.vc_code=e_singleitem.vc_itemcode
left join hr_staff on hr_staff.userlogin=e_singleitem.vc_ouser
--left join e_finance on e_finance.vc_operationcode=e_singleitem.vc_code
where e_singleitem.vc_code=${fld:pk_value} and e_singleitem.i_status= 2