private void btnVoidRequest_Click(object sender, EventArgs e) { if ( XtraMessageBox.Show(UserLookAndFeel.Default, "Are you sure, you want to request void for this Document?", "Are you sure:", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { int receiptID = Convert.ToInt32(gridReceiveView.GetFocusedDataRow()["ReceiptID"].ToString()); var grv = new ReceiptConfirmationPrintout(); grv.Where.ReceiptID.Value = receiptID; grv.Query.Load(); while (!grv.EOF) { grv.VoidRequestUserID = CurrentContext.UserId; grv.VoidRequest = true; grv.VoidRequestDateTime = DateTimeHelper.ServerDateTime; grv.MoveNext(); } grv.Save(); this.LogActivity("Request-Receipt-Void", ReceiptID); XtraMessageBox.Show("Void requested.", "Success"); } }
/// <summary> /// Returns a datatable with the following column layout. /// (GRV,AccountName,ID,PrintedDate, IsVoid) /// </summary> /// <param name="IDPrinted"></param> /// <returns></returns> public static DataTable GetListOfGRVPrinted(int idPrinted) { var query = HCMIS.Repository.Queries.ReceiptConfirmationPrintout.SelectGetListOfGRVPrinted(idPrinted); var receiptConfirmationPrintout = new ReceiptConfirmationPrintout(); receiptConfirmationPrintout.LoadFromRawSql(query); return receiptConfirmationPrintout.DefaultView.Table; }
/// <summary> /// Returns a datatable with the following column layout. /// (GRV,AccountName,ID,PrintedDate, IsVoid) /// </summary> /// <param name="IDPrinted"></param> /// <returns></returns> public static DataTable GetListOfSRMPrinted(int idPrinted) { var query = HCMIS.Repository.Queries.ReceiptConfirmationPrintout.SelectGetListOfSRMPrinted(idPrinted); var receiptConfirmationPrintout = new ReceiptConfirmationPrintout(); receiptConfirmationPrintout.LoadFromRawSql(query); return(receiptConfirmationPrintout.DefaultView.Table); }
public static XtraReport CreateCostAnalysis(int receiptConfirmationPrintoutID) { BLL.ReceiptConfirmationPrintout receiptPrintout = new BLL.ReceiptConfirmationPrintout(); receiptPrintout.LoadByPrimaryKey(receiptConfirmationPrintoutID); if (BLL.Settings.IsCenter) { return(GetCostBuildUpPrintout(receiptPrintout.IDPrinted.ToString("00000"), receiptPrintout.ReceiptID)); } return(GetCostAnalysisPrintout(receiptPrintout.IDPrinted.ToString("00000"), receiptPrintout.ReceiptID)); }
public static XtraReport CreateGRNFPrintout(int receiptConfirmationPrintoutID) { BLL.ReceiptConfirmationPrintout receiptPrintout = new BLL.ReceiptConfirmationPrintout(); receiptPrintout.LoadByPrimaryKey(receiptConfirmationPrintoutID); FiscalYear fiscalYear = new FiscalYear(); fiscalYear.LoadByPrimaryKey(receiptPrintout.FiscalYearID); return(CreateGRNFPrintout(receiptPrintout.ReceiptID, receiptPrintout.IDPrinted, true, fiscalYear)); }
/// <summary> /// Only for the exporting of Receipt Printouts (GRV, iGRV, SRM, Delivery Note) /// </summary> /// <param name="receiptConfirmationPrintoutID"></param> /// <returns></returns> public static XtraReport CreateReceiptPrintout(string printedBy, int receiptConfirmationPrintoutID) { BLL.ReceiptConfirmationPrintout rcp = new BLL.ReceiptConfirmationPrintout(); rcp.LoadByPrimaryKey(receiptConfirmationPrintoutID); FiscalYear fiscalYear = new FiscalYear(); fiscalYear.LoadByPrimaryKey(rcp.FiscalYearID); if (rcp.RowCount > 0 && !rcp.IsColumnNull("ReceiptID")) { return(PrintReceiptConfirmation(printedBy, rcp.ReceiptID, rcp.ID, true, fiscalYear)); } return(null); }
/// <summary> /// Gets the GRNF no. /// </summary> /// <param name="ReceiptID">The receipt ID.</param> /// <returns></returns> public static int GetGRNFNo(int ReceiptID) { BLL.ReceiptConfirmationPrintout rc = new ReceiptConfirmationPrintout(); var query = HCMIS.Repository.Queries.ReceiptConfirmationPrintout.SelectGetGRNFNo(ReceiptID); rc.LoadFromRawSql(query); int printedID; try { printedID = int.Parse(rc.GetColumn("IDPrinted").ToString()); } catch { printedID = 0; } return printedID; }
private void Search() { if (txtDocumentNumber.Text == "") { return; } printControl1.PrintingSystem = null; printControl1.Refresh(); int searchID = Convert.ToInt32(txtDocumentNumber.Text); DataTable dtChoices = null; switch (documentType.EditValue.ToString()) { case "GRNF": case "Cost": dtChoices = ReceiptConfirmationPrintout.GetListOfGRNFPrinted(searchID); break; case "STV": case "Cash": case "Credit": dtChoices = BLL.Issue.Search(txtDocumentNumber.Text, documentType.EditValue.ToString()); break; case "GRV": dtChoices = BLL.ReceiptConfirmationPrintout.GetListOfGRVPrinted(searchID); break; case "SRM": dtChoices = BLL.ReceiptConfirmationPrintout.GetListOfSRMPrinted(searchID); break; case "iGRV": dtChoices = BLL.ReceiptConfirmationPrintout.GetListOfiGRVPrinted(searchID); break; } viewChoices.Columns.Clear(); gridChoices.DataSource = dtChoices; if (dtChoices != null) { viewChoices.Columns["ID"].Visible = false; viewChoices.Columns["IsVoid"].Visible = false; } }
/// <summary> /// Gets the GRNF no. /// </summary> /// <param name="ReceiptID">The receipt ID.</param> /// <returns></returns> public static int GetGRNFNo(int ReceiptID) { BLL.ReceiptConfirmationPrintout rc = new ReceiptConfirmationPrintout(); var query = HCMIS.Repository.Queries.ReceiptConfirmationPrintout.SelectGetGRNFNo(ReceiptID); rc.LoadFromRawSql(query); int printedID; try { printedID = int.Parse(rc.GetColumn("IDPrinted").ToString()); } catch { printedID = 0; } return(printedID); }
private void btnVoid_Click(object sender, EventArgs e) { if (XtraMessageBox.Show(DevExpress.LookAndFeel.UserLookAndFeel.Default, "Are you sure, you want to Void the Document?", "Are you sure:", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == System.Windows.Forms.DialogResult.Yes) { ReceiptConfirmationPrintout receiptVoidlog = new ReceiptConfirmationPrintout(); receiptVoidlog.AddNew(); receiptVoidlog.VoidRequestUserID = CurrentContext.UserId; receiptVoidlog.VoidRequest = true; receiptVoidlog.VoidApprovedByUserID = CurrentContext.UserId; receiptVoidlog.VoidRequestDateTime = DateTimeHelper.ServerDateTime; receiptVoidlog.VoidApprovalDateTime = DateTimeHelper.ServerDateTime; receiptVoidlog.UserID = CurrentContext.UserId; int receiptID = Convert.ToInt32(gridReceiveView.GetFocusedDataRow()["ReceiptID"].ToString()); receiptVoidlog.ReceiptID = receiptID; ReturnToStoreForQuantityEdit(); } }
//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 static ReceiptConfirmationShortagePrintout PrintReceiptConfirmationForShortage(int receiptID, int printedID, FiscalYear fiscalYear) { var printout = new ReceiptConfirmationShortagePrintout(); var rc = new BLL.ReceiptConfirmationPrintout(); var receiveDoc = new ReceiveDoc(); var receipt = new BLL.Receipt(); receiveDoc.LoadByReceiptID(receiptID); receipt.LoadByPrimaryKey(receiptID); var referenceNumber = receiveDoc.RefNo; if (receipt.ReceiptTypeID == ReceiptType.CONSTANTS.STANDARD_RECEIPT) { rc.PrepareDataForPrintout(receiptID, CurrentContext.UserId, true, 2, printedID, null, fiscalYear); printout.DataSource = rc.DefaultView.ToTable(); } return(printout); }
private void btnCancelVoidRequest_Click(object sender, EventArgs e) { if (XtraMessageBox.Show(DevExpress.LookAndFeel.UserLookAndFeel.Default, "Are you sure, you want to request void for this Document?", "Are you sure:", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == System.Windows.Forms.DialogResult.Yes) { int receiptID = Convert.ToInt32(gridReceiveView.GetFocusedDataRow()["ReceiptID"].ToString()); ReceiptConfirmationPrintout grv = new ReceiptConfirmationPrintout(); grv.Where.ReceiptID.Value = receiptID; grv.Query.Load(); while (!grv.EOF) { grv.SetColumnNull("VoidRequestUserID"); grv.VoidRequest = true; grv.SetColumnNull("VoidRequestDateTime"); grv.MoveNext(); } grv.Save(); XtraMessageBox.Show("Void request cancelled.", "Success"); } }
private void LoadReceiptDescriptions() { if (radioGpC.EditValue == null || lkAccount.EditValue == null) { return; } rctPrintout = new BLL.ReceiptConfirmationPrintout(); if (radioGpC.EditValue.ToString() == "GRV") { rctPrintout.GetGRVAndiGRVDescriptions(Convert.ToInt32(lkAccount.EditValue)); } else if (radioGpC.EditValue.ToString() == "GRNF") { rctPrintout.GetGRNFDescriptions(Convert.ToInt32(lkAccount.EditValue)); } else if (radioGpC.EditValue.ToString() == "SRM") { rctPrintout.GetSRMDescriptions(Convert.ToInt32(lkAccount.EditValue)); grdViewSTVForChecking.Columns["Supplier"].Caption = "Returned From"; } grdSTVs.DataSource = rctPrintout.DefaultView; }
private void LoadReceiptDescriptions() { if(radioGpC.EditValue == null || lkAccount.EditValue == null) { return; } rctPrintout = new BLL.ReceiptConfirmationPrintout(); if (radioGpC.EditValue.ToString() == "GRV") { rctPrintout.GetGRVAndiGRVDescriptions(Convert.ToInt32(lkAccount.EditValue)); } else if (radioGpC.EditValue.ToString() == "GRNF") { rctPrintout.GetGRNFDescriptions(Convert.ToInt32(lkAccount.EditValue)); } else if (radioGpC.EditValue.ToString() == "SRM") { rctPrintout.GetSRMDescriptions(Convert.ToInt32(lkAccount.EditValue)); grdViewSTVForChecking.Columns["Supplier"].Caption = "Returned From"; } grdSTVs.DataSource = rctPrintout.DefaultView; }
private void PrintReceiptConfirmation(string referenceNumber, int? reprintOfReceiptConfirmationPrintoutID) { ReceiptConfirmationPrintout rc = new ReceiptConfirmationPrintout(); HCMIS.Desktop.Reports.ReceiptConfirmationPrintout printout = new HCMIS.Desktop.Reports.ReceiptConfirmationPrintout(CurrentContext.LoggedInUserName); HCMIS.Desktop.Reports.SRMPrintout srmPrintout = new HCMIS.Desktop.Reports.SRMPrintout(CurrentContext.LoggedInUserName); int ReceiptID = Convert.ToInt32(gridReceiveView.GetFocusedDataRow()["ReceiptID"]); BLL.ReceiveDoc receiveDoc = new ReceiveDoc(); // receiveDoc.LoadByReferenceNo(reference); receiveDoc.LoadByReceiptID(ReceiptID); BLL.Supplier supplier = new Supplier(); supplier.LoadByPrimaryKey(receiveDoc.SupplierID); int printedID = 0; int GRNFNo = BLL.ReceiptConfirmationPrintout.GetGRNFNo(ReceiptID); if (currentMode == Modes.DeliveryNotePrinting) { printout.BranchName.Text = GeneralInfo.Current.HospitalName; printout.xrGRVLabel.Text = "Delivery Note."; 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.Visible = false; printout.xrInvoiceNoValue.Visible = false; printout.xrPurchaseOrderNo.Visible = false; printout.xrPurchaseOrderNoValue.Visible = false; printout.xrSTV.Visible = false; printout.xrSTVNoValue.Visible = false; printout.DataSource = rc.PrepareDataForPrintout(ReceiptID, CurrentContext.UserId, false, 5, null, reprintOfReceiptConfirmationPrintoutID,FiscalYear.Current); CalendarLib.DateTimePickerEx dtDate = new CalendarLib.DateTimePickerEx(); //dtDate.CustomFormat = "dd/MM/yyyy"; dtDate.Value = receiveDoc.EurDate; printout.Date.Text = dtDate.Text; } var activity = new Activity(); activity.LoadByPrimaryKey(receiveDoc.StoreID); printout.xrLabelStoreName.Text = activity.FullActivityName; if (ReceiveDoc.IsThereShortageOrDamage(ReceiptID)) { HCMIS.Desktop.Reports.ReceiptConfirmationShortagePrintout printoutShortage = PrintReceiptConfirmationForShortage(referenceNumber, printedID); printout.xrShortageReport.ReportSource = printoutShortage; printout.PrintingSystem.ContinuousPageNumbering = true; } else { printout.ReportFooter.Visible = false; } //Successfully printed //Release Product CostCalculator GRV = new CostCalculator(); GRV.LoadGRV(ReceiptID); GRV.ReleaseForIssue(); String reference = gridReceiveView.GetFocusedDataRow()["RefNo"].ToString(); BLL.ReceiveDoc recDoc = new ReceiveDoc(); recDoc.LoadByReferenceNo(reference); recDoc.ConfirmGRVPrinted(CurrentContext.UserId); BindFormContents(); }
private void btnVoid_Click(object sender, EventArgs e) { int receiptID = Convert.ToInt32(gridReceiveView.GetFocusedDataRow()["ReceiptID"].ToString()); if(BLL.Receipt.AreThereIssues(receiptID)) { if (CurrentContext.LoggedInUser.UserType == UserType.Constants.FINANCE) //Allow only the manager to void the GRV. { if(XtraMessageBox.Show("There are issues with this GRV. Are you sure you want to void it anyway?","Confirmation",MessageBoxButtons.YesNo,MessageBoxIcon.Warning)==DialogResult.No) { return; } } else { XtraMessageBox.Show("There are issues with this GRV. You can't void it."); return; } } ReceiptConfirmationPrintout grv = new ReceiptConfirmationPrintout(); grv.Where.ReceiptID.Value = receiptID; grv.Query.Load(); if (!grv.VoidRequest) { XtraMessageBox.Show("Void needs to be first requested.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (XtraMessageBox.Show(DevExpress.LookAndFeel.UserLookAndFeel.Default, "Are you sure, you want to Void the Document?", "Are you sure:", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == System.Windows.Forms.DialogResult.Yes) { while (!grv.EOF) { grv.IsVoided = true; grv.VoidApprovedByUserID = CurrentContext.UserId; grv.VoidApprovalDateTime = DateTimeHelper.ServerDateTime; grv.MoveNext(); } grv.Save(); ReturnToStoreForQuantityEdit(); } }
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 btnCancelVoidRequest_Click(object sender, EventArgs e) { if ( XtraMessageBox.Show(UserLookAndFeel.Default, "Are you sure, you want to request void for this Document?", "Are you sure:", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { int receiptID = Convert.ToInt32(gridReceiveView.GetFocusedDataRow()["ReceiptID"].ToString()); var grv = new ReceiptConfirmationPrintout(); grv.Where.ReceiptID.Value = receiptID; grv.Query.Load(); while (!grv.EOF) { grv.VoidRequest = false; grv.MoveNext(); } grv.Save(); this.LogActivity("Cancel-Void-Request", ReceiptID); XtraMessageBox.Show("Void request cancelled.", "Success"); } }
/// <summary> /// /// </summary> /// <param name="refNo"></param> /// <param name="userID"></param> /// <param name="shortageAndDamage"></param> /// <param name="preGRVOrGRVOrSRM">1-PreGRV, 2-GRV, 3-SRM, 4-iGRV, 5-DeliveryNote</param> /// <param name="IDToBePrintedOut">Only applicable for the shortage where we need to show the same ID</param> /// <returns></returns> public int PrepareDataForPrintout(int ReceiptID, int? userID, bool shortageAndDamage, int preGRVOrGRVOrSRM, int? IDToBePrintedOut, int? isReprintOfRCPrintoutID,FiscalYear fiscalYear) { string query = ""; if (!shortageAndDamage && preGRVOrGRVOrSRM != 3) { query = HCMIS.Repository.Queries.ReceiptConfirmationPrintout.SelectPrepareDataForPrintout(ReceiptID, StorageType.Quaranteen); } else if (preGRVOrGRVOrSRM == 3)//SRM { BLL.ReceiveDoc rd = new ReceiveDoc(); rd.LoadAllByReceiptID(ReceiptID); if (rd.IsColumnNull("ReturnedFromIssueDocID")) //This is an SRM done for an issue from the old system. (The issue was done using the old system) { query = HCMIS.Repository.Queries.ReceiptConfirmationPrintout.SelectPrepareDataForPrintoutIssueDone(ReceiptID); } else //This is a normal SRM (Both the issue and the receive were done using this system) { query = HCMIS.Repository.Queries.ReceiptConfirmationPrintout.SelectPrepareDataForPrintoutIssueAndReceiveDone(ReceiptID); } } else { //Cost Calculations should be removed from the query below query = HCMIS.Repository.Queries.ReceiptConfirmationPrintout.SelectPrepareDataForPrintout(ReceiptID); } this.LoadFromRawSql(query); if (this.RowCount == 0) { if (ReceiveDoc.IsThereShortageOrDamage(ReceiptID)) { query = HCMIS.Repository.Queries.ReceiptConfirmationPrintout.SelectPrepareDataForPrintout(ReceiptID); this.LoadFromRawSql(query); } if (this.RowCount == 0) throw new Exception("No Data To Print, please receive Document before Trying again"); } this.Rewind(); this.AddColumn("LineNum", typeof(int)); this.AddColumn("PrintedGRVNumber", typeof(string)); BLL.Receipt receipt = new Receipt(); int receiptID = int.Parse(this.GetColumn("ReceiptID").ToString()); receipt.LoadByPrimaryKey(receiptID); int receiptTypeID = receipt.ReceiptTypeID; int printedGRVNumber; int lineNum = 1; int totalItems = 0; BLL.ReceiptConfirmationPrintout rcp = new ReceiptConfirmationPrintout(); int? supplierID = null; if (preGRVOrGRVOrSRM != 3) supplierID = this.SupplierID; if (IDToBePrintedOut.HasValue) { printedGRVNumber = IDToBePrintedOut.Value; } else { printedGRVNumber = rcp.AddNew(this.StoreID, supplierID, receiptTypeID == 2 ? null : userID, receipt.ID, preGRVOrGRVOrSRM, isReprintOfRCPrintoutID); } if (!IDToBePrintedOut.HasValue) //We want to save a new receipt confirmation printout only when a new ID is generated (Not when an ID to be printed has been passed as a parameter) { //For delivery note only, we don't save the saved by user id so that we don't say GRV has been printed. } while (!this.EOF) { this.SetColumn("LineNum", lineNum); lineNum++; this.SetColumn("PrintedGRVNumber", fiscalYear.GetCode(printedGRVNumber)); totalItems++; this.MoveNext(); } return printedGRVNumber; }
public static XtraReport PrintReceiptConfirmation(string printedBy, int receiptID, int?previousReceiptConfirmationPrintoutID, bool forExporting, FiscalYear fiscalYear) { var rcPrevious = new BLL.ReceiptConfirmationPrintout(); int?idToBePrintedOut = null; if (forExporting && previousReceiptConfirmationPrintoutID.HasValue) { rcPrevious.LoadByPrimaryKey(previousReceiptConfirmationPrintoutID.Value); idToBePrintedOut = rcPrevious.IDPrinted; } var rc = new BLL.ReceiptConfirmationPrintout(); var printout = new HCMIS.Desktop.Reports.ReceiptConfirmationPrintout(printedBy); var srmPrintout = new HCMIS.Desktop.Reports.SRMPrintout(printedBy); var receiveDoc = new ReceiveDoc(); var receipt = new BLL.Receipt(); receipt.LoadByPrimaryKey(receiptID); receiveDoc.LoadByReceiptID(receiptID); var referenceNumber = receiveDoc.RefNo; var activity = new Activity(); activity.LoadByPrimaryKey(receiveDoc.StoreID); var supplier = new Supplier(); supplier.LoadByPrimaryKey(receiveDoc.SupplierID); int printedID = 0; string GRNFNo = fiscalYear.GetCode(BLL.ReceiptConfirmationPrintout.GetGRNFNo(receiptID)); if (receipt.ReceiptTypeID == ReceiptType.CONSTANTS.STANDARD_RECEIPT || receipt.ReceiptTypeID == ReceiptType.CONSTANTS.DELIVERY_NOTE || receipt.ReceiptTypeID == ReceiptType.CONSTANTS.ACCOUNT_TO_ACCOUNT_TRANSFER) { if (!String.IsNullOrEmpty(GeneralInfo.Current.HospitalName)) { printout.BranchName.Text = GeneralInfo.Current.HospitalName; } else { throw new Exception("Branch name could not be read from the database."); } PrepareGRVPrintout(printout); // String reference = gridReceiveView.GetFocusedDataRow()["RefNo"].ToString(); 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, idToBePrintedOut, previousReceiptConfirmationPrintoutID, fiscalYear); printout.DataSource = rc.DefaultView.ToTable(); var dtDate = new 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, idToBePrintedOut, previousReceiptConfirmationPrintoutID, fiscalYear); printout.xrLabelGRNF.Text = GRNFNo; printout.DataSource = rc.DefaultView.ToTable(); var dtDate = new DateTimePickerEx(); //dtDate.CustomFormat = "dd/MM/yyyy"; dtDate.Value = receiveDoc.EurDate; printout.Date.Text = dtDate.Text; } printout.xrLabelStoreName.Text = activity.FullActivityName; if (ReceiveDoc.IsThereShortageOrDamage(receiptID)) { ReceiptConfirmationShortagePrintout printoutShortage = PrintReceiptConfirmationForShortage(receiptID, printedID, fiscalYear); PrepareGRVPrintout(printoutShortage); printout.xrShortageReport.ReportSource = printoutShortage; printout.PrintingSystem.ContinuousPageNumbering = true; } else { printout.ReportFooter.Visible = false; } if (!forExporting) //If this is not for exporting, we print on paper. { if (printout.PrintDialog() != DialogResult.OK) { throw new Exception("Print cancelled by user!"); } } return(printout); } else if (receipt.ReceiptTypeID == ReceiptType.CONSTANTS.STOCK_RETURN) { if (!String.IsNullOrEmpty(GeneralInfo.Current.HospitalName)) { srmPrintout.BranchName.Text = GeneralInfo.Current.HospitalName; } rc.PrepareDataForPrintout(receiptID, CurrentContext.UserId, false, 3, idToBePrintedOut, previousReceiptConfirmationPrintoutID, fiscalYear); 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 Issue(); stvLog.LoadByPrimaryKey(idoc.STVID); var issuedActivity = new Activity(); issuedActivity.LoadByPrimaryKey(idoc.StoreId); srmPrintout.xrAccountName.Text = issuedActivity.FullActivityName; srmPrintout.xrSTVNoValue.Text = stvLog.IDPrinted.ToString("00000"); } else { srmPrintout.xrAccountName.Text = activity.FullActivityName;; srmPrintout.xrSTVNoValue.Text = receiveDoc.RefNo; } var dtDate = new DateTimePickerEx(); dtDate.Value = receiveDoc.EurDate; srmPrintout.Date.Text = dtDate.Text; if (!forExporting) { if (srmPrintout.PrintDialog() != DialogResult.OK) { throw new Exception("Print cancelled by user!"); } } return(srmPrintout); } else //TODO: Implement Delivery notes. { return(null); } }
/// <summary> /// /// </summary> /// <param name="refNo"></param> /// <param name="userID"></param> /// <param name="shortageAndDamage"></param> /// <param name="preGRVOrGRVOrSRM">1-PreGRV, 2-GRV, 3-SRM, 4-iGRV, 5-DeliveryNote</param> /// <param name="IDToBePrintedOut">Only applicable for the shortage where we need to show the same ID</param> /// <returns></returns> public int PrepareDataForPrintout(int ReceiptID, int?userID, bool shortageAndDamage, int preGRVOrGRVOrSRM, int?IDToBePrintedOut, int?isReprintOfRCPrintoutID, FiscalYear fiscalYear) { string query = ""; if (!shortageAndDamage && preGRVOrGRVOrSRM != 3) { query = HCMIS.Repository.Queries.ReceiptConfirmationPrintout.SelectPrepareDataForPrintout(ReceiptID, StorageType.Quaranteen); } else if (preGRVOrGRVOrSRM == 3)//SRM { BLL.ReceiveDoc rd = new ReceiveDoc(); rd.LoadAllByReceiptID(ReceiptID); if (rd.IsColumnNull("ReturnedFromIssueDocID")) //This is an SRM done for an issue from the old system. (The issue was done using the old system) { query = HCMIS.Repository.Queries.ReceiptConfirmationPrintout.SelectPrepareDataForPrintoutIssueDone(ReceiptID); } else //This is a normal SRM (Both the issue and the receive were done using this system) { query = HCMIS.Repository.Queries.ReceiptConfirmationPrintout.SelectPrepareDataForPrintoutIssueAndReceiveDone(ReceiptID); } } else { //Cost Calculations should be removed from the query below query = HCMIS.Repository.Queries.ReceiptConfirmationPrintout.SelectPrepareDataForPrintout(ReceiptID); } this.LoadFromRawSql(query); if (this.RowCount == 0) { if (ReceiveDoc.IsThereShortageOrDamage(ReceiptID)) { query = HCMIS.Repository.Queries.ReceiptConfirmationPrintout.SelectPrepareDataForPrintout(ReceiptID); this.LoadFromRawSql(query); } if (this.RowCount == 0) { throw new Exception("No Data To Print, please receive Document before Trying again"); } } this.Rewind(); this.AddColumn("LineNum", typeof(int)); this.AddColumn("PrintedGRVNumber", typeof(string)); BLL.Receipt receipt = new Receipt(); int receiptID = int.Parse(this.GetColumn("ReceiptID").ToString()); receipt.LoadByPrimaryKey(receiptID); int receiptTypeID = receipt.ReceiptTypeID; int printedGRVNumber; int lineNum = 1; int totalItems = 0; BLL.ReceiptConfirmationPrintout rcp = new ReceiptConfirmationPrintout(); int?supplierID = null; if (preGRVOrGRVOrSRM != 3) { supplierID = this.SupplierID; } if (IDToBePrintedOut.HasValue) { printedGRVNumber = IDToBePrintedOut.Value; } else { printedGRVNumber = rcp.AddNew(this.StoreID, supplierID, receiptTypeID == 2 ? null : userID, receipt.ID, preGRVOrGRVOrSRM, isReprintOfRCPrintoutID); } if (!IDToBePrintedOut.HasValue) //We want to save a new receipt confirmation printout only when a new ID is generated (Not when an ID to be printed has been passed as a parameter) { //For delivery note only, we don't save the saved by user id so that we don't say GRV has been printed. } while (!this.EOF) { this.SetColumn("LineNum", lineNum); lineNum++; this.SetColumn("PrintedGRVNumber", fiscalYear.GetCode(printedGRVNumber)); totalItems++; this.MoveNext(); } return(printedGRVNumber); }
/// <summary> /// Returns an extra report containing the GRNF. /// This function is used for creating the report for the first time as well (Not just export). Which is why we can't /// just use the overload with the ReceiptConfirmationPrintoutID as a parameter. /// </summary> /// <param name="receiptID"></param> /// <param name="IDPrinted">Use this if you're trying to get a GRNF printed previously using some ID</param> /// <param name="isDocumentBrowser">Use this For Docuement Browser </param> /// <returns></returns> public static XtraReport CreateGRNFPrintout(int receiptID, int?IDPrinted, bool isDocumentBrowser, FiscalYear fiscalYear) { ReceiptConfirmationPrintoutStore printout = new ReceiptConfirmationPrintoutStore(CurrentContext.LoggedInUserName); BLL.ReceiptConfirmationPrintout rc = new BLL.ReceiptConfirmationPrintout(); printout.BranchName.Text = GeneralInfo.Current.HospitalName; printout.xrGRVLabel.Text = "GRNF No."; int printedID; BLL.ReceiveDoc rDoc = new ReceiveDoc(); rDoc.LoadByReceiptID(receiptID); var activity = new Activity(); activity.LoadByPrimaryKey(rDoc.StoreID); var supplier = new Supplier(); supplier.LoadByPrimaryKey(rDoc.SupplierID); var hsup = new Supplier(); DataTable homeOffice = hsup.GetHubHeadOffice(); if (supplier.ID == (int)homeOffice.Rows[0]["SupplierID"] && !Settings.IsCenter) { printout.ReportType = ReceiptConfirmationPrintoutStore.GRNFReportType.IGRV; } else if (supplier.ID != (int)homeOffice.Rows[0]["SupplierID"]) { printout.ReportType = ReceiptConfirmationPrintoutStore.GRNFReportType.GRV; } if (rDoc.RowCount == 0 && isDocumentBrowser) { rDoc.LoadDeletedByReceiptID(receiptID); } else if (rDoc.RowCount == 0) { throw new Exception("This Receipt Doesn't have corresponding Receipt Doc Entries."); } if (rDoc.ReturnedStock) { BLL.Institution ru = new Institution(); BLL.IssueDoc issueDoc = new IssueDoc(); if (!rDoc.IsColumnNull("ReturnedFromIssueDocID")) { issueDoc.LoadByPrimaryKey(rDoc.ReturnedFromIssueDocID); ru.LoadByPrimaryKey(issueDoc.ReceivingUnitID); } else { BLL.PO po = new PO(); po.LoadByReceiptID(receiptID); ru.LoadByPrimaryKey(Int32.Parse(po.RefNo)); } printout.xrFromFacilityValue.Text = ru.Name; printout.ReportType = ReceiptConfirmationPrintoutStore.GRNFReportType.SRM; } // determine if this is a transfer? account to account or store to store Receipt receipt = new Receipt(); receipt.LoadByPrimaryKey(receiptID); printedID = rc.PrepareDataForPrintout(receiptID, CurrentContext.UserId, false, 1, IDPrinted, null, fiscalYear); DataTable dataTable = rc.DefaultView.ToTable(); printout.DataSource = dataTable; printout.xrLabelStoreName.Text = activity.FullActivityName; ReceiveDocConfirmation receiveDocConfirmation = new ReceiveDocConfirmation(); DataTable Users = receiveDocConfirmation.GetUserNamebyReceipt(receiptID); if (Users.Rows.Count > 0) { printout.PreparedBy.Text = Users.Rows[0]["ReceivedBy"].ToString(); printout.CheckedBy.Text = Users.Rows[0]["ConfirmedBy"].ToString(); } if (ReceiveDoc.IsThereShortageOrDamage(receiptID)) { ReceiptConfirmationShortagePrintout printoutShortage = new ReceiptConfirmationShortagePrintout(); rc.PrepareDataForPrintout(receiptID, CurrentContext.UserId, true, 1, printedID, null, fiscalYear); printoutShortage.DataSource = rc.DefaultView.ToTable(); printout.xrShortageReport.ReportSource = printoutShortage; printout.PrintingSystem.ContinuousPageNumbering = true; } else { printout.ReportFooter.Visible = false; } CalendarLib.DateTimePickerEx dtDate = new CalendarLib.DateTimePickerEx(); //dtDate.CustomFormat = "dd/MM/yyyy"; dtDate.Value = rDoc.EurDate; printout.Date.Text = dtDate.Text; if (InstitutionIType.IsVaccine(GeneralInfo.Current)) { return(CreateModel19Printout(dataTable.DefaultView.ToTable(), dtDate.Text)); } 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 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 HCMIS.Desktop.Reports.ReceiptConfirmationShortagePrintout PrintReceiptConfirmationForShortage(int ReceiptID, int printedID) { HCMIS.Desktop.Reports.ReceiptConfirmationShortagePrintout printout = new HCMIS.Desktop.Reports.ReceiptConfirmationShortagePrintout(); ReceiptConfirmationPrintout rc = new ReceiptConfirmationPrintout(); BLL.ReceiveDoc receiveDoc = new ReceiveDoc(); receiveDoc.LoadAllByReceiptID(ReceiptID); if (currentMode == Modes.GRVPrinting ) { BLL.Supplier supplier = new Supplier(); supplier.LoadByPrimaryKey(receiveDoc.SupplierID); } rc.PrepareDataForPrintout(ReceiptID, CurrentContext.UserId, true, 2, printedID,null,FiscalYear.Current); printout.DataSource = rc.DefaultView.ToTable(); return printout; }
private void btnVoid_Click(object sender, EventArgs e) { if (XtraMessageBox.Show(DevExpress.LookAndFeel.UserLookAndFeel.Default, "Are you sure, you want to Void the Document?", "Are you sure:", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == System.Windows.Forms.DialogResult.Yes) { ReceiptConfirmationPrintout receiptVoidlog = new ReceiptConfirmationPrintout(); receiptVoidlog.AddNew(); receiptVoidlog.VoidRequestUserID = CurrentContext.UserId; receiptVoidlog.VoidRequest = true; receiptVoidlog.VoidApprovedByUserID = CurrentContext.UserId; receiptVoidlog.VoidRequestDateTime = DateTimeHelper.ServerDateTime; receiptVoidlog.VoidApprovalDateTime = DateTimeHelper.ServerDateTime; receiptVoidlog.UserID = CurrentContext.UserId; int receiptID = Convert.ToInt32(gridReceiveView.GetFocusedDataRow()["ReceiptID"].ToString()); receiptVoidlog.ReceiptID = receiptID; ReturnToStoreForQuantityEdit(); } }
private HCMIS.Desktop.Reports.ReceiptConfirmationShortagePrintout PrintReceiptConfirmationForShortage(string reference, int printedID) { HCMIS.Desktop.Reports.ReceiptConfirmationShortagePrintout printout = new HCMIS.Desktop.Reports.ReceiptConfirmationShortagePrintout(); ReceiptConfirmationPrintout rc = new ReceiptConfirmationPrintout(); BLL.ReceiveDoc receiveDoc = new ReceiveDoc(); receiveDoc.LoadByReceiptID(ReceiptID); rc.PrepareDataForPrintout(ReceiptID, CurrentContext.UserId, true, 2, printedID,null,FiscalYear.Current); printout.DataSource = rc.DefaultView.ToTable(); return printout; }
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 gridViewRefNo_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { DataRow dr = gridViewRefNo.GetFocusedDataRow(); DateTime dt1 = new DateTime(); DateTime dt2 = new DateTime(); dtDate.Value = DateTimeHelper.ServerDateTime; DateTime dtCurrent = ConvertDate.DateConverter(dtDate.Text); if (dr == null) return; lblMode.Text = dr["Mode"] == DBNull.Value ? "-" : Convert.ToString(dr["Mode"]); lblAccount.Text = dr["Account"] == DBNull.Value ? "-" : Convert.ToString(dr["Account"]); lblSubAccount.Text = dr["SubAccount"] == DBNull.Value ? "-" : Convert.ToString(dr["SubAccount"]); lblActivity.Text = dr["Activity"] == DBNull.Value ? "-" : Convert.ToString(dr["Activity"]); lblSupplier.Text = dr["Supplier"] == DBNull.Value ? "-" : Convert.ToString(dr["Supplier"]); lblInvoiceNo.Text = dr["STVOrInvoiceNo"] == DBNull.Value ? "-" : Convert.ToString(dr["STVOrInvoiceNo"]); lblPaymentType.Text = dr["PaymentType"] == DBNull.Value ? "-" : Convert.ToString(dr["PaymentType"]); lblPONumber.Text = dr["PONumber"] == DBNull.Value ? "-" : Convert.ToString(dr["PONumber"]); lblPOType.Text = dr["POType"] == DBNull.Value ? "-" : Convert.ToString(dr["POType"]); lblDocumentType.Text = dr["DocumentType"] == DBNull.Value ? "-" : Convert.ToString(dr["DocumentType"]); lblCluster.Text = dr["Cluster"] == DBNull.Value ? "-" : Convert.ToString(dr["Cluster"]); lblWarehouse.Text = dr["Warehouse"] == DBNull.Value ? "-" : Convert.ToString(dr["Warehouse"]); lblPhysicalStore.Text = dr["PhysicalStore"] == DBNull.Value ? "-" : Convert.ToString(dr["PhysicalStore"]); lblReceiveType.Text = dr["ReceiptType"] == DBNull.Value ? "-" : Convert.ToString(dr["ReceiptType"]); lblReceiveStatus.Text = dr["ReceiptStatus"] == DBNull.Value ? "-" : Convert.ToString(dr["ReceiptStatus"]); lblReceivedDate.Text = dr["ReceivedDate"] == DBNull.Value ? "-" : Convert.ToDateTime(dr["ReceivedDate"]).ToShortDateString(); lblReceivedBy.Text = dr["ReceivedBy"] == DBNull.Value ? "-" : Convert.ToString(dr["ReceivedBy"]); var receiptConfirmationPrintout = new ReceiptConfirmationPrintout(); var grnfDetail = receiptConfirmationPrintout.GetReceivePrintoutDetail(Convert.ToInt32(dr["ReceiptID"]),"PGRV"); var grvDetail = receiptConfirmationPrintout.GetReceivePrintoutDetail(Convert.ToInt32(dr["ReceiptID"]), "GRV"); if (grnfDetail != null) { lblGRNFNo.Text = grnfDetail["IDPrinted"] == DBNull.Value ? "-" : Convert.ToString(grnfDetail["IDPrinted"]); lblGRNFDate.Text = grnfDetail["PrintedDate"] == DBNull.Value ? "-" : Convert.ToDateTime(grnfDetail["PrintedDate"]).ToShortDateString(); lblGRNFBy.Text = grnfDetail["FullName"] == DBNull.Value ? "-" : Convert.ToString(grnfDetail["FullName"]); } if (grvDetail != null) { lblGRVDate.Text = grvDetail["PrintedDate"] == DBNull.Value ? "-" : Convert.ToDateTime(grvDetail["PrintedDate"]).ToShortDateString(); lblGRVBy.Text = grvDetail["FullName"] == DBNull.Value ? "-" : Convert.ToString(grvDetail["FullName"]); } string ReferenceNo = dr["RefNo"].ToString(); if (ReferenceNo != "") { gridTransactions.DataSource = null; ReceiveDoc rec = new ReceiveDoc(); DataTable dtRec = new DataTable(); if (ReferenceNo == "0") { int yr = ((dtCurrent.Month > 10) ? dtCurrent.Year : dtCurrent.Year - 1); dt1 = new DateTime(yr, 11, 1); dt2 = new DateTime(dtCurrent.Year, dtCurrent.Month, dtCurrent.Day); dtRec = rec.GetTransactionByDateRange(Convert.ToInt32(cboStores.EditValue), dt1, dt2); //lblRecDate.Text = "Current Year";// ( " + dtCurrent.Year + " )"; } else if (ReferenceNo == "1") { int yr = ((dtCurrent.Month > 10) ? dtCurrent.Year : dtCurrent.Year - 1); dt1 = new DateTime(1980, 11, 1); dt2 = new DateTime(yr, 10, 30); dtRec = rec.GetTransactionByDateRange(Convert.ToInt32(cboStores.EditValue), dt1, dt2); //lblRecDate.Text = "Past Year(s)"; } else { dtRec = rec.GetTransactionByRefNo(ReferenceNo, Convert.ToInt32(cboStores.EditValue), dr["Date"].ToString()); //lblRecDate.Text = Convert.ToDateTime(ReferenceNo[1]).ToString("MM dd,yyyy"); } PopulateTransactions(dtRec); } }