Пример #1
0
        private static void ButtonAsignar(string formUID, ref ItemEvent oItemEvent, SAPbobsCOM.Company sbo_company, ref Application sbo_application, out bool bBubbleEvent, string sessionId)
        {
            bBubbleEvent = true;

            if (oItemEvent.BeforeAction)
            {
            }

            if (!oItemEvent.BeforeAction)
            {
                var oForm = sbo_application.Forms.Item(formUID);
                if (oItemEvent.EventType == BoEventTypes.et_CLICK)
                {
                    var _Cabecera  = oForm.DataSources.UserDataSources.Item(CommonForms.FormCalidad.UDCab).ValueEx.DeserializeJsonToDynamic();
                    var _vista     = new ServiceLayer.ListadoLotesOrdenFabricacion(int.Parse(_Cabecera.Valor.ToString()), oForm.Title.RemoveParents().Trim());
                    var response   = CommonFunctions.GET(_vista.url, null, "?$filter=Disponible gt 0", sessionId, out _);
                    var _xml       = response.json2xml(CommonForms.FormLotesCalidad.GrdLotes.dt);
                    var oFormLotes = SAPFunctions.LoadFormLotesCalidad(ref sbo_application, _xml) as Form;
                    oFormLotes.DataSources.UserDataSources.Item(CommonForms.FormLotesCalidad.UDFather).ValueEx = formUID;
                }
            }
        }
Пример #2
0
        private static void ButtonPrint(string formUID, ref ItemEvent oItemEvent, SAPbobsCOM.Company sbo_company, ref Application sbo_application, out bool bBubbleEvent, string sessionId)
        {
            bBubbleEvent = true;
            if (oItemEvent.BeforeAction)
            {
            }

            if (!oItemEvent.BeforeAction)
            {
                var oForm = sbo_application.Forms.Item(formUID);
                if (oItemEvent.EventType == BoEventTypes.et_COMBO_SELECT)
                {
                    var objComex = CommonFunctions.GET(ServiceLayer.Embarque, oForm.DataSources.DBDataSources.Item(pluginForm.dbCabecera).GetValue("DocEntry", 0), null, sessionId, out System.Net.HttpStatusCode statusCode).DeserializeJsonObject <Embarque>();

                    if (statusCode == System.Net.HttpStatusCode.OK)
                    {
                        switch (int.Parse(((ButtonCombo)(oForm.Items.Item(pluginForm.ButtonPrint).Specific)).Caption))
                        {
                        case 1:
                            SAPFunctions.PrintAduana(objComex, sessionId, sbo_company);
                            break;

                        case 2:
                            SAPFunctions.PrintTransporte(objComex, sessionId, sbo_company);
                            break;

                        case 3:
                            throw new Exception("No habilitado");
                        }
                    }
                    else
                    {
                        throw new Exception("Documento no encontrado");
                    }
                }
                //((ButtonCombo)(oForm.Items.Item(pluginForm.ButtonPrint).Specific)).Caption = "Imprimir";
            }
        }
Пример #3
0
        private static void TxtCardCodeNav(string formUID, ref ItemEvent oItemEvent, SAPbobsCOM.Company sbo_company, ref Application sbo_application, out bool bBubbleEvent, string sessionId)
        {
            bBubbleEvent = true;

            if (oItemEvent.BeforeAction)
            {
            }

            if (!oItemEvent.BeforeAction)
            {
                var oForm = sbo_application.Forms.Item(formUID);

                if (oItemEvent.EventType == BoEventTypes.et_CHOOSE_FROM_LIST)
                {
                    var oDT = SAPFunctions.ChooseFromListEvent(oItemEvent) as DataTable;
                    if (oDT != null)
                    {
                        oForm.DataSources.DBDataSources.Item(pluginForm.dbCabecera).SetValue(pluginForm.TxtCardCodeNav.dbField, 0, oDT.GetValue("CardCode", 0).ToString());
                        oForm.DataSources.DBDataSources.Item(pluginForm.dbCabecera).SetValue(pluginForm.TxtCardNameNav.dbField, 0, oDT.GetValue("CardName", 0).ToString());
                    }
                }
            }
        }
Пример #4
0
        private static void ButtonAddOVs(string formUID, ref ItemEvent oItemEvent, SAPbobsCOM.Company sbo_company, ref Application sbo_application, out bool bBubbleEvent, string sessionId)
        {
            bBubbleEvent = true;

            if (oItemEvent.BeforeAction)
            {
            }

            if (!oItemEvent.BeforeAction)
            {
                var oForm = sbo_application.Forms.Item(formUID);
                if (oItemEvent.EventType == BoEventTypes.et_CHOOSE_FROM_LIST)
                {
                    try
                    {
                        var oDT = SAPFunctions.ChooseFromListEvent(oItemEvent) as DataTable;
                        if (oDT != null)
                        {
                            //((Matrix)oForm.Items.Item(pluginForm.MtxOV.Uid).Specific).Clear();
                            DBDataSource det      = oForm.DataSources.DBDataSources.Item(pluginForm.dbDetalle);
                            var          rs       = sbo_company.GetBusinessObject(BoObjectTypes.BoRecordset) as Recordset;
                            string       CardCode = string.Empty;
                            string       sql;

                            for (int i = 0; i < oDT.Rows.Count; i++)
                            {
                                var   DocEntry = oDT.GetValue("DocEntry", i).ToString();
                                Order oNv      = CommonFunctions.GET(ServiceLayer.Orders, DocEntry, null, sessionId, out _).DeserializeJsonObject <Order>();

                                oForm.DataSources.DBDataSources.Item(pluginForm.dbCabecera).SetValue("U_DirFact", 0, $"{oNv.PayToCode} \r\n{oDT.GetValue("Address", i)}");
                                oForm.DataSources.DBDataSources.Item(pluginForm.dbCabecera).SetValue("U_DirDesp", 0, $"{oNv.ShipToCode} \r\n{oDT.GetValue("Address2", i)}");
                                oForm.DataSources.DBDataSources.Item(pluginForm.dbCabecera).SetValue("U_Destino", 0, $"{oNv.U_DTE_IdAdicPtoDesemb}");

                                foreach (var item in oNv.DocumentLines)
                                {
                                    int offset = det.Size;
                                    det.InsertRecord(offset);
                                    det.SetValue(pluginForm.MtxOV.Columns.Col_OvDocEntry.dbField, offset, oDT.GetValue("DocEntry", i).ToString());
                                    det.SetValue(pluginForm.MtxOV.Columns.Col_OvDocNum.dbField, offset, oDT.GetValue("DocNum", i).ToString());
                                    det.SetValue(pluginForm.MtxOV.Columns.Col_OvCardCode.dbField, offset, oDT.GetValue("CardCode", i).ToString());
                                    det.SetValue(pluginForm.MtxOV.Columns.Col_OvCardName.dbField, offset, oDT.GetValue("CardName", i).ToString());
                                    //det.SetValue(pluginForm.MtxOV.Columns.Col_OvDestino.dbField, offset, (string.IsNullOrEmpty(oDT.GetValue("U_DTE_IdAdicPtoDesemb", i).ToString())) ? "" : oDT.GetValue("U_DTE_IdAdicPtoDesemb", i).ToString()); //"");
                                    det.SetValue(pluginForm.MtxOV.Columns.Col_OvATA.dbField, offset, "");
                                    //det.SetValue(pluginForm.MtxOV.Columns.Col_Planta.dbField, offset, string.IsNullOrEmpty(oDT.GetValue("U_DFO_Planta", i).ToString()) ? "": oDT.GetValue("U_DFO_Planta", i).ToString());
                                    det.SetValue(pluginForm.MtxOV.Columns.Col_Planta.dbField, offset, item.WarehouseCode);
                                    //det.SetValue(pluginForm.MtxOV.Columns.Col_FechaPlanta.dbField, offset, (string.IsNullOrEmpty(oDT.GetValue("U_DFO_PlantaDate", i).ToString()))? "": DateTime.Parse(oDT.GetValue("U_DFO_PlantaDate", i).ToString()).ToString("yyyyMMdd"));
                                    det.SetValue(pluginForm.MtxOV.Columns.Col_HoraPlanta.dbField, offset, oDT.GetValue("U_DFO_PlantaHour", i).ToString());
                                    //det.SetValue(pluginForm.MtxOV.Columns.Col_FechaSAG.dbField, offset, (string.IsNullOrEmpty(oDT.GetValue("U_DFO_SAGDate", i).ToString())) ? "" : DateTime.Parse(oDT.GetValue("U_DFO_SAGDate", i).ToString()).ToString("yyyyMMdd"));
                                    det.SetValue(pluginForm.MtxOV.Columns.Col_HoraSAG.dbField, offset, oDT.GetValue("U_DFO_SAGHour", i).ToString());
                                    det.SetValue(pluginForm.MtxOV.Columns.Col_ItemCode.dbField, offset, item.ItemCode);
                                    det.SetValue(pluginForm.MtxOV.Columns.Col_ItemName.dbField, offset, item.ItemDescription);
                                    det.SetValue(pluginForm.MtxOV.Columns.Col_Qty.dbField, offset, item.Quantity.GetStringFromDouble(2));
                                    det.SetValue(pluginForm.MtxOV.Columns.Col_Price.dbField, offset, item.Price);
                                    det.SetValue(pluginForm.MtxOV.Columns.Col_Variedad.dbField, offset, item.U_FRU_Variedad);
                                    det.SetValue(pluginForm.MtxOV.Columns.Col_Tipo.dbField, offset, item.U_FRU_Tipo);
                                    det.SetValue(pluginForm.MtxOV.Columns.Col_Calibre.dbField, offset, item.U_FRU_Calibre);
                                    det.SetValue(pluginForm.MtxOV.Columns.Col_Color.dbField, offset, item.U_FRU_Color);
                                    //det.SetValue(pluginForm.MtxOV.Columns.Col_Conteo.dbField, offset, item.U_FRU_Conteo);
                                    det.SetValue(pluginForm.MtxOV.Columns.Col_Caracteristica.dbField, offset, item.U_FRU_Caracteristica);
                                    det.SetValue(pluginForm.MtxOV.Columns.Col_DescCli.dbField, offset, item.U_FRU_DescripcionCliente);
                                    det.SetValue(pluginForm.MtxOV.Columns.Col_DescPlanta.dbField, offset, item.U_FRU_DescripcionAduana);
                                    det.SetValue(pluginForm.MtxOV.Columns.Col_BaseLine.dbField, offset, item.LineNum.ToString());
                                    det.SetValue(pluginForm.MtxOV.Columns.Col_Pedido.dbField, offset, oDT.GetValue("NumAtCard", i).ToString());
                                    CardCode = oDT.GetValue("CardCode", i).ToString();
                                }
                            }

                            sql = $"select top 1 \"U_NotD1\", \"U_NotD2\", \"U_NotD3\", \"U_NotD4\", \"U_NotD5\", \"U_NotD6\", \"U_NotD7\", \"U_Not2D1\", \"U_Not2D2\", \"U_Not2D3\", \"U_Not2D4\", \"U_Not2D5\", \"U_Not2D6\", \"U_Not2D7\", \"U_Notif1\", \"U_Notif2\" from \"@DFO_OEMB\" where \"DocEntry\" = (select max(\"DocEntry\") from \"@DFO_EMB1\" where \"U_CardCode\"='{CardCode}') ";
                            rs.DoQuery(sql);

                            if (rs.RecordCount != 0)
                            {
                                oForm.DataSources.DBDataSources.Item(pluginForm.dbCabecera).SetValue("U_NotD1", 0, rs.Fields.Item(0).Value.ToString());
                                oForm.DataSources.DBDataSources.Item(pluginForm.dbCabecera).SetValue("U_NotD2", 0, rs.Fields.Item(1).Value.ToString());
                                oForm.DataSources.DBDataSources.Item(pluginForm.dbCabecera).SetValue("U_NotD3", 0, rs.Fields.Item(2).Value.ToString());
                                oForm.DataSources.DBDataSources.Item(pluginForm.dbCabecera).SetValue("U_NotD4", 0, rs.Fields.Item(3).Value.ToString());
                                oForm.DataSources.DBDataSources.Item(pluginForm.dbCabecera).SetValue("U_NotD5", 0, rs.Fields.Item(4).Value.ToString());
                                oForm.DataSources.DBDataSources.Item(pluginForm.dbCabecera).SetValue("U_NotD6", 0, rs.Fields.Item(5).Value.ToString());
                                oForm.DataSources.DBDataSources.Item(pluginForm.dbCabecera).SetValue("U_NotD7", 0, rs.Fields.Item(6).Value.ToString());

                                oForm.DataSources.DBDataSources.Item(pluginForm.dbCabecera).SetValue("U_Not2D1", 0, rs.Fields.Item(7).Value.ToString());
                                oForm.DataSources.DBDataSources.Item(pluginForm.dbCabecera).SetValue("U_Not2D2", 0, rs.Fields.Item(8).Value.ToString());
                                oForm.DataSources.DBDataSources.Item(pluginForm.dbCabecera).SetValue("U_Not2D3", 0, rs.Fields.Item(9).Value.ToString());
                                oForm.DataSources.DBDataSources.Item(pluginForm.dbCabecera).SetValue("U_Not2D4", 0, rs.Fields.Item(10).Value.ToString());
                                oForm.DataSources.DBDataSources.Item(pluginForm.dbCabecera).SetValue("U_Not2D5", 0, rs.Fields.Item(11).Value.ToString());
                                oForm.DataSources.DBDataSources.Item(pluginForm.dbCabecera).SetValue("U_Not2D6", 0, rs.Fields.Item(12).Value.ToString());
                                oForm.DataSources.DBDataSources.Item(pluginForm.dbCabecera).SetValue("U_Not2D7", 0, rs.Fields.Item(13).Value.ToString());

                                oForm.DataSources.DBDataSources.Item(pluginForm.dbCabecera).SetValue("U_Notif1", 0, rs.Fields.Item(14).Value.ToString());
                                oForm.DataSources.DBDataSources.Item(pluginForm.dbCabecera).SetValue("U_Notif2", 0, rs.Fields.Item(15).Value.ToString());
                            }
                        }
                    }
                    catch { throw; }
                    finally
                    {
                        ((Matrix)oForm.Items.Item(pluginForm.MtxOV.Uid).Specific).LoadFromDataSourceEx();
                        ((Matrix)oForm.Items.Item(pluginForm.MtxOV.Uid).Specific).AutoResizeColumns();
                    }
                }

                if (oForm.Mode == BoFormMode.fm_OK_MODE)
                {
                    oForm.Mode = BoFormMode.fm_UPDATE_MODE;
                }
            }
        }
Пример #5
0
        private static void TxtNroOrden(string formUID, ref ItemEvent oItemEvent, SAPbobsCOM.Company sbo_company, ref Application sbo_application, out bool bBubbleEvent, string sessionId)
        {
            Form oForm = sbo_application.Forms.Item(formUID);

            if (oItemEvent.BeforeAction)
            {
                if (oItemEvent.EventType == BoEventTypes.et_CHOOSE_FROM_LIST)
                {
                    ((EditText)oForm.Items.Item(pluginForm.TxtNroLote.Uid).Specific).Item.Click();
                }
            }

            bBubbleEvent = true;
            if (!oItemEvent.BeforeAction)
            {
                if (oItemEvent.EventType == BoEventTypes.et_CHOOSE_FROM_LIST)
                {
                    var oDT = SAPFunctions.ChooseFromListEvent(oItemEvent) as DataTable;
                    if (oDT != null)
                    {
                        oForm.DataSources.UserDataSources.Item(pluginForm.TxtNroOrden.Uds).ValueEx = oDT.GetValue("DocNum", 0).ToString();

                        valores.NroOF = oDT.GetValue("DocEntry", 0).ToString();

                        SAPbobsCOM.Recordset oRS = (SAPbobsCOM.Recordset)sbo_company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
                        string sSql = "SELECT  T0.\"ItemCode\",T0.\"ProdName\", " +
                                      "T0.\"PlannedQty\", T0.\"OriginNum\",  T0.\"OriginAbs\", T0.\"PostDate\", T0.\"DueDate\",T0.\"CardCode\" " +
                                      "FROM OWOR T0  " +
                                      "WHERE T0.\"DocEntry\" = '" + oDT.GetValue("DocEntry", 0).ToString() + "' ";
                        oRS.DoQuery(sSql);
                        if (oRS.RecordCount != 0)
                        {
                            EditText TxtForm = (EditText)oForm.Items.Item(pluginForm.TxtItemCode.Uid).Specific;
                            TxtForm.Value = oRS.Fields.Item("ItemCode").Value.ToString();

                            TxtForm       = (EditText)oForm.Items.Item(pluginForm.TxtItemName.Uid).Specific;
                            TxtForm.Value = oRS.Fields.Item("ProdName").Value.ToString();

                            TxtForm       = (EditText)oForm.Items.Item(pluginForm.TxtCantPlan.Uid).Specific;
                            TxtForm.Value = oRS.Fields.Item("PlannedQty").Value.ToString();

                            TxtForm       = (EditText)oForm.Items.Item(pluginForm.TxtNroOc.Uid).Specific;
                            TxtForm.Value = oRS.Fields.Item("OriginNum").Value.ToString();

                            TxtForm       = (EditText)oForm.Items.Item(pluginForm.TxtFecCreac.Uid).Specific;
                            TxtForm.Value = oRS.Fields.Item("PostDate").Value.ToString();

                            TxtForm       = (EditText)oForm.Items.Item(pluginForm.TxtFecPlanf.Uid).Specific;
                            TxtForm.Value = oRS.Fields.Item("DueDate").Value.ToString();

                            TxtForm       = (EditText)oForm.Items.Item(pluginForm.TxtCardCode.Uid).Specific;
                            TxtForm.Value = oRS.Fields.Item("CardCode").Value.ToString();

                            valores.NroOC    = oRS.Fields.Item("OriginAbs").Value.ToString();
                            valores.CardCode = oRS.Fields.Item("CardCode").Value.ToString();

                            EditText OF = (EditText)oForm.Items.Item("OF").Specific;
                            OF.Value = valores.NroOF;

                            EditText OV = (EditText)oForm.Items.Item("OV").Specific;
                            OV.Value = valores.NroOC;

                            //Linked = (SAPbouiCOM.LinkedButton)oForm.Items.Item(pluginForm.LinkedOV).Specific;
                            //Linked.Item.LinkTo = pluginForm.TxtNroOc.Uid;
                            //Linked.LinkedObject = BoLinkedObject.lf_Order;

                            //Linked = (SAPbouiCOM.LinkedButton)oForm.Items.Item(pluginForm.LinkedCardCode).Specific;
                            //Linked.Item.LinkTo = pluginForm.TxtCardCode.Uid; ;
                            //Linked.LinkedObject = BoLinkedObject.lf_BusinessPartner;

                            Grid      grid = (Grid)oForm.Items.Item(pluginForm.GridConsumo.Uid).Specific;
                            DataTable oDT1 = grid.DataTable;
                            oDT1.Clear();

                            sSql = "SELECT  T0.\"DocEntry\",T0.\"DocNum\", T1.\"DocDate\", T0.\"DocTime\", " +
                                   "T1.\"ItemCode\", T1.\"Dscription\", T1.\"LineStatus\", T1.\"Quantity\",T1.\"WhsCode\" " +
                                   "FROM OIGE T0 INNER JOIN IGE1 T1 ON T0.\"DocEntry\" = T1.\"DocEntry\" " +
                                   "WHERE T1.\"BaseEntry\" = '" + oDT.GetValue("DocEntry", 0).ToString() + "' order by T0.\"DocEntry\" desc ";

                            oDT1.ExecuteQuery(sSql);
                            EditTextColumn oColumns = (EditTextColumn)grid.Columns.Item("DocEntry");
                            oColumns.Description      = "N° Consumo";
                            oColumns.LinkedObjectType = "60";

                            for (int i = 0; i < grid.Columns.Count; i++)
                            {
                                try
                                {
                                    grid.Columns.Item(i).Editable = false;
                                }
                                catch (Exception e)
                                {
                                    throw new Exception(string.Format("FormLoad {0}", e.Message));
                                }
                            }

                            if (grid.Rows.Count > 0)
                            {
                                string DocEntryOIGE = grid.DataTable.GetValue("DocEntry", 0).ToString();
                                sSql = "select T0.\"DocEntry\",T0.\"DocNum\",T5.\"CardCode\" as CardCode,T1.\"Quantity\",T1.\"ItemCode\",T3.\"ALLOCQTY\" as BatchSerialQty, " +
                                       "T4.\"DistNumber\" as BatchorSerialNum,T4.\"SysNumber\" from OIGE T0 inner join IGE1 T1 on T0.\"DocEntry\" = T1.\"DocEntry\" " +
                                       "inner join OITM T2 on T1.\"ItemCode\" = T2.\"ItemCode\" " +
                                       "inner join(select S0.\"DocEntry\", S0.\"DocLine\", S1.\"SysNumber\", -sum(S1.\"Quantity\") as AllocQty " +
                                       "from OITL S0 inner join ITL1 S1 on S0.\"LogEntry\" = S1.\"LogEntry\" where S0.\"DocType\" = 60 group by S0.\"DocEntry\", " +
                                       "S0.\"DocLine\", S1.\"SysNumber\") T3 on T1.\"DocEntry\" = T3.\"DocEntry\" and T1.\"LineNum\" = T3.\"DocLine\" " +
                                       "inner join OBTN T4 on T3.\"SysNumber\" = T4.\"SysNumber\" and T1.\"ItemCode\" = T4.\"ItemCode\" " +
                                       "inner join OWOR T5 on T1.\"BaseEntry\" = T5.\"DocEntry\" " +
                                       "where T1.\"BaseType\" = 202 and T1.\"BaseEntry\" = '" + oDT.GetValue("DocEntry", 0).ToString() + "' and T0.\"DocEntry\" " +
                                       "= '" + DocEntryOIGE + "'  ";

                                //SAPbobsCOM.Recordset oRS = (SAPbobsCOM.Recordset)sbo_company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
                                oRS.DoQuery(sSql);
                                if (oRS.RecordCount == 1)
                                {
                                    string lote  = oRS.Fields.Item("BatchorSerialNum").Value.ToString();
                                    var    batch = CommonFunctions.DeserializeJsonObject <BatchNumberDetails>(CommonFunctions.GET(ServiceLayer.BatchNumberDetails, null, $"?$filter=Batch eq '{lote}'", sessionId, out _));

                                    StaticText StaticLote = (StaticText)oForm.Items.Item(pluginForm.StaticLote).Specific;
                                    StaticLote.Caption = lote;
                                    StaticText StaticCons = (StaticText)oForm.Items.Item(pluginForm.StaticCons).Specific;
                                    StaticCons.Caption = batch.U_FRU_CantBinsVol.ToString();
                                    StaticText StaticDisp = (StaticText)oForm.Items.Item(pluginForm.StaticDisp).Specific;
                                    StaticDisp.Caption = batch.U_FRU_CantBinsDis.ToString();
                                }
                                if (oRS.RecordCount == 0)
                                {
                                    StaticText StaticLote = (StaticText)oForm.Items.Item(pluginForm.StaticLote).Specific;
                                    StaticLote.Caption = "";
                                    StaticText StaticCons = (StaticText)oForm.Items.Item(pluginForm.StaticCons).Specific;
                                    StaticCons.Caption = "";
                                    StaticText StaticDisp = (StaticText)oForm.Items.Item(pluginForm.StaticDisp).Specific;
                                    StaticDisp.Caption = "";
                                }
                            }

                            //SAPbouiCOM.DataTable oDTgrid = oForm.DataSources.DataTables.Add(pluginForm.GridConsumo.Dt);
                            //SAPbouiCOM.Grid grid = (SAPbouiCOM.Grid)oForm.Items.Item(pluginForm.GridConsumo.Uid).Specific;
                            //grid.DataTable = oDTgrid;
                            //oDTgrid.Clear();

                            //SELECT "ItemCode", "Dscription", "Quantity" from IGE1 where "BaseType" = '202' and "BaseEntry" = 75

                            //sSql = "SELECT  T0.\"ItemCode\",T0.\"Dscription\",T0.\"Quantity\" " +
                            //    "FROM IGE1 T0 INNER JOIN IGE1 T1 ON T0.\"DocEntry\" = T1.\"DocEntry\" " +
                            //    "WHERE T1.\"BaseEntry\" = '" + oDT.GetValue("DocEntry", 0).ToString() + "' ";
                            //oDTgrid.ExecuteQuery(sSql);

                            int cantbins = 0;
                            cantbins = grid.DataTable.Rows.Count;
                            StaticText StaticTotBins = (StaticText)oForm.Items.Item(pluginForm.StaticTotBins).Specific;
                            StaticTotBins.Caption = cantbins.ToString();

                            double kgConsumido = 0;
                            for (int i = 0; i < grid.Rows.Count; i++)
                            {
                                kgConsumido = kgConsumido + double.Parse(grid.DataTable.GetValue("Quantity", i).ToString().Replace(".", ","));
                            }

                            StaticText StaticKgBins = (StaticText)oForm.Items.Item(pluginForm.StaticKgBins).Specific;
                            StaticKgBins.Caption = kgConsumido.ToString();



                            grid.Item.AffectsFormMode = false;
                        }
                    }
                }
            }
        }
Пример #6
0
        private static void ButtonFumigar(string formUID, ref ItemEvent oItemEvent, SAPbobsCOM.Company sbo_company, ref Application sbo_application, out bool bBubbleEvent, string sessionId)
        {
            //throw new NotImplementedException();
            bBubbleEvent = true;
            if (oItemEvent.BeforeAction)
            {
                if (oItemEvent.EventType == BoEventTypes.et_CLICK)
                {
                    var oForm = sbo_application.Forms.Item(formUID);
                    if (oForm.Mode != BoFormMode.fm_OK_MODE)
                    {
                        bBubbleEvent = false;
                        if (oForm.Mode == BoFormMode.fm_ADD_MODE)
                        {
                            throw new Exception("Debe crear el documento antes");
                        }

                        if (oForm.Mode == BoFormMode.fm_UPDATE_MODE)
                        {
                            throw new Exception("Debe grabar los cambios antes");
                        }

                        if (oForm.Mode == BoFormMode.fm_FIND_MODE)
                        {
                            throw new Exception("Debe buscar un registro antes");
                        }
                    }
                }
            }

            if (!oItemEvent.BeforeAction)
            {
                if (oItemEvent.EventType == BoEventTypes.et_CLICK)
                {
                    var oForm = sbo_application.Forms.Item(formUID);
                    var Doc   = CommonFunctions.GET(ServiceLayer.StockTransfers, oForm.DataSources.DBDataSources.Item(pluginForm.dbCabecera).GetValue("DocEntry", 0), null, sessionId, out _).DeserializeJsonObject <StockTransfer>();

                    var lotes = new List <RegistroCalidad_Lotes>();

                    foreach (var line in Doc.StockTransferLines)
                    {
                        foreach (var lote in line.BatchNumbers)
                        {
                            var loteCalidad = new RegistroCalidad_Lotes
                            {
                                DocEntry   = null,
                                LineId     = null,
                                U_BatchNum = lote.BatchNumber,
                                U_Kg       = lote.Quantity
                            };

                            lotes.Add(loteCalidad);
                        }
                    }

                    dynamic Cabecera = new System.Dynamic.ExpandoObject();

                    Cabecera.Tipo  = "67";
                    Cabecera.Valor = Doc.DocNum;
                    Cabecera.Lote  = lotes.SerializeJson();

                    var Fruta = oForm.DataSources.DBDataSources.Item("WTR1").GetValue("Dscription", 0);

                    if (Fruta.Contains("Pasa"))
                    {
                        var oFormCalidad = SAPFunctions.LoadFormCalidad(ref sbo_application, "PASA-20016-RG-6.1.1", sessionId, Cabecera);
                    }
                    if (Fruta.Contains("Cir"))
                    {
                        var oFormCalidad = SAPFunctions.LoadFormCalidad(ref sbo_application, "CIRUELA-GRAL-RG-6.1.1", sessionId, Cabecera);
                    }
                    if (Fruta.Contains("Nue"))
                    {
                        var oFormCalidad = SAPFunctions.LoadFormCalidad(ref sbo_application, "CIRUELA-GRAL-RG-6.1.1", sessionId, Cabecera);
                    }
                }
            }
        }