업무일지 리포트 추가

This commit is contained in:
chikyun.kim
2019-05-07 14:11:57 +09:00
parent 1b487e8c5d
commit a9888ebf39
60 changed files with 8953 additions and 10776 deletions

View File

@@ -13,7 +13,8 @@ namespace FCOMMON
{
purchase,
holyday,
project
project,
jobreport,
}
public static int getAuth(eAutoType type, string uid)
{

View File

@@ -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())

View File

@@ -93,6 +93,12 @@
<Compile Include="fLovDateList.Designer.cs">
<DependentUpon>fLovDateList.cs</DependentUpon>
</Compile>
<Compile Include="fSelectMonth.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="fSelectMonth.Designer.cs">
<DependentUpon>fSelectMonth.cs</DependentUpon>
</Compile>
<Compile Include="fWebCamera.cs">
<SubType>Form</SubType>
</Compile>
@@ -116,6 +122,9 @@
<EmbeddedResource Include="fLovDateList.resx">
<DependentUpon>fLovDateList.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="fSelectMonth.resx">
<DependentUpon>fSelectMonth.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="fWebCamera.resx">
<DependentUpon>fWebCamera.cs</DependentUpon>
</EmbeddedResource>

View File

@@ -51,31 +51,6 @@ namespace FCOMMON
this.listView1.DragOver += listView1_DragOver;
}
void listView1_DragOver(object sender, DragEventArgs e)
{
this.Cursor = Cursors.Hand;
}
void listView1_DragEnter(object sender, DragEventArgs e)
{
e.Effect = DragDropEffects.All;
}
void listView1_DragDrop(object sender, DragEventArgs e)
{
string[] files = (string[])e.Data.GetData(DataFormats.FileDrop, false);
if (files.Length < 1) return;
string msg = string.Format("{0}건의 파일을 업로드 하시겠습니까?",files.Length);
if (FCOMMON.Util.MsgQ(msg) != System.Windows.Forms.DialogResult.Yes) return;
foreach(var fileName in files)
{
System.IO.FileInfo fi = new System.IO.FileInfo(fileName);
string remote = tbpath.Text + "/" + fi.Name;
ftp.upload(remote, fi.FullName);
}
btQuery.PerformClick();
}
void __Closed(object sender, FormClosedEventArgs e)
{
//listview column width
@@ -83,9 +58,9 @@ namespace FCOMMON
arUtil.INIHelper ini = new arUtil.INIHelper(fn);
for (int i = 0; i < this.listView1.Columns.Count; i++)
{
var curwidth = this.listView1.Columns[i].Width;
var curwidth = this.listView1.Columns[i].Width;
ini.set_Data("colsize", "index_" + i.ToString(), curwidth.ToString());
}
}
ini.Flush();
//string item = "ftp_lv_col_";
@@ -115,13 +90,44 @@ namespace FCOMMON
}
btQuery.PerformClick();
}
void listView1_DragOver(object sender, DragEventArgs e)
{
this.Cursor = Cursors.Hand;
}
void listView1_DragEnter(object sender, DragEventArgs e)
{
e.Effect = DragDropEffects.All;
}
void listView1_DragDrop(object sender, DragEventArgs e)
{
string[] files = (string[])e.Data.GetData(DataFormats.FileDrop, false);
if (files.Length < 1) return;
string msg = string.Format("{0}건의 파일을 업로드 하시겠습니까?",files.Length);
if (FCOMMON.Util.MsgQ(msg) != System.Windows.Forms.DialogResult.Yes) return;
foreach(var fileName in files)
{
System.IO.FileInfo fi = new System.IO.FileInfo(fileName);
string remote = tbpath.Text + "/" + fi.Name;
ftp.upload(remote, fi.FullName);
}
btQuery.PerformClick();
}
void listView1_DoubleClick(object sender, EventArgs e)
{
var path = listView1.SelectedItems[0].Text;
var newpath = string.Empty;
if (path == "..")
newpath = ftp.getParent(curPath);
{
if( this.homePath.Replace("/","") == curPath.Replace("/",""))
{
FCOMMON.Util.MsgE("홈 디렉토리 입니다.");
return;
} else newpath = ftp.getParent(curPath);
}
else
newpath = ftp.PathCombine(curPath, path);
@@ -149,6 +155,12 @@ namespace FCOMMON
// var list = ftp.directoryListSimple("/201");
var lvup = listView1.Items.Add("..");
lvup.SubItems.Add("");
lvup.SubItems.Add("");
lvup.SubItems.Add("");
var ftpdir = ftp.ListDirectoryDetail(path);
if(ftpdir == null)
{
@@ -158,6 +170,7 @@ namespace FCOMMON
this.progressBar1.Maximum = ftpdir.Count;
var OrderData = ftpdir.OrderBy(t => t.FileType).OrderBy(t=>t.Filename);
foreach (var item in OrderData)
{
this.progressBar1.Value += 1;
@@ -195,8 +208,7 @@ namespace FCOMMON
var selfile = this.listView1.SelectedItems[0];
var remotefile = ftp.PathFileCombine(curPath, selfile.Text);
var onlyfilename = remotefile.Substring(remotefile.LastIndexOf("/")+1);
SaveFileDialog od = new SaveFileDialog();
od.Filter = "All files|*.*";
od.FilterIndex = 1;
@@ -204,7 +216,6 @@ namespace FCOMMON
if (od.ShowDialog() != System.Windows.Forms.DialogResult.OK) return;
System.IO.FileInfo fi = new System.IO.FileInfo(od.FileName);
string newfile = ftp.PathFileCombine(curPath, fi.Name);
if (!ftp.download(remotefile,od.FileName))