Exemple #1
0
        void loadImage()
        {
            DataTable dt = LibQLSX.Select("select * from ProjectProblemImage with(nolock) where ProjectProblemID = " + ProjectProblem.ID);

            grvImage.AutoGenerateColumns = false;
            grvImage.DataSource          = dt;
        }
Exemple #2
0
        void loadData(string year)
        {
            //frmDesignSummaryManager_View_All
            string    sql = "";
            DataTable dt  = new DataTable();

            //if(TextUtils.HasPermission("frmDesignSummaryManager_View_All"))
            //{
            sql = "select * from vDesignSummary with(nolock) where [Year] = '" + year + "'";
            //}
            //else
            //{
            //    sql = "select * from vDesignSummary with(nolock) where [Year] = '" + year + "' and UpdatedBy = '" + Global.AppUserName + "'";
            //}
            dt = LibQLSX.Select(sql);
            grdData.DataSource = dt;
            if (_rownIndex >= grvData.RowCount)
            {
                _rownIndex = 0;
            }
            if (_rownIndex > 0)
            {
                grvData.FocusedRowHandle = _rownIndex;
            }
        }
Exemple #3
0
        void addItem(string projectId)
        {
            DataTable dtRi1 = LibQLSX.Select("spGetProblemOfProject '" + projectId + "'");

            _dtProjectProblem.Merge(dtRi1);
            grdData.DataSource = _dtProjectProblem;
        }
Exemple #4
0
        decimal countPart()
        {
            ConfigSystemModel model = (ConfigSystemModel)ConfigSystemBO.Instance.FindByAttribute("KeyName", "CanhBaoHanVeVT_period")[0];

            string sqlPart = "SELECT * FROM [vRequireBuyPart] with(nolock) where (status = 2) and [DateAboutE] is not null and ([DateAboutF] is null or [DateAboutF] = '')"
                             + " and datediff(dd,getdate(),DateAboutE)<= " + model.KeyValue + " and Account = '" + Global.AppUserName + "'";
            DataTable dtData = LibQLSX.Select(sqlPart);

            string sqlOut = "SELECT * FROM [vRequestOut] with(nolock) where ([ProposalStatus] = 2) and [DateAboutE] is not null and ([DateAboutF] is null or [DateAboutF] = '')"
                            + " and datediff(dd,getdate(),DateAboutE)<= " + model.KeyValue + " and Account = '" + Global.AppUserName + "'";
            DataTable dtOut = LibQLSX.Select(sqlOut);

            string sqlMaterial = "SELECT * FROM [vRequestMaterial] with(nolock) where ([ProposalStatus] = 2) and [DateAboutE] is not null and ([DateAboutF] is null or [DateAboutF] = '')"
                                 + " and datediff(dd,getdate(),DateAboutE) <= " + model.KeyValue + " and Account = '" + Global.AppUserName + "'";
            DataTable dtMaterial = LibQLSX.Select(sqlMaterial);

            if (dtMaterial.Rows.Count > 0)
            {
                dtData.Merge(dtMaterial);
            }
            if (dtOut.Rows.Count > 0)
            {
                dtData.Merge(dtOut);
            }

            return(dtData.Rows.Count);
        }
Exemple #5
0
        void loadGrid()
        {
            string    userId   = TextUtils.ToString(cboUser.EditValue);
            DataTable dtAction = LibQLSX.Select("select * from vProjectProblemActionUserLink with(nolock) where UserId = '" + userId + "'");

            grdData.DataSource = dtAction;
        }
        void loadGrid()
        {
            DataTable dt = TextUtils.Select("Select *,0 as Price,0 as TotalPrice,0 as PriceType from vBaiThucHanhModule with(nolock) where BaiThucHanhID = " + BaiThucHanh.ID);

            foreach (DataRow row in dt.Rows)
            {
                string code = row["Code"].ToString();
                try
                {
                    if (code.StartsWith("TPAD."))
                    {
                        DataTable dtPrice = TextUtils.LoadModulePriceTPAD(code, false);
                        row["Price"]      = TextUtils.ToInt(dtPrice.Compute("Sum(TotalPrice)", ""));
                        row["TotalPrice"] = TextUtils.ToInt(row["Qty"]) * TextUtils.ToInt(row["Price"]);
                        row["PriceType"]  = TextUtils.ToInt(dtPrice.Rows[0]["PriceType"]);
                    }
                    else
                    {
                        string    sql     = "select top 1 Price from [Parts] with(nolock) where Replace(PartsCode,' ','') = '" + code.Replace(" ", "") + "'";
                        DataTable dtPrice = LibQLSX.Select(sql);
                        row["Price"]      = TextUtils.ToInt(dtPrice.Rows[0][0]);
                        row["TotalPrice"] = TextUtils.ToInt(row["Qty"]) * TextUtils.ToInt(row["Price"]);
                        row["PriceType"]  = 1;
                    }
                }
                catch (Exception)
                {
                }
            }
            grdModule.DataSource = dt;
        }
Exemple #7
0
        void InsertLink()
        {
            DataTable dtItem = LibQLSX.Select("select * from C_QuotationDetail_SX where C_QuotationID = " + C_QuotationID);

            foreach (DataRow item in dtItem.Rows)
            {
                int groupID = TextUtils.ToInt(item["C_ProductGroupID"]);
                int id      = TextUtils.ToInt(item["ID"]);

                //if (groupID == 0)
                //{
                //    C_QuotationDetail_SXModel model = (C_QuotationDetail_SXModel)C_QuotationDetail_SXBO.Instance.FindByPK(id);
                //    C_CostQuotationItemLinkBO.Instance.DeleteByAttribute("C_QuotationDetail_SXID", id);
                //    model.TotalNC = 0;
                //    C_QuotationDetail_SXBO.Instance.Update(model);
                //}
                //else
                if (groupID > 0)
                {
                    string sql = "insert into [C_CostQuotationItemLinkNew] ([C_CostID],[C_QuotationDetail_SXID],[Price],[PersonNumber],[NumberDay],[TotalR],[IsDirect],[CostNCType])"
                                 + " select ID ," + id + " as [C_QuotationDetail_SXID], 0 as b, 0 as c, 0 as d, 0 as e, 1 as f, 'C' as g"
                                 + " from [C_Cost] m where m.IsDirectCost = 1 and ((select COUNT(ID) from [C_CostQuotationItemLinkNew] where [C_CostID] = m.ID and  [C_QuotationDetail_SXID] = " + id + ") = 0)";
                    LibQLSX.ExcuteSQL(sql);
                }
            }
        }
Exemple #8
0
        private void frmGetPriceForYCMVT_Load(object sender, EventArgs e)
        {
            loadUser();

            _dtItem = LibQLSX.Select("spGetPartWithYCMVT_All ''");
            //_dtItem.Columns.Add("PriceGN", typeof(decimal));
            //_dtItem.Columns.Add("ChenhLech", typeof(decimal));
            //_dtItem.Columns.Add("TotalChenhLech", typeof(decimal));
            //_dtItem.Columns.Add("DeliveryTime1", typeof(int));

            DataColumn col1 = new DataColumn();

            col1.DataType     = System.Type.GetType("System.Decimal");
            col1.ColumnName   = "ChenhLech";
            col1.DefaultValue = 50;
            col1.Expression   = "Price - PriceDM";
            _dtItem.Columns.Add(col1);

            DataColumn col2 = new DataColumn();

            col2.DataType     = System.Type.GetType("System.Decimal");
            col2.ColumnName   = "TotalChenhLech";
            col2.DefaultValue = 50;
            col2.Expression   = "TotalBuy*ChenhLech";
            _dtItem.Columns.Add(col2);

            grdData.DataSource = _dtItem;
        }
Exemple #9
0
        void loadData(string code)
        {
            string    sql = string.Format("select * from [vImportProduct] with(nolock) where [PartsCode] = '{0}' order by [ImportId] desc", code);
            DataTable dt  = LibQLSX.Select(sql);

            grdData.DataSource = dt;
        }
Exemple #10
0
        void addItem(string YCMVTCode)
        {
            DataTable dtRi1 = LibQLSX.Select("spGetPartWithYCMVT_All '" + YCMVTCode + "'");

            _dtItem.Merge(dtRi1);
            grdData.DataSource = _dtItem;
        }
Exemple #11
0
        DataTable loadPartOfYCMVT(string proposalCode)
        {
            DataTable Source = LibQLSX.Select("spGetPartWithYCMVT_All '" + proposalCode + "'");
            DataTable dt     = Source.Copy();

            dt.Rows.Clear();
            foreach (DataRow row in Source.Rows)
            {
                string  code           = TextUtils.ToString(row["PartsCode"]);
                decimal totalBuy       = TextUtils.ToDecimal(row["TotalBuy"]);
                decimal total          = TextUtils.ToDecimal(row["Total"]);
                decimal totalInventory = TextUtils.ToDecimal(row["TotalInventory"]);

                DataRow[] drs = dt.Select("PartsCode = '" + code + "'");
                if (drs.Length == 0)
                {
                    dt.ImportRow(row);
                }
                else
                {
                    drs[0]["TotalBuy"]       = TextUtils.ToDecimal(drs[0]["TotalBuy"]) + totalBuy;
                    drs[0]["Total"]          = TextUtils.ToDecimal(drs[0]["Total"]) + total;
                    drs[0]["TotalInventory"] = TextUtils.ToDecimal(drs[0]["TotalInventory"]) + totalInventory;
                }
            }
            return(dt);
        }
Exemple #12
0
 private void btnLoadPrice_Click(object sender, EventArgs e)
 {
     using (WaitDialogForm fWait = new WaitDialogForm("Vui lòng chờ trong giây lát", "Đang load giá..."))
     {
         foreach (DataRow item in _dtItem.Rows)
         {
             string    partCode     = TextUtils.ToString(item["PartsCode"]);
             string    sql1         = "exec spGetPriceOfPart '" + partCode + "'";
             DataTable dtOrderPrice = LibQLSX.Select(sql1);
             if (dtOrderPrice.Rows.Count > 0)
             {
                 item["PriceDM"]        = TextUtils.ToDecimal(dtOrderPrice.Rows[0]["Price"]);
                 item["DeliveryTimeDM"] = TextUtils.ToInt(dtOrderPrice.Rows[0]["DeliveryTime"]);
             }
             else
             {
                 item["PriceDM"]        = TextUtils.ToDecimal(item["Price"]);
                 item["DeliveryTimeDM"] = TextUtils.ToInt(item["DeliveryTime"]);
             }
             //item["ChenhLech"] = TextUtils.ToDecimal(item["Price"]) - TextUtils.ToDecimal(item["PriceDM"]);
             //item["TotalChenhLech"] = TextUtils.ToDecimal(item["TotalBuy"]) * TextUtils.ToDecimal(item["ChenhLech"]);
         }
         grdData.DataSource = _dtItem;
     }
 }
Exemple #13
0
        void loadItem()
        {
            string importId = TextUtils.ToString(grvDNNK.GetFocusedRowCellValue(colImportId));

            if (importId == "")
            {
                grdData.DataSource = null;
                return;
            }

            int type = TextUtils.ToInt(grvDNNK.GetFocusedRowCellValue(colImportType));

            using (WaitDialogForm fWait = new WaitDialogForm("Vui lòng chờ trong giây lát...", "Đang load danh sách vật tư..."))
            {
                _dtItem = new DataTable();
                if (type == 1)
                {
                    _dtItem = LibQLSX.Select("select *, ROW_NUMBER() OVER(ORDER BY [ProductPartsImportId]) AS STT from [vImportMaterial] with(nolock) where [ImportId] = '" + importId + "'");
                }
                else
                {
                    _dtItem = LibQLSX.Select("select *, ROW_NUMBER() OVER(ORDER BY [ProjectProductImportId]) AS STT from [vImportProduct] with(nolock) where [ImportId] = '" + importId + "'");
                }
                grdData.DataSource = _dtItem;
            }
        }
Exemple #14
0
        void loadData()
        {
            DataTable dt = LibQLSX.Select("select * from [CriteriaImport] with(nolock) where [Status] = 0 and [ProductPartsImportId] = '"
                                          + ProductPartsImportId + "' order by [CriteriaIndex]");

            grdData.DataSource = dt;
        }
Exemple #15
0
        void loadModuleLink()
        {
            string    moduleCode = TextUtils.ToString(grvModule.GetFocusedRowCellValue("FolderCode"));
            DataTable dtlink     = LibQLSX.Select("select * from vPartsConfigLink where Type = 2 and ModuleCode = '" + moduleCode + "'");

            grdModuleLink.DataSource = dtlink;
        }
Exemple #16
0
        void loadData()
        {
            string    sql = "exec spGetOrderRequirePaid";
            DataTable dt  = LibQLSX.Select(sql);

            grdYC.DataSource = dt;
        }
Exemple #17
0
        void loadGroupLink()
        {
            string    groupCode = TextUtils.ToString(grvGroup.GetFocusedRowCellValue("GroupCode"));
            DataTable dtlink    = LibQLSX.Select("select * from vPartsConfigLink where Type = 3 and GroupCode = '" + groupCode + "'");

            grdGroupLink.DataSource = dtlink;
        }
Exemple #18
0
        string loadNumber(PaymentTableModel paymentTable)
        {
            string numberPT = "";

            if (paymentTable.ID == 0)
            {
                string    current = "BKTT." + DateTime.Now.ToString("ddMMyy");
                DataTable dt      = LibQLSX.Select("select * from PaymentTable with(nolock) where Number like '%" + current + "%' order by ID desc");
                if (dt.Rows.Count > 0)
                {
                    string number = TextUtils.ToString(dt.Rows[0]["Number"]);
                    int    index  = TextUtils.ToInt(number.Split('.')[2]);
                    numberPT = current + "." + string.Format("{0:00}", index + 1);
                }
                else
                {
                    numberPT = current + ".01";
                }
            }
            else
            {
                numberPT = paymentTable.Number;
            }
            return(numberPT);
        }
        void loadDebt()
        {
            int       caseID = TextUtils.ToInt(grvData.GetFocusedRowCellValue(colID));
            DataTable dt     = LibQLSX.Select("select * from vCaseVoucherDebt with(nolock) where CaseID = " + caseID);

            grdDebt.DataSource = dt;
        }
Exemple #20
0
        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;
            }
        }
Exemple #21
0
        private void linkToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (grvData.SelectedRowsCount == 0)
            {
                return;
            }
            DataTable dt = LibQLSX.Select("select * from C_ProductGroup");

            foreach (int i in grvData.GetSelectedRows())
            {
                DataTable dtLink = LibQLSX.Select("select * from C_CostProductGroupLink where C_CostID = " + TextUtils.ToInt(grvData.GetRowCellValue(i, colID)));
                if (dtLink.Rows.Count > 0)
                {
                    MessageBox.Show("Đã được tạo");
                    continue;
                }
                foreach (DataRow row in dt.Rows)
                {
                    C_CostProductGroupLinkModel m = new C_CostProductGroupLinkModel();
                    m.C_CostID         = TextUtils.ToInt(grvData.GetRowCellValue(i, colID));
                    m.C_ProductGroupID = TextUtils.ToInt(row["ID"]);
                    C_CostProductGroupLinkBO.Instance.Insert(m);
                }
            }

            MessageBox.Show("OK");
        }
Exemple #22
0
 void loadHangGrid()
 {
     _dtHang = LibQLSX.Select("select * from vSupplierManufacturerLink WITH(NOLOCK) " +
                              "where SupplierId = '" + TextUtils.ToString(Supplier.SupplierId) + "'");
     grvHang.AutoGenerateColumns = false;
     grvHang.DataSource          = _dtHang;
 }
Exemple #23
0
        void loadGrid()
        {
            DataTable tbl = LibQLSX.Select("exec spGetAllProject");

            grdData.DataSource = null;
            grdData.DataSource = tbl;
        }
Exemple #24
0
        void loadPartsNotDMVT()
        {
            string    moduleCode = TextUtils.ToString(grvModule1.GetFocusedRowCellValue("FolderCode"));
            DataTable dtlink     = LibQLSX.Select("select * from vPartsNotDMVT where ModuleCode = '" + moduleCode + "'");

            grdLink.DataSource = dtlink;
        }
Exemple #25
0
        void addSuppliersManufacturerLink()
        {
            DataTable dt = LibQLSX.Select("SELECT     vRequirePartFull.SupplierId, Manufacturer.ManufacturerId"
                                          + " FROM vRequirePartFull INNER JOIN"
                                          + " Manufacturer ON vRequirePartFull.ManufacturerCode = Manufacturer.ManufacturerCode"
                                          + " order by vRequirePartFull.SupplierId");
            long count = 0;

            foreach (DataRow r in dt.Rows)
            {
                string supplierId     = TextUtils.ToString(r["SupplierId"]);
                string manufacturerId = TextUtils.ToString(r["ManufacturerId"]);
                if (supplierId == "" || manufacturerId == "")
                {
                    continue;
                }

                DataTable dtSuppliersManufacturerLink = LibQLSX.Select("select * from SuppliersManufacturerLink with(nolock) where SupplierId = '"
                                                                       + supplierId + "' and ManufacturerId = '" + manufacturerId + "'");
                if (dtSuppliersManufacturerLink.Rows.Count > 0)
                {
                    continue;
                }
                SuppliersManufacturerLinkModel model = new SuppliersManufacturerLinkModel();
                model.SupplierId     = supplierId;
                model.ManufacturerId = manufacturerId;
                SuppliersManufacturerLinkBO.Instance.Insert(model);
                count++;
            }
            MessageBox.Show("Insert: " + count);
        }
Exemple #26
0
        void loadModule()
        {
            DataTable dt = LibQLSX.Select("select * from SourceCode with(nolock) where FolderCode like 'tpad.%' order by FolderCode");

            grdModule.DataSource  = dt;
            grdModule1.DataSource = dt;
        }
Exemple #27
0
        void loadProject()
        {
            DataTable tbl = LibQLSX.Select("SELECT distinct [ProjectId],[ProjectName],[ProjectCode],[Year],[Month],convert(bit,0) as [check] FROM [vProjectProblem]");

            grdProject.DataSource = null;
            grdProject.DataSource = tbl;
        }
Exemple #28
0
        void loadVTLink()
        {
            string    partsId = TextUtils.ToString(grvVT.GetFocusedRowCellValue("PartsId"));
            DataTable dtlink  = LibQLSX.Select("select * from vPartsConfigLink where Type = 1 and PartsId = '" + partsId + "'");

            grdVTLink.DataSource = dtlink;
        }
        void loadGrid()
        {
            DataTable tbl = LibQLSX.Select("exec spGetHistoryModuleUsing '" + Module.Code + "'");

            grdData.DataSource = null;
            grdData.DataSource = tbl;
        }
Exemple #30
0
        void addRequestItem(string requestCode)
        {
            string sql = "";

            //sql = "select * from vRequirePartFull with(nolock) where RequestCode ='" + requestCode + "'";
            sql = "select *,(Price * TotalBuy) as TotalPrice from vRequestMaterial with(nolock) where RequestCode ='" + requestCode + "'";

            DataTable dt = LibQLSX.Select(sql);

            //DataRow[] drs = dt.Select("Price = 0 or Price is null");
            foreach (DataRow r in dt.Rows)
            {
                //string sqlM = "SELECT top 1 Price FROM  vGetPriceOfPart with(nolock)"
                //            + " WHERE Price > 1 AND replace(replace([PartsCode],'/','#'),')','#') = '" + TextUtils.ToString(r["PartsCode"]) + "'"
                //            + " ORDER BY DateAboutF DESC";
                //DataTable dtOrderPriceM = LibQLSX.Select(sqlM);

                string    sqlM          = "exec spGetPriceOfPart '" + TextUtils.ToString(r["PartsCode"]) + "'";
                DataTable dtOrderPriceM = LibQLSX.Select(sqlM);
                if (dtOrderPriceM.Rows.Count > 0)
                {
                    r["Price"]      = TextUtils.ToDecimal(dtOrderPriceM.Rows[0][0]);
                    r["TotalPrice"] = TextUtils.ToDecimal(r["Price"]) * TextUtils.ToDecimal(r["TotalBuy"]);
                }
            }
            grdParts.DataSource = dt;
        }