Ejemplo n.º 1
0
        private void btnPrintTag_Click(object sender, EventArgs e)
        {
            try
            {
                ErrorItem err = CheckCanRunProcess();
                if (err != null)
                {
                    MessageDialog.ShowBusiness(this, err.Message);
                    this.Close();
                    return;
                }

                try
                {
                    if (txtPreProcessBy.Text.Trim().Length == 0)
                    {
                        MessageDialog.ShowBusiness(this
                                                   , new EVOFramework.Message(TKPMessages.eValidate.VLM0086.ToString()));

                        return;
                    }

                    ReportBIZ biz = new ReportBIZ();


                    DataSet ds = biz.LoadStockTakingTagSummary();


                    if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                    {
                        string strReportFileName = @"Report\STR040_StockTakingTagSummary.rpt";


                        RPT999_PreviewReport preview = new RPT999_PreviewReport(
                            Path.Combine(Application.StartupPath, strReportFileName)
                            );

                        preview.SetDataSource(ds);
                        preview.ReportDoc.SetParameterValue("USER", Common.CurrentUserInfomation.Username.ToString().ToUpper());

                        preview.ShowPreview();
                    }
                    else
                    {
                        MessageDialog.ShowInformation(this, null, Message.LoadMessage(TKPMessages.eInformation.INF0001.ToString()).MessageDescription);
                    }
                }
                catch (Exception ex)
                {
                    MessageDialog.ShowBusiness(this, ex.Message);
                }
            }
            catch (Exception ex)
            {
                MessageDialog.ShowBusiness(this, ex.Message);
            }
        }
Ejemplo n.º 2
0
        private void btnRun_Click(object sender, EventArgs e)
        {
            try
            {
                ErrorItem err = CheckCanRunProcess();
                if (err != null)
                {
                    MessageDialog.ShowBusiness(this, err.Message);
                    this.Close();
                    return;
                }

                try
                {
                    if (txtPreProcessBy.Text.Trim().Length == 0)
                    {
                        MessageDialog.ShowBusiness(this
                                                   , new EVOFramework.Message(TKPMessages.eValidate.VLM0086.ToString()));

                        return;
                    }

                    StockTakingDTO dto = new StockTakingDTO();
                    dto.STOCK_TAKING_DATE = Convert.ToDateTime(dtStockTakingDate.DateValue);
                    dto.LOCATION_CODE     = cboProcess.SelectedValue == null ? string.Empty : cboProcess.SelectedValue.ToString();//txtLocation.Text;
                    dto.PART_NO           = txtMasterNo.Text;
                    dto.PART_TYPE         = Convert.ToString(cboItemType.SelectedValue);
                    dto.PART_SUB_TYPE     = Convert.ToString(cboItemClassMinor04.SelectedValue);

                    if (chkIncomplete.Checked)
                    {
                        dto.SEARCH_INCOMPLETE = 1;
                    }
                    else
                    {
                        dto.SEARCH_INCOMPLETE = 0;
                    }

                    if (chkDiff.Checked)
                    {
                        dto.SEARCH_DIFF = 1;
                    }
                    else
                    {
                        dto.SEARCH_DIFF = 0;
                    }

                    if (chkNoMaster.Checked)
                    {
                        dto.NO_MASTER = 1;
                    }
                    else
                    {
                        dto.NO_MASTER = 0;
                    }

                    DataSet ds = GetReportTable(dto);
                    if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                    {
                        string strReportFileName = @"Report\STR010_StockCheckingList.rpt";

                        if (rdoReportCheckingList.Checked)
                        {
                            strReportFileName = @"Report\STR010_StockCheckingList.rpt";
                        }
                        else if (rdoReportCountingResult.Checked)
                        {
                            strReportFileName = @"Report\STR020_StockCountingResult.rpt";
                        }
                        else
                        {
                            strReportFileName = @"Report\STR010_StockCheckingList.rpt";
                        }



                        RPT999_PreviewReport preview = new RPT999_PreviewReport(
                            Path.Combine(Application.StartupPath, strReportFileName)
                            );

                        preview.SetDataSource(ds);
                        preview.ReportDoc.SetParameterValue("StockTakingDate", dto.STOCK_TAKING_DATE);
                        preview.ReportDoc.SetParameterValue("IncompleteData", dto.SEARCH_INCOMPLETE);
                        preview.ReportDoc.SetParameterValue("DiffMoreThanZero", dto.SEARCH_DIFF);

                        preview.ShowPreview();
                    }
                    else
                    {
                        MessageDialog.ShowInformation(this, null, Message.LoadMessage(TKPMessages.eInformation.INF0001.ToString()).MessageDescription);
                    }
                }
                catch (Exception ex)
                {
                    MessageDialog.ShowBusiness(this, ex.Message);
                }
            }
            catch (Exception ex)
            {
                MessageDialog.ShowBusiness(this, ex.Message);
            }
        }