Esempio n. 1
0
        private bool AppointmentNuevaCita(AppointmentEditDialogShowingEventArgs e)
        {
            try
            {
                bool resul = false;

                cs_cita  objCita = new cs_cita();
                cs_sapbo sapo    = new cs_sapbo();

                objCita.Start       = e.Appointment.Start;
                objCita.End         = e.Appointment.End;
                objCita.DocStatus   = "R";
                objCita.Description = "R";
                objCita.PatientCode = "RESERVADO";
                objCita.PatientName = "RESERVADO";

                if (sapo.INSERT_CITAS(objCita) == true)
                {
                    objCita.LineNum       = 0;
                    objCita.TargetType    = -1;
                    objCita.DocEntry      = sapo.NewDocEntry;
                    objCita.AppointmentID = sapo.NewDocEntry;
                    objCita.ResourceID    = e.Appointment.ResourceId.KeyValue.ToString();
                    objCita.RoomCode      = e.Appointment.ResourceId.KeyValue.ToString();
                    objCita.ItemCode      = "RESERVADO";
                    objCita.Dscription    = "RESERVADO";
                    objCita.Currency      = "MXP";

                    _NewDocEntry = sapo.NewDocEntry;

                    if (sapo.INSERT_CITA1(objCita) == true)
                    {
                        resul = true;
                    }
                    else
                    {
                        MessageBox.Show(sapo.MessageError, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        sapo.DELETE_CITAS_RESERVADO(_NewDocEntry);
                    }
                }
                else
                {
                    MessageBox.Show(sapo.MessageError, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }

                objCita = null;
                sapo    = null;

                return(resul);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return(false);
            }
        }
Esempio n. 2
0
        private void btn_AgregarEstudio_Click(object sender, EventArgs e)
        {
            try
            {
                if (txt_nombre.Text == "" || txt_apellido_paterno.Text == "" || txt_apellido_materno.Text == "" || txt_sexo.Text == "" ||
                    txt_telefono.Text == "" || txt_celular.Text == "" || txt_correo.Text == "")
                {
                    MessageBox.Show("Debe de capturar todos la información de los datos del paciente.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    cs_sapbo sapo = new cs_sapbo();
                    cs_cita  cita = new cs_cita();

                    if (!sapo.MultiCitas((string)txt_salas.SelectedValue))
                    {
                        if (sapo.MISMO_HORARIO_CITA1(int.Parse(txt_DocEntry.Text), Convert.ToDateTime(txt_start.Text)) == true)
                        {
                            MessageBox.Show("El estudio no se puede registrar en el mismo horario.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            return;
                        }
                    }

                    if (txt_id_paciente.Text == "")
                    {
                        cita.PatientCode =
                            cs_funciones.GET_PatientCode(txt_nombre.Text, txt_apellido_paterno.Text, txt_apellido_materno.Text) + txt_fecha_naci.Value.ToString("yyMMdd");
                        txt_id_paciente.Text = cita.PatientCode;

                        if (sapo.EXIST_PACIENTE(cita.PatientCode) == true)
                        {
                            MessageBox.Show("Ya existe el ID del paciente.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            return;
                        }
                    }
                    else
                    {
                        cita.PatientCode = txt_id_paciente.Text;
                    }

                    cita.DocEntry   = int.Parse(txt_DocEntry.Text);
                    cita.LineNum    = sapo.GET_CITA1_LineNum(int.Parse(txt_DocEntry.Text));
                    cita.TargetType = 0;
                    cita.TrgetEntry = 0;
                    cita.ItemCode   = (string)txt_estudios.SelectedValue;
                    cita.Dscription = txt_estudios.Text;
                    cita.Quantity   = 1;
                    cita.Price      = this.GetPrecio();
                    cita.RoomCode   = (string)txt_salas.SelectedValue;
                    cita.Currency   = "MXP";
                    cita.DiscPrcnt1 = 0;
                    cita.LineTotal  = (cita.Price * cita.Quantity);
                    cita.PriceBefDi = 0;
                    cita.DocDate    = txt_fecha.Value.Date;
                    cita.Start      = Convert.ToDateTime(txt_start.Text);
                    int _duracion = sapo.GET_ESTUDIO_Duration((string)txt_estudios.SelectedValue);
                    cita.End           = Convert.ToDateTime(txt_start.Text).AddMinutes(_duracion);
                    cita.AppointmentID = int.Parse(txt_DocEntry.Text);
                    cita.ResourceID    = (string)txt_salas.SelectedValue;

                    if (sapo.INSERT_CITA1(cita) == true)
                    {
                        cita.DocNum    = int.Parse(txt_DocEntry.Text);
                        cita.CANCELED  = "N";
                        cita.DocStatus = "N";
                        cita.DocDate   = DateTime.Now.Date;
                        cita.NumAtCard = "";

                        cita.PatientCode     = txt_id_paciente.Text;
                        cita.PatientName     = txt_nombre.Text + " " + txt_apellido_paterno.Text + " " + txt_apellido_materno.Text;
                        cita.PatientType     = txt_cardtype.Text;
                        cita.InstitutionCode = (string)txt_instituciones.SelectedValue;
                        cita.InstitutionName = txt_instituciones.Text;
                        cita.DependencyCode  = "";
                        cita.DependencyName  = "";
                        cita.DoctorCode      = "";
                        cita.DoctorName      = "";
                        cita.VatSum          = 0;
                        cita.DiscPrcnt       = 0;
                        cita.DocCur          = "MXP";
                        cita.DocTotal        = this.GetLineTotal();
                        cita.PaidToDate      = 0;
                        cita.Comments        = txt_Observaciones.Text;
                        cita.MultiCita       = "N";
                        cita.Series          = 0;
                        cita.CreateDate      = DateTime.Now.Date;
                        cita.UpdateDate      = DateTime.Now.Date;
                        cita.UserSign        = 1;
                        cita.VersionNum      = "9.2";
                        cita.Summary         = "";
                        cita.RecurrenceRule  = "";
                        cita.MasterEventID   = 0;
                        cita.Location        = "";
                        cita.Description     = "N";
                        cita.BackgroundID    = 1;
                        cita.StatusID        = 4;
                        cita.ParentID        = 0;
                        cita.Email           = "";
                        cita.Visible         = 1;

                        if (sapo.UPDATE_CITAS(cita) == false)
                        {
                            MessageBox.Show(sapo.MessageError, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                        if (sapo.DELETE_CITA1_RESERVADO(int.Parse(txt_DocEntry.Text), "RESERVADO") == false)
                        {
                            //MessageBox.Show(sapo.MessageError, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }

                        this.InitializeRadSchedulerDataBinding();
                        this.InitializeRadSchedulerResource();

                        //if (cbox_multicita.Checked == false) { this.InitializeRadSchedulerResource(); }
                        //else { this.InitializeRadSchedulerResources(); }

                        radGridEstudios.DataSource = sapo.GET_CITAS_RGV(int.Parse(txt_DocEntry.Text));
                        radGridEstudios.Refresh();

                        txt_doc_total.Text = this.GetLineTotal().ToString("C");
                    }
                    else
                    {
                        MessageBox.Show(sapo.MessageError, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                    cita = null;
                    sapo = null;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Esempio n. 3
0
        private void AppointmentUpdate()
        {
            try
            {
                if (txt_nombre.Text == "" || txt_apellido_paterno.Text == "" || txt_apellido_materno.Text == "" || txt_sexo.Text == "" || txt_medico.Text == "")
                {
                    MessageBox.Show("Debe de capturar todos la información de los datos del paciente.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    cs_sapbo sapo = new cs_sapbo();
                    cs_cita  cita = new cs_cita();

                    cita.DocEntry = int.Parse(txt_DocEntry.Text);

                    cita.Start = Convert.ToDateTime(txt_start.Text);
                    int _duracion = sapo.GET_ESTUDIO_Duration((string)txt_estudios.SelectedValue);
                    cita.End           = Convert.ToDateTime(txt_start.Text).AddMinutes(_duracion);
                    cita.AppointmentID = int.Parse(txt_DocEntry.Text);
                    cita.ResourceID    = (string)txt_salas.SelectedValue;

                    cita.DocNum    = int.Parse(txt_DocEntry.Text);
                    cita.CANCELED  = "N";
                    cita.DocStatus = "N";
                    cita.DocDate   = DateTime.Now.Date;
                    cita.NumAtCard = "";

                    cita.PatientCode     = txt_id_paciente.Text;
                    cita.PatientName     = txt_nombre.Text + " " + txt_apellido_paterno.Text + " " + txt_apellido_materno.Text;
                    cita.PatientType     = txt_cardtype.Text;
                    cita.InstitutionCode = (string)txt_instituciones.SelectedValue;
                    cita.InstitutionName = txt_instituciones.Text;
                    cita.DependencyCode  = "";
                    cita.DependencyName  = "";
                    cita.DoctorCode      = "-1";
                    cita.DoctorName      = txt_medico.Text;
                    cita.VatSum          = 0;
                    cita.DiscPrcnt       = 0;
                    cita.DocCur          = "MXP";
                    cita.DocTotal        = this.GetLineTotal();
                    cita.PaidToDate      = 0;
                    cita.Comments        = txt_Observaciones.Text;
                    cita.MultiCita       = "N";
                    cita.Series          = 0;
                    cita.CreateDate      = DateTime.Now.Date;
                    cita.UpdateDate      = DateTime.Now.Date;
                    cita.UserSign        = 1;
                    cita.VersionNum      = "9.2";
                    cita.Summary         = "";
                    cita.RecurrenceRule  = "";
                    cita.MasterEventID   = 0;
                    cita.Location        = "";
                    cita.Description     = "N";
                    cita.BackgroundID    = 2;
                    cita.StatusID        = 4;
                    cita.ParentID        = 0;
                    cita.Email           = "";
                    cita.Visible         = 1;

                    if (sapo.UPDATE_CITAS(cita) == false)
                    {
                        MessageBox.Show(sapo.MessageError, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }

                    txt_doc_total.Text = this.GetLineTotal().ToString("C");

                    cita = null;
                    sapo = null;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }