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;
using A8erp.Cache;
using Newtonsoft.Json;


namespace A8ERP.CaiWu.CaiWuTongJiFenXi
{
    public partial class W_CW_KHDZD_Main
    {
        private string cdbh = "";
        private string bbfl = "";
        private string bbmc = "";
        private string yhbh = "";
        private string pzh = "";
        public W_CW_KHDZD_Main()
        {

        }
        public override void OnLoad()
        {
            base.OnLoad();
            string curYhbh = A8ERP.AppService.GetUserID();
            this.SetParm("curYhbh", curYhbh);
            this.SetParm("curCdbh", this.FunctionID);
   
            dw_temp.AllowCreate = true;
            dw_temp.AllowRetrieve = true;
            dw_format.AllowCreate = true;
            dw_format.AllowRetrieve = true;
            this.st_title.Text = "客户对账单";
            string curFromKHYE = string.Empty;
            if (Request["curFromKHYE"] != null)
            {
                curFromKHYE = Request["curFromKHYE"].ToString();
                this.SetParm("curFromKHYE", curFromKHYE);
            }
            this.SetParm("curJqm", AppService.GetJqm());   //管理系统机器码
            this.SetParm("curUserGroupId",AppService.GetUser().GroupId);
            //DataTable dt = null;
            //DBHelp db = new DBHelp();

            //dt = db.QueryRDataTable(" select qybz from da_qj_csb where csfl='cw_jqdbm' and csbh='jqdbm' ");
            //if (dt.Rows[0]["qybz"].ToString() == "1")
            //{
            //    dw_temp.DataWindowObject = "dw_cw_khbmdzd_list";
            //}
            //else {
            //    dw_temp.DataWindowObject = "dw_cw_khdzd_list";
            //}
            //this.SetParm("curJqdbm", dt.Rows[0]["qybz"].ToString());

            #region print
            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;
            #endregion

            if (this.Page != null)
            {

                this.Page.ClientScript.RegisterClientScriptInclude("W_CG_HZ_Base", "/CaiGou/CaiGouTongJiFenxi/W_CG_HZ_Base.win.js?JSV=" + AppService.GetJSVesion());
                this.Page.ClientScript.RegisterClientScriptInclude("W_YW_LIST", "/CaiWu/CaiWuTongJiFenXi/W_YW_LIST.win.js?JSV=" + AppService.GetJSVesion());
                this.Page.ClientScript.RegisterClientScriptInclude("W_CW_KHDZD_Main", "/CaiWu/CaiWuTongJiFenXi/W_CW_KHDZD_Main.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_CW_KHDZD_Main", "/CaiWu/CaiWuTongJiFenXi/W_CW_KHDZD_Main.win.js?JSV=" + AppService.GetJSVesion());
            }
            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);



            this.btn_Print.DataWindowAction = TXSoft.ExtPB.DataWindowAction.None;
  

            this.btn_Print.EventName = "this.Myprints";



            this.dw_da_qx_mokuai_print = new TXSoft.ExtPB.DataWindow();
            this.pl_print.Controls.Add(this.dw_da_qx_mokuai_print);
            this.dw_da_qx_mokuai_print.DataWindowObject = "dw_da_qx_mokuai_save_print";
            this.dw_da_qx_mokuai_print.Height = 106;
            this.dw_da_qx_mokuai_print.Name = "dw_da_qx_mokuai_print";
            this.dw_da_qx_mokuai_print.TabIndex = 24;
            this.dw_da_qx_mokuai_print.Title = "";
            this.dw_da_qx_mokuai_print.Visible = false;
            this.dw_da_qx_mokuai_print.Width = 189;
            this.dw_da_qx_mokuai_print.X = 359;
            

            this.IsRegisterScriptFile = false;

            
        }
        protected TXSoft.ExtPB.DataWindow dw_da_qx_mokuai_print;
      
    }
}
