示例#1
0
        private void printprocedure_btn_Click(object sender, EventArgs e)
        {
            try
            {
                DBManager c     = new DBManager();
                string    query = "select * from [procedure] where idprocedure = '" + idprocedure_txt.Text + "'";
                string    tb    = "Procedure";
                string    xml   = "procedure.xml";
                string    rpt   = "reportprocedure.rpt";
                c.test_printreport(query, tb, xml, rpt);

                string query3 = "select insurance, affiliate from patient where idpatient = '" + pidpatient_txt.Text + "'";
                string tb3    = "insuranceafi";
                string xml3   = "insuranceafi.xml";
                string rpt3   = "reportprocedure.rpt";
                c.test_printreport(query3, tb3, xml3, rpt3);

                string query2 = "select * from [subprocedure] where idprocedure = '" + idprocedure_txt.Text + "'";
                string tb2    = "SubProcedure";
                string xml2   = "subprocedure.xml";
                string rpt2   = "reportprocedure.rpt";
                c.printreport(query2, tb2, xml2, rpt2);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Errror al cargar el reporte, Causa: " + ex, "Error");
            }
        }
示例#2
0
        private void button1_Click(object sender, EventArgs e)
        {
            DBManager c   = new DBManager();
            string    dt  = "closing";
            string    xml = "closing.xml";
            string    rpt = "rclosing.rpt";

            if (transall.Checked == true)
            {
                if (rankall.Checked == true)
                {
                    if (paytype.Text == "Todos")
                    {
                        string query = "select idtransactions, ref, madebytran, reasontran, datetran, origin, entry, expenses from [transaction]";
                        c.printreport(query, dt, xml, rpt);
                    }
                    else if (paytype.Text != "Todos")
                    {
                        string query = "select idtransactions, ref, madebytran, reasontran, datetran, origin, entry, expenses from [transaction] where origin = '" + paytype.Text + "'";
                        c.printreport(query, dt, xml, rpt);
                    }
                }
                else if (rankdate.Checked == true)
                {
                    if (paytype.Text == "Todos")
                    {
                        string query = "select idtransactions, ref, madebytran, reasontran, datetran, origin, entry, expenses from [transaction] where datetran between '" + datestart.Text + "' and '" + dateend.Text + "'";
                        c.printreport(query, dt, xml, rpt);
                    }
                    else if (paytype.Text != "Todos")
                    {
                        string query = "select idtransactions, ref, madebytran, reasontran, datetran, origin, entry, expenses from [transaction] where origin = '" + paytype.Text + "' and datetran between '" + datestart.Text + "' and '" + dateend.Text + "'";
                        c.printreport(query, dt, xml, rpt);
                    }
                }
            }
            else if (transentry.Checked == true)
            {
                if (rankall.Checked == true)
                {
                    if (paytype.Text == "Todos")
                    {
                        string query = "select idtransactions, ref, madebytran, reasontran, datetran, origin, entry, expenses from [transaction] where entry > 0";
                        c.printreport(query, dt, xml, rpt);
                    }
                    else if (paytype.Text != "Todos")
                    {
                        string query = "select idtransactions, ref, madebytran, reasontran, datetran, origin, entry, expenses from [transaction] where entry > 0 and origin = '" + paytype.Text + "'";
                        c.printreport(query, dt, xml, rpt);
                    }
                }
                else if (rankdate.Checked == true)
                {
                    if (paytype.Text == "Todos")
                    {
                        string query = "select idtransactions, ref, madebytran, reasontran, datetran, origin, entry, expenses from [transaction] where entry > 0 and datetran between '" + datestart.Text + "' and '" + dateend.Text + "'";
                        c.printreport(query, dt, xml, rpt);
                    }
                    else if (paytype.Text != "Todos")
                    {
                        string query = "select idtransactions, ref, madebytran, reasontran, datetran, origin, entry, expenses from [transaction] where entry > 0 and origin = '" + paytype.Text + "' and datetran between '" + datestart.Text + "' and '" + dateend.Text + "'";
                        c.printreport(query, dt, xml, rpt);
                    }
                }
            }
            else if (transout.Checked == true)
            {
                if (rankall.Checked == true)
                {
                    if (paytype.Text == "Todos")
                    {
                        string query = "select idtransactions, ref, madebytran, reasontran, datetran, origin, entry, expenses from [transaction] where expenses > 0";
                        c.printreport(query, dt, xml, rpt);
                    }
                    else if (paytype.Text != "Todos")
                    {
                        string query = "select idtransactions, ref, madebytran, reasontran, datetran, origin, entry, expenses from [transaction] where expenses > 0 and origin like '" + paytype.Text + "'";
                        c.printreport(query, dt, xml, rpt);
                    }
                }
                else if (rankdate.Checked == true)
                {
                    if (paytype.Text == "Todos")
                    {
                        string query = "select idtransactions, ref, madebytran, reasontran, datetran, origin, entry, expenses from [transaction] where expenses > 0 and datetran between '" + datestart.Text + "' and '" + dateend.Text + "'";
                        c.printreport(query, dt, xml, rpt);
                    }
                    else if (paytype.Text != "Todos")
                    {
                        string query = "select idtransactions, ref, madebytran, reasontran, datetran, origin, entry, expenses from [transaction] where expenses > 0 and origin like '" + paytype.Text + "' and datetran between '" + datestart.Text + "' and '" + dateend.Text + "'";
                        c.printreport(query, dt, xml, rpt);
                    }
                }
            }
        }
示例#3
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.");
                        }
                    }
                }
            }
        }