public List <ETL_InventoryLedger> TransformInventoryJournalToInventoryLedger(ETL_InventoryTransaction inventoryTransaction) { List <ETL_InventoryLedger> result = new List <ETL_InventoryLedger>(); try { foreach (ETL_InventoryJournal inventoryJournal in inventoryTransaction.InventoryJournalList) { ETL_InventoryLedger temp = new ETL_InventoryLedger(); temp.CreateDate = inventoryJournal.CreateDate; temp.AccountId = inventoryJournal.AccountId; temp.Credit = inventoryJournal.Credit; temp.Debit = inventoryJournal.Debit; temp.Description = inventoryJournal.Description; temp.InventoryId = inventoryJournal.InventoryId; temp.InventoryTransactionId = inventoryJournal.InventoryTransactionId; temp.IsOriginal = true; temp.IssueDate = inventoryTransaction.IssueDate; temp.ItemUnitId = inventoryJournal.ItemUnitId; temp.LedgerType = inventoryJournal.JournalType; temp.LotId = inventoryJournal.LotId; result.Add(temp); } } catch (Exception) { } return(result); }
public void Extract() { //_ETLLogBO.JobLog(session, JobId, "Next", "Status1"); //Console.WriteLine("Extract"); RefId = _ETLJobBO.ETLGetNextProcessObject(session, JobId, BusinessObjectTypeId); if (RefId == null) { return; } transaction = inventoryBO.ExtractInventoryTransaction(session, RefId); Console.WriteLine("InventoryJournalToInventoryLedger: " + RefId); //Thread.Sleep(3000); }
public List <ETL_InventoryLedger> TransformInventoryJournalToInventoryLedger(ETL_InventoryTransaction inventoryTransaction) { List <ETL_InventoryLedger> result = new List <ETL_InventoryLedger>(); try { foreach (ETL_InventoryJournal journal in inventoryTransaction.InventoryJournalList) { } } catch (Exception) { } return(result); }
public ETL_Bill ExtractSalesInvoice(Session session, Guid BillId, bool ExtractFinancialTransaction, bool ExtractInventoryTransaction) { ETL_Bill result = null; try { result = ExtractSalesInvoice(session, BillId); if (result == null) { return(null); } SalesInvoice invoice = session.GetObjectByKey <SalesInvoice>(BillId); if (ExtractFinancialTransaction) { ETLAccountingBO _ETLAccountingPeriodBO = new ETLAccountingBO(); result.FinancialTranSactionList = new List <ETL_Transaction>(); foreach (SaleInvoiceTransaction transaction in invoice.SaleInvoiceTransactions) { ETL_Transaction temp = _ETLAccountingPeriodBO.ExtractTransaction(session, transaction.TransactionId); result.FinancialTranSactionList.Add(temp); } } if (ExtractInventoryTransaction) { ETLInventoryBO _ETLInventoryBO = new ETLInventoryBO(); result.InventoryTranSactionList = new List <Inventory.TempData.ETL_InventoryTransaction>(); foreach (SalesInvoiceInventoryTransaction transaction in invoice.SalesInvoiceInventoryTransactions) { ETL_InventoryTransaction temp = _ETLInventoryBO.ExtractInventoryTransaction(session, transaction.InventoryTransactionId); result.InventoryTranSactionList.Add(temp); } } } catch (Exception) { return(null); } return(result); }
public ETL_InventoryTransaction ExtractInventoryTransaction(Session session, Guid InventoryTransactionId) { ETL_InventoryTransaction result = null; try { InventoryTransaction transaction = session.GetObjectByKey <InventoryTransaction>(InventoryTransactionId); if (transaction != null) { result = new ETL_InventoryTransaction(); if (transaction.AccountingPeriodId != null) { result.AccountingPeriodId = transaction.AccountingPeriodId.AccountingPeriodId; } result.Code = transaction.Code; result.CreateDate = transaction.CreateDate; result.Description = transaction.Description; result.InventoryTransactionId = transaction.InventoryTransactionId; result.IssueDate = transaction.IssueDate; result.InventoryJournalList = new List <ETL_InventoryJournal>(); result.COGSList = new List <ETL_COGS>(); foreach (InventoryJournal journal in transaction.InventoryJournals) { if (journal.RowStatus >= 0) { ETL_InventoryJournal newJournal = new ETL_InventoryJournal(); if (journal.AccountId != null) { newJournal.AccountId = journal.AccountId.AccountId; } newJournal.Credit = journal.Credit; newJournal.Debit = journal.Debit; if (journal.InventoryId != null) { newJournal.InventoryId = journal.InventoryId.InventoryId; } newJournal.InventoryJournalId = journal.InventoryJournalId; if (journal.InventoryTransactionId != null) { newJournal.InventoryTransactionId = journal.InventoryTransactionId.InventoryTransactionId; } if (journal.ItemUnitId != null) { newJournal.ItemUnitId = journal.ItemUnitId.ItemUnitId; } newJournal.JournalType = journal.JournalType; if (journal.LotId != null) { newJournal.LotId = journal.LotId.LotId; } newJournal.Description = journal.Description; newJournal.CreateDate = journal.CreateDate; result.InventoryJournalList.Add(newJournal); } } foreach (COGS cogs in transaction.COGSs) { ETL_COGS newCOGS = new ETL_COGS(); newCOGS.Amount = cogs.Amount; newCOGS.Assumption = cogs.Assumption; newCOGS.Balance = cogs.Balance; newCOGS.COGSPrice = cogs.COGSPrice; newCOGS.COGSId = cogs.COGSId; newCOGS.Credit = cogs.Credit; newCOGS.Debit = cogs.Debit; newCOGS.Description = cogs.Description; newCOGS.CreateDate = cogs.CreateDate; newCOGS.IssueDate = cogs.IssueDate; newCOGS.UpdateDate = cogs.UpdateDate; if (cogs.InventoryId != null) { newCOGS.InventoryId = cogs.InventoryId.InventoryId; } if (cogs.InventoryTransactionId != null) { newCOGS.InventoryTransactionId = cogs.InventoryTransactionId.InventoryTransactionId; } if (cogs.ItemUnitId != null) { newCOGS.ItemUnitId = cogs.ItemUnitId.ItemUnitId; } if (cogs.CurrencyId != null) { newCOGS.CurrencyId = cogs.CurrencyId.CurrencyId; } newCOGS.Price = cogs.Price; newCOGS.Total = cogs.Total; result.COGSList.Add(newCOGS); } } } catch (Exception) { throw; } return(result); }