示例#1
0
文件: zt.cs 项目: RotkiwCzujko/obieg
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text == "")
            {
                MessageBox.Show("Nrumer szukanego dokumentu nie może być pusty");
                textBox1.Focus();
            }

            string connectionString = settings.ConnStrRAKS;
            dbConnRAKS = new fb();

            List<string>[] lstWzPoz = dbConnRAKS.fWyszukajZO(textBox1.Text, textBox2.Text, textBox3.Text, textBox8.Text);

            if (lstWzPoz[0].Count == 0)
            {
                MessageBox.Show("Nie znaleziono żadnych zamówień o podanych kryteriach lub wskazane zamówienie zostało już zrealizowane!");
                textBox1.Focus();
                return;
            }
            try
            {
                dtZO.Columns.Add("id", typeof(string));
                dtZO.Columns.Add("Numer", typeof(string));
                dtZO.Columns.Add("Data", typeof(string));
                dtZO.Columns.Add("Platnik", typeof(string));
                dtZO.Columns.Add("Sygnatura", typeof(string));
                dtZO.Columns.Add("Operator", typeof(string));
            }
            catch (DuplicateNameException)
            {
                dtZO.Clear();
            }

            for (int i = 0; i < lstWzPoz[0].Count; i++)
            {
                dtZO.Rows.Add(new object[] { lstWzPoz[0][i].ToString(), lstWzPoz[1][i].ToString(), lstWzPoz[2][i].ToString().Substring(0, 10), lstWzPoz[3][i].ToString(), lstWzPoz[4][i].ToString(), lstWzPoz[5][i].ToString() });
            }
            //dt = dataGridView1.DataSource[];

            dataGridView1.DataSource = dtZO;
            dataGridView1.Columns[0].Visible = false;
            dataGridView1.Columns[1].Width = 96;
            dataGridView1.Columns[2].Width = 96;
            dataGridView1.Columns[3].Width = 370;
            dataGridView1.Columns[4].Width = 278;
            dataGridView1.Columns[5].Width = 96;
            dataGridView1.Columns[1].HeaderText = "NUMER";
            dataGridView1.Columns[2].HeaderText = "DATA ZAM";
            dataGridView1.Columns[3].HeaderText = "PŁATNIK";
            dataGridView1.Columns[4].HeaderText = "SYGNATURA";
            dataGridView1.Columns[5].HeaderText = "OPERATOR";
            //dataGridView1.Columns[1].CellTemplate.Style.Alignment = DataGridViewContentAlignment.MiddleLeft;
        }
示例#2
0
文件: zt.cs 项目: RotkiwCzujko/obieg
        public zt()
        {
            InitializeComponent();
            //dbConnect = new ConnDB(settings.ConnStr);
            dbConnRAKS = new fb();
            // domyslna data dokumnetu - dwie ostatnie cyfry roku
            DateTime currDate = DateTime.Now;
            string currYear = currDate.Year.ToString();
            //currYear = currYear.Substring(currYear.Length - 2);
            textBox2.Text = currYear;
            //textBox7.Text = settings.currTransp;
            //domyslna seria dokumentu
            //textBox3.Text = "WZ";

            if (settings.login == "admin" && settings.pass == "admin")
            { label13.Visible = true; }
        }
示例#3
0
        private void dataGridView1_CellClick_1(object sender, DataGridViewCellEventArgs e)
        {
            dataGridView2.Enabled = true;
            string sID = dataGridView1.CurrentRow.Cells[0].Value.ToString();
            string sIDFS = dataGridView1.CurrentRow.Cells[11].Value.ToString();
            if (sIDFS != "")
            {
                MessageBox.Show("Wybrane WZ jest przyłaczone do faktury.\nNie można edytować cen.", "Blokada WZ");
                dataGridView2.Enabled = false;
            }
            else
                dataGridView2.Enabled = true;

            textBox4.Text = sID;

            string sBlokada = dataGridView1.CurrentRow.Cells[7].Value.ToString();
            if (sBlokada == "0")
            {
                label6.Text = "UWAGA! WZ " + dataGridView1.CurrentRow.Cells[1].Value.ToString() + " nie jest zablokowane!" + " Popraw je z poziomu RAKS!!";
                //label7.Text = "Popraw je z poziomu RAKS!!";
            }
            else
            {
                label6.Text = "";
                label7.Text = "";
            }

            if (dataGridView1.CurrentRow.Cells[6].Value.ToString() == "0")
                label14.Text = "Wartości dla dokumnetu liczone od NETTO";
            else if (dataGridView1.CurrentRow.Cells[6].Value.ToString() == "1")
                label14.Text = "Wartości dla dokumnetu liczone od BRUTTO";
            else
                label14.Text = "Nie rozpoznano sposobu liczenia";

            textBox12.Text = ""; textBox14.Text = ""; textBox15.Text = "";
            textBox12.Text = dataGridView1.CurrentRow.Cells[8].Value.ToString();
            textBox14.Text = dataGridView1.CurrentRow.Cells[9].Value.ToString();
            textBox15.Text = dataGridView1.CurrentRow.Cells[10].Value.ToString();

            textBox17.Text = dataGridView1.CurrentRow.Cells[8].Value.ToString();
            textBox18.Text = dataGridView1.CurrentRow.Cells[9].Value.ToString();
            textBox19.Text = dataGridView1.CurrentRow.Cells[10].Value.ToString();

            string connectionString = settings.ConnStrRAKS;
            dbConnRAKS = new fb();

            List<string>[] lstWzPoz = dbConnRAKS.fWyszukajZOPoz(sID);

            if (lstWzPoz[0].Count == 0)
            {
                MessageBox.Show("Nie znaleziono żadnych pozycji!");
                textBox1.Focus();
                return;
            }
            try
            {
                dtZOPoz.Columns.Add("id", typeof(string));
                dtZOPoz.Columns.Add("Nazwa", typeof(string));
                dtZOPoz.Columns.Add("Ile", typeof(string));
                dtZOPoz.Columns.Add("Cena", typeof(string));
                dtZOPoz.Columns.Add("Brutto", typeof(string));
                dtZOPoz.Columns.Add("Nowa netto", typeof(string));
                dtZOPoz.Columns.Add("Nowa brutto", typeof(string));
                dtZOPoz.Columns.Add("Wspolczynnik", typeof(string));
                dtZOPoz.Columns.Add("Cena zakupu", typeof(string));

            }
            catch (DuplicateNameException)
            {
                dtZOPoz.Clear();
            }

            for (int i = 0; i < lstWzPoz[0].Count; i++)
            {
                dtZOPoz.Rows.Add(new object[] { lstWzPoz[0][i].ToString(), lstWzPoz[1][i].ToString(), lstWzPoz[2][i].ToString(), lstWzPoz[3][i].ToString(), lstWzPoz[4][i].ToString(), "", "", lstWzPoz[5][i].ToString(), lstWzPoz[6][i].ToString() });
            }
            //dt = dataGridView1.DataSource[];

            dataGridView2.DataSource = dtZOPoz;
            dataGridView2.Columns[7].Visible = false;
            //dataGridView2.Columns[4].Visible = false;
            dataGridView2.Columns[1].Width = 310;
            dataGridView2.Columns[2].Width = 50;
            dataGridView2.Columns[3].Width = 50;
            //dataGridView2.Columns[8].Width = 50;
            //dataGridView1.Columns[4].Width = 278;
            //dataGridView1.Columns[5].Width = 96;
            //dataGridView2.Columns[1].HeaderText = "NAZWA";
            //dataGridView2.Columns[2].HeaderText = "Ile";
            //dataGridView2.Columns[3].HeaderText = "Cena";
            //dataGridView1.Columns[4].HeaderText = "SYGNATURA";
            //dataGridView1.Columns[5].HeaderText = "OPERATOR";
            dataGridView1.Columns[2].CellTemplate.Style.Alignment = DataGridViewContentAlignment.MiddleRight;
            dataGridView1.Columns[3].CellTemplate.Style.Alignment = DataGridViewContentAlignment.MiddleRight;

            textBox10.Text = dataGridView2.RowCount.ToString();
        }
示例#4
0
文件: zt.cs 项目: RotkiwCzujko/obieg
        private void button1_Click_1(object sender, EventArgs e)
        {
            dataGridView1.DataSource = "";
            dataGridView2.DataSource = "";

            if (textBox1.Text == "")
            {
                MessageBox.Show("Numer szukanego dokumentu nie może być pusty");
                textBox1.Focus();
                return;
            }

            if (textBox2.Text == "")
            {
                MessageBox.Show("Rok szukanego dokumentu nie może być pusty");
                textBox2.Focus();
                return;
            }

            if (textBox3.Text == "")
            {
                MessageBox.Show("Kod dokumentu nie może być pusty.\nKliknij odpowiedni kod dokumentu.");
                //textBox1.Focus();
                return;
            }

            if (textBox6.Text == "")
            {
                MessageBox.Show("Numer magazynu nie może być pusty.\nKliknij odpowidni nr magazynu");
                //textBox1.Focus();
                return;
            }

            string connectionString = settings.ConnStrRAKS;
            dbConnRAKS = new fb();

            List<string>[] lstWzPoz = dbConnRAKS.fWyszukajZO(textBox1.Text, textBox2.Text, textBox3.Text, textBox8.Text);

            if (lstWzPoz[0].Count == 0)
            {
                MessageBox.Show("Nie znaleziono żadnych WZ o podanych kryteriach.");
                textBox1.Focus();
                return;
            }
            try
            {
                dtZO.Columns.Add("id", typeof(string));
                dtZO.Columns.Add("Numer", typeof(string));
                dtZO.Columns.Add("Data", typeof(string));
                dtZO.Columns.Add("Platnik", typeof(string));
                dtZO.Columns.Add("Sygnatura", typeof(string));
                dtZO.Columns.Add("Operator", typeof(string));
                dtZO.Columns.Add("Liczenie", typeof(string));
                dtZO.Columns.Add("Blokada", typeof(string));
                dtZO.Columns.Add("Netto", typeof(string));
                dtZO.Columns.Add("vat", typeof(string));
                dtZO.Columns.Add("brutto", typeof(string));

            }
            catch (DuplicateNameException)
            {
                dtZO.Clear();
            }

            for (int i = 0; i < lstWzPoz[0].Count; i++)
            {
                dtZO.Rows.Add(new object[] { lstWzPoz[0][i].ToString(), lstWzPoz[1][i].ToString(), lstWzPoz[2][i].ToString().Substring(0, 10), lstWzPoz[3][i].ToString(), lstWzPoz[4][i].ToString(), lstWzPoz[5][i].ToString(), lstWzPoz[7][i].ToString(), lstWzPoz[6][i].ToString(), lstWzPoz[8][i].ToString(), lstWzPoz[9][i].ToString(), lstWzPoz[10][i].ToString() });
            }
            //dt = dataGridView1.DataSource[];

            dataGridView1.DataSource = dtZO;
            dataGridView1.Columns[0].Visible = false;
            dataGridView1.Columns[6].Visible = false;
            dataGridView1.Columns[7].Visible = false;
            dataGridView1.Columns[8].Visible = false;
            dataGridView1.Columns[9].Visible = false;
            dataGridView1.Columns[10].Visible = false;
            dataGridView1.Columns[1].Width = 96;
            dataGridView1.Columns[2].Width = 96;
            dataGridView1.Columns[3].Width = 370;
            dataGridView1.Columns[4].Width = 278;
            dataGridView1.Columns[5].Width = 96;
            dataGridView1.Columns[1].HeaderText = "NUMER";
            dataGridView1.Columns[2].HeaderText = "DATA WZ";
            dataGridView1.Columns[3].HeaderText = "PŁATNIK";
            dataGridView1.Columns[4].HeaderText = "SYGNATURA";
            dataGridView1.Columns[5].HeaderText = "OPERATOR";
            //dataGridView1.Columns[1].CellTemplate.Style.Alignment = DataGridViewContentAlignment.MiddleLeft;
        }
示例#5
0
        private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            string sID = dataGridView1.CurrentRow.Cells[0].Value.ToString();
            textBox4.Text = sID;

            string connectionString = settings.ConnStrRAKS;
            dbConnRAKS = new fb();

            List<string>[] lstWzPoz = dbConnRAKS.fWyszukajZOPoz(sID);

            if (lstWzPoz[0].Count == 0)
            {
                MessageBox.Show("Nie znaleziono żadnych pozycji!");
                textBox1.Focus();
                return;
            }
            try
            {
                dtZOPoz.Columns.Add("id", typeof(string));
                dtZOPoz.Columns.Add("Nazwa", typeof(string));
                dtZOPoz.Columns.Add("IleZam", typeof(string));
                dtZOPoz.Columns.Add("ZREALIZOWANE", typeof(string));
                dtZOPoz.Columns.Add("OpZbiorcze", typeof(string));

            }
            catch (DuplicateNameException)
            {
                dtZOPoz.Clear();
            }

            for (int i = 0; i < lstWzPoz[0].Count; i++)
            {
                dtZOPoz.Rows.Add(new object[] { lstWzPoz[0][i].ToString(), lstWzPoz[1][i].ToString(), lstWzPoz[2][i].ToString(), lstWzPoz[3][i].ToString(), lstWzPoz[4][i].ToString() });
            }
            //dt = dataGridView1.DataSource[];

            dataGridView2.DataSource = dtZOPoz;
            dataGridView2.Columns[0].Visible = false;
            dataGridView2.Columns[4].Visible = false;
            dataGridView2.Columns[1].Width = 310;
            dataGridView2.Columns[2].Width = 50;
            dataGridView2.Columns[3].Width = 50;
            //dataGridView1.Columns[4].Width = 278;
            //dataGridView1.Columns[5].Width = 96;
            dataGridView2.Columns[1].HeaderText = "NAZWA";
            dataGridView2.Columns[2].HeaderText = "Ile zam.";
            dataGridView2.Columns[3].HeaderText = "Zreal.";
            //dataGridView1.Columns[4].HeaderText = "SYGNATURA";
            //dataGridView1.Columns[5].HeaderText = "OPERATOR";
            dataGridView1.Columns[2].CellTemplate.Style.Alignment = DataGridViewContentAlignment.MiddleRight;
            dataGridView1.Columns[3].CellTemplate.Style.Alignment = DataGridViewContentAlignment.MiddleRight;
        }
示例#6
0
        private void button3_Click(object sender, EventArgs e)
        {
            int sIlePozWZ = int.Parse(dataGridView2.RowCount.ToString());
            string sID = dataGridView1.CurrentRow.Cells[0].Value.ToString();

            string sNetto = textBox17.Text;
            string sVat = textBox18.Text;
            string sBrutto = textBox19.Text;

            dbConnRAKS = new fb();
            //aktualizuj Platnosci
            dbConnRAKS.fAktualizujWZStawkiVat(sID, sNetto, sVat, sBrutto);
            //aktualizuj Naglowek WZ
            dbConnRAKS.fAktualizujWZGlowka(sID, sNetto, sVat, sBrutto);
            //aktualizuj pozycje

            string sIDPoz; string sCenaOrg; string sBruttoOrg; string sCenaNew; string sBruttoNew;
            for (int i = 0; i < sIlePozWZ; i++)
            {
                sIDPoz = dataGridView2.Rows[i].Cells[0].Value.ToString();
                sCenaOrg = dataGridView2.Rows[i].Cells[3].Value.ToString(); ;
                sBruttoOrg = dataGridView2.Rows[i].Cells[4].Value.ToString(); ;
                sCenaNew = dataGridView2.Rows[i].Cells[5].Value.ToString(); ;
                sBruttoNew = dataGridView2.Rows[i].Cells[6].Value.ToString(); ;

                if (sBruttoNew == "" || sCenaNew == "") continue;

                dbConnRAKS.fAktualizujWZPoz(sIDPoz, sCenaNew, sBruttoNew);

            }
            textBox17.Text = "";
            textBox18.Text = "";
            textBox19.Text = "";
            button1_Click_1(sender, e);
        }
示例#7
0
        private void fFzRAKSdoMySQL()
        {
            fsza fszaDB = new fsza();
            fszaDB.sParametryZapytania();

            string format = "yyyy-MM-dd";
            string persianDate = fszaDB.sDataMin.ToString();
            int intDays = int.Parse(fszaDB.sDni.ToString());

            DateTime persianDateTime = DateTime.ParseExact(persianDate, format, CultureInfo.InvariantCulture);
            DateTime CurrentDateTime = DateTime.Now.AddDays(-intDays);

            if (persianDateTime > CurrentDateTime) sDataQry = persianDateTime.ToShortDateString();
            else sDataQry = CurrentDateTime.ToShortDateString();

            //MessageBox.Show(fFiltrZnacznikow());

            string sFiltrZnaczniki = fFiltrZnacznikow();
            string sFiltrDataStart = persianDateTime.ToShortDateString();

            string sFiltrWhere = "   ((NOT UPPER( gm_fz.sygnatura) CONTAINING UPPER('OK_LP')  and NOT UPPER( gm_fz.sygnatura) CONTAINING UPPER('NIE_LP') and NOT UPPER( gm_fz.sygnatura) CONTAINING UPPER('OK_K'))  or (SYGNATURA is null) ) and (gm_fz.datarejestracji > '{0}') " +
                            "       and " +
                            "       ( " +
                            "       {1} " +
                            "        or ((gm_fz.datarejestracji > '{0}') and gm_fzpoz.znaczniki is null) " +
                            "        ) ";

            string sWhere = String.Format(sFiltrWhere, sFiltrDataStart, sFiltrZnaczniki);

            string sQuery = "select " +
                            "        gm_fz.magnum, " +
                            "        gm_fz.kod, " +
                            "        gm_fz.data_wystawienia, " +
                            "        gm_fz.datarejestracji, " +
                            "        gm_fz.rok, " +
                            "        gm_fz.miesiac, " +
                            "        gm_fz.nr, " +
                            "        gm_fz.numer, " +
                            "        gm_fz.nazwa_skrocona_dostawcy, " +
                            "        gm_fz.operator, " +
                            "        gm_fz.nazwa_dokumentu, " +
                            "        gm_fz.sygnatura, " +
                            "        gm_fzpoz.ilosc_po, " +
                            "        gm_fzpoz.stawka_zakupu_po, " +
                            "        gm_fzpoz.cena_zakupu_netto_po, " +
                            "        gm_fzpoz.cena_zakupu_brutto_po, " +
                            "        gm_fzpoz.nazwa_oryginalna, " +
                            "        gm_fzpoz.znaczniki, " +
                            "        cast(substring(gm_fzpoz.uwagi from 1 for 3200) as varchar(3200)) uwagipoz, " +
                            "        gm_fzpoz.id, " +
                            "        gm_fz.wal_wartosc_brutto_po " +
                            "    from gm_fzpoz " +
                            "       inner join gm_fz on (gm_fzpoz.id_glowki = gm_fz.id) " +
                            "    where (" + sWhere + ")";

            fb fbRAKS = new fb();
            List<string>[] lstFZ = fbRAKS.fWyszukajFZ(sQuery);

            fszaDB.fZapiszFzSQL(lstFZ);
        }
示例#8
0
        private void fSpisDokRAKS()
        {
            dbConnRAKS = new fb();
            List<string>[] lstDokumenty = dbConnRAKS.fKodyDokumentow(textBox5.Text);

            dataGridView6.Rows.Clear();

            for (int i = 0; i < lstDokumenty[0].Count; i++)
            {
                int number = dataGridView6.Rows.Add();
                dataGridView6.Rows[number].Cells[0].Value = lstDokumenty[0][i].ToString();
                dataGridView6.Rows[number].Cells[1].Value = lstDokumenty[1][i].ToString();
                dataGridView6.Rows[number].Cells[2].Value = lstDokumenty[2][i].ToString();
                dataGridView6.Rows[number].Cells[3].Value = lstDokumenty[3][i].ToString();
            }
        }
示例#9
0
        private void fMagazynyRAKSList()
        {
            dbConnRAKS = new fb();
            List<string>[] lstMagazyny = dbConnRAKS.fMagazyny();

            dataGridView3.Rows.Clear();

            for (int i = 0; i < lstMagazyny[0].Count; i++)
            {
                int number = dataGridView3.Rows.Add();
                dataGridView3.Rows[number].Cells[0].Value = lstMagazyny[0][i].ToString();
                dataGridView3.Rows[number].Cells[1].Value = lstMagazyny[1][i].ToString();
                dataGridView3.Rows[number].Cells[2].Value = lstMagazyny[2][i].ToString();
                dataGridView3.Rows[number].Cells[3].Value = lstMagazyny[3][i].ToString();
                dataGridView3.Rows[number].Cells[4].Value = lstMagazyny[4][i].ToString();

            }
        }