private void UpdateJorunalEntryDebit(JournalEntryDTO pObjJournalEntry) { try { string lStrAccountC = DtMatrixSellers.GetValue("C_AccountC", mIntRowSelected - 1).ToString(); string lStrAccountD = DtMatrixSellers.GetValue("C_AccountD", mIntRowSelected - 1).ToString(); JournalEntryDTO lObjJournalEntry = mLstJournalEntryDTO.Where(x => x.Aux == pObjJournalEntry.Aux && x.Account == lStrAccountD).FirstOrDefault(); if (lObjJournalEntry == null) { lObjJournalEntry = new JournalEntryDTO(); lObjJournalEntry.AuctionId = mStrAuctionId; lObjJournalEntry.Area = pObjJournalEntry.Area; lObjJournalEntry.AuxType = pObjJournalEntry.AuxType; lObjJournalEntry.Aux = pObjJournalEntry.Aux; lObjJournalEntry.Debit = pObjJournalEntry.Credit; lObjJournalEntry.Credit = 0; lObjJournalEntry.AuctionId = mStrAuctionId; lObjJournalEntry.Account = lStrAccountD; mLstJournalEntryDTO.Add(lObjJournalEntry); } else { decimal lDecDebit = mLstJournalEntryDTO.Where(x => x.Aux == pObjJournalEntry.Aux && x.Account == lStrAccountC).Sum(y => y.Credit); lObjJournalEntry.Debit = lDecDebit; } } catch (Exception ex) { UIApplication.ShowError("frmPayment (UpdateJorunalEntryDebit) " + ex.Message); LogService.WriteError("frmPayment (UpdateJorunalEntryDebit) " + ex.Message); LogService.WriteError(ex); } }
private void UpdateMatrix() { try { this.UIAPIRawForm.Freeze(true); decimal lDecPaymentPayment = 0; for (int i = 0; i < DtMatrixAuctions.Rows.Count; i++) { string lStrPayment = (mtxAuction.Columns.Item("C_TotalC").Cells.Item(i + 1).Specific as EditText).Value.Trim(); decimal lDblPayment = Convert.ToDecimal(lStrPayment == "" ? "0" : lStrPayment); DtMatrixAuctions.SetValue("C_TotalC", i, lDblPayment.ToString()); lDecPaymentPayment += lDblPayment; } decimal lDecPaymentSell = Convert.ToDecimal(DtMatrixSellers.GetValue("C_TotalS", mIntRowSelected - 1).ToString()); DtMatrixSellers.SetValue("C_TotalC", mIntRowSelected - 1, lDecPaymentPayment.ToString()); DtMatrixSellers.SetValue("C_Total", mIntRowSelected - 1, (lDecPaymentSell - lDecPaymentPayment).ToString()); mtxSellers.LoadFromDataSource(); mtxAuction.LoadFromDataSource(); } catch (Exception ex) { UIApplication.ShowError("frmPayment (UpdateMatrix) " + ex.Message); LogService.WriteError("frmPayment (UpdateMatrix) " + ex.Message); LogService.WriteError(ex); } finally { this.UIAPIRawForm.Freeze(false); } }
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); } }
private List <AuctionsDTO> AddChargeToList(List <AuctionsDTO> pLstAuctionDTO) { try { string lStrAccount = DtMatrixSellers.GetValue("C_AccountC", mIntRowSelected - 1).ToString(); string lStrAux = DtMatrixSellers.GetValue("C_Code", mIntRowSelected - 1).ToString(); foreach (AuctionsDTO lObjAuctionsDTO in pLstAuctionDTO) { JournalEntryDTO lObjJournalEntry = mLstJournalEntryDTO.Where(x => x.Credit > 0 && x.Account == lStrAccount && x.Aux == lStrAux && x.AuctionId == lObjAuctionsDTO.Folio).FirstOrDefault(); if (lObjJournalEntry != null) { lObjAuctionsDTO.TotalCharge = lObjJournalEntry.Credit.ToString(); } } } catch (Exception ex) { UIApplication.ShowError("frmPayment (AddChargeToList) " + ex.Message); LogService.WriteError("frmPayment (AddChargeToList) " + ex.Message); LogService.WriteError(ex); } return(pLstAuctionDTO); }
private void mtxSellers_DoubleClickAfter(object sboObject, SAPbouiCOM.SBOItemEventArg pVal) { try { mIntRowSelected = pVal.Row; if (DtMatrixAuctions == null) { CreateDataTableMatrixAuctions(); } List <AuctionsDTO> lLstAuctionDTO = mObjPaymentServiceFactory.GetPaymentService().GetAuctions(DtMatrixSellers.GetValue("C_Code", pVal.Row - 1).ToString(), mIntSignature).ToList(); lLstAuctionDTO = AddChargeToList(lLstAuctionDTO); FillMatrixAuction(lLstAuctionDTO); } catch (Exception ex) { UIApplication.ShowError("frmPayment (mtxSellers_DoubleClickAfter) " + ex.Message); LogService.WriteError("frmPayment (mtxSellers_DoubleClickAfter) " + ex.Message); LogService.WriteError(ex); } }