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.DuiZhangDan
{
    public partial class YFDuiZhangDan
    {
        public YFDuiZhangDan()
        {

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

            DBHelp db = new DBHelp();
            db.Open();
            SqlCommand cmd = db.GetCommand("SELECT bzxx FROM da_qj_csb WHERE csfl = 'CWZQSZ' AND csbh = 'JSZQ'");
            string JSZQ = cmd.ExecuteScalar().ToString().Trim();
            db.Close();
            cmd.Dispose();
            string treeDataObject = "dw_cw_yfdz_month_tree";
            if ("WEEK".Equals(JSZQ))
            {
                treeDataObject = "dw_cw_yfdz_week_tree";
            }
            else if ("HALFMONTH".Equals(JSZQ))
            {
                treeDataObject = "dw_cw_yfdz_halfmonth_tree";
            }
            string CurYhbh = A8ERP.AppService.GetUserID();
            this.SetParm("CurYhbh", CurYhbh);
            tv_1.AddRootNode = true;
            tv_1.RootNodeData = "00";
            tv_1.RootNodeLabel = "²ÆÎñÕËÆÚ";

            tv_1.DataStore.DataWindowObject = treeDataObject;
            tv_1.DataField = "bh";
            tv_1.LabelField = "mc";
            tv_1.ParentField = "fbh";
            tv_1.LeaveField = "islast";

            tv_1.RootNodePictureIndex = 1;
            tv_1.PictureIndex = 1;
            tv_1.LeavePictureIndex = 2;
            tv_1.LeaveSelectedPictureIndex = 2;

            tv_1.LoadTreeNodesStyle = LoadTreeNodesStyle.Retrive;
            tv_1.DataStore.Retrieve("00", CurYhbh);

            dw_1.DataStore.DataWindowObject = "dw_cw_yfdzd_hz_list";
            dw_1.SetTransaction(this.AdoTransaction);
            //dw_1.Retrieve();

            dw_2.DataStore.DataWindowObject = "dw_cw_yfdzd_mx_list";
            dw_2.SetTransaction(this.AdoTransaction);
            //dw_2.Retrieve();

            tb_1.GetItem("btn_PriorRow").Enabled = false;
            tb_1.GetItem("btn_NextRow").Enabled = false;

            A8ERP.Common.DWServiceHelp.AddReportService(dw_1);
            A8ERP.Common.DWServiceHelp.AddReportService(dw_2);
        }
    }
}
