Exemple #1
0
    private void dataBind()
    {
        ErrorMsgLabel.Text = "";

        string SessionIDName = "VGR061_" + PageTimeStamp.Value;

        VGRModel.VDS_VGR06_BCO BCOVGR = new VGRModel.VDS_VGR06_BCO(ConntionDB);

        ArrayList ParameterList = new ArrayList();
        ParameterList.Add(txtBatchNo.Text);
        ParameterList.Add(SLP_Date.Text);
        ParameterList.Add(SLP_Vendor.Text);
        ParameterList.Add(SLP_Item.Text);
        ParameterList.Add(SLP_Period.Text);
        ParameterList.Add(int.Parse(TextBoxRowCountLimit.Text));

        DataTable dt = BCOVGR.QueryMainByFind(ParameterList);

        if (dt.Rows.Count == 0)
        {
            ButtonNew.Enabled = false;
            SLP_LocateSection.ReadOnly = true;
            this.ErrorMsgLabel.Text = "查無資料";
        }
        else
        {
            ButtonNew.Enabled = true;
            SLP_LocateSection.ReadOnly = false;
        }
        if (!dt.Columns.Contains("CHECKED"))//增加欄位以方便判別是否可
            dt.Columns.Add("CHECKED");

        if (!dt.Columns.Contains("ROWID"))//增加欄位以判別勾選與否
            dt.Columns.Add("ROWID");

        hidden_RowID_MaxID.Value = dt == null ? "-1" : (dt.Rows.Count - 1).ToString();//記錄最大ROWID
        hidden_RowID_Selected.Value = "";//清空已選
        SetRowIDToDataTable(dt, false);//設定ROWID

        Session[SessionIDName] = dt;

        bAfterQueryDataBinding = true;

        GridView1.DataSource = dt;
        GridView1.PageSize = (TextBoxPagesize.Text == "") ? 10 : (int.Parse(TextBoxPagesize.Text) < 0) ? 10 : int.Parse(TextBoxPagesize.Text);
        GridView1.PageIndex = 0;
        GridView1.DataBind();

        bAfterQueryDataBinding = false;

        upMain.Update();
        UpdatePanel1.Update();

    }
Exemple #2
0
    private void LoadData()
    {
        ErrorMsgLabel.Text = "";


        string SSID = Request["SSID"].ToString();
        string strLocateSection = Request["LocateSection"].ToString();

        DataTable dtBoxNo = (DataTable)Session[SSID];

        DataTable dtResult = new DataTable();

        VGRModel.VDS_VGR06_BCO BCOVGR = new VGRModel.VDS_VGR06_BCO(ConntionDB);

        for (int i = 0; i < dtBoxNo.Rows.Count; i++)
        {
            ParameterList.Clear();
            ParameterList.Add(dtBoxNo.Rows[i]["box_no"].ToString());
            ParameterList.Add(strLocateSection);
            DataTable dtTemp = BCOVGR.QueryItemByBoxNO(ParameterList);
            if (i == 0)
                dtResult = dtTemp.Clone();

            dtResult.Merge(dtTemp);
        }

        DataView dv = dtResult.DefaultView;
        dv.Sort = "orderRemain asc,Remain_QTY asc,batch_no asc,box_no asc,item asc,period asc ";
        string SessionIDName = "VGR062_" + PageTimeStamp.Value;
        Session[SessionIDName] = dv.ToTable();
        GridView1.DataSource = dv;
        GridView1.DataBind();

    }//page_load
Exemple #3
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        #region
        try
        {
            ErrorMsgLabel.Text = "";
            WriteToCache();

            string strReturnNoS = string.Empty;
            string strReturnNoE = string.Empty;
            string strAdjustNoS = string.Empty;
            string strAdjustNoE = string.Empty;
            string strRemoveNoS = string.Empty;
            string strRemoveNoE = string.Empty;
            string strLocateSection = Request["LocateSection"].ToString();
            DateTime dtNow = DateTime.Now;
            VGRModel.VDS_VGR06_BCO BCOVGR = new VGRModel.VDS_VGR06_BCO(ConntionDB);
            ParameterList.Clear();
            ParameterList.Add(Session["UID"].ToString());
            ParameterList.Add(strLocateSection);
            ParameterList.Add(dtNow);
            //0.UserID            
            //1.LocateSection
            string SessionIDName = "VGR062_" + PageTimeStamp.Value;
            DataTable dtData = (DataTable)Session[SessionIDName];
            if (dtData.Rows.Count == 0)
            {
                ErrorMsgLabel.Text = "沒有明細資料,請回查詢頁重新選取!";
                return;
            }
            BCOVGR.SaveData(ParameterList, dtData, out  strReturnNoS, out  strReturnNoE, out  strAdjustNoS, out  strAdjustNoE, out strRemoveNoS, out strRemoveNoE);


            //儲存完後,載入資料
            if (strReturnNoS != "")
            {
                txtReturn_No_S.Text = strReturnNoS;
                if (strReturnNoE != "")
                    txtReturn_No_E.Text = strReturnNoE;
                else
                    txtReturn_No_E.Text = strReturnNoS;

                txtAdjust_No_S.Text = strAdjustNoS;
                if (strAdjustNoE != "")
                    txtAdjust_No_E.Text = strAdjustNoE;
                else
                    txtAdjust_No_E.Text = strAdjustNoS;

                txtRemove_No_S.Text = strRemoveNoS;
                if (strRemoveNoE != "")
                    txtRemove_No_E.Text = strRemoveNoE;
                else
                    txtRemove_No_E.Text = strRemoveNoS;

                txtCreateDate.Text = dtNow.ToString("yyyy/MM/dd HH:mm:ss");
                slpCreateID.Text = Session["UID"].ToString();
                txtUpdateDate.Text = dtNow.ToString("yyyy/MM/dd HH:mm:ss");
                slpUpdateID.Text = Session["UID"].ToString();
                slpReturn_Date.Text = dtNow.ToString("yyyy/MM/dd");
                //txtRemoveNo.Text = strRemoveNo;

                btnPrint1.Enabled = true;
                btnPrint2.Enabled = true;

                btnPrint1.OnClientClick = "AddIFrameTab('VGR04供應商退貨單明細表列印處理','../VGR/VGR041.aspx?Code=VGR04&Return_No_S=" + txtReturn_No_S.Text + "&Return_No_E=" + txtReturn_No_E.Text + "&eturn_Date=" + slpReturn_Date.Text + "');return false;";

            }

            btnSave.Enabled = false;
            btnCancel.Enabled = false;

            ViewState["MODE"] = "VIEW";
            GridView1.DataSource = dtData.DefaultView;
            GridView1.DataBind();
            UpdatePanel1.Update();

            ErrorMsgLabel.Text = "儲存成功";
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
        }
        #endregion
    }
Exemple #4
0
        /// <summary>
        /// CGR05報表
        /// </summary>
        /// <param name="ParameterList">變數清單</param>
        /// <returns>回傳查詢結果</returns>
        public DataTable VGR06_1(ArrayList ParameterList,
                                 string ReportOutputFormat,
                                 ref ReportList.ExcelOtherType EOT
                                 )
        {
            VGRModel.VDS_VGR06_BCO bco = new VGRModel.VDS_VGR06_BCO(ConntionDB);
            DataTable dtData = bco.GetRptData(ParameterList);

            if (dtData.Rows.Count == 0)
            {
                throw new Exception("查無資料");
            }
            else
            {
                DataTable dtResult = dtData.Copy();
                DataView dv = dtData.DefaultView;
                dv.Sort = "Return_No asc,Item asc,Period asc";
                dtData = dv.ToTable();
                //取得筆數資料,筆數未滿10的倍數,塞假資料補成10的倍數(因為套表是10筆1張)                
                int iSeqNo = 0;
                for (int j = 0; j < dtData.Rows.Count; j++)
                {
                    if (j > 0)
                    {
                        if (dtData.Rows[j]["Return_No"].ToString().Trim() != dtData.Rows[j - 1]["Return_No"].ToString().Trim())
                        {
                            if (iSeqNo < 10)
                            {
                                for (int i = 0; i < (10 - iSeqNo); i++)
                                {
                                    DataRow drNew = dtResult.NewRow();
                                    drNew["Return_Date"] = dtData.Rows[j - 1]["Return_Date"].ToString();
                                    drNew["Vendor_Name"] = dtData.Rows[j - 1]["Vendor_Name"].ToString();
                                    drNew["Vendor"] = dtData.Rows[j - 1]["Vendor"].ToString();
                                    drNew["Business_Contact"] = dtData.Rows[j - 1]["Business_Contact"].ToString();
                                    drNew["Business_Fax"] = dtData.Rows[j - 1]["Business_Fax"].ToString();
                                    drNew["Return_No"] = dtData.Rows[j - 1]["Return_No"].ToString();
                                    drNew["Tax_Total_Amt"] = decimal.Parse(dtData.Rows[j - 1]["Tax_Total_Amt"].ToString());
                                    drNew["UnTax_Total_Amt"] = decimal.Parse(dtData.Rows[j - 1]["UnTax_Total_Amt"].ToString());
                                    drNew["Tax_Amt"] = decimal.Parse(dtData.Rows[j - 1]["Tax_Amt"].ToString());
                                    drNew["Item"] = "XXXXXXXXXX"; //只要ITEM是XXXXXXXXXX就抑制顯示
                                    drNew["Item_Name"] = "";
                                    drNew["Period"] = "";
                                    drNew["Return_Qty"] = 0;
                                    drNew["Price"] = 0;
                                    drNew["Cost"] = 0;
                                    dtResult.Rows.Add(drNew);
                                }                               
                            } 
                            iSeqNo = 0;
                        }
                    }
                    iSeqNo++;
                }

                if (iSeqNo < 10) //判斷最後一筆是否為第10筆
                {
                    for (int i = 0; i < (10 - iSeqNo); i++)
                    {
                        DataRow drNew = dtResult.NewRow();
                        drNew["Return_Date"] = dtData.Rows[dtData.Rows.Count - 1]["Return_Date"].ToString();
                        drNew["Vendor_Name"] = dtData.Rows[dtData.Rows.Count - 1]["Vendor_Name"].ToString();
                        drNew["Vendor"] = dtData.Rows[dtData.Rows.Count - 1]["Vendor"].ToString();
                        drNew["Business_Contact"] = dtData.Rows[dtData.Rows.Count - 1]["Business_Contact"].ToString();
                        drNew["Business_Fax"] = dtData.Rows[dtData.Rows.Count - 1]["Business_Fax"].ToString();
                        drNew["Return_No"] = dtData.Rows[dtData.Rows.Count - 1]["Return_No"].ToString();
                        drNew["Tax_Total_Amt"] = decimal.Parse(dtData.Rows[dtData.Rows.Count - 1]["Tax_Total_Amt"].ToString());
                        drNew["UnTax_Total_Amt"] = decimal.Parse(dtData.Rows[dtData.Rows.Count - 1]["UnTax_Total_Amt"].ToString());
                        drNew["Tax_Amt"] = decimal.Parse(dtData.Rows[dtData.Rows.Count - 1]["Tax_Amt"].ToString());
                        drNew["Item"] = "XXXXXXXXXX"; //只要ITEM是XXXXXXXXXX就抑制顯示
                        drNew["Item_Name"] = "";
                        drNew["Period"] = "";
                        drNew["Return_Qty"] = 0;
                        drNew["Price"] = 0;
                        drNew["Cost"] = 0;
                        dtResult.Rows.Add(drNew);
                    }
                }

                dv = dtResult.DefaultView;
                dv.Sort = "Return_No asc,Item asc,Period asc";
                dtResult = dv.ToTable();

                return dtResult;
            }
        }