Beispiel #1
0
        private void loadData(string print_type, string file_str)
        {
            if (txtDep.Text.Trim() == "")
            {
                ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "alert", " alert('部門不能為空!');", true);
                return;
            }
            user_id = getUserName();
            //System.Web.UI.WebControls.PagedDataSource ps = new PagedDataSource();
            string    filename = file_str + ".xls";
            DataTable dt = new DataTable();
            string    dat1, dat2;

            dat1 = Convert.ToDateTime(dateStart.Value).ToString("yyyy/MM/dd");
            dat2 = Convert.ToDateTime(dateEnd.Value).AddDays(1).ToString("yyyy/MM/dd");
            SqlParameter[] parameters1 = { new SqlParameter("@print_type", print_type)
                                           ,                               new SqlParameter("@dep", txtDep.Text)
                                           ,                               new SqlParameter("@dat1", dat1)
                                           ,                               new SqlParameter("@dat2", dat2) };
            dt = sh.ExecuteProcedure("usp_mo_outsideprocess", parameters1);


            //ps.DataSource = dtTranRec.DefaultView;
            //this.rptDetail.DataSource = ps;
            //this.rptDetail.DataBind();


            string content = getExcelContent(dt);
            string css     = ".firstTR td{color:blue;width:100px;}.secondTR td{color:blue;width:100px;}";

            filename = System.Web.HttpUtility.UrlEncode(filename, System.Text.Encoding.UTF8);//.UTF8
            ExportToExcel(filename, content, css);
        }
Beispiel #2
0
        protected void BindData()
        {
            if (!validData())
            {
                return;
            }
            string dat1, dat2;

            string inv1 = txtInv1.Text;
            string inv2 = txtInv2.Text;

            int tr_type = dlShowDeliv.SelectedIndex;//過期類型報表

            dat1 = dateStart.Value;
            dat2 = dateEnd.Value;


            if (dat2 != "")
            {
                dat2 = Convert.ToDateTime(dat2).AddDays(1).ToString("yyyy/MM/dd");
            }

            if (dateStart.Value == "" && txtMo1.Text == "" && txtMo2.Text == "" &&
                txtCust.Text == "" && txtInv1.Text == "" && txtInv2.Text == "")
            {
                inv1 = "ZZZZZZZZZ";
                inv2 = "ZZZZZZZZZ";
            }

            System.Web.UI.WebControls.PagedDataSource ps = new PagedDataSource();
            string strSql = "usp_ShowInvStatus";

            SqlParameter[] parameters = { new SqlParameter("@tr_type", tr_type)
                                          ,                            new SqlParameter("@dat1", dat1), new SqlParameter("@dat2", dat2)
                                          ,                            new SqlParameter("@mo1",  txtMo1.Text)
                                          ,                            new SqlParameter("@mo2",  txtMo2.Text)
                                          ,                            new SqlParameter("@inv1", inv1)
                                          ,                            new SqlParameter("@inv2", inv2)
                                          ,                            new SqlParameter("@cust", txtCust.Text) };


            DataTable dtInv = sh.ExecuteProcedure(strSql, parameters);

            ps.DataSource            = dtInv.DefaultView;
            this.wpDetail.DataSource = ps;
            this.wpDetail.DataBind();

            if (dtInv.Rows.Count > 0)
            {
                lblShowInfo.Text = dlShowDeliv.SelectedValue + "  記錄數:" + dtInv.Rows.Count.ToString();
            }
            else
            {
                lblShowInfo.Text = "已開發票,未送貨記錄。";
            }
        }
Beispiel #3
0
        protected void BindData()
        {
            if (!validData())
            {
                return;
            }
            string dat1, dat2;
            string vatdat1, vatdat2;

            dat1    = dateStart.Value;
            dat2    = dateEnd.Value;
            vatdat1 = vatDateStart.Value;
            vatdat2 = vatDateEnd.Value;
            string Agent1   = txtAgent1.Text;
            string Agent2   = txtAgent2.Text;
            int    doc_type = 1;

            if (chkShowVat.Checked == true)
            {
                doc_type = 2;
            }
            if (dat2 != "")
            {
                dat2 = Convert.ToDateTime(dat2).AddDays(1).ToString("yyyy/MM/dd");
            }
            if (vatdat2 != "")
            {
                vatdat2 = Convert.ToDateTime(vatdat2).AddDays(1).ToString("yyyy/MM/dd");
            }
            System.Web.UI.WebControls.PagedDataSource ps = new PagedDataSource();
            string strSql = "usp_LoadInvByAgent";

            SqlParameter[] parameters = { new SqlParameter("@doc_type", doc_type)
                                          ,                             new SqlParameter("@brand1",  txtBrand1.Text), new SqlParameter("@brand2", txtBrand2.Text)
                                          ,                             new SqlParameter("@Agent1",  Agent1),         new SqlParameter("@Agent2", Agent2)
                                          ,                             new SqlParameter("@dat1",    dat1),           new SqlParameter("@dat2", dat2)
                                          ,                             new SqlParameter("@vatdat1", vatdat1),        new SqlParameter("@vatdat2", vatdat2) };


            DataTable dtStTr = sh.ExecuteProcedure(strSql, parameters);

            ps.DataSource            = dtStTr.DefaultView;
            this.wpDetail.DataSource = ps;
            this.wpDetail.DataBind();
        }
Beispiel #4
0
        protected void BindData()
        {
            if (!validData())
            {
                return;
            }
            string dat1, dat2;

            dat1 = txtDate1.Text;
            dat2 = txtDate2.Text;
            string dep = txtDep.Text;

            if (dat2 != "")
            {
                dat2 = Convert.ToDateTime(dat2).AddDays(1).ToString("yyyy/MM/dd");
            }

            if (txtDate2.Text == "" && txtDep.Text == "")
            {
                dep = "ZZZZZZZZZ";
            }


            string strSql = "mo_MoveStatus_Spec";

            SqlParameter[] parameters = { new SqlParameter("@dep", dep)
                                          ,                        new SqlParameter("@dat1",dat1), new SqlParameter("@dat2", dat2) };


            DataTable dtStTr = sh.ExecuteProcedure(strSql, parameters);

            gvDetails.DataSource = dtStTr.DefaultView;
            gvDetails.DataBind();
            if (dtStTr.Rows.Count > 0)
            {
                lblShowInfo.Text = "  記錄數:" + dtStTr.Rows.Count.ToString();
            }
            else
            {
                lblShowInfo.Text = "查看外發記錄之移交狀態。";
            }
        }
Beispiel #5
0
        protected void BindData()
        {
            user_id = getUserName();
            string strDat1 = dateStart.Value;
            string strDat2 = dateEnd.Value;

            if (!StrHlp.CheckDateFormat(strDat1))
            {
                strDat1 = "";
            }
            if (!StrHlp.CheckDateFormat(strDat2))
            {
                strDat2 = "";
            }
            string sales_group    = dlSales_group.SelectedValue.ToString();
            string brand          = txtBrand.Text;
            string mat            = txtMaterial.Text;
            string cust_code      = txtCust_code.Text;
            string cust_color     = txtCust_color.Text;
            string cf_code        = txtCf_code.Text;
            string cf_color       = txtCf_color.Text;
            string season         = txtSeason.Text;
            string temp_code      = txtTemp_code.Text;
            string size           = txtSize.Text;
            string sub_mo_id      = txtSubMo.Text;
            string product_desc   = txtGood_desc.Text;
            string plm_code       = "";
            string reason_edit    = "";
            string remark         = "";
            string other_remark   = "";
            string remark_for_pdd = "";

            SqlParameter[] paras = new SqlParameter[] {
                new SqlParameter("@user_id", user_id),
                new SqlParameter("@sales_group", sales_group),
                new SqlParameter("@brand", brand),
                new SqlParameter("@material", mat),
                new SqlParameter("@cust_code", cust_code),
                new SqlParameter("@cust_color", cust_color),
                new SqlParameter("@cf_code", cf_code),
                new SqlParameter("@cf_color", cf_color),
                new SqlParameter("@season", season),
                new SqlParameter("@temp_code", temp_code),
                new SqlParameter("@size", size),
                new SqlParameter("@dat1", strDat1),
                new SqlParameter("@dat2", strDat2),
                new SqlParameter("@mo_id", txtMo_id.Text),
                new SqlParameter("@sub_mo_id", sub_mo_id),
                new SqlParameter("@plm_code", plm_code),
                new SqlParameter("@reason_edit", reason_edit),
                new SqlParameter("@product_desc", product_desc),
                new SqlParameter("@remark", remark),
                new SqlParameter("@other_remark", other_remark),
                new SqlParameter("@remark_for_pdd", remark_for_pdd)
            };

            DataTable dtQuotation = sh.ExecuteProcedure("usp_qoutation_find", paras);

            if (dtQuotation.Rows.Count == 0)
            {
                dtQuotation.Rows.Add();
            }

            gvDetails.DataSource = dtQuotation.DefaultView;
            gvDetails.DataBind();
        }
Beispiel #6
0
        protected void LoadData()
        {
            if (!validData())
            {
                return;
            }
            string user_id = "admin";// getUserName();
            string mo1 = txtMo1.Text.Trim().ToUpper();
            string mo2 = txtMo2.Text.Trim().ToUpper();
            string date1, date2;
            string crdate1, crdate2;
            string cs_date1, cs_date2;
            string crby     = txtCrBy.Text;
            string mo_group = "";
            string brand1;
            string cust1;
            string agent1;
            string only_apart  = "";
            int    period_type = dlShowPeriod.SelectedIndex;//過期類型報表

            brand1   = txtBrand.Text;
            cust1    = txtCust.Text;
            date1    = orderDateStart.Value;
            date2    = orderDateEnd.Value;
            crdate1  = crDateStart.Value;
            crdate2  = crDateEnd.Value;
            cs_date1 = custReqDateStart.Value;
            cs_date2 = custReqDateEnd.Value;
            agent1   = txtAgent1.Text;
            if (chkShowA_part.Checked == true)
            {
                only_apart = "1";
            }
            if (dlMo_group.SelectedIndex > 0)
            {
                mo_group = dlMo_group.SelectedValue.ToString();
            }

            if (date2 != "")
            {
                date2 = Convert.ToDateTime(date2).AddDays(1).ToString("yyyy/MM/dd");
            }
            if (crdate2 != "")
            {
                crdate2 = Convert.ToDateTime(crdate2).AddDays(1).ToString("yyyy/MM/dd");
            }
            if (cs_date2 != "")
            {
                cs_date2 = Convert.ToDateTime(cs_date2).AddDays(1).ToString("yyyy/MM/dd");
            }
            string strSql = "usp_ShowOcList_prd";

            SqlParameter[] parameters = { new SqlParameter("@user_id", user_id)
                                          ,                            new SqlParameter("@period_type",period_type)
                                          ,                            new SqlParameter("@mo_group",   mo_group)
                                          ,                            new SqlParameter("@only_apart", only_apart)
                                          ,                            new SqlParameter("@crdat1",     crdate1),  new SqlParameter("@crdat2", crdate2)
                                          ,                            new SqlParameter("@dat1",       date1),    new SqlParameter("@dat2", date2)
                                          ,                            new SqlParameter("@cs_dat1",    cs_date1), new SqlParameter("@cs_dat2", cs_date2)
                                          ,                            new SqlParameter("@crby",       crby)
                                          ,                            new SqlParameter("@mo1",        mo1),      new SqlParameter("@mo2", mo2)
                                          ,                            new SqlParameter("@brand1",     brand1)
                                          ,                            new SqlParameter("@cust1",      cust1)
                                          ,                            new SqlParameter("@agent1",     agent1)
                                          ,                            new SqlParameter("@cust_goods", txtCust_Goods.Text)
                                          ,                            new SqlParameter("@cust_color", txtCust_Color.Text)
                                          ,                            new SqlParameter("@cust_style", txtCust_Style.Text)
                                          ,                            new SqlParameter("@season",     txtSeason.Text)
                                          ,                            new SqlParameter("@mat_code",   txtMat.Text)
                                          ,                            new SqlParameter("@prod_code",  txtProd.Text)
                                          ,                            new SqlParameter("@art_code",   txtArt.Text)
                                          ,                            new SqlParameter("@size_code",  txtSize.Text)
                                          ,                            new SqlParameter("@clr_code",   txtClr.Text)
                                          ,                            new SqlParameter("@pono",       txtPoNo.Text)
                                          ,                            new SqlParameter("@ocno",       txtOcNo.Text)
                                          ,                            new SqlParameter("@goods_id",   txtGoods_id.Text) };

            DataTable dtOc = sh.ExecuteProcedure(strSql, parameters);

            BindData();

            //if (dtOc.Rows.Count == 0)
            //    dtOc.Rows.Add();
            //gvDetails.DataSource = dtOc.DefaultView;
            //gvDetails.DataBind();
        }
Beispiel #7
0
        protected void loadData()
        {
            if (!validData())
            {
                return;
            }

            try
            {
                /*实例化分页数据源*/
                System.Web.UI.WebControls.PagedDataSource ps = new PagedDataSource();
                /*建立业务层对象,执行查询,将记录集绑定到分页数据源上*/
                //HourseBLL hourseBll = new HourseBLL();
                //ps.DataSource = hourseBll.QueryHourseInfo(this.leixing.SelectedValue, xiaoqu.Text, lowprice.Text, highprice.Text).Tables[0].DefaultView;


                string dat1, dat2;
                string fdep;
                int    type       = 1;//從外發加工單中提取
                int    no_set_oil = 0;
                dat1 = dateStart.Value;
                dat2 = Convert.ToDateTime(dateEnd.Value).AddDays(1).ToString("yyyy/MM/dd");
                fdep = txtDep.Text;
                if (chkAfter501.Checked == true)//電鍍部已申請大通,但噴油未申請的記錄
                {
                    no_set_oil = 1;
                }
                string         strSql     = "usp_MoAfterPlate_To510";
                SqlParameter[] parameters = { new SqlParameter("@type", type)
                                              ,                         new SqlParameter("@no_set_oil", no_set_oil)
                                              ,                         new SqlParameter("@fdep", fdep)
                                              ,                         new SqlParameter("@dat1", dat1)
                                              ,                         new SqlParameter("@dat2", dat2) };


                DataTable dtTranRec = sh.ExecuteProcedure(strSql, parameters);

                ps.DataSource       = dtTranRec.DefaultView;
                ps.AllowPaging      = true;
                ps.PageSize         = 1000000;     //每页显示几条记录
                ps.CurrentPageIndex = curPage - 1; //设置当前页的索引(当前页码减1就是)

                //this.firstBtn.Enabled = true;
                //this.nextBtn.Enabled = true;
                //this.prevBtn.Enabled = true;
                //this.lastBtn.Enabled = true;

                //this.CurrentPage.Text = curPage.ToString();
                //this.TotalPage.Text = totalPage.ToString();

                //if (curPage == 1)//当是第一页是.上一页和首页的按钮不可用
                //{
                //    this.prevBtn.Enabled = false;
                //    this.firstBtn.Enabled = false;

                //}
                //if (curPage == ps.PageCount)//当是最后一页时下一页和最后一页的按钮不可用
                //{
                //    this.nextBtn.Enabled = false;
                //    this.lastBtn.Enabled = false;
                //}
                this.rptDetail.DataSource = ps;
                //this.hourseDataList.DataKeyField = "hourseId";
                this.rptDetail.DataBind();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Beispiel #8
0
        protected void loadData()
        {
            if (!validData())
            {
                return;
            }

            try
            {
                /*实例化分页数据源*/
                System.Web.UI.WebControls.PagedDataSource ps = new PagedDataSource();
                /*建立业务层对象,执行查询,将记录集绑定到分页数据源上*/
                //HourseBLL hourseBll = new HourseBLL();
                //ps.DataSource = hourseBll.QueryHourseInfo(this.leixing.SelectedValue, xiaoqu.Text, lowprice.Text, highprice.Text).Tables[0].DefaultView;


                string dat1, dat2;
                string season;
                string mo_group = dlMo_group.Text;
                string brand1   = txtBrand1.Value;
                string brand2   = txtBrand2.Value;
                dat1   = dateStart.Value;
                dat2   = dateEnd.Value;
                season = dlSeason.Text;

                dat2 = Convert.ToDateTime(dat2).AddDays(1).ToString("yyyy/MM/dd");
                string         strSql     = "usp_mo_find_season";
                SqlParameter[] parameters = { new SqlParameter("@sea", season)
                                              ,                        new SqlParameter("@mo_group", mo_group)
                                              ,                        new SqlParameter("@dat1", dat1)
                                              ,                        new SqlParameter("@dat2", dat2)
                                              ,                        new SqlParameter("@brand1", brand1)
                                              ,                        new SqlParameter("@brand2", brand2) };


                DataTable dtTranRec = sh.ExecuteProcedure(strSql, parameters);

                ps.DataSource       = dtTranRec.DefaultView;
                ps.AllowPaging      = true;
                ps.PageSize         = 1000000;     //每页显示几条记录
                ps.CurrentPageIndex = curPage - 1; //设置当前页的索引(当前页码减1就是)

                //this.firstBtn.Enabled = true;
                //this.nextBtn.Enabled = true;
                //this.prevBtn.Enabled = true;
                //this.lastBtn.Enabled = true;

                //this.CurrentPage.Text = curPage.ToString();
                //this.TotalPage.Text = totalPage.ToString();

                //if (curPage == 1)//当是第一页是.上一页和首页的按钮不可用
                //{
                //    this.prevBtn.Enabled = false;
                //    this.firstBtn.Enabled = false;

                //}
                //if (curPage == ps.PageCount)//当是最后一页时下一页和最后一页的按钮不可用
                //{
                //    this.nextBtn.Enabled = false;
                //    this.lastBtn.Enabled = false;
                //}

                this.wpDetail.DataSource = ps;
                //this.hourseDataList.DataKeyField = "hourseId";
                this.wpDetail.DataBind();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Beispiel #9
0
        protected void loadData(int rpt_type)
        {
            if (!validData())
            {
                return;
            }

            try
            {
                /*实例化分页数据源*/
                System.Web.UI.WebControls.PagedDataSource ps = new PagedDataSource();
                /*建立业务层对象,执行查询,将记录集绑定到分页数据源上*/
                //HourseBLL hourseBll = new HourseBLL();
                //ps.DataSource = hourseBll.QueryHourseInfo(this.leixing.SelectedValue, xiaoqu.Text, lowprice.Text, highprice.Text).Tables[0].DefaultView;


                string dat1, dat2;
                string season;
                string mo_group = dlMo_group.Text;
                string brand1   = txtBrand1.Value;
                string brand2   = txtBrand2.Value;
                string userid   = getUserName();
                dat1   = dateStart.Value;
                dat2   = dateEnd.Value;
                season = dlSeason.Text;

                dat2 = Convert.ToDateTime(dat2).AddDays(1).ToString("yyyy/MM/dd");
                string         strSql     = "usp_mo_find_brand";
                SqlParameter[] parameters = { new SqlParameter("@usr", userid)
                                              ,                        new SqlParameter("@rpt_type", rpt_type)
                                              ,                        new SqlParameter("@sea", season)
                                              ,                        new SqlParameter("@mo_group", mo_group)
                                              ,                        new SqlParameter("@dat1", dat1)
                                              ,                        new SqlParameter("@dat2", dat2)
                                              ,                        new SqlParameter("@brand1", brand1)
                                              ,                        new SqlParameter("@brand2", brand2) };


                DataTable dtTranRec = sh.ExecuteProcedure(strSql, parameters);

                //if (rpt_type == 1)
                //{
                //    ps.DataSource = dtTranRec.DefaultView;
                //    ps.AllowPaging = true;
                //    ps.PageSize = 1000000;//每页显示几条记录
                //    ps.CurrentPageIndex = curPage - 1;//设置当前页的索引(当前页码减1就是)

                //    //this.firstBtn.Enabled = true;
                //    //this.nextBtn.Enabled = true;
                //    //this.prevBtn.Enabled = true;
                //    //this.lastBtn.Enabled = true;

                //    //this.CurrentPage.Text = curPage.ToString();
                //    //this.TotalPage.Text = totalPage.ToString();

                //    //if (curPage == 1)//当是第一页是.上一页和首页的按钮不可用
                //    //{
                //    //    this.prevBtn.Enabled = false;
                //    //    this.firstBtn.Enabled = false;

                //    //}
                //    //if (curPage == ps.PageCount)//当是最后一页时下一页和最后一页的按钮不可用
                //    //{
                //    //    this.nextBtn.Enabled = false;
                //    //    this.lastBtn.Enabled = false;
                //    //}

                //    this.wpDetail.DataSource = ps;
                //    //this.hourseDataList.DataKeyField = "hourseId";
                //    this.wpDetail.DataBind();
                //}
                expData(rpt_type, dtTranRec);
            }
            catch (Exception ex)
            {
                //Console.WriteLine(ex.Message.Replace("\r\n", "").Replace("'", ""));
                //顯示錯誤信息,原來畫面不會清除
                StrHlp.WebMessageBox(this.Page, ex.Message.Replace("\r\n", "").Replace("'", ""));
                //以下兩個都會顯示信息,但原來畫面會空白的閃一下
                //ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "alert", " alert('" + ex.Message.Replace("\r\n", "").Replace("'", "") + "');", true);
                //Response.Write("<script language='javascript'>alert(\"" + ex.Message.Replace("\r\n", "").Replace("'", "") + "\");</script>");
            }
        }
Beispiel #10
0
        protected void loadData()
        {
            if (!validData())
            {
                return;
            }

            try
            {
                /*实例化分页数据源*/
                System.Web.UI.WebControls.PagedDataSource ps = new PagedDataSource();
                /*建立业务层对象,执行查询,将记录集绑定到分页数据源上*/
                //HourseBLL hourseBll = new HourseBLL();
                //ps.DataSource = hourseBll.QueryHourseInfo(this.leixing.SelectedValue, xiaoqu.Text, lowprice.Text, highprice.Text).Tables[0].DefaultView;


                string dat1, dat2;
                string dep;
                int    is_qc = ddlCheckState.SelectedIndex;
                dat1 = DateStart.Value;
                dat2 = DateEnd.Value;
                dep  = txtDep.Text;
                dat2 = Convert.ToDateTime(dat2).AddDays(1).ToString("yyyy/MM/dd");
                string         strSql     = "dgcf_pad.dbo.usp_iqc";
                SqlParameter[] parameters = { new SqlParameter("@is_qc", is_qc)
                                              ,                          new SqlParameter("@dep", dep)
                                              ,                          new SqlParameter("@dat1", dat1)
                                              ,                          new SqlParameter("@dat2", dat2)
                                              ,                          new SqlParameter("@mo1", txtFindMo1.Text)
                                              ,                          new SqlParameter("@mo2", txtFindMo2.Text)
                                              ,                          new SqlParameter("@item1", "")
                                              ,                          new SqlParameter("@item2", "") };


                DataTable dtTranRec = sh.ExecuteProcedure(strSql, parameters);
                txtShowRec.Text     = dtTranRec.Rows.Count.ToString();
                ps.DataSource       = dtTranRec.DefaultView;
                ps.AllowPaging      = true;
                ps.PageSize         = 1000000;     //每页显示几条记录
                ps.CurrentPageIndex = curPage - 1; //设置当前页的索引(当前页码减1就是)

                //this.firstBtn.Enabled = true;
                //this.nextBtn.Enabled = true;
                //this.prevBtn.Enabled = true;
                //this.lastBtn.Enabled = true;

                //this.CurrentPage.Text = curPage.ToString();
                //this.TotalPage.Text = totalPage.ToString();

                //if (curPage == 1)//当是第一页是.上一页和首页的按钮不可用
                //{
                //    this.prevBtn.Enabled = false;
                //    this.firstBtn.Enabled = false;

                //}
                //if (curPage == ps.PageCount)//当是最后一页时下一页和最后一页的按钮不可用
                //{
                //    this.nextBtn.Enabled = false;
                //    this.lastBtn.Enabled = false;
                //}

                this.wpDetail.DataSource = ps;
                //this.hourseDataList.DataKeyField = "hourseId";
                this.wpDetail.DataBind();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Beispiel #11
0
        protected void LoadData()
        {
            if (!validData())
            {
                return;
            }
            string dat1, dat2;
            string crdat1, crdat2;
            string mo_group = "";
            string user_id = "admin";
            int    period_type = dlShowPeriod.SelectedIndex;//過期類型報表
            int    f_type, mo_group_select;


            crdat1 = createDateStart.Value;
            crdat2 = createDateEnd.Value;

            dat1 = orderDateStart.Value;
            dat2 = orderDateEnd.Value;


            if (dat2 != "")
            {
                dat2 = Convert.ToDateTime(dat2).AddDays(1).ToString("yyyy/MM/dd");
            }

            if (crdat2 != "")
            {
                crdat2 = Convert.ToDateTime(crdat2).AddDays(1).ToString("yyyy/MM/dd");
            }


            mo_group_select = dlMo_group.SelectedIndex;

            mo_group = "ALL";

            f_type = dlShowPeriod.SelectedIndex;//訂單發貨:全部,已發貨,未發貨

            if (mo_group_select == -1 || dlMo_group.SelectedItem.ToString() == "" || mo_group_select == 0)
            {
                mo_group = "ALL";
            }
            else
            {
                if (mo_group_select <= 27)
                {
                    mo_group = Convert.ToChar(64 + mo_group_select).ToString();
                }
                else
                if (mo_group_select == 28)    //PDD
                {
                    mo_group = "PDD";
                }
            }
            System.Web.UI.WebControls.PagedDataSource ps = new PagedDataSource();
            string strSql = "usp_OcDelivStatus1";

            SqlParameter[] parameters = { new SqlParameter("@f_type", f_type)
                                          ,                           new SqlParameter("@lang",     lang_id)
                                          ,                           new SqlParameter("@mo_group", mo_group)
                                          ,                           new SqlParameter("@usr",      user_id)
                                          ,                           new SqlParameter("@crdat1",   crdat1),new SqlParameter("@crdat2", crdat2)
                                          ,                           new SqlParameter("@brand1",   txtBrand.Text)
                                          ,                           new SqlParameter("@dat1",     dat1), new SqlParameter("@dat2", dat2)
                                          ,                           new SqlParameter("@cust1",    txtCust.Text)
                                          ,                           new SqlParameter("@po1",      txtPoNo.Text)
                                          ,                           new SqlParameter("@mo1",      txtMo1.Text)
                                          ,                           new SqlParameter("@mo2",      txtMo2.Text) };

            DataTable dtOc = sh.ExecuteProcedure(strSql, parameters);

            ps.DataSource            = dtOc.DefaultView;
            this.wpDetail.DataSource = ps;
            this.wpDetail.DataBind();
        }
Beispiel #12
0
        protected void FindByMoWip()
        {
            string mo_id = txtMo.Text.Trim().ToUpper();
            //string strSql = "SELECT a.mo_id, b.flag,b.goods_state,b.transfers_state,b.goods_id" +
            //    ",CONVERT(VARCHAR(20),b.f_complete_date,120) AS f_complete_date,CONVERT(VARCHAR(20),b.t_complete_date,111) AS t_complete_date" +
            //    ",b.prod_qty, b.c_qty_ok,b.wp_id,d.name AS wp_name, b.next_wp_id" +
            //    ",e.name AS next_wp_name,b.state, b.hold,c.name AS goods_name" +
            //    " FROM dbo.jo_bill_mostly a " +
            //    " INNER JOIN dbo.jo_bill_goods_details b " +
            //    " ON  a.within_code = b.within_code AND  a.id = b.id AND  a.ver = b.ver" +
            //    " LEFT JOIN dbo.it_goods c ON b.within_code=c.within_code AND b.goods_id=c.id" +
            //    " LEFT JOIN dbo.cd_department d ON b.within_code=d.within_code AND b.wp_id=d.id" +
            //    " LEFT JOIN dbo.cd_department e ON b.within_code=e.within_code AND b.next_wp_id=e.id" +
            //    " WHERE  a.within_code = '" + within_code + "' AND  a.mo_id = '" + mo_id + "'";
            string sqlstr  = "usp_ShowMoStatus";
            int    tb_type = 1;

            SqlParameter[] parameters = { new SqlParameter("@tb_type", tb_type), new SqlParameter("@mo_id", mo_id), new SqlParameter("@goods_id", "") };
            DataTable      tbWip      = sh.ExecuteProcedure(sqlstr, parameters);

            if (tbWip.Rows.Count > 0)
            {
                string state = "";
                int    prod_qty, c_qty_ok;
                for (int i = 0; i < tbWip.Rows.Count; i++)
                {
                    prod_qty = (tbWip.Rows[i]["prod_qty"].ToString() != "" ? Convert.ToInt32(tbWip.Rows[i]["prod_qty"]) : 0);
                    c_qty_ok = (tbWip.Rows[i]["c_qty_ok"].ToString() != "" ? Convert.ToInt32(tbWip.Rows[i]["c_qty_ok"]) : 0);
                    state    = tbWip.Rows[i]["mo_state"].ToString();
                    if (state == "G")
                    {
                        tbWip.Rows[i]["mo_state"] = "強制完成";
                    }
                    else
                    if (c_qty_ok >= prod_qty && prod_qty != 0)
                    {
                        tbWip.Rows[i]["mo_state"] = "完成";
                    }
                    else
                    if (prod_qty > c_qty_ok && prod_qty != 0)
                    {
                        tbWip.Rows[i]["mo_state"] = "未完成";
                    }
                    else
                    {
                        tbWip.Rows[i]["mo_state"] = "";
                    }
                    tbWip.Rows[i]["prod_qty"] = prod_qty.ToString();
                    tbWip.Rows[i]["c_qty_ok"] = c_qty_ok.ToString();
                }
                txtBill_date.Text     = tbWip.Rows[0]["bill_date"].ToString();
                txtRec_hk_date.Text   = tbWip.Rows[0]["rec_hk_date"].ToString();
                txtCust_req_date.Text = tbWip.Rows[0]["cust_req_date"].ToString();
            }
            else
            {
                tbWip.Rows.Add();
                txtBill_date.Text     = "";
                txtRec_hk_date.Text   = "";
                txtCust_req_date.Text = "";
            }
            gvDetails.DataSource = tbWip.DefaultView;
            gvDetails.DataBind();
            for (int i = 0; i < gvDetails.Rows.Count; i++)
            {
                if (gvDetails.Rows[i].Cells[2].Text == "Y")
                {
                    gvDetails.Rows[i].BackColor = System.Drawing.Color.FromArgb(0xFF, 0x33, 0x00);
                }
            }
            if (gvDetails.Rows.Count > 1)
            {
                ShowImage(gvDetails.Rows[0].Cells[7].Text);
            }
        }
Beispiel #13
0
        protected void loadData()
        {
            if (validData() == false)
            {
                return;
            }

            int show_details = 0;           //顯示明細表記錄  1--匯總表記錄

            if (chkShowSum.Checked == true) //顯示匯總表記錄
            {
                show_details = 1;
            }
            int    show_price = 0;
            string date1      = "";
            string date2      = "";
            string vend_id    = "";

            if (dlVend_id.SelectedIndex != 0)
            {
                vend_id = dlVend_id.Text.Trim();
            }
            string doc_id1  = txtDoc_id1.Text.Trim();
            string doc_id2  = txtDoc_id2.Text.Trim();
            string mo1      = txtMo1.Text.Trim();
            string mo2      = txtMo2.Text.Trim();
            string dep      = txtDep.Text.Trim();
            string prd_item = "";

            date1 = txtDoc_date1.Text;
            date2 = txtDoc_date2.Text;

            //if (dlDeliverFlag.SelectedIndex == 2)//從已發貨中提取
            //    select_tb = 2;
            //if (chkOut_type2.Checked == true)
            show_price = dlSetPrice.SelectedIndex;
            //if (vend_id == "")
            //{
            //    Response.Write("<script>alert('供應商不能為空!');<" + "/" + "script>");
            //    txtVend_id.Focus();
            //    return;
            //}
            if (date2 != "")
            {
                date2 = Convert.ToDateTime(date2).AddDays(1).ToString("yyyy/MM/dd");
            }
            string sqlstr = "pu_DeliverSetPrice_find";

            SqlParameter[] parameters = { new SqlParameter("@show_details", show_details),               new SqlParameter("@show_price", show_price)
                                          ,                                 new SqlParameter("@dep",     dep),                           new SqlParameter("@vend_id", vend_id), new SqlParameter("@prd_item", prd_item)
                                          ,                                 new SqlParameter("@doc_id1", doc_id1),                       new SqlParameter("@doc_id2", doc_id2)
                                          ,                                 new SqlParameter("@date1",   date1),                         new SqlParameter("@date2",   date2) };
            DataTable      tbPu = sh.ExecuteProcedure(sqlstr, parameters);

            if (show_details == 0)//顯示明細表記錄
            {
                gvDetails.DataSource = tbPu.DefaultView;
                gvDetails.DataBind();
                lblTotalRec.Text = "    記錄數:  " + tbPu.Rows.Count.ToString();
            }
            else
            {
                lblTotalRec.Text = "匯總表";
                gvSum.DataSource = tbPu.DefaultView;
                gvSum.DataBind();
            }
        }