private void PopulateItemType()
        {
            IMasterList objItemCommonlist = (IMasterList)ObjectFactory.CreateInstance("BusinessProcess.SCM.BMasterList,BusinessProcess.SCM");
            String      TableName         = "Mst_Decode";
            DataTable   DTItemlist        = new DataTable();

            DTItemlist = objItemCommonlist.GetItemTypeList();
            BindFunctions BindManager = new BindFunctions();
            DataSet       theDS       = objItemCommonlist.GetItemDetails(Convert.ToInt32(0));

            if (DTItemlist.Rows.Count > 0)
            {
                BindManager.BindCombo((DropDownList)ddlItemType, DTItemlist, "Name", "ID");
            }

            BindManager.BindCombo(ddlpurchaseunit, theDS.Tables[3].Copy(), "Name", "Id");
            BindManager.BindCombo(ddlmanufaturer, theDS.Tables[4], "Name", "Id");
            BindManager.BindCombo(ddldispensingunit, theDS.Tables[3].Copy(), "Name", "Id");
            BindManager.BindCombo(ddlVolumeUnit, theDS.Tables[6].Copy(), "Name", "Id");
        }
Ejemplo n.º 2
0
    protected void FillDropDowns()
    {
        try
        {
            BindFunctions BindManager       = new BindFunctions();
            IMasterList   objItemCommonlist = (IMasterList)ObjectFactory.CreateInstance("BusinessProcess.SCM.BMasterList,BusinessProcess.SCM");
            DataSet       theDS             = objItemCommonlist.GetItemDetails(Convert.ToInt32(0));
            DataSet       DTItemlist        = objItemCommonlist.GetDrugType(0);

            BindManager.BindCombo(ddlDrugType, DTItemlist.Tables[1], "DrugTypeName", "drugTypeID");
            BindManager.BindCombo(ddlPurchaseUnit, theDS.Tables[3].Copy(), "Name", "Id");
            BindManager.BindCombo(ddlDispensingUnit, theDS.Tables[3].Copy(), "Name", "Id");
        }
        catch (Exception err)
        {
            MsgBuilder theBuilder = new MsgBuilder();
            theBuilder.DataElements["MessageText"] = err.Message.ToString();
            IQCareMsgBox.Show("#C1", theBuilder, this);
            return;
        }
    }
Ejemplo n.º 3
0
        private void Bind_Controls()
        {
            string[]    theItem       = GblIQCare.theItemId.ToString().Split('-');
            IMasterList theMasterList = (IMasterList)ObjectFactory.CreateInstance("BusinessProcess.SCM.BMasterList, BusinessProcess.SCM");
            DataSet     theDS         = theMasterList.GetItemDetails(Convert.ToInt32(theItem[2]));

            theDTAllItems = theDS.Tables[5];
            BindFunctions theBindManager = new BindFunctions();

            theBindManager.Win_BindCombo(cmbDispensingUnit, theDS.Tables[3].Copy(), "Name", "Id");
            theBindManager.Win_BindCombo(cmbPurchaseUnit, theDS.Tables[3].Copy(), "Name", "Id");
            theBindManager.Win_BindCombo(cmbManufacturer, theDS.Tables[4], "Name", "Id");
            theBindManager.Win_BindCombo(cmbDispensingUnit, theDS.Tables[3].Copy(), "Name", "Id");

            if (theDS.Tables[0].Rows.Count > 0)
            {
                txtItemType.Text    = theItem[0].ToString();
                txtItemSubtype.Text = theItem[1].ToString();
                if (theDS.Tables[0].Rows[0].IsNull("DrugId") == true)
                {
                    txtItemCode.Text = "";
                }
                else
                {
                    txtItemCode.Text = theDS.Tables[0].Rows[0]["DrugId"].ToString();
                }
                ItemCode = txtItemCode.Text;
                if (theDS.Tables[0].Rows[0].IsNull("FDACode") == true)
                {
                    txtFDACode.Text = "";
                }
                else
                {
                    txtFDACode.Text = theDS.Tables[0].Rows[0]["FDACode"].ToString();
                }
                if (theDS.Tables[0].Rows[0].IsNull("GenericName") == true)
                {
                    txtGeneric.Text = "";
                }
                else
                {
                    txtGeneric.Text = theDS.Tables[0].Rows[0]["GenericName"].ToString();
                }
                txtTradeName.Text = theDS.Tables[0].Rows[0]["DrugName"].ToString();
                if (theDS.Tables[0].Rows[0].IsNull("DispensingUnit") == true)
                {
                    cmbDispensingUnit.SelectedValue = 0;
                }
                else
                {
                    cmbDispensingUnit.SelectedValue = theDS.Tables[0].Rows[0]["DispensingUnit"].ToString();
                }
                if (theDS.Tables[0].Rows[0].IsNull("GenAbbr") == true)
                {
                    txtArvAbbrevstion.Text = "";
                }
                else
                {
                    txtArvAbbrevstion.Text = theDS.Tables[0].Rows[0]["GenAbbr"].ToString();
                }
                if (theDS.Tables[0].Rows[0].IsNull("PurchaseUnit") == true)
                {
                    cmbPurchaseUnit.SelectedValue = 0;
                }
                else
                {
                    cmbPurchaseUnit.SelectedValue = theDS.Tables[0].Rows[0]["PurchaseUnit"].ToString();
                }
                if (theDS.Tables[0].Rows[0].IsNull("QtyPerPurchaseUnit") == true)
                {
                    txtUnitQty.Text = "";
                }
                else
                {
                    txtUnitQty.Text = theDS.Tables[0].Rows[0]["QtyPerPurchaseUnit"].ToString();
                }
                if (theDS.Tables[0].Rows[0].IsNull("PurchaseUnitPrice") == true)
                {
                    txtPurchaseUnitPrice.Text = "";
                }
                else
                {
                    txtPurchaseUnitPrice.Text = theDS.Tables[0].Rows[0]["PurchaseUnitPrice"].ToString();
                }
                if (theDS.Tables[0].Rows[0].IsNull("Manufacturer") == true)
                {
                    cmbManufacturer.SelectedValue = 0;
                }
                else
                {
                    cmbManufacturer.SelectedValue = theDS.Tables[0].Rows[0]["Manufacturer"].ToString();
                }
                if (theDS.Tables[0].Rows[0].IsNull("DispensingUnitPrice") == true)
                {
                    txtDispenseUnitPrice.Text = "";
                }
                else
                {
                    txtDispenseUnitPrice.Text = theDS.Tables[0].Rows[0]["DispensingUnitPrice"].ToString();
                }
                if (theDS.Tables[0].Rows[0].IsNull("DispensingMargin") == true)
                {
                    txtdespensingMargin.Text = "";
                }
                else
                {
                    txtdespensingMargin.Text = theDS.Tables[0].Rows[0]["DispensingMargin"].ToString();
                }
                if (theDS.Tables[0].Rows[0].IsNull("EffectiveDate") == true)
                {
                    dtpEffectiveDate.CustomFormat = "dd-MMM-yyyy";
                }
                else
                {
                    dtpEffectiveDate.CustomFormat = "dd-MMM-yyyy";
                    dtpEffectiveDate.Text         = theDS.Tables[0].Rows[0]["EffectiveDate"].ToString();
                }
                if (theDS.Tables[0].Rows[0].IsNull("SellingUnitPrice") == true)
                {
                    txteditsellingprice.Text = "";
                }
                else
                {
                    txteditsellingprice.Text = theDS.Tables[0].Rows[0]["SellingUnitPrice"].ToString();
                }

                if (theDS.Tables[0].Rows[0].IsNull("MinStock") == true)
                {
                    txtMinStock.Text = "";
                }
                else
                {
                    txtMinStock.Text = theDS.Tables[0].Rows[0]["MinStock"].ToString();
                }
                if (theDS.Tables[0].Rows[0].IsNull("MaxStock") == true)
                {
                    txtMaxStock.Text = "";
                }
                else
                {
                    txtMaxStock.Text = theDS.Tables[0].Rows[0]["MaxStock"].ToString();
                }
                if (theDS.Tables[0].Rows[0].IsNull("DeleteFlag") == true)
                {
                    cmbStatus.SelectedIndex = 0;
                }
                else
                {
                    cmbStatus.SelectedIndex = Convert.ToInt32(theDS.Tables[0].Rows[0]["DeleteFlag"]);
                }

                CalculateSellingPrice();
            }
        }
        private void Bind_Controls(int ItemId)
        {
            BindFunctions BindManager   = new BindFunctions();
            IMasterList   theMasterList = (IMasterList)ObjectFactory.CreateInstance("BusinessProcess.SCM.BMasterList, BusinessProcess.SCM");
            DataSet       theDS         = theMasterList.GetItemDetails(ItemId);


            if (theDS.Tables[0].Rows.Count > 0)
            {
                if (theDS.Tables[0].Rows[0].IsNull("FDACode") == true)
                {
                    txtItemCode.Text = "";
                }
                else
                {
                    txtItemCode.Text = theDS.Tables[0].Rows[0]["FDACode"].ToString();
                }
                if (theDS.Tables[0].Rows[0].IsNull("ItemTypeID") == true)
                {
                    ddlItemType.SelectedValue = "0";
                }
                else
                {
                    ddlItemType.SelectedValue = theDS.Tables[0].Rows[0]["ItemTypeID"].ToString();
                }
                if (theDS.Tables[0].Rows[0].IsNull("DrugSubTypeId") != true)
                {
                    hdsubtype.Value = theDS.Tables[0].Rows[0]["DrugSubTypeId"].ToString();
                }

                DataTable theSubDT = PopulateItemSubTypeDT(Convert.ToInt32(ddlItemType.SelectedValue));
                BindManager.BindCombo(ddlItemSubType, theSubDT, "SubTypeName", "SubItemTypeID");
                ddlItemSubType.Attributes.Add("onchange", "ItemSubTypeChange('" + ddlItemSubType.ClientID + "');");
                //ScriptManager.RegisterStartupScript(this, GetType(), "PopulateItemType", "PopulateContinents('" + theDS.Tables[0].Rows[0]["DrugSubTypeId"].ToString() + "');", true);
                if (theDS.Tables[0].Rows[0].IsNull("DrugSubTypeId") == true)
                {
                    ddlItemSubType.SelectedValue = "0";
                }
                else
                {
                    ddlItemSubType.SelectedValue = theDS.Tables[0].Rows[0]["DrugSubTypeId"].ToString();
                    hdsubtype.Value = theDS.Tables[0].Rows[0]["DrugSubTypeId"].ToString();
                }



                //$('#mycontrolId').val(myvalue).attr("selected", "selected");
                if (theDS.Tables[0].Rows[0].IsNull("RxNorm") == true)
                {
                    txtRxNorm.Text = "";
                }
                else
                {
                    txtRxNorm.Text = theDS.Tables[0].Rows[0]["RxNorm"].ToString();
                }

                if (theDS.Tables[0].Rows[0].IsNull("MorDose") == true || theDS.Tables[0].Rows[0]["MorDose"].ToString() == "0")
                {
                    txtMornDose.Text = "";
                }
                else
                {
                    txtMornDose.Text = theDS.Tables[0].Rows[0]["MorDose"].ToString();
                }
                if (theDS.Tables[0].Rows[0].IsNull("MidDose") == true || theDS.Tables[0].Rows[0]["MidDose"].ToString() == "0")
                {
                    txtMidDayDose.Text = "";
                }
                else
                {
                    txtMidDayDose.Text = theDS.Tables[0].Rows[0]["MidDose"].ToString();
                }
                if (theDS.Tables[0].Rows[0].IsNull("EvenDose") == true || theDS.Tables[0].Rows[0]["EvenDose"].ToString() == "0")
                {
                    txtEvenDose.Text = "";
                }
                else
                {
                    txtEvenDose.Text = theDS.Tables[0].Rows[0]["EvenDose"].ToString();
                }

                if (theDS.Tables[0].Rows[0].IsNull("NightDose") == true || theDS.Tables[0].Rows[0]["NightDose"].ToString() == "0")
                {
                    txtNightDose.Text = "";
                }
                else
                {
                    txtNightDose.Text = theDS.Tables[0].Rows[0]["NightDose"].ToString();
                }


                txtTradeName.Text    = theDS.Tables[0].Rows[0]["ItemName"].ToString();
                txtTradeName.Enabled = false;

                if (theDS.Tables[0].Rows[0].IsNull("PurchaseUnit") == true)
                {
                    ddlpurchaseunit.SelectedValue = "0";
                }
                else
                {
                    ddlpurchaseunit.SelectedValue = theDS.Tables[0].Rows[0]["PurchaseUnit"].ToString();
                }
                if (theDS.Tables[0].Rows[0].IsNull("QtyPerPurchaseUnit") == true)
                {
                    txtpurchaseqty.Text = "";
                }
                else
                {
                    txtpurchaseqty.Text = theDS.Tables[0].Rows[0]["QtyPerPurchaseUnit"].ToString();
                }
                if (theDS.Tables[0].Rows[0].IsNull("PurchaseUnitPrice") == true)
                {
                    txtPurUnitPrice.Text = "";
                }
                else
                {
                    txtPurUnitPrice.Text = theDS.Tables[0].Rows[0]["PurchaseUnitPrice"].ToString();
                }
                if (theDS.Tables[0].Rows[0].IsNull("Manufacturer") == true)
                {
                    ddlmanufaturer.SelectedValue = "0";
                }
                else
                {
                    ddlmanufaturer.SelectedValue = theDS.Tables[0].Rows[0]["Manufacturer"].ToString();
                }

                if (theDS.Tables[0].Rows[0].IsNull("DispensingUnit") == true)
                {
                    ddldispensingunit.SelectedValue = "0";
                }
                else
                {
                    ddldispensingunit.SelectedValue = theDS.Tables[0].Rows[0]["DispensingUnit"].ToString();
                }
                if (theDS.Tables[0].Rows[0].IsNull("DispensingUnitPrice") == true)
                {
                    txtDispUnitPrice.Text = "";
                }
                else
                {
                    txtDispUnitPrice.Text = theDS.Tables[0].Rows[0]["DispensingUnitPrice"].ToString();
                }
                if (theDS.Tables[0].Rows[0].IsNull("DispensingMargin") == true)
                {
                    txtDispMargin.Text = "0";
                }
                else
                {
                    txtDispMargin.Text = theDS.Tables[0].Rows[0]["DispensingMargin"].ToString();
                }
                if ((theDS.Tables[0].Rows[0].IsNull("EffectiveDate") == true) || (Convert.ToDateTime(theDS.Tables[0].Rows[0]["EffectiveDate"]).ToString("dd-MMM-yyyy") == "01-Jan-1900"))
                {
                }
                else
                {
                    txtEffectiveDate.Text = Convert.ToDateTime(theDS.Tables[0].Rows[0]["EffectiveDate"]).ToString("dd-MMM-yyyy");
                }
                if (theDS.Tables[0].Rows[0].IsNull("SellingUnitPrice") == true)
                {
                    txtsellingprice.Text = "";
                }
                else
                {
                    txtsellingprice.Text = theDS.Tables[0].Rows[0]["SellingUnitPrice"].ToString();
                }


                if (theDS.Tables[0].Rows[0].IsNull("ItemInstructions") == true)
                {
                    txtinstructions.Text = "";
                }
                else
                {
                    txtinstructions.Text = theDS.Tables[0].Rows[0]["ItemInstructions"].ToString();
                }

                if (theDS.Tables[0].Rows[0].IsNull("syrup") == true)
                {
                    chksyrup.Checked = false;
                }
                else if (theDS.Tables[0].Rows[0]["syrup"].ToString() == "1")
                {
                    chksyrup.Checked      = true;
                    ddlVolumeUnit.Enabled = true;
                }

                if (theDS.Tables[0].Rows[0].IsNull("VolUnit") == true)
                {
                    ddlVolumeUnit.SelectedValue = "0";
                }
                else
                {
                    ddlVolumeUnit.SelectedValue = theDS.Tables[0].Rows[0]["VolUnit"].ToString();
                }

                CalculateSellingPrice();
                collapsepanels();
            }
            if (theDS.Tables[7].Rows.Count > 0)
            {
                string GenericAbbv = "";
                foreach (DataRow DRow in theDS.Tables[7].Rows)
                {
                    if (DRow["Abbrevation"].ToString() != "")
                    {
                        if (GenericAbbv == "")
                        {
                            GenericAbbv = DRow["Abbrevation"].ToString();
                        }
                        else
                        {
                            GenericAbbv = GenericAbbv + '/' + DRow["Abbrevation"].ToString();
                        }
                    }
                    DataTable theSelectedGeneric = MakeSelectedGenericTable();
                    DataRow   theDR1             = theSelectedGeneric.NewRow();
                    theDR1["Drug_pk"]     = ItemId.ToString();
                    theDR1["Id"]          = DRow["ID"];
                    theDR1["Name"]        = DRow["Name"];
                    theDR1["Abbrevation"] = DRow["Abbrevation"];
                    theSelectedGeneric.Rows.Add(theDR1);
                    ViewState["SelGeneric"] = theSelectedGeneric;

                    DataTable DT1 = (DataTable)ViewState["SelGeneric"];
                    theGenericTable = DT1;
                    foreach (DataRow theDR2 in DT1.Rows)
                    {
                        DataTable theDT2 = (DataTable)ViewState["GenericMaster"];
                        DataRow[] DR2    = theDT2.Select("GenericID = " + theDR1["Id"].ToString());
                        if (DR2.Length > 0)
                        {
                            theDT2.Rows.Remove(DR2[0]);
                        }
                        ViewState["GenericMaster"] = theDT2;
                    }
                    txtDrugAbbre.Text = GenericAbbv.ToString();
                }
                BindManager.BindList(lstGeneric, theDS.Tables[7], "Name", "Id");
            }
            if (theDS.Tables[8].Rows.Count > 0)
            {
                BindManager.BindList(lstStrength, theDS.Tables[8], "Name", "Id");
                DataTable SelStrength = theDS.Tables[8];
                //SelStrength.Columns.Add("Abbrevation", System.Type.GetType("System.String"));
                ViewState["SelStrength"] = SelStrength;
                //////// StrengthMaster /////////
                DataTable DT = (DataTable)ViewState["SelStrength"];
                foreach (DataRow theDR in DT.Rows)
                {
                    DataTable theDT = (DataTable)ViewState["StrengthMaster"];
                    DataRow[] DR    = theDT.Select("StrengthId = '" + theDR["Id"].ToString() + "'");
                    if (DR.Length > 0)
                    {
                        theDT.Rows.Remove(DR[0]);
                    }
                    ViewState["StrengthMaster"] = theDT;
                }
            }
            if (theDS.Tables[0].Rows[0]["ItemTypeID"].ToString() == "300")
            {
                lstGeneric.Enabled    = false;
                btnAddGeneric.Enabled = false;
                lstStrength.Enabled   = false;
                btnAddDose.Enabled    = false;
            }
            if (theDS.Tables[9] != null)
            {
                if (theDS.Tables[9].Rows.Count > 0)
                {
                    if (theDS.Tables[9].Rows[0]["BatchId"].ToString() != "0")
                    {
                        gridItemBatchList.DataSource = theDS.Tables[9];
                        gridItemBatchList.DataBind();
                        btnbatchsummary.Visible = true;
                    }
                }
                else
                {
                    btnbatchsummary.Visible = false;
                }
            }
            //ScriptManager.RegisterStartupScript(this, GetType(), "PopulateItmSubT", "PopulateItmSubT('" + theDS.Tables[0].Rows[0]["DrugSubTypeId"].ToString() + "');", true);
        }