protected void DMGrid_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e)
        {
            ASPxGridView grid = sender as ASPxGridView;

            ASPxTextBox qty   = grid.FindEditRowCellTemplateControl((GridViewDataColumn)grid.Columns["EdittedQty"], "InvEdittedQty") as ASPxTextBox;
            ASPxTextBox cost  = grid.FindEditRowCellTemplateControl((GridViewDataColumn)grid.Columns["EdittedCost"], "InvEdittedCost") as ASPxTextBox;
            ASPxTextBox total = grid.FindEditRowCellTemplateControl((GridViewDataColumn)grid.Columns["EdittiedTotalCost"], "InvEdittiedTotalCost") as ASPxTextBox;

            string PK = e.Keys[0].ToString();
            Double qty_float = 0, cost_float = 0, total_float = 0;

            if (qty.Value != null)
            {
                qty_float = Convert.ToDouble(qty.Value.ToString());
            }
            if (cost.Value != null)
            {
                cost_float = Convert.ToDouble(cost.Value.ToString());
            }
            if (total.Value != null)
            {
                total_float = Convert.ToDouble(total.Value.ToString());
            }

            //Double qty_float = Convert.ToDouble(qty.Value.ToString());
            //Double cost_float = Convert.ToDouble(cost.Value.ToString());
            //Double total_float = Convert.ToDouble(total.Value.ToString());

            SqlConnection conn = new SqlConnection(GlobalClass.SQLConnString());

            conn.Open();

            //string update = "UPDATE " + MRPClass.DirectMatTable() +
            //                " SET [EdittedQty] = @QTY, [EdittedCost] = @COST, [EdittiedTotalCost] = @TOTAL, " +
            //                " [ApprovedQty] = @QTY, [ApprovedCost] = @COST, [ApprovedTotalCost] = @TOTAL " +
            //                " WHERE [PK] = @PK";
            //SqlCommand cmd = new SqlCommand(update, conn);
            //cmd.Parameters.AddWithValue("@PK", PK);
            //cmd.Parameters.AddWithValue("@QTY", qty_float);
            //cmd.Parameters.AddWithValue("@COST", cost_float);
            //cmd.Parameters.AddWithValue("@TOTAL", total_float);
            //cmd.CommandType = CommandType.Text;
            //int result = cmd.ExecuteNonQuery();

            int result = QuerySPClass.InsertUpdateDirectMaterials(wrkflwln, 2, Convert.ToInt32(PK), docnumber, 1, "", "", "", "", "", "", "", qty_float, cost_float, total_float);

            if (result > 0)
            {
                MRPClass.UpdateLastModified(conn, docnumber);
                string remarks = MRPClass.directmaterials_logs + "-" + MRPClass.edit_logs;
                MRPClass.AddLogsMOPList(conn, mrp_key, remarks);
            }

            conn.Close();

            e.Cancel = true;
            grid.CancelEdit();
            bindDM = true;
            BindDirectMaterials(docnumber);
        }
        protected void FixedAssetID_Init(object sender, EventArgs e)
        {
            string entCode = "", procCat = "";

            entCode = CAPEXCIP.GetRowValues(CAPEXCIP.FocusedRowIndex, "EntCode").ToString();
            procCat = CAPEXCIP.GetRowValues(CAPEXCIP.FocusedRowIndex, "ProcCat").ToString();

            MRPClass.PrintString(entCode + " : " + procCat);

            DataTable    dtRecord = GlobalClass.FixedAssetIDTable(entCode, procCat);
            ASPxComboBox combo    = sender as ASPxComboBox;

            combo.DataSource = dtRecord;
            ListBoxColumn l_ValueField = new ListBoxColumn();

            l_ValueField.FieldName = "ID";
            l_ValueField.Caption   = "CODE";
            l_ValueField.Width     = 125;
            combo.Columns.Add(l_ValueField);

            ListBoxColumn l_TextField = new ListBoxColumn();

            l_TextField.FieldName = "NAME";
            l_TextField.Width     = 350;
            combo.Columns.Add(l_TextField);

            combo.ValueField = "ID";
            combo.TextField  = "ID";
            combo.DataBind();

            combo.Value = sFixedAssetID.ToString();
            combo.Text  = sFixedAssetID.ToString();
        }
        private void Load_MRP(string docnumber)
        {
            string query = "SELECT TOP (100) PERCENT  tbl_MRP_List.*, vw_AXEntityTable.NAME AS EntityCodeDesc, vw_AXOperatingUnitTable.NAME AS BUCodeDesc, tbl_MRP_Status.StatusName, tbl_Users.Lastname, tbl_Users.Firstname FROM   tbl_MRP_List LEFT OUTER JOIN tbl_Users ON tbl_MRP_List.CreatorKey = tbl_Users.PK LEFT OUTER JOIN vw_AXOperatingUnitTable ON tbl_MRP_List.BUCode = vw_AXOperatingUnitTable.OMOPERATINGUNITNUMBER LEFT OUTER JOIN tbl_MRP_Status ON tbl_MRP_List.StatusKey = tbl_MRP_Status.PK LEFT OUTER JOIN vw_AXEntityTable ON tbl_MRP_List.EntityCode = vw_AXEntityTable.ID WHERE dbo.tbl_MRP_List.DocNumber = '" + docnumber + "' ORDER BY dbo.tbl_MRP_List.DocNumber DESC";

            SqlConnection conn = new SqlConnection(GlobalClass.SQLConnString());

            conn.Open();

            SqlCommand    cmd    = new SqlCommand(query, conn);
            SqlDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                mrp_key          = Convert.ToInt32(reader["PK"].ToString());
                entitycode       = reader["EntityCode"].ToString();
                DocNum.Text      = reader["DocNumber"].ToString();
                DateCreated.Text = reader["DateCreated"].ToString();
                EntityCode.Text  = reader["EntityCodeDesc"].ToString();
                BUCode.Text      = reader["BUCodeDesc"].ToString();
                buCode           = reader["BUCode"].ToString();
                Month.Text       = MRPClass.Month_Name(Int32.Parse(reader["MRPMonth"].ToString()));
                Year.Text        = reader["MRPYear"].ToString();
                Status.Text      = reader["StatusName"].ToString();
                firstname        = reader["Firstname"].ToString();
                lastname         = reader["Lastname"].ToString();
            }
            reader.Close();
            conn.Close();

            Creator.Text = EncryptionClass.Decrypt(firstname) + " " + EncryptionClass.Decrypt(lastname);
            iStatusKey   = MRPClass.MRP_Line_Status(mrp_key, wrkflwln);
        }
        protected void RevListview_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            if (e.CommandName == "Link")
            {
                itemcommand = revstring;
                ListViewItem itemClicked = e.Item;
                // Find Controls/Retrieve values from the item  here
                Label c = (Label)itemClicked.FindControl("RevID");
                PK_REV = Convert.ToInt32(c.Text);

                string query = "SELECT [Remarks] FROM " + MRPClass.RevenueTableLogs() + " WHERE MasterKey = '" + PK_REV + "' AND UserKey = '" + Session["CreatorKey"].ToString() + "'";

                SqlConnection conn = new SqlConnection(GlobalClass.SQLConnString());
                conn.Open();
                SqlCommand    comm   = new SqlCommand(query, conn);
                SqlDataReader reader = comm.ExecuteReader();
                bool          empty  = true;
                while (reader.Read())
                {
                    LogsMemo.Text = reader[0].ToString();
                    LogsMemo.Focus();
                    empty = false;
                }

                if (empty)
                {
                    LogsMemo.Text = "";
                    LogsMemo.Focus();
                }
                conn.Close();

                LogsPopup.HeaderText     = "Comment";
                LogsPopup.ShowOnPageLoad = true;
            }
        }
Exemplo n.º 5
0
        protected void ProdCat_ListBox_Init(object sender, EventArgs e)
        {
            string docnum = MOPNum_Combo.Text.ToString();

            empty = string.IsNullOrEmpty(docnum);
            ASPxListBox list = sender as ASPxListBox;

            list.Columns.Clear();
            list.Items.Clear();

            //if (empty)
            list.DataSource = MRPClass.ProCategoryTable_WithoutAll();
            //else
            //list.DataSource = MRPClass.ProCategoryTable_Filter("");

            ListBoxColumn l_value = new ListBoxColumn();

            l_value.FieldName = "NAME";
            l_value.Caption   = "Code";
            l_value.Width     = 100;
            list.Columns.Add(l_value);

            ListBoxColumn l_text = new ListBoxColumn();

            l_text.FieldName = "DESCRIPTION";
            l_text.Caption   = "Description";
            l_text.Width     = 350;
            list.Columns.Add(l_text);

            list.ValueField = "NAME";
            list.TextField  = "DESCRIPTION";
            list.DataBind();
            list.ItemStyle.Wrap = DevExpress.Utils.DefaultBoolean.True;
            list.ClientEnabled  = false;
        }
        private void BindAll()
        {
            MatListview.DataSource = Preview.Preview_DM(docnum, entitycode);
            MatListview.DataBind();
            TAMat.InnerText  = Preview.preview_total_directmaterials(docnum);
            ETAMat.InnerText = Preview.preview_requestedtotal_directmaterials(docnum);

            OpexListiview.DataSource = Preview.Preview_OP(docnum, entitycode);
            OpexListiview.DataBind();
            TAOpex.InnerText  = Preview.preview_total_opex(docnum);
            ETAOpex.InnerText = Preview.preview_requestedtotal_opex(docnum);

            ManListview.DataSource = Preview.Preview_MAN(docnum, entitycode);
            ManListview.DataBind();
            TAManpower.InnerText  = Preview.preview_total_manpower(docnum);
            ETAManpower.InnerText = Preview.preview_requestedtotal_manpower(docnum);
            //ATAManpower.InnerText = MRPClass.manpower_approved_total().ToString("N");

            CapexListview.DataSource = Preview.Preview_CA(docnum, entitycode);
            CapexListview.DataBind();
            TACapex.InnerText  = Preview.preview_total_capex(docnum);
            ETACapex.InnerText = Preview.preview_requestedtotal_capex(docnum);

            RevListview.DataSource = Preview.Preview_Revenue(DocNum.Text.ToString(), entitycode);
            RevListview.DataBind();
            TARevenue.InnerText = MRPClass.revenue_total().ToString("N");

            PreviewListSummary.DataSource = Preview.MRP_PrevTotalSummary(DocNum.Text.ToString(), entitycode);
            PreviewListSummary.DataBind();
            TotalAmountSummary.InnerText = Preview.Prev_Summary_Total();
        }
Exemplo n.º 7
0
        protected void POUOM_Init(object sender, EventArgs e)
        {
            ASPxComboBox combo = sender as ASPxComboBox;

            combo.DataSource     = MRPClass.UOMTable();
            combo.ItemStyle.Wrap = DevExpress.Utils.DefaultBoolean.True;

            ListBoxColumn l_value = new ListBoxColumn();

            l_value.FieldName = "SYMBOL";
            combo.Columns.Add(l_value);

            ListBoxColumn l_text = new ListBoxColumn();

            l_text.FieldName = "description";
            combo.Columns.Add(l_text);

            combo.ValueField = "SYMBOL";
            combo.TextField  = "description";
            combo.DataBind();
            combo.TextFormatString = "{0}";

            GridViewEditItemTemplateContainer container = ((ASPxComboBox)sender).NamingContainer as GridViewEditItemTemplateContainer;

            if (!container.Grid.IsNewRowEditing)
            {
                combo.Value = DataBinder.Eval(container.DataItem, "POUOM").ToString();
            }
        }
        protected void POAddEditGrid_CustomCallback(object sender, ASPxGridViewCustomCallbackEventArgs e)
        {
            SqlConnection  cn  = new SqlConnection(GlobalClass.SQLConnString());
            DataTable      dt  = new DataTable();
            SqlCommand     cmd = null;
            SqlDataAdapter adp;

            string s      = ProCategory.Value.ToString();
            string docnum = DocNumber.Value.ToString();

            //MOPMonthYear.Text = "";
            //MOPEntity.Text = "";
            //MOPBUSSU.Text = "";

            MRPClass.PrintString(docnum);

            string qry = "SELECT dbo.vw_AXEntityTable.NAME AS Entity, " +
                         " dbo.vw_AXOperatingUnitTable.NAME AS BUSSU, " +
                         " dbo.tbl_MRP_List.MRPMonth, dbo.tbl_MRP_List.MRPYear, " +
                         " dbo.tbl_MRP_List.DocNumber " +
                         " FROM dbo.tbl_MRP_List LEFT OUTER JOIN " +
                         " dbo.vw_AXEntityTable ON dbo.tbl_MRP_List.EntityCode = dbo.vw_AXEntityTable.ID LEFT OUTER JOIN " +
                         " dbo.vw_AXOperatingUnitTable ON dbo.tbl_MRP_List.BUCode = dbo.vw_AXOperatingUnitTable.OMOPERATINGUNITNUMBER " +
                         " WHERE(dbo.tbl_MRP_List.DocNumber = '" + docnum + "')";

            cn.Open();
            cmd            = new SqlCommand(qry);
            cmd.Connection = cn;
            adp            = new SqlDataAdapter(cmd);
            adp.Fill(dt);
            MRPClass.PrintString(dt.Rows.Count.ToString());
            if (dt.Rows.Count > 0)
            {
                foreach (DataRow row in dt.Rows)
                {
                    MRPClass.PrintString("pass foreach");
                    //MOPMonthYear.Text = DateTimeFormatInfo.CurrentInfo.GetAbbreviatedMonthName(Convert.ToInt32(row["MRPMonth"])) + "-" + row["MRPYear"].ToString(); ;
                    //MOPEntity.Text = row["Entity"].ToString();
                    //MOPBUSSU.Text = row["BUSSU"].ToString();
                }
            }
            dt.Clear();
            cn.Close();

            if (s == "ALL")
            {
                s = "ITEMGROUPID";
            }

            if (Session["MRP_Number"] == null)
            {
                BindPOAddEdit(docnum, s);
            }
            else
            {
                BindPOAddEdit(Session["MRP_Number"].ToString(), s);
            }

            //selList.Items.Clear();
        }
Exemplo n.º 9
0
        private void Bind_MRP_InventAnalyst()
        {
            DataTable dtRecord = MRPClass.MRP_InventoryAnalyst_Edit();

            grdMRPListInventAnalyst.DataSource   = dtRecord;
            grdMRPListInventAnalyst.KeyFieldName = "PK";
            grdMRPListInventAnalyst.DataBind();
        }
        private void BindCapex(string DOC_NUMBER)
        {
            DataTable dtRecord = MRPClass.MRPInvent_CAPEX(DOC_NUMBER, entitycode);

            CapGrid.DataSource   = dtRecord;
            CapGrid.KeyFieldName = "PK";
            CapGrid.DataBind();
        }
        private void BindManPower(string DOC_NUMBER)
        {
            DataTable dtRecord = MRPClass.MRPInvent_ManPower(DOC_NUMBER, entitycode);

            ManPoGridFinance.DataSource   = dtRecord;
            ManPoGridFinance.KeyFieldName = "PK";
            ManPoGridFinance.DataBind();
        }
        private void BindOpex(string DOC_NUMBER)
        {
            DataTable dtRecord = MRPClass.MRPInvent_OPEX(DOC_NUMBER, entitycode);

            OPGridFinance.DataSource   = dtRecord;
            OPGridFinance.KeyFieldName = "PK";
            OPGridFinance.DataBind();
        }
        private void BindPO()
        {
            DataTable dtRecord = MRPClass.PO_Table();

            POTable.DataSource   = dtRecord;
            POTable.KeyFieldName = "PK";
            POTable.DataBind();
        }
        private void BindDirectMaterials(string DOC_NUMBER)
        {
            DataTable dtRecord = MRPClass.MRPInvent_Direct_Materials(DOC_NUMBER, entitycode);

            DMGridFinance.DataSource   = dtRecord;
            DMGridFinance.KeyFieldName = "PK";
            DMGridFinance.DataBind();
        }
        private void Load_MRP(string docnum)
        {
            //string query = "SELECT TOP (100) PERCENT dbo.tbl_MRP_List.PK, dbo.tbl_MRP_List.DocNumber, " +
            //                  " dbo.tbl_MRP_List.DateCreated, dbo.tbl_MRP_List.EntityCode, dbo.vw_AXEntityTable.NAME AS EntityCodeDesc, " +
            //                  " dbo.tbl_MRP_List.BUCode, dbo.vw_AXOperatingUnitTable.NAME AS BUCodeDesc, dbo.tbl_MRP_List.MRPMonth, " +
            //                  " dbo.tbl_MRP_List.MRPYear, dbo.tbl_MRP_List.StatusKey, dbo.tbl_MRP_Status.StatusName, " +
            //                  " dbo.tbl_MRP_List.CreatorKey, dbo.tbl_MRP_List.LastModified " +
            //                  " FROM  dbo.tbl_MRP_List LEFT OUTER JOIN " +
            //                  " dbo.vw_AXOperatingUnitTable ON dbo.tbl_MRP_List.BUCode = dbo.vw_AXOperatingUnitTable.OMOPERATINGUNITNUMBER LEFT OUTER JOIN " +
            //                  " dbo.tbl_MRP_Status ON dbo.tbl_MRP_List.StatusKey = dbo.tbl_MRP_Status.PK LEFT OUTER JOIN " +
            //                  " dbo.vw_AXEntityTable ON dbo.tbl_MRP_List.EntityCode = dbo.vw_AXEntityTable.ID " +
            //                  " WHERE(dbo.tbl_MRP_List.DocNumber = '" + DocNum.Text.ToString().Trim() + "') " +
            //                  " ORDER BY dbo.tbl_MRP_List.DocNumber DESC";

            string query = "SELECT tbl_MRP_List.*, " +
                           " vw_AXEntityTable.NAME AS EntityCodeDesc, " +
                           " vw_AXOperatingUnitTable.NAME AS BUCodeDesc, " +
                           " tbl_MRP_Status.StatusName, tbl_Users.Lastname, " +
                           " tbl_Users.Firstname, tbl_MRP_List.EntityCode, " +
                           " tbl_MRP_List.BUCode " +
                           " FROM tbl_MRP_List LEFT OUTER JOIN tbl_Users ON tbl_MRP_List.CreatorKey = tbl_Users.PK " +
                           " LEFT OUTER JOIN vw_AXOperatingUnitTable ON tbl_MRP_List.BUCode = vw_AXOperatingUnitTable.OMOPERATINGUNITNUMBER " +
                           " LEFT OUTER JOIN tbl_MRP_Status ON tbl_MRP_List.StatusKey = tbl_MRP_Status.PK " +
                           " LEFT OUTER JOIN vw_AXEntityTable ON tbl_MRP_List.EntityCode = vw_AXEntityTable.ID " +
                           " WHERE dbo.tbl_MRP_List.DocNumber = '" + docnum + "' " +
                           " ORDER BY dbo.tbl_MRP_List.DocNumber DESC";

            SqlConnection conn = new SqlConnection(GlobalClass.SQLConnString());

            conn.Open();

            SqlCommand    cmd    = new SqlCommand(query, conn);
            SqlDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                DocNum.Text = reader["DocNumber"].ToString();
                //DateCreated.Text = reader["DateCreated"].ToString();
                dateCreated     = Convert.ToDateTime(reader["DateCreated"]);
                mrp_key         = Convert.ToInt32(reader["PK"]);
                entitycode      = reader["EntityCode"].ToString();
                EntityCode.Text = reader["EntityCodeDesc"].ToString();
                buCode          = reader["BUCode"].ToString();
                BUCode.Text     = reader["BUCodeDesc"].ToString();
                Month.Text      = MRPClass.Month_Name(Int32.Parse(reader["MRPMonth"].ToString()));
                Year.Text       = reader["MRPYear"].ToString();
                //Status.Text = reader["StatusName"].ToString();
                Creator.Text = EncryptionClass.Decrypt(reader["Firstname"].ToString()) + " " + EncryptionClass.Decrypt(reader["Lastname"].ToString());
                Status.Text  = reader["StatusName"].ToString();
            }
            reader.Close();
            conn.Close();

            iStatusKey = MRPClass.MRP_ApprvLine_Status(mrp_key, appflwln);
            StatusHidden["hidden_preview_iStatusKey"] = iStatusKey;
            WorkLineHidden["hidden_preview_wrkflwln"] = appflwln;
            BindAll();
        }
Exemplo n.º 16
0
        private void BindMRP(int ViewAll, string EntityCode, string BUCode)
        {
            //MRPClass.PrintString("MRP is bind");
            DataTable dtRecord = MRPClass.Master_MRP_List(ViewAll, EntityCode, BUCode);

            MainTable.DataSource   = dtRecord;
            MainTable.KeyFieldName = "PK";
            MainTable.DataBind();
        }
Exemplo n.º 17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            CheckCreatorKey();

            if (!Page.IsPostBack)
            {
                bool isAllowed = false;
                isAllowed = GlobalClass.IsAllowed(Convert.ToInt32(Session["CreatorKey"]), "MOPProcurementOfficer", DateTime.Now);
                if (isAllowed == false)
                {
                    Response.Redirect("home.aspx");
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this.Page, typeof(string), "Resize", "changeWidth.resizeWidth();", true);

                    ponumber = Request.Params["PONum"].ToString();

                    if (string.IsNullOrEmpty(ponumber))
                    {
                        return;
                    }

                    SqlConnection conn = new SqlConnection(GlobalClass.SQLConnString());
                    conn.Open();

                    //QUERY DETAILS
                    string        query  = "SELECT * FROM " + MRPClass.POTableName() + " WHERE [PONumber] = '" + ponumber + "'";
                    SqlCommand    cmd    = new SqlCommand(query, conn);
                    SqlDataReader reader = cmd.ExecuteReader();
                    while (reader.Read())
                    {
                        docnumber          = reader["MRPNumber"].ToString();
                        DocNumber.Value    = docnumber;
                        DateCreated.Value  = Convert.ToDateTime(reader["DateCreated"].ToString()).ToString("MM/dd/yyyy");
                        ExpectedDate.Value = reader["ExpectedDate"].ToString();
                        Vendor.Value       = reader["VendorCode"].ToString();
                        Terms.Value        = reader["PaymentTerms"].ToString();
                        Currency.Value     = reader["CurrencyCode"].ToString();
                        Site.Value         = reader["InventSite"].ToString();
                        Warehouse.Value    = reader["InventSiteWarehouse"].ToString();
                        Location.Value     = reader["InventSiteWarehouseLocation"].ToString();
                    }

                    PONumber.Value = ponumber;
                }
            }
            if (bind)
            {
                BindGrid();
            }
            else
            {
                bind = true;
            }
        }
Exemplo n.º 18
0
        private void BindGrid()
        {
            if (string.IsNullOrEmpty(ponumber))
            {
                return;
            }

            POCreatedGrid.DataSource   = MRPClass.PO_Creation_Details(ponumber);
            POCreatedGrid.KeyFieldName = "PK";
            POCreatedGrid.DataBind();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            CheckCreatorKey();

            if (!Page.IsPostBack)
            {
                //ScriptManager.RegisterStartupScript(this.Page, typeof(string), "Resize", "changeWidth.resizeWidth();", true);

                //docnum = Request.Params["DocNum"].ToString();
                //appflwln = Convert.ToInt32(Request.Params["ApprvLn"].ToString());
                //DocNum.Text = Request.Params["DocNum"].ToString();

                //Session["mrp_docNum"] = value.ToString();
                //Session["mrp_appLine"] = wrklineval.ToString();
                docnum   = Session["mrp_docNum"].ToString();
                appflwln = Convert.ToInt32(Session["mrp_appLine"]);

                DocNum.Text = Session["mrp_docNum"].ToString();

                if (MRPClass.PreviewApprovalRights(Convert.ToInt32(Session["CreatorKey"]), docnum) == false)
                {
                    MRPAccessRightsMsg.Text        = "Acces Denied!";
                    MRPAccessRights.HeaderText     = "Access Denied";
                    MRPAccessRights.ShowOnPageLoad = true;
                }

                switch (appflwln)
                {
                case 1:
                {
                    h1Approval.Text = "M O P for Approval in Supply Chain Management Level";
                    break;
                }

                case 2:
                {
                    h1Approval.Text = "M O P for Approval in Finance Level";
                    break;
                }

                case 3:
                {
                    h1Approval.Text = "M O P for Approval in Executive Level";
                    break;
                }
                }


                Load_MRP(docnum);
            }

            BindAll();
        }
Exemplo n.º 20
0
        //protected void ProdCategory_Combo_Init(object sender, EventArgs e)
        //{
        //    ASPxComboBox combo = sender as ASPxComboBox;
        //    combo.DataSource = MRPClass.ProCategoryTable();

        //    ListBoxColumn l_value = new ListBoxColumn();
        //    l_value.FieldName = "NAME";
        //    l_value.Caption = "CODE";
        //    l_value.Width = 100;
        //    combo.Columns.Add(l_value);

        //    ListBoxColumn l_text = new ListBoxColumn();
        //    l_text.FieldName = "DESCRIPTION";
        //    l_text.Width = 350;
        //    combo.Columns.Add(l_text);

        //    combo.ValueField = "NAME";
        //    combo.TextField = "DESCRIPTION";
        //    combo.DataBind();
        //    combo.TextFormatString = "{1}";
        //}

        private void ProdCat_DataBind()
        {
            ASPxListBox list = ProdCat_ListBox as ASPxListBox;

            list.Columns.Clear();
            list.Items.Clear();

            string monthyear = MonthYear_Combo.Text;

            //if (!string.IsNullOrEmpty(monthyear) && ((MOPNum_Combo.Value != null) || (CheckboxAll.Checked)))
            //if ((!string.IsNullOrEmpty(monthyear) && MOPNum_Combo.Value != null) || (!string.IsNullOrEmpty(monthyear) && CheckboxAll.Checked))
            if (!string.IsNullOrEmpty(monthyear))
            {
                if (!string.IsNullOrEmpty(MOPNum_Combo.Text.ToString()) || CheckboxAll.Checked)
                {
                    string[] strarr     = monthyear.Split(' ');
                    string   month      = strarr[0].ToString();
                    string   year       = strarr[1].ToString();
                    string   docnum     = "";
                    int      monthindex = Convertion.MONTH_TO_INDEX(month);
                    if (!string.IsNullOrEmpty(MOPNum_Combo.Text.ToString()))
                    {
                        docnum = MOPNum_Combo.Text.ToString();
                    }

                    //MRPClass.PrintString("pass");

                    //MRPClass.PrintString(docnum);

                    list.DataSource = MRPClass.ProCategoryTable_Filter_SelectItemPO(Convert.ToInt32(year), monthindex, docnum);


                    ListBoxColumn l_value = new ListBoxColumn();
                    l_value.FieldName = "NAME";
                    l_value.Caption   = "Code";
                    l_value.Width     = 100;
                    list.Columns.Add(l_value);

                    ListBoxColumn l_text = new ListBoxColumn();
                    l_text.FieldName = "DESCRIPTION";
                    l_text.Caption   = "Description";
                    l_text.Width     = 350;
                    list.Columns.Add(l_text);

                    list.ValueField = "NAME";
                    list.TextField  = "DESCRIPTION";
                    list.DataBind();
                    list.ItemStyle.Wrap = DevExpress.Utils.DefaultBoolean.True;
                    list.ClientEnabled  = true;
                }
            }
        }
        private void BindPOAddEdit(string mrp_number, string type)
        {
            DataTable dtRecord = MRPClass.POAddEdit_Table(mrp_number, type);

            POAddEditGrid.DataSource   = dtRecord;
            POAddEditGrid.KeyFieldName = "PK";
            POAddEditGrid.DataBind();

            //for row updating
            DataSet ds = new DataSet();

            ds.Tables.Add(dtRecord);
            Session["DataSet"] = ds;
        }
Exemplo n.º 22
0
 private void CheckCreatorKey()
 {
     if (Session["CreatorKey"] == null)
     {
         if (Page.IsCallback)
         {
             ASPxWebControl.RedirectOnCallback(MRPClass.DefaultPage());
         }
         else
         {
             Response.Redirect("default.aspx");
         }
         return;
     }
 }
        protected void InfoGrid_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e)
        {
            ASPxGridView grid   = sender as ASPxGridView;
            ASPxComboBox code   = grid.FindEditRowCellTemplateControl((GridViewDataColumn)grid.Columns["Code"], "Code") as ASPxComboBox;
            ASPxTextBox  prefix = grid.FindEditRowCellTemplateControl((GridViewDataColumn)grid.Columns["Prefix"], "Prefix") as ASPxTextBox;
            ASPxTextBox  series = grid.FindEditRowCellTemplateControl((GridViewDataColumn)grid.Columns["BeforeSeries"], "BeforeSeries") as ASPxTextBox;
            ASPxTextBox  max    = grid.FindEditRowCellTemplateControl((GridViewDataColumn)grid.Columns["MaxNumber"], "MaxNumber") as ASPxTextBox;
            ASPxTextBox  last   = grid.FindEditRowCellTemplateControl((GridViewDataColumn)grid.Columns["LastNumber"], "LastNumber") as ASPxTextBox;

            SqlConnection conn = new SqlConnection(GlobalClass.SQLConnString());

            conn.Open();

            string PK     = e.Keys[0].ToString();
            string update = "UPDATE [dbo].[tbl_PONumber] SET [EntityCode] = @EntityCode, [Prefix] = @Prefix, [BeforeSeries] = @BeforeSeries, [MaxNumber] = @MaxNumber, [LastNumber] = @LastNumber WHERE [PK] = @PK";

            double max_number  = Convert.ToDouble(max.Text);
            double last_number = Convert.ToDouble(last.Text);

            string[] arr           = code.Text.ToString().Split(';');
            string   entity_string = arr[0];

            SqlCommand cmd = new SqlCommand(update, conn);

            cmd.Parameters.AddWithValue("@EntityCode", entity_string);
            cmd.Parameters.AddWithValue("@Prefix", prefix.Text);
            cmd.Parameters.AddWithValue("@BeforeSeries", series.Text);
            cmd.Parameters.AddWithValue("@MaxNumber", max_number);
            cmd.Parameters.AddWithValue("@LastNumber", last_number);
            cmd.Parameters.AddWithValue("@PK", PK);
            cmd.CommandType = CommandType.Text;
            MRPClass.PrintString(code.Text);

            try
            {
                cmd.ExecuteNonQuery();
            }
            catch (SqlException exc)
            {
                MRPClass.PrintString(exc.Message);
            }


            conn.Close();
            grid.CancelEdit();
            e.Cancel = true;
            BindInfo();
        }
        protected void Submit_Click(object sender, EventArgs e)
        {
            MRPClass.Submit_MRP(docnumber.ToString(), mrp_key, wrkflwln + 1, entitycode, buCode, Convert.ToInt32(Session["CreatorKey"]));

            ScriptManager.RegisterStartupScript(this.Page, typeof(string), "Resize", "changeWidth.resizeWidth();", true);
            Submit.Enabled = false;

            Load_MRP(docnumber);

            BindDirectMaterials(docnumber);
            BindOpex(docnumber);
            BindManPower(docnumber);
            BindCapex(docnumber);

            MRPNotificationMessage.Text      = MRPClass.successfully_submitted;
            MRPNotificationMessage.ForeColor = System.Drawing.Color.Black;
            MRPNotify.HeaderText             = "Info";
            MRPNotify.ShowOnPageLoad         = true;
        }
Exemplo n.º 25
0
        protected void BtnAdd_Click(object sender, EventArgs e)
        {
            CheckCreatorKey();

            if (Month.Value == null || Year.Value == null)
            {
                return;
            }

            //ScriptManager.RegisterStartupScript(this.Page, typeof(string), "Resize", "changeWidth.resizeWidth();", true);

            int CopyMOP = 0, PreMonth = 0, PreYear = 0;

            if (Checkbox.Checked)
            {
                CopyMOP = 1;
                string[] arr       = MonthYearCombo.Text.ToString().Split('-');
                string   arr_month = arr[0];
                //MRPClass.PrintString(MonthYearCombo.Text.ToString());
                string arr_year = arr[1];
                PreMonth = Convertion.MONTH_TO_INDEX(arr_month);
                PreYear  = Convert.ToInt32(arr_year);
            }

            string month = Month.Value.ToString();
            string year  = Year.Value.ToString();

            string sResult = MRPClass.Insert_MRP(month, year, Convert.ToInt32(Session["CreatorKey"].ToString()), Session["EntityCode"].ToString(), Session["BUCode"].ToString(), CopyMOP, PreMonth, PreYear, WarningPopUp, WarningText, PopUpControl);

            string[] txtSplit  = sResult.Split('|');
            int      iRes      = Convert.ToInt32(txtSplit[0]);
            string   docNumber = txtSplit[1].ToString();
            int      mrpKey    = Convert.ToInt32(txtSplit[2]);

            if (iRes == 1)
            {
                Session["mrp_creator"]      = Session["CreatorKey"].ToString();
                PopUpControl.ShowOnPageLoad = false;
                Session["mrp_docNum"]       = docNumber.ToString();
                Session["mrp_wrkLine"]      = "0";
                Response.Redirect("mrp_addedit.aspx?DocNum=" + docNumber.ToString() + "&WrkFlwLn=0");
            }
        }
Exemplo n.º 26
0
        protected void grdCreator_CustomCallback(object sender, ASPxGridViewCustomCallbackEventArgs e)
        {
            ASPxGridView grid = sender as ASPxGridView;

            //MRPClass.PrintString(e.Parameters.ToString());

            if (e.Parameters == "AddNew")
            {
                if (grdBUSSU.VisibleRowCount == 0)
                {
                    return;
                }
                bool parseInt = int.TryParse(grdBUSSU.GetRowValues(grdBUSSU.FocusedRowIndex, "PK").ToString(), out iBUSSUMasterKey);
                if (parseInt == false)
                {
                    return;
                }
                if (iBUSSUMasterKey == 0)
                {
                    return;
                }

                bindCreatorList  = false;
                sBUSSUCreatorKey = "";

                grid.AddNewRow();
            }

            if (e.Parameters == "Creator")
            {
                int iMaster = 0;
                if (grdBUSSU.VisibleRowCount > 0)
                {
                    iMaster = Convert.ToInt32(grdBUSSU.GetRowValues(grdBUSSU.FocusedRowIndex, "PK").ToString());
                }
                grid.CancelEdit();

                MRPClass.PrintString(iMaster.ToString());

                BindBUSSUListCreator(iMaster);
            }
        }
Exemplo n.º 27
0
        protected void CapexGridApproval_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e)
        {
            ASPxGridView grid  = sender as ASPxGridView;
            ASPxTextBox  qty   = grid.FindEditRowCellTemplateControl((GridViewDataColumn)grid.Columns["ApprovedQty"], "ApprovedQtyCapex") as ASPxTextBox;
            ASPxTextBox  cost  = grid.FindEditRowCellTemplateControl((GridViewDataColumn)grid.Columns["ApprovedCost"], "ApprovedCostCapex") as ASPxTextBox;
            ASPxTextBox  total = grid.FindEditRowCellTemplateControl((GridViewDataColumn)grid.Columns["ApprovedTotalCost"], "ApprovedTotalCostCapex") as ASPxTextBox;

            string PK = e.Keys[0].ToString();

            Double qty_float   = Convert.ToDouble(qty.Value.ToString());
            Double cost_float  = Convert.ToDouble(cost.Value.ToString());
            Double total_float = Convert.ToDouble(total.Value.ToString());

            SqlConnection conn = new SqlConnection(GlobalClass.SQLConnString());

            conn.Open();

            string     update = "UPDATE " + MRPClass.CapexTable() + " SET [ApprovedQty] = @QTY, [ApprovedCost] = @COST, [ApprovedTotalCost] = @TOTAL WHERE [PK] = @PK";
            SqlCommand cmd    = new SqlCommand(update, conn);

            cmd.Parameters.AddWithValue("@PK", PK);
            cmd.Parameters.AddWithValue("@QTY", qty_float);
            cmd.Parameters.AddWithValue("@COST", cost_float);
            cmd.Parameters.AddWithValue("@TOTAL", total_float);
            cmd.CommandType = CommandType.Text;
            int result = cmd.ExecuteNonQuery();

            if (result > 0)
            {
                MRPClass.UpdateLastModified(conn, docnumber);
                string remarks = MRPClass.capex_logs + "-" + MRPClass.edit_logs;
                MRPClass.AddLogsMOPList(conn, mrp_key, remarks);
            }

            conn.Close();

            e.Cancel = true;
            grid.CancelEdit();
            bindCapex = true;
            BindCapex(docnumber);
        }
        protected void ProCategory_Init(object sender, EventArgs e)
        {
            ASPxComboBox combo = sender as ASPxComboBox;

            combo.DataSource = MRPClass.ProCategoryTable();

            ListBoxColumn l_value = new ListBoxColumn();

            l_value.FieldName = "NAME";
            combo.Columns.Add(l_value);

            ListBoxColumn l_text = new ListBoxColumn();

            l_text.FieldName = "DESCRIPTION";
            combo.Columns.Add(l_text);

            combo.ValueField = "NAME";
            combo.TextField  = "DESCRIPTION";
            combo.DataBind();
            combo.SelectedIndex = 0;
        }
        protected void DocNumber_Init(object sender, EventArgs e)
        {
            ASPxComboBox combo    = sender as ASPxComboBox;
            DataTable    dtRecord = MRPClass.Master_MRP_List_DOCNUM();

            combo.DataSource = dtRecord;

            ListBoxColumn l_ValueField = new ListBoxColumn();

            l_ValueField.FieldName = "DocNumber";
            l_ValueField.Caption   = "MRP#";
            l_ValueField.Width     = 150;
            combo.Columns.Add(l_ValueField);

            ListBoxColumn l_TextField = new ListBoxColumn();

            l_TextField.FieldName = "MRPMonth";
            l_TextField.Caption   = "Month/Year";
            l_TextField.Width     = 75;
            combo.Columns.Add(l_TextField);

            ListBoxColumn l_TextField2 = new ListBoxColumn();

            l_TextField2.FieldName = "EntityCode";
            l_TextField2.Caption   = "Entity";
            l_TextField2.Width     = 150;
            combo.Columns.Add(l_TextField2);

            ListBoxColumn l_TextField3 = new ListBoxColumn();

            l_TextField3.FieldName = "BUCode";
            l_TextField3.Caption   = "BU";
            l_TextField3.Width     = 250;
            combo.Columns.Add(l_TextField3);

            combo.ValueField = "DocNumber";
            combo.TextField  = "DocNumber";
            combo.DataBind();
            combo.TextFormatString = "{0}";
        }
Exemplo n.º 30
0
        protected void MainGridCallbackPanel_Callback(object sender, CallbackEventArgsBase e)
        {
            MRPClass.PrintString("list selected:" + ProdCat_ListBox.SelectedItems.Count.ToString());
            ArrayList     arrlist = new ArrayList();
            List <object> Temp    = new List <object>();

            foreach (ListEditItem item in ProdCat_ListBox.SelectedItems)
            {
                if (item.Selected)
                {
                    arrlist.Add(item.Value.ToString());
                }
                else
                {
                    MRPClass.PrintString("empty");
                }
            }

            string month = "";

            year_static  = "";
            month_static = 0;
            if (MonthYear_Combo.Value != null)
            {
                string   monthyear = MonthYear_Combo.Text;
                string[] arr       = monthyear.Split(' ');
                month        = arr[0];
                year_static  = arr[1];
                month_static = Convertion.MONTH_TO_INDEX(month);
            }

            doc_static = "";
            if (!string.IsNullOrEmpty(MOPNum_Combo.Text))
            {
                doc_static = MOPNum_Combo.Text.ToString();
            }
            prod_static = new ArrayList();
            prod_static = arrlist;
            BindTable(doc_static, month_static, year_static, arrlist);
        }