Ejemplo n.º 1
0
        private void grdDataHabitaciones_AfterSelectChange(object sender, Infragistics.Win.UltraWinGrid.AfterSelectChangeEventArgs e)
        {
            if (grdDataHabitaciones.Selected.Rows.Count == 0)
            {
                return;
            }
            OperationResult     objOperationResult = new OperationResult();
            SystemParameterList habHospit          = new SystemParameterList();

            if (_mode == "NewASEGU")
            {
                #region Conexion SAM
                ConexionSigesoft conectasam = new ConexionSigesoft();
                conectasam.opensigesoft();
                #endregion
                var           cadena1 = "select r_HospitalBedPrice from protocol where v_ProtocolId ='" + _v_ProtocoloId + "'";
                SqlCommand    comando = new SqlCommand(cadena1, connection: conectasam.conectarsigesoft);
                SqlDataReader lector  = comando.ExecuteReader();
                string        hab     = "0.00";
                while (lector.Read())
                {
                    hab = lector.GetValue(0).ToString();
                }
                lector.Close();
                txtPrecio.Text    = double.Parse(hab).ToString("N2");
                txtPrecio.Enabled = false;
            }
            else
            {
                int HabitacionId = int.Parse(grdDataHabitaciones.Selected.Rows[0].Cells["i_HabitacionId"].Value.ToString());
                habHospit = _hospitalizacionBL.GetHabitaciónH(ref objOperationResult, HabitacionId);

                txtPrecio.Text = double.Parse(habHospit.v_Value2).ToString("N2");
            }
        }
Ejemplo n.º 2
0
        private object LlenarExamen()
        {
            #region Conexion SIGESOFT Llenar componentes
            ConexionSigesoft conectasam = new ConexionSigesoft();
            conectasam.opensigesoft();
            var cadena = "select CP.v_Name, SC.v_ComponentId " +
                         "from service SR " +
                         "inner join servicecomponent SC on SR.v_ServiceId=SC.v_ServiceId " +
                         "inner join component CP on SC.v_ComponentId=CP.v_ComponentId " +
                         "where SR.v_ServiceId='" + _serviceId + "' and SC.r_Price>0";
            SqlCommand         comando        = new SqlCommand(cadena, connection: conectasam.conectarsigesoft);
            SqlDataReader      lector         = comando.ExecuteReader();
            List <ListaExamen> objListaExamen = new List <ListaExamen>();
            while (lector.Read())
            {
                ListaExamen Lista = new ListaExamen();
                Lista.v_Nombre = lector.GetValue(0).ToString();
                Lista.v_IdComp = lector.GetValue(1).ToString();
                objListaExamen.Add(Lista);
            }
            lector.Close();
            conectasam.closesigesoft();
            #endregion

            return(objListaExamen);
        }
        private void btnTicket_Click(object sender, EventArgs e)
        {
            // obtener serviceId y protocolId
            var ServiceId  = grdData.Selected.Rows[0].Cells["v_ServiceId"].Value.ToString();
            var protocolId = grdData.Selected.Rows[0].Cells["v_ProtocolId"].Value.ToString();

            #region Conexion SAM Obtener Plan
            ConexionSigesoft conectasam = new ConexionSigesoft();
            conectasam.opensigesoft();
            var           cadena1 = "select PL.i_PlanId from [dbo].[plan] PL where PL.v_ProtocoloId ='" + protocolId + "'";
            SqlCommand    comando = new SqlCommand(cadena1, connection: conectasam.conectarsigesoft);
            SqlDataReader lector  = comando.ExecuteReader();
            string        plan    = "";
            while (lector.Read())
            {
                plan = lector.GetValue(0).ToString();
            }
            lector.Close();
            conectasam.closesigesoft();
            string modoMasterService;
            if (plan != "")
            {
                modoMasterService = "ASEGU";
            }
            else
            {
                modoMasterService = "HOSPI";
            }
            #endregion
            // construir formulario ticket
            frmTicket ticket = new frmTicket(_tempTicket, ServiceId, string.Empty, "New", protocolId, modoMasterService);
            ticket.ShowDialog();
            btnFilter_Click(sender, e);
            btnTicket.Enabled = false;
        }
Ejemplo n.º 4
0
        private object LlenarLines()
        {
            #region Conexion SAMBHS
            ConexionSigesoft conectasam = new ConexionSigesoft();
            conectasam.opensigesoft();
            var cadenasam = "select LN.v_Nombre as v_Nombre ,PL.v_IdUnidadProductiva as  v_IdLinea " +
                            "from [dbo].[plan] PL " +
                            "inner join protocol PR on PL.v_ProtocoloId=PR.v_ProtocolId " +
                            "inner join [20505310072].[dbo].[linea] LN on PL.v_IdUnidadProductiva=LN.v_IdLinea " +
                            "where PR.v_ProtocolId='" + _protocolId + "'";
            var                comando        = new SqlCommand(cadenasam, connection: conectasam.conectarsigesoft);
            var                lector         = comando.ExecuteReader();
            string             preciounitario = "";
            List <ListaLineas> objListaLineas = new List <ListaLineas>();

            while (lector.Read())
            {
                ListaLineas Lista = new ListaLineas();
                Lista.v_Nombre  = lector.GetValue(0).ToString();
                Lista.v_IdLinea = lector.GetValue(1).ToString();
                objListaLineas.Add(Lista);
            }
            lector.Close();
            conectasam.closesigesoft();
            #endregion

            return(objListaLineas);
        }
Ejemplo n.º 5
0
        private void txtMedicamento_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
        {
            TicketBL oTicketBL = new TicketBL();
            var      f         = new frmSearchMedicamento();
            var      result    = f.ShowDialog();

            if (result == DialogResult.OK)
            {
                var medicamento = f.MedicamentoSeleccionado;
                if (medicamento == null)
                {
                    return;
                }
                txtMedicamento.Text      = medicamento.NombreCompleto;
                txtMedicamento.Tag       = medicamento.IdProductoDetalle;
                idUnidadProductiva       = medicamento.IdLinea;
                txtUnidadProductiva.Text = medicamento.IdLinea;
                txtPrecio.Text           = medicamento.PrecioVenta.ToString();
                var tienePlan  = false;
                var resultplan = oTicketBL.TienePlan(_protocolId, txtUnidadProductiva.Text);
                if (resultplan.Count > 0)
                {
                    tienePlan = true;
                }
                else
                {
                    tienePlan = false;
                }

                if (tienePlan)
                {
                    if (resultplan[0].i_EsCoaseguro == 1)
                    {
                        #region Conexion SAM
                        ConexionSigesoft conectasam = new ConexionSigesoft();
                        conectasam.opensigesoft();
                        #endregion
                        var           cadena1 = "select PR.r_MedicineDiscount, OO.v_Name, PR.v_CustomerOrganizationId from Organization OO inner join protocol PR On PR.v_AseguradoraOrganizationId = OO.v_OrganizationId where PR.v_ProtocolId ='" + _protocolId + "'";
                        SqlCommand    comando = new SqlCommand(cadena1, connection: conectasam.conectarsigesoft);
                        SqlDataReader lector  = comando.ExecuteReader();
                        string        eps     = "";
                        while (lector.Read())
                        {
                            eps = lector.GetValue(0).ToString();
                        }
                        lector.Close();
                        conectasam.closesigesoft();
                        //calculo nuevo precio
                        txtPPS.Text     = medicamento.d_PrecioMayorista.ToString();
                        txtDctoEPS.Text = eps;
                        decimal nuevoPrecio = decimal.Parse(txtPPS.Text) - ((decimal.Parse(eps) * decimal.Parse(txtPPS.Text)) / 100);
                        txtNuevoPrecio.Text = nuevoPrecio.ToString();
                    }
                }
            }
        }
        private void btnAgregarExamenes_Click(object sender, EventArgs e)
        {
            OperationResult objOperationResult = new OperationResult();
            var             serviceId          = grdData.Selected.Rows[0].Cells["v_ServiceId"].Value.ToString();
            var             protocolId         = grdData.Selected.Rows[0].Cells["v_ProtocolId"].Value.ToString();
            var             NroHospitalizacion = grdData.Selected.Rows[0].Cells["v_HopitalizacionId"].Value.ToString();
            var             dni = grdData.Selected.Rows[0].Cells["v_DocNumber"].Value.ToString();

            #region Conexion SAM
            ConexionSigesoft conectasam = new ConexionSigesoft();
            conectasam.opensigesoft();
            #endregion
            var           cadena1 = "select PL.i_PlanId from [dbo].[plan] PL where PL.v_ProtocoloId ='" + protocolId + "'";
            SqlCommand    comando = new SqlCommand(cadena1, connection: conectasam.conectarsigesoft);
            SqlDataReader lector  = comando.ExecuteReader();
            string        plan    = "";
            while (lector.Read())
            {
                plan = lector.GetValue(0).ToString();
            }
            lector.Close();
            conectasam.closesigesoft();

            var ListServiceComponent = new ServiceBL().GetServiceComponents_(ref objOperationResult, serviceId);
            ListaComponentes = new List <string>();
            foreach (var item in ListServiceComponent)
            {
                ListaComponentes.Add(item.v_ComponentId);
            }

            if (plan != "")
            {
                var frm = new frmAddExam(ListaComponentes, "ASEGU", protocolId, "Asegu", NroHospitalizacion, dni, serviceId, null)
                {
                    _serviceId = serviceId
                };
                frm.ShowDialog();
                if (frm.DialogResult == DialogResult.OK)
                {
                    btnFilter_Click(sender, e);
                }
            }
            else
            {
                var frm = new frmAddExam(ListaComponentes, "HOSPI", protocolId, "Hospi", NroHospitalizacion, dni, serviceId, null)
                {
                    _serviceId = serviceId
                };
                frm.ShowDialog();
                if (frm.DialogResult == DialogResult.OK)
                {
                    btnFilter_Click(sender, e);
                }
            }
        }
Ejemplo n.º 7
0
        public void btnCancelar_Click(object sender, EventArgs e)
        {
            ConexionSigesoft conectasam = new ConexionSigesoft();

            conectasam.opensigesoft();
            var cadena = "update protocol set " +
                         "v_AseguradoraOrganizationId='" + _aseguradoraId + "' " +
                         "where v_ProtocolId='" + _protocolId + "'";
            SqlCommand comando = new SqlCommand(cadena, connection: conectasam.conectarsigesoft);
            var        lector  = comando.ExecuteReader();

            lector.Close();
            conectasam.closesigesoft();
            this.Close();
        }
Ejemplo n.º 8
0
 private void cbExamen_RowSelected(object sender, RowSelectedEventArgs e)
 {
     #region Conexion SIGESOFT obtener idcomponent
     ConexionSigesoft conectasam = new ConexionSigesoft();
     conectasam.opensigesoft();
     var           cadena  = "select CP.v_componentId from component CP where CP.v_Name='" + cbExamen.Text + "'";
     SqlCommand    comando = new SqlCommand(cadena, connection: conectasam.conectarsigesoft);
     SqlDataReader lector  = comando.ExecuteReader();
     while (lector.Read())
     {
         txtComponentId.Text = lector.GetValue(0).ToString();
     }
     lector.Close();
     conectasam.closesigesoft();
     #endregion
 }
Ejemplo n.º 9
0
 private string VerificarRegistro()
 {
     #region Conexion SAM
     ConexionSigesoft conectasam = new ConexionSigesoft();
     conectasam.opensigesoft();
     #endregion
     var           cadena1 = "select v_NroCartaSolicitud from service where v_ServiceId='" + _service + "'";
     SqlCommand    comando = new SqlCommand(cadena1, connection: conectasam.conectarsigesoft);
     SqlDataReader lector  = comando.ExecuteReader();
     string        confirm = "";
     while (lector.Read())
     {
         confirm = lector.GetValue(0).ToString();
     }
     lector.Close();
     return(confirm);
 }
        private void cbProcedimiento_RowSelected(object sender, Infragistics.Win.UltraWinGrid.RowSelectedEventArgs e)
        {
            #region Conexion SAM
            ConexionSigesoft conectasam = new ConexionSigesoft();
            conectasam.opensigesoft();
            #endregion

            string        proced  = cbProcedimiento.Text;
            var           cadena1 = "select i_ParameterId from systemparameter where v_Value1='" + proced + "'";
            SqlCommand    comando = new SqlCommand(cadena1, connection: conectasam.conectarsigesoft);
            SqlDataReader lector  = comando.ExecuteReader();
            while (lector.Read())
            {
                txtProcedId.Text = lector.GetValue(0).ToString();
            }
            lector.Close();
            conectasam.closesigesoft();
        }
        private void cbDx_RowSelected(object sender, Infragistics.Win.UltraWinGrid.RowSelectedEventArgs e)
        {
            //MessageBox.Show("hola MUNDO", "Validacion", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            #region Conexion SAM
            ConexionSigesoft conectasam = new ConexionSigesoft();
            conectasam.opensigesoft();
            #endregion

            string        dx      = cbDx.Text;
            var           cadena1 = "select v_CIE10Description2 from cie10 where v_CIE10Description1='" + dx + "'";
            SqlCommand    comando = new SqlCommand(cadena1, connection: conectasam.conectarsigesoft);
            SqlDataReader lector  = comando.ExecuteReader();
            while (lector.Read())
            {
                txtCie10.Text = lector.GetValue(0).ToString();
            }
            lector.Close();
            conectasam.closesigesoft();
        }
Ejemplo n.º 12
0
        private void cboHabitación_SelectedIndexChanged(object sender, EventArgs e)
        {
            OperationResult     objOperationResult = new OperationResult();
            SystemParameterList habHospit          = new SystemParameterList();

            if (cboHabitación.SelectedValue == null)
            {
                return;
            }
            if (cboHabitación.SelectedValue.ToString() == "-1")
            {
                txtPrecio.Text = ".";
                return;
            }
            if (_mode == "NewASEGU")
            {
                #region Conexion SAM
                ConexionSigesoft conectasam = new ConexionSigesoft();
                conectasam.opensigesoft();
                #endregion
                var           cadena1 = "select r_HospitalBedPrice from protocol where v_ProtocolId ='" + _v_ProtocoloId + "'";
                SqlCommand    comando = new SqlCommand(cadena1, connection: conectasam.conectarsigesoft);
                SqlDataReader lector  = comando.ExecuteReader();
                string        hab     = "";
                while (lector.Read())
                {
                    hab = lector.GetValue(0).ToString();
                }
                lector.Close();
                txtPrecio.Text    = hab;
                txtPrecio.Enabled = false;
            }
            else
            {
                habHospit = _hospitalizacionBL.GetHabitaciónH(ref objOperationResult, int.Parse(cboHabitación.SelectedValue.ToString()));

                txtPrecio.Text = habHospit.v_Value2;
            }
        }
Ejemplo n.º 13
0
        private void btnLiberar_Click(object sender, EventArgs e)
        {
            var v_HopitalizacionId = grdData.Selected.Rows[0].Cells["v_HopitalizacionId"].Value.ToString();

            bool HabitacionEnUso = new HabitacionBL().GetHabitacionByHabitacionId(v_HopitalizacionId);



            #region Conexion SAM
            ConexionSigesoft conectasam = new ConexionSigesoft();
            conectasam.opensigesoft();
            #endregion

            var cadena1 = "update hospitalizacion set " +
                          "d_FechaAlta = NULL " +
                          "where v_HopitalizacionId='" + v_HopitalizacionId + "' ";
            SqlCommand    comando = new SqlCommand(cadena1, connection: conectasam.conectarsigesoft);
            SqlDataReader lector  = comando.ExecuteReader();
            lector.Close();
            btnFilter_Click(sender, e);
            MessageBox.Show("Se liberó el registro exitosamente.", "Información", MessageBoxButtons.OK,
                            MessageBoxIcon.Information);
        }
Ejemplo n.º 14
0
        private void btnEditarTicket_Click(object sender, EventArgs e)
        {
            OperationResult objOperationResult = new OperationResult();
            var             ServiceId          = grdData.Selected.Rows[0].Cells["v_ServiceId"].Value.ToString();
            var             ticketId           = grdData.Selected.Rows[0].Cells["v_TicketId"].Value.ToString();

            #region Conexion SAM
            ConexionSigesoft conectasam = new ConexionSigesoft();
            conectasam.opensigesoft();
            #endregion
            var           cadena1    = "select PL.i_PlanId from service SR inner join protocol PR on SR.v_ProtocolId = PR.v_ProtocolId inner join [dbo].[plan] PL on PR.v_ProtocolId = PL.v_ProtocoloId where SR.v_ServiceId ='" + ServiceId + "'";
            SqlCommand    comando    = new SqlCommand(cadena1, connection: conectasam.conectarsigesoft);
            SqlDataReader lector     = comando.ExecuteReader();
            string        plan       = "";
            string        protocolId = "";
            while (lector.Read())
            {
                plan = lector.GetValue(0).ToString();
            }
            lector.Close();
            conectasam.closesigesoft();
            ServiceList personData = _serviceBL.GetServicePersonData(ref objOperationResult, ServiceId);
            string      modoMasterService;
            if (plan != "")
            {
                modoMasterService = "ASEGU";
            }
            else
            {
                modoMasterService = "HOSPI";
            }
            _ticketId = ticketId;
            frmTicket ticket = new frmTicket(_tempTicket, ServiceId, _ticketId, "Edit", personData.v_ProtocolId, modoMasterService);
            ticket.ShowDialog();

            btnFilter_Click(sender, e);
        }
Ejemplo n.º 15
0
        private void btnBuscar_Click(object sender, EventArgs e)
        {
            var f      = new frmSearchMedicamento();
            var result = f.ShowDialog();

            #region Conexion SIGESOFT Obtener Porcentaje de descuento EPS
            ConexionSigesoft conectasam = new ConexionSigesoft();
            conectasam.opensigesoft();
            var           cadena  = "select PR.r_MedicineDiscount from protocol PR inner join organization OO on PR.v_CustomerOrganizationId = OO.v_OrganizationId where PR.v_ProtocolId='" + _protocolId + "'";
            SqlCommand    comando = new SqlCommand(cadena, connection: conectasam.conectarsigesoft);
            SqlDataReader lector  = comando.ExecuteReader();
            string        EPS     = "";
            while (lector.Read())
            {
                EPS = lector.GetValue(0).ToString();
            }
            lector.Close();
            conectasam.closesigesoft();
            #endregion
            if (result == DialogResult.OK)
            {
                var medicamento = f.MedicamentoSeleccionado;
                if (medicamento == null)
                {
                    return;
                }
                txtMedicamento.Text = medicamento.NombreCompleto;
                txtCodigo.Text      = medicamento.CodInterno;
                txtMedicamento.Tag  = medicamento.IdProductoDetalle;
                //Nuevo Precio con descuento EPS
                txtPrecioVenta.Text      = (decimal.Round((medicamento.d_PrecioMayorista - (medicamento.d_PrecioMayorista * decimal.Parse(EPS)) / 100), 2)).ToString();
                txtUnidadProductiva.Text = medicamento.IdLinea;
                txtPrecio.Text           = (decimal.Round((decimal)medicamento.PrecioVenta, 2)).ToString();
                txtPPS.Text       = (decimal.Round((decimal)medicamento.d_PrecioMayorista, 2)).ToString();
                txtDesctoEPS.Text = EPS;
            }
        }
Ejemplo n.º 16
0
        private void AdditionalExam_Load(object sender, EventArgs e)
        {
            OperationResult objOperationResult = new OperationResult();

            var ListServiceComponent = objServiceBL.GetAllComponents(ref objOperationResult, null, "");

            //grdDataServiceComponent.DataSource = ListServiceComponent;
            gdDataExams.DataSource = ListServiceComponent;

            #region Conexion SIGESOFT Obtener nombre del protocolo

            ConexionSigesoft conectasam = new ConexionSigesoft();
            conectasam.opensigesoft();
            var cadena1 = "select PR.v_Name, OO.v_Name " +
                          "from protocol PR " +
                          "inner join [dbo].[plan] PL on PR.v_ProtocolId=PL.v_ProtocoloId " +
                          "inner join organization OO on PL.v_OrganizationSeguroId=OO.v_OrganizationId " +
                          "where v_ProtocolId='" + _protocolId + "' " +
                          "group by PR.v_Name, OO.v_Name ";
            SqlCommand    comando = new SqlCommand(cadena1, connection: conectasam.conectarsigesoft);
            SqlDataReader lector  = comando.ExecuteReader();

            string protocolName    = "";
            string aseguradoraName = "";

            while (lector.Read())
            {
                protocolName    = lector.GetValue(0).ToString();
                aseguradoraName = lector.GetValue(1).ToString();
            }

            lector.Close();
            conectasam.closesigesoft();

            #endregion
        }
Ejemplo n.º 17
0
        private void frmAddAdditionalExam_Load(object sender, EventArgs e)
        {
            OperationResult objOperationResult = new OperationResult();

            if (_DataSource.Count > 0)
            {
                grdDataServiceComponent.DataSource = _DataSource;
                ultraGrid1.DataSource = _DataSource;
                groupBox1.Visible     = false;
                cbLine.Visible        = false;
                this.Height           = 458;
                ultraGrid1.Height     = 360;
                ultraGrid1.Location   = new Point(3, 3);
            }
            else
            {
                var ListServiceComponent = objServiceBL.GetAllComponents(ref objOperationResult, null, "");
                grdDataServiceComponent.DataSource = ListServiceComponent;
                ultraGrid1.DataSource = ListServiceComponent;
            }


            if (_modo == "HOSPI" || _modo == "ASEGU")
            {
                cboMedico.Enabled = true;
                Utils.LoadDropDownList(cboMedico, "Value1", "Id", BLL.Utils.GetProfessionalName(ref objOperationResult), DropDownListAction.Select);
                cboMedico.SelectedValue = "11";
                if (_modo == "ASEGU")
                {
                    #region Conexion SIGESOFT Obtener nombre del protocolo
                    ConexionSigesoft conectasam = new ConexionSigesoft();
                    conectasam.opensigesoft();
                    var cadena1 = "select PR.v_Name, OO.v_Name " +
                                  "from protocol PR " +
                                  "inner join [dbo].[plan] PL on PR.v_ProtocolId=PL.v_ProtocoloId " +
                                  "inner join organization OO on PL.v_OrganizationSeguroId=OO.v_OrganizationId " +
                                  "where v_ProtocolId='" + _protocolId + "' " +
                                  "group by PR.v_Name, OO.v_Name ";
                    SqlCommand    comando         = new SqlCommand(cadena1, connection: conectasam.conectarsigesoft);
                    SqlDataReader lector          = comando.ExecuteReader();
                    string        protocolName    = "";
                    string        aseguradoraName = "";
                    while (lector.Read())
                    {
                        protocolName    = lector.GetValue(0).ToString();
                        aseguradoraName = lector.GetValue(1).ToString();
                    }
                    lector.Close();
                    //conectasam.closesigesoft();
                    lblPlan.Text = "Añadir plan de: " + aseguradoraName + "\n" + "Protocolo de Atención: " + protocolName;
                    if (lblPlan.Text.Length > 50)
                    {
                        lblPlan.Font = new Font("Microsoft Sans Serif", 6.25f);
                    }
                    #endregion

                    cbLine.Select();
                    object listaLine = LlenarLines();
                    cbLine.DataSource            = listaLine;
                    cbLine.DisplayMember         = "v_Nombre";
                    cbLine.ValueMember           = "v_IdLinea";
                    cbLine.AutoCompleteMode      = Infragistics.Win.AutoCompleteMode.Suggest;
                    cbLine.AutoSuggestFilterMode = Infragistics.Win.AutoSuggestFilterMode.Contains;
                    this.cbLine.DropDownWidth    = 590;
                    cbLine.DisplayLayout.Bands[0].Columns[0].Width = 20;
                    cbLine.DisplayLayout.Bands[0].Columns[1].Width = 335;
                    #region Colocar el Plan en el combo y bloquearlo
                    cadena1 = "select SR.i_PlanId, PL.v_IdUnidadProductiva, LN.v_Nombre " +
                              "from service SR " +
                              "inner join [dbo].[plan] PL on SR.v_ProtocolId=PL.v_ProtocoloId and SR.i_PlanId=PL.i_PlanId " +
                              "inner join [20505310072].[dbo].[linea] LN on PL.v_IdUnidadProductiva= LN.v_IdLinea " +
                              "where v_ServiceId = '" + _serviceId + "' and SR.i_PlanId <> ''";
                    comando = new SqlCommand(cadena1, connection: conectasam.conectarsigesoft);
                    lector  = comando.ExecuteReader();
                    string i_PlanId, v_IdUnidadProductiva, v_Nombre = "";
                    bool   resultPlan = false;
                    while (lector.Read())
                    {
                        i_PlanId             = lector.GetValue(0).ToString();
                        v_IdUnidadProductiva = lector.GetValue(1).ToString();
                        v_Nombre             = lector.GetValue(2).ToString();
                        resultPlan           = true;
                    }
                    lector.Close();
                    conectasam.closesigesoft();
                    if (resultPlan)
                    {
                        cbLine.Text    = v_Nombre;
                        cbLine.Enabled = false;
                    }
                    #endregion
                }
                else
                {
                    gbExamenesSeleccionados.Size     = new Size(337, 430);
                    gbExamenesSeleccionados.Location = new Point(626, 12);
                    gbTipoAtencion.Visible           = false;
                    lblPlan.Visible = false;
                    cbLine.Visible  = false;
                }
            }
            else
            {
                Utils.LoadDropDownList(cboMedico, "Value1", "Id", BLL.Utils.GetProfessionalName(ref objOperationResult), DropDownListAction.Select);
                cboMedico.SelectedValue = "11";
                cboMedico.Enabled       = false;
            }
        }
Ejemplo n.º 18
0
        private void btnGuardarTicket_Click(object sender, EventArgs e)
        {
            OperationResult objOperationResult = new OperationResult();

            if (_hospitalizacionHabitaciónDto == null)
            {
                _hospitalizacionHabitaciónDto = new hospitalizacionhabitacionDto();
            }

            if (_mode == "NewASEGU" || _mode == "NewHOSPI")
            {
                _hospitalizacionHabitaciónDto.v_HopitalizacionId = _hospitalizacion;
                _hospitalizacionHabitaciónDto.i_HabitacionId     = int.Parse(cboHabitación.SelectedValue.ToString());
                _hospitalizacionHabitaciónDto.d_StartDate        = dtpFechaInicio.Value;
                _hospitalizacionHabitaciónDto.d_EndDate          = (DateTime?)(dtpFechaFin.Checked == false ?  (ValueType)null : dtpFechaFin.Value);
                decimal d;
                if (_mode == "NewASEGU")
                {
                    #region Conexion SIGESOFT Obtener Deducible de Habitacion
                    ConexionSigesoft conectasam = new ConexionSigesoft();
                    conectasam.opensigesoft();
                    var           cadena1   = "select PL.d_Importe from [dbo].[plan] PL where PL.v_IdUnidadProductiva='" + lineId + "' and PL.v_ProtocoloId='" + _v_ProtocoloId + "' ";
                    SqlCommand    comando   = new SqlCommand(cadena1, connection: conectasam.conectarsigesoft);
                    SqlDataReader lector    = comando.ExecuteReader();
                    string        deducible = "";
                    while (lector.Read())
                    {
                        deducible = lector.GetValue(0).ToString();
                    }
                    lector.Close();
                    conectasam.closesigesoft();
                    #endregion
                    _hospitalizacionHabitaciónDto.d_Precio           = txtPrecio.Text != string.Empty ? decimal.TryParse(txtPrecio.Text, out d) ? d : 0 : (decimal?)null;
                    _hospitalizacionHabitaciónDto.d_SaldoPaciente    = decimal.Parse(deducible);
                    _hospitalizacionHabitaciónDto.d_SaldoAseguradora = decimal.Parse(txtPrecio.Text) - decimal.Parse(deducible);
                }
                else if (_mode == "NewHOSPI")
                {
                    _hospitalizacionHabitaciónDto.i_ConCargoA = rbMedicoTratante.Checked ? (int)CargoHospitalizacion.MedicoTratante : (int)CargoHospitalizacion.Paciente;
                    _hospitalizacionHabitaciónDto.d_Precio    = txtPrecio.Text != string.Empty ? decimal.TryParse(txtPrecio.Text, out d) ? d : 0 : (decimal?)null;
                }

                DialogResult Result = MessageBox.Show("¿Desea Guardar Habitación?", "ADVERTENCIA!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

                if (Result == System.Windows.Forms.DialogResult.Yes)
                {
                    habitacionId = _hospitalizacionBL.AddHospitalizacionHabitacion(ref objOperationResult, _hospitalizacionHabitaciónDto, Globals.ClientSession.GetAsList());
                    this.Close();
                }
                else
                {
                    this.Close();
                }
            }
            else if (_mode == "EditASEGU" || _mode == "EditHOSPI")
            {
                _hospitalizacionHabitaciónDto.v_HopitalizacionId = _hospitalizacion;
                _hospitalizacionHabitaciónDto.i_HabitacionId     = int.Parse(cboHabitación.SelectedValue.ToString());
                _hospitalizacionHabitaciónDto.d_StartDate        = dtpFechaInicio.Value;
                _hospitalizacionHabitaciónDto.d_EndDate          = dtpFechaFin.Value;
                _hospitalizacionHabitaciónDto.i_ConCargoA        = rbMedicoTratante.Checked ? (int)CargoHospitalizacion.MedicoTratante : (int)CargoHospitalizacion.Paciente;
                decimal d;
                if (_mode == "EditASEGU")
                {
                    _hospitalizacionHabitaciónDto.d_Precio           = txtPrecio.Text != string.Empty ? decimal.TryParse(txtPrecio.Text, out d) ? d : 0 : (decimal?)null;
                    _hospitalizacionHabitaciónDto.d_SaldoAseguradora = txtPrecio.Text != string.Empty ? decimal.TryParse(txtPrecio.Text, out d) ? d : 0 : (decimal?)null;
                }
                else if (_mode == "EditHOSPI")
                {
                    _hospitalizacionHabitaciónDto.d_Precio = txtPrecio.Text != string.Empty ? decimal.TryParse(txtPrecio.Text, out d) ? d : 0 : (decimal?)null;
                }

                DialogResult Result = MessageBox.Show("¿Desea Guardar Habitación?", "ADVERTENCIA!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

                if (Result == System.Windows.Forms.DialogResult.Yes)
                {
                    _hospitalizacionBL.UpdateHospitalizacionHabitacion(ref objOperationResult, _hospitalizacionHabitaciónDto, Globals.ClientSession.GetAsList());
                    this.Close();
                }
                else
                {
                    this.Close();
                }
            }
        }
Ejemplo n.º 19
0
        private void btnEditarHabitacion_Click(object sender, EventArgs e)
        {
            try
            {
                var v_HopitalizacionId = grdData.Selected.Rows[0].Cells["v_HopitalizacionId"].Value.ToString();

                #region Conexion SIGESOFT Obtener Protocolo
                ConexionSigesoft conectasam = new ConexionSigesoft();
                conectasam.opensigesoft();
                var cadena1 = "select PR.v_ProtocolId " +
                              "from hospitalizacionservice HS " +
                              "inner join service SR on SR.v_ServiceId= HS.v_ServiceId " +
                              "inner join protocol PR on SR.v_ProtocolId=PR.v_ProtocolId " +
                              "where v_HopitalizacionId='" + v_HopitalizacionId + "'";
                SqlCommand    comando = new SqlCommand(cadena1, connection: conectasam.conectarsigesoft);
                SqlDataReader lector  = comando.ExecuteReader();
                v_ProtocoloId = "";
                while (lector.Read())
                {
                    v_ProtocoloId = lector.GetValue(0).ToString();
                }
                lector.Close();
                conectasam.closesigesoft();
                #endregion

                #region Conexion SIGESOFT Obtener Plan
                conectasam = new ConexionSigesoft();
                conectasam.opensigesoft();
                cadena1 = "select PL.i_PlanId from [dbo].[plan] PL where PL.v_ProtocoloId ='" + v_ProtocoloId + "'";
                comando = new SqlCommand(cadena1, connection: conectasam.conectarsigesoft);
                lector  = comando.ExecuteReader();
                string plan = "";
                while (lector.Read())
                {
                    plan = lector.GetValue(0).ToString();
                }
                lector.Close();
                conectasam.closesigesoft();
                #endregion
                string modoMasterService;
                if (plan != "")
                {
                    modoMasterService = "ASEGU";
                }
                else
                {
                    modoMasterService = "HOSPI";
                }
                var hospitalizacionId           = grdData.Selected.Rows[0].Cells["v_HopitalizacionId"].Value.ToString();
                var hospitalizacionHabitacionId = grdData.Selected.Rows[0].Cells["v_HospitalizacionHabitacionId"].Value.ToString();

                frmHabitaciones frm = new frmHabitaciones(hospitalizacionId, "Edit" + modoMasterService, hospitalizacionHabitacionId, v_ProtocoloId);


                //frmHabitacion frm = new frmHabitacion(hospitalizacionId, "Edit" + modoMasterService, hospitalizacionHabitacionId, v_ProtocoloId);
                //frmHabitacion frm = new frmHabitacion(hospitalizacionId, "Edit", hospitalizacionHabitacionId, v_ProtocoloId);

                frm.ShowDialog();
                btnFilter_Click(sender, e);
                btnEditarHabitacion.Enabled = false;
            }
            catch (Exception ex)
            {
                //Console.WriteLine(ex);
                MessageBox.Show("NO SE PUEDE EDITAR HABITACIÓN - YA ASIGNADO", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Information);
                //throw;
            }
        }
Ejemplo n.º 20
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            TicketBL oTicketBL = new TicketBL();

            if (_TempTicketDetalleList == null)
            {
                _TempTicketDetalleList = new List <TicketDetalleList>();
            }
            OperationResult objOperationResult = new OperationResult();

            string[] componentIdFromProtocol = _TempTicketDetalleList.FindAll(p => p.i_RecordStatus != (int)RecordStatus.EliminadoLogico)
                                               .Select(p => p.v_IdProductoDetalle).ToArray();

            bool IsExists = _ticketlBL.IsExistsproductoInTicket(ref objOperationResult, componentIdFromProtocol, _ProductoId);

            if (IsExists)
            {
                var msj = string.Format("El examen producto puede agregar, ya existe", labelmensaje.Text);
                MessageBox.Show(msj, "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (_mode == "New")
            {
                // || cbExamen.Text == ""
                if (txtMedicamento.Tag == null)
                {
                    string mensage = "";
                    if (txtMedicamento.Tag == null)
                    {
                        mensage = @"Por favor seleccione un medicamento";
                    }
                    //else if (cbExamen.Text == ""){mensage = @"Por favor seleccione un examen";}
                    MessageBox.Show(mensage, @"Error de validación", MessageBoxButtons.OK);
                    txtMedicamento.Focus();
                    return;
                }

                var findResult = _TempTicketDetalleList.Find(p => p.v_IdProductoDetalle == _ProductoId);
                _objTicketDetalleList = new TicketDetalleList();

                if (findResult == null)
                {
                    _objTicketDetalleList.v_TicketDetalleId = Guid.NewGuid().ToString();

                    _objTicketDetalleList.v_IdProductoDetalle  = txtMedicamento.Tag.ToString();
                    _objTicketDetalleList.v_NombreProducto     = txtMedicamento.Text;
                    _objTicketDetalleList.v_CodInterno         = txtCodigo.Text;
                    _objTicketDetalleList.v_IdUnidadProductiva = txtUnidadProductiva.Text;
                    var precioTarifa = oTicketBL.ObtenerPrecioTarifario(_serviceId, _objTicketDetalleList.v_IdProductoDetalle);


                    decimal d;
                    _objTicketDetalleList.d_Cantidad = decimal.TryParse(txtCantidad.Text, out d) ? d : 0;

                    //nuevo
                    //int planId = 0;
                    //var servicioDet = oTicketBL.GetService(ref objOperationResult,_serviceId);
                    //if (servicioDet.i_PlanId != null)
                    //{
                    //    planId = (int)servicioDet.i_PlanId;
                    //}
                    //////


                    var tienePlan = false;
                    //var resultplan = oTicketBL.TienePlan_(_protocolId, planId);
                    var resultplan = oTicketBL.TienePlan(_protocolId, lineId);

                    if (resultplan.Count > 0)
                    {
                        tienePlan = true;
                    }
                    else
                    {
                        tienePlan = false;
                    }

                    if (tienePlan)
                    {
                        if (resultplan[0].i_EsCoaseguro == 1)
                        {
                            #region Conexion SIGESOFT verificar la unidad productiva del componente
                            ConexionSigesoft conectasam = new ConexionSigesoft();
                            conectasam.opensigesoft();
                            var cadena1 = "select PL.d_ImporteCo, PL.i_PlanId " +
                                          "from [dbo].[plan] PL " +
                                          "inner join protocol PR on PL.v_ProtocoloId=PR.v_ProtocolId " +
                                          "where PR.v_ProtocolId='" + _protocolId + "' and PL.v_IdUnidadProductiva='" + lineId + "'";
                            SqlCommand    comando = new SqlCommand(cadena1, connection: conectasam.conectarsigesoft);
                            SqlDataReader lector = comando.ExecuteReader();
                            string        ImporteCo = ""; string PlanId = "";
                            bool          lectorleido = false;
                            while (lector.Read())
                            {
                                ImporteCo   = lector.GetValue(0).ToString();
                                PlanId      = lector.GetValue(1).ToString();
                                lectorleido = true;
                            }

                            if (lectorleido == false)
                            {
                                MessageBox.Show(@"Elija un Examen que tenga Plan de Seguros", @"Error de validación", MessageBoxButtons.OK);
                                return;
                            }
                            lector.Close();

                            #endregion
                            _objTicketDetalleList.d_SaldoPaciente    = decimal.Round((decimal.Parse(txtPrecioVenta.Text)), 2) * decimal.Round((decimal.Parse(txtCantidad.Text)), 2) * decimal.Round((decimal.Parse(ImporteCo)), 2) / 100;
                            _objTicketDetalleList.d_SaldoAseguradora = decimal.Round((decimal.Parse(txtPrecioVenta.Text)), 2) * decimal.Round((decimal.Parse(txtCantidad.Text)), 2) - _objTicketDetalleList.d_SaldoPaciente;
                            _objTicketDetalleList.d_PrecioVenta      = decimal.Round((decimal.Parse(txtPrecioVenta.Text)), 2);

                            #region Update a service agrega el PlanId
                            var cadena2 = "update service set " +
                                          "i_PlanId = '" + PlanId + "' " +
                                          "where v_ServiceId = '" + _serviceId + "' ";
                            SqlCommand    comando_ = new SqlCommand(cadena2, connection: conectasam.conectarsigesoft);
                            SqlDataReader lector_  = comando_.ExecuteReader();
                            lector_.Close();

                            conectasam.closesigesoft();
                            #endregion
                        }
                        else if (resultplan[0].i_EsDeducible == 1)
                        {
                        }
                    }
                    else
                    {
                        _objTicketDetalleList.d_PrecioVenta = decimal.Round((decimal.Parse(txtPrecio.Text)), 2);   // decimal.Parse(txtPrecioVenta.Text);
                    }

                    _objTicketDetalleList.i_RecordStatus = (int)RecordStatus.Agregado;
                    _objTicketDetalleList.i_RecordType   = (int)RecordType.Temporal;


                    _TempTicketDetalleList.Add(_objTicketDetalleList);
                }
                else
                {
                    if (findResult.i_RecordStatus == (int)RecordStatus.EliminadoLogico)
                    {
                        if (findResult.i_RecordType == (int)RecordType.NoTemporal)
                        {
                            _objTicketDetalleList.v_IdProductoDetalle  = txtMedicamento.Tag.ToString();
                            _objTicketDetalleList.v_NombreProducto     = txtMedicamento.Text;
                            _objTicketDetalleList.v_CodInterno         = txtCodigo.Text;
                            _objTicketDetalleList.v_IdUnidadProductiva = txtUnidadProductiva.Text;
                            var precioTarifa = oTicketBL.ObtenerPrecioTarifario(_serviceId, _objTicketDetalleList.v_IdProductoDetalle);
                            _objTicketDetalleList.d_PrecioVenta = precioTarifa;    // decimal.Parse(txtPrecioVenta.Text);
                            decimal d;
                            _objTicketDetalleList.d_Cantidad = decimal.TryParse(txtCantidad.Text, out d) ? d : 0;

                            var tienePlan  = false;
                            var resultplan = oTicketBL.TienePlan(_protocolId, txtUnidadProductiva.Text);
                            if (resultplan.Count > 0)
                            {
                                tienePlan = true;
                            }
                            else
                            {
                                tienePlan = false;
                            }

                            if (tienePlan)
                            {
                                if (resultplan[0].i_EsCoaseguro == 1)
                                {
                                    _objTicketDetalleList.d_SaldoPaciente    = resultplan[0].d_Importe;
                                    _objTicketDetalleList.d_SaldoAseguradora = (decimal.Parse(_objTicketDetalleList.d_PrecioVenta.ToString()) * _objTicketDetalleList.d_Cantidad) - resultplan[0].d_Importe;
                                }
                                if (resultplan[0].i_EsDeducible == 1)
                                {
                                    _objTicketDetalleList.d_SaldoPaciente    = resultplan[0].d_Importe * decimal.Parse(_objTicketDetalleList.d_PrecioVenta.ToString()) * _objTicketDetalleList.d_Cantidad / 100;
                                    _objTicketDetalleList.d_SaldoAseguradora = (decimal.Parse(_objTicketDetalleList.d_PrecioVenta.ToString()) * _objTicketDetalleList.d_Cantidad) - _objTicketDetalleList.d_SaldoPaciente;
                                }
                            }

                            findResult.i_RecordStatus = (int)RecordStatus.Grabado;
                        }
                        else if (findResult.i_RecordType == (int)RecordType.Temporal)       // El registro tiene un ID temporal [GUID]
                        {
                            _objTicketDetalleList.v_IdProductoDetalle  = txtMedicamento.Tag.ToString();
                            _objTicketDetalleList.v_NombreProducto     = txtMedicamento.Text;
                            _objTicketDetalleList.v_CodInterno         = txtCodigo.Text;
                            _objTicketDetalleList.d_PrecioVenta        = decimal.Parse(txtPrecioVenta.Text);
                            _objTicketDetalleList.v_IdUnidadProductiva = txtUnidadProductiva.Text;
                            decimal d;
                            _objTicketDetalleList.d_Cantidad = decimal.TryParse(txtCantidad.Text, out d) ? d : 0;

                            var tienePlan  = false;
                            var resultplan = oTicketBL.TienePlan(_protocolId, txtUnidadProductiva.Text);
                            if (resultplan.Count > 0)
                            {
                                tienePlan = true;
                            }
                            else
                            {
                                tienePlan = false;
                            }

                            if (tienePlan)
                            {
                                if (resultplan[0].i_EsCoaseguro == 1)
                                {
                                    _objTicketDetalleList.d_SaldoPaciente    = resultplan[0].d_Importe;
                                    _objTicketDetalleList.d_SaldoAseguradora = (decimal.Parse(_objTicketDetalleList.d_PrecioVenta.ToString()) * _objTicketDetalleList.d_Cantidad) - resultplan[0].d_Importe;
                                }
                                if (resultplan[0].i_EsDeducible == 1)
                                {
                                    _objTicketDetalleList.d_SaldoPaciente    = resultplan[0].d_Importe * decimal.Parse(_objTicketDetalleList.d_PrecioVenta.ToString()) * _objTicketDetalleList.d_Cantidad / 100;
                                    _objTicketDetalleList.d_SaldoAseguradora = (decimal.Parse(_objTicketDetalleList.d_PrecioVenta.ToString()) * _objTicketDetalleList.d_Cantidad) - _objTicketDetalleList.d_SaldoPaciente;
                                }
                            }

                            _objTicketDetalleList.i_RecordType = (int)RecordType.Temporal;

                            findResult.i_RecordStatus = (int)RecordStatus.Agregado;
                        }
                    }
                    else
                    {
                        MessageBox.Show("Por favor seleccione otro medicamento. ya existe", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }
                }
            }
            else if (_mode == "Edit")
            {
                var     result = _TempTicketDetalleList.Find(p => p.v_TicketDetalleId == _id);
                decimal d;
                result.d_Cantidad = decimal.Round((decimal.TryParse(txtCantidad.Text, out d) ? d : 0), 2);
                if ((result.d_SaldoAseguradora != null || result.d_SaldoAseguradora >= 0) || result.d_SaldoPaciente != null || result.d_SaldoPaciente >= 0)
                {
                    result.d_SaldoAseguradora =
                        decimal.Round((decimal.TryParse(txtCantidad.Text, out d) ? d : 0), 2) * decimal.Round((decimal)result.d_PrecioVenta, 2);
                    result.d_SaldoPaciente = 0;
                }
                result.v_CodInterno   = txtCodigo.Text;
                result.i_RecordStatus = (int)RecordStatus.Modificado;
            }
            MessageBox.Show("Se grabo correctamente.", "INFORMACION!", MessageBoxButtons.OK, MessageBoxIcon.Information);

            this.Close();
        }
Ejemplo n.º 21
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            TicketBL oTicketBL = new TicketBL();

            try
            {
                _pobjOperationResult = new OperationResult();
                if (!uvDatos.Validate(true, false).IsValid)
                {
                    return;
                }

                if (txtMedicamento.Tag == null)
                {
                    MessageBox.Show(@"Por favor seleccione un medicamento", @"Error de validación", MessageBoxButtons.OK);
                    txtMedicamento.Focus();
                    return;
                }

                decimal d;
                _recetaDto.d_Cantidad           = decimal.TryParse(txtCantidad.Text, out d) ? d : 0;
                _recetaDto.v_Duracion           = txtDuracion.Text.Trim();
                _recetaDto.v_Posologia          = txtPosologia.Text.Trim();
                _recetaDto.t_FechaFin           = dtpFechaFin.Value;
                _recetaDto.v_IdProductoDetalle  = txtMedicamento.Tag.ToString();
                _recetaDto.v_IdUnidadProductiva = idUnidadProductiva;
                _recetaDto.v_ServiceId          = _serviceId;

                var tienePlan  = false;
                var resultplan = oTicketBL.TienePlan(_protocolId, txtUnidadProductiva.Text);
                if (resultplan.Count > 0)
                {
                    tienePlan = true;
                }
                else
                {
                    tienePlan = false;
                }

                if (tienePlan)
                {
                    if (resultplan[0].i_EsCoaseguro == 1)
                    {
                        #region Conexion SIGESOFT verificar la unidad productiva del componente
                        ConexionSigesoft conectasam = new ConexionSigesoft();
                        conectasam.opensigesoft();
                        var cadena1 = "select PL.d_ImporteCo " +
                                      "from [dbo].[plan] PL " +
                                      "inner join protocol PR on PL.v_ProtocoloId=PR.v_ProtocolId " +
                                      "inner join servicecomponent SC on PL.v_IdUnidadProductiva=SC.v_IdUnidadProductiva " +
                                      "inner join diagnosticrepository DR on DR.v_ComponentId=SC.v_ComponentId " +
                                      "where PR.v_ProtocolId='" + _protocolId + "' and DR.v_DiagnosticRepositoryId='" + _idDiagnosticRepository + "' ";
                        SqlCommand    comando     = new SqlCommand(cadena1, connection: conectasam.conectarsigesoft);
                        SqlDataReader lector      = comando.ExecuteReader();
                        string        ImporteCo   = "";
                        bool          lectorleido = false;
                        while (lector.Read())
                        {
                            ImporteCo   = lector.GetValue(0).ToString();
                            lectorleido = true;
                        }
                        if (lectorleido == false)
                        {
                            MessageBox.Show(@"El consultorio no tiene Plan de Seguros", @"Error de validación", MessageBoxButtons.OK);
                            return;
                        }
                        lector.Close();
                        conectasam.closesigesoft();
                        #endregion
                        _recetaDto.d_SaldoPaciente    = (decimal.Parse(ImporteCo) / 100) * (decimal.Parse(txtNuevoPrecio.Text) * _recetaDto.d_Cantidad);
                        _recetaDto.d_SaldoAseguradora = (decimal.Parse(txtNuevoPrecio.Text) * _recetaDto.d_Cantidad) - _recetaDto.d_SaldoPaciente;
                    }
                }
                else
                {
                    _recetaDto.d_SaldoPaciente = decimal.Parse(txtPrecio.Text) * _recetaDto.d_Cantidad;
                }

                _objRecetaBl.AddUpdateRecipe(ref _pobjOperationResult, _recetaDto);

                if (_pobjOperationResult.Success == 0)
                {
                    MessageBox.Show(_pobjOperationResult.ErrorMessage, @"Error", MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);
                    return;
                }

                Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, @"btnGuardar_Click()", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 22
0
        private void grdTotalDiagnosticos_ClickCellButton(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e)
        {
            try
            {
                if (e.Cell == null || e.Cell.Row.Cells["v_DiagnosticRepositoryId"].Value == null)
                {
                    return;
                }
                var diagnosticRepositoryId = e.Cell.Row.Cells["v_DiagnosticRepositoryId"].Value.ToString();
                var categoryName           = e.Cell.Row.Cells["v_ComponentName"].Value.ToString();
                #region Conexion SIGESOFT verificar la unidad productiva del componente
                ConexionSigesoft conectasam = new ConexionSigesoft();
                conectasam.opensigesoft();
                var cadena1 = "select CP.v_IdUnidadProductiva " +
                              "from diagnosticrepository DR " +
                              "inner join component CP on DR.v_ComponentId=CP.v_ComponentId " +
                              "where DR.v_DiagnosticRepositoryId='" + diagnosticRepositoryId + "' ";
                SqlCommand    comando = new SqlCommand(cadena1, connection: conectasam.conectarsigesoft);
                SqlDataReader lector  = comando.ExecuteReader();
                string        LineId  = "";
                while (lector.Read())
                {
                    LineId = lector.GetValue(0).ToString();
                }
                lector.Close();
                conectasam.closesigesoft();
                #endregion
                switch (e.Cell.Column.Key)
                {
                case "_AddRecipe":
                {
                    var f = new frmAddRecipe(ActionForm.Add, diagnosticRepositoryId, 0, _protocolId, _serviceId, categoryName, LineId)
                    {
                        StartPosition = FormStartPosition.CenterScreen
                    };
                    f.ShowDialog();
                    GetData(_listDiagnosticRepositoryLists);
                }
                break;

                case "_EditRecipe":
                {
                    var recipeId = int.Parse(e.Cell.Row.Cells["i_IdReceta"].Value.ToString());
                    var f        = new frmAddRecipe(ActionForm.Edit, diagnosticRepositoryId, recipeId, _protocolId, _serviceId, categoryName, LineId)
                    {
                        StartPosition = FormStartPosition.CenterScreen
                    };
                    f.ShowDialog();
                    GetData(_listDiagnosticRepositoryLists);
                }
                break;

                case "_DeleteRecipe":
                {
                    _pobjOperationResult = new OperationResult();
                    var recipeId = int.Parse(e.Cell.Row.Cells["i_IdReceta"].Value.ToString());
                    var msg      = MessageBox.Show(@"¿Seguro de eliminar esta receta?", @"Confirmación",
                                                   MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (msg == DialogResult.No)
                    {
                        return;
                    }
                    _objRecetaBl.DeleteRecipe(ref _pobjOperationResult, recipeId);
                    if (_pobjOperationResult.Success == 0)
                    {
                        MessageBox.Show(_pobjOperationResult.ErrorMessage, @"Error", MessageBoxButtons.OK,
                                        MessageBoxIcon.Error);
                        return;
                    }

                    GetData(_listDiagnosticRepositoryLists);
                }
                break;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, @"grdTotalDiagnosticos_ClickCellButton()", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 23
0
        private void frmAddProducto_Load(object sender, EventArgs e)
        {
            cbExamen.Visible       = false;
            txtComponentId.Visible = false;
            ultraLabel9.Visible    = false;

            if (_mode == "Edit")
            {
                btnBuscar.Visible      = false;
                txtMedicamento.Enabled = false;
                var findResult = _TempTicketDetalleList.Find(p => p.v_TicketDetalleId == _id);
                txtMedicamento.Text  = findResult.v_NombreProducto;
                txtCodigo.Text       = findResult.v_CodInterno;
                txtCantidad.Value    = decimal.Round((findResult.d_Cantidad), 2);
                txtPrecioVenta.Value = decimal.Round((findResult.d_PrecioVenta), 2);
            }
            cbExamen.Select();
            object listaExamen = LlenarExamen();

            cbExamen.DataSource            = listaExamen;
            cbExamen.DisplayMember         = "v_Nombre";
            cbExamen.ValueMember           = "v_IdComp";
            cbExamen.AutoCompleteMode      = Infragistics.Win.AutoCompleteMode.Suggest;
            cbExamen.AutoSuggestFilterMode = Infragistics.Win.AutoSuggestFilterMode.Contains;
            this.cbExamen.DropDownWidth    = 590;
            cbExamen.DisplayLayout.Bands[0].Columns[0].Width = 20;
            cbExamen.DisplayLayout.Bands[0].Columns[1].Width = 550;


            cbLine.Select();
            object listaLine = LlenarLines();

            cbLine.DataSource            = listaLine;
            cbLine.DisplayMember         = "v_Nombre";
            cbLine.ValueMember           = "v_IdLinea";
            cbLine.AutoCompleteMode      = Infragistics.Win.AutoCompleteMode.Suggest;
            cbLine.AutoSuggestFilterMode = Infragistics.Win.AutoSuggestFilterMode.Contains;
            this.cbLine.DropDownWidth    = 590;
            cbLine.DisplayLayout.Bands[0].Columns[0].Width = 20;
            cbLine.DisplayLayout.Bands[0].Columns[1].Width = 550;
            txtMedicamento.Focus();

            ConexionSigesoft conectasam = new ConexionSigesoft();

            conectasam.opensigesoft();
            #region Colocar el Plan en el combo y bloquearlo
            var cadena1 = "select SR.i_PlanId, PL.v_IdUnidadProductiva, LN.v_Nombre " +
                          "from service SR " +
                          "inner join [dbo].[plan] PL on SR.v_ProtocolId=PL.v_ProtocoloId and SR.i_PlanId=PL.i_PlanId " +
                          "inner join [20505310072].[dbo].[linea] LN on PL.v_IdUnidadProductiva= LN.v_IdLinea " +
                          "where v_ServiceId = '" + _serviceId + "' and SR.i_PlanId <> ''";
            SqlCommand    comando = new SqlCommand(cadena1, connection: conectasam.conectarsigesoft);
            SqlDataReader lector = comando.ExecuteReader();
            string        i_PlanId, v_IdUnidadProductiva, v_Nombre = "";
            bool          resultPlan = false;
            while (lector.Read())
            {
                i_PlanId             = lector.GetValue(0).ToString();
                v_IdUnidadProductiva = lector.GetValue(1).ToString();
                v_Nombre             = lector.GetValue(2).ToString();
                resultPlan           = true;
            }
            lector.Close();
            conectasam.closesigesoft();
            if (resultPlan)
            {
                cbLine.Text    = v_Nombre;
                cbLine.Enabled = false;
            }
            #endregion
        }
Ejemplo n.º 24
0
        private void btnAgregar_Click(object sender, EventArgs e)
        {
            #region VALIDACION DE DUPLICADOS
            ConexionSigesoft conectasam = new ConexionSigesoft();
            conectasam.opensigesoft();
            var cadena = "select count (*) as result from [dbo].[plan] " +
                         "where v_OrganizationSeguroId='" + _aseguradoraId + "' and v_ProtocoloId='" + _protocolId + "' and v_IdUnidadProductiva='" + txtUnidadProdId.Text + "'";
            SqlCommand comando = new SqlCommand(cadena, connection: conectasam.conectarsigesoft);
            var        lector  = comando.ExecuteReader();
            string     result  = "";
            while (lector.Read())
            {
                result = lector.GetValue(0).ToString();
            }
            lector.Close();
            conectasam.closesigesoft();
            if (result != "0")
            {
                MessageBox.Show("Ya se agrego esta unidad al plan", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            #endregion
            planDto ObjPlan = new planDto();
            ObjPlan.v_OrganizationSeguroId = _aseguradoraId;
            ObjPlan.v_ProtocoloId          = _protocolId;
            ObjPlan.v_IdUnidadProductiva   = txtUnidadProdId.Text;
            ObjPlan.d_Importe     = txtDeducible.Text == "" ? (decimal?)null : decimal.Parse(txtDeducible.Text);
            ObjPlan.i_EsCoaseguro = chkCoaseguro.Checked == true ? 1 : 0;
            ObjPlan.i_EsDeducible = chkDeducible.Checked == true ? 1 : 0;
            ObjPlan.d_ImporteCo   = txtCoaseguro.Text == "" ? (decimal?)null : decimal.Parse(txtCoaseguro.Text);
            #region Conexion SIGESOFT Insert

            conectasam.opensigesoft();
            string cadenanull = "";
            if (ObjPlan.d_Importe == null && ObjPlan.d_ImporteCo != null)
            {
                cadenanull = "INSERT INTO [dbo].[plan] (v_OrganizationSeguroId, v_ProtocoloId, v_IdUnidadProductiva, i_EsDeducible, i_EsCoaseguro, d_Importe, d_ImporteCo) " +
                             "VALUES ('" + ObjPlan.v_OrganizationSeguroId + "', '" + ObjPlan.v_ProtocoloId + "', '" + ObjPlan.v_IdUnidadProductiva + "', " + ObjPlan.i_EsDeducible + ", " + ObjPlan.i_EsCoaseguro + ", " + "NULL" + ", " + ObjPlan.d_ImporteCo + ")";
            }
            else if (ObjPlan.d_ImporteCo == null && ObjPlan.d_Importe != null)
            {
                cadenanull = "INSERT INTO [dbo].[plan] (v_OrganizationSeguroId, v_ProtocoloId, v_IdUnidadProductiva, i_EsDeducible, i_EsCoaseguro, d_Importe, d_ImporteCo) " +
                             "VALUES ('" + ObjPlan.v_OrganizationSeguroId + "', '" + ObjPlan.v_ProtocoloId + "', '" + ObjPlan.v_IdUnidadProductiva + "', " + ObjPlan.i_EsDeducible + ", " + ObjPlan.i_EsCoaseguro + ", " + ObjPlan.d_Importe + ", " + "NULL" + ")";
            }
            else if (ObjPlan.d_ImporteCo != null && ObjPlan.d_Importe != null)
            {
                cadenanull = "INSERT INTO [dbo].[plan] (v_OrganizationSeguroId, v_ProtocoloId, v_IdUnidadProductiva, i_EsDeducible, i_EsCoaseguro, d_Importe, d_ImporteCo) " +
                             "VALUES ('" + ObjPlan.v_OrganizationSeguroId + "', '" + ObjPlan.v_ProtocoloId + "', '" + ObjPlan.v_IdUnidadProductiva + "', " + ObjPlan.i_EsDeducible + ", " + ObjPlan.i_EsCoaseguro + ", " + ObjPlan.d_Importe + ", " + ObjPlan.d_ImporteCo + ")";
            }
            else
            {
                MessageBox.Show("Verifique la información ingresada", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            var cadena1 = cadenanull;
            comando = new SqlCommand(cadena1, connection: conectasam.conectarsigesoft);
            comando.ExecuteReader();
            conectasam.closesigesoft();
            #endregion
            //plan _objPlan = planAssembler.ToEntity(ObjPlan);
            //_objPlan.d_Importe = decimal.Parse(txtDeducible.Text);
            //SigesoftEntitiesModel dbContext = new SigesoftEntitiesModel();
            //dbContext.AddToplan(_objPlan);
            MessageBox.Show("Se agrego correctamente", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information);
            cbLine.Text          = "";
            chkDeducible.Checked = false;
            chkCoaseguro.Checked = false;
            txtDeducible.Text    = "";
            txtCoaseguro.Text    = "";
        }
Ejemplo n.º 25
0
        private void btnExport_Click(object sender, EventArgs e)
        {
            #region Crear Carpeta
            anio = cbAnio.Text; mes = ""; ugi = txtUgi.Text;
            if (cbmes.SelectedValue.ToString().Length == 1)
            {
                mes = "0" + cbmes.SelectedValue.ToString();
            }
            else
            {
                mes = cbmes.SelectedValue.ToString();
            }
            NombreCarpeta = anio + mes + "_SUSALUD";
            rutaapp       = Common.Utils.GetApplicationConfigValue("rutaTramas").ToString();
            CrearCarpeta(NombreCarpeta, rutaapp);
            #endregion

            #region  Ambulatorio (Tablas AB1-AB2)
            #region Conexion SAM
            ConexionSigesoft conectasam = new ConexionSigesoft();
            conectasam.opensigesoft();
            #endregion
            #region Select
            var           cadena1 = "select i_Genero, i_GrupoEtario, v_CIE10Id from Tramas where MONTH(d_FechaIngreso)=" + mes + " and YEAR(d_FechaIngreso)=" + anio + " and v_TipoRegistro='Ambulatorio' and i_IsDeleted=0";
            SqlCommand    comando = new SqlCommand(cadena1, connection: conectasam.conectarsigesoft);
            SqlDataReader lector  = comando.ExecuteReader();
            while (lector.Read())
            {
                AgeGenderList.Add(lector.GetValue(0).ToString() + "|" + lector.GetValue(1).ToString());
                DiagnosticList.Add(lector.GetValue(0).ToString() + "|" + lector.GetValue(1).ToString() + "|" + lector.GetValue(2).ToString());
            }
            lector.Close();
            #endregion
            #region Contar DiagnosticCount
            foreach (var item in DiagnosticList)
            {
                var count = DiagnosticList.FindAll(p => p == item).ToList().Count;
                DiagnosticCount.Add(item + "|" + count.ToString());
            }
            DiagnosticCount = DiagnosticCount.Distinct().ToList();
            foreach (var item in AgeGenderList)
            {
                var count = AgeGenderList.FindAll(p => p == item).ToList().Count;
                AgeGenderCount.Add(item + "|" + count.ToString());
            }
            AgeGenderCount = AgeGenderCount.Distinct().ToList();
            #endregion
            #region Generar TXT
            GenerartxtAB1();
            GenerartxtAB2();
            #endregion
            #endregion

            #region  Emergencia (Tablas C1-C2)
            #region Select
            cadena1 = "select i_Genero, i_GrupoEtario, v_CIE10Id from Tramas where MONTH(d_FechaIngreso)=" + mes + " and YEAR(d_FechaIngreso)=" + anio + " and v_TipoRegistro='Emergencia' and i_IsDeleted=0";
            comando = new SqlCommand(cadena1, connection: conectasam.conectarsigesoft);
            lector  = comando.ExecuteReader();
            while (lector.Read())
            {
                AgeGenderListEmer.Add(lector.GetValue(0).ToString() + "|" + lector.GetValue(1).ToString());
                DiagnosticListEmer.Add(lector.GetValue(0).ToString() + "|" + lector.GetValue(1).ToString() + "|" + lector.GetValue(2).ToString());
            }
            lector.Close();
            #endregion
            #region Contar DiagnosticCountEmer
            foreach (var item in DiagnosticListEmer)
            {
                var count = DiagnosticListEmer.FindAll(p => p == item).ToList().Count;
                DiagnosticCountEmer.Add(item + "|" + count.ToString());
            }
            DiagnosticCountEmer = DiagnosticCountEmer.Distinct().ToList();
            foreach (var item in AgeGenderListEmer)
            {
                var count = AgeGenderListEmer.FindAll(p => p == item).ToList().Count;
                AgeGenderCountEmer.Add(item + "|" + count.ToString());
            }
            AgeGenderCountEmer = AgeGenderCountEmer.Distinct().ToList();
            #endregion
            #region Generar TXT
            GenerartxtC1();
            GenerartxtC2();
            #endregion

            #endregion

            #region  Hospi (Tablas D1-D2)
            #region Select
            cadena1 = "select i_Genero, i_GrupoEtario, v_CIE10Id, d_FechaIngreso, d_FechaAlta, i_UPS, i_Procedimiento, v_TramaId  from Tramas where MONTH(d_FechaIngreso)=" + mes + " and YEAR(d_FechaIngreso)=" + anio + " and v_TipoRegistro='Hospitalización' and i_IsDeleted=0";
            comando = new SqlCommand(cadena1, connection: conectasam.conectarsigesoft);
            lector  = comando.ExecuteReader();
            while (lector.Read())
            {
                if (lector.GetValue(3).ToString() != null)
                {
                    HospiIngreso = "|SI|";
                }
                else
                {
                    HospiIngreso = "|NO|" + "";
                }
                if (lector.GetValue(4).ToString() != null)
                {
                    HospiEgreso = "|SI|";
                }
                else
                {
                    HospiEgreso = "|NO|" + "";
                }
                UPSIngresoList.Add(lector.GetValue(5).ToString() + HospiIngreso);
                UPSEgresoList.Add(lector.GetValue(5).ToString() + HospiEgreso);
                FechasLis.Add(lector.GetValue(5).ToString() + "|" + lector.GetValue(3).ToString() + "|" + lector.GetValue(4).ToString() + "|" + lector.GetValue(7).ToString());
                UPSList.Add(lector.GetValue(5).ToString());
                HospiList.Add(lector.GetValue(0).ToString() + "|" + lector.GetValue(1).ToString() + "|" + lector.GetValue(2).ToString());
                HospiFallecidoList.Add(lector.GetValue(5).ToString() + "|" + lector.GetValue(6).ToString());
            }
            lector.Close();
            #endregion
            #region Contar UPSIngresoList
            foreach (var item in UPSIngresoList)
            {
                var count = UPSIngresoList.FindAll(p => p == item).ToList().Count;
                UPSIngresoCount.Add(item + count.ToString());
            }
            UPSIngresoCount = UPSIngresoCount.Distinct().ToList();
            foreach (var item in UPSEgresoList)
            {
                var count = UPSEgresoList.FindAll(p => p == item).ToList().Count;
                UPSEgresoCount.Add(item + count.ToString());
            }
            UPSEgresoCount = UPSEgresoCount.Distinct().ToList();
            foreach (var item in FechasLis)
            {
                string[] itemsplit   = item.Split('|');
                DateTime DateInicial = DateTime.Parse(itemsplit[1]);
                if (itemsplit[2] != null)
                {
                    DateTime DateFinal      = DateTime.Parse(itemsplit[2]);
                    var      tiempoestancia = DateFinal - DateInicial;
                    string[] tiemposplit    = tiempoestancia.ToString().Split(':');
                    double   tiempo         = double.Parse(tiemposplit[0]);
                    FechasCount.Add(itemsplit[0] + "|" + tiempo.ToString() + "|" + itemsplit[3]);
                }
                else
                {
                    FechasCount.Add(itemsplit[0] + itemsplit[3]);
                }
            }
            FechasCount = FechasCount.Distinct().ToList();
            foreach (var item in FechasCount)
            {
                double   acumulador = 0;
                string[] itemsplit  = item.Split('|');
                foreach (var item1 in FechasCount)
                {
                    string[] itemsplit1 = item1.Split('|');
                    if ((itemsplit[0] == itemsplit1[0]) && (itemsplit[2] != itemsplit1[2]))
                    {
                        acumulador = acumulador + double.Parse(itemsplit1[1]);
                    }
                }
                acumulador = acumulador + double.Parse(itemsplit[1]);
                acumulador = Math.Round(acumulador, 0);
                Estancia.Add(itemsplit[0] + "|" + acumulador.ToString());
            }
            Estancia = Estancia.Distinct().ToList();
            foreach (var item in UPSList)
            {
                var count = UPSList.FindAll(p => p == item).ToList().Count;
                UPSCount.Add(item + "|" + count.ToString());
            }
            UPSCount = UPSCount.Distinct().ToList();
            foreach (var item in HospiList)
            {
                var count = HospiList.FindAll(p => p == item).ToList().Count;
                HospiCount.Add(item + "|" + count.ToString());
            }
            HospiCount = HospiCount.Distinct().ToList();
            foreach (var item in HospiFallecidoList)
            {
                var count = HospiFallecidoList.FindAll(p => p == item).ToList().Count;
                HospiFallecidoCount.Add(item + "|" + count.ToString());
            }
            HospiFallecidoCount = HospiFallecidoCount.Distinct().ToList();
            #endregion
            #region Generar TXT
            GenerartxtD1();
            GenerartxtD2();
            #endregion

            #endregion

            #region  Partos (Tabla E0)
            #region Select
            cadena1 = "select i_TipoParto, i_TipoNacimiento, i_TipoComplicacion from Tramas where MONTH(d_FechaIngreso)=" + mes + " and YEAR(d_FechaIngreso)=" + anio + " and v_TipoRegistro='Partos' and i_IsDeleted=0";
            comando = new SqlCommand(cadena1, connection: conectasam.conectarsigesoft);
            lector  = comando.ExecuteReader();
            while (lector.Read())
            {
                string nacimientovivo = "";
                if (lector.GetValue(1).ToString() == "1")
                {
                    nacimientovivo = "VIVO";
                }
                else
                {
                    nacimientovivo = "MUERTO";
                }
                PartoComplicacionList.Add(lector.GetValue(0).ToString() + "|" + lector.GetValue(2).ToString());
                PartoComplicacionVivosList.Add(lector.GetValue(0).ToString() + "|" + lector.GetValue(2).ToString() + "|" + nacimientovivo);
            }
            lector.Close();
            #endregion
            #region Contar PartoComplicacionList
            foreach (var item in PartoComplicacionList)
            {
                var count = PartoComplicacionList.FindAll(p => p == item).ToList().Count;
                PartoComplicacionCount.Add(item + "|" + count.ToString());
            }
            PartoComplicacionCount = PartoComplicacionCount.Distinct().ToList();
            foreach (var item in PartoComplicacionVivosList)
            {
                var count = PartoComplicacionVivosList.FindAll(p => p == item).ToList().Count;
                PartoComplicacionVivosCount.Add(item + "|" + count.ToString());
            }
            PartoComplicacionVivosCount = PartoComplicacionVivosCount.Distinct().ToList();
            #endregion
            #region Generar TXT
            GenerartxtE0();
            #endregion

            #endregion

            #region  Procedimientos (Tabla G0)
            #region Select
            cadena1 = "select i_Procedimiento, i_UPS  from Tramas where MONTH(d_FechaIngreso)=" + mes + " and YEAR(d_FechaIngreso)=" + anio + " and v_TipoRegistro='Procedimientos / Cirugía' and i_IsDeleted=0";
            comando = new SqlCommand(cadena1, connection: conectasam.conectarsigesoft);
            lector  = comando.ExecuteReader();
            while (lector.Read())
            {
                ProcedimientoList.Add(lector.GetValue(0).ToString() + "|" + lector.GetValue(1).ToString());
            }
            lector.Close();
            #endregion
            #region Contar DiagnosticCount
            foreach (var item in ProcedimientoList)
            {
                var count = ProcedimientoList.FindAll(p => p == item).ToList().Count;
                ProcedimientoCount.Add(item + "|" + count.ToString());
            }
            ProcedimientoCount = ProcedimientoCount.Distinct().ToList();
            #endregion
            #region Generar TXT
            GenerartxtG0();
            #endregion
            #endregion

            #region  Cirugia (Tabla H0)
            #region Select
            cadena1 = "select i_Programacion, i_TipoCirugia, i_HorasProg, i_HorasEfect, i_HorasActo, v_TramaId   from Tramas where MONTH(d_FechaIngreso)=" + mes + " and YEAR(d_FechaIngreso)=" + anio + " and v_TipoRegistro='Procedimientos / Cirugía' and i_IsDeleted=0";
            comando = new SqlCommand(cadena1, connection: conectasam.conectarsigesoft);
            lector  = comando.ExecuteReader();
            while (lector.Read())
            {
                if (lector.GetValue(0).ToString() == "1" && lector.GetValue(1).ToString() == "1")
                {
                    ProgMayorList.Add(lector.GetValue(0).ToString() + "|" + lector.GetValue(1).ToString());
                    ProgMayorHorasProg  = ProgMayorHorasProg + int.Parse(lector.GetValue(2).ToString());
                    ProgMayorHorasEfect = ProgMayorHorasEfect + int.Parse(lector.GetValue(3).ToString());
                    ProgMayorHorasAct   = ProgMayorHorasAct + int.Parse(lector.GetValue(4).ToString());
                }
                else if (lector.GetValue(0).ToString() == "1" && lector.GetValue(1).ToString() == "2")
                {
                    ProgMenorList.Add(lector.GetValue(0).ToString() + "|" + lector.GetValue(1).ToString());
                    ProgMenorHorasProg  = ProgMenorHorasProg + int.Parse(lector.GetValue(2).ToString());
                    ProgMenorHorasEfect = ProgMayorHorasEfect + int.Parse(lector.GetValue(3).ToString());
                    ProgMenorHorasAct   = ProgMayorHorasAct + int.Parse(lector.GetValue(4).ToString());
                }
                else if (lector.GetValue(0).ToString() == "2" && lector.GetValue(1).ToString() == "1")
                {
                    EmergMayorList.Add(lector.GetValue(0).ToString() + "|" + lector.GetValue(1).ToString());
                    EmerMayorHorasProg  = EmerMayorHorasProg + int.Parse(lector.GetValue(2).ToString());
                    EmerMayorHorasEfect = EmerMayorHorasEfect + int.Parse(lector.GetValue(3).ToString());
                    EmerMayorHorasAct   = EmerMayorHorasAct + int.Parse(lector.GetValue(4).ToString());
                }
                else if (lector.GetValue(0).ToString() == "2" && lector.GetValue(1).ToString() == "2")
                {
                    EmergMenorList.Add(lector.GetValue(0).ToString() + "|" + lector.GetValue(1).ToString());
                    EmerMenorHorasProg  = EmerMenorHorasProg + int.Parse(lector.GetValue(2).ToString());
                    EmerMenorHorasEfect = EmerMenorHorasEfect + int.Parse(lector.GetValue(3).ToString());
                    EmerMenorHorasAct   = EmerMenorHorasAct + int.Parse(lector.GetValue(4).ToString());
                }
                else if (lector.GetValue(0).ToString() == "3" && lector.GetValue(1).ToString() == "1")
                {
                    SuspMayorList.Add(lector.GetValue(0).ToString() + "|" + lector.GetValue(1).ToString());
                    SusMayorHorasProg  = EmerMayorHorasProg + int.Parse(lector.GetValue(2).ToString());
                    SusMayorHorasEfect = EmerMayorHorasEfect + int.Parse(lector.GetValue(3).ToString());
                    SusMayorHorasAct   = EmerMayorHorasAct + int.Parse(lector.GetValue(4).ToString());
                }
                else if (lector.GetValue(0).ToString() == "3" && lector.GetValue(1).ToString() == "2")
                {
                    SuspMenorList.Add(lector.GetValue(0).ToString() + "|" + lector.GetValue(1).ToString());
                    SusMenorHorasProg  = EmerMenorHorasProg + int.Parse(lector.GetValue(2).ToString());
                    SusMenorHorasEfect = EmerMenorHorasEfect + int.Parse(lector.GetValue(3).ToString());
                    SusMenorHorasAct   = EmerMenorHorasAct + int.Parse(lector.GetValue(4).ToString());
                }
            }
            lector.Close();
            #endregion
            #region Contar ProgMayorList
            foreach (var item in ProgMayorList)
            {
                var count = ProgMayorList.FindAll(p => p == item).ToList().Count;
                ProgMayorCount.Add(item + "|" + count.ToString());
            }
            ProgMayorCount = ProgMayorCount.Distinct().ToList();
            foreach (var item in ProgMenorList)
            {
                var count = ProgMenorList.FindAll(p => p == item).ToList().Count;
                ProgMenorCount.Add(item + "|" + count.ToString());
            }
            ProgMenorCount = ProgMenorCount.Distinct().ToList();

            foreach (var item in EmergMayorList)
            {
                var count = EmergMayorList.FindAll(p => p == item).ToList().Count;
                EmergMayorCount.Add(item + "|" + count.ToString());
            }
            EmergMayorCount = EmergMayorCount.Distinct().ToList();
            foreach (var item in EmergMenorList)
            {
                var count = EmergMenorList.FindAll(p => p == item).ToList().Count;
                EmergMenorCount.Add(item + "|" + count.ToString());
            }
            EmergMenorCount = EmergMenorCount.Distinct().ToList();

            foreach (var item in SuspMayorList)
            {
                var count = SuspMayorList.FindAll(p => p == item).ToList().Count;
                SuspMayorCount.Add(item + "|" + count.ToString());
            }
            SuspMayorCount = SuspMayorCount.Distinct().ToList();
            foreach (var item in SuspMenorList)
            {
                var count = SuspMenorList.FindAll(p => p == item).ToList().Count;
                SuspMenorCount.Add(item + "|" + count.ToString());
            }
            SuspMenorCount = SuspMenorCount.Distinct().ToList();

            #endregion
            #region Generar TXT
            GenerartxtH0();
            #endregion
            #endregion

            conectasam.closesigesoft();
            this.Close();
            MessageBox.Show("Generación Exitosa", "Informe", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
Ejemplo n.º 26
0
        private void frmContainerEso_FormClosing(object sender, FormClosingEventArgs e)
        {
            Globals.ClientSession.i_SystemUserId = Globals.ClientSession.i_SystemUserCopyId;
            OperationResult objOperationResult = new OperationResult();
            ServiceBL       objServiceBL       = new ServiceBL();

            foreach (var item in _KeyValueDTO)
            {
                if (item.Id != "-1")
                {
                    var        alert         = objServiceBL.GetServiceComponentsCulminados(ref objOperationResult, item.Id);
                    serviceDto objserviceDto = new serviceDto();
                    objserviceDto = objServiceBL.GetService(ref objOperationResult, item.Id);
                    if (alert.Count == 0 || alert == null)
                    {
                        Sigesoft.Common.ConexionSigesoft conexionSigesoft = new ConexionSigesoft();
                        conexionSigesoft.opensigesoft();
                        var cadena =
                            "select i_MasterServiceId, i_AptitudeStatusId, v_FirstLastName+' '+v_SecondLastName+', '+v_FirstName, i_ServiceStatusId " +
                            "from service SR " +
                            "inner join person PP on SR.v_PersonId=PP.v_PersonId " +
                            "where v_ServiceId='" + item.Id + "'";
                        SqlCommand    comando        = new SqlCommand(cadena, connection: conexionSigesoft.conectarsigesoft);
                        SqlDataReader lector         = comando.ExecuteReader();
                        string        masterService  = "0";
                        string        aptirudService = "0";
                        string        name           = "";
                        string        serviceStatus  = "";
                        while (lector.Read())
                        {
                            masterService  = lector.GetValue(0).ToString();
                            aptirudService = lector.GetValue(1).ToString();
                            name           = lector.GetValue(2).ToString();
                            serviceStatus  = lector.GetValue(3).ToString();
                        }

                        if (int.Parse(masterService) == (int)MasterService.AtxMedicaParticular || int.Parse(masterService) == (int)MasterService.AtxMedicaSeguros)
                        {
                            if (int.Parse(serviceStatus) != (int)ServiceStatus.Culminado)
                            {
                                MessageBox.Show("El servicio: " + item.Id + " del paciente: " + name + ", se ha concluido correctamente.", "INFORMACIÓN!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                objserviceDto = objServiceBL.GetService(ref objOperationResult, item.Id);
                                objserviceDto.i_ServiceStatusId  = (int)ServiceStatus.Culminado;
                                objserviceDto.v_Motive           = "Culminado";
                                objserviceDto.i_AptitudeStatusId = (int)AptitudeStatus.Asistencial;
                                objServiceBL.UpdateService(ref objOperationResult, objserviceDto, Globals.ClientSession.GetAsList());
                            }
                        }
                        else if (int.Parse(masterService) == (int)MasterService.Eso)
                        {
                            if (int.Parse(aptirudService) == (int)AptitudeStatus.SinAptitud)
                            {
                                MessageBox.Show("Todos los Examenes del servicio: " + item.Id + " del paciente: " + name + ", se encuentran concluidos.\nEl estado de la Atención es: En espera de Aptitud.", "INFORMACIÓN!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                objserviceDto = objServiceBL.GetService(ref objOperationResult, item.Id);
                                objserviceDto.i_ServiceStatusId = (int)ServiceStatus.EsperandoAptitud;
                                objserviceDto.v_Motive          = "Esperando Aptitud";
                                objServiceBL.UpdateService(ref objOperationResult, objserviceDto, Globals.ClientSession.GetAsList());
                            }
                            else
                            {
                                if (int.Parse(serviceStatus) != (int)ServiceStatus.Culminado)
                                {
                                    MessageBox.Show("El servicio: " + item.Id + " del paciente: " + name + ", se ha concluido correctamente.", "INFORMACIÓN!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                    objserviceDto = objServiceBL.GetService(ref objOperationResult, item.Id);
                                    objserviceDto.i_ServiceStatusId = (int)ServiceStatus.Culminado;
                                    objserviceDto.v_Motive          = "Culminado Automático";
                                    objServiceBL.UpdateService(ref objOperationResult, objserviceDto, Globals.ClientSession.GetAsList());
                                }
                            }
                        }
                    }
                }
            }
        }
        public static void CreatePago_Especialsta_Report(string monto1, string fechaInicio1, string fechaFin1, string usuarioMedico1, int usuarioPaga1, List <string> ids1, string ruta, string filePDF, organizationDto infoEmpresa)
        {
            Document document = new Document(PageSize.A5, 15f, 15f, 15f, 40f);

            document.SetPageSize(iTextSharp.text.PageSize.A5);

            PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(filePDF, FileMode.Create));
            pdfPage   page   = new pdfPage();

            writer.PageEvent = page;
            document.Open();

            #region Declaration Tables
            var             subTitleBackGroundColor = new BaseColor(System.Drawing.Color.Gray);
            string          include       = string.Empty;
            List <PdfPCell> cells         = null;
            float[]         columnWidths  = null;
            string[]        columnValues  = null;
            string[]        columnHeaders = null;
            PdfPTable       header2       = new PdfPTable(6);
            header2.HorizontalAlignment = Element.ALIGN_CENTER;
            header2.WidthPercentage     = 100;
            float[] widths1 = new float[] { 16.6f, 18.6f, 16.6f, 16.6f, 16.6f, 16.6f };
            header2.SetWidths(widths1);
            PdfPTable companyData = new PdfPTable(6);
            companyData.HorizontalAlignment = Element.ALIGN_CENTER;
            companyData.WidthPercentage     = 100;
            float[] widthscolumnsCompanyData = new float[] { 16.6f, 16.6f, 16.6f, 16.6f, 16.6f, 16.6f };
            companyData.SetWidths(widthscolumnsCompanyData);
            PdfPTable filiationWorker = new PdfPTable(4);
            PdfPTable table           = null;
            PdfPCell  cell            = null;
            document.Add(new Paragraph("\r\n"));
            #endregion

            #region Fonts
            Font fontTitle1               = FontFactory.GetFont("Calibri", 10, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black));
            Font fontTitle2               = FontFactory.GetFont("Calibri", 7, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black));
            Font fontTitleTable           = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black));
            Font fontTitleTableNegro      = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black));
            Font fontSubTitle             = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.White));
            Font fontSubTitleNegroNegrita = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black));

            Font fontColumnValue         = FontFactory.GetFont("Calibri", 7, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black));
            Font fontColumnValueBold     = FontFactory.GetFont("Calibri", 7, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black));
            Font fontColumnValueApendice = FontFactory.GetFont("Calibri", 5, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black));

            Font fontTitleTableAntecedentesOcupacionales  = FontFactory.GetFont("Arial", 5, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black));
            Font fontColumnValueAntecedentesOcupacionales = FontFactory.GetFont("Arial", 5, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black));
            #endregion

            var tamaño_celda  = 18f;
            var tamaño_celda2 = 60f;

            #region Conexion Sigesoft
            ConexionSigesoft conectaSigesoft = new ConexionSigesoft();
            conectaSigesoft.opensigesoft();
            #endregion

            #region Fecha
            string   anioinicio = fechaInicio1.Substring(6, 4);
            string   mesinicio  = fechaInicio1.Substring(3, 2);
            string   diainicio  = fechaInicio1.Substring(0, 2);
            DateTime localDate  = DateTime.Now;
            #endregion

            #region Title

            var fechain   = fechaInicio1.Split(' ');
            var fechafin  = fechaFin1.Split(' ');
            var rutaImg   = GetApplicationConfigValue("Logo");
            var imageLogo = new PdfPCell(GetImageLogo(rutaImg.ToString(), null, null, 120, 50))
            {
                HorizontalAlignment = PdfPCell.ALIGN_CENTER
            };

            #region Obtener usuarios

            var cadena1 = "select PP.v_FirstName+' '+PP.v_FirstLastName+' '+PP.v_SecondLastName, v_UserName from systemuser SU " +
                          "Inner join person PP " +
                          "On SU.v_PersonId=PP.v_PersonId " +
                          "where i_SystemUserId=" + usuarioPaga1;
            SqlCommand    comando1 = new SqlCommand(cadena1, connection: conectaSigesoft.conectarsigesoft);
            SqlDataReader lector1 = comando1.ExecuteReader();
            String        cajanombre = "", cajauser = "";
            while (lector1.Read())
            {
                cajanombre = lector1.GetValue(0).ToString();
                cajauser   = lector1.GetValue(1).ToString();
            }
            lector1.Close();
            #endregion
            cells = new List <PdfPCell>()
            {
                new PdfPCell(imageLogo)
                {
                    Rowspan = 1, HorizontalAlignment = PdfPCell.ALIGN_CENTER, MinimumHeight = tamaño_celda2, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE
                },
                new PdfPCell(new Phrase("PAGO MÉDICO ESPECIALISTA ", fontTitle1))
                {
                    Rowspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda2, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE
                },
                new PdfPCell(new Phrase(" usuario: " + cajauser + "\r\n Desde: " + fechain[0] + "\r\n Hasta: " + fechafin[0], fontColumnValueBold))
                {
                    Rowspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda2, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE
                },
            };
            columnWidths    = new float[] { 35f, 35f, 30f };
            filiationWorker = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, fontTitleTableNegro, null);
            document.Add(filiationWorker);

            #endregion

            #region Cabecera
            cells = new List <PdfPCell>()
            {
                new PdfPCell(new Phrase("Nombre del Paciente", fontColumnValueBold))
                {
                    BackgroundColor = BaseColor.LIGHT_GRAY, Rowspan = 1, HorizontalAlignment = PdfPCell.ALIGN_CENTER, MinimumHeight = tamaño_celda, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE
                },
                new PdfPCell(new Phrase("Protocolo de Atención", fontColumnValueBold))
                {
                    BackgroundColor = BaseColor.LIGHT_GRAY, Rowspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda
                },
                new PdfPCell(new Phrase("Fecha", fontColumnValueBold))
                {
                    BackgroundColor = BaseColor.LIGHT_GRAY, Rowspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda
                },
            };
            columnWidths    = new float[] { 42f, 42f, 15f };
            filiationWorker = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, fontTitleTableNegro, null);
            document.Add(filiationWorker);
            #endregion

            #region Detalle
            foreach (var serviceId in ids1)
            {
                var ids = serviceId.Split('|');
                foreach (var id in ids)
                {
                    var r = id;
                    #region Query
                    var cadena = "Select PP.v_FirstName+', '+PP.v_FirstLastName+' '+PP.v_SecondLastName as Persona, " +
                                 "PR.v_Name as Protocolo, d_ServiceDate as Fecha " +
                                 "from service SR " +
                                 "Inner Join person PP " +
                                 " On SR.v_PersonId = PP.v_PersonId " +
                                 "Inner Join protocol PR " +
                                 "On SR.v_ProtocolId = PR.v_ProtocolId " +
                                 "where SR.v_ServiceId='" + id + "'";
                    #endregion

                    #region Lector Open
                    SqlCommand    comando = new SqlCommand(cadena, connection: conectaSigesoft.conectarsigesoft);
                    SqlDataReader lector  = comando.ExecuteReader();
                    #endregion

                    #region Llenar Detalle
                    while (lector.Read())
                    {
                        var fecha = lector.GetValue(2).ToString().Split(' ');
                        cells = new List <PdfPCell>()
                        {
                            new PdfPCell(new Phrase(lector.GetValue(0).ToString(), fontColumnValue))
                            {
                                Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK
                            },
                            new PdfPCell(new Phrase(lector.GetValue(1).ToString(), fontColumnValue))
                            {
                                Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK
                            },
                            new PdfPCell(new Phrase(fecha[0].ToString(), fontColumnValue))
                            {
                                Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK
                            },
                        };
                        columnWidths    = new float[] { 42f, 42f, 15f };
                        filiationWorker = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, fontTitleTableNegro, null);
                        document.Add(filiationWorker);
                    }
                    lector.Close();
                    #endregion
                }
            }
            #endregion

            #region Recibido
            cells = new List <PdfPCell>()
            {
                new PdfPCell(new Phrase("Documento emitido por:", fontColumnValueBold))
                {
                    BackgroundColor = BaseColor.LIGHT_GRAY, Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK
                },
                new PdfPCell(new Phrase("Dr(a) Especialista", fontColumnValueBold))
                {
                    BackgroundColor = BaseColor.LIGHT_GRAY, Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK
                },
                new PdfPCell(new Phrase("Monto a pagar:", fontColumnValueBold))
                {
                    BackgroundColor = BaseColor.LIGHT_GRAY, Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK
                },

                new PdfPCell(new Phrase(cajanombre, fontColumnValueBold))
                {
                    Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK
                },
                new PdfPCell(new Phrase(usuarioMedico1, fontColumnValueBold))
                {
                    Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK
                },
                new PdfPCell(new Phrase(monto1, fontColumnValueBold))
                {
                    Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK
                },

                new PdfPCell(new Phrase("Firma Emisor:", fontColumnValue))
                {
                    Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda2, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK
                },
                new PdfPCell(new Phrase("Recibi conforme:", fontColumnValue))
                {
                    Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda2, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK
                },
                new PdfPCell(new Phrase("Fecha y hora" + "\rde Impresión: \r" + localDate, fontColumnValue))
                {
                    Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda2, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK
                },
            };
            columnWidths    = new float[] { 42f, 42f, 15f };
            filiationWorker = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, fontTitleTableNegro, null);
            document.Add(filiationWorker);


            #endregion

            document.Close();
            writer.Close();
            writer.Dispose();
            RunFile(filePDF);
        }
Ejemplo n.º 28
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (cboMedico.SelectedValue.ToString() == "-1")
            {
                MessageBox.Show("Seleccionar un médico tratante", " ¡ VALIDACIÓN!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
            if (_auxiliaryExams == null)
            {
                _auxiliaryExams = new List <ServiceComponentList>();
            }

            // Save ListView / recorrer la lista de examenes seleccionados
            foreach (ListViewItem item in lvExamenesSeleccionados.Items)
            {
                var fields           = item.SubItems;
                var ComponentId      = fields[1].Text.Split('|');
                var NombreComponente = fields[0].Text.Split('|');



                MedicalExamBL objComponentBL  = new MedicalExamBL();
                componentDto  objComponentDto = new componentDto();

                OperationResult objOperationResult = new OperationResult();
                foreach (var scid in ComponentId)
                {
                    var conCargoA = -1;
                    if (_type == "Hospi")
                    {
                        var oFrmType = new frmType();
                        oFrmType.ShowDialog();

                        if (oFrmType._conCargoA == "Médico")
                        {
                            conCargoA = 1;
                        }
                        else
                        {
                            conCargoA = 2;
                        }
                    }

                    objComponentDto = objComponentBL.GetMedicalExam(ref objOperationResult, scid);
                    SystemParameterBL oSp = new SystemParameterBL();
                    var o = oSp.GetSystemParameter(ref objOperationResult, 116, int.Parse(objComponentDto.i_CategoryId.ToString()));
                    //Lógica de Aumento de Precio Base

                    var porcentajes = o.v_Field.Split('-');

                    float p1 = porcentajes[0] == null ? 0 : float.Parse(porcentajes[0].ToString());

                    float p2 = porcentajes[1] == null ? 0 : float.Parse(porcentajes[1].ToString());

                    float pb          = objComponentDto.r_BasePrice.Value;
                    var   precio_base = pb + (pb * p1 / 100) + (pb * p2 / 100);
                    //FormPrecioComponente frm = new FormPrecioComponente("", "", "");
                    //frmConfigSeguros frm1 = new frmConfigSeguros(0, 0, 0, "", "");
                    ServiceComponentList auxiliaryExam          = new ServiceComponentList();
                    servicecomponentDto  objServiceComponentDto = new servicecomponentDto();
                    ServiceBL            _ObjServiceBL          = new ServiceBL();
                    TicketBL             oTicketBL = new TicketBL();
                    if (_modo == "ASEGU")
                    {
                        #region OLD Logica antigua
                        #region Conexion SAM
                        //ConexionSigesoft conectasam = new ConexionSigesoft();
                        //conectasam.opensigesoft();
                        #endregion
                        #region Query
                        //var componente = NombreComponente[0].ToString();
                        //var cadena1 = "select PL.i_EsDeducible, PL.i_EsCoaseguro, PL.d_Importe, PL.d_ImporteCo from [dbo].[plan] PL where PL.v_IdUnidadProductiva='" + lineId + "' and PL.v_ProtocoloId='" + _protocolId + "' ";
                        //SqlCommand comando = new SqlCommand(cadena1, connection: conectasam.conectarsigesoft);
                        //SqlDataReader lector = comando.ExecuteReader();
                        //int deducible = 0;
                        //int coaseguro = 0;
                        //decimal? importe = 0;
                        //decimal? importeCo = 0;
                        //while (lector.Read())
                        //{
                        //    deducible = int.Parse(lector.GetValue(0).ToString()); coaseguro = int.Parse(lector.GetValue(1).ToString()); importe = decimal.Parse(lector.GetValue(2).ToString()); importeCo = decimal.Parse(lector.GetValue(3).ToString());
                        //}
                        //lector.Close();
                        //string factores = ""; string aseguradoraName = ""; string organizationId = "";
                        //var factorGlobal = "";
                        //var cadena2 = "select PR.r_PriceFactor, OO.v_Name, PR.v_CustomerOrganizationId from Organization OO inner join protocol PR On PR.v_AseguradoraOrganizationId = OO.v_OrganizationId where PR.v_ProtocolId ='" + _protocolId + "'";
                        //comando = new SqlCommand(cadena2, connection: conectasam.conectarsigesoft);
                        //lector = comando.ExecuteReader();
                        //while (lector.Read())
                        //{
                        //    factores = lector.GetValue(0).ToString();
                        //    var factorArray = factores.Split('|');// factores[0].ToString().Split('|');
                        //    factorGlobal = factorArray[0];
                        //    aseguradoraName = lector.GetValue(1).ToString();
                        //    organizationId = lector.GetValue(2).ToString();
                        //}
                        //lector.Close();
                        //string empresa = "";
                        //var cadena3 = "select v_Name from Organization OO  where OO.v_OrganizationId ='" + organizationId + "'";
                        //comando = new SqlCommand(cadena3, connection: conectasam.conectarsigesoft);
                        //lector = comando.ExecuteReader();
                        //while (lector.Read())
                        //{
                        //    empresa = lector.GetValue(0).ToString();
                        //}
                        //lector.Close();
                        #endregion
                        #region Lógica PARA SABER SI ES DEDUCIBLE O COASEGURO
                        //if (rbNuevaConsulta.Checked)// QUIERE DECIR QUE ES UNA NUEVA ATENCION Y DEBE SER CONSIDERADO COMO DEDUCIBLE SIN FACTOR
                        //{
                        //    factorGlobal = "1";
                        //    coaseguro = 0;
                        //    importeCo = null;
                        //}
                        //else if (rbAdicional.Checked) // QUIERE DECIR QUE ES UN COMPONENTE ADICIONAL Y DEBE SER CONSIDERADO COMO COASEGURO CON FACTOR
                        //{
                        //    deducible = 0;
                        //    importe = null;
                        //}
                        #endregion
                        #region Formulario
                        //precio_base = (float)objComponentDto.r_PriceSegus;// se cambia el precio inicial por el SEGUS
                        //frmConfigSeguros frm1 = new frmConfigSeguros(deducible, coaseguro, importe, precio_base.ToString(), factorGlobal, importeCo);
                        //frm1.Text = aseguradoraName + " / " + empresa;
                        //frm1.ShowDialog();
                        #endregion
                        #endregion

                        #region Obteniendo los campos de la BD
                        ConexionSigesoft conectasam = new ConexionSigesoft();
                        conectasam.opensigesoft();
                        var           componente      = NombreComponente[0].ToString();
                        var           cadena          = "select i_KindOfService from  component where v_ComponentId='" + objComponentDto.v_ComponentId + "'";
                        SqlCommand    comando         = new SqlCommand(cadena, connection: conectasam.conectarsigesoft);
                        SqlDataReader lector          = comando.ExecuteReader();
                        int           i_KindOfService = 0;
                        while (lector.Read())
                        {
                            try
                            {
                                i_KindOfService = int.Parse(lector.GetValue(0).ToString());
                            }
                            catch (Exception exception)
                            {
                                MessageBox.Show(exception.Message, " ¡ ERROR !", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                return;
                            }
                        }
                        lector.Close();
                        var cadena1 = "select PL.i_PlanId, PL.i_EsCoaseguro, PL.d_Importe, PL.d_ImporteCo " +
                                      "from [dbo].[plan] PL " +
                                      "where PL.v_IdUnidadProductiva='" + lineId + "' and PL.v_ProtocoloId='" + _protocolId + "' ";
                        comando = new SqlCommand(cadena1, connection: conectasam.conectarsigesoft);
                        lector  = comando.ExecuteReader();
                        string PlanId = ""; int coaseguro = 0; decimal?importe = 0; decimal?importeCo = 0;
                        while (lector.Read())
                        {
                            try
                            {
                                PlanId    = lector.GetValue(0).ToString();
                                coaseguro = int.Parse(lector.GetValue(1).ToString());
                                importe   = decimal.Parse(lector.GetValue(2).ToString());
                                importeCo = decimal.Parse(lector.GetValue(3).ToString());
                            }
                            catch (Exception exception)
                            {
                                MessageBox.Show(exception.Message, " ¡ ERROR !", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                return;
                            }
                        }
                        lector.Close();
                        string factores = ""; string aseguradoraName = ""; string organizationId = ""; var factorGlobal = "";
                        var    cadena2 = "select PR.r_PriceFactor, OO.v_Name, PR.v_CustomerOrganizationId " +
                                         "from Organization OO " +
                                         "inner join protocol PR On PR.v_AseguradoraOrganizationId = OO.v_OrganizationId " +
                                         "where PR.v_ProtocolId ='" + _protocolId + "'";
                        comando = new SqlCommand(cadena2, connection: conectasam.conectarsigesoft);
                        lector  = comando.ExecuteReader();
                        while (lector.Read())
                        {
                            try
                            {
                                factores = lector.GetValue(0).ToString();
                                var factorArray = factores.Split('|');// factores[0].ToString().Split('|');
                                factorGlobal    = factorArray[0];
                                aseguradoraName = lector.GetValue(1).ToString();
                                organizationId  = lector.GetValue(2).ToString();
                            }
                            catch (Exception exception)
                            {
                                MessageBox.Show(exception.Message, " ¡ ERROR !", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                return;
                            }
                        }
                        lector.Close();
                        #endregion

                        #region Según el tipo de componente se hace el calculo
                        switch (i_KindOfService)
                        {
                        //CLINICA
                        case 1:
                        {
                            if (objComponentDto.r_PriceSegus != 0)
                            {
                                objServiceComponentDto.r_Price            = objComponentDto.r_PriceSegus;
                                objServiceComponentDto.d_SaldoPaciente    = importe;
                                objServiceComponentDto.d_SaldoAseguradora = (decimal)objComponentDto.r_PriceSegus - importe;
                            }
                            else
                            {
                                frmConfigSeguros frm1 = new frmConfigSeguros("1");
                                frm1.ShowDialog();
                                objServiceComponentDto.r_Price            = (float)frm1.nuevoPrecio;
                                objServiceComponentDto.d_SaldoPaciente    = importe;
                                objServiceComponentDto.d_SaldoAseguradora = frm1.nuevoPrecio - importe;
                            }
                        }
                        break;

                        //SERVICIOS AUXILIARES
                        case 2:
                        {
                            if (objComponentDto.r_PriceSegus != 0)
                            {
                                objServiceComponentDto.r_Price            = objComponentDto.r_PriceSegus * float.Parse(factorGlobal);
                                objServiceComponentDto.d_SaldoPaciente    = importeCo * (decimal)objServiceComponentDto.r_Price / 100;
                                objServiceComponentDto.d_SaldoAseguradora = (100 - importeCo) * (decimal)objServiceComponentDto.r_Price / 100;
                            }
                            else
                            {
                                frmConfigSeguros frm1 = new frmConfigSeguros(factorGlobal);
                                frm1.ShowDialog();
                                objServiceComponentDto.r_Price            = (float)frm1.nuevoPrecio;
                                objServiceComponentDto.d_SaldoPaciente    = importeCo * frm1.nuevoPrecio / 100;
                                objServiceComponentDto.d_SaldoAseguradora = (100 - importeCo) * frm1.nuevoPrecio / 100;
                            }
                        }
                        break;

                        //HONORARIOS MÉDICOS Y/O QUIRURGICOS
                        case 3:
                        {
                            if (objComponentDto.r_PriceSegus != 0)
                            {
                                objServiceComponentDto.r_Price            = objComponentDto.r_PriceSegus * float.Parse(factorGlobal);
                                objServiceComponentDto.d_SaldoPaciente    = importeCo * (decimal)objServiceComponentDto.r_Price / 100;
                                objServiceComponentDto.d_SaldoAseguradora = (100 - importeCo) * (decimal)objServiceComponentDto.r_Price / 100;
                            }
                            else
                            {
                                frmConfigSeguros frm1 = new frmConfigSeguros(factorGlobal);
                                frm1.ShowDialog();
                                objServiceComponentDto.r_Price            = (float)frm1.nuevoPrecio;
                                objServiceComponentDto.d_SaldoPaciente    = importeCo * frm1.nuevoPrecio / 100;
                                objServiceComponentDto.d_SaldoAseguradora = (100 - importeCo) * frm1.nuevoPrecio / 100;
                            }
                        }
                        break;
                        }
                        #endregion



                        objServiceComponentDto.v_ServiceId              = _serviceId;
                        objServiceComponentDto.i_ExternalInternalId     = (int)Common.ComponenteProcedencia.Interno;
                        objServiceComponentDto.i_ServiceComponentTypeId = 1;
                        objServiceComponentDto.i_IsVisibleId            = 1;
                        objServiceComponentDto.i_IsInheritedId          = (int)Common.SiNo.NO;
                        objServiceComponentDto.d_StartDate              = null;
                        objServiceComponentDto.d_EndDate                  = null;
                        objServiceComponentDto.i_index                    = 1;
                        objServiceComponentDto.v_ComponentId              = scid;
                        objServiceComponentDto.i_IsInvoicedId             = (int)Common.SiNo.NO;
                        objServiceComponentDto.i_ServiceComponentStatusId = (int)Common.ServiceStatus.PorIniciar;
                        objServiceComponentDto.i_QueueStatusId            = (int)Common.QueueStatusId.LIBRE;
                        objServiceComponentDto.i_Iscalling                = (int)Common.Flag_Call.NoseLlamo;
                        objServiceComponentDto.i_Iscalling_1              = (int)Common.Flag_Call.NoseLlamo;
                        objServiceComponentDto.i_IsManuallyAddedId        = (int)Common.SiNo.NO;
                        objServiceComponentDto.i_IsRequiredId             = (int)Common.SiNo.SI;
                        objServiceComponentDto.v_IdUnidadProductiva       = txtUnidProdId.Text;
                        objServiceComponentDto.i_MedicoTratanteId         = int.Parse(cboMedico.SelectedValue.ToString());
                        if (rbNuevaConsulta.Checked)
                        {
                            objServiceComponentDto.i_TipoDesc = 1;
                        }
                        else if (rbAdicional.Checked)
                        {
                            objServiceComponentDto.i_TipoDesc = 2;
                        }

                        _ObjServiceBL.AddServiceComponent(ref objOperationResult, objServiceComponentDto, Globals.ClientSession.GetAsList());
                        #region Update a service agrega el PlanId
                        cadena1 = "update service set " +
                                  "i_PlanId = '" + PlanId + "' " +
                                  "where v_ServiceId = '" + _serviceId + "' ";
                        comando = new SqlCommand(cadena1, connection: conectasam.conectarsigesoft);
                        lector  = comando.ExecuteReader();
                        lector.Close();
                        #endregion
                    }
                    else
                    {
                        FormPrecioComponente frm = new FormPrecioComponente(NombreComponente[0].ToString(), precio_base.ToString(), "");
                        frm.ShowDialog();
                        objServiceComponentDto.i_ConCargoA              = conCargoA;
                        objServiceComponentDto.v_ServiceId              = _serviceId;
                        objServiceComponentDto.i_ExternalInternalId     = (int)Common.ComponenteProcedencia.Interno;
                        objServiceComponentDto.i_ServiceComponentTypeId = 1;
                        objServiceComponentDto.i_IsVisibleId            = 1;
                        objServiceComponentDto.i_IsInheritedId          = (int)Common.SiNo.NO;
                        objServiceComponentDto.d_StartDate              = null;
                        objServiceComponentDto.d_EndDate                  = null;
                        objServiceComponentDto.i_index                    = 1;
                        objServiceComponentDto.r_Price                    = frm.Precio;
                        objServiceComponentDto.v_ComponentId              = scid;
                        objServiceComponentDto.i_IsInvoicedId             = (int)Common.SiNo.NO;
                        objServiceComponentDto.i_ServiceComponentStatusId = (int)Common.ServiceStatus.PorIniciar;
                        objServiceComponentDto.i_QueueStatusId            = (int)Common.QueueStatusId.LIBRE;
                        //objServiceComponentDto.i_IsRequiredId = (int)Common.SiNo.SI;
                        objServiceComponentDto.i_Iscalling          = (int)Common.Flag_Call.NoseLlamo;
                        objServiceComponentDto.i_Iscalling_1        = (int)Common.Flag_Call.NoseLlamo;
                        objServiceComponentDto.i_IsManuallyAddedId  = (int)Common.SiNo.NO;
                        objServiceComponentDto.i_IsRequiredId       = (int)Common.SiNo.SI;
                        objServiceComponentDto.v_IdUnidadProductiva = objComponentDto.v_IdUnidadProductiva;
                        objServiceComponentDto.i_MedicoTratanteId   = int.Parse(cboMedico.SelectedValue.ToString());
                        objServiceComponentDto.d_SaldoPaciente      = 0;
                        objServiceComponentDto.d_SaldoAseguradora   = 0;
                        _ObjServiceBL.AddServiceComponent(ref objOperationResult, objServiceComponentDto, Globals.ClientSession.GetAsList());
                    }
                }

                //Actualizo si son examenes adicionales
                if (_DataSource.Count > 0)
                {
                    new AdditionalExamBL().UpdateAdditionalExamByComponentIdAndServiceId(ComponentId[0], _serviceId,
                                                                                         Globals.ClientSession.i_SystemUserId);
                }
            }

            MessageBox.Show("Se grabo correctamente", " ¡ INFORMACIÓN !", MessageBoxButtons.OK, MessageBoxIcon.Information);
            this.DialogResult = DialogResult.OK;
        }
Ejemplo n.º 29
0
        private void btnGuardarTicket_Click(object sender, EventArgs e)
        {
            if (grdDataHabitaciones.Selected.Rows.Count == 0)
            {
                MessageBox.Show("Por favor, seleccione una habitación", "VALIDACIÓN", MessageBoxButtons.OK,
                                MessageBoxIcon.Warning);

                return;
            }

            if (grdDataHabitaciones.Selected.Rows[0].Cells["Estado"].Value.ToString() == "OCUPADO")
            {
                MessageBox.Show("No puede asignar una habitación que ya esta siendo usada", "VALIDACIÓN", MessageBoxButtons.OK,
                                MessageBoxIcon.Warning);

                return;
            }
            if (txtPrecio.Text == "" || txtPrecio.Text == null)
            {
                MessageBox.Show("Debe ingresar un precio.", "VALIDACIÓN", MessageBoxButtons.OK,
                                MessageBoxIcon.Warning);

                return;
            }
            OperationResult objOperationResult = new OperationResult();
            int             HabitacionId       = int.Parse(grdDataHabitaciones.Selected.Rows[0].Cells["i_HabitacionId"].Value.ToString());

            if (_hospitalizacionHabitaciónDto == null)
            {
                _hospitalizacionHabitaciónDto = new hospitalizacionhabitacionDto();
            }

            if (_mode == "NewASEGU" || _mode == "NewHOSPI")
            {
                _hospitalizacionHabitaciónDto.v_HopitalizacionId = _hospitalizacion;
                _hospitalizacionHabitaciónDto.i_HabitacionId     = HabitacionId;
                _hospitalizacionHabitaciónDto.d_StartDate        = dtpFechaInicio.Value;

                //_hospitalizacionHabitaciónDto.d_EndDate = (DateTime?)(dtpFechaFin.Checked == false ? (ValueType)null : dtpFechaFin.Value);
                decimal d;
                if (_mode == "NewASEGU")
                {
                    #region Conexion SIGESOFT Obtener Deducible de Habitacion
                    ConexionSigesoft conectasam = new ConexionSigesoft();
                    conectasam.opensigesoft();
                    var           cadena1   = "select PL.d_Importe from [dbo].[plan] PL where PL.v_IdUnidadProductiva='" + lineId + "' and PL.v_ProtocoloId='" + _v_ProtocoloId + "' ";
                    SqlCommand    comando   = new SqlCommand(cadena1, connection: conectasam.conectarsigesoft);
                    SqlDataReader lector    = comando.ExecuteReader();
                    string        deducible = "0.00";
                    while (lector.Read())
                    {
                        deducible = lector.GetValue(0).ToString();
                    }
                    lector.Close();
                    conectasam.closesigesoft();
                    #endregion
                    _hospitalizacionHabitaciónDto.d_Precio           = txtPrecio.Text != string.Empty ? decimal.TryParse(txtPrecio.Text, out d) ? d : 0 : (decimal?)null;
                    _hospitalizacionHabitaciónDto.d_SaldoPaciente    = decimal.Parse(deducible);
                    _hospitalizacionHabitaciónDto.d_SaldoAseguradora = decimal.Parse(txtPrecio.Text) - decimal.Parse(deducible);
                }
                else if (_mode == "NewHOSPI")
                {
                    _hospitalizacionHabitaciónDto.i_ConCargoA = rbMedicoTratante.Checked ? (int)CargoHospitalizacion.MedicoTratante : (int)CargoHospitalizacion.Paciente;
                    _hospitalizacionHabitaciónDto.d_Precio    = txtPrecio.Text != string.Empty ? decimal.TryParse(txtPrecio.Text, out d) ? d : 0 : (decimal?)null;
                }

                DialogResult Result = MessageBox.Show("¿Desea Guardar Habitación?", "ADVERTENCIA!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

                if (Result == System.Windows.Forms.DialogResult.Yes)
                {
                    bool IsUpdateHabitacion = new HabitacionBL().UpdateEstateHabitacionByHospId(_hospitalizacion);
                    _hospitalizacionHabitaciónDto.i_EstateRoom = (int)EstadoHabitacion.Ocupado;
                    habitacionId = _hospitalizacionBL.AddHospitalizacionHabitacion(ref objOperationResult, _hospitalizacionHabitaciónDto, Globals.ClientSession.GetAsList());

                    if (IsUpdateHabitacion)
                    {
                        MessageBox.Show(
                            "El estado de la habitación anterior será de 'En Limpieza', por favor dar aviso al personal correspondiente",
                            "AVISO", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        this.Close();
                    }
                }
                else
                {
                    this.Close();
                }
            }
            else if (_mode == "EditASEGU" || _mode == "EditHOSPI")
            {
                if (dtpFechaInicio.Value > dtFin.Value)
                {
                    MessageBox.Show("La fecha de INICIO no puede ser mayor a la fecha FINAL", "VALIDACIÓN!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                _hospitalizacionHabitaciónDto.v_HopitalizacionId = _hospitalizacion;
                _hospitalizacionHabitaciónDto.i_HabitacionId     = HabitacionId;
                _hospitalizacionHabitaciónDto.d_StartDate        = dtpFechaInicio.Value;
                _hospitalizacionHabitaciónDto.d_EndDate          = dtFin.Value;
                _hospitalizacionHabitaciónDto.i_ConCargoA        = rbMedicoTratante.Checked ? (int)CargoHospitalizacion.MedicoTratante : (int)CargoHospitalizacion.Paciente;

                decimal d;
                if (_mode == "EditASEGU")
                {
                    _hospitalizacionHabitaciónDto.d_Precio           = txtPrecio.Text != string.Empty ? decimal.TryParse(txtPrecio.Text, out d) ? d : 0 : (decimal?)null;
                    _hospitalizacionHabitaciónDto.d_SaldoAseguradora = txtPrecio.Text != string.Empty ? decimal.TryParse(txtPrecio.Text, out d) ? d : 0 : (decimal?)null;
                }
                else if (_mode == "EditHOSPI")
                {
                    _hospitalizacionHabitaciónDto.d_Precio = txtPrecio.Text != string.Empty ? decimal.TryParse(txtPrecio.Text, out d) ? d : 0 : (decimal?)null;
                }
                _hospitalizacionHabitaciónDto.d_Precio = txtPrecio.Text != string.Empty ? decimal.TryParse(txtPrecio.Text, out d) ? d : 0 : (decimal?)null;

                DialogResult Result = MessageBox.Show("¿Desea Guardar Habitación?", "ADVERTENCIA!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

                if (Result == System.Windows.Forms.DialogResult.Yes)
                {
                    _hospitalizacionBL.UpdateHospitalizacionHabitacion(ref objOperationResult, _hospitalizacionHabitaciónDto, Globals.ClientSession.GetAsList());
                    this.Close();
                }
                else
                {
                    this.Close();
                }
            }
        }