Example #1
0
        protected override void doRevise(EventJournal events, Period p)
        {
            foreach (PaymentItem item in events.EVENT_JOURNAL_ITEMS)
            {
                item.CURRENCY = events.CURRENCY;
                item.VENDOR   = events.VENDOR;
                SetVendorBalance(item, p);
                item.ProcessUnPosted();
                updateVendorBalances(item.VENDOR_BALANCE);
                deleteVendorBalanceEntry(item.VENDOR_BALANCE_ENTRY);
                item.SUPPLIER_INVOICE_JOURNAL_ITEM.UnSetOSAgainstPaymentItem(item);
                if (item.SUPPLIER_INVOICE_JOURNAL_ITEM is SupplierInvoiceJournalItem)
                {
                    SupplierInvoiceJournalRepository.UpdateAgainstStatus(m_command, item.SUPPLIER_INVOICE_JOURNAL_ITEM.GET_EVENT_JOURNAL,
                                                                         item.SUPPLIER_INVOICE_JOURNAL_ITEM);
                }
                if (item.SUPPLIER_INVOICE_JOURNAL_ITEM is SupplierOutStandingInvoiceItem)
                {
                    SupplierOutStandingInvoiceRepository.UpdateAgainstStatus(m_command, item.SUPPLIER_INVOICE_JOURNAL_ITEM.GET_EVENT_JOURNAL,
                                                                             item.SUPPLIER_INVOICE_JOURNAL_ITEM);
                }
                //if (item.PAYMENT_TYPE == PaymentType.APDebitNote)
                //{

                //}
            }
        }
Example #2
0
        protected override EventJournal doGet(int ID)
        {
            m_command.CommandText = Payment.GetByIDSQL(ID);
            MySql.Data.MySqlClient.MySqlDataReader r = m_command.ExecuteReader();
            Payment st = Payment.TransformReader(r);

            r.Close();
            m_command.CommandText = PaymentItem.GetByEventIDSQL(ID);
            r = m_command.ExecuteReader();
            IList stis = PaymentItem.TransformReaderList(r);

            r.Close();
            foreach (PaymentItem sti in stis)
            {
                sti.EVENT_JOURNAL = st;
                //sti.VENDOR = PartRepository.GetByID(m_command, sti.PART.ID);
                sti.VENDOR_BALANCE_ENTRY = VendorBalanceEntryRepository.FindVendorBalanceEntryByEventItem(m_command, sti.ID, sti.VENDOR_BALANCE_ENTRY_TYPE);
                //sti.GRN_ITEM = GoodReceiveNoteRepository.FindGoodReceiveNoteItem(m_command, sti.GRN_ITEM.ID);
                //sti.GRN_ITEM.PART = PartRepository.GetByID(m_command, sti.GRN_ITEM.PART.ID);
                if (sti.VENDOR_BALANCE_SUPPLIER_INVOICE_TYPE == VendorBalanceEntryType.SupplierInvoice)
                {
                    if (sti.SUPPLIER_INVOICE_JOURNAL_ITEM != null)
                    {
                        sti.SUPPLIER_INVOICE_JOURNAL_ITEM = SupplierInvoiceJournalRepository.FindSIJournalItemlistForPayment(m_command, sti.SUPPLIER_INVOICE_JOURNAL_ITEM.GetID());
                    }
                }
                if (sti.VENDOR_BALANCE_SUPPLIER_INVOICE_TYPE == VendorBalanceEntryType.SupplierOutStandingInvoice)
                {
                    if (sti.SUPPLIER_INVOICE_JOURNAL_ITEM != null)
                    {
                        sti.SUPPLIER_INVOICE_JOURNAL_ITEM = SupplierOutStandingInvoiceRepository.FindSOIItemlistForPayment(m_command, sti.SUPPLIER_INVOICE_JOURNAL_ITEM.GetID());
                    }
                }
                if (sti.PAYMENT_TYPE == PaymentType.Bank)
                {
                    sti.BANK = getBank(sti.BANK.ID);
                }
                if (sti.PAYMENT_TYPE == PaymentType.APDebitNote)
                {
                    sti.AP_DEBIT_NOTE = APDebitNoteRepository.FindAPDNForPayment(m_command, sti.AP_DEBIT_NOTE.ID);
                }
                st.EVENT_JOURNAL_ITEMS.Add(sti);
            }
            return(st);
        }