protected void Page_Load(object sender, EventArgs e)
        {
            //DateTime time=new DateTime(2013,12,10);

            //DateTime d=Libs.VSDateTime.getPreBusinessDay(time, 3); 
            StockTaiSanReport ts = new StockTaiSanReport("094K002555","N");
            this.lbName.Text=ts.TenTaiKhoan;
            ts.dailyReport(new DateTime(2013, 8,31), new DateTime(2013, 9, 30));
            GridView1.DataSource = ts.TaiSan;
            GridView1.DataBind();
            GridView2.DataSource = ts.No;
            GridView2.DataBind();
            GridView3.DataSource = ts.TaiSanKhac;
            GridView3.DataBind();
            this.lbTSRongTN.Text = ts.taiSanRongTN().ToString();
            this.lbTSRongDN.Text = ts.taiSanRongDN().ToString();
            GridView4.DataSource = ts.getDataForAYear(new DateTime(2013,11,6)) ;
            GridView4.DataBind();

        }
Exemplo n.º 2
0
 public DataTable getDataForAYear(DateTime todate)
 {
     DataTable yearly = new DataTable();
     yearly.Columns.Add("ten");
     yearly.Columns.Add("taisan");
     yearly.Columns.Add("no");
     yearly.Columns.Add("taisanrong");
     StockTaiSanReport taisan = new StockTaiSanReport(this.MaTk,this.Type);
     for (int i = 11; i >= 0; i--)
     {
         DateTime time = new DateTime(todate.Year, todate.Month, 1).AddMonths(-i).AddDays(-1);
         taisan.dailyReport(time, time);
         yearly.Rows.Add(new object[] { "Tháng "+ time.Month.ToString("00") + "-" + time.Year, taisan.tongTaiSanTN(), taisan.tongNoTN(), taisan.tongTaiSanTN() - taisan.tongNoTN() });
     }
         return yearly;
 }
Exemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["username"] == null)
            {
                Response.Redirect("login.aspx");
            }

            this.ctr_taisan_result.Visible = false;
            
            
            if (Request["acccode"]!=null)
            {
                this.maTk = Request["acccode"];
                //DateTime time=new DateTime(2013,12,10);
                
                if (Request["txtDateTn"] != null)
                {
                    try
                    {
                        string datetn=Request["txtDateTn"];
                        dateTn = DateTime.ParseExact(datetn, "dd/MM/yyyy", CultureInfo.CurrentCulture);
                    }
                    catch (Exception ex)
                    {
                        
                        //this.ctr_taisan_result.builreport = false;
                        this.txtMessageError.Text = "Ngày nhập vào không hợp lệ";
                        return;
                    }
                }
                if (Request["txtDateDn"] != null)
                {
                    try
                    {
                        string datedn = Request["txtDateDn"];
                        dateDn = DateTime.ParseExact(datedn, "dd/MM/yyyy", CultureInfo.CurrentCulture);
                    }
                    catch (Exception ex)
                    {
                        //this.ctr_taisan_result.builreport = false;
                        this.txtMessageError.Text = "Ngày nhập vào không hợp lệ";
                        return;
                    }
                }
                if (this.dateTn > this.dateDn)
                {
                    this.txtMessageError.Text = "Ngày cuối kỳ phải lớn hơn ngày đầu kỳ";
                    return;
                }
                
                string query = "SELECT * FROM [dbo].[TradingAccount]  WHERE [CustomerId] = '" + Session["username"].ToString().Replace("'", "\\'") + "' and AccountId = '" + Request["acccode"] + "'";
                DataTable tbl = VSDBConnection.getDataTable(query, VSDBConnection.CSVSFServices);
                if (tbl.Rows.Count == 0)
                {
                    this.txtMessageError.Text = "Tài khoản không hợp lệ!";
                    return;
                }
                  
                //DateTime d=Libs.VSDateTime.getPreBusinessDay(time, 3); 
                string type="N";
                if(Request["type"]=="Y") type="Y";
                StockTaiSanReport ts = new StockTaiSanReport(Request["acccode"], type);
                
                //this.ctr_taisan_result.MaTK = "";
                
                this.ctr_taisan_result.TenTk=ts.TenTaiKhoan;
                if (!ts.exisAcc)
                {
                    this.txtMessageError.Text = "Không tìm thấy tài khoản";
                    return;
                }
                this.ctr_taisan_result.report = ts;
                //if (this.ctr_taisan_result.builreport)
                //{
                    this.ctr_taisan_result.DateTn = dateTn;
                    this.ctr_taisan_result.DateDn = dateDn;
                    this.ctr_taisan_result.loadContent();
                //}
                //ts.dailyReport(new DateTime(2013, 8, 31), new DateTime(2013, 9, 30));
                
                //GridView1.DataSource = ts.TaiSan;
                //GridView1.DataBind();
                //GridView2.DataSource = ts.No;
                //GridView2.DataBind();
                //GridView3.DataSource = ts.TaiSanKhac;
                //GridView3.DataBind();
                //this.lbTSRongTN.Text = ts.taiSanRongTN().ToString();
                //this.lbTSRongDN.Text = ts.taiSanRongDN().ToString();
                //GridView4.DataSource = ts.getDataForAYear(new DateTime(2013, 11, 6));
                //GridView4.DataBind();
                   
                this.ctr_taisan_result.Visible = true;
            }
        }