private void mtxAuction_ValidateBefore(object sboObject, SAPbouiCOM.SBOItemEventArg pVal, out bool BubbleEvent) { BubbleEvent = true; try { if (pVal.ColUID == "C_TotalC") { string lStrPayment = (mtxAuction.Columns.Item("C_TotalC").Cells.Item(pVal.Row).Specific as EditText).Value.Trim(); decimal lDblPayment = Convert.ToDecimal(lStrPayment == "" ? "0" : lStrPayment); decimal lDblCompra = Convert.ToDecimal(DtMatrixAuctions.GetValue("C_TotalB", pVal.Row - 1)); if (lDblPayment <= lDblCompra && lDblPayment >= 0) { UpdateMatrix(); JounralEntry(pVal.Row); } else { BubbleEvent = false; UIApplication.ShowError("Cantidad incorrecta favor de revisar"); } } } catch (Exception ex) { UIApplication.ShowError("frmPayment (mtxAuction_ValidateBefore) " + ex.Message); LogService.WriteError("frmPayment (mtxAuction_ValidateBefore) " + ex.Message); LogService.WriteError(ex); } }
private void JounralEntry(int pIntRow) { try { string lStrAuction = DtMatrixAuctions.GetValue("C_Auction", pIntRow - 1).ToString(); string lStrAux = DtMatrixSellers.GetValue("C_Code", mIntRowSelected - 1).ToString(); decimal lDecTotalC = Convert.ToDecimal(DtMatrixAuctions.GetValue("C_TotalC", pIntRow - 1).ToString()); if (lDecTotalC > 0) { JournalEntryDTO lObjJournalEntry = mLstJournalEntryDTO.Where(x => x.Aux == lStrAux && x.AuctionId == lStrAuction).FirstOrDefault(); if (lObjJournalEntry == null) { JournalEntryDTO lObjJournalEntryDTO = new JournalEntryDTO(); lObjJournalEntryDTO.AuctionId = DtMatrixAuctions.GetValue("C_Auction", pIntRow - 1).ToString(); lObjJournalEntryDTO.Credit = Convert.ToDecimal(DtMatrixAuctions.GetValue("C_TotalC", pIntRow - 1).ToString()); lObjJournalEntryDTO.Debit = 0; lObjJournalEntryDTO.Area = "SU_HERMO"; lObjJournalEntryDTO.AuxType = "1"; lObjJournalEntryDTO.Aux = DtMatrixSellers.GetValue("C_Code", mIntRowSelected - 1).ToString(); lObjJournalEntryDTO.AuctionId = DtMatrixAuctions.GetValue("C_Auction", pIntRow - 1).ToString(); lObjJournalEntryDTO.Account = DtMatrixSellers.GetValue("C_AccountC", mIntRowSelected - 1).ToString(); lObjJournalEntry = lObjJournalEntryDTO; mLstJournalEntryDTO.Add(lObjJournalEntryDTO); } else { lObjJournalEntry.Credit = Convert.ToDecimal(DtMatrixAuctions.GetValue("C_TotalC", pIntRow - 1).ToString()); } UpdateJorunalEntryDebit(lObjJournalEntry); } } catch (Exception ex) { UIApplication.ShowError("frmPayment (JounralEntry) " + ex.Message); LogService.WriteError("frmPayment (JounralEntry) " + ex.Message); LogService.WriteError(ex); } }