Ejemplo n.º 1
0
 private void processinvoice_Click(object sender, EventArgs e)
 {
     if (idonsys.Text == "")
     {
         string query = "insert Into [transaction] (ref, madebytran, reasontran, datetran, origin, entry, expenses) values ('" + nobill.Text + "', '" + nameprovider.Text + "', '" + reasonbill.Text + "', '" + datebill.Text + "', '" + paymeth.Text + "', '0.00', '" + qty.Text + "')";
         c.command(query);
         this.Close();
     }
     else if (idonsys.Text != "")
     {
         string query = "update [transaction] set ref = '" + nobill.Text + "', madebytran = '" + nameprovider.Text + "', reasontran = '" + reasonbill.Text + "', datetran = '" + datebill.Text + "', origin = '" + paymeth.Text + "', expenses = '" + qty.Text + "'";
         c.command(query);
         this.Close();
     }
 }
Ejemplo n.º 2
0
        private void delateprocedure_btn_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("Seguro que desea eliminar este Procedimiento?", "Eliminar procedimiento", MessageBoxButtons.YesNo);

            if (result == DialogResult.Yes)
            {
                DBManager c = new DBManager();
                try
                {
                    string comando = "DELETE FROM [procedure] WHERE idprocedure = '" + idprocedure_txt.Text + "'";
                    c.command(comando);
                    if (c.valor == "si")
                    {
                        Close();
                    }
                    else
                    {
                        MessageBox.Show("Algo fue mal");
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Error");
                }
                finally
                {
                }
            }
            else if (result == DialogResult.No)
            {
            }
        }
Ejemplo n.º 3
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            DBManager c = new DBManager();

            try
            {
                DialogResult result = MessageBox.Show("Seguro que desea pasar a ser un procedimientoRegular?", "Pasar a Procedimiento Regular", MessageBoxButtons.YesNo);
                if (result == DialogResult.Yes)
                {
                    string query = "UPDATE [procedure] set ptype = 'Regular'";
                    c.command(query);
                    if (c.valor == "si")
                    {
                        Close();
                    }
                    else
                    {
                        MessageBox.Show("Algo fallo!!!");
                    }
                }
                else if (result == DialogResult.No)
                {
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error");
            }
            finally
            {
            }
        }
Ejemplo n.º 4
0
        private void updateinsurance_btn_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("Seguro que desea Actualizar?", "Actualizar datos", MessageBoxButtons.YesNo);

            if (result == DialogResult.Yes)
            {
                string    query = "UPDATE insurances set nameinsurance = '" + pnameinsurance_txt.Text + "', telinsurance = '" + ptelinsurance_txt.Text + "', emailinsurance = '" + pmailinsurance_txt.Text + "', contractinsurance = '" + pcontractinsurance_txt.Text + "', pssinsurance = '" + ppssinsurance_txt.Text + "' WHERE idinsurance = '" + pidinsurance_txt.Text + "'";
                DBManager c     = new DBManager();
                c.command(query);
                Close();

                //SQLiteConnection cnx = new SQLiteConnection("Data Source=C:\\syspandemic\\db\\syspandemic.db;Version=3;");
                //cnx.Open();
                //DialogResult result = MessageBox.Show("Seguro que desea Actualizar?", "Actualizar datos", MessageBoxButtons.YesNo);
                //if (result == DialogResult.Yes)
                //{
                //    string comando = "UPDATE insurances set nameinsurance = '" + pnameinsurance_txt.Text + "', telinsurance = '" + ptelinsurance_txt.Text + "', emailinsurance = '" + pmailinsurance_txt.Text + "', contractinsurance = '" + pcontractinsurance_txt.Text + "', pssinsurance = '" + ppssinsurance_txt.Text + "' WHERE idinsurance = '" + pidinsurance_txt.Text + "'";
                //    SQLiteCommand insertion = new SQLiteCommand(comando, cnx);
                //    if (insertion.ExecuteNonQuery() > 0)
                //    {
                //        MessageBox.Show("Se ha actualizado!");
                //        Close();
                //    }
                //    else
                //    {
                //        MessageBox.Show("Algo fallo!!!");
                //    }
            }
        }
Ejemplo n.º 5
0
 private void vn_addnotes_txt_Click(object sender, EventArgs e)
 {
     if (vn_idnote_txt.Text == "")
     {
         string query = "insert into procedurenotes (idprocedure, note) values ('" + vn_idpro_txt.Text + "', '" + vn_note_txt.Text + "')";
         c.command(query);
         load();
         vn_note_txt.Clear();
     }
     else
     {
         string query = "update procedurenotes set note = '" + vn_note_txt.Text + "' where idnote = '" + vn_idnote_txt.Text + "'";
         c.command(query);
         load();
         vn_idnote_txt.Clear();
         vn_note_txt.Clear();
     }
 }
Ejemplo n.º 6
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (reasondesc_txt.Text.Length < 1)
     {
         MessageBox.Show("Debe de digitar la razon antes de guardar", "Error");
         reasondesc_txt.Focus();
     }
     else
     {
         if (allpay_rbtn.Checked)
         {
             if (doctorpay_txt.Text.Length > 1 && pdoctorpay_txt.Text.Length < 1)
             {
                 decimal doctordesc = Convert.ToDecimal(doctorpay_txt.Text) * -1;
                 string  querry     = "Insert into [payrolldoctors]([iddoctor], reason, qty, date) values ('" + iddoctors.Text + "', '" + reasondesc_txt.Text + "','" + doctordesc + "','" + datedesc_dtp.Text + "')";
                 c.command(querry);
             }
             else
             {
                 MessageBox.Show("Algo no va como debe, verifique que solo el campo de texto MONTO A PAGAR DOCTOR tenga numeros", "Error");
             }
         }
         else if (porcent_rbtn.Checked)
         {
             if (doctorpay_txt.Text.Length > 1 && pdoctorpay_txt.Text.Length > 1)
             {
                 decimal doctordesc  = Convert.ToDecimal(doctorpay_txt.Text) * -1;
                 decimal pdoctordesc = Convert.ToDecimal(pdoctorpay_txt.Text) * -1;
                 string  querry      = "Insert into [payrolldoctors]([iddoctor], reason, qty, date) values ('" + iddoctors.Text + "', '" + reasondesc_txt.Text + "','" + doctordesc + "','" + datedesc_dtp.Text + "')";
                 c.command3(querry);
                 querry = "Insert into [payrolldoctors]([iddoctor], reason, qty, date) values ('1', '" + reasondesc_txt.Text + "','" + pdoctordesc + "','" + datedesc_dtp.Text + "')";
                 c.command(querry);
             }
             else
             {
                 MessageBox.Show("Algo no va como debe, verifique que los campo de texto MONTO A PAGAR DOCTOR y MONTO A PAGAR PRIN DOCTOR tenga numeros", "Error");
             }
         }
     }
 }
Ejemplo n.º 7
0
        private void btnguardar_Click(object sender, EventArgs e)
        {
            string query0 = "Select * from datem where date = '" + dtpfecha.Text + "' and time = '" + dtphora.Text + "' and iddoctor = '" + txtiddo.Text + "'";

            c.validation(query0);
            if (c.valor == "si")
            {
                MessageBox.Show("NO se puede agregar, debido a que ya hay una cita a esa hora");
                c.valor = "";
            }
            else if (c.valor == "no")
            {
                string query = "INSERT INTO datem(idpatient,namepa,iddoctor,namedoctor,assist,date,time) values('" + txtidpa.Text + "','" + txtpaciente.Text + "','" + txtiddo.Text + "','" + txtdoct.Text + "','Pendiente','" + dtpfecha.Text + "','" + dtphora.Text + "')";
                c.command(query);
                txtidpa.Clear();
                txtpaciente.Clear();
                txtdoct.Clear();
                txtiddo.Clear();

                c.valor = "";
            }
        }
Ejemplo n.º 8
0
        private void updateprocedure_btn_Click(object sender, EventArgs e)
        {
            DBManager c = new DBManager();

            if (string.IsNullOrEmpty(gaindoctor_txt.Text) == false)
            {
                if (string.IsNullOrEmpty(piddoctor_txt.Text) == false)
                {
                    if (string.IsNullOrEmpty(tooth_txt.Text) == false)
                    {
                        if (string.IsNullOrEmpty(procedure_txt.Text) == false)
                        {
                            DialogResult result = MessageBox.Show("Seguro que desea Actualizar?", "Actualizar datos del Procedimiento", MessageBoxButtons.YesNo);
                            if (result == DialogResult.Yes)
                            {
                                string comando = "UPDATE [procedure] set iddoctor = '" + piddoctor_txt.Text + "', namedoctor = '" + pnamedoctor_txt.Text + "', [procedure] = '" + procedure_txt.Text + "', realprice = '" + realpay_txt.Text + "', iscoverage = '" + iscoverage_txt.Text + "', pricepay = '" + pricepay_txt.Text + "', tooth = '" + tooth_txt.Text + "' , dateprocedure = '" + dateprocedure_dtp.Text + "', gaindoctor = '" + gaindoctor_txt.Text + "' WHERE idprocedure = '" + idprocedure_txt.Text + "'";
                                c.command(comando);
                                if (c.valor == "si")
                                {
                                    Close();
                                    c.valor = "";
                                }
                                else
                                {
                                    MessageBox.Show("Algo fallo!!!");
                                }
                            }
                            else if (result == DialogResult.No)
                            {
                            }
                        }
                        else
                        {
                            MessageBox.Show("No ha escrito el titulo del procedimiento, favor revise.", "Falta informacion.");
                        }
                    }
                    else
                    {
                        MessageBox.Show("No ha asignado el diente de trabajo, favor revise.", "Falta informacion.");
                    }
                }
                else
                {
                    MessageBox.Show("No ha ingresado un Doctor, favor revise.", "Falta informacion.");
                }
            }
            else
            {
                MessageBox.Show("Debe de digitar la ganancia del doctor antes de guardar", "Error");
            }
        }
Ejemplo n.º 9
0
        private void savepwi_btn_Click(object sender, EventArgs e)
        {
            if (process_txt.Text.Length < 1)
            {
                MessageBox.Show("Debe de introducir la informacion requerida.", "Error");
            }
            else
            {
                string    idinsurance = "0";
                string    insurance   = "NO SEGURO";
                string    query       = "INSERT INTO detailsinsurance(pinsurance, tariff, coverage, difference,  idinsurance) VALUES('" + process_txt.Text + "', '" + priceprocess_txt.Text + "', '00', '" + priceprocess_txt.Text + "', '1004');";
                DBManager c           = new DBManager();
                c.command(query);
                process_txt.Clear();
                priceprocess_txt.Clear();
                process_txt.Focus();
            }

            //if (process_txt.Text.Length < 1)
            //{
            //    MessageBox.Show("Debe de introducir la informacion requerida.", "Error");
            //}
            //else
            //{
            //    SQLiteConnection cnx = new SQLiteConnection("Data Source=C:\\syspandemic\\db\\syspandemic.db;Version=3;");
            //    try
            //    {
            //        cnx.Open();
            //        string idinsurance = "0";
            //        string insurance = "NO SEGURO";
            //        string comando = "INSERT INTO detailsinsurance(pinsurance, tariff, coverage, difference,  idinsurance, insurance) VALUES('" + process_txt.Text + "', '" + priceprocess_txt.Text + "', '00', '"+ priceprocess_txt.Text +"', '" + idinsurance + "', '" + insurance + "');";
            //        SQLiteCommand insertion = new SQLiteCommand(comando, cnx);

            //        if (insertion.ExecuteNonQuery() > 0)
            //        {
            //            MessageBox.Show("Se agrego correctamente");
            //            process_txt.Clear();
            //            priceprocess_txt.Clear();
            //            process_txt.Focus();
            //            cnx.Close();
            //        }
            //    }
            //    catch (Exception ex)
            //    {
            //        MessageBox.Show(ex.Message, "Error");
            //    }
            //}
        }
Ejemplo n.º 10
0
        private void deletepwi_btn_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("Seguro que desea eliminar este proceso?", "Eliminar proceso", MessageBoxButtons.YesNo);

            if (result == DialogResult.Yes)
            {
                string    query = "DELETE FROM detailsinsurance WHERE id = '" + idprocess_txt.Text + "'";
                DBManager c     = new DBManager();
                c.command(query);
                Close();
            }
            else if (result == DialogResult.No)
            {
            }



            //DialogResult result = MessageBox.Show("Seguro que desea eliminar este proceso?", "Eliminar proceso", MessageBoxButtons.YesNo);

            //if (result == DialogResult.Yes)
            //{
            //    SQLiteConnection cnx = new SQLiteConnection("Data Source=C:\\syspandemic\\db\\syspandemic.db;Version=3;");
            //    try
            //    {
            //        cnx.Open();
            //        string comando = "DELETE FROM detailsinsurance WHERE id = '" + idprocess_txt.Text + "'";
            //        SQLiteCommand insertion = new SQLiteCommand(comando, cnx);
            //        if (insertion.ExecuteNonQuery() > 0)
            //        {
            //            MessageBox.Show("Se ha eliminado!");
            //            Close();
            //        }
            //        else
            //        {
            //            MessageBox.Show("Algo fue mal");
            //        }
            //    }
            //    catch (Exception ex)
            //    {
            //        MessageBox.Show(ex.Message, "Error");
            //    }

            //}
            //else if (result == DialogResult.No)
            //{
            //}
        }
Ejemplo n.º 11
0
        private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            DBManager       c         = new DBManager();
            DataGridViewRow act       = dataGridView1.Rows[e.RowIndex];
            string          id        = act.Cells["ID"].Value.ToString();
            string          procedure = act.Cells["SubProceso"].Value.ToString();
            string          diente    = act.Cells["Diente"].Value.ToString();

            DialogResult result = MessageBox.Show("Desea convertir el procedimiento '" + procedure + "' en el diente '" + diente + "' como realizado?", "Sub Proceso realizado", MessageBoxButtons.YesNo);

            if (result == DialogResult.Yes)
            {
                string query = "update subprocedure set status = 'Realizado' where id = '" + id + "' ";
                c.command(query);
                cargarDGV();
            }
        }
Ejemplo n.º 12
0
 private void ep_delete_btn_Click(object sender, EventArgs e)
 {
     try
     {
         DialogResult result = MessageBox.Show("Seguro que desea Borrar?", "Borrar Sub-Procedimiento", MessageBoxButtons.YesNo);
         if (result == DialogResult.Yes)
         {
             string query = "DELETE FROM subprocedure WHERE id = '" + ep_id_txt.Text + "'";
             c.command(query);
             this.Close();
         }
         else if (result == DialogResult.No)
         {
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error");
     }
 }
Ejemplo n.º 13
0
        private void addsubpro_btn_Click(object sender, EventArgs e)
        {
            DBManager c = new DBManager();

            c.valor = "";
            string status = "Sin Realizar";
            string query  = "select idprocedure, subprocedure, tooth from subprocedure where idprocedure = '" + vsp_idprocedure_txt.Text + "' and subprocedure = '" + vsp_activity_txt.Text + "' and tooth = '" + vsp_tooth_txt.Text + "'";

            c.validation(query);
            if (c.valor == "si")
            {
                MessageBox.Show("No puede agregar el mismo sub-procedimiento al mismo diente dos veces.", "Error al agregar");
                c.valor = "";
            }
            else
            {
                string query2 = "INSERT INTO subprocedure(idprocedure, codeinsurance, subprocedure, tariff, coverage, difference, status, insurance, tooth) VALUES('" + vsp_idprocedure_txt.Text + "', '" + vsp_codeinsu_txt.Text + "','" + vsp_activity_txt.Text + "','" + vsp_tariff_txt.Text + "', '" + vsp_coverage_txt.Text + "', '" + vsp_difference_txt.Text + "', '" + status + "', '" + vsp_insurance_txt.Text + "', '" + vsp_tooth_txt.Text + "')";
                c.command(query2);
            }
        }
Ejemplo n.º 14
0
        private void deleteinsurance_txt_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("Seguro que desea Borrar?", "Borrar datos", MessageBoxButtons.YesNo);

            if (result == DialogResult.Yes)
            {
                string    query = "DELETE FROM insurances WHERE idinsurance = '" + pidinsurance_txt.Text + "'";
                DBManager c     = new DBManager();
                c.command(query);
                Close();
            }



            //DialogResult result = MessageBox.Show("Seguro que desea Borrar?", "Borrar datos", MessageBoxButtons.YesNo);
            //if (result == DialogResult.Yes)
            //{
            //    try
            //    {
            //        SQLiteConnection cnx = new SQLiteConnection("Data Source=C:\\syspandemic\\db\\syspandemic.db;Version=3;");
            //        cnx.Open();
            //        string comando = "DELETE FROM insurances WHERE idinsurance = '" + pidinsurance_txt.Text + "'";
            //        SQLiteCommand insertion = new SQLiteCommand(comando, cnx);
            //        if (insertion.ExecuteNonQuery() > 0)
            //        {
            //            MessageBox.Show("Se ha actualizado!");
            //            Close();
            //        }
            //    }

            //    catch (Exception ex)
            //    {
            //        MessageBox.Show(ex.Message, "Error");
            //    }
            //}
            //else
            //{

            //}
        }
Ejemplo n.º 15
0
        private void updatepwi_btn_Click(object sender, EventArgs e)
        {
            string    query = "UPDATE detailsinsurance set pinsurance = '" + process_txt.Text + "', tariff = '" + priceprocess_txt.Text + "' where id= '" + idprocess_txt.Text + "'";
            DBManager c     = new DBManager();

            c.command(query);
            seepwi frm = new seepwi();

            frm.loaddgv();
            Close();

            //try
            //{
            //    SQLiteConnection cnx = new SQLiteConnection("Data Source=C:\\syspandemic\\db\\syspandemic.db;Version=3;");
            //    cnx.Open();
            //    string comando = "UPDATE detailsinsurance set pinsurance = '" + process_txt.Text + "', tariff = '" + priceprocess_txt.Text + "' where id= '" +idprocess_txt.Text+"'";
            //    SQLiteCommand insertion = new SQLiteCommand(comando, cnx);
            //    if (insertion.ExecuteNonQuery() > 0)
            //    {
            //        cnx.Close();
            //        seepwi frm = new seepwi();
            //        frm.loaddgv();
            //        MessageBox.Show("Se ha actualizado!");
            //        Close();

            //    }
            //    else
            //    {
            //        MessageBox.Show("No se consiguio");
            //    }
            //}
            //catch (Exception ex)
            //{
            //    MessageBox.Show(ex.Message, "Error");
            //}
        }
Ejemplo n.º 16
0
        private void saveprocedure_btn_Click(object sender, EventArgs e)
        {
            DBManager c = new DBManager();

            if (string.IsNullOrEmpty(gaindoctor_txt.Text) == false)
            {
                if (string.IsNullOrEmpty(pidpatient_txt.Text) == false)
                {
                    if (string.IsNullOrEmpty(piddoctor_txt.Text) == false)
                    {
                        if (string.IsNullOrEmpty(tooth_txt.Text) == false)
                        {
                            if (string.IsNullOrEmpty(procedure_txt.Text) == false)
                            {
                                if (string.IsNullOrEmpty(pricepay_txt.Text) == false)
                                {
                                    try
                                    {
                                        DialogResult result = MessageBox.Show("Seguro que desea Guardar?", "Guardar datos del Procedimiento", MessageBoxButtons.YesNo);
                                        if (result == DialogResult.Yes)
                                        {
                                            string query = "UPDATE [procedure] set idpatient = '" + pidpatient_txt.Text + "', namepatient = '" + pnamepatient_txt.Text + "', iddoctor = '" + piddoctor_txt.Text + "', namedoctor = '" + pnamedoctor_txt.Text + "', [procedure] = '" + procedure_txt.Text + "', realprice = '" + realpay_txt.Text + "', iscoverage = '" + iscoverage_txt.Text + "', pricepay = '" + pricepay_txt.Text + "', dateprocedure = '" + dateprocedure_dtp.Text + "', tooth = '" + tooth_txt.Text + "', gaindoctor = '" + gaindoctor_txt.Text + "' WHERE idprocedure = '" + idprocedure_txt.Text + "'";
                                            c.command(query);
                                            if (c.valor == "si")
                                            {
                                                Close();
                                            }
                                            else
                                            {
                                                MessageBox.Show("Algo fallo!!!");
                                            }
                                        }
                                        else if (result == DialogResult.No)
                                        {
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                        MessageBox.Show(ex.Message, "Error");
                                    }
                                    finally
                                    {
                                    }
                                }
                                else
                                {
                                    MessageBox.Show("Al parecer no ha asignado Sub-Procesos a este procedimiento, favor revise.", "Falta informacion.");
                                }
                            }
                            else
                            {
                                MessageBox.Show("No ha escrito el titulo del procedimiento, favor revise.", "Falta informacion.");
                            }
                        }
                        else
                        {
                            MessageBox.Show("No ha asignado el diente de trabajo, favor revise.", "Falta informacion.");
                        }
                    }
                    else
                    {
                        MessageBox.Show("No ha ingresado un Doctor, favor revise.", "Falta informacion.");
                    }
                }
                else
                {
                    MessageBox.Show("No ha ingresado un Paciente, favor revise.", "Falta informacion.");
                }
            }
            else
            {
                MessageBox.Show("Debe de digitar la ganancia del doctor");
            }
        }
Ejemplo n.º 17
0
        private void adddetail_Click(object sender, EventArgs e)
        {
            string query;

            if (procedure_txt.Text.Length == 0)
            {
                MessageBox.Show("Debe de introducir la informacion requerida.", "Error");
            }
            else
            {
                if (id_txt.Text == "")
                {
                    query = "INSERT INTO detailsinsurance(Code, pinsurance, tariff, coverage, difference, idinsurance, insurance) VALUES('" + code_txt.Text + "', '" + procedure_txt.Text + "','" + tariff_txt.Text + "', '" + coverage_txt.Text + "', '" + difference_txt.Text + "', '" + pidinsurance_txt.Text + "', '" + pnameinsurance_txt.Text + "')";
                    DBManager c = new DBManager();
                    c.command(query);
                    code_txt.Clear();
                    procedure_txt.Clear();
                    tariff_txt.Clear();
                    coverage_txt.Clear();
                    difference_txt.Clear();
                    loadDGV();
                }
                else
                {
                    DialogResult result = MessageBox.Show("Seguro que desea Actualizar?", "Actualizar datos", MessageBoxButtons.YesNo);
                    if (result == DialogResult.Yes)
                    {
                        query = "UPDATE detailsinsurance set code = '" + code_txt.Text + "', pinsurance = '" + procedure_txt.Text + "', tariff = '" + tariff_txt.Text + "', coverage = '" + coverage_txt.Text + "', difference = '" + difference_txt.Text + "' WHERE id = '" + id_txt.Text + "'";
                        DBManager c = new DBManager();
                        c.command(query);
                        id_txt.Clear();
                        code_txt.Clear();
                        procedure_txt.Clear();
                        tariff_txt.Clear();
                        coverage_txt.Clear();
                        difference_txt.Clear();
                        loadDGV();
                    }
                    else
                    {
                        MessageBox.Show("Algo fallo!!!");
                    }
                }
            }



            //if (procedure_txt.Text.Length == 0)
            //{
            //    MessageBox.Show("Debe de introducir la informacion requerida.", "Error");
            //}
            //else {
            //    SQLiteConnection cnx = new SQLiteConnection("Data Source=C:\\syspandemic\\db\\syspandemic.db;Version=3;");
            //try
            //{
            //    if (id_txt.Text == "")
            //    {
            //        cnx.Open();
            //        string comando = "INSERT INTO detailsinsurance(Code, pinsurance, tariff, coverage, difference, idinsurance, insurance) VALUES('" + code_txt.Text + "', '" + procedure_txt.Text + "','" + tariff_txt.Text + "', '" + coverage_txt.Text + "', '" + difference_txt.Text + "', '" + pidinsurance_txt.Text + "', '" + pnameinsurance_txt.Text + "');";
            //        SQLiteCommand insertion = new SQLiteCommand(comando, cnx);

            //        if (insertion.ExecuteNonQuery() > 0)
            //        {
            //            MessageBox.Show("Se agrego correctamente");
            //            code_txt.Clear();
            //            procedure_txt.Clear();
            //            tariff_txt.Clear();
            //            coverage_txt.Clear();
            //            difference_txt.Clear();
            //            loadDGV();

            //        }
            //    }
            //    else
            //    {
            //        cnx.Open();
            //        DialogResult result = MessageBox.Show("Seguro que desea Actualizar?", "Actualizar datos", MessageBoxButtons.YesNo);
            //        if (result == DialogResult.Yes)
            //        {
            //            string comando = "UPDATE detailsinsurance set code = '" + code_txt.Text + "', pinsurance = '" + procedure_txt.Text + "', tariff = '" + tariff_txt.Text + "', coverage = '" + coverage_txt.Text + "', difference = '" + difference_txt.Text + "' WHERE id = '" + id_txt.Text + "'";
            //            SQLiteCommand insertion = new SQLiteCommand(comando, cnx);
            //            if (insertion.ExecuteNonQuery() > 0)
            //            {
            //                MessageBox.Show("Se ha actualizado!");
            //                id_txt.Clear();
            //                code_txt.Clear();
            //                procedure_txt.Clear();
            //                tariff_txt.Clear();
            //                coverage_txt.Clear();
            //                difference_txt.Clear();
            //                loadDGV();
            //            }
            //            else
            //            {
            //                MessageBox.Show("Algo fallo!!!");
            //            }
            //        }
            //    }
            //}
            //catch (Exception ex)
            //{
            //    MessageBox.Show(ex.Message, "Error");

            //}

            //}
        }
Ejemplo n.º 18
0
        private void deletedetail_btn_Click(object sender, EventArgs e)
        {
            try
            {
                if (id_txt.Text == "")
                {
                    MessageBox.Show("No puede borrar este registro; no ha seleccionado uno de los del visor para esto.", "Error");
                }
                else
                {
                    string    query = "DELETE FROM detailsinsurance WHERE id = '" + id_txt.Text + "'";
                    DBManager c     = new DBManager();
                    c.command(query);
                    id_txt.Clear();
                    code_txt.Clear();
                    procedure_txt.Clear();
                    tariff_txt.Clear();
                    coverage_txt.Clear();
                    difference_txt.Clear();
                    loadDGV();
                }



                //try
                //{
                //    if (id_txt.Text == "")
                //    {
                //        MessageBox.Show("No puede borrar este registro; no ha seleccionado uno de los del visor para esto.", "Error");
                //    }
                //    else{
                //        try
                //        {
                //            SQLiteConnection cnx = new SQLiteConnection("Data Source=C:\\syspandemic\\db\\syspandemic.db;Version=3;");
                //            cnx.Open();
                //            string comando = "DELETE FROM detailsinsurance WHERE id = '" + id_txt.Text + "'";
                //            SQLiteCommand insertion = new SQLiteCommand(comando, cnx);
                //            if (insertion.ExecuteNonQuery() > 0)
                //            {
                //                MessageBox.Show("Se ha Borrado!");
                //                id_txt.Clear();
                //                code_txt.Clear();
                //                procedure_txt.Clear();
                //                tariff_txt.Clear();
                //                coverage_txt.Clear();
                //                difference_txt.Clear();
                //                loadDGV();
                //            }
                //            else
                //            {
                //                MessageBox.Show("Algo fallo!!!");
                //            }
                //        }
                //        catch (Exception ex)
                //        {
                //            MessageBox.Show(ex.Message, "Errror");
                //        }
                //    }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error");
            }
        }
Ejemplo n.º 19
0
        private void addpay_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(typepay.Text))
            {
                MessageBox.Show("Debe de elegir un metodo de pago.", "Error");
            }
            else
            {
                if (string.IsNullOrEmpty(qtypay.Text))
                {
                    MessageBox.Show("Debe de elegir una cantidad de pago.", "Error");
                }
                else
                {
                    DBManager c     = new DBManager();
                    string    query = "INSERT INTO [transaction](ref, madebytran, reasontran, datetran, origin, entry, expenses) values('" + idsubprocedure_txt.Text + "', '" + spnamepatient_txt.Text + "', '" + sprocedure_txt.Text + "', '" + datepay.Text + "', '" + typepay.Text + "', '" + qtypay.Text + "', '0')";
                    decimal   ppay  = Convert.ToDecimal(sppricepay_txt.Text);

                    decimal qty = Convert.ToDecimal(qtypay.Text);

                    if (string.IsNullOrEmpty(nowpay_txt.Text))
                    {
                        if (ppay >= qty)
                        {
                            c.command(query);

                            //insertar en la tabla de pago a los doctores;

                            if (Convert.ToInt32(iddoctor_txt.Text) == 1)
                            {
                                string querry2 = "Insert into [payrolldoctors](iddoctor, idpatient, namepatient, idprocedure, reason, qty, date) values ('" + iddoctor_txt.Text + "', '" + sidpatient.Text + "', '" + spnamepatient_txt.Text + "', '" + idsubprocedure_txt.Text + "', '" + sprocedure_txt.Text + "', '" + qtypay.Text + "', '" + datepay.Text + "')";
                                c.command3(querry2);
                            }
                            else
                            {
                                decimal gaindoctor     = Convert.ToDecimal(gaindoctor_txt.Text) / 100;
                                decimal gainfulldoctor = 1 - gaindoctor;
                                decimal paygaindoctor  = Convert.ToDecimal(qtypay.Text) * gaindoctor;
                                decimal payfulldoctor  = Convert.ToDecimal(qtypay.Text) * gainfulldoctor;

                                string querry2 = "Insert into [payrolldoctors](iddoctor, idpatient, namepatient, idprocedure, reason, qty, date) values ('" + iddoctor_txt.Text + "', '" + sidpatient.Text + "', '" + spnamepatient_txt.Text + "',  '" + idsubprocedure_txt.Text + "', '" + sprocedure_txt.Text + "', '" + paygaindoctor + "', '" + datepay.Text + "')";
                                c.command3(querry2);

                                string querry3 = "Insert into [payrolldoctors](iddoctor, idpatient, namepatient, idprocedure, reason, qty, date) values ('1', '" + sidpatient.Text + "', '" + spnamepatient_txt.Text + "', '" + idsubprocedure_txt.Text + "', '" + sprocedure_txt.Text + "', '" + payfulldoctor + "', '" + datepay.Text + "')";
                                c.command3(querry3);
                            }



                            //Insertar en la tabla del historico del paciente
                            string hquery = "insert into patienthistory(idpatient, tooth, activity, qtypay, date) values('" + sidpatient.Text + "', '" + stooth_txt.Text + "', '" + sactivity_txt.Text + "', '" + qtypay.Text + "', '" + datepay.Text + "')";
                            c.command3(hquery);

                            loadbill();
                            string query2 = "Select top 1 * from [transaction] order by idtransactions desc";

                            string tablename = "entrybill";
                            string xml       = "entrybill.xml";
                            string report    = "entrybill.rpt";
                            c.printreport(query2, tablename, xml, report);

                            sactivity_txt.Clear();
                            qtypay.Clear();
                            typepay.Text = "";
                        }
                        else
                        {
                            MessageBox.Show("El monto ha abonar mas lo ya abonado sobrepasa el precio del procedimiento, favor verifique y reintente");
                        }
                    }
                    else
                    {
                        decimal nowpay = Convert.ToDecimal(nowpay_txt.Text);
                        if (ppay > nowpay)
                        {
                            if (ppay >= (nowpay + qty))
                            {
                                c.command(query);

                                //insertar en la tabla de pago a los doctores;

                                if (Convert.ToInt32(iddoctor_txt.Text) == 1)
                                {
                                    string querry2 = "Insert into [payrolldoctors](iddoctor, idpatient, namepatient, idprocedure, reason, qty, date) values ('" + iddoctor_txt.Text + "', '" + sidpatient.Text + "', '" + spnamepatient_txt.Text + "', '" + idsubprocedure_txt.Text + "', '" + sprocedure_txt.Text + "', '" + qtypay.Text + "', '" + datepay.Text + "')";
                                    c.command3(querry2);
                                }
                                else
                                {
                                    decimal gaindoctor     = Convert.ToDecimal(gaindoctor_txt.Text) / 100;
                                    decimal gainfulldoctor = 1 - gaindoctor;
                                    decimal paygaindoctor  = Convert.ToDecimal(qtypay.Text) * gaindoctor;
                                    decimal payfulldoctor  = Convert.ToDecimal(qtypay.Text) * gainfulldoctor;

                                    string querry2 = "Insert into [payrolldoctors](iddoctor, idpatient, namepatient, idprocedure, reason, qty, date) values ('" + iddoctor_txt.Text + "', '" + sidpatient.Text + "', '" + spnamepatient_txt.Text + "', '" + idsubprocedure_txt.Text + "', '" + sprocedure_txt.Text + "', '" + paygaindoctor + "', '" + datepay.Text + "')";
                                    c.command3(querry2);

                                    string querry3 = "Insert into [payrolldoctors](iddoctor, idpatient, namepatient, idprocedure, reason, qty, date) values ('1', '" + sidpatient.Text + "', '" + spnamepatient_txt.Text + "', '" + idsubprocedure_txt.Text + "', '" + sprocedure_txt.Text + "', '" + payfulldoctor + "', '" + datepay.Text + "')";
                                    c.command3(querry3);
                                }


                                loadbill();

                                //Insertar en la tabla del historico del paciente
                                string hquery = "insert into patienthistory(idpatient, tooth, activity, qtypay, date) values('" + sidpatient.Text + "', '" + stooth_txt.Text + "', '" + sactivity_txt.Text + "', '" + qtypay.Text + "', '" + datepay.Text + "')";
                                c.command3(hquery);

                                string query3 = "Select top 1 * from [transaction] order by idtransactions desc";

                                string tablename = "entrybill";
                                string xml       = "entrybill.xml";
                                string report    = "entrybill.rpt";
                                c.printreport(query3, tablename, xml, report);

                                sactivity_txt.Clear();
                                qtypay.Clear();
                                typepay.Text = "";
                            }
                            else
                            {
                                MessageBox.Show("El monto ha abonar mas lo ya abonado sobrepasa el precio del procedimiento, favor verifique y reintente");
                            }
                        }
                        else
                        {
                            MessageBox.Show("NO puede abonar, debido a que el procedimiento ya esta pagado.");
                        }
                    }
                }
            }
        }