Beispiel #1
0
        private void verificarEstadoBaseMovil()
        {
            SAPbobsCOM.Recordset oRS = null;

            try
            {
                oRS = company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
                oRS.DoQuery("select count(*) as \"Result\" from \"SYS\".\"P_SCHEMAS_\" where \"NAME\" = '" + BdMobile.BD_NAME + "'");
                if (oRS.RecordCount > 0)
                {
                    int result = int.Parse(oRS.Fields.Item("Result").Value.ToString().Trim());
                    if (result == 0)
                    {
                        application.StatusBar.SetText("Base móvil no encontrada. Se registrará la base móvil.", SAPbouiCOM.BoMessageTime.bmt_Medium, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);
                        oRS.DoQuery(BdMobile.getDataBaseSQL());
                        foreach (var scriptTable in BdMobile.getTablesSQL())
                        {
                            oRS.DoQuery(scriptTable);
                        }
                        application.StatusBar.SetText("Base móvil registrada.", SAPbouiCOM.BoMessageTime.bmt_Medium, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);
                    }
                }
            }
            catch (Exception ex)
            {
                application.StatusBar.SetText("verificarEstadoBaseMovil() > " + ex.Message);
            }
            finally
            {
                if (oRS != null)
                {
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(oRS);
                }
            }
        }
Beispiel #2
0
        private void createSP(string name, string store)
        {
            SAPbobsCOM.Recordset rs = Conexion.company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);

            try
            {
                try
                {
                    rs.DoQuery("DROP PROCEDURE " + name);
                }
                catch (Exception)
                {
                }

                rs.DoQuery(store);
            }
            catch (Exception ex)
            {
                StatusMessageError("createSP() > " + ex.Message);
            }
            finally
            {
                if (rs != null)
                {
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(rs);
                }
            }
        }
Beispiel #3
0
    public void SetupCfgInit()
    {
        string sql = string.Format("select 1 from \"@CCCFG\"");


        string sql2 = string.Format("INSERT INTO \"@CCCFG\"(\"DocEntry\", \"U_Pin\", \"U_SourceKey\", \"U_eBizChargeUrl\", \"U_NegPayment\", \"U_ProcessPreAuth\", \"U_sendCustomerEmail\" , \"U_urlSandbox\" , \"U_urlProduction\",\"U_merchantID\") " +
                                    " values(1, '{0}','{1}','{2}', 'Y', 'Y', 'Y','https://sandbox.ebizcharge.com/soap/gate/CCEBDC0A','https://secure.ebizcharge.com/soap/gate/CCEBDC0A','{3}')", "", "", "", txtMerchantID);

        SAPbobsCOM.Recordset oRS = (SAPbobsCOM.Recordset)oSetupCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
        try
        {
            oRS.DoQuery(sql);
            if (oRS.EoF)
            {
                oRS.DoQuery(sql2);
            }
        }
        catch (Exception ex)
        {
            errorLog(ex);
            errorLog(sql);
            errorLog(sql2);
        }
        finally
        {
            System.Runtime.InteropServices.Marshal.ReleaseComObject(oRS);
        }
    }
Beispiel #4
0
    public void SetupInitCardAcct()
    {
        string sql  = "delete from \"@CCCARDACCT\" where \"U_CardCode\" Not in (select \"CreditCard\" from OCRC) or \"U_CardCode\" is null";
        string sql2 = "insert into \"@CCCARDACCT\"(\"DocEntry\", \"U_CardCode\", \"U_CardName\")\r\n" +
                      "Select \"CreditCard\", \"CreditCard\", \"CardName\" from OCRC a where a.\"CreditCard\" not in (select \"U_CardCode\" from \"@CCCARDACCT\")";
        string sql3 = "Update \"@CCCARDACCT\" set \"U_CardName\" = a.\"CardName\" from OCRC a, \"@CCCARDACCT\" b where a.\"CreditCard\" = b.\"U_CardCode\"";

        SAPbobsCOM.Recordset oRS = (SAPbobsCOM.Recordset)oSetupCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);

        try
        {
            oRS.DoQuery(sql);
            oRS.DoQuery(sql2);
            oRS.DoQuery(sql3);
        }
        catch (Exception ex)
        {
            errorLog(ex);
            errorLog(sql);
            errorLog(sql2);
            errorLog(sql3);
        }
        finally
        {
            System.Runtime.InteropServices.Marshal.ReleaseComObject(oRS);
        }
        SetupinitUpdateCardAcctWithOCRC("v", "Visa");
        SetupinitUpdateCardAcctWithOCRC("m", "Ma");
        SetupinitUpdateCardAcctWithOCRC("a", "Am");
        SetupinitUpdateCardAcctWithOCRC("ds", "Disc");
        SetupinitUpdateCardAcctWithOCRC("eCheck", "eCheck");
    }
Beispiel #5
0
        private void cargarRuta()
        {
            String fechaD, fechaH;

            try
            {
                oForm.Freeze(true);

                if (CBoxtpoRuta.ValidValues.Count > 0)
                {
                    for (int i = CBoxtpoRuta.ValidValues.Count - 1; i >= 0; i--)
                    {
                        CBoxtpoRuta.ValidValues.Remove(i, SAPbouiCOM.BoSearchKey.psk_Index);
                    }
                }

                fechaD = ((System.String)((SAPbouiCOM.EditText)oForm.Items.Item("FechaD").Specific).Value);
                fechaH = ((System.String)((SAPbouiCOM.EditText)oForm.Items.Item("FechaH").Specific).Value);

                s = @"SELECT T0.""U_RUTA"" ""Code"" , T0.""U_RUTA"" ""Name""
                        FROM ""ORDR"" T0
                        WHERE T0.""U_RUTA"" IS NOT NULL
                        AND T0.""DocDueDate"" BETWEEN '{0}' AND  '{1}'
                        GROUP BY T0.""U_RUTA""
                        ORDER BY T0.""U_RUTA""";
                s = String.Format(s, fechaD, fechaH);

                oRecordSet.DoQuery(s);
                oRecordSet.MoveFirst();

                int a = oRecordSet.RecordCount;

                while (!oRecordSet.EoF)
                {
                    string code = (String)(oRecordSet.Fields.Item("Code").Value);
                    string name = (String)(oRecordSet.Fields.Item("Name").Value);
                    CBoxtpoRuta.ValidValues.Add(code, name);
                    oRecordSet.MoveNext();

                    ;
                }
                if (CBoxtpoRuta.ValidValues.Count > 0)
                {
                    CBoxtpoRuta.ValidValues.Add("Todos", "Todos");
                    //oRecordSet.MoveNext();
                }
            }
            catch (Exception e)
            {
                Application.SBO_Application.StatusBar.SetText(e.Message + " ** Trace: " + e.StackTrace, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error);
                log.AddLog(e.Message + " ** Trace: ");
            }
            finally
            {
                oForm.Freeze(false);
            }
        }
Beispiel #6
0
        public async Task <IActionResult> Get(uint DocEntry)
        {
            SAPContext context = HttpContext.RequestServices.GetService(typeof(SAPContext)) as SAPContext;

            SAPbobsCOM.Recordset oRecSet = (SAPbobsCOM.Recordset)context.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
            oRecSet.DoQuery($@"
                SELECT
                    document.""DocEntry"",
                    document.""DocNum"",
                    to_char(to_date(SUBSTRING(document.""DocDate"", 0, 10), 'YYYY-MM-DD'), 'DD-MM-YYYY') as ""DocDate"",

                    (case when document.""CANCELED"" = 'Y' then 'Cancelado'
                    when document.""DocStatus"" = 'O' then 'Abierto'
                    when document.""DocStatus"" = 'C' then 'Cerrado'
                    else document.""DocStatus"" end)  AS  ""DocStatus"",

                    warehouse.""WhsName""
                FROM OIGN document
                LEFT JOIN NNM1 series ON series.""Series"" = document.""Series""
                LEFT JOIN OWHS warehouse ON warehouse.""WhsCode"" = series.""SeriesName""
                WHERE document.""DocEntry"" = '{DocEntry}';");

            int rc = oRecSet.RecordCount;

            if (rc == 0)
            {
                return(NoContent());
            }

            JToken temp = context.XMLTOJSON(oRecSet.GetAsXML())["OIGN"][0];

            oRecSet.DoQuery($@"
                Select
                    ""ItemCode"",
                    ""Dscription"",
                    ""Quantity"",
                    ""UomCode"",
                    ""InvQty"",
                    ""UomCode2""
                From IGN1 Where ""DocEntry"" = '{DocEntry}';");
            oRecSet.MoveFirst();
            temp["Lines"] = context.XMLTOJSON(oRecSet.GetAsXML())["IGN1"];

            GoodsReceiptDetail output = temp.ToObject <GoodsReceiptDetail>();

            //Force Garbage Collector. Recommendation by InterLatin Dude. SDK Problem with memory.
            GC.Collect();
            GC.WaitForPendingFinalizers();

            //var s1 = Stopwatch.StartNew();
            //s1.Stop();
            //const int _max = 1000000;
            //Console.WriteLine(((double)(s1.Elapsed.TotalMilliseconds * 1000 * 1000) / _max).ToString("0.00 ns"));

            return(Ok(output));
        }
Beispiel #7
0
        public async Task <IActionResult> GetDetail(int id)
        {
            SAPContext context = HttpContext.RequestServices.GetService(typeof(SAPContext)) as SAPContext;

            SAPbobsCOM.Recordset oRecSet = (SAPbobsCOM.Recordset)context.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
            oRecSet.DoQuery(@"
                Select
                    ord.""DocEntry"",
                    ord.""DocNum"",
                    ord.""DocCur"",
                    
                    ord.""DocTotal"",
                    ord.""DocTotalFC"",
                    to_char(to_date(SUBSTRING(ord.""DocDate"", 0, 10), 'YYYY-MM-DD'), 'DD-MM-YYYY') as ""DocDate"",
                    to_char(to_date(SUBSTRING(ord.""DocDueDate"", 0, 10), 'YYYY-MM-DD'), 'DD-MM-YYYY') as ""DocDueDate"",
                    to_char(to_date(SUBSTRING(ord.""CancelDate"", 0, 10), 'YYYY-MM-DD'), 'DD-MM-YYYY') as ""CancelDate"",

                    (case when ord.""CANCELED"" = 'Y' then 'Cancelado'
                    when ord.""DocStatus"" = 'O' then 'Abierto'
                    when ord.""DocStatus"" = 'C' then 'Cerrado'
                    else ord.""DocStatus"" end)  AS  ""DocStatus"",

                    ord.""Comments"",
                    contact.""CardCode"",
                    contact.""CardName"",
                    contact.""CardFName"",
                    warehouse.""WhsName""
                From OPDN ord
                LEFT JOIN NNM1 serie ON ord.""Series"" = serie.""Series""
                LEFT JOIN OWHS warehouse ON serie.""SeriesName"" = warehouse.""WhsCode""
                LEFT JOIN OCRD contact ON ord.""CardCode"" = contact.""CardCode""
                WHERE ord.""DocEntry"" = '" + id + "'");
            oRecSet.MoveFirst();
            JToken purchaseOrder = context.XMLTOJSON(oRecSet.GetAsXML())["OPDN"][0];

            oRecSet.DoQuery(@"
                Select
                    ""ItemCode"",
                    ""Dscription"",
                    ""Price"",
                    ""Currency"",
                    ""Quantity"",
                    ""UomCode"",
                    ""InvQty"",
                    ""UomCode2"",
                    ""LineTotal"",
                    ""TotalFrgn""
                From PDN1
                WHERE ""DocEntry"" = '" + id + "'");
            oRecSet.MoveFirst();
            purchaseOrder["rows"] = context.XMLTOJSON(oRecSet.GetAsXML())["PDN1"];
            return(Ok(purchaseOrder));
        }
Beispiel #8
0
        public async Task <IActionResult> GetCRMClientToSell(string CardCode)
        {
            SAPContext context = HttpContext.RequestServices.GetService(typeof(SAPContext)) as SAPContext;

            SAPbobsCOM.Recordset oRecSet = (SAPbobsCOM.Recordset)context.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);

            oRecSet.DoQuery(@"
                Select
                    ""CardCode"",
                    ""CardName"",
                    ""CardFName"",
                    contact.""ListNum"",
                    paymentTerm.""GroupNum"",
                    paymentTerm.""PymntGroup"",
                    paymentMethod.""PayMethCod"",
                    paymentMethod.""Descript"",
                    ""SlpName"",
                    ""Balance"",
                    ""ListName""
                From OCRD contact
                JOIN OSLP seller ON contact.""SlpCode"" = seller.""SlpCode""
                JOIN OCTG paymentTerm ON paymentTerm.""GroupNum"" = contact.""GroupNum""
                JOIN OPLN priceList ON priceList.""ListNum"" = contact.""ListNum""
                LEFT JOIN OPYM paymentMethod ON paymentMethod.""PayMethCod"" = contact.""PymCode""
                Where ""CardCode"" = '" + CardCode + "'");

            if (oRecSet.RecordCount == 0)
            {
                return(NoContent());
            }

            JToken temp = context.XMLTOJSON(oRecSet.GetAsXML())["OCRD"][0];

            oRecSet.DoQuery(@"
                Select
                    paymentMethodCardCode.""PymCode"",
                    paymentMethod.""Descript""
                From CRD2 paymentMethodCardCode
                JOIN OPYM paymentMethod ON paymentMethod.""PayMethCod"" = paymentMethodCardCode.""PymCode""
                Where ""CardCode"" = '" + CardCode + "'");

            temp["PaymentMethods"] = context.XMLTOJSON(oRecSet.GetAsXML())["CRD2"];

            ContactToSell ContactOutput = temp.ToObject <ContactToSell>();

            //Force Garbage Collector. Recommendation by InterLatin Dude. SDK Problem with memory.
            GC.Collect();
            GC.WaitForPendingFinalizers();

            return(Ok(ContactOutput));
        }
Beispiel #9
0
        public async Task <IActionResult> Get(string WhsCode, string ItemCode)
        {
            SAPContext context = HttpContext.RequestServices.GetService(typeof(SAPContext)) as SAPContext;

            SAPbobsCOM.Recordset oRecSet = (SAPbobsCOM.Recordset)context.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);

            oRecSet.DoQuery($@"
                Select ""ManBtchNum""
                From OITM
                Where ""ItemCode"" = '{ItemCode}';");

            if (oRecSet.RecordCount == 0)
            {
                return(NoContent());
            }

            string ManBtnNum = context.XMLTOJSON(oRecSet.GetAsXML())["OITM"][0]["ManBtchNum"].ToString();

            if (ManBtnNum == "N")
            {
                oRecSet.DoQuery($@"
                    Select ""OnHand""
                    From OITW
                    Where ""WhsCode"" = '{WhsCode}'
                    AND ""ItemCode"" = '{ItemCode}';");

                double stock = context.XMLTOJSON(oRecSet.GetAsXML())["OITW"][0]["OnHand"].ToObject <double>();
                return(Ok(new { value = "No Maneja Lote", stock }));
            }

            oRecSet.DoQuery($@"
                Select
                    ""ItemCode"",
                    ""BatchNum"",
                    ""Quantity"",
                    ""U_IL_CodBar"",
                    ""CreateDate""
                From OIBT
                Where ""Quantity"" != 0 AND ""ItemCode"" = '{ItemCode}' AND ""WhsCode"" = '{WhsCode}';");
            oRecSet.MoveFirst();

            JToken batchList = context.XMLTOJSON(oRecSet.GetAsXML())["OIBT"];

            //Force Garbage Collector. Recommendation by InterLatin Dude. SDK Problem with memory.
            GC.Collect();
            GC.WaitForPendingFinalizers();

            return(Ok(batchList));
        }
Beispiel #10
0
        private static string[] GetConfigValues()
        {
            SAPbobsCOM.Recordset lObjRecordSet = null;
            string[]             lArrConfig;
            try
            {
                lObjRecordSet = (SAPbobsCOM.Recordset)DIApplication.Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
                lObjRecordSet.DoQuery("SELECT STUFF((SELECT ', ' + U_Value FROM [@UG_CONFIG] where Name='CO_PROD_CONTRACT' or Name='CP_PROD_USER' or Name='CO_PROD_PASSW' FOR XML PATH(''), TYPE).value('.', 'NVARCHAR(MAX)'), 1, 1, '') as Value"); //SELECT CO_DIFFACT FROM [@UG_CONFIG]
                if (lObjRecordSet.RecordCount == 1)
                {
                    lArrConfig = lObjRecordSet.Fields.Item(0).Value.ToString().Split(',');
                    if (lArrConfig.Length != 3)
                    {
                        throw new Exception("No se encontro la configuracion para hacer la validacion con SAT");
                    }
                }
                else
                {
                    throw new Exception("No se encontro la configuracion para hacer la validacion con SAT");
                }

                return(lArrConfig);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                Marshal.ReleaseComObject(lObjRecordSet);
            }
        }
Beispiel #11
0
        public async Task <IActionResult> GetList(string date)
        {
            SAPContext context = HttpContext.RequestServices.GetService(typeof(SAPContext)) as SAPContext;

            SAPbobsCOM.Documents items   = (SAPbobsCOM.Documents)context.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oPurchaseDeliveryNotes);
            SAPbobsCOM.Recordset oRecSet = (SAPbobsCOM.Recordset)context.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
            List <Object>        list    = new List <Object>();

            oRecSet.DoQuery("Select * From OPDN Where \"DocDate\" = '" + date + "'");
            int rc = oRecSet.RecordCount;

            if (rc == 0)
            {
                return(NotFound());
            }
            items.Browser.Recordset = oRecSet;
            items.Browser.MoveFirst();

            while (items.Browser.EoF == false)
            {
                JToken temp = context.XMLTOJSON(items.GetAsXML());
                temp["OPDN"] = temp["OPDN"][0];
                temp["PDN4"]?.Parent.Remove();
                temp["PDN12"]?.Parent.Remove();
                temp["BTNT"]?.Parent.Remove();
                list.Add(temp);
                items.Browser.MoveNext();
            }

            return(Ok(list));
        }
Beispiel #12
0
        public bool GetLastDelivery(int pIntTicket)
        {
            SAPbobsCOM.Recordset lObjRecordsetCT = null;
            try
            {
                lObjRecordsetCT = (SAPbobsCOM.Recordset)DIApplication.Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
                string lStrQuery = (string.Format("SELECT * FROM DLN1 WHERE U_PL_Ticket ='{0}'", pIntTicket));

                lObjRecordsetCT.DoQuery(lStrQuery);

                if (lObjRecordsetCT.RecordCount > 0)
                {
                    return(true);
                }
            }
            catch (Exception ex)
            {
                LogService.WriteError("[RemoveTicketDetail]: " + ex.Message);
                LogService.WriteError(ex);
                UIApplication.ShowError("Error: " + ex.Message);
            }
            finally
            {
                MemoryUtility.ReleaseComObject(lObjRecordsetCT);
            }

            return(false);
        }
Beispiel #13
0
        public static bool actualizar(EmpresaBean bean)
        {
            var res = true;

            SAPbobsCOM.Recordset mRS = null;

            try
            {
                mRS = Conexion.company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
                mRS.DoQuery("update " + BdMobile.BD_NAME + "." + BdMobile.TB_EMPRESAS + " SET \"descripcion\" = '" + bean.descripcion + "', " +
                            "	 \"estado\" = '"+ bean.estado + "', \"usuario\" = '" + bean.usuario + "', \"clave\" = '" + bean.password + "', " +
                            "	 \"LINEAS_ORDR\" = "+ bean.maximoLineas + ", \"EST_ORDR\" = '" + bean.estadoOrden + "', " +
                            "    \"EST_ORCT\" = '" + bean.estadoPago + "', \"MOTIVO\" = '" + bean.motivoTraslado + "' " +
                            "    where \"id\" = " + bean.id);
            }
            catch (Exception e)
            {
                res = false;
                StatusMessageError("EmpresaDAO > actualizar() > " + e.Message);
            }
            finally
            {
                if (mRS != null)
                {
                    LiberarObjetoGenerico(mRS);
                }
            }

            return(res);
        }
Beispiel #14
0
        public List <string> GetServerDatetime()
        {
            string        lStrQuery  = "select getdate(), SUBSTRING( convert(varchar, getdate(),108),1,5)";
            List <string> lStrResult = new List <string>();

            SAPbobsCOM.Recordset lObjRecordSet = null;
            try
            {
                lObjRecordSet = (SAPbobsCOM.Recordset)DIApplication.Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
                lObjRecordSet.DoQuery(lStrQuery);

                if (lObjRecordSet.RecordCount > 0)
                {
                    lStrResult.Add(lObjRecordSet.Fields.Item(0).Value.ToString());
                    lStrResult.Add(lObjRecordSet.Fields.Item(1).Value.ToString());
                }
            }
            catch (Exception ex)
            {
                LogService.WriteError("[GetServerDatetime]: " + ex.Message);
                LogService.WriteError(ex);
                UIApplication.ShowMessageBox(string.Format("Error de consulta", ex.Message));
            }
            finally
            {
                MemoryUtility.ReleaseComObject(lObjRecordSet);
            }

            return(lStrResult);
        }
Beispiel #15
0
        //select sum(U_netWeight) as NetWeight from  [@UG_PL_TCKD] where U_Folio = '258'
        public string GetNetWeight(string pStrFolio)
        {
            Dictionary <string, string> lLstStrParameters = null;
            string lStrNetWeight = "0";

            SAPbobsCOM.Recordset lObjRecordsetCT = null;
            try
            {
                lObjRecordsetCT = (SAPbobsCOM.Recordset)DIApplication.Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
                string lStrQuery = ("select sum(U_netWeight) as NetWeight from  [@UG_PL_TCKD] where U_Folio = '{Folio}'");
                lLstStrParameters = new Dictionary <string, string>();
                lLstStrParameters.Add("Folio", pStrFolio);

                lStrQuery = lStrQuery.Inject(lLstStrParameters);
                lObjRecordsetCT.DoQuery(lStrQuery);

                if (lObjRecordsetCT.RecordCount > 0)
                {
                    lStrNetWeight = lObjRecordsetCT.Fields.Item(0).Value.ToString();
                }
            }
            catch (Exception ex)
            {
                LogService.WriteError("[GetNetWeight]: " + ex.Message);
                LogService.WriteError(ex);
                UIApplication.ShowError("Error al consultar cantidades pendientes " + ex.Message);
            }
            finally
            {
                MemoryUtility.ReleaseComObject(lObjRecordsetCT);
            }
            return(lStrNetWeight);
        }
Beispiel #16
0
        public static bool registrar(EmpresaBean bean)
        {
            var res = true;

            SAPbobsCOM.Recordset mRS = null;

            try
            {
                string query = "INSERT INTO " + BdMobile.BD_NAME + "." + BdMobile.TB_EMPRESAS + " (\"id\", \"descripcion\", \"base_datos\", \"estado\",  " +
                               " \"usuario\", \"clave\", \"observacion\", \"LINEAS_ORDR\", \"EST_ORDR\", \"EST_ORCT\", \"MOTIVO\")  " +
                               " VALUES(" + obtenerUltimoId() + ", '" + bean.descripcion + "', '" + bean.base_datos + "', '" +
                               bean.estado + "', '" + bean.usuario + "', '" + bean.password + "', '', " +
                               bean.maximoLineas + ", '" + bean.estadoOrden + "', '" + bean.estadoPago + "', '" + bean.motivoTraslado + "')";

                mRS = Conexion.company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
                mRS.DoQuery(query);
            }
            catch (Exception e)
            {
                res = false;
                StatusMessageError("EmpresaDAO > registrar() > " + e.Message);
            }
            finally
            {
                if (mRS != null)
                {
                    LiberarObjetoGenerico(mRS);
                }
            }

            return(res);
        }
Beispiel #17
0
        public static int obtenerIdInterno()
        {
            int res = -1;

            SAPbobsCOM.Recordset oRS = null;

            try
            {
                oRS = Conexion.company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
                oRS.DoQuery("select \"id\" as \"Result\" from " + BdMobile.BD_NAME + "." + BdMobile.TB_EMPRESAS + " where \"base_datos\" = '" + Conexion.company.CompanyDB + "'");

                if (oRS.RecordCount > 0)
                {
                    res = int.Parse(oRS.Fields.Item("Result").Value.ToString().Trim());
                }
            }
            catch (Exception)
            {
                res = -1;
            }
            finally
            {
                if (oRS != null)
                {
                    LiberarObjetoGenerico(oRS);
                }
            }


            return(res);
        }
Beispiel #18
0
        private void OnCustomInitialize()
        {
            oApp     = (SAPbouiCOM.Application)Application.SBO_Application;
            oCompany = (SAPbobsCOM.Company)oApp.Company.GetDICompany();



            //busca con recorset los datos y los muestros en los textboxes
            SAPbobsCOM.Recordset oRecordset   = ((SAPbobsCOM.Recordset)(oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)));
            SAPbouiCOM.EditText  oEditStatus  = EditText1;
            SAPbouiCOM.EditText  oEditStatus2 = EditText2;
            SAPbouiCOM.EditText  oEditStatus3 = EditText3;
            //oApp.SetStatusBarMessage("El dato es..." + EditText0.Value);
            string SqlCad1 = "select t0.U_NombreEDC as 'Nombre',t0.U_ProyectoEDC as 'Proyecto',t1.U_NombrePyto as 'NombreProyecto' from [@EDICIONESCOL] as t0  left join [@PROYECTOSCOSTE] as t1 on t0.U_ProyectoEDC = (CAST (t1.U_CentroPyto AS VARCHAR) + '' + CAST (t1.U_DeptoPyto AS VARCHAR) + '' + CAST (t1.U_CodigoPyto AS VARCHAR)) where t0.U_CodigoEDC= '" + sValorGrid2 + "'";

            // oApp.SetStatusBarMessage("El dato es " + SqlCad1);
            oRecordset.DoQuery(SqlCad1);
            string Extraerdequery  = oRecordset.Fields.Item("Nombre").Value.ToString();
            string Extraerdequery2 = oRecordset.Fields.Item("Proyecto").Value.ToString();
            string Extraerdequery3 = oRecordset.Fields.Item("NombreProyecto").Value.ToString();

            oEditStatus.Value  = Extraerdequery;
            oEditStatus2.Value = Extraerdequery2;
            oEditStatus3.Value = Extraerdequery3;



            CleanComboBox(ComboBox0);
            string SqlCad = ("  SELECT CAST (U_CentroPyto AS VARCHAR) + '' + CAST (U_DeptoPyto AS VARCHAR) + '' + CAST (U_CodigoPyto AS VARCHAR) As Codigo,U_NombrePyto FROM [@PROYECTOSCOSTE]");

            // oApp.SetStatusBarMessage("El dato es " + SqlCad );
            LoadComboQueryRecordset(SqlCad, ComboBox0, "Codigo", "U_NombrePyto", oCompany);
        }
Beispiel #19
0
        public List <string> GetAuthorizers(string pStrConfigName)
        {
            SAPbobsCOM.Recordset lObjResults = (SAPbobsCOM.Recordset)DIApplication.Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
            List <string>        lStrUsers   = new List <string>();

            try
            {
                Dictionary <string, string> lLstParams = new Dictionary <string, string>();
                lLstParams.Add("ConfigName", pStrConfigName);
                string lStrQuery = this.GetSQL("GetAuthorizers").Inject(lLstParams);
                lObjResults.DoQuery(lStrQuery);
                if (lObjResults.RecordCount > 0)
                {
                    for (int i = 0; i < lObjResults.RecordCount; i++)
                    {
                        lStrUsers.Add(lObjResults.Fields.Item("U_Value").Value.ToString());
                        lObjResults.MoveNext();
                    }
                }
            }
            catch (Exception ex)
            {
                LogService.WriteError("CommissionDAO (GetAauthorizers): " + ex.Message);
                LogService.WriteError(ex);
                UIApplication.ShowError(string.Format("GetAauthorizers: {0}", ex.Message));
            }
            finally
            {
                MemoryUtility.ReleaseComObject(lObjResults);
            }
            return(lStrUsers);
        }
Beispiel #20
0
        public async Task <IActionResult> GetTSRList()
        {
            SAPContext context = HttpContext.RequestServices.GetService(typeof(SAPContext)) as SAPContext;

            SAPbobsCOM.Recordset oRecSet = (SAPbobsCOM.Recordset)context.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
            // Release WMS
            //oRecSet.DoQuery(@"
            //    Select
            //        warehouse.""WhsCode"" as ""WhsCodeTSR"",
            //        warehouse2.""WhsCode"" as ""WhsCode"",
            //        warehouse.""WhsName""
            //    From OWHS warehouse
            //    JOIN OWHS warehouse2 ON warehouse.""WhsName"" = warehouse2.""WhsName"" AND warehouse.""WhsCode"" != warehouse2.""WhsCode""
            //    Where warehouse.""WhsCode"" LIKE 'TSR%'");

            oRecSet.DoQuery(@"
                Select
                    warehouse.""WhsCode"" as WhsTSRCode,
                    warehouse2.""WhsCode"" as WhsCode,
                    warehouse.""WhsName""
                From OWHS warehouse
                JOIN OWHS warehouse2 ON warehouse.""WhsName"" = warehouse2.""WhsName"" AND warehouse.""WhsCode"" != warehouse2.""WhsCode""
                Where warehouse.""WhsCode"" LIKE 'TSR%'");
            oRecSet.MoveFirst();
            JToken warehouseList = context.XMLTOJSON(oRecSet.GetAsXML())["OWHS"];

            return(Ok(warehouseList));
        }
Beispiel #21
0
        private List <object> GetListBatch(string pStrAlmacen, string oStrCardCode, string pStrItemCode, List <object> pLstUsedBatch)
        {
            SAPbobsCOM.Recordset lObjRecordSet3 = (SAPbobsCOM.Recordset)oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
            lObjRecordSet3.DoQuery("SELECT T0.DistNumber AS BatchNumber, T1.Quantity FROM OBTN AS T0 INNER JOIN dbo.OBTQ AS T1 ON T0.ItemCode = T1.ItemCode AND T0.SysNumber = T1.SysNumber where T1.WhsCode = '" + pStrAlmacen + "' and T1.Quantity>0 and MnfSerial is not null and T0.MnfSerial = '" + oStrCardCode + "' and T0.ItemCode = '" + pStrItemCode + "' order by T0.ExpDate asc");

            List <object> lLstrLotes = new List <object>();

            while (!lObjRecordSet3.EoF)
            {
                var lObjUsedBatch = pLstUsedBatch.Find(x => ((dynamic)x).Batch == lObjRecordSet3.Fields.Item(0).Value.ToString());

                if (lObjUsedBatch == null || ((dynamic)lObjUsedBatch).Quantity < int.Parse(lObjRecordSet3.Fields.Item(1).Value.ToString()))
                {
                    lLstrLotes.Add(new
                    {
                        Batch    = lObjRecordSet3.Fields.Item(0).Value.ToString(),
                        Quantity = int.Parse(lObjRecordSet3.Fields.Item(1).Value.ToString())
                    });
                }

                lObjRecordSet3.MoveNext();
            }

            Memory.ReleaseComObject(lObjRecordSet3);

            return(lLstrLotes);
        }
Beispiel #22
0
 public void InsertDocumentReference(int pIntCredMemoDocNum, int pIntObjType, int pIntLineNum, int pIntRefDocEntry, int pIntRefDocNum, int pIntRefObjType, string pStrLinkRefType, string pObjDate)
 {
     SAPbobsCOM.Recordset lObjResults = (SAPbobsCOM.Recordset)DIApplication.Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
     try
     {
         string lStrQuery = this.GetSQL("AddDraftReference");
         Dictionary <string, string> lObjParameters = new Dictionary <string, string>();
         lObjParameters.Add("DocEntry", pIntCredMemoDocNum.ToString());
         lObjParameters.Add("ObjectType", pIntObjType.ToString());
         lObjParameters.Add("LineNum", pIntLineNum.ToString());
         lObjParameters.Add("RefDocEntr", pIntRefDocEntry.ToString());
         lObjParameters.Add("RefDocNum", pIntRefDocNum.ToString());
         lObjParameters.Add("RefObjType", pIntRefObjType.ToString());
         lObjParameters.Add("LinkRefTyp", pStrLinkRefType);
         lObjParameters.Add("IssueDate", pObjDate);
         lStrQuery = lStrQuery.Inject(lObjParameters);
         lObjResults.DoQuery(lStrQuery);
     }
     catch (Exception e)
     {
         LogUtility.WriteError(string.Format("[PaymentDAO - InsertDocumentReference] Error al agregar la referencia de documento con DocEntry {0}, ObjectType {1}, LineNum {2}, RefDocEntr {3}, RefDocNum {4}, RefObjType {5}, LinkRefTyp {6}, IssueDate {7}: {8}"
                                             , pIntCredMemoDocNum, pIntObjType, pIntLineNum, pIntRefDocEntry, pIntRefDocNum, pIntRefObjType, pStrLinkRefType, pObjDate, e.Message));
         throw new Exception(string.Format("Error al agregar la referencia de documento: {0}", e.Message));
     }
     finally
     {
         MemoryUtility.ReleaseComObject(lObjResults);
     }
 }
        public string ValidateBLId(string blId)
        {
            string _query = string.Empty;

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

                _query = string.Format("SELECT [CctName] FROM [dbo].[OCCT] WHERE CctCode = '{0}'", blId);

                oRecordSet.DoQuery(_query);
                LogDAL _log = new LogDAL();
                _log.WriteEntry(_query);
                if (oRecordSet.RecordCount == 1)
                {
                    return(oRecordSet.Fields.Item("CctName").Value.ToString());
                }
            }
            catch (Exception)
            {
                return("false");
            }

            return("false");
        }
Beispiel #24
0
        private void LoadComboQueryRecordset(string _query, dynamic oComboBox, string fieldValue, string fieldDesc, SAPbobsCOM.Company oCompany)
        {
            //oApp = (SAPbouiCOM.Application)Application.SBO_Application;
            //oCompany = (SAPbobsCOM.Company)oApp.Company.GetDICompany();

            SAPbobsCOM.Recordset businessObject = (SAPbobsCOM.Recordset)oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
            businessObject.DoQuery(_query);
            SAPbouiCOM.ValidValues validValues = oComboBox.ValidValues;

            CleanComboBox(oComboBox);

            if (!string.Equals(fieldDesc, string.Empty))
            {
                while (!businessObject.EoF)
                {
                    validValues.Add((dynamic)businessObject.Fields.Item(fieldValue).Value, (dynamic)businessObject.Fields.Item(fieldDesc).Value);
                    businessObject.MoveNext();
                }
            }
            else
            {
                while (!businessObject.EoF)
                {
                    validValues.Add((dynamic)businessObject.Fields.Item(fieldValue).Value, "");
                    businessObject.MoveNext();
                }
            }
        }
Beispiel #25
0
        public string GetEmpName(string pStrEmpId)
        {
            SAPbobsCOM.Recordset lObjRecordset = null;
            string lStrEmpName = string.Empty;

            try
            {
                Dictionary <string, string> lLstStrParameters = new Dictionary <string, string>();
                lLstStrParameters.Add("EmpId", pStrEmpId);

                string lStrQuery = this.GetSQL("GetEmployeeName").Inject(lLstStrParameters);
                //this.UIAPIRawForm.DataSources.DataTables.Item("RESULT").ExecuteQuery(lStrQuery);

                lObjRecordset = (SAPbobsCOM.Recordset)DIApplication.Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
                lObjRecordset.DoQuery(lStrQuery);

                if (lObjRecordset.RecordCount > 0)
                {
                    lStrEmpName = lObjRecordset.Fields.Item("EmployeeName").Value.ToString();
                }
            }
            catch (Exception ex)
            {
                //UIApplication.ShowMessageBox(string.Format("InitDataSourcesException: {0}", ex.Message));
                LogService.WriteError("PurchasesDAO (GetAttachPath): " + ex.Message);
                LogService.WriteError(ex);
            }
            finally
            {
                MemoryUtility.ReleaseComObject(lObjRecordset);
            }

            return(lStrEmpName);
        }
Beispiel #26
0
        public static bool empresaExiste(string baseDatos)
        {
            bool existe = true;

            SAPbobsCOM.Recordset oRS = null;

            try
            {
                oRS = Conexion.company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
                oRS.DoQuery("select count(*)  as \"Result\" from " + BdMobile.BD_NAME + "." + BdMobile.TB_EMPRESAS + " where \"base_datos\" = '" + baseDatos + "'");

                if (oRS.RecordCount > 0)
                {
                    int counter = int.Parse(oRS.Fields.Item("Result").Value.ToString().Trim());
                    if (counter == 0)
                    {
                        existe = false;
                    }
                }
            }
            catch (Exception)
            {
                existe = false;
            }
            finally
            {
                if (oRS != null)
                {
                    LiberarObjetoGenerico(oRS);
                }
            }

            return(existe);
        }
Beispiel #27
0
        public string GetAttachPath()
        {
            SAPbobsCOM.Recordset lObjRecordset = null;
            string lStrAttachPath = string.Empty;

            try
            {
                string lStrQuery = this.GetSQL("GetAttachPath");
                //this.UIAPIRawForm.DataSources.DataTables.Item("RESULT").ExecuteQuery(lStrQuery);

                lObjRecordset = (SAPbobsCOM.Recordset)DIApplication.Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
                lObjRecordset.DoQuery(lStrQuery);

                if (lObjRecordset.RecordCount > 0)
                {
                    lStrAttachPath = lObjRecordset.Fields.Item("AttachPath").Value.ToString();
                }
            }
            catch (Exception ex)
            {
                //UIApplication.ShowMessageBox(string.Format("InitDataSourcesException: {0}", ex.Message));
                LogService.WriteError("PurchasesDAO (GetAttachPath): " + ex.Message);
                LogService.WriteError(ex);
            }
            finally
            {
                MemoryUtility.ReleaseComObject(lObjRecordset);
            }

            return(lStrAttachPath);
        }
Beispiel #28
0
 void Load_SubProject(string pFProject)
 {
     if (this.ComboBox1.ValidValues.Count > 1)
     {
         //Remove Valid Value
         this.ComboBox1.Select("", SAPbouiCOM.BoSearchKey.psk_ByValue);
         int itm_count = ComboBox1.ValidValues.Count;
         for (int i = 0; i < itm_count - 1; i++)
         {
             this.ComboBox1.ValidValues.Remove(1, SAPbouiCOM.BoSearchKey.psk_Index);
         }
     }
     SAPbobsCOM.Recordset oR_RecordSet = (SAPbobsCOM.Recordset)oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
     //oR_RecordSet.DoQuery("Select AbsEntry, NAME as 'Description' from OPHA where TYP =1 and ProjectID = " + pProject_AbsEntry.ToString());
     oR_RecordSet.DoQuery(string.Format("SELECT AbsEntry,NAME FROM OPMG T0 WHERE T0.[FIPROJECT] = '{0}'and T0.[STATUS] <> 'T' ORDER BY AbsEntry", pFProject));
     try
     {
         this.ComboBox1.ValidValues.Add("", "");
     }
     catch
     { }
     if (oR_RecordSet.RecordCount > 0)
     {
         while (!oR_RecordSet.EoF)
         {
             ComboBox1.ValidValues.Add(oR_RecordSet.Fields.Item("AbsEntry").Value.ToString(), oR_RecordSet.Fields.Item("NAME").Value.ToString());
             oR_RecordSet.MoveNext();
         }
     }
 }
Beispiel #29
0
        public static int obtenerUltimoId()
        {
            int res = 1;

            SAPbobsCOM.Recordset oRS = null;

            try
            {
                oRS = Conexion.company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
                oRS.DoQuery("select IFNULL(max(\"id\"),0) + 1  as \"Result\" from " + BdMobile.BD_NAME + "." + BdMobile.TB_EMPRESAS);

                if (oRS.RecordCount > 0)
                {
                    res = int.Parse(oRS.Fields.Item("Result").Value.ToString().Trim());
                }
            }
            catch (Exception)
            {
                res = 1;
            }
            finally
            {
                if (oRS != null)
                {
                    LiberarObjetoGenerico(oRS);
                }
            }


            return(res);
        }
Beispiel #30
0
        public static void addActivityTypes(string newType)
        {
            SAPbobsCOM.ActivityTypes type = null;
            SAPbobsCOM.Recordset     oRS  = null;

            try
            {
                oRS = Conexion.company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
                oRS.DoQuery("SELECT COUNT(*) as \"Counter\" FROM OCLT WHERE \"Name\" like '" + newType + "'");

                if (int.Parse(oRS.Fields.Item("Counter").Value.ToString()) == 0)
                {
                    type      = Conexion.company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oActivityTypes);
                    type.Name = newType;
                    type.Add();
                }
            }
            catch (Exception e)
            {
                System.Windows.Forms.MessageBox.Show(Constantes.PREFIX_MSG_ADDON +
                                                     " Error creando el tipo de actividad " + newType + " ! " + e.Message);
            }
            finally
            {
                if (type != null)
                {
                    LiberarObjetoGenerico(type);
                }
                LiberarObjetoGenerico(oRS);
            }
        }
Beispiel #31
0
        public void LoadProjetistasCadastrados(string idOOPR)
        {
            string QryStr = null;

            QryStr = "Select Code, Name from [@FLX_FB_PRJ]";
            projetistas = ((SAPbobsCOM.Recordset)(ConexaoSAP.Instance.getOCompany().GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)));
            projetistas.DoQuery(QryStr);
            RecCount = projetistas.RecordCount;
        }
Beispiel #32
0
        public string GetQtdEmEstoque(string itemCode)
        {
            SAPbobsCOM.Recordset RecSet = null;
            string QryStr = null;
            string qtdEstoque = "";

            RecSet = ((SAPbobsCOM.Recordset)(conexao.getOCompany().GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)));
            QryStr = "SELECT T0.[OnHand] FROM OITM T0 WHERE T0.ItemCode = '" + itemCode + "'";
            RecSet.DoQuery(QryStr);
            qtdEstoque = Convert.ToString(RecSet.Fields.Item(0).Value);

            return qtdEstoque;
        }
Beispiel #33
0
        public string GetIdPendenciasParaUpdate(string descricao, int idOOPR)
        {
            SAPbobsCOM.Recordset RecSet = null;
            string QryStr = null;
            string code = "";

            RecSet = ((SAPbobsCOM.Recordset)(conexao.getOCompany().GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)));
            QryStr = "SELECT top 1 [Code] FROM [SBO_SEA_Design_Prod].[dbo].[@FLX_FB_PEN] where U_FLX_FB_PEN_DESC = '" + descricao + "' and U_FLX_FB_PEN_IDOOPR ='" + idOOPR + "'  order by CreateDate desc";
            RecSet.DoQuery(QryStr);
            code = Convert.ToString(RecSet.Fields.Item(0).Value);

            return code;
        }
Beispiel #34
0
        public string GetProxCodeConferenciaMedicao()
        {
            SAPbobsCOM.Recordset RecSet = null;
            string QryStr = null;
            string proxCod = "";

            RecSet = ((SAPbobsCOM.Recordset)(conexao.getOCompany().GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)));
            QryStr = "DECLARE @Numero AS INT SELECT @Numero = (select top 1 cast (Code as INT) + 1 from [SBO_SEA_Design_Prod].[dbo].[@FLX_FB_CONFMED] order by Code desc) if @Numero is null begin set @Numero = 0000000 + 1 end SELECT case len(CAST(@Numero AS varchar(7))) WHEN 1 THEN '000000' + CAST(@Numero AS varchar(7)) WHEN 2 THEN '00000' + CAST(@Numero AS varchar(7)) WHEN 3 THEN '0000' + CAST(@Numero AS varchar(7)) WHEN 4 THEN '000' + CAST(@Numero AS varchar(7)) WHEN 5 THEN '00' + CAST(@Numero AS varchar(7)) WHEN 6 THEN '0' + CAST(@Numero AS varchar(7)) WHEN 7 THEN CAST(@Numero AS varchar(7)) END";
            RecSet.DoQuery(QryStr);
            proxCod = Convert.ToString(RecSet.Fields.Item(0).Value);

            return proxCod;
        }
Beispiel #35
0
        public string GetIdConferenciaMedicaoParaUpdate(string data, int idOOPR, string conferente, int idAmbiente)
        {
            SAPbobsCOM.Recordset RecSet = null;
            string QryStr = null;
            string code = "";

            RecSet = ((SAPbobsCOM.Recordset)(conexao.getOCompany().GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)));
            QryStr = "SELECT top 1 [Code] FROM [SBO_SEA_Design_Prod].[dbo].[@FLX_FB_CONFMED] where U_FLX_FB_CONFMED_DAT = '" + data + "' and U_FLX_FB_CONFMED_PRJ = '" + conferente +
                "' and U_FLX_FB_CONFMED_ID ='" + idOOPR + "' and U_FLX_FB_CONFMED_IDA ='" + iIdAmbienteMedicao + "'  order by CreateDate desc";
            RecSet.DoQuery(QryStr);
            code = Convert.ToString(RecSet.Fields.Item(0).Value);

            return code;
        }
Beispiel #36
0
        private void LoadResumo(SAPbouiCOM.EditText etvResp, SAPbouiCOM.EditText medResp, SAPbouiCOM.EditText elbIni, SAPbouiCOM.EditText elbFim, SAPbouiCOM.EditText elbResp, SAPbouiCOM.EditText verificacao, SAPbouiCOM.EditText verResp, SAPbouiCOM.EditText apsResp, SAPbouiCOM.EditText aprovacao, SAPbouiCOM.EditText aprResp, SAPbouiCOM.EditText pedido, SAPbouiCOM.EditText pedResp, SAPbouiCOM.EditText detIni, SAPbouiCOM.EditText detFim, SAPbouiCOM.EditText detResp, SAPbouiCOM.EditText fabIni, SAPbouiCOM.EditText fabFim, SAPbouiCOM.EditText fabResp, SAPbouiCOM.EditText montagem, SAPbouiCOM.EditText montagemFim, SAPbouiCOM.EditText montResp, SAPbouiCOM.EditText entrega, SAPbouiCOM.EditText etgResp, string idOOPR)
        {
            SAPbobsCOM.Recordset RecSet = null;
            string QryStr = null;

            RecSet = ((SAPbobsCOM.Recordset)(conexao.getOCompany().GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)));
            QryStr = "SELECT TOP 1 T2.Name as etvResp, T4.Name as medResp,CONVERT(char,T0.U_FLX_FB_ELB_INICIOR,103) as elaboracaoIni, CONVERT(char,T0.U_FLX_FB_ELB_TERMINR,103) as elaboracaoFim, T5.Name as elbResp, CONVERT(char,T0.U_FLX_FB_VRF_DATEVER,103) as verificacao, T0.U_FLX_FB_VRF_VERIFPO as verResp,T6.Name as apsResp,CONVERT(char,T0.U_FLX_FB_APR_DATAAPR,103)as aprovacao, T0.U_FLX_FB_APR_APROVAD as aprovPor,CONVERT(char,T0.U_FLX_FB_PED_DATE,103)as pedido, T0.U_FLX_FB_PED_SOLICIT as pedSolicitante,CONVERT(char,T0.U_FLX_FB_DET_INICIRE,103)as detIni,CONVERT(char,T0.U_FLX_FB_DET_TERMINO,103) as detFim, T7.Name as detResp,CONVERT(char,T0.U_FLX_FB_FAB_EXPEDIC,103)as fabIni,CONVERT(char,T0.U_FLX_FB_FAB_RECEBIM,103)as fabFim,T0.U_FLX_FB_FAB_CONFERE as fabConf,T0.U_FLX_FB_MTG_RESPONS as montResp,CONVERT(char,T0.U_FLX_FB_ENT_ENTREGA,103)as entrega, T0.U_FLX_FB_ENT_RESPONS as etgResp FROM OPR4 T0 left join OOPR T1 on T1.OpprId = T0.OprId left join [@FLX_FB_PRJ] T2 on T2.Code = T1.U_FLX_FB_ETV_RESP left join [@FLX_FB_MED] T3 on T3.U_FLX_FB_MED_IDOOPR = T0.OprId left join [@FLX_FB_PRJ] T4 on T4.Code = T3.U_FLX_FB_MED_PROJT left join [@FLX_FB_PRJ] T5 on T5.Code = T0.U_FLX_FB_ELB_PROJETI left join [@FLX_FB_PRJ] T6 on T6.Code = T1.U_FLX_FB_APS_PROJT left join [@FLX_FB_PRJ] T7 on T7.Code = T0.U_FLX_FB_DET_PROJETI WHERE OprId = " + idOOPR + "order by OprId asc";
            RecSet.DoQuery(QryStr);
            etvResp.Value = RecSet.Fields.Item(0).Value.ToString();
            medResp.Value = RecSet.Fields.Item(1).Value.ToString();
            elbIni.Value = RecSet.Fields.Item(2).Value.ToString();
            elbFim.Value = RecSet.Fields.Item(3).Value.ToString();
            elbResp.Value = RecSet.Fields.Item(4).Value.ToString();
            verificacao.Value = RecSet.Fields.Item(5).Value.ToString();
            verResp.Value = RecSet.Fields.Item(6).Value.ToString();
            apsResp.Value = RecSet.Fields.Item(7).Value.ToString();
            aprovacao.Value = RecSet.Fields.Item(8).Value.ToString();
            aprResp.Value = RecSet.Fields.Item(9).Value.ToString();
            pedido.Value = RecSet.Fields.Item(10).Value.ToString();
            pedResp.Value = RecSet.Fields.Item(11).Value.ToString();
            detIni.Value = RecSet.Fields.Item(12).Value.ToString();
            detFim.Value = RecSet.Fields.Item(13).Value.ToString();
            detResp.Value = RecSet.Fields.Item(14).Value.ToString();
            fabIni.Value = RecSet.Fields.Item(15).Value.ToString();
            fabFim.Value = RecSet.Fields.Item(16).Value.ToString();
            fabResp.Value = RecSet.Fields.Item(17).Value.ToString();
            //montagem.Value = RecSet.Fields.Item(18).Value.ToString();
            //montagemFim.Value = RecSet.Fields.Item(18).Value.ToString();
            montResp.Value = RecSet.Fields.Item(18).Value.ToString();
            entrega.Value = RecSet.Fields.Item(19).Value.ToString();
            etgResp.Value = RecSet.Fields.Item(20).Value.ToString();
        }
Beispiel #37
0
        private void LoadDataHoraMedicao(SAPbouiCOM.EditText data, SAPbouiCOM.EditText hora, SAPbouiCOM.EditText dataResumo, string idOOPR)
        {
            RecSet = null;
            string QryStr = null;

            RecSet = ((SAPbobsCOM.Recordset)(conexao.getOCompany().GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)));
            QryStr = "Select CONVERT(char,U_FLX_FB_MED_DATAMED,103), Convert(varchar(05),U_FLX_FB_MED_HORAMED,108) from [SBO_SEA_Design_Prod].[dbo].[@FLX_FB_MED] where U_FLX_FB_MED_IDOOPR =" + idOOPR;
            RecSet.DoQuery(QryStr);
            data.Value = RecSet.Fields.Item(0).Value.ToString();
            dataResumo.Value = RecSet.Fields.Item(0).Value.ToString();
            hora.Value = RecSet.Fields.Item(1).Value.ToString();
        }
Beispiel #38
0
        public string[] VerificarSeExisteCadastroMedicao(int idOOPR)
        {
            SAPbobsCOM.Recordset RecSet = null;
            string QryStr = null;
            string retorno = "";
            string code = "";

            RecSet = ((SAPbobsCOM.Recordset)(conexao.getOCompany().GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)));
            QryStr = " declare @retorno INT declare @code INT select @retorno = (select U_FLX_FB_MED_IDOOPR from [SBO_SEA_Design_Prod].[dbo].[@FLX_FB_MED] where U_FLX_FB_MED_IDOOPR =" + idOOPR + ") if @retorno is null begin set @retorno = 0 select @retorno, @code end else begin select @retorno, Code from [SBO_SEA_Design_Prod].[dbo].[@FLX_FB_MED] where U_FLX_FB_MED_IDOOPR =" + idOOPR + " end";
            RecSet.DoQuery(QryStr);
            retorno = Convert.ToString(RecSet.Fields.Item(0).Value);
            code = Convert.ToString(RecSet.Fields.Item(1).Value);

            string[] valores = { retorno, code };

            return valores;
        }
Beispiel #39
0
        public string GetProxCodeItensComplementares()
        {
            SAPbobsCOM.Recordset RecSet = null;
            string QryStr = null;
            string proxCod = "";

            RecSet = ((SAPbobsCOM.Recordset)(conexao.getOCompany().GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)));
            QryStr = "DECLARE @Numero AS INT SELECT @Numero = (select top 1 cast (Code as INT) + 1 from [SBO_SEA_Design_Prod].[dbo].[@FLX_FB_ITC] order by Code desc) if @Numero is null begin set @Numero = 1 end select @Numero";
            RecSet.DoQuery(QryStr);
            proxCod = Convert.ToString(RecSet.Fields.Item(0).Value);

            return proxCod;
        }