private void btnDelete_Click(object sender, EventArgs e) { try { int id = TextUtils.ToInt(grvDetail.GetFocusedRowCellValue(colWorkingID)); if (id == 0) { return; } if (MessageBox.Show("Bạn có chắc muốn xóa mục cần kiểm tra [" + grvDetail.GetFocusedRowCellValue(colWorkingName).ToString() + "] không?", TextUtils.Caption, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } WorkingBO.Instance.Delete(id); grvDetail.DeleteSelectedRows(); //Xóa các thằng con thuộc thằng cha này đi LibIE.ExcuteSQL(string.Format("EXEC spUpdateMultiProductWorking {0}, 2", id)); } catch (Exception ex) { MessageBox.Show(ex.Message, TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
void loadData() { string projectId = TextUtils.ToString(cboProject.EditValue); if (projectId == "") { return; } using (WaitDialogForm fWait = new WaitDialogForm("Vui lòng chờ trong giây lát...", "Đang load dữ liệu...")) { string sql = "spGetOrderOfProject '" + projectId + "'"; DataTable dt = LibQLSX.Select(sql); dt.Columns.Add("ChenhLech", typeof(decimal)); foreach (DataRow row in dt.Rows) { decimal totalVAT = TextUtils.ToDecimal(row["TotalVAT"]); string orderCode = TextUtils.ToString(row["OrderCode"]); decimal totalInvoice = 0; string sql1 = "select sum(T_XNTC.C_PSNO) FROM T_XNTC INNER JOIN T_DM_VUVIEC ON T_XNTC.FK_VUVIEC = T_DM_VUVIEC.PK_ID" + " WHERE (T_DM_VUVIEC.C_MA = '" + orderCode + "') AND (T_XNTC.FK_TKNO LIKE '133%')"; totalInvoice = TextUtils.ToDecimal(LibIE.ExcuteScalar(sql1)); row["ChenhLech"] = totalVAT - totalInvoice; } grdData.DataSource = dt; } }
private bool ValidateForm() { if (txtShipTo.Text.Trim() == "") { MessageBox.Show("Xin hãy nhập Đích", TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Stop); return(false); } string sql1 = ""; if (_ShipToModel.ID > 0) { sql1 = $"SELECT top 1 ID from ConfigShipTo WHERE ShipTo = N'{txtShipTo.Text.Trim()}' and ID <>'{_ShipToModel.ID}'"; } else { sql1 = $"SELECT top 1 ID from ConfigShipTo WHERE ShipTo = N'{txtShipTo.Text.Trim()}'"; } int id = TextUtils.ToInt(LibIE.ExcuteScalar(sql1)); if (id > 0) { MessageBox.Show("Đã tồn tại Đích", TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Stop); return(false); } return(true); }
private void LoadInfoSearch(int type = 0) { //string[] paraName = new string[2]; //object[] paraValue = new object[2]; if (type == 0) { _catID = TextUtils.ToInt(treeData.FocusedNode.GetValue(colIDTree)); } else { _catID = 0; } //paraName[0] = "@GroupID"; paraValue[0] = _catID; //paraName[1] = "@TextFilter"; paraValue[1] = txtName.Text.Trim(); DataTable arr = LibIE.LoadDataFromSP("spGetProductData" , "A" , new string[] { "@GroupID", "@TextFilter" } , new object[] { _catID, txtName.Text.Trim() } ); grdData.DataSource = arr; }
private void frmFCMdetail_Load(object sender, EventArgs e) { loadYear(); loadDepartment(); if (FCM.ID > 0) { txtProjectCode.Text = FCM.C_CODE; txtHopDong.Text = FCM.C_SOHOADON; cboMonth.SelectedIndex = FCM.C_MONTH; cboYear.SelectedItem = FCM.C_YEAR; txtTotalBX.EditValue = FCM.TotalBX; txtTotalHD.EditValue = FCM.TotalHD; txtTotalNC.EditValue = FCM.TotalNC; txtTotalPB.EditValue = FCM.TotalPB; txtTotalProfit.EditValue = FCM.TotalProfit; txtTotalReal.EditValue = FCM.TotalReal; txtTotalTPA.EditValue = FCM.TotalTPA; txtTotalTrienKhai.EditValue = FCM.TotalTrienKhai; txtTotalVAT.EditValue = FCM.TotalVAT; txtTotalVT.EditValue = FCM.TotalVT; DataTable dt = LibIE.Select("select * from V_DM_FCM_DETAIL where FK_FCM = " + FCM.ID); grdData.DataSource = dt; } this.Text += ": " + FCM.C_CODE; }
private void btnUpdateStepCode_Click(object sender, EventArgs e) { using (WaitDialogForm fWait = new WaitDialogForm("", "")) { LibIE.ExcuteSQL("exec spReUpdateProductWorkingStepCode"); } }
private bool ValidateForm() { if (cboProductGroupCode.EditValue == null) { MessageBox.Show("Xin hãy chọn Group.", TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Stop); return(false); } if (cboProductTypeCode.Text.Trim() == "") { MessageBox.Show("Xin hãy chọn loại sản phẩm.", TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Stop); return(false); } string sql1 = ""; if (formulaModel.ID > 0) { sql1 = $"SELECT top 1 ID from ConfigFormula WHERE ProductTypeCode = N'{cboProductTypeCode.Text.Trim()}' and ProductGroupID={cboProductGroupCode.EditValue} and ID <>'{formulaModel.ID}'"; } else { sql1 = $"SELECT top 1 ID from ConfigFormula WHERE ProductTypeCode = '{cboProductTypeCode.Text.Trim()}' and ProductGroupID={cboProductGroupCode.EditValue}"; } int id = TextUtils.ToInt(LibIE.ExcuteScalar(sql1)); if (id > 0) { MessageBox.Show("Đã tồn tại loại sản phẩm", TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Stop); return(false); } return(true); }
void loadPhongBan() { string sql = "SELECT [PK_ID],[C_MA],[C_MOTA] FROM [tanphat].[dbo].[T_DM_PHANXUONG] order by [C_MA]"; DataTable dt = LibIE.Select(sql); grdPhongBan.DataSource = dt; }
void loadKMP() { string sql = "SELECT [PK_ID],[C_MA],[C_MOTA] FROM [tanphat].[dbo].[T_DM_KMP] order by [C_MA]"; DataTable dt = LibIE.Select(sql); grdData.DataSource = dt; }
private void btnPush_Click(object sender, EventArgs e) { string kmpCode = TextUtils.ToString(grvData.GetFocusedRowCellValue(colCode)); string phongbanCode = TextUtils.ToString(grvPhongBan.GetFocusedRowCellValue(colPBCode)); if (kmpCode == "" || phongbanCode == "") { return; } string sql = "SELECT top 1 * from V_DM_PHANXUONG_KMP_LINK where C_MA = '" + kmpCode + "' order by [C_MA]"; DataTable dt = LibIE.Select(sql); if (dt.Rows.Count > 0) { //MessageBox.Show("Khoản mục phí này đã được gán cho phòng (" + TextUtils.ToString(dt.Rows[0]["PHANXUONG_MA"]) + " - " + TextUtils.ToString(dt.Rows[0]["PHANXUONG_TEN"]) + ")" // , TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Stop); //return; int id = TextUtils.ToInt(dt.Rows[0]["ID"]); T_DM_PHANXUONG_KMP_LinkModel link = (T_DM_PHANXUONG_KMP_LinkModel)T_DM_PHANXUONG_KMP_LinkBO.Instance.FindByPK(id); link.PK_KMP = TextUtils.ToInt(grvData.GetFocusedRowCellValue(colID)); link.PK_PHANXUONG = TextUtils.ToInt(grvPhongBan.GetFocusedRowCellValue(colPBID)); T_DM_PHANXUONG_KMP_LinkBO.Instance.Update(link); } else { T_DM_PHANXUONG_KMP_LinkModel link = new T_DM_PHANXUONG_KMP_LinkModel(); link.PK_KMP = TextUtils.ToInt(grvData.GetFocusedRowCellValue(colID)); link.PK_PHANXUONG = TextUtils.ToInt(grvPhongBan.GetFocusedRowCellValue(colPBID)); T_DM_PHANXUONG_KMP_LinkBO.Instance.Insert(link); } loadLink(); }
private void btnDelete_Click(object sender, EventArgs e) { if (treeData.DataSource == null) { return; } int id = (int)treeData.Selection[0].GetValue(colIDTree); if (id == 0) { return; } int pkKMP = TextUtils.ToInt(grvData.GetFocusedRowCellValue(colID)); if (MessageBox.Show("Bạn có chắc muốn xóa chi phí [" + TextUtils.ToInt(grvData.GetFocusedRowCellValue(colLinkName)) + "] ra khỏi nhóm không?", TextUtils.Caption, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } string sql = "update [T_DM_KMP] set [FK_GROUP] = 0 where [PK_ID] = " + pkKMP; LibIE.ExcuteSQL(sql); MessageBox.Show("Khoản mục phí ra khỏi nhóm thành công.", TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Information); loadLink(); }
private void btnAdd_Click(object sender, EventArgs e) { if (treeData.DataSource == null) { return; } int id = TextUtils.ToInt(treeData.Selection[0].GetValue(colIDTree)); if (id == 0) { return; } int count = 0; foreach (int i in grvData.GetSelectedRows()) { int pkKMP = TextUtils.ToInt(grvData.GetRowCellValue(i, colID)); string sql = "update [T_DM_KMP] set [FK_GROUP] = " + id + " where [PK_ID] = " + pkKMP; LibIE.ExcuteSQL(sql); count++; } if (count > 0) { //MessageBox.Show("Thêm khoản mục phí vào nhóm thành công.", TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Information); loadLink(); } }
void LoadCBTo() { DataTable dt = LibIE.Select($"SELECT * FROM dbo.ProductGroup where ID <> {GroupID}"); Check.DataSource = dt; Check.DisplayMember = "ProductGroupName"; Check.ValueMember = "ID"; }
void loadData() { DataTable dt = LibIE.LoadDataFromSP("spGetHistoryCheckOrderDataDetailH", "A" , new string[] { "orderCode" } , new object[] { _OrderCode }); int count = dt.Columns.Count; if (count > 9) { string RealValue1 = Lib.ToString(dt.Columns[9]); colRealValue1.FieldName = RealValue1; colRealValue1.Caption = RealValue1; } else { colRealValue1.Visible = false; } if (count > 10) { string realvalue2 = Lib.ToString(dt.Columns[10]); colRealValue2.FieldName = realvalue2; colRealValue2.Caption = realvalue2; } else { colRealValue2.Visible = false; } if (count > 11) { string realvalue3 = Lib.ToString(dt.Columns[11]); colRealValue3.FieldName = realvalue3; colRealValue3.Caption = realvalue3; } else { colRealValue3.Visible = false; } if (count > 12) { string realvalue4 = Lib.ToString(dt.Columns[12]); colRealValue4.FieldName = realvalue4; colRealValue4.Caption = realvalue4; } else { colRealValue4.Visible = false; } if (count > 13) { string realvalue5 = Lib.ToString(dt.Columns[13]); colRealValue5.FieldName = realvalue5; colRealValue5.Caption = realvalue5; } else { colRealValue5.Visible = false; } grdData.DataSource = dt; }
void loadLink() { int phongBanID = TextUtils.ToInt(grvPhongBan.GetFocusedRowCellValue(colPBID)); string sql = "SELECT [ID],[C_MA],[C_MOTA] from V_DM_PHANXUONG_KMP_LINK where PK_PHANXUONG = " + phongBanID + " order by [C_MA]"; DataTable dt = LibIE.Select(sql); grdLink.DataSource = dt; }
void loadCbProductStepCode() { DataTable dt = LibIE.Select(@"select DISTINCT ProductStepCode from dbo.ProductStep "); cbbProductStepCode.DataSource = dt; cbbProductStepCode.DisplayMember = "ProductStepCode"; //cbbProductStepCode.ValueMember = "ID"; }
void loadLink() { int groupID = TextUtils.ToInt(treeData.FocusedNode.GetValue(colIDTree)); string sql = "SELECT [PK_ID],[C_MA],[C_MOTA] from T_DM_KMP where FK_GROUP = " + groupID + " order by [C_MA]"; DataTable dt = LibIE.Select(sql); grdLink.DataSource = dt; }
void loadData() { DataTable dt = LibIE.LoadDataFromSP("spFindDataCD1", "A" , new string[] { "@TextFind" } , new object[] { txtFindText.Text.Trim() }); grdData.DataSource = dt; }
void loadData() { DataTable dt = LibIE.LoadDataFromSP("spGetHistoryCheckDataDetail", "A" , new string[] { "QRCode" } , new object[] { QRCode }); grdData.DataSource = dt; }
void LoadCBFrom() { DataTable dt = LibIE.Select($"SELECT * FROM dbo.ProductGroup where ID = {GroupID}"); cboGroup.Properties.DataSource = dt; cboGroup.Properties.DisplayMember = "ProductGroupName"; cboGroup.Properties.ValueMember = "ID"; cboGroup.EditValue = TextUtils.ToString(dt.Rows[0]["ID"]); }
void loadGroup() { DataTable dt = LibIE.Select("SELECT * FROM dbo.ProductGroup WITH(NOLOCK)"); cboGroup.Properties.DataSource = dt; cboGroup.Properties.DisplayMember = "ProductGroupName"; cboGroup.Properties.ValueMember = "ID"; }
private void btnReloadData_Click(object sender, EventArgs e) { using (WaitDialogForm fWait = new WaitDialogForm("Vui lòng chờ trong giây lát...", "Đang load dữ liệu...")) { string sql = "exec spReportChiPhi_DoanhThu " + TextUtils.ToInt(cboYear.SelectedItem) + ", '" + TextUtils.ToString(cboPhongBan.EditValue) + "'"; DataTable dtData = LibIE.Select(sql); grdData.DataSource = dtData; } }
void loadcboProductGroup() { DataTable dt = new DataTable(); dt = LibIE.Select("SELECT * FROM ProductGroup"); cboProductGroupCode.Properties.DisplayMember = "ProductGroupName"; cboProductGroupCode.Properties.ValueMember = "ID"; cboProductGroupCode.Properties.DataSource = dt; }
private void btnSave_Click(object sender, EventArgs e) { try { using (WaitDialogForm fWait = new WaitDialogForm("Please Wait...", "Processing Data")) { ProductGroup.ProductGroupCode = txtCode.Text.Trim(); ProductGroup.ProductGroupName = txtName.Text.Trim(); if (ProductGroup.ID <= 0) { ProductGroup.ID = (int)ProductGroupBO.Instance.Insert(ProductGroup); } else { ProductGroupBO.Instance.Update(ProductGroup); } CurentNode = ProductGroup.ID; for (int i = 0; i < arrStep.Count; i++) { _STT = Lib.ToInt(grvData.GetRowCellValue(i, colSortOrder)); _Name = Lib.ToString(grvData.GetRowCellValue(i, colName)); _Des = Lib.ToString(grvData.GetRowCellValue(i, colDes)); WorkingStepModel step = (WorkingStepModel)arrStep[i]; int type = 0; if (step.ID <= 0) { step.ProductGroupID = ProductGroup.ID; step.ID = (int)WorkingStepBO.Instance.Insert(step); type = 1; //Thêm step vào các sản phẩm thuộc nhóm này } else { //string sql= $"SELECT TOP 1 ws.ID FROM dbo.WorkingStep ws JOIN dbo.ProductStep ps ON ws.ID = ps.WorkingStepID WHERE WorkingStepID = {step.ID} and ws.WorkingStepCode = N'{_Name}' and ws.Description = N'{_Des}' and ws.SortOrder ='{_STT}'"; //int id = Lib.ToInt(LibIE.ExcuteScalar(sql)); //if (id == 0) //{ WorkingStepBO.Instance.Update(step); type = 2; // type = 1; //Cập nhật vào các sản phẩm thuộc nhóm này //} } LibIE.ExcuteProcedure("spUpdateProductStep_ByWorkingStep" , new string[] { "@WorkingStepID", "@Type" } , new object[] { step.ID, type }); } DialogResult = DialogResult.OK; } } catch (Exception ex) { MessageBox.Show(ex.Message, TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
void loadcboProductType() { DataTable dt = new DataTable(); dt = LibIE.Select(string.Format($"SELECT DISTINCT ProductTypeCode FROM dbo.Product where ProductGroupID='{cboProductGroupCode.EditValue}'order by ProductTypeCode")); cboProductTypeCode.DataSource = dt; cboProductTypeCode.DisplayMember = "ProductTypeCode"; cboProductTypeCode.Text = ""; }
void loadPhongBan() { string sql = "SELECT [PK_ID],[C_MA],[C_MOTA] FROM [T_DM_PHANXUONG] order by [C_MA]"; DataTable dt = LibIE.Select(sql); cboPhongBan.Properties.DataSource = dt; cboPhongBan.Properties.DisplayMember = "C_MOTA"; cboPhongBan.Properties.ValueMember = "C_MA"; }
void loadStep() { DataTable dt = new DataTable(); dt = LibIE.Select(string.Format("SELECT * FROM dbo.ProductStep WHERE ProductID = {0} ORDER BY SortOrder", ProductID)); cboStep.Properties.DataSource = dt; cboStep.Properties.DisplayMember = "ProductStepCode"; cboStep.Properties.ValueMember = "ID"; }
bool ValidateForm() { if (txtProjectCode.Text.Trim() == "") { MessageBox.Show("Không tìm thấy mã dự án.", TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Stop); return(false); } else { int id = TextUtils.ToInt(LibIE.ExcuteScalar("select top 1 ID from T_DM_FCM where [C_CODE] = '" + txtProjectCode.Text.Trim() + "'")); if (id > 0) { MessageBox.Show("FCM này đã được tồn tại trong cơ sở dữ liệu.", TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Stop); return(false); } } if (TextUtils.ToInt(cboPhongBan.SelectedValue) == 0) { MessageBox.Show("Bạn phải chọn một phòng ban phụ trách.", TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Stop); return(false); } if (TextUtils.ToInt(cboYear.SelectedItem) == 0) { MessageBox.Show("Bạn phải chọn một năm.", TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Stop); return(false); } if (cboMonth.SelectedIndex < 1) { MessageBox.Show("Bạn phải chọn một tháng trong năm.", TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Stop); return(false); } if (TextUtils.ToDecimal(txtTotalHD.EditValue) == 0 || TextUtils.ToDecimal(txtTotalProfit.EditValue) == 0) { MessageBox.Show("Đây không phải là dữ liệu FCM.", TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Stop); return(false); } if (TextUtils.ToDecimal(txtTotalVT.EditValue) == 0) { MessageBox.Show("Đây không phải là dữ liệu FCM.", TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Stop); return(false); } int dtcp = TextUtils.ToInt(LibIE.ExcuteScalar("SELECT TOP 1 [PK_ID] FROM [T_DM_DTCP] where C_MA = '" + txtProjectCode.Text.Trim() + "'")); if (dtcp <= 0) { MessageBox.Show("Dự án này chưa có trên IEnter.", TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Stop); return(false); } return(true); }
private void btnCopy_Click(object sender, EventArgs e) { string GroupIDNew = TextUtils.ToString(Check.ValueMember); string[] arrListStr = GroupIDNew.Split(','); for (int i = 0; i < arrListStr.Length; i++) { LibIE.ExcuteSQL(string.Format($"EXEC spCopyALLGroupProducts @GroupID={GroupID}, @GroupNewID={arrListStr[i]}")); } }
void loadFCM() { //string sql = "select ID, [C_CODE] from T_DM_FCM"; string sql = "SELECT * FROM [T_DM_DTCP] where ([C_MA] like 'F%' or [C_MA] like 'S%' or [C_MA] like 'T%') and len(C_Ma) = 9 "; DataTable dt = LibIE.Select(sql); cboFCM.Properties.DataSource = dt; cboFCM.Properties.DisplayMember = "C_MA"; cboFCM.Properties.ValueMember = "C_MA"; }