private void assertUsedByARCR(SalesReturnItem item) { IList used = ARCreditNoteRepository.FindARCRBySalesReturn(m_command, item.EVENT.ID); if (used.Count > 0) { throw new Exception("This Sales Return [" + item.EVENT.CODE + "] is used by [" + ((ARCreditNoteItem)used[0]).EVENT_JOURNAL.CODE + "], please delete APDN first."); } }
protected override EventJournal doGet(int ID) { m_command.CommandText = Receipt.GetByIDSQL(ID); MySql.Data.MySqlClient.MySqlDataReader r = m_command.ExecuteReader(); Receipt st = Receipt.TransformReader(r); r.Close(); if (st == null) { return(null); } m_command.CommandText = ReceiptItem.GetByEventIDSQL(ID); r = m_command.ExecuteReader(); IList stis = ReceiptItem.TransformReaderList(r); r.Close(); foreach (ReceiptItem 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_CUSTOMER_INVOICE_TYPE == VendorBalanceEntryType.CustomerInvoice) { if (sti.CUSTOMER_INVOICE_JOURNAL_ITEM != null) { sti.CUSTOMER_INVOICE_JOURNAL_ITEM = CustomerInvoiceJournalRepository.FindCIJournalItemlistForReceipt(m_command, sti.CUSTOMER_INVOICE_JOURNAL_ITEM.GetID()); } } if (sti.VENDOR_BALANCE_CUSTOMER_INVOICE_TYPE == VendorBalanceEntryType.CustomerOutStandingInvoice) { if (sti.CUSTOMER_INVOICE_JOURNAL_ITEM != null) { sti.CUSTOMER_INVOICE_JOURNAL_ITEM = CustomerOutStandingInvoiceRepository.FindCOIItemlistForReceipt(m_command, sti.CUSTOMER_INVOICE_JOURNAL_ITEM.GetID()); } } if (sti.PAYMENT_TYPE == ReceiptType.Bank) { sti.BANK = getBank(sti.BANK.ID); } if (sti.PAYMENT_TYPE == ReceiptType.ARCreditNote) { sti.AR_CREDIT_NOTE = ARCreditNoteRepository.FindARCRForReceipt(m_command, sti.AR_CREDIT_NOTE.ID); } st.EVENT_JOURNAL_ITEMS.Add(sti); } return(st); }