protected override IList doSearch(string find) { try { m_command.CommandText = PurchaseReturn.GetSearch(find); MySql.Data.MySqlClient.MySqlDataReader r = m_command.ExecuteReader(); IList rest = PurchaseReturn.TransformReaderList(r); r.Close(); return(rest); } catch (Exception x) { throw x; } }
public IList GetAllTransactions(int supID) { ArrayList result = new ArrayList(); OpenConnection(); MySql.Data.MySqlClient.MySqlDataReader r; m_cmd.CommandText = PurchaseOrder.GetBySupplierSQL(supID); r = m_cmd.ExecuteReader(); IList po = PurchaseOrder.TransformReaderList(r); r.Close(); foreach (Event e in po) { result.Add(e); } m_cmd.CommandText = GoodReceiveNote.GetBySupplierSQL(supID); r = m_cmd.ExecuteReader(); IList grn = GoodReceiveNote.TransformReaderList(r); r.Close(); foreach (Event e in grn) { result.Add(e); } m_cmd.CommandText = SupplierInvoice.GetBySupplierSQL(supID); r = m_cmd.ExecuteReader(); IList si = SupplierInvoice.TransformReaderList(r); r.Close(); foreach (Event e in si) { result.Add(e); } m_cmd.CommandText = PurchaseReturn.GetBySupplierSQL(supID); r = m_cmd.ExecuteReader(); IList pr = PurchaseReturn.TransformReaderList(r); r.Close(); foreach (Event e in pr) { result.Add(e); } m_cmd.CommandText = APDebitNote.GetBySupplierSQL(supID); r = m_cmd.ExecuteReader(); IList apdn = APDebitNote.TransformReaderList(r); r.Close(); foreach (EventJournal e in apdn) { result.Add(e); } m_cmd.CommandText = Payment.GetBySupplierSQL(supID); r = m_cmd.ExecuteReader(); IList py = Payment.TransformReaderList(r); r.Close(); foreach (EventJournal e in py) { result.Add(e); } m_cmd.CommandText = SupplierOutStandingInvoice.GetBySupplierSQL(supID); r = m_cmd.ExecuteReader(); IList soi = SupplierOutStandingInvoice.TransformReaderList(r); r.Close(); foreach (EventJournal e in soi) { result.Add(e); } result.Sort(new EventDateComparer()); return(result); }
public IList FindPRForAPDebitNote(string find, int supID, DateTime trdate, IList added) { m_command.CommandText = APDebitNoteItem.GetPRUsedByAPDN(); MySql.Data.MySqlClient.MySqlDataReader r = m_command.ExecuteReader(); if (r.HasRows) { while (r.Read()) { int id = Convert.ToInt32(r[0]); if (!added.Contains(id)) { added.Add(id); } } } r.Close(); StringBuilder poisSB = new StringBuilder(); foreach (int i in added) { poisSB.Append(i.ToString()); poisSB.Append(','); } string pois = poisSB.ToString(); pois = added.Count > 0 ? pois.Substring(0, pois.Length - 1) : ""; m_command.CommandText = PurchaseReturn.GetSearchPRNoForAPDN(find, supID, pois, trdate); r = m_command.ExecuteReader(); IList result = PurchaseReturn.TransformReaderList(r); r.Close(); foreach (PurchaseReturn p in result) { m_command.CommandText = PurchaseReturnItem.GetByEventIDSQL(p.ID); r = m_command.ExecuteReader(); p.EVENT_ITEMS = PurchaseReturnItem.TransformReaderList(r); r.Close(); foreach (PurchaseReturnItem t in p.EVENT_ITEMS) { if ((t.GRN_ITEM == null) && (t.GRN_ITEM.ID == 0)) { continue; } m_command.CommandText = GoodReceiveNoteItem.GetByIDSQL(t.GRN_ITEM.ID); r = m_command.ExecuteReader(); t.GRN_ITEM = GoodReceiveNoteItem.TransformReader(r); r.Close(); if ((t.GRN_ITEM.PO_ITEM == null)) { continue; } if (t.GRN_ITEM.PO_ITEM.ID == 0) { continue; } m_command.CommandText = PurchaseOrderItem.GetByIDSQL(t.GRN_ITEM.PO_ITEM.ID); r = m_command.ExecuteReader(); t.GRN_ITEM.PO_ITEM = PurchaseOrderItem.TransformReader(r); r.Close(); t.GRN_ITEM.PART = PartRepository.GetByID(m_command, t.GRN_ITEM.PART.ID); t.GRN_ITEM.PART.UNIT_CONVERSION_LIST = PartRepository.GetUnitConversionsStatic(m_command, t.GRN_ITEM.PO_ITEM.PART.ID); t.PART = t.GRN_ITEM.PO_ITEM.PART = t.GRN_ITEM.PART; double subamount = (t.GRN_ITEM.PO_ITEM.SUBTOTAL / t.GRN_ITEM.PO_ITEM.GetAmountInSmallestUnit()) * t.GetAmountInSmallestUnit(); p.TOTAL_AMOUNT_FROM_PO += subamount; t.GRN_ITEM.PO_ITEM.EVENT = PurchaseOrderRepository.GetHeaderOnly(m_command, t.GRN_ITEM.PO_ITEM.EVENT.ID); p.CURRENCY = ((PurchaseOrder)t.GRN_ITEM.PO_ITEM.EVENT).CURRENCY; } } return(result); }