Пример #1
0
 public override void MenuEvent(ref SAPbouiCOM.MenuEvent pVal, out bool BubbleEvent)
 {
     BubbleEvent = true;
     this.UIAPIRawForm.Freeze(true);
     try
     {
         if (pVal.MenuUID == "AddLine")
         {
             if (this.UIAPIRawForm.Mode == SAPbouiCOM.BoFormMode.fm_ADD_MODE || this.UIAPIRawForm.Mode == SAPbouiCOM.BoFormMode.fm_OK_MODE)
             {
                 if (fldrItems.Selected == true)
                 {
                     mtxItems.AddLine();
                 }
                 else
                 {
                     mtxCost.AddLine();
                 }
             }
         }
         if (pVal.MenuUID == "DeleteLine")
         {
             if (RowToDeleteIndex > 0)
             {
                 mtxItems.DeleteRow(RowToDeleteIndex);
                 mtxItems.FlushToDataSource();
             }
         }
     }
     catch (Exception ex)
     {
         Application.SBO_Application.SetStatusBarMessage(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Long, true);
     }
     this.UIAPIRawForm.Freeze(false);
 }
Пример #2
0
        private void DeleteRow(int row, string ItemUID)
        {
            try
            {
                if (ItemUID.Equals(MATRIZ_PRINCIPAL))
                {
                    oMatrix.FlushToDataSource();

                    if (dsTipoUsuario.GetValue("Code", row - 1) != null &&
                        !string.IsNullOrEmpty(dsTipoUsuario.GetValue("Code", row - 1).Trim()))
                    {
                        deletedEntries.Add(dsTipoUsuario.GetValue("Code", row - 1).ToString().Trim());
                        dsTipoUsuario.RemoveRecord(row - 1);

                        if (mForm.Mode == SAPbouiCOM.BoFormMode.fm_OK_MODE)
                        {
                            mForm.Mode = SAPbouiCOM.BoFormMode.fm_UPDATE_MODE;
                        }

                        oMatrix.LoadFromDataSource();
                        oMatrix.CommonSetting.SetCellEditable(dsTipoUsuario.Size, 1, true);
                    }
                }
            }
            catch (Exception ex)
            {
                StatusMessageError("DeleteRow() > " + ex.Message);
            }
        }
Пример #3
0
 void btnAddRow_ClickAfter(object sboObject, SAPbouiCOM.SBOItemEventArg pVal)
 {
     mtxCost.AddLine();
     //mtxCost.AddRowIndex();
     mtxCost.AddRowIndex();
     mtxCost.FlushToDataSource();
     this.UIAPIRawForm.Mode = SAPbouiCOM.BoFormMode.fm_UPDATE_MODE;
 }
Пример #4
0
        private void CalcToday()
        {
            mtAnimals.FlushToDataSource();
            double TodayTotal = Convert.ToDouble(dtHead.GetValue("TodayQty", 0));



            mtAnimals.LoadFromDataSource();
            getReport();
        }
Пример #5
0
        // on button next check which rows are checked, and proceed to pane 2
        void _btnNext_PressedAfter(object sboObject, SAPbouiCOM.SBOItemEventArg pVal)
        {
            try
            {
                //listofDocEntries = new List<String>();
                //for (int i = 1; i <= _mat_CST.RowCount; i++)
                //{
                //    SAPbouiCOM.CheckBox check = (SAPbouiCOM.CheckBox)_mat_CST.Columns.Item("colCHK").Cells.Item(i).Specific;
                //    SAPbouiCOM.EditText oEditText = (SAPbouiCOM.EditText)_mat_CST.Columns.Item("colDOCET").Cells.Item(i).Specific;
                //    if (check.Checked)
                //        listofDocEntries.Add(oEditText.Value);
                //}
                _mat_CST.FlushToDataSource();
                int[] SelectedRows = eCommon.DataTableIndexOf(_dt_CST, "Check", "Y");

                if (SelectedRows == null || SelectedRows.Length < 1)
                {
                    eCommon.SBO_Application.StatusBar.SetText("No SO selected", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error);
                }
                else
                {
                    changePane(2);
                }
            }
            catch (Exception Ex) { eCommon.SBO_Application.StatusBar.SetText(Ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error); }
        }
Пример #6
0
        public override void etAfterValidate(ref SAPbouiCOM.ItemEvent pVal, ref bool BubbleEvent)
        {
            base.etAfterValidate(ref pVal, ref BubbleEvent);
            if (pVal.ItemUID == txFrom.Item.UniqueID || pVal.ItemUID == txTo.Item.UniqueID)
            {
                fillReport();
            }
            if (pVal.ItemUID == mtReport.Item.UniqueID)
            {
                if (pVal.ColUID == "cFT")
                {
                    mtReport.FlushToDataSource();
                    int selRowIndex = pVal.Row - 1;
                    if (selRowIndex >= 0)
                    {
                        string DocEntry = Convert.ToString(dtRpt.GetValue("DocEntry", selRowIndex));
                        string Seq      = Convert.ToString(dtRpt.GetValue("Seq", selRowIndex));
                        string FreeText = Convert.ToString(dtRpt.GetValue("FreeText", selRowIndex));
                        string prodLine = Convert.ToString(dtRpt.GetValue("ProdLine", selRowIndex));

                        if (pVal.ColUID == "cFT")
                        {
                            SAPbobsCOM.ProductionOrders prodOrder = (SAPbobsCOM.ProductionOrders)oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oProductionOrders);
                            prodOrder.GetByKey(Convert.ToInt32(DocEntry));

                            prodOrder.UserFields.Fields.Item("U_B1_FrTxt").Value = FreeText;
                            int result = prodOrder.Update();
                            if (result != 0)
                            {
                                int    errorCode = 0;
                                string errmsg    = "";
                                oCompany.GetLastError(out errorCode, out errmsg);
                                oApplication.MessageBox(errmsg);
                            }
                            else
                            {
                            }
                        }
                        else
                        {
                            //  UpdateSeq(Convert.ToInt32(DocEntry), Convert.ToInt32(Seq), prodLine);
                        }
                    }
                }
            }
        }
        private static void Cargar_Datos_Matrix()
        {
            try
            {
                //oForm = Application.SBO_Application.Forms.ActiveForm;
                oDTTable = oForm.DataSources.DataTables.Item("DT_SQL1");
                SAPbouiCOM.DBDataSource source = oForm.DataSources.DBDataSources.Item("@ZDFER");

                oForm.Freeze(true);

                string sql = "SELECT * FROM [@ZDFER] ORDER BY U_Fecha";

                oDTTable.ExecuteQuery(sql);

                oMatrix = (SAPbouiCOM.Matrix)oForm.Items.Item("3").Specific;
                oMatrix.FlushToDataSource();
                source.Clear();
                oMatrix.Clear();

                for (int i = 0; i < oDTTable.Rows.Count; i++)
                {
                    source.InsertRecord(source.Size);
                    source.Offset = source.Size - 1;
                    source.SetValue("Code", source.Size - 1, Convert.ToString(oDTTable.GetValue("Code", i)));
                    //DateTime fecha = (DateTime)oDTTable.GetValue("U_Fecha", i);
                    source.SetValue("U_Fecha", source.Size - 1, Convert.ToDateTime(oDTTable.GetValue("U_Fecha", i)).ToString("yyyyMMdd"));
                    source.SetValue("U_Descripcion", source.Size - 1, Convert.ToString(oDTTable.GetValue("U_Descripcion", i)));
                    source.SetValue("DocEntry", source.Size - 1, Convert.ToString(oDTTable.GetValue("DocEntry", i)));
                }

                sql = "SELECT MAX(CAST(Code as int)) + 1 as Proximo FROM [@ZDFER]";
                oDTTable.ExecuteQuery(sql);

                source.InsertRecord(source.Size);
                source.Offset = source.Size - 1;
                source.SetValue("Code", source.Size - 1, Convert.ToString(oDTTable.GetValue("Proximo", 0)));
                source.SetValue("DocEntry", source.Size - 1, Convert.ToString(oDTTable.GetValue("Proximo", 0)));

                oMatrix.LoadFromDataSource();
                oMatrix.AutoResizeColumns();
            }
            catch (Exception)
            {
            }
            finally
            {
                oForm.Freeze(false);
            }
        }
Пример #8
0
        private void addEmptyRow(SAPbouiCOM.Matrix mt, SAPbouiCOM.DataTable dt, string firstCol)
        {
            if (dt.Rows.Count == 0)
            {
                dt.Rows.Add(2);
                dt.Rows.Remove(1);
                dt.SetValue("Id", 0, "1");
                mt.AddRow(1, mt.RowCount + 1);
            }
            else
            {
                if (Convert.ToString(dt.GetValue(firstCol, dt.Rows.Count - 1)) == "")
                {
                    string strCostCode = Convert.ToString(dt.GetValue(firstCol, dt.Rows.Count - 1));
                }
                else
                {
                    mt.AddRow(1, mt.RowCount + 1);
                    mt.SetLineData(mt.RowCount);
                    mt.FlushToDataSource();


                    dt.SetValue("Id", dt.Rows.Count - 1, dt.Rows.Count.ToString());
                    dt.SetValue(firstCol, dt.Rows.Count - 1, "");



                    BOQD.SetValue("STD", dt.Rows.Count - 1, "");
                    BOQD.SetValue("ETD", dt.Rows.Count - 1, "");
                    BOQD.SetValue("WBL", dt.Rows.Count - 1, "");
                    BOQD.SetValue("WBD", dt.Rows.Count - 1, "");
                    BOQD.SetValue("Type", dt.Rows.Count - 1, "");
                    BOQD.SetValue("Code", dt.Rows.Count - 1, "");
                    BOQD.SetValue("Name", dt.Rows.Count - 1, "");
                    BOQD.SetValue("Remarks", dt.Rows.Count - 1, "");
                    BOQD.SetValue("Qty", dt.Rows.Count - 1, "0");
                    BOQD.SetValue("UP", dt.Rows.Count - 1, "0");
                    BOQD.SetValue("BGTC", dt.Rows.Count - 1, "0");



                    mt.SetLineData(mt.RowCount);
                }
            }
            //    mt.LoadFromDataSource();
        }
Пример #9
0
    private void HandleItemPressBPExport(SAPbouiCOM.Form form)
    {
        bool FlgChange = false;

        try
        {
            if (form.Items.Item(MtxBPExport) == null)
            {
                return;
            }

            form.Items.Item(MtxBPExport).AffectsFormMode = false;
            oMatrixBpExport = (SAPbouiCOM.Matrix)form.Items.Item(MtxBPExport).Specific;
            int RowCount = oDTBpExport.Rows.Count;
            if (RowCount > 0)
            {
                for (int i = oDTBpExport.Rows.Count - 1; i >= 0; i--)
                {
                    var EdCardCode = GetMatrixValue(oMatrixBpExport, i, "colCard").ToString();
                    var EdCardName = GetMatrixValue(oMatrixBpExport, i, "CardName").ToString();
                    var EdEmail    = GetMatrixValue(oMatrixBpExport, i, "E_Mail").ToString();

                    var chk = (SAPbouiCOM.CheckBox)oMatrixBpExport.Columns.Item("clSel").Cells.Item(i + 1).Specific;
                    if (chk.Checked)
                    {
                        FlgChange = true;
                        Customer oCust = NewCustomer(EdCardCode, EdCardName, EdEmail);
                        PostBP(oCust, i, oMatrixBpExport);
                    }
                    else
                    {
                    }
                }
                if (FlgChange)
                {
                    //   oMatrixBpExport.LoadFromDataSource();
                    oMatrixBpExport.FlushToDataSource();
                }
            }
        }
        catch (Exception ex)
        {
            errorLog(ex.Message);
        }
    }
Пример #10
0
        // on button next check which rows are checked, and proceed to pane 2
        void _btnNext_PressedAfter(object sboObject, SAPbouiCOM.SBOItemEventArg pVal)
        {
            try
            {
                _mat_Vendor.FlushToDataSource();
                int[] SelectedRows = eCommon.DataTableIndexOf(_dt_VendorMatrix, "Check", "Y");

                if (SelectedRows == null || SelectedRows.Length < 1)
                {
                    eCommon.SBO_Application.StatusBar.SetText("No PO selected", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error);
                }
                else
                {
                    changePane(2);
                }
            }
            catch (Exception Ex) { eCommon.SBO_Application.StatusBar.SetText(Ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error); }
        }
    private void HandleItemRecPay(SAPbouiCOM.Form form)
    {
        bool FlgChange = false;

        try
        {
            if (form.Items.Item(MtxRecPay) == null)
            {
                return;
            }

            form.Items.Item(MtxRecPay).AffectsFormMode = false;
            OMtxRecPay = (SAPbouiCOM.Matrix)form.Items.Item(MtxRecPay).Specific;
            int RowCount = odtRecPay.Rows.Count;
            if (RowCount > 0)
            {
                for (int i = odtRecPay.Rows.Count - 1; i >= 0; i--)
                {
                    var EdTemplate = GetMatrixValue(OMtxRecPay, i, "clEbizkey").ToString(); //DocNum
                    var EdDocNum   = GetMatrixValue(OMtxRecPay, i, "DocNum").ToString();    //

                    var chk = (SAPbouiCOM.CheckBox)OMtxRecPay.Columns.Item("clSel").Cells.Item(i + 1).Specific;
                    if (chk.Checked)
                    {
                        FlgChange = true;
                        PostRecPay(EdTemplate, i, OMtxRecPay, form, EdDocNum);
                    }
                    else
                    {
                    }
                }
                if (FlgChange)
                {
                    //   oMatrixBpExport.LoadFromDataSource();
                    OMtxRecPay.FlushToDataSource();
                }
            }
        }
        catch (Exception ex)
        {
            errorLog(ex.Message);
        }
    }
Пример #12
0
        private void updateModuleSetup()
        {
            mtAddon.FlushToDataSource();
            string updateAddon = "";

            for (int i = 0; i < dtHead.Rows.Count; i++)
            {
                updateAddon += "Update [@DEM_MODULES] set U_LicenseKey='" + dtHead.GetValue("LK", i).ToString() + "',U_Enabled='" + dtHead.GetValue("Active", i).ToString() + "' where Code='" + dtHead.GetValue("AC", i).ToString() + "' ;";
            }



            int result = Program.objHrmsUI.ExecQuery(updateAddon, "Updating Module Setup");

            saveSettings();
            Program.objHrmsUI.createConfigurationTables();
            Program.objHrmsUI.loadSettings();
            Program.objHrmsUI.loadAddons();
        }
Пример #13
0
 public static void AddLineMatrixDBDataSource(SAPbouiCOM.Matrix oMatrix, SAPbouiCOM.DBDataSource source, string ColumnaFocus = "")
 {
     try
     {
         SAPbouiCOM.EditText oEdit;
         oMatrix.FlushToDataSource();
         source.InsertRecord(source.Size);
         source.Offset = source.Size - 1;
         oMatrix.LoadFromDataSource();
         oMatrix.SelectRow(source.Size, true, false);
         if (ColumnaFocus.Trim().Length != 0)
         {
             oEdit              = (SAPbouiCOM.EditText)oMatrix.Columns.Item(ColumnaFocus).Cells.Item(source.Size).Specific;
             oEdit.Active       = true;
             oEdit.Item.Enabled = true;
         }
     }
     catch (Exception) { }
 }
Пример #14
0
    private void HandleItemPressIExportSO(SAPbouiCOM.Form form)
    {
        bool FlgChange = false;

        try
        {
            if (form.Items.Item(MtxExportSO) == null)
            {
                return;
            }

            form.Items.Item(MtxExportSO).AffectsFormMode = false;
            oMatrixExportSO = (SAPbouiCOM.Matrix)form.Items.Item(MtxExportSO).Specific;
            int RowCount = oDTExportSO.Rows.Count;
            if (RowCount > 0)
            {
                for (int i = oDTExportSO.Rows.Count - 1; i >= 0; i--)
                {
                    var EdDocNum = GetMatrixValue(oMatrixExportSO, i, "DocNum").ToString();

                    var chk = (SAPbouiCOM.CheckBox)oMatrixExportSO.Columns.Item("clSel").Cells.Item(i + 1).Specific;
                    if (chk.Checked)
                    {
                        FlgChange = true;
                        SalesOrder oSalesOrder = GetSO(EdDocNum);
                        PostSO(oSalesOrder, i, oMatrixExportSO);
                    }
                    else
                    {
                    }
                }
                if (FlgChange)
                {
                    //   oMatrixBpExport.LoadFromDataSource();
                    oMatrixExportSO.FlushToDataSource();
                }
            }
        }
        catch (Exception ex)
        {
            errorLog(ex.Message);
        }
    }
    private void HandleItemPressPendEmail(SAPbouiCOM.Form form)
    {
        bool FlgChange = false;

        try
        {
            if (form.Items.Item(MtxSendPendingEmail) == null)
            {
                return;
            }

            form.Items.Item(MtxSendPendingEmail).AffectsFormMode = false;
            oMatrixPendEmail = (SAPbouiCOM.Matrix)form.Items.Item(MtxSendPendingEmail).Specific;
            int RowCount = odtSendPendingEmail.Rows.Count;
            if (RowCount > 0)
            {
                for (int i = odtSendPendingEmail.Rows.Count - 1; i >= 0; i--)
                {
                    var EdTemplate = GetMatrixValue(oMatrixPendEmail, i, "clEbizkey").ToString();

                    var chk = (SAPbouiCOM.CheckBox)oMatrixPendEmail.Columns.Item("clSel").Cells.Item(i + 1).Specific;
                    if (chk.Checked)
                    {
                        FlgChange = true;
                        PostPendEmail(EdTemplate, i, oMatrixPendEmail, form);
                    }
                    else
                    {
                    }
                }
                if (FlgChange)
                {
                    //   oMatrixBpExport.LoadFromDataSource();
                    oMatrixPendEmail.FlushToDataSource();
                }
            }
        }
        catch (Exception ex)
        {
            errorLog(ex.Message);
        }
    }
    private void ExportItemFormHandler(SAPbouiCOM.Form form, SAPbouiCOM.ItemEvent pVal)
    {
        try
        {
            theExportItemForm = form;
            if (pVal.BeforeAction)
            {
                switch (pVal.EventType)
                {
                case SAPbouiCOM.BoEventTypes.et_FORM_LOAD:

                    break;
                }
            }
            else
            {
                switch (pVal.EventType)
                {
                case SAPbouiCOM.BoEventTypes.et_FORM_RESIZE:
                    currentForm = form;
                    //tProcess = new Thread(BPMoveThreadProc);
                    //tProcess.Start();
                    break;

                case SAPbouiCOM.BoEventTypes.et_FORM_LOAD:

                    try
                    {
                        formSelTarget = form;

                        //form.Items.Item(tbeBizCharge).Visible = false;
                        //   bcontrolCreated = false;
                    }
                    catch (Exception ex)
                    {
                        errorLog(ex);
                    }

                    break;

                case SAPbouiCOM.BoEventTypes.et_VALIDATE:
                    try
                    {
                        //Reload DATA
                        //if (!bcontrolCreated)
                        //    return;
                        //if (pVal.ItemChanged == true && pVal.ItemUID == editCardNum)
                        //{
                        //    setCardName(form, selSAPCust);
                        //}
                    }
                    catch (Exception)
                    { }

                    break;

                case SAPbouiCOM.BoEventTypes.et_COMBO_SELECT:
                {
                }
                break;

                case SAPbouiCOM.BoEventTypes.et_CLICK:
                    if (pVal.ItemUID == "btnPost")
                    {
                        HandleItemPressItemExport(form);
                    }
                    if (pVal.ItemUID == MtxItem)
                    {
                        if (form.Items.Item(MtxItem) == null)
                        {
                            return;
                        }

                        oMatrixItemExport.FlushToDataSource();
                    }

                    if (pVal.ItemUID == MtxItem && pVal.ColUID.Equals("clSel") && pVal.Row == 0 && !pVal.BeforeAction)
                    {
                        HandleExportItemSelectAll(form, MtxItem, oDTItemExport);
                    }


                    break;

                case SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED:
                    // handleItemPress(form, pVal);
                    break;
                }
            }
        }
        catch (Exception ex)
        {
            errorLog(ex);
        }
    }
Пример #17
0
 private void mtxCost_ClickBefore(object sboObject, SAPbouiCOM.SBOItemEventArg pVal, out bool BubbleEvent)
 {
     BubbleEvent = true;
     mtxCost.FlushToDataSource();
 }
Пример #18
0
        private void CalcToday()
        {
            mtAnimals.FlushToDataSource();
            double TodayTotal = Convert.ToDouble(dtHead.GetValue("TodayQty", 0));
            double reqQty     = Convert.ToDouble(dtHead.GetValue("reqQty", 0));

            if (TodayTotal < reqQty)
            {
                oApplication.MessageBox("Qty must be greater or equal to special qty");
                dtHead.SetValue("TodayQty", 0, reqQty);
                txQtyT.Active = true;
                return;
            }

            DateTime dtToday = Convert.ToDateTime(dtHead.GetValue("stDate", 0));


            double perTotal = 0.00;

            for (int i = 0; i < Animals.Rows.Count; i++)
            {
                string ItemCode   = Convert.ToString(Animals.GetValue("ItemCode", i));
                double rowPercent = Convert.ToDouble(Animals.GetValue("Per", i));
                //updateMrpPer(ItemCode, rowPercent);
                double QtyAdd = Convert.ToDouble(TodayTotal) * Convert.ToDouble(rowPercent);
                //double SpecialQty = Convert.ToDouble(Animals.GetValue("Special", i));
                //double oldReqPer = Convert.ToDouble(Animals.GetValue("Per", i));

                //if (Math.Round(SpecialQty, 2) > Math.Round(QtyAdd, 2))
                //{
                //    oApplication.MessageBox("For item " + ItemCode + " required percentage is more to get special qty");
                //    Animals.SetValue("QtyAdd", i, SpecialQty.ToString());
                //    double requiredPercent = 100 * (SpecialQty / TodayTotal);
                //    if (oldReqPer < requiredPercent)
                //    {

                //        Animals.SetValue("Per", i, Math.Round(requiredPercent, 3).ToString());
                //        perTotal += requiredPercent;
                //    }

                //}
                //else
                //{

                //    perTotal += oldReqPer;
                //    Animals.SetValue("QtyAdd", i, QtyAdd.ToString());
                //}

                Animals.SetValue("QtyAdd", i, QtyAdd.ToString());
            }

            if (perTotal > 100)
            {
                oApplication.MessageBox("Please adjust % to make it 100% in all without reducing recommended special qty percentage");
            }



            mtAnimals.LoadFromDataSource();
            getReport();
        }
Пример #19
0
        public bool HandleItemEvents(SAPbouiCOM.ItemEvent itemEvent)
        {
            var res = true;

            try
            {
                switch (itemEvent.ItemUID)
                {
                case EDT_COD_VENDEDOR:
                    if (!itemEvent.BeforeAction && itemEvent.EventType == SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST)
                    {
                        var selectedObjects = ((SAPbouiCOM.IChooseFromListEvent)itemEvent).SelectedObjects;

                        if (selectedObjects != null)
                        {
                            dsCabecera.SetValue("Code", 0, selectedObjects.GetValue("SlpCode", 0).ToString().Trim());
                            dsCabecera.SetValue("Name", 0, selectedObjects.GetValue("SlpName", 0).ToString().Trim());

                            if (mForm.Mode == SAPbouiCOM.BoFormMode.fm_OK_MODE)
                            {
                                mForm.Mode = SAPbouiCOM.BoFormMode.fm_UPDATE_MODE;
                            }
                        }
                    }
                    break;

                case MATRIZ_ALMACENES:
                    if (!itemEvent.BeforeAction && itemEvent.EventType == SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST)
                    {
                        var selectedObjects = ((SAPbouiCOM.IChooseFromListEvent)itemEvent).SelectedObjects;

                        if (selectedObjects != null)
                        {
                            dsDetAlmacenes.SetValue("U_MSSM_COD", itemEvent.Row - 1, selectedObjects.GetValue("WhsCode", 0).ToString().Trim());
                            dsDetAlmacenes.SetValue("U_MSSM_NOM", itemEvent.Row - 1, selectedObjects.GetValue("WhsName", 0).ToString().Trim());
                            mtxAlmacenes.LoadFromDataSource();

                            if (mForm.Mode == SAPbouiCOM.BoFormMode.fm_OK_MODE)
                            {
                                mForm.Mode = SAPbouiCOM.BoFormMode.fm_UPDATE_MODE;
                            }
                        }
                    }
                    break;

                case EDT_EQUIPO_ASIGNADO:
                    if (!itemEvent.BeforeAction && itemEvent.EventType == SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST)
                    {
                        var selectedObjects = ((SAPbouiCOM.IChooseFromListEvent)itemEvent).SelectedObjects;

                        if (selectedObjects != null)
                        {
                            dsCabecera.SetValue("U_MSSM_EQP", 0, selectedObjects.GetValue("Code", 0).ToString().Trim());

                            if (mForm.Mode == SAPbouiCOM.BoFormMode.fm_OK_MODE)
                            {
                                mForm.Mode = SAPbouiCOM.BoFormMode.fm_UPDATE_MODE;
                            }
                        }
                    }
                    break;

                case EDT_PROYECTO:
                    if (!itemEvent.BeforeAction && itemEvent.EventType == SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST)
                    {
                        var selectedObjects = ((SAPbouiCOM.IChooseFromListEvent)itemEvent).SelectedObjects;

                        if (selectedObjects != null)
                        {
                            dsCabecera.SetValue("U_MSSM_PRJ", 0, selectedObjects.GetValue("PrjCode", 0).ToString().Trim());

                            if (mForm.Mode == SAPbouiCOM.BoFormMode.fm_OK_MODE)
                            {
                                mForm.Mode = SAPbouiCOM.BoFormMode.fm_UPDATE_MODE;
                            }
                        }
                    }
                    break;

                case EDT_VEHICULO:
                    if (!itemEvent.BeforeAction && itemEvent.EventType == SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST)
                    {
                        var selectedObjects = ((SAPbouiCOM.IChooseFromListEvent)itemEvent).SelectedObjects;

                        if (selectedObjects != null)
                        {
                            dsCabecera.SetValue("U_MSSM_VEH", 0, selectedObjects.GetValue("Code", 0).ToString().Trim());

                            if (mForm.Mode == SAPbouiCOM.BoFormMode.fm_OK_MODE)
                            {
                                mForm.Mode = SAPbouiCOM.BoFormMode.fm_UPDATE_MODE;
                            }
                        }
                    }
                    break;
                //case MATRIZ_GRUPOS_ARTICULOS:
                //    if (!itemEvent.BeforeAction && itemEvent.EventType == SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST)
                //    {
                //        var selectedObjects = ((SAPbouiCOM.IChooseFromListEvent)itemEvent).SelectedObjects;

                //        if (selectedObjects != null)
                //        {
                //            dsDetalle1.SetValue("U_MSSM_COD", itemEvent.Row - 1, selectedObjects.GetValue("ItmsGrpCod", 0).ToString().Trim());
                //            dsDetalle1.SetValue("U_MSSM_NOM", itemEvent.Row - 1, selectedObjects.GetValue("ItmsGrpNam", 0).ToString().Trim());
                //            mtxGruposArticulo.LoadFromDataSource();

                //            if (mForm.Mode == SAPbouiCOM.BoFormMode.fm_OK_MODE)
                //                mForm.Mode = SAPbouiCOM.BoFormMode.fm_UPDATE_MODE;
                //        }
                //    }
                //    break;
                //case MATRIZ_GRUPOS_CLIENTES:
                //    if (!itemEvent.BeforeAction && itemEvent.EventType == SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST)
                //    {
                //        var selectedObjects = ((SAPbouiCOM.IChooseFromListEvent)itemEvent).SelectedObjects;

                //        if (selectedObjects != null)
                //        {
                //            dsDetalle2.SetValue("U_MSSM_COD", itemEvent.Row - 1, selectedObjects.GetValue("GroupCode", 0).ToString().Trim());
                //            dsDetalle2.SetValue("U_MSSM_NOM", itemEvent.Row - 1, selectedObjects.GetValue("GroupName", 0).ToString().Trim());
                //            mtxGruposCliente.LoadFromDataSource();

                //            if (mForm.Mode == SAPbouiCOM.BoFormMode.fm_OK_MODE)
                //                mForm.Mode = SAPbouiCOM.BoFormMode.fm_UPDATE_MODE;
                //        }
                //    }
                //    break;
                case BTN_ADD_ROW_P1:
                    if (!itemEvent.BeforeAction)
                    {
                        dsDetAlmacenes.InsertRecord(dsDetAlmacenes.Size);
                        dsDetAlmacenes.SetValue("U_MSSM_COD", dsDetAlmacenes.Size - 1, string.Empty);
                        dsDetAlmacenes.SetValue("U_MSSM_NOM", dsDetAlmacenes.Size - 1, string.Empty);
                        mtxAlmacenes.LoadFromDataSource();
                    }
                    break;

                //case BTN_ADD_ROW_P2:
                //    if (!itemEvent.BeforeAction)
                //    {
                //        dsDetalle2.InsertRecord(dsDetalle2.Size);
                //        dsDetalle2.SetValue("U_MSSM_COD", dsDetalle2.Size - 1, string.Empty);
                //        dsDetalle2.SetValue("U_MSSM_NOM", dsDetalle2.Size - 1, string.Empty);
                //        mtxGruposCliente.LoadFromDataSource();
                //    }
                //    break;
                //case BTN_ADD_ROW_P3:
                //    if (!itemEvent.BeforeAction)
                //    {
                //        dsDetalle3.InsertRecord(dsDetalle3.Size);
                //        dsDetalle3.SetValue("U_MSSM_COD", dsDetalle3.Size - 1, string.Empty);
                //        dsDetalle3.SetValue("U_MSSM_NOM", dsDetalle3.Size - 1, string.Empty);
                //        mtxGruposZona.LoadFromDataSource();
                //    }
                //    break;
                case BTN_DEL_ROW_P1:
                    if (!itemEvent.BeforeAction)
                    {
                        List <int> indexes = new List <int>();
                        for (int i = 1; i <= mtxAlmacenes.RowCount; i++)
                        {
                            if (mtxAlmacenes.IsRowSelected(i))
                            {
                                indexes.Add(i);
                            }
                        }

                        if (indexes.Count > 0)
                        {
                            int counter = 0;
                            while (counter <= indexes.Count)
                            {
                                for (int i = 1; i <= mtxAlmacenes.RowCount; i++)
                                {
                                    if (mtxAlmacenes.IsRowSelected(i))
                                    {
                                        mtxAlmacenes.DeleteRow(i);
                                        break;
                                    }
                                }

                                counter++;
                            }

                            if (mForm.Mode == SAPbouiCOM.BoFormMode.fm_OK_MODE)
                            {
                                mForm.Mode = SAPbouiCOM.BoFormMode.fm_UPDATE_MODE;
                            }

                            mtxAlmacenes.FlushToDataSource();
                        }
                    }
                    break;
                //case BTN_DEL_ROW_P2:
                //    if (!itemEvent.BeforeAction)
                //    {
                //        List<int> indexes = new List<int>();
                //        for (int i = 1; i <= mtxGruposCliente.RowCount; i++)
                //        {
                //            if (mtxGruposCliente.IsRowSelected(i))
                //                indexes.Add(i);
                //        }

                //        if (indexes.Count > 0)
                //        {
                //            int counter = 0;
                //            while (counter <= indexes.Count)
                //            {
                //                for (int i = 1; i <= mtxGruposCliente.RowCount; i++)
                //                {
                //                    if (mtxGruposCliente.IsRowSelected(i))
                //                    {
                //                        mtxGruposCliente.DeleteRow(i);
                //                        break;
                //                    }
                //                }

                //                counter++;
                //            }

                //            if (mForm.Mode == SAPbouiCOM.BoFormMode.fm_OK_MODE)
                //                mForm.Mode = SAPbouiCOM.BoFormMode.fm_UPDATE_MODE;

                //            mtxGruposCliente.FlushToDataSource();
                //        }
                //    }
                //    break;
                //case BTN_DEL_ROW_P3:
                //    if (!itemEvent.BeforeAction)
                //    {

                //    }
                //    break;
                case BTN_PRINCIPAL:
                    if (itemEvent.BeforeAction && (mForm.Mode == SAPbouiCOM.BoFormMode.fm_UPDATE_MODE || mForm.Mode == SAPbouiCOM.BoFormMode.fm_ADD_MODE))
                    {
                        res = validarObjeto();
                    }
                    break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                StatusMessageError("HandleItemEvents() > " + ex.Message);
            }

            return(res);
        }
Пример #20
0
        private bool RegistrarObjetos()
        {
            var res = true;

            try
            {
                Conexion.company.StartTransaction();

                mtxPrincipal.FlushToDataSource();


                //Recorrer el datasource principal para buscar nuevos registros y actualizar
                for (int i = dsEquipo.Size - 1; i >= 0; i--)
                {
                    var    docEntry    = dsEquipo.GetValue("DocEntry", i);
                    string codigo      = dsEquipo.GetValue("Code", i).Trim();
                    string descripcion = dsEquipo.GetValue("Name", i).Trim();
                    string modelo      = dsEquipo.GetValue("U_MSSM_MOD", i).Trim();
                    string serie       = dsEquipo.GetValue("U_MSSM_SER", i).Trim();
                    string color       = dsEquipo.GetValue("U_MSSM_COL", i).Trim();
                    string codigoUnico = dsEquipo.GetValue("U_MSSM_IDU", i).Trim();
                    string verificarID = dsEquipo.GetValue("U_MSSM_VAL", i).Trim();

                    EquipoBean bean = new EquipoBean()
                    {
                        codigo      = codigo,
                        descripcion = descripcion,
                        modelo      = modelo,
                        serie       = serie,
                        color       = color,
                        codigoUnico = codigoUnico,
                        verificarId = verificarID
                    };

                    if (docEntry != null && !string.IsNullOrEmpty(docEntry.ToString().Trim()))
                    {
                        res = EquipoDAO.actualizar(bean);

                        if (!res)
                        {
                            break;
                        }
                    }
                    else if (!string.IsNullOrEmpty(codigo))
                    {
                        res = EquipoDAO.registrar(bean);

                        if (!res)
                        {
                            break;
                        }
                    }
                }

                if (res)
                {
                    if (Conexion.company.InTransaction)
                    {
                        Conexion.company.EndTransaction(SAPbobsCOM.BoWfTransOpt.wf_Commit);
                    }

                    iniciarValoresPorDefecto();
                }
                else
                {
                    if (Conexion.company.InTransaction)
                    {
                        Conexion.company.EndTransaction(SAPbobsCOM.BoWfTransOpt.wf_RollBack);
                    }
                }
            }
            catch (Exception ex)
            {
                res = false;
                StatusMessageError("RegistrarObjetos() > " + ex.Message);
            }

            return(res);
        }
Пример #21
0
    private void ExportSOFormHandler(SAPbouiCOM.Form form, SAPbouiCOM.ItemEvent pVal)
    {
        try
        {
            theExportSO = form;
            if (pVal.BeforeAction)
            {
                switch (pVal.EventType)
                {
                case SAPbouiCOM.BoEventTypes.et_FORM_LOAD:

                    break;
                }
            }
            else
            {
                switch (pVal.EventType)
                {
                case SAPbouiCOM.BoEventTypes.et_FORM_RESIZE:
                    currentForm = form;
                    //tProcess = new Thread(BPMoveThreadProc);
                    //tProcess.Start();
                    break;

                case SAPbouiCOM.BoEventTypes.et_FORM_LOAD:

                    try
                    {
                        formSelTarget = form;

                        //form.Items.Item(tbeBizCharge).Visible = false;
                        //   bcontrolCreated = false;
                    }
                    catch (Exception ex)
                    {
                        errorLog(ex);
                    }

                    break;

                case SAPbouiCOM.BoEventTypes.et_VALIDATE:


                    break;

                case SAPbouiCOM.BoEventTypes.et_COMBO_SELECT:
                {
                }
                break;

                case SAPbouiCOM.BoEventTypes.et_MATRIX_LINK_PRESSED:
                    try
                    {
                        if (pVal.ItemUID == MtxExportSO & pVal.ColUID == "DocNum")
                        {    //SO
                            SAPbouiCOM.EditText DocNum = (SAPbouiCOM.EditText)oMatrixExportSO.Columns.Item("DocNum").Cells.Item(pVal.Row).Specific;
                            DoOpenLinkedObjectForm("139", "2050", "8", DocNum.Value);
                        }
                        if (pVal.ItemUID == MtxExportSO & pVal.ColUID == "DocEntry")
                        {    //SO
                            SAPbouiCOM.EditText DocEntry = (SAPbouiCOM.EditText)oMatrixExportSO.Columns.Item("DocEntry").Cells.Item(pVal.Row).Specific;
                            var DocNum = getSODocNum(Convert.ToInt32(DocEntry.Value));
                            DoOpenLinkedObjectForm("139", "2050", "8", DocNum);
                        }
                        if (pVal.ItemUID == MtxExportSO & pVal.ColUID == "CardCode")
                        {    //SO
                            SAPbouiCOM.EditText CardCode = (SAPbouiCOM.EditText)oMatrixExportSO.Columns.Item("CardCode").Cells.Item(pVal.Row).Specific;
                            DoOpenLinkedObjectForm("134", "2561", "5", CardCode.Value);
                        }
                    }
                    catch (Exception ex)
                    {
                        var error = ex.Message;
                    }
                    break;

                case SAPbouiCOM.BoEventTypes.et_CLICK:
                    if (pVal.ItemUID == "btnPost")
                    {
                        HandleItemPressIExportSO(form);
                    }
                    if (pVal.ItemUID == "btnsrch")
                    {
                        SearchExportSO(form);
                    }
                    if (pVal.ItemUID == MtxExportSO && pVal.ColUID.Equals("clSel") && pVal.Row == 0 && !pVal.BeforeAction)
                    {
                        HandleExportSOSelectAll(form, MtxExportSO, oDTExportSO);
                    }
                    if (pVal.ItemUID == MtxExportSO)
                    {
                        if (form.Items.Item(MtxExportSO) == null)
                        {
                            return;
                        }

                        oMatrixExportSO.FlushToDataSource();
                    }

                    break;

                case SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED:
                    // handleItemPress(form, pVal);
                    break;
                }
            }
        }
        catch (Exception ex)
        {
            errorLog(ex);
        }
    }
Пример #22
0
        private void SBO_Application_MenuEvent(ref SAPbouiCOM.MenuEvent pVal, out bool BubbleEvent)
        {
            BubbleEvent = true;

            //Matrix de Conferencia de Medicao
            if (pVal.MenuUID == "AddRowMatrixConf" && pVal.BeforeAction == true)
            {
                oNewItem = oForm.Items.Item("Med_Cnf");
                oMatrix = ((SAPbouiCOM.Matrix)(oNewItem.Specific));
                oColumns = oMatrix.Columns;
                int numeroLinhas = oMatrix.RowCount;
                oMatrix.AddRow(1, numeroLinhas + 1);
                ((SAPbouiCOM.EditText)oMatrix.Columns.Item("Med_Cnf_C0").Cells.Item(oMatrix.RowCount).Specific).Value = "";
                //((SAPbouiCOM.EditText)oMatrix.Columns.Item("med_Cnf_C1").Cells.Item(oMatrix.RowCount).Specific).Value = "";
            }

            //Matrix de Conferencia de Avarias
            if (pVal.MenuUID == "AddRowMatrixAvr" && pVal.BeforeAction == true)
            {
                oNewItem = oForm.Items.Item("Ava_Amb");
                oMatrix = ((SAPbouiCOM.Matrix)(oNewItem.Specific));
                oColumns = oMatrix.Columns;
                int numeroLinhas = oMatrix.RowCount;
                oMatrix.AddRow(1, numeroLinhas + 1);
                ((SAPbouiCOM.EditText)oMatrix.Columns.Item("Ava_Amb_C0").Cells.Item(oMatrix.RowCount).Specific).Value = "";
            }

            //Matrix de Conferencia de Avarias
            if (pVal.MenuUID == "AddRowMatrixPend" && pVal.BeforeAction == true)
            {
                oNewItem = oForm.Items.Item("Pen_Amb");
                oMatrix = ((SAPbouiCOM.Matrix)(oNewItem.Specific));
                oColumns = oMatrix.Columns;
                int numeroLinhas = oMatrix.RowCount;
                oMatrix.AddRow(1, numeroLinhas + 1);
                ((SAPbouiCOM.EditText)oMatrix.Columns.Item("Pen_Amb_C0").Cells.Item(oMatrix.RowCount).Specific).Value = "";
            }

            //Matrix de Itens Complementares
            if (pVal.MenuUID == "AddRowMatrixIt" && pVal.BeforeAction == true)
            {
                oNewItem = oForm.Items.Item("Det_Cmp");
                oMatrix = ((SAPbouiCOM.Matrix)(oNewItem.Specific));
                oColumns = oMatrix.Columns;
                int numeroLinhas = oMatrix.RowCount;
                oMatrix.AddRow(1, numeroLinhas + 1);
                ((SAPbouiCOM.EditText)oMatrix.Columns.Item("Cmp_Amb_C0").Cells.Item(oMatrix.RowCount).Specific).Value = "";
                ((SAPbouiCOM.EditText)oMatrix.Columns.Item("Cmp_Amb_C1").Cells.Item(oMatrix.RowCount).Specific).Value = "";
                ((SAPbouiCOM.EditText)oMatrix.Columns.Item("Cmp_Amb_C4").Cells.Item(oMatrix.RowCount).Specific).Value = "0.000000";
                ((SAPbouiCOM.EditText)oMatrix.Columns.Item("Cmp_Amb_C2").Cells.Item(oMatrix.RowCount).Specific).Value = "0.000000";
                ((SAPbouiCOM.EditText)oMatrix.Columns.Item("Cmp_Amb_C6").Cells.Item(oMatrix.RowCount).Specific).Value = "";
                ((SAPbouiCOM.EditText)oMatrix.Columns.Item("Cmp_Amb_C3").Cells.Item(oMatrix.RowCount).Specific).Value = "";
                ((SAPbouiCOM.EditText)oMatrix.Columns.Item("Cmp_Amb_C5").Cells.Item(oMatrix.RowCount).Specific).Value = "";
                ((SAPbouiCOM.EditText)oMatrix.Columns.Item("Cmp_Amb_C7").Cells.Item(oMatrix.RowCount).Specific).Value = "";

                oMatrix.FlushToDataSource();
            }
        }