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.FaPiaoGuanLi
{
    public partial class W_YuKaiPiaoTongJi
    {
        public W_YuKaiPiaoTongJi()
        {

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

            ddlb_kplx.Items.Add("全部");
            ddlb_pjzl.Items.Add("全部");
            ddlb_wczt.Items.Add("全部");

            //DataTable dt = null;
            //DBHelp db = new DBHelp();

            //dt = db.QueryRDataTable(" select csbh,csmc from da_qj_csb where csfl='cw_pjlx' ");
            //int count = dt.Rows.Count;
            //if (count > 0)
            //{
            //    for (int i = 0; i < count; i++)
            //    {
            //        ddlb_kplx.Items.Add("[" + dt.Rows[i]["csbh"].ToString() + "]" + dt.Rows[i]["csmc"].ToString());
            //    }
            //}

            //dt = db.QueryRDataTable(" select csbh,csmc from da_qj_csb where csfl='cw_pjzl' ");
            //int count1 = dt.Rows.Count;
            //if (count1 > 0)
            //{
            //    for (int i = 0; i < count1; i++)
            //    {
            //        ddlb_pjzl.Items.Add("[" + dt.Rows[i]["csbh"].ToString() + "]" + dt.Rows[i]["csmc"].ToString());
            //    }
            //}

            //dt = db.QueryRDataTable(" select fhjb,fhmc from da_qx_mokuai_fuhejibie where cdbh='" + this.FunctionID + "'");
            //int count2 = dt.Rows.Count;
            //if (count2 > 0)
            //{
            //    for (int i = 0; i < count2; i++)
            //    {
            //        ddlb_wczt.Items.Add(dt.Rows[i]["fhmc"].ToString());
            //    }
            //}

            //db.Close();
            //dt.Dispose();


            string curKplx = AppService.GetXiTongCanShu("xsfp", "cw_pjlx", "csmc");
            ddlb_kplx.Items.Add(curKplx);


            string curPjzl1 = AppService.GetXiTongCanShu("ptfp", "cw_pjzl", "csmc");
            string curPjzl2 = AppService.GetXiTongCanShu("zzsfp", "cw_pjzl", "csmc");

            ddlb_pjzl.Items.Add(curPjzl1);
            ddlb_pjzl.Items.Add(curPjzl2);


            ddlb_wczt.Items.Add("未审核");
            ddlb_wczt.Items.Add("审核");



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

            string yhbh = A8ERP.AppService.GetUserID();
            this.SetParm("curYhbh", yhbh);

            A8ERP.Common.DWServiceHelp.AddReportService(dw_1);

            dw_2.DataStore.DataWindowObject = "da_fp_ykpxz_top";
            dw_2.SetTransaction(this.AdoTransaction);
            //dw_3.DataStore.DataWindowObject = "da_fp_hz_mx";
            //dw_3.SetTransaction(this.AdoTransaction);

            //数据窗口关联服务
            LinkageService service = (LinkageService)dw_2.Services.Add(ServiceName.Linkage);
            service.SetMaster(dw_1.DataStore);
            service.Add("fplsh", "fplsh");
            service.LinkageStyle = LinkageStyle.Retrieve;


            DataWindowChild dwc = dw_2.GetChild("kplx");
            dwc.SetTransaction(this.AdoTransaction);
            dwc.Retrieve("cw_pjlx");
            dwc = dw_2.GetChild("pjzl");
            dwc.SetTransaction(this.AdoTransaction);
            dwc.Retrieve("cw_pjzl");
            dwc = dw_2.GetChild("kpr");
            dwc.SetTransaction(this.AdoTransaction);
            dwc.Retrieve("%");
            dwc = dw_2.GetChild("jbr");
            dwc.SetTransaction(this.AdoTransaction);
            dwc.Retrieve("%");
            dwc = dw_2.GetChild("bmbh");
            dwc.SetTransaction(this.AdoTransaction);
            dwc.Retrieve("%", yhbh, "all");
            dwc = dw_2.GetChild("wldw");
            dwc.SetTransaction(this.AdoTransaction);
            dwc.Retrieve("00", "%", yhbh);
            //dwc = dw_3.GetChild("djlx");
            //dwc.SetTransaction(this.AdoTransaction);
            //dwc.Retrieve("fp_djlb");
           
            if (this.Page != null)
            {
                this.Page.ClientScript.RegisterClientScriptInclude("OpenWindowQueryBase", "/DangAn/Base/OpenWindowQueryBase.win.js?JSV=" + AppService.GetJSVesion());
                this.Page.ClientScript.RegisterClientScriptInclude("W_YuKaiPiaoTongJi", "/CaiWu/FaPiaoGuanLi/W_YuKaiPiaoTongJi.win.js?JSV=" + AppService.GetJSVesion());
            }

            this.IsRegisterScriptFile = false;
        }
    }
}
