private void GuardarDatos() { Int32 Entry; oForm.Freeze(true); try { for (Int32 iCant = 0; iCant <= oDataTable.Rows.Count - 1; iCant++) { if (((System.String)oDataTable.GetValue("Cuenta", iCant)).Trim() != "") { oDBDSHeader.Clear(); oDBDSHeader.InsertRecord(0); oDBDSHeader.SetValue("U_Cuenta", 0, ((System.String)oDataTable.GetValue("Cuenta", iCant)).Trim()); oDBDSHeader.SetValue("U_Desc", 0, ((System.String)oDataTable.GetValue("Descripcion", iCant)).Trim()); oDBDSHeader.SetValue("U_Clasif", 0, ((System.String)oDataTable.GetValue("Clasificacion", iCant)).Trim()); if (((System.Int32)oDataTable.GetValue("DocEntry", iCant)) == 0) { Entry = Funciones.AddDataSourceInt1("VID_FEPLANCTA", oDBDSHeader, "", null, "", null, "", null); } else { oDBDSHeader.SetValue("DocEntry", 0, oDataTable.GetValue("DocEntry", iCant).ToString().Trim()); Entry = Funciones.UpdDataSourceInt1("VID_FEPLANCTA", oDBDSHeader, "", null, "", null, "", null); } if (Entry > 0) { FSBOApp.StatusBar.SetText("Se ha guardado satisfactoriamente el Plan de Cuenta", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Success); } else { FSBOApp.StatusBar.SetText("No se ha guardado Plan de Cuenta", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error); } } } CargarGrilla(); oForm.Mode = BoFormMode.fm_OK_MODE; } catch (Exception y) { FSBOApp.StatusBar.SetText("GuardarDatos: " + y.Message + " ** Trace: " + y.StackTrace, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error); OutLog("GuardarDatos: " + y.Message + " ** Trace: " + y.StackTrace); } finally { oForm.Freeze(false); } }
/// <summary> /// Agrega un item de venta de pesaje a la matriz /// </summary> public SAPbouiCOM.DBDataSource AddItemService(SAPbouiCOM.DBDataSource mDBDataSourceD) { mDBDataSourceD.Clear(); mDBDataSourceD.InsertRecord(0); QueryManager lObjQueryManager = new QueryManager(); string lSTrItemCode = lObjQueryManager.GetValue("U_Value", "Name", "PL_WEIGHING_SALE", "[@UG_CONFIG]"); mDBDataSourceD.SetValue("ItemCode", 0, lSTrItemCode); //Ponerlo en configuracion TicketDAO lObjTicketDAO = new TicketDAO(); string lStrPrice = lObjTicketDAO.GetPrice(lSTrItemCode); mDBDataSourceD.SetValue("Dscription", 0, "SERVICIO DE BASCULA"); mDBDataSourceD.SetValue("Price", 0, lStrPrice); if (lStrPrice == "0") { mDBDataSourceD.SetValue("Price", 0, "1"); } mDBDataSourceD.SetValue("Quantity", 0, "1"); mDBDataSourceD.SetValue("LineTotal", 0, "0"); return(mDBDataSourceD); }
}//fin FormEvent private void Distribuir() { Int64 iFolio; Int64 iDesde; Int64 iHasta; Int32 i; SAPbouiCOM.EditText oEditText; try { oMtx.Clear(); oMtx.FlushToDataSource(); oEditText = (EditText)(oForm.Items.Item("Desde").Specific); iDesde = Convert.ToInt64((System.String)(oEditText.Value), _nf); oEditText = (EditText)(oForm.Items.Item("Hasta").Specific); iHasta = Convert.ToInt64((System.String)(oEditText.Value), _nf); if (iDesde <= 0) { FSBOApp.StatusBar.SetText("Debe ingresar Folio desde", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error); } else if (iHasta <= 0) { FSBOApp.StatusBar.SetText("Debe ingresar Folio hasta", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error); } else if (iDesde >= iHasta) { FSBOApp.StatusBar.SetText("Ingrese rango Folio correcto", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error); } else { i = 0; for (iFolio = iDesde; iFolio <= iHasta; iFolio++) { oDBDSD.InsertRecord(i); oDBDSD.SetValue("U_Folio", i, Convert.ToString(iFolio)); oDBDSD.SetValue("U_Estado", i, "D"); i++; } if (Convert.ToDouble((System.String)(oDBDSD.GetValue("U_Folio", i)), _nf) == 0) { oDBDSD.RemoveRecord(i); } oMtx.LoadFromDataSource(); oColumn = oMtx.Columns.Item("Folio"); oColumn.TitleObject.Sortable = true; oColumn.TitleObject.Sort(SAPbouiCOM.BoGridSortType.gst_Ascending); } } catch (Exception e) { FSBOApp.MessageBox(e.Message + " ** Trace: " + e.StackTrace, 1, "Ok", "", ""); OutLog("Distribuir: " + e.Message + " ** Trace: " + e.StackTrace); } }//fin Distribuir
}//fin InitForm public new void FormEvent(String FormUID, ref SAPbouiCOM.ItemEvent pVal, ref Boolean BubbleEvent) { Int32 nErr; String sErr; SAPbouiCOM.DataTable oDataTable; String sValue, sValue1; SAPbouiCOM.IChooseFromListEvent oCFLEvento = null; base.FormEvent(FormUID, ref pVal, ref BubbleEvent); try { if ((pVal.EventType == BoEventTypes.et_ITEM_PRESSED) && (pVal.BeforeAction)) { if ((pVal.ItemUID == "1") && (oForm.Mode == BoFormMode.fm_ADD_MODE)) { //BubbleEvent := ValidarDatosFE(); } } if ((pVal.EventType == BoEventTypes.et_CHOOSE_FROM_LIST) && (!pVal.BeforeAction)) { if (pVal.ColUID == "V_0") { oCFLEvento = (SAPbouiCOM.IChooseFromListEvent)(pVal); oDataTable = oCFLEvento.SelectedObjects; if (oDataTable != null) { sValue = (System.String)(oDataTable.GetValue("Code", 0)); sValue1 = (System.String)(oDataTable.GetValue("Name", 0)); oMtx.FlushToDataSource(); oDBDSD.SetValue("U_Indicato", pVal.Row - 1, sValue); oDBDSD.SetValue("U_Descrip", pVal.Row - 1, sValue1); if (pVal.Row == oMtx.RowCount) { oDBDSD.InsertRecord(pVal.Row); } oMtx.LoadFromDataSource(); oMtx.AutoResizeColumns(); if (oForm.Mode == BoFormMode.fm_OK_MODE) { oForm.Mode = BoFormMode.fm_UPDATE_MODE; } } } } } catch (Exception e) { FCmpny.GetLastError(out nErr, out sErr); FSBOApp.StatusBar.SetText("FormEvent: " + e.Message + " ** Trace: " + e.StackTrace, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error); OutLog("FormEvent: " + e.Message + " ** Trace: " + e.StackTrace); } }//fin FormEvent
}//fin LimpiarGrid private Boolean CrearDatos() { Boolean _result; Int32 i; TFunctions Functions; try { _result = true; i = 0; oDBDSHeader.Clear(); Functions = new TFunctions(); Functions.SBO_f = FSBOf; if (GlobalSettings.RunningUnderSQLServer) { s = "select Code, U_CodImpto, U_Desc, U_Porc from [@VID_FEIMPADIC]"; } else { s = @"select ""Code"", ""U_CodImpto"", ""U_Desc"", ""U_Porc"" from ""@VID_FEIMPADIC"" "; } oRecordSet.DoQuery(s); if (oRecordSet.RecordCount > 0) { Functions.ImpAdicDel(ref oRecordSet); } while (i < oDataTable.Rows.Count) { oDBDSHeader.InsertRecord(0); oDBDSHeader.SetValue("Code", 0, (System.String)(oDataTable.GetValue("Code", i)).ToString().Trim()); oDBDSHeader.SetValue("U_CodImpto", 0, (System.String)(oDataTable.GetValue("U_CodImpto", i)).ToString().Trim()); oDBDSHeader.SetValue("U_Desc", 0, (System.String)(oDataTable.GetValue("U_Desc", i)).ToString().Trim()); oDBDSHeader.SetValue("U_Porc", 0, FSBOf.DoubleToStr(((System.Double)oDataTable.GetValue("U_Porc", i))).Trim()); _result = Functions.ImpAdicAdd(oDBDSHeader); i++; } oDataTable.Rows.Add(1); oDataTable.SetValue("Code", oDataTable.Rows.Count - 1, ""); oDataTable.SetValue("U_CodImpto", oDataTable.Rows.Count - 1, ""); oDataTable.SetValue("U_Desc", oDataTable.Rows.Count - 1, ""); oDataTable.SetValue("U_Porc", oDataTable.Rows.Count - 1, 0); return(_result); } catch (Exception e) { FSBOApp.StatusBar.SetText(e.Message, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error); OutLog("CrearDatos " + e.Message + " ** Trace: " + e.StackTrace); return(false); } } //fin CrearDatos
}//fin MenuEvent private void GuardarRegistros() { TFunctions Reg; Int32 i; Int32 DocEntryAsig; String User, Pass; try { if (ValidarMatrix()) { Reg = new TFunctions(); Reg.SBO_f = FSBOf; oMtx.FlushToDataSource(); FCmpny.StartTransaction(); i = 0; while (i < oMtx.RowCount) { User = (System.String)(oDBDSH.GetValue("U_Usuario", i)); Pass = (System.String)(oDBDSH.GetValue("U_Password", i)); //s = Reg.Encriptar(Pass); oDBDSH.SetValue("U_Password", i, Pass); if ((System.String)(oDBDSH.GetValue("DocEntry", i)) == "") { DocEntryAsig = Reg.FEMultiSocAdd((System.String)(oDBDSH.GetValue("U_Servidor", i)), (System.String)(oDBDSH.GetValue("U_RUT", i)), (System.String)(oDBDSH.GetValue("U_Base", i)), (System.String)(oDBDSH.GetValue("U_Usuario", i)), (System.String)(oDBDSH.GetValue("U_Password", i)), (System.String)(oDBDSH.GetValue("U_Sociedad", i)), (System.String)(oDBDSH.GetValue("U_Habilitada", i))); oDBDSH.SetValue("DocEntry", i, DocEntryAsig.ToString()); } else { Reg.FEMultiSocUpt((System.String)(oDBDSH.GetValue("DocEntry", i)), (System.String)(oDBDSH.GetValue("U_Servidor", i)), (System.String)(oDBDSH.GetValue("U_RUT", i)), (System.String)(oDBDSH.GetValue("U_Base", i)), (System.String)(oDBDSH.GetValue("U_Usuario", i)), (System.String)(oDBDSH.GetValue("U_Password", i)), (System.String)(oDBDSH.GetValue("U_Sociedad", i)), (System.String)(oDBDSH.GetValue("U_Habilitada", i))); } //oDBDSH.SetValue("U_Password", i, Pass); i++; } FCmpny.EndTransaction(BoWfTransOpt.wf_Commit); oDBDSH.InsertRecord(i); oMtx.LoadFromDataSource(); oMtx.AutoResizeColumns(); FSBOApp.StatusBar.SetText("Sociedades registradas satisfactoriamente", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Success); } } catch (Exception e) { FSBOApp.MessageBox(e.Message + " ** Trace: " + e.StackTrace, 1, "Ok", "", ""); OutLog("GuardarRegistros: " + e.Message + " ** Trace: " + e.StackTrace); if (FCmpny.InTransaction) { FCmpny.EndTransaction(BoWfTransOpt.wf_RollBack); } } }//fin GuardarRegistros
}//fin LimpiarGrid private Boolean CrearDatos() { Boolean _result; Int32 i; TFunctions Functions; try { _result = true; oDBDSHeader.Clear(); Functions = new TFunctions(); Functions.SBO_f = FSBOf; if (GlobalSettings.RunningUnderSQLServer) { s = "SELECT Code, Name FROM [@FM_IVA]"; } else { s = @"SELECT ""Code"", ""Name"" FROM ""@FM_IVA"" "; } oRecordSet.DoQuery(s); if (oRecordSet.RecordCount > 0) { Functions.PEImpDel(ref oRecordSet); } i = 0; while (i < oDataTable.Rows.Count) { oDBDSHeader.Clear(); oDBDSHeader.InsertRecord(0); oDBDSHeader.SetValue("Code", 0, ((System.String)oDataTable.GetValue("Code", i)).Trim()); oDBDSHeader.SetValue("Name", 0, ((System.String)oDataTable.GetValue("Name", i)).Trim()); _result = Functions.PEImpAdd(oDBDSHeader); i++; } oDataTable.Rows.Add(1); oDataTable.SetValue("Code", oDataTable.Rows.Count - 1, ""); oDataTable.SetValue("Name", oDataTable.Rows.Count - 1, ""); return(_result); } catch (Exception e) { FSBOApp.StatusBar.SetText(e.Message, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error); OutLog("CrearDatos " + e.Message + " ** Trace: " + e.StackTrace); return(false); } } //fin CrearDatos
private void GuardarDatos() { Int32 Entry = 0; Int32 LineId = 0; oForm.Freeze(true); try { oDBDSDetalle.Clear(); for (Int32 iCant = 0; iCant <= odt.Rows.Count - 1; iCant++) { if (((System.String)odt.GetValue("U_CtaSAP", iCant)) != "") { oDBDSDetalle.InsertRecord(LineId); oDBDSDetalle.SetValue("DocEntry", LineId, odt.GetValue("DocEntry", iCant).ToString().Trim()); oDBDSDetalle.SetValue("LineId", LineId, LineId.ToString()); oDBDSDetalle.SetValue("U_CtaSAP", LineId, ((System.String)odt.GetValue("U_CtaSAP", iCant)).ToString().Trim()); oDBDSDetalle.SetValue("U_DescSAP", LineId, ((System.String)odt.GetValue("U_DescSAP", iCant)).ToString().Trim()); } LineId++; } Entry = Funciones.UpdDataSourceInt1("VID_FEPLANCTA", oDBDSHeader, "VID_FEPLANCTAD", oDBDSDetalle, "", null, "", null); if (Entry > 0) { FSBOApp.StatusBar.SetText("Se ha guardado satisfactoriamente el Plan de Cuentas", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Success); } else { FSBOApp.StatusBar.SetText("No se ha guardado Plan de Cuentas", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error); } CargarGrilla(); oForm.Mode = BoFormMode.fm_OK_MODE; } catch (Exception y) { FSBOApp.StatusBar.SetText("GuardarDatos: " + y.Message + " ** Trace: " + y.StackTrace, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error); OutLog("GuardarDatos: " + y.Message + " ** Trace: " + y.StackTrace); } finally { oForm.Freeze(false); } }
/// <summary> /// Agrega un item de venta de pesaje a la matriz /// </summary> public SAPbouiCOM.DBDataSource AddItemWeigin(SAPbouiCOM.DBDataSource mDBDataSourceD) { mDBDataSourceD.Clear(); mDBDataSourceD.InsertRecord(0); QueryManager lObjQueryManager = new QueryManager(); string lSTrItemCode = lObjQueryManager.GetValue("U_Value", "Name", "PL_ITEM_WEIGH", "[@UG_CONFIG]"); mDBDataSourceD.SetValue("ItemCode", 0, lSTrItemCode); //Ponerlo en configuracion TicketDAO lObjTicketDAO = new TicketDAO(); string lStrPrice = lObjTicketDAO.GetPrice(lSTrItemCode); mDBDataSourceD.SetValue("Dscription", 0, "Articulo de pesaje simple"); mDBDataSourceD.SetValue("Price", 0, lStrPrice); if (lStrPrice == "0") { mDBDataSourceD.SetValue("Price", 0, "0"); } mDBDataSourceD.SetValue("Quantity", 0, "0"); mDBDataSourceD.SetValue("LineTotal", 0, "0"); return(mDBDataSourceD); }
//Carga los datos al data source de la matriz public SAPbouiCOM.DBDataSource LoadMatrixData(Ticket pObjTicket, SAPbouiCOM.DBDataSource pDBDataSourceD, IList <TicketDetail> pLstTicketDetail, string pStrSource) { int i = 0; double lFloQuantity = 0; foreach (TicketDetail lObjTicketDetail in pLstTicketDetail.OrderByDescending(x => x.Line)) { ///LE Importe Pesaje simple if (pObjTicket.CapType == 4) { lFloQuantity = 1; } else { lFloQuantity = lObjTicketDetail.netWeight; } //mObjQueryManager.GetObjectsList< pDBDataSourceD.InsertRecord(i); pDBDataSourceD.SetValue("ItemCode", i, lObjTicketDetail.Item); pDBDataSourceD.SetValue("Dscription", i, mObjTicketServices.SearchItemName(lObjTicketDetail.Item)); pDBDataSourceD.SetValue("Price", i, lObjTicketDetail.Price.ToString()); pDBDataSourceD.SetValue("Weight1", i, lObjTicketDetail.FirstWT.ToString()); pDBDataSourceD.SetValue("Weight2", i, lObjTicketDetail.SecondWT.ToString()); pDBDataSourceD.SetValue("Quantity", i, lFloQuantity.ToString()); pDBDataSourceD.SetValue("LineTotal", i, (lFloQuantity * lObjTicketDetail.Price).ToString()); pDBDataSourceD.SetValue("U_GLO_BagsBales", i, lObjTicketDetail.BagsBales.ToString()); pDBDataSourceD.SetValue("WhsCode", i, lObjTicketDetail.WhsCode.ToString()); pDBDataSourceD.SetValue("FromWhsCod", i, lObjTicketDetail.WhsCode.ToString()); pDBDataSourceD.SetValue("LineNum", i, lObjTicketDetail.BaseLine.ToString()); string lStrLine = GetTableLine(pObjTicket.DocType, pStrSource); string lStrTable = lStrLine.Remove(lStrLine.Length - 1); pDBDataSourceD.SetValue("OpenCreQty", i, mObjTicketServices.GetOpenLine("O" + lStrTable, lStrLine, "OpenCreQty", pObjTicket.Number.ToString(), lObjTicketDetail.BaseLine.ToString())); pDBDataSourceD.SetValue("DelivrdQty", i, mObjTicketServices.GetDeliveryLine("O" + lStrTable, lStrLine, "DelivrdQty", pObjTicket.Number.ToString(), lObjTicketDetail.BaseLine.ToString())); } return(pDBDataSourceD); }
}//fin InitForm public new void FormEvent(String FormUID, ref SAPbouiCOM.ItemEvent pVal, ref Boolean BubbleEvent) { Int32 nErr; String sErr; SAPbouiCOM.DataTable oDataTable; String sValue, sValue1; SAPbouiCOM.IChooseFromListEvent oCFLEvento = null; base.FormEvent(FormUID, ref pVal, ref BubbleEvent); try { if ((pVal.EventType == BoEventTypes.et_ITEM_PRESSED) && (pVal.BeforeAction)) { if ((pVal.ItemUID == "1") && (oForm.Mode == BoFormMode.fm_ADD_MODE)) { //BubbleEvent := ValidarDatosFE(); } } if ((pVal.EventType == BoEventTypes.et_COMBO_SELECT) && (!pVal.BeforeAction) && (pVal.ItemUID == "mtx")) { if (pVal.ColUID == "V_0") { oMtx.FlushToDataSource(); sValue = ((System.String)oDBDSD.GetValue("U_CodeImp", pVal.Row - 1)).Trim(); if (GlobalSettings.RunningUnderSQLServer) { s = @"select Code, Name from OSTA where Code = '{0}' UNION ALL select WTCode 'Code', WTName 'Name' from OWHT where Inactive = 'N' and WTCode = '{0}'"; } else { s = @"select ""Code"", ""Name"" from ""OSTA"" where ""Code"" = '{0}' UNION ALL select ""WTCode"" ""Code"", ""WTName"" ""Name"" from ""OWHT"" where ""Inactive"" = 'N' and ""WTCode"" = '{0}' "; } s = String.Format(s, sValue); oRecordSet.DoQuery(s); if (oRecordSet.RecordCount == 0) { FSBOApp.StatusBar.SetText("No se encuentra Impuesto o Retención: " + sValue, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error); } else { sValue1 = ((System.String)oRecordSet.Fields.Item("Name").Value).Trim(); oDBDSD.SetValue("U_CodeImp", pVal.Row - 1, sValue); oDBDSD.SetValue("U_Descrip", pVal.Row - 1, sValue1); if (pVal.Row == oMtx.RowCount) { oDBDSD.InsertRecord(pVal.Row); } oMtx.LoadFromDataSource(); oMtx.AutoResizeColumns(); if (oForm.Mode == BoFormMode.fm_OK_MODE) { oForm.Mode = BoFormMode.fm_UPDATE_MODE; } } } } } catch (Exception e) { FCmpny.GetLastError(out nErr, out sErr); FSBOApp.StatusBar.SetText("FormEvent: " + e.Message + " ** Trace: " + e.StackTrace, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error); OutLog("FormEvent: " + e.Message + " ** Trace: " + e.StackTrace); } }//fin FormEvent
public new bool InitForm(string uid, string xmlPath, ref Application application, ref SAPbobsCOM.Company company, ref CSBOFunctions SBOFunctions, ref TGlobalVid _GlobalSettings) { Int32 i; //SAPbouiCOM.EditTextColumn oEditText; SAPbouiCOM.CommonSetting oSetting; TFunctions Reg; bool Result = base.InitForm(uid, xmlPath, ref application, ref company, ref SBOFunctions, ref _GlobalSettings); try { oRecordSet = (SAPbobsCOM.Recordset)(FCmpny.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)); Lista = new List <string>(); FSBOf.LoadForm(xmlPath, "VID_Sucursal.srf", uid); //EnableCrystal := true; oForm = FSBOApp.Forms.Item(uid); oForm.Freeze(true); oForm.AutoManaged = true; oForm.SupportedModes = -1; // afm_All // VID_DelRow := true; // VID_DelRowOK := true; //oForm.DataBrowser.BrowseBy := "Code"; oDBDSH = oForm.DataSources.DBDataSources.Item("@VID_FESUC"); // Ok Ad Fnd Vw Rq Sec Lista.Add("mtx , f, t, f, f, r, 1"); //Lista.Add('Name , f, t, t, f, r, 1'); //Lista.Add('CardCode , f, t, t, f, r, 1'); //FSBOf.SetAutoManaged(var oForm, Lista); //oCombo := ComboBox(oForm.Items.Item('TipDoc').Specific); //oCombo.ValidValues.Add('33', 'Factura'); //s := '1'; //oCombo.Select(s, BoSearchKey.psk_ByValue); // AddChooseFromList(); oMtx = (Matrix)(oForm.Items.Item("mtx").Specific); // oColumn := SAPbouiCOM.Column(oMtx.Columns.Item('V_0')); // oColumn.ChooseFromListUID := 'CFL0'; // oColumn.ChooseFromListAlias:= 'Code'; // oMtx.AutoResizeColumns(); if (GlobalSettings.RunningUnderSQLServer) { s = @"select Code, Name, ISNULL(U_Habilitada,'Y') 'Habilitada' from [@VID_FESUC]"; } else { s = @"select ""Code"", ""Name"", IFNULL(""U_Habilitada"",'Y') ""Habilitada"" from ""@VID_FESUC"" "; } oRecordSet.DoQuery(s); if (oRecordSet.RecordCount == 0) { if (GlobalSettings.RunningUnderSQLServer) { s = "select Code from [@VID_FESUC] where Code = 'Principal'"; } else { s = @"select ""Code"" from ""@VID_FESUC"" where ""Code"" = 'Principal' "; } oRecordSet.DoQuery(s); if (oRecordSet.RecordCount == 0) { Reg = new TFunctions(); Reg.SBO_f = FSBOf; oDBDSH.Clear(); oDBDSH.InsertRecord(0); oDBDSH.SetValue("Code", 0, "Principal"); oDBDSH.SetValue("Name", 0, "SAP BO"); oDBDSH.SetValue("U_Habilitada", 0, "Y"); if (Reg.FESUCAdd(oDBDSH) == true) { FSBOApp.StatusBar.SetText("Sucursal Principal creada correctamente", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Success); } else { FSBOApp.StatusBar.SetText("Sucursal Principal no ha sido creada", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error); } } } if (GlobalSettings.RunningUnderSQLServer) { s = @"select Code, Name, ISNULL(U_Habilitada,'Y') 'Habilitada' from [@VID_FESUC]"; } else { s = @"select ""Code"", ""Name"", IFNULL(""U_Habilitada"",'Y') ""Habilitada"" from ""@VID_FESUC"" "; } oRecordSet.DoQuery(s); i = 0; oDBDSH.Clear(); while (!oRecordSet.EoF) { oDBDSH.InsertRecord(i); oDBDSH.SetValue("Code", i, (System.String)(oRecordSet.Fields.Item("Code").Value)); oDBDSH.SetValue("Name", i, (System.String)(oRecordSet.Fields.Item("Name").Value)); oDBDSH.SetValue("U_Habilitada", i, (System.String)(oRecordSet.Fields.Item("Habilitada").Value)); oRecordSet.MoveNext(); i++; } oDBDSH.InsertRecord(i); oDBDSH.SetValue("Code", i, ""); oDBDSH.SetValue("Name", i, ""); oDBDSH.SetValue("U_Habilitada", i, "Y"); if (GlobalSettings.RunningUnderSQLServer) { s = @"select FldValue 'Code', Descr 'Name' from UFD1 where TableID = '@VID_FESUC' and FieldID = 0"; } else { s = @"select ""FldValue"" ""Code"", ""Descr"" ""Name"" from ""UFD1"" where ""TableID"" = '@VID_FESUC' and ""FieldID"" = 0"; } oRecordSet.DoQuery(s); oColumn = (SAPbouiCOM.Column)(oMtx.Columns.Item("Habilitada")); FSBOf.FillComboMtx(oColumn, ref oRecordSet, false); //EditText(oForm.Items.Item('CardCode').Specific).Active := True; oMtx.LoadFromDataSource(); oSetting = oMtx.CommonSetting; i = 1; while (i <= oMtx.RowCount) { if ((System.String)(oDBDSH.GetValue("Code", i - 1)).Trim() != "") { oSetting.SetCellEditable(i, 1, false); } i++; } oForm.Mode = BoFormMode.fm_OK_MODE; oMtx.AutoResizeColumns(); } catch (Exception e) { OutLog("InitForm: " + e.Message + " ** Trace: " + e.StackTrace); FSBOApp.MessageBox(e.Message + " ** Trace: " + e.StackTrace, 1, "Ok", "", ""); } oForm.Freeze(false); return(Result); }//fin InitForm
}//fin FormEvent private void GuardarRegistros() { TFunctions Reg; Int32 i; SAPbouiCOM.EditText oEditText; SAPbouiCOM.ComboBox oComboBox; String Code, Name, Hab; Boolean _return = false; try { Reg = new TFunctions(); Reg.SBO_f = FSBOf; oMtx.FlushToDataSource(); i = 1; while (i <= oMtx.RowCount) { oEditText = (EditText)(oMtx.Columns.Item("Code").Cells.Item(i).Specific); Code = (System.String)(oEditText.Value).Trim(); oEditText = (EditText)(oMtx.Columns.Item("Name").Cells.Item(i).Specific); Name = (System.String)(oEditText.Value).Trim(); oComboBox = (ComboBox)(oMtx.Columns.Item("Habilitada").Cells.Item(i).Specific); Hab = oComboBox.Value; oDBDSH.Clear(); oDBDSH.InsertRecord(0); oDBDSH.SetValue("Code", 0, Code); oDBDSH.SetValue("Name", 0, Name); oDBDSH.SetValue("U_Habilitada", 0, Hab); if (GlobalSettings.RunningUnderSQLServer) { s = @"select count(*) 'cont' from [@VID_FESUC] where Code = '{0}'"; } else { s = @"select COUNT(*) ""cont"" from ""@VID_FESUC"" where ""Code"" = '{0}' "; } s = String.Format(s, Code); oRecordSet.DoQuery(s); if ((System.Int32)(oRecordSet.Fields.Item("cont").Value) == 0) { _return = Reg.FESUCAdd(oDBDSH); } else { _return = Reg.FESUCUpd(oDBDSH); } i++; } if (_return) { oForm.Mode = BoFormMode.fm_OK_MODE; } } catch (Exception e) { FSBOApp.MessageBox(e.Message + " ** Trace: " + e.StackTrace, 1, "Ok", "", ""); OutLog("GuardarRegistros: " + e.Message + " ** Trace: " + e.StackTrace); } }//fin GuardarRegistro
private void SetSystemDataTable(SAPbouiCOM.Form oForm) { try { oDB1_O = (SAPbouiCOM.DBDataSource)oForm.DataSources.DBDataSources.Item("@KIS_SO00301_HRD"); oDB2_O = (SAPbouiCOM.DBDataSource)oForm.DataSources.DBDataSources.Item("@KIS_SO00302_HRD"); oDB1_Z = (SAPbouiCOM.DBDataSource)oForm.DataSources.DBDataSources.Item("@KIS_SO00301Z_HRD"); oDB1_Z.Clear(); //if (gDs.Tables[oForm.UniqueID + "_Deliver"] != null) // gDs.Tables[oForm.UniqueID + "_Deliver"].Clear(); //else // gDs.Tables[oForm.UniqueID + "_Deliver"] = SetParameterDataTableSchema(oForm.UniqueID+"Deliver"); if (gDs.Tables.Contains(oForm.UniqueID + "_Deliver")) { gDs.Tables[oForm.UniqueID + "_Deliver"].Rows.Clear(); } else { System.Data.DataTable dt = SetParameterDataTableSchema(oForm.UniqueID + "_Deliver"); gDs.Tables.Add(dt); } if (oDB1_O.Size > 0 && oDB1_O.GetValue("U_DELVCD", 0).ToString().Trim() != "") { for (int i = 0; i < oDB1_O.Size; i++) { System.Data.DataRow dr; // 데이터 필터를 위해 DataTable에 담는다. dr = gDs.Tables[oForm.UniqueID + "_Deliver"].NewRow(); dr["IDX"] = i; // "DataTable 고유ID" dr["LINEID"] = oDB1_O.GetValue("LineId", i);//"원본라인번호"; dr["DELVCD"] = oDB1_O.GetValue("U_DELVCD", i).Trim(); //"배달코드"; dr["RDEPT"] = oDB1_O.GetValue("U_RDEPT", i).Trim(); //"부서"; dr["PAPERTP"] = oDB1_O.GetValue("U_PAPERTP", i).Trim(); //"지종"; dr["PAYCD"] = oDB1_O.GetValue("U_PAYCD", i).Trim(); //"요금제코드"; dr["PAYNM"] = oDB1_O.GetValue("U_PAYNM", i).Trim(); //"요금제명"; dr["TEL"] = oDB1_O.GetValue("U_TEL", i).Trim(); //"연락처"; dr["MOBILE"] = oDB1_O.GetValue("U_MOBILE", i).Trim(); //"휴대폰"; dr["ADDR1"] = oDB1_O.GetValue("U_ADDR1", i).Trim(); //"주소1"; dr["ADDR2"] = oDB1_O.GetValue("U_ADDR2", i).Trim(); //"주소2"; dr["ADDR1_D"] = oDB1_O.GetValue("U_ADDR1_D", i).Trim(); //"주소1상세"; dr["ADDR2_D"] = oDB1_O.GetValue("U_ADDR2_D", i).Trim(); //"주소2상세"; dr["CENTCD"] = oDB1_O.GetValue("U_CENTCD", i).Trim(); //"지국"; dr["CENTNM"] = oDB1_O.GetValue("U_CENTNM", i).Trim(); //"지국명"; dr["DELVFR"] = oDB1_O.GetValue("U_DELVFR", i).Trim(); //"배달시작일"; dr["DELVTO"] = oDB1_O.GetValue("U_DELVTO", i).Trim(); //"배달종료일"; dr["DELVCNT"] = oDB1_O.GetValue("U_DELVCNT", i).Trim(); //"배달부수"; dr["METHOD"] = oDB1_O.GetValue("U_METHOD", i).Trim(); //"가입방법"; dr["SAILCD"] = oDB1_O.GetValue("U_SAILCD", i).Trim(); //"유치자"; dr["SAILNM"] = oDB1_O.GetValue("U_SAILNM", i).Trim(); //"유치자"; dr["STATUS"] = oDB1_O.GetValue("U_STATUS", i).Trim(); //"배달상태"; dr["SDEPT"] = oDB1_O.GetValue("U_SDEPT", i).Trim(); //"유치부서"; dr["NOTE"] = oDB1_O.GetValue("U_NOTE", i).Trim(); //"배달상세"; dr["JOINDT"] = oDB1_O.GetValue("U_JOINDT", i).Trim(); //"가입일자"; dr["CLOSEDT"] = oDB1_O.GetValue("U_CLOSEDT", i).Trim(); //"해지일자"; dr["USERSG1"] = oDB1_O.GetValue("U_USERSG1", i).Trim(); //"등록자"; dr["READTP"] = oDB1_O.GetValue("U_READTP", i).Trim(); //"독자구분"; dr["BTEL1"] = oDB1_O.GetValue("U_BTEL1", i).Trim(); //"분국전화1"; dr["BTEL2"] = oDB1_O.GetValue("U_BTEL2", i).Trim(); //"분국전화1"; dr["ROWSTATE"] = ""; // 기본: "", 수정: M, 신규: I, 삭제: D gDs.Tables[oForm.UniqueID + "_Deliver"].Rows.Add(dr); oDB1_Z.InsertRecord(i); oDB1_Z.SetValue("U_NO", i, (i + 1).ToString());//"번호"; oDB1_Z.SetValue("U_IDX", i, (i).ToString());//"DataTable 고유ID"; oDB1_Z.SetValue("LineId", i, oDB1_O.GetValue("LineId", i));//"원본라인번호"; oDB1_Z.SetValue("U_DELVCD", i, oDB1_O.GetValue("U_DELVCD", i).Trim()); //"배달코드"; oDB1_Z.SetValue("U_RDEPT", i, oDB1_O.GetValue("U_RDEPT", i).Trim()); //"부서"; oDB1_Z.SetValue("U_PAPERTP", i, oDB1_O.GetValue("U_PAPERTP", i).Trim()); //"지종"; oDB1_Z.SetValue("U_PAYCD", i, oDB1_O.GetValue("U_PAYCD", i).Trim()); //"요금제코드"; oDB1_Z.SetValue("U_PAYNM", i, oDB1_O.GetValue("U_PAYNM", i).Trim()); //"요금제명"; oDB1_Z.SetValue("U_TEL", i, oDB1_O.GetValue("U_TEL", i).Trim()); //"연락처"; oDB1_Z.SetValue("U_MOBILE", i, oDB1_O.GetValue("U_MOBILE", i).Trim()); //"휴대폰"; oDB1_Z.SetValue("U_ADDR1", i, oDB1_O.GetValue("U_ADDR1", i).Trim()); //"주소1"; oDB1_Z.SetValue("U_ADDR2", i, oDB1_O.GetValue("U_ADDR2", i).Trim()); //"주소2"; oDB1_Z.SetValue("U_ADDR1_D", i, oDB1_O.GetValue("U_ADDR1_D", i).Trim()); //"주소1"; oDB1_Z.SetValue("U_ADDR2_D", i, oDB1_O.GetValue("U_ADDR2_D", i).Trim()); //"주소2"; oDB1_Z.SetValue("U_CENTCD", i, oDB1_O.GetValue("U_CENTCD", i).Trim()); //"지국"; oDB1_Z.SetValue("U_CENTNM", i, oDB1_O.GetValue("U_CENTNM", i).Trim()); //"지국명"; oDB1_Z.SetValue("U_DELVFR", i, oDB1_O.GetValue("U_DELVFR", i).Trim()); //"배달시작일"; oDB1_Z.SetValue("U_DELVTO", i, oDB1_O.GetValue("U_DELVTO", i).Trim()); //"배달종료일"; oDB1_Z.SetValue("U_DELVCNT", i, oDB1_O.GetValue("U_DELVCNT", i).Trim()); //"배달부수"; oDB1_Z.SetValue("U_METHOD", i, oDB1_O.GetValue("U_METHOD", i).Trim()); //"가입방법"; oDB1_Z.SetValue("U_SAILCD", i, oDB1_O.GetValue("U_SAILCD", i).Trim()); //"유치자"; oDB1_Z.SetValue("U_SAILNM", i, oDB1_O.GetValue("U_SAILNM", i).Trim()); //"유치자"; oDB1_Z.SetValue("U_STATUS", i, oDB1_O.GetValue("U_STATUS", i).Trim()); //"배달상태"; oDB1_Z.SetValue("U_SDEPT", i, oDB1_O.GetValue("U_SDEPT", i).Trim()); //"유치부서"; oDB1_Z.SetValue("U_NOTE", i, oDB1_O.GetValue("U_NOTE", i).Trim()); //"배달상세"; oDB1_Z.SetValue("U_JOINDT", i, oDB1_O.GetValue("U_JOINDT", i).Trim()); //"가입일자"; oDB1_Z.SetValue("U_CLOSEDT", i, oDB1_O.GetValue("U_CLOSEDT", i).Trim()); //"해지일자"; oDB1_Z.SetValue("U_USERSG1", i, oDB1_O.GetValue("U_USERSG1", i).Trim()); //"등록자"; oDB1_Z.SetValue("U_READTP", i, oDB1_O.GetValue("U_READTP", i).Trim()); //"등록자"; oDB1_Z.SetValue("U_BTEL1", i, oDB1_O.GetValue("U_BTEL1", i).Trim()); //"분국전화1"; oDB1_Z.SetValue("U_BTEL2", i, oDB1_O.GetValue("U_BTEL2", i).Trim()); //"분국전화2"; } } //if (gDs.Tables[oForm.UniqueID + "_Call"] != null) // gDs.Tables[oForm.UniqueID + "_Call"].Clear(); //else // gDs.Tables[oForm.UniqueID + "_Call"] = SetParameterDataTableSchema(oForm.UniqueID+"Call"); if (gDs.Tables.Contains(oForm.UniqueID + "_Call")) { gDs.Tables[oForm.UniqueID + "_Call"].Rows.Clear(); } else { System.Data.DataTable dt = SetParameterDataTableSchema(oForm.UniqueID + "_Call"); gDs.Tables.Add(dt); } if (oDB2_O.Size > 0 && oDB2_O.GetValue("U_DELVCD", 0).ToString().Trim() != "") { for (int i = 0; i < oDB2_O.Size; i++) { System.Data.DataRow dr; // 데이터 필터를 위해 DataTable에 담는다. dr = gDs.Tables[oForm.UniqueID + "_Call"].NewRow(); dr["IDX"] = i; //"DataTable 고유ID"; dr["LINEID"] = oDB2_O.GetValue("LineId", i);//"원본라인번호"; dr["DELVCD"] = oDB2_O.GetValue("U_DELVCD", i).Trim(); //"배달코드" dr["CALLTP"] = oDB2_O.GetValue("U_CALLTP", i).Trim(); //"콜유형" dr["MEMO"] = oDB2_O.GetValue("U_MEMO", i).Trim(); //"접수내용" dr["RECVID"] = oDB2_O.GetValue("U_RECVID", i).Trim(); //"접수자ID" dr["RECVNM"] = oDB2_O.GetValue("U_RECVNM", i).Trim(); //"접수자명" dr["RECVDT"] = oDB2_O.GetValue("U_RECVDT", i).Trim(); //"접수일자" dr["RECVTI"] = oDB2_O.GetValue("U_RECVTI", i).Trim(); //"접수시간" dr["RECVTI"] = oDB2_O.GetValue("U_RECVTI", i).Trim(); //"접수시간" dr["PROCID"] = oDB2_O.GetValue("U_PROCID", i).Trim(); //"처리자ID" dr["PROCNM"] = oDB2_O.GetValue("U_PROCNM", i).Trim(); //"처리자명" dr["PROCDT"] = oDB2_O.GetValue("U_PROCDT", i).Trim(); //"처리일자" dr["PROSTAT"] = oDB2_O.GetValue("U_PROSTAT", i).Trim(); //"처리상태" dr["ROWSTATE"] = ""; // 기본: "", 수정: M, 신규: I, 삭제: D gDs.Tables[oForm.UniqueID + "_Call"].Rows.Add(dr); } } //else //{ // gDs.Tables[oForm.UniqueID + "_Call"].Rows.Clear(); //} oMatrix = (SAPbouiCOM.Matrix)oForm.Items.Item("mtx1_DUMY").Specific; oMatrix.LoadFromDataSource(); oMatrix = (SAPbouiCOM.Matrix)oForm.Items.Item("mtx2_DUMY").Specific; oMatrix.Clear(); //oMatrix.LoadFromDataSource(); // 데이터 로드하면 메트릭스 선택된행 값 초기화 함.(중요) gDeliverySelect = -1; } catch (Exception) { throw; } }
private void FindData(SAPbouiCOM.Form oForm) { string strExpr = string.Empty; string strSort = string.Empty; /* 조회조건 */ string strF_DEPT = string.Empty; // 구독부서 string strF_TEL = string.Empty; // 전화번호 string strF_ADDR = string.Empty; // 주소 string strF_CENTER = string.Empty; // 지국(분국) string strF_STATUS = string.Empty; // 상태 System.Data.DataRow[] findRows = null; StringBuilder sb = new StringBuilder(); int i = 0; try { /*조회조건 값 가져오기 */ oUDS = oForm.DataSources.UserDataSources; strF_DEPT = oUDS.Item("edtF_RDEPT").Value; strF_TEL = oUDS.Item("edtF_TEL").Value; strF_ADDR = oUDS.Item("edtF_ADDR").Value; strF_CENTER = oUDS.Item("edtF_CENT").Value; strF_STATUS = oUDS.Item("cboF_STATU").Value; oDB1_Z = (SAPbouiCOM.DBDataSource)oForm.DataSources.DBDataSources.Item("@KIS_SO00301Z_HRD"); oDB1_Z.Clear(); sb.Append(" 1 = 1 "); if (!string.IsNullOrEmpty(strF_DEPT)) //구독부서 sb.AppendFormat(" AND RDEPT LIKE '%{0}%' ", strF_DEPT); if (!string.IsNullOrEmpty(strF_TEL)) //전화번호 sb.AppendFormat(" AND TEL LIKE '%{0}%' ", strF_TEL); if (!string.IsNullOrEmpty(strF_ADDR)) //주소 sb.AppendFormat(" AND (ADDR1 LIKE '%{0}%' OR ADDR1_D LIKE '%{0}%' OR ADDR2 LIKE '%{0}%' OR ADDR2_D LIKE '%{0}%' ) ", strF_ADDR); if (!string.IsNullOrEmpty(strF_CENTER)) //지국 sb.AppendFormat(" AND CENTNM LIKE '%{0}%' ", strF_CENTER); if (!string.IsNullOrEmpty(strF_STATUS)) //상태 sb.AppendFormat(" AND STATUS = '{0}' ", strF_STATUS); // 정렬 기준 findRows = gDs.Tables[oForm.UniqueID + "_Deliver"].Select(sb.ToString(), "LINEID ASC"); foreach (System.Data.DataRow dr in findRows) { oDB1_Z.InsertRecord(i); oDB1_Z.SetValue("U_NO", i, (i + 1).ToString()); oDB1_Z.SetValue("U_IDX", i, dr["IDX"].ToString()); //"데이터테이블 고유번호 IDX"; oDB1_Z.SetValue("LineId", i, dr["LineId"].ToString());//"원본라인번호"; oDB1_Z.SetValue("U_DELVCD", i, dr["DELVCD"].ToString()); //"배달코드"; oDB1_Z.SetValue("U_RDEPT", i, dr["RDEPT"].ToString()); //"부서"; oDB1_Z.SetValue("U_PAPERTP", i, dr["PAPERTP"].ToString()); //"지종"; oDB1_Z.SetValue("U_READTP", i, dr["READTP"].ToString()); //"독자구분"; oDB1_Z.SetValue("U_PAYCD", i, dr["PAYCD"].ToString()); //"요금제코드"; oDB1_Z.SetValue("U_PAYNM", i, dr["PAYNM"].ToString()); //"요금제명"; oDB1_Z.SetValue("U_TEL", i, dr["TEL"].ToString()); //"연락처"; oDB1_Z.SetValue("U_MOBILE", i, dr["MOBILE"].ToString()); //"휴대폰"; oDB1_Z.SetValue("U_ADDR1", i, dr["ADDR1"].ToString()); //"주소1"; oDB1_Z.SetValue("U_ADDR2", i, dr["ADDR2"].ToString()); //"주소2"; oDB1_Z.SetValue("U_ADDR1_D", i, dr["ADDR1_D"].ToString()); //"주소1상세"; oDB1_Z.SetValue("U_ADDR2_D", i, dr["ADDR2_D"].ToString()); //"주소2상세"; oDB1_Z.SetValue("U_CENTCD", i, dr["CENTCD"].ToString()); //"지국"; oDB1_Z.SetValue("U_CENTNM", i, dr["CENTNM"].ToString()); //"지국명"; oDB1_Z.SetValue("U_DELVFR", i, FN.SetDateFormatToDB(dr["DELVFR"].ToString(), FN.eDateType.n_YYYYMMDD)); //"배달시작일"; oDB1_Z.SetValue("U_DELVTO", i, FN.SetDateFormatToDB(dr["DELVTO"].ToString(), FN.eDateType.n_YYYYMMDD)); //"배달종료일"; oDB1_Z.SetValue("U_DELVCNT", i, dr["DELVCNT"].ToString()); //"배달부수"; oDB1_Z.SetValue("U_METHOD", i, dr["METHOD"].ToString()); //"가입방법"; oDB1_Z.SetValue("U_SAILCD", i, dr["SAILCD"].ToString()); //"유치자"; oDB1_Z.SetValue("U_SAILNM", i, dr["SAILNM"].ToString()); //"유치자"; oDB1_Z.SetValue("U_SDEPT", i, dr["SDEPT"].ToString()); //"유치부서"; oDB1_Z.SetValue("U_NOTE", i, dr["NOTE"].ToString()); //"배달상세"; oDB1_Z.SetValue("U_STATUS", i, dr["STATUS"].ToString()); //"배달상태"; oDB1_Z.SetValue("U_JOINDT", i, FN.SetDateFormatToDB(dr["JOINDT"].ToString(), FN.eDateType.n_YYYYMMDD)); //"가입일자"; oDB1_Z.SetValue("U_CLOSEDT", i, FN.SetDateFormatToDB(dr["CLOSEDT"].ToString(), FN.eDateType.n_YYYYMMDD)); //"중지일자"; oDB1_Z.SetValue("U_USERSG1", i, dr["USERSG1"].ToString()); //"등록자"; oDB1_Z.SetValue("U_BTEL1", i, dr["BTEL1"].ToString()); //"분국전화1"; oDB1_Z.SetValue("U_BTEL2", i, dr["BTEL2"].ToString()); //"분국전화1"; i += 1; } oMatrix = (SAPbouiCOM.Matrix)oForm.Items.Item("mtx1_DUMY").Specific; oMatrix.LoadFromDataSource(); } catch (Exception) { throw; } finally { findRows = null; } }
}//fin MenuEvent private void ActualizarRegistrosWS() { String sCode = ""; //SqlDataAdapter cmd2; System.Data.DataTable resultDataTable; //System.Data.DataTable resultDataTable1; Int32 i; Boolean _return; SAPbouiCOM.GridColumn oColumn; String sDocEntry = ""; SAPbobsCOM.Recordset orsAux; String RUTEmpresa = ""; String URL = ""; String URLFinal; String[] TipoDocs = { "33", "34", "39", "41", "43", "46", "52", "56", "61", "110", "111", "112" }; String UserWS = ""; String PassWS = ""; String sMessage; String xmlCAF = ""; XmlDocument oXml; String Desde = ""; String Hasta = ""; String Fecha = ""; try { ActualizarGrilla(); orsAux = (SAPbobsCOM.Recordset)(FCmpny.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)); if (GlobalSettings.RunningUnderSQLServer) { s = @"SELECT U_BuscarCAF, ISNULL(U_UserWSCL,'') 'UserWS', ISNULL(U_PassWSCL,'') 'PassWS' FROM [@VID_FEPARAM] WHERE Code = '1'"; } else { s = @"SELECT ""U_BuscarCAF"", IFNULL(""U_UserWSCL"",'') ""UserWS"", IFNULL(""U_PassWSCL"",'') ""PassWS"" FROM ""@VID_FEPARAM"" WHERE ""Code"" = '1'"; } orsAux.DoQuery(s); if (orsAux.RecordCount == 0) { throw new Exception("Debe parametrizar el addon"); } else if (((System.String)orsAux.Fields.Item("U_BuscarCAF").Value).Trim() == "") { throw new Exception("Debe ingresar http para buscar CAF en paramatros del addon"); } else { URL = ((System.String)orsAux.Fields.Item("U_BuscarCAF").Value).Trim(); if (((System.String)orsAux.Fields.Item("UserWS").Value).Trim() != "") { UserWS = Funciones.DesEncriptar(((System.String)orsAux.Fields.Item("UserWS").Value).Trim()); } if (((System.String)orsAux.Fields.Item("PassWS").Value).Trim() != "") { PassWS = Funciones.DesEncriptar(((System.String)orsAux.Fields.Item("PassWS").Value).Trim()); } } if (bMultiSoc) { if (GlobalSettings.RunningUnderSQLServer) { s = @"SELECT DocEntry, REPLACE(REPLACE(ISNULL(U_RUT,''),'.',''),'-','') TaxIdNum FROM [@VID_FEMULTISOC] WHERE U_Habilitada = 'Y'"; } else { s = @"SELECT TO_VARCHAR(""DocEntry"") ""DocEntry"", REPLACE(REPLACE(IFNULL(""U_RUT"",''),'.',''),'-','') ""TaxIdNum"" FROM ""@VID_FEMULTISOC"" WHERE ""U_Habilitada"" = 'Y' "; } } else { if (GlobalSettings.RunningUnderSQLServer) { s = @"SELECT REPLACE(REPLACE(ISNULL(TaxIdNum,''),'-',''),'.','') TaxIdNum FROM OADM"; } else { s = @"SELECT REPLACE(REPLACE(IFNULL(""TaxIdNum"",''),'-',''),'.','') ""TaxIdNum"" FROM ""OADM"" "; } } oRecordSet.DoQuery(s); if (oRecordSet.RecordCount > 0) { while (!oRecordSet.EoF) { try { RUTEmpresa = ((System.String)oRecordSet.Fields.Item("TaxIdNum").Value).Trim(); if (bMultiSoc) { sDocEntry = Convert.ToString((System.Int32)(oRecordSet.Fields.Item("DocEntry").Value)); } else { sDocEntry = "0"; } foreach (String xTipo in TipoDocs) { try { //http://portal1.easydoc.cl/consulta/generaciondte.aspx?RUT={0}&TIPODTE={1}&OP=22 URLFinal = URL; URLFinal = String.Format(URLFinal, RUTEmpresa, xTipo); WebRequest request = WebRequest.Create(URLFinal); if ((UserWS != "") && (PassWS != "")) { request.Credentials = new NetworkCredential(UserWS, PassWS); } request.Method = "POST"; string postData = "";//** xmlDOC.InnerXml; byte[] byteArray = Encoding.UTF8.GetBytes(postData); request.ContentType = "text/xml"; request.ContentLength = byteArray.Length; Stream dataStream = request.GetRequestStream(); dataStream.Write(byteArray, 0, byteArray.Length); dataStream.Close(); WebResponse response = request.GetResponse(); Console.WriteLine(((HttpWebResponse)(response)).StatusDescription); dataStream = response.GetResponseStream(); StreamReader reader = new StreamReader(dataStream); string responseFromServer = reader.ReadToEnd(); reader.Close(); dataStream.Close(); response.Close(); sMessage = responseFromServer; request = null; response = null; GC.Collect(); GC.WaitForPendingFinalizers(); if (sMessage != "") { xmlCAF = sMessage; xmlCAF = xmlCAF.Replace(@"<?xml version=""1.0""?>", ""); //xmlCAF = xmlCAF.Replace("\n", ""); //xmlCAF = xmlCAF.Replace(@"\", ""); //xmlCAF = xmlCAF.Replace(Environment.NewLine, ""); oXml = new XmlDocument(); oXml.LoadXml(xmlCAF); var DA = oXml.GetElementsByTagName("DA"); var RNG = ((XmlElement)DA[0]).GetElementsByTagName("RNG"); foreach (XmlElement nodo in RNG) { var nDesde = nodo.GetElementsByTagName("D"); var nHasta = nodo.GetElementsByTagName("H"); Desde = (System.String)(nDesde[0].InnerText); Hasta = (System.String)(nHasta[0].InnerText); } var CAF = oXml.GetElementsByTagName("CAF"); var DA2 = ((XmlElement)CAF[0]).GetElementsByTagName("DA"); foreach (XmlElement nodo in CAF) { var nFecha = nodo.GetElementsByTagName("FA"); Fecha = (System.String)(nFecha[0].InnerText); } if (GlobalSettings.RunningUnderSQLServer) { s = @"SELECT Code FROM [@VID_FECAF] WHERE U_TipoDoc = '{0}' AND U_Desde = {1} AND U_Hasta = {2} {3}"; } else { s = @"SELECT ""Code"" FROM ""@VID_FECAF"" WHERE ""U_TipoDoc"" = '{0}' AND ""U_Desde"" = {1} AND ""U_Hasta"" = {2} {3}"; } s = String.Format(s, xTipo, Desde, Hasta, (bMultiSoc ? " AND U_BaseMul = " + sDocEntry : "")); orsAux.DoQuery(s); if (orsAux.RecordCount == 0) //no existe en la base de datos { sCode = Funciones.sNuevoDocEntryLargo("@VID_FECAF", GlobalSettings.RunningUnderSQLServer); oDBDSH.Clear(); oDBDSH.InsertRecord(0); oDBDSH.SetValue("Code", 0, sCode); //OutLog("Code -> " + oDBDSH.GetValue("Code",0)); oDBDSH.SetValue("U_TipoDoc", 0, xTipo); //OutLog("TipoDoc -> " + oDBDSH.GetValue("U_TipoDoc", 0)); oDBDSH.SetValue("U_Desde", 0, Desde); //OutLog("Desde -> " + oDBDSH.GetValue("U_Desde", 0)); oDBDSH.SetValue("U_Hasta", 0, Hasta); //OutLog("Hasta -> " + oDBDSH.GetValue("U_Hasta", 0)); DateTime oFecha; DateTime.TryParse(Fecha, out oFecha); oDBDSH.SetValue("U_Fecha", 0, oFecha.ToString("yyyyMMdd")); //OutLog("Fecha -> " + oDBDSH.GetValue("U_Fecha", 0)); oDBDSH.SetValue("U_BaseMul", 0, sDocEntry); //OutLog("BaseMul -> " + oDBDSH.GetValue("U_BaseMul", 0)); oDBDSH.SetValue("U_CAF", 0, xmlCAF); //OutLog("CAF -> " + oDBDSH.GetValue("U_CAF", 0)); oDBDSH.SetValue("U_Utilizados", 0, "0"); //OutLog("Utilizados -> " + oDBDSH.GetValue("U_Utilizados", 0)); var iDif = (Convert.ToInt32(Hasta) - Convert.ToInt32(Desde)) + 1; oDBDSH.SetValue("U_Asignables", 0, iDif.ToString()); //OutLog("Asignables -> " + oDBDSH.GetValue("U_Asignables", 0)); oDBDSH.SetValue("U_FolioDesde", 0, Desde); //OutLog("FolioDesde -> " + oDBDSH.GetValue("U_FolioDesde", 0)); _return = Funciones.CAFAdd(oDBDSH); if (_return) { FSBOApp.StatusBar.SetText("CAF Registrado, TipoDoc " + xTipo, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Success); } else { FSBOApp.StatusBar.SetText("CAF no se ha registrado, TipoDoc " + xTipo, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error); } } } else { FSBOApp.StatusBar.SetText("No se ha encontrado CAF para documento " + xTipo, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Warning); } } catch (Exception v) { OutLog("Error actualizar CAF Tipo " + xTipo + " RUT Empresa " + RUTEmpresa + ", " + v.Message + ", TRACE " + v.StackTrace); FSBOApp.StatusBar.SetText("Error actualizar CAF Tipo " + xTipo + " RUT Empresa " + RUTEmpresa + ", " + v.Message, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error); } }//Fin Foreach FSBOApp.StatusBar.SetText("CAF actualizados", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Success); } catch (Exception v) { OutLog("Error actualizar empresa RUT " + RUTEmpresa + ", " + v.Message + ", TRACE " + v.StackTrace); FSBOApp.StatusBar.SetText("Error actualizar empresa RUT " + RUTEmpresa + ", " + v.Message, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error); } oRecordSet.MoveNext(); } ActualizarGrilla(); } else { FSBOApp.StatusBar.SetText("Debe ingresar datos de conexion", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error); } } catch (Exception e) { FSBOApp.MessageBox(e.Message + " ** Trace: " + e.StackTrace, 1, "Ok", "", ""); OutLog("ActualizarRegistros: " + e.Message + " ** Trace: " + e.StackTrace); } }//fin ActualizarRegistros
private void FindSubData(SAPbouiCOM.Form oForm, int pRowIdx, string Type = "") { string strDeliveryCode = string.Empty; string strExpr = string.Empty; string strSort = string.Empty; System.Data.DataRow[] findRows = null; StringBuilder sb = new StringBuilder(); int i = 0; try { oForm.Freeze(true); oMatrix = ((SAPbouiCOM.Matrix)(oForm.Items.Item("mtx1_DUMY").Specific)); oDB2_Z = (SAPbouiCOM.DBDataSource)oForm.DataSources.DBDataSources.Item("@KIS_SO00302Z_HRD"); oDB2_Z.Clear(); if (oMatrix.VisualRowCount > 0) { strDeliveryCode = FN.GetMatirxCellValue(ref oMatrix, "U_DELVCD", pRowIdx); sb.Append(" 1 = 1 "); if (!string.IsNullOrEmpty(strDeliveryCode)) { sb.AppendFormat(" AND DELVCD = '{0}' ", strDeliveryCode); } if (Type == "") { sb.AppendFormat(" AND DELVCD = '{0}' ", strDeliveryCode); sFindTY = "F"; } else { sFindTY = ""; } findRows = gDs.Tables[oForm.UniqueID + "_Call"].Select(sb.ToString(), "IDX DESC"); oMatrix = (SAPbouiCOM.Matrix)oForm.Items.Item("mtx2_DUMY").Specific; foreach (System.Data.DataRow dr in findRows) { oDB2_Z.InsertRecord(i); oDB2_Z.SetValue("U_NO", i, (i + 1).ToString()); oDB2_Z.SetValue("U_IDX", i, dr["IDX"].ToString());//"데이터테이블 고유번호 IDX"; oDB2_Z.SetValue("LineId", i, dr["LINEID"].ToString());//"원본라인번호"; oDB2_Z.SetValue("U_DELVCD", i, dr["DELVCD"].ToString());//"배달코드" oDB2_Z.SetValue("U_CALLTP", i, dr["CALLTP"].ToString());//"콜유형" oDB2_Z.SetValue("U_MEMO", i, dr["MEMO"].ToString());//"접수내용" oDB2_Z.SetValue("U_RECVID", i, dr["RECVID"].ToString());//"접수자ID" oDB2_Z.SetValue("U_RECVNM", i, dr["RECVNM"].ToString());//"접수자명" oDB2_Z.SetValue("U_RECVDT", i, dr["RECVDT"].ToString());//"접수일자" oDB2_Z.SetValue("U_RECVTI", i, dr["RECVTI"].ToString());//"접수시간" oDB2_Z.SetValue("U_PROCID", i, dr["PROCID"].ToString());//"처리자ID" oDB2_Z.SetValue("U_PROCNM", i, dr["PROCNM"].ToString());//"처리자명" oDB2_Z.SetValue("U_PROCDT", i, dr["PROCDT"].ToString());//"처리일자" oDB2_Z.SetValue("U_PROSTAT", i, dr["PROSTAT"].ToString());//"처리상태" i += 1; } oMatrix = (SAPbouiCOM.Matrix)oForm.Items.Item("mtx2_DUMY").Specific; oMatrix.LoadFromDataSource(); //접수자 ID와 로그인 아이디가 다를경우 수정불가 for (int j = 0; j < oMatrix.VisualRowCount; j++) { if ((oMatrix.GetCellSpecific("U_RECVID", j + 1).Value.Trim() == B1Connections.diCompany.UserName.ToString()) && (sFindTY == "F")) { oMatrix.CommonSetting.SetCellEditable(j + 1, gCallTp_IDX, true); oMatrix.CommonSetting.SetCellEditable(j + 1, gComment_IDX, true); } else { oMatrix.CommonSetting.SetCellEditable(j + 1, gCallTp_IDX, false); oMatrix.CommonSetting.SetCellEditable(j + 1, gComment_IDX, false); } } } } catch (Exception) { oForm.Freeze(false); throw; } finally { oForm.Freeze(false); findRows = null; } }
private void GuardarRegistros() { TFunctions Reg; Int32 i; SAPbouiCOM.EditText oEditText; SAPbouiCOM.ComboBox oComboBox; String DocEntry, ProcNomE, ProcNomD, ProcNomR, ProcNomC, ProcNomL, ProcNomS, Hab, TipoDoc, CantLineas, ProcNomDe; Int32 _return = 0; try { Reg = new TFunctions(); Reg.SBO_f = FSBOf; oMtx.FlushToDataSource(); i = 1; while (i <= oMtx.RowCount) { oEditText = (EditText)(oMtx.Columns.Item("DocEntry").Cells.Item(i).Specific); DocEntry = (System.String)(oEditText.Value).Trim(); oEditText = (EditText)(oMtx.Columns.Item("ProcNomE").Cells.Item(i).Specific); ProcNomE = (System.String)(oEditText.Value).Trim(); oEditText = (EditText)(oMtx.Columns.Item("ProcNomD").Cells.Item(i).Specific); ProcNomD = (System.String)(oEditText.Value).Trim(); oEditText = (EditText)(oMtx.Columns.Item("ProcNomR").Cells.Item(i).Specific); ProcNomR = (System.String)(oEditText.Value).Trim(); oEditText = (EditText)(oMtx.Columns.Item("ProcNomC").Cells.Item(i).Specific); ProcNomC = (System.String)(oEditText.Value).Trim(); //oEditText = (EditText)(oMtx.Columns.Item("ProcNomDe").Cells.Item(i).Specific); //ProcNomDe = (System.String)(oEditText.Value).Trim(); //oEditText = (EditText)(oMtx.Columns.Item("ProcNomL").Cells.Item(i).Specific); //ProcNomL = (System.String)(oEditText.Value).Trim(); //oEditText = (EditText)(oMtx.Columns.Item("ProcNomS").Cells.Item(i).Specific); //ProcNomS = (System.String)(oEditText.Value).Trim(); oComboBox = (ComboBox)(oMtx.Columns.Item("Habili").Cells.Item(i).Specific); Hab = oComboBox.Value; oComboBox = (ComboBox)(oMtx.Columns.Item("TipoDoc").Cells.Item(i).Specific); TipoDoc = oComboBox.Value; //oComboBox = (ComboBox)(oMtx.Columns.Item("TipoDocPE").Cells.Item(i).Specific); //TipoDocPE = oComboBox.Value; oEditText = (EditText)(oMtx.Columns.Item("CantLineas").Cells.Item(i).Specific); CantLineas = (System.String)(oEditText.Value).Trim(); oDBDSH.Clear(); oDBDSH.InsertRecord(0); oDBDSH.SetValue("DocEntry", 0, DocEntry); oDBDSH.SetValue("U_TipoDoc", 0, TipoDoc); //oDBDSH.SetValue("U_TipoDocPE", 0, TipoDocPE); oDBDSH.SetValue("U_Habili", 0, Hab); oDBDSH.SetValue("U_ProcNomE", 0, ProcNomE); oDBDSH.SetValue("U_ProcNomD", 0, ProcNomD); oDBDSH.SetValue("U_ProcNomR", 0, ProcNomR); oDBDSH.SetValue("U_ProcNomC", 0, ProcNomC); //oDBDSH.SetValue("U_ProcNomDe", 0, ProcNomDe); //oDBDSH.SetValue("U_ProcNomL", 0, ProcNomL); //oDBDSH.SetValue("U_ProcNomS", 0, ProcNomS); oDBDSH.SetValue("U_CantLineas", 0, CantLineas); if (DocEntry.Trim() == "") { _return = Reg.FEPROCAdd(oDBDSH); } else { _return = Reg.FEPROCUpt(oDBDSH); } if (_return != 0) { oEditText = (EditText)(oMtx.Columns.Item("DocEntry").Cells.Item(i).Specific); oEditText.Value = _return.ToString(); FSBOApp.StatusBar.SetText("Se ha guardado regsitro Tipo Documento " + TipoDoc, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Success); } else { FSBOApp.StatusBar.SetText("No se ha guardado regsitro Tipo Documento " + TipoDoc, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error); } i++; } oMtx.FlushToDataSource(); oMtx.AutoResizeColumns(); if (_return > 0) { oForm.Mode = BoFormMode.fm_OK_MODE; } } catch (Exception e) { FSBOApp.MessageBox(e.Message + " ** Trace: " + e.StackTrace, 1, "Ok", "", ""); OutLog("GuardarRegistros: " + e.Message + " ** Trace: " + e.StackTrace); } }//fin GuardarRegistro
public new bool InitForm(string uid, string xmlPath, ref Application application, ref SAPbobsCOM.Company company, ref CSBOFunctions SBOFunctions, ref TGlobalVid _GlobalSettings) { Int32 i; TFunctions Param; bool Result = base.InitForm(uid, xmlPath, ref application, ref company, ref SBOFunctions, ref _GlobalSettings); try { oRecordSet = (SAPbobsCOM.Recordset)(FCmpny.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)); Lista = new List <string>(); FSBOf.LoadForm(xmlPath, "VID_FEMULTISOC.srf", uid); //EnableCrystal := true; oForm = FSBOApp.Forms.Item(uid); oForm.Freeze(true); oForm.AutoManaged = true; oForm.SupportedModes = -1; // afm_All VID_DelRow = false; VID_DelRowOK = false; Param = new TFunctions(); Param.SBO_f = FSBOf; //oForm.DataBrowser.BrowseBy := "DocEntry"; oDBDSH = oForm.DataSources.DBDataSources.Item("@VID_FEMULTISOC"); //oDBDSBases := oForm.DataSources.DBDataSources.Item("@VID_FEMULTISOC"); // Ok Ad Fnd Vw Rq Sec // Lista.Add('DocEntry , f, f, t, f, r, 1'); // Lista.Add('Desde , f, f, f, f, r, 1'); // Lista.Add('mtx , f, t, f, f, n, 1'); // FSBOf.SetAutoManaged(var oForm, Lista); oMtx = (Matrix)(oForm.Items.Item("mtx").Specific); oMtx.AutoResizeColumns(); //EditText(oForm.Items.Item('CardCode').Specific).Active := True; if (GlobalSettings.RunningUnderSQLServer) { s = @"select U_Sociedad ,U_RUT ,U_Servidor ,U_Base ,U_Usuario ,U_Password ,DocEntry ,U_Habilitada from [@VID_FEMULTISOC]"; } else { s = @"select ""U_Sociedad"" ,""U_RUT"" ,""U_Servidor"" ,""U_Base"" ,""U_Usuario"" ,""U_Password"" ,""DocEntry"" ,""U_Habilitada"" from ""@VID_FEMULTISOC"" "; } oRecordSet.DoQuery(s); if (oRecordSet.RecordCount == 0) { oMtx.AddRow(1, 1); oMtx.FlushToDataSource(); oMtx.AutoResizeColumns(); } else { i = 0; oDBDSH.Clear(); while (!oRecordSet.EoF) { oDBDSH.InsertRecord(i); oDBDSH.SetValue("U_Sociedad", i, (System.String)(oRecordSet.Fields.Item("U_Sociedad").Value)); oDBDSH.SetValue("U_RUT", i, (System.String)(oRecordSet.Fields.Item("U_RUT").Value)); oDBDSH.SetValue("U_Servidor", i, (System.String)(oRecordSet.Fields.Item("U_Servidor").Value)); oDBDSH.SetValue("U_Base", i, (System.String)(oRecordSet.Fields.Item("U_Base").Value)); oDBDSH.SetValue("U_Usuario", i, (System.String)(oRecordSet.Fields.Item("U_Usuario").Value)); //s = Param.DesEncriptar((System.String)(oRecordSet.Fields.Item("U_Password").Value).ToString().Trim()); oDBDSH.SetValue("U_Password", i, (System.String)(oRecordSet.Fields.Item("U_Password").Value)); oDBDSH.SetValue("DocEntry", i, Convert.ToString((System.Int32)(oRecordSet.Fields.Item("DocEntry").Value))); oDBDSH.SetValue("U_Habilitada", i, (System.String)(oRecordSet.Fields.Item("U_Habilitada").Value)); i++; oRecordSet.MoveNext(); } oDBDSH.InsertRecord(i); oMtx.LoadFromDataSource(); oMtx.AutoResizeColumns(); } oForm.Mode = BoFormMode.fm_OK_MODE; } catch (Exception e) { OutLog("InitForm: " + e.Message + " ** Trace: " + e.StackTrace); FSBOApp.MessageBox(e.Message + " ** Trace: " + e.StackTrace, 1, "Ok", "", ""); } oForm.Freeze(false); return(Result); }//fin InitForm
public new bool InitForm(string uid, string xmlPath, ref Application application, ref SAPbobsCOM.Company company, ref CSBOFunctions SBOFunctions, ref TGlobalVid _GlobalSettings) { Int32 i; //TFunctions Reg; bool Result = base.InitForm(uid, xmlPath, ref application, ref company, ref SBOFunctions, ref _GlobalSettings); try { oRecordSet = (SAPbobsCOM.Recordset)(FCmpny.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)); Lista = new List <string>(); FSBOf.LoadForm(xmlPath, "VID_FEPROCED.srf", uid); //EnableCrystal := true; oForm = FSBOApp.Forms.Item(uid); oForm.Freeze(true); oForm.AutoManaged = true; oForm.SupportedModes = -1; // afm_All // VID_DelRow := true; // VID_DelRowOK := true; //oForm.DataBrowser.BrowseBy := "Code"; oDBDSH = oForm.DataSources.DBDataSources.Item("@VID_FEPROCED"); // Ok Ad Fnd Vw Rq Sec Lista.Add("mtx , f, t, f, f, r, 1"); //Lista.Add('Name , f, t, t, f, r, 1'); //Lista.Add('CardCode , f, t, t, f, r, 1'); //FSBOf.SetAutoManaged(var oForm, Lista); //oCombo := ComboBox(oForm.Items.Item('TipDoc').Specific); //oCombo.ValidValues.Add('33', 'Factura'); //s := '1'; //oCombo.Select(s, BoSearchKey.psk_ByValue); // AddChooseFromList(); oMtx = (Matrix)(oForm.Items.Item("mtx").Specific); // oColumn := SAPbouiCOM.Column(oMtx.Columns.Item('V_0')); // oColumn.ChooseFromListUID := 'CFL0'; // oColumn.ChooseFromListAlias:= 'Code'; // oMtx.AutoResizeColumns(); if (GlobalSettings.RunningUnderSQLServer) { s = @"select DocEntry, ISNULL(U_TipoDoc,'') TipoDoc, ISNULL(U_ProcNomE,'') ProcNomE, ISNULL(U_ProcNomD,'') ProcNomD, ISNULL(U_ProcNomR,'') ProcNomR, ISNULL(U_ProcNomC,'') ProcNomC, ISNULL(U_ProcNomDe,'') ProcNomDe, ISNULL(U_ProcNomL,'') ProcNomL, ISNULL(U_ProcNomS,'') ProcNomS, ISNULL(U_Habili,'Y') 'Habilitada', ISNULL(U_CantLineas,0) 'CantLineas' from [@VID_FEPROCED]"; } else { s = @"select ""DocEntry"", IFNULL(""U_TipoDoc"",'') ""TipoDoc"", IFNULL(""U_ProcNomE"",'') ""ProcNomE"", IFNULL(""U_ProcNomD"",'') ""ProcNomD"", IFNULL(""U_ProcNomR"",'') ""ProcNomR"", IFNULL(""U_ProcNomC"",'') ""ProcNomC"", IFNULL(""U_ProcNomDe"",'') ""ProcNomDe"", IFNULL(""U_ProcNomL"",'') ""ProcNomL"", IFNULL(""U_ProcNomS"",'') ""ProcNomS"", IFNULL(""U_Habili"",'Y') ""Habilitada"", IFNULL(""U_CantLineas"",0) ""CantLineas"" from ""@VID_FEPROCED"" "; } oRecordSet.DoQuery(s); i = 0; oDBDSH.Clear(); while (!oRecordSet.EoF) { oDBDSH.InsertRecord(i); oDBDSH.SetValue("DocEntry", i, Convert.ToString((System.Int32)(oRecordSet.Fields.Item("DocEntry").Value))); oDBDSH.SetValue("U_TipoDoc", i, (System.String)(oRecordSet.Fields.Item("TipoDoc").Value)); //oDBDSH.SetValue("U_TipoDocPE", i, (System.String)(oRecordSet.Fields.Item("TipoDocPE").Value)); oDBDSH.SetValue("U_ProcNomE", i, (System.String)(oRecordSet.Fields.Item("ProcNomE").Value)); oDBDSH.SetValue("U_ProcNomD", i, (System.String)(oRecordSet.Fields.Item("ProcNomD").Value)); oDBDSH.SetValue("U_ProcNomR", i, (System.String)(oRecordSet.Fields.Item("ProcNomR").Value)); oDBDSH.SetValue("U_ProcNomC", i, (System.String)(oRecordSet.Fields.Item("ProcNomC").Value)); //oDBDSH.SetValue("U_ProcNomDe", i, (System.String)(oRecordSet.Fields.Item("ProcNomDe").Value)); //oDBDSH.SetValue("U_ProcNomL", i, (System.String)(oRecordSet.Fields.Item("ProcNomL").Value)); //oDBDSH.SetValue("U_ProcNomS", i, (System.String)(oRecordSet.Fields.Item("ProcNomS").Value)); oDBDSH.SetValue("U_Habili", i, (System.String)(oRecordSet.Fields.Item("Habilitada").Value)); oDBDSH.SetValue("U_CantLineas", i, Convert.ToString((System.Int32)(oRecordSet.Fields.Item("CantLineas").Value))); oRecordSet.MoveNext(); i++; } oDBDSH.InsertRecord(i); oDBDSH.SetValue("DocEntry", i, ""); oDBDSH.SetValue("U_TipoDoc", i, ""); //oDBDSH.SetValue("U_TipoDocPE", i, ""); oDBDSH.SetValue("U_ProcNomE", i, ""); oDBDSH.SetValue("U_ProcNomD", i, ""); oDBDSH.SetValue("U_ProcNomR", i, ""); oDBDSH.SetValue("U_ProcNomC", i, ""); //oDBDSH.SetValue("U_ProcNomDe", i, ""); //oDBDSH.SetValue("U_ProcNomL", i, ""); //oDBDSH.SetValue("U_ProcNomS", i, ""); oDBDSH.SetValue("U_Habili", i, "Y"); oDBDSH.SetValue("U_CantLineas", i, "60"); if (GlobalSettings.RunningUnderSQLServer) //TipoDoc { s = @"select U1.FldValue 'Code', U1.Descr 'Name' from UFD1 U1 join CUFD U0 on U0.TableID = U1.TableID and U0.FieldID = U1.FieldID where U1.TableID = '@VID_FEPROCED' and U0.AliasID = '{0}'"; } else { s = @"select U1.""FldValue"" ""Code"", U1.""Descr"" ""Name"" from ""UFD1"" U1 join ""CUFD"" U0 on U0.""TableID"" = U1.""TableID"" and U0.""FieldID"" = U1.""FieldID"" where U1.""TableID"" = '@VID_FEPROCED' and U0.""AliasID"" = '{0}' "; } s = String.Format(s, "TipoDoc"); oRecordSet.DoQuery(s); oColumn = (SAPbouiCOM.Column)(oMtx.Columns.Item("TipoDoc")); FSBOf.FillComboMtx(oColumn, ref oRecordSet, false); //((SAPbouiCOM.Column)oMtx.Columns.Item("TipoDocPE")).Visible = false; if (GlobalSettings.RunningUnderSQLServer) //Habilitado { s = @"select FldValue 'Code', Descr 'Name' from UFD1 where TableID = '@VID_FEPROCED' and FieldID = 2"; } else { s = @"select ""FldValue"" ""Code"", ""Descr"" ""Name"" from ""UFD1"" where ""TableID"" = '@VID_FEPROCED' and ""FieldID"" = 2"; } oRecordSet.DoQuery(s); oColumn = (SAPbouiCOM.Column)(oMtx.Columns.Item("Habili")); FSBOf.FillComboMtx(oColumn, ref oRecordSet, false); //EditText(oForm.Items.Item('CardCode').Specific).Active := True; oMtx.LoadFromDataSource(); oForm.Mode = BoFormMode.fm_OK_MODE; oMtx.AutoResizeColumns(); } catch (Exception e) { OutLog("InitForm: " + e.Message + " ** Trace: " + e.StackTrace); FSBOApp.MessageBox(e.Message + " ** Trace: " + e.StackTrace, 1, "Ok", "", ""); } oForm.Freeze(false); return(Result); }//fin InitForm
private void Guardar_Registros() { String CardCode; String CardName; String Activado; Int32 DocEntry; Int32 lRetCode; SAPbouiCOM.ProgressBar oProgressBar = null; oForm.Freeze(true); try { FSBOApp.StatusBar.SetText("Inicio de actualización lista negra", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Success); oProgressBar = FSBOApp.StatusBar.CreateProgressBar("Actualizando lista negra...", odt.Rows.Count, false); for (Int32 iCont_1 = 0; iCont_1 < odt.Rows.Count; iCont_1++) { if (((System.String)odt.GetValue("U_CardCode", iCont_1)).Trim().Length > 0) { oDBDSHeader.Clear(); oDBDSHeader.InsertRecord(0); DocEntry = ((System.Int32)odt.GetValue("DocEntry", iCont_1)); CardCode = ((System.String)odt.GetValue("U_CardCode", iCont_1)).Trim(); CardName = ((System.String)odt.GetValue("U_CardName", iCont_1)).Trim(); s = ((System.String)odt.GetValue("U_Activado", iCont_1)).Trim(); if (s == "") { Activado = "N"; } else { Activado = s; } oDBDSHeader.SetValue("U_CardCode", 0, CardCode); oDBDSHeader.SetValue("U_CardName", 0, CardName); oDBDSHeader.SetValue("U_Activado", 0, Activado); if (DocEntry != 0) { oDBDSHeader.SetValue("DocEntry", 0, DocEntry.ToString()); lRetCode = Funciones.UpdDataSourceInt1("VID_FELISTANE", oDBDSHeader, "", null, "", null, "", null); } else { lRetCode = Funciones.AddDataSourceInt1("VID_FELISTANE", oDBDSHeader, "", null, "", null, "", null); } if (lRetCode == 0) { FSBOApp.StatusBar.SetText("No se ha actualizado proveedor " + CardCode, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error); } else { FSBOApp.StatusBar.SetText("Se ha actualizado proveedor " + CardCode, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Success); } } oProgressBar.Value = iCont_1 + 1; } oProgressBar.Value = oProgressBar.Maximum; oForm.Mode = SAPbouiCOM.BoFormMode.fm_OK_MODE; CargarGrid(); } catch (Exception e) { FSBOApp.StatusBar.SetText(e.Message, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error); OutLog("Guardar_Registros: " + e.Message + " ** Trace: " + e.StackTrace); } finally { oForm.Freeze(false); oProgressBar.Stop(); FSBOf._ReleaseCOMObject(oProgressBar); } }
public new bool InitForm(string uid, string xmlPath, ref Application application, ref SAPbobsCOM.Company company, ref CSBOFunctions SBOFunctions, ref TGlobalVid _GlobalSettings) { //SAPbouiCOM.ComboBox oComboBox; bool Result = base.InitForm(uid, xmlPath, ref application, ref company, ref SBOFunctions, ref _GlobalSettings); try { oRecordSet = (SAPbobsCOM.Recordset)(FCmpny.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)); Lista = new List <string>(); FSBOf.LoadForm(xmlPath, "VID_FEDIST.srf", uid); //EnableCrystal := true; oForm = FSBOApp.Forms.Item(uid); oForm.Freeze(true); oForm.AutoManaged = true; oForm.SupportedModes = -1; // afm_All VID_DelRow = false; VID_DelRowOK = false; oForm.DataBrowser.BrowseBy = "DocEntry"; oDBDSH = oForm.DataSources.DBDataSources.Item("@VID_FEDIST"); oDBDSD = oForm.DataSources.DBDataSources.Item("@VID_FEDISTD"); oForm.EnableMenu("1282", false); // boton Crear // Ok Ad Fnd Vw Rq Sec Lista.Add("DocEntry , f, f, f, f, r, 1"); Lista.Add("Desde , f, t, f, f, r, 1"); Lista.Add("Hasta , f, t, f, f, r, 1"); Lista.Add("Hasta , f, t, f, f, r, 1"); Lista.Add("Sucursal , f, t, f, f, r, 1"); Lista.Add("RangoF , f, t, t, f, r, 1"); Lista.Add("TipoDoc , f, t, t, f, r, 1"); Lista.Add("btnDist , f, t, f, f, n, 1"); FSBOf.SetAutoManaged(oForm, Lista); //carga tipo documentos if (GlobalSettings.RunningUnderSQLServer) { s = @"select distinct U_TipoDoc 'Code', U_TipoDoc 'Name' from [@VID_FECAF]"; } else { s = @"select distinct ""U_TipoDoc"" ""Code"", ""U_TipoDoc"" ""Name"" from ""@VID_FECAF"" "; } oRecordSet.DoQuery(s); FSBOf.FillCombo((ComboBox)(oForm.Items.Item("TipoDoc").Specific), ref oRecordSet, true); //carga sucursales if (GlobalSettings.RunningUnderSQLServer) { s = "select Code, Name from [@VID_FESUC]"; } else { s = @"select ""Code"", ""Name"" from ""@VID_FESUC"" "; } oRecordSet.DoQuery(s); FSBOf.FillCombo((ComboBox)(oForm.Items.Item("Sucursal").Specific), ref oRecordSet, true); // AddChooseFromList(); oMtx = (Matrix)(oForm.Items.Item("mtx").Specific); // oColumn := SAPbouiCOM.Column(oMtx.Columns.Item('V_0')); // oColumn.ChooseFromListUID := 'CFL0'; // oColumn.ChooseFromListAlias:= 'Code'; if (GlobalSettings.RunningUnderSQLServer) { s = @"select C1.FldValue 'Code', C1.Descr 'Name' from CUFD C0 join UFD1 C1 on C1.TableID = C0.TableID and C1.FieldID = C0.FieldID where C0.TableID = '@VID_FEDISTD' and C0.AliasID = 'Estado'"; } else { s = @"select C1.""FldValue"" ""Code"", C1.""Descr"" ""Name"" from ""CUFD"" C0 join ""UFD1"" C1 on C1.""TableID"" = C0.""TableID"" and C1.""FieldID"" = C0.""FieldID"" where C0.""TableID"" = '@VID_FEDISTD' and C0.""AliasID"" = 'Estado' "; } oRecordSet.DoQuery(s); oColumn = (SAPbouiCOM.Column)(oMtx.Columns.Item("Estado")); FSBOf.FillComboMtx(oColumn, ref oRecordSet, false); oDBDSD.InsertRecord(0); oMtx.LoadFromDataSource(); oMtx.AutoResizeColumns(); //EditText(oForm.Items.Item('CardCode').Specific).Active := True; oForm.Mode = BoFormMode.fm_OK_MODE; } catch (Exception e) { OutLog("InitForm: " + e.Message + " ** Trace: " + e.StackTrace); FSBOApp.MessageBox(e.Message + " ** Trace: " + e.StackTrace, 1, "Ok", "", ""); } oForm.Freeze(false); return(Result); }//fin InitForm
private bool GetMonth() { int iRow; bool bModify = false; try { oForm.Freeze(true); oDB_M = oForm.DataSources.DBDataSources.Item("@KIS_FI0020M_HRD"); oDB_1 = oForm.DataSources.DBDataSources.Item("@KIS_FI00201_HRD"); oMatrix = (SAPbouiCOM.Matrix)oForm.Items.Item("mtx").Specific; //oMatrix.LoadFromDataSource(); oMatrix.Clear(); string Year = oForm.Items.Item("Code").Specific.value.Trim(); YYYYCode = Year; int Month = 1; string YYYYMM = ""; iRow = oMatrix.VisualRowCount; for (int i = 0; i < 12; i++) { if (Month.ToString().Length == 1) { YYYYMM = Year + "0" + Month.ToString(); } else { YYYYMM = Year + Month.ToString(); } oDB_1.InsertRecord(iRow); oDB_1.SetValue("U_YYYYMM", iRow, YYYYMM); Month = Month + 1; iRow += 1; bModify = true; if (i == 11) oDB_1.RemoveRecord(iRow); } if (bModify) { oMatrix.LoadFromDataSource(); } //B1Connections.theAppl.StatusBar.SetText("저장이 완료 되었습니다.", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning); //데이터 조회중입니다 } catch (Exception ex) { oForm.Freeze(false); B1Connections.theAppl.StatusBar.SetText("GetCostCenterList " + ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error); return false; } finally { oForm.Freeze(false); oRS = null; } return true; }
private void GetCostCenterList() { StringBuilder sb = new StringBuilder(); SAPbobsCOM.Recordset oRS = null; string expression = string.Empty; System.Data.DataRow[] foundRows; int iRow; bool bModify = false; try { oForm.Freeze(true); oDB_M = oForm.DataSources.DBDataSources.Item("@KIS_FI0010M_HRD"); oDB_1 = oForm.DataSources.DBDataSources.Item("@KIS_FI00101_HRD"); oMatrix = (SAPbouiCOM.Matrix)oForm.Items.Item("mtx").Specific; //oMatrix.LoadFromDataSource(); oMatrix.Clear(); FN.SetMatrixIsNullOrEmptDeleteRow(ref oForm, ref oMatrix, "U_PRCCD"); sDataTable = FN.SapDBDataSourceToSystemDataTable(oDB_1); oRS = (SAPbobsCOM.Recordset)B1Connections.diCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset); sb.Append(" SELECT Code,Name FROM [@KIS_CO0110M] \r"); if (FN.GetItemValue(ref oForm, "edtCOSTFR") != "" && FN.GetItemValue(ref oForm, "edtCOSTTO") != "") sb.Append(" WHERE Code BETWEEN '" + FN.GetItemValue(ref oForm, "edtCOSTFR") + "' AND '" + FN.GetItemValue(ref oForm, "edtCOSTTO") + "' \r"); B1Connections.theAppl.StatusBar.SetText("불러오기를 시작합니다.", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning); oRS.DoQuery(sb.ToString()); iRow = oMatrix.VisualRowCount; if (!oRS.EoF) { for (int i = 0; i < oRS.RecordCount; i++) { expression = "U_PRCCD = '" + oRS.Fields.Item("Code").Value.ToString() + "'"; foundRows = sDataTable.Select(expression); if (foundRows.Length < 1) { if (iRow != 0) oDB_1.InsertRecord(iRow-1); //oDB_1.SetValue("U_LINENUM", iRow, (iRow+1).ToString()); oDB_1.SetValue("U_PRCCD", iRow, oRS.Fields.Item("Code").Value.ToString()); oDB_1.SetValue("U_PRCNM", iRow, oRS.Fields.Item("Name").Value.ToString()); iRow += 1; bModify = true; } oRS.MoveNext(); } if (bModify) { oMatrix.LoadFromDataSource(); if (oForm.Mode == BoFormMode.fm_OK_MODE) oForm.Mode = BoFormMode.fm_UPDATE_MODE; } } B1Connections.theAppl.StatusBar.SetText("불러오기가 완료 되었습니다.", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning); //데이터 조회중입니다 } catch (Exception ex) { oForm.Freeze(false); B1Connections.theAppl.StatusBar.SetText("GetCostCenterList " + ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error); } finally { if (oRS != null) { oForm.Freeze(false); System.Runtime.InteropServices.Marshal.ReleaseComObject(oRS); oRS = null; } } }