示例#1
0
        void MtdLoadTbl6Tbl7()
        {
            MtdCreateController();
            if (txtPageSize.Text != "")
            {
                pageSize = int.Parse(txtPageSize.Text);
            }
            int pageIndex = pageSize == -1 ? 0 : int.Parse(lblCurrentPage.Text) * pageSize;

            bool bAll   = comboBox2.SelectedIndex == comboBox2.Items.Count - 1;
            int  idTbl1 = Convert.ToInt32(ddlTbl1.SelectedValue);
            int  idTbl2 = Convert.ToInt32(ddlTbl2.SelectedValue);
            int  idTbl3 = Convert.ToInt32(comboBox1.SelectedValue);

            if (comboBox3.SelectedIndex == 0)
            {
                dataGridView1.DataSource = oCtrLer.Tbl6_Gets_DesCreateDate(pageIndex, pageSize, idTbl1, idTbl2, idTbl3, bAll, dateTimePicker1.Value, dateTimePicker2.Value);
                if (idTbl3 == -1)
                {
                    sDateName = "Ngày Giao/Nhập";
                }
                else if (idTbl3 == 0)
                {
                    sDateName = "Ngày Nhập";
                }
                else
                {
                    sDateName = "Ngày Giao";
                }

                dataGridView1.Columns["Col6"].HeaderText = "Tiền Mua Vào";
                dataGridView1.Columns["Col6"].Visible    = false;
                dataGridView1.Columns["Col7"].HeaderText = sDateName;

                lblTotal.Text      = VNTCode.Controller.MtdIntToString(oCtrLer.Tbl6_Gets_DesCreateDate_Count(idTbl1, idTbl2, idTbl3, bAll, dateTimePicker1.Value, dateTimePicker2.Value));
                lblTotalICol1.Text = VNTCode.Controller.MtdIntToString(oCtrLer.Tbl6_Gets_DesCreateDate_ICol1(idTbl1, idTbl2, idTbl3, bAll, dateTimePicker1.Value, dateTimePicker2.Value)) + " (ly)";
                lblTotalSell.Text  = "0 (đ)";
                //lblTotalSell.Text = VNTCode.Controller.MtdDecimalToString(oCtrLer.Tbl6_Gets_DesCreateDate_ICol1_Sell(idTbl1, idTbl2, idTbl3, bAll, dateTimePicker1.Value, dateTimePicker2.Value)) + " (đ)";
            }
            else
            {
                dataGridView1.DataSource = oCtrLer.Tbl7_Gets_DesCreateDate(pageIndex, pageSize, idTbl1, idTbl2, idTbl3, bAll, dateTimePicker1.Value, dateTimePicker2.Value);
                dataGridView1.Columns["Col6"].HeaderText = "Tiền Bán Ra";
                dataGridView1.Columns["Col6"].Visible    = true;
                sDateName = "Ngày Bán";
                dataGridView1.Columns["Col7"].HeaderText = sDateName;

                lblTotal.Text      = VNTCode.Controller.MtdIntToString(oCtrLer.Tbl7_Gets_DesCreateDate_Count(idTbl1, idTbl2, idTbl3, bAll, dateTimePicker1.Value, dateTimePicker2.Value));
                lblTotalICol1.Text = VNTCode.Controller.MtdIntToString(oCtrLer.Tbl7_Gets_DesCreateDate_ICol1(idTbl1, idTbl2, idTbl3, bAll, dateTimePicker1.Value, dateTimePicker2.Value)) + " (ly)";
                lblTotalSell.Text  = VNTCode.Controller.MtdDecimalToString(oCtrLer.Tbl7_Gets_DesCreateDate_Sell(idTbl1, idTbl2, idTbl3, bAll, dateTimePicker1.Value, dateTimePicker2.Value)) + " (đ)";
            }
            if (pageSize != -1)
            {
                MtdGetPageCount();
            }
        }