コード例 #1
0
    public static ALOModel.ALOCommon.PERIODWithChanSale GetPeriodWithSalesItem(ALOModel.ALOCommon.PERIODWithChanSale PERIODWithChanSaleObject)
    {
        try
        {
            ALOModel.QueryALOCommon PeriodProc = new ALOModel.QueryALOCommon(ConnectionDB);

            #region 輸入變數

            ArrayList ParameterList = new ArrayList();//20091113

            ParameterList.Clear();
            //品號
            ParameterList.Add(PERIODWithChanSaleObject.Item);
            //期別
            ParameterList.Add(PERIODWithChanSaleObject.Period);
            //通路
            ParameterList.Add(PERIODWithChanSaleObject.ChanNO);

            #endregion

            DataTable Dt = PeriodProc.QueryItemPeriodChanSalesInfo(ParameterList);

            if (Dt.Rows.Count == 0)
            {
                PERIODWithChanSaleObject.NoDataErrorMsg = "查無銷售實績,不可做為參考品項!";
            }
            else
            {
                //進貨
                PERIODWithChanSaleObject.AcceptQty = Dt.Rows[0]["ACCEPT_QTY"].ToString();
                //退貨
                PERIODWithChanSaleObject.BackWardQty = Dt.Rows[0]["BACKWARD_QTY"].ToString();
                //實績
                int iRealSale = int.Parse(PERIODWithChanSaleObject.AcceptQty) -
                                int.Parse(PERIODWithChanSaleObject.BackWardQty);

                PERIODWithChanSaleObject.RealSale = iRealSale.ToString();
                //實銷率
                double iRealSalePercent = double.Parse(PERIODWithChanSaleObject.RealSale) /
                                          double.Parse(PERIODWithChanSaleObject.AcceptQty) * 100;

                PERIODWithChanSaleObject.RealSalePercent = Math.Round(iRealSalePercent, 0).ToString();
                //錯誤訊息
                PERIODWithChanSaleObject.NoDataErrorMsg = "";
            }

            return PERIODWithChanSaleObject;
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }