}//fin FormEvent

        private void Distribuir()
        {
            Int64 iFolio;
            Int64 iDesde;
            Int64 iHasta;
            Int32 i;

            SAPbouiCOM.EditText oEditText;

            try
            {
                oMtx.Clear();
                oMtx.FlushToDataSource();
                oEditText = (EditText)(oForm.Items.Item("Desde").Specific);
                iDesde    = Convert.ToInt64((System.String)(oEditText.Value), _nf);
                oEditText = (EditText)(oForm.Items.Item("Hasta").Specific);
                iHasta    = Convert.ToInt64((System.String)(oEditText.Value), _nf);
                if (iDesde <= 0)
                {
                    FSBOApp.StatusBar.SetText("Debe ingresar Folio desde", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                }
                else if (iHasta <= 0)
                {
                    FSBOApp.StatusBar.SetText("Debe ingresar Folio hasta", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                }
                else if (iDesde >= iHasta)
                {
                    FSBOApp.StatusBar.SetText("Ingrese rango Folio correcto", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                }
                else
                {
                    i = 0;
                    for (iFolio = iDesde; iFolio <= iHasta; iFolio++)
                    {
                        oDBDSD.InsertRecord(i);
                        oDBDSD.SetValue("U_Folio", i, Convert.ToString(iFolio));
                        oDBDSD.SetValue("U_Estado", i, "D");
                        i++;
                    }

                    if (Convert.ToDouble((System.String)(oDBDSD.GetValue("U_Folio", i)), _nf) == 0)
                    {
                        oDBDSD.RemoveRecord(i);
                    }

                    oMtx.LoadFromDataSource();
                    oColumn = oMtx.Columns.Item("Folio");
                    oColumn.TitleObject.Sortable = true;
                    oColumn.TitleObject.Sort(SAPbouiCOM.BoGridSortType.gst_Ascending);
                }
            }
            catch (Exception e)
            {
                FSBOApp.MessageBox(e.Message + " ** Trace: " + e.StackTrace, 1, "Ok", "", "");
                OutLog("Distribuir: " + e.Message + " ** Trace: " + e.StackTrace);
            }
        }//fin Distribuir
Ejemplo n.º 2
0
        private void BindDataNoForm()
        {
            oColumn = oColumns.Item("DSCardCode");
            oColumn.DataBind.SetBound(true, "OCRD", "CardCode");

            oColumn = oColumns.Item("DSCardName");
            oColumn.DataBind.SetBound(true, "OCRD", "CardName");

            oColumn = oColumns.Item("DSPhone");
            oColumn.DataBind.SetBound(true, "OCRD", "Phone1");

            //oColumn = oColumns.Item("DSPhoneInt");
            //oColumn.DataBind.SetBound(true, "", "IntPhone");
        }
Ejemplo n.º 3
0
        private void fillLOVinCol(SAPbouiCOM.Column col, string attrId, string sql)
        {
            string strSelect = "SELECT \"U_Val\" , \"U_Descr\" FROM \"@B1_QA_ATTR_LOV\" WHERE \"U_AttrCode\" = '" + attrId + "' ORDER BY \"U_VisOrder\"";

            if (sql != "")
            {
                strSelect = sql;
            }
            System.Data.DataTable dtCodes = Program.objHrmsUI.getDataTable(strSelect, "getting codes LOV");
            int i = 0;

            foreach (System.Data.DataRow dr in dtCodes.Rows)
            {
                col.ValidValues.Add(dr[0].ToString(), dr[1].ToString());
            }
        }
Ejemplo n.º 4
0
        private void AddMatrixNoForm()
        {
            LinkedButton oLink = null;

            oItem        = oForm.Items.Add("Matrix1", BoFormItemTypes.it_MATRIX);
            oItem.Left   = 5;
            oItem.Width  = 500;
            oItem.Top    = 5;
            oItem.Height = 150;

            oMatrix = ((SAPbouiCOM.Matrix)(oItem.Specific));

            oColumns = oMatrix.Columns;

            oColumn = oColumns.Add("#", BoFormItemTypes.it_EDIT);
            oColumn.TitleObject.Caption = "#";
            oColumn.Width    = 30;
            oColumn.Editable = false;

            oColumn = oColumns.Add("DSCardCode", BoFormItemTypes.it_LINKED_BUTTON);
            oColumn.TitleObject.Caption = "Card Code";
            oColumn.Width    = 40;
            oColumn.Editable = true;

            oLink = (oColumn).ExtendedObject;
            oLink.LinkedObject = BoLinkedObject.lf_BusinessPartner;

            oColumn = oColumns.Add("DSCardName", BoFormItemTypes.it_EDIT);
            oColumn.TitleObject.Caption = "Name";
            oColumn.Width    = 40;
            oColumn.Editable = true;


            oColumn = oColumns.Add("DSPhone", BoFormItemTypes.it_EDIT);
            oColumn.TitleObject.Caption = "Phone";
            oColumn.Width    = 40;
            oColumn.Editable = true;


            //oColumn = oColumns.Add("DSPhone", BoFormItemTypes.it_EDIT);
            //oColumn.TitleObject.Caption = "Int.Phone";
            //oColumn.Width = 40;
            //oColumn.Editable = true;
        }
Ejemplo n.º 5
0
        private void selectAllWO()
        {
            try
            {
                oForm.Freeze(true);
                SAPbouiCOM.Column col = mtWO.Columns.Item("V_3");

                if (col.TitleObject.Caption == "✓")
                {
                    for (int i = 0; i < dtWebO.Rows.Count; i++)
                    {
                        dtWebO.SetValue("sel", i, "N");
                        col.TitleObject.Caption = "";
                    }
                }
                else
                {
                    for (int i = 0; i < dtWebO.Rows.Count; i++)
                    {
                        string rdrNum = dtWebO.GetValue("RdrNum", i).ToString();
                        if (rdrNum != "")
                        {
                            continue;
                        }
                        dtWebO.SetValue("sel", i, "Y");
                        col.TitleObject.Caption = "✓";
                    }
                }
                mtWO.LoadFromDataSource();
                oForm.Freeze(false);
            }
            catch (Exception ex)
            {
                oApplication.SetStatusBarMessage("Error occured " + ex.Message);
                // iniSalaryDetail();
            }
        }
        public new bool InitForm(string uid, string xmlPath, ref Application application, ref SAPbobsCOM.Company company, ref CSBOFunctions SBOFunctions, ref TGlobalVid _GlobalSettings)
        {
            Int32 i;
            //TFunctions Reg;
            bool Result = base.InitForm(uid, xmlPath, ref application, ref company, ref SBOFunctions, ref _GlobalSettings);

            try
            {
                oRecordSet = (SAPbobsCOM.Recordset)(FCmpny.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset));

                Lista = new List <string>();

                FSBOf.LoadForm(xmlPath, "VID_FEPROCED.srf", uid);
                //EnableCrystal := true;
                oForm = FSBOApp.Forms.Item(uid);
                oForm.Freeze(true);
                oForm.AutoManaged    = true;
                oForm.SupportedModes = -1;             // afm_All

                //        VID_DelRow := true;
                //        VID_DelRowOK := true;

                //oForm.DataBrowser.BrowseBy := "Code";
                oDBDSH = oForm.DataSources.DBDataSources.Item("@VID_FEPROCED");

                // Ok Ad  Fnd Vw Rq Sec
                Lista.Add("mtx      , f,  t,  f,  f, r, 1");
                //Lista.Add('Name      , f,  t,  t,  f, r, 1');
                //Lista.Add('CardCode  , f,  t,  t,  f, r, 1');
                //FSBOf.SetAutoManaged(var oForm, Lista);

                //oCombo := ComboBox(oForm.Items.Item('TipDoc').Specific);
                //oCombo.ValidValues.Add('33', 'Factura');

                //s := '1';
                //oCombo.Select(s, BoSearchKey.psk_ByValue);

                //        AddChooseFromList();
                oMtx = (Matrix)(oForm.Items.Item("mtx").Specific);
                //        oColumn                    := SAPbouiCOM.Column(oMtx.Columns.Item('V_0'));
                //        oColumn.ChooseFromListUID  := 'CFL0';
                //        oColumn.ChooseFromListAlias:= 'Code';
                //        oMtx.AutoResizeColumns();


                if (GlobalSettings.RunningUnderSQLServer)
                {
                    s = @"select DocEntry, ISNULL(U_TipoDoc,'') TipoDoc, ISNULL(U_ProcNomE,'') ProcNomE, ISNULL(U_ProcNomD,'') ProcNomD, ISNULL(U_ProcNomR,'') ProcNomR, ISNULL(U_ProcNomC,'') ProcNomC, ISNULL(U_ProcNomDe,'') ProcNomDe, ISNULL(U_ProcNomL,'') ProcNomL, ISNULL(U_ProcNomS,'') ProcNomS, ISNULL(U_Habili,'Y') 'Habilitada', ISNULL(U_CantLineas,0) 'CantLineas' from [@VID_FEPROCED]";
                }
                else
                {
                    s = @"select ""DocEntry"", IFNULL(""U_TipoDoc"",'') ""TipoDoc"", IFNULL(""U_ProcNomE"",'') ""ProcNomE"", IFNULL(""U_ProcNomD"",'') ""ProcNomD"", IFNULL(""U_ProcNomR"",'') ""ProcNomR"", IFNULL(""U_ProcNomC"",'') ""ProcNomC"", IFNULL(""U_ProcNomDe"",'') ""ProcNomDe"", IFNULL(""U_ProcNomL"",'') ""ProcNomL"", IFNULL(""U_ProcNomS"",'') ""ProcNomS"", IFNULL(""U_Habili"",'Y') ""Habilitada"", IFNULL(""U_CantLineas"",0) ""CantLineas"" from ""@VID_FEPROCED"" ";
                }
                oRecordSet.DoQuery(s);

                i = 0;
                oDBDSH.Clear();
                while (!oRecordSet.EoF)
                {
                    oDBDSH.InsertRecord(i);
                    oDBDSH.SetValue("DocEntry", i, Convert.ToString((System.Int32)(oRecordSet.Fields.Item("DocEntry").Value)));
                    oDBDSH.SetValue("U_TipoDoc", i, (System.String)(oRecordSet.Fields.Item("TipoDoc").Value));
                    //oDBDSH.SetValue("U_TipoDocPE", i, (System.String)(oRecordSet.Fields.Item("TipoDocPE").Value));
                    oDBDSH.SetValue("U_ProcNomE", i, (System.String)(oRecordSet.Fields.Item("ProcNomE").Value));
                    oDBDSH.SetValue("U_ProcNomD", i, (System.String)(oRecordSet.Fields.Item("ProcNomD").Value));
                    oDBDSH.SetValue("U_ProcNomR", i, (System.String)(oRecordSet.Fields.Item("ProcNomR").Value));
                    oDBDSH.SetValue("U_ProcNomC", i, (System.String)(oRecordSet.Fields.Item("ProcNomC").Value));
                    //oDBDSH.SetValue("U_ProcNomDe", i, (System.String)(oRecordSet.Fields.Item("ProcNomDe").Value));
                    //oDBDSH.SetValue("U_ProcNomL", i, (System.String)(oRecordSet.Fields.Item("ProcNomL").Value));
                    //oDBDSH.SetValue("U_ProcNomS", i, (System.String)(oRecordSet.Fields.Item("ProcNomS").Value));
                    oDBDSH.SetValue("U_Habili", i, (System.String)(oRecordSet.Fields.Item("Habilitada").Value));
                    oDBDSH.SetValue("U_CantLineas", i, Convert.ToString((System.Int32)(oRecordSet.Fields.Item("CantLineas").Value)));
                    oRecordSet.MoveNext();
                    i++;
                }

                oDBDSH.InsertRecord(i);
                oDBDSH.SetValue("DocEntry", i, "");
                oDBDSH.SetValue("U_TipoDoc", i, "");
                //oDBDSH.SetValue("U_TipoDocPE", i, "");
                oDBDSH.SetValue("U_ProcNomE", i, "");
                oDBDSH.SetValue("U_ProcNomD", i, "");
                oDBDSH.SetValue("U_ProcNomR", i, "");
                oDBDSH.SetValue("U_ProcNomC", i, "");
                //oDBDSH.SetValue("U_ProcNomDe", i, "");
                //oDBDSH.SetValue("U_ProcNomL", i, "");
                //oDBDSH.SetValue("U_ProcNomS", i, "");
                oDBDSH.SetValue("U_Habili", i, "Y");
                oDBDSH.SetValue("U_CantLineas", i, "60");

                if (GlobalSettings.RunningUnderSQLServer) //TipoDoc
                {
                    s = @"select U1.FldValue 'Code', U1.Descr 'Name' from UFD1 U1 join CUFD U0 on U0.TableID = U1.TableID and U0.FieldID = U1.FieldID where U1.TableID = '@VID_FEPROCED' and U0.AliasID = '{0}'";
                }
                else
                {
                    s = @"select U1.""FldValue"" ""Code"", U1.""Descr"" ""Name"" from ""UFD1"" U1 join ""CUFD"" U0 on U0.""TableID"" = U1.""TableID"" and U0.""FieldID"" = U1.""FieldID"" where U1.""TableID"" = '@VID_FEPROCED' and U0.""AliasID"" = '{0}' ";
                }

                s = String.Format(s, "TipoDoc");
                oRecordSet.DoQuery(s);
                oColumn = (SAPbouiCOM.Column)(oMtx.Columns.Item("TipoDoc"));
                FSBOf.FillComboMtx(oColumn, ref oRecordSet, false);
                //((SAPbouiCOM.Column)oMtx.Columns.Item("TipoDocPE")).Visible = false;

                if (GlobalSettings.RunningUnderSQLServer) //Habilitado
                {
                    s = @"select FldValue 'Code', Descr 'Name' from UFD1 where TableID = '@VID_FEPROCED' and FieldID = 2";
                }
                else
                {
                    s = @"select ""FldValue"" ""Code"", ""Descr"" ""Name"" from ""UFD1"" where ""TableID"" = '@VID_FEPROCED' and ""FieldID"" = 2";
                }
                oRecordSet.DoQuery(s);
                oColumn = (SAPbouiCOM.Column)(oMtx.Columns.Item("Habili"));
                FSBOf.FillComboMtx(oColumn, ref oRecordSet, false);


                //EditText(oForm.Items.Item('CardCode').Specific).Active := True;
                oMtx.LoadFromDataSource();


                oForm.Mode = BoFormMode.fm_OK_MODE;
                oMtx.AutoResizeColumns();
            }
            catch (Exception e)
            {
                OutLog("InitForm: " + e.Message + " ** Trace: " + e.StackTrace);
                FSBOApp.MessageBox(e.Message + " ** Trace: " + e.StackTrace, 1, "Ok", "", "");
            }
            oForm.Freeze(false);
            return(Result);
        }//fin InitForm
Ejemplo n.º 7
0
        private void getAttributes(string itemCode)
        {
            oForm.Freeze(true);
            try
            {
                dtRpt.Rows.Clear();
                mtRpt.LoadFromDataSource();

                int colcnt = dtRpt.Columns.Count;
                for (int i = 1; i < colcnt; i++)
                {
                    string colid = dtRpt.Columns.Item(1).Name;
                    dtRpt.Columns.Remove(colid);
                    mtRpt.Columns.Remove("m" + colid);
                }

                mtRpt.LoadFromDataSource();



                int k = 1;

                string strRows = "   SELECT t0.\"Code\", t0.\"Name\", t0.\"U_IGCode\", t1.\"Code\" AS \"AttrCode\", t1.\"Name\" AS \"AttrName\", t1.\"U_Descr\" AS \"AttrDescr\", t1.\"U_Type\", t1.\"U_DefVal\", t1.\"U_LOVT\", t1.\"U_LOVSQL\", t1.\"U_DefValRem\", \"U_VisOrder\", \"U_Active\" FROM \"@B1_QA_CODES_ATTR\" t0 INNER JOIN \"@B1_QA_ATTR\" t1 ON t0.\"Name\" = t1.\"Code\" WHERE \"U_IGCode\" = '" + itemCode + "'  ";
                System.Data.DataTable dtRows = Program.objHrmsUI.getDataTable(strRows, "getting docs");
                foreach (System.Data.DataRow dr in dtRows.Rows)
                {
                    SAPbouiCOM.DataColumn dccol1;

                    string type = dr["U_Type"].ToString();
                    switch (type)
                    {
                    case "01":

                        dccol1 = dtRpt.Columns.Add("col_" + dr["AttrCode"].ToString(), BoFieldsType.ft_AlphaNumeric, 250);

                        break;

                    case "02":
                        dccol1 = dtRpt.Columns.Add("col_" + dr["AttrCode"].ToString(), BoFieldsType.ft_Float, 250);
                        break;

                    case "03":
                        dccol1 = dtRpt.Columns.Add("col_" + dr["AttrCode"].ToString(), BoFieldsType.ft_Date);
                        break;
                    }


                    string Lovtype = dr["U_LOVT"].ToString();

                    SAPbouiCOM.Column col1;
                    switch (Lovtype)
                    {
                    case "01":
                        col1 = mtRpt.Columns.Add("mcol_" + dr["AttrCode"].ToString(), BoFormItemTypes.it_EDIT);
                        col1.TitleObject.Caption = dr["AttrDescr"].ToString();
                        col1.Editable            = true;
                        col1.Width = 20;
                        col1.DataBind.Bind("dtRpt", "col_" + dr["AttrCode"].ToString());

                        break;

                    case "02":
                        col1 = mtRpt.Columns.Add("mcol_" + dr["AttrCode"].ToString(), BoFormItemTypes.it_COMBO_BOX);
                        col1.TitleObject.Caption = dr["AttrDescr"].ToString();
                        col1.Editable            = true;
                        col1.Width = 20;
                        col1.DataBind.Bind("dtRpt", "col_" + dr["AttrCode"].ToString());
                        col1.DisplayDesc = true;

                        fillLOVinCol(col1, dr["AttrCode"].ToString(), "");
                        break;

                    case "03":
                        col1 = mtRpt.Columns.Add("mcol_" + dr["AttrCode"].ToString(), BoFormItemTypes.it_COMBO_BOX);
                        col1.TitleObject.Caption = dr["AttrDescr"].ToString();
                        col1.Editable            = true;
                        col1.Width       = 20;
                        col1.DisplayDesc = true;

                        col1.DataBind.Bind("dtRpt", "col_" + dr["AttrCode"].ToString());
                        fillLOVinCol(col1, dr["AttrCode"].ToString(), dr["U_LOVSQL"].ToString());


                        break;
                    }



                    k++;
                }

                for (int i = 1; i < dtRpt.Columns.Count; i++)
                {
                    SAPbouiCOM.Column col = mtRpt.Columns.Item(i);

                    string colUid = dtRpt.Columns.Item(i).Name.ToString();
                    if (colUid != "col_00")
                    {
                        string attrCode = colUid.Split('_')[1].ToString();
                        col.DataBind.Bind("dtRpt", "col_" + attrCode);
                    }
                    else
                    {
                        col.DataBind.Bind("dtRpt", "col_00");
                    }
                }

                dtRpt.Rows.Add(2);

                mtRpt.LoadFromDataSource();
                mtRpt.CommonSetting.SetRowEditable(1, false);
            }
            finally
            {
                oForm.Freeze(false);
            }
            //mtRpt.Item.Width = 500;
        }
        public new bool InitForm(string uid, string xmlPath, ref Application application, ref SAPbobsCOM.Company company, ref CSBOFunctions SBOFunctions, ref TGlobalVid _GlobalSettings)
        {
            //SAPbouiCOM.ComboBox oComboBox;
            bool Result = base.InitForm(uid, xmlPath, ref application, ref company, ref SBOFunctions, ref _GlobalSettings);

            try
            {
                oRecordSet = (SAPbobsCOM.Recordset)(FCmpny.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset));

                Lista = new List <string>();

                FSBOf.LoadForm(xmlPath, "VID_FEDIST.srf", uid);
                //EnableCrystal := true;
                oForm = FSBOApp.Forms.Item(uid);
                oForm.Freeze(true);
                oForm.AutoManaged    = true;
                oForm.SupportedModes = -1;             // afm_All

                VID_DelRow   = false;
                VID_DelRowOK = false;

                oForm.DataBrowser.BrowseBy = "DocEntry";
                oDBDSH = oForm.DataSources.DBDataSources.Item("@VID_FEDIST");
                oDBDSD = oForm.DataSources.DBDataSources.Item("@VID_FEDISTD");

                oForm.EnableMenu("1282", false); // boton Crear

                // Ok Ad  Fnd Vw Rq Sec
                Lista.Add("DocEntry  , f,  f,  f,  f, r, 1");
                Lista.Add("Desde     , f,  t,  f,  f, r, 1");
                Lista.Add("Hasta     , f,  t,  f,  f, r, 1");
                Lista.Add("Hasta     , f,  t,  f,  f, r, 1");
                Lista.Add("Sucursal  , f,  t,  f,  f, r, 1");
                Lista.Add("RangoF    , f,  t,  t,  f, r, 1");
                Lista.Add("TipoDoc   , f,  t,  t,  f, r, 1");
                Lista.Add("btnDist   , f,  t,  f,  f, n, 1");
                FSBOf.SetAutoManaged(oForm, Lista);

                //carga tipo documentos
                if (GlobalSettings.RunningUnderSQLServer)
                {
                    s = @"select distinct U_TipoDoc 'Code', U_TipoDoc 'Name' from [@VID_FECAF]";
                }
                else
                {
                    s = @"select distinct ""U_TipoDoc"" ""Code"", ""U_TipoDoc"" ""Name"" from ""@VID_FECAF"" ";
                }
                oRecordSet.DoQuery(s);
                FSBOf.FillCombo((ComboBox)(oForm.Items.Item("TipoDoc").Specific), ref oRecordSet, true);

                //carga sucursales
                if (GlobalSettings.RunningUnderSQLServer)
                {
                    s = "select Code, Name from [@VID_FESUC]";
                }
                else
                {
                    s = @"select ""Code"", ""Name"" from ""@VID_FESUC"" ";
                }
                oRecordSet.DoQuery(s);
                FSBOf.FillCombo((ComboBox)(oForm.Items.Item("Sucursal").Specific), ref oRecordSet, true);

                //        AddChooseFromList();
                oMtx = (Matrix)(oForm.Items.Item("mtx").Specific);
                //        oColumn                    := SAPbouiCOM.Column(oMtx.Columns.Item('V_0'));
                //        oColumn.ChooseFromListUID  := 'CFL0';
                //        oColumn.ChooseFromListAlias:= 'Code';

                if (GlobalSettings.RunningUnderSQLServer)
                {
                    s = @"select C1.FldValue 'Code', C1.Descr 'Name'
                           from CUFD C0
                           join UFD1 C1 on C1.TableID = C0.TableID
                                       and C1.FieldID = C0.FieldID
                          where C0.TableID = '@VID_FEDISTD'
                            and C0.AliasID = 'Estado'";
                }
                else
                {
                    s = @"select C1.""FldValue"" ""Code"", C1.""Descr"" ""Name""
                           from ""CUFD"" C0
                           join ""UFD1"" C1 on C1.""TableID"" = C0.""TableID""
                                       and C1.""FieldID"" = C0.""FieldID""
                          where C0.""TableID"" = '@VID_FEDISTD'
                            and C0.""AliasID"" = 'Estado' ";
                }
                oRecordSet.DoQuery(s);
                oColumn = (SAPbouiCOM.Column)(oMtx.Columns.Item("Estado"));
                FSBOf.FillComboMtx(oColumn, ref oRecordSet, false);

                oDBDSD.InsertRecord(0);
                oMtx.LoadFromDataSource();
                oMtx.AutoResizeColumns();

                //EditText(oForm.Items.Item('CardCode').Specific).Active := True;
                oForm.Mode = BoFormMode.fm_OK_MODE;
            }
            catch (Exception e)
            {
                OutLog("InitForm: " + e.Message + " ** Trace: " + e.StackTrace);
                FSBOApp.MessageBox(e.Message + " ** Trace: " + e.StackTrace, 1, "Ok", "", "");
            }
            oForm.Freeze(false);

            return(Result);
        }//fin InitForm
Ejemplo n.º 9
0
        public new bool InitForm(string uid, string xmlPath, ref Application application, ref SAPbobsCOM.Company company, ref CSBOFunctions SBOFunctions, ref TGlobalVid _GlobalSettings)
        {
            Int32 i;

            //SAPbouiCOM.EditTextColumn oEditText;
            SAPbouiCOM.CommonSetting oSetting;
            TFunctions Reg;
            bool       Result = base.InitForm(uid, xmlPath, ref application, ref company, ref SBOFunctions, ref _GlobalSettings);

            try
            {
                oRecordSet = (SAPbobsCOM.Recordset)(FCmpny.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset));

                Lista = new List <string>();

                FSBOf.LoadForm(xmlPath, "VID_Sucursal.srf", uid);
                //EnableCrystal := true;
                oForm = FSBOApp.Forms.Item(uid);
                oForm.Freeze(true);
                oForm.AutoManaged    = true;
                oForm.SupportedModes = -1;             // afm_All

                //        VID_DelRow := true;
                //        VID_DelRowOK := true;

                //oForm.DataBrowser.BrowseBy := "Code";
                oDBDSH = oForm.DataSources.DBDataSources.Item("@VID_FESUC");

                // Ok Ad  Fnd Vw Rq Sec
                Lista.Add("mtx      , f,  t,  f,  f, r, 1");
                //Lista.Add('Name      , f,  t,  t,  f, r, 1');
                //Lista.Add('CardCode  , f,  t,  t,  f, r, 1');
                //FSBOf.SetAutoManaged(var oForm, Lista);

                //oCombo := ComboBox(oForm.Items.Item('TipDoc').Specific);
                //oCombo.ValidValues.Add('33', 'Factura');

                //s := '1';
                //oCombo.Select(s, BoSearchKey.psk_ByValue);

                //        AddChooseFromList();
                oMtx = (Matrix)(oForm.Items.Item("mtx").Specific);
                //        oColumn                    := SAPbouiCOM.Column(oMtx.Columns.Item('V_0'));
                //        oColumn.ChooseFromListUID  := 'CFL0';
                //        oColumn.ChooseFromListAlias:= 'Code';
                //        oMtx.AutoResizeColumns();

                if (GlobalSettings.RunningUnderSQLServer)
                {
                    s = @"select Code, Name, ISNULL(U_Habilitada,'Y') 'Habilitada' from [@VID_FESUC]";
                }
                else
                {
                    s = @"select ""Code"", ""Name"", IFNULL(""U_Habilitada"",'Y') ""Habilitada"" from ""@VID_FESUC"" ";
                }
                oRecordSet.DoQuery(s);
                if (oRecordSet.RecordCount == 0)
                {
                    if (GlobalSettings.RunningUnderSQLServer)
                    {
                        s = "select Code from [@VID_FESUC] where Code = 'Principal'";
                    }
                    else
                    {
                        s = @"select ""Code"" from ""@VID_FESUC"" where ""Code"" = 'Principal' ";
                    }
                    oRecordSet.DoQuery(s);
                    if (oRecordSet.RecordCount == 0)
                    {
                        Reg       = new TFunctions();
                        Reg.SBO_f = FSBOf;
                        oDBDSH.Clear();
                        oDBDSH.InsertRecord(0);
                        oDBDSH.SetValue("Code", 0, "Principal");
                        oDBDSH.SetValue("Name", 0, "SAP BO");
                        oDBDSH.SetValue("U_Habilitada", 0, "Y");
                        if (Reg.FESUCAdd(oDBDSH) == true)
                        {
                            FSBOApp.StatusBar.SetText("Sucursal Principal creada correctamente", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Success);
                        }
                        else
                        {
                            FSBOApp.StatusBar.SetText("Sucursal Principal no ha sido creada", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                        }
                    }
                }

                if (GlobalSettings.RunningUnderSQLServer)
                {
                    s = @"select Code, Name, ISNULL(U_Habilitada,'Y') 'Habilitada' from [@VID_FESUC]";
                }
                else
                {
                    s = @"select ""Code"", ""Name"", IFNULL(""U_Habilitada"",'Y') ""Habilitada"" from ""@VID_FESUC"" ";
                }
                oRecordSet.DoQuery(s);
                i = 0;
                oDBDSH.Clear();
                while (!oRecordSet.EoF)
                {
                    oDBDSH.InsertRecord(i);
                    oDBDSH.SetValue("Code", i, (System.String)(oRecordSet.Fields.Item("Code").Value));
                    oDBDSH.SetValue("Name", i, (System.String)(oRecordSet.Fields.Item("Name").Value));
                    oDBDSH.SetValue("U_Habilitada", i, (System.String)(oRecordSet.Fields.Item("Habilitada").Value));
                    oRecordSet.MoveNext();
                    i++;
                }

                oDBDSH.InsertRecord(i);
                oDBDSH.SetValue("Code", i, "");
                oDBDSH.SetValue("Name", i, "");
                oDBDSH.SetValue("U_Habilitada", i, "Y");

                if (GlobalSettings.RunningUnderSQLServer)
                {
                    s = @"select FldValue 'Code', Descr 'Name' from UFD1 where TableID = '@VID_FESUC' and FieldID = 0";
                }
                else
                {
                    s = @"select ""FldValue"" ""Code"", ""Descr"" ""Name"" from ""UFD1"" where ""TableID"" = '@VID_FESUC' and ""FieldID"" = 0";
                }
                oRecordSet.DoQuery(s);
                oColumn = (SAPbouiCOM.Column)(oMtx.Columns.Item("Habilitada"));
                FSBOf.FillComboMtx(oColumn, ref oRecordSet, false);

                //EditText(oForm.Items.Item('CardCode').Specific).Active := True;
                oMtx.LoadFromDataSource();

                oSetting = oMtx.CommonSetting;
                i        = 1;
                while (i <= oMtx.RowCount)
                {
                    if ((System.String)(oDBDSH.GetValue("Code", i - 1)).Trim() != "")
                    {
                        oSetting.SetCellEditable(i, 1, false);
                    }
                    i++;
                }

                oForm.Mode = BoFormMode.fm_OK_MODE;
                oMtx.AutoResizeColumns();
            }
            catch (Exception e)
            {
                OutLog("InitForm: " + e.Message + " ** Trace: " + e.StackTrace);
                FSBOApp.MessageBox(e.Message + " ** Trace: " + e.StackTrace, 1, "Ok", "", "");
            }
            oForm.Freeze(false);
            return(Result);
        }//fin InitForm
Ejemplo n.º 10
0
        private void fillCBs()
        {
            for (int i = 1; i <= 12; i++)
            {
                cbHH.ValidValues.Add(i.ToString().PadLeft(2, '0'), i.ToString().PadLeft(2, '0'));
                cbOTHH.ValidValues.Add(i.ToString().PadLeft(2, '0'), i.ToString().PadLeft(2, '0'));
            }

            for (int i = 0; i <= 59; i += 5)
            {
                cbMM.ValidValues.Add(i.ToString().PadLeft(2, '0'), i.ToString().PadLeft(2, '0'));
                cbOTMM.ValidValues.Add(i.ToString().PadLeft(2, '0'), i.ToString().PadLeft(2, '0'));
            }
            cbAP.ValidValues.Add("AM", "AM");
            cbAP.ValidValues.Add("PM", "PM");
            cbOTAP.ValidValues.Add("AM", "AM");
            cbOTAP.ValidValues.Add("PM", "PM");


            cbEWN.ValidValues.Add("1", "1");
            cbEWN.ValidValues.Add("2", "2");
            cbEWN.ValidValues.Add("3", "3");
            cbEWN.ValidValues.Add("4", "4");

            cbHH.Select("12", BoSearchKey.psk_ByValue);
            cbMM.Select(0, BoSearchKey.psk_Index);
            cbAP.Select(0, BoSearchKey.psk_Index);

            cbOTHH.Select("12", BoSearchKey.psk_ByValue);
            cbOTMM.Select(0, BoSearchKey.psk_Index);
            cbOTAP.Select(0, BoSearchKey.psk_Index);


            cbEWN.Select(0, BoSearchKey.psk_Index);


            System.Data.DataTable dtSP = Program.objHrmsUI.getDataTable("Select slpcode,slpname from oslp", "FillSP");

            foreach (System.Data.DataRow dr in dtSP.Rows)
            {
                cbSP.ValidValues.Add(dr["slpcode"].ToString(), dr["slpname"].ToString());
            }

            cbSP.Select(0, SAPbouiCOM.BoSearchKey.psk_Index);


            cbDays.ValidValues.Add("Mon", "Monday");
            cbDays.ValidValues.Add("Tue", "Tuesday");
            cbDays.ValidValues.Add("Wed", "Wednesday");
            cbDays.ValidValues.Add("Thu", "Thursday");
            cbDays.ValidValues.Add("Fri", "Friday");
            cbDays.ValidValues.Add("Sat", "Saturday");
            cbDays.ValidValues.Add("Sun", "Sunday");



            cbWeeks.ValidValues.Add("1", "Week 1");
            cbWeeks.ValidValues.Add("2", "Week 2");
            cbWeeks.ValidValues.Add("3", "Week 3");
            cbWeeks.ValidValues.Add("4", "Week 4");
            cbWeeks.ValidValues.Add("5", "Week 5");



            SAPbouiCOM.Column mtColDay = mtDay.Columns.Item("colDay");
            mtColDay.ValidValues.Add("Mon", "Monday");
            mtColDay.ValidValues.Add("Tue", "Tuesday");
            mtColDay.ValidValues.Add("Wed", "Wednesday");
            mtColDay.ValidValues.Add("Thu", "Thursday");
            mtColDay.ValidValues.Add("Fri", "Friday");
            mtColDay.ValidValues.Add("Sat", "Saturday");
            mtColDay.ValidValues.Add("Sun", "Sunday");

            SAPbouiCOM.Column mtColWeek = mtDay.Columns.Item("colWeek");
            mtColWeek.ValidValues.Add("1", "Week 1");
            mtColWeek.ValidValues.Add("2", "Week 2");
            mtColWeek.ValidValues.Add("3", "Week 3");
            mtColWeek.ValidValues.Add("4", "Week 4");
            mtColWeek.ValidValues.Add("5", "Week 5");
        }