コード例 #1
0
            /// <summary>
            /// 排序方法
            /// </summary>
            public int Compare(object x, object y)
            {
                ItemizedBill o1 = (x as ItemizedBill);
                ItemizedBill o2 = (y as ItemizedBill);

                string oX = o1.OperDate;          //操作日期
                string oY = o2.OperDate;          //

                int nComp;

                if (oX == null)
                {
                    nComp = (oY != null) ? -1 : 0;
                }
                else if (oY == null)
                {
                    nComp = 1;
                }
                else
                {
                    nComp = string.Compare(oX.ToString(), oY.ToString());
                }

                return(nComp);
            }
コード例 #2
0
        private ArrayList QueryItemizedData(string execSql, DataSource dataSource, DateTime beginDate, DateTime endDate)
        {
            if (dataManagment.ExecQuery(execSql, this.DrugDept.ID, this.DrugCode, beginDate.ToString(), endDate.ToString()) == -1)
            {
                MessageBox.Show("执行查询Sql语句发生错误" + this.dataManagment.Err);
                return(null);
            }

            ArrayList alData = new ArrayList();

            while (this.dataManagment.Reader.Read())
            {
                ItemizedBill info = new ItemizedBill();

                info.Source = dataSource;

                info.OperDate     = this.dataManagment.Reader[0].ToString(); //日期
                info.ListNO       = this.dataManagment.Reader[1].ToString(); //单据号
                info.OperType     = this.dataManagment.Reader[2].ToString(); //权限类别
                info.TargetDeptNO = this.dataManagment.Reader[3].ToString();
                info.Qty          = Neusoft.FrameWork.Function.NConvert.ToDecimal(this.dataManagment.Reader[4]);
                info.RetailPrice  = Neusoft.FrameWork.Function.NConvert.ToDecimal(this.dataManagment.Reader[5]);
                info.Cost         = Neusoft.FrameWork.Function.NConvert.ToDecimal(this.dataManagment.Reader[6]);
                if (dataManagment.Reader.FieldCount > 7)
                {
                    info.BatchNo = this.dataManagment.Reader[7].ToString();
                }
                if (dataManagment.Reader.FieldCount > 8)
                {
                    info.PurchasePrice = Neusoft.FrameWork.Function.NConvert.ToDecimal(this.dataManagment.Reader[8]);
                }
                alData.Add(info);
            }

            return(alData);
        }
コード例 #3
0
        /// <summary>
        /// 数据检索显示
        /// </summary>
        /// <param name="alData">所有数据</param>
        /// <returns>成功返回1 失败返回-1</returns>
        protected int ShowData(ArrayList alData)
        {
            this.neuSpread1_Sheet1.Rows.Count = 0;

            this.neuSpread1_Sheet1.Rows.Count = 0;

            int    iRowIndex       = 0;
            string currentMonthStr = "";

            for (int i = 0; i < alData.Count; i++)
            {
                ItemizedBill info = alData[i] as ItemizedBill;

                this.neuSpread1_Sheet1.Rows.Add(iRowIndex, 1);

                this.neuSpread1_Sheet1.Cells[iRowIndex, 0].Text = info.OperDate;     //日期
                this.neuSpread1_Sheet1.Cells[iRowIndex, 1].Text = info.ListNO;       //凭证编号
                this.neuSpread1_Sheet1.Cells[iRowIndex, 2].Text = info.TargetDeptNO; //摘要

                // 购入价
                if (info.Source == DataSource.In || info.Source == DataSource.Out)
                {
                    this.neuSpread1_Sheet1.Cells[iRowIndex, 3].Text = info.PurchasePrice.ToString();
                }
                else
                {
                    this.neuSpread1_Sheet1.Cells[iRowIndex, 3].Text = "";
                }

                //增加批号显示 sdh 2010-01-07
                this.neuSpread1_Sheet1.Cells[iRowIndex, 12].Text = info.BatchNo;//批号

                string source = info.OperType;

                if ((info.Source == DataSource.In) || (info.Source == DataSource.Adjust && info.OperType == "调盈") ||
                    (info.Source == DataSource.Check && info.OperType == "盘盈"))
                {
                    this.neuSpread1_Sheet1.Cells[iRowIndex, 4].Text = info.Qty.ToString();
                    this.neuSpread1_Sheet1.Cells[iRowIndex, 5].Text = info.RetailPrice.ToString();
                    this.neuSpread1_Sheet1.Cells[iRowIndex, 6].Text = info.Cost.ToString();

                    if (this.hsProduce.ContainsKey(info.TargetDeptNO))
                    {
                        source = source + "(" + this.hsProduce[info.TargetDeptNO] + ")";
                    }
                }
                else if ((info.Source == DataSource.Out) || (info.Source == DataSource.Adjust && info.OperType == "调亏") ||
                         (info.Source == DataSource.Check && info.OperType == "盘亏"))
                {
                    this.neuSpread1_Sheet1.Cells[iRowIndex, 7].Text = info.Qty.ToString();
                    this.neuSpread1_Sheet1.Cells[iRowIndex, 8].Text = info.RetailPrice.ToString();
                    this.neuSpread1_Sheet1.Cells[iRowIndex, 9].Text = info.Cost.ToString();

                    if (this.hsDept.ContainsKey(info.TargetDeptNO))
                    {
                        source = source + "(" + this.hsDept[info.TargetDeptNO] + ")";
                    }
                }
                else if (info.Source == DataSource.MonthCurrent || info.Source == DataSource.MonthLast)
                {
                    this.neuSpread1_Sheet1.Cells[iRowIndex, 10].Text = info.Qty.ToString();
                    this.neuSpread1_Sheet1.Cells[iRowIndex, 11].Text = info.Cost.ToString();

                    this.neuSpread1_Sheet1.Rows[iRowIndex].Tag = info.Source.ToString();
                }

                this.neuSpread1_Sheet1.Cells[iRowIndex, 2].Text = source;      //摘要
                if (info.Source == DataSource.In)
                {
                    this.neuSpread1_Sheet1.Cells[iRowIndex, 2].Text = source + "(" + info.TargetDeptNO + ")";
                }

                if (info.OperType == "本期库存")
                {
                    iRowIndex++;

                    this.neuSpread1_Sheet1.Rows.Add(iRowIndex, 1);
                    this.neuSpread1_Sheet1.Cells[iRowIndex, 0].Text = info.OperDate.Substring(0, 7);
                    this.neuSpread1_Sheet1.Cells[iRowIndex, 2].Text = "本期合计";

                    this.neuSpread1_Sheet1.Rows[iRowIndex].Tag = "1";       //标识合计行
                }

                iRowIndex++;

                currentMonthStr = info.OperDate.Substring(0, 8);

                //if (string.IsNullOrEmpty(currentMonthStr) == true)
                //{
                //    currentMonthStr = info.OperDate.Substring(0, 7);
                //}
                //else
                //{
                //    if (currentMonthStr != info.OperDate.Substring(0, 7))       //不是同一个月的数据
                //    {
                //        this.neuSpread1_Sheet1.Rows.Add(iRowIndex, 1);
                //        this.neuSpread1_Sheet1.Cells[iRowIndex, 0].Text = info.OperDate.Substring(0, 7);
                //        this.neuSpread1_Sheet1.Cells[iRowIndex, 2].Text = "本期合计";

                //        this.neuSpread1_Sheet1.Rows[iRowIndex].Tag = "1";       //标识合计行

                //        iRowIndex++;

                //        currentMonthStr = info.OperDate.Substring(0, 7);
                //    }
                //}
            }

            //this.neuSpread1_Sheet1.Rows.Add(iRowIndex, 1);
            //this.neuSpread1_Sheet1.Cells[iRowIndex, 0].Text = currentMonthStr;
            //this.neuSpread1_Sheet1.Cells[iRowIndex, 2].Text = "本期合计";

            //this.neuSpread1_Sheet1.Rows[iRowIndex].Tag = "1";

            this.neuSpread1_Sheet1.Rows.Add(iRowIndex, 1);
            this.neuSpread1_Sheet1.Cells[iRowIndex, 0].Text = "";
            this.neuSpread1_Sheet1.Cells[iRowIndex, 2].Text = "当前合计";

            this.neuSpread1_Sheet1.Rows[iRowIndex].Tag = "1";      //标识合计行

            this.SumByMonth();

            return(1);
        }