Пример #1
0
        public override void UpdateChargeGrid(Object _chargeObjects)
        {
            CalculateChargeClass calculateChargeClass =
                (_chargeObjects as Dictionary <string, object>)["第一阶段"] as CalculateChargeClass;

            base.UpdateChargeGrid(calculateChargeClass);
            if (calculateChargeClass != null)
            {
                DataRow row = _chargeTable_1.NewRow();
                row[0] = calculateChargeClass.MID;
                row[1] = "有功(总)";
                row[2] = calculateChargeClass.endEnergy.ToString("#0.00");
                row[3] = calculateChargeClass.startEnergy.ToString("#0.00");
                row[4] = "30";
                row[5] = calculateChargeClass.totalPower.ToString("#0.00");
                _chargeTable_1.Rows.Add(row);

                row    = _chargeTable_1.NewRow();
                row[0] = calculateChargeClass.MID;
                row[1] = "有功(尖峰)";
                row[2] = calculateChargeClass.spikeEnergy.ToString("#0.00");
                row[4] = "30";
                row[5] = calculateChargeClass.spikePower.ToString("#0.00");
                _chargeTable_1.Rows.Add(row);

                row    = _chargeTable_1.NewRow();
                row[0] = calculateChargeClass.MID;
                row[1] = "有功(峰)";
                row[2] = calculateChargeClass.peakEnergy.ToString("#0.00");;
                row[4] = "30";
                row[5] = calculateChargeClass.peakPower.ToString("#0.00");
                _chargeTable_1.Rows.Add(row);

                row    = _chargeTable_1.NewRow();
                row[0] = calculateChargeClass.MID;
                row[1] = "有功(谷)";
                row[2] = calculateChargeClass.valleyEnergy.ToString("#0.00");;
                row[4] = "30";
                row[5] = calculateChargeClass.valleyPower.ToString("#0.00");
                _chargeTable_1.Rows.Add(row);

                row    = _chargeTable_1.NewRow();
                row[0] = calculateChargeClass.MID;
                row[1] = "无功(QI象限)";
                row[2] = "";
                row[4] = "30";
                row[5] = calculateChargeClass.ReactiveQI.ToString("#0.00");
                _chargeTable_1.Rows.Add(row);

                DataRow row1 = _chargeTable_2.NewRow();
                row1[0] = calculateChargeClass.activeCopperLoss.ToString("#0.00");
                row1[1] = calculateChargeClass.activeCoreLoss.ToString("#0.00");
                row1[2] = calculateChargeClass.activeAll.ToString("#0.00");
                row1[3] = calculateChargeClass.reactiveCopperLoss.ToString("#0.00");
                row1[4] = calculateChargeClass.reactiveCoreLoss.ToString("#0.00");
                row1[5] = calculateChargeClass.reactiveAll.ToString("#0.00");
                row1[6] = calculateChargeClass.peakPower.ToString("#0.00");
                row1[7] = calculateChargeClass.valleyPower.ToString("#0.00");
                row1[8] = calculateChargeClass.spikePower.ToString("#0.00");
                _chargeTable_2.Rows.Add(row1);

                DataRow row2 = _chargeTable_3.NewRow();
                row2[0] = 0;
                row2[1] = 0;
                row2[2] = 0;
                row2[3] = 0;
                row2[4] = 0;
                row2[5] = 0;
                row2[6] = 0;
                row2[7] = 0;
                row2[8] = 0;
                _chargeTable_3.Rows.Add(row2);

                DataRow row3  = _chargeTable_4.NewRow();
                Double  total = 0;
                row3[0] = "尖 一般工商";
                row3[1] = calculateChargeClass.spikePower.ToString("#0.00");
                row3[2] = 0;
                row3[3] = "kW.h";
                row3[4] =
                    ((_chargeObjects as Dictionary <string, object>)["电量参数"] as List <ElectricityParameter>)[0].PriceSpike;
                row3[5] = (Convert.ToDouble(row3[4].ToString()) * Convert.ToDouble(row3[1].ToString())).ToString("#0.00");
                total  += Convert.ToDouble(row3[5]);
                _chargeTable_4.Rows.Add(row3);
                row3    = _chargeTable_4.NewRow();
                row3[0] = "峰 一般工商";
                row3[1] = calculateChargeClass.peakPower.ToString("#0.00");
                row3[2] = 0;
                row3[3] = "kW.h";
                row3[4] =
                    ((_chargeObjects as Dictionary <string, object>)["电量参数"] as List <ElectricityParameter>)[0].PricePeak;
                row3[5] = (Convert.ToDouble(row3[4].ToString()) * Convert.ToDouble(row3[1].ToString())).ToString("#0.00");
                total  += Convert.ToDouble(row3[5]);
                _chargeTable_4.Rows.Add(row3);
                row3    = _chargeTable_4.NewRow();
                row3[0] = "谷 一般工商";
                row3[1] = calculateChargeClass.valleyPower.ToString("#0.00");
                row3[2] = 0;
                row3[3] = "kW.h";
                row3[4] =
                    ((_chargeObjects as Dictionary <string, object>)["电量参数"] as List <ElectricityParameter>)[0]
                    .PriceValley;
                row3[5] = (Convert.ToDouble(row3[4].ToString()) * Convert.ToDouble(row3[1].ToString())).ToString("#0.00");
                total  += Convert.ToDouble(row3[5]);
                _chargeTable_4.Rows.Add(row3);
                row3    = _chargeTable_4.NewRow();
                row3[0] = "合计";
                row3[1] = "";
                row3[2] = "";
                row3[3] = "";
                row3[4] = "";
                row3[5] = total.ToString("#0.00");
                _chargeTable_4.Rows.Add(row3);


                gridCharge_1.DataSource = _chargeTable_1;
                gridCharge_2.DataSource = _chargeTable_2;
                gridCharge_3.DataSource = _chargeTable_3;
                gridCharge_4.DataSource = _chargeTable_4;


                XtraReport1 report = new XtraReport1();
                report.ExportOptions.PrintPreview.DefaultFileName = "国网浙江慈溪市供电公司非居民用户电费复核单据 (一次抄表)" +
                                                                    DateTime.Now.ToString("D");


                documentViewer.DocumentSource = report;
                report.SetReportDataSource(_chargeTable_1, _chargeTable_2, _chargeTable_3, _chargeTable_4);
            }
        }