示例#1
0
        /// <summary>
        /// Clear Data and Load Data Source
        /// </summary>
        private void Template_Clear_FixDisc(ref Form oForm)
        {
            DBDataSource fixDisc_H  = oForm.DataSources.DBDataSources.Item("@SOL_FIXDISC_H");
            DBDataSource fixDisc_D1 = oForm.DataSources.DBDataSources.Item("@SOL_FIXDISC_D1");
            DBDataSource fixDisc_D2 = oForm.DataSources.DBDataSources.Item("@SOL_FIXDISC_D2");

            fixDisc_H.SetValue("Code", 0, "");
            fixDisc_H.SetValue("U_SOL_AREA", 0, "");
            fixDisc_H.SetValue("U_SOL_CARDCODE", 0, "");
            fixDisc_H.SetValue("U_SOL_CARDNAME", 0, "");

            fixDisc_D1.Clear(); fixDisc_D1.Clear();

            fixDisc_D1.InsertRecord(fixDisc_D1.Size);
            fixDisc_D2.InsertRecord(fixDisc_D2.Size);

            fixDisc_D1.Offset = fixDisc_D1.Size - 1;
            fixDisc_D1.SetValue("LineId", fixDisc_D1.Size - 1, fixDisc_D1.Size.ToString());
            fixDisc_D2.Offset = fixDisc_D2.Size - 1;
            fixDisc_D2.SetValue("LineId", fixDisc_D2.Size - 1, fixDisc_D2.Size.ToString());

            oForm.Items.Item("mt_1").Specific.LoadFromDataSource();
            oForm.Items.Item("mt_2").Specific.LoadFromDataSource();

            Utils.releaseObject(fixDisc_H);
            Utils.releaseObject(fixDisc_D1);
            Utils.releaseObject(fixDisc_D2);
        }
        private void TemplateLoad(ref Form oForm)
        {
            try
            {
                DBDataSource dtSource = null;
                dtSource = oForm.DataSources.DBDataSources.Item("@SOL_UPBOMVER_H");
                oForm.Freeze(true);

                DateTime updDate = DateTime.Now.Date;
                string   updTime = DateTime.Now.TimeOfDay.ToString();
                GetLastUpdate(out updDate, out updTime);

                dtSource.SetValue("U_SOL_UPDATE", 0, updDate.ToString("yyyyMMdd", CultureInfo.InvariantCulture));
                dtSource.SetValue("U_SOL_UPTIME", 0, updTime);

                EditText oEdit = oForm.Items.Item("tEdit").Specific;
                oEdit.Active = true;

                oForm.Items.Item("tUpDt").Enabled = false;
                oForm.Items.Item("tUpTm").Enabled = false;

                Utils.releaseObject(dtSource);
            }
            catch (Exception ex)
            {
                oSBOApplication.MessageBox(ex.Message);
            }
            finally
            {
                oForm.Freeze(false);
            }
        }
示例#3
0
        /// <summary>
        /// Validate - Brand Code
        /// Ketika Brand Code Dipilih, Brand Name terisi otomatis
        /// </summary>
        private void Validate_FixDisc_BrandCode(string formUID, ref ItemEvent pVal, ref bool bubbleEvent)
        {
            if (bubbleEvent)
            {
                if (pVal.BeforeAction == false && pVal.ActionSuccess == true && pVal.ItemChanged == true)
                {
                    Form         oForm    = oSBOApplication.Forms.Item(formUID);
                    Matrix       oMtx     = oForm.Items.Item("mt_1").Specific;
                    DBDataSource dtSource = oForm.DataSources.DBDataSources.Item("@SOL_FIXDISC_D1");
                    Recordset    oRec     = oSBOCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);

                    try
                    {
                        oForm.Freeze(true);
                        oMtx.FlushToDataSource();

                        if (pVal.Row == oMtx.RowCount)
                        {
                            dtSource.InsertRecord(dtSource.Size);
                            dtSource.SetValue("LineId", dtSource.Size - 1, dtSource.Size.ToString());
                        }

                        string nama      = string.Empty;
                        string brandCode = oMtx.Columns.Item("cBrCd").Cells.Item(pVal.Row).Specific.Value;
                        string query     = "SELECT T1.\"U_SOL_SUBGRP\" "
                                           + "FROM \"@SOL_ITMGRP_MAP_H\" T0 "
                                           + "INNER JOIN \"@SOL_ITMGRP_MAP_D\" T1 ON T0.\"Code\" = T1.\"Code\" "
                                           + "WHERE T1.\"U_SOL_SUBGRP_CODE\" = '" + brandCode + "'";

                        oRec.DoQuery(query);
                        if (oRec.RecordCount > 0)
                        {
                            nama = oRec.Fields.Item(0).Value;
                        }

                        dtSource.SetValue("U_SOL_BRANDNAME", pVal.Row - 1, nama);

                        oMtx.LoadFromDataSource();
                    }
                    catch (Exception ex)
                    {
                        bubbleEvent = false;
                        oSBOApplication.MessageBox(ex.Message);
                    }
                    finally
                    {
                        if (oForm != null)
                        {
                            oForm.Freeze(false);
                        }

                        Utils.releaseObject(oForm);
                        Utils.releaseObject(oMtx);
                        Utils.releaseObject(dtSource);
                        Utils.releaseObject(oRec);
                    }
                }
            }
        }
示例#4
0
        /// <summary>
        /// Validate - Item Code
        /// Ketika Item Code Dipilih, Item Name terisi otomatis
        /// </summary>
        private void Validate_FixDisc_ItemCode(string formUID, ref ItemEvent pVal, ref bool bubbleEvent)
        {
            if (bubbleEvent)
            {
                if (pVal.BeforeAction == false && pVal.ActionSuccess == true && pVal.ItemChanged == true)
                {
                    Form         oForm    = oSBOApplication.Forms.Item(formUID);
                    Matrix       oMtx     = oForm.Items.Item("mt_2").Specific;
                    DBDataSource dtSource = oForm.DataSources.DBDataSources.Item("@SOL_FIXDISC_D2");
                    Recordset    oRec     = oSBOCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);

                    try
                    {
                        oForm.Freeze(true);
                        oMtx.FlushToDataSource();

                        if (pVal.Row == oMtx.RowCount)
                        {
                            dtSource.InsertRecord(dtSource.Size);
                            dtSource.SetValue("LineId", dtSource.Size - 1, dtSource.Size.ToString());
                        }

                        string nama = string.Empty;
                        oRec.DoQuery("SELECT \"ItemName\" FROM OITM WHERE \"ItemCode\" = '"
                                     + oMtx.Columns.Item("cItmCd").Cells.Item(pVal.Row).Specific.Value + "'");

                        if (oRec.RecordCount > 0)
                        {
                            nama = oRec.Fields.Item(0).Value;
                        }

                        dtSource.SetValue("U_SOL_ITEMNAME", pVal.Row - 1, nama);

                        oMtx.LoadFromDataSource();
                    }
                    catch (Exception ex)
                    {
                        bubbleEvent = false;
                        oSBOApplication.MessageBox(ex.Message);
                    }
                    finally
                    {
                        if (oForm != null)
                        {
                            oForm.Freeze(false);
                        }

                        Utils.releaseObject(oForm);
                        Utils.releaseObject(oMtx);
                        Utils.releaseObject(dtSource);
                        Utils.releaseObject(oRec);
                    }
                }
            }
        }
        /// <summary>
        /// Validate customer code - nomor memo
        /// </summary>
        private void Validate_CashDisc_CustCode(string formUID, ref ItemEvent pVal, ref bool bubbleEvent)
        {
            if (bubbleEvent)
            {
                if (pVal.BeforeAction == false && pVal.ActionSuccess == true && pVal.ItemChanged == true)
                {
                    Form         oForm    = oSBOApplication.Forms.Item(formUID);
                    DBDataSource dtSource = oForm.DataSources.DBDataSources.Item("@SOL_CASHDISC");
                    Recordset    oRec     = oSBOCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);

                    try
                    {
                        oForm.Freeze(true);
                        string noMemo = GenerateNoMemo(oForm.Items.Item("tCusCd").Specific.Value);
                        dtSource.SetValue("Code", 0, noMemo);
                    }
                    catch (Exception ex)
                    {
                        bubbleEvent = false;
                        oSBOApplication.MessageBox(ex.Message);
                    }
                    finally
                    {
                        if (oForm != null)
                        {
                            oForm.Freeze(false);
                        }

                        Utils.releaseObject(oForm);
                        Utils.releaseObject(dtSource);
                        Utils.releaseObject(oRec);
                    }
                }
            }
        }
示例#6
0
 /// <summary>
 /// Sets the specified column identifier.
 /// </summary>
 /// <param name="source">The source.</param>
 /// <param name="columnId">The column identifier.</param>
 /// <param name="rowIndex">Index of the row.</param>
 /// <param name="value">The value.</param>
 public static void Set(this DBDataSource source, string columnId, int rowIndex, double?value)
 {
     if (value != null)
     {
         source.SetValue(columnId, rowIndex, ((double)value).ToString(CultureInfo.InvariantCulture));
     }
 }
示例#7
0
 /// <summary>
 /// Sets the specified column identifier.
 /// </summary>
 /// <param name="source">The source.</param>
 /// <param name="columnId">The column identifier.</param>
 /// <param name="rowIndex">Index of the row.</param>
 /// <param name="value">The value.</param>
 public static void Set(this DBDataSource source, string columnId, int rowIndex, DateTime?value)
 {
     if (value != null)
     {
         source.SetValue(columnId, rowIndex, ((DateTime)value).ToString("yyyyMMdd"));
     }
 }
示例#8
0
 /// <summary>
 /// Sets the specified column identifier.
 /// </summary>
 /// <param name="source">The source.</param>
 /// <param name="columnId">The column identifier.</param>
 /// <param name="rowIndex">Index of the row.</param>
 /// <param name="value">The value.</param>
 public static void Set(this DBDataSource source, string columnId, int rowIndex, string value)
 {
     if (value != null)
     {
         source.SetValue(columnId, rowIndex, value);
     }
 }
        /// <summary>
        /// Menu add row
        /// </summary>
        public void MenuEvent_AltItemAdd(ref MenuEvent pVal, ref bool bubbleEvent)
        {
            if (pVal.BeforeAction == true)
            {
                Form oForm = oSBOApplication.Forms.ActiveForm;
                if (oForm.TypeEx == "ALTITEM")
                {
                    try
                    {
                        oForm.Freeze(true);

                        string mtxName    = "mt_1";
                        string dataSource = "@SOL_ALTITEM_D";

                        Matrix oMtx = oForm.Items.Item(mtxName).Specific;
                        oMtx.FlushToDataSource();

                        DBDataSource dtSource = oForm.DataSources.DBDataSources.Item(dataSource);
                        dtSource.InsertRecord(GeneralVariables.iDelRow);

                        dtSource.SetValue("U_SOL_ITEMCODE", GeneralVariables.iDelRow, "");
                        dtSource.SetValue("U_SOL_ITEMNAME", GeneralVariables.iDelRow, "");
                        dtSource.SetValue("U_SOL_FACTOR", GeneralVariables.iDelRow, "");

                        oMtx.LoadFromDataSource();
                        for (int i = 1; i <= oMtx.RowCount; i++)
                        {
                            oMtx.Columns.Item("#").Cells.Item(i).Specific.value = i;
                        }
                        oMtx.FlushToDataSource();

                        oMtx.Columns.Item(1).Cells.Item(GeneralVariables.iDelRow + 1).Click();
                        Utils.releaseObject(dtSource);
                        Utils.releaseObject(oMtx);
                    }
                    catch (Exception ex)
                    {
                        oSBOApplication.MessageBox(ex.Message);
                    }
                    finally
                    {
                        oForm.Freeze(false);
                        Utils.releaseObject(oForm);
                    }
                }
            }
        }
示例#10
0
        /// <summary>
        /// Agrega una nueva linea para ingresar un nuevo registro
        /// </summary>
        private void AgregarNuevaLinea()
        {
            matriz.AddRow();
            matriz.ClearRowData(matriz.RowCount);

            matriz.FlushToDataSource();
            dataSourceMatriz.SetValue("DocEntry", matriz.RowCount - 1, "");

            matriz.Clear();
            matriz.LoadFromDataSource();
        }
        private void Template_AltItem(ref Form oForm)
        {
            DBDataSource altItem_D = oForm.DataSources.DBDataSources.Item("@SOL_ALTITEM_D");

            altItem_D.Clear();
            altItem_D.InsertRecord(altItem_D.Size);

            altItem_D.Offset = altItem_D.Size - 1;
            altItem_D.SetValue("LineId", altItem_D.Size - 1, altItem_D.Size.ToString());

            oForm.Items.Item("mt_1").Specific.LoadFromDataSource();

            Utils.releaseObject(altItem_D);
        }
示例#12
0
        private void PreencherDadosMatriz(SAPbouiCOM.Form form, Matrix mtx, DBDataSource dbdts)
        {
            dbdts.Clear();

            using (var recordset = new RecordSet())
            {
                var rs = recordset.DoQuery("SELECT * FROM [@UPD_CONF_PENEIRA] ORDER BY CONVERT(INT,Code)");
                if (rs.RecordCount > 0)
                {
                    while (!rs.EoF)
                    {
                        var code        = rs.Fields.Item("Code").Value;
                        var peneira     = rs.Fields.Item(_matriz._peneira.Datasource).Value;
                        var nomePeneira = rs.Fields.Item(_matriz._nomepeneira.Datasource).Value;
                        var ativo       = rs.Fields.Item(_matriz._ativo.Datasource).Value;

                        dbdts.InsertRecord(dbdts.Size);

                        int row = dbdts.Size - 1;

                        dbdts.SetValue("Code", row, code);
                        dbdts.SetValue(_matriz._peneira.Datasource, row, peneira);
                        dbdts.SetValue(_matriz._nomepeneira.Datasource, row, nomePeneira);
                        dbdts.SetValue(_matriz._ativo.Datasource, row, ativo);

                        rs.MoveNext();
                    }

                    mtx.LoadFromDataSourceEx();
                }
                else
                {
                    _matriz.AdicionarLinha(form);
                }
            }
        }
示例#13
0
        /// <summary>
        /// Validate alternative item code
        /// </summary>
        private void Validate_CompItem_AltItemCode(string formUID, ref ItemEvent pVal, ref bool bubbleEvent)
        {
            if (bubbleEvent)
            {
                if (pVal.BeforeAction == false && pVal.ActionSuccess == true && pVal.ItemChanged == true)
                {
                    Form         oForm    = oSBOApplication.Forms.Item(formUID);
                    DBDataSource dtSource = oForm.DataSources.DBDataSources.Item("@SOL_COMP_LOG");
                    Recordset    oRec     = oSBOCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
                    String       itemCode = oForm.Items.Item("tAltItmCd").Specific.Value;
                    try
                    {
                        oForm.Freeze(true);
                        string name = string.Empty;

                        oRec.DoQuery("SELECT \"ItemName\" FROM OITM WHERE \"ItemCode\" = '" + itemCode + "'");
                        if (oRec.RecordCount > 0)
                        {
                            name = oRec.Fields.Item(0).Value;
                        }

                        dtSource.SetValue("U_SOL_ITMNAME", 0, name);
                    }
                    catch (Exception ex)
                    {
                        bubbleEvent = false;
                        oSBOApplication.MessageBox(ex.Message);
                    }
                    finally
                    {
                        if (oForm != null)
                        {
                            oForm.Freeze(false);
                        }

                        Utils.releaseObject(oForm);
                        Utils.releaseObject(oRec);
                        Utils.releaseObject(dtSource);
                    }
                }
            }
        }
示例#14
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;
                }
            }
        }
示例#15
0
        /// <summary>
        /// CFL Customer Code
        /// </summary>
        private void CFL_FixDisc_CustCode(string formUID, ref ItemEvent pVal, ref bool bubbleEvent, ref IChooseFromListEvent oCFLEvent)
        {
            if (bubbleEvent)
            {
                Form       oForm = null;
                Conditions oCons = null;
                ICondition oCon  = null;
                SAPbouiCOM.ChooseFromList oCFL = null;
                DataTable        oDataTable    = null;
                BusinessPartners oBp           = null;
                DBDataSource     oDBSource_H   = null;
                Matrix           oMtx1         = null;
                Matrix           oMtx2         = null;

                try
                {
                    oForm = oSBOApplication.Forms.GetForm(pVal.FormTypeEx, pVal.FormTypeCount);
                    oBp   = oSBOCompany.GetBusinessObject(BoObjectTypes.oBusinessPartners);
                    oMtx1 = oForm.Items.Item("mt_1").Specific;
                    oMtx2 = oForm.Items.Item("mt_2").Specific;

                    DBDataSource fixDisc_D1 = oForm.DataSources.DBDataSources.Item("@SOL_FIXDISC_D1");
                    DBDataSource fixDisc_D2 = oForm.DataSources.DBDataSources.Item("@SOL_FIXDISC_D2");

                    if (oCFLEvent.BeforeAction == true)
                    {
                        if (oForm.Mode == BoFormMode.fm_ADD_MODE || oForm.Mode == BoFormMode.fm_OK_MODE || oForm.Mode == BoFormMode.fm_UPDATE_MODE)
                        {
                            oForm.Freeze(true);
                            oCFL = oForm.ChooseFromLists.Item("CFL_CUST");

                            oCFL.SetConditions(null);
                            oCons = oCFL.GetConditions();

                            oCon              = oCons.Add();
                            oCon.Alias        = "CardType";
                            oCon.Operation    = BoConditionOperation.co_EQUAL;
                            oCon.Relationship = BoConditionRelationship.cr_AND;
                            oCon.CondVal      = "C";

                            oCon           = oCons.Add();
                            oCon.Alias     = "validFor";
                            oCon.Operation = BoConditionOperation.co_EQUAL;
                            oCon.CondVal   = "Y";

                            oCFL.SetConditions(oCons);
                        }
                    }
                    else if (oCFLEvent.BeforeAction == false && oCFLEvent.ActionSuccess == true && oCFLEvent.SelectedObjects != null && oCFLEvent.FormMode != 0)
                    {
                        oForm.Freeze(true);
                        oDataTable = oCFLEvent.SelectedObjects;

                        if (oBp.GetByKey(oDataTable.GetValue("CardCode", 0)))
                        {
                            oDBSource_H = oForm.DataSources.DBDataSources.Item("@SOL_FIXDISC_H");
                            oDBSource_H.SetValue("U_SOL_CARDCODE", 0, oBp.CardCode);
                            oDBSource_H.SetValue("U_SOL_CARDNAME", 0, oBp.CardName);

                            // Generate Code
                            string code = GenerateCode(oBp.CardCode);
                            oDBSource_H.SetValue("Code", 0, code);

                            if (oForm.Mode != BoFormMode.fm_ADD_MODE)
                            {
                                oForm.Mode = BoFormMode.fm_UPDATE_MODE;
                            }

                            if (oMtx1.RowCount <= 0 || oMtx2.RowCount <= 0)
                            {
                                fixDisc_D1.InsertRecord(fixDisc_D1.Size);
                                fixDisc_D2.InsertRecord(fixDisc_D2.Size);

                                fixDisc_D1.Offset = fixDisc_D1.Size - 1;
                                fixDisc_D1.SetValue("LineId", fixDisc_D1.Size - 1, fixDisc_D1.Size.ToString());
                                fixDisc_D2.Offset = fixDisc_D2.Size - 1;
                                fixDisc_D2.SetValue("LineId", fixDisc_D2.Size - 1, fixDisc_D2.Size.ToString());

                                oForm.Items.Item("mt_1").Specific.LoadFromDataSource();
                                oForm.Items.Item("mt_2").Specific.LoadFromDataSource();
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    bubbleEvent = false;
                    oSBOApplication.MessageBox(ex.Message + " : " + ex.StackTrace);
                }
                finally
                {
                    if (oForm != null)
                    {
                        oForm.Freeze(false);
                    }

                    Utils.releaseObject(oForm);
                    Utils.releaseObject(oCons);
                    Utils.releaseObject(oCon);
                    Utils.releaseObject(oCFL);
                    Utils.releaseObject(oDataTable);
                    Utils.releaseObject(oBp);
                    Utils.releaseObject(oDBSource_H);
                }
            }
        }
示例#16
0
        /// <summary>
        /// Add row in Fix Discount
        /// </summary>
        public void MenuEvent_FixDiscAdd(ref MenuEvent pVal, ref bool bubbleEvent)
        {
            if (pVal.BeforeAction == true)
            {
                Form oForm = oSBOApplication.Forms.ActiveForm;
                if (oForm.TypeEx == "FIXDISC")
                {
                    try
                    {
                        oForm.Freeze(true);

                        string mtxName    = string.Empty;
                        string dataSource = string.Empty;

                        switch (oForm.ActiveItem)
                        {
                        case "mt_1": mtxName = "mt_1"; dataSource = "@SOL_FIXDISC_D1"; break;

                        case "mt_2": mtxName = "mt_2"; dataSource = "@SOL_FIXDISC_D2"; break;
                        }

                        Matrix oMtx = oForm.Items.Item(mtxName).Specific;
                        oMtx.FlushToDataSource();

                        DBDataSource dtSource = oForm.DataSources.DBDataSources.Item(dataSource);
                        dtSource.InsertRecord(GeneralVariables.iDelRow);

                        if (mtxName == "mt_1")
                        {
                            dtSource.SetValue("U_SOL_BRANDCODE", GeneralVariables.iDelRow, "");
                            dtSource.SetValue("U_SOL_BRANDNAME", GeneralVariables.iDelRow, "");
                            dtSource.SetValue("U_SOL_BRANDDISC", GeneralVariables.iDelRow, "0");
                        }
                        else if (mtxName == "mt_2")
                        {
                            dtSource.SetValue("U_SOL_ITEMCODE", GeneralVariables.iDelRow, "");
                            dtSource.SetValue("U_SOL_ITEMNAME", GeneralVariables.iDelRow, "");
                            dtSource.SetValue("U_SOL_ITEMDISC", GeneralVariables.iDelRow, "0");
                        }

                        oMtx.LoadFromDataSource();

                        for (int i = 1; i <= oMtx.RowCount; i++)
                        {
                            oMtx.Columns.Item("#").Cells.Item(i).Specific.value = i;
                        }
                        oMtx.FlushToDataSource();

                        if (mtxName == "mt_2")
                        {
                            oMtx.Columns.Item(2).Cells.Item(GeneralVariables.iDelRow + 1).Click();
                        }
                        else
                        {
                            oMtx.Columns.Item(1).Cells.Item(GeneralVariables.iDelRow + 1).Click();
                        }

                        Utils.releaseObject(dtSource);
                        Utils.releaseObject(oMtx);
                    }
                    catch (Exception ex)
                    {
                        oSBOApplication.MessageBox(ex.Message);
                    }
                    finally
                    {
                        oForm.Freeze(false);
                        Utils.releaseObject(oForm);
                    }
                }
            }
        }