Exemplo n.º 1
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            WS.Data.Agents.cDBMSAgent objSQLHelper = new WS.Data.Agents.cDBMSAgent(App.ConnectionString, App.DatabaseReside);
            KeepLogAgent.KeepLog(objSQLHelper, KeepLogType.Print, this.mstrTaskName, "", "", App.FMAppUserID, App.AppUserName);

            this.pmPrintData();
            this.pmSumHirachy();

            Report.LocalDataSet.DTSBUDGET01 dtsPreviewReport = new Report.LocalDataSet.DTSBUDGET01();

            DataRow dtrPreview = null;

            foreach (DataRow dtrTemBg in this.dtsDataEnv.Tables[this.mstrTemBg].Rows)
            {
                int intLevel = Convert.ToInt32(dtrTemBg["nLevel"]);

                if (intLevel == this.mintPLevel)
                //if (true)
                {
                    dtrPreview              = dtsPreviewReport.XRBUDGET2.NewRow();
                    dtrPreview["nLevel"]    = Convert.ToInt32(dtrTemBg["nLevel"]);
                    dtrPreview["nRun"]      = Convert.ToInt32(dtrTemBg["nRun"]);
                    dtrPreview["cGroup"]    = dtrTemBg["cGroup"].ToString();
                    dtrPreview["cSeq"]      = dtrTemBg["cSeq"].ToString();
                    dtrPreview["cRunNo"]    = dtrTemBg["cRunNo"].ToString();
                    dtrPreview["cType"]     = dtrTemBg["cType"].ToString();
                    dtrPreview["cQcPrProj"] = dtrTemBg["cQcPrProj"].ToString();
                    dtrPreview["cQcProj"]   = dtrTemBg["cQcProj"].ToString();
                    dtrPreview["cQnProj"]   = dtrTemBg["cQnProj"].ToString();
                    dtrPreview["nAmt01"]    = Convert.ToDecimal(dtrTemBg["nAmt01"]);
                    dtrPreview["nAmt02"]    = Convert.ToDecimal(dtrTemBg["nAmt02"]);
                    dtrPreview["nAmt03"]    = Convert.ToDecimal(dtrTemBg["nAmt03"]);
                    dtrPreview["nAmt04"]    = Convert.ToDecimal(dtrTemBg["nAmt04"]);
                    dtrPreview["nAmt05"]    = Convert.ToDecimal(dtrTemBg["nAmt05"]);
                    dtrPreview["nAmt06"]    = Convert.ToDecimal(dtrTemBg["nAmt06"]);
                    dtrPreview["nAmt07"]    = Convert.ToDecimal(dtrTemBg["nAmt07"]);
                    dtrPreview["nAmt08"]    = Convert.ToDecimal(dtrTemBg["nAmt08"]);
                    dtrPreview["nAmt09"]    = Convert.ToDecimal(dtrTemBg["nAmt09"]);
                    dtrPreview["nAmt10"]    = Convert.ToDecimal(dtrTemBg["nAmt10"]);
                    dtrPreview["nAmt11"]    = Convert.ToDecimal(dtrTemBg["nAmt11"]);
                    dtrPreview["nAmt12"]    = Convert.ToDecimal(dtrTemBg["nAmt12"]);

                    dtsPreviewReport.XRBUDGET2.Rows.Add(dtrPreview);
                }
            }

            if (dtsPreviewReport.XRBUDGET2.Rows.Count != 0)
            {
                //this.dataGridView1.DataSource = dtsPreviewReport.XRBUDGET2;
                this.pmPreviewReport(dtsPreviewReport);
            }
            else
            {
                MessageBox.Show(this, "ไม่มีข้อมูล", "Application confirm message", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Exemplo n.º 2
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            WS.Data.Agents.cDBMSAgent objSQLHelper = new WS.Data.Agents.cDBMSAgent(App.ConnectionString, App.DatabaseReside);
            KeepLogAgent.KeepLog(objSQLHelper, KeepLogType.Print, this.mstrTaskName, "", "", App.FMAppUserID, App.AppUserName);

            this.pmPrintData();
            this.pmSumHirachy();
            this.pmSumHirachy2();
            this.pmAllocPercent();

            Report.LocalDataSet.DTSBUDGET01 dtsPreviewReport = new Report.LocalDataSet.DTSBUDGET01();

            decimal decSumBG1 = 0;
            decimal decSumBG2 = 0;
            decimal decSumBG3 = 0;
            decimal decSumBG4 = 0;
            decimal decSumBG5 = 0;

            decimal decPcn1 = 0;
            decimal decPcn2 = 0;
            decimal decPcn3 = 0;
            decimal decPcn4 = 0;
            decimal decPcn5 = 0;


            this.pmSumBGTotal(
                ref decSumBG1
                , ref decSumBG2
                , ref decSumBG3
                , ref decSumBG4
                , ref decSumBG5
                , ref decPcn1
                , ref decPcn2
                , ref decPcn3
                , ref decPcn4
                , ref decPcn5);

            DataRow dtrPreview = null;

            string strPYear = (this.mintYear + 543).ToString("0000");

            dtrPreview              = dtsPreviewReport.XRBUDGET1.NewRow();
            dtrPreview["nLevel"]    = 0;
            dtrPreview["nRun"]      = 0;
            dtrPreview["cGroup"]    = "";
            dtrPreview["cGroup2"]   = "";
            dtrPreview["cSeq"]      = "";
            dtrPreview["cRunNo"]    = "";
            dtrPreview["cType"]     = "H";
            dtrPreview["cQcPrProj"] = "";
            dtrPreview["cQcProj"]   = "";
            dtrPreview["cQnProj"]   = "รวมงบประมาณรายจ่ายประจำปี " + strPYear;
            dtrPreview["nAmt01"]    = decSumBG1;
            dtrPreview["nAmt02"]    = decSumBG2;
            dtrPreview["nAmt03"]    = decSumBG3;
            dtrPreview["nAmt04"]    = decSumBG4;
            dtrPreview["nAmt05"]    = decSumBG5;
            dtrPreview["nPcn01"]    = decPcn1;
            dtrPreview["nPcn02"]    = decPcn2;
            dtrPreview["nPcn03"]    = decPcn3;
            dtrPreview["nPcn04"]    = decPcn4;
            dtrPreview["nPcn05"]    = decPcn5;

            dtsPreviewReport.XRBUDGET1.Rows.Add(dtrPreview);

            foreach (DataRow dtrTemBg in this.dtsDataEnv.Tables[this.mstrTemBg].Rows)
            {
                dtrPreview              = dtsPreviewReport.XRBUDGET1.NewRow();
                dtrPreview["nLevel"]    = Convert.ToInt32(dtrTemBg["nLevel"]);
                dtrPreview["nRun"]      = Convert.ToInt32(dtrTemBg["nRun"]);
                dtrPreview["cGroup"]    = dtrTemBg["cGroup"].ToString();
                dtrPreview["cGroup2"]   = dtrTemBg["cGroup2"].ToString();
                dtrPreview["cSeq"]      = dtrTemBg["cSeq"].ToString();
                dtrPreview["cRunNo"]    = dtrTemBg["cRunNo"].ToString();
                dtrPreview["cType"]     = dtrTemBg["cType"].ToString();
                dtrPreview["cType2"]    = dtrTemBg["cType2"].ToString();
                dtrPreview["cQcPrProj"] = dtrTemBg["cQcPrProj"].ToString();
                dtrPreview["cQcProj"]   = dtrTemBg["cQcProj"].ToString();
                dtrPreview["cQnProj"]   = dtrTemBg["cQnProj"].ToString();
                dtrPreview["nAmt01"]    = Convert.ToDecimal(dtrTemBg["nAmt01"]);
                dtrPreview["nAmt02"]    = Convert.ToDecimal(dtrTemBg["nAmt02"]);
                dtrPreview["nAmt03"]    = Convert.ToDecimal(dtrTemBg["nAmt03"]);
                dtrPreview["nAmt04"]    = Convert.ToDecimal(dtrTemBg["nAmt04"]);
                dtrPreview["nAmt05"]    = Convert.ToDecimal(dtrTemBg["nAmt05"]);
                dtrPreview["nPcn01"]    = Convert.ToDecimal(dtrTemBg["nPcn01"]);
                dtrPreview["nPcn02"]    = Convert.ToDecimal(dtrTemBg["nPcn02"]);
                dtrPreview["nPcn03"]    = Convert.ToDecimal(dtrTemBg["nPcn03"]);
                dtrPreview["nPcn04"]    = Convert.ToDecimal(dtrTemBg["nPcn04"]);
                dtrPreview["nPcn05"]    = Convert.ToDecimal(dtrTemBg["nPcn05"]);

                dtsPreviewReport.XRBUDGET1.Rows.Add(dtrPreview);
            }
            if (dtsPreviewReport.XRBUDGET1.Rows.Count != 0)
            {
                this.dataGridView1.DataSource = dtsPreviewReport.XRBUDGET1;
                this.pmPreviewReport(dtsPreviewReport);
            }
        }
Exemplo n.º 3
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            WS.Data.Agents.cDBMSAgent objSQLHelper = new WS.Data.Agents.cDBMSAgent(App.ConnectionString, App.DatabaseReside);
            KeepLogAgent.KeepLog(objSQLHelper, KeepLogType.Print, this.mstrTaskName, "", "", App.FMAppUserID, App.AppUserName);

            this.pmPrintData();
            this.pmSumHirachy();
            this.pmAllocPercent();

            Report.LocalDataSet.DTSBUDGET01 dtsPreviewReport = new Report.LocalDataSet.DTSBUDGET01();

            decimal decSumBG1 = 0; decimal decSumBG2 = 0; decimal decSumBG3 = 0; decimal decSumBG4 = 0; decimal decSumBG5 = 0;
            decimal decPcn1 = 0; decimal decPcn2 = 0; decimal decPcn3 = 0; decimal decPcn4 = 0; decimal decPcn5 = 0;

            this.pmSumBGTotal(
                ref decSumBG1
                , ref decSumBG2
                , ref decSumBG3
                , ref decSumBG4
                , ref decSumBG5
                , ref decPcn1
                , ref decPcn2
                , ref decPcn3
                , ref decPcn4
                , ref decPcn5);

            DataRow dtrPreview = null;

            switch (this.mstrForm)
            {
            case "FORM1":
                break;

            case "FORM2":
                decPcn1 = 100; decPcn2 = 100; decPcn3 = 100; decPcn4 = 100; decPcn5 = 100;
                break;

            case "FORM3":
            case "FORM4":
                //decPcn1 = 100; decPcn2 = 100; decPcn3 = 100; decPcn4 = 100; decPcn5 = 100;
                decimal decSumTotalBg = decSumBG1 + decSumBG2 + decSumBG3 + decSumBG4;
                if (decSumTotalBg != 0)
                {
                    decPcn1 = Math.Round(100 * decSumBG1 / decSumTotalBg, 2, MidpointRounding.AwayFromZero);
                    decPcn2 = Math.Round(100 * decSumBG2 / decSumTotalBg, 2, MidpointRounding.AwayFromZero);
                    decPcn3 = Math.Round(100 * decSumBG3 / decSumTotalBg, 2, MidpointRounding.AwayFromZero);
                    decPcn4 = Math.Round(100 * decSumBG4 / decSumTotalBg, 2, MidpointRounding.AwayFromZero);
                    decPcn5 = Math.Round(100 * decSumBG5 / decSumTotalBg, 2, MidpointRounding.AwayFromZero);
                }
                break;
            }

            string strPYear = (this.mintYear + 543).ToString("0000");

            dtrPreview              = dtsPreviewReport.XRBUDGET1.NewRow();
            dtrPreview["nLevel"]    = 0;
            dtrPreview["nRun"]      = 0;
            dtrPreview["cGroup"]    = "";
            dtrPreview["cSeq"]      = "";
            dtrPreview["cRunNo"]    = "";
            dtrPreview["cType"]     = "H";
            dtrPreview["cQcPrProj"] = "";
            dtrPreview["cQcProj"]   = "";
            dtrPreview["cQnProj"]   = "รวมงบประมาณรายจ่ายประจำปี " + strPYear;
            dtrPreview["nAmt01"]    = decSumBG1;
            dtrPreview["nAmt02"]    = decSumBG2;
            dtrPreview["nAmt03"]    = decSumBG3;
            dtrPreview["nAmt04"]    = decSumBG4;
            dtrPreview["nAmt05"]    = decSumBG5;
            dtrPreview["nPcn01"]    = decPcn1;
            dtrPreview["nPcn02"]    = decPcn2;
            dtrPreview["nPcn03"]    = decPcn3;
            dtrPreview["nPcn04"]    = decPcn4;
            dtrPreview["nPcn05"]    = decPcn5;

            dtsPreviewReport.XRBUDGET1.Rows.Add(dtrPreview);

            foreach (DataRow dtrTemBg in this.dtsDataEnv.Tables[this.mstrTemBg].Rows)
            {
                dtrPreview              = dtsPreviewReport.XRBUDGET1.NewRow();
                dtrPreview["nLevel"]    = Convert.ToInt32(dtrTemBg["nLevel"]);
                dtrPreview["nRun"]      = Convert.ToInt32(dtrTemBg["nRun"]);
                dtrPreview["cGroup"]    = dtrTemBg["cGroup"].ToString();
                dtrPreview["cSeq"]      = dtrTemBg["cSeq"].ToString();
                dtrPreview["cRunNo"]    = dtrTemBg["cRunNo"].ToString();
                dtrPreview["cType"]     = dtrTemBg["cType"].ToString();
                dtrPreview["cQcPrProj"] = dtrTemBg["cQcPrProj"].ToString();
                dtrPreview["cQcProj"]   = dtrTemBg["cQcProj"].ToString();
                dtrPreview["cQnProj"]   = dtrTemBg["cQnProj"].ToString();
                dtrPreview["nAmt01"]    = Convert.ToDecimal(dtrTemBg["nAmt01"]);
                dtrPreview["nAmt02"]    = Convert.ToDecimal(dtrTemBg["nAmt02"]);
                dtrPreview["nAmt03"]    = Convert.ToDecimal(dtrTemBg["nAmt03"]);
                dtrPreview["nAmt04"]    = Convert.ToDecimal(dtrTemBg["nAmt04"]);
                dtrPreview["nAmt05"]    = Convert.ToDecimal(dtrTemBg["nAmt05"]);
                dtrPreview["nPcn01"]    = Convert.ToDecimal(dtrTemBg["nPcn01"]);
                dtrPreview["nPcn02"]    = Convert.ToDecimal(dtrTemBg["nPcn02"]);
                dtrPreview["nPcn03"]    = Convert.ToDecimal(dtrTemBg["nPcn03"]);
                dtrPreview["nPcn04"]    = Convert.ToDecimal(dtrTemBg["nPcn04"]);
                dtrPreview["nPcn05"]    = Convert.ToDecimal(dtrTemBg["nPcn05"]);

                dtsPreviewReport.XRBUDGET1.Rows.Add(dtrPreview);
            }
            if (dtsPreviewReport.XRBUDGET1.Rows.Count != 0)
            {
                //this.dataGridView1.DataSource = dtsPreviewReport.XRBUDGET1;
                this.pmPreviewReport(dtsPreviewReport);
            }
            else
            {
                MessageBox.Show(this, "ไม่มีข้อมูล", "Application confirm message", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Exemplo n.º 4
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            WS.Data.Agents.cDBMSAgent objSQLHelper = new WS.Data.Agents.cDBMSAgent(App.ConnectionString, App.DatabaseReside);
            KeepLogAgent.KeepLog(objSQLHelper, KeepLogType.Print, this.mstrTaskName, "", "", App.FMAppUserID, App.AppUserName);

            this.pmPrintData();
            this.pmSumHirachy();
            this.pmAllocPercent();

            Report.LocalDataSet.DTSBUDGET01 dtsPreviewReport = new Report.LocalDataSet.DTSBUDGET01();

            decimal[] decAmt = new decimal[12] {
                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
            };

            this.pmSumBGTotal(ref decAmt);

            DataRow dtrPreview = null;

            string strMsg2 = "";

            switch (this.mstrForm)
            {
            case "FORM1":
                strMsg2 = "";
                break;

            case "FORM2":
                strMsg2 = "    (ค่าใช้จ่ายลงทุน)";
                break;

            case "FORM3":
                strMsg2 = "";
                break;
            }

            string strPYear = (this.mintYear + 543).ToString("0000");

            dtrPreview              = dtsPreviewReport.XRBUDGET2.NewRow();
            dtrPreview["nLevel"]    = 0;
            dtrPreview["nRun"]      = 0;
            dtrPreview["cGroup"]    = "";
            dtrPreview["cSeq"]      = "";
            dtrPreview["cRunNo"]    = "";
            dtrPreview["cType"]     = "H";
            dtrPreview["cQcPrProj"] = "";
            dtrPreview["cQcProj"]   = "";
            dtrPreview["cQnProj"]   = "รวมงบประมาณรายจ่ายของปีงบประมาณ " + strPYear + strMsg2;
            dtrPreview["nAmt01"]    = decAmt[0];
            dtrPreview["nAmt02"]    = decAmt[1];
            dtrPreview["nAmt03"]    = decAmt[2];
            dtrPreview["nAmt04"]    = decAmt[3];
            dtrPreview["nAmt05"]    = decAmt[4];
            dtrPreview["nAmt06"]    = decAmt[5];
            dtrPreview["nAmt07"]    = decAmt[6];
            dtrPreview["nAmt08"]    = decAmt[7];
            dtrPreview["nAmt09"]    = decAmt[8];
            dtrPreview["nAmt10"]    = decAmt[9];
            dtrPreview["nAmt11"]    = decAmt[10];
            dtrPreview["nAmt12"]    = decAmt[11];

            dtsPreviewReport.XRBUDGET2.Rows.Add(dtrPreview);

            foreach (DataRow dtrTemBg in this.dtsDataEnv.Tables[this.mstrTemBg].Rows)
            {
                dtrPreview              = dtsPreviewReport.XRBUDGET2.NewRow();
                dtrPreview["nLevel"]    = Convert.ToInt32(dtrTemBg["nLevel"]);
                dtrPreview["nRun"]      = Convert.ToInt32(dtrTemBg["nRun"]);
                dtrPreview["cGroup"]    = dtrTemBg["cGroup"].ToString();
                dtrPreview["cSeq"]      = dtrTemBg["cSeq"].ToString();
                dtrPreview["cRunNo"]    = dtrTemBg["cRunNo"].ToString();
                dtrPreview["cType"]     = dtrTemBg["cType"].ToString();
                dtrPreview["cQcPrProj"] = dtrTemBg["cQcPrProj"].ToString();
                dtrPreview["cQcProj"]   = dtrTemBg["cQcProj"].ToString();
                dtrPreview["cQnProj"]   = dtrTemBg["cQnProj"].ToString();
                dtrPreview["nAmt01"]    = Convert.ToDecimal(dtrTemBg["nAmt01"]);
                dtrPreview["nAmt02"]    = Convert.ToDecimal(dtrTemBg["nAmt02"]);
                dtrPreview["nAmt03"]    = Convert.ToDecimal(dtrTemBg["nAmt03"]);
                dtrPreview["nAmt04"]    = Convert.ToDecimal(dtrTemBg["nAmt04"]);
                dtrPreview["nAmt05"]    = Convert.ToDecimal(dtrTemBg["nAmt05"]);
                dtrPreview["nAmt06"]    = Convert.ToDecimal(dtrTemBg["nAmt06"]);
                dtrPreview["nAmt07"]    = Convert.ToDecimal(dtrTemBg["nAmt07"]);
                dtrPreview["nAmt08"]    = Convert.ToDecimal(dtrTemBg["nAmt08"]);
                dtrPreview["nAmt09"]    = Convert.ToDecimal(dtrTemBg["nAmt09"]);
                dtrPreview["nAmt10"]    = Convert.ToDecimal(dtrTemBg["nAmt10"]);
                dtrPreview["nAmt11"]    = Convert.ToDecimal(dtrTemBg["nAmt11"]);
                dtrPreview["nAmt12"]    = Convert.ToDecimal(dtrTemBg["nAmt12"]);

                dtsPreviewReport.XRBUDGET2.Rows.Add(dtrPreview);
            }
            if (dtsPreviewReport.XRBUDGET2.Rows.Count != 0)
            {
                this.dataGridView1.DataSource = dtsPreviewReport.XRBUDGET2;
                this.pmPreviewReport(dtsPreviewReport);
            }
            else
            {
                MessageBox.Show(this, "ไม่มีข้อมูล", "Application confirm message", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }