public ChallanaPaymentReportDTO GetChallanaPaymentReport(string connectionstring, string ChallanaNO) { ChallanaPaymentReportDTO lstChallanaPaymentReport = new ChallanaPaymentReportDTO(); try { using (NpgsqlDataReader dr = NPGSqlHelper.ExecuteReader(connectionstring, CommandType.Text, "select distinct c.challana_no,tc.tan_number,c.company_type,tc.nameofenterprise as Companyname,(tcd.address1 || tcd.address2 || tcd.district ||','|| tcd.city||','||tcd.state||' - ' ||tcd.pincode)address,tv.section,c.actual_tds,date_part('year',current_date) as currentyear,date_part('year',current_date)+1 as nextyear from challana_entry c join tblmstcompany tc on tc.companyid=c.companyid join challana_entry_details cd on cd.challana_id= c.challana_id left join tblmstcompanyaddressdetails tcd on tcd.companyid=tc.companyid and tcd.priority='PRIMARY' join tds_vouchers tv on tv.tds_voucher_id=cd.tds_voucher_id where c.challana_no='" + ChallanaNO + "' ")) { while (dr.Read()) { lstChallanaPaymentReport = new ChallanaPaymentReportDTO() { pChallanaNo = dr["challana_no"], pTanNo = dr["tan_number"], pCompanyType = dr["company_type"], pCompanyName = dr["Companyname"], pAddress = dr["address"], pSection = dr["section"], pActualTdsAmount = Convert.ToDecimal(dr["actual_tds"]), pCurrentYear = dr["currentyear"], pNextYear = dr["nextyear"], }; } } } catch (Exception ex) { throw ex; } return(lstChallanaPaymentReport); }
public IActionResult GetChallanaPaymentReport(string ChallanaNO) { ChallanaPaymentReportDTO ChallanaPaymentReportList = new ChallanaPaymentReportDTO(); try { ChallanaPaymentReportList = objChallana.GetChallanaPaymentReport(Con, ChallanaNO); return(ChallanaPaymentReportList != null?Ok(ChallanaPaymentReportList) : (IActionResult)StatusCode(StatusCodes.Status204NoContent)); } catch (Exception ex) { return(StatusCode(StatusCodes.Status500InternalServerError)); throw ex; } }