/// <summary> /// Cancel document /// </summary> protected virtual void Cancel() { if (btnCancel.Visibility == DevExpress.XtraBars.BarItemVisibility.Never || btnCancel.Enabled == false) { return; } this.MessageBox = new MessageBoxs(); IvsMessage message = new IvsMessage(CommonConstantMessage.COM_MSG_CONFIRM_CANCEL); this.MessageBox.Add(message); CommonData.MessageTypeResult result = this.MessageBox.Display(CommonData.MessageType.YesNo); if (result == CommonData.MessageTypeResult.Yes) { this.MessageBox = new MessageBoxs(); StockTransactionBl stockTransactionBl = new StockTransactionBl(); StockResult stockResult = stockTransactionBl.Cancel((ST_StockTransactionMasterDto)this.Dto); if (stockResult.ReturnCode == CommonData.StockReturnCode.Succeed) { message = new IvsMessage(CommonConstantMessage.COM_MSG_CANCEL_SUCCESSFULLY); this.MessageBox.Add(message); this.MessageBox.Display(CommonData.MessageType.Ok); this.CloseForm(); } else { lblErrorMessage.Text = ProcessStockException(stockResult); } } }
/// <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); } } } }
/// <summary> /// Show report /// </summary> protected void ShowReport(int countedPrint) { StockTransactionBl stocktransactionBl = new StockTransactionBl(); List <DeliverySheetDTO> lstResult = new List <DeliverySheetDTO>(); //stockMasterDto = (ST_StockTransactionMasterDto)this.Dto; DeliverySheetHeaderDTO deliverySheetHeaderDto = new DeliverySheetHeaderDTO(); stockMasterDto.DeliverySheetPrintCount = countedPrint; stocktransactionBl.SearchDataForReport(stockMasterDto, out lstResult, out deliverySheetHeaderDto); //this.ReportForm = new IvsReport(); this.ReportForm.CreateDocument(true); this.ReportForm.BindHeader(deliverySheetHeaderDto); this.ReportForm.DataSource = lstResult; this.ReportForm.BindData(); //this.ReportForm.ShowPreview(); }