private void Button1_ClickAfter(object sboObject, SAPbouiCOM.SBOItemEventArg pVal)
        {
            try
            {
                if (CheckBox0.Checked)
                {
                    oUDS = oForm.DataSources.UserDataSources.Item("UD_0X");

                    SAPbouiCOM.Form oFormP = Application.SBO_Application.Forms.Item(oUDS.ValueEx);
                    oForm.Close();

                    ((SAPbouiCOM.EditText)oFormP.Items.Item("Item_2").Specific).String  = "AJUSTE";
                    ((SAPbouiCOM.EditText)oFormP.Items.Item("Item_10").Specific).String = "AJUSTE";
                }
                else
                if (Grid0.Rows.SelectedRows.Count > 0)
                {
                    oUDS = oForm.DataSources.UserDataSources.Item("UD_0X");
                    string sRut    = Convert.ToString(Grid0.DataTable.GetValue(0, Grid0.Rows.SelectedRows.Item(0, SAPbouiCOM.BoOrderType.ot_RowOrder)));
                    string sNombre = Convert.ToString(Grid0.DataTable.GetValue(1, Grid0.Rows.SelectedRows.Item(0, SAPbouiCOM.BoOrderType.ot_RowOrder)));

                    SAPbouiCOM.Form oFormP = Application.SBO_Application.Forms.Item(oUDS.ValueEx);
                    oForm.Close();

                    ((SAPbouiCOM.EditText)oFormP.Items.Item("Item_2").Specific).String  = sRut;
                    ((SAPbouiCOM.EditText)oFormP.Items.Item("Item_10").Specific).String = sNombre;
                }
            }
            catch (Exception)
            {
            }
        }
Exemple #2
0
        /// <summary>
        /// Controla los eventos de items del formularios
        /// </summary>
        public static void m_SBO_Appl_ItemEvent(String FormUID, ref SAPbouiCOM.ItemEvent pVal, out bool BubbleEvent)
        {
            BubbleEvent = true;
            SAPbouiCOM.Form oForm = null;
            oForm = Conexion_SBO.m_SBO_Appl.Forms.Item(FormUID);
            ResultMessage result = new ResultMessage();

            try
            {
                if (pVal.BeforeAction && pVal.EventType.Equals(SAPbouiCOM.BoEventTypes.et_CLICK) && pVal.ItemUID.Equals("btnCanc"))
                {
                    ListaFilas.ListFilas.Clear();
                    oForm.Close();
                }
                if (pVal.BeforeAction && pVal.EventType.Equals(SAPbouiCOM.BoEventTypes.et_CLICK) && pVal.ItemUID.Equals("btnAcep"))
                {
                    result = ValidarDatos(oForm.Items.Item("Item_0").Specific);
                    if (!result.Success)
                    {
                        BubbleEvent = false;
                        Conexion_SBO.m_SBO_Appl.StatusBar.SetText(result.Mensaje, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);
                    }
                }
                if (!pVal.BeforeAction && pVal.EventType.Equals(SAPbouiCOM.BoEventTypes.et_CLICK) && pVal.ItemUID.Equals("btnAcep"))
                {
                    AsignarDatos(oForm.Items.Item("Item_0").Specific);
                    oForm.Close();
                }
            }
            catch (Exception ex)
            {
                Conexion_SBO.m_SBO_Appl.StatusBar.SetText(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error);
            }
        }
        /// <summary>
        /// Interviene los eventos de los item del form.
        /// </summary>
        public static void m_SBO_Appl_ItemEvent(string FormUID, ref SAPbouiCOM.ItemEvent pVal, out bool BubbleEvent)
        {
            BubbleEvent = true;
            SAPbouiCOM.Form oForm = Conexion_SBO.m_SBO_Appl.Forms.Item(FormUID);
            ResultMessage   rslt  = new ResultMessage();

            try
            {
                if (pVal.BeforeAction && pVal.EventType.Equals(SAPbouiCOM.BoEventTypes.et_CLICK) && pVal.ItemUID.Equals("bt_chk"))
                {
                    EjecutarChecking(oForm);
                }
                if (pVal.BeforeAction && pVal.EventType.Equals(SAPbouiCOM.BoEventTypes.et_CLICK) && pVal.ItemUID.Equals("bt_SLR"))
                {
                    //AsignadosHec.ListaAsignacionHec.Clear();
                    oForm.Close();
                }
                if (pVal.BeforeAction && pVal.EventType.Equals(SAPbouiCOM.BoEventTypes.et_CLICK) && pVal.ItemUID.Equals("bt_ASG"))
                {
                    rslt = ValidarDatosAsignados(oForm);

                    if (rslt.Success)
                    {
                        //rslt = AsignarDatos(oForm);
                        if (rslt.Success)
                        {
                            oForm.Close();
                            Conexion_SBO.m_SBO_Appl.StatusBar.SetText(rslt.Mensaje, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Success);
                        }
                        else
                        {
                            BubbleEvent = false;
                            Conexion_SBO.m_SBO_Appl.StatusBar.SetText(rslt.Mensaje, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);
                        }
                    }
                    else
                    {
                        BubbleEvent = false;
                        Conexion_SBO.m_SBO_Appl.StatusBar.SetText(rslt.Mensaje, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);
                    }
                }
                if (pVal.BeforeAction && pVal.EventType.Equals(SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED) && pVal.ItemUID.Equals("matrixVar") && pVal.ColUID.Equals("co_Chk"))
                {
                    DataBindCuarteles(oForm);
                }
                if (pVal.BeforeAction && pVal.EventType.Equals(SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED) && pVal.ItemUID.Equals("matrixCrt") && pVal.ColUID.Equals("co_Chk"))
                {
                    SetButtonCheckCuarteles(oForm);
                }
            }
            catch (Exception ex)
            {
                Msj_Appl.Errores(14, "m_SBO_Appl_ItemEvent() > SEI_FormINGMH.cs " + ex.Message);
                Conexion_SBO.m_SBO_Appl.StatusBar.SetText("m_SBO_Appl_ItemEvent() > SEI_FormINGMH.cs " + ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error);
            }
        }
Exemple #4
0
        public static void m_SBO_Appl_ItemEvent(String FormUID, ref SAPbouiCOM.ItemEvent pVal, out bool BubbleEvent)
        {
            BubbleEvent = true;

            SAPbouiCOM.Form oForm = null;

            try
            {
                if (!pVal.BeforeAction)
                {
                    switch (pVal.EventType)
                    {
                    case SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST:
                        oForm = Conexion_SBO.m_SBO_Appl.Forms.Item(FormUID);
                        GestionarSeleccionCFL(oForm, pVal);
                        break;

                    case SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED:
                        oForm = Conexion_SBO.m_SBO_Appl.Forms.Item(FormUID);
                        if (pVal.ItemUID.Equals("Item_15"))
                        {
                            Descripcion = oForm.Items.Item("Item_1").Specific.Value.ToString();
                            Cuenta      = oForm.Items.Item("Item_3").Specific.Value.ToString();
                            Dim1        = oForm.Items.Item("Item_6").Specific.Value.ToString();
                            Dim2        = oForm.Items.Item("Item_8").Specific.Value.ToString();
                            Dim3        = oForm.Items.Item("Item_10").Specific.Value.ToString();
                            Dim4        = oForm.Items.Item("Item_12").Specific.Value.ToString();
                            Dim5        = oForm.Items.Item("Item_14").Specific.Value.ToString();

                            IntegracionServicio();

                            oForm.Close();
                        }
                        if (pVal.ItemUID.Equals("Item_16"))
                        {
                            oForm.Close();
                        }
                        break;

                    default:
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                Conexion_SBO.m_SBO_Appl.StatusBar.SetText("Error: " + ex.Message, SAPbouiCOM.BoMessageTime.bmt_Long, SAPbouiCOM.BoStatusBarMessageType.smt_Error);
            }
            finally
            {
                FuncionesComunes.LiberarObjetoGenerico(oForm);
            }
        }
        private void Button0_ClickBefore(object sboObject, SAPbouiCOM.SBOItemEventArg pVal, out bool BubbleEvent)
        {
            BubbleEvent = true;

            oUserTable      = oCompany.UserTables.Item("SECCIONESCOL");
            oUserTable.Code = EditText0.Value.ToString();
            oUserTable.Name = EditText0.Value.ToString();
            oUserTable.UserFields.Fields.Item("U_CodigoSEC").Value       = EditText0.Value.ToString();
            oUserTable.UserFields.Fields.Item("U_NombreSEC").Value       = EditText1.Value.ToString();
            oUserTable.UserFields.Fields.Item("U_SupraSeccionSEC").Value = EditText3.Value.ToString();
            oUserTable.UserFields.Fields.Item("U_PrecioSEC").Value       = EditText2.Value.ToString();
            oUserTable.UserFields.Fields.Item("U_ProyectoSEC").Value     = "";
            //oUserTable.Add();

            int i = oUserTable.Add();


            if (i != 0)
            {
                oApp.SetStatusBarMessage("Error" + oCompany.GetLastErrorDescription(), SAPbouiCOM.BoMessageTime.bmt_Medium, false);
            }
            else
            {
                oApp.SetStatusBarMessage("Exito en la inserción", SAPbouiCOM.BoMessageTime.bmt_Medium, false);
                oForm = oApp.Forms.Item("creasecc");
                oForm.Close();
            }
        }
Exemple #6
0
        private void Button2_ClickBefore(object sboObject, SAPbouiCOM.SBOItemEventArg pVal, out bool BubbleEvent)
        {
            BubbleEvent = true;
            //oApp = (SAPbouiCOM.Application)Application.SBO_Application;
            //oCompany = (SAPbobsCOM.Company)oApp.Company.GetDICompany();

            oUserTable      = oCompany.UserTables.Item("EDICIONESCOL");
            oUserTable.Code = EditText4.Value.ToString();
            oUserTable.Name = EditText4.Value.ToString();
            oUserTable.UserFields.Fields.Item("U_CodigoEDC").Value   = EditText4.Value.ToString();
            oUserTable.UserFields.Fields.Item("U_NombreEDC").Value   = EditText7.Value.ToString();
            oUserTable.UserFields.Fields.Item("U_ProyectoEDC").Value = EditText5.Value.ToString();
            //oUserTable.Add();

            int i = oUserTable.Add();


            if (i != 0)
            {
                oApp.SetStatusBarMessage("Error" + oCompany.GetLastErrorDescription(), SAPbouiCOM.BoMessageTime.bmt_Medium, false);
            }
            else
            {
                oApp.SetStatusBarMessage("Exito en la inserción", SAPbouiCOM.BoMessageTime.bmt_Medium, false);
                oForm = oApp.Forms.Item("fmcred");
                oForm.Close();
            }
        }
Exemple #7
0
    private void HandleJobPress(SAPbouiCOM.Form form, SAPbouiCOM.ItemEvent pVal)
    {
        try
        {

            switch (pVal.ItemUID)
            {
                case btnUpdate:
                    if (!ValidateJob(form))
                    {
                        return;
                    }
                    HandleUpdate(form);
                    break;
                case btnClose:
                    if (JobID != "" && getFormItemVal(oJobForm, stCancel) != LB_CANCELLED)
                    {
                        if (SBO_Application.MessageBox("Cancel this job?", 1, "Yes", "No") == 1)
                        {
                            CancelJob(JobID);
                        }
                    }
                    form.Close();
                    break;

            }

        }
        catch (Exception ex)
        {
            errorLog(ex);
        }
    }
Exemple #8
0
 private void Button1_ClickAfter(object sboObject, SAPbouiCOM.SBOItemEventArg pVal)
 {
     try
     {
         if (Grid0.Rows.SelectedRows.Count > 0)
         {
             //oUDS = oForm.DataSources.UserDataSources.Item("UD_1");
             string sPago = Convert.ToString(Grid0.DataTable.GetValue(0, Grid0.Rows.SelectedRows.Item(0, SAPbouiCOM.BoOrderType.ot_RowOrder)));
             Comisiones.Agregar_Documento_Grid_Pagos(sPago);
             oForm.Close();
         }
     }
     catch (Exception)
     {
     }
 }
 public void Dispose()
 {
     if (oTimer != null)
     {
         oTimer.Dispose();
     }
     _oForm.Close();
 }
        private void Button1_ClickAfter(object sboObject, SAPbouiCOM.SBOItemEventArg pVal)
        {
            try
            {
                if (CheckBox0.Checked)
                {
                    oForm.Close();
                    Comisiones.Agregar_Proyecto_Grid_Pagos("");
                }

                if (Grid0.Rows.SelectedRows.Count > 0 && CheckBox0.Checked == false)
                {
                    oUDS = oForm.DataSources.UserDataSources.Item("UD_1");
                    string sOrig = oUDS.ValueEx;

                    oUDS = oForm.DataSources.UserDataSources.Item("UD_0");
                    string sProyecto = Convert.ToString(Grid0.DataTable.GetValue(0, Grid0.Rows.SelectedRows.Item(0, SAPbouiCOM.BoOrderType.ot_RowOrder)));

                    SAPbouiCOM.Form oFormP = Application.SBO_Application.Forms.Item(oUDS.ValueEx);
                    oForm.Close();

                    switch (sOrigf)
                    {
                    case "Consultas":
                        ((SAPbouiCOM.EditText)oFormP.Items.Item("Item_23").Specific).String = sProyecto;
                        break;

                    case "Pagos":
                        Comisiones.Agregar_Proyecto_Grid_Pagos(sProyecto);
                        break;

                    case "Premios":
                        Comisiones.Agregar_Proyecto_Grid_Premios(sProyecto);
                        break;
                    }
                }
            }
            catch (Exception)
            {
            }
        }
Exemple #11
0
        public void llenarMatrixDesdePersonalizada(int docNum, int lineId)
        {
            string query;

            SAPbobsCOM.Recordset rs;
            SAPbouiCOM.Matrix    oMatrix;

            try
            {
                oMatrix = (SAPbouiCOM.Matrix)oForm.Items.Item("38").Specific;

                rs = (SAPbobsCOM.Recordset)oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);

                query = "SELECT T1.[U_ItemCode], T1.[U_Dscript], T1.[U_OpenQty], T1.[U_PrcBfDi], T1.[U_DiscItem], T1.[U_TaxCode], T1.[DocEntry], T1.[LineId] FROM [dbo].[@ZTV]  T0 , [dbo].[@ZTV_LINES]  T1 WHERE T0.[DocEntry]  =  T1.[DocEntry] and  T0.[DocNum]  = "
                        + docNum + " and  T1.[LineId] = " + lineId;
                rs.DoQuery(query);

                int i = oMatrix.RowCount;

                if ("" != rs.Fields.Item("U_ItemCode").Value.ToString())
                {
                    ((SAPbouiCOM.EditText)oMatrix.Columns.Item("1").Cells.Item(i).Specific).Value   = rs.Fields.Item("U_ItemCode").Value.ToString();
                    ((SAPbouiCOM.EditText)oMatrix.Columns.Item("3").Cells.Item(i).Specific).Value   = rs.Fields.Item("U_Dscript").Value.ToString();
                    ((SAPbouiCOM.EditText)oMatrix.Columns.Item("11").Cells.Item(i).Specific).Value  = rs.Fields.Item("U_OpenQty").Value.ToString();
                    ((SAPbouiCOM.EditText)oMatrix.Columns.Item("14").Cells.Item(i).Specific).Value  = rs.Fields.Item("U_PrcBfDi").Value.ToString();
                    ((SAPbouiCOM.EditText)oMatrix.Columns.Item("15").Cells.Item(i).Specific).Value  = rs.Fields.Item("U_DiscItem").Value.ToString();
                    ((SAPbouiCOM.EditText)oMatrix.Columns.Item("160").Cells.Item(i).Specific).Value = rs.Fields.Item("U_TaxCode").Value.ToString();

                    ((SAPbouiCOM.EditText)oMatrix.Columns.Item("U_BsEntry").Cells.Item(i).Specific).Value = rs.Fields.Item("DocEntry").Value.ToString();
                    ((SAPbouiCOM.EditText)oMatrix.Columns.Item("U_BsLine").Cells.Item(i).Specific).Value  = rs.Fields.Item("LineId").Value.ToString();
                }
                forma.Close();
            }
            catch (Exception e)
            {
                app.StatusBar.SetText("listaSolicitud_method_llenarMatrixDesdePersonalizada -> " + e.Message, SAPbouiCOM.BoMessageTime.bmt_Short,
                                      SAPbouiCOM.BoStatusBarMessageType.smt_Warning);
            }
        }
Exemple #12
0
        private void mBtnAdd_ClickBefore(object sboObject, SAPbouiCOM.SBOItemEventArg pVal, out bool BubbleEvent)
        {
            BubbleEvent = true;
            string lStrItemCode = mCmbType.Value.ToString();
            string lStrPrice    = mObjModal.DataSources.UserDataSources.Item("UD_Cost").ValueEx;

            mObjModal.Close();
            int lIntRow = mMtxLines.RowCount;

            SetValueColumnEditText("1", lIntRow, lStrItemCode);
            SetValueColumnEditText("11", lIntRow, "1");
            SetValueColumnEditText("14", lIntRow, lStrPrice);
        }
Exemple #13
0
        /// <summary>
        /// funcion controla los eventos del formulario
        /// </summary>
        /// <param name="FormUID">identificador unico del formulario</param>
        /// <param name="pVal">Item even</param>
        /// <param name="BubbleEvent">BobbleEvent</param>
        public static void m_SBO_Appl_ItemEvent(String FormUID, ref SAPbouiCOM.ItemEvent pVal, out bool BubbleEvent)
        {
            BubbleEvent = true;

            SAPbouiCOM.Form oForm = null;

            try
            {
                if (!pVal.BeforeAction)
                {
                    switch (pVal.EventType)
                    {
                    case SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST:
                        oForm = Conexion_SBO.m_SBO_Appl.Forms.Item(FormUID);
                        GestionarSeleccionCFL(oForm, pVal);
                        break;

                    case SAPbouiCOM.BoEventTypes.et_CLICK:
                        oForm = Conexion_SBO.m_SBO_Appl.Forms.Item(FormUID);
                        switch (pVal.ItemUID)
                        {
                        case "btnInt":
                            IntegracionServicio(oForm);

                            oForm.Close();
                            break;

                        case "btnCompl":
                            CopyInfo(oForm);
                            break;
                        }

                        break;

                    default:
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                Conexion_SBO.m_SBO_Appl.StatusBar.SetText("Error: " + ex.Message, SAPbouiCOM.BoMessageTime.bmt_Long, SAPbouiCOM.BoStatusBarMessageType.smt_Error);
            }
            finally
            {
                FuncionesComunes.LiberarObjetoGenerico(oForm);
            }
        }
Exemple #14
0
 private void ButtonCancelar_ClickAfter(object sboObject, SAPbouiCOM.SBOItemEventArg pVal)
 {
     try
     {
         SAPbouiCOM.Form oForm = Application.SBO_Application.Forms.ActiveForm;
         oForm.Close();
     }
     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
     {
     }
 }
Exemple #15
0
 public void VoidCloseFormProc()
 {
     try
     {
         formIncomingPayment.Close();
         formPaymentList.Close();
         SBO_Application.Menus.Item("1289").Activate();
         SBO_Application.Menus.Item("1288").Activate();
     }
     catch (Exception)
     {
         //errorLog(ex);
     }finally
     {
         voidCCTRANS(confirmNum);
     }
 }
Exemple #16
0
        private void mBtnAdd_ClickBefore(object sboObject, SAPbouiCOM.SBOItemEventArg pVal, out bool BubbleEvent)
        {
            BubbleEvent = true;
            if (!(sboObject as SAPbouiCOM.Button).Item.Enabled)
            {
                return;
            }

            try
            {
                string lStrItemCode = mCmbType.Value.ToString();
                string lStrPrice    = mEdtAmnt.Value;
                if (mFrmInvoice.Mode != SAPbouiCOM.BoFormMode.fm_ADD_MODE && mFrmInvoice.Mode != SAPbouiCOM.BoFormMode.fm_UPDATE_MODE)
                {
                    UIApplication.ShowMessageBox("El documento actual no es editable.");
                    return;
                }
                if (mFrmInvoice.Mode != SAPbouiCOM.BoFormMode.fm_ADD_MODE && mFrmInvoice.Mode != SAPbouiCOM.BoFormMode.fm_UPDATE_MODE)
                {
                    UIApplication.ShowMessageBox("El documento actual no es editable.");
                    return;
                }
                if (Convert.ToDouble(lStrPrice) <= 0)
                {
                    UIApplication.ShowMessageBox("La comisión debe ser mayor a cero.");
                    return;
                }

                mFrmDialog.Close();

                int lIntRow = mMtxLines.RowCount;
                if ((mMtxLines.Columns.Item("1").Cells.Item(lIntRow).Specific as SAPbouiCOM.EditText).Value != "")
                {
                    mMtxLines.AddRow();
                    lIntRow++;
                }
                mMtxLines.SetCellFocus(lIntRow, 1);
                SetValueColumnEditText("1", lIntRow, lStrItemCode);
                SetValueColumnEditText("14", lIntRow, lStrPrice);
            }
            catch (Exception lObjException)
            {
                LogUtility.WriteError(string.Format("[ComissionModal - mBtnAdd_ClickBefore] Error al agregar el item con la comisión: {0}", lObjException.Message));
                UIApplication.ShowMessageBox(string.Format("Error al agregar el item con la comisión: {0}", lObjException.Message));
            }
        }
Exemple #17
0
    private void SetupFormHandler(SAPbouiCOM.Form form, SAPbouiCOM.ItemEvent pVal)
    {
        try
        {
            if (pVal.BeforeAction)
            {
            }
            else
            {
                switch (pVal.EventType)
                {
                case SAPbouiCOM.BoEventTypes.et_COMBO_SELECT:
                {
                    switch (pVal.ItemUID)
                    {
                    }
                }
                break;

                case SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED:
                {
                    switch (pVal.ItemUID)
                    {
                    case btnClose:

                        oSetupForm.Close();

                        break;

                    case btnProcess:
                        HandleSetupUpdate(form);
                        break;
                    }
                }
                break;
                }
            }
        }
        catch (Exception ex)
        {
            errorLog(ex);
        }
    }
Exemple #18
0
        /// <summary>
        /// Controla los eventos de items del formularios
        /// </summary>
        public static void m_SBO_Appl_ItemEvent(String FormUID, ref SAPbouiCOM.ItemEvent pVal, out bool BubbleEvent)
        {
            BubbleEvent = true;
            SAPbouiCOM.Form oForm = null;
            oForm = Conexion_SBO.m_SBO_Appl.Forms.Item(FormUID);
            ResultMessage result = new ResultMessage();

            SAPbouiCOM.Matrix oMatrix = null;
            Int32             Row     = -1;

            try
            {
                if (pVal.BeforeAction && pVal.EventType.Equals(SAPbouiCOM.BoEventTypes.et_CLICK) && pVal.ItemUID.Equals("bt_Salir"))
                {
                    oForm.Close();
                }
                if (pVal.BeforeAction && pVal.EventType.Equals(SAPbouiCOM.BoEventTypes.et_CLICK) && pVal.ItemUID.Equals("bt_Ver"))
                {
                    oMatrix = oForm.Items.Item("Item_0").Specific;
                    Row     = oMatrix.GetNextSelectedRow(0, SAPbouiCOM.BoOrderType.ot_SelectionOrder);
                    if (Row != -1)
                    {
                        Conexion_SBO.m_SBO_Appl.StatusBar.SetText("Visualizando 1 documento. Espere un momento.", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);
                        result = GestionarVisualizar(oForm, Row);

                        if (!result.Success)
                        {
                            Conexion_SBO.m_SBO_Appl.StatusBar.SetText(result.Mensaje, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error);
                        }
                    }
                    else
                    {
                        BubbleEvent = false;
                        Conexion_SBO.m_SBO_Appl.StatusBar.SetText("Seleccione un documento para visualizar", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);
                    }
                }
            }
            catch (Exception ex)
            {
                Conexion_SBO.m_SBO_Appl.StatusBar.SetText(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error);
            }
        }
    private void HandleCFPress(SAPbouiCOM.Form form, SAPbouiCOM.ItemEvent pVal)
    {
        try
        {
            switch (pVal.ItemUID)
            {
            case btnTerminal:
                TermAmount = getFormItemVal(form, editCAmount);
                TermFunc   = "Charge";
                if (getFormItemVal(form, btnProcess) == "Credit")
                {
                    TermFunc = "Credit";
                }
                TermGroup           = getGroupName(getCustomerID());
                TermInvoice         = getInvoiceNum();
                TermCustomer        = getCustomerID();
                oTerminalLaunchForm = form;
                CreateTerminalForm();
                break;

            case btnProcess:
                formCM = form;
                if (!ValidateChargeForm(form))
                {
                    return;
                }
                tProcess = new Thread(ProcessCardCM);
                tProcess.Start();
                break;

            case btnClose:
                oCreditForm.Close();
                break;
            }
        }
        catch (Exception ex)
        {
            errorLog(ex);
        }
    }
Exemple #20
0
    private void HandleSetupUpdate(SAPbouiCOM.Form form)
    {
        //errorLog("Handle select");
        try
        {
            string dbPassword  = B1Info.DBPassWD;
            string appPassword = B1Info.AppPassWD;
            FormFreeze(form, true);
            if (getFormItemVal(form, editDBPasswd) != passwdMask)
            {
                dbPassword = getFormItemVal(form, editDBPasswd);
            }
            if (getFormItemVal(form, editAppPasswd) != passwdMask)
            {
                appPassword = getFormItemVal(form, editAppPasswd);
            }
            upsertSetupInfo(getFormItemVal(form, editDBUser), dbPassword, getFormItemVal(form, editAppUser), appPassword);

            tProcess = new Thread(appInit);
            tProcess.Start();
        }
        catch (Exception ex)
        {
            showMessage(ex.Message);
            errorLog(ex);
        }
        finally
        {
            try
            {
                FormFreeze(form, false);
                form.Close();
            }
            catch (Exception) { }
        }
    }
Exemple #21
0
        /// <summary>
        /// Maneja los eventos de los item del formulario
        /// </summary>
        /// <param name="FormUID"></param>
        /// <param name="pVal"></param>
        /// <param name="BubbleEvent"></param>
        public static void m_SBO_Appl_ItemEvent(string FormUID, ref SAPbouiCOM.ItemEvent pVal, out bool BubbleEvent)
        {
            BubbleEvent = true;
            SAPbouiCOM.Form oForm = null;
            string          Pago  = string.Empty;
            string          Fecha = string.Empty;

            try
            {
                oForm = Conexion_SBO.m_SBO_Appl.Forms.Item(FormUID);
                if (pVal.BeforeAction == false)
                {
                    if (pVal.EventType == SAPbouiCOM.BoEventTypes.et_LOST_FOCUS)
                    {
                        if (pVal.ItemUID.Equals("6"))
                        {
                            // Obtener Fecha
                            Fecha = ((SAPbouiCOM.EditText)oForm.Items.Item("6").Specific).String;

                            int Index = 0;

                            // Asociar Pagos
                            List <string> ListaPagos = PagosMasivos.ObtenerPagosExistentes(Fecha);

                            if (ListaPagos.Count > 0)
                            {
                                SAPbouiCOM.Item     oItem     = oForm.Items.Item("4");
                                SAPbouiCOM.ComboBox oComboBox = ((SAPbouiCOM.ComboBox)(oItem.Specific));
                                oComboBox.Item.DisplayDesc = true;

                                // Limpiar Combobox si tiene datos y eliminar userdatasource
                                if (oComboBox.ValidValues.Count > 0)
                                {
                                    FuncionesComunes.BorrarCombo(FormUID, "4");
                                    oComboBox.DataBind.UnBind();
                                }

                                foreach (string pago in ListaPagos)
                                {
                                    oComboBox.ValidValues.Add(Index.ToString(), pago);
                                    Index++;
                                }
                                oComboBox.DataBind.SetBound(true, "", "udsPagos");
                            }
                            else
                            {
                                FuncionesComunes.BorrarCombo(FormUID, "4");
                                Conexion_SBO.m_SBO_Appl.StatusBar.SetText(string.Format("No se encontraron pagos en fecha: {0}", Fecha), SAPbouiCOM.BoMessageTime.bmt_Long, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);
                            }
                        }
                    }
                    if (pVal.EventType == SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED)
                    {
                        // boton Generar
                        if (pVal.ItemUID.Equals("1"))
                        {
                            // Obtener Fecha
                            Fecha = ((SAPbouiCOM.EditText)oForm.Items.Item("6").Specific).String;

                            // Obtener pago
                            Pago = ((SAPbouiCOM.ComboBox)oForm.Items.Item("4").Specific).Value;

                            // Validar ingreso de pago
                            result = ValidarCampos(Fecha, Pago);
                            if (result.Success)
                            {
                                Pago   = ((SAPbouiCOM.ComboBox)oForm.Items.Item("4").Specific).Selected.Description;
                                result = PagosMasivos.GestionarPagoMasivo(Pago);

                                if (result.Success)
                                {
                                    Conexion_SBO.m_SBO_Appl.StatusBar.SetText(result.Mensaje, SAPbouiCOM.BoMessageTime.bmt_Long, SAPbouiCOM.BoStatusBarMessageType.smt_Success);
                                }
                                else
                                {
                                    Conexion_SBO.m_SBO_Appl.StatusBar.SetText(result.Mensaje, SAPbouiCOM.BoMessageTime.bmt_Long, SAPbouiCOM.BoStatusBarMessageType.smt_Error);
                                }
                            }
                            else
                            {
                                Conexion_SBO.m_SBO_Appl.StatusBar.SetText(result.Mensaje, SAPbouiCOM.BoMessageTime.bmt_Long, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);
                            }
                        }
                        // boton cancelar
                        else if (pVal.ItemUID.Equals("2"))
                        {
                            oForm.Close();
                        }
                    }
                }
            }
            catch
            {
            }
        }
Exemple #22
0
    private void ePaymentFormFormHandler(SAPbouiCOM.Form form, SAPbouiCOM.ItemEvent pVal)
    {
        try
        {
            if (pVal.BeforeAction)
            {
            }
            else
            {
                switch (pVal.EventType)
                {
                case SAPbouiCOM.BoEventTypes.et_COMBO_SELECT:
                {
                    switch (pVal.ItemUID)
                    {
                    case cbEMTemplate:
                        string t = getFormItemVal(form, cbEMTemplate);
                        updateDefaultEmailTemplate(t);
                        break;

                    case cbCustomerID:
                        string id = getFormItemVal(form, cbCustomerID);
                        if (id != "")
                        {
                            setFormEditVal(form, editCustomerID, id);
                            checkePayPaidStatus(id);
                            setComboValue(form, cbGroup, "");
                            populateePaymentFormMatrix();
                        }
                        break;

                    case cbGroup:
                        string grp = getFormItemVal(form, cbGroup);
                        if (grp != "")
                        {
                            setFormEditVal(form, editCustomerID, "");
                            setComboValue(form, cbCustomerID, "");
                            string   s = getCardCodeByGroup(grp);
                            string[] c = s.Split(',');
                            foreach (string i in c)
                            {
                                checkePayPaidStatus(i.Replace("'", "").Trim());
                            }
                            populateePaymentFormMatrix();
                        }
                        break;
                    }
                }
                break;

                case SAPbouiCOM.BoEventTypes.et_CLICK:
                    if (pVal.ItemUID == matrixePaymentForm)
                    {
                        if (!ePayHandleInvSelect())
                        {
                            switch (pVal.ColUID)
                            {
                            case "PaidDT":
                                populateePaymentFormMatrix(" \"U_PaidDate\" DESC,");
                                break;

                            case "UploadDT":
                                populateePaymentFormMatrix(" \"U_UploadDate\" DESC,");
                                break;

                            case "Balance":
                                populateePaymentFormMatrix("balance,");
                                break;

                            case "UpBal":
                                populateePaymentFormMatrix(" \"U_UploadedBalance\",");
                                break;

                            case "Status":
                                populateePaymentFormMatrix(" \"U_Status\" DESC,");
                                break;

                            case "CustID":
                            case "CName":
                                populateePaymentFormMatrix(" a.\"CardCode\" DESC,");
                                break;
                            }
                        }
                    }
                    break;

                case SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED:
                {
                    switch (pVal.ItemUID)
                    {
                    case btnClose:
                        oePaymentFormForm.Close();
                        oePaymentFormForm = null;
                        break;

                    case btnAdd:
                        string str = string.Format("Send all invoices?");
                        if (SBO_Application.MessageBox(str + "?", 1, "Yes", "No") == 1)
                        {
                            tProcess = new Thread(SendAll);
                            tProcess.Start();
                        }
                        break;

                    case btnRefresh:
                        try
                        {
                            string cid = getFormItemVal(oePaymentFormForm, editCustomerID);
                            if (cid != "")
                            {
                                checkePayPaidStatus(cid);
                            }
                            else
                            {
                                string grp = getFormItemVal(form, cbGroup);
                                if (grp != "")
                                {
                                    string   s = getCardCodeByGroup(grp);
                                    string[] c = s.Split(',');
                                    foreach (string i in c)
                                    {
                                        checkePayPaidStatus(i.Replace("'", "").Trim());
                                    }
                                }
                            }
                            populateePaymentFormMatrix();
                        }
                        catch (Exception ex)
                        {
                            SBO_Application.MessageBox(ex.Message);
                        }
                        break;

                    case btnRun:
                        try
                        {
                            //ProcessJob();
                            //showMessage("Job completed");
                            populateePaymentFormMatrix();
                        }
                        catch (Exception ex)
                        {
                            SBO_Application.MessageBox(ex.Message);
                        }
                        break;

                    case btnFind:
                        string id = getFormItemVal(oePaymentFormForm, editCustomerID);
                        SBO_Application.SetStatusBarMessage("Finding customer please wait...", SAPbouiCOM.BoMessageTime.bmt_Medium, false);
                        List <String> list = FindCustomer(id);
                        if (list.Count() == 0)
                        {
                            SBO_Application.SetStatusBarMessage("No customer found.", SAPbouiCOM.BoMessageTime.bmt_Medium, false);
                        }
                        else
                        {
                            SAPbouiCOM.ComboBox oCB = (SAPbouiCOM.ComboBox)form.Items.Item(cbCustomerID).Specific;
                            try
                            {
                                while (oCB.ValidValues.Count > 0)
                                {
                                    oCB.ValidValues.Remove(0, SAPbouiCOM.BoSearchKey.psk_Index);
                                }
                            }
                            catch (Exception)
                            { }
                            ComboAddItem(oCB, "");
                            foreach (string c in list)
                            {
                                ComboAddItem(oCB, c);
                            }
                            SBO_Application.SetStatusBarMessage("Found " + list.Count().ToString() + " customer(s).", SAPbouiCOM.BoMessageTime.bmt_Medium, false);
                        }
                        break;
                    }
                }
                break;
                }
            }
        }
        catch (Exception ex)
        {
            errorLog(ex);
        }
    }
Exemple #23
0
 private void Button0_ClickAfter(object sboObject, SAPbouiCOM.SBOItemEventArg pVal)
 {
     oForm.Close();
 }
Exemple #24
0
    private void CustImpFormHandler(SAPbouiCOM.Form form, SAPbouiCOM.ItemEvent pVal)
    {
        try
        {
            if (pVal.BeforeAction)
            {
            }
            else
            {
                switch (pVal.EventType)
                {
                case SAPbouiCOM.BoEventTypes.et_CLICK:

                    break;

                case SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED:
                {
                    switch (pVal.ItemUID)
                    {
                    case btnClose:
                        try
                        {
                            if (tImpProcess != null)
                            {
                                tImpProcess.Abort();
                            }
                        }
                        catch (Exception) { }
                        oCustImpForm.Close();
                        break;

                    case btnImp:
                        try
                        {
                            if (custObjForImport == null)
                            {
                                form.Items.Item(btnFind).Click();
                            }
                            else
                            {
                                string cardcode = getFormItemVal(form, editCustomerID);
                                if (cardcode == "")
                                {
                                    showMessage("Enter customer ID.");
                                }
                                else
                                {
                                    if (custObjForImport == null)
                                    {
                                        form.Items.Item(btnFind).Click();
                                    }
                                    else
                                    {
                                        string code = FindCustomerByID(cardcode);
                                        if (code == "")
                                        {
                                            showMessage("Customer not found");
                                            return;
                                        }

                                        if (SBO_Application.MessageBox("Import payment method(s) to " + cardcode + "?", 1, "Yes", "No") == 1)
                                        {
                                            foreach (PaymentMethodProfile pm in custObjForImport.PaymentMethodProfiles)
                                            {
                                                if (!isPaymentMethodExists(cardcode, pm.CardNumber, pm.CardExpiration))
                                                {
                                                    CCCUST cccust = new CCCUST();
                                                    cccust.CustomerID = cardcode;
                                                    cccust.active     = 'Y';
                                                    cccust.email      = custObjForImport.Email;
                                                    cccust.firstName  = custObjForImport.BillingAddress.FirstName;
                                                    cccust.lastName   = custObjForImport.BillingAddress.LastName;
                                                    cccust.street     = custObjForImport.BillingAddress.Address1;
                                                    cccust.city       = custObjForImport.BillingAddress.City;
                                                    cccust.state      = custObjForImport.BillingAddress.State;
                                                    cccust.zip        = custObjForImport.BillingAddress.ZipCode;
                                                    cccust.expDate    = pm.CardExpiration;
                                                    cccust.cardCode   = pm.CardCode;
                                                    try
                                                    {
                                                        if (pm.MethodName != null && pm.MethodName != "")
                                                        {
                                                            if (pm.MethodName.IndexOf(" ") >= 0)
                                                            {
                                                                string   name = pm.MethodName;
                                                                string[] s    = name.Split(' ');

                                                                cccust.firstName = s[0];
                                                                cccust.lastName  = s[s.Length - 1];
                                                            }
                                                        }
                                                    }
                                                    catch (Exception) { }
                                                    cccust.routingNumber   = pm.Routing;
                                                    cccust.checkingAccount = pm.Account;
                                                    cccust.GroupName       = getGroupName(cardcode);
                                                    cccust.CustNum         = custObjForImport.CustomerToken;
                                                    cccust.MethodID        = pm.MethodID;
                                                    int    id     = getNextTableID("@CCCUST");
                                                    string ccname = cccust.firstName + " " + cccust.lastName;
                                                    string desc   = ccname;
                                                    if (pm.MethodName != "" && pm.MethodName != "")
                                                    {
                                                        desc = pm.MethodName;
                                                    }
                                                    if (pm.MethodType == "check")
                                                    {
                                                        cccust.methodDescription = id.ToString() + "_" + pm.Routing + " " + pm.Account + "(" + desc + ")";
                                                        cccust.checkingAccount   = pm.Account;
                                                        cccust.routingNumber     = pm.Routing;
                                                    }
                                                    else
                                                    {
                                                        cccust.cardNum           = pm.CardNumber;
                                                        cccust.methodDescription = id.ToString() + "_" + pm.CardNumber + " " + pm.CardExpiration + "(" + desc + ")";
                                                        cccust.cardType          = pm.CardType;
                                                    }
                                                    string cardid = "";
                                                    cccust.CardName    = getCardName(cccust.GroupName, cccust.cardType, "", ref cardid);
                                                    cccust.CCAccountID = cardid;
                                                    insert(cccust);
                                                    SBO_Application.SetStatusBarMessage(string.Format("Import payment method {0} to {1}.", cccust.cardNum, cardcode), SAPbouiCOM.BoMessageTime.bmt_Medium, false);
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            SBO_Application.SetStatusBarMessage(string.Format("Import payment method error: {0}.", ex.Message), SAPbouiCOM.BoMessageTime.bmt_Medium, true);
                        }
                        break;

                    case btnFImp:
                        string fn = getFormItemVal(form, editFileName);
                        if (fn == "")
                        {
                            showMessage("Please enter file name.");
                        }
                        else
                        {
                            if (!File.Exists(fn))
                            {
                                showMessage("File: " + fn + " not found.");
                            }
                            else
                            {
                                if (SBO_Application.MessageBox("Import payment method(s) from file " + fn + "?", 1, "Yes", "No") == 1)
                                {
                                    SetText("Import Begin.  Please wait...\r\n");
                                    tImpProcess = new Thread(importThread);
                                    tImpProcess.Start();
                                }
                            }
                        }
                        break;

                    case btnExpFImp:
                        fn = getFormItemVal(form, editExpFileName);
                        if (fn == "")
                        {
                            showMessage("Please enter exported customer file name.");
                        }
                        else
                        {
                            if (!File.Exists(fn))
                            {
                                showMessage("File: " + fn + " not found.");
                            }
                            else
                            {
                                if (SBO_Application.MessageBox("Import payment method(s) from file " + fn + "?", 1, "Yes", "No") == 1)
                                {
                                    SetText("Import Begin.  Please wait...\r\n");
                                    tImpProcess = new Thread(ExpImportThread);
                                    tImpProcess.Start();
                                }
                            }
                        }
                        break;
                    }
                }
                break;
                }
            }
        }
        catch (Exception ex)
        {
            errorLog(ex);
        }
    }
    private void CustImpFormHandler(SAPbouiCOM.Form form, SAPbouiCOM.ItemEvent pVal)
    {
        try
        {
            if (pVal.BeforeAction)
            {
            }
            else
            {
                switch (pVal.EventType)
                {
                case SAPbouiCOM.BoEventTypes.et_CLICK:

                    break;

                case SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED:
                {
                    switch (pVal.ItemUID)
                    {
                    case btnClose:
                        oCustImpForm.Close();
                        break;

                    case btnImp:
                        try
                        {
                            if (custObjForImport == null)
                            {
                                form.Items.Item(btnFind).Click();
                            }
                            else
                            {
                                string cardcode = getComboBoxVal(form, cbCustomerID);
                                if (cardcode == "")
                                {
                                    showMessage("Please select a customer.");
                                }
                                else
                                {
                                    if (custObjForImport == null)
                                    {
                                        form.Items.Item(btnFind).Click();
                                    }
                                    else
                                    {
                                        if (SBO_Application.MessageBox("Import payment method(s) to " + cardcode + "?", 1, "Yes", "No") == 1)
                                        {
                                            int i = 0;
                                            foreach (PaymentMethod pm in custObjForImport.PaymentMethods)
                                            {
                                                if (!isPaymentMethodExists(cardcode, pm.CardNumber, pm.CardExpiration))
                                                {
                                                    CCCUST cccust = new CCCUST();
                                                    cccust.CustomerID = cardcode;
                                                    cccust.active     = 'Y';
                                                    cccust.email      = custObjForImport.BillingAddress.Email;
                                                    cccust.firstName  = custObjForImport.BillingAddress.FirstName;
                                                    cccust.lastName   = custObjForImport.BillingAddress.LastName;
                                                    cccust.street     = custObjForImport.BillingAddress.Street;
                                                    cccust.city       = custObjForImport.BillingAddress.City;
                                                    cccust.state      = custObjForImport.BillingAddress.State;
                                                    cccust.zip        = custObjForImport.BillingAddress.Zip;
                                                    cccust.expDate    = pm.CardExpiration;
                                                    cccust.cardCode   = pm.CardCode;

                                                    cccust.routingNumber   = pm.Routing;
                                                    cccust.checkingAccount = pm.Account;
                                                    cccust.GroupName       = getGroupName(cardcode);
                                                    cccust.CustNum         = custObjForImport.CustNum;
                                                    cccust.MethodID        = pm.MethodID;
                                                    try
                                                    {
                                                        if (pm.MethodName != null && pm.MethodName != "")
                                                        {
                                                            if (pm.MethodName.IndexOf(" ") > 0)
                                                            {
                                                                string   name = pm.MethodName;
                                                                string[] s    = name.Split(' ');

                                                                cccust.firstName = s[0];
                                                                cccust.lastName  = s[s.Length - 1];
                                                            }
                                                        }
                                                    }
                                                    catch (Exception) { }
                                                    int    id   = getNextTableID("@CCCUST");
                                                    string desc = cccust.firstName + " " + cccust.lastName;
                                                    if (pm.MethodName != null && pm.MethodName != "")
                                                    {
                                                        desc = pm.MethodName;
                                                    }
                                                    if (pm.MethodType == "check")
                                                    {
                                                        cccust.methodDescription = id.ToString() + "_" + pm.Routing + " " + pm.Account + "(" + desc + ")";
                                                        cccust.checkingAccount   = pm.Account;
                                                        cccust.routingNumber     = pm.Routing;
                                                    }
                                                    else
                                                    {
                                                        cccust.cardNum           = pm.CardNumber;
                                                        cccust.methodDescription = id.ToString() + "_" + pm.CardNumber + " " + pm.CardExpiration + "(" + desc + ")";
                                                        cccust.checkingAccount   = pm.Account;
                                                        cccust.cardType          = pm.CardType;
                                                    }
                                                    string cardid = "";
                                                    cccust.CardName    = getCardName(cccust.GroupName, cccust.cardType, "", ref cardid);
                                                    cccust.CCAccountID = cardid;
                                                    cccust.methodName  = pm.MethodName;
                                                    insert(cccust);
                                                    SBO_Application.SetStatusBarMessage(string.Format("Import payment method {0} to {1}.", cccust.cardNum, cardcode), SAPbouiCOM.BoMessageTime.bmt_Medium, false);
                                                }
                                                i++;
                                            }
                                        }
                                    }
                                }
                            }
                        }catch (Exception ex)
                        {
                            SBO_Application.SetStatusBarMessage(string.Format("Import payment method error: {0}.", ex.Message), SAPbouiCOM.BoMessageTime.bmt_Medium, true);
                        }
                        break;

                    case btnFind:
                        try
                        {
                            string custNum = getFormEditVal(form, editCustNum);
                            if (custNum == "")
                            {
                                showMessage("Please enter customer number.");
                            }
                            else
                            {
                                SBO_Application.SetStatusBarMessage("Finding customer please wait...", SAPbouiCOM.BoMessageTime.bmt_Medium, false);

                                ueSecurityToken token = getToken("");
                                custObjForImport = ebiz.getCustomer(token, custNum);
                                SAPbouiCOM.ComboBox oCB = (SAPbouiCOM.ComboBox)form.Items.Item(cbPaymentMethod).Specific;
                                try
                                {
                                    while (oCB.ValidValues.Count > 0)
                                    {
                                        oCB.ValidValues.Remove(0, SAPbouiCOM.BoSearchKey.psk_Index);
                                    }
                                }
                                catch (Exception)
                                { }
                                ComboAddItem(oCB, "");
                                foreach (PaymentMethod pm in custObjForImport.PaymentMethods)
                                {
                                    string s    = "";
                                    string name = "";
                                    name = custObjForImport.BillingAddress.FirstName + " " + custObjForImport.BillingAddress.LastName;
                                    if (pm.MethodName != null && pm.MethodName != "")
                                    {
                                        if (pm.MethodName.IndexOf(" ") > 0)
                                        {
                                            name = pm.MethodName;
                                        }
                                    }
                                    if (pm.MethodType == "check")
                                    {
                                        s = pm.Routing + " " + pm.Account + "(" + name + ")";
                                    }
                                    else
                                    {
                                        s = pm.CardNumber + " " + pm.CardExpiration + "(" + name + ")";
                                    }
                                    ComboAddItem(oCB, s);
                                }
                                oCB.Select("");
                                SBO_Application.SetStatusBarMessage(string.Format("{0} payment method(s) ready to import.", oCB.ValidValues.Count - 1), SAPbouiCOM.BoMessageTime.bmt_Medium, false);
                                // form.Items.Item(btnImp).Click();
                            }
                        }catch (Exception ex)
                        {
                            custObjForImport = null;
                            SAPbouiCOM.ComboBox oCB = (SAPbouiCOM.ComboBox)form.Items.Item(cbPaymentMethod).Specific;
                            try
                            {
                                while (oCB.ValidValues.Count > 0)
                                {
                                    oCB.ValidValues.Remove(0, SAPbouiCOM.BoSearchKey.psk_Index);
                                }
                            }
                            catch (Exception)
                            { }
                            ComboAddItem(oCB, "");
                            oCB.Select("");
                            SBO_Application.SetStatusBarMessage(string.Format("Find customer error: {0}.", ex.Message), SAPbouiCOM.BoMessageTime.bmt_Medium, true);

                            errorLog(ex);
                        }
                        break;
                    }
                }
                break;
                }
            }
        }
        catch (Exception ex)
        {
            errorLog(ex);
        }
    }
Exemple #26
0
        public twmKDS_EXPXML()
        {
            try
            {
                //Draw the form
                String sFileName = string.Format("{0}.xml", this.GetType().Name);
                bool   bSuccess  = true;
                if (System.IO.File.Exists(Environment.CurrentDirectory + "\\" + sFileName))
                {
                    System.Xml.XmlDocument oXml = new System.Xml.XmlDocument();
                    oXml.Load(Environment.CurrentDirectory + "\\" + sFileName);
                    String sXml = eCommon.ModifySize(oXml.InnerXml);
                    try
                    {
                        eCommon.SBO_Application.LoadBatchActions(ref sXml);
                    }
                    catch
                    {
                        bSuccess = false;
                    }
                }
                else
                {
                    String ResourceName = string.Format("{0}.Src.Resource.{1}", System.Reflection.Assembly.GetExecutingAssembly().GetName().Name, sFileName);

                    String sXml = eCommon.ModifySize(eCommon.GetXMLResource(ResourceName));
                    try
                    {
                        eCommon.SBO_Application.LoadBatchActions(ref sXml);
                    }
                    catch {
                        bSuccess = false;
                    }
                }

                if (bSuccess)
                {
                    _oForm = eCommon.SBO_Application.Forms.ActiveForm;
                    if (_oForm.TypeEx.StartsWith("-"))
                    {
                        //a UDF form is opened. Close it.
                        String UDFFormUID    = _oForm.UniqueID;
                        String ParentFormUID = eCommon.GetParentFormUID(_oForm);
                        _oForm.Close();

                        _oForm = eCommon.SBO_Application.Forms.ActiveForm;
                        if (_oForm.UniqueID != ParentFormUID)
                        {
                            _oForm = eCommon.SBO_Application.Forms.Item(ParentFormUID);
                        }
                    }
                    _oForm.EnableMenu("6913", false);

                    GetItemReferences();
                    // Initform can be use if you want to fill anything or color anything
                    InitForm();
                    if (!SBOAddon.oOpenForms.Contains(_oForm.UniqueID))
                    {
                        SBOAddon.oOpenForms.Add(_oForm.UniqueID, this);
                    }

                    _oForm.Visible = true;
                }
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message);
            }
        }
Exemple #27
0
        private void SBO_Application_ItemEvent(string FormUID, ref SAPbouiCOM.ItemEvent pVal, out bool BubbleEvent)
        {
            BubbleEvent = true;

            // SOCIO DE NEGOCIOS
            if ((pVal.FormType == 134 & pVal.EventType != SAPbouiCOM.BoEventTypes.et_FORM_UNLOAD) & (pVal.Before_Action == true))
            {
                oOrderForm = SBO_Application.Forms.GetFormByTypeAndCount(pVal.FormType, pVal.FormTypeCount);
                if ((pVal.EventType == SAPbouiCOM.BoEventTypes.et_FORM_LOAD) & (pVal.BeforeAction == true))
                {
                    DibujaItems.BtnCoRuc(oOrderForm);
                }

                if (pVal.ItemUID == "btnCRu" & (pVal.EventType == SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED))
                {
                    /*VALIDAMOS LICENCIA*/
                    DateTime dt1, dt2;
                    dt1 = DateTime.Parse("01/01/2021");
                    dt2 = DateTime.Now;
                    TimeSpan ts = dt2 - dt1;
                    if (ts.Days < 15)
                    {
                        if ((oOrderForm.Mode == SAPbouiCOM.BoFormMode.fm_ADD_MODE))
                        {
                            try
                            {
                                txtRuc    = (SAPbouiCOM.EditText)oOrderForm.Items.Item("41").Specific;
                                oCardType = (SAPbouiCOM.ComboBox)oOrderForm.Items.Item("40").Specific;
                                Ruc       = txtRuc.Value;

                                if (Ruc.Length == 11)
                                {
                                    oSocioNegocio              = new SocioNegocio();
                                    DatosSunat                 = ClassDatosSN.GetDatosSN(Ruc);
                                    oSocioNegocio.CardType     = oCardType.Value; // [C] cliente [S] Proveedor
                                    oSocioNegocio.ruc          = DatosSunat[0];
                                    oSocioNegocio.razonSocial  = DatosSunat[1];
                                    oSocioNegocio.estado       = DatosSunat[2];
                                    oSocioNegocio.condicion    = DatosSunat[3];
                                    oSocioNegocio.direccion    = DatosSunat[4];
                                    oSocioNegocio.departamento = DatosSunat[5];
                                    oSocioNegocio.provincia    = DatosSunat[6];
                                    oSocioNegocio.distrito     = DatosSunat[7];


                                    if (!(SetConnectionContext() == 0))
                                    {
                                        SBO_Application.MessageBox("Failed setting a connection to DI API", 1, "Ok", "", "");
                                        System.Environment.Exit(0); //  Terminating the Add-On Application
                                    }

                                    if (!(ConnectToCompany() == 0))
                                    {
                                        SBO_Application.MessageBox("Failed connecting to the company's Data Base", 1, "Ok", "", "");
                                        System.Environment.Exit(0); //  Terminating the Add-On Application
                                    }


                                    if (oSocioNegocio.estado == "ACTIVO" && oSocioNegocio.condicion == "HABIDO")
                                    {
                                        if (SBO_Application.MessageBox("Esta seguro de [Cear] Socio de negocios:" + oSocioNegocio.razonSocial, 2, "Ok", "Cancelar") == 1)
                                        {
                                            int res = AddSocioNegocioController.CreaSoNe(oCompany, oSocioNegocio);
                                            if (res == 0)
                                            {
                                                SBO_Application.MessageBox("Socio de negocios creado: " + oCompany.CompanyName + Constants.vbNewLine, 1, "Ok", "", "");
                                                oOrderForm.Close();
                                            }
                                            else
                                            {
                                                string LastError = "";
                                                oCompany.GetLastError(out res, out LastError);
                                                SBO_Application.MessageBox(res + "-" + LastError);
                                            }
                                        }
                                    }
                                    else
                                    {
                                        if (SBO_Application.MessageBox("El SN: " + oSocioNegocio.razonSocial + "\r\n" + "Estado: " + oSocioNegocio.estado + " Condición: " + oSocioNegocio.condicion + "\r\n" + "Desea crear SN de todas formas?", 2, "Ok", "Cancelar") == 1)
                                        {
                                            int res = AddSocioNegocioController.CreaSoNe(oCompany, oSocioNegocio);
                                            if (res == 0)
                                            {
                                                SBO_Application.MessageBox("Socio de negocios creado: " + oCompany.CompanyName + Constants.vbNewLine, 1, "Ok", "", "");
                                                oOrderForm.Close();
                                            }
                                            else
                                            {
                                                string LastError = "";
                                                oCompany.GetLastError(out res, out LastError);
                                                SBO_Application.MessageBox(res + "-" + LastError);
                                            }
                                        }
                                    }
                                }
                                else
                                {
                                    SBO_Application.MessageBox("Nùmero de RUC debe de contener 12 caracteres");
                                }
                            }
                            catch (Exception ex)
                            {
                                SBO_Application.MessageBox(ex.Message);
                            }
                        }
                        else
                        {
                            SBO_Application.MessageBox("Esta obcion solo esta activada para [Crear] Socio de negocio.");
                        }
                    }
                    else
                    {
                        SBO_Application.MessageBox("Periodo de prueba [terminado]");
                    }
                }
            }
        }
Exemple #28
0
        // TODO: Submit the PO to create GRPO
        void _btnPost_PressedAfter(object sboObject, SAPbouiCOM.SBOItemEventArg pVal)
        {
            try
            {
                if (eCommon.DataTableIndexOf(_dt_VendorGrid, "Checked", "Y") == null)
                {
                    eCommon.SBO_Application.StatusBar.SetText("No PO Selected", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error);
                }
                else
                {
                    SAPbobsCOM.Documents oReceipt = null;
                    // If save as draft
                    if (_cbDraft.Checked)
                    {
                        oReceipt = eCommon.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oDrafts) as SAPbobsCOM.Documents;
                        oReceipt.DocObjectCode = SAPbobsCOM.BoObjectTypes.oPurchaseDeliveryNotes;
                    }
                    // If save as GRPO
                    else
                    {
                        oReceipt = eCommon.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oPurchaseDeliveryNotes) as SAPbobsCOM.Documents;
                    }


                    oReceipt.CardCode = _oForm.DataSources.UserDataSources.Item("txtVendor").ValueEx;
                    oReceipt.CardName = _oForm.DataSources.UserDataSources.Item("txtNAME").ValueEx;

                    oReceipt.DocDate = DateTime.ParseExact(_oForm.DataSources.UserDataSources.Item("txtPSTDT").ValueEx, "yyyyMMdd", System.Globalization.DateTimeFormatInfo.CurrentInfo, System.Globalization.DateTimeStyles.AssumeLocal);
                    //check if empty
                    if (_oForm.DataSources.UserDataSources.Item("txtDOCDT").ValueEx.Length > 0)
                    {
                        oReceipt.DocDueDate = DateTime.ParseExact(_oForm.DataSources.UserDataSources.Item("txtDOCDT").ValueEx, "yyyyMMdd", System.Globalization.DateTimeFormatInfo.CurrentInfo, System.Globalization.DateTimeStyles.AssumeLocal);
                    }
                    //check if empty
                    if (_oForm.DataSources.UserDataSources.Item("txtDUEDT").ValueEx.Length > 0)
                    {
                        oReceipt.TaxDate = DateTime.ParseExact(_oForm.DataSources.UserDataSources.Item("txtDUEDT").ValueEx, "yyyyMMdd", System.Globalization.DateTimeFormatInfo.CurrentInfo, System.Globalization.DateTimeStyles.AssumeLocal);
                    }
                    //check if empty
                    if (_oForm.DataSources.UserDataSources.Item("txtRMK").ValueEx.Length > 0)
                    {
                        oReceipt.Comments = _oForm.DataSources.UserDataSources.Item("txtRMK").ValueEx;
                    }

                    int[] SelectedRows = eCommon.DataTableIndexOf(_dt_VendorGrid, "Checked", "Y");
                    int   iLineCount   = 0;

                    if (SelectedRows != null)
                    {
                        foreach (int Row in SelectedRows)
                        {
                            //Check whether it is checked. if not just continue;
                            //first time theres already a new line, so only add on 2nd line on wards
                            if (iLineCount > 0)
                            {
                                oReceipt.Lines.Add();
                            }
                            // the document type
                            String temp = _dt_VendorGrid.GetValue("Doc_Type", Row).ToString();
                            oReceipt.Lines.BaseType = Int32.Parse(_dt_VendorGrid.GetValue("Doc_Type", Row).ToString());
                            // the document id
                            oReceipt.Lines.BaseEntry = Int32.Parse(_dt_VendorGrid.GetValue("Doc_Entry", Row).ToString());
                            // which line is it in the document
                            oReceipt.Lines.BaseLine = Int32.Parse(_dt_VendorGrid.GetValue("Line_Num", Row).ToString());
                            oReceipt.Lines.Quantity = double.Parse(_dt_VendorGrid.GetValue("Quantity", Row).ToString());
                            oReceipt.Lines.UserFields.Fields.Item("U_TWM_CTBOXNO").Value = _dt_VendorGrid.GetValue("Checked", Row);

                            iLineCount++;
                        }
                    }

                    //add the invoice
                    int iErr = oReceipt.Add();
                    //open the invoice
                    if (iErr != 0)
                    {
                        throw new Exception(eCommon.oCompany.GetLastErrorDescription());
                    }
                    else
                    {
                        String iDocEntry   = eCommon.oCompany.GetNewObjectKey();
                        String sObjectType = eCommon.oCompany.GetNewObjectType();

                        oReceipt = eCommon.oCompany.GetBusinessObject((SAPbobsCOM.BoObjectTypes) int.Parse(sObjectType)) as SAPbobsCOM.Documents;
                        oReceipt.GetByKey(int.Parse(iDocEntry));
                        String sDocNum = oReceipt.DocNum.ToString();

                        eCommon.SBO_Application.OpenForm((SAPbouiCOM.BoFormObjectEnum) int.Parse(sObjectType), "", iDocEntry);
                        _oForm.Close();
                    }
                }
            }
            catch (Exception Ex) { eCommon.SBO_Application.StatusBar.SetText(Ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error); }
        }
    private void PayOnTermFormHandler(SAPbouiCOM.ItemEvent pVal)
    {
        try
        {
            if (pVal.BeforeAction)
            {
            }
            else
            {
                switch (pVal.EventType)
                {
                case SAPbouiCOM.BoEventTypes.et_CLICK:

                    break;

                case SAPbouiCOM.BoEventTypes.et_KEY_DOWN:

                    if ((pVal.CharPressed == 13 || pVal.CharPressed == 10 || pVal.CharPressed == 9) && pVal.ItemUID == editStartDate)
                    {
                        try
                        {
                            string deliveryID = getFormItemVal(oPayOnTermForm, editStartDate);

                            if (deliveryID != "")
                            {
                                if (cfgBatchAutoMode != "Y")
                                {
                                    if (getFormItemVal(oPayOnTermForm, editStartDate) != "")
                                    {
                                        if (ManualScan == "")
                                        {
                                            ManualScan = getFormItemVal(oPayOnTermForm, editStartDate);
                                        }
                                        else
                                        {
                                            ManualScan = ManualScan + "," + getFormItemVal(oPayOnTermForm, editStartDate);
                                        }
                                        setFormEditVal(oPayOnTermForm, editStartDate, "");
                                    }
                                }
                                populatePayOnTermMatrix(true, getFormItemVal(oPayOnTermForm, editStartDate));
                            }
                        }
                        catch (Exception e)
                        {
                            errorLog(e);
                        }
                    }
                    break;

                case SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED:
                {
                    switch (pVal.ItemUID)
                    {
                    case btnClose:
                        oPayOnTermForm.Close();
                        break;

                    case btnInvoice:
                        //DateTime dt = DateTime.Parse(getFormItemVal(oPayOnTermForm, editStartDate));
                        bAuto = false;
                        populatePayOnTermMatrix(false);
                        SAPbouiCOM.Matrix oMatrix = (SAPbouiCOM.Matrix)oPayOnTermForm.Items.Item(matrixPayOnTerm).Specific;
                        if (oMatrix.RowCount == 0)
                        {
                            SBO_Application.MessageBox("No order to process.");
                            return;
                        }
                        if (SBO_Application.MessageBox("Capture and create invoices for delivered order?", 1, "Yes", "No") == 1)
                        {
                            tProcess = new Thread(BatchCreateInvoice);
                            tProcess.Start();

                            /*
                             * BatchCreateInvoice();
                             * populatePayOnTermMatrix(true);
                             * SetPaymentID();
                             */
                        }
                        break;

                    case btnRefresh:
                        try
                        {
                            populatePayOnTermMatrix(false);
                        }
                        catch (Exception ex)
                        {
                            SBO_Application.MessageBox(ex.Message);
                        }
                        break;

                    case btnFind:
                    {
                        if (cfgBatchAutoMode != "Y")
                        {
                            if (getFormItemVal(oPayOnTermForm, editStartDate) != "")
                            {
                                if (ManualScan == "")
                                {
                                    ManualScan = getFormItemVal(oPayOnTermForm, editStartDate);
                                }
                                else
                                {
                                    ManualScan = ManualScan + "," + getFormItemVal(oPayOnTermForm, editStartDate);
                                }
                                setFormEditVal(oPayOnTermForm, editStartDate, "");
                            }
                        }
                        populatePayOnTermMatrix(true, getFormItemVal(oPayOnTermForm, editStartDate));
                    }
                    break;
                    }
                }
                break;
                }
            }
        }
        catch (Exception ex)
        {
            errorLog(ex);
        }
    }
Exemple #30
0
    private void RBillingFormHandler(SAPbouiCOM.Form form, SAPbouiCOM.ItemEvent pVal)
    {
        try
        {
            oRBillingForm = form;
            if (pVal.BeforeAction)
            {
            }
            else
            {
                switch (pVal.EventType)
                {
                case SAPbouiCOM.BoEventTypes.et_COMBO_SELECT:
                {
                    switch (pVal.ItemUID)
                    {
                    case cbCustomerID:
                        string id = getFormItemVal(form, cbCustomerID);
                        if (id != "")
                        {
                            setFormEditVal(form, editCustomerID, id);

                            populateRBillingMatrix("", string.Format(" AND \"U_CustomerID\"='{0}'", getFormItemVal(oRBillingForm, editCustomerID)));
                        }
                        break;
                    }
                }
                break;

                case SAPbouiCOM.BoEventTypes.et_CLICK:
                    if (pVal.ItemUID == matrixRBilling)
                    {
                        if (pVal.ColUID != "jobID")
                        {
                            switch (pVal.ColUID)
                            {
                            case "LastRun":
                                populateRBillingMatrix("\"U_LastRunDate\" DESC,");
                                break;

                            case "Desc":
                                populateRBillingMatrix("\"U_Description\",");
                                break;

                            case "NextRun":
                                populateRBillingMatrix();
                                break;

                            case "InvID":
                                populateRBillingMatrix("\"U_InvoiceID\", ");
                                break;

                            case "CustName":
                                populateRBillingMatrix("\"U_CustomerName\", ");
                                break;

                            case "CustomerID":
                                populateRBillingMatrix("\"U_CustomerID\", ");
                                break;

                            default:
                                populateRBillingMatrix();
                                break;
                            }
                        }
                        else
                        {
                            HandleJobSelect();
                        }
                    }
                    break;

                case SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED:
                {
                    switch (pVal.ItemUID)
                    {
                    case btnClose:
                        oRBillingForm.Close();
                        oRBillingForm = null;
                        break;

                    case btnAdd:
                        JobCustID = getFormItemVal(form, cbCustomerID);
                        if (JobCustID == "")
                        {
                            showMessage("Please select a customer");
                            return;
                        }

                        resetGlobal();
                        JobCustID = getFormItemVal(form, cbCustomerID);

                        CreateJobForm();
                        bAuto = false;
                        break;

                    case btnRefresh:
                        try
                        {
                            populateRBillingMatrix();
                        }
                        catch (Exception ex)
                        {
                            showMessage(ex.Message);
                        }
                        break;

                    case btnRun:
                        try
                        {
                            ProcessJob();

                            populateRBillingMatrix();
                        }
                        catch (Exception ex)
                        {
                            showMessage(ex.Message);
                        }
                        break;

                    case btnFind:
                        string id = getFormItemVal(oeBizConnectForm, editCustomerID);
                        showStatus("Finding customer please wait...", SAPbouiCOM.BoMessageTime.bmt_Medium, false);
                        List <String> list = FindCustomer(id);
                        if (list.Count() == 0)
                        {
                            showStatus("No customer found.", SAPbouiCOM.BoMessageTime.bmt_Medium, false);
                        }
                        else
                        {
                            SAPbouiCOM.ComboBox oCB = (SAPbouiCOM.ComboBox)form.Items.Item(cbCustomerID).Specific;
                            try
                            {
                                while (oCB.ValidValues.Count > 0)
                                {
                                    oCB.ValidValues.Remove(0, SAPbouiCOM.BoSearchKey.psk_Index);
                                }
                            }
                            catch (Exception)
                            { }
                            ComboAddItem(oCB, "");
                            foreach (string c in list)
                            {
                                ComboAddItem(oCB, c);
                            }
                            showStatus("Found " + list.Count().ToString() + " customer(s).", SAPbouiCOM.BoMessageTime.bmt_Medium, false);
                        }
                        break;
                    }
                }
                break;
                }
            }
        }
        catch (Exception ex)
        {
            errorLog(ex);
        }
    }