分享泛微公司OA系统用于二次开发的sql脚本
2015-01-18 22:27
786 查看
本单位用的oa系统就是泛微公司的oa协同办公平台,下面是我对他进行二次开发统计用到的写数据库脚本,只做开发参考使用,对于该系统的二次开发技术交流可以加我q:2050372586
【仪表盘】格式sql编写规则: ?只支持select语句并且,Select的结果必须为四列一行,且没列值为数值,其中 ?第一个值为最小值 ?第二个值为最大值 ?第三个值为安全值 ?第四个值为当前值 例如 Select0,400,300,count(id)fromhrmresource 【其他图形】格式sql编写规则(饼状、柱状、折线等等) 只支持select语句并且,select的结果必须为两列N(N>=1)行,且第二列必须为数值,其中 第一列值为显示项目(分类)名称 第二列值为对应项目(分类)的值 例如 员工数机构 sql: selecttop10(selectsubcompanynamefromhrmsubcompanywhereid=subCompanyId1),count(id)AscidsfromhrmresourcegroupbysubCompanyId1orderbycidsdesc oracle: select(selectsubcompanynamefromhrmsubcompanywhereid=subCompanyId1),count(id)AscidsfromhrmresourcegroupbysubCompanyId1orderbycidsdesc 合同金额前十机构 selecttop10(selectsubcompanynamefromhrmsubcompanywhereid=subCompanyId1),floor(sum(price/10000))AscidsfromCRM_ContractwheresubCompanyId1isnotnullgroupbysubCompanyId1orderbycidsdesc 销售机会金额前十机构 selecttop10(selectsubcompanynamefromhrmsubcompanywhereid=subCompanyId),floor(sum(preyield/10000))AscidsfromCRM_SellChancegroupbysubCompanyIdorderbycidsdesc 耗时前五长流程 sql: selecttop5(selectworkflownamefromworkflow_basewhereid=workflowid),24*avg(convert(float,convert(datetime,lastoperatedate))-convert(float,convert(datetime,createdate)))cidsfromworkflow_requestbasewhereworkflowid>0andworkflowid!=5groupbyworkflowidorderbycidsdesc oracle: select(selectworkflownamefromworkflow_basewhereid=workflowid),avg(nvl(to_date(lastoperatedate,'yyyy-mm-dd'),to_date(to_char(sysdate,'YYYY-MM-DD'),'yyyy-mm-dd'))- to_date(createdate,'yyyy-mm-dd'))ascidsfromworkflow_requestbasewhereworkflowid>0andworkflowid!=5andrownum<=5groupbyworkflowidorderbycidsdesc 销售机会前十机构 selecttop10(selectsubcompanynamefromhrmsubcompanywhereid=subCompanyId),count(id)AscidsfromCRM_SellChancegroupbysubCompanyIdorderbycidsdesc 项目统计前十机构 selecttop10(selectsubcompanynamefromhrmsubcompanywhereid=hrmdepartment.subcompanyid1),count(*)ascidfromPrj_ProjectInfo,hrmdepartmentwherePrj_ProjectInfo.department=hrmdepartment.idgroupbyhrmdepartment.subcompanyid1orderbyciddesc 人员性别统计 selectcasesexwhen'0'then'男'else'女'end,count(id)ascidfromhrmresourcegroupbysex 典型客户前十机构 selecttop10(selectprovincenamefromhrmprovincewhereid=province),province,count(id)ascidsfromCRM_CustomerInfo wherestatus=4andprovince>0groupbyprovinceorderbycidsdesc 创建文挡前十名统计 sql: selecttop10(selectlastnamefromhrmresourcewhereid=doccreaterid),count(id)ascidfromdocdetailgroupbydoccreateridorderbyciddesc oracle: select(selectlastnamefromhrmresourcewhereid=doccreaterid),count(id)ascidfromdocdetailwhererownum<=10groupbydoccreateridorderbyciddesc 待办事宜数量前十机构统计 slq: selecttop10(selectsubcompanynamefromhrmsubcompanywhereid=subcompanyid1),count(requestid)ascidfromworkflow_currentoperator,hrmresourcewherehrmresource.id=workflow_currentoperator.useridandisremarkin(0,1,8,9)andislasttimes=1groupbysubcompanyid1orderbyciddesc oracle: select(selectsubcompanynamefromhrmsubcompanywhereid=subcompanyid1),count(requestid)ascidfromworkflow_currentoperator,hrmresourcewherehrmresource.id=workflow_currentoperator.useridandisremarkin(0,1,8,9)andislasttimes=1andrownum<=10groupbysubcompanyid1orderbyciddesc 学历人员分布 oracle: select(selectnamefromhrmeducationlevelwhereid=educationlevel)as学历,count(id)as人数fromhrmresourcewhereeducationlevel!=0groupbyeducationlevelorderbyeducationleveldesc 办公地点人员分布 oracle: select(selectlocationnamefromhrmlocationswhereid=locationid)as办公地点,count(id)as人数fromhrmresourcegroupbylocationid 年龄段人员分布 oracle: select年龄段,age1from(selectcount(id)age1,'40后'年龄段fromhrmresourcet1wheret1.birthdaybetween'1940-01-01'and'1949-12-31'unionselectcount(id)age1,'50后'年龄段fromhrmresourcet1wheret1.birthdaybetween'1950-01-01'and'1959-12-31'unionselectcount(id)age1,'60后'年龄段fromhrmresourcet1wheret1.birthdaybetween'1960-01-01'and'1969-12-31'unionselectcount(id)age1,'70后'年龄段fromhrmresourcet1wheret1.birthdaybetween'1970-01-01'and'1979-12-31'unionselectcount(id)age1,'80后'年龄段fromhrmresourcet1wheret1.birthdaybetween'1980-01-01'and'1989-12-31'unionselectcount(id)age1,'90后'年龄段fromhrmresourcet1wheret1.birthdaybetween'1990-01-01'and'1999-12-31')orderby年龄段 职务人员分布 sql: selectcount(id)as人数,'总裁'as职务fromhrmresourcewhereseclevel=80 unionallselectcount(id)as人数,'中心领导'as职务fromhrmresourcewhereseclevel=70orseclevel=60 unionallselectcount(id)as人数,'经理'as职务fromhrmresourcewhereseclevel=40 unionallselectcount(id)as人数,'副经理'as职务fromhrmresourcewhereseclevel=30 unionallselectcount(id)as人数,'主管'as职务fromhrmresourcewhereseclevel=20 unionallselectcount(id)as人数,'普通员工'as职务fromhrmresourcewhereseclevel=10 unionallselectcount(id)as人数,'实习生'as职务fromhrmresourcewhereseclevel=5 oracle: select人数,职务from(selectcount(id)as人数,'总裁'as职务fromhrmresourcewhereseclevel=80unionallselectcount(id)as人数,'中心领导'as职务fromhrmresourcewhereseclevel=70orseclevel=60unionallselectcount(id)as人数,'经理'as职务fromhrmresourcewhereseclevel=40unionallselectcount(id)as人数,'副经理'as职务fromhrmresourcewhereseclevel=30unionallselectcount(id)as人数,'主管'as职务fromhrmresourcewhereseclevel=20 unionallselectcount(id)as人数,'普通员工'as职务fromhrmresourcewhereseclevel=10unionallselectcount(id)as人数,'实习生'as职务fromhrmresourcewherelevel=5) U8系统-主营业务收入期间图 selectcaseb.iperiodwhen'1'then'一月'when'2'then'二月'when'3'then'三月'when'4'then'四月'when'5'then'五月'when'6'then'六月'when'7'then'七月'when'8'then'八月'when'9'then'九月'when'10'then'十月'when'11'then'十一月'when'12'then'十二月'end,sum(b.md)as金额fromfitemss00asa,GL_accassasb,codeascwherea.citemcode=b.citem_idandb.ccode=c.ccodeandc.ccodelike'6001%'groupbyiperiod U8系统-主营业务成本期间图 selectcaseb.iperiodwhen'1'then'一月'when'2'then'二月'when'3'then'三月'when'4'then'四月'when'5'then'五月'when'6'then'六月'when'7'then'七月'when'8'then'八月'when'9'then'九月'when'10'then'十月'when'11'then'十一月'when'12'then'十二月'end,sum(b.md)as金额fromfitemss00asa,GL_accassasb,codeascwherea.citemcode=b.citem_idandb.ccode=c.ccodeandc.ccodelike'6401%'groupbyiperiod U8系统-主营业务利润 select'成本'as项,sum(md)as金额fromfitemss00asa,GL_accassasb,codeascwherea.citemcode=b.citem_idandb.ccode=c.ccodeandc.ccodelike'6401%' unionall select'收入'as项,sum(mc)as金额fromfitemss00asa,GL_accassasb,codeascwherea.citemcode=b.citem_idandb.ccode=c.ccodeandc.ccodelike'6001%' U8系统-主营业务每月利润表 select'一月'as月份,(selectsum(b.md)fromGL_accassasb,codeascwhereb.ccode=c.ccodeandc.ccodelike'6001%'andiperiod='1')-(selectsum(b.md)fromGL_accassasb,codeascwhereb.ccode=c.ccodeandc.ccodelike'6401%'andiperiod='1')as金额unionallselect'二月'as月份,(selectsum(b.md)fromGL_accassasb,codeascwhereb.ccode=c.ccodeandc.ccodelike'6001%'andiperiod='2')-(selectsum(b.md)fromGL_accassasb,codeascwhereb.ccode=c.ccodeandc.ccodelike'6401%'andiperiod='2')as金额unionallselect'三月'as月份,(selectsum(b.md)fromGL_accassasb,codeascwhereb.ccode=c.ccodeandc.ccodelike'6001%'andiperiod='3')-(selectsum(b.md)fromGL_accassasb,codeascwhereb.ccode=c.ccodeandc.ccodelike'6401%'andiperiod='3')as金额unionallselect'四月'as月份,(selectsum(b.md)fromGL_accassasb,codeascwhereb.ccode=c.ccodeandc.ccodelike'6001%'andiperiod='4')-(selectsum(b.md)fromGL_accassasb,codeascwhereb.ccode=c.ccodeandc.ccodelike'6401%'andiperiod='4')as金额unionallselect'五月'as月份,(selectsum(b.md)fromGL_accassasb,codeascwhereb.ccode=c.ccodeandc.ccodelike'6001%'andiperiod='5')-(selectsum(b.md)fromGL_accassasb,codeascwhereb.ccode=c.ccodeandc.ccodelike'6401%'andiperiod='5')as金额unionallselect'六月'as月份,(selectsum(b.md)fromGL_accassasb,codeascwhereb.ccode=c.ccodeandc.ccodelike'6001%'andiperiod='6')-(selectsum(b.md)fromGL_accassasb,codeascwhereb.ccode=c.ccodeandc.ccodelike'6401%'andiperiod='6')as金额unionallselect'七月'as月份,(selectsum(b.md)fromGL_accassasb,codeascwhereb.ccode=c.ccodeandc.ccodelike'6001%'andiperiod='7')-(selectsum(b.md)fromGL_accassasb,codeascwhereb.ccode=c.ccodeandc.ccodelike'6401%'andiperiod='7')as金额unionallselect'八月'as月份,(selectsum(b.md)fromGL_accassasb,codeascwhereb.ccode=c.ccodeandc.ccodelike'6001%'andiperiod='8')-(selectsum(b.md)fromGL_accassasb,codeascwhereb.ccode=c.ccodeandc.ccodelike'6401%'andiperiod='8')as金额unionallselect'九月'as月份,(selectsum(b.md)fromGL_accassasb,codeascwhereb.ccode=c.ccodeandc.ccodelike'6001%'andiperiod='9')-(selectsum(b.md)fromGL_accassasb,codeascwhereb.ccode=c.ccodeandc.ccodelike'6401%'andiperiod='9')as金额unionallselect'十月'as月份,(selectsum(b.md)fromGL_accassasb,codeascwhereb.ccode=c.ccodeandc.ccodelike'6001%'andiperiod='10')-(selectsum(b.md)fromGL_accassasb,codeascwhereb.ccode=c.ccodeandc.ccodelike'6401%'andiperiod='10')as金额unionallselect'十一月'as月份,(selectsum(b.md)fromGL_accassasb,codeascwhereb.ccode=c.ccodeandc.ccodelike'6001%'andiperiod='11')-(selectsum(b.md)fromGL_accassasb,codeascwhereb.ccode=c.ccodeandc.ccodelike'6401%'andiperiod='11')as金额unionallselect'十二月'as月份,(selectsum(b.md)fromGL_accassasb,codeascwhereb.ccode=c.ccodeandc.ccodelike'6001%'andiperiod='12')-(selectsum(b.md)fromGL_accassasb,codeascwhereb.ccode=c.ccodeandc.ccodelike'6401%'andiperiod='12')as金额 fitemss00产品 code科目 fitemss00class产品分类表 GL_accass资金表 GL_CashTable总账现金流量数据表 GL_accvouch凭证及明细账 Code会计科目档案 Department部门基本信息 Person职员档案 Customer客户档案 CustomerClass客户分类档案 Vendor供应商档案 VendorClass供应商分类档案 fitemss98现金流量项目目录 fitemss98class现金流量分类目录
序号 | 查询语句 | 功能 |
1 | Select*fromDocDetailwheremaincategory=17 | 查看通知 |
2 | SELECT*fromHrmResource | 查看个人信息 |
3 | select*fromworkflow_requestbase | 流程申请表 |
select*fromworkflow_requestbasewherestatus='提醒' | 查看会议提醒() | |
4 | Select*fromworkflow_currentoperatorwhereuserid=606andisremark=0(其中userid是用户信息表的账号) | 查看当前待办流程 |
select*fromworkflow_requestbaseWHERErequestidin(Selectrequestidfromworkflow_currentoperatorwhereuserid=10andisremark=0) | ||
5 | Updateworkflow_currentoperator | |
6 | select*fromMeeting | 查看会议 |
7 | select*fromMeetingRoom | 会议室 |
8 | SELECTa.name,b.lastname,c.lastname,d.name,a.begindate,a.begintime,a.enddate,a.endtime,a.createdate,a.createtime,a.totalmember,a.description,a.requestidFROMMeetingaLEFTJOINHrmResourcebONa.caller=b.idLEFTJOINHrmResourcecONa.contacter=c.idLEFTJOINMeetingRoomdONa.address=d.idwhereDateDiff(dd,begindate,getdate())<=14ORDERBYbegindateasc | 14天以后的会议详细查看 |
9 | WhereDateDiff(dd,a.createdate,getdate())=0 | 今天的所有数据 |
10 | WhereDateDiff(dd,a.createdate,getdate())=1 | 昨天 |
11 | select*fromMeetingwhereDateDiff(dd,begindate,getdate())<=14ORDERBYbegindatedesc | 14天内 |
12 | select*fromMeetingwhereDateDiff(mm,createdate,getdate())=0 | 本月申报 |
13 | select*fromMeetingwhereDateDiff(yy,createdate,getdate())=0 | 本年申报 |
14 | HrmDepartment人力资源部门表HrmJobGroups人力资源职务类型表HrmJobTitles人力资源岗位表 | |
15 | selectloginidas工号,lastnameas姓名fromHrmResourcewhereisnull(loginid,'')<>'' | sql查询账号不为空的: |
16 | select*fromworkflow_billfieldselect*fromworkflow_baseselect*fromworkflow_selectitem | 一下三个表关联起来可以查询到选择项的对应流程 |
相关文章推荐
- 方维分享系统二次开发,给后台添加菜单
- Silverlight管理系统源码(用于开发ERP、OA、CRM、HR、进销存、财务等系统之用)
- 方维分享系统二次开发,tip.htm,修改调用的当前用户的信息
- 方维购物分享系统二次开发教程、详解(官方)
- 分享一个全开源的ASP.NET快速开发平台,能快速开发OA CRM ERP 等系统
- 海康威视 DVR IPC, IOS系统的SDK包。用于二次开发
- 方维分享系统二次开发,修改成直接登录,第三方登录无需二次注册
- 方维分享系统二次开发,新加一个模块
- 通达OA二次开发 小飞鱼应用OA工作流二次开发智能公文系统(二)(图文)
- 通达OA二次开发 小飞鱼应用OA工作流二次开发智能公文系统(三)(图文)
- 通达OA二次开发 小飞鱼应用OA工作流二次开发智能公文系统(一)(图文)
- 分享NetSuite CRM二次开发服务及系统优势!
- 方维分享系统二次开发,订阅tag标签的功能
- 方维分享系统二次开发, 给评论、主题、回复、活动 加审核的功能
- [二次开发] EBS R12 探索之路【EBS 经典SQL分享】
- 一个Web系统OA界面设计和开发
- C#中使用SQLDMO.Database.ExecuteImmediate执行SQL脚本(可用于新建表、视图)
- Web系统OA界面设计和开发,OA设计开发指南,OA界面设计,OA系统开发
- SQL Server 开发之 复制表数据的SQL脚本生成器