示例#1
0
        private void pmPrintData()
        {
            string strSQLStr = "select * from SALESUM02 where cCorp = ? and QcSaleTeam between ? and ? and dDate between ? and ? ";

            Report.LocalDataSet.DTSSALESUM10 dtsPrintPreview = new Report.LocalDataSet.DTSSALESUM10();

            string strErrorMsg = "";

            WS.Data.Agents.cDBMSAgent objSQLHelper = new WS.Data.Agents.cDBMSAgent(App.ConnectionString, App.DatabaseReside);

            Cursor currentCursor = Cursor.Current;

            Cursor.Current = Cursors.WaitCursor;

            App.MoreProcess = true;

            App.AppMessage = "Start Extract Data...";
            DateTime dttBegDate = DateTime.Now;
            DateTime dttEndDate = DateTime.Now;

            dttBegDate = new DateTime(this.txtBegDate.DateTime.Year - 1, 1, 1);
            dttEndDate = new DateTime(this.txtBegDate.DateTime.Year, this.txtBegDate.DateTime.Month, 1).AddMonths(1).AddDays(-1);

            objSQLHelper.SetPara(new object[] { App.gcCorp, this.txtBegQcEmZone.Text.TrimEnd(), this.txtEndQcEmZone.Text.TrimEnd(), dttBegDate, dttEndDate });
            if (objSQLHelper.SQLExec(ref this.dtsDataEnv, "QGLRef", "GLRef", strSQLStr, ref strErrorMsg))
            {
                DataRow dtrPreview = null;
                foreach (DataRow dtrGLRef in this.dtsDataEnv.Tables["QGLRef"].Rows)
                {
                    if (App.MoreProcess == false)
                    {
                        break;
                    }

                    dtrPreview = dtsPrintPreview.SALESUM01.NewRow();

                    dtrPreview["QcSaleTeam"] = dtrGLRef["QcSaleTeam"].ToString().TrimEnd();
                    dtrPreview["QnSaleTeam"] = dtrGLRef["QnSaleTeam"].ToString().TrimEnd();
                    dtrPreview["QcSEmpl"]    = dtrGLRef["QcSEmpl"].ToString().TrimEnd();
                    dtrPreview["QnSEmpl"]    = dtrGLRef["QnSEmpl"].ToString().TrimEnd();

                    dtrPreview["dDate"] = Convert.ToDateTime(dtrGLRef["dDate"]);
                    dtrPreview["cYear"] = dtrGLRef["cYear"].ToString().TrimEnd();

                    dtrPreview["Amt_SO"]     = Convert.ToDecimal(dtrGLRef["Amt_SO"]);
                    dtrPreview["Amt_Sale"]   = Convert.ToDecimal(dtrGLRef["Amt_Sale"]);
                    dtrPreview["Amt_Sale_A"] = Convert.ToDecimal(dtrGLRef["Amt_Sale_A"]);
                    dtrPreview["Amt_Ret"]    = Convert.ToDecimal(dtrGLRef["Amt_Ret"]);
                    dtrPreview["Amt_Ret_A"]  = Convert.ToDecimal(dtrGLRef["Amt_Ret_A"]);
                    dtrPreview["Amt_Bill"]   = Convert.ToDecimal(dtrGLRef["Amt_Bill"]);
                    dtrPreview["Amt_Bill_A"] = Convert.ToDecimal(dtrGLRef["Amt_Bill_A"]);
                    dtrPreview["Cost1"]      = Convert.ToDecimal(dtrGLRef["Cost1"]);
                    dtrPreview["Cost2"]      = Convert.ToDecimal(dtrGLRef["Cost2"]);

                    dtsPrintPreview.SALESUM01.Rows.Add(dtrPreview);
                }

                this.pmPreviewReport(dtsPrintPreview);
            }
        }
示例#2
0
        private void pmPreviewReport(Report.LocalDataSet.DTSSALESUM10 inData)
        {
            string strRPTFileName = "";
            string strRPTName     = "";

            switch (this.mstrForm)
            {
            case "FORM1":
                strRPTFileName = Application.StartupPath + @"\RPT\XRSALESUM10.rpt";
                strRPTName     = "MAC_XRREPORT10";
                break;

            case "FORM2":
                strRPTFileName = Application.StartupPath + @"\RPT\XRSALESUM11.rpt";
                strRPTName     = "MAC_XRREPORT11";
                break;

            case "FORM3":
                strRPTFileName = Application.StartupPath + @"\RPT\XRSALESUM14.rpt";
                strRPTName     = "MAC_XRREPORT14";
                break;
            }

            ReportDocument rptPreviewReport = new ReportDocument();

            if (!System.IO.File.Exists(strRPTFileName))
            {
                MessageBox.Show("File not found " + strRPTFileName, "Application Message", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            rptPreviewReport.Load(strRPTFileName);

            //this.pmOpenSubReport(inData, rptPreviewReport);

            rptPreviewReport.SetDataSource(inData);

            this.pACrPara.Clear();

            //AppUtil.ReportHelper.mAddCrPara(ref this.pACrPara, (this.cmbPOrderBy.SelectedIndex == 0 ? "ÃËÑÊ" : "ª×èÍ") + "¼Ñ§¡ÅØèÁÊÔ¹¤éÒ " + this.txtBegQcPdGrp.Text.TrimEnd() + " ¶Ö§ " + this.txtEndQcPdGrp.Text.TrimEnd());
            //AppUtil.ReportHelper.mAddCrPara(ref this.pACrPara, this.cmbPOrderBy.SelectedIndex == 0 ? "CODE" : "NAME");
            AppUtil.ReportHelper.mAddCrPara(ref this.pACrPara, App.gcCorpName);
            AppUtil.ReportHelper.mAddCrPara(ref this.pACrPara, "³ " + this.txtBegDate.DateTime.ToString("yyyy") + " - " + this.txtEndDate.DateTime.ToString("yyyy"));
            AppUtil.ReportHelper.mAddCrPara(ref this.pACrPara, strRPTName);

            ParameterFieldDefinitions prmCRPara = rptPreviewReport.DataDefinition.ParameterFields;

            prmCRPara["PFREPORTTITLE1"].ApplyCurrentValues((ParameterValues)this.pACrPara[0]);
            prmCRPara["PFREPORTTITLE2"].ApplyCurrentValues((ParameterValues)this.pACrPara[1]);
            prmCRPara["PFRPTNAME"].ApplyCurrentValues((ParameterValues)this.pACrPara[2]);
            //prmCRPara["PFORDERBY"].ApplyCurrentValues((ParameterValues)this.pACrPara[1]);

            App.PreviewReport(this, false, rptPreviewReport);
        }
示例#3
0
        private void pmPreviewReport(Report.LocalDataSet.DTSSALESUM10 inData)
        {
            string strRPTFileName = "";

            strRPTFileName = Application.StartupPath + @"\RPT\XRSALESUM03.rpt";
            DateTime dttXDate   = DateTime.Now;
            string   strRPTName = "";
            string   strTitle2  = "";

            switch (this.mstrForm)
            {
            case "FORM1":
                strRPTFileName = Application.StartupPath + @"\RPT\XRSALESUM03.rpt";
                strRPTName     = "MAC_XRREPORT03";
                break;
            }

            ReportDocument rptPreviewReport = new ReportDocument();

            if (!System.IO.File.Exists(strRPTFileName))
            {
                MessageBox.Show("File not found " + strRPTFileName, "Application Message", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            rptPreviewReport.Load(strRPTFileName);

            //this.pmOpenSubReport(inData, rptPreviewReport);

            rptPreviewReport.SetDataSource(inData);

            this.pACrPara.Clear();

            AppUtil.ReportHelper.mAddCrPara(ref this.pACrPara, App.gcCorpName);
            AppUtil.ReportHelper.mAddCrPara(ref this.pACrPara, "");
            AppUtil.ReportHelper.mAddCrPara(ref this.pACrPara, strRPTName);

            ParameterFieldDefinitions prmCRPara = rptPreviewReport.DataDefinition.ParameterFields;

            prmCRPara["PFREPORTTITLE1"].ApplyCurrentValues((ParameterValues)this.pACrPara[0]);
            prmCRPara["PFREPORTTITLE2"].ApplyCurrentValues((ParameterValues)this.pACrPara[1]);
            prmCRPara["PFRPTNAME"].ApplyCurrentValues((ParameterValues)this.pACrPara[2]);

            App.PreviewReport(this, false, rptPreviewReport);
        }
示例#4
0
        private void pmPrintData()
        {
            string strSQLStr = "select * from SALESUM03 where cCorp = ? and QcSEmpl between ? and ? and dDate between ? and ? order by QcSEmpl, dDate";

            Report.LocalDataSet.DTSSALESUM10 dtsPrintPreview = new Report.LocalDataSet.DTSSALESUM10();

            string strErrorMsg = "";

            WS.Data.Agents.cDBMSAgent objSQLHelper = new WS.Data.Agents.cDBMSAgent(App.ConnectionString, App.DatabaseReside);

            Cursor currentCursor = Cursor.Current;

            Cursor.Current = Cursors.WaitCursor;

            App.MoreProcess = true;
            App.AppMessage  = "Start Extract Data...";

            objSQLHelper.SetPara(new object[] { App.gcCorp, this.txtBegQcEmpl.Text.TrimEnd(), this.txtEndQcEmpl.Text.TrimEnd(), this.txtBegDate.DateTime.Date, this.txtEndDate.DateTime.Date });
            if (objSQLHelper.SQLExec(ref this.dtsDataEnv, "QGLRef", "GLRef", strSQLStr, ref strErrorMsg))
            {
                DataRow dtrPreview = null;
                foreach (DataRow dtrGLRef in this.dtsDataEnv.Tables["QGLRef"].Rows)
                {
                    dtrPreview = dtsPrintPreview.SALESUM01.NewRow();

                    dtrPreview["QcSEmpl"] = dtrGLRef["QcSEmpl"].ToString().TrimEnd();
                    dtrPreview["QnSEmpl"] = dtrGLRef["QnSEmpl"].ToString().TrimEnd();
                    dtrPreview["QcProd"]  = dtrGLRef["QcProd"].ToString().TrimEnd();
                    dtrPreview["QnProd"]  = dtrGLRef["QnProd"].ToString().TrimEnd();
                    dtrPreview["QcCoor"]  = dtrGLRef["QcCoor"].ToString().TrimEnd();
                    dtrPreview["QnCoor"]  = dtrGLRef["QnCoor"].ToString().TrimEnd();

                    dtrPreview["Amt_Sale"] = Convert.ToDecimal(dtrGLRef["Amt_Sale"]);
                    dtrPreview["Amt_Ret"]  = Convert.ToDecimal(dtrGLRef["Amt_Ret"]);

                    dtsPrintPreview.SALESUM01.Rows.Add(dtrPreview);
                }

                this.pmPreviewReport(dtsPrintPreview);
            }
        }
示例#5
0
        private void pmPrintData()
        {
            Report.LocalDataSet.DTSSALESUM10 dtsPrintPreview = new Report.LocalDataSet.DTSSALESUM10();

            string strErrorMsg = "";

            WS.Data.Agents.cDBMSAgent objSQLHelper  = new WS.Data.Agents.cDBMSAgent(App.ERPConnectionString, App.DatabaseReside);
            WS.Data.Agents.cDBMSAgent objSQLHelper2 = new WS.Data.Agents.cDBMSAgent(App.ConnectionString, App.DatabaseReside);

            Cursor currentCursor = Cursor.Current;

            Cursor.Current = Cursors.WaitCursor;

            App.MoreProcess = true;
            App.AppMessage  = "Start Extract Data...";

            DateTime dttBegDate = DateTime.Now;
            DateTime dttEndDate = DateTime.Now;

            dttBegDate = new DateTime(this.txtBegDate.DateTime.Year, this.txtBegDate.DateTime.Month, 1);
            dttEndDate = new DateTime(this.txtEndDate.DateTime.Year, this.txtEndDate.DateTime.Month, 1).AddMonths(1).AddDays(-1);

            string strSQLStr = "SELECT GLREF.FCSKID, GLREF.FCREFTYPE, GLREF.FNAMT, GLREF.FNVATAMT, GLREF.FNVATRATE, GLREF.FCRFTYPE, GLREF.FCREFNO, GLREF.FCCODE, GLREF.FCVATISOUT, GLREF.FNDISCAMT1, GLREF.FNDISCAMT2 ";

            strSQLStr = strSQLStr + ", REFPROD.FDDATE, REFPROD.FNQTY, REFPROD.FNPRICEKE, REFPROD.FNUMQTY, REFPROD.FNXRATE , REFPROD.FNDISCAMT, REFPROD.FNCOSTAMT, REFPROD.FNCOSTADJ, REFPROD.FNVATAMT as FNVATAMT_I ";
            strSQLStr = strSQLStr + ", PROD.FCCODE as CQCPROD, PROD.FCNAME as CQNPROD ";
            strSQLStr = strSQLStr + ", PDGRP.FCSKID as CPDGRP, PDGRP.FCCODE as CQCPDGRP, PDGRP.FCNAME as CQNPDGRP, PDGRP.FCNAME2 as CQNPDGRP2 ";
            strSQLStr = strSQLStr + ", BOOK.FCSKID as CBOOK, BOOK.FCCODE as CQCBOOK, BOOK.FCNAME as CQNBOOK ";
            strSQLStr = strSQLStr + " from REFPROD ";
            strSQLStr = strSQLStr + " left join GLREF on REFPROD.FCGLREF = GLREF.FCSKID ";
            strSQLStr = strSQLStr + " left join PROD on REFPROD.FCPROD = PROD.FCSKID ";
            strSQLStr = strSQLStr + " left join PDGRP on PROD.FCPDGRP = PDGRP.FCSKID ";
            strSQLStr = strSQLStr + " left join BOOK on GLREF.FCBOOK = BOOK.FCSKID ";
            strSQLStr = strSQLStr + " where REFPROD.FCCORP = ? ";
            strSQLStr = strSQLStr + " and REFPROD.FDDATE between ? and ? ";
            strSQLStr = strSQLStr + " and PDGRP.FCCODE between ? and ? ";
            strSQLStr = strSQLStr + " and REFPROD.FCSTAT <> 'C' ";
            strSQLStr = strSQLStr + " and REFPROD.FCREFPDTYP = 'P' ";
            strSQLStr = strSQLStr + " and GLREF.FCRFTYPE in ('S', 'E', 'F') ";

            objSQLHelper.SetPara(new object[] { App.gcCorp, dttBegDate, dttEndDate, this.txtBegQcPdGrp.Text.TrimEnd(), this.txtEndQcPdGrp.Text.TrimEnd() });
            if (objSQLHelper.SQLExec(ref this.dtsDataEnv, "QGLRef", "GLRef", strSQLStr, ref strErrorMsg))
            {
                foreach (DataRow dtrGLRef in this.dtsDataEnv.Tables["QGLRef"].Rows)
                {
                    if (App.MoreProcess == false)
                    {
                        break;
                    }

                    DateTime dttDate = Convert.ToDateTime(dtrGLRef["fdDate"]);

                    DataRow dtrSumGLRef = this.dtsDataEnv.Tables[this.mstrTemSaleSum].NewRow();

                    dtrSumGLRef["cBook"]   = dtrGLRef["cBook"].ToString();
                    dtrSumGLRef["cQcBook"] = dtrGLRef["cQcBook"].ToString();
                    dtrSumGLRef["cQnBook"] = dtrGLRef["cQnBook"].ToString();

                    dtrSumGLRef["cPdGrp"]   = dtrGLRef["cPdGrp"].ToString();
                    dtrSumGLRef["cQcPdGrp"] = dtrGLRef["cQcPdGrp"].ToString();
                    dtrSumGLRef["cQnPdGrp"] = dtrGLRef["cQnPdGrp"].ToString();

                    this.dtsDataEnv.Tables[this.mstrTemSaleSum].Rows.Add(dtrSumGLRef);

                    decimal decSign = (dtrGLRef["fcRfType"].ToString() == "F" ? -1 : 1);

                    decimal decAmt = this.pmCalAmt(dtrGLRef) * decSign;

                    decimal decUMQty = Convert.ToDecimal(dtrGLRef["fnUMQty"]);
                    decUMQty = (decUMQty != 0 ? decUMQty : 1);
                    decimal decQty = Convert.ToDecimal(dtrGLRef["fnQty"]) * decUMQty * decSign;

                    decimal decSum    = Convert.ToDecimal(dtrSumGLRef["nSale_Amt"]);
                    decimal decSumQty = Convert.ToDecimal(dtrSumGLRef["nSale_Qty"]);

                    dtrSumGLRef["nSale_Amt"] = decSum + decAmt;
                    dtrSumGLRef["nSale_Qty"] = decSumQty + decQty;


                    DataRow dtrPreview = dtsPrintPreview.SALESUM01.NewRow();

                    dtrPreview["cBook"]  = dtrGLRef["cBook"].ToString();
                    dtrPreview["QcBook"] = dtrGLRef["cQcBook"].ToString();
                    dtrPreview["QnBook"] = dtrGLRef["cQnBook"].ToString();
                    //dtrPreview["cPdGrp"] = dtrGLRef["cPdGrp"].ToString();
                    dtrPreview["QcPdGrp"]  = dtrGLRef["cQcPdGrp"].ToString();
                    dtrPreview["QnPdGrp"]  = dtrGLRef["cQnPdGrp"].ToString();
                    dtrPreview["Amt_Sale"] = Convert.ToDecimal(dtrSumGLRef["nSale_Amt"]);
                    dtrPreview["Qty_Sale"] = Convert.ToDecimal(dtrSumGLRef["nSale_Qty"]);

                    dtsPrintPreview.SALESUM01.Rows.Add(dtrPreview);
                }
                this.pmPreviewReport(dtsPrintPreview);
            }
        }
示例#6
0
        private void pmPrintData()
        {
            //string strSQLStr = "select * from SALESUM02 where cCorp = ? and QcPdGrp between ? and ? and QcSaleZone between ? and ? and dDate between ? and ? order by QcPdGrp, dDate";

            Report.LocalDataSet.DTSSALESUM10 dtsPrintPreview = new Report.LocalDataSet.DTSSALESUM10();

            string strErrorMsg = "";

            WS.Data.Agents.cDBMSAgent objSQLHelper = new WS.Data.Agents.cDBMSAgent(App.ConnectionString, App.DatabaseReside);

            Cursor currentCursor = Cursor.Current;

            Cursor.Current = Cursors.WaitCursor;

            App.MoreProcess = true;

            App.AppMessage = "Start Extract Data...";
            DateTime dttBegDate = DateTime.Now;
            DateTime dttEndDate = DateTime.Now;

            if (this.mstrForm == "FORM1")
            {
                dttBegDate = new DateTime(this.txtBegDate.DateTime.Year, this.txtBegDate.DateTime.Month, 1);
            }
            else
            {
                dttBegDate = new DateTime(this.txtBegDate.DateTime.Year - 1, 1, 1);
            }
            DateTime dttXDate = new DateTime(this.txtEndDate.DateTime.Year, this.txtEndDate.DateTime.Month, 1);

            dttEndDate = dttXDate.AddMonths(1).AddDays(-1);

            string strSQLStr = "select * from SALESUM04 where cCorp = ? and QcSaleZone between ? and ? and dDate between ? and ? ";

            objSQLHelper.SetPara(new object[] { App.gcCorp, this.txtBegQcCrZone.Text.TrimEnd(), this.txtEndQcCrZone.Text.TrimEnd(), dttBegDate, dttEndDate });
            if (objSQLHelper.SQLExec(ref this.dtsDataEnv, "QGLRef", "GLRef", strSQLStr, ref strErrorMsg))
            {
                DataRow dtrPreview = null;
                foreach (DataRow dtrGLRef in this.dtsDataEnv.Tables["QGLRef"].Rows)
                {
                    if (App.MoreProcess == false)
                    {
                        break;
                    }

                    dtrPreview = dtsPrintPreview.SALESUM01.NewRow();

                    dtrPreview["QcSaleZone"] = dtrGLRef["QcSaleZone"].ToString().TrimEnd();
                    dtrPreview["QnSaleZone"] = dtrGLRef["QnSaleZone"].ToString().TrimEnd();
                    dtrPreview["cCrGrpType"] = dtrGLRef["cCrGrpType"].ToString().TrimEnd();
                    dtrPreview["QcCrGrp"]    = dtrGLRef["MQcCrGrp"].ToString().TrimEnd();
                    dtrPreview["QnCrGrp"]    = dtrGLRef["MQnCrGrp"].ToString().TrimEnd();
                    dtrPreview["QcSEmpl"]    = dtrGLRef["QcSEmpl"].ToString().TrimEnd();
                    dtrPreview["QnSEmpl"]    = dtrGLRef["QnSEmpl"].ToString().TrimEnd();
                    dtrPreview["dDate"]      = Convert.ToDateTime(dtrGLRef["dDate"]);
                    dtrPreview["cYear"]      = dtrGLRef["cYear"].ToString().TrimEnd();

                    decimal decLastYrSale = this.pmGetLastYrSale(dtrGLRef["cSaleZone"].ToString(), dtrGLRef["cCrGrp"].ToString());

                    dtrPreview["LastYrSale"] = decLastYrSale;
                    dtrPreview["SLTarget"]   = Convert.ToDecimal(dtrGLRef["SLTarget"]);
                    dtrPreview["Amt_Sale"]   = Convert.ToDecimal(dtrGLRef["Amt_Sale"]);
                    dtrPreview["Amt_Ret"]    = Convert.ToDecimal(dtrGLRef["Amt_Ret"]);

                    dtsPrintPreview.SALESUM01.Rows.Add(dtrPreview);
                }

                this.pmPreviewReport(dtsPrintPreview);
            }
        }