コード例 #1
0
        private void editbutton_Click(object sender, EventArgs e)
        {
            entrada = "editar";
            string         date = fechabox.Value.Day.ToString() + "/" + fechabox.Value.Month.ToString() + "/" + fechabox.Value.Year.ToString();
            LoginClass     AP   = new LoginClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport());
            MovementsClass Ad   = new MovementsClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport());


            if (DireccionGestor.getorigen() == "_payfor_table")
            {
                titlepanel.Text = "EDITAR CUENTA POR PAGAR";
                string orden = "SELECT * FROM  " + UserAccessForm.getusername() + "_payfor_table WHERE `TIPO MONEDA`='" + tipobox.Text + "' AND  COBRADOR='" + namecombo.Text + "' AND MONTO='" + cantidadbox.Text + "' AND FECHA='" + date + "';";


                AP.ShowDataGridfound(datagrid, orden);
                id         = MovementsClass.getdato()[0];
                name.Text  = MovementsClass.getdato()[1];
                fecha.Text = MovementsClass.getdato()[2];

                monto.Text = MovementsClass.getdato()[3];
                tipo.Text  = MovementsClass.getdato()[4];
                panelpad.Show();
                entrada = "editar";
                openpad = true;
            }
            else if (DireccionGestor.getorigen() == "_askfor_table")
            {
                titlepanel.Text = "EDITAR CUENTA POR COBRAR";
                string orden = "SELECT * FROM  " + UserAccessForm.getusername() + "_askfor_table WHERE `TIPO MONEDA`='" + tipobox.Text + "' AND  COBRADOR='" + namecombo.Text + "' AND MONTO='" + cantidadbox.Text + "' AND FECHA='" + date + "';";

                AP.ShowDataGridfound(datagrid, orden);

                id         = MovementsClass.getdato()[0];
                name.Text  = MovementsClass.getdato()[1];
                fecha.Text = MovementsClass.getdato()[2];

                monto.Text = MovementsClass.getdato()[3];
                tipo.Text  = MovementsClass.getdato()[4];

                panelpad.Show();
                entrada = "editar";
                openpad = true;
            }
        }
コード例 #2
0
 private void IngresosForm_Load(object sender, EventArgs e)
 {
     if (DireccionGestor.getorigen() == "inicio")
     {
         monedatipo.Text  = "DOP";
         fondoorigen.Text = "EFECTIVO";
     }
     else if (DireccionGestor.getorigen() == "editor")
     {
         titleingreso.Text   = "MODIFICAR INGRESO";
         gastostrip.Text     = "MODIFICAR";
         datebox.Text        = MovementsClass.getdato()[2];
         horabox.Text        = MovementsClass.getdato()[3];
         reasonbox.Text      = MovementsClass.getdato()[1];
         monedatipo.Text     = MovementsClass.getdato()[5];
         cuantitybox.Text    = MovementsClass.getdato()[4];
         explanationbox.Text = MovementsClass.getdato()[6];
         fondoorigen.Text    = MovementsClass.getdato()[7];
     }
 }
コード例 #3
0
        private void quitarbutton_Click(object sender, EventArgs e)
        {
            LoginClass AP = new LoginClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport());

            MovementsClass show = new MovementsClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport());

            if (DireccionGestor.getorigen() == "_payfor_table")
            {
                string userDataName = UserAccessForm.getusername() + "_payfor_table";

                string orden = "DELETE from " + userDataName + " where ID='" + id + "' ;";
                if (show.ordensql(orden))
                {
                    MessageBox.Show("CUENTA POR PAGAR A " + MovementsClass.getdato()[1] + " HA SIDO SALDADA");
                }
                else
                {
                    MessageBox.Show("CUENTA POR PAGAR A " + MovementsClass.getdato()[1] + " SALDADA");
                }
                limpiarbutton.PerformClick();
            }
            else if (DireccionGestor.getorigen() == "_askfor_table")
            {
                string userDataName = UserAccessForm.getusername() + "_askfor_table";

                string orden = "DELETE from " + userDataName + " where ID='" + id + "' ;";
                if (show.ordensql(orden))
                {
                    MessageBox.Show("CUENTA POR COBRAR A " + MovementsClass.getdato()[1] + " HA SIDO SALDADA");
                }
                else
                {
                    MessageBox.Show("CUENTA POR COBRAR A " + MovementsClass.getdato()[1] + " SALDADA");
                }
                limpiarbutton.PerformClick();
            }
        }
コード例 #4
0
        private void addbuttonstrip_Click(object sender, EventArgs e)
        {
            if (DireccionGestor.getorigen() == "inicio")
            {
                if (reasonbox.Text == "" || cuantitybox.Text == "" || explanationbox.Text == "")
                {
                    MessageBox.Show("Hay datos importantes vacios, termine el formulario.");
                    if (reasonbox.Text == "")
                    {
                        reasonbox.BackColor = Color.Red;
                    }
                    else
                    {
                        reasonbox.BackColor = Color.Green;
                    }

                    if (cuantitybox.Text == "")
                    {
                        cuantitybox.BackColor = Color.Red;
                    }
                    else
                    {
                        cuantitybox.BackColor = Color.Green;
                    }

                    if (explanationbox.Text == "")
                    {
                        explanationbox.BackColor = Color.Red;
                    }
                    else
                    {
                        explanationbox.BackColor = Color.Green;
                    }
                }
                else
                {
                    try
                    {
                        string         userDataName = UserAccessForm.getusername() + "_movements_table";
                        MovementsClass save         = new MovementsClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport());
                        double         cuantity     = double.Parse(cuantitybox.Text);
                        string         date         = datebox.Value.Day.ToString() + "/" + datebox.Value.Month.ToString() + "/" + datebox.Value.Year.ToString();
                        string         hour         = horabox.Value.Hour.ToString() + ":" + horabox.Value.Minute.ToString() + ":" + horabox.Value.Second.ToString();



                        DireccionGestor.setotrostatic("refresh");
                        if (save.setProfit(date, hour, reasonbox.Text, cuantity, monedatipo.Text, datebox.Value.Day.ToString(), datebox.Value.Month.ToString()
                                           , datebox.Value.Year.ToString(), horabox.Value.Hour.ToString(), horabox.Value.Minute.ToString(), horabox.Value.Second.ToString(),
                                           explanationbox.Text, fondoorigen.Text, userDataName))
                        {
                            save.OrderID(userDataName);
                            MessageBox.Show("NUEVO INGRESO DE DINERO A LAS " + hour + " HA SIDO REGISTRADO");
                            if (MessageBox.Show("REGISTRAR OTRO INGRESO DE DINERO?", "REGISTRAR", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
                            {
                                save = new MovementsClass();
                                this.Close();
                                IngresosForm menu = new IngresosForm();
                                menu.WindowState = FormWindowState.Normal;
                                menu.Show();
                            }
                            else
                            {
                                save = new MovementsClass();
                                this.Close();
                            }
                        }
                        else
                        {
                            MessageBox.Show("INGRESO DE DINERO A LAS " + hour + " HA SIDO REGISTRADO");
                            if (MessageBox.Show("REGISTRAR OTRO INGRESO DE DINERO?", "REGISTRAR", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
                            {
                                save = new MovementsClass();
                                this.Close();
                                IngresosForm menu = new IngresosForm();
                                menu.WindowState = FormWindowState.Normal;
                                menu.Show();
                            }
                            else
                            {
                                save = new MovementsClass();
                                this.Close();
                            }
                        }
                    }
                    catch (FormatException datethis) { MessageBox.Show(datethis.ToString()); }
                    catch (InvalidCastException datethose) { MessageBox.Show(datethose.ToString()); }
                }
            }
            else if (DireccionGestor.getorigen() == "editor")
            {
                if (reasonbox.Text == "" || cuantitybox.Text == "" || explanationbox.Text == "")
                {
                    MessageBox.Show("Hay datos importantes vacios, termine el formulario.");
                    if (reasonbox.Text == "")
                    {
                        reasonbox.BackColor = Color.Red;
                    }
                    else
                    {
                        reasonbox.BackColor = Color.Green;
                    }

                    if (cuantitybox.Text == "")
                    {
                        cuantitybox.BackColor = Color.Red;
                    }
                    else
                    {
                        cuantitybox.BackColor = Color.Green;
                    }

                    if (explanationbox.Text == "")
                    {
                        explanationbox.BackColor = Color.Red;
                    }
                    else
                    {
                        explanationbox.BackColor = Color.Green;
                    }
                }
                else
                {
                    try
                    {
                        string         userDataName = UserAccessForm.getusername() + "_movements_table";
                        MovementsClass save         = new MovementsClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport());
                        double         cuantity     = double.Parse(cuantitybox.Text);
                        string         date         = datebox.Value.Day.ToString() + "/" + datebox.Value.Month.ToString() + "/" + datebox.Value.Year.ToString();
                        string         hour         = horabox.Value.Hour.ToString() + ":" + horabox.Value.Minute.ToString() + ":" + horabox.Value.Second.ToString();

                        //`FECHA DEL MOVIMIENTO` ,`HORA DEL MOVIMIENTO` ,MOTIVO ,INGRESO, `TIPO DE MONEDA`, DIA, MES, AÑO, HORA, MINUTO, SEGUNDO, EXPLICACION, `FORMA DE PAGO` ) values ('" + datemovement + "', '" + timemovement + "' , '" + reasonmovement + "', '" + profit + "','" + tipomoneda + "','" + dia + "','" + mes + "','" + anio + "','" + hora + "','" + minuto + "','" + segundo + "','" + explicacion + "','" + origenfondo + "'

                        DireccionGestor.setotrostatic("refresh");
                        string orden = "UPDATE " + userDataName + " SET `FECHA DEL MOVIMIENTO`='" + date + "',  `HORA DEL MOVIMIENTO`='" + hour + "', MOTIVO='" + reasonbox.Text + "', INGRESO='" + cuantity + "', `TIPO DE MONEDA`='" + monedatipo.Text + "',DIA='" + datebox.Value.Day.ToString() + "', MES='" + datebox.Value.Month.ToString() + "', AÑO='" + datebox.Value.Year.ToString() + "', HORA='" + datebox.Value.Hour.ToString() + "', MINUTO='" + datebox.Value.Minute.ToString() + "', SEGUNDO='" + datebox.Value.Second.ToString() + "', EXPLICACION='" + explanationbox.Text + "', `FORMA DE PAGO`='" + fondoorigen.Text + "' WHERE ID='" + MovementsClass.getdato()[0] + "' AND `FECHA DEL MOVIMIENTO`='" + MovementsClass.getdato()[2] + "' AND  `HORA DEL MOVIMIENTO`='" + MovementsClass.getdato()[3] + "';";
                        save.ordensql(orden);


                        MessageBox.Show("INGRESO DE LAS " + MovementsClass.getdato()[3] + " EL DIA " + MovementsClass.getdato()[2] + " HA SIDO EDITADO");
                        this.Close();
                    }
                    catch (FormatException datethis) { MessageBox.Show(datethis.ToString()); }
                    catch (InvalidCastException datethose) { MessageBox.Show(datethose.ToString()); }
                }
            }
        }
コード例 #5
0
        private void datagrid_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            try {
                MovementsClass show = new MovementsClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport());
                string         dato = this.datagrid.CurrentCell.Value.ToString();

                namecombo.Text = dato;
                if (DireccionGestor.getorigen() == "_payfor_table")
                {
                    string userDataName = UserAccessForm.getusername() + "_payfor_table";

                    string orden = "select * from " + userDataName + " where COBRADOR='" + dato + "' ;";
                    if (show.Fillbuscadorpagador(orden))
                    {
                        id             = MovementsClass.getdato()[0];
                        namecombo.Text = MovementsClass.getdato()[1];
                        fechabox.Text  = MovementsClass.getdato()[2];

                        cantidadbox.Text = MovementsClass.getdato()[3];
                        tipobox.Text     = MovementsClass.getdato()[4];


                        name.Text  = MovementsClass.getdato()[1];
                        fecha.Text = MovementsClass.getdato()[2];

                        monto.Text = MovementsClass.getdato()[3];
                        tipo.Text  = MovementsClass.getdato()[4];
                        editbutton.PerformClick();
                    }
                    else
                    {
                        editbutton.Enabled   = false;
                        quitarbutton.Enabled = false;
                        namecombo.Text       = "";
                        tipobox.Text         = "DOP";
                        cantidadbox.Text     = "";
                        fechabox.Text        = DateTime.Now.ToString();
                    }
                }
                else if (DireccionGestor.getorigen() == "_askfor_table")
                {
                    string userDataName = UserAccessForm.getusername() + "_askfor_table";
                    namecombo.Text = dato;
                    string orden = "select * from " + userDataName + " where DEUDOR='" + dato + "' ; ";
                    if (show.Fillbuscadorcobrador(orden))
                    {
                        entrada        = "editar";
                        id             = MovementsClass.getdato()[0];
                        namecombo.Text = MovementsClass.getdato()[1];
                        fechabox.Text  = MovementsClass.getdato()[2];

                        cantidadbox.Text = MovementsClass.getdato()[3];
                        tipobox.Text     = MovementsClass.getdato()[4];


                        name.Text  = MovementsClass.getdato()[1];
                        fecha.Text = MovementsClass.getdato()[2];

                        monto.Text = MovementsClass.getdato()[3];
                        tipo.Text  = MovementsClass.getdato()[4];
                        editbutton.PerformClick();
                    }
                    else
                    {
                        editbutton.Enabled   = false;
                        quitarbutton.Enabled = false;
                        namecombo.Text       = "";
                        tipobox.Text         = "DOP";
                        cantidadbox.Text     = "";
                        fechabox.Text        = DateTime.Now.ToString();
                    }
                }
            } catch (NullReferenceException pafh) { pafh.ToString(); }
        }
コード例 #6
0
        private void OKbutton_Click(object sender, EventArgs e)
        {
            string date = fecha.Value.Day.ToString() + "/" + fecha.Value.Month.ToString() + "/" + fecha.Value.Year.ToString();

            openpad = false;
            panelpad.Show();
            LoginClass AP = new LoginClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport());

            if (DireccionGestor.getorigen() == "_payfor_table")
            {
                titlelabel.Text = "CUENTAS POR PAGAR";
                string orden = "SELECT COBRADOR,FECHA,CANTIDAD FROM  " + UserAccessForm.getusername() + "_payfor_table WHERE `TIPO MONEDA`='" + tipobox + "';";
                AP.ShowDataGridfound(datagrid, orden);
                encontradolabel.Text = AP.getcuenta().ToString();


                ////////////////////////////////////////////////////////////


                if (entrada == "agregar")
                {
                    if (name.Text == "" || monto.Text == "")
                    {
                        MessageBox.Show("Hay datos importantes vacios, termine el formulario.");



                        if (name.Text == "")
                        {
                            name.BackColor = Color.Red;
                        }
                        else
                        {
                            name.BackColor = Color.Green;
                        }

                        if (monto.Text == "")
                        {
                            monto.BackColor = Color.Red;
                        }
                        else
                        {
                            monto.BackColor = Color.Green;
                        }
                    }
                    else
                    {
                        try
                        {
                            MovementsClass ad = new MovementsClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport());


                            date = fecha.Value.Day.ToString() + "/" + fecha.Value.Month.ToString() + "/" + fecha.Value.Year.ToString();
                            double montos = double.Parse(monto.Text);


                            if (ad.AddCountPayFor(name.Text, date, montos, tipobox.Text, UserAccessForm.getusername()))
                            {
                                MessageBox.Show("NUEVO CUENTA POR PAGAR EL " + date + " AGREGADA.");

                                if (MessageBox.Show("Agregar otra cuenta por pagar?", "Agregar", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No)
                                {
                                    ad = new MovementsClass();
                                    panelpad.Hide();
                                }
                                else
                                {
                                    ad         = new MovementsClass();
                                    name.Text  = "";
                                    tipo.Text  = "DOP";
                                    monto.Text = "";
                                    fecha.Text = DateTime.Now.ToString();
                                }
                            }
                            else
                            {
                                MessageBox.Show("NUEVO CUENTA POR PAGAR EL " + date + " AGREGADA.");

                                if (MessageBox.Show("Agregar otra cuenta por pagar?", "Agregar", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No)
                                {
                                    ad = new MovementsClass();
                                    panelpad.Hide();
                                }
                                else
                                {
                                    ad         = new MovementsClass();
                                    name.Text  = "";
                                    tipo.Text  = "DOP";
                                    monto.Text = "";
                                    fecha.Text = DateTime.Now.ToString();
                                }
                            }


                            orden = "SELECT SUM(CANTIDAD) FROM  " + UserAccessForm.getusername() + "_payfor_table WHERE `TIPO MONEDA`='" + tipobox.Text + "';";
                            MovementsClass Ad = new MovementsClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport());

                            Ad.getsuma(totalalbel, tipobox.Text, orden, "CANTIDAD");
                        }
                        catch (FormatException datethis) { datethis.ToString(); }
                    }
                    limpiarbutton.PerformClick();
                }
                else if (entrada == "editar")
                {
                    MovementsClass mc = new MovementsClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport());
                    orden = "UPDATE " + UserAccessForm.getusername() + "_payfor_table SET COBRADOR='" + name.Text + "', FECHA='" + date + "', CANTIDAD='" + monto.Text + "', `TIPO MONEDA`='" + tipo.Text + "' WHERE ID = '" + id + "'";
                    mc.ordensql(orden);
                    panelpad.Hide();
                    orden = "SELECT COBRADOR,FECHA,CANTIDAD FROM  " + UserAccessForm.getusername() + "_payfor_table WHERE `TIPO MONEDA`='" + tipobox + "';";
                    AP.ShowDataGridfound(datagrid, orden);
                    encontradolabel.Text = AP.getcuenta().ToString();
                    MessageBox.Show("COBRADOR " + MovementsClass.getdato()[1] + " EDITADO");
                }

                ////////////////////////////////////////////////////////////
            }

            else if (DireccionGestor.getorigen() == "_askfor_table")
            {
                titlelabel.Text = "CUENTAS POR COBRAR";
                string orden = "SELECT DEUDOR,FECHA,CANTIDAD FROM  " + UserAccessForm.getusername() + "_askfor_table WHERE `TIPO MONEDA`='" + tipobox + "';";
                AP.ShowDataGridfound(datagrid, orden);
                encontradolabel.Text = AP.getcuenta().ToString();


                ////////////////////////////////////////////////////////////


                if (entrada == "agregar")
                {
                    if (name.Text == "" || monto.Text == "")
                    {
                        MessageBox.Show("Hay datos importantes vacios, termine el formulario.");



                        if (name.Text == "")
                        {
                            name.BackColor = Color.Red;
                        }
                        else
                        {
                            name.BackColor = Color.Green;
                        }

                        if (monto.Text == "")
                        {
                            monto.BackColor = Color.Red;
                        }
                        else
                        {
                            monto.BackColor = Color.Green;
                        }
                    }
                    else
                    {
                        try
                        {
                            MovementsClass ad = new MovementsClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport());


                            date = fecha.Value.Day.ToString() + "/" + fecha.Value.Month.ToString() + "/" + fecha.Value.Year.ToString();
                            double montos = double.Parse(monto.Text);


                            if (ad.AddCountAskFor(name.Text, date, montos, tipobox.Text, UserAccessForm.getusername()))
                            {
                                MessageBox.Show("NUEVA CUENTA POR COBRAR EL " + date + " AGREGADA.");

                                if (MessageBox.Show("Agregar otra cuenta por cobrar?", "Agregar", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No)
                                {
                                    ad = new MovementsClass();
                                    panelpad.Hide();
                                }
                                else
                                {
                                    ad         = new MovementsClass();
                                    name.Text  = "";
                                    tipo.Text  = "DOP";
                                    monto.Text = "";
                                    fecha.Text = DateTime.Now.ToString();
                                }
                            }
                            else
                            {
                                MessageBox.Show("NUEVO CUENTA POR COBRAR EL " + date + " AGREGADA.");

                                if (MessageBox.Show("Agregar otra cuenta por cobrar?", "Agregar", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No)
                                {
                                    ad = new MovementsClass();
                                    panelpad.Hide();
                                }
                                else
                                {
                                    ad         = new MovementsClass();
                                    name.Text  = "";
                                    tipo.Text  = "DOP";
                                    monto.Text = "";
                                    fecha.Text = DateTime.Now.ToString();
                                }
                            }

                            orden = "SELECT SUM(CANTIDAD) FROM  " + UserAccessForm.getusername() + "_askfor_table WHERE `TIPO MONEDA`='" + tipobox.Text + "';";
                            MovementsClass Ad = new MovementsClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport());

                            Ad.getsuma(totalalbel, tipobox.Text, orden, "CANTIDAD");
                        }
                        catch (FormatException datethis) { datethis.ToString(); }
                    }
                    limpiarbutton.PerformClick();
                }
                else if (entrada == "editar")
                {
                    MovementsClass mc = new MovementsClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport());
                    orden = "UPDATE " + UserAccessForm.getusername() + "_askfor_table SET DEUDOR='" + name.Text + "', FECHA='" + date + "', CANTIDAD='" + monto.Text + "', `TIPO MONEDA`='" + tipo.Text + "' WHERE ID = '" + id + "'";

                    mc.ordensql(orden);
                    panelpad.Hide();
                    orden = "SELECT DEUDOR,FECHA,CANTIDAD FROM  " + UserAccessForm.getusername() + "_askfor_table WHERE `TIPO MONEDA`='" + tipobox + "';";
                    AP.ShowDataGridfound(datagrid, orden);
                    encontradolabel.Text = AP.getcuenta().ToString();
                    MessageBox.Show("DEUDOR " + MovementsClass.getdato()[1] + " EDITADO");
                }

                ////////////////////////////////////////////////////////////
            }

            limpiarbutton.PerformClick();
        }