public List <ETL_FinancialOnTheWayBuyingGoodDetail> TransformTransactionOnTheWayBuyingGoodDetail(Session session, ETL_Transaction transaction, string AccountCode) { Util util = new Util(); Account account = util.GetXpoObjectByFieldName <Account, string>(session, "Code", AccountCode, BinaryOperatorType.Equal); if (account == null) { return(null); } if (transaction == null) { return(null); } ETL_Transaction etlTransaction = transaction; List <ETL_FinancialOnTheWayBuyingGoodDetail> detailList = new List <ETL_FinancialOnTheWayBuyingGoodDetail>(); try { ETLAccountingBO accountingBO = new ETLAccountingBO(); FinancialLiabilityBO liabilityBO = new FinancialLiabilityBO(); ETL_FinancialOnTheWayBuyingGoodDetail temp = null; List <ETL_GeneralJournal> JournalListJoined = liabilityBO.JoinJournal(session, etlTransaction.GeneralJournalList); List <ETL_GeneralJournal> FinishJournalList = liabilityBO.ClearJournalList(session, JournalListJoined, account.AccountId); foreach (ETL_GeneralJournal journal in JournalListJoined) { temp = new ETL_FinancialOnTheWayBuyingGoodDetail(); temp.AccountCode = ""; temp.CorrespondAccountCode = ""; if (accountingBO.IsRelateAccount(session, account.AccountId, journal.AccountId)) { temp.AccountCode = session.GetObjectByKey <Account>(journal.AccountId).Code; } else { temp.CorrespondAccountCode = session.GetObjectByKey <Account>(journal.AccountId).Code; } temp.ActualPrice = (transaction as ETL_TransactionS04a6DN).ActualPrice; temp.BookedPrice = (transaction as ETL_TransactionS04a6DN).BookedPrice; temp.IssueDate = etlTransaction.IssuedDate; temp.OwnerOrgId = etlTransaction.OwnerOrgId; temp.TransactionId = etlTransaction.TransactionId; temp.Credit = journal.Credit; temp.Debit = journal.Debit; temp.Credit = journal.Credit; temp.Debit = journal.Debit; temp.CurrencyCode = session.GetObjectByKey <Currency>(journal.CurrencyId).Code; temp.TransactionId = etlTransaction.TransactionId; temp.IsBalanceForward = etlTransaction.IsBalanceForward; temp.PurchaseInvoiceId = (transaction as ETL_TransactionS04a6DN).PurchaseInvoiceId; temp.InputInventoryCommandId = (transaction as ETL_TransactionS04a6DN).InputInventoryCommandId; detailList.Add(temp); } } catch (Exception) { return(null); } return(detailList); }
protected ETL_FinanciaActualPriceTransformData TransformTransactionFinancialActualPriceDetail ( Session session, ETL_ActualPriceTransaction transaction, string AccountCode) { Util util = new Util(); ETL_FinanciaActualPriceTransformData result = new ETL_FinanciaActualPriceTransformData(); Account account = util.GetXpoObjectByFieldName <Account, string>(session, "Code", AccountCode, BinaryOperatorType.Equal); if (account == null) { return(null); } if (transaction == null) { return(null); } ETL_Transaction etlTransaction = transaction; string subMainAccount = string.Empty; List <ETL_FinanciaActualPriceDetail> detail = new List <ETL_FinanciaActualPriceDetail>(); try { ETLAccountingBO accountingBO = new ETLAccountingBO(); FinancialLiabilityBO liabilityBO = new FinancialLiabilityBO(); //List<ETL_GeneralJournal> JournalListJoined = JoinJournal(session, etlTransaction.GeneralJournalList, AccountCode); List <ETL_GeneralJournal> FinishJournalList = liabilityBO.ClearJournalList(session, etlTransaction.GeneralJournalList, account.AccountId); foreach (ETL_GeneralJournal journal in FinishJournalList) { ETL_FinanciaActualPriceDetail temp = new ETL_FinanciaActualPriceDetail(); temp.AccountCode = ""; temp.CorrespondAccountCode = ""; if (accountingBO.IsRelateAccount(session, account.AccountId, journal.AccountId)) { temp.AccountCode = subMainAccount = session.GetObjectByKey <Account>(journal.AccountId).Code; } else { temp.CorrespondAccountCode = session.GetObjectByKey <Account>(journal.AccountId).Code; } temp.CurrencyCode = session.GetObjectByKey <Currency>(journal.CurrencyId).Code; temp.IsBalanceForward = etlTransaction.IsBalanceForward; temp.IssueDate = etlTransaction.IssuedDate; temp.OwnerOrgId = etlTransaction.OwnerOrgId; temp.TransactionId = etlTransaction.TransactionId; temp.Credit = (decimal)journal.Credit; temp.Debit = (decimal)journal.Debit; detail.Add(temp); } result.ETL_DetailList = detail; result.AccountCode = subMainAccount; } catch (Exception) { return(null); } return(result); }