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);
        }
        //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))
            {
                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();
            }
        }
Exemple #3
0
        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 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 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);
            }
        }
        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();
        }
Exemple #7
0
        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);
        }