Exemplo n.º 1
0
        public static async void NewOrgObjView(string org, string obj, string fy, ExtendedForm parentForm)
        {
            try
            {
                parentForm.Waiting();
                GridForm newGridForm = new GridForm(parentForm, "Org/Obj Info");
                string   glColumns   = " glma_org, glma_obj, glma_desc, glma_seg5, glma_bud_yr, glma_orig_bud_cy, glma_rev_bud_cy, glma_encumb_cy, glma_memo_bal_cy, glma_rev_bud_cy-glma_encumb_cy-glma_memo_bal_cy AS 'Funds Available' ";
                string   glMasterQry = "Select TOP " + intMaxResults + " " + glColumns + "FROM glmaster";

                QueryParamCollection glParams = new QueryParamCollection();
                glParams.Add("glma_org", org, true);

                if (!string.IsNullOrEmpty(obj)) //Show Rollup info for Object
                {
                    glParams.Add("glma_obj", obj, true);

                    string rollUpCode = await munisComms.ReturnSqlValueAsync("gl_budget_rollup", "a_org", org, "a_rollup_code");

                    string rollUpByCodeQry = "SELECT TOP " + intMaxResults + " * FROM gl_budget_rollup WHERE a_rollup_code = '" + rollUpCode + "'";
                    string budgetQry       = "SELECT TOP " + intMaxResults + " a_projection_no,a_org,a_object,db_line,db_bud_desc_line1,db_bud_reason_desc,db_bud_req_qty5,db_bud_unit_cost,db_bud_req_amt5,a_account_id FROM gl_budget_detail_2"; // WHERE a_projection_no='" & FY & "' AND a_org='" & Org & "' AND a_object='" & Obj & "'"

                    QueryParamCollection budgetParams = new QueryParamCollection();
                    budgetParams.Add("a_projection_no", fy, true);
                    budgetParams.Add("a_org", org, true);
                    budgetParams.Add("a_object", obj, true);

                    newGridForm.AddGrid("OrgGrid", "GL Info:", await munisComms.ReturnSqlTableFromCmdAsync(munisComms.GetSqlCommandFromParams(glMasterQry, glParams.Parameters)));
                    newGridForm.AddGrid("RollupGrid", "Rollup Info:", await munisComms.ReturnSqlTableAsync(rollUpByCodeQry));
                    newGridForm.AddGrid("BudgetGrid", "Budget Info:", await munisComms.ReturnSqlTableFromCmdAsync(munisComms.GetSqlCommandFromParams(budgetQry, budgetParams.Parameters)));
                }
                else // Show Rollup info for all Objects in Org
                {
                    string rollUpAllQry = "SELECT TOP " + intMaxResults + " * FROM gl_budget_rollup";

                    QueryParamCollection rollUpParams = new QueryParamCollection();
                    rollUpParams.Add("a_org", org, true);

                    newGridForm.AddGrid("OrgGrid", "GL Info:", await munisComms.ReturnSqlTableFromCmdAsync(munisComms.GetSqlCommandFromParams(glMasterQry, glParams.Parameters)));             //MunisComms.Return_MSSQLTableAsync(Qry))
                    newGridForm.AddGrid("RollupGrid", "Rollup Info:", await munisComms.ReturnSqlTableFromCmdAsync(munisComms.GetSqlCommandFromParams(rollUpAllQry, rollUpParams.Parameters))); //MunisComms.Return_MSSQLTableAsync("SELECT TOP " & intMaxResults & " * FROM gl_budget_rollup WHERE a_org = '" & Org & "'"))
                }
                newGridForm.Show();
            }
            catch (Exception ex)
            {
                ErrorHandling.ErrHandle(ex, System.Reflection.MethodBase.GetCurrentMethod());
            }
            finally
            {
                parentForm.DoneWaiting();
            }
        }
Exemplo n.º 2
0
        public static async void NewMunisPOSearch(string po, ExtendedForm parentForm)
        {
            try
            {
                parentForm.Waiting();

                if (po == "")
                {
                    return;
                }
                string query = "SELECT TOP " + intMaxResults + @" pohd_pur_no, pohd_fsc_yr, pohd_req_no, pohd_gen_cm, pohd_buy_id, pohd_pre_dt, pohd_exp_dt, pohd_sta_cd, pohd_vnd_cd, pohd_dep_cd, pohd_shp_cd, pohd_tot_amt, pohd_serial
FROM poheader";

                QueryParamCollection searchParams = new QueryParamCollection();
                searchParams.Add("pohd_pur_no", po, true);

                GridForm newGridForm = new GridForm(parentForm, "MUNIS PO Info");
                using (var cmd = munisComms.GetSqlCommandFromParams(query, searchParams.Parameters))
                {
                    using (var results = await munisComms.ReturnSqlTableFromCmdAsync(cmd))
                    {
                        if (HasResults(results, parentForm))
                        {
                            newGridForm.AddGrid("POGrid", "PO Info:", results);
                            newGridForm.Show();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorHandling.ErrHandle(ex, System.Reflection.MethodBase.GetCurrentMethod());
            }
            finally
            {
                parentForm.DoneWaiting();
            }
        }
Exemplo n.º 3
0
        public static async void ReqSearch(ExtendedForm parentForm)
        {
            try
            {
                string reqNumber = "";
                string fy        = "";
                using (var newDialog = new Dialog(parentForm))
                {
                    newDialog.Text = "Req Search";
                    newDialog.AddTextBox("ReqNum", "Requisition #:");
                    newDialog.AddTextBox("FY", "FY:");
                    newDialog.ShowDialog();
                    if (newDialog.DialogResult == DialogResult.OK)
                    {
                        reqNumber = newDialog.GetControlValue("ReqNum").ToString();
                        fy        = newDialog.GetControlValue("FY").ToString();
                        if (DataConsistency.IsValidYear(fy))
                        {
                            parentForm.Waiting();

                            var blah = await NewMunisReqSearch(reqNumber, fy, parentForm);
                        }
                        else
                        {
                            OtherFunctions.Message("Invalid year.", MessageBoxButtons.OK, MessageBoxIcon.Information, "Invalid", parentForm);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorHandling.ErrHandle(ex, System.Reflection.MethodBase.GetCurrentMethod());
            }
            finally
            {
                parentForm.DoneWaiting();
            }
        }
Exemplo n.º 4
0
        private static async void NewMunisEmployeeSearch(string name, ExtendedForm parentForm)
        {
            try
            {
                parentForm.Waiting();

                string columns = "e.a_employee_number,e.a_name_last,e.a_name_first,e.a_org_primary,e.a_object_primary,e.a_location_primary,e.a_location_p_desc,e.a_location_p_short,e.e_work_location,m.a_employee_number as sup_employee_number,m.a_name_first as sup_name_first,m.a_name_last as sup_name_last";
                string query   = "SELECT TOP " + intMaxResults + " " + columns + @"
FROM pr_employee_master e
INNER JOIN pr_employee_master m on e.e_supervisor = m.a_employee_number";

                QueryParamCollection searchParams = new QueryParamCollection();
                searchParams.Add("e.a_name_last", name.ToUpper(), "OR");
                searchParams.Add("e.a_name_first", name.ToUpper(), "OR");

                using (var cmd = munisComms.GetSqlCommandFromParams(query, searchParams.Parameters))
                    using (var results = await munisComms.ReturnSqlTableFromCmdAsync(cmd))
                    {
                        if (HasResults(results, parentForm))
                        {
                            parentForm.DoneWaiting();

                            GridForm newGridForm = new GridForm(parentForm, "MUNIS Employee Info");
                            newGridForm.AddGrid("EmpGrid", "MUNIS Info:", results);
                            newGridForm.Show();
                        }
                    }
            }
            catch (Exception ex)
            {
                ErrorHandling.ErrHandle(ex, System.Reflection.MethodBase.GetCurrentMethod());
            }
            finally
            {
                parentForm.DoneWaiting();
            }
        }
Exemplo n.º 5
0
        public static async void LoadMunisInfoByDevice(Device device, ExtendedForm parentForm)
        {
            try
            {
                parentForm.Waiting();

                DataTable reqLinesTable  = new DataTable();
                DataTable reqHeaderTable = new DataTable();
                DataTable inventoryTable = new DataTable();

                if (device.PO == "" || device.PO == null)
                {
                    device.PO = await GetPOFromDevice(device);
                }

                if (device.PO != string.Empty)
                {
                    inventoryTable = await LoadMunisInventoryGrid(device);

                    reqLinesTable = await GetReqLineItemsFromReqNum(await GetReqNumberFromPOAsync(device.PO), GetFYFromPO(device.PO));

                    reqHeaderTable = await GetReqHeaderFromReqNum(await GetReqNumberFromPOAsync(device.PO), GetFYFromPO(device.PO));
                }
                else
                {
                    inventoryTable = await LoadMunisInventoryGrid(device);

                    reqLinesTable  = null;
                    reqHeaderTable = null;
                }
                if (inventoryTable != null || reqLinesTable != null)
                {
                    GridForm newGridForm = new GridForm(parentForm, "MUNIS Info");
                    if (inventoryTable == null)
                    {
                        OtherFunctions.Message("Munis Fixed Asset info. not found.", MessageBoxButtons.OK, MessageBoxIcon.Information, "No FA Record");
                    }
                    else
                    {
                        newGridForm.AddGrid("InvGrid", "FA Info:", inventoryTable);
                    }
                    if (reqLinesTable == null)
                    {
                        OtherFunctions.Message("Could not resolve PO from Asset Tag or Serial. Please add a valid PO if possible.", MessageBoxButtons.OK, MessageBoxIcon.Information, "No Req. Record");
                    }
                    else
                    {
                        newGridForm.AddGrid("ReqHeadGrid", "Requisition Header:", reqHeaderTable);
                        newGridForm.AddGrid("ReqLineGrid", "Requisition Line Items:", reqLinesTable);
                    }

                    if (newGridForm.GridCount > 0)
                    {
                        newGridForm.Show();
                    }
                    else
                    {
                        newGridForm.Dispose();
                    }
                }
                else if (inventoryTable == null && reqLinesTable == null)
                {
                    OtherFunctions.Message("Could not resolve any purchase or Fixed Asset info.", MessageBoxButtons.OK, MessageBoxIcon.Information, "Nothing Found");
                }
            }
            catch (Exception ex)
            {
                ErrorHandling.ErrHandle(ex, System.Reflection.MethodBase.GetCurrentMethod());
            }
            finally
            {
                parentForm.DoneWaiting();
            }
        }