- (function(){
- var yx = "";
- var date = getToday();
- date = format(date,"yyyy-MM-dd");
-
- var sql = "select a.domainid,item_项目名称,item_负责人,item_预算成本, (select sum(ITEM_金额) as item_金额 from tlk_临时费用登记 where ITEM_所属项目 = a.ITEM_项目名称) item_临时费用, (select sum(ITEM_成本) as item_金额 from tlk_工作日报 where ITEM_所属项目 = a.ITEM_项目名称) item_人工费用 from tlk_项目信息 a where item_项目状态<>'已完成' GROUP BY ITEM_项目名称";
- var process1 = getDocProcess('11e6-2d1c-908d1c9b-abde-35dbfa83876a');//application
- var datas = process1.queryBySQL(sql, '11e1-81e2-37f74759-9124-47aada6b7467');
- datas = datas.getDatas();
- //var datas = queryBySQL(sql);
- var html = "";
- var html="<table cellSpacing='0' cellPadding='1' width='100%' align='center' style='border:solid #cccccc;border-width:2px 0px 0px 2px;'>"
- +"<tbody><tr style='line-height:22px;'>"
- +"<td width=30%' style='font-size:larger;font-family: Arial;border:solid #cccccc;border-width:0px 2px 2px 0px;' >项目名称</td>"
- +"<td width='8%' style='font-size:larger;font-family: Arial;border:solid #cccccc;border-width:0px 2px 2px 0px;' >负责人</td>"
- +"<td width='8%' style='font-size:larger;font-family: Arial;border:solid #cccccc;border-width:0px 2px 2px 0px;' >预算成本</td>"
- +"<td width='8%' style='font-size:larger;font-family: Arial;border:solid #cccccc;border-width:0px 2px 2px 0px;' >人工费用</td>"
- +"<td width='8%' style='font-size:larger;font-family: Arial;border:solid #cccccc;border-width:0px 2px 2px 0px;' >临时费用</td>"
- +"<td width='8%' style='font-size:larger;font-family: Arial;border:solid #cccccc;border-width:0px 2px 2px 0px;' >合计</td>"
- +"<td width='8%' style='font-size:larger;font-family: Arial;border:solid #cccccc;border-width:0px 2px 2px 0px;' >剩余费用</td></tr>";
- if(datas != null){
- for(var iter = datas.iterator();iter.hasNext();){
-
- var doc = iter.next();
- var pname = doc.getItemValueAsString("项目名称");
- var fzr = doc.getItemValueAsString("负责人");
- var fzrname=getUserById(fzr).getName();
- var ys = doc.getItemValueAsDouble("预算成本");
- ys=round(ys,2);
- var rgfy = doc.getItemValueAsDouble("人工费用");
- rgfy=round(rgfy,2);
- var lsfy = doc.getItemValueAsDouble("临时费用");
- lsfy=round(lsfy,2);
- var hj = rgfy+lsfy;
- hj=round(hj,2);
- var syfy = ys-hj;
- syfy=round(syfy,2);
-
-
- html += "<tr style='line-height:22px;'>"
- +"<td style='font-size:larger;font-family: Arial;border:solid #cccccc;border-width:0px 2px 2px 0px;'>"+pname+"</td>"
- +"<td style='font-size:larger;font-family: Arial;border:solid #cccccc;border-width:0px 2px 2px 0px;'>"+fzrname+"</td>"
- +"<td style='font-size:larger;font-family: Arial;border:solid #cccccc;border-width:0px 2px 2px 0px;text-align:right'>"+ys+"</td>"
- +"<td style='font-size:larger;font-family: Arial;border:solid #cccccc;border-width:0px 2px 2px 0px;text-align:right'>"+rgfy+"</td>"
- +"<td style='font-size:larger;font-family: Arial;border:solid #cccccc;border-width:0px 2px 2px 0px;text-align:right'>"+lsfy+"</td>"
- +"<td style='font-size:larger;font-family: Arial;border:solid #cccccc;border-width:0px 2px 2px 0px;text-align:right'>"+hj+"</td>"
- +"<td style='font-size:larger;font-family: Arial;border:solid #cccccc;border-width:0px 2px 2px 0px;text-align:right'>"+syfy+"</td>"
- +"</tr>";
-
- }
- html += "</tbody></table>"
- }
- println("---------html----------------------"+html);
- var sql1 = "select email as item_邮箱,domainid from obpm.t_user where id in(select b.USERID from obpm.t_user_role_set b where b.roleid = (select a.id from obpm.t_role a where a.NAME ='项目总经理') )";
- var datas1 = process1.queryBySQL(sql1, '11e1-81e2-37f74759-9124-47aada6b7467'); //domainid
- datas1 = datas1.getDatas();
- //var datas1 = queryBySQL(sql1);
- if(datas1 != null){
- for(var iter = datas1.iterator();iter.hasNext();){
- var doc1 = iter.next();
- var yx = doc1.getItemValueAsString("邮箱");
- println("---------yx----------------------"+yx);
- var first="您好!截止至"+date+","+"公司项目费用明细如下表所示:<br><br>";
- var last="<br>温馨提示:以上数据由系统定时自动导出,如有疑问请登录http://查询。"
- var body = first+html+last;
- var subject = "项目费用报表"+"("+date+")";
- var to = yx;
- var from1 = "5454566.com";
- var host = "smtp.exmail.qq.com";
- var user = "s345656@weioa365.com";
- var password1 = "已uyiuyiuyui";
- var bbc = "";
- var validate = true;
- var files = new Array("");
- sendMail(from1,to,subject,body,host,user,password1,bbc,validate);
- }
- }
- })();
- //80.10
复制代码 |