protected override void OnReportRequest(ReportRequestArgs args)
        {
            base.OnReportRequest(args);
            DataTable dtSource = ((DataView)this.grdMain.DataSource).Table.Copy();

            dtSource.TableName = "T003";
            DataSet dsSource = new DataSet("Report");

            dsSource.Tables.Add(dtSource);
            args.DSDataSource = dsSource;
        }
        private void btnEditReport_Click(object sender, EventArgs e)
        {
            try
            {
                long      lReportTemplateID = 0;
                DataTable dtReport          = ExecuteSQL.CallView(132, "ReportTemplateID", "ReportViewID=" + mlReportViewID, "");

                if (dtReport.Rows.Count > 0)
                {
                    lReportTemplateID = dtReport.Rows[0]["ReportTemplateID"].ToString() == "" ?
                                        0 : Convert.ToInt64(dtReport.Rows[0]["ReportTemplateID"]);
                }

                ReportRequestArgs args;
                args = new ReportRequestArgs(lReportTemplateID, 8, null, null);

                LBDbParameterCollection parmCol = new LBDbParameterCollection();
                parmCol.Add(new LBParameter("ReportViewID", enLBDbType.Int64, mlReportViewID));
                DataSet dsReturn;
                Dictionary <string, object> dictValue;
                ExecuteSQL.CallSP(14407, parmCol, out dsReturn, out dictValue);

                DataTable dtSource = null;
                if (dsReturn != null && dsReturn.Tables.Count > 0)
                {
                    dtSource           = dsReturn.Tables[0].Copy();
                    dtSource.TableName = "T008";
                    DataSet dsSource = new DataSet("Report");
                    dsSource.Tables.Add(dtSource);
                    args.DSDataSource     = dsSource;
                    args.ReportTemplateID = lReportTemplateID;
                    frmEditReport frm = new frmEditReport(args);
                    LBShowForm.ShowDialog(frm);

                    if (frm.ReportArgs != null &&
                        frm.ReportArgs.ReportTemplateID > 0)
                    {
                        parmCol = new LBDbParameterCollection();
                        parmCol.Add(new LBParameter("ReportViewID", enLBDbType.Int64, mlReportViewID));
                        parmCol.Add(new LBParameter("ReportTemplateID", enLBDbType.Int64, frm.ReportArgs.ReportTemplateID));
                        ExecuteSQL.CallSP(14406, parmCol, out dsReturn, out dictValue);
                    }
                }
            }
            catch (Exception ex)
            {
                LB.WinFunction.LBCommonHelper.DealWithErrorMessage(ex);
            }
        }
        protected override void OnReportRequest(ReportRequestArgs args)
        {
            base.OnReportRequest(args);
            DataTable dtHeader = ExecuteSQL.CallView(115, "", "ModifyBillHeaderID=" + mModifyBillHeaderID, "");

            if (dtHeader.Rows.Count > 0)
            {
                DataRow drHeader = dtHeader.Rows[0];
                args.RecordDR = drHeader;
            }
            DataTable dtSource = ((DataView)this.grdMain.DataSource).Table.Copy();

            dtSource.TableName = "T005";
            DataSet dsSource = new DataSet("Report");

            dsSource.Tables.Add(dtSource);
            args.DSDataSource = dsSource;
        }
Exemple #4
0
 protected virtual void OnReportRequest(ReportRequestArgs args)
 {
 }
Exemple #5
0
        private void btnView_Click(object sender, EventArgs e)
        {
            try
            {
                if (tvReportType.SelectedNode == null || tvReportType.SelectedNode.Tag == null)
                {
                    return;
                }
                DataRow dr = tvReportType.SelectedNode.Tag as DataRow;
                long    lReportTemplateID = dr["ReportTemplateID"] == DBNull.Value ?
                                            0 : Convert.ToInt64(dr["ReportTemplateID"]);
                long lReportViewID = dr["ReportViewID"] == DBNull.Value ?
                                     0 : Convert.ToInt64(dr["ReportViewID"]);

                if (lReportTemplateID == 0 || lReportViewID == 0)
                {
                    return;
                }

                DataTable dtField = ExecuteSQL.CallView(133, "", "ReportViewID=" + lReportViewID, "");
                DataView  dvField = new DataView(dtField);

                DataTable dtFieldValue = new DataTable("Field");
                dtFieldValue.Columns.Add("FieldName", typeof(string));
                dtFieldValue.Columns.Add("FieldValue", typeof(string));

                foreach (Control ctl in this.pnlField.Controls)
                {
                    string strName  = "";
                    string strValue = "";
                    if (ctl is CoolTextBox)
                    {
                        CoolTextBox txt = ctl as CoolTextBox;
                        strName  = txt.Name;
                        strValue = txt.Text;
                    }
                    else if (ctl is LBDateTime)
                    {
                        LBDateTime txt = ctl as LBDateTime;
                        strName  = txt.Name;
                        strValue = txt.TextBox.Text.ToString();
                    }

                    dvField.RowFilter = "FieldName='" + strName + "'";
                    if (dvField.Count > 0)
                    {
                        DataRow drField = dtFieldValue.NewRow();
                        drField["FieldName"]  = strName;
                        drField["FieldValue"] = strValue;
                        dtFieldValue.Rows.Add(drField);
                    }
                }

                ReportRequestArgs args;
                args = new ReportRequestArgs(lReportTemplateID, 8, null, null);

                DataTable dtSPIN = new DataTable();
                dtSPIN.Columns.Add("ReportViewID", typeof(long));
                dtSPIN.Columns.Add("DTFieldValue", typeof(DataTable));
                DataRow drNew = dtSPIN.NewRow();
                drNew["ReportViewID"] = lReportViewID;
                drNew["DTFieldValue"] = dtFieldValue;
                dtSPIN.Rows.Add(drNew);
                dtSPIN.AcceptChanges();

                DataSet   dsReturn;
                DataTable dtOut;
                ExecuteSQL.CallSP(14407, dtSPIN, out dsReturn, out dtOut);

                DataTable dtSource = null;
                if (dsReturn != null && dsReturn.Tables.Count > 0)
                {
                    dtSource           = dsReturn.Tables[0].Copy();
                    dtSource.TableName = "T008";
                    DataSet dsSource = new DataSet("Report");
                    dsSource.Tables.Add(dtSource);
                    args.DSDataSource     = dsSource;
                    args.ReportTemplateID = lReportTemplateID;

                    FastReport.Report report = ReportHelper.GetReport(args);
                    report.Preview = this.previewControl1;
                    report.Show();
                }
            }
            catch (Exception ex)
            {
                LB.WinFunction.LBCommonHelper.DealWithErrorMessage(ex);
            }
        }
Exemple #6
0
        public static void PreviceReport(long saleID, enWeightType weightType, enRequestReportActionType requestType)
        {
            ProcessStep.mdtStep = null;
            ReportRequestArgs args;

            if (weightType == enWeightType.WeightIn)
            {
                ProcessStep.AddStep("StartPreviceReport", DateTime.Now.ToString("MMdd HH:mm:ss ") + DateTime.Now.Millisecond);
                DataTable dtReportTemp = ReportHelper.GetReportTemplateRowByType(6);
                ProcessStep.AddStep("CallView_105", DateTime.Now.ToString("MMdd HH:mm:ss ") + DateTime.Now.Millisecond);
                if (dtReportTemp.Rows.Count > 0)
                {
                    //打印磅单
                    if (requestType == enRequestReportActionType.DirectPrint)
                    {
                        frmPrint = new frmAutoPrint();
                    }

                    DataRow drReport          = dtReportTemp.Rows[0];
                    long    lReportTemplateID = Convert.ToInt64(drReport["ReportTemplateID"]);
                    long    lReportTypeID     = Convert.ToInt64(drReport["ReportTypeID"]);

                    args = new ReportRequestArgs(lReportTemplateID, 6, null, null);

                    //long lSaleCarInBillID = LBConverter.ToInt64(this.txtSaleCarInBillID.Text);
                    DataTable dtBill = ExecuteSQL.CallView(128, "", "SaleCarInBillID=" + saleID, "");
                    dtBill.TableName = "T006";
                    DataSet dsSource = new DataSet("Report");
                    dsSource.Tables.Add(dtBill);
                    args.DSDataSource = dsSource;

                    ProcessStep.AddStep("CallView_128", DateTime.Now.ToString("MMdd HH:mm:ss ") + DateTime.Now.Millisecond);

                    ReportHelper.OpenReportDialog(requestType, args);

                    ProcessStep.AddStep("OpenReportDialog_End", DateTime.Now.ToString("MMdd HH:mm:ss ") + DateTime.Now.Millisecond);

                    if (requestType == enRequestReportActionType.DirectPrint)
                    {
                        //记录小票打印次数
                        LBDbParameterCollection parmCol = new LBDbParameterCollection();
                        parmCol.Add(new LBParameter("SaleCarInBillID", enLBDbType.Int64, saleID));

                        DataSet dsReturn;
                        Dictionary <string, object> dictValue;
                        ExecuteSQL.CallSP(14109, parmCol, out dsReturn, out dictValue);

                        ProcessStep.AddStep("CallSP_14109", DateTime.Now.ToString("MMdd HH:mm:ss ") + DateTime.Now.Millisecond);
                        DataTable dtt = ProcessStep.mdtStep;

                        LBShowForm.ShowDialog(frmPrint);
                    }
                }
            }
            else if (weightType == enWeightType.WeightOut ||
                     weightType == enWeightType.WeightOnlyOut)
            {
                DataTable dtReportTemp = ReportHelper.GetReportTemplateRowByType(7);
                if (dtReportTemp.Rows.Count > 0)
                {
                    //打印磅单
                    if (requestType == enRequestReportActionType.DirectPrint)
                    {
                        frmPrint = new frmAutoPrint();
                    }

                    DataRow drReport          = dtReportTemp.Rows[0];
                    long    lReportTemplateID = Convert.ToInt64(drReport["ReportTemplateID"]);
                    long    lReportTypeID     = Convert.ToInt64(drReport["ReportTypeID"]);

                    args = new ReportRequestArgs(lReportTemplateID, 7, null, null);

                    //long lSaleCarOutBillID = LBConverter.ToInt64(this.txtSaleCarOutBillID.Text);
                    DataTable dtBill = ExecuteSQL.CallView(125, "", "SaleCarOutBillID=" + saleID, "");
                    dtBill.TableName = "T007";
                    DataSet dsSource = new DataSet("Report");
                    dsSource.Tables.Add(dtBill);
                    args.DSDataSource = dsSource;

                    ReportHelper.OpenReportDialog(requestType, args);

                    if (requestType == enRequestReportActionType.DirectPrint)
                    {
                        //记录磅单打印次数
                        LBDbParameterCollection parmCol = new LBDbParameterCollection();
                        parmCol.Add(new LBParameter("SaleCarOutBillID", enLBDbType.Int64, saleID));

                        DataSet dsReturn;
                        Dictionary <string, object> dictValue;
                        ExecuteSQL.CallSP(14110, parmCol, out dsReturn, out dictValue);

                        LBShowForm.ShowDialog(frmPrint);
                    }
                }
            }
        }