private void btnSelect_Click(object sender, EventArgs e) { //조회 버튼 try { ShipmentClosingVO vo = new ShipmentClosingVO(); vo.start_date = dtpFromDate.Value.ToShortDateString(); vo.end_date = dtpToDate.Value.ToShortDateString(); if (cboCustomer.Text != "선택") { vo.company_code = cboCustomer.SelectedValue.ToString(); } if (txtProduct.Text != "") { vo.product_name = txtProduct.Text.Trim(); } SetDGV(); dt = new DataTable(); shipment_service = new ShipmentService(); dt = shipment_service.GetSalesCompleteStatus(vo); dgvClientOrder.DataSource = dt; SetBottomStatusLabel($"{dt.Rows.Count}건이 조회되었습니다."); } catch (Exception err) { LoggingUtility.GetLoggingUtility(err.Message, Level.Error); } }
/// <summary> /// 마감현황조회 /// </summary> /// <param name="product_id"></param> /// <returns></returns> public DataTable GetSalesCompleteStatus(ShipmentClosingVO vo) { using (SqlCommand cmd = new SqlCommand()) { DataTable dt = new DataTable(); StringBuilder sql = new StringBuilder(); sql.Append(@"select so_wo_id,s.so_id,s_date,s.plan_id,p.product_codename,p.product_name,s_count,s_TotalPrice,s_company,c.company_name,so.so_pcount from TBL_SALES_COMPLETE s inner join TBL_PRODUCT p on s.product_id = p.product_id inner join TBL_SO_MASTER so on s.so_id = so.so_id inner join TBL_COMPANY c on c.company_code = s.s_company and CONVERT (DATETIME, s_date) >= CONVERT (DATETIME, @startDate) and CONVERT (DATETIME, s_date) <= CONVERT (DATETIME, @endDate)"); if (vo.company_code != null) { sql.Append(" and c.company_code = @company_code"); cmd.Parameters.AddWithValue("@company_code", vo.company_code); } if (vo.product_name != null) { sql.Append($" and p.product_name like '%{vo.product_name}%'"); // cmd.Parameters.AddWithValue("@order_id", vo.order_id); } cmd.Parameters.AddWithValue("@startDate", vo.start_date); cmd.Parameters.AddWithValue("@endDate", vo.end_date); cmd.Connection = new SqlConnection(this.ConnectionString); cmd.Connection.Open(); cmd.CommandText = sql.ToString(); cmd.CommandType = CommandType.Text; SqlDataAdapter da = new SqlDataAdapter(cmd); da.Fill(dt); da.Dispose(); cmd.Connection.Close(); return(dt); } }
public DataTable GetSalesCompleteStatus(ShipmentClosingVO vo) { ShipmentDac dac = new ShipmentDac(); return(dac.GetSalesCompleteStatus(vo)); }
private void button2_Click(object sender, EventArgs e) { string str = "조회를 먼저 해야합니다."; if (dt == null) { MessageBox.Show(str, "레포트 생성", MessageBoxButtons.OK, MessageBoxIcon.Information); SetBottomStatusLabel(str); return; } else { if (MessageBox.Show("레포트를 생성하시겠습니까?", "레포트 생성", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { try { ShipmentClosingVO vo = new ShipmentClosingVO(); vo.start_date = dtpFromDate.Value.ToShortDateString(); vo.end_date = dtpToDate.Value.ToShortDateString(); if (cboCustomer.Text != "선택") { vo.company_code = cboCustomer.SelectedValue.ToString(); } if (txtProduct.Text != "") { vo.product_name = txtProduct.Text.Trim(); } shipment_service = new ShipmentService(); shipment_service.GetSalesCompleteStatus(vo); SalesComplete ds = new SalesComplete(); Report_SalesComplete rpt = new Report_SalesComplete(); dt.TableName = "salescomplete"; ds.Tables.Add(dt); rpt.DataSource = ds.Tables["salescomplete"]; using (ReportPrintTool printTool = new ReportPrintTool(rpt)) { printTool.ShowRibbonPreviewDialog(); } //WinReport_SC frm = new WinReport_SC(rpt); //frm.documentViewer1.DocumentSource = rpt; ////?? //frm.documentViewer1.PrintingSystem.ExecCommand( // DevExpress.XtraPrinting.PrintingSystemCommand.SubmitParameters // , new object[] { true }); //frm.ShowDialog(); } catch (Exception err) { string str2 = "레포트를 생성할 수 없습니다."; SetBottomStatusLabel(str2); if (MessageBox.Show(str2, "레포트 생성 실패", MessageBoxButtons.OK, MessageBoxIcon.Information) == DialogResult.OK) { LoggingUtility.GetLoggingUtility(err.Message, Level.Error); return; } } } } }