업무일지 리포트 추가
This commit is contained in:
		| @@ -290,8 +290,20 @@ namespace FCOMMON | ||||
|         } | ||||
|         public static System.Data.DataTable getUserTable(int baseLevel = 1) | ||||
|         { | ||||
|             var list = getUserList(baseLevel); | ||||
|             return MakeDataTable(list); | ||||
|             var cn = getCn(); | ||||
|             cn.Open(); | ||||
|  | ||||
|             var retval = new sItemInfo(); | ||||
|             retval.idx = -1; | ||||
|  | ||||
|             string sql = "select [id],[name],concat([name],'(',[id],')') as dispName,[dept],[email],[level],[tel] from Users where dept like '%장비기술%' order by [name]"; | ||||
|             var cmd = new SqlCommand(sql, cn); | ||||
|             var da = new SqlDataAdapter(sql, cn); | ||||
|             var ds = new System.Data.DataSet(); | ||||
|             da.Fill(ds); | ||||
|             cn.Close(); | ||||
|             cn.Dispose(); | ||||
|             return ds.Tables[0]; | ||||
|         } | ||||
|  | ||||
|         private static Dictionary<string,string> MakeDataTable(List<string> list) | ||||
| @@ -351,6 +363,43 @@ namespace FCOMMON | ||||
|           cn.Dispose(); | ||||
|           return data.ToString(); | ||||
|       } | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 지정된 프로젝트의 마지막 업무일지 데이터를 반환함  | ||||
|         /// </summary> | ||||
|         /// <param name="projectIdx"></param> | ||||
|         /// <returns></returns> | ||||
|       public static System.Data.DataTable getLastJobReportData(string uid,int projectIdx) | ||||
|       { | ||||
|           var cn = getCn(); | ||||
|           cn.Open(); | ||||
|           var sql = "select top 1 * from JobReport" + | ||||
|               " where isnull(pidx,-1)=" + projectIdx.ToString() +  | ||||
|               " and uid ='" + uid + "'" +  | ||||
|               " order by pdate desc, idx desc"; | ||||
|           var da = new SqlDataAdapter(sql, cn); | ||||
|           var ds = new System.Data.DataSet(); | ||||
|           da.Fill(ds); | ||||
|           cn.Close(); | ||||
|           if (ds.Tables.Count > 0) return ds.Tables[0]; | ||||
|           else return null; | ||||
|       } | ||||
|       public static System.Data.DataTable getLastJobReportData(string uid, string type) | ||||
|       { | ||||
|           var cn = getCn(); | ||||
|           cn.Open(); | ||||
|           var sql = "select top 1 * from JobReport" + | ||||
|               " where isnull([type],'')='" + type + "'" +  | ||||
|               " and uid ='" + uid + "'" +  | ||||
|               " order by pdate desc, idx desc"; | ||||
|           var da = new SqlDataAdapter(sql, cn); | ||||
|           var ds = new System.Data.DataSet(); | ||||
|           da.Fill(ds); | ||||
|           cn.Close(); | ||||
|           if (ds.Tables.Count > 0) return ds.Tables[0]; | ||||
|           else return null; | ||||
|       } | ||||
|  | ||||
|       public static System.Data.DataTable getCodeTable(string GroupCode = "99") | ||||
|       { | ||||
|  | ||||
| @@ -378,7 +427,7 @@ namespace FCOMMON | ||||
|           cn.Dispose(); | ||||
|           return retval; | ||||
|       } | ||||
|         private static Dictionary<string, string> getTwoColumnList(string table,string col1,string col2,string where="",string order="") | ||||
|       public static Dictionary<string, string> getTwoColumnList(string table, string col1, string col2, string where = "", string order = "") | ||||
|         { | ||||
|             Dictionary<string, string> retval = new Dictionary<string, string>(); | ||||
|             var cn = getCn(); | ||||
| @@ -399,7 +448,6 @@ namespace FCOMMON | ||||
|             cn.Close(); | ||||
|             cn.Dispose(); | ||||
|             return retval; | ||||
|  | ||||
|         } | ||||
|         | ||||
|         public static Dictionary<string,string> getGroupTable(string GroupColumn, string table, string where = "", Boolean desc = false) | ||||
| @@ -441,6 +489,56 @@ namespace FCOMMON | ||||
|             return retval; | ||||
|         } | ||||
|  | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 지정된 사용자/월의 전체 근무시간 초과시간을 반환함 | ||||
|         /// </summary> | ||||
|         /// <param name="uid">사용자번호</param> | ||||
|         /// <param name="yymm">지정월(2019-05)</param> | ||||
|         /// <param name="work">근무시간</param> | ||||
|         /// <param name="total">최대근무시간(근무일수*8)</param> | ||||
|         /// <param name="ot">초과근무시간</param> | ||||
|         public static void getWorkTime(string uid,string yymm,out int work,out int total,out int ot) | ||||
|         { | ||||
|             work = 0; | ||||
|             total = 0; | ||||
|             ot = 0; | ||||
|             string retval = string.Empty; | ||||
|             var cn = getCn(); | ||||
|  | ||||
|             try | ||||
|             { | ||||
|  | ||||
|                 cn.Open(); | ||||
|                 var sql = "select isnull(sum(hrs),0) as hrs,isnull(sum(ot),0) as ot,dbo.getWorkDayCount('{1}') as workday" + | ||||
|                     " from JobReport" + | ||||
|                     " where uid = '{0}' and substring(pdate,1,7) = '{1}'"; | ||||
|  | ||||
|                 sql = string.Format(sql, uid, yymm); | ||||
|                 var cmd = new SqlCommand(sql, cn); | ||||
|                 var rdr = cmd.ExecuteReader(); | ||||
|                 while (rdr.Read()) | ||||
|                 { | ||||
|                     work = int.Parse(rdr[0].ToString()); | ||||
|                     ot = int.Parse(rdr[1].ToString()); | ||||
|                     total = int.Parse(rdr[2].ToString()) * 8; | ||||
|                 } | ||||
|                 cmd.Dispose(); | ||||
|                 cn.Close(); | ||||
|                 cn.Dispose(); | ||||
|             } | ||||
|             catch (Exception ex) | ||||
|             { | ||||
|                 work = 0; | ||||
|                 total = 0; | ||||
|                 ot = 0; | ||||
|             } | ||||
|             finally { | ||||
|                 if (cn != null) cn.Dispose(); | ||||
|             } | ||||
|         } | ||||
|  | ||||
|  | ||||
|         public static int addItem(string pumname,string sid, string model, decimal price, string supply ,int supplyidx = -1,byte[] pic = null) | ||||
|         { | ||||
|  | ||||
| @@ -498,7 +596,7 @@ namespace FCOMMON | ||||
|             return retval; | ||||
|         } | ||||
|  | ||||
|         public static List<String> getGroupList(string GroupColumn, string table, string where = "",Boolean desc=false) | ||||
|         public static List<String> getGroupList(string GroupColumn, string table, string where = "",Boolean desc=false,Boolean useColumncover=true) | ||||
|         { | ||||
|             List<string> retval = new List<string>(); | ||||
|             var cn = getCn(); | ||||
| @@ -513,7 +611,10 @@ namespace FCOMMON | ||||
|                    " order by {0} "; | ||||
|             if (desc) sql += " desc"; | ||||
|  | ||||
|             sql = string.Format(sql, "[" + GroupColumn + "]", table); | ||||
|             if (useColumncover) | ||||
|                 sql = string.Format(sql, "[" + GroupColumn + "]", table); | ||||
|             else | ||||
|                 sql = string.Format(sql,  GroupColumn , table); | ||||
|             var cmd = new SqlCommand(sql, cn); | ||||
|             var rdr = cmd.ExecuteReader(); | ||||
|             while (rdr.Read()) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 chikyun.kim
					chikyun.kim