File name
Commit message
Commit date
File name
Commit message
Commit date
using ClientLib;
using ClientLib.CommonService2;
using DevExpress.XtraGrid;
using DevExpress.XtraGrid.Views.Grid.ViewInfo;
using DevExpress.XtraReports.UI;
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_J_SALE
{
public partial class CreditSalesList : PublicLib.CommonMDI
{
private string m_YYMM;
public CreditSalesList()
{
InitializeComponent();
gridControl_Main.LookAndFeel.Style = DevExpress.LookAndFeel.LookAndFeelStyle.Flat;
gridControl_Main.LookAndFeel.UseDefaultLookAndFeel = false;
gridView_Main.Appearance.HeaderPanel.BackColor = Color.FromArgb(170, 204, 255);
gridControl_Det.LookAndFeel.Style = DevExpress.LookAndFeel.LookAndFeelStyle.Flat;
gridControl_Det.LookAndFeel.UseDefaultLookAndFeel = false;
gridView_Det.Appearance.HeaderPanel.BackColor = Color.FromArgb(170, 204, 255);
m_YYMM = "";
spinEdit_YY.Value = DateTime.Now.Year;
spinEdit_MM.Value = DateTime.Now.Month;
spinEdit_MM.Spin += (sender, e) =>
{
if (e.IsSpinUp)
{
if (spinEdit_MM.Value >= 12)
{
spinEdit_YY.Value++;
spinEdit_MM.Value = 1;
e.Handled = true;
}
}
else
{
if (spinEdit_MM.Value <= 1)
{
spinEdit_YY.Value--;
spinEdit_MM.Value = 12;
e.Handled = true;
}
}
};
panelControl_Det.Visible = splitterControl_Det.Visible = false;
checkEdit_YearList.CheckedChanged += (sender, e) =>
{
panelControl_Det.Visible = splitterControl_Det.Visible = checkEdit_YearList.Checked;
if (checkEdit_YearList.Checked)
{
splitterControl_Det.BringToFront();
gridSplitContainer_Main.BringToFront();
ShowDetail();
}
};
gridView_Main.FocusedRowChanged += (sender, e) =>
{
ShowDetail();
};
this.Shown += (sender, e) =>
{
try
{
SerializedSqlParam[] aParam = new SerializedSqlParam[] {
ClientClass.CreateSqlParameter("COMP_CD", SqlDbType.NVarChar, ConstClass._COMP_CD)
};
ResultData resultData = ClientClass.GetData("GetCreditSalesListForLookup", aParam);
if (resultData.isError)
{
throw new Exception(resultData.ResultValue);
}
DataRow row;
row = resultData.DataList.Tables[0].NewRow();
row["USR_ID"] = "";
row["EMP_NO"] = "";
row["USR_NM"] = "전체담당자";
resultData.DataList.Tables[0].Rows.InsertAt(row, 0);
UtilClass.SetLookup(lookUpEdit_SALES_USER, resultData.DataList.Tables[0], "EMP_NO", "USR_NM", true);
row = resultData.DataList.Tables[1].NewRow();
row["MST_DEPT_CD"] = "";
row["DEPT_CD"] = "";
row["DEPT_NM"] = "전체부서";
resultData.DataList.Tables[1].Rows.InsertAt(row, 0);
UtilClass.SetLookup(lookUpEdit_DEPT, resultData.DataList.Tables[1], "MST_DEPT_CD", "DEPT_NM", true);
DataView c17 = new DataView(ConstClass._DATA);
c17.RowFilter = "CATE_CD = 'C' and GRP_CD = 'C17'";
DataTable c17Data = c17.ToTable();
row = c17Data.NewRow();
row["NO_CD"] = "";
row["NO_CD_NM"] = "전체지역";
c17Data.Rows.InsertAt(row, 0);
UtilClass.SetLookup(lookUpEdit_AREA_CD, c17Data, "NO_CD", "NO_CD_NM", true);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
this.Close();
}
};
}
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("YYMM", SqlDbType.NVarChar, spinEdit_YY.Value.ToString("0000") + "." + spinEdit_MM.Value.ToString("00")),
ClientClass.CreateSqlParameter("SEARCH_CONDITION", SqlDbType.Int, comboBoxEdit_SEARCH_CONDITION.SelectedIndex),
ClientClass.CreateSqlParameter("REMARK_CONDITION", SqlDbType.Int, comboBoxEdit_REMARK_CONDITION.SelectedIndex),
ClientClass.CreateSqlParameter("MST_DEPT_CD", SqlDbType.NVarChar, lookUpEdit_DEPT.EditValue),
ClientClass.CreateSqlParameter("SALES_USR_ID", SqlDbType.NVarChar, lookUpEdit_SALES_USER.EditValue),
ClientClass.CreateSqlParameter("AREA_CD", SqlDbType.NVarChar, lookUpEdit_AREA_CD.EditValue),
ClientClass.CreateSqlParameter("DEAL_CONDITION", SqlDbType.Int, comboBoxEdit_DEAL_CONDITION.SelectedIndex)
};
ResultData resultData = ClientClass.GetData("GetCreditSaleList", aParam);
if (resultData.isError)
{
throw new Exception(resultData.ResultValue);
}
m_YYMM = spinEdit_YY.Value.ToString("0000") + "." + spinEdit_MM.Value.ToString("00");
gridControl_Main.DataSource = resultData.TableData;
this.Cursor = Cursors.Arrow;
}
catch (Exception ex)
{
this.Cursor = Cursors.Arrow;
MessageBox.Show(ex.Message);
}
}
private void ShowDetail()
{
try
{
DataRow row = gridView_Main.GetFocusedDataRow();
gridControl_Det.DataSource = null;
textEdit_REMAIN_MY.Text = "";
if (row == null || !gridControl_Det.Visible)
{
return;
}
this.Cursor = Cursors.WaitCursor;
SerializedSqlParam[] aParam = new SerializedSqlParam[] {
ClientClass.CreateSqlParameter("COMP_CD", SqlDbType.NVarChar, ConstClass._COMP_CD),
ClientClass.CreateSqlParameter("YY", SqlDbType.NVarChar, spinEdit_YY.Value.ToString("0000")),
ClientClass.CreateSqlParameter("CUST_CD", SqlDbType.NVarChar, row["CUST_CD"])
};
ResultData resultData = ClientClass.GetData("GetCreditSaleListDetail", aParam);
if (resultData.isError)
{
throw new Exception(resultData.ResultValue);
}
int remain_my = UtilClass.toInt(resultData.DataList.Tables[1].Rows[0]["REMAIN_MY"]);
textEdit_REMAIN_MY.EditValue = remain_my;
int order_my, col_my;
for (int i = 0; i < resultData.DataList.Tables[0].Rows.Count; i++)
{
order_my = UtilClass.toInt(resultData.DataList.Tables[0].Rows[i]["ORDER_MY"]);
col_my = UtilClass.toInt(resultData.DataList.Tables[0].Rows[i]["COL_MY"]);
remain_my = remain_my + order_my - col_my;
resultData.DataList.Tables[0].Rows[i]["REMAIN_MY"] = remain_my;
}
resultData.DataList.Tables[0].AcceptChanges();
gridControl_Det.DataSource = resultData.DataList.Tables[0];
this.Cursor = Cursors.Arrow;
}
catch (Exception ex)
{
this.Cursor = Cursors.Arrow;
MessageBox.Show(ex.Message);
}
}
public override void printProc()
{
if (gridControl_Main.DataSource == null)
{
return;
}
DataTable data = gridControl_Main.DataSource as DataTable;
if (data.Rows.Count < 1)
{
return;
}
CreditSalesReport report = new CreditSalesReport();
report.setDataBinding(data, m_YYMM);
CommonPreview preview = new CommonPreview("외상매출금 현황", true, false);
preview.SetH1Report(report);
preview.ShowDialog();
}
public override void excelProc()
{
this.ExportExcelGrid(gridControl_Main);
}
}
}