Ejemplo n.º 1
0
    //離開品號或期別的時候,去資料庫內讀取符合條件的相關資料
    public static string AddNewToSession(string sItem, string sPeriod, string sDate, string sPageTimeStamp, string sID)
    {
        String rtnValue = "";
        ArrayList ParameterList = new ArrayList();

        PUR_PUR022 PUR022 = new PUR_PUR022();
        DataTable dtDetail = (DataTable)PUR022.Session["PUR02_DTL_" + sPageTimeStamp];

        string DeatilData = string.Empty;
        if (sDate.Trim() != "")
        {
            MaintainPurchaseOrder bco = new MaintainPurchaseOrder(ConntionDB);
            ParameterList.Clear();
            ParameterList.Add(sItem);
            ParameterList.Add(sPeriod);
            ParameterList.Add(DateTime.Parse(sDate.Trim()).ToString("yyyy/MM/dd"));

            DateTime DT = DateTime.ParseExact(DateTime.Parse(sDate.Trim()).ToString("yyyy/MM/dd"), "yyyy/MM/dd", null);
            DateTime DT2 = DT.AddMonths(-1);
            string sDT = DT2.ToString("yyyy/MM");
            sDT = sDT + "/26";
            ParameterList.Add(DateTime.Parse(sDT.Trim()).ToString("yyyy/MM/dd"));

            DeatilData = bco.GetDetail_Data(ParameterList);
        }

        //找出新增或修改的筆數資料,將其輸入的值放到Session內
        DataRow[] FindRows = dtDetail.Select("ID='" + sID + "'");
        if (DeatilData != "")
        {
            string[] DetailAry;
            DetailAry = DeatilData.Split(new Char[] { ';' });
            FindRows[0]["ITEM"] = sItem;
            FindRows[0]["PERIOD"] = sPeriod;
            FindRows[0]["COST"] = DetailAry[2].ToString();
            FindRows[0]["MDC_QTY"] = DetailAry[3].ToString();
            FindRows[0]["ACCEPT_ACCQTY"] = DetailAry[4].ToString();
            FindRows[0]["PURCHASE_QTY"] = "0";
            FindRows[0]["PLAN_ACCEPT_DATE"] = DetailAry[5].ToString();
            FindRows[0]["SUMY_COST"] = "0.00";
            FindRows[0]["MSG"] = DetailAry[6].ToString();
            FindRows[0]["STATUS"] = "FIRST";
            rtnValue = "NEW";
        }
        else
        {
            FindRows[0]["ITEM"] = sItem;
            FindRows[0]["PERIOD"] = sPeriod;
            FindRows[0]["COST"] = "0";
            FindRows[0]["MDC_QTY"] = "0";
            FindRows[0]["ACCEPT_ACCQTY"] = "0";
            FindRows[0]["PURCHASE_QTY"] = "0";
            FindRows[0]["PLAN_ACCEPT_DATE"] = "";
            FindRows[0]["SUMY_COST"] = "0.00";
            FindRows[0]["MSG"] = "";
            rtnValue = "NEW_NOREF";
        }
        rtnValue = rtnValue + "<partition>" + decimal.Parse(FindRows[0]["COST"].ToString()).ToString("0.00") + "<partition>" + FindRows[0]["ACCEPT_ACCQTY"].ToString() + "<partition>" + FindRows[0]["MDC_QTY"].ToString() + "<partition>" + FindRows[0]["PLAN_ACCEPT_DATE"].ToString() + "<partition>" + FindRows[0]["MSG"].ToString();
        PUR022.Session["PUR02_DTL_" + sPageTimeStamp] = dtDetail;

        return rtnValue;
    }
Ejemplo n.º 2
0
        private DataTable FilterDetail(DataTable dtData, string strMANUFACTURE)
        {
            ArrayList ParameterList = new ArrayList();
            MaintainPurchaseOrder PUR02_BCO = new MaintainPurchaseOrder(strConn);
            DataRow[] FindRow = dtData.Select("MANUFACTURE='" + strMANUFACTURE + "'");
            DataTable dtDetail = Detail_Schema();
            int i = 1;
            foreach (DataRow dr in FindRow)
            {
                ParameterList.Clear();
                ParameterList.Add(dr["ITEM"].ToString());
                ParameterList.Add(dr["PERIOD"].ToString());
                ParameterList.Add(DateTime.Now.ToString("yyyy/MM/dd"));

                DateTime DT2 = DateTime.Now.AddMonths(-1);
                string sDT = DT2.ToString("yyyy/MM");
                sDT = sDT + "/26";
                ParameterList.Add(DateTime.Parse(sDT.Trim()).ToString("yyyy/MM/dd"));

                string DeatilData = PUR02_BCO.GetDetail_Data(ParameterList);
                string[] DetailAry;
                DetailAry = DeatilData.Split(new Char[] { ';' });

                DataRow dRow = dtDetail.NewRow();
                dRow["IS_ADD"] = 1;
                dRow["ID"] = i;
                dRow["ITEM"] = dr["ITEM"].ToString();
                dRow["PERIOD"] = dr["PERIOD"].ToString();
                dRow["VIRTUAL_CODE"] = dr["ITEM"].ToString();
                dRow["COST"] = DetailAry[2].ToString();
                dRow["MDC_QTY"] = DetailAry[3].ToString();
                dRow["ACCEPT_ACCQTY"] = DetailAry[4].ToString();

                //取得預設的採購量
                ParameterList.Clear();
                ParameterList.Add(dr["ITEM"].ToString());
                ParameterList.Add(dr["PERIOD"].ToString());
                ParameterList.Add(dr["ROOT_NO"].ToString());
                DataTable dtQty = GetPURCHASE_QTY(ParameterList);
                dRow["PURCHASE_QTY"] = dtQty.Rows[0][0].ToString();

                //dRow["PLAN_ACCEPT_DATE"] = DetailAry[5].ToString();
                dRow["PLAN_ACCEPT_DATE"] = dtQty.Rows[0][1].ToString();

                dRow["MSG"] = DetailAry[6].ToString();
                dRow["CLOSE_TYPE"] = "";
                dRow["CLOSE_DATE"] = "";
                dtDetail.Rows.Add(dRow);
                i++;
            }
            dtDetail.AcceptChanges();
            return dtDetail;
        }
Ejemplo n.º 3
0
    private void RefreshCost()
    {
        ArrayList ParameterList = new ArrayList();
        string sPageTimeStamp = PageTimeStamp.Value;
        DataTable dtDetail = (DataTable)Session["PUR02_DTL_" + sPageTimeStamp];
        foreach (GridViewRow row in gv_Detail.Rows)
        {
            string sID = ((HiddenField)row.FindControl("HidenID")).Value;
            string sItem = ((ASP.itm_slp_slp_sku_vender_ascx)row.FindControl("PUR_SKU")).Text;
            string sPeriod = ((ASP.itm_slp_slp_itemperiod_ascx)row.FindControl("PUR_Period")).Text;

            string DeatilData = string.Empty;
            string sDate = this.PUR_PURDate.Text.Trim();
            if (sDate != "")
            {
                MaintainPurchaseOrder bco = new MaintainPurchaseOrder(ConntionDB);
                ParameterList.Clear();
                ParameterList.Add(sItem);
                ParameterList.Add(sPeriod);
                ParameterList.Add(DateTime.Parse(sDate.Trim()).ToString("yyyy/MM/dd"));

                DateTime DT = DateTime.ParseExact(DateTime.Parse(sDate.Trim()).ToString("yyyy/MM/dd"), "yyyy/MM/dd", null);
                DateTime DT2 = DT.AddMonths(-1);
                string sDT = DT2.ToString("yyyy/MM");
                sDT = sDT + "/26";
                ParameterList.Add(DateTime.Parse(sDT.Trim()).ToString("yyyy/MM/dd"));

                DeatilData = bco.GetDetail_Data(ParameterList);
            }

            //找出新增或修改的筆數資料,將其輸入的值放到Session內
            DataRow[] FindRows = dtDetail.Select("ID='" + sID + "'");
            if (DeatilData != "")
            {
                string[] DetailAry;
                DetailAry = DeatilData.Split(new Char[] { ';' });
                FindRows[0]["ITEM"] = sItem;
                FindRows[0]["PERIOD"] = sPeriod;
                FindRows[0]["COST"] = DetailAry[2].ToString();
                FindRows[0]["MDC_QTY"] = DetailAry[3].ToString();
                FindRows[0]["ACCEPT_ACCQTY"] = DetailAry[4].ToString();
                FindRows[0]["PLAN_ACCEPT_DATE"] = DetailAry[5].ToString();
            }
            else
            {
                FindRows[0]["ITEM"] = sItem;
                FindRows[0]["PERIOD"] = sPeriod;
                FindRows[0]["COST"] = "0";
                FindRows[0]["MDC_QTY"] = "0";
                FindRows[0]["ACCEPT_ACCQTY"] = "0";
                FindRows[0]["PLAN_ACCEPT_DATE"] = "";
            }
        }
        Session["PUR02_DTL_" + sPageTimeStamp] = dtDetail;
    }