using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using System.Web;
using System.Data;
using System.Data.SqlClient;
using A8ERP.Common;
using Sybase.DataWindow;
using TXSoft.Common;
using TXSoft.ExtPB;
using TXSoft.DataStore;
using A8erp.Cache;


namespace A8ERP.CaiGou.CaiGouDingDanTongJiFenXi
{
    public partial class W_JQCM_CGDD
    {
        private string cdbh = "";
        private string bbfl = "";
        private string bbmc = "";
        private string yhbh = "";
        private string pzh = "";
        public W_JQCM_CGDD()
        {

        }
        public override void OnLoad()
        {
            base.OnLoad();
            DBHelp dbhelp = new DBHelp();
            dbhelp.Open();
            if (this.Page != null)
            {
                this.Page.ClientScript.RegisterClientScriptInclude("W_Edit", "/DangAn/Base/OpenWindowDoubleRowsChooseBase.win.js?JSV=" + AppService.GetJSVesion());
                this.Page.ClientScript.RegisterClientScriptInclude("OpenWindowQueryBase", "/DangAn/Base/OpenWindowQueryBase.win.js?JSV=" + AppService.GetJSVesion());
                this.Page.ClientScript.RegisterClientScriptInclude("OpenWindowSimpleChoseBase", "/DangAn/Base/OpenWindowSimpleChoseBase.win.js?JSV=" + AppService.GetJSVesion());
                this.Page.ClientScript.RegisterClientScriptInclude("W_Base_Report_Open_Mx_Ex", "/Base/W_Base_Report_Open_Mx_Ex.win.js?JSV=" + AppService.GetJSVesion());
                this.Page.ClientScript.RegisterClientScriptInclude("W_Base_SaveOP", "/KuCun/TongJiFenXi/Base/W_Base_SaveOP.win.js?JSV=" + AppService.GetJSVesion());
                this.Page.ClientScript.RegisterClientScriptInclude("W_Base_BB_List", "/KuCun/TongJiFenXi/Base/W_Base_BB_List.win.js?JSV=" + AppService.GetJSVesion());
                this.Page.ClientScript.RegisterClientScriptInclude("W_KC_PIC", "/KuCun/TongJiFenXi/W_KC_PIC.win.js?JSV=" + AppService.GetJSVesion());
                this.Page.ClientScript.RegisterClientScriptInclude("W_NFCheck", "/KuCun/TongJiFenXi/W_NFCheck.win.js?JSV=" + AppService.GetJSVesion());
                this.Page.ClientScript.RegisterClientScriptInclude("W_JQCM_CGDD", "/CaiGou/CaiGouDingDanTongJiFenXi/W_JQCM_CGDD.win.js?JSV=" + AppService.GetJSVesion());  

            }
            
            rb_hx.Checked = true;
            string curcm = A8ERP.Common.DWServiceHelp.GetCMByString1();
            dw_list.StringData1 = curcm;
            User user = new User();
            user = (User)Session["User"];
            string curYhbh = user.Yhbh;
            this.SetParm("curYhbh", curYhbh);
            this.SetParm("curYhmc", AppService.GetUserName());
            string str_jgqx = A8ERP.DBHelp.GetJGTXByBMAndYH(this.FunctionID, curYhbh);
            this.SetParm("curjgqx", str_jgqx);
            string ywflag = "";
            cbx_rkfs.Visible = false;
            if (this.FunctionID.Equals("SJ103"))
            {
                ywflag = "CG";
                base.st_title.Text = "采购订单明细统计";
                st_10.Text = "订单方式";
             
            }
            else if (this.FunctionID.Equals("SJ320"))
            {
                ywflag = "CR";
                base.st_title.Text = "采购入库单明细统计";
                st_10.Text = "采购方式";
                cbx_rkfs.Visible = true;
              
            }
            else if (this.FunctionID.Equals("SJ333"))
            {
                ywflag = "CS";
                base.st_title.Text = "采购退货申请单明细统计";
                st_10.Text = "订单方式";
              
            }
            else if (this.FunctionID.Equals("SJ337"))
            {
                ywflag = "CT";
                base.st_title.Text = "采购退货单明细统计";
                st_10.Text = "采购方式";
                cbx_rkfs.Visible = true;
              
            }

            else if (this.FunctionID.Equals("SJ120"))
            {
                ywflag = "CZ";
                base.st_title.Text = "采购通知单明细统计";
                st_10.Text = "采购方式";
                cbx_fs.Text = "方式";
            }
            else if (this.FunctionID.Equals("SJ332"))
            {
                ywflag = "CD";
                base.st_title.Text = "采购退货通知单明细统计";
                st_10.Text = "采购方式";
                cbx_fs.Text = "采购方式";
            }
            this.SetParm("ywflag", ywflag);
            this.SetParm("curCdbh", this.FunctionID);
            dw_temp.AllowCreate = true;
            dw_temp.AllowRetrieve = true;
            dw_format.AllowCreate = true;
            dw_format.AllowRetrieve = true;

            string curJgtx = A8ERP.DBHelp.GetJGTXByBMAndYH(this.FunctionID, curYhbh);
            this.SetParm("jgtxlist", curJgtx);

            DataRow[] dt = CacheHelp.GetDataTable("REPORT_FORMAT").Select("cdbh ='" + this.FunctionID + "'  AND qdid ='" + curYhbh + "'");
            if (dt != null)
            {
                if (dt.Length > 0)
                {
                    pzh = dt[0][0].ToString();
                    bbmc = dt[0][1].ToString();
                    bbfl = dt[0][2].ToString();

                }
            }

            this.SetParm("pzh", pzh);
            this.SetParm("bbmc", bbmc);
            this.SetParm("bbfl", bbfl);

            #region 每页显示条数&查询天数
            string curDayAndPageSize = DBHelp.GetDayAndPageSize(this.FunctionID, "CG");

            string curPageSize = curDayAndPageSize.Split('#')[1];
            dw_list.PageSize = Convert.ToInt32(curPageSize);

            // 查询天数
            string seldays = curDayAndPageSize.Split('#')[0];
            this.SetParm("seldays", seldays.ToString());

            #endregion
            this.IsRegisterScriptFile = false;
            ddlb_sex.Width = 80;
        }
    }
}
