예제 #1
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();
                    }
                }
            }
        }
예제 #2
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;
            }
        }