using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using IBBMSClassLib.Master.CDO;
using IBBMSClassLib.Master.DA;
using Ibbms.Security;
using HRClassLib.Master.CDO;
using HRClassLib.Master.DA;
using Ibbms.Security.CDO;
using Ibbms.Security.DA;
using CRILib.Master.CDO;
using CRILib.Master.DA;
using CRILib.Transaction.CDO;
using CRILib.Transaction.DA;
using GenCode128;
using System.Xml;
using System.IO;
using System.Text;
public partial class CRI_TRANSACTION_BloodIssue : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
clsUserMenuRights UserMenuRights = new clsUserMenuRights();
if (!UserMenuRights.Assign_Rights(Request.ApplicationPath, Request.CurrentExecutionFilePath, Session["USERNAME"] == null ? "" : Session["USERNAME"].ToString()))
Response.Redirect(UserMenuRights.Redirectpath);
ViewState["viewflg"] = UserMenuRights.view_flag.ToString();
ViewState["editflg"] = UserMenuRights.Edit_flag.ToString();
ViewState["delflg"] = UserMenuRights.Del_flag.ToString();
ViewState["addflg"] = UserMenuRights.Add_flag.ToString();
gvISSUEMAIN.Columns[0].Visible = Convert.ToBoolean(ViewState["editflg"].ToString());
gvISSUEMAIN.Columns[1].Visible = Convert.ToBoolean(ViewState["viewflg"].ToString());
btnADDNEW.Visible = Convert.ToBoolean(ViewState["addflg"].ToString());
CompareValidator9.ValueToCompare = DateTime.Now.ToString("dd/MM/yyyy");
CompareValidator1.ValueToCompare = DateTime.Now.ToString("dd/MM/yyyy");
txtFISSUE_D.Text = DateTime.Now.ToShortDateString();
txtISSUE_D.Text = DateTime.Now.ToShortDateString();
Bind_REQUISITIONID();
Bind_PatientCategory();
Bind_Employee();
Bind_BloodGroup();
Bind_RhdFactor();
SetPanel(true);
pnlISSEDETAILS.Visible = false;
pnlLABELPRINTING.Visible = false;
btnISSUELABEL.Enabled = false;
btnISSUEREPORT.Enabled = false;
if (Request["REQN_C"] != null)
{
if (!string.IsNullOrEmpty(Request["REQN_C"].ToString()))
{
btnADDNEW_Click(null, null);
txtRequisitionId.Text = Request["REQN_C"].ToString();
ddlREQUISITIONID.SelectedIndex = ddlREQUISITIONID.Items.IndexOf(ddlREQUISITIONID.Items.FindByText(txtRequisitionId.Text.Trim()));
imgtxtReq_c_Click(null, null);
btnFetchReqnDtl.Focus();
}
}
}
}
//Set Panel
private void SetPanel(bool flg)
{
pnlGrid.Visible = flg;
pnlTrans.Visible = !flg;
}
//BIND CATEGORY.....
private void Bind_PatientCategory()
{
clsPATCATMST_CDO PATCATMST_CDO = new clsPATCATMST_CDO();
clsPATCATMST_DA PATCATMST_DA = new clsPATCATMST_DA();
DataSet DSPATCAT = new DataSet();
DSPATCAT = PATCATMST_DA.GET_BL_PATCATEGORY_COMBO(PATCATMST_CDO);
ddlPATCATEGORY = BindListBox(ddlPATCATEGORY, DSPATCAT, "CATEGORY_M", "CATEGORY_C");
ddlPATCATEGORY.Items.Insert(0, "SELECT");
ddlPATCATEGORY.SelectedIndex = ddlPATCATEGORY.Items.IndexOf(ddlPATCATEGORY.Items.FindByText("SELECT"));
}
private void Bind_REQUISITIONID()
{
ddlREQUISITIONID.Items.Clear();
clsISSMST_CDO ISSMST_CDO = new clsISSMST_CDO();
clsISSMST_DA ISSMST_DA = new clsISSMST_DA();
ISSMST_CDO.ISSUE_D = DateTime.Parse(txtISSUE_D.Text);
DataSet DS = new DataSet();
DS = ISSMST_DA.GET_REQN_C_FOR_ISSUE(ISSMST_CDO);
ddlREQUISITIONID.Items.Clear();
ddlREQUISITIONID.Items.Insert(0, "SELECT");
if (DS.Tables[0].Rows.Count > 0)
{
ddlREQUISITIONID = BindListBox(ddlREQUISITIONID, DS, "REQN_C", "REQN_C");
}
}
private void Bind_Employee()
{
ddlFISSUEBY.Items.Clear();
ddlISSUEBY.Items.Clear();
clsEmpmst_CDO Empmst_CDO = new clsEmpmst_CDO();
clsEmpmst_DA Empmst_DA = new clsEmpmst_DA();
Empmst_CDO.COLOCN_C = Session["COLOCN_C"].ToString();
DataSet dsTemp = new DataSet();
dsTemp = Empmst_DA.Get_HR_EMPMST_COMBO(Empmst_CDO);
ddlISSUEBY.Items.Insert(0, "SELECT");
ddlISSUEBY.DataSource = dsTemp;
ddlISSUEBY.DataTextField = "EMP_M";
ddlISSUEBY.DataValueField = "EMP_C";
ddlISSUEBY.DataBind();
ddlFISSUEBY.Items.Insert(0, "ALL");
ddlFISSUEBY.DataSource = dsTemp;
ddlFISSUEBY.DataTextField = "EMP_M";
ddlFISSUEBY.DataValueField = "EMP_C";
ddlFISSUEBY.DataBind();
}
// DropDownList Binding Function
private DropDownList BindListBox(DropDownList ddlList, DataSet ds, string TextFields, string ValueFields)
{
ddlList.DataSource = ds;
ddlList.DataTextField = TextFields;
ddlList.DataValueField = ValueFields;
ddlList.DataBind();
if (ddlList.Items.Count > 0)
{
ddlList.SelectedIndex = -1;
}
return ddlList;
}
//BIND BLOOD GROUP
private void Bind_BloodGroup()
{
clsBLDGRPMST_CDO BLDGRPMST_CDO = new clsBLDGRPMST_CDO();
clsBLDGRPMST_DA BLDGRPMST_DA = new clsBLDGRPMST_DA();
DataSet DSBLDGRP = new DataSet();
DSBLDGRP = BLDGRPMST_DA.GET_BLDGRPMST_COMBO(BLDGRPMST_CDO);
ddlBLDGRP_C = BindListBox(ddlBLDGRP_C, DSBLDGRP, "BLDGRPSHT_M", "BLDGRP_C");
ddlBLDGRP_C.Items.Insert(0, "SELECT");
ddlBLDGRP_C.SelectedIndex = ddlBLDGRP_C.Items.IndexOf(ddlBLDGRP_C.Items.FindByText("SELECT"));
}
//BIND RH D FACTOR
private void Bind_RhdFactor()
{
clsBLDRHDFCTMST_CDO BLDRHDFCTMST_CDO = new clsBLDRHDFCTMST_CDO();
clsBLDRHDFCTMST_DA BLDRHDFCTMST_DA = new clsBLDRHDFCTMST_DA();
DataSet DSRHDFACTOR = new DataSet();
DSRHDFACTOR = BLDRHDFCTMST_DA.GET_BL_BLDRHDFCTMST_COMBO(BLDRHDFCTMST_CDO);
ddlBLDRHDFCT_C = BindListBox(ddlBLDRHDFCT_C, DSRHDFACTOR, "BLDRHDSHT_M", "BLDRHDFCT_C");
ddlBLDRHDFCT_C.Items.Insert(0, "SELECT");
ddlBLDRHDFCT_C.SelectedIndex = ddlBLDRHDFCT_C.Items.IndexOf(ddlBLDRHDFCT_C.Items.FindByText("SELECT"));
}
protected void ddlREQUISITIONID_SelectedIndexChanged(object sender, EventArgs e)
{
lblstatus_msg.Text = "";
}
private void SETPATDTL(DataSet DS)
{
if (DS.Tables[0].Rows[0]["PATINST_I"].ToString() == "P")
{
txtPATINST_M.Text = DS.Tables[0].Rows[0]["PAT_M"].ToString();
ddlPATCATEGORY.SelectedIndex = ddlPATCATEGORY.Items.IndexOf(ddlPATCATEGORY.Items.FindByValue(DS.Tables[0].Rows[0]["CATEGORY_C"].ToString()));
ddlSEX_I.SelectedIndex = ddlSEX_I.Items.IndexOf(ddlSEX_I.Items.FindByValue(DS.Tables[0].Rows[0]["SEX_I"].ToString()));
txtREM_X.Text = DS.Tables[0].Rows[0]["REM_X"].ToString();
ddlBLDGRP_C.SelectedIndex = ddlBLDGRP_C.Items.IndexOf(ddlBLDGRP_C.Items.FindByValue(DS.Tables[0].Rows[0]["BLDGRP_C"].ToString()));
ddlBLDRHDFCT_C.SelectedIndex = ddlBLDRHDFCT_C.Items.IndexOf(ddlBLDRHDFCT_C.Items.FindByValue(DS.Tables[0].Rows[0]["BLDRHDFCT_C"].ToString()));
ddlPATINST_I.SelectedIndex = ddlPATINST_I.Items.IndexOf(ddlPATINST_I.Items.FindByValue(DS.Tables[0].Rows[0]["PATINST_I"].ToString()));
txtINST_M.Text = DS.Tables[0].Rows[0]["INST_M"].ToString();
txtDOCT_M.Text = DS.Tables[0].Rows[0]["DOCT_M"].ToString();
DateTime ENT_D = DateTime.Parse(DS.Tables[0].Rows[0]["ENT_D"].ToString());
DateTime CURRENT = DateTime.Now;
int YEARS;
int MONTHS;
int DAYS;
GetDifference(ENT_D, CURRENT, out YEARS, out MONTHS, out DAYS);
if (!string.IsNullOrEmpty(DS.Tables[0].Rows[0]["AGEYR_N"].ToString()))
YEARS = YEARS + int.Parse(DS.Tables[0].Rows[0]["AGEYR_N"].ToString());
if (!string.IsNullOrEmpty(DS.Tables[0].Rows[0]["AGEMON_N"].ToString()))
MONTHS = MONTHS + int.Parse(DS.Tables[0].Rows[0]["AGEMON_N"].ToString());
if (!string.IsNullOrEmpty(DS.Tables[0].Rows[0]["AGEDAY_N"].ToString()))
DAYS = DAYS + int.Parse(DS.Tables[0].Rows[0]["AGEDAY_N"].ToString());
if (DAYS < 0)
{
DAYS = DAYS + 30;
if (MONTHS > 0)
MONTHS = MONTHS - 1;
else
{
YEARS = YEARS - 1;
MONTHS = MONTHS + 12;
MONTHS = MONTHS - 1;
}
}
if (DAYS > 30)
{
DAYS = DAYS - 30;
MONTHS = MONTHS + 1;
if (MONTHS >= 12)
{
YEARS = YEARS + 1;
MONTHS = MONTHS - 12;
}
}
if (MONTHS >= 12)
{
YEARS = YEARS + 1;
MONTHS = MONTHS - 12;
}
if (MONTHS < 0)
{
YEARS = YEARS - 1;
MONTHS = MONTHS + 12;
}
txtYEAR.Text = YEARS.ToString();
txtAGEMONTH.Text = MONTHS.ToString();
txtAGEDAY.Text = DAYS.ToString();
}
else
{
txtPATINST_M.Text = DS.Tables[0].Rows[0]["INST_M"].ToString();
ddlPATINST_I.SelectedIndex = ddlPATINST_I.Items.IndexOf(ddlPATINST_I.Items.FindByValue(DS.Tables[0].Rows[0]["PATINST_I"].ToString()));
}
}
public void GetDifference(DateTime ENT_D, DateTime CURRENT, out int YEARS, out int MONTHS, out int DAYS)
{
YEARS = CURRENT.Year - ENT_D.Year;
MONTHS = CURRENT.Month - ENT_D.Month;
DAYS = CURRENT.Day - ENT_D.Day;
//if (DAYS < 0)
//{
// DAYS = DAYS + 30;
// if (MONTHS > 0)
// MONTHS = MONTHS - 1;
// else
// {
// YEARS = YEARS - 1;
// MONTHS = 12;
// MONTHS = MONTHS - 1;
// }
//}
}
protected void imgREQN_CREF_Click(object sender, ImageClickEventArgs e)
{
lblstatus_msg.Text = "";
if (ddlREQUISITIONID.SelectedIndex != 0)
{
gvISSUDETAILS.DataSource = null;
gvISSUDETAILS.DataBind();
pnlISSEDETAILS.Visible = false;
pnlLABELPRINTING.Visible = false;
clsRSVPRODMST_CDO RSVPRODMST_CDO = new clsRSVPRODMST_CDO();
clsRSVPRODMST_DA RSVPRODMST_DA = new clsRSVPRODMST_DA();
RSVPRODMST_CDO.COLOCN_C = Session["COLOCN_C"].ToString();
RSVPRODMST_CDO.REQN_C = ddlREQUISITIONID.SelectedItem.Text;
DataSet DSREQN = new DataSet();
DSREQN = RSVPRODMST_DA.GET_PATINST_I_BY_REQN_C(RSVPRODMST_CDO);
if (DSREQN.Tables[0].Rows.Count > 0)
{
txtRequisitionId.Text = ddlREQUISITIONID.SelectedItem.Text;
RSVPRODMST_CDO.PATINST_I = DSREQN.Tables[0].Rows[0]["PATINST_I"].ToString();
clsISSMST_CDO ISSMST_CDO = new clsISSMST_CDO();
clsISSMST_DA ISSMST_DA = new clsISSMST_DA();
ISSMST_CDO.REQN_C = ddlREQUISITIONID.SelectedItem.Text;
ISSMST_CDO.COLOCN_C = Session["COLOCN_C"].ToString();
ISSMST_CDO.PATINST_I = RSVPRODMST_CDO.PATINST_I.ToString();
ISSMST_CDO.PATINST_C = decimal.Parse(DSREQN.Tables[0].Rows[0]["PATINST_C"].ToString());
ISSMST_CDO.ISSUE_D = DateTime.Parse(txtISSUE_D.Text);
DataSet DSPAT = new DataSet();
DSPAT = ISSMST_DA.GET_PATINSTDOCT_DTL_BY_REQN_C(ISSMST_CDO);
if (DSPAT.Tables[0].Rows.Count > 0)
{
if (RSVPRODMST_CDO.PATINST_I == "P")
{
ViewState["PATINST_C"] = DSPAT.Tables[0].Rows[0]["PAT_C"].ToString();
SETPATDTL(DSPAT);
ViewState["ISSUEMASTER"] = DSPAT.Tables[0];
}
else
{
ViewState["PATINST_C"] = DSPAT.Tables[0].Rows[0]["INST_C"].ToString();
SETPATDTL(DSPAT);
ViewState["ISSUEMASTER"] = DSPAT.Tables[0];
}
}
}
else
{
lblstatus_msg.Text = "Requisition Id is invalid";
lblstatus_msg.ForeColor = System.Drawing.Color.Red;
}
//SETPATDTL(DSREQN);
}
else
{
Bind_REQUISITIONID();
txtREQN_C.Text = string.Empty;
ClearText();
ClearTextDtl();
}
}
private void setTextPatientDetail(Boolean flg)
{
txtINST_M.Enabled = flg;
ddlPATINST_I.Enabled = flg;
txtPATINST_M.Enabled = flg;
ddlPATCATEGORY.Enabled = flg;
txtDOCT_M.Enabled = flg;
ddlBLDGRP_C.Enabled = flg;
ddlBLDRHDFCT_C.Enabled = flg;
txtREM_X.Enabled = flg;
txtYEAR.Enabled = flg;
txtAGEMONTH.Enabled = flg;
txtAGEDAY.Enabled = flg;
ddlSEX_I.Enabled = flg;
}
protected void btnADDNEW_Click(object sender, ImageClickEventArgs e)
{
Bind_REQUISITIONID();
btnFetchReqnDtl.Enabled = true;
btnISSUELABEL.Visible = true;
btnISSUEREPORT.Visible = true;
SetPanel(false);
setTextPatientDetail(false);
btnSAVE.Text = "Save";
ddlREQUISITIONID.Enabled = true;
imgREQN_CREF.Visible = true;
txtISSUE_D.Enabled = true;
ImageButton2.Visible = true;
ClearText();
btnFetchReqnDtl.Visible = true;
btnISSUELABEL.Enabled = false;
btnISSUEREPORT.Enabled = false;
gvISSUDETAILS.DataSource = null;
gvISSUDETAILS.DataBind();
ClearTextDtl();
lblISSUE_N.Visible = false;
llblISSUE_N.Visible = false;
pnlISSEDETAILS.Visible = false;
pnlLABELPRINTING.Visible = false;
txtISSUE_D.Text = DateTime.Now.ToShortDateString();
ddlISSUEBY.Enabled = true;
ddlISSUEBY.SelectedIndex = ddlISSUEBY.Items.IndexOf(ddlISSUEBY.Items.FindByValue(Session["EMP_C"].ToString()));
lblRequisitionId.Visible = true;
txtRequisitionId.Visible = true;
imgtxtReq_c.Visible = true;
RequiredFieldValidator4.Visible = true;
txtRequisitionId.Enabled = true;
txtRequisitionId.Text = string.Empty;
}
protected void btnFetchReqnDtl_Click(object sender, EventArgs e)
{
lblstatus_msg.Text = "";
clsISSMST_CDO ISSMST_CDO = new clsISSMST_CDO();
clsISSMST_DA ISSMST_DA = new clsISSMST_DA();
ISSMST_CDO.COLOCN_C = Session["COLOCN_C"].ToString();
ISSMST_CDO.REQN_C = ddlREQUISITIONID.SelectedItem.Text;
ISSMST_CDO.ISSUE_D = DateTime.Parse(txtISSUE_D.Text);
// ISSMST_CDO.BLDGRP_C = decimal.Parse(ddlBLDGRP_C.SelectedValue.ToString());
// ISSMST_CDO.BLDRHDFCT_C = decimal.Parse(ddlBLDRHDFCT_C.SelectedValue.ToString());
DataSet DS = new DataSet();
DS = ISSMST_DA.GET_REQN_DTL_FOR_ISSUE(ISSMST_CDO);
decimal A = 0;
decimal B = 0;
if (!string.IsNullOrEmpty(DS.Tables[0].Rows[0]["UNT_N"].ToString()))
A = decimal.Parse(DS.Tables[0].Rows[0]["UNT_N"].ToString());
if (!string.IsNullOrEmpty(DS.Tables[0].Rows[0]["RSVQTY_N"].ToString()))
B = decimal.Parse(DS.Tables[0].Rows[0]["RSVQTY_N"].ToString());
if (A != 0 && B != 0)
{
if (A == B)
{
pnlISSEDETAILS.Visible = true;
if (DS.Tables[1].Rows.Count > 0)
{
gvISSUDETAILS.DataSource = DS.Tables[1];
gvISSUDETAILS.DataBind();
lblTOTALDETAILRECORD.Text = "Total Record Found :" + DS.Tables[1].Rows.Count;
btnSAVE.Visible = true;
ViewState["ISSUEDETAIL"] = DS.Tables[1];
}
else
{
gvISSUDETAILS.DataSource = null;
gvISSUDETAILS.DataBind();
lblTOTALDETAILRECORD.Text = "";
}
}
else
{
lblstatus_msg.Text = "Reservation is pending, Fetch not possible";
lblstatus_msg.ForeColor = System.Drawing.Color.Red;
}
}
else
{
lblstatus_msg.Text = "Reservation is pending, Fetch not possible";
lblstatus_msg.ForeColor = System.Drawing.Color.Red;
}
}
private void ClearText()
{
// txtISSUE_D.Text = String.Empty;
txtREM_X.Text = String.Empty;
ddlREQUISITIONID.SelectedIndex = -1;
// ddlISSUEBY.SelectedIndex = -1;
ddlPATINST_I.SelectedIndex = -1;
ddlBLDGRP_C.SelectedIndex = -1;
ddlBLDRHDFCT_C.SelectedIndex = -1;
txtINST_M.Text = string.Empty;
ddlPATINST_I.SelectedIndex = -1;
txtPATINST_M.Text = string.Empty;
ddlPATCATEGORY.SelectedIndex = -1;
txtDOCT_M.Text = string.Empty;
ddlBLDGRP_C.SelectedIndex = -1;
ddlBLDRHDFCT_C.SelectedIndex = -1;
txtREM_X.Text = string.Empty;
txtYEAR.Text = string.Empty;
txtAGEMONTH.Text = string.Empty;
txtAGEDAY.Text = string.Empty;
ddlSEX_I.SelectedIndex = -1;
}
//Enabled-Disabled Control Function
private void setText(Boolean flg)
{
txtISSUE_D.Enabled = flg;
txtREM_X.Enabled = flg;
ddlREQUISITIONID.Enabled = flg;
ddlISSUEBY.Enabled = flg;
ddlPATINST_I.Enabled = flg;
ddlBLDGRP_C.Enabled = flg;
ddlBLDRHDFCT_C.Enabled = flg;
txtINST_M.Enabled = flg;
ddlPATINST_I.Enabled = flg;
txtPATINST_M.Enabled = flg;
ddlPATCATEGORY.Enabled = flg;
txtDOCT_M.Enabled = flg;
ddlBLDGRP_C.Enabled = flg;
ddlBLDRHDFCT_C.Enabled = flg;
txtREM_X.Enabled = flg;
txtYEAR.Enabled = flg;
txtAGEMONTH.Enabled = flg;
txtAGEDAY.Enabled = flg;
ddlSEX_I.Enabled = flg;
}
//Load Form Data in to CDO
private void Load_Data(ref clsISSMST_CDO ISSMST_CDO)
{
ISSMST_CDO.MODY_C = Session["USERNAME"].ToString();
ISSMST_CDO.MODY_D = DateTime.Now;
ISSMST_CDO.COLOCN_C = Session["COLOCN_C"].ToString();
ISSMST_CDO.ISSUE_D = DateTime.Parse(txtISSUE_D.Text);
ISSMST_CDO.STRGLOCNTO_C = -1;
ISSMST_CDO.REMS_X = txtREM_X.Text;
ISSMST_CDO.REQN_C = ddlREQUISITIONID.SelectedItem.Text;
ISSMST_CDO.TRANSFPERS_C = Decimal.Parse(ddlISSUEBY.SelectedValue.ToString());
ISSMST_CDO.CRTD_C = Session["USERNAME"].ToString();
ISSMST_CDO.CRTD_D = DateTime.Now;
ISSMST_CDO.PATINST_I = ddlPATINST_I.SelectedValue.ToString();
ISSMST_CDO.CANCEL_I = "N";
ISSMST_CDO.PATINST_C = decimal.Parse(ViewState["PATINST_C"].ToString());
}
// set data rows value to controls
private void setValues(DataSet ds)
{
txtISSUE_D.Text = ds.Tables[0].Rows[0]["ISSUE_D"].ToString();
txtREM_X.Text = ds.Tables[0].Rows[0]["REMS_X"].ToString();
//ddlREQUISITIONID.SelectedIndex=ddlREQUISITIONID.Items.IndexOf()
//txtREQN_C.Text = ds.Tables[0].Rows[0]["REQN_C"].ToString();
//txtTRANSFPERS_C.Text = ds.Tables[0].Rows[0]["TRANSFPERS_C"].ToString();
//txtPATINST_I.Text = ds.Tables[0].Rows[0]["PATINST_I"].ToString();
//txtPATINST_C.Text = ds.Tables[0].Rows[0]["PATINST_C"].ToString();
//txtREQNDTLID_N.Text = ds.Tables[0].Rows[0]["REQNDTLID_N"].ToString();
//txtCANCEL_I.Text = ds.Tables[0].Rows[0]["CANCEL_I"].ToString();
}
// Common Switch case Function For Save Data
// common function for Save, Update, Delete Records
private Boolean Common_Switch_Case(string strCommandName)
{
Boolean Blnflg = false;
try
{
clsISSMST_CDO ISSMST_CDO = new clsISSMST_CDO();
clsISSMST_DA ISSMST_DA = new clsISSMST_DA();
ISSMST_CDO.COLOCN_C = Session["COLOCN_C"].ToString();
if (strCommandName != "Delete") Load_Data(ref ISSMST_CDO);
if (strCommandName != "Save") ISSMST_CDO.ISSUE_N = decimal.Parse(ViewState["ISSUE_N"].ToString());
if (strCommandName != "Delete")
Blnflg = ISSMST_DA.Save_BL_ISSMST(ref ISSMST_CDO, strCommandName);
else
Blnflg = ISSMST_DA.Delete_BL_ISSMST(ref ISSMST_CDO, strCommandName);
}
catch (Exception ex)
{
Session["ex"] = ex;
throw new Exception(ex.Message, ex);
}
return Blnflg;
}
private void ClearTextDtl()
{
txtDNA_C.Text = String.Empty;
txtPROD_C.Text = String.Empty;
txtPRODCHILD_I.Text = String.Empty;
txtREQN_C.Text = String.Empty;
}
//Enabled-Disabled Control Function
private void setTextDtl(Boolean flg)
{
txtDNA_C.Enabled = flg;
txtPROD_C.Enabled = flg;
txtPRODCHILD_I.Enabled = flg;
txtREQN_C.Enabled = flg;
}
//Load Form Data in to CDO
private void Load_DataDtl(ref clsISSDTL_CDO ISSDTL_CDO)
{
ISSDTL_CDO.COLOCN_C = Session["COLOCN_C"].ToString();
ISSDTL_CDO.ISSUE_N = Decimal.Parse(ViewState["ISSUE_N"].ToString());
ISSDTL_CDO.REQN_C = ddlREQUISITIONID.SelectedItem.Text.Trim();
ISSDTL_CDO.CRTD_C = Session["USERNAME"].ToString();
ISSDTL_CDO.CRTD_D = DateTime.Now;
ISSDTL_CDO.MODY_C = Session["USERNAME"].ToString();
ISSDTL_CDO.MODY_D = DateTime.Now;
ISSDTL_CDO.CANCEL_I = "N";
}
// Common Switch case Function For Save Data
// common function for Save, Update, Delete Records
private Boolean Common_Switch_CaseDtl(string strCommandName)
{
Boolean Blnflg = false;
try
{
clsISSDTL_CDO ISSDTL_CDO = new clsISSDTL_CDO();
clsISSDTL_DA ISSDTL_DA = new clsISSDTL_DA();
ISSDTL_CDO.COLOCN_C = Session["COLOCN_C"].ToString();
if (strCommandName != "Delete") Load_DataDtl(ref ISSDTL_CDO);
if (strCommandName != "Save") ISSDTL_CDO.ISSDTL_N = Int64.Parse(ViewState["ISSDTL_N"].ToString());
if (strCommandName != "Delete")
Blnflg = ISSDTL_DA.Save_BL_ISSDTL(ref ISSDTL_CDO, strCommandName);
else
Blnflg = ISSDTL_DA.Delete_BL_ISSDTL(ref ISSDTL_CDO, strCommandName);
}
catch (Exception ex)
{
Session["ex"] = ex;
throw new Exception(ex.Message, ex);
}
return Blnflg;
}
protected void btnSAVE_Click(object sender, EventArgs e)
{
clsISSMST_CDO ISSMST_CDO = new clsISSMST_CDO();
clsISSMST_DA ISSMST_DA = new clsISSMST_DA();
clsISSDTL_CDO ISSDTL_CDO = new clsISSDTL_CDO();
clsISSDTL_DA ISSDTL_DA = new clsISSDTL_DA();
if (btnSAVE.Text == "Save")
{
Boolean SaveMst = false;
Boolean SaveDtl = false;
if (gvISSUDETAILS.Rows.Count > 0)
{
SaveDtl = false;
Load_Data(ref ISSMST_CDO);
ISSMST_CDO.REQNDTLID_N = decimal.Parse(((Label)gvISSUDETAILS.Rows[0].FindControl("gvdREQMT_N")).Text);
ISSMST_CDO.STRGLOCNFR_C = decimal.Parse(((Label)gvISSUDETAILS.Rows[0].FindControl("gvdSTRGLOCN_N")).Text);
SaveMst = ISSMST_DA.Save_BL_ISSMST(ref ISSMST_CDO, "Save");
if (SaveMst)
{
ViewState["ISSUE_N"] = ISSMST_CDO.ISSUE_N.ToString();
lblISSUE_N.Visible = true;
llblISSUE_N.Visible = true;
llblISSUE_N.Text = ISSMST_CDO.ISSUE_N.ToString();
for (int I = 0; I < gvISSUDETAILS.Rows.Count; I++)
{
ISSDTL_CDO.LOCNID_C = ((Label)gvISSUDETAILS.Rows[I].FindControl("gvdLOCNID_C")).Text;
if (!string.IsNullOrEmpty(((Label)gvISSUDETAILS.Rows[I].FindControl("gvdBLDRHDFCT_C")).Text))
ISSDTL_CDO.BLDRHDFCT_C = decimal.Parse(((Label)gvISSUDETAILS.Rows[I].FindControl("gvdBLDRHDFCT_C")).Text);
else
ISSDTL_CDO.BLDRHDFCT_C = -1;
if (!string.IsNullOrEmpty(((Label)gvISSUDETAILS.Rows[I].FindControl("gvdUOM_C")).Text))
ISSDTL_CDO.UOM_C = decimal.Parse(((Label)gvISSUDETAILS.Rows[I].FindControl("gvdUOM_C")).Text);
else
ISSDTL_CDO.UOM_C = -1;
ISSDTL_CDO.REFLOCNID_C = "";
if (!string.IsNullOrEmpty(((Label)gvISSUDETAILS.Rows[I].FindControl("gvdEXPY_D")).Text))
ISSDTL_CDO.EXP_D = DateTime.Parse(((Label)gvISSUDETAILS.Rows[I].FindControl("gvdEXPY_D")).Text);
ISSDTL_CDO.DNA_C = ((Label)gvISSUDETAILS.Rows[I].FindControl("gvdDNA_C")).Text;
ISSDTL_CDO.PROD_C = ((Label)gvISSUDETAILS.Rows[I].FindControl("gvdPROD_C")).Text;
if (!string.IsNullOrEmpty(((Label)gvISSUDETAILS.Rows[I].FindControl("gvdBLDGRP_C")).Text))
ISSDTL_CDO.BLDGRP_C = decimal.Parse(((Label)gvISSUDETAILS.Rows[I].FindControl("gvdBLDGRP_C")).Text);
else
ISSDTL_CDO.BLDGRP_C = -1;
ISSDTL_CDO.PRODCHILD_I = ((Label)gvISSUDETAILS.Rows[I].FindControl("gvdPRODCHILD_I")).Text;
ISSDTL_CDO.PRODTYPE_I = ((Label)gvISSUDETAILS.Rows[I].FindControl("gvdPRODTYPE_I")).Text;
if (!string.IsNullOrEmpty(((Label)gvISSUDETAILS.Rows[I].FindControl("gvdPRODVOL_N")).Text))
ISSDTL_CDO.PRODVOL_N = Decimal.Parse(((Label)gvISSUDETAILS.Rows[I].FindControl("gvdPRODVOL_N")).Text);
if (!string.IsNullOrEmpty(((Label)gvISSUDETAILS.Rows[I].FindControl("gvdREQN_D")).Text))
ISSDTL_CDO.REQN_D = DateTime.Parse(((Label)gvISSUDETAILS.Rows[I].FindControl("gvdREQN_D")).Text);
if (!string.IsNullOrEmpty(((Label)gvISSUDETAILS.Rows[I].FindControl("gvdREQMT_D")).Text))
ISSDTL_CDO.REQMT_D = DateTime.Parse(((Label)gvISSUDETAILS.Rows[I].FindControl("gvdREQMT_D")).Text);
ISSDTL_CDO.NAT = ((Label)gvISSUDETAILS.Rows[I].FindControl("gvdNAT")).Text;
if (!string.IsNullOrEmpty(((Label)gvISSUDETAILS.Rows[I].FindControl("gvdMFR_D")).Text))
ISSDTL_CDO.MFR_D = DateTime.Parse(((Label)gvISSUDETAILS.Rows[I].FindControl("gvdMFR_D")).Text);
Load_DataDtl(ref ISSDTL_CDO);
SaveDtl = ISSDTL_DA.Save_BL_ISSDTL(ref ISSDTL_CDO, "Save");
}
if (SaveDtl)
{
btnFetchReqnDtl.Enabled = true;
btnISSUELABEL.Enabled = true;
btnISSUEREPORT.Enabled = true;
pnlLABELPRINTING.Visible = true;
lblstatus_msg.Text = "Record saved successfully";
lblstatus_msg.ForeColor = System.Drawing.Color.Green;
btnSAVE.Text = "Update";
ddlREQUISITIONID.Enabled = false;
imgREQN_CREF.Visible = false;
txtISSUE_D.Enabled = false;
ImageButton2.Visible = false;
}
}
else
{
lblstatus_msg.Text = "Master record not saved";
lblstatus_msg.ForeColor = System.Drawing.Color.Red;
}
}
else
{
lblstatus_msg.Text = "No record for save";
lblstatus_msg.ForeColor = System.Drawing.Color.Red;
}
}
else
{
Boolean UpdateDtl = false;
ISSMST_CDO.TRANSFPERS_C = decimal.Parse(ddlISSUEBY.SelectedValue.ToString());
ISSMST_CDO.ISSUE_N = decimal.Parse(ViewState["ISSUE_N"].ToString());
ISSMST_CDO.MODY_C = Session["USERNAME"].ToString();
ISSMST_CDO.MODY_D = DateTime.Now;
ISSMST_CDO.COLOCN_C = Session["COLOCN_C"].ToString();
UpdateDtl = UpdateDtl = ISSMST_DA.UPDATE_BL_ISSMST(ref ISSMST_CDO, "UpdateIssueBy");
//FOR UPDATE OTHER DONATION.....
if (UpdateDtl)
{
Boolean SaveDtl = false ;
for (int I = 0; I < gvISSUDETAILS.Rows.Count; I++)
{
ISSDTL_CDO.LOCNID_C = ((Label)gvISSUDETAILS.Rows[I].FindControl("gvdLOCNID_C")).Text;
ISSDTL_CDO.BLDRHDFCT_C = decimal.Parse(((Label)gvISSUDETAILS.Rows[I].FindControl("gvdBLDRHDFCT_C")).Text);
ISSDTL_CDO.UOM_C = decimal.Parse(((Label)gvISSUDETAILS.Rows[I].FindControl("gvdUOM_C")).Text);
ISSDTL_CDO.REFLOCNID_C = "";
ISSDTL_CDO.EXP_D = DateTime.Parse(((Label)gvISSUDETAILS.Rows[I].FindControl("gvdEXPY_D")).Text);
ISSDTL_CDO.DNA_C = ((Label)gvISSUDETAILS.Rows[I].FindControl("gvdDNA_C")).Text;
ISSDTL_CDO.PROD_C = ((Label)gvISSUDETAILS.Rows[I].FindControl("gvdPROD_C")).Text;
ISSDTL_CDO.BLDGRP_C = decimal.Parse(((Label)gvISSUDETAILS.Rows[I].FindControl("gvdBLDGRP_C")).Text);
ISSDTL_CDO.PRODCHILD_I = ((Label)gvISSUDETAILS.Rows[I].FindControl("gvdPRODCHILD_I")).Text;
ISSDTL_CDO.PRODTYPE_I = ((Label)gvISSUDETAILS.Rows[I].FindControl("gvdPRODTYPE_I")).Text;
if (!string.IsNullOrEmpty(((Label)gvISSUDETAILS.Rows[I].FindControl("gvdPRODVOL_N")).Text))
ISSDTL_CDO.PRODVOL_N = Decimal.Parse(((Label)gvISSUDETAILS.Rows[I].FindControl("gvdPRODVOL_N")).Text);
ISSDTL_CDO.REQN_D = DateTime.Parse(((Label)gvISSUDETAILS.Rows[I].FindControl("gvdREQN_D")).Text);
ISSDTL_CDO.REQMT_D = DateTime.Parse(((Label)gvISSUDETAILS.Rows[I].FindControl("gvdREQMT_D")).Text);
ISSDTL_CDO.NAT = ((Label)gvISSUDETAILS.Rows[I].FindControl("gvdNAT")).Text;
ISSDTL_CDO.MFR_D = DateTime.Parse(((Label)gvISSUDETAILS.Rows[I].FindControl("gvdMFR_D")).Text);
Load_DataDtl(ref ISSDTL_CDO);
DataSet DS = new DataSet();
DS = ISSDTL_DA.UPDATE_BL_ISSDTL(ISSDTL_CDO);
if (DS.Tables[0].Rows.Count == 0)
{
SaveDtl = ISSDTL_DA.Save_BL_ISSDTL(ref ISSDTL_CDO, "Save");
}
}
if (SaveDtl)
{
ISSMST_CDO.ISSUE_N = decimal.Parse(ViewState["ISSUE_N"].ToString());
ISSMST_CDO.COLOCN_C = Session["COLOCN_C"].ToString();
DataSet DS = new DataSet();
DS = ISSMST_DA.GET_BL_ISSUE_BY_ISSUE_N(ISSMST_CDO);
if (DS.Tables[0].Rows.Count > 0)
{
gvISSUDETAILS.DataSource = DS;
ViewState["ISSUEDETAIL"] = DS.Tables[0];
gvISSUDETAILS.DataBind();
lblTOTALDETAILRECORD.Text = "Total Record Found :" + DS.Tables[0].Rows.Count;
pnlLABELPRINTING.Visible = true;
pnlISSEDETAILS.Visible = true;
btnISSUEREPORT.Visible = true;
btnISSUEREPORT.Enabled = true;
btnISSUELABEL.Enabled = true;
}
btnFetchReqnDtl.Enabled = true;
btnISSUELABEL.Enabled = true;
btnISSUEREPORT.Enabled = true;
pnlLABELPRINTING.Visible = true;
lblstatus_msg.Text = "Record saved successfully";
lblstatus_msg.ForeColor = System.Drawing.Color.Green;
btnSAVE.Text = "Update";
ddlREQUISITIONID.Enabled = false;
imgREQN_CREF.Visible = false;
txtISSUE_D.Enabled = false;
ImageButton2.Visible = false;
}
lblstatus_msg.Text = "Record updated successfully";
lblstatus_msg.ForeColor = System.Drawing.Color.Green;
}
}
}
protected void btnSEARCH_Click(object sender, EventArgs e)
{
lblstatus_msg.Text = "";
Bind_SearchGrid();
}
private void Bind_SearchGrid()
{
bool flg = true ;
clsISSMST_CDO ISSMST_CDO = new clsISSMST_CDO();
clsISSMST_DA ISSMST_DA = new clsISSMST_DA();
ISSMST_CDO.COLOCN_C = Session["COLOCN_c"].ToString();
if (!string.IsNullOrEmpty(txtFREQN_C.Text.Trim()))
{
ISSMST_CDO.REQN_C = txtFREQN_C.Text.ToUpper().Trim();
flg = false;
ISSMST_CDO.TRANSFPERS_C = -1;
ISSMST_CDO.ISSUE_N = -1;
}
else
{
if (ddlFISSUEBY.SelectedIndex != 0)
{
ISSMST_CDO.TRANSFPERS_C = decimal.Parse(ddlFISSUEBY.SelectedValue.ToString());
flg = false;
}
else
ISSMST_CDO.TRANSFPERS_C = -1;
if (!string.IsNullOrEmpty(txtFTRANS_N.Text))
{
ISSMST_CDO.ISSUE_N = decimal.Parse(txtFTRANS_N.Text);
flg = false;
}
else
ISSMST_CDO.ISSUE_N = -1;
if (!string.IsNullOrEmpty(txtFREQN_C.Text.Trim()))
{
ISSMST_CDO.REQN_C = txtFREQN_C.Text.ToUpper().Trim();
flg = false;
}
if (!string.IsNullOrEmpty(txtFISSUE_D.Text))
{
ISSMST_CDO.ISSUE_D = DateTime.Parse(txtFISSUE_D.Text);
flg = false;
}
}
if (flg)
{
ISSMST_CDO.ISSUE_D = DateTime.Parse(DateTime.Now.ToShortDateString());
}
DataSet dsSEARCH = new DataSet();
dsSEARCH = ISSMST_DA.GET_BL_ISSUE_SEARCH(ISSMST_CDO);
if (dsSEARCH.Tables[0].Rows.Count > 0)
{
gvISSUEMAIN.DataSource = dsSEARCH;
ViewState["dsSEARCH"] = dsSEARCH.Tables[0];
gvISSUEMAIN.DataBind();
lblTOTALRECORDMAIN.Text = "Total Record Found :" + dsSEARCH.Tables[0].Rows.Count.ToString();
}
else
{
gvISSUEMAIN.DataSource = null;
gvISSUEMAIN.DataBind();
lblTOTALRECORDMAIN.Text = "";
}
}
protected void gvISSUEMAIN_RowEditing(object sender, GridViewEditEventArgs e)
{
lblstatus_msg.Text = "";
ClearText();
ClearTextDtl();
llblISSUE_N.Text = "";
gvISSUDETAILS.DataSource = null;
gvISSUDETAILS.DataBind();
setTextPatientDetail(false);
txtISSUE_D.Enabled = false;
ImageButton2.Visible = false;
lblstatus_msg.Text = "";
imgREQN_CREF.Visible = false;
btnFetchReqnDtl.Visible = true;
btnCANCEL.Visible = false;
clsISSMST_CDO ISSMST_CDO = new clsISSMST_CDO();
clsISSMST_DA ISSMST_DA = new clsISSMST_DA();
ISSMST_CDO.ISSUE_N = decimal.Parse(((Label)gvISSUEMAIN.Rows[e.NewEditIndex].FindControl("gvmISSUE_N")).Text);
ViewState["ISSUE_N"] = ISSMST_CDO.ISSUE_N.ToString();
llblISSUE_N.Visible = true;
llblISSUE_N.Text = ISSMST_CDO.ISSUE_N.ToString();
lblISSUE_N.Visible = true;
ISSMST_CDO.REQN_C = ((Label)gvISSUEMAIN.Rows[e.NewEditIndex].FindControl("gvmREQN_C")).Text;
txtISSUE_D.Text = DateTime.Parse(((Label)gvISSUEMAIN.Rows[e.NewEditIndex].FindControl("gvmISSUE_D")).Text).ToShortDateString();
if (!string.IsNullOrEmpty(((Label)gvISSUEMAIN.Rows[e.NewEditIndex].FindControl("gvmTRANSFPERS_C")).Text))
ISSMST_CDO.TRANSFPERS_C = decimal.Parse(((Label)gvISSUEMAIN.Rows[e.NewEditIndex].FindControl("gvmTRANSFPERS_C")).Text);
ddlISSUEBY.SelectedIndex = ddlISSUEBY.Items.IndexOf(ddlISSUEBY.Items.FindByValue(ISSMST_CDO.TRANSFPERS_C.ToString()));
ddlREQUISITIONID.Items.Add(ISSMST_CDO.REQN_C.ToString());
txtRequisitionId.Text = ISSMST_CDO.REQN_C.ToString();
ddlREQUISITIONID.SelectedIndex = ddlREQUISITIONID.Items.IndexOf(ddlREQUISITIONID.Items.FindByText(ISSMST_CDO.REQN_C.ToString()));
ISSMST_CDO.COLOCN_C = Session["COLOCN_C"].ToString();
DataSet DS = new DataSet();
DS = ISSMST_DA.GET_BL_ISSUE_BY_ISSUE_N(ISSMST_CDO);
ddlREQUISITIONID.Enabled = false;
imgREQN_CREF_Click(null, null);
ddlREQUISITIONID.Items.Add(ISSMST_CDO.REQN_C.ToString());
ddlREQUISITIONID.SelectedIndex = ddlREQUISITIONID.Items.IndexOf(ddlREQUISITIONID.Items.FindByText(ISSMST_CDO.REQN_C.ToString()));
if (DS.Tables[0].Rows.Count > 0)
{
gvISSUDETAILS.DataSource = DS;
ViewState["ISSUEDETAIL"] = DS.Tables[0];
gvISSUDETAILS.DataBind();
lblTOTALDETAILRECORD.Text = "Total Record Found :" + DS.Tables[0].Rows.Count;
pnlLABELPRINTING.Visible = true;
pnlISSEDETAILS.Visible = true;
btnISSUEREPORT.Visible = true;
btnISSUEREPORT.Enabled = true;
btnISSUELABEL.Enabled = true;
}
else
{
gvISSUDETAILS.DataSource = null;
gvISSUDETAILS.DataBind();
lblTOTALDETAILRECORD.Text = "";
}
btnSAVE.Visible = true;
btnSAVE.Text = "Update";
SetPanel(false);
pnlLABELPRINTING.Visible = true;
txtRequisitionId.Enabled = false;
imgtxtReq_c.Visible = false;
RequiredFieldValidator4.Visible = false;
btnISSUELABEL.Visible = true;
}
protected void btnCANCEL_Click(object sender, EventArgs e)
{
pnlISSEDETAILS.Visible = false;
pnlLABELPRINTING.Visible = false;
}
protected void gvISSUEMAIN_SelectedIndexChanged(object sender, EventArgs e)
{
lblstatus_msg.Text = "";
ClearText();
ClearTextDtl();
llblISSUE_N.Text = "";
gvISSUDETAILS.DataSource = null;
gvISSUDETAILS.DataBind();
setTextPatientDetail(false);
txtISSUE_D.Enabled = false;
ImageButton2.Visible = false;
lblstatus_msg.Text = "";
imgREQN_CREF.Visible = false;
btnFetchReqnDtl.Visible = false;
clsISSMST_CDO ISSMST_CDO = new clsISSMST_CDO();
clsISSMST_DA ISSMST_DA = new clsISSMST_DA();
ISSMST_CDO.ISSUE_N = decimal.Parse(((Label)gvISSUEMAIN.SelectedRow.FindControl("gvmISSUE_N")).Text);
ViewState["ISSUE_N"] = ISSMST_CDO.ISSUE_N.ToString();
llblISSUE_N.Visible = true;
llblISSUE_N.Text = ISSMST_CDO.ISSUE_N.ToString();
lblISSUE_N.Visible = true;
ISSMST_CDO.REQN_C = ((Label)gvISSUEMAIN.SelectedRow.FindControl("gvmREQN_C")).Text;
txtISSUE_D.Text = DateTime.Parse(((Label)gvISSUEMAIN.SelectedRow.FindControl("gvmISSUE_D")).Text).ToShortDateString();
if (!string.IsNullOrEmpty(((Label)gvISSUEMAIN.SelectedRow.FindControl("gvmTRANSFPERS_C")).Text))
ISSMST_CDO.TRANSFPERS_C = decimal.Parse(((Label)gvISSUEMAIN.SelectedRow.FindControl("gvmTRANSFPERS_C")).Text);
ddlISSUEBY.SelectedIndex = ddlISSUEBY.Items.IndexOf(ddlISSUEBY.Items.FindByValue(ISSMST_CDO.TRANSFPERS_C.ToString()));
ddlREQUISITIONID.Items.Add(ISSMST_CDO.REQN_C.ToString());
ddlREQUISITIONID.SelectedIndex = ddlREQUISITIONID.Items.IndexOf(ddlREQUISITIONID.Items.FindByText(ISSMST_CDO.REQN_C.ToString()));
ISSMST_CDO.COLOCN_C = Session["COLOCN_C"].ToString();
DataSet DS = new DataSet();
ddlREQUISITIONID.Enabled = false;
imgREQN_CREF_Click(null, null);
ddlREQUISITIONID.Items.Add(ISSMST_CDO.REQN_C.ToString());
ddlREQUISITIONID.SelectedIndex = ddlREQUISITIONID.Items.IndexOf(ddlREQUISITIONID.Items.FindByText(ISSMST_CDO.REQN_C.ToString()));
DS = ISSMST_DA.GET_BL_ISSUE_BY_ISSUE_N(ISSMST_CDO);
if (DS.Tables[0].Rows.Count > 0)
{
gvISSUDETAILS.DataSource = DS;
gvISSUDETAILS.DataBind();
lblTOTALDETAILRECORD.Text = "Total Record Found :" + DS.Tables[0].Rows.Count;
pnlLABELPRINTING.Visible = true;
pnlISSEDETAILS.Visible = true;
btnISSUEREPORT.Visible = false;
btnISSUELABEL.Visible = false;
}
else
{
gvISSUDETAILS.DataSource = null;
gvISSUDETAILS.DataBind();
lblTOTALDETAILRECORD.Text = "";
}
btnSAVE.Visible = false;
SetPanel(false);
setText(false);
pnlLABELPRINTING.Visible = false;
btnCANCEL.Visible = false;
lblRequisitionId.Visible = false;
txtRequisitionId.Text = ISSMST_CDO.REQN_C.ToString();
txtRequisitionId.Enabled = false;
imgtxtReq_c.Visible = false;
RequiredFieldValidator4.Visible = false;
}
protected void btnCLOSE_Click(object sender, EventArgs e)
{
SetPanel(true);
lblstatus_msg.Text = "";
// Bind_SearchGrid();
}
#region Print_Label
private void Print_Label(DataSet dsReturn)
{
//string sid = Session.SessionID.ToString();
try
{
if (!System.IO.Directory.Exists(Server.MapPath("~/labelimages/" + Session.SessionID.ToString())))
{
// System.IO.Directory.Delete(Server.MapPath("~/labelimages/" + Session.SessionID.ToString()), true);
System.IO.Directory.CreateDirectory(Server.MapPath("~/labelimages/" + Session.SessionID.ToString()));
}
}
catch { }
string TestResult, TestResultNAT;
string tstrst = "";
string BloodGroup = "", BloodGroupName = "", Rhd = "", ExpDate = "", NAT = "", DonationDate = "", DNA_C = "";
string PROD_C = "", storageCond = "", ProductName = "";
string univcode = "", PRODVOL;
string age, sex, patientbloodgroup, institute, requisitionid, issuedate, patientname, productfullname = "", bearingdonation;
TestResult = "Negative for HIV 1&2, HCV, Malaria, Syphillis, HepBsAg";
TestResultNAT = "Negative for HIV 1&2, HCV, Malaria,Syphillis,HBsAg & NAT Tested";
DNA_C = txtDNA_C.Text;
PROD_C = txtPROD_C.Text;
int I = 0;
for (int J = 0; J < dsReturn.Tables[0].Rows.Count; J++)
{
if (dsReturn.Tables[0].Rows[J]["DNA_C"].ToString() == txtDNA_C.Text && dsReturn.Tables[0].Rows[J]["PROD_C"].ToString() == txtPROD_C.Text)
{
ProductName = dsReturn.Tables[0].Rows[J]["bldprodsht_m"].ToString();
BloodGroup = dsReturn.Tables[0].Rows[J]["bldgrpsht_m"].ToString();
Rhd = dsReturn.Tables[0].Rows[J]["bldrhdsht_m"].ToString();
ExpDate = DateTime.Parse(dsReturn.Tables[0].Rows[J]["expy_d"].ToString()).ToString("dd-MMM-yy");
PRODVOL = dsReturn.Tables[0].Rows[J]["PRODVOL_N"].ToString();
I = J;
}
}
//ProductName = dsReturn.Tables[0].Rows[0]["bldprodsht_m"].ToString();
// NAT = dsReturn.Tables[0].Rows[0]["NAT"].ToString();
// DonationDate = DateTime.Parse(dsReturn.Tables[0].Rows[0]["DNA_D"].ToString()).ToString("dd-MMM-yy");
BloodGroupName = BloodGroup + Rhd;
requisitionid = dsReturn.Tables[0].Rows[I]["reqn_c"].ToString();
// age = dsReturn.Tables[1].Rows[0]["AGEYR_N"].ToString();
age = txtYEAR.Text;
sex = dsReturn.Tables[1].Rows[0]["SEX_I"].ToString();
if (sex.ToUpper() == "M")
sex = "Male";
else
sex = "Female";
patientbloodgroup = dsReturn.Tables[1].Rows[0]["BLDGRP_M"].ToString() + dsReturn.Tables[1].Rows[0]["BLDRHDFCT_M"].ToString();
institute = dsReturn.Tables[1].Rows[0]["INST_M"].ToString();
issuedate = DateTime.Parse(dsReturn.Tables[0].Rows[I]["REQMT_d"].ToString()).ToString("dd-MMM-yy").ToUpper();
patientname = dsReturn.Tables[1].Rows[0]["PAT_M"].ToString();
string sml = dsReturn.Tables[0].Rows[I]["SIZE"].ToString();
if (NAT == "N")
tstrst = TestResultNAT;
else
tstrst = TestResult;
clsPRODMST_CDO PRODMST_CDO = new clsPRODMST_CDO();
clsPRODMST_DA PRODMST_DA = new clsPRODMST_DA();
PRODMST_CDO.PROD_C = dsReturn.Tables[0].Rows[I]["PROD_C"].ToString();
DataSet dsProduct = new DataSet();
dsProduct = PRODMST_DA.GetBL_PRODMSTById(PRODMST_CDO);
if (dsProduct.Tables[0].Rows.Count > 0)
{
productfullname = dsProduct.Tables[0].Rows[0]["PROD_M"].ToString();
}
clsUNIVCODE_CDO UNIVCODE_CDO = new clsUNIVCODE_CDO();
clsUNIVCODE_DA UNIVCODE_DA = new clsUNIVCODE_DA();
UNIVCODE_CDO.BLDGRP_C = decimal.Parse(dsReturn.Tables[0].Rows[I]["BLDGRP_C"].ToString());
UNIVCODE_CDO.BLDRHDFCT_C = decimal.Parse(dsReturn.Tables[0].Rows[I]["BLDRHDFCT_C"].ToString());
DataSet dsCode = new DataSet();
dsCode = UNIVCODE_DA.Get_UNIVCODEById(UNIVCODE_CDO);
if (dsCode.Tables[0].Rows.Count > 0)
univcode = dsCode.Tables[0].Rows[0]["CODE"].ToString();
XmlDocument doc = new XmlDocument();
doc.Load(Server.MapPath("~/xmlfiles/IssueLabel.xml"));
XmlNode root = doc.DocumentElement;
XmlNode donationcodenode = root.ChildNodes[0];
XmlNode productnode = root.ChildNodes[1];
XmlNode productnamenode = root.ChildNodes[2];
XmlNode bloodgroupnamenode = root.ChildNodes[3];
XmlNode bloodgroupnode = root.ChildNodes[4];
XmlNode companylogonode = root.ChildNodes[5];
XmlNode companynameonode = root.ChildNodes[6];
XmlNode companyaddnode = root.ChildNodes[7];
XmlNode fdsnode = root.ChildNodes[8];
XmlNode reqcodenode = root.ChildNodes[9];
XmlNode agenode = root.ChildNodes[10];
XmlNode sexnode = root.ChildNodes[11];
XmlNode patientbloodgroupnode = root.ChildNodes[12];
XmlNode institutenode = root.ChildNodes[13];
XmlNode issuedatenode = root.ChildNodes[14];
XmlNode patientnode = root.ChildNodes[15];
XmlNode requisitionidnode = root.ChildNodes[16];
XmlNode productfullnamenode = root.ChildNodes[17];
XmlNode bearingdonationnode = root.ChildNodes[18];
XmlNode smlnode = root.ChildNodes[19];
StringBuilder sb = new StringBuilder();
sb.Append("");
if (companylogonode.SelectSingleNode("isprint").ChildNodes[0].Value.ToString().ToUpper() == "YES")
{
if (companylogonode.SelectSingleNode("isimage").ChildNodes[0].Value.ToString().ToUpper() == "YES")
sb.AppendFormat(GetValues(companylogonode, ""));
else
sb.AppendFormat(GetTextValues(companylogonode, ""));
}
if (donationcodenode.SelectSingleNode("isprint").ChildNodes[0].Value.ToString().ToUpper() == "YES")
{
if (donationcodenode.SelectSingleNode("isimage").ChildNodes[0].Value.ToString().ToUpper() == "YES")
sb.AppendFormat(GetValues(donationcodenode, DNA_C));
else
sb.AppendFormat(GetValues(donationcodenode, DNA_C));
}
if (productnode.SelectSingleNode("isprint").ChildNodes[0].Value.ToString().ToUpper() == "YES")
{
if (productnode.SelectSingleNode("isimage").ChildNodes[0].Value.ToString().ToUpper() == "YES")
sb.AppendFormat(GetValues(productnode, PROD_C));
else
sb.AppendFormat(GetValues(productnode, PROD_C));
}
if (productnamenode.SelectSingleNode("isprint").ChildNodes[0].Value.ToString().ToUpper() == "YES")
{
if (productnamenode.SelectSingleNode("isimage").ChildNodes[0].Value.ToString().ToUpper() == "YES")
sb.AppendFormat(GetValues(productnamenode, ProductName));
else
sb.AppendFormat(GetTextValues(productnamenode, ProductName));
}
if (bloodgroupnamenode.SelectSingleNode("isprint").ChildNodes[0].Value.ToString().ToUpper() == "YES")
{
if (bloodgroupnamenode.SelectSingleNode("isimage").ChildNodes[0].Value.ToString().ToUpper() == "YES")
sb.AppendFormat(GetValues(bloodgroupnamenode, BloodGroupName));
else
sb.AppendFormat(GetTextValues(bloodgroupnamenode, BloodGroupName));
}
if (bloodgroupnode.SelectSingleNode("isprint").ChildNodes[0].Value.ToString().ToUpper() == "YES")
{
if (bloodgroupnode.SelectSingleNode("isimage").ChildNodes[0].Value.ToString().ToUpper() == "YES")
sb.AppendFormat(GetValues(bloodgroupnode, BloodGroup));
else
sb.AppendFormat(GetTextValues(bloodgroupnode, BloodGroup));
}
if (companynameonode.SelectSingleNode("isprint").ChildNodes[0].Value.ToString().ToUpper() == "YES")
{
if (companynameonode.SelectSingleNode("isimage").ChildNodes[0].Value.ToString().ToUpper() == "YES")
sb.AppendFormat(GetValues(companynameonode, "PRATHAMA BLOOD CENTRE"));
else
sb.AppendFormat(GetTextValues(companynameonode, "PRATHAMA BLOOD CENTRE"));
}
if (companyaddnode.SelectSingleNode("isprint").ChildNodes[0].Value.ToString().ToUpper() == "YES")
{
if (companyaddnode.SelectSingleNode("isimage").ChildNodes[0].Value.ToString().ToUpper() == "YES")
sb.AppendFormat(GetValues(companyaddnode, "Vasana Ahmedabad Ph-079 26600101"));
else
sb.AppendFormat(GetTextValues(companyaddnode, "Vasana Ahmedabad Ph-079 26600101"));
}
if (fdsnode.SelectSingleNode("isprint").ChildNodes[0].Value.ToString().ToUpper() == "YES")
{
if (fdsnode.SelectSingleNode("isimage").ChildNodes[0].Value.ToString().ToUpper() == "YES")
sb.AppendFormat(GetValues(fdsnode, "FDA Licence No:GB/96"));
else
sb.AppendFormat(GetTextValues(fdsnode, "FDA Licence No:GB/96"));
}
if (reqcodenode.SelectSingleNode("isprint").ChildNodes[0].Value.ToString().ToUpper() == "YES")
{
if (reqcodenode.SelectSingleNode("isimage").ChildNodes[0].Value.ToString().ToUpper() == "YES")
sb.AppendFormat(GetValues(reqcodenode, requisitionid));
else
sb.AppendFormat(GetTextValues(reqcodenode, requisitionid));
}
if (agenode.SelectSingleNode("isprint").ChildNodes[0].Value.ToString().ToUpper() == "YES")
{
if (agenode.SelectSingleNode("isimage").ChildNodes[0].Value.ToString().ToUpper() == "YES")
sb.AppendFormat(GetValues(agenode, age));
else
sb.AppendFormat(GetTextValues(agenode, age));
}
if (sexnode.SelectSingleNode("isprint").ChildNodes[0].Value.ToString().ToUpper() == "YES")
{
if (sexnode.SelectSingleNode("isimage").ChildNodes[0].Value.ToString().ToUpper() == "YES")
sb.AppendFormat(GetValues(sexnode, sex));
else
sb.AppendFormat(GetTextValues(sexnode, sex));
}
if (patientbloodgroupnode.SelectSingleNode("isprint").ChildNodes[0].Value.ToString().ToUpper() == "YES")
{
if (patientbloodgroupnode.SelectSingleNode("isimage").ChildNodes[0].Value.ToString().ToUpper() == "YES")
sb.AppendFormat(GetValues(patientbloodgroupnode, patientbloodgroup));
else
sb.AppendFormat(GetTextValues(patientbloodgroupnode, patientbloodgroup));
}
if (institutenode.SelectSingleNode("isprint").ChildNodes[0].Value.ToString().ToUpper() == "YES")
{
if (institutenode.SelectSingleNode("isimage").ChildNodes[0].Value.ToString().ToUpper() == "YES")
sb.AppendFormat(GetValues(institutenode, institute));
else
sb.AppendFormat(GetTextValues(institutenode, institute));
}
if (issuedatenode.SelectSingleNode("isprint").ChildNodes[0].Value.ToString().ToUpper() == "YES")
{
if (issuedatenode.SelectSingleNode("isimage").ChildNodes[0].Value.ToString().ToUpper() == "YES")
sb.AppendFormat(GetValues(issuedatenode, issuedate));
else
sb.AppendFormat(GetTextValues(issuedatenode, issuedate));
}
if (patientnode.SelectSingleNode("isprint").ChildNodes[0].Value.ToString().ToUpper() == "YES")
{
if (issuedatenode.SelectSingleNode("isimage").ChildNodes[0].Value.ToString().ToUpper() == "YES")
sb.AppendFormat(GetValues(patientnode, patientname));
else
sb.AppendFormat(GetTextValues(patientnode, patientname));
}
if (requisitionidnode.SelectSingleNode("isprint").ChildNodes[0].Value.ToString().ToUpper() == "YES")
{
if (requisitionidnode.SelectSingleNode("isimage").ChildNodes[0].Value.ToString().ToUpper() == "YES")
sb.AppendFormat(GetValues(requisitionidnode, "Requisition Id:"));
else
sb.AppendFormat(GetTextValues(requisitionidnode, "Requisition Id:"));
}
if (productfullnamenode.SelectSingleNode("isprint").ChildNodes[0].Value.ToString().ToUpper() == "YES")
{
if (productfullnamenode.SelectSingleNode("isimage").ChildNodes[0].Value.ToString().ToUpper() == "YES")
sb.AppendFormat(GetValues(productfullnamenode, productfullname));
else
sb.AppendFormat(GetTextValues(productfullnamenode, productfullname));
}
if (bearingdonationnode.SelectSingleNode("isprint").ChildNodes[0].Value.ToString().ToUpper() == "YES")
{
if (bearingdonationnode.SelectSingleNode("isimage").ChildNodes[0].Value.ToString().ToUpper() == "YES")
sb.AppendFormat(GetValues(bearingdonationnode, "bearing Donation Id:"));
else
sb.AppendFormat(GetTextValues(bearingdonationnode, "bearing Donation Id:"));
}
if (!string.IsNullOrEmpty(sml))
{
if (smlnode.SelectSingleNode("isprint").ChildNodes[0].Value.ToString().ToUpper() == "YES")
{
if (smlnode.SelectSingleNode("isimage").ChildNodes[0].Value.ToString().ToUpper() == "YES")
sb.AppendFormat(GetValues(smlnode, sml));
else
sb.AppendFormat(GetTextValues(smlnode, sml));
}
}
sb.Append("");
StreamWriter fp;
//string htmlFileName = DNA_C.ToString() + "1.html";
string htmlFileName = "~/labelimages/" + Session.SessionID.ToString() + "/" + DNA_C.ToString() + "1.html";
// string url = Server.MapPath("/labelimages/" + Session.SessionID.ToString() + "/" + htmlFileName);
string url = Server.MapPath(htmlFileName);
htmlFileName = "../../labelimages/" + Session.SessionID.ToString() + "/" + DNA_C.ToString() + "1.html";
fp = File.CreateText(url);
fp.WriteLine(sb.ToString());
// lblStatus.Text = "File Succesfully created!";
fp.Close();
ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "issuelabel", "", false);
//ClientScript.RegisterStartupScript(typeof(Page), "OpenWin", "");
}
//Get Values
private string GetValues(XmlNode root, string labelCode)
{
StringBuilder sb = new StringBuilder();
System.Drawing.Image myimg2 = GenCode128.Code128Rendering.MakeBarcodeImage(labelCode, 1, true);
string IMAGENAME = "~/labelimages/" + Session.SessionID.ToString() + "/" + labelCode + "1.GIF";
//Response.Write(IMAGENAME);
//return "";
string imageURL1 = Server.MapPath(IMAGENAME);
myimg2.Save(imageURL1);
IMAGENAME = labelCode + "1.GIF";
//IMAGENAME = "/labelimages/" + Session.SessionID.ToString() + "/" + labelCode + "1.GIF";
string labelheader = root.SelectSingleNode("sublable").ChildNodes[0].Value;
string height = root.SelectSingleNode("height").ChildNodes[0].Value;
string width = root.SelectSingleNode("width").ChildNodes[0].Value;
string islabeltext = root.SelectSingleNode("islabeltext").ChildNodes[0].Value;
string labelpos = root.SelectSingleNode("labeltextpos").ChildNodes[0].Value;
string divtop = root.SelectSingleNode("divtop").ChildNodes[0].Value;
string divleft = root.SelectSingleNode("divleft").ChildNodes[0].Value;
string divh = root.SelectSingleNode("divheight").ChildNodes[0].Value;
string divw = root.SelectSingleNode("divwidth").ChildNodes[0].Value;
string fontsize = root.SelectSingleNode("fontsize").ChildNodes[0].Value;
string fontfamily = root.SelectSingleNode("fontfamily").ChildNodes[0].Value;
string fontweight = root.SelectSingleNode("fontweight").ChildNodes[0].Value;
string fontstyle = root.SelectSingleNode("fontstyle").ChildNodes[0].Value;
if (root.SelectSingleNode("imageurl") != null)
IMAGENAME = root.SelectSingleNode("imageurl").ChildNodes[0].Value.ToString();
string labelappendtext = "";
if (root.SelectSingleNode("labelappendtext").ChildNodes[0] != null)
labelappendtext = root.SelectSingleNode("labelappendtext").ChildNodes[0].Value;
string labelpretext = "";
if (root.SelectSingleNode("labelpretext").ChildNodes[0] != null)
labelpretext = root.SelectSingleNode("labelpretext").ChildNodes[0].Value;
string labeltextcode = labelpretext + labelCode + labelappendtext;
sb.AppendFormat("
", divh, divw, divtop, divleft, fontfamily, fontsize, fontweight, fontstyle);
if (islabeltext.ToString().ToUpper() == "YES")
{
switch (labelpos.ToUpper())
{
case "UP":
sb.AppendFormat("{0} ", labeltextcode, height, width, IMAGENAME, labelCode);
break;
case "DOWN":
sb.AppendFormat(" {0} ", labeltextcode, height, width, IMAGENAME, labelCode);
break;
case "LEFT":
sb.AppendFormat(" {0} ", labeltextcode, height, width, IMAGENAME, labelCode);
break;
case "RIGHT":
sb.AppendFormat("", labeltextcode, height, width, IMAGENAME, labelCode);
break;
}
}
else
{
sb.AppendFormat("", height, width, IMAGENAME, labelCode);
}
sb.Append("
");
if (islabeltext.ToString().ToUpper() == "YES")
{
switch (labelpos.ToUpper())
{
case "UP":
sb.AppendFormat("{0} ", labeltextcode, height, width, IMAGENAME, labelCode);
break;
case "DOWN":
sb.AppendFormat(" {0} ", labeltextcode, height, width, IMAGENAME, labelCode);
break;
case "LEFT":
sb.AppendFormat(" {0} ", labeltextcode, height, width, IMAGENAME, labelCode);
break;
case "RIGHT":
sb.AppendFormat("", labeltextcode, height, width, IMAGENAME, labelCode);
break;
}
}
else
{
sb.AppendFormat("", height, width, IMAGENAME, labelCode);
}
sb.Append("
return sb.ToString();
}
//Get Text Value
private string GetTextValues(XmlNode root, string labelCode)
{
StringBuilder sb = new StringBuilder();
string labelheader = root.SelectSingleNode("sublable").ChildNodes[0].Value;
string fontsize = root.SelectSingleNode("fontsize").ChildNodes[0].Value;
string fontfamily = root.SelectSingleNode("fontfamily").ChildNodes[0].Value;
string fontweight = root.SelectSingleNode("fontweight").ChildNodes[0].Value;
string fontstyle = root.SelectSingleNode("fontstyle").ChildNodes[0].Value;
string divtop = root.SelectSingleNode("divtop").ChildNodes[0].Value;
string divleft = root.SelectSingleNode("divleft").ChildNodes[0].Value;
string divh = root.SelectSingleNode("divheight").ChildNodes[0].Value;
string divw = root.SelectSingleNode("divwidth").ChildNodes[0].Value;
string labelappendtext = "";
if (root.SelectSingleNode("labelappendtext").ChildNodes[0] != null)
labelappendtext = root.SelectSingleNode("labelappendtext").ChildNodes[0].Value;
string labelpretext = "";
if (root.SelectSingleNode("labelpretext").ChildNodes[0] != null)
labelpretext = root.SelectSingleNode("labelpretext").ChildNodes[0].Value;
string labeltextcode = labelpretext + labelCode + labelappendtext;
sb.AppendFormat("
", divh, divw, divtop, divleft, fontfamily, fontsize, fontweight, fontstyle);
sb.AppendFormat("{0} ", labeltextcode);
sb.Append("
");
sb.AppendFormat("{0} ", labeltextcode);
sb.Append("
return sb.ToString();
}
#endregion
protected void btnISSUELABEL_Click(object sender, EventArgs e)
{
lblstatus_msg.Text = "";
if (gvISSUDETAILS.Rows.Count > 0)
{
if (txtREQN_C.Text == ddlREQUISITIONID.SelectedItem.Text)
{
int i = -1;
for (int j = 0; j < gvISSUDETAILS.Rows.Count; j++)
{
if (txtDNA_C.Text == ((Label)gvISSUDETAILS.Rows[j].FindControl("gvdDNA_C")).Text)
{
if (txtPROD_C.Text == ((Label)gvISSUDETAILS.Rows[j].FindControl("gvdPROD_C")).Text)
{
//if (string.IsNullOrEmpty(((Label)gvISSUDETAILS.Rows[j].FindControl("gvdPRODCHILD_I")).Text))
//{
// if (string.IsNullOrEmpty(txtPRODCHILD_I.Text))
// {
// i = j;
// }
// else
// {
//// if (txtPRODCHILD_I.Text == ((Label)gvISSUDETAILS.Rows[j].FindControl("gvdPRODCHILD_I")).Text)
//// {
//// i = j;
//// }
//// }
////}
//else
//{
// txtPRODCHILD_I.Focus();
//}
if (txtPRODCHILD_I.Text == ((Label)gvISSUDETAILS.Rows[j].FindControl("gvdPRODCHILD_I")).Text)
{
i = j;
}
else
{
txtPRODCHILD_I.Focus();
}
}
else
{
txtPROD_C.Focus();
}
}
else
{
txtDNA_C.Focus();
}
}
if (i != -1)
{
DataTable DTMASTER = new DataTable();
DataTable DTDETAIL = new DataTable();
DTDETAIL = (DataTable)ViewState["ISSUEDETAIL"];
DTMASTER = (DataTable)ViewState["ISSUEMASTER"];
DataSet DS = new DataSet();
DS.Tables.Add(DTDETAIL);
DTMASTER.TableName = "Master";
DS.Tables.Add(DTMASTER);
Print_Label(DS);
txtDNA_C.Text = "";
txtPROD_C.Text = "";
txtPRODCHILD_I.Text = "";
txtDNA_C.Focus();
}
else
{
lblstatus_msg.Text = "Combination of this Donation Id,Product Code,Product Child Id not found";
lblstatus_msg.ForeColor = System.Drawing.Color.Red;
}
}
else
{
txtREQN_C.Focus();
lblstatus_msg.Text = "Requisition id is invalid";
lblstatus_msg.ForeColor = System.Drawing.Color.Red;
}
}
}
protected void btnISSUEREPORT_Click(object sender, EventArgs e)
{
lblstatus_msg.Text = "";
// Session["ISSUE_N"] = ViewState["ISSUE_N"].ToString();
string htmlFileName = "";
htmlFileName = ("../REPORT/BloodIssue.aspx");
if (ddlPATINST_I.SelectedValue == "P")
{
htmlFileName = htmlFileName + "?YEARS=" + txtYEAR.Text.Trim() + "&MONTHS=" + txtAGEMONTH.Text.Trim() + "&DAYS=" + txtAGEDAY.Text.Trim() + "&REPORT=P" + "&ISSUE_N=" + ViewState["ISSUE_N"].ToString();
}
else if (ddlPATINST_I.SelectedValue == "I")
{
bool researchINSTFlag = false;
bool bioProdFlag = false;
for (int i = 0; i < gvISSUDETAILS.Rows.Count; i++)
{
string prod_c = ((Label)gvISSUDETAILS.Rows[i].FindControl("gvdPROD_C")).Text.Trim();
if (prod_c == "18202" || prod_c == "18203" || prod_c == "18204")
{
researchINSTFlag = true;
}
if (prod_c == "18205" || prod_c == "18206" || prod_c == "18207" || prod_c == "18208" || prod_c == "18209" || prod_c == "18210" || prod_c == "18211")
{
bioProdFlag = true;
}
}
if (researchINSTFlag == true)
{
researchINSTFlag = false;
htmlFileName = htmlFileName + "?REPORT=RI" + "&ISSUE_N=" + ViewState["ISSUE_N"].ToString(); ;
}
else if (bioProdFlag == true)
{
bioProdFlag = false;
htmlFileName = htmlFileName + "?REPORT=BI" + "&ISSUE_N=" + ViewState["ISSUE_N"].ToString(); ;
}
else
{
htmlFileName = htmlFileName + "?REPORT=I" + "&ISSUE_N=" + ViewState["ISSUE_N"].ToString(); ;
}
}
ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "OpenWin", "", false);
}
//addressbar=no, scrollbars =no, resizable=yes,status=yes, fullscreen=yes,location=yes, toolbar=yes, menubar=yes,top = 0, left = 0, target=_self'
protected void gvISSUEMAIN_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
gvISSUEMAIN.PageIndex = e.NewPageIndex;
gvISSUEMAIN.DataSource = (DataTable)ViewState["dsSEARCH"];
gvISSUEMAIN.DataBind();
}
protected void imgtxtReq_c_Click(object sender, ImageClickEventArgs e)
{
lblstatus_msg.Text = "";
if (!string.IsNullOrEmpty(txtRequisitionId.Text))
{
ddlREQUISITIONID.SelectedIndex = ddlREQUISITIONID.Items.IndexOf(ddlREQUISITIONID.Items.FindByText(txtRequisitionId.Text.Trim()));
if (ddlREQUISITIONID.SelectedIndex != 0)
{
Bind_REQUISITIONID();
gvISSUDETAILS.DataSource = null;
gvISSUDETAILS.DataBind();
pnlISSEDETAILS.Visible = false;
pnlLABELPRINTING.Visible = false;
clsRSVPRODMST_CDO RSVPRODMST_CDO = new clsRSVPRODMST_CDO();
clsRSVPRODMST_DA RSVPRODMST_DA = new clsRSVPRODMST_DA();
RSVPRODMST_CDO.COLOCN_C = Session["COLOCN_C"].ToString();
RSVPRODMST_CDO.REQN_C = txtRequisitionId.Text.Trim();
DataSet DSREQN = new DataSet();
DSREQN = RSVPRODMST_DA.GET_PATINST_I_BY_REQN_C(RSVPRODMST_CDO);
if (DSREQN.Tables[0].Rows.Count > 0)
{
RSVPRODMST_CDO.PATINST_I = DSREQN.Tables[0].Rows[0]["PATINST_I"].ToString();
clsISSMST_CDO ISSMST_CDO = new clsISSMST_CDO();
clsISSMST_DA ISSMST_DA = new clsISSMST_DA();
ISSMST_CDO.REQN_C = txtRequisitionId.Text.Trim();
ddlREQUISITIONID.SelectedIndex = ddlREQUISITIONID.Items.IndexOf(ddlREQUISITIONID.Items.FindByText(txtRequisitionId.Text.Trim()));
ISSMST_CDO.COLOCN_C = Session["COLOCN_C"].ToString();
ISSMST_CDO.PATINST_I = RSVPRODMST_CDO.PATINST_I.ToString();
ISSMST_CDO.PATINST_C = decimal.Parse(DSREQN.Tables[0].Rows[0]["PATINST_C"].ToString());
ISSMST_CDO.ISSUE_D = DateTime.Parse(txtISSUE_D.Text);
DataSet DSPAT = new DataSet();
DSPAT = ISSMST_DA.GET_PATINSTDOCT_DTL_BY_REQN_C(ISSMST_CDO);
if (DSPAT.Tables[0].Rows.Count > 0)
{
if (RSVPRODMST_CDO.PATINST_I == "P")
{
ViewState["PATINST_C"] = DSPAT.Tables[0].Rows[0]["PAT_C"].ToString();
SETPATDTL(DSPAT);
ViewState["ISSUEMASTER"] = DSPAT.Tables[0];
}
else
{
ViewState["PATINST_C"] = DSPAT.Tables[0].Rows[0]["INST_C"].ToString();
SETPATDTL(DSPAT);
ViewState["ISSUEMASTER"] = DSPAT.Tables[0];
}
}
else
{
lblstatus_msg.Text = "Requisition Id is invalid";
lblstatus_msg.ForeColor = System.Drawing.Color.Red;
}
//SETPATDTL(DSREQN);
}
else
{
lblstatus_msg.Text = "Requisition Id is invalid";
lblstatus_msg.ForeColor = System.Drawing.Color.Red;
ClearText();
pnlISSEDETAILS.Visible = false;
gvISSUDETAILS.DataSource = null;
gvISSUDETAILS.DataBind();
pnlLABELPRINTING.Visible = false;
txtISSUE_D.Text = DateTime.Now.ToShortDateString();
ddlISSUEBY.SelectedIndex = ddlISSUEBY.Items.IndexOf(ddlISSUEBY.Items.FindByValue(Session["EMP_C"].ToString()));
}
}
else
{
lblstatus_msg.Text = "Requisition Id is invalid";
lblstatus_msg.ForeColor = System.Drawing.Color.Red;
ClearText();
pnlISSEDETAILS.Visible = false;
gvISSUDETAILS.DataSource = null;
gvISSUDETAILS.DataBind();
pnlLABELPRINTING.Visible = false;
txtISSUE_D.Text = DateTime.Now.ToShortDateString();
ddlISSUEBY.SelectedIndex = ddlISSUEBY.Items.IndexOf(ddlISSUEBY.Items.FindByValue(Session["EMP_C"].ToString()));
}
}
}
}
No comments:
Post a Comment