Пример #1
0
        protected override void doRevise(EventJournal events, Period p)
        {
            foreach (ReceiptItem 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.CUSTOMER_INVOICE_JOURNAL_ITEM.UnSetOSAgainstReceiptItem(item);
                if (item.CUSTOMER_INVOICE_JOURNAL_ITEM is CustomerInvoiceJournalItem)
                {
                    CustomerInvoiceJournalRepository.UpdateAgainstStatus(m_command, item.CUSTOMER_INVOICE_JOURNAL_ITEM.GET_EVENT_JOURNAL,
                                                                         item.CUSTOMER_INVOICE_JOURNAL_ITEM);
                    CustomerInvoiceJournal cij = (CustomerInvoiceJournal)((CustomerInvoiceJournalItem)item.CUSTOMER_INVOICE_JOURNAL_ITEM).EVENT_JOURNAL;
                    if (cij.POS_INVOICE.ID > 0)
                    {
                        throw new Exception("POS Receipt can not revise, please revise POS");
                    }
                }
                if (item.CUSTOMER_INVOICE_JOURNAL_ITEM is CustomerOutStandingInvoiceItem)
                {
                    CustomerOutStandingInvoiceRepository.UpdateAgainstStatus(m_command, item.CUSTOMER_INVOICE_JOURNAL_ITEM.GET_EVENT_JOURNAL,
                                                                             item.CUSTOMER_INVOICE_JOURNAL_ITEM);
                }
                //if (item.PAYMENT_TYPE == ReceiptType.ARCreditNote)
                //{

                //}
            }
        }
Пример #2
0
        protected override void doConfirm(EventJournal events, Period p)
        {
            foreach (ReceiptItem item in events.EVENT_JOURNAL_ITEMS)
            {
                assertConfirmedSIJ(item.CUSTOMER_INVOICE_JOURNAL_ITEM.GET_EVENT_JOURNAL);
                assertValidDate(item.CUSTOMER_INVOICE_JOURNAL_ITEM.GET_EVENT_JOURNAL, events);
                item.CURRENCY = events.CURRENCY;
                item.VENDOR   = events.VENDOR;
                SetVendorBalance(item, p);
                item.ProcessPosted();
                updateVendorBalances(item.VENDOR_BALANCE);
                saveVendorBalanceEntry(item.VENDOR_BALANCE_ENTRY);
                item.CUSTOMER_INVOICE_JOURNAL_ITEM.SetOSAgainstReceiptItem(item);
                if (item.CUSTOMER_INVOICE_JOURNAL_ITEM is CustomerInvoiceJournalItem)
                {
                    CustomerInvoiceJournalRepository.UpdateAgainstStatus(m_command, item.CUSTOMER_INVOICE_JOURNAL_ITEM.GET_EVENT_JOURNAL,
                                                                         item.CUSTOMER_INVOICE_JOURNAL_ITEM);
                }
                if (item.CUSTOMER_INVOICE_JOURNAL_ITEM is CustomerOutStandingInvoiceItem)
                {
                    CustomerOutStandingInvoiceRepository.UpdateAgainstStatus(m_command, item.CUSTOMER_INVOICE_JOURNAL_ITEM.GET_EVENT_JOURNAL,
                                                                             item.CUSTOMER_INVOICE_JOURNAL_ITEM);
                }
                // if (item.PAYMENT_TYPE == ReceiptType.ARCreditNote)
                //{

                //}
            }
        }
Пример #3
0
        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);
        }
Пример #4
0
 public void ReviseForPOSNoTransaction(int id)
 {
     try
     {
         EventJournal events = this.Get(id);
         if (events.EVENT_STATUS == EventStatus.Entry)
         {
             throw new Exception("Status is already Unposted/Entry");
         }
         Period p = AssertValidPeriod(events.TRANSACTION_DATE);
         foreach (ReceiptItem 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.CUSTOMER_INVOICE_JOURNAL_ITEM.UnSetOSAgainstReceiptItem(item);
             if (item.CUSTOMER_INVOICE_JOURNAL_ITEM is CustomerInvoiceJournalItem)
             {
                 CustomerInvoiceJournalRepository.UpdateAgainstStatus(m_command, item.CUSTOMER_INVOICE_JOURNAL_ITEM.GET_EVENT_JOURNAL,
                                                                      item.CUSTOMER_INVOICE_JOURNAL_ITEM);
                 CustomerInvoiceJournal cij = (CustomerInvoiceJournal)((CustomerInvoiceJournalItem)item.CUSTOMER_INVOICE_JOURNAL_ITEM).EVENT_JOURNAL;
             }
             //if (item.CUSTOMER_INVOICE_JOURNAL_ITEM is CustomerOutStandingInvoiceItem)
             //{
             //    CustomerOutStandingInvoiceRepository.UpdateAgainstStatus(m_command, item.CUSTOMER_INVOICE_JOURNAL_ITEM.GET_EVENT_JOURNAL,
             //        item.CUSTOMER_INVOICE_JOURNAL_ITEM);
             //}
         }
         events.ProcessUnPosted();
         this.UpdateStatus(events, false);
     }
     catch (Exception x)
     {
         throw x;
     }
 }
Пример #5
0
 public CustomerInvoiceRepository()
     : base()
 {
     r_sij = new CustomerInvoiceJournalRepository(m_command);
 }
Пример #6
0
 public POSRepository()
     : base()
 {
     r_cij     = new CustomerInvoiceJournalRepository(m_command);
     r_receipt = new ReceiptRepository(m_command);
 }