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;
}
}
}
}