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.XiaoHuoShouKuanDan
{
    public partial class W_XJSRPZ
    {
        public W_XJSRPZ()
        {

        }
        public override void OnLoad()
        {
            base.OnLoad();

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

            dwc = dw_mx_top.GetChild("skfs");
            dwc.SetTransaction(this.AdoTransaction);
            dwc.Modify("csbh.visible='0' csbh_t.visible='0'");
            dwc.Modify("bzxx.visible='0' bzxx_t.visible='0'");
            dwc.Retrieve();

            dwc = dw_hz.GetChild("skfs");
            dwc.SetTransaction(this.AdoTransaction);
            dwc.Retrieve();

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

            dwc = dw_mx.GetChild("km");
            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);
            this.SetParm("FunctionID", this.FunctionID);
            this.SetParm("curYhbh", A8ERP.AppService.GetUserID());

            #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

            #region  处理权限
            dw_mkfhjb.DataStore.DataWindowObject = "dw_da_qx_fhjb_by_cdbh";
            dw_mkfhjb.SetTransaction(this.AdoTransaction);
            dw_mkfhjb.Retrieve(this.FunctionID);

            #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 = "未记账";
            
            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_XJSRPZ", "/CaiWu/XiaoHuoShouKuanDan/W_XJSRPZ.win.js?JSV=" + AppService.GetJSVesion());

            }
            this.IsRegisterScriptFile = false;
        }
    }
}
