private void btnSeacrh_ClickAfter(object sboObject, SBOItemEventArg pVal) { try { if (mObjPaymentServiceFactory.GetPaymentService().ExistConfiguration("SU_DEUDORA") && mObjPaymentServiceFactory.GetPaymentService().ExistConfiguration("SU_ACREEDORA")) { List <PaymentDTO> lLstPaymentDTO = mObjPaymentServiceFactory.GetPaymentService().GetPayments(txtAuction.Value, mIntSignature).ToList(); if (lLstPaymentDTO.Count() > 0) { mStrAuctionId = txtAuction.Value; LogService.WriteInfo("Carga de subastas correctamente"); } else { UIApplication.ShowWarning("No se encontraron registros para esa subasta"); LogService.WriteInfo("No se encontraron registros para esa subasta"); } FillMatrix(lLstPaymentDTO); } else { UIApplication.ShowMessageBox("Los registros SU_DEUDORA o SU_ACREEDORA no existen en la tabla de configuración"); LogService.WriteInfo("Los registros SU_DEUDORA o SU_ACREEDORA no existen en la tabla de configuración"); } } catch (Exception ex) { UIApplication.ShowError("frmPayment (txtAuction_KeyDownAfter)" + ex.Message); LogService.WriteError("frmPayment (txtAuction_KeyDownAfter)" + ex.Message); LogService.WriteError(ex); } }
private void LoadFreight() { try { Form lObjSOForm = UIApplication.GetApplication().Forms.ActiveForm;//SAPbouiCOM.Framework.Application.SBO_Application.Forms.GetFormByTypeAndCount(mIntFormType = pFrmActive.Type;, pVal.FormTypeCount); SetFormSettings(lObjSOForm); //lObjMtxSO = UIApplication.GetApplication().Forms.ActiveForm; //5897 if (EmptyOrder()) { OpenFreightsForm(); } else { LoadFreightsForm(); } } catch (Exception ex) { LogService.WriteError("(LoadCombobox): " + ex.Message); LogService.WriteError(ex); UIApplication.ShowMessageBox(ex.Message); } }
public void OpenStockTransferForm() { try { if (!Object.ReferenceEquals(requestTransfers, null)) { LogService.WriteInfo("Begin Transfer for Document: " + requestTransfers[0].DocNum); SAPMatrix.SetColumnQuantities(mtx0, "Quantity", requestTransfers, "Quantity"); requestTransfers[0].Observations = txtObserv.Value; var result = StockTransferDI.CreateDraft(requestTransfers, user); if (result.Success) { Form form = SAPbouiCOM.Framework.Application.SBO_Application.OpenForm((BoFormObjectEnum)112, "", result.DocEntry.ToString()); this.UIAPIRawForm.Close(); Task.Factory.StartNew(() => { AlertMessageDI.Create(new MessageDTO() { UserCode = foodTransferDAO.GetUserCode(requestTransfers[0].UserID.ToString()), Message = "Se ha realizado la transferencia de mercancia solicitada en el documento #" + requestTransfers[0].DocNum }); }); LogService.WriteInfo("End Transfer for Document: " + requestTransfers[0].DocNum); } else { UIApplication.ShowMessageBox(result.Message); } } } catch (Exception ex) { SAPException.Handle(ex, "OpenStockTransferForm"); } }
public void ProcessPendingOrders() { ProgressBarManager oProgressBar = null; var timer = Stopwatch.StartNew(); try { if (pendingOrders != null && pendingOrders.Length > 0) { SAPbouiCOM.Framework.Application.SBO_Application.StatusBar.SetText("Procesando Ordenes de Venta", SAPbouiCOM.BoMessageTime.bmt_Medium, SAPbouiCOM.BoStatusBarMessageType.smt_Warning); oProgressBar = new ProgressBarManager(UIApplication.GetApplication(), "Processing Sales Orders, please wait...", pendingOrders.Length); foreach (var request in pendingOrders) { var result = new PermissionRequestService().CreateSaleOrder(request.ID); LogService.WriteInfo(String.Format("Orden {3}-{0}-{1}: Resultado: {2}", request.ID, request.Type, result, request.Folio)); oProgressBar.NextPosition(); } UIApplication.ShowMessageBox(String.Format("Se procesaron un total de {0} ordenes de venta \n Tiempo Transcurrido {1}", pendingOrders.Length, timer.Elapsed)); } else { UIApplication.ShowMessageBox("No hay ordenes de venta pendientes o las ordenes aun no se han terminado cargar"); } } catch (Exception ex) { PendingSalesOrdersDAO.HandleException(ex, "ProcessPendingOrders"); } finally { oProgressBar.Stop(); btnProcess.Item.Enabled = false; } }
private void GetItemsDetails(string pStrRiseId) { try { this.UIAPIRawForm.Freeze(true); if (string.IsNullOrEmpty(pStrRiseId)) { UIApplication.ShowMessageBox("Seleccione una subida"); return; } ClearMatrix(dtItems.UniqueID, mtxItems); List <InventoryItemsLinesDTO> lLstRiseItems = mObjMachineryServiceFactory.GetGoodIssuesService().GetRiseItemsForStockTransfer(int.Parse(pStrRiseId)); foreach (var lObjRiseItem in lLstRiseItems.Where(x => x.Category != "Unk" && x.Quantity > 0)) { AddRiseItemDetails(lObjRiseItem); } } catch (Exception lObjException) { LogUtility.WriteError(string.Format("[frmStockTransfer - GetItemsDetails] Error: {0}", lObjException.Message)); UIApplication.ShowMessageBox(lObjException.Message); } finally { this.UIAPIRawForm.Freeze(false); } }
/// <summary> /// Loads the available bank accounts in the comoboxes. /// </summary> private void cboAuctions_ComboSelectAfter(object sboObject, SAPbouiCOM.SBOItemEventArg pVal) { try { if (!string.IsNullOrEmpty(CboAuctions.Value)) { mObjLastAuction = mAuctionDAO.GetAuctionByFolio(CboAuctions.Value); if (mObjLastAuction != null) { LoadSellers(mObjLastAuction.Folio); mEdtFolio.Value = mObjLastAuction.Folio; lObjBtnCC.Item.Enabled = true; } else { UIApplication.ShowError("No hay subastas activas."); } } } catch (Exception ex) { LogUtility.WriteError(string.Format("[CheckGeneration - cboAuctions_ComboSelectAfter] Error: {0}", ex.Message)); UIApplication.ShowMessageBox(ex.Message); //UIApplication.ShowError("frm (LoadMatrix)" + ex.Message); } finally { this.UIAPIRawForm.Freeze(false); } }
public List <string> GetServerDatetime() { string lStrQuery = "select getdate(), SUBSTRING( convert(varchar, getdate(),108),1,5)"; List <string> lStrResult = new List <string>(); SAPbobsCOM.Recordset lObjRecordSet = null; try { lObjRecordSet = (SAPbobsCOM.Recordset)DIApplication.Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset); lObjRecordSet.DoQuery(lStrQuery); if (lObjRecordSet.RecordCount > 0) { lStrResult.Add(lObjRecordSet.Fields.Item(0).Value.ToString()); lStrResult.Add(lObjRecordSet.Fields.Item(1).Value.ToString()); } } catch (Exception ex) { LogService.WriteError("[GetServerDatetime]: " + ex.Message); LogService.WriteError(ex); UIApplication.ShowMessageBox(string.Format("Error de consulta", ex.Message)); } finally { MemoryUtility.ReleaseComObject(lObjRecordSet); } return(lStrResult); }
/// <summary> /// Valida si existe UUID /// </summary> public bool ValidateUUID(string pStrUUID) { SAPbobsCOM.Recordset lObjRecordset = null; bool lBolExist = false; try { Dictionary <string, string> lLstStrParameters = new Dictionary <string, string>(); lLstStrParameters.Add("UUID", pStrUUID); string lStrQuery = this.GetSQL("ValidateUUID").Inject(lLstStrParameters); //this.UIAPIRawForm.DataSources.DataTables.Item("RESULT").ExecuteQuery(lStrQuery); lObjRecordset = (SAPbobsCOM.Recordset)DIApplication.Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset); lObjRecordset.DoQuery(lStrQuery); if (lObjRecordset.RecordCount > 0) { lBolExist = true; } } catch (Exception ex) { UIApplication.ShowMessageBox(string.Format("InitDataSourcesException: {0}", ex.Message)); LogService.WriteError("PurchasesDAO (ValidateUUID): " + ex.Message); LogService.WriteError(ex); } finally { MemoryUtility.ReleaseComObject(lObjRecordset); } return(lBolExist); }
public PacConfigDTO GetConfigurationPac() { SAPbobsCOM.Recordset lObjRecordset = (SAPbobsCOM.Recordset)DIApplication.Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset); var pacConfigDTO = new PacConfigDTO(); try { lObjRecordset.DoQuery(this.GetSQL("GetConfigurationPac")); if (lObjRecordset.RecordCount > 0) { pacConfigDTO.Contract = lObjRecordset.Fields.Item("U_Contract").Value.ToString(); pacConfigDTO.Pass = lObjRecordset.Fields.Item("U_Pass").Value.ToString(); pacConfigDTO.User = lObjRecordset.Fields.Item("U_User").Value.ToString(); } } catch (Exception ex) { UIApplication.ShowMessageBox(string.Format("GetConfigurationPac: {0}", ex.Message)); LogService.WriteError("PurchasesXmlDAO (GetConfigurationPac): " + ex.Message); LogService.WriteError(ex); } finally { MemoryUtility.ReleaseComObject(lObjRecordset); } return(pacConfigDTO); }
public string GetCodeMov(int docEntry, string type) { SAPbobsCOM.Recordset lObjRecordset = (SAPbobsCOM.Recordset)DIApplication.Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);; string codeMov = String.Empty; try { Dictionary <string, string> lLstStrParameters = new Dictionary <string, string>(); lLstStrParameters.Add("DocEntry", docEntry.ToString()); string lStrQuery = this.GetSQL("GetCodeMov" + type).Inject(lLstStrParameters); lObjRecordset.DoQuery(lStrQuery); if (lObjRecordset.RecordCount > 0) { codeMov = lObjRecordset.Fields.Item(0).Value.ToString(); } } catch (Exception ex) { UIApplication.ShowMessageBox(string.Format("InitDataSourcesException: {0}", ex.Message)); LogService.WriteError("PurchasesDAO (GetVoucherCode): " + ex.Message); LogService.WriteError(ex); } finally { MemoryUtility.ReleaseComObject(lObjRecordset); } return(codeMov); }
/// <summary> /// Obtener RFC de la empresa. /// </summary> public string GetRFC() { SAPbobsCOM.Recordset lObjRecordset = null; string lStrRFC = ""; try { //Dictionary<string, string> lLstStrParameters = new Dictionary<string, string>(); //lLstStrParameters.Add("WareHouse", ""); string lStrQuery = this.GetSQL("GetRFC"); //this.UIAPIRawForm.DataSources.DataTables.Item("RESULT").ExecuteQuery(lStrQuery); lObjRecordset = (SAPbobsCOM.Recordset)DIApplication.Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset); lObjRecordset.DoQuery(lStrQuery); if (lObjRecordset.RecordCount > 0) { lStrRFC = lObjRecordset.Fields.Item("taxidnum").Value.ToString(); } } catch (Exception ex) { UIApplication.ShowMessageBox(string.Format("InitDataSourcesException: {0}", ex.Message)); LogService.WriteError("PurchasesDAO (GetRFC): " + ex.Message); LogService.WriteError(ex); } finally { MemoryUtility.ReleaseComObject(lObjRecordset); } return(lStrRFC); }
private void pObjMtxRoutes_ClickBefore(object sboObject, SAPbouiCOM.SBOItemEventArg pVal, out bool BubbleEvent) { BubbleEvent = true; try { if (pVal.Row > 0) { SetRoutes(pVal.Row); pObjMtxRoutes.SelectRow(pVal.Row, true, false); //pIntCode = (int)(lObjDtRoutes.Columns.Item("Code").Cells.Item(pVal.Row - 1).Value); //pIntRow = pVal.Row; } else { pRoutes = null; //pIntCode = 0; //pIntRow = 0; } } catch (Exception ex) { LogService.WriteError(ex.Message); LogService.WriteError(ex); UIApplication.ShowMessageBox(ex.Message); } }
private bool Permission_Purchases(string pStrUserCode, string pStrSqlQuery, string pStrCostCenter, string pStrType) { SAPbobsCOM.Recordset lObjRecordset = null; try { Dictionary <string, string> lLstStrParameters = new Dictionary <string, string>(); lLstStrParameters.Add("UserCode", pStrUserCode); if (!string.IsNullOrEmpty(pStrCostCenter)) { lLstStrParameters.Add("CostCenter", pStrCostCenter); } string lStrQuery = this.GetSQL(pStrSqlQuery).Inject(lLstStrParameters); lStrQuery = lStrQuery + " and " + pStrType + "= 'Y' "; lObjRecordset = (SAPbobsCOM.Recordset)DIApplication.Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset); lObjRecordset.DoQuery(lStrQuery); if (lObjRecordset.RecordCount > 0) { return(true); } } catch (Exception ex) { UIApplication.ShowMessageBox(string.Format("InitDataSourcesException: {0}", ex.Message)); LogService.WriteError("PurchasesDAO (Permission_Purchases): " + ex.Message); LogService.WriteError(ex); } finally { MemoryUtility.ReleaseComObject(lObjRecordset); } return(false); }
private void btnFinish_ClickAfter(object sboObject, SBOItemEventArg pVal) { string lStrMessage = mLstJournalEntryDTO.Count() > 0 ? " Aun tiene registros por guardar " : ""; Auction lObjAuction = mObjPaymentServiceFactory.GetPaymentService().GetAuction(mStrAuctionId); if (!lObjAuction.AutAuction) { if (UIApplication.ShowOptionBox(lStrMessage + "¿Desea terminar cobro? ") == 1) { lObjAuction.AutAuction = true; int lIntResult = mObjPaymentServiceFactory.GetAuctionService().Update(lObjAuction); if (lIntResult == 0)//&& lObjAuction.AutCorral && lObjAuction.AutTransp) { List <MessageDTO> lLstMessagesDTO = mObjPaymentServiceFactory.GetPaymentService().GetMessages(mStrAuctionId); bool lBolAlert = false; foreach (MessageDTO lObjMessage in lLstMessagesDTO) { if (mObjPaymentServiceFactory.GetAlertService().SaveAlert(lObjMessage)) { lBolAlert = true; } } if (lBolAlert) { UIApplication.ShowMessageBox("Proceso terminado \n Se envió una alerta al departamento de crédito y cobranza"); } } } } else { UIApplication.ShowMessageBox("Proceso ya se ha terminado anteriormente"); } }
public string CreateDocument(string pStrCardCode, double pDblTotal, string pStrRef)//(List<Locations> pObjLocation, string pStrCardCode) { ExpoganServiceFactory mObjExpoganService = new ExpoganServiceFactory(); string lStrDocEntry = string.Empty; SAPbobsCOM.Documents lObjDocument = (SAPbobsCOM.Documents)DIApplication.Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oOrders); lObjDocument.CardCode = pStrCardCode; lObjDocument.DocDueDate = DateTime.Now; lObjDocument.Lines.COGSCostingCode = mObjExpoganService.GetLocationService().GetCostCenter(); lObjDocument.Lines.ItemCode = mObjExpoganService.GetLocationService().GetItemCode("EX_ITEMSTAND"); lObjDocument.Lines.Price = pDblTotal; //GetPryce lObjDocument.Lines.Add(); if (lObjDocument.Add() != 0) { string lStrError = DIApplication.Company.GetLastErrorDescription(); UIApplication.ShowMessageBox(string.Format("Exception: {0}", DIApplication.Company.GetLastErrorDescription())); LogService.WriteError("PurchaseOrderDI (CreateDocument) " + DIApplication.Company.GetLastErrorDescription()); } else { return(DIApplication.Company.GetNewObjectKey().ToString()); } return(lStrDocEntry); }
private void DownloadSchema(List <string> lLstStrSchemas) { string lStrFilenameCatch = string.Empty; try { foreach (string lStrSchema in lLstStrSchemas) { string lStrFilename = lStrSchema.Substring(lStrSchema.LastIndexOf("/") + 1); lStrFilenameCatch = lStrFilename; if (!ExistFile(lStrFilename)) { using (var client = new WebClient()) { LogService.WriteInfo("Descargando esquema: " + lStrSchema); client.DownloadFile(lStrSchema.Substring(lStrSchema.LastIndexOf(" ") + 1), Path.Combine(Environment.CurrentDirectory, @"Services\", lStrFilename)); LogService.WriteInfo("Descarga correcta:" + lStrSchema); } } } } catch (Exception ex) { UIApplication.ShowMessageBox("Error al descargar el esquema " + lStrFilenameCatch + " favor de revisar el log o permisos de guardado " + ex.Message); LogService.WriteError("ReadXMLService (DownloadSchema) " + ex.Message); LogService.WriteError(ex); } }
public bool CancelPayment(string pStrDocEntry) { try { int lIntDocNum = Convert.ToInt32(mObjPurchaseServiceFactory.GetPurchasePaymentService().GetPaymentDocNum(pStrDocEntry)); if (lIntDocNum != 0) { SAPbobsCOM.Payments lObjPayment = (SAPbobsCOM.Payments)DIApplication.Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oVendorPayments); lObjPayment.GetByKey(lIntDocNum); if (lObjPayment.CancelbyCurrentSystemDate() != 0) { UIApplication.ShowMessageBox(DIApplication.Company.GetLastErrorDescription()); LogService.WriteError("PaymentDI (CancelPayment) DocEntry:" + pStrDocEntry + " Mensaje:" + DIApplication.Company.GetLastErrorDescription()); return(false); } else { LogService.WriteSuccess("Pago cancelado correctamente: PaymentDocEntry: " + pStrDocEntry); return(true); } } else { return(true); } } catch (Exception ex) { UIApplication.ShowMessageBox(ex.Message); LogService.WriteError("PaymentDI (CancelPayment) DocEntry:" + pStrDocEntry + " Mensaje:" + ex.Message); LogService.WriteError(ex); return(false); } }
public bool CheckVoucherStatus(PurchaseXMLDTO lObjPurchaseXML) { try { var pacConfDTO = new PurchaseXmlService().GetConfigurationPac(); var mObjTimbradorp = new servTim.PadeTimbradoServiceClient(); var resultXML = mObjTimbradorp.consultarEstatusComprobante(pacConfDTO.Contract, pacConfDTO.User, pacConfDTO.Pass, lObjPurchaseXML.FolioFiscal, lObjPurchaseXML.RFCProvider, lObjPurchaseXML.RFCReceptor, lObjPurchaseXML.Total, null); var statusXML = XDocument.Parse(resultXML) .Document.Descendants("servicioConsultaComprobante") .Select(p => new VoucherStatusDTO { QueryOK = p.Element("consultaOk").Value ?? "", Code = p.Element("codigo").Value ?? "", StatusCode = p.Element("codigoEstatus").Value ?? "", IsCancelable = p.Element("esCancelable").Value ?? "", Status = p.Element("estado").Value ?? "", }).FirstOrDefault(); if (statusXML.QueryOK.Equals("true") && statusXML.Status.Equals("Vigente")) { UIApplication.ShowMessageBox(String.Format("El estado del comprobante se consulto satisfactoriamente: \nFolio Fiscal: {0} \nCodigoEstatus: {1} \nEstado: {2} \nCancelable: {3}\n", lObjPurchaseXML.FolioFiscal, statusXML.StatusCode, statusXML.Status, statusXML.IsCancelable)); return(true); } else { UIApplication.ShowMessageBox(String.Format("Estado del comprobante consultado sin éxito: \nFolio Fiscal: {0} \nCodigoEstatus: {1} \nEstado: {2}\n", lObjPurchaseXML.FolioFiscal, statusXML.StatusCode, statusXML.Status)); } } catch (Exception ex) { LogService.WriteError("(CheckVoucherStatus): " + ex.Message + "," + ex.StackTrace); LogService.WriteError(ex); UIApplication.ShowMessageBox("Problemas al consultar el estado del comprobante: " + ex.Message); } return(false); }
private void lObjTxt_Validate(object sboObject, SBOItemEventArg pVal, out bool BubbleEvent) { BubbleEvent = true; try { if (mBoolLoaded && mIntActualRoute == mModalFrmRouteFinder.mIntCode) { if (pVal.ItemChanged) { lObjBtnUpdate.Caption = "Actualizar"; lObjBtnUpdate.Item.Enabled = true; } } else { if (pVal.ItemChanged) { lObjBtnUpdate.Caption = "Nuevo"; lObjBtnUpdate.Item.Enabled = true; } } } catch (Exception ex) { LogService.WriteError("JournalService (CreateAction): " + ex.Message); LogService.WriteError(ex); UIApplication.ShowMessageBox(string.Format("CreateAction: {0}", ex.Message)); } }
/// <summary> /// Create Invoice For Closure Charge and Auction Invoicing /// </summary> private void CreateInvoice(string type) { var tasks = new List <Task <ResultDTO> >(); var results = new List <string>(); //try { LogService.WriteInfo("Begin Mass Billing " + type); DraftService lObjDraftService = new DraftService(); lObjDraftService.DeleteDrafts(type); foreach (var doc in pendingInvoices) { // tasks.Add(Task.Run(() => { try { LogService.WriteInfo("Begin Creating Invoice for Cient: " + doc.Code); var invoice = new DocumentDTO(); invoice.Document = doc; invoice.FloorServiceLines = massInvoicingDAO.GetFloorServiceLines(doc.Code, user.WhsCode, type); invoice.DeliveryLines = massInvoicingDAO.GetDeliveryLines(doc.Code, user.WhsCode); //invoice.FloorServiceLines = massInvoicingDAO.GetFloorServiceLines(doc.Code, "CRHE", type); //invoice.DeliveryLines = massInvoicingDAO.GetDeliveryLines(doc.Code, "CRHE"); if (invoice.FloorServiceLines.Count == 0 && invoice.DeliveryLines.Count == 0) { results.Add("Sin servicio de piso ni entregas de alimento"); } else { results.Add(InvoiceDI.CreateInvoice(invoice, user, floorServiceItem, type).Message); } LogService.WriteInfo("Successfully Creating Invoice for Cient: " + doc.Code); // })); //Thread.Sleep(130); } catch (Exception ex) { HandleException(ex, "[Exception] Invoice for Client " + doc.Code); } //Task.WaitAll(tasks.ToArray()); } //catch(AggregateException ae) { // ae.Handle(e => { // HandleException(e, "(Closure)"); // return true; // }); //} //catch(Exception ex) { // HandleException(ex, "(Closure)"); //} Task.Factory.StartNew(() => { // BindResultColumn(tasks.Select(t => t.Result.Message).AsParallel().AsOrdered().ToList(), type); BindResultColumn(results, type); LogService.WriteInfo("Done Mass Billing " + type); }); UIApplication.ShowMessageBox("Revisar la Columna de Resultados"); }
public bool RemoveTicketDetail(List <TicketDetail> pLstTicketDetail) { try { IList <TicketDetail> lLstTicketDetail = mObjTicketDAO.GetListTicketDetail(pLstTicketDetail[0].Folio); if (lLstTicketDetail.Count > pLstTicketDetail.Count) { foreach (TicketDetail lObjTicketDetail in lLstTicketDetail) { List <TicketDetail> lLstTicketDelete = pLstTicketDetail.Where(x => x.RowCode == lObjTicketDetail.RowCode).ToList(); if (lLstTicketDelete.Count == 0) { if (mObjFoodProductionFactory.GetTicketDetailService().Remove(lObjTicketDetail) != 0) { return(false); } LogService.WriteSuccess("[Delete Ticket] Folio:" + lObjTicketDetail.Folio); } //lLstTicketDetail.Where } } } catch (Exception ex) { LogService.WriteError("[RemoveTicketDetail]: " + ex.Message); LogService.WriteError(ex); UIApplication.ShowMessageBox(string.Format("RemoveTicketDetail: {0}", ex.Message)); } return(true); }
public static void HandleException(Exception ex, string section) { lock (padlock) { UIApplication.ShowMessageBox(String.Format("Error: {0}", ex.Message)); LogService.WriteError(String.Format("{0}: {1}, {2}", section, ex.Message, ex.StackTrace)); } }
private void btnSearch_ClickBefore(object sboObject, SAPbouiCOM.SBOItemEventArg pVal, out bool BubbleEvent) { BubbleEvent = true; try { mObjFrmFolios = new frmCFLFolios(FoliosFormModeEnum.StockTransfer); mObjFrmFolios.Show(); } catch (Exception lObjException) { LogUtility.WriteError(string.Format("[frmStockTransfer - btnSearch_ClickBefore] Error: {0}", lObjException.Message)); if (lObjException.Message.Contains("Failed to create form. Please check the form attributes")) { if (Application.SBO_Application.MessageBox("La pantalla de folios ya se encuentra abierta, ¿desea cerrar la actual?", 1, "Aceptar", "Cancelar", "") == 1) { UIApplication.GetApplication().Forms.Item("frmFolios").Close(); mObjFrmFolios = new frmCFLFolios(FoliosFormModeEnum.StockTransfer); mObjFrmFolios.Show(); } } else { UIApplication.ShowMessageBox(string.Format("Error al abrir la pantalla de folios: {0}", lObjException.Message)); } } }
/// <summary> /// Obtener el ultimo folio de comprobante dependiendo del area. /// </summary> public string GetVoucherFolio(string pStrArea, string pStrType) { SAPbobsCOM.Recordset lObjRecordset = null; string lStrVoucherFolio = "0"; try { Dictionary <string, string> lLstStrParameters = new Dictionary <string, string>(); lLstStrParameters.Add("Area", pStrArea); lLstStrParameters.Add("TypeVoucher", pStrType); string lStrQuery = this.GetSQL("GetVoucherFolio").Inject(lLstStrParameters); //this.UIAPIRawForm.DataSources.DataTables.Item("RESULT").ExecuteQuery(lStrQuery); lObjRecordset = (SAPbobsCOM.Recordset)DIApplication.Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset); lObjRecordset.DoQuery(lStrQuery); if (lObjRecordset.RecordCount > 0) { lStrVoucherFolio = lObjRecordset.Fields.Item("U_Folio").Value.ToString(); } } catch (Exception ex) { UIApplication.ShowMessageBox(string.Format("InitDataSourcesException: {0}", ex.Message)); LogService.WriteError("PurchasesDAO (GetVoucherFolio): " + ex.Message); LogService.WriteError(ex); } finally { MemoryUtility.ReleaseComObject(lObjRecordset); } return(lStrVoucherFolio); }
/// <summary> /// Actualiza el total /// </summary> public int UpdateTotal(string pStrCode) { int lIntResult = -1; try { PurchasesServiceFactory mObjPurchaseServiceFactory = new PurchasesServiceFactory(); var lObjVoucher = mObjPurchaseServiceFactory.GetPurchaseVouchersService().GetVouches(pStrCode); if (lObjVoucher.Count > 0) { List <VouchersDetailDTO> lLstVouchersDetail = mObjPurchaseServiceFactory.GetPurchaseVouchersService().GetInvoiceVouchesDetail(lObjVoucher[0].Area, lObjVoucher[0].Folio); lObjVoucher[0].Total = lLstVouchersDetail.Where(x => x.Status != "Cancelado").Sum(x => x.Total); // lObjVoucher[0].Total = pDblTotal; // lObjVoucher[0].Total = mObjPurchaseServiceFactory.GetPurchaseVouchersService().GetVouchesDetail(pStrCode).Where(x => x.Status != "Cancelado").Sum(x => x.Total); lIntResult = mObjPurchaseServiceFactory.GetVouchersService().Update(lObjVoucher[0]); if (lIntResult != 0) { UIApplication.ShowMessageBox(string.Format("Exception: {0}", DIApplication.Company.GetLastErrorDescription())); LogService.WriteError("InvoiceDI (AddVoucherDetail) " + DIApplication.Company.GetLastErrorDescription()); } } else { LogService.WriteError("VouchersService: Comprobante no encontrado: " + pStrCode); } } catch (System.Exception ex) { LogService.WriteError("VouchersService (UpdateTotal) " + ex.Message); LogService.WriteError(ex); } return(lIntResult); }
public Dictionary <string, string> GetBankInfo(string pStrAccountNumber) { SAPbobsCOM.Recordset lObjRecordset = null; Dictionary <string, string> lStrBankName = new Dictionary <string, string>(); try { string lStrQuery = this.GetSQL("GetBankByAccount").InjectSingleValue("AccountNumber", pStrAccountNumber); lObjRecordset = (SAPbobsCOM.Recordset)DIApplication.Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset); lObjRecordset.DoQuery(lStrQuery); if (lObjRecordset.RecordCount > 0) { lStrBankName.Add(lObjRecordset.Fields.Item("Account").Value.ToString(), lObjRecordset.Fields.Item("BankName").Value.ToString()); } } catch (Exception ex) { UIApplication.ShowMessageBox(string.Format("InitDataSourcesException: {0}", ex.Message)); LogService.WriteError("PurchasesDAO (GetBank): " + ex.Message); LogService.WriteError(ex); } finally { MemoryUtility.ReleaseComObject(lObjRecordset); } return(lStrBankName); }
//Actualiza asiento como cancelado public bool UpdateJournalEntryCancel(string pStrTransID) { try { SAPbobsCOM.JournalEntries lObjJournalEntryesCancel = (SAPbobsCOM.JournalEntries)DIApplication.Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oJournalEntries); lObjJournalEntryesCancel.GetByKey(Convert.ToInt32(pStrTransID)); lObjJournalEntryesCancel.UserFields.Fields.Item("U_GLO_Cancel").Value = "Y"; lObjJournalEntryesCancel.Reference2 = ""; if (lObjJournalEntryesCancel.Update() != 0) { UIApplication.ShowMessageBox(string.Format("Mensaje: {0} ", DIApplication.Company.GetLastErrorDescription())); LogService.WriteError("PolicyDI (CancelJournalEntry) Código:" + pStrTransID + " Mensaje:" + DIApplication.Company.GetLastErrorDescription()); return(false); } else { return(true); } } catch (Exception ex) { LogService.WriteError("PolicyDI (UpdateJournalEntryCancel) Código:" + pStrTransID + " Mensaje:" + ex.Message); LogService.WriteError(ex); return(false); } }
public bool ExistsPayment(string pStrEmployeeCode, string pStrFolio, string pStrArea) { SAPbobsCOM.Recordset lObjRecordset = null; bool lBolResult = false; try { Dictionary <string, string> lLstStrParameters = new Dictionary <string, string>(); lLstStrParameters.Add("EmpCode", pStrEmployeeCode); lLstStrParameters.Add("CodeMov", pStrFolio); lLstStrParameters.Add("Area", pStrArea); string lStrQuery = this.GetSQL("ExistsPayment").Inject(lLstStrParameters); lObjRecordset = (SAPbobsCOM.Recordset)DIApplication.Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset); lObjRecordset.DoQuery(lStrQuery); if (lObjRecordset.RecordCount > 0) { lBolResult = true; } } catch (Exception ex) { UIApplication.ShowMessageBox(string.Format("InitDataSourcesException: {0}", ex.Message)); LogService.WriteError("PurchasesDAO (ExistsPayment): " + ex.Message); LogService.WriteError(ex); } finally { MemoryUtility.ReleaseComObject(lObjRecordset); } return(lBolResult); }
/// <summary> /// Crea hilo para abrir carpeta /// </summary> private void CreateFolderBroserThread() { try { Thread ShowFolderBroserThread = new Thread(OpenFileBrowser); if (ShowFolderBroserThread.ThreadState == System.Threading.ThreadState.Unstarted) { ShowFolderBroserThread.SetApartmentState(System.Threading.ApartmentState.STA); ShowFolderBroserThread.Start(); } else { ShowFolderBroserThread.Start(); ShowFolderBroserThread.Join(); } while (ShowFolderBroserThread.ThreadState == System.Threading.ThreadState.Running) { System.Windows.Forms.Application.DoEvents(); } } catch (Exception ex) { UIApplication.ShowMessageBox(ex.Message); LogUtility.WriteError("[frmDriversCommissions - CreateFolderBroserThread] " + ex.Message); LogUtility.WriteError(ex.Message); } }
public string GetPrefix() { Recordset lObjRecordSet = null; string lStrPrefix = string.Empty; try { lObjRecordSet = (Recordset)DIApplication.Company.GetBusinessObject(BoObjectTypes.BoRecordset); string lStrQuery = this.GetSQL("GetPrefix"); lObjRecordSet.DoQuery(lStrQuery); if (lObjRecordSet.RecordCount > 0) { lStrPrefix = lObjRecordSet.Fields.Item("U_Prefix").Value.ToString(); } else { UIApplication.ShowMessageBox("No se encontro ningun prefijo activo registrado"); } } catch (Exception lObjException) { throw new DAOException(lObjException.Message, lObjException); } finally { MemoryUtility.ReleaseComObject(lObjRecordSet); } return(lStrPrefix); }