using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using System.Web;
using System.Data;
using System.Data.SqlClient;

using Sybase.DataWindow;
using TXSoft.Common;
using TXSoft.ExtPB;
using TXSoft.DataStore;


namespace A8ERP.CaiWu.JinHuoFuKuanDan
{
    public partial class W_JinHuoFuKuanDan
    {
        public W_JinHuoFuKuanDan()
        {

        }
        public override void OnLoad()
        {
            base.OnLoad();
            string yhbh = A8ERP.AppService.GetUserID();
            this.SetParm("curYhbh", yhbh);
            DataWindowChild dwc;
            dwc = dw_mx_top.GetChild("gysbh");
            dwc.SetTransaction(this.AdoTransaction);
            dwc.Retrieve("%", A8ERP.AppService.GetUserID());

            dwc = dw_mx_top.GetChild("bmbh");
            dwc.SetTransaction(this.AdoTransaction);
            dwc.Retrieve("%", A8ERP.AppService.GetUserID(), "cw");

            dwc = dw_hz.GetChild("fkfs");
            dwc.SetTransaction(this.AdoTransaction);
            dwc.Retrieve("skfs");       // 订单方式的下拉框。

            dwc = dw_mx_top.GetChild("fkfs");
            dwc.SetTransaction(this.AdoTransaction);
            dwc.Retrieve("skfs");       // 订单方式的下拉框。


            dwc = dw_mx_top.GetChild("ywy");
            dwc.SetTransaction(this.AdoTransaction);
            dwc.Retrieve("%", A8ERP.AppService.GetUserID(), "cw");

            dwc = dw_mx_top.GetChild("zdr");
            dwc.SetTransaction(this.AdoTransaction);
            dwc.Retrieve("%", A8ERP.AppService.GetUserID(), "cw");

            dwc = dw_mx_top.GetChild("fyzh");
            dwc.SetTransaction(this.AdoTransaction); 

            //dwc = dw_hz.GetChild("fyzh");
            //dwc.SetTransaction(this.AdoTransaction);
            //dwc.Retrieve("%"); 
            string FormatPzh = Request["FormatPzh"];
            string FormatValue = Request["FormatValue"];
            if (FormatPzh != null && FormatPzh != "")
            {
                this.SetParm("format_pzh", FormatPzh);
                AppService.GetYwFormat(dw_hz, FormatValue);
            }


            A8erp.Core.Common.AddReportService(dw_hz);
        //    A8erp.Core.Common.AddReportService(dw_mx);

            #region  处理权限
            dw_mkfhjb.Retrieve(this.FunctionID);  // 审核级别 
            #endregion

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

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

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

            #endregion

            //--------------------打印----------------------------
            this.SetParm("curFunctionId", this.FunctionID);
            dw_print.AllowCreate = true;
            dw_print.AllowRetrieve = true;
            dw_print.AllowSetFullState = true;
            dw_proxy.AllowCreate = true;
            dw_proxy.AllowRetrieve = true;
            dw_proxy.AllowSetFullState = true;
            dw_print.AllowUpdate = true;
            this.SetParm("curUserId", AppService.GetUserID().ToString());
            this.SetParm("curJqm", AppService.GetJqm());
            this.SetParm("dw_yw_cg_top_title_value", "进货付款单");
            this.SetParm("curUserGroupId", AppService.GetUser().GroupId);//权限组
            //--------------------打印结束-------------------------

            for (int i = 1; i <= dw_mkfhjb.RowCount; i++)
            {
                ddlb_1.Items.Add(dw_mkfhjb.GetItemString(i, "fhmc"));
            }
            ddlb_1.Items.Add("未记账");
            ddlb_1.Items.Add("已记账");
            ddlb_1.Items.Add("全部");
            ddlb_1.Text = "未记账";
            ddlb_2.Items.Add("全部单据");
            ddlb_2.Items.Add("新增单据");
            ddlb_2.Items.Add("转接单据");
            ddlb_2.Text = "全部单据";

            //来源于对账单
            //来源于对账单
            string curDzdPzh = "";
            if (Request["curDzdPzh"] != null)
            {
                curDzdPzh = Request["curDzdPzh"].ToString();
            }
            this.SetParm("curDzdPzh", curDzdPzh);
            //dw_hz.Retrieve(A8ERP.AppService.GetUserID(), "%");
            this.SetParm("FunctionID", this.FunctionID);
            if (this.Page != null)
            {
                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_CaiWuChaXun", "/CaiWu/ChaXun/W_CaiWuChaXun.win.js?JSV=" + AppService.GetJSVesion());
                this.Page.ClientScript.RegisterClientScriptInclude("W_JinHuoFuKuanDan", "/CaiWu/JinHuoFuKuanDan/W_JinHuoFuKuanDan.win.js?JSV=" + AppService.GetJSVesion());

            }
            this.IsRegisterScriptFile = false;
        }
    }
}
