private void btnSave_Click(object sender, EventArgs e) { MyGeneration.dOOdads.TransactionMgr transaction = MyGeneration.dOOdads.TransactionMgr.ThreadTransactionMgr(); var dt = grdDetailView.DataSource as DataView; if ((dt) != null) { // This is where we set the Price foreach (DataRow dr in dt.Table.Rows) { var costElement = new CostElement(); costElement.LoadFromDataRow(dr, receipt.ID); costElement.AverageCost = Math.Round(Convert.ToDouble(dr["AverageCost"]), BLL.Settings.NoOfDigitsAfterTheDecimalPoint, MidpointRounding.AwayFromZero); costElement.Margin = Convert.ToDouble(dr["Margin"]); costElement.SellingPrice = Math.Round(Convert.ToDouble(dr["SellingPrice"]), BLL.Settings.NoOfDigitsAfterTheDecimalPoint, MidpointRounding.AwayFromZero); try { transaction.BeginTransaction(); var journalService = new JournalService(); journalService.StartRecordingSession(); costElement.SetPriceForReceiveDocs(); costElement.SavePrice(CurrentContext.UserId, costElement.ReceiptID.ToString(), journalService, ChangeMode.ErrorCorrection); journalService.CommitRecordingSession(); transaction.CommitTransaction(); } catch (Exception exception) { transaction.RollbackTransaction(); XtraMessageBox.Show("Error : " + exception.Message, "Error...", MessageBoxButtons.OK, MessageBoxIcon.Error); throw exception; } var report = new PriceOverridePrintout { xrCostedBy = { Text = CurrentContext.LoggedInUserName }, lblDate = { Text = DateTimeHelper.ServerDateTime.ToString() }, DataSource = getPriceChangeReport(costElement) }; report.ShowPreviewDialog(); } var recDoc = new ReceiveDoc(); recDoc.LoadByReceiptID(receipt.ID); recDoc.SetPrice(CurrentContext.UserId); receipt.ChangeStatus(ReceiptConfirmationStatus.Constants.PRICE_CALCULATED, null, this.GetFormIdentifier(), CurrentContext.UserId, "Price Set"); } }
private void btnSave_Click(object sender, EventArgs e) { BLL.ReceiveDoc recDoc = new ReceiveDoc(); recDoc.LoadByReceiptID(ReceiptID); if (PONumber.StartsWith("S2S-")) { if (SetFinalCost()) { recDoc.ConfirmGRVPrinted(CurrentContext.UserId); BLL.Receipt receiptStatus = new BLL.Receipt(); receiptStatus.LoadByPrimaryKey(ReceiptID); receiptStatus.ChangeStatus(ReceiptConfirmationStatus.Constants.GRV_PRINTED, null, this.GetFormIdentifier(), CurrentContext.UserId, "Store To Store Confirmed"); } } else { recDoc.ConfirmPrice(CurrentContext.UserId); BLL.Receipt receiptStatus = new BLL.Receipt(); receiptStatus.LoadByPrimaryKey(ReceiptID); receiptStatus.ChangeStatus(ReceiptConfirmationStatus.Constants.PRICE_CONFIRMED, null, this.GetFormIdentifier(), CurrentContext.UserId, "Price Confirmed"); } this.LogActivity("Confirm-Price", ReceiptID); XtraMessageBox.Show("Received Cost and Margin Set successfully!", "Success", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information); PutAwayListsLoad(null, null); }
private void btnReturn_Click(object sender, EventArgs e) { //TODO: finish updating the changed locations MyGeneration.dOOdads.TransactionMgr transaction = MyGeneration.dOOdads.TransactionMgr.ThreadTransactionMgr(); if (gridGRVs.DataSource == null) { return; } transaction.BeginTransaction(); try { PalletLocation pl = new PalletLocation(); BLL.ReceiveDoc recDoc = new ReceiveDoc(); recDoc.LoadByReceiptID(ReceiptID); recDoc.SetStatusAsReceived(null); BLL.Receipt receiptStatus = new BLL.Receipt(); receiptStatus.LoadByPrimaryKey(ReceiptID); receiptStatus.ChangeStatus(ReceiptConfirmationStatus.Constants.RECEIVE_ENTERED, null, this.GetFormIdentifier(), CurrentContext.UserId, "Return For Quantity Editing"); transaction.CommitTransaction(); this.LogActivity("Return-Receipt-To-Quantity-Confirmation", ReceiptID); XtraMessageBox.Show("Receipt Returned!", "Success", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information); } catch (Exception exp) { transaction.RollbackTransaction(); throw exp; } PutAwayListsLoad(null, null); }
private void btnReturn_Click(object sender, EventArgs e) { //TODO: finish updating the changed locations MyGeneration.dOOdads.TransactionMgr transaction = MyGeneration.dOOdads.TransactionMgr.ThreadTransactionMgr(); if (gridGRVs.DataSource == null) return; transaction.BeginTransaction(); try { PalletLocation pl = new PalletLocation(); BLL.ReceiveDoc recDoc = new ReceiveDoc(); recDoc.LoadByReceiptID(ReceiptID); recDoc.ConfirmGRNFPrinted(null); BLL.Receipt receiptStatus = new BLL.Receipt(); receiptStatus.LoadByPrimaryKey(ReceiptID); receiptStatus.ChangeStatus(ReceiptConfirmationStatus.Constants.GRNF_PRINTED, null, this.GetFormIdentifier(), CurrentContext.UserId, "Return For Price Change"); transaction.CommitTransaction(); this.LogActivity("Return-For-Costing", ReceiptID); XtraMessageBox.Show("Receipt Returned!", "Success", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information); } catch (Exception exp) { transaction.RollbackTransaction(); throw exp; } PutAwayListsLoad(null, null); }
private void ReturnToStoreForQuantityEdit() { //TODO: finish updating the changed locations MyGeneration.dOOdads.TransactionMgr transaction = MyGeneration.dOOdads.TransactionMgr.ThreadTransactionMgr(); transaction.BeginTransaction(); try { PalletLocation pl = new PalletLocation(); String reference = gridReceiveView.GetFocusedDataRow()["RefNo"].ToString(); int ReceiptID = Convert.ToInt32(gridReceiveView.GetFocusedDataRow()["ReceiptID"]); if (gridDetailView.DataSource == null) { return; } BLL.ReceiveDoc recDoc = new ReceiveDoc(); recDoc.LoadByReceiptID(ReceiptID); recDoc.SetStatusAsDraft(CurrentContext.UserId); BLL.Receipt receiptStatus = new BLL.Receipt(); receiptStatus.LoadByPrimaryKey(ReceiptID); receiptStatus.ChangeStatus(ReceiptConfirmationStatus.Constants.DRAFT_RECEIPT, null, this.GetFormIdentifier(), CurrentContext.UserId, "Returned To Draft"); transaction.CommitTransaction(); XtraMessageBox.Show("Receipt Returned!", "Success", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information); BindFormContents(); } catch (Exception exp) { transaction.RollbackTransaction(); XtraMessageBox.Show(exp.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void ReturnFromGRVPrinting() { int ReceiptID = Convert.ToInt32(gridReceiveView.GetFocusedDataRow()["ReceiptID"]); var receiveDoc = new ReceiveDoc(); receiveDoc.LoadByReceiptID(ReceiptID); receiveDoc.ConfirmGRNFPrinted(null); BLL.Receipt receiptStatus = new BLL.Receipt(); receiptStatus.LoadByPrimaryKey(ReceiptID); receiptStatus.ChangeStatus(ReceiptConfirmationStatus.Constants.PRICE_CALCULATED, null, this.GetFormIdentifier(), CurrentContext.UserId, "Return For Price Change"); BindFormContents(); this.LogActivity("Return-SRM-To-Costing", ReceiptID); }
private void btnSave_Click(object sender, EventArgs e) { GRV.SaveInsurance(); GRV.SaveCostCoefficientAndTotalValue(CurrentContext.UserId); //ToDo: Remove this When it is safe and Ready for deployement. GRV.RecordAverageCostAndSellingPrice(CurrentContext.UserId); print(); BLL.ReceiveDoc recDoc = new ReceiveDoc(); recDoc.LoadByReceiptID(ReceiptID); BLL.Receipt receiptStatus = new BLL.Receipt(); if (!BLL.Settings.UseReceiveCostConfirmation && PONumber.StartsWith("S2S-")) { if (SetFinalCost()) { recDoc.ConfirmGRVPrinted(CurrentContext.UserId); receiptStatus.LoadByPrimaryKey(ReceiptID); receiptStatus.ChangeStatus(ReceiptConfirmationStatus.Constants.GRV_PRINTED, null, this.GetFormIdentifier(), CurrentContext.UserId, "StoreToStore Confirmed"); } } else if (BLL.Settings.UseReceiveCostConfirmation) { recDoc.SetPrice(CurrentContext.UserId); receiptStatus.LoadByPrimaryKey(ReceiptID); receiptStatus.ChangeStatus(ReceiptConfirmationStatus.Constants.PRICE_CALCULATED, null, this.GetFormIdentifier(), CurrentContext.UserId, "Price Set"); } else { recDoc.ConfirmPrice(CurrentContext.UserId); receiptStatus.LoadByPrimaryKey(ReceiptID); receiptStatus.ChangeStatus(ReceiptConfirmationStatus.Constants.PRICE_CONFIRMED, null, this.GetFormIdentifier(), CurrentContext.UserId, "Price Set"); } XtraMessageBox.Show("Received Cost and Margin Set successfully!", "Success", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information); PutAwayListsLoad(null, null); this.LogActivity("Print-Cost-Analysis", ReceiptID); }
private void ConfirmQuantityAndLocation() { MyGeneration.dOOdads.TransactionMgr transaction = MyGeneration.dOOdads.TransactionMgr.ThreadTransactionMgr(); transaction.BeginTransaction(); try { PalletLocation pl = new PalletLocation(); DataRow dr = gridReceiveView.GetFocusedDataRow(); if (dr == null) { throw new Exception("Nothing to confirm!"); } int ReceiptID = Convert.ToInt32(gridReceiveView.GetFocusedDataRow()["ReceiptID"]); if (gridDetailView.DataSource == null) { return; } BLL.ReceiveDoc receiveDoc = new ReceiveDoc(); receiveDoc.LoadByReceiptIDWithReceivePallet(ReceiptID); while (!receiveDoc.EOF) { int palletLocationID = Convert.ToInt32(receiveDoc.GetColumn("PalletLocationID")); pl.LoadByPrimaryKey(palletLocationID); pl.Confirmed = true; pl.Save(); receiveDoc.MoveNext(); } BLL.ReceiveDoc recDoc = new ReceiveDoc(); recDoc.LoadByReceiptID(ReceiptID); recDoc.ConfirmQuantityAndLocation(CurrentContext.UserId); BLL.Receipt receiptStatus = new BLL.Receipt(); receiptStatus.LoadByPrimaryKey(ReceiptID); receiptStatus.ChangeStatus(ReceiptConfirmationStatus.Constants.RECEIVE_QUANTITY_CONFIRMED, null, this.GetFormIdentifier(), CurrentContext.UserId, "Receive Confirmed"); transaction.CommitTransaction(); XtraMessageBox.Show("Receipt Confirmed!", "Success", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information); BindFormContents(); } catch (Exception exp) { transaction.RollbackTransaction(); XtraMessageBox.Show(exp.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
//TODO: Definitly going to BLL but i don't have time to do a clean job here. #region Void Process private void btnVoid_Click(object sender, EventArgs e) { int receiptID = Convert.ToInt32(gridReceiveView.GetFocusedDataRow()["ReceiptID"].ToString()); if (BLL.Receipt.AreThereIssues(receiptID)) { XtraMessageBox.Show("There are issues with this GRV. You can't void it."); return; } var grv = new ReceiptConfirmationPrintout(); grv.Where.ReceiptID.Value = receiptID; grv.Query.Load(); if (grv.IsColumnNull("VoidRequest") || !grv.VoidRequest) { XtraMessageBox.Show("Void needs to be first requested.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if ( XtraMessageBox.Show(UserLookAndFeel.Default, "Are you sure, you want to Void the Document?", "Are you sure:", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { while (!grv.EOF) { grv.IsVoided = true; grv.VoidApprovedByUserID = CurrentContext.UserId; grv.VoidApprovalDateTime = DateTimeHelper.ServerDateTime; grv.MoveNext(); } grv.Save(); ReturnToStoreForQuantityEdit(); BLL.Receipt receiptStatus = new BLL.Receipt(); receiptStatus.LoadByPrimaryKey(ReceiptID); receiptStatus.ChangeStatus(ReceiptConfirmationStatus.Constants.DRAFT_RECEIPT, null, this.GetFormIdentifier(), CurrentContext.UserId, "GRV Voided"); this.LogActivity("Approve-Receipt-Void", ReceiptID); } }
private void PassReceiveForQtyConfirmation() { if (gridReceiveView.GetFocusedDataRow() != null) { String reference = gridReceiveView.GetFocusedDataRow()["RefNo"].ToString(); if (gridDetailView.DataSource == null) { return; } BLL.ReceiveDoc recDoc = new ReceiveDoc(); recDoc.LoadByReferenceNo(reference); recDoc.SetStatusAsReceived(CurrentContext.UserId); BLL.Receipt receiptStatus = new BLL.Receipt(); receiptStatus.LoadByPrimaryKey(ReceiptID); receiptStatus.ChangeStatus(ReceiptConfirmationStatus.Constants.RECEIVE_ENTERED, null, this.GetFormIdentifier(), CurrentContext.UserId, "Quantity edited"); XtraMessageBox.Show("Receipt forwarded for quantity confirmation!", "Success", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information); BindFormContents(); } }
private void btnVoid_Click(object sender, EventArgs e) { int receiptID = Convert.ToInt32(gridReceiveView.GetFocusedDataRow()["ReceiptID"].ToString()); if (BLL.Receipt.AreThereIssues(receiptID)) { XtraMessageBox.Show("There are issues with this GRV. You can't void it."); return; } var grv = new ReceiptConfirmationPrintout(); grv.Where.ReceiptID.Value = receiptID; grv.Query.Load(); if (grv.IsColumnNull("VoidRequest") || !grv.VoidRequest) { XtraMessageBox.Show("Void needs to be first requested.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if ( XtraMessageBox.Show(UserLookAndFeel.Default, "Are you sure, you want to Void the Document?", "Are you sure:", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { while (!grv.EOF) { grv.IsVoided = true; grv.VoidApprovedByUserID = CurrentContext.UserId; grv.VoidApprovalDateTime = DateTimeHelper.ServerDateTime; grv.MoveNext(); } grv.Save(); ReturnToStoreForQuantityEdit(); BLL.Receipt receiptStatus = new BLL.Receipt(); receiptStatus.LoadByPrimaryKey(ReceiptID); receiptStatus.ChangeStatus(ReceiptConfirmationStatus.Constants.DRAFT_RECEIPT, null, this.GetFormIdentifier(), CurrentContext.UserId, "GRV Voided"); this.LogActivity("Approve-Receipt-Void", ReceiptID); } }
private void SaveReceive() { // Merge all Receives with Same Item information and Assigned to Same PhysicalStore as One Item , Quantity Sumed UP! MergeReceiveDocLines(); BLL.ReceiveDoc rec = new ReceiveDoc(); ////int receiptTypeID = srm //// ? ReceiptType.CONSTANTS.STOCK_RETURN //// : (deliveryNoteType != DeliveryNoteType.NotSet) //// ? ReceiptType.CONSTANTS.DELIVERY_NOTE //// : beginningBalance //// ? ReceiptType.CONSTANTS.BEGINNING_BALANCE //// : ReceiptType.CONSTANTS.STANDARD_RECEIPT; int receiptID; int warehouseID = Convert.ToInt32(lkWarehouse.EditValue); receiptID = SaveRelevantReceiptHeaders(_receiptTypeID, warehouseID); DataTable zeroQuantitiesDueToMultipleBatch = null; DataRow [] zeroQuantityRows = _dtRecGrid.Select(string.Format("[Pack Qty] = 0"),"[Ordering] ASC "); if (zeroQuantityRows.Any() && zeroQuantityRows.Any(r => r["ShortageReasonID"] == DBNull.Value)) { zeroQuantityRows = CheckAndRemoveIfFullNotReceiveEntry(zeroQuantityRows); if (zeroQuantityRows.Any()) zeroQuantitiesDueToMultipleBatch = zeroQuantityRows.Where(r => r["ShortageReasonID"] == DBNull.Value).CopyToDataTable(); } var mergeableTables = _dtRecGrid.Select(string.Format("[Pack Qty] > 0 "), "[Ordering] ASC "); DataTable mergedDataTable = null; if (mergeableTables.Any()) { mergedDataTable = _dtRecGrid.Select(string.Format("[Pack Qty] > 0 "), "[Ordering] ASC ").CopyToDataTable(); if (zeroQuantitiesDueToMultipleBatch != null) mergedDataTable.Merge(zeroQuantitiesDueToMultipleBatch); if (grdShortageOrDamaged.DataSource != null) { var shortageOrDamage = (DataTable) grdShortageOrDamaged.DataSource; mergedDataTable.Merge(shortageOrDamage); } } else { if (grdShortageOrDamaged.DataSource != null) { var shortageOrDamage = (DataTable)grdShortageOrDamaged.DataSource; if (zeroQuantitiesDueToMultipleBatch != null) shortageOrDamage.Merge(zeroQuantitiesDueToMultipleBatch); //~ {"[ShortageReasonID] ASC} --> Just to give priority among shortages to Damaged reasons as we will create a receiveDoc entry for this ~// mergedDataTable = mergedDataTable == null ? shortageOrDamage.Select(string.Format("[Pack Qty] >= 0 "), "[ShortageReasonID] ASC ").CopyToDataTable() : shortageOrDamage; } } foreach (DataRowView dr in mergedDataTable.DefaultView) { var shortageReasonID = dr["ShortageReasonID"]; var onlyOneEntryFound = _dtRecGrid.Select(String.Format("GUID = '{0}'", dr["GUID"])); bool zeroQtyDueTomultipleBatchFound = (Convert.ToDecimal(dr["Pack Qty"]) == 0) && (shortageReasonID == DBNull.Value) && (onlyOneEntryFound.Count() == 1); bool fullNotReceivedEntry = (Convert.ToDecimal(dr["BU Qty"]) == 0) && (shortageReasonID != DBNull.Value) && (Convert.ToInt32(shortageReasonID) == ShortageReasons.Constants.NOT_RECEIVED) && (onlyOneEntryFound.Count() == 1); if (fullNotReceivedEntry) { dr["Pack Qty"] = 0; } var item = new Item(); item.LoadByPrimaryKey(Convert.ToInt32(dr["ID"])); if (item.NeedExpiryBatch || (shortageReasonID == DBNull.Value && ((dr["Expiry Date"] != DBNull.Value) && (Convert.ToDateTime(dr["Expiry Date"]) <= DateTimeHelper.ServerDateTime)))) { var expDate = Convert.ToDateTime(dr["Expiry Date"]); if ((shortageReasonID == DBNull.Value && expDate > DateTimeHelper.ServerDateTime) || zeroQtyDueTomultipleBatchFound) { AddNewReceiveDoc(rec, receiptID, dr); } else { //for physically Damaged receives and expired receives if ((shortageReasonID != DBNull.Value && Convert.ToInt32(shortageReasonID) == ShortageReasons.Constants.DAMAGED) || (shortageReasonID == DBNull.Value && expDate <= DateTimeHelper.ServerDateTime) || fullNotReceivedEntry) { AddNewReceiveDoc(rec, receiptID, dr, true); if (shortageReasonID == DBNull.Value) { dr["ShortageReasonID"] = ShortageReasons.Constants.DAMAGED; } } else { HandleReceiveDocShortage(dr, rec); } } } else { if ((shortageReasonID == DBNull.Value) || zeroQtyDueTomultipleBatchFound) { AddNewReceiveDoc(rec, receiptID, dr); } else { //for physically Damaged receives if (shortageReasonID != DBNull.Value && Convert.ToInt32(shortageReasonID) == ShortageReasons.Constants.DAMAGED || fullNotReceivedEntry) { AddNewReceiveDoc(rec, receiptID, dr, true); } else { HandleReceiveDocShortage(dr, rec); } } } } rec.SetStatusAsReceived(CurrentContext.UserId); BLL.Receipt receiptStatus = new BLL.Receipt(); receiptStatus.LoadByPrimaryKey(receiptID); receiptStatus.ChangeStatus(ReceiptConfirmationStatus.Constants.RECEIVE_ENTERED, null, this.GetFormIdentifier(), CurrentContext.UserId, "Received"); if (!BLL.Settings.HandleGRV) //If HandleGRV is true, the price isn't entered in the receive stage meaning { rec.Rewind(); while (!rec.EOF) { if (!ReceiveDoc.DoesPriceNeedToBeChanged(rec.StoreID, rec.ItemID, rec.UnitID, rec.ManufacturerId) && (deliveryNoteType == DeliveryNoteType.NotSet)) { rec.SellingPrice = rec.Cost; rec.UnitCost = Convert.ToDecimal(rec.Cost); // Added by Heny In order to display Unit Cost on Vaccine rec.Margin = 0; } rec.MoveNext(); } } rec.Save(); //TODO: To be removed after the ShortageReasonID in receviedoc is discontinued. //SavePalletization(rdDamaged); _revDocRelatePalletGuid.Clear(); }
private HCMIS.Desktop.Reports.ReceiptConfirmationPrintout PrintReceiptConfirmation(int ReceiptID, int? reprintOfReceiptConfirmationPrintoutID) { ReceiptConfirmationPrintout rc = new ReceiptConfirmationPrintout(); HCMIS.Desktop.Reports.ReceiptConfirmationPrintout printout = new HCMIS.Desktop.Reports.ReceiptConfirmationPrintout(CurrentContext.LoggedInUserName); BLL.ReceiveDoc receiveDoc = new ReceiveDoc(); // receiveDoc.LoadByReferenceNo(reference); receiveDoc.LoadByReceiptID(ReceiptID); var activity = new Activity(); activity.LoadByPrimaryKey(receiveDoc.StoreID); BLL.Supplier supplier = new Supplier(); supplier.LoadByPrimaryKey(receiveDoc.SupplierID); BLL.Receipt receipt=new BLL.Receipt(); receipt.LoadByPrimaryKey(receiveDoc.ReceiptID); BLL.ReceiptInvoice receiptInvoice= new ReceiptInvoice(); receiptInvoice.LoadByPrimaryKey(receipt.ReceiptInvoiceID); BLL.PO po = new PO(); po.LoadByPrimaryKey(receiptInvoice.POID); BLL.POType poType = new POType(); poType.LoadByPrimaryKey(po.PurchaseType); int printedID = 0; string GRNFNo = FiscalYear.Current.GetCode(BLL.ReceiptConfirmationPrintout.GetGRNFNo(ReceiptID)); if (currentMode == Modes.GRVPrinting) //The GRVConfirmation is for reprinting { printout.BranchName.Text = GeneralInfo.Current.HospitalName; PrepareGRVPrintout(printout); // String reference = gridReceiveView.GetFocusedDataRow()["RefNo"].ToString(); if (poType.PurchaseOrderTypeCode == "LP") printout.xrGRVLabel.Text = "GRV No."; else printout.xrGRVLabel.Text = "iGRV No."; if (supplier.SupplierTypeID == SupplierType.CONSTANTS.HOME_OFFICE || supplier.SupplierTypeID == SupplierType.CONSTANTS.HUBS || supplier.SupplierTypeID == SupplierType.CONSTANTS.ACCOUNTS || supplier.SupplierTypeID == SupplierType.CONSTANTS.STORES) { //printout.xrGRVLabel.Text = "iGRV No."; printout.xrAir.Visible = false; printout.xrAirValue.Visible = false; printout.xrTransit.Visible = false; printout.xrTransitValue.Visible = false; printout.xrInsurance.Visible = false; printout.xrInsuranceValue.Visible = false; printout.xrNumberOfCases.Visible = false; printout.xrNumberOfCasesValue.Visible = false; printout.xrInvoiceNo.Text = "STV No."; printout.xrPurchaseOrderNo.Visible = false; printout.xrPurchaseOrderNoValue.Visible = false; printout.xrLabelGRNF.Text = GRNFNo; printout.xrSTV.Visible = false; printout.xrSTVNoValue.Visible = false; printedID = rc.PrepareDataForPrintout(ReceiptID, CurrentContext.UserId, false, 4, null,reprintOfReceiptConfirmationPrintoutID,FiscalYear.Current); printout.DataSource = rc.DefaultView.ToTable(); CalendarLib.DateTimePickerEx dtDate = new CalendarLib.DateTimePickerEx(); //dtDate.CustomFormat = "dd/MM/yyyy"; dtDate.Value = receiveDoc.EurDate; printout.Date.Text = dtDate.Text; } else { // printout.xrGRVLabel.Text = "GRV No."; printout.xrSTV.Visible = false; printout.xrSTVNoValue.Visible = false; printedID = rc.PrepareDataForPrintout(ReceiptID, CurrentContext.UserId, false, 2, null, reprintOfReceiptConfirmationPrintoutID,FiscalYear.Current); printout.xrLabelGRNF.Text = GRNFNo; printout.DataSource = rc.DefaultView.ToTable(); CalendarLib.DateTimePickerEx dtDate = new CalendarLib.DateTimePickerEx(); //dtDate.CustomFormat = "dd/MM/yyyy"; dtDate.Value = receiveDoc.EurDate; printout.Date.Text = dtDate.Text; } } printout.xrLabelStoreName.Text = activity.FullActivityName; if (ReceiveDoc.IsThereShortageOrDamage(ReceiptID)) { HCMIS.Desktop.Reports.ReceiptConfirmationShortagePrintout printoutShortage = PrintReceiptConfirmationForShortage(ReceiptID, printedID); if (currentMode == Modes.GRVPrinting) PrepareGRVPrintout(printoutShortage); printout.xrShortageReport.ReportSource = printoutShortage; printout.PrintingSystem.ContinuousPageNumbering = true; } else { printout.ReportFooter.Visible = false; } //Release Product CostCalculator GRV = new CostCalculator(); GRV.LoadGRV(ReceiptID); String reference = gridReceiveView.GetFocusedDataRow()["RefNo"].ToString(); BLL.ReceiveDoc recDoc = new ReceiveDoc(); recDoc.LoadByReceiptID(ReceiptID); 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(); // LOG Cost Analysis printout in PDF Log MemoryStream stream = new MemoryStream(); printout.ExportToPdf(stream); HCMIS.Core.Distribution.Services.PrintLogService.SavePrintLogNoWait(stream, "GRV/IGRV", true, ReceiptID, CurrentContext.UserId, BLL.DateTimeHelper.ServerDateTime); return printout; }
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(); }
private void ReturnToStoreForQuantityEdit() { //TODO: finish updating the changed locations MyGeneration.dOOdads.TransactionMgr transaction = MyGeneration.dOOdads.TransactionMgr.ThreadTransactionMgr(); transaction.BeginTransaction(); try { PalletLocation pl = new PalletLocation(); String reference = gridReceiveView.GetFocusedDataRow()["RefNo"].ToString(); int ReceiptID = Convert.ToInt32(gridReceiveView.GetFocusedDataRow()["ReceiptID"]); if (gridDetailView.DataSource == null) return; BLL.ReceiveDoc recDoc = new ReceiveDoc(); recDoc.LoadByReceiptID(ReceiptID); recDoc.SetStatusAsDraft(CurrentContext.UserId); BLL.Receipt receiptStatus = new BLL.Receipt(); receiptStatus.LoadByPrimaryKey(ReceiptID); receiptStatus.ChangeStatus(ReceiptConfirmationStatus.Constants.DRAFT_RECEIPT, null, this.GetFormIdentifier(), CurrentContext.UserId, "Returned To Draft"); transaction.CommitTransaction(); XtraMessageBox.Show("Receipt Returned!", "Success", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information); BindFormContents(); } catch (Exception exp) { transaction.RollbackTransaction(); XtraMessageBox.Show(exp.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void PassReceiveForQtyConfirmation() { if (gridReceiveView.GetFocusedDataRow() != null) { String reference = gridReceiveView.GetFocusedDataRow()["RefNo"].ToString(); if (gridDetailView.DataSource == null) return; BLL.ReceiveDoc recDoc = new ReceiveDoc(); recDoc.LoadByReferenceNo(reference); recDoc.SetStatusAsReceived(CurrentContext.UserId); BLL.Receipt receiptStatus = new BLL.Receipt(); receiptStatus.LoadByPrimaryKey(ReceiptID); receiptStatus.ChangeStatus(ReceiptConfirmationStatus.Constants.RECEIVE_ENTERED, null, this.GetFormIdentifier(), CurrentContext.UserId, "Quantity edited"); XtraMessageBox.Show("Receipt forwarded for quantity confirmation!", "Success", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information); BindFormContents(); } }
private void ConfirmQuantityAndLocation() { MyGeneration.dOOdads.TransactionMgr transaction = MyGeneration.dOOdads.TransactionMgr.ThreadTransactionMgr(); transaction.BeginTransaction(); try { PalletLocation pl = new PalletLocation(); DataRow dr = gridReceiveView.GetFocusedDataRow(); if (dr == null) { throw new Exception("Nothing to confirm!"); } int ReceiptID = Convert.ToInt32(gridReceiveView.GetFocusedDataRow()["ReceiptID"]); if (gridDetailView.DataSource == null) return; BLL.ReceiveDoc receiveDoc = new ReceiveDoc(); receiveDoc.LoadByReceiptIDWithReceivePallet(ReceiptID); while (!receiveDoc.EOF) { int palletLocationID = Convert.ToInt32(receiveDoc.GetColumn("PalletLocationID")); pl.LoadByPrimaryKey(palletLocationID); pl.Confirmed = true; pl.Save(); receiveDoc.MoveNext(); } BLL.ReceiveDoc recDoc = new ReceiveDoc(); recDoc.LoadByReceiptID(ReceiptID); recDoc.ConfirmQuantityAndLocation(CurrentContext.UserId); BLL.Receipt receiptStatus = new BLL.Receipt(); receiptStatus.LoadByPrimaryKey(ReceiptID); receiptStatus.ChangeStatus(ReceiptConfirmationStatus.Constants.RECEIVE_QUANTITY_CONFIRMED, null, this.GetFormIdentifier(), CurrentContext.UserId, "Receive Confirmed"); transaction.CommitTransaction(); XtraMessageBox.Show("Receipt Confirmed!", "Success", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information); BindFormContents(); } catch (Exception exp) { transaction.RollbackTransaction(); XtraMessageBox.Show(exp.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private HCMIS.Desktop.Reports.ReceiptConfirmationPrintout PrintReceiptConfirmation(int ReceiptID, int?reprintOfReceiptConfirmationPrintoutID) { ReceiptConfirmationPrintout rc = new ReceiptConfirmationPrintout(); HCMIS.Desktop.Reports.ReceiptConfirmationPrintout printout = new HCMIS.Desktop.Reports.ReceiptConfirmationPrintout(CurrentContext.LoggedInUserName); BLL.ReceiveDoc receiveDoc = new ReceiveDoc(); // receiveDoc.LoadByReferenceNo(reference); receiveDoc.LoadByReceiptID(ReceiptID); var activity = new Activity(); activity.LoadByPrimaryKey(receiveDoc.StoreID); BLL.Supplier supplier = new Supplier(); supplier.LoadByPrimaryKey(receiveDoc.SupplierID); BLL.Receipt receipt = new BLL.Receipt(); receipt.LoadByPrimaryKey(receiveDoc.ReceiptID); BLL.ReceiptInvoice receiptInvoice = new ReceiptInvoice(); receiptInvoice.LoadByPrimaryKey(receipt.ReceiptInvoiceID); BLL.PO po = new PO(); po.LoadByPrimaryKey(receiptInvoice.POID); BLL.POType poType = new POType(); poType.LoadByPrimaryKey(po.PurchaseType); int printedID = 0; string GRNFNo = FiscalYear.Current.GetCode(BLL.ReceiptConfirmationPrintout.GetGRNFNo(ReceiptID)); if (currentMode == Modes.GRVPrinting) //The GRVConfirmation is for reprinting { printout.BranchName.Text = GeneralInfo.Current.HospitalName; PrepareGRVPrintout(printout); // String reference = gridReceiveView.GetFocusedDataRow()["RefNo"].ToString(); if (poType.PurchaseOrderTypeCode == "LP") { printout.xrGRVLabel.Text = "GRV No."; } else { printout.xrGRVLabel.Text = "iGRV No."; } if (supplier.SupplierTypeID == SupplierType.CONSTANTS.HOME_OFFICE || supplier.SupplierTypeID == SupplierType.CONSTANTS.HUBS || supplier.SupplierTypeID == SupplierType.CONSTANTS.ACCOUNTS || supplier.SupplierTypeID == SupplierType.CONSTANTS.STORES) { //printout.xrGRVLabel.Text = "iGRV No."; printout.xrAir.Visible = false; printout.xrAirValue.Visible = false; printout.xrTransit.Visible = false; printout.xrTransitValue.Visible = false; printout.xrInsurance.Visible = false; printout.xrInsuranceValue.Visible = false; printout.xrNumberOfCases.Visible = false; printout.xrNumberOfCasesValue.Visible = false; printout.xrInvoiceNo.Text = "STV No."; printout.xrPurchaseOrderNo.Visible = false; printout.xrPurchaseOrderNoValue.Visible = false; printout.xrLabelGRNF.Text = GRNFNo; printout.xrSTV.Visible = false; printout.xrSTVNoValue.Visible = false; printedID = rc.PrepareDataForPrintout(ReceiptID, CurrentContext.UserId, false, 4, null, reprintOfReceiptConfirmationPrintoutID, FiscalYear.Current); printout.DataSource = rc.DefaultView.ToTable(); CalendarLib.DateTimePickerEx dtDate = new CalendarLib.DateTimePickerEx(); //dtDate.CustomFormat = "dd/MM/yyyy"; dtDate.Value = receiveDoc.EurDate; printout.Date.Text = dtDate.Text; } else { // printout.xrGRVLabel.Text = "GRV No."; printout.xrSTV.Visible = false; printout.xrSTVNoValue.Visible = false; printedID = rc.PrepareDataForPrintout(ReceiptID, CurrentContext.UserId, false, 2, null, reprintOfReceiptConfirmationPrintoutID, FiscalYear.Current); printout.xrLabelGRNF.Text = GRNFNo; printout.DataSource = rc.DefaultView.ToTable(); CalendarLib.DateTimePickerEx dtDate = new CalendarLib.DateTimePickerEx(); //dtDate.CustomFormat = "dd/MM/yyyy"; dtDate.Value = receiveDoc.EurDate; printout.Date.Text = dtDate.Text; } } printout.xrLabelStoreName.Text = activity.FullActivityName; if (ReceiveDoc.IsThereShortageOrDamage(ReceiptID)) { HCMIS.Desktop.Reports.ReceiptConfirmationShortagePrintout printoutShortage = PrintReceiptConfirmationForShortage(ReceiptID, printedID); if (currentMode == Modes.GRVPrinting) { PrepareGRVPrintout(printoutShortage); } printout.xrShortageReport.ReportSource = printoutShortage; printout.PrintingSystem.ContinuousPageNumbering = true; } else { printout.ReportFooter.Visible = false; } //Release Product CostCalculator GRV = new CostCalculator(); GRV.LoadGRV(ReceiptID); String reference = gridReceiveView.GetFocusedDataRow()["RefNo"].ToString(); BLL.ReceiveDoc recDoc = new ReceiveDoc(); recDoc.LoadByReceiptID(ReceiptID); 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(); // LOG Cost Analysis printout in PDF Log MemoryStream stream = new MemoryStream(); printout.ExportToPdf(stream); HCMIS.Core.Distribution.Services.PrintLogService.SavePrintLogNoWait(stream, "GRV/IGRV", true, ReceiptID, CurrentContext.UserId, BLL.DateTimeHelper.ServerDateTime); return(printout); }
private void btnPrint_Click(object sender, EventArgs e) { DataRow dataRow = gridReceiveView.GetFocusedDataRow(); if (dataRow != null) { if (Convert.ToInt32(dataRow["ReceiptConfirmationStatusID"]) == ReceiptConfirmationStatus.Constants.RECEIVE_QUANTITY_CONFIRMED) { ReceiptID = Convert.ToInt32(dataRow["ReceiptID"]); PrintDialog printDialog = new PrintDialog(); printDialog.PrinterSettings.Copies = BLL.Settings.GRNFCopies; DialogResult dialogResult = printDialog.ShowDialog(); if (dialogResult != DialogResult.OK) { MessageBox.Show("Printing Canceled by user", "Cancel Printint...", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); return; } TransactionMgr transaction = TransactionMgr.ThreadTransactionMgr(); XtraReport printout; try { transaction.BeginTransaction(); printout = WorkflowReportFactory.CreateGRNFPrintout(ReceiptID, null, false, FiscalYear.Current); var receipt = new BLL.Receipt(ReceiptID); var recDoc = new ReceiveDoc(); recDoc.LoadByReceiptID(ReceiptID); if (receipt.ReceiptInvoice.PO.PurchaseType == BLL.POType.STORE_TO_STORE_TRANSFER || !BLL.Settings.HandleGRV) { recDoc.ConfirmGRVPrinted(CurrentContext.UserId); BLL.Receipt receiptStatus = new BLL.Receipt(); receiptStatus.LoadByPrimaryKey(ReceiptID); receiptStatus.ChangeStatus(ReceiptConfirmationStatus.Constants.GRV_PRINTED, null, this.GetFormIdentifier(), CurrentContext.UserId, "Transfer Confirmed"); } else { recDoc.ConfirmGRNFPrinted(CurrentContext.UserId); BLL.Receipt receiptStatus = new BLL.Receipt(); receiptStatus.LoadByPrimaryKey(ReceiptID); receiptStatus.ChangeStatus(ReceiptConfirmationStatus.Constants.GRNF_PRINTED, null, this.GetFormIdentifier(), CurrentContext.UserId, "GRNF Printed"); } transaction.CommitTransaction(); } catch (Exception exception) { transaction.RollbackTransaction(); XtraMessageBox.Show(exception.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); throw; } for (int i = 0; i < printDialog.PrinterSettings.Copies; i++) { printout.Print(printDialog.PrinterSettings.PrinterName); } ReceiptConfirmation_Load(null, null); } else { XtraMessageBox.Show("The selected receipt has to be confirmed before GRNF is printed!", "ERROR", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); } } }
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(); }
private void btnPrint_Click(object sender, EventArgs e) { DataRow dataRow = gridReceiveView.GetFocusedDataRow(); if (dataRow != null) { if (Convert.ToInt32(dataRow["ReceiptConfirmationStatusID"]) == ReceiptConfirmationStatus.Constants.RECEIVE_QUANTITY_CONFIRMED) { ReceiptID = Convert.ToInt32(dataRow["ReceiptID"]); PrintDialog printDialog = new PrintDialog(); printDialog.PrinterSettings.Copies = BLL.Settings.GRNFCopies; DialogResult dialogResult = printDialog.ShowDialog(); if (dialogResult != DialogResult.OK) { MessageBox.Show("Printing Canceled by user", "Cancel Printint...", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); return; } TransactionMgr transaction = TransactionMgr.ThreadTransactionMgr(); XtraReport printout; try { transaction.BeginTransaction(); printout = WorkflowReportFactory.CreateGRNFPrintout(ReceiptID, null, false, FiscalYear.Current); var receipt = new BLL.Receipt(ReceiptID); var recDoc = new ReceiveDoc(); recDoc.LoadByReceiptID(ReceiptID); if (receipt.ReceiptInvoice.PO.PurchaseType == BLL.POType.STORE_TO_STORE_TRANSFER || !BLL.Settings.HandleGRV) { recDoc.ConfirmGRVPrinted(CurrentContext.UserId); BLL.Receipt receiptStatus = new BLL.Receipt(); receiptStatus.LoadByPrimaryKey(ReceiptID); receiptStatus.ChangeStatus(ReceiptConfirmationStatus.Constants.GRV_PRINTED, null, this.GetFormIdentifier(), CurrentContext.UserId, "Transfer Confirmed"); } else { recDoc.ConfirmGRNFPrinted(CurrentContext.UserId); BLL.Receipt receiptStatus = new BLL.Receipt(); receiptStatus.LoadByPrimaryKey(ReceiptID); receiptStatus.ChangeStatus(ReceiptConfirmationStatus.Constants.GRNF_PRINTED, null, this.GetFormIdentifier(), CurrentContext.UserId, "GRNF Printed"); } transaction.CommitTransaction(); } catch (Exception exception) { transaction.RollbackTransaction(); XtraMessageBox.Show(exception.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); throw; } for (int i = 0; i < printDialog.PrinterSettings.Copies; i++) { printout.Print( printDialog.PrinterSettings.PrinterName); } ReceiptConfirmation_Load(null, null); } else { XtraMessageBox.Show("The selected receipt has to be confirmed before GRNF is printed!", "ERROR", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); } } }