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; }
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; }
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; }
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(); }
void LoadCBTo() { DataTable dt = LibIE.Select($"SELECT * FROM dbo.ProductGroup where ID <> {GroupID}"); Check.DataSource = dt; Check.DisplayMember = "ProductGroupName"; Check.ValueMember = "ID"; }
void loadCbProductStepCode() { DataTable dt = LibIE.Select(@"select DISTINCT ProductStepCode from dbo.ProductStep "); cbbProductStepCode.DataSource = dt; cbbProductStepCode.DisplayMember = "ProductStepCode"; //cbbProductStepCode.ValueMember = "ID"; }
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 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 loadGroup() { DataTable dt = LibIE.Select("SELECT * FROM dbo.ProductGroup WITH(NOLOCK)"); cboGroup.Properties.DataSource = dt; cboGroup.Properties.DisplayMember = "ProductGroupName"; cboGroup.Properties.ValueMember = "ID"; }
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 loadcboProductGroup() { DataTable dt = new DataTable(); dt = LibIE.Select("SELECT * FROM ProductGroup"); cboProductGroupCode.Properties.DisplayMember = "ProductGroupName"; cboProductGroupCode.Properties.ValueMember = "ID"; cboProductGroupCode.Properties.DataSource = dt; }
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"; }
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"; }
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 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 loadCombo() { DataTable tbl = LibIE.Select(@"SELECT ID,C_Code+'-'+C_Name as C_Code FROM T_DM_KMP_GROUP WITH(NOLOCK)"); if (tbl == null) { return; } TextUtils.PopulateCombo(leParentCat, tbl.Copy(), "C_Code", "ID", "--Cấp lớn nhất--"); }
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"; }
void loadStep() { int groupID = TextUtils.ToInt(cboGroup.EditValue); DataTable dt = new DataTable(); if (groupID > 0) { dt = LibIE.Select(string.Format("SELECT * FROM dbo.WorkingStep WHERE ProductGroupID = {0} AND (IsDeleted = 0 OR IsDeleted IS NULL) ORDER BY SortOrder", groupID)); } grdData.DataSource = dt; }
private void loadData() { try { DataTable tbl = LibIE.Select("SELECT * FROM ProductType WITH(NOLOCK)"); grdData.DataSource = tbl; } catch (Exception) { } }
private void button1_Click(object sender, EventArgs e) { string ProductGroup = Lib.ToString(grvData.GetFocusedRowCellValue(colProductGroupCode)); DataTable dt = LibIE.Select($"SELECT DISTINCT ProductTypeCode FROM dbo.ConfigFormula WHERE ProductGroupCode='{ProductGroup}'"); string ProductTypeCode = ""; for (int i = 0; i < dt.Rows.Count; i++) { ProductTypeCode = Lib.ToString(dt.Rows[i]["ProductTypeCode"]); LibIE.ExcuteProcedure("spGetInsertFormula", new string[] { "@ProductTypeCode", "@ProductGroupCode" }, new object[] { ProductTypeCode, ProductGroup }); } }
private void frmOrderTransfer_Load(object sender, EventArgs e) { this.Text += " " + OrderCode; DataTable dt = new DataTable(); //dt = LibQLSX.Select("select ROW_NUMBER() OVER(ORDER BY OrderId DESC) AS STT, * from vOrderMoneyTransfer with(nolock) where OrderCode = '" + OrderCode + "'"); //grdData.DataSource = dt; string sql = "SELECT * FROM V_XNTC_VUVIEC WHERE (C_MA = '" + OrderCode + "') AND (FK_TKCO LIKE '111%' OR FK_TKCO LIKE '112%') AND (FK_TKNO LIKE '331%') and C_KHACHHANG_MA = '" + SupplierCode + "'"; dt = LibIE.Select(sql); grdData.DataSource = dt; }
private void frmProductGroup_Load(object sender, EventArgs e) { txtCode.Text = ProductGroup.ProductGroupCode; txtName.Text = ProductGroup.ProductGroupName; loadData(); DataTable dt = LibIE.Select("SELECT * FROM ProductGroup"); cbCopy.Properties.DataSource = dt; cbCopy.Properties.DisplayMember = "ProductGroupName"; cbCopy.Properties.ValueMember = "ID"; }
void loadStep() { int groupID = TextUtils.ToInt(cboGroup.EditValue); DataTable dt = new DataTable(); if (groupID > 0) { dt = LibIE.Select(string.Format("SELECT * FROM dbo.WorkingStep WHERE ProductGroupID = {0} ORDER BY SortOrder", groupID)); } cboStep.Properties.DataSource = dt; cboStep.Properties.DisplayMember = "WorkingStepCode"; cboStep.Properties.ValueMember = "ID"; }
void loadDepartment() { DataTable dt = LibIE.Select("SELECT [PK_ID],[C_MA],[C_MOTA] FROM [tanphat].[dbo].[T_DM_PHANXUONG]"); repositoryItemSearchLookUpEdit1.DataSource = dt; repositoryItemSearchLookUpEdit1.ValueMember = "PK_ID"; repositoryItemSearchLookUpEdit1.DisplayMember = "C_MOTA"; //DataTable dt1 = LibIE.Select("SELECT [PK_ID],[C_MA],[C_MOTA] FROM [tanphat].[dbo].[T_DM_PHANXUONG] where PK_ID = 40 or PK_ID = 71"); //DataRow row = dt1.NewRow(); //dt1.Rows.InsertAt(row, 0); //cboPhongBan.DataSource = dt1; //cboPhongBan.DisplayMember = "C_MOTA"; //cboPhongBan.ValueMember = "PK_ID"; }
private void grvData_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { string orderCode = TextUtils.ToString(grvData.GetFocusedRowCellValue(colOrderCode)); string sql = "SELECT T_XNTC.PK_ID, T_XNTC.FK_CHUNGTU, T_XNTC.C_SOPHIEU,[C_DIENGIAI] ,T_XNTC.C_NGAYLAP, T_XNTC.C_NGAYCT, T_XNTC.C_SOCT, " + " T_XNTC.FK_PHONGBAN, T_XNTC.FK_TKNO, T_XNTC.FK_TKCO, T_XNTC.C_PSNO, T_XNTC.C_PSCO, T_XNTC.FK_VUVIEC, " + " T_XNTC.FK_USER, T_XNTC.FK_ORDER, T_XNTC.C_PSNO2, T_XNTC.C_PSCO2, T_XNTC.C_TIENTHUE2, T_DM_VUVIEC.C_MA, T_XNTC.C_NGUOILH" + ",InvoiceNumber = (CASE WHEN [C_DIENGIAI2] IS NULL OR [C_DIENGIAI2] = '' THEN (case when [C_SOHDGTGT] IS NULL OR [C_SOHDGTGT] = '' THEN [C_DIENGIAI] ELSE [C_SOHDGTGT] END) ELSE [C_DIENGIAI2] END)" + " 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%')"; DataTable dt = LibIE.Select(sql); grdInvoice.DataSource = dt; }
/// <summary> /// Validate trước khi cất dữ liệu /// </summary> /// <returns></returns> private bool ValidateForm() { if (cboGroup.EditValue == null) { MessageBox.Show("Xin hãy chọn một nhóm sản phẩm.", TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Stop); return(false); } if (string.IsNullOrEmpty(txtProductTypeCode.Text.Trim())) { MessageBox.Show("Xin hãy nhập loại sản phẩm.", TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Stop); return(false); } if (txtCode.Text.Trim() == "") { MessageBox.Show("Xin hãy điền mã sản phẩm.", TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Stop); return(false); } else { DataTable dt; if (Product.ID > 0) { dt = LibIE.Select("select top 1 ProductCode from Product where ProductCode = '" + txtCode.Text.Trim() + "' and ID <> " + Product.ID); } else { dt = LibIE.Select("select top 1 ProductCode from Product where ProductCode = '" + txtCode.Text.Trim() + "'"); } if (dt != null) { if (dt.Rows.Count > 0) { MessageBox.Show("Mã này đã tồn tại!", TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Stop); return(false); } } } if (txtDes.Text.Trim() == "") { MessageBox.Show("Xin hãy điền tên sản phẩm.", TextUtils.Caption, MessageBoxButtons.OK, MessageBoxIcon.Stop); return(false); } return(true); }
private void btnLoadData_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 dCode = TextUtils.ToString(cboPhongBan.EditValue); int year = TextUtils.ToInt(cboYear.SelectedItem); int month = cboMonth.SelectedIndex; string sqlStart = "SELECT a.PK_ID, a.C_MA, a.C_MOTA, a.[GroupCode] +'-'+ a.[GroupName] as [GroupCode]"; string sqlEnd = " FROM V_DM_KMP a where isnull([FK_GROUP],0) > 0"; string sql = ""; DataTable dt = LibIE.Select("select distinct [C_CODE] from [V_DM_FCM_DETAIL] where [C_YEAR] = " + year + " and [C_MONTH] = " + month); foreach (DataRow row in dt.Rows) { string p = TextUtils.ToString(row["C_CODE"]); sql += " ,[" + p + "] = (select SUM(ISNULL(C_PRICE,0)) from V_DM_FCM_DETAIL where C_CODE = '" + p + "' and (C_PHANXUONG_MA = '" + dCode + "') and FK_KMP = a.PK_ID and C_Month = " + month + " and C_Year = " + year + ") "; } string str = sqlStart + sql + sqlEnd; DataTable dtData = LibIE.Select(str); dtData.Columns["PK_ID"].Caption = "PK_ID"; dtData.Columns["C_MA"].Caption = "Mã"; dtData.Columns["C_MOTA"].Caption = "Tên"; dtData.Columns["GroupCode"].Caption = "Nhóm"; grvData.PopulateColumns(dtData); grdData.DataSource = dtData; grvData.Columns[0].Visible = false; grvData.Columns[3].GroupIndex = 0; grvData.Columns[3].Visible = false; for (int i = 4; i < dtData.Columns.Count; i++) { grvData.Columns[i].DisplayFormat.FormatType = FormatType.Numeric; grvData.Columns[i].DisplayFormat.FormatString = "n0"; } grvData.BestFitColumns(); grvData.ExpandAllGroups(); grvData.Columns[1].Fixed = FixedStyle.Left; grvData.Columns[2].Fixed = FixedStyle.Left; } }
void loadWorking() { int stepID = TextUtils.ToInt(grvData.GetFocusedRowCellValue(colStepID)); DataTable dt = new DataTable(); if (chkAll.Checked) { dt = LibIE.Select(string.Format($"select w.*,(CAST(ws.SortOrder as nvarchar)+'-'+cast(ws.WorkingStepCode as nvarchar)) as WorkingStepCodes, case when w.CheckValueType=1 then N'Số' when w.CheckValueType = 2 then N'Ký tự' when w.CheckValueType = 0 then '' END as CheckValueTypes from Working w left join WorkingStep ws on w.WorkingStepID = ws.ID Left join ProductGroup pg on ws.ProductGroupID = pg.ID where ProductGroupID = '{cboGroup.EditValue}' Order by w.SortOrder")); } else { if (stepID > 0) { dt = LibIE.Select(string.Format("SELECT w.* ,case when w.CheckValueType=1 then N'Số' when w.CheckValueType = 2 then N'Ký tự' when w.CheckValueType = 0 then '' END as CheckValueTypes FROM dbo.Working w WHERE WorkingStepID = {0} ORDER BY SortOrder", stepID)); } } grdDetail.DataSource = dt; }
void loadTree() { try { DataTable tbl = LibIE.Select("Select * from ProductGroup with(nolock) order by ProductGroupCode"); treeData.DataSource = tbl; treeData.KeyFieldName = "ID"; treeData.PreviewFieldName = "ProductGroupName"; treeData.ExpandAll(); DevExpress.XtraTreeList.Nodes.TreeListNode currentNode = treeData.FindNodeByFieldValue("ID", _curentNode); treeData.SetFocusedNode(currentNode); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
void loadLink() { int pk_KMP = TextUtils.ToInt(grvData.GetFocusedRowCellValue(colID)); if (pk_KMP == 0) { return; } string sql = "select * from V_DM_PHANXUONG_KMP where PK_KMP = " + pk_KMP + " order by [C_MA]"; DataTable dtLink = LibIE.Select(sql); if (dtLink.Rows.Count > 0) { grdLink.DataSource = dtLink; } else { string sql1 = "select 0.00 as TYLE, 0 as ID, PK_ID as PK_PHANXUONG, C_MA, C_MOTA from T_DM_PHANXUONG order by [C_MA]"; grdLink.DataSource = LibIE.Select(sql1); } }