예제 #1
0
        private void button6_Click(object sender, EventArgs e)
        {
            filter_bill f = new filter_bill();

            f.ShowDialog();

            if (Data_bill.date_from != false || Data_bill.ser_num != false || Data_bill.ser_aggr != false || Data_bill.crp != false || Data_bill.inn != false || Data_bill.pinfl != false || Data_bill.code_nds != false || Data_bill.name != false || Data_bill.serv != false || Data_bill.status != false || Data_bill.fio != false)
            {
                string request = "";
                string name_cl = "";

                OracleCommand cmd = con.CreateCommand();
                if (Data_bill.date_from == true)
                {
                    request = $" AND date_of_bill  >= '{Data_bill.s_date_from}'  AND date_of_bill <= '{Data_bill.s_date_to}' ";
                }
                if (Data_bill.ser_num == true)
                {
                    request = request + $" AND num_aggr = {Data_bill.s_ser_num} ";
                }
                if (Data_bill.ser_aggr == true)
                {
                    request = request + $" AND sres_aggr = '{Data_bill.s_ser_aggr}' ";
                }
                if (Data_bill.crp == true)
                {
                    request = request + $" AND CRP_CD = {Data_bill.s_crp} ";
                }
                if (Data_bill.name == true)
                {
                    for (int i = 0; i < Data_bill.s_name.Length; i++)
                    {
                        if (Data_bill.s_name[i] == '%')
                        {
                            name_cl += '_';
                        }
                        else
                        {
                            name_cl += Data_bill.s_name[i];
                        }
                    }
                    request = request + $" AND CRP_NM LIKE '%{name_cl}%' ";
                }
                if (Data_bill.inn == true)
                {
                    request = request + $" AND dist_id_2 = '{Data_bill.s_inn}'";
                }
                if (Data_bill.pinfl == true)
                {
                    request = request + $" AND pinfl = '{Data_bill.s_pinfl}'";
                }
                if (Data_bill.code_nds == true)
                {
                    request = request + $" and nds = '{Data_bill.s_code_nds}'";
                }
                if (Data_bill.serv == true)
                {
                    request = request + $" AND type_sres = '{Data_bill.s_serv}'";
                }
                if (Data_bill.fio == true)
                {
                    request = request + $" AND fio = '{Data_bill.s_fio}'";
                }
                if (Data_bill.status == true)
                {
                    request = request + $" AND  state = '{Data_bill.s_status}'";
                }
                if (Data_bill.its_ok)
                {
                    string str = "SELECT * from table_billing where 1 = 1 " + request + "order by num_of_bill desc ";
                    cmd.CommandText = str;
                    bool find_val = false;
                    cmd.CommandType = CommandType.Text;
                    OracleDataReader dr = cmd.ExecuteReader();
                    try
                    {
                        if (dr.Read())
                        {
                            LoadData(str);
                        }
                        else
                        {
                            MessageBox.Show("Не найдено по данному запросу!");
                        }
                    }
                    catch
                    {
                    }
                }
                Data_bill.clear();
            }
        }
예제 #2
0
        private void filtr_Click(object sender, EventArgs e)
        {
            filter_for_invoice r = new filter_for_invoice();

            r.StartPosition = FormStartPosition.CenterParent;
            r.ShowDialog();
            if (Data_bill.date_from != false || Data_bill.ser_num != false || Data_bill.ser_aggr != false || Data_bill.crp != false || Data_bill.inn != false || Data_bill.pinfl != false || Data_bill.code_nds != false || Data_bill.name != false || Data_bill.serv != false || Data_bill.status != false || Data_bill.fio != false)
            {
                string request = "";
                string name_cl = "";

                OracleCommand cmd = con.CreateCommand();
                if (Data_bill.date_from == true)
                {
                    request = $" AND DATE_T  >= '{Data_bill.s_date_from}'  AND DATE_T <= '{Data_bill.s_date_to}' ";
                }
                if (Data_bill.ser_num == true)
                {
                    request = request + $" AND ser LIKE '{Data_bill.s_ser_num}/%'";
                }
                if (Data_bill.ser_aggr == true)
                {
                    request = request + $" AND ser LIKE '%/{Data_bill.s_ser_aggr}'";
                }
                if (Data_bill.crp == true)
                {
                    request = request + $" AND CRP = {Data_bill.s_crp} ";
                }
                if (Data_bill.name == true)
                {
                    for (int i = 0; i < Data_bill.s_name.Length; i++)
                    {
                        if (Data_bill.s_name[i] == '%')
                        {
                            name_cl += '_';
                        }
                        else
                        {
                            name_cl += Data_bill.s_name[i];
                        }
                    }
                    request = request + $" AND CRP_NM LIKE '%{name_cl}%' ";
                }
                if (Data_bill.inn == true)
                {
                    request = request + $" AND INN = '{Data_bill.s_inn}'";
                }
                if (Data_bill.pinfl == true)
                {
                    request = request + $" AND NDS_PINFL = '{Data_bill.s_pinfl}' AND IF_FIZ = 1";
                }
                if (Data_bill.code_nds == true)
                {
                    request = request + $" AND NDS_PINFL = '{Data_bill.s_code_nds}' AND IF_FIZ = 0";
                }
                if (Data_bill.serv == true)
                {
                    request = request + $" AND SERVICE_T = '{Data_bill.s_serv}'";
                }
                if (Data_bill.fio == true)
                {
                    request = request + $" AND FIO = '{Data_bill.s_fio}'";
                }
                if (Data_bill.status == true)
                {
                    request = request + $" AND  STATUS = '{Data_bill.s_status}'";
                }
                if (Data_bill.its_ok)
                {
                    string str = "SELECT * from registration_of_invoice where 1 = 1 " + request + " order by ID desc ";

                    cmd.CommandText = str;
                    cmd.CommandType = CommandType.Text;
                    OracleDataReader dr = cmd.ExecuteReader();

                    if (dr.Read())
                    {
                        LoadData(str);
                    }
                    else
                    {
                        MessageBox.Show("Не найдено по данному запросу!");
                    }

                    Data_bill.clear();
                }
            }
        }