private void searchTotal_Click(object sender, EventArgs e) { splashScreenManager5.ShowWaitForm(); if (dateEdit1.DateTime.Date > dateEdit2.DateTime.Date) { MessageBox.Show("Ngày bắt đàu không được lớn hơn ngày kết thúc", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { // Add a title to the chart (if necessary). chartControl2.Titles.Clear(); chartTitle2.Text = "BIỂU ĐỒ SẢN LƯỢNG HẰNG THÁNG\n(" + dateEdit1.DateTime.ToString("dd/MM/yyyy") + " - " + dateEdit2.DateTime.ToString("dd/MM/yyyy") + ")"; chartTitle2.Font = new Font("Times New Roman", 15, FontStyle.Bold); chartControl2.Titles.Add(chartTitle2); dtChart2 = BUS_SanXuat.ChartQtyMonthly(dateEdit1.DateTime.ToString("yyyy-MM-dd"), dateEdit2.DateTime.ToString("yyyy-MM-dd"), lkBoPhanTotal.EditValue.ToString()); DateTime selectedMonth1 = dateEdit1.DateTime; DateTime previousSelectedMonth1 = selectedMonth1.AddMonths(-1); DateTime selectedMonth2 = dateEdit2.DateTime; DateTime previousSelectedMonth2 = selectedMonth2.AddMonths(-1); lblQtyMonth.Text = "Sản lượng tháng trước: " + BUS_SanXuat.ChartQtyTotal(previousSelectedMonth1.ToString("yyyy-MM-dd"), previousSelectedMonth2.ToString("yyyy-MM-dd"), lkBoPhanTotal.EditValue.ToString()); CreateChart2(dtChart2); } splashScreenManager5.CloseWaitForm(); }
private void btnSave_Click(object sender, EventArgs e) { if (string.Compare(documentStatus, "Đã đóng") == 0) { MessageBox.Show(this, "Chứng từ đã đóng, không thể thêm mới.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { string headCount = txtHeadcount.Text; string outPut = txtOutput.Text; if (!string.IsNullOrEmpty(headCount) && !string.IsNullOrEmpty(outPut)) { bool flag = BUS_SanXuat.InputLine(m_inout_id, lkInput.EditValue.ToString(), txtHeadcount.Text, txtOutput.Text, txtNote.Text); if (!flag) { MessageBox.Show("Dữ liệu đã tồn tại.\n Vui lòng loại bỏ dữ liệu đã có trước khi tạo mới.", "Không thành công", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { dtInoutLine = BUS_SanXuat.GetInoutLine(m_inout_id); grdInoutLine.DataSource = dtInoutLine; } } else { MessageBox.Show("Vui lòng nhập các dữ liệu cần thiết!", "Không thành công", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void btnSua_Click(object sender, EventArgs e) { if (string.Compare(documentStatus, "Đã đóng") == 0) { MessageBox.Show(this, "Chứng từ đã đóng, không thể xóa.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { int[] selectedRows = gridView.GetSelectedRows(); foreach (int rowHandle in selectedRows) { if (rowHandle >= 0) { _inoutline_id = gridView.GetRowCellValue(rowHandle, m_inoutline_id).ToString(); bool flag = BUS_SanXuat.RemoveLine(_inoutline_id); if (!flag) { MessageBox.Show("Reomve không thành công.", "Không thành công", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { dtInoutLine = BUS_SanXuat.GetInoutLine(m_inout_id); grdInoutLine.DataSource = dtInoutLine; } } } } }
private void btnDelete_Click(object sender, EventArgs e) { int[] selectedRows = gridView.GetSelectedRows(); if (selectedRows.Length > 0) { foreach (int rowHandle in selectedRows) { if (rowHandle >= 0) { sochungtu = gridView.GetRowCellValue(rowHandle, documentno).ToString(); bool flag = BUS_SanXuat.RemoveInout(sochungtu); if (!flag) { MessageBox.Show("Reomve không thành công.", "Không thành công", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { dtInout = BUS_SanXuat.GetInout(ad_org_id, dateEdit1.DateTime.Date.ToString("yyyy-MM-dd"), dateEdit2.DateTime.Date.ToString("yyyy-MM-dd")); grdInout.DataSource = dtInout; } } } } else { MessageBox.Show("Vui lòng chọn dòng cần remove!", "Không thành công", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnSave_Click(object sender, EventArgs e) { string documentstatus = "D01"; string typeName = lkTypename.EditValue.ToString(); string partCode = lkPartname.EditValue.ToString(); string documentType = lkDocumenttype.EditValue.ToString(); if (!string.IsNullOrEmpty(typeName) && !string.IsNullOrEmpty(documentType)) { bool flag = BUS_SanXuat.InputInout(ad_org_id, typeName, partCode, documentType, documentstatus); if (!flag) { MessageBox.Show("Dữ liệu đã tồn tại.\n Vui lòng loại bỏ dữ liệu đã có trước khi tạo mới.", "Không thành công", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { dtInout = BUS_SanXuat.GetInout(ad_org_id, dateEdit1.DateTime.Date.ToString("yyyy-MM-dd"), dateEdit2.DateTime.Date.ToString("yyyy-MM-dd")); grdInout.DataSource = dtInout; } } else { MessageBox.Show("Vui lòng chọn typename & loại chứng từ!", "Không thành công", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void frmQLSanLuong_Load(object sender, EventArgs e) { DataTable dt = new DataTable(); dt = BUS_SanXuat.GetTargetActualLine(deptID, dtpStart.DateTime.Date.ToString("yyyy-MM-dd"), dtpEnd.DateTime.Date.ToString("yyyy-MM-dd")); grdTargetActualLine.DataSource = dt; }
private void simpleButton1_Click(object sender, EventArgs e) { splashScreenManager2.ShowWaitForm(); dt = BUS_SanXuat.GetTargetActualLine(deptID, dtpStart.DateTime.Date.ToString("yyyy-MM-dd"), dtpEnd.DateTime.Date.ToString("yyyy-MM-dd")); grdTargetActualLine.DataSource = dt; splashScreenManager2.CloseWaitForm(); }
public frmNhSanLuong(string ad_user_id, string ad_org_id, DataTable dtProcess) { InitializeComponent(); dateEdit1.EditValue = DateTime.Now.Date; dateEdit2.EditValue = DateTime.Now.Date; this.ad_user_id = ad_user_id; this.ad_org_id = ad_org_id; this.dtProcess = dtProcess; dtboPhan = BUS_BoPhan.LoadBoPhan(ad_org_id); utility.SearchProcess(this.Controls, dtProcess); dtInout = BUS_SanXuat.GetInout(ad_org_id, dateEdit1.DateTime.Date.ToString("yyyy-MM-dd"), dateEdit2.DateTime.Date.ToString("yyyy-MM-dd")); dtTypename = BUS_SanXuat.LoadTypename(); dtPartname = BUS_SanXuat.LoadPartname(); dtRecentTypePart = BUS_SanXuat.LoadRecentTypePart(ad_org_id); dtDocument = BUS_SanXuat.LoadDocumenttype(); }
private void searchNgay_Click(object sender, EventArgs e) { splashScreenManager5.ShowWaitForm(); if (dateEdit.DateTime.Date != null) { // Add a title to the chart (if necessary). chartControl1.Titles.Clear(); chartTitle1.Text = "BIỂU ĐỒ SẢN LƯỢNG HẰNG NGÀY\n(" + dateEdit.DateTime.ToString("dd/MM/yyyy") + ")"; chartTitle1.Font = new Font("Times New Roman", 15, FontStyle.Bold); chartControl1.Titles.Add(chartTitle1); dtChart1 = BUS_SanXuat.ChartQtyDaily(dateEdit.DateTime.ToString("yyyy-MM-dd"), lkBoPhanNgay.EditValue.ToString()); DateTime seletedDay = dateEdit.DateTime; DateTime previousSelectedDay = seletedDay.AddDays(-1); lblQtyNgay.Text = "Sản lượng ngày trước: " + BUS_SanXuat.ChartQtyTotal(previousSelectedDay.ToString("yyyy-MM-dd"), previousSelectedDay.ToString("yyyy-MM-dd"), lkBoPhanNgay.EditValue.ToString()); CreateChart1(dtChart1); } splashScreenManager5.CloseWaitForm(); }
public frmInoutLine(DataTable dtInout, DataTable dtProcess) { InitializeComponent(); this.dtInout = dtInout; this.dtProcess = dtProcess; m_inout_id = dtInout.Rows[0][0].ToString(); ad_org_id = dtInout.Rows[0][2].ToString(); document_type_code = dtInout.Rows[0][6].ToString(); txtDocumentno.Text = dtInout.Rows[0][1].ToString(); txtDeptname.Text = dtInout.Rows[0][3].ToString(); documentStatus = dtInout.Rows[0][12].ToString(); txtDocumentstatus.Text = documentStatus; txtDocumenttype.Text = dtInout.Rows[0][9].ToString(); txtInouttime.Text = dtInout.Rows[0][10].ToString(); txtTypename.Text = dtInout.Rows[0][5].ToString(); txtPartname.Text = dtInout.Rows[0][7].ToString(); dtInput = BUS_SanXuat.LoadInputPeriod(ad_org_id); utility.SearchProcess(this.Controls, dtProcess); }
private void frmInoutLine_Load(object sender, EventArgs e) { if (string.Compare(document_type_code, "ITG") == 0) { lkInputProcess(false); } else { lkInputProcess(false); } dtInoutLine = BUS_SanXuat.GetInoutLine(m_inout_id); grdInoutLine.DataSource = dtInoutLine; groupControl3.Text = "Headcount ngày " + DateTime.Now.Date.ToString("dd/MM/yyyy"); dtAttendance = BUS_BaoCom.LoadAttendance(ad_org_id); txtTotal.Text = dtAttendance.Rows[0][1].ToString(); txtAttendance.Text = dtAttendance.Rows[0][2].ToString(); txtAbsent.Text = dtAttendance.Rows[0][3].ToString(); }
private void gridView_DoubleClick(object sender, EventArgs e) { if (gridView.RowCount > 0) { int rowHandle = gridView.FocusedRowHandle; object variable = gridView.GetRowCellValue(rowHandle, "documentno"); DataTable dt = new DataTable(); dt = BUS_SanXuat.GetInoutbydocumentno(variable.ToString()); //splashScreenManager1.ShowWaitForm(); frmInoutLine inoutLine = new frmInoutLine(dt, dtProcess); foreach (System.Windows.Forms.Form _mdi_child in this.MdiChildren) { if (inoutLine.Name == _mdi_child.Name) { _mdi_child.Close(); } } //inoutLine.MdiParent = this; inoutLine.ShowDialog(); //splashScreenManager1.CloseWaitForm(); } }
public frmQtyReport(string ad_user_id, string ad_org_id, DataTable dtProcess) { InitializeComponent(); dateEdit.DateTime = DateTime.Now; dateEdit1.DateTime = DateTime.Now; this.ad_user_id = ad_user_id; this.ad_org_id = ad_org_id; this.dtProcess = dtProcess; dtboPhan = BUS_BoPhan.LoadBoPhan(ad_org_id); utility.SearchProcess(this.Controls, dtProcess); dateEdit.DateTime = DateTime.Now; dateEdit1.DateTime = DateTime.Now; dateEdit2.DateTime = DateTime.Now; #region Chart control 1 // Create an empty Bar series and add it to the chart. chartControl1.Series.Add(series1); series1.View.Color = Color.Green; chartControl1.Series.Add(series2); series2.View.Color = Color.DarkGoldenrod; chartControl1.Series.Add(series3); series3.View.Color = Color.Red; //Show point view lable and customize it chartControl1.Series["Sản lượng mục tiêu"].LabelsVisibility = DevExpress.Utils.DefaultBoolean.True; SideBySideBarSeriesLabel label1 = chartControl1.Series["Sản lượng mục tiêu"].Label as SideBySideBarSeriesLabel; if (label1 != null) { label1.Position = BarSeriesLabelPosition.Top; } chartControl1.Series["Sản lượng thực tế"].LabelsVisibility = DevExpress.Utils.DefaultBoolean.True; SideBySideBarSeriesLabel label2 = chartControl1.Series["Sản lượng thực tế"].Label as SideBySideBarSeriesLabel; if (label2 != null) { label2.Position = BarSeriesLabelPosition.Top; } chartControl1.Series["Tỉ lệ đạt mục tiêu(%)"].LabelsVisibility = DevExpress.Utils.DefaultBoolean.True; SideBySideBarSeriesLabel label3 = chartControl1.Series["Tỉ lệ đạt mục tiêu(%)"].Label as SideBySideBarSeriesLabel; if (label3 != null) { label3.Position = BarSeriesLabelPosition.Top; } // Cast Diagram to the XYDiagram type. XYDiagram diagram = chartControl1.Diagram as XYDiagram; diagram.AxisY.Title.Visibility = DevExpress.Utils.DefaultBoolean.True; diagram.AxisY.Title.Text = "Sản lượng (k)"; diagram.AxisY.Title.Font = new Font("Times New Roman", 10, FontStyle.Regular); // Add a title to the chart (if necessary). chartTitle1.Text = "BIỂU ĐỒ SẢN LƯỢNG HẰNG NGÀY\n(" + DateTime.Now.ToString("dd/MM/yyyy") + ")"; chartTitle1.Font = new Font("Times New Roman", 15, FontStyle.Bold); chartControl1.Titles.Add(chartTitle1); // Control legend & position chartControl1.Legend.Visibility = DevExpress.Utils.DefaultBoolean.True; chartControl1.Legend.AlignmentHorizontal = LegendAlignmentHorizontal.Center; chartControl1.Legend.AlignmentVertical = LegendAlignmentVertical.BottomOutside; chartControl1.Legend.Direction = LegendDirection.LeftToRight; chartControl1.Legend.EquallySpacedItems = true; //Create secondary Y-Axis, and add them to the chart's diagram SecondaryAxisY myAxisY = new SecondaryAxisY("Y-Axis"); ((XYDiagram)chartControl1.Diagram).SecondaryAxesY.Add(myAxisY); //Assign series3 to the created axis ((LineSeriesView)series3.View).AxisY = myAxisY; //Customize the apperance of the secondary axis myAxisY.Title.Text = "Tỉ lệ đạt mục tiêu(%)"; myAxisY.Title.Visibility = DevExpress.Utils.DefaultBoolean.True; myAxisY.Title.TextColor = Color.Red; myAxisY.Title.Font = new Font("Times New Roman", 10, FontStyle.Regular); myAxisY.Label.TextColor = Color.Red; myAxisY.Color = Color.Red; #endregion #region Chart control 2 // Create an empty Bar series and add it to the chart. chartControl2.Series.Add(series4); series4.View.Color = Color.Green; chartControl2.Series.Add(series5); series5.View.Color = Color.DarkGoldenrod; chartControl2.Series.Add(series6); series6.View.Color = Color.Red; //Show point view lable and customize it chartControl2.Series["Sản lượng mục tiêu"].LabelsVisibility = DevExpress.Utils.DefaultBoolean.True; SideBySideBarSeriesLabel label4 = chartControl2.Series["Sản lượng mục tiêu"].Label as SideBySideBarSeriesLabel; if (label4 != null) { label4.Position = BarSeriesLabelPosition.Top; } chartControl2.Series["Sản lượng thực tế"].LabelsVisibility = DevExpress.Utils.DefaultBoolean.True; SideBySideBarSeriesLabel label5 = chartControl2.Series["Sản lượng thực tế"].Label as SideBySideBarSeriesLabel; if (label5 != null) { label5.Position = BarSeriesLabelPosition.Top; } //chartControl2.Series["Tỉ lệ đạt mục tiêu(%)"].LabelsVisibility = DevExpress.Utils.DefaultBoolean.True; //SideBySideBarSeriesLabel label6 = chartControl2.Series["Tỉ lệ đạt mục tiêu(%)"].Label as SideBySideBarSeriesLabel; //if (label6 != null) //{ // label6.Position = BarSeriesLabelPosition.Top; //} // Cast Diagram to the XYDiagram type. XYDiagram diagram2 = chartControl2.Diagram as XYDiagram; diagram2.AxisY.Title.Visibility = DevExpress.Utils.DefaultBoolean.True; diagram2.AxisY.Title.Text = "Sản lượng (k)"; diagram2.AxisY.Title.Font = new Font("Times New Roman", 10, FontStyle.Regular); // Add a title to the chart (if necessary). chartTitle2.Text = "BIỂU ĐỒ SẢN LƯỢNG HẰNG THÁNG\n(" + "01/" + DateTime.Now.ToString("MM/yyyy") + " - " + DateTime.Now.ToString("dd/MM/yyyy") + ")"; chartTitle2.Font = new Font("Times New Roman", 15, FontStyle.Bold); chartControl2.Titles.Add(chartTitle2); // Control legend & position chartControl2.Legend.Visibility = DevExpress.Utils.DefaultBoolean.True; chartControl2.Legend.AlignmentHorizontal = LegendAlignmentHorizontal.Center; chartControl2.Legend.AlignmentVertical = LegendAlignmentVertical.BottomOutside; chartControl2.Legend.Direction = LegendDirection.LeftToRight; chartControl2.Legend.EquallySpacedItems = true; //Create secondary Y-Axis, and add them to the chart's diagram SecondaryAxisY myAxisY2 = new SecondaryAxisY("Y-Axis2"); ((XYDiagram)chartControl2.Diagram).SecondaryAxesY.Add(myAxisY2); //Assign series3 to the created axis ((LineSeriesView)series6.View).AxisY = myAxisY2; //Customize the apperance of the secondary axis myAxisY2.Title.Text = "Tỉ lệ đạt mục tiêu(%)"; myAxisY2.Title.Visibility = DevExpress.Utils.DefaultBoolean.True; myAxisY2.Title.TextColor = Color.Red; myAxisY2.Title.Font = new Font("Times New Roman", 10, FontStyle.Regular); myAxisY2.Label.TextColor = Color.Red; myAxisY2.Color = Color.Red; #endregion dtChart1 = BUS_SanXuat.ChartQtyDaily(DateTime.Now.ToString("yyyy-MM-dd"), ad_org_id); DateTime today = DateTime.Today; DateTime yesterday = today.AddDays(-1); lblQtyNgay.Text = "Sản lượng ngày trước (k): " + BUS_SanXuat.ChartQtyTotal(yesterday.ToString("yyyy-MM-dd"), yesterday.ToString("yyyy-MM-dd"), ad_org_id); CreateChart1(dtChart1); dtChart2 = BUS_SanXuat.ChartQtyMonthly(DateTime.Now.ToString("yyyy-MM-") + "01", DateTime.Now.ToString("yyyy-MM-dd"), ad_org_id); DateTime currentMonth = DateTime.Today; DateTime lastMonth = currentMonth.AddMonths(-1); lblQtyMonth.Text = "Sản lượng tháng trước (k): " + BUS_SanXuat.ChartQtyTotal(lastMonth.ToString("yyyy-MM-") + "01", lastMonth.ToString("yyyy-MM-") + "31", ad_org_id); CreateChart2(dtChart2); }
private void search_Click(object sender, EventArgs e) { dtInout = BUS_SanXuat.GetInout(ad_org_id, dateEdit1.DateTime.Date.ToString("yyyy-MM-dd"), dateEdit2.DateTime.Date.ToString("yyyy-MM-dd")); grdInout.DataSource = dtInout; }