Example #1
0
        //private void init_ComboBox()
        //{
        //    ComInfo comInfo = new ComInfo();
        //    string sqlQuery = "";

        //    cmb.ValueMember = "코드";
        //    cmb.DisplayMember = "명칭";
        //    sqlQuery = comInfo.queryCustUsed("1");
        //    wConst.ComboBox_Read_Blank(cmb, sqlQuery);
        //}

        private void cust_list(string condition)
        {
            try
            {
                wnDm          wDm = new wnDm();
                DataTable     dt  = null;
                StringBuilder sb  = new StringBuilder();

                cust_Grid.Rows.Clear();

                string condition2 = "  c.INPUT_DATE >= '" + start_date.Text.ToString() + "' and  c.INPUT_DATE <= '" + end_date.Text.ToString() + "' ";

                //sb.AppendLine(" and C.CUST_CD = cmb.SelectedValue");

                dt = wDm.cust_Grid_List(condition, condition2);
                //if (!txtSrch.Text.ToString().Equals(""))
                //{
                //    sb.AppendLine("and CHK_NM like '%" + txtSrch.Text.ToString() + "%' ");
                //}

                if (dt != null && dt.Rows.Count > 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        cust_Grid.Rows.Add();
                        cust_Grid.Rows[i].Cells["CUST_NM"].Value    = dt.Rows[i]["CUST_NM"].ToString();
                        cust_Grid.Rows[i].Cells["ORDER_DATE"].Value = dt.Rows[i]["ORDER_DATE"].ToString();
                        // cust_Grid.Rows[i].Cells["ORDER_CD"].Value = dt.Rows[i]["ORDER_CD"].ToString();
                        cust_Grid.Rows[i].Cells["INPUT_DATE"].Value  = dt.Rows[i]["INPUT_DATE"].ToString();
                        cust_Grid.Rows[i].Cells["RAW_MAT_NM"].Value  = dt.Rows[i]["RAW_MAT_NM"].ToString();
                        cust_Grid.Rows[i].Cells["SPEC"].Value        = dt.Rows[i]["SPEC"].ToString();
                        cust_Grid.Rows[i].Cells["UNIT_CD"].Value     = (decimal.Parse(dt.Rows[i]["TOTAL_AMT"].ToString())).ToString("#,0");
                        cust_Grid.Rows[i].Cells["PRICE"].Value       = (decimal.Parse(dt.Rows[i]["PRICE"].ToString())).ToString("#,0");
                        cust_Grid.Rows[i].Cells["TOTAL_AMT"].Value   = (decimal.Parse(dt.Rows[i]["TOTAL_MONEY"].ToString())).ToString("#,0");
                        cust_Grid.Rows[i].Cells["COMPLETE_YN"].Value = dt.Rows[i]["COMPLETE_YN"].ToString() ?? "N";

                        if (dt.Rows[i]["ORDER_DATE"].ToString() == "9999-99-99")
                        {
                            cust_Grid.Rows[i].Cells["ORDER_DATE"].Value       = (String)"합계";
                            cust_Grid.Rows[i].Cells["INPUT_DATE"].Value       = (String)"합계";
                            this.cust_Grid.Rows[i].DefaultCellStyle.ForeColor = Color.Red;
                        }
                    }
                    wConst.mergeCells(cust_Grid, 1);
                }
                else
                {
                    cust_Grid.Rows.Clear();
                }
            }
            catch (Exception e)
            {
                MessageBox.Show("시스템 에러: " + e.Message.ToString());
                Popup.pop오류리포트 msg = new Popup.pop오류리포트(e.Message + " - " + e.ToString());
                msg.ShowDialog();
            }
        }
        //private void init_ComboBox()
        //{
        //    ComInfo comInfo = new ComInfo();
        //    string sqlQuery = "";

        //    cmb.ValueMember = "코드";
        //    cmb.DisplayMember = "명칭";
        //    sqlQuery = comInfo.queryCustUsed("1");
        //    wConst.ComboBox_Read_Blank(cmb, sqlQuery);
        //}

        private void cust_list(string condition)
        {
            try
            {
                wnDm          wDm = new wnDm();
                DataTable     dt  = null;
                StringBuilder sb  = new StringBuilder();

                if (txtcustSrch != null)
                {
                    sb.AppendLine(" and (SELECT CUST_NM FROM N_CUST_CODE WHERE CUST_CD = A.CUST_CD) LIKE '%" + txtcustSrch.Text.ToString() + "%' ");
                    //sb.AppendLine(" and C.CUST_CD = cmb.SelectedValue");
                }

                sb.AppendLine(" and C.CUST_CD = cmb.SelectedValue");
                sb.AppendLine(" and A.ORDER_DATE >= '" + start_date.Text.ToString() + "' and  A.ORDER_DATE <= '" + end_date.Text.ToString() + "'");

                dt = wDm.cust_Grid_List(sb.ToString());
                //if (!txtSrch.Text.ToString().Equals(""))
                //{
                //    sb.AppendLine("and CHK_NM like '%" + txtSrch.Text.ToString() + "%' ");
                //}



                if (dt != null && dt.Rows.Count > 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        custGrid.Rows[i].Cells[0].Value = dt.Rows[i]["ORDER_DATE"].ToString();
                        custGrid.Rows[i].Cells[1].Value = dt.Rows[i]["ORDER_CD"].ToString();
                        custGrid.Rows[i].Cells[2].Value = dt.Rows[i]["SEQ"].ToString();
                        custGrid.Rows[i].Cells[3].Value = dt.Rows[i]["RAW_MAT_CD"].ToString();
                        custGrid.Rows[i].Cells[4].Value = dt.Rows[i]["SPEC"].ToString();
                        custGrid.Rows[i].Cells[5].Value = dt.Rows[i]["UNIT_CD"].ToString();
                        custGrid.Rows[i].Cells[6].Value = dt.Rows[i]["TOTAL_AMT"].ToString();
                        custGrid.Rows[i].Cells[7].Value = dt.Rows[i]["PRICE"].ToString();
                        custGrid.Rows[i].Cells[8].Value = dt.Rows[i]["COMPLETE_YN"].ToString();
                    }
                }
                else
                {
                    custGrid.Rows.Clear();
                }
            }
            catch (Exception e)
            {
                MessageBox.Show("시스템 에러: " + e.Message.ToString());
            }
        }