private void butt_ok_Click(object sender, EventArgs e) { MemoryStream stream = new MemoryStream(); pictureBoxLogo.Image.Save(stream, System.Drawing.Imaging.ImageFormat.Jpeg); byte[] picbyte = stream.ToArray(); SqlCommand command = new SqlCommand(); command.Connection = objConnection; command.CommandType = CommandType.Text; command.CommandText = "UPDATE Tab_Shrkat SET name_shrkat=@name_shrkat, mahale_sabt=@mahale_sabt, noe_shrkat=@noe_shrkat, phone=@phone, sabt=@sabt, idposti=@idposti, address=@address, image_byte=@image_byte, kod_kargah=@kod_kargah, radif_peyman=@radif_peyman, nameshobe_bime=@nameshobe_bime, name_kargah=@name_kargah, kod_shemely=@kod_shemely, nerkhe_bime=@nerkhe_bime, sh_parvande=@sh_parvande, kod_shobe=@kod_shobe, noeasliepardakhtkonande=@noeasliepardakhtkonande, noefareiepardakhtkonande=@noefareiepardakhtkonande, name_shobe=@name_shobe, nahve_maliyat=@nahve_maliyat, pardakht_name=@pardakht_name, pardakht_family=@pardakht_family, pardakht_codemelli=@pardakht_codemelli, kod_egtesady=@kod_egtesady, nahve_pardakht=@nahve_pardakht, emza1_name=@emza1_name, emza1_family=@emza1_family, emza1_codemelli=@emza1_codemelli, emza1_semat=@emza1_semat, kod_TFN=@kod_TFN, kod_TIN=@kod_TIN, uuser=@uuser, udate=@udate, utime=@utime, upc=@upc WHERE (tmpid = " + id_group.ToString() + ")"; command.Parameters.AddWithValue("@name_shrkat", textBox1.Text); command.Parameters.AddWithValue("@mahale_sabt", textBox2.Text); command.Parameters.AddWithValue("@noe_shrkat", textBox3.Text); command.Parameters.AddWithValue("@phone", textBox4.Text); command.Parameters.AddWithValue("@sabt", textBox5.Text); command.Parameters.AddWithValue("@idposti", textBox6.Text); command.Parameters.AddWithValue("@address", textBox7.Text); command.Parameters.AddWithValue("@image_byte", picbyte); command.Parameters.AddWithValue("@kod_kargah", textBox8.Text); command.Parameters.AddWithValue("@radif_peyman", textBox9.Text); command.Parameters.AddWithValue("@nameshobe_bime", textBox10.Text); command.Parameters.AddWithValue("@name_kargah", textBox11.Text); command.Parameters.AddWithValue("@kod_shemely", textBox12.Text); command.Parameters.AddWithValue("@nerkhe_bime", textBox13.Text); command.Parameters.AddWithValue("@sh_parvande", textBox14.Text); command.Parameters.AddWithValue("@kod_shobe", textBox15.Text); command.Parameters.AddWithValue("@noeasliepardakhtkonande", db_Combo1.SelectedValue); command.Parameters.AddWithValue("@noefareiepardakhtkonande", db_Combo2.SelectedValue); command.Parameters.AddWithValue("@name_shobe", textBox16.Text); command.Parameters.AddWithValue("@nahve_maliyat", db_Combo3.SelectedValue); command.Parameters.AddWithValue("@pardakht_name", textBox17.Text); command.Parameters.AddWithValue("@pardakht_family", textBox18.Text); command.Parameters.AddWithValue("@pardakht_codemelli", textBox19.Text); command.Parameters.AddWithValue("@kod_egtesady", textBox20.Text); command.Parameters.AddWithValue("@nahve_pardakht", db_Combo4.SelectedValue); command.Parameters.AddWithValue("@emza1_name", textBox21.Text); command.Parameters.AddWithValue("@emza1_family", textBox22.Text); command.Parameters.AddWithValue("@emza1_codemelli", textBox23.Text); command.Parameters.AddWithValue("@emza1_semat", textBox24.Text); command.Parameters.AddWithValue("@kod_TFN", textBox25.Text); command.Parameters.AddWithValue("@kod_TIN", textBox26.Text); command.Parameters.AddWithValue("@uuser", "."); command.Parameters.AddWithValue("@udate", Database.u_date()); command.Parameters.AddWithValue("@utime", Database.u_time()); command.Parameters.AddWithValue("@upc", Database.u_pc()); objConnection.Open(); command.ExecuteNonQuery(); objConnection.Close(); command.Dispose(); MessageBox.Show(" اطلاعات با موفقیت ثبت شد ", "", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Hide(); }
//private void Bind_2_Grid_Good() //{ // string Qry = ""; // string[] Search_Data; // int i; // bool first = true; // if (textBox5.Text.Trim() == "") // Qry = "SELECT [tmpid]as[ردیف],[hogog]AS[حقوق],[shahr]as[عنوان],[mablag]as[مبلغ],[maliat]as[مالیات],[maliat_darsad]as[درصد مالیات],[bimeh_karfarma]as[بیمه کارفرما],[karfarma_darsad]as[درصد بیمه کارفرما],[bimeh_personel]as[بیمه پرسنل],[personel_dasad]as[درصد بیمه پرسنل],[bimeh_bikari]as[بیمه بیکاری],[bikari_darsad]as[درصد بیمه بیکاری],[noe]as[نوع] FROM [Tbl_hogog]"; // else // { // Search_Data = textBox5.Text.Split(' '); // Qry = "SELECT [tmpid]as[ردیف],[hogog]AS[حقوق],[shahr]as[عنوان],[mablag]as[مبلغ],[maliat]as[مالیات],[maliat_darsad]as[درصد مالیات],[bimeh_karfarma]as[بیمه کارفرما],[karfarma_darsad]as[درصد بیمه کارفرما],[bimeh_personel]as[بیمه پرسنل],[personel_dasad]as[درصد بیمه پرسنل],[bimeh_bikari]as[بیمه بیکاری],[bikari_darsad]as[درصد بیمه بیکاری],[noe]as[نوع] FROM [Tbl_hogog] WHERE ("; // for (i = 0; i < Search_Data.Length; i++) // { // if (Search_Data[i].Trim() != "") // { // if (first == false) // Qry += "And"; // Qry += "("; // if (database.Is_Numeric(Search_Data[i])) // { // Qry += "([tmpid] like '%" + Search_Data[i] + "%')"; // Qry += "Or ([hogog] like '%" + Search_Data[i] + "%')"; // Qry += "Or ([shahr] like '%" + Search_Data[i] + "%')"; // Qry += "Or ([mablag] like '%" + Search_Data[i] + "%')"; // Qry += "Or ([personel_dasad] like '%" + Search_Data[i] + "%')"; // Qry += "Or ([maliat_darsad] like '%" + Search_Data[i] + "%')"; // Qry += "Or ([karfarma_darsad] like '%" + Search_Data[i] + "%')"; // Qry += "Or ([bikari_darsad] like '%" + Search_Data[i] + "%')"; // Qry += "Or ([noe] like '%" + Search_Data[i] + "%')"; // } // else // { // Qry += "([tmpid] like '%" + Search_Data[i] + "%')"; // Qry += "Or ([hogog] like '%" + Search_Data[i] + "%')"; // Qry += "Or ([shahr] like '%" + Search_Data[i] + "%')"; // Qry += "Or ([mablag] like '%" + Search_Data[i] + "%')"; // Qry += "Or ([personel_dasad] like '%" + Search_Data[i] + "%')"; // Qry += "Or ([maliat_darsad] like '%" + Search_Data[i] + "%')"; // Qry += "Or ([karfarma_darsad] like '%" + Search_Data[i] + "%')"; // Qry += "Or ([bikari_darsad] like '%" + Search_Data[i] + "%')"; // Qry += "Or ([noe] like '%" + Search_Data[i] + "%')"; // } // Qry += ")"; // first = false; // } // } // Qry += ")"; // } // database.Connection_Open(); // database.Fill(Qry, objDataSet, "Tbl_hogog", true); // database.Connection_Close(); // dataGridView1.DataSource = objDataSet.Tables["Tbl_hogog"]; //} //private void but_serch_Click(object sender, EventArgs e) //{ // // Bind_2_Grid_Good(); // String[] arrserarch; // arrserarch = new String[22]; // String[] arrserarch1; // arrserarch1 = new String[22]; // if (comboBox1.Text != "") // { // arrserarch[1] = " (hogog ='" + comboBox1.Text + "') AND "; // arrserarch1[1] = " ({Tbl_hogog.hogog} Like '" + comboBox1.Text + "') AND "; // } // if (comboBox3.Text != "") // { // arrserarch[2] = " (noe = '" + comboBox3.Text + "') AND "; // arrserarch1[2] = " ({Tbl_hogog.noe} Like '" + comboBox3.Text + "') AND "; // } // if (textBox1.Text != "") // { // arrserarch[3] = " (shahr= '" + textBox1.Text + "') AND "; // arrserarch1[3] = " ({Tbl_hogog.shahr} = '" + textBox1.Text + "') AND "; // } // if (textBox4.Text != "") // { // arrserarch[4] = " (mablag= '" + textBox4.Text + "') AND "; // arrserarch1[4] = " ({Tbl_hogog.mablag} = '" + textBox4.Text + "') AND "; // } // arrserarch[0] = arrserarch[1] + arrserarch[2] + arrserarch[3] + arrserarch[4] + arrserarch[5] + arrserarch[6]; // arrserarch1[0] = arrserarch1[1] + arrserarch1[2] + arrserarch1[3] + arrserarch1[4] + arrserarch1[5] + arrserarch1[6]; // objDataSet.Clear(); // if (arrserarch[0] == "") // { // database.Connection_Open(); // database.Fill("SELECT * FROM Tbl_hogog", objDataSet, "Tbl_hogog", true); // database.Connection_Close(); // dataGridView1.DataSource = objDataSet.Tables["Tbl_hogog"]; // } // else // { // arrserarch[0] = arrserarch[0].Substring(1, arrserarch[0].Length - 5); // arrserarch1[0] = arrserarch1[0].Substring(1, arrserarch1[0].Length - 5); // database.Connection_Open(); // database.Fill("SELECT * FROM Tbl_hogog WHERE " + arrserarch[0], objDataSet, "Tbl_hogog", true); // database.Connection_Close(); // dataGridView1.DataSource = objDataSet.Tables["Tbl_hogog"]; // } //} private void butt_ok_Click(object sender, EventArgs e) { if (comboBox1.SelectedIndex == -1) { MessageBox.Show("لطفا نوع کسورات و مزایا را وارد نمایید", "", MessageBoxButtons.OK, MessageBoxIcon.Error); comboBox1.Focus(); return; } if (comboBox3.SelectedIndex == -1) { MessageBox.Show("لطفا نوع را وارد نمایید", "", MessageBoxButtons.OK, MessageBoxIcon.Error); comboBox3.Focus(); return; } if (textBox1.Text == "") { MessageBox.Show("لطفا عنوان را وارد نمایید", "", MessageBoxButtons.OK, MessageBoxIcon.Error); textBox1.Focus(); return; } if (textBox4.Text == "") { MessageBox.Show("لطفا مبلغ را وارد نمایید", "", MessageBoxButtons.OK, MessageBoxIcon.Error); textBox4.Focus(); return; } if (textBox2.Text == "") { MessageBox.Show("لطفا کد حسابداری را وارد نمایید", "", MessageBoxButtons.OK, MessageBoxIcon.Error); textBox2.Focus(); return; } if (textBox3.Text == "") { MessageBox.Show("لطفا بیمه کارفرما را وارد نمایید", "", MessageBoxButtons.OK, MessageBoxIcon.Error); textBox3.Focus(); return; } if (textBox7.Text == "") { MessageBox.Show("لطفا بیمه پرسنل را وارد نمایید", "", MessageBoxButtons.OK, MessageBoxIcon.Error); textBox7.Focus(); return; } if (textBox6.Text == "") { MessageBox.Show("لطفا بیمه بیکاری را وارد نمایید", "", MessageBoxButtons.OK, MessageBoxIcon.Error); textBox6.Focus(); return; } if (label3.Text == "ADD") { SqlCommand insert1 = new SqlCommand(); insert1.Connection = objConnection; objConnection.Open(); insert1.CommandText = "INSERT INTO [Tbl_hogog] ([hogog],[shahr],[mablag],[noe],[maliat],[bimeh_karfarma],[karfarma_darsad],[personel_dasad],[bikari_darsad],[uuser],[udate],[utime],[upc],IDnoe,idAccounting) Values (@hogog,@shahr,@mablag,@noe,@maliat,@bimeh_karfarma,@karfarma_darsad,@personel_dasad,@bikari_darsad,@uuser,@udate,@utime,@upc,@IDnoe,@idAccounting)"; insert1.CommandType = CommandType.Text; insert1.Parameters.AddWithValue("@hogog", comboBox1.Text); insert1.Parameters.AddWithValue("@shahr", textBox1.Text); insert1.Parameters.AddWithValue("@mablag", textBox4.Text); insert1.Parameters.AddWithValue("@IDnoe", comboBox3.SelectedIndex); insert1.Parameters.AddWithValue("@noe", comboBox3.Text); insert1.Parameters.AddWithValue("@maliat", checkBox1.Checked); insert1.Parameters.AddWithValue("@bimeh_karfarma", checkBox2.Checked); insert1.Parameters.AddWithValue("@karfarma_darsad", textBox3.Text); insert1.Parameters.AddWithValue("@bikari_darsad", textBox7.Text); insert1.Parameters.AddWithValue("@personel_dasad", textBox6.Text); insert1.Parameters.AddWithValue("@idAccounting", textBox2.Text); insert1.Parameters.AddWithValue("@uuser", ""); insert1.Parameters.AddWithValue("@udate", database.u_date()); insert1.Parameters.AddWithValue("@utime", database.u_time()); insert1.Parameters.AddWithValue("@upc", database.u_pc()); if (insert1.ExecuteNonQuery() > 0) { MessageBox.Show("ثبت با موفقیت انجام شد", "پيغام", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("خطا در ثبت", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error); } insert1.Dispose(); objConnection.Close(); delete(); } if (label3.Text == "EDIT") { SqlCommand insert1 = new SqlCommand(); insert1.Connection = objConnection; objConnection.Open(); insert1.CommandText = "UPDATE Tbl_hogog SET hogog=@hogog ,shahr=@shahr ,mablag=@mablag ,noe=@noe ,maliat=@maliat ,bimeh_karfarma=@bimeh_karfarma ,karfarma_darsad=@karfarma_darsad ,personel_dasad=@personel_dasad ,bikari_darsad=@bikari_darsad ,uuser=@uuser ,udate=@udate ,utime=@utime ,upc=@upc ,IDnoe=@IDnoe ,idAccounting=@idAccounting WHERE (tmpid = '" + label6.Text + "')"; insert1.CommandType = CommandType.Text; insert1.Parameters.AddWithValue("@hogog", comboBox1.Text); insert1.Parameters.AddWithValue("@shahr", textBox1.Text); insert1.Parameters.AddWithValue("@mablag", textBox4.Text); insert1.Parameters.AddWithValue("@IDnoe", comboBox3.SelectedIndex); insert1.Parameters.AddWithValue("@noe", comboBox3.Text); insert1.Parameters.AddWithValue("@maliat", checkBox1.Checked); insert1.Parameters.AddWithValue("@bimeh_karfarma", checkBox2.Checked); insert1.Parameters.AddWithValue("@karfarma_darsad", textBox3.Text); insert1.Parameters.AddWithValue("@bikari_darsad", textBox7.Text); insert1.Parameters.AddWithValue("@personel_dasad", textBox6.Text); insert1.Parameters.AddWithValue("@idAccounting", textBox2.Text); insert1.Parameters.AddWithValue("@uuser", ""); insert1.Parameters.AddWithValue("@udate", database.u_date()); insert1.Parameters.AddWithValue("@utime", database.u_time()); insert1.Parameters.AddWithValue("@upc", database.u_pc()); if (insert1.ExecuteNonQuery() > 0) { MessageBox.Show("اطلاعات با موفقیت ویرایش شد", "پيغام", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("خطا در ثبت", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error); } insert1.Dispose(); objConnection.Close(); delete(); } database.Connection_Open(); database.Fill("SELECT * FROM Tbl_hogog", objDataSet, "Tbl_hogog", true); database.Connection_Close(); dataGridView1.DataSource = objDataSet; dataGridView1.DataMember = "Tbl_hogog"; Grid_Amin(); }
private void button1_Click(object sender, EventArgs e) { button1.Enabled = false; string file_name = Application.StartupPath.ToString() + @"\Maliat\" + id_year.ToString() + id_moon.ToString().PadLeft(2, '0'); if (Directory.Exists(file_name) == false) { Directory.CreateDirectory(file_name); } string open_file_name = file_name; file_name += @"\" + "WH" + id_year.ToString() + id_moon.ToString().PadLeft(2, '0') + ".TXT"; database.Connection_Open(); database.Fill("SELECT * FROM Tbl_process INNER JOIN tbl_personel ON Tbl_process.idgroup = tbl_personel.idgroup AND Tbl_process.idyear = tbl_personel.idyear AND Tbl_process.idmoon = tbl_personel.idmoon AND Tbl_process.idpersonal = tbl_personel.tmpid AND Tbl_process.type1 = 2 AND tbl_personel.list1 = 1 WHERE (Tbl_process.idgroup=" + id_group + ") AND (Tbl_process.idyear=" + id_year + ") AND (Tbl_process.idmoon=" + id_moon + ")", objDataSet, "Tbl_process", true); database.Connection_Close(); database.Connection_Open(); database.Fill("SELECT * FROM Tab_Shrkat WHERE (tmpid=" + id_group + ")", objDataSet, "Tab_Shrkat", true); database.Connection_Close(); database.Connection_Open(); database.Fill("SELECT * FROM Tbl_maliat WHERE (tmpid=1)", objDataSet, "Tbl_maliat", true); database.Connection_Close(); string[] installs = new string[(objDataSet.Tables["Tbl_process"].Rows.Count + 1)]; installs[0] = objDataSet.Tables["Tab_Shrkat"].Rows[0]["sh_parvande"].ToString(); installs[0] += "," + objDataSet.Tables["Tab_Shrkat"].Rows[0]["kod_shobe"].ToString(); installs[0] += "," + id_year; installs[0] += "," + id_moon.PadLeft(2, '0'); installs[0] += "," + objDataSet.Tables["Tab_Shrkat"].Rows[0]["noeasliepardakhtkonande"].ToString(); installs[0] += "," + objDataSet.Tables["Tab_Shrkat"].Rows[0]["noefareiepardakhtkonande"].ToString(); installs[0] += ","; installs[0] += "," + objDataSet.Tables["Tab_Shrkat"].Rows[0]["pardakht_name"].ToString() + " " + objDataSet.Tables["Tab_Shrkat"].Rows[0]["pardakht_family"].ToString(); installs[0] += "," + objDataSet.Tables["Tab_Shrkat"].Rows[0]["name_shobe"].ToString(); installs[0] += "," + objDataSet.Tables["Tab_Shrkat"].Rows[0]["kod_egtesady"].ToString(); installs[0] += "," + objDataSet.Tables["Tab_Shrkat"].Rows[0]["idposti"].ToString(); installs[0] += "," + objDataSet.Tables["Tab_Shrkat"].Rows[0]["phone"].ToString(); installs[0] += "," + objDataSet.Tables["Tab_Shrkat"].Rows[0]["address"].ToString(); installs[0] += "," + objDataSet.Tables["Tab_Shrkat"].Rows[0]["emza1_codemelli"].ToString(); installs[0] += "," + objDataSet.Tables["Tab_Shrkat"].Rows[0]["emza1_name"].ToString(); installs[0] += "," + objDataSet.Tables["Tab_Shrkat"].Rows[0]["emza1_family"].ToString(); installs[0] += "," + objDataSet.Tables["Tab_Shrkat"].Rows[0]["emza1_semat"].ToString(); installs[0] += ","; installs[0] += ","; installs[0] += ","; installs[0] += ","; //installs[0] += ",";//آن کد آخریه for (int q = 1; q <= objDataSet.Tables["Tbl_process"].Rows.Count; q++) { installs[q] = objDataSet.Tables["Tbl_process"].Rows[q - 1]["cod_mely"].ToString(); installs[q] += "," + objDataSet.Tables["Tbl_process"].Rows[q - 1]["name"].ToString(); installs[q] += "," + objDataSet.Tables["Tbl_process"].Rows[q - 1]["family"].ToString(); installs[q] += "," + objDataSet.Tables["Tbl_process"].Rows[q - 1]["name_pedar"].ToString(); installs[q] += "," + objDataSet.Tables["Tbl_process"].Rows[q - 1]["noe_garardad"].ToString(); if (objDataSet.Tables["Tbl_process"].Rows[q - 1]["code_posti"].ToString() == "-") { installs[q] += ","; } else { installs[q] += "," + objDataSet.Tables["Tbl_process"].Rows[q - 1]["code_posti"].ToString(); } database.Connection_Open(); database.Fill("SELECT * FROM Maliat_coding WHERE (MCode = 2) AND (SCode = " + objDataSet.Tables["Tbl_process"].Rows[q - 1]["maliat_onvanShoghl"].ToString() + ")", objDataSet, "maliat_onvanShoghl", true); database.Connection_Close(); installs[q] += "," + objDataSet.Tables["maliat_onvanShoghl"].Rows[0]["SDesc"].ToString(); objDataSet.Tables["maliat_onvanShoghl"].Clear(); //سابقه database.Connection_Open(); database.Fill("SELECT * FROM tbl_personel WHERE (tmpid = " + objDataSet.Tables["Tbl_process"].Rows[q - 1]["idpersonal"].ToString() + ")", objDataSet, "tbl_personel", true); database.Connection_Close(); installs[q] += "," + Convert.ToString(Convert.ToInt16(database.u_date().ToString().Substring(0, 4)) - Convert.ToInt16(objDataSet.Tables["tbl_personel"].Rows[0]["data_estekhdam"].ToString().Substring(0, 4))); objDataSet.Tables["tbl_personel"].Clear(); installs[q] += "," + objDataSet.Tables["Tbl_process"].Rows[q - 1]["maliat_madrak"].ToString(); installs[q] += "," + objDataSet.Tables["Tbl_process"].Rows[q - 1]["maliat_rasteshoghli"].ToString(); database.Connection_Open(); database.Fill("SELECT * FROM Tbl_moafiat_maliat WHERE (tmpid = " + objDataSet.Tables["Tbl_process"].Rows[q - 1]["code_moafiat_maliat"].ToString() + ")", objDataSet, "Tbl_moafiat_maliat", true); database.Connection_Close(); installs[q] += "," + objDataSet.Tables["Tbl_moafiat_maliat"].Rows[0]["kod_moafiat"].ToString(); objDataSet.Tables["Tbl_moafiat_maliat"].Clear(); installs[q] += "," + objDataSet.Tables["Tbl_process"].Rows[q - 1]["maliat_meliat"].ToString(); if (objDataSet.Tables["Tbl_process"].Rows[q - 1]["maliat_meliat"].ToString() != "1") { database.Connection_Open(); database.Fill("SELECT * FROM Maliat_coding WHERE (MCode = 12) AND (SCode = " + objDataSet.Tables["Tbl_process"].Rows[q - 1]["maliat_namekeshvar"].ToString() + ")", objDataSet, "maliat_namekeshvar", true); database.Connection_Close(); installs[q] += "," + objDataSet.Tables["maliat_namekeshvar"].Rows[0]["SDesc"].ToString(); objDataSet.Tables["maliat_namekeshvar"].Clear(); } else { installs[q] += ","; } installs[q] += "," + objDataSet.Tables["Tbl_process"].Rows[q - 1]["noe_bimeh"].ToString(); installs[q] += ",";//نام بیمه installs[q] += "," + objDataSet.Tables["Tbl_process"].Rows[q - 1]["sh_bimeh"].ToString().PadLeft(10, '0'); installs[q] += "," + Math.Round(Convert.ToDecimal(objDataSet.Tables["Tbl_process"].Rows[q - 1]["w4"].ToString()), 0).ToString(); installs[q] += "," + Math.Round(Convert.ToDecimal(objDataSet.Tables["Tbl_process"].Rows[q - 1]["SUM_mazaya_maliat"].ToString()), 0).ToString(); installs[q] += ",0"; installs[q] += "," + Math.Round(Convert.ToDecimal(objDataSet.Tables["Tbl_process"].Rows[q - 1]["SUM_hogogh_mazaya"].ToString()), 0).ToString(); installs[q] += ",0"; installs[q] += "," + Math.Round(Convert.ToDecimal(objDataSet.Tables["Tbl_process"].Rows[q - 1]["SUM_hogogh_mazaya"].ToString()), 0).ToString(); installs[q] += ",0"; installs[q] += ",0"; installs[q] += ",0"; installs[q] += ",0"; installs[q] += ",0"; installs[q] += "," + Math.Round(Convert.ToDecimal(objDataSet.Tables["Tbl_process"].Rows[q - 1]["Eydi"].ToString()), 0).ToString(); installs[q] += "," + Math.Round(Convert.ToDecimal(objDataSet.Tables["Tbl_process"].Rows[q - 1]["sanavat"].ToString()), 0).ToString(); installs[q] += "," + (Convert.ToInt64(objDataSet.Tables["Tbl_process"].Rows[q - 1]["SUM_hogogh_mazaya"]) + Convert.ToInt64(objDataSet.Tables["Tbl_process"].Rows[q - 1]["Eydi"]) + Convert.ToInt64(objDataSet.Tables["Tbl_process"].Rows[q - 1]["sanavat"])).ToString(); installs[q] += "," + Math.Round(Convert.ToDecimal(objDataSet.Tables["Tbl_process"].Rows[q - 1]["bime2"].ToString()), 0).ToString(); if (Convert.ToInt64(objDataSet.Tables["Tbl_process"].Rows[q - 1]["SUM_MASHMOL_MALIAT"]) >= Convert.ToInt64(objDataSet.Tables["Tbl_maliat"].Rows[0]["maliat_ta"])) { installs[q] += "," + (Convert.ToInt64(objDataSet.Tables["Tbl_process"].Rows[q - 1]["SUM_MASHMOL_MALIAT"]) - Convert.ToInt64(objDataSet.Tables["Tbl_maliat"].Rows[0]["maliat_ta"])).ToString(); } else { installs[q] += ",0"; } installs[q] += "," + Math.Round(Convert.ToDecimal(objDataSet.Tables["Tbl_process"].Rows[q - 1]["view_maliat"].ToString()), 0).ToString(); installs[q] += "," + Math.Round(Convert.ToDecimal(objDataSet.Tables["Tbl_process"].Rows[q - 1]["view_maliat"].ToString()), 0).ToString(); } System.IO.File.WriteAllLines(file_name, installs, Encoding.Unicode); objDataSet.Clear(); file_name = ""; file_name = Application.StartupPath.ToString() + @"\Maliat\" + id_year.ToString() + id_moon.ToString().PadLeft(2, '0'); file_name += @"\" + "WK" + id_year.ToString() + id_moon.ToString().PadLeft(2, '0') + ".TXT"; database.Connection_Open(); database.Fill("SELECT ISNULL(SUM(w4)+SUM(w5)+SUM(w6)+SUM(SUM_mazaya_maliat),0) AS S_w4, Count(Tbl_process.idgroup) AS rsnumber, ISNULL(Sum(view_maliat),0) AS S_view_maliat FROM Tbl_process INNER JOIN tbl_personel ON Tbl_process.idgroup = tbl_personel.idgroup AND Tbl_process.idyear = tbl_personel.idyear AND Tbl_process.idmoon = tbl_personel.idmoon AND Tbl_process.idpersonal = tbl_personel.tmpid AND Tbl_process.type1 = 2 AND tbl_personel.list1 = 1 WHERE (Tbl_process.idgroup=" + id_group + ") AND (Tbl_process.idyear=" + id_year + ") AND (Tbl_process.idmoon=" + id_moon + ")", objDataSet, "Tbl_process", true); database.Connection_Close(); database.Connection_Open(); database.Fill("SELECT Sum(SUM_MASHMOL_MALIAT - 4833333) AS sumnumber FROM Tbl_process INNER JOIN tbl_personel ON Tbl_process.idgroup = tbl_personel.idgroup AND Tbl_process.idyear = tbl_personel.idyear AND Tbl_process.idmoon = tbl_personel.idmoon AND Tbl_process.idpersonal = tbl_personel.tmpid AND Tbl_process.type1 = 2 AND tbl_personel.list1 = 1 WHERE ((SUM_MASHMOL_MALIAT - 4833333) > 0) AND (Tbl_process.type1 = 2) AND (Tbl_process.idgroup=" + id_group + ") AND (Tbl_process.idyear=" + id_year + ") AND (Tbl_process.idmoon=" + id_moon + ")", objDataSet, "Tbl_process1", true); database.Connection_Close(); database.Connection_Open(); database.Fill("SELECT * FROM Tab_Shrkat WHERE (tmpid=" + id_group + ")", objDataSet, "Tab_Shrkat", true); database.Connection_Close(); database.Connection_Open(); database.Fill("SELECT * FROM Tbl_maliat WHERE (tmpid=1)", objDataSet, "Tbl_maliat", true); database.Connection_Close(); database.Connection_Open(); database.Fill("SELECT * FROM PKH WHERE (no1=2) AND (no2=4)", objDataSet, "PKH", true); database.Connection_Close(); string[] installs1 = new string[(1)]; installs1[0] = objDataSet.Tables["Tab_Shrkat"].Rows[0]["sh_parvande"].ToString(); installs1[0] += "," + id_year; installs1[0] += "," + id_moon.PadLeft(2, '0'); installs1[0] += "," + Math.Round(Convert.ToDecimal(objDataSet.Tables["Tbl_process"].Rows[0]["S_w4"].ToString()), 0).ToString(); installs1[0] += "," + Math.Round(Convert.ToDecimal(objDataSet.Tables["Tbl_process1"].Rows[0]["sumnumber"].ToString()), 0).ToString(); installs1[0] += "," + Math.Round(Convert.ToDecimal(objDataSet.Tables["Tbl_process"].Rows[0]["S_view_maliat"].ToString()), 0).ToString(); installs1[0] += ",0"; installs1[0] += ",0"; installs1[0] += ",0"; installs1[0] += ",0"; //حقوق پرداختنی installs1[0] += ",0"; //حقوق مزایا ماه گذشته installs1[0] += ",0"; //مالیات installs1[0] += ",0"; installs1[0] += ",0"; installs1[0] += ",0";//بدهی مالیاتی تا ماه گذشته string file_name_date = @"DD.dll"; string[] installs_date = new string[1]; installs_date = System.IO.File.ReadAllLines(file_name_date, Encoding.Unicode); installs1[0] += "," + installs_date[0].Replace("/", ""); installs1[0] += "," + objDataSet.Tables["Tbl_process"].Rows[0]["rsnumber"].ToString(); installs1[0] += ","; installs1[0] += "," + objDataSet.Tables["Tab_Shrkat"].Rows[0]["nahve_maliyat"].ToString(); if (objDataSet.Tables["PKH"].Rows.Count > 0) { installs1[0] += "," + objDataSet.Tables["PKH"].Rows[0]["q1"].ToString(); installs1[0] += "," + objDataSet.Tables["PKH"].Rows[0]["q2"].ToString(); installs1[0] += "," + objDataSet.Tables["PKH"].Rows[0]["q3"].ToString(); installs1[0] += "," + objDataSet.Tables["PKH"].Rows[0]["q4"].ToString(); installs1[0] += "," + objDataSet.Tables["PKH"].Rows[0]["q5"].ToString(); } else { installs1[0] += ","; installs1[0] += ","; installs1[0] += ","; installs1[0] += ","; installs1[0] += ","; } installs1[0] += "," + Math.Round(Convert.ToDecimal(objDataSet.Tables["Tbl_process"].Rows[0]["S_view_maliat"].ToString()), 0).ToString(); System.IO.File.WriteAllLines(file_name, installs1, Encoding.Unicode); objDataSet.Clear(); MessageBox.Show("فایل ها در پوشه مخصوص خود ساخته شده است", "", MessageBoxButtons.OK, MessageBoxIcon.Information); ProcessStartInfo start_info = new ProcessStartInfo("explorer.exe", open_file_name); start_info.UseShellExecute = false; start_info.CreateNoWindow = true; Process proc = new Process(); proc.StartInfo = start_info; proc.Start(); button1.Enabled = true; }
private void timer1_Tick(object sender, EventArgs e) { lab_date.Text = DataBase.u_date(); lab_time.Text = DataBase.u_time(); }