Exemple #1
0
        private void assertUsedByAPDN(PurchaseReturnItem item)
        {
            IList used = APDebitNoteRepository.FindAPDNByPurchaseReturn(m_command, item.EVENT.ID);

            if (used.Count > 0)
            {
                throw new Exception("This Purchase Return [" + item.EVENT.CODE + "] is used by [" + ((APDebitNoteItem)used[0]).EVENT_JOURNAL.CODE + "], please delete APDN first.");
            }
        }
Exemple #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);
        }