private void BindFormElements() { //Bind the Region Lookup (Zone and Woredas will be bind after selection Region) lkRegion.Properties.DataSource = BLL.Region.GetAllRegions().DefaultView; lkRegion.EditValue = regionId; //Bind the Receiving units Types Lookup InstitutionType institutionsTypes = new InstitutionType(); institutionsTypes.LoadAll(); institutionsTypes.Sort = "Name ASC"; lkType.Properties.DataSource = institutionsTypes.DefaultView; lkType.EditValue = ruType; //Bind the Ownership Type Lookup OwnershipType ownershipTypes = new OwnershipType(); ownershipTypes.LoadAll(); ownershipTypes.Sort = "Name ASC"; lkOwnership.Properties.DataSource = ownershipTypes.DefaultView; lkOwnership.EditValue = OwnershipType.Constants.Public; //Bind the Active lookup lkActive.Properties.ValueMember = lkActive.Properties.DisplayMember = "Column"; lkActive.Properties.DataSource = new string[3] { "All", "Active", "InActive" }; lkActive.ItemIndex = 0; //Bind the others LoadZones(); lkZone.EditValue = zoneID; LoadWoredas(); lkWoreda.EditValue = woredaID; LoadReceivingUnits(); }
/// <summary> /// Gets the receiving unit type by region and number RU. /// </summary> /// <param name="WoredaID">The woreda ID.</param> /// <param name="OwnershipID">The ownership ID.</param> /// <returns></returns> public static DataTable GetReceivingUnitTypeByRegionAndNumberRU(int WoredaID,int OwnershipID) { InstitutionType RUType = new InstitutionType(); // string query = // string.Format(@"Select rt.ID,rt.Name,rt.Name+ ' (' + CAST(COUNT(ru.ID) as varchar) + ')' as Count from Institution ru Join InstitutionType rt on rt.ID = ru.RUType // WHERE ru.Woreda= {0} and Ownership ={1} and ru.RUType <> {2} // Group by rt.ID,rt.Name // Union // Select rt.ID,rt.Name,rt.Name +'(0)' Count from InstitutionType rt // where rt.ID <> {2} and rt.ID Not In ( // Select Distinct ru.RUType from Institution ru WHERE ru.Woreda= {0} and Ownership ={1})", WoredaID, OwnershipID,Constants.HUB); //The above query string is commented because it filters out the hubs assuming that the hub to hub transfer is supposed to handle the hubs. Therefore, it's commented until we make sure the hub to hub transfer is working perfectly as it should var query = HCMIS.Repository.Queries.InstitutionType.SelectGetReceivingUnitTypeByRegionAndNumberRU(WoredaID, OwnershipID); RUType.LoadFromRawSql(query); return RUType.DataTable; }
/// <summary> /// Gets the receiving unit type by region and number RU. /// </summary> /// <param name="WoredaID">The woreda ID.</param> /// <param name="OwnershipID">The ownership ID.</param> /// <returns></returns> public static DataTable GetReceivingUnitTypeByRegionAndNumberRU(int WoredaID, int OwnershipID) { InstitutionType RUType = new InstitutionType(); // string query = // string.Format(@"Select rt.ID,rt.Name,rt.Name+ ' (' + CAST(COUNT(ru.ID) as varchar) + ')' as Count from Institution ru Join InstitutionType rt on rt.ID = ru.RUType // WHERE ru.Woreda= {0} and Ownership ={1} and ru.RUType <> {2} // Group by rt.ID,rt.Name // Union // Select rt.ID,rt.Name,rt.Name +'(0)' Count from InstitutionType rt // where rt.ID <> {2} and rt.ID Not In ( // Select Distinct ru.RUType from Institution ru WHERE ru.Woreda= {0} and Ownership ={1})", WoredaID, OwnershipID,Constants.HUB); //The above query string is commented because it filters out the hubs assuming that the hub to hub transfer is supposed to handle the hubs. Therefore, it's commented until we make sure the hub to hub transfer is working perfectly as it should var query = HCMIS.Repository.Queries.InstitutionType.SelectGetReceivingUnitTypeByRegionAndNumberRU(WoredaID, OwnershipID); RUType.LoadFromRawSql(query); return(RUType.DataTable); }
private void ReceiveingForm_Load(object sender, EventArgs e) { SetPermissions(); LoadDecimalFormatings(); //Bind ReceiptType cboReceiveType.Properties.DataSource = ReceiptType.GetAllReceiptTypesForReceive(); cboReceiveType.EditValue = ReceiptType.CONSTANTS.STANDARD_RECEIPT; //Bind the Receiving units Types Lookup InstitutionType institutionsTypes = new InstitutionType(); institutionsTypes.LoadAll(); institutionsTypes.Sort = "Name ASC"; lkType.Properties.DataSource = institutionsTypes.DefaultView; lkType.EditValue = InstitutionType.Constants.HEALTH_CENTER; //--- //Bind the Ownership Type Lookup LoadOwnershipType(); lkOwnership.EditValue = OwnershipType.Constants.Public; LoadReceivingUnits(); //---------------------------- // reset the receiving date dtRecDate.Value = DateTimeHelper.ServerDateTime; // Load the logical stores and populate the combo boxes //lkStoreType.Properties.DataSource = BLL.StoreType.GetStoreTypesForAUser(NewMainWindow.UserId).DefaultView; lkAccounts.SetupActivityEditor().SetDefaultActivity(); // Load the possible suppliers and populate // Load all occupied Pallet location list for the consolidate lookup editManuf2 repoLKConsolidate.DataSource = PalletLocation.GetAllOccupied(); // load the receiving unit's to the combo box Institution rus = new Institution(); rus.LoadAll(); lkFacilitySelection.Properties.DataSource = rus.DefaultView; lkStorageType.DataSource = StorageType.AllStorageTypes; // bulkPalletLocationLookup.DataSource = PalletLocation.GetAllFree(StorageType.BulkStore); nonBulkPalletLocationLookup.DataSource = PalletLocation.GetAllFreeNonBulk(); //OnSelectedFilterChanged(new object(), new DevExpress.XtraEditors.Controls.ChangingEventArgs(null,"Drug")); // load all item Units ItemUnit itemUnit = new ItemUnit(); itemUnit.LoadAll(); editUnits.DataSource = itemUnit.DefaultView; lkCategories.Properties.DataSource = BLL.CommodityType.GetAllTypes(); lkCategories.ItemIndex = 0; // Get the default who's receiving this txtReceivedBy.Text = CurrentContext.LoggedInUserName; // for RDF, Hide the packs column on receipt if (BLL.Settings.IsRdfMode) { colPacks.Visible = false; } //lcDeliveryNoteCheck.Visibility = BLL.Settings.HandleDeliveryNotes ? DevExpress.XtraLayout.Utils.LayoutVisibility.Always : DevExpress.XtraLayout.Utils.LayoutVisibility.Never; colPricePerPack.Visible = !BLL.Settings.HandleGRV && srm != true; lcRefNoInput.Visibility = lcRefNo.Visibility = BLL.Settings.HandleGRV ? DevExpress.XtraLayout.Utils.LayoutVisibility.Never : DevExpress.XtraLayout.Utils.LayoutVisibility.Always; if (BLL.Settings.IsCenter) { colShipper.Visible = false; colPercentReceived.Visible = true; colPrintedDate.Visible = false; PalletizeTab.PageVisible = false; txtPassCode.Enabled = false; lcPassCode .Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always; tabReceiveTabs.TabPages[3].Text = "Step Three - Store Selection"; } //Load the allowed Warehouses DataView PossibleWarehouses = BLL.Warehouse.getActiveWarehouseWithCluster(CurrentContext.UserId); lkWarehouse.Properties.DataSource = PossibleWarehouses; if (PossibleWarehouses.Count > 0) { lkWarehouse.EditValue = ((DataView)lkWarehouse.Properties.DataSource)[0]["ID"]; } //Load IsElectronicReceiveOnly Setting LoadIsPOElectronicSetting(); }
private void BindFormElements() { // Find the next order number and write it on the order ID Field // The order ID is generated here in code DataTable tbl = BLL.CommodityType.GetAllTypes(); tbl.Rows.Add(0, "All"); lkCategoires.Properties.DataSource = tbl; //lkCategoires.ItemIndex = 0; lkCategoires.EditValue = 0; lkRequisitionType.EditValue = RequisitionType.Demand; // lkPeriod.Visible = false; //Bind the Region Lookup (Zone and Woredas will be bind after selection Region) lkRegion.Properties.DataSource = BLL.Region.GetAllRegions().DefaultView; if (!GeneralInfo.Current.IsColumnNull("Region")) { lkRegion.EditValue = GeneralInfo.Current.Region; } else { lkRegion.Properties.NullText = "Select Region"; } //Bind the Receiving units Types Lookup InstitutionType institutionsTypes = new InstitutionType(); institutionsTypes.LoadAll(); institutionsTypes.Sort = "Name ASC"; lkType.Properties.DataSource = institutionsTypes.DefaultView; lkType.EditValue = InstitutionType.Constants.HEALTH_CENTER; //Bind the Ownership Type Lookup LoadOwnershipType(); lkOwnership.EditValue = OwnershipType.Constants.Public; LoadReceivingUnits(); // txtRefNo.Text = Order.GetNextOrderReference(); // bind the selected data table to the hidden grid on the CDR request screen LoadReceivingUnits(); // load all the logical stores that exist in the system. lkModes.SetupModeEditor().SetDefaultMode(); //if (BLL.Stores.GetDefaultStore(NewMainWindow.UserId).RowCount > 0 && !BLL.Stores.GetDefaultStore(NewMainWindow.UserId).IsColumnNull("ID")) //{ // lkModes.EditValue = BLL.Stores.GetDefaultStore(NewMainWindow.UserId).ID; //} //else //{ // lkModes.ItemIndex = 0; // //lkModes.EditValue = null; //} //lkModes_EditValueChanged(null, null); boxSizedList.DataSource = BLL.ItemManufacturer.PackageLevelKeys; // Load all RRF Period var periods = BLL.Period.GetAllPeriods(); lkPeriod.Properties.DataSource = periods.DefaultView; // requisition Type: for the Time being it is hard coded var requisitionTypes = Enum.GetValues(typeof(RequisitionType)).Cast<RequisitionType>() .Select(e => new { Value = (int)e, Description = e.ToString() }) .ToList(); //For this release - Mrach-20 remove consumption Type requisitionTypes.RemoveAt(requisitionTypes.IndexOf(new { Value = (int)RequisitionType.Consumption, Description = "Consumption" })); lkRequisitionType.Properties.DataSource = requisitionTypes; }
private void LoadReceivingUnits() { BLL.Region reg = new BLL.Region(); reg.LoadAll(); lkRegion.Properties.DataSource = reg.DefaultView; BLL.InstitutionType ruType = new InstitutionType(); ruType.Where.IsActive.Value = 1; ruType.Query.Load(); lkRUType.Properties.DataSource = ruType.DefaultView; BLL.OwnershipType ownershipType = new OwnershipType(); ownershipType.LoadAll(); lkOwnership.Properties.DataSource = ownershipType.DefaultView; Route r = new Route(); r.LoadAll(); lkRoute.Properties.DataSource = r.DefaultView; }