File name
Commit message
Commit date
File name
Commit message
Commit date
using ClientLib;
using ClientLib.CommonService2;
using DevExpress.XtraEditors;
using DevExpress.XtraGrid;
using DevExpress.XtraGrid.Views.Grid.ViewInfo;
using PublicLib;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace HANMI_SALE
{
public partial class CostManager : PublicLib.CommonMDI
{
Timer m_Timer;
private string m_ORDER_NO;
public CostManager()
{
InitializeComponent();
textEdit_CUST_NM.ImeMode = System.Windows.Forms.ImeMode.Hangul;
textEdit_ITEM_NM.ImeMode = System.Windows.Forms.ImeMode.Hangul;
m_Timer = new Timer();
m_Timer.Enabled = false;
m_ORDER_NO = "";
dateEdit_SDATE.DateTime = DateTime.Now;
dateEdit_FDATE.DateTime = DateTime.Now;
labelControl_SDATE_YO.Text = GetDay(DateTime.Now) + "부터";
labelControl_FDATE_YO.Text = GetDay(DateTime.Now) + "까지";
gridControl_Main.LookAndFeel.Style = DevExpress.LookAndFeel.LookAndFeelStyle.Flat;
gridControl_Main.LookAndFeel.UseDefaultLookAndFeel = false;
gridView_Main.Appearance.HeaderPanel.BackColor = Color.FromArgb(170, 204, 255);
simpleButton_ITEM_Search.Click += (sender, e) =>
{
selectItemProc();
};
comboBoxEdit_ORDER_BY.EditValueChanged += (sender, e) =>
{
searchProc();
};
lookUpEdit_ROUT_CD.EditValueChanged += (sender, e) =>
{
searchProc();
};
dateEdit_SDATE.EditValueChanged += (sender, e) =>
{
labelControl_SDATE_YO.Text = GetDay(dateEdit_SDATE.DateTime) + "부터";
};
dateEdit_FDATE.EditValueChanged += (sender, e) =>
{
labelControl_FDATE_YO.Text = GetDay(dateEdit_FDATE.DateTime) + "까지";
};
simpleButton_Cust_Search.Click += (sender, e) =>
{
selectCustProc();
};
textEdit_CUST_NM.KeyPress += (sender, e) =>
{
if (e.KeyChar == '\r')
{
selectCustProc();
}
};
textEdit_CUST_NM.EditValueChanged += (sender, e) =>
{
if (UtilClass.isNull(textEdit_CUST_NM.Text))
{
labelControl_CUST_CD.Text = "";
}
};
textEdit_ITEM_NM.KeyPress += (sender, e) =>
{
if (e.KeyChar == '\r')
{
selectItemProc();
}
};
textEdit_ITEM_NM.EditValueChanged += (sender, e) =>
{
if (UtilClass.isNull(textEdit_ITEM_NM.Text))
{
labelControl_ITEM_CD.Text = "";
}
};
gridView_Main.CustomDrawCell += (sender, e) =>
{
DataRow row = gridView_Main.GetDataRow(e.RowHandle);
if (!UtilClass.isEqual(row["BILL_NO"], ""))
{
e.Appearance.BackColor = Color.FromArgb(206, 254, 188);
e.Appearance.ForeColor = Color.DarkBlue;
}
};
gridView_Main.DoubleClick += (sender, e) =>
{
Point aPT = gridControl_Main.PointToClient(Control.MousePosition);
GridHitInfo aInfo = gridView_Main.CalcHitInfo(aPT);
if (aInfo.InRowCell)
{
updateProc();
}
};
gridView_Main.FocusedRowChanged += (sender, e) =>
{
};
dateEdit_FDATE.KeyPress += (sender, e) =>
{
searchProc();
};
m_Timer.Tick += (sender, e) =>
{
DateTime dt = DateTime.Now;
string datePart = dt.ToString("yyyy-MM-dd hh:mm:ss");
labelControl_Time.Text = datePart;
};
simpleButton_New.Click += (sender, e) =>
{
newProc();
};
simpleButton_Search.Click += (sender, e) =>
{
searchProc();
};
simpleButton_Print.Click += (sender, e) =>
{
printProc();
};
simpleButton_Excel_Save.Click += (sender, e) =>
{
excelProc();
};
simpleButton_Close.Click += (sender, e) =>
{
this.Close();
};
this.Shown += (sender, e) =>
{
dateEdit_SDATE.Focus();
//시간 설정.
m_Timer.Interval = 100;
m_Timer.Enabled = true;
try
{
SerializedSqlParam[] aParam = new SerializedSqlParam[] {
ClientClass.CreateSqlParameter("COMP_CD", SqlDbType.NVarChar, ConstClass._COMP_CD)
};
ResultData result = ClientClass.GetData("GetRoutingManager", aParam);
if (result.isError)
{
throw new Exception(result.ResultValue);
}
UtilClass.SetLookup(lookUpEdit_ROUT_CD, result.TableData, "ROUT_CD", "ROUT_NM", true, true);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
searchProc();
};
}
private void selectCustProc()
{
SelectCustomerForm form = new SelectCustomerForm(textEdit_CUST_NM.Text);
if (form.ShowDialog() != System.Windows.Forms.DialogResult.Yes)
{
return;
}
textEdit_CUST_NM.Text = form.m_CUST_NN;
labelControl_CUST_CD.Text = form.m_CUST_CD;
searchProc();
}
private void selectItemProc()
{
SelectItemForm form = new SelectItemForm(textEdit_ITEM_NM.Text);
form.TopMost = true;
if (form.ShowDialog() != System.Windows.Forms.DialogResult.Yes)
{
return;
}
labelControl_ITEM_CD.Text = form.m_ITEM_CD;
textEdit_ITEM_NM.Text = form.m_ITEM_NM;
textEdit_ITEM_NM.Focus();
searchProc();
}
public override void searchProc()
{
try
{
this.Cursor = Cursors.WaitCursor;
gridControl_Main.DataSource = null;
SerializedSqlParam[] aParam = new SerializedSqlParam[] {
ClientClass.CreateSqlParameter("COMP_CD", SqlDbType.NVarChar, ConstClass._COMP_CD),
ClientClass.CreateSqlParameter("CUST_CD", SqlDbType.NVarChar, labelControl_CUST_CD.Text),
ClientClass.CreateSqlParameter("SDATE", SqlDbType.NVarChar, dateEdit_SDATE.DateTime.ToString("yyyy-MM-dd")),
ClientClass.CreateSqlParameter("FDATE", SqlDbType.NVarChar, dateEdit_FDATE.DateTime.ToString("yyyy-MM-dd")),
ClientClass.CreateSqlParameter("ROUT_CD", SqlDbType.NVarChar, lookUpEdit_ROUT_CD.EditValue),
ClientClass.CreateSqlParameter("ITEM_CD", SqlDbType.NVarChar, labelControl_ITEM_CD.Text),
ClientClass.CreateSqlParameter("ORDER_BY", SqlDbType.Int, comboBoxEdit_ORDER_BY.SelectedIndex)
};
ResultData resultData = ClientClass.GetData("GetCostManager", aParam);
if (resultData.isError)
{
throw new Exception(resultData.ResultValue);
}
DataTable aData = resultData.TableData;
foreach (DataRow arow in aData.Rows)
{
if (UtilClass.isEqual(arow["LN_SEQ"], "01"))
{
continue;
}
arow["FILE_NM"] = "";
}
gridControl_Main.DataSource = aData;
aData.AcceptChanges();
this.Cursor = Cursors.Arrow;
if (!UtilClass.isNull(m_ORDER_NO))
{
for (int i = 0; i < gridView_Main.RowCount; i++)
{
if (UtilClass.isEqual(gridView_Main.GetDataRow(i)["ORDER_NO"], m_ORDER_NO))
{
gridView_Main.FocusedRowHandle = i;
break;
}
}
}
}
catch (Exception ex)
{
this.Cursor = Cursors.Arrow;
XtraMessageBox.Show(ex.Message);
}
}
public override void newProc()
{
try
{
CostManagerPopup form = new CostManagerPopup(this);
form.initProc("");
form.TopMost = true;
form.Show();
}
catch (Exception ex)
{
XtraMessageBox.Show(ex.Message);
}
}
public override void updateProc()
{
DataRow row = gridView_Main.GetFocusedDataRow();
if (row == null)
{
return;
}
string order_no = UtilClass.toStr(row["ORDER_NO"]);
CostManagerPopup form = new CostManagerPopup(this);
string str = form.initProc(order_no);
if (!UtilClass.isNull(str))
{
XtraMessageBox.Show(str);
return;
}
form.TopMost = true;
form.Show();
}
public override void deleteProc()
{
}
public override void printProc()
{
DataTable data = gridControl_Main.DataSource as DataTable;
CostManagerReport report = new CostManagerReport();
report.SetData(data,
dateEdit_SDATE.Text,
dateEdit_FDATE.Text
);
}
public override void excelProc()
{
this.ExportExcelGrid(gridControl_Main);
}
public override void saveProc()
{
}
private string GetDay(DateTime dt)
{
string strDay = "";
switch (dt.DayOfWeek)
{
case DayOfWeek.Monday:
strDay = "월요일";
break;
case DayOfWeek.Tuesday:
strDay = "화요일";
break;
case DayOfWeek.Wednesday:
strDay = "수요일";
break;
case DayOfWeek.Thursday:
strDay = "목요일";
break;
case DayOfWeek.Friday:
strDay = "금요일";
break;
case DayOfWeek.Saturday:
strDay = "토요일";
break;
case DayOfWeek.Sunday:
strDay = "일요일";
break;
}
return strDay;
}
}
}