コード例 #1
0
        protected override void doDeleteNoTransaction(EventJournal e)
        {
            CustomerInvoiceJournal st = (CustomerInvoiceJournal)e;

            try
            {
                if (getEventStatus(st.ID) == EventStatus.Confirm)
                {
                    throw new Exception("Revise before delete");
                }
                m_command.CommandText = CustomerInvoiceJournalItem.DeleteAllByEventSQL(st.ID);
                m_command.ExecuteNonQuery();
                m_command.CommandText = CustomerInvoiceJournal.DeleteSQL(st.ID);
                m_command.ExecuteNonQuery();
            }
            catch (Exception x)
            {
                throw x;
            }
        }
コード例 #2
0
 public void ConfirmNoTransaction(int id)
 {
     try
     {
         EventJournal events = this.Get(id);
         if (events.POSTED)
         {
             throw new Exception("Status is already Posted/Confirm");
         }
         Period p = AssertValidPeriod(events.TRANSACTION_DATE);
         events.ProcessPosting();
         doConfirm(events, p);
         this.UpdateStatus(events, true);
         //updateVendorBalances(events.EVENT_JOURNAL_ITEMS);
     }
     catch (Exception x)
     {
         throw x;
     }
 }
コード例 #3
0
ファイル: PaymentRepository.cs プロジェクト: oghenez/profitz
        protected override void doSaveNoTransaction(EventJournal e)
        {
            try
            {
                DateTime     trDate     = DateTime.Today;
                string       codesample = AutoNumberSetupRepository.GetCodeSampleByDomainName(m_command, "Payment");
                EventJournal codeDate   = FindLastCodeAndTransactionDate(codesample);
                string       lastCode   = codeDate == null ? string.Empty : codeDate.CODE;
                DateTime     lastDate   = codeDate == null ? trDate : codeDate.TRANSACTION_DATE;
                int          trCount    = RecordCount();
                e.CODE = AutoNumberSetupRepository.GetAutoNumberByDomainName(m_command, "Payment", e.CODE, lastCode, lastDate, trDate, trCount == 0);

                Payment stk = (Payment)e;
                m_command.CommandText = stk.GetInsertSQL();
                m_command.ExecuteNonQuery();
                m_command.CommandText = Payment.SelectMaxIDSQL();
                stk.ID = Convert.ToInt32(m_command.ExecuteScalar());
                foreach (PaymentItem item in stk.EVENT_JOURNAL_ITEMS)
                {
                    item.VENDOR_BALANCE_SUPPLIER_INVOICE_TYPE = item.SUPPLIER_INVOICE_JOURNAL_ITEM.GET_EVENT_JOURNAL.VENDOR_BALANCE_ENTRY_TYPE;
                    m_command.CommandText = item.GetInsertSQL();
                    m_command.ExecuteNonQuery();
                    m_command.CommandText = PaymentItem.SelectMaxIDSQL();
                    item.ID = Convert.ToInt32(m_command.ExecuteScalar());
                    if (item.PAYMENT_TYPE == PaymentType.APDebitNote)
                    {
                        m_command.CommandText = APDebitNote.UpdateUsedForPayment(item.AP_DEBIT_NOTE.ID, true);
                        m_command.ExecuteNonQuery();
                    }
                }
            }
            catch (Exception x)
            {
                e.ID = 0;
                foreach (EventJournalItem item in e.EVENT_JOURNAL_ITEMS)
                {
                    item.ID = 0;
                }
                throw x;
            }
        }
コード例 #4
0
 public void ReviseNoTransaction(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);
         doRevise(events, p);
         events.ProcessUnPosted();
         this.UpdateStatus(events, false);
         //deleteVendorBalanceEntry(events.DELETED_VENDORBALANCEENTRY);
         // updateVendorBalances(events.EVENT_JOURNAL_ITEMS);
     }
     catch (Exception x)
     {
         throw x;
     }
 }
コード例 #5
0
        //private void assertConfirmedPO(EventJournal p)
        //{
        //    if (p.EVENT_STATUS.Equals(EventStatus.Entry))
        //        throw new Exception("PO not confirmed :" + p.CODE);
        //}
        //private void assertValidDate(EventJournal po, EventJournal grn)
        //{
        //    if (grn.TRANSACTION_DATE < po.TRANSACTION_DATE)
        //        throw new Exception("GRN Date can not less than PO Date :" + po.CODE + " [ " + po.TRANSACTION_DATE.ToString("dd-MMM-yyyy") + " ] ");
        //}
        protected override void doSave(EventJournal e)
        {
            MySql.Data.MySqlClient.MySqlTransaction trc = m_connection.BeginTransaction();
            try
            {
                m_command.Transaction = trc;

                DateTime     trDate     = DateTime.Today;
                string       codesample = AutoNumberSetupRepository.GetCodeSampleByDomainName(m_command, "SupplierInvoiceJournal");
                EventJournal codeDate   = FindLastCodeAndTransactionDate(codesample);
                string       lastCode   = codeDate == null ? string.Empty : codeDate.CODE;
                DateTime     lastDate   = codeDate == null ? trDate : codeDate.TRANSACTION_DATE;
                int          trCount    = RecordCount();
                e.CODE = AutoNumberSetupRepository.GetAutoNumberByDomainName(m_command, "SupplierInvoiceJournal", e.CODE, lastCode, lastDate, trDate, trCount == 0);

                SupplierInvoiceJournal stk = (SupplierInvoiceJournal)e;
                m_command.CommandText = stk.GetInsertSQL();
                m_command.ExecuteNonQuery();
                m_command.CommandText = SupplierInvoiceJournal.SelectMaxIDSQL();
                stk.ID = Convert.ToInt32(m_command.ExecuteScalar());
                foreach (SupplierInvoiceJournalItem item in stk.EVENT_JOURNAL_ITEMS)
                {
                    m_command.CommandText = item.GetInsertSQL();
                    m_command.ExecuteNonQuery();
                    m_command.CommandText = SupplierInvoiceJournalItem.SelectMaxIDSQL();
                    item.ID = Convert.ToInt32(m_command.ExecuteScalar());
                }
                trc.Commit();
            }
            catch (Exception x)
            {
                e.ID = 0;
                foreach (EventJournalItem item in e.EVENT_JOURNAL_ITEMS)
                {
                    item.ID = 0;
                }
                trc.Rollback();
                throw x;
            }
        }
コード例 #6
0
ファイル: ReceiptRepository.cs プロジェクト: oghenez/profitz
 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;
     }
 }
コード例 #7
0
 public void Confirm(int id)
 {
     MySql.Data.MySqlClient.MySqlTransaction trc = m_connection.BeginTransaction();
     m_command.Transaction = trc;
     try
     {
         EventJournal events = this.Get(id);
         if (events.POSTED)
         {
             throw new Exception("Status is already Posted/Confirm");
         }
         Period p = AssertValidPeriod(events.TRANSACTION_DATE);
         events.ProcessPosting();
         doConfirm(events, p);
         this.UpdateStatus(events, true);
         //updateVendorBalances(events.EVENT_JOURNAL_ITEMS);
         trc.Commit();
     }
     catch (Exception x)
     {
         trc.Rollback();
         throw x;
     }
 }
コード例 #8
0
        protected override void doDelete(EventJournal e)
        {
            SupplierInvoiceJournal st = (SupplierInvoiceJournal)e;

            MySql.Data.MySqlClient.MySqlTransaction trc = m_connection.BeginTransaction();
            m_command.Transaction = trc;
            try
            {
                if (getEventStatus(st.ID) == EventStatus.Confirm)
                {
                    throw new Exception("Revise before delete");
                }
                m_command.CommandText = SupplierInvoiceJournalItem.DeleteAllByEventSQL(st.ID);
                m_command.ExecuteNonQuery();
                m_command.CommandText = SupplierInvoiceJournal.DeleteSQL(st.ID);
                m_command.ExecuteNonQuery();
                trc.Commit();
            }
            catch (Exception x)
            {
                trc.Rollback();
                throw x;
            }
        }
コード例 #9
0
 abstract protected void doConfirm(EventJournal events, Period p);
コード例 #10
0
 public void UpdateStatus(EventJournal e, bool p)
 {
     doUpdateStatus(e, p);
 }
コード例 #11
0
 public void Delete(EventJournal e)
 {
     doDelete(e);
 }
コード例 #12
0
 public void DeleteNoTransaction(EventJournal e)
 {
     doDeleteNoTransaction(e);
 }
コード例 #13
0
 public void UpdateNoTransaction(EventJournal e)
 {
     doUpdateNoTransaction(e);
 }
コード例 #14
0
 abstract protected void doSave(EventJournal e);
コード例 #15
0
        public static void UpdateAgainstStatus(MySql.Data.MySqlClient.MySqlCommand cmd, EventJournal e, ICustomerInvoiceJournalItem ei)
        {
            CustomerOutStandingInvoice     po  = (CustomerOutStandingInvoice)e;
            CustomerOutStandingInvoiceItem poi = (CustomerOutStandingInvoiceItem)ei;

            cmd.CommandText = poi.UpdateAgainstStatus();
            cmd.ExecuteNonQuery();
            cmd.CommandText = po.UpdateAgainstStatus();
            cmd.ExecuteNonQuery();
        }
コード例 #16
0
        public static void UpdateAgainstStatus(MySql.Data.MySqlClient.MySqlCommand cmd, EventJournal e, ISupplierInvoiceJournalItem ei)
        {
            SupplierInvoiceJournal     po  = (SupplierInvoiceJournal)e;
            SupplierInvoiceJournalItem poi = (SupplierInvoiceJournalItem)ei;

            cmd.CommandText = poi.UpdateAgainstStatus();
            cmd.ExecuteNonQuery();
            cmd.CommandText = po.UpdateAgainstStatus();
            cmd.ExecuteNonQuery();
        }
コード例 #17
0
 abstract protected void doDelete(EventJournal e);
コード例 #18
0
 abstract protected void doDeleteNoTransaction(EventJournal e);
コード例 #19
0
 abstract protected void doUpdate(EventJournal e);
コード例 #20
0
 protected override void doUpdateStatus(EventJournal e, bool posted)
 {
     m_command.CommandText = ARCreditNote.GetUpdateStatusSQL(e);
     m_command.ExecuteNonQuery();
 }
コード例 #21
0
 public void Update(EventJournal e)
 {
     doUpdate(e);
 }
コード例 #22
0
 abstract protected void doUpdateStatus(EventJournal e, bool p);
コード例 #23
0
 abstract protected void doRevise(EventJournal events, Period p);
コード例 #24
0
 protected override void doUpdateStatus(EventJournal e, bool posted)
 {
     m_command.CommandText = SupplierInvoiceJournal.GetUpdateStatusSQL(e);
     m_command.ExecuteNonQuery();
 }
コード例 #25
0
 public void Save(EventJournal e)
 {
     doSave(e);
 }
コード例 #26
0
 public void SaveNoTransaction(EventJournal e)
 {
     doSaveNoTransaction(e);
 }
コード例 #27
0
 protected override void doUpdateStatus(EventJournal e, bool posted)
 {
     m_command.CommandText = CustomerOutStandingInvoice.GetUpdateStatusSQL(e);
     m_command.ExecuteNonQuery();
 }