/// <summary> /// MKT10報表 /// </summary> /// <param name="ParameterList">變數清單</param> /// <returns>回傳查詢結果</returns> public DataSet MKT05_1(ArrayList ParameterList) { DataSet ds = new DataSet(); MKTModel.MaintainPurchaseCard bco = new MKTModel.MaintainPurchaseCard(ConntionDB); DataTable Dt1 = bco.QueryMstForPrint(ParameterList); if (Dt1.Rows.Count == 0) throw new Exception("查無資料"); DataTable Dt2 = Check_Row(bco.QueryDetlForPrint(ParameterList), ParameterList[0].ToString()); Dt1.TableName = "CRMKT05R01"; ds.Tables.Add(Dt1.Copy()); Dt2.TableName = "CRMKT05R02"; ds.Tables.Add(Dt2.Copy()); return ds; }
protected void Btn_PurchaseCard_Click(object sender, EventArgs e) { string strRootNo = string.Empty; string strUrl = string.Empty; string strItem = this.SLP_SKU1.Text; string strPeriod = this.SLP_ItemPeriod1.Text; #region 取得Root No決定連結 採購卡or圖書採購卡 BCO.MaintainGift bcoGift = new BCO.MaintainGift(ConnectionDB); DataTable dt = new DataTable(); dt = bcoGift.GetItemDataByItem(this.getParameterList()); //品號資料check if (dt == null || (dt != null && dt.Rows.Count <= 0)) { ErrorMsgLabel.Text = "品號資料錯誤"; return; } strRootNo = dt.Rows[0]["ROOT_NO"].ToString(); #endregion #region 連結 採購卡or圖書採購卡 if (strRootNo == "1") //雜誌 { ParameterList.Clear(); SQLHelper.SQLWhere(ref ParameterList, DbType.VarNumeric, "M.ENABLE", 1, "=", "and"); SQLHelper.SQLWhere(ref ParameterList, DbType.String, "ROWNUM", "2", "<=", "and"); SQLHelper.SQLWhere(ref ParameterList, DbType.String, "I.ITEM", SLP_SKU1.Text, "=", "and"); SQLHelper.SQLWhere(ref ParameterList, DbType.String, "M.PERIOD", SLP_ItemPeriod1.Text, "=", "and"); SQLHelper.SQLWhere(ref ParameterList, DbType.String, "I.MANUFACTURE", "", "=", "and"); SQLHelper.SQLWhere(ref ParameterList, DbType.String, "I.PUBLISH_TYPE", "", "=", "and"); SQLHelper.SQLWhere(ref ParameterList, DbType.String, "M.CREATEUID", "", "=", "and"); SQLHelper.SQLWhere(ref ParameterList, DbType.DateTime, "M.PLAN_ACCEPT_DATE", "", ">=", "and"); SQLHelper.SQLWhere(ref ParameterList, DbType.DateTime, "M.PLAN_ACCEPT_DATE", "", "<=", "and"); SQLHelper.SQLWhere(ref ParameterList, DbType.DateTime, "M.PLAN_PUBLISH_DATE", "", ">=", "and"); SQLHelper.SQLWhere(ref ParameterList, DbType.DateTime, "M.PLAN_PUBLISH_DATE", "", "<=", "and"); MaintainPurchaseCard bco = new MaintainPurchaseCard(ConnectionDB); DataTable Dt = bco.QueryPurchaseCardByFind_1(ParameterList); string ID = ""; if (Dt.Rows.Count > 0) { DataRow[] dr = Dt.Select("1=1", "createdate desc"); ID = dr[0]["ID"].ToString(); strUrl = Application["AppSite_RootDir"] + "MKT/MKT052.aspx?Code=MKT05&ID=" + ID; //開啟[採購卡維護], 預設進入新增模式,並帶入品號&期別作為預設條件 ScriptManager.RegisterStartupScript(this.upButton, typeof(UpdatePanel), "MKT052", "AddIFrameTab('採購卡維護','" + strUrl + "')", true); } else ScriptManager.RegisterClientScriptBlock(this.upButton, typeof(UpdatePanel), "", "if (confirm('該品項尚未開立採購卡,是否進入採購卡新增畫面?')){this.disabled=true;__doPostBack('','GoInsert05');}", true); } else if (strRootNo == "2")//圖書 { ParameterList.Clear(); SQLHelper.SQLWhere(ref ParameterList, DbType.VarNumeric, "M.ENABLE", 1, "=", "and"); SQLHelper.SQLWhere(ref ParameterList, DbType.String, "ROWNUM", "2", "<=", "and"); SQLHelper.SQLWhere(ref ParameterList, DbType.String, "I.ITEM", SLP_SKU1.Text, "=", "and"); SQLHelper.SQLWhere(ref ParameterList, DbType.String, "I.MANUFACTURE", "", "=", "and"); SQLHelper.SQLWhere(ref ParameterList, DbType.String, "I.PATTERN_NO", "", "=", "and"); SQLHelper.SQLWhere(ref ParameterList, DbType.String, "M.COMMODITY_LEVEL", "", "=", "and"); SQLHelper.SQLWhere(ref ParameterList, DbType.DateTime, "M.PLAN_ACCEPT_DATE", "", ">=", "and"); SQLHelper.SQLWhere(ref ParameterList, DbType.DateTime, "M.PLAN_ACCEPT_DATE", "", "<=", "and"); SQLHelper.SQLWhere(ref ParameterList, DbType.DateTime, "M.PLAN_PUBLISH_DATE", "", ">=", "and"); SQLHelper.SQLWhere(ref ParameterList, DbType.DateTime, "M.PLAN_PUBLISH_DATE", "", "<=", "and"); MaintainBooksPurchaseCardMain bco = new MaintainBooksPurchaseCardMain(ConnectionDB); DataTable Dt = bco.QueryBooksPurchaseCardMainByFind_1(ParameterList); string ID = ""; if (Dt.Rows.Count > 0) { DataRow[] dr = Dt.Select("1=1", "createdate desc"); ID = dr[0]["ID"].ToString(); strUrl = Application["AppSite_RootDir"] + "MKT/MKT062.aspx?Code=MKT06&ID=" + ID; //開啟[圖書採購卡維護],預設進入新增模式,並帶入品號作為預設條件 ScriptManager.RegisterStartupScript(this.upButton, typeof(UpdatePanel), "MKT062", "AddIFrameTab('圖書採購卡維護','" + strUrl + "')", true); } else ScriptManager.RegisterClientScriptBlock(this.upButton, typeof(UpdatePanel), "", "if (confirm('該品項尚未開立圖書採購卡,是否進入圖書採購卡新增畫面?')){this.disabled=true;__doPostBack('','GoInsert06');}", true); } #endregion }
protected void txtPERIOD_Changed(object sender, EventArgs e) { if (txtITEM.Text == "" || txtPERIOD.Text == "") { txtPERIOD_BARCODE.Text = ""; txtMANUFACTURE.Text = ""; txtPUBLISH_TYPE.Text = ""; txtPRICE.Text = ""; return; } #region 期別000000,請至圖書採購卡維護資料 ITM.MaintainSKU bcoITEM = new PIC.VDS2G.GFM.ITM.MaintainSKU(ConntionDB); ParameterList.Clear(); ITM.SQLHelper.SQLWhere(ref ParameterList, DbType.String, "MA.ITEM", txtITEM.Text, "=", "and"); DataTable dtItem = bcoITEM.QuerySKUByFind_1(ParameterList); if (dtItem.Rows.Count > 0) { DataRow drItem = dtItem.Rows[0]; if (drItem["ROOT_NO"].ToString() == "2" && IsPostBack) { ShowErrorMessage("該品號群分類為圖書,請至圖書採購卡維護資料"); txtITEM.Text = ""; txtPERIOD.Text = ""; hidITEM.Value = ""; hidPeriod.Value = ""; return; } else { //2010/09/24 added for more check #region MKT.MaintainPurchaseCard BCO_PC = new MKT.MaintainPurchaseCard(ConntionDB); ParameterList.Clear(); ParameterList.Add(txtITEM.Text); ParameterList.Add(txtPERIOD.Text); bool bResult = BCO_PC.CheckIsDuplicatedByItemPeriod(ParameterList); if (!bResult) { ScriptManager.RegisterStartupScript(this, this.GetType(), "JS", "alert('此品號/期別已開立過採購卡,請確認!');", true); } #endregion #region ITM.MaintainSKUPeriod bcoPeriod = new ITM.MaintainSKUPeriod(ConntionDB); ParameterList.Clear(); ITM.SQLHelper.SQLWhere(ref ParameterList, DbType.String, "MA.ITEM", txtITEM.Text, "=", "and"); ITM.SQLHelper.SQLWhere(ref ParameterList, DbType.String, "MA.PERIOD", txtPERIOD.Text, "=", "and"); DataTable dt = bcoPeriod.QuerySKUPeriodByFind_1(ParameterList); hidPeriod.Value = txtPERIOD.Text; if (dt.Rows.Count > 0) { DataRow dr = dt.Rows[0]; txtPERIOD_BARCODE.Text = dr["PERIOD_BARCODE"].ToString(); txtMANUFACTURE.Text = dr["VENDOR"].ToString(); txtPUBLISH_TYPE.Text = dr["PUBLISH_TYPE_NO"].ToString(); txtPRICE.Text = dr["PRICE"].ToString(); } else { txtPERIOD_BARCODE.Text = ""; txtMANUFACTURE.Text = ""; txtPUBLISH_TYPE.Text = ""; txtPRICE.Text = ""; } #endregion } } Focus(txtPLAN_ACCEPT_DATE.DateTextBox.ClientID); /* if (txtPERIOD.Text == "000000") { ShowErrorMessage("期別000000,請至圖書採購卡維護資料"); txtPERIOD.Text = ""; } */ #endregion }
protected void btnPrint_Click(object sender, EventArgs e) { if (VerifyFormData() == true) { try { DataSet ds = new DataSet(); //VDS_MKT_PURCHASE_MAIN MKT.MaintainPurchaseCard BCO = new MKT.MaintainPurchaseCard(ConntionDB); ParameterList.Clear(); ParameterList.Add(hidPurcard_no.Value); DataTable Dt_M = BCO.QueryMstForPrint(ParameterList); if (Dt_M.Rows.Count == 0) { ScriptManager.RegisterStartupScript(Page, this.GetType(), "MKT052.aspx", "alert(' 查無資料 ');", true); return; } //VDS_MKT_PURCHASE_CHAIN MKT.MaintainPurchaseCard BCO_Detail = new MKT.MaintainPurchaseCard(ConntionDB); ParameterList.Clear(); ParameterList.Add(hidPurcard_no.Value); DataTable Dt_D = BCO_Detail.QueryDetlForPrint(ParameterList); DataTable Dt_D_Check = Check_Row(Dt_D); //加入報表 Dt_M.TableName = "CRMKT05R01"; ds.Tables.Add(Dt_M.Copy()); Dt_D_Check.TableName = "CRMKT05R02"; ds.Tables.Add(Dt_D_Check.Copy()); ShowReport(ds); } catch (Exception ex) { ErrorMsgLabel.Text = ex.Message; UpdatePanel_ErrMsg.Update(); } } }
private void LoadData(int intID, string strItem, string strPeriod) { try { #region Bind gvGift MaintainGift bcoGift = new MaintainGift(ConntionDB); ParameterList.Clear(); ParameterList.Add(strItem); ParameterList.Add(strPeriod); ParameterList.Add(999); DataTable Dt_Gift = bcoGift.QueryGift(ParameterList); Session["MKT05_POP_Gift" + PageTimeStamp.Value] = Dt_Gift; if (Dt_Gift != null && Dt_Gift.Rows.Count != 0) { gvGift.PageSize = 20; gvGift.PageIndex = 0; gvGift.DataSource = Dt_Gift; gvGift.DataBind(); NoData_1.Visible = false; } else { NoData_1.Visible = true; } #endregion #region Bind gvGiftChan MaintainPurchaseCard bco = new MaintainPurchaseCard(ConntionDB); ParameterList.Clear(); ParameterList.Add(intID); ParameterList.Add(strItem); ParameterList.Add(strPeriod); DataTable Dt_GiftChan = bco.MTK05_POP_GiftChan(ParameterList); Session["MKT05_POP_GiftChan" + PageTimeStamp.Value] = Dt_GiftChan; if (Dt_GiftChan != null && Dt_GiftChan.Rows.Count != 0) { gvGiftChan.PageSize = 20; gvGiftChan.PageIndex = 0; gvGiftChan.DataSource = Dt_GiftChan; gvGiftChan.DataBind(); NoData_2.Visible = false; } else { NoData_2.Visible = true; } #endregion #region Bind 通路門市贈品 MaintainStoreGift BCO = new MaintainStoreGift(ConntionDB); ParameterList.Clear(); ParameterList.Add(strItem); ParameterList.Add(strPeriod); ParameterList.Add("99999999"); DataTable Dt_GiftStore = BCO.QueryStoreGift(ParameterList); Session["MKT05_POP_GiftStore" + PageTimeStamp.Value] = Dt_GiftStore; if (Dt_GiftStore != null && Dt_GiftStore.Rows.Count != 0) { GridView1.PageSize = 20; GridView1.PageIndex = 0; GridView1.DataSource = Dt_GiftStore; GridView1.DataBind(); NoData_3.Visible = false; } else { NoData_3.Visible = true; } #endregion } catch (Exception ex) { ErrorMsgLabel.Text = ex.Message; } }