using BusinesLayer.BLOutPatient; using BusinesLayer.BLPharmacy; using CrystalDecisions.CrystalReports.Engine; using EntityDataLayer; using EntityDataLayer.model; using System; using System.Collections.Generic; using System.Configuration; using System.IO; using System.Linq; using System.Web; using System.Web.Hosting; using System.Web.Services; namespace WebMediSmart.webmethod { /// /// Summary description for servicebill /// [WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] [System.ComponentModel.ToolboxItem(false)] // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. [System.Web.Script.Services.ScriptService] public class servicebill : System.Web.Services.WebService { [WebMethod(EnableSession = true)] public List doctorlistbybranchcode() { try { string branchvode = Session["BranchCode"].ToString().Trim(); if (branchvode == "") { branchvode = ""; } List items = new List(); BLServiceBill bl = new BLServiceBill(); items = bl.doctorlistbybranchcode(branchvode); return items; } catch (Exception ex) { return null; } } [WebMethod] public List SalesList() { try { List items = new List(); BLServiceBill bl = new BLServiceBill(); items = bl.SalesList(); return items; } catch (Exception ex) { return null; } } [WebMethod] public List searchpatient(string searchtext) { try { BLServiceBill bl = new BLServiceBill(); return bl.searchpatient(searchtext); } catch (Exception ex) { return null; } } [WebMethod] public List SearchService_Code(string searchtext, string ServiceType, string ActivityType, string CompanyID) { try { BLServiceBill bl = new BLServiceBill(); return bl.SearchService_Code(searchtext, ServiceType, ActivityType, CompanyID.ToInt()); } catch (Exception ex) { return null; } } [WebMethod] public patientregister selectpatient(int patientval) { try { BLServiceBill bl = new BLServiceBill(); return bl.selectpatient(patientval); } catch (Exception ex) { return null; } } [WebMethod] public sp_NewServiceBillFetchDetails_Result getappoimentdetails(int patientval) { try { BLServiceBill bl = new BLServiceBill(); return bl.getappoimentdetails(patientval); } catch (Exception ex) { return null; } } [WebMethod] public sp_ServiceBillNewAddService_Result AddService(int PatientAppoinmentID, int ServiceID, string ServiceType) { try { BLServiceBill bl = new BLServiceBill(); return bl.AddService(PatientAppoinmentID, ServiceID, ServiceType); } catch (Exception ex) { return null; } } [WebMethod] public string SelectRefNo() { try { string strErr = ""; BLServiceBill bl = new BLServiceBill(); return bl.SelectRefNo(ref strErr); } catch (Exception ex) { return ""; } } [WebMethod] public double GetWalletAmount(int PatientID) { try { string strErr = ""; BLServiceBill bl = new BLServiceBill(); return bl.GetWalletAmount(PatientID, ref strErr); } catch (Exception ex) { return 0; } } [WebMethod] public int GetGroupID(int UserID) { try { string strErr = ""; BLServiceBill bl = new BLServiceBill(); return bl.GetGroupID(UserID, ref strErr); } catch (Exception ex) { return 0; } } [WebMethod] public bool GetVat(int ServiceID) { try { string strErr = ""; BLServiceBill bl = new BLServiceBill(); return bl.GetVat(ServiceID, ref strErr); } catch (Exception ex) { return false; } } [WebMethod] public sp_ServiceBillNewInsuranceDetails_Result fillInsuranceDetails(int patientval) { try { string strErr = ""; BLServiceBill bl = new BLServiceBill(); return bl.fillInsuranceDetails(patientval); } catch (Exception ex) { return null; } } [WebMethod] public Payersharedetails GetPayerShare(int PatientID, int LastVisitID, int BillTypeID, int ServiceID, float Rate, bool IsExcluded, bool IsApproved) { try { string strErr = ""; BLServiceBill bl = new BLServiceBill(); return bl.GetPayerShare(PatientID, LastVisitID, BillTypeID, ServiceID, Rate, IsExcluded, IsApproved, ref strErr); } catch (Exception ex) { return null; } } [WebMethod] public FindUserGroupSettings_Result FindUserGroupSettings(int GroupID) { try { string strErr = ""; BLServiceBill bl = new BLServiceBill(); return bl.FindUserGroupSettings(GroupID, ref strErr); } catch (Exception ex) { return null; } } [WebMethod] public List GetOffers() { try { string strErr = ""; BLServiceBill bl = new BLServiceBill(); return bl.GetOffers(ref strErr); } catch (Exception ex) { return null; } } [WebMethod] public int SendOTPEmail() { try { string strErr = ""; BLServiceBill bl = new BLServiceBill(); return bl.SendOTPEmail(ref strErr); } catch (Exception ex) { return 0; } } //[WebMethod] //public List fillSessionList(int patientval) //{ // try // { // string strErr = ""; // BLServiceBill bl = new BLServiceBill(); // return bl.fillSessionList(patientval); // } // catch (Exception ex) // { // return null; // } //} [WebMethod] public List PatientDiagnosisList(int patientval) { try { string strErr = ""; BLServiceBill bl = new BLServiceBill(); return bl.PatientDiagnosisList(patientval); } catch (Exception ex) { return null; } } [WebMethod(EnableSession = true)] public clsReturn saveServiceBill(EntityDataLayer.model.clsServiceBill service) { try { //EntityDataLayer.model.clsServiceBill service = new EntityDataLayer.model.clsServiceBill(); BLServiceBill bl = new BLServiceBill(); service.BranchCode = Session["BranchCode"].ToString().Trim(); return bl.saveServiceBill(service); } catch (Exception ex) { return null; } } [WebMethod(EnableSession = true)] public returnstaatus servicebillreport(int ServiceType, int ServiceBillID, int PatientID, int ReceiptID = 0) { returnstaatus rtn = new returnstaatus(); rtn.status = false; rtn.message = "
Login Agin.!
Session Expired.
"; try { if (Session["UserId"] == null) { return rtn; } int userval = Convert.ToInt16(Session["UserId"].ToString()); string ServiceBillNo = ""; BLServiceBill bl = new BLServiceBill(); ServiceBillNo = bl.GetServiceBillNo(ServiceBillID); string dataSourceName = ConfigurationManager.AppSettings["DSN"]; string dataBaseName = ConfigurationManager.AppSettings["DBN"]; string userName = ConfigurationManager.AppSettings["USR"]; string password = ConfigurationManager.AppSettings["PWD"]; // string fromDt = Convert.ToDateTime(fromdt, System.Globalization.CultureInfo.GetCultureInfo("hi-IN").DateTimeFormat).ToString("dd/MMM/yyyy"); // string toDt = Convert.ToDateTime(todt, System.Globalization.CultureInfo.GetCultureInfo("hi-IN").DateTimeFormat).ToString("dd/MMM/yyyy"); ReportDocument rd = new ReportDocument(); string ReportName = ""; switch (ServiceType) { case 1: ReportName = "ServiceCash.rpt"; break; case 2: ReportName = "ServiceCompany.rpt"; break; case 3: ReportName = "ServiceCash.rpt"; break; case 4: ReportName = "RptReceipt.rpt"; break; } rd.Load(Path.Combine(HostingEnvironment.MapPath("~/Reports"), ReportName)); if (ServiceType == 4) { rd.SetParameterValue("@Receiptid", ReceiptID); } else { rd.SetParameterValue("@ServiceBillNO", ServiceBillNo); } rd.DataSourceConnections[0].SetConnection(dataSourceName, dataBaseName, userName, password); string path = HostingEnvironment.MapPath("~/Report/patient/TempView"); string yourGuid = Guid.NewGuid().ToString(); string pathToCreate = Path.Combine(path, yourGuid); if (!Directory.Exists(pathToCreate)) { Directory.CreateDirectory(Path.Combine(path, yourGuid)); } rd.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, HostingEnvironment.MapPath("~/Report/patient/TempView/" + yourGuid + "/" + "ServiceBill.pdf")); rd.Close(); rd.Dispose(); rtn.status = true; rtn.message = "../Report/patient/TempView/" + yourGuid + "/" + "ServiceBill.pdf"; string strerr = ""; bl.SendReport(PatientID, path +"/"+ yourGuid + "/" + "ServiceBill.pdf", ref strerr); return rtn; } catch (Exception ex) { rtn.message = "
" + ex.Message + "
"; return rtn; } } [WebMethod(EnableSession = true)] public returnstaatus servicebillreport2(int ServiceType, int ServiceBillID, int PatientID, int ReceiptID = 0) { returnstaatus rtn = new returnstaatus(); rtn.status = false; rtn.message = "
Login Agin.!
Session Expired.
"; try { if (Session["UserId"] == null) { return rtn; } int userval = Convert.ToInt16(Session["UserId"].ToString()); string ServiceBillNo = ""; BLServiceBill bl = new BLServiceBill(); ServiceBillNo = bl.GetServiceBillNo(ServiceBillID); string dataSourceName = ConfigurationManager.AppSettings["DSN"]; string dataBaseName = ConfigurationManager.AppSettings["DBN"]; string userName = ConfigurationManager.AppSettings["USR"]; string password = ConfigurationManager.AppSettings["PWD"]; // string fromDt = Convert.ToDateTime(fromdt, System.Globalization.CultureInfo.GetCultureInfo("hi-IN").DateTimeFormat).ToString("dd/MMM/yyyy"); // string toDt = Convert.ToDateTime(todt, System.Globalization.CultureInfo.GetCultureInfo("hi-IN").DateTimeFormat).ToString("dd/MMM/yyyy"); ReportDocument rd = new ReportDocument(); string ReportName = ""; switch (ServiceType) { case 1: ReportName = "ServiceCash.rpt"; break; case 2: ReportName = "ServiceCompany.rpt"; break; case 3: ReportName = "ServiceInvoiceInsurance.rpt"; break; case 4: ReportName = "RptReceipt.rpt"; break; } rd.Load(Path.Combine(HostingEnvironment.MapPath("~/Reports"), ReportName)); if (ServiceType == 4) { rd.SetParameterValue("@Receiptid", ReceiptID); } else { rd.SetParameterValue("@ServiceBillNO", ServiceBillNo); } rd.DataSourceConnections[0].SetConnection(dataSourceName, dataBaseName, userName, password); string path = HostingEnvironment.MapPath("~/Report/patient/TempView"); string yourGuid = Guid.NewGuid().ToString(); string pathToCreate = Path.Combine(path, yourGuid); if (!Directory.Exists(pathToCreate)) { Directory.CreateDirectory(Path.Combine(path, yourGuid)); } rd.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, HostingEnvironment.MapPath("~/Report/patient/TempView/" + yourGuid + "/" + "ServiceBill.pdf")); rd.Close(); rd.Dispose(); rtn.status = true; rtn.message = "../Report/patient/TempView/" + yourGuid + "/" + "ServiceBill.pdf"; string strerr = ""; bl.SendReport(PatientID, path + yourGuid + "/" + "ServiceBill.pdf", ref strerr); return rtn; } catch (Exception ex) { rtn.message = "
" + ex.Message + "
"; return rtn; } } } }