public JsonResult GetLedgerSummery() { GetStoreId(); var parties = objDal.GetPartyList(StoreId); List <LedgerSummary> ledgerSummary = new List <LedgerSummary>(); foreach (clsParty party in parties) { var ledger = objLedgerDal.GetLedgerbyParty(party.PartyId.ToString()); if (ledger != null && ledger.Count() != 0) { clsLedger objledger = ledger.Last(); LedgerSummary summary = new LedgerSummary(); summary.ClosingBalance = objledger.ClosingBalance; summary.PartyName = party.PartyName; ledgerSummary.Add(summary); } } var Result = new { page = 1, records = ledgerSummary.Count(), rows = ledgerSummary, total = 1 }; return(Json(Result, JsonRequestBehavior.AllowGet)); }
public ActionResult Ledger() { clsLedger oModel = new clsLedger(); List <clsLedger> oList1 = new List <clsLedger>(); oModel.LstItem = oList1; return(View(oModel)); }
public ActionResult Ledger(clsLedger oCls, string Submit) { clsLedger oModel = new clsLedger(); clsSubmitModel oSubmit = new clsSubmitModel(); DataTable dt = new DataTable(); int comp = Convert.ToInt32(SessionMaster.CompCode); if (comp == 0) { TempData["message"] = "Please Select Company ..."; } switch (Submit) { case "Search": //string sFilter = ""; //string sInnerFilter = ""; //if (oCls.FromDt != "" && oCls.ToDt != "") // sInnerFilter = "@BdDateFrom ='" + oSubmit.GetDateFormat(oCls.FromDt) + "', @BdDateTo ='" + oSubmit.GetDateFormat(oCls.ToDt) + "' ,"; //else // sInnerFilter = "'2017-04-01', '2017-09-23' ,"; //if (oCls.PartyID > 0) // sFilter = " @PartyID =" + oCls.PartyID; //dt = oSubmit.GetData("select * from udf_GetTrialBalLedger(" + sInnerFilter + SessionMaster.CompCode + ", 60, '2017-09-23') where 1=1 " + sFilter); dt = oSubmit.GetData("Exec sp_GetLedger @CompList = '" + SessionMaster.CompCode + "', @AcctList = " + oCls.PartyID + ", @BdDateFrom = '" + oSubmit.GetDateFormat(oCls.FromDt) + "', @BdDateTo = '" + oSubmit.GetDateFormat(oCls.ToDt) + "'"); List <clsLedger> oList1 = new List <clsLedger>(); for (int i = 0; i < dt.Rows.Count; i++) { oModel = new Models.clsLedger(); //oModel.grouname = dt.Rows[i]["groupnum"].ToString(); oModel.acctcode = Convert.ToInt32(dt.Rows[i]["trncode"].ToString()); oModel.acctname = dt.Rows[i]["ledger"].ToString(); //oModel.cityname = dt.Rows[i]["cityname"].ToString(); // oModel.opbl = Convert.ToDecimal(dt.Rows[i]["opbl"].ToString()); if (Convert.ToDecimal(dt.Rows[i]["Dr"].ToString()) > 0) { oModel.dr = Convert.ToDecimal(dt.Rows[i]["Dr"]); } else { oModel.dr = 0; } if (Convert.ToDecimal(dt.Rows[i]["Cr"].ToString()) > 0) { oModel.cr = Convert.ToDecimal(dt.Rows[i]["Cr"]); } else { oModel.cr = 0; } oModel.crdrbl = Convert.ToDecimal(dt.Rows[i]["Bal"].ToString()); //oModel.grourepo = dt.Rows[i]["grourepo"].ToString(); oModel.mstdate = Convert.ToDateTime(dt.Rows[i]["VcDt"].ToString()); oModel.mstcode = Convert.ToInt32(dt.Rows[i]["trncode"].ToString()); oModel.msttype = Convert.ToInt32(dt.Rows[i]["trntype"].ToString()); oModel.sType = dt.Rows[i]["VcType"].ToString(); oModel.VcNO = dt.Rows[i]["VcNo"].ToString(); oModel.Particular = dt.Rows[i]["OnAccountName"].ToString(); oModel.trnsrno = Convert.ToInt32(dt.Rows[i]["trnitem"].ToString()); oModel.trnrema = dt.Rows[i]["DrCr"].ToString(); //oModel.mstrema = dt.Rows[i]["mstrema"].ToString(); oList1.Add(oModel); } oModel.LstItem = oList1; break; case "Print": break; } return(View(oModel)); }
public ActionResult LedgerReport(string sFrom, string sTO, string sParty, int WithItem = 1, int Compcode = 0) { clsLedger oModel = new clsLedger(); clsSubmitModel oSubmit = new clsSubmitModel(); DataTable dt = new DataTable(); int comp = Convert.ToInt32(SessionMaster.CompCode); if (sFrom == null || sFrom == "") { sFrom = "01/04/" + DateTime.Now.Year; } if (sTO == null || sTO == "") { sTO = "31/03/" + ((Int32)DateTime.Now.Year + 1); } dt = oSubmit.GetData("Exec sp_GetLedger @CompList = '" + Compcode + "', @AcctList = '" + sParty + "', @BdDateFrom = '" + oSubmit.GetDateFormat(sFrom) + "', @BdDateTo = '" + oSubmit.GetDateFormat(sTO) + "' ,@pItemDtls= " + WithItem); List <clsLedger> oList1 = new List <clsLedger>(); for (int i = 0; i < dt.Rows.Count; i++) { oModel = new Models.clsLedger(); oModel.acctcode = Convert.ToInt32(dt.Rows[i]["trncode"].ToString()); oModel.acctname = dt.Rows[i]["ledger"].ToString(); if (Convert.ToDecimal(dt.Rows[i]["Dr"].ToString()) > 0) { oModel.dr = Convert.ToDecimal(dt.Rows[i]["Dr"]); } else { oModel.dr = 0; } if (Convert.ToDecimal(dt.Rows[i]["Cr"].ToString()) > 0) { oModel.cr = Convert.ToDecimal(dt.Rows[i]["Cr"]); } else { oModel.cr = 0; } oModel.crdrbl = Convert.ToDecimal(dt.Rows[i]["Bal"].ToString()); oModel.mstdate = Convert.ToDateTime(dt.Rows[i]["VcDt"].ToString()); oModel.mstcode = Convert.ToInt32(dt.Rows[i]["trncode"].ToString()); oModel.msttype = Convert.ToInt32(dt.Rows[i]["trntype"].ToString()); oModel.sType = dt.Rows[i]["VcType"].ToString(); oModel.VcNO = dt.Rows[i]["VcNo"].ToString(); oModel.Particular = dt.Rows[i]["OnAccountName"].ToString() + " <br/> " + dt.Rows[i]["Remark"].ToString().Replace("<br/>", " <br/> "); oModel.mstrema = Convert.ToDateTime(dt.Rows[i]["VcDt"].ToString()).ToString("dd/MM/yyyy"); oModel.trnsrno = Convert.ToInt32(dt.Rows[i]["trnitem"].ToString()); oModel.trnrema = dt.Rows[i]["DrCr"].ToString(); oModel.Compcode = Compcode; oList1.Add(oModel); } // oModel.LstItem = oList1; // return View( "Ledger" , oModel ); var sData = new { oList = oList1 }; return(Json(Json(sData).Data, JsonRequestBehavior.AllowGet)); }
public ActionResult TrialBal(int CompCode, string From, string To, int DealerCode = 0, int StateID = 0, int Executive = 0) { clsLedger oModel = new clsLedger(); clsSubmitModel oSubmit = new clsSubmitModel(); DataTable dt = new DataTable(); int comp = Convert.ToInt32(SessionMaster.CompCode); if (comp == 0) { TempData["message"] = "Please Select Company ..."; } string sDealer = ""; string sState = ""; if (DealerCode > 0) { sDealer = "and acctcode = " + DealerCode; } if (StateID > 0) { sState = "and acctstat = " + StateID; } if (Executive > 0) { dt = oSubmit.GetData("select a.* from [udf_GetTrialBalQuick]('" + oSubmit.GetDateFormat(From) + "', '" + oSubmit.GetDateFormat(To) + "', " + CompCode + " , 0) a Left join tblDistributor b on a.acctDeal = b.mstCode Left join EmpAllotMst c on b.mstCode = c.DealerID where groucode = 21 and empID = (select empcode from Employee where usecode = " + Executive + ") " + sDealer + sState + " order by grouposi , grouname ,acctname "); } else { dt = oSubmit.GetData("select * from [udf_GetTrialBalQuick]('" + oSubmit.GetDateFormat(From) + "', '" + oSubmit.GetDateFormat(To) + "', " + CompCode + " , 0) where groucode = 21 " + sDealer + sState + " order by grouposi , grouname ,acctname "); } decimal dDR = 0; decimal dCR = 0; List <clsLedger> oList1 = new List <clsLedger>(); for (int i = 0; i < dt.Rows.Count; i++) { oModel = new Models.clsLedger(); oModel.Compcode = Convert.ToInt32(dt.Rows[i]["Compcode"].ToString()); oModel.acctcode = Convert.ToInt32(dt.Rows[i]["acctcode"].ToString()); oModel.grouname = dt.Rows[i]["grouname"].ToString(); oModel.acctname = dt.Rows[i]["acctname"].ToString(); if (Convert.ToDecimal(dt.Rows[i]["dr"].ToString()) > 0) { oModel.dr = Convert.ToDecimal(dt.Rows[i]["dr"]); dDR += Convert.ToDecimal(dt.Rows[i]["dr"]); } else { oModel.dr = 0; } if (Convert.ToDecimal(dt.Rows[i]["cr"].ToString()) > 0) { oModel.cr = Convert.ToDecimal(dt.Rows[i]["Cr"]); dCR += Convert.ToDecimal(dt.Rows[i]["Cr"]); } else { oModel.cr = 0; } oModel.opbl = Convert.ToDecimal(dt.Rows[i]["opbl"].ToString()); oModel.crdrbl = Convert.ToDecimal(dt.Rows[i]["crdrbl"].ToString()); oList1.Add(oModel); } oModel = new Models.clsLedger(); oModel.Compcode = 0; oModel.opbl = oModel.crdrbl = oModel.acctcode = 0; oModel.grouname = ""; oModel.acctname = "Total"; oModel.dr = dDR; oModel.cr = dCR; oList1.Add(oModel); oModel.LstItem = oList1; return(View(oModel)); //clsLedger oModel = new clsLedger(); //List<clsLedger> oList1 = new List<clsLedger>(); //oModel.LstItem = oList1; //return View(oModel); }