Пример #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="receiptID"></param>
        /// <param name="referenceNumber"></param>
        /// <param name="preGRVorGRV">1-Pre-GRV, 2-GRV</param>
        private void PrintReceiptConfirmation(int receiptID)
        {
            var printout = WorkflowReportFactory.CreateGRNFPrintout(receiptID, null, false, FiscalYear.Current);

            if (printout.PrintDialog() != System.Windows.Forms.DialogResult.OK)
            {
                throw new Exception("Print cancelled by user!");
            }
        }
        private XtraReport GetReport()
        {
            DataRow    dr     = viewChoices.GetFocusedDataRow();
            XtraReport report = null;

            if (dr != null)
            {
                int id = Convert.ToInt32(dr["ID"]);
                switch (documentType.EditValue.ToString())
                {
                case "GRNF":
                    report = WorkflowReportFactory.CreateGRNFPrintout(id);
                    break;

                case "GRV":
                case "SRM":
                case "iGRV":
                    report = WorkflowReportFactory.CreateReceiptPrintout(CurrentContext.LoggedInUserName, id);
                    break;

                case "Cost":
                    report = WorkflowReportFactory.CreateCostAnalysis(id);
                    break;

                case "STV":
                case "Cash":
                case "Credit":
                {
                    report = WorkflowReportFactory.CreateInvoice(id);
                }
                break;
                }
                printControl1.PrintingSystem = report.PrintingSystem;
                SetTextWatermark(report);
            }
            return(report);
        }
Пример #3
0
        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);
                }
            }
        }