Ejemplo n.º 1
0
 public void printreport(string query, string tablename, string xml, string reportrpt)
 {
     try
     {
         SqlCommand cmd = cnx.CreateCommand();
         cmd.CommandText = query;
         SqlDataAdapter ad = new SqlDataAdapter(cmd);
         DataSet        ds = new DataSet();
         DataTable      dt = new DataTable();
         ad.Fill(dt);
         ds.Tables.Add(dt);
         if (dt.Rows.Count <= 0)
         {
             MessageBox.Show("No hay datos que imprimir.");
         }
         else
         {
             ds.Tables[0].TableName = tablename;
             ds.WriteXml(@"C:\SysPandemic server\xml\" + xml + "");
             //MessageBox.Show("Done");
             reportview rv = new reportview(reportrpt);
             rv.Show();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error");
     }
 }
Ejemplo n.º 2
0
        private void seebill_btn_Click(object sender, EventArgs e)
        {
            SQLiteConnection cnx = new SQLiteConnection("Data Source=C:\\syspandemic\\db\\syspandemic.db;Version=3;");

            try
            {
                cnx.Open();
                SQLiteDataAdapter ad;
                DataTable         dt  = new DataTable();
                SQLiteCommand     cmd = cnx.CreateCommand();
                cmd.CommandText = "Select * from emerpat where idep = '" + idpaemer_txt.Text + "'";
                ad = new SQLiteDataAdapter(cmd);
                DataSet ds = new DataSet();
                ad.Fill(dt);
                ds.Tables.Add(dt);
                ds.Tables[0].TableName = "FacturaAmbulante";
                ds.WriteXml(@"C:\SysPandemic\xml\apatientebill.xml");
                //MessageBox.Show("Done");
                reportview rv = new reportview("billep.rpt");
                rv.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error");
            }
        }
Ejemplo n.º 3
0
        private void printpurchase_btn_Click(object sender, EventArgs e)
        {
            SQLiteConnection cnx = new SQLiteConnection("Data Source=C:\\syspandemic\\db\\syspandemic.db;Version=3;");

            try
            {
                cnx.Open();
                SQLiteDataAdapter ad;
                SQLiteDataAdapter ad2;
                DataTable         dt   = new DataTable();
                DataTable         dt2  = new DataTable();
                SQLiteCommand     cmd  = cnx.CreateCommand();
                SQLiteCommand     cmd2 = cnx.CreateCommand();
                cmd.CommandText  = "Select * from procedure where idprocedure = '" + idsubprocedure_txt.Text + "'";
                cmd2.CommandText = "Select * from patient where name = '" + spnamepatient_txt.Text + "'";
                ad = new SQLiteDataAdapter(cmd);
                DataSet ds = new DataSet();
                ad.Fill(dt);
                ds.Tables.Add(dt);
                ds.Tables[0].TableName = "Procedimiento";
                ds.WriteXml(@"C:\SysPandemic\xml\procedure.xml");
                ad2 = new SQLiteDataAdapter(cmd2);
                DataSet ds2 = new DataSet();
                ad2.Fill(dt2);
                ds2.Tables.Add(dt2);
                ds2.Tables[0].TableName = "infopaciente";
                ds2.WriteXml(@"C:\SysPandemic\xml\infopatient.xml");

                SQLiteDataAdapter ad3;
                DataTable         dt3  = new DataTable();
                SQLiteCommand     cmd3 = cnx.CreateCommand();
                cmd3.CommandText = "Select * from bills where idprocedure = '" + idsubprocedure_txt.Text + "'";
                ad3 = new SQLiteDataAdapter(cmd3);
                DataSet ds3 = new DataSet();
                ad3.Fill(dt3);
                ds3.Tables.Add(dt3);
                ds3.Tables[0].TableName = "date";
                ds3.WriteXml(@"C:\SysPandemic\xml\datebill.xml");


                reportview rv = new reportview("bill.rpt");
                rv.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error");
            }
        }
Ejemplo n.º 4
0
        private void billpa_btn_Click(object sender, EventArgs e)
        {
            SQLiteConnection cnx = new SQLiteConnection("Data Source=C:\\syspandemic\\db\\syspandemic.db;Version=3;");

            try
            {
                cnx.Open();
                DialogResult result = MessageBox.Show("Seguro que desea Facturar?", "Facturar procedimiento", MessageBoxButtons.YesNo);
                if (result == DialogResult.Yes)
                {
                    string        am        = "Ambulante";
                    string        com       = "INSERT INTO bills(idprocedure, procedure, namep, named, realprice, iscoverage, totalpay, datebill) VALUES('" + am + "', '" + txtprocedure.Text + "', '" + txtname.Text + "','" + am + "','" + txtprecio.Text + "', '" + txtcober.Text + "', '" + txtpreap.Text + "', '" + datetoday.Text + "');";
                    SQLiteCommand insertion = new SQLiteCommand(com, cnx);

                    String        status     = "PAGADO";
                    string        comando    = "UPDATE emerpat set statuspay = '" + status + "' WHERE idep = '" + idpaemer_txt.Text + "'";
                    SQLiteCommand insertion2 = new SQLiteCommand(comando, cnx);

                    if (insertion2.ExecuteNonQuery() > 0 && insertion.ExecuteNonQuery() > 0)
                    {
                    }

                    SQLiteDataAdapter ad;
                    DataTable         dt  = new DataTable();
                    SQLiteCommand     cmd = cnx.CreateCommand();
                    cmd.CommandText = "Select * from emerpat where idep = '" + idpaemer_txt.Text + "'";
                    ad = new SQLiteDataAdapter(cmd);
                    DataSet ds = new DataSet();
                    ad.Fill(dt);
                    ds.Tables.Add(dt);
                    ds.Tables[0].TableName = "FacturaAmbulante";
                    ds.WriteXml(@"C:\SysPandemic\xml\apatientebill.xml");
                    //MessageBox.Show("Done");
                    reportview rv = new reportview("billep.rpt");
                    rv.Show();
                }
                else if (result == DialogResult.No)
                {
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error");
            }
        }
Ejemplo n.º 5
0
        private void printpre_Click(object sender, EventArgs e)
        {
            dataGridView2.Rows.Add(patientpre.Text, bdaypre.Text, today.Text);


            DataTable dT = GetDataTableFromDGV(dataGridView1);
            DataSet   dS = new DataSet();

            dS.Tables.Add(dT);
            dS.Tables[0].TableName = "prescription";
            dS.WriteXml(@"C:\SysPandemic server\xml\prescription.xml");

            //DataTable dT2 = GetDataTableFromDGV(dataGridView2);
            //DataSet dS2 = new DataSet();
            //dS2.Tables.Add(dT2);
            //dS2.Tables[0].TableName = "prescriptioninfo";
            //dS2.WriteXml(@"C:\SysPandemic server\xml\prescriptioninfo.xml");
            string     rpt = "prescriptionr.rpt";
            reportview rv  = new reportview(rpt);

            rv.Show();
        }
Ejemplo n.º 6
0
        private void seecxc_rbtn_Click(object sender, EventArgs e)
        {
            SQLiteConnection cnx = new SQLiteConnection("Data Source=C:\\syspandemic\\db\\syspandemic.db;Version=3;");

            try
            {
                cnx.Open();
                if (cxc_rbtn.Checked == true)
                {
                    if (allcxc_rbtn.Checked == true)
                    {
                        string            comando = "Select * FROM procedure WHERE statuspay like 'NO PAGADO'";
                        SQLiteDataAdapter adac    = new SQLiteDataAdapter(comando, cnx);
                        DataTable         tabla   = new DataTable("CxC-CP");
                        DataSet           ds      = new DataSet();
                        adac.Fill(tabla);
                        ds.Tables.Add(tabla);
                        if (tabla.Rows.Count <= 0)
                        {
                            MessageBox.Show("No hay datos que imprimir.");
                        }
                        else
                        {
                            ds.Tables[0].TableName = "cxc-cp";
                            ds.WriteXml(@"C:\SysPandemic\xml\cxc-cp.xml");
                            //MessageBox.Show("Done");
                            reportview rv = new reportview("cxcpreport.rpt");
                            rv.Show();
                        }
                    }
                    else if (rankdate_rbtn.Checked == true)
                    {
                        string            comando = "Select * FROM procedure WHERE statuspay like 'NO PAGADO' and dateprocedure between '" + startrank_dtp.Text + "' and '" + endrank_dtp.Text + "' ";
                        SQLiteDataAdapter adac    = new SQLiteDataAdapter(comando, cnx);
                        DataTable         tabla   = new DataTable("CxC-CP");
                        DataSet           ds      = new DataSet();
                        adac.Fill(tabla);
                        ds.Tables.Add(tabla);
                        if (tabla.Rows.Count <= 0)
                        {
                            MessageBox.Show("No hay datos que imprimir.");
                        }
                        else
                        {
                            ds.Tables[0].TableName = "cxc-cp";
                            ds.WriteXml(@"C:\SysPandemic\xml\cxc-cp.xml");
                            //MessageBox.Show("Done");
                            reportview rv = new reportview("cxcpreport.rpt");
                            rv.Show();
                        }
                    }
                    else
                    {
                        MessageBox.Show("Olvido seleccionar un rango.");
                    }
                }
                else if (cp_rbtn.Checked == true)
                {
                    if (allcxc_rbtn.Checked == true)
                    {
                        string            comando = "Select * FROM procedure WHERE statuspay like 'PAGADO'";
                        SQLiteDataAdapter adac    = new SQLiteDataAdapter(comando, cnx);
                        DataTable         tabla   = new DataTable("CxC-CP");
                        DataSet           ds      = new DataSet();
                        adac.Fill(tabla);
                        ds.Tables.Add(tabla);
                        if (tabla.Rows.Count <= 0)
                        {
                            MessageBox.Show("No hay datos que imprimir.");
                        }
                        else
                        {
                            ds.Tables[0].TableName = "cxc-cp";
                            ds.WriteXml(@"C:\SysPandemic\xml\cxc-cp.xml");
                            //MessageBox.Show("Done");
                            reportview rv = new reportview("cxcpreport.rpt");
                            rv.Show();
                        }
                    }
                    else if (rankdate_rbtn.Checked == true)
                    {
                        string            comando = "Select * FROM procedure WHERE statuspay like 'PAGADO' and dateprocedure between '" + startrank_dtp.Text + "' and '" + endrank_dtp.Text + "' ";
                        SQLiteDataAdapter adac    = new SQLiteDataAdapter(comando, cnx);
                        DataTable         tabla   = new DataTable("CxC-CP");
                        DataSet           ds      = new DataSet();
                        adac.Fill(tabla);
                        ds.Tables.Add(tabla);
                        if (tabla.Rows.Count <= 0)
                        {
                            MessageBox.Show("No hay datos que imprimir.");
                        }
                        else
                        {
                            ds.Tables[0].TableName = "cxc-cp";
                            ds.WriteXml(@"C:\SysPandemic\xml\cxc-cp.xml");
                            //MessageBox.Show("Done");
                            reportview rv = new reportview("cxcpreport.rpt");
                            rv.Show();
                        }
                    }
                    else
                    {
                        MessageBox.Show("Olvido seleccionar un rango.");
                    }
                }
                else
                {
                    MessageBox.Show("Olvido seleccionar una condicion.");
                }
            }

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