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; } }
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; } }
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; } }
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; } }
//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; } }
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; } }
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; } }
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; } }
abstract protected void doConfirm(EventJournal events, Period p);
public void UpdateStatus(EventJournal e, bool p) { doUpdateStatus(e, p); }
public void Delete(EventJournal e) { doDelete(e); }
public void DeleteNoTransaction(EventJournal e) { doDeleteNoTransaction(e); }
public void UpdateNoTransaction(EventJournal e) { doUpdateNoTransaction(e); }
abstract protected void doSave(EventJournal e);
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(); }
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(); }
abstract protected void doDelete(EventJournal e);
abstract protected void doDeleteNoTransaction(EventJournal e);
abstract protected void doUpdate(EventJournal e);
protected override void doUpdateStatus(EventJournal e, bool posted) { m_command.CommandText = ARCreditNote.GetUpdateStatusSQL(e); m_command.ExecuteNonQuery(); }
public void Update(EventJournal e) { doUpdate(e); }
abstract protected void doUpdateStatus(EventJournal e, bool p);
abstract protected void doRevise(EventJournal events, Period p);
protected override void doUpdateStatus(EventJournal e, bool posted) { m_command.CommandText = SupplierInvoiceJournal.GetUpdateStatusSQL(e); m_command.ExecuteNonQuery(); }
public void Save(EventJournal e) { doSave(e); }
public void SaveNoTransaction(EventJournal e) { doSaveNoTransaction(e); }
protected override void doUpdateStatus(EventJournal e, bool posted) { m_command.CommandText = CustomerOutStandingInvoice.GetUpdateStatusSQL(e); m_command.ExecuteNonQuery(); }