/// <summary> /// Formats the cash invoice. /// </summary> /// <param name="ord">The ord.</param> /// <param name="dvPriced">The dv priced.</param> /// <param name="rus">The rus.</param> /// <param name="pl">The pl.</param> /// <param name="deliveryNote">if set to <c>true</c> [delivery note].</param> /// <param name="allowCancelByUser">if set to <c>true</c> [allow cancel by user].</param> /// <exception cref="System.Exception"></exception> private XtraReport FormatCashInvoice_Smaller(Order ord, DataTable dvPriced, BLL.Institution rus, PickList pl, bool deliveryNote, string printerName, HCMIS.Core.Distribution.Services.PrintLogService pLogService) { string activityName = txtConfirmFromStore.Text; bool hasInsurnance = chkIncludeInsurance.Checked; return(WorkflowReportFactory.CreateCashInvoiceSmaller(ord, dvPriced, rus, pl, deliveryNote, hasInsurnance, activityName)); }
private void chkEditInprocess_CheckedChanged(object sender, EventArgs e) { DataRow dr = grdViewClientStatus.GetFocusedDataRow(); int id = Convert.ToInt32(dr["ID"]); BLL.Institution ru = new BLL.Institution(); ru.LoadByPrimaryKey(id); bool PreviousValue; if (!dr.IsNull("InProcess")) PreviousValue = Convert.ToBoolean(dr["InProcess"]); else PreviousValue = false; if (!Convert.ToBoolean(dr["Active"])) { ru.InProcess = PreviousValue; LoadReceivingUnits(); XtraMessageBox.Show(string.Format("The {0} is inactive, you are not allow to change any status", dr["Name"].ToString().ToUpper()), "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (XtraMessageBox.Show(string.Format("Are you sure you want to allow {0} to get service ", dr["Name"].ToString()), "Are you Sure", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes) { ru.InProcess = !PreviousValue; ru.Save(); } else ru.InProcess = PreviousValue; LoadReceivingUnits(); }
private void btnPrint_Click(object sender, EventArgs e) { var dvPickListMakeup = (DataTable)gridTransactions.DataSource; var ord = new BLL.Order(); ord.LoadByPrimaryKey(OrderID); var rus = new Institution(); rus.LoadByPrimaryKey(ord.RequestedBy); if (BLL.Settings.IsCenter) { dvPickListMakeup.Columns["PhysicalStoreTypeName"].ColumnName = "WarehouseName"; dvPickListMakeup.Columns["SKUTOPICK"].ColumnName = "QtyInSKU"; dvPickListMakeup.Columns["StoreGroupName"].ColumnName = "AccountName"; dvPickListMakeup.Columns.Add("ActivityConcat"); foreach (DataRow r in dvPickListMakeup.Rows) { var activity = new Activity(); activity.LoadByPrimaryKey(Convert.ToInt32(r["StoreID"])); r["ActivityConcat"] = activity.FullActivityName; } } var pl = HCMIS.Desktop.Reports.WorkflowReportFactory.CreatePicklistReport(ord, rus.Name, dvPickListMakeup.DefaultView); pl.ShowPreviewDialog(); // refresh the display lstRefNo_FocusedNodeChanged(null, null); }
private void chkEditInprocess_CheckedChanged(object sender, EventArgs e) { DataRow dr = grdViewClientStatus.GetFocusedDataRow(); int id = Convert.ToInt32(dr["ID"]); BLL.Institution ru = new BLL.Institution(); ru.LoadByPrimaryKey(id); bool PreviousValue; if (!dr.IsNull("InProcess")) { PreviousValue = Convert.ToBoolean(dr["InProcess"]); } else { PreviousValue = false; } if (!Convert.ToBoolean(dr["Active"])) { ru.InProcess = PreviousValue; LoadReceivingUnits(); XtraMessageBox.Show(string.Format("The {0} is inactive, you are not allow to change any status", dr["Name"].ToString().ToUpper()), "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (XtraMessageBox.Show(string.Format("Are you sure you want to allow {0} to get service ", dr["Name"].ToString()), "Are you Sure", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes) { ru.InProcess = !PreviousValue; ru.Save(); } else { ru.InProcess = PreviousValue; } LoadReceivingUnits(); }
/// <summary> /// Gets the zone by region and number Receiving Units. /// </summary> /// <param name="regionId">The region id.</param> /// <param name="storeID">The store ID.</param> /// <param name="issuedTo">if set to <c>true</c> [issued to].</param> /// <returns></returns> public static DataTable GetZoneByRegionAndNumberRU(int regionId,int storeID, bool issuedTo) { Zone zones = new Zone(); var query = HCMIS.Repository.Queries.Zone.SelectGetZoneByRegionAndNumberRU(regionId, storeID); Institution institution = new Institution(); zones.LoadFromRawSql(query); return zones.DataTable; }
/// <summary> /// Gets the woreda by zone and number RU. /// </summary> /// <param name="zoneId">The zone id.</param> /// <returns></returns> public static DataTable GetWoredaByZoneAndNumberRU(int zoneId) { Woreda woredas = new Woreda(); string query = HCMIS.Repository.Queries.Woreda.SelectGetWoredaByZoneAndNumberRU(zoneId); Institution institution = new Institution(); woredas.LoadFromRawSql(query); return woredas.DataTable; }
private XtraReport FormatCreditRePrintInvoice(Order ord, DataTable dvPriced, BLL.Institution rus, PickList pl, bool deliveryNote, string printerName, HCMIS.Core.Distribution.Services.PrintLogService pLogService, int?stvLogID) { if (BLL.Settings.UseSmallerCreditPrintout) { return(FormatCreditRePrintInvoice_Smaller(dvPriced, ord, pl, rus, deliveryNote, printerName, pLogService, _stvLogIdChosen)); } return(FormatCreditRePrintInvoice_Larger(dvPriced, ord, pl, rus, deliveryNote, printerName, pLogService, _stvLogIdChosen)); }
/// <summary> /// Formats the cash invoice. /// </summary> /// <param name="ord">The ord.</param> /// <param name="dvPriced">The dv priced.</param> /// <param name="rus">The rus.</param> /// <param name="pl">The pl.</param> /// <param name="deliveryNote">if set to <c>true</c> [delivery note].</param> /// <param name="allowCancelByUser">if set to <c>true</c> [allow cancel by user].</param> /// <exception cref="System.Exception"></exception> private XtraReport FormatCashInvoice(Order ord, DataTable dvPriced, BLL.Institution rus, PickList pl, bool deliveryNote, string printerName, HCMIS.Core.Distribution.Services.PrintLogService pLogService) { if (BLL.Settings.UseSmallerCashPrintout) { return(FormatCashInvoice_Smaller(ord, dvPriced, rus, pl, deliveryNote, printerName, pLogService)); } return(FormatCashInvoice_Larger(ord, dvPriced, rus, pl, deliveryNote, printerName, pLogService)); }
/// <summary> /// Gets the woreda by zone and number RU. /// </summary> /// <param name="zoneId">The zone id.</param> /// <returns></returns> public static DataTable GetWoredaByZoneAndNumberRU(int zoneId) { Woreda woredas = new Woreda(); string query = HCMIS.Repository.Queries.Woreda.SelectGetWoredaByZoneAndNumberRU(zoneId); Institution institution = new Institution(); woredas.LoadFromRawSql(query); return(woredas.DataTable); }
/// <summary> /// Swaps the receiving units. /// </summary> /// <param name="receivingUnitID">The receiving unit ID.</param> /// <param name="receivingUnitIDTarget">The receiving unit ID target.</param> public static void SwapReceivingUnits(int receivingUnitID, int receivingUnitIDTarget) { BLL.Institution ru = new Institution(); var query = HCMIS.Repository.Queries.Institution.UpdateSwapReceivingUnitsOrder(receivingUnitID, receivingUnitIDTarget); ru.LoadFromRawSql(query); ru.FlushData(); query = HCMIS.Repository.Queries.Institution.UpdateSwapReceivingUnitsIssueDoc(receivingUnitID, receivingUnitIDTarget); ru.LoadFromRawSql(query); }
/// <summary> /// Gets the woreda by zone and number RU. /// </summary> /// <param name="zoneId">The zone id.</param> /// <param name="storeID">The store ID.</param> /// <param name="issuedTo">if set to <c>true</c> [issued to].</param> /// <returns></returns> public static DataTable GetWoredaByZoneAndNumberRU(int zoneId,int storeID, bool issuedTo) { Woreda woredas = new Woreda(); if (issuedTo) { string query = HCMIS.Repository.Queries.Woreda.SelectGetWoredaByZoneAndNumberRU(zoneId, storeID); Institution institution = new Institution(); woredas.LoadFromRawSql(query); } return woredas.DataTable; }
/// <summary> /// Loads the receiving unit by filter. /// </summary> /// <param name="woredaID">The woreda ID.</param> /// <param name="zoneID">The zone ID.</param> /// <param name="ruType">Type of the ru.</param> /// <param name="ownershipType">Type of the ownership.</param> /// <param name="activeStatus">The active status.</param> /// <param name="inProcess">The in process.</param> /// <param name="storeID">The store ID.</param> /// <param name="hasBeenIssuedTo">if set to <c>true</c> [has been issued to].</param> /// <returns></returns> public static Institution LoadReceivingUnitByFilter(int woredaID, int zoneID, int ruType, int ownershipType, int activeStatus, Boolean inProcess, int storeID, bool hasBeenIssuedTo) { var query = HCMIS.Repository.Queries.Institution.SelectLoadReceivingUnitByFilterByName(woredaID, zoneID, ruType, ownershipType, activeStatus, hasBeenIssuedTo, inProcess, storeID); BLL.Institution ru = new Institution(); ru.LoadFromRawSql(query); return(ru); }
/// <summary> /// Returns 0 if there is no limit /// </summary> /// <param name="itemID"></param> /// <param name="receivingUnitID"></param> /// <returns></returns> internal long GetMaxIssueQuantity(int itemID, int receivingUnitID) { Institution ru = new Institution(); ru.LoadByPrimaryKey(receivingUnitID); this.FlushData(); this.Where.ItemID.Value = itemID; this.Where.ReceivingUnitTypeID.Value = ru.RUType; this.Query.Load(); if (this.RowCount > 0) return this.MaxIssueQty; return 0; }
/// <summary> /// Gets the woreda by zone and number RU. /// </summary> /// <param name="zoneId">The zone id.</param> /// <param name="storeID">The store ID.</param> /// <param name="issuedTo">if set to <c>true</c> [issued to].</param> /// <returns></returns> public static DataTable GetWoredaByZoneAndNumberRU(int zoneId, int storeID, bool issuedTo) { Woreda woredas = new Woreda(); if (issuedTo) { string query = HCMIS.Repository.Queries.Woreda.SelectGetWoredaByZoneAndNumberRU(zoneId, storeID); Institution institution = new Institution(); woredas.LoadFromRawSql(query); } return(woredas.DataTable); }
/// <summary> /// Returns the product Allow status as an integer /// </summary> /// <param name="productID"></param> /// <param name="receivingUnitID"></param> /// <returns>1=AllowFully, 0=Warning, -1 = Restricted</returns> public int ProductAllowStatus(int productID, int receivingUnitID) { Institution institution = new Institution(); ProductOwnershipType ownershipStatus = new ProductOwnershipType(); ProductReceivingUnitType ruTypeStatus = new ProductReceivingUnitType(); institution.LoadByPrimaryKey(receivingUnitID); ownershipStatus.Where.RUOwnershipTypeID.Value = institution.Ownership; ownershipStatus.Where.ProductID.Value = productID; ownershipStatus.Query.Load(); if (ownershipStatus.RowCount > 0) { if (!ownershipStatus.IsColumnNull("Restriction") && ownershipStatus.Restriction) { return(-1); } else if (!ownershipStatus.IsColumnNull("Warning") && ownershipStatus.Warning) { return(0); } else if (!ownershipStatus.IsColumnNull("AllowFully") && ownershipStatus.AllowFully) { return(1); } } ruTypeStatus.Where.ReceivingUnitTypeID.Value = institution.RUType; ruTypeStatus.Where.ProductID.Value = productID; ruTypeStatus.Query.Load(); if (ruTypeStatus.RowCount > 0) { if (!ruTypeStatus.IsColumnNull("Restriction") && ruTypeStatus.Restriction) { return(-1); } if (!ruTypeStatus.IsColumnNull("Warning") && ruTypeStatus.Warning) { return(0); } if (!ruTypeStatus.IsColumnNull("AllowFully") && ruTypeStatus.AllowFully) { return(1); } } //If it gets here, this means there is no entry in the table about the allow status for this product. Therefore we give full allow status. return(1); }
protected override ICollection <Domain.Client> GetData() { ICollection <Domain.Client> clients = new Collection <Domain.Client>(); var dbClients = new BLL.Institution(); dbClients.LoadAll(); while (!dbClients.EOF) { clients.Add(new Domain.Client { ClientID = dbClients.ID, ClientName = dbClients.Name, Woreda = dbClients.WoredaName, Zone = dbClients.ZoneName, Region = dbClients.RegionName, InstitutionType = dbClients.InstitutionTypeName }); dbClients.MoveNext(); } return(clients); }
/// <summary> /// Returns 0 if there is no limit /// </summary> /// <param name="itemID"></param> /// <param name="receivingUnitID"></param> /// <returns></returns> internal long GetMaxIssueQuantity(int itemID, int receivingUnitID) { Institution ru = new Institution(); ru.LoadByPrimaryKey(receivingUnitID); this.FlushData(); this.Where.ItemID.Value = itemID; this.Where.ReceivingUnitTypeID.Value = ru.RUType; this.Query.Load(); if (this.RowCount > 0) { return(this.MaxIssueQty); } return(0); }
public static bool ValidateNewAddition(string facilityName, int woredaID) { BLL.Institution institution = new Institution(); var query = HCMIS.Repository.Queries.Institution.SelectValidateNewAddition(facilityName, woredaID); institution.LoadFromRawSql(query); if (institution.RowCount > 0) //If it already exists, then it's not valid. { return(false); } else { return(true); } }
private void btnAddReceivingUnit_Click(object sender, EventArgs e) { int ActiveStatus; int regionId = Convert.ToInt32(lkRegion.EditValue); int woredaID = Convert.ToInt32(lkWoreda.EditValue); int zoneID = Convert.ToInt32(lkZone.EditValue); int ruType = Convert.ToInt32(lkType.EditValue); int ownershipType = Convert.ToInt32(lkOwnership.EditValue); if (lkActive.Text.ToString().Equals("Active")) ActiveStatus = 1; else if (lkActive.Text.ToString().Equals("InActive")) ActiveStatus = 0; else ActiveStatus = -1; // ReceivingUnitsForm con = new ReceivingUnitsForm(regionId, woredaID, zoneID, ruType, ownershipType, ActiveStatus); // con.ShowDialog(); Institution recUnit = new Institution(); recUnit.LoadAll(); LoadReceivingUnits(); }
/// <summary> /// Returns the product Allow status as an integer /// </summary> /// <param name="productID"></param> /// <param name="receivingUnitID"></param> /// <returns>1=AllowFully, 0=Warning, -1 = Restricted</returns> public int ProductAllowStatus(int productID, int receivingUnitID) { Institution institution = new Institution(); ProductOwnershipType ownershipStatus = new ProductOwnershipType(); ProductReceivingUnitType ruTypeStatus = new ProductReceivingUnitType(); institution.LoadByPrimaryKey(receivingUnitID); ownershipStatus.Where.RUOwnershipTypeID.Value = institution.Ownership; ownershipStatus.Where.ProductID.Value = productID; ownershipStatus.Query.Load(); if (ownershipStatus.RowCount > 0) { if (!ownershipStatus.IsColumnNull("Restriction") && ownershipStatus.Restriction) return -1; else if (!ownershipStatus.IsColumnNull("Warning") && ownershipStatus.Warning) return 0; else if (!ownershipStatus.IsColumnNull("AllowFully") && ownershipStatus.AllowFully) return 1; } ruTypeStatus.Where.ReceivingUnitTypeID.Value = institution.RUType; ruTypeStatus.Where.ProductID.Value = productID; ruTypeStatus.Query.Load(); if (ruTypeStatus.RowCount > 0) { if (!ruTypeStatus.IsColumnNull("Restriction") && ruTypeStatus.Restriction) return -1; if (!ruTypeStatus.IsColumnNull("Warning") && ruTypeStatus.Warning) return 0; if (!ruTypeStatus.IsColumnNull("AllowFully") && ruTypeStatus.AllowFully) return 1; } //If it gets here, this means there is no entry in the table about the allow status for this product. Therefore we give full allow status. return 1; }
private void gridItemsView_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { DataRow dr = gridItemsView.GetFocusedDataRow(); lblIssueType.Text = dr["OrderType"]!=DBNull.Value ? (string) dr["OrderType"] : "-"; if ((dr["ReceivingUnitID"]) != DBNull.Value) { var ins = new Institution(); ins.LoadByPrimaryKey(Convert.ToInt32(dr["ReceivingUnitID"])); lblRegion.Text = ins.RegionName ?? "-"; lblWoreda.Text = ins.WoredaName ?? "-"; lblZone.Text = ins.ZoneName ?? "-"; var own = new OwnershipType(); own.LoadByPrimaryKey(ins.Ownership); lblOwnership.Text = own.Name ?? "-"; var iss = new Issue(); iss.LoadByPrimaryKey(Convert.ToInt32(dr["STVID"])); if (!iss.IsColumnNull("PaymentTypeID")) { var pType = new PaymentType(); pType.LoadByPrimaryKey(iss.PaymentTypeID); lblPaymentType.Text = pType.Name; } lblPaymentType.Text = "-"; if (!iss.IsColumnNull("VoidRequestDateTime")) lblVoidRequestedDate.Text = iss.VoidRequestDateTime.ToShortDateString(); else { lblVoidRequestedDate.Text = "-"; } if(!iss.IsColumnNull("VoidApprovalDateTime")) lblVoidConfirmedDate.Text= iss.VoidApprovalDateTime.ToShortDateString(); else { lblVoidConfirmedDate.Text = "-"; } var user = new User(); if (!iss.IsColumnNull("VoidRequestUserID")) { user.LoadByPrimaryKey(iss.VoidRequestUserID); lblVoidRequestedBy.Text = user.FullName; } else lblVoidRequestedBy.Text = "-"; if (!iss.IsColumnNull("VoidApprovedByUserID")) { user.LoadByPrimaryKey(iss.VoidApprovedByUserID); lblVoidConfirmedBy.Text = user.FullName; } else lblVoidConfirmedBy.Text = "-"; lblInstitutionType.Text = ins.InstitutionTypeName; if (!iss.IsColumnNull("DocumentTypeID")) { lblDocumentType.Text = DocumentType.GetDocumentType(iss.DocumentTypeID).Name; } else lblDocumentType.Text = ""; } else { lblRegion.Text = lblWoreda.Text = lblZone.Text = "-"; } lblPrintedDate.Text = string.IsNullOrEmpty((Convert.ToDateTime(dr["PrintedDate"].ToString())).ToShortDateString()) ? "-" : (Convert.ToDateTime(dr["PrintedDate"].ToString())).ToShortDateString(); lblAccount.Text = string.IsNullOrEmpty(dr["AccountName"].ToString()) ? "-" : dr["AccountName"].ToString(); lblSubAccount.Text = string.IsNullOrEmpty(dr["SubAccountName"].ToString()) ? "-" : dr["SubAccountName"].ToString(); lblActivity.Text = string.IsNullOrEmpty(dr["ActivityName"].ToString()) ? "-" : dr["ActivityName"].ToString(); lblPrintedBy.Text = string.IsNullOrEmpty(dr["IssuedBy"].ToString()) ? "-" : dr["IssuedBy"].ToString(); lblIssueStatus.Text = string.IsNullOrEmpty(dr["Status"].ToString()) ? "-" : dr["Status"].ToString(); int accountid = Convert.ToInt32(dr["AccountID"]); Account account = new Account(); account.LoadByPrimaryKey(accountid); Mode mode = new Mode(); mode.LoadByPrimaryKey(account.ModeID); lblMode.Text = mode.TypeName; }
private void PrintReceiptConfirmation(string referenceNumber, int? reprintOfReceiptConfirmationPrintoutID) { var rc = new ReceiptConfirmationPrintout(); var srmPrintout = new HCMIS.Desktop.Reports.SRMPrintout(CurrentContext.LoggedInUserName); int ReceiptID = Convert.ToInt32(gridReceiveView.GetFocusedDataRow()["ReceiptID"]); var receiveDoc = new ReceiveDoc(); receiveDoc.LoadByReceiptID(ReceiptID); ReceiptConfirmationPrintout.GetGRNFNo(ReceiptID); srmPrintout.BranchName.Text = GeneralInfo.Current.HospitalName; rc.PrepareDataForPrintout(ReceiptID, CurrentContext.UserId, false, 3, null, reprintOfReceiptConfirmationPrintoutID,FiscalYear.Current); srmPrintout.DataSource = rc.DefaultView.ToTable(); var rUnit = new Institution(); var idoc = new IssueDoc(); if (!receiveDoc.IsColumnNull("ReturnedFromIssueDocID")) { idoc.LoadByPrimaryKey(receiveDoc.ReturnedFromIssueDocID); rUnit.LoadByPrimaryKey(idoc.ReceivingUnitID); } else { var po = new PO(); po.LoadByReceiptID(receiveDoc.ReceiptID); rUnit.LoadByPrimaryKey(int.Parse(po.RefNo)); } srmPrintout.xrFromValue.Text = rUnit.Name; srmPrintout.xrWoredaValue.Text = rUnit.WoredaText; srmPrintout.xrRegionValue.Text = rUnit.Region; srmPrintout.xrZoneValue.Text = rUnit.ZoneText; if (!receiveDoc.IsColumnNull("ReturnedFromIssueDocID")) { var stvLog = new BLL.Issue(); stvLog.LoadByPrimaryKey(idoc.STVID); srmPrintout.xrIssueDateValue.Text = idoc.Date.ToString("M/d/yyyy"); var activity = new Activity(); activity.LoadByPrimaryKey(idoc.StoreId); srmPrintout.xrAccountName.Text = activity.FullActivityName; var rct = new BLL.Receipt(); rct.LoadByPrimaryKey(ReceiptID); var rctInvoice = new ReceiptInvoice(); rctInvoice.LoadByPrimaryKey(rct.ReceiptInvoiceID); srmPrintout.xrSTVNoValue.Text = rctInvoice.STVOrInvoiceNo; } else { var activity = new Activity(); activity.LoadByPrimaryKey(receiveDoc.StoreID); srmPrintout.xrAccountName.Text = activity.FullActivityName; srmPrintout.xrSTVNoValue.Text = receiveDoc.RefNo; } var dtDate = new DateTimePickerEx(); dtDate.Value = receiveDoc.EurDate; srmPrintout.Date.Text = dtDate.Text; if (srmPrintout.PrintDialog() != DialogResult.OK) { throw new Exception("Print cancelled by user!"); } //Successfully printed //Release Product var GRV = new CostCalculator(); GRV.LoadGRV(ReceiptID); GRV.ReleaseForIssue(); String reference = gridReceiveView.GetFocusedDataRow()["RefNo"].ToString(); var recDoc = new ReceiveDoc(); recDoc.LoadByReferenceNo(reference); recDoc.ConfirmGRVPrinted(CurrentContext.UserId); BLL.Receipt receiptStatus = new BLL.Receipt(); receiptStatus.LoadByPrimaryKey(ReceiptID); receiptStatus.ChangeStatus(ReceiptConfirmationStatus.Constants.GRV_PRINTED, null, this.GetFormIdentifier(), CurrentContext.UserId, "GRV Printed"); BindFormContents(); }
/// <summary> /// The code supports manufacturer preference here too but we choose not to prefer manufacturers when looking into the stores. /// </summary> /// <param name="userID"></param> /// <param name="orderDetailID"></param> /// <param name="pricedUnpricedBoth"></param> /// <param name="bal"> </param> /// <param name="markStockoutBit"> </param> /// <param name="usableStock"> </param> /// <param name="approved"> </param> public decimal LoadOptionsForOrderDetail(int userID, int orderDetailID, PriceSettings pricedUnpricedBoth, Balance bal, bool markStockoutBit, out decimal usableStock, out decimal approved) { decimal avQuantity = 0; BLL.OrderDetail orderDetail = new OrderDetail(); orderDetail.LoadByPrimaryKey(orderDetailID); BLL.Order order = new Order(); order.LoadByPrimaryKey(orderDetail.OrderID); Institution ru = new Institution(); ru.LoadByPrimaryKey(order.RequestedBy); int month = EthiopianDate.EthiopianDate.Now.Month; int year = EthiopianDate.EthiopianDate.Now.Year; decimal availableQty = 0; usableStock = 0; approved = 0; int? manufacturerPrefrence = null, unitID = null; if (!orderDetail.IsColumnNull("PreferredManufacturerID")) { manufacturerPrefrence = orderDetail.PreferredManufacturerID; } DateTime? expPreferrence = null; if(!orderDetail.IsColumnNull("PreferredExpiryDate")) { expPreferrence = orderDetail.PreferredExpiryDate; } int? preferredPhysicalStoreID = null; if (!orderDetail.IsColumnNull("PreferredPhysicalStoreID")) { preferredPhysicalStoreID = orderDetail.PreferredPhysicalStoreID; } //-------------------------------------------------------------------------- //manufacturerPrefrence = null; //We are overriding the manufacturer preference. //expPreferrence = null; //-------------------------------------------------------------------------- if (!orderDetail.IsColumnNull("UnitID")) { unitID = orderDetail.UnitID; } BLL.UserActivity userStore = new UserActivity(); // Definitely a danger zone userStore.LoadByUserIDAndStoreType(userID, order.FromStore, orderDetail.ItemID, unitID.Value); while (!userStore.EOF) { var activity = new Activity(); activity.LoadByPrimaryKey(userStore.ActivityID); if(order.FromStore == Mode.Constants.RDF && !BLL.Settings.IsCenter && !BLL.Settings.PrivateCanGetFromMDGAndPBS && ru.Ownership == OwnershipType.Constants.Private && activity.IsSubsidized ){ userStore.MoveNext(); continue; } // Load the Activity Selection that has PRiced Commodities. Balance balance = new Balance(); if (pricedUnpricedBoth == PriceSettings.PRICED_ONLY || pricedUnpricedBoth == PriceSettings.BOTH) { BLL.Order.MakeStockCalculations(userID, month, year, PriceSettings.PRICED_ONLY, orderDetail, userStore.ActivityID, orderDetail.ItemID, order, balance, unitID, manufacturerPrefrence, expPreferrence, preferredPhysicalStoreID, out usableStock, out approved, out availableQty, markStockoutBit); avQuantity += availableQty; if (availableQty > 0) { this.AddNew(); this.ID = userStore.ActivityID; this.Name = string.Format("{0} ({1})", activity.FullActivityName, availableQty.ToString("#,##0")); PrepareColumnsForApproval(); this.SetColumn("AvailableSKU", availableQty); this.SetColumn("IsDeliveryNote", false); this.SetColumn("TextID",string.Format("N{0}",this.ID)); } } // Load Activity Selections for Delivery Note Items. if (pricedUnpricedBoth == PriceSettings.DELIVERY_NOTE_ONLY || pricedUnpricedBoth == PriceSettings.BOTH) { BLL.Order.MakeStockCalculations(userID, month, year, PriceSettings.DELIVERY_NOTE_ONLY, orderDetail, userStore.ActivityID, orderDetail.ItemID, order, balance, unitID, manufacturerPrefrence, expPreferrence, preferredPhysicalStoreID, out usableStock, out approved, out availableQty, markStockoutBit); avQuantity += availableQty; if (availableQty > 0) { this.AddNew(); this.ID = userStore.ActivityID; //Just to give it a different ID so we know there is a change only. this.Name = string.Format("+-- {0} - Delivery Notes - ({1})", userStore.GetColumn("ActivityName"), availableQty.ToString("#,##0")); PrepareColumnsForApproval(); this.SetColumn("AvailableSKU", availableQty); this.SetColumn("IsDeliveryNote", true); this.SetColumn("TextID", string.Format("D{0}", this.ID)); } } userStore.MoveNext(); } return avQuantity; }
private XtraReport FormatCreditRePrintInvoice_Smaller(DataTable dvPriced, Order ord, PickList pl, Institution rus, bool deliveryNote, string printerName, HCMIS.Core.Distribution.Services.PrintLogService pLogService, int? stvLogID) { string activityName = ""; bool hasInsurnance = includeInsurance; return WorkflowReportFactory.CreateCreditRePrintInvoiceSmaller(dvPriced, ord, pl, rus, deliveryNote, hasInsurnance, activityName, _stvLogIdChosen); }
/// <summary> /// Handles the FocusedRowChanged event of the gridViewReferences control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs" /> instance containing the event data.</param> private void gridViewReferences_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { if (e != null && e.PrevFocusedRowHandle < -1) return; dtDate.Value = DateTimeHelper.ServerDateTime; _reprintId = null; DataRow dr = gridViewReferences.GetFocusedDataRow(); if (dr == null) { return; } string[] referenceNo = new string[2]; referenceNo[0] = dr["RefNo"].ToString(); if (Convert.ToBoolean(dr["isConvertedDN"])) { _isConvertedDn = true; _stvLogIdChosen = (int?)dr["IsReprintOf"]; } else if (dr != null && dr["ID"] != DBNull.Value) { _isConvertedDn = false; _stvLogIdChosen = (int?)dr["ID"]; } UpdateReprintedNumbers(dr); // Enable and disable STV reprint // STV SHouldn't be reprinted off a reprint. if (dr["IsReprintOf"] != DBNull.Value && !Convert.ToBoolean(dr["isConvertedDN"])) { btnExport.Enabled = btnReprint.Enabled = false; var permission = (BLL.Settings.UseNewUserManagement) ? this.HasPermission("Print") : true; btnPrint.Enabled = permission; _reprintId = _stvLogIdChosen; _stvLogIdChosen = Convert.ToInt32(dr["IsReprintOf"]); } else if (dr["IsDeliveryNote"] != DBNull.Value && Convert.ToBoolean(dr["IsDeliveryNote"])) { btnExport.Enabled = false; btnReprint.Enabled = (BLL.Settings.UseNewUserManagement) ? this.HasPermission("Re-Print") : true; btnPrint.Enabled = false; } else { btnPrint.Enabled = this.HasPermission("Print"); btnReprint.Enabled = this.HasPermission("Re-Print"); btnExport.Enabled = this.HasPermission("Export"); } if (_stvLogIdChosen != null) { Issue log = new Issue(); log.LoadByPrimaryKey(_stvLogIdChosen.Value); Institution rus = new Institution(); IssueDoc iss = new IssueDoc(); if (!log.IsColumnNull("ReceivingUnitID")) { rus.LoadByPrimaryKey(log.ReceivingUnitID); //FacilityName.Text = rus.Name; HeaderSection.Text = rus.Name; var activity = new Activity(); activity.LoadByPrimaryKey(log.StoreID); lblActivity.Text = activity.Name; lblSubAccount.Text = activity.SubAccountName; lblMode.Text = activity.ModeName; lblAccount.Text = activity.AccountName; lblRegion.Text = rus.RegionName; lblWoreda.Text = rus.WoredaName; lblZone.Text = rus.ZoneName; lblInstType.Text = rus.InstitutionTypeName; var ownership = new OwnershipType(); ownership.LoadByPrimaryKey(rus.Ownership); lblOwnership.Text = ownership.Name; lblVoidConDate.Text = (dr["approvalDate"]) != DBNull.Value ? Convert.ToDateTime(dr["approvalDate"]).ToShortDateString(): "-"; lblIssueType.Text = (string)dr["OrderType"]; User user = new User(); if (dr["approvedBy"] != DBNull.Value) { user.LoadByPrimaryKey(Convert.ToInt32(dr["approvedBy"])); lblConfirmedBy.Text = user.FullName; } else { lblConfirmedBy.Text = "-"; } var doc = new DocumentType(); doc.LoadByPrimaryKey(log.DocumentTypeID); lblDocType.Text = doc.Name; lblPrintedDate.Text = log.PrintedDate.ToShortDateString(); var pt = new PaymentType(); if (!rus.IsColumnNull("PaymentTypeID")) { pt.LoadByPrimaryKey(rus.PaymentTypeID); lblPaymentType.Text = pt.Name; } else { lblPaymentType.Text = "-"; } // Show user name user.LoadByPrimaryKey(log.UserID); lblPrintedBy.Text = (user.FullName == "") ? user.UserName : user.FullName; // show contact person PickList pl = new PickList(); pl.LoadByPrimaryKey(log.PickListID); Order order = new Order(); order.LoadByPrimaryKey(pl.OrderID); var os = new OrderStatus(); os.LoadByPrimaryKey(order.OrderStatusID); lblIssueStatus.Text = os.OrderStatus; if (!order.IsColumnNull("ContactPerson")) { lblRecivedBy.Text = order.ContactPerson; } else { lblRecivedBy.Text = @"-"; } lblReceivedDate.Text = order.EurDate.ToShortDateString(); } dtDate.Value = log.PrintedDate; //PrintedDate.Text = dtDate.Text; lblPrintedDate.Text = dtDate.Text; gridTransactions.DataSource = iss.GetIssueBySTV(_stvLogIdChosen.Value); layoutUnconfirmedSTVs.Visibility = LayoutVisibility.Never; if (BLL.Settings.ShowMissingSTVsOnIssueLog) { DataView view = iss.GetPossibleUnconfirmedIssues(_stvLogIdChosen.Value); if (view.Count > 0) { gridUnconfirmed.DataSource = view; layoutUnconfirmedSTVs.Visibility = LayoutVisibility.Always; } else { layoutUnconfirmedSTVs.Visibility = LayoutVisibility.Never; } } } }
private void LoadReceivingUnits() { Institution rUnit = new Institution(); rUnit.LoadAll(); lkForHub.Properties.DataSource = rUnit.DefaultView; }
private static string GetReceivingUnitName(Order order) { if (!order.IsColumnNull("RequestedBy")) { var rus = new Institution(); rus.LoadByPrimaryKey(order.RequestedBy); return rus.Name; } if (!order.IsColumnNull("OrderTypeID") && order.OrderTypeID == OrderType.CONSTANTS.ACCOUNT_TO_ACCOUNT_TRANSFER) { var transfer = new Transfer(); transfer.LoadByOrderID(order.ID); var activity = new Activity(); activity.LoadByPrimaryKey(transfer.ToStoreID); return activity.FullActivityName; } return ""; }
public void getFacilityInfo() { string region, woreda, zone; if (!IsColumnNull("RequestedBy")) { var rus = new Institution(); rus.LoadByPrimaryKey(RequestedBy); region = rus.RegionName; woreda = rus.WoredaName; zone = rus.ZoneName; } }
private void lkForFacility_EditValueChanged(object sender, EventArgs e) { if (lkForFacility.EditValue == null) return; FacilityChanged(lkForFacility); Institution ru = new Institution(); ru.LoadByPrimaryKey(Convert.ToInt32(lkForFacility.EditValue)); if (!ru.IsColumnNull("Woreda")) { BLL.Woreda woreda = new BLL.Woreda(); woreda.LoadByPrimaryKey(ru.Woreda); BLL.Zone zone = new BLL.Zone(); zone.LoadByPrimaryKey(woreda.ZoneID); lkRegion.EditValue = zone.RegionId; lkZone.EditValue = zone.ID; lkWoreda.EditValue = ru.Woreda; } lkOwnership.EditValue = ru.Ownership; lkType.EditValue = ru.RUType; //Fill facility visit history DataRow facilityHis = BLL.Issue.GetVisitHistoryForFacility((int)lkForFacility.EditValue); NoOfVisitLabel.Text = facilityHis != null ? Convert.ToInt32(facilityHis["VisitCount"]).ToString(CultureInfo.InvariantCulture) : "0"; LastVisitlabel.Text = facilityHis != null ? Convert.ToDateTime(facilityHis["LastVisit"]).TimeAgo() : "Never"; //Reset Requisitoin Type if(!BLL.Settings.IsCenter && OrderID == null && Type == RequisitionType.History) lkRequisitionType_EditValueChanged(null, null); }
public void EditRequisition(int orderID) { OrderID = orderID; Order ord = new Order(); ord.LoadByPrimaryKey(orderID); txtRefNo.Text = ord.RefNo; txtLetterNumber.Text = ord.LetterNo; labelControl4.Text = ord.RefNo; Institution ru = new Institution(); ru.LoadByPrimaryKey(ord.RequestedBy); if (!ru.IsColumnNull("Zone")) { // Just because the region Property on the Receiving Unit is not working as desired. Zone zone = new Zone(); zone.LoadByPrimaryKey(ru.Zone); lkRegion.EditValue = zone.RegionId; lkZone.EditValue = ru.Zone; } lkForFacility.EditValue = ru.ID; lkModes.EditValue = ord.FromStore; lkModes_EditValueChanged(null, null); lkPaymentType.EditValue = ord.PaymentTypeID; txtContactPerson.EditValue = ord.ContactPerson; BLL.OrderDetail or = new BLL.OrderDetail(); or.LoadAllByOrderID(orderID); DataView selectables = (DataView)gridItemChoiceView.DataSource; if (_dtSelectedTable != null) { _dtSelectedTable.Clear(); } else { PopulateItemsList(); } while (!or.EOF) { // select the items and put it in the dtselected table. if (selectables != null) { DataRow[] dataRows = selectables.Table.Select(String.Format("ID = {0} and UnitID = {1}", or.ItemID, or.UnitID)); if (dataRows.Length > 0) { _dtSelectedTable.ImportRow(dataRows[0]); dataRows[0]["IsSelected"] = true; } } or.MoveNext(); } _dvOrderTable = or.DefaultView; orderGrid.DataSource = _dvOrderTable; EnableDisableButtons(); }
/// <summary> /// Called when [outstanding picklist selected]. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="DevExpress.XtraGrid.Views.Grid.RowClickEventArgs" /> instance containing the event data.</param> private void OnOutstandingPicklistSelected(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e) { var dr = gridOutstandingPickListView.GetFocusedDataRow(); _orderID = Convert.ToInt32(dr["ID"]); var order = new BLL.Order(); order.LoadByPrimaryKey(_orderID); // load payment type options int? requestedBy = null; var usr = new User(); lblIssueStatus.Text = (string)dr["OrderStatus"]; lblIssueTypes.Text = (string) dr["Description"]; if (!order.IsColumnNull("RequestedBy")) { var ins = new Institution(); requestedBy = order.RequestedBy; lkPaymentType.Properties.DataSource = PaymentType.GetAllowedTypes(order.FromStore, requestedBy); ins.LoadByPrimaryKey(order.RequestedBy); try { lblWoreda.Text = ins.WoredaName ?? "-"; lblRegion.Text = ins.RegionName ?? "-"; lblZone.Text = ins.ZoneName ?? "-"; lblInstitutionType.Text = ins.InstitutionTypeName ?? "-"; var ownership = new BLL.OwnershipType(); if (!ins.IsColumnNull("Ownership")) { ownership.LoadByPrimaryKey(ins.Ownership); lblOwnership.Text = ownership.Name; } } catch (NullReferenceException ex) { //when transfer, institution has no woreda, zone or region, ignore the error } } else lblWoreda.Text = lblRegion.Text = lblZone.Text = lblInstitutionType.Text = lblOwnership.Text = "NA"; //usr.LoadByPrimaryKey(NewMainWindow.UserId); usr = CurrentContext.LoggedInUser; txtIssuedBy.Text = usr.FullName ?? "-"; PickList pl = new PickList(); _dvOutstandingPickList = pl.GetPickListDetailsForOrder(_orderID, CurrentContext.LoggedInUserName); gridOutstandingPicklistDetail.DataSource = _dvOutstandingPickList; if (order.FromStore != Mode.Constants.HEALTH_PROGRAM) { colSKUPicked.Visible = false; } else { colSKUPicked.Visible = true; } txtConfirmFromStore.Text = order.GetFromStore(); txtConfirmRequestedBy.Text = order.GetRequestedBy(); int length = order.GetRequestedBy().Length; string s = ""; HeaderSection.Text = order.GetRequestedBy() + s.PadRight(150-length)+"Order Number: " + order.RefNo; txtConfirmOrderNumber.Text = order.RefNo; //txtConfirmApprovedBy.Text = order.GetApprovedBy() ?? "-"; lblApprovedBy.Text = order.GetApprovedBy() ?? "-"; lkPaymentType.EditValue = order.PaymentTypeID; // Temporarily copy the STV txtIssueRefNo.Text = order.RefNo; //""; lblRefNo.Text = order.RefNo ?? "-"; var paymentType = new BLL.PaymentType(); paymentType.LoadByPrimaryKey(order.PaymentTypeID); lblPaymentType.Text = paymentType.Name ?? "-"; lblMode.Text = order.GetFromStore() ?? "-"; lblissuedDate.Text = order.Date.ToShortDateString(); lblIssuedBy.Text = order.GetFilledBy(); lblPicklistPrintedDate.Text = pl.PickedDate.ToShortDateString()!="" ? pl.PickedDate.ToShortDateString() : "-"; var us = new User(); pl.LoadByOrderID(_orderID); if (!pl.IsColumnNull("PickedBy")) { us.LoadByPrimaryKey(pl.PickedBy); lblPicklistConfirmedBy.Text = us.FullName; } else lblPicklistConfirmedBy.Text = "-"; }
public static int SavePLITSApprovedOrderToDatabase(int Status, int userID, int? plitsOrderID, int facilityID, int paymentType, int modeID, string remarks, string letterNumber, string contactPerson, BLL.OrderDetail _PLITSOrderDetail) { int hcmisorderid; MyGeneration.dOOdads.TransactionMgr mgr = MyGeneration.dOOdads.TransactionMgr.ThreadTransactionMgr(); try { mgr.BeginTransaction(); BLL.Order or = new BLL.Order(); or.AddNew(); or.RefNo = Order.GetNextOrderReference(); or.OrderTypeID = OrderType.CONSTANTS.PLITS; or.HCTSReferenceID = plitsOrderID.Value; or.OrderStatusID = Status; or.RequisitionTypeID = RequisitionType.CONSTANTS.DEMAND; or.Remark = remarks; or.EurDate = or.Date = DateTimeHelper.ServerDateTime; //Both fields are assigned dates. var institution = new Institution(); institution.LoadBySN(facilityID); or.RequestedBy = institution.ID; or.FilledBy = userID; or.LetterNo = letterNumber; or.PaymentTypeID = paymentType; or.ContactPerson = contactPerson; or.FromStore = modeID; or.FiscalYearID = FiscalYear.Current.ID; or.Save(); or.LogRequisitionStatus(or.ID,null,Status, CurrentContext.UserId); //Log OrderStatus change _PLITSOrderDetail.Rewind(); while (!_PLITSOrderDetail.EOF) { _PLITSOrderDetail.OrderID = or.ID; _PLITSOrderDetail.MoveNext(); } _PLITSOrderDetail.Save(); hcmisorderid = or.ID; //this.LogActivity("Save-Requisition", ord.ID); mgr.CommitTransaction(); } catch (Exception exp) { mgr.RollbackTransaction(); return 0; throw (exp); } //ResetOrder(); return hcmisorderid; }
private void FacilityChanged(GridLookUpEdit lkRecUnit) { if (lkRecUnit.EditValue != null) { int facilityID = Convert.ToInt32(lkRecUnit.EditValue); Institution institution = new Institution(); institution.LoadByPrimaryKey(facilityID); string facilityPaymentType = ""; if (!institution.IsColumnNull("PaymentTypeID")) facilityPaymentType = PaymentType.GetPaymentTypeString(institution.PaymentTypeID); txtVatRegistration.Text = (!institution.IsColumnNull("VATNo")) ? institution.VATNo : ""; labelControl2.Text = (!institution.IsColumnNull("VATNo")) ? institution.VATNo : ""; txtTin.Text = (!institution.IsColumnNull("TinNo")) ? institution.TinNo : ""; labelControl1.Text = (!institution.IsColumnNull("TinNo")) ? institution.TinNo : ""; txtRegistrationNo.Text = (!institution.IsColumnNull("LicenseNo")) ? institution.LicenseNo : ""; labelControl3.Text = (!institution.IsColumnNull("LicenseNo")) ? institution.LicenseNo : ""; } }
private XtraReport FormatCashRePrintInvoice_Larger(Order ord, DataTable dvPriced, BLL.Institution rus, PickList pl, bool deliveryNote, string printerName, HCMIS.Core.Distribution.Services.PrintLogService pLogService, int?stvLogID) { string activityName = ""; bool hasInsurnance = includeInsurance; return(WorkflowReportFactory.CreateCashRePrintInvoiceLarger(ord, dvPriced, rus, pl, deliveryNote, hasInsurnance, activityName, true, _stvLogIdChosen)); }
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(); }
/// <summary> /// Re print STV. /// </summary> /// <param name="dv">The dv.</param> /// <param name="orderId">The order id.</param> /// <param name="pl">The pl.</param> /// <param name="stvLogID">The STV log ID.</param> /// <param name="isConversion">if set to <c>true</c> [is conversion].</param> /// <param name="generateNewPrintID">if set to <c>true</c> [generate new print ID].</param> //public XtraReport RePrintSTV(DataView dv,int orderId, PickList pl,int? stvLogID, bool isConversion, bool generateNewPrintID = true) //{ // var includeInsurance =XtraMessageBox.Show("Include insurance?", "Insurance",MessageBoxButtons.YesNo,MessageBoxIcon.Question)== DialogResult.Yes; // var ord = new Order(); // ord.LoadByPrimaryKey(orderId); // var order = new Order(); // order.LoadByPrimaryKey(orderId); // if (!order.IsPaymentTypeValid()) // { // //TODO: This needs to be handled well. // throw new Exception( // string.Format("PaymentTypeID has a problem. The order has a payment type id of {0}", // ord.PaymentTypeID)); // } // var stores = new Activity(); // stores.LoadByPrimaryKey(order.FromStore); // var textDeliveryNote = ""; // var sendToString = GetReceivingUnitName(order); // if (stvLogID != null) // { // var stvLog = new Issue(); // stvLog.LoadByPrimaryKey(stvLogID.Value); // if (!stvLog.IsColumnNull("IsDeliveryNote") && stvLog.IsDeliveryNote && isConversion) // { // textDeliveryNote = stvLog.IDPrinted.ToString("00000"); // } // } // if (PaymentType.Constants.CASH == ord.PaymentTypeID) // { // var rus = new Institution(); // rus.LoadByPrimaryKey(order.RequestedBy); // var stvReport = new HCMIS.Desktop.Reports.CashInvoice(CurrentContext.LoggedInUserName); // pl.LoadByOrderID(orderId); // PrepareTheReport(stvReport); // stvReport.DeliveryNoteNo.Text = textDeliveryNote; // stvReport.DataSource = Order.ReorganizeDataViewForSTVPrint_Program(dv, ord.ID, pl.ID, CurrentContext.UserId, stvLogID, isConversion, generateNewPrintID, includeInsurance); // stvReport.From.Text = GeneralInfo.Current.HospitalName; // stvReport.To.Text = sendToString; // stvReport.TIN.Text = rus.TinNo; // stvReport.VAT.Text = rus.VATNo; // stvReport.Town.Text = rus.Town; // stvReport.Woreda.Text = rus.WoredaText; // stvReport.Zone.Text = rus.ZoneText; // stvReport.Region.Text = rus.Region; // stvReport.License.Text = (!rus.IsColumnNull("Ownership") && rus.IsPrivatelyOwned) ? rus.LicenseNo : (!ord.IsColumnNull("LetterNo")) ? ord.LetterNo : ""; // //stvReport.Program.Text = stores.StoreName; // DateTimePickerEx dtDate = new DateTimePickerEx(); // dtDate.Value = DateTimeHelper.ServerDateTime; // stvReport.Date.Text = dtDate.Text; // return stvReport; // } // else if (PaymentType.Constants.CREDIT == ord.PaymentTypeID) // { // var rus = new Institution(); // rus.LoadByPrimaryKey(order.RequestedBy); // HCMIS.Desktop.Reports.CreditInvoice stvReport = // new HCMIS.Desktop.Reports.CreditInvoice(CurrentContext.LoggedInUserName); // pl.LoadByOrderID(orderId); // PrepareTheReport(stvReport); // stvReport.DeliveryNoteNo.Text = textDeliveryNote; // stvReport.DataSource = Order.ReorganizeDataViewForSTVPrint_Program(dv, ord.ID, pl.ID, // CurrentContext.UserId, stvLogID, isConversion, generateNewPrintID, includeInsurance); // stvReport.From.Text = GeneralInfo.Current.HospitalName; // stvReport.To.Text = sendToString; // //stvReport.Region.Text = rus.Woreda; // stvReport.Zone.Text = rus.Town; // stvReport.Letter.Text = ord.LetterNo; // //stvReport.Program.Text = stores.StoreName; // DateTimePickerEx dtDate = new DateTimePickerEx(); // dtDate.Value = DateTimeHelper.ServerDateTime; // stvReport.Date.Text = dtDate.Text; // } //} /// <summary> /// Re print STV. /// </summary> /// <param name="dv">The dv.</param> /// <param name="orderId">The order id.</param> /// <param name="pl">The pl.</param> /// <param name="stvLogID">The STV log ID.</param> /// <param name="isConversion">if set to <c>true</c> [is conversion].</param> /// <param name="generateNewPrintID">if set to <c>true</c> [generate new print ID].</param> public XtraReport RePrintSTV(DataView dv, int orderId, PickList pl, int? stvLogID, bool isConversion, bool generateNewPrintID = true) { HCMIS.Core.Distribution.Services.PrintLogService pLogService = new HCMIS.Core.Distribution.Services.PrintLogService(); pLogService.StartPrintingSession(); includeInsurance = XtraMessageBox.Show("Include insurance?", "Insurance", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes; var ord = new Order(); ord.LoadByPrimaryKey(orderId); //loading two times var order = new Order(); order.LoadByPrimaryKey(orderId); if (!order.IsPaymentTypeValid()) { //TODO: This needs to be handled well. throw new Exception( string.Format("PaymentTypeID has a problem. The order has a payment type id of {0}", ord.PaymentTypeID)); } var rus = new Institution(); if (ord.PaymentTypeID == PaymentType.Constants.CASH || ord.PaymentTypeID == PaymentType.Constants.CREDIT) { rus.LoadByPrimaryKey(order.RequestedBy); } var stores = new Activity(); stores.LoadByPrimaryKey(order.FromStore); var textDeliveryNote = ""; var sendToString = GetReceivingUnitName(order); if (stvLogID != null) { var stvLog = new Issue(); stvLog.LoadByPrimaryKey(stvLogID.Value); if (!stvLog.IsColumnNull("IsDeliveryNote") && stvLog.IsDeliveryNote && isConversion) { textDeliveryNote = stvLog.IDPrinted.ToString("00000"); } } var xtraReport = new XtraReport(); string stvPrinterName = ""; if (PaymentType.Constants.CASH == ord.PaymentTypeID && !chkDeliveryNotes.Checked) { xtraReport = FormatCashRePrintInvoice(ord, dv.Table, rus, pl, false, stvPrinterName, pLogService, _stvLogIdChosen); pLogService.CommitPrintLog(); return xtraReport; } else if (PaymentType.Constants.CASH == ord.PaymentTypeID && chkDeliveryNotes.Checked) { xtraReport = FormatCashRePrintInvoice(ord, pl.DefaultView.ToTable(), rus, pl, true, stvPrinterName, pLogService, _stvLogIdChosen); pLogService.CommitPrintLog(); return xtraReport; } else if (PaymentType.Constants.CREDIT == ord.PaymentTypeID && !chkDeliveryNotes.Checked) { xtraReport = FormatCreditRePrintInvoice(ord, pl.DefaultView.ToTable(), rus, pl, false, stvPrinterName, pLogService, _stvLogIdChosen); pLogService.CommitPrintLog(); return xtraReport; } else if (PaymentType.Constants.CREDIT == ord.PaymentTypeID && chkDeliveryNotes.Checked) { xtraReport = FormatCreditRePrintInvoice(ord, pl.DefaultView.ToTable(), rus, pl, true, stvPrinterName, pLogService, _stvLogIdChosen); pLogService.CommitPrintLog(); return xtraReport; } //if (PaymentType.Constants.CASH == ord.PaymentTypeID) //{ // var stvReport = new HCMIS.Desktop.Reports.CashInvoice(CurrentContext.LoggedInUserName); // pl.LoadByOrderID(orderId); // PrepareTheReport(stvReport); // stvReport.DeliveryNoteNo.Text = textDeliveryNote; // stvReport.DataSource = Order.ReorganizeDataViewForSTVPrint_Program(dv, ord.ID, pl.ID, CurrentContext.UserId, stvLogID, isConversion, generateNewPrintID, includeInsurance); // stvReport.From.Text = GeneralInfo.Current.HospitalName; // stvReport.To.Text = sendToString; // stvReport.TIN.Text = rus.TinNo; // stvReport.VAT.Text = rus.VATNo; // stvReport.Town.Text = rus.Town; // stvReport.Woreda.Text = rus.WoredaText; // stvReport.Zone.Text = rus.ZoneText; // stvReport.Region.Text = rus.Region; // stvReport.License.Text = (!rus.IsColumnNull("Ownership") && rus.IsPrivatelyOwned) ? rus.LicenseNo : (!ord.IsColumnNull("LetterNo")) ? ord.LetterNo : ""; // //stvReport.Program.Text = stores.StoreName; // DateTimePickerEx dtDate = new DateTimePickerEx(); // dtDate.Value = DateTimeHelper.ServerDateTime; // stvReport.Date.Text = dtDate.Text; // return stvReport; //} //else if (PaymentType.Constants.CREDIT == ord.PaymentTypeID) //{ // HCMIS.Desktop.Reports.CreditInvoice stvReport = new HCMIS.Desktop.Reports.CreditInvoice(CurrentContext.LoggedInUserName); // pl.LoadByOrderID(orderId); // PrepareTheReport(stvReport); // stvReport.DeliveryNoteNo.Text = textDeliveryNote; // stvReport.DataSource = Order.ReorganizeDataViewForSTVPrint_Program(dv, ord.ID, pl.ID, CurrentContext.UserId, stvLogID, isConversion, generateNewPrintID, includeInsurance); // stvReport.From.Text = GeneralInfo.Current.HospitalName; // stvReport.To.Text = sendToString; // //stvReport.Region.Text = rus.Woreda; // stvReport.Zone.Text = rus.Town; // stvReport.Letter.Text = ord.LetterNo; // //stvReport.Program.Text = stores.StoreName; // DateTimePickerEx dtDate = new DateTimePickerEx(); // dtDate.Value = DateTimeHelper.ServerDateTime; // stvReport.Date.Text = dtDate.Text; // return stvReport; //} else if (PaymentType.Constants.STV == ord.PaymentTypeID && generateNewPrintID) { pl.LoadByOrderID(orderId); // check if this is a delivery note Issue sl = new Issue(); sl.LoadByPrimaryKey(stvLogID.Value); if (!sl.IsColumnNull("IsDeliveryNote") && sl.IsDeliveryNote && !isConversion) { var stvReport = new HCMIS.Desktop.Reports.DeliveryNoteForIssue(ord.ID, includeInsurance, CurrentContext.LoggedInUserName); PrepareTheReport(stvReport); stvReport.DataSource = Order.ReorganizeDataViewForSTVPrint_Program(dv, ord.ID, pl.ID, CurrentContext.UserId, stvLogID, isConversion, generateNewPrintID, includeInsurance); stvReport.From.Text = GeneralInfo.Current.HospitalName; stvReport.To.Text = sendToString; stvReport.STVNO.Text = Issue.GetLogFor(ord.RefNo); //stvReport.Date.Text = @"(Reprint) " + Convert.ToDateTime(dv[0]["IssueDate"]).ToString("MM/dd/yyyy"); DateTimePickerEx dtDate = new DateTimePickerEx(); dtDate.Value = DateTimeHelper.ServerDateTime; stvReport.Date.Text = dtDate.Text; //stvReport.ShowPreview(); return stvReport; } else { var stvReport = new HCMIS.Desktop.Reports.STVonHeadedPaper(ord.ID, includeInsurance, CurrentContext.LoggedInUserName); stvReport.DeliveryNoteNo.Text = textDeliveryNote; PrepareTheReport(stvReport); stvReport.DataSource = Order.ReorganizeDataViewForSTVPrint_Program(dv, ord.ID, pl.ID, CurrentContext.UserId, stvLogID, isConversion, generateNewPrintID, includeInsurance); stvReport.From.Text = GeneralInfo.Current.HospitalName; stvReport.To.Text = sendToString; stvReport.STVNO.Text = Issue.GetLogFor(ord.RefNo); //stvReport.Date.Text = @"(Reprint) " + Convert.ToDateTime(dv[0]["IssueDate"]).ToString("MM/dd/yyyy"); DateTimePickerEx dtDate = new DateTimePickerEx(); dtDate.Value = DateTimeHelper.ServerDateTime; stvReport.Date.Text = dtDate.Text; //stvReport.ShowPreview(); return stvReport; } } else if (PaymentType.Constants.STV == ord.PaymentTypeID && !generateNewPrintID) { pl.LoadByOrderID(orderId); //System.Windows.Forms.DialogResult result = XtraMessageBox.Show("Include insurance?", "Insurance", //MessageBoxButtons.YesNo, //MessageBoxIcon.Question); Issue log = new Issue(); log.LoadByPrimaryKey((_reprintId != null) ? _reprintId.Value : stvLogID.Value); if (log.IsColumnNull("HasInsurance") || BLL.Settings.IsCenter) //If it is null, we have no idea about what the insurance status was. So let's ask the user. { System.Windows.Forms.DialogResult result = XtraMessageBox.Show("Include insurance?", "Insurance", MessageBoxButtons.YesNo, MessageBoxIcon.Question); includeInsurance = result == DialogResult.Yes ? true : false; log.HasInsurance = includeInsurance; log.Save(); } else { includeInsurance = log.HasInsurance; } //bool includeInsurance = (!log.IsColumnNull("HasInsurance"))? log.HasInsurance : false; var stvReport = new HCMIS.Desktop.Reports.STVonA4(ord.ID, includeInsurance, CurrentContext.LoggedInUserName); stvReport.DeliveryNoteNo.Text = textDeliveryNote; PrepareTheReport(stvReport); stvReport.DataSource = Order.ReorganizeDataViewForSTVPrint_Program(dv, ord.ID, pl.ID, CurrentContext.UserId, (_reprintId != null) ? _reprintId : stvLogID, isConversion, generateNewPrintID, includeInsurance); stvReport.From.Text = GeneralInfo.Current.HospitalName; stvReport.To.Text = sendToString; //stvReport.STVNO.Text = //STVLog.GetLogFor(ord.RefNo); //stvReport.Date.Text = @"(Reprint) " + Convert.ToDateTime(dv[0]["IssueDate"]).ToString("MM/dd/yyyy"); DateTimePickerEx dtDate = new DateTimePickerEx(); dtDate.Value = DateTimeHelper.ServerDateTime; stvReport.Date.Text = dtDate.Text; return stvReport; } return null; }
public string ZoneName() { if (!IsColumnNull("RequestedBy")) { var rus = new Institution(); rus.LoadByPrimaryKey(RequestedBy); return rus.ZoneName; } return ""; }
/// <summary> /// The code supports manufacturer preference here too but we choose not to prefer manufacturers when looking into the stores. /// </summary> /// <param name="userID"></param> /// <param name="orderDetailID"></param> /// <param name="pricedUnpricedBoth"></param> /// <param name="bal"> </param> /// <param name="markStockoutBit"> </param> /// <param name="usableStock"> </param> /// <param name="approved"> </param> public decimal LoadOptionsForOrderDetail(int userID, int orderDetailID, PriceSettings pricedUnpricedBoth, Balance bal, bool markStockoutBit, out decimal usableStock, out decimal approved) { decimal avQuantity = 0; BLL.OrderDetail orderDetail = new OrderDetail(); orderDetail.LoadByPrimaryKey(orderDetailID); BLL.Order order = new Order(); order.LoadByPrimaryKey(orderDetail.OrderID); Institution ru = new Institution(); ru.LoadByPrimaryKey(order.RequestedBy); int month = EthiopianDate.EthiopianDate.Now.Month; int year = EthiopianDate.EthiopianDate.Now.Year; decimal availableQty = 0; usableStock = 0; approved = 0; int?manufacturerPrefrence = null, unitID = null; if (!orderDetail.IsColumnNull("PreferredManufacturerID")) { manufacturerPrefrence = orderDetail.PreferredManufacturerID; } DateTime?expPreferrence = null; if (!orderDetail.IsColumnNull("PreferredExpiryDate")) { expPreferrence = orderDetail.PreferredExpiryDate; } int?preferredPhysicalStoreID = null; if (!orderDetail.IsColumnNull("PreferredPhysicalStoreID")) { preferredPhysicalStoreID = orderDetail.PreferredPhysicalStoreID; } //-------------------------------------------------------------------------- //manufacturerPrefrence = null; //We are overriding the manufacturer preference. //expPreferrence = null; //-------------------------------------------------------------------------- if (!orderDetail.IsColumnNull("UnitID")) { unitID = orderDetail.UnitID; } BLL.UserActivity userStore = new UserActivity(); // Definitely a danger zone userStore.LoadByUserIDAndStoreType(userID, order.FromStore, orderDetail.ItemID, unitID.Value); while (!userStore.EOF) { var activity = new Activity(); activity.LoadByPrimaryKey(userStore.ActivityID); if (order.FromStore == Mode.Constants.RDF && !BLL.Settings.IsCenter && !BLL.Settings.PrivateCanGetFromMDGAndPBS && ru.Ownership == OwnershipType.Constants.Private && activity.IsSubsidized) { userStore.MoveNext(); continue; } // Load the Activity Selection that has PRiced Commodities. Balance balance = new Balance(); if (pricedUnpricedBoth == PriceSettings.PRICED_ONLY || pricedUnpricedBoth == PriceSettings.BOTH) { BLL.Order.MakeStockCalculations(userID, month, year, PriceSettings.PRICED_ONLY, orderDetail, userStore.ActivityID, orderDetail.ItemID, order, balance, unitID, manufacturerPrefrence, expPreferrence, preferredPhysicalStoreID, out usableStock, out approved, out availableQty, markStockoutBit); avQuantity += availableQty; if (availableQty > 0) { this.AddNew(); this.ID = userStore.ActivityID; this.Name = string.Format("{0} ({1})", activity.FullActivityName, availableQty.ToString("#,##0")); PrepareColumnsForApproval(); this.SetColumn("AvailableSKU", availableQty); this.SetColumn("IsDeliveryNote", false); this.SetColumn("TextID", string.Format("N{0}", this.ID)); } } // Load Activity Selections for Delivery Note Items. if (pricedUnpricedBoth == PriceSettings.DELIVERY_NOTE_ONLY || pricedUnpricedBoth == PriceSettings.BOTH) { BLL.Order.MakeStockCalculations(userID, month, year, PriceSettings.DELIVERY_NOTE_ONLY, orderDetail, userStore.ActivityID, orderDetail.ItemID, order, balance, unitID, manufacturerPrefrence, expPreferrence, preferredPhysicalStoreID, out usableStock, out approved, out availableQty, markStockoutBit); avQuantity += availableQty; if (availableQty > 0) { this.AddNew(); this.ID = userStore.ActivityID; //Just to give it a different ID so we know there is a change only. this.Name = string.Format("+-- {0} - Delivery Notes - ({1})", userStore.GetColumn("ActivityName"), availableQty.ToString("#,##0")); PrepareColumnsForApproval(); this.SetColumn("AvailableSKU", availableQty); this.SetColumn("IsDeliveryNote", true); this.SetColumn("TextID", string.Format("D{0}", this.ID)); } } userStore.MoveNext(); } return(avQuantity); }
private void lkRoute_EditValueChanged(object sender, EventArgs e) { Institution rec = new Institution(); if (lkRoute.EditValue.ToString() == "0") { lkIssuedTo.Properties.DataSource = rec.GetFacilitiesThatEverReceivedItems(); ; } else { lkIssuedTo.Properties.DataSource = rec.GetAllUnderRoute(Convert.ToInt32(lkRoute.EditValue)); } }
private void DistributionReport_Load(object sender, EventArgs e) { dtFromFacilitySupply.Text = dtToTopFacilities.Text = dtFrom.Text = @"7/7/2010"; btnRefresh_Click(null, null); Institution institution = new Institution(); institution.LoadAll(); gridFacilities.DataSource = institution.DefaultView; gridTopFacilities.DataSource = BLL.Institution.GetTopReceivingUnits(); //TODO: add a combo box for selection and change this 1 whenever that combo is changed gridItemList.DataSource = Item.GetActiveItemsByCommodityType(1, null); lkStoreType.SetupModeEditor().SetDefaultMode(); }
/// <summary> /// Formats the credit invoice. /// </summary> /// <param name="ord">The ord.</param> /// <param name="dvPriced">The dv priced.</param> /// <param name="rus">The rus.</param> /// <param name="pl">The pl.</param> /// <param name="deliveryNote">if set to <c>true</c> [delivery note].</param> /// <param name="allowCancelByUser">if set to <c>true</c> [allow cancel by user].</param> /// <exception cref="System.Exception"></exception> private XtraReport FormatCreditInvoice_Smaller(DataTable dvPriced, Order ord, PickList pl, Institution rus, bool deliveryNote, string printerName, HCMIS.Core.Distribution.Services.PrintLogService pLogService) { string activityName = txtConfirmFromStore.Text; bool hasInsurnance = chkIncludeInsurance.Checked; return WorkflowReportFactory.CreateCreditInvoiceSmaller(dvPriced, ord, pl, rus, deliveryNote, hasInsurnance, activityName); }
public DataTable GetIssuesByReceivingUnit(int storeId, int routeId, int type, DateTime sdate, DateTime edate,int storeid) { //This function does not look efficient. var rus = new Institution(); rus.LoadAll(); rus.GetAllUnderRoute(routeId); string theFrom = ""; int i = 0; while (!rus.EOF) { theFrom += HCMIS.Repository.Queries.Item.GetFromClauseFor_GetIssueByReceivingUnitsFilterByDateRange(rus.ID, i,sdate,edate, storeid); i++; rus.MoveNext(); } string select = ""; rus.Rewind(); for (int j = 0; j < i; j++) { select = HCMIS.Repository.Queries.Item.GetSelectClauseFor_GetIssueByReceivingUnits(select, rus.Name, j); rus.MoveNext(); } var query = HCMIS.Repository.Queries.Item.SelectGetIssuesByReceivingUnit(type, select, theFrom); Item ite =new Item(); ite.LoadFromRawSql(query); return ite.DataTable; }
/// <summary> /// Saves the and print STV. /// </summary> /// <param name="pickListDetail">The pick list detail.</param> /// <param name="deliveryNotePrinter">The delivery note printer.</param> /// <param name="stvPrinterName">Name of the STV printer.</param> /// <param name="dtDate">The dt date.</param> /// <param name="dtCurrent">The dt current.</param> /// <exception cref="System.Exception"></exception> private XtraReport SaveAndPrintSTV(DataView pickListDetail, bool isDeliveryNote, string printerName, DateTimePickerEx dtDate, DateTime dtCurrent) { HCMIS.Core.Distribution.Services.PrintLogService pLogService = new HCMIS.Core.Distribution.Services.PrintLogService(); pLogService.StartPrintingSession(); Order ord = IssueDoc.SaveIssueTransaction(_orderID, ref pickListDetail, txtRemarks.Text, CurrentContext.LoggedInUserName, dtCurrent); if (pickListDetail.Count == 0) throw new Exception("An error occurred during saving the issue. Please contact your administrator."); string sendToString = ""; BLL.Order ordr = new BLL.Order(); ordr.LoadByPrimaryKey(_orderID); BLL.Institution rus = new Institution(); if (!ordr.IsColumnNull("RequestedBy")) { rus.LoadByPrimaryKey(ordr.RequestedBy); sendToString = rus.Name; } else if (!ordr.IsColumnNull("OrderTypeID") && ordr.OrderTypeID == BLL.OrderType.CONSTANTS.ACCOUNT_TO_ACCOUNT_TRANSFER) { BLL.Transfer transfer = new Transfer(); transfer.LoadByOrderID(_orderID); var activity = new Activity(); activity.LoadByPrimaryKey(transfer.ToStoreID); sendToString = activity.FullActivityName; } PickList pl = new PickList(); pl.LoadByOrderID(ord.ID); var xtraReport = new XtraReport(); if (ord.PaymentTypeID == PaymentType.Constants.CASH) { xtraReport = FormatCashInvoice(ord, pickListDetail.Table, rus, pl, isDeliveryNote, printerName, pLogService); } else if (ord.PaymentTypeID == PaymentType.Constants.CREDIT) { xtraReport = FormatCreditInvoice(ord, pickListDetail.Table, rus, pl, isDeliveryNote, printerName, pLogService); } else if (ord.PaymentTypeID == PaymentType.Constants.STV) { xtraReport = FormatSTV(ord, pickListDetail.Table, sendToString, pl, isDeliveryNote, printerName, pLogService, _orderID); } SavePdfReport(pLogService, xtraReport); pLogService.CommitPrintLog(); return xtraReport; }
/// <summary> /// Gets the issues by receiving unit faster. /// </summary> /// <param name="storeID">The store ID.</param> /// <param name="routeID">The route ID.</param> /// <param name="type">The type.</param> /// <returns></returns> /// Shit: what a name? and it does crazy stuff too. public DataTable GetIssuesByReceivingUnitFaster(int storeID, int routeID, int type) { var ru = new Institution(); if (Settings.IsRdfMode) ru.GetFacilitiesThatEverReceivedItems(); else ru.GetAllUnderRoute(routeID); //Load all the items. var query = HCMIS.Repository.Queries.Item.SelectGetIssuesByReceivingUnitFaster(type); this.LoadFromRawSql(query); //Add the columns while (!ru.EOF) { this.AddColumn(string.Format("{0},{1}", ru.Name, ru.ID), typeof(int)); ru.MoveNext(); } while (!this.EOF) { Institution rus = new Institution(); if (Settings.IsRdfMode) rus.GetFacilitiesThatEverReceivedItems(); else rus.GetAllUnderRoute(routeID); while (!rus.EOF) { int itemID = int.Parse(this.GetColumn("ID").ToString()); var itm = new Item(); var issueQuery = HCMIS.Repository.Queries.Item.SelectGetIssuesByReceivingUnitFasterIssueQuery(itemID, rus.ID); itm.LoadFromRawSql(issueQuery); if (itm.RowCount > 0 && !itm.IsColumnNull("Quantity")) this.SetColumn(string.Format("{0},{1}", ru.Name, ru.ID), itm.GetColumn("Quantity")); rus.MoveNext(); } this.MoveNext(); } return this.DataTable; }