//------------------ Get Sale-Purchage Information ----------------------------------------------- public List <SalePurchaseEntity> GetSalePurchase(DBSite site, string sp_ids = "") { List <SalePurchaseEntity> sale_purchase_entity_list = new List <SalePurchaseEntity>(); SalePurchaseEntity sale_purchase_entity = null; //444 string qry = " SELECT ledgerId " + ", Billdate " + ", AccountName " + ", credit " // if sales else debit + ", particulars " + ", discount " + " FROM tblLedger l" + Util_BLL.GetUserWhereCondition(Util_BLL.User); //string qry = GetQueryForSimpleFields(); DataTable dt = dt = site.ExecuteSelect(qry); foreach (DataRow row in dt.Rows) { sale_purchase_entity = new SalePurchaseEntity(); // -------- sale purchase entity ---------- //--------------- Normal Fields ---------------------------- sale_purchase_entity.SalePurchaseId = util.CheckNullInt(row["LedgerId"]); sale_purchase_entity.BillDate = util.CheckNull(row["LDate"]); sale_purchase_entity.party = util.CheckNull(row["AccountName"]); sale_purchase_entity.BillNumber = util.CheckNull(row["BillNumber"]); sale_purchase_entity.SalePurchaseAmount = util.CheckNullDouble(row["Debit"]); sale_purchase_entity.discount = util.CheckNull(row["Particulars"]); sale_purchase_entity.discount = util.CheckNull(row["Discount"]); double discount = util.GetDiscountAmount(sale_purchase_entity.discount, sale_purchase_entity.SalePurchaseAmount); sale_purchase_entity.TotalAmount = sale_purchase_entity.SalePurchaseAmount - discount; //---------------- sale detail entity [ product information ]------------------ // -------------- tax information [ taxes on the whole ] ------------------------ sale_purchase_entity_list.Add(sale_purchase_entity); } return(sale_purchase_entity_list); }