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;


namespace A8ERP.CaiGou.CaiGouDingDanTongJiFenXi
{
    public partial class W_JQYS_CGDD
    {
        private string cdbh = "";
        private string bbfl = "";
        private string bbmc = "";
        private string yhbh = "";
        private string pzh = "";
        public W_JQYS_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());  
            }

            //User user = new User();
            //user = (User)Session["User"];
            string curYhbh = AppService.GetUserID();
            this.SetParm("curYhbh", curYhbh);
            this.SetParm("curYhmc", AppService.GetUserName());
            string ywflag = "";
            string str_jgqx = A8ERP.DBHelp.GetJGTXByBMAndYH(this.FunctionID, curYhbh);
            this.SetParm("curjgqx", str_jgqx);
            if (this.FunctionID.Equals("SJ102"))
            {
                ywflag = "CG";
                base.st_title.Text = "采购订单【精确到颜色】";
                st_10.Text = "订单方式";
              
            }
            else if (this.FunctionID.Equals("SJ319"))
            {
                ywflag = "CR";
                base.st_title.Text = "采购入库单【精确到颜色】";
                st_10.Text = "采购方式";
              
            }
            else if (this.FunctionID.Equals("SJ331"))
            {
                ywflag = "CS";
                base.st_title.Text = "采购退货申请单【精确到颜色】";
                st_10.Text = "订单方式";
               
            }
            else if (this.FunctionID.Equals("SJ336"))
            {
                ywflag = "CT";
                base.st_title.Text = "采购退货单【精确到颜色】";
                st_10.Text = "采购方式";
            }

            else if (this.FunctionID.Equals("SJ119"))
            {
                ywflag = "CZ";
                base.st_title.Text = "采购通知单【精确到颜色】";
                st_10.Text = "采购方式";
                cbx_fs.Text = "采购方式";
            }
            else if (this.FunctionID.Equals("SJ622"))
            {
                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);
            DBHelp db = new DBHelp();
            DataTable dt = db.QueryRDataTable("SELECT TOP 1 pzh,bbmc,bbfl FROM da_xt_report_format_hz WHERE cdbh ='" + this.FunctionID + "'  AND qdid ='" + curYhbh + "' AND bzxx='1'");
            if (dt.Rows.Count > 0)
            {
                pzh = dt.Rows[0][0].ToString();
                bbmc = dt.Rows[0][1].ToString();
                bbfl = dt.Rows[0][2].ToString();
            }
            this.SetParm("pzh", pzh);
            this.SetParm("bbmc", bbmc);
            this.SetParm("bbfl", bbfl);
            db.Close();
            this.IsRegisterScriptFile = false;
        }
    }
}
