コード例 #1
0
        public async Task TestCreateTransWithTemplate()
        {
            Assert.IsTrue(_coreDriver.IsInitialize);
            MasterDataCreater.CreateMasterData(_coreDriver);

            await TemplateCreater.CreateTemplate(_coreDriver, _coreDriver.TmMgmt);

            // create transaction data
            DateTime date = DateTime.Parse("2012.07.02");

            VendorEntry vendor = (VendorEntry)_coreDriver.TmMgmt.GetEntryTemplate(1)
                                 .GenerateEntry();

            vendor.SetValue(EntryTemplate.POSTING_DATE, date);
            await vendor.SaveAsync(true);

            CustomerEntry customer = (CustomerEntry)_coreDriver.TmMgmt.GetEntryTemplate(3)
                                     .GenerateEntry();

            customer.SetValue(EntryTemplate.POSTING_DATE, date);
            customer.SetValue(EntryTemplate.AMOUNT, TestData.AMOUNT_CUSTOMER);
            await customer.SaveAsync(true);

            GLAccountEntry glEntry = (GLAccountEntry)_coreDriver.TmMgmt.GetEntryTemplate(2)
                                     .GenerateEntry();

            glEntry.SetValue(EntryTemplate.POSTING_DATE, date);
            glEntry.SetValue(EntryTemplate.AMOUNT, TestData.AMOUNT_GL);
            await glEntry.SaveAsync(true);

            TransactionDataManagement transManagement = _coreDriver.TransMgmt;

            // month 08
            date = DateTime.Parse("2012.08.02");
            HeadEntity headEntity = await DocumentCreater.CreateVendorDoc(_coreDriver,
                                                                          date);

            DocumentIdentity docId = headEntity.DocIdentity;

            transManagement.ReverseDocument(docId);

            // check
            TransactionDataChecker.CheckTransactionData(_coreDriver);

            // reload
            await _coreDriver.RestartAsync();

            TransactionDataChecker.CheckTransactionData(_coreDriver);
        }
コード例 #2
0
        public async static Task CreateTemplate(CoreDriver coreDriver,
                                                EntryTemplatesManagement tempMgmt)
        {
            // vendor
            VendorEntry vendorEntry = new VendorEntry(coreDriver, coreDriver.MdMgmt);

            vendorEntry.SetValue(EntryTemplate.AMOUNT, TestData.AMOUNT_VENDOR);
            vendorEntry.SetValue(VendorEntry.VENDOR, new MasterDataIdentity(
                                     TestData.VENDOR_BUS));
            vendorEntry.SetValue(EntryTemplate.TEXT, TestData.TEXT_VENDOR_DOC);
            vendorEntry.SetValue(VendorEntry.REC_ACC,
                                 new MasterDataIdentity_GLAccount(TestData.GL_ACCOUNT_CASH));
            vendorEntry.SetValue(VendorEntry.GL_ACCOUNT,
                                 new MasterDataIdentity_GLAccount(TestData.GL_ACCOUNT_COST));
            vendorEntry.SetValue(VendorEntry.BUSINESS_AREA, new MasterDataIdentity(
                                     TestData.BUSINESS_AREA_WORK));
            await tempMgmt.SaveAsTemplate(vendorEntry, TestData.TEXT_VENDOR_DOC);

            // GL
            GLAccountEntry glEntry = new GLAccountEntry(coreDriver, coreDriver.MdMgmt);

            glEntry.SetValue(EntryTemplate.TEXT, TestData.TEXT_GL_DOC);
            glEntry.SetValue(GLAccountEntry.SRC_ACCOUNT,
                             new MasterDataIdentity_GLAccount(TestData.GL_ACCOUNT_BANK));
            glEntry.SetValue(GLAccountEntry.DST_ACCOUNT,
                             new MasterDataIdentity_GLAccount(TestData.GL_ACCOUNT_CASH));
            await tempMgmt.SaveAsTemplate(glEntry, TestData.TEXT_GL_DOC);

            // customer
            CustomerEntry customerEntry = new CustomerEntry(coreDriver, coreDriver.MdMgmt);

            customerEntry.SetValue(EntryTemplate.TEXT, TestData.TEXT_CUSTOMER_DOC);
            customerEntry.SetValue(CustomerEntry.CUSTOMER, new MasterDataIdentity(
                                       TestData.CUSTOMER1));
            customerEntry.SetValue(CustomerEntry.REC_ACC,
                                   new MasterDataIdentity_GLAccount(TestData.GL_ACCOUNT_BANK));
            customerEntry.SetValue(CustomerEntry.GL_ACCOUNT,
                                   new MasterDataIdentity_GLAccount(TestData.GL_ACCOUNT_REV));
            await tempMgmt.SaveAsTemplate(customerEntry, TestData.TEXT_CUSTOMER_DOC);
        }
コード例 #3
0
        public async Task TestCreateTransDataWithEntry()
        {
            Assert.IsTrue(_coreDriver.IsInitialize);
            MasterDataCreater.CreateMasterData(_coreDriver);

            // month 08, reverse document
            DateTime date = DateTime.Parse("2012.07.02");
            // ledger
            VendorEntry vendorEntry = new VendorEntry(_coreDriver, _coreDriver.MdMgmt);

            vendorEntry.SetValue(EntryTemplate.POSTING_DATE, date);
            vendorEntry.SetValue(EntryTemplate.TEXT, TestData.TEXT_VENDOR_DOC);
            vendorEntry.SetValue(VendorEntry.VENDOR, new MasterDataIdentity(
                                     TestData.VENDOR_BUS));
            vendorEntry.SetValue(VendorEntry.REC_ACC,
                                 new MasterDataIdentity_GLAccount(TestData.GL_ACCOUNT_CASH));
            vendorEntry.SetValue(VendorEntry.GL_ACCOUNT,
                                 new MasterDataIdentity_GLAccount(TestData.GL_ACCOUNT_COST));
            vendorEntry.SetValue(VendorEntry.BUSINESS_AREA, new MasterDataIdentity(
                                     TestData.BUSINESS_AREA_WORK));
            vendorEntry.SetValue(EntryTemplate.AMOUNT, TestData.AMOUNT_VENDOR);
            await vendorEntry.SaveAsync(true);

            // customer
            CustomerEntry customerEntry = new CustomerEntry(_coreDriver, _coreDriver.MdMgmt);

            customerEntry.SetValue(EntryTemplate.POSTING_DATE, date);
            customerEntry.SetValue(EntryTemplate.TEXT, TestData.TEXT_CUSTOMER_DOC);
            customerEntry.SetValue(CustomerEntry.CUSTOMER, new MasterDataIdentity(
                                       TestData.CUSTOMER1));
            customerEntry.SetValue(CustomerEntry.REC_ACC,
                                   new MasterDataIdentity_GLAccount(TestData.GL_ACCOUNT_BANK));
            customerEntry.SetValue(CustomerEntry.GL_ACCOUNT,
                                   new MasterDataIdentity_GLAccount(TestData.GL_ACCOUNT_REV));
            customerEntry.SetValue(EntryTemplate.AMOUNT, TestData.AMOUNT_CUSTOMER);
            await customerEntry.SaveAsync(true);

            // GL
            GLAccountEntry glAccEntry = new GLAccountEntry(_coreDriver, _coreDriver.MdMgmt);

            glAccEntry.SetValue(EntryTemplate.POSTING_DATE, date);
            glAccEntry.SetValue(EntryTemplate.TEXT, TestData.TEXT_GL_DOC);
            glAccEntry.SetValue(GLAccountEntry.SRC_ACCOUNT,
                                new MasterDataIdentity_GLAccount(TestData.GL_ACCOUNT_BANK));
            glAccEntry.SetValue(GLAccountEntry.DST_ACCOUNT,
                                new MasterDataIdentity_GLAccount(TestData.GL_ACCOUNT_CASH));
            glAccEntry.SetValue(EntryTemplate.AMOUNT, TestData.AMOUNT_GL);
            await glAccEntry.SaveAsync(true);

            TransactionDataManagement transManagement = _coreDriver.TransMgmt;

            date = DateTime.Parse("2012.08.02");
            HeadEntity headEntity = await DocumentCreater.CreateVendorDoc(_coreDriver,
                                                                          date);

            DocumentIdentity docId = headEntity.DocIdentity;

            transManagement.ReverseDocument(docId);

            // check
            TransactionDataChecker.CheckTransactionData(_coreDriver);

            // reload
            await _coreDriver.RestartAsync();

            TransactionDataChecker.CheckTransactionData(_coreDriver);
        }