Exemplo n.º 1
0
        /// <summary>
        /// Print delivery sheet
        /// </summary>
        protected virtual void PrintSheet(IvsUserControl masterControl)
        {
            if (this.btnPrintSheet.Visibility == DevExpress.XtraBars.BarItemVisibility.Never || this.btnPrintSheet.Enabled == false)
            {
                return;
            }

            StockTransactionBl stocktransactionBl = new StockTransactionBl();

            stockMasterDto           = (ST_StockTransactionMasterDto)this.Dto;
            transactionMasterControl = masterControl;
            DataTable stockMasterDt = new DataTable();
            int       rows          = 0;
            int       returnCode    = stocktransactionBl.SearchMaster(stockMasterDto, out stockMasterDt, out rows);

            if (!CommonMethod.IsNullOrEmpty(stockMasterDt))
            {
                printedCount = CommonMethod.ParseInt32(stockMasterDt.Rows[0][CommonKey.DeliverySheetPrintCount]);
                stockMasterDto.DeliverySheetPrintCount = printedCount;
                if (printedCount == 0)
                {
                    printedCount = printedCount + 1;
                    this.ShowReport(printedCount);
                    this.UpdateStockTransactionMasterForCountingPrint(printedCount, string.Empty);
                    var collection = masterControl.Controls.Find("txtPrintCount", true);
                    if (collection.Length > 0)
                    {
                        Ivs.Controls.CustomControls.WinForm.IvsTextEdit chk = (Ivs.Controls.CustomControls.WinForm.IvsTextEdit)collection[0];
                        chk.Text = printedCount.ToString();
                    }
                }
                else
                {
                    if (printedCount <= CommonData.PrintSheetDelivery.DeliverySheet)
                    {
                        ReasonPrintForm.ShowDialog();
                    }
                    else
                    {
                        //Display message can not print more than four times.
                        this.MessageBox = new MessageBoxs();
                        IvsMessage message = null;
                        message = new IvsMessage(CommonConstantMessage.COM_MSG_CAN_NOT_PRINT, "4");
                        this.MessageBox.Add(message);
                        this.MessageBox.Display(CommonData.MessageType.Ok);
                    }
                }
            }
        }
Exemplo n.º 2
0
        private void ReasonPrintForm_FormClosed(object sender, FormClosedEventArgs e)
        {
            MasterEditForm form             = sender as MasterEditForm;
            string         printSheetReason = CommonData.StringEmpty;

            if (form.ListDto != null && form.ListDto.Count > 0)
            {
                foreach (SH_DeliveryPrintConfirmDto dto in form.ListDto)
                {
                    printSheetReason = CommonMethod.ParseString(dto.Reason);
                }
            }

            if (form.DialogResult == System.Windows.Forms.DialogResult.Yes)
            {
                printedCount = printedCount + 1;
                this.UpdateStockTransactionMasterForCountingPrint(printedCount, printSheetReason);
                this.ShowReport(printedCount);

                ////Set Printed check box is checked
                var collection = transactionMasterControl.Controls.Find("txtPrintCount", true);
                if (collection.Length > 0)
                {
                    Ivs.Controls.CustomControls.WinForm.IvsTextEdit chk = (Ivs.Controls.CustomControls.WinForm.IvsTextEdit)collection[0];
                    chk.Text = CommonMethod.ParseString(printedCount);
                    stockMasterDto.DeliverySheetPrintCount = printedCount;
                }

                var collection2 = transactionMasterControl.Controls.Find("txtPrintReason", true);
                if (collection2.Length > 0)
                {
                    //ST_StockTransactionMasterDto stockTransactionMaster = new ST_StockTransactionMastersBL().GetOneStockTransactionMaster((this.ctrlHeader.Dto as ST_StockTransactionMasterDto).DocumentNumber);
                    Ivs.Controls.CustomControls.WinForm.IvsTextEdit txtPrintReason = (Ivs.Controls.CustomControls.WinForm.IvsTextEdit)collection2[0];
                    txtPrintReason.Visible = true;
                    txtPrintReason.Text    = printSheetReason;
                }
            }
        }