private void RRFForm_Load(object sender, EventArgs e) { btnAutoPushToPFSA.Enabled = false; btnSendEmergencyOrder.Enabled = false; var unitcolumn = ((GridView) gridItemsChoice.MainView).Columns[2]; var unitcolumn1 = ((GridView) gridItemsChoice.MainView).Columns[13]; layoutControlItem18.Visibility =LayoutVisibility.Never; switch (VisibilitySetting.HandleUnits) { case 3: unitcolumn.Visible = false; unitcolumn1.Visible = true; break; case 2: unitcolumn.Visible = false; unitcolumn1.Visible = true; break; default: unitcolumn.Visible = true; unitcolumn1.Visible = false; break; } var unit = new ItemUnit(); var units = unit.GetAllUnits(); unitsBindingSource.DataSource = units.DefaultView; var type = new BLL.Type(); var alltypes = type.GetAllCategory(); categorybindingSource.DataSource = alltypes.DefaultView; var program = new Programs(); var programs = program.GetSubPrograms(); cboProgram.Properties.DataSource = programs; cboProgram.Properties.DisplayMember = "Name"; cboProgram.Properties.ValueMember = "ID"; var orderstatus = new PharmInventory.HelperClasses.OrderStatus(); orderbindingSource.DataSource = orderstatus.GetRRFOrders(); lkorderstatus.Properties.DataSource = orderbindingSource; lkorderstatus.Properties.ValueMember = "RecordId"; lkorderstatus.Properties.DisplayMember = "Name"; PopulateTheMonthCombos(cboFromMonth); PopulateTheMonthCombos(cboToMonth); PopulateTheYearCombo(cboFromYear); PopulateTheYearCombo(cboToYear); var stor = new Stores(); stor.GetActiveStores(); cboStores.Properties.DataSource = stor.DefaultView; PopulateRRFs(); WindowVisibility(false); EnableDisableStatusCheck(); var prog = new Programs(); prog.GetSubPrograms(); cboProgram.Properties.DataSource = prog.DefaultView; cboProgram.EditValue = 1000; }
private void ManageItems_Load(object sender, EventArgs e) { PopulateCatTree(SelectedType); lkCommodityTypes.Properties.DataSource = BLL.Type.GetAllTypes(); lkCommodityTypes.ItemIndex = 0; var itemunit = new ItemUnit(); var allunits = itemunit.GetAllUnits(); unitBindingSource.DataSource = allunits.DefaultView; var stor = new Stores(); stor.GetActiveStores(); cboStores.Properties.DataSource = stor.DefaultView; string[] arr = {"All", "Stock Out", "Below EOP", "Near EOP", "Normal", "Over Stocked"}; cboStatus.Properties.DataSource = arr; DataTable dtMonths = new DataTable(); dtMonths.Columns.Add("Value"); dtMonths.Columns.Add("Month"); dtDate.Value = DateTime.Now; dtDate.CustomFormat = "MM/dd/yyyy"; dtCur = ConvertDate.DateConverter(dtDate.Text); int currentMont = dtCur.Month; int year = ((currentMont < 11) ? dtCur.Year : dtCur.Year + 1); // this is just a try if (currentMont >= 11) { currentMont -= 11; } var dtyears = Items.AllYears(); cboYear.Properties.DataSource = dtyears; cboYear.EditValue = year; if (cboYear.Properties.Columns.Count > 0) cboYear.Properties.Columns[0].Alignment = DevExpress.Utils.HorzAlignment.Near; var prog = new Programs(); var dtProg = new DataTable(); dtProg = prog.GetSubPrograms(); object[] objProg = { 0, "All Programs", "", 0, "" }; dtProg.Rows.Add(objProg); cboSubProgram.Properties.DataSource = dtProg; cboSubProgram.ItemIndex = -1; cboSubProgram.Text = "Select Program"; var rec = new ReceivingUnits(); var drRec = rec.GetAllApplicableDU(); cboIssuedTo.Properties.DataSource = drRec; cboIssuedTo.ItemIndex = -1; cboIssuedTo.Text = "Select Issue Location"; IsReady = true; var unitcolumn = ((GridView)gridItemsChoice.MainView).Columns[15]; switch (VisibilitySetting.HandleUnits) { case 1: unitcolumn.Visible = false; break; case 2: unitcolumn.Visible = true; break; default: unitcolumn.Visible = true; break; } PopulateGrid(); }
private void ManageItems_Load(object sender, EventArgs e) { lkCommodityTypes.Properties.DataSource = BLL.Type.GetAllTypes(); lkCommodityTypes.ItemIndex = 0; PopulateCatTree(); Stores stor = new Stores(); stor.GetActiveStores(); cboStores.DataSource = stor.DefaultView; dtDate.Value = DateTime.Now; dtDate.CustomFormat = "MM/dd/yyyy"; dtCurrent = ConvertDate.DateConverter(dtDate.Text); Programs prog = new Programs(); DataTable dtProg = new DataTable(); dtProg = prog.GetSubPrograms(); object[] objProg = { 0, "All Programs", "", 0, "" }; dtProg.Rows.Add(objProg); cboSubProgram.DataSource = dtProg; cboSubProgram.SelectedIndex = -1; cboSubProgram.Text = "Select Program"; ReceivingUnits rec = new ReceivingUnits(); DataTable drRec = rec.GetAllApplicableDU(); cboIssuedTo.DataSource = drRec; cboIssuedTo.SelectedIndex = -1; cboIssuedTo.Text = "Select Issue Location"; int month = dtCurrent.Month; int year = ((dtCurrent.Month < 11) ? dtCurrent.Year : dtCurrent.Year + 1); DataTable dtyears = Items.AllYears(); foreach (DataRow drYears in dtyears.Rows) { int yr = Convert.ToInt32(drYears["year"]); cboYear.Items.Add(yr); } bool added = true; for (int x = 0; x < cboYear.Items.Count; x++)//to check if the current year is included or not { if (Convert.ToInt64(cboYear.Items[x]) == year) { added = false; break; } } if (added) { cboYear.Items.Add(year); } cboYear.SelectedItem = year; }
/// <summary> /// Populate the lookups and item lists. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ReceiveingForm_Load(object sender, EventArgs e) { //gridRecieveView.Columns[4].Visible = VisibilitySetting.HandleUnits; var UnitColumn = ((GridView)receivingGrid.MainView).Columns[12]; var UnitColumn1 = ((GridView)receivingGrid.MainView).Columns[5]; var UnitColumn2 = ((GridView)gridItemsChoice.MainView).Columns[4]; var qtyperpack = ((GridView)receivingGrid.MainView).Columns[3]; var buqty = ((GridView)receivingGrid.MainView).Columns[4]; switch (VisibilitySetting.HandleUnits) { case 3: UnitColumn.Visible = true; UnitColumn1.Visible = false; UnitColumn2.Visible = false; qtyperpack.Visible = false; buqty.Visible = false; break; case 2: UnitColumn.Visible = true; UnitColumn1.Visible = false; UnitColumn2.Visible = false; qtyperpack.Visible = false; buqty.Visible = false; break; case 1: UnitColumn.Visible = false; UnitColumn1.Visible = true; qtyperpack.Visible = true; UnitColumn2.Visible = true; buqty.Visible = true; break; } var stor = new Stores(); stor.GetActiveStores(); cboStores.Properties.DataSource = stor.DefaultView; cboStores.ItemIndex = 0; Programs prog = new Programs(); DataTable dtProg = prog.GetSubPrograms(); cboProgram.Properties.DataSource = dtProg; cboProgram.Properties.DisplayMember = "Name"; cboProgram.Properties.ValueMember = "ID"; var unit = new ItemUnit(); var units = unit.GetAllUnits(); UnitsbindingSource.DataSource = units.DefaultView; Supplier sup = new Supplier(); DataTable dtSup = new DataTable(); sup.GetActiveSuppliers(); dtSup = sup.DefaultView.ToTable(); cboSuppliers.DataSource = dtSup; cboSupplier.Properties.DataSource = sup.DefaultView; cboSuppliers.Text = "Select Supplier"; cboSuppliers.ValueMember = "ID"; cboSuppliers.DisplayMember = "CompanyName"; // Bind the grid with only active items Items itm = new Items(); //DataTable dtItem = itm.GetAllItems(1); DataTable dtItem = BLL.Items.GetActiveItemsByCommodityType(0); lkCategories.Properties.DataSource = BLL.Type.GetAllTypes(); lkCategories.ItemIndex = 0; PopulateItemList(dtItem); selectedType = radioGroup1.EditValue.ToString(); PopulateCatTree(selectedType); int userID = MainWindow.LoggedinId; User us = new User(); us.LoadByPrimaryKey(userID); txtReceivedBy.Text = us.FullName; // bind the current date as the datetime field dtRecDate.Value = DateTime.Now; }
/// <summary> /// Populates the fields based on the supplied itemID or categoryID /// </summary> private void PopulateFields() { if (_itemId == 0) return; Items itm = new Items(); DataTable dtItem = itm.GetItemById(_itemId); txtItemName.Text = dtItem.Rows[0]["ItemName"].ToString() + " - " + dtItem.Rows[0]["DosageForm"].ToString() + " - " + dtItem.Rows[0]["Strength"].ToString(); ckExculed.Checked =itm.IsInHospitalList; chkNeedExpiryBatch.Checked = itm.NeedExpiryBatch; txtText.Text = itm.StockCodeDACA ?? string.Empty; txtQuantityPerPack.Text = itm.Cost ?? string.Empty; try { if (dtItem.Rows[0]["ABC"].ToString() == "A") rdA.Checked = true; else if (dtItem.Rows[0]["ABC"].ToString() == "B") rdB.Checked = true; else if (dtItem.Rows[0]["ABC"].ToString() == "C") rdC.Checked = true; } catch { } try { if (dtItem.Rows[0]["VEN"].ToString() == "V") rdV.Checked = true; else if (dtItem.Rows[0]["VEN"].ToString() == "E") rdE.Checked = true; else if (dtItem.Rows[0]["VEN"].ToString() == "N") rdN.Checked = true; } catch { } //ItemShelf itmShelf = new ItemShelf(); //DataTable dtSlf = itmShelf.GetLocationByItem(itm.ID); //lstBinLocation.DataSource = dtSlf; var unit = new ItemUnit(); var itemunits= unit.LoadFromSQl(_itemId); itemunitbindingSource.DataSource = itemunits; if (VisibilitySetting.HandleUnits == 2) { listBox1.Visible = true; } else if(VisibilitySetting.HandleUnits == 3) { listBox1.Visible = true; } else if(VisibilitySetting.HandleUnits == 1) { listBox1.Hide(); } Supplier sup = new Supplier(); sup.GetActiveSuppliers(); ItemSupplier itmSup = new ItemSupplier(); itm.GetItemsBySupplier(_itemId); foreach (DataRowView dv in sup.DefaultView) { bool check = false; check = itmSup.CheckIfExist(_itemId, Convert.ToInt32(dv["ID"])); object obj = dv["CompanyName"]; lstSuppliers.Items.Add(obj, check); } Programs prog = new Programs(); prog.GetSubPrograms(); ProgramProduct progItem = new ProgramProduct(); lstPrograms.Items.Clear(); foreach (DataRowView dv in prog.DefaultView) { bool check = false; check = progItem.CheckIfExists(_itemId, Convert.ToInt32(dv["ID"])); lstPrograms.Items.Add(dv["Name"], check); } ReceivingUnits dus = new ReceivingUnits(); dus.GetActiveDispensaries(); lstDUs.Items.Clear(); DUsItemList duItem = new DUsItemList(); foreach (DataRowView drDus in dus.DefaultView) { bool check = false; check = duItem.CheckIfExsits(_itemId, Convert.ToInt32(drDus["ID"])); lstDUs.Items.Add(drDus["Name"], check); } }
/// <summary> /// When the cboPrograms changes, the program lists needs to be repopulated /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void cboPrograms_SelectedIndexChanged(object sender, EventArgs e) { lstPrograms.Items.Clear(); Programs prog = new Programs(); ProgramProduct progItem = new ProgramProduct(); if (cboPrograms.SelectedValue != null) { prog.GetSubProgramsByParentId(Convert.ToInt32(cboPrograms.SelectedValue)); } else { prog.GetSubPrograms(); } foreach (DataRowView dv in prog.DefaultView) { bool check = false; check = progItem.CheckIfExists(_itemId, Convert.ToInt32(dv["ID"])); lstPrograms.Items.Add(dv["Name"], check); } }
/// <summary> /// Load the dropdowns and the category tree /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ManageItems_Load(object sender, EventArgs e) { PopulateCatTree(_selectedType); Programs prog = new Programs(); DataTable dtProg = prog.GetSubPrograms(); object[] objProg = { 0, "All Programs", "", 0, "" }; dtProg.Rows.Add(objProg); cboSubProgram.DataSource = dtProg; cboSubProgram.SelectedIndex = -1; cboSubProgram.Text = "Select Program"; Stores stor = new Stores(); stor.GetActiveStores(); cboStores.DataSource = stor.DefaultView; }
/// <summary> /// Load the lookups and Prepare the form /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void EditReceive_Load(object sender, EventArgs e) { lkItemUnit.Enabled = VisibilitySetting.HandleUnits != 1; var str = new Stores(); str.LoadAll(); cboStores.DataSource = str.DefaultView; var sup = new Supplier(); sup.GetActiveSuppliers(); cboSupplier.DataSource = sup.DefaultView; if(_tranId != 0) { var rec = new ReceiveDoc(); var itm = new Items(); rec.LoadByPrimaryKey(_tranId); var dtItm = itm.GetItemById(rec.ItemID); var units = new ItemUnit(); var unit = units.LoadFromSQl(rec.ItemID); lkItemUnit.Properties.DataSource = unit; lkItemUnit.Properties.DisplayMember = "Text"; lkItemUnit.Properties.ValueMember = "ID"; var programs = new Programs(); var allprograms = programs.GetSubPrograms(); lkPrograms.Properties.DataSource = allprograms; lkPrograms.Properties.ValueMember = "ID"; lkPrograms.Properties.DisplayMember = "Name"; string itemName = dtItm.Rows[0]["ItemName"].ToString() + " - " + dtItm.Rows[0]["DosageForm"].ToString() + " - " + dtItm.Rows[0]["Strength"].ToString(); txtRefNo.Text = rec.RefNo; txtBatchNo.Text = rec.BatchNo; try { txtPack.Text = rec.NoOfPack.ToString(); txtQtyPack.Text =rec.QtyPerPack.ToString(); txtPrice.Text = (rec.Cost * rec.QtyPerPack).ToString(); //txtQuantityLeft.Text = rec.QuantityLeft.ToString(); } catch { txtPack.Text = "0"; txtQtyPack.Text = "0"; txtPrice.Text = (rec.Cost * 1).ToString(); } txtQuantity.Text = rec.Quantity.ToString(); lkPrograms.EditValue = rec.SubProgramID; DateTime dtDate = Convert.ToDateTime(rec.Date.ToString("MM/dd/yyyy")); txtDate.Text = dtDate.ToShortDateString(); dtRecDate.Value = DateTime.Now; dtRecDate.CustomFormat = "MM/dd/yyyy"; if (!rec.IsColumnNull("ExpDate")) dtExpiryDate.Value = rec.ExpDate; cboStores.SelectedValue = rec.StoreID; cboSupplier.SelectedValue = rec.SupplierID; if (!rec.IsColumnNull("UnitID")) lkItemUnit.EditValue = rec.UnitID; txtItemName.Text = itemName; txtReceivedBy.Text = rec.ReceivedBy; txtRemark.Text = rec.Remark; } }