public void Load()
        {
            if (Stop == true)
            {
                return;
            }
            //Console.WriteLine("Load");
            if (ETL_GeneralLedgerList != null && RefId != Guid.Empty)
            {
                etlAccountingBO.LoadGeneralLedger(session, ETL_GeneralLedgerList);
            }

            ETLEntryObjectHistoryBO _ETLEntryObjectHistoryBO = new ETLEntryObjectHistoryBO();
            ETLJobBO _ETLJobBO = new ETLJobBO();

            //Console.WriteLine("Load DataBase");

            if (RefId != Guid.Empty)
            {
                _ETLLogBO.JobLog(session, JobId, "State1", "Status1");
                _ETLLogBO.SetETLBusinessObjectStatus(session, JobId, RefId, 1);
                _ETLEntryObjectHistoryBO.SetETLEntryObjectHistoryStatus(session, JobId, RefId, 1);
            }
            //Code for Loading
        }
Esempio n. 2
0
 public void Load()
 {
     //if (Stop == true) return;
     if (RefId != Guid.Empty)
     {
         liabilityBO.LoadFinancialSupplierLiabilityDetail(session, detailList, "331");
         _ETLLogBO.JobLog(session, JobId, "State1", "Status1");
         _ETLLogBO.SetETLBusinessObjectStatus(session, JobId, RefId, 1);
         _ETLEntryObjectHistoryBO.SetETLEntryObjectHistoryStatus(session, JobId, RefId, 1);
     }
 }
Esempio n. 3
0
 public void Load()
 {
     //if (Stop == true) return;
     if (RefId != Guid.Empty)
     {
         inventoryBO.LoadInventoryLedger(session, LedgerList);
         _ETLLogBO.JobLog(session, JobId, "State1", "Status1");
         _ETLLogBO.SetETLBusinessObjectStatus(session, JobId, RefId, 1);
         _ETLEntryObjectHistoryBO.SetETLEntryObjectHistoryStatus(session, JobId, RefId, 1);
     }
 }
Esempio n. 4
0
 public void Load()
 {
     if (RefId != Guid.Empty)
     {
         foreach (IELTLogicJob Strategy in Strategies)
         {
             Strategy.LoadTransaction(session);
         }
         eTLLogBO.JobLog(session, JobId, "State1", "Status1");
         eTLLogBO.SetETLBusinessObjectStatus(session, JobId, RefId, 1);
         _ETLEntryObjectHistoryBO.SetETLEntryObjectHistoryStatus(session, JobId, RefId, 1);
     }
 }
Esempio n. 5
0
 public void Load()
 {
     if (RefId == Guid.Empty)
     {
         return;
     }
     {
         diaryJournalBO.LoadTemplateAreaToDiaryJournalDetail(session, detailList, m_AccountRun, m_DebitOrCredit);
         _ETLLogBO.JobLog(session, JobId, "State1", "Status1");
         _ETLLogBO.SetETLBusinessObjectStatus(session, JobId, RefId, 1);
         _ETLEntryObjectHistoryBO.SetETLEntryObjectHistoryStatus(session, JobId, RefId, 1);
     }
 }
Esempio n. 6
0
 public void Load()
 {
     //if (Stop == true) return;
     if (RefId == Guid.Empty)
     {
         return;
     }
     _ETLFinancialRevenueByItemBO.CreateFinancialRevenueByItem(session, ETL_Bill_temp);
     //Console.WriteLine("Load");
     if (RefId != Guid.Empty)
     {
         _ETLLogBO.JobLog(session, JobId, "State1", "Status1");
         _ETLLogBO.SetETLBusinessObjectStatus(session, JobId, RefId, 1);
         _ETLEntryObjectHistoryBO.SetETLEntryObjectHistoryStatus(session, JobId, RefId, 1);
     }
 }
Esempio n. 7
0
        public void Load()
        {
            //if (Stop == true) return;
            //Console.WriteLine("Load");
            ETLEntryObjectHistoryBO _ETLEntryObjectHistoryBO = new ETLEntryObjectHistoryBO();
            ObjectEntryLogBO        _ObjectEntryLogBO        = new ObjectEntryLogBO();
            ETLJobBO         _ETLJobBO         = new ETLJobBO();
            ETLLogBO         _ETLLogBO         = new ETLLogBO();
            BusinessObjectBO _BusinessObjectBO = new BusinessObjectBO();

            if (RefId != Guid.Empty)
            {
                _ETLLogBO.JobLog(session, JobId, "State1", "Status1");
                _ETLLogBO.SetETLBusinessObjectStatus(session, JobId, RefId, 1);
                _ETLEntryObjectHistoryBO.SetETLEntryObjectHistoryStatus(session, JobId, RefId, 1);
            }
        }
Esempio n. 8
0
        public void Load()
        {
            // MonthDim

            //m_Filter = new BinaryOperator("Name", transaction.IssuedDate.Month, BinaryOperatorType.Equal);
            //m_MonthDim = session.FindObject<MonthDim>(m_Filter);

            //if (m_MonthDim == null)
            //{
            //    m_MonthDim = new MonthDim(session);
            //    m_MonthDim.Name = transaction.IssuedDate.Month.ToString();
            //    m_MonthDim.Description = "Tháng " + transaction.IssuedDate.Month.ToString();
            //    m_MonthDim.RowStatus = 1;

            //    m_MonthDim.Save();
            //}

            //// YearDim

            //m_Filter = new BinaryOperator("Name", transaction.IssuedDate.Year, BinaryOperatorType.Equal);
            //m_YearDim = session.FindObject<YearDim>(m_Filter);

            //if (m_YearDim == null)
            //{
            //    m_YearDim = new YearDim(session);
            //    m_YearDim.Name = transaction.IssuedDate.Year.ToString();
            //    m_YearDim.Description = "Năm " + transaction.IssuedDate.Year.ToString();
            //    m_YearDim.RowStatus = 1;

            //    m_YearDim.Save();
            //}


            if (RefId != Guid.Empty)
            {
                // FinancialVoucherDim
                m_Filter = new BinaryOperator("RefId", RefId, BinaryOperatorType.Equal);
                m_FinancialVoucherDim = session.FindObject <FinancialVoucherDim>(m_Filter);
                if (m_FinancialVoucherDim == null)
                {
                    m_FinancialVoucherDim             = new FinancialVoucherDim(session);
                    m_FinancialVoucherDim.BookingDate = transaction.IssuedDate;
                    m_FinancialVoucherDim.IssueDate   = transaction.CreateDate;
                    m_FinancialVoucherDim.Name        = transaction.Code;
                    m_FinancialVoucherDim.RefId       = RefId;
                    m_FinancialVoucherDim.Description = transaction.Description;
                }
                m_FinancialVoucherDim.Save();

                // FinancialCash_Fact
                foreach (ETL_GeneralJournal item in transaction.GeneralJournalList)
                {
                    // FinancialCashTypeDim
                    m_Currency = session.GetObjectByKey <Currency>(item.CurrencyId);

                    m_Filter = new BinaryOperator("Name", item.CurrencyCode, BinaryOperatorType.Equal);
                    m_FinancialCashTypeDim = session.FindObject <FinancialCashTypeDim>(m_Filter);
                    if (m_FinancialCashTypeDim == null)
                    {
                        m_FinancialCashTypeDim = new FinancialCashTypeDim(session);
                    }
                    m_FinancialCashTypeDim.Name        = item.CurrencyCode;
                    m_FinancialCashTypeDim.Description = item.CurrencyName;

                    m_FinancialCashTypeDim.Save();

                    // FinancialCash_Fact
                    m_FinancialCash_Fact = session.FindObject <FinancialCash_Fact>(m_FinancialVoucherDim.FinancialVoucherDimId);
                    if (m_FinancialCash_Fact == null)
                    {
                        m_FinancialCash_Fact = new FinancialCash_Fact(session);
                    }
                    m_FinancialCash_Fact.FinancialVoucherDimId  = m_FinancialVoucherDim;
                    m_FinancialCash_Fact.FinancialCashTypeDimId = m_FinancialCashTypeDim;

                    if (item.AccountCode.Contains("111") || item.AccountCode.Contains("112"))
                    {
                        m_Filter = new BinaryOperator("Code", item.AccountCode, BinaryOperatorType.Equal);
                        m_FinancialAccountDim = session.FindObject <FinancialAccountDim>(m_Filter);

                        if (m_FinancialAccountDim == null)
                        {
                            m_FinancialAccountDim = new FinancialAccountDim(session);
                        }
                        m_FinancialAccountDim.Code        = item.AccountCode;
                        m_FinancialAccountDim.Name        = item.AccountName;
                        m_FinancialAccountDim.Description = item.AccountName;
                        m_FinancialAccountDim.RowStatus   = 1;

                        m_FinancialAccountDim.Save();
                    }
                    else
                    {
                        m_Filter = new BinaryOperator("Code", item.AccountCode, BinaryOperatorType.Equal);
                        m_CorrespondFinancialAccountDim = session.FindObject <CorrespondFinancialAccountDim>(m_Filter);
                        if (m_CorrespondFinancialAccountDim == null)
                        {
                            m_CorrespondFinancialAccountDim             = new CorrespondFinancialAccountDim(session);
                            m_CorrespondFinancialAccountDim.Code        = item.AccountCode;
                            m_CorrespondFinancialAccountDim.Name        = item.AccountName;
                            m_CorrespondFinancialAccountDim.Description = item.AccountName;
                            m_CorrespondFinancialAccountDim.RowStatus   = 1;

                            m_CorrespondFinancialAccountDim.Save();
                        }
                    }

                    if (item.Credit > 0 && (item.AccountCode.Contains("111") || item.AccountCode.Contains("112")))
                    {
                        m_FinancialCash_Fact.FinancialAccountDimId = m_FinancialAccountDim;
                        m_FinancialCash_Fact.Credit = item.Credit;
                    }
                    else if (item.Debit > 0 && (item.AccountCode.Contains("111") || item.AccountCode.Contains("112")))
                    {
                        m_FinancialCash_Fact.FinancialAccountDimId = m_FinancialAccountDim;
                        m_FinancialCash_Fact.Debit = item.Debit;
                    }
                    else
                    {
                        if (m_CorrespondFinancialAccountDim.Code != "NAAN_DEFAULT")
                        {
                            if (item.Credit > 0)
                            {
                                m_FinancialCash_Fact.CorrespondFinancialAccountDimId = m_CorrespondFinancialAccountDim;
                                m_FinancialCash_Fact.Credit = item.Credit;
                            }
                            else
                            {
                                m_FinancialCash_Fact.CorrespondFinancialAccountDimId = m_CorrespondFinancialAccountDim;
                                m_FinancialCash_Fact.Debit = item.Debit;
                            }
                        }
                    }

                    m_FinancialCash_Fact.Save();
                }
            }



            m_Filter = CriteriaOperator.And(
                CriteriaOperator.Or(
                    new BinaryOperator("SumOfDebit", 0, BinaryOperatorType.Greater),
                    new BinaryOperator("SumOfCredit", 0, BinaryOperatorType.Greater)
                    ),
                new BinaryOperator("RowStatus", 1, BinaryOperatorType.Equal)
                );
            XPCollection <Vouches> vouches = new XPCollection <Vouches>(session, m_Filter);

            m_Sql = "" +
                    "delete from FinancialCash_Fact " +
                    "	where exists (select null from FinancialVoucherDim aa, Vouches bb  "+
                    "					where bb.RowStatus = 4  "+
                    "                   and aa.RefId = bb.VouchesId " +
                    "					and aa.FinancialVoucherDimId = FinancialCash_Fact.FinancialVoucherDimId) "+
                    " delete from FinancialVoucherDim " +
                    "    where exists (select null from Vouches bb  " +
                    "					where bb.RowStatus = 4  "+
                    "                   and bb.VouchesId = FinancialVoucherDim.Refid) ";

            session.ExecuteNonQuery(m_Sql);

            foreach (Vouches item in vouches)
            {
                //if (item is PaymentVouches)
                //{
                //    m_Filter = new BinaryOperator("PaymentVouchesId", item.VouchesId, BinaryOperatorType.Equal);
                //    m_PaymentVouchesTransaction = session.FindObject<PaymentVouchesTransaction>(m_Filter);
                //    if (m_PaymentVouchesTransaction != null)
                //    {
                //        m_Sql = "" +
                //        "delete from FinancialCash_Fact " +
                //        "	where exists (select null from FinancialVoucherDim bb  " +
                //        "					where bb.BookingDate is null  " +
                //        "					and bb.FinancialVoucherDimId = FinancialCash_Fact.FinancialVoucherDimId " +
                //        "                   and bb.RefId = '" + m_PaymentVouchesTransaction.TransactionId + "') " +
                //        " delete from FinancialVoucherDim where RefId = '" + m_PaymentVouchesTransaction.TransactionId + "'";

                //        session.ExecuteNonQuery(m_Sql);
                //        continue;
                //    }
                //}
                //else
                //{
                //    m_Filter = new BinaryOperator("ReceiptVouchesId", item.VouchesId, BinaryOperatorType.Equal);
                //    m_ReceiptVouchesTransaction = session.FindObject<ReceiptVouchesTransaction>(m_Filter);
                //    if (m_ReceiptVouchesTransaction != null)
                //    {
                //        m_Sql = "" +
                //     "delete from FinancialCash_Fact " +
                //     "	where exists (select null from FinancialVoucherDim bb  " +
                //     "					where bb.BookingDate is null  " +
                //     "					and bb.FinancialVoucherDimId = FinancialCash_Fact.FinancialVoucherDimId " +
                //     "                  and bb.RefId = '" + m_ReceiptVouchesTransaction.TransactionId + "') " +
                //     " delete from FinancialVoucherDim where RefId = '" + m_ReceiptVouchesTransaction.TransactionId + "'";

                //        continue;
                //    }
                //}

                // FinancialVoucherDim
                m_Filter = new BinaryOperator("RefId", item.VouchesId, BinaryOperatorType.Equal);
                m_FinancialVoucherDim = session.FindObject <FinancialVoucherDim>(m_Filter);
                if (m_FinancialVoucherDim == null)
                {
                    m_FinancialVoucherDim             = new FinancialVoucherDim(session);
                    m_FinancialVoucherDim.IssueDate   = item.IssuedDate;
                    m_FinancialVoucherDim.Name        = item.Code;
                    m_FinancialVoucherDim.RefId       = item.VouchesId;
                    m_FinancialVoucherDim.Description = item.Description;
                    m_FinancialVoucherDim.Save();
                }

                //FinancialCashTypeDim
                m_Filter = new BinaryOperator("Name", item.VouchesAmounts[0].CurrencyId.Code, BinaryOperatorType.Equal);
                m_FinancialCashTypeDim = session.FindObject <FinancialCashTypeDim>(m_Filter);
                if (m_FinancialCashTypeDim == null)
                {
                    m_FinancialCashTypeDim             = new FinancialCashTypeDim(session);
                    m_FinancialCashTypeDim.Name        = item.VouchesAmounts[0].CurrencyId.Code;
                    m_FinancialCashTypeDim.Description = item.VouchesAmounts[0].CurrencyId.Name;

                    m_FinancialCashTypeDim.Save();
                }

                // FinancialCash_Fact
                m_Filter             = new BinaryOperator("FinancialVoucherDimId", m_FinancialVoucherDim.FinancialVoucherDimId, BinaryOperatorType.Equal);
                m_FinancialCash_Fact = session.FindObject <FinancialCash_Fact>(m_Filter);
                if (m_FinancialCash_Fact == null)
                {
                    m_FinancialCash_Fact = new FinancialCash_Fact(session);
                    m_FinancialCash_Fact.FinancialVoucherDimId  = m_FinancialVoucherDim;
                    m_FinancialCash_Fact.FinancialCashTypeDimId = m_FinancialCashTypeDim;

                    if (item is PaymentVouches)
                    {
                        m_FinancialCash_Fact.Credit = item.SumOfCredit;
                    }
                    else if (item is ReceiptVouches)
                    {
                        m_FinancialCash_Fact.Debit = item.SumOfDebit;
                    }

                    m_FinancialCash_Fact.Save();
                }
            }

            _ETLLogBO.JobLog(session, JobId, "State1", "Status1");
            _ETLLogBO.SetETLBusinessObjectStatus(session, JobId, RefId, 1);
            _ETLEntryObjectHistoryBO.SetETLEntryObjectHistoryStatus(session, JobId, RefId, 1);
        }